Skip to content

Instantly share code, notes, and snippets.

@moshest
Last active May 30, 2024 21:27
Show Gist options
  • Save moshest/d66a098c98bd6f1e9c812e2f2254351b to your computer and use it in GitHub Desktop.
Save moshest/d66a098c98bd6f1e9c812e2f2254351b to your computer and use it in GitHub Desktop.
var vs=Object.create;var Pe=Object.defineProperty,ys=Object.defineProperties,Is=Object.getOwnPropertyDescriptor,Bs=Object.getOwnPropertyDescriptors,ws=Object.getOwnPropertyNames,Vt=Object.getOwnPropertySymbols,Es=Object.getPrototypeOf,Gt=Object.prototype.hasOwnProperty,ks=Object.prototype.propertyIsEnumerable;var Ht=(r,e)=>(e=Symbol[r])?e:Symbol.for("Symbol."+r);var qt=(r,e,t)=>e in r?Pe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,qe=(r,e)=>{for(var t in e||(e={}))Gt.call(e,t)&&qt(r,t,e[t]);if(Vt)for(var t of Vt(e))ks.call(e,t)&&qt(r,t,e[t]);return r},Ge=(r,e)=>ys(r,Bs(e));var O=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Cs=(r,e)=>{for(var t in e)Pe(r,t,{get:e[t],enumerable:!0})},$t=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of ws(e))!Gt.call(r,a)&&a!==t&&Pe(r,a,{get:()=>e[a],enumerable:!(s=Is(e,a))||s.enumerable});return r};var Os=(r,e,t)=>(t=r!=null?vs(Es(r)):{},$t(e||!r||!r.__esModule?Pe(t,"default",{value:r,enumerable:!0}):t,r)),Ts=r=>$t(Pe({},"__esModule",{value:!0}),r);var Ue=(r,e,t)=>new Promise((s,a)=>{var f=v=>{try{g(t.next(v))}catch(w){a(w)}},l=v=>{try{g(t.throw(v))}catch(w){a(w)}},g=v=>v.done?s(v.value):Promise.resolve(v.value).then(f,l);g((t=t.apply(r,e)).next())});var zt=(r,e,t)=>(e=r[Ht("asyncIterator")])?e.call(r):(r=r[Ht("iterator")](),e={},t=(s,a)=>(a=r[s])&&(e[s]=f=>new Promise((l,g,v)=>(f=a.call(r,f),v=f.done,Promise.resolve(f.value).then(w=>l({value:w,done:v}),g)))),t("next"),t("return"),e);var Yt=O(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});var Zt=require("buffer"),me={INVALID_ENCODING:"Invalid encoding provided. Please specify a valid encoding the internal Node.js Buffer supports.",INVALID_SMARTBUFFER_SIZE:"Invalid size provided. Size must be a valid integer greater than zero.",INVALID_SMARTBUFFER_BUFFER:"Invalid Buffer provided in SmartBufferOptions.",INVALID_SMARTBUFFER_OBJECT:"Invalid SmartBufferOptions object supplied to SmartBuffer constructor or factory methods.",INVALID_OFFSET:"An invalid offset value was provided.",INVALID_OFFSET_NON_NUMBER:"An invalid offset value was provided. A numeric value is required.",INVALID_LENGTH:"An invalid length value was provided.",INVALID_LENGTH_NON_NUMBER:"An invalid length value was provived. A numeric value is required.",INVALID_TARGET_OFFSET:"Target offset is beyond the bounds of the internal SmartBuffer data.",INVALID_TARGET_LENGTH:"Specified length value moves cursor beyong the bounds of the internal SmartBuffer data.",INVALID_READ_BEYOND_BOUNDS:"Attempted to read beyond the bounds of the managed data.",INVALID_WRITE_BEYOND_BOUNDS:"Attempted to write beyond the bounds of the managed data."};ce.ERRORS=me;function As(r){if(!Zt.Buffer.isEncoding(r))throw new Error(me.INVALID_ENCODING)}ce.checkEncoding=As;function Kt(r){return typeof r=="number"&&isFinite(r)&&Ms(r)}ce.isFiniteInteger=Kt;function Wt(r,e){if(typeof r=="number"){if(!Kt(r)||r<0)throw new Error(e?me.INVALID_OFFSET:me.INVALID_LENGTH)}else throw new Error(e?me.INVALID_OFFSET_NON_NUMBER:me.INVALID_LENGTH_NON_NUMBER)}function Rs(r){Wt(r,!1)}ce.checkLengthValue=Rs;function Ns(r){Wt(r,!0)}ce.checkOffsetValue=Ns;function Ds(r,e){if(r<0||r>e.length)throw new Error(me.INVALID_TARGET_OFFSET)}ce.checkTargetOffset=Ds;function Ms(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r}function Ps(r){if(typeof BigInt=="undefined")throw new Error("Platform does not support JS BigInt type.");if(typeof Zt.Buffer.prototype[r]=="undefined")throw new Error(`Platform does not support Buffer.prototype.${r}.`)}ce.bigIntAndBufferInt64Check=Ps});var Xt=O(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});var B=Yt(),Jt=4096,Us="utf8",ct=class r{constructor(e){if(this.length=0,this._encoding=Us,this._writeOffset=0,this._readOffset=0,r.isSmartBufferOptions(e))if(e.encoding&&(B.checkEncoding(e.encoding),this._encoding=e.encoding),e.size)if(B.isFiniteInteger(e.size)&&e.size>0)this._buff=Buffer.allocUnsafe(e.size);else throw new Error(B.ERRORS.INVALID_SMARTBUFFER_SIZE);else if(e.buff)if(Buffer.isBuffer(e.buff))this._buff=e.buff,this.length=e.buff.length;else throw new Error(B.ERRORS.INVALID_SMARTBUFFER_BUFFER);else this._buff=Buffer.allocUnsafe(Jt);else{if(typeof e!="undefined")throw new Error(B.ERRORS.INVALID_SMARTBUFFER_OBJECT);this._buff=Buffer.allocUnsafe(Jt)}}static fromSize(e,t){return new this({size:e,encoding:t})}static fromBuffer(e,t){return new this({buff:e,encoding:t})}static fromOptions(e){return new this(e)}static isSmartBufferOptions(e){let t=e;return t&&(t.encoding!==void 0||t.size!==void 0||t.buff!==void 0)}readInt8(e){return this._readNumberValue(Buffer.prototype.readInt8,1,e)}readInt16BE(e){return this._readNumberValue(Buffer.prototype.readInt16BE,2,e)}readInt16LE(e){return this._readNumberValue(Buffer.prototype.readInt16LE,2,e)}readInt32BE(e){return this._readNumberValue(Buffer.prototype.readInt32BE,4,e)}readInt32LE(e){return this._readNumberValue(Buffer.prototype.readInt32LE,4,e)}readBigInt64BE(e){return B.bigIntAndBufferInt64Check("readBigInt64BE"),this._readNumberValue(Buffer.prototype.readBigInt64BE,8,e)}readBigInt64LE(e){return B.bigIntAndBufferInt64Check("readBigInt64LE"),this._readNumberValue(Buffer.prototype.readBigInt64LE,8,e)}writeInt8(e,t){return this._writeNumberValue(Buffer.prototype.writeInt8,1,e,t),this}insertInt8(e,t){return this._insertNumberValue(Buffer.prototype.writeInt8,1,e,t)}writeInt16BE(e,t){return this._writeNumberValue(Buffer.prototype.writeInt16BE,2,e,t)}insertInt16BE(e,t){return this._insertNumberValue(Buffer.prototype.writeInt16BE,2,e,t)}writeInt16LE(e,t){return this._writeNumberValue(Buffer.prototype.writeInt16LE,2,e,t)}insertInt16LE(e,t){return this._insertNumberValue(Buffer.prototype.writeInt16LE,2,e,t)}writeInt32BE(e,t){return this._writeNumberValue(Buffer.prototype.writeInt32BE,4,e,t)}insertInt32BE(e,t){return this._insertNumberValue(Buffer.prototype.writeInt32BE,4,e,t)}writeInt32LE(e,t){return this._writeNumberValue(Buffer.prototype.writeInt32LE,4,e,t)}insertInt32LE(e,t){return this._insertNumberValue(Buffer.prototype.writeInt32LE,4,e,t)}writeBigInt64BE(e,t){return B.bigIntAndBufferInt64Check("writeBigInt64BE"),this._writeNumberValue(Buffer.prototype.writeBigInt64BE,8,e,t)}insertBigInt64BE(e,t){return B.bigIntAndBufferInt64Check("writeBigInt64BE"),this._insertNumberValue(Buffer.prototype.writeBigInt64BE,8,e,t)}writeBigInt64LE(e,t){return B.bigIntAndBufferInt64Check("writeBigInt64LE"),this._writeNumberValue(Buffer.prototype.writeBigInt64LE,8,e,t)}insertBigInt64LE(e,t){return B.bigIntAndBufferInt64Check("writeBigInt64LE"),this._insertNumberValue(Buffer.prototype.writeBigInt64LE,8,e,t)}readUInt8(e){return this._readNumberValue(Buffer.prototype.readUInt8,1,e)}readUInt16BE(e){return this._readNumberValue(Buffer.prototype.readUInt16BE,2,e)}readUInt16LE(e){return this._readNumberValue(Buffer.prototype.readUInt16LE,2,e)}readUInt32BE(e){return this._readNumberValue(Buffer.prototype.readUInt32BE,4,e)}readUInt32LE(e){return this._readNumberValue(Buffer.prototype.readUInt32LE,4,e)}readBigUInt64BE(e){return B.bigIntAndBufferInt64Check("readBigUInt64BE"),this._readNumberValue(Buffer.prototype.readBigUInt64BE,8,e)}readBigUInt64LE(e){return B.bigIntAndBufferInt64Check("readBigUInt64LE"),this._readNumberValue(Buffer.prototype.readBigUInt64LE,8,e)}writeUInt8(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt8,1,e,t)}insertUInt8(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt8,1,e,t)}writeUInt16BE(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt16BE,2,e,t)}insertUInt16BE(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt16BE,2,e,t)}writeUInt16LE(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt16LE,2,e,t)}insertUInt16LE(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt16LE,2,e,t)}writeUInt32BE(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt32BE,4,e,t)}insertUInt32BE(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt32BE,4,e,t)}writeUInt32LE(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt32LE,4,e,t)}insertUInt32LE(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt32LE,4,e,t)}writeBigUInt64BE(e,t){return B.bigIntAndBufferInt64Check("writeBigUInt64BE"),this._writeNumberValue(Buffer.prototype.writeBigUInt64BE,8,e,t)}insertBigUInt64BE(e,t){return B.bigIntAndBufferInt64Check("writeBigUInt64BE"),this._insertNumberValue(Buffer.prototype.writeBigUInt64BE,8,e,t)}writeBigUInt64LE(e,t){return B.bigIntAndBufferInt64Check("writeBigUInt64LE"),this._writeNumberValue(Buffer.prototype.writeBigUInt64LE,8,e,t)}insertBigUInt64LE(e,t){return B.bigIntAndBufferInt64Check("writeBigUInt64LE"),this._insertNumberValue(Buffer.prototype.writeBigUInt64LE,8,e,t)}readFloatBE(e){return this._readNumberValue(Buffer.prototype.readFloatBE,4,e)}readFloatLE(e){return this._readNumberValue(Buffer.prototype.readFloatLE,4,e)}writeFloatBE(e,t){return this._writeNumberValue(Buffer.prototype.writeFloatBE,4,e,t)}insertFloatBE(e,t){return this._insertNumberValue(Buffer.prototype.writeFloatBE,4,e,t)}writeFloatLE(e,t){return this._writeNumberValue(Buffer.prototype.writeFloatLE,4,e,t)}insertFloatLE(e,t){return this._insertNumberValue(Buffer.prototype.writeFloatLE,4,e,t)}readDoubleBE(e){return this._readNumberValue(Buffer.prototype.readDoubleBE,8,e)}readDoubleLE(e){return this._readNumberValue(Buffer.prototype.readDoubleLE,8,e)}writeDoubleBE(e,t){return this._writeNumberValue(Buffer.prototype.writeDoubleBE,8,e,t)}insertDoubleBE(e,t){return this._insertNumberValue(Buffer.prototype.writeDoubleBE,8,e,t)}writeDoubleLE(e,t){return this._writeNumberValue(Buffer.prototype.writeDoubleLE,8,e,t)}insertDoubleLE(e,t){return this._insertNumberValue(Buffer.prototype.writeDoubleLE,8,e,t)}readString(e,t){let s;typeof e=="number"?(B.checkLengthValue(e),s=Math.min(e,this.length-this._readOffset)):(t=e,s=this.length-this._readOffset),typeof t!="undefined"&&B.checkEncoding(t);let a=this._buff.slice(this._readOffset,this._readOffset+s).toString(t||this._encoding);return this._readOffset+=s,a}insertString(e,t,s){return B.checkOffsetValue(t),this._handleString(e,!0,t,s)}writeString(e,t,s){return this._handleString(e,!1,t,s)}readStringNT(e){typeof e!="undefined"&&B.checkEncoding(e);let t=this.length;for(let a=this._readOffset;a<this.length;a++)if(this._buff[a]===0){t=a;break}let s=this._buff.slice(this._readOffset,t);return this._readOffset=t+1,s.toString(e||this._encoding)}insertStringNT(e,t,s){return B.checkOffsetValue(t),this.insertString(e,t,s),this.insertUInt8(0,t+e.length),this}writeStringNT(e,t,s){return this.writeString(e,t,s),this.writeUInt8(0,typeof t=="number"?t+e.length:this.writeOffset),this}readBuffer(e){typeof e!="undefined"&&B.checkLengthValue(e);let t=typeof e=="number"?e:this.length,s=Math.min(this.length,this._readOffset+t),a=this._buff.slice(this._readOffset,s);return this._readOffset=s,a}insertBuffer(e,t){return B.checkOffsetValue(t),this._handleBuffer(e,!0,t)}writeBuffer(e,t){return this._handleBuffer(e,!1,t)}readBufferNT(){let e=this.length;for(let s=this._readOffset;s<this.length;s++)if(this._buff[s]===0){e=s;break}let t=this._buff.slice(this._readOffset,e);return this._readOffset=e+1,t}insertBufferNT(e,t){return B.checkOffsetValue(t),this.insertBuffer(e,t),this.insertUInt8(0,t+e.length),this}writeBufferNT(e,t){return typeof t!="undefined"&&B.checkOffsetValue(t),this.writeBuffer(e,t),this.writeUInt8(0,typeof t=="number"?t+e.length:this._writeOffset),this}clear(){return this._writeOffset=0,this._readOffset=0,this.length=0,this}remaining(){return this.length-this._readOffset}get readOffset(){return this._readOffset}set readOffset(e){B.checkOffsetValue(e),B.checkTargetOffset(e,this),this._readOffset=e}get writeOffset(){return this._writeOffset}set writeOffset(e){B.checkOffsetValue(e),B.checkTargetOffset(e,this),this._writeOffset=e}get encoding(){return this._encoding}set encoding(e){B.checkEncoding(e),this._encoding=e}get internalBuffer(){return this._buff}toBuffer(){return this._buff.slice(0,this.length)}toString(e){let t=typeof e=="string"?e:this._encoding;return B.checkEncoding(t),this._buff.toString(t,0,this.length)}destroy(){return this.clear(),this}_handleString(e,t,s,a){let f=this._writeOffset,l=this._encoding;typeof s=="number"?f=s:typeof s=="string"&&(B.checkEncoding(s),l=s),typeof a=="string"&&(B.checkEncoding(a),l=a);let g=Buffer.byteLength(e,l);return t?this.ensureInsertable(g,f):this._ensureWriteable(g,f),this._buff.write(e,f,g,l),t?this._writeOffset+=g:typeof s=="number"?this._writeOffset=Math.max(this._writeOffset,f+g):this._writeOffset+=g,this}_handleBuffer(e,t,s){let a=typeof s=="number"?s:this._writeOffset;return t?this.ensureInsertable(e.length,a):this._ensureWriteable(e.length,a),e.copy(this._buff,a),t?this._writeOffset+=e.length:typeof s=="number"?this._writeOffset=Math.max(this._writeOffset,a+e.length):this._writeOffset+=e.length,this}ensureReadable(e,t){let s=this._readOffset;if(typeof t!="undefined"&&(B.checkOffsetValue(t),s=t),s<0||s+e>this.length)throw new Error(B.ERRORS.INVALID_READ_BEYOND_BOUNDS)}ensureInsertable(e,t){B.checkOffsetValue(t),this._ensureCapacity(this.length+e),t<this.length&&this._buff.copy(this._buff,t+e,t,this._buff.length),t+e>this.length?this.length=t+e:this.length+=e}_ensureWriteable(e,t){let s=typeof t=="number"?t:this._writeOffset;this._ensureCapacity(s+e),s+e>this.length&&(this.length=s+e)}_ensureCapacity(e){let t=this._buff.length;if(e>t){let s=this._buff,a=t*3/2+1;a<e&&(a=e),this._buff=Buffer.allocUnsafe(a),s.copy(this._buff,0,0,t)}}_readNumberValue(e,t,s){this.ensureReadable(t,s);let a=e.call(this._buff,typeof s=="number"?s:this._readOffset);return typeof s=="undefined"&&(this._readOffset+=t),a}_insertNumberValue(e,t,s,a){return B.checkOffsetValue(a),this.ensureInsertable(t,a),e.call(this._buff,s,a),this._writeOffset+=t,this}_writeNumberValue(e,t,s,a){if(typeof a=="number"){if(a<0)throw new Error(B.ERRORS.INVALID_WRITE_BEYOND_BOUNDS);B.checkOffsetValue(a)}let f=typeof a=="number"?a:this._writeOffset;return this._ensureWriteable(t,f),e.call(this._buff,s,f),typeof a=="number"?this._writeOffset=Math.max(this._writeOffset,f+t):this._writeOffset+=t,this}};ht.SmartBuffer=ct});var lt=O(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.SOCKS5_NO_ACCEPTABLE_AUTH=E.SOCKS5_CUSTOM_AUTH_END=E.SOCKS5_CUSTOM_AUTH_START=E.SOCKS_INCOMING_PACKET_SIZES=E.SocksClientState=E.Socks5Response=E.Socks5HostType=E.Socks5Auth=E.Socks4Response=E.SocksCommand=E.ERRORS=E.DEFAULT_TIMEOUT=void 0;var Fs=3e4;E.DEFAULT_TIMEOUT=Fs;var xs={InvalidSocksCommand:"An invalid SOCKS command was provided. Valid options are connect, bind, and associate.",InvalidSocksCommandForOperation:"An invalid SOCKS command was provided. Only a subset of commands are supported for this operation.",InvalidSocksCommandChain:"An invalid SOCKS command was provided. Chaining currently only supports the connect command.",InvalidSocksClientOptionsDestination:"An invalid destination host was provided.",InvalidSocksClientOptionsExistingSocket:"An invalid existing socket was provided. This should be an instance of stream.Duplex.",InvalidSocksClientOptionsProxy:"Invalid SOCKS proxy details were provided.",InvalidSocksClientOptionsTimeout:"An invalid timeout value was provided. Please enter a value above 0 (in ms).",InvalidSocksClientOptionsProxiesLength:"At least two socks proxies must be provided for chaining.",InvalidSocksClientOptionsCustomAuthRange:"Custom auth must be a value between 0x80 and 0xFE.",InvalidSocksClientOptionsCustomAuthOptions:"When a custom_auth_method is provided, custom_auth_request_handler, custom_auth_response_size, and custom_auth_response_handler must also be provided and valid.",NegotiationError:"Negotiation error",SocketClosed:"Socket closed",ProxyConnectionTimedOut:"Proxy connection timed out",InternalError:"SocksClient internal error (this should not happen)",InvalidSocks4HandshakeResponse:"Received invalid Socks4 handshake response",Socks4ProxyRejectedConnection:"Socks4 Proxy rejected connection",InvalidSocks4IncomingConnectionResponse:"Socks4 invalid incoming connection response",Socks4ProxyRejectedIncomingBoundConnection:"Socks4 Proxy rejected incoming bound connection",InvalidSocks5InitialHandshakeResponse:"Received invalid Socks5 initial handshake response",InvalidSocks5IntiailHandshakeSocksVersion:"Received invalid Socks5 initial handshake (invalid socks version)",InvalidSocks5InitialHandshakeNoAcceptedAuthType:"Received invalid Socks5 initial handshake (no accepted authentication type)",InvalidSocks5InitialHandshakeUnknownAuthType:"Received invalid Socks5 initial handshake (unknown authentication type)",Socks5AuthenticationFailed:"Socks5 Authentication failed",InvalidSocks5FinalHandshake:"Received invalid Socks5 final handshake response",InvalidSocks5FinalHandshakeRejected:"Socks5 proxy rejected connection",InvalidSocks5IncomingConnectionResponse:"Received invalid Socks5 incoming connection response",Socks5ProxyRejectedIncomingBoundConnection:"Socks5 Proxy rejected incoming bound connection"};E.ERRORS=xs;var Ls={Socks5InitialHandshakeResponse:2,Socks5UserPassAuthenticationResponse:2,Socks5ResponseHeader:5,Socks5ResponseIPv4:10,Socks5ResponseIPv6:22,Socks5ResponseHostname:r=>r+7,Socks4Response:8};E.SOCKS_INCOMING_PACKET_SIZES=Ls;var Qt;(function(r){r[r.connect=1]="connect",r[r.bind=2]="bind",r[r.associate=3]="associate"})(Qt||(E.SocksCommand=Qt={}));var er;(function(r){r[r.Granted=90]="Granted",r[r.Failed=91]="Failed",r[r.Rejected=92]="Rejected",r[r.RejectedIdent=93]="RejectedIdent"})(er||(E.Socks4Response=er={}));var tr;(function(r){r[r.NoAuth=0]="NoAuth",r[r.GSSApi=1]="GSSApi",r[r.UserPass=2]="UserPass"})(tr||(E.Socks5Auth=tr={}));var js=128;E.SOCKS5_CUSTOM_AUTH_START=js;var Vs=254;E.SOCKS5_CUSTOM_AUTH_END=Vs;var Hs=255;E.SOCKS5_NO_ACCEPTABLE_AUTH=Hs;var rr;(function(r){r[r.Granted=0]="Granted",r[r.Failure=1]="Failure",r[r.NotAllowed=2]="NotAllowed",r[r.NetworkUnreachable=3]="NetworkUnreachable",r[r.HostUnreachable=4]="HostUnreachable",r[r.ConnectionRefused=5]="ConnectionRefused",r[r.TTLExpired=6]="TTLExpired",r[r.CommandNotSupported=7]="CommandNotSupported",r[r.AddressNotSupported=8]="AddressNotSupported"})(rr||(E.Socks5Response=rr={}));var ir;(function(r){r[r.IPv4=1]="IPv4",r[r.Hostname=3]="Hostname",r[r.IPv6=4]="IPv6"})(ir||(E.Socks5HostType=ir={}));var sr;(function(r){r[r.Created=0]="Created",r[r.Connecting=1]="Connecting",r[r.Connected=2]="Connected",r[r.SentInitialHandshake=3]="SentInitialHandshake",r[r.ReceivedInitialHandshakeResponse=4]="ReceivedInitialHandshakeResponse",r[r.SentAuthentication=5]="SentAuthentication",r[r.ReceivedAuthenticationResponse=6]="ReceivedAuthenticationResponse",r[r.SentFinalHandshake=7]="SentFinalHandshake",r[r.ReceivedFinalResponse=8]="ReceivedFinalResponse",r[r.BoundWaitingForConnection=9]="BoundWaitingForConnection",r[r.Established=10]="Established",r[r.Disconnected=11]="Disconnected",r[r.Error=99]="Error"})(sr||(E.SocksClientState=sr={}))});var pt=O(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.shuffleArray=we.SocksClientError=void 0;var dt=class extends Error{constructor(e,t){super(e),this.options=t}};we.SocksClientError=dt;function qs(r){for(let e=r.length-1;e>0;e--){let t=Math.floor(Math.random()*(e+1));[r[e],r[t]]=[r[t],r[e]]}}we.shuffleArray=qs});var St=O(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.isCorrect=Ee.isInSubnet=void 0;function Gs(r){return this.subnetMask<r.subnetMask?!1:this.mask(r.subnetMask)===r.mask()}Ee.isInSubnet=Gs;function $s(r){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===r&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}Ee.isCorrect=$s});var gt=O(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.RE_SUBNET_STRING=se.RE_ADDRESS=se.GROUPS=se.BITS=void 0;se.BITS=32;se.GROUPS=4;se.RE_ADDRESS=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g;se.RE_SUBNET_STRING=/\/\d{1,2}$/});var ze=O($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.AddressError=void 0;var mt=class extends Error{constructor(e,t){super(e),this.name="AddressError",t!==null&&(this.parseMessage=t)}};$e.AddressError=mt});var bt=O((Ze,nr)=>{(function(){var r,e=0xdeadbeefcafe,t=(e&16777215)==15715070;function s(i,n,o){i!=null&&(typeof i=="number"?this.fromNumber(i,n,o):n==null&&typeof i!="string"?this.fromString(i,256):this.fromString(i,n))}function a(){return new s(null)}function f(i,n,o,u,h,d){for(;--d>=0;){var S=n*this[i++]+o[u]+h;h=Math.floor(S/67108864),o[u++]=S&67108863}return h}function l(i,n,o,u,h,d){for(var S=n&32767,m=n>>15;--d>=0;){var C=this[i]&32767,D=this[i++]>>15,Y=m*C+D*S;C=S*C+((Y&32767)<<15)+o[u]+(h&1073741823),h=(C>>>30)+(Y>>>15)+m*D+(h>>>30),o[u++]=C&1073741823}return h}function g(i,n,o,u,h,d){for(var S=n&16383,m=n>>14;--d>=0;){var C=this[i]&16383,D=this[i++]>>14,Y=m*C+D*S;C=S*C+((Y&16383)<<14)+o[u]+h,h=(C>>28)+(Y>>14)+m*D,o[u++]=C&268435455}return h}var v=typeof navigator!="undefined";v&&t&&navigator.appName=="Microsoft Internet Explorer"?(s.prototype.am=l,r=30):v&&t&&navigator.appName!="Netscape"?(s.prototype.am=f,r=26):(s.prototype.am=g,r=28),s.prototype.DB=r,s.prototype.DM=(1<<r)-1,s.prototype.DV=1<<r;var w=52;s.prototype.FV=Math.pow(2,w),s.prototype.F1=w-r,s.prototype.F2=2*r-w;var c="0123456789abcdefghijklmnopqrstuvwxyz",b=new Array,y,I;for(y=48,I=0;I<=9;++I)b[y++]=I;for(y=97,I=10;I<36;++I)b[y++]=I;for(y=65,I=10;I<36;++I)b[y++]=I;function _(i){return c.charAt(i)}function T(i,n){var o=b[i.charCodeAt(n)];return o==null?-1:o}function R(i){for(var n=this.t-1;n>=0;--n)i[n]=this[n];i.t=this.t,i.s=this.s}function G(i){this.t=1,this.s=i<0?-1:0,i>0?this[0]=i:i<-1?this[0]=i+this.DV:this.t=0}function U(i){var n=a();return n.fromInt(i),n}function ie(i,n){var o;if(n==16)o=4;else if(n==8)o=3;else if(n==256)o=8;else if(n==2)o=1;else if(n==32)o=5;else if(n==4)o=2;else{this.fromRadix(i,n);return}this.t=0,this.s=0;for(var u=i.length,h=!1,d=0;--u>=0;){var S=o==8?i[u]&255:T(i,u);if(S<0){i.charAt(u)=="-"&&(h=!0);continue}h=!1,d==0?this[this.t++]=S:d+o>this.DB?(this[this.t-1]|=(S&(1<<this.DB-d)-1)<<d,this[this.t++]=S>>this.DB-d):this[this.t-1]|=S<<d,d+=o,d>=this.DB&&(d-=this.DB)}o==8&&i[0]&128&&(this.s=-1,d>0&&(this[this.t-1]|=(1<<this.DB-d)-1<<d)),this.clamp(),h&&s.ZERO.subTo(this,this)}function Ie(){for(var i=this.s&this.DM;this.t>0&&this[this.t-1]==i;)--this.t}function Mt(i){if(this.s<0)return"-"+this.negate().toString(i);var n;if(i==16)n=4;else if(i==8)n=3;else if(i==2)n=1;else if(i==32)n=5;else if(i==4)n=2;else return this.toRadix(i);var o=(1<<n)-1,u,h=!1,d="",S=this.t,m=this.DB-S*this.DB%n;if(S-- >0)for(m<this.DB&&(u=this[S]>>m)>0&&(h=!0,d=_(u));S>=0;)m<n?(u=(this[S]&(1<<m)-1)<<n-m,u|=this[--S]>>(m+=this.DB-n)):(u=this[S]>>(m-=n)&o,m<=0&&(m+=this.DB,--S)),u>0&&(h=!0),h&&(d+=_(u));return h?d:"0"}function De(){var i=a();return s.ZERO.subTo(this,i),i}function st(){return this.s<0?this.negate():this}function Le(i){var n=this.s-i.s;if(n!=0)return n;var o=this.t;if(n=o-i.t,n!=0)return this.s<0?-n:n;for(;--o>=0;)if((n=this[o]-i[o])!=0)return n;return 0}function Be(i){var n=1,o;return(o=i>>>16)!=0&&(i=o,n+=16),(o=i>>8)!=0&&(i=o,n+=8),(o=i>>4)!=0&&(i=o,n+=4),(o=i>>2)!=0&&(i=o,n+=2),(o=i>>1)!=0&&(i=o,n+=1),n}function jr(){return this.t<=0?0:this.DB*(this.t-1)+Be(this[this.t-1]^this.s&this.DM)}function Vr(i,n){var o;for(o=this.t-1;o>=0;--o)n[o+i]=this[o];for(o=i-1;o>=0;--o)n[o]=0;n.t=this.t+i,n.s=this.s}function Hr(i,n){for(var o=i;o<this.t;++o)n[o-i]=this[o];n.t=Math.max(this.t-i,0),n.s=this.s}function qr(i,n){var o=i%this.DB,u=this.DB-o,h=(1<<u)-1,d=Math.floor(i/this.DB),S=this.s<<o&this.DM,m;for(m=this.t-1;m>=0;--m)n[m+d+1]=this[m]>>u|S,S=(this[m]&h)<<o;for(m=d-1;m>=0;--m)n[m]=0;n[d]=S,n.t=this.t+d+1,n.s=this.s,n.clamp()}function Gr(i,n){n.s=this.s;var o=Math.floor(i/this.DB);if(o>=this.t){n.t=0;return}var u=i%this.DB,h=this.DB-u,d=(1<<u)-1;n[0]=this[o]>>u;for(var S=o+1;S<this.t;++S)n[S-o-1]|=(this[S]&d)<<h,n[S-o]=this[S]>>u;u>0&&(n[this.t-o-1]|=(this.s&d)<<h),n.t=this.t-o,n.clamp()}function $r(i,n){for(var o=0,u=0,h=Math.min(i.t,this.t);o<h;)u+=this[o]-i[o],n[o++]=u&this.DM,u>>=this.DB;if(i.t<this.t){for(u-=i.s;o<this.t;)u+=this[o],n[o++]=u&this.DM,u>>=this.DB;u+=this.s}else{for(u+=this.s;o<i.t;)u-=i[o],n[o++]=u&this.DM,u>>=this.DB;u-=i.s}n.s=u<0?-1:0,u<-1?n[o++]=this.DV+u:u>0&&(n[o++]=u),n.t=o,n.clamp()}function zr(i,n){var o=this.abs(),u=i.abs(),h=o.t;for(n.t=h+u.t;--h>=0;)n[h]=0;for(h=0;h<u.t;++h)n[h+o.t]=o.am(0,u[h],n,h,0,o.t);n.s=0,n.clamp(),this.s!=i.s&&s.ZERO.subTo(n,n)}function Zr(i){for(var n=this.abs(),o=i.t=2*n.t;--o>=0;)i[o]=0;for(o=0;o<n.t-1;++o){var u=n.am(o,n[o],i,2*o,0,1);(i[o+n.t]+=n.am(o+1,2*n[o],i,2*o+1,u,n.t-o-1))>=n.DV&&(i[o+n.t]-=n.DV,i[o+n.t+1]=1)}i.t>0&&(i[i.t-1]+=n.am(o,n[o],i,2*o,0,1)),i.s=0,i.clamp()}function Kr(i,n,o){var u=i.abs();if(!(u.t<=0)){var h=this.abs();if(h.t<u.t){n!=null&&n.fromInt(0),o!=null&&this.copyTo(o);return}o==null&&(o=a());var d=a(),S=this.s,m=i.s,C=this.DB-Be(u[u.t-1]);C>0?(u.lShiftTo(C,d),h.lShiftTo(C,o)):(u.copyTo(d),h.copyTo(o));var D=d.t,Y=d[D-1];if(Y!=0){var z=Y*(1<<this.F1)+(D>1?d[D-2]>>this.F2:0),fe=this.FV/z,Ve=(1<<this.F1)/z,ee=1<<this.F2,te=o.t,He=te-D,le=n==null?a():n;for(d.dlShiftTo(He,le),o.compareTo(le)>=0&&(o[o.t++]=1,o.subTo(le,o)),s.ONE.dlShiftTo(D,le),le.subTo(d,d);d.t<D;)d[d.t++]=0;for(;--He>=0;){var ft=o[--te]==Y?this.DM:Math.floor(o[te]*fe+(o[te-1]+ee)*Ve);if((o[te]+=d.am(0,ft,o,He,0,D))<ft)for(d.dlShiftTo(He,le),o.subTo(le,o);o[te]<--ft;)o.subTo(le,o)}n!=null&&(o.drShiftTo(D,n),S!=m&&s.ZERO.subTo(n,n)),o.t=D,o.clamp(),C>0&&o.rShiftTo(C,o),S<0&&s.ZERO.subTo(o,o)}}}function Wr(i){var n=a();return this.abs().divRemTo(i,null,n),this.s<0&&n.compareTo(s.ZERO)>0&&i.subTo(n,n),n}function pe(i){this.m=i}function Yr(i){return i.s<0||i.compareTo(this.m)>=0?i.mod(this.m):i}function Jr(i){return i}function Xr(i){i.divRemTo(this.m,null,i)}function Qr(i,n,o){i.multiplyTo(n,o),this.reduce(o)}function ei(i,n){i.squareTo(n),this.reduce(n)}pe.prototype.convert=Yr,pe.prototype.revert=Jr,pe.prototype.reduce=Xr,pe.prototype.mulTo=Qr,pe.prototype.sqrTo=ei;function ti(){if(this.t<1)return 0;var i=this[0];if(!(i&1))return 0;var n=i&3;return n=n*(2-(i&15)*n)&15,n=n*(2-(i&255)*n)&255,n=n*(2-((i&65535)*n&65535))&65535,n=n*(2-i*n%this.DV)%this.DV,n>0?this.DV-n:-n}function Se(i){this.m=i,this.mp=i.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<i.DB-15)-1,this.mt2=2*i.t}function ri(i){var n=a();return i.abs().dlShiftTo(this.m.t,n),n.divRemTo(this.m,null,n),i.s<0&&n.compareTo(s.ZERO)>0&&this.m.subTo(n,n),n}function ii(i){var n=a();return i.copyTo(n),this.reduce(n),n}function si(i){for(;i.t<=this.mt2;)i[i.t++]=0;for(var n=0;n<this.m.t;++n){var o=i[n]&32767,u=o*this.mpl+((o*this.mph+(i[n]>>15)*this.mpl&this.um)<<15)&i.DM;for(o=n+this.m.t,i[o]+=this.m.am(0,u,i,n,0,this.m.t);i[o]>=i.DV;)i[o]-=i.DV,i[++o]++}i.clamp(),i.drShiftTo(this.m.t,i),i.compareTo(this.m)>=0&&i.subTo(this.m,i)}function ni(i,n){i.squareTo(n),this.reduce(n)}function oi(i,n,o){i.multiplyTo(n,o),this.reduce(o)}Se.prototype.convert=ri,Se.prototype.revert=ii,Se.prototype.reduce=si,Se.prototype.mulTo=oi,Se.prototype.sqrTo=ni;function ai(){return(this.t>0?this[0]&1:this.s)==0}function ui(i,n){if(i>4294967295||i<1)return s.ONE;var o=a(),u=a(),h=n.convert(this),d=Be(i)-1;for(h.copyTo(o);--d>=0;)if(n.sqrTo(o,u),(i&1<<d)>0)n.mulTo(u,h,o);else{var S=o;o=u,u=S}return n.revert(o)}function fi(i,n){var o;return i<256||n.isEven()?o=new pe(n):o=new Se(n),this.exp(i,o)}s.prototype.copyTo=R,s.prototype.fromInt=G,s.prototype.fromString=ie,s.prototype.clamp=Ie,s.prototype.dlShiftTo=Vr,s.prototype.drShiftTo=Hr,s.prototype.lShiftTo=qr,s.prototype.rShiftTo=Gr,s.prototype.subTo=$r,s.prototype.multiplyTo=zr,s.prototype.squareTo=Zr,s.prototype.divRemTo=Kr,s.prototype.invDigit=ti,s.prototype.isEven=ai,s.prototype.exp=ui,s.prototype.toString=Mt,s.prototype.negate=De,s.prototype.abs=st,s.prototype.compareTo=Le,s.prototype.bitLength=jr,s.prototype.mod=Wr,s.prototype.modPowInt=fi,s.ZERO=U(0),s.ONE=U(1);function ci(){var i=a();return this.copyTo(i),i}function hi(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function li(){return this.t==0?this.s:this[0]<<24>>24}function di(){return this.t==0?this.s:this[0]<<16>>16}function pi(i){return Math.floor(Math.LN2*this.DB/Math.log(i))}function Si(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function gi(i){if(i==null&&(i=10),this.signum()==0||i<2||i>36)return"0";var n=this.chunkSize(i),o=Math.pow(i,n),u=U(o),h=a(),d=a(),S="";for(this.divRemTo(u,h,d);h.signum()>0;)S=(o+d.intValue()).toString(i).substr(1)+S,h.divRemTo(u,h,d);return d.intValue().toString(i)+S}function mi(i,n){this.fromInt(0),n==null&&(n=10);for(var o=this.chunkSize(n),u=Math.pow(n,o),h=!1,d=0,S=0,m=0;m<i.length;++m){var C=T(i,m);if(C<0){i.charAt(m)=="-"&&this.signum()==0&&(h=!0);continue}S=n*S+C,++d>=o&&(this.dMultiply(u),this.dAddOffset(S,0),d=0,S=0)}d>0&&(this.dMultiply(Math.pow(n,d)),this.dAddOffset(S,0)),h&&s.ZERO.subTo(this,this)}function bi(i,n,o){if(typeof n=="number")if(i<2)this.fromInt(1);else for(this.fromNumber(i,o),this.testBit(i-1)||this.bitwiseTo(s.ONE.shiftLeft(i-1),nt,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(n);)this.dAddOffset(2,0),this.bitLength()>i&&this.subTo(s.ONE.shiftLeft(i-1),this);else{var u=new Array,h=i&7;u.length=(i>>3)+1,n.nextBytes(u),h>0?u[0]&=(1<<h)-1:u[0]=0,this.fromString(u,256)}}function _i(){var i=this.t,n=new Array;n[0]=this.s;var o=this.DB-i*this.DB%8,u,h=0;if(i-- >0)for(o<this.DB&&(u=this[i]>>o)!=(this.s&this.DM)>>o&&(n[h++]=u|this.s<<this.DB-o);i>=0;)o<8?(u=(this[i]&(1<<o)-1)<<8-o,u|=this[--i]>>(o+=this.DB-8)):(u=this[i]>>(o-=8)&255,o<=0&&(o+=this.DB,--i)),u&128&&(u|=-256),h==0&&(this.s&128)!=(u&128)&&++h,(h>0||u!=this.s)&&(n[h++]=u);return n}function vi(i){return this.compareTo(i)==0}function yi(i){return this.compareTo(i)<0?this:i}function Ii(i){return this.compareTo(i)>0?this:i}function Bi(i,n,o){var u,h,d=Math.min(i.t,this.t);for(u=0;u<d;++u)o[u]=n(this[u],i[u]);if(i.t<this.t){for(h=i.s&this.DM,u=d;u<this.t;++u)o[u]=n(this[u],h);o.t=this.t}else{for(h=this.s&this.DM,u=d;u<i.t;++u)o[u]=n(h,i[u]);o.t=i.t}o.s=n(this.s,i.s),o.clamp()}function wi(i,n){return i&n}function Ei(i){var n=a();return this.bitwiseTo(i,wi,n),n}function nt(i,n){return i|n}function ki(i){var n=a();return this.bitwiseTo(i,nt,n),n}function Pt(i,n){return i^n}function Ci(i){var n=a();return this.bitwiseTo(i,Pt,n),n}function Ut(i,n){return i&~n}function Oi(i){var n=a();return this.bitwiseTo(i,Ut,n),n}function Ti(){for(var i=a(),n=0;n<this.t;++n)i[n]=this.DM&~this[n];return i.t=this.t,i.s=~this.s,i}function Ai(i){var n=a();return i<0?this.rShiftTo(-i,n):this.lShiftTo(i,n),n}function Ri(i){var n=a();return i<0?this.lShiftTo(-i,n):this.rShiftTo(i,n),n}function Ni(i){if(i==0)return-1;var n=0;return i&65535||(i>>=16,n+=16),i&255||(i>>=8,n+=8),i&15||(i>>=4,n+=4),i&3||(i>>=2,n+=2),i&1||++n,n}function Di(){for(var i=0;i<this.t;++i)if(this[i]!=0)return i*this.DB+Ni(this[i]);return this.s<0?this.t*this.DB:-1}function Mi(i){for(var n=0;i!=0;)i&=i-1,++n;return n}function Pi(){for(var i=0,n=this.s&this.DM,o=0;o<this.t;++o)i+=Mi(this[o]^n);return i}function Ui(i){var n=Math.floor(i/this.DB);return n>=this.t?this.s!=0:(this[n]&1<<i%this.DB)!=0}function Fi(i,n){var o=s.ONE.shiftLeft(i);return this.bitwiseTo(o,n,o),o}function xi(i){return this.changeBit(i,nt)}function Li(i){return this.changeBit(i,Ut)}function ji(i){return this.changeBit(i,Pt)}function Vi(i,n){for(var o=0,u=0,h=Math.min(i.t,this.t);o<h;)u+=this[o]+i[o],n[o++]=u&this.DM,u>>=this.DB;if(i.t<this.t){for(u+=i.s;o<this.t;)u+=this[o],n[o++]=u&this.DM,u>>=this.DB;u+=this.s}else{for(u+=this.s;o<i.t;)u+=i[o],n[o++]=u&this.DM,u>>=this.DB;u+=i.s}n.s=u<0?-1:0,u>0?n[o++]=u:u<-1&&(n[o++]=this.DV+u),n.t=o,n.clamp()}function Hi(i){var n=a();return this.addTo(i,n),n}function qi(i){var n=a();return this.subTo(i,n),n}function Gi(i){var n=a();return this.multiplyTo(i,n),n}function $i(){var i=a();return this.squareTo(i),i}function zi(i){var n=a();return this.divRemTo(i,n,null),n}function Zi(i){var n=a();return this.divRemTo(i,null,n),n}function Ki(i){var n=a(),o=a();return this.divRemTo(i,n,o),new Array(n,o)}function Wi(i){this[this.t]=this.am(0,i-1,this,0,0,this.t),++this.t,this.clamp()}function Yi(i,n){if(i!=0){for(;this.t<=n;)this[this.t++]=0;for(this[n]+=i;this[n]>=this.DV;)this[n]-=this.DV,++n>=this.t&&(this[this.t++]=0),++this[n]}}function Me(){}function Ft(i){return i}function Ji(i,n,o){i.multiplyTo(n,o)}function Xi(i,n){i.squareTo(n)}Me.prototype.convert=Ft,Me.prototype.revert=Ft,Me.prototype.mulTo=Ji,Me.prototype.sqrTo=Xi;function Qi(i){return this.exp(i,new Me)}function es(i,n,o){var u=Math.min(this.t+i.t,n);for(o.s=0,o.t=u;u>0;)o[--u]=0;var h;for(h=o.t-this.t;u<h;++u)o[u+this.t]=this.am(0,i[u],o,u,0,this.t);for(h=Math.min(i.t,n);u<h;++u)this.am(0,i[u],o,u,0,n-u);o.clamp()}function ts(i,n,o){--n;var u=o.t=this.t+i.t-n;for(o.s=0;--u>=0;)o[u]=0;for(u=Math.max(n-this.t,0);u<i.t;++u)o[this.t+u-n]=this.am(n-u,i[u],o,0,0,this.t+u-n);o.clamp(),o.drShiftTo(1,o)}function ge(i){this.r2=a(),this.q3=a(),s.ONE.dlShiftTo(2*i.t,this.r2),this.mu=this.r2.divide(i),this.m=i}function rs(i){if(i.s<0||i.t>2*this.m.t)return i.mod(this.m);if(i.compareTo(this.m)<0)return i;var n=a();return i.copyTo(n),this.reduce(n),n}function is(i){return i}function ss(i){for(i.drShiftTo(this.m.t-1,this.r2),i.t>this.m.t+1&&(i.t=this.m.t+1,i.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);i.compareTo(this.r2)<0;)i.dAddOffset(1,this.m.t+1);for(i.subTo(this.r2,i);i.compareTo(this.m)>=0;)i.subTo(this.m,i)}function ns(i,n){i.squareTo(n),this.reduce(n)}function os(i,n,o){i.multiplyTo(n,o),this.reduce(o)}ge.prototype.convert=rs,ge.prototype.revert=is,ge.prototype.reduce=ss,ge.prototype.mulTo=os,ge.prototype.sqrTo=ns;function as(i,n){var o=i.bitLength(),u,h=U(1),d;if(o<=0)return h;o<18?u=1:o<48?u=3:o<144?u=4:o<768?u=5:u=6,o<8?d=new pe(n):n.isEven()?d=new ge(n):d=new Se(n);var S=new Array,m=3,C=u-1,D=(1<<u)-1;if(S[1]=d.convert(this),u>1){var Y=a();for(d.sqrTo(S[1],Y);m<=D;)S[m]=a(),d.mulTo(Y,S[m-2],S[m]),m+=2}var z=i.t-1,fe,Ve=!0,ee=a(),te;for(o=Be(i[z])-1;z>=0;){for(o>=C?fe=i[z]>>o-C&D:(fe=(i[z]&(1<<o+1)-1)<<C-o,z>0&&(fe|=i[z-1]>>this.DB+o-C)),m=u;!(fe&1);)fe>>=1,--m;if((o-=m)<0&&(o+=this.DB,--z),Ve)S[fe].copyTo(h),Ve=!1;else{for(;m>1;)d.sqrTo(h,ee),d.sqrTo(ee,h),m-=2;m>0?d.sqrTo(h,ee):(te=h,h=ee,ee=te),d.mulTo(ee,S[fe],h)}for(;z>=0&&!(i[z]&1<<o);)d.sqrTo(h,ee),te=h,h=ee,ee=te,--o<0&&(o=this.DB-1,--z)}return d.revert(h)}function us(i){var n=this.s<0?this.negate():this.clone(),o=i.s<0?i.negate():i.clone();if(n.compareTo(o)<0){var u=n;n=o,o=u}var h=n.getLowestSetBit(),d=o.getLowestSetBit();if(d<0)return n;for(h<d&&(d=h),d>0&&(n.rShiftTo(d,n),o.rShiftTo(d,o));n.signum()>0;)(h=n.getLowestSetBit())>0&&n.rShiftTo(h,n),(h=o.getLowestSetBit())>0&&o.rShiftTo(h,o),n.compareTo(o)>=0?(n.subTo(o,n),n.rShiftTo(1,n)):(o.subTo(n,o),o.rShiftTo(1,o));return d>0&&o.lShiftTo(d,o),o}function fs(i){if(i<=0)return 0;var n=this.DV%i,o=this.s<0?i-1:0;if(this.t>0)if(n==0)o=this[0]%i;else for(var u=this.t-1;u>=0;--u)o=(n*o+this[u])%i;return o}function cs(i){var n=i.isEven();if(this.isEven()&&n||i.signum()==0)return s.ZERO;for(var o=i.clone(),u=this.clone(),h=U(1),d=U(0),S=U(0),m=U(1);o.signum()!=0;){for(;o.isEven();)o.rShiftTo(1,o),n?((!h.isEven()||!d.isEven())&&(h.addTo(this,h),d.subTo(i,d)),h.rShiftTo(1,h)):d.isEven()||d.subTo(i,d),d.rShiftTo(1,d);for(;u.isEven();)u.rShiftTo(1,u),n?((!S.isEven()||!m.isEven())&&(S.addTo(this,S),m.subTo(i,m)),S.rShiftTo(1,S)):m.isEven()||m.subTo(i,m),m.rShiftTo(1,m);o.compareTo(u)>=0?(o.subTo(u,o),n&&h.subTo(S,h),d.subTo(m,d)):(u.subTo(o,u),n&&S.subTo(h,S),m.subTo(d,m))}if(u.compareTo(s.ONE)!=0)return s.ZERO;if(m.compareTo(i)>=0)return m.subtract(i);if(m.signum()<0)m.addTo(i,m);else return m;return m.signum()<0?m.add(i):m}var x=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],hs=(1<<26)/x[x.length-1];function ls(i){var n,o=this.abs();if(o.t==1&&o[0]<=x[x.length-1]){for(n=0;n<x.length;++n)if(o[0]==x[n])return!0;return!1}if(o.isEven())return!1;for(n=1;n<x.length;){for(var u=x[n],h=n+1;h<x.length&&u<hs;)u*=x[h++];for(u=o.modInt(u);n<h;)if(u%x[n++]==0)return!1}return o.millerRabin(i)}function ds(i){var n=this.subtract(s.ONE),o=n.getLowestSetBit();if(o<=0)return!1;var u=n.shiftRight(o);i=i+1>>1,i>x.length&&(i=x.length);for(var h=a(),d=0;d<i;++d){h.fromInt(x[Math.floor(Math.random()*x.length)]);var S=h.modPow(u,this);if(S.compareTo(s.ONE)!=0&&S.compareTo(n)!=0){for(var m=1;m++<o&&S.compareTo(n)!=0;)if(S=S.modPowInt(2,this),S.compareTo(s.ONE)==0)return!1;if(S.compareTo(n)!=0)return!1}}return!0}s.prototype.chunkSize=pi,s.prototype.toRadix=gi,s.prototype.fromRadix=mi,s.prototype.fromNumber=bi,s.prototype.bitwiseTo=Bi,s.prototype.changeBit=Fi,s.prototype.addTo=Vi,s.prototype.dMultiply=Wi,s.prototype.dAddOffset=Yi,s.prototype.multiplyLowerTo=es,s.prototype.multiplyUpperTo=ts,s.prototype.modInt=fs,s.prototype.millerRabin=ds,s.prototype.clone=ci,s.prototype.intValue=hi,s.prototype.byteValue=li,s.prototype.shortValue=di,s.prototype.signum=Si,s.prototype.toByteArray=_i,s.prototype.equals=vi,s.prototype.min=yi,s.prototype.max=Ii,s.prototype.and=Ei,s.prototype.or=ki,s.prototype.xor=Ci,s.prototype.andNot=Oi,s.prototype.not=Ti,s.prototype.shiftLeft=Ai,s.prototype.shiftRight=Ri,s.prototype.getLowestSetBit=Di,s.prototype.bitCount=Pi,s.prototype.testBit=Ui,s.prototype.setBit=xi,s.prototype.clearBit=Li,s.prototype.flipBit=ji,s.prototype.add=Hi,s.prototype.subtract=qi,s.prototype.multiply=Gi,s.prototype.divide=zi,s.prototype.remainder=Zi,s.prototype.divideAndRemainder=Ki,s.prototype.modPow=as,s.prototype.modInverse=cs,s.prototype.pow=Qi,s.prototype.gcd=us,s.prototype.isProbablePrime=ls,s.prototype.square=$i,s.prototype.Barrett=ge;var je,$,N;function ps(i){$[N++]^=i&255,$[N++]^=i>>8&255,$[N++]^=i>>16&255,$[N++]^=i>>24&255,N>=ut&&(N-=ut)}function xt(){ps(new Date().getTime())}if($==null){$=new Array,N=0;var Q;if(typeof window!="undefined"&&window.crypto){if(window.crypto.getRandomValues){var Lt=new Uint8Array(32);for(window.crypto.getRandomValues(Lt),Q=0;Q<32;++Q)$[N++]=Lt[Q]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var jt=window.crypto.random(32);for(Q=0;Q<jt.length;++Q)$[N++]=jt.charCodeAt(Q)&255}}for(;N<ut;)Q=Math.floor(65536*Math.random()),$[N++]=Q>>>8,$[N++]=Q&255;N=0,xt()}function Ss(){if(je==null){for(xt(),je=_s(),je.init($),N=0;N<$.length;++N)$[N]=0;N=0}return je.next()}function gs(i){var n;for(n=0;n<i.length;++n)i[n]=Ss()}function ot(){}ot.prototype.nextBytes=gs;function at(){this.i=0,this.j=0,this.S=new Array}function ms(i){var n,o,u;for(n=0;n<256;++n)this.S[n]=n;for(o=0,n=0;n<256;++n)o=o+this.S[n]+i[n%i.length]&255,u=this.S[n],this.S[n]=this.S[o],this.S[o]=u;this.i=0,this.j=0}function bs(){var i;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,i=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=i,this.S[i+this.S[this.i]&255]}at.prototype.init=ms,at.prototype.next=bs;function _s(){return new at}var ut=256;typeof Ze!="undefined"?Ze=nr.exports={default:s,BigInteger:s,SecureRandom:ot}:this.jsbn={BigInteger:s,SecureRandom:ot}}).call(Ze)});var Fe=O(Ke=>{(function(){"use strict";var r={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function e(l){return s(f(l),arguments)}function t(l,g){return e.apply(null,[l].concat(g||[]))}function s(l,g){var v=1,w=l.length,c,b="",y,I,_,T,R,G,U,ie;for(y=0;y<w;y++)if(typeof l[y]=="string")b+=l[y];else if(typeof l[y]=="object"){if(_=l[y],_.keys)for(c=g[v],I=0;I<_.keys.length;I++){if(c==null)throw new Error(e('[sprintf] Cannot access property "%s" of undefined value "%s"',_.keys[I],_.keys[I-1]));c=c[_.keys[I]]}else _.param_no?c=g[_.param_no]:c=g[v++];if(r.not_type.test(_.type)&&r.not_primitive.test(_.type)&&c instanceof Function&&(c=c()),r.numeric_arg.test(_.type)&&typeof c!="number"&&isNaN(c))throw new TypeError(e("[sprintf] expecting number but found %T",c));switch(r.number.test(_.type)&&(U=c>=0),_.type){case"b":c=parseInt(c,10).toString(2);break;case"c":c=String.fromCharCode(parseInt(c,10));break;case"d":case"i":c=parseInt(c,10);break;case"j":c=JSON.stringify(c,null,_.width?parseInt(_.width):0);break;case"e":c=_.precision?parseFloat(c).toExponential(_.precision):parseFloat(c).toExponential();break;case"f":c=_.precision?parseFloat(c).toFixed(_.precision):parseFloat(c);break;case"g":c=_.precision?String(Number(c.toPrecision(_.precision))):parseFloat(c);break;case"o":c=(parseInt(c,10)>>>0).toString(8);break;case"s":c=String(c),c=_.precision?c.substring(0,_.precision):c;break;case"t":c=String(!!c),c=_.precision?c.substring(0,_.precision):c;break;case"T":c=Object.prototype.toString.call(c).slice(8,-1).toLowerCase(),c=_.precision?c.substring(0,_.precision):c;break;case"u":c=parseInt(c,10)>>>0;break;case"v":c=c.valueOf(),c=_.precision?c.substring(0,_.precision):c;break;case"x":c=(parseInt(c,10)>>>0).toString(16);break;case"X":c=(parseInt(c,10)>>>0).toString(16).toUpperCase();break}r.json.test(_.type)?b+=c:(r.number.test(_.type)&&(!U||_.sign)?(ie=U?"+":"-",c=c.toString().replace(r.sign,"")):ie="",R=_.pad_char?_.pad_char==="0"?"0":_.pad_char.charAt(1):" ",G=_.width-(ie+c).length,T=_.width&&G>0?R.repeat(G):"",b+=_.align?ie+c+T:R==="0"?ie+T+c:T+ie+c)}return b}var a=Object.create(null);function f(l){if(a[l])return a[l];for(var g=l,v,w=[],c=0;g;){if((v=r.text.exec(g))!==null)w.push(v[0]);else if((v=r.modulo.exec(g))!==null)w.push("%");else if((v=r.placeholder.exec(g))!==null){if(v[2]){c|=1;var b=[],y=v[2],I=[];if((I=r.key.exec(y))!==null)for(b.push(I[1]);(y=y.substring(I[0].length))!=="";)if((I=r.key_access.exec(y))!==null)b.push(I[1]);else if((I=r.index_access.exec(y))!==null)b.push(I[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");v[2]=b}else c|=2;if(c===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");w.push({placeholder:v[0],param_no:v[1],keys:v[2],sign:v[3],pad_char:v[4],align:v[5],width:v[6],precision:v[7],type:v[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");g=g.substring(v[0].length)}return a[l]=w}typeof Ke!="undefined"&&(Ke.sprintf=e,Ke.vsprintf=t),typeof window!="undefined"&&(window.sprintf=e,window.vsprintf=t,typeof define=="function"&&define.amd&&define(function(){return{sprintf:e,vsprintf:t}}))})()});var vt=O(ne=>{"use strict";var zs=ne&&ne.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t);var a=Object.getOwnPropertyDescriptor(e,t);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,s,a)}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t]}),Zs=ne&&ne.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),ur=ne&&ne.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&zs(e,r,t);return Zs(e,r),e};Object.defineProperty(ne,"__esModule",{value:!0});ne.Address4=void 0;var or=ur(St()),re=ur(gt()),ar=ze(),xe=bt(),ke=Fe(),_t=class r{constructor(e){this.groups=re.GROUPS,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=or.isCorrect(re.BITS),this.isInSubnet=or.isInSubnet,this.address=e;let t=re.RE_SUBNET_STRING.exec(e);if(t){if(this.parsedSubnet=t[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>re.BITS)throw new ar.AddressError("Invalid subnet mask.");e=e.replace(re.RE_SUBNET_STRING,"")}this.addressMinusSuffix=e,this.parsedAddress=this.parse(e)}static isValid(e){try{return new r(e),!0}catch(t){return!1}}parse(e){let t=e.split(".");if(!e.match(re.RE_ADDRESS))throw new ar.AddressError("Invalid IPv4 address.");return t}correctForm(){return this.parsedAddress.map(e=>parseInt(e,10)).join(".")}static fromHex(e){let t=e.replace(/:/g,"").padStart(8,"0"),s=[],a;for(a=0;a<8;a+=2){let f=t.slice(a,a+2);s.push(parseInt(f,16))}return new r(s.join("."))}static fromInteger(e){return r.fromHex(e.toString(16))}static fromArpa(e){let s=e.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new r(s)}toHex(){return this.parsedAddress.map(e=>(0,ke.sprintf)("%02x",parseInt(e,10))).join(":")}toArray(){return this.parsedAddress.map(e=>parseInt(e,10))}toGroup6(){let e=[],t;for(t=0;t<re.GROUPS;t+=2){let s=(0,ke.sprintf)("%02x%02x",parseInt(this.parsedAddress[t],10),parseInt(this.parsedAddress[t+1],10));e.push((0,ke.sprintf)("%x",parseInt(s,16)))}return e.join(":")}bigInteger(){return new xe.BigInteger(this.parsedAddress.map(e=>(0,ke.sprintf)("%02x",parseInt(e,10))).join(""),16)}_startAddress(){return new xe.BigInteger(this.mask()+"0".repeat(re.BITS-this.subnetMask),2)}startAddress(){return r.fromBigInteger(this._startAddress())}startAddressExclusive(){let e=new xe.BigInteger("1");return r.fromBigInteger(this._startAddress().add(e))}_endAddress(){return new xe.BigInteger(this.mask()+"1".repeat(re.BITS-this.subnetMask),2)}endAddress(){return r.fromBigInteger(this._endAddress())}endAddressExclusive(){let e=new xe.BigInteger("1");return r.fromBigInteger(this._endAddress().subtract(e))}static fromBigInteger(e){return r.fromInteger(parseInt(e.toString(),10))}mask(e){return e===void 0&&(e=this.subnetMask),this.getBitsBase2(0,e)}getBitsBase2(e,t){return this.binaryZeroPad().slice(e,t)}reverseForm(e){e||(e={});let t=this.correctForm().split(".").reverse().join(".");return e.omitSuffix?t:(0,ke.sprintf)("%s.in-addr.arpa.",t)}isMulticast(){return this.isInSubnet(new r("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(re.BITS,"0")}groupForV6(){let e=this.parsedAddress;return this.address.replace(re.RE_ADDRESS,(0,ke.sprintf)('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',e.slice(0,2).join("."),e.slice(2,4).join(".")))}};ne.Address4=_t});var yt=O(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.RE_URL_WITH_PORT=A.RE_URL=A.RE_ZONE_STRING=A.RE_SUBNET_STRING=A.RE_BAD_ADDRESS=A.RE_BAD_CHARACTERS=A.TYPES=A.SCOPES=A.GROUPS=A.BITS=void 0;A.BITS=128;A.GROUPS=8;A.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"};A.TYPES={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"};A.RE_BAD_CHARACTERS=/([^0-9a-f:/%])/gi;A.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi;A.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/;A.RE_ZONE_STRING=/%.*$/;A.RE_URL=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/);A.RE_URL_WITH_PORT=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/)});var It=O(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.simpleGroup=oe.spanLeadingZeroes=oe.spanAll=oe.spanAllZeroes=void 0;var fr=Fe();function cr(r){return r.replace(/(0+)/g,'<span class="zero">$1</span>')}oe.spanAllZeroes=cr;function Ks(r,e=0){return r.split("").map((s,a)=>(0,fr.sprintf)('<span class="digit value-%s position-%d">%s</span>',s,a+e,cr(s))).join("")}oe.spanAll=Ks;function hr(r){return r.replace(/^(0+)/,'<span class="zero">$1</span>')}function Ws(r){return r.split(":").map(t=>hr(t)).join(":")}oe.spanLeadingZeroes=Ws;function Ys(r,e=0){return r.split(":").map((s,a)=>/group-v4/.test(s)?s:(0,fr.sprintf)('<span class="hover-group group-%d">%s</span>',a+e,hr(s)))}oe.simpleGroup=Ys});var lr=O(M=>{"use strict";var Js=M&&M.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t);var a=Object.getOwnPropertyDescriptor(e,t);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,s,a)}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t]}),Xs=M&&M.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),Qs=M&&M.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&Js(e,r,t);return Xs(e,r),e};Object.defineProperty(M,"__esModule",{value:!0});M.possibleElisions=M.simpleRegularExpression=M.ADDRESS_BOUNDARY=M.padGroup=M.groupPossibilities=void 0;var en=Qs(yt()),Ce=Fe();function Ye(r){return(0,Ce.sprintf)("(%s)",r.join("|"))}M.groupPossibilities=Ye;function We(r){return r.length<4?(0,Ce.sprintf)("0{0,%d}%s",4-r.length,r):r}M.padGroup=We;M.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]";function tn(r){let e=[];r.forEach((s,a)=>{parseInt(s,16)===0&&e.push(a)});let t=e.map(s=>r.map((a,f)=>{if(f===s){let l=f===0||f===en.GROUPS-1?":":"";return Ye([We(a),l])}return We(a)}).join(":"));return t.push(r.map(We).join(":")),Ye(t)}M.simpleRegularExpression=tn;function rn(r,e,t){let s=e?"":":",a=t?"":":",f=[];!e&&!t&&f.push("::"),e&&t&&f.push(""),(t&&!e||!t&&e)&&f.push(":"),f.push((0,Ce.sprintf)("%s(:0{1,4}){1,%d}",s,r-1)),f.push((0,Ce.sprintf)("(0{1,4}:){1,%d}%s",r-1,a)),f.push((0,Ce.sprintf)("(0{1,4}:){%d}0{1,4}",r-1));for(let l=1;l<r-1;l++)for(let g=1;g<r-l;g++)f.push((0,Ce.sprintf)("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",g,r-g-l-1));return Ye(f)}M.possibleElisions=rn});var gr=O(ae=>{"use strict";var sn=ae&&ae.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t);var a=Object.getOwnPropertyDescriptor(e,t);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,s,a)}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t]}),nn=ae&&ae.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),Xe=ae&&ae.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&sn(e,r,t);return nn(e,r),e};Object.defineProperty(ae,"__esModule",{value:!0});ae.Address6=void 0;var dr=Xe(St()),Bt=Xe(gt()),k=Xe(yt()),wt=Xe(It()),be=vt(),_e=lr(),he=ze(),L=bt(),j=Fe();function Je(r){if(!r)throw new Error("Assertion failed.")}function on(r){let e=/(\d+)(\d{3})/;for(;e.test(r);)r=r.replace(e,"$1,$2");return r}function an(r){return r=r.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2'),r=r.replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2'),r}function un(r,e){let t=[],s=[],a;for(a=0;a<r.length;a++)a<e[0]?t.push(r[a]):a>e[1]&&s.push(r[a]);return t.concat(["compact"]).concat(s)}function pr(r){return(0,j.sprintf)("%04x",parseInt(r,16))}function Sr(r){return r&255}var Et=class r{constructor(e,t){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=dr.isInSubnet,this.isCorrect=dr.isCorrect(k.BITS),t===void 0?this.groups=k.GROUPS:this.groups=t,this.address=e;let s=k.RE_SUBNET_STRING.exec(e);if(s){if(this.parsedSubnet=s[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>k.BITS)throw new he.AddressError("Invalid subnet mask.");e=e.replace(k.RE_SUBNET_STRING,"")}else if(/\//.test(e))throw new he.AddressError("Invalid subnet mask.");let a=k.RE_ZONE_STRING.exec(e);a&&(this.zone=a[0],e=e.replace(k.RE_ZONE_STRING,"")),this.addressMinusSuffix=e,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(e){try{return new r(e),!0}catch(t){return!1}}static fromBigInteger(e){let t=e.toString(16).padStart(32,"0"),s=[],a;for(a=0;a<k.GROUPS;a++)s.push(t.slice(a*4,(a+1)*4));return new r(s.join(":"))}static fromURL(e){let t,s=null,a;if(e.indexOf("[")!==-1&&e.indexOf("]:")!==-1){if(a=k.RE_URL_WITH_PORT.exec(e),a===null)return{error:"failed to parse address with port",address:null,port:null};t=a[1],s=a[2]}else if(e.indexOf("/")!==-1){if(e=e.replace(/^[a-z0-9]+:\/\//,""),a=k.RE_URL.exec(e),a===null)return{error:"failed to parse address from URL",address:null,port:null};t=a[1]}else t=e;return s?(s=parseInt(s,10),(s<0||s>65536)&&(s=null)):s=null,{address:new r(t),port:s}}static fromAddress4(e){let t=new be.Address4(e),s=k.BITS-(Bt.BITS-t.subnetMask);return new r(`::ffff:${t.correctForm()}/${s}`)}static fromArpa(e){let t=e.replace(/(\.ip6\.arpa)?\.$/,""),s=7;if(t.length!==63)throw new he.AddressError("Invalid 'ip6.arpa' form.");let a=t.split(".").reverse();for(let f=s;f>0;f--){let l=f*4;a.splice(l,0,":")}return t=a.join(""),new r(t)}microsoftTranscription(){return(0,j.sprintf)("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))}mask(e=this.subnetMask){return this.getBitsBase2(0,e)}possibleSubnets(e=128){let t=k.BITS-this.subnetMask,s=Math.abs(e-k.BITS),a=t-s;return a<0?"0":on(new L.BigInteger("2",10).pow(a).toString(10))}_startAddress(){return new L.BigInteger(this.mask()+"0".repeat(k.BITS-this.subnetMask),2)}startAddress(){return r.fromBigInteger(this._startAddress())}startAddressExclusive(){let e=new L.BigInteger("1");return r.fromBigInteger(this._startAddress().add(e))}_endAddress(){return new L.BigInteger(this.mask()+"1".repeat(k.BITS-this.subnetMask),2)}endAddress(){return r.fromBigInteger(this._endAddress())}endAddressExclusive(){let e=new L.BigInteger("1");return r.fromBigInteger(this._endAddress().subtract(e))}getScope(){let e=k.SCOPES[this.getBits(12,16).intValue()];return this.getType()==="Global unicast"&&e!=="Link local"&&(e="Global"),e||"Unknown"}getType(){for(let e of Object.keys(k.TYPES))if(this.isInSubnet(new r(e)))return k.TYPES[e];return"Global unicast"}getBits(e,t){return new L.BigInteger(this.getBitsBase2(e,t),2)}getBitsBase2(e,t){return this.binaryZeroPad().slice(e,t)}getBitsBase16(e,t){let s=t-e;if(s%4!==0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(e,t).toString(16).padStart(s/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,k.BITS)}reverseForm(e){e||(e={});let t=Math.floor(this.subnetMask/4),s=this.canonicalForm().replace(/:/g,"").split("").slice(0,t).reverse().join(".");return t>0?e.omitSuffix?s:(0,j.sprintf)("%s.ip6.arpa.",s):e.omitSuffix?"":"ip6.arpa."}correctForm(){let e,t=[],s=0,a=[];for(e=0;e<this.parsedAddress.length;e++){let g=parseInt(this.parsedAddress[e],16);g===0&&s++,g!==0&&s>0&&(s>1&&a.push([e-s,e-1]),s=0)}s>1&&a.push([this.parsedAddress.length-s,this.parsedAddress.length-1]);let f=a.map(g=>g[1]-g[0]+1);if(a.length>0){let g=f.indexOf(Math.max(...f));t=un(this.parsedAddress,a[g])}else t=this.parsedAddress;for(e=0;e<t.length;e++)t[e]!=="compact"&&(t[e]=parseInt(t[e],16).toString(16));let l=t.join(":");return l=l.replace(/^compact$/,"::"),l=l.replace(/^compact|compact$/,":"),l=l.replace(/compact/,""),l}binaryZeroPad(){return this.bigInteger().toString(2).padStart(k.BITS,"0")}parse4in6(e){let t=e.split(":"),a=t.slice(-1)[0].match(Bt.RE_ADDRESS);if(a){this.parsedAddress4=a[0],this.address4=new be.Address4(this.parsedAddress4);for(let f=0;f<this.address4.groups;f++)if(/^0[0-9]+/.test(this.address4.parsedAddress[f]))throw new he.AddressError("IPv4 addresses can't have leading zeroes.",e.replace(Bt.RE_ADDRESS,this.address4.parsedAddress.map(an).join(".")));this.v4=!0,t[t.length-1]=this.address4.toGroup6(),e=t.join(":")}return e}parse(e){e=this.parse4in6(e);let t=e.match(k.RE_BAD_CHARACTERS);if(t)throw new he.AddressError((0,j.sprintf)("Bad character%s detected in address: %s",t.length>1?"s":"",t.join("")),e.replace(k.RE_BAD_CHARACTERS,'<span class="parse-error">$1</span>'));let s=e.match(k.RE_BAD_ADDRESS);if(s)throw new he.AddressError((0,j.sprintf)("Address failed regex: %s",s.join("")),e.replace(k.RE_BAD_ADDRESS,'<span class="parse-error">$1</span>'));let a=[],f=e.split("::");if(f.length===2){let l=f[0].split(":"),g=f[1].split(":");l.length===1&&l[0]===""&&(l=[]),g.length===1&&g[0]===""&&(g=[]);let v=this.groups-(l.length+g.length);if(!v)throw new he.AddressError("Error parsing groups");this.elidedGroups=v,this.elisionBegin=l.length,this.elisionEnd=l.length+this.elidedGroups,a=a.concat(l);for(let w=0;w<v;w++)a.push("0");a=a.concat(g)}else if(f.length===1)a=e.split(":"),this.elidedGroups=0;else throw new he.AddressError("Too many :: groups found");if(a=a.map(l=>(0,j.sprintf)("%x",parseInt(l,16))),a.length!==this.groups)throw new he.AddressError("Incorrect number of groups found");return a}canonicalForm(){return this.parsedAddress.map(pr).join(":")}decimal(){return this.parsedAddress.map(e=>(0,j.sprintf)("%05d",parseInt(e,16))).join(":")}bigInteger(){return new L.BigInteger(this.parsedAddress.map(pr).join(""),16)}to4(){let e=this.binaryZeroPad().split("");return be.Address4.fromHex(new L.BigInteger(e.slice(96,128).join(""),2).toString(16))}to4in6(){let e=this.to4(),s=new r(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),a="";return/:$/.test(s)||(a=":"),s+a+e.address}inspectTeredo(){let e=this.getBitsBase16(0,32),t=this.getBits(80,96).xor(new L.BigInteger("ffff",16)).toString(),s=be.Address4.fromHex(this.getBitsBase16(32,64)),a=be.Address4.fromHex(this.getBits(96,128).xor(new L.BigInteger("ffffffff",16)).toString(16)),f=this.getBits(64,80),l=this.getBitsBase2(64,80),g=f.testBit(15),v=f.testBit(14),w=f.testBit(8),c=f.testBit(9),b=new L.BigInteger(l.slice(2,6)+l.slice(8,16),2).toString(10);return{prefix:(0,j.sprintf)("%s:%s",e.slice(0,4),e.slice(4,8)),server4:s.address,client4:a.address,flags:l,coneNat:g,microsoft:{reserved:v,universalLocal:c,groupIndividual:w,nonce:b},udpPort:t}}inspect6to4(){let e=this.getBitsBase16(0,16),t=be.Address4.fromHex(this.getBitsBase16(16,48));return{prefix:(0,j.sprintf)("%s",e.slice(0,4)),gateway:t.address}}to6to4(){if(!this.is4())return null;let e=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new r(e)}toByteArray(){let e=this.bigInteger().toByteArray();return e.length===17&&e[0]===0?e.slice(1):e}toUnsignedByteArray(){return this.toByteArray().map(Sr)}static fromByteArray(e){return this.fromUnsignedByteArray(e.map(Sr))}static fromUnsignedByteArray(e){let t=new L.BigInteger("256",10),s=new L.BigInteger("0",10),a=new L.BigInteger("1",10);for(let f=e.length-1;f>=0;f--)s=s.add(a.multiply(new L.BigInteger(e[f].toString(10),10))),a=a.multiply(t);return r.fromBigInteger(s)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){return this.getBitsBase2(0,64)==="1111111010000000000000000000000000000000000000000000000000000000"}isMulticast(){return this.getType()==="Multicast"}is4(){return this.v4}isTeredo(){return this.isInSubnet(new r("2001::/32"))}is6to4(){return this.isInSubnet(new r("2002::/16"))}isLoopback(){return this.getType()==="Loopback"}href(e){return e===void 0?e="":e=(0,j.sprintf)(":%s",e),(0,j.sprintf)("http://[%s]%s/",this.correctForm(),e)}link(e){e||(e={}),e.className===void 0&&(e.className=""),e.prefix===void 0&&(e.prefix="/#address="),e.v4===void 0&&(e.v4=!1);let t=this.correctForm;return e.v4&&(t=this.to4in6),e.className?(0,j.sprintf)('<a href="%1$s%2$s" class="%3$s">%2$s</a>',e.prefix,t.call(this),e.className):(0,j.sprintf)('<a href="%1$s%2$s">%2$s</a>',e.prefix,t.call(this))}group(){if(this.elidedGroups===0)return wt.simpleGroup(this.address).join(":");Je(typeof this.elidedGroups=="number"),Je(typeof this.elisionBegin=="number");let e=[],[t,s]=this.address.split("::");t.length?e.push(...wt.simpleGroup(t)):e.push("");let a=["hover-group"];for(let f=this.elisionBegin;f<this.elisionBegin+this.elidedGroups;f++)a.push((0,j.sprintf)("group-%d",f));return e.push((0,j.sprintf)('<span class="%s"></span>',a.join(" "))),s.length?e.push(...wt.simpleGroup(s,this.elisionEnd)):e.push(""),this.is4()&&(Je(this.address4 instanceof be.Address4),e.pop(),e.push(this.address4.groupForV6())),e.join(":")}regularExpressionString(e=!1){let t=[],s=new r(this.correctForm());if(s.elidedGroups===0)t.push((0,_e.simpleRegularExpression)(s.parsedAddress));else if(s.elidedGroups===k.GROUPS)t.push((0,_e.possibleElisions)(k.GROUPS));else{let a=s.address.split("::");a[0].length&&t.push((0,_e.simpleRegularExpression)(a[0].split(":"))),Je(typeof s.elidedGroups=="number"),t.push((0,_e.possibleElisions)(s.elidedGroups,a[0].length!==0,a[1].length!==0)),a[1].length&&t.push((0,_e.simpleRegularExpression)(a[1].split(":"))),t=[t.join(":")]}return e||(t=["(?=^|",_e.ADDRESS_BOUNDARY,"|[^\\w\\:])(",...t,")(?=[^\\w\\:]|",_e.ADDRESS_BOUNDARY,"|$)"]),t.join("")}regularExpression(e=!1){return new RegExp(this.regularExpressionString(e),"i")}};ae.Address6=Et});var kt=O(F=>{"use strict";var fn=F&&F.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t);var a=Object.getOwnPropertyDescriptor(e,t);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,s,a)}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t]}),cn=F&&F.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),hn=F&&F.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&fn(e,r,t);return cn(e,r),e};Object.defineProperty(F,"__esModule",{value:!0});F.v6=F.AddressError=F.Address6=F.Address4=void 0;var ln=vt();Object.defineProperty(F,"Address4",{enumerable:!0,get:function(){return ln.Address4}});var dn=gr();Object.defineProperty(F,"Address6",{enumerable:!0,get:function(){return dn.Address6}});var pn=ze();Object.defineProperty(F,"AddressError",{enumerable:!0,get:function(){return pn.AddressError}});var Sn=hn(It());F.v6={helpers:Sn}});var Ir=O(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.ipToBuffer=J.int32ToIpv4=J.ipv4ToInt32=J.validateSocksClientChainOptions=J.validateSocksClientOptions=void 0;var V=pt(),P=lt(),gn=require("stream"),Ct=kt(),mr=require("net");function mn(r,e=["connect","bind","associate"]){if(!P.SocksCommand[r.command])throw new V.SocksClientError(P.ERRORS.InvalidSocksCommand,r);if(e.indexOf(r.command)===-1)throw new V.SocksClientError(P.ERRORS.InvalidSocksCommandForOperation,r);if(!_r(r.destination))throw new V.SocksClientError(P.ERRORS.InvalidSocksClientOptionsDestination,r);if(!vr(r.proxy))throw new V.SocksClientError(P.ERRORS.InvalidSocksClientOptionsProxy,r);if(br(r.proxy,r),r.timeout&&!yr(r.timeout))throw new V.SocksClientError(P.ERRORS.InvalidSocksClientOptionsTimeout,r);if(r.existing_socket&&!(r.existing_socket instanceof gn.Duplex))throw new V.SocksClientError(P.ERRORS.InvalidSocksClientOptionsExistingSocket,r)}J.validateSocksClientOptions=mn;function bn(r){if(r.command!=="connect")throw new V.SocksClientError(P.ERRORS.InvalidSocksCommandChain,r);if(!_r(r.destination))throw new V.SocksClientError(P.ERRORS.InvalidSocksClientOptionsDestination,r);if(!(r.proxies&&Array.isArray(r.proxies)&&r.proxies.length>=2))throw new V.SocksClientError(P.ERRORS.InvalidSocksClientOptionsProxiesLength,r);if(r.proxies.forEach(e=>{if(!vr(e))throw new V.SocksClientError(P.ERRORS.InvalidSocksClientOptionsProxy,r);br(e,r)}),r.timeout&&!yr(r.timeout))throw new V.SocksClientError(P.ERRORS.InvalidSocksClientOptionsTimeout,r)}J.validateSocksClientChainOptions=bn;function br(r,e){if(r.custom_auth_method!==void 0){if(r.custom_auth_method<P.SOCKS5_CUSTOM_AUTH_START||r.custom_auth_method>P.SOCKS5_CUSTOM_AUTH_END)throw new V.SocksClientError(P.ERRORS.InvalidSocksClientOptionsCustomAuthRange,e);if(r.custom_auth_request_handler===void 0||typeof r.custom_auth_request_handler!="function")throw new V.SocksClientError(P.ERRORS.InvalidSocksClientOptionsCustomAuthOptions,e);if(r.custom_auth_response_size===void 0)throw new V.SocksClientError(P.ERRORS.InvalidSocksClientOptionsCustomAuthOptions,e);if(r.custom_auth_response_handler===void 0||typeof r.custom_auth_response_handler!="function")throw new V.SocksClientError(P.ERRORS.InvalidSocksClientOptionsCustomAuthOptions,e)}}function _r(r){return r&&typeof r.host=="string"&&typeof r.port=="number"&&r.port>=0&&r.port<=65535}function vr(r){return r&&(typeof r.host=="string"||typeof r.ipaddress=="string")&&typeof r.port=="number"&&r.port>=0&&r.port<=65535&&(r.type===4||r.type===5)}function yr(r){return typeof r=="number"&&r>0}function _n(r){return new Ct.Address4(r).toArray().reduce((t,s)=>(t<<8)+s,0)}J.ipv4ToInt32=_n;function vn(r){let e=r>>>24&255,t=r>>>16&255,s=r>>>8&255,a=r&255;return[e,t,s,a].join(".")}J.int32ToIpv4=vn;function yn(r){if(mr.isIPv4(r)){let e=new Ct.Address4(r);return Buffer.from(e.toArray())}else if(mr.isIPv6(r)){let e=new Ct.Address6(r);return Buffer.from(e.canonicalForm().split(":").map(t=>t.padStart(4,"0")).join(""),"hex")}else throw new Error("Invalid IP address format")}J.ipToBuffer=yn});var Br=O(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.ReceiveBuffer=void 0;var Ot=class{constructor(e=4096){this.buffer=Buffer.allocUnsafe(e),this.offset=0,this.originalSize=e}get length(){return this.offset}append(e){if(!Buffer.isBuffer(e))throw new Error("Attempted to append a non-buffer instance to ReceiveBuffer.");if(this.offset+e.length>=this.buffer.length){let t=this.buffer;this.buffer=Buffer.allocUnsafe(Math.max(this.buffer.length+this.originalSize,this.buffer.length+e.length)),t.copy(this.buffer)}return e.copy(this.buffer,this.offset),this.offset+=e.length}peek(e){if(e>this.offset)throw new Error("Attempted to read beyond the bounds of the managed internal data.");return this.buffer.slice(0,e)}get(e){if(e>this.offset)throw new Error("Attempted to read beyond the bounds of the managed internal data.");let t=Buffer.allocUnsafe(e);return this.buffer.slice(0,e).copy(t),this.buffer.copyWithin(0,e,e+this.offset-e),this.offset-=e,t}};Qe.ReceiveBuffer=Ot});var wr=O(de=>{"use strict";var Oe=de&&de.__awaiter||function(r,e,t,s){function a(f){return f instanceof t?f:new t(function(l){l(f)})}return new(t||(t=Promise))(function(f,l){function g(c){try{w(s.next(c))}catch(b){l(b)}}function v(c){try{w(s.throw(c))}catch(b){l(b)}}function w(c){c.done?f(c.value):a(c.value).then(g,v)}w((s=s.apply(r,e||[])).next())})};Object.defineProperty(de,"__esModule",{value:!0});de.SocksClientError=de.SocksClient=void 0;var In=require("events"),Te=require("net"),H=Xt(),p=lt(),Z=Ir(),Bn=Br(),At=pt();Object.defineProperty(de,"SocksClientError",{enumerable:!0,get:function(){return At.SocksClientError}});var Tt=kt(),Rt=class r extends In.EventEmitter{constructor(e){super(),this.options=Object.assign({},e),(0,Z.validateSocksClientOptions)(e),this.setState(p.SocksClientState.Created)}static createConnection(e,t){return new Promise((s,a)=>{try{(0,Z.validateSocksClientOptions)(e,["connect"])}catch(l){return typeof t=="function"?(t(l),s(l)):a(l)}let f=new r(e);f.connect(e.existing_socket),f.once("established",l=>{f.removeAllListeners(),typeof t=="function"&&t(null,l),s(l)}),f.once("error",l=>{f.removeAllListeners(),typeof t=="function"?(t(l),s(l)):a(l)})})}static createConnectionChain(e,t){return new Promise((s,a)=>Oe(this,void 0,void 0,function*(){try{(0,Z.validateSocksClientChainOptions)(e)}catch(f){return typeof t=="function"?(t(f),s(f)):a(f)}e.randomizeChain&&(0,At.shuffleArray)(e.proxies);try{let f;for(let l=0;l<e.proxies.length;l++){let g=e.proxies[l],v=l===e.proxies.length-1?e.destination:{host:e.proxies[l+1].host||e.proxies[l+1].ipaddress,port:e.proxies[l+1].port},w=yield r.createConnection({command:"connect",proxy:g,destination:v,existing_socket:f});f=f||w.socket}typeof t=="function"?(t(null,{socket:f}),s({socket:f})):s({socket:f})}catch(f){typeof t=="function"?(t(f),s(f)):a(f)}}))}static createUDPFrame(e){let t=new H.SmartBuffer;return t.writeUInt16BE(0),t.writeUInt8(e.frameNumber||0),Te.isIPv4(e.remoteHost.host)?(t.writeUInt8(p.Socks5HostType.IPv4),t.writeUInt32BE((0,Z.ipv4ToInt32)(e.remoteHost.host))):Te.isIPv6(e.remoteHost.host)?(t.writeUInt8(p.Socks5HostType.IPv6),t.writeBuffer((0,Z.ipToBuffer)(e.remoteHost.host))):(t.writeUInt8(p.Socks5HostType.Hostname),t.writeUInt8(Buffer.byteLength(e.remoteHost.host)),t.writeString(e.remoteHost.host)),t.writeUInt16BE(e.remoteHost.port),t.writeBuffer(e.data),t.toBuffer()}static parseUDPFrame(e){let t=H.SmartBuffer.fromBuffer(e);t.readOffset=2;let s=t.readUInt8(),a=t.readUInt8(),f;a===p.Socks5HostType.IPv4?f=(0,Z.int32ToIpv4)(t.readUInt32BE()):a===p.Socks5HostType.IPv6?f=Tt.Address6.fromByteArray(Array.from(t.readBuffer(16))).canonicalForm():f=t.readString(t.readUInt8());let l=t.readUInt16BE();return{frameNumber:s,remoteHost:{host:f,port:l},data:t.readBuffer()}}setState(e){this.state!==p.SocksClientState.Error&&(this.state=e)}connect(e){this.onDataReceived=s=>this.onDataReceivedHandler(s),this.onClose=()=>this.onCloseHandler(),this.onError=s=>this.onErrorHandler(s),this.onConnect=()=>this.onConnectHandler();let t=setTimeout(()=>this.onEstablishedTimeout(),this.options.timeout||p.DEFAULT_TIMEOUT);t.unref&&typeof t.unref=="function"&&t.unref(),e?this.socket=e:this.socket=new Te.Socket,this.socket.once("close",this.onClose),this.socket.once("error",this.onError),this.socket.once("connect",this.onConnect),this.socket.on("data",this.onDataReceived),this.setState(p.SocksClientState.Connecting),this.receiveBuffer=new Bn.ReceiveBuffer,e?this.socket.emit("connect"):(this.socket.connect(this.getSocketOptions()),this.options.set_tcp_nodelay!==void 0&&this.options.set_tcp_nodelay!==null&&this.socket.setNoDelay(!!this.options.set_tcp_nodelay)),this.prependOnceListener("established",s=>{setImmediate(()=>{if(this.receiveBuffer.length>0){let a=this.receiveBuffer.get(this.receiveBuffer.length);s.socket.emit("data",a)}s.socket.resume()})})}getSocketOptions(){return Object.assign(Object.assign({},this.options.socket_options),{host:this.options.proxy.host||this.options.proxy.ipaddress,port:this.options.proxy.port})}onEstablishedTimeout(){this.state!==p.SocksClientState.Established&&this.state!==p.SocksClientState.BoundWaitingForConnection&&this.closeSocket(p.ERRORS.ProxyConnectionTimedOut)}onConnectHandler(){this.setState(p.SocksClientState.Connected),this.options.proxy.type===4?this.sendSocks4InitialHandshake():this.sendSocks5InitialHandshake(),this.setState(p.SocksClientState.SentInitialHandshake)}onDataReceivedHandler(e){this.receiveBuffer.append(e),this.processData()}processData(){for(;this.state!==p.SocksClientState.Established&&this.state!==p.SocksClientState.Error&&this.receiveBuffer.length>=this.nextRequiredPacketBufferSize;)if(this.state===p.SocksClientState.SentInitialHandshake)this.options.proxy.type===4?this.handleSocks4FinalHandshakeResponse():this.handleInitialSocks5HandshakeResponse();else if(this.state===p.SocksClientState.SentAuthentication)this.handleInitialSocks5AuthenticationHandshakeResponse();else if(this.state===p.SocksClientState.SentFinalHandshake)this.handleSocks5FinalHandshakeResponse();else if(this.state===p.SocksClientState.BoundWaitingForConnection)this.options.proxy.type===4?this.handleSocks4IncomingConnectionResponse():this.handleSocks5IncomingConnectionResponse();else{this.closeSocket(p.ERRORS.InternalError);break}}onCloseHandler(){this.closeSocket(p.ERRORS.SocketClosed)}onErrorHandler(e){this.closeSocket(e.message)}removeInternalSocketHandlers(){this.socket.pause(),this.socket.removeListener("data",this.onDataReceived),this.socket.removeListener("close",this.onClose),this.socket.removeListener("error",this.onError),this.socket.removeListener("connect",this.onConnect)}closeSocket(e){this.state!==p.SocksClientState.Error&&(this.setState(p.SocksClientState.Error),this.socket.destroy(),this.removeInternalSocketHandlers(),this.emit("error",new At.SocksClientError(e,this.options)))}sendSocks4InitialHandshake(){let e=this.options.proxy.userId||"",t=new H.SmartBuffer;t.writeUInt8(4),t.writeUInt8(p.SocksCommand[this.options.command]),t.writeUInt16BE(this.options.destination.port),Te.isIPv4(this.options.destination.host)?(t.writeBuffer((0,Z.ipToBuffer)(this.options.destination.host)),t.writeStringNT(e)):(t.writeUInt8(0),t.writeUInt8(0),t.writeUInt8(0),t.writeUInt8(1),t.writeStringNT(e),t.writeStringNT(this.options.destination.host)),this.nextRequiredPacketBufferSize=p.SOCKS_INCOMING_PACKET_SIZES.Socks4Response,this.socket.write(t.toBuffer())}handleSocks4FinalHandshakeResponse(){let e=this.receiveBuffer.get(8);if(e[1]!==p.Socks4Response.Granted)this.closeSocket(`${p.ERRORS.Socks4ProxyRejectedConnection} - (${p.Socks4Response[e[1]]})`);else if(p.SocksCommand[this.options.command]===p.SocksCommand.bind){let t=H.SmartBuffer.fromBuffer(e);t.readOffset=2;let s={port:t.readUInt16BE(),host:(0,Z.int32ToIpv4)(t.readUInt32BE())};s.host==="0.0.0.0"&&(s.host=this.options.proxy.ipaddress),this.setState(p.SocksClientState.BoundWaitingForConnection),this.emit("bound",{remoteHost:s,socket:this.socket})}else this.setState(p.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{socket:this.socket})}handleSocks4IncomingConnectionResponse(){let e=this.receiveBuffer.get(8);if(e[1]!==p.Socks4Response.Granted)this.closeSocket(`${p.ERRORS.Socks4ProxyRejectedIncomingBoundConnection} - (${p.Socks4Response[e[1]]})`);else{let t=H.SmartBuffer.fromBuffer(e);t.readOffset=2;let s={port:t.readUInt16BE(),host:(0,Z.int32ToIpv4)(t.readUInt32BE())};this.setState(p.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{remoteHost:s,socket:this.socket})}}sendSocks5InitialHandshake(){let e=new H.SmartBuffer,t=[p.Socks5Auth.NoAuth];(this.options.proxy.userId||this.options.proxy.password)&&t.push(p.Socks5Auth.UserPass),this.options.proxy.custom_auth_method!==void 0&&t.push(this.options.proxy.custom_auth_method),e.writeUInt8(5),e.writeUInt8(t.length);for(let s of t)e.writeUInt8(s);this.nextRequiredPacketBufferSize=p.SOCKS_INCOMING_PACKET_SIZES.Socks5InitialHandshakeResponse,this.socket.write(e.toBuffer()),this.setState(p.SocksClientState.SentInitialHandshake)}handleInitialSocks5HandshakeResponse(){let e=this.receiveBuffer.get(2);e[0]!==5?this.closeSocket(p.ERRORS.InvalidSocks5IntiailHandshakeSocksVersion):e[1]===p.SOCKS5_NO_ACCEPTABLE_AUTH?this.closeSocket(p.ERRORS.InvalidSocks5InitialHandshakeNoAcceptedAuthType):e[1]===p.Socks5Auth.NoAuth?(this.socks5ChosenAuthType=p.Socks5Auth.NoAuth,this.sendSocks5CommandRequest()):e[1]===p.Socks5Auth.UserPass?(this.socks5ChosenAuthType=p.Socks5Auth.UserPass,this.sendSocks5UserPassAuthentication()):e[1]===this.options.proxy.custom_auth_method?(this.socks5ChosenAuthType=this.options.proxy.custom_auth_method,this.sendSocks5CustomAuthentication()):this.closeSocket(p.ERRORS.InvalidSocks5InitialHandshakeUnknownAuthType)}sendSocks5UserPassAuthentication(){let e=this.options.proxy.userId||"",t=this.options.proxy.password||"",s=new H.SmartBuffer;s.writeUInt8(1),s.writeUInt8(Buffer.byteLength(e)),s.writeString(e),s.writeUInt8(Buffer.byteLength(t)),s.writeString(t),this.nextRequiredPacketBufferSize=p.SOCKS_INCOMING_PACKET_SIZES.Socks5UserPassAuthenticationResponse,this.socket.write(s.toBuffer()),this.setState(p.SocksClientState.SentAuthentication)}sendSocks5CustomAuthentication(){return Oe(this,void 0,void 0,function*(){this.nextRequiredPacketBufferSize=this.options.proxy.custom_auth_response_size,this.socket.write(yield this.options.proxy.custom_auth_request_handler()),this.setState(p.SocksClientState.SentAuthentication)})}handleSocks5CustomAuthHandshakeResponse(e){return Oe(this,void 0,void 0,function*(){return yield this.options.proxy.custom_auth_response_handler(e)})}handleSocks5AuthenticationNoAuthHandshakeResponse(e){return Oe(this,void 0,void 0,function*(){return e[1]===0})}handleSocks5AuthenticationUserPassHandshakeResponse(e){return Oe(this,void 0,void 0,function*(){return e[1]===0})}handleInitialSocks5AuthenticationHandshakeResponse(){return Oe(this,void 0,void 0,function*(){this.setState(p.SocksClientState.ReceivedAuthenticationResponse);let e=!1;this.socks5ChosenAuthType===p.Socks5Auth.NoAuth?e=yield this.handleSocks5AuthenticationNoAuthHandshakeResponse(this.receiveBuffer.get(2)):this.socks5ChosenAuthType===p.Socks5Auth.UserPass?e=yield this.handleSocks5AuthenticationUserPassHandshakeResponse(this.receiveBuffer.get(2)):this.socks5ChosenAuthType===this.options.proxy.custom_auth_method&&(e=yield this.handleSocks5CustomAuthHandshakeResponse(this.receiveBuffer.get(this.options.proxy.custom_auth_response_size))),e?this.sendSocks5CommandRequest():this.closeSocket(p.ERRORS.Socks5AuthenticationFailed)})}sendSocks5CommandRequest(){let e=new H.SmartBuffer;e.writeUInt8(5),e.writeUInt8(p.SocksCommand[this.options.command]),e.writeUInt8(0),Te.isIPv4(this.options.destination.host)?(e.writeUInt8(p.Socks5HostType.IPv4),e.writeBuffer((0,Z.ipToBuffer)(this.options.destination.host))):Te.isIPv6(this.options.destination.host)?(e.writeUInt8(p.Socks5HostType.IPv6),e.writeBuffer((0,Z.ipToBuffer)(this.options.destination.host))):(e.writeUInt8(p.Socks5HostType.Hostname),e.writeUInt8(this.options.destination.host.length),e.writeString(this.options.destination.host)),e.writeUInt16BE(this.options.destination.port),this.nextRequiredPacketBufferSize=p.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHeader,this.socket.write(e.toBuffer()),this.setState(p.SocksClientState.SentFinalHandshake)}handleSocks5FinalHandshakeResponse(){let e=this.receiveBuffer.peek(5);if(e[0]!==5||e[1]!==p.Socks5Response.Granted)this.closeSocket(`${p.ERRORS.InvalidSocks5FinalHandshakeRejected} - ${p.Socks5Response[e[1]]}`);else{let t=e[3],s,a;if(t===p.Socks5HostType.IPv4){let f=p.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv4;if(this.receiveBuffer.length<f){this.nextRequiredPacketBufferSize=f;return}a=H.SmartBuffer.fromBuffer(this.receiveBuffer.get(f).slice(4)),s={host:(0,Z.int32ToIpv4)(a.readUInt32BE()),port:a.readUInt16BE()},s.host==="0.0.0.0"&&(s.host=this.options.proxy.ipaddress)}else if(t===p.Socks5HostType.Hostname){let f=e[4],l=p.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHostname(f);if(this.receiveBuffer.length<l){this.nextRequiredPacketBufferSize=l;return}a=H.SmartBuffer.fromBuffer(this.receiveBuffer.get(l).slice(5)),s={host:a.readString(f),port:a.readUInt16BE()}}else if(t===p.Socks5HostType.IPv6){let f=p.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv6;if(this.receiveBuffer.length<f){this.nextRequiredPacketBufferSize=f;return}a=H.SmartBuffer.fromBuffer(this.receiveBuffer.get(f).slice(4)),s={host:Tt.Address6.fromByteArray(Array.from(a.readBuffer(16))).canonicalForm(),port:a.readUInt16BE()}}this.setState(p.SocksClientState.ReceivedFinalResponse),p.SocksCommand[this.options.command]===p.SocksCommand.connect?(this.setState(p.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{remoteHost:s,socket:this.socket})):p.SocksCommand[this.options.command]===p.SocksCommand.bind?(this.setState(p.SocksClientState.BoundWaitingForConnection),this.nextRequiredPacketBufferSize=p.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHeader,this.emit("bound",{remoteHost:s,socket:this.socket})):p.SocksCommand[this.options.command]===p.SocksCommand.associate&&(this.setState(p.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{remoteHost:s,socket:this.socket}))}}handleSocks5IncomingConnectionResponse(){let e=this.receiveBuffer.peek(5);if(e[0]!==5||e[1]!==p.Socks5Response.Granted)this.closeSocket(`${p.ERRORS.Socks5ProxyRejectedIncomingBoundConnection} - ${p.Socks5Response[e[1]]}`);else{let t=e[3],s,a;if(t===p.Socks5HostType.IPv4){let f=p.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv4;if(this.receiveBuffer.length<f){this.nextRequiredPacketBufferSize=f;return}a=H.SmartBuffer.fromBuffer(this.receiveBuffer.get(f).slice(4)),s={host:(0,Z.int32ToIpv4)(a.readUInt32BE()),port:a.readUInt16BE()},s.host==="0.0.0.0"&&(s.host=this.options.proxy.ipaddress)}else if(t===p.Socks5HostType.Hostname){let f=e[4],l=p.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHostname(f);if(this.receiveBuffer.length<l){this.nextRequiredPacketBufferSize=l;return}a=H.SmartBuffer.fromBuffer(this.receiveBuffer.get(l).slice(5)),s={host:a.readString(f),port:a.readUInt16BE()}}else if(t===p.Socks5HostType.IPv6){let f=p.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv6;if(this.receiveBuffer.length<f){this.nextRequiredPacketBufferSize=f;return}a=H.SmartBuffer.fromBuffer(this.receiveBuffer.get(f).slice(4)),s={host:Tt.Address6.fromByteArray(Array.from(a.readBuffer(16))).canonicalForm(),port:a.readUInt16BE()}}this.setState(p.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{remoteHost:s,socket:this.socket})}}get socksClientOptions(){return Object.assign({},this.options)}};de.SocksClient=Rt});var Er=O(ve=>{"use strict";var wn=ve&&ve.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t);var a=Object.getOwnPropertyDescriptor(e,t);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,s,a)}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t]}),En=ve&&ve.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&wn(e,r,t)};Object.defineProperty(ve,"__esModule",{value:!0});En(wr(),ve)});var Or=O(q=>{"use strict";var kn=q&&q.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t);var a=Object.getOwnPropertyDescriptor(e,t);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,s,a)}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t]}),Cn=q&&q.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),kr=q&&q.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&kn(e,r,t);return Cn(e,r),e};Object.defineProperty(q,"__esModule",{value:!0});q.req=q.json=q.toBuffer=void 0;var On=kr(require("http")),Tn=kr(require("https"));function Cr(r){return Ue(this,null,function*(){let e=0,t=[];try{for(var s=zt(r),a,f,l;a=!(f=yield s.next()).done;a=!1){let g=f.value;e+=g.length,t.push(g)}}catch(f){l=[f]}finally{try{a&&(f=s.return)&&(yield f.call(s))}finally{if(l)throw l[0]}}return Buffer.concat(t,e)})}q.toBuffer=Cr;function An(r){return Ue(this,null,function*(){let t=(yield Cr(r)).toString("utf8");try{return JSON.parse(t)}catch(s){let a=s;throw a.message+=` (input: ${t})`,a}})}q.json=An;function Rn(r,e={}){let s=((typeof r=="string"?r:r.href).startsWith("https:")?Tn:On).request(r,e),a=new Promise((f,l)=>{s.once("response",f).once("error",l).end()});return s.then=a.then.bind(a),s}q.req=Rn});var Nr=O(K=>{"use strict";var Ar=K&&K.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t);var a=Object.getOwnPropertyDescriptor(e,t);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,s,a)}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t]}),Nn=K&&K.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),Rr=K&&K.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&Ar(e,r,t);return Nn(e,r),e},Dn=K&&K.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Ar(e,r,t)};Object.defineProperty(K,"__esModule",{value:!0});K.Agent=void 0;var Mn=Rr(require("net")),Tr=Rr(require("http")),Pn=require("https");Dn(Or(),K);var ue=Symbol("AgentBaseInternalState"),Nt=class extends Tr.Agent{constructor(e){super(e),this[ue]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint=="boolean")return e.secureEndpoint;if(typeof e.protocol=="string")return e.protocol==="https:"}let{stack:t}=new Error;return typeof t!="string"?!1:t.split(`
`).some(s=>s.indexOf("(https.js:")!==-1||s.indexOf("node:https:")!==-1)}incrementSockets(e){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;this.sockets[e]||(this.sockets[e]=[]);let t=new Mn.Socket({writable:!1});return this.sockets[e].push(t),this.totalSocketCount++,t}decrementSockets(e,t){if(!this.sockets[e]||t===null)return;let s=this.sockets[e],a=s.indexOf(t);a!==-1&&(s.splice(a,1),this.totalSocketCount--,s.length===0&&delete this.sockets[e])}getName(e){return(typeof e.secureEndpoint=="boolean"?e.secureEndpoint:this.isSecureEndpoint(e))?Pn.Agent.prototype.getName.call(this,e):super.getName(e)}createSocket(e,t,s){let a=Ge(qe({},t),{secureEndpoint:this.isSecureEndpoint(t)}),f=this.getName(a),l=this.incrementSockets(f);Promise.resolve().then(()=>this.connect(e,a)).then(g=>{if(this.decrementSockets(f,l),g instanceof Tr.Agent)return g.addRequest(e,a);this[ue].currentSocket=g,super.createSocket(e,t,s)},g=>{this.decrementSockets(f,l),s(g)})}createConnection(){let e=this[ue].currentSocket;if(this[ue].currentSocket=void 0,!e)throw new Error("No socket was returned in the `connect()` function");return e}get defaultPort(){var e;return(e=this[ue].defaultPort)!=null?e:this.protocol==="https:"?443:80}set defaultPort(e){this[ue]&&(this[ue].defaultPort=e)}get protocol(){var e;return(e=this[ue].protocol)!=null?e:this.isSecureEndpoint()?"https:":"http:"}set protocol(e){this[ue]&&(this[ue].protocol=e)}};K.Agent=Nt});var Mr=O((Ro,Dr)=>{var Ae=1e3,Re=Ae*60,Ne=Re*60,ye=Ne*24,Un=ye*7,Fn=ye*365.25;Dr.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return xn(r);if(t==="number"&&isFinite(r))return e.long?jn(r):Ln(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function xn(r){if(r=String(r),!(r.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(e){var t=parseFloat(e[1]),s=(e[2]||"ms").toLowerCase();switch(s){case"years":case"year":case"yrs":case"yr":case"y":return t*Fn;case"weeks":case"week":case"w":return t*Un;case"days":case"day":case"d":return t*ye;case"hours":case"hour":case"hrs":case"hr":case"h":return t*Ne;case"minutes":case"minute":case"mins":case"min":case"m":return t*Re;case"seconds":case"second":case"secs":case"sec":case"s":return t*Ae;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Ln(r){var e=Math.abs(r);return e>=ye?Math.round(r/ye)+"d":e>=Ne?Math.round(r/Ne)+"h":e>=Re?Math.round(r/Re)+"m":e>=Ae?Math.round(r/Ae)+"s":r+"ms"}function jn(r){var e=Math.abs(r);return e>=ye?et(r,e,ye,"day"):e>=Ne?et(r,e,Ne,"hour"):e>=Re?et(r,e,Re,"minute"):e>=Ae?et(r,e,Ae,"second"):r+" ms"}function et(r,e,t,s){var a=e>=t*1.5;return Math.round(r/t)+" "+s+(a?"s":"")}});var Ur=O((No,Pr)=>{function Vn(r){t.debug=t,t.default=t,t.coerce=v,t.disable=f,t.enable=a,t.enabled=l,t.humanize=Mr(),t.destroy=w,Object.keys(r).forEach(c=>{t[c]=r[c]}),t.names=[],t.skips=[],t.formatters={};function e(c){let b=0;for(let y=0;y<c.length;y++)b=(b<<5)-b+c.charCodeAt(y),b|=0;return t.colors[Math.abs(b)%t.colors.length]}t.selectColor=e;function t(c){let b,y=null,I,_;function T(...R){if(!T.enabled)return;let G=T,U=Number(new Date),ie=U-(b||U);G.diff=ie,G.prev=b,G.curr=U,b=U,R[0]=t.coerce(R[0]),typeof R[0]!="string"&&R.unshift("%O");let Ie=0;R[0]=R[0].replace(/%([a-zA-Z%])/g,(De,st)=>{if(De==="%%")return"%";Ie++;let Le=t.formatters[st];if(typeof Le=="function"){let Be=R[Ie];De=Le.call(G,Be),R.splice(Ie,1),Ie--}return De}),t.formatArgs.call(G,R),(G.log||t.log).apply(G,R)}return T.namespace=c,T.useColors=t.useColors(),T.color=t.selectColor(c),T.extend=s,T.destroy=t.destroy,Object.defineProperty(T,"enabled",{enumerable:!0,configurable:!1,get:()=>y!==null?y:(I!==t.namespaces&&(I=t.namespaces,_=t.enabled(c)),_),set:R=>{y=R}}),typeof t.init=="function"&&t.init(T),T}function s(c,b){let y=t(this.namespace+(typeof b=="undefined"?":":b)+c);return y.log=this.log,y}function a(c){t.save(c),t.namespaces=c,t.names=[],t.skips=[];let b,y=(typeof c=="string"?c:"").split(/[\s,]+/),I=y.length;for(b=0;b<I;b++)y[b]&&(c=y[b].replace(/\*/g,".*?"),c[0]==="-"?t.skips.push(new RegExp("^"+c.slice(1)+"$")):t.names.push(new RegExp("^"+c+"$")))}function f(){let c=[...t.names.map(g),...t.skips.map(g).map(b=>"-"+b)].join(",");return t.enable(""),c}function l(c){if(c[c.length-1]==="*")return!0;let b,y;for(b=0,y=t.skips.length;b<y;b++)if(t.skips[b].test(c))return!1;for(b=0,y=t.names.length;b<y;b++)if(t.names[b].test(c))return!0;return!1}function g(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}function v(c){return c instanceof Error?c.stack||c.message:c}function w(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}Pr.exports=Vn});var Fr=O((W,tt)=>{W.formatArgs=qn;W.save=Gn;W.load=$n;W.useColors=Hn;W.storage=zn();W.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();W.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Hn(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function qn(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+tt.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,s=0;r[0].replace(/%[a-zA-Z%]/g,a=>{a!=="%%"&&(t++,a==="%c"&&(s=t))}),r.splice(s,0,e)}W.log=console.debug||console.log||(()=>{});function Gn(r){try{r?W.storage.setItem("debug",r):W.storage.removeItem("debug")}catch(e){}}function $n(){let r;try{r=W.storage.getItem("debug")}catch(e){}return!r&&typeof process!="undefined"&&"env"in process&&(r=process.env.DEBUG),r}function zn(){try{return localStorage}catch(r){}}tt.exports=Ur()(W);var{formatters:Zn}=tt.exports;Zn.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var xr=O(X=>{"use strict";var Kn=X&&X.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t);var a=Object.getOwnPropertyDescriptor(e,t);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,s,a)}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t]}),Wn=X&&X.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),Dt=X&&X.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&Kn(e,r,t);return Wn(e,r),e},Yn=X&&X.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(X,"__esModule",{value:!0});X.SocksProxyAgent=void 0;var Jn=Er(),Xn=Nr(),Qn=Yn(Fr()),eo=Dt(require("dns")),to=Dt(require("net")),ro=Dt(require("tls")),io=require("url"),rt=(0,Qn.default)("socks-proxy-agent");function so(r){let e=!1,t=5,s=r.hostname,a=parseInt(r.port,10)||1080;switch(r.protocol.replace(":","")){case"socks4":e=!0,t=4;break;case"socks4a":t=4;break;case"socks5":e=!0,t=5;break;case"socks":t=5;break;case"socks5h":t=5;break;default:throw new TypeError(`A "socks" protocol must be specified! Got: ${String(r.protocol)}`)}let f={host:s,port:a,type:t};return r.username&&Object.defineProperty(f,"userId",{value:decodeURIComponent(r.username),enumerable:!1}),r.password!=null&&Object.defineProperty(f,"password",{value:decodeURIComponent(r.password),enumerable:!1}),{lookup:e,proxy:f}}var it=class extends Xn.Agent{constructor(e,t){var l,g;super(t);let s=typeof e=="string"?new io.URL(e):e,{proxy:a,lookup:f}=so(s);this.shouldLookup=f,this.proxy=a,this.timeout=(l=t==null?void 0:t.timeout)!=null?l:null,this.socketOptions=(g=t==null?void 0:t.socketOptions)!=null?g:null}connect(e,t){return Ue(this,null,function*(){var y;let{shouldLookup:s,proxy:a,timeout:f}=this;if(!t.host)throw new Error("No `host` defined!");let{host:l}=t,{port:g,lookup:v=eo.lookup}=t;s&&(l=yield new Promise((I,_)=>{v(l,{},(T,R)=>{T?_(T):I(R)})}));let w={proxy:a,destination:{host:l,port:typeof g=="number"?g:parseInt(g,10)},command:"connect",timeout:f!=null?f:void 0,socket_options:(y=this.socketOptions)!=null?y:void 0},c=I=>{e.destroy(),b.destroy(),I&&I.destroy()};rt("Creating socks proxy connection: %o",w);let{socket:b}=yield Jn.SocksClient.createConnection(w);if(rt("Successfully created socks proxy connection"),f!==null&&(b.setTimeout(f),b.on("timeout",()=>c())),t.secureEndpoint){rt("Upgrading socket connection to TLS");let I=t.servername||t.host,_=ro.connect(Ge(qe({},no(t,"host","path","port")),{socket:b,servername:to.isIP(I)?void 0:I}));return _.once("error",T=>{rt("Socket TLS error",T.message),c(_)}),_}return b})}};it.protocols=["socks","socks4","socks4a","socks5","socks5h"];X.SocksProxyAgent=it;function no(r,...e){let t={},s;for(s in r)e.includes(s)||(t[s]=r[s]);return t}});var oo={};Cs(oo,{SocksProxyAgent:()=>Lr.SocksProxyAgent});module.exports=Ts(oo);var Lr=Os(xr());0&&(module.exports={SocksProxyAgent});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment