@gjsify/example-node-express-webserver 0.4.20 → 0.4.21
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 +5 -5
package/dist/index.gjs.js
CHANGED
|
@@ -183,7 +183,7 @@ var n=qa()(`finalhandler`),r=Wc(),i=Gc(),a=Bo(),o=Kc(),s=Za(),c=a.isFinished;fun
|
|
|
183
183
|
</body>
|
|
184
184
|
</html>
|
|
185
185
|
`}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()}})),Jc,__exportAll,Yc=__esmMin(()=>{Jc=Object.defineProperty,__exportAll=(e,t)=>{let n={};for(var r in e)Jc(n,r,{get:e[r],enumerable:!0});return t||Jc(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 Xc=__esmMin(()=>{q()}),Dirent,Zc=__esmMin(()=>{P(),Wa(),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||=La(e),this.name=t,this.parentPath=Ia(e),this._file=N.File.new_for_path(e),n??this._file.query_file_type(N.FileQueryInfoFlags.NONE,null)){case N.FileType.DIRECTORY:this._isDirectory=!0;break;case N.FileType.MOUNTABLE:break;case N.FileType.REGULAR:this._isFile=!0;break;case N.FileType.SYMBOLIC_LINK:case N.FileType.SHORTCUT:this._isSymbolicLink=!0;break;case N.FileType.SPECIAL:this._classifySpecialFile(e);break}}_classifySpecialFile(e){try{let t=N.File.new_for_path(e).query_info(`unix::mode`,N.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 Qc,Stats,BigIntStats,$c=__esmMin(()=>{Zc(),P(),Wa(),Qc=`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 N.FileInfo?(r=e,i=t.toString(),n||=La(i)):(i=e.toString(),typeof t==`string`&&(n=t),n||=La(i),r=N.File.new_for_path(i).query_info(Qc,N.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 N.FileInfo?(r=e,i=t.toString(),n||=La(i)):(i=e.toString(),typeof t==`string`&&(n=t),n||=La(i),r=N.File.new_for_path(i).query_info(Qc,N.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(()=>{El(),j(),P(),q(),Fr(),ReadStream=class extends kr{bytesRead=0;path;pending=!0;fd=null;_gioFile;_inputStream=null;_cancellable=new N.Cancellable;_start;_end;_pos;close(e){this._cancellable.cancel(),this._inputStream&&=(this._inputStream.close_async(A.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=N.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(A.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,A.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,A.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(A.PRIORITY_DEFAULT,null,()=>{}),null),t(e)}}});function createNodeError(e,t,n,r){return createNodeError$1(e,t,{path:n.toString(),dest:r?.toString()})}var tl=__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=N.FileCopyFlags.NONE;return t&&(n|=N.FileCopyFlags.OVERWRITE),e.preserveTimestamps&&(n|=N.FileCopyFlags.TARGET_DEFAULT_MODIFIED_TIME),e.dereference||(n|=N.FileCopyFlags.NOFOLLOW_SYMLINKS),n}function copyOneSyncFile(e,t,n,r,i){let a=i.force??!0;try{if(t.query_info(`standard::type`,N.FileQueryInfoFlags.NONE,null).get_file_type()===N.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`,N.FileQueryInfoFlags.NONE,null).get_file_type()!==N.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?N.FileQueryInfoFlags.NONE:N.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=Na(n,e),a=Na(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=N.File.new_for_path(e),i=N.File.new_for_path(t),a;try{a=r.query_info(`standard::type,standard::is-symlink`,n.dereference?N.FileQueryInfoFlags.NONE:N.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(t){throw createNodeError(t,`stat`,e)}if(a.get_file_type()===N.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=N.File.new_for_path(r),s=a.filter;if(!(s&&!s(r,i))){try{if(o.query_info(`standard::type`,a.dereference?N.FileQueryInfoFlags.NONE:N.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null).get_file_type()===N.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=N.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=N.File.new_for_path(e),o;try{o=a.enumerate_children(`standard::name,standard::type`,n.dereference?N.FileQueryInfoFlags.NONE:N.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=Na(e,r),a=Na(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=N.File.new_for_path(r),o;try{o=a.query_info(`standard::type`,n.dereference?N.FileQueryInfoFlags.NONE:N.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(e){throw createNodeError(e,`stat`,r)}if(o.get_file_type()===N.FileType.DIRECTORY){if(!n.recursive)throw makeEISDIR(r);await cpPromisesDir(r,i,n)}else copyOneSyncFile(a,N.File.new_for_path(i),r,i,n)}var nl=__esmMin(()=>{El(),tl(),P(),Wa()});function _openDir(e){let t=N.File.new_for_path(e),n;try{n=t.enumerate_children(rl,N.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=N.File.new_for_path(r);i.enumerate_children_async(rl,N.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,A.PRIORITY_DEFAULT,null,(e,a)=>{try{t(new Dir(r,i.enumerate_children_finish(a)))}catch(e){n(createNodeError(e,`opendir`,r))}})})}var rl,Dir,il=__esmMin(()=>{El(),Zc(),tl(),j(),P(),rl=`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 al=__esmMin(()=>{El(),Tl()});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/sl),i=Math.floor(n/sl);return{type:0,bsize:sl,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(sl),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=N.File.new_for_path(normalizePath(e)).query_filesystem_info(ol,null);return t?.bigint===!0?buildBigIntStatFs(n):buildStatFs(n)}function queryFsInfoAsync(e,t){return new Promise((n,r)=>{let i=N.File.new_for_path(normalizePath(e));i.query_filesystem_info_async(ol,A.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){typeof t==`function`&&(n=t,t={}),queryFsInfoAsync(e,t?.bigint===!0).then(e=>n(null,e),e=>n(e,null))}async function statfsAsync(e,t){return queryFsInfoAsync(e,t?.bigint===!0)}var ol,sl,cl=__esmMin(()=>{El(),j(),P(),ol=[`filesystem::size`,`filesystem::free`].join(`,`),sl=4096}),ll=__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 A.DateTime.new_from_unix_utc(Math.floor(t/1e3))}function setTimestamps(e,t,n,r){let i=N.File.new_for_path(e),a=new N.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,N.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,N.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){A.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 ul=__esmMin(()=>{El(),j(),P()});function getFH(e){return e instanceof Cl?Cl.getInstance(e.fd):Cl.getInstance(e)}function fstatSync(e,t){return statSync(normalizePath(getFH(e).options.path),t)}function fstat(e,t,n){typeof t==`function`&&(n=t,t={}),Promise.resolve().then(()=>fstatSync(e,t)).then(e=>n(null,e),n)}async function fstatAsync(e,t){return fstatSync(e,t)}function ftruncateSync(e,t=0){truncateSync(normalizePath(getFH(e).options.path),t)}function ftruncate(e,t,n){typeof t==`function`&&(n=t,t=0),Promise.resolve().then(()=>ftruncateSync(e,t)).then(()=>n(null),n)}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){typeof n==`function`&&(r=n,n=null),Promise.resolve().then(()=>({bytesRead:readvSync(e,t,n),buffers:t})).then(e=>r(null,e.bytesRead,e.buffers),r)}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){typeof n==`function`&&(r=n,n=null),Promise.resolve().then(()=>({bytesWritten:writevSync(e,t,n),buffers:t})).then(e=>r(null,e.bytesWritten,e.buffers),r)}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 dl=__esmMin(()=>{El(),wl(),Tl(),ul()});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=N.File.new_for_path(r);return new Promise((e,t)=>{i.make_directory_async(A.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=N.File.new_for_path(e);try{return await new Promise((e,n)=>{t.make_directory_async(A.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===N.IOErrorEnum.EXISTS)return;if(n.code===N.IOErrorEnum.NOT_FOUND){let n=Ia(e);if(n===e)throw createNodeError(t,`mkdir`,e);let r=await mkdirRecursiveAsync(n),i=N.File.new_for_path(e);return await new Promise((t,n)=>{i.make_directory_async(A.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=N.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=N.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,N.FileCreateFlags.REPLACE_DESTINATION,A.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 A.Bytes(i);await new Promise((t,r)=>{a.write_bytes_async(e,A.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(A.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=N.File.new_for_path(n);if((await new Promise((e,t)=>{r.query_info_async(`standard::type`,N.FileQueryInfoFlags.NONE,A.PRIORITY_DEFAULT,null,(i,a)=>{try{e(r.query_info_finish(a))}catch(e){t(createNodeError(e,`rmdir`,n))}})})).get_file_type()!==N.FileType.DIRECTORY)throw createNodeError(Object.assign(Error(),{code:4}),`rmdir`,n);if((await new Promise((e,t)=>{r.enumerate_children_async(`standard::name`,N.FileQueryInfoFlags.NONE,A.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(A.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=N.File.new_for_path(t);await new Promise((e,r)=>{n.delete_async(A.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 Cl({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 Cl.getInstance(e).write(t,n,r,i)).bytesWritten,buffer:t}}async function _writeStr(e,t,n,r){return{bytesWritten:(await Cl.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=N.File.new_for_path(i);o.query_info_async(Qc,t,A.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,N.FileQueryInfoFlags.NONE,`stat`,t)}async function lstat$1(e,t){return queryInfoAsync(e,N.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=N.File.new_for_path(r);n.make_symbolic_link_async(i,A.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=N.File.new_for_path(n),i=t?.recursive||!1,a=t?.force||!1,o;try{o=new Dirent(n)}catch(t){if(a)return;throw createNodeError(t,`rm`,e)}if(o.isDirectory()){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(Na(n,e.name),t)}await new Promise((t,n)=>{r.delete_async(A.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 fl,pl,ml=__esmMin(()=>{Yc(),Xc(),El(),Ol(),Zc(),$c(),wl(),tl(),Tl(),nl(),il(),al(),cl(),ul(),dl(),j(),P(),Wa(),fl=__exportAll({access:()=>access$1,appendFile:()=>appendFile$1,chmod:()=>chmod$1,chown:()=>chown$1,copyFile:()=>copyFile$1,cp:()=>cpPromises,default:()=>pl,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`),pl={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=N.File.new_for_path(a);o.query_info_async(Qc,t,A.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,N.FileQueryInfoFlags.NONE,`stat`,r,i)}function lstat(e,t,n){let{options:r,callback:i}=parseOptsCb(t,n);statImpl(e,N.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=N.File.new_for_path(a);s.make_symbolic_link_async(o,A.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=Cl.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=Cl.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){Cl.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(!A.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{A.unlink(n),t(null)}catch(e){t(e)}})}var hl=__esmMin(()=>{El(),$c(),wl(),tl(),Tl(),ml(),j(),P(),q()});function toPathIfFileURL(e){return normalizePath(e)}function createWriteStream(e,t){return new WriteStream(e,t)}var gl,_l,WriteStream,vl=__esmMin(()=>{El(),hl(),Fr(),gl=Symbol(`kIsPerformingIO`),_l=Symbol(`kIoDone`),WriteStream=class extends Ar{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;[gl]=!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[gl]=!0,write(this.fd,e,0,e.length,this.pos,(e,t)=>{if(this[gl]=!1,this.destroyed)return n(e),this.emit(_l,e);if(e)return n(e);this.bytesWritten+=t,n()}),this.pos!==void 0&&(this.pos+=e.length)}_destroy(e,t){this[gl]?this.once(_l,n=>this.close(t,e||n)):this.close(t,e)}}});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===`
|
|
186
|
-
`?(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[bl])return;n[bl]=new oo(`utf8`),n[xl]=emitKeys(e),n[xl].next();let r=t.escapeCodeTimeout??500,i,triggerEscape=()=>n[xl].next(``);function onData(t){if(e.listenerCount(`keypress`)>0){let a=n[bl].write(typeof t==`string`?Buffer.from(t):t);if(a){clearTimeout(i);for(let t of a)try{n[xl].next(t),t===`\x1B`&&(i=setTimeout(triggerEscape,r))}catch{n[xl]=emitKeys(e),n[xl].next()}}}else e.removeListener(`data`,onData),delete n[bl],delete n[xl]}e.on(`data`,onData)}var yl,Interface,bl,xl,Sl=__esmMin(()=>{ln(),co(),yl=/\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=yl.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}}}},bl=Symbol(`keypress-decoder`),xl=Symbol(`escape-decoder`)});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 openIOChannel(e,t,n){try{return A.IOChannel.new_file(e,t)}catch(r){if(n&&t===`r+`&&r?.code===A.FileError.NOENT)return A.file_set_contents(e,new Uint8Array),A.IOChannel.new_file(e,t);throw r}}function mapOpenError(e,t){return createGLibFileError(e,`open`,{path:t})}var Cl,wl=__esmMin(()=>{Xc(),El(),el(),vl(),$c(),Tl(),j(),P(),q(),L(),Sl(),Cl=class FileHandle{options;_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=typeof e.flags==`number`&&(e.flags&64)!=0,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=N.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===A.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),A.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===A.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(Qc,N.FileQueryInfoFlags.NONE,A.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(()=>(ul(),ll));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,A.SeekType.SET);let[i]=this._file.write_chars(r,r.length);if(i===A.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),A.SeekType.SET,null);let t=e.get_output_stream(),n=await new Promise((e,n)=>{t.write_bytes_async(new A.Bytes(l),A.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(A.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{}delete FileHandle.instances[this.fd]}_readSync(e,t,n,r){let i=this._gFile.read(null);try{r!==null&&r>=0&&i.seek(r,A.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,A.SeekType.SET,null),n.get_output_stream().write_bytes(A.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()}}});function statSync(e,t){let n=normalizePath(e);try{let e=N.File.new_for_path(n).query_info(Qc,N.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=N.File.new_for_path(n).query_info(Qc,N.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=N.File.new_for_path(n).enumerate_children(`standard::name,standard::type`,N.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null),i=[],a=r.next_file(null);for(;a!==null;){let e=a.get_name(),o=Na(n,e),s=a.get_file_type();if(t?.withFileTypes?i.push(new Dirent(o,e,s)):i.push(e),t?.recursive&&s===N.FileType.DIRECTORY){let n=readdirSync(o,t);for(let t of n)typeof t==`string`?i.push(Na(e,t)):i.push(t)}a=r.next_file(null)}return i}function realpathSync(e){let t=normalizePath(e),n=N.File.new_for_path(t),r=0;for(;;){let e=n.query_info(`standard::is-symlink,standard::symlink-target`,N.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):N.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);N.File.new_for_path(r).make_symbolic_link(i,null)}function readFileSync(e,t={encoding:null,flag:`r`}){let n=normalizePath(e),r=N.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,r);let i=N.File.new_for_path(e);try{i.make_directory(null)}catch(t){throw createNodeError(t,`mkdir`,e)}}function mkdirSyncRecursive(e,t){let n=N.File.new_for_path(e);try{return n.make_directory(null),e}catch(n){let r=n;if(r.code===N.IOErrorEnum.EXISTS)return;if(r.code===N.IOErrorEnum.NOT_FOUND){let r=Na(e,`..`),i=N.File.new_for_path(r).get_path();if(i===e)throw createNodeError(n,`mkdir`,e);let a=mkdirSyncRecursive(i,t),o=N.File.new_for_path(e);try{o.make_directory(null)}catch(t){throw createNodeError(t,`mkdir`,e)}return a??e}throw createNodeError(n,`mkdir`,e)}}function rmdirSync(e,t){let n=normalizePath(e),r=N.File.new_for_path(n);try{if(r.query_info(`standard::type`,N.FileQueryInfoFlags.NONE,null).get_file_type()!==N.FileType.DIRECTORY)throw createNodeError(Object.assign(Error(),{code:4}),`rmdir`,n);if(r.enumerate_children(`standard::name`,N.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=N.File.new_for_path(t);try{n.delete(null)}catch(e){throw createNodeError(e,`unlink`,t)}}function writeFileSync(e,t){A.file_set_contents(normalizePath(e),t)}function renameSync(e,t){let n=normalizePath(e),r=normalizePath(t),i=N.File.new_for_path(n),a=N.File.new_for_path(r);try{i.move(a,N.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=N.File.new_for_path(r),o=N.File.new_for_path(i),s=N.FileCopyFlags.NONE;n&&!(n&1)?s=N.FileCopyFlags.OVERWRITE:n||(s=N.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=N.File.new_for_path(n);try{let e=r.query_info(`access::*`,N.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=N.File.new_for_path(r),a;a=typeof t==`string`?new TextEncoder().encode(t):t;try{let e=i.append_to(N.FileCreateFlags.NONE,null);a.length>0&&e.write_bytes(new A.Bytes(a),null),e.close(null)}catch(e){throw createNodeError(e,`appendfile`,r)}}function readlinkSync(e,t){let n=normalizePath(e),r=N.File.new_for_path(n);try{let e=r.query_info(`standard::symlink-target`,N.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(!A.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=N.File.new_for_path(n);try{let e=r.replace(null,!1,N.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 A.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(!A.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(!A.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 Cl({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=N.File.new_for_path(n),i=t?.recursive||!1,a=t?.force||!1,o;try{o=new Dirent(n)}catch(t){if(a&&isNotFoundError(t))return;throw createNodeError(t,`rm`,e)}if(o.isDirectory()){let r=readdirSync(e,{withFileTypes:!0});if(!i&&r.length)throw createNodeError(Object.assign(Error(),{code:5}),`rm`,e);for(let e of r)typeof e!=`string`&&rmSync(Na(n,e.name),t)}try{r.delete(null)}catch(t){if(a&&isNotFoundError(t))return;throw createNodeError(t,`rm`,e)}}var Tl=__esmMin(()=>{Xc(),El(),Ol(),Zc(),$c(),wl(),tl(),j(),P(),Wa(),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 El=__esmMin(()=>{Tl(),xn()});function changed(e,t,n,r){switch(r){case N.FileMonitorEvent.CHANGES_DONE_HINT:this.emit(`change`,`change`,t.get_basename());break;case N.FileMonitorEvent.DELETED:case N.FileMonitorEvent.CREATED:case N.FileMonitorEvent.RENAMED:case N.FileMonitorEvent.MOVED_IN:case N.FileMonitorEvent.MOVED_OUT:this.emit(`rename`,`rename`,t.get_basename());break}}function gioEventToNodeType(e){switch(e){case N.FileMonitorEvent.CHANGES_DONE_HINT:return`change`;case N.FileMonitorEvent.DELETED:case N.FileMonitorEvent.CREATED:case N.FileMonitorEvent.RENAMED:case N.FileMonitorEvent.MOVED_IN:case N.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=N.File.new_for_path(r),a=N.Cancellable.new(),o;try{o=i.monitor(N.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 Dl,FSWatcher,Ol=__esmMin(()=>{El(),j(),P(),ln(),Dl=new WeakMap,FSWatcher=class extends J{constructor(e,t,n){super(),(!t||typeof t!=`object`)&&(t={persistent:!0});let r=t.persistent!==!1,i=N.Cancellable.new(),a=normalizePath(e),o=N.File.new_for_path(a).monitor(N.FileMonitorFlags.NONE,i);o.connect(`changed`,changed.bind(this));let s=null;r&&(s=A.timeout_add(A.PRIORITY_LOW,2147483647,()=>A.SOURCE_CONTINUE)),Dl.set(this,{persistent:r,cancellable:i,sourceId:s,watcher:o}),n&&this.on(`change`,n)}close(){let e=Dl.get(this);e.cancellable.is_cancelled()||(e.cancellable.cancel(),e.sourceId!==null&&(A.source_remove(e.sourceId),e.sourceId=null))}ref(){let e=Dl.get(this);return!e.persistent&&!e.cancellable.is_cancelled()&&(e.persistent=!0,e.sourceId=A.timeout_add(A.PRIORITY_LOW,2147483647,()=>A.SOURCE_CONTINUE)),this}unref(){let e=Dl.get(this);return e.persistent&&(e.persistent=!1,e.sourceId!==null&&(A.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=kl.get(i);return a||(a=new StatWatcher(i,r),a.start(),kl.set(i,a)),n&&a.addChangeListener(n),a}function unwatchFile(e,t){let n=e.toString(),r=kl.get(n);r&&(t?r.removeChangeListener(t):r.removeAllChangeListeners(),r.changeListenerCount===0&&(r.stop(),kl.delete(n)))}var StatWatcher,kl,Al=__esmMin(()=>{Tl(),ln(),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}},kl=new Map}),jl=__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:()=>Ml,copyFile:()=>copyFile,copyFileSync:()=>copyFileSync,cp:()=>cp,cpSync:()=>cpSync,createReadStream:()=>createReadStream,createWriteStream:()=>createWriteStream,default:()=>Nl,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:()=>fl,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}),Ml,Nl,Pl=__esmMin(()=>{Ol(),el(),vl(),Zc(),$c(),Tl(),nl(),il(),al(),cl(),ul(),dl(),ml(),hl(),Al(),Ml={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},Nl={FSWatcher,StatWatcher,Stats,BigIntStats,Dirent,Dir,constants:Ml,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:fl,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}}),Fl=__commonJSMin(((e,t)=>{
|
|
186
|
+
`?(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[bl])return;n[bl]=new oo(`utf8`),n[xl]=emitKeys(e),n[xl].next();let r=t.escapeCodeTimeout??500,i,triggerEscape=()=>n[xl].next(``);function onData(t){if(e.listenerCount(`keypress`)>0){let a=n[bl].write(typeof t==`string`?Buffer.from(t):t);if(a){clearTimeout(i);for(let t of a)try{n[xl].next(t),t===`\x1B`&&(i=setTimeout(triggerEscape,r))}catch{n[xl]=emitKeys(e),n[xl].next()}}}else e.removeListener(`data`,onData),delete n[bl],delete n[xl]}e.on(`data`,onData)}var yl,Interface,bl,xl,Sl=__esmMin(()=>{ln(),co(),yl=/\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=yl.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}}}},bl=Symbol(`keypress-decoder`),xl=Symbol(`escape-decoder`)});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 openIOChannel(e,t,n){try{return A.IOChannel.new_file(e,t)}catch(r){if(n&&t===`r+`&&r?.code===A.FileError.NOENT)return A.file_set_contents(e,new Uint8Array),A.IOChannel.new_file(e,t);throw r}}function mapOpenError(e,t){return createGLibFileError(e,`open`,{path:t})}var Cl,wl=__esmMin(()=>{Xc(),El(),el(),vl(),$c(),Tl(),j(),P(),q(),L(),Sl(),Cl=class FileHandle{options;_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=typeof e.flags==`number`&&(e.flags&64)!=0,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=N.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===A.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),A.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===A.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(Qc,N.FileQueryInfoFlags.NONE,A.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(()=>(ul(),ll));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,A.SeekType.SET);let[i]=this._file.write_chars(r,r.length);if(i===A.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),A.SeekType.SET,null);let t=e.get_output_stream(),n=await new Promise((e,n)=>{t.write_bytes_async(new A.Bytes(l),A.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(A.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{}delete FileHandle.instances[this.fd]}_readSync(e,t,n,r){let i=this._gFile.read(null);try{r!==null&&r>=0&&i.seek(r,A.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,A.SeekType.SET,null),n.get_output_stream().write_bytes(A.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()}}});function statSync(e,t){let n=normalizePath(e);try{let e=N.File.new_for_path(n).query_info(Qc,N.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=N.File.new_for_path(n).query_info(Qc,N.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=N.File.new_for_path(n).enumerate_children(`standard::name,standard::type`,N.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=Na(n,e.name);if(t?.withFileTypes?a.push(new Dirent(r,e.name,e.type)):a.push(e.name),t?.recursive&&e.type===N.FileType.DIRECTORY){let n=readdirSync(r,t);for(let t of n)typeof t==`string`?a.push(Na(e.name,t)):a.push(t)}}return a}function realpathSync(e){let t=normalizePath(e),n=N.File.new_for_path(t),r=0;for(;;){let e=n.query_info(`standard::is-symlink,standard::symlink-target`,N.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):N.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);N.File.new_for_path(r).make_symbolic_link(i,null)}function readFileSync(e,t={encoding:null,flag:`r`}){let n=normalizePath(e),r=N.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,r);let i=N.File.new_for_path(e);try{i.make_directory(null)}catch(t){throw createNodeError(t,`mkdir`,e)}}function mkdirSyncRecursive(e,t){let n=N.File.new_for_path(e);try{return n.make_directory(null),e}catch(n){let r=n;if(r.code===N.IOErrorEnum.EXISTS)return;if(r.code===N.IOErrorEnum.NOT_FOUND){let r=Na(e,`..`),i=N.File.new_for_path(r).get_path();if(i===e)throw createNodeError(n,`mkdir`,e);let a=mkdirSyncRecursive(i,t),o=N.File.new_for_path(e);try{o.make_directory(null)}catch(t){throw createNodeError(t,`mkdir`,e)}return a??e}throw createNodeError(n,`mkdir`,e)}}function rmdirSync(e,t){let n=normalizePath(e),r=N.File.new_for_path(n);try{if(r.query_info(`standard::type`,N.FileQueryInfoFlags.NONE,null).get_file_type()!==N.FileType.DIRECTORY)throw createNodeError(Object.assign(Error(),{code:4}),`rmdir`,n);if(r.enumerate_children(`standard::name`,N.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=N.File.new_for_path(t);try{n.delete(null)}catch(e){throw createNodeError(e,`unlink`,t)}}function writeFileSync(e,t){A.file_set_contents(normalizePath(e),t)}function renameSync(e,t){let n=normalizePath(e),r=normalizePath(t),i=N.File.new_for_path(n),a=N.File.new_for_path(r);try{i.move(a,N.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=N.File.new_for_path(r),o=N.File.new_for_path(i),s=N.FileCopyFlags.NONE;n&&!(n&1)?s=N.FileCopyFlags.OVERWRITE:n||(s=N.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=N.File.new_for_path(n);try{let e=r.query_info(`access::*`,N.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=N.File.new_for_path(r),a;a=typeof t==`string`?new TextEncoder().encode(t):t;try{let e=i.append_to(N.FileCreateFlags.NONE,null);a.length>0&&e.write_bytes(new A.Bytes(a),null),e.close(null)}catch(e){throw createNodeError(e,`appendfile`,r)}}function readlinkSync(e,t){let n=normalizePath(e),r=N.File.new_for_path(n);try{let e=r.query_info(`standard::symlink-target`,N.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(!A.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=N.File.new_for_path(n);try{let e=r.replace(null,!1,N.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 A.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(!A.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(!A.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 Cl({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=N.File.new_for_path(n),i=t?.recursive||!1,a=t?.force||!1,o;try{o=new Dirent(n)}catch(t){if(a&&isNotFoundError(t))return;throw createNodeError(t,`rm`,e)}if(o.isDirectory()){let r=readdirSync(e);if(!i&&r.length)throw createNodeError(Object.assign(Error(),{code:5}),`rm`,e);for(let e of r)rmSync(Na(n,e),t)}try{r.delete(null)}catch(t){if(a&&isNotFoundError(t))return;throw createNodeError(t,`rm`,e)}}var Tl=__esmMin(()=>{Xc(),El(),Ol(),Zc(),$c(),wl(),tl(),j(),P(),Wa(),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 El=__esmMin(()=>{Tl(),xn()});function changed(e,t,n,r){switch(r){case N.FileMonitorEvent.CHANGES_DONE_HINT:this.emit(`change`,`change`,t.get_basename());break;case N.FileMonitorEvent.DELETED:case N.FileMonitorEvent.CREATED:case N.FileMonitorEvent.RENAMED:case N.FileMonitorEvent.MOVED_IN:case N.FileMonitorEvent.MOVED_OUT:this.emit(`rename`,`rename`,t.get_basename());break}}function gioEventToNodeType(e){switch(e){case N.FileMonitorEvent.CHANGES_DONE_HINT:return`change`;case N.FileMonitorEvent.DELETED:case N.FileMonitorEvent.CREATED:case N.FileMonitorEvent.RENAMED:case N.FileMonitorEvent.MOVED_IN:case N.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=N.File.new_for_path(r),a=N.Cancellable.new(),o;try{o=i.monitor(N.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 Dl,FSWatcher,Ol=__esmMin(()=>{El(),j(),P(),ln(),Dl=new WeakMap,FSWatcher=class extends J{constructor(e,t,n){super(),(!t||typeof t!=`object`)&&(t={persistent:!0});let r=t.persistent!==!1,i=N.Cancellable.new(),a=normalizePath(e),o=N.File.new_for_path(a).monitor(N.FileMonitorFlags.NONE,i);o.connect(`changed`,changed.bind(this));let s=null;r&&(s=A.timeout_add(A.PRIORITY_LOW,2147483647,()=>A.SOURCE_CONTINUE)),Dl.set(this,{persistent:r,cancellable:i,sourceId:s,watcher:o}),n&&this.on(`change`,n)}close(){let e=Dl.get(this);e.cancellable.is_cancelled()||(e.cancellable.cancel(),e.sourceId!==null&&(A.source_remove(e.sourceId),e.sourceId=null))}ref(){let e=Dl.get(this);return!e.persistent&&!e.cancellable.is_cancelled()&&(e.persistent=!0,e.sourceId=A.timeout_add(A.PRIORITY_LOW,2147483647,()=>A.SOURCE_CONTINUE)),this}unref(){let e=Dl.get(this);return e.persistent&&(e.persistent=!1,e.sourceId!==null&&(A.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=kl.get(i);return a||(a=new StatWatcher(i,r),a.start(),kl.set(i,a)),n&&a.addChangeListener(n),a}function unwatchFile(e,t){let n=e.toString(),r=kl.get(n);r&&(t?r.removeChangeListener(t):r.removeAllChangeListeners(),r.changeListenerCount===0&&(r.stop(),kl.delete(n)))}var StatWatcher,kl,Al=__esmMin(()=>{Tl(),ln(),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}},kl=new Map}),jl=__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:()=>Ml,copyFile:()=>copyFile,copyFileSync:()=>copyFileSync,cp:()=>cp,cpSync:()=>cpSync,createReadStream:()=>createReadStream,createWriteStream:()=>createWriteStream,default:()=>Nl,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:()=>fl,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}),Ml,Nl,Pl=__esmMin(()=>{Ol(),el(),vl(),Zc(),$c(),Tl(),nl(),il(),al(),cl(),ul(),dl(),ml(),hl(),Al(),Ml={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},Nl={FSWatcher,StatWatcher,Stats,BigIntStats,Dirent,Dir,constants:Ml,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:fl,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}}),Fl=__commonJSMin(((e,t)=>{
|
|
187
187
|
/*!
|
|
188
188
|
* express
|
|
189
189
|
* Copyright(c) 2009-2013 TJ Holowaychuk
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/example-node-express-webserver",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.21",
|
|
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.4.
|
|
24
|
+
"@gjsify/http-soup-bridge": "^0.4.21"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@gjsify/cli": "^0.4.
|
|
28
|
-
"@gjsify/node-globals": "^0.4.
|
|
29
|
-
"@gjsify/runtime": "^0.4.
|
|
27
|
+
"@gjsify/cli": "^0.4.21",
|
|
28
|
+
"@gjsify/node-globals": "^0.4.21",
|
|
29
|
+
"@gjsify/runtime": "^0.4.21",
|
|
30
30
|
"@types/express": "^5.0.6",
|
|
31
31
|
"@types/node": "^25.6.2",
|
|
32
32
|
"express": "^5.2.1",
|