diff options
author | 2023-08-04 03:35:04 +0800 | |
---|---|---|
committer | 2023-08-03 12:35:04 -0700 | |
commit | 2c9ff9584a0294a2e65a995d0012dd1e9a7aedc3 (patch) | |
tree | 01810f5ec36e148e679fb1fb5be77265bfa71a73 /src/js/out/InternalModuleRegistryConstants.h | |
parent | 30dde625214daf60c8ee4d1a7d132bdb3a175f17 (diff) | |
download | bun-2c9ff9584a0294a2e65a995d0012dd1e9a7aedc3.tar.gz bun-2c9ff9584a0294a2e65a995d0012dd1e9a7aedc3.tar.zst bun-2c9ff9584a0294a2e65a995d0012dd1e9a7aedc3.zip |
Minor optimization: Avoid extra copying when the chunk has only one element. (#3946)
* Optimize the case where there is only one chunk.
* add generated code
Diffstat (limited to 'src/js/out/InternalModuleRegistryConstants.h')
-rw-r--r-- | src/js/out/InternalModuleRegistryConstants.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/js/out/InternalModuleRegistryConstants.h b/src/js/out/InternalModuleRegistryConstants.h index fca984312..210ac6921 100644 --- a/src/js/out/InternalModuleRegistryConstants.h +++ b/src/js/out/InternalModuleRegistryConstants.h @@ -22,7 +22,7 @@ static constexpr ASCIILiteral NodeDomainCode = "(function (){\"use strict\";var static constexpr ASCIILiteral NodeEventsCode = "(function (){\"use strict\";const{throwNotImplemented}=@getInternalField(@internalModuleRegistry,2)||@createInternalModuleById(2),SymbolFor=Symbol.for,kCapture=Symbol(\"kCapture\"),kErrorMonitor=SymbolFor(\"events.errorMonitor\"),kMaxEventTargetListeners=Symbol(\"events.maxEventTargetListeners\"),kMaxEventTargetListenersWarned=Symbol(\"events.maxEventTargetListenersWarned\"),kWatermarkData=SymbolFor(\"nodejs.watermarkData\"),kRejection=SymbolFor(\"nodejs.rejection\"),captureRejectionSymbol=SymbolFor(\"nodejs.rejection\"),ArrayPrototypeSlice=Array.prototype.slice;var defaultMaxListeners=10;const EventEmitter=function EventEmitter(opts){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners\?\?=void 0,this[kCapture]=opts\?.captureRejections\?Boolean(opts\?.captureRejections):EventEmitterPrototype[kCapture])this.emit=emitWithRejectionCapture},EventEmitterPrototype=EventEmitter.prototype={};EventEmitterPrototype._events=void 0,EventEmitterPrototype._eventsCount=0,EventEmitterPrototype._maxListeners=void 0,EventEmitterPrototype.setMaxListeners=function setMaxListeners(n){return validateNumber(n,\"setMaxListeners\",0),this._maxListeners=n,this},EventEmitterPrototype.getMaxListeners=function getMaxListeners(){return this._maxListeners\?\?defaultMaxListeners};function emitError(emitter,args){var{_events:events}=emitter;if(args[0]\?\?=new Error(\"Unhandled error.\"),!events)throw args[0];var errorMonitor=events[kErrorMonitor];if(errorMonitor)for(var handler of ArrayPrototypeSlice.call(errorMonitor))handler.apply(emitter,args);var handlers=events.error;if(!handlers)throw args[0];for(var handler of ArrayPrototypeSlice.call(handlers))handler.apply(emitter,args);return!0}function addCatch(emitter,promise,type,args){promise.then(void 0,function(err){process.nextTick(emitUnhandledRejectionOrErr,emitter,err,type,args)})}function emitUnhandledRejectionOrErr(emitter,err,type,args){if(typeof emitter[kRejection]===\"function\")emitter[kRejection](err,type,...args);else try{emitter[kCapture]=!1,emitter.emit(\"error\",err)}finally{emitter[kCapture]=!0}}const emitWithoutRejectionCapture=function emit(type,...args){if(type===\"error\")return emitError(this,args);var{_events:events}=this;if(events===void 0)return!1;var handlers=events[type];if(handlers===void 0)return!1;for(var handler of[...handlers])handler.apply(this,args);return!0},emitWithRejectionCapture=function emit(type,...args){if(type===\"error\")return emitError(this,args);var{_events:events}=this;if(events===void 0)return!1;var handlers=events[type];if(handlers===void 0)return!1;for(var handler of[...handlers]){var result=handler.apply(this,args);if(result!==void 0&&@isPromise(result))addCatch(this,result,type,args)}return!0};EventEmitterPrototype.emit=emitWithoutRejectionCapture,EventEmitterPrototype.addListener=function addListener(type,fn){checkListener(fn);var events=this._events;if(!events)events=this._events={__proto__:null},this._eventsCount=0;else if(events.newListener)this.emit(\"newListener\",type,fn.listener\?\?fn);var handlers=events[type];if(!handlers)events[type]=[fn],this._eventsCount++;else{handlers.push(fn);var m=this._maxListeners\?\?defaultMaxListeners;if(m>0&&handlers.length>m&&!handlers.warned)overflowWarning(this,type,handlers)}return this},EventEmitterPrototype.on=EventEmitterPrototype.addListener,EventEmitterPrototype.prependListener=function prependListener(type,fn){checkListener(fn);var events=this._events;if(!events)events=this._events={__proto__:null},this._eventsCount=0;else if(events.newListener)this.emit(\"newListener\",type,fn.listener\?\?fn);var handlers=events[type];if(!handlers)events[type]=[fn],this._eventsCount++;else{handlers.unshift(fn);var m=this._maxListeners\?\?defaultMaxListeners;if(m>0&&handlers.length>m&&!handlers.warned)overflowWarning(this,type,handlers)}return this};function overflowWarning(emitter,type,handlers){handlers.warned=!0;const warn=new Error(`Possible EventEmitter memory leak detected. ${handlers.length} ${String(type)} listeners `+`added to [${emitter.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);warn.name=\"MaxListenersExceededWarning\",warn.emitter=emitter,warn.type=type,warn.count=handlers.length,process.emitWarning(warn)}function onceWrapper(type,listener,...args){this.removeListener(type,listener),listener.apply(this,args)}EventEmitterPrototype.once=function once(type,fn){checkListener(fn);const bound=onceWrapper.bind(this,type,fn);return bound.listener=fn,this.addListener(type,bound),this},EventEmitterPrototype.prependOnceListener=function prependOnceListener(type,fn){checkListener(fn);const bound=onceWrapper.bind(this,type,fn);return bound.listener=fn,this.prependListener(type,bound),this},EventEmitterPrototype.removeListener=function removeListener(type,fn){checkListener(fn);var{_events:events}=this;if(!events)return this;var handlers=events[type];if(!handlers)return this;var length=handlers.length;let position=-1;for(let i=length-1;i>=0;i--)if(handlers[i]===fn||handlers[i].listener===fn){position=i;break}if(position<0)return this;if(position===0)handlers.shift();else handlers.splice(position,1);if(handlers.length===0)delete events[type],this._eventsCount--;return this},EventEmitterPrototype.off=EventEmitterPrototype.removeListener,EventEmitterPrototype.removeAllListeners=function removeAllListeners(type){var{_events:events}=this;if(type&&events){if(events[type])delete events[type],this._eventsCount--}else this._events={__proto__:null};return this},EventEmitterPrototype.listeners=function listeners(type){var{_events:events}=this;if(!events)return[];var handlers=events[type];if(!handlers)return[];return handlers.map((x)=>x.listener\?\?x)},EventEmitterPrototype.rawListeners=function rawListeners(type){var{_events}=this;if(!_events)return[];var handlers=_events[type];if(!handlers)return[];return handlers.slice()},EventEmitterPrototype.listenerCount=function listenerCount(type){var{_events:events}=this;if(!events)return 0;return events[type]\?.length\?\?0},EventEmitterPrototype.eventNames=function eventNames(){return this._eventsCount>0\?Reflect.ownKeys(this._events):[]},EventEmitterPrototype[kCapture]=!1;function once(emitter,type,options){var signal=options\?.signal;if(validateAbortSignal(signal,\"options.signal\"),signal\?.aborted)throw new AbortError(void 0,{cause:signal\?.reason});return new Promise((resolve,reject)=>{const errorListener=(err)=>{if(emitter.removeListener(type,resolver),signal!=null)eventTargetAgnosticRemoveListener(signal,\"abort\",abortListener);reject(err)},resolver=(...args)=>{if(typeof emitter.removeListener===\"function\")emitter.removeListener(\"error\",errorListener);if(signal!=null)eventTargetAgnosticRemoveListener(signal,\"abort\",abortListener);resolve(args)};if(eventTargetAgnosticAddListener(emitter,type,resolver,{once:!0}),type!==\"error\"&&typeof emitter.once===\"function\")emitter.once(\"error\",errorListener);function abortListener(){eventTargetAgnosticRemoveListener(emitter,type,resolver),eventTargetAgnosticRemoveListener(emitter,\"error\",errorListener),reject(new AbortError(void 0,{cause:signal\?.reason}))}if(signal!=null)eventTargetAgnosticAddListener(signal,\"abort\",abortListener,{once:!0})})}function on(emitter,type,options){var{signal,close,highWatermark=Number.MAX_SAFE_INTEGER,lowWatermark=1}=options||{};throwNotImplemented(\"events.on\",2679)}function getEventListeners(emitter,type){if(emitter instanceof EventTarget)throwNotImplemented(\"getEventListeners with an EventTarget\",2678);return emitter.listeners(type)}function setMaxListeners(n,...eventTargets){validateNumber(n,\"setMaxListeners\",0);var length;if(eventTargets&&(length=eventTargets.length))for(let i=0;i<length;i++)eventTargets[i].setMaxListeners(n);else defaultMaxListeners=n}function listenerCount(emitter,type){return emitter.listenerCount(type)}function eventTargetAgnosticRemoveListener(emitter,name,listener,flags){if(typeof emitter.removeListener===\"function\")emitter.removeListener(name,listener);else emitter.removeEventListener(name,listener,flags)}function eventTargetAgnosticAddListener(emitter,name,listener,flags){if(typeof emitter.on===\"function\")emitter.on(name,listener);else emitter.addEventListener(name,listener)}class AbortError extends Error{constructor(message=\"The operation was aborted\",options=void 0){if(options!==void 0&&typeof options!==\"object\")throw new codes.ERR_INVALID_ARG_TYPE(\"options\",\"Object\",options);super(message,options);this.code=\"ABORT_ERR\",this.name=\"AbortError\"}}function ERR_INVALID_ARG_TYPE(name,type,value){const err=@makeTypeError(`The \"${name}\" argument must be of type ${type}. Received ${value}`);return err.code=\"ERR_INVALID_ARG_TYPE\",err}function ERR_OUT_OF_RANGE(name,range,value){const err=new RangeError(`The \"${name}\" argument is out of range. It must be ${range}. Received ${value}`);return err.code=\"ERR_OUT_OF_RANGE\",err}function validateAbortSignal(signal,name){if(signal!==void 0&&(signal===null||typeof signal!==\"object\"||!(\"aborted\"in signal)))throw new ERR_INVALID_ARG_TYPE(name,\"AbortSignal\",signal)}function validateNumber(value,name,min=void 0,max){if(typeof value!==\"number\")throw new ERR_INVALID_ARG_TYPE(name,\"number\",value);if(min!=null&&value<min||max!=null&&value>max||(min!=null||max!=null)&&Number.isNaN(value))throw new ERR_OUT_OF_RANGE(name,`${min!=null\?`>= ${min}`:\"\"}${min!=null&&max!=null\?\" && \":\"\"}${max!=null\?`<= ${max}`:\"\"}`,value)}function checkListener(listener){if(typeof listener!==\"function\")@throwTypeError(\"The listener must be a function\")}let AsyncResource=null;class EventEmitterAsyncResource extends EventEmitter{triggerAsyncId;asyncResource;constructor(options){if(!AsyncResource)AsyncResource=(@getInternalField(@internalModuleRegistry,5)||@createInternalModuleById(5)).AsyncResource;var{captureRejections=!1,triggerAsyncId,name=new.target.name,requireManualDestroy}=options||{};super({captureRejections});this.triggerAsyncId=triggerAsyncId\?\?0,this.asyncResource=new AsyncResource(name,{triggerAsyncId,requireManualDestroy})}emit(...args){this.asyncResource.runInAsyncScope(()=>super.emit(...args))}emitDestroy(){this.asyncResource.emitDestroy()}}return Object.defineProperties(EventEmitter,{captureRejections:{get(){return EventEmitterPrototype[kCapture]},set(value){validateBoolean(value,\"EventEmitter.captureRejections\"),EventEmitterPrototype[kCapture]=value},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return defaultMaxListeners},set:(arg)=>{validateNumber(arg,\"defaultMaxListeners\",0),defaultMaxListeners=arg}},kMaxEventTargetListeners:{value:kMaxEventTargetListeners,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:kMaxEventTargetListenersWarned,enumerable:!1,configurable:!1,writable:!1}}),Object.assign(EventEmitter,{once,on,getEventListeners,setMaxListeners,EventEmitter,usingDomains:!1,captureRejectionSymbol,EventEmitterAsyncResource,errorMonitor:kErrorMonitor,setMaxListeners,init:EventEmitter,listenerCount}),EventEmitter})\n"_s; static constexpr ASCIILiteral NodeFSCode = "(function (){\"use strict\";var $,ReadStream,WriteStream;const EventEmitter=@getInternalField(@internalModuleRegistry,15)||@createInternalModuleById(15),promises=@getInternalField(@internalModuleRegistry,17)||@createInternalModuleById(17),Stream=@getInternalField(@internalModuleRegistry,34)||@createInternalModuleById(34);var fs=Bun.fs();class FSWatcher extends EventEmitter{#watcher;#listener;constructor(path,options,listener){super();if(typeof options===\"function\")listener=options,options={};else if(typeof options===\"string\")options={encoding:options};if(typeof listener!==\"function\")listener=()=>{};this.#listener=listener;try{this.#watcher=fs.watch(path,options||{},this.#onEvent.bind(this))}catch(e){if(!e.message\?.startsWith(\"FileNotFound\"))throw e;const notFound=new Error(`ENOENT: no such file or directory, watch '${path}'`);throw notFound.code=\"ENOENT\",notFound.errno=-2,notFound.path=path,notFound.syscall=\"watch\",notFound.filename=path,notFound}}#onEvent(eventType,filenameOrError){if(eventType===\"error\"||eventType===\"close\")this.emit(eventType,filenameOrError);else this.emit(\"change\",eventType,filenameOrError),this.#listener(eventType,filenameOrError)}close(){this.#watcher\?.close(),this.#watcher=null}ref(){this.#watcher\?.ref()}unref(){this.#watcher\?.unref()}}var access=function access(...args){callbackify(fs.accessSync,args)},appendFile=function appendFile(...args){callbackify(fs.appendFileSync,args)},close=function close(...args){callbackify(fs.closeSync,args)},rm=function rm(...args){callbackify(fs.rmSync,args)},rmdir=function rmdir(...args){callbackify(fs.rmdirSync,args)},copyFile=function copyFile(...args){callbackify(fs.copyFileSync,args)},exists=function exists(...args){callbackify(fs.existsSync,args)},chown=function chown(...args){callbackify(fs.chownSync,args)},chmod=function chmod(...args){callbackify(fs.chmodSync,args)},fchmod=function fchmod(...args){callbackify(fs.fchmodSync,args)},fchown=function fchown(...args){callbackify(fs.fchownSync,args)},fstat=function fstat(...args){callbackify(fs.fstatSync,args)},fsync=function fsync(...args){callbackify(fs.fsyncSync,args)},ftruncate=function ftruncate(...args){callbackify(fs.ftruncateSync,args)},futimes=function futimes(...args){callbackify(fs.futimesSync,args)},lchmod=function lchmod(...args){callbackify(fs.lchmodSync,args)},lchown=function lchown(...args){callbackify(fs.lchownSync,args)},link=function link(...args){callbackify(fs.linkSync,args)},mkdir=function mkdir(...args){callbackify(fs.mkdirSync,args)},mkdtemp=function mkdtemp(...args){callbackify(fs.mkdtempSync,args)},open=function open(...args){callbackify(fs.openSync,args)},read=function read(...args){callbackify(fs.readSync,args)},write=function write(...args){callbackify(fs.writeSync,args)},readdir=function readdir(...args){const callback=args[args.length-1];if(typeof callback!==\"function\")@throwTypeError(\"Callback must be a function\");fs.readdir(...args).then((result)=>callback(null,result),callback)},readFile=function readFile(...args){const callback=args[args.length-1];if(typeof callback!==\"function\")@throwTypeError(\"Callback must be a function\");fs.readFile(...args).then((result)=>callback(null,result),callback)},writeFile=function writeFile(...args){callbackify(fs.writeFileSync,args)},readlink=function readlink(...args){callbackify(fs.readlinkSync,args)},realpath=function realpath(...args){callbackify(fs.realpathSync,args)},rename=function rename(...args){callbackify(fs.renameSync,args)},lstat=function lstat(...args){const callback=args[args.length-1];if(typeof callback!==\"function\")@throwTypeError(\"Callback must be a function\");fs.lstat(...args).then((result)=>callback(null,result),callback)},stat=function stat(...args){const callback=args[args.length-1];if(typeof callback!==\"function\")@throwTypeError(\"Callback must be a function\");fs.stat(...args).then((result)=>callback(null,result),callback)},symlink=function symlink(...args){callbackify(fs.symlinkSync,args)},truncate=function truncate(...args){callbackify(fs.truncateSync,args)},unlink=function unlink(...args){callbackify(fs.unlinkSync,args)},utimes=function utimes(...args){callbackify(fs.utimesSync,args)},lutimes=function lutimes(...args){callbackify(fs.lutimesSync,args)},accessSync=fs.accessSync.bind(fs),appendFileSync=fs.appendFileSync.bind(fs),closeSync=fs.closeSync.bind(fs),copyFileSync=fs.copyFileSync.bind(fs),existsSync=fs.existsSync.bind(fs),chownSync=fs.chownSync.bind(fs),chmodSync=fs.chmodSync.bind(fs),fchmodSync=fs.fchmodSync.bind(fs),fchownSync=fs.fchownSync.bind(fs),fstatSync=fs.fstatSync.bind(fs),fsyncSync=fs.fsyncSync.bind(fs),ftruncateSync=fs.ftruncateSync.bind(fs),futimesSync=fs.futimesSync.bind(fs),lchmodSync=fs.lchmodSync.bind(fs),lchownSync=fs.lchownSync.bind(fs),linkSync=fs.linkSync.bind(fs),lstatSync=fs.lstatSync.bind(fs),mkdirSync=fs.mkdirSync.bind(fs),mkdtempSync=fs.mkdtempSync.bind(fs),openSync=fs.openSync.bind(fs),readSync=fs.readSync.bind(fs),writeSync=fs.writeSync.bind(fs),readdirSync=fs.readdirSync.bind(fs),readFileSync=fs.readFileSync.bind(fs),writeFileSync=fs.writeFileSync.bind(fs),readlinkSync=fs.readlinkSync.bind(fs),realpathSync=fs.realpathSync.bind(fs),renameSync=fs.renameSync.bind(fs),statSync=fs.statSync.bind(fs),symlinkSync=fs.symlinkSync.bind(fs),truncateSync=fs.truncateSync.bind(fs),unlinkSync=fs.unlinkSync.bind(fs),utimesSync=fs.utimesSync.bind(fs),lutimesSync=fs.lutimesSync.bind(fs),rmSync=fs.rmSync.bind(fs),rmdirSync=fs.rmdirSync.bind(fs),writev=(fd,buffers,position,callback)=>{if(typeof position===\"function\")callback=position,position=null;queueMicrotask(()=>{try{var written=fs.writevSync(fd,buffers,position)}catch(e){callback(e)}callback(null,written,buffers)})},writevSync=fs.writevSync.bind(fs),readv=(fd,buffers,position,callback)=>{if(typeof position===\"function\")callback=position,position=null;queueMicrotask(()=>{try{var written=fs.readvSync(fd,buffers,position)}catch(e){callback(e)}callback(null,written,buffers)})},readvSync=fs.readvSync.bind(fs),Dirent=fs.Dirent,Stats=fs.Stats,watch=function watch(path,options,listener){return new FSWatcher(path,options,listener)};function callbackify(fsFunction,args){try{const result=fsFunction.apply(fs,args.slice(0,args.length-1)),callback=args[args.length-1];if(typeof callback===\"function\")queueMicrotask(()=>callback(null,result))}catch(e){const callback=args[args.length-1];if(typeof callback===\"function\")queueMicrotask(()=>callback(e))}}var readStreamPathFastPathSymbol=Symbol.for(\"Bun.Node.readStreamPathFastPath\");const readStreamSymbol=Symbol.for(\"Bun.NodeReadStream\"),readStreamPathOrFdSymbol=Symbol.for(\"Bun.NodeReadStreamPathOrFd\"),writeStreamSymbol=Symbol.for(\"Bun.NodeWriteStream\");var writeStreamPathFastPathSymbol=Symbol.for(\"Bun.NodeWriteStreamFastPath\"),writeStreamPathFastPathCallSymbol=Symbol.for(\"Bun.NodeWriteStreamFastPathCall\"),kIoDone=Symbol.for(\"kIoDone\"),defaultReadStreamOptions={file:void 0,fd:void 0,flags:\"r\",encoding:void 0,mode:438,autoClose:!0,emitClose:!0,start:0,end:Infinity,highWaterMark:65536,fs:{read,open:(path,flags,mode,cb)=>{var fd;try{fd=openSync(path,flags,mode)}catch(e){cb(e);return}cb(null,fd)},openSync,close},autoDestroy:!0},ReadStreamClass;ReadStream=function(InternalReadStream){ReadStreamClass=InternalReadStream,Object.defineProperty(ReadStreamClass.prototype,Symbol.toStringTag,{value:\"ReadStream\",enumerable:!1});function ReadStream2(path,options){return new InternalReadStream(path,options)}return ReadStream2.prototype=InternalReadStream.prototype,Object.defineProperty(ReadStream2,Symbol.hasInstance,{value(instance){return instance instanceof InternalReadStream}})}(class ReadStream2 extends Stream._getNativeReadableStreamPrototype(2,Stream.Readable){constructor(pathOrFd,options=defaultReadStreamOptions){if(typeof options!==\"object\"||!options)@throwTypeError(\"Expected options to be an object\");var{flags=defaultReadStreamOptions.flags,encoding=defaultReadStreamOptions.encoding,mode=defaultReadStreamOptions.mode,autoClose=defaultReadStreamOptions.autoClose,emitClose=defaultReadStreamOptions.emitClose,start=defaultReadStreamOptions.start,end=defaultReadStreamOptions.end,autoDestroy=defaultReadStreamOptions.autoClose,fs:fs2=defaultReadStreamOptions.fs,highWaterMark=defaultReadStreamOptions.highWaterMark}=options;if(pathOrFd\?.constructor\?.name===\"URL\")pathOrFd=Bun.fileURLToPath(pathOrFd);var tempThis={};if(typeof pathOrFd===\"string\"){if(pathOrFd.startsWith(\"file://\"))pathOrFd=Bun.fileURLToPath(pathOrFd);if(pathOrFd.length===0)@throwTypeError(\"Expected path to be a non-empty string\");tempThis.path=tempThis.file=tempThis[readStreamPathOrFdSymbol]=pathOrFd}else if(typeof pathOrFd===\"number\"){if(pathOrFd|=0,pathOrFd<0)@throwTypeError(\"Expected fd to be a positive integer\");tempThis.fd=tempThis[readStreamPathOrFdSymbol]=pathOrFd,tempThis.autoClose=!1}else @throwTypeError(\"Expected a path or file descriptor\");if(!tempThis.fd)tempThis.fd=fs2.openSync(pathOrFd,flags,mode);var fileRef=Bun.file(tempThis.fd),stream=fileRef.stream(),native=@direct(stream);if(!native)throw new Error(\"no native readable stream\");var{stream:ptr}=native;super(ptr,{...options,encoding,autoDestroy,autoClose,emitClose,highWaterMark});if(Object.assign(this,tempThis),this.#fileRef=fileRef,this.end=end,this._read=this.#internalRead,this.start=start,this.flags=flags,this.mode=mode,this.emitClose=emitClose,this[readStreamPathFastPathSymbol]=start===0&&end===Infinity&&autoClose&&fs2===defaultReadStreamOptions.fs&&(encoding===\"buffer\"||encoding===\"binary\"||encoding==null||encoding===\"utf-8\"||encoding===\"utf8\"),this._readableState.autoClose=autoDestroy=autoClose,this._readableState.highWaterMark=highWaterMark,start!==void 0)this.pos=start}#fileRef;#fs;file;path;fd=null;flags;mode;start;end;pos;bytesRead=0;#fileSize=-1;_read;[readStreamSymbol]=!0;[readStreamPathOrFdSymbol];[readStreamPathFastPathSymbol];_construct(callback){if(super._construct)super._construct(callback);else callback();this.emit(\"open\",this.fd),this.emit(\"ready\")}_destroy(err,cb){super._destroy(err,cb);try{var fd=this.fd;if(this[readStreamPathFastPathSymbol]=!1,!fd)cb(err);else this.#fs.close(fd,(er)=>{cb(er||err)}),this.fd=null}catch(e){throw e}}close(cb){if(typeof cb===\"function\")eos_()(this,cb);this.destroy()}push(chunk){var bytesRead=chunk\?.length\?\?0;if(bytesRead>0){this.bytesRead+=bytesRead;var currPos=this.pos;if(currPos!==void 0){if(this.bytesRead<currPos)return!0;if(currPos===this.start){var n=this.bytesRead-currPos;chunk=chunk.slice(-n);var[_,...rest]=arguments;if(this.pos=this.bytesRead,this.end!==void 0&&this.bytesRead>this.end)chunk=chunk.slice(0,this.end-this.start+1);return super.push(chunk,...rest)}var end=this.end;if(end!==void 0&&this.bytesRead>end){chunk=chunk.slice(0,end-currPos+1);var[_,...rest]=arguments;return this.pos=this.bytesRead,super.push(chunk,...rest)}this.pos=this.bytesRead}}return super.push(...arguments)}#internalRead(n){var{pos,end,bytesRead,fd,encoding}=this;if(n=pos!==void 0\?Math.min(end-pos+1,n):Math.min(end-bytesRead+1,n),n<=0){this.push(null);return}if(this.#fileSize===-1&&bytesRead===0&&pos===void 0){var stat2=fstatSync(fd);if(this.#fileSize=stat2.size,this.#fileSize>0&&n>this.#fileSize)n=this.#fileSize+1}this[kIoDone]=!1;var res=super._read(n);if(@isPromise(res)){var then=res\?.then;if(then&&@isCallable(then))then(()=>{if(this[kIoDone]=!0,this.destroyed)this.emit(kIoDone)},(er)=>{this[kIoDone]=!0,this.#errorOrDestroy(er)})}else if(this[kIoDone]=!0,this.destroyed)this.emit(kIoDone),this.#errorOrDestroy(new Error(\"ERR_STREAM_PREMATURE_CLOSE\"))}#errorOrDestroy(err,sync=null){var{_readableState:r={destroyed:!1,autoDestroy:!1},_writableState:w={destroyed:!1,autoDestroy:!1}}=this;if(w\?.destroyed||r\?.destroyed)return this;if(r\?.autoDestroy||w\?.autoDestroy)this.destroy(err);else if(err)this.emit(\"error\",err)}pause(){return this[readStreamPathFastPathSymbol]=!1,super.pause()}resume(){return this[readStreamPathFastPathSymbol]=!1,super.resume()}unshift(...args){return this[readStreamPathFastPathSymbol]=!1,super.unshift(...args)}pipe(dest,pipeOpts){if(this[readStreamPathFastPathSymbol]&&(pipeOpts\?.end\?\?!0)&&this._readableState\?.pipes\?.length===0){if((writeStreamPathFastPathSymbol in dest)&&dest[writeStreamPathFastPathSymbol]){if(dest[writeStreamPathFastPathCallSymbol](this,pipeOpts))return this}}return this[readStreamPathFastPathSymbol]=!1,super.pipe(dest,pipeOpts)}});function createReadStream(path,options){return new ReadStream(path,options)}var defaultWriteStreamOptions={fd:null,start:void 0,pos:void 0,encoding:void 0,flags:\"w\",mode:438,fs:{write,close,open,openSync}},WriteStreamClass;WriteStream=function(InternalWriteStream){WriteStreamClass=InternalWriteStream,Object.defineProperty(WriteStreamClass.prototype,Symbol.toStringTag,{value:\"WritesStream\",enumerable:!1});function WriteStream2(path,options){return new InternalWriteStream(path,options)}return WriteStream2.prototype=InternalWriteStream.prototype,Object.defineProperty(WriteStream2,Symbol.hasInstance,{value(instance){return instance instanceof InternalWriteStream}})}(class WriteStream2 extends Stream.NativeWritable{constructor(path,options=defaultWriteStreamOptions){if(!options)@throwTypeError(\"Expected options to be an object\");var{fs:fs2=defaultWriteStreamOptions.fs,start=defaultWriteStreamOptions.start,flags=defaultWriteStreamOptions.flags,mode=defaultWriteStreamOptions.mode,autoClose=!0,emitClose=!1,autoDestroy=autoClose,encoding=defaultWriteStreamOptions.encoding,fd=defaultWriteStreamOptions.fd,pos=defaultWriteStreamOptions.pos}=options,tempThis={};if(typeof path===\"string\"){if(path.length===0)@throwTypeError(\"Expected a non-empty path\");if(path.startsWith(\"file:\"))path=Bun.fileURLToPath(path);tempThis.path=path,tempThis.fd=null,tempThis[writeStreamPathFastPathSymbol]=autoClose&&(start===void 0||start===0)&&fs2.write===defaultWriteStreamOptions.fs.write&&fs2.close===defaultWriteStreamOptions.fs.close}else tempThis.fd=fd,tempThis[writeStreamPathFastPathSymbol]=!1;if(!tempThis.fd)tempThis.fd=fs2.openSync(path,flags,mode);super(tempThis.fd,{...options,decodeStrings:!1,autoDestroy,emitClose,fd:tempThis});if(Object.assign(this,tempThis),typeof fs2\?.write!==\"function\")@throwTypeError(\"Expected fs.write to be a function\");if(typeof fs2\?.close!==\"function\")@throwTypeError(\"Expected fs.close to be a function\");if(typeof fs2\?.open!==\"function\")@throwTypeError(\"Expected fs.open to be a function\");if(typeof path===\"object\"&&path){if(path instanceof URL)path=Bun.fileURLToPath(path)}if(typeof path!==\"string\"&&typeof fd!==\"number\")@throwTypeError(\"Expected a path or file descriptor\");if(this.start=start,this.#fs=fs2,this.flags=flags,this.mode=mode,this.start!==void 0)this.pos=this.start;if(encoding!==defaultWriteStreamOptions.encoding){if(this.setDefaultEncoding(encoding),encoding!==\"buffer\"&&encoding!==\"utf8\"&&encoding!==\"utf-8\"&&encoding!==\"binary\")this[writeStreamPathFastPathSymbol]=!1}}get autoClose(){return this._writableState.autoDestroy}set autoClose(val){this._writableState.autoDestroy=val}destroySoon=this.end;open(){}path;fd;flags;mode;#fs;bytesWritten=0;pos;[writeStreamPathFastPathSymbol];[writeStreamSymbol]=!0;start;[writeStreamPathFastPathCallSymbol](readStream,pipeOpts){if(!this[writeStreamPathFastPathSymbol])return!1;if(this.fd!==null)return this[writeStreamPathFastPathSymbol]=!1,!1;return this[kIoDone]=!1,readStream[kIoDone]=!1,Bun.write(this[writeStreamPathFastPathSymbol],readStream[readStreamPathOrFdSymbol]).then((bytesWritten)=>{readStream[kIoDone]=this[kIoDone]=!0,this.bytesWritten+=bytesWritten,readStream.bytesRead+=bytesWritten,this.end(),readStream.close()},(err)=>{readStream[kIoDone]=this[kIoDone]=!0,this.#errorOrDestroy(err),readStream.emit(\"error\",err)})}isBunFastPathEnabled(){return this[writeStreamPathFastPathSymbol]}disableBunFastPath(){this[writeStreamPathFastPathSymbol]=!1}#handleWrite(er,bytes){if(er)return this.#errorOrDestroy(er);this.bytesWritten+=bytes}#internalClose(err,cb){this[writeStreamPathFastPathSymbol]=!1;var fd=this.fd;this.#fs.close(fd,(er)=>{this.fd=null,cb(err||er)})}_construct(callback){if(typeof this.fd===\"number\"){callback();return}callback(),this.emit(\"open\",this.fd),this.emit(\"ready\")}_destroy(err,cb){if(this.fd===null)return cb(err);if(this[kIoDone]){this.once(kIoDone,()=>this.#internalClose(err,cb));return}this.#internalClose(err,cb)}[kIoDone]=!1;close(cb){if(cb){if(this.closed){process.nextTick(cb);return}this.on(\"close\",cb)}if(!this.autoClose)this.on(\"finish\",this.destroy);this.end()}write(chunk,encoding=this._writableState.defaultEncoding,cb){if(this[writeStreamPathFastPathSymbol]=!1,typeof chunk===\"string\")chunk=Buffer.from(chunk,encoding);var native=this.pos===void 0;return this[kIoDone]=!0,super.write(chunk,encoding,native\?(err,bytes)=>{if(this[kIoDone]=!1,this.#handleWrite(err,bytes),this.emit(kIoDone),cb)!err\?cb():cb(err)}:()=>{},native)}#internalWriteSlow(chunk,encoding,cb){this.#fs.write(this.fd,chunk,0,chunk.length,this.pos,(err,bytes)=>{this[kIoDone]=!1,this.#handleWrite(err,bytes),this.emit(kIoDone),!err\?cb():cb(err)})}end(chunk,encoding,cb){var native=this.pos===void 0;return super.end(chunk,encoding,cb,native)}_write=this.#internalWriteSlow;_writev=void 0;get pending(){return this.fd===null}_destroy(err,cb){this.close(err,cb)}#errorOrDestroy(err){var{_readableState:r={destroyed:!1,autoDestroy:!1},_writableState:w={destroyed:!1,autoDestroy:!1}}=this;if(w\?.destroyed||r\?.destroyed)return this;if(r\?.autoDestroy||w\?.autoDestroy)this.destroy(err);else if(err)this.emit(\"error\",err)}});function createWriteStream(path,options){return new WriteStream(path,options)}return Object.defineProperties(fs,{createReadStream:{value:createReadStream},createWriteStream:{value:createWriteStream},ReadStream:{value:ReadStream},WriteStream:{value:WriteStream}}),realpath.native=realpath,realpathSync.native=realpathSync,$={access,accessSync,appendFile,appendFileSync,chmod,chmodSync,chown,chownSync,close,closeSync,constants:promises.constants,copyFile,copyFileSync,createReadStream,createWriteStream,Dirent,exists,existsSync,fchmod,fchmodSync,fchown,fchownSync,fstat,fstatSync,fsync,fsyncSync,ftruncate,ftruncateSync,futimes,futimesSync,lchmod,lchmodSync,lchown,lchownSync,link,linkSync,lstat,lstatSync,lutimes,lutimesSync,mkdir,mkdirSync,mkdtemp,mkdtempSync,open,openSync,promises,read,readFile,readFileSync,readSync,readdir,readdirSync,readlink,readlinkSync,realpath,realpathSync,rename,renameSync,rm,rmSync,rmdir,rmdirSync,stat,statSync,Stats,symlink,symlinkSync,truncate,truncateSync,unlink,unlinkSync,utimes,utimesSync,write,writeFile,writeFileSync,writeSync,WriteStream,ReadStream,watch,FSWatcher,writev,writevSync,readv,readvSync,[Symbol.for(\"::bunternal::\")]:{ReadStreamClass,WriteStreamClass}},$})\n"_s; static constexpr ASCIILiteral NodeFSPromisesCode = "(function (){\"use strict\";var $;const constants=@processBindingConstants.fs;var fs=Bun.fs();const notrace=\"::bunternal::\";var promisify={[notrace]:(fsFunction)=>{return async function(...args){return await 1,fsFunction.apply(fs,args)}}}[notrace];function watch(filename,options={}){if(filename instanceof URL)@throwTypeError(\"Watch URLs are not supported yet\");else if(Buffer.isBuffer(filename))filename=filename.toString();else if(typeof filename!==\"string\")@throwTypeError(\"Expected path to be a string or Buffer\");let nextEventResolve=null;if(typeof options===\"string\")options={encoding:options};const queue=@createFIFO(),watcher=fs.watch(filename,options||{},(eventType,filename2)=>{if(queue.push({eventType,filename:filename2}),nextEventResolve){const resolve=nextEventResolve;nextEventResolve=null,resolve()}});return{[Symbol.asyncIterator](){let closed=!1;return{async next(){while(!closed){let event;while(event=queue.shift()){if(event.eventType===\"close\")return closed=!0,{value:void 0,done:!0};if(event.eventType===\"error\")throw closed=!0,event.filename;return{value:event,done:!1}}const{promise,resolve}=Promise.withResolvers();nextEventResolve=resolve,await promise}return{value:void 0,done:!0}},return(){if(!closed){if(watcher.close(),closed=!0,nextEventResolve){const resolve=nextEventResolve;nextEventResolve=null,resolve()}}return{value:void 0,done:!0}}}}}}return $={access:promisify(fs.accessSync),appendFile:promisify(fs.appendFileSync),close:promisify(fs.closeSync),copyFile:promisify(fs.copyFileSync),exists:promisify(fs.existsSync),chown:promisify(fs.chownSync),chmod:promisify(fs.chmodSync),fchmod:promisify(fs.fchmodSync),fchown:promisify(fs.fchownSync),fstat:promisify(fs.fstatSync),fsync:promisify(fs.fsyncSync),ftruncate:promisify(fs.ftruncateSync),futimes:promisify(fs.futimesSync),lchmod:promisify(fs.lchmodSync),lchown:promisify(fs.lchownSync),link:promisify(fs.linkSync),lstat:fs.lstat.bind(fs),mkdir:promisify(fs.mkdirSync),mkdtemp:promisify(fs.mkdtempSync),open:promisify(fs.openSync),read:promisify(fs.readSync),write:promisify(fs.writeSync),readdir:fs.readdir.bind(fs),readFile:fs.readFile.bind(fs),writeFile:promisify(fs.writeFileSync),readlink:promisify(fs.readlinkSync),realpath:promisify(fs.realpathSync),rename:promisify(fs.renameSync),stat:fs.stat.bind(fs),symlink:promisify(fs.symlinkSync),truncate:promisify(fs.truncateSync),unlink:promisify(fs.unlinkSync),utimes:promisify(fs.utimesSync),lutimes:promisify(fs.lutimesSync),rm:promisify(fs.rmSync),rmdir:promisify(fs.rmdirSync),writev:(fd,buffers,position)=>{return new Promise((resolve,reject)=>{try{var bytesWritten=fs.writevSync(fd,buffers,position)}catch(err){reject(err);return}resolve({bytesWritten,buffers})})},readv:(fd,buffers,position)=>{return new Promise((resolve,reject)=>{try{var bytesRead=fs.readvSync(fd,buffers,position)}catch(err){reject(err);return}resolve({bytesRead,buffers})})},constants,watch},$})\n"_s; -static constexpr ASCIILiteral NodeHttpCode = "(function (){\"use strict\";var $;const EventEmitter=@getInternalField(@internalModuleRegistry,15)||@createInternalModuleById(15),{isTypedArray}=@requireNativeModule(\"node:util/types\"),{Duplex,Readable,Writable}=@getInternalField(@internalModuleRegistry,34)||@createInternalModuleById(34),headerCharRegex=/[^\\t\\x20-\\x7e\\x80-\\xff]/;function checkInvalidHeaderChar(val){return RegExpPrototypeExec.call(headerCharRegex,val)!==null}const validateHeaderName=(name,label)=>{if(typeof name!==\"string\"||!name||!checkIsHttpToken(name))throw new Error(\"ERR_INVALID_HTTP_TOKEN\")},validateHeaderValue=(name,value)=>{if(value===void 0)throw new Error(\"ERR_HTTP_INVALID_HEADER_VALUE\");if(checkInvalidHeaderChar(value))throw new Error(\"ERR_INVALID_CHAR\")};function isIPv6(input){return new RegExp(\"^((\?:(\?:[0-9a-fA-F]{1,4}):){7}(\?:(\?:[0-9a-fA-F]{1,4})|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){6}(\?:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|:(\?:[0-9a-fA-F]{1,4})|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){5}(\?::((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,2}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){4}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,1}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,3}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){3}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,2}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,4}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){2}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,3}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,5}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){1}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,4}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,6}|:)|(\?::((\?::(\?:[0-9a-fA-F]{1,4})){0,5}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(\?::(\?:[0-9a-fA-F]{1,4})){1,7}|:)))(%[0-9a-zA-Z-.:]{1,})\?$\").test(input)}const{URL}=globalThis,globalReportError=globalThis.reportError,setTimeout=globalThis.setTimeout,fetch=Bun.fetch,nop=()=>{},kEmptyObject=Object.freeze(Object.create(null)),kOutHeaders=Symbol.for(\"kOutHeaders\"),kEndCalled=Symbol.for(\"kEndCalled\"),kAbortController=Symbol.for(\"kAbortController\"),kClearTimeout=Symbol(\"kClearTimeout\"),kCorked=Symbol.for(\"kCorked\"),searchParamsSymbol=Symbol.for(\"query\"),StringPrototypeSlice=String.prototype.slice,StringPrototypeStartsWith=String.prototype.startsWith,StringPrototypeToUpperCase=String.prototype.toUpperCase,StringPrototypeIncludes=String.prototype.includes,StringPrototypeCharCodeAt=String.prototype.charCodeAt,StringPrototypeIndexOf=String.prototype.indexOf,ArrayIsArray=Array.isArray,RegExpPrototypeExec=RegExp.prototype.exec,ObjectAssign=Object.assign,ObjectPrototypeHasOwnProperty=Object.prototype.hasOwnProperty,INVALID_PATH_REGEX=/[^\\u0021-\\u00ff]/,NODE_HTTP_WARNING=\"WARN: Agent is mostly unused in Bun's implementation of http. If you see strange behavior, this is probably the cause.\";var _defaultHTTPSAgent,kInternalRequest=Symbol(\"kInternalRequest\"),kInternalSocketData=Symbol.for(\"::bunternal::\");const kEmptyBuffer=Buffer.alloc(0);function isValidTLSArray(obj){if(typeof obj===\"string\"||isTypedArray(obj)||obj instanceof ArrayBuffer||obj instanceof Blob)return!0;if(Array.isArray(obj)){for(var i=0;i<obj.length;i++)if(typeof obj!==\"string\"&&!isTypedArray(obj)&&!(obj instanceof ArrayBuffer)&&!(obj instanceof Blob))return!1;return!0}}class ERR_INVALID_ARG_TYPE extends TypeError{constructor(name,expected,actual){super(`The ${name} argument must be of type ${expected}. Received type ${typeof actual}`);this.code=\"ERR_INVALID_ARG_TYPE\"}}function validateMsecs(numberlike,field){if(typeof numberlike!==\"number\"||numberlike<0)throw new ERR_INVALID_ARG_TYPE(field,\"number\",numberlike);return numberlike}function validateFunction(callable,field){if(typeof callable!==\"function\")throw new ERR_INVALID_ARG_TYPE(field,\"Function\",callable);return callable}function getHeader(headers,name){if(!headers)return;const result=headers.get(name);return result==null\?void 0:result}var FakeSocket=class Socket extends Duplex{bytesRead=0;bytesWritten=0;connecting=!1;remoteAddress=null;remotePort;timeout=0;isServer=!1;address(){return{address:this.localAddress,family:this.localFamily,port:this.localPort}}get bufferSize(){return this.writableLength}connect(port,host,connectListener){return this}_destroy(err,callback){}_final(callback){}get localAddress(){return\"127.0.0.1\"}get localFamily(){return\"IPv4\"}get localPort(){return 80}get pending(){return this.connecting}_read(size){}get readyState(){if(this.connecting)return\"opening\";if(this.readable)return this.writable\?\"open\":\"readOnly\";else return this.writable\?\"writeOnly\":\"closed\"}ref(){}get remoteFamily(){return\"IPv4\"}resetAndDestroy(){}setKeepAlive(enable=!1,initialDelay=0){}setNoDelay(noDelay=!0){return this}setTimeout(timeout,callback){return this}unref(){}_write(chunk,encoding,callback){}};function createServer(options,callback){return new Server(options,callback)}class Agent extends EventEmitter{defaultPort=80;protocol=\"http:\";options;requests;sockets;freeSockets;keepAliveMsecs;keepAlive;maxSockets;maxFreeSockets;scheduling;maxTotalSockets;totalSocketCount;#fakeSocket;static get globalAgent(){return globalAgent}static get defaultMaxSockets(){return Infinity}constructor(options=kEmptyObject){super();if(this.options=options={...options,path:null},options.noDelay===void 0)options.noDelay=!0;this.requests=kEmptyObject,this.sockets=kEmptyObject,this.freeSockets=kEmptyObject,this.keepAliveMsecs=options.keepAliveMsecs||1000,this.keepAlive=options.keepAlive||!1,this.maxSockets=options.maxSockets||Agent.defaultMaxSockets,this.maxFreeSockets=options.maxFreeSockets||256,this.scheduling=options.scheduling||\"lifo\",this.maxTotalSockets=options.maxTotalSockets,this.totalSocketCount=0,this.defaultPort=options.defaultPort||80,this.protocol=options.protocol||\"http:\"}createConnection(){return this.#fakeSocket\?\?=new FakeSocket}getName(options=kEmptyObject){let name=`http:${options.host||\"localhost\"}:`;if(options.port)name+=options.port;if(name+=\":\",options.localAddress)name+=options.localAddress;if(options.family===4||options.family===6)name+=`:${options.family}`;if(options.socketPath)name+=`:${options.socketPath}`;return name}addRequest(){}createSocket(req,options,cb){cb(null,this.#fakeSocket\?\?=new FakeSocket)}removeSocket(){}keepSocketAlive(){return!0}reuseSocket(){}destroy(){}}function emitListeningNextTick(self,onListen,err,hostname,port){if(typeof onListen===\"function\")try{onListen(err,hostname,port)}catch(err2){self.emit(\"error\",err2)}if(self.listening=!err,err)self.emit(\"error\",err);else self.emit(\"listening\",hostname,port)}class Server extends EventEmitter{#server;#options;#tls;#is_tls=!1;listening=!1;serverName;constructor(options,callback){super();if(typeof options===\"function\")callback=options,options={};else if(options==null||typeof options===\"object\"){options={...options},this.#tls=null;let key=options.key;if(key){if(!isValidTLSArray(key))@throwTypeError(\"key argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");this.#is_tls=!0}let cert=options.cert;if(cert){if(!isValidTLSArray(cert))@throwTypeError(\"cert argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");this.#is_tls=!0}let ca=options.ca;if(ca){if(!isValidTLSArray(ca))@throwTypeError(\"ca argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");this.#is_tls=!0}let passphrase=options.passphrase;if(passphrase&&typeof passphrase!==\"string\")@throwTypeError(\"passphrase argument must be an string\");let serverName=options.servername;if(serverName&&typeof serverName!==\"string\")@throwTypeError(\"servername argument must be an string\");let secureOptions=options.secureOptions||0;if(secureOptions&&typeof secureOptions!==\"number\")@throwTypeError(\"secureOptions argument must be an number\");if(this.#is_tls)this.#tls={serverName,key,cert,ca,passphrase,secureOptions};else this.#tls=null}else throw new Error(\"bun-http-polyfill: invalid arguments\");if(this.#options=options,callback)this.on(\"request\",callback)}closeAllConnections(){const server=this.#server;if(!server)return;this.#server=void 0,server.stop(!0),this.emit(\"close\")}closeIdleConnections(){}close(optionalCallback){const server=this.#server;if(!server){if(typeof optionalCallback===\"function\")process.nextTick(optionalCallback,new Error(\"Server is not running\"));return}if(this.#server=void 0,typeof optionalCallback===\"function\")this.once(\"close\",optionalCallback);server.stop(),this.emit(\"close\")}address(){if(!this.#server)return null;const address=this.#server.hostname;return{address,family:isIPv6(address)\?\"IPv6\":\"IPv4\",port:this.#server.port}}listen(port,host,backlog,onListen){const server=this;if(typeof host===\"function\")onListen=host,host=void 0;if(typeof port===\"function\")onListen=port;else if(typeof port===\"object\"){if(port\?.signal\?.addEventListener(\"abort\",()=>{this.close()}),host=port\?.host,port=port\?.port,typeof port\?.callback===\"function\")onListen=port\?.callback}if(typeof backlog===\"function\")onListen=backlog;const ResponseClass=this.#options.ServerResponse||ServerResponse,RequestClass=this.#options.IncomingMessage||IncomingMessage;try{const tls=this.#tls;if(tls)this.serverName=tls.serverName||host||\"localhost\";this.#server=Bun.serve({tls,port,hostname:host,websocket:{open(ws){ws.data.open(ws)},message(ws,message){ws.data.message(ws,message)},close(ws,code,reason){ws.data.close(ws,code,reason)},drain(ws){ws.data.drain(ws)}},fetch(req,_server){var pendingResponse,pendingError,rejectFunction,resolveFunction,reject=(err)=>{if(pendingError)return;if(pendingError=err,rejectFunction)rejectFunction(err)},reply=function(resp){if(pendingResponse)return;if(pendingResponse=resp,resolveFunction)resolveFunction(resp)};const http_req=new RequestClass(req),http_res=new ResponseClass({reply,req:http_req});if(http_req.once(\"error\",(err)=>reject(err)),http_res.once(\"error\",(err)=>reject(err)),req.headers.get(\"upgrade\")){const socket=new FakeSocket;socket[kInternalSocketData]=[_server,http_res,req],server.emit(\"upgrade\",http_req,socket,kEmptyBuffer)}else server.emit(\"request\",http_req,http_res);if(pendingError)throw pendingError;if(pendingResponse)return pendingResponse;return new Promise((resolve,reject2)=>{resolveFunction=resolve,rejectFunction=reject2})}}),setTimeout(emitListeningNextTick,1,this,onListen,null,this.#server.hostname,this.#server.port)}catch(err){setTimeout(emitListeningNextTick,1,this,onListen,err)}return this}setTimeout(msecs,callback){}}function assignHeaders(object,req){var headers=req.headers.toJSON();const rawHeaders=@newArrayWithSize(req.headers.count*2);var i=0;for(let key in headers)rawHeaders[i++]=key,rawHeaders[i++]=headers[key];object.headers=headers,object.rawHeaders=rawHeaders}function destroyBodyStreamNT(bodyStream){bodyStream.destroy()}var defaultIncomingOpts={type:\"request\"};function getDefaultHTTPSAgent(){return _defaultHTTPSAgent\?\?=new Agent({defaultPort:443,protocol:\"https:\"})}class IncomingMessage extends Readable{method;complete;constructor(req,defaultIncomingOpts2){const method=req.method;super();const url=new URL(req.url);var{type=\"request\",[kInternalRequest]:nodeReq}=defaultIncomingOpts2||{};this.#noBody=type===\"request\"\?method===\"GET\"||method===\"HEAD\"||method===\"TRACE\"||method===\"CONNECT\"||method===\"OPTIONS\"||(parseInt(req.headers.get(\"Content-Length\")||\"\")||0)===0:!1,this.#req=req,this.method=method,this.#type=type,this.complete=!!this.#noBody,this.#bodyStream=void 0;const socket=new FakeSocket;socket.remoteAddress=url.hostname,socket.remotePort=url.port,this.#fakeSocket=socket,this.url=url.pathname+url.search,this.#nodeReq=nodeReq,assignHeaders(this,req)}headers;rawHeaders;_consuming=!1;_dumped=!1;#bodyStream;#fakeSocket;#noBody=!1;#aborted=!1;#req;url;#type;#nodeReq;get req(){return this.#nodeReq}_construct(callback){if(this.#type===\"response\"||this.#noBody){callback();return}const contentLength=this.#req.headers.get(\"content-length\");if((contentLength\?parseInt(contentLength,10):0)===0){this.#noBody=!0,callback();return}callback()}async#consumeStream(reader){while(!0){var{done,value}=await reader.readMany();if(this.#aborted)return;if(done){this.push(null),this.destroy();break}for(var v of value)this.push(v)}}_read(size){if(this.#noBody)this.push(null),this.complete=!0;else if(this.#bodyStream==null){const reader=this.#req.body\?.getReader();if(!reader){this.push(null);return}this.#bodyStream=reader,this.#consumeStream(reader)}}get aborted(){return this.#aborted}#abort(){if(this.#aborted)return;this.#aborted=!0;var bodyStream=this.#bodyStream;if(!bodyStream)return;bodyStream.cancel(),this.complete=!0,this.#bodyStream=void 0,this.push(null)}get connection(){return this.#fakeSocket}get statusCode(){return this.#req.status}get statusMessage(){return STATUS_CODES[this.#req.status]}get httpVersion(){return\"1.1\"}get rawTrailers(){return[]}get httpVersionMajor(){return 1}get httpVersionMinor(){return 1}get trailers(){return kEmptyObject}get socket(){return this.#fakeSocket\?\?=new FakeSocket}set socket(val){this.#fakeSocket=val}setTimeout(msecs,callback){throw new Error(\"not implemented\")}}function emitErrorNt(msg,err,callback){if(callback(err),typeof msg.emit===\"function\"&&!msg._closed)msg.emit(\"error\",err)}function onError(self,err,cb){process.nextTick(()=>emitErrorNt(self,err,cb))}function write_(msg,chunk,encoding,callback,fromEnd){if(typeof callback!==\"function\")callback=nop;let len;if(chunk===null)throw new Error(\"ERR_STREAM_NULL_VALUES\");else if(typeof chunk===\"string\")len=Buffer.byteLength(chunk,encoding);else throw new Error(\"Invalid arg type for chunk\");let err;if(msg.finished)err=new Error(\"ERR_STREAM_WRITE_AFTER_END\");else if(msg.destroyed)err=new Error(\"ERR_STREAM_DESTROYED\");if(err){if(!msg.destroyed)onError(msg,err,callback);else process.nextTick(callback,err);return!1}if(!msg._header){if(fromEnd)msg._contentLength=len}if(!msg._hasBody)return process.nextTick(callback),!0;return!0}class OutgoingMessage extends Writable{constructor(){super(...arguments)}#headers;headersSent=!1;sendDate=!0;req;timeout;#finished=!1;[kEndCalled]=!1;#fakeSocket;#timeoutTimer;[kAbortController]=null;_implicitHeader(){}get headers(){if(!this.#headers)return kEmptyObject;return this.#headers.toJSON()}get shouldKeepAlive(){return!0}get chunkedEncoding(){return!1}set chunkedEncoding(value){}set shouldKeepAlive(value){}get useChunkedEncodingByDefault(){return!0}set useChunkedEncodingByDefault(value){}get socket(){return this.#fakeSocket\?\?=new FakeSocket}set socket(val){this.#fakeSocket=val}get connection(){return this.socket}get finished(){return this.#finished}appendHeader(name,value){var headers=this.#headers\?\?=new Headers;headers.append(name,value)}flushHeaders(){}getHeader(name){return getHeader(this.#headers,name)}getHeaders(){if(!this.#headers)return kEmptyObject;return this.#headers.toJSON()}getHeaderNames(){var headers=this.#headers;if(!headers)return[];return Array.from(headers.keys())}removeHeader(name){if(!this.#headers)return;this.#headers.delete(name)}setHeader(name,value){var headers=this.#headers\?\?=new Headers;return headers.set(name,value),this}hasHeader(name){if(!this.#headers)return!1;return this.#headers.has(name)}addTrailers(headers){throw new Error(\"not implemented\")}[kClearTimeout](){if(this.#timeoutTimer)clearTimeout(this.#timeoutTimer),this.removeAllListeners(\"timeout\"),this.#timeoutTimer=void 0}#onTimeout(){this.#timeoutTimer=void 0,this[kAbortController]\?.abort(),this.emit(\"timeout\")}setTimeout(msecs,callback){if(this.destroyed)return this;if(this.timeout=msecs=validateMsecs(msecs,\"msecs\"),clearTimeout(this.#timeoutTimer),msecs===0){if(callback!==void 0)validateFunction(callback,\"callback\"),this.removeListener(\"timeout\",callback);this.#timeoutTimer=void 0}else if(this.#timeoutTimer=setTimeout(this.#onTimeout.bind(this),msecs).unref(),callback!==void 0)validateFunction(callback,\"callback\"),this.once(\"timeout\",callback);return this}}let OriginalWriteHeadFn,OriginalImplicitHeadFn;class ServerResponse extends Writable{constructor({req,reply}){super();if(this.req=req,this._reply=reply,this.sendDate=!0,this.statusCode=200,this.headersSent=!1,this.statusMessage=void 0,this.#controller=void 0,this.#firstWrite=void 0,this._writableState.decodeStrings=!1,this.#deferred=void 0,req.method===\"HEAD\")this._hasBody=!1}req;_reply;sendDate;statusCode;#headers;headersSent=!1;statusMessage;#controller;#firstWrite;_sent100=!1;_defaultKeepAlive=!1;_removedConnection=!1;_removedContLen=!1;_hasBody=!0;#deferred=void 0;#finished=!1;_implicitHeader(){this.writeHead(this.statusCode)}_write(chunk,encoding,callback){if(!this.#firstWrite&&!this.headersSent){this.#firstWrite=chunk,callback();return}this.#ensureReadableStreamController((controller)=>{controller.write(chunk),callback()})}_writev(chunks,callback){if(chunks.length===1&&!this.headersSent&&!this.#firstWrite){this.#firstWrite=chunks[0].chunk,callback();return}this.#ensureReadableStreamController((controller)=>{for(let chunk of chunks)controller.write(chunk.chunk);callback()})}#ensureReadableStreamController(run){var thisController=this.#controller;if(thisController)return run(thisController);this.headersSent=!0;var firstWrite=this.#firstWrite;this.#firstWrite=void 0,this._reply(new Response(new ReadableStream({type:\"direct\",pull:(controller)=>{if(this.#controller=controller,firstWrite)controller.write(firstWrite);if(firstWrite=void 0,run(controller),!this.#finished)return new Promise((resolve)=>{this.#deferred=resolve})}}),{headers:this.#headers,status:this.statusCode,statusText:this.statusMessage\?\?STATUS_CODES[this.statusCode]}))}#drainHeadersIfObservable(){if(this._implicitHeader===OriginalImplicitHeadFn&&this.writeHead===OriginalWriteHeadFn)return;this._implicitHeader()}_final(callback){if(!this.headersSent){var data=this.#firstWrite||\"\";this.#firstWrite=void 0,this.#finished=!0,this.#drainHeadersIfObservable(),this._reply(new Response(data,{headers:this.#headers,status:this.statusCode,statusText:this.statusMessage\?\?STATUS_CODES[this.statusCode]})),callback&&callback();return}this.#finished=!0,this.#ensureReadableStreamController((controller)=>{controller.end(),callback();var deferred=this.#deferred;if(deferred)this.#deferred=void 0,deferred()})}writeProcessing(){throw new Error(\"not implemented\")}addTrailers(headers){throw new Error(\"not implemented\")}assignSocket(socket){throw new Error(\"not implemented\")}detachSocket(socket){throw new Error(\"not implemented\")}writeContinue(callback){throw new Error(\"not implemented\")}setTimeout(msecs,callback){throw new Error(\"not implemented\")}get shouldKeepAlive(){return!0}get chunkedEncoding(){return!1}set chunkedEncoding(value){}set shouldKeepAlive(value){}get useChunkedEncodingByDefault(){return!0}set useChunkedEncodingByDefault(value){}appendHeader(name,value){var headers=this.#headers\?\?=new Headers;headers.append(name,value)}flushHeaders(){}getHeader(name){return getHeader(this.#headers,name)}getHeaders(){var headers=this.#headers;if(!headers)return kEmptyObject;return headers.toJSON()}getHeaderNames(){var headers=this.#headers;if(!headers)return[];return Array.from(headers.keys())}removeHeader(name){if(!this.#headers)return;this.#headers.delete(name)}setHeader(name,value){var headers=this.#headers\?\?=new Headers;return headers.set(name,value),this}hasHeader(name){if(!this.#headers)return!1;return this.#headers.has(name)}writeHead(statusCode,statusMessage,headers){return _writeHead(statusCode,statusMessage,headers,this),this}}OriginalWriteHeadFn=ServerResponse.prototype.writeHead,OriginalImplicitHeadFn=ServerResponse.prototype._implicitHeader;class ClientRequest extends OutgoingMessage{#timeout;#res=null;#upgradeOrConnect=!1;#parser=null;#maxHeadersCount=null;#reusedSocket=!1;#host;#protocol;#method;#port;#useDefaultPort;#joinDuplicateHeaders;#maxHeaderSize;#agent=globalAgent;#path;#socketPath;#bodyChunks=null;#fetchRequest;#signal=null;[kAbortController]=null;#timeoutTimer=void 0;#options;#finished;get path(){return this.#path}get port(){return this.#port}get method(){return this.#method}get host(){return this.#host}get protocol(){return this.#protocol}_write(chunk,encoding,callback){if(!this.#bodyChunks){this.#bodyChunks=[chunk],callback();return}this.#bodyChunks.push(chunk),callback()}_writev(chunks,callback){if(!this.#bodyChunks){this.#bodyChunks=chunks,callback();return}this.#bodyChunks.push(...chunks),callback()}_final(callback){if(this.#finished=!0,this[kAbortController]=new AbortController,this[kAbortController].signal.addEventListener(\"abort\",()=>{this[kClearTimeout]()}),this.#signal\?.aborted)this[kAbortController].abort();var method=this.#method,body=Buffer.concat(this.#bodyChunks||[]);try{this.#fetchRequest=fetch(`${this.#protocol}//${this.#host}${this.#useDefaultPort\?\"\":\":\"+this.#port}${this.#path}`,{method,headers:this.getHeaders(),body:body&&method!==\"GET\"&&method!==\"HEAD\"&&method!==\"OPTIONS\"\?body:void 0,redirect:\"manual\",verbose:!1,signal:this[kAbortController].signal,timeout:!1}).then((response)=>{var res=this.#res=new IncomingMessage(response,{type:\"response\",[kInternalRequest]:this});this.emit(\"response\",res)}).catch((err)=>{this.emit(\"error\",err)}).finally(()=>{this.#fetchRequest=null,this[kClearTimeout]()})}catch(err){this.emit(\"error\",err)}finally{callback()}}get aborted(){return this.#signal\?.aborted||!!this[kAbortController]\?.signal.aborted}abort(){if(this.aborted)return;this[kAbortController].abort()}constructor(input,options,cb){super();if(typeof input===\"string\"){const urlStr=input;try{var urlObject=new URL(urlStr)}catch(e){@throwTypeError(`Invalid URL: ${urlStr}`)}input=urlToHttpOptions(urlObject)}else if(input&&typeof input===\"object\"&&input instanceof URL)input=urlToHttpOptions(input);else cb=options,options=input,input=null;if(typeof options===\"function\")cb=options,options=input||kEmptyObject;else options=ObjectAssign(input||{},options);var defaultAgent=options._defaultAgent||Agent.globalAgent;let protocol=options.protocol;if(!protocol)if(options.port===443)protocol=\"https:\";else protocol=defaultAgent.protocol||\"http:\";switch(this.#protocol=protocol,this.#agent\?.protocol){case void 0:break;case\"http:\":if(protocol===\"https:\"){defaultAgent=this.#agent=getDefaultHTTPSAgent();break}case\"https:\":if(protocol===\"https\"){defaultAgent=this.#agent=Agent.globalAgent;break}default:break}if(options.path){const path=String(options.path);if(RegExpPrototypeExec.call(INVALID_PATH_REGEX,path)!==null)throw new Error(\"Path contains unescaped characters\")}if(protocol!==\"http:\"&&protocol!==\"https:\"&&protocol){const expectedProtocol=defaultAgent\?.protocol\?\?\"http:\";throw new Error(`Protocol mismatch. Expected: ${expectedProtocol}. Got: ${protocol}`)}const defaultPort=protocol===\"https:\"\?443:80;this.#port=options.port||options.defaultPort||this.#agent\?.defaultPort||defaultPort,this.#useDefaultPort=this.#port===defaultPort;const host=this.#host=options.host=validateHost(options.hostname,\"hostname\")||validateHost(options.host,\"host\")||\"localhost\";this.#socketPath=options.socketPath;const signal=options.signal;if(signal)signal.addEventListener(\"abort\",()=>{this[kAbortController]\?.abort()}),this.#signal=signal;let method=options.method;const methodIsString=typeof method===\"string\";if(method!==null&&method!==void 0&&!methodIsString)throw new Error(\"ERR_INVALID_ARG_TYPE: options.method\");if(methodIsString&&method){if(!checkIsHttpToken(method))throw new Error(\"ERR_INVALID_HTTP_TOKEN: Method\");method=this.#method=StringPrototypeToUpperCase.call(method)}else method=this.#method=\"GET\";const _maxHeaderSize=options.maxHeaderSize;this.#maxHeaderSize=_maxHeaderSize;var _joinDuplicateHeaders=options.joinDuplicateHeaders;if(this.#joinDuplicateHeaders=_joinDuplicateHeaders,this.#path=options.path||\"/\",cb)this.once(\"response\",cb);this.#finished=!1,this.#res=null,this.#upgradeOrConnect=!1,this.#parser=null,this.#maxHeadersCount=null,this.#reusedSocket=!1,this.#host=host,this.#protocol=protocol;var timeout=options.timeout;if(timeout!==void 0&&timeout!==0)this.setTimeout(timeout,void 0);if(!ArrayIsArray(headers)){var headers=options.headers;if(headers)for(let key in headers)this.setHeader(key,headers[key]);var auth=options.auth;if(auth&&!this.getHeader(\"Authorization\"))this.setHeader(\"Authorization\",\"Basic \"+Buffer.from(auth).toString(\"base64\"))}var{signal:_signal,...optsWithoutSignal}=options;this.#options=optsWithoutSignal}setSocketKeepAlive(enable=!0,initialDelay=0){}setNoDelay(noDelay=!0){}[kClearTimeout](){if(this.#timeoutTimer)clearTimeout(this.#timeoutTimer),this.#timeoutTimer=void 0,this.removeAllListeners(\"timeout\")}#onTimeout(){this.#timeoutTimer=void 0,this[kAbortController]\?.abort(),this.emit(\"timeout\")}setTimeout(msecs,callback){if(this.destroyed)return this;if(this.timeout=msecs=validateMsecs(msecs,\"msecs\"),clearTimeout(this.#timeoutTimer),msecs===0){if(callback!==void 0)validateFunction(callback,\"callback\"),this.removeListener(\"timeout\",callback);this.#timeoutTimer=void 0}else if(this.#timeoutTimer=setTimeout(this.#onTimeout.bind(this),msecs).unref(),callback!==void 0)validateFunction(callback,\"callback\"),this.once(\"timeout\",callback);return this}}function urlToHttpOptions(url){var{protocol,hostname,hash,search,pathname,href,port,username,password}=url;return{protocol,hostname:typeof hostname===\"string\"&&StringPrototypeStartsWith.call(hostname,\"[\")\?StringPrototypeSlice.call(hostname,1,-1):hostname,hash,search,pathname,path:`${pathname||\"\"}${search||\"\"}`,href,port:port\?Number(port):protocol===\"https:\"\?443:protocol===\"http:\"\?80:void 0,auth:username||password\?`${decodeURIComponent(username)}:${decodeURIComponent(password)}`:void 0}}function validateHost(host,name){if(host!==null&&host!==void 0&&typeof host!==\"string\")throw new Error(\"Invalid arg type in options\");return host}const tokenRegExp=/^[\\^_`a-zA-Z\\-0-9!#$%&'*+.|~]+$/;function checkIsHttpToken(val){return RegExpPrototypeExec.call(tokenRegExp,val)!==null}const METHODS=[\"ACL\",\"BIND\",\"CHECKOUT\",\"CONNECT\",\"COPY\",\"DELETE\",\"GET\",\"HEAD\",\"LINK\",\"LOCK\",\"M-SEARCH\",\"MERGE\",\"MKACTIVITY\",\"MKCALENDAR\",\"MKCOL\",\"MOVE\",\"NOTIFY\",\"OPTIONS\",\"PATCH\",\"POST\",\"PROPFIND\",\"PROPPATCH\",\"PURGE\",\"PUT\",\"REBIND\",\"REPORT\",\"SEARCH\",\"SOURCE\",\"SUBSCRIBE\",\"TRACE\",\"UNBIND\",\"UNLINK\",\"UNLOCK\",\"UNSUBSCRIBE\"],STATUS_CODES={100:\"Continue\",101:\"Switching Protocols\",102:\"Processing\",103:\"Early Hints\",200:\"OK\",201:\"Created\",202:\"Accepted\",203:\"Non-Authoritative Information\",204:\"No Content\",205:\"Reset Content\",206:\"Partial Content\",207:\"Multi-Status\",208:\"Already Reported\",226:\"IM Used\",300:\"Multiple Choices\",301:\"Moved Permanently\",302:\"Found\",303:\"See Other\",304:\"Not Modified\",305:\"Use Proxy\",307:\"Temporary Redirect\",308:\"Permanent Redirect\",400:\"Bad Request\",401:\"Unauthorized\",402:\"Payment Required\",403:\"Forbidden\",404:\"Not Found\",405:\"Method Not Allowed\",406:\"Not Acceptable\",407:\"Proxy Authentication Required\",408:\"Request Timeout\",409:\"Conflict\",410:\"Gone\",411:\"Length Required\",412:\"Precondition Failed\",413:\"Payload Too Large\",414:\"URI Too Long\",415:\"Unsupported Media Type\",416:\"Range Not Satisfiable\",417:\"Expectation Failed\",418:\"I'm a Teapot\",421:\"Misdirected Request\",422:\"Unprocessable Entity\",423:\"Locked\",424:\"Failed Dependency\",425:\"Too Early\",426:\"Upgrade Required\",428:\"Precondition Required\",429:\"Too Many Requests\",431:\"Request Header Fields Too Large\",451:\"Unavailable For Legal Reasons\",500:\"Internal Server Error\",501:\"Not Implemented\",502:\"Bad Gateway\",503:\"Service Unavailable\",504:\"Gateway Timeout\",505:\"HTTP Version Not Supported\",506:\"Variant Also Negotiates\",507:\"Insufficient Storage\",508:\"Loop Detected\",509:\"Bandwidth Limit Exceeded\",510:\"Not Extended\",511:\"Network Authentication Required\"};function _normalizeArgs(args){let arr;if(args.length===0)return arr=[{},null],arr;const arg0=args[0];let options={};if(typeof arg0===\"object\"&&arg0!==null)options=arg0;else if(options.port=arg0,args.length>1&&typeof args[1]===\"string\")options.host=args[1];const cb=args[args.length-1];if(typeof cb!==\"function\")arr=[options,null];else arr=[options,cb];return arr}function _writeHead(statusCode,reason,obj,response){if(statusCode|=0,statusCode<100||statusCode>999)throw new Error(\"status code must be between 100 and 999\");if(typeof reason===\"string\")response.statusMessage=reason;else{if(!response.statusMessage)response.statusMessage=STATUS_CODES[statusCode]||\"unknown\";obj=reason}response.statusCode=statusCode;{let k;if(Array.isArray(obj)){if(obj.length%2!==0)throw new Error(\"raw headers must have an even number of elements\");for(let n=0;n<obj.length;n+=2)if(k=obj[n+0],k)response.setHeader(k,obj[n+1])}else if(obj){const keys=Object.keys(obj);for(let i=0;i<keys.length;i++)if(k=keys[i],k)response.setHeader(k,obj[k])}}if(statusCode===204||statusCode===304||statusCode>=100&&statusCode<=199)response._hasBody=!1}function request(url,options,cb){return new ClientRequest(url,options,cb)}function get(url,options,cb){const req=request(url,options,cb);return req.end(),req}var globalAgent=new Agent;return $={Agent,Server,METHODS,STATUS_CODES,createServer,ServerResponse,IncomingMessage,request,get,maxHeaderSize:16384,validateHeaderName,validateHeaderValue,setMaxIdleHTTPParsers(max){},globalAgent,ClientRequest,OutgoingMessage},$})\n"_s; +static constexpr ASCIILiteral NodeHttpCode = "(function (){\"use strict\";var $;const EventEmitter=@getInternalField(@internalModuleRegistry,15)||@createInternalModuleById(15),{isTypedArray}=@requireNativeModule(\"node:util/types\"),{Duplex,Readable,Writable}=@getInternalField(@internalModuleRegistry,34)||@createInternalModuleById(34),headerCharRegex=/[^\\t\\x20-\\x7e\\x80-\\xff]/;function checkInvalidHeaderChar(val){return RegExpPrototypeExec.call(headerCharRegex,val)!==null}const validateHeaderName=(name,label)=>{if(typeof name!==\"string\"||!name||!checkIsHttpToken(name))throw new Error(\"ERR_INVALID_HTTP_TOKEN\")},validateHeaderValue=(name,value)=>{if(value===void 0)throw new Error(\"ERR_HTTP_INVALID_HEADER_VALUE\");if(checkInvalidHeaderChar(value))throw new Error(\"ERR_INVALID_CHAR\")};function isIPv6(input){return new RegExp(\"^((\?:(\?:[0-9a-fA-F]{1,4}):){7}(\?:(\?:[0-9a-fA-F]{1,4})|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){6}(\?:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|:(\?:[0-9a-fA-F]{1,4})|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){5}(\?::((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,2}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){4}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,1}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,3}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){3}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,2}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,4}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){2}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,3}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,5}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){1}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,4}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,6}|:)|(\?::((\?::(\?:[0-9a-fA-F]{1,4})){0,5}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(\?::(\?:[0-9a-fA-F]{1,4})){1,7}|:)))(%[0-9a-zA-Z-.:]{1,})\?$\").test(input)}const{URL}=globalThis,globalReportError=globalThis.reportError,setTimeout=globalThis.setTimeout,fetch=Bun.fetch,nop=()=>{},kEmptyObject=Object.freeze(Object.create(null)),kOutHeaders=Symbol.for(\"kOutHeaders\"),kEndCalled=Symbol.for(\"kEndCalled\"),kAbortController=Symbol.for(\"kAbortController\"),kClearTimeout=Symbol(\"kClearTimeout\"),kCorked=Symbol.for(\"kCorked\"),searchParamsSymbol=Symbol.for(\"query\"),StringPrototypeSlice=String.prototype.slice,StringPrototypeStartsWith=String.prototype.startsWith,StringPrototypeToUpperCase=String.prototype.toUpperCase,StringPrototypeIncludes=String.prototype.includes,StringPrototypeCharCodeAt=String.prototype.charCodeAt,StringPrototypeIndexOf=String.prototype.indexOf,ArrayIsArray=Array.isArray,RegExpPrototypeExec=RegExp.prototype.exec,ObjectAssign=Object.assign,ObjectPrototypeHasOwnProperty=Object.prototype.hasOwnProperty,INVALID_PATH_REGEX=/[^\\u0021-\\u00ff]/,NODE_HTTP_WARNING=\"WARN: Agent is mostly unused in Bun's implementation of http. If you see strange behavior, this is probably the cause.\";var _defaultHTTPSAgent,kInternalRequest=Symbol(\"kInternalRequest\"),kInternalSocketData=Symbol.for(\"::bunternal::\");const kEmptyBuffer=Buffer.alloc(0);function isValidTLSArray(obj){if(typeof obj===\"string\"||isTypedArray(obj)||obj instanceof ArrayBuffer||obj instanceof Blob)return!0;if(Array.isArray(obj)){for(var i=0;i<obj.length;i++)if(typeof obj!==\"string\"&&!isTypedArray(obj)&&!(obj instanceof ArrayBuffer)&&!(obj instanceof Blob))return!1;return!0}}class ERR_INVALID_ARG_TYPE extends TypeError{constructor(name,expected,actual){super(`The ${name} argument must be of type ${expected}. Received type ${typeof actual}`);this.code=\"ERR_INVALID_ARG_TYPE\"}}function validateMsecs(numberlike,field){if(typeof numberlike!==\"number\"||numberlike<0)throw new ERR_INVALID_ARG_TYPE(field,\"number\",numberlike);return numberlike}function validateFunction(callable,field){if(typeof callable!==\"function\")throw new ERR_INVALID_ARG_TYPE(field,\"Function\",callable);return callable}function getHeader(headers,name){if(!headers)return;const result=headers.get(name);return result==null\?void 0:result}var FakeSocket=class Socket extends Duplex{bytesRead=0;bytesWritten=0;connecting=!1;remoteAddress=null;remotePort;timeout=0;isServer=!1;address(){return{address:this.localAddress,family:this.localFamily,port:this.localPort}}get bufferSize(){return this.writableLength}connect(port,host,connectListener){return this}_destroy(err,callback){}_final(callback){}get localAddress(){return\"127.0.0.1\"}get localFamily(){return\"IPv4\"}get localPort(){return 80}get pending(){return this.connecting}_read(size){}get readyState(){if(this.connecting)return\"opening\";if(this.readable)return this.writable\?\"open\":\"readOnly\";else return this.writable\?\"writeOnly\":\"closed\"}ref(){}get remoteFamily(){return\"IPv4\"}resetAndDestroy(){}setKeepAlive(enable=!1,initialDelay=0){}setNoDelay(noDelay=!0){return this}setTimeout(timeout,callback){return this}unref(){}_write(chunk,encoding,callback){}};function createServer(options,callback){return new Server(options,callback)}class Agent extends EventEmitter{defaultPort=80;protocol=\"http:\";options;requests;sockets;freeSockets;keepAliveMsecs;keepAlive;maxSockets;maxFreeSockets;scheduling;maxTotalSockets;totalSocketCount;#fakeSocket;static get globalAgent(){return globalAgent}static get defaultMaxSockets(){return Infinity}constructor(options=kEmptyObject){super();if(this.options=options={...options,path:null},options.noDelay===void 0)options.noDelay=!0;this.requests=kEmptyObject,this.sockets=kEmptyObject,this.freeSockets=kEmptyObject,this.keepAliveMsecs=options.keepAliveMsecs||1000,this.keepAlive=options.keepAlive||!1,this.maxSockets=options.maxSockets||Agent.defaultMaxSockets,this.maxFreeSockets=options.maxFreeSockets||256,this.scheduling=options.scheduling||\"lifo\",this.maxTotalSockets=options.maxTotalSockets,this.totalSocketCount=0,this.defaultPort=options.defaultPort||80,this.protocol=options.protocol||\"http:\"}createConnection(){return this.#fakeSocket\?\?=new FakeSocket}getName(options=kEmptyObject){let name=`http:${options.host||\"localhost\"}:`;if(options.port)name+=options.port;if(name+=\":\",options.localAddress)name+=options.localAddress;if(options.family===4||options.family===6)name+=`:${options.family}`;if(options.socketPath)name+=`:${options.socketPath}`;return name}addRequest(){}createSocket(req,options,cb){cb(null,this.#fakeSocket\?\?=new FakeSocket)}removeSocket(){}keepSocketAlive(){return!0}reuseSocket(){}destroy(){}}function emitListeningNextTick(self,onListen,err,hostname,port){if(typeof onListen===\"function\")try{onListen(err,hostname,port)}catch(err2){self.emit(\"error\",err2)}if(self.listening=!err,err)self.emit(\"error\",err);else self.emit(\"listening\",hostname,port)}class Server extends EventEmitter{#server;#options;#tls;#is_tls=!1;listening=!1;serverName;constructor(options,callback){super();if(typeof options===\"function\")callback=options,options={};else if(options==null||typeof options===\"object\"){options={...options},this.#tls=null;let key=options.key;if(key){if(!isValidTLSArray(key))@throwTypeError(\"key argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");this.#is_tls=!0}let cert=options.cert;if(cert){if(!isValidTLSArray(cert))@throwTypeError(\"cert argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");this.#is_tls=!0}let ca=options.ca;if(ca){if(!isValidTLSArray(ca))@throwTypeError(\"ca argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");this.#is_tls=!0}let passphrase=options.passphrase;if(passphrase&&typeof passphrase!==\"string\")@throwTypeError(\"passphrase argument must be an string\");let serverName=options.servername;if(serverName&&typeof serverName!==\"string\")@throwTypeError(\"servername argument must be an string\");let secureOptions=options.secureOptions||0;if(secureOptions&&typeof secureOptions!==\"number\")@throwTypeError(\"secureOptions argument must be an number\");if(this.#is_tls)this.#tls={serverName,key,cert,ca,passphrase,secureOptions};else this.#tls=null}else throw new Error(\"bun-http-polyfill: invalid arguments\");if(this.#options=options,callback)this.on(\"request\",callback)}closeAllConnections(){const server=this.#server;if(!server)return;this.#server=void 0,server.stop(!0),this.emit(\"close\")}closeIdleConnections(){}close(optionalCallback){const server=this.#server;if(!server){if(typeof optionalCallback===\"function\")process.nextTick(optionalCallback,new Error(\"Server is not running\"));return}if(this.#server=void 0,typeof optionalCallback===\"function\")this.once(\"close\",optionalCallback);server.stop(),this.emit(\"close\")}address(){if(!this.#server)return null;const address=this.#server.hostname;return{address,family:isIPv6(address)\?\"IPv6\":\"IPv4\",port:this.#server.port}}listen(port,host,backlog,onListen){const server=this;if(typeof host===\"function\")onListen=host,host=void 0;if(typeof port===\"function\")onListen=port;else if(typeof port===\"object\"){if(port\?.signal\?.addEventListener(\"abort\",()=>{this.close()}),host=port\?.host,port=port\?.port,typeof port\?.callback===\"function\")onListen=port\?.callback}if(typeof backlog===\"function\")onListen=backlog;const ResponseClass=this.#options.ServerResponse||ServerResponse,RequestClass=this.#options.IncomingMessage||IncomingMessage;try{const tls=this.#tls;if(tls)this.serverName=tls.serverName||host||\"localhost\";this.#server=Bun.serve({tls,port,hostname:host,websocket:{open(ws){ws.data.open(ws)},message(ws,message){ws.data.message(ws,message)},close(ws,code,reason){ws.data.close(ws,code,reason)},drain(ws){ws.data.drain(ws)}},fetch(req,_server){var pendingResponse,pendingError,rejectFunction,resolveFunction,reject=(err)=>{if(pendingError)return;if(pendingError=err,rejectFunction)rejectFunction(err)},reply=function(resp){if(pendingResponse)return;if(pendingResponse=resp,resolveFunction)resolveFunction(resp)};const http_req=new RequestClass(req),http_res=new ResponseClass({reply,req:http_req});if(http_req.once(\"error\",(err)=>reject(err)),http_res.once(\"error\",(err)=>reject(err)),req.headers.get(\"upgrade\")){const socket=new FakeSocket;socket[kInternalSocketData]=[_server,http_res,req],server.emit(\"upgrade\",http_req,socket,kEmptyBuffer)}else server.emit(\"request\",http_req,http_res);if(pendingError)throw pendingError;if(pendingResponse)return pendingResponse;return new Promise((resolve,reject2)=>{resolveFunction=resolve,rejectFunction=reject2})}}),setTimeout(emitListeningNextTick,1,this,onListen,null,this.#server.hostname,this.#server.port)}catch(err){setTimeout(emitListeningNextTick,1,this,onListen,err)}return this}setTimeout(msecs,callback){}}function assignHeaders(object,req){var headers=req.headers.toJSON();const rawHeaders=@newArrayWithSize(req.headers.count*2);var i=0;for(let key in headers)rawHeaders[i++]=key,rawHeaders[i++]=headers[key];object.headers=headers,object.rawHeaders=rawHeaders}function destroyBodyStreamNT(bodyStream){bodyStream.destroy()}var defaultIncomingOpts={type:\"request\"};function getDefaultHTTPSAgent(){return _defaultHTTPSAgent\?\?=new Agent({defaultPort:443,protocol:\"https:\"})}class IncomingMessage extends Readable{method;complete;constructor(req,defaultIncomingOpts2){const method=req.method;super();const url=new URL(req.url);var{type=\"request\",[kInternalRequest]:nodeReq}=defaultIncomingOpts2||{};this.#noBody=type===\"request\"\?method===\"GET\"||method===\"HEAD\"||method===\"TRACE\"||method===\"CONNECT\"||method===\"OPTIONS\"||(parseInt(req.headers.get(\"Content-Length\")||\"\")||0)===0:!1,this.#req=req,this.method=method,this.#type=type,this.complete=!!this.#noBody,this.#bodyStream=void 0;const socket=new FakeSocket;socket.remoteAddress=url.hostname,socket.remotePort=url.port,this.#fakeSocket=socket,this.url=url.pathname+url.search,this.#nodeReq=nodeReq,assignHeaders(this,req)}headers;rawHeaders;_consuming=!1;_dumped=!1;#bodyStream;#fakeSocket;#noBody=!1;#aborted=!1;#req;url;#type;#nodeReq;get req(){return this.#nodeReq}_construct(callback){if(this.#type===\"response\"||this.#noBody){callback();return}const contentLength=this.#req.headers.get(\"content-length\");if((contentLength\?parseInt(contentLength,10):0)===0){this.#noBody=!0,callback();return}callback()}async#consumeStream(reader){while(!0){var{done,value}=await reader.readMany();if(this.#aborted)return;if(done){this.push(null),this.destroy();break}for(var v of value)this.push(v)}}_read(size){if(this.#noBody)this.push(null),this.complete=!0;else if(this.#bodyStream==null){const reader=this.#req.body\?.getReader();if(!reader){this.push(null);return}this.#bodyStream=reader,this.#consumeStream(reader)}}get aborted(){return this.#aborted}#abort(){if(this.#aborted)return;this.#aborted=!0;var bodyStream=this.#bodyStream;if(!bodyStream)return;bodyStream.cancel(),this.complete=!0,this.#bodyStream=void 0,this.push(null)}get connection(){return this.#fakeSocket}get statusCode(){return this.#req.status}get statusMessage(){return STATUS_CODES[this.#req.status]}get httpVersion(){return\"1.1\"}get rawTrailers(){return[]}get httpVersionMajor(){return 1}get httpVersionMinor(){return 1}get trailers(){return kEmptyObject}get socket(){return this.#fakeSocket\?\?=new FakeSocket}set socket(val){this.#fakeSocket=val}setTimeout(msecs,callback){throw new Error(\"not implemented\")}}function emitErrorNt(msg,err,callback){if(callback(err),typeof msg.emit===\"function\"&&!msg._closed)msg.emit(\"error\",err)}function onError(self,err,cb){process.nextTick(()=>emitErrorNt(self,err,cb))}function write_(msg,chunk,encoding,callback,fromEnd){if(typeof callback!==\"function\")callback=nop;let len;if(chunk===null)throw new Error(\"ERR_STREAM_NULL_VALUES\");else if(typeof chunk===\"string\")len=Buffer.byteLength(chunk,encoding);else throw new Error(\"Invalid arg type for chunk\");let err;if(msg.finished)err=new Error(\"ERR_STREAM_WRITE_AFTER_END\");else if(msg.destroyed)err=new Error(\"ERR_STREAM_DESTROYED\");if(err){if(!msg.destroyed)onError(msg,err,callback);else process.nextTick(callback,err);return!1}if(!msg._header){if(fromEnd)msg._contentLength=len}if(!msg._hasBody)return process.nextTick(callback),!0;return!0}class OutgoingMessage extends Writable{constructor(){super(...arguments)}#headers;headersSent=!1;sendDate=!0;req;timeout;#finished=!1;[kEndCalled]=!1;#fakeSocket;#timeoutTimer;[kAbortController]=null;_implicitHeader(){}get headers(){if(!this.#headers)return kEmptyObject;return this.#headers.toJSON()}get shouldKeepAlive(){return!0}get chunkedEncoding(){return!1}set chunkedEncoding(value){}set shouldKeepAlive(value){}get useChunkedEncodingByDefault(){return!0}set useChunkedEncodingByDefault(value){}get socket(){return this.#fakeSocket\?\?=new FakeSocket}set socket(val){this.#fakeSocket=val}get connection(){return this.socket}get finished(){return this.#finished}appendHeader(name,value){var headers=this.#headers\?\?=new Headers;headers.append(name,value)}flushHeaders(){}getHeader(name){return getHeader(this.#headers,name)}getHeaders(){if(!this.#headers)return kEmptyObject;return this.#headers.toJSON()}getHeaderNames(){var headers=this.#headers;if(!headers)return[];return Array.from(headers.keys())}removeHeader(name){if(!this.#headers)return;this.#headers.delete(name)}setHeader(name,value){var headers=this.#headers\?\?=new Headers;return headers.set(name,value),this}hasHeader(name){if(!this.#headers)return!1;return this.#headers.has(name)}addTrailers(headers){throw new Error(\"not implemented\")}[kClearTimeout](){if(this.#timeoutTimer)clearTimeout(this.#timeoutTimer),this.removeAllListeners(\"timeout\"),this.#timeoutTimer=void 0}#onTimeout(){this.#timeoutTimer=void 0,this[kAbortController]\?.abort(),this.emit(\"timeout\")}setTimeout(msecs,callback){if(this.destroyed)return this;if(this.timeout=msecs=validateMsecs(msecs,\"msecs\"),clearTimeout(this.#timeoutTimer),msecs===0){if(callback!==void 0)validateFunction(callback,\"callback\"),this.removeListener(\"timeout\",callback);this.#timeoutTimer=void 0}else if(this.#timeoutTimer=setTimeout(this.#onTimeout.bind(this),msecs).unref(),callback!==void 0)validateFunction(callback,\"callback\"),this.once(\"timeout\",callback);return this}}let OriginalWriteHeadFn,OriginalImplicitHeadFn;class ServerResponse extends Writable{constructor({req,reply}){super();if(this.req=req,this._reply=reply,this.sendDate=!0,this.statusCode=200,this.headersSent=!1,this.statusMessage=void 0,this.#controller=void 0,this.#firstWrite=void 0,this._writableState.decodeStrings=!1,this.#deferred=void 0,req.method===\"HEAD\")this._hasBody=!1}req;_reply;sendDate;statusCode;#headers;headersSent=!1;statusMessage;#controller;#firstWrite;_sent100=!1;_defaultKeepAlive=!1;_removedConnection=!1;_removedContLen=!1;_hasBody=!0;#deferred=void 0;#finished=!1;_implicitHeader(){this.writeHead(this.statusCode)}_write(chunk,encoding,callback){if(!this.#firstWrite&&!this.headersSent){this.#firstWrite=chunk,callback();return}this.#ensureReadableStreamController((controller)=>{controller.write(chunk),callback()})}_writev(chunks,callback){if(chunks.length===1&&!this.headersSent&&!this.#firstWrite){this.#firstWrite=chunks[0].chunk,callback();return}this.#ensureReadableStreamController((controller)=>{for(let chunk of chunks)controller.write(chunk.chunk);callback()})}#ensureReadableStreamController(run){var thisController=this.#controller;if(thisController)return run(thisController);this.headersSent=!0;var firstWrite=this.#firstWrite;this.#firstWrite=void 0,this._reply(new Response(new ReadableStream({type:\"direct\",pull:(controller)=>{if(this.#controller=controller,firstWrite)controller.write(firstWrite);if(firstWrite=void 0,run(controller),!this.#finished)return new Promise((resolve)=>{this.#deferred=resolve})}}),{headers:this.#headers,status:this.statusCode,statusText:this.statusMessage\?\?STATUS_CODES[this.statusCode]}))}#drainHeadersIfObservable(){if(this._implicitHeader===OriginalImplicitHeadFn&&this.writeHead===OriginalWriteHeadFn)return;this._implicitHeader()}_final(callback){if(!this.headersSent){var data=this.#firstWrite||\"\";this.#firstWrite=void 0,this.#finished=!0,this.#drainHeadersIfObservable(),this._reply(new Response(data,{headers:this.#headers,status:this.statusCode,statusText:this.statusMessage\?\?STATUS_CODES[this.statusCode]})),callback&&callback();return}this.#finished=!0,this.#ensureReadableStreamController((controller)=>{controller.end(),callback();var deferred=this.#deferred;if(deferred)this.#deferred=void 0,deferred()})}writeProcessing(){throw new Error(\"not implemented\")}addTrailers(headers){throw new Error(\"not implemented\")}assignSocket(socket){throw new Error(\"not implemented\")}detachSocket(socket){throw new Error(\"not implemented\")}writeContinue(callback){throw new Error(\"not implemented\")}setTimeout(msecs,callback){throw new Error(\"not implemented\")}get shouldKeepAlive(){return!0}get chunkedEncoding(){return!1}set chunkedEncoding(value){}set shouldKeepAlive(value){}get useChunkedEncodingByDefault(){return!0}set useChunkedEncodingByDefault(value){}appendHeader(name,value){var headers=this.#headers\?\?=new Headers;headers.append(name,value)}flushHeaders(){}getHeader(name){return getHeader(this.#headers,name)}getHeaders(){var headers=this.#headers;if(!headers)return kEmptyObject;return headers.toJSON()}getHeaderNames(){var headers=this.#headers;if(!headers)return[];return Array.from(headers.keys())}removeHeader(name){if(!this.#headers)return;this.#headers.delete(name)}setHeader(name,value){var headers=this.#headers\?\?=new Headers;return headers.set(name,value),this}hasHeader(name){if(!this.#headers)return!1;return this.#headers.has(name)}writeHead(statusCode,statusMessage,headers){return _writeHead(statusCode,statusMessage,headers,this),this}}OriginalWriteHeadFn=ServerResponse.prototype.writeHead,OriginalImplicitHeadFn=ServerResponse.prototype._implicitHeader;class ClientRequest extends OutgoingMessage{#timeout;#res=null;#upgradeOrConnect=!1;#parser=null;#maxHeadersCount=null;#reusedSocket=!1;#host;#protocol;#method;#port;#useDefaultPort;#joinDuplicateHeaders;#maxHeaderSize;#agent=globalAgent;#path;#socketPath;#bodyChunks=null;#fetchRequest;#signal=null;[kAbortController]=null;#timeoutTimer=void 0;#options;#finished;get path(){return this.#path}get port(){return this.#port}get method(){return this.#method}get host(){return this.#host}get protocol(){return this.#protocol}_write(chunk,encoding,callback){if(!this.#bodyChunks){this.#bodyChunks=[chunk],callback();return}this.#bodyChunks.push(chunk),callback()}_writev(chunks,callback){if(!this.#bodyChunks){this.#bodyChunks=chunks,callback();return}this.#bodyChunks.push(...chunks),callback()}_final(callback){if(this.#finished=!0,this[kAbortController]=new AbortController,this[kAbortController].signal.addEventListener(\"abort\",()=>{this[kClearTimeout]()}),this.#signal\?.aborted)this[kAbortController].abort();var method=this.#method,body=this.#bodyChunks\?.length===1\?this.#bodyChunks[0]:Buffer.concat(this.#bodyChunks||[]);try{this.#fetchRequest=fetch(`${this.#protocol}//${this.#host}${this.#useDefaultPort\?\"\":\":\"+this.#port}${this.#path}`,{method,headers:this.getHeaders(),body:body&&method!==\"GET\"&&method!==\"HEAD\"&&method!==\"OPTIONS\"\?body:void 0,redirect:\"manual\",verbose:!1,signal:this[kAbortController].signal,timeout:!1}).then((response)=>{var res=this.#res=new IncomingMessage(response,{type:\"response\",[kInternalRequest]:this});this.emit(\"response\",res)}).catch((err)=>{this.emit(\"error\",err)}).finally(()=>{this.#fetchRequest=null,this[kClearTimeout]()})}catch(err){this.emit(\"error\",err)}finally{callback()}}get aborted(){return this.#signal\?.aborted||!!this[kAbortController]\?.signal.aborted}abort(){if(this.aborted)return;this[kAbortController].abort()}constructor(input,options,cb){super();if(typeof input===\"string\"){const urlStr=input;try{var urlObject=new URL(urlStr)}catch(e){@throwTypeError(`Invalid URL: ${urlStr}`)}input=urlToHttpOptions(urlObject)}else if(input&&typeof input===\"object\"&&input instanceof URL)input=urlToHttpOptions(input);else cb=options,options=input,input=null;if(typeof options===\"function\")cb=options,options=input||kEmptyObject;else options=ObjectAssign(input||{},options);var defaultAgent=options._defaultAgent||Agent.globalAgent;let protocol=options.protocol;if(!protocol)if(options.port===443)protocol=\"https:\";else protocol=defaultAgent.protocol||\"http:\";switch(this.#protocol=protocol,this.#agent\?.protocol){case void 0:break;case\"http:\":if(protocol===\"https:\"){defaultAgent=this.#agent=getDefaultHTTPSAgent();break}case\"https:\":if(protocol===\"https\"){defaultAgent=this.#agent=Agent.globalAgent;break}default:break}if(options.path){const path=String(options.path);if(RegExpPrototypeExec.call(INVALID_PATH_REGEX,path)!==null)throw new Error(\"Path contains unescaped characters\")}if(protocol!==\"http:\"&&protocol!==\"https:\"&&protocol){const expectedProtocol=defaultAgent\?.protocol\?\?\"http:\";throw new Error(`Protocol mismatch. Expected: ${expectedProtocol}. Got: ${protocol}`)}const defaultPort=protocol===\"https:\"\?443:80;this.#port=options.port||options.defaultPort||this.#agent\?.defaultPort||defaultPort,this.#useDefaultPort=this.#port===defaultPort;const host=this.#host=options.host=validateHost(options.hostname,\"hostname\")||validateHost(options.host,\"host\")||\"localhost\";this.#socketPath=options.socketPath;const signal=options.signal;if(signal)signal.addEventListener(\"abort\",()=>{this[kAbortController]\?.abort()}),this.#signal=signal;let method=options.method;const methodIsString=typeof method===\"string\";if(method!==null&&method!==void 0&&!methodIsString)throw new Error(\"ERR_INVALID_ARG_TYPE: options.method\");if(methodIsString&&method){if(!checkIsHttpToken(method))throw new Error(\"ERR_INVALID_HTTP_TOKEN: Method\");method=this.#method=StringPrototypeToUpperCase.call(method)}else method=this.#method=\"GET\";const _maxHeaderSize=options.maxHeaderSize;this.#maxHeaderSize=_maxHeaderSize;var _joinDuplicateHeaders=options.joinDuplicateHeaders;if(this.#joinDuplicateHeaders=_joinDuplicateHeaders,this.#path=options.path||\"/\",cb)this.once(\"response\",cb);this.#finished=!1,this.#res=null,this.#upgradeOrConnect=!1,this.#parser=null,this.#maxHeadersCount=null,this.#reusedSocket=!1,this.#host=host,this.#protocol=protocol;var timeout=options.timeout;if(timeout!==void 0&&timeout!==0)this.setTimeout(timeout,void 0);if(!ArrayIsArray(headers)){var headers=options.headers;if(headers)for(let key in headers)this.setHeader(key,headers[key]);var auth=options.auth;if(auth&&!this.getHeader(\"Authorization\"))this.setHeader(\"Authorization\",\"Basic \"+Buffer.from(auth).toString(\"base64\"))}var{signal:_signal,...optsWithoutSignal}=options;this.#options=optsWithoutSignal}setSocketKeepAlive(enable=!0,initialDelay=0){}setNoDelay(noDelay=!0){}[kClearTimeout](){if(this.#timeoutTimer)clearTimeout(this.#timeoutTimer),this.#timeoutTimer=void 0,this.removeAllListeners(\"timeout\")}#onTimeout(){this.#timeoutTimer=void 0,this[kAbortController]\?.abort(),this.emit(\"timeout\")}setTimeout(msecs,callback){if(this.destroyed)return this;if(this.timeout=msecs=validateMsecs(msecs,\"msecs\"),clearTimeout(this.#timeoutTimer),msecs===0){if(callback!==void 0)validateFunction(callback,\"callback\"),this.removeListener(\"timeout\",callback);this.#timeoutTimer=void 0}else if(this.#timeoutTimer=setTimeout(this.#onTimeout.bind(this),msecs).unref(),callback!==void 0)validateFunction(callback,\"callback\"),this.once(\"timeout\",callback);return this}}function urlToHttpOptions(url){var{protocol,hostname,hash,search,pathname,href,port,username,password}=url;return{protocol,hostname:typeof hostname===\"string\"&&StringPrototypeStartsWith.call(hostname,\"[\")\?StringPrototypeSlice.call(hostname,1,-1):hostname,hash,search,pathname,path:`${pathname||\"\"}${search||\"\"}`,href,port:port\?Number(port):protocol===\"https:\"\?443:protocol===\"http:\"\?80:void 0,auth:username||password\?`${decodeURIComponent(username)}:${decodeURIComponent(password)}`:void 0}}function validateHost(host,name){if(host!==null&&host!==void 0&&typeof host!==\"string\")throw new Error(\"Invalid arg type in options\");return host}const tokenRegExp=/^[\\^_`a-zA-Z\\-0-9!#$%&'*+.|~]+$/;function checkIsHttpToken(val){return RegExpPrototypeExec.call(tokenRegExp,val)!==null}const METHODS=[\"ACL\",\"BIND\",\"CHECKOUT\",\"CONNECT\",\"COPY\",\"DELETE\",\"GET\",\"HEAD\",\"LINK\",\"LOCK\",\"M-SEARCH\",\"MERGE\",\"MKACTIVITY\",\"MKCALENDAR\",\"MKCOL\",\"MOVE\",\"NOTIFY\",\"OPTIONS\",\"PATCH\",\"POST\",\"PROPFIND\",\"PROPPATCH\",\"PURGE\",\"PUT\",\"REBIND\",\"REPORT\",\"SEARCH\",\"SOURCE\",\"SUBSCRIBE\",\"TRACE\",\"UNBIND\",\"UNLINK\",\"UNLOCK\",\"UNSUBSCRIBE\"],STATUS_CODES={100:\"Continue\",101:\"Switching Protocols\",102:\"Processing\",103:\"Early Hints\",200:\"OK\",201:\"Created\",202:\"Accepted\",203:\"Non-Authoritative Information\",204:\"No Content\",205:\"Reset Content\",206:\"Partial Content\",207:\"Multi-Status\",208:\"Already Reported\",226:\"IM Used\",300:\"Multiple Choices\",301:\"Moved Permanently\",302:\"Found\",303:\"See Other\",304:\"Not Modified\",305:\"Use Proxy\",307:\"Temporary Redirect\",308:\"Permanent Redirect\",400:\"Bad Request\",401:\"Unauthorized\",402:\"Payment Required\",403:\"Forbidden\",404:\"Not Found\",405:\"Method Not Allowed\",406:\"Not Acceptable\",407:\"Proxy Authentication Required\",408:\"Request Timeout\",409:\"Conflict\",410:\"Gone\",411:\"Length Required\",412:\"Precondition Failed\",413:\"Payload Too Large\",414:\"URI Too Long\",415:\"Unsupported Media Type\",416:\"Range Not Satisfiable\",417:\"Expectation Failed\",418:\"I'm a Teapot\",421:\"Misdirected Request\",422:\"Unprocessable Entity\",423:\"Locked\",424:\"Failed Dependency\",425:\"Too Early\",426:\"Upgrade Required\",428:\"Precondition Required\",429:\"Too Many Requests\",431:\"Request Header Fields Too Large\",451:\"Unavailable For Legal Reasons\",500:\"Internal Server Error\",501:\"Not Implemented\",502:\"Bad Gateway\",503:\"Service Unavailable\",504:\"Gateway Timeout\",505:\"HTTP Version Not Supported\",506:\"Variant Also Negotiates\",507:\"Insufficient Storage\",508:\"Loop Detected\",509:\"Bandwidth Limit Exceeded\",510:\"Not Extended\",511:\"Network Authentication Required\"};function _normalizeArgs(args){let arr;if(args.length===0)return arr=[{},null],arr;const arg0=args[0];let options={};if(typeof arg0===\"object\"&&arg0!==null)options=arg0;else if(options.port=arg0,args.length>1&&typeof args[1]===\"string\")options.host=args[1];const cb=args[args.length-1];if(typeof cb!==\"function\")arr=[options,null];else arr=[options,cb];return arr}function _writeHead(statusCode,reason,obj,response){if(statusCode|=0,statusCode<100||statusCode>999)throw new Error(\"status code must be between 100 and 999\");if(typeof reason===\"string\")response.statusMessage=reason;else{if(!response.statusMessage)response.statusMessage=STATUS_CODES[statusCode]||\"unknown\";obj=reason}response.statusCode=statusCode;{let k;if(Array.isArray(obj)){if(obj.length%2!==0)throw new Error(\"raw headers must have an even number of elements\");for(let n=0;n<obj.length;n+=2)if(k=obj[n+0],k)response.setHeader(k,obj[n+1])}else if(obj){const keys=Object.keys(obj);for(let i=0;i<keys.length;i++)if(k=keys[i],k)response.setHeader(k,obj[k])}}if(statusCode===204||statusCode===304||statusCode>=100&&statusCode<=199)response._hasBody=!1}function request(url,options,cb){return new ClientRequest(url,options,cb)}function get(url,options,cb){const req=request(url,options,cb);return req.end(),req}var globalAgent=new Agent;return $={Agent,Server,METHODS,STATUS_CODES,createServer,ServerResponse,IncomingMessage,request,get,maxHeaderSize:16384,validateHeaderName,validateHeaderValue,setMaxIdleHTTPParsers(max){},globalAgent,ClientRequest,OutgoingMessage},$})\n"_s; static constexpr ASCIILiteral NodeHttp2Code = "(function (){\"use strict\";var $;const{hideFromStack,throwNotImplemented}=@getInternalField(@internalModuleRegistry,2)||@createInternalModuleById(2);function connect(){throwNotImplemented(\"node:http2 connect\",887)}const constants={NGHTTP2_ERR_FRAME_SIZE_ERROR:-522,NGHTTP2_SESSION_SERVER:0,NGHTTP2_SESSION_CLIENT:1,NGHTTP2_STREAM_STATE_IDLE:1,NGHTTP2_STREAM_STATE_OPEN:2,NGHTTP2_STREAM_STATE_RESERVED_LOCAL:3,NGHTTP2_STREAM_STATE_RESERVED_REMOTE:4,NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL:5,NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE:6,NGHTTP2_STREAM_STATE_CLOSED:7,NGHTTP2_FLAG_NONE:0,NGHTTP2_FLAG_END_STREAM:1,NGHTTP2_FLAG_END_HEADERS:4,NGHTTP2_FLAG_ACK:1,NGHTTP2_FLAG_PADDED:8,NGHTTP2_FLAG_PRIORITY:32,DEFAULT_SETTINGS_HEADER_TABLE_SIZE:4096,DEFAULT_SETTINGS_ENABLE_PUSH:1,DEFAULT_SETTINGS_MAX_CONCURRENT_STREAMS:4294967295,DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE:65535,DEFAULT_SETTINGS_MAX_FRAME_SIZE:16384,DEFAULT_SETTINGS_MAX_HEADER_LIST_SIZE:65535,DEFAULT_SETTINGS_ENABLE_CONNECT_PROTOCOL:0,MAX_MAX_FRAME_SIZE:16777215,MIN_MAX_FRAME_SIZE:16384,MAX_INITIAL_WINDOW_SIZE:2147483647,NGHTTP2_SETTINGS_HEADER_TABLE_SIZE:1,NGHTTP2_SETTINGS_ENABLE_PUSH:2,NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS:3,NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE:4,NGHTTP2_SETTINGS_MAX_FRAME_SIZE:5,NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE:6,NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:8,PADDING_STRATEGY_NONE:0,PADDING_STRATEGY_ALIGNED:1,PADDING_STRATEGY_MAX:2,PADDING_STRATEGY_CALLBACK:1,NGHTTP2_NO_ERROR:0,NGHTTP2_PROTOCOL_ERROR:1,NGHTTP2_INTERNAL_ERROR:2,NGHTTP2_FLOW_CONTROL_ERROR:3,NGHTTP2_SETTINGS_TIMEOUT:4,NGHTTP2_STREAM_CLOSED:5,NGHTTP2_FRAME_SIZE_ERROR:6,NGHTTP2_REFUSED_STREAM:7,NGHTTP2_CANCEL:8,NGHTTP2_COMPRESSION_ERROR:9,NGHTTP2_CONNECT_ERROR:10,NGHTTP2_ENHANCE_YOUR_CALM:11,NGHTTP2_INADEQUATE_SECURITY:12,NGHTTP2_HTTP_1_1_REQUIRED:13,NGHTTP2_DEFAULT_WEIGHT:16,HTTP2_HEADER_STATUS:\":status\",HTTP2_HEADER_METHOD:\":method\",HTTP2_HEADER_AUTHORITY:\":authority\",HTTP2_HEADER_SCHEME:\":scheme\",HTTP2_HEADER_PATH:\":path\",HTTP2_HEADER_PROTOCOL:\":protocol\",HTTP2_HEADER_ACCEPT_ENCODING:\"accept-encoding\",HTTP2_HEADER_ACCEPT_LANGUAGE:\"accept-language\",HTTP2_HEADER_ACCEPT_RANGES:\"accept-ranges\",HTTP2_HEADER_ACCEPT:\"accept\",HTTP2_HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS:\"access-control-allow-credentials\",HTTP2_HEADER_ACCESS_CONTROL_ALLOW_HEADERS:\"access-control-allow-headers\",HTTP2_HEADER_ACCESS_CONTROL_ALLOW_METHODS:\"access-control-allow-methods\",HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN:\"access-control-allow-origin\",HTTP2_HEADER_ACCESS_CONTROL_EXPOSE_HEADERS:\"access-control-expose-headers\",HTTP2_HEADER_ACCESS_CONTROL_REQUEST_HEADERS:\"access-control-request-headers\",HTTP2_HEADER_ACCESS_CONTROL_REQUEST_METHOD:\"access-control-request-method\",HTTP2_HEADER_AGE:\"age\",HTTP2_HEADER_AUTHORIZATION:\"authorization\",HTTP2_HEADER_CACHE_CONTROL:\"cache-control\",HTTP2_HEADER_CONNECTION:\"connection\",HTTP2_HEADER_CONTENT_DISPOSITION:\"content-disposition\",HTTP2_HEADER_CONTENT_ENCODING:\"content-encoding\",HTTP2_HEADER_CONTENT_LENGTH:\"content-length\",HTTP2_HEADER_CONTENT_TYPE:\"content-type\",HTTP2_HEADER_COOKIE:\"cookie\",HTTP2_HEADER_DATE:\"date\",HTTP2_HEADER_ETAG:\"etag\",HTTP2_HEADER_FORWARDED:\"forwarded\",HTTP2_HEADER_HOST:\"host\",HTTP2_HEADER_IF_MODIFIED_SINCE:\"if-modified-since\",HTTP2_HEADER_IF_NONE_MATCH:\"if-none-match\",HTTP2_HEADER_IF_RANGE:\"if-range\",HTTP2_HEADER_LAST_MODIFIED:\"last-modified\",HTTP2_HEADER_LINK:\"link\",HTTP2_HEADER_LOCATION:\"location\",HTTP2_HEADER_RANGE:\"range\",HTTP2_HEADER_REFERER:\"referer\",HTTP2_HEADER_SERVER:\"server\",HTTP2_HEADER_SET_COOKIE:\"set-cookie\",HTTP2_HEADER_STRICT_TRANSPORT_SECURITY:\"strict-transport-security\",HTTP2_HEADER_TRANSFER_ENCODING:\"transfer-encoding\",HTTP2_HEADER_TE:\"te\",HTTP2_HEADER_UPGRADE_INSECURE_REQUESTS:\"upgrade-insecure-requests\",HTTP2_HEADER_UPGRADE:\"upgrade\",HTTP2_HEADER_USER_AGENT:\"user-agent\",HTTP2_HEADER_VARY:\"vary\",HTTP2_HEADER_X_CONTENT_TYPE_OPTIONS:\"x-content-type-options\",HTTP2_HEADER_X_FRAME_OPTIONS:\"x-frame-options\",HTTP2_HEADER_KEEP_ALIVE:\"keep-alive\",HTTP2_HEADER_PROXY_CONNECTION:\"proxy-connection\",HTTP2_HEADER_X_XSS_PROTECTION:\"x-xss-protection\",HTTP2_HEADER_ALT_SVC:\"alt-svc\",HTTP2_HEADER_CONTENT_SECURITY_POLICY:\"content-security-policy\",HTTP2_HEADER_EARLY_DATA:\"early-data\",HTTP2_HEADER_EXPECT_CT:\"expect-ct\",HTTP2_HEADER_ORIGIN:\"origin\",HTTP2_HEADER_PURPOSE:\"purpose\",HTTP2_HEADER_TIMING_ALLOW_ORIGIN:\"timing-allow-origin\",HTTP2_HEADER_X_FORWARDED_FOR:\"x-forwarded-for\",HTTP2_HEADER_PRIORITY:\"priority\",HTTP2_HEADER_ACCEPT_CHARSET:\"accept-charset\",HTTP2_HEADER_ACCESS_CONTROL_MAX_AGE:\"access-control-max-age\",HTTP2_HEADER_ALLOW:\"allow\",HTTP2_HEADER_CONTENT_LANGUAGE:\"content-language\",HTTP2_HEADER_CONTENT_LOCATION:\"content-location\",HTTP2_HEADER_CONTENT_MD5:\"content-md5\",HTTP2_HEADER_CONTENT_RANGE:\"content-range\",HTTP2_HEADER_DNT:\"dnt\",HTTP2_HEADER_EXPECT:\"expect\",HTTP2_HEADER_EXPIRES:\"expires\",HTTP2_HEADER_FROM:\"from\",HTTP2_HEADER_IF_MATCH:\"if-match\",HTTP2_HEADER_IF_UNMODIFIED_SINCE:\"if-unmodified-since\",HTTP2_HEADER_MAX_FORWARDS:\"max-forwards\",HTTP2_HEADER_PREFER:\"prefer\",HTTP2_HEADER_PROXY_AUTHENTICATE:\"proxy-authenticate\",HTTP2_HEADER_PROXY_AUTHORIZATION:\"proxy-authorization\",HTTP2_HEADER_REFRESH:\"refresh\",HTTP2_HEADER_RETRY_AFTER:\"retry-after\",HTTP2_HEADER_TRAILER:\"trailer\",HTTP2_HEADER_TK:\"tk\",HTTP2_HEADER_VIA:\"via\",HTTP2_HEADER_WARNING:\"warning\",HTTP2_HEADER_WWW_AUTHENTICATE:\"www-authenticate\",HTTP2_HEADER_HTTP2_SETTINGS:\"http2-settings\",HTTP2_METHOD_ACL:\"ACL\",HTTP2_METHOD_BASELINE_CONTROL:\"BASELINE-CONTROL\",HTTP2_METHOD_BIND:\"BIND\",HTTP2_METHOD_CHECKIN:\"CHECKIN\",HTTP2_METHOD_CHECKOUT:\"CHECKOUT\",HTTP2_METHOD_CONNECT:\"CONNECT\",HTTP2_METHOD_COPY:\"COPY\",HTTP2_METHOD_DELETE:\"DELETE\",HTTP2_METHOD_GET:\"GET\",HTTP2_METHOD_HEAD:\"HEAD\",HTTP2_METHOD_LABEL:\"LABEL\",HTTP2_METHOD_LINK:\"LINK\",HTTP2_METHOD_LOCK:\"LOCK\",HTTP2_METHOD_MERGE:\"MERGE\",HTTP2_METHOD_MKACTIVITY:\"MKACTIVITY\",HTTP2_METHOD_MKCALENDAR:\"MKCALENDAR\",HTTP2_METHOD_MKCOL:\"MKCOL\",HTTP2_METHOD_MKREDIRECTREF:\"MKREDIRECTREF\",HTTP2_METHOD_MKWORKSPACE:\"MKWORKSPACE\",HTTP2_METHOD_MOVE:\"MOVE\",HTTP2_METHOD_OPTIONS:\"OPTIONS\",HTTP2_METHOD_ORDERPATCH:\"ORDERPATCH\",HTTP2_METHOD_PATCH:\"PATCH\",HTTP2_METHOD_POST:\"POST\",HTTP2_METHOD_PRI:\"PRI\",HTTP2_METHOD_PROPFIND:\"PROPFIND\",HTTP2_METHOD_PROPPATCH:\"PROPPATCH\",HTTP2_METHOD_PUT:\"PUT\",HTTP2_METHOD_REBIND:\"REBIND\",HTTP2_METHOD_REPORT:\"REPORT\",HTTP2_METHOD_SEARCH:\"SEARCH\",HTTP2_METHOD_TRACE:\"TRACE\",HTTP2_METHOD_UNBIND:\"UNBIND\",HTTP2_METHOD_UNCHECKOUT:\"UNCHECKOUT\",HTTP2_METHOD_UNLINK:\"UNLINK\",HTTP2_METHOD_UNLOCK:\"UNLOCK\",HTTP2_METHOD_UPDATE:\"UPDATE\",HTTP2_METHOD_UPDATEREDIRECTREF:\"UPDATEREDIRECTREF\",HTTP2_METHOD_VERSION_CONTROL:\"VERSION-CONTROL\",HTTP_STATUS_CONTINUE:100,HTTP_STATUS_SWITCHING_PROTOCOLS:101,HTTP_STATUS_PROCESSING:102,HTTP_STATUS_EARLY_HINTS:103,HTTP_STATUS_OK:200,HTTP_STATUS_CREATED:201,HTTP_STATUS_ACCEPTED:202,HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION:203,HTTP_STATUS_NO_CONTENT:204,HTTP_STATUS_RESET_CONTENT:205,HTTP_STATUS_PARTIAL_CONTENT:206,HTTP_STATUS_MULTI_STATUS:207,HTTP_STATUS_ALREADY_REPORTED:208,HTTP_STATUS_IM_USED:226,HTTP_STATUS_MULTIPLE_CHOICES:300,HTTP_STATUS_MOVED_PERMANENTLY:301,HTTP_STATUS_FOUND:302,HTTP_STATUS_SEE_OTHER:303,HTTP_STATUS_NOT_MODIFIED:304,HTTP_STATUS_USE_PROXY:305,HTTP_STATUS_TEMPORARY_REDIRECT:307,HTTP_STATUS_PERMANENT_REDIRECT:308,HTTP_STATUS_BAD_REQUEST:400,HTTP_STATUS_UNAUTHORIZED:401,HTTP_STATUS_PAYMENT_REQUIRED:402,HTTP_STATUS_FORBIDDEN:403,HTTP_STATUS_NOT_FOUND:404,HTTP_STATUS_METHOD_NOT_ALLOWED:405,HTTP_STATUS_NOT_ACCEPTABLE:406,HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED:407,HTTP_STATUS_REQUEST_TIMEOUT:408,HTTP_STATUS_CONFLICT:409,HTTP_STATUS_GONE:410,HTTP_STATUS_LENGTH_REQUIRED:411,HTTP_STATUS_PRECONDITION_FAILED:412,HTTP_STATUS_PAYLOAD_TOO_LARGE:413,HTTP_STATUS_URI_TOO_LONG:414,HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE:415,HTTP_STATUS_RANGE_NOT_SATISFIABLE:416,HTTP_STATUS_EXPECTATION_FAILED:417,HTTP_STATUS_TEAPOT:418,HTTP_STATUS_MISDIRECTED_REQUEST:421,HTTP_STATUS_UNPROCESSABLE_ENTITY:422,HTTP_STATUS_LOCKED:423,HTTP_STATUS_FAILED_DEPENDENCY:424,HTTP_STATUS_TOO_EARLY:425,HTTP_STATUS_UPGRADE_REQUIRED:426,HTTP_STATUS_PRECONDITION_REQUIRED:428,HTTP_STATUS_TOO_MANY_REQUESTS:429,HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE:431,HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS:451,HTTP_STATUS_INTERNAL_SERVER_ERROR:500,HTTP_STATUS_NOT_IMPLEMENTED:501,HTTP_STATUS_BAD_GATEWAY:502,HTTP_STATUS_SERVICE_UNAVAILABLE:503,HTTP_STATUS_GATEWAY_TIMEOUT:504,HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED:505,HTTP_STATUS_VARIANT_ALSO_NEGOTIATES:506,HTTP_STATUS_INSUFFICIENT_STORAGE:507,HTTP_STATUS_LOOP_DETECTED:508,HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED:509,HTTP_STATUS_NOT_EXTENDED:510,HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED:511};function createServer(){throwNotImplemented(\"node:http2 createServer\",887)}function createSecureServer(){throwNotImplemented(\"node:http2 createSecureServer\",887)}function getDefaultSettings(){return{headerTableSize:4096,enablePush:!0,initialWindowSize:65535,maxFrameSize:16384,maxConcurrentStreams:4294967295,maxHeaderSize:65535,maxHeaderListSize:65535,enableConnectProtocol:!1}}function getPackedSettings(){return Buffer.alloc(0)}function getUnpackedSettings(){return Buffer.alloc(0)}const sensitiveHeaders=Symbol.for(\"nodejs.http2.sensitiveHeaders\");function Http2ServerRequest(){throwNotImplemented(\"node:http2 Http2ServerRequest\",887)}function Http2ServerResponse(){throwNotImplemented(\"node:http2 Http2ServerResponse\",887)}return $={constants,createServer,createSecureServer,getDefaultSettings,getPackedSettings,getUnpackedSettings,sensitiveHeaders,Http2ServerRequest,Http2ServerResponse,connect},hideFromStack([Http2ServerRequest,Http2ServerResponse,connect,createServer,createSecureServer,getDefaultSettings,getPackedSettings,getUnpackedSettings]),$})\n"_s; static constexpr ASCIILiteral NodeHttpsCode = "(function (){\"use strict\";const http=@getInternalField(@internalModuleRegistry,18)||@createInternalModuleById(18);function request(input,options,cb){if(input&&typeof input===\"object\"&&!(input instanceof URL))input.protocol\?\?=\"https:\";else if(typeof options===\"object\")options.protocol\?\?=\"https:\";return http.request(input,options,cb)}function get(input,options,cb){const req=request(input,options,cb);return req.end(),req}return{...http,get,request}})\n"_s; static constexpr ASCIILiteral NodeInspectorCode = "(function (){\"use strict\";var $;const{hideFromStack,throwNotImplemented}=@getInternalField(@internalModuleRegistry,2)||@createInternalModuleById(2),EventEmitter=@getInternalField(@internalModuleRegistry,15)||@createInternalModuleById(15);function open(){throwNotImplemented(\"node:inspector open\",2445)}function close(){throwNotImplemented(\"node:inspector close\",2445)}function url(){throwNotImplemented(\"node:inspector url\",2445)}function waitForDebugger(){throwNotImplemented(\"node:inspector waitForDebugger\",2445)}class Session extends EventEmitter{constructor(){super();throwNotImplemented(\"node:inspector Session\",2445)}}return $={console:{...globalThis.console,context:{console:globalThis.console}},open,close,url,waitForDebugger,Session},hideFromStack(open,close,url,waitForDebugger,Session.prototype.constructor),$})\n"_s; @@ -79,7 +79,7 @@ static constexpr ASCIILiteral NodeDomainCode = "(function (){\"use strict\";var static constexpr ASCIILiteral NodeEventsCode = "(function (){\"use strict\";const{throwNotImplemented}=@getInternalField(@internalModuleRegistry,2)||@createInternalModuleById(2),SymbolFor=Symbol.for,kCapture=Symbol(\"kCapture\"),kErrorMonitor=SymbolFor(\"events.errorMonitor\"),kMaxEventTargetListeners=Symbol(\"events.maxEventTargetListeners\"),kMaxEventTargetListenersWarned=Symbol(\"events.maxEventTargetListenersWarned\"),kWatermarkData=SymbolFor(\"nodejs.watermarkData\"),kRejection=SymbolFor(\"nodejs.rejection\"),captureRejectionSymbol=SymbolFor(\"nodejs.rejection\"),ArrayPrototypeSlice=Array.prototype.slice;var defaultMaxListeners=10;const EventEmitter=function EventEmitter(opts){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners\?\?=void 0,this[kCapture]=opts\?.captureRejections\?Boolean(opts\?.captureRejections):EventEmitterPrototype[kCapture])this.emit=emitWithRejectionCapture},EventEmitterPrototype=EventEmitter.prototype={};EventEmitterPrototype._events=void 0,EventEmitterPrototype._eventsCount=0,EventEmitterPrototype._maxListeners=void 0,EventEmitterPrototype.setMaxListeners=function setMaxListeners(n){return validateNumber(n,\"setMaxListeners\",0),this._maxListeners=n,this},EventEmitterPrototype.getMaxListeners=function getMaxListeners(){return this._maxListeners\?\?defaultMaxListeners};function emitError(emitter,args){var{_events:events}=emitter;if(args[0]\?\?=new Error(\"Unhandled error.\"),!events)throw args[0];var errorMonitor=events[kErrorMonitor];if(errorMonitor)for(var handler of ArrayPrototypeSlice.call(errorMonitor))handler.apply(emitter,args);var handlers=events.error;if(!handlers)throw args[0];for(var handler of ArrayPrototypeSlice.call(handlers))handler.apply(emitter,args);return!0}function addCatch(emitter,promise,type,args){promise.then(void 0,function(err){process.nextTick(emitUnhandledRejectionOrErr,emitter,err,type,args)})}function emitUnhandledRejectionOrErr(emitter,err,type,args){if(typeof emitter[kRejection]===\"function\")emitter[kRejection](err,type,...args);else try{emitter[kCapture]=!1,emitter.emit(\"error\",err)}finally{emitter[kCapture]=!0}}const emitWithoutRejectionCapture=function emit(type,...args){if(type===\"error\")return emitError(this,args);var{_events:events}=this;if(events===void 0)return!1;var handlers=events[type];if(handlers===void 0)return!1;for(var handler of[...handlers])handler.apply(this,args);return!0},emitWithRejectionCapture=function emit(type,...args){if(type===\"error\")return emitError(this,args);var{_events:events}=this;if(events===void 0)return!1;var handlers=events[type];if(handlers===void 0)return!1;for(var handler of[...handlers]){var result=handler.apply(this,args);if(result!==void 0&&@isPromise(result))addCatch(this,result,type,args)}return!0};EventEmitterPrototype.emit=emitWithoutRejectionCapture,EventEmitterPrototype.addListener=function addListener(type,fn){checkListener(fn);var events=this._events;if(!events)events=this._events={__proto__:null},this._eventsCount=0;else if(events.newListener)this.emit(\"newListener\",type,fn.listener\?\?fn);var handlers=events[type];if(!handlers)events[type]=[fn],this._eventsCount++;else{handlers.push(fn);var m=this._maxListeners\?\?defaultMaxListeners;if(m>0&&handlers.length>m&&!handlers.warned)overflowWarning(this,type,handlers)}return this},EventEmitterPrototype.on=EventEmitterPrototype.addListener,EventEmitterPrototype.prependListener=function prependListener(type,fn){checkListener(fn);var events=this._events;if(!events)events=this._events={__proto__:null},this._eventsCount=0;else if(events.newListener)this.emit(\"newListener\",type,fn.listener\?\?fn);var handlers=events[type];if(!handlers)events[type]=[fn],this._eventsCount++;else{handlers.unshift(fn);var m=this._maxListeners\?\?defaultMaxListeners;if(m>0&&handlers.length>m&&!handlers.warned)overflowWarning(this,type,handlers)}return this};function overflowWarning(emitter,type,handlers){handlers.warned=!0;const warn=new Error(`Possible EventEmitter memory leak detected. ${handlers.length} ${String(type)} listeners `+`added to [${emitter.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);warn.name=\"MaxListenersExceededWarning\",warn.emitter=emitter,warn.type=type,warn.count=handlers.length,process.emitWarning(warn)}function onceWrapper(type,listener,...args){this.removeListener(type,listener),listener.apply(this,args)}EventEmitterPrototype.once=function once(type,fn){checkListener(fn);const bound=onceWrapper.bind(this,type,fn);return bound.listener=fn,this.addListener(type,bound),this},EventEmitterPrototype.prependOnceListener=function prependOnceListener(type,fn){checkListener(fn);const bound=onceWrapper.bind(this,type,fn);return bound.listener=fn,this.prependListener(type,bound),this},EventEmitterPrototype.removeListener=function removeListener(type,fn){checkListener(fn);var{_events:events}=this;if(!events)return this;var handlers=events[type];if(!handlers)return this;var length=handlers.length;let position=-1;for(let i=length-1;i>=0;i--)if(handlers[i]===fn||handlers[i].listener===fn){position=i;break}if(position<0)return this;if(position===0)handlers.shift();else handlers.splice(position,1);if(handlers.length===0)delete events[type],this._eventsCount--;return this},EventEmitterPrototype.off=EventEmitterPrototype.removeListener,EventEmitterPrototype.removeAllListeners=function removeAllListeners(type){var{_events:events}=this;if(type&&events){if(events[type])delete events[type],this._eventsCount--}else this._events={__proto__:null};return this},EventEmitterPrototype.listeners=function listeners(type){var{_events:events}=this;if(!events)return[];var handlers=events[type];if(!handlers)return[];return handlers.map((x)=>x.listener\?\?x)},EventEmitterPrototype.rawListeners=function rawListeners(type){var{_events}=this;if(!_events)return[];var handlers=_events[type];if(!handlers)return[];return handlers.slice()},EventEmitterPrototype.listenerCount=function listenerCount(type){var{_events:events}=this;if(!events)return 0;return events[type]\?.length\?\?0},EventEmitterPrototype.eventNames=function eventNames(){return this._eventsCount>0\?Reflect.ownKeys(this._events):[]},EventEmitterPrototype[kCapture]=!1;function once(emitter,type,options){var signal=options\?.signal;if(validateAbortSignal(signal,\"options.signal\"),signal\?.aborted)throw new AbortError(void 0,{cause:signal\?.reason});return new Promise((resolve,reject)=>{const errorListener=(err)=>{if(emitter.removeListener(type,resolver),signal!=null)eventTargetAgnosticRemoveListener(signal,\"abort\",abortListener);reject(err)},resolver=(...args)=>{if(typeof emitter.removeListener===\"function\")emitter.removeListener(\"error\",errorListener);if(signal!=null)eventTargetAgnosticRemoveListener(signal,\"abort\",abortListener);resolve(args)};if(eventTargetAgnosticAddListener(emitter,type,resolver,{once:!0}),type!==\"error\"&&typeof emitter.once===\"function\")emitter.once(\"error\",errorListener);function abortListener(){eventTargetAgnosticRemoveListener(emitter,type,resolver),eventTargetAgnosticRemoveListener(emitter,\"error\",errorListener),reject(new AbortError(void 0,{cause:signal\?.reason}))}if(signal!=null)eventTargetAgnosticAddListener(signal,\"abort\",abortListener,{once:!0})})}function on(emitter,type,options){var{signal,close,highWatermark=Number.MAX_SAFE_INTEGER,lowWatermark=1}=options||{};throwNotImplemented(\"events.on\",2679)}function getEventListeners(emitter,type){if(emitter instanceof EventTarget)throwNotImplemented(\"getEventListeners with an EventTarget\",2678);return emitter.listeners(type)}function setMaxListeners(n,...eventTargets){validateNumber(n,\"setMaxListeners\",0);var length;if(eventTargets&&(length=eventTargets.length))for(let i=0;i<length;i++)eventTargets[i].setMaxListeners(n);else defaultMaxListeners=n}function listenerCount(emitter,type){return emitter.listenerCount(type)}function eventTargetAgnosticRemoveListener(emitter,name,listener,flags){if(typeof emitter.removeListener===\"function\")emitter.removeListener(name,listener);else emitter.removeEventListener(name,listener,flags)}function eventTargetAgnosticAddListener(emitter,name,listener,flags){if(typeof emitter.on===\"function\")emitter.on(name,listener);else emitter.addEventListener(name,listener)}class AbortError extends Error{constructor(message=\"The operation was aborted\",options=void 0){if(options!==void 0&&typeof options!==\"object\")throw new codes.ERR_INVALID_ARG_TYPE(\"options\",\"Object\",options);super(message,options);this.code=\"ABORT_ERR\",this.name=\"AbortError\"}}function ERR_INVALID_ARG_TYPE(name,type,value){const err=@makeTypeError(`The \"${name}\" argument must be of type ${type}. Received ${value}`);return err.code=\"ERR_INVALID_ARG_TYPE\",err}function ERR_OUT_OF_RANGE(name,range,value){const err=new RangeError(`The \"${name}\" argument is out of range. It must be ${range}. Received ${value}`);return err.code=\"ERR_OUT_OF_RANGE\",err}function validateAbortSignal(signal,name){if(signal!==void 0&&(signal===null||typeof signal!==\"object\"||!(\"aborted\"in signal)))throw new ERR_INVALID_ARG_TYPE(name,\"AbortSignal\",signal)}function validateNumber(value,name,min=void 0,max){if(typeof value!==\"number\")throw new ERR_INVALID_ARG_TYPE(name,\"number\",value);if(min!=null&&value<min||max!=null&&value>max||(min!=null||max!=null)&&Number.isNaN(value))throw new ERR_OUT_OF_RANGE(name,`${min!=null\?`>= ${min}`:\"\"}${min!=null&&max!=null\?\" && \":\"\"}${max!=null\?`<= ${max}`:\"\"}`,value)}function checkListener(listener){if(typeof listener!==\"function\")@throwTypeError(\"The listener must be a function\")}let AsyncResource=null;class EventEmitterAsyncResource extends EventEmitter{triggerAsyncId;asyncResource;constructor(options){if(!AsyncResource)AsyncResource=(@getInternalField(@internalModuleRegistry,5)||@createInternalModuleById(5)).AsyncResource;var{captureRejections=!1,triggerAsyncId,name=new.target.name,requireManualDestroy}=options||{};super({captureRejections});this.triggerAsyncId=triggerAsyncId\?\?0,this.asyncResource=new AsyncResource(name,{triggerAsyncId,requireManualDestroy})}emit(...args){this.asyncResource.runInAsyncScope(()=>super.emit(...args))}emitDestroy(){this.asyncResource.emitDestroy()}}return Object.defineProperties(EventEmitter,{captureRejections:{get(){return EventEmitterPrototype[kCapture]},set(value){validateBoolean(value,\"EventEmitter.captureRejections\"),EventEmitterPrototype[kCapture]=value},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return defaultMaxListeners},set:(arg)=>{validateNumber(arg,\"defaultMaxListeners\",0),defaultMaxListeners=arg}},kMaxEventTargetListeners:{value:kMaxEventTargetListeners,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:kMaxEventTargetListenersWarned,enumerable:!1,configurable:!1,writable:!1}}),Object.assign(EventEmitter,{once,on,getEventListeners,setMaxListeners,EventEmitter,usingDomains:!1,captureRejectionSymbol,EventEmitterAsyncResource,errorMonitor:kErrorMonitor,setMaxListeners,init:EventEmitter,listenerCount}),EventEmitter})\n"_s; static constexpr ASCIILiteral NodeFSCode = "(function (){\"use strict\";var $,ReadStream,WriteStream;const EventEmitter=@getInternalField(@internalModuleRegistry,15)||@createInternalModuleById(15),promises=@getInternalField(@internalModuleRegistry,17)||@createInternalModuleById(17),Stream=@getInternalField(@internalModuleRegistry,34)||@createInternalModuleById(34);var fs=Bun.fs();class FSWatcher extends EventEmitter{#watcher;#listener;constructor(path,options,listener){super();if(typeof options===\"function\")listener=options,options={};else if(typeof options===\"string\")options={encoding:options};if(typeof listener!==\"function\")listener=()=>{};this.#listener=listener;try{this.#watcher=fs.watch(path,options||{},this.#onEvent.bind(this))}catch(e){if(!e.message\?.startsWith(\"FileNotFound\"))throw e;const notFound=new Error(`ENOENT: no such file or directory, watch '${path}'`);throw notFound.code=\"ENOENT\",notFound.errno=-2,notFound.path=path,notFound.syscall=\"watch\",notFound.filename=path,notFound}}#onEvent(eventType,filenameOrError){if(eventType===\"error\"||eventType===\"close\")this.emit(eventType,filenameOrError);else this.emit(\"change\",eventType,filenameOrError),this.#listener(eventType,filenameOrError)}close(){this.#watcher\?.close(),this.#watcher=null}ref(){this.#watcher\?.ref()}unref(){this.#watcher\?.unref()}}var access=function access(...args){callbackify(fs.accessSync,args)},appendFile=function appendFile(...args){callbackify(fs.appendFileSync,args)},close=function close(...args){callbackify(fs.closeSync,args)},rm=function rm(...args){callbackify(fs.rmSync,args)},rmdir=function rmdir(...args){callbackify(fs.rmdirSync,args)},copyFile=function copyFile(...args){callbackify(fs.copyFileSync,args)},exists=function exists(...args){callbackify(fs.existsSync,args)},chown=function chown(...args){callbackify(fs.chownSync,args)},chmod=function chmod(...args){callbackify(fs.chmodSync,args)},fchmod=function fchmod(...args){callbackify(fs.fchmodSync,args)},fchown=function fchown(...args){callbackify(fs.fchownSync,args)},fstat=function fstat(...args){callbackify(fs.fstatSync,args)},fsync=function fsync(...args){callbackify(fs.fsyncSync,args)},ftruncate=function ftruncate(...args){callbackify(fs.ftruncateSync,args)},futimes=function futimes(...args){callbackify(fs.futimesSync,args)},lchmod=function lchmod(...args){callbackify(fs.lchmodSync,args)},lchown=function lchown(...args){callbackify(fs.lchownSync,args)},link=function link(...args){callbackify(fs.linkSync,args)},mkdir=function mkdir(...args){callbackify(fs.mkdirSync,args)},mkdtemp=function mkdtemp(...args){callbackify(fs.mkdtempSync,args)},open=function open(...args){callbackify(fs.openSync,args)},read=function read(...args){callbackify(fs.readSync,args)},write=function write(...args){callbackify(fs.writeSync,args)},readdir=function readdir(...args){const callback=args[args.length-1];if(typeof callback!==\"function\")@throwTypeError(\"Callback must be a function\");fs.readdir(...args).then((result)=>callback(null,result),callback)},readFile=function readFile(...args){const callback=args[args.length-1];if(typeof callback!==\"function\")@throwTypeError(\"Callback must be a function\");fs.readFile(...args).then((result)=>callback(null,result),callback)},writeFile=function writeFile(...args){callbackify(fs.writeFileSync,args)},readlink=function readlink(...args){callbackify(fs.readlinkSync,args)},realpath=function realpath(...args){callbackify(fs.realpathSync,args)},rename=function rename(...args){callbackify(fs.renameSync,args)},lstat=function lstat(...args){const callback=args[args.length-1];if(typeof callback!==\"function\")@throwTypeError(\"Callback must be a function\");fs.lstat(...args).then((result)=>callback(null,result),callback)},stat=function stat(...args){const callback=args[args.length-1];if(typeof callback!==\"function\")@throwTypeError(\"Callback must be a function\");fs.stat(...args).then((result)=>callback(null,result),callback)},symlink=function symlink(...args){callbackify(fs.symlinkSync,args)},truncate=function truncate(...args){callbackify(fs.truncateSync,args)},unlink=function unlink(...args){callbackify(fs.unlinkSync,args)},utimes=function utimes(...args){callbackify(fs.utimesSync,args)},lutimes=function lutimes(...args){callbackify(fs.lutimesSync,args)},accessSync=fs.accessSync.bind(fs),appendFileSync=fs.appendFileSync.bind(fs),closeSync=fs.closeSync.bind(fs),copyFileSync=fs.copyFileSync.bind(fs),existsSync=fs.existsSync.bind(fs),chownSync=fs.chownSync.bind(fs),chmodSync=fs.chmodSync.bind(fs),fchmodSync=fs.fchmodSync.bind(fs),fchownSync=fs.fchownSync.bind(fs),fstatSync=fs.fstatSync.bind(fs),fsyncSync=fs.fsyncSync.bind(fs),ftruncateSync=fs.ftruncateSync.bind(fs),futimesSync=fs.futimesSync.bind(fs),lchmodSync=fs.lchmodSync.bind(fs),lchownSync=fs.lchownSync.bind(fs),linkSync=fs.linkSync.bind(fs),lstatSync=fs.lstatSync.bind(fs),mkdirSync=fs.mkdirSync.bind(fs),mkdtempSync=fs.mkdtempSync.bind(fs),openSync=fs.openSync.bind(fs),readSync=fs.readSync.bind(fs),writeSync=fs.writeSync.bind(fs),readdirSync=fs.readdirSync.bind(fs),readFileSync=fs.readFileSync.bind(fs),writeFileSync=fs.writeFileSync.bind(fs),readlinkSync=fs.readlinkSync.bind(fs),realpathSync=fs.realpathSync.bind(fs),renameSync=fs.renameSync.bind(fs),statSync=fs.statSync.bind(fs),symlinkSync=fs.symlinkSync.bind(fs),truncateSync=fs.truncateSync.bind(fs),unlinkSync=fs.unlinkSync.bind(fs),utimesSync=fs.utimesSync.bind(fs),lutimesSync=fs.lutimesSync.bind(fs),rmSync=fs.rmSync.bind(fs),rmdirSync=fs.rmdirSync.bind(fs),writev=(fd,buffers,position,callback)=>{if(typeof position===\"function\")callback=position,position=null;queueMicrotask(()=>{try{var written=fs.writevSync(fd,buffers,position)}catch(e){callback(e)}callback(null,written,buffers)})},writevSync=fs.writevSync.bind(fs),readv=(fd,buffers,position,callback)=>{if(typeof position===\"function\")callback=position,position=null;queueMicrotask(()=>{try{var written=fs.readvSync(fd,buffers,position)}catch(e){callback(e)}callback(null,written,buffers)})},readvSync=fs.readvSync.bind(fs),Dirent=fs.Dirent,Stats=fs.Stats,watch=function watch(path,options,listener){return new FSWatcher(path,options,listener)};function callbackify(fsFunction,args){try{const result=fsFunction.apply(fs,args.slice(0,args.length-1)),callback=args[args.length-1];if(typeof callback===\"function\")queueMicrotask(()=>callback(null,result))}catch(e){const callback=args[args.length-1];if(typeof callback===\"function\")queueMicrotask(()=>callback(e))}}var readStreamPathFastPathSymbol=Symbol.for(\"Bun.Node.readStreamPathFastPath\");const readStreamSymbol=Symbol.for(\"Bun.NodeReadStream\"),readStreamPathOrFdSymbol=Symbol.for(\"Bun.NodeReadStreamPathOrFd\"),writeStreamSymbol=Symbol.for(\"Bun.NodeWriteStream\");var writeStreamPathFastPathSymbol=Symbol.for(\"Bun.NodeWriteStreamFastPath\"),writeStreamPathFastPathCallSymbol=Symbol.for(\"Bun.NodeWriteStreamFastPathCall\"),kIoDone=Symbol.for(\"kIoDone\"),defaultReadStreamOptions={file:void 0,fd:void 0,flags:\"r\",encoding:void 0,mode:438,autoClose:!0,emitClose:!0,start:0,end:Infinity,highWaterMark:65536,fs:{read,open:(path,flags,mode,cb)=>{var fd;try{fd=openSync(path,flags,mode)}catch(e){cb(e);return}cb(null,fd)},openSync,close},autoDestroy:!0},ReadStreamClass;ReadStream=function(InternalReadStream){ReadStreamClass=InternalReadStream,Object.defineProperty(ReadStreamClass.prototype,Symbol.toStringTag,{value:\"ReadStream\",enumerable:!1});function ReadStream2(path,options){return new InternalReadStream(path,options)}return ReadStream2.prototype=InternalReadStream.prototype,Object.defineProperty(ReadStream2,Symbol.hasInstance,{value(instance){return instance instanceof InternalReadStream}})}(class ReadStream2 extends Stream._getNativeReadableStreamPrototype(2,Stream.Readable){constructor(pathOrFd,options=defaultReadStreamOptions){if(typeof options!==\"object\"||!options)@throwTypeError(\"Expected options to be an object\");var{flags=defaultReadStreamOptions.flags,encoding=defaultReadStreamOptions.encoding,mode=defaultReadStreamOptions.mode,autoClose=defaultReadStreamOptions.autoClose,emitClose=defaultReadStreamOptions.emitClose,start=defaultReadStreamOptions.start,end=defaultReadStreamOptions.end,autoDestroy=defaultReadStreamOptions.autoClose,fs:fs2=defaultReadStreamOptions.fs,highWaterMark=defaultReadStreamOptions.highWaterMark}=options;if(pathOrFd\?.constructor\?.name===\"URL\")pathOrFd=Bun.fileURLToPath(pathOrFd);var tempThis={};if(typeof pathOrFd===\"string\"){if(pathOrFd.startsWith(\"file://\"))pathOrFd=Bun.fileURLToPath(pathOrFd);if(pathOrFd.length===0)@throwTypeError(\"Expected path to be a non-empty string\");tempThis.path=tempThis.file=tempThis[readStreamPathOrFdSymbol]=pathOrFd}else if(typeof pathOrFd===\"number\"){if(pathOrFd|=0,pathOrFd<0)@throwTypeError(\"Expected fd to be a positive integer\");tempThis.fd=tempThis[readStreamPathOrFdSymbol]=pathOrFd,tempThis.autoClose=!1}else @throwTypeError(\"Expected a path or file descriptor\");if(!tempThis.fd)tempThis.fd=fs2.openSync(pathOrFd,flags,mode);var fileRef=Bun.file(tempThis.fd),stream=fileRef.stream(),native=@direct(stream);if(!native)throw new Error(\"no native readable stream\");var{stream:ptr}=native;super(ptr,{...options,encoding,autoDestroy,autoClose,emitClose,highWaterMark});if(Object.assign(this,tempThis),this.#fileRef=fileRef,this.end=end,this._read=this.#internalRead,this.start=start,this.flags=flags,this.mode=mode,this.emitClose=emitClose,this[readStreamPathFastPathSymbol]=start===0&&end===Infinity&&autoClose&&fs2===defaultReadStreamOptions.fs&&(encoding===\"buffer\"||encoding===\"binary\"||encoding==null||encoding===\"utf-8\"||encoding===\"utf8\"),this._readableState.autoClose=autoDestroy=autoClose,this._readableState.highWaterMark=highWaterMark,start!==void 0)this.pos=start}#fileRef;#fs;file;path;fd=null;flags;mode;start;end;pos;bytesRead=0;#fileSize=-1;_read;[readStreamSymbol]=!0;[readStreamPathOrFdSymbol];[readStreamPathFastPathSymbol];_construct(callback){if(super._construct)super._construct(callback);else callback();this.emit(\"open\",this.fd),this.emit(\"ready\")}_destroy(err,cb){super._destroy(err,cb);try{var fd=this.fd;if(this[readStreamPathFastPathSymbol]=!1,!fd)cb(err);else this.#fs.close(fd,(er)=>{cb(er||err)}),this.fd=null}catch(e){throw e}}close(cb){if(typeof cb===\"function\")eos_()(this,cb);this.destroy()}push(chunk){var bytesRead=chunk\?.length\?\?0;if(bytesRead>0){this.bytesRead+=bytesRead;var currPos=this.pos;if(currPos!==void 0){if(this.bytesRead<currPos)return!0;if(currPos===this.start){var n=this.bytesRead-currPos;chunk=chunk.slice(-n);var[_,...rest]=arguments;if(this.pos=this.bytesRead,this.end!==void 0&&this.bytesRead>this.end)chunk=chunk.slice(0,this.end-this.start+1);return super.push(chunk,...rest)}var end=this.end;if(end!==void 0&&this.bytesRead>end){chunk=chunk.slice(0,end-currPos+1);var[_,...rest]=arguments;return this.pos=this.bytesRead,super.push(chunk,...rest)}this.pos=this.bytesRead}}return super.push(...arguments)}#internalRead(n){var{pos,end,bytesRead,fd,encoding}=this;if(n=pos!==void 0\?Math.min(end-pos+1,n):Math.min(end-bytesRead+1,n),n<=0){this.push(null);return}if(this.#fileSize===-1&&bytesRead===0&&pos===void 0){var stat2=fstatSync(fd);if(this.#fileSize=stat2.size,this.#fileSize>0&&n>this.#fileSize)n=this.#fileSize+1}this[kIoDone]=!1;var res=super._read(n);if(@isPromise(res)){var then=res\?.then;if(then&&@isCallable(then))then(()=>{if(this[kIoDone]=!0,this.destroyed)this.emit(kIoDone)},(er)=>{this[kIoDone]=!0,this.#errorOrDestroy(er)})}else if(this[kIoDone]=!0,this.destroyed)this.emit(kIoDone),this.#errorOrDestroy(new Error(\"ERR_STREAM_PREMATURE_CLOSE\"))}#errorOrDestroy(err,sync=null){var{_readableState:r={destroyed:!1,autoDestroy:!1},_writableState:w={destroyed:!1,autoDestroy:!1}}=this;if(w\?.destroyed||r\?.destroyed)return this;if(r\?.autoDestroy||w\?.autoDestroy)this.destroy(err);else if(err)this.emit(\"error\",err)}pause(){return this[readStreamPathFastPathSymbol]=!1,super.pause()}resume(){return this[readStreamPathFastPathSymbol]=!1,super.resume()}unshift(...args){return this[readStreamPathFastPathSymbol]=!1,super.unshift(...args)}pipe(dest,pipeOpts){if(this[readStreamPathFastPathSymbol]&&(pipeOpts\?.end\?\?!0)&&this._readableState\?.pipes\?.length===0){if((writeStreamPathFastPathSymbol in dest)&&dest[writeStreamPathFastPathSymbol]){if(dest[writeStreamPathFastPathCallSymbol](this,pipeOpts))return this}}return this[readStreamPathFastPathSymbol]=!1,super.pipe(dest,pipeOpts)}});function createReadStream(path,options){return new ReadStream(path,options)}var defaultWriteStreamOptions={fd:null,start:void 0,pos:void 0,encoding:void 0,flags:\"w\",mode:438,fs:{write,close,open,openSync}},WriteStreamClass;WriteStream=function(InternalWriteStream){WriteStreamClass=InternalWriteStream,Object.defineProperty(WriteStreamClass.prototype,Symbol.toStringTag,{value:\"WritesStream\",enumerable:!1});function WriteStream2(path,options){return new InternalWriteStream(path,options)}return WriteStream2.prototype=InternalWriteStream.prototype,Object.defineProperty(WriteStream2,Symbol.hasInstance,{value(instance){return instance instanceof InternalWriteStream}})}(class WriteStream2 extends Stream.NativeWritable{constructor(path,options=defaultWriteStreamOptions){if(!options)@throwTypeError(\"Expected options to be an object\");var{fs:fs2=defaultWriteStreamOptions.fs,start=defaultWriteStreamOptions.start,flags=defaultWriteStreamOptions.flags,mode=defaultWriteStreamOptions.mode,autoClose=!0,emitClose=!1,autoDestroy=autoClose,encoding=defaultWriteStreamOptions.encoding,fd=defaultWriteStreamOptions.fd,pos=defaultWriteStreamOptions.pos}=options,tempThis={};if(typeof path===\"string\"){if(path.length===0)@throwTypeError(\"Expected a non-empty path\");if(path.startsWith(\"file:\"))path=Bun.fileURLToPath(path);tempThis.path=path,tempThis.fd=null,tempThis[writeStreamPathFastPathSymbol]=autoClose&&(start===void 0||start===0)&&fs2.write===defaultWriteStreamOptions.fs.write&&fs2.close===defaultWriteStreamOptions.fs.close}else tempThis.fd=fd,tempThis[writeStreamPathFastPathSymbol]=!1;if(!tempThis.fd)tempThis.fd=fs2.openSync(path,flags,mode);super(tempThis.fd,{...options,decodeStrings:!1,autoDestroy,emitClose,fd:tempThis});if(Object.assign(this,tempThis),typeof fs2\?.write!==\"function\")@throwTypeError(\"Expected fs.write to be a function\");if(typeof fs2\?.close!==\"function\")@throwTypeError(\"Expected fs.close to be a function\");if(typeof fs2\?.open!==\"function\")@throwTypeError(\"Expected fs.open to be a function\");if(typeof path===\"object\"&&path){if(path instanceof URL)path=Bun.fileURLToPath(path)}if(typeof path!==\"string\"&&typeof fd!==\"number\")@throwTypeError(\"Expected a path or file descriptor\");if(this.start=start,this.#fs=fs2,this.flags=flags,this.mode=mode,this.start!==void 0)this.pos=this.start;if(encoding!==defaultWriteStreamOptions.encoding){if(this.setDefaultEncoding(encoding),encoding!==\"buffer\"&&encoding!==\"utf8\"&&encoding!==\"utf-8\"&&encoding!==\"binary\")this[writeStreamPathFastPathSymbol]=!1}}get autoClose(){return this._writableState.autoDestroy}set autoClose(val){this._writableState.autoDestroy=val}destroySoon=this.end;open(){}path;fd;flags;mode;#fs;bytesWritten=0;pos;[writeStreamPathFastPathSymbol];[writeStreamSymbol]=!0;start;[writeStreamPathFastPathCallSymbol](readStream,pipeOpts){if(!this[writeStreamPathFastPathSymbol])return!1;if(this.fd!==null)return this[writeStreamPathFastPathSymbol]=!1,!1;return this[kIoDone]=!1,readStream[kIoDone]=!1,Bun.write(this[writeStreamPathFastPathSymbol],readStream[readStreamPathOrFdSymbol]).then((bytesWritten)=>{readStream[kIoDone]=this[kIoDone]=!0,this.bytesWritten+=bytesWritten,readStream.bytesRead+=bytesWritten,this.end(),readStream.close()},(err)=>{readStream[kIoDone]=this[kIoDone]=!0,this.#errorOrDestroy(err),readStream.emit(\"error\",err)})}isBunFastPathEnabled(){return this[writeStreamPathFastPathSymbol]}disableBunFastPath(){this[writeStreamPathFastPathSymbol]=!1}#handleWrite(er,bytes){if(er)return this.#errorOrDestroy(er);this.bytesWritten+=bytes}#internalClose(err,cb){this[writeStreamPathFastPathSymbol]=!1;var fd=this.fd;this.#fs.close(fd,(er)=>{this.fd=null,cb(err||er)})}_construct(callback){if(typeof this.fd===\"number\"){callback();return}callback(),this.emit(\"open\",this.fd),this.emit(\"ready\")}_destroy(err,cb){if(this.fd===null)return cb(err);if(this[kIoDone]){this.once(kIoDone,()=>this.#internalClose(err,cb));return}this.#internalClose(err,cb)}[kIoDone]=!1;close(cb){if(cb){if(this.closed){process.nextTick(cb);return}this.on(\"close\",cb)}if(!this.autoClose)this.on(\"finish\",this.destroy);this.end()}write(chunk,encoding=this._writableState.defaultEncoding,cb){if(this[writeStreamPathFastPathSymbol]=!1,typeof chunk===\"string\")chunk=Buffer.from(chunk,encoding);var native=this.pos===void 0;return this[kIoDone]=!0,super.write(chunk,encoding,native\?(err,bytes)=>{if(this[kIoDone]=!1,this.#handleWrite(err,bytes),this.emit(kIoDone),cb)!err\?cb():cb(err)}:()=>{},native)}#internalWriteSlow(chunk,encoding,cb){this.#fs.write(this.fd,chunk,0,chunk.length,this.pos,(err,bytes)=>{this[kIoDone]=!1,this.#handleWrite(err,bytes),this.emit(kIoDone),!err\?cb():cb(err)})}end(chunk,encoding,cb){var native=this.pos===void 0;return super.end(chunk,encoding,cb,native)}_write=this.#internalWriteSlow;_writev=void 0;get pending(){return this.fd===null}_destroy(err,cb){this.close(err,cb)}#errorOrDestroy(err){var{_readableState:r={destroyed:!1,autoDestroy:!1},_writableState:w={destroyed:!1,autoDestroy:!1}}=this;if(w\?.destroyed||r\?.destroyed)return this;if(r\?.autoDestroy||w\?.autoDestroy)this.destroy(err);else if(err)this.emit(\"error\",err)}});function createWriteStream(path,options){return new WriteStream(path,options)}return Object.defineProperties(fs,{createReadStream:{value:createReadStream},createWriteStream:{value:createWriteStream},ReadStream:{value:ReadStream},WriteStream:{value:WriteStream}}),realpath.native=realpath,realpathSync.native=realpathSync,$={access,accessSync,appendFile,appendFileSync,chmod,chmodSync,chown,chownSync,close,closeSync,constants:promises.constants,copyFile,copyFileSync,createReadStream,createWriteStream,Dirent,exists,existsSync,fchmod,fchmodSync,fchown,fchownSync,fstat,fstatSync,fsync,fsyncSync,ftruncate,ftruncateSync,futimes,futimesSync,lchmod,lchmodSync,lchown,lchownSync,link,linkSync,lstat,lstatSync,lutimes,lutimesSync,mkdir,mkdirSync,mkdtemp,mkdtempSync,open,openSync,promises,read,readFile,readFileSync,readSync,readdir,readdirSync,readlink,readlinkSync,realpath,realpathSync,rename,renameSync,rm,rmSync,rmdir,rmdirSync,stat,statSync,Stats,symlink,symlinkSync,truncate,truncateSync,unlink,unlinkSync,utimes,utimesSync,write,writeFile,writeFileSync,writeSync,WriteStream,ReadStream,watch,FSWatcher,writev,writevSync,readv,readvSync,[Symbol.for(\"::bunternal::\")]:{ReadStreamClass,WriteStreamClass}},$})\n"_s; static constexpr ASCIILiteral NodeFSPromisesCode = "(function (){\"use strict\";var $;const constants=@processBindingConstants.fs;var fs=Bun.fs();const notrace=\"::bunternal::\";var promisify={[notrace]:(fsFunction)=>{return async function(...args){return await 1,fsFunction.apply(fs,args)}}}[notrace];function watch(filename,options={}){if(filename instanceof URL)@throwTypeError(\"Watch URLs are not supported yet\");else if(Buffer.isBuffer(filename))filename=filename.toString();else if(typeof filename!==\"string\")@throwTypeError(\"Expected path to be a string or Buffer\");let nextEventResolve=null;if(typeof options===\"string\")options={encoding:options};const queue=@createFIFO(),watcher=fs.watch(filename,options||{},(eventType,filename2)=>{if(queue.push({eventType,filename:filename2}),nextEventResolve){const resolve=nextEventResolve;nextEventResolve=null,resolve()}});return{[Symbol.asyncIterator](){let closed=!1;return{async next(){while(!closed){let event;while(event=queue.shift()){if(event.eventType===\"close\")return closed=!0,{value:void 0,done:!0};if(event.eventType===\"error\")throw closed=!0,event.filename;return{value:event,done:!1}}const{promise,resolve}=Promise.withResolvers();nextEventResolve=resolve,await promise}return{value:void 0,done:!0}},return(){if(!closed){if(watcher.close(),closed=!0,nextEventResolve){const resolve=nextEventResolve;nextEventResolve=null,resolve()}}return{value:void 0,done:!0}}}}}}return $={access:promisify(fs.accessSync),appendFile:promisify(fs.appendFileSync),close:promisify(fs.closeSync),copyFile:promisify(fs.copyFileSync),exists:promisify(fs.existsSync),chown:promisify(fs.chownSync),chmod:promisify(fs.chmodSync),fchmod:promisify(fs.fchmodSync),fchown:promisify(fs.fchownSync),fstat:promisify(fs.fstatSync),fsync:promisify(fs.fsyncSync),ftruncate:promisify(fs.ftruncateSync),futimes:promisify(fs.futimesSync),lchmod:promisify(fs.lchmodSync),lchown:promisify(fs.lchownSync),link:promisify(fs.linkSync),lstat:fs.lstat.bind(fs),mkdir:promisify(fs.mkdirSync),mkdtemp:promisify(fs.mkdtempSync),open:promisify(fs.openSync),read:promisify(fs.readSync),write:promisify(fs.writeSync),readdir:fs.readdir.bind(fs),readFile:fs.readFile.bind(fs),writeFile:promisify(fs.writeFileSync),readlink:promisify(fs.readlinkSync),realpath:promisify(fs.realpathSync),rename:promisify(fs.renameSync),stat:fs.stat.bind(fs),symlink:promisify(fs.symlinkSync),truncate:promisify(fs.truncateSync),unlink:promisify(fs.unlinkSync),utimes:promisify(fs.utimesSync),lutimes:promisify(fs.lutimesSync),rm:promisify(fs.rmSync),rmdir:promisify(fs.rmdirSync),writev:(fd,buffers,position)=>{return new Promise((resolve,reject)=>{try{var bytesWritten=fs.writevSync(fd,buffers,position)}catch(err){reject(err);return}resolve({bytesWritten,buffers})})},readv:(fd,buffers,position)=>{return new Promise((resolve,reject)=>{try{var bytesRead=fs.readvSync(fd,buffers,position)}catch(err){reject(err);return}resolve({bytesRead,buffers})})},constants,watch},$})\n"_s; -static constexpr ASCIILiteral NodeHttpCode = "(function (){\"use strict\";var $;const EventEmitter=@getInternalField(@internalModuleRegistry,15)||@createInternalModuleById(15),{isTypedArray}=@requireNativeModule(\"node:util/types\"),{Duplex,Readable,Writable}=@getInternalField(@internalModuleRegistry,34)||@createInternalModuleById(34),headerCharRegex=/[^\\t\\x20-\\x7e\\x80-\\xff]/;function checkInvalidHeaderChar(val){return RegExpPrototypeExec.call(headerCharRegex,val)!==null}const validateHeaderName=(name,label)=>{if(typeof name!==\"string\"||!name||!checkIsHttpToken(name))throw new Error(\"ERR_INVALID_HTTP_TOKEN\")},validateHeaderValue=(name,value)=>{if(value===void 0)throw new Error(\"ERR_HTTP_INVALID_HEADER_VALUE\");if(checkInvalidHeaderChar(value))throw new Error(\"ERR_INVALID_CHAR\")};function isIPv6(input){return new RegExp(\"^((\?:(\?:[0-9a-fA-F]{1,4}):){7}(\?:(\?:[0-9a-fA-F]{1,4})|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){6}(\?:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|:(\?:[0-9a-fA-F]{1,4})|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){5}(\?::((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,2}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){4}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,1}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,3}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){3}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,2}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,4}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){2}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,3}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,5}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){1}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,4}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,6}|:)|(\?::((\?::(\?:[0-9a-fA-F]{1,4})){0,5}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(\?::(\?:[0-9a-fA-F]{1,4})){1,7}|:)))(%[0-9a-zA-Z-.:]{1,})\?$\").test(input)}const{URL}=globalThis,globalReportError=globalThis.reportError,setTimeout=globalThis.setTimeout,fetch=Bun.fetch,nop=()=>{},kEmptyObject=Object.freeze(Object.create(null)),kOutHeaders=Symbol.for(\"kOutHeaders\"),kEndCalled=Symbol.for(\"kEndCalled\"),kAbortController=Symbol.for(\"kAbortController\"),kClearTimeout=Symbol(\"kClearTimeout\"),kCorked=Symbol.for(\"kCorked\"),searchParamsSymbol=Symbol.for(\"query\"),StringPrototypeSlice=String.prototype.slice,StringPrototypeStartsWith=String.prototype.startsWith,StringPrototypeToUpperCase=String.prototype.toUpperCase,StringPrototypeIncludes=String.prototype.includes,StringPrototypeCharCodeAt=String.prototype.charCodeAt,StringPrototypeIndexOf=String.prototype.indexOf,ArrayIsArray=Array.isArray,RegExpPrototypeExec=RegExp.prototype.exec,ObjectAssign=Object.assign,ObjectPrototypeHasOwnProperty=Object.prototype.hasOwnProperty,INVALID_PATH_REGEX=/[^\\u0021-\\u00ff]/,NODE_HTTP_WARNING=\"WARN: Agent is mostly unused in Bun's implementation of http. If you see strange behavior, this is probably the cause.\";var _defaultHTTPSAgent,kInternalRequest=Symbol(\"kInternalRequest\"),kInternalSocketData=Symbol.for(\"::bunternal::\");const kEmptyBuffer=Buffer.alloc(0);function isValidTLSArray(obj){if(typeof obj===\"string\"||isTypedArray(obj)||obj instanceof ArrayBuffer||obj instanceof Blob)return!0;if(Array.isArray(obj)){for(var i=0;i<obj.length;i++)if(typeof obj!==\"string\"&&!isTypedArray(obj)&&!(obj instanceof ArrayBuffer)&&!(obj instanceof Blob))return!1;return!0}}class ERR_INVALID_ARG_TYPE extends TypeError{constructor(name,expected,actual){super(`The ${name} argument must be of type ${expected}. Received type ${typeof actual}`);this.code=\"ERR_INVALID_ARG_TYPE\"}}function validateMsecs(numberlike,field){if(typeof numberlike!==\"number\"||numberlike<0)throw new ERR_INVALID_ARG_TYPE(field,\"number\",numberlike);return numberlike}function validateFunction(callable,field){if(typeof callable!==\"function\")throw new ERR_INVALID_ARG_TYPE(field,\"Function\",callable);return callable}function getHeader(headers,name){if(!headers)return;const result=headers.get(name);return result==null\?void 0:result}var FakeSocket=class Socket extends Duplex{bytesRead=0;bytesWritten=0;connecting=!1;remoteAddress=null;remotePort;timeout=0;isServer=!1;address(){return{address:this.localAddress,family:this.localFamily,port:this.localPort}}get bufferSize(){return this.writableLength}connect(port,host,connectListener){return this}_destroy(err,callback){}_final(callback){}get localAddress(){return\"127.0.0.1\"}get localFamily(){return\"IPv4\"}get localPort(){return 80}get pending(){return this.connecting}_read(size){}get readyState(){if(this.connecting)return\"opening\";if(this.readable)return this.writable\?\"open\":\"readOnly\";else return this.writable\?\"writeOnly\":\"closed\"}ref(){}get remoteFamily(){return\"IPv4\"}resetAndDestroy(){}setKeepAlive(enable=!1,initialDelay=0){}setNoDelay(noDelay=!0){return this}setTimeout(timeout,callback){return this}unref(){}_write(chunk,encoding,callback){}};function createServer(options,callback){return new Server(options,callback)}class Agent extends EventEmitter{defaultPort=80;protocol=\"http:\";options;requests;sockets;freeSockets;keepAliveMsecs;keepAlive;maxSockets;maxFreeSockets;scheduling;maxTotalSockets;totalSocketCount;#fakeSocket;static get globalAgent(){return globalAgent}static get defaultMaxSockets(){return Infinity}constructor(options=kEmptyObject){super();if(this.options=options={...options,path:null},options.noDelay===void 0)options.noDelay=!0;this.requests=kEmptyObject,this.sockets=kEmptyObject,this.freeSockets=kEmptyObject,this.keepAliveMsecs=options.keepAliveMsecs||1000,this.keepAlive=options.keepAlive||!1,this.maxSockets=options.maxSockets||Agent.defaultMaxSockets,this.maxFreeSockets=options.maxFreeSockets||256,this.scheduling=options.scheduling||\"lifo\",this.maxTotalSockets=options.maxTotalSockets,this.totalSocketCount=0,this.defaultPort=options.defaultPort||80,this.protocol=options.protocol||\"http:\"}createConnection(){return this.#fakeSocket\?\?=new FakeSocket}getName(options=kEmptyObject){let name=`http:${options.host||\"localhost\"}:`;if(options.port)name+=options.port;if(name+=\":\",options.localAddress)name+=options.localAddress;if(options.family===4||options.family===6)name+=`:${options.family}`;if(options.socketPath)name+=`:${options.socketPath}`;return name}addRequest(){}createSocket(req,options,cb){cb(null,this.#fakeSocket\?\?=new FakeSocket)}removeSocket(){}keepSocketAlive(){return!0}reuseSocket(){}destroy(){}}function emitListeningNextTick(self,onListen,err,hostname,port){if(typeof onListen===\"function\")try{onListen(err,hostname,port)}catch(err2){self.emit(\"error\",err2)}if(self.listening=!err,err)self.emit(\"error\",err);else self.emit(\"listening\",hostname,port)}class Server extends EventEmitter{#server;#options;#tls;#is_tls=!1;listening=!1;serverName;constructor(options,callback){super();if(typeof options===\"function\")callback=options,options={};else if(options==null||typeof options===\"object\"){options={...options},this.#tls=null;let key=options.key;if(key){if(!isValidTLSArray(key))@throwTypeError(\"key argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");this.#is_tls=!0}let cert=options.cert;if(cert){if(!isValidTLSArray(cert))@throwTypeError(\"cert argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");this.#is_tls=!0}let ca=options.ca;if(ca){if(!isValidTLSArray(ca))@throwTypeError(\"ca argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");this.#is_tls=!0}let passphrase=options.passphrase;if(passphrase&&typeof passphrase!==\"string\")@throwTypeError(\"passphrase argument must be an string\");let serverName=options.servername;if(serverName&&typeof serverName!==\"string\")@throwTypeError(\"servername argument must be an string\");let secureOptions=options.secureOptions||0;if(secureOptions&&typeof secureOptions!==\"number\")@throwTypeError(\"secureOptions argument must be an number\");if(this.#is_tls)this.#tls={serverName,key,cert,ca,passphrase,secureOptions};else this.#tls=null}else throw new Error(\"bun-http-polyfill: invalid arguments\");if(this.#options=options,callback)this.on(\"request\",callback)}closeAllConnections(){const server=this.#server;if(!server)return;this.#server=void 0,server.stop(!0),this.emit(\"close\")}closeIdleConnections(){}close(optionalCallback){const server=this.#server;if(!server){if(typeof optionalCallback===\"function\")process.nextTick(optionalCallback,new Error(\"Server is not running\"));return}if(this.#server=void 0,typeof optionalCallback===\"function\")this.once(\"close\",optionalCallback);server.stop(),this.emit(\"close\")}address(){if(!this.#server)return null;const address=this.#server.hostname;return{address,family:isIPv6(address)\?\"IPv6\":\"IPv4\",port:this.#server.port}}listen(port,host,backlog,onListen){const server=this;if(typeof host===\"function\")onListen=host,host=void 0;if(typeof port===\"function\")onListen=port;else if(typeof port===\"object\"){if(port\?.signal\?.addEventListener(\"abort\",()=>{this.close()}),host=port\?.host,port=port\?.port,typeof port\?.callback===\"function\")onListen=port\?.callback}if(typeof backlog===\"function\")onListen=backlog;const ResponseClass=this.#options.ServerResponse||ServerResponse,RequestClass=this.#options.IncomingMessage||IncomingMessage;try{const tls=this.#tls;if(tls)this.serverName=tls.serverName||host||\"localhost\";this.#server=Bun.serve({tls,port,hostname:host,websocket:{open(ws){ws.data.open(ws)},message(ws,message){ws.data.message(ws,message)},close(ws,code,reason){ws.data.close(ws,code,reason)},drain(ws){ws.data.drain(ws)}},fetch(req,_server){var pendingResponse,pendingError,rejectFunction,resolveFunction,reject=(err)=>{if(pendingError)return;if(pendingError=err,rejectFunction)rejectFunction(err)},reply=function(resp){if(pendingResponse)return;if(pendingResponse=resp,resolveFunction)resolveFunction(resp)};const http_req=new RequestClass(req),http_res=new ResponseClass({reply,req:http_req});if(http_req.once(\"error\",(err)=>reject(err)),http_res.once(\"error\",(err)=>reject(err)),req.headers.get(\"upgrade\")){const socket=new FakeSocket;socket[kInternalSocketData]=[_server,http_res,req],server.emit(\"upgrade\",http_req,socket,kEmptyBuffer)}else server.emit(\"request\",http_req,http_res);if(pendingError)throw pendingError;if(pendingResponse)return pendingResponse;return new Promise((resolve,reject2)=>{resolveFunction=resolve,rejectFunction=reject2})}}),setTimeout(emitListeningNextTick,1,this,onListen,null,this.#server.hostname,this.#server.port)}catch(err){setTimeout(emitListeningNextTick,1,this,onListen,err)}return this}setTimeout(msecs,callback){}}function assignHeaders(object,req){var headers=req.headers.toJSON();const rawHeaders=@newArrayWithSize(req.headers.count*2);var i=0;for(let key in headers)rawHeaders[i++]=key,rawHeaders[i++]=headers[key];object.headers=headers,object.rawHeaders=rawHeaders}function destroyBodyStreamNT(bodyStream){bodyStream.destroy()}var defaultIncomingOpts={type:\"request\"};function getDefaultHTTPSAgent(){return _defaultHTTPSAgent\?\?=new Agent({defaultPort:443,protocol:\"https:\"})}class IncomingMessage extends Readable{method;complete;constructor(req,defaultIncomingOpts2){const method=req.method;super();const url=new URL(req.url);var{type=\"request\",[kInternalRequest]:nodeReq}=defaultIncomingOpts2||{};this.#noBody=type===\"request\"\?method===\"GET\"||method===\"HEAD\"||method===\"TRACE\"||method===\"CONNECT\"||method===\"OPTIONS\"||(parseInt(req.headers.get(\"Content-Length\")||\"\")||0)===0:!1,this.#req=req,this.method=method,this.#type=type,this.complete=!!this.#noBody,this.#bodyStream=void 0;const socket=new FakeSocket;socket.remoteAddress=url.hostname,socket.remotePort=url.port,this.#fakeSocket=socket,this.url=url.pathname+url.search,this.#nodeReq=nodeReq,assignHeaders(this,req)}headers;rawHeaders;_consuming=!1;_dumped=!1;#bodyStream;#fakeSocket;#noBody=!1;#aborted=!1;#req;url;#type;#nodeReq;get req(){return this.#nodeReq}_construct(callback){if(this.#type===\"response\"||this.#noBody){callback();return}const contentLength=this.#req.headers.get(\"content-length\");if((contentLength\?parseInt(contentLength,10):0)===0){this.#noBody=!0,callback();return}callback()}async#consumeStream(reader){while(!0){var{done,value}=await reader.readMany();if(this.#aborted)return;if(done){this.push(null),this.destroy();break}for(var v of value)this.push(v)}}_read(size){if(this.#noBody)this.push(null),this.complete=!0;else if(this.#bodyStream==null){const reader=this.#req.body\?.getReader();if(!reader){this.push(null);return}this.#bodyStream=reader,this.#consumeStream(reader)}}get aborted(){return this.#aborted}#abort(){if(this.#aborted)return;this.#aborted=!0;var bodyStream=this.#bodyStream;if(!bodyStream)return;bodyStream.cancel(),this.complete=!0,this.#bodyStream=void 0,this.push(null)}get connection(){return this.#fakeSocket}get statusCode(){return this.#req.status}get statusMessage(){return STATUS_CODES[this.#req.status]}get httpVersion(){return\"1.1\"}get rawTrailers(){return[]}get httpVersionMajor(){return 1}get httpVersionMinor(){return 1}get trailers(){return kEmptyObject}get socket(){return this.#fakeSocket\?\?=new FakeSocket}set socket(val){this.#fakeSocket=val}setTimeout(msecs,callback){throw new Error(\"not implemented\")}}function emitErrorNt(msg,err,callback){if(callback(err),typeof msg.emit===\"function\"&&!msg._closed)msg.emit(\"error\",err)}function onError(self,err,cb){process.nextTick(()=>emitErrorNt(self,err,cb))}function write_(msg,chunk,encoding,callback,fromEnd){if(typeof callback!==\"function\")callback=nop;let len;if(chunk===null)throw new Error(\"ERR_STREAM_NULL_VALUES\");else if(typeof chunk===\"string\")len=Buffer.byteLength(chunk,encoding);else throw new Error(\"Invalid arg type for chunk\");let err;if(msg.finished)err=new Error(\"ERR_STREAM_WRITE_AFTER_END\");else if(msg.destroyed)err=new Error(\"ERR_STREAM_DESTROYED\");if(err){if(!msg.destroyed)onError(msg,err,callback);else process.nextTick(callback,err);return!1}if(!msg._header){if(fromEnd)msg._contentLength=len}if(!msg._hasBody)return process.nextTick(callback),!0;return!0}class OutgoingMessage extends Writable{constructor(){super(...arguments)}#headers;headersSent=!1;sendDate=!0;req;timeout;#finished=!1;[kEndCalled]=!1;#fakeSocket;#timeoutTimer;[kAbortController]=null;_implicitHeader(){}get headers(){if(!this.#headers)return kEmptyObject;return this.#headers.toJSON()}get shouldKeepAlive(){return!0}get chunkedEncoding(){return!1}set chunkedEncoding(value){}set shouldKeepAlive(value){}get useChunkedEncodingByDefault(){return!0}set useChunkedEncodingByDefault(value){}get socket(){return this.#fakeSocket\?\?=new FakeSocket}set socket(val){this.#fakeSocket=val}get connection(){return this.socket}get finished(){return this.#finished}appendHeader(name,value){var headers=this.#headers\?\?=new Headers;headers.append(name,value)}flushHeaders(){}getHeader(name){return getHeader(this.#headers,name)}getHeaders(){if(!this.#headers)return kEmptyObject;return this.#headers.toJSON()}getHeaderNames(){var headers=this.#headers;if(!headers)return[];return Array.from(headers.keys())}removeHeader(name){if(!this.#headers)return;this.#headers.delete(name)}setHeader(name,value){var headers=this.#headers\?\?=new Headers;return headers.set(name,value),this}hasHeader(name){if(!this.#headers)return!1;return this.#headers.has(name)}addTrailers(headers){throw new Error(\"not implemented\")}[kClearTimeout](){if(this.#timeoutTimer)clearTimeout(this.#timeoutTimer),this.removeAllListeners(\"timeout\"),this.#timeoutTimer=void 0}#onTimeout(){this.#timeoutTimer=void 0,this[kAbortController]\?.abort(),this.emit(\"timeout\")}setTimeout(msecs,callback){if(this.destroyed)return this;if(this.timeout=msecs=validateMsecs(msecs,\"msecs\"),clearTimeout(this.#timeoutTimer),msecs===0){if(callback!==void 0)validateFunction(callback,\"callback\"),this.removeListener(\"timeout\",callback);this.#timeoutTimer=void 0}else if(this.#timeoutTimer=setTimeout(this.#onTimeout.bind(this),msecs).unref(),callback!==void 0)validateFunction(callback,\"callback\"),this.once(\"timeout\",callback);return this}}let OriginalWriteHeadFn,OriginalImplicitHeadFn;class ServerResponse extends Writable{constructor({req,reply}){super();if(this.req=req,this._reply=reply,this.sendDate=!0,this.statusCode=200,this.headersSent=!1,this.statusMessage=void 0,this.#controller=void 0,this.#firstWrite=void 0,this._writableState.decodeStrings=!1,this.#deferred=void 0,req.method===\"HEAD\")this._hasBody=!1}req;_reply;sendDate;statusCode;#headers;headersSent=!1;statusMessage;#controller;#firstWrite;_sent100=!1;_defaultKeepAlive=!1;_removedConnection=!1;_removedContLen=!1;_hasBody=!0;#deferred=void 0;#finished=!1;_implicitHeader(){this.writeHead(this.statusCode)}_write(chunk,encoding,callback){if(!this.#firstWrite&&!this.headersSent){this.#firstWrite=chunk,callback();return}this.#ensureReadableStreamController((controller)=>{controller.write(chunk),callback()})}_writev(chunks,callback){if(chunks.length===1&&!this.headersSent&&!this.#firstWrite){this.#firstWrite=chunks[0].chunk,callback();return}this.#ensureReadableStreamController((controller)=>{for(let chunk of chunks)controller.write(chunk.chunk);callback()})}#ensureReadableStreamController(run){var thisController=this.#controller;if(thisController)return run(thisController);this.headersSent=!0;var firstWrite=this.#firstWrite;this.#firstWrite=void 0,this._reply(new Response(new ReadableStream({type:\"direct\",pull:(controller)=>{if(this.#controller=controller,firstWrite)controller.write(firstWrite);if(firstWrite=void 0,run(controller),!this.#finished)return new Promise((resolve)=>{this.#deferred=resolve})}}),{headers:this.#headers,status:this.statusCode,statusText:this.statusMessage\?\?STATUS_CODES[this.statusCode]}))}#drainHeadersIfObservable(){if(this._implicitHeader===OriginalImplicitHeadFn&&this.writeHead===OriginalWriteHeadFn)return;this._implicitHeader()}_final(callback){if(!this.headersSent){var data=this.#firstWrite||\"\";this.#firstWrite=void 0,this.#finished=!0,this.#drainHeadersIfObservable(),this._reply(new Response(data,{headers:this.#headers,status:this.statusCode,statusText:this.statusMessage\?\?STATUS_CODES[this.statusCode]})),callback&&callback();return}this.#finished=!0,this.#ensureReadableStreamController((controller)=>{controller.end(),callback();var deferred=this.#deferred;if(deferred)this.#deferred=void 0,deferred()})}writeProcessing(){throw new Error(\"not implemented\")}addTrailers(headers){throw new Error(\"not implemented\")}assignSocket(socket){throw new Error(\"not implemented\")}detachSocket(socket){throw new Error(\"not implemented\")}writeContinue(callback){throw new Error(\"not implemented\")}setTimeout(msecs,callback){throw new Error(\"not implemented\")}get shouldKeepAlive(){return!0}get chunkedEncoding(){return!1}set chunkedEncoding(value){}set shouldKeepAlive(value){}get useChunkedEncodingByDefault(){return!0}set useChunkedEncodingByDefault(value){}appendHeader(name,value){var headers=this.#headers\?\?=new Headers;headers.append(name,value)}flushHeaders(){}getHeader(name){return getHeader(this.#headers,name)}getHeaders(){var headers=this.#headers;if(!headers)return kEmptyObject;return headers.toJSON()}getHeaderNames(){var headers=this.#headers;if(!headers)return[];return Array.from(headers.keys())}removeHeader(name){if(!this.#headers)return;this.#headers.delete(name)}setHeader(name,value){var headers=this.#headers\?\?=new Headers;return headers.set(name,value),this}hasHeader(name){if(!this.#headers)return!1;return this.#headers.has(name)}writeHead(statusCode,statusMessage,headers){return _writeHead(statusCode,statusMessage,headers,this),this}}OriginalWriteHeadFn=ServerResponse.prototype.writeHead,OriginalImplicitHeadFn=ServerResponse.prototype._implicitHeader;class ClientRequest extends OutgoingMessage{#timeout;#res=null;#upgradeOrConnect=!1;#parser=null;#maxHeadersCount=null;#reusedSocket=!1;#host;#protocol;#method;#port;#useDefaultPort;#joinDuplicateHeaders;#maxHeaderSize;#agent=globalAgent;#path;#socketPath;#bodyChunks=null;#fetchRequest;#signal=null;[kAbortController]=null;#timeoutTimer=void 0;#options;#finished;get path(){return this.#path}get port(){return this.#port}get method(){return this.#method}get host(){return this.#host}get protocol(){return this.#protocol}_write(chunk,encoding,callback){if(!this.#bodyChunks){this.#bodyChunks=[chunk],callback();return}this.#bodyChunks.push(chunk),callback()}_writev(chunks,callback){if(!this.#bodyChunks){this.#bodyChunks=chunks,callback();return}this.#bodyChunks.push(...chunks),callback()}_final(callback){if(this.#finished=!0,this[kAbortController]=new AbortController,this[kAbortController].signal.addEventListener(\"abort\",()=>{this[kClearTimeout]()}),this.#signal\?.aborted)this[kAbortController].abort();var method=this.#method,body=Buffer.concat(this.#bodyChunks||[]);try{this.#fetchRequest=fetch(`${this.#protocol}//${this.#host}${this.#useDefaultPort\?\"\":\":\"+this.#port}${this.#path}`,{method,headers:this.getHeaders(),body:body&&method!==\"GET\"&&method!==\"HEAD\"&&method!==\"OPTIONS\"\?body:void 0,redirect:\"manual\",verbose:!1,signal:this[kAbortController].signal,timeout:!1}).then((response)=>{var res=this.#res=new IncomingMessage(response,{type:\"response\",[kInternalRequest]:this});this.emit(\"response\",res)}).catch((err)=>{this.emit(\"error\",err)}).finally(()=>{this.#fetchRequest=null,this[kClearTimeout]()})}catch(err){this.emit(\"error\",err)}finally{callback()}}get aborted(){return this.#signal\?.aborted||!!this[kAbortController]\?.signal.aborted}abort(){if(this.aborted)return;this[kAbortController].abort()}constructor(input,options,cb){super();if(typeof input===\"string\"){const urlStr=input;try{var urlObject=new URL(urlStr)}catch(e){@throwTypeError(`Invalid URL: ${urlStr}`)}input=urlToHttpOptions(urlObject)}else if(input&&typeof input===\"object\"&&input instanceof URL)input=urlToHttpOptions(input);else cb=options,options=input,input=null;if(typeof options===\"function\")cb=options,options=input||kEmptyObject;else options=ObjectAssign(input||{},options);var defaultAgent=options._defaultAgent||Agent.globalAgent;let protocol=options.protocol;if(!protocol)if(options.port===443)protocol=\"https:\";else protocol=defaultAgent.protocol||\"http:\";switch(this.#protocol=protocol,this.#agent\?.protocol){case void 0:break;case\"http:\":if(protocol===\"https:\"){defaultAgent=this.#agent=getDefaultHTTPSAgent();break}case\"https:\":if(protocol===\"https\"){defaultAgent=this.#agent=Agent.globalAgent;break}default:break}if(options.path){const path=String(options.path);if(RegExpPrototypeExec.call(INVALID_PATH_REGEX,path)!==null)throw new Error(\"Path contains unescaped characters\")}if(protocol!==\"http:\"&&protocol!==\"https:\"&&protocol){const expectedProtocol=defaultAgent\?.protocol\?\?\"http:\";throw new Error(`Protocol mismatch. Expected: ${expectedProtocol}. Got: ${protocol}`)}const defaultPort=protocol===\"https:\"\?443:80;this.#port=options.port||options.defaultPort||this.#agent\?.defaultPort||defaultPort,this.#useDefaultPort=this.#port===defaultPort;const host=this.#host=options.host=validateHost(options.hostname,\"hostname\")||validateHost(options.host,\"host\")||\"localhost\";this.#socketPath=options.socketPath;const signal=options.signal;if(signal)signal.addEventListener(\"abort\",()=>{this[kAbortController]\?.abort()}),this.#signal=signal;let method=options.method;const methodIsString=typeof method===\"string\";if(method!==null&&method!==void 0&&!methodIsString)throw new Error(\"ERR_INVALID_ARG_TYPE: options.method\");if(methodIsString&&method){if(!checkIsHttpToken(method))throw new Error(\"ERR_INVALID_HTTP_TOKEN: Method\");method=this.#method=StringPrototypeToUpperCase.call(method)}else method=this.#method=\"GET\";const _maxHeaderSize=options.maxHeaderSize;this.#maxHeaderSize=_maxHeaderSize;var _joinDuplicateHeaders=options.joinDuplicateHeaders;if(this.#joinDuplicateHeaders=_joinDuplicateHeaders,this.#path=options.path||\"/\",cb)this.once(\"response\",cb);this.#finished=!1,this.#res=null,this.#upgradeOrConnect=!1,this.#parser=null,this.#maxHeadersCount=null,this.#reusedSocket=!1,this.#host=host,this.#protocol=protocol;var timeout=options.timeout;if(timeout!==void 0&&timeout!==0)this.setTimeout(timeout,void 0);if(!ArrayIsArray(headers)){var headers=options.headers;if(headers)for(let key in headers)this.setHeader(key,headers[key]);var auth=options.auth;if(auth&&!this.getHeader(\"Authorization\"))this.setHeader(\"Authorization\",\"Basic \"+Buffer.from(auth).toString(\"base64\"))}var{signal:_signal,...optsWithoutSignal}=options;this.#options=optsWithoutSignal}setSocketKeepAlive(enable=!0,initialDelay=0){}setNoDelay(noDelay=!0){}[kClearTimeout](){if(this.#timeoutTimer)clearTimeout(this.#timeoutTimer),this.#timeoutTimer=void 0,this.removeAllListeners(\"timeout\")}#onTimeout(){this.#timeoutTimer=void 0,this[kAbortController]\?.abort(),this.emit(\"timeout\")}setTimeout(msecs,callback){if(this.destroyed)return this;if(this.timeout=msecs=validateMsecs(msecs,\"msecs\"),clearTimeout(this.#timeoutTimer),msecs===0){if(callback!==void 0)validateFunction(callback,\"callback\"),this.removeListener(\"timeout\",callback);this.#timeoutTimer=void 0}else if(this.#timeoutTimer=setTimeout(this.#onTimeout.bind(this),msecs).unref(),callback!==void 0)validateFunction(callback,\"callback\"),this.once(\"timeout\",callback);return this}}function urlToHttpOptions(url){var{protocol,hostname,hash,search,pathname,href,port,username,password}=url;return{protocol,hostname:typeof hostname===\"string\"&&StringPrototypeStartsWith.call(hostname,\"[\")\?StringPrototypeSlice.call(hostname,1,-1):hostname,hash,search,pathname,path:`${pathname||\"\"}${search||\"\"}`,href,port:port\?Number(port):protocol===\"https:\"\?443:protocol===\"http:\"\?80:void 0,auth:username||password\?`${decodeURIComponent(username)}:${decodeURIComponent(password)}`:void 0}}function validateHost(host,name){if(host!==null&&host!==void 0&&typeof host!==\"string\")throw new Error(\"Invalid arg type in options\");return host}const tokenRegExp=/^[\\^_`a-zA-Z\\-0-9!#$%&'*+.|~]+$/;function checkIsHttpToken(val){return RegExpPrototypeExec.call(tokenRegExp,val)!==null}const METHODS=[\"ACL\",\"BIND\",\"CHECKOUT\",\"CONNECT\",\"COPY\",\"DELETE\",\"GET\",\"HEAD\",\"LINK\",\"LOCK\",\"M-SEARCH\",\"MERGE\",\"MKACTIVITY\",\"MKCALENDAR\",\"MKCOL\",\"MOVE\",\"NOTIFY\",\"OPTIONS\",\"PATCH\",\"POST\",\"PROPFIND\",\"PROPPATCH\",\"PURGE\",\"PUT\",\"REBIND\",\"REPORT\",\"SEARCH\",\"SOURCE\",\"SUBSCRIBE\",\"TRACE\",\"UNBIND\",\"UNLINK\",\"UNLOCK\",\"UNSUBSCRIBE\"],STATUS_CODES={100:\"Continue\",101:\"Switching Protocols\",102:\"Processing\",103:\"Early Hints\",200:\"OK\",201:\"Created\",202:\"Accepted\",203:\"Non-Authoritative Information\",204:\"No Content\",205:\"Reset Content\",206:\"Partial Content\",207:\"Multi-Status\",208:\"Already Reported\",226:\"IM Used\",300:\"Multiple Choices\",301:\"Moved Permanently\",302:\"Found\",303:\"See Other\",304:\"Not Modified\",305:\"Use Proxy\",307:\"Temporary Redirect\",308:\"Permanent Redirect\",400:\"Bad Request\",401:\"Unauthorized\",402:\"Payment Required\",403:\"Forbidden\",404:\"Not Found\",405:\"Method Not Allowed\",406:\"Not Acceptable\",407:\"Proxy Authentication Required\",408:\"Request Timeout\",409:\"Conflict\",410:\"Gone\",411:\"Length Required\",412:\"Precondition Failed\",413:\"Payload Too Large\",414:\"URI Too Long\",415:\"Unsupported Media Type\",416:\"Range Not Satisfiable\",417:\"Expectation Failed\",418:\"I'm a Teapot\",421:\"Misdirected Request\",422:\"Unprocessable Entity\",423:\"Locked\",424:\"Failed Dependency\",425:\"Too Early\",426:\"Upgrade Required\",428:\"Precondition Required\",429:\"Too Many Requests\",431:\"Request Header Fields Too Large\",451:\"Unavailable For Legal Reasons\",500:\"Internal Server Error\",501:\"Not Implemented\",502:\"Bad Gateway\",503:\"Service Unavailable\",504:\"Gateway Timeout\",505:\"HTTP Version Not Supported\",506:\"Variant Also Negotiates\",507:\"Insufficient Storage\",508:\"Loop Detected\",509:\"Bandwidth Limit Exceeded\",510:\"Not Extended\",511:\"Network Authentication Required\"};function _normalizeArgs(args){let arr;if(args.length===0)return arr=[{},null],arr;const arg0=args[0];let options={};if(typeof arg0===\"object\"&&arg0!==null)options=arg0;else if(options.port=arg0,args.length>1&&typeof args[1]===\"string\")options.host=args[1];const cb=args[args.length-1];if(typeof cb!==\"function\")arr=[options,null];else arr=[options,cb];return arr}function _writeHead(statusCode,reason,obj,response){if(statusCode|=0,statusCode<100||statusCode>999)throw new Error(\"status code must be between 100 and 999\");if(typeof reason===\"string\")response.statusMessage=reason;else{if(!response.statusMessage)response.statusMessage=STATUS_CODES[statusCode]||\"unknown\";obj=reason}response.statusCode=statusCode;{let k;if(Array.isArray(obj)){if(obj.length%2!==0)throw new Error(\"raw headers must have an even number of elements\");for(let n=0;n<obj.length;n+=2)if(k=obj[n+0],k)response.setHeader(k,obj[n+1])}else if(obj){const keys=Object.keys(obj);for(let i=0;i<keys.length;i++)if(k=keys[i],k)response.setHeader(k,obj[k])}}if(statusCode===204||statusCode===304||statusCode>=100&&statusCode<=199)response._hasBody=!1}function request(url,options,cb){return new ClientRequest(url,options,cb)}function get(url,options,cb){const req=request(url,options,cb);return req.end(),req}var globalAgent=new Agent;return $={Agent,Server,METHODS,STATUS_CODES,createServer,ServerResponse,IncomingMessage,request,get,maxHeaderSize:16384,validateHeaderName,validateHeaderValue,setMaxIdleHTTPParsers(max){},globalAgent,ClientRequest,OutgoingMessage},$})\n"_s; +static constexpr ASCIILiteral NodeHttpCode = "(function (){\"use strict\";var $;const EventEmitter=@getInternalField(@internalModuleRegistry,15)||@createInternalModuleById(15),{isTypedArray}=@requireNativeModule(\"node:util/types\"),{Duplex,Readable,Writable}=@getInternalField(@internalModuleRegistry,34)||@createInternalModuleById(34),headerCharRegex=/[^\\t\\x20-\\x7e\\x80-\\xff]/;function checkInvalidHeaderChar(val){return RegExpPrototypeExec.call(headerCharRegex,val)!==null}const validateHeaderName=(name,label)=>{if(typeof name!==\"string\"||!name||!checkIsHttpToken(name))throw new Error(\"ERR_INVALID_HTTP_TOKEN\")},validateHeaderValue=(name,value)=>{if(value===void 0)throw new Error(\"ERR_HTTP_INVALID_HEADER_VALUE\");if(checkInvalidHeaderChar(value))throw new Error(\"ERR_INVALID_CHAR\")};function isIPv6(input){return new RegExp(\"^((\?:(\?:[0-9a-fA-F]{1,4}):){7}(\?:(\?:[0-9a-fA-F]{1,4})|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){6}(\?:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|:(\?:[0-9a-fA-F]{1,4})|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){5}(\?::((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,2}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){4}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,1}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,3}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){3}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,2}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,4}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){2}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,3}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,5}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){1}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,4}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,6}|:)|(\?::((\?::(\?:[0-9a-fA-F]{1,4})){0,5}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(\?::(\?:[0-9a-fA-F]{1,4})){1,7}|:)))(%[0-9a-zA-Z-.:]{1,})\?$\").test(input)}const{URL}=globalThis,globalReportError=globalThis.reportError,setTimeout=globalThis.setTimeout,fetch=Bun.fetch,nop=()=>{},kEmptyObject=Object.freeze(Object.create(null)),kOutHeaders=Symbol.for(\"kOutHeaders\"),kEndCalled=Symbol.for(\"kEndCalled\"),kAbortController=Symbol.for(\"kAbortController\"),kClearTimeout=Symbol(\"kClearTimeout\"),kCorked=Symbol.for(\"kCorked\"),searchParamsSymbol=Symbol.for(\"query\"),StringPrototypeSlice=String.prototype.slice,StringPrototypeStartsWith=String.prototype.startsWith,StringPrototypeToUpperCase=String.prototype.toUpperCase,StringPrototypeIncludes=String.prototype.includes,StringPrototypeCharCodeAt=String.prototype.charCodeAt,StringPrototypeIndexOf=String.prototype.indexOf,ArrayIsArray=Array.isArray,RegExpPrototypeExec=RegExp.prototype.exec,ObjectAssign=Object.assign,ObjectPrototypeHasOwnProperty=Object.prototype.hasOwnProperty,INVALID_PATH_REGEX=/[^\\u0021-\\u00ff]/,NODE_HTTP_WARNING=\"WARN: Agent is mostly unused in Bun's implementation of http. If you see strange behavior, this is probably the cause.\";var _defaultHTTPSAgent,kInternalRequest=Symbol(\"kInternalRequest\"),kInternalSocketData=Symbol.for(\"::bunternal::\");const kEmptyBuffer=Buffer.alloc(0);function isValidTLSArray(obj){if(typeof obj===\"string\"||isTypedArray(obj)||obj instanceof ArrayBuffer||obj instanceof Blob)return!0;if(Array.isArray(obj)){for(var i=0;i<obj.length;i++)if(typeof obj!==\"string\"&&!isTypedArray(obj)&&!(obj instanceof ArrayBuffer)&&!(obj instanceof Blob))return!1;return!0}}class ERR_INVALID_ARG_TYPE extends TypeError{constructor(name,expected,actual){super(`The ${name} argument must be of type ${expected}. Received type ${typeof actual}`);this.code=\"ERR_INVALID_ARG_TYPE\"}}function validateMsecs(numberlike,field){if(typeof numberlike!==\"number\"||numberlike<0)throw new ERR_INVALID_ARG_TYPE(field,\"number\",numberlike);return numberlike}function validateFunction(callable,field){if(typeof callable!==\"function\")throw new ERR_INVALID_ARG_TYPE(field,\"Function\",callable);return callable}function getHeader(headers,name){if(!headers)return;const result=headers.get(name);return result==null\?void 0:result}var FakeSocket=class Socket extends Duplex{bytesRead=0;bytesWritten=0;connecting=!1;remoteAddress=null;remotePort;timeout=0;isServer=!1;address(){return{address:this.localAddress,family:this.localFamily,port:this.localPort}}get bufferSize(){return this.writableLength}connect(port,host,connectListener){return this}_destroy(err,callback){}_final(callback){}get localAddress(){return\"127.0.0.1\"}get localFamily(){return\"IPv4\"}get localPort(){return 80}get pending(){return this.connecting}_read(size){}get readyState(){if(this.connecting)return\"opening\";if(this.readable)return this.writable\?\"open\":\"readOnly\";else return this.writable\?\"writeOnly\":\"closed\"}ref(){}get remoteFamily(){return\"IPv4\"}resetAndDestroy(){}setKeepAlive(enable=!1,initialDelay=0){}setNoDelay(noDelay=!0){return this}setTimeout(timeout,callback){return this}unref(){}_write(chunk,encoding,callback){}};function createServer(options,callback){return new Server(options,callback)}class Agent extends EventEmitter{defaultPort=80;protocol=\"http:\";options;requests;sockets;freeSockets;keepAliveMsecs;keepAlive;maxSockets;maxFreeSockets;scheduling;maxTotalSockets;totalSocketCount;#fakeSocket;static get globalAgent(){return globalAgent}static get defaultMaxSockets(){return Infinity}constructor(options=kEmptyObject){super();if(this.options=options={...options,path:null},options.noDelay===void 0)options.noDelay=!0;this.requests=kEmptyObject,this.sockets=kEmptyObject,this.freeSockets=kEmptyObject,this.keepAliveMsecs=options.keepAliveMsecs||1000,this.keepAlive=options.keepAlive||!1,this.maxSockets=options.maxSockets||Agent.defaultMaxSockets,this.maxFreeSockets=options.maxFreeSockets||256,this.scheduling=options.scheduling||\"lifo\",this.maxTotalSockets=options.maxTotalSockets,this.totalSocketCount=0,this.defaultPort=options.defaultPort||80,this.protocol=options.protocol||\"http:\"}createConnection(){return this.#fakeSocket\?\?=new FakeSocket}getName(options=kEmptyObject){let name=`http:${options.host||\"localhost\"}:`;if(options.port)name+=options.port;if(name+=\":\",options.localAddress)name+=options.localAddress;if(options.family===4||options.family===6)name+=`:${options.family}`;if(options.socketPath)name+=`:${options.socketPath}`;return name}addRequest(){}createSocket(req,options,cb){cb(null,this.#fakeSocket\?\?=new FakeSocket)}removeSocket(){}keepSocketAlive(){return!0}reuseSocket(){}destroy(){}}function emitListeningNextTick(self,onListen,err,hostname,port){if(typeof onListen===\"function\")try{onListen(err,hostname,port)}catch(err2){self.emit(\"error\",err2)}if(self.listening=!err,err)self.emit(\"error\",err);else self.emit(\"listening\",hostname,port)}class Server extends EventEmitter{#server;#options;#tls;#is_tls=!1;listening=!1;serverName;constructor(options,callback){super();if(typeof options===\"function\")callback=options,options={};else if(options==null||typeof options===\"object\"){options={...options},this.#tls=null;let key=options.key;if(key){if(!isValidTLSArray(key))@throwTypeError(\"key argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");this.#is_tls=!0}let cert=options.cert;if(cert){if(!isValidTLSArray(cert))@throwTypeError(\"cert argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");this.#is_tls=!0}let ca=options.ca;if(ca){if(!isValidTLSArray(ca))@throwTypeError(\"ca argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");this.#is_tls=!0}let passphrase=options.passphrase;if(passphrase&&typeof passphrase!==\"string\")@throwTypeError(\"passphrase argument must be an string\");let serverName=options.servername;if(serverName&&typeof serverName!==\"string\")@throwTypeError(\"servername argument must be an string\");let secureOptions=options.secureOptions||0;if(secureOptions&&typeof secureOptions!==\"number\")@throwTypeError(\"secureOptions argument must be an number\");if(this.#is_tls)this.#tls={serverName,key,cert,ca,passphrase,secureOptions};else this.#tls=null}else throw new Error(\"bun-http-polyfill: invalid arguments\");if(this.#options=options,callback)this.on(\"request\",callback)}closeAllConnections(){const server=this.#server;if(!server)return;this.#server=void 0,server.stop(!0),this.emit(\"close\")}closeIdleConnections(){}close(optionalCallback){const server=this.#server;if(!server){if(typeof optionalCallback===\"function\")process.nextTick(optionalCallback,new Error(\"Server is not running\"));return}if(this.#server=void 0,typeof optionalCallback===\"function\")this.once(\"close\",optionalCallback);server.stop(),this.emit(\"close\")}address(){if(!this.#server)return null;const address=this.#server.hostname;return{address,family:isIPv6(address)\?\"IPv6\":\"IPv4\",port:this.#server.port}}listen(port,host,backlog,onListen){const server=this;if(typeof host===\"function\")onListen=host,host=void 0;if(typeof port===\"function\")onListen=port;else if(typeof port===\"object\"){if(port\?.signal\?.addEventListener(\"abort\",()=>{this.close()}),host=port\?.host,port=port\?.port,typeof port\?.callback===\"function\")onListen=port\?.callback}if(typeof backlog===\"function\")onListen=backlog;const ResponseClass=this.#options.ServerResponse||ServerResponse,RequestClass=this.#options.IncomingMessage||IncomingMessage;try{const tls=this.#tls;if(tls)this.serverName=tls.serverName||host||\"localhost\";this.#server=Bun.serve({tls,port,hostname:host,websocket:{open(ws){ws.data.open(ws)},message(ws,message){ws.data.message(ws,message)},close(ws,code,reason){ws.data.close(ws,code,reason)},drain(ws){ws.data.drain(ws)}},fetch(req,_server){var pendingResponse,pendingError,rejectFunction,resolveFunction,reject=(err)=>{if(pendingError)return;if(pendingError=err,rejectFunction)rejectFunction(err)},reply=function(resp){if(pendingResponse)return;if(pendingResponse=resp,resolveFunction)resolveFunction(resp)};const http_req=new RequestClass(req),http_res=new ResponseClass({reply,req:http_req});if(http_req.once(\"error\",(err)=>reject(err)),http_res.once(\"error\",(err)=>reject(err)),req.headers.get(\"upgrade\")){const socket=new FakeSocket;socket[kInternalSocketData]=[_server,http_res,req],server.emit(\"upgrade\",http_req,socket,kEmptyBuffer)}else server.emit(\"request\",http_req,http_res);if(pendingError)throw pendingError;if(pendingResponse)return pendingResponse;return new Promise((resolve,reject2)=>{resolveFunction=resolve,rejectFunction=reject2})}}),setTimeout(emitListeningNextTick,1,this,onListen,null,this.#server.hostname,this.#server.port)}catch(err){setTimeout(emitListeningNextTick,1,this,onListen,err)}return this}setTimeout(msecs,callback){}}function assignHeaders(object,req){var headers=req.headers.toJSON();const rawHeaders=@newArrayWithSize(req.headers.count*2);var i=0;for(let key in headers)rawHeaders[i++]=key,rawHeaders[i++]=headers[key];object.headers=headers,object.rawHeaders=rawHeaders}function destroyBodyStreamNT(bodyStream){bodyStream.destroy()}var defaultIncomingOpts={type:\"request\"};function getDefaultHTTPSAgent(){return _defaultHTTPSAgent\?\?=new Agent({defaultPort:443,protocol:\"https:\"})}class IncomingMessage extends Readable{method;complete;constructor(req,defaultIncomingOpts2){const method=req.method;super();const url=new URL(req.url);var{type=\"request\",[kInternalRequest]:nodeReq}=defaultIncomingOpts2||{};this.#noBody=type===\"request\"\?method===\"GET\"||method===\"HEAD\"||method===\"TRACE\"||method===\"CONNECT\"||method===\"OPTIONS\"||(parseInt(req.headers.get(\"Content-Length\")||\"\")||0)===0:!1,this.#req=req,this.method=method,this.#type=type,this.complete=!!this.#noBody,this.#bodyStream=void 0;const socket=new FakeSocket;socket.remoteAddress=url.hostname,socket.remotePort=url.port,this.#fakeSocket=socket,this.url=url.pathname+url.search,this.#nodeReq=nodeReq,assignHeaders(this,req)}headers;rawHeaders;_consuming=!1;_dumped=!1;#bodyStream;#fakeSocket;#noBody=!1;#aborted=!1;#req;url;#type;#nodeReq;get req(){return this.#nodeReq}_construct(callback){if(this.#type===\"response\"||this.#noBody){callback();return}const contentLength=this.#req.headers.get(\"content-length\");if((contentLength\?parseInt(contentLength,10):0)===0){this.#noBody=!0,callback();return}callback()}async#consumeStream(reader){while(!0){var{done,value}=await reader.readMany();if(this.#aborted)return;if(done){this.push(null),this.destroy();break}for(var v of value)this.push(v)}}_read(size){if(this.#noBody)this.push(null),this.complete=!0;else if(this.#bodyStream==null){const reader=this.#req.body\?.getReader();if(!reader){this.push(null);return}this.#bodyStream=reader,this.#consumeStream(reader)}}get aborted(){return this.#aborted}#abort(){if(this.#aborted)return;this.#aborted=!0;var bodyStream=this.#bodyStream;if(!bodyStream)return;bodyStream.cancel(),this.complete=!0,this.#bodyStream=void 0,this.push(null)}get connection(){return this.#fakeSocket}get statusCode(){return this.#req.status}get statusMessage(){return STATUS_CODES[this.#req.status]}get httpVersion(){return\"1.1\"}get rawTrailers(){return[]}get httpVersionMajor(){return 1}get httpVersionMinor(){return 1}get trailers(){return kEmptyObject}get socket(){return this.#fakeSocket\?\?=new FakeSocket}set socket(val){this.#fakeSocket=val}setTimeout(msecs,callback){throw new Error(\"not implemented\")}}function emitErrorNt(msg,err,callback){if(callback(err),typeof msg.emit===\"function\"&&!msg._closed)msg.emit(\"error\",err)}function onError(self,err,cb){process.nextTick(()=>emitErrorNt(self,err,cb))}function write_(msg,chunk,encoding,callback,fromEnd){if(typeof callback!==\"function\")callback=nop;let len;if(chunk===null)throw new Error(\"ERR_STREAM_NULL_VALUES\");else if(typeof chunk===\"string\")len=Buffer.byteLength(chunk,encoding);else throw new Error(\"Invalid arg type for chunk\");let err;if(msg.finished)err=new Error(\"ERR_STREAM_WRITE_AFTER_END\");else if(msg.destroyed)err=new Error(\"ERR_STREAM_DESTROYED\");if(err){if(!msg.destroyed)onError(msg,err,callback);else process.nextTick(callback,err);return!1}if(!msg._header){if(fromEnd)msg._contentLength=len}if(!msg._hasBody)return process.nextTick(callback),!0;return!0}class OutgoingMessage extends Writable{constructor(){super(...arguments)}#headers;headersSent=!1;sendDate=!0;req;timeout;#finished=!1;[kEndCalled]=!1;#fakeSocket;#timeoutTimer;[kAbortController]=null;_implicitHeader(){}get headers(){if(!this.#headers)return kEmptyObject;return this.#headers.toJSON()}get shouldKeepAlive(){return!0}get chunkedEncoding(){return!1}set chunkedEncoding(value){}set shouldKeepAlive(value){}get useChunkedEncodingByDefault(){return!0}set useChunkedEncodingByDefault(value){}get socket(){return this.#fakeSocket\?\?=new FakeSocket}set socket(val){this.#fakeSocket=val}get connection(){return this.socket}get finished(){return this.#finished}appendHeader(name,value){var headers=this.#headers\?\?=new Headers;headers.append(name,value)}flushHeaders(){}getHeader(name){return getHeader(this.#headers,name)}getHeaders(){if(!this.#headers)return kEmptyObject;return this.#headers.toJSON()}getHeaderNames(){var headers=this.#headers;if(!headers)return[];return Array.from(headers.keys())}removeHeader(name){if(!this.#headers)return;this.#headers.delete(name)}setHeader(name,value){var headers=this.#headers\?\?=new Headers;return headers.set(name,value),this}hasHeader(name){if(!this.#headers)return!1;return this.#headers.has(name)}addTrailers(headers){throw new Error(\"not implemented\")}[kClearTimeout](){if(this.#timeoutTimer)clearTimeout(this.#timeoutTimer),this.removeAllListeners(\"timeout\"),this.#timeoutTimer=void 0}#onTimeout(){this.#timeoutTimer=void 0,this[kAbortController]\?.abort(),this.emit(\"timeout\")}setTimeout(msecs,callback){if(this.destroyed)return this;if(this.timeout=msecs=validateMsecs(msecs,\"msecs\"),clearTimeout(this.#timeoutTimer),msecs===0){if(callback!==void 0)validateFunction(callback,\"callback\"),this.removeListener(\"timeout\",callback);this.#timeoutTimer=void 0}else if(this.#timeoutTimer=setTimeout(this.#onTimeout.bind(this),msecs).unref(),callback!==void 0)validateFunction(callback,\"callback\"),this.once(\"timeout\",callback);return this}}let OriginalWriteHeadFn,OriginalImplicitHeadFn;class ServerResponse extends Writable{constructor({req,reply}){super();if(this.req=req,this._reply=reply,this.sendDate=!0,this.statusCode=200,this.headersSent=!1,this.statusMessage=void 0,this.#controller=void 0,this.#firstWrite=void 0,this._writableState.decodeStrings=!1,this.#deferred=void 0,req.method===\"HEAD\")this._hasBody=!1}req;_reply;sendDate;statusCode;#headers;headersSent=!1;statusMessage;#controller;#firstWrite;_sent100=!1;_defaultKeepAlive=!1;_removedConnection=!1;_removedContLen=!1;_hasBody=!0;#deferred=void 0;#finished=!1;_implicitHeader(){this.writeHead(this.statusCode)}_write(chunk,encoding,callback){if(!this.#firstWrite&&!this.headersSent){this.#firstWrite=chunk,callback();return}this.#ensureReadableStreamController((controller)=>{controller.write(chunk),callback()})}_writev(chunks,callback){if(chunks.length===1&&!this.headersSent&&!this.#firstWrite){this.#firstWrite=chunks[0].chunk,callback();return}this.#ensureReadableStreamController((controller)=>{for(let chunk of chunks)controller.write(chunk.chunk);callback()})}#ensureReadableStreamController(run){var thisController=this.#controller;if(thisController)return run(thisController);this.headersSent=!0;var firstWrite=this.#firstWrite;this.#firstWrite=void 0,this._reply(new Response(new ReadableStream({type:\"direct\",pull:(controller)=>{if(this.#controller=controller,firstWrite)controller.write(firstWrite);if(firstWrite=void 0,run(controller),!this.#finished)return new Promise((resolve)=>{this.#deferred=resolve})}}),{headers:this.#headers,status:this.statusCode,statusText:this.statusMessage\?\?STATUS_CODES[this.statusCode]}))}#drainHeadersIfObservable(){if(this._implicitHeader===OriginalImplicitHeadFn&&this.writeHead===OriginalWriteHeadFn)return;this._implicitHeader()}_final(callback){if(!this.headersSent){var data=this.#firstWrite||\"\";this.#firstWrite=void 0,this.#finished=!0,this.#drainHeadersIfObservable(),this._reply(new Response(data,{headers:this.#headers,status:this.statusCode,statusText:this.statusMessage\?\?STATUS_CODES[this.statusCode]})),callback&&callback();return}this.#finished=!0,this.#ensureReadableStreamController((controller)=>{controller.end(),callback();var deferred=this.#deferred;if(deferred)this.#deferred=void 0,deferred()})}writeProcessing(){throw new Error(\"not implemented\")}addTrailers(headers){throw new Error(\"not implemented\")}assignSocket(socket){throw new Error(\"not implemented\")}detachSocket(socket){throw new Error(\"not implemented\")}writeContinue(callback){throw new Error(\"not implemented\")}setTimeout(msecs,callback){throw new Error(\"not implemented\")}get shouldKeepAlive(){return!0}get chunkedEncoding(){return!1}set chunkedEncoding(value){}set shouldKeepAlive(value){}get useChunkedEncodingByDefault(){return!0}set useChunkedEncodingByDefault(value){}appendHeader(name,value){var headers=this.#headers\?\?=new Headers;headers.append(name,value)}flushHeaders(){}getHeader(name){return getHeader(this.#headers,name)}getHeaders(){var headers=this.#headers;if(!headers)return kEmptyObject;return headers.toJSON()}getHeaderNames(){var headers=this.#headers;if(!headers)return[];return Array.from(headers.keys())}removeHeader(name){if(!this.#headers)return;this.#headers.delete(name)}setHeader(name,value){var headers=this.#headers\?\?=new Headers;return headers.set(name,value),this}hasHeader(name){if(!this.#headers)return!1;return this.#headers.has(name)}writeHead(statusCode,statusMessage,headers){return _writeHead(statusCode,statusMessage,headers,this),this}}OriginalWriteHeadFn=ServerResponse.prototype.writeHead,OriginalImplicitHeadFn=ServerResponse.prototype._implicitHeader;class ClientRequest extends OutgoingMessage{#timeout;#res=null;#upgradeOrConnect=!1;#parser=null;#maxHeadersCount=null;#reusedSocket=!1;#host;#protocol;#method;#port;#useDefaultPort;#joinDuplicateHeaders;#maxHeaderSize;#agent=globalAgent;#path;#socketPath;#bodyChunks=null;#fetchRequest;#signal=null;[kAbortController]=null;#timeoutTimer=void 0;#options;#finished;get path(){return this.#path}get port(){return this.#port}get method(){return this.#method}get host(){return this.#host}get protocol(){return this.#protocol}_write(chunk,encoding,callback){if(!this.#bodyChunks){this.#bodyChunks=[chunk],callback();return}this.#bodyChunks.push(chunk),callback()}_writev(chunks,callback){if(!this.#bodyChunks){this.#bodyChunks=chunks,callback();return}this.#bodyChunks.push(...chunks),callback()}_final(callback){if(this.#finished=!0,this[kAbortController]=new AbortController,this[kAbortController].signal.addEventListener(\"abort\",()=>{this[kClearTimeout]()}),this.#signal\?.aborted)this[kAbortController].abort();var method=this.#method,body=this.#bodyChunks\?.length===1\?this.#bodyChunks[0]:Buffer.concat(this.#bodyChunks||[]);try{this.#fetchRequest=fetch(`${this.#protocol}//${this.#host}${this.#useDefaultPort\?\"\":\":\"+this.#port}${this.#path}`,{method,headers:this.getHeaders(),body:body&&method!==\"GET\"&&method!==\"HEAD\"&&method!==\"OPTIONS\"\?body:void 0,redirect:\"manual\",verbose:!1,signal:this[kAbortController].signal,timeout:!1}).then((response)=>{var res=this.#res=new IncomingMessage(response,{type:\"response\",[kInternalRequest]:this});this.emit(\"response\",res)}).catch((err)=>{this.emit(\"error\",err)}).finally(()=>{this.#fetchRequest=null,this[kClearTimeout]()})}catch(err){this.emit(\"error\",err)}finally{callback()}}get aborted(){return this.#signal\?.aborted||!!this[kAbortController]\?.signal.aborted}abort(){if(this.aborted)return;this[kAbortController].abort()}constructor(input,options,cb){super();if(typeof input===\"string\"){const urlStr=input;try{var urlObject=new URL(urlStr)}catch(e){@throwTypeError(`Invalid URL: ${urlStr}`)}input=urlToHttpOptions(urlObject)}else if(input&&typeof input===\"object\"&&input instanceof URL)input=urlToHttpOptions(input);else cb=options,options=input,input=null;if(typeof options===\"function\")cb=options,options=input||kEmptyObject;else options=ObjectAssign(input||{},options);var defaultAgent=options._defaultAgent||Agent.globalAgent;let protocol=options.protocol;if(!protocol)if(options.port===443)protocol=\"https:\";else protocol=defaultAgent.protocol||\"http:\";switch(this.#protocol=protocol,this.#agent\?.protocol){case void 0:break;case\"http:\":if(protocol===\"https:\"){defaultAgent=this.#agent=getDefaultHTTPSAgent();break}case\"https:\":if(protocol===\"https\"){defaultAgent=this.#agent=Agent.globalAgent;break}default:break}if(options.path){const path=String(options.path);if(RegExpPrototypeExec.call(INVALID_PATH_REGEX,path)!==null)throw new Error(\"Path contains unescaped characters\")}if(protocol!==\"http:\"&&protocol!==\"https:\"&&protocol){const expectedProtocol=defaultAgent\?.protocol\?\?\"http:\";throw new Error(`Protocol mismatch. Expected: ${expectedProtocol}. Got: ${protocol}`)}const defaultPort=protocol===\"https:\"\?443:80;this.#port=options.port||options.defaultPort||this.#agent\?.defaultPort||defaultPort,this.#useDefaultPort=this.#port===defaultPort;const host=this.#host=options.host=validateHost(options.hostname,\"hostname\")||validateHost(options.host,\"host\")||\"localhost\";this.#socketPath=options.socketPath;const signal=options.signal;if(signal)signal.addEventListener(\"abort\",()=>{this[kAbortController]\?.abort()}),this.#signal=signal;let method=options.method;const methodIsString=typeof method===\"string\";if(method!==null&&method!==void 0&&!methodIsString)throw new Error(\"ERR_INVALID_ARG_TYPE: options.method\");if(methodIsString&&method){if(!checkIsHttpToken(method))throw new Error(\"ERR_INVALID_HTTP_TOKEN: Method\");method=this.#method=StringPrototypeToUpperCase.call(method)}else method=this.#method=\"GET\";const _maxHeaderSize=options.maxHeaderSize;this.#maxHeaderSize=_maxHeaderSize;var _joinDuplicateHeaders=options.joinDuplicateHeaders;if(this.#joinDuplicateHeaders=_joinDuplicateHeaders,this.#path=options.path||\"/\",cb)this.once(\"response\",cb);this.#finished=!1,this.#res=null,this.#upgradeOrConnect=!1,this.#parser=null,this.#maxHeadersCount=null,this.#reusedSocket=!1,this.#host=host,this.#protocol=protocol;var timeout=options.timeout;if(timeout!==void 0&&timeout!==0)this.setTimeout(timeout,void 0);if(!ArrayIsArray(headers)){var headers=options.headers;if(headers)for(let key in headers)this.setHeader(key,headers[key]);var auth=options.auth;if(auth&&!this.getHeader(\"Authorization\"))this.setHeader(\"Authorization\",\"Basic \"+Buffer.from(auth).toString(\"base64\"))}var{signal:_signal,...optsWithoutSignal}=options;this.#options=optsWithoutSignal}setSocketKeepAlive(enable=!0,initialDelay=0){}setNoDelay(noDelay=!0){}[kClearTimeout](){if(this.#timeoutTimer)clearTimeout(this.#timeoutTimer),this.#timeoutTimer=void 0,this.removeAllListeners(\"timeout\")}#onTimeout(){this.#timeoutTimer=void 0,this[kAbortController]\?.abort(),this.emit(\"timeout\")}setTimeout(msecs,callback){if(this.destroyed)return this;if(this.timeout=msecs=validateMsecs(msecs,\"msecs\"),clearTimeout(this.#timeoutTimer),msecs===0){if(callback!==void 0)validateFunction(callback,\"callback\"),this.removeListener(\"timeout\",callback);this.#timeoutTimer=void 0}else if(this.#timeoutTimer=setTimeout(this.#onTimeout.bind(this),msecs).unref(),callback!==void 0)validateFunction(callback,\"callback\"),this.once(\"timeout\",callback);return this}}function urlToHttpOptions(url){var{protocol,hostname,hash,search,pathname,href,port,username,password}=url;return{protocol,hostname:typeof hostname===\"string\"&&StringPrototypeStartsWith.call(hostname,\"[\")\?StringPrototypeSlice.call(hostname,1,-1):hostname,hash,search,pathname,path:`${pathname||\"\"}${search||\"\"}`,href,port:port\?Number(port):protocol===\"https:\"\?443:protocol===\"http:\"\?80:void 0,auth:username||password\?`${decodeURIComponent(username)}:${decodeURIComponent(password)}`:void 0}}function validateHost(host,name){if(host!==null&&host!==void 0&&typeof host!==\"string\")throw new Error(\"Invalid arg type in options\");return host}const tokenRegExp=/^[\\^_`a-zA-Z\\-0-9!#$%&'*+.|~]+$/;function checkIsHttpToken(val){return RegExpPrototypeExec.call(tokenRegExp,val)!==null}const METHODS=[\"ACL\",\"BIND\",\"CHECKOUT\",\"CONNECT\",\"COPY\",\"DELETE\",\"GET\",\"HEAD\",\"LINK\",\"LOCK\",\"M-SEARCH\",\"MERGE\",\"MKACTIVITY\",\"MKCALENDAR\",\"MKCOL\",\"MOVE\",\"NOTIFY\",\"OPTIONS\",\"PATCH\",\"POST\",\"PROPFIND\",\"PROPPATCH\",\"PURGE\",\"PUT\",\"REBIND\",\"REPORT\",\"SEARCH\",\"SOURCE\",\"SUBSCRIBE\",\"TRACE\",\"UNBIND\",\"UNLINK\",\"UNLOCK\",\"UNSUBSCRIBE\"],STATUS_CODES={100:\"Continue\",101:\"Switching Protocols\",102:\"Processing\",103:\"Early Hints\",200:\"OK\",201:\"Created\",202:\"Accepted\",203:\"Non-Authoritative Information\",204:\"No Content\",205:\"Reset Content\",206:\"Partial Content\",207:\"Multi-Status\",208:\"Already Reported\",226:\"IM Used\",300:\"Multiple Choices\",301:\"Moved Permanently\",302:\"Found\",303:\"See Other\",304:\"Not Modified\",305:\"Use Proxy\",307:\"Temporary Redirect\",308:\"Permanent Redirect\",400:\"Bad Request\",401:\"Unauthorized\",402:\"Payment Required\",403:\"Forbidden\",404:\"Not Found\",405:\"Method Not Allowed\",406:\"Not Acceptable\",407:\"Proxy Authentication Required\",408:\"Request Timeout\",409:\"Conflict\",410:\"Gone\",411:\"Length Required\",412:\"Precondition Failed\",413:\"Payload Too Large\",414:\"URI Too Long\",415:\"Unsupported Media Type\",416:\"Range Not Satisfiable\",417:\"Expectation Failed\",418:\"I'm a Teapot\",421:\"Misdirected Request\",422:\"Unprocessable Entity\",423:\"Locked\",424:\"Failed Dependency\",425:\"Too Early\",426:\"Upgrade Required\",428:\"Precondition Required\",429:\"Too Many Requests\",431:\"Request Header Fields Too Large\",451:\"Unavailable For Legal Reasons\",500:\"Internal Server Error\",501:\"Not Implemented\",502:\"Bad Gateway\",503:\"Service Unavailable\",504:\"Gateway Timeout\",505:\"HTTP Version Not Supported\",506:\"Variant Also Negotiates\",507:\"Insufficient Storage\",508:\"Loop Detected\",509:\"Bandwidth Limit Exceeded\",510:\"Not Extended\",511:\"Network Authentication Required\"};function _normalizeArgs(args){let arr;if(args.length===0)return arr=[{},null],arr;const arg0=args[0];let options={};if(typeof arg0===\"object\"&&arg0!==null)options=arg0;else if(options.port=arg0,args.length>1&&typeof args[1]===\"string\")options.host=args[1];const cb=args[args.length-1];if(typeof cb!==\"function\")arr=[options,null];else arr=[options,cb];return arr}function _writeHead(statusCode,reason,obj,response){if(statusCode|=0,statusCode<100||statusCode>999)throw new Error(\"status code must be between 100 and 999\");if(typeof reason===\"string\")response.statusMessage=reason;else{if(!response.statusMessage)response.statusMessage=STATUS_CODES[statusCode]||\"unknown\";obj=reason}response.statusCode=statusCode;{let k;if(Array.isArray(obj)){if(obj.length%2!==0)throw new Error(\"raw headers must have an even number of elements\");for(let n=0;n<obj.length;n+=2)if(k=obj[n+0],k)response.setHeader(k,obj[n+1])}else if(obj){const keys=Object.keys(obj);for(let i=0;i<keys.length;i++)if(k=keys[i],k)response.setHeader(k,obj[k])}}if(statusCode===204||statusCode===304||statusCode>=100&&statusCode<=199)response._hasBody=!1}function request(url,options,cb){return new ClientRequest(url,options,cb)}function get(url,options,cb){const req=request(url,options,cb);return req.end(),req}var globalAgent=new Agent;return $={Agent,Server,METHODS,STATUS_CODES,createServer,ServerResponse,IncomingMessage,request,get,maxHeaderSize:16384,validateHeaderName,validateHeaderValue,setMaxIdleHTTPParsers(max){},globalAgent,ClientRequest,OutgoingMessage},$})\n"_s; static constexpr ASCIILiteral NodeHttp2Code = "(function (){\"use strict\";var $;const{hideFromStack,throwNotImplemented}=@getInternalField(@internalModuleRegistry,2)||@createInternalModuleById(2);function connect(){throwNotImplemented(\"node:http2 connect\",887)}const constants={NGHTTP2_ERR_FRAME_SIZE_ERROR:-522,NGHTTP2_SESSION_SERVER:0,NGHTTP2_SESSION_CLIENT:1,NGHTTP2_STREAM_STATE_IDLE:1,NGHTTP2_STREAM_STATE_OPEN:2,NGHTTP2_STREAM_STATE_RESERVED_LOCAL:3,NGHTTP2_STREAM_STATE_RESERVED_REMOTE:4,NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL:5,NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE:6,NGHTTP2_STREAM_STATE_CLOSED:7,NGHTTP2_FLAG_NONE:0,NGHTTP2_FLAG_END_STREAM:1,NGHTTP2_FLAG_END_HEADERS:4,NGHTTP2_FLAG_ACK:1,NGHTTP2_FLAG_PADDED:8,NGHTTP2_FLAG_PRIORITY:32,DEFAULT_SETTINGS_HEADER_TABLE_SIZE:4096,DEFAULT_SETTINGS_ENABLE_PUSH:1,DEFAULT_SETTINGS_MAX_CONCURRENT_STREAMS:4294967295,DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE:65535,DEFAULT_SETTINGS_MAX_FRAME_SIZE:16384,DEFAULT_SETTINGS_MAX_HEADER_LIST_SIZE:65535,DEFAULT_SETTINGS_ENABLE_CONNECT_PROTOCOL:0,MAX_MAX_FRAME_SIZE:16777215,MIN_MAX_FRAME_SIZE:16384,MAX_INITIAL_WINDOW_SIZE:2147483647,NGHTTP2_SETTINGS_HEADER_TABLE_SIZE:1,NGHTTP2_SETTINGS_ENABLE_PUSH:2,NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS:3,NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE:4,NGHTTP2_SETTINGS_MAX_FRAME_SIZE:5,NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE:6,NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:8,PADDING_STRATEGY_NONE:0,PADDING_STRATEGY_ALIGNED:1,PADDING_STRATEGY_MAX:2,PADDING_STRATEGY_CALLBACK:1,NGHTTP2_NO_ERROR:0,NGHTTP2_PROTOCOL_ERROR:1,NGHTTP2_INTERNAL_ERROR:2,NGHTTP2_FLOW_CONTROL_ERROR:3,NGHTTP2_SETTINGS_TIMEOUT:4,NGHTTP2_STREAM_CLOSED:5,NGHTTP2_FRAME_SIZE_ERROR:6,NGHTTP2_REFUSED_STREAM:7,NGHTTP2_CANCEL:8,NGHTTP2_COMPRESSION_ERROR:9,NGHTTP2_CONNECT_ERROR:10,NGHTTP2_ENHANCE_YOUR_CALM:11,NGHTTP2_INADEQUATE_SECURITY:12,NGHTTP2_HTTP_1_1_REQUIRED:13,NGHTTP2_DEFAULT_WEIGHT:16,HTTP2_HEADER_STATUS:\":status\",HTTP2_HEADER_METHOD:\":method\",HTTP2_HEADER_AUTHORITY:\":authority\",HTTP2_HEADER_SCHEME:\":scheme\",HTTP2_HEADER_PATH:\":path\",HTTP2_HEADER_PROTOCOL:\":protocol\",HTTP2_HEADER_ACCEPT_ENCODING:\"accept-encoding\",HTTP2_HEADER_ACCEPT_LANGUAGE:\"accept-language\",HTTP2_HEADER_ACCEPT_RANGES:\"accept-ranges\",HTTP2_HEADER_ACCEPT:\"accept\",HTTP2_HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS:\"access-control-allow-credentials\",HTTP2_HEADER_ACCESS_CONTROL_ALLOW_HEADERS:\"access-control-allow-headers\",HTTP2_HEADER_ACCESS_CONTROL_ALLOW_METHODS:\"access-control-allow-methods\",HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN:\"access-control-allow-origin\",HTTP2_HEADER_ACCESS_CONTROL_EXPOSE_HEADERS:\"access-control-expose-headers\",HTTP2_HEADER_ACCESS_CONTROL_REQUEST_HEADERS:\"access-control-request-headers\",HTTP2_HEADER_ACCESS_CONTROL_REQUEST_METHOD:\"access-control-request-method\",HTTP2_HEADER_AGE:\"age\",HTTP2_HEADER_AUTHORIZATION:\"authorization\",HTTP2_HEADER_CACHE_CONTROL:\"cache-control\",HTTP2_HEADER_CONNECTION:\"connection\",HTTP2_HEADER_CONTENT_DISPOSITION:\"content-disposition\",HTTP2_HEADER_CONTENT_ENCODING:\"content-encoding\",HTTP2_HEADER_CONTENT_LENGTH:\"content-length\",HTTP2_HEADER_CONTENT_TYPE:\"content-type\",HTTP2_HEADER_COOKIE:\"cookie\",HTTP2_HEADER_DATE:\"date\",HTTP2_HEADER_ETAG:\"etag\",HTTP2_HEADER_FORWARDED:\"forwarded\",HTTP2_HEADER_HOST:\"host\",HTTP2_HEADER_IF_MODIFIED_SINCE:\"if-modified-since\",HTTP2_HEADER_IF_NONE_MATCH:\"if-none-match\",HTTP2_HEADER_IF_RANGE:\"if-range\",HTTP2_HEADER_LAST_MODIFIED:\"last-modified\",HTTP2_HEADER_LINK:\"link\",HTTP2_HEADER_LOCATION:\"location\",HTTP2_HEADER_RANGE:\"range\",HTTP2_HEADER_REFERER:\"referer\",HTTP2_HEADER_SERVER:\"server\",HTTP2_HEADER_SET_COOKIE:\"set-cookie\",HTTP2_HEADER_STRICT_TRANSPORT_SECURITY:\"strict-transport-security\",HTTP2_HEADER_TRANSFER_ENCODING:\"transfer-encoding\",HTTP2_HEADER_TE:\"te\",HTTP2_HEADER_UPGRADE_INSECURE_REQUESTS:\"upgrade-insecure-requests\",HTTP2_HEADER_UPGRADE:\"upgrade\",HTTP2_HEADER_USER_AGENT:\"user-agent\",HTTP2_HEADER_VARY:\"vary\",HTTP2_HEADER_X_CONTENT_TYPE_OPTIONS:\"x-content-type-options\",HTTP2_HEADER_X_FRAME_OPTIONS:\"x-frame-options\",HTTP2_HEADER_KEEP_ALIVE:\"keep-alive\",HTTP2_HEADER_PROXY_CONNECTION:\"proxy-connection\",HTTP2_HEADER_X_XSS_PROTECTION:\"x-xss-protection\",HTTP2_HEADER_ALT_SVC:\"alt-svc\",HTTP2_HEADER_CONTENT_SECURITY_POLICY:\"content-security-policy\",HTTP2_HEADER_EARLY_DATA:\"early-data\",HTTP2_HEADER_EXPECT_CT:\"expect-ct\",HTTP2_HEADER_ORIGIN:\"origin\",HTTP2_HEADER_PURPOSE:\"purpose\",HTTP2_HEADER_TIMING_ALLOW_ORIGIN:\"timing-allow-origin\",HTTP2_HEADER_X_FORWARDED_FOR:\"x-forwarded-for\",HTTP2_HEADER_PRIORITY:\"priority\",HTTP2_HEADER_ACCEPT_CHARSET:\"accept-charset\",HTTP2_HEADER_ACCESS_CONTROL_MAX_AGE:\"access-control-max-age\",HTTP2_HEADER_ALLOW:\"allow\",HTTP2_HEADER_CONTENT_LANGUAGE:\"content-language\",HTTP2_HEADER_CONTENT_LOCATION:\"content-location\",HTTP2_HEADER_CONTENT_MD5:\"content-md5\",HTTP2_HEADER_CONTENT_RANGE:\"content-range\",HTTP2_HEADER_DNT:\"dnt\",HTTP2_HEADER_EXPECT:\"expect\",HTTP2_HEADER_EXPIRES:\"expires\",HTTP2_HEADER_FROM:\"from\",HTTP2_HEADER_IF_MATCH:\"if-match\",HTTP2_HEADER_IF_UNMODIFIED_SINCE:\"if-unmodified-since\",HTTP2_HEADER_MAX_FORWARDS:\"max-forwards\",HTTP2_HEADER_PREFER:\"prefer\",HTTP2_HEADER_PROXY_AUTHENTICATE:\"proxy-authenticate\",HTTP2_HEADER_PROXY_AUTHORIZATION:\"proxy-authorization\",HTTP2_HEADER_REFRESH:\"refresh\",HTTP2_HEADER_RETRY_AFTER:\"retry-after\",HTTP2_HEADER_TRAILER:\"trailer\",HTTP2_HEADER_TK:\"tk\",HTTP2_HEADER_VIA:\"via\",HTTP2_HEADER_WARNING:\"warning\",HTTP2_HEADER_WWW_AUTHENTICATE:\"www-authenticate\",HTTP2_HEADER_HTTP2_SETTINGS:\"http2-settings\",HTTP2_METHOD_ACL:\"ACL\",HTTP2_METHOD_BASELINE_CONTROL:\"BASELINE-CONTROL\",HTTP2_METHOD_BIND:\"BIND\",HTTP2_METHOD_CHECKIN:\"CHECKIN\",HTTP2_METHOD_CHECKOUT:\"CHECKOUT\",HTTP2_METHOD_CONNECT:\"CONNECT\",HTTP2_METHOD_COPY:\"COPY\",HTTP2_METHOD_DELETE:\"DELETE\",HTTP2_METHOD_GET:\"GET\",HTTP2_METHOD_HEAD:\"HEAD\",HTTP2_METHOD_LABEL:\"LABEL\",HTTP2_METHOD_LINK:\"LINK\",HTTP2_METHOD_LOCK:\"LOCK\",HTTP2_METHOD_MERGE:\"MERGE\",HTTP2_METHOD_MKACTIVITY:\"MKACTIVITY\",HTTP2_METHOD_MKCALENDAR:\"MKCALENDAR\",HTTP2_METHOD_MKCOL:\"MKCOL\",HTTP2_METHOD_MKREDIRECTREF:\"MKREDIRECTREF\",HTTP2_METHOD_MKWORKSPACE:\"MKWORKSPACE\",HTTP2_METHOD_MOVE:\"MOVE\",HTTP2_METHOD_OPTIONS:\"OPTIONS\",HTTP2_METHOD_ORDERPATCH:\"ORDERPATCH\",HTTP2_METHOD_PATCH:\"PATCH\",HTTP2_METHOD_POST:\"POST\",HTTP2_METHOD_PRI:\"PRI\",HTTP2_METHOD_PROPFIND:\"PROPFIND\",HTTP2_METHOD_PROPPATCH:\"PROPPATCH\",HTTP2_METHOD_PUT:\"PUT\",HTTP2_METHOD_REBIND:\"REBIND\",HTTP2_METHOD_REPORT:\"REPORT\",HTTP2_METHOD_SEARCH:\"SEARCH\",HTTP2_METHOD_TRACE:\"TRACE\",HTTP2_METHOD_UNBIND:\"UNBIND\",HTTP2_METHOD_UNCHECKOUT:\"UNCHECKOUT\",HTTP2_METHOD_UNLINK:\"UNLINK\",HTTP2_METHOD_UNLOCK:\"UNLOCK\",HTTP2_METHOD_UPDATE:\"UPDATE\",HTTP2_METHOD_UPDATEREDIRECTREF:\"UPDATEREDIRECTREF\",HTTP2_METHOD_VERSION_CONTROL:\"VERSION-CONTROL\",HTTP_STATUS_CONTINUE:100,HTTP_STATUS_SWITCHING_PROTOCOLS:101,HTTP_STATUS_PROCESSING:102,HTTP_STATUS_EARLY_HINTS:103,HTTP_STATUS_OK:200,HTTP_STATUS_CREATED:201,HTTP_STATUS_ACCEPTED:202,HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION:203,HTTP_STATUS_NO_CONTENT:204,HTTP_STATUS_RESET_CONTENT:205,HTTP_STATUS_PARTIAL_CONTENT:206,HTTP_STATUS_MULTI_STATUS:207,HTTP_STATUS_ALREADY_REPORTED:208,HTTP_STATUS_IM_USED:226,HTTP_STATUS_MULTIPLE_CHOICES:300,HTTP_STATUS_MOVED_PERMANENTLY:301,HTTP_STATUS_FOUND:302,HTTP_STATUS_SEE_OTHER:303,HTTP_STATUS_NOT_MODIFIED:304,HTTP_STATUS_USE_PROXY:305,HTTP_STATUS_TEMPORARY_REDIRECT:307,HTTP_STATUS_PERMANENT_REDIRECT:308,HTTP_STATUS_BAD_REQUEST:400,HTTP_STATUS_UNAUTHORIZED:401,HTTP_STATUS_PAYMENT_REQUIRED:402,HTTP_STATUS_FORBIDDEN:403,HTTP_STATUS_NOT_FOUND:404,HTTP_STATUS_METHOD_NOT_ALLOWED:405,HTTP_STATUS_NOT_ACCEPTABLE:406,HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED:407,HTTP_STATUS_REQUEST_TIMEOUT:408,HTTP_STATUS_CONFLICT:409,HTTP_STATUS_GONE:410,HTTP_STATUS_LENGTH_REQUIRED:411,HTTP_STATUS_PRECONDITION_FAILED:412,HTTP_STATUS_PAYLOAD_TOO_LARGE:413,HTTP_STATUS_URI_TOO_LONG:414,HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE:415,HTTP_STATUS_RANGE_NOT_SATISFIABLE:416,HTTP_STATUS_EXPECTATION_FAILED:417,HTTP_STATUS_TEAPOT:418,HTTP_STATUS_MISDIRECTED_REQUEST:421,HTTP_STATUS_UNPROCESSABLE_ENTITY:422,HTTP_STATUS_LOCKED:423,HTTP_STATUS_FAILED_DEPENDENCY:424,HTTP_STATUS_TOO_EARLY:425,HTTP_STATUS_UPGRADE_REQUIRED:426,HTTP_STATUS_PRECONDITION_REQUIRED:428,HTTP_STATUS_TOO_MANY_REQUESTS:429,HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE:431,HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS:451,HTTP_STATUS_INTERNAL_SERVER_ERROR:500,HTTP_STATUS_NOT_IMPLEMENTED:501,HTTP_STATUS_BAD_GATEWAY:502,HTTP_STATUS_SERVICE_UNAVAILABLE:503,HTTP_STATUS_GATEWAY_TIMEOUT:504,HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED:505,HTTP_STATUS_VARIANT_ALSO_NEGOTIATES:506,HTTP_STATUS_INSUFFICIENT_STORAGE:507,HTTP_STATUS_LOOP_DETECTED:508,HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED:509,HTTP_STATUS_NOT_EXTENDED:510,HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED:511};function createServer(){throwNotImplemented(\"node:http2 createServer\",887)}function createSecureServer(){throwNotImplemented(\"node:http2 createSecureServer\",887)}function getDefaultSettings(){return{headerTableSize:4096,enablePush:!0,initialWindowSize:65535,maxFrameSize:16384,maxConcurrentStreams:4294967295,maxHeaderSize:65535,maxHeaderListSize:65535,enableConnectProtocol:!1}}function getPackedSettings(){return Buffer.alloc(0)}function getUnpackedSettings(){return Buffer.alloc(0)}const sensitiveHeaders=Symbol.for(\"nodejs.http2.sensitiveHeaders\");function Http2ServerRequest(){throwNotImplemented(\"node:http2 Http2ServerRequest\",887)}function Http2ServerResponse(){throwNotImplemented(\"node:http2 Http2ServerResponse\",887)}return $={constants,createServer,createSecureServer,getDefaultSettings,getPackedSettings,getUnpackedSettings,sensitiveHeaders,Http2ServerRequest,Http2ServerResponse,connect},hideFromStack([Http2ServerRequest,Http2ServerResponse,connect,createServer,createSecureServer,getDefaultSettings,getPackedSettings,getUnpackedSettings]),$})\n"_s; static constexpr ASCIILiteral NodeHttpsCode = "(function (){\"use strict\";const http=@getInternalField(@internalModuleRegistry,18)||@createInternalModuleById(18);function request(input,options,cb){if(input&&typeof input===\"object\"&&!(input instanceof URL))input.protocol\?\?=\"https:\";else if(typeof options===\"object\")options.protocol\?\?=\"https:\";return http.request(input,options,cb)}function get(input,options,cb){const req=request(input,options,cb);return req.end(),req}return{...http,get,request}})\n"_s; static constexpr ASCIILiteral NodeInspectorCode = "(function (){\"use strict\";var $;const{hideFromStack,throwNotImplemented}=@getInternalField(@internalModuleRegistry,2)||@createInternalModuleById(2),EventEmitter=@getInternalField(@internalModuleRegistry,15)||@createInternalModuleById(15);function open(){throwNotImplemented(\"node:inspector open\",2445)}function close(){throwNotImplemented(\"node:inspector close\",2445)}function url(){throwNotImplemented(\"node:inspector url\",2445)}function waitForDebugger(){throwNotImplemented(\"node:inspector waitForDebugger\",2445)}class Session extends EventEmitter{constructor(){super();throwNotImplemented(\"node:inspector Session\",2445)}}return $={console:{...globalThis.console,context:{console:globalThis.console}},open,close,url,waitForDebugger,Session},hideFromStack(open,close,url,waitForDebugger,Session.prototype.constructor),$})\n"_s; @@ -137,7 +137,7 @@ static constexpr ASCIILiteral NodeDomainCode = "(function (){\"use strict\";var static constexpr ASCIILiteral NodeEventsCode = "(function (){\"use strict\";const{throwNotImplemented}=@getInternalField(@internalModuleRegistry,2)||@createInternalModuleById(2),SymbolFor=Symbol.for,kCapture=Symbol(\"kCapture\"),kErrorMonitor=SymbolFor(\"events.errorMonitor\"),kMaxEventTargetListeners=Symbol(\"events.maxEventTargetListeners\"),kMaxEventTargetListenersWarned=Symbol(\"events.maxEventTargetListenersWarned\"),kWatermarkData=SymbolFor(\"nodejs.watermarkData\"),kRejection=SymbolFor(\"nodejs.rejection\"),captureRejectionSymbol=SymbolFor(\"nodejs.rejection\"),ArrayPrototypeSlice=Array.prototype.slice;var defaultMaxListeners=10;const EventEmitter=function EventEmitter(opts){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners\?\?=void 0,this[kCapture]=opts\?.captureRejections\?Boolean(opts\?.captureRejections):EventEmitterPrototype[kCapture])this.emit=emitWithRejectionCapture},EventEmitterPrototype=EventEmitter.prototype={};EventEmitterPrototype._events=void 0,EventEmitterPrototype._eventsCount=0,EventEmitterPrototype._maxListeners=void 0,EventEmitterPrototype.setMaxListeners=function setMaxListeners(n){return validateNumber(n,\"setMaxListeners\",0),this._maxListeners=n,this},EventEmitterPrototype.getMaxListeners=function getMaxListeners(){return this._maxListeners\?\?defaultMaxListeners};function emitError(emitter,args){var{_events:events}=emitter;if(args[0]\?\?=new Error(\"Unhandled error.\"),!events)throw args[0];var errorMonitor=events[kErrorMonitor];if(errorMonitor)for(var handler of ArrayPrototypeSlice.call(errorMonitor))handler.apply(emitter,args);var handlers=events.error;if(!handlers)throw args[0];for(var handler of ArrayPrototypeSlice.call(handlers))handler.apply(emitter,args);return!0}function addCatch(emitter,promise,type,args){promise.then(void 0,function(err){process.nextTick(emitUnhandledRejectionOrErr,emitter,err,type,args)})}function emitUnhandledRejectionOrErr(emitter,err,type,args){if(typeof emitter[kRejection]===\"function\")emitter[kRejection](err,type,...args);else try{emitter[kCapture]=!1,emitter.emit(\"error\",err)}finally{emitter[kCapture]=!0}}const emitWithoutRejectionCapture=function emit(type,...args){if(type===\"error\")return emitError(this,args);var{_events:events}=this;if(events===void 0)return!1;var handlers=events[type];if(handlers===void 0)return!1;for(var handler of[...handlers])handler.apply(this,args);return!0},emitWithRejectionCapture=function emit(type,...args){if(type===\"error\")return emitError(this,args);var{_events:events}=this;if(events===void 0)return!1;var handlers=events[type];if(handlers===void 0)return!1;for(var handler of[...handlers]){var result=handler.apply(this,args);if(result!==void 0&&@isPromise(result))addCatch(this,result,type,args)}return!0};EventEmitterPrototype.emit=emitWithoutRejectionCapture,EventEmitterPrototype.addListener=function addListener(type,fn){checkListener(fn);var events=this._events;if(!events)events=this._events={__proto__:null},this._eventsCount=0;else if(events.newListener)this.emit(\"newListener\",type,fn.listener\?\?fn);var handlers=events[type];if(!handlers)events[type]=[fn],this._eventsCount++;else{handlers.push(fn);var m=this._maxListeners\?\?defaultMaxListeners;if(m>0&&handlers.length>m&&!handlers.warned)overflowWarning(this,type,handlers)}return this},EventEmitterPrototype.on=EventEmitterPrototype.addListener,EventEmitterPrototype.prependListener=function prependListener(type,fn){checkListener(fn);var events=this._events;if(!events)events=this._events={__proto__:null},this._eventsCount=0;else if(events.newListener)this.emit(\"newListener\",type,fn.listener\?\?fn);var handlers=events[type];if(!handlers)events[type]=[fn],this._eventsCount++;else{handlers.unshift(fn);var m=this._maxListeners\?\?defaultMaxListeners;if(m>0&&handlers.length>m&&!handlers.warned)overflowWarning(this,type,handlers)}return this};function overflowWarning(emitter,type,handlers){handlers.warned=!0;const warn=new Error(`Possible EventEmitter memory leak detected. ${handlers.length} ${String(type)} listeners `+`added to [${emitter.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);warn.name=\"MaxListenersExceededWarning\",warn.emitter=emitter,warn.type=type,warn.count=handlers.length,process.emitWarning(warn)}function onceWrapper(type,listener,...args){this.removeListener(type,listener),listener.apply(this,args)}EventEmitterPrototype.once=function once(type,fn){checkListener(fn);const bound=onceWrapper.bind(this,type,fn);return bound.listener=fn,this.addListener(type,bound),this},EventEmitterPrototype.prependOnceListener=function prependOnceListener(type,fn){checkListener(fn);const bound=onceWrapper.bind(this,type,fn);return bound.listener=fn,this.prependListener(type,bound),this},EventEmitterPrototype.removeListener=function removeListener(type,fn){checkListener(fn);var{_events:events}=this;if(!events)return this;var handlers=events[type];if(!handlers)return this;var length=handlers.length;let position=-1;for(let i=length-1;i>=0;i--)if(handlers[i]===fn||handlers[i].listener===fn){position=i;break}if(position<0)return this;if(position===0)handlers.shift();else handlers.splice(position,1);if(handlers.length===0)delete events[type],this._eventsCount--;return this},EventEmitterPrototype.off=EventEmitterPrototype.removeListener,EventEmitterPrototype.removeAllListeners=function removeAllListeners(type){var{_events:events}=this;if(type&&events){if(events[type])delete events[type],this._eventsCount--}else this._events={__proto__:null};return this},EventEmitterPrototype.listeners=function listeners(type){var{_events:events}=this;if(!events)return[];var handlers=events[type];if(!handlers)return[];return handlers.map((x)=>x.listener\?\?x)},EventEmitterPrototype.rawListeners=function rawListeners(type){var{_events}=this;if(!_events)return[];var handlers=_events[type];if(!handlers)return[];return handlers.slice()},EventEmitterPrototype.listenerCount=function listenerCount(type){var{_events:events}=this;if(!events)return 0;return events[type]\?.length\?\?0},EventEmitterPrototype.eventNames=function eventNames(){return this._eventsCount>0\?Reflect.ownKeys(this._events):[]},EventEmitterPrototype[kCapture]=!1;function once(emitter,type,options){var signal=options\?.signal;if(validateAbortSignal(signal,\"options.signal\"),signal\?.aborted)throw new AbortError(void 0,{cause:signal\?.reason});return new Promise((resolve,reject)=>{const errorListener=(err)=>{if(emitter.removeListener(type,resolver),signal!=null)eventTargetAgnosticRemoveListener(signal,\"abort\",abortListener);reject(err)},resolver=(...args)=>{if(typeof emitter.removeListener===\"function\")emitter.removeListener(\"error\",errorListener);if(signal!=null)eventTargetAgnosticRemoveListener(signal,\"abort\",abortListener);resolve(args)};if(eventTargetAgnosticAddListener(emitter,type,resolver,{once:!0}),type!==\"error\"&&typeof emitter.once===\"function\")emitter.once(\"error\",errorListener);function abortListener(){eventTargetAgnosticRemoveListener(emitter,type,resolver),eventTargetAgnosticRemoveListener(emitter,\"error\",errorListener),reject(new AbortError(void 0,{cause:signal\?.reason}))}if(signal!=null)eventTargetAgnosticAddListener(signal,\"abort\",abortListener,{once:!0})})}function on(emitter,type,options){var{signal,close,highWatermark=Number.MAX_SAFE_INTEGER,lowWatermark=1}=options||{};throwNotImplemented(\"events.on\",2679)}function getEventListeners(emitter,type){if(emitter instanceof EventTarget)throwNotImplemented(\"getEventListeners with an EventTarget\",2678);return emitter.listeners(type)}function setMaxListeners(n,...eventTargets){validateNumber(n,\"setMaxListeners\",0);var length;if(eventTargets&&(length=eventTargets.length))for(let i=0;i<length;i++)eventTargets[i].setMaxListeners(n);else defaultMaxListeners=n}function listenerCount(emitter,type){return emitter.listenerCount(type)}function eventTargetAgnosticRemoveListener(emitter,name,listener,flags){if(typeof emitter.removeListener===\"function\")emitter.removeListener(name,listener);else emitter.removeEventListener(name,listener,flags)}function eventTargetAgnosticAddListener(emitter,name,listener,flags){if(typeof emitter.on===\"function\")emitter.on(name,listener);else emitter.addEventListener(name,listener)}class AbortError extends Error{constructor(message=\"The operation was aborted\",options=void 0){if(options!==void 0&&typeof options!==\"object\")throw new codes.ERR_INVALID_ARG_TYPE(\"options\",\"Object\",options);super(message,options);this.code=\"ABORT_ERR\",this.name=\"AbortError\"}}function ERR_INVALID_ARG_TYPE(name,type,value){const err=@makeTypeError(`The \"${name}\" argument must be of type ${type}. Received ${value}`);return err.code=\"ERR_INVALID_ARG_TYPE\",err}function ERR_OUT_OF_RANGE(name,range,value){const err=new RangeError(`The \"${name}\" argument is out of range. It must be ${range}. Received ${value}`);return err.code=\"ERR_OUT_OF_RANGE\",err}function validateAbortSignal(signal,name){if(signal!==void 0&&(signal===null||typeof signal!==\"object\"||!(\"aborted\"in signal)))throw new ERR_INVALID_ARG_TYPE(name,\"AbortSignal\",signal)}function validateNumber(value,name,min=void 0,max){if(typeof value!==\"number\")throw new ERR_INVALID_ARG_TYPE(name,\"number\",value);if(min!=null&&value<min||max!=null&&value>max||(min!=null||max!=null)&&Number.isNaN(value))throw new ERR_OUT_OF_RANGE(name,`${min!=null\?`>= ${min}`:\"\"}${min!=null&&max!=null\?\" && \":\"\"}${max!=null\?`<= ${max}`:\"\"}`,value)}function checkListener(listener){if(typeof listener!==\"function\")@throwTypeError(\"The listener must be a function\")}let AsyncResource=null;class EventEmitterAsyncResource extends EventEmitter{triggerAsyncId;asyncResource;constructor(options){if(!AsyncResource)AsyncResource=(@getInternalField(@internalModuleRegistry,5)||@createInternalModuleById(5)).AsyncResource;var{captureRejections=!1,triggerAsyncId,name=new.target.name,requireManualDestroy}=options||{};super({captureRejections});this.triggerAsyncId=triggerAsyncId\?\?0,this.asyncResource=new AsyncResource(name,{triggerAsyncId,requireManualDestroy})}emit(...args){this.asyncResource.runInAsyncScope(()=>super.emit(...args))}emitDestroy(){this.asyncResource.emitDestroy()}}return Object.defineProperties(EventEmitter,{captureRejections:{get(){return EventEmitterPrototype[kCapture]},set(value){validateBoolean(value,\"EventEmitter.captureRejections\"),EventEmitterPrototype[kCapture]=value},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return defaultMaxListeners},set:(arg)=>{validateNumber(arg,\"defaultMaxListeners\",0),defaultMaxListeners=arg}},kMaxEventTargetListeners:{value:kMaxEventTargetListeners,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:kMaxEventTargetListenersWarned,enumerable:!1,configurable:!1,writable:!1}}),Object.assign(EventEmitter,{once,on,getEventListeners,setMaxListeners,EventEmitter,usingDomains:!1,captureRejectionSymbol,EventEmitterAsyncResource,errorMonitor:kErrorMonitor,setMaxListeners,init:EventEmitter,listenerCount}),EventEmitter})\n"_s; static constexpr ASCIILiteral NodeFSCode = "(function (){\"use strict\";var $,ReadStream,WriteStream;const EventEmitter=@getInternalField(@internalModuleRegistry,15)||@createInternalModuleById(15),promises=@getInternalField(@internalModuleRegistry,17)||@createInternalModuleById(17),Stream=@getInternalField(@internalModuleRegistry,34)||@createInternalModuleById(34);var fs=Bun.fs();class FSWatcher extends EventEmitter{#watcher;#listener;constructor(path,options,listener){super();if(typeof options===\"function\")listener=options,options={};else if(typeof options===\"string\")options={encoding:options};if(typeof listener!==\"function\")listener=()=>{};this.#listener=listener;try{this.#watcher=fs.watch(path,options||{},this.#onEvent.bind(this))}catch(e){if(!e.message\?.startsWith(\"FileNotFound\"))throw e;const notFound=new Error(`ENOENT: no such file or directory, watch '${path}'`);throw notFound.code=\"ENOENT\",notFound.errno=-2,notFound.path=path,notFound.syscall=\"watch\",notFound.filename=path,notFound}}#onEvent(eventType,filenameOrError){if(eventType===\"error\"||eventType===\"close\")this.emit(eventType,filenameOrError);else this.emit(\"change\",eventType,filenameOrError),this.#listener(eventType,filenameOrError)}close(){this.#watcher\?.close(),this.#watcher=null}ref(){this.#watcher\?.ref()}unref(){this.#watcher\?.unref()}}var access=function access(...args){callbackify(fs.accessSync,args)},appendFile=function appendFile(...args){callbackify(fs.appendFileSync,args)},close=function close(...args){callbackify(fs.closeSync,args)},rm=function rm(...args){callbackify(fs.rmSync,args)},rmdir=function rmdir(...args){callbackify(fs.rmdirSync,args)},copyFile=function copyFile(...args){callbackify(fs.copyFileSync,args)},exists=function exists(...args){callbackify(fs.existsSync,args)},chown=function chown(...args){callbackify(fs.chownSync,args)},chmod=function chmod(...args){callbackify(fs.chmodSync,args)},fchmod=function fchmod(...args){callbackify(fs.fchmodSync,args)},fchown=function fchown(...args){callbackify(fs.fchownSync,args)},fstat=function fstat(...args){callbackify(fs.fstatSync,args)},fsync=function fsync(...args){callbackify(fs.fsyncSync,args)},ftruncate=function ftruncate(...args){callbackify(fs.ftruncateSync,args)},futimes=function futimes(...args){callbackify(fs.futimesSync,args)},lchmod=function lchmod(...args){callbackify(fs.lchmodSync,args)},lchown=function lchown(...args){callbackify(fs.lchownSync,args)},link=function link(...args){callbackify(fs.linkSync,args)},mkdir=function mkdir(...args){callbackify(fs.mkdirSync,args)},mkdtemp=function mkdtemp(...args){callbackify(fs.mkdtempSync,args)},open=function open(...args){callbackify(fs.openSync,args)},read=function read(...args){callbackify(fs.readSync,args)},write=function write(...args){callbackify(fs.writeSync,args)},readdir=function readdir(...args){const callback=args[args.length-1];if(typeof callback!==\"function\")@throwTypeError(\"Callback must be a function\");fs.readdir(...args).then((result)=>callback(null,result),callback)},readFile=function readFile(...args){const callback=args[args.length-1];if(typeof callback!==\"function\")@throwTypeError(\"Callback must be a function\");fs.readFile(...args).then((result)=>callback(null,result),callback)},writeFile=function writeFile(...args){callbackify(fs.writeFileSync,args)},readlink=function readlink(...args){callbackify(fs.readlinkSync,args)},realpath=function realpath(...args){callbackify(fs.realpathSync,args)},rename=function rename(...args){callbackify(fs.renameSync,args)},lstat=function lstat(...args){const callback=args[args.length-1];if(typeof callback!==\"function\")@throwTypeError(\"Callback must be a function\");fs.lstat(...args).then((result)=>callback(null,result),callback)},stat=function stat(...args){const callback=args[args.length-1];if(typeof callback!==\"function\")@throwTypeError(\"Callback must be a function\");fs.stat(...args).then((result)=>callback(null,result),callback)},symlink=function symlink(...args){callbackify(fs.symlinkSync,args)},truncate=function truncate(...args){callbackify(fs.truncateSync,args)},unlink=function unlink(...args){callbackify(fs.unlinkSync,args)},utimes=function utimes(...args){callbackify(fs.utimesSync,args)},lutimes=function lutimes(...args){callbackify(fs.lutimesSync,args)},accessSync=fs.accessSync.bind(fs),appendFileSync=fs.appendFileSync.bind(fs),closeSync=fs.closeSync.bind(fs),copyFileSync=fs.copyFileSync.bind(fs),existsSync=fs.existsSync.bind(fs),chownSync=fs.chownSync.bind(fs),chmodSync=fs.chmodSync.bind(fs),fchmodSync=fs.fchmodSync.bind(fs),fchownSync=fs.fchownSync.bind(fs),fstatSync=fs.fstatSync.bind(fs),fsyncSync=fs.fsyncSync.bind(fs),ftruncateSync=fs.ftruncateSync.bind(fs),futimesSync=fs.futimesSync.bind(fs),lchmodSync=fs.lchmodSync.bind(fs),lchownSync=fs.lchownSync.bind(fs),linkSync=fs.linkSync.bind(fs),lstatSync=fs.lstatSync.bind(fs),mkdirSync=fs.mkdirSync.bind(fs),mkdtempSync=fs.mkdtempSync.bind(fs),openSync=fs.openSync.bind(fs),readSync=fs.readSync.bind(fs),writeSync=fs.writeSync.bind(fs),readdirSync=fs.readdirSync.bind(fs),readFileSync=fs.readFileSync.bind(fs),writeFileSync=fs.writeFileSync.bind(fs),readlinkSync=fs.readlinkSync.bind(fs),realpathSync=fs.realpathSync.bind(fs),renameSync=fs.renameSync.bind(fs),statSync=fs.statSync.bind(fs),symlinkSync=fs.symlinkSync.bind(fs),truncateSync=fs.truncateSync.bind(fs),unlinkSync=fs.unlinkSync.bind(fs),utimesSync=fs.utimesSync.bind(fs),lutimesSync=fs.lutimesSync.bind(fs),rmSync=fs.rmSync.bind(fs),rmdirSync=fs.rmdirSync.bind(fs),writev=(fd,buffers,position,callback)=>{if(typeof position===\"function\")callback=position,position=null;queueMicrotask(()=>{try{var written=fs.writevSync(fd,buffers,position)}catch(e){callback(e)}callback(null,written,buffers)})},writevSync=fs.writevSync.bind(fs),readv=(fd,buffers,position,callback)=>{if(typeof position===\"function\")callback=position,position=null;queueMicrotask(()=>{try{var written=fs.readvSync(fd,buffers,position)}catch(e){callback(e)}callback(null,written,buffers)})},readvSync=fs.readvSync.bind(fs),Dirent=fs.Dirent,Stats=fs.Stats,watch=function watch(path,options,listener){return new FSWatcher(path,options,listener)};function callbackify(fsFunction,args){try{const result=fsFunction.apply(fs,args.slice(0,args.length-1)),callback=args[args.length-1];if(typeof callback===\"function\")queueMicrotask(()=>callback(null,result))}catch(e){const callback=args[args.length-1];if(typeof callback===\"function\")queueMicrotask(()=>callback(e))}}var readStreamPathFastPathSymbol=Symbol.for(\"Bun.Node.readStreamPathFastPath\");const readStreamSymbol=Symbol.for(\"Bun.NodeReadStream\"),readStreamPathOrFdSymbol=Symbol.for(\"Bun.NodeReadStreamPathOrFd\"),writeStreamSymbol=Symbol.for(\"Bun.NodeWriteStream\");var writeStreamPathFastPathSymbol=Symbol.for(\"Bun.NodeWriteStreamFastPath\"),writeStreamPathFastPathCallSymbol=Symbol.for(\"Bun.NodeWriteStreamFastPathCall\"),kIoDone=Symbol.for(\"kIoDone\"),defaultReadStreamOptions={file:void 0,fd:void 0,flags:\"r\",encoding:void 0,mode:438,autoClose:!0,emitClose:!0,start:0,end:Infinity,highWaterMark:65536,fs:{read,open:(path,flags,mode,cb)=>{var fd;try{fd=openSync(path,flags,mode)}catch(e){cb(e);return}cb(null,fd)},openSync,close},autoDestroy:!0},ReadStreamClass;ReadStream=function(InternalReadStream){ReadStreamClass=InternalReadStream,Object.defineProperty(ReadStreamClass.prototype,Symbol.toStringTag,{value:\"ReadStream\",enumerable:!1});function ReadStream2(path,options){return new InternalReadStream(path,options)}return ReadStream2.prototype=InternalReadStream.prototype,Object.defineProperty(ReadStream2,Symbol.hasInstance,{value(instance){return instance instanceof InternalReadStream}})}(class ReadStream2 extends Stream._getNativeReadableStreamPrototype(2,Stream.Readable){constructor(pathOrFd,options=defaultReadStreamOptions){if(typeof options!==\"object\"||!options)@throwTypeError(\"Expected options to be an object\");var{flags=defaultReadStreamOptions.flags,encoding=defaultReadStreamOptions.encoding,mode=defaultReadStreamOptions.mode,autoClose=defaultReadStreamOptions.autoClose,emitClose=defaultReadStreamOptions.emitClose,start=defaultReadStreamOptions.start,end=defaultReadStreamOptions.end,autoDestroy=defaultReadStreamOptions.autoClose,fs:fs2=defaultReadStreamOptions.fs,highWaterMark=defaultReadStreamOptions.highWaterMark}=options;if(pathOrFd\?.constructor\?.name===\"URL\")pathOrFd=Bun.fileURLToPath(pathOrFd);var tempThis={};if(typeof pathOrFd===\"string\"){if(pathOrFd.startsWith(\"file://\"))pathOrFd=Bun.fileURLToPath(pathOrFd);if(pathOrFd.length===0)@throwTypeError(\"Expected path to be a non-empty string\");tempThis.path=tempThis.file=tempThis[readStreamPathOrFdSymbol]=pathOrFd}else if(typeof pathOrFd===\"number\"){if(pathOrFd|=0,pathOrFd<0)@throwTypeError(\"Expected fd to be a positive integer\");tempThis.fd=tempThis[readStreamPathOrFdSymbol]=pathOrFd,tempThis.autoClose=!1}else @throwTypeError(\"Expected a path or file descriptor\");if(!tempThis.fd)tempThis.fd=fs2.openSync(pathOrFd,flags,mode);var fileRef=Bun.file(tempThis.fd),stream=fileRef.stream(),native=@direct(stream);if(!native)throw new Error(\"no native readable stream\");var{stream:ptr}=native;super(ptr,{...options,encoding,autoDestroy,autoClose,emitClose,highWaterMark});if(Object.assign(this,tempThis),this.#fileRef=fileRef,this.end=end,this._read=this.#internalRead,this.start=start,this.flags=flags,this.mode=mode,this.emitClose=emitClose,this[readStreamPathFastPathSymbol]=start===0&&end===Infinity&&autoClose&&fs2===defaultReadStreamOptions.fs&&(encoding===\"buffer\"||encoding===\"binary\"||encoding==null||encoding===\"utf-8\"||encoding===\"utf8\"),this._readableState.autoClose=autoDestroy=autoClose,this._readableState.highWaterMark=highWaterMark,start!==void 0)this.pos=start}#fileRef;#fs;file;path;fd=null;flags;mode;start;end;pos;bytesRead=0;#fileSize=-1;_read;[readStreamSymbol]=!0;[readStreamPathOrFdSymbol];[readStreamPathFastPathSymbol];_construct(callback){if(super._construct)super._construct(callback);else callback();this.emit(\"open\",this.fd),this.emit(\"ready\")}_destroy(err,cb){super._destroy(err,cb);try{var fd=this.fd;if(this[readStreamPathFastPathSymbol]=!1,!fd)cb(err);else this.#fs.close(fd,(er)=>{cb(er||err)}),this.fd=null}catch(e){throw e}}close(cb){if(typeof cb===\"function\")eos_()(this,cb);this.destroy()}push(chunk){var bytesRead=chunk\?.length\?\?0;if(bytesRead>0){this.bytesRead+=bytesRead;var currPos=this.pos;if(currPos!==void 0){if(this.bytesRead<currPos)return!0;if(currPos===this.start){var n=this.bytesRead-currPos;chunk=chunk.slice(-n);var[_,...rest]=arguments;if(this.pos=this.bytesRead,this.end!==void 0&&this.bytesRead>this.end)chunk=chunk.slice(0,this.end-this.start+1);return super.push(chunk,...rest)}var end=this.end;if(end!==void 0&&this.bytesRead>end){chunk=chunk.slice(0,end-currPos+1);var[_,...rest]=arguments;return this.pos=this.bytesRead,super.push(chunk,...rest)}this.pos=this.bytesRead}}return super.push(...arguments)}#internalRead(n){var{pos,end,bytesRead,fd,encoding}=this;if(n=pos!==void 0\?Math.min(end-pos+1,n):Math.min(end-bytesRead+1,n),n<=0){this.push(null);return}if(this.#fileSize===-1&&bytesRead===0&&pos===void 0){var stat2=fstatSync(fd);if(this.#fileSize=stat2.size,this.#fileSize>0&&n>this.#fileSize)n=this.#fileSize+1}this[kIoDone]=!1;var res=super._read(n);if(@isPromise(res)){var then=res\?.then;if(then&&@isCallable(then))then(()=>{if(this[kIoDone]=!0,this.destroyed)this.emit(kIoDone)},(er)=>{this[kIoDone]=!0,this.#errorOrDestroy(er)})}else if(this[kIoDone]=!0,this.destroyed)this.emit(kIoDone),this.#errorOrDestroy(new Error(\"ERR_STREAM_PREMATURE_CLOSE\"))}#errorOrDestroy(err,sync=null){var{_readableState:r={destroyed:!1,autoDestroy:!1},_writableState:w={destroyed:!1,autoDestroy:!1}}=this;if(w\?.destroyed||r\?.destroyed)return this;if(r\?.autoDestroy||w\?.autoDestroy)this.destroy(err);else if(err)this.emit(\"error\",err)}pause(){return this[readStreamPathFastPathSymbol]=!1,super.pause()}resume(){return this[readStreamPathFastPathSymbol]=!1,super.resume()}unshift(...args){return this[readStreamPathFastPathSymbol]=!1,super.unshift(...args)}pipe(dest,pipeOpts){if(this[readStreamPathFastPathSymbol]&&(pipeOpts\?.end\?\?!0)&&this._readableState\?.pipes\?.length===0){if((writeStreamPathFastPathSymbol in dest)&&dest[writeStreamPathFastPathSymbol]){if(dest[writeStreamPathFastPathCallSymbol](this,pipeOpts))return this}}return this[readStreamPathFastPathSymbol]=!1,super.pipe(dest,pipeOpts)}});function createReadStream(path,options){return new ReadStream(path,options)}var defaultWriteStreamOptions={fd:null,start:void 0,pos:void 0,encoding:void 0,flags:\"w\",mode:438,fs:{write,close,open,openSync}},WriteStreamClass;WriteStream=function(InternalWriteStream){WriteStreamClass=InternalWriteStream,Object.defineProperty(WriteStreamClass.prototype,Symbol.toStringTag,{value:\"WritesStream\",enumerable:!1});function WriteStream2(path,options){return new InternalWriteStream(path,options)}return WriteStream2.prototype=InternalWriteStream.prototype,Object.defineProperty(WriteStream2,Symbol.hasInstance,{value(instance){return instance instanceof InternalWriteStream}})}(class WriteStream2 extends Stream.NativeWritable{constructor(path,options=defaultWriteStreamOptions){if(!options)@throwTypeError(\"Expected options to be an object\");var{fs:fs2=defaultWriteStreamOptions.fs,start=defaultWriteStreamOptions.start,flags=defaultWriteStreamOptions.flags,mode=defaultWriteStreamOptions.mode,autoClose=!0,emitClose=!1,autoDestroy=autoClose,encoding=defaultWriteStreamOptions.encoding,fd=defaultWriteStreamOptions.fd,pos=defaultWriteStreamOptions.pos}=options,tempThis={};if(typeof path===\"string\"){if(path.length===0)@throwTypeError(\"Expected a non-empty path\");if(path.startsWith(\"file:\"))path=Bun.fileURLToPath(path);tempThis.path=path,tempThis.fd=null,tempThis[writeStreamPathFastPathSymbol]=autoClose&&(start===void 0||start===0)&&fs2.write===defaultWriteStreamOptions.fs.write&&fs2.close===defaultWriteStreamOptions.fs.close}else tempThis.fd=fd,tempThis[writeStreamPathFastPathSymbol]=!1;if(!tempThis.fd)tempThis.fd=fs2.openSync(path,flags,mode);super(tempThis.fd,{...options,decodeStrings:!1,autoDestroy,emitClose,fd:tempThis});if(Object.assign(this,tempThis),typeof fs2\?.write!==\"function\")@throwTypeError(\"Expected fs.write to be a function\");if(typeof fs2\?.close!==\"function\")@throwTypeError(\"Expected fs.close to be a function\");if(typeof fs2\?.open!==\"function\")@throwTypeError(\"Expected fs.open to be a function\");if(typeof path===\"object\"&&path){if(path instanceof URL)path=Bun.fileURLToPath(path)}if(typeof path!==\"string\"&&typeof fd!==\"number\")@throwTypeError(\"Expected a path or file descriptor\");if(this.start=start,this.#fs=fs2,this.flags=flags,this.mode=mode,this.start!==void 0)this.pos=this.start;if(encoding!==defaultWriteStreamOptions.encoding){if(this.setDefaultEncoding(encoding),encoding!==\"buffer\"&&encoding!==\"utf8\"&&encoding!==\"utf-8\"&&encoding!==\"binary\")this[writeStreamPathFastPathSymbol]=!1}}get autoClose(){return this._writableState.autoDestroy}set autoClose(val){this._writableState.autoDestroy=val}destroySoon=this.end;open(){}path;fd;flags;mode;#fs;bytesWritten=0;pos;[writeStreamPathFastPathSymbol];[writeStreamSymbol]=!0;start;[writeStreamPathFastPathCallSymbol](readStream,pipeOpts){if(!this[writeStreamPathFastPathSymbol])return!1;if(this.fd!==null)return this[writeStreamPathFastPathSymbol]=!1,!1;return this[kIoDone]=!1,readStream[kIoDone]=!1,Bun.write(this[writeStreamPathFastPathSymbol],readStream[readStreamPathOrFdSymbol]).then((bytesWritten)=>{readStream[kIoDone]=this[kIoDone]=!0,this.bytesWritten+=bytesWritten,readStream.bytesRead+=bytesWritten,this.end(),readStream.close()},(err)=>{readStream[kIoDone]=this[kIoDone]=!0,this.#errorOrDestroy(err),readStream.emit(\"error\",err)})}isBunFastPathEnabled(){return this[writeStreamPathFastPathSymbol]}disableBunFastPath(){this[writeStreamPathFastPathSymbol]=!1}#handleWrite(er,bytes){if(er)return this.#errorOrDestroy(er);this.bytesWritten+=bytes}#internalClose(err,cb){this[writeStreamPathFastPathSymbol]=!1;var fd=this.fd;this.#fs.close(fd,(er)=>{this.fd=null,cb(err||er)})}_construct(callback){if(typeof this.fd===\"number\"){callback();return}callback(),this.emit(\"open\",this.fd),this.emit(\"ready\")}_destroy(err,cb){if(this.fd===null)return cb(err);if(this[kIoDone]){this.once(kIoDone,()=>this.#internalClose(err,cb));return}this.#internalClose(err,cb)}[kIoDone]=!1;close(cb){if(cb){if(this.closed){process.nextTick(cb);return}this.on(\"close\",cb)}if(!this.autoClose)this.on(\"finish\",this.destroy);this.end()}write(chunk,encoding=this._writableState.defaultEncoding,cb){if(this[writeStreamPathFastPathSymbol]=!1,typeof chunk===\"string\")chunk=Buffer.from(chunk,encoding);var native=this.pos===void 0;return this[kIoDone]=!0,super.write(chunk,encoding,native\?(err,bytes)=>{if(this[kIoDone]=!1,this.#handleWrite(err,bytes),this.emit(kIoDone),cb)!err\?cb():cb(err)}:()=>{},native)}#internalWriteSlow(chunk,encoding,cb){this.#fs.write(this.fd,chunk,0,chunk.length,this.pos,(err,bytes)=>{this[kIoDone]=!1,this.#handleWrite(err,bytes),this.emit(kIoDone),!err\?cb():cb(err)})}end(chunk,encoding,cb){var native=this.pos===void 0;return super.end(chunk,encoding,cb,native)}_write=this.#internalWriteSlow;_writev=void 0;get pending(){return this.fd===null}_destroy(err,cb){this.close(err,cb)}#errorOrDestroy(err){var{_readableState:r={destroyed:!1,autoDestroy:!1},_writableState:w={destroyed:!1,autoDestroy:!1}}=this;if(w\?.destroyed||r\?.destroyed)return this;if(r\?.autoDestroy||w\?.autoDestroy)this.destroy(err);else if(err)this.emit(\"error\",err)}});function createWriteStream(path,options){return new WriteStream(path,options)}return Object.defineProperties(fs,{createReadStream:{value:createReadStream},createWriteStream:{value:createWriteStream},ReadStream:{value:ReadStream},WriteStream:{value:WriteStream}}),realpath.native=realpath,realpathSync.native=realpathSync,$={access,accessSync,appendFile,appendFileSync,chmod,chmodSync,chown,chownSync,close,closeSync,constants:promises.constants,copyFile,copyFileSync,createReadStream,createWriteStream,Dirent,exists,existsSync,fchmod,fchmodSync,fchown,fchownSync,fstat,fstatSync,fsync,fsyncSync,ftruncate,ftruncateSync,futimes,futimesSync,lchmod,lchmodSync,lchown,lchownSync,link,linkSync,lstat,lstatSync,lutimes,lutimesSync,mkdir,mkdirSync,mkdtemp,mkdtempSync,open,openSync,promises,read,readFile,readFileSync,readSync,readdir,readdirSync,readlink,readlinkSync,realpath,realpathSync,rename,renameSync,rm,rmSync,rmdir,rmdirSync,stat,statSync,Stats,symlink,symlinkSync,truncate,truncateSync,unlink,unlinkSync,utimes,utimesSync,write,writeFile,writeFileSync,writeSync,WriteStream,ReadStream,watch,FSWatcher,writev,writevSync,readv,readvSync,[Symbol.for(\"::bunternal::\")]:{ReadStreamClass,WriteStreamClass}},$})\n"_s; static constexpr ASCIILiteral NodeFSPromisesCode = "(function (){\"use strict\";var $;const constants=@processBindingConstants.fs;var fs=Bun.fs();const notrace=\"::bunternal::\";var promisify={[notrace]:(fsFunction)=>{return async function(...args){return await 1,fsFunction.apply(fs,args)}}}[notrace];function watch(filename,options={}){if(filename instanceof URL)@throwTypeError(\"Watch URLs are not supported yet\");else if(Buffer.isBuffer(filename))filename=filename.toString();else if(typeof filename!==\"string\")@throwTypeError(\"Expected path to be a string or Buffer\");let nextEventResolve=null;if(typeof options===\"string\")options={encoding:options};const queue=@createFIFO(),watcher=fs.watch(filename,options||{},(eventType,filename2)=>{if(queue.push({eventType,filename:filename2}),nextEventResolve){const resolve=nextEventResolve;nextEventResolve=null,resolve()}});return{[Symbol.asyncIterator](){let closed=!1;return{async next(){while(!closed){let event;while(event=queue.shift()){if(event.eventType===\"close\")return closed=!0,{value:void 0,done:!0};if(event.eventType===\"error\")throw closed=!0,event.filename;return{value:event,done:!1}}const{promise,resolve}=Promise.withResolvers();nextEventResolve=resolve,await promise}return{value:void 0,done:!0}},return(){if(!closed){if(watcher.close(),closed=!0,nextEventResolve){const resolve=nextEventResolve;nextEventResolve=null,resolve()}}return{value:void 0,done:!0}}}}}}return $={access:promisify(fs.accessSync),appendFile:promisify(fs.appendFileSync),close:promisify(fs.closeSync),copyFile:promisify(fs.copyFileSync),exists:promisify(fs.existsSync),chown:promisify(fs.chownSync),chmod:promisify(fs.chmodSync),fchmod:promisify(fs.fchmodSync),fchown:promisify(fs.fchownSync),fstat:promisify(fs.fstatSync),fsync:promisify(fs.fsyncSync),ftruncate:promisify(fs.ftruncateSync),futimes:promisify(fs.futimesSync),lchmod:promisify(fs.lchmodSync),lchown:promisify(fs.lchownSync),link:promisify(fs.linkSync),lstat:fs.lstat.bind(fs),mkdir:promisify(fs.mkdirSync),mkdtemp:promisify(fs.mkdtempSync),open:promisify(fs.openSync),read:promisify(fs.readSync),write:promisify(fs.writeSync),readdir:fs.readdir.bind(fs),readFile:fs.readFile.bind(fs),writeFile:promisify(fs.writeFileSync),readlink:promisify(fs.readlinkSync),realpath:promisify(fs.realpathSync),rename:promisify(fs.renameSync),stat:fs.stat.bind(fs),symlink:promisify(fs.symlinkSync),truncate:promisify(fs.truncateSync),unlink:promisify(fs.unlinkSync),utimes:promisify(fs.utimesSync),lutimes:promisify(fs.lutimesSync),rm:promisify(fs.rmSync),rmdir:promisify(fs.rmdirSync),writev:(fd,buffers,position)=>{return new Promise((resolve,reject)=>{try{var bytesWritten=fs.writevSync(fd,buffers,position)}catch(err){reject(err);return}resolve({bytesWritten,buffers})})},readv:(fd,buffers,position)=>{return new Promise((resolve,reject)=>{try{var bytesRead=fs.readvSync(fd,buffers,position)}catch(err){reject(err);return}resolve({bytesRead,buffers})})},constants,watch},$})\n"_s; -static constexpr ASCIILiteral NodeHttpCode = "(function (){\"use strict\";var $;const EventEmitter=@getInternalField(@internalModuleRegistry,15)||@createInternalModuleById(15),{isTypedArray}=@requireNativeModule(\"node:util/types\"),{Duplex,Readable,Writable}=@getInternalField(@internalModuleRegistry,34)||@createInternalModuleById(34),headerCharRegex=/[^\\t\\x20-\\x7e\\x80-\\xff]/;function checkInvalidHeaderChar(val){return RegExpPrototypeExec.call(headerCharRegex,val)!==null}const validateHeaderName=(name,label)=>{if(typeof name!==\"string\"||!name||!checkIsHttpToken(name))throw new Error(\"ERR_INVALID_HTTP_TOKEN\")},validateHeaderValue=(name,value)=>{if(value===void 0)throw new Error(\"ERR_HTTP_INVALID_HEADER_VALUE\");if(checkInvalidHeaderChar(value))throw new Error(\"ERR_INVALID_CHAR\")};function isIPv6(input){return new RegExp(\"^((\?:(\?:[0-9a-fA-F]{1,4}):){7}(\?:(\?:[0-9a-fA-F]{1,4})|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){6}(\?:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|:(\?:[0-9a-fA-F]{1,4})|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){5}(\?::((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,2}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){4}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,1}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,3}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){3}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,2}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,4}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){2}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,3}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,5}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){1}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,4}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,6}|:)|(\?::((\?::(\?:[0-9a-fA-F]{1,4})){0,5}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(\?::(\?:[0-9a-fA-F]{1,4})){1,7}|:)))(%[0-9a-zA-Z-.:]{1,})\?$\").test(input)}const{URL}=globalThis,globalReportError=globalThis.reportError,setTimeout=globalThis.setTimeout,fetch=Bun.fetch,nop=()=>{},kEmptyObject=Object.freeze(Object.create(null)),kOutHeaders=Symbol.for(\"kOutHeaders\"),kEndCalled=Symbol.for(\"kEndCalled\"),kAbortController=Symbol.for(\"kAbortController\"),kClearTimeout=Symbol(\"kClearTimeout\"),kCorked=Symbol.for(\"kCorked\"),searchParamsSymbol=Symbol.for(\"query\"),StringPrototypeSlice=String.prototype.slice,StringPrototypeStartsWith=String.prototype.startsWith,StringPrototypeToUpperCase=String.prototype.toUpperCase,StringPrototypeIncludes=String.prototype.includes,StringPrototypeCharCodeAt=String.prototype.charCodeAt,StringPrototypeIndexOf=String.prototype.indexOf,ArrayIsArray=Array.isArray,RegExpPrototypeExec=RegExp.prototype.exec,ObjectAssign=Object.assign,ObjectPrototypeHasOwnProperty=Object.prototype.hasOwnProperty,INVALID_PATH_REGEX=/[^\\u0021-\\u00ff]/,NODE_HTTP_WARNING=\"WARN: Agent is mostly unused in Bun's implementation of http. If you see strange behavior, this is probably the cause.\";var _defaultHTTPSAgent,kInternalRequest=Symbol(\"kInternalRequest\"),kInternalSocketData=Symbol.for(\"::bunternal::\");const kEmptyBuffer=Buffer.alloc(0);function isValidTLSArray(obj){if(typeof obj===\"string\"||isTypedArray(obj)||obj instanceof ArrayBuffer||obj instanceof Blob)return!0;if(Array.isArray(obj)){for(var i=0;i<obj.length;i++)if(typeof obj!==\"string\"&&!isTypedArray(obj)&&!(obj instanceof ArrayBuffer)&&!(obj instanceof Blob))return!1;return!0}}class ERR_INVALID_ARG_TYPE extends TypeError{constructor(name,expected,actual){super(`The ${name} argument must be of type ${expected}. Received type ${typeof actual}`);this.code=\"ERR_INVALID_ARG_TYPE\"}}function validateMsecs(numberlike,field){if(typeof numberlike!==\"number\"||numberlike<0)throw new ERR_INVALID_ARG_TYPE(field,\"number\",numberlike);return numberlike}function validateFunction(callable,field){if(typeof callable!==\"function\")throw new ERR_INVALID_ARG_TYPE(field,\"Function\",callable);return callable}function getHeader(headers,name){if(!headers)return;const result=headers.get(name);return result==null\?void 0:result}var FakeSocket=class Socket extends Duplex{bytesRead=0;bytesWritten=0;connecting=!1;remoteAddress=null;remotePort;timeout=0;isServer=!1;address(){return{address:this.localAddress,family:this.localFamily,port:this.localPort}}get bufferSize(){return this.writableLength}connect(port,host,connectListener){return this}_destroy(err,callback){}_final(callback){}get localAddress(){return\"127.0.0.1\"}get localFamily(){return\"IPv4\"}get localPort(){return 80}get pending(){return this.connecting}_read(size){}get readyState(){if(this.connecting)return\"opening\";if(this.readable)return this.writable\?\"open\":\"readOnly\";else return this.writable\?\"writeOnly\":\"closed\"}ref(){}get remoteFamily(){return\"IPv4\"}resetAndDestroy(){}setKeepAlive(enable=!1,initialDelay=0){}setNoDelay(noDelay=!0){return this}setTimeout(timeout,callback){return this}unref(){}_write(chunk,encoding,callback){}};function createServer(options,callback){return new Server(options,callback)}class Agent extends EventEmitter{defaultPort=80;protocol=\"http:\";options;requests;sockets;freeSockets;keepAliveMsecs;keepAlive;maxSockets;maxFreeSockets;scheduling;maxTotalSockets;totalSocketCount;#fakeSocket;static get globalAgent(){return globalAgent}static get defaultMaxSockets(){return Infinity}constructor(options=kEmptyObject){super();if(this.options=options={...options,path:null},options.noDelay===void 0)options.noDelay=!0;this.requests=kEmptyObject,this.sockets=kEmptyObject,this.freeSockets=kEmptyObject,this.keepAliveMsecs=options.keepAliveMsecs||1000,this.keepAlive=options.keepAlive||!1,this.maxSockets=options.maxSockets||Agent.defaultMaxSockets,this.maxFreeSockets=options.maxFreeSockets||256,this.scheduling=options.scheduling||\"lifo\",this.maxTotalSockets=options.maxTotalSockets,this.totalSocketCount=0,this.defaultPort=options.defaultPort||80,this.protocol=options.protocol||\"http:\"}createConnection(){return this.#fakeSocket\?\?=new FakeSocket}getName(options=kEmptyObject){let name=`http:${options.host||\"localhost\"}:`;if(options.port)name+=options.port;if(name+=\":\",options.localAddress)name+=options.localAddress;if(options.family===4||options.family===6)name+=`:${options.family}`;if(options.socketPath)name+=`:${options.socketPath}`;return name}addRequest(){}createSocket(req,options,cb){cb(null,this.#fakeSocket\?\?=new FakeSocket)}removeSocket(){}keepSocketAlive(){return!0}reuseSocket(){}destroy(){}}function emitListeningNextTick(self,onListen,err,hostname,port){if(typeof onListen===\"function\")try{onListen(err,hostname,port)}catch(err2){self.emit(\"error\",err2)}if(self.listening=!err,err)self.emit(\"error\",err);else self.emit(\"listening\",hostname,port)}class Server extends EventEmitter{#server;#options;#tls;#is_tls=!1;listening=!1;serverName;constructor(options,callback){super();if(typeof options===\"function\")callback=options,options={};else if(options==null||typeof options===\"object\"){options={...options},this.#tls=null;let key=options.key;if(key){if(!isValidTLSArray(key))@throwTypeError(\"key argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");this.#is_tls=!0}let cert=options.cert;if(cert){if(!isValidTLSArray(cert))@throwTypeError(\"cert argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");this.#is_tls=!0}let ca=options.ca;if(ca){if(!isValidTLSArray(ca))@throwTypeError(\"ca argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");this.#is_tls=!0}let passphrase=options.passphrase;if(passphrase&&typeof passphrase!==\"string\")@throwTypeError(\"passphrase argument must be an string\");let serverName=options.servername;if(serverName&&typeof serverName!==\"string\")@throwTypeError(\"servername argument must be an string\");let secureOptions=options.secureOptions||0;if(secureOptions&&typeof secureOptions!==\"number\")@throwTypeError(\"secureOptions argument must be an number\");if(this.#is_tls)this.#tls={serverName,key,cert,ca,passphrase,secureOptions};else this.#tls=null}else throw new Error(\"bun-http-polyfill: invalid arguments\");if(this.#options=options,callback)this.on(\"request\",callback)}closeAllConnections(){const server=this.#server;if(!server)return;this.#server=void 0,server.stop(!0),this.emit(\"close\")}closeIdleConnections(){}close(optionalCallback){const server=this.#server;if(!server){if(typeof optionalCallback===\"function\")process.nextTick(optionalCallback,new Error(\"Server is not running\"));return}if(this.#server=void 0,typeof optionalCallback===\"function\")this.once(\"close\",optionalCallback);server.stop(),this.emit(\"close\")}address(){if(!this.#server)return null;const address=this.#server.hostname;return{address,family:isIPv6(address)\?\"IPv6\":\"IPv4\",port:this.#server.port}}listen(port,host,backlog,onListen){const server=this;if(typeof host===\"function\")onListen=host,host=void 0;if(typeof port===\"function\")onListen=port;else if(typeof port===\"object\"){if(port\?.signal\?.addEventListener(\"abort\",()=>{this.close()}),host=port\?.host,port=port\?.port,typeof port\?.callback===\"function\")onListen=port\?.callback}if(typeof backlog===\"function\")onListen=backlog;const ResponseClass=this.#options.ServerResponse||ServerResponse,RequestClass=this.#options.IncomingMessage||IncomingMessage;try{const tls=this.#tls;if(tls)this.serverName=tls.serverName||host||\"localhost\";this.#server=Bun.serve({tls,port,hostname:host,websocket:{open(ws){ws.data.open(ws)},message(ws,message){ws.data.message(ws,message)},close(ws,code,reason){ws.data.close(ws,code,reason)},drain(ws){ws.data.drain(ws)}},fetch(req,_server){var pendingResponse,pendingError,rejectFunction,resolveFunction,reject=(err)=>{if(pendingError)return;if(pendingError=err,rejectFunction)rejectFunction(err)},reply=function(resp){if(pendingResponse)return;if(pendingResponse=resp,resolveFunction)resolveFunction(resp)};const http_req=new RequestClass(req),http_res=new ResponseClass({reply,req:http_req});if(http_req.once(\"error\",(err)=>reject(err)),http_res.once(\"error\",(err)=>reject(err)),req.headers.get(\"upgrade\")){const socket=new FakeSocket;socket[kInternalSocketData]=[_server,http_res,req],server.emit(\"upgrade\",http_req,socket,kEmptyBuffer)}else server.emit(\"request\",http_req,http_res);if(pendingError)throw pendingError;if(pendingResponse)return pendingResponse;return new Promise((resolve,reject2)=>{resolveFunction=resolve,rejectFunction=reject2})}}),setTimeout(emitListeningNextTick,1,this,onListen,null,this.#server.hostname,this.#server.port)}catch(err){setTimeout(emitListeningNextTick,1,this,onListen,err)}return this}setTimeout(msecs,callback){}}function assignHeaders(object,req){var headers=req.headers.toJSON();const rawHeaders=@newArrayWithSize(req.headers.count*2);var i=0;for(let key in headers)rawHeaders[i++]=key,rawHeaders[i++]=headers[key];object.headers=headers,object.rawHeaders=rawHeaders}function destroyBodyStreamNT(bodyStream){bodyStream.destroy()}var defaultIncomingOpts={type:\"request\"};function getDefaultHTTPSAgent(){return _defaultHTTPSAgent\?\?=new Agent({defaultPort:443,protocol:\"https:\"})}class IncomingMessage extends Readable{method;complete;constructor(req,defaultIncomingOpts2){const method=req.method;super();const url=new URL(req.url);var{type=\"request\",[kInternalRequest]:nodeReq}=defaultIncomingOpts2||{};this.#noBody=type===\"request\"\?method===\"GET\"||method===\"HEAD\"||method===\"TRACE\"||method===\"CONNECT\"||method===\"OPTIONS\"||(parseInt(req.headers.get(\"Content-Length\")||\"\")||0)===0:!1,this.#req=req,this.method=method,this.#type=type,this.complete=!!this.#noBody,this.#bodyStream=void 0;const socket=new FakeSocket;socket.remoteAddress=url.hostname,socket.remotePort=url.port,this.#fakeSocket=socket,this.url=url.pathname+url.search,this.#nodeReq=nodeReq,assignHeaders(this,req)}headers;rawHeaders;_consuming=!1;_dumped=!1;#bodyStream;#fakeSocket;#noBody=!1;#aborted=!1;#req;url;#type;#nodeReq;get req(){return this.#nodeReq}_construct(callback){if(this.#type===\"response\"||this.#noBody){callback();return}const contentLength=this.#req.headers.get(\"content-length\");if((contentLength\?parseInt(contentLength,10):0)===0){this.#noBody=!0,callback();return}callback()}async#consumeStream(reader){while(!0){var{done,value}=await reader.readMany();if(this.#aborted)return;if(done){this.push(null),this.destroy();break}for(var v of value)this.push(v)}}_read(size){if(this.#noBody)this.push(null),this.complete=!0;else if(this.#bodyStream==null){const reader=this.#req.body\?.getReader();if(!reader){this.push(null);return}this.#bodyStream=reader,this.#consumeStream(reader)}}get aborted(){return this.#aborted}#abort(){if(this.#aborted)return;this.#aborted=!0;var bodyStream=this.#bodyStream;if(!bodyStream)return;bodyStream.cancel(),this.complete=!0,this.#bodyStream=void 0,this.push(null)}get connection(){return this.#fakeSocket}get statusCode(){return this.#req.status}get statusMessage(){return STATUS_CODES[this.#req.status]}get httpVersion(){return\"1.1\"}get rawTrailers(){return[]}get httpVersionMajor(){return 1}get httpVersionMinor(){return 1}get trailers(){return kEmptyObject}get socket(){return this.#fakeSocket\?\?=new FakeSocket}set socket(val){this.#fakeSocket=val}setTimeout(msecs,callback){throw new Error(\"not implemented\")}}function emitErrorNt(msg,err,callback){if(callback(err),typeof msg.emit===\"function\"&&!msg._closed)msg.emit(\"error\",err)}function onError(self,err,cb){process.nextTick(()=>emitErrorNt(self,err,cb))}function write_(msg,chunk,encoding,callback,fromEnd){if(typeof callback!==\"function\")callback=nop;let len;if(chunk===null)throw new Error(\"ERR_STREAM_NULL_VALUES\");else if(typeof chunk===\"string\")len=Buffer.byteLength(chunk,encoding);else throw new Error(\"Invalid arg type for chunk\");let err;if(msg.finished)err=new Error(\"ERR_STREAM_WRITE_AFTER_END\");else if(msg.destroyed)err=new Error(\"ERR_STREAM_DESTROYED\");if(err){if(!msg.destroyed)onError(msg,err,callback);else process.nextTick(callback,err);return!1}if(!msg._header){if(fromEnd)msg._contentLength=len}if(!msg._hasBody)return process.nextTick(callback),!0;return!0}class OutgoingMessage extends Writable{constructor(){super(...arguments)}#headers;headersSent=!1;sendDate=!0;req;timeout;#finished=!1;[kEndCalled]=!1;#fakeSocket;#timeoutTimer;[kAbortController]=null;_implicitHeader(){}get headers(){if(!this.#headers)return kEmptyObject;return this.#headers.toJSON()}get shouldKeepAlive(){return!0}get chunkedEncoding(){return!1}set chunkedEncoding(value){}set shouldKeepAlive(value){}get useChunkedEncodingByDefault(){return!0}set useChunkedEncodingByDefault(value){}get socket(){return this.#fakeSocket\?\?=new FakeSocket}set socket(val){this.#fakeSocket=val}get connection(){return this.socket}get finished(){return this.#finished}appendHeader(name,value){var headers=this.#headers\?\?=new Headers;headers.append(name,value)}flushHeaders(){}getHeader(name){return getHeader(this.#headers,name)}getHeaders(){if(!this.#headers)return kEmptyObject;return this.#headers.toJSON()}getHeaderNames(){var headers=this.#headers;if(!headers)return[];return Array.from(headers.keys())}removeHeader(name){if(!this.#headers)return;this.#headers.delete(name)}setHeader(name,value){var headers=this.#headers\?\?=new Headers;return headers.set(name,value),this}hasHeader(name){if(!this.#headers)return!1;return this.#headers.has(name)}addTrailers(headers){throw new Error(\"not implemented\")}[kClearTimeout](){if(this.#timeoutTimer)clearTimeout(this.#timeoutTimer),this.removeAllListeners(\"timeout\"),this.#timeoutTimer=void 0}#onTimeout(){this.#timeoutTimer=void 0,this[kAbortController]\?.abort(),this.emit(\"timeout\")}setTimeout(msecs,callback){if(this.destroyed)return this;if(this.timeout=msecs=validateMsecs(msecs,\"msecs\"),clearTimeout(this.#timeoutTimer),msecs===0){if(callback!==void 0)validateFunction(callback,\"callback\"),this.removeListener(\"timeout\",callback);this.#timeoutTimer=void 0}else if(this.#timeoutTimer=setTimeout(this.#onTimeout.bind(this),msecs).unref(),callback!==void 0)validateFunction(callback,\"callback\"),this.once(\"timeout\",callback);return this}}let OriginalWriteHeadFn,OriginalImplicitHeadFn;class ServerResponse extends Writable{constructor({req,reply}){super();if(this.req=req,this._reply=reply,this.sendDate=!0,this.statusCode=200,this.headersSent=!1,this.statusMessage=void 0,this.#controller=void 0,this.#firstWrite=void 0,this._writableState.decodeStrings=!1,this.#deferred=void 0,req.method===\"HEAD\")this._hasBody=!1}req;_reply;sendDate;statusCode;#headers;headersSent=!1;statusMessage;#controller;#firstWrite;_sent100=!1;_defaultKeepAlive=!1;_removedConnection=!1;_removedContLen=!1;_hasBody=!0;#deferred=void 0;#finished=!1;_implicitHeader(){this.writeHead(this.statusCode)}_write(chunk,encoding,callback){if(!this.#firstWrite&&!this.headersSent){this.#firstWrite=chunk,callback();return}this.#ensureReadableStreamController((controller)=>{controller.write(chunk),callback()})}_writev(chunks,callback){if(chunks.length===1&&!this.headersSent&&!this.#firstWrite){this.#firstWrite=chunks[0].chunk,callback();return}this.#ensureReadableStreamController((controller)=>{for(let chunk of chunks)controller.write(chunk.chunk);callback()})}#ensureReadableStreamController(run){var thisController=this.#controller;if(thisController)return run(thisController);this.headersSent=!0;var firstWrite=this.#firstWrite;this.#firstWrite=void 0,this._reply(new Response(new ReadableStream({type:\"direct\",pull:(controller)=>{if(this.#controller=controller,firstWrite)controller.write(firstWrite);if(firstWrite=void 0,run(controller),!this.#finished)return new Promise((resolve)=>{this.#deferred=resolve})}}),{headers:this.#headers,status:this.statusCode,statusText:this.statusMessage\?\?STATUS_CODES[this.statusCode]}))}#drainHeadersIfObservable(){if(this._implicitHeader===OriginalImplicitHeadFn&&this.writeHead===OriginalWriteHeadFn)return;this._implicitHeader()}_final(callback){if(!this.headersSent){var data=this.#firstWrite||\"\";this.#firstWrite=void 0,this.#finished=!0,this.#drainHeadersIfObservable(),this._reply(new Response(data,{headers:this.#headers,status:this.statusCode,statusText:this.statusMessage\?\?STATUS_CODES[this.statusCode]})),callback&&callback();return}this.#finished=!0,this.#ensureReadableStreamController((controller)=>{controller.end(),callback();var deferred=this.#deferred;if(deferred)this.#deferred=void 0,deferred()})}writeProcessing(){throw new Error(\"not implemented\")}addTrailers(headers){throw new Error(\"not implemented\")}assignSocket(socket){throw new Error(\"not implemented\")}detachSocket(socket){throw new Error(\"not implemented\")}writeContinue(callback){throw new Error(\"not implemented\")}setTimeout(msecs,callback){throw new Error(\"not implemented\")}get shouldKeepAlive(){return!0}get chunkedEncoding(){return!1}set chunkedEncoding(value){}set shouldKeepAlive(value){}get useChunkedEncodingByDefault(){return!0}set useChunkedEncodingByDefault(value){}appendHeader(name,value){var headers=this.#headers\?\?=new Headers;headers.append(name,value)}flushHeaders(){}getHeader(name){return getHeader(this.#headers,name)}getHeaders(){var headers=this.#headers;if(!headers)return kEmptyObject;return headers.toJSON()}getHeaderNames(){var headers=this.#headers;if(!headers)return[];return Array.from(headers.keys())}removeHeader(name){if(!this.#headers)return;this.#headers.delete(name)}setHeader(name,value){var headers=this.#headers\?\?=new Headers;return headers.set(name,value),this}hasHeader(name){if(!this.#headers)return!1;return this.#headers.has(name)}writeHead(statusCode,statusMessage,headers){return _writeHead(statusCode,statusMessage,headers,this),this}}OriginalWriteHeadFn=ServerResponse.prototype.writeHead,OriginalImplicitHeadFn=ServerResponse.prototype._implicitHeader;class ClientRequest extends OutgoingMessage{#timeout;#res=null;#upgradeOrConnect=!1;#parser=null;#maxHeadersCount=null;#reusedSocket=!1;#host;#protocol;#method;#port;#useDefaultPort;#joinDuplicateHeaders;#maxHeaderSize;#agent=globalAgent;#path;#socketPath;#bodyChunks=null;#fetchRequest;#signal=null;[kAbortController]=null;#timeoutTimer=void 0;#options;#finished;get path(){return this.#path}get port(){return this.#port}get method(){return this.#method}get host(){return this.#host}get protocol(){return this.#protocol}_write(chunk,encoding,callback){if(!this.#bodyChunks){this.#bodyChunks=[chunk],callback();return}this.#bodyChunks.push(chunk),callback()}_writev(chunks,callback){if(!this.#bodyChunks){this.#bodyChunks=chunks,callback();return}this.#bodyChunks.push(...chunks),callback()}_final(callback){if(this.#finished=!0,this[kAbortController]=new AbortController,this[kAbortController].signal.addEventListener(\"abort\",()=>{this[kClearTimeout]()}),this.#signal\?.aborted)this[kAbortController].abort();var method=this.#method,body=Buffer.concat(this.#bodyChunks||[]);try{this.#fetchRequest=fetch(`${this.#protocol}//${this.#host}${this.#useDefaultPort\?\"\":\":\"+this.#port}${this.#path}`,{method,headers:this.getHeaders(),body:body&&method!==\"GET\"&&method!==\"HEAD\"&&method!==\"OPTIONS\"\?body:void 0,redirect:\"manual\",verbose:!1,signal:this[kAbortController].signal,timeout:!1}).then((response)=>{var res=this.#res=new IncomingMessage(response,{type:\"response\",[kInternalRequest]:this});this.emit(\"response\",res)}).catch((err)=>{this.emit(\"error\",err)}).finally(()=>{this.#fetchRequest=null,this[kClearTimeout]()})}catch(err){this.emit(\"error\",err)}finally{callback()}}get aborted(){return this.#signal\?.aborted||!!this[kAbortController]\?.signal.aborted}abort(){if(this.aborted)return;this[kAbortController].abort()}constructor(input,options,cb){super();if(typeof input===\"string\"){const urlStr=input;try{var urlObject=new URL(urlStr)}catch(e){@throwTypeError(`Invalid URL: ${urlStr}`)}input=urlToHttpOptions(urlObject)}else if(input&&typeof input===\"object\"&&input instanceof URL)input=urlToHttpOptions(input);else cb=options,options=input,input=null;if(typeof options===\"function\")cb=options,options=input||kEmptyObject;else options=ObjectAssign(input||{},options);var defaultAgent=options._defaultAgent||Agent.globalAgent;let protocol=options.protocol;if(!protocol)if(options.port===443)protocol=\"https:\";else protocol=defaultAgent.protocol||\"http:\";switch(this.#protocol=protocol,this.#agent\?.protocol){case void 0:break;case\"http:\":if(protocol===\"https:\"){defaultAgent=this.#agent=getDefaultHTTPSAgent();break}case\"https:\":if(protocol===\"https\"){defaultAgent=this.#agent=Agent.globalAgent;break}default:break}if(options.path){const path=String(options.path);if(RegExpPrototypeExec.call(INVALID_PATH_REGEX,path)!==null)throw new Error(\"Path contains unescaped characters\")}if(protocol!==\"http:\"&&protocol!==\"https:\"&&protocol){const expectedProtocol=defaultAgent\?.protocol\?\?\"http:\";throw new Error(`Protocol mismatch. Expected: ${expectedProtocol}. Got: ${protocol}`)}const defaultPort=protocol===\"https:\"\?443:80;this.#port=options.port||options.defaultPort||this.#agent\?.defaultPort||defaultPort,this.#useDefaultPort=this.#port===defaultPort;const host=this.#host=options.host=validateHost(options.hostname,\"hostname\")||validateHost(options.host,\"host\")||\"localhost\";this.#socketPath=options.socketPath;const signal=options.signal;if(signal)signal.addEventListener(\"abort\",()=>{this[kAbortController]\?.abort()}),this.#signal=signal;let method=options.method;const methodIsString=typeof method===\"string\";if(method!==null&&method!==void 0&&!methodIsString)throw new Error(\"ERR_INVALID_ARG_TYPE: options.method\");if(methodIsString&&method){if(!checkIsHttpToken(method))throw new Error(\"ERR_INVALID_HTTP_TOKEN: Method\");method=this.#method=StringPrototypeToUpperCase.call(method)}else method=this.#method=\"GET\";const _maxHeaderSize=options.maxHeaderSize;this.#maxHeaderSize=_maxHeaderSize;var _joinDuplicateHeaders=options.joinDuplicateHeaders;if(this.#joinDuplicateHeaders=_joinDuplicateHeaders,this.#path=options.path||\"/\",cb)this.once(\"response\",cb);this.#finished=!1,this.#res=null,this.#upgradeOrConnect=!1,this.#parser=null,this.#maxHeadersCount=null,this.#reusedSocket=!1,this.#host=host,this.#protocol=protocol;var timeout=options.timeout;if(timeout!==void 0&&timeout!==0)this.setTimeout(timeout,void 0);if(!ArrayIsArray(headers)){var headers=options.headers;if(headers)for(let key in headers)this.setHeader(key,headers[key]);var auth=options.auth;if(auth&&!this.getHeader(\"Authorization\"))this.setHeader(\"Authorization\",\"Basic \"+Buffer.from(auth).toString(\"base64\"))}var{signal:_signal,...optsWithoutSignal}=options;this.#options=optsWithoutSignal}setSocketKeepAlive(enable=!0,initialDelay=0){}setNoDelay(noDelay=!0){}[kClearTimeout](){if(this.#timeoutTimer)clearTimeout(this.#timeoutTimer),this.#timeoutTimer=void 0,this.removeAllListeners(\"timeout\")}#onTimeout(){this.#timeoutTimer=void 0,this[kAbortController]\?.abort(),this.emit(\"timeout\")}setTimeout(msecs,callback){if(this.destroyed)return this;if(this.timeout=msecs=validateMsecs(msecs,\"msecs\"),clearTimeout(this.#timeoutTimer),msecs===0){if(callback!==void 0)validateFunction(callback,\"callback\"),this.removeListener(\"timeout\",callback);this.#timeoutTimer=void 0}else if(this.#timeoutTimer=setTimeout(this.#onTimeout.bind(this),msecs).unref(),callback!==void 0)validateFunction(callback,\"callback\"),this.once(\"timeout\",callback);return this}}function urlToHttpOptions(url){var{protocol,hostname,hash,search,pathname,href,port,username,password}=url;return{protocol,hostname:typeof hostname===\"string\"&&StringPrototypeStartsWith.call(hostname,\"[\")\?StringPrototypeSlice.call(hostname,1,-1):hostname,hash,search,pathname,path:`${pathname||\"\"}${search||\"\"}`,href,port:port\?Number(port):protocol===\"https:\"\?443:protocol===\"http:\"\?80:void 0,auth:username||password\?`${decodeURIComponent(username)}:${decodeURIComponent(password)}`:void 0}}function validateHost(host,name){if(host!==null&&host!==void 0&&typeof host!==\"string\")throw new Error(\"Invalid arg type in options\");return host}const tokenRegExp=/^[\\^_`a-zA-Z\\-0-9!#$%&'*+.|~]+$/;function checkIsHttpToken(val){return RegExpPrototypeExec.call(tokenRegExp,val)!==null}const METHODS=[\"ACL\",\"BIND\",\"CHECKOUT\",\"CONNECT\",\"COPY\",\"DELETE\",\"GET\",\"HEAD\",\"LINK\",\"LOCK\",\"M-SEARCH\",\"MERGE\",\"MKACTIVITY\",\"MKCALENDAR\",\"MKCOL\",\"MOVE\",\"NOTIFY\",\"OPTIONS\",\"PATCH\",\"POST\",\"PROPFIND\",\"PROPPATCH\",\"PURGE\",\"PUT\",\"REBIND\",\"REPORT\",\"SEARCH\",\"SOURCE\",\"SUBSCRIBE\",\"TRACE\",\"UNBIND\",\"UNLINK\",\"UNLOCK\",\"UNSUBSCRIBE\"],STATUS_CODES={100:\"Continue\",101:\"Switching Protocols\",102:\"Processing\",103:\"Early Hints\",200:\"OK\",201:\"Created\",202:\"Accepted\",203:\"Non-Authoritative Information\",204:\"No Content\",205:\"Reset Content\",206:\"Partial Content\",207:\"Multi-Status\",208:\"Already Reported\",226:\"IM Used\",300:\"Multiple Choices\",301:\"Moved Permanently\",302:\"Found\",303:\"See Other\",304:\"Not Modified\",305:\"Use Proxy\",307:\"Temporary Redirect\",308:\"Permanent Redirect\",400:\"Bad Request\",401:\"Unauthorized\",402:\"Payment Required\",403:\"Forbidden\",404:\"Not Found\",405:\"Method Not Allowed\",406:\"Not Acceptable\",407:\"Proxy Authentication Required\",408:\"Request Timeout\",409:\"Conflict\",410:\"Gone\",411:\"Length Required\",412:\"Precondition Failed\",413:\"Payload Too Large\",414:\"URI Too Long\",415:\"Unsupported Media Type\",416:\"Range Not Satisfiable\",417:\"Expectation Failed\",418:\"I'm a Teapot\",421:\"Misdirected Request\",422:\"Unprocessable Entity\",423:\"Locked\",424:\"Failed Dependency\",425:\"Too Early\",426:\"Upgrade Required\",428:\"Precondition Required\",429:\"Too Many Requests\",431:\"Request Header Fields Too Large\",451:\"Unavailable For Legal Reasons\",500:\"Internal Server Error\",501:\"Not Implemented\",502:\"Bad Gateway\",503:\"Service Unavailable\",504:\"Gateway Timeout\",505:\"HTTP Version Not Supported\",506:\"Variant Also Negotiates\",507:\"Insufficient Storage\",508:\"Loop Detected\",509:\"Bandwidth Limit Exceeded\",510:\"Not Extended\",511:\"Network Authentication Required\"};function _normalizeArgs(args){let arr;if(args.length===0)return arr=[{},null],arr;const arg0=args[0];let options={};if(typeof arg0===\"object\"&&arg0!==null)options=arg0;else if(options.port=arg0,args.length>1&&typeof args[1]===\"string\")options.host=args[1];const cb=args[args.length-1];if(typeof cb!==\"function\")arr=[options,null];else arr=[options,cb];return arr}function _writeHead(statusCode,reason,obj,response){if(statusCode|=0,statusCode<100||statusCode>999)throw new Error(\"status code must be between 100 and 999\");if(typeof reason===\"string\")response.statusMessage=reason;else{if(!response.statusMessage)response.statusMessage=STATUS_CODES[statusCode]||\"unknown\";obj=reason}response.statusCode=statusCode;{let k;if(Array.isArray(obj)){if(obj.length%2!==0)throw new Error(\"raw headers must have an even number of elements\");for(let n=0;n<obj.length;n+=2)if(k=obj[n+0],k)response.setHeader(k,obj[n+1])}else if(obj){const keys=Object.keys(obj);for(let i=0;i<keys.length;i++)if(k=keys[i],k)response.setHeader(k,obj[k])}}if(statusCode===204||statusCode===304||statusCode>=100&&statusCode<=199)response._hasBody=!1}function request(url,options,cb){return new ClientRequest(url,options,cb)}function get(url,options,cb){const req=request(url,options,cb);return req.end(),req}var globalAgent=new Agent;return $={Agent,Server,METHODS,STATUS_CODES,createServer,ServerResponse,IncomingMessage,request,get,maxHeaderSize:16384,validateHeaderName,validateHeaderValue,setMaxIdleHTTPParsers(max){},globalAgent,ClientRequest,OutgoingMessage},$})\n"_s; +static constexpr ASCIILiteral NodeHttpCode = "(function (){\"use strict\";var $;const EventEmitter=@getInternalField(@internalModuleRegistry,15)||@createInternalModuleById(15),{isTypedArray}=@requireNativeModule(\"node:util/types\"),{Duplex,Readable,Writable}=@getInternalField(@internalModuleRegistry,34)||@createInternalModuleById(34),headerCharRegex=/[^\\t\\x20-\\x7e\\x80-\\xff]/;function checkInvalidHeaderChar(val){return RegExpPrototypeExec.call(headerCharRegex,val)!==null}const validateHeaderName=(name,label)=>{if(typeof name!==\"string\"||!name||!checkIsHttpToken(name))throw new Error(\"ERR_INVALID_HTTP_TOKEN\")},validateHeaderValue=(name,value)=>{if(value===void 0)throw new Error(\"ERR_HTTP_INVALID_HEADER_VALUE\");if(checkInvalidHeaderChar(value))throw new Error(\"ERR_INVALID_CHAR\")};function isIPv6(input){return new RegExp(\"^((\?:(\?:[0-9a-fA-F]{1,4}):){7}(\?:(\?:[0-9a-fA-F]{1,4})|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){6}(\?:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|:(\?:[0-9a-fA-F]{1,4})|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){5}(\?::((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,2}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){4}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,1}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,3}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){3}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,2}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,4}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){2}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,3}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,5}|:)|(\?:(\?:[0-9a-fA-F]{1,4}):){1}(\?:(:(\?:[0-9a-fA-F]{1,4})){0,4}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(:(\?:[0-9a-fA-F]{1,4})){1,6}|:)|(\?::((\?::(\?:[0-9a-fA-F]{1,4})){0,5}:((\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(\?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|(\?::(\?:[0-9a-fA-F]{1,4})){1,7}|:)))(%[0-9a-zA-Z-.:]{1,})\?$\").test(input)}const{URL}=globalThis,globalReportError=globalThis.reportError,setTimeout=globalThis.setTimeout,fetch=Bun.fetch,nop=()=>{},kEmptyObject=Object.freeze(Object.create(null)),kOutHeaders=Symbol.for(\"kOutHeaders\"),kEndCalled=Symbol.for(\"kEndCalled\"),kAbortController=Symbol.for(\"kAbortController\"),kClearTimeout=Symbol(\"kClearTimeout\"),kCorked=Symbol.for(\"kCorked\"),searchParamsSymbol=Symbol.for(\"query\"),StringPrototypeSlice=String.prototype.slice,StringPrototypeStartsWith=String.prototype.startsWith,StringPrototypeToUpperCase=String.prototype.toUpperCase,StringPrototypeIncludes=String.prototype.includes,StringPrototypeCharCodeAt=String.prototype.charCodeAt,StringPrototypeIndexOf=String.prototype.indexOf,ArrayIsArray=Array.isArray,RegExpPrototypeExec=RegExp.prototype.exec,ObjectAssign=Object.assign,ObjectPrototypeHasOwnProperty=Object.prototype.hasOwnProperty,INVALID_PATH_REGEX=/[^\\u0021-\\u00ff]/,NODE_HTTP_WARNING=\"WARN: Agent is mostly unused in Bun's implementation of http. If you see strange behavior, this is probably the cause.\";var _defaultHTTPSAgent,kInternalRequest=Symbol(\"kInternalRequest\"),kInternalSocketData=Symbol.for(\"::bunternal::\");const kEmptyBuffer=Buffer.alloc(0);function isValidTLSArray(obj){if(typeof obj===\"string\"||isTypedArray(obj)||obj instanceof ArrayBuffer||obj instanceof Blob)return!0;if(Array.isArray(obj)){for(var i=0;i<obj.length;i++)if(typeof obj!==\"string\"&&!isTypedArray(obj)&&!(obj instanceof ArrayBuffer)&&!(obj instanceof Blob))return!1;return!0}}class ERR_INVALID_ARG_TYPE extends TypeError{constructor(name,expected,actual){super(`The ${name} argument must be of type ${expected}. Received type ${typeof actual}`);this.code=\"ERR_INVALID_ARG_TYPE\"}}function validateMsecs(numberlike,field){if(typeof numberlike!==\"number\"||numberlike<0)throw new ERR_INVALID_ARG_TYPE(field,\"number\",numberlike);return numberlike}function validateFunction(callable,field){if(typeof callable!==\"function\")throw new ERR_INVALID_ARG_TYPE(field,\"Function\",callable);return callable}function getHeader(headers,name){if(!headers)return;const result=headers.get(name);return result==null\?void 0:result}var FakeSocket=class Socket extends Duplex{bytesRead=0;bytesWritten=0;connecting=!1;remoteAddress=null;remotePort;timeout=0;isServer=!1;address(){return{address:this.localAddress,family:this.localFamily,port:this.localPort}}get bufferSize(){return this.writableLength}connect(port,host,connectListener){return this}_destroy(err,callback){}_final(callback){}get localAddress(){return\"127.0.0.1\"}get localFamily(){return\"IPv4\"}get localPort(){return 80}get pending(){return this.connecting}_read(size){}get readyState(){if(this.connecting)return\"opening\";if(this.readable)return this.writable\?\"open\":\"readOnly\";else return this.writable\?\"writeOnly\":\"closed\"}ref(){}get remoteFamily(){return\"IPv4\"}resetAndDestroy(){}setKeepAlive(enable=!1,initialDelay=0){}setNoDelay(noDelay=!0){return this}setTimeout(timeout,callback){return this}unref(){}_write(chunk,encoding,callback){}};function createServer(options,callback){return new Server(options,callback)}class Agent extends EventEmitter{defaultPort=80;protocol=\"http:\";options;requests;sockets;freeSockets;keepAliveMsecs;keepAlive;maxSockets;maxFreeSockets;scheduling;maxTotalSockets;totalSocketCount;#fakeSocket;static get globalAgent(){return globalAgent}static get defaultMaxSockets(){return Infinity}constructor(options=kEmptyObject){super();if(this.options=options={...options,path:null},options.noDelay===void 0)options.noDelay=!0;this.requests=kEmptyObject,this.sockets=kEmptyObject,this.freeSockets=kEmptyObject,this.keepAliveMsecs=options.keepAliveMsecs||1000,this.keepAlive=options.keepAlive||!1,this.maxSockets=options.maxSockets||Agent.defaultMaxSockets,this.maxFreeSockets=options.maxFreeSockets||256,this.scheduling=options.scheduling||\"lifo\",this.maxTotalSockets=options.maxTotalSockets,this.totalSocketCount=0,this.defaultPort=options.defaultPort||80,this.protocol=options.protocol||\"http:\"}createConnection(){return this.#fakeSocket\?\?=new FakeSocket}getName(options=kEmptyObject){let name=`http:${options.host||\"localhost\"}:`;if(options.port)name+=options.port;if(name+=\":\",options.localAddress)name+=options.localAddress;if(options.family===4||options.family===6)name+=`:${options.family}`;if(options.socketPath)name+=`:${options.socketPath}`;return name}addRequest(){}createSocket(req,options,cb){cb(null,this.#fakeSocket\?\?=new FakeSocket)}removeSocket(){}keepSocketAlive(){return!0}reuseSocket(){}destroy(){}}function emitListeningNextTick(self,onListen,err,hostname,port){if(typeof onListen===\"function\")try{onListen(err,hostname,port)}catch(err2){self.emit(\"error\",err2)}if(self.listening=!err,err)self.emit(\"error\",err);else self.emit(\"listening\",hostname,port)}class Server extends EventEmitter{#server;#options;#tls;#is_tls=!1;listening=!1;serverName;constructor(options,callback){super();if(typeof options===\"function\")callback=options,options={};else if(options==null||typeof options===\"object\"){options={...options},this.#tls=null;let key=options.key;if(key){if(!isValidTLSArray(key))@throwTypeError(\"key argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");this.#is_tls=!0}let cert=options.cert;if(cert){if(!isValidTLSArray(cert))@throwTypeError(\"cert argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");this.#is_tls=!0}let ca=options.ca;if(ca){if(!isValidTLSArray(ca))@throwTypeError(\"ca argument must be an string, Buffer, TypedArray, BunFile or an array containing string, Buffer, TypedArray or BunFile\");this.#is_tls=!0}let passphrase=options.passphrase;if(passphrase&&typeof passphrase!==\"string\")@throwTypeError(\"passphrase argument must be an string\");let serverName=options.servername;if(serverName&&typeof serverName!==\"string\")@throwTypeError(\"servername argument must be an string\");let secureOptions=options.secureOptions||0;if(secureOptions&&typeof secureOptions!==\"number\")@throwTypeError(\"secureOptions argument must be an number\");if(this.#is_tls)this.#tls={serverName,key,cert,ca,passphrase,secureOptions};else this.#tls=null}else throw new Error(\"bun-http-polyfill: invalid arguments\");if(this.#options=options,callback)this.on(\"request\",callback)}closeAllConnections(){const server=this.#server;if(!server)return;this.#server=void 0,server.stop(!0),this.emit(\"close\")}closeIdleConnections(){}close(optionalCallback){const server=this.#server;if(!server){if(typeof optionalCallback===\"function\")process.nextTick(optionalCallback,new Error(\"Server is not running\"));return}if(this.#server=void 0,typeof optionalCallback===\"function\")this.once(\"close\",optionalCallback);server.stop(),this.emit(\"close\")}address(){if(!this.#server)return null;const address=this.#server.hostname;return{address,family:isIPv6(address)\?\"IPv6\":\"IPv4\",port:this.#server.port}}listen(port,host,backlog,onListen){const server=this;if(typeof host===\"function\")onListen=host,host=void 0;if(typeof port===\"function\")onListen=port;else if(typeof port===\"object\"){if(port\?.signal\?.addEventListener(\"abort\",()=>{this.close()}),host=port\?.host,port=port\?.port,typeof port\?.callback===\"function\")onListen=port\?.callback}if(typeof backlog===\"function\")onListen=backlog;const ResponseClass=this.#options.ServerResponse||ServerResponse,RequestClass=this.#options.IncomingMessage||IncomingMessage;try{const tls=this.#tls;if(tls)this.serverName=tls.serverName||host||\"localhost\";this.#server=Bun.serve({tls,port,hostname:host,websocket:{open(ws){ws.data.open(ws)},message(ws,message){ws.data.message(ws,message)},close(ws,code,reason){ws.data.close(ws,code,reason)},drain(ws){ws.data.drain(ws)}},fetch(req,_server){var pendingResponse,pendingError,rejectFunction,resolveFunction,reject=(err)=>{if(pendingError)return;if(pendingError=err,rejectFunction)rejectFunction(err)},reply=function(resp){if(pendingResponse)return;if(pendingResponse=resp,resolveFunction)resolveFunction(resp)};const http_req=new RequestClass(req),http_res=new ResponseClass({reply,req:http_req});if(http_req.once(\"error\",(err)=>reject(err)),http_res.once(\"error\",(err)=>reject(err)),req.headers.get(\"upgrade\")){const socket=new FakeSocket;socket[kInternalSocketData]=[_server,http_res,req],server.emit(\"upgrade\",http_req,socket,kEmptyBuffer)}else server.emit(\"request\",http_req,http_res);if(pendingError)throw pendingError;if(pendingResponse)return pendingResponse;return new Promise((resolve,reject2)=>{resolveFunction=resolve,rejectFunction=reject2})}}),setTimeout(emitListeningNextTick,1,this,onListen,null,this.#server.hostname,this.#server.port)}catch(err){setTimeout(emitListeningNextTick,1,this,onListen,err)}return this}setTimeout(msecs,callback){}}function assignHeaders(object,req){var headers=req.headers.toJSON();const rawHeaders=@newArrayWithSize(req.headers.count*2);var i=0;for(let key in headers)rawHeaders[i++]=key,rawHeaders[i++]=headers[key];object.headers=headers,object.rawHeaders=rawHeaders}function destroyBodyStreamNT(bodyStream){bodyStream.destroy()}var defaultIncomingOpts={type:\"request\"};function getDefaultHTTPSAgent(){return _defaultHTTPSAgent\?\?=new Agent({defaultPort:443,protocol:\"https:\"})}class IncomingMessage extends Readable{method;complete;constructor(req,defaultIncomingOpts2){const method=req.method;super();const url=new URL(req.url);var{type=\"request\",[kInternalRequest]:nodeReq}=defaultIncomingOpts2||{};this.#noBody=type===\"request\"\?method===\"GET\"||method===\"HEAD\"||method===\"TRACE\"||method===\"CONNECT\"||method===\"OPTIONS\"||(parseInt(req.headers.get(\"Content-Length\")||\"\")||0)===0:!1,this.#req=req,this.method=method,this.#type=type,this.complete=!!this.#noBody,this.#bodyStream=void 0;const socket=new FakeSocket;socket.remoteAddress=url.hostname,socket.remotePort=url.port,this.#fakeSocket=socket,this.url=url.pathname+url.search,this.#nodeReq=nodeReq,assignHeaders(this,req)}headers;rawHeaders;_consuming=!1;_dumped=!1;#bodyStream;#fakeSocket;#noBody=!1;#aborted=!1;#req;url;#type;#nodeReq;get req(){return this.#nodeReq}_construct(callback){if(this.#type===\"response\"||this.#noBody){callback();return}const contentLength=this.#req.headers.get(\"content-length\");if((contentLength\?parseInt(contentLength,10):0)===0){this.#noBody=!0,callback();return}callback()}async#consumeStream(reader){while(!0){var{done,value}=await reader.readMany();if(this.#aborted)return;if(done){this.push(null),this.destroy();break}for(var v of value)this.push(v)}}_read(size){if(this.#noBody)this.push(null),this.complete=!0;else if(this.#bodyStream==null){const reader=this.#req.body\?.getReader();if(!reader){this.push(null);return}this.#bodyStream=reader,this.#consumeStream(reader)}}get aborted(){return this.#aborted}#abort(){if(this.#aborted)return;this.#aborted=!0;var bodyStream=this.#bodyStream;if(!bodyStream)return;bodyStream.cancel(),this.complete=!0,this.#bodyStream=void 0,this.push(null)}get connection(){return this.#fakeSocket}get statusCode(){return this.#req.status}get statusMessage(){return STATUS_CODES[this.#req.status]}get httpVersion(){return\"1.1\"}get rawTrailers(){return[]}get httpVersionMajor(){return 1}get httpVersionMinor(){return 1}get trailers(){return kEmptyObject}get socket(){return this.#fakeSocket\?\?=new FakeSocket}set socket(val){this.#fakeSocket=val}setTimeout(msecs,callback){throw new Error(\"not implemented\")}}function emitErrorNt(msg,err,callback){if(callback(err),typeof msg.emit===\"function\"&&!msg._closed)msg.emit(\"error\",err)}function onError(self,err,cb){process.nextTick(()=>emitErrorNt(self,err,cb))}function write_(msg,chunk,encoding,callback,fromEnd){if(typeof callback!==\"function\")callback=nop;let len;if(chunk===null)throw new Error(\"ERR_STREAM_NULL_VALUES\");else if(typeof chunk===\"string\")len=Buffer.byteLength(chunk,encoding);else throw new Error(\"Invalid arg type for chunk\");let err;if(msg.finished)err=new Error(\"ERR_STREAM_WRITE_AFTER_END\");else if(msg.destroyed)err=new Error(\"ERR_STREAM_DESTROYED\");if(err){if(!msg.destroyed)onError(msg,err,callback);else process.nextTick(callback,err);return!1}if(!msg._header){if(fromEnd)msg._contentLength=len}if(!msg._hasBody)return process.nextTick(callback),!0;return!0}class OutgoingMessage extends Writable{constructor(){super(...arguments)}#headers;headersSent=!1;sendDate=!0;req;timeout;#finished=!1;[kEndCalled]=!1;#fakeSocket;#timeoutTimer;[kAbortController]=null;_implicitHeader(){}get headers(){if(!this.#headers)return kEmptyObject;return this.#headers.toJSON()}get shouldKeepAlive(){return!0}get chunkedEncoding(){return!1}set chunkedEncoding(value){}set shouldKeepAlive(value){}get useChunkedEncodingByDefault(){return!0}set useChunkedEncodingByDefault(value){}get socket(){return this.#fakeSocket\?\?=new FakeSocket}set socket(val){this.#fakeSocket=val}get connection(){return this.socket}get finished(){return this.#finished}appendHeader(name,value){var headers=this.#headers\?\?=new Headers;headers.append(name,value)}flushHeaders(){}getHeader(name){return getHeader(this.#headers,name)}getHeaders(){if(!this.#headers)return kEmptyObject;return this.#headers.toJSON()}getHeaderNames(){var headers=this.#headers;if(!headers)return[];return Array.from(headers.keys())}removeHeader(name){if(!this.#headers)return;this.#headers.delete(name)}setHeader(name,value){var headers=this.#headers\?\?=new Headers;return headers.set(name,value),this}hasHeader(name){if(!this.#headers)return!1;return this.#headers.has(name)}addTrailers(headers){throw new Error(\"not implemented\")}[kClearTimeout](){if(this.#timeoutTimer)clearTimeout(this.#timeoutTimer),this.removeAllListeners(\"timeout\"),this.#timeoutTimer=void 0}#onTimeout(){this.#timeoutTimer=void 0,this[kAbortController]\?.abort(),this.emit(\"timeout\")}setTimeout(msecs,callback){if(this.destroyed)return this;if(this.timeout=msecs=validateMsecs(msecs,\"msecs\"),clearTimeout(this.#timeoutTimer),msecs===0){if(callback!==void 0)validateFunction(callback,\"callback\"),this.removeListener(\"timeout\",callback);this.#timeoutTimer=void 0}else if(this.#timeoutTimer=setTimeout(this.#onTimeout.bind(this),msecs).unref(),callback!==void 0)validateFunction(callback,\"callback\"),this.once(\"timeout\",callback);return this}}let OriginalWriteHeadFn,OriginalImplicitHeadFn;class ServerResponse extends Writable{constructor({req,reply}){super();if(this.req=req,this._reply=reply,this.sendDate=!0,this.statusCode=200,this.headersSent=!1,this.statusMessage=void 0,this.#controller=void 0,this.#firstWrite=void 0,this._writableState.decodeStrings=!1,this.#deferred=void 0,req.method===\"HEAD\")this._hasBody=!1}req;_reply;sendDate;statusCode;#headers;headersSent=!1;statusMessage;#controller;#firstWrite;_sent100=!1;_defaultKeepAlive=!1;_removedConnection=!1;_removedContLen=!1;_hasBody=!0;#deferred=void 0;#finished=!1;_implicitHeader(){this.writeHead(this.statusCode)}_write(chunk,encoding,callback){if(!this.#firstWrite&&!this.headersSent){this.#firstWrite=chunk,callback();return}this.#ensureReadableStreamController((controller)=>{controller.write(chunk),callback()})}_writev(chunks,callback){if(chunks.length===1&&!this.headersSent&&!this.#firstWrite){this.#firstWrite=chunks[0].chunk,callback();return}this.#ensureReadableStreamController((controller)=>{for(let chunk of chunks)controller.write(chunk.chunk);callback()})}#ensureReadableStreamController(run){var thisController=this.#controller;if(thisController)return run(thisController);this.headersSent=!0;var firstWrite=this.#firstWrite;this.#firstWrite=void 0,this._reply(new Response(new ReadableStream({type:\"direct\",pull:(controller)=>{if(this.#controller=controller,firstWrite)controller.write(firstWrite);if(firstWrite=void 0,run(controller),!this.#finished)return new Promise((resolve)=>{this.#deferred=resolve})}}),{headers:this.#headers,status:this.statusCode,statusText:this.statusMessage\?\?STATUS_CODES[this.statusCode]}))}#drainHeadersIfObservable(){if(this._implicitHeader===OriginalImplicitHeadFn&&this.writeHead===OriginalWriteHeadFn)return;this._implicitHeader()}_final(callback){if(!this.headersSent){var data=this.#firstWrite||\"\";this.#firstWrite=void 0,this.#finished=!0,this.#drainHeadersIfObservable(),this._reply(new Response(data,{headers:this.#headers,status:this.statusCode,statusText:this.statusMessage\?\?STATUS_CODES[this.statusCode]})),callback&&callback();return}this.#finished=!0,this.#ensureReadableStreamController((controller)=>{controller.end(),callback();var deferred=this.#deferred;if(deferred)this.#deferred=void 0,deferred()})}writeProcessing(){throw new Error(\"not implemented\")}addTrailers(headers){throw new Error(\"not implemented\")}assignSocket(socket){throw new Error(\"not implemented\")}detachSocket(socket){throw new Error(\"not implemented\")}writeContinue(callback){throw new Error(\"not implemented\")}setTimeout(msecs,callback){throw new Error(\"not implemented\")}get shouldKeepAlive(){return!0}get chunkedEncoding(){return!1}set chunkedEncoding(value){}set shouldKeepAlive(value){}get useChunkedEncodingByDefault(){return!0}set useChunkedEncodingByDefault(value){}appendHeader(name,value){var headers=this.#headers\?\?=new Headers;headers.append(name,value)}flushHeaders(){}getHeader(name){return getHeader(this.#headers,name)}getHeaders(){var headers=this.#headers;if(!headers)return kEmptyObject;return headers.toJSON()}getHeaderNames(){var headers=this.#headers;if(!headers)return[];return Array.from(headers.keys())}removeHeader(name){if(!this.#headers)return;this.#headers.delete(name)}setHeader(name,value){var headers=this.#headers\?\?=new Headers;return headers.set(name,value),this}hasHeader(name){if(!this.#headers)return!1;return this.#headers.has(name)}writeHead(statusCode,statusMessage,headers){return _writeHead(statusCode,statusMessage,headers,this),this}}OriginalWriteHeadFn=ServerResponse.prototype.writeHead,OriginalImplicitHeadFn=ServerResponse.prototype._implicitHeader;class ClientRequest extends OutgoingMessage{#timeout;#res=null;#upgradeOrConnect=!1;#parser=null;#maxHeadersCount=null;#reusedSocket=!1;#host;#protocol;#method;#port;#useDefaultPort;#joinDuplicateHeaders;#maxHeaderSize;#agent=globalAgent;#path;#socketPath;#bodyChunks=null;#fetchRequest;#signal=null;[kAbortController]=null;#timeoutTimer=void 0;#options;#finished;get path(){return this.#path}get port(){return this.#port}get method(){return this.#method}get host(){return this.#host}get protocol(){return this.#protocol}_write(chunk,encoding,callback){if(!this.#bodyChunks){this.#bodyChunks=[chunk],callback();return}this.#bodyChunks.push(chunk),callback()}_writev(chunks,callback){if(!this.#bodyChunks){this.#bodyChunks=chunks,callback();return}this.#bodyChunks.push(...chunks),callback()}_final(callback){if(this.#finished=!0,this[kAbortController]=new AbortController,this[kAbortController].signal.addEventListener(\"abort\",()=>{this[kClearTimeout]()}),this.#signal\?.aborted)this[kAbortController].abort();var method=this.#method,body=this.#bodyChunks\?.length===1\?this.#bodyChunks[0]:Buffer.concat(this.#bodyChunks||[]);try{this.#fetchRequest=fetch(`${this.#protocol}//${this.#host}${this.#useDefaultPort\?\"\":\":\"+this.#port}${this.#path}`,{method,headers:this.getHeaders(),body:body&&method!==\"GET\"&&method!==\"HEAD\"&&method!==\"OPTIONS\"\?body:void 0,redirect:\"manual\",verbose:!1,signal:this[kAbortController].signal,timeout:!1}).then((response)=>{var res=this.#res=new IncomingMessage(response,{type:\"response\",[kInternalRequest]:this});this.emit(\"response\",res)}).catch((err)=>{this.emit(\"error\",err)}).finally(()=>{this.#fetchRequest=null,this[kClearTimeout]()})}catch(err){this.emit(\"error\",err)}finally{callback()}}get aborted(){return this.#signal\?.aborted||!!this[kAbortController]\?.signal.aborted}abort(){if(this.aborted)return;this[kAbortController].abort()}constructor(input,options,cb){super();if(typeof input===\"string\"){const urlStr=input;try{var urlObject=new URL(urlStr)}catch(e){@throwTypeError(`Invalid URL: ${urlStr}`)}input=urlToHttpOptions(urlObject)}else if(input&&typeof input===\"object\"&&input instanceof URL)input=urlToHttpOptions(input);else cb=options,options=input,input=null;if(typeof options===\"function\")cb=options,options=input||kEmptyObject;else options=ObjectAssign(input||{},options);var defaultAgent=options._defaultAgent||Agent.globalAgent;let protocol=options.protocol;if(!protocol)if(options.port===443)protocol=\"https:\";else protocol=defaultAgent.protocol||\"http:\";switch(this.#protocol=protocol,this.#agent\?.protocol){case void 0:break;case\"http:\":if(protocol===\"https:\"){defaultAgent=this.#agent=getDefaultHTTPSAgent();break}case\"https:\":if(protocol===\"https\"){defaultAgent=this.#agent=Agent.globalAgent;break}default:break}if(options.path){const path=String(options.path);if(RegExpPrototypeExec.call(INVALID_PATH_REGEX,path)!==null)throw new Error(\"Path contains unescaped characters\")}if(protocol!==\"http:\"&&protocol!==\"https:\"&&protocol){const expectedProtocol=defaultAgent\?.protocol\?\?\"http:\";throw new Error(`Protocol mismatch. Expected: ${expectedProtocol}. Got: ${protocol}`)}const defaultPort=protocol===\"https:\"\?443:80;this.#port=options.port||options.defaultPort||this.#agent\?.defaultPort||defaultPort,this.#useDefaultPort=this.#port===defaultPort;const host=this.#host=options.host=validateHost(options.hostname,\"hostname\")||validateHost(options.host,\"host\")||\"localhost\";this.#socketPath=options.socketPath;const signal=options.signal;if(signal)signal.addEventListener(\"abort\",()=>{this[kAbortController]\?.abort()}),this.#signal=signal;let method=options.method;const methodIsString=typeof method===\"string\";if(method!==null&&method!==void 0&&!methodIsString)throw new Error(\"ERR_INVALID_ARG_TYPE: options.method\");if(methodIsString&&method){if(!checkIsHttpToken(method))throw new Error(\"ERR_INVALID_HTTP_TOKEN: Method\");method=this.#method=StringPrototypeToUpperCase.call(method)}else method=this.#method=\"GET\";const _maxHeaderSize=options.maxHeaderSize;this.#maxHeaderSize=_maxHeaderSize;var _joinDuplicateHeaders=options.joinDuplicateHeaders;if(this.#joinDuplicateHeaders=_joinDuplicateHeaders,this.#path=options.path||\"/\",cb)this.once(\"response\",cb);this.#finished=!1,this.#res=null,this.#upgradeOrConnect=!1,this.#parser=null,this.#maxHeadersCount=null,this.#reusedSocket=!1,this.#host=host,this.#protocol=protocol;var timeout=options.timeout;if(timeout!==void 0&&timeout!==0)this.setTimeout(timeout,void 0);if(!ArrayIsArray(headers)){var headers=options.headers;if(headers)for(let key in headers)this.setHeader(key,headers[key]);var auth=options.auth;if(auth&&!this.getHeader(\"Authorization\"))this.setHeader(\"Authorization\",\"Basic \"+Buffer.from(auth).toString(\"base64\"))}var{signal:_signal,...optsWithoutSignal}=options;this.#options=optsWithoutSignal}setSocketKeepAlive(enable=!0,initialDelay=0){}setNoDelay(noDelay=!0){}[kClearTimeout](){if(this.#timeoutTimer)clearTimeout(this.#timeoutTimer),this.#timeoutTimer=void 0,this.removeAllListeners(\"timeout\")}#onTimeout(){this.#timeoutTimer=void 0,this[kAbortController]\?.abort(),this.emit(\"timeout\")}setTimeout(msecs,callback){if(this.destroyed)return this;if(this.timeout=msecs=validateMsecs(msecs,\"msecs\"),clearTimeout(this.#timeoutTimer),msecs===0){if(callback!==void 0)validateFunction(callback,\"callback\"),this.removeListener(\"timeout\",callback);this.#timeoutTimer=void 0}else if(this.#timeoutTimer=setTimeout(this.#onTimeout.bind(this),msecs).unref(),callback!==void 0)validateFunction(callback,\"callback\"),this.once(\"timeout\",callback);return this}}function urlToHttpOptions(url){var{protocol,hostname,hash,search,pathname,href,port,username,password}=url;return{protocol,hostname:typeof hostname===\"string\"&&StringPrototypeStartsWith.call(hostname,\"[\")\?StringPrototypeSlice.call(hostname,1,-1):hostname,hash,search,pathname,path:`${pathname||\"\"}${search||\"\"}`,href,port:port\?Number(port):protocol===\"https:\"\?443:protocol===\"http:\"\?80:void 0,auth:username||password\?`${decodeURIComponent(username)}:${decodeURIComponent(password)}`:void 0}}function validateHost(host,name){if(host!==null&&host!==void 0&&typeof host!==\"string\")throw new Error(\"Invalid arg type in options\");return host}const tokenRegExp=/^[\\^_`a-zA-Z\\-0-9!#$%&'*+.|~]+$/;function checkIsHttpToken(val){return RegExpPrototypeExec.call(tokenRegExp,val)!==null}const METHODS=[\"ACL\",\"BIND\",\"CHECKOUT\",\"CONNECT\",\"COPY\",\"DELETE\",\"GET\",\"HEAD\",\"LINK\",\"LOCK\",\"M-SEARCH\",\"MERGE\",\"MKACTIVITY\",\"MKCALENDAR\",\"MKCOL\",\"MOVE\",\"NOTIFY\",\"OPTIONS\",\"PATCH\",\"POST\",\"PROPFIND\",\"PROPPATCH\",\"PURGE\",\"PUT\",\"REBIND\",\"REPORT\",\"SEARCH\",\"SOURCE\",\"SUBSCRIBE\",\"TRACE\",\"UNBIND\",\"UNLINK\",\"UNLOCK\",\"UNSUBSCRIBE\"],STATUS_CODES={100:\"Continue\",101:\"Switching Protocols\",102:\"Processing\",103:\"Early Hints\",200:\"OK\",201:\"Created\",202:\"Accepted\",203:\"Non-Authoritative Information\",204:\"No Content\",205:\"Reset Content\",206:\"Partial Content\",207:\"Multi-Status\",208:\"Already Reported\",226:\"IM Used\",300:\"Multiple Choices\",301:\"Moved Permanently\",302:\"Found\",303:\"See Other\",304:\"Not Modified\",305:\"Use Proxy\",307:\"Temporary Redirect\",308:\"Permanent Redirect\",400:\"Bad Request\",401:\"Unauthorized\",402:\"Payment Required\",403:\"Forbidden\",404:\"Not Found\",405:\"Method Not Allowed\",406:\"Not Acceptable\",407:\"Proxy Authentication Required\",408:\"Request Timeout\",409:\"Conflict\",410:\"Gone\",411:\"Length Required\",412:\"Precondition Failed\",413:\"Payload Too Large\",414:\"URI Too Long\",415:\"Unsupported Media Type\",416:\"Range Not Satisfiable\",417:\"Expectation Failed\",418:\"I'm a Teapot\",421:\"Misdirected Request\",422:\"Unprocessable Entity\",423:\"Locked\",424:\"Failed Dependency\",425:\"Too Early\",426:\"Upgrade Required\",428:\"Precondition Required\",429:\"Too Many Requests\",431:\"Request Header Fields Too Large\",451:\"Unavailable For Legal Reasons\",500:\"Internal Server Error\",501:\"Not Implemented\",502:\"Bad Gateway\",503:\"Service Unavailable\",504:\"Gateway Timeout\",505:\"HTTP Version Not Supported\",506:\"Variant Also Negotiates\",507:\"Insufficient Storage\",508:\"Loop Detected\",509:\"Bandwidth Limit Exceeded\",510:\"Not Extended\",511:\"Network Authentication Required\"};function _normalizeArgs(args){let arr;if(args.length===0)return arr=[{},null],arr;const arg0=args[0];let options={};if(typeof arg0===\"object\"&&arg0!==null)options=arg0;else if(options.port=arg0,args.length>1&&typeof args[1]===\"string\")options.host=args[1];const cb=args[args.length-1];if(typeof cb!==\"function\")arr=[options,null];else arr=[options,cb];return arr}function _writeHead(statusCode,reason,obj,response){if(statusCode|=0,statusCode<100||statusCode>999)throw new Error(\"status code must be between 100 and 999\");if(typeof reason===\"string\")response.statusMessage=reason;else{if(!response.statusMessage)response.statusMessage=STATUS_CODES[statusCode]||\"unknown\";obj=reason}response.statusCode=statusCode;{let k;if(Array.isArray(obj)){if(obj.length%2!==0)throw new Error(\"raw headers must have an even number of elements\");for(let n=0;n<obj.length;n+=2)if(k=obj[n+0],k)response.setHeader(k,obj[n+1])}else if(obj){const keys=Object.keys(obj);for(let i=0;i<keys.length;i++)if(k=keys[i],k)response.setHeader(k,obj[k])}}if(statusCode===204||statusCode===304||statusCode>=100&&statusCode<=199)response._hasBody=!1}function request(url,options,cb){return new ClientRequest(url,options,cb)}function get(url,options,cb){const req=request(url,options,cb);return req.end(),req}var globalAgent=new Agent;return $={Agent,Server,METHODS,STATUS_CODES,createServer,ServerResponse,IncomingMessage,request,get,maxHeaderSize:16384,validateHeaderName,validateHeaderValue,setMaxIdleHTTPParsers(max){},globalAgent,ClientRequest,OutgoingMessage},$})\n"_s; static constexpr ASCIILiteral NodeHttp2Code = "(function (){\"use strict\";var $;const{hideFromStack,throwNotImplemented}=@getInternalField(@internalModuleRegistry,2)||@createInternalModuleById(2);function connect(){throwNotImplemented(\"node:http2 connect\",887)}const constants={NGHTTP2_ERR_FRAME_SIZE_ERROR:-522,NGHTTP2_SESSION_SERVER:0,NGHTTP2_SESSION_CLIENT:1,NGHTTP2_STREAM_STATE_IDLE:1,NGHTTP2_STREAM_STATE_OPEN:2,NGHTTP2_STREAM_STATE_RESERVED_LOCAL:3,NGHTTP2_STREAM_STATE_RESERVED_REMOTE:4,NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL:5,NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE:6,NGHTTP2_STREAM_STATE_CLOSED:7,NGHTTP2_FLAG_NONE:0,NGHTTP2_FLAG_END_STREAM:1,NGHTTP2_FLAG_END_HEADERS:4,NGHTTP2_FLAG_ACK:1,NGHTTP2_FLAG_PADDED:8,NGHTTP2_FLAG_PRIORITY:32,DEFAULT_SETTINGS_HEADER_TABLE_SIZE:4096,DEFAULT_SETTINGS_ENABLE_PUSH:1,DEFAULT_SETTINGS_MAX_CONCURRENT_STREAMS:4294967295,DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE:65535,DEFAULT_SETTINGS_MAX_FRAME_SIZE:16384,DEFAULT_SETTINGS_MAX_HEADER_LIST_SIZE:65535,DEFAULT_SETTINGS_ENABLE_CONNECT_PROTOCOL:0,MAX_MAX_FRAME_SIZE:16777215,MIN_MAX_FRAME_SIZE:16384,MAX_INITIAL_WINDOW_SIZE:2147483647,NGHTTP2_SETTINGS_HEADER_TABLE_SIZE:1,NGHTTP2_SETTINGS_ENABLE_PUSH:2,NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS:3,NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE:4,NGHTTP2_SETTINGS_MAX_FRAME_SIZE:5,NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE:6,NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:8,PADDING_STRATEGY_NONE:0,PADDING_STRATEGY_ALIGNED:1,PADDING_STRATEGY_MAX:2,PADDING_STRATEGY_CALLBACK:1,NGHTTP2_NO_ERROR:0,NGHTTP2_PROTOCOL_ERROR:1,NGHTTP2_INTERNAL_ERROR:2,NGHTTP2_FLOW_CONTROL_ERROR:3,NGHTTP2_SETTINGS_TIMEOUT:4,NGHTTP2_STREAM_CLOSED:5,NGHTTP2_FRAME_SIZE_ERROR:6,NGHTTP2_REFUSED_STREAM:7,NGHTTP2_CANCEL:8,NGHTTP2_COMPRESSION_ERROR:9,NGHTTP2_CONNECT_ERROR:10,NGHTTP2_ENHANCE_YOUR_CALM:11,NGHTTP2_INADEQUATE_SECURITY:12,NGHTTP2_HTTP_1_1_REQUIRED:13,NGHTTP2_DEFAULT_WEIGHT:16,HTTP2_HEADER_STATUS:\":status\",HTTP2_HEADER_METHOD:\":method\",HTTP2_HEADER_AUTHORITY:\":authority\",HTTP2_HEADER_SCHEME:\":scheme\",HTTP2_HEADER_PATH:\":path\",HTTP2_HEADER_PROTOCOL:\":protocol\",HTTP2_HEADER_ACCEPT_ENCODING:\"accept-encoding\",HTTP2_HEADER_ACCEPT_LANGUAGE:\"accept-language\",HTTP2_HEADER_ACCEPT_RANGES:\"accept-ranges\",HTTP2_HEADER_ACCEPT:\"accept\",HTTP2_HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS:\"access-control-allow-credentials\",HTTP2_HEADER_ACCESS_CONTROL_ALLOW_HEADERS:\"access-control-allow-headers\",HTTP2_HEADER_ACCESS_CONTROL_ALLOW_METHODS:\"access-control-allow-methods\",HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN:\"access-control-allow-origin\",HTTP2_HEADER_ACCESS_CONTROL_EXPOSE_HEADERS:\"access-control-expose-headers\",HTTP2_HEADER_ACCESS_CONTROL_REQUEST_HEADERS:\"access-control-request-headers\",HTTP2_HEADER_ACCESS_CONTROL_REQUEST_METHOD:\"access-control-request-method\",HTTP2_HEADER_AGE:\"age\",HTTP2_HEADER_AUTHORIZATION:\"authorization\",HTTP2_HEADER_CACHE_CONTROL:\"cache-control\",HTTP2_HEADER_CONNECTION:\"connection\",HTTP2_HEADER_CONTENT_DISPOSITION:\"content-disposition\",HTTP2_HEADER_CONTENT_ENCODING:\"content-encoding\",HTTP2_HEADER_CONTENT_LENGTH:\"content-length\",HTTP2_HEADER_CONTENT_TYPE:\"content-type\",HTTP2_HEADER_COOKIE:\"cookie\",HTTP2_HEADER_DATE:\"date\",HTTP2_HEADER_ETAG:\"etag\",HTTP2_HEADER_FORWARDED:\"forwarded\",HTTP2_HEADER_HOST:\"host\",HTTP2_HEADER_IF_MODIFIED_SINCE:\"if-modified-since\",HTTP2_HEADER_IF_NONE_MATCH:\"if-none-match\",HTTP2_HEADER_IF_RANGE:\"if-range\",HTTP2_HEADER_LAST_MODIFIED:\"last-modified\",HTTP2_HEADER_LINK:\"link\",HTTP2_HEADER_LOCATION:\"location\",HTTP2_HEADER_RANGE:\"range\",HTTP2_HEADER_REFERER:\"referer\",HTTP2_HEADER_SERVER:\"server\",HTTP2_HEADER_SET_COOKIE:\"set-cookie\",HTTP2_HEADER_STRICT_TRANSPORT_SECURITY:\"strict-transport-security\",HTTP2_HEADER_TRANSFER_ENCODING:\"transfer-encoding\",HTTP2_HEADER_TE:\"te\",HTTP2_HEADER_UPGRADE_INSECURE_REQUESTS:\"upgrade-insecure-requests\",HTTP2_HEADER_UPGRADE:\"upgrade\",HTTP2_HEADER_USER_AGENT:\"user-agent\",HTTP2_HEADER_VARY:\"vary\",HTTP2_HEADER_X_CONTENT_TYPE_OPTIONS:\"x-content-type-options\",HTTP2_HEADER_X_FRAME_OPTIONS:\"x-frame-options\",HTTP2_HEADER_KEEP_ALIVE:\"keep-alive\",HTTP2_HEADER_PROXY_CONNECTION:\"proxy-connection\",HTTP2_HEADER_X_XSS_PROTECTION:\"x-xss-protection\",HTTP2_HEADER_ALT_SVC:\"alt-svc\",HTTP2_HEADER_CONTENT_SECURITY_POLICY:\"content-security-policy\",HTTP2_HEADER_EARLY_DATA:\"early-data\",HTTP2_HEADER_EXPECT_CT:\"expect-ct\",HTTP2_HEADER_ORIGIN:\"origin\",HTTP2_HEADER_PURPOSE:\"purpose\",HTTP2_HEADER_TIMING_ALLOW_ORIGIN:\"timing-allow-origin\",HTTP2_HEADER_X_FORWARDED_FOR:\"x-forwarded-for\",HTTP2_HEADER_PRIORITY:\"priority\",HTTP2_HEADER_ACCEPT_CHARSET:\"accept-charset\",HTTP2_HEADER_ACCESS_CONTROL_MAX_AGE:\"access-control-max-age\",HTTP2_HEADER_ALLOW:\"allow\",HTTP2_HEADER_CONTENT_LANGUAGE:\"content-language\",HTTP2_HEADER_CONTENT_LOCATION:\"content-location\",HTTP2_HEADER_CONTENT_MD5:\"content-md5\",HTTP2_HEADER_CONTENT_RANGE:\"content-range\",HTTP2_HEADER_DNT:\"dnt\",HTTP2_HEADER_EXPECT:\"expect\",HTTP2_HEADER_EXPIRES:\"expires\",HTTP2_HEADER_FROM:\"from\",HTTP2_HEADER_IF_MATCH:\"if-match\",HTTP2_HEADER_IF_UNMODIFIED_SINCE:\"if-unmodified-since\",HTTP2_HEADER_MAX_FORWARDS:\"max-forwards\",HTTP2_HEADER_PREFER:\"prefer\",HTTP2_HEADER_PROXY_AUTHENTICATE:\"proxy-authenticate\",HTTP2_HEADER_PROXY_AUTHORIZATION:\"proxy-authorization\",HTTP2_HEADER_REFRESH:\"refresh\",HTTP2_HEADER_RETRY_AFTER:\"retry-after\",HTTP2_HEADER_TRAILER:\"trailer\",HTTP2_HEADER_TK:\"tk\",HTTP2_HEADER_VIA:\"via\",HTTP2_HEADER_WARNING:\"warning\",HTTP2_HEADER_WWW_AUTHENTICATE:\"www-authenticate\",HTTP2_HEADER_HTTP2_SETTINGS:\"http2-settings\",HTTP2_METHOD_ACL:\"ACL\",HTTP2_METHOD_BASELINE_CONTROL:\"BASELINE-CONTROL\",HTTP2_METHOD_BIND:\"BIND\",HTTP2_METHOD_CHECKIN:\"CHECKIN\",HTTP2_METHOD_CHECKOUT:\"CHECKOUT\",HTTP2_METHOD_CONNECT:\"CONNECT\",HTTP2_METHOD_COPY:\"COPY\",HTTP2_METHOD_DELETE:\"DELETE\",HTTP2_METHOD_GET:\"GET\",HTTP2_METHOD_HEAD:\"HEAD\",HTTP2_METHOD_LABEL:\"LABEL\",HTTP2_METHOD_LINK:\"LINK\",HTTP2_METHOD_LOCK:\"LOCK\",HTTP2_METHOD_MERGE:\"MERGE\",HTTP2_METHOD_MKACTIVITY:\"MKACTIVITY\",HTTP2_METHOD_MKCALENDAR:\"MKCALENDAR\",HTTP2_METHOD_MKCOL:\"MKCOL\",HTTP2_METHOD_MKREDIRECTREF:\"MKREDIRECTREF\",HTTP2_METHOD_MKWORKSPACE:\"MKWORKSPACE\",HTTP2_METHOD_MOVE:\"MOVE\",HTTP2_METHOD_OPTIONS:\"OPTIONS\",HTTP2_METHOD_ORDERPATCH:\"ORDERPATCH\",HTTP2_METHOD_PATCH:\"PATCH\",HTTP2_METHOD_POST:\"POST\",HTTP2_METHOD_PRI:\"PRI\",HTTP2_METHOD_PROPFIND:\"PROPFIND\",HTTP2_METHOD_PROPPATCH:\"PROPPATCH\",HTTP2_METHOD_PUT:\"PUT\",HTTP2_METHOD_REBIND:\"REBIND\",HTTP2_METHOD_REPORT:\"REPORT\",HTTP2_METHOD_SEARCH:\"SEARCH\",HTTP2_METHOD_TRACE:\"TRACE\",HTTP2_METHOD_UNBIND:\"UNBIND\",HTTP2_METHOD_UNCHECKOUT:\"UNCHECKOUT\",HTTP2_METHOD_UNLINK:\"UNLINK\",HTTP2_METHOD_UNLOCK:\"UNLOCK\",HTTP2_METHOD_UPDATE:\"UPDATE\",HTTP2_METHOD_UPDATEREDIRECTREF:\"UPDATEREDIRECTREF\",HTTP2_METHOD_VERSION_CONTROL:\"VERSION-CONTROL\",HTTP_STATUS_CONTINUE:100,HTTP_STATUS_SWITCHING_PROTOCOLS:101,HTTP_STATUS_PROCESSING:102,HTTP_STATUS_EARLY_HINTS:103,HTTP_STATUS_OK:200,HTTP_STATUS_CREATED:201,HTTP_STATUS_ACCEPTED:202,HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION:203,HTTP_STATUS_NO_CONTENT:204,HTTP_STATUS_RESET_CONTENT:205,HTTP_STATUS_PARTIAL_CONTENT:206,HTTP_STATUS_MULTI_STATUS:207,HTTP_STATUS_ALREADY_REPORTED:208,HTTP_STATUS_IM_USED:226,HTTP_STATUS_MULTIPLE_CHOICES:300,HTTP_STATUS_MOVED_PERMANENTLY:301,HTTP_STATUS_FOUND:302,HTTP_STATUS_SEE_OTHER:303,HTTP_STATUS_NOT_MODIFIED:304,HTTP_STATUS_USE_PROXY:305,HTTP_STATUS_TEMPORARY_REDIRECT:307,HTTP_STATUS_PERMANENT_REDIRECT:308,HTTP_STATUS_BAD_REQUEST:400,HTTP_STATUS_UNAUTHORIZED:401,HTTP_STATUS_PAYMENT_REQUIRED:402,HTTP_STATUS_FORBIDDEN:403,HTTP_STATUS_NOT_FOUND:404,HTTP_STATUS_METHOD_NOT_ALLOWED:405,HTTP_STATUS_NOT_ACCEPTABLE:406,HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED:407,HTTP_STATUS_REQUEST_TIMEOUT:408,HTTP_STATUS_CONFLICT:409,HTTP_STATUS_GONE:410,HTTP_STATUS_LENGTH_REQUIRED:411,HTTP_STATUS_PRECONDITION_FAILED:412,HTTP_STATUS_PAYLOAD_TOO_LARGE:413,HTTP_STATUS_URI_TOO_LONG:414,HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE:415,HTTP_STATUS_RANGE_NOT_SATISFIABLE:416,HTTP_STATUS_EXPECTATION_FAILED:417,HTTP_STATUS_TEAPOT:418,HTTP_STATUS_MISDIRECTED_REQUEST:421,HTTP_STATUS_UNPROCESSABLE_ENTITY:422,HTTP_STATUS_LOCKED:423,HTTP_STATUS_FAILED_DEPENDENCY:424,HTTP_STATUS_TOO_EARLY:425,HTTP_STATUS_UPGRADE_REQUIRED:426,HTTP_STATUS_PRECONDITION_REQUIRED:428,HTTP_STATUS_TOO_MANY_REQUESTS:429,HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE:431,HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS:451,HTTP_STATUS_INTERNAL_SERVER_ERROR:500,HTTP_STATUS_NOT_IMPLEMENTED:501,HTTP_STATUS_BAD_GATEWAY:502,HTTP_STATUS_SERVICE_UNAVAILABLE:503,HTTP_STATUS_GATEWAY_TIMEOUT:504,HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED:505,HTTP_STATUS_VARIANT_ALSO_NEGOTIATES:506,HTTP_STATUS_INSUFFICIENT_STORAGE:507,HTTP_STATUS_LOOP_DETECTED:508,HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED:509,HTTP_STATUS_NOT_EXTENDED:510,HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED:511};function createServer(){throwNotImplemented(\"node:http2 createServer\",887)}function createSecureServer(){throwNotImplemented(\"node:http2 createSecureServer\",887)}function getDefaultSettings(){return{headerTableSize:4096,enablePush:!0,initialWindowSize:65535,maxFrameSize:16384,maxConcurrentStreams:4294967295,maxHeaderSize:65535,maxHeaderListSize:65535,enableConnectProtocol:!1}}function getPackedSettings(){return Buffer.alloc(0)}function getUnpackedSettings(){return Buffer.alloc(0)}const sensitiveHeaders=Symbol.for(\"nodejs.http2.sensitiveHeaders\");function Http2ServerRequest(){throwNotImplemented(\"node:http2 Http2ServerRequest\",887)}function Http2ServerResponse(){throwNotImplemented(\"node:http2 Http2ServerResponse\",887)}return $={constants,createServer,createSecureServer,getDefaultSettings,getPackedSettings,getUnpackedSettings,sensitiveHeaders,Http2ServerRequest,Http2ServerResponse,connect},hideFromStack([Http2ServerRequest,Http2ServerResponse,connect,createServer,createSecureServer,getDefaultSettings,getPackedSettings,getUnpackedSettings]),$})\n"_s; static constexpr ASCIILiteral NodeHttpsCode = "(function (){\"use strict\";const http=@getInternalField(@internalModuleRegistry,18)||@createInternalModuleById(18);function request(input,options,cb){if(input&&typeof input===\"object\"&&!(input instanceof URL))input.protocol\?\?=\"https:\";else if(typeof options===\"object\")options.protocol\?\?=\"https:\";return http.request(input,options,cb)}function get(input,options,cb){const req=request(input,options,cb);return req.end(),req}return{...http,get,request}})\n"_s; static constexpr ASCIILiteral NodeInspectorCode = "(function (){\"use strict\";var $;const{hideFromStack,throwNotImplemented}=@getInternalField(@internalModuleRegistry,2)||@createInternalModuleById(2),EventEmitter=@getInternalField(@internalModuleRegistry,15)||@createInternalModuleById(15);function open(){throwNotImplemented(\"node:inspector open\",2445)}function close(){throwNotImplemented(\"node:inspector close\",2445)}function url(){throwNotImplemented(\"node:inspector url\",2445)}function waitForDebugger(){throwNotImplemented(\"node:inspector waitForDebugger\",2445)}class Session extends EventEmitter{constructor(){super();throwNotImplemented(\"node:inspector Session\",2445)}}return $={console:{...globalThis.console,context:{console:globalThis.console}},open,close,url,waitForDebugger,Session},hideFromStack(open,close,url,waitForDebugger,Session.prototype.constructor),$})\n"_s; |