@libp2p/autonat 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.min.js +10 -10
  2. package/package.json +7 -7
package/dist/index.min.js CHANGED
@@ -1,18 +1,18 @@
1
1
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PAutonat = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
- "use strict";var Libp2PAutonat=(()=>{var Qc=Object.create;var Tn=Object.defineProperty;var Xc=Object.getOwnPropertyDescriptor;var Jc=Object.getOwnPropertyNames;var jc=Object.getPrototypeOf,tu=Object.prototype.hasOwnProperty;var ft=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ct=(t,e)=>{for(var r in e)Tn(t,r,{get:e[r],enumerable:!0})},Zs=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Jc(e))!tu.call(t,i)&&i!==r&&Tn(t,i,{get:()=>e[i],enumerable:!(n=Xc(e,i))||n.enumerable});return t};var Kt=(t,e,r)=>(r=t!=null?Qc(jc(t)):{},Zs(e||!t||!t.__esModule?Tn(r,"default",{value:t,enumerable:!0}):r,t)),eu=t=>Zs(Tn({},"__esModule",{value:!0}),t);var ct=ft((mg,ba)=>{ba.exports={options:{usePureJavaScript:!1}}});var Sa=ft((vg,Ea)=>{var eo={};Ea.exports=eo;var wa={};eo.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=cl(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,f=t[i];c<a.length;++c)f+=a[c]<<8,a[c]=f%o,f=f/o|0;for(;f>0;)a.push(f%o),f=f/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 u=new RegExp(".{1,"+r+"}","g");n=n.match(u).join(`\r
3
- `)}return n};eo.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=wa[e];if(!r){r=wa[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,f=a;c<s.length;++c)f+=s[c]*i,s[c]=f&255,f>>=8;for(;f>0;)s.push(f&255),f>>=8}for(var u=0;t[u]===o&&u<t.length-1;++u)s.push(0);return typeof Buffer<"u"?Buffer.from(s.reverse()):new Uint8Array(s.reverse())};function cl(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 Et=ft((bg,Ta)=>{var Ba=ct(),Aa=Sa(),v=Ta.exports=Ba.util=Ba.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 f=e.slice();e.length=0,f.forEach(function(u){u()})}};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(f){f()})}).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 nn(t){if(!(t===8||t===16||t===24||t===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+t)}v.ByteBuffer=ro;function ro(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 ro||typeof t=="object"&&typeof t.data=="string"&&typeof t.read=="number")&&(this.data=t.data,this.read=t.read);this._constructedStringLength=0}v.ByteStringBuffer=ro;var ul=4096;v.ByteStringBuffer.prototype._optimizeConstructedString=function(t){this._constructedStringLength+=t,this._constructedStringLength>ul&&(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))};v.ByteStringBuffer.prototype.putInt16Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255))};v.ByteStringBuffer.prototype.putInt24Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255))};v.ByteStringBuffer.prototype.putInt32Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>24&255))};v.ByteStringBuffer.prototype.putInt=function(t,e){nn(e);var r="";do e-=8,r+=String.fromCharCode(t>>e&255);while(e>0);return this.putBytes(r)};v.ByteStringBuffer.prototype.putSignedInt=function(t,e){return t<0&&(t+=2<<e-1),this.putInt(t,e)};v.ByteStringBuffer.prototype.putBuffer=function(t){return this.putBytes(t.getBytes())};v.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};v.ByteStringBuffer.prototype.getInt16=function(){var t=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,t};v.ByteStringBuffer.prototype.getInt24=function(){var t=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,t};v.ByteStringBuffer.prototype.getInt32=function(){var t=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,t};v.ByteStringBuffer.prototype.getInt16Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,t};v.ByteStringBuffer.prototype.getInt24Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,t};v.ByteStringBuffer.prototype.getInt32Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,t};v.ByteStringBuffer.prototype.getInt=function(t){nn(t);var e=0;do e=(e<<8)+this.data.charCodeAt(this.read++),t-=8;while(t>0);return e};v.ByteStringBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e};v.ByteStringBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):t===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};v.ByteStringBuffer.prototype.bytes=function(t){return typeof t>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+t)};v.ByteStringBuffer.prototype.at=function(t){return this.data.charCodeAt(this.read+t)};v.ByteStringBuffer.prototype.setAt=function(t,e){return this.data=this.data.substr(0,this.read+t)+String.fromCharCode(e)+this.data.substr(this.read+t+1),this};v.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};v.ByteStringBuffer.prototype.copy=function(){var t=v.createBuffer(this.data);return t.read=this.read,t};v.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this};v.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};v.ByteStringBuffer.prototype.truncate=function(t){var e=Math.max(0,this.length()-t);return this.data=this.data.substr(this.read,e),this.read=0,this};v.ByteStringBuffer.prototype.toHex=function(){for(var t="",e=this.read;e<this.data.length;++e){var r=this.data.charCodeAt(e);r<16&&(t+="0"),t+=r.toString(16)}return t};v.ByteStringBuffer.prototype.toString=function(){return v.decodeUtf8(this.bytes())};function ll(t,e){e=e||{},this.read=e.readOffset||0,this.growSize=e.growSize||1024;var r=v.isArrayBuffer(t),n=v.isArrayBufferView(t);if(r||n){r?this.data=new DataView(t):this.data=new DataView(t.buffer,t.byteOffset,t.byteLength),this.write="writeOffset"in e?e.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,t!=null&&this.putBytes(t),"writeOffset"in e&&(this.write=e.writeOffset)}v.DataBuffer=ll;v.DataBuffer.prototype.length=function(){return this.write-this.read};v.DataBuffer.prototype.isEmpty=function(){return this.length()<=0};v.DataBuffer.prototype.accommodate=function(t,e){if(this.length()>=t)return this;e=Math.max(e||this.growSize,t);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+e);return n.set(r),this.data=new DataView(n.buffer),this};v.DataBuffer.prototype.putByte=function(t){return this.accommodate(1),this.data.setUint8(this.write++,t),this};v.DataBuffer.prototype.fillWithByte=function(t,e){this.accommodate(e);for(var r=0;r<e;++r)this.data.setUint8(t);return this};v.DataBuffer.prototype.putBytes=function(t,e){if(v.isArrayBufferView(t)){var r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n=r.byteLength-r.byteOffset;this.accommodate(n);var i=new Uint8Array(this.data.buffer,this.write);return i.set(r),this.write+=n,this}if(v.isArrayBuffer(t)){var r=new Uint8Array(t);this.accommodate(r.byteLength);var i=new Uint8Array(this.data.buffer);return i.set(r,this.write),this.write+=r.byteLength,this}if(t instanceof v.DataBuffer||typeof t=="object"&&typeof t.read=="number"&&typeof t.write=="number"&&v.isArrayBufferView(t.data)){var r=new Uint8Array(t.data.byteLength,t.read,t.length());this.accommodate(r.byteLength);var i=new Uint8Array(t.data.byteLength,this.write);return i.set(r),this.write+=r.byteLength,this}if(t instanceof v.ByteStringBuffer&&(t=t.data,e="binary"),e=e||"binary",typeof t=="string"){var o;if(e==="hex")return this.accommodate(Math.ceil(t.length/2)),o=new Uint8Array(this.data.buffer,this.write),this.write+=v.binary.hex.decode(t,o,this.write),this;if(e==="base64")return this.accommodate(Math.ceil(t.length/4)*3),o=new Uint8Array(this.data.buffer,this.write),this.write+=v.binary.base64.decode(t,o,this.write),this;if(e==="utf8"&&(t=v.encodeUtf8(t),e="binary"),e==="binary"||e==="raw")return this.accommodate(t.length),o=new Uint8Array(this.data.buffer,this.write),this.write+=v.binary.raw.decode(o),this;if(e==="utf16")return this.accommodate(t.length*2),o=new Uint16Array(this.data.buffer,this.write),this.write+=v.text.utf16.encode(o),this;throw new Error("Invalid encoding: "+e)}throw Error("Invalid parameter: "+t)};v.DataBuffer.prototype.putBuffer=function(t){return this.putBytes(t),t.clear(),this};v.DataBuffer.prototype.putString=function(t){return this.putBytes(t,"utf16")};v.DataBuffer.prototype.putInt16=function(t){return this.accommodate(2),this.data.setInt16(this.write,t),this.write+=2,this};v.DataBuffer.prototype.putInt24=function(t){return this.accommodate(3),this.data.setInt16(this.write,t>>8&65535),this.data.setInt8(this.write,t>>16&255),this.write+=3,this};v.DataBuffer.prototype.putInt32=function(t){return this.accommodate(4),this.data.setInt32(this.write,t),this.write+=4,this};v.DataBuffer.prototype.putInt16Le=function(t){return this.accommodate(2),this.data.setInt16(this.write,t,!0),this.write+=2,this};v.DataBuffer.prototype.putInt24Le=function(t){return this.accommodate(3),this.data.setInt8(this.write,t>>16&255),this.data.setInt16(this.write,t>>8&65535,!0),this.write+=3,this};v.DataBuffer.prototype.putInt32Le=function(t){return this.accommodate(4),this.data.setInt32(this.write,t,!0),this.write+=4,this};v.DataBuffer.prototype.putInt=function(t,e){nn(e),this.accommodate(e/8);do e-=8,this.data.setInt8(this.write++,t>>e&255);while(e>0);return this};v.DataBuffer.prototype.putSignedInt=function(t,e){return nn(e),this.accommodate(e/8),t<0&&(t+=2<<e-1),this.putInt(t,e)};v.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};v.DataBuffer.prototype.getInt16=function(){var t=this.data.getInt16(this.read);return this.read+=2,t};v.DataBuffer.prototype.getInt24=function(){var t=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,t};v.DataBuffer.prototype.getInt32=function(){var t=this.data.getInt32(this.read);return this.read+=4,t};v.DataBuffer.prototype.getInt16Le=function(){var t=this.data.getInt16(this.read,!0);return this.read+=2,t};v.DataBuffer.prototype.getInt24Le=function(){var t=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,t};v.DataBuffer.prototype.getInt32Le=function(){var t=this.data.getInt32(this.read,!0);return this.read+=4,t};v.DataBuffer.prototype.getInt=function(t){nn(t);var e=0;do e=(e<<8)+this.data.getInt8(this.read++),t-=8;while(t>0);return e};v.DataBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e};v.DataBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):t===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};v.DataBuffer.prototype.bytes=function(t){return typeof t>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+t)};v.DataBuffer.prototype.at=function(t){return this.data.getUint8(this.read+t)};v.DataBuffer.prototype.setAt=function(t,e){return this.data.setUint8(t,e),this};v.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};v.DataBuffer.prototype.copy=function(){return new v.DataBuffer(this)};v.DataBuffer.prototype.compact=function(){if(this.read>0){var t=new Uint8Array(this.data.buffer,this.read),e=new Uint8Array(t.byteLength);e.set(t),this.data=new DataView(e),this.write-=this.read,this.read=0}return this};v.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};v.DataBuffer.prototype.truncate=function(t){return this.write=Math.max(0,this.length()-t),this.read=Math.min(this.read,this.write),this};v.DataBuffer.prototype.toHex=function(){for(var t="",e=this.read;e<this.data.byteLength;++e){var r=this.data.getUint8(e);r<16&&(t+="0"),t+=r.toString(16)}return t};v.DataBuffer.prototype.toString=function(t){var e=new Uint8Array(this.data,this.read,this.length());if(t=t||"utf8",t==="binary"||t==="raw")return v.binary.raw.encode(e);if(t==="hex")return v.binary.hex.encode(e);if(t==="base64")return v.binary.base64.encode(e);if(t==="utf8")return v.text.utf8.decode(e);if(t==="utf16")return v.text.utf16.decode(e);throw new Error("Invalid encoding: "+t)};v.createBuffer=function(t,e){return e=e||"raw",t!==void 0&&e==="utf8"&&(t=v.encodeUtf8(t)),new v.ByteBuffer(t)};v.fillString=function(t,e){for(var r="";e>0;)e&1&&(r+=t),e>>>=1,e>0&&(t+=t);return r};v.xorBytes=function(t,e,r){for(var n="",i="",o="",s=0,a=0;r>0;--r,++s)i=t.charCodeAt(s)^e.charCodeAt(s),a>=10&&(n+=o,o="",a=0),o+=String.fromCharCode(i),++a;return n+=o,n};v.hexToBytes=function(t){var e="",r=0;for(t.length&!0&&(r=1,e+=String.fromCharCode(parseInt(t[0],16)));r<t.length;r+=2)e+=String.fromCharCode(parseInt(t.substr(r,2),16));return e};v.bytesToHex=function(t){return v.createBuffer(t).toHex()};v.int32ToBytes=function(t){return String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255)};var $e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Ge=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],Ia="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";v.encode64=function(t,e){for(var r="",n="",i,o,s,a=0;a<t.length;)i=t.charCodeAt(a++),o=t.charCodeAt(a++),s=t.charCodeAt(a++),r+=$e.charAt(i>>2),r+=$e.charAt((i&3)<<4|o>>4),isNaN(o)?r+="==":(r+=$e.charAt((o&15)<<2|s>>6),r+=isNaN(s)?"=":$e.charAt(s&63)),e&&r.length>e&&(n+=r.substr(0,e)+`\r
4
- `,r=r.substr(e));return n+=r,n};v.decode64=function(t){t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e="",r,n,i,o,s=0;s<t.length;)r=Ge[t.charCodeAt(s++)-43],n=Ge[t.charCodeAt(s++)-43],i=Ge[t.charCodeAt(s++)-43],o=Ge[t.charCodeAt(s++)-43],e+=String.fromCharCode(r<<2|n>>4),i!==64&&(e+=String.fromCharCode((n&15)<<4|i>>2),o!==64&&(e+=String.fromCharCode((i&3)<<6|o)));return e};v.encodeUtf8=function(t){return unescape(encodeURIComponent(t))};v.decodeUtf8=function(t){return decodeURIComponent(escape(t))};v.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:Aa.encode,decode:Aa.decode}};v.binary.raw.encode=function(t){return String.fromCharCode.apply(null,t)};v.binary.raw.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(t.length)),r=r||0;for(var i=r,o=0;o<t.length;++o)n[i++]=t.charCodeAt(o);return e?i-r:n};v.binary.hex.encode=v.bytesToHex;v.binary.hex.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(Math.ceil(t.length/2))),r=r||0;var i=0,o=r;for(t.length&1&&(i=1,n[o++]=parseInt(t[0],16));i<t.length;i+=2)n[o++]=parseInt(t.substr(i,2),16);return e?o-r:n};v.binary.base64.encode=function(t,e){for(var r="",n="",i,o,s,a=0;a<t.byteLength;)i=t[a++],o=t[a++],s=t[a++],r+=$e.charAt(i>>2),r+=$e.charAt((i&3)<<4|o>>4),isNaN(o)?r+="==":(r+=$e.charAt((o&15)<<2|s>>6),r+=isNaN(s)?"=":$e.charAt(s&63)),e&&r.length>e&&(n+=r.substr(0,e)+`\r
5
- `,r=r.substr(e));return n+=r,n};v.binary.base64.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(Math.ceil(t.length/4)*3)),t=t.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var i,o,s,a,c=0,f=r;c<t.length;)i=Ge[t.charCodeAt(c++)-43],o=Ge[t.charCodeAt(c++)-43],s=Ge[t.charCodeAt(c++)-43],a=Ge[t.charCodeAt(c++)-43],n[f++]=i<<2|o>>4,s!==64&&(n[f++]=(o&15)<<4|s>>2,a!==64&&(n[f++]=(s&3)<<6|a));return e?f-r:n.subarray(0,f)};v.binary.base58.encode=function(t,e){return v.binary.baseN.encode(t,Ia,e)};v.binary.base58.decode=function(t,e){return v.binary.baseN.decode(t,Ia,e)};v.text={utf8:{},utf16:{}};v.text.utf8.encode=function(t,e,r){t=v.encodeUtf8(t);var n=e;n||(n=new Uint8Array(t.length)),r=r||0;for(var i=r,o=0;o<t.length;++o)n[i++]=t.charCodeAt(o);return e?i-r:n};v.text.utf8.decode=function(t){return v.decodeUtf8(String.fromCharCode.apply(null,t))};v.text.utf16.encode=function(t,e,r){var n=e;n||(n=new Uint8Array(t.length*2));var i=new Uint16Array(n.buffer);r=r||0;for(var o=r,s=r,a=0;a<t.length;++a)i[s++]=t.charCodeAt(a),o+=2;return e?o-r:n};v.text.utf16.decode=function(t){return String.fromCharCode.apply(null,new Uint16Array(t.buffer))};v.deflate=function(t,e,r){if(e=v.decode64(t.deflate(v.encode64(e)).rval),r){var n=2,i=e.charCodeAt(1);i&32&&(n=6),e=e.substring(n,e.length-4)}return e};v.inflate=function(t,e,r){var n=t.inflate(v.encode64(e)).rval;return n===null?null:v.decode64(n)};var no=function(t,e,r){if(!t)throw new Error("WebStorage not available.");var n;if(r===null?n=t.removeItem(e):(r=v.encode64(JSON.stringify(r)),n=t.setItem(e,r)),typeof n<"u"&&n.rval!==!0){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}},io=function(t,e){if(!t)throw new Error("WebStorage not available.");var r=t.getItem(e);if(t.init)if(r.rval===null){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}r=null}else r=r.rval;return r!==null&&(r=JSON.parse(v.decode64(r))),r},hl=function(t,e,r,n){var i=io(t,e);i===null&&(i={}),i[r]=n,no(t,e,i)},dl=function(t,e,r){var n=io(t,e);return n!==null&&(n=r in n?n[r]:null),n},pl=function(t,e,r){var n=io(t,e);if(n!==null&&r in n){delete n[r];var i=!0;for(var o in n){i=!1;break}i&&(n=null),no(t,e,n)}},yl=function(t,e){no(t,e,null)},Ln=function(t,e,r){var n=null;typeof r>"u"&&(r=["web","flash"]);var i,o=!1,s=null;for(var a in r){i=r[a];try{if(i==="flash"||i==="both"){if(e[0]===null)throw new Error("Flash local storage not available.");n=t.apply(this,e),o=i==="flash"}(i==="web"||i==="both")&&(e[0]=localStorage,n=t.apply(this,e),o=!0)}catch(c){s=c}if(o)break}if(!o)throw s;return n};v.setItem=function(t,e,r,n,i){Ln(hl,arguments,i)};v.getItem=function(t,e,r,n){return Ln(dl,arguments,n)};v.removeItem=function(t,e,r,n){Ln(pl,arguments,n)};v.clearItems=function(t,e,r){Ln(yl,arguments,r)};v.isEmpty=function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0};v.format=function(t){for(var e=/%./g,r,n,i=0,o=[],s=0;r=e.exec(t);){n=t.substring(s,e.lastIndex-2),n.length>0&&o.push(n),s=e.lastIndex;var a=r[0][1];switch(a){case"s":case"o":i<arguments.length?o.push(arguments[i+++1]):o.push("<?>");break;case"%":o.push("%");break;default:o.push("<%"+a+"?>")}}return o.push(t.substring(s)),o.join("")};v.formatNumber=function(t,e,r,n){var i=t,o=isNaN(e=Math.abs(e))?2:e,s=r===void 0?",":r,a=n===void 0?".":n,c=i<0?"-":"",f=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",u=f.length>3?f.length%3:0;return c+(u?f.substr(0,u)+a:"")+f.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+a)+(o?s+Math.abs(i-f).toFixed(o).slice(2):"")};v.formatSize=function(t){return t>=1073741824?t=v.formatNumber(t/1073741824,2,".","")+" GiB":t>=1048576?t=v.formatNumber(t/1048576,2,".","")+" MiB":t>=1024?t=v.formatNumber(t/1024,0)+" KiB":t=v.formatNumber(t,0)+" bytes",t};v.bytesFromIP=function(t){return t.indexOf(".")!==-1?v.bytesFromIPv4(t):t.indexOf(":")!==-1?v.bytesFromIPv6(t):null};v.bytesFromIPv4=function(t){if(t=t.split("."),t.length!==4)return null;for(var e=v.createBuffer(),r=0;r<t.length;++r){var n=parseInt(t[r],10);if(isNaN(n))return null;e.putByte(n)}return e.getBytes()};v.bytesFromIPv6=function(t){var e=0;t=t.split(":").filter(function(s){return s.length===0&&++e,!0});for(var r=(8-t.length+e)*2,n=v.createBuffer(),i=0;i<8;++i){if(!t[i]||t[i].length===0){n.fillWithByte(0,r),r=0;continue}var o=v.hexToBytes(t[i]);o.length<2&&n.putByte(0),n.putBytes(o)}return n.getBytes()};v.bytesToIP=function(t){return t.length===4?v.bytesToIPv4(t):t.length===16?v.bytesToIPv6(t):null};v.bytesToIPv4=function(t){if(t.length!==4)return null;for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e.join(".")};v.bytesToIPv6=function(t){if(t.length!==16)return null;for(var e=[],r=[],n=0,i=0;i<t.length;i+=2){for(var o=v.bytesToHex(t[i]+t[i+1]);o[0]==="0"&&o!=="0";)o=o.substr(1);if(o==="0"){var s=r[r.length-1],a=e.length;!s||a!==s.end+1?r.push({start:a,end:a}):(s.end=a,s.end-s.start>r[n].end-r[n].start&&(n=r.length-1))}e.push(o)}if(r.length>0){var c=r[n];c.end-c.start>0&&(e.splice(c.start,c.end-c.start+1,""),c.start===0&&e.unshift(""),c.end===7&&e.push(""))}return e.join(":")};v.estimateCores=function(t,e){if(typeof t=="function"&&(e=t,t={}),t=t||{},"cores"in v&&!t.update)return e(null,v.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return v.cores=navigator.hardwareConcurrency,e(null,v.cores);if(typeof Worker>"u")return v.cores=1,e(null,v.cores);if(typeof Blob>"u")return v.cores=2,e(null,v.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(s){for(var a=Date.now(),c=a+4;Date.now()<c;);self.postMessage({st:a,et:c})})}.toString(),")()"],{type:"application/javascript"}));n([],5,16);function n(s,a,c){if(a===0){var f=Math.floor(s.reduce(function(u,l){return u+l},0)/s.length);return v.cores=Math.max(1,f),URL.revokeObjectURL(r),e(null,v.cores)}i(c,function(u,l){s.push(o(c,l)),n(s,a-1,c)})}function i(s,a){for(var c=[],f=[],u=0;u<s;++u){var l=new Worker(r);l.addEventListener("message",function(p){if(f.push(p.data),f.length===s){for(var d=0;d<s;++d)c[d].terminate();a(null,f)}}),c.push(l)}for(var u=0;u<s;++u)c[u].postMessage(u)}function o(s,a){for(var c=[],f=0;f<s;++f)for(var u=a[f],l=c[f]=[],p=0;p<s;++p)if(f!==p){var d=a[p];(u.st>d.st&&u.st<d.et||d.st>u.st&&d.st<u.et)&&l.push(p)}return c.reduce(function(h,y){return Math.max(h,y.length)},0)}}});var Dn=ft((wg,Ca)=>{var on=ct();on.pki=on.pki||{};var oo=Ca.exports=on.pki.oids=on.oids=on.oids||{};function C(t,e){oo[t]=e,oo[e]=t}function nt(t,e){oo[t]=e}C("1.2.840.113549.1.1.1","rsaEncryption");C("1.2.840.113549.1.1.4","md5WithRSAEncryption");C("1.2.840.113549.1.1.5","sha1WithRSAEncryption");C("1.2.840.113549.1.1.7","RSAES-OAEP");C("1.2.840.113549.1.1.8","mgf1");C("1.2.840.113549.1.1.9","pSpecified");C("1.2.840.113549.1.1.10","RSASSA-PSS");C("1.2.840.113549.1.1.11","sha256WithRSAEncryption");C("1.2.840.113549.1.1.12","sha384WithRSAEncryption");C("1.2.840.113549.1.1.13","sha512WithRSAEncryption");C("1.3.101.112","EdDSA25519");C("1.2.840.10040.4.3","dsa-with-sha1");C("1.3.14.3.2.7","desCBC");C("1.3.14.3.2.26","sha1");C("1.3.14.3.2.29","sha1WithRSASignature");C("2.16.840.1.101.3.4.2.1","sha256");C("2.16.840.1.101.3.4.2.2","sha384");C("2.16.840.1.101.3.4.2.3","sha512");C("2.16.840.1.101.3.4.2.4","sha224");C("2.16.840.1.101.3.4.2.5","sha512-224");C("2.16.840.1.101.3.4.2.6","sha512-256");C("1.2.840.113549.2.2","md2");C("1.2.840.113549.2.5","md5");C("1.2.840.113549.1.7.1","data");C("1.2.840.113549.1.7.2","signedData");C("1.2.840.113549.1.7.3","envelopedData");C("1.2.840.113549.1.7.4","signedAndEnvelopedData");C("1.2.840.113549.1.7.5","digestedData");C("1.2.840.113549.1.7.6","encryptedData");C("1.2.840.113549.1.9.1","emailAddress");C("1.2.840.113549.1.9.2","unstructuredName");C("1.2.840.113549.1.9.3","contentType");C("1.2.840.113549.1.9.4","messageDigest");C("1.2.840.113549.1.9.5","signingTime");C("1.2.840.113549.1.9.6","counterSignature");C("1.2.840.113549.1.9.7","challengePassword");C("1.2.840.113549.1.9.8","unstructuredAddress");C("1.2.840.113549.1.9.14","extensionRequest");C("1.2.840.113549.1.9.20","friendlyName");C("1.2.840.113549.1.9.21","localKeyId");C("1.2.840.113549.1.9.22.1","x509Certificate");C("1.2.840.113549.1.12.10.1.1","keyBag");C("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");C("1.2.840.113549.1.12.10.1.3","certBag");C("1.2.840.113549.1.12.10.1.4","crlBag");C("1.2.840.113549.1.12.10.1.5","secretBag");C("1.2.840.113549.1.12.10.1.6","safeContentsBag");C("1.2.840.113549.1.5.13","pkcs5PBES2");C("1.2.840.113549.1.5.12","pkcs5PBKDF2");C("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");C("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");C("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");C("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");C("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");C("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");C("1.2.840.113549.2.7","hmacWithSHA1");C("1.2.840.113549.2.8","hmacWithSHA224");C("1.2.840.113549.2.9","hmacWithSHA256");C("1.2.840.113549.2.10","hmacWithSHA384");C("1.2.840.113549.2.11","hmacWithSHA512");C("1.2.840.113549.3.7","des-EDE3-CBC");C("2.16.840.1.101.3.4.1.2","aes128-CBC");C("2.16.840.1.101.3.4.1.22","aes192-CBC");C("2.16.840.1.101.3.4.1.42","aes256-CBC");C("2.5.4.3","commonName");C("2.5.4.4","surname");C("2.5.4.5","serialNumber");C("2.5.4.6","countryName");C("2.5.4.7","localityName");C("2.5.4.8","stateOrProvinceName");C("2.5.4.9","streetAddress");C("2.5.4.10","organizationName");C("2.5.4.11","organizationalUnitName");C("2.5.4.12","title");C("2.5.4.13","description");C("2.5.4.15","businessCategory");C("2.5.4.17","postalCode");C("2.5.4.42","givenName");C("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");C("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");C("2.16.840.1.113730.1.1","nsCertType");C("2.16.840.1.113730.1.13","nsComment");nt("2.5.29.1","authorityKeyIdentifier");nt("2.5.29.2","keyAttributes");nt("2.5.29.3","certificatePolicies");nt("2.5.29.4","keyUsageRestriction");nt("2.5.29.5","policyMapping");nt("2.5.29.6","subtreesConstraint");nt("2.5.29.7","subjectAltName");nt("2.5.29.8","issuerAltName");nt("2.5.29.9","subjectDirectoryAttributes");nt("2.5.29.10","basicConstraints");nt("2.5.29.11","nameConstraints");nt("2.5.29.12","policyConstraints");nt("2.5.29.13","basicConstraints");C("2.5.29.14","subjectKeyIdentifier");C("2.5.29.15","keyUsage");nt("2.5.29.16","privateKeyUsagePeriod");C("2.5.29.17","subjectAltName");C("2.5.29.18","issuerAltName");C("2.5.29.19","basicConstraints");nt("2.5.29.20","cRLNumber");nt("2.5.29.21","cRLReason");nt("2.5.29.22","expirationDate");nt("2.5.29.23","instructionCode");nt("2.5.29.24","invalidityDate");nt("2.5.29.25","cRLDistributionPoints");nt("2.5.29.26","issuingDistributionPoint");nt("2.5.29.27","deltaCRLIndicator");nt("2.5.29.28","issuingDistributionPoint");nt("2.5.29.29","certificateIssuer");nt("2.5.29.30","nameConstraints");C("2.5.29.31","cRLDistributionPoints");C("2.5.29.32","certificatePolicies");nt("2.5.29.33","policyMappings");nt("2.5.29.34","policyConstraints");C("2.5.29.35","authorityKeyIdentifier");nt("2.5.29.36","policyConstraints");C("2.5.29.37","extKeyUsage");nt("2.5.29.46","freshestCRL");nt("2.5.29.54","inhibitAnyPolicy");C("1.3.6.1.4.1.11129.2.4.2","timestampList");C("1.3.6.1.5.5.7.1.1","authorityInfoAccess");C("1.3.6.1.5.5.7.3.1","serverAuth");C("1.3.6.1.5.5.7.3.2","clientAuth");C("1.3.6.1.5.5.7.3.3","codeSigning");C("1.3.6.1.5.5.7.3.4","emailProtection");C("1.3.6.1.5.5.7.3.8","timeStamping")});var an=ft((Eg,Ra)=>{var dt=ct();Et();Dn();var N=Ra.exports=dt.asn1=dt.asn1||{};N.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};N.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30};N.create=function(t,e,r,n,i){if(dt.util.isArray(n)){for(var o=[],s=0;s<n.length;++s)n[s]!==void 0&&o.push(n[s]);n=o}var a={tagClass:t,type:e,constructed:r,composed:r||dt.util.isArray(n),value:n};return i&&"bitStringContents"in i&&(a.bitStringContents=i.bitStringContents,a.original=N.copy(a)),a};N.copy=function(t,e){var r;if(dt.util.isArray(t)){r=[];for(var n=0;n<t.length;++n)r.push(N.copy(t[n],e));return r}return typeof t=="string"?t:(r={tagClass:t.tagClass,type:t.type,constructed:t.constructed,composed:t.composed,value:N.copy(t.value,e)},e&&!e.excludeBitStringContents&&(r.bitStringContents=t.bitStringContents),r)};N.equals=function(t,e,r){if(dt.util.isArray(t)){if(!dt.util.isArray(e)||t.length!==e.length)return!1;for(var n=0;n<t.length;++n)if(!N.equals(t[n],e[n]))return!1;return!0}if(typeof t!=typeof e)return!1;if(typeof t=="string")return t===e;var i=t.tagClass===e.tagClass&&t.type===e.type&&t.constructed===e.constructed&&t.composed===e.composed&&N.equals(t.value,e.value);return r&&r.includeBitStringContents&&(i=i&&t.bitStringContents===e.bitStringContents),i};N.getBerValueLength=function(t){var e=t.getByte();if(e!==128){var r,n=e&128;return n?r=t.getInt((e&127)<<3):r=e,r}};function sn(t,e,r){if(r>e){var n=new Error("Too few bytes to parse DER.");throw n.available=t.length(),n.remaining=e,n.requested=r,n}}var gl=function(t,e){var r=t.getByte();if(e--,r!==128){var n,i=r&128;if(!i)n=r;else{var o=r&127;sn(t,e,o),n=t.getInt(o<<3)}if(n<0)throw new Error("Negative length: "+n);return n}};N.fromDer=function(t,e){e===void 0&&(e={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof e=="boolean"&&(e={strict:e,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in e||(e.strict=!0),"parseAllBytes"in e||(e.parseAllBytes=!0),"decodeBitStrings"in e||(e.decodeBitStrings=!0),typeof t=="string"&&(t=dt.util.createBuffer(t));var r=t.length(),n=Pn(t,t.length(),0,e);if(e.parseAllBytes&&t.length()!==0){var i=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw i.byteCount=r,i.remaining=t.length(),i}return n};function Pn(t,e,r,n){var i;sn(t,e,2);var o=t.getByte();e--;var s=o&192,a=o&31;i=t.length();var c=gl(t,e);if(e-=i-t.length(),c!==void 0&&c>e){if(n.strict){var f=new Error("Too few bytes to read ASN.1 value.");throw f.available=t.length(),f.remaining=e,f.requested=c,f}c=e}var u,l,p=(o&32)===32;if(p)if(u=[],c===void 0)for(;;){if(sn(t,e,2),t.bytes(2)==="\0\0"){t.getBytes(2),e-=2;break}i=t.length(),u.push(Pn(t,e,r+1,n)),e-=i-t.length()}else for(;c>0;)i=t.length(),u.push(Pn(t,c,r+1,n)),e-=i-t.length(),c-=i-t.length();if(u===void 0&&s===N.Class.UNIVERSAL&&a===N.Type.BITSTRING&&(l=t.bytes(c)),u===void 0&&n.decodeBitStrings&&s===N.Class.UNIVERSAL&&a===N.Type.BITSTRING&&c>1){var d=t.read,h=e,y=0;if(a===N.Type.BITSTRING&&(sn(t,e,1),y=t.getByte(),e--),y===0)try{i=t.length();var g={strict:!0,decodeBitStrings:!0},x=Pn(t,e,r+1,g),m=i-t.length();e-=m,a==N.Type.BITSTRING&&m++;var b=x.tagClass;m===c&&(b===N.Class.UNIVERSAL||b===N.Class.CONTEXT_SPECIFIC)&&(u=[x])}catch{}u===void 0&&(t.read=d,e=h)}if(u===void 0){if(c===void 0){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");c=e}if(a===N.Type.BMPSTRING)for(u="";c>0;c-=2)sn(t,e,2),u+=String.fromCharCode(t.getInt16()),e-=2;else u=t.getBytes(c),e-=c}var _=l===void 0?null:{bitStringContents:l};return N.create(s,a,p,u,_)}N.toDer=function(t){var e=dt.util.createBuffer(),r=t.tagClass|t.type,n=dt.util.createBuffer(),i=!1;if("bitStringContents"in t&&(i=!0,t.original&&(i=N.equals(t,t.original))),i)n.putBytes(t.bitStringContents);else if(t.composed){t.constructed?r|=32:n.putByte(0);for(var o=0;o<t.value.length;++o)t.value[o]!==void 0&&n.putBuffer(N.toDer(t.value[o]))}else if(t.type===N.Type.BMPSTRING)for(var o=0;o<t.value.length;++o)n.putInt16(t.value.charCodeAt(o));else t.type===N.Type.INTEGER&&t.value.length>1&&(t.value.charCodeAt(0)===0&&!(t.value.charCodeAt(1)&128)||t.value.charCodeAt(0)===255&&(t.value.charCodeAt(1)&128)===128)?n.putBytes(t.value.substr(1)):n.putBytes(t.value);if(e.putByte(r),n.length()<=127)e.putByte(n.length()&127);else{var s=n.length(),a="";do a+=String.fromCharCode(s&255),s=s>>>8;while(s>0);e.putByte(a.length|128);for(var o=a.length-1;o>=0;--o)e.putByte(a.charCodeAt(o))}return e.putBuffer(n),e};N.oidToDer=function(t){var e=t.split("."),r=dt.util.createBuffer();r.putByte(40*parseInt(e[0],10)+parseInt(e[1],10));for(var n,i,o,s,a=2;a<e.length;++a){n=!0,i=[],o=parseInt(e[a],10);do s=o&127,o=o>>>7,n||(s|=128),i.push(s),n=!1;while(o>0);for(var c=i.length-1;c>=0;--c)r.putByte(i[c])}return r};N.derToOid=function(t){var e;typeof t=="string"&&(t=dt.util.createBuffer(t));var r=t.getByte();e=Math.floor(r/40)+"."+r%40;for(var n=0;t.length()>0;)r=t.getByte(),n=n<<7,r&128?n+=r&127:(e+="."+(n+r),n=0);return e};N.utcTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(t.substr(2,2),10)-1,i=parseInt(t.substr(4,2),10),o=parseInt(t.substr(6,2),10),s=parseInt(t.substr(8,2),10),a=0;if(t.length>11){var c=t.charAt(10),f=10;c!=="+"&&c!=="-"&&(a=parseInt(t.substr(10,2),10),f+=2)}if(e.setUTCFullYear(r,n,i),e.setUTCHours(o,s,a,0),f&&(c=t.charAt(f),c==="+"||c==="-")){var u=parseInt(t.substr(f+1,2),10),l=parseInt(t.substr(f+4,2),10),p=u*60+l;p*=6e4,c==="+"?e.setTime(+e-p):e.setTime(+e+p)}return e};N.generalizedTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,4),10),n=parseInt(t.substr(4,2),10)-1,i=parseInt(t.substr(6,2),10),o=parseInt(t.substr(8,2),10),s=parseInt(t.substr(10,2),10),a=parseInt(t.substr(12,2),10),c=0,f=0,u=!1;t.charAt(t.length-1)==="Z"&&(u=!0);var l=t.length-5,p=t.charAt(l);if(p==="+"||p==="-"){var d=parseInt(t.substr(l+1,2),10),h=parseInt(t.substr(l+4,2),10);f=d*60+h,f*=6e4,p==="+"&&(f*=-1),u=!0}return t.charAt(14)==="."&&(c=parseFloat(t.substr(14),10)*1e3),u?(e.setUTCFullYear(r,n,i),e.setUTCHours(o,s,a,c),e.setTime(+e+f)):(e.setFullYear(r,n,i),e.setHours(o,s,a,c)),e};N.dateToUtcTime=function(t){if(typeof t=="string")return t;var e="",r=[];r.push((""+t.getUTCFullYear()).substr(2)),r.push(""+(t.getUTCMonth()+1)),r.push(""+t.getUTCDate()),r.push(""+t.getUTCHours()),r.push(""+t.getUTCMinutes()),r.push(""+t.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(e+="0"),e+=r[n];return e+="Z",e};N.dateToGeneralizedTime=function(t){if(typeof t=="string")return t;var e="",r=[];r.push(""+t.getUTCFullYear()),r.push(""+(t.getUTCMonth()+1)),r.push(""+t.getUTCDate()),r.push(""+t.getUTCHours()),r.push(""+t.getUTCMinutes()),r.push(""+t.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(e+="0"),e+=r[n];return e+="Z",e};N.integerToDer=function(t){var e=dt.util.createBuffer();if(t>=-128&&t<128)return e.putSignedInt(t,8);if(t>=-32768&&t<32768)return e.putSignedInt(t,16);if(t>=-8388608&&t<8388608)return e.putSignedInt(t,24);if(t>=-2147483648&&t<2147483648)return e.putSignedInt(t,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=t,r};N.derToInteger=function(t){typeof t=="string"&&(t=dt.util.createBuffer(t));var e=t.length()*8;if(e>32)throw new Error("Integer too large; max is 32-bits.");return t.getSignedInt(e)};N.validate=function(t,e,r,n){var i=!1;if((t.tagClass===e.tagClass||typeof e.tagClass>"u")&&(t.type===e.type||typeof e.type>"u"))if(t.constructed===e.constructed||typeof e.constructed>"u"){if(i=!0,e.value&&dt.util.isArray(e.value))for(var o=0,s=0;i&&s<e.value.length;++s)i=e.value[s].optional||!1,t.value[o]&&(i=N.validate(t.value[o],e.value[s],r,n),i?++o:e.value[s].optional&&(i=!0)),!i&&n&&n.push("["+e.name+'] Tag class "'+e.tagClass+'", type "'+e.type+'" expected value length "'+e.value.length+'", got "'+t.value.length+'"');if(i&&r&&(e.capture&&(r[e.capture]=t.value),e.captureAsn1&&(r[e.captureAsn1]=t),e.captureBitStringContents&&"bitStringContents"in t&&(r[e.captureBitStringContents]=t.bitStringContents),e.captureBitStringValue&&"bitStringContents"in t)){var a;if(t.bitStringContents.length<2)r[e.captureBitStringValue]="";else{var c=t.bitStringContents.charCodeAt(0);if(c!==0)throw new Error("captureBitStringValue only supported for zero unused bits");r[e.captureBitStringValue]=t.bitStringContents.slice(1)}}}else n&&n.push("["+e.name+'] Expected constructed "'+e.constructed+'", got "'+t.constructed+'"');else n&&(t.tagClass!==e.tagClass&&n.push("["+e.name+'] Expected tag class "'+e.tagClass+'", got "'+t.tagClass+'"'),t.type!==e.type&&n.push("["+e.name+'] Expected type "'+e.type+'", got "'+t.type+'"'));return i};var _a=/[^\\u0000-\\u00ff]/;N.prettyPrint=function(t,e,r){var n="";e=e||0,r=r||2,e>0&&(n+=`
2
+ "use strict";var Libp2PAutonat=(()=>{var Hc=Object.create;var An=Object.defineProperty;var $c=Object.getOwnPropertyDescriptor;var Gc=Object.getOwnPropertyNames;var Wc=Object.getPrototypeOf,Yc=Object.prototype.hasOwnProperty;var ft=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),_t=(t,e)=>{for(var r in e)An(t,r,{get:e[r],enumerable:!0})},Gs=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Gc(e))!Yc.call(t,i)&&i!==r&&An(t,i,{get:()=>e[i],enumerable:!(n=$c(e,i))||n.enumerable});return t};var Mt=(t,e,r)=>(r=t!=null?Hc(Wc(t)):{},Gs(e||!t||!t.__esModule?An(r,"default",{value:t,enumerable:!0}):r,t)),Zc=t=>Gs(An({},"__esModule",{value:!0}),t);var ct=ft((hg,xa)=>{xa.exports={options:{usePureJavaScript:!1}}});var ba=ft((dg,va)=>{var ji={};va.exports=ji;var ma={};ji.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=nl(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,f=t[i];c<a.length;++c)f+=a[c]<<8,a[c]=f%o,f=f/o|0;for(;f>0;)a.push(f%o),f=f/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 u=new RegExp(".{1,"+r+"}","g");n=n.match(u).join(`\r
3
+ `)}return n};ji.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=ma[e];if(!r){r=ma[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,f=a;c<s.length;++c)f+=s[c]*i,s[c]=f&255,f>>=8;for(;f>0;)s.push(f&255),f>>=8}for(var u=0;t[u]===o&&u<t.length-1;++u)s.push(0);return typeof Buffer<"u"?Buffer.from(s.reverse()):new Uint8Array(s.reverse())};function nl(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 Et=ft((pg,Ba)=>{var wa=ct(),Ea=ba(),v=Ba.exports=wa.util=wa.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 f=e.slice();e.length=0,f.forEach(function(u){u()})}};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(f){f()})}).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 nn(t){if(!(t===8||t===16||t===24||t===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+t)}v.ByteBuffer=to;function to(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 to||typeof t=="object"&&typeof t.data=="string"&&typeof t.read=="number")&&(this.data=t.data,this.read=t.read);this._constructedStringLength=0}v.ByteStringBuffer=to;var il=4096;v.ByteStringBuffer.prototype._optimizeConstructedString=function(t){this._constructedStringLength+=t,this._constructedStringLength>il&&(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))};v.ByteStringBuffer.prototype.putInt16Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255))};v.ByteStringBuffer.prototype.putInt24Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255))};v.ByteStringBuffer.prototype.putInt32Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>24&255))};v.ByteStringBuffer.prototype.putInt=function(t,e){nn(e);var r="";do e-=8,r+=String.fromCharCode(t>>e&255);while(e>0);return this.putBytes(r)};v.ByteStringBuffer.prototype.putSignedInt=function(t,e){return t<0&&(t+=2<<e-1),this.putInt(t,e)};v.ByteStringBuffer.prototype.putBuffer=function(t){return this.putBytes(t.getBytes())};v.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};v.ByteStringBuffer.prototype.getInt16=function(){var t=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,t};v.ByteStringBuffer.prototype.getInt24=function(){var t=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,t};v.ByteStringBuffer.prototype.getInt32=function(){var t=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,t};v.ByteStringBuffer.prototype.getInt16Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,t};v.ByteStringBuffer.prototype.getInt24Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,t};v.ByteStringBuffer.prototype.getInt32Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,t};v.ByteStringBuffer.prototype.getInt=function(t){nn(t);var e=0;do e=(e<<8)+this.data.charCodeAt(this.read++),t-=8;while(t>0);return e};v.ByteStringBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e};v.ByteStringBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):t===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};v.ByteStringBuffer.prototype.bytes=function(t){return typeof t>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+t)};v.ByteStringBuffer.prototype.at=function(t){return this.data.charCodeAt(this.read+t)};v.ByteStringBuffer.prototype.setAt=function(t,e){return this.data=this.data.substr(0,this.read+t)+String.fromCharCode(e)+this.data.substr(this.read+t+1),this};v.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};v.ByteStringBuffer.prototype.copy=function(){var t=v.createBuffer(this.data);return t.read=this.read,t};v.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this};v.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};v.ByteStringBuffer.prototype.truncate=function(t){var e=Math.max(0,this.length()-t);return this.data=this.data.substr(this.read,e),this.read=0,this};v.ByteStringBuffer.prototype.toHex=function(){for(var t="",e=this.read;e<this.data.length;++e){var r=this.data.charCodeAt(e);r<16&&(t+="0"),t+=r.toString(16)}return t};v.ByteStringBuffer.prototype.toString=function(){return v.decodeUtf8(this.bytes())};function ol(t,e){e=e||{},this.read=e.readOffset||0,this.growSize=e.growSize||1024;var r=v.isArrayBuffer(t),n=v.isArrayBufferView(t);if(r||n){r?this.data=new DataView(t):this.data=new DataView(t.buffer,t.byteOffset,t.byteLength),this.write="writeOffset"in e?e.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,t!=null&&this.putBytes(t),"writeOffset"in e&&(this.write=e.writeOffset)}v.DataBuffer=ol;v.DataBuffer.prototype.length=function(){return this.write-this.read};v.DataBuffer.prototype.isEmpty=function(){return this.length()<=0};v.DataBuffer.prototype.accommodate=function(t,e){if(this.length()>=t)return this;e=Math.max(e||this.growSize,t);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+e);return n.set(r),this.data=new DataView(n.buffer),this};v.DataBuffer.prototype.putByte=function(t){return this.accommodate(1),this.data.setUint8(this.write++,t),this};v.DataBuffer.prototype.fillWithByte=function(t,e){this.accommodate(e);for(var r=0;r<e;++r)this.data.setUint8(t);return this};v.DataBuffer.prototype.putBytes=function(t,e){if(v.isArrayBufferView(t)){var r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n=r.byteLength-r.byteOffset;this.accommodate(n);var i=new Uint8Array(this.data.buffer,this.write);return i.set(r),this.write+=n,this}if(v.isArrayBuffer(t)){var r=new Uint8Array(t);this.accommodate(r.byteLength);var i=new Uint8Array(this.data.buffer);return i.set(r,this.write),this.write+=r.byteLength,this}if(t instanceof v.DataBuffer||typeof t=="object"&&typeof t.read=="number"&&typeof t.write=="number"&&v.isArrayBufferView(t.data)){var r=new Uint8Array(t.data.byteLength,t.read,t.length());this.accommodate(r.byteLength);var i=new Uint8Array(t.data.byteLength,this.write);return i.set(r),this.write+=r.byteLength,this}if(t instanceof v.ByteStringBuffer&&(t=t.data,e="binary"),e=e||"binary",typeof t=="string"){var o;if(e==="hex")return this.accommodate(Math.ceil(t.length/2)),o=new Uint8Array(this.data.buffer,this.write),this.write+=v.binary.hex.decode(t,o,this.write),this;if(e==="base64")return this.accommodate(Math.ceil(t.length/4)*3),o=new Uint8Array(this.data.buffer,this.write),this.write+=v.binary.base64.decode(t,o,this.write),this;if(e==="utf8"&&(t=v.encodeUtf8(t),e="binary"),e==="binary"||e==="raw")return this.accommodate(t.length),o=new Uint8Array(this.data.buffer,this.write),this.write+=v.binary.raw.decode(o),this;if(e==="utf16")return this.accommodate(t.length*2),o=new Uint16Array(this.data.buffer,this.write),this.write+=v.text.utf16.encode(o),this;throw new Error("Invalid encoding: "+e)}throw Error("Invalid parameter: "+t)};v.DataBuffer.prototype.putBuffer=function(t){return this.putBytes(t),t.clear(),this};v.DataBuffer.prototype.putString=function(t){return this.putBytes(t,"utf16")};v.DataBuffer.prototype.putInt16=function(t){return this.accommodate(2),this.data.setInt16(this.write,t),this.write+=2,this};v.DataBuffer.prototype.putInt24=function(t){return this.accommodate(3),this.data.setInt16(this.write,t>>8&65535),this.data.setInt8(this.write,t>>16&255),this.write+=3,this};v.DataBuffer.prototype.putInt32=function(t){return this.accommodate(4),this.data.setInt32(this.write,t),this.write+=4,this};v.DataBuffer.prototype.putInt16Le=function(t){return this.accommodate(2),this.data.setInt16(this.write,t,!0),this.write+=2,this};v.DataBuffer.prototype.putInt24Le=function(t){return this.accommodate(3),this.data.setInt8(this.write,t>>16&255),this.data.setInt16(this.write,t>>8&65535,!0),this.write+=3,this};v.DataBuffer.prototype.putInt32Le=function(t){return this.accommodate(4),this.data.setInt32(this.write,t,!0),this.write+=4,this};v.DataBuffer.prototype.putInt=function(t,e){nn(e),this.accommodate(e/8);do e-=8,this.data.setInt8(this.write++,t>>e&255);while(e>0);return this};v.DataBuffer.prototype.putSignedInt=function(t,e){return nn(e),this.accommodate(e/8),t<0&&(t+=2<<e-1),this.putInt(t,e)};v.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};v.DataBuffer.prototype.getInt16=function(){var t=this.data.getInt16(this.read);return this.read+=2,t};v.DataBuffer.prototype.getInt24=function(){var t=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,t};v.DataBuffer.prototype.getInt32=function(){var t=this.data.getInt32(this.read);return this.read+=4,t};v.DataBuffer.prototype.getInt16Le=function(){var t=this.data.getInt16(this.read,!0);return this.read+=2,t};v.DataBuffer.prototype.getInt24Le=function(){var t=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,t};v.DataBuffer.prototype.getInt32Le=function(){var t=this.data.getInt32(this.read,!0);return this.read+=4,t};v.DataBuffer.prototype.getInt=function(t){nn(t);var e=0;do e=(e<<8)+this.data.getInt8(this.read++),t-=8;while(t>0);return e};v.DataBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e};v.DataBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):t===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};v.DataBuffer.prototype.bytes=function(t){return typeof t>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+t)};v.DataBuffer.prototype.at=function(t){return this.data.getUint8(this.read+t)};v.DataBuffer.prototype.setAt=function(t,e){return this.data.setUint8(t,e),this};v.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};v.DataBuffer.prototype.copy=function(){return new v.DataBuffer(this)};v.DataBuffer.prototype.compact=function(){if(this.read>0){var t=new Uint8Array(this.data.buffer,this.read),e=new Uint8Array(t.byteLength);e.set(t),this.data=new DataView(e),this.write-=this.read,this.read=0}return this};v.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};v.DataBuffer.prototype.truncate=function(t){return this.write=Math.max(0,this.length()-t),this.read=Math.min(this.read,this.write),this};v.DataBuffer.prototype.toHex=function(){for(var t="",e=this.read;e<this.data.byteLength;++e){var r=this.data.getUint8(e);r<16&&(t+="0"),t+=r.toString(16)}return t};v.DataBuffer.prototype.toString=function(t){var e=new Uint8Array(this.data,this.read,this.length());if(t=t||"utf8",t==="binary"||t==="raw")return v.binary.raw.encode(e);if(t==="hex")return v.binary.hex.encode(e);if(t==="base64")return v.binary.base64.encode(e);if(t==="utf8")return v.text.utf8.decode(e);if(t==="utf16")return v.text.utf16.decode(e);throw new Error("Invalid encoding: "+t)};v.createBuffer=function(t,e){return e=e||"raw",t!==void 0&&e==="utf8"&&(t=v.encodeUtf8(t)),new v.ByteBuffer(t)};v.fillString=function(t,e){for(var r="";e>0;)e&1&&(r+=t),e>>>=1,e>0&&(t+=t);return r};v.xorBytes=function(t,e,r){for(var n="",i="",o="",s=0,a=0;r>0;--r,++s)i=t.charCodeAt(s)^e.charCodeAt(s),a>=10&&(n+=o,o="",a=0),o+=String.fromCharCode(i),++a;return n+=o,n};v.hexToBytes=function(t){var e="",r=0;for(t.length&!0&&(r=1,e+=String.fromCharCode(parseInt(t[0],16)));r<t.length;r+=2)e+=String.fromCharCode(parseInt(t.substr(r,2),16));return e};v.bytesToHex=function(t){return v.createBuffer(t).toHex()};v.int32ToBytes=function(t){return String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255)};var $e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Ge=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],Sa="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";v.encode64=function(t,e){for(var r="",n="",i,o,s,a=0;a<t.length;)i=t.charCodeAt(a++),o=t.charCodeAt(a++),s=t.charCodeAt(a++),r+=$e.charAt(i>>2),r+=$e.charAt((i&3)<<4|o>>4),isNaN(o)?r+="==":(r+=$e.charAt((o&15)<<2|s>>6),r+=isNaN(s)?"=":$e.charAt(s&63)),e&&r.length>e&&(n+=r.substr(0,e)+`\r
4
+ `,r=r.substr(e));return n+=r,n};v.decode64=function(t){t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e="",r,n,i,o,s=0;s<t.length;)r=Ge[t.charCodeAt(s++)-43],n=Ge[t.charCodeAt(s++)-43],i=Ge[t.charCodeAt(s++)-43],o=Ge[t.charCodeAt(s++)-43],e+=String.fromCharCode(r<<2|n>>4),i!==64&&(e+=String.fromCharCode((n&15)<<4|i>>2),o!==64&&(e+=String.fromCharCode((i&3)<<6|o)));return e};v.encodeUtf8=function(t){return unescape(encodeURIComponent(t))};v.decodeUtf8=function(t){return decodeURIComponent(escape(t))};v.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:Ea.encode,decode:Ea.decode}};v.binary.raw.encode=function(t){return String.fromCharCode.apply(null,t)};v.binary.raw.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(t.length)),r=r||0;for(var i=r,o=0;o<t.length;++o)n[i++]=t.charCodeAt(o);return e?i-r:n};v.binary.hex.encode=v.bytesToHex;v.binary.hex.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(Math.ceil(t.length/2))),r=r||0;var i=0,o=r;for(t.length&1&&(i=1,n[o++]=parseInt(t[0],16));i<t.length;i+=2)n[o++]=parseInt(t.substr(i,2),16);return e?o-r:n};v.binary.base64.encode=function(t,e){for(var r="",n="",i,o,s,a=0;a<t.byteLength;)i=t[a++],o=t[a++],s=t[a++],r+=$e.charAt(i>>2),r+=$e.charAt((i&3)<<4|o>>4),isNaN(o)?r+="==":(r+=$e.charAt((o&15)<<2|s>>6),r+=isNaN(s)?"=":$e.charAt(s&63)),e&&r.length>e&&(n+=r.substr(0,e)+`\r
5
+ `,r=r.substr(e));return n+=r,n};v.binary.base64.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(Math.ceil(t.length/4)*3)),t=t.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var i,o,s,a,c=0,f=r;c<t.length;)i=Ge[t.charCodeAt(c++)-43],o=Ge[t.charCodeAt(c++)-43],s=Ge[t.charCodeAt(c++)-43],a=Ge[t.charCodeAt(c++)-43],n[f++]=i<<2|o>>4,s!==64&&(n[f++]=(o&15)<<4|s>>2,a!==64&&(n[f++]=(s&3)<<6|a));return e?f-r:n.subarray(0,f)};v.binary.base58.encode=function(t,e){return v.binary.baseN.encode(t,Sa,e)};v.binary.base58.decode=function(t,e){return v.binary.baseN.decode(t,Sa,e)};v.text={utf8:{},utf16:{}};v.text.utf8.encode=function(t,e,r){t=v.encodeUtf8(t);var n=e;n||(n=new Uint8Array(t.length)),r=r||0;for(var i=r,o=0;o<t.length;++o)n[i++]=t.charCodeAt(o);return e?i-r:n};v.text.utf8.decode=function(t){return v.decodeUtf8(String.fromCharCode.apply(null,t))};v.text.utf16.encode=function(t,e,r){var n=e;n||(n=new Uint8Array(t.length*2));var i=new Uint16Array(n.buffer);r=r||0;for(var o=r,s=r,a=0;a<t.length;++a)i[s++]=t.charCodeAt(a),o+=2;return e?o-r:n};v.text.utf16.decode=function(t){return String.fromCharCode.apply(null,new Uint16Array(t.buffer))};v.deflate=function(t,e,r){if(e=v.decode64(t.deflate(v.encode64(e)).rval),r){var n=2,i=e.charCodeAt(1);i&32&&(n=6),e=e.substring(n,e.length-4)}return e};v.inflate=function(t,e,r){var n=t.inflate(v.encode64(e)).rval;return n===null?null:v.decode64(n)};var eo=function(t,e,r){if(!t)throw new Error("WebStorage not available.");var n;if(r===null?n=t.removeItem(e):(r=v.encode64(JSON.stringify(r)),n=t.setItem(e,r)),typeof n<"u"&&n.rval!==!0){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}},ro=function(t,e){if(!t)throw new Error("WebStorage not available.");var r=t.getItem(e);if(t.init)if(r.rval===null){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}r=null}else r=r.rval;return r!==null&&(r=JSON.parse(v.decode64(r))),r},sl=function(t,e,r,n){var i=ro(t,e);i===null&&(i={}),i[r]=n,eo(t,e,i)},al=function(t,e,r){var n=ro(t,e);return n!==null&&(n=r in n?n[r]:null),n},fl=function(t,e,r){var n=ro(t,e);if(n!==null&&r in n){delete n[r];var i=!0;for(var o in n){i=!1;break}i&&(n=null),eo(t,e,n)}},cl=function(t,e){eo(t,e,null)},_n=function(t,e,r){var n=null;typeof r>"u"&&(r=["web","flash"]);var i,o=!1,s=null;for(var a in r){i=r[a];try{if(i==="flash"||i==="both"){if(e[0]===null)throw new Error("Flash local storage not available.");n=t.apply(this,e),o=i==="flash"}(i==="web"||i==="both")&&(e[0]=localStorage,n=t.apply(this,e),o=!0)}catch(c){s=c}if(o)break}if(!o)throw s;return n};v.setItem=function(t,e,r,n,i){_n(sl,arguments,i)};v.getItem=function(t,e,r,n){return _n(al,arguments,n)};v.removeItem=function(t,e,r,n){_n(fl,arguments,n)};v.clearItems=function(t,e,r){_n(cl,arguments,r)};v.isEmpty=function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0};v.format=function(t){for(var e=/%./g,r,n,i=0,o=[],s=0;r=e.exec(t);){n=t.substring(s,e.lastIndex-2),n.length>0&&o.push(n),s=e.lastIndex;var a=r[0][1];switch(a){case"s":case"o":i<arguments.length?o.push(arguments[i+++1]):o.push("<?>");break;case"%":o.push("%");break;default:o.push("<%"+a+"?>")}}return o.push(t.substring(s)),o.join("")};v.formatNumber=function(t,e,r,n){var i=t,o=isNaN(e=Math.abs(e))?2:e,s=r===void 0?",":r,a=n===void 0?".":n,c=i<0?"-":"",f=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",u=f.length>3?f.length%3:0;return c+(u?f.substr(0,u)+a:"")+f.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+a)+(o?s+Math.abs(i-f).toFixed(o).slice(2):"")};v.formatSize=function(t){return t>=1073741824?t=v.formatNumber(t/1073741824,2,".","")+" GiB":t>=1048576?t=v.formatNumber(t/1048576,2,".","")+" MiB":t>=1024?t=v.formatNumber(t/1024,0)+" KiB":t=v.formatNumber(t,0)+" bytes",t};v.bytesFromIP=function(t){return t.indexOf(".")!==-1?v.bytesFromIPv4(t):t.indexOf(":")!==-1?v.bytesFromIPv6(t):null};v.bytesFromIPv4=function(t){if(t=t.split("."),t.length!==4)return null;for(var e=v.createBuffer(),r=0;r<t.length;++r){var n=parseInt(t[r],10);if(isNaN(n))return null;e.putByte(n)}return e.getBytes()};v.bytesFromIPv6=function(t){var e=0;t=t.split(":").filter(function(s){return s.length===0&&++e,!0});for(var r=(8-t.length+e)*2,n=v.createBuffer(),i=0;i<8;++i){if(!t[i]||t[i].length===0){n.fillWithByte(0,r),r=0;continue}var o=v.hexToBytes(t[i]);o.length<2&&n.putByte(0),n.putBytes(o)}return n.getBytes()};v.bytesToIP=function(t){return t.length===4?v.bytesToIPv4(t):t.length===16?v.bytesToIPv6(t):null};v.bytesToIPv4=function(t){if(t.length!==4)return null;for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e.join(".")};v.bytesToIPv6=function(t){if(t.length!==16)return null;for(var e=[],r=[],n=0,i=0;i<t.length;i+=2){for(var o=v.bytesToHex(t[i]+t[i+1]);o[0]==="0"&&o!=="0";)o=o.substr(1);if(o==="0"){var s=r[r.length-1],a=e.length;!s||a!==s.end+1?r.push({start:a,end:a}):(s.end=a,s.end-s.start>r[n].end-r[n].start&&(n=r.length-1))}e.push(o)}if(r.length>0){var c=r[n];c.end-c.start>0&&(e.splice(c.start,c.end-c.start+1,""),c.start===0&&e.unshift(""),c.end===7&&e.push(""))}return e.join(":")};v.estimateCores=function(t,e){if(typeof t=="function"&&(e=t,t={}),t=t||{},"cores"in v&&!t.update)return e(null,v.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return v.cores=navigator.hardwareConcurrency,e(null,v.cores);if(typeof Worker>"u")return v.cores=1,e(null,v.cores);if(typeof Blob>"u")return v.cores=2,e(null,v.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(s){for(var a=Date.now(),c=a+4;Date.now()<c;);self.postMessage({st:a,et:c})})}.toString(),")()"],{type:"application/javascript"}));n([],5,16);function n(s,a,c){if(a===0){var f=Math.floor(s.reduce(function(u,l){return u+l},0)/s.length);return v.cores=Math.max(1,f),URL.revokeObjectURL(r),e(null,v.cores)}i(c,function(u,l){s.push(o(c,l)),n(s,a-1,c)})}function i(s,a){for(var c=[],f=[],u=0;u<s;++u){var l=new Worker(r);l.addEventListener("message",function(p){if(f.push(p.data),f.length===s){for(var d=0;d<s;++d)c[d].terminate();a(null,f)}}),c.push(l)}for(var u=0;u<s;++u)c[u].postMessage(u)}function o(s,a){for(var c=[],f=0;f<s;++f)for(var u=a[f],l=c[f]=[],p=0;p<s;++p)if(f!==p){var d=a[p];(u.st>d.st&&u.st<d.et||d.st>u.st&&d.st<u.et)&&l.push(p)}return c.reduce(function(h,y){return Math.max(h,y.length)},0)}}});var Rn=ft((yg,Aa)=>{var on=ct();on.pki=on.pki||{};var no=Aa.exports=on.pki.oids=on.oids=on.oids||{};function C(t,e){no[t]=e,no[e]=t}function nt(t,e){no[t]=e}C("1.2.840.113549.1.1.1","rsaEncryption");C("1.2.840.113549.1.1.4","md5WithRSAEncryption");C("1.2.840.113549.1.1.5","sha1WithRSAEncryption");C("1.2.840.113549.1.1.7","RSAES-OAEP");C("1.2.840.113549.1.1.8","mgf1");C("1.2.840.113549.1.1.9","pSpecified");C("1.2.840.113549.1.1.10","RSASSA-PSS");C("1.2.840.113549.1.1.11","sha256WithRSAEncryption");C("1.2.840.113549.1.1.12","sha384WithRSAEncryption");C("1.2.840.113549.1.1.13","sha512WithRSAEncryption");C("1.3.101.112","EdDSA25519");C("1.2.840.10040.4.3","dsa-with-sha1");C("1.3.14.3.2.7","desCBC");C("1.3.14.3.2.26","sha1");C("1.3.14.3.2.29","sha1WithRSASignature");C("2.16.840.1.101.3.4.2.1","sha256");C("2.16.840.1.101.3.4.2.2","sha384");C("2.16.840.1.101.3.4.2.3","sha512");C("2.16.840.1.101.3.4.2.4","sha224");C("2.16.840.1.101.3.4.2.5","sha512-224");C("2.16.840.1.101.3.4.2.6","sha512-256");C("1.2.840.113549.2.2","md2");C("1.2.840.113549.2.5","md5");C("1.2.840.113549.1.7.1","data");C("1.2.840.113549.1.7.2","signedData");C("1.2.840.113549.1.7.3","envelopedData");C("1.2.840.113549.1.7.4","signedAndEnvelopedData");C("1.2.840.113549.1.7.5","digestedData");C("1.2.840.113549.1.7.6","encryptedData");C("1.2.840.113549.1.9.1","emailAddress");C("1.2.840.113549.1.9.2","unstructuredName");C("1.2.840.113549.1.9.3","contentType");C("1.2.840.113549.1.9.4","messageDigest");C("1.2.840.113549.1.9.5","signingTime");C("1.2.840.113549.1.9.6","counterSignature");C("1.2.840.113549.1.9.7","challengePassword");C("1.2.840.113549.1.9.8","unstructuredAddress");C("1.2.840.113549.1.9.14","extensionRequest");C("1.2.840.113549.1.9.20","friendlyName");C("1.2.840.113549.1.9.21","localKeyId");C("1.2.840.113549.1.9.22.1","x509Certificate");C("1.2.840.113549.1.12.10.1.1","keyBag");C("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");C("1.2.840.113549.1.12.10.1.3","certBag");C("1.2.840.113549.1.12.10.1.4","crlBag");C("1.2.840.113549.1.12.10.1.5","secretBag");C("1.2.840.113549.1.12.10.1.6","safeContentsBag");C("1.2.840.113549.1.5.13","pkcs5PBES2");C("1.2.840.113549.1.5.12","pkcs5PBKDF2");C("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");C("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");C("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");C("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");C("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");C("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");C("1.2.840.113549.2.7","hmacWithSHA1");C("1.2.840.113549.2.8","hmacWithSHA224");C("1.2.840.113549.2.9","hmacWithSHA256");C("1.2.840.113549.2.10","hmacWithSHA384");C("1.2.840.113549.2.11","hmacWithSHA512");C("1.2.840.113549.3.7","des-EDE3-CBC");C("2.16.840.1.101.3.4.1.2","aes128-CBC");C("2.16.840.1.101.3.4.1.22","aes192-CBC");C("2.16.840.1.101.3.4.1.42","aes256-CBC");C("2.5.4.3","commonName");C("2.5.4.4","surname");C("2.5.4.5","serialNumber");C("2.5.4.6","countryName");C("2.5.4.7","localityName");C("2.5.4.8","stateOrProvinceName");C("2.5.4.9","streetAddress");C("2.5.4.10","organizationName");C("2.5.4.11","organizationalUnitName");C("2.5.4.12","title");C("2.5.4.13","description");C("2.5.4.15","businessCategory");C("2.5.4.17","postalCode");C("2.5.4.42","givenName");C("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");C("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");C("2.16.840.1.113730.1.1","nsCertType");C("2.16.840.1.113730.1.13","nsComment");nt("2.5.29.1","authorityKeyIdentifier");nt("2.5.29.2","keyAttributes");nt("2.5.29.3","certificatePolicies");nt("2.5.29.4","keyUsageRestriction");nt("2.5.29.5","policyMapping");nt("2.5.29.6","subtreesConstraint");nt("2.5.29.7","subjectAltName");nt("2.5.29.8","issuerAltName");nt("2.5.29.9","subjectDirectoryAttributes");nt("2.5.29.10","basicConstraints");nt("2.5.29.11","nameConstraints");nt("2.5.29.12","policyConstraints");nt("2.5.29.13","basicConstraints");C("2.5.29.14","subjectKeyIdentifier");C("2.5.29.15","keyUsage");nt("2.5.29.16","privateKeyUsagePeriod");C("2.5.29.17","subjectAltName");C("2.5.29.18","issuerAltName");C("2.5.29.19","basicConstraints");nt("2.5.29.20","cRLNumber");nt("2.5.29.21","cRLReason");nt("2.5.29.22","expirationDate");nt("2.5.29.23","instructionCode");nt("2.5.29.24","invalidityDate");nt("2.5.29.25","cRLDistributionPoints");nt("2.5.29.26","issuingDistributionPoint");nt("2.5.29.27","deltaCRLIndicator");nt("2.5.29.28","issuingDistributionPoint");nt("2.5.29.29","certificateIssuer");nt("2.5.29.30","nameConstraints");C("2.5.29.31","cRLDistributionPoints");C("2.5.29.32","certificatePolicies");nt("2.5.29.33","policyMappings");nt("2.5.29.34","policyConstraints");C("2.5.29.35","authorityKeyIdentifier");nt("2.5.29.36","policyConstraints");C("2.5.29.37","extKeyUsage");nt("2.5.29.46","freshestCRL");nt("2.5.29.54","inhibitAnyPolicy");C("1.3.6.1.4.1.11129.2.4.2","timestampList");C("1.3.6.1.5.5.7.1.1","authorityInfoAccess");C("1.3.6.1.5.5.7.3.1","serverAuth");C("1.3.6.1.5.5.7.3.2","clientAuth");C("1.3.6.1.5.5.7.3.3","codeSigning");C("1.3.6.1.5.5.7.3.4","emailProtection");C("1.3.6.1.5.5.7.3.8","timeStamping")});var an=ft((gg,Ta)=>{var dt=ct();Et();Rn();var N=Ta.exports=dt.asn1=dt.asn1||{};N.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};N.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30};N.create=function(t,e,r,n,i){if(dt.util.isArray(n)){for(var o=[],s=0;s<n.length;++s)n[s]!==void 0&&o.push(n[s]);n=o}var a={tagClass:t,type:e,constructed:r,composed:r||dt.util.isArray(n),value:n};return i&&"bitStringContents"in i&&(a.bitStringContents=i.bitStringContents,a.original=N.copy(a)),a};N.copy=function(t,e){var r;if(dt.util.isArray(t)){r=[];for(var n=0;n<t.length;++n)r.push(N.copy(t[n],e));return r}return typeof t=="string"?t:(r={tagClass:t.tagClass,type:t.type,constructed:t.constructed,composed:t.composed,value:N.copy(t.value,e)},e&&!e.excludeBitStringContents&&(r.bitStringContents=t.bitStringContents),r)};N.equals=function(t,e,r){if(dt.util.isArray(t)){if(!dt.util.isArray(e)||t.length!==e.length)return!1;for(var n=0;n<t.length;++n)if(!N.equals(t[n],e[n]))return!1;return!0}if(typeof t!=typeof e)return!1;if(typeof t=="string")return t===e;var i=t.tagClass===e.tagClass&&t.type===e.type&&t.constructed===e.constructed&&t.composed===e.composed&&N.equals(t.value,e.value);return r&&r.includeBitStringContents&&(i=i&&t.bitStringContents===e.bitStringContents),i};N.getBerValueLength=function(t){var e=t.getByte();if(e!==128){var r,n=e&128;return n?r=t.getInt((e&127)<<3):r=e,r}};function sn(t,e,r){if(r>e){var n=new Error("Too few bytes to parse DER.");throw n.available=t.length(),n.remaining=e,n.requested=r,n}}var ul=function(t,e){var r=t.getByte();if(e--,r!==128){var n,i=r&128;if(!i)n=r;else{var o=r&127;sn(t,e,o),n=t.getInt(o<<3)}if(n<0)throw new Error("Negative length: "+n);return n}};N.fromDer=function(t,e){e===void 0&&(e={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof e=="boolean"&&(e={strict:e,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in e||(e.strict=!0),"parseAllBytes"in e||(e.parseAllBytes=!0),"decodeBitStrings"in e||(e.decodeBitStrings=!0),typeof t=="string"&&(t=dt.util.createBuffer(t));var r=t.length(),n=Ln(t,t.length(),0,e);if(e.parseAllBytes&&t.length()!==0){var i=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw i.byteCount=r,i.remaining=t.length(),i}return n};function Ln(t,e,r,n){var i;sn(t,e,2);var o=t.getByte();e--;var s=o&192,a=o&31;i=t.length();var c=ul(t,e);if(e-=i-t.length(),c!==void 0&&c>e){if(n.strict){var f=new Error("Too few bytes to read ASN.1 value.");throw f.available=t.length(),f.remaining=e,f.requested=c,f}c=e}var u,l,p=(o&32)===32;if(p)if(u=[],c===void 0)for(;;){if(sn(t,e,2),t.bytes(2)==="\0\0"){t.getBytes(2),e-=2;break}i=t.length(),u.push(Ln(t,e,r+1,n)),e-=i-t.length()}else for(;c>0;)i=t.length(),u.push(Ln(t,c,r+1,n)),e-=i-t.length(),c-=i-t.length();if(u===void 0&&s===N.Class.UNIVERSAL&&a===N.Type.BITSTRING&&(l=t.bytes(c)),u===void 0&&n.decodeBitStrings&&s===N.Class.UNIVERSAL&&a===N.Type.BITSTRING&&c>1){var d=t.read,h=e,y=0;if(a===N.Type.BITSTRING&&(sn(t,e,1),y=t.getByte(),e--),y===0)try{i=t.length();var g={strict:!0,decodeBitStrings:!0},x=Ln(t,e,r+1,g),m=i-t.length();e-=m,a==N.Type.BITSTRING&&m++;var b=x.tagClass;m===c&&(b===N.Class.UNIVERSAL||b===N.Class.CONTEXT_SPECIFIC)&&(u=[x])}catch{}u===void 0&&(t.read=d,e=h)}if(u===void 0){if(c===void 0){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");c=e}if(a===N.Type.BMPSTRING)for(u="";c>0;c-=2)sn(t,e,2),u+=String.fromCharCode(t.getInt16()),e-=2;else u=t.getBytes(c),e-=c}var _=l===void 0?null:{bitStringContents:l};return N.create(s,a,p,u,_)}N.toDer=function(t){var e=dt.util.createBuffer(),r=t.tagClass|t.type,n=dt.util.createBuffer(),i=!1;if("bitStringContents"in t&&(i=!0,t.original&&(i=N.equals(t,t.original))),i)n.putBytes(t.bitStringContents);else if(t.composed){t.constructed?r|=32:n.putByte(0);for(var o=0;o<t.value.length;++o)t.value[o]!==void 0&&n.putBuffer(N.toDer(t.value[o]))}else if(t.type===N.Type.BMPSTRING)for(var o=0;o<t.value.length;++o)n.putInt16(t.value.charCodeAt(o));else t.type===N.Type.INTEGER&&t.value.length>1&&(t.value.charCodeAt(0)===0&&!(t.value.charCodeAt(1)&128)||t.value.charCodeAt(0)===255&&(t.value.charCodeAt(1)&128)===128)?n.putBytes(t.value.substr(1)):n.putBytes(t.value);if(e.putByte(r),n.length()<=127)e.putByte(n.length()&127);else{var s=n.length(),a="";do a+=String.fromCharCode(s&255),s=s>>>8;while(s>0);e.putByte(a.length|128);for(var o=a.length-1;o>=0;--o)e.putByte(a.charCodeAt(o))}return e.putBuffer(n),e};N.oidToDer=function(t){var e=t.split("."),r=dt.util.createBuffer();r.putByte(40*parseInt(e[0],10)+parseInt(e[1],10));for(var n,i,o,s,a=2;a<e.length;++a){n=!0,i=[],o=parseInt(e[a],10);do s=o&127,o=o>>>7,n||(s|=128),i.push(s),n=!1;while(o>0);for(var c=i.length-1;c>=0;--c)r.putByte(i[c])}return r};N.derToOid=function(t){var e;typeof t=="string"&&(t=dt.util.createBuffer(t));var r=t.getByte();e=Math.floor(r/40)+"."+r%40;for(var n=0;t.length()>0;)r=t.getByte(),n=n<<7,r&128?n+=r&127:(e+="."+(n+r),n=0);return e};N.utcTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(t.substr(2,2),10)-1,i=parseInt(t.substr(4,2),10),o=parseInt(t.substr(6,2),10),s=parseInt(t.substr(8,2),10),a=0;if(t.length>11){var c=t.charAt(10),f=10;c!=="+"&&c!=="-"&&(a=parseInt(t.substr(10,2),10),f+=2)}if(e.setUTCFullYear(r,n,i),e.setUTCHours(o,s,a,0),f&&(c=t.charAt(f),c==="+"||c==="-")){var u=parseInt(t.substr(f+1,2),10),l=parseInt(t.substr(f+4,2),10),p=u*60+l;p*=6e4,c==="+"?e.setTime(+e-p):e.setTime(+e+p)}return e};N.generalizedTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,4),10),n=parseInt(t.substr(4,2),10)-1,i=parseInt(t.substr(6,2),10),o=parseInt(t.substr(8,2),10),s=parseInt(t.substr(10,2),10),a=parseInt(t.substr(12,2),10),c=0,f=0,u=!1;t.charAt(t.length-1)==="Z"&&(u=!0);var l=t.length-5,p=t.charAt(l);if(p==="+"||p==="-"){var d=parseInt(t.substr(l+1,2),10),h=parseInt(t.substr(l+4,2),10);f=d*60+h,f*=6e4,p==="+"&&(f*=-1),u=!0}return t.charAt(14)==="."&&(c=parseFloat(t.substr(14),10)*1e3),u?(e.setUTCFullYear(r,n,i),e.setUTCHours(o,s,a,c),e.setTime(+e+f)):(e.setFullYear(r,n,i),e.setHours(o,s,a,c)),e};N.dateToUtcTime=function(t){if(typeof t=="string")return t;var e="",r=[];r.push((""+t.getUTCFullYear()).substr(2)),r.push(""+(t.getUTCMonth()+1)),r.push(""+t.getUTCDate()),r.push(""+t.getUTCHours()),r.push(""+t.getUTCMinutes()),r.push(""+t.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(e+="0"),e+=r[n];return e+="Z",e};N.dateToGeneralizedTime=function(t){if(typeof t=="string")return t;var e="",r=[];r.push(""+t.getUTCFullYear()),r.push(""+(t.getUTCMonth()+1)),r.push(""+t.getUTCDate()),r.push(""+t.getUTCHours()),r.push(""+t.getUTCMinutes()),r.push(""+t.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(e+="0"),e+=r[n];return e+="Z",e};N.integerToDer=function(t){var e=dt.util.createBuffer();if(t>=-128&&t<128)return e.putSignedInt(t,8);if(t>=-32768&&t<32768)return e.putSignedInt(t,16);if(t>=-8388608&&t<8388608)return e.putSignedInt(t,24);if(t>=-2147483648&&t<2147483648)return e.putSignedInt(t,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=t,r};N.derToInteger=function(t){typeof t=="string"&&(t=dt.util.createBuffer(t));var e=t.length()*8;if(e>32)throw new Error("Integer too large; max is 32-bits.");return t.getSignedInt(e)};N.validate=function(t,e,r,n){var i=!1;if((t.tagClass===e.tagClass||typeof e.tagClass>"u")&&(t.type===e.type||typeof e.type>"u"))if(t.constructed===e.constructed||typeof e.constructed>"u"){if(i=!0,e.value&&dt.util.isArray(e.value))for(var o=0,s=0;i&&s<e.value.length;++s)i=e.value[s].optional||!1,t.value[o]&&(i=N.validate(t.value[o],e.value[s],r,n),i?++o:e.value[s].optional&&(i=!0)),!i&&n&&n.push("["+e.name+'] Tag class "'+e.tagClass+'", type "'+e.type+'" expected value length "'+e.value.length+'", got "'+t.value.length+'"');if(i&&r&&(e.capture&&(r[e.capture]=t.value),e.captureAsn1&&(r[e.captureAsn1]=t),e.captureBitStringContents&&"bitStringContents"in t&&(r[e.captureBitStringContents]=t.bitStringContents),e.captureBitStringValue&&"bitStringContents"in t)){var a;if(t.bitStringContents.length<2)r[e.captureBitStringValue]="";else{var c=t.bitStringContents.charCodeAt(0);if(c!==0)throw new Error("captureBitStringValue only supported for zero unused bits");r[e.captureBitStringValue]=t.bitStringContents.slice(1)}}}else n&&n.push("["+e.name+'] Expected constructed "'+e.constructed+'", got "'+t.constructed+'"');else n&&(t.tagClass!==e.tagClass&&n.push("["+e.name+'] Expected tag class "'+e.tagClass+'", got "'+t.tagClass+'"'),t.type!==e.type&&n.push("["+e.name+'] Expected type "'+e.type+'", got "'+t.type+'"'));return i};var Ia=/[^\\u0000-\\u00ff]/;N.prettyPrint=function(t,e,r){var n="";e=e||0,r=r||2,e>0&&(n+=`
6
6
  `);for(var i="",o=0;o<e*r;++o)i+=" ";switch(n+=i+"Tag: ",t.tagClass){case N.Class.UNIVERSAL:n+="Universal:";break;case N.Class.APPLICATION:n+="Application:";break;case N.Class.CONTEXT_SPECIFIC:n+="Context-Specific:";break;case N.Class.PRIVATE:n+="Private:";break}if(t.tagClass===N.Class.UNIVERSAL)switch(n+=t.type,t.type){case N.Type.NONE:n+=" (None)";break;case N.Type.BOOLEAN:n+=" (Boolean)";break;case N.Type.INTEGER:n+=" (Integer)";break;case N.Type.BITSTRING:n+=" (Bit string)";break;case N.Type.OCTETSTRING:n+=" (Octet string)";break;case N.Type.NULL:n+=" (Null)";break;case N.Type.OID:n+=" (Object Identifier)";break;case N.Type.ODESC:n+=" (Object Descriptor)";break;case N.Type.EXTERNAL:n+=" (External or Instance of)";break;case N.Type.REAL:n+=" (Real)";break;case N.Type.ENUMERATED:n+=" (Enumerated)";break;case N.Type.EMBEDDED:n+=" (Embedded PDV)";break;case N.Type.UTF8:n+=" (UTF8)";break;case N.Type.ROID:n+=" (Relative Object Identifier)";break;case N.Type.SEQUENCE:n+=" (Sequence)";break;case N.Type.SET:n+=" (Set)";break;case N.Type.PRINTABLESTRING:n+=" (Printable String)";break;case N.Type.IA5String:n+=" (IA5String (ASCII))";break;case N.Type.UTCTIME:n+=" (UTC time)";break;case N.Type.GENERALIZEDTIME:n+=" (Generalized time)";break;case N.Type.BMPSTRING:n+=" (BMP String)";break}else n+=t.type;if(n+=`
7
7
  `,n+=i+"Constructed: "+t.constructed+`
8
- `,t.composed){for(var s=0,a="",o=0;o<t.value.length;++o)t.value[o]!==void 0&&(s+=1,a+=N.prettyPrint(t.value[o],e+1,r),o+1<t.value.length&&(a+=","));n+=i+"Sub values: "+s+a}else{if(n+=i+"Value: ",t.type===N.Type.OID){var c=N.derToOid(t.value);n+=c,dt.pki&&dt.pki.oids&&c in dt.pki.oids&&(n+=" ("+dt.pki.oids[c]+") ")}if(t.type===N.Type.INTEGER)try{n+=N.derToInteger(t.value)}catch{n+="0x"+dt.util.bytesToHex(t.value)}else if(t.type===N.Type.BITSTRING){if(t.value.length>1?n+="0x"+dt.util.bytesToHex(t.value.slice(1)):n+="(none)",t.value.length>0){var f=t.value.charCodeAt(0);f==1?n+=" (1 unused bit shown)":f>1&&(n+=" ("+f+" unused bits shown)")}}else if(t.type===N.Type.OCTETSTRING)_a.test(t.value)||(n+="("+t.value+") "),n+="0x"+dt.util.bytesToHex(t.value);else if(t.type===N.Type.UTF8)try{n+=dt.util.decodeUtf8(t.value)}catch(u){if(u.message==="URI malformed")n+="0x"+dt.util.bytesToHex(t.value)+" (malformed UTF8)";else throw u}else t.type===N.Type.PRINTABLESTRING||t.type===N.Type.IA5String?n+=t.value:_a.test(t.value)?n+="0x"+dt.util.bytesToHex(t.value):t.value.length===0?n+="[null]":n+=t.value}return n}});var ao=ft((Sg,La)=>{var _t=ct();Et();La.exports=_t.cipher=_t.cipher||{};_t.cipher.algorithms=_t.cipher.algorithms||{};_t.cipher.createCipher=function(t,e){var r=t;if(typeof r=="string"&&(r=_t.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new _t.cipher.BlockCipher({algorithm:r,key:e,decrypt:!1})};_t.cipher.createDecipher=function(t,e){var r=t;if(typeof r=="string"&&(r=_t.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new _t.cipher.BlockCipher({algorithm:r,key:e,decrypt:!0})};_t.cipher.registerAlgorithm=function(t,e){t=t.toUpperCase(),_t.cipher.algorithms[t]=e};_t.cipher.getAlgorithm=function(t){return t=t.toUpperCase(),t in _t.cipher.algorithms?_t.cipher.algorithms[t]:null};var so=_t.cipher.BlockCipher=function(t){this.algorithm=t.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=t.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=t.decrypt,this.algorithm.initialize(t)};so.prototype.start=function(t){t=t||{};var e={};for(var r in t)e[r]=t[r];e.decrypt=this._decrypt,this._finish=!1,this._input=_t.util.createBuffer(),this.output=t.output||_t.util.createBuffer(),this.mode.start(e)};so.prototype.update=function(t){for(t&&this._input.putBuffer(t);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};so.prototype.finish=function(t){t&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(r){return t(this.blockSize,r,!1)},this.mode.unpad=function(r){return t(this.blockSize,r,!0)});var e={};return e.decrypt=this._decrypt,e.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,e)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,e))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,e))}});var co=ft((Bg,Da)=>{var Rt=ct();Et();Rt.cipher=Rt.cipher||{};var Q=Da.exports=Rt.cipher.modes=Rt.cipher.modes||{};Q.ecb=function(t){t=t||{},this.name="ECB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};Q.ecb.prototype.start=function(t){};Q.ecb.prototype.encrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=t.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n])};Q.ecb.prototype.decrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=t.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n])};Q.ecb.prototype.pad=function(t,e){var r=t.length()===this.blockSize?this.blockSize:this.blockSize-t.length();return t.fillWithByte(r,r),!0};Q.ecb.prototype.unpad=function(t,e){if(e.overflow>0)return!1;var r=t.length(),n=t.at(r-1);return n>this.blockSize<<2?!1:(t.truncate(n),!0)};Q.cbc=function(t){t=t||{},this.name="CBC",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};Q.cbc.prototype.start=function(t){if(t.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in t)this._iv=kn(t.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")};Q.cbc.prototype.encrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^t.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n]);this._prev=this._outBlock};Q.cbc.prototype.decrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=t.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)};Q.cbc.prototype.pad=function(t,e){var r=t.length()===this.blockSize?this.blockSize:this.blockSize-t.length();return t.fillWithByte(r,r),!0};Q.cbc.prototype.unpad=function(t,e){if(e.overflow>0)return!1;var r=t.length(),n=t.at(r-1);return n>this.blockSize<<2?!1:(t.truncate(n),!0)};Q.cfb=function(t){t=t||{},this.name="CFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=Rt.util.createBuffer(),this._partialBytes=0};Q.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=kn(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Q.cfb.prototype.encrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)this._inBlock[i]=t.getInt32()^this._outBlock[i],e.putInt32(this._inBlock[i]);return}var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialBlock[i]=t.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(o>0)t.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};Q.cfb.prototype.decrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)this._inBlock[i]=t.getInt32(),e.putInt32(this._inBlock[i]^this._outBlock[i]);return}var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialBlock[i]=t.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(o>0)t.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};Q.ofb=function(t){t=t||{},this.name="OFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Rt.util.createBuffer(),this._partialBytes=0};Q.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=kn(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Q.ofb.prototype.encrypt=function(t,e,r){var n=t.length();if(t.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)e.putInt32(t.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];return}var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(o>0)t.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};Q.ofb.prototype.decrypt=Q.ofb.prototype.encrypt;Q.ctr=function(t){t=t||{},this.name="CTR",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Rt.util.createBuffer(),this._partialBytes=0};Q.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=kn(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Q.ctr.prototype.encrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize)for(var i=0;i<this._ints;++i)e.putInt32(t.getInt32()^this._outBlock[i]);else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(o>0&&(t.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}Nn(this._inBlock)};Q.ctr.prototype.decrypt=Q.ctr.prototype.encrypt;Q.gcm=function(t){t=t||{},this.name="GCM",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=Rt.util.createBuffer(),this._partialBytes=0,this._R=3774873600};Q.gcm.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");var e=Rt.util.createBuffer(t.iv);this._cipherLength=0;var r;if("additionalData"in t?r=Rt.util.createBuffer(t.additionalData):r=Rt.util.createBuffer(),"tagLength"in t?this._tagLength=t.tagLength:this._tagLength=128,this._tag=null,t.decrypt&&(this._tag=Rt.util.createBuffer(t.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=e.length();if(n===12)this._j0=[e.getInt32(),e.getInt32(),e.getInt32(),1];else{for(this._j0=[0,0,0,0];e.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(fo(n*8)))}this._inBlock=this._j0.slice(0),Nn(this._inBlock),this._partialBytes=0,r=Rt.util.createBuffer(r),this._aDataLength=fo(r.length()*8);var i=r.length()%this.blockSize;for(i&&r.fillWithByte(0,this.blockSize-i),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])};Q.gcm.prototype.encrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)e.putInt32(this._outBlock[i]^=t.getInt32());this._cipherLength+=this.blockSize}else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(o<=0||r){if(r){var s=n%this.blockSize;this._cipherLength+=s,this._partialOutput.truncate(this.blockSize-s)}else this._cipherLength+=this.blockSize;for(var i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.read-=this.blockSize,e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),Nn(this._inBlock)};Q.gcm.prototype.decrypt=function(t,e,r){var n=t.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),Nn(this._inBlock),this._hashBlock[0]=t.getInt32(),this._hashBlock[1]=t.getInt32(),this._hashBlock[2]=t.getInt32(),this._hashBlock[3]=t.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i<this._ints;++i)e.putInt32(this._outBlock[i]^this._hashBlock[i]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize};Q.gcm.prototype.afterFinish=function(t,e){var r=!0;e.decrypt&&e.overflow&&t.truncate(this.blockSize-e.overflow),this.tag=Rt.util.createBuffer();var n=this._aDataLength.concat(fo(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,n);var i=[];this.cipher.encrypt(this._j0,i);for(var o=0;o<this._ints;++o)this.tag.putInt32(this._s[o]^i[o]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),e.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r};Q.gcm.prototype.multiply=function(t,e){for(var r=[0,0,0,0],n=e.slice(0),i=0;i<128;++i){var o=t[i/32|0]&1<<31-i%32;o&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n)}return r};Q.gcm.prototype.pow=function(t,e){for(var r=t[3]&1,n=3;n>0;--n)e[n]=t[n]>>>1|(t[n-1]&1)<<31;e[0]=t[0]>>>1,r&&(e[0]^=this._R)};Q.gcm.prototype.tableMultiply=function(t){for(var e=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,i=t[n]>>>(7-r%8)*4&15,o=this._m[r][i];e[0]^=o[0],e[1]^=o[1],e[2]^=o[2],e[3]^=o[3]}return e};Q.gcm.prototype.ghash=function(t,e,r){return e[0]^=r[0],e[1]^=r[1],e[2]^=r[2],e[3]^=r[3],this.tableMultiply(e)};Q.gcm.prototype.generateHashTable=function(t,e){for(var r=8/e,n=4*r,i=16*r,o=new Array(i),s=0;s<i;++s){var a=[0,0,0,0],c=s/n|0,f=(n-1-s%n)*e;a[c]=1<<e-1<<f,o[s]=this.generateSubHashTable(this.multiply(a,t),e)}return o};Q.gcm.prototype.generateSubHashTable=function(t,e){var r=1<<e,n=r>>>1,i=new Array(r);i[n]=t.slice(0);for(var o=n>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o<n;){for(var s=1;s<o;++s){var a=i[o],c=i[s];i[o+s]=[a[0]^c[0],a[1]^c[1],a[2]^c[2],a[3]^c[3]]}o*=2}for(i[0]=[0,0,0,0],o=n+1;o<r;++o){var f=i[o^n];i[o]=[t[0]^f[0],t[1]^f[1],t[2]^f[2],t[3]^f[3]]}return i};function kn(t,e){if(typeof t=="string"&&(t=Rt.util.createBuffer(t)),Rt.util.isArray(t)&&t.length>4){var r=t;t=Rt.util.createBuffer();for(var n=0;n<r.length;++n)t.putByte(r[n])}if(t.length()<e)throw new Error("Invalid IV length; got "+t.length()+" bytes and expected "+e+" bytes.");if(!Rt.util.isArray(t)){for(var i=[],o=e/4,n=0;n<o;++n)i.push(t.getInt32());t=i}return t}function Nn(t){t[t.length-1]=t[t.length-1]+1&4294967295}function fo(t){return[t/4294967296|0,t&4294967295]}});var po=ft((Ag,Ua)=>{var ht=ct();ao();co();Et();Ua.exports=ht.aes=ht.aes||{};ht.aes.startEncrypting=function(t,e,r,n){var i=Un({key:t,output:r,decrypt:!1,mode:n});return i.start(e),i};ht.aes.createEncryptionCipher=function(t,e){return Un({key:t,output:null,decrypt:!1,mode:e})};ht.aes.startDecrypting=function(t,e,r,n){var i=Un({key:t,output:r,decrypt:!0,mode:n});return i.start(e),i};ht.aes.createDecryptionCipher=function(t,e){return Un({key:t,output:null,decrypt:!0,mode:e})};ht.aes.Algorithm=function(t,e){ho||ka();var r=this;r.name=t,r.mode=new e({blockSize:16,cipher:{encrypt:function(n,i){return lo(r._w,n,i,!1)},decrypt:function(n,i){return lo(r._w,n,i,!0)}}}),r._init=!1};ht.aes.Algorithm.prototype.initialize=function(t){if(!this._init){var e=t.key,r;if(typeof e=="string"&&(e.length===16||e.length===24||e.length===32))e=ht.util.createBuffer(e);else if(ht.util.isArray(e)&&(e.length===16||e.length===24||e.length===32)){r=e,e=ht.util.createBuffer();for(var n=0;n<r.length;++n)e.putByte(r[n])}if(!ht.util.isArray(e)){r=e,e=[];var i=r.length();if(i===16||i===24||i===32){i=i>>>2;for(var n=0;n<i;++n)e.push(r.getInt32())}}if(!ht.util.isArray(e)||!(e.length===4||e.length===6||e.length===8))throw new Error("Invalid key parameter.");var o=this.mode.name,s=["CFB","OFB","CTR","GCM"].indexOf(o)!==-1;this._w=Na(e,t.decrypt&&!s),this._init=!0}};ht.aes._expandKey=function(t,e){return ho||ka(),Na(t,e)};ht.aes._updateBlock=lo;Lr("AES-ECB",ht.cipher.modes.ecb);Lr("AES-CBC",ht.cipher.modes.cbc);Lr("AES-CFB",ht.cipher.modes.cfb);Lr("AES-OFB",ht.cipher.modes.ofb);Lr("AES-CTR",ht.cipher.modes.ctr);Lr("AES-GCM",ht.cipher.modes.gcm);function Lr(t,e){var r=function(){return new ht.aes.Algorithm(t,e)};ht.cipher.registerAlgorithm(t,r)}var ho=!1,Rr=4,Ht,uo,Pa,ar,re;function ka(){ho=!0,Pa=[0,1,2,4,8,16,32,64,128,27,54];for(var t=new Array(256),e=0;e<128;++e)t[e]=e<<1,t[e+128]=e+128<<1^283;Ht=new Array(256),uo=new Array(256),ar=new Array(4),re=new Array(4);for(var e=0;e<4;++e)ar[e]=new Array(256),re[e]=new Array(256);for(var r=0,n=0,i,o,s,a,c,f,u,e=0;e<256;++e){a=n^n<<1^n<<2^n<<3^n<<4,a=a>>8^a&255^99,Ht[r]=a,uo[a]=r,c=t[a],i=t[r],o=t[i],s=t[o],f=c<<24^a<<16^a<<8^(a^c),u=(i^o^s)<<24^(r^s)<<16^(r^o^s)<<8^(r^i^s);for(var l=0;l<4;++l)ar[l][r]=f,re[l][a]=u,f=f<<24|f>>>8,u=u<<24|u>>>8;r===0?r=n=1:(r=i^t[t[t[i^s]]],n^=t[t[n]])}}function Na(t,e){for(var r=t.slice(0),n,i=1,o=r.length,s=o+6+1,a=Rr*s,c=o;c<a;++c)n=r[c-1],c%o===0?(n=Ht[n>>>16&255]<<24^Ht[n>>>8&255]<<16^Ht[n&255]<<8^Ht[n>>>24]^Pa[i]<<24,i++):o>6&&c%o===4&&(n=Ht[n>>>24]<<24^Ht[n>>>16&255]<<16^Ht[n>>>8&255]<<8^Ht[n&255]),r[c]=r[c-o]^n;if(e){var f,u=re[0],l=re[1],p=re[2],d=re[3],h=r.slice(0);a=r.length;for(var c=0,y=a-Rr;c<a;c+=Rr,y-=Rr)if(c===0||c===a-Rr)h[c]=r[y],h[c+1]=r[y+3],h[c+2]=r[y+2],h[c+3]=r[y+1];else for(var g=0;g<Rr;++g)f=r[y+g],h[c+(3&-g)]=u[Ht[f>>>24]]^l[Ht[f>>>16&255]]^p[Ht[f>>>8&255]]^d[Ht[f&255]];r=h}return r}function lo(t,e,r,n){var i=t.length/4-1,o,s,a,c,f;n?(o=re[0],s=re[1],a=re[2],c=re[3],f=uo):(o=ar[0],s=ar[1],a=ar[2],c=ar[3],f=Ht);var u,l,p,d,h,y,g;u=e[0]^t[0],l=e[n?3:1]^t[1],p=e[2]^t[2],d=e[n?1:3]^t[3];for(var x=3,m=1;m<i;++m)h=o[u>>>24]^s[l>>>16&255]^a[p>>>8&255]^c[d&255]^t[++x],y=o[l>>>24]^s[p>>>16&255]^a[d>>>8&255]^c[u&255]^t[++x],g=o[p>>>24]^s[d>>>16&255]^a[u>>>8&255]^c[l&255]^t[++x],d=o[d>>>24]^s[u>>>16&255]^a[l>>>8&255]^c[p&255]^t[++x],u=h,l=y,p=g;r[0]=f[u>>>24]<<24^f[l>>>16&255]<<16^f[p>>>8&255]<<8^f[d&255]^t[++x],r[n?3:1]=f[l>>>24]<<24^f[p>>>16&255]<<16^f[d>>>8&255]<<8^f[u&255]^t[++x],r[2]=f[p>>>24]<<24^f[d>>>16&255]<<16^f[u>>>8&255]<<8^f[l&255]^t[++x],r[n?1:3]=f[d>>>24]<<24^f[u>>>16&255]<<16^f[l>>>8&255]<<8^f[p&255]^t[++x]}function Un(t){t=t||{};var e=(t.mode||"CBC").toUpperCase(),r="AES-"+e,n;t.decrypt?n=ht.cipher.createDecipher(r,t.key):n=ht.cipher.createCipher(r,t.key);var i=n.start;return n.start=function(o,s){var a=null;s instanceof ht.util.ByteBuffer&&(a=s,s={}),s=s||{},s.output=a,s.iv=o,i.call(n,s)},n}});var Fa=ft((Ig,Ka)=>{var yt=ct();ao();co();Et();Ka.exports=yt.des=yt.des||{};yt.des.startEncrypting=function(t,e,r,n){var i=On({key:t,output:r,decrypt:!1,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};yt.des.createEncryptionCipher=function(t,e){return On({key:t,output:null,decrypt:!1,mode:e})};yt.des.startDecrypting=function(t,e,r,n){var i=On({key:t,output:r,decrypt:!0,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};yt.des.createDecryptionCipher=function(t,e){return On({key:t,output:null,decrypt:!0,mode:e})};yt.des.Algorithm=function(t,e){var r=this;r.name=t,r.mode=new e({blockSize:8,cipher:{encrypt:function(n,i){return Oa(r._keys,n,i,!1)},decrypt:function(n,i){return Oa(r._keys,n,i,!0)}}}),r._init=!1};yt.des.Algorithm.prototype.initialize=function(t){if(!this._init){var e=yt.util.createBuffer(t.key);if(this.name.indexOf("3DES")===0&&e.length()!==24)throw new Error("Invalid Triple-DES key size: "+e.length()*8);this._keys=Al(e),this._init=!0}};ge("DES-ECB",yt.cipher.modes.ecb);ge("DES-CBC",yt.cipher.modes.cbc);ge("DES-CFB",yt.cipher.modes.cfb);ge("DES-OFB",yt.cipher.modes.ofb);ge("DES-CTR",yt.cipher.modes.ctr);ge("3DES-ECB",yt.cipher.modes.ecb);ge("3DES-CBC",yt.cipher.modes.cbc);ge("3DES-CFB",yt.cipher.modes.cfb);ge("3DES-OFB",yt.cipher.modes.ofb);ge("3DES-CTR",yt.cipher.modes.ctr);function ge(t,e){var r=function(){return new yt.des.Algorithm(t,e)};yt.cipher.registerAlgorithm(t,r)}var xl=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],ml=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],vl=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],bl=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],wl=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],El=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],Sl=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],Bl=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function Al(t){for(var e=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],r=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],o=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],s=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],a=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],c=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],f=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],u=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],l=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],d=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],h=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=t.length()>8?3:1,g=[],x=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],m=0,b,_=0;_<y;_++){var E=t.getInt32(),S=t.getInt32();b=(E>>>4^S)&252645135,S^=b,E^=b<<4,b=(S>>>-16^E)&65535,E^=b,S^=b<<-16,b=(E>>>2^S)&858993459,S^=b,E^=b<<2,b=(S>>>-16^E)&65535,E^=b,S^=b<<-16,b=(E>>>1^S)&1431655765,S^=b,E^=b<<1,b=(S>>>8^E)&16711935,E^=b,S^=b<<8,b=(E>>>1^S)&1431655765,S^=b,E^=b<<1,b=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=b;for(var L=0;L<x.length;++L){x[L]?(E=E<<2|E>>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var D=e[E>>>28]|r[E>>>24&15]|n[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|s[E>>>8&15]|a[E>>>4&15],H=c[S>>>28]|f[S>>>24&15]|u[S>>>20&15]|l[S>>>16&15]|p[S>>>12&15]|d[S>>>8&15]|h[S>>>4&15];b=(H>>>16^D)&65535,g[m++]=D^b,g[m++]=H^b<<16}}return g}function Oa(t,e,r,n){var i=t.length===32?3:9,o;i===3?o=n?[30,-2,-2]:[0,32,2]:o=n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var s,a=e[0],c=e[1];s=(a>>>4^c)&252645135,c^=s,a^=s<<4,s=(a>>>16^c)&65535,c^=s,a^=s<<16,s=(c>>>2^a)&858993459,a^=s,c^=s<<2,s=(c>>>8^a)&16711935,a^=s,c^=s<<8,s=(a>>>1^c)&1431655765,c^=s,a^=s<<1,a=a<<1|a>>>31,c=c<<1|c>>>31;for(var f=0;f<i;f+=3){for(var u=o[f+1],l=o[f+2],p=o[f];p!=u;p+=l){var d=c^t[p],h=(c>>>4|c<<28)^t[p+1];s=a,a=c,c=s^(ml[d>>>24&63]|bl[d>>>16&63]|El[d>>>8&63]|Bl[d&63]|xl[h>>>24&63]|vl[h>>>16&63]|wl[h>>>8&63]|Sl[h&63])}s=a,a=c,c=s}a=a>>>1|a<<31,c=c>>>1|c<<31,s=(a>>>1^c)&1431655765,c^=s,a^=s<<1,s=(c>>>8^a)&16711935,a^=s,c^=s<<8,s=(c>>>2^a)&858993459,a^=s,c^=s<<2,s=(a>>>16^c)&65535,c^=s,a^=s<<16,s=(a>>>4^c)&252645135,c^=s,a^=s<<4,r[0]=a,r[1]=c}function On(t){t=t||{};var e=(t.mode||"CBC").toUpperCase(),r="DES-"+e,n;t.decrypt?n=yt.cipher.createDecipher(r,t.key):n=yt.cipher.createCipher(r,t.key);var i=n.start;return n.start=function(o,s){var a=null;s instanceof yt.util.ByteBuffer&&(a=s,s={}),s=s||{},s.output=a,s.iv=o,i.call(n,s)},n}});var fr=ft((Tg,Ma)=>{var Kn=ct();Ma.exports=Kn.md=Kn.md||{};Kn.md.algorithms=Kn.md.algorithms||{}});var qa=ft((Cg,Va)=>{var Ie=ct();fr();Et();var Il=Va.exports=Ie.hmac=Ie.hmac||{};Il.create=function(){var t=null,e=null,r=null,n=null,i={};return i.start=function(o,s){if(o!==null)if(typeof o=="string")if(o=o.toLowerCase(),o in Ie.md.algorithms)e=Ie.md.algorithms[o].create();else throw new Error('Unknown hash algorithm "'+o+'"');else e=o;if(s===null)s=t;else{if(typeof s=="string")s=Ie.util.createBuffer(s);else if(Ie.util.isArray(s)){var a=s;s=Ie.util.createBuffer();for(var c=0;c<a.length;++c)s.putByte(a[c])}var f=s.length();f>e.blockLength&&(e.start(),e.update(s.bytes()),s=e.digest()),r=Ie.util.createBuffer(),n=Ie.util.createBuffer(),f=s.length();for(var c=0;c<f;++c){var a=s.at(c);r.putByte(54^a),n.putByte(92^a)}if(f<e.blockLength)for(var a=e.blockLength-f,c=0;c<a;++c)r.putByte(54),n.putByte(92);t=s,r=r.bytes(),n=n.bytes()}e.start(),e.update(r)},i.update=function(o){e.update(o)},i.getMac=function(){var o=e.digest().bytes();return e.start(),e.update(n),e.update(o),e.digest()},i.digest=i.getMac,i}});var Fn=ft(()=>{});var za=ft((Lg,Ha)=>{var zt=ct();qa();fr();Et();var Tl=zt.pkcs5=zt.pkcs5||{},Te;zt.util.isNodejs&&!zt.options.usePureJavaScript&&(Te=Fn());Ha.exports=zt.pbkdf2=Tl.pbkdf2=function(t,e,r,n,i,o){if(typeof i=="function"&&(o=i,i=null),zt.util.isNodejs&&!zt.options.usePureJavaScript&&Te.pbkdf2&&(i===null||typeof i!="object")&&(Te.pbkdf2Sync.length>4||!i||i==="sha1"))return typeof i!="string"&&(i="sha1"),t=Buffer.from(t,"binary"),e=Buffer.from(e,"binary"),o?Te.pbkdf2Sync.length===4?Te.pbkdf2(t,e,r,n,function(b,_){if(b)return o(b);o(null,_.toString("binary"))}):Te.pbkdf2(t,e,r,n,i,function(b,_){if(b)return o(b);o(null,_.toString("binary"))}):Te.pbkdf2Sync.length===4?Te.pbkdf2Sync(t,e,r,n).toString("binary"):Te.pbkdf2Sync(t,e,r,n,i).toString("binary");if((typeof i>"u"||i===null)&&(i="sha1"),typeof i=="string"){if(!(i in zt.md.algorithms))throw new Error("Unknown hash algorithm: "+i);i=zt.md[i].create()}var s=i.digestLength;if(n>4294967295*s){var a=new Error("Derived key is too long.");if(o)return o(a);throw a}var c=Math.ceil(n/s),f=n-(c-1)*s,u=zt.hmac.create();u.start(i,t);var l="",p,d,h;if(!o){for(var y=1;y<=c;++y){u.start(null,null),u.update(e),u.update(zt.util.int32ToBytes(y)),p=h=u.digest().getBytes();for(var g=2;g<=r;++g)u.start(null,null),u.update(h),d=u.digest().getBytes(),p=zt.util.xorBytes(p,d,s),h=d;l+=y<c?p:p.substr(0,f)}return l}var y=1,g;function x(){if(y>c)return o(null,l);u.start(null,null),u.update(e),u.update(zt.util.int32ToBytes(y)),p=h=u.digest().getBytes(),g=2,m()}function m(){if(g<=r)return u.start(null,null),u.update(h),d=u.digest().getBytes(),p=zt.util.xorBytes(p,d,s),h=d,++g,zt.util.setImmediate(m);l+=y<c?p:p.substr(0,f),++y,x()}x()}});var Wa=ft((Dg,Ga)=>{var Vn=ct();Et();var $a=Ga.exports=Vn.pem=Vn.pem||{};$a.encode=function(t,e){e=e||{};var r="-----BEGIN "+t.type+`-----\r
9
- `,n;if(t.procType&&(n={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]},r+=Mn(n)),t.contentDomain&&(n={name:"Content-Domain",values:[t.contentDomain]},r+=Mn(n)),t.dekInfo&&(n={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&n.values.push(t.dekInfo.parameters),r+=Mn(n)),t.headers)for(var i=0;i<t.headers.length;++i)r+=Mn(t.headers[i]);return t.procType&&(r+=`\r
10
- `),r+=Vn.util.encode64(t.body,e.maxline||64)+`\r
8
+ `,t.composed){for(var s=0,a="",o=0;o<t.value.length;++o)t.value[o]!==void 0&&(s+=1,a+=N.prettyPrint(t.value[o],e+1,r),o+1<t.value.length&&(a+=","));n+=i+"Sub values: "+s+a}else{if(n+=i+"Value: ",t.type===N.Type.OID){var c=N.derToOid(t.value);n+=c,dt.pki&&dt.pki.oids&&c in dt.pki.oids&&(n+=" ("+dt.pki.oids[c]+") ")}if(t.type===N.Type.INTEGER)try{n+=N.derToInteger(t.value)}catch{n+="0x"+dt.util.bytesToHex(t.value)}else if(t.type===N.Type.BITSTRING){if(t.value.length>1?n+="0x"+dt.util.bytesToHex(t.value.slice(1)):n+="(none)",t.value.length>0){var f=t.value.charCodeAt(0);f==1?n+=" (1 unused bit shown)":f>1&&(n+=" ("+f+" unused bits shown)")}}else if(t.type===N.Type.OCTETSTRING)Ia.test(t.value)||(n+="("+t.value+") "),n+="0x"+dt.util.bytesToHex(t.value);else if(t.type===N.Type.UTF8)try{n+=dt.util.decodeUtf8(t.value)}catch(u){if(u.message==="URI malformed")n+="0x"+dt.util.bytesToHex(t.value)+" (malformed UTF8)";else throw u}else t.type===N.Type.PRINTABLESTRING||t.type===N.Type.IA5String?n+=t.value:Ia.test(t.value)?n+="0x"+dt.util.bytesToHex(t.value):t.value.length===0?n+="[null]":n+=t.value}return n}});var oo=ft((xg,Ca)=>{var Rt=ct();Et();Ca.exports=Rt.cipher=Rt.cipher||{};Rt.cipher.algorithms=Rt.cipher.algorithms||{};Rt.cipher.createCipher=function(t,e){var r=t;if(typeof r=="string"&&(r=Rt.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new Rt.cipher.BlockCipher({algorithm:r,key:e,decrypt:!1})};Rt.cipher.createDecipher=function(t,e){var r=t;if(typeof r=="string"&&(r=Rt.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new Rt.cipher.BlockCipher({algorithm:r,key:e,decrypt:!0})};Rt.cipher.registerAlgorithm=function(t,e){t=t.toUpperCase(),Rt.cipher.algorithms[t]=e};Rt.cipher.getAlgorithm=function(t){return t=t.toUpperCase(),t in Rt.cipher.algorithms?Rt.cipher.algorithms[t]:null};var io=Rt.cipher.BlockCipher=function(t){this.algorithm=t.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=t.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=t.decrypt,this.algorithm.initialize(t)};io.prototype.start=function(t){t=t||{};var e={};for(var r in t)e[r]=t[r];e.decrypt=this._decrypt,this._finish=!1,this._input=Rt.util.createBuffer(),this.output=t.output||Rt.util.createBuffer(),this.mode.start(e)};io.prototype.update=function(t){for(t&&this._input.putBuffer(t);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};io.prototype.finish=function(t){t&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(r){return t(this.blockSize,r,!1)},this.mode.unpad=function(r){return t(this.blockSize,r,!0)});var e={};return e.decrypt=this._decrypt,e.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,e)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,e))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,e))}});var ao=ft((mg,_a)=>{var Lt=ct();Et();Lt.cipher=Lt.cipher||{};var Q=_a.exports=Lt.cipher.modes=Lt.cipher.modes||{};Q.ecb=function(t){t=t||{},this.name="ECB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};Q.ecb.prototype.start=function(t){};Q.ecb.prototype.encrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=t.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n])};Q.ecb.prototype.decrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=t.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n])};Q.ecb.prototype.pad=function(t,e){var r=t.length()===this.blockSize?this.blockSize:this.blockSize-t.length();return t.fillWithByte(r,r),!0};Q.ecb.prototype.unpad=function(t,e){if(e.overflow>0)return!1;var r=t.length(),n=t.at(r-1);return n>this.blockSize<<2?!1:(t.truncate(n),!0)};Q.cbc=function(t){t=t||{},this.name="CBC",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};Q.cbc.prototype.start=function(t){if(t.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in t)this._iv=Dn(t.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")};Q.cbc.prototype.encrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^t.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n]);this._prev=this._outBlock};Q.cbc.prototype.decrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=t.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)};Q.cbc.prototype.pad=function(t,e){var r=t.length()===this.blockSize?this.blockSize:this.blockSize-t.length();return t.fillWithByte(r,r),!0};Q.cbc.prototype.unpad=function(t,e){if(e.overflow>0)return!1;var r=t.length(),n=t.at(r-1);return n>this.blockSize<<2?!1:(t.truncate(n),!0)};Q.cfb=function(t){t=t||{},this.name="CFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=Lt.util.createBuffer(),this._partialBytes=0};Q.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=Dn(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Q.cfb.prototype.encrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)this._inBlock[i]=t.getInt32()^this._outBlock[i],e.putInt32(this._inBlock[i]);return}var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialBlock[i]=t.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(o>0)t.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};Q.cfb.prototype.decrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)this._inBlock[i]=t.getInt32(),e.putInt32(this._inBlock[i]^this._outBlock[i]);return}var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialBlock[i]=t.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(o>0)t.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};Q.ofb=function(t){t=t||{},this.name="OFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Lt.util.createBuffer(),this._partialBytes=0};Q.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=Dn(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Q.ofb.prototype.encrypt=function(t,e,r){var n=t.length();if(t.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)e.putInt32(t.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];return}var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(o>0)t.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};Q.ofb.prototype.decrypt=Q.ofb.prototype.encrypt;Q.ctr=function(t){t=t||{},this.name="CTR",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Lt.util.createBuffer(),this._partialBytes=0};Q.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=Dn(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Q.ctr.prototype.encrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize)for(var i=0;i<this._ints;++i)e.putInt32(t.getInt32()^this._outBlock[i]);else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(o>0&&(t.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}Pn(this._inBlock)};Q.ctr.prototype.decrypt=Q.ctr.prototype.encrypt;Q.gcm=function(t){t=t||{},this.name="GCM",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=Lt.util.createBuffer(),this._partialBytes=0,this._R=3774873600};Q.gcm.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");var e=Lt.util.createBuffer(t.iv);this._cipherLength=0;var r;if("additionalData"in t?r=Lt.util.createBuffer(t.additionalData):r=Lt.util.createBuffer(),"tagLength"in t?this._tagLength=t.tagLength:this._tagLength=128,this._tag=null,t.decrypt&&(this._tag=Lt.util.createBuffer(t.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=e.length();if(n===12)this._j0=[e.getInt32(),e.getInt32(),e.getInt32(),1];else{for(this._j0=[0,0,0,0];e.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(so(n*8)))}this._inBlock=this._j0.slice(0),Pn(this._inBlock),this._partialBytes=0,r=Lt.util.createBuffer(r),this._aDataLength=so(r.length()*8);var i=r.length()%this.blockSize;for(i&&r.fillWithByte(0,this.blockSize-i),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])};Q.gcm.prototype.encrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)e.putInt32(this._outBlock[i]^=t.getInt32());this._cipherLength+=this.blockSize}else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(o<=0||r){if(r){var s=n%this.blockSize;this._cipherLength+=s,this._partialOutput.truncate(this.blockSize-s)}else this._cipherLength+=this.blockSize;for(var i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.read-=this.blockSize,e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),Pn(this._inBlock)};Q.gcm.prototype.decrypt=function(t,e,r){var n=t.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),Pn(this._inBlock),this._hashBlock[0]=t.getInt32(),this._hashBlock[1]=t.getInt32(),this._hashBlock[2]=t.getInt32(),this._hashBlock[3]=t.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i<this._ints;++i)e.putInt32(this._outBlock[i]^this._hashBlock[i]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize};Q.gcm.prototype.afterFinish=function(t,e){var r=!0;e.decrypt&&e.overflow&&t.truncate(this.blockSize-e.overflow),this.tag=Lt.util.createBuffer();var n=this._aDataLength.concat(so(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,n);var i=[];this.cipher.encrypt(this._j0,i);for(var o=0;o<this._ints;++o)this.tag.putInt32(this._s[o]^i[o]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),e.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r};Q.gcm.prototype.multiply=function(t,e){for(var r=[0,0,0,0],n=e.slice(0),i=0;i<128;++i){var o=t[i/32|0]&1<<31-i%32;o&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n)}return r};Q.gcm.prototype.pow=function(t,e){for(var r=t[3]&1,n=3;n>0;--n)e[n]=t[n]>>>1|(t[n-1]&1)<<31;e[0]=t[0]>>>1,r&&(e[0]^=this._R)};Q.gcm.prototype.tableMultiply=function(t){for(var e=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,i=t[n]>>>(7-r%8)*4&15,o=this._m[r][i];e[0]^=o[0],e[1]^=o[1],e[2]^=o[2],e[3]^=o[3]}return e};Q.gcm.prototype.ghash=function(t,e,r){return e[0]^=r[0],e[1]^=r[1],e[2]^=r[2],e[3]^=r[3],this.tableMultiply(e)};Q.gcm.prototype.generateHashTable=function(t,e){for(var r=8/e,n=4*r,i=16*r,o=new Array(i),s=0;s<i;++s){var a=[0,0,0,0],c=s/n|0,f=(n-1-s%n)*e;a[c]=1<<e-1<<f,o[s]=this.generateSubHashTable(this.multiply(a,t),e)}return o};Q.gcm.prototype.generateSubHashTable=function(t,e){var r=1<<e,n=r>>>1,i=new Array(r);i[n]=t.slice(0);for(var o=n>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o<n;){for(var s=1;s<o;++s){var a=i[o],c=i[s];i[o+s]=[a[0]^c[0],a[1]^c[1],a[2]^c[2],a[3]^c[3]]}o*=2}for(i[0]=[0,0,0,0],o=n+1;o<r;++o){var f=i[o^n];i[o]=[t[0]^f[0],t[1]^f[1],t[2]^f[2],t[3]^f[3]]}return i};function Dn(t,e){if(typeof t=="string"&&(t=Lt.util.createBuffer(t)),Lt.util.isArray(t)&&t.length>4){var r=t;t=Lt.util.createBuffer();for(var n=0;n<r.length;++n)t.putByte(r[n])}if(t.length()<e)throw new Error("Invalid IV length; got "+t.length()+" bytes and expected "+e+" bytes.");if(!Lt.util.isArray(t)){for(var i=[],o=e/4,n=0;n<o;++n)i.push(t.getInt32());t=i}return t}function Pn(t){t[t.length-1]=t[t.length-1]+1&4294967295}function so(t){return[t/4294967296|0,t&4294967295]}});var lo=ft((vg,Pa)=>{var ht=ct();oo();ao();Et();Pa.exports=ht.aes=ht.aes||{};ht.aes.startEncrypting=function(t,e,r,n){var i=kn({key:t,output:r,decrypt:!1,mode:n});return i.start(e),i};ht.aes.createEncryptionCipher=function(t,e){return kn({key:t,output:null,decrypt:!1,mode:e})};ht.aes.startDecrypting=function(t,e,r,n){var i=kn({key:t,output:r,decrypt:!0,mode:n});return i.start(e),i};ht.aes.createDecryptionCipher=function(t,e){return kn({key:t,output:null,decrypt:!0,mode:e})};ht.aes.Algorithm=function(t,e){uo||La();var r=this;r.name=t,r.mode=new e({blockSize:16,cipher:{encrypt:function(n,i){return co(r._w,n,i,!1)},decrypt:function(n,i){return co(r._w,n,i,!0)}}}),r._init=!1};ht.aes.Algorithm.prototype.initialize=function(t){if(!this._init){var e=t.key,r;if(typeof e=="string"&&(e.length===16||e.length===24||e.length===32))e=ht.util.createBuffer(e);else if(ht.util.isArray(e)&&(e.length===16||e.length===24||e.length===32)){r=e,e=ht.util.createBuffer();for(var n=0;n<r.length;++n)e.putByte(r[n])}if(!ht.util.isArray(e)){r=e,e=[];var i=r.length();if(i===16||i===24||i===32){i=i>>>2;for(var n=0;n<i;++n)e.push(r.getInt32())}}if(!ht.util.isArray(e)||!(e.length===4||e.length===6||e.length===8))throw new Error("Invalid key parameter.");var o=this.mode.name,s=["CFB","OFB","CTR","GCM"].indexOf(o)!==-1;this._w=Da(e,t.decrypt&&!s),this._init=!0}};ht.aes._expandKey=function(t,e){return uo||La(),Da(t,e)};ht.aes._updateBlock=co;Lr("AES-ECB",ht.cipher.modes.ecb);Lr("AES-CBC",ht.cipher.modes.cbc);Lr("AES-CFB",ht.cipher.modes.cfb);Lr("AES-OFB",ht.cipher.modes.ofb);Lr("AES-CTR",ht.cipher.modes.ctr);Lr("AES-GCM",ht.cipher.modes.gcm);function Lr(t,e){var r=function(){return new ht.aes.Algorithm(t,e)};ht.cipher.registerAlgorithm(t,r)}var uo=!1,Rr=4,Ht,fo,Ra,fr,ne;function La(){uo=!0,Ra=[0,1,2,4,8,16,32,64,128,27,54];for(var t=new Array(256),e=0;e<128;++e)t[e]=e<<1,t[e+128]=e+128<<1^283;Ht=new Array(256),fo=new Array(256),fr=new Array(4),ne=new Array(4);for(var e=0;e<4;++e)fr[e]=new Array(256),ne[e]=new Array(256);for(var r=0,n=0,i,o,s,a,c,f,u,e=0;e<256;++e){a=n^n<<1^n<<2^n<<3^n<<4,a=a>>8^a&255^99,Ht[r]=a,fo[a]=r,c=t[a],i=t[r],o=t[i],s=t[o],f=c<<24^a<<16^a<<8^(a^c),u=(i^o^s)<<24^(r^s)<<16^(r^o^s)<<8^(r^i^s);for(var l=0;l<4;++l)fr[l][r]=f,ne[l][a]=u,f=f<<24|f>>>8,u=u<<24|u>>>8;r===0?r=n=1:(r=i^t[t[t[i^s]]],n^=t[t[n]])}}function Da(t,e){for(var r=t.slice(0),n,i=1,o=r.length,s=o+6+1,a=Rr*s,c=o;c<a;++c)n=r[c-1],c%o===0?(n=Ht[n>>>16&255]<<24^Ht[n>>>8&255]<<16^Ht[n&255]<<8^Ht[n>>>24]^Ra[i]<<24,i++):o>6&&c%o===4&&(n=Ht[n>>>24]<<24^Ht[n>>>16&255]<<16^Ht[n>>>8&255]<<8^Ht[n&255]),r[c]=r[c-o]^n;if(e){var f,u=ne[0],l=ne[1],p=ne[2],d=ne[3],h=r.slice(0);a=r.length;for(var c=0,y=a-Rr;c<a;c+=Rr,y-=Rr)if(c===0||c===a-Rr)h[c]=r[y],h[c+1]=r[y+3],h[c+2]=r[y+2],h[c+3]=r[y+1];else for(var g=0;g<Rr;++g)f=r[y+g],h[c+(3&-g)]=u[Ht[f>>>24]]^l[Ht[f>>>16&255]]^p[Ht[f>>>8&255]]^d[Ht[f&255]];r=h}return r}function co(t,e,r,n){var i=t.length/4-1,o,s,a,c,f;n?(o=ne[0],s=ne[1],a=ne[2],c=ne[3],f=fo):(o=fr[0],s=fr[1],a=fr[2],c=fr[3],f=Ht);var u,l,p,d,h,y,g;u=e[0]^t[0],l=e[n?3:1]^t[1],p=e[2]^t[2],d=e[n?1:3]^t[3];for(var x=3,m=1;m<i;++m)h=o[u>>>24]^s[l>>>16&255]^a[p>>>8&255]^c[d&255]^t[++x],y=o[l>>>24]^s[p>>>16&255]^a[d>>>8&255]^c[u&255]^t[++x],g=o[p>>>24]^s[d>>>16&255]^a[u>>>8&255]^c[l&255]^t[++x],d=o[d>>>24]^s[u>>>16&255]^a[l>>>8&255]^c[p&255]^t[++x],u=h,l=y,p=g;r[0]=f[u>>>24]<<24^f[l>>>16&255]<<16^f[p>>>8&255]<<8^f[d&255]^t[++x],r[n?3:1]=f[l>>>24]<<24^f[p>>>16&255]<<16^f[d>>>8&255]<<8^f[u&255]^t[++x],r[2]=f[p>>>24]<<24^f[d>>>16&255]<<16^f[u>>>8&255]<<8^f[l&255]^t[++x],r[n?1:3]=f[d>>>24]<<24^f[u>>>16&255]<<16^f[l>>>8&255]<<8^f[p&255]^t[++x]}function kn(t){t=t||{};var e=(t.mode||"CBC").toUpperCase(),r="AES-"+e,n;t.decrypt?n=ht.cipher.createDecipher(r,t.key):n=ht.cipher.createCipher(r,t.key);var i=n.start;return n.start=function(o,s){var a=null;s instanceof ht.util.ByteBuffer&&(a=s,s={}),s=s||{},s.output=a,s.iv=o,i.call(n,s)},n}});var Ua=ft((bg,Na)=>{var yt=ct();oo();ao();Et();Na.exports=yt.des=yt.des||{};yt.des.startEncrypting=function(t,e,r,n){var i=Nn({key:t,output:r,decrypt:!1,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};yt.des.createEncryptionCipher=function(t,e){return Nn({key:t,output:null,decrypt:!1,mode:e})};yt.des.startDecrypting=function(t,e,r,n){var i=Nn({key:t,output:r,decrypt:!0,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};yt.des.createDecryptionCipher=function(t,e){return Nn({key:t,output:null,decrypt:!0,mode:e})};yt.des.Algorithm=function(t,e){var r=this;r.name=t,r.mode=new e({blockSize:8,cipher:{encrypt:function(n,i){return ka(r._keys,n,i,!1)},decrypt:function(n,i){return ka(r._keys,n,i,!0)}}}),r._init=!1};yt.des.Algorithm.prototype.initialize=function(t){if(!this._init){var e=yt.util.createBuffer(t.key);if(this.name.indexOf("3DES")===0&&e.length()!==24)throw new Error("Invalid Triple-DES key size: "+e.length()*8);this._keys=vl(e),this._init=!0}};ge("DES-ECB",yt.cipher.modes.ecb);ge("DES-CBC",yt.cipher.modes.cbc);ge("DES-CFB",yt.cipher.modes.cfb);ge("DES-OFB",yt.cipher.modes.ofb);ge("DES-CTR",yt.cipher.modes.ctr);ge("3DES-ECB",yt.cipher.modes.ecb);ge("3DES-CBC",yt.cipher.modes.cbc);ge("3DES-CFB",yt.cipher.modes.cfb);ge("3DES-OFB",yt.cipher.modes.ofb);ge("3DES-CTR",yt.cipher.modes.ctr);function ge(t,e){var r=function(){return new yt.des.Algorithm(t,e)};yt.cipher.registerAlgorithm(t,r)}var ll=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],hl=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],dl=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],pl=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],yl=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],gl=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],xl=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],ml=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function vl(t){for(var e=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],r=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],o=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],s=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],a=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],c=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],f=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],u=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],l=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],d=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],h=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=t.length()>8?3:1,g=[],x=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],m=0,b,_=0;_<y;_++){var E=t.getInt32(),S=t.getInt32();b=(E>>>4^S)&252645135,S^=b,E^=b<<4,b=(S>>>-16^E)&65535,E^=b,S^=b<<-16,b=(E>>>2^S)&858993459,S^=b,E^=b<<2,b=(S>>>-16^E)&65535,E^=b,S^=b<<-16,b=(E>>>1^S)&1431655765,S^=b,E^=b<<1,b=(S>>>8^E)&16711935,E^=b,S^=b<<8,b=(E>>>1^S)&1431655765,S^=b,E^=b<<1,b=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=b;for(var L=0;L<x.length;++L){x[L]?(E=E<<2|E>>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var D=e[E>>>28]|r[E>>>24&15]|n[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|s[E>>>8&15]|a[E>>>4&15],z=c[S>>>28]|f[S>>>24&15]|u[S>>>20&15]|l[S>>>16&15]|p[S>>>12&15]|d[S>>>8&15]|h[S>>>4&15];b=(z>>>16^D)&65535,g[m++]=D^b,g[m++]=z^b<<16}}return g}function ka(t,e,r,n){var i=t.length===32?3:9,o;i===3?o=n?[30,-2,-2]:[0,32,2]:o=n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var s,a=e[0],c=e[1];s=(a>>>4^c)&252645135,c^=s,a^=s<<4,s=(a>>>16^c)&65535,c^=s,a^=s<<16,s=(c>>>2^a)&858993459,a^=s,c^=s<<2,s=(c>>>8^a)&16711935,a^=s,c^=s<<8,s=(a>>>1^c)&1431655765,c^=s,a^=s<<1,a=a<<1|a>>>31,c=c<<1|c>>>31;for(var f=0;f<i;f+=3){for(var u=o[f+1],l=o[f+2],p=o[f];p!=u;p+=l){var d=c^t[p],h=(c>>>4|c<<28)^t[p+1];s=a,a=c,c=s^(hl[d>>>24&63]|pl[d>>>16&63]|gl[d>>>8&63]|ml[d&63]|ll[h>>>24&63]|dl[h>>>16&63]|yl[h>>>8&63]|xl[h&63])}s=a,a=c,c=s}a=a>>>1|a<<31,c=c>>>1|c<<31,s=(a>>>1^c)&1431655765,c^=s,a^=s<<1,s=(c>>>8^a)&16711935,a^=s,c^=s<<8,s=(c>>>2^a)&858993459,a^=s,c^=s<<2,s=(a>>>16^c)&65535,c^=s,a^=s<<16,s=(a>>>4^c)&252645135,c^=s,a^=s<<4,r[0]=a,r[1]=c}function Nn(t){t=t||{};var e=(t.mode||"CBC").toUpperCase(),r="DES-"+e,n;t.decrypt?n=yt.cipher.createDecipher(r,t.key):n=yt.cipher.createCipher(r,t.key);var i=n.start;return n.start=function(o,s){var a=null;s instanceof yt.util.ByteBuffer&&(a=s,s={}),s=s||{},s.output=a,s.iv=o,i.call(n,s)},n}});var cr=ft((wg,Oa)=>{var Un=ct();Oa.exports=Un.md=Un.md||{};Un.md.algorithms=Un.md.algorithms||{}});var Fa=ft((Eg,Ka)=>{var Ie=ct();cr();Et();var bl=Ka.exports=Ie.hmac=Ie.hmac||{};bl.create=function(){var t=null,e=null,r=null,n=null,i={};return i.start=function(o,s){if(o!==null)if(typeof o=="string")if(o=o.toLowerCase(),o in Ie.md.algorithms)e=Ie.md.algorithms[o].create();else throw new Error('Unknown hash algorithm "'+o+'"');else e=o;if(s===null)s=t;else{if(typeof s=="string")s=Ie.util.createBuffer(s);else if(Ie.util.isArray(s)){var a=s;s=Ie.util.createBuffer();for(var c=0;c<a.length;++c)s.putByte(a[c])}var f=s.length();f>e.blockLength&&(e.start(),e.update(s.bytes()),s=e.digest()),r=Ie.util.createBuffer(),n=Ie.util.createBuffer(),f=s.length();for(var c=0;c<f;++c){var a=s.at(c);r.putByte(54^a),n.putByte(92^a)}if(f<e.blockLength)for(var a=e.blockLength-f,c=0;c<a;++c)r.putByte(54),n.putByte(92);t=s,r=r.bytes(),n=n.bytes()}e.start(),e.update(r)},i.update=function(o){e.update(o)},i.getMac=function(){var o=e.digest().bytes();return e.start(),e.update(n),e.update(o),e.digest()},i.digest=i.getMac,i}});var On=ft(()=>{});var Va=ft((Ag,Ma)=>{var $t=ct();Fa();cr();Et();var wl=$t.pkcs5=$t.pkcs5||{},Te;$t.util.isNodejs&&!$t.options.usePureJavaScript&&(Te=On());Ma.exports=$t.pbkdf2=wl.pbkdf2=function(t,e,r,n,i,o){if(typeof i=="function"&&(o=i,i=null),$t.util.isNodejs&&!$t.options.usePureJavaScript&&Te.pbkdf2&&(i===null||typeof i!="object")&&(Te.pbkdf2Sync.length>4||!i||i==="sha1"))return typeof i!="string"&&(i="sha1"),t=Buffer.from(t,"binary"),e=Buffer.from(e,"binary"),o?Te.pbkdf2Sync.length===4?Te.pbkdf2(t,e,r,n,function(b,_){if(b)return o(b);o(null,_.toString("binary"))}):Te.pbkdf2(t,e,r,n,i,function(b,_){if(b)return o(b);o(null,_.toString("binary"))}):Te.pbkdf2Sync.length===4?Te.pbkdf2Sync(t,e,r,n).toString("binary"):Te.pbkdf2Sync(t,e,r,n,i).toString("binary");if((typeof i>"u"||i===null)&&(i="sha1"),typeof i=="string"){if(!(i in $t.md.algorithms))throw new Error("Unknown hash algorithm: "+i);i=$t.md[i].create()}var s=i.digestLength;if(n>4294967295*s){var a=new Error("Derived key is too long.");if(o)return o(a);throw a}var c=Math.ceil(n/s),f=n-(c-1)*s,u=$t.hmac.create();u.start(i,t);var l="",p,d,h;if(!o){for(var y=1;y<=c;++y){u.start(null,null),u.update(e),u.update($t.util.int32ToBytes(y)),p=h=u.digest().getBytes();for(var g=2;g<=r;++g)u.start(null,null),u.update(h),d=u.digest().getBytes(),p=$t.util.xorBytes(p,d,s),h=d;l+=y<c?p:p.substr(0,f)}return l}var y=1,g;function x(){if(y>c)return o(null,l);u.start(null,null),u.update(e),u.update($t.util.int32ToBytes(y)),p=h=u.digest().getBytes(),g=2,m()}function m(){if(g<=r)return u.start(null,null),u.update(h),d=u.digest().getBytes(),p=$t.util.xorBytes(p,d,s),h=d,++g,$t.util.setImmediate(m);l+=y<c?p:p.substr(0,f),++y,x()}x()}});var Ha=ft((Ig,za)=>{var Fn=ct();Et();var qa=za.exports=Fn.pem=Fn.pem||{};qa.encode=function(t,e){e=e||{};var r="-----BEGIN "+t.type+`-----\r
9
+ `,n;if(t.procType&&(n={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]},r+=Kn(n)),t.contentDomain&&(n={name:"Content-Domain",values:[t.contentDomain]},r+=Kn(n)),t.dekInfo&&(n={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&n.values.push(t.dekInfo.parameters),r+=Kn(n)),t.headers)for(var i=0;i<t.headers.length;++i)r+=Kn(t.headers[i]);return t.procType&&(r+=`\r
10
+ `),r+=Fn.util.encode64(t.body,e.maxline||64)+`\r
11
11
  `,r+="-----END "+t.type+`-----\r
12
- `,r};$a.decode=function(t){for(var e=[],r=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,n=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,i=/\r?\n/,o;o=r.exec(t),!!o;){var s=o[1];s==="NEW CERTIFICATE REQUEST"&&(s="CERTIFICATE REQUEST");var a={type:s,procType:null,contentDomain:null,dekInfo:null,headers:[],body:Vn.util.decode64(o[3])};if(e.push(a),!!o[2]){for(var c=o[2].split(i),f=0;o&&f<c.length;){for(var u=c[f].replace(/\s+$/,""),l=f+1;l<c.length;++l){var p=c[l];if(!/\s/.test(p[0]))break;u+=p,f=l}if(o=u.match(n),o){for(var d={name:o[1],values:[]},h=o[2].split(","),y=0;y<h.length;++y)d.values.push(Cl(h[y]));if(a.procType)if(!a.contentDomain&&d.name==="Content-Domain")a.contentDomain=h[0]||"";else if(!a.dekInfo&&d.name==="DEK-Info"){if(d.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');a.dekInfo={algorithm:h[0],parameters:h[1]||null}}else a.headers.push(d);else{if(d.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(d.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');a.procType={version:h[0],type:h[1]}}}++f}if(a.procType==="ENCRYPTED"&&!a.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(e.length===0)throw new Error("Invalid PEM formatted message.");return e};function Mn(t){for(var e=t.name+": ",r=[],n=function(c,f){return" "+f},i=0;i<t.values.length;++i)r.push(t.values[i].replace(/^(\S+\r\n)/,n));e+=r.join(",")+`\r
12
+ `,r};qa.decode=function(t){for(var e=[],r=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,n=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,i=/\r?\n/,o;o=r.exec(t),!!o;){var s=o[1];s==="NEW CERTIFICATE REQUEST"&&(s="CERTIFICATE REQUEST");var a={type:s,procType:null,contentDomain:null,dekInfo:null,headers:[],body:Fn.util.decode64(o[3])};if(e.push(a),!!o[2]){for(var c=o[2].split(i),f=0;o&&f<c.length;){for(var u=c[f].replace(/\s+$/,""),l=f+1;l<c.length;++l){var p=c[l];if(!/\s/.test(p[0]))break;u+=p,f=l}if(o=u.match(n),o){for(var d={name:o[1],values:[]},h=o[2].split(","),y=0;y<h.length;++y)d.values.push(El(h[y]));if(a.procType)if(!a.contentDomain&&d.name==="Content-Domain")a.contentDomain=h[0]||"";else if(!a.dekInfo&&d.name==="DEK-Info"){if(d.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');a.dekInfo={algorithm:h[0],parameters:h[1]||null}}else a.headers.push(d);else{if(d.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(d.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');a.procType={version:h[0],type:h[1]}}}++f}if(a.procType==="ENCRYPTED"&&!a.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(e.length===0)throw new Error("Invalid PEM formatted message.");return e};function Kn(t){for(var e=t.name+": ",r=[],n=function(c,f){return" "+f},i=0;i<t.values.length;++i)r.push(t.values[i].replace(/^(\S+\r\n)/,n));e+=r.join(",")+`\r
13
13
  `;for(var o=0,s=-1,i=0;i<e.length;++i,++o)if(o>65&&s!==-1){var a=e[s];a===","?(++s,e=e.substr(0,s)+`\r
14
14
  `+e.substr(s)):e=e.substr(0,s)+`\r
15
- `+a+e.substr(s+1),o=i-s-1,s=-1,++i}else(e[i]===" "||e[i]===" "||e[i]===",")&&(s=i);return e}function Cl(t){return t.replace(/^\s+/,"")}});var ja=ft((Pg,Ja)=>{var xe=ct();fr();Et();var Za=Ja.exports=xe.sha256=xe.sha256||{};xe.md.sha256=xe.md.algorithms.sha256=Za;Za.create=function(){Qa||_l();var t=null,e=xe.util.createBuffer(),r=new Array(64),n={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var i=n.messageLengthSize/4,o=0;o<i;++o)n.fullMessageLength.push(0);return e=xe.util.createBuffer(),t={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},n},n.start(),n.update=function(i,o){o==="utf8"&&(i=xe.util.encodeUtf8(i));var s=i.length;n.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var a=n.fullMessageLength.length-1;a>=0;--a)n.fullMessageLength[a]+=s[1],s[1]=s[0]+(n.fullMessageLength[a]/4294967296>>>0),n.fullMessageLength[a]=n.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return e.putBytes(i),Ya(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var i=xe.util.createBuffer();i.putBytes(e.bytes());var o=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,s=o&n.blockLength-1;i.putBytes(yo.substr(0,n.blockLength-s));for(var a,c,f=n.fullMessageLength[0]*8,u=0;u<n.fullMessageLength.length-1;++u)a=n.fullMessageLength[u+1]*8,c=a/4294967296>>>0,f+=c,i.putInt32(f>>>0),f=a>>>0;i.putInt32(f);var l={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};Ya(l,r,i);var p=xe.util.createBuffer();return p.putInt32(l.h0),p.putInt32(l.h1),p.putInt32(l.h2),p.putInt32(l.h3),p.putInt32(l.h4),p.putInt32(l.h5),p.putInt32(l.h6),p.putInt32(l.h7),p},n};var yo=null,Qa=!1,Xa=null;function _l(){yo="\x80",yo+=xe.util.fillString("\0",64),Xa=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Qa=!0}function Ya(t,e,r){for(var n,i,o,s,a,c,f,u,l,p,d,h,y,g,x,m=r.length();m>=64;){for(f=0;f<16;++f)e[f]=r.getInt32();for(;f<64;++f)n=e[f-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=e[f-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,e[f]=n+e[f-7]+i+e[f-16]|0;for(u=t.h0,l=t.h1,p=t.h2,d=t.h3,h=t.h4,y=t.h5,g=t.h6,x=t.h7,f=0;f<64;++f)s=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),a=g^h&(y^g),o=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),c=u&l|p&(u^l),n=x+s+a+Xa[f]+e[f],i=o+c,x=g,g=y,y=h,h=d+n>>>0,d=p,p=l,l=u,u=n+i>>>0;t.h0=t.h0+u|0,t.h1=t.h1+l|0,t.h2=t.h2+p|0,t.h3=t.h3+d|0,t.h4=t.h4+h|0,t.h5=t.h5+y|0,t.h6=t.h6+g|0,t.h7=t.h7+x|0,m-=64}}});var e0=ft((kg,t0)=>{var me=ct();Et();var qn=null;me.util.isNodejs&&!me.options.usePureJavaScript&&!process.versions["node-webkit"]&&(qn=Fn());var Rl=t0.exports=me.prng=me.prng||{};Rl.create=function(t){for(var e={plugin:t,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=t.md,n=new Array(32),i=0;i<32;++i)n[i]=r.create();e.pools=n,e.pool=0,e.generate=function(f,u){if(!u)return e.generateSync(f);var l=e.plugin.cipher,p=e.plugin.increment,d=e.plugin.formatKey,h=e.plugin.formatSeed,y=me.util.createBuffer();e.key=null,g();function g(x){if(x)return u(x);if(y.length()>=f)return u(null,y.getBytes(f));if(e.generated>1048575&&(e.key=null),e.key===null)return me.util.nextTick(function(){o(g)});var m=l(e.key,e.seed);e.generated+=m.length,y.putBytes(m),e.key=d(l(e.key,p(e.seed))),e.seed=h(l(e.key,e.seed)),me.util.setImmediate(g)}},e.generateSync=function(f){var u=e.plugin.cipher,l=e.plugin.increment,p=e.plugin.formatKey,d=e.plugin.formatSeed;e.key=null;for(var h=me.util.createBuffer();h.length()<f;){e.generated>1048575&&(e.key=null),e.key===null&&s();var y=u(e.key,e.seed);e.generated+=y.length,h.putBytes(y),e.key=p(u(e.key,l(e.seed))),e.seed=d(u(e.key,e.seed))}return h.getBytes(f)};function o(f){if(e.pools[0].messageLength>=32)return a(),f();var u=32-e.pools[0].messageLength<<5;e.seedFile(u,function(l,p){if(l)return f(l);e.collect(p),a(),f()})}function s(){if(e.pools[0].messageLength>=32)return a();var f=32-e.pools[0].messageLength<<5;e.collect(e.seedFileSync(f)),a()}function a(){e.reseeds=e.reseeds===4294967295?0:e.reseeds+1;var f=e.plugin.md.create();f.update(e.keyBytes);for(var u=1,l=0;l<32;++l)e.reseeds%u===0&&(f.update(e.pools[l].digest().getBytes()),e.pools[l].start()),u=u<<1;e.keyBytes=f.digest().getBytes(),f.start(),f.update(e.keyBytes);var p=f.digest().getBytes();e.key=e.plugin.formatKey(e.keyBytes),e.seed=e.plugin.formatSeed(p),e.generated=0}function c(f){var u=null,l=me.util.globalScope,p=l.crypto||l.msCrypto;p&&p.getRandomValues&&(u=function(E){return p.getRandomValues(E)});var d=me.util.createBuffer();if(u)for(;d.length()<f;){var h=Math.max(1,Math.min(f-d.length(),65536)/4),y=new Uint32Array(Math.floor(h));try{u(y);for(var g=0;g<y.length;++g)d.putInt32(y[g])}catch(E){if(!(typeof QuotaExceededError<"u"&&E instanceof QuotaExceededError))throw E}}if(d.length()<f)for(var x,m,b,_=Math.floor(Math.random()*65536);d.length()<f;){m=16807*(_&65535),x=16807*(_>>16),m+=(x&32767)<<16,m+=x>>15,m=(m&2147483647)+(m>>31),_=m&4294967295;for(var g=0;g<3;++g)b=_>>>(g<<3),b^=Math.floor(Math.random()*256),d.putByte(b&255)}return d.getBytes(f)}return qn?(e.seedFile=function(f,u){qn.randomBytes(f,function(l,p){if(l)return u(l);u(null,p.toString())})},e.seedFileSync=function(f){return qn.randomBytes(f).toString()}):(e.seedFile=function(f,u){try{u(null,c(f))}catch(l){u(l)}},e.seedFileSync=c),e.collect=function(f){for(var u=f.length,l=0;l<u;++l)e.pools[e.pool].update(f.substr(l,1)),e.pool=e.pool===31?0:e.pool+1},e.collectInt=function(f,u){for(var l="",p=0;p<u;p+=8)l+=String.fromCharCode(f>>p&255);e.collect(l)},e.registerWorker=function(f){if(f===self)e.seedFile=function(l,p){function d(h){var y=h.data;y.forge&&y.forge.prng&&(self.removeEventListener("message",d),p(y.forge.prng.err,y.forge.prng.bytes))}self.addEventListener("message",d),self.postMessage({forge:{prng:{needed:l}}})};else{var u=function(l){var p=l.data;p.forge&&p.forge.prng&&e.seedFile(p.forge.prng.needed,function(d,h){f.postMessage({forge:{prng:{err:d,bytes:h}}})})};f.addEventListener("message",u)}},e}});var fn=ft((Ng,go)=>{var Lt=ct();po();ja();e0();Et();(function(){if(Lt.random&&Lt.random.getBytes){go.exports=Lt.random;return}(function(t){var e={},r=new Array(4),n=Lt.util.createBuffer();e.formatKey=function(l){var p=Lt.util.createBuffer(l);return l=new Array(4),l[0]=p.getInt32(),l[1]=p.getInt32(),l[2]=p.getInt32(),l[3]=p.getInt32(),Lt.aes._expandKey(l,!1)},e.formatSeed=function(l){var p=Lt.util.createBuffer(l);return l=new Array(4),l[0]=p.getInt32(),l[1]=p.getInt32(),l[2]=p.getInt32(),l[3]=p.getInt32(),l},e.cipher=function(l,p){return Lt.aes._updateBlock(l,p,r,!1),n.putInt32(r[0]),n.putInt32(r[1]),n.putInt32(r[2]),n.putInt32(r[3]),n.getBytes()},e.increment=function(l){return++l[3],l},e.md=Lt.md.sha256;function i(){var l=Lt.prng.create(e);return l.getBytes=function(p,d){return l.generate(p,d)},l.getBytesSync=function(p){return l.generate(p)},l}var o=i(),s=null,a=Lt.util.globalScope,c=a.crypto||a.msCrypto;if(c&&c.getRandomValues&&(s=function(l){return c.getRandomValues(l)}),Lt.options.usePureJavaScript||!Lt.util.isNodejs&&!s){if(typeof window>"u"||window.document,o.collectInt(+new Date,32),typeof navigator<"u"){var f="";for(var u in navigator)try{typeof navigator[u]=="string"&&(f+=navigator[u])}catch{}o.collect(f),f=null}t&&(t().mousemove(function(l){o.collectInt(l.clientX,16),o.collectInt(l.clientY,16)}),t().keypress(function(l){o.collectInt(l.charCode,8)}))}if(!Lt.random)Lt.random=o;else for(var u in o)Lt.random[u]=o[u];Lt.random.createInstance=i,go.exports=Lt.random})(typeof jQuery<"u"?jQuery:null)})()});var o0=ft((Ug,i0)=>{var $t=ct();Et();var xo=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],r0=[1,2,3,5],Ll=function(t,e){return t<<e&65535|(t&65535)>>16-e},Dl=function(t,e){return(t&65535)>>e|t<<16-e&65535};i0.exports=$t.rc2=$t.rc2||{};$t.rc2.expandKey=function(t,e){typeof t=="string"&&(t=$t.util.createBuffer(t)),e=e||128;var r=t,n=t.length(),i=e,o=Math.ceil(i/8),s=255>>(i&7),a;for(a=n;a<128;a++)r.putByte(xo[r.at(a-1)+r.at(a-n)&255]);for(r.setAt(128-o,xo[r.at(128-o)&s]),a=127-o;a>=0;a--)r.setAt(a,xo[r.at(a+1)^r.at(a+o)]);return r};var n0=function(t,e,r){var n=!1,i=null,o=null,s=null,a,c,f,u,l=[];for(t=$t.rc2.expandKey(t,e),f=0;f<64;f++)l.push(t.getInt16Le());r?(a=function(h){for(f=0;f<4;f++)h[f]+=l[u]+(h[(f+3)%4]&h[(f+2)%4])+(~h[(f+3)%4]&h[(f+1)%4]),h[f]=Ll(h[f],r0[f]),u++},c=function(h){for(f=0;f<4;f++)h[f]+=l[h[(f+3)%4]&63]}):(a=function(h){for(f=3;f>=0;f--)h[f]=Dl(h[f],r0[f]),h[f]-=l[u]+(h[(f+3)%4]&h[(f+2)%4])+(~h[(f+3)%4]&h[(f+1)%4]),u--},c=function(h){for(f=3;f>=0;f--)h[f]-=l[h[(f+3)%4]&63]});var p=function(h){var y=[];for(f=0;f<4;f++){var g=i.getInt16Le();s!==null&&(r?g^=s.getInt16Le():s.putInt16Le(g)),y.push(g&65535)}u=r?0:63;for(var x=0;x<h.length;x++)for(var m=0;m<h[x][0];m++)h[x][1](y);for(f=0;f<4;f++)s!==null&&(r?s.putInt16Le(y[f]):y[f]^=s.getInt16Le()),o.putInt16Le(y[f])},d=null;return d={start:function(h,y){h&&typeof h=="string"&&(h=$t.util.createBuffer(h)),n=!1,i=$t.util.createBuffer(),o=y||new $t.util.createBuffer,s=h,d.output=o},update:function(h){for(n||i.putBuffer(h);i.length()>=8;)p([[5,a],[1,c],[6,a],[1,c],[5,a]])},finish:function(h){var y=!0;if(r)if(h)y=h(8,i,!r);else{var g=i.length()===8?8:8-i.length();i.fillWithByte(g,g)}if(y&&(n=!0,d.update()),!r&&(y=i.length()===0,y))if(h)y=h(8,o,!r);else{var x=o.length(),m=o.at(x-1);m>x?y=!1:o.truncate(m)}return y}},d};$t.rc2.startEncrypting=function(t,e,r){var n=$t.rc2.createEncryptionCipher(t,128);return n.start(e,r),n};$t.rc2.createEncryptionCipher=function(t,e){return n0(t,e,!0)};$t.rc2.startDecrypting=function(t,e,r){var n=$t.rc2.createDecryptionCipher(t,128);return n.start(e,r),n};$t.rc2.createDecryptionCipher=function(t,e){return n0(t,e,!1)}});var $n=ft((Og,d0)=>{var mo=ct();d0.exports=mo.jsbn=mo.jsbn||{};var Ce,Pl=0xdeadbeefcafe,s0=(Pl&16777215)==15715070;function I(t,e,r){this.data=[],t!=null&&(typeof t=="number"?this.fromNumber(t,e,r):e==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,e))}mo.jsbn.BigInteger=I;function et(){return new I(null)}function kl(t,e,r,n,i,o){for(;--o>=0;){var s=e*this.data[t++]+r.data[n]+i;i=Math.floor(s/67108864),r.data[n++]=s&67108863}return i}function Nl(t,e,r,n,i,o){for(var s=e&32767,a=e>>15;--o>=0;){var c=this.data[t]&32767,f=this.data[t++]>>15,u=a*c+f*s;c=s*c+((u&32767)<<15)+r.data[n]+(i&1073741823),i=(c>>>30)+(u>>>15)+a*f+(i>>>30),r.data[n++]=c&1073741823}return i}function a0(t,e,r,n,i,o){for(var s=e&16383,a=e>>14;--o>=0;){var c=this.data[t]&16383,f=this.data[t++]>>14,u=a*c+f*s;c=s*c+((u&16383)<<14)+r.data[n]+i,i=(c>>28)+(u>>14)+a*f,r.data[n++]=c&268435455}return i}typeof navigator>"u"?(I.prototype.am=a0,Ce=28):s0&&navigator.appName=="Microsoft Internet Explorer"?(I.prototype.am=Nl,Ce=30):s0&&navigator.appName!="Netscape"?(I.prototype.am=kl,Ce=26):(I.prototype.am=a0,Ce=28);I.prototype.DB=Ce;I.prototype.DM=(1<<Ce)-1;I.prototype.DV=1<<Ce;var vo=52;I.prototype.FV=Math.pow(2,vo);I.prototype.F1=vo-Ce;I.prototype.F2=2*Ce-vo;var Ul="0123456789abcdefghijklmnopqrstuvwxyz",Hn=new Array,Dr,Xt;Dr=48;for(Xt=0;Xt<=9;++Xt)Hn[Dr++]=Xt;Dr=97;for(Xt=10;Xt<36;++Xt)Hn[Dr++]=Xt;Dr=65;for(Xt=10;Xt<36;++Xt)Hn[Dr++]=Xt;function f0(t){return Ul.charAt(t)}function c0(t,e){var r=Hn[t.charCodeAt(e)];return r??-1}function Ol(t){for(var e=this.t-1;e>=0;--e)t.data[e]=this.data[e];t.t=this.t,t.s=this.s}function Kl(t){this.t=1,this.s=t<0?-1:0,t>0?this.data[0]=t:t<-1?this.data[0]=t+this.DV:this.t=0}function We(t){var e=et();return e.fromInt(t),e}function Fl(t,e){var r;if(e==16)r=4;else if(e==8)r=3;else if(e==256)r=8;else if(e==2)r=1;else if(e==32)r=5;else if(e==4)r=2;else{this.fromRadix(t,e);return}this.t=0,this.s=0;for(var n=t.length,i=!1,o=0;--n>=0;){var s=r==8?t[n]&255:c0(t,n);if(s<0){t.charAt(n)=="-"&&(i=!0);continue}i=!1,o==0?this.data[this.t++]=s:o+r>this.DB?(this.data[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this.data[this.t++]=s>>this.DB-o):this.data[this.t-1]|=s<<o,o+=r,o>=this.DB&&(o-=this.DB)}r==8&&t[0]&128&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&I.ZERO.subTo(this,this)}function Ml(){for(var t=this.s&this.DM;this.t>0&&this.data[this.t-1]==t;)--this.t}function Vl(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(t==16)e=4;else if(t==8)e=3;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else return this.toRadix(t);var r=(1<<e)-1,n,i=!1,o="",s=this.t,a=this.DB-s*this.DB%e;if(s-- >0)for(a<this.DB&&(n=this.data[s]>>a)>0&&(i=!0,o=f0(n));s>=0;)a<e?(n=(this.data[s]&(1<<a)-1)<<e-a,n|=this.data[--s]>>(a+=this.DB-e)):(n=this.data[s]>>(a-=e)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=f0(n));return i?o:"0"}function ql(){var t=et();return I.ZERO.subTo(this,t),t}function Hl(){return this.s<0?this.negate():this}function zl(t){var e=this.s-t.s;if(e!=0)return e;var r=this.t;if(e=r-t.t,e!=0)return this.s<0?-e:e;for(;--r>=0;)if((e=this.data[r]-t.data[r])!=0)return e;return 0}function zn(t){var e=1,r;return(r=t>>>16)!=0&&(t=r,e+=16),(r=t>>8)!=0&&(t=r,e+=8),(r=t>>4)!=0&&(t=r,e+=4),(r=t>>2)!=0&&(t=r,e+=2),(r=t>>1)!=0&&(t=r,e+=1),e}function $l(){return this.t<=0?0:this.DB*(this.t-1)+zn(this.data[this.t-1]^this.s&this.DM)}function Gl(t,e){var r;for(r=this.t-1;r>=0;--r)e.data[r+t]=this.data[r];for(r=t-1;r>=0;--r)e.data[r]=0;e.t=this.t+t,e.s=this.s}function Wl(t,e){for(var r=t;r<this.t;++r)e.data[r-t]=this.data[r];e.t=Math.max(this.t-t,0),e.s=this.s}function Yl(t,e){var r=t%this.DB,n=this.DB-r,i=(1<<n)-1,o=Math.floor(t/this.DB),s=this.s<<r&this.DM,a;for(a=this.t-1;a>=0;--a)e.data[a+o+1]=this.data[a]>>n|s,s=(this.data[a]&i)<<r;for(a=o-1;a>=0;--a)e.data[a]=0;e.data[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()}function Zl(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t){e.t=0;return}var n=t%this.DB,i=this.DB-n,o=(1<<n)-1;e.data[0]=this.data[r]>>n;for(var s=r+1;s<this.t;++s)e.data[s-r-1]|=(this.data[s]&o)<<i,e.data[s-r]=this.data[s]>>n;n>0&&(e.data[this.t-r-1]|=(this.s&o)<<i),e.t=this.t-r,e.clamp()}function Ql(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this.data[r]-t.data[r],e.data[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;r<this.t;)n+=this.data[r],e.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n-=t.data[r],e.data[r++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e.data[r++]=this.DV+n:n>0&&(e.data[r++]=n),e.t=r,e.clamp()}function Xl(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e.data[i]=0;for(i=0;i<n.t;++i)e.data[i+r.t]=r.am(0,n.data[i],e,i,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&I.ZERO.subTo(e,e)}function Jl(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t.data[r]=0;for(r=0;r<e.t-1;++r){var n=e.am(r,e.data[r],t,2*r,0,1);(t.data[r+e.t]+=e.am(r+1,2*e.data[r],t,2*r+1,n,e.t-r-1))>=e.DV&&(t.data[r+e.t]-=e.DV,t.data[r+e.t+1]=1)}t.t>0&&(t.data[t.t-1]+=e.am(r,e.data[r],t,2*r,0,1)),t.s=0,t.clamp()}function jl(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t){e?.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=et());var o=et(),s=this.s,a=t.s,c=this.DB-zn(n.data[n.t-1]);c>0?(n.lShiftTo(c,o),i.lShiftTo(c,r)):(n.copyTo(o),i.copyTo(r));var f=o.t,u=o.data[f-1];if(u!=0){var l=u*(1<<this.F1)+(f>1?o.data[f-2]>>this.F2:0),p=this.FV/l,d=(1<<this.F1)/l,h=1<<this.F2,y=r.t,g=y-f,x=e??et();for(o.dlShiftTo(g,x),r.compareTo(x)>=0&&(r.data[r.t++]=1,r.subTo(x,r)),I.ONE.dlShiftTo(f,x),x.subTo(o,o);o.t<f;)o.data[o.t++]=0;for(;--g>=0;){var m=r.data[--y]==u?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+h)*d);if((r.data[y]+=o.am(0,m,r,g,0,f))<m)for(o.dlShiftTo(g,x),r.subTo(x,r);r.data[y]<--m;)r.subTo(x,r)}e!=null&&(r.drShiftTo(f,e),s!=a&&I.ZERO.subTo(e,e)),r.t=f,r.clamp(),c>0&&r.rShiftTo(c,r),s<0&&I.ZERO.subTo(r,r)}}}function th(t){var e=et();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(I.ZERO)>0&&t.subTo(e,e),e}function cr(t){this.m=t}function eh(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function rh(t){return t}function nh(t){t.divRemTo(this.m,null,t)}function ih(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function oh(t,e){t.squareTo(e),this.reduce(e)}cr.prototype.convert=eh;cr.prototype.revert=rh;cr.prototype.reduce=nh;cr.prototype.mulTo=ih;cr.prototype.sqrTo=oh;function sh(){if(this.t<1)return 0;var t=this.data[0];if(!(t&1))return 0;var e=t&3;return e=e*(2-(t&15)*e)&15,e=e*(2-(t&255)*e)&255,e=e*(2-((t&65535)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}function ur(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function ah(t){var e=et();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(I.ZERO)>0&&this.m.subTo(e,e),e}function fh(t){var e=et();return t.copyTo(e),this.reduce(e),e}function ch(t){for(;t.t<=this.mt2;)t.data[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=t.data[e]&32767,n=r*this.mpl+((r*this.mph+(t.data[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t.data[r]+=this.m.am(0,n,t,e,0,this.m.t);t.data[r]>=t.DV;)t.data[r]-=t.DV,t.data[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function uh(t,e){t.squareTo(e),this.reduce(e)}function lh(t,e,r){t.multiplyTo(e,r),this.reduce(r)}ur.prototype.convert=ah;ur.prototype.revert=fh;ur.prototype.reduce=ch;ur.prototype.mulTo=lh;ur.prototype.sqrTo=uh;function hh(){return(this.t>0?this.data[0]&1:this.s)==0}function dh(t,e){if(t>4294967295||t<1)return I.ONE;var r=et(),n=et(),i=e.convert(this),o=zn(t)-1;for(i.copyTo(r);--o>=0;)if(e.sqrTo(r,n),(t&1<<o)>0)e.mulTo(n,i,r);else{var s=r;r=n,n=s}return e.revert(r)}function ph(t,e){var r;return t<256||e.isEven()?r=new cr(e):r=new ur(e),this.exp(t,r)}I.prototype.copyTo=Ol;I.prototype.fromInt=Kl;I.prototype.fromString=Fl;I.prototype.clamp=Ml;I.prototype.dlShiftTo=Gl;I.prototype.drShiftTo=Wl;I.prototype.lShiftTo=Yl;I.prototype.rShiftTo=Zl;I.prototype.subTo=Ql;I.prototype.multiplyTo=Xl;I.prototype.squareTo=Jl;I.prototype.divRemTo=jl;I.prototype.invDigit=sh;I.prototype.isEven=hh;I.prototype.exp=dh;I.prototype.toString=Vl;I.prototype.negate=ql;I.prototype.abs=Hl;I.prototype.compareTo=zl;I.prototype.bitLength=$l;I.prototype.mod=th;I.prototype.modPowInt=ph;I.ZERO=We(0);I.ONE=We(1);function yh(){var t=et();return this.copyTo(t),t}function gh(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function xh(){return this.t==0?this.s:this.data[0]<<24>>24}function mh(){return this.t==0?this.s:this.data[0]<<16>>16}function vh(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function bh(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function wh(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=We(r),i=et(),o=et(),s="";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(t).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(t)+s}function Eh(t,e){this.fromInt(0),e==null&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,o=0,s=0,a=0;a<t.length;++a){var c=c0(t,a);if(c<0){t.charAt(a)=="-"&&this.signum()==0&&(i=!0);continue}s=e*s+c,++o>=r&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),i&&I.ZERO.subTo(this,this)}function Sh(t,e,r){if(typeof e=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(I.ONE.shiftLeft(t-1),bo,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(I.ONE.shiftLeft(t-1),this);else{var n=new Array,i=t&7;n.length=(t>>3)+1,e.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}}function Bh(){var t=this.t,e=new Array;e[0]=this.s;var r=this.DB-t*this.DB%8,n,i=0;if(t-- >0)for(r<this.DB&&(n=this.data[t]>>r)!=(this.s&this.DM)>>r&&(e[i++]=n|this.s<<this.DB-r);t>=0;)r<8?(n=(this.data[t]&(1<<r)-1)<<8-r,n|=this.data[--t]>>(r+=this.DB-8)):(n=this.data[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),n&128&&(n|=-256),i==0&&(this.s&128)!=(n&128)&&++i,(i>0||n!=this.s)&&(e[i++]=n);return e}function Ah(t){return this.compareTo(t)==0}function Ih(t){return this.compareTo(t)<0?this:t}function Th(t){return this.compareTo(t)>0?this:t}function Ch(t,e,r){var n,i,o=Math.min(t.t,this.t);for(n=0;n<o;++n)r.data[n]=e(this.data[n],t.data[n]);if(t.t<this.t){for(i=t.s&this.DM,n=o;n<this.t;++n)r.data[n]=e(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<t.t;++n)r.data[n]=e(i,t.data[n]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()}function _h(t,e){return t&e}function Rh(t){var e=et();return this.bitwiseTo(t,_h,e),e}function bo(t,e){return t|e}function Lh(t){var e=et();return this.bitwiseTo(t,bo,e),e}function u0(t,e){return t^e}function Dh(t){var e=et();return this.bitwiseTo(t,u0,e),e}function l0(t,e){return t&~e}function Ph(t){var e=et();return this.bitwiseTo(t,l0,e),e}function kh(){for(var t=et(),e=0;e<this.t;++e)t.data[e]=this.DM&~this.data[e];return t.t=this.t,t.s=~this.s,t}function Nh(t){var e=et();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}function Uh(t){var e=et();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}function Oh(t){if(t==0)return-1;var e=0;return t&65535||(t>>=16,e+=16),t&255||(t>>=8,e+=8),t&15||(t>>=4,e+=4),t&3||(t>>=2,e+=2),t&1||++e,e}function Kh(){for(var t=0;t<this.t;++t)if(this.data[t]!=0)return t*this.DB+Oh(this.data[t]);return this.s<0?this.t*this.DB:-1}function Fh(t){for(var e=0;t!=0;)t&=t-1,++e;return e}function Mh(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=Fh(this.data[r]^e);return t}function Vh(t){var e=Math.floor(t/this.DB);return e>=this.t?this.s!=0:(this.data[e]&1<<t%this.DB)!=0}function qh(t,e){var r=I.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r}function Hh(t){return this.changeBit(t,bo)}function zh(t){return this.changeBit(t,l0)}function $h(t){return this.changeBit(t,u0)}function Gh(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this.data[r]+t.data[r],e.data[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n+=t.s;r<this.t;)n+=this.data[r],e.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n+=t.data[r],e.data[r++]=n&this.DM,n>>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e.data[r++]=n:n<-1&&(e.data[r++]=this.DV+n),e.t=r,e.clamp()}function Wh(t){var e=et();return this.addTo(t,e),e}function Yh(t){var e=et();return this.subTo(t,e),e}function Zh(t){var e=et();return this.multiplyTo(t,e),e}function Qh(t){var e=et();return this.divRemTo(t,e,null),e}function Xh(t){var e=et();return this.divRemTo(t,null,e),e}function Jh(t){var e=et(),r=et();return this.divRemTo(t,e,r),new Array(e,r)}function jh(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function td(t,e){if(t!=0){for(;this.t<=e;)this.data[this.t++]=0;for(this.data[e]+=t;this.data[e]>=this.DV;)this.data[e]-=this.DV,++e>=this.t&&(this.data[this.t++]=0),++this.data[e]}}function cn(){}function h0(t){return t}function ed(t,e,r){t.multiplyTo(e,r)}function rd(t,e){t.squareTo(e)}cn.prototype.convert=h0;cn.prototype.revert=h0;cn.prototype.mulTo=ed;cn.prototype.sqrTo=rd;function nd(t){return this.exp(t,new cn)}function id(t,e,r){var n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;var i;for(i=r.t-this.t;n<i;++n)r.data[n+this.t]=this.am(0,t.data[n],r,n,0,this.t);for(i=Math.min(t.t,e);n<i;++n)this.am(0,t.data[n],r,n,0,e-n);r.clamp()}function od(t,e,r){--e;var n=r.t=this.t+t.t-e;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(e-this.t,0);n<t.t;++n)r.data[this.t+n-e]=this.am(e-n,t.data[n],r,0,0,this.t+n-e);r.clamp(),r.drShiftTo(1,r)}function Pr(t){this.r2=et(),this.q3=et(),I.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function sd(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=et();return t.copyTo(e),this.reduce(e),e}function ad(t){return t}function fd(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function cd(t,e){t.squareTo(e),this.reduce(e)}function ud(t,e,r){t.multiplyTo(e,r),this.reduce(r)}Pr.prototype.convert=sd;Pr.prototype.revert=ad;Pr.prototype.reduce=fd;Pr.prototype.mulTo=ud;Pr.prototype.sqrTo=cd;function ld(t,e){var r=t.bitLength(),n,i=We(1),o;if(r<=0)return i;r<18?n=1:r<48?n=3:r<144?n=4:r<768?n=5:n=6,r<8?o=new cr(e):e.isEven()?o=new Pr(e):o=new ur(e);var s=new Array,a=3,c=n-1,f=(1<<n)-1;if(s[1]=o.convert(this),n>1){var u=et();for(o.sqrTo(s[1],u);a<=f;)s[a]=et(),o.mulTo(u,s[a-2],s[a]),a+=2}var l=t.t-1,p,d=!0,h=et(),y;for(r=zn(t.data[l])-1;l>=0;){for(r>=c?p=t.data[l]>>r-c&f:(p=(t.data[l]&(1<<r+1)-1)<<c-r,l>0&&(p|=t.data[l-1]>>this.DB+r-c)),a=n;!(p&1);)p>>=1,--a;if((r-=a)<0&&(r+=this.DB,--l),d)s[p].copyTo(i),d=!1;else{for(;a>1;)o.sqrTo(i,h),o.sqrTo(h,i),a-=2;a>0?o.sqrTo(i,h):(y=i,i=h,h=y),o.mulTo(h,s[p],i)}for(;l>=0&&!(t.data[l]&1<<r);)o.sqrTo(i,h),y=i,i=h,h=y,--r<0&&(r=this.DB-1,--l)}return o.revert(i)}function hd(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var n=e;e=r,r=n}var i=e.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return e;for(i<o&&(o=i),o>0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r}function dd(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(e==0)r=this.data[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this.data[n])%t;return r}function pd(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return I.ZERO;for(var r=t.clone(),n=this.clone(),i=We(1),o=We(0),s=We(0),a=We(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),e?((!i.isEven()||!o.isEven())&&(i.addTo(this,i),o.subTo(t,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),e?((!s.isEven()||!a.isEven())&&(s.addTo(this,s),a.subTo(t,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(s,i),o.subTo(a,o)):(n.subTo(r,n),e&&s.subTo(i,s),a.subTo(o,a))}if(n.compareTo(I.ONE)!=0)return I.ZERO;if(a.compareTo(t)>=0)return a.subtract(t);if(a.signum()<0)a.addTo(t,a);else return a;return a.signum()<0?a.add(t):a}var ne=[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],yd=(1<<26)/ne[ne.length-1];function gd(t){var e,r=this.abs();if(r.t==1&&r.data[0]<=ne[ne.length-1]){for(e=0;e<ne.length;++e)if(r.data[0]==ne[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<ne.length;){for(var n=ne[e],i=e+1;i<ne.length&&n<yd;)n*=ne[i++];for(n=r.modInt(n);e<i;)if(n%ne[e++]==0)return!1}return r.millerRabin(t)}function xd(t){var e=this.subtract(I.ONE),r=e.getLowestSetBit();if(r<=0)return!1;for(var n=e.shiftRight(r),i=md(),o,s=0;s<t;++s){do o=new I(this.bitLength(),i);while(o.compareTo(I.ONE)<=0||o.compareTo(e)>=0);var a=o.modPow(n,this);if(a.compareTo(I.ONE)!=0&&a.compareTo(e)!=0){for(var c=1;c++<r&&a.compareTo(e)!=0;)if(a=a.modPowInt(2,this),a.compareTo(I.ONE)==0)return!1;if(a.compareTo(e)!=0)return!1}}return!0}function md(){return{nextBytes:function(t){for(var e=0;e<t.length;++e)t[e]=Math.floor(Math.random()*256)}}}I.prototype.chunkSize=vh;I.prototype.toRadix=wh;I.prototype.fromRadix=Eh;I.prototype.fromNumber=Sh;I.prototype.bitwiseTo=Ch;I.prototype.changeBit=qh;I.prototype.addTo=Gh;I.prototype.dMultiply=jh;I.prototype.dAddOffset=td;I.prototype.multiplyLowerTo=id;I.prototype.multiplyUpperTo=od;I.prototype.modInt=dd;I.prototype.millerRabin=xd;I.prototype.clone=yh;I.prototype.intValue=gh;I.prototype.byteValue=xh;I.prototype.shortValue=mh;I.prototype.signum=bh;I.prototype.toByteArray=Bh;I.prototype.equals=Ah;I.prototype.min=Ih;I.prototype.max=Th;I.prototype.and=Rh;I.prototype.or=Lh;I.prototype.xor=Dh;I.prototype.andNot=Ph;I.prototype.not=kh;I.prototype.shiftLeft=Nh;I.prototype.shiftRight=Uh;I.prototype.getLowestSetBit=Kh;I.prototype.bitCount=Mh;I.prototype.testBit=Vh;I.prototype.setBit=Hh;I.prototype.clearBit=zh;I.prototype.flipBit=$h;I.prototype.add=Wh;I.prototype.subtract=Yh;I.prototype.multiply=Zh;I.prototype.divide=Qh;I.prototype.remainder=Xh;I.prototype.divideAndRemainder=Jh;I.prototype.modPow=ld;I.prototype.modInverse=pd;I.prototype.pow=nd;I.prototype.gcd=hd;I.prototype.isProbablePrime=gd});var m0=ft((Kg,x0)=>{var ve=ct();fr();Et();var y0=x0.exports=ve.sha1=ve.sha1||{};ve.md.sha1=ve.md.algorithms.sha1=y0;y0.create=function(){g0||vd();var t=null,e=ve.util.createBuffer(),r=new Array(80),n={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var i=n.messageLengthSize/4,o=0;o<i;++o)n.fullMessageLength.push(0);return e=ve.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},n},n.start(),n.update=function(i,o){o==="utf8"&&(i=ve.util.encodeUtf8(i));var s=i.length;n.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var a=n.fullMessageLength.length-1;a>=0;--a)n.fullMessageLength[a]+=s[1],s[1]=s[0]+(n.fullMessageLength[a]/4294967296>>>0),n.fullMessageLength[a]=n.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return e.putBytes(i),p0(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var i=ve.util.createBuffer();i.putBytes(e.bytes());var o=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,s=o&n.blockLength-1;i.putBytes(wo.substr(0,n.blockLength-s));for(var a,c,f=n.fullMessageLength[0]*8,u=0;u<n.fullMessageLength.length-1;++u)a=n.fullMessageLength[u+1]*8,c=a/4294967296>>>0,f+=c,i.putInt32(f>>>0),f=a>>>0;i.putInt32(f);var l={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};p0(l,r,i);var p=ve.util.createBuffer();return p.putInt32(l.h0),p.putInt32(l.h1),p.putInt32(l.h2),p.putInt32(l.h3),p.putInt32(l.h4),p},n};var wo=null,g0=!1;function vd(){wo="\x80",wo+=ve.util.fillString("\0",64),g0=!0}function p0(t,e,r){for(var n,i,o,s,a,c,f,u,l=r.length();l>=64;){for(i=t.h0,o=t.h1,s=t.h2,a=t.h3,c=t.h4,u=0;u<16;++u)n=r.getInt32(),e[u]=n,f=a^o&(s^a),n=(i<<5|i>>>27)+f+c+1518500249+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<20;++u)n=e[u-3]^e[u-8]^e[u-14]^e[u-16],n=n<<1|n>>>31,e[u]=n,f=a^o&(s^a),n=(i<<5|i>>>27)+f+c+1518500249+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<32;++u)n=e[u-3]^e[u-8]^e[u-14]^e[u-16],n=n<<1|n>>>31,e[u]=n,f=o^s^a,n=(i<<5|i>>>27)+f+c+1859775393+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<40;++u)n=e[u-6]^e[u-16]^e[u-28]^e[u-32],n=n<<2|n>>>30,e[u]=n,f=o^s^a,n=(i<<5|i>>>27)+f+c+1859775393+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<60;++u)n=e[u-6]^e[u-16]^e[u-28]^e[u-32],n=n<<2|n>>>30,e[u]=n,f=o&s|a&(o^s),n=(i<<5|i>>>27)+f+c+2400959708+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<80;++u)n=e[u-6]^e[u-16]^e[u-28]^e[u-32],n=n<<2|n>>>30,e[u]=n,f=o^s^a,n=(i<<5|i>>>27)+f+c+3395469782+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;t.h0=t.h0+i|0,t.h1=t.h1+o|0,t.h2=t.h2+s|0,t.h3=t.h3+a|0,t.h4=t.h4+c|0,l-=64}}});var w0=ft((Fg,b0)=>{var be=ct();Et();fn();m0();var v0=b0.exports=be.pkcs1=be.pkcs1||{};v0.encode_rsa_oaep=function(t,e,r){var n,i,o,s;typeof r=="string"?(n=r,i=arguments[3]||void 0,o=arguments[4]||void 0):r&&(n=r.label||void 0,i=r.seed||void 0,o=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),o?o.start():o=be.md.sha1.create(),s||(s=o);var a=Math.ceil(t.n.bitLength()/8),c=a-2*o.digestLength-2;if(e.length>c){var f=new Error("RSAES-OAEP input message length is too long.");throw f.length=e.length,f.maxLength=c,f}n||(n=""),o.update(n,"raw");for(var u=o.digest(),l="",p=c-e.length,d=0;d<p;d++)l+="\0";var h=u.getBytes()+l+""+e;if(!i)i=be.random.getBytes(o.digestLength);else if(i.length!==o.digestLength){var f=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw f.seedLength=i.length,f.digestLength=o.digestLength,f}var y=Gn(i,a-o.digestLength-1,s),g=be.util.xorBytes(h,y,h.length),x=Gn(g,o.digestLength,s),m=be.util.xorBytes(i,x,i.length);return"\0"+m+g};v0.decode_rsa_oaep=function(t,e,r){var n,i,o;typeof r=="string"?(n=r,i=arguments[3]||void 0):r&&(n=r.label||void 0,i=r.md||void 0,r.mgf1&&r.mgf1.md&&(o=r.mgf1.md));var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var g=new Error("RSAES-OAEP encoded message length is invalid.");throw g.length=e.length,g.expectedLength=s,g}if(i===void 0?i=be.md.sha1.create():i.start(),o||(o=i),s<2*i.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");n||(n=""),i.update(n,"raw");for(var a=i.digest().getBytes(),c=e.charAt(0),f=e.substring(1,i.digestLength+1),u=e.substring(1+i.digestLength),l=Gn(u,i.digestLength,o),p=be.util.xorBytes(f,l,f.length),d=Gn(p,s-i.digestLength-1,o),h=be.util.xorBytes(u,d,u.length),y=h.substring(0,i.digestLength),g=c!=="\0",x=0;x<i.digestLength;++x)g|=a.charAt(x)!==y.charAt(x);for(var m=1,b=i.digestLength,_=i.digestLength;_<h.length;_++){var E=h.charCodeAt(_),S=E&1^1,L=m?65534:0;g|=E&L,m=m&S,b+=m}if(g||h.charCodeAt(b)!==1)throw new Error("Invalid RSAES-OAEP padding.");return h.substring(b+1)};function Gn(t,e,r){r||(r=be.md.sha1.create());for(var n="",i=Math.ceil(e/r.digestLength),o=0;o<i;++o){var s=String.fromCharCode(o>>24&255,o>>16&255,o>>8&255,o&255);r.start(),r.update(t+s),n+=r.digest().getBytes()}return n.substring(0,e)}});var E0=ft((Mg,Eo)=>{var Ye=ct();Et();$n();fn();(function(){if(Ye.prime){Eo.exports=Ye.prime;return}var t=Eo.exports=Ye.prime=Ye.prime||{},e=Ye.jsbn.BigInteger,r=[6,4,2,4,2,4,6,2],n=new e(null);n.fromInt(30);var i=function(l,p){return l|p};t.generateProbablePrime=function(l,p,d){typeof p=="function"&&(d=p,p={}),p=p||{};var h=p.algorithm||"PRIMEINC";typeof h=="string"&&(h={name:h}),h.options=h.options||{};var y=p.prng||Ye.random,g={nextBytes:function(x){for(var m=y.getBytesSync(x.length),b=0;b<x.length;++b)x[b]=m.charCodeAt(b)}};if(h.name==="PRIMEINC")return o(l,g,h.options,d);throw new Error("Invalid prime generation algorithm: "+h.name)};function o(l,p,d,h){return"workers"in d?c(l,p,d,h):s(l,p,d,h)}function s(l,p,d,h){var y=f(l,p),g=0,x=u(y.bitLength());"millerRabinTests"in d&&(x=d.millerRabinTests);var m=10;"maxBlockTime"in d&&(m=d.maxBlockTime),a(y,l,p,g,x,m,h)}function a(l,p,d,h,y,g,x){var m=+new Date;do{if(l.bitLength()>p&&(l=f(p,d)),l.isProbablePrime(y))return x(null,l);l.dAddOffset(r[h++%8],0)}while(g<0||+new Date-m<g);Ye.util.setImmediate(function(){a(l,p,d,h,y,g,x)})}function c(l,p,d,h){if(typeof Worker>"u")return s(l,p,d,h);var y=f(l,p),g=d.workers,x=d.workLoad||100,m=x*30/8,b=d.workerScript||"forge/prime.worker.js";if(g===-1)return Ye.util.estimateCores(function(E,S){E&&(S=2),g=S-1,_()});_();function _(){g=Math.max(1,g);for(var E=[],S=0;S<g;++S)E[S]=new Worker(b);for(var L=g,S=0;S<g;++S)E[S].addEventListener("message",H);var D=!1;function H(q){if(!D){--L;var M=q.data;if(M.found){for(var X=0;X<E.length;++X)E[X].terminate();return D=!0,h(null,new e(M.prime,16))}y.bitLength()>l&&(y=f(l,p));var at=y.toString(16);q.target.postMessage({hex:at,workLoad:x}),y.dAddOffset(m,0)}}}}function f(l,p){var d=new e(l,p),h=l-1;return d.testBit(h)||d.bitwiseTo(e.ONE.shiftLeft(h),i,d),d.dAddOffset(31-d.mod(n).byteValue(),0),d}function u(l){return l<=100?27:l<=150?18:l<=200?15:l<=250?12:l<=300?9:l<=350?8:l<=400?7:l<=500?6:l<=600?5:l<=800?4:l<=1250?3:2}})()});var Yn=ft((Vg,_0)=>{var F=ct();an();$n();Dn();w0();E0();fn();Et();typeof tt>"u"&&(tt=F.jsbn.BigInteger);var tt,So=F.util.isNodejs?Fn():null,w=F.asn1,Jt=F.util;F.pki=F.pki||{};_0.exports=F.pki.rsa=F.rsa=F.rsa||{};var z=F.pki,bd=[6,4,2,4,2,4,6,2],wd={name:"PrivateKeyInfo",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:w.Class.UNIVERSAL,type:w.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:w.Class.UNIVERSAL,type:w.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},Ed={name:"RSAPrivateKey",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},Sd={name:"RSAPublicKey",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},Bd=F.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:w.Class.UNIVERSAL,type:w.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:w.Class.UNIVERSAL,type:w.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},Ad={name:"DigestInfo",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:w.Class.UNIVERSAL,type:w.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:w.Class.UNIVERSAL,type:w.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:w.Class.UNIVERSAL,type:w.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},Id=function(t){var e;if(t.algorithm in z.oids)e=z.oids[t.algorithm];else{var r=new Error("Unknown message digest algorithm.");throw r.algorithm=t.algorithm,r}var n=w.oidToDer(e).getBytes(),i=w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[]),o=w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[]);o.value.push(w.create(w.Class.UNIVERSAL,w.Type.OID,!1,n)),o.value.push(w.create(w.Class.UNIVERSAL,w.Type.NULL,!1,""));var s=w.create(w.Class.UNIVERSAL,w.Type.OCTETSTRING,!1,t.digest().getBytes());return i.value.push(o),i.value.push(s),w.toDer(i).getBytes()},T0=function(t,e,r){if(r)return t.modPow(e.e,e.n);if(!e.p||!e.q)return t.modPow(e.d,e.n);e.dP||(e.dP=e.d.mod(e.p.subtract(tt.ONE))),e.dQ||(e.dQ=e.d.mod(e.q.subtract(tt.ONE))),e.qInv||(e.qInv=e.q.modInverse(e.p));var n;do n=new tt(F.util.bytesToHex(F.random.getBytes(e.n.bitLength()/8)),16);while(n.compareTo(e.n)>=0||!n.gcd(e.n).equals(tt.ONE));t=t.multiply(n.modPow(e.e,e.n)).mod(e.n);for(var i=t.mod(e.p).modPow(e.dP,e.p),o=t.mod(e.q).modPow(e.dQ,e.q);i.compareTo(o)<0;)i=i.add(e.p);var s=i.subtract(o).multiply(e.qInv).mod(e.p).multiply(e.q).add(o);return s=s.multiply(n.modInverse(e.n)).mod(e.n),s};z.rsa.encrypt=function(t,e,r){var n=r,i,o=Math.ceil(e.n.bitLength()/8);r!==!1&&r!==!0?(n=r===2,i=C0(t,e,r)):(i=F.util.createBuffer(),i.putBytes(t));for(var s=new tt(i.toHex(),16),a=T0(s,e,n),c=a.toString(16),f=F.util.createBuffer(),u=o-Math.ceil(c.length/2);u>0;)f.putByte(0),--u;return f.putBytes(F.util.hexToBytes(c)),f.getBytes()};z.rsa.decrypt=function(t,e,r,n){var i=Math.ceil(e.n.bitLength()/8);if(t.length!==i){var o=new Error("Encrypted message length is invalid.");throw o.length=t.length,o.expected=i,o}var s=new tt(F.util.createBuffer(t).toHex(),16);if(s.compareTo(e.n)>=0)throw new Error("Encrypted message is invalid.");for(var a=T0(s,e,r),c=a.toString(16),f=F.util.createBuffer(),u=i-Math.ceil(c.length/2);u>0;)f.putByte(0),--u;return f.putBytes(F.util.hexToBytes(c)),n!==!1?Wn(f.getBytes(),e,r):f.getBytes()};z.rsa.createKeyPairGenerationState=function(t,e,r){typeof t=="string"&&(t=parseInt(t,10)),t=t||2048,r=r||{};var n=r.prng||F.random,i={nextBytes:function(a){for(var c=n.getBytesSync(a.length),f=0;f<a.length;++f)a[f]=c.charCodeAt(f)}},o=r.algorithm||"PRIMEINC",s;if(o==="PRIMEINC")s={algorithm:o,state:0,bits:t,rng:i,eInt:e||65537,e:new tt(null),p:null,q:null,qBits:t>>1,pBits:t-(t>>1),pqState:0,num:null,keys:null},s.e.fromInt(s.eInt);else throw new Error("Invalid key generation algorithm: "+o);return s};z.rsa.stepKeyPairGenerationState=function(t,e){"algorithm"in t||(t.algorithm="PRIMEINC");var r=new tt(null);r.fromInt(30);for(var n=0,i=function(l,p){return l|p},o=+new Date,s,a=0;t.keys===null&&(e<=0||a<e);){if(t.state===0){var c=t.p===null?t.pBits:t.qBits,f=c-1;t.pqState===0?(t.num=new tt(c,t.rng),t.num.testBit(f)||t.num.bitwiseTo(tt.ONE.shiftLeft(f),i,t.num),t.num.dAddOffset(31-t.num.mod(r).byteValue(),0),n=0,++t.pqState):t.pqState===1?t.num.bitLength()>c?t.pqState=0:t.num.isProbablePrime(Cd(t.num.bitLength()))?++t.pqState:t.num.dAddOffset(bd[n++%8],0):t.pqState===2?t.pqState=t.num.subtract(tt.ONE).gcd(t.e).compareTo(tt.ONE)===0?3:0:t.pqState===3&&(t.pqState=0,t.p===null?t.p=t.num:t.q=t.num,t.p!==null&&t.q!==null&&++t.state,t.num=null)}else if(t.state===1)t.p.compareTo(t.q)<0&&(t.num=t.p,t.p=t.q,t.q=t.num),++t.state;else if(t.state===2)t.p1=t.p.subtract(tt.ONE),t.q1=t.q.subtract(tt.ONE),t.phi=t.p1.multiply(t.q1),++t.state;else if(t.state===3)t.phi.gcd(t.e).compareTo(tt.ONE)===0?++t.state:(t.p=null,t.q=null,t.state=0);else if(t.state===4)t.n=t.p.multiply(t.q),t.n.bitLength()===t.bits?++t.state:(t.q=null,t.state=0);else if(t.state===5){var u=t.e.modInverse(t.phi);t.keys={privateKey:z.rsa.setPrivateKey(t.n,t.e,u,t.p,t.q,u.mod(t.p1),u.mod(t.q1),t.q.modInverse(t.p)),publicKey:z.rsa.setPublicKey(t.n,t.e)}}s=+new Date,a+=s-o,o=s}return t.keys!==null};z.rsa.generateKeyPair=function(t,e,r,n){if(arguments.length===1?typeof t=="object"?(r=t,t=void 0):typeof t=="function"&&(n=t,t=void 0):arguments.length===2?typeof t=="number"?typeof e=="function"?(n=e,e=void 0):typeof e!="number"&&(r=e,e=void 0):(r=t,n=e,t=void 0,e=void 0):arguments.length===3&&(typeof e=="number"?typeof r=="function"&&(n=r,r=void 0):(n=r,r=e,e=void 0)),r=r||{},t===void 0&&(t=r.bits||2048),e===void 0&&(e=r.e||65537),!F.options.usePureJavaScript&&!r.prng&&t>=256&&t<=16384&&(e===65537||e===3)){if(n){if(S0("generateKeyPair"))return So.generateKeyPair("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(a,c,f){if(a)return n(a);n(null,{privateKey:z.privateKeyFromPem(f),publicKey:z.publicKeyFromPem(c)})});if(B0("generateKey")&&B0("exportKey"))return Jt.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:I0(e),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(a){return Jt.globalScope.crypto.subtle.exportKey("pkcs8",a.privateKey)}).then(void 0,function(a){n(a)}).then(function(a){if(a){var c=z.privateKeyFromAsn1(w.fromDer(F.util.createBuffer(a)));n(null,{privateKey:c,publicKey:z.setRsaPublicKey(c.n,c.e)})}});if(A0("generateKey")&&A0("exportKey")){var i=Jt.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:I0(e),hash:{name:"SHA-256"}},!0,["sign","verify"]);i.oncomplete=function(a){var c=a.target.result,f=Jt.globalScope.msCrypto.subtle.exportKey("pkcs8",c.privateKey);f.oncomplete=function(u){var l=u.target.result,p=z.privateKeyFromAsn1(w.fromDer(F.util.createBuffer(l)));n(null,{privateKey:p,publicKey:z.setRsaPublicKey(p.n,p.e)})},f.onerror=function(u){n(u)}},i.onerror=function(a){n(a)};return}}else if(S0("generateKeyPairSync")){var o=So.generateKeyPairSync("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:z.privateKeyFromPem(o.privateKey),publicKey:z.publicKeyFromPem(o.publicKey)}}}var s=z.rsa.createKeyPairGenerationState(t,e,r);if(!n)return z.rsa.stepKeyPairGenerationState(s,0),s.keys;Td(s,r,n)};z.setRsaPublicKey=z.rsa.setPublicKey=function(t,e){var r={n:t,e};return r.encrypt=function(n,i,o){if(typeof i=="string"?i=i.toUpperCase():i===void 0&&(i="RSAES-PKCS1-V1_5"),i==="RSAES-PKCS1-V1_5")i={encode:function(a,c,f){return C0(a,c,2).getBytes()}};else if(i==="RSA-OAEP"||i==="RSAES-OAEP")i={encode:function(a,c){return F.pkcs1.encode_rsa_oaep(c,a,o)}};else if(["RAW","NONE","NULL",null].indexOf(i)!==-1)i={encode:function(a){return a}};else if(typeof i=="string")throw new Error('Unsupported encryption scheme: "'+i+'".');var s=i.encode(n,r,!0);return z.rsa.encrypt(s,r,!0)},r.verify=function(n,i,o,s){typeof o=="string"?o=o.toUpperCase():o===void 0&&(o="RSASSA-PKCS1-V1_5"),s===void 0&&(s={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in s||(s._parseAllDigestBytes=!0),o==="RSASSA-PKCS1-V1_5"?o={verify:function(c,f){f=Wn(f,r,!0);var u=w.fromDer(f,{parseAllBytes:s._parseAllDigestBytes}),l={},p=[];if(!w.validate(u,Ad,l,p)){var d=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw d.errors=p,d}var h=w.derToOid(l.algorithmIdentifier);if(!(h===F.oids.md2||h===F.oids.md5||h===F.oids.sha1||h===F.oids.sha224||h===F.oids.sha256||h===F.oids.sha384||h===F.oids.sha512||h===F.oids["sha512-224"]||h===F.oids["sha512-256"])){var d=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw d.oid=h,d}if((h===F.oids.md2||h===F.oids.md5)&&!("parameters"in l))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return c===l.digest}}:(o==="NONE"||o==="NULL"||o===null)&&(o={verify:function(c,f){return f=Wn(f,r,!0),c===f}});var a=z.rsa.decrypt(i,r,!0,!1);return o.verify(n,a,r.n.bitLength())},r};z.setRsaPrivateKey=z.rsa.setPrivateKey=function(t,e,r,n,i,o,s,a){var c={n:t,e,d:r,p:n,q:i,dP:o,dQ:s,qInv:a};return c.decrypt=function(f,u,l){typeof u=="string"?u=u.toUpperCase():u===void 0&&(u="RSAES-PKCS1-V1_5");var p=z.rsa.decrypt(f,c,!1,!1);if(u==="RSAES-PKCS1-V1_5")u={decode:Wn};else if(u==="RSA-OAEP"||u==="RSAES-OAEP")u={decode:function(d,h){return F.pkcs1.decode_rsa_oaep(h,d,l)}};else if(["RAW","NONE","NULL",null].indexOf(u)!==-1)u={decode:function(d){return d}};else throw new Error('Unsupported encryption scheme: "'+u+'".');return u.decode(p,c,!1)},c.sign=function(f,u){var l=!1;typeof u=="string"&&(u=u.toUpperCase()),u===void 0||u==="RSASSA-PKCS1-V1_5"?(u={encode:Id},l=1):(u==="NONE"||u==="NULL"||u===null)&&(u={encode:function(){return f}},l=1);var p=u.encode(f,c.n.bitLength());return z.rsa.encrypt(p,c,l)},c};z.wrapRsaPrivateKey=function(t){return w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,w.integerToDer(0).getBytes()),w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.OID,!1,w.oidToDer(z.oids.rsaEncryption).getBytes()),w.create(w.Class.UNIVERSAL,w.Type.NULL,!1,"")]),w.create(w.Class.UNIVERSAL,w.Type.OCTETSTRING,!1,w.toDer(t).getBytes())])};z.privateKeyFromAsn1=function(t){var e={},r=[];if(w.validate(t,wd,e,r)&&(t=w.fromDer(F.util.createBuffer(e.privateKey))),e={},r=[],!w.validate(t,Ed,e,r)){var n=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw n.errors=r,n}var i,o,s,a,c,f,u,l;return i=F.util.createBuffer(e.privateKeyModulus).toHex(),o=F.util.createBuffer(e.privateKeyPublicExponent).toHex(),s=F.util.createBuffer(e.privateKeyPrivateExponent).toHex(),a=F.util.createBuffer(e.privateKeyPrime1).toHex(),c=F.util.createBuffer(e.privateKeyPrime2).toHex(),f=F.util.createBuffer(e.privateKeyExponent1).toHex(),u=F.util.createBuffer(e.privateKeyExponent2).toHex(),l=F.util.createBuffer(e.privateKeyCoefficient).toHex(),z.setRsaPrivateKey(new tt(i,16),new tt(o,16),new tt(s,16),new tt(a,16),new tt(c,16),new tt(f,16),new tt(u,16),new tt(l,16))};z.privateKeyToAsn1=z.privateKeyToRSAPrivateKey=function(t){return w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,w.integerToDer(0).getBytes()),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.n)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.e)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.d)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.p)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.q)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.dP)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.dQ)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.qInv))])};z.publicKeyFromAsn1=function(t){var e={},r=[];if(w.validate(t,Bd,e,r)){var n=w.derToOid(e.publicKeyOid);if(n!==z.oids.rsaEncryption){var i=new Error("Cannot read public key. Unknown OID.");throw i.oid=n,i}t=e.rsaPublicKey}if(r=[],!w.validate(t,Sd,e,r)){var i=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw i.errors=r,i}var o=F.util.createBuffer(e.publicKeyModulus).toHex(),s=F.util.createBuffer(e.publicKeyExponent).toHex();return z.setRsaPublicKey(new tt(o,16),new tt(s,16))};z.publicKeyToAsn1=z.publicKeyToSubjectPublicKeyInfo=function(t){return w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.OID,!1,w.oidToDer(z.oids.rsaEncryption).getBytes()),w.create(w.Class.UNIVERSAL,w.Type.NULL,!1,"")]),w.create(w.Class.UNIVERSAL,w.Type.BITSTRING,!1,[z.publicKeyToRSAPublicKey(t)])])};z.publicKeyToRSAPublicKey=function(t){return w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.n)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.e))])};function C0(t,e,r){var n=F.util.createBuffer(),i=Math.ceil(e.n.bitLength()/8);if(t.length>i-11){var o=new Error("Message is too long for PKCS#1 v1.5 padding.");throw o.length=t.length,o.max=i-11,o}n.putByte(0),n.putByte(r);var s=i-3-t.length,a;if(r===0||r===1){a=r===0?0:255;for(var c=0;c<s;++c)n.putByte(a)}else for(;s>0;){for(var f=0,u=F.random.getBytes(s),c=0;c<s;++c)a=u.charCodeAt(c),a===0?++f:n.putByte(a);s=f}return n.putByte(0),n.putBytes(t),n}function Wn(t,e,r,n){var i=Math.ceil(e.n.bitLength()/8),o=F.util.createBuffer(t),s=o.getByte(),a=o.getByte();if(s!==0||r&&a!==0&&a!==1||!r&&a!=2||r&&a===0&&typeof n>"u")throw new Error("Encryption block is invalid.");var c=0;if(a===0){c=i-3-n;for(var f=0;f<c;++f)if(o.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(a===1)for(c=0;o.length()>1;){if(o.getByte()!==255){--o.read;break}++c}else if(a===2)for(c=0;o.length()>1;){if(o.getByte()===0){--o.read;break}++c}var u=o.getByte();if(u!==0||c!==i-3-o.length())throw new Error("Encryption block is invalid.");return o.getBytes()}function Td(t,e,r){typeof e=="function"&&(r=e,e={}),e=e||{};var n={algorithm:{name:e.algorithm||"PRIMEINC",options:{workers:e.workers||2,workLoad:e.workLoad||100,workerScript:e.workerScript}}};"prng"in e&&(n.prng=e.prng),i();function i(){o(t.pBits,function(a,c){if(a)return r(a);if(t.p=c,t.q!==null)return s(a,t.q);o(t.qBits,s)})}function o(a,c){F.prime.generateProbablePrime(a,n,c)}function s(a,c){if(a)return r(a);if(t.q=c,t.p.compareTo(t.q)<0){var f=t.p;t.p=t.q,t.q=f}if(t.p.subtract(tt.ONE).gcd(t.e).compareTo(tt.ONE)!==0){t.p=null,i();return}if(t.q.subtract(tt.ONE).gcd(t.e).compareTo(tt.ONE)!==0){t.q=null,o(t.qBits,s);return}if(t.p1=t.p.subtract(tt.ONE),t.q1=t.q.subtract(tt.ONE),t.phi=t.p1.multiply(t.q1),t.phi.gcd(t.e).compareTo(tt.ONE)!==0){t.p=t.q=null,i();return}if(t.n=t.p.multiply(t.q),t.n.bitLength()!==t.bits){t.q=null,o(t.qBits,s);return}var u=t.e.modInverse(t.phi);t.keys={privateKey:z.rsa.setPrivateKey(t.n,t.e,u,t.p,t.q,u.mod(t.p1),u.mod(t.q1),t.q.modInverse(t.p)),publicKey:z.rsa.setPublicKey(t.n,t.e)},r(null,t.keys)}}function we(t){var e=t.toString(16);e[0]>="8"&&(e="00"+e);var r=F.util.hexToBytes(e);return r.length>1&&(r.charCodeAt(0)===0&&!(r.charCodeAt(1)&128)||r.charCodeAt(0)===255&&(r.charCodeAt(1)&128)===128)?r.substr(1):r}function Cd(t){return t<=100?27:t<=150?18:t<=200?15:t<=250?12:t<=300?9:t<=350?8:t<=400?7:t<=500?6:t<=600?5:t<=800?4:t<=1250?3:2}function S0(t){return F.util.isNodejs&&typeof So[t]=="function"}function B0(t){return typeof Jt.globalScope<"u"&&typeof Jt.globalScope.crypto=="object"&&typeof Jt.globalScope.crypto.subtle=="object"&&typeof Jt.globalScope.crypto.subtle[t]=="function"}function A0(t){return typeof Jt.globalScope<"u"&&typeof Jt.globalScope.msCrypto=="object"&&typeof Jt.globalScope.msCrypto.subtle=="object"&&typeof Jt.globalScope.msCrypto.subtle[t]=="function"}function I0(t){for(var e=F.util.hexToBytes(t.toString(16)),r=new Uint8Array(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}});var N0=ft((qg,k0)=>{var U=ct();po();an();Fa();fr();Dn();za();Wa();fn();o0();Yn();Et();typeof R0>"u"&&(R0=U.jsbn.BigInteger);var R0,B=U.asn1,G=U.pki=U.pki||{};k0.exports=G.pbe=U.pbe=U.pbe||{};var lr=G.oids,_d={name:"EncryptedPrivateKeyInfo",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:B.Class.UNIVERSAL,type:B.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:B.Class.UNIVERSAL,type:B.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},Rd={name:"PBES2Algorithms",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:B.Class.UNIVERSAL,type:B.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:B.Class.UNIVERSAL,type:B.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:B.Class.UNIVERSAL,type:B.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:B.Class.UNIVERSAL,type:B.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:B.Class.UNIVERSAL,type:B.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:B.Class.UNIVERSAL,type:B.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:B.Class.UNIVERSAL,type:B.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},Ld={name:"pkcs-12PbeParams",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:B.Class.UNIVERSAL,type:B.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:B.Class.UNIVERSAL,type:B.Type.INTEGER,constructed:!1,capture:"iterations"}]};G.encryptPrivateKeyInfo=function(t,e,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var n=U.random.getBytesSync(r.saltSize),i=r.count,o=B.integerToDer(i),s,a,c;if(r.algorithm.indexOf("aes")===0||r.algorithm==="des"){var f,u,l;switch(r.algorithm){case"aes128":s=16,f=16,u=lr["aes128-CBC"],l=U.aes.createEncryptionCipher;break;case"aes192":s=24,f=16,u=lr["aes192-CBC"],l=U.aes.createEncryptionCipher;break;case"aes256":s=32,f=16,u=lr["aes256-CBC"],l=U.aes.createEncryptionCipher;break;case"des":s=8,f=8,u=lr.desCBC,l=U.des.createEncryptionCipher;break;default:var p=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw p.algorithm=r.algorithm,p}var d="hmacWith"+r.prfAlgorithm.toUpperCase(),h=P0(d),y=U.pkcs5.pbkdf2(e,n,i,s,h),g=U.random.getBytesSync(f),x=l(y);x.start(g),x.update(B.toDer(t)),x.finish(),c=x.output.getBytes();var m=Dd(n,o,s,d);a=B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OID,!1,B.oidToDer(lr.pkcs5PBES2).getBytes()),B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OID,!1,B.oidToDer(lr.pkcs5PBKDF2).getBytes()),m]),B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OID,!1,B.oidToDer(u).getBytes()),B.create(B.Class.UNIVERSAL,B.Type.OCTETSTRING,!1,g)])])])}else if(r.algorithm==="3des"){s=24;var b=new U.util.ByteBuffer(n),y=G.pbe.generatePkcs12Key(e,b,1,i,s),g=G.pbe.generatePkcs12Key(e,b,2,i,s),x=U.des.createEncryptionCipher(y);x.start(g),x.update(B.toDer(t)),x.finish(),c=x.output.getBytes(),a=B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OID,!1,B.oidToDer(lr["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OCTETSTRING,!1,n),B.create(B.Class.UNIVERSAL,B.Type.INTEGER,!1,o.getBytes())])])}else{var p=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw p.algorithm=r.algorithm,p}var _=B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[a,B.create(B.Class.UNIVERSAL,B.Type.OCTETSTRING,!1,c)]);return _};G.decryptPrivateKeyInfo=function(t,e){var r=null,n={},i=[];if(!B.validate(t,_d,n,i)){var o=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=B.derToOid(n.encryptionOid),a=G.pbe.getCipher(s,n.encryptionParams,e),c=U.util.createBuffer(n.encryptedData);return a.update(c),a.finish()&&(r=B.fromDer(a.output)),r};G.encryptedPrivateKeyToPem=function(t,e){var r={type:"ENCRYPTED PRIVATE KEY",body:B.toDer(t).getBytes()};return U.pem.encode(r,{maxline:e})};G.encryptedPrivateKeyFromPem=function(t){var e=U.pem.decode(t)[0];if(e.type!=="ENCRYPTED PRIVATE KEY"){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=e.type,r}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return B.fromDer(e.body)};G.encryptRsaPrivateKey=function(t,e,r){if(r=r||{},!r.legacy){var n=G.wrapRsaPrivateKey(G.privateKeyToAsn1(t));return n=G.encryptPrivateKeyInfo(n,e,r),G.encryptedPrivateKeyToPem(n)}var i,o,s,a;switch(r.algorithm){case"aes128":i="AES-128-CBC",s=16,o=U.random.getBytesSync(16),a=U.aes.createEncryptionCipher;break;case"aes192":i="AES-192-CBC",s=24,o=U.random.getBytesSync(16),a=U.aes.createEncryptionCipher;break;case"aes256":i="AES-256-CBC",s=32,o=U.random.getBytesSync(16),a=U.aes.createEncryptionCipher;break;case"3des":i="DES-EDE3-CBC",s=24,o=U.random.getBytesSync(8),a=U.des.createEncryptionCipher;break;case"des":i="DES-CBC",s=8,o=U.random.getBytesSync(8),a=U.des.createEncryptionCipher;break;default:var c=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw c.algorithm=r.algorithm,c}var f=U.pbe.opensslDeriveBytes(e,o.substr(0,8),s),u=a(f);u.start(o),u.update(B.toDer(G.privateKeyToAsn1(t))),u.finish();var l={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:i,parameters:U.util.bytesToHex(o).toUpperCase()},body:u.output.getBytes()};return U.pem.encode(l)};G.decryptRsaPrivateKey=function(t,e){var r=null,n=U.pem.decode(t)[0];if(n.type!=="ENCRYPTED PRIVATE KEY"&&n.type!=="PRIVATE KEY"&&n.type!=="RSA PRIVATE KEY"){var i=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw i.headerType=i,i}if(n.procType&&n.procType.type==="ENCRYPTED"){var o,s;switch(n.dekInfo.algorithm){case"DES-CBC":o=8,s=U.des.createDecryptionCipher;break;case"DES-EDE3-CBC":o=24,s=U.des.createDecryptionCipher;break;case"AES-128-CBC":o=16,s=U.aes.createDecryptionCipher;break;case"AES-192-CBC":o=24,s=U.aes.createDecryptionCipher;break;case"AES-256-CBC":o=32,s=U.aes.createDecryptionCipher;break;case"RC2-40-CBC":o=5,s=function(l){return U.rc2.createDecryptionCipher(l,40)};break;case"RC2-64-CBC":o=8,s=function(l){return U.rc2.createDecryptionCipher(l,64)};break;case"RC2-128-CBC":o=16,s=function(l){return U.rc2.createDecryptionCipher(l,128)};break;default:var i=new Error('Could not decrypt private key; unsupported encryption algorithm "'+n.dekInfo.algorithm+'".');throw i.algorithm=n.dekInfo.algorithm,i}var a=U.util.hexToBytes(n.dekInfo.parameters),c=U.pbe.opensslDeriveBytes(e,a.substr(0,8),o),f=s(c);if(f.start(a),f.update(U.util.createBuffer(n.body)),f.finish())r=f.output.getBytes();else return r}else r=n.body;return n.type==="ENCRYPTED PRIVATE KEY"?r=G.decryptPrivateKeyInfo(B.fromDer(r),e):r=B.fromDer(r),r!==null&&(r=G.privateKeyFromAsn1(r)),r};G.pbe.generatePkcs12Key=function(t,e,r,n,i,o){var s,a;if(typeof o>"u"||o===null){if(!("sha1"in U.md))throw new Error('"sha1" hash algorithm unavailable.');o=U.md.sha1.create()}var c=o.digestLength,f=o.blockLength,u=new U.util.ByteBuffer,l=new U.util.ByteBuffer;if(t!=null){for(a=0;a<t.length;a++)l.putInt16(t.charCodeAt(a));l.putInt16(0)}var p=l.length(),d=e.length(),h=new U.util.ByteBuffer;h.fillWithByte(r,f);var y=f*Math.ceil(d/f),g=new U.util.ByteBuffer;for(a=0;a<y;a++)g.putByte(e.at(a%d));var x=f*Math.ceil(p/f),m=new U.util.ByteBuffer;for(a=0;a<x;a++)m.putByte(l.at(a%p));var b=g;b.putBuffer(m);for(var _=Math.ceil(i/c),E=1;E<=_;E++){var S=new U.util.ByteBuffer;S.putBytes(h.bytes()),S.putBytes(b.bytes());for(var L=0;L<n;L++)o.start(),o.update(S.getBytes()),S=o.digest();var D=new U.util.ByteBuffer;for(a=0;a<f;a++)D.putByte(S.at(a%c));var H=Math.ceil(d/f)+Math.ceil(p/f),q=new U.util.ByteBuffer;for(s=0;s<H;s++){var M=new U.util.ByteBuffer(b.getBytes(f)),X=511;for(a=D.length()-1;a>=0;a--)X=X>>8,X+=D.at(a)+M.at(a),M.setAt(a,X&255);q.putBuffer(M)}b=q,u.putBuffer(S)}return u.truncate(u.length()-i),u};G.pbe.getCipher=function(t,e,r){switch(t){case G.oids.pkcs5PBES2:return G.pbe.getCipherForPBES2(t,e,r);case G.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case G.oids["pbewithSHAAnd40BitRC2-CBC"]:return G.pbe.getCipherForPKCS12PBE(t,e,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=t,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}};G.pbe.getCipherForPBES2=function(t,e,r){var n={},i=[];if(!B.validate(e,Rd,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if(t=B.derToOid(n.kdfOid),t!==G.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=t,o.supportedOids=["pkcs5PBKDF2"],o}if(t=B.derToOid(n.encOid),t!==G.oids["aes128-CBC"]&&t!==G.oids["aes192-CBC"]&&t!==G.oids["aes256-CBC"]&&t!==G.oids["des-EDE3-CBC"]&&t!==G.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=t,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,a=U.util.createBuffer(n.kdfIterationCount);a=a.getInt(a.length()<<3);var c,f;switch(G.oids[t]){case"aes128-CBC":c=16,f=U.aes.createDecryptionCipher;break;case"aes192-CBC":c=24,f=U.aes.createDecryptionCipher;break;case"aes256-CBC":c=32,f=U.aes.createDecryptionCipher;break;case"des-EDE3-CBC":c=24,f=U.des.createDecryptionCipher;break;case"desCBC":c=8,f=U.des.createDecryptionCipher;break}var u=D0(n.prfOid),l=U.pkcs5.pbkdf2(r,s,a,c,u),p=n.encIv,d=f(l);return d.start(p),d};G.pbe.getCipherForPKCS12PBE=function(t,e,r){var n={},i=[];if(!B.validate(e,Ld,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=U.util.createBuffer(n.salt),a=U.util.createBuffer(n.iterations);a=a.getInt(a.length()<<3);var c,f,u;switch(t){case G.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,f=8,u=U.des.startDecrypting;break;case G.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,f=8,u=function(y,g){var x=U.rc2.createDecryptionCipher(y,40);return x.start(g,null),x};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=t,o}var l=D0(n.prfOid),p=G.pbe.generatePkcs12Key(r,s,1,a,c,l);l.start();var d=G.pbe.generatePkcs12Key(r,s,2,a,f,l);return u(p,d)};G.pbe.opensslDeriveBytes=function(t,e,r,n){if(typeof n>"u"||n===null){if(!("md5"in U.md))throw new Error('"md5" hash algorithm unavailable.');n=U.md.md5.create()}e===null&&(e="");for(var i=[L0(n,t+e)],o=16,s=1;o<r;++s,o+=16)i.push(L0(n,i[s-1]+t+e));return i.join("").substr(0,r)};function L0(t,e){return t.start().update(e).digest().getBytes()}function D0(t){var e;if(!t)e="hmacWithSHA1";else if(e=G.oids[B.derToOid(t)],!e){var r=new Error("Unsupported PRF OID.");throw r.oid=t,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}return P0(e)}function P0(t){var e=U.md;switch(t){case"hmacWithSHA224":e=U.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":t=t.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=t,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!e||!(t in e))throw new Error("Unknown hash algorithm: "+t);return e[t].create()}function Dd(t,e,r,n){var i=B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OCTETSTRING,!1,t),B.create(B.Class.UNIVERSAL,B.Type.INTEGER,!1,e.getBytes())]);return n!=="hmacWithSHA1"&&i.value.push(B.create(B.Class.UNIVERSAL,B.Type.INTEGER,!1,U.util.hexToBytes(r.toString(16))),B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OID,!1,B.oidToDer(G.oids[n]).getBytes()),B.create(B.Class.UNIVERSAL,B.Type.NULL,!1,"")])),i}});var Af=ft((sv,Bf)=>{var pt=ct();fr();Et();var xn=Bf.exports=pt.sha512=pt.sha512||{};pt.md.sha512=pt.md.algorithms.sha512=xn;var Ef=pt.sha384=pt.sha512.sha384=pt.sha512.sha384||{};Ef.create=function(){return xn.create("SHA-384")};pt.md.sha384=pt.md.algorithms.sha384=Ef;pt.sha512.sha256=pt.sha512.sha256||{create:function(){return xn.create("SHA-512/256")}};pt.md["sha512/256"]=pt.md.algorithms["sha512/256"]=pt.sha512.sha256;pt.sha512.sha224=pt.sha512.sha224||{create:function(){return xn.create("SHA-512/224")}};pt.md["sha512/224"]=pt.md.algorithms["sha512/224"]=pt.sha512.sha224;xn.create=function(t){if(Sf||jp(),typeof t>"u"&&(t="SHA-512"),!(t in vr))throw new Error("Invalid SHA-512 algorithm: "+t);for(var e=vr[t],r=null,n=pt.util.createBuffer(),i=new Array(80),o=0;o<80;++o)i[o]=new Array(2);var s=64;switch(t){case"SHA-384":s=48;break;case"SHA-512/256":s=32;break;case"SHA-512/224":s=28;break}var a={algorithm:t.replace("-","").toLowerCase(),blockLength:128,digestLength:s,messageLength:0,fullMessageLength:null,messageLengthSize:16};return a.start=function(){a.messageLength=0,a.fullMessageLength=a.messageLength128=[];for(var c=a.messageLengthSize/4,f=0;f<c;++f)a.fullMessageLength.push(0);n=pt.util.createBuffer(),r=new Array(e.length);for(var f=0;f<e.length;++f)r[f]=e[f].slice(0);return a},a.start(),a.update=function(c,f){f==="utf8"&&(c=pt.util.encodeUtf8(c));var u=c.length;a.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var l=a.fullMessageLength.length-1;l>=0;--l)a.fullMessageLength[l]+=u[1],u[1]=u[0]+(a.fullMessageLength[l]/4294967296>>>0),a.fullMessageLength[l]=a.fullMessageLength[l]>>>0,u[0]=u[1]/4294967296>>>0;return n.putBytes(c),wf(r,i,n),(n.read>2048||n.length()===0)&&n.compact(),a},a.digest=function(){var c=pt.util.createBuffer();c.putBytes(n.bytes());var f=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,u=f&a.blockLength-1;c.putBytes(rs.substr(0,a.blockLength-u));for(var l,p,d=a.fullMessageLength[0]*8,h=0;h<a.fullMessageLength.length-1;++h)l=a.fullMessageLength[h+1]*8,p=l/4294967296>>>0,d+=p,c.putInt32(d>>>0),d=l>>>0;c.putInt32(d);for(var y=new Array(r.length),h=0;h<r.length;++h)y[h]=r[h].slice(0);wf(y,i,c);var g=pt.util.createBuffer(),x;t==="SHA-512"?x=y.length:t==="SHA-384"?x=y.length-2:x=y.length-4;for(var h=0;h<x;++h)g.putInt32(y[h][0]),(h!==x-1||t!=="SHA-512/224")&&g.putInt32(y[h][1]);return g},a};var rs=null,Sf=!1,ns=null,vr=null;function jp(){rs="\x80",rs+=pt.util.fillString("\0",128),ns=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],vr={},vr["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],vr["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],vr["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],vr["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],Sf=!0}function wf(t,e,r){for(var n,i,o,s,a,c,f,u,l,p,d,h,y,g,x,m,b,_,E,S,L,D,H,q,M,X,at,Pt,T,k,R,P,A,O,K,V=r.length();V>=128;){for(T=0;T<16;++T)e[T][0]=r.getInt32()>>>0,e[T][1]=r.getInt32()>>>0;for(;T<80;++T)P=e[T-2],k=P[0],R=P[1],n=((k>>>19|R<<13)^(R>>>29|k<<3)^k>>>6)>>>0,i=((k<<13|R>>>19)^(R<<3|k>>>29)^(k<<26|R>>>6))>>>0,O=e[T-15],k=O[0],R=O[1],o=((k>>>1|R<<31)^(k>>>8|R<<24)^k>>>7)>>>0,s=((k<<31|R>>>1)^(k<<24|R>>>8)^(k<<25|R>>>7))>>>0,A=e[T-7],K=e[T-16],R=i+A[1]+s+K[1],e[T][0]=n+A[0]+o+K[0]+(R/4294967296>>>0)>>>0,e[T][1]=R>>>0;for(y=t[0][0],g=t[0][1],x=t[1][0],m=t[1][1],b=t[2][0],_=t[2][1],E=t[3][0],S=t[3][1],L=t[4][0],D=t[4][1],H=t[5][0],q=t[5][1],M=t[6][0],X=t[6][1],at=t[7][0],Pt=t[7][1],T=0;T<80;++T)f=((L>>>14|D<<18)^(L>>>18|D<<14)^(D>>>9|L<<23))>>>0,u=((L<<18|D>>>14)^(L<<14|D>>>18)^(D<<23|L>>>9))>>>0,l=(M^L&(H^M))>>>0,p=(X^D&(q^X))>>>0,a=((y>>>28|g<<4)^(g>>>2|y<<30)^(g>>>7|y<<25))>>>0,c=((y<<4|g>>>28)^(g<<30|y>>>2)^(g<<25|y>>>7))>>>0,d=(y&x|b&(y^x))>>>0,h=(g&m|_&(g^m))>>>0,R=Pt+u+p+ns[T][1]+e[T][1],n=at+f+l+ns[T][0]+e[T][0]+(R/4294967296>>>0)>>>0,i=R>>>0,R=c+h,o=a+d+(R/4294967296>>>0)>>>0,s=R>>>0,at=M,Pt=X,M=H,X=q,H=L,q=D,R=S+i,L=E+n+(R/4294967296>>>0)>>>0,D=R>>>0,E=b,S=_,b=x,_=m,x=y,m=g,R=i+s,y=n+o+(R/4294967296>>>0)>>>0,g=R>>>0;R=t[0][1]+g,t[0][0]=t[0][0]+y+(R/4294967296>>>0)>>>0,t[0][1]=R>>>0,R=t[1][1]+m,t[1][0]=t[1][0]+x+(R/4294967296>>>0)>>>0,t[1][1]=R>>>0,R=t[2][1]+_,t[2][0]=t[2][0]+b+(R/4294967296>>>0)>>>0,t[2][1]=R>>>0,R=t[3][1]+S,t[3][0]=t[3][0]+E+(R/4294967296>>>0)>>>0,t[3][1]=R>>>0,R=t[4][1]+D,t[4][0]=t[4][0]+L+(R/4294967296>>>0)>>>0,t[4][1]=R>>>0,R=t[5][1]+q,t[5][0]=t[5][0]+H+(R/4294967296>>>0)>>>0,t[5][1]=R>>>0,R=t[6][1]+X,t[6][0]=t[6][0]+M+(R/4294967296>>>0)>>>0,t[6][1]=R>>>0,R=t[7][1]+Pt,t[7][0]=t[7][0]+at+(R/4294967296>>>0)>>>0,t[7][1]=R>>>0,V-=128}}});var Bc=ft((xw,Sc)=>{"use strict";function Ec(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function ny(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 Ec(t,r)}catch{r.message=t.message,r.stack=t.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(t)),Ec(new i,r)}}Sc.exports=ny});var Rc=ft(In=>{(function(){var t,e,r,n,i,o,s,a;a=function(c){var f,u,l,p;return f=(c&255<<24)>>>24,u=(c&255<<16)>>>16,l=(c&65280)>>>8,p=c&255,[f,u,l,p].join(".")},s=function(c){var f,u,l,p,d,h;for(f=[],l=p=0;p<=3&&c.length!==0;l=++p){if(l>0){if(c[0]!==".")throw new Error("Invalid IP");c=c.substring(1)}h=e(c),d=h[0],u=h[1],c=c.substring(u),f.push(d)}if(c.length!==0)throw new Error("Invalid IP");switch(f.length){case 1:if(f[0]>4294967295)throw new Error("Invalid IP");return f[0]>>>0;case 2:if(f[0]>255||f[1]>16777215)throw new Error("Invalid IP");return(f[0]<<24|f[1])>>>0;case 3:if(f[0]>255||f[1]>255||f[2]>65535)throw new Error("Invalid IP");return(f[0]<<24|f[1]<<16|f[2])>>>0;case 4:if(f[0]>255||f[1]>255||f[2]>255||f[3]>255)throw new Error("Invalid IP");return(f[0]<<24|f[1]<<16|f[2]<<8|f[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 f,u,l,p,d;for(p=0,f=10,u="9",l=0,c.length>1&&c[l]==="0"&&(c[l+1]==="x"||c[l+1]==="X"?(l+=2,f=16):"0"<=c[l+1]&&c[l+1]<="9"&&(l++,f=8,u="7")),d=l;l<c.length;){if("0"<=c[l]&&c[l]<=u)p=p*f+(r(c[l])-n)>>>0;else if(f===16)if("a"<=c[l]&&c[l]<="f")p=p*f+(10+r(c[l])-o)>>>0;else if("A"<=c[l]&&c[l]<="F")p=p*f+(10+r(c[l])-i)>>>0;else break;else break;if(p>4294967295)throw new Error("too large");l++}if(l===d)throw new Error("empty octet");return[p,l]},t=function(){function c(f,u){var l,p,d,h;if(typeof f!="string")throw new Error("Missing `net' parameter");if(u||(h=f.split("/",2),f=h[0],u=h[1]),u||(u=32),typeof u=="string"&&u.indexOf(".")>-1){try{this.maskLong=s(u)}catch(y){throw l=y,new Error("Invalid mask: "+u)}for(p=d=32;d>=0;p=--d)if(this.maskLong===4294967295<<32-p>>>0){this.bitmask=p;break}}else if(u||u===0)this.bitmask=parseInt(u,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(f)&this.maskLong)>>>0}catch(y){throw l=y,new Error("Invalid net address: "+f)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+u);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(f){return typeof f=="string"&&(f.indexOf("/")>0||f.split(".").length!==4)&&(f=new c(f)),f instanceof c?this.contains(f.base)&&this.contains(f.broadcast||f.last):(s(f)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},c.prototype.next=function(f){return f==null&&(f=1),new c(a(this.netLong+this.size*f),this.mask)},c.prototype.forEach=function(f){var u,l,p;for(p=s(this.first),l=s(this.last),u=0;p<=l;)f(a(p),p,u),u++,p++},c.prototype.toString=function(){return this.base+"/"+this.bitmask},c}(),In.ip2long=s,In.long2ip=a,In.Netmask=t}).call(In)});var kc=ft((Pc,Ti)=>{(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(d,h){if(d.indexOf("::")!==d.lastIndexOf("::"))return null;let y=0,g=-1,x=(d.match(a.zoneIndex)||[])[0],m,b;for(x&&(x=x.substring(1),d=d.replace(/%.+$/,""));(g=d.indexOf(":",g+1))>=0;)y++;if(d.substr(0,2)==="::"&&y--,d.substr(-2,2)==="::"&&y--,y>h)return null;for(b=h-y,m=":";b--;)m+="0:";return d=d.replace("::",m),d[0]===":"&&(d=d.slice(1)),d[d.length-1]===":"&&(d=d.slice(0,-1)),h=function(){let _=d.split(":"),E=[];for(let S=0;S<_.length;S++)E.push(parseInt(_[S],16));return E}(),{parts:h,zoneId:x}}function f(d,h,y,g){if(d.length!==h.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let x=0,m;for(;g>0;){if(m=y-g,m<0&&(m=0),d[x]>>m!==h[x]>>m)return!1;g-=y,x+=1}return!0}function u(d){if(i.test(d))return parseInt(d,16);if(d[0]==="0"&&!isNaN(parseInt(d[1],10))){if(n.test(d))return parseInt(d,8);throw new Error(`ipaddr: cannot parse ${d} as octal`)}return parseInt(d,10)}function l(d,h){for(;d.length<h;)d=`0${d}`;return d}let p={};p.IPv4=function(){function d(h){if(h.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let y,g;for(y=0;y<h.length;y++)if(g=h[y],!(0<=g&&g<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=h}return d.prototype.SpecialRanges={unspecified:[[new d([0,0,0,0]),8]],broadcast:[[new d([255,255,255,255]),32]],multicast:[[new d([224,0,0,0]),4]],linkLocal:[[new d([169,254,0,0]),16]],loopback:[[new d([127,0,0,0]),8]],carrierGradeNat:[[new d([100,64,0,0]),10]],private:[[new d([10,0,0,0]),8],[new d([172,16,0,0]),12],[new d([192,168,0,0]),16]],reserved:[[new d([192,0,0,0]),24],[new d([192,0,2,0]),24],[new d([192,88,99,0]),24],[new d([198,18,0,0]),15],[new d([198,51,100,0]),24],[new d([203,0,113,0]),24],[new d([240,0,0,0]),4]]},d.prototype.kind=function(){return"ipv4"},d.prototype.match=function(h,y){let g;if(y===void 0&&(g=h,h=g[0],y=g[1]),h.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return f(this.octets,h.octets,8,y)},d.prototype.prefixLengthFromSubnetMask=function(){let h=0,y=!1,g={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},x,m,b;for(x=3;x>=0;x-=1)if(m=this.octets[x],m in g){if(b=g[m],y&&b!==0)return null;b!==8&&(y=!0),h+=b}else return null;return 32-h},d.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},d.prototype.toByteArray=function(){return this.octets.slice(0)},d.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},d.prototype.toNormalizedString=function(){return this.toString()},d.prototype.toString=function(){return this.octets.join(".")},d}(),p.IPv4.broadcastAddressFromCIDR=function(d){try{let h=this.parseCIDR(d),y=h[0].toByteArray(),g=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),x=[],m=0;for(;m<4;)x.push(parseInt(y[m],10)|parseInt(g[m],10)^255),m++;return new this(x)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},p.IPv4.isIPv4=function(d){return this.parser(d)!==null},p.IPv4.isValid=function(d){try{return new this(this.parser(d)),!0}catch{return!1}},p.IPv4.isValidFourPartDecimal=function(d){return!!(p.IPv4.isValid(d)&&d.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.networkAddressFromCIDR=function(d){let h,y,g,x,m;try{for(h=this.parseCIDR(d),g=h[0].toByteArray(),m=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),x=[],y=0;y<4;)x.push(parseInt(g[y],10)&parseInt(m[y],10)),y++;return new this(x)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},p.IPv4.parse=function(d){let h=this.parser(d);if(h===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(h)},p.IPv4.parseCIDR=function(d){let h;if(h=d.match(/^(.+)\/(\d+)$/)){let y=parseInt(h[2]);if(y>=0&&y<=32){let g=[this.parse(h[1]),y];return Object.defineProperty(g,"toString",{value:function(){return this.join("/")}}),g}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},p.IPv4.parser=function(d){let h,y,g;if(h=d.match(r.fourOctet))return function(){let x=h.slice(1,6),m=[];for(let b=0;b<x.length;b++)y=x[b],m.push(u(y));return m}();if(h=d.match(r.longValue)){if(g=u(h[1]),g>4294967295||g<0)throw new Error("ipaddr: address outside defined range");return function(){let x=[],m;for(m=0;m<=24;m+=8)x.push(g>>m&255);return x}().reverse()}else return(h=d.match(r.twoOctet))?function(){let x=h.slice(1,4),m=[];if(g=u(x[1]),g>16777215||g<0)throw new Error("ipaddr: address outside defined range");return m.push(u(x[0])),m.push(g>>16&255),m.push(g>>8&255),m.push(g&255),m}():(h=d.match(r.threeOctet))?function(){let x=h.slice(1,5),m=[];if(g=u(x[2]),g>65535||g<0)throw new Error("ipaddr: address outside defined range");return m.push(u(x[0])),m.push(u(x[1])),m.push(g>>8&255),m.push(g&255),m}():null},p.IPv4.subnetMaskFromPrefixLength=function(d){if(d=parseInt(d),d<0||d>32)throw new Error("ipaddr: invalid IPv4 prefix length");let h=[0,0,0,0],y=0,g=Math.floor(d/8);for(;y<g;)h[y]=255,y++;return g<4&&(h[g]=Math.pow(2,d%8)-1<<8-d%8),new this(h)},p.IPv6=function(){function d(h,y){let g,x;if(h.length===16)for(this.parts=[],g=0;g<=14;g+=2)this.parts.push(h[g]<<8|h[g+1]);else if(h.length===8)this.parts=h;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(g=0;g<this.parts.length;g++)if(x=this.parts[g],!(0<=x&&x<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");y&&(this.zoneId=y)}return d.prototype.SpecialRanges={unspecified:[new d([0,0,0,0,0,0,0,0]),128],linkLocal:[new d([65152,0,0,0,0,0,0,0]),10],multicast:[new d([65280,0,0,0,0,0,0,0]),8],loopback:[new d([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new d([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new d([0,0,0,0,0,65535,0,0]),96],rfc6145:[new d([0,0,0,0,65535,0,0,0]),96],rfc6052:[new d([100,65435,0,0,0,0,0,0]),96],"6to4":[new d([8194,0,0,0,0,0,0,0]),16],teredo:[new d([8193,0,0,0,0,0,0,0]),32],reserved:[[new d([8193,3512,0,0,0,0,0,0]),32]],benchmarking:[new d([8193,2,0,0,0,0,0,0]),48],amt:[new d([8193,3,0,0,0,0,0,0]),32],as112v6:[new d([8193,4,274,0,0,0,0,0]),48],deprecated:[new d([8193,16,0,0,0,0,0,0]),28],orchid2:[new d([8193,32,0,0,0,0,0,0]),28]},d.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},d.prototype.kind=function(){return"ipv6"},d.prototype.match=function(h,y){let g;if(y===void 0&&(g=h,h=g[0],y=g[1]),h.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return f(this.parts,h.parts,16,y)},d.prototype.prefixLengthFromSubnetMask=function(){let h=0,y=!1,g={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},x,m;for(let b=7;b>=0;b-=1)if(x=this.parts[b],x in g){if(m=g[x],y&&m!==0)return null;m!==16&&(y=!0),h+=m}else return null;return 128-h},d.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},d.prototype.toByteArray=function(){let h,y=[],g=this.parts;for(let x=0;x<g.length;x++)h=g[x],y.push(h>>8),y.push(h&255);return y},d.prototype.toFixedLengthString=function(){let h=function(){let g=[];for(let x=0;x<this.parts.length;x++)g.push(l(this.parts[x].toString(16),4));return g}.call(this).join(":"),y="";return this.zoneId&&(y=`%${this.zoneId}`),h+y},d.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),y=h[0],g=h[1];return new p.IPv4([y>>8,y&255,g>>8,g&255])},d.prototype.toNormalizedString=function(){let h=function(){let g=[];for(let x=0;x<this.parts.length;x++)g.push(this.parts[x].toString(16));return g}.call(this).join(":"),y="";return this.zoneId&&(y=`%${this.zoneId}`),h+y},d.prototype.toRFC5952String=function(){let h=/((^|:)(0(:|$)){2,})/g,y=this.toNormalizedString(),g=0,x=-1,m;for(;m=h.exec(y);)m[0].length>x&&(g=m.index,x=m[0].length);return x<0?y:`${y.substring(0,g)}::${y.substring(g+x)}`},d.prototype.toString=function(){return this.toRFC5952String()},d}(),p.IPv6.broadcastAddressFromCIDR=function(d){try{let h=this.parseCIDR(d),y=h[0].toByteArray(),g=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),x=[],m=0;for(;m<16;)x.push(parseInt(y[m],10)|parseInt(g[m],10)^255),m++;return new this(x)}catch(h){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${h})`)}},p.IPv6.isIPv6=function(d){return this.parser(d)!==null},p.IPv6.isValid=function(d){if(typeof d=="string"&&d.indexOf(":")===-1)return!1;try{let h=this.parser(d);return new this(h.parts,h.zoneId),!0}catch{return!1}},p.IPv6.networkAddressFromCIDR=function(d){let h,y,g,x,m;try{for(h=this.parseCIDR(d),g=h[0].toByteArray(),m=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),x=[],y=0;y<16;)x.push(parseInt(g[y],10)&parseInt(m[y],10)),y++;return new this(x)}catch(b){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${b})`)}},p.IPv6.parse=function(d){let h=this.parser(d);if(h.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(h.parts,h.zoneId)},p.IPv6.parseCIDR=function(d){let h,y,g;if((y=d.match(/^(.+)\/(\d+)$/))&&(h=parseInt(y[2]),h>=0&&h<=128))return g=[this.parse(y[1]),h],Object.defineProperty(g,"toString",{value:function(){return this.join("/")}}),g;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},p.IPv6.parser=function(d){let h,y,g,x,m,b;if(g=d.match(a.deprecatedTransitional))return this.parser(`::ffff:${g[1]}`);if(a.native.test(d))return c(d,8);if((g=d.match(a.transitional))&&(b=g[6]||"",h=c(g[1].slice(0,-1)+b,6),h.parts)){for(m=[parseInt(g[2]),parseInt(g[3]),parseInt(g[4]),parseInt(g[5])],y=0;y<m.length;y++)if(x=m[y],!(0<=x&&x<=255))return null;return h.parts.push(m[0]<<8|m[1]),h.parts.push(m[2]<<8|m[3]),{parts:h.parts,zoneId:h.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(d){if(d=parseInt(d),d<0||d>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],y=0,g=Math.floor(d/8);for(;y<g;)h[y]=255,y++;return g<16&&(h[g]=Math.pow(2,d%8)-1<<8-d%8),new this(h)},p.fromByteArray=function(d){let h=d.length;if(h===4)return new p.IPv4(d);if(h===16)return new p.IPv6(d);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},p.isValid=function(d){return p.IPv6.isValid(d)||p.IPv4.isValid(d)},p.parse=function(d){if(p.IPv6.isValid(d))return p.IPv6.parse(d);if(p.IPv4.isValid(d))return p.IPv4.parse(d);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},p.parseCIDR=function(d){try{return p.IPv6.parseCIDR(d)}catch{try{return p.IPv4.parseCIDR(d)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},p.process=function(d){let h=this.parse(d);return h.kind()==="ipv6"&&h.isIPv4MappedAddress()?h.toIPv4Address():h},p.subnetMatch=function(d,h,y){let g,x,m,b;y==null&&(y="unicast");for(x in h)if(Object.prototype.hasOwnProperty.call(h,x)){for(m=h[x],m[0]&&!(m[0]instanceof Array)&&(m=[m]),g=0;g<m.length;g++)if(b=m[g],d.kind()===b[0].kind()&&d.match.apply(d,b))return x}return y},typeof Ti<"u"&&Ti.exports?Ti.exports=p:t.ipaddr=p})(Pc)});var _y={};Ct(_y,{autoNAT:()=>Cy});var Ly=Symbol.for("@libp2p/connection");var Py=Symbol.for("@libp2p/content-routing");var Uy=Symbol.for("@libp2p/peer-discovery");var Qs=Symbol.for("@libp2p/peer-id");var Fy=Symbol.for("@libp2p/peer-routing");var Xs;(function(t){t.Accept="accept",t.Ignore="ignore",t.Reject="reject"})(Xs||(Xs={}));var Hy=Symbol.for("@libp2p/transport");var Js;(function(t){t[t.FATAL_ALL=0]="FATAL_ALL",t[t.NO_FATAL=1]="NO_FATAL"})(Js||(Js={}));var $=class extends Error{code;props;constructor(e,r,n){super(e),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var Ri="ERR_TIMEOUT";var Li=class extends Event{detail;constructor(e,r){super(e,r),this.detail=r?.detail}},Gy=globalThis.CustomEvent??Li;var Di=(t,...e)=>{try{[...e]}catch{}};var Oi={};Ct(Oi,{base58btc:()=>At,base58flickr:()=>au});var E2=new Uint8Array(0);function js(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}function Be(t){if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")}function ta(t){return new TextEncoder().encode(t)}function ea(t){return new TextDecoder().decode(t)}function ru(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=t.length,c=t.charAt(0),f=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function l(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var y=0,g=0,x=0,m=h.length;x!==m&&h[x]===0;)x++,y++;for(var b=(m-x)*u+1>>>0,_=new Uint8Array(b);x!==m;){for(var E=h[x],S=0,L=b-1;(E!==0||S<g)&&L!==-1;L--,S++)E+=256*_[L]>>>0,_[L]=E%a>>>0,E=E/a>>>0;if(E!==0)throw new Error("Non-zero carry");g=S,x++}for(var D=b-g;D!==b&&_[D]===0;)D++;for(var H=c.repeat(y);D<b;++D)H+=t.charAt(_[D]);return H}function p(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var y=0;if(h[y]!==" "){for(var g=0,x=0;h[y]===c;)g++,y++;for(var m=(h.length-y)*f+1>>>0,b=new Uint8Array(m);h[y];){var _=r[h.charCodeAt(y)];if(_===255)return;for(var E=0,S=m-1;(_!==0||E<x)&&S!==-1;S--,E++)_+=a*b[S]>>>0,b[S]=_%256>>>0,_=_/256>>>0;if(_!==0)throw new Error("Non-zero carry");x=E,y++}if(h[y]!==" "){for(var L=m-x;L!==m&&b[L]===0;)L++;for(var D=new Uint8Array(g+(m-L)),H=g;L!==m;)D[H++]=b[L++];return D}}}function d(h){var y=p(h);if(y)return y;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:p,decode:d}}var nu=ru,iu=nu,na=iu;var Pi=class{name;prefix;baseEncode;constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},ki=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return ia(this,e)}},Ni=class{decoders;constructor(e){this.decoders=e}or(e){return ia(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function ia(t,e){return new Ni({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var Ui=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Pi(e,r,n),this.decoder=new ki(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Sr({name:t,prefix:e,encode:r,decode:n}){return new Ui(t,e,r,n)}function qe({name:t,prefix:e,alphabet:r}){let{encode:n,decode:i}=na(r,t);return Sr({prefix:e,name:t,encode:n,decode:o=>Be(i(o))})}function ou(t,e,r,n){let i={};for(let u=0;u<e.length;++u)i[e[u]]=u;let o=t.length;for(;t[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,c=0,f=0;for(let u=0;u<o;++u){let l=i[t[u]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<r|l,a+=r,a>=8&&(a-=8,s[f++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s}function su(t,e,r){let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s!==0&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o}function vt({name:t,prefix:e,bitsPerChar:r,alphabet:n}){return Sr({prefix:e,name:t,encode(i){return su(i,n,r)},decode(i){return ou(i,n,r,t)}})}var At=qe({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),au=qe({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ki={};Ct(Ki,{base10:()=>fu});var fu=qe({prefix:"9",name:"base10",alphabet:"0123456789"});var Fi={};Ct(Fi,{base16:()=>cu,base16upper:()=>uu});var cu=vt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),uu=vt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Mi={};Ct(Mi,{base2:()=>lu});var lu=vt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Vi={};Ct(Vi,{base256emoji:()=>gu});var oa=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),hu=oa.reduce((t,e,r)=>(t[r]=e,t),[]),du=oa.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function pu(t){return t.reduce((e,r)=>(e+=hu[r],e),"")}function yu(t){let e=[];for(let r of t){let n=du[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var gu=Sr({prefix:"\u{1F680}",name:"base256emoji",encode:pu,decode:yu});var qi={};Ct(qi,{base32:()=>Ae,base32hex:()=>bu,base32hexpad:()=>Eu,base32hexpadupper:()=>Su,base32hexupper:()=>wu,base32pad:()=>mu,base32padupper:()=>vu,base32upper:()=>xu,base32z:()=>Bu});var Ae=vt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),xu=vt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),mu=vt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),vu=vt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),bu=vt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),wu=vt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Eu=vt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Su=vt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Bu=vt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Hi={};Ct(Hi,{base36:()=>Au,base36upper:()=>Iu});var Au=qe({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Iu=qe({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var zi={};Ct(zi,{base64:()=>Cn,base64pad:()=>Tu,base64url:()=>Cu,base64urlpad:()=>_u});var Cn=vt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Tu=vt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Cu=vt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),_u=vt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var $i={};Ct($i,{base8:()=>Ru});var Ru=vt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Gi={};Ct(Gi,{identity:()=>Lu});var Lu=Sr({prefix:"\0",name:"identity",encode:t=>ea(t),decode:t=>ta(t)});var K2=new TextEncoder,F2=new TextDecoder;var Yi={};Ct(Yi,{identity:()=>He});var ku=fa,sa=128,Nu=127,Uu=~Nu,Ou=Math.pow(2,31);function fa(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Ou;)e[r++]=t&255|sa,t/=128;for(;t&Uu;)e[r++]=t&255|sa,t>>>=7;return e[r]=t|0,fa.bytes=r-n+1,e}var Ku=Wi,Fu=128,aa=127;function Wi(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw Wi.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&aa)<<i:(s&aa)*Math.pow(2,i),i+=7}while(s>=Fu);return Wi.bytes=o-n,r}var Mu=Math.pow(2,7),Vu=Math.pow(2,14),qu=Math.pow(2,21),Hu=Math.pow(2,28),zu=Math.pow(2,35),$u=Math.pow(2,42),Gu=Math.pow(2,49),Wu=Math.pow(2,56),Yu=Math.pow(2,63),Zu=function(t){return t<Mu?1:t<Vu?2:t<qu?3:t<Hu?4:t<zu?5:t<$u?6:t<Gu?7:t<Wu?8:t<Yu?9:10},Qu={encode:ku,decode:Ku,encodingLength:Zu},Xu=Qu,jr=Xu;function tn(t,e=0){return[jr.decode(t,e),jr.decode.bytes]}function Br(t,e,r=0){return jr.encode(t,e,r),e}function Ar(t){return jr.encodingLength(t)}function ye(t,e){let r=e.byteLength,n=Ar(t),i=n+Ar(r),o=new Uint8Array(i+r);return Br(t,o,0),Br(r,o,n),o.set(e,i),new Ir(t,r,e,o)}function or(t){let e=Be(t),[r,n]=tn(e),[i,o]=tn(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Ir(r,i,s,e)}function ca(t,e){if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&js(t.bytes,r.bytes)}}var Ir=class{code;size;digest;bytes;constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var ua=0,Ju="identity",la=Be;function ju(t){return ye(ua,la(t))}var He={code:ua,name:Ju,encode:la,digest:ju};var Xi={};Ct(Xi,{sha256:()=>Ut,sha512:()=>tl});function Qi({name:t,code:e,encode:r}){return new Zi(t,e,r)}var Zi=class{name;code;encode;constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?ye(this.code,r):r.then(n=>ye(this.code,n))}else throw Error("Unknown type, must be binary type")}};function da(t){return async e=>new Uint8Array(await crypto.subtle.digest(t,e))}var Ut=Qi({name:"sha2-256",code:18,encode:da("SHA-256")}),tl=Qi({name:"sha2-512",code:19,encode:da("SHA-512")});function pa(t,e){let{bytes:r,version:n}=t;switch(n){case 0:return rl(r,Ji(t),e??At.encoder);default:return nl(r,Ji(t),e??Ae.encoder)}}var ya=new WeakMap;function Ji(t){let e=ya.get(t);if(e==null){let r=new Map;return ya.set(t,r),r}return e}var ee=class t{code;version;multihash;bytes;"/";constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==en)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==il)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=ye(e,r);return t.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return t.equals(this,e)}static equals(e,r){let n=r;return n!=null&&e.code===n.code&&e.version===n.version&&ca(e.multihash,n.multihash)}toString(e){return pa(this,e)}toJSON(){return{"/":pa(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof t)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new t(n,i,o,s??ga(n,i,o.bytes))}else if(r[ol]===!0){let{version:n,multihash:i,code:o}=r,s=or(i);return t.create(n,o,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==en)throw new Error(`Version 0 CID must use dag-pb (code: ${en}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=ga(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,en,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=Be(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new Ir(r.multihashCode,r.digestSize,o,i);return[r.version===0?t.createV0(s):t.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[l,p]=tn(e.subarray(r));return r+=p,l},i=n(),o=en;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),c=n(),f=r+c,u=f-s;return{version:i,codec:o,multihashCode:a,digestSize:c,multihashSize:u,size:f}}static parse(e,r){let[n,i]=el(e,r),o=t.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ji(o).set(n,e),o}};function el(t,e){switch(t[0]){case"Q":{let r=e??At;return[At.prefix,r.decode(`${At.prefix}${t}`)]}case At.prefix:{let r=e??At;return[At.prefix,r.decode(t)]}case Ae.prefix:{let r=e??Ae;return[Ae.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}}function rl(t,e,r){let{prefix:n}=r;if(n!==At.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let o=r.encode(t).slice(1);return e.set(n,o),o}else return i}function nl(t,e,r){let{prefix:n}=r,i=e.get(n);if(i==null){let o=r.encode(t);return e.set(n,o),o}else return i}var en=112,il=18;function ga(t,e,r){let n=Ar(t),i=n+Ar(e),o=new Uint8Array(i+r.byteLength);return Br(t,o,0),Br(e,o,n),o.set(r,i),o}var ol=Symbol.for("@ipld/js-cid/CID");var ze={...Gi,...Mi,...$i,...Ki,...Fi,...qi,...Hi,...Oi,...zi,...Vi},sg={...Xi,...Yi};function qt(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}var sl=Symbol.for("nodejs.util.inspect.custom"),xa=Object.values(ze).map(t=>t.decoder).reduce((t,e)=>t.or(e),ze.identity.decoder),ma=114,ji=36,to=37,rn=class{type;multihash;privateKey;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[Qs]=!0;toString(){return this.string==null&&(this.string=At.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return ee.createV1(ma,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e==null)return!1;if(e instanceof Uint8Array)return qt(this.multihash.bytes,e);if(typeof e=="string")return al(e).equals(this);if(e?.multihash?.bytes!=null)return qt(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[sl](){return`PeerId(${this.toString()})`}},Tr=class extends rn{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},Cr=class extends rn{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},_r=class extends rn{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}};function al(t,e){if(e=e??xa,t.charAt(0)==="1"||t.charAt(0)==="Q"){let r=or(At.decode(`z${t}`));return t.startsWith("12D")?new Cr({multihash:r}):t.startsWith("16U")?new _r({multihash:r}):new Tr({multihash:r})}return Rn(xa.decode(t))}function Rn(t){try{let e=or(t);if(e.code===He.code){if(e.digest.length===ji)return new Cr({multihash:e});if(e.digest.length===to)return new _r({multihash:e})}if(e.code===Ut.code)return new Tr({multihash:e})}catch{return fl(ee.decode(t))}throw new Error("Supplied PeerID CID is invalid")}function fl(t){if(t==null||t.multihash==null||t.version==null||t.version===1&&t.code!==ma)throw new Error("Supplied PeerID CID is invalid");let e=t.multihash;if(e.code===Ut.code)return new Tr({multihash:t.multihash});if(e.code===He.code){if(e.digest.length===ji)return new Cr({multihash:t.multihash});if(e.digest.length===to)return new _r({multihash:t.multihash})}throw new Error("Supplied PeerID CID is invalid")}async function va(t,e){return t.length===ji?new Cr({multihash:ye(He.code,t),privateKey:e}):t.length===to?new _r({multihash:ye(He.code,t),privateKey:e}):new Tr({multihash:await Ut.digest(t),publicKey:t,privateKey:e})}var db=Kt(an(),1),pb=Kt(N0(),1);var A1=Kt(ct(),1);function hr(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function ie(t=0){return globalThis.Buffer?.allocUnsafe!=null?hr(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function O0(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var U0=O0("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Bo=O0("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=ie(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Pd={utf8:U0,"utf-8":U0,hex:ze.base16,latin1:Bo,ascii:Bo,binary:Bo,...ze},Zn=Pd;function It(t,e="utf8"){let r=Zn[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?hr(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var es={};Ct(es,{Ed25519PrivateKey:()=>mr,Ed25519PublicKey:()=>gn,generateKeyPair:()=>Zp,generateKeyPairFromSeed:()=>bf,unmarshalEd25519PrivateKey:()=>Wp,unmarshalEd25519PublicKey:()=>Yp});var nx=Kt(Et(),1),ix=Kt($n(),1),K0=Kt(ct(),1);function Ft(t,e){if(globalThis.Buffer!=null)return hr(globalThis.Buffer.concat(t,e));e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=ie(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return hr(r)}function lt(t,e="utf8"){let r=Zn[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}function oe(t,e){let r=Uint8Array.from(t.abs().toByteArray());if(r=r[0]===0?r.subarray(1):r,e!=null){if(r.length>e)throw new Error("byte array longer than desired length");r=Ft([new Uint8Array(e-r.length),r])}return lt(r,"base64url")}function Zt(t){let e=F0(t);return new K0.default.jsbn.BigInteger(lt(e,"base16"),16)}function F0(t,e){let r=It(t,"base64urlpad");if(e!=null){if(r.length>e)throw new Error("byte array longer than desired length");r=Ft([new Uint8Array(e-r.length),r])}return r}function jt(t){return t==null?!1:typeof t.then=="function"&&typeof t.catch=="function"&&typeof t.finally=="function"}function M0(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function kd(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function Ao(t,...e){if(!kd(t))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function V0(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");M0(t.outputLen),M0(t.blockLen)}function kr(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function q0(t,e){Ao(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var Qn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function H0(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var Xn=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),se=(t,e)=>t<<32-e|t>>>e,Nd=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Nd)throw new Error("Non little-endian hardware is not supported");function Io(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function un(t){if(typeof t=="string"&&(t=Io(t)),!H0(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function Jn(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];if(!H0(i))throw new Error("Uint8Array expected");e+=i.length}let r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){let o=t[n];r.set(o,i),i+=o.length}return r}var Nr=class{clone(){return this._cloneInto()}},hx={}.toString;function jn(t){let e=n=>t().update(un(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function Ur(t=32){if(Qn&&typeof Qn.getRandomValues=="function")return Qn.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}function Ud(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),c=n?4:0,f=n?0:4;t.setUint32(e+c,s,n),t.setUint32(e+f,a,n)}var Or=class extends Nr{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Xn(this.buffer)}update(e){kr(this);let{view:r,buffer:n,blockLen:i}=this;e=un(e);let o=e.length;for(let s=0;s<o;){let a=Math.min(i-this.pos,o-s);if(a===i){let c=Xn(e);for(;i<=o-s;s+=i)this.process(c,s);continue}n.set(e.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){kr(this),q0(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:o}=this,{pos:s}=this;r[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(n,0),s=0);for(let l=s;l<i;l++)r[l]=0;Ud(n,i-8,BigInt(this.length*8),o),this.process(n,0);let a=Xn(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let f=c/4,u=this.get();if(f>u.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<f;l++)a.setUint32(4*l,u[l],o)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:r,buffer:n,length:i,finished:o,destroyed:s,pos:a}=this;return e.length=i,e.pos=a,e.finished=o,e.destroyed=s,i%r&&e.buffer.set(n),e}};var ti=BigInt(4294967295),To=BigInt(32);function z0(t,e=!1){return e?{h:Number(t&ti),l:Number(t>>To&ti)}:{h:Number(t>>To&ti)|0,l:Number(t&ti)|0}}function Od(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){let{h:o,l:s}=z0(t[i],e);[r[i],n[i]]=[o,s]}return[r,n]}var Kd=(t,e)=>BigInt(t>>>0)<<To|BigInt(e>>>0),Fd=(t,e,r)=>t>>>r,Md=(t,e,r)=>t<<32-r|e>>>r,Vd=(t,e,r)=>t>>>r|e<<32-r,qd=(t,e,r)=>t<<32-r|e>>>r,Hd=(t,e,r)=>t<<64-r|e>>>r-32,zd=(t,e,r)=>t>>>r-32|e<<64-r,$d=(t,e)=>e,Gd=(t,e)=>t,Wd=(t,e,r)=>t<<r|e>>>32-r,Yd=(t,e,r)=>e<<r|t>>>32-r,Zd=(t,e,r)=>e<<r-32|t>>>64-r,Qd=(t,e,r)=>t<<r-32|e>>>64-r;function Xd(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var Jd=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),jd=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,tp=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),ep=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,rp=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),np=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0;var ip={fromBig:z0,split:Od,toBig:Kd,shrSH:Fd,shrSL:Md,rotrSH:Vd,rotrSL:qd,rotrBH:Hd,rotrBL:zd,rotr32H:$d,rotr32L:Gd,rotlSH:Wd,rotlSL:Yd,rotlBH:Zd,rotlBL:Qd,add:Xd,add3L:Jd,add3H:jd,add4L:tp,add4H:ep,add5H:np,add5L:rp},W=ip;var[op,sp]=W.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),Ze=new Uint32Array(80),Qe=new Uint32Array(80),Co=class extends Or{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:r,Bh:n,Bl:i,Ch:o,Cl:s,Dh:a,Dl:c,Eh:f,El:u,Fh:l,Fl:p,Gh:d,Gl:h,Hh:y,Hl:g}=this;return[e,r,n,i,o,s,a,c,f,u,l,p,d,h,y,g]}set(e,r,n,i,o,s,a,c,f,u,l,p,d,h,y,g){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=o|0,this.Cl=s|0,this.Dh=a|0,this.Dl=c|0,this.Eh=f|0,this.El=u|0,this.Fh=l|0,this.Fl=p|0,this.Gh=d|0,this.Gl=h|0,this.Hh=y|0,this.Hl=g|0}process(e,r){for(let b=0;b<16;b++,r+=4)Ze[b]=e.getUint32(r),Qe[b]=e.getUint32(r+=4);for(let b=16;b<80;b++){let _=Ze[b-15]|0,E=Qe[b-15]|0,S=W.rotrSH(_,E,1)^W.rotrSH(_,E,8)^W.shrSH(_,E,7),L=W.rotrSL(_,E,1)^W.rotrSL(_,E,8)^W.shrSL(_,E,7),D=Ze[b-2]|0,H=Qe[b-2]|0,q=W.rotrSH(D,H,19)^W.rotrBH(D,H,61)^W.shrSH(D,H,6),M=W.rotrSL(D,H,19)^W.rotrBL(D,H,61)^W.shrSL(D,H,6),X=W.add4L(L,M,Qe[b-7],Qe[b-16]),at=W.add4H(X,S,q,Ze[b-7],Ze[b-16]);Ze[b]=at|0,Qe[b]=X|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:c,Dh:f,Dl:u,Eh:l,El:p,Fh:d,Fl:h,Gh:y,Gl:g,Hh:x,Hl:m}=this;for(let b=0;b<80;b++){let _=W.rotrSH(l,p,14)^W.rotrSH(l,p,18)^W.rotrBH(l,p,41),E=W.rotrSL(l,p,14)^W.rotrSL(l,p,18)^W.rotrBL(l,p,41),S=l&d^~l&y,L=p&h^~p&g,D=W.add5L(m,E,L,sp[b],Qe[b]),H=W.add5H(D,x,_,S,op[b],Ze[b]),q=D|0,M=W.rotrSH(n,i,28)^W.rotrBH(n,i,34)^W.rotrBH(n,i,39),X=W.rotrSL(n,i,28)^W.rotrBL(n,i,34)^W.rotrBL(n,i,39),at=n&o^n&a^o&a,Pt=i&s^i&c^s&c;x=y|0,m=g|0,y=d|0,g=h|0,d=l|0,h=p|0,{h:l,l:p}=W.add(f|0,u|0,H|0,q|0),f=a|0,u=c|0,a=o|0,c=s|0,o=n|0,s=i|0;let T=W.add3L(q,X,Pt);n=W.add3H(T,H,M,at),i=T|0}({h:n,l:i}=W.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=W.add(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:c}=W.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:f,l:u}=W.add(this.Dh|0,this.Dl|0,f|0,u|0),{h:l,l:p}=W.add(this.Eh|0,this.El|0,l|0,p|0),{h:d,l:h}=W.add(this.Fh|0,this.Fl|0,d|0,h|0),{h:y,l:g}=W.add(this.Gh|0,this.Gl|0,y|0,g|0),{h:x,l:m}=W.add(this.Hh|0,this.Hl|0,x|0,m|0),this.set(n,i,o,s,a,c,f,u,l,p,d,h,y,g,x,m)}roundClean(){Ze.fill(0),Qe.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var _o=jn(()=>new Co);var ri={};Ct(ri,{bitGet:()=>dp,bitLen:()=>hp,bitMask:()=>ln,bitSet:()=>pp,bytesToHex:()=>Re,bytesToNumberBE:()=>Le,bytesToNumberLE:()=>Xe,concatBytes:()=>De,createHmacDrbg:()=>Do,ensureBytes:()=>bt,equalBytes:()=>up,hexToBytes:()=>dr,hexToNumber:()=>Lo,isBytes:()=>ae,numberToBytesBE:()=>Je,numberToBytesLE:()=>pr,numberToHexUnpadded:()=>Y0,numberToVarBytesBE:()=>cp,utf8ToBytes:()=>lp,validateObject:()=>Ee});var W0=BigInt(0),ei=BigInt(1),ap=BigInt(2);function ae(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var fp=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Re(t){if(!ae(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=fp[t[r]];return e}function Y0(t){let e=t.toString(16);return e.length&1?`0${e}`:e}function Lo(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}var _e={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function $0(t){if(t>=_e._0&&t<=_e._9)return t-_e._0;if(t>=_e._A&&t<=_e._F)return t-(_e._A-10);if(t>=_e._a&&t<=_e._f)return t-(_e._a-10)}function dr(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);let e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){let s=$0(t.charCodeAt(o)),a=$0(t.charCodeAt(o+1));if(s===void 0||a===void 0){let c=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+o)}n[i]=s*16+a}return n}function Le(t){return Lo(Re(t))}function Xe(t){if(!ae(t))throw new Error("Uint8Array expected");return Lo(Re(Uint8Array.from(t).reverse()))}function Je(t,e){return dr(t.toString(16).padStart(e*2,"0"))}function pr(t,e){return Je(t,e).reverse()}function cp(t){return dr(Y0(t))}function bt(t,e,r){let n;if(typeof e=="string")try{n=dr(e)}catch(o){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${o}`)}else if(ae(e))n=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);let i=n.length;if(typeof r=="number"&&i!==r)throw new Error(`${t} expected ${r} bytes, got ${i}`);return n}function De(...t){let e=0;for(let i=0;i<t.length;i++){let o=t[i];if(!ae(o))throw new Error("Uint8Array expected");e+=o.length}let r=new Uint8Array(e),n=0;for(let i=0;i<t.length;i++){let o=t[i];r.set(o,n),n+=o.length}return r}function up(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}function lp(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function hp(t){let e;for(e=0;t>W0;t>>=ei,e+=1);return e}function dp(t,e){return t>>BigInt(e)&ei}var pp=(t,e,r)=>t|(r?ei:W0)<<BigInt(e),ln=t=>(ap<<BigInt(t-1))-ei,Ro=t=>new Uint8Array(t),G0=t=>Uint8Array.from(t);function Do(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=Ro(t),i=Ro(t),o=0,s=()=>{n.fill(1),i.fill(0),o=0},a=(...l)=>r(i,n,...l),c=(l=Ro())=>{i=a(G0([0]),l),n=a(),l.length!==0&&(i=a(G0([1]),l),n=a())},f=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let l=0,p=[];for(;l<e;){n=a();let d=n.slice();p.push(d),l+=n.length}return De(...p)};return(l,p)=>{s(),c(l);let d;for(;!(d=p(f()));)c();return s(),d}}var yp={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||ae(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Ee(t,e,r={}){let n=(i,o,s)=>{let a=yp[o];if(typeof a!="function")throw new Error(`Invalid validator "${o}", expected function`);let c=t[i];if(!(s&&c===void 0)&&!a(c,t))throw new Error(`Invalid param ${String(i)}=${c} (${typeof c}), expected ${o}`)};for(let[i,o]of Object.entries(e))n(i,o,!1);for(let[i,o]of Object.entries(r))n(i,o,!0);return t}var Tt=BigInt(0),gt=BigInt(1),yr=BigInt(2),gp=BigInt(3),Po=BigInt(4),Z0=BigInt(5),Q0=BigInt(8),xp=BigInt(9),mp=BigInt(16);function ut(t,e){let r=t%e;return r>=Tt?r:e+r}function vp(t,e,r){if(r<=Tt||e<Tt)throw new Error("Expected power/modulo > 0");if(r===gt)return Tt;let n=gt;for(;e>Tt;)e&gt&&(n=n*t%r),t=t*t%r,e>>=gt;return n}function xt(t,e,r){let n=t;for(;e-- >Tt;)n*=n,n%=r;return n}function ni(t,e){if(t===Tt||e<=Tt)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=ut(t,e),n=e,i=Tt,o=gt,s=gt,a=Tt;for(;r!==Tt;){let f=n/r,u=n%r,l=i-s*f,p=o-a*f;n=r,r=u,i=s,o=a,s=l,a=p}if(n!==gt)throw new Error("invert: does not exist");return ut(i,e)}function bp(t){let e=(t-gt)/yr,r,n,i;for(r=t-gt,n=0;r%yr===Tt;r/=yr,n++);for(i=yr;i<t&&vp(i,e,t)!==t-gt;i++);if(n===1){let s=(t+gt)/Po;return function(c,f){let u=c.pow(f,s);if(!c.eql(c.sqr(u),f))throw new Error("Cannot find square root");return u}}let o=(r+gt)/yr;return function(a,c){if(a.pow(c,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let f=n,u=a.pow(a.mul(a.ONE,i),r),l=a.pow(c,o),p=a.pow(c,r);for(;!a.eql(p,a.ONE);){if(a.eql(p,a.ZERO))return a.ZERO;let d=1;for(let y=a.sqr(p);d<f&&!a.eql(y,a.ONE);d++)y=a.sqr(y);let h=a.pow(u,gt<<BigInt(f-d-1));u=a.sqr(h),l=a.mul(l,h),p=a.mul(p,u),f=d}return l}}function wp(t){if(t%Po===gp){let e=(t+gt)/Po;return function(n,i){let o=n.pow(i,e);if(!n.eql(n.sqr(o),i))throw new Error("Cannot find square root");return o}}if(t%Q0===Z0){let e=(t-Z0)/Q0;return function(n,i){let o=n.mul(i,yr),s=n.pow(o,e),a=n.mul(i,s),c=n.mul(n.mul(a,yr),s),f=n.mul(a,n.sub(c,n.ONE));if(!n.eql(n.sqr(f),i))throw new Error("Cannot find square root");return f}}return t%mp,bp(t)}var X0=(t,e)=>(ut(t,e)&gt)===gt,Ep=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function ko(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=Ep.reduce((n,i)=>(n[i]="function",n),e);return Ee(t,r)}function Sp(t,e,r){if(r<Tt)throw new Error("Expected power > 0");if(r===Tt)return t.ONE;if(r===gt)return e;let n=t.ONE,i=e;for(;r>Tt;)r&gt&&(n=t.mul(n,i)),i=t.sqr(i),r>>=gt;return n}function Bp(t,e){let r=new Array(e.length),n=e.reduce((o,s,a)=>t.is0(s)?o:(r[a]=o,t.mul(o,s)),t.ONE),i=t.inv(n);return e.reduceRight((o,s,a)=>t.is0(s)?o:(r[a]=t.mul(o,r[a]),t.mul(o,s)),i),r}function No(t,e){let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function ii(t,e,r=!1,n={}){if(t<=Tt)throw new Error(`Expected Field ORDER > 0, got ${t}`);let{nBitLength:i,nByteLength:o}=No(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");let s=wp(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:ln(i),ZERO:Tt,ONE:gt,create:c=>ut(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return Tt<=c&&c<t},is0:c=>c===Tt,isOdd:c=>(c&gt)===gt,neg:c=>ut(-c,t),eql:(c,f)=>c===f,sqr:c=>ut(c*c,t),add:(c,f)=>ut(c+f,t),sub:(c,f)=>ut(c-f,t),mul:(c,f)=>ut(c*f,t),pow:(c,f)=>Sp(a,c,f),div:(c,f)=>ut(c*ni(f,t),t),sqrN:c=>c*c,addN:(c,f)=>c+f,subN:(c,f)=>c-f,mulN:(c,f)=>c*f,inv:c=>ni(c,t),sqrt:n.sqrt||(c=>s(a,c)),invertBatch:c=>Bp(a,c),cmov:(c,f,u)=>u?f:c,toBytes:c=>r?pr(c,o):Je(c,o),fromBytes:c=>{if(c.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${c.length}`);return r?Xe(c):Le(c)}});return Object.freeze(a)}function J0(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");let r=t.sqrt(e);return t.isOdd(r)?t.neg(r):r}function j0(t){if(typeof t!="bigint")throw new Error("field order must be bigint");let e=t.toString(2).length;return Math.ceil(e/8)}function Uo(t){let e=j0(t);return e+Math.ceil(e/2)}function tf(t,e,r=!1){let n=t.length,i=j0(e),o=Uo(e);if(n<16||n<o||n>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);let s=r?Le(t):Xe(t),a=ut(s,e-gt)+gt;return r?pr(a,i):Je(a,i)}var Ip=BigInt(0),Oo=BigInt(1);function oi(t,e){let r=(i,o)=>{let s=o.negate();return i?s:o},n=i=>{let o=Math.ceil(e/i)+1,s=2**(i-1);return{windows:o,windowSize:s}};return{constTimeNegate:r,unsafeLadder(i,o){let s=t.ZERO,a=i;for(;o>Ip;)o&Oo&&(s=s.add(a)),a=a.double(),o>>=Oo;return s},precomputeWindow(i,o){let{windows:s,windowSize:a}=n(o),c=[],f=i,u=f;for(let l=0;l<s;l++){u=f,c.push(u);for(let p=1;p<a;p++)u=u.add(f),c.push(u);f=u.double()}return c},wNAF(i,o,s){let{windows:a,windowSize:c}=n(i),f=t.ZERO,u=t.BASE,l=BigInt(2**i-1),p=2**i,d=BigInt(i);for(let h=0;h<a;h++){let y=h*c,g=Number(s&l);s>>=d,g>c&&(g-=p,s+=Oo);let x=y,m=y+Math.abs(g)-1,b=h%2!==0,_=g<0;g===0?u=u.add(r(b,o[x])):f=f.add(r(_,o[m]))}return{p:f,f:u}},wNAFCached(i,o,s,a){let c=i._WINDOW_SIZE||1,f=o.get(i);return f||(f=this.precomputeWindow(i,c),c!==1&&o.set(i,a(f))),this.wNAF(c,f,s)}}}function hn(t){return ko(t.Fp),Ee(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...No(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}var fe=BigInt(0),Qt=BigInt(1),si=BigInt(2),Tp=BigInt(8),Cp={zip215:!0};function _p(t){let e=hn(t);return Ee(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function ai(t){let e=_p(t),{Fp:r,n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:c}=e,f=si<<BigInt(a*8)-Qt,u=r.create,l=e.uvRatio||((P,A)=>{try{return{isValid:!0,value:r.sqrt(P*r.inv(A))}}catch{return{isValid:!1,value:fe}}}),p=e.adjustScalarBytes||(P=>P),d=e.domain||((P,A,O)=>{if(A.length||O)throw new Error("Contexts/pre-hash are not supported");return P}),h=P=>typeof P=="bigint"&&fe<P,y=(P,A)=>h(P)&&h(A)&&P<A,g=P=>P===fe||y(P,f);function x(P,A){if(y(P,A))return P;throw new Error(`Expected valid scalar < ${A}, got ${typeof P} ${P}`)}function m(P){return P===fe?P:x(P,n)}let b=new Map;function _(P){if(!(P instanceof E))throw new Error("ExtendedPoint expected")}class E{constructor(A,O,K,V){if(this.ex=A,this.ey=O,this.ez=K,this.et=V,!g(A))throw new Error("x required");if(!g(O))throw new Error("y required");if(!g(K))throw new Error("z required");if(!g(V))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(A){if(A instanceof E)throw new Error("extended point not allowed");let{x:O,y:K}=A||{};if(!g(O)||!g(K))throw new Error("invalid affine point");return new E(O,K,Qt,u(O*K))}static normalizeZ(A){let O=r.invertBatch(A.map(K=>K.ez));return A.map((K,V)=>K.toAffine(O[V])).map(E.fromAffine)}_setWindowSize(A){this._WINDOW_SIZE=A,b.delete(this)}assertValidity(){let{a:A,d:O}=e;if(this.is0())throw new Error("bad point: ZERO");let{ex:K,ey:V,ez:Z,et:J}=this,ot=u(K*K),j=u(V*V),rt=u(Z*Z),wt=u(rt*rt),mt=u(ot*A),kt=u(rt*u(mt+j)),Nt=u(wt+u(O*u(ot*j)));if(kt!==Nt)throw new Error("bad point: equation left != right (1)");let Bt=u(K*V),Ot=u(Z*J);if(Bt!==Ot)throw new Error("bad point: equation left != right (2)")}equals(A){_(A);let{ex:O,ey:K,ez:V}=this,{ex:Z,ey:J,ez:ot}=A,j=u(O*ot),rt=u(Z*V),wt=u(K*ot),mt=u(J*V);return j===rt&&wt===mt}is0(){return this.equals(E.ZERO)}negate(){return new E(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:A}=e,{ex:O,ey:K,ez:V}=this,Z=u(O*O),J=u(K*K),ot=u(si*u(V*V)),j=u(A*Z),rt=O+K,wt=u(u(rt*rt)-Z-J),mt=j+J,kt=mt-ot,Nt=j-J,Bt=u(wt*kt),Ot=u(mt*Nt),Se=u(wt*Nt),ir=u(kt*mt);return new E(Bt,Ot,ir,Se)}add(A){_(A);let{a:O,d:K}=e,{ex:V,ey:Z,ez:J,et:ot}=this,{ex:j,ey:rt,ez:wt,et:mt}=A;if(O===BigInt(-1)){let qs=u((Z-V)*(rt+j)),Hs=u((Z+V)*(rt-j)),_i=u(Hs-qs);if(_i===fe)return this.double();let zs=u(J*si*mt),$s=u(ot*si*wt),Gs=$s+zs,Ws=Hs+qs,Ys=$s-zs,Gc=u(Gs*_i),Wc=u(Ws*Ys),Yc=u(Gs*Ys),Zc=u(_i*Ws);return new E(Gc,Wc,Zc,Yc)}let kt=u(V*j),Nt=u(Z*rt),Bt=u(ot*K*mt),Ot=u(J*wt),Se=u((V+Z)*(j+rt)-kt-Nt),ir=Ot-Bt,Jr=Ot+Bt,Vs=u(Nt-O*kt),qc=u(Se*ir),Hc=u(Jr*Vs),zc=u(Se*Vs),$c=u(ir*Jr);return new E(qc,Hc,$c,zc)}subtract(A){return this.add(A.negate())}wNAF(A){return D.wNAFCached(this,b,A,E.normalizeZ)}multiply(A){let{p:O,f:K}=this.wNAF(x(A,n));return E.normalizeZ([O,K])[0]}multiplyUnsafe(A){let O=m(A);return O===fe?L:this.equals(L)||O===Qt?this:this.equals(S)?this.wNAF(O).p:D.unsafeLadder(this,O)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return D.unsafeLadder(this,n).is0()}toAffine(A){let{ex:O,ey:K,ez:V}=this,Z=this.is0();A==null&&(A=Z?Tp:r.inv(V));let J=u(O*A),ot=u(K*A),j=u(V*A);if(Z)return{x:fe,y:Qt};if(j!==Qt)throw new Error("invZ was invalid");return{x:J,y:ot}}clearCofactor(){let{h:A}=e;return A===Qt?this:this.multiplyUnsafe(A)}static fromHex(A,O=!1){let{d:K,a:V}=e,Z=r.BYTES;A=bt("pointHex",A,Z);let J=A.slice(),ot=A[Z-1];J[Z-1]=ot&-129;let j=Xe(J);j===fe||(O?x(j,f):x(j,r.ORDER));let rt=u(j*j),wt=u(rt-Qt),mt=u(K*rt-V),{isValid:kt,value:Nt}=l(wt,mt);if(!kt)throw new Error("Point.fromHex: invalid y coordinate");let Bt=(Nt&Qt)===Qt,Ot=(ot&128)!==0;if(!O&&Nt===fe&&Ot)throw new Error("Point.fromHex: x=0 and x_0=1");return Ot!==Bt&&(Nt=u(-Nt)),E.fromAffine({x:Nt,y:j})}static fromPrivateKey(A){return M(A).point}toRawBytes(){let{x:A,y:O}=this.toAffine(),K=pr(O,r.BYTES);return K[K.length-1]|=A&Qt?128:0,K}toHex(){return Re(this.toRawBytes())}}E.BASE=new E(e.Gx,e.Gy,Qt,u(e.Gx*e.Gy)),E.ZERO=new E(fe,Qt,Qt,fe);let{BASE:S,ZERO:L}=E,D=oi(E,a*8);function H(P){return ut(P,n)}function q(P){return H(Xe(P))}function M(P){let A=a;P=bt("private key",P,A);let O=bt("hashed private key",o(P),2*A),K=p(O.slice(0,A)),V=O.slice(A,2*A),Z=q(K),J=S.multiply(Z),ot=J.toRawBytes();return{head:K,prefix:V,scalar:Z,point:J,pointBytes:ot}}function X(P){return M(P).pointBytes}function at(P=new Uint8Array,...A){let O=De(...A);return q(o(d(O,bt("context",P),!!i)))}function Pt(P,A,O={}){P=bt("message",P),i&&(P=i(P));let{prefix:K,scalar:V,pointBytes:Z}=M(A),J=at(O.context,K,P),ot=S.multiply(J).toRawBytes(),j=at(O.context,ot,Z,P),rt=H(J+j*V);m(rt);let wt=De(ot,pr(rt,r.BYTES));return bt("result",wt,a*2)}let T=Cp;function k(P,A,O,K=T){let{context:V,zip215:Z}=K,J=r.BYTES;P=bt("signature",P,2*J),A=bt("message",A),i&&(A=i(A));let ot=Xe(P.slice(J,2*J)),j,rt,wt;try{j=E.fromHex(O,Z),rt=E.fromHex(P.slice(0,J),Z),wt=S.multiplyUnsafe(ot)}catch{return!1}if(!Z&&j.isSmallOrder())return!1;let mt=at(V,rt.toRawBytes(),j.toRawBytes(),A);return rt.add(j.multiplyUnsafe(mt)).subtract(wt).clearCofactor().equals(E.ZERO)}return S._setWindowSize(8),{CURVE:e,getPublicKey:X,sign:Pt,verify:k,ExtendedPoint:E,utils:{getExtendedPublicKey:M,randomPrivateKey:()=>s(r.BYTES),precompute(P=8,A=E.BASE){return A._setWindowSize(P),A.multiply(BigInt(3)),A}}}}var Fo=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),ef=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),kx=BigInt(0),Rp=BigInt(1),Ko=BigInt(2),Lp=BigInt(5),rf=BigInt(10),Dp=BigInt(20),Pp=BigInt(40),nf=BigInt(80);function kp(t){let e=Fo,n=t*t%e*t%e,i=xt(n,Ko,e)*n%e,o=xt(i,Rp,e)*t%e,s=xt(o,Lp,e)*o%e,a=xt(s,rf,e)*s%e,c=xt(a,Dp,e)*a%e,f=xt(c,Pp,e)*c%e,u=xt(f,nf,e)*f%e,l=xt(u,nf,e)*f%e,p=xt(l,rf,e)*s%e;return{pow_p_5_8:xt(p,Ko,e)*t%e,b2:n}}function Np(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function Up(t,e){let r=Fo,n=ut(e*e*e,r),i=ut(n*n*e,r),o=kp(t*i).pow_p_5_8,s=ut(t*n*o,r),a=ut(e*s*s,r),c=s,f=ut(s*ef,r),u=a===t,l=a===ut(-t,r),p=a===ut(-t*ef,r);return u&&(s=c),(l||p)&&(s=f),X0(s,r)&&(s=ut(-s,r)),{isValid:u||l,value:s}}var Pe=ii(Fo,void 0,!0),Mo={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Pe,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:_o,randomBytes:Ur,adjustScalarBytes:Np,uvRatio:Up},Kr=ai(Mo);function of(t,e,r){if(e.length>255)throw new Error("Context is too big");return Jn(Io("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,e.length]),e,t)}var Nx=ai({...Mo,domain:of}),Ux=ai({...Mo,domain:of,prehash:_o});var Op=(Pe.ORDER+BigInt(3))/BigInt(8),Ox=Pe.pow(Ko,Op),Kx=Pe.sqrt(Pe.neg(Pe.ONE)),Fx=(Pe.ORDER-BigInt(5))/BigInt(8),Mx=BigInt(486662);var Vx=J0(Pe,Pe.neg(BigInt(486664)));var qx=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),Hx=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),zx=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),$x=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");var Gx=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Fr=32,ke=64,fi=32;function sf(){let t=Kr.utils.randomPrivateKey(),e=Kr.getPublicKey(t);return{privateKey:uf(t,e),publicKey:e}}function af(t){if(t.length!==fi)throw new TypeError('"seed" must be 32 bytes in length.');if(!(t instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, or Uint8Array.');let e=t,r=Kr.getPublicKey(e);return{privateKey:uf(e,r),publicKey:r}}function ff(t,e){let r=t.subarray(0,fi);return Kr.sign(e instanceof Uint8Array?e:e.subarray(),r)}function cf(t,e,r){return Kr.verify(e,r instanceof Uint8Array?r:r.subarray(),t)}function uf(t,e){let r=new Uint8Array(ke);for(let n=0;n<fi;n++)r[n]=t[n],r[fi+n]=e[n];return r}var Gt={get(t=globalThis){let e=t.crypto;if(e==null||e.subtle==null)throw Object.assign(new Error("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p/blob/main/packages/crypto/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return e}};var Vo={alg:"A128GCM",ext:!0,k:"scm9jmO_4BJAgdwWGVulLg",key_ops:["encrypt","decrypt"],kty:"oct"};function qo(t){let e=t?.algorithm??"AES-GCM",r=t?.keyLength??16,n=t?.nonceLength??12,i=t?.digest??"SHA-256",o=t?.saltLength??16,s=t?.iterations??32767,a=Gt.get();r*=8;async function c(l,p){let d=a.getRandomValues(new Uint8Array(o)),h=a.getRandomValues(new Uint8Array(n)),y={name:e,iv:h};typeof p=="string"&&(p=It(p));let g;if(p.length===0){g=await a.subtle.importKey("jwk",Vo,{name:"AES-GCM"},!0,["encrypt"]);try{let m={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},b=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);g=await a.subtle.deriveKey(m,b,{name:e,length:r},!0,["encrypt"])}catch{g=await a.subtle.importKey("jwk",Vo,{name:"AES-GCM"},!0,["encrypt"])}}else{let m={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},b=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);g=await a.subtle.deriveKey(m,b,{name:e,length:r},!0,["encrypt"])}let x=await a.subtle.encrypt(y,g,l);return Ft([d,y.iv,new Uint8Array(x)])}async function f(l,p){let d=l.subarray(0,o),h=l.subarray(o,o+n),y=l.subarray(o+n),g={name:e,iv:h};typeof p=="string"&&(p=It(p));let x;if(p.length===0)try{let b={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},_=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);x=await a.subtle.deriveKey(b,_,{name:e,length:r},!0,["decrypt"])}catch{x=await a.subtle.importKey("jwk",Vo,{name:"AES-GCM"},!0,["decrypt"])}else{let b={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},_=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);x=await a.subtle.deriveKey(b,_,{name:e,length:r},!0,["decrypt"])}let m=await a.subtle.decrypt(g,x,y);return new Uint8Array(m)}return{encrypt:c,decrypt:f}}async function Mr(t,e){let n=await qo().encrypt(t,e);return Cn.encode(n)}var Ho=new Float32Array([-0]),je=new Uint8Array(Ho.buffer);function hf(t,e,r){Ho[0]=t,e[r]=je[0],e[r+1]=je[1],e[r+2]=je[2],e[r+3]=je[3]}function df(t,e){return je[0]=t[e],je[1]=t[e+1],je[2]=t[e+2],je[3]=t[e+3],Ho[0]}var zo=new Float64Array([-0]),Mt=new Uint8Array(zo.buffer);function pf(t,e,r){zo[0]=t,e[r]=Mt[0],e[r+1]=Mt[1],e[r+2]=Mt[2],e[r+3]=Mt[3],e[r+4]=Mt[4],e[r+5]=Mt[5],e[r+6]=Mt[6],e[r+7]=Mt[7]}function yf(t,e){return Mt[0]=t[e],Mt[1]=t[e+1],Mt[2]=t[e+2],Mt[3]=t[e+3],Mt[4]=t[e+4],Mt[5]=t[e+5],Mt[6]=t[e+6],Mt[7]=t[e+7],zo[0]}var Fp=BigInt(Number.MAX_SAFE_INTEGER),Mp=BigInt(Number.MIN_SAFE_INTEGER),Wt=class t{lo;hi;constructor(e,r){this.lo=e|0,this.hi=r|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(BigInt(r)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}static fromBigInt(e){if(e===0n)return gr;if(e<Fp&&e>Mp)return this.fromNumber(Number(e));let r=e<0n;r&&(e=-e);let n=e>>32n,i=e-(n<<32n);return r&&(n=~n|0n,i=~i|0n,++i>gf&&(i=0n,++n>gf&&(n=0n))),new t(Number(i),Number(n))}static fromNumber(e){if(e===0)return gr;let r=e<0;r&&(e=-e);let n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new t(n,i)}static from(e){return typeof e=="number"?t.fromNumber(e):typeof e=="bigint"?t.fromBigInt(e):typeof e=="string"?t.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new t(e.low>>>0,e.high>>>0):gr}},gr=new Wt(0,0);gr.toBigInt=function(){return 0n};gr.zzEncode=gr.zzDecode=function(){return this};gr.length=function(){return 1};var gf=4294967296n;function xf(t){let e=0,r=0;for(let n=0;n<t.length;++n)r=t.charCodeAt(n),r<128?e+=1:r<2048?e+=2:(r&64512)===55296&&(t.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e}function mf(t,e,r){if(r-e<1)return"";let i,o=[],s=0,a;for(;e<r;)a=t[e++],a<128?o[s++]=a:a>191&&a<224?o[s++]=(a&31)<<6|t[e++]&63:a>239&&a<365?(a=((a&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,o[s++]=55296+(a>>10),o[s++]=56320+(a&1023)):o[s++]=(a&15)<<12|(t[e++]&63)<<6|t[e++]&63,s>8191&&((i??(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i!=null?(s>0&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))}function $o(t,e,r){let n=r,i,o;for(let s=0;s<t.length;++s)i=t.charCodeAt(s),i<128?e[r++]=i:i<2048?(e[r++]=i>>6|192,e[r++]=i&63|128):(i&64512)===55296&&((o=t.charCodeAt(s+1))&64512)===56320?(i=65536+((i&1023)<<10)+(o&1023),++s,e[r++]=i>>18|240,e[r++]=i>>12&63|128,e[r++]=i>>6&63|128,e[r++]=i&63|128):(e[r++]=i>>12|224,e[r++]=i>>6&63|128,e[r++]=i&63|128);return r-n}function ce(t,e){return RangeError(`index out of range: ${t.pos} + ${e??1} > ${t.len}`)}function ci(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}var Go=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,ce(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw ce(this,4);return ci(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw ce(this,4);return ci(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw ce(this,4);let e=df(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw ce(this,4);let e=yf(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw ce(this,e);return this.pos+=e,r===n?new Uint8Array(0):this.buf.subarray(r,n)}string(){let e=this.bytes();return mf(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw ce(this,e);this.pos+=e}else do if(this.pos>=this.len)throw ce(this);while(this.buf[this.pos++]&128);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new Wt(0,0),r=0;if(this.len-this.pos>4){for(;r<4;++r)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;r=0}else{for(;r<3;++r){if(this.pos>=this.len)throw ce(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<r*7)>>>0,e}if(this.len-this.pos>4){for(;r<5;++r)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;r<5;++r){if(this.pos>=this.len)throw ce(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw ce(this,8);let e=ci(this.buf,this.pos+=4),r=ci(this.buf,this.pos+=4);return new Wt(e,r)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){return this.readLongVarint().toNumber(!0)}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function Wo(t){return new Go(t instanceof Uint8Array?t:t.subarray())}function ue(t,e){let r=Wo(t);return e.decode(r)}function Yo(t){let e=t??8192,r=e>>>1,n,i=e;return function(s){if(s<1||s>r)return ie(s);i+s>e&&(n=ie(e),i=0);let a=n.subarray(i,i+=s);return i&7&&(i=(i|7)+1),a}}var xr=class{fn;len;next;val;constructor(e,r,n){this.fn=e,this.len=r,this.next=void 0,this.val=n}};function Zo(){}var Xo=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},Vp=Yo();function qp(t){return globalThis.Buffer!=null?ie(t):Vp(t)}var yn=class{len;head;tail;states;constructor(){this.len=0,this.head=new xr(Zo,0,0),this.tail=this.head,this.states=null}_push(e,r,n){return this.tail=this.tail.next=new xr(e,r,n),this.len+=r,this}uint32(e){return this.len+=(this.tail=this.tail.next=new Jo((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(dn,10,Wt.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let r=Wt.fromBigInt(e);return this._push(dn,r.length(),r)}uint64Number(e){let r=Wt.fromNumber(e);return this._push(dn,r.length(),r)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let r=Wt.fromBigInt(e).zzEncode();return this._push(dn,r.length(),r)}sint64Number(e){let r=Wt.fromNumber(e).zzEncode();return this._push(dn,r.length(),r)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(Qo,1,e?1:0)}fixed32(e){return this._push(pn,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let r=Wt.fromBigInt(e);return this._push(pn,4,r.lo)._push(pn,4,r.hi)}fixed64Number(e){let r=Wt.fromNumber(e);return this._push(pn,4,r.lo)._push(pn,4,r.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(hf,4,e)}double(e){return this._push(pf,8,e)}bytes(e){let r=e.length>>>0;return r===0?this._push(Qo,1,0):this.uint32(r)._push(zp,r,e)}string(e){let r=xf(e);return r!==0?this.uint32(r)._push($o,r,e):this._push(Qo,1,0)}fork(){return this.states=new Xo(this),this.head=this.tail=new xr(Zo,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new xr(Zo,0,0),this.len=0),this}ldelim(){let e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=e.next,this.tail=r,this.len+=n),this}finish(){let e=this.head.next,r=qp(this.len),n=0;for(;e!=null;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r}};function Qo(t,e,r){e[r]=t&255}function Hp(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}var Jo=class extends xr{next;constructor(e,r){super(Hp,e,r),this.next=void 0}};function dn(t,e,r){for(;t.hi!==0;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}function pn(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function zp(t,e,r){e.set(t,r)}globalThis.Buffer!=null&&(yn.prototype.bytes=function(t){let e=t.length>>>0;return this.uint32(e),e>0&&this._push($p,e,t),this},yn.prototype.string=function(t){let e=globalThis.Buffer.byteLength(t);return this.uint32(e),e>0&&this._push(Gp,e,t),this});function $p(t,e,r){e.set(t,r)}function Gp(t,e,r){t.length<40?$o(t,e,r):e.utf8Write!=null?e.utf8Write(t,r):e.set(It(t),r)}function jo(){return new yn}function le(t,e){let r=jo();return e.encode(t,r,{lengthDelimited:!1}),r.finish()}var Vr;(function(t){t[t.VARINT=0]="VARINT",t[t.BIT64=1]="BIT64",t[t.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",t[t.START_GROUP=3]="START_GROUP",t[t.END_GROUP=4]="END_GROUP",t[t.BIT32=5]="BIT32"})(Vr||(Vr={}));function ui(t,e,r,n){return{name:t,type:e,encode:r,decode:n}}function qr(t){function e(i){if(t[i.toString()]==null)throw new Error("Invalid enum value");return t[i]}let r=function(o,s){let a=e(o);s.int32(a)},n=function(o){let s=o.int32();return e(s)};return ui("enum",Vr.VARINT,r,n)}function he(t,e){return ui("message",Vr.LENGTH_DELIMITED,t,e)}var Dt;(function(t){t.RSA="RSA",t.Ed25519="Ed25519",t.Secp256k1="Secp256k1"})(Dt||(Dt={}));var ts;(function(t){t[t.RSA=0]="RSA",t[t.Ed25519=1]="Ed25519",t[t.Secp256k1=2]="Secp256k1"})(ts||(ts={}));(function(t){t.codec=()=>qr(ts)})(Dt||(Dt={}));var Ne;(function(t){let e;t.codec=()=>(e==null&&(e=he((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),Dt.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},o=n==null?r.len:r.pos+n;for(;r.pos<o;){let s=r.uint32();switch(s>>>3){case 1:i.Type=Dt.codec().decode(r);break;case 2:i.Data=r.bytes();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>le(r,t.codec()),t.decode=r=>ue(r,t.codec())})(Ne||(Ne={}));var Ue;(function(t){let e;t.codec=()=>(e==null&&(e=he((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),Dt.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},o=n==null?r.len:r.pos+n;for(;r.pos<o;){let s=r.uint32();switch(s>>>3){case 1:i.Type=Dt.codec().decode(r);break;case 2:i.Data=r.bytes();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>le(r,t.codec()),t.decode=r=>ue(r,t.codec())})(Ue||(Ue={}));var gn=class{_key;constructor(e){this._key=Hr(e,Fr)}verify(e,r){return cf(this._key,r,e)}marshal(){return this._key}get bytes(){return Ne.encode({Type:Dt.Ed25519,Data:this.marshal()}).subarray()}equals(e){return qt(this.bytes,e.bytes)}hash(){let e=Ut.digest(this.bytes);return jt(e)?e.then(({bytes:r})=>r):e.bytes}},mr=class{_key;_publicKey;constructor(e,r){this._key=Hr(e,ke),this._publicKey=Hr(r,Fr)}sign(e){return ff(this._key,e)}get public(){return new gn(this._publicKey)}marshal(){return this._key}get bytes(){return Ue.encode({Type:Dt.Ed25519,Data:this.marshal()}).subarray()}equals(e){return qt(this.bytes,e.bytes)}async hash(){let e=Ut.digest(this.bytes),r;return jt(e)?{bytes:r}=await e:r=e.bytes,r}async id(){let e=He.digest(this.public.bytes);return At.encode(e.bytes).substring(1)}async export(e,r="libp2p-key"){if(r==="libp2p-key")return Mr(this.bytes,e);throw new $(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}};function Wp(t){if(t.length>ke){t=Hr(t,ke+Fr);let n=t.subarray(0,ke),i=t.subarray(ke,t.length);return new mr(n,i)}t=Hr(t,ke);let e=t.subarray(0,ke),r=t.subarray(Fr);return new mr(e,r)}function Yp(t){return t=Hr(t,Fr),new gn(t)}async function Zp(){let{privateKey:t,publicKey:e}=sf();return new mr(t,e)}async function bf(t){let{privateKey:e,publicKey:r}=af(t);return new mr(e,r)}function Hr(t,e){if(t=Uint8Array.from(t??[]),t.length!==e)throw new $(`Key must be a Uint8Array of length ${e}, got ${t.length}`,"ERR_INVALID_KEY_TYPE");return t}var Qp={"P-256":256,"P-384":384,"P-521":521},Xp=Object.keys(Qp),zm=Xp.join(" / ");var ss={};Ct(ss,{MAX_KEY_SIZE:()=>bn,RsaPrivateKey:()=>zr,RsaPublicKey:()=>vn,fromJwk:()=>f1,generateKeyPair:()=>c1,unmarshalRsaPrivateKey:()=>s1,unmarshalRsaPublicKey:()=>a1});var mn=Kt(ct(),1);var Cv=Kt(Af(),1);function hi(t){if(isNaN(t)||t<=0)throw new $("random bytes length must be a Number bigger than 0","ERR_INVALID_LENGTH");return Ur(t)}var uv=Kt(Yn(),1),is=Kt(ct(),1);function If(t,e){return e.map(r=>Zt(t[r]))}function Tf(t){return is.default.pki.setRsaPrivateKey(...If(t,["n","e","d","p","q","dp","dq","qi"]))}function Cf(t){return is.default.pki.setRsaPublicKey(...If(t,["n","e"]))}var br={};Ct(br,{jwkToPkcs1:()=>e1,jwkToPkix:()=>n1,pkcs1ToJwk:()=>t1,pkixToJwk:()=>r1});var dv=Kt(an(),1),pv=Kt(Yn(),1);var Oe=Kt(ct(),1);function t1(t){let e=Oe.default.asn1.fromDer(lt(t,"ascii")),r=Oe.default.pki.privateKeyFromAsn1(e);return{kty:"RSA",n:oe(r.n),e:oe(r.e),d:oe(r.d),p:oe(r.p),q:oe(r.q),dp:oe(r.dP),dq:oe(r.dQ),qi:oe(r.qInv),alg:"RS256"}}function e1(t){if(t.n==null||t.e==null||t.d==null||t.p==null||t.q==null||t.dp==null||t.dq==null||t.qi==null)throw new $("JWK was missing components","ERR_INVALID_PARAMETERS");let e=Oe.default.pki.privateKeyToAsn1({n:Zt(t.n),e:Zt(t.e),d:Zt(t.d),p:Zt(t.p),q:Zt(t.q),dP:Zt(t.dp),dQ:Zt(t.dq),qInv:Zt(t.qi)});return It(Oe.default.asn1.toDer(e).getBytes(),"ascii")}function r1(t){let e=Oe.default.asn1.fromDer(lt(t,"ascii")),r=Oe.default.pki.publicKeyFromAsn1(e);return{kty:"RSA",n:oe(r.n),e:oe(r.e)}}function n1(t){if(t.n==null||t.e==null)throw new $("JWK was missing components","ERR_INVALID_PARAMETERS");let e=Oe.default.pki.publicKeyToAsn1({n:Zt(t.n),e:Zt(t.e)});return It(Oe.default.asn1.toDer(e).getBytes(),"ascii")}async function _f(t){let e=await Gt.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),r=await Df(e);return{privateKey:r[0],publicKey:r[1]}}async function os(t){let r=[await Gt.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await i1(t)],n=await Df({privateKey:r[0],publicKey:r[1]});return{privateKey:n[0],publicKey:n[1]}}async function Rf(t,e){let r=await Gt.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),n=await Gt.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,e instanceof Uint8Array?e:e.subarray());return new Uint8Array(n,0,n.byteLength)}async function Lf(t,e,r){let n=await Gt.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return Gt.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},n,e,r instanceof Uint8Array?r:r.subarray())}async function Df(t){if(t.privateKey==null||t.publicKey==null)throw new $("Private and public key are required","ERR_INVALID_PARAMETERS");return Promise.all([Gt.get().subtle.exportKey("jwk",t.privateKey),Gt.get().subtle.exportKey("jwk",t.publicKey)])}async function i1(t){return Gt.get().subtle.importKey("jwk",{kty:t.kty,n:t.n,e:t.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}function Pf(t,e,r,n){let i=e?Cf(t):Tf(t),o=lt(r instanceof Uint8Array?r:r.subarray(),"ascii"),s=n(o,i);return It(s,"ascii")}function kf(t,e){return Pf(t,!0,e,(r,n)=>n.encrypt(r))}function Nf(t,e){return Pf(t,!1,e,(r,n)=>n.decrypt(r))}function di(t){if(t.kty!=="RSA")throw new $("invalid key type","ERR_INVALID_KEY_TYPE");if(t.n==null)throw new $("invalid key modulus","ERR_INVALID_KEY_MODULUS");return It(t.n,"base64url").length*8}var bn=8192,vn=class{_key;constructor(e){this._key=e}verify(e,r){return Lf(this._key,r,e)}marshal(){return br.jwkToPkix(this._key)}get bytes(){return Ne.encode({Type:Dt.RSA,Data:this.marshal()}).subarray()}encrypt(e){return kf(this._key,e)}equals(e){return qt(this.bytes,e.bytes)}hash(){let e=Ut.digest(this.bytes);return jt(e)?e.then(({bytes:r})=>r):e.bytes}},zr=class{_key;_publicKey;constructor(e,r){this._key=e,this._publicKey=r}genSecret(){return hi(16)}sign(e){return Rf(this._key,e)}get public(){if(this._publicKey==null)throw new $("public key not provided","ERR_PUBKEY_NOT_PROVIDED");return new vn(this._publicKey)}decrypt(e){return Nf(this._key,e)}marshal(){return br.jwkToPkcs1(this._key)}get bytes(){return Ue.encode({Type:Dt.RSA,Data:this.marshal()}).subarray()}equals(e){return qt(this.bytes,e.bytes)}hash(){let e=Ut.digest(this.bytes);return jt(e)?e.then(({bytes:r})=>r):e.bytes}async id(){let e=await this.public.hash();return lt(e,"base58btc")}async export(e,r="pkcs-8"){if(r==="pkcs-8"){let n=new mn.default.util.ByteBuffer(this.marshal()),i=mn.default.asn1.fromDer(n),o=mn.default.pki.privateKeyFromAsn1(i),s={algorithm:"aes256",count:1e4,saltSize:128/8,prfAlgorithm:"sha512"};return mn.default.pki.encryptRsaPrivateKey(o,e,s)}else{if(r==="libp2p-key")return Mr(this.bytes,e);throw new $(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}}};async function s1(t){let e=br.pkcs1ToJwk(t);if(di(e)>bn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let r=await os(e);return new zr(r.privateKey,r.publicKey)}function a1(t){let e=br.pkixToJwk(t);if(di(e)>bn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");return new vn(e)}async function f1(t){if(di(t)>bn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let e=await os(t);return new zr(e.privateKey,e.publicKey)}async function c1(t){if(t>bn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let e=await _f(t);return new zr(e.privateKey,e.publicKey)}var hs={};Ct(hs,{Secp256k1PrivateKey:()=>En,Secp256k1PublicKey:()=>wn,generateKeyPair:()=>B1,unmarshalSecp256k1PrivateKey:()=>E1,unmarshalSecp256k1PublicKey:()=>S1});var u1=(t,e,r)=>t&e^~t&r,l1=(t,e,r)=>t&e^t&r^e&r,h1=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),tr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),er=new Uint32Array(64),as=class extends Or{constructor(){super(64,32,8,!1),this.A=tr[0]|0,this.B=tr[1]|0,this.C=tr[2]|0,this.D=tr[3]|0,this.E=tr[4]|0,this.F=tr[5]|0,this.G=tr[6]|0,this.H=tr[7]|0}get(){let{A:e,B:r,C:n,D:i,E:o,F:s,G:a,H:c}=this;return[e,r,n,i,o,s,a,c]}set(e,r,n,i,o,s,a,c){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=c|0}process(e,r){for(let l=0;l<16;l++,r+=4)er[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){let p=er[l-15],d=er[l-2],h=se(p,7)^se(p,18)^p>>>3,y=se(d,17)^se(d,19)^d>>>10;er[l]=y+er[l-7]+h+er[l-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:c,G:f,H:u}=this;for(let l=0;l<64;l++){let p=se(a,6)^se(a,11)^se(a,25),d=u+p+u1(a,c,f)+h1[l]+er[l]|0,y=(se(n,2)^se(n,13)^se(n,22))+l1(n,i,o)|0;u=f,f=c,c=a,a=s+d|0,s=o,o=i,i=n,n=d+y|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,c=c+this.F|0,f=f+this.G|0,u=u+this.H|0,this.set(n,i,o,s,a,c,f,u)}roundClean(){er.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Uf=jn(()=>new as);function d1(t){let e=hn(t);Ee(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}var{bytesToNumberBE:p1,hexToBytes:y1}=ri,wr={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){let{Err:e}=wr;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");let r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:p1(n),l:t.subarray(r+2)}},toSig(t){let{Err:e}=wr,r=typeof t=="string"?y1(t):t;if(!ae(r))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");let{d:i,l:o}=wr._parseInt(r.subarray(2)),{d:s,l:a}=wr._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){let e=f=>Number.parseInt(f[0],16)&8?"00"+f:f,r=f=>{let u=f.toString(16);return u.length&1?`0${u}`:u},n=e(r(t.s)),i=e(r(t.r)),o=n.length/2,s=i.length/2,a=r(o),c=r(s);return`30${r(s+o+4)}02${c}${i}02${a}${n}`}},Ke=BigInt(0),te=BigInt(1),Kv=BigInt(2),Of=BigInt(3),Fv=BigInt(4);function g1(t){let e=d1(t),{Fp:r}=e,n=e.toBytes||((h,y,g)=>{let x=y.toAffine();return De(Uint8Array.from([4]),r.toBytes(x.x),r.toBytes(x.y))}),i=e.fromBytes||(h=>{let y=h.subarray(1),g=r.fromBytes(y.subarray(0,r.BYTES)),x=r.fromBytes(y.subarray(r.BYTES,2*r.BYTES));return{x:g,y:x}});function o(h){let{a:y,b:g}=e,x=r.sqr(h),m=r.mul(x,h);return r.add(r.add(m,r.mul(h,y)),g)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(h){return typeof h=="bigint"&&Ke<h&&h<e.n}function a(h){if(!s(h))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function c(h){let{allowedPrivateKeyLengths:y,nByteLength:g,wrapPrivateKey:x,n:m}=e;if(y&&typeof h!="bigint"){if(ae(h)&&(h=Re(h)),typeof h!="string"||!y.includes(h.length))throw new Error("Invalid key");h=h.padStart(g*2,"0")}let b;try{b=typeof h=="bigint"?h:Le(bt("private key",h,g))}catch{throw new Error(`private key must be ${g} bytes, hex or bigint, not ${typeof h}`)}return x&&(b=ut(b,m)),a(b),b}let f=new Map;function u(h){if(!(h instanceof l))throw new Error("ProjectivePoint expected")}class l{constructor(y,g,x){if(this.px=y,this.py=g,this.pz=x,y==null||!r.isValid(y))throw new Error("x required");if(g==null||!r.isValid(g))throw new Error("y required");if(x==null||!r.isValid(x))throw new Error("z required")}static fromAffine(y){let{x:g,y:x}=y||{};if(!y||!r.isValid(g)||!r.isValid(x))throw new Error("invalid affine point");if(y instanceof l)throw new Error("projective point not allowed");let m=b=>r.eql(b,r.ZERO);return m(g)&&m(x)?l.ZERO:new l(g,x,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(y){let g=r.invertBatch(y.map(x=>x.pz));return y.map((x,m)=>x.toAffine(g[m])).map(l.fromAffine)}static fromHex(y){let g=l.fromAffine(i(bt("pointHex",y)));return g.assertValidity(),g}static fromPrivateKey(y){return l.BASE.multiply(c(y))}_setWindowSize(y){this._WINDOW_SIZE=y,f.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:y,y:g}=this.toAffine();if(!r.isValid(y)||!r.isValid(g))throw new Error("bad point: x or y not FE");let x=r.sqr(g),m=o(y);if(!r.eql(x,m))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y}=this.toAffine();if(r.isOdd)return!r.isOdd(y);throw new Error("Field doesn't support isOdd")}equals(y){u(y);let{px:g,py:x,pz:m}=this,{px:b,py:_,pz:E}=y,S=r.eql(r.mul(g,E),r.mul(b,m)),L=r.eql(r.mul(x,E),r.mul(_,m));return S&&L}negate(){return new l(this.px,r.neg(this.py),this.pz)}double(){let{a:y,b:g}=e,x=r.mul(g,Of),{px:m,py:b,pz:_}=this,E=r.ZERO,S=r.ZERO,L=r.ZERO,D=r.mul(m,m),H=r.mul(b,b),q=r.mul(_,_),M=r.mul(m,b);return M=r.add(M,M),L=r.mul(m,_),L=r.add(L,L),E=r.mul(y,L),S=r.mul(x,q),S=r.add(E,S),E=r.sub(H,S),S=r.add(H,S),S=r.mul(E,S),E=r.mul(M,E),L=r.mul(x,L),q=r.mul(y,q),M=r.sub(D,q),M=r.mul(y,M),M=r.add(M,L),L=r.add(D,D),D=r.add(L,D),D=r.add(D,q),D=r.mul(D,M),S=r.add(S,D),q=r.mul(b,_),q=r.add(q,q),D=r.mul(q,M),E=r.sub(E,D),L=r.mul(q,H),L=r.add(L,L),L=r.add(L,L),new l(E,S,L)}add(y){u(y);let{px:g,py:x,pz:m}=this,{px:b,py:_,pz:E}=y,S=r.ZERO,L=r.ZERO,D=r.ZERO,H=e.a,q=r.mul(e.b,Of),M=r.mul(g,b),X=r.mul(x,_),at=r.mul(m,E),Pt=r.add(g,x),T=r.add(b,_);Pt=r.mul(Pt,T),T=r.add(M,X),Pt=r.sub(Pt,T),T=r.add(g,m);let k=r.add(b,E);return T=r.mul(T,k),k=r.add(M,at),T=r.sub(T,k),k=r.add(x,m),S=r.add(_,E),k=r.mul(k,S),S=r.add(X,at),k=r.sub(k,S),D=r.mul(H,T),S=r.mul(q,at),D=r.add(S,D),S=r.sub(X,D),D=r.add(X,D),L=r.mul(S,D),X=r.add(M,M),X=r.add(X,M),at=r.mul(H,at),T=r.mul(q,T),X=r.add(X,at),at=r.sub(M,at),at=r.mul(H,at),T=r.add(T,at),M=r.mul(X,T),L=r.add(L,M),M=r.mul(k,T),S=r.mul(Pt,S),S=r.sub(S,M),M=r.mul(Pt,X),D=r.mul(k,D),D=r.add(D,M),new l(S,L,D)}subtract(y){return this.add(y.negate())}is0(){return this.equals(l.ZERO)}wNAF(y){return d.wNAFCached(this,f,y,g=>{let x=r.invertBatch(g.map(m=>m.pz));return g.map((m,b)=>m.toAffine(x[b])).map(l.fromAffine)})}multiplyUnsafe(y){let g=l.ZERO;if(y===Ke)return g;if(a(y),y===te)return this;let{endo:x}=e;if(!x)return d.unsafeLadder(this,y);let{k1neg:m,k1:b,k2neg:_,k2:E}=x.splitScalar(y),S=g,L=g,D=this;for(;b>Ke||E>Ke;)b&te&&(S=S.add(D)),E&te&&(L=L.add(D)),D=D.double(),b>>=te,E>>=te;return m&&(S=S.negate()),_&&(L=L.negate()),L=new l(r.mul(L.px,x.beta),L.py,L.pz),S.add(L)}multiply(y){a(y);let g=y,x,m,{endo:b}=e;if(b){let{k1neg:_,k1:E,k2neg:S,k2:L}=b.splitScalar(g),{p:D,f:H}=this.wNAF(E),{p:q,f:M}=this.wNAF(L);D=d.constTimeNegate(_,D),q=d.constTimeNegate(S,q),q=new l(r.mul(q.px,b.beta),q.py,q.pz),x=D.add(q),m=H.add(M)}else{let{p:_,f:E}=this.wNAF(g);x=_,m=E}return l.normalizeZ([x,m])[0]}multiplyAndAddUnsafe(y,g,x){let m=l.BASE,b=(E,S)=>S===Ke||S===te||!E.equals(m)?E.multiplyUnsafe(S):E.multiply(S),_=b(this,g).add(b(y,x));return _.is0()?void 0:_}toAffine(y){let{px:g,py:x,pz:m}=this,b=this.is0();y==null&&(y=b?r.ONE:r.inv(m));let _=r.mul(g,y),E=r.mul(x,y),S=r.mul(m,y);if(b)return{x:r.ZERO,y:r.ZERO};if(!r.eql(S,r.ONE))throw new Error("invZ was invalid");return{x:_,y:E}}isTorsionFree(){let{h:y,isTorsionFree:g}=e;if(y===te)return!0;if(g)return g(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:y,clearCofactor:g}=e;return y===te?this:g?g(l,this):this.multiplyUnsafe(e.h)}toRawBytes(y=!0){return this.assertValidity(),n(l,this,y)}toHex(y=!0){return Re(this.toRawBytes(y))}}l.BASE=new l(e.Gx,e.Gy,r.ONE),l.ZERO=new l(r.ZERO,r.ONE,r.ZERO);let p=e.nBitLength,d=oi(l,e.endo?Math.ceil(p/2):p);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:s}}function x1(t){let e=hn(t);return Ee(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Kf(t){let e=x1(t),{Fp:r,n}=e,i=r.BYTES+1,o=2*r.BYTES+1;function s(T){return Ke<T&&T<r.ORDER}function a(T){return ut(T,n)}function c(T){return ni(T,n)}let{ProjectivePoint:f,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:p}=g1({...e,toBytes(T,k,R){let P=k.toAffine(),A=r.toBytes(P.x),O=De;return R?O(Uint8Array.from([k.hasEvenY()?2:3]),A):O(Uint8Array.from([4]),A,r.toBytes(P.y))},fromBytes(T){let k=T.length,R=T[0],P=T.subarray(1);if(k===i&&(R===2||R===3)){let A=Le(P);if(!s(A))throw new Error("Point is not on curve");let O=l(A),K=r.sqrt(O),V=(K&te)===te;return(R&1)===1!==V&&(K=r.neg(K)),{x:A,y:K}}else if(k===o&&R===4){let A=r.fromBytes(P.subarray(0,r.BYTES)),O=r.fromBytes(P.subarray(r.BYTES,2*r.BYTES));return{x:A,y:O}}else throw new Error(`Point of length ${k} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}}),d=T=>Re(Je(T,e.nByteLength));function h(T){let k=n>>te;return T>k}function y(T){return h(T)?a(-T):T}let g=(T,k,R)=>Le(T.slice(k,R));class x{constructor(k,R,P){this.r=k,this.s=R,this.recovery=P,this.assertValidity()}static fromCompact(k){let R=e.nByteLength;return k=bt("compactSignature",k,R*2),new x(g(k,0,R),g(k,R,2*R))}static fromDER(k){let{r:R,s:P}=wr.toSig(bt("DER",k));return new x(R,P)}assertValidity(){if(!p(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!p(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(k){return new x(this.r,this.s,k)}recoverPublicKey(k){let{r:R,s:P,recovery:A}=this,O=L(bt("msgHash",k));if(A==null||![0,1,2,3].includes(A))throw new Error("recovery id invalid");let K=A===2||A===3?R+e.n:R;if(K>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let V=A&1?"03":"02",Z=f.fromHex(V+d(K)),J=c(K),ot=a(-O*J),j=a(P*J),rt=f.BASE.multiplyAndAddUnsafe(Z,ot,j);if(!rt)throw new Error("point at infinify");return rt.assertValidity(),rt}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new x(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return dr(this.toDERHex())}toDERHex(){return wr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return dr(this.toCompactHex())}toCompactHex(){return d(this.r)+d(this.s)}}let m={isValidPrivateKey(T){try{return u(T),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{let T=Uo(e.n);return tf(e.randomBytes(T),e.n)},precompute(T=8,k=f.BASE){return k._setWindowSize(T),k.multiply(BigInt(3)),k}};function b(T,k=!0){return f.fromPrivateKey(T).toRawBytes(k)}function _(T){let k=ae(T),R=typeof T=="string",P=(k||R)&&T.length;return k?P===i||P===o:R?P===2*i||P===2*o:T instanceof f}function E(T,k,R=!0){if(_(T))throw new Error("first arg must be private key");if(!_(k))throw new Error("second arg must be public key");return f.fromHex(k).multiply(u(T)).toRawBytes(R)}let S=e.bits2int||function(T){let k=Le(T),R=T.length*8-e.nBitLength;return R>0?k>>BigInt(R):k},L=e.bits2int_modN||function(T){return a(S(T))},D=ln(e.nBitLength);function H(T){if(typeof T!="bigint")throw new Error("bigint expected");if(!(Ke<=T&&T<D))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Je(T,e.nByteLength)}function q(T,k,R=M){if(["recovered","canonical"].some(mt=>mt in R))throw new Error("sign() legacy options not supported");let{hash:P,randomBytes:A}=e,{lowS:O,prehash:K,extraEntropy:V}=R;O==null&&(O=!0),T=bt("msgHash",T),K&&(T=bt("prehashed msgHash",P(T)));let Z=L(T),J=u(k),ot=[H(J),H(Z)];if(V!=null){let mt=V===!0?A(r.BYTES):V;ot.push(bt("extraEntropy",mt))}let j=De(...ot),rt=Z;function wt(mt){let kt=S(mt);if(!p(kt))return;let Nt=c(kt),Bt=f.BASE.multiply(kt).toAffine(),Ot=a(Bt.x);if(Ot===Ke)return;let Se=a(Nt*a(rt+Ot*J));if(Se===Ke)return;let ir=(Bt.x===Ot?0:2)|Number(Bt.y&te),Jr=Se;return O&&h(Se)&&(Jr=y(Se),ir^=1),new x(Ot,Jr,ir)}return{seed:j,k2sig:wt}}let M={lowS:e.lowS,prehash:!1},X={lowS:e.lowS,prehash:!1};function at(T,k,R=M){let{seed:P,k2sig:A}=q(T,k,R),O=e;return Do(O.hash.outputLen,O.nByteLength,O.hmac)(P,A)}f.BASE._setWindowSize(8);function Pt(T,k,R,P=X){let A=T;if(k=bt("msgHash",k),R=bt("publicKey",R),"strict"in P)throw new Error("options.strict was renamed to lowS");let{lowS:O,prehash:K}=P,V,Z;try{if(typeof A=="string"||ae(A))try{V=x.fromDER(A)}catch(Bt){if(!(Bt instanceof wr.Err))throw Bt;V=x.fromCompact(A)}else if(typeof A=="object"&&typeof A.r=="bigint"&&typeof A.s=="bigint"){let{r:Bt,s:Ot}=A;V=new x(Bt,Ot)}else throw new Error("PARSE");Z=f.fromHex(R)}catch(Bt){if(Bt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(O&&V.hasHighS())return!1;K&&(k=e.hash(k));let{r:J,s:ot}=V,j=L(k),rt=c(ot),wt=a(j*rt),mt=a(J*rt),kt=f.BASE.multiplyAndAddUnsafe(Z,wt,mt)?.toAffine();return kt?a(kt.x)===J:!1}return{CURVE:e,getPublicKey:b,getSharedSecret:E,sign:at,verify:Pt,ProjectivePoint:f,Signature:x,utils:m}}var pi=class extends Nr{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,V0(e);let n=un(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,o=new Uint8Array(i);o.set(n.length>i?e.create().update(n).digest():n);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=e.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),o.fill(0)}update(e){return kr(this),this.iHash.update(e),this}digestInto(e){kr(this),Ao(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:n,finished:i,destroyed:o,blockLen:s,outputLen:a}=this;return e=e,e.finished=i,e.destroyed=o,e.blockLen=s,e.outputLen=a,e.oHash=r._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},fs=(t,e,r)=>new pi(t,e).update(r).digest();fs.create=(t,e)=>new pi(t,e);function m1(t){return{hash:t,hmac:(e,...r)=>fs(t,e,Jn(...r)),randomBytes:Ur}}function Ff(t,e){let r=n=>Kf({...t,...m1(n)});return Object.freeze({...r(e),create:r})}var qf=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Mf=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),v1=BigInt(1),cs=BigInt(2),Vf=(t,e)=>(t+e/cs)/e;function b1(t){let e=qf,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),c=BigInt(88),f=t*t*t%e,u=f*f*t%e,l=xt(u,r,e)*u%e,p=xt(l,r,e)*u%e,d=xt(p,cs,e)*f%e,h=xt(d,i,e)*d%e,y=xt(h,o,e)*h%e,g=xt(y,a,e)*y%e,x=xt(g,c,e)*g%e,m=xt(x,a,e)*y%e,b=xt(m,r,e)*u%e,_=xt(b,s,e)*h%e,E=xt(_,n,e)*f%e,S=xt(E,cs,e);if(!us.eql(us.sqr(S),t))throw new Error("Cannot find square root");return S}var us=ii(qf,void 0,void 0,{sqrt:b1}),de=Ff({a:BigInt(0),b:BigInt(7),Fp:us,n:Mf,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=Mf,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-v1*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),a=Vf(o*t,e),c=Vf(-n*t,e),f=ut(t-a*r-c*i,e),u=ut(-a*n-c*o,e),l=f>s,p=u>s;if(l&&(f=e-f),p&&(u=e-u),f>s||u>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:f,k2neg:p,k2:u}}}},Uf),Xv=BigInt(0);var Jv=de.ProjectivePoint;function Hf(){return de.utils.randomPrivateKey()}function zf(t,e){let r=Ut.digest(e instanceof Uint8Array?e:e.subarray());if(jt(r))return r.then(({digest:n})=>de.sign(n,t).toDERRawBytes()).catch(n=>{throw new $(String(n),"ERR_INVALID_INPUT")});try{return de.sign(r.digest,t).toDERRawBytes()}catch(n){throw new $(String(n),"ERR_INVALID_INPUT")}}function $f(t,e,r){let n=Ut.digest(r instanceof Uint8Array?r:r.subarray());if(jt(n))return n.then(({digest:i})=>de.verify(e,i,t)).catch(i=>{throw new $(String(i),"ERR_INVALID_INPUT")});try{return de.verify(e,n.digest,t)}catch(i){throw new $(String(i),"ERR_INVALID_INPUT")}}function Gf(t){return de.ProjectivePoint.fromHex(t).toRawBytes(!0)}function Wf(t){try{de.getPublicKey(t,!0)}catch(e){throw new $(String(e),"ERR_INVALID_PRIVATE_KEY")}}function ls(t){try{de.ProjectivePoint.fromHex(t)}catch(e){throw new $(String(e),"ERR_INVALID_PUBLIC_KEY")}}function Yf(t){try{return de.getPublicKey(t,!0)}catch(e){throw new $(String(e),"ERR_INVALID_PRIVATE_KEY")}}var wn=class{_key;constructor(e){ls(e),this._key=e}verify(e,r){return $f(this._key,r,e)}marshal(){return Gf(this._key)}get bytes(){return Ne.encode({Type:Dt.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return qt(this.bytes,e.bytes)}async hash(){let e=Ut.digest(this.bytes),r;return jt(e)?{bytes:r}=await e:r=e.bytes,r}},En=class{_key;_publicKey;constructor(e,r){this._key=e,this._publicKey=r??Yf(e),Wf(this._key),ls(this._publicKey)}sign(e){return zf(this._key,e)}get public(){return new wn(this._publicKey)}marshal(){return this._key}get bytes(){return Ue.encode({Type:Dt.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return qt(this.bytes,e.bytes)}hash(){let e=Ut.digest(this.bytes);return jt(e)?e.then(({bytes:r})=>r):e.bytes}async id(){let e=await this.public.hash();return lt(e,"base58btc")}async export(e,r="libp2p-key"){if(r==="libp2p-key")return Mr(this.bytes,e);throw new $(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}};function E1(t){return new En(t)}function S1(t){return new wn(t)}async function B1(){let t=Hf();return new En(t)}var Zf={rsa:ss,ed25519:es,secp256k1:hs};function I1(t){let e=Object.keys(Zf).join(" / ");return new $(`invalid or unsupported key type ${t}. Must be ${e}`,"ERR_UNSUPPORTED_KEY_TYPE")}function ds(t){if(t=t.toLowerCase(),t==="rsa"||t==="ed25519"||t==="secp256k1")return Zf[t];throw I1(t)}async function Qf(t,e){return ds(t).generateKeyPair(e??2048)}function Xf(t,e){return e=(e??"rsa").toLowerCase(),ds(e),t.bytes}function Jf(t,e){return e=(e??"rsa").toLowerCase(),ds(e),t.bytes}var ps;(function(t){let e;t.codec=()=>(e==null&&(e=he((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.id!=null&&(n.uint32(10),n.bytes(r.id)),r.pubKey!=null&&(n.uint32(18),n.bytes(r.pubKey)),r.privKey!=null&&(n.uint32(26),n.bytes(r.privKey)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},o=n==null?r.len:r.pos+n;for(;r.pos<o;){let s=r.uint32();switch(s>>>3){case 1:i.id=r.bytes();break;case 2:i.pubKey=r.bytes();break;case 3:i.privKey=r.bytes();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>le(r,t.codec()),t.decode=r=>ue(r,t.codec())})(ps||(ps={}));var jf=async()=>{let t=await Qf("Ed25519"),e=await T1(t);if(e.type==="Ed25519")return e;throw new Error(`Generated unexpected PeerId type "${e.type}"`)};async function T1(t){return va(Xf(t.public),Jf(t))}var C1=Math.pow(2,7),_1=Math.pow(2,14),R1=Math.pow(2,21),ys=Math.pow(2,28),gs=Math.pow(2,35),xs=Math.pow(2,42),ms=Math.pow(2,49),it=128,Vt=127;function Yt(t){if(t<C1)return 1;if(t<_1)return 2;if(t<R1)return 3;if(t<ys)return 4;if(t<gs)return 5;if(t<xs)return 6;if(t<ms)return 7;if(Number.MAX_SAFE_INTEGER!=null&&t>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function L1(t,e,r=0){switch(Yt(t)){case 8:e[r++]=t&255|it,t/=128;case 7:e[r++]=t&255|it,t/=128;case 6:e[r++]=t&255|it,t/=128;case 5:e[r++]=t&255|it,t/=128;case 4:e[r++]=t&255|it,t>>>=7;case 3:e[r++]=t&255|it,t>>>=7;case 2:e[r++]=t&255|it,t>>>=7;case 1:{e[r++]=t&255,t>>>=7;break}default:throw new Error("unreachable")}return e}function D1(t,e,r=0){switch(Yt(t)){case 8:e.set(r++,t&255|it),t/=128;case 7:e.set(r++,t&255|it),t/=128;case 6:e.set(r++,t&255|it),t/=128;case 5:e.set(r++,t&255|it),t/=128;case 4:e.set(r++,t&255|it),t>>>=7;case 3:e.set(r++,t&255|it),t>>>=7;case 2:e.set(r++,t&255|it),t>>>=7;case 1:{e.set(r++,t&255),t>>>=7;break}default:throw new Error("unreachable")}return e}function P1(t,e){let r=t[e],n=0;if(n+=r&Vt,r<it||(r=t[e+1],n+=(r&Vt)<<7,r<it)||(r=t[e+2],n+=(r&Vt)<<14,r<it)||(r=t[e+3],n+=(r&Vt)<<21,r<it)||(r=t[e+4],n+=(r&Vt)*ys,r<it)||(r=t[e+5],n+=(r&Vt)*gs,r<it)||(r=t[e+6],n+=(r&Vt)*xs,r<it)||(r=t[e+7],n+=(r&Vt)*ms,r<it))return n;throw new RangeError("Could not decode varint")}function k1(t,e){let r=t.get(e),n=0;if(n+=r&Vt,r<it||(r=t.get(e+1),n+=(r&Vt)<<7,r<it)||(r=t.get(e+2),n+=(r&Vt)<<14,r<it)||(r=t.get(e+3),n+=(r&Vt)<<21,r<it)||(r=t.get(e+4),n+=(r&Vt)*ys,r<it)||(r=t.get(e+5),n+=(r&Vt)*gs,r<it)||(r=t.get(e+6),n+=(r&Vt)*xs,r<it)||(r=t.get(e+7),n+=(r&Vt)*ms,r<it))return n;throw new RangeError("Could not decode varint")}function rr(t,e,r=0){return e==null&&(e=ie(Yt(t))),e instanceof Uint8Array?L1(t,e,r):D1(t,e,r)}function Fe(t,e=0){return t instanceof Uint8Array?P1(t,e):k1(t,e)}var gi=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let r=this.index,n=e();return n===void 0&&(this.index=r),n}parseWith(e){let r=e();if(this.index===this.input.length)return r}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let r=this.readChar();if(r===e)return r})}readSeparator(e,r,n){return this.readAtomically(()=>{if(!(r>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,r,n,i){return this.readAtomically(()=>{let o=0,s=0,a=this.peekChar();if(a===void 0)return;let c=a==="0",f=2**(8*i)-1;for(;;){let u=this.readAtomically(()=>{let l=this.readChar();if(l===void 0)return;let p=Number.parseInt(l,e);if(!Number.isNaN(p))return p});if(u===void 0)break;if(o*=e,o+=u,o>f||(s+=1,r!==void 0&&s>r))return}if(s!==0)return!n&&c&&s>1?void 0:o})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let r=0;r<e.length;r++){let n=this.readSeparator(".",r,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[r]=n}return e})}readIPv6Addr(){let e=r=>{for(let n=0;n<r.length/2;n++){let i=n*2;if(n<r.length-3){let s=this.readSeparator(":",n,()=>this.readIPv4Addr());if(s!==void 0)return r[i]=s[0],r[i+1]=s[1],r[i+2]=s[2],r[i+3]=s[3],[i+4,!0]}let o=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(o===void 0)return[i,!1];r[i]=o>>8,r[i+1]=o&255}return[r.length,!1]};return this.readAtomically(()=>{let r=new Uint8Array(16),[n,i]=e(r);if(n===16)return r;if(i||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let o=new Uint8Array(14),s=16-(n+2),[a]=e(o.subarray(0,s));return r.set(o.subarray(0,a),16-a),r})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var tc=45,N1=15,$r=new gi;function vs(t){if(!(t.length>N1))return $r.new(t).parseWith(()=>$r.readIPv4Addr())}function bs(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>tc))return $r.new(t).parseWith(()=>$r.readIPv6Addr())}function xi(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>tc))return $r.new(t).parseWith(()=>$r.readIPAddr())}var Mb=parseInt("0xFFFF",16),Vb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function nc(t){return!!vs(t)}function ic(t){return!!bs(t)}function Gr(t){return!!xi(t)}var oc=nc,M1=ic,ws=function(t){let e=0;if(t=t.toString().trim(),oc(t)){let r=new Uint8Array(e+4);return t.split(/\./g).forEach(n=>{r[e++]=parseInt(n,10)&255}),r}if(M1(t)){let r=t.split(":",8),n;for(n=0;n<r.length;n++){let o=oc(r[n]),s;o&&(s=ws(r[n]),r[n]=lt(s.slice(0,2),"base16")),s!=null&&++n<8&&r.splice(n,0,lt(s.slice(2,4),"base16"))}if(r[0]==="")for(;r.length<8;)r.unshift("0");else if(r[r.length-1]==="")for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&r[n]!=="";n++);let o=[n,1];for(n=9-r.length;n>0;n--)o.push("0");r.splice.apply(r,o)}let i=new Uint8Array(e+16);for(n=0;n<r.length;n++){let o=parseInt(r[n],16);i[e++]=o>>8&255,i[e++]=o&255}return i}throw new Error("invalid ip address")},sc=function(t,e=0,r){e=~~e,r=r??t.length-e;let n=new DataView(t.buffer);if(r===4){let i=[];for(let o=0;o<r;o++)i.push(t[e+o]);return i.join(".")}if(r===16){let i=[];for(let o=0;o<r;o+=2)i.push(n.getUint16(e+o).toString(16));return i.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Wr={},Es={},q1=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[449,-1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]];q1.forEach(t=>{let e=H1(...t);Es[e.code]=e,Wr[e.name]=e});function H1(t,e,r,n,i){return{code:t,size:e,name:r,resolvable:!!n,path:!!i}}function st(t){if(typeof t=="number"){if(Es[t]!=null)return Es[t];throw new Error(`no protocol with code: ${t}`)}else if(typeof t=="string"){if(Wr[t]!=null)return Wr[t];throw new Error(`no protocol with name: ${t}`)}throw new Error(`invalid protocol id type: ${typeof t}`)}var B4=st("ip4"),A4=st("ip6"),I4=st("ipcidr");function Bs(t,e){switch(st(t).code){case 4:case 41:return $1(e);case 42:return cc(e);case 6:case 273:case 33:case 132:return lc(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return cc(e);case 421:return Z1(e);case 444:return uc(e);case 445:return uc(e);case 466:return Y1(e);default:return lt(e,"base16")}}function As(t,e){switch(st(t).code){case 4:return ac(e);case 41:return ac(e);case 42:return fc(e);case 6:case 273:case 33:case 132:return Is(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return fc(e);case 421:return G1(e);case 444:return Q1(e);case 445:return X1(e);case 466:return W1(e);default:return It(e,"base16")}}var Ss=Object.values(ze).map(t=>t.decoder),z1=function(){let t=Ss[0].or(Ss[1]);return Ss.slice(2).forEach(e=>t=t.or(e)),t}();function ac(t){if(!Gr(t))throw new Error("invalid ip address");return ws(t)}function $1(t){let e=sc(t,0,t.length);if(e==null)throw new Error("ipBuff is required");if(!Gr(e))throw new Error("invalid ip address");return e}function Is(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t),new Uint8Array(e)}function lc(t){return new DataView(t.buffer).getUint16(t.byteOffset)}function fc(t){let e=It(t),r=Uint8Array.from(rr(e.length));return Ft([r,e],r.length+e.length)}function cc(t){let e=Fe(t);if(t=t.slice(Yt(e)),t.length!==e)throw new Error("inconsistent lengths");return lt(t)}function G1(t){let e;t[0]==="Q"||t[0]==="1"?e=or(At.decode(`z${t}`)).bytes:e=ee.parse(t).multihash.bytes;let r=Uint8Array.from(rr(e.length));return Ft([r,e],r.length+e.length)}function W1(t){let e=z1.decode(t),r=Uint8Array.from(rr(e.length));return Ft([r,e],r.length+e.length)}function Y1(t){let e=Fe(t),r=t.slice(Yt(e));if(r.length!==e)throw new Error("inconsistent lengths");return"u"+lt(r,"base64url")}function Z1(t){let e=Fe(t),r=t.slice(Yt(e));if(r.length!==e)throw new Error("inconsistent lengths");return lt(r,"base58btc")}function Q1(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let r=Ae.decode("b"+e[0]),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let i=Is(n);return Ft([r,i],r.length+i.length)}function X1(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let r=Ae.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let i=Is(n);return Ft([r,i],r.length+i.length)}function uc(t){let e=t.slice(0,t.length-2),r=t.slice(t.length-2),n=lt(e,"base32"),i=lc(r);return`${n}:${i}`}function hc(t){t=Ts(t);let e=[],r=[],n=null,i=t.split("/").slice(1);if(i.length===1&&i[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let o=0;o<i.length;o++){let s=i[o],a=st(s);if(a.size===0){e.push([a.code]),r.push([a.code]);continue}if(o++,o>=i.length)throw pc("invalid address: "+t);if(a.path===!0){n=Ts(i.slice(o).join("/")),e.push([a.code,As(a.code,n)]),r.push([a.code,n]);break}let c=As(a.code,i[o]);e.push([a.code,c]),r.push([a.code,Bs(a.code,c)])}return{string:dc(r),bytes:_s(e),tuples:e,stringTuples:r,path:n}}function Cs(t){let e=[],r=[],n=null,i=0;for(;i<t.length;){let o=Fe(t,i),s=Yt(o),a=st(o),c=J1(a,t.slice(i+s));if(c===0){e.push([o]),r.push([o]),i+=s;continue}let f=t.slice(i+s,i+s+c);if(i+=c+s,i>t.length)throw pc("Invalid address Uint8Array: "+lt(t,"base16"));e.push([o,f]);let u=Bs(o,f);if(r.push([o,u]),a.path===!0){n=u;break}}return{bytes:Uint8Array.from(t),string:dc(r),tuples:e,stringTuples:r,path:n}}function dc(t){let e=[];return t.map(r=>{let n=st(r[0]);return e.push(n.name),r.length>1&&r[1]!=null&&e.push(r[1]),null}),Ts(e.join("/"))}function _s(t){return Ft(t.map(e=>{let r=st(e[0]),n=Uint8Array.from(rr(r.code));return e.length>1&&e[1]!=null&&(n=Ft([n,e[1]])),n}))}function J1(t,e){if(t.size>0)return t.size/8;if(t.size===0)return 0;{let r=Fe(e instanceof Uint8Array?e:Uint8Array.from(e));return r+Yt(r)}}function Ts(t){return"/"+t.trim().split("/").filter(e=>e).join("/")}function pc(t){return new Error("Error parsing address: "+t)}var j1=Symbol.for("nodejs.util.inspect.custom"),Rs=Symbol.for("@multiformats/js-multiaddr/multiaddr"),ty=[st("dns").code,st("dns4").code,st("dns6").code,st("dnsaddr").code],mi=class t{bytes;#e;#t;#r;#n;[Rs]=!0;constructor(e){e==null&&(e="");let r;if(e instanceof Uint8Array)r=Cs(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);r=hc(e)}else if(gc(e))r=Cs(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=r.bytes,this.#e=r.string,this.#t=r.tuples,this.#r=r.stringTuples,this.#n=r.path}toString(){return this.#e}toJSON(){return this.toString()}toOptions(){let e,r,n,i,o="",s=st("tcp"),a=st("udp"),c=st("ip4"),f=st("ip6"),u=st("dns6"),l=st("ip6zone");for(let[d,h]of this.stringTuples())d===l.code&&(o=`%${h??""}`),ty.includes(d)&&(r=s.name,i=443,n=`${h??""}${o}`,e=d===u.code?6:4),(d===s.code||d===a.code)&&(r=st(d).name,i=parseInt(h??"")),(d===c.code||d===f.code)&&(r=st(d).name,n=`${h??""}${o}`,e=d===f.code?6:4);if(e==null||r==null||n==null||i==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:r,port:i}}protos(){return this.#t.map(([e])=>Object.assign({},st(e)))}protoCodes(){return this.#t.map(([e])=>e)}protoNames(){return this.#t.map(([e])=>st(e).name)}tuples(){return this.#t}stringTuples(){return this.#r}encapsulate(e){return e=new t(e),new t(this.toString()+e.toString())}decapsulate(e){let r=e.toString(),n=this.toString(),i=n.lastIndexOf(r);if(i<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new t(n.slice(0,i))}decapsulateCode(e){let r=this.tuples();for(let n=r.length-1;n>=0;n--)if(r[n][0]===e)return new t(_s(r.slice(0,n)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([n,i])=>{n===Wr.p2p.code&&e.push([n,i]),n===Wr["p2p-circuit"].code&&(e=[])});let r=e.pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?lt(At.decode(`z${n}`),"base58btc"):lt(ee.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(e){return qt(this.bytes,e.bytes)}async resolve(e){let r=this.protos().find(o=>o.resolvable);if(r==null)return[this];let n=yc.get(r.name);if(n==null)throw new $(`no available resolver for ${r.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(o=>new t(o))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let r=(e??this).protos();return!(r.length!==2||r[0].code!==4&&r[0].code!==41||r[1].code!==6&&r[1].code!==273)}[j1](){return`Multiaddr(${this.#e})`}};var yc=new Map;function gc(t){return!!t?.[Rs]}function vi(t){return new mi(t)}function ey(t){return t[Symbol.asyncIterator]!=null}function ry(t){if(ey(t))return(async()=>{for await(let e of t)return e})();for(let e of t)return e}var Ls=ry;function Sn(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Me(t=0){return globalThis.Buffer?.alloc!=null?Sn(globalThis.Buffer.alloc(t)):new Uint8Array(t)}function Bn(t=0){return globalThis.Buffer?.allocUnsafe!=null?Sn(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Ds(t,e){e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=Bn(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Sn(r)}function xc(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}var vc=Symbol.for("@achingbrain/uint8arraylist");function mc(t,e){if(e==null||e<0)throw new RangeError("index is out of bounds");let r=0;for(let n of t){let i=r+n.byteLength;if(e<i)return{buf:n,index:e-r};r=i}throw new RangeError("index is out of bounds")}function bi(t){return!!t?.[vc]}var Yr=class t{bufs;length;[vc]=!0;constructor(...e){this.bufs=[],this.length=0,e.length>0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let r=0;for(let n of e)if(n instanceof Uint8Array)r+=n.byteLength,this.bufs.push(n);else if(bi(n))r+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=r}prepend(...e){this.prependAll(e)}prependAll(e){let r=0;for(let n of e.reverse())if(n instanceof Uint8Array)r+=n.byteLength,this.bufs.unshift(n);else if(bi(n))r+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=r}get(e){let r=mc(this.bufs,e);return r.buf[r.index]}set(e,r){let n=mc(this.bufs,e);n.buf[n.index]=r}write(e,r=0){if(e instanceof Uint8Array)for(let n=0;n<e.length;n++)this.set(r+n,e[n]);else if(bi(e))for(let n=0;n<e.length;n++)this.set(r+n,e.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,r){let{bufs:n,length:i}=this._subList(e,r);return Ds(n,i)}subarray(e,r){let{bufs:n,length:i}=this._subList(e,r);return n.length===1?n[0]:Ds(n,i)}sublist(e,r){let{bufs:n,length:i}=this._subList(e,r),o=new t;return o.length=i,o.bufs=[...n],o}_subList(e,r){if(e=e??0,r=r??this.length,e<0&&(e=this.length+e),r<0&&(r=this.length+r),e<0||r>this.length)throw new RangeError("index is out of bounds");if(e===r)return{bufs:[],length:0};if(e===0&&r===this.length)return{bufs:this.bufs,length:this.length};let n=[],i=0;for(let o=0;o<this.bufs.length;o++){let s=this.bufs[o],a=i,c=a+s.byteLength;if(i=c,e>=c)continue;let f=e>=a&&e<c,u=r>a&&r<=c;if(f&&u){if(e===a&&r===c){n.push(s);break}let l=e-a;n.push(s.subarray(l,l+(r-e)));break}if(f){if(e===0){n.push(s);continue}n.push(s.subarray(e-a));continue}if(u){if(r===c){n.push(s);break}n.push(s.subarray(0,r-a));break}n.push(s)}return{bufs:n,length:r-e}}indexOf(e,r=0){if(!bi(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(r=Number(r??0),isNaN(r)&&(r=0),r<0&&(r=this.length+r),r<0&&(r=0),e.length===0)return r>this.length?this.length:r;let i=n.byteLength;if(i===0)throw new TypeError("search must be at least 1 byte long");let o=256,s=new Int32Array(o);for(let l=0;l<o;l++)s[l]=-1;for(let l=0;l<i;l++)s[n[l]]=l;let a=s,c=this.byteLength-n.byteLength,f=n.byteLength-1,u;for(let l=r;l<=c;l+=u){u=0;for(let p=f;p>=0;p--){let d=this.get(l+p);if(n[p]!==d){u=Math.max(1,p-a[d]);break}}if(u===0)return l}return-1}getInt8(e){let r=this.subarray(e,e+1);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt8(0)}setInt8(e,r){let n=Bn(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,r),this.write(n,e)}getInt16(e,r){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,r)}setInt16(e,r,n){let i=Me(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,r,n),this.write(i,e)}getInt32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,r)}setInt32(e,r,n){let i=Me(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,r,n),this.write(i,e)}getBigInt64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,r)}setBigInt64(e,r,n){let i=Me(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,r,n),this.write(i,e)}getUint8(e){let r=this.subarray(e,e+1);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint8(0)}setUint8(e,r){let n=Bn(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,r),this.write(n,e)}getUint16(e,r){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,r)}setUint16(e,r,n){let i=Me(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,r,n),this.write(i,e)}getUint32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,r)}setUint32(e,r,n){let i=Me(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,r,n),this.write(i,e)}getBigUint64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,r)}setBigUint64(e,r,n){let i=Me(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,r,n),this.write(i,e)}getFloat32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,r)}setFloat32(e,r,n){let i=Me(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,r,n),this.write(i,e)}getFloat64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,r)}setFloat64(e,r,n){let i=Me(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,r,n),this.write(i,e)}equals(e){if(e==null||!(e instanceof t)||e.bufs.length!==this.bufs.length)return!1;for(let r=0;r<this.bufs.length;r++)if(!xc(this.bufs[r],e.bufs[r]))return!1;return!0}static fromUint8Arrays(e,r){let n=new t;return n.bufs=e,r==null&&(r=e.reduce((i,o)=>i+o.byteLength,0)),n.length=r,n}};function bc(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function wc(t=0){return globalThis.Buffer?.allocUnsafe!=null?bc(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function wi(t){return t[Symbol.asyncIterator]!=null}var Ei=t=>{let e=Yt(t),r=wc(e);return rr(t,r),Ei.bytes=e,r};Ei.bytes=0;function An(t,e){e=e??{};let r=e.lengthEncoder??Ei;function*n(i){let o=r(i.byteLength);o instanceof Uint8Array?yield o:yield*o,i instanceof Uint8Array?yield i:yield*i}return wi(t)?async function*(){for await(let i of t)yield*n(i)}():function*(){for(let i of t)yield*n(i)}()}An.single=(t,e)=>{e=e??{};let r=e.lengthEncoder??Ei;return new Yr(r(t.byteLength),t)};var Zr=Kt(Bc(),1);var iy=8,oy=1024*1024*4,Er;(function(t){t[t.LENGTH=0]="LENGTH",t[t.DATA=1]="DATA"})(Er||(Er={}));var Ps=t=>{let e=Fe(t);return Ps.bytes=Yt(e),e};Ps.bytes=0;function Qr(t,e){let r=new Yr,n=Er.LENGTH,i=-1,o=e?.lengthDecoder??Ps,s=e?.maxLengthLength??iy,a=e?.maxDataLength??oy;function*c(){for(;r.byteLength>0;){if(n===Er.LENGTH)try{if(i=o(r),i<0)throw(0,Zr.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(i>a)throw(0,Zr.default)(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let f=o.bytes;r.consume(f),e?.onLength!=null&&e.onLength(i),n=Er.DATA}catch(f){if(f instanceof RangeError){if(r.byteLength>s)throw(0,Zr.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw f}if(n===Er.DATA){if(r.byteLength<i)break;let f=r.sublist(0,i);r.consume(i),e?.onData!=null&&e.onData(f),yield f,n=Er.LENGTH}}}return wi(t)?async function*(){for await(let f of t)r.append(f),yield*c();if(r.byteLength>0)throw(0,Zr.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}():function*(){for(let f of t)r.append(f),yield*c();if(r.byteLength>0)throw(0,Zr.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}Qr.fromReader=(t,e)=>{let r=1,n=async function*(){for(;;)try{let{done:o,value:s}=await t.next(r);if(o===!0)return;s!=null&&(yield s)}catch(o){if(o.code==="ERR_UNDER_READ")return{done:!0,value:null};throw o}finally{r=1}}();return Qr(n,{...e??{},onLength:o=>{r=o}})};function ay(t){let[e,r]=t[Symbol.asyncIterator]!=null?[t[Symbol.asyncIterator](),Symbol.asyncIterator]:[t[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>e.next(),push:i=>{n.push(i)},next:()=>n.length>0?{done:!1,value:n.shift()}:e.next(),[r](){return this}}}var Ac=ay;function fy(t){return t[Symbol.asyncIterator]!=null}function cy(t,e){if(fy(t))return async function*(){for await(let a of t)yield e(a)}();let r=Ac(t),{value:n,done:i}=r.next();if(i===!0)return function*(){}();let o=e(n);if(typeof o.then=="function")return async function*(){yield await o;for await(let a of r)yield e(a)}();let s=e;return function*(){yield o;for(let a of r)yield s(a)}()}var Ic=cy;function Ve(){let t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}var Si=globalThis.CustomEvent??Event;async function*ks(t,e={}){let r=e.concurrency??1/0;r<1&&(r=1/0);let n=e.ordered==null?!1:e.ordered,i=new EventTarget,o=[],s=Ve(),a=Ve(),c=!1,f,u=!1;i.addEventListener("task-complete",()=>{a.resolve()}),Promise.resolve().then(async()=>{try{for await(let h of t){if(o.length===r&&(s=Ve(),await s.promise),u)break;let y={done:!1};o.push(y),h().then(g=>{y.done=!0,y.ok=!0,y.value=g,i.dispatchEvent(new Si("task-complete"))},g=>{y.done=!0,y.err=g,i.dispatchEvent(new Si("task-complete"))})}c=!0,i.dispatchEvent(new Si("task-complete"))}catch(h){f=h,i.dispatchEvent(new Si("task-complete"))}});function l(){return n?o[0]?.done:!!o.find(h=>h.done)}function*p(){for(;o.length>0&&o[0].done;){let h=o[0];if(o.shift(),h.ok)yield h.value;else throw u=!0,s.resolve(),h.err;s.resolve()}}function*d(){for(;l();)for(let h=0;h<o.length;h++)if(o[h].done){let y=o[h];if(o.splice(h,1),h--,y.ok)yield y.value;else throw u=!0,s.resolve(),y.err;s.resolve()}}for(;;){if(l()||(a=Ve(),await a.promise),f!=null)throw f;if(n?yield*p():yield*d(),c&&o.length===0)break}}var Bi=class{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},Xr=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new Bi(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let r=this.head;this.head=r.next=new Bi(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let r=this.tail.next;this.tail.next=null,this.tail=r,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};var Ns=class extends Error{type;code;constructor(e,r){super(e??"The operation was aborted"),this.type="aborted",this.code=r??"ABORT_ERR"}};function Ai(t={}){return uy(r=>{let n=r.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},t)}function uy(t,e){e=e??{};let r=e.onEnd,n=new Xr,i,o,s,a=Ve(),c=async()=>{try{return n.isEmpty()?s?{done:!0}:await new Promise((g,x)=>{o=m=>{o=null,n.push(m);try{g(t(n))}catch(b){x(b)}return i}}):t(n)}finally{n.isEmpty()&&queueMicrotask(()=>{a.resolve(),a=Ve()})}},f=g=>o!=null?o(g):(n.push(g),i),u=g=>(n=new Xr,o!=null?o({error:g}):(n.push({error:g}),i)),l=g=>{if(s)return i;if(e?.objectMode!==!0&&g?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return f({done:!1,value:g})},p=g=>s?i:(s=!0,g!=null?u(g):f({done:!0})),d=()=>(n=new Xr,p(),{done:!0}),h=g=>(p(g),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:c,return:d,throw:h,push:l,end:p,get readableLength(){return n.size},onEmpty:async g=>{let x=g?.signal;if(x?.throwIfAborted(),n.isEmpty())return;let m,b;x!=null&&(m=new Promise((_,E)=>{b=()=>{E(new Ns)},x.addEventListener("abort",b)}));try{await Promise.race([a.promise,m])}finally{b!=null&&x!=null&&x?.removeEventListener("abort",b)}}},r==null)return i;let y=i;return i={[Symbol.asyncIterator](){return this},next(){return y.next()},throw(g){return y.throw(g),r!=null&&(r(g),r=void 0),{done:!0}},return(){return y.return(),r!=null&&(r(),r=void 0),{done:!0}},push:l,end(g){return y.end(g),r!=null&&(r(g),r=void 0),i},get readableLength(){return y.readableLength},onEmpty:g=>y.onEmpty(g)},i}function ly(t){return t[Symbol.asyncIterator]!=null}function hy(...t){let e=[];for(let r of t)ly(r)||e.push(r);return e.length===t.length?function*(){for(let r of e)yield*r}():async function*(){let r=Ai({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(t.map(async n=>{for await(let i of n)r.push(i)})),r.end()}catch(n){r.end(n)}}),yield*r}()}var Tc=hy;function Os(t,...e){if(t==null)throw new Error("Empty pipeline");if(Us(t)){let n=t;t=()=>n.source}else if(_c(t)||Cc(t)){let n=t;t=()=>n}let r=[t,...e];if(r.length>1&&Us(r[r.length-1])&&(r[r.length-1]=r[r.length-1].sink),r.length>2)for(let n=1;n<r.length-1;n++)Us(r[n])&&(r[n]=py(r[n]));return dy(...r)}var dy=(...t)=>{let e;for(;t.length>0;)e=t.shift()(e);return e},Cc=t=>t?.[Symbol.asyncIterator]!=null,_c=t=>t?.[Symbol.iterator]!=null,Us=t=>t==null?!1:t.sink!=null&&t.source!=null,py=t=>e=>{let r=t.sink(e);if(r?.then!=null){let n=Ai({objectMode:!0});r.then(()=>{n.end()},s=>{n.end(s)});let i,o=t.source;if(Cc(o))i=async function*(){yield*o,n.end()};else if(_c(o))i=function*(){yield*o,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return Tc(n,i())}return t.source};var Uc=Kt(Rc(),1);var Lc="[a-fA-F\\d:]",nr=t=>t&&t.includeBoundaries?`(?:(?<=\\s|^)(?=${Lc})|(?<=${Lc})(?=\\s|$))`:"",pe="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",St="[a-fA-F\\d]{1,4}",Ii=`
15
+ `+a+e.substr(s+1),o=i-s-1,s=-1,++i}else(e[i]===" "||e[i]===" "||e[i]===",")&&(s=i);return e}function El(t){return t.replace(/^\s+/,"")}});var Qa=ft((Tg,Za)=>{var xe=ct();cr();Et();var Ga=Za.exports=xe.sha256=xe.sha256||{};xe.md.sha256=xe.md.algorithms.sha256=Ga;Ga.create=function(){Wa||Sl();var t=null,e=xe.util.createBuffer(),r=new Array(64),n={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var i=n.messageLengthSize/4,o=0;o<i;++o)n.fullMessageLength.push(0);return e=xe.util.createBuffer(),t={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},n},n.start(),n.update=function(i,o){o==="utf8"&&(i=xe.util.encodeUtf8(i));var s=i.length;n.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var a=n.fullMessageLength.length-1;a>=0;--a)n.fullMessageLength[a]+=s[1],s[1]=s[0]+(n.fullMessageLength[a]/4294967296>>>0),n.fullMessageLength[a]=n.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return e.putBytes(i),$a(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var i=xe.util.createBuffer();i.putBytes(e.bytes());var o=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,s=o&n.blockLength-1;i.putBytes(ho.substr(0,n.blockLength-s));for(var a,c,f=n.fullMessageLength[0]*8,u=0;u<n.fullMessageLength.length-1;++u)a=n.fullMessageLength[u+1]*8,c=a/4294967296>>>0,f+=c,i.putInt32(f>>>0),f=a>>>0;i.putInt32(f);var l={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};$a(l,r,i);var p=xe.util.createBuffer();return p.putInt32(l.h0),p.putInt32(l.h1),p.putInt32(l.h2),p.putInt32(l.h3),p.putInt32(l.h4),p.putInt32(l.h5),p.putInt32(l.h6),p.putInt32(l.h7),p},n};var ho=null,Wa=!1,Ya=null;function Sl(){ho="\x80",ho+=xe.util.fillString("\0",64),Ya=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Wa=!0}function $a(t,e,r){for(var n,i,o,s,a,c,f,u,l,p,d,h,y,g,x,m=r.length();m>=64;){for(f=0;f<16;++f)e[f]=r.getInt32();for(;f<64;++f)n=e[f-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=e[f-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,e[f]=n+e[f-7]+i+e[f-16]|0;for(u=t.h0,l=t.h1,p=t.h2,d=t.h3,h=t.h4,y=t.h5,g=t.h6,x=t.h7,f=0;f<64;++f)s=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),a=g^h&(y^g),o=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),c=u&l|p&(u^l),n=x+s+a+Ya[f]+e[f],i=o+c,x=g,g=y,y=h,h=d+n>>>0,d=p,p=l,l=u,u=n+i>>>0;t.h0=t.h0+u|0,t.h1=t.h1+l|0,t.h2=t.h2+p|0,t.h3=t.h3+d|0,t.h4=t.h4+h|0,t.h5=t.h5+y|0,t.h6=t.h6+g|0,t.h7=t.h7+x|0,m-=64}}});var Ja=ft((Cg,Xa)=>{var me=ct();Et();var Mn=null;me.util.isNodejs&&!me.options.usePureJavaScript&&!process.versions["node-webkit"]&&(Mn=On());var Bl=Xa.exports=me.prng=me.prng||{};Bl.create=function(t){for(var e={plugin:t,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=t.md,n=new Array(32),i=0;i<32;++i)n[i]=r.create();e.pools=n,e.pool=0,e.generate=function(f,u){if(!u)return e.generateSync(f);var l=e.plugin.cipher,p=e.plugin.increment,d=e.plugin.formatKey,h=e.plugin.formatSeed,y=me.util.createBuffer();e.key=null,g();function g(x){if(x)return u(x);if(y.length()>=f)return u(null,y.getBytes(f));if(e.generated>1048575&&(e.key=null),e.key===null)return me.util.nextTick(function(){o(g)});var m=l(e.key,e.seed);e.generated+=m.length,y.putBytes(m),e.key=d(l(e.key,p(e.seed))),e.seed=h(l(e.key,e.seed)),me.util.setImmediate(g)}},e.generateSync=function(f){var u=e.plugin.cipher,l=e.plugin.increment,p=e.plugin.formatKey,d=e.plugin.formatSeed;e.key=null;for(var h=me.util.createBuffer();h.length()<f;){e.generated>1048575&&(e.key=null),e.key===null&&s();var y=u(e.key,e.seed);e.generated+=y.length,h.putBytes(y),e.key=p(u(e.key,l(e.seed))),e.seed=d(u(e.key,e.seed))}return h.getBytes(f)};function o(f){if(e.pools[0].messageLength>=32)return a(),f();var u=32-e.pools[0].messageLength<<5;e.seedFile(u,function(l,p){if(l)return f(l);e.collect(p),a(),f()})}function s(){if(e.pools[0].messageLength>=32)return a();var f=32-e.pools[0].messageLength<<5;e.collect(e.seedFileSync(f)),a()}function a(){e.reseeds=e.reseeds===4294967295?0:e.reseeds+1;var f=e.plugin.md.create();f.update(e.keyBytes);for(var u=1,l=0;l<32;++l)e.reseeds%u===0&&(f.update(e.pools[l].digest().getBytes()),e.pools[l].start()),u=u<<1;e.keyBytes=f.digest().getBytes(),f.start(),f.update(e.keyBytes);var p=f.digest().getBytes();e.key=e.plugin.formatKey(e.keyBytes),e.seed=e.plugin.formatSeed(p),e.generated=0}function c(f){var u=null,l=me.util.globalScope,p=l.crypto||l.msCrypto;p&&p.getRandomValues&&(u=function(E){return p.getRandomValues(E)});var d=me.util.createBuffer();if(u)for(;d.length()<f;){var h=Math.max(1,Math.min(f-d.length(),65536)/4),y=new Uint32Array(Math.floor(h));try{u(y);for(var g=0;g<y.length;++g)d.putInt32(y[g])}catch(E){if(!(typeof QuotaExceededError<"u"&&E instanceof QuotaExceededError))throw E}}if(d.length()<f)for(var x,m,b,_=Math.floor(Math.random()*65536);d.length()<f;){m=16807*(_&65535),x=16807*(_>>16),m+=(x&32767)<<16,m+=x>>15,m=(m&2147483647)+(m>>31),_=m&4294967295;for(var g=0;g<3;++g)b=_>>>(g<<3),b^=Math.floor(Math.random()*256),d.putByte(b&255)}return d.getBytes(f)}return Mn?(e.seedFile=function(f,u){Mn.randomBytes(f,function(l,p){if(l)return u(l);u(null,p.toString())})},e.seedFileSync=function(f){return Mn.randomBytes(f).toString()}):(e.seedFile=function(f,u){try{u(null,c(f))}catch(l){u(l)}},e.seedFileSync=c),e.collect=function(f){for(var u=f.length,l=0;l<u;++l)e.pools[e.pool].update(f.substr(l,1)),e.pool=e.pool===31?0:e.pool+1},e.collectInt=function(f,u){for(var l="",p=0;p<u;p+=8)l+=String.fromCharCode(f>>p&255);e.collect(l)},e.registerWorker=function(f){if(f===self)e.seedFile=function(l,p){function d(h){var y=h.data;y.forge&&y.forge.prng&&(self.removeEventListener("message",d),p(y.forge.prng.err,y.forge.prng.bytes))}self.addEventListener("message",d),self.postMessage({forge:{prng:{needed:l}}})};else{var u=function(l){var p=l.data;p.forge&&p.forge.prng&&e.seedFile(p.forge.prng.needed,function(d,h){f.postMessage({forge:{prng:{err:d,bytes:h}}})})};f.addEventListener("message",u)}},e}});var fn=ft((_g,po)=>{var Dt=ct();lo();Qa();Ja();Et();(function(){if(Dt.random&&Dt.random.getBytes){po.exports=Dt.random;return}(function(t){var e={},r=new Array(4),n=Dt.util.createBuffer();e.formatKey=function(l){var p=Dt.util.createBuffer(l);return l=new Array(4),l[0]=p.getInt32(),l[1]=p.getInt32(),l[2]=p.getInt32(),l[3]=p.getInt32(),Dt.aes._expandKey(l,!1)},e.formatSeed=function(l){var p=Dt.util.createBuffer(l);return l=new Array(4),l[0]=p.getInt32(),l[1]=p.getInt32(),l[2]=p.getInt32(),l[3]=p.getInt32(),l},e.cipher=function(l,p){return Dt.aes._updateBlock(l,p,r,!1),n.putInt32(r[0]),n.putInt32(r[1]),n.putInt32(r[2]),n.putInt32(r[3]),n.getBytes()},e.increment=function(l){return++l[3],l},e.md=Dt.md.sha256;function i(){var l=Dt.prng.create(e);return l.getBytes=function(p,d){return l.generate(p,d)},l.getBytesSync=function(p){return l.generate(p)},l}var o=i(),s=null,a=Dt.util.globalScope,c=a.crypto||a.msCrypto;if(c&&c.getRandomValues&&(s=function(l){return c.getRandomValues(l)}),Dt.options.usePureJavaScript||!Dt.util.isNodejs&&!s){if(typeof window>"u"||window.document,o.collectInt(+new Date,32),typeof navigator<"u"){var f="";for(var u in navigator)try{typeof navigator[u]=="string"&&(f+=navigator[u])}catch{}o.collect(f),f=null}t&&(t().mousemove(function(l){o.collectInt(l.clientX,16),o.collectInt(l.clientY,16)}),t().keypress(function(l){o.collectInt(l.charCode,8)}))}if(!Dt.random)Dt.random=o;else for(var u in o)Dt.random[u]=o[u];Dt.random.createInstance=i,po.exports=Dt.random})(typeof jQuery<"u"?jQuery:null)})()});var r0=ft((Rg,e0)=>{var Gt=ct();Et();var yo=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],ja=[1,2,3,5],Al=function(t,e){return t<<e&65535|(t&65535)>>16-e},Il=function(t,e){return(t&65535)>>e|t<<16-e&65535};e0.exports=Gt.rc2=Gt.rc2||{};Gt.rc2.expandKey=function(t,e){typeof t=="string"&&(t=Gt.util.createBuffer(t)),e=e||128;var r=t,n=t.length(),i=e,o=Math.ceil(i/8),s=255>>(i&7),a;for(a=n;a<128;a++)r.putByte(yo[r.at(a-1)+r.at(a-n)&255]);for(r.setAt(128-o,yo[r.at(128-o)&s]),a=127-o;a>=0;a--)r.setAt(a,yo[r.at(a+1)^r.at(a+o)]);return r};var t0=function(t,e,r){var n=!1,i=null,o=null,s=null,a,c,f,u,l=[];for(t=Gt.rc2.expandKey(t,e),f=0;f<64;f++)l.push(t.getInt16Le());r?(a=function(h){for(f=0;f<4;f++)h[f]+=l[u]+(h[(f+3)%4]&h[(f+2)%4])+(~h[(f+3)%4]&h[(f+1)%4]),h[f]=Al(h[f],ja[f]),u++},c=function(h){for(f=0;f<4;f++)h[f]+=l[h[(f+3)%4]&63]}):(a=function(h){for(f=3;f>=0;f--)h[f]=Il(h[f],ja[f]),h[f]-=l[u]+(h[(f+3)%4]&h[(f+2)%4])+(~h[(f+3)%4]&h[(f+1)%4]),u--},c=function(h){for(f=3;f>=0;f--)h[f]-=l[h[(f+3)%4]&63]});var p=function(h){var y=[];for(f=0;f<4;f++){var g=i.getInt16Le();s!==null&&(r?g^=s.getInt16Le():s.putInt16Le(g)),y.push(g&65535)}u=r?0:63;for(var x=0;x<h.length;x++)for(var m=0;m<h[x][0];m++)h[x][1](y);for(f=0;f<4;f++)s!==null&&(r?s.putInt16Le(y[f]):y[f]^=s.getInt16Le()),o.putInt16Le(y[f])},d=null;return d={start:function(h,y){h&&typeof h=="string"&&(h=Gt.util.createBuffer(h)),n=!1,i=Gt.util.createBuffer(),o=y||new Gt.util.createBuffer,s=h,d.output=o},update:function(h){for(n||i.putBuffer(h);i.length()>=8;)p([[5,a],[1,c],[6,a],[1,c],[5,a]])},finish:function(h){var y=!0;if(r)if(h)y=h(8,i,!r);else{var g=i.length()===8?8:8-i.length();i.fillWithByte(g,g)}if(y&&(n=!0,d.update()),!r&&(y=i.length()===0,y))if(h)y=h(8,o,!r);else{var x=o.length(),m=o.at(x-1);m>x?y=!1:o.truncate(m)}return y}},d};Gt.rc2.startEncrypting=function(t,e,r){var n=Gt.rc2.createEncryptionCipher(t,128);return n.start(e,r),n};Gt.rc2.createEncryptionCipher=function(t,e){return t0(t,e,!0)};Gt.rc2.startDecrypting=function(t,e,r){var n=Gt.rc2.createDecryptionCipher(t,128);return n.start(e,r),n};Gt.rc2.createDecryptionCipher=function(t,e){return t0(t,e,!1)}});var zn=ft((Lg,u0)=>{var go=ct();u0.exports=go.jsbn=go.jsbn||{};var Ce,Tl=0xdeadbeefcafe,n0=(Tl&16777215)==15715070;function I(t,e,r){this.data=[],t!=null&&(typeof t=="number"?this.fromNumber(t,e,r):e==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,e))}go.jsbn.BigInteger=I;function et(){return new I(null)}function Cl(t,e,r,n,i,o){for(;--o>=0;){var s=e*this.data[t++]+r.data[n]+i;i=Math.floor(s/67108864),r.data[n++]=s&67108863}return i}function _l(t,e,r,n,i,o){for(var s=e&32767,a=e>>15;--o>=0;){var c=this.data[t]&32767,f=this.data[t++]>>15,u=a*c+f*s;c=s*c+((u&32767)<<15)+r.data[n]+(i&1073741823),i=(c>>>30)+(u>>>15)+a*f+(i>>>30),r.data[n++]=c&1073741823}return i}function i0(t,e,r,n,i,o){for(var s=e&16383,a=e>>14;--o>=0;){var c=this.data[t]&16383,f=this.data[t++]>>14,u=a*c+f*s;c=s*c+((u&16383)<<14)+r.data[n]+i,i=(c>>28)+(u>>14)+a*f,r.data[n++]=c&268435455}return i}typeof navigator>"u"?(I.prototype.am=i0,Ce=28):n0&&navigator.appName=="Microsoft Internet Explorer"?(I.prototype.am=_l,Ce=30):n0&&navigator.appName!="Netscape"?(I.prototype.am=Cl,Ce=26):(I.prototype.am=i0,Ce=28);I.prototype.DB=Ce;I.prototype.DM=(1<<Ce)-1;I.prototype.DV=1<<Ce;var xo=52;I.prototype.FV=Math.pow(2,xo);I.prototype.F1=xo-Ce;I.prototype.F2=2*Ce-xo;var Rl="0123456789abcdefghijklmnopqrstuvwxyz",Vn=new Array,Dr,Jt;Dr=48;for(Jt=0;Jt<=9;++Jt)Vn[Dr++]=Jt;Dr=97;for(Jt=10;Jt<36;++Jt)Vn[Dr++]=Jt;Dr=65;for(Jt=10;Jt<36;++Jt)Vn[Dr++]=Jt;function o0(t){return Rl.charAt(t)}function s0(t,e){var r=Vn[t.charCodeAt(e)];return r??-1}function Ll(t){for(var e=this.t-1;e>=0;--e)t.data[e]=this.data[e];t.t=this.t,t.s=this.s}function Dl(t){this.t=1,this.s=t<0?-1:0,t>0?this.data[0]=t:t<-1?this.data[0]=t+this.DV:this.t=0}function We(t){var e=et();return e.fromInt(t),e}function Pl(t,e){var r;if(e==16)r=4;else if(e==8)r=3;else if(e==256)r=8;else if(e==2)r=1;else if(e==32)r=5;else if(e==4)r=2;else{this.fromRadix(t,e);return}this.t=0,this.s=0;for(var n=t.length,i=!1,o=0;--n>=0;){var s=r==8?t[n]&255:s0(t,n);if(s<0){t.charAt(n)=="-"&&(i=!0);continue}i=!1,o==0?this.data[this.t++]=s:o+r>this.DB?(this.data[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this.data[this.t++]=s>>this.DB-o):this.data[this.t-1]|=s<<o,o+=r,o>=this.DB&&(o-=this.DB)}r==8&&t[0]&128&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&I.ZERO.subTo(this,this)}function kl(){for(var t=this.s&this.DM;this.t>0&&this.data[this.t-1]==t;)--this.t}function Nl(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(t==16)e=4;else if(t==8)e=3;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else return this.toRadix(t);var r=(1<<e)-1,n,i=!1,o="",s=this.t,a=this.DB-s*this.DB%e;if(s-- >0)for(a<this.DB&&(n=this.data[s]>>a)>0&&(i=!0,o=o0(n));s>=0;)a<e?(n=(this.data[s]&(1<<a)-1)<<e-a,n|=this.data[--s]>>(a+=this.DB-e)):(n=this.data[s]>>(a-=e)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=o0(n));return i?o:"0"}function Ul(){var t=et();return I.ZERO.subTo(this,t),t}function Ol(){return this.s<0?this.negate():this}function Kl(t){var e=this.s-t.s;if(e!=0)return e;var r=this.t;if(e=r-t.t,e!=0)return this.s<0?-e:e;for(;--r>=0;)if((e=this.data[r]-t.data[r])!=0)return e;return 0}function qn(t){var e=1,r;return(r=t>>>16)!=0&&(t=r,e+=16),(r=t>>8)!=0&&(t=r,e+=8),(r=t>>4)!=0&&(t=r,e+=4),(r=t>>2)!=0&&(t=r,e+=2),(r=t>>1)!=0&&(t=r,e+=1),e}function Fl(){return this.t<=0?0:this.DB*(this.t-1)+qn(this.data[this.t-1]^this.s&this.DM)}function Ml(t,e){var r;for(r=this.t-1;r>=0;--r)e.data[r+t]=this.data[r];for(r=t-1;r>=0;--r)e.data[r]=0;e.t=this.t+t,e.s=this.s}function Vl(t,e){for(var r=t;r<this.t;++r)e.data[r-t]=this.data[r];e.t=Math.max(this.t-t,0),e.s=this.s}function ql(t,e){var r=t%this.DB,n=this.DB-r,i=(1<<n)-1,o=Math.floor(t/this.DB),s=this.s<<r&this.DM,a;for(a=this.t-1;a>=0;--a)e.data[a+o+1]=this.data[a]>>n|s,s=(this.data[a]&i)<<r;for(a=o-1;a>=0;--a)e.data[a]=0;e.data[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()}function zl(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t){e.t=0;return}var n=t%this.DB,i=this.DB-n,o=(1<<n)-1;e.data[0]=this.data[r]>>n;for(var s=r+1;s<this.t;++s)e.data[s-r-1]|=(this.data[s]&o)<<i,e.data[s-r]=this.data[s]>>n;n>0&&(e.data[this.t-r-1]|=(this.s&o)<<i),e.t=this.t-r,e.clamp()}function Hl(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this.data[r]-t.data[r],e.data[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;r<this.t;)n+=this.data[r],e.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n-=t.data[r],e.data[r++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e.data[r++]=this.DV+n:n>0&&(e.data[r++]=n),e.t=r,e.clamp()}function $l(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e.data[i]=0;for(i=0;i<n.t;++i)e.data[i+r.t]=r.am(0,n.data[i],e,i,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&I.ZERO.subTo(e,e)}function Gl(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t.data[r]=0;for(r=0;r<e.t-1;++r){var n=e.am(r,e.data[r],t,2*r,0,1);(t.data[r+e.t]+=e.am(r+1,2*e.data[r],t,2*r+1,n,e.t-r-1))>=e.DV&&(t.data[r+e.t]-=e.DV,t.data[r+e.t+1]=1)}t.t>0&&(t.data[t.t-1]+=e.am(r,e.data[r],t,2*r,0,1)),t.s=0,t.clamp()}function Wl(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t){e?.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=et());var o=et(),s=this.s,a=t.s,c=this.DB-qn(n.data[n.t-1]);c>0?(n.lShiftTo(c,o),i.lShiftTo(c,r)):(n.copyTo(o),i.copyTo(r));var f=o.t,u=o.data[f-1];if(u!=0){var l=u*(1<<this.F1)+(f>1?o.data[f-2]>>this.F2:0),p=this.FV/l,d=(1<<this.F1)/l,h=1<<this.F2,y=r.t,g=y-f,x=e??et();for(o.dlShiftTo(g,x),r.compareTo(x)>=0&&(r.data[r.t++]=1,r.subTo(x,r)),I.ONE.dlShiftTo(f,x),x.subTo(o,o);o.t<f;)o.data[o.t++]=0;for(;--g>=0;){var m=r.data[--y]==u?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+h)*d);if((r.data[y]+=o.am(0,m,r,g,0,f))<m)for(o.dlShiftTo(g,x),r.subTo(x,r);r.data[y]<--m;)r.subTo(x,r)}e!=null&&(r.drShiftTo(f,e),s!=a&&I.ZERO.subTo(e,e)),r.t=f,r.clamp(),c>0&&r.rShiftTo(c,r),s<0&&I.ZERO.subTo(r,r)}}}function Yl(t){var e=et();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(I.ZERO)>0&&t.subTo(e,e),e}function ur(t){this.m=t}function Zl(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function Ql(t){return t}function Xl(t){t.divRemTo(this.m,null,t)}function Jl(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function jl(t,e){t.squareTo(e),this.reduce(e)}ur.prototype.convert=Zl;ur.prototype.revert=Ql;ur.prototype.reduce=Xl;ur.prototype.mulTo=Jl;ur.prototype.sqrTo=jl;function th(){if(this.t<1)return 0;var t=this.data[0];if(!(t&1))return 0;var e=t&3;return e=e*(2-(t&15)*e)&15,e=e*(2-(t&255)*e)&255,e=e*(2-((t&65535)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}function lr(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function eh(t){var e=et();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(I.ZERO)>0&&this.m.subTo(e,e),e}function rh(t){var e=et();return t.copyTo(e),this.reduce(e),e}function nh(t){for(;t.t<=this.mt2;)t.data[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=t.data[e]&32767,n=r*this.mpl+((r*this.mph+(t.data[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t.data[r]+=this.m.am(0,n,t,e,0,this.m.t);t.data[r]>=t.DV;)t.data[r]-=t.DV,t.data[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function ih(t,e){t.squareTo(e),this.reduce(e)}function oh(t,e,r){t.multiplyTo(e,r),this.reduce(r)}lr.prototype.convert=eh;lr.prototype.revert=rh;lr.prototype.reduce=nh;lr.prototype.mulTo=oh;lr.prototype.sqrTo=ih;function sh(){return(this.t>0?this.data[0]&1:this.s)==0}function ah(t,e){if(t>4294967295||t<1)return I.ONE;var r=et(),n=et(),i=e.convert(this),o=qn(t)-1;for(i.copyTo(r);--o>=0;)if(e.sqrTo(r,n),(t&1<<o)>0)e.mulTo(n,i,r);else{var s=r;r=n,n=s}return e.revert(r)}function fh(t,e){var r;return t<256||e.isEven()?r=new ur(e):r=new lr(e),this.exp(t,r)}I.prototype.copyTo=Ll;I.prototype.fromInt=Dl;I.prototype.fromString=Pl;I.prototype.clamp=kl;I.prototype.dlShiftTo=Ml;I.prototype.drShiftTo=Vl;I.prototype.lShiftTo=ql;I.prototype.rShiftTo=zl;I.prototype.subTo=Hl;I.prototype.multiplyTo=$l;I.prototype.squareTo=Gl;I.prototype.divRemTo=Wl;I.prototype.invDigit=th;I.prototype.isEven=sh;I.prototype.exp=ah;I.prototype.toString=Nl;I.prototype.negate=Ul;I.prototype.abs=Ol;I.prototype.compareTo=Kl;I.prototype.bitLength=Fl;I.prototype.mod=Yl;I.prototype.modPowInt=fh;I.ZERO=We(0);I.ONE=We(1);function ch(){var t=et();return this.copyTo(t),t}function uh(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function lh(){return this.t==0?this.s:this.data[0]<<24>>24}function hh(){return this.t==0?this.s:this.data[0]<<16>>16}function dh(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function ph(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function yh(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=We(r),i=et(),o=et(),s="";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(t).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(t)+s}function gh(t,e){this.fromInt(0),e==null&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,o=0,s=0,a=0;a<t.length;++a){var c=s0(t,a);if(c<0){t.charAt(a)=="-"&&this.signum()==0&&(i=!0);continue}s=e*s+c,++o>=r&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),i&&I.ZERO.subTo(this,this)}function xh(t,e,r){if(typeof e=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(I.ONE.shiftLeft(t-1),mo,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(I.ONE.shiftLeft(t-1),this);else{var n=new Array,i=t&7;n.length=(t>>3)+1,e.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}}function mh(){var t=this.t,e=new Array;e[0]=this.s;var r=this.DB-t*this.DB%8,n,i=0;if(t-- >0)for(r<this.DB&&(n=this.data[t]>>r)!=(this.s&this.DM)>>r&&(e[i++]=n|this.s<<this.DB-r);t>=0;)r<8?(n=(this.data[t]&(1<<r)-1)<<8-r,n|=this.data[--t]>>(r+=this.DB-8)):(n=this.data[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),n&128&&(n|=-256),i==0&&(this.s&128)!=(n&128)&&++i,(i>0||n!=this.s)&&(e[i++]=n);return e}function vh(t){return this.compareTo(t)==0}function bh(t){return this.compareTo(t)<0?this:t}function wh(t){return this.compareTo(t)>0?this:t}function Eh(t,e,r){var n,i,o=Math.min(t.t,this.t);for(n=0;n<o;++n)r.data[n]=e(this.data[n],t.data[n]);if(t.t<this.t){for(i=t.s&this.DM,n=o;n<this.t;++n)r.data[n]=e(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<t.t;++n)r.data[n]=e(i,t.data[n]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()}function Sh(t,e){return t&e}function Bh(t){var e=et();return this.bitwiseTo(t,Sh,e),e}function mo(t,e){return t|e}function Ah(t){var e=et();return this.bitwiseTo(t,mo,e),e}function a0(t,e){return t^e}function Ih(t){var e=et();return this.bitwiseTo(t,a0,e),e}function f0(t,e){return t&~e}function Th(t){var e=et();return this.bitwiseTo(t,f0,e),e}function Ch(){for(var t=et(),e=0;e<this.t;++e)t.data[e]=this.DM&~this.data[e];return t.t=this.t,t.s=~this.s,t}function _h(t){var e=et();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}function Rh(t){var e=et();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}function Lh(t){if(t==0)return-1;var e=0;return t&65535||(t>>=16,e+=16),t&255||(t>>=8,e+=8),t&15||(t>>=4,e+=4),t&3||(t>>=2,e+=2),t&1||++e,e}function Dh(){for(var t=0;t<this.t;++t)if(this.data[t]!=0)return t*this.DB+Lh(this.data[t]);return this.s<0?this.t*this.DB:-1}function Ph(t){for(var e=0;t!=0;)t&=t-1,++e;return e}function kh(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=Ph(this.data[r]^e);return t}function Nh(t){var e=Math.floor(t/this.DB);return e>=this.t?this.s!=0:(this.data[e]&1<<t%this.DB)!=0}function Uh(t,e){var r=I.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r}function Oh(t){return this.changeBit(t,mo)}function Kh(t){return this.changeBit(t,f0)}function Fh(t){return this.changeBit(t,a0)}function Mh(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this.data[r]+t.data[r],e.data[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n+=t.s;r<this.t;)n+=this.data[r],e.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n+=t.data[r],e.data[r++]=n&this.DM,n>>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e.data[r++]=n:n<-1&&(e.data[r++]=this.DV+n),e.t=r,e.clamp()}function Vh(t){var e=et();return this.addTo(t,e),e}function qh(t){var e=et();return this.subTo(t,e),e}function zh(t){var e=et();return this.multiplyTo(t,e),e}function Hh(t){var e=et();return this.divRemTo(t,e,null),e}function $h(t){var e=et();return this.divRemTo(t,null,e),e}function Gh(t){var e=et(),r=et();return this.divRemTo(t,e,r),new Array(e,r)}function Wh(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function Yh(t,e){if(t!=0){for(;this.t<=e;)this.data[this.t++]=0;for(this.data[e]+=t;this.data[e]>=this.DV;)this.data[e]-=this.DV,++e>=this.t&&(this.data[this.t++]=0),++this.data[e]}}function cn(){}function c0(t){return t}function Zh(t,e,r){t.multiplyTo(e,r)}function Qh(t,e){t.squareTo(e)}cn.prototype.convert=c0;cn.prototype.revert=c0;cn.prototype.mulTo=Zh;cn.prototype.sqrTo=Qh;function Xh(t){return this.exp(t,new cn)}function Jh(t,e,r){var n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;var i;for(i=r.t-this.t;n<i;++n)r.data[n+this.t]=this.am(0,t.data[n],r,n,0,this.t);for(i=Math.min(t.t,e);n<i;++n)this.am(0,t.data[n],r,n,0,e-n);r.clamp()}function jh(t,e,r){--e;var n=r.t=this.t+t.t-e;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(e-this.t,0);n<t.t;++n)r.data[this.t+n-e]=this.am(e-n,t.data[n],r,0,0,this.t+n-e);r.clamp(),r.drShiftTo(1,r)}function Pr(t){this.r2=et(),this.q3=et(),I.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function td(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=et();return t.copyTo(e),this.reduce(e),e}function ed(t){return t}function rd(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function nd(t,e){t.squareTo(e),this.reduce(e)}function id(t,e,r){t.multiplyTo(e,r),this.reduce(r)}Pr.prototype.convert=td;Pr.prototype.revert=ed;Pr.prototype.reduce=rd;Pr.prototype.mulTo=id;Pr.prototype.sqrTo=nd;function od(t,e){var r=t.bitLength(),n,i=We(1),o;if(r<=0)return i;r<18?n=1:r<48?n=3:r<144?n=4:r<768?n=5:n=6,r<8?o=new ur(e):e.isEven()?o=new Pr(e):o=new lr(e);var s=new Array,a=3,c=n-1,f=(1<<n)-1;if(s[1]=o.convert(this),n>1){var u=et();for(o.sqrTo(s[1],u);a<=f;)s[a]=et(),o.mulTo(u,s[a-2],s[a]),a+=2}var l=t.t-1,p,d=!0,h=et(),y;for(r=qn(t.data[l])-1;l>=0;){for(r>=c?p=t.data[l]>>r-c&f:(p=(t.data[l]&(1<<r+1)-1)<<c-r,l>0&&(p|=t.data[l-1]>>this.DB+r-c)),a=n;!(p&1);)p>>=1,--a;if((r-=a)<0&&(r+=this.DB,--l),d)s[p].copyTo(i),d=!1;else{for(;a>1;)o.sqrTo(i,h),o.sqrTo(h,i),a-=2;a>0?o.sqrTo(i,h):(y=i,i=h,h=y),o.mulTo(h,s[p],i)}for(;l>=0&&!(t.data[l]&1<<r);)o.sqrTo(i,h),y=i,i=h,h=y,--r<0&&(r=this.DB-1,--l)}return o.revert(i)}function sd(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var n=e;e=r,r=n}var i=e.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return e;for(i<o&&(o=i),o>0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r}function ad(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(e==0)r=this.data[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this.data[n])%t;return r}function fd(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return I.ZERO;for(var r=t.clone(),n=this.clone(),i=We(1),o=We(0),s=We(0),a=We(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),e?((!i.isEven()||!o.isEven())&&(i.addTo(this,i),o.subTo(t,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),e?((!s.isEven()||!a.isEven())&&(s.addTo(this,s),a.subTo(t,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(s,i),o.subTo(a,o)):(n.subTo(r,n),e&&s.subTo(i,s),a.subTo(o,a))}if(n.compareTo(I.ONE)!=0)return I.ZERO;if(a.compareTo(t)>=0)return a.subtract(t);if(a.signum()<0)a.addTo(t,a);else return a;return a.signum()<0?a.add(t):a}var ie=[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],cd=(1<<26)/ie[ie.length-1];function ud(t){var e,r=this.abs();if(r.t==1&&r.data[0]<=ie[ie.length-1]){for(e=0;e<ie.length;++e)if(r.data[0]==ie[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<ie.length;){for(var n=ie[e],i=e+1;i<ie.length&&n<cd;)n*=ie[i++];for(n=r.modInt(n);e<i;)if(n%ie[e++]==0)return!1}return r.millerRabin(t)}function ld(t){var e=this.subtract(I.ONE),r=e.getLowestSetBit();if(r<=0)return!1;for(var n=e.shiftRight(r),i=hd(),o,s=0;s<t;++s){do o=new I(this.bitLength(),i);while(o.compareTo(I.ONE)<=0||o.compareTo(e)>=0);var a=o.modPow(n,this);if(a.compareTo(I.ONE)!=0&&a.compareTo(e)!=0){for(var c=1;c++<r&&a.compareTo(e)!=0;)if(a=a.modPowInt(2,this),a.compareTo(I.ONE)==0)return!1;if(a.compareTo(e)!=0)return!1}}return!0}function hd(){return{nextBytes:function(t){for(var e=0;e<t.length;++e)t[e]=Math.floor(Math.random()*256)}}}I.prototype.chunkSize=dh;I.prototype.toRadix=yh;I.prototype.fromRadix=gh;I.prototype.fromNumber=xh;I.prototype.bitwiseTo=Eh;I.prototype.changeBit=Uh;I.prototype.addTo=Mh;I.prototype.dMultiply=Wh;I.prototype.dAddOffset=Yh;I.prototype.multiplyLowerTo=Jh;I.prototype.multiplyUpperTo=jh;I.prototype.modInt=ad;I.prototype.millerRabin=ld;I.prototype.clone=ch;I.prototype.intValue=uh;I.prototype.byteValue=lh;I.prototype.shortValue=hh;I.prototype.signum=ph;I.prototype.toByteArray=mh;I.prototype.equals=vh;I.prototype.min=bh;I.prototype.max=wh;I.prototype.and=Bh;I.prototype.or=Ah;I.prototype.xor=Ih;I.prototype.andNot=Th;I.prototype.not=Ch;I.prototype.shiftLeft=_h;I.prototype.shiftRight=Rh;I.prototype.getLowestSetBit=Dh;I.prototype.bitCount=kh;I.prototype.testBit=Nh;I.prototype.setBit=Oh;I.prototype.clearBit=Kh;I.prototype.flipBit=Fh;I.prototype.add=Vh;I.prototype.subtract=qh;I.prototype.multiply=zh;I.prototype.divide=Hh;I.prototype.remainder=$h;I.prototype.divideAndRemainder=Gh;I.prototype.modPow=od;I.prototype.modInverse=fd;I.prototype.pow=Xh;I.prototype.gcd=sd;I.prototype.isProbablePrime=ud});var y0=ft((Dg,p0)=>{var ve=ct();cr();Et();var h0=p0.exports=ve.sha1=ve.sha1||{};ve.md.sha1=ve.md.algorithms.sha1=h0;h0.create=function(){d0||dd();var t=null,e=ve.util.createBuffer(),r=new Array(80),n={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var i=n.messageLengthSize/4,o=0;o<i;++o)n.fullMessageLength.push(0);return e=ve.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},n},n.start(),n.update=function(i,o){o==="utf8"&&(i=ve.util.encodeUtf8(i));var s=i.length;n.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var a=n.fullMessageLength.length-1;a>=0;--a)n.fullMessageLength[a]+=s[1],s[1]=s[0]+(n.fullMessageLength[a]/4294967296>>>0),n.fullMessageLength[a]=n.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return e.putBytes(i),l0(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var i=ve.util.createBuffer();i.putBytes(e.bytes());var o=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,s=o&n.blockLength-1;i.putBytes(vo.substr(0,n.blockLength-s));for(var a,c,f=n.fullMessageLength[0]*8,u=0;u<n.fullMessageLength.length-1;++u)a=n.fullMessageLength[u+1]*8,c=a/4294967296>>>0,f+=c,i.putInt32(f>>>0),f=a>>>0;i.putInt32(f);var l={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};l0(l,r,i);var p=ve.util.createBuffer();return p.putInt32(l.h0),p.putInt32(l.h1),p.putInt32(l.h2),p.putInt32(l.h3),p.putInt32(l.h4),p},n};var vo=null,d0=!1;function dd(){vo="\x80",vo+=ve.util.fillString("\0",64),d0=!0}function l0(t,e,r){for(var n,i,o,s,a,c,f,u,l=r.length();l>=64;){for(i=t.h0,o=t.h1,s=t.h2,a=t.h3,c=t.h4,u=0;u<16;++u)n=r.getInt32(),e[u]=n,f=a^o&(s^a),n=(i<<5|i>>>27)+f+c+1518500249+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<20;++u)n=e[u-3]^e[u-8]^e[u-14]^e[u-16],n=n<<1|n>>>31,e[u]=n,f=a^o&(s^a),n=(i<<5|i>>>27)+f+c+1518500249+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<32;++u)n=e[u-3]^e[u-8]^e[u-14]^e[u-16],n=n<<1|n>>>31,e[u]=n,f=o^s^a,n=(i<<5|i>>>27)+f+c+1859775393+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<40;++u)n=e[u-6]^e[u-16]^e[u-28]^e[u-32],n=n<<2|n>>>30,e[u]=n,f=o^s^a,n=(i<<5|i>>>27)+f+c+1859775393+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<60;++u)n=e[u-6]^e[u-16]^e[u-28]^e[u-32],n=n<<2|n>>>30,e[u]=n,f=o&s|a&(o^s),n=(i<<5|i>>>27)+f+c+2400959708+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<80;++u)n=e[u-6]^e[u-16]^e[u-28]^e[u-32],n=n<<2|n>>>30,e[u]=n,f=o^s^a,n=(i<<5|i>>>27)+f+c+3395469782+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;t.h0=t.h0+i|0,t.h1=t.h1+o|0,t.h2=t.h2+s|0,t.h3=t.h3+a|0,t.h4=t.h4+c|0,l-=64}}});var m0=ft((Pg,x0)=>{var be=ct();Et();fn();y0();var g0=x0.exports=be.pkcs1=be.pkcs1||{};g0.encode_rsa_oaep=function(t,e,r){var n,i,o,s;typeof r=="string"?(n=r,i=arguments[3]||void 0,o=arguments[4]||void 0):r&&(n=r.label||void 0,i=r.seed||void 0,o=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),o?o.start():o=be.md.sha1.create(),s||(s=o);var a=Math.ceil(t.n.bitLength()/8),c=a-2*o.digestLength-2;if(e.length>c){var f=new Error("RSAES-OAEP input message length is too long.");throw f.length=e.length,f.maxLength=c,f}n||(n=""),o.update(n,"raw");for(var u=o.digest(),l="",p=c-e.length,d=0;d<p;d++)l+="\0";var h=u.getBytes()+l+""+e;if(!i)i=be.random.getBytes(o.digestLength);else if(i.length!==o.digestLength){var f=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw f.seedLength=i.length,f.digestLength=o.digestLength,f}var y=Hn(i,a-o.digestLength-1,s),g=be.util.xorBytes(h,y,h.length),x=Hn(g,o.digestLength,s),m=be.util.xorBytes(i,x,i.length);return"\0"+m+g};g0.decode_rsa_oaep=function(t,e,r){var n,i,o;typeof r=="string"?(n=r,i=arguments[3]||void 0):r&&(n=r.label||void 0,i=r.md||void 0,r.mgf1&&r.mgf1.md&&(o=r.mgf1.md));var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var g=new Error("RSAES-OAEP encoded message length is invalid.");throw g.length=e.length,g.expectedLength=s,g}if(i===void 0?i=be.md.sha1.create():i.start(),o||(o=i),s<2*i.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");n||(n=""),i.update(n,"raw");for(var a=i.digest().getBytes(),c=e.charAt(0),f=e.substring(1,i.digestLength+1),u=e.substring(1+i.digestLength),l=Hn(u,i.digestLength,o),p=be.util.xorBytes(f,l,f.length),d=Hn(p,s-i.digestLength-1,o),h=be.util.xorBytes(u,d,u.length),y=h.substring(0,i.digestLength),g=c!=="\0",x=0;x<i.digestLength;++x)g|=a.charAt(x)!==y.charAt(x);for(var m=1,b=i.digestLength,_=i.digestLength;_<h.length;_++){var E=h.charCodeAt(_),S=E&1^1,L=m?65534:0;g|=E&L,m=m&S,b+=m}if(g||h.charCodeAt(b)!==1)throw new Error("Invalid RSAES-OAEP padding.");return h.substring(b+1)};function Hn(t,e,r){r||(r=be.md.sha1.create());for(var n="",i=Math.ceil(e/r.digestLength),o=0;o<i;++o){var s=String.fromCharCode(o>>24&255,o>>16&255,o>>8&255,o&255);r.start(),r.update(t+s),n+=r.digest().getBytes()}return n.substring(0,e)}});var v0=ft((kg,bo)=>{var Ye=ct();Et();zn();fn();(function(){if(Ye.prime){bo.exports=Ye.prime;return}var t=bo.exports=Ye.prime=Ye.prime||{},e=Ye.jsbn.BigInteger,r=[6,4,2,4,2,4,6,2],n=new e(null);n.fromInt(30);var i=function(l,p){return l|p};t.generateProbablePrime=function(l,p,d){typeof p=="function"&&(d=p,p={}),p=p||{};var h=p.algorithm||"PRIMEINC";typeof h=="string"&&(h={name:h}),h.options=h.options||{};var y=p.prng||Ye.random,g={nextBytes:function(x){for(var m=y.getBytesSync(x.length),b=0;b<x.length;++b)x[b]=m.charCodeAt(b)}};if(h.name==="PRIMEINC")return o(l,g,h.options,d);throw new Error("Invalid prime generation algorithm: "+h.name)};function o(l,p,d,h){return"workers"in d?c(l,p,d,h):s(l,p,d,h)}function s(l,p,d,h){var y=f(l,p),g=0,x=u(y.bitLength());"millerRabinTests"in d&&(x=d.millerRabinTests);var m=10;"maxBlockTime"in d&&(m=d.maxBlockTime),a(y,l,p,g,x,m,h)}function a(l,p,d,h,y,g,x){var m=+new Date;do{if(l.bitLength()>p&&(l=f(p,d)),l.isProbablePrime(y))return x(null,l);l.dAddOffset(r[h++%8],0)}while(g<0||+new Date-m<g);Ye.util.setImmediate(function(){a(l,p,d,h,y,g,x)})}function c(l,p,d,h){if(typeof Worker>"u")return s(l,p,d,h);var y=f(l,p),g=d.workers,x=d.workLoad||100,m=x*30/8,b=d.workerScript||"forge/prime.worker.js";if(g===-1)return Ye.util.estimateCores(function(E,S){E&&(S=2),g=S-1,_()});_();function _(){g=Math.max(1,g);for(var E=[],S=0;S<g;++S)E[S]=new Worker(b);for(var L=g,S=0;S<g;++S)E[S].addEventListener("message",z);var D=!1;function z(q){if(!D){--L;var M=q.data;if(M.found){for(var X=0;X<E.length;++X)E[X].terminate();return D=!0,h(null,new e(M.prime,16))}y.bitLength()>l&&(y=f(l,p));var at=y.toString(16);q.target.postMessage({hex:at,workLoad:x}),y.dAddOffset(m,0)}}}}function f(l,p){var d=new e(l,p),h=l-1;return d.testBit(h)||d.bitwiseTo(e.ONE.shiftLeft(h),i,d),d.dAddOffset(31-d.mod(n).byteValue(),0),d}function u(l){return l<=100?27:l<=150?18:l<=200?15:l<=250?12:l<=300?9:l<=350?8:l<=400?7:l<=500?6:l<=600?5:l<=800?4:l<=1250?3:2}})()});var Gn=ft((Ng,I0)=>{var F=ct();an();zn();Rn();m0();v0();fn();Et();typeof tt>"u"&&(tt=F.jsbn.BigInteger);var tt,wo=F.util.isNodejs?On():null,w=F.asn1,jt=F.util;F.pki=F.pki||{};I0.exports=F.pki.rsa=F.rsa=F.rsa||{};var H=F.pki,pd=[6,4,2,4,2,4,6,2],yd={name:"PrivateKeyInfo",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:w.Class.UNIVERSAL,type:w.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:w.Class.UNIVERSAL,type:w.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},gd={name:"RSAPrivateKey",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},xd={name:"RSAPublicKey",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},md=F.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:w.Class.UNIVERSAL,type:w.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:w.Class.UNIVERSAL,type:w.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},vd={name:"DigestInfo",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:w.Class.UNIVERSAL,type:w.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:w.Class.UNIVERSAL,type:w.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:w.Class.UNIVERSAL,type:w.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},bd=function(t){var e;if(t.algorithm in H.oids)e=H.oids[t.algorithm];else{var r=new Error("Unknown message digest algorithm.");throw r.algorithm=t.algorithm,r}var n=w.oidToDer(e).getBytes(),i=w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[]),o=w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[]);o.value.push(w.create(w.Class.UNIVERSAL,w.Type.OID,!1,n)),o.value.push(w.create(w.Class.UNIVERSAL,w.Type.NULL,!1,""));var s=w.create(w.Class.UNIVERSAL,w.Type.OCTETSTRING,!1,t.digest().getBytes());return i.value.push(o),i.value.push(s),w.toDer(i).getBytes()},B0=function(t,e,r){if(r)return t.modPow(e.e,e.n);if(!e.p||!e.q)return t.modPow(e.d,e.n);e.dP||(e.dP=e.d.mod(e.p.subtract(tt.ONE))),e.dQ||(e.dQ=e.d.mod(e.q.subtract(tt.ONE))),e.qInv||(e.qInv=e.q.modInverse(e.p));var n;do n=new tt(F.util.bytesToHex(F.random.getBytes(e.n.bitLength()/8)),16);while(n.compareTo(e.n)>=0||!n.gcd(e.n).equals(tt.ONE));t=t.multiply(n.modPow(e.e,e.n)).mod(e.n);for(var i=t.mod(e.p).modPow(e.dP,e.p),o=t.mod(e.q).modPow(e.dQ,e.q);i.compareTo(o)<0;)i=i.add(e.p);var s=i.subtract(o).multiply(e.qInv).mod(e.p).multiply(e.q).add(o);return s=s.multiply(n.modInverse(e.n)).mod(e.n),s};H.rsa.encrypt=function(t,e,r){var n=r,i,o=Math.ceil(e.n.bitLength()/8);r!==!1&&r!==!0?(n=r===2,i=A0(t,e,r)):(i=F.util.createBuffer(),i.putBytes(t));for(var s=new tt(i.toHex(),16),a=B0(s,e,n),c=a.toString(16),f=F.util.createBuffer(),u=o-Math.ceil(c.length/2);u>0;)f.putByte(0),--u;return f.putBytes(F.util.hexToBytes(c)),f.getBytes()};H.rsa.decrypt=function(t,e,r,n){var i=Math.ceil(e.n.bitLength()/8);if(t.length!==i){var o=new Error("Encrypted message length is invalid.");throw o.length=t.length,o.expected=i,o}var s=new tt(F.util.createBuffer(t).toHex(),16);if(s.compareTo(e.n)>=0)throw new Error("Encrypted message is invalid.");for(var a=B0(s,e,r),c=a.toString(16),f=F.util.createBuffer(),u=i-Math.ceil(c.length/2);u>0;)f.putByte(0),--u;return f.putBytes(F.util.hexToBytes(c)),n!==!1?$n(f.getBytes(),e,r):f.getBytes()};H.rsa.createKeyPairGenerationState=function(t,e,r){typeof t=="string"&&(t=parseInt(t,10)),t=t||2048,r=r||{};var n=r.prng||F.random,i={nextBytes:function(a){for(var c=n.getBytesSync(a.length),f=0;f<a.length;++f)a[f]=c.charCodeAt(f)}},o=r.algorithm||"PRIMEINC",s;if(o==="PRIMEINC")s={algorithm:o,state:0,bits:t,rng:i,eInt:e||65537,e:new tt(null),p:null,q:null,qBits:t>>1,pBits:t-(t>>1),pqState:0,num:null,keys:null},s.e.fromInt(s.eInt);else throw new Error("Invalid key generation algorithm: "+o);return s};H.rsa.stepKeyPairGenerationState=function(t,e){"algorithm"in t||(t.algorithm="PRIMEINC");var r=new tt(null);r.fromInt(30);for(var n=0,i=function(l,p){return l|p},o=+new Date,s,a=0;t.keys===null&&(e<=0||a<e);){if(t.state===0){var c=t.p===null?t.pBits:t.qBits,f=c-1;t.pqState===0?(t.num=new tt(c,t.rng),t.num.testBit(f)||t.num.bitwiseTo(tt.ONE.shiftLeft(f),i,t.num),t.num.dAddOffset(31-t.num.mod(r).byteValue(),0),n=0,++t.pqState):t.pqState===1?t.num.bitLength()>c?t.pqState=0:t.num.isProbablePrime(Ed(t.num.bitLength()))?++t.pqState:t.num.dAddOffset(pd[n++%8],0):t.pqState===2?t.pqState=t.num.subtract(tt.ONE).gcd(t.e).compareTo(tt.ONE)===0?3:0:t.pqState===3&&(t.pqState=0,t.p===null?t.p=t.num:t.q=t.num,t.p!==null&&t.q!==null&&++t.state,t.num=null)}else if(t.state===1)t.p.compareTo(t.q)<0&&(t.num=t.p,t.p=t.q,t.q=t.num),++t.state;else if(t.state===2)t.p1=t.p.subtract(tt.ONE),t.q1=t.q.subtract(tt.ONE),t.phi=t.p1.multiply(t.q1),++t.state;else if(t.state===3)t.phi.gcd(t.e).compareTo(tt.ONE)===0?++t.state:(t.p=null,t.q=null,t.state=0);else if(t.state===4)t.n=t.p.multiply(t.q),t.n.bitLength()===t.bits?++t.state:(t.q=null,t.state=0);else if(t.state===5){var u=t.e.modInverse(t.phi);t.keys={privateKey:H.rsa.setPrivateKey(t.n,t.e,u,t.p,t.q,u.mod(t.p1),u.mod(t.q1),t.q.modInverse(t.p)),publicKey:H.rsa.setPublicKey(t.n,t.e)}}s=+new Date,a+=s-o,o=s}return t.keys!==null};H.rsa.generateKeyPair=function(t,e,r,n){if(arguments.length===1?typeof t=="object"?(r=t,t=void 0):typeof t=="function"&&(n=t,t=void 0):arguments.length===2?typeof t=="number"?typeof e=="function"?(n=e,e=void 0):typeof e!="number"&&(r=e,e=void 0):(r=t,n=e,t=void 0,e=void 0):arguments.length===3&&(typeof e=="number"?typeof r=="function"&&(n=r,r=void 0):(n=r,r=e,e=void 0)),r=r||{},t===void 0&&(t=r.bits||2048),e===void 0&&(e=r.e||65537),!F.options.usePureJavaScript&&!r.prng&&t>=256&&t<=16384&&(e===65537||e===3)){if(n){if(b0("generateKeyPair"))return wo.generateKeyPair("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(a,c,f){if(a)return n(a);n(null,{privateKey:H.privateKeyFromPem(f),publicKey:H.publicKeyFromPem(c)})});if(w0("generateKey")&&w0("exportKey"))return jt.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:S0(e),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(a){return jt.globalScope.crypto.subtle.exportKey("pkcs8",a.privateKey)}).then(void 0,function(a){n(a)}).then(function(a){if(a){var c=H.privateKeyFromAsn1(w.fromDer(F.util.createBuffer(a)));n(null,{privateKey:c,publicKey:H.setRsaPublicKey(c.n,c.e)})}});if(E0("generateKey")&&E0("exportKey")){var i=jt.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:S0(e),hash:{name:"SHA-256"}},!0,["sign","verify"]);i.oncomplete=function(a){var c=a.target.result,f=jt.globalScope.msCrypto.subtle.exportKey("pkcs8",c.privateKey);f.oncomplete=function(u){var l=u.target.result,p=H.privateKeyFromAsn1(w.fromDer(F.util.createBuffer(l)));n(null,{privateKey:p,publicKey:H.setRsaPublicKey(p.n,p.e)})},f.onerror=function(u){n(u)}},i.onerror=function(a){n(a)};return}}else if(b0("generateKeyPairSync")){var o=wo.generateKeyPairSync("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:H.privateKeyFromPem(o.privateKey),publicKey:H.publicKeyFromPem(o.publicKey)}}}var s=H.rsa.createKeyPairGenerationState(t,e,r);if(!n)return H.rsa.stepKeyPairGenerationState(s,0),s.keys;wd(s,r,n)};H.setRsaPublicKey=H.rsa.setPublicKey=function(t,e){var r={n:t,e};return r.encrypt=function(n,i,o){if(typeof i=="string"?i=i.toUpperCase():i===void 0&&(i="RSAES-PKCS1-V1_5"),i==="RSAES-PKCS1-V1_5")i={encode:function(a,c,f){return A0(a,c,2).getBytes()}};else if(i==="RSA-OAEP"||i==="RSAES-OAEP")i={encode:function(a,c){return F.pkcs1.encode_rsa_oaep(c,a,o)}};else if(["RAW","NONE","NULL",null].indexOf(i)!==-1)i={encode:function(a){return a}};else if(typeof i=="string")throw new Error('Unsupported encryption scheme: "'+i+'".');var s=i.encode(n,r,!0);return H.rsa.encrypt(s,r,!0)},r.verify=function(n,i,o,s){typeof o=="string"?o=o.toUpperCase():o===void 0&&(o="RSASSA-PKCS1-V1_5"),s===void 0&&(s={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in s||(s._parseAllDigestBytes=!0),o==="RSASSA-PKCS1-V1_5"?o={verify:function(c,f){f=$n(f,r,!0);var u=w.fromDer(f,{parseAllBytes:s._parseAllDigestBytes}),l={},p=[];if(!w.validate(u,vd,l,p)){var d=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw d.errors=p,d}var h=w.derToOid(l.algorithmIdentifier);if(!(h===F.oids.md2||h===F.oids.md5||h===F.oids.sha1||h===F.oids.sha224||h===F.oids.sha256||h===F.oids.sha384||h===F.oids.sha512||h===F.oids["sha512-224"]||h===F.oids["sha512-256"])){var d=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw d.oid=h,d}if((h===F.oids.md2||h===F.oids.md5)&&!("parameters"in l))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return c===l.digest}}:(o==="NONE"||o==="NULL"||o===null)&&(o={verify:function(c,f){return f=$n(f,r,!0),c===f}});var a=H.rsa.decrypt(i,r,!0,!1);return o.verify(n,a,r.n.bitLength())},r};H.setRsaPrivateKey=H.rsa.setPrivateKey=function(t,e,r,n,i,o,s,a){var c={n:t,e,d:r,p:n,q:i,dP:o,dQ:s,qInv:a};return c.decrypt=function(f,u,l){typeof u=="string"?u=u.toUpperCase():u===void 0&&(u="RSAES-PKCS1-V1_5");var p=H.rsa.decrypt(f,c,!1,!1);if(u==="RSAES-PKCS1-V1_5")u={decode:$n};else if(u==="RSA-OAEP"||u==="RSAES-OAEP")u={decode:function(d,h){return F.pkcs1.decode_rsa_oaep(h,d,l)}};else if(["RAW","NONE","NULL",null].indexOf(u)!==-1)u={decode:function(d){return d}};else throw new Error('Unsupported encryption scheme: "'+u+'".');return u.decode(p,c,!1)},c.sign=function(f,u){var l=!1;typeof u=="string"&&(u=u.toUpperCase()),u===void 0||u==="RSASSA-PKCS1-V1_5"?(u={encode:bd},l=1):(u==="NONE"||u==="NULL"||u===null)&&(u={encode:function(){return f}},l=1);var p=u.encode(f,c.n.bitLength());return H.rsa.encrypt(p,c,l)},c};H.wrapRsaPrivateKey=function(t){return w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,w.integerToDer(0).getBytes()),w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.OID,!1,w.oidToDer(H.oids.rsaEncryption).getBytes()),w.create(w.Class.UNIVERSAL,w.Type.NULL,!1,"")]),w.create(w.Class.UNIVERSAL,w.Type.OCTETSTRING,!1,w.toDer(t).getBytes())])};H.privateKeyFromAsn1=function(t){var e={},r=[];if(w.validate(t,yd,e,r)&&(t=w.fromDer(F.util.createBuffer(e.privateKey))),e={},r=[],!w.validate(t,gd,e,r)){var n=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw n.errors=r,n}var i,o,s,a,c,f,u,l;return i=F.util.createBuffer(e.privateKeyModulus).toHex(),o=F.util.createBuffer(e.privateKeyPublicExponent).toHex(),s=F.util.createBuffer(e.privateKeyPrivateExponent).toHex(),a=F.util.createBuffer(e.privateKeyPrime1).toHex(),c=F.util.createBuffer(e.privateKeyPrime2).toHex(),f=F.util.createBuffer(e.privateKeyExponent1).toHex(),u=F.util.createBuffer(e.privateKeyExponent2).toHex(),l=F.util.createBuffer(e.privateKeyCoefficient).toHex(),H.setRsaPrivateKey(new tt(i,16),new tt(o,16),new tt(s,16),new tt(a,16),new tt(c,16),new tt(f,16),new tt(u,16),new tt(l,16))};H.privateKeyToAsn1=H.privateKeyToRSAPrivateKey=function(t){return w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,w.integerToDer(0).getBytes()),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.n)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.e)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.d)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.p)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.q)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.dP)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.dQ)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.qInv))])};H.publicKeyFromAsn1=function(t){var e={},r=[];if(w.validate(t,md,e,r)){var n=w.derToOid(e.publicKeyOid);if(n!==H.oids.rsaEncryption){var i=new Error("Cannot read public key. Unknown OID.");throw i.oid=n,i}t=e.rsaPublicKey}if(r=[],!w.validate(t,xd,e,r)){var i=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw i.errors=r,i}var o=F.util.createBuffer(e.publicKeyModulus).toHex(),s=F.util.createBuffer(e.publicKeyExponent).toHex();return H.setRsaPublicKey(new tt(o,16),new tt(s,16))};H.publicKeyToAsn1=H.publicKeyToSubjectPublicKeyInfo=function(t){return w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.OID,!1,w.oidToDer(H.oids.rsaEncryption).getBytes()),w.create(w.Class.UNIVERSAL,w.Type.NULL,!1,"")]),w.create(w.Class.UNIVERSAL,w.Type.BITSTRING,!1,[H.publicKeyToRSAPublicKey(t)])])};H.publicKeyToRSAPublicKey=function(t){return w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.n)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.e))])};function A0(t,e,r){var n=F.util.createBuffer(),i=Math.ceil(e.n.bitLength()/8);if(t.length>i-11){var o=new Error("Message is too long for PKCS#1 v1.5 padding.");throw o.length=t.length,o.max=i-11,o}n.putByte(0),n.putByte(r);var s=i-3-t.length,a;if(r===0||r===1){a=r===0?0:255;for(var c=0;c<s;++c)n.putByte(a)}else for(;s>0;){for(var f=0,u=F.random.getBytes(s),c=0;c<s;++c)a=u.charCodeAt(c),a===0?++f:n.putByte(a);s=f}return n.putByte(0),n.putBytes(t),n}function $n(t,e,r,n){var i=Math.ceil(e.n.bitLength()/8),o=F.util.createBuffer(t),s=o.getByte(),a=o.getByte();if(s!==0||r&&a!==0&&a!==1||!r&&a!=2||r&&a===0&&typeof n>"u")throw new Error("Encryption block is invalid.");var c=0;if(a===0){c=i-3-n;for(var f=0;f<c;++f)if(o.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(a===1)for(c=0;o.length()>1;){if(o.getByte()!==255){--o.read;break}++c}else if(a===2)for(c=0;o.length()>1;){if(o.getByte()===0){--o.read;break}++c}var u=o.getByte();if(u!==0||c!==i-3-o.length())throw new Error("Encryption block is invalid.");return o.getBytes()}function wd(t,e,r){typeof e=="function"&&(r=e,e={}),e=e||{};var n={algorithm:{name:e.algorithm||"PRIMEINC",options:{workers:e.workers||2,workLoad:e.workLoad||100,workerScript:e.workerScript}}};"prng"in e&&(n.prng=e.prng),i();function i(){o(t.pBits,function(a,c){if(a)return r(a);if(t.p=c,t.q!==null)return s(a,t.q);o(t.qBits,s)})}function o(a,c){F.prime.generateProbablePrime(a,n,c)}function s(a,c){if(a)return r(a);if(t.q=c,t.p.compareTo(t.q)<0){var f=t.p;t.p=t.q,t.q=f}if(t.p.subtract(tt.ONE).gcd(t.e).compareTo(tt.ONE)!==0){t.p=null,i();return}if(t.q.subtract(tt.ONE).gcd(t.e).compareTo(tt.ONE)!==0){t.q=null,o(t.qBits,s);return}if(t.p1=t.p.subtract(tt.ONE),t.q1=t.q.subtract(tt.ONE),t.phi=t.p1.multiply(t.q1),t.phi.gcd(t.e).compareTo(tt.ONE)!==0){t.p=t.q=null,i();return}if(t.n=t.p.multiply(t.q),t.n.bitLength()!==t.bits){t.q=null,o(t.qBits,s);return}var u=t.e.modInverse(t.phi);t.keys={privateKey:H.rsa.setPrivateKey(t.n,t.e,u,t.p,t.q,u.mod(t.p1),u.mod(t.q1),t.q.modInverse(t.p)),publicKey:H.rsa.setPublicKey(t.n,t.e)},r(null,t.keys)}}function we(t){var e=t.toString(16);e[0]>="8"&&(e="00"+e);var r=F.util.hexToBytes(e);return r.length>1&&(r.charCodeAt(0)===0&&!(r.charCodeAt(1)&128)||r.charCodeAt(0)===255&&(r.charCodeAt(1)&128)===128)?r.substr(1):r}function Ed(t){return t<=100?27:t<=150?18:t<=200?15:t<=250?12:t<=300?9:t<=350?8:t<=400?7:t<=500?6:t<=600?5:t<=800?4:t<=1250?3:2}function b0(t){return F.util.isNodejs&&typeof wo[t]=="function"}function w0(t){return typeof jt.globalScope<"u"&&typeof jt.globalScope.crypto=="object"&&typeof jt.globalScope.crypto.subtle=="object"&&typeof jt.globalScope.crypto.subtle[t]=="function"}function E0(t){return typeof jt.globalScope<"u"&&typeof jt.globalScope.msCrypto=="object"&&typeof jt.globalScope.msCrypto.subtle=="object"&&typeof jt.globalScope.msCrypto.subtle[t]=="function"}function S0(t){for(var e=F.util.hexToBytes(t.toString(16)),r=new Uint8Array(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}});var D0=ft((Ug,L0)=>{var U=ct();lo();an();Ua();cr();Rn();Va();Ha();fn();r0();Gn();Et();typeof T0>"u"&&(T0=U.jsbn.BigInteger);var T0,B=U.asn1,G=U.pki=U.pki||{};L0.exports=G.pbe=U.pbe=U.pbe||{};var hr=G.oids,Sd={name:"EncryptedPrivateKeyInfo",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:B.Class.UNIVERSAL,type:B.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:B.Class.UNIVERSAL,type:B.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},Bd={name:"PBES2Algorithms",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:B.Class.UNIVERSAL,type:B.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:B.Class.UNIVERSAL,type:B.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:B.Class.UNIVERSAL,type:B.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:B.Class.UNIVERSAL,type:B.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:B.Class.UNIVERSAL,type:B.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:B.Class.UNIVERSAL,type:B.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:B.Class.UNIVERSAL,type:B.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},Ad={name:"pkcs-12PbeParams",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:B.Class.UNIVERSAL,type:B.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:B.Class.UNIVERSAL,type:B.Type.INTEGER,constructed:!1,capture:"iterations"}]};G.encryptPrivateKeyInfo=function(t,e,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var n=U.random.getBytesSync(r.saltSize),i=r.count,o=B.integerToDer(i),s,a,c;if(r.algorithm.indexOf("aes")===0||r.algorithm==="des"){var f,u,l;switch(r.algorithm){case"aes128":s=16,f=16,u=hr["aes128-CBC"],l=U.aes.createEncryptionCipher;break;case"aes192":s=24,f=16,u=hr["aes192-CBC"],l=U.aes.createEncryptionCipher;break;case"aes256":s=32,f=16,u=hr["aes256-CBC"],l=U.aes.createEncryptionCipher;break;case"des":s=8,f=8,u=hr.desCBC,l=U.des.createEncryptionCipher;break;default:var p=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw p.algorithm=r.algorithm,p}var d="hmacWith"+r.prfAlgorithm.toUpperCase(),h=R0(d),y=U.pkcs5.pbkdf2(e,n,i,s,h),g=U.random.getBytesSync(f),x=l(y);x.start(g),x.update(B.toDer(t)),x.finish(),c=x.output.getBytes();var m=Id(n,o,s,d);a=B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OID,!1,B.oidToDer(hr.pkcs5PBES2).getBytes()),B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OID,!1,B.oidToDer(hr.pkcs5PBKDF2).getBytes()),m]),B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OID,!1,B.oidToDer(u).getBytes()),B.create(B.Class.UNIVERSAL,B.Type.OCTETSTRING,!1,g)])])])}else if(r.algorithm==="3des"){s=24;var b=new U.util.ByteBuffer(n),y=G.pbe.generatePkcs12Key(e,b,1,i,s),g=G.pbe.generatePkcs12Key(e,b,2,i,s),x=U.des.createEncryptionCipher(y);x.start(g),x.update(B.toDer(t)),x.finish(),c=x.output.getBytes(),a=B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OID,!1,B.oidToDer(hr["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OCTETSTRING,!1,n),B.create(B.Class.UNIVERSAL,B.Type.INTEGER,!1,o.getBytes())])])}else{var p=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw p.algorithm=r.algorithm,p}var _=B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[a,B.create(B.Class.UNIVERSAL,B.Type.OCTETSTRING,!1,c)]);return _};G.decryptPrivateKeyInfo=function(t,e){var r=null,n={},i=[];if(!B.validate(t,Sd,n,i)){var o=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=B.derToOid(n.encryptionOid),a=G.pbe.getCipher(s,n.encryptionParams,e),c=U.util.createBuffer(n.encryptedData);return a.update(c),a.finish()&&(r=B.fromDer(a.output)),r};G.encryptedPrivateKeyToPem=function(t,e){var r={type:"ENCRYPTED PRIVATE KEY",body:B.toDer(t).getBytes()};return U.pem.encode(r,{maxline:e})};G.encryptedPrivateKeyFromPem=function(t){var e=U.pem.decode(t)[0];if(e.type!=="ENCRYPTED PRIVATE KEY"){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=e.type,r}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return B.fromDer(e.body)};G.encryptRsaPrivateKey=function(t,e,r){if(r=r||{},!r.legacy){var n=G.wrapRsaPrivateKey(G.privateKeyToAsn1(t));return n=G.encryptPrivateKeyInfo(n,e,r),G.encryptedPrivateKeyToPem(n)}var i,o,s,a;switch(r.algorithm){case"aes128":i="AES-128-CBC",s=16,o=U.random.getBytesSync(16),a=U.aes.createEncryptionCipher;break;case"aes192":i="AES-192-CBC",s=24,o=U.random.getBytesSync(16),a=U.aes.createEncryptionCipher;break;case"aes256":i="AES-256-CBC",s=32,o=U.random.getBytesSync(16),a=U.aes.createEncryptionCipher;break;case"3des":i="DES-EDE3-CBC",s=24,o=U.random.getBytesSync(8),a=U.des.createEncryptionCipher;break;case"des":i="DES-CBC",s=8,o=U.random.getBytesSync(8),a=U.des.createEncryptionCipher;break;default:var c=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw c.algorithm=r.algorithm,c}var f=U.pbe.opensslDeriveBytes(e,o.substr(0,8),s),u=a(f);u.start(o),u.update(B.toDer(G.privateKeyToAsn1(t))),u.finish();var l={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:i,parameters:U.util.bytesToHex(o).toUpperCase()},body:u.output.getBytes()};return U.pem.encode(l)};G.decryptRsaPrivateKey=function(t,e){var r=null,n=U.pem.decode(t)[0];if(n.type!=="ENCRYPTED PRIVATE KEY"&&n.type!=="PRIVATE KEY"&&n.type!=="RSA PRIVATE KEY"){var i=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw i.headerType=i,i}if(n.procType&&n.procType.type==="ENCRYPTED"){var o,s;switch(n.dekInfo.algorithm){case"DES-CBC":o=8,s=U.des.createDecryptionCipher;break;case"DES-EDE3-CBC":o=24,s=U.des.createDecryptionCipher;break;case"AES-128-CBC":o=16,s=U.aes.createDecryptionCipher;break;case"AES-192-CBC":o=24,s=U.aes.createDecryptionCipher;break;case"AES-256-CBC":o=32,s=U.aes.createDecryptionCipher;break;case"RC2-40-CBC":o=5,s=function(l){return U.rc2.createDecryptionCipher(l,40)};break;case"RC2-64-CBC":o=8,s=function(l){return U.rc2.createDecryptionCipher(l,64)};break;case"RC2-128-CBC":o=16,s=function(l){return U.rc2.createDecryptionCipher(l,128)};break;default:var i=new Error('Could not decrypt private key; unsupported encryption algorithm "'+n.dekInfo.algorithm+'".');throw i.algorithm=n.dekInfo.algorithm,i}var a=U.util.hexToBytes(n.dekInfo.parameters),c=U.pbe.opensslDeriveBytes(e,a.substr(0,8),o),f=s(c);if(f.start(a),f.update(U.util.createBuffer(n.body)),f.finish())r=f.output.getBytes();else return r}else r=n.body;return n.type==="ENCRYPTED PRIVATE KEY"?r=G.decryptPrivateKeyInfo(B.fromDer(r),e):r=B.fromDer(r),r!==null&&(r=G.privateKeyFromAsn1(r)),r};G.pbe.generatePkcs12Key=function(t,e,r,n,i,o){var s,a;if(typeof o>"u"||o===null){if(!("sha1"in U.md))throw new Error('"sha1" hash algorithm unavailable.');o=U.md.sha1.create()}var c=o.digestLength,f=o.blockLength,u=new U.util.ByteBuffer,l=new U.util.ByteBuffer;if(t!=null){for(a=0;a<t.length;a++)l.putInt16(t.charCodeAt(a));l.putInt16(0)}var p=l.length(),d=e.length(),h=new U.util.ByteBuffer;h.fillWithByte(r,f);var y=f*Math.ceil(d/f),g=new U.util.ByteBuffer;for(a=0;a<y;a++)g.putByte(e.at(a%d));var x=f*Math.ceil(p/f),m=new U.util.ByteBuffer;for(a=0;a<x;a++)m.putByte(l.at(a%p));var b=g;b.putBuffer(m);for(var _=Math.ceil(i/c),E=1;E<=_;E++){var S=new U.util.ByteBuffer;S.putBytes(h.bytes()),S.putBytes(b.bytes());for(var L=0;L<n;L++)o.start(),o.update(S.getBytes()),S=o.digest();var D=new U.util.ByteBuffer;for(a=0;a<f;a++)D.putByte(S.at(a%c));var z=Math.ceil(d/f)+Math.ceil(p/f),q=new U.util.ByteBuffer;for(s=0;s<z;s++){var M=new U.util.ByteBuffer(b.getBytes(f)),X=511;for(a=D.length()-1;a>=0;a--)X=X>>8,X+=D.at(a)+M.at(a),M.setAt(a,X&255);q.putBuffer(M)}b=q,u.putBuffer(S)}return u.truncate(u.length()-i),u};G.pbe.getCipher=function(t,e,r){switch(t){case G.oids.pkcs5PBES2:return G.pbe.getCipherForPBES2(t,e,r);case G.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case G.oids["pbewithSHAAnd40BitRC2-CBC"]:return G.pbe.getCipherForPKCS12PBE(t,e,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=t,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}};G.pbe.getCipherForPBES2=function(t,e,r){var n={},i=[];if(!B.validate(e,Bd,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if(t=B.derToOid(n.kdfOid),t!==G.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=t,o.supportedOids=["pkcs5PBKDF2"],o}if(t=B.derToOid(n.encOid),t!==G.oids["aes128-CBC"]&&t!==G.oids["aes192-CBC"]&&t!==G.oids["aes256-CBC"]&&t!==G.oids["des-EDE3-CBC"]&&t!==G.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=t,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,a=U.util.createBuffer(n.kdfIterationCount);a=a.getInt(a.length()<<3);var c,f;switch(G.oids[t]){case"aes128-CBC":c=16,f=U.aes.createDecryptionCipher;break;case"aes192-CBC":c=24,f=U.aes.createDecryptionCipher;break;case"aes256-CBC":c=32,f=U.aes.createDecryptionCipher;break;case"des-EDE3-CBC":c=24,f=U.des.createDecryptionCipher;break;case"desCBC":c=8,f=U.des.createDecryptionCipher;break}var u=_0(n.prfOid),l=U.pkcs5.pbkdf2(r,s,a,c,u),p=n.encIv,d=f(l);return d.start(p),d};G.pbe.getCipherForPKCS12PBE=function(t,e,r){var n={},i=[];if(!B.validate(e,Ad,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=U.util.createBuffer(n.salt),a=U.util.createBuffer(n.iterations);a=a.getInt(a.length()<<3);var c,f,u;switch(t){case G.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,f=8,u=U.des.startDecrypting;break;case G.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,f=8,u=function(y,g){var x=U.rc2.createDecryptionCipher(y,40);return x.start(g,null),x};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=t,o}var l=_0(n.prfOid),p=G.pbe.generatePkcs12Key(r,s,1,a,c,l);l.start();var d=G.pbe.generatePkcs12Key(r,s,2,a,f,l);return u(p,d)};G.pbe.opensslDeriveBytes=function(t,e,r,n){if(typeof n>"u"||n===null){if(!("md5"in U.md))throw new Error('"md5" hash algorithm unavailable.');n=U.md.md5.create()}e===null&&(e="");for(var i=[C0(n,t+e)],o=16,s=1;o<r;++s,o+=16)i.push(C0(n,i[s-1]+t+e));return i.join("").substr(0,r)};function C0(t,e){return t.start().update(e).digest().getBytes()}function _0(t){var e;if(!t)e="hmacWithSHA1";else if(e=G.oids[B.derToOid(t)],!e){var r=new Error("Unsupported PRF OID.");throw r.oid=t,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}return R0(e)}function R0(t){var e=U.md;switch(t){case"hmacWithSHA224":e=U.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":t=t.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=t,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!e||!(t in e))throw new Error("Unknown hash algorithm: "+t);return e[t].create()}function Id(t,e,r,n){var i=B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OCTETSTRING,!1,t),B.create(B.Class.UNIVERSAL,B.Type.INTEGER,!1,e.getBytes())]);return n!=="hmacWithSHA1"&&i.value.push(B.create(B.Class.UNIVERSAL,B.Type.INTEGER,!1,U.util.hexToBytes(r.toString(16))),B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OID,!1,B.oidToDer(G.oids[n]).getBytes()),B.create(B.Class.UNIVERSAL,B.Type.NULL,!1,"")])),i}});var Ef=ft((tv,wf)=>{var pt=ct();cr();Et();var xn=wf.exports=pt.sha512=pt.sha512||{};pt.md.sha512=pt.md.algorithms.sha512=xn;var vf=pt.sha384=pt.sha512.sha384=pt.sha512.sha384||{};vf.create=function(){return xn.create("SHA-384")};pt.md.sha384=pt.md.algorithms.sha384=vf;pt.sha512.sha256=pt.sha512.sha256||{create:function(){return xn.create("SHA-512/256")}};pt.md["sha512/256"]=pt.md.algorithms["sha512/256"]=pt.sha512.sha256;pt.sha512.sha224=pt.sha512.sha224||{create:function(){return xn.create("SHA-512/224")}};pt.md["sha512/224"]=pt.md.algorithms["sha512/224"]=pt.sha512.sha224;xn.create=function(t){if(bf||Wp(),typeof t>"u"&&(t="SHA-512"),!(t in vr))throw new Error("Invalid SHA-512 algorithm: "+t);for(var e=vr[t],r=null,n=pt.util.createBuffer(),i=new Array(80),o=0;o<80;++o)i[o]=new Array(2);var s=64;switch(t){case"SHA-384":s=48;break;case"SHA-512/256":s=32;break;case"SHA-512/224":s=28;break}var a={algorithm:t.replace("-","").toLowerCase(),blockLength:128,digestLength:s,messageLength:0,fullMessageLength:null,messageLengthSize:16};return a.start=function(){a.messageLength=0,a.fullMessageLength=a.messageLength128=[];for(var c=a.messageLengthSize/4,f=0;f<c;++f)a.fullMessageLength.push(0);n=pt.util.createBuffer(),r=new Array(e.length);for(var f=0;f<e.length;++f)r[f]=e[f].slice(0);return a},a.start(),a.update=function(c,f){f==="utf8"&&(c=pt.util.encodeUtf8(c));var u=c.length;a.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var l=a.fullMessageLength.length-1;l>=0;--l)a.fullMessageLength[l]+=u[1],u[1]=u[0]+(a.fullMessageLength[l]/4294967296>>>0),a.fullMessageLength[l]=a.fullMessageLength[l]>>>0,u[0]=u[1]/4294967296>>>0;return n.putBytes(c),mf(r,i,n),(n.read>2048||n.length()===0)&&n.compact(),a},a.digest=function(){var c=pt.util.createBuffer();c.putBytes(n.bytes());var f=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,u=f&a.blockLength-1;c.putBytes(ts.substr(0,a.blockLength-u));for(var l,p,d=a.fullMessageLength[0]*8,h=0;h<a.fullMessageLength.length-1;++h)l=a.fullMessageLength[h+1]*8,p=l/4294967296>>>0,d+=p,c.putInt32(d>>>0),d=l>>>0;c.putInt32(d);for(var y=new Array(r.length),h=0;h<r.length;++h)y[h]=r[h].slice(0);mf(y,i,c);var g=pt.util.createBuffer(),x;t==="SHA-512"?x=y.length:t==="SHA-384"?x=y.length-2:x=y.length-4;for(var h=0;h<x;++h)g.putInt32(y[h][0]),(h!==x-1||t!=="SHA-512/224")&&g.putInt32(y[h][1]);return g},a};var ts=null,bf=!1,es=null,vr=null;function Wp(){ts="\x80",ts+=pt.util.fillString("\0",128),es=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],vr={},vr["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],vr["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],vr["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],vr["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],bf=!0}function mf(t,e,r){for(var n,i,o,s,a,c,f,u,l,p,d,h,y,g,x,m,b,_,E,S,L,D,z,q,M,X,at,kt,T,k,R,P,A,O,K,V=r.length();V>=128;){for(T=0;T<16;++T)e[T][0]=r.getInt32()>>>0,e[T][1]=r.getInt32()>>>0;for(;T<80;++T)P=e[T-2],k=P[0],R=P[1],n=((k>>>19|R<<13)^(R>>>29|k<<3)^k>>>6)>>>0,i=((k<<13|R>>>19)^(R<<3|k>>>29)^(k<<26|R>>>6))>>>0,O=e[T-15],k=O[0],R=O[1],o=((k>>>1|R<<31)^(k>>>8|R<<24)^k>>>7)>>>0,s=((k<<31|R>>>1)^(k<<24|R>>>8)^(k<<25|R>>>7))>>>0,A=e[T-7],K=e[T-16],R=i+A[1]+s+K[1],e[T][0]=n+A[0]+o+K[0]+(R/4294967296>>>0)>>>0,e[T][1]=R>>>0;for(y=t[0][0],g=t[0][1],x=t[1][0],m=t[1][1],b=t[2][0],_=t[2][1],E=t[3][0],S=t[3][1],L=t[4][0],D=t[4][1],z=t[5][0],q=t[5][1],M=t[6][0],X=t[6][1],at=t[7][0],kt=t[7][1],T=0;T<80;++T)f=((L>>>14|D<<18)^(L>>>18|D<<14)^(D>>>9|L<<23))>>>0,u=((L<<18|D>>>14)^(L<<14|D>>>18)^(D<<23|L>>>9))>>>0,l=(M^L&(z^M))>>>0,p=(X^D&(q^X))>>>0,a=((y>>>28|g<<4)^(g>>>2|y<<30)^(g>>>7|y<<25))>>>0,c=((y<<4|g>>>28)^(g<<30|y>>>2)^(g<<25|y>>>7))>>>0,d=(y&x|b&(y^x))>>>0,h=(g&m|_&(g^m))>>>0,R=kt+u+p+es[T][1]+e[T][1],n=at+f+l+es[T][0]+e[T][0]+(R/4294967296>>>0)>>>0,i=R>>>0,R=c+h,o=a+d+(R/4294967296>>>0)>>>0,s=R>>>0,at=M,kt=X,M=z,X=q,z=L,q=D,R=S+i,L=E+n+(R/4294967296>>>0)>>>0,D=R>>>0,E=b,S=_,b=x,_=m,x=y,m=g,R=i+s,y=n+o+(R/4294967296>>>0)>>>0,g=R>>>0;R=t[0][1]+g,t[0][0]=t[0][0]+y+(R/4294967296>>>0)>>>0,t[0][1]=R>>>0,R=t[1][1]+m,t[1][0]=t[1][0]+x+(R/4294967296>>>0)>>>0,t[1][1]=R>>>0,R=t[2][1]+_,t[2][0]=t[2][0]+b+(R/4294967296>>>0)>>>0,t[2][1]=R>>>0,R=t[3][1]+S,t[3][0]=t[3][0]+E+(R/4294967296>>>0)>>>0,t[3][1]=R>>>0,R=t[4][1]+D,t[4][0]=t[4][0]+L+(R/4294967296>>>0)>>>0,t[4][1]=R>>>0,R=t[5][1]+q,t[5][0]=t[5][0]+z+(R/4294967296>>>0)>>>0,t[5][1]=R>>>0,R=t[6][1]+X,t[6][0]=t[6][0]+M+(R/4294967296>>>0)>>>0,t[6][1]=R>>>0,R=t[7][1]+kt,t[7][0]=t[7][0]+at+(R/4294967296>>>0)>>>0,t[7][1]=R>>>0,V-=128}}});var mc=ft((ew,xc)=>{"use strict";function gc(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function X1(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 gc(t,r)}catch{r.message=t.message,r.stack=t.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(t)),gc(new i,r)}}xc.exports=X1});var Bc=ft(Bn=>{(function(){var t,e,r,n,i,o,s,a;a=function(c){var f,u,l,p;return f=(c&255<<24)>>>24,u=(c&255<<16)>>>16,l=(c&65280)>>>8,p=c&255,[f,u,l,p].join(".")},s=function(c){var f,u,l,p,d,h;for(f=[],l=p=0;p<=3&&c.length!==0;l=++p){if(l>0){if(c[0]!==".")throw new Error("Invalid IP");c=c.substring(1)}h=e(c),d=h[0],u=h[1],c=c.substring(u),f.push(d)}if(c.length!==0)throw new Error("Invalid IP");switch(f.length){case 1:if(f[0]>4294967295)throw new Error("Invalid IP");return f[0]>>>0;case 2:if(f[0]>255||f[1]>16777215)throw new Error("Invalid IP");return(f[0]<<24|f[1])>>>0;case 3:if(f[0]>255||f[1]>255||f[2]>65535)throw new Error("Invalid IP");return(f[0]<<24|f[1]<<16|f[2])>>>0;case 4:if(f[0]>255||f[1]>255||f[2]>255||f[3]>255)throw new Error("Invalid IP");return(f[0]<<24|f[1]<<16|f[2]<<8|f[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 f,u,l,p,d;for(p=0,f=10,u="9",l=0,c.length>1&&c[l]==="0"&&(c[l+1]==="x"||c[l+1]==="X"?(l+=2,f=16):"0"<=c[l+1]&&c[l+1]<="9"&&(l++,f=8,u="7")),d=l;l<c.length;){if("0"<=c[l]&&c[l]<=u)p=p*f+(r(c[l])-n)>>>0;else if(f===16)if("a"<=c[l]&&c[l]<="f")p=p*f+(10+r(c[l])-o)>>>0;else if("A"<=c[l]&&c[l]<="F")p=p*f+(10+r(c[l])-i)>>>0;else break;else break;if(p>4294967295)throw new Error("too large");l++}if(l===d)throw new Error("empty octet");return[p,l]},t=function(){function c(f,u){var l,p,d,h;if(typeof f!="string")throw new Error("Missing `net' parameter");if(u||(h=f.split("/",2),f=h[0],u=h[1]),u||(u=32),typeof u=="string"&&u.indexOf(".")>-1){try{this.maskLong=s(u)}catch(y){throw l=y,new Error("Invalid mask: "+u)}for(p=d=32;d>=0;p=--d)if(this.maskLong===4294967295<<32-p>>>0){this.bitmask=p;break}}else if(u||u===0)this.bitmask=parseInt(u,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(f)&this.maskLong)>>>0}catch(y){throw l=y,new Error("Invalid net address: "+f)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+u);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(f){return typeof f=="string"&&(f.indexOf("/")>0||f.split(".").length!==4)&&(f=new c(f)),f instanceof c?this.contains(f.base)&&this.contains(f.broadcast||f.last):(s(f)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},c.prototype.next=function(f){return f==null&&(f=1),new c(a(this.netLong+this.size*f),this.mask)},c.prototype.forEach=function(f){var u,l,p;for(p=s(this.first),l=s(this.last),u=0;p<=l;)f(a(p),p,u),u++,p++},c.prototype.toString=function(){return this.base+"/"+this.bitmask},c}(),Bn.ip2long=s,Bn.long2ip=a,Bn.Netmask=t}).call(Bn)});var Cc=ft((Tc,Ai)=>{(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(d,h){if(d.indexOf("::")!==d.lastIndexOf("::"))return null;let y=0,g=-1,x=(d.match(a.zoneIndex)||[])[0],m,b;for(x&&(x=x.substring(1),d=d.replace(/%.+$/,""));(g=d.indexOf(":",g+1))>=0;)y++;if(d.substr(0,2)==="::"&&y--,d.substr(-2,2)==="::"&&y--,y>h)return null;for(b=h-y,m=":";b--;)m+="0:";return d=d.replace("::",m),d[0]===":"&&(d=d.slice(1)),d[d.length-1]===":"&&(d=d.slice(0,-1)),h=function(){let _=d.split(":"),E=[];for(let S=0;S<_.length;S++)E.push(parseInt(_[S],16));return E}(),{parts:h,zoneId:x}}function f(d,h,y,g){if(d.length!==h.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let x=0,m;for(;g>0;){if(m=y-g,m<0&&(m=0),d[x]>>m!==h[x]>>m)return!1;g-=y,x+=1}return!0}function u(d){if(i.test(d))return parseInt(d,16);if(d[0]==="0"&&!isNaN(parseInt(d[1],10))){if(n.test(d))return parseInt(d,8);throw new Error(`ipaddr: cannot parse ${d} as octal`)}return parseInt(d,10)}function l(d,h){for(;d.length<h;)d=`0${d}`;return d}let p={};p.IPv4=function(){function d(h){if(h.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let y,g;for(y=0;y<h.length;y++)if(g=h[y],!(0<=g&&g<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=h}return d.prototype.SpecialRanges={unspecified:[[new d([0,0,0,0]),8]],broadcast:[[new d([255,255,255,255]),32]],multicast:[[new d([224,0,0,0]),4]],linkLocal:[[new d([169,254,0,0]),16]],loopback:[[new d([127,0,0,0]),8]],carrierGradeNat:[[new d([100,64,0,0]),10]],private:[[new d([10,0,0,0]),8],[new d([172,16,0,0]),12],[new d([192,168,0,0]),16]],reserved:[[new d([192,0,0,0]),24],[new d([192,0,2,0]),24],[new d([192,88,99,0]),24],[new d([198,18,0,0]),15],[new d([198,51,100,0]),24],[new d([203,0,113,0]),24],[new d([240,0,0,0]),4]]},d.prototype.kind=function(){return"ipv4"},d.prototype.match=function(h,y){let g;if(y===void 0&&(g=h,h=g[0],y=g[1]),h.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return f(this.octets,h.octets,8,y)},d.prototype.prefixLengthFromSubnetMask=function(){let h=0,y=!1,g={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},x,m,b;for(x=3;x>=0;x-=1)if(m=this.octets[x],m in g){if(b=g[m],y&&b!==0)return null;b!==8&&(y=!0),h+=b}else return null;return 32-h},d.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},d.prototype.toByteArray=function(){return this.octets.slice(0)},d.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},d.prototype.toNormalizedString=function(){return this.toString()},d.prototype.toString=function(){return this.octets.join(".")},d}(),p.IPv4.broadcastAddressFromCIDR=function(d){try{let h=this.parseCIDR(d),y=h[0].toByteArray(),g=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),x=[],m=0;for(;m<4;)x.push(parseInt(y[m],10)|parseInt(g[m],10)^255),m++;return new this(x)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},p.IPv4.isIPv4=function(d){return this.parser(d)!==null},p.IPv4.isValid=function(d){try{return new this(this.parser(d)),!0}catch{return!1}},p.IPv4.isValidFourPartDecimal=function(d){return!!(p.IPv4.isValid(d)&&d.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.networkAddressFromCIDR=function(d){let h,y,g,x,m;try{for(h=this.parseCIDR(d),g=h[0].toByteArray(),m=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),x=[],y=0;y<4;)x.push(parseInt(g[y],10)&parseInt(m[y],10)),y++;return new this(x)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},p.IPv4.parse=function(d){let h=this.parser(d);if(h===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(h)},p.IPv4.parseCIDR=function(d){let h;if(h=d.match(/^(.+)\/(\d+)$/)){let y=parseInt(h[2]);if(y>=0&&y<=32){let g=[this.parse(h[1]),y];return Object.defineProperty(g,"toString",{value:function(){return this.join("/")}}),g}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},p.IPv4.parser=function(d){let h,y,g;if(h=d.match(r.fourOctet))return function(){let x=h.slice(1,6),m=[];for(let b=0;b<x.length;b++)y=x[b],m.push(u(y));return m}();if(h=d.match(r.longValue)){if(g=u(h[1]),g>4294967295||g<0)throw new Error("ipaddr: address outside defined range");return function(){let x=[],m;for(m=0;m<=24;m+=8)x.push(g>>m&255);return x}().reverse()}else return(h=d.match(r.twoOctet))?function(){let x=h.slice(1,4),m=[];if(g=u(x[1]),g>16777215||g<0)throw new Error("ipaddr: address outside defined range");return m.push(u(x[0])),m.push(g>>16&255),m.push(g>>8&255),m.push(g&255),m}():(h=d.match(r.threeOctet))?function(){let x=h.slice(1,5),m=[];if(g=u(x[2]),g>65535||g<0)throw new Error("ipaddr: address outside defined range");return m.push(u(x[0])),m.push(u(x[1])),m.push(g>>8&255),m.push(g&255),m}():null},p.IPv4.subnetMaskFromPrefixLength=function(d){if(d=parseInt(d),d<0||d>32)throw new Error("ipaddr: invalid IPv4 prefix length");let h=[0,0,0,0],y=0,g=Math.floor(d/8);for(;y<g;)h[y]=255,y++;return g<4&&(h[g]=Math.pow(2,d%8)-1<<8-d%8),new this(h)},p.IPv6=function(){function d(h,y){let g,x;if(h.length===16)for(this.parts=[],g=0;g<=14;g+=2)this.parts.push(h[g]<<8|h[g+1]);else if(h.length===8)this.parts=h;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(g=0;g<this.parts.length;g++)if(x=this.parts[g],!(0<=x&&x<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");y&&(this.zoneId=y)}return d.prototype.SpecialRanges={unspecified:[new d([0,0,0,0,0,0,0,0]),128],linkLocal:[new d([65152,0,0,0,0,0,0,0]),10],multicast:[new d([65280,0,0,0,0,0,0,0]),8],loopback:[new d([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new d([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new d([0,0,0,0,0,65535,0,0]),96],rfc6145:[new d([0,0,0,0,65535,0,0,0]),96],rfc6052:[new d([100,65435,0,0,0,0,0,0]),96],"6to4":[new d([8194,0,0,0,0,0,0,0]),16],teredo:[new d([8193,0,0,0,0,0,0,0]),32],reserved:[[new d([8193,3512,0,0,0,0,0,0]),32]],benchmarking:[new d([8193,2,0,0,0,0,0,0]),48],amt:[new d([8193,3,0,0,0,0,0,0]),32],as112v6:[new d([8193,4,274,0,0,0,0,0]),48],deprecated:[new d([8193,16,0,0,0,0,0,0]),28],orchid2:[new d([8193,32,0,0,0,0,0,0]),28]},d.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},d.prototype.kind=function(){return"ipv6"},d.prototype.match=function(h,y){let g;if(y===void 0&&(g=h,h=g[0],y=g[1]),h.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return f(this.parts,h.parts,16,y)},d.prototype.prefixLengthFromSubnetMask=function(){let h=0,y=!1,g={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},x,m;for(let b=7;b>=0;b-=1)if(x=this.parts[b],x in g){if(m=g[x],y&&m!==0)return null;m!==16&&(y=!0),h+=m}else return null;return 128-h},d.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},d.prototype.toByteArray=function(){let h,y=[],g=this.parts;for(let x=0;x<g.length;x++)h=g[x],y.push(h>>8),y.push(h&255);return y},d.prototype.toFixedLengthString=function(){let h=function(){let g=[];for(let x=0;x<this.parts.length;x++)g.push(l(this.parts[x].toString(16),4));return g}.call(this).join(":"),y="";return this.zoneId&&(y=`%${this.zoneId}`),h+y},d.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),y=h[0],g=h[1];return new p.IPv4([y>>8,y&255,g>>8,g&255])},d.prototype.toNormalizedString=function(){let h=function(){let g=[];for(let x=0;x<this.parts.length;x++)g.push(this.parts[x].toString(16));return g}.call(this).join(":"),y="";return this.zoneId&&(y=`%${this.zoneId}`),h+y},d.prototype.toRFC5952String=function(){let h=/((^|:)(0(:|$)){2,})/g,y=this.toNormalizedString(),g=0,x=-1,m;for(;m=h.exec(y);)m[0].length>x&&(g=m.index,x=m[0].length);return x<0?y:`${y.substring(0,g)}::${y.substring(g+x)}`},d.prototype.toString=function(){return this.toRFC5952String()},d}(),p.IPv6.broadcastAddressFromCIDR=function(d){try{let h=this.parseCIDR(d),y=h[0].toByteArray(),g=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),x=[],m=0;for(;m<16;)x.push(parseInt(y[m],10)|parseInt(g[m],10)^255),m++;return new this(x)}catch(h){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${h})`)}},p.IPv6.isIPv6=function(d){return this.parser(d)!==null},p.IPv6.isValid=function(d){if(typeof d=="string"&&d.indexOf(":")===-1)return!1;try{let h=this.parser(d);return new this(h.parts,h.zoneId),!0}catch{return!1}},p.IPv6.networkAddressFromCIDR=function(d){let h,y,g,x,m;try{for(h=this.parseCIDR(d),g=h[0].toByteArray(),m=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),x=[],y=0;y<16;)x.push(parseInt(g[y],10)&parseInt(m[y],10)),y++;return new this(x)}catch(b){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${b})`)}},p.IPv6.parse=function(d){let h=this.parser(d);if(h.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(h.parts,h.zoneId)},p.IPv6.parseCIDR=function(d){let h,y,g;if((y=d.match(/^(.+)\/(\d+)$/))&&(h=parseInt(y[2]),h>=0&&h<=128))return g=[this.parse(y[1]),h],Object.defineProperty(g,"toString",{value:function(){return this.join("/")}}),g;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},p.IPv6.parser=function(d){let h,y,g,x,m,b;if(g=d.match(a.deprecatedTransitional))return this.parser(`::ffff:${g[1]}`);if(a.native.test(d))return c(d,8);if((g=d.match(a.transitional))&&(b=g[6]||"",h=c(g[1].slice(0,-1)+b,6),h.parts)){for(m=[parseInt(g[2]),parseInt(g[3]),parseInt(g[4]),parseInt(g[5])],y=0;y<m.length;y++)if(x=m[y],!(0<=x&&x<=255))return null;return h.parts.push(m[0]<<8|m[1]),h.parts.push(m[2]<<8|m[3]),{parts:h.parts,zoneId:h.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(d){if(d=parseInt(d),d<0||d>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],y=0,g=Math.floor(d/8);for(;y<g;)h[y]=255,y++;return g<16&&(h[g]=Math.pow(2,d%8)-1<<8-d%8),new this(h)},p.fromByteArray=function(d){let h=d.length;if(h===4)return new p.IPv4(d);if(h===16)return new p.IPv6(d);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},p.isValid=function(d){return p.IPv6.isValid(d)||p.IPv4.isValid(d)},p.parse=function(d){if(p.IPv6.isValid(d))return p.IPv6.parse(d);if(p.IPv4.isValid(d))return p.IPv4.parse(d);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},p.parseCIDR=function(d){try{return p.IPv6.parseCIDR(d)}catch{try{return p.IPv4.parseCIDR(d)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},p.process=function(d){let h=this.parse(d);return h.kind()==="ipv6"&&h.isIPv4MappedAddress()?h.toIPv4Address():h},p.subnetMatch=function(d,h,y){let g,x,m,b;y==null&&(y="unicast");for(x in h)if(Object.prototype.hasOwnProperty.call(h,x)){for(m=h[x],m[0]&&!(m[0]instanceof Array)&&(m=[m]),g=0;g<m.length;g++)if(b=m[g],d.kind()===b[0].kind()&&d.match.apply(d,b))return x}return y},typeof Ai<"u"&&Ai.exports?Ai.exports=p:t.ipaddr=p})(Tc)});var Sy={};_t(Sy,{autoNAT:()=>Ey});var Ay=Symbol.for("@libp2p/connection");var Ty=Symbol.for("@libp2p/content-routing");var Ry=Symbol.for("@libp2p/peer-discovery");var Ws=Symbol.for("@libp2p/peer-id");var Py=Symbol.for("@libp2p/peer-routing");var Ys;(function(t){t.Accept="accept",t.Ignore="ignore",t.Reject="reject"})(Ys||(Ys={}));var Oy=Symbol.for("@libp2p/transport");var Zs;(function(t){t[t.FATAL_ALL=0]="FATAL_ALL",t[t.NO_FATAL=1]="NO_FATAL"})(Zs||(Zs={}));var $=class extends Error{code;props;constructor(e,r,n){super(e),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var Ci="ERR_TIMEOUT";var _i=class extends Event{detail;constructor(e,r){super(e,r),this.detail=r?.detail}},My=globalThis.CustomEvent??_i;var Ri=(t,...e)=>{try{[...e]}catch{}};var Ni={};_t(Ni,{base58btc:()=>At,base58flickr:()=>eu});var g2=new Uint8Array(0);function Qs(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}function Be(t){if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")}function Xs(t){return new TextEncoder().encode(t)}function Js(t){return new TextDecoder().decode(t)}function Qc(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=t.length,c=t.charAt(0),f=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function l(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var y=0,g=0,x=0,m=h.length;x!==m&&h[x]===0;)x++,y++;for(var b=(m-x)*u+1>>>0,_=new Uint8Array(b);x!==m;){for(var E=h[x],S=0,L=b-1;(E!==0||S<g)&&L!==-1;L--,S++)E+=256*_[L]>>>0,_[L]=E%a>>>0,E=E/a>>>0;if(E!==0)throw new Error("Non-zero carry");g=S,x++}for(var D=b-g;D!==b&&_[D]===0;)D++;for(var z=c.repeat(y);D<b;++D)z+=t.charAt(_[D]);return z}function p(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var y=0;if(h[y]!==" "){for(var g=0,x=0;h[y]===c;)g++,y++;for(var m=(h.length-y)*f+1>>>0,b=new Uint8Array(m);h[y];){var _=r[h.charCodeAt(y)];if(_===255)return;for(var E=0,S=m-1;(_!==0||E<x)&&S!==-1;S--,E++)_+=a*b[S]>>>0,b[S]=_%256>>>0,_=_/256>>>0;if(_!==0)throw new Error("Non-zero carry");x=E,y++}if(h[y]!==" "){for(var L=m-x;L!==m&&b[L]===0;)L++;for(var D=new Uint8Array(g+(m-L)),z=g;L!==m;)D[z++]=b[L++];return D}}}function d(h){var y=p(h);if(y)return y;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:p,decode:d}}var Xc=Qc,Jc=Xc,ta=Jc;var Li=class{name;prefix;baseEncode;constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Di=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return ea(this,e)}},Pi=class{decoders;constructor(e){this.decoders=e}or(e){return ea(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function ea(t,e){return new Pi({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var ki=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Li(e,r,n),this.decoder=new Di(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Sr({name:t,prefix:e,encode:r,decode:n}){return new ki(t,e,r,n)}function qe({name:t,prefix:e,alphabet:r}){let{encode:n,decode:i}=ta(r,t);return Sr({prefix:e,name:t,encode:n,decode:o=>Be(i(o))})}function jc(t,e,r,n){let i={};for(let u=0;u<e.length;++u)i[e[u]]=u;let o=t.length;for(;t[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,c=0,f=0;for(let u=0;u<o;++u){let l=i[t[u]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<r|l,a+=r,a>=8&&(a-=8,s[f++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s}function tu(t,e,r){let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s!==0&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o}function vt({name:t,prefix:e,bitsPerChar:r,alphabet:n}){return Sr({prefix:e,name:t,encode(i){return tu(i,n,r)},decode(i){return jc(i,n,r,t)}})}var At=qe({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),eu=qe({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ui={};_t(Ui,{base10:()=>ru});var ru=qe({prefix:"9",name:"base10",alphabet:"0123456789"});var Oi={};_t(Oi,{base16:()=>nu,base16upper:()=>iu});var nu=vt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),iu=vt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ki={};_t(Ki,{base2:()=>ou});var ou=vt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Fi={};_t(Fi,{base256emoji:()=>uu});var ra=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),su=ra.reduce((t,e,r)=>(t[r]=e,t),[]),au=ra.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function fu(t){return t.reduce((e,r)=>(e+=su[r],e),"")}function cu(t){let e=[];for(let r of t){let n=au[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var uu=Sr({prefix:"\u{1F680}",name:"base256emoji",encode:fu,decode:cu});var Mi={};_t(Mi,{base32:()=>Ae,base32hex:()=>pu,base32hexpad:()=>gu,base32hexpadupper:()=>xu,base32hexupper:()=>yu,base32pad:()=>hu,base32padupper:()=>du,base32upper:()=>lu,base32z:()=>mu});var Ae=vt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),lu=vt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),hu=vt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),du=vt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),pu=vt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),yu=vt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),gu=vt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),xu=vt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),mu=vt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Vi={};_t(Vi,{base36:()=>vu,base36upper:()=>bu});var vu=qe({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),bu=qe({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var qi={};_t(qi,{base64:()=>In,base64pad:()=>wu,base64url:()=>Eu,base64urlpad:()=>Su});var In=vt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),wu=vt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Eu=vt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Su=vt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var zi={};_t(zi,{base8:()=>Bu});var Bu=vt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Hi={};_t(Hi,{identity:()=>Au});var Au=Sr({prefix:"\0",name:"identity",encode:t=>Js(t),decode:t=>Xs(t)});var D2=new TextEncoder,P2=new TextDecoder;var Gi={};_t(Gi,{identity:()=>ze});var Cu=oa,na=128,_u=127,Ru=~_u,Lu=Math.pow(2,31);function oa(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Lu;)e[r++]=t&255|na,t/=128;for(;t&Ru;)e[r++]=t&255|na,t>>>=7;return e[r]=t|0,oa.bytes=r-n+1,e}var Du=$i,Pu=128,ia=127;function $i(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw $i.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&ia)<<i:(s&ia)*Math.pow(2,i),i+=7}while(s>=Pu);return $i.bytes=o-n,r}var ku=Math.pow(2,7),Nu=Math.pow(2,14),Uu=Math.pow(2,21),Ou=Math.pow(2,28),Ku=Math.pow(2,35),Fu=Math.pow(2,42),Mu=Math.pow(2,49),Vu=Math.pow(2,56),qu=Math.pow(2,63),zu=function(t){return t<ku?1:t<Nu?2:t<Uu?3:t<Ou?4:t<Ku?5:t<Fu?6:t<Mu?7:t<Vu?8:t<qu?9:10},Hu={encode:Cu,decode:Du,encodingLength:zu},$u=Hu,jr=$u;function tn(t,e=0){return[jr.decode(t,e),jr.decode.bytes]}function Br(t,e,r=0){return jr.encode(t,e,r),e}function Ar(t){return jr.encodingLength(t)}function ye(t,e){let r=e.byteLength,n=Ar(t),i=n+Ar(r),o=new Uint8Array(i+r);return Br(t,o,0),Br(r,o,n),o.set(e,i),new Ir(t,r,e,o)}function sr(t){let e=Be(t),[r,n]=tn(e),[i,o]=tn(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Ir(r,i,s,e)}function sa(t,e){if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Qs(t.bytes,r.bytes)}}var Ir=class{code;size;digest;bytes;constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var aa=0,Gu="identity",fa=Be;function Wu(t){return ye(aa,fa(t))}var ze={code:aa,name:Gu,encode:fa,digest:Wu};var Zi={};_t(Zi,{sha256:()=>Ot,sha512:()=>Yu});function Yi({name:t,code:e,encode:r}){return new Wi(t,e,r)}var Wi=class{name;code;encode;constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?ye(this.code,r):r.then(n=>ye(this.code,n))}else throw Error("Unknown type, must be binary type")}};function ua(t){return async e=>new Uint8Array(await crypto.subtle.digest(t,e))}var Ot=Yi({name:"sha2-256",code:18,encode:ua("SHA-256")}),Yu=Yi({name:"sha2-512",code:19,encode:ua("SHA-512")});function la(t,e){let{bytes:r,version:n}=t;switch(n){case 0:return Qu(r,Qi(t),e??At.encoder);default:return Xu(r,Qi(t),e??Ae.encoder)}}var ha=new WeakMap;function Qi(t){let e=ha.get(t);if(e==null){let r=new Map;return ha.set(t,r),r}return e}var re=class t{code;version;multihash;bytes;"/";constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==en)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Ju)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=ye(e,r);return t.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return t.equals(this,e)}static equals(e,r){let n=r;return n!=null&&e.code===n.code&&e.version===n.version&&sa(e.multihash,n.multihash)}toString(e){return la(this,e)}toJSON(){return{"/":la(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof t)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new t(n,i,o,s??da(n,i,o.bytes))}else if(r[ju]===!0){let{version:n,multihash:i,code:o}=r,s=sr(i);return t.create(n,o,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==en)throw new Error(`Version 0 CID must use dag-pb (code: ${en}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=da(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,en,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=Be(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new Ir(r.multihashCode,r.digestSize,o,i);return[r.version===0?t.createV0(s):t.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[l,p]=tn(e.subarray(r));return r+=p,l},i=n(),o=en;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),c=n(),f=r+c,u=f-s;return{version:i,codec:o,multihashCode:a,digestSize:c,multihashSize:u,size:f}}static parse(e,r){let[n,i]=Zu(e,r),o=t.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Qi(o).set(n,e),o}};function Zu(t,e){switch(t[0]){case"Q":{let r=e??At;return[At.prefix,r.decode(`${At.prefix}${t}`)]}case At.prefix:{let r=e??At;return[At.prefix,r.decode(t)]}case Ae.prefix:{let r=e??Ae;return[Ae.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}}function Qu(t,e,r){let{prefix:n}=r;if(n!==At.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let o=r.encode(t).slice(1);return e.set(n,o),o}else return i}function Xu(t,e,r){let{prefix:n}=r,i=e.get(n);if(i==null){let o=r.encode(t);return e.set(n,o),o}else return i}var en=112,Ju=18;function da(t,e,r){let n=Ar(t),i=n+Ar(e),o=new Uint8Array(i+r.byteLength);return Br(t,o,0),Br(e,o,n),o.set(r,i),o}var ju=Symbol.for("@ipld/js-cid/CID");var He={...Hi,...Ki,...zi,...Ui,...Oi,...Mi,...Vi,...Ni,...qi,...Fi},tg={...Zi,...Gi};function Kt(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}var tl=Symbol.for("nodejs.util.inspect.custom"),pa=Object.values(He).map(t=>t.decoder).reduce((t,e)=>t.or(e),He.identity.decoder),ya=114,Xi=36,Ji=37,rn=class{type;multihash;privateKey;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[Ws]=!0;toString(){return this.string==null&&(this.string=At.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return re.createV1(ya,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e==null)return!1;if(e instanceof Uint8Array)return Kt(this.multihash.bytes,e);if(typeof e=="string")return el(e).equals(this);if(e?.multihash?.bytes!=null)return Kt(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[tl](){return`PeerId(${this.toString()})`}},Tr=class extends rn{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},Cr=class extends rn{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},_r=class extends rn{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}};function el(t,e){if(e=e??pa,t.charAt(0)==="1"||t.charAt(0)==="Q"){let r=sr(At.decode(`z${t}`));return t.startsWith("12D")?new Cr({multihash:r}):t.startsWith("16U")?new _r({multihash:r}):new Tr({multihash:r})}return Cn(pa.decode(t))}function Cn(t){try{let e=sr(t);if(e.code===ze.code){if(e.digest.length===Xi)return new Cr({multihash:e});if(e.digest.length===Ji)return new _r({multihash:e})}if(e.code===Ot.code)return new Tr({multihash:e})}catch{return rl(re.decode(t))}throw new Error("Supplied PeerID CID is invalid")}function rl(t){if(t==null||t.multihash==null||t.version==null||t.version===1&&t.code!==ya)throw new Error("Supplied PeerID CID is invalid");let e=t.multihash;if(e.code===Ot.code)return new Tr({multihash:t.multihash});if(e.code===ze.code){if(e.digest.length===Xi)return new Cr({multihash:t.multihash});if(e.digest.length===Ji)return new _r({multihash:t.multihash})}throw new Error("Supplied PeerID CID is invalid")}async function ga(t,e){return t.length===Xi?new Cr({multihash:ye(ze.code,t),privateKey:e}):t.length===Ji?new _r({multihash:ye(ze.code,t),privateKey:e}):new Tr({multihash:await Ot.digest(t),publicKey:t,privateKey:e})}var ab=Mt(an(),1),fb=Mt(D0(),1);var v1=Mt(ct(),1);function Ze(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function _e(t=0){return globalThis.Buffer?.alloc!=null?Ze(globalThis.Buffer.alloc(t)):new Uint8Array(t)}function Vt(t=0){return globalThis.Buffer?.allocUnsafe!=null?Ze(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function k0(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var P0=k0("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Eo=k0("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=Vt(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Td={utf8:P0,"utf-8":P0,hex:He.base16,latin1:Eo,ascii:Eo,binary:Eo,...He},Wn=Td;function It(t,e="utf8"){let r=Wn[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Ze(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var jo={};_t(jo,{Ed25519PrivateKey:()=>mr,Ed25519PublicKey:()=>gn,generateKeyPair:()=>zp,generateKeyPairFromSeed:()=>xf,unmarshalEd25519PrivateKey:()=>Vp,unmarshalEd25519PublicKey:()=>qp});var Xg=Mt(Et(),1),Jg=Mt(zn(),1),N0=Mt(ct(),1);function Tt(t,e){if(globalThis.Buffer!=null)return Ze(globalThis.Buffer.concat(t,e));e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=Vt(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Ze(r)}function lt(t,e="utf8"){let r=Wn[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}function oe(t,e){let r=Uint8Array.from(t.abs().toByteArray());if(r=r[0]===0?r.subarray(1):r,e!=null){if(r.length>e)throw new Error("byte array longer than desired length");r=Tt([new Uint8Array(e-r.length),r])}return lt(r,"base64url")}function Qt(t){let e=U0(t);return new N0.default.jsbn.BigInteger(lt(e,"base16"),16)}function U0(t,e){let r=It(t,"base64urlpad");if(e!=null){if(r.length>e)throw new Error("byte array longer than desired length");r=Tt([new Uint8Array(e-r.length),r])}return r}function te(t){return t==null?!1:typeof t.then=="function"&&typeof t.catch=="function"&&typeof t.finally=="function"}function O0(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function Cd(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function So(t,...e){if(!Cd(t))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function K0(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");O0(t.outputLen),O0(t.blockLen)}function kr(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function F0(t,e){So(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var Yn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function M0(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var Zn=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),se=(t,e)=>t<<32-e|t>>>e,_d=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!_d)throw new Error("Non little-endian hardware is not supported");function Bo(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function un(t){if(typeof t=="string"&&(t=Bo(t)),!M0(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function Qn(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];if(!M0(i))throw new Error("Uint8Array expected");e+=i.length}let r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){let o=t[n];r.set(o,i),i+=o.length}return r}var Nr=class{clone(){return this._cloneInto()}},sx={}.toString;function Xn(t){let e=n=>t().update(un(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function Ur(t=32){if(Yn&&typeof Yn.getRandomValues=="function")return Yn.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}function Rd(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),c=n?4:0,f=n?0:4;t.setUint32(e+c,s,n),t.setUint32(e+f,a,n)}var Or=class extends Nr{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Zn(this.buffer)}update(e){kr(this);let{view:r,buffer:n,blockLen:i}=this;e=un(e);let o=e.length;for(let s=0;s<o;){let a=Math.min(i-this.pos,o-s);if(a===i){let c=Zn(e);for(;i<=o-s;s+=i)this.process(c,s);continue}n.set(e.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){kr(this),F0(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:o}=this,{pos:s}=this;r[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(n,0),s=0);for(let l=s;l<i;l++)r[l]=0;Rd(n,i-8,BigInt(this.length*8),o),this.process(n,0);let a=Zn(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let f=c/4,u=this.get();if(f>u.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<f;l++)a.setUint32(4*l,u[l],o)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:r,buffer:n,length:i,finished:o,destroyed:s,pos:a}=this;return e.length=i,e.pos=a,e.finished=o,e.destroyed=s,i%r&&e.buffer.set(n),e}};var Jn=BigInt(4294967295),Ao=BigInt(32);function V0(t,e=!1){return e?{h:Number(t&Jn),l:Number(t>>Ao&Jn)}:{h:Number(t>>Ao&Jn)|0,l:Number(t&Jn)|0}}function Ld(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){let{h:o,l:s}=V0(t[i],e);[r[i],n[i]]=[o,s]}return[r,n]}var Dd=(t,e)=>BigInt(t>>>0)<<Ao|BigInt(e>>>0),Pd=(t,e,r)=>t>>>r,kd=(t,e,r)=>t<<32-r|e>>>r,Nd=(t,e,r)=>t>>>r|e<<32-r,Ud=(t,e,r)=>t<<32-r|e>>>r,Od=(t,e,r)=>t<<64-r|e>>>r-32,Kd=(t,e,r)=>t>>>r-32|e<<64-r,Fd=(t,e)=>e,Md=(t,e)=>t,Vd=(t,e,r)=>t<<r|e>>>32-r,qd=(t,e,r)=>e<<r|t>>>32-r,zd=(t,e,r)=>e<<r-32|t>>>64-r,Hd=(t,e,r)=>t<<r-32|e>>>64-r;function $d(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var Gd=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),Wd=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,Yd=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),Zd=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,Qd=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),Xd=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0;var Jd={fromBig:V0,split:Ld,toBig:Dd,shrSH:Pd,shrSL:kd,rotrSH:Nd,rotrSL:Ud,rotrBH:Od,rotrBL:Kd,rotr32H:Fd,rotr32L:Md,rotlSH:Vd,rotlSL:qd,rotlBH:zd,rotlBL:Hd,add:$d,add3L:Gd,add3H:Wd,add4L:Yd,add4H:Zd,add5H:Xd,add5L:Qd},W=Jd;var[jd,tp]=W.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),Qe=new Uint32Array(80),Xe=new Uint32Array(80),Io=class extends Or{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:r,Bh:n,Bl:i,Ch:o,Cl:s,Dh:a,Dl:c,Eh:f,El:u,Fh:l,Fl:p,Gh:d,Gl:h,Hh:y,Hl:g}=this;return[e,r,n,i,o,s,a,c,f,u,l,p,d,h,y,g]}set(e,r,n,i,o,s,a,c,f,u,l,p,d,h,y,g){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=o|0,this.Cl=s|0,this.Dh=a|0,this.Dl=c|0,this.Eh=f|0,this.El=u|0,this.Fh=l|0,this.Fl=p|0,this.Gh=d|0,this.Gl=h|0,this.Hh=y|0,this.Hl=g|0}process(e,r){for(let b=0;b<16;b++,r+=4)Qe[b]=e.getUint32(r),Xe[b]=e.getUint32(r+=4);for(let b=16;b<80;b++){let _=Qe[b-15]|0,E=Xe[b-15]|0,S=W.rotrSH(_,E,1)^W.rotrSH(_,E,8)^W.shrSH(_,E,7),L=W.rotrSL(_,E,1)^W.rotrSL(_,E,8)^W.shrSL(_,E,7),D=Qe[b-2]|0,z=Xe[b-2]|0,q=W.rotrSH(D,z,19)^W.rotrBH(D,z,61)^W.shrSH(D,z,6),M=W.rotrSL(D,z,19)^W.rotrBL(D,z,61)^W.shrSL(D,z,6),X=W.add4L(L,M,Xe[b-7],Xe[b-16]),at=W.add4H(X,S,q,Qe[b-7],Qe[b-16]);Qe[b]=at|0,Xe[b]=X|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:c,Dh:f,Dl:u,Eh:l,El:p,Fh:d,Fl:h,Gh:y,Gl:g,Hh:x,Hl:m}=this;for(let b=0;b<80;b++){let _=W.rotrSH(l,p,14)^W.rotrSH(l,p,18)^W.rotrBH(l,p,41),E=W.rotrSL(l,p,14)^W.rotrSL(l,p,18)^W.rotrBL(l,p,41),S=l&d^~l&y,L=p&h^~p&g,D=W.add5L(m,E,L,tp[b],Xe[b]),z=W.add5H(D,x,_,S,jd[b],Qe[b]),q=D|0,M=W.rotrSH(n,i,28)^W.rotrBH(n,i,34)^W.rotrBH(n,i,39),X=W.rotrSL(n,i,28)^W.rotrBL(n,i,34)^W.rotrBL(n,i,39),at=n&o^n&a^o&a,kt=i&s^i&c^s&c;x=y|0,m=g|0,y=d|0,g=h|0,d=l|0,h=p|0,{h:l,l:p}=W.add(f|0,u|0,z|0,q|0),f=a|0,u=c|0,a=o|0,c=s|0,o=n|0,s=i|0;let T=W.add3L(q,X,kt);n=W.add3H(T,z,M,at),i=T|0}({h:n,l:i}=W.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=W.add(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:c}=W.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:f,l:u}=W.add(this.Dh|0,this.Dl|0,f|0,u|0),{h:l,l:p}=W.add(this.Eh|0,this.El|0,l|0,p|0),{h:d,l:h}=W.add(this.Fh|0,this.Fl|0,d|0,h|0),{h:y,l:g}=W.add(this.Gh|0,this.Gl|0,y|0,g|0),{h:x,l:m}=W.add(this.Hh|0,this.Hl|0,x|0,m|0),this.set(n,i,o,s,a,c,f,u,l,p,d,h,y,g,x,m)}roundClean(){Qe.fill(0),Xe.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var To=Xn(()=>new Io);var ti={};_t(ti,{bitGet:()=>ap,bitLen:()=>sp,bitMask:()=>ln,bitSet:()=>fp,bytesToHex:()=>Le,bytesToNumberBE:()=>De,bytesToNumberLE:()=>Je,concatBytes:()=>Pe,createHmacDrbg:()=>Ro,ensureBytes:()=>bt,equalBytes:()=>ip,hexToBytes:()=>dr,hexToNumber:()=>_o,isBytes:()=>ae,numberToBytesBE:()=>je,numberToBytesLE:()=>pr,numberToHexUnpadded:()=>$0,numberToVarBytesBE:()=>np,utf8ToBytes:()=>op,validateObject:()=>Ee});var H0=BigInt(0),jn=BigInt(1),ep=BigInt(2);function ae(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var rp=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Le(t){if(!ae(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=rp[t[r]];return e}function $0(t){let e=t.toString(16);return e.length&1?`0${e}`:e}function _o(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}var Re={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function q0(t){if(t>=Re._0&&t<=Re._9)return t-Re._0;if(t>=Re._A&&t<=Re._F)return t-(Re._A-10);if(t>=Re._a&&t<=Re._f)return t-(Re._a-10)}function dr(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);let e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){let s=q0(t.charCodeAt(o)),a=q0(t.charCodeAt(o+1));if(s===void 0||a===void 0){let c=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+o)}n[i]=s*16+a}return n}function De(t){return _o(Le(t))}function Je(t){if(!ae(t))throw new Error("Uint8Array expected");return _o(Le(Uint8Array.from(t).reverse()))}function je(t,e){return dr(t.toString(16).padStart(e*2,"0"))}function pr(t,e){return je(t,e).reverse()}function np(t){return dr($0(t))}function bt(t,e,r){let n;if(typeof e=="string")try{n=dr(e)}catch(o){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${o}`)}else if(ae(e))n=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);let i=n.length;if(typeof r=="number"&&i!==r)throw new Error(`${t} expected ${r} bytes, got ${i}`);return n}function Pe(...t){let e=0;for(let i=0;i<t.length;i++){let o=t[i];if(!ae(o))throw new Error("Uint8Array expected");e+=o.length}let r=new Uint8Array(e),n=0;for(let i=0;i<t.length;i++){let o=t[i];r.set(o,n),n+=o.length}return r}function ip(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}function op(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function sp(t){let e;for(e=0;t>H0;t>>=jn,e+=1);return e}function ap(t,e){return t>>BigInt(e)&jn}var fp=(t,e,r)=>t|(r?jn:H0)<<BigInt(e),ln=t=>(ep<<BigInt(t-1))-jn,Co=t=>new Uint8Array(t),z0=t=>Uint8Array.from(t);function Ro(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=Co(t),i=Co(t),o=0,s=()=>{n.fill(1),i.fill(0),o=0},a=(...l)=>r(i,n,...l),c=(l=Co())=>{i=a(z0([0]),l),n=a(),l.length!==0&&(i=a(z0([1]),l),n=a())},f=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let l=0,p=[];for(;l<e;){n=a();let d=n.slice();p.push(d),l+=n.length}return Pe(...p)};return(l,p)=>{s(),c(l);let d;for(;!(d=p(f()));)c();return s(),d}}var cp={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||ae(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Ee(t,e,r={}){let n=(i,o,s)=>{let a=cp[o];if(typeof a!="function")throw new Error(`Invalid validator "${o}", expected function`);let c=t[i];if(!(s&&c===void 0)&&!a(c,t))throw new Error(`Invalid param ${String(i)}=${c} (${typeof c}), expected ${o}`)};for(let[i,o]of Object.entries(e))n(i,o,!1);for(let[i,o]of Object.entries(r))n(i,o,!0);return t}var Ct=BigInt(0),gt=BigInt(1),yr=BigInt(2),up=BigInt(3),Lo=BigInt(4),G0=BigInt(5),W0=BigInt(8),lp=BigInt(9),hp=BigInt(16);function ut(t,e){let r=t%e;return r>=Ct?r:e+r}function dp(t,e,r){if(r<=Ct||e<Ct)throw new Error("Expected power/modulo > 0");if(r===gt)return Ct;let n=gt;for(;e>Ct;)e&gt&&(n=n*t%r),t=t*t%r,e>>=gt;return n}function xt(t,e,r){let n=t;for(;e-- >Ct;)n*=n,n%=r;return n}function ei(t,e){if(t===Ct||e<=Ct)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=ut(t,e),n=e,i=Ct,o=gt,s=gt,a=Ct;for(;r!==Ct;){let f=n/r,u=n%r,l=i-s*f,p=o-a*f;n=r,r=u,i=s,o=a,s=l,a=p}if(n!==gt)throw new Error("invert: does not exist");return ut(i,e)}function pp(t){let e=(t-gt)/yr,r,n,i;for(r=t-gt,n=0;r%yr===Ct;r/=yr,n++);for(i=yr;i<t&&dp(i,e,t)!==t-gt;i++);if(n===1){let s=(t+gt)/Lo;return function(c,f){let u=c.pow(f,s);if(!c.eql(c.sqr(u),f))throw new Error("Cannot find square root");return u}}let o=(r+gt)/yr;return function(a,c){if(a.pow(c,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let f=n,u=a.pow(a.mul(a.ONE,i),r),l=a.pow(c,o),p=a.pow(c,r);for(;!a.eql(p,a.ONE);){if(a.eql(p,a.ZERO))return a.ZERO;let d=1;for(let y=a.sqr(p);d<f&&!a.eql(y,a.ONE);d++)y=a.sqr(y);let h=a.pow(u,gt<<BigInt(f-d-1));u=a.sqr(h),l=a.mul(l,h),p=a.mul(p,u),f=d}return l}}function yp(t){if(t%Lo===up){let e=(t+gt)/Lo;return function(n,i){let o=n.pow(i,e);if(!n.eql(n.sqr(o),i))throw new Error("Cannot find square root");return o}}if(t%W0===G0){let e=(t-G0)/W0;return function(n,i){let o=n.mul(i,yr),s=n.pow(o,e),a=n.mul(i,s),c=n.mul(n.mul(a,yr),s),f=n.mul(a,n.sub(c,n.ONE));if(!n.eql(n.sqr(f),i))throw new Error("Cannot find square root");return f}}return t%hp,pp(t)}var Y0=(t,e)=>(ut(t,e)&gt)===gt,gp=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Do(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=gp.reduce((n,i)=>(n[i]="function",n),e);return Ee(t,r)}function xp(t,e,r){if(r<Ct)throw new Error("Expected power > 0");if(r===Ct)return t.ONE;if(r===gt)return e;let n=t.ONE,i=e;for(;r>Ct;)r&gt&&(n=t.mul(n,i)),i=t.sqr(i),r>>=gt;return n}function mp(t,e){let r=new Array(e.length),n=e.reduce((o,s,a)=>t.is0(s)?o:(r[a]=o,t.mul(o,s)),t.ONE),i=t.inv(n);return e.reduceRight((o,s,a)=>t.is0(s)?o:(r[a]=t.mul(o,r[a]),t.mul(o,s)),i),r}function Po(t,e){let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function ri(t,e,r=!1,n={}){if(t<=Ct)throw new Error(`Expected Field ORDER > 0, got ${t}`);let{nBitLength:i,nByteLength:o}=Po(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");let s=yp(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:ln(i),ZERO:Ct,ONE:gt,create:c=>ut(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return Ct<=c&&c<t},is0:c=>c===Ct,isOdd:c=>(c&gt)===gt,neg:c=>ut(-c,t),eql:(c,f)=>c===f,sqr:c=>ut(c*c,t),add:(c,f)=>ut(c+f,t),sub:(c,f)=>ut(c-f,t),mul:(c,f)=>ut(c*f,t),pow:(c,f)=>xp(a,c,f),div:(c,f)=>ut(c*ei(f,t),t),sqrN:c=>c*c,addN:(c,f)=>c+f,subN:(c,f)=>c-f,mulN:(c,f)=>c*f,inv:c=>ei(c,t),sqrt:n.sqrt||(c=>s(a,c)),invertBatch:c=>mp(a,c),cmov:(c,f,u)=>u?f:c,toBytes:c=>r?pr(c,o):je(c,o),fromBytes:c=>{if(c.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${c.length}`);return r?Je(c):De(c)}});return Object.freeze(a)}function Z0(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");let r=t.sqrt(e);return t.isOdd(r)?t.neg(r):r}function Q0(t){if(typeof t!="bigint")throw new Error("field order must be bigint");let e=t.toString(2).length;return Math.ceil(e/8)}function ko(t){let e=Q0(t);return e+Math.ceil(e/2)}function X0(t,e,r=!1){let n=t.length,i=Q0(e),o=ko(e);if(n<16||n<o||n>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);let s=r?De(t):Je(t),a=ut(s,e-gt)+gt;return r?pr(a,i):je(a,i)}var bp=BigInt(0),No=BigInt(1);function ni(t,e){let r=(i,o)=>{let s=o.negate();return i?s:o},n=i=>{let o=Math.ceil(e/i)+1,s=2**(i-1);return{windows:o,windowSize:s}};return{constTimeNegate:r,unsafeLadder(i,o){let s=t.ZERO,a=i;for(;o>bp;)o&No&&(s=s.add(a)),a=a.double(),o>>=No;return s},precomputeWindow(i,o){let{windows:s,windowSize:a}=n(o),c=[],f=i,u=f;for(let l=0;l<s;l++){u=f,c.push(u);for(let p=1;p<a;p++)u=u.add(f),c.push(u);f=u.double()}return c},wNAF(i,o,s){let{windows:a,windowSize:c}=n(i),f=t.ZERO,u=t.BASE,l=BigInt(2**i-1),p=2**i,d=BigInt(i);for(let h=0;h<a;h++){let y=h*c,g=Number(s&l);s>>=d,g>c&&(g-=p,s+=No);let x=y,m=y+Math.abs(g)-1,b=h%2!==0,_=g<0;g===0?u=u.add(r(b,o[x])):f=f.add(r(_,o[m]))}return{p:f,f:u}},wNAFCached(i,o,s,a){let c=i._WINDOW_SIZE||1,f=o.get(i);return f||(f=this.precomputeWindow(i,c),c!==1&&o.set(i,a(f))),this.wNAF(c,f,s)}}}function hn(t){return Do(t.Fp),Ee(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Po(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}var fe=BigInt(0),Xt=BigInt(1),ii=BigInt(2),wp=BigInt(8),Ep={zip215:!0};function Sp(t){let e=hn(t);return Ee(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function oi(t){let e=Sp(t),{Fp:r,n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:c}=e,f=ii<<BigInt(a*8)-Xt,u=r.create,l=e.uvRatio||((P,A)=>{try{return{isValid:!0,value:r.sqrt(P*r.inv(A))}}catch{return{isValid:!1,value:fe}}}),p=e.adjustScalarBytes||(P=>P),d=e.domain||((P,A,O)=>{if(A.length||O)throw new Error("Contexts/pre-hash are not supported");return P}),h=P=>typeof P=="bigint"&&fe<P,y=(P,A)=>h(P)&&h(A)&&P<A,g=P=>P===fe||y(P,f);function x(P,A){if(y(P,A))return P;throw new Error(`Expected valid scalar < ${A}, got ${typeof P} ${P}`)}function m(P){return P===fe?P:x(P,n)}let b=new Map;function _(P){if(!(P instanceof E))throw new Error("ExtendedPoint expected")}class E{constructor(A,O,K,V){if(this.ex=A,this.ey=O,this.ez=K,this.et=V,!g(A))throw new Error("x required");if(!g(O))throw new Error("y required");if(!g(K))throw new Error("z required");if(!g(V))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(A){if(A instanceof E)throw new Error("extended point not allowed");let{x:O,y:K}=A||{};if(!g(O)||!g(K))throw new Error("invalid affine point");return new E(O,K,Xt,u(O*K))}static normalizeZ(A){let O=r.invertBatch(A.map(K=>K.ez));return A.map((K,V)=>K.toAffine(O[V])).map(E.fromAffine)}_setWindowSize(A){this._WINDOW_SIZE=A,b.delete(this)}assertValidity(){let{a:A,d:O}=e;if(this.is0())throw new Error("bad point: ZERO");let{ex:K,ey:V,ez:Z,et:J}=this,ot=u(K*K),j=u(V*V),rt=u(Z*Z),wt=u(rt*rt),mt=u(ot*A),Nt=u(rt*u(mt+j)),Ut=u(wt+u(O*u(ot*j)));if(Nt!==Ut)throw new Error("bad point: equation left != right (1)");let Bt=u(K*V),Ft=u(Z*J);if(Bt!==Ft)throw new Error("bad point: equation left != right (2)")}equals(A){_(A);let{ex:O,ey:K,ez:V}=this,{ex:Z,ey:J,ez:ot}=A,j=u(O*ot),rt=u(Z*V),wt=u(K*ot),mt=u(J*V);return j===rt&&wt===mt}is0(){return this.equals(E.ZERO)}negate(){return new E(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:A}=e,{ex:O,ey:K,ez:V}=this,Z=u(O*O),J=u(K*K),ot=u(ii*u(V*V)),j=u(A*Z),rt=O+K,wt=u(u(rt*rt)-Z-J),mt=j+J,Nt=mt-ot,Ut=j-J,Bt=u(wt*Nt),Ft=u(mt*Ut),Se=u(wt*Ut),or=u(Nt*mt);return new E(Bt,Ft,or,Se)}add(A){_(A);let{a:O,d:K}=e,{ex:V,ey:Z,ez:J,et:ot}=this,{ex:j,ey:rt,ez:wt,et:mt}=A;if(O===BigInt(-1)){let Fs=u((Z-V)*(rt+j)),Ms=u((Z+V)*(rt-j)),Ti=u(Ms-Fs);if(Ti===fe)return this.double();let Vs=u(J*ii*mt),qs=u(ot*ii*wt),zs=qs+Vs,Hs=Ms+Fs,$s=qs-Vs,Mc=u(zs*Ti),Vc=u(Hs*$s),qc=u(zs*$s),zc=u(Ti*Hs);return new E(Mc,Vc,zc,qc)}let Nt=u(V*j),Ut=u(Z*rt),Bt=u(ot*K*mt),Ft=u(J*wt),Se=u((V+Z)*(j+rt)-Nt-Ut),or=Ft-Bt,Jr=Ft+Bt,Ks=u(Ut-O*Nt),Uc=u(Se*or),Oc=u(Jr*Ks),Kc=u(Se*Ks),Fc=u(or*Jr);return new E(Uc,Oc,Fc,Kc)}subtract(A){return this.add(A.negate())}wNAF(A){return D.wNAFCached(this,b,A,E.normalizeZ)}multiply(A){let{p:O,f:K}=this.wNAF(x(A,n));return E.normalizeZ([O,K])[0]}multiplyUnsafe(A){let O=m(A);return O===fe?L:this.equals(L)||O===Xt?this:this.equals(S)?this.wNAF(O).p:D.unsafeLadder(this,O)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return D.unsafeLadder(this,n).is0()}toAffine(A){let{ex:O,ey:K,ez:V}=this,Z=this.is0();A==null&&(A=Z?wp:r.inv(V));let J=u(O*A),ot=u(K*A),j=u(V*A);if(Z)return{x:fe,y:Xt};if(j!==Xt)throw new Error("invZ was invalid");return{x:J,y:ot}}clearCofactor(){let{h:A}=e;return A===Xt?this:this.multiplyUnsafe(A)}static fromHex(A,O=!1){let{d:K,a:V}=e,Z=r.BYTES;A=bt("pointHex",A,Z);let J=A.slice(),ot=A[Z-1];J[Z-1]=ot&-129;let j=Je(J);j===fe||(O?x(j,f):x(j,r.ORDER));let rt=u(j*j),wt=u(rt-Xt),mt=u(K*rt-V),{isValid:Nt,value:Ut}=l(wt,mt);if(!Nt)throw new Error("Point.fromHex: invalid y coordinate");let Bt=(Ut&Xt)===Xt,Ft=(ot&128)!==0;if(!O&&Ut===fe&&Ft)throw new Error("Point.fromHex: x=0 and x_0=1");return Ft!==Bt&&(Ut=u(-Ut)),E.fromAffine({x:Ut,y:j})}static fromPrivateKey(A){return M(A).point}toRawBytes(){let{x:A,y:O}=this.toAffine(),K=pr(O,r.BYTES);return K[K.length-1]|=A&Xt?128:0,K}toHex(){return Le(this.toRawBytes())}}E.BASE=new E(e.Gx,e.Gy,Xt,u(e.Gx*e.Gy)),E.ZERO=new E(fe,Xt,Xt,fe);let{BASE:S,ZERO:L}=E,D=ni(E,a*8);function z(P){return ut(P,n)}function q(P){return z(Je(P))}function M(P){let A=a;P=bt("private key",P,A);let O=bt("hashed private key",o(P),2*A),K=p(O.slice(0,A)),V=O.slice(A,2*A),Z=q(K),J=S.multiply(Z),ot=J.toRawBytes();return{head:K,prefix:V,scalar:Z,point:J,pointBytes:ot}}function X(P){return M(P).pointBytes}function at(P=new Uint8Array,...A){let O=Pe(...A);return q(o(d(O,bt("context",P),!!i)))}function kt(P,A,O={}){P=bt("message",P),i&&(P=i(P));let{prefix:K,scalar:V,pointBytes:Z}=M(A),J=at(O.context,K,P),ot=S.multiply(J).toRawBytes(),j=at(O.context,ot,Z,P),rt=z(J+j*V);m(rt);let wt=Pe(ot,pr(rt,r.BYTES));return bt("result",wt,a*2)}let T=Ep;function k(P,A,O,K=T){let{context:V,zip215:Z}=K,J=r.BYTES;P=bt("signature",P,2*J),A=bt("message",A),i&&(A=i(A));let ot=Je(P.slice(J,2*J)),j,rt,wt;try{j=E.fromHex(O,Z),rt=E.fromHex(P.slice(0,J),Z),wt=S.multiplyUnsafe(ot)}catch{return!1}if(!Z&&j.isSmallOrder())return!1;let mt=at(V,rt.toRawBytes(),j.toRawBytes(),A);return rt.add(j.multiplyUnsafe(mt)).subtract(wt).clearCofactor().equals(E.ZERO)}return S._setWindowSize(8),{CURVE:e,getPublicKey:X,sign:kt,verify:k,ExtendedPoint:E,utils:{getExtendedPublicKey:M,randomPrivateKey:()=>s(r.BYTES),precompute(P=8,A=E.BASE){return A._setWindowSize(P),A.multiply(BigInt(3)),A}}}}var Oo=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),J0=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Cx=BigInt(0),Bp=BigInt(1),Uo=BigInt(2),Ap=BigInt(5),j0=BigInt(10),Ip=BigInt(20),Tp=BigInt(40),tf=BigInt(80);function Cp(t){let e=Oo,n=t*t%e*t%e,i=xt(n,Uo,e)*n%e,o=xt(i,Bp,e)*t%e,s=xt(o,Ap,e)*o%e,a=xt(s,j0,e)*s%e,c=xt(a,Ip,e)*a%e,f=xt(c,Tp,e)*c%e,u=xt(f,tf,e)*f%e,l=xt(u,tf,e)*f%e,p=xt(l,j0,e)*s%e;return{pow_p_5_8:xt(p,Uo,e)*t%e,b2:n}}function _p(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function Rp(t,e){let r=Oo,n=ut(e*e*e,r),i=ut(n*n*e,r),o=Cp(t*i).pow_p_5_8,s=ut(t*n*o,r),a=ut(e*s*s,r),c=s,f=ut(s*J0,r),u=a===t,l=a===ut(-t,r),p=a===ut(-t*J0,r);return u&&(s=c),(l||p)&&(s=f),Y0(s,r)&&(s=ut(-s,r)),{isValid:u||l,value:s}}var ke=ri(Oo,void 0,!0),Ko={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:ke,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:To,randomBytes:Ur,adjustScalarBytes:_p,uvRatio:Rp},Kr=oi(Ko);function ef(t,e,r){if(e.length>255)throw new Error("Context is too big");return Qn(Bo("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,e.length]),e,t)}var _x=oi({...Ko,domain:ef}),Rx=oi({...Ko,domain:ef,prehash:To});var Lp=(ke.ORDER+BigInt(3))/BigInt(8),Lx=ke.pow(Uo,Lp),Dx=ke.sqrt(ke.neg(ke.ONE)),Px=(ke.ORDER-BigInt(5))/BigInt(8),kx=BigInt(486662);var Nx=Z0(ke,ke.neg(BigInt(486664)));var Ux=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),Ox=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),Kx=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),Fx=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");var Mx=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Fr=32,Ne=64,si=32;function rf(){let t=Kr.utils.randomPrivateKey(),e=Kr.getPublicKey(t);return{privateKey:af(t,e),publicKey:e}}function nf(t){if(t.length!==si)throw new TypeError('"seed" must be 32 bytes in length.');if(!(t instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, or Uint8Array.');let e=t,r=Kr.getPublicKey(e);return{privateKey:af(e,r),publicKey:r}}function of(t,e){let r=t.subarray(0,si);return Kr.sign(e instanceof Uint8Array?e:e.subarray(),r)}function sf(t,e,r){return Kr.verify(e,r instanceof Uint8Array?r:r.subarray(),t)}function af(t,e){let r=new Uint8Array(Ne);for(let n=0;n<si;n++)r[n]=t[n],r[si+n]=e[n];return r}var Wt={get(t=globalThis){let e=t.crypto;if(e==null||e.subtle==null)throw Object.assign(new Error("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p/blob/main/packages/crypto/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return e}};var Fo={alg:"A128GCM",ext:!0,k:"scm9jmO_4BJAgdwWGVulLg",key_ops:["encrypt","decrypt"],kty:"oct"};function Mo(t){let e=t?.algorithm??"AES-GCM",r=t?.keyLength??16,n=t?.nonceLength??12,i=t?.digest??"SHA-256",o=t?.saltLength??16,s=t?.iterations??32767,a=Wt.get();r*=8;async function c(l,p){let d=a.getRandomValues(new Uint8Array(o)),h=a.getRandomValues(new Uint8Array(n)),y={name:e,iv:h};typeof p=="string"&&(p=It(p));let g;if(p.length===0){g=await a.subtle.importKey("jwk",Fo,{name:"AES-GCM"},!0,["encrypt"]);try{let m={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},b=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);g=await a.subtle.deriveKey(m,b,{name:e,length:r},!0,["encrypt"])}catch{g=await a.subtle.importKey("jwk",Fo,{name:"AES-GCM"},!0,["encrypt"])}}else{let m={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},b=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);g=await a.subtle.deriveKey(m,b,{name:e,length:r},!0,["encrypt"])}let x=await a.subtle.encrypt(y,g,l);return Tt([d,y.iv,new Uint8Array(x)])}async function f(l,p){let d=l.subarray(0,o),h=l.subarray(o,o+n),y=l.subarray(o+n),g={name:e,iv:h};typeof p=="string"&&(p=It(p));let x;if(p.length===0)try{let b={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},_=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);x=await a.subtle.deriveKey(b,_,{name:e,length:r},!0,["decrypt"])}catch{x=await a.subtle.importKey("jwk",Fo,{name:"AES-GCM"},!0,["decrypt"])}else{let b={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},_=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);x=await a.subtle.deriveKey(b,_,{name:e,length:r},!0,["decrypt"])}let m=await a.subtle.decrypt(g,x,y);return new Uint8Array(m)}return{encrypt:c,decrypt:f}}async function Mr(t,e){let n=await Mo().encrypt(t,e);return In.encode(n)}var Vo=new Float32Array([-0]),tr=new Uint8Array(Vo.buffer);function cf(t,e,r){Vo[0]=t,e[r]=tr[0],e[r+1]=tr[1],e[r+2]=tr[2],e[r+3]=tr[3]}function uf(t,e){return tr[0]=t[e],tr[1]=t[e+1],tr[2]=t[e+2],tr[3]=t[e+3],Vo[0]}var qo=new Float64Array([-0]),qt=new Uint8Array(qo.buffer);function lf(t,e,r){qo[0]=t,e[r]=qt[0],e[r+1]=qt[1],e[r+2]=qt[2],e[r+3]=qt[3],e[r+4]=qt[4],e[r+5]=qt[5],e[r+6]=qt[6],e[r+7]=qt[7]}function hf(t,e){return qt[0]=t[e],qt[1]=t[e+1],qt[2]=t[e+2],qt[3]=t[e+3],qt[4]=t[e+4],qt[5]=t[e+5],qt[6]=t[e+6],qt[7]=t[e+7],qo[0]}var Pp=BigInt(Number.MAX_SAFE_INTEGER),kp=BigInt(Number.MIN_SAFE_INTEGER),Yt=class t{lo;hi;constructor(e,r){this.lo=e|0,this.hi=r|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(BigInt(r)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}static fromBigInt(e){if(e===0n)return gr;if(e<Pp&&e>kp)return this.fromNumber(Number(e));let r=e<0n;r&&(e=-e);let n=e>>32n,i=e-(n<<32n);return r&&(n=~n|0n,i=~i|0n,++i>df&&(i=0n,++n>df&&(n=0n))),new t(Number(i),Number(n))}static fromNumber(e){if(e===0)return gr;let r=e<0;r&&(e=-e);let n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new t(n,i)}static from(e){return typeof e=="number"?t.fromNumber(e):typeof e=="bigint"?t.fromBigInt(e):typeof e=="string"?t.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new t(e.low>>>0,e.high>>>0):gr}},gr=new Yt(0,0);gr.toBigInt=function(){return 0n};gr.zzEncode=gr.zzDecode=function(){return this};gr.length=function(){return 1};var df=4294967296n;function pf(t){let e=0,r=0;for(let n=0;n<t.length;++n)r=t.charCodeAt(n),r<128?e+=1:r<2048?e+=2:(r&64512)===55296&&(t.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e}function yf(t,e,r){if(r-e<1)return"";let i,o=[],s=0,a;for(;e<r;)a=t[e++],a<128?o[s++]=a:a>191&&a<224?o[s++]=(a&31)<<6|t[e++]&63:a>239&&a<365?(a=((a&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,o[s++]=55296+(a>>10),o[s++]=56320+(a&1023)):o[s++]=(a&15)<<12|(t[e++]&63)<<6|t[e++]&63,s>8191&&((i??(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i!=null?(s>0&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))}function zo(t,e,r){let n=r,i,o;for(let s=0;s<t.length;++s)i=t.charCodeAt(s),i<128?e[r++]=i:i<2048?(e[r++]=i>>6|192,e[r++]=i&63|128):(i&64512)===55296&&((o=t.charCodeAt(s+1))&64512)===56320?(i=65536+((i&1023)<<10)+(o&1023),++s,e[r++]=i>>18|240,e[r++]=i>>12&63|128,e[r++]=i>>6&63|128,e[r++]=i&63|128):(e[r++]=i>>12|224,e[r++]=i>>6&63|128,e[r++]=i&63|128);return r-n}function ce(t,e){return RangeError(`index out of range: ${t.pos} + ${e??1} > ${t.len}`)}function ai(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}var Ho=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,ce(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw ce(this,4);return ai(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw ce(this,4);return ai(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw ce(this,4);let e=uf(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw ce(this,4);let e=hf(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw ce(this,e);return this.pos+=e,r===n?new Uint8Array(0):this.buf.subarray(r,n)}string(){let e=this.bytes();return yf(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw ce(this,e);this.pos+=e}else do if(this.pos>=this.len)throw ce(this);while(this.buf[this.pos++]&128);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new Yt(0,0),r=0;if(this.len-this.pos>4){for(;r<4;++r)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;r=0}else{for(;r<3;++r){if(this.pos>=this.len)throw ce(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<r*7)>>>0,e}if(this.len-this.pos>4){for(;r<5;++r)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;r<5;++r){if(this.pos>=this.len)throw ce(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw ce(this,8);let e=ai(this.buf,this.pos+=4),r=ai(this.buf,this.pos+=4);return new Yt(e,r)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){return this.readLongVarint().toNumber(!0)}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function $o(t){return new Ho(t instanceof Uint8Array?t:t.subarray())}function ue(t,e){let r=$o(t);return e.decode(r)}function Go(t){let e=t??8192,r=e>>>1,n,i=e;return function(s){if(s<1||s>r)return Vt(s);i+s>e&&(n=Vt(e),i=0);let a=n.subarray(i,i+=s);return i&7&&(i=(i|7)+1),a}}var xr=class{fn;len;next;val;constructor(e,r,n){this.fn=e,this.len=r,this.next=void 0,this.val=n}};function Wo(){}var Zo=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},Np=Go();function Up(t){return globalThis.Buffer!=null?Vt(t):Np(t)}var yn=class{len;head;tail;states;constructor(){this.len=0,this.head=new xr(Wo,0,0),this.tail=this.head,this.states=null}_push(e,r,n){return this.tail=this.tail.next=new xr(e,r,n),this.len+=r,this}uint32(e){return this.len+=(this.tail=this.tail.next=new Qo((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(dn,10,Yt.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let r=Yt.fromBigInt(e);return this._push(dn,r.length(),r)}uint64Number(e){let r=Yt.fromNumber(e);return this._push(dn,r.length(),r)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let r=Yt.fromBigInt(e).zzEncode();return this._push(dn,r.length(),r)}sint64Number(e){let r=Yt.fromNumber(e).zzEncode();return this._push(dn,r.length(),r)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(Yo,1,e?1:0)}fixed32(e){return this._push(pn,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let r=Yt.fromBigInt(e);return this._push(pn,4,r.lo)._push(pn,4,r.hi)}fixed64Number(e){let r=Yt.fromNumber(e);return this._push(pn,4,r.lo)._push(pn,4,r.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(cf,4,e)}double(e){return this._push(lf,8,e)}bytes(e){let r=e.length>>>0;return r===0?this._push(Yo,1,0):this.uint32(r)._push(Kp,r,e)}string(e){let r=pf(e);return r!==0?this.uint32(r)._push(zo,r,e):this._push(Yo,1,0)}fork(){return this.states=new Zo(this),this.head=this.tail=new xr(Wo,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new xr(Wo,0,0),this.len=0),this}ldelim(){let e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=e.next,this.tail=r,this.len+=n),this}finish(){let e=this.head.next,r=Up(this.len),n=0;for(;e!=null;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r}};function Yo(t,e,r){e[r]=t&255}function Op(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}var Qo=class extends xr{next;constructor(e,r){super(Op,e,r),this.next=void 0}};function dn(t,e,r){for(;t.hi!==0;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}function pn(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function Kp(t,e,r){e.set(t,r)}globalThis.Buffer!=null&&(yn.prototype.bytes=function(t){let e=t.length>>>0;return this.uint32(e),e>0&&this._push(Fp,e,t),this},yn.prototype.string=function(t){let e=globalThis.Buffer.byteLength(t);return this.uint32(e),e>0&&this._push(Mp,e,t),this});function Fp(t,e,r){e.set(t,r)}function Mp(t,e,r){t.length<40?zo(t,e,r):e.utf8Write!=null?e.utf8Write(t,r):e.set(It(t),r)}function Xo(){return new yn}function le(t,e){let r=Xo();return e.encode(t,r,{lengthDelimited:!1}),r.finish()}var Vr;(function(t){t[t.VARINT=0]="VARINT",t[t.BIT64=1]="BIT64",t[t.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",t[t.START_GROUP=3]="START_GROUP",t[t.END_GROUP=4]="END_GROUP",t[t.BIT32=5]="BIT32"})(Vr||(Vr={}));function fi(t,e,r,n){return{name:t,type:e,encode:r,decode:n}}function qr(t){function e(i){if(t[i.toString()]==null)throw new Error("Invalid enum value");return t[i]}let r=function(o,s){let a=e(o);s.int32(a)},n=function(o){let s=o.int32();return e(s)};return fi("enum",Vr.VARINT,r,n)}function he(t,e){return fi("message",Vr.LENGTH_DELIMITED,t,e)}var Pt;(function(t){t.RSA="RSA",t.Ed25519="Ed25519",t.Secp256k1="Secp256k1"})(Pt||(Pt={}));var Jo;(function(t){t[t.RSA=0]="RSA",t[t.Ed25519=1]="Ed25519",t[t.Secp256k1=2]="Secp256k1"})(Jo||(Jo={}));(function(t){t.codec=()=>qr(Jo)})(Pt||(Pt={}));var Ue;(function(t){let e;t.codec=()=>(e==null&&(e=he((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),Pt.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},o=n==null?r.len:r.pos+n;for(;r.pos<o;){let s=r.uint32();switch(s>>>3){case 1:i.Type=Pt.codec().decode(r);break;case 2:i.Data=r.bytes();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>le(r,t.codec()),t.decode=r=>ue(r,t.codec())})(Ue||(Ue={}));var Oe;(function(t){let e;t.codec=()=>(e==null&&(e=he((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),Pt.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},o=n==null?r.len:r.pos+n;for(;r.pos<o;){let s=r.uint32();switch(s>>>3){case 1:i.Type=Pt.codec().decode(r);break;case 2:i.Data=r.bytes();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>le(r,t.codec()),t.decode=r=>ue(r,t.codec())})(Oe||(Oe={}));var gn=class{_key;constructor(e){this._key=zr(e,Fr)}verify(e,r){return sf(this._key,r,e)}marshal(){return this._key}get bytes(){return Ue.encode({Type:Pt.Ed25519,Data:this.marshal()}).subarray()}equals(e){return Kt(this.bytes,e.bytes)}hash(){let e=Ot.digest(this.bytes);return te(e)?e.then(({bytes:r})=>r):e.bytes}},mr=class{_key;_publicKey;constructor(e,r){this._key=zr(e,Ne),this._publicKey=zr(r,Fr)}sign(e){return of(this._key,e)}get public(){return new gn(this._publicKey)}marshal(){return this._key}get bytes(){return Oe.encode({Type:Pt.Ed25519,Data:this.marshal()}).subarray()}equals(e){return Kt(this.bytes,e.bytes)}async hash(){let e=Ot.digest(this.bytes),r;return te(e)?{bytes:r}=await e:r=e.bytes,r}async id(){let e=ze.digest(this.public.bytes);return At.encode(e.bytes).substring(1)}async export(e,r="libp2p-key"){if(r==="libp2p-key")return Mr(this.bytes,e);throw new $(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}};function Vp(t){if(t.length>Ne){t=zr(t,Ne+Fr);let n=t.subarray(0,Ne),i=t.subarray(Ne,t.length);return new mr(n,i)}t=zr(t,Ne);let e=t.subarray(0,Ne),r=t.subarray(Fr);return new mr(e,r)}function qp(t){return t=zr(t,Fr),new gn(t)}async function zp(){let{privateKey:t,publicKey:e}=rf();return new mr(t,e)}async function xf(t){let{privateKey:e,publicKey:r}=nf(t);return new mr(e,r)}function zr(t,e){if(t=Uint8Array.from(t??[]),t.length!==e)throw new $(`Key must be a Uint8Array of length ${e}, got ${t.length}`,"ERR_INVALID_KEY_TYPE");return t}var Hp={"P-256":256,"P-384":384,"P-521":521},$p=Object.keys(Hp),Km=$p.join(" / ");var is={};_t(is,{MAX_KEY_SIZE:()=>bn,RsaPrivateKey:()=>Hr,RsaPublicKey:()=>vn,fromJwk:()=>r1,generateKeyPair:()=>n1,unmarshalRsaPrivateKey:()=>t1,unmarshalRsaPublicKey:()=>e1});var mn=Mt(ct(),1);var Ev=Mt(Ef(),1);function ui(t){if(isNaN(t)||t<=0)throw new $("random bytes length must be a Number bigger than 0","ERR_INVALID_LENGTH");return Ur(t)}var iv=Mt(Gn(),1),rs=Mt(ct(),1);function Sf(t,e){return e.map(r=>Qt(t[r]))}function Bf(t){return rs.default.pki.setRsaPrivateKey(...Sf(t,["n","e","d","p","q","dp","dq","qi"]))}function Af(t){return rs.default.pki.setRsaPublicKey(...Sf(t,["n","e"]))}var br={};_t(br,{jwkToPkcs1:()=>Zp,jwkToPkix:()=>Xp,pkcs1ToJwk:()=>Yp,pkixToJwk:()=>Qp});var av=Mt(an(),1),fv=Mt(Gn(),1);var Ke=Mt(ct(),1);function Yp(t){let e=Ke.default.asn1.fromDer(lt(t,"ascii")),r=Ke.default.pki.privateKeyFromAsn1(e);return{kty:"RSA",n:oe(r.n),e:oe(r.e),d:oe(r.d),p:oe(r.p),q:oe(r.q),dp:oe(r.dP),dq:oe(r.dQ),qi:oe(r.qInv),alg:"RS256"}}function Zp(t){if(t.n==null||t.e==null||t.d==null||t.p==null||t.q==null||t.dp==null||t.dq==null||t.qi==null)throw new $("JWK was missing components","ERR_INVALID_PARAMETERS");let e=Ke.default.pki.privateKeyToAsn1({n:Qt(t.n),e:Qt(t.e),d:Qt(t.d),p:Qt(t.p),q:Qt(t.q),dP:Qt(t.dp),dQ:Qt(t.dq),qInv:Qt(t.qi)});return It(Ke.default.asn1.toDer(e).getBytes(),"ascii")}function Qp(t){let e=Ke.default.asn1.fromDer(lt(t,"ascii")),r=Ke.default.pki.publicKeyFromAsn1(e);return{kty:"RSA",n:oe(r.n),e:oe(r.e)}}function Xp(t){if(t.n==null||t.e==null)throw new $("JWK was missing components","ERR_INVALID_PARAMETERS");let e=Ke.default.pki.publicKeyToAsn1({n:Qt(t.n),e:Qt(t.e)});return It(Ke.default.asn1.toDer(e).getBytes(),"ascii")}async function If(t){let e=await Wt.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),r=await _f(e);return{privateKey:r[0],publicKey:r[1]}}async function ns(t){let r=[await Wt.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await Jp(t)],n=await _f({privateKey:r[0],publicKey:r[1]});return{privateKey:n[0],publicKey:n[1]}}async function Tf(t,e){let r=await Wt.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),n=await Wt.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,e instanceof Uint8Array?e:e.subarray());return new Uint8Array(n,0,n.byteLength)}async function Cf(t,e,r){let n=await Wt.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return Wt.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},n,e,r instanceof Uint8Array?r:r.subarray())}async function _f(t){if(t.privateKey==null||t.publicKey==null)throw new $("Private and public key are required","ERR_INVALID_PARAMETERS");return Promise.all([Wt.get().subtle.exportKey("jwk",t.privateKey),Wt.get().subtle.exportKey("jwk",t.publicKey)])}async function Jp(t){return Wt.get().subtle.importKey("jwk",{kty:t.kty,n:t.n,e:t.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}function Rf(t,e,r,n){let i=e?Af(t):Bf(t),o=lt(r instanceof Uint8Array?r:r.subarray(),"ascii"),s=n(o,i);return It(s,"ascii")}function Lf(t,e){return Rf(t,!0,e,(r,n)=>n.encrypt(r))}function Df(t,e){return Rf(t,!1,e,(r,n)=>n.decrypt(r))}function li(t){if(t.kty!=="RSA")throw new $("invalid key type","ERR_INVALID_KEY_TYPE");if(t.n==null)throw new $("invalid key modulus","ERR_INVALID_KEY_MODULUS");return It(t.n,"base64url").length*8}var bn=8192,vn=class{_key;constructor(e){this._key=e}verify(e,r){return Cf(this._key,r,e)}marshal(){return br.jwkToPkix(this._key)}get bytes(){return Ue.encode({Type:Pt.RSA,Data:this.marshal()}).subarray()}encrypt(e){return Lf(this._key,e)}equals(e){return Kt(this.bytes,e.bytes)}hash(){let e=Ot.digest(this.bytes);return te(e)?e.then(({bytes:r})=>r):e.bytes}},Hr=class{_key;_publicKey;constructor(e,r){this._key=e,this._publicKey=r}genSecret(){return ui(16)}sign(e){return Tf(this._key,e)}get public(){if(this._publicKey==null)throw new $("public key not provided","ERR_PUBKEY_NOT_PROVIDED");return new vn(this._publicKey)}decrypt(e){return Df(this._key,e)}marshal(){return br.jwkToPkcs1(this._key)}get bytes(){return Oe.encode({Type:Pt.RSA,Data:this.marshal()}).subarray()}equals(e){return Kt(this.bytes,e.bytes)}hash(){let e=Ot.digest(this.bytes);return te(e)?e.then(({bytes:r})=>r):e.bytes}async id(){let e=await this.public.hash();return lt(e,"base58btc")}async export(e,r="pkcs-8"){if(r==="pkcs-8"){let n=new mn.default.util.ByteBuffer(this.marshal()),i=mn.default.asn1.fromDer(n),o=mn.default.pki.privateKeyFromAsn1(i),s={algorithm:"aes256",count:1e4,saltSize:128/8,prfAlgorithm:"sha512"};return mn.default.pki.encryptRsaPrivateKey(o,e,s)}else{if(r==="libp2p-key")return Mr(this.bytes,e);throw new $(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}}};async function t1(t){let e=br.pkcs1ToJwk(t);if(li(e)>bn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let r=await ns(e);return new Hr(r.privateKey,r.publicKey)}function e1(t){let e=br.pkixToJwk(t);if(li(e)>bn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");return new vn(e)}async function r1(t){if(li(t)>bn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let e=await ns(t);return new Hr(e.privateKey,e.publicKey)}async function n1(t){if(t>bn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let e=await If(t);return new Hr(e.privateKey,e.publicKey)}var us={};_t(us,{Secp256k1PrivateKey:()=>En,Secp256k1PublicKey:()=>wn,generateKeyPair:()=>m1,unmarshalSecp256k1PrivateKey:()=>g1,unmarshalSecp256k1PublicKey:()=>x1});var i1=(t,e,r)=>t&e^~t&r,o1=(t,e,r)=>t&e^t&r^e&r,s1=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),er=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),rr=new Uint32Array(64),os=class extends Or{constructor(){super(64,32,8,!1),this.A=er[0]|0,this.B=er[1]|0,this.C=er[2]|0,this.D=er[3]|0,this.E=er[4]|0,this.F=er[5]|0,this.G=er[6]|0,this.H=er[7]|0}get(){let{A:e,B:r,C:n,D:i,E:o,F:s,G:a,H:c}=this;return[e,r,n,i,o,s,a,c]}set(e,r,n,i,o,s,a,c){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=c|0}process(e,r){for(let l=0;l<16;l++,r+=4)rr[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){let p=rr[l-15],d=rr[l-2],h=se(p,7)^se(p,18)^p>>>3,y=se(d,17)^se(d,19)^d>>>10;rr[l]=y+rr[l-7]+h+rr[l-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:c,G:f,H:u}=this;for(let l=0;l<64;l++){let p=se(a,6)^se(a,11)^se(a,25),d=u+p+i1(a,c,f)+s1[l]+rr[l]|0,y=(se(n,2)^se(n,13)^se(n,22))+o1(n,i,o)|0;u=f,f=c,c=a,a=s+d|0,s=o,o=i,i=n,n=d+y|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,c=c+this.F|0,f=f+this.G|0,u=u+this.H|0,this.set(n,i,o,s,a,c,f,u)}roundClean(){rr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Pf=Xn(()=>new os);function a1(t){let e=hn(t);Ee(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}var{bytesToNumberBE:f1,hexToBytes:c1}=ti,wr={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){let{Err:e}=wr;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");let r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:f1(n),l:t.subarray(r+2)}},toSig(t){let{Err:e}=wr,r=typeof t=="string"?c1(t):t;if(!ae(r))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");let{d:i,l:o}=wr._parseInt(r.subarray(2)),{d:s,l:a}=wr._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){let e=f=>Number.parseInt(f[0],16)&8?"00"+f:f,r=f=>{let u=f.toString(16);return u.length&1?`0${u}`:u},n=e(r(t.s)),i=e(r(t.r)),o=n.length/2,s=i.length/2,a=r(o),c=r(s);return`30${r(s+o+4)}02${c}${i}02${a}${n}`}},Fe=BigInt(0),ee=BigInt(1),Dv=BigInt(2),kf=BigInt(3),Pv=BigInt(4);function u1(t){let e=a1(t),{Fp:r}=e,n=e.toBytes||((h,y,g)=>{let x=y.toAffine();return Pe(Uint8Array.from([4]),r.toBytes(x.x),r.toBytes(x.y))}),i=e.fromBytes||(h=>{let y=h.subarray(1),g=r.fromBytes(y.subarray(0,r.BYTES)),x=r.fromBytes(y.subarray(r.BYTES,2*r.BYTES));return{x:g,y:x}});function o(h){let{a:y,b:g}=e,x=r.sqr(h),m=r.mul(x,h);return r.add(r.add(m,r.mul(h,y)),g)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(h){return typeof h=="bigint"&&Fe<h&&h<e.n}function a(h){if(!s(h))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function c(h){let{allowedPrivateKeyLengths:y,nByteLength:g,wrapPrivateKey:x,n:m}=e;if(y&&typeof h!="bigint"){if(ae(h)&&(h=Le(h)),typeof h!="string"||!y.includes(h.length))throw new Error("Invalid key");h=h.padStart(g*2,"0")}let b;try{b=typeof h=="bigint"?h:De(bt("private key",h,g))}catch{throw new Error(`private key must be ${g} bytes, hex or bigint, not ${typeof h}`)}return x&&(b=ut(b,m)),a(b),b}let f=new Map;function u(h){if(!(h instanceof l))throw new Error("ProjectivePoint expected")}class l{constructor(y,g,x){if(this.px=y,this.py=g,this.pz=x,y==null||!r.isValid(y))throw new Error("x required");if(g==null||!r.isValid(g))throw new Error("y required");if(x==null||!r.isValid(x))throw new Error("z required")}static fromAffine(y){let{x:g,y:x}=y||{};if(!y||!r.isValid(g)||!r.isValid(x))throw new Error("invalid affine point");if(y instanceof l)throw new Error("projective point not allowed");let m=b=>r.eql(b,r.ZERO);return m(g)&&m(x)?l.ZERO:new l(g,x,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(y){let g=r.invertBatch(y.map(x=>x.pz));return y.map((x,m)=>x.toAffine(g[m])).map(l.fromAffine)}static fromHex(y){let g=l.fromAffine(i(bt("pointHex",y)));return g.assertValidity(),g}static fromPrivateKey(y){return l.BASE.multiply(c(y))}_setWindowSize(y){this._WINDOW_SIZE=y,f.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:y,y:g}=this.toAffine();if(!r.isValid(y)||!r.isValid(g))throw new Error("bad point: x or y not FE");let x=r.sqr(g),m=o(y);if(!r.eql(x,m))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y}=this.toAffine();if(r.isOdd)return!r.isOdd(y);throw new Error("Field doesn't support isOdd")}equals(y){u(y);let{px:g,py:x,pz:m}=this,{px:b,py:_,pz:E}=y,S=r.eql(r.mul(g,E),r.mul(b,m)),L=r.eql(r.mul(x,E),r.mul(_,m));return S&&L}negate(){return new l(this.px,r.neg(this.py),this.pz)}double(){let{a:y,b:g}=e,x=r.mul(g,kf),{px:m,py:b,pz:_}=this,E=r.ZERO,S=r.ZERO,L=r.ZERO,D=r.mul(m,m),z=r.mul(b,b),q=r.mul(_,_),M=r.mul(m,b);return M=r.add(M,M),L=r.mul(m,_),L=r.add(L,L),E=r.mul(y,L),S=r.mul(x,q),S=r.add(E,S),E=r.sub(z,S),S=r.add(z,S),S=r.mul(E,S),E=r.mul(M,E),L=r.mul(x,L),q=r.mul(y,q),M=r.sub(D,q),M=r.mul(y,M),M=r.add(M,L),L=r.add(D,D),D=r.add(L,D),D=r.add(D,q),D=r.mul(D,M),S=r.add(S,D),q=r.mul(b,_),q=r.add(q,q),D=r.mul(q,M),E=r.sub(E,D),L=r.mul(q,z),L=r.add(L,L),L=r.add(L,L),new l(E,S,L)}add(y){u(y);let{px:g,py:x,pz:m}=this,{px:b,py:_,pz:E}=y,S=r.ZERO,L=r.ZERO,D=r.ZERO,z=e.a,q=r.mul(e.b,kf),M=r.mul(g,b),X=r.mul(x,_),at=r.mul(m,E),kt=r.add(g,x),T=r.add(b,_);kt=r.mul(kt,T),T=r.add(M,X),kt=r.sub(kt,T),T=r.add(g,m);let k=r.add(b,E);return T=r.mul(T,k),k=r.add(M,at),T=r.sub(T,k),k=r.add(x,m),S=r.add(_,E),k=r.mul(k,S),S=r.add(X,at),k=r.sub(k,S),D=r.mul(z,T),S=r.mul(q,at),D=r.add(S,D),S=r.sub(X,D),D=r.add(X,D),L=r.mul(S,D),X=r.add(M,M),X=r.add(X,M),at=r.mul(z,at),T=r.mul(q,T),X=r.add(X,at),at=r.sub(M,at),at=r.mul(z,at),T=r.add(T,at),M=r.mul(X,T),L=r.add(L,M),M=r.mul(k,T),S=r.mul(kt,S),S=r.sub(S,M),M=r.mul(kt,X),D=r.mul(k,D),D=r.add(D,M),new l(S,L,D)}subtract(y){return this.add(y.negate())}is0(){return this.equals(l.ZERO)}wNAF(y){return d.wNAFCached(this,f,y,g=>{let x=r.invertBatch(g.map(m=>m.pz));return g.map((m,b)=>m.toAffine(x[b])).map(l.fromAffine)})}multiplyUnsafe(y){let g=l.ZERO;if(y===Fe)return g;if(a(y),y===ee)return this;let{endo:x}=e;if(!x)return d.unsafeLadder(this,y);let{k1neg:m,k1:b,k2neg:_,k2:E}=x.splitScalar(y),S=g,L=g,D=this;for(;b>Fe||E>Fe;)b&ee&&(S=S.add(D)),E&ee&&(L=L.add(D)),D=D.double(),b>>=ee,E>>=ee;return m&&(S=S.negate()),_&&(L=L.negate()),L=new l(r.mul(L.px,x.beta),L.py,L.pz),S.add(L)}multiply(y){a(y);let g=y,x,m,{endo:b}=e;if(b){let{k1neg:_,k1:E,k2neg:S,k2:L}=b.splitScalar(g),{p:D,f:z}=this.wNAF(E),{p:q,f:M}=this.wNAF(L);D=d.constTimeNegate(_,D),q=d.constTimeNegate(S,q),q=new l(r.mul(q.px,b.beta),q.py,q.pz),x=D.add(q),m=z.add(M)}else{let{p:_,f:E}=this.wNAF(g);x=_,m=E}return l.normalizeZ([x,m])[0]}multiplyAndAddUnsafe(y,g,x){let m=l.BASE,b=(E,S)=>S===Fe||S===ee||!E.equals(m)?E.multiplyUnsafe(S):E.multiply(S),_=b(this,g).add(b(y,x));return _.is0()?void 0:_}toAffine(y){let{px:g,py:x,pz:m}=this,b=this.is0();y==null&&(y=b?r.ONE:r.inv(m));let _=r.mul(g,y),E=r.mul(x,y),S=r.mul(m,y);if(b)return{x:r.ZERO,y:r.ZERO};if(!r.eql(S,r.ONE))throw new Error("invZ was invalid");return{x:_,y:E}}isTorsionFree(){let{h:y,isTorsionFree:g}=e;if(y===ee)return!0;if(g)return g(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:y,clearCofactor:g}=e;return y===ee?this:g?g(l,this):this.multiplyUnsafe(e.h)}toRawBytes(y=!0){return this.assertValidity(),n(l,this,y)}toHex(y=!0){return Le(this.toRawBytes(y))}}l.BASE=new l(e.Gx,e.Gy,r.ONE),l.ZERO=new l(r.ZERO,r.ONE,r.ZERO);let p=e.nBitLength,d=ni(l,e.endo?Math.ceil(p/2):p);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:s}}function l1(t){let e=hn(t);return Ee(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Nf(t){let e=l1(t),{Fp:r,n}=e,i=r.BYTES+1,o=2*r.BYTES+1;function s(T){return Fe<T&&T<r.ORDER}function a(T){return ut(T,n)}function c(T){return ei(T,n)}let{ProjectivePoint:f,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:p}=u1({...e,toBytes(T,k,R){let P=k.toAffine(),A=r.toBytes(P.x),O=Pe;return R?O(Uint8Array.from([k.hasEvenY()?2:3]),A):O(Uint8Array.from([4]),A,r.toBytes(P.y))},fromBytes(T){let k=T.length,R=T[0],P=T.subarray(1);if(k===i&&(R===2||R===3)){let A=De(P);if(!s(A))throw new Error("Point is not on curve");let O=l(A),K=r.sqrt(O),V=(K&ee)===ee;return(R&1)===1!==V&&(K=r.neg(K)),{x:A,y:K}}else if(k===o&&R===4){let A=r.fromBytes(P.subarray(0,r.BYTES)),O=r.fromBytes(P.subarray(r.BYTES,2*r.BYTES));return{x:A,y:O}}else throw new Error(`Point of length ${k} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}}),d=T=>Le(je(T,e.nByteLength));function h(T){let k=n>>ee;return T>k}function y(T){return h(T)?a(-T):T}let g=(T,k,R)=>De(T.slice(k,R));class x{constructor(k,R,P){this.r=k,this.s=R,this.recovery=P,this.assertValidity()}static fromCompact(k){let R=e.nByteLength;return k=bt("compactSignature",k,R*2),new x(g(k,0,R),g(k,R,2*R))}static fromDER(k){let{r:R,s:P}=wr.toSig(bt("DER",k));return new x(R,P)}assertValidity(){if(!p(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!p(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(k){return new x(this.r,this.s,k)}recoverPublicKey(k){let{r:R,s:P,recovery:A}=this,O=L(bt("msgHash",k));if(A==null||![0,1,2,3].includes(A))throw new Error("recovery id invalid");let K=A===2||A===3?R+e.n:R;if(K>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let V=A&1?"03":"02",Z=f.fromHex(V+d(K)),J=c(K),ot=a(-O*J),j=a(P*J),rt=f.BASE.multiplyAndAddUnsafe(Z,ot,j);if(!rt)throw new Error("point at infinify");return rt.assertValidity(),rt}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new x(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return dr(this.toDERHex())}toDERHex(){return wr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return dr(this.toCompactHex())}toCompactHex(){return d(this.r)+d(this.s)}}let m={isValidPrivateKey(T){try{return u(T),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{let T=ko(e.n);return X0(e.randomBytes(T),e.n)},precompute(T=8,k=f.BASE){return k._setWindowSize(T),k.multiply(BigInt(3)),k}};function b(T,k=!0){return f.fromPrivateKey(T).toRawBytes(k)}function _(T){let k=ae(T),R=typeof T=="string",P=(k||R)&&T.length;return k?P===i||P===o:R?P===2*i||P===2*o:T instanceof f}function E(T,k,R=!0){if(_(T))throw new Error("first arg must be private key");if(!_(k))throw new Error("second arg must be public key");return f.fromHex(k).multiply(u(T)).toRawBytes(R)}let S=e.bits2int||function(T){let k=De(T),R=T.length*8-e.nBitLength;return R>0?k>>BigInt(R):k},L=e.bits2int_modN||function(T){return a(S(T))},D=ln(e.nBitLength);function z(T){if(typeof T!="bigint")throw new Error("bigint expected");if(!(Fe<=T&&T<D))throw new Error(`bigint expected < 2^${e.nBitLength}`);return je(T,e.nByteLength)}function q(T,k,R=M){if(["recovered","canonical"].some(mt=>mt in R))throw new Error("sign() legacy options not supported");let{hash:P,randomBytes:A}=e,{lowS:O,prehash:K,extraEntropy:V}=R;O==null&&(O=!0),T=bt("msgHash",T),K&&(T=bt("prehashed msgHash",P(T)));let Z=L(T),J=u(k),ot=[z(J),z(Z)];if(V!=null){let mt=V===!0?A(r.BYTES):V;ot.push(bt("extraEntropy",mt))}let j=Pe(...ot),rt=Z;function wt(mt){let Nt=S(mt);if(!p(Nt))return;let Ut=c(Nt),Bt=f.BASE.multiply(Nt).toAffine(),Ft=a(Bt.x);if(Ft===Fe)return;let Se=a(Ut*a(rt+Ft*J));if(Se===Fe)return;let or=(Bt.x===Ft?0:2)|Number(Bt.y&ee),Jr=Se;return O&&h(Se)&&(Jr=y(Se),or^=1),new x(Ft,Jr,or)}return{seed:j,k2sig:wt}}let M={lowS:e.lowS,prehash:!1},X={lowS:e.lowS,prehash:!1};function at(T,k,R=M){let{seed:P,k2sig:A}=q(T,k,R),O=e;return Ro(O.hash.outputLen,O.nByteLength,O.hmac)(P,A)}f.BASE._setWindowSize(8);function kt(T,k,R,P=X){let A=T;if(k=bt("msgHash",k),R=bt("publicKey",R),"strict"in P)throw new Error("options.strict was renamed to lowS");let{lowS:O,prehash:K}=P,V,Z;try{if(typeof A=="string"||ae(A))try{V=x.fromDER(A)}catch(Bt){if(!(Bt instanceof wr.Err))throw Bt;V=x.fromCompact(A)}else if(typeof A=="object"&&typeof A.r=="bigint"&&typeof A.s=="bigint"){let{r:Bt,s:Ft}=A;V=new x(Bt,Ft)}else throw new Error("PARSE");Z=f.fromHex(R)}catch(Bt){if(Bt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(O&&V.hasHighS())return!1;K&&(k=e.hash(k));let{r:J,s:ot}=V,j=L(k),rt=c(ot),wt=a(j*rt),mt=a(J*rt),Nt=f.BASE.multiplyAndAddUnsafe(Z,wt,mt)?.toAffine();return Nt?a(Nt.x)===J:!1}return{CURVE:e,getPublicKey:b,getSharedSecret:E,sign:at,verify:kt,ProjectivePoint:f,Signature:x,utils:m}}var hi=class extends Nr{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,K0(e);let n=un(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,o=new Uint8Array(i);o.set(n.length>i?e.create().update(n).digest():n);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=e.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),o.fill(0)}update(e){return kr(this),this.iHash.update(e),this}digestInto(e){kr(this),So(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:n,finished:i,destroyed:o,blockLen:s,outputLen:a}=this;return e=e,e.finished=i,e.destroyed=o,e.blockLen=s,e.outputLen=a,e.oHash=r._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},ss=(t,e,r)=>new hi(t,e).update(r).digest();ss.create=(t,e)=>new hi(t,e);function h1(t){return{hash:t,hmac:(e,...r)=>ss(t,e,Qn(...r)),randomBytes:Ur}}function Uf(t,e){let r=n=>Nf({...t,...h1(n)});return Object.freeze({...r(e),create:r})}var Ff=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Of=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),d1=BigInt(1),as=BigInt(2),Kf=(t,e)=>(t+e/as)/e;function p1(t){let e=Ff,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),c=BigInt(88),f=t*t*t%e,u=f*f*t%e,l=xt(u,r,e)*u%e,p=xt(l,r,e)*u%e,d=xt(p,as,e)*f%e,h=xt(d,i,e)*d%e,y=xt(h,o,e)*h%e,g=xt(y,a,e)*y%e,x=xt(g,c,e)*g%e,m=xt(x,a,e)*y%e,b=xt(m,r,e)*u%e,_=xt(b,s,e)*h%e,E=xt(_,n,e)*f%e,S=xt(E,as,e);if(!fs.eql(fs.sqr(S),t))throw new Error("Cannot find square root");return S}var fs=ri(Ff,void 0,void 0,{sqrt:p1}),de=Uf({a:BigInt(0),b:BigInt(7),Fp:fs,n:Of,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=Of,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-d1*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),a=Kf(o*t,e),c=Kf(-n*t,e),f=ut(t-a*r-c*i,e),u=ut(-a*n-c*o,e),l=f>s,p=u>s;if(l&&(f=e-f),p&&(u=e-u),f>s||u>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:f,k2neg:p,k2:u}}}},Pf),$v=BigInt(0);var Gv=de.ProjectivePoint;function Mf(){return de.utils.randomPrivateKey()}function Vf(t,e){let r=Ot.digest(e instanceof Uint8Array?e:e.subarray());if(te(r))return r.then(({digest:n})=>de.sign(n,t).toDERRawBytes()).catch(n=>{throw new $(String(n),"ERR_INVALID_INPUT")});try{return de.sign(r.digest,t).toDERRawBytes()}catch(n){throw new $(String(n),"ERR_INVALID_INPUT")}}function qf(t,e,r){let n=Ot.digest(r instanceof Uint8Array?r:r.subarray());if(te(n))return n.then(({digest:i})=>de.verify(e,i,t)).catch(i=>{throw new $(String(i),"ERR_INVALID_INPUT")});try{return de.verify(e,n.digest,t)}catch(i){throw new $(String(i),"ERR_INVALID_INPUT")}}function zf(t){return de.ProjectivePoint.fromHex(t).toRawBytes(!0)}function Hf(t){try{de.getPublicKey(t,!0)}catch(e){throw new $(String(e),"ERR_INVALID_PRIVATE_KEY")}}function cs(t){try{de.ProjectivePoint.fromHex(t)}catch(e){throw new $(String(e),"ERR_INVALID_PUBLIC_KEY")}}function $f(t){try{return de.getPublicKey(t,!0)}catch(e){throw new $(String(e),"ERR_INVALID_PRIVATE_KEY")}}var wn=class{_key;constructor(e){cs(e),this._key=e}verify(e,r){return qf(this._key,r,e)}marshal(){return zf(this._key)}get bytes(){return Ue.encode({Type:Pt.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return Kt(this.bytes,e.bytes)}async hash(){let e=Ot.digest(this.bytes),r;return te(e)?{bytes:r}=await e:r=e.bytes,r}},En=class{_key;_publicKey;constructor(e,r){this._key=e,this._publicKey=r??$f(e),Hf(this._key),cs(this._publicKey)}sign(e){return Vf(this._key,e)}get public(){return new wn(this._publicKey)}marshal(){return this._key}get bytes(){return Oe.encode({Type:Pt.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return Kt(this.bytes,e.bytes)}hash(){let e=Ot.digest(this.bytes);return te(e)?e.then(({bytes:r})=>r):e.bytes}async id(){let e=await this.public.hash();return lt(e,"base58btc")}async export(e,r="libp2p-key"){if(r==="libp2p-key")return Mr(this.bytes,e);throw new $(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}};function g1(t){return new En(t)}function x1(t){return new wn(t)}async function m1(){let t=Mf();return new En(t)}var Gf={rsa:is,ed25519:jo,secp256k1:us};function b1(t){let e=Object.keys(Gf).join(" / ");return new $(`invalid or unsupported key type ${t}. Must be ${e}`,"ERR_UNSUPPORTED_KEY_TYPE")}function ls(t){if(t=t.toLowerCase(),t==="rsa"||t==="ed25519"||t==="secp256k1")return Gf[t];throw b1(t)}async function Wf(t,e){return ls(t).generateKeyPair(e??2048)}function Yf(t,e){return e=(e??"rsa").toLowerCase(),ls(e),t.bytes}function Zf(t,e){return e=(e??"rsa").toLowerCase(),ls(e),t.bytes}var hs;(function(t){let e;t.codec=()=>(e==null&&(e=he((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.id!=null&&(n.uint32(10),n.bytes(r.id)),r.pubKey!=null&&(n.uint32(18),n.bytes(r.pubKey)),r.privKey!=null&&(n.uint32(26),n.bytes(r.privKey)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},o=n==null?r.len:r.pos+n;for(;r.pos<o;){let s=r.uint32();switch(s>>>3){case 1:i.id=r.bytes();break;case 2:i.pubKey=r.bytes();break;case 3:i.privKey=r.bytes();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>le(r,t.codec()),t.decode=r=>ue(r,t.codec())})(hs||(hs={}));var Qf=async()=>{let t=await Wf("Ed25519"),e=await w1(t);if(e.type==="Ed25519")return e;throw new Error(`Generated unexpected PeerId type "${e.type}"`)};async function w1(t){return ga(Yf(t.public),Zf(t))}var E1=Math.pow(2,7),S1=Math.pow(2,14),B1=Math.pow(2,21),ds=Math.pow(2,28),ps=Math.pow(2,35),ys=Math.pow(2,42),gs=Math.pow(2,49),it=128,zt=127;function Zt(t){if(t<E1)return 1;if(t<S1)return 2;if(t<B1)return 3;if(t<ds)return 4;if(t<ps)return 5;if(t<ys)return 6;if(t<gs)return 7;if(Number.MAX_SAFE_INTEGER!=null&&t>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function A1(t,e,r=0){switch(Zt(t)){case 8:e[r++]=t&255|it,t/=128;case 7:e[r++]=t&255|it,t/=128;case 6:e[r++]=t&255|it,t/=128;case 5:e[r++]=t&255|it,t/=128;case 4:e[r++]=t&255|it,t>>>=7;case 3:e[r++]=t&255|it,t>>>=7;case 2:e[r++]=t&255|it,t>>>=7;case 1:{e[r++]=t&255,t>>>=7;break}default:throw new Error("unreachable")}return e}function I1(t,e,r=0){switch(Zt(t)){case 8:e.set(r++,t&255|it),t/=128;case 7:e.set(r++,t&255|it),t/=128;case 6:e.set(r++,t&255|it),t/=128;case 5:e.set(r++,t&255|it),t/=128;case 4:e.set(r++,t&255|it),t>>>=7;case 3:e.set(r++,t&255|it),t>>>=7;case 2:e.set(r++,t&255|it),t>>>=7;case 1:{e.set(r++,t&255),t>>>=7;break}default:throw new Error("unreachable")}return e}function T1(t,e){let r=t[e],n=0;if(n+=r&zt,r<it||(r=t[e+1],n+=(r&zt)<<7,r<it)||(r=t[e+2],n+=(r&zt)<<14,r<it)||(r=t[e+3],n+=(r&zt)<<21,r<it)||(r=t[e+4],n+=(r&zt)*ds,r<it)||(r=t[e+5],n+=(r&zt)*ps,r<it)||(r=t[e+6],n+=(r&zt)*ys,r<it)||(r=t[e+7],n+=(r&zt)*gs,r<it))return n;throw new RangeError("Could not decode varint")}function C1(t,e){let r=t.get(e),n=0;if(n+=r&zt,r<it||(r=t.get(e+1),n+=(r&zt)<<7,r<it)||(r=t.get(e+2),n+=(r&zt)<<14,r<it)||(r=t.get(e+3),n+=(r&zt)<<21,r<it)||(r=t.get(e+4),n+=(r&zt)*ds,r<it)||(r=t.get(e+5),n+=(r&zt)*ps,r<it)||(r=t.get(e+6),n+=(r&zt)*ys,r<it)||(r=t.get(e+7),n+=(r&zt)*gs,r<it))return n;throw new RangeError("Could not decode varint")}function nr(t,e,r=0){return e==null&&(e=Vt(Zt(t))),e instanceof Uint8Array?A1(t,e,r):I1(t,e,r)}function Me(t,e=0){return t instanceof Uint8Array?T1(t,e):C1(t,e)}var pi=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let r=this.index,n=e();return n===void 0&&(this.index=r),n}parseWith(e){let r=e();if(this.index===this.input.length)return r}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let r=this.readChar();if(r===e)return r})}readSeparator(e,r,n){return this.readAtomically(()=>{if(!(r>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,r,n,i){return this.readAtomically(()=>{let o=0,s=0,a=this.peekChar();if(a===void 0)return;let c=a==="0",f=2**(8*i)-1;for(;;){let u=this.readAtomically(()=>{let l=this.readChar();if(l===void 0)return;let p=Number.parseInt(l,e);if(!Number.isNaN(p))return p});if(u===void 0)break;if(o*=e,o+=u,o>f||(s+=1,r!==void 0&&s>r))return}if(s!==0)return!n&&c&&s>1?void 0:o})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let r=0;r<e.length;r++){let n=this.readSeparator(".",r,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[r]=n}return e})}readIPv6Addr(){let e=r=>{for(let n=0;n<r.length/2;n++){let i=n*2;if(n<r.length-3){let s=this.readSeparator(":",n,()=>this.readIPv4Addr());if(s!==void 0)return r[i]=s[0],r[i+1]=s[1],r[i+2]=s[2],r[i+3]=s[3],[i+4,!0]}let o=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(o===void 0)return[i,!1];r[i]=o>>8,r[i+1]=o&255}return[r.length,!1]};return this.readAtomically(()=>{let r=new Uint8Array(16),[n,i]=e(r);if(n===16)return r;if(i||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let o=new Uint8Array(14),s=16-(n+2),[a]=e(o.subarray(0,s));return r.set(o.subarray(0,a),16-a),r})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Xf=45,_1=15,$r=new pi;function xs(t){if(!(t.length>_1))return $r.new(t).parseWith(()=>$r.readIPv4Addr())}function ms(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>Xf))return $r.new(t).parseWith(()=>$r.readIPv6Addr())}function yi(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>Xf))return $r.new(t).parseWith(()=>$r.readIPAddr())}var kb=parseInt("0xFFFF",16),Nb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function tc(t){return!!xs(t)}function ec(t){return!!ms(t)}function Gr(t){return!!yi(t)}var rc=tc,k1=ec,vs=function(t){let e=0;if(t=t.toString().trim(),rc(t)){let r=new Uint8Array(e+4);return t.split(/\./g).forEach(n=>{r[e++]=parseInt(n,10)&255}),r}if(k1(t)){let r=t.split(":",8),n;for(n=0;n<r.length;n++){let o=rc(r[n]),s;o&&(s=vs(r[n]),r[n]=lt(s.slice(0,2),"base16")),s!=null&&++n<8&&r.splice(n,0,lt(s.slice(2,4),"base16"))}if(r[0]==="")for(;r.length<8;)r.unshift("0");else if(r[r.length-1]==="")for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&r[n]!=="";n++);let o=[n,1];for(n=9-r.length;n>0;n--)o.push("0");r.splice.apply(r,o)}let i=new Uint8Array(e+16);for(n=0;n<r.length;n++){let o=parseInt(r[n],16);i[e++]=o>>8&255,i[e++]=o&255}return i}throw new Error("invalid ip address")},nc=function(t,e=0,r){e=~~e,r=r??t.length-e;let n=new DataView(t.buffer);if(r===4){let i=[];for(let o=0;o<r;o++)i.push(t[e+o]);return i.join(".")}if(r===16){let i=[];for(let o=0;o<r;o+=2)i.push(n.getUint16(e+o).toString(16));return i.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Wr={},bs={},U1=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[449,-1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]];U1.forEach(t=>{let e=O1(...t);bs[e.code]=e,Wr[e.name]=e});function O1(t,e,r,n,i){return{code:t,size:e,name:r,resolvable:!!n,path:!!i}}function st(t){if(typeof t=="number"){if(bs[t]!=null)return bs[t];throw new Error(`no protocol with code: ${t}`)}else if(typeof t=="string"){if(Wr[t]!=null)return Wr[t];throw new Error(`no protocol with name: ${t}`)}throw new Error(`invalid protocol id type: ${typeof t}`)}var m4=st("ip4"),v4=st("ip6"),b4=st("ipcidr");function Es(t,e){switch(st(t).code){case 4:case 41:return F1(e);case 42:return sc(e);case 6:case 273:case 33:case 132:return fc(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return sc(e);case 421:return z1(e);case 444:return ac(e);case 445:return ac(e);case 466:return q1(e);default:return lt(e,"base16")}}function Ss(t,e){switch(st(t).code){case 4:return ic(e);case 41:return ic(e);case 42:return oc(e);case 6:case 273:case 33:case 132:return Bs(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return oc(e);case 421:return M1(e);case 444:return H1(e);case 445:return $1(e);case 466:return V1(e);default:return It(e,"base16")}}var ws=Object.values(He).map(t=>t.decoder),K1=function(){let t=ws[0].or(ws[1]);return ws.slice(2).forEach(e=>t=t.or(e)),t}();function ic(t){if(!Gr(t))throw new Error("invalid ip address");return vs(t)}function F1(t){let e=nc(t,0,t.length);if(e==null)throw new Error("ipBuff is required");if(!Gr(e))throw new Error("invalid ip address");return e}function Bs(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t),new Uint8Array(e)}function fc(t){return new DataView(t.buffer).getUint16(t.byteOffset)}function oc(t){let e=It(t),r=Uint8Array.from(nr(e.length));return Tt([r,e],r.length+e.length)}function sc(t){let e=Me(t);if(t=t.slice(Zt(e)),t.length!==e)throw new Error("inconsistent lengths");return lt(t)}function M1(t){let e;t[0]==="Q"||t[0]==="1"?e=sr(At.decode(`z${t}`)).bytes:e=re.parse(t).multihash.bytes;let r=Uint8Array.from(nr(e.length));return Tt([r,e],r.length+e.length)}function V1(t){let e=K1.decode(t),r=Uint8Array.from(nr(e.length));return Tt([r,e],r.length+e.length)}function q1(t){let e=Me(t),r=t.slice(Zt(e));if(r.length!==e)throw new Error("inconsistent lengths");return"u"+lt(r,"base64url")}function z1(t){let e=Me(t),r=t.slice(Zt(e));if(r.length!==e)throw new Error("inconsistent lengths");return lt(r,"base58btc")}function H1(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let r=Ae.decode("b"+e[0]),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let i=Bs(n);return Tt([r,i],r.length+i.length)}function $1(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let r=Ae.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let i=Bs(n);return Tt([r,i],r.length+i.length)}function ac(t){let e=t.slice(0,t.length-2),r=t.slice(t.length-2),n=lt(e,"base32"),i=fc(r);return`${n}:${i}`}function cc(t){t=As(t);let e=[],r=[],n=null,i=t.split("/").slice(1);if(i.length===1&&i[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let o=0;o<i.length;o++){let s=i[o],a=st(s);if(a.size===0){e.push([a.code]),r.push([a.code]);continue}if(o++,o>=i.length)throw lc("invalid address: "+t);if(a.path===!0){n=As(i.slice(o).join("/")),e.push([a.code,Ss(a.code,n)]),r.push([a.code,n]);break}let c=Ss(a.code,i[o]);e.push([a.code,c]),r.push([a.code,Es(a.code,c)])}return{string:uc(r),bytes:Ts(e),tuples:e,stringTuples:r,path:n}}function Is(t){let e=[],r=[],n=null,i=0;for(;i<t.length;){let o=Me(t,i),s=Zt(o),a=st(o),c=G1(a,t.slice(i+s));if(c===0){e.push([o]),r.push([o]),i+=s;continue}let f=t.slice(i+s,i+s+c);if(i+=c+s,i>t.length)throw lc("Invalid address Uint8Array: "+lt(t,"base16"));e.push([o,f]);let u=Es(o,f);if(r.push([o,u]),a.path===!0){n=u;break}}return{bytes:Uint8Array.from(t),string:uc(r),tuples:e,stringTuples:r,path:n}}function uc(t){let e=[];return t.map(r=>{let n=st(r[0]);return e.push(n.name),r.length>1&&r[1]!=null&&e.push(r[1]),null}),As(e.join("/"))}function Ts(t){return Tt(t.map(e=>{let r=st(e[0]),n=Uint8Array.from(nr(r.code));return e.length>1&&e[1]!=null&&(n=Tt([n,e[1]])),n}))}function G1(t,e){if(t.size>0)return t.size/8;if(t.size===0)return 0;{let r=Me(e instanceof Uint8Array?e:Uint8Array.from(e));return r+Zt(r)}}function As(t){return"/"+t.trim().split("/").filter(e=>e).join("/")}function lc(t){return new Error("Error parsing address: "+t)}var W1=Symbol.for("nodejs.util.inspect.custom"),Cs=Symbol.for("@multiformats/js-multiaddr/multiaddr"),Y1=[st("dns").code,st("dns4").code,st("dns6").code,st("dnsaddr").code],gi=class t{bytes;#e;#t;#r;#n;[Cs]=!0;constructor(e){e==null&&(e="");let r;if(e instanceof Uint8Array)r=Is(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);r=cc(e)}else if(dc(e))r=Is(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=r.bytes,this.#e=r.string,this.#t=r.tuples,this.#r=r.stringTuples,this.#n=r.path}toString(){return this.#e}toJSON(){return this.toString()}toOptions(){let e,r,n,i,o="",s=st("tcp"),a=st("udp"),c=st("ip4"),f=st("ip6"),u=st("dns6"),l=st("ip6zone");for(let[d,h]of this.stringTuples())d===l.code&&(o=`%${h??""}`),Y1.includes(d)&&(r=s.name,i=443,n=`${h??""}${o}`,e=d===u.code?6:4),(d===s.code||d===a.code)&&(r=st(d).name,i=parseInt(h??"")),(d===c.code||d===f.code)&&(r=st(d).name,n=`${h??""}${o}`,e=d===f.code?6:4);if(e==null||r==null||n==null||i==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:r,port:i}}protos(){return this.#t.map(([e])=>Object.assign({},st(e)))}protoCodes(){return this.#t.map(([e])=>e)}protoNames(){return this.#t.map(([e])=>st(e).name)}tuples(){return this.#t}stringTuples(){return this.#r}encapsulate(e){return e=new t(e),new t(this.toString()+e.toString())}decapsulate(e){let r=e.toString(),n=this.toString(),i=n.lastIndexOf(r);if(i<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new t(n.slice(0,i))}decapsulateCode(e){let r=this.tuples();for(let n=r.length-1;n>=0;n--)if(r[n][0]===e)return new t(Ts(r.slice(0,n)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([n,i])=>{n===Wr.p2p.code&&e.push([n,i]),n===Wr["p2p-circuit"].code&&(e=[])});let r=e.pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?lt(At.decode(`z${n}`),"base58btc"):lt(re.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(e){return Kt(this.bytes,e.bytes)}async resolve(e){let r=this.protos().find(o=>o.resolvable);if(r==null)return[this];let n=hc.get(r.name);if(n==null)throw new $(`no available resolver for ${r.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(o=>new t(o))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let r=(e??this).protos();return!(r.length!==2||r[0].code!==4&&r[0].code!==41||r[1].code!==6&&r[1].code!==273)}[W1](){return`Multiaddr(${this.#e})`}};var hc=new Map;function dc(t){return!!t?.[Cs]}function xi(t){return new gi(t)}function Z1(t){return t[Symbol.asyncIterator]!=null}function Q1(t){if(Z1(t))return(async()=>{for await(let e of t)return e})();for(let e of t)return e}var _s=Q1;var yc=Symbol.for("@achingbrain/uint8arraylist");function pc(t,e){if(e==null||e<0)throw new RangeError("index is out of bounds");let r=0;for(let n of t){let i=r+n.byteLength;if(e<i)return{buf:n,index:e-r};r=i}throw new RangeError("index is out of bounds")}function mi(t){return!!t?.[yc]}var Yr=class t{bufs;length;[yc]=!0;constructor(...e){this.bufs=[],this.length=0,e.length>0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let r=0;for(let n of e)if(n instanceof Uint8Array)r+=n.byteLength,this.bufs.push(n);else if(mi(n))r+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=r}prepend(...e){this.prependAll(e)}prependAll(e){let r=0;for(let n of e.reverse())if(n instanceof Uint8Array)r+=n.byteLength,this.bufs.unshift(n);else if(mi(n))r+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=r}get(e){let r=pc(this.bufs,e);return r.buf[r.index]}set(e,r){let n=pc(this.bufs,e);n.buf[n.index]=r}write(e,r=0){if(e instanceof Uint8Array)for(let n=0;n<e.length;n++)this.set(r+n,e[n]);else if(mi(e))for(let n=0;n<e.length;n++)this.set(r+n,e.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,r){let{bufs:n,length:i}=this._subList(e,r);return Tt(n,i)}subarray(e,r){let{bufs:n,length:i}=this._subList(e,r);return n.length===1?n[0]:Tt(n,i)}sublist(e,r){let{bufs:n,length:i}=this._subList(e,r),o=new t;return o.length=i,o.bufs=[...n],o}_subList(e,r){if(e=e??0,r=r??this.length,e<0&&(e=this.length+e),r<0&&(r=this.length+r),e<0||r>this.length)throw new RangeError("index is out of bounds");if(e===r)return{bufs:[],length:0};if(e===0&&r===this.length)return{bufs:this.bufs,length:this.length};let n=[],i=0;for(let o=0;o<this.bufs.length;o++){let s=this.bufs[o],a=i,c=a+s.byteLength;if(i=c,e>=c)continue;let f=e>=a&&e<c,u=r>a&&r<=c;if(f&&u){if(e===a&&r===c){n.push(s);break}let l=e-a;n.push(s.subarray(l,l+(r-e)));break}if(f){if(e===0){n.push(s);continue}n.push(s.subarray(e-a));continue}if(u){if(r===c){n.push(s);break}n.push(s.subarray(0,r-a));break}n.push(s)}return{bufs:n,length:r-e}}indexOf(e,r=0){if(!mi(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(r=Number(r??0),isNaN(r)&&(r=0),r<0&&(r=this.length+r),r<0&&(r=0),e.length===0)return r>this.length?this.length:r;let i=n.byteLength;if(i===0)throw new TypeError("search must be at least 1 byte long");let o=256,s=new Int32Array(o);for(let l=0;l<o;l++)s[l]=-1;for(let l=0;l<i;l++)s[n[l]]=l;let a=s,c=this.byteLength-n.byteLength,f=n.byteLength-1,u;for(let l=r;l<=c;l+=u){u=0;for(let p=f;p>=0;p--){let d=this.get(l+p);if(n[p]!==d){u=Math.max(1,p-a[d]);break}}if(u===0)return l}return-1}getInt8(e){let r=this.subarray(e,e+1);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt8(0)}setInt8(e,r){let n=Vt(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,r),this.write(n,e)}getInt16(e,r){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,r)}setInt16(e,r,n){let i=_e(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,r,n),this.write(i,e)}getInt32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,r)}setInt32(e,r,n){let i=_e(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,r,n),this.write(i,e)}getBigInt64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,r)}setBigInt64(e,r,n){let i=_e(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,r,n),this.write(i,e)}getUint8(e){let r=this.subarray(e,e+1);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint8(0)}setUint8(e,r){let n=Vt(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,r),this.write(n,e)}getUint16(e,r){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,r)}setUint16(e,r,n){let i=_e(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,r,n),this.write(i,e)}getUint32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,r)}setUint32(e,r,n){let i=_e(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,r,n),this.write(i,e)}getBigUint64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,r)}setBigUint64(e,r,n){let i=_e(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,r,n),this.write(i,e)}getFloat32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,r)}setFloat32(e,r,n){let i=_e(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,r,n),this.write(i,e)}getFloat64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,r)}setFloat64(e,r,n){let i=_e(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,r,n),this.write(i,e)}equals(e){if(e==null||!(e instanceof t)||e.bufs.length!==this.bufs.length)return!1;for(let r=0;r<this.bufs.length;r++)if(!Kt(this.bufs[r],e.bufs[r]))return!1;return!0}static fromUint8Arrays(e,r){let n=new t;return n.bufs=e,r==null&&(r=e.reduce((i,o)=>i+o.byteLength,0)),n.length=r,n}};function vi(t){return t[Symbol.asyncIterator]!=null}var bi=t=>{let e=Zt(t),r=Vt(e);return nr(t,r),bi.bytes=e,r};bi.bytes=0;function Sn(t,e){e=e??{};let r=e.lengthEncoder??bi;function*n(i){let o=r(i.byteLength);o instanceof Uint8Array?yield o:yield*o,i instanceof Uint8Array?yield i:yield*i}return vi(t)?async function*(){for await(let i of t)yield*n(i)}():function*(){for(let i of t)yield*n(i)}()}Sn.single=(t,e)=>{e=e??{};let r=e.lengthEncoder??bi;return new Yr(r(t.byteLength),t)};var Zr=Mt(mc(),1);var J1=8,j1=1024*1024*4,Er;(function(t){t[t.LENGTH=0]="LENGTH",t[t.DATA=1]="DATA"})(Er||(Er={}));var Rs=t=>{let e=Me(t);return Rs.bytes=Zt(e),e};Rs.bytes=0;function Qr(t,e){let r=new Yr,n=Er.LENGTH,i=-1,o=e?.lengthDecoder??Rs,s=e?.maxLengthLength??J1,a=e?.maxDataLength??j1;function*c(){for(;r.byteLength>0;){if(n===Er.LENGTH)try{if(i=o(r),i<0)throw(0,Zr.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(i>a)throw(0,Zr.default)(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let f=o.bytes;r.consume(f),e?.onLength!=null&&e.onLength(i),n=Er.DATA}catch(f){if(f instanceof RangeError){if(r.byteLength>s)throw(0,Zr.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw f}if(n===Er.DATA){if(r.byteLength<i)break;let f=r.sublist(0,i);r.consume(i),e?.onData!=null&&e.onData(f),yield f,n=Er.LENGTH}}}return vi(t)?async function*(){for await(let f of t)r.append(f),yield*c();if(r.byteLength>0)throw(0,Zr.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}():function*(){for(let f of t)r.append(f),yield*c();if(r.byteLength>0)throw(0,Zr.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}Qr.fromReader=(t,e)=>{let r=1,n=async function*(){for(;;)try{let{done:o,value:s}=await t.next(r);if(o===!0)return;s!=null&&(yield s)}catch(o){if(o.code==="ERR_UNDER_READ")return{done:!0,value:null};throw o}finally{r=1}}();return Qr(n,{...e??{},onLength:o=>{r=o}})};function ey(t){let[e,r]=t[Symbol.asyncIterator]!=null?[t[Symbol.asyncIterator](),Symbol.asyncIterator]:[t[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>e.next(),push:i=>{n.push(i)},next:()=>n.length>0?{done:!1,value:n.shift()}:e.next(),[r](){return this}}}var vc=ey;function ry(t){return t[Symbol.asyncIterator]!=null}function ny(t,e){if(ry(t))return async function*(){for await(let a of t)yield e(a)}();let r=vc(t),{value:n,done:i}=r.next();if(i===!0)return function*(){}();let o=e(n);if(typeof o.then=="function")return async function*(){yield await o;for await(let a of r)yield e(a)}();let s=e;return function*(){yield o;for(let a of r)yield s(a)}()}var bc=ny;function Ve(){let t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}var wi=globalThis.CustomEvent??Event;async function*Ls(t,e={}){let r=e.concurrency??1/0;r<1&&(r=1/0);let n=e.ordered==null?!1:e.ordered,i=new EventTarget,o=[],s=Ve(),a=Ve(),c=!1,f,u=!1;i.addEventListener("task-complete",()=>{a.resolve()}),Promise.resolve().then(async()=>{try{for await(let h of t){if(o.length===r&&(s=Ve(),await s.promise),u)break;let y={done:!1};o.push(y),h().then(g=>{y.done=!0,y.ok=!0,y.value=g,i.dispatchEvent(new wi("task-complete"))},g=>{y.done=!0,y.err=g,i.dispatchEvent(new wi("task-complete"))})}c=!0,i.dispatchEvent(new wi("task-complete"))}catch(h){f=h,i.dispatchEvent(new wi("task-complete"))}});function l(){return n?o[0]?.done:!!o.find(h=>h.done)}function*p(){for(;o.length>0&&o[0].done;){let h=o[0];if(o.shift(),h.ok)yield h.value;else throw u=!0,s.resolve(),h.err;s.resolve()}}function*d(){for(;l();)for(let h=0;h<o.length;h++)if(o[h].done){let y=o[h];if(o.splice(h,1),h--,y.ok)yield y.value;else throw u=!0,s.resolve(),y.err;s.resolve()}}for(;;){if(l()||(a=Ve(),await a.promise),f!=null)throw f;if(n?yield*p():yield*d(),c&&o.length===0)break}}var Ei=class{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},Xr=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new Ei(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let r=this.head;this.head=r.next=new Ei(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let r=this.tail.next;this.tail.next=null,this.tail=r,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};var Ds=class extends Error{type;code;constructor(e,r){super(e??"The operation was aborted"),this.type="aborted",this.code=r??"ABORT_ERR"}};function Si(t={}){return iy(r=>{let n=r.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},t)}function iy(t,e){e=e??{};let r=e.onEnd,n=new Xr,i,o,s,a=Ve(),c=async()=>{try{return n.isEmpty()?s?{done:!0}:await new Promise((g,x)=>{o=m=>{o=null,n.push(m);try{g(t(n))}catch(b){x(b)}return i}}):t(n)}finally{n.isEmpty()&&queueMicrotask(()=>{a.resolve(),a=Ve()})}},f=g=>o!=null?o(g):(n.push(g),i),u=g=>(n=new Xr,o!=null?o({error:g}):(n.push({error:g}),i)),l=g=>{if(s)return i;if(e?.objectMode!==!0&&g?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return f({done:!1,value:g})},p=g=>s?i:(s=!0,g!=null?u(g):f({done:!0})),d=()=>(n=new Xr,p(),{done:!0}),h=g=>(p(g),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:c,return:d,throw:h,push:l,end:p,get readableLength(){return n.size},onEmpty:async g=>{let x=g?.signal;if(x?.throwIfAborted(),n.isEmpty())return;let m,b;x!=null&&(m=new Promise((_,E)=>{b=()=>{E(new Ds)},x.addEventListener("abort",b)}));try{await Promise.race([a.promise,m])}finally{b!=null&&x!=null&&x?.removeEventListener("abort",b)}}},r==null)return i;let y=i;return i={[Symbol.asyncIterator](){return this},next(){return y.next()},throw(g){return y.throw(g),r!=null&&(r(g),r=void 0),{done:!0}},return(){return y.return(),r!=null&&(r(),r=void 0),{done:!0}},push:l,end(g){return y.end(g),r!=null&&(r(g),r=void 0),i},get readableLength(){return y.readableLength},onEmpty:g=>y.onEmpty(g)},i}function oy(t){return t[Symbol.asyncIterator]!=null}function sy(...t){let e=[];for(let r of t)oy(r)||e.push(r);return e.length===t.length?function*(){for(let r of e)yield*r}():async function*(){let r=Si({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(t.map(async n=>{for await(let i of n)r.push(i)})),r.end()}catch(n){r.end(n)}}),yield*r}()}var wc=sy;function ks(t,...e){if(t==null)throw new Error("Empty pipeline");if(Ps(t)){let n=t;t=()=>n.source}else if(Sc(t)||Ec(t)){let n=t;t=()=>n}let r=[t,...e];if(r.length>1&&Ps(r[r.length-1])&&(r[r.length-1]=r[r.length-1].sink),r.length>2)for(let n=1;n<r.length-1;n++)Ps(r[n])&&(r[n]=fy(r[n]));return ay(...r)}var ay=(...t)=>{let e;for(;t.length>0;)e=t.shift()(e);return e},Ec=t=>t?.[Symbol.asyncIterator]!=null,Sc=t=>t?.[Symbol.iterator]!=null,Ps=t=>t==null?!1:t.sink!=null&&t.source!=null,fy=t=>e=>{let r=t.sink(e);if(r?.then!=null){let n=Si({objectMode:!0});r.then(()=>{n.end()},s=>{n.end(s)});let i,o=t.source;if(Ec(o))i=async function*(){yield*o,n.end()};else if(Sc(o))i=function*(){yield*o,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return wc(n,i())}return t.source};var Rc=Mt(Bc(),1);var Ac="[a-fA-F\\d:]",ir=t=>t&&t.includeBoundaries?`(?:(?<=\\s|^)(?=${Ac})|(?<=${Ac})(?=\\s|$))`:"",pe="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",St="[a-fA-F\\d]{1,4}",Bi=`
16
16
  (?:
17
17
  (?:${St}:){7}(?:${St}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
18
18
  (?:${St}:){6}(?:${pe}|:${St}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
@@ -23,7 +23,7 @@
23
23
  (?:${St}:){1}(?:(?::${St}){0,4}:${pe}|(?::${St}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
24
24
  (?::(?:(?::${St}){0,5}:${pe}|(?::${St}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
25
25
  )(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
26
- `.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),yy=new RegExp(`(?:^${pe}$)|(?:^${Ii}$)`),gy=new RegExp(`^${pe}$`),xy=new RegExp(`^${Ii}$`),Ks=t=>t&&t.exact?yy:new RegExp(`(?:${nr(t)}${pe}${nr(t)})|(?:${nr(t)}${Ii}${nr(t)})`,"g");Ks.v4=t=>t&&t.exact?gy:new RegExp(`${nr(t)}${pe}${nr(t)}`,"g");Ks.v6=t=>t&&t.exact?xy:new RegExp(`${nr(t)}${Ii}${nr(t)}`,"g");var Dc=Ks;var Oc=Kt(kc(),1),{isValid:my,parse:vy}=Oc.default,by=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"],wy=by.map(t=>new Uc.Netmask(t));function Ey(t){for(let e of wy)if(e.contains(t))return!0;return!1}function Nc(t){return/^::$/.test(t)||/^::1$/.test(t)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(t)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(t)||/^ff([0-9a-fA-F]{2,2}):/i.test(t)}var Kc=t=>{if(my(t)){let e=vy(t);if(e.kind()==="ipv4")return Ey(e.toNormalizedString());if(e.kind()==="ipv6")return Nc(t)}else if(Gr(t)&&Dc.v6().test(t))return Nc(t)};var Fs=Kc;var Fc="libp2p",Mc="autonat",Vc="1.0.0";var Y;(function(t){let e;(function(f){f.DIAL="DIAL",f.DIAL_RESPONSE="DIAL_RESPONSE"})(e=t.MessageType||(t.MessageType={}));let r;(function(f){f[f.DIAL=0]="DIAL",f[f.DIAL_RESPONSE=1]="DIAL_RESPONSE"})(r||(r={})),function(f){f.codec=()=>qr(r)}(e=t.MessageType||(t.MessageType={}));let n;(function(f){f.OK="OK",f.E_DIAL_ERROR="E_DIAL_ERROR",f.E_DIAL_REFUSED="E_DIAL_REFUSED",f.E_BAD_REQUEST="E_BAD_REQUEST",f.E_INTERNAL_ERROR="E_INTERNAL_ERROR"})(n=t.ResponseStatus||(t.ResponseStatus={}));let i;(function(f){f[f.OK=0]="OK",f[f.E_DIAL_ERROR=100]="E_DIAL_ERROR",f[f.E_DIAL_REFUSED=101]="E_DIAL_REFUSED",f[f.E_BAD_REQUEST=200]="E_BAD_REQUEST",f[f.E_INTERNAL_ERROR=300]="E_INTERNAL_ERROR"})(i||(i={})),function(f){f.codec=()=>qr(i)}(n=t.ResponseStatus||(t.ResponseStatus={}));let o;(function(f){let u;f.codec=()=>(u==null&&(u=he((l,p,d={})=>{if(d.lengthDelimited!==!1&&p.fork(),l.id!=null&&(p.uint32(10),p.bytes(l.id)),l.addrs!=null)for(let h of l.addrs)p.uint32(18),p.bytes(h);d.lengthDelimited!==!1&&p.ldelim()},(l,p)=>{let d={addrs:[]},h=p==null?l.len:l.pos+p;for(;l.pos<h;){let y=l.uint32();switch(y>>>3){case 1:d.id=l.bytes();break;case 2:d.addrs.push(l.bytes());break;default:l.skipType(y&7);break}}return d})),u),f.encode=l=>le(l,f.codec()),f.decode=l=>ue(l,f.codec())})(o=t.PeerInfo||(t.PeerInfo={}));let s;(function(f){let u;f.codec=()=>(u==null&&(u=he((l,p,d={})=>{d.lengthDelimited!==!1&&p.fork(),l.peer!=null&&(p.uint32(10),t.PeerInfo.codec().encode(l.peer,p)),d.lengthDelimited!==!1&&p.ldelim()},(l,p)=>{let d={},h=p==null?l.len:l.pos+p;for(;l.pos<h;){let y=l.uint32();switch(y>>>3){case 1:d.peer=t.PeerInfo.codec().decode(l,l.uint32());break;default:l.skipType(y&7);break}}return d})),u),f.encode=l=>le(l,f.codec()),f.decode=l=>ue(l,f.codec())})(s=t.Dial||(t.Dial={}));let a;(function(f){let u;f.codec=()=>(u==null&&(u=he((l,p,d={})=>{d.lengthDelimited!==!1&&p.fork(),l.status!=null&&(p.uint32(8),t.ResponseStatus.codec().encode(l.status,p)),l.statusText!=null&&(p.uint32(18),p.string(l.statusText)),l.addr!=null&&(p.uint32(26),p.bytes(l.addr)),d.lengthDelimited!==!1&&p.ldelim()},(l,p)=>{let d={},h=p==null?l.len:l.pos+p;for(;l.pos<h;){let y=l.uint32();switch(y>>>3){case 1:d.status=t.ResponseStatus.codec().decode(l);break;case 2:d.statusText=l.string();break;case 3:d.addr=l.bytes();break;default:l.skipType(y&7);break}}return d})),u),f.encode=l=>le(l,f.codec()),f.decode=l=>ue(l,f.codec())})(a=t.DialResponse||(t.DialResponse={}));let c;t.codec=()=>(c==null&&(c=he((f,u,l={})=>{l.lengthDelimited!==!1&&u.fork(),f.type!=null&&(u.uint32(8),t.MessageType.codec().encode(f.type,u)),f.dial!=null&&(u.uint32(18),t.Dial.codec().encode(f.dial,u)),f.dialResponse!=null&&(u.uint32(26),t.DialResponse.codec().encode(f.dialResponse,u)),l.lengthDelimited!==!1&&u.ldelim()},(f,u)=>{let l={},p=u==null?f.len:f.pos+u;for(;f.pos<p;){let d=f.uint32();switch(d>>>3){case 1:l.type=t.MessageType.codec().decode(f);break;case 2:l.dial=t.Dial.codec().decode(f,f.uint32());break;case 3:l.dialResponse=t.DialResponse.codec().decode(f,f.uint32());break;default:f.skipType(d&7);break}}return l})),c),t.encode=f=>le(f,t.codec()),t.decode=f=>ue(f,t.codec())})(Y||(Y={}));var Ms=4,Ci=class{components;startupDelay;refreshInterval;protocol;timeout;maxInboundStreams;maxOutboundStreams;verifyAddressTimeout;started;log;constructor(e,r){this.components=e,this.log=e.logger.forComponent("libp2p:autonat"),this.started=!1,this.protocol=`/${r.protocolPrefix??Fc}/${Mc}/${Vc}`,this.timeout=r.timeout??3e4,this.maxInboundStreams=r.maxInboundStreams??1,this.maxOutboundStreams=r.maxOutboundStreams??1,this.startupDelay=r.startupDelay??5e3,this.refreshInterval=r.refreshInterval??6e4,this._verifyExternalAddresses=this._verifyExternalAddresses.bind(this)}isStarted(){return this.started}async start(){this.started||(await this.components.registrar.handle(this.protocol,e=>{this.handleIncomingAutonatStream(e).catch(r=>{this.log.error("error handling incoming autonat stream",r)})},{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams}),this.verifyAddressTimeout=setTimeout(this._verifyExternalAddresses,this.startupDelay),this.started=!0)}async stop(){await this.components.registrar.unhandle(this.protocol),clearTimeout(this.verifyAddressTimeout),this.started=!1}async handleIncomingAutonatStream(e){let r=AbortSignal.timeout(this.timeout),n=()=>{e.stream.abort(new $("handleIncomingAutonatStream timeout",Ri))};r.addEventListener("abort",n,{once:!0}),Di(1/0,r);let i=this.components.addressManager.getAddresses().map(o=>o.toOptions().host);try{let o=this;await Os(e.stream,s=>Qr(s),async function*(s){let a=await Ls(s);if(a==null){o.log("no message received"),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"No message was sent"}});return}let c;try{c=Y.decode(a)}catch(y){o.log.error("could not decode message",y),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"Could not decode message"}});return}let f=c.dial;if(f==null){o.log.error("dial was missing from message"),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"No Dial message found in message"}});return}let u,l=f.peer;if(l==null||l.id==null){o.log.error("PeerId missing from message"),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"missing peer info"}});return}try{u=Rn(l.id)}catch(y){o.log.error("invalid PeerId",y),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"bad peer id"}});return}if(o.log("incoming request from %p",u),!e.connection.remotePeer.equals(u)){o.log("target peer %p did not equal sending peer %p",u,e.connection.remotePeer),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"peer id mismatch"}});return}let p=l.addrs.map(y=>vi(y)).filter(y=>{let g=y.toOptions().host===e.connection.remoteAddr.toOptions().host;return o.log.trace("request to dial %a was sent from %a is same host %s",y,e.connection.remoteAddr,g),g}).filter(y=>{let g=y.toOptions().host,x=!(Fs(g)??!1);return o.log.trace("host %s was public %s",g,x),x}).filter(y=>{let g=y.toOptions().host,x=!i.includes(g);return o.log.trace("host %s was not our host %s",g,x),x}).filter(y=>{let g=!!o.components.transportManager.transportForMultiaddr(y);return o.log.trace("transport for %a is supported %s",y,g),g}).map(y=>(y.getPeerId()==null&&(y=y.encapsulate(`/p2p/${u.toString()}`)),y));if(p.length===0){o.log("no valid multiaddrs for %p in message",u),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_DIAL_REFUSED,statusText:"no dialable addresses"}});return}o.log("dial multiaddrs %s for peer %p",p.map(y=>y.toString()).join(", "),u);let d="",h=p[0];for await(let y of p){let g;h=y;try{if(g=await o.components.connectionManager.openConnection(y,{signal:r}),!g.remoteAddr.equals(y))throw o.log.error("tried to dial %a but dialed %a",y,g.remoteAddr),new Error("Unexpected remote address");o.log("Success %p",u),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.OK,addr:g.remoteAddr.decapsulateCode(st("p2p").code).bytes}});return}catch(x){o.log("could not dial %p",u,x),d=x.message}finally{g!=null&&await g.close()}}yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_DIAL_ERROR,statusText:d,addr:h.bytes}})},s=>An(s),e.stream)}catch(o){this.log.error("error handling incoming autonat stream",o)}finally{r.removeEventListener("abort",n)}}_verifyExternalAddresses(){this.verifyExternalAddresses().catch(e=>{this.log.error("error verifying external address",e)})}async verifyExternalAddresses(){if(clearTimeout(this.verifyAddressTimeout),!this.isStarted())return;let e=this.components.addressManager,r=e.getObservedAddrs().filter(o=>{let s=o.toOptions();return!(Fs(s.host)??!1)});if(r.length===0){this.log("no public addresses found, not requesting verification"),this.verifyAddressTimeout=setTimeout(this._verifyExternalAddresses,this.refreshInterval);return}let n=AbortSignal.timeout(this.timeout);Di(1/0,n);let i=this;try{this.log("verify multiaddrs %s",r.map(l=>l.toString()).join(", "));let o=Y.encode({type:Y.MessageType.DIAL,dial:{peer:{id:this.components.peerId.toBytes(),addrs:r.map(l=>l.bytes)}}}),a=(await jf()).toBytes(),c={},f=[],u=async l=>{let p=()=>{};try{this.log("asking %p to verify multiaddr",l.id);let d=await i.components.connectionManager.openConnection(l.id,{signal:n}),h=await d.newStream(this.protocol,{signal:n});p=()=>{h.abort(new $("verifyAddress timeout",Ri))},n.addEventListener("abort",p,{once:!0});let y=await Os([o],x=>An(x),h,x=>Qr(x),async x=>Ls(x));if(y==null){this.log("no response received from %p",d.remotePeer);return}let g=Y.decode(y);if(g.type!==Y.MessageType.DIAL_RESPONSE||g.dialResponse==null){this.log("invalid autonat response from %p",d.remotePeer);return}if(g.dialResponse.status===Y.ResponseStatus.OK){let x=d.remoteAddr.toOptions(),m;if(x.family===4)m=x.host.split(".")[0];else if(x.family===6)m=x.host.split(":")[0];else{this.log('remote address "%s" was not IP4 or IP6?',x.host);return}if(f.includes(m)){this.log("already have response from network segment %d - %s",m,x.host);return}f.push(m)}return g.dialResponse}catch(d){this.log.error("error asking remote to verify multiaddr",d)}finally{n.removeEventListener("abort",p)}};for await(let l of ks(Ic(this.components.peerRouting.getClosestPeers(a,{signal:n}),p=>async()=>u(p)),{concurrency:Ms}))try{if(l==null)continue;let p=l.addr==null?r[0]:vi(l.addr);if(this.log("autonat response for %a is %s",p,l.status),l.status===Y.ResponseStatus.E_BAD_REQUEST||l.status===Y.ResponseStatus.E_DIAL_REFUSED||l.addr==null&&r.length>1)continue;if(!r.some(h=>h.equals(p))){this.log("peer reported %a as %s but it was not in our observed address list",p,l.status);continue}let d=p.toString();if(c[d]==null&&(c[d]={success:0,failure:0}),l.status===Y.ResponseStatus.OK?c[d].success++:l.status===Y.ResponseStatus.E_DIAL_ERROR&&c[d].failure++,c[d].success===Ms){this.log("%a is externally dialable",p),e.confirmObservedAddr(p);return}if(c[d].failure===Ms){this.log("%a is not externally dialable",p),e.removeObservedAddr(p);return}}catch(p){this.log.error("could not verify external address",p)}}finally{this.verifyAddressTimeout=setTimeout(this._verifyExternalAddresses,this.refreshInterval)}}};function Cy(t={}){return e=>new Ci(e,t)}return eu(_y);})();
26
+ `.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),cy=new RegExp(`(?:^${pe}$)|(?:^${Bi}$)`),uy=new RegExp(`^${pe}$`),ly=new RegExp(`^${Bi}$`),Ns=t=>t&&t.exact?cy:new RegExp(`(?:${ir(t)}${pe}${ir(t)})|(?:${ir(t)}${Bi}${ir(t)})`,"g");Ns.v4=t=>t&&t.exact?uy:new RegExp(`${ir(t)}${pe}${ir(t)}`,"g");Ns.v6=t=>t&&t.exact?ly:new RegExp(`${ir(t)}${Bi}${ir(t)}`,"g");var Ic=Ns;var Lc=Mt(Cc(),1),{isValid:hy,parse:dy}=Lc.default,py=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"],yy=py.map(t=>new Rc.Netmask(t));function gy(t){for(let e of yy)if(e.contains(t))return!0;return!1}function _c(t){return/^::$/.test(t)||/^::1$/.test(t)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(t)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(t)||/^ff([0-9a-fA-F]{2,2}):/i.test(t)}var Dc=t=>{if(hy(t)){let e=dy(t);if(e.kind()==="ipv4")return gy(e.toNormalizedString());if(e.kind()==="ipv6")return _c(t)}else if(Gr(t)&&Ic.v6().test(t))return _c(t)};var Us=Dc;var Pc="libp2p",kc="autonat",Nc="1.0.0";var Y;(function(t){let e;(function(f){f.DIAL="DIAL",f.DIAL_RESPONSE="DIAL_RESPONSE"})(e=t.MessageType||(t.MessageType={}));let r;(function(f){f[f.DIAL=0]="DIAL",f[f.DIAL_RESPONSE=1]="DIAL_RESPONSE"})(r||(r={})),function(f){f.codec=()=>qr(r)}(e=t.MessageType||(t.MessageType={}));let n;(function(f){f.OK="OK",f.E_DIAL_ERROR="E_DIAL_ERROR",f.E_DIAL_REFUSED="E_DIAL_REFUSED",f.E_BAD_REQUEST="E_BAD_REQUEST",f.E_INTERNAL_ERROR="E_INTERNAL_ERROR"})(n=t.ResponseStatus||(t.ResponseStatus={}));let i;(function(f){f[f.OK=0]="OK",f[f.E_DIAL_ERROR=100]="E_DIAL_ERROR",f[f.E_DIAL_REFUSED=101]="E_DIAL_REFUSED",f[f.E_BAD_REQUEST=200]="E_BAD_REQUEST",f[f.E_INTERNAL_ERROR=300]="E_INTERNAL_ERROR"})(i||(i={})),function(f){f.codec=()=>qr(i)}(n=t.ResponseStatus||(t.ResponseStatus={}));let o;(function(f){let u;f.codec=()=>(u==null&&(u=he((l,p,d={})=>{if(d.lengthDelimited!==!1&&p.fork(),l.id!=null&&(p.uint32(10),p.bytes(l.id)),l.addrs!=null)for(let h of l.addrs)p.uint32(18),p.bytes(h);d.lengthDelimited!==!1&&p.ldelim()},(l,p)=>{let d={addrs:[]},h=p==null?l.len:l.pos+p;for(;l.pos<h;){let y=l.uint32();switch(y>>>3){case 1:d.id=l.bytes();break;case 2:d.addrs.push(l.bytes());break;default:l.skipType(y&7);break}}return d})),u),f.encode=l=>le(l,f.codec()),f.decode=l=>ue(l,f.codec())})(o=t.PeerInfo||(t.PeerInfo={}));let s;(function(f){let u;f.codec=()=>(u==null&&(u=he((l,p,d={})=>{d.lengthDelimited!==!1&&p.fork(),l.peer!=null&&(p.uint32(10),t.PeerInfo.codec().encode(l.peer,p)),d.lengthDelimited!==!1&&p.ldelim()},(l,p)=>{let d={},h=p==null?l.len:l.pos+p;for(;l.pos<h;){let y=l.uint32();switch(y>>>3){case 1:d.peer=t.PeerInfo.codec().decode(l,l.uint32());break;default:l.skipType(y&7);break}}return d})),u),f.encode=l=>le(l,f.codec()),f.decode=l=>ue(l,f.codec())})(s=t.Dial||(t.Dial={}));let a;(function(f){let u;f.codec=()=>(u==null&&(u=he((l,p,d={})=>{d.lengthDelimited!==!1&&p.fork(),l.status!=null&&(p.uint32(8),t.ResponseStatus.codec().encode(l.status,p)),l.statusText!=null&&(p.uint32(18),p.string(l.statusText)),l.addr!=null&&(p.uint32(26),p.bytes(l.addr)),d.lengthDelimited!==!1&&p.ldelim()},(l,p)=>{let d={},h=p==null?l.len:l.pos+p;for(;l.pos<h;){let y=l.uint32();switch(y>>>3){case 1:d.status=t.ResponseStatus.codec().decode(l);break;case 2:d.statusText=l.string();break;case 3:d.addr=l.bytes();break;default:l.skipType(y&7);break}}return d})),u),f.encode=l=>le(l,f.codec()),f.decode=l=>ue(l,f.codec())})(a=t.DialResponse||(t.DialResponse={}));let c;t.codec=()=>(c==null&&(c=he((f,u,l={})=>{l.lengthDelimited!==!1&&u.fork(),f.type!=null&&(u.uint32(8),t.MessageType.codec().encode(f.type,u)),f.dial!=null&&(u.uint32(18),t.Dial.codec().encode(f.dial,u)),f.dialResponse!=null&&(u.uint32(26),t.DialResponse.codec().encode(f.dialResponse,u)),l.lengthDelimited!==!1&&u.ldelim()},(f,u)=>{let l={},p=u==null?f.len:f.pos+u;for(;f.pos<p;){let d=f.uint32();switch(d>>>3){case 1:l.type=t.MessageType.codec().decode(f);break;case 2:l.dial=t.Dial.codec().decode(f,f.uint32());break;case 3:l.dialResponse=t.DialResponse.codec().decode(f,f.uint32());break;default:f.skipType(d&7);break}}return l})),c),t.encode=f=>le(f,t.codec()),t.decode=f=>ue(f,t.codec())})(Y||(Y={}));var Os=4,Ii=class{components;startupDelay;refreshInterval;protocol;timeout;maxInboundStreams;maxOutboundStreams;verifyAddressTimeout;started;log;constructor(e,r){this.components=e,this.log=e.logger.forComponent("libp2p:autonat"),this.started=!1,this.protocol=`/${r.protocolPrefix??Pc}/${kc}/${Nc}`,this.timeout=r.timeout??3e4,this.maxInboundStreams=r.maxInboundStreams??1,this.maxOutboundStreams=r.maxOutboundStreams??1,this.startupDelay=r.startupDelay??5e3,this.refreshInterval=r.refreshInterval??6e4,this._verifyExternalAddresses=this._verifyExternalAddresses.bind(this)}isStarted(){return this.started}async start(){this.started||(await this.components.registrar.handle(this.protocol,e=>{this.handleIncomingAutonatStream(e).catch(r=>{this.log.error("error handling incoming autonat stream",r)})},{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams}),this.verifyAddressTimeout=setTimeout(this._verifyExternalAddresses,this.startupDelay),this.started=!0)}async stop(){await this.components.registrar.unhandle(this.protocol),clearTimeout(this.verifyAddressTimeout),this.started=!1}async handleIncomingAutonatStream(e){let r=AbortSignal.timeout(this.timeout),n=()=>{e.stream.abort(new $("handleIncomingAutonatStream timeout",Ci))};r.addEventListener("abort",n,{once:!0}),Ri(1/0,r);let i=this.components.addressManager.getAddresses().map(o=>o.toOptions().host);try{let o=this;await ks(e.stream,s=>Qr(s),async function*(s){let a=await _s(s);if(a==null){o.log("no message received"),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"No message was sent"}});return}let c;try{c=Y.decode(a)}catch(y){o.log.error("could not decode message",y),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"Could not decode message"}});return}let f=c.dial;if(f==null){o.log.error("dial was missing from message"),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"No Dial message found in message"}});return}let u,l=f.peer;if(l==null||l.id==null){o.log.error("PeerId missing from message"),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"missing peer info"}});return}try{u=Cn(l.id)}catch(y){o.log.error("invalid PeerId",y),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"bad peer id"}});return}if(o.log("incoming request from %p",u),!e.connection.remotePeer.equals(u)){o.log("target peer %p did not equal sending peer %p",u,e.connection.remotePeer),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"peer id mismatch"}});return}let p=l.addrs.map(y=>xi(y)).filter(y=>{let g=y.toOptions().host===e.connection.remoteAddr.toOptions().host;return o.log.trace("request to dial %a was sent from %a is same host %s",y,e.connection.remoteAddr,g),g}).filter(y=>{let g=y.toOptions().host,x=!(Us(g)??!1);return o.log.trace("host %s was public %s",g,x),x}).filter(y=>{let g=y.toOptions().host,x=!i.includes(g);return o.log.trace("host %s was not our host %s",g,x),x}).filter(y=>{let g=!!o.components.transportManager.transportForMultiaddr(y);return o.log.trace("transport for %a is supported %s",y,g),g}).map(y=>(y.getPeerId()==null&&(y=y.encapsulate(`/p2p/${u.toString()}`)),y));if(p.length===0){o.log("no valid multiaddrs for %p in message",u),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_DIAL_REFUSED,statusText:"no dialable addresses"}});return}o.log("dial multiaddrs %s for peer %p",p.map(y=>y.toString()).join(", "),u);let d="",h=p[0];for await(let y of p){let g;h=y;try{if(g=await o.components.connectionManager.openConnection(y,{signal:r}),!g.remoteAddr.equals(y))throw o.log.error("tried to dial %a but dialed %a",y,g.remoteAddr),new Error("Unexpected remote address");o.log("Success %p",u),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.OK,addr:g.remoteAddr.decapsulateCode(st("p2p").code).bytes}});return}catch(x){o.log("could not dial %p",u,x),d=x.message}finally{g!=null&&await g.close()}}yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_DIAL_ERROR,statusText:d,addr:h.bytes}})},s=>Sn(s),e.stream)}catch(o){this.log.error("error handling incoming autonat stream",o)}finally{r.removeEventListener("abort",n)}}_verifyExternalAddresses(){this.verifyExternalAddresses().catch(e=>{this.log.error("error verifying external address",e)})}async verifyExternalAddresses(){if(clearTimeout(this.verifyAddressTimeout),!this.isStarted())return;let e=this.components.addressManager,r=e.getObservedAddrs().filter(o=>{let s=o.toOptions();return!(Us(s.host)??!1)});if(r.length===0){this.log("no public addresses found, not requesting verification"),this.verifyAddressTimeout=setTimeout(this._verifyExternalAddresses,this.refreshInterval);return}let n=AbortSignal.timeout(this.timeout);Ri(1/0,n);let i=this;try{this.log("verify multiaddrs %s",r.map(l=>l.toString()).join(", "));let o=Y.encode({type:Y.MessageType.DIAL,dial:{peer:{id:this.components.peerId.toBytes(),addrs:r.map(l=>l.bytes)}}}),a=(await Qf()).toBytes(),c={},f=[],u=async l=>{let p=()=>{};try{this.log("asking %p to verify multiaddr",l.id);let d=await i.components.connectionManager.openConnection(l.id,{signal:n}),h=await d.newStream(this.protocol,{signal:n});p=()=>{h.abort(new $("verifyAddress timeout",Ci))},n.addEventListener("abort",p,{once:!0});let y=await ks([o],x=>Sn(x),h,x=>Qr(x),async x=>_s(x));if(y==null){this.log("no response received from %p",d.remotePeer);return}let g=Y.decode(y);if(g.type!==Y.MessageType.DIAL_RESPONSE||g.dialResponse==null){this.log("invalid autonat response from %p",d.remotePeer);return}if(g.dialResponse.status===Y.ResponseStatus.OK){let x=d.remoteAddr.toOptions(),m;if(x.family===4)m=x.host.split(".")[0];else if(x.family===6)m=x.host.split(":")[0];else{this.log('remote address "%s" was not IP4 or IP6?',x.host);return}if(f.includes(m)){this.log("already have response from network segment %d - %s",m,x.host);return}f.push(m)}return g.dialResponse}catch(d){this.log.error("error asking remote to verify multiaddr",d)}finally{n.removeEventListener("abort",p)}};for await(let l of Ls(bc(this.components.peerRouting.getClosestPeers(a,{signal:n}),p=>async()=>u(p)),{concurrency:Os}))try{if(l==null)continue;let p=l.addr==null?r[0]:xi(l.addr);if(this.log("autonat response for %a is %s",p,l.status),l.status===Y.ResponseStatus.E_BAD_REQUEST||l.status===Y.ResponseStatus.E_DIAL_REFUSED||l.addr==null&&r.length>1)continue;if(!r.some(h=>h.equals(p))){this.log("peer reported %a as %s but it was not in our observed address list",p,l.status);continue}let d=p.toString();if(c[d]==null&&(c[d]={success:0,failure:0}),l.status===Y.ResponseStatus.OK?c[d].success++:l.status===Y.ResponseStatus.E_DIAL_ERROR&&c[d].failure++,c[d].success===Os){this.log("%a is externally dialable",p),e.confirmObservedAddr(p);return}if(c[d].failure===Os){this.log("%a is not externally dialable",p),e.removeObservedAddr(p);return}}catch(p){this.log.error("could not verify external address",p)}}finally{this.verifyAddressTimeout=setTimeout(this._verifyExternalAddresses,this.refreshInterval)}}};function Ey(t={}){return e=>new Ii(e,t)}return Zc(Sy);})();
27
27
  /*! Bundled license information:
28
28
 
29
29
  @noble/hashes/esm/utils.js: