UNPKG

@helia/http

Version:

A lightweight implementation of IPFS over HTTP in JavaScript

3 lines 662 kB
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.HeliaHttp = factory()}(typeof self !== 'undefined' ? self : this, function () { "use strict";var HeliaHttp=(()=>{var TR=Object.create;var Bu=Object.defineProperty;var kR=Object.getOwnPropertyDescriptor;var CR=Object.getOwnPropertyNames;var PR=Object.getPrototypeOf,DR=Object.prototype.hasOwnProperty;var re=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Y=(t,e)=>{for(var r in e)Bu(t,r,{get:e[r],enumerable:!0})},Eb=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of CR(e))!DR.call(t,i)&&i!==r&&Bu(t,i,{get:()=>e[i],enumerable:!(n=kR(e,i))||n.enumerable});return t};var me=(t,e,r)=>(r=t!=null?TR(PR(t)):{},Eb(e||!t||!t.__esModule?Bu(r,"default",{value:t,enumerable:!0}):r,t)),NR=t=>Eb(Bu({},"__esModule",{value:!0}),t);var Gb=re((wK,zb)=>{zb.exports=$b;var qb=128,EB=127,AB=~EB,SB=Math.pow(2,31);function $b(t,e,r){e=e||[],r=r||0;for(var n=r;t>=SB;)e[r++]=t&255|qb,t/=128;for(;t&AB;)e[r++]=t&255|qb,t>>>=7;return e[r]=t|0,$b.bytes=r-n+1,e}});var jb=re((xK,Yb)=>{Yb.exports=Wd;var _B=128,Wb=127;function Wd(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw Wd.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&Wb)<<i:(s&Wb)*Math.pow(2,i),i+=7}while(s>=_B);return Wd.bytes=o-n,r}});var Jb=re((vK,Qb)=>{var IB=Math.pow(2,7),RB=Math.pow(2,14),BB=Math.pow(2,21),TB=Math.pow(2,28),kB=Math.pow(2,35),CB=Math.pow(2,42),PB=Math.pow(2,49),DB=Math.pow(2,56),NB=Math.pow(2,63);Qb.exports=function(t){return t<IB?1:t<RB?2:t<BB?3:t<TB?4:t<kB?5:t<CB?6:t<PB?7:t<DB?8:t<NB?9:10}});var Zb=re((EK,Xb)=>{Xb.exports={encode:Gb(),decode:jb(),encodingLength:Jb()}});var rw=re((AK,tw)=>{"use strict";var ew=Zb();tw.exports=t=>{if(!(t instanceof Uint8Array))throw new Error("arg needs to be a Uint8Array");let e=[];for(;t.length>0;){let r=ew.decode(t);e.push(r),t=t.slice(ew.decode.bytes)}return e}});var Yd=re((SK,nw)=>{var us=1e3,ls=us*60,fs=ls*60,so=fs*24,LB=so*7,OB=so*365.25;nw.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return UB(t);if(r==="number"&&isFinite(t))return e.long?MB(t):KB(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function UB(t){if(t=String(t),!(t.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(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*OB;case"weeks":case"week":case"w":return r*LB;case"days":case"day":case"d":return r*so;case"hours":case"hour":case"hrs":case"hr":case"h":return r*fs;case"minutes":case"minute":case"mins":case"min":case"m":return r*ls;case"seconds":case"second":case"secs":case"sec":case"s":return r*us;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function KB(t){var e=Math.abs(t);return e>=so?Math.round(t/so)+"d":e>=fs?Math.round(t/fs)+"h":e>=ls?Math.round(t/ls)+"m":e>=us?Math.round(t/us)+"s":t+"ms"}function MB(t){var e=Math.abs(t);return e>=so?Lu(t,e,so,"day"):e>=fs?Lu(t,e,fs,"hour"):e>=ls?Lu(t,e,ls,"minute"):e>=us?Lu(t,e,us,"second"):t+" ms"}function Lu(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var ow=re((_K,iw)=>{function FB(t){r.debug=r,r.default=r,r.coerce=c,r.disable=o,r.enable=i,r.enabled=s,r.humanize=Yd(),r.destroy=u,Object.keys(t).forEach(l=>{r[l]=t[l]}),r.names=[],r.skips=[],r.formatters={};function e(l){let f=0;for(let d=0;d<l.length;d++)f=(f<<5)-f+l.charCodeAt(d),f|=0;return r.colors[Math.abs(f)%r.colors.length]}r.selectColor=e;function r(l){let f,d=null,p,h;function m(...y){if(!m.enabled)return;let g=m,b=Number(new Date),w=b-(f||b);g.diff=w,g.prev=f,g.curr=b,f=b,y[0]=r.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let _=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(A,B)=>{if(A==="%%")return"%";_++;let I=r.formatters[B];if(typeof I=="function"){let L=y[_];A=I.call(g,L),y.splice(_,1),_--}return A}),r.formatArgs.call(g,y),(g.log||r.log).apply(g,y)}return m.namespace=l,m.useColors=r.useColors(),m.color=r.selectColor(l),m.extend=n,m.destroy=r.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(p!==r.namespaces&&(p=r.namespaces,h=r.enabled(l)),h),set:y=>{d=y}}),typeof r.init=="function"&&r.init(m),m}function n(l,f){let d=r(this.namespace+(typeof f>"u"?":":f)+l);return d.log=this.log,d}function i(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let f,d=(typeof l=="string"?l:"").split(/[\s,]+/),p=d.length;for(f=0;f<p;f++)d[f]&&(l=d[f].replace(/\*/g,".*?"),l[0]==="-"?r.skips.push(new RegExp("^"+l.slice(1)+"$")):r.names.push(new RegExp("^"+l+"$")))}function o(){let l=[...r.names.map(a),...r.skips.map(a).map(f=>"-"+f)].join(",");return r.enable(""),l}function s(l){if(l[l.length-1]==="*")return!0;let f,d;for(f=0,d=r.skips.length;f<d;f++)if(r.skips[f].test(l))return!1;for(f=0,d=r.names.length;f<d;f++)if(r.names[f].test(l))return!0;return!1}function a(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function c(l){return l instanceof Error?l.stack||l.message:l}function u(){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 r.enable(r.load()),r}iw.exports=FB});var Uu=re((cr,Ou)=>{cr.formatArgs=HB;cr.save=qB;cr.load=$B;cr.useColors=VB;cr.storage=zB();cr.destroy=(()=>{let t=!1;return()=>{t||(t=!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`."))}})();cr.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 VB(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function HB(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Ou.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),t.splice(n,0,e)}cr.log=console.debug||console.log||(()=>{});function qB(t){try{t?cr.storage.setItem("debug",t):cr.storage.removeItem("debug")}catch{}}function $B(){let t;try{t=cr.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function zB(){try{return localStorage}catch{}}Ou.exports=ow()(cr);var{formatters:GB}=Ou.exports;GB.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var mw=re((JK,pw)=>{pw.exports=np;var dw=128,lT=127,fT=~lT,hT=Math.pow(2,31);function np(t,e,r){if(Number.MAX_SAFE_INTEGER&&t>Number.MAX_SAFE_INTEGER)throw np.bytes=0,new RangeError("Could not encode varint");e=e||[],r=r||0;for(var n=r;t>=hT;)e[r++]=t&255|dw,t/=128;for(;t&fT;)e[r++]=t&255|dw,t>>>=7;return e[r]=t|0,np.bytes=r-n+1,e}});var bw=re((XK,gw)=>{gw.exports=ip;var dT=128,yw=127;function ip(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a||i>49)throw ip.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&yw)<<i:(s&yw)*Math.pow(2,i),i+=7}while(s>=dT);return ip.bytes=o-n,r}});var xw=re((ZK,ww)=>{var pT=Math.pow(2,7),mT=Math.pow(2,14),yT=Math.pow(2,21),gT=Math.pow(2,28),bT=Math.pow(2,35),wT=Math.pow(2,42),xT=Math.pow(2,49),vT=Math.pow(2,56),ET=Math.pow(2,63);ww.exports=function(t){return t<pT?1:t<mT?2:t<yT?3:t<gT?4:t<bT?5:t<wT?6:t<xT?7:t<vT?8:t<ET?9:10}});var Ew=re((eM,vw)=>{vw.exports={encode:mw(),decode:bw(),encodingLength:xw()}});var fo=re((b9,Zw)=>{"use strict";function Xw(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function _8(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return Xw(t,r)}catch{r.message=t.message,r.stack=t.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(t)),Xw(new i,r)}}Zw.exports=_8});var rx=re((K9,tx)=>{"use strict";tx.exports=function(){return Date.now()}});var ix=re((M9,nx)=>{"use strict";var Ju=rx(),Kp=class{constructor(e,r,n){let i=this;this._started=Ju(),this._rescheduled=0,this._scheduled=r,this._args=n,this._triggered=!1,this._timerWrapper=()=>{i._rescheduled>0?(i._scheduled=i._rescheduled-(Ju()-i._started),i._schedule(i._scheduled)):(i._triggered=!0,e.apply(null,i._args))},this._timer=setTimeout(this._timerWrapper,r)}reschedule(e){e||(e=this._scheduled);let r=Ju();r+e-(this._started+this._scheduled)<0?(clearTimeout(this._timer),this._schedule(e)):this._triggered?this._schedule(e):(this._started=r,this._rescheduled=e)}_schedule(e){this._triggered=!1,this._started=Ju(),this._rescheduled=0,this._scheduled=e,this._timer=setTimeout(this._timerWrapper,e)}clear(){clearTimeout(this._timer)}};function L8(){if(typeof arguments[0]!="function")throw new Error("callback needed");if(typeof arguments[1]!="number")throw new Error("timeout needed");let t;if(arguments.length>0){t=new Array(arguments.length-2);for(var e=0;e<t.length;e++)t[e]=arguments[e+2]}return new Kp(arguments[0],arguments[1],t)}nx.exports=L8});var ax=re((F9,sx)=>{"use strict";var{AbortController:O8}=globalThis,ox=ix(),Mp=class t extends O8{constructor(e){super(),this._ms=e,this._timer=ox(()=>this.abort(),e),Object.setPrototypeOf(this,t.prototype)}abort(){return this._timer.clear(),super.abort()}clear(){this._timer.clear()}reset(){this._timer.clear(),this._timer=ox(()=>this.abort(),this._ms)}};sx.exports={TimeoutController:Mp}});var el=re((J9,Vp)=>{"use strict";var xs=typeof Reflect=="object"?Reflect:null,cx=xs&&typeof xs.apply=="function"?xs.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Xu;xs&&typeof xs.ownKeys=="function"?Xu=xs.ownKeys:Object.getOwnPropertySymbols?Xu=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Xu=function(e){return Object.getOwnPropertyNames(e)};function F8(t){console&&console.warn&&console.warn(t)}var lx=Number.isNaN||function(e){return e!==e};function De(){De.init.call(this)}Vp.exports=De;Vp.exports.once=$8;De.EventEmitter=De;De.prototype._events=void 0;De.prototype._eventsCount=0;De.prototype._maxListeners=void 0;var ux=10;function Zu(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(De,"defaultMaxListeners",{enumerable:!0,get:function(){return ux},set:function(t){if(typeof t!="number"||t<0||lx(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");ux=t}});De.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};De.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||lx(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function fx(t){return t._maxListeners===void 0?De.defaultMaxListeners:t._maxListeners}De.prototype.getMaxListeners=function(){return fx(this)};De.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",o=this._events;if(o!==void 0)i=i&&o.error===void 0;else if(!i)return!1;if(i){var s;if(r.length>0&&(s=r[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(c===void 0)return!1;if(typeof c=="function")cx(c,this,r);else for(var u=c.length,l=yx(c,u),n=0;n<u;++n)cx(l[n],this,r);return!0};function hx(t,e,r,n){var i,o,s;if(Zu(r),o=t._events,o===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),s===void 0)s=o[e]=r,++t._eventsCount;else if(typeof s=="function"?s=o[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),i=fx(t),i>0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,F8(a)}return t}De.prototype.addListener=function(e,r){return hx(this,e,r,!1)};De.prototype.on=De.prototype.addListener;De.prototype.prependListener=function(e,r){return hx(this,e,r,!0)};function V8(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function dx(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=V8.bind(n);return i.listener=r,n.wrapFn=i,i}De.prototype.once=function(e,r){return Zu(r),this.on(e,dx(this,e,r)),this};De.prototype.prependOnceListener=function(e,r){return Zu(r),this.prependListener(e,dx(this,e,r)),this};De.prototype.removeListener=function(e,r){var n,i,o,s,a;if(Zu(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(o=-1,s=n.length-1;s>=0;s--)if(n[s]===r||n[s].listener===r){a=n[s].listener,o=s;break}if(o<0)return this;o===0?n.shift():H8(n,o),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};De.prototype.off=De.prototype.removeListener;De.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var o=Object.keys(n),s;for(i=0;i<o.length;++i)s=o[i],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function px(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?q8(i):yx(i,i.length)}De.prototype.listeners=function(e){return px(this,e,!0)};De.prototype.rawListeners=function(e){return px(this,e,!1)};De.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):mx.call(t,e)};De.prototype.listenerCount=mx;function mx(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}De.prototype.eventNames=function(){return this._eventsCount>0?Xu(this._events):[]};function yx(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function H8(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function q8(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function $8(t,e){return new Promise(function(r,n){function i(s){t.removeListener(e,o),n(s)}function o(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}gx(t,e,o,{once:!0}),e!=="error"&&z8(t,i,{once:!0})})}function z8(t,e,r){typeof t.on=="function"&&gx(t,"error",e,r)}function gx(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(o){n.once&&t.removeEventListener(e,i),r(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var Rx=re((_x,Ix)=>{"use strict";var mk=Math.exp;_x=Ix.exports=function(e){if(typeof e!="number")throw new Error("must provide a timespan to the moving average constructor");if(e<=0)throw new Error("must provide a timespan > 0 to the moving average constructor");let r,n=0,i=0,o=0,s,a={};function c(u,l){return 1-mk(-(u-l)/e)}return a.push=function(l,f){if(s){let d=c(l,s),p=f-r,h=d*p;r=d*f+(1-d)*r,n=(1-d)*(n+p*h),i=Math.sqrt(n),o=r+d*p}else r=f;s=l},a.movingAverage=function(){return r},a.variance=function(){return n},a.deviation=function(){return i},a.forecast=function(){return o},a}});var Q1=re(($q,y0)=>{"use strict";var cC=Object.prototype.hasOwnProperty,zt="~";function gc(){}Object.create&&(gc.prototype=Object.create(null),new gc().__proto__||(zt=!1));function uC(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function j1(t,e,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var o=new uC(r,n||t,i),s=zt?zt+e:e;return t._events[s]?t._events[s].fn?t._events[s]=[t._events[s],o]:t._events[s].push(o):(t._events[s]=o,t._eventsCount++),t}function Sl(t,e){--t._eventsCount===0?t._events=new gc:delete t._events[e]}function Vt(){this._events=new gc,this._eventsCount=0}Vt.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)cC.call(r,n)&&e.push(zt?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};Vt.prototype.listeners=function(e){var r=zt?zt+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,s=new Array(o);i<o;i++)s[i]=n[i].fn;return s};Vt.prototype.listenerCount=function(e){var r=zt?zt+e:e,n=this._events[r];return n?n.fn?1:n.length:0};Vt.prototype.emit=function(e,r,n,i,o,s){var a=zt?zt+e:e;if(!this._events[a])return!1;var c=this._events[a],u=arguments.length,l,f;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,r),!0;case 3:return c.fn.call(c.context,r,n),!0;case 4:return c.fn.call(c.context,r,n,i),!0;case 5:return c.fn.call(c.context,r,n,i,o),!0;case 6:return c.fn.call(c.context,r,n,i,o,s),!0}for(f=1,l=new Array(u-1);f<u;f++)l[f-1]=arguments[f];c.fn.apply(c.context,l)}else{var d=c.length,p;for(f=0;f<d;f++)switch(c[f].once&&this.removeListener(e,c[f].fn,void 0,!0),u){case 1:c[f].fn.call(c[f].context);break;case 2:c[f].fn.call(c[f].context,r);break;case 3:c[f].fn.call(c[f].context,r,n);break;case 4:c[f].fn.call(c[f].context,r,n,i);break;default:if(!l)for(p=1,l=new Array(u-1);p<u;p++)l[p-1]=arguments[p];c[f].fn.apply(c[f].context,l)}}return!0};Vt.prototype.on=function(e,r,n){return j1(this,e,r,n,!1)};Vt.prototype.once=function(e,r,n){return j1(this,e,r,n,!0)};Vt.prototype.removeListener=function(e,r,n,i){var o=zt?zt+e:e;if(!this._events[o])return this;if(!r)return Sl(this,o),this;var s=this._events[o];if(s.fn)s.fn===r&&(!i||s.once)&&(!n||s.context===n)&&Sl(this,o);else{for(var a=0,c=[],u=s.length;a<u;a++)(s[a].fn!==r||i&&!s[a].once||n&&s[a].context!==n)&&c.push(s[a]);c.length?this._events[o]=c.length===1?c[0]:c:Sl(this,o)}return this};Vt.prototype.removeAllListeners=function(e){var r;return e?(r=zt?zt+e:e,this._events[r]&&Sl(this,r)):(this._events=new gc,this._eventsCount=0),this};Vt.prototype.off=Vt.prototype.removeListener;Vt.prototype.addListener=Vt.prototype.on;Vt.prefixed=zt;Vt.EventEmitter=Vt;typeof y0<"u"&&(y0.exports=Vt)});var Kv=re(Vs=>{"use strict";var z4="[object ArrayBuffer]",$n=class t{static isArrayBuffer(e){return Object.prototype.toString.call(e)===z4}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,r){if(e.constructor===r)return e;if(this.isArrayBuffer(e))return new r(e);if(this.isArrayBufferView(e))return new r(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,r){let n=t.toUint8Array(e),i=t.toUint8Array(r);if(n.length!==i.byteLength)return!1;for(let o=0;o<n.length;o++)if(n[o]!==i[o])return!1;return!0}static concat(...e){let r;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?r=e[0]:e[e.length-1]instanceof Function?r=e.slice(0,e.length-1):r=e;let n=0;for(let s of r)n+=s.byteLength;let i=new Uint8Array(n),o=0;for(let s of r){let a=this.toUint8Array(s);i.set(a,o),o+=a.length}return e[e.length-1]instanceof Function?this.toView(i,e[e.length-1]):i.buffer}},W0="string",G4=/^[0-9a-f]+$/i,W4=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Y4=/^[a-zA-Z0-9-_]+$/,zl=class{static fromString(e){let r=unescape(encodeURIComponent(e)),n=new Uint8Array(r.length);for(let i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return n.buffer}static toString(e){let r=$n.toUint8Array(e),n="";for(let o=0;o<r.length;o++)n+=String.fromCharCode(r[o]);return decodeURIComponent(escape(n))}},Rr=class{static toString(e,r=!1){let n=$n.toArrayBuffer(e),i=new DataView(n),o="";for(let s=0;s<n.byteLength;s+=2){let a=i.getUint16(s,r);o+=String.fromCharCode(a)}return o}static fromString(e,r=!1){let n=new ArrayBuffer(e.length*2),i=new DataView(n);for(let o=0;o<e.length;o++)i.setUint16(o*2,e.charCodeAt(o),r);return n}},Gl=class t{static isHex(e){return typeof e===W0&&G4.test(e)}static isBase64(e){return typeof e===W0&&W4.test(e)}static isBase64Url(e){return typeof e===W0&&Y4.test(e)}static ToString(e,r="utf8"){let n=$n.toUint8Array(e);switch(r.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);case"utf16le":return Rr.toString(n,!0);case"utf16":case"utf16be":return Rr.toString(n);default:throw new Error(`Unknown type of encoding '${r}'`)}}static FromString(e,r="utf8"){if(!e)return new ArrayBuffer(0);switch(r.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return Rr.fromString(e,!0);case"utf16":case"utf16be":return Rr.fromString(e);default:throw new Error(`Unknown type of encoding '${r}'`)}}static ToBase64(e){let r=$n.toUint8Array(e);if(typeof btoa<"u"){let n=this.ToString(r,"binary");return btoa(n)}else return Buffer.from(r).toString("base64")}static FromBase64(e){let r=this.formatString(e);if(!r)return new ArrayBuffer(0);if(!t.isBase64(r))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(r)):new Uint8Array(Buffer.from(r,"base64")).buffer}static FromBase64Url(e){let r=this.formatString(e);if(!r)return new ArrayBuffer(0);if(!t.isBase64Url(r))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(r.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,r=t.DEFAULT_UTF8_ENCODING){switch(r){case"ascii":return this.FromBinary(e);case"utf8":return zl.fromString(e);case"utf16":case"utf16be":return Rr.fromString(e);case"utf16le":case"usc2":return Rr.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${r}'`)}}static ToUtf8String(e,r=t.DEFAULT_UTF8_ENCODING){switch(r){case"ascii":return this.ToBinary(e);case"utf8":return zl.toString(e);case"utf16":case"utf16be":return Rr.toString(e);case"utf16le":case"usc2":return Rr.toString(e,!0);default:throw new Error(`Unknown type of encoding '${r}'`)}}static FromBinary(e){let r=e.length,n=new Uint8Array(r);for(let i=0;i<r;i++)n[i]=e.charCodeAt(i);return n.buffer}static ToBinary(e){let r=$n.toUint8Array(e),n="";for(let i=0;i<r.length;i++)n+=String.fromCharCode(r[i]);return n}static ToHex(e){let r=$n.toUint8Array(e),n="",i=r.length;for(let o=0;o<i;o++){let s=r[o];s<16&&(n+="0"),n+=s.toString(16)}return n}static FromHex(e){let r=this.formatString(e);if(!r)return new ArrayBuffer(0);if(!t.isHex(r))throw new TypeError("Argument 'hexString' is not HEX encoded");r.length%2&&(r=`0${r}`);let n=new Uint8Array(r.length/2);for(let i=0;i<r.length;i=i+2){let o=r.slice(i,i+2);n[i/2]=parseInt(o,16)}return n.buffer}static ToUtf16String(e,r=!1){return Rr.toString(e,r)}static FromUtf16String(e,r=!1){return Rr.fromString(e,r)}static Base64Padding(e){let r=4-e.length%4;if(r<4)for(let n=0;n<r;n++)e+="=";return e}static formatString(e){return e?.replace(/[\n\r\t ]/g,"")||""}};Gl.DEFAULT_UTF8_ENCODING="utf8";function j4(t,...e){let r=arguments[0];for(let n=1;n<arguments.length;n++){let i=arguments[n];for(let o in i)r[o]=i[o]}return r}function Q4(...t){let e=t.map(i=>i.byteLength).reduce((i,o)=>i+o),r=new Uint8Array(e),n=0;return t.map(i=>new Uint8Array(i)).forEach(i=>{for(let o of i)r[n++]=o}),r.buffer}function J4(t,e){if(!(t&&e)||t.byteLength!==e.byteLength)return!1;let r=new Uint8Array(t),n=new Uint8Array(e);for(let i=0;i<t.byteLength;i++)if(r[i]!==n[i])return!1;return!0}Vs.BufferSourceConverter=$n;Vs.Convert=Gl;Vs.assign=j4;Vs.combine=Q4;Vs.isEqual=J4});var lA=re($c=>{(function(){var t,e,r,n,i,o,s,a;a=function(c){var u,l,f,d;return u=(c&255<<24)>>>24,l=(c&255<<16)>>>16,f=(c&65280)>>>8,d=c&255,[u,l,f,d].join(".")},s=function(c){var u,l,f,d,p,h;for(u=[],f=d=0;d<=3&&c.length!==0;f=++d){if(f>0){if(c[0]!==".")throw new Error("Invalid IP");c=c.substring(1)}h=e(c),p=h[0],l=h[1],c=c.substring(l),u.push(p)}if(c.length!==0)throw new Error("Invalid IP");switch(u.length){case 1:if(u[0]>4294967295)throw new Error("Invalid IP");return u[0]>>>0;case 2:if(u[0]>255||u[1]>16777215)throw new Error("Invalid IP");return(u[0]<<24|u[1])>>>0;case 3:if(u[0]>255||u[1]>255||u[2]>65535)throw new Error("Invalid IP");return(u[0]<<24|u[1]<<16|u[2])>>>0;case 4:if(u[0]>255||u[1]>255||u[2]>255||u[3]>255)throw new Error("Invalid IP");return(u[0]<<24|u[1]<<16|u[2]<<8|u[3])>>>0;default:throw new Error("Invalid IP")}},r=function(c){return c.charCodeAt(0)},n=r("0"),o=r("a"),i=r("A"),e=function(c){var u,l,f,d,p;for(d=0,u=10,l="9",f=0,c.length>1&&c[f]==="0"&&(c[f+1]==="x"||c[f+1]==="X"?(f+=2,u=16):"0"<=c[f+1]&&c[f+1]<="9"&&(f++,u=8,l="7")),p=f;f<c.length;){if("0"<=c[f]&&c[f]<=l)d=d*u+(r(c[f])-n)>>>0;else if(u===16)if("a"<=c[f]&&c[f]<="f")d=d*u+(10+r(c[f])-o)>>>0;else if("A"<=c[f]&&c[f]<="F")d=d*u+(10+r(c[f])-i)>>>0;else break;else break;if(d>4294967295)throw new Error("too large");f++}if(f===p)throw new Error("empty octet");return[d,f]},t=function(){function c(u,l){var f,d,p,h;if(typeof u!="string")throw new Error("Missing `net' parameter");if(l||(h=u.split("/",2),u=h[0],l=h[1]),l||(l=32),typeof l=="string"&&l.indexOf(".")>-1){try{this.maskLong=s(l)}catch(m){throw f=m,new Error("Invalid mask: "+l)}for(d=p=32;p>=0;d=--p)if(this.maskLong===4294967295<<32-d>>>0){this.bitmask=d;break}}else if(l||l===0)this.bitmask=parseInt(l,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(s(u)&this.maskLong)>>>0}catch(m){throw f=m,new Error("Invalid net address: "+u)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+l);this.size=Math.pow(2,32-this.bitmask),this.base=a(this.netLong),this.mask=a(this.maskLong),this.hostmask=a(~this.maskLong),this.first=this.bitmask<=30?a(this.netLong+1):this.base,this.last=this.bitmask<=30?a(this.netLong+this.size-2):a(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?a(this.netLong+this.size-1):void 0}return c.prototype.contains=function(u){return typeof u=="string"&&(u.indexOf("/")>0||u.split(".").length!==4)&&(u=new c(u)),u instanceof c?this.contains(u.base)&&this.contains(u.broadcast||u.last):(s(u)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},c.prototype.next=function(u){return u==null&&(u=1),new c(a(this.netLong+this.size*u),this.mask)},c.prototype.forEach=function(u){var l,f,d;for(d=s(this.first),f=s(this.last),l=0;d<=f;)u(a(d),d,l),l++,d++},c.prototype.toString=function(){return this.base+"/"+this.bitmask},c}(),$c.ip2long=s,$c.long2ip=a,$c.Netmask=t}).call($c)});var pA=re((dA,ih)=>{(function(t){"use strict";let e="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${e}\\.${e}\\.${e}\\.${e}$`,"i"),threeOctet:new RegExp(`^${e}\\.${e}\\.${e}$`,"i"),twoOctet:new RegExp(`^${e}\\.${e}$`,"i"),longValue:new RegExp(`^${e}$`,"i")},n=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),o="%[0-9a-z]{1,}",s="(?:[0-9a-f]+::?)+",a={zoneIndex:new RegExp(o,"i"),native:new RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${e}\\.${e}\\.${e}\\.${e}(${o})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${e}\\.${e}\\.${e}\\.${e}(${o})?$`,"i")};function c(p,h){if(p.indexOf("::")!==p.lastIndexOf("::"))return null;let m=0,y=-1,g=(p.match(a.zoneIndex)||[])[0],b,w;for(g&&(g=g.substring(1),p=p.replace(/%.+$/,""));(y=p.indexOf(":",y+1))>=0;)m++;if(p.substr(0,2)==="::"&&m--,p.substr(-2,2)==="::"&&m--,m>h)return null;for(w=h-m,b=":";w--;)b+="0:";return p=p.replace("::",b),p[0]===":"&&(p=p.slice(1)),p[p.length-1]===":"&&(p=p.slice(0,-1)),h=function(){let _=p.split(":"),E=[];for(let A=0;A<_.length;A++)E.push(parseInt(_[A],16));return E}(),{parts:h,zoneId:g}}function u(p,h,m,y){if(p.length!==h.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let g=0,b;for(;y>0;){if(b=m-y,b<0&&(b=0),p[g]>>b!==h[g]>>b)return!1;y-=m,g+=1}return!0}function l(p){if(i.test(p))return parseInt(p,16);if(p[0]==="0"&&!isNaN(parseInt(p[1],10))){if(n.test(p))return parseInt(p,8);throw new Error(`ipaddr: cannot parse ${p} as octal`)}return parseInt(p,10)}function f(p,h){for(;p.length<h;)p=`0${p}`;return p}let d={};d.IPv4=function(){function p(h){if(h.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let m,y;for(m=0;m<h.length;m++)if(y=h[m],!(0<=y&&y<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=h}return p.prototype.SpecialRanges={unspecified:[[new p([0,0,0,0]),8]],broadcast:[[new p([255,255,255,255]),32]],multicast:[[new p([224,0,0,0]),4]],linkLocal:[[new p([169,254,0,0]),16]],loopback:[[new p([127,0,0,0]),8]],carrierGradeNat:[[new p([100,64,0,0]),10]],private:[[new p([10,0,0,0]),8],[new p([172,16,0,0]),12],[new p([192,168,0,0]),16]],reserved:[[new p([192,0,0,0]),24],[new p([192,0,2,0]),24],[new p([192,88,99,0]),24],[new p([198,18,0,0]),15],[new p([198,51,100,0]),24],[new p([203,0,113,0]),24],[new p([240,0,0,0]),4]]},p.prototype.kind=function(){return"ipv4"},p.prototype.match=function(h,m){let y;if(m===void 0&&(y=h,h=y[0],m=y[1]),h.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return u(this.octets,h.octets,8,m)},p.prototype.prefixLengthFromSubnetMask=function(){let h=0,m=!1,y={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},g,b,w;for(g=3;g>=0;g-=1)if(b=this.octets[g],b in y){if(w=y[b],m&&w!==0)return null;w!==8&&(m=!0),h+=w}else return null;return 32-h},p.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},p.prototype.toByteArray=function(){return this.octets.slice(0)},p.prototype.toIPv4MappedAddress=function(){return d.IPv6.parse(`::ffff:${this.toString()}`)},p.prototype.toNormalizedString=function(){return this.toString()},p.prototype.toString=function(){return this.octets.join(".")},p}(),d.IPv4.broadcastAddressFromCIDR=function(p){try{let h=this.parseCIDR(p),m=h[0].toByteArray(),y=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),g=[],b=0;for(;b<4;)g.push(parseInt(m[b],10)|parseInt(y[b],10)^255),b++;return new this(g)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.isIPv4=function(p){return this.parser(p)!==null},d.IPv4.isValid=function(p){try{return new this(this.parser(p)),!0}catch{return!1}},d.IPv4.isValidFourPartDecimal=function(p){return!!(d.IPv4.isValid(p)&&p.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},d.IPv4.networkAddressFromCIDR=function(p){let h,m,y,g,b;try{for(h=this.parseCIDR(p),y=h[0].toByteArray(),b=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),g=[],m=0;m<4;)g.push(parseInt(y[m],10)&parseInt(b[m],10)),m++;return new this(g)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.parse=function(p){let h=this.parser(p);if(h===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(h)},d.IPv4.parseCIDR=function(p){let h;if(h=p.match(/^(.+)\/(\d+)$/)){let m=parseInt(h[2]);if(m>=0&&m<=32){let y=[this.parse(h[1]),m];return Object.defineProperty(y,"toString",{value:function(){return this.join("/")}}),y}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},d.IPv4.parser=function(p){let h,m,y;if(h=p.match(r.fourOctet))return function(){let g=h.slice(1,6),b=[];for(let w=0;w<g.length;w++)m=g[w],b.push(l(m));return b}();if(h=p.match(r.longValue)){if(y=l(h[1]),y>4294967295||y<0)throw new Error("ipaddr: address outside defined range");return function(){let g=[],b;for(b=0;b<=24;b+=8)g.push(y>>b&255);return g}().reverse()}else return(h=p.match(r.twoOctet))?function(){let g=h.slice(1,4),b=[];if(y=l(g[1]),y>16777215||y<0)throw new Error("ipaddr: address outside defined range");return b.push(l(g[0])),b.push(y>>16&255),b.push(y>>8&255),b.push(y&255),b}():(h=p.match(r.threeOctet))?function(){let g=h.slice(1,5),b=[];if(y=l(g[2]),y>65535||y<0)throw new Error("ipaddr: address outside defined range");return b.push(l(g[0])),b.push(l(g[1])),b.push(y>>8&255),b.push(y&255),b}():null},d.IPv4.subnetMaskFromPrefixLength=function(p){if(p=parseInt(p),p<0||p>32)throw new Error("ipaddr: invalid IPv4 prefix length");let h=[0,0,0,0],m=0,y=Math.floor(p/8);for(;m<y;)h[m]=255,m++;return y<4&&(h[y]=Math.pow(2,p%8)-1<<8-p%8),new this(h)},d.IPv6=function(){function p(h,m){let y,g;if(h.length===16)for(this.parts=[],y=0;y<=14;y+=2)this.parts.push(h[y]<<8|h[y+1]);else if(h.length===8)this.parts=h;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(y=0;y<this.parts.length;y++)if(g=this.parts[y],!(0<=g&&g<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");m&&(this.zoneId=m)}return p.prototype.SpecialRanges={unspecified:[new p([0,0,0,0,0,0,0,0]),128],linkLocal:[new p([65152,0,0,0,0,0,0,0]),10],multicast:[new p([65280,0,0,0,0,0,0,0]),8],loopback:[new p([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new p([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new p([0,0,0,0,0,65535,0,0]),96],rfc6145:[new p([0,0,0,0,65535,0,0,0]),96],rfc6052:[new p([100,65435,0,0,0,0,0,0]),96],"6to4":[new p([8194,0,0,0,0,0,0,0]),16],teredo:[new p([8193,0,0,0,0,0,0,0]),32],reserved:[[new p([8193,3512,0,0,0,0,0,0]),32]],benchmarking:[new p([8193,2,0,0,0,0,0,0]),48],amt:[new p([8193,3,0,0,0,0,0,0]),32],as112v6:[new p([8193,4,274,0,0,0,0,0]),48],deprecated:[new p([8193,16,0,0,0,0,0,0]),28],orchid2:[new p([8193,32,0,0,0,0,0,0]),28]},p.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},p.prototype.kind=function(){return"ipv6"},p.prototype.match=function(h,m){let y;if(m===void 0&&(y=h,h=y[0],m=y[1]),h.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return u(this.parts,h.parts,16,m)},p.prototype.prefixLengthFromSubnetMask=function(){let h=0,m=!1,y={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},g,b;for(let w=7;w>=0;w-=1)if(g=this.parts[w],g in y){if(b=y[g],m&&b!==0)return null;b!==16&&(m=!0),h+=b}else return null;return 128-h},p.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},p.prototype.toByteArray=function(){let h,m=[],y=this.parts;for(let g=0;g<y.length;g++)h=y[g],m.push(h>>8),m.push(h&255);return m},p.prototype.toFixedLengthString=function(){let h=function(){let y=[];for(let g=0;g<this.parts.length;g++)y.push(f(this.parts[g].toString(16),4));return y}.call(this).join(":"),m="";return this.zoneId&&(m=`%${this.zoneId}`),h+m},p.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let h=this.parts.slice(-2),m=h[0],y=h[1];return new d.IPv4([m>>8,m&255,y>>8,y&255])},p.prototype.toNormalizedString=function(){let h=function(){let y=[];for(let g=0;g<this.parts.length;g++)y.push(this.parts[g].toString(16));return y}.call(this).join(":"),m="";return this.zoneId&&(m=`%${this.zoneId}`),h+m},p.prototype.toRFC5952String=function(){let h=/((^|:)(0(:|$)){2,})/g,m=this.toNormalizedString(),y=0,g=-1,b;for(;b=h.exec(m);)b[0].length>g&&(y=b.index,g=b[0].length);return g<0?m:`${m.substring(0,y)}::${m.substring(y+g)}`},p.prototype.toString=function(){return this.toRFC5952String()},p}(),d.IPv6.broadcastAddressFromCIDR=function(p){try{let h=this.parseCIDR(p),m=h[0].toByteArray(),y=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),g=[],b=0;for(;b<16;)g.push(parseInt(m[b],10)|parseInt(y[b],10)^255),b++;return new this(g)}catch(h){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${h})`)}},d.IPv6.isIPv6=function(p){return this.parser(p)!==null},d.IPv6.isValid=function(p){if(typeof p=="string"&&p.indexOf(":")===-1)return!1;try{let h=this.parser(p);return new this(h.parts,h.zoneId),!0}catch{return!1}},d.IPv6.networkAddressFromCIDR=function(p){let h,m,y,g,b;try{for(h=this.parseCIDR(p),y=h[0].toByteArray(),b=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),g=[],m=0;m<16;)g.push(parseInt(y[m],10)&parseInt(b[m],10)),m++;return new this(g)}catch(w){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${w})`)}},d.IPv6.parse=function(p){let h=this.parser(p);if(h.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(h.parts,h.zoneId)},d.IPv6.parseCIDR=function(p){let h,m,y;if((m=p.match(/^(.+)\/(\d+)$/))&&(h=parseInt(m[2]),h>=0&&h<=128))return y=[this.parse(m[1]),h],Object.defineProperty(y,"toString",{value:function(){return this.join("/")}}),y;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},d.IPv6.parser=function(p){let h,m,y,g,b,w;if(y=p.match(a.deprecatedTransitional))return this.parser(`::ffff:${y[1]}`);if(a.native.test(p))return c(p,8);if((y=p.match(a.transitional))&&(w=y[6]||"",h=c(y[1].slice(0,-1)+w,6),h.parts)){for(b=[parseInt(y[2]),parseInt(y[3]),parseInt(y[4]),parseInt(y[5])],m=0;m<b.length;m++)if(g=b[m],!(0<=g&&g<=255))return null;return h.parts.push(b[0]<<8|b[1]),h.parts.push(b[2]<<8|b[3]),{parts:h.parts,zoneId:h.zoneId}}return null},d.IPv6.subnetMaskFromPrefixLength=function(p){if(p=parseInt(p),p<0||p>128)throw new Error("ipaddr: invalid IPv6 prefix length");let h=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],m=0,y=Math.floor(p/8);for(;m<y;)h[m]=255,m++;return y<16&&(h[y]=Math.pow(2,p%8)-1<<8-p%8),new this(h)},d.fromByteArray=function(p){let h=p.length;if(h===4)return new d.IPv4(p);if(h===16)return new d.IPv6(p);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},d.isValid=function(p){return d.IPv6.isValid(p)||d.IPv4.isValid(p)},d.parse=function(p){if(d.IPv6.isValid(p))return d.IPv6.parse(p);if(d.IPv4.isValid(p))return d.IPv4.parse(p);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},d.parseCIDR=function(p){try{return d.IPv6.parseCIDR(p)}catch{try{return d.IPv4.parseCIDR(p)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},d.process=function(p){let h=this.parse(p);return h.kind()==="ipv6"&&h.isIPv4MappedAddress()?h.toIPv4Address():h},d.subnetMatch=function(p,h,m){let y,g,b,w;m==null&&(m="unicast");for(g in h)if(Object.prototype.hasOwnProperty.call(h,g)){for(b=h[g],b[0]&&!(b[0]instanceof Array)&&(b=[b]),y=0;y<b.length;y++)if(w=b[y],p.kind()===w[0].kind()&&p.match.apply(p,w))return g}return m},typeof ih<"u"&&ih.exports?ih.exports=d:t.ipaddr=d})(dA)});var CA=re((pre,kA)=>{"use strict";kA.exports=TA;var pP=Yd(),$i=TA.prototype,mP=new Date%1e9;function yP(){return(Math.random()*1e9>>>0)+mP++}function TA(t){t=t||{},this.id=t.id||yP(),this.max=t.max||1/0,this.items=t.items||[],this._lookup={},this.size=this.items.length,this.lastModified=new Date(t.lastModified||new Date);for(var e,r,n=this.items.length;n--;)e=this.items[n],r=new Date(e.expires)-new Date,this._lookup[e.key]=e,r>0?this.expire(e.key,r):r<=0&&this.delete(e.key)}$i.has=function(t){return t in this._lookup};$i.get=function(t){if(!this.has(t))return null;var e=this._lookup[t];return e.refresh&&this.expire(t,e.refresh),this.items.splice(this.items.indexOf(e),1),this.items.push(e),e.value};$i.meta=function(t){if(!this.has(t))return null;var e=this._lookup[t];return"meta"in e?e.meta:null};$i.set=function(t,e,r){var n=this._lookup[t],i=this._lookup[t]={key:t,value:e};return this.lastModified=new Date,n?(clearTimeout(n.timeout),this.items.splice(this.items.indexOf(n),1,i)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(i),this.size++),r&&("ttl"in r&&this.expire(t,r.ttl),"meta"in r&&(i.meta=r.meta),r.refresh&&(i.refresh=r.ttl)),this};$i.delete=function(t){var e=this._lookup[t];return e?(this.lastModified=new Date,this.items.splice(this.items.indexOf(e),1),clearTimeout(e.timeout),delete this._lookup[t],this.size--,this):!1};$i.expire=function(t,e){var r=e||0,n=this._lookup[t];if(!n)return this;if(typeof r=="string"&&(r=pP(e)),typeof r!="number")throw new TypeError("Expiration time must be a string or number.");return clearTimeout(n.timeout),n.timeout=setTimeout(this.delete.bind(this,n.key),r),n.expires=Number(new Date)+r,this};$i.clear=function(){for(var t=this.items.length;t--;)this.delete(this.items[t].key);return this};$i.toJSON=function(){for(var t=new Array(this.items.length),e,r=t.length;r--;)e=this.items[r],t[r]={key:e.key,meta:e.meta,value:e.value,expires:e.expires,refresh:e.refresh};return{id:this.id,max:isFinite(this.max)?this.max:void 0,lastModified:this.lastModified,items:t}}});var OA=re((vre,LA)=>{"use strict";LA.exports=t=>{if(Object.prototype.toString.call(t)!=="[object Object]")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}});var HA=re((FA,VA)=>{"use strict";var hh=OA(),{hasOwnProperty:KA}=Object.prototype,{propertyIsEnumerable:wP}=Object,wa=(t,e,r)=>Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0}),xP=FA,UA={concatArrays:!1,ignoreUndefined:!1},dh=t=>{let e=[];for(let r in t)KA.call(t,r)&&e.push(r);if(Object.getOwnPropertySymbols){let r=Object.getOwnPropertySymbols(t);for(let n of r)wP.call(t,n)&&e.push(n)}return e};function xa(t){return Array.isArray(t)?vP(t):hh(t)?EP(t):t}function vP(t){let e=t.slice(0,0);return dh(t).forEach(r=>{wa(e,r,xa(t[r]))}),e}function EP(t){let e=Object.getPrototypeOf(t)===null?Object.create(null):{};return dh(t).forEach(r=>{wa(e,r,xa(t[r]))}),e}var MA=(t,e,r,n)=>(r.forEach(i=>{typeof e[i]>"u"&&n.ignoreUndefined||(i in t&&t[i]!==Object.getPrototypeOf(t)?wa(t,i,ay(t[i],e[i],n)):wa(t,i,xa(e[i])))}),t),AP=(t,e,r)=>{let n=t.slice(0,0),i=0;return[t,e].forEach(o=>{let s=[];for(let a=0;a<o.length;a++)KA.call(o,a)&&(s.push(String(a)),o===t?wa(n,i++,o[a]):wa(n,i++,xa(o[a])));n=MA(n,o,dh(o).filter(a=>!s.includes(a)),r)}),n};function ay(t,e,r){return r.concatArrays&&Array.isArray(t)&&Array.isArray(e)?AP(t,e,r):!hh(e)||!hh(t)?xa(e):MA(t,e,dh(e),r)}VA.exports=function(...t){let e=ay(xa(UA),this!==xP&&this||{},UA),r={_:{}};for(let n of t)if(n!==void 0){if(!hh(n))throw new TypeError("`"+n+"` is not an Option Object");r=ay(r,{_:n},e)}return r._}});var Le=re((pse,PS)=>{PS.exports={options:{usePureJavaScript:!1}}});var LS=re((mse,NS)=>{var Gy={};NS.exports=Gy;var DS={};Gy.encode=function(t,e,r){if(typeof e!="string")throw new TypeError('"alphabet" must be a string.');if(r!==void 0&&typeof r!="number")throw new TypeError('"maxline" must be a number.');var n="";if(!(t instanceof Uint8Array))n=jD(t,e);else{var i=0,o=e.length,s=e.charAt(0),a=[0];for(i=0;i<t.length;++i){for(var c=0,u=t[i];c<a.length;++c)u+=a[c]<<8,a[c]=u%o,u=u/o|0;for(;u>0;)a.push(u%o),u=u/o|0}for(i=0;t[i]===0&&i<t.length-1;++i)n+=s;for(i=a.length-1;i>=0;--i)n+=e[a[i]]}if(r){var l=new RegExp(".{1,"+r+"}","g");n=n.match(l).join(`\r `)}return n};Gy.decode=function(t,e){if(typeof t!="string")throw new TypeError('"input" must be a string.');if(typeof e!="string")throw new TypeError('"alphabet" must be a string.');var r=DS[e];if(!r){r=DS[e]=[];for(var n=0;n<e.length;++n)r[e.charCodeAt(n)]=n}t=t.replace(/\s/g,"");for(var i=e.length,o=e.charAt(0),s=[0],n=0;n<t.length;n++){var a=r[t.charCodeAt(n)];if(a===void 0)return;for(var c=0,u=a;c<s.length;++c)u+=s[c]*i,s[c]=u&255,u>>=8;for(;u>0;)s.push(u&255),u>>=8}for(var l=0;t[l]===o&&l<t.length-1;++l)s.push(0);return typeof Buffer<"u"?Buffer.from(s.reverse()):new Uint8Array(s.reverse())};function jD(t,e){var r=0,n=e.length,i=e.charAt(0),o=[0];for(r=0;r<t.length();++r){for(var s=0,a=t.at(r);s<o.length;++s)a+=o[s]<<8,o[s]=a%n,a=a/n|0;for(;a>0;)o.push(a%n),a=a/n|0}var c="";for(r=0;t.at(r)===0&&r<t.length()-1;++r)c+=i;for(r=o.length-1;r>=0;--r)c+=e[o[r]];return c}});var ft=re((yse,MS)=>{var OS=Le(),US=LS(),v=MS.exports=OS.util=OS.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){v.nextTick=process.nextTick,typeof setImmediate=="function"?v.setImmediate=setImmediate:v.setImmediate=v.nextTick;return}if(typeof setImmediate=="function"){v.setImmediate=function(){return setImmediate.apply(void 0,arguments)},v.nextTick=function(a){return setImmediate(a)};return}if(v.setImmediate=function(a){setTimeout(a,0)},typeof window<"u"&&typeof window.postMessage=="function"){let a=function(c){if(c.source===window&&c.data===t){c.stopPropagation();var u=e.slice();e.length=0,u.forEach(function(l){l()})}};var s=a,t="forge.setImmediate",e=[];v.setImmediate=function(c){e.push(c),e.length===1&&window.postMessage(t,"*")},window.addEventListener("message",a,!0)}if(typeof MutationObserver<"u"){var r=Date.now(),n=!0,i=document.createElement("div"),e=[];new MutationObserver(function(){var c=e.slice();e.length=0,c.forEach(function(u){u()})}).observe(i,{attributes:!0});var o=v.setImmediate;v.setImmediate=function(c){Date.now()-r>15?(r=Date.now(),o(c)):(e.push(c),e.length===1&&i.setAttribute("a",n=!n))}}v.nextTick=v.setImmediate})();v.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;v.globalScope=function(){return v.isNodejs?globalThis:typeof self>"u"?window:self}();v.isArray=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};v.isArrayBuffer=function(t){return typeof ArrayBuffer<"u"&&t instanceof ArrayBuffer};v.isArrayBufferView=function(t){return t&&v.isArrayBuffer(t.buffer)&&t.byteLength!==void 0};function ru(t){if(!(t===8||t===16||t===24||t===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+t)}v.ByteBuffer=Wy;function Wy(t){if(this.data="",this.read=0,typeof t=="string")this.data=t;else if(v.isArrayBuffer(t)||v.isArrayBufferView(t))if(typeof Buffer<"u"&&t instanceof Buffer)this.data=t.toString("binary");else{var e=new Uint8Array(t);try{this.data=String.fromCharCode.apply(null,e)}catch{for(var r=0;r<e.length;++r)this.putByte(e[r])}}else(t instanceof Wy||typeof t=="object"&&typeof t.data=="string"&&typeof t.read=="number")&&(this.data=t.data,this.read=t.read);this._constructedStringLength=0}v.ByteStringBuffer=Wy;var QD=4096;v.ByteStringBuffer.prototype._optimizeConstructedString=function(t){this._constructedStringLength+=t,this._constructedStringLength>QD&&(this.data.substr(0,1),this._constructedStringLength=0)};v.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};v.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};v.ByteStringBuffer.prototype.putByte=function(t){return this.putBytes(String.fromCharCode(t))};v.ByteStringBuffer.prototype.fillWithByte=function(t,e){t=String.fromCharCode(t);for(var r=this.data;e>0;)e&1&&(r+=t),e>>>=1,e>0&&(t+=t);return this.data=r,this._optimizeConstructedString(e),this};v.ByteStringBuffer.prototype.putBytes=function(t){return this.data+=t,this._optimizeConstructedString(t.length),this};v.ByteStringBuffer.prototype.putString=function(t){return this.putBytes(v.encodeUtf8(t))};v.ByteStringBuffer.prototype.putInt16=function(t){return this.putBytes(String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};v.ByteStringBuffer.prototype.putInt24=function(t){return this.putBytes(String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};v.ByteStringBuffer.prototype.putInt32=function(t){return this.putBytes(String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255