@libp2p/autonat 1.0.5-230afea4b → 1.0.5-4e0135c7d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +19 -19
- package/package.json +6 -6
package/dist/index.min.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
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
|
|
3
|
-
`)}return n};fo.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=La[e];if(!r){r=La[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 wt=ft((Ug,Oa)=>{var ka=ct(),Na=Pa(),b=Oa.exports=ka.util=ka.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){b.nextTick=process.nextTick,typeof setImmediate=="function"?b.setImmediate=setImmediate:b.setImmediate=b.nextTick;return}if(typeof setImmediate=="function"){b.setImmediate=function(){return setImmediate.apply(void 0,arguments)},b.nextTick=function(a){return setImmediate(a)};return}if(b.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=[];b.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=b.setImmediate;b.setImmediate=function(c){Date.now()-r>15?(r=Date.now(),o(c)):(e.push(c),e.length===1&&i.setAttribute("a",n=!n))}}b.nextTick=b.setImmediate})();b.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;b.globalScope=function(){return b.isNodejs?globalThis:typeof self>"u"?window:self}();b.isArray=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};b.isArrayBuffer=function(t){return typeof ArrayBuffer<"u"&&t instanceof ArrayBuffer};b.isArrayBufferView=function(t){return t&&b.isArrayBuffer(t.buffer)&&t.byteLength!==void 0};function an(t){if(!(t===8||t===16||t===24||t===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+t)}b.ByteBuffer=co;function co(t){if(this.data="",this.read=0,typeof t=="string")this.data=t;else if(b.isArrayBuffer(t)||b.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 co||typeof t=="object"&&typeof t.data=="string"&&typeof t.read=="number")&&(this.data=t.data,this.read=t.read);this._constructedStringLength=0}b.ByteStringBuffer=co;var _l=4096;b.ByteStringBuffer.prototype._optimizeConstructedString=function(t){this._constructedStringLength+=t,this._constructedStringLength>_l&&(this.data.substr(0,1),this._constructedStringLength=0)};b.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};b.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};b.ByteStringBuffer.prototype.putByte=function(t){return this.putBytes(String.fromCharCode(t))};b.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};b.ByteStringBuffer.prototype.putBytes=function(t){return this.data+=t,this._optimizeConstructedString(t.length),this};b.ByteStringBuffer.prototype.putString=function(t){return this.putBytes(b.encodeUtf8(t))};b.ByteStringBuffer.prototype.putInt16=function(t){return this.putBytes(String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};b.ByteStringBuffer.prototype.putInt24=function(t){return this.putBytes(String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};b.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))};b.ByteStringBuffer.prototype.putInt16Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255))};b.ByteStringBuffer.prototype.putInt24Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255))};b.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))};b.ByteStringBuffer.prototype.putInt=function(t,e){an(e);var r="";do e-=8,r+=String.fromCharCode(t>>e&255);while(e>0);return this.putBytes(r)};b.ByteStringBuffer.prototype.putSignedInt=function(t,e){return t<0&&(t+=2<<e-1),this.putInt(t,e)};b.ByteStringBuffer.prototype.putBuffer=function(t){return this.putBytes(t.getBytes())};b.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};b.ByteStringBuffer.prototype.getInt16=function(){var t=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,t};b.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};b.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};b.ByteStringBuffer.prototype.getInt16Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,t};b.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};b.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};b.ByteStringBuffer.prototype.getInt=function(t){an(t);var e=0;do e=(e<<8)+this.data.charCodeAt(this.read++),t-=8;while(t>0);return e};b.ByteStringBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e};b.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};b.ByteStringBuffer.prototype.bytes=function(t){return typeof t>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+t)};b.ByteStringBuffer.prototype.at=function(t){return this.data.charCodeAt(this.read+t)};b.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};b.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};b.ByteStringBuffer.prototype.copy=function(){var t=b.createBuffer(this.data);return t.read=this.read,t};b.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this};b.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};b.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};b.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};b.ByteStringBuffer.prototype.toString=function(){return b.decodeUtf8(this.bytes())};function Rl(t,e){e=e||{},this.read=e.readOffset||0,this.growSize=e.growSize||1024;var r=b.isArrayBuffer(t),n=b.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)}b.DataBuffer=Rl;b.DataBuffer.prototype.length=function(){return this.write-this.read};b.DataBuffer.prototype.isEmpty=function(){return this.length()<=0};b.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};b.DataBuffer.prototype.putByte=function(t){return this.accommodate(1),this.data.setUint8(this.write++,t),this};b.DataBuffer.prototype.fillWithByte=function(t,e){this.accommodate(e);for(var r=0;r<e;++r)this.data.setUint8(t);return this};b.DataBuffer.prototype.putBytes=function(t,e){if(b.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(b.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 b.DataBuffer||typeof t=="object"&&typeof t.read=="number"&&typeof t.write=="number"&&b.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 b.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+=b.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+=b.binary.base64.decode(t,o,this.write),this;if(e==="utf8"&&(t=b.encodeUtf8(t),e="binary"),e==="binary"||e==="raw")return this.accommodate(t.length),o=new Uint8Array(this.data.buffer,this.write),this.write+=b.binary.raw.decode(o),this;if(e==="utf16")return this.accommodate(t.length*2),o=new Uint16Array(this.data.buffer,this.write),this.write+=b.text.utf16.encode(o),this;throw new Error("Invalid encoding: "+e)}throw Error("Invalid parameter: "+t)};b.DataBuffer.prototype.putBuffer=function(t){return this.putBytes(t),t.clear(),this};b.DataBuffer.prototype.putString=function(t){return this.putBytes(t,"utf16")};b.DataBuffer.prototype.putInt16=function(t){return this.accommodate(2),this.data.setInt16(this.write,t),this.write+=2,this};b.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};b.DataBuffer.prototype.putInt32=function(t){return this.accommodate(4),this.data.setInt32(this.write,t),this.write+=4,this};b.DataBuffer.prototype.putInt16Le=function(t){return this.accommodate(2),this.data.setInt16(this.write,t,!0),this.write+=2,this};b.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};b.DataBuffer.prototype.putInt32Le=function(t){return this.accommodate(4),this.data.setInt32(this.write,t,!0),this.write+=4,this};b.DataBuffer.prototype.putInt=function(t,e){an(e),this.accommodate(e/8);do e-=8,this.data.setInt8(this.write++,t>>e&255);while(e>0);return this};b.DataBuffer.prototype.putSignedInt=function(t,e){return an(e),this.accommodate(e/8),t<0&&(t+=2<<e-1),this.putInt(t,e)};b.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};b.DataBuffer.prototype.getInt16=function(){var t=this.data.getInt16(this.read);return this.read+=2,t};b.DataBuffer.prototype.getInt24=function(){var t=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,t};b.DataBuffer.prototype.getInt32=function(){var t=this.data.getInt32(this.read);return this.read+=4,t};b.DataBuffer.prototype.getInt16Le=function(){var t=this.data.getInt16(this.read,!0);return this.read+=2,t};b.DataBuffer.prototype.getInt24Le=function(){var t=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,t};b.DataBuffer.prototype.getInt32Le=function(){var t=this.data.getInt32(this.read,!0);return this.read+=4,t};b.DataBuffer.prototype.getInt=function(t){an(t);var e=0;do e=(e<<8)+this.data.getInt8(this.read++),t-=8;while(t>0);return e};b.DataBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e};b.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};b.DataBuffer.prototype.bytes=function(t){return typeof t>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+t)};b.DataBuffer.prototype.at=function(t){return this.data.getUint8(this.read+t)};b.DataBuffer.prototype.setAt=function(t,e){return this.data.setUint8(t,e),this};b.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};b.DataBuffer.prototype.copy=function(){return new b.DataBuffer(this)};b.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};b.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};b.DataBuffer.prototype.truncate=function(t){return this.write=Math.max(0,this.length()-t),this.read=Math.min(this.read,this.write),this};b.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};b.DataBuffer.prototype.toString=function(t){var e=new Uint8Array(this.data,this.read,this.length());if(t=t||"utf8",t==="binary"||t==="raw")return b.binary.raw.encode(e);if(t==="hex")return b.binary.hex.encode(e);if(t==="base64")return b.binary.base64.encode(e);if(t==="utf8")return b.text.utf8.decode(e);if(t==="utf16")return b.text.utf16.decode(e);throw new Error("Invalid encoding: "+t)};b.createBuffer=function(t,e){return e=e||"raw",t!==void 0&&e==="utf8"&&(t=b.encodeUtf8(t)),new b.ByteBuffer(t)};b.fillString=function(t,e){for(var r="";e>0;)e&1&&(r+=t),e>>>=1,e>0&&(t+=t);return r};b.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};b.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};b.bytesToHex=function(t){return b.createBuffer(t).toHex()};b.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],Ua="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";b.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};
|
|
5
|
-
`,r=r.substr(e));return n+=r,n};b.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)};b.binary.base58.encode=function(t,e){return b.binary.baseN.encode(t,Ua,e)};b.binary.base58.decode=function(t,e){return b.binary.baseN.decode(t,Ua,e)};b.text={utf8:{},utf16:{}};b.text.utf8.encode=function(t,e,r){t=b.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};b.text.utf8.decode=function(t){return b.decodeUtf8(String.fromCharCode.apply(null,t))};b.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};b.text.utf16.decode=function(t){return String.fromCharCode.apply(null,new Uint16Array(t.buffer))};b.deflate=function(t,e,r){if(e=b.decode64(t.deflate(b.encode64(e)).rval),r){var n=2,i=e.charCodeAt(1);i&32&&(n=6),e=e.substring(n,e.length-4)}return e};b.inflate=function(t,e,r){var n=t.inflate(b.encode64(e)).rval;return n===null?null:b.decode64(n)};var uo=function(t,e,r){if(!t)throw new Error("WebStorage not available.");var n;if(r===null?n=t.removeItem(e):(r=b.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}},lo=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(b.decode64(r))),r},Ll=function(t,e,r,n){var i=lo(t,e);i===null&&(i={}),i[r]=n,uo(t,e,i)},Dl=function(t,e,r){var n=lo(t,e);return n!==null&&(n=r in n?n[r]:null),n},Pl=function(t,e,r){var n=lo(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),uo(t,e,n)}},kl=function(t,e){uo(t,e,null)},kn=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};b.setItem=function(t,e,r,n,i){kn(Ll,arguments,i)};b.getItem=function(t,e,r,n){return kn(Dl,arguments,n)};b.removeItem=function(t,e,r,n){kn(Pl,arguments,n)};b.clearItems=function(t,e,r){kn(kl,arguments,r)};b.isEmpty=function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0};b.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("")};b.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):"")};b.formatSize=function(t){return t>=1073741824?t=b.formatNumber(t/1073741824,2,".","")+" GiB":t>=1048576?t=b.formatNumber(t/1048576,2,".","")+" MiB":t>=1024?t=b.formatNumber(t/1024,0)+" KiB":t=b.formatNumber(t,0)+" bytes",t};b.bytesFromIP=function(t){return t.indexOf(".")!==-1?b.bytesFromIPv4(t):t.indexOf(":")!==-1?b.bytesFromIPv6(t):null};b.bytesFromIPv4=function(t){if(t=t.split("."),t.length!==4)return null;for(var e=b.createBuffer(),r=0;r<t.length;++r){var n=parseInt(t[r],10);if(isNaN(n))return null;e.putByte(n)}return e.getBytes()};b.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=b.createBuffer(),i=0;i<8;++i){if(!t[i]||t[i].length===0){n.fillWithByte(0,r),r=0;continue}var o=b.hexToBytes(t[i]);o.length<2&&n.putByte(0),n.putBytes(o)}return n.getBytes()};b.bytesToIP=function(t){return t.length===4?b.bytesToIPv4(t):t.length===16?b.bytesToIPv6(t):null};b.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(".")};b.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=b.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(":")};b.estimateCores=function(t,e){if(typeof t=="function"&&(e=t,t={}),t=t||{},"cores"in b&&!t.update)return e(null,b.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return b.cores=navigator.hardwareConcurrency,e(null,b.cores);if(typeof Worker>"u")return b.cores=1,e(null,b.cores);if(typeof Blob>"u")return b.cores=2,e(null,b.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 b.cores=Math.max(1,f),URL.revokeObjectURL(r),e(null,b.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 Nn=ft((Og,Ka)=>{var fn=ct();fn.pki=fn.pki||{};var ho=Ka.exports=fn.pki.oids=fn.oids=fn.oids||{};function C(t,e){ho[t]=e,ho[e]=t}function nt(t,e){ho[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 un=ft((Kg,Ma)=>{var ht=ct();wt();Nn();var N=Ma.exports=ht.asn1=ht.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(ht.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||ht.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(ht.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(ht.util.isArray(t)){if(!ht.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 cn(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 Nl=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;cn(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=ht.util.createBuffer(t));var r=t.length(),n=Un(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 Un(t,e,r,n){var i;cn(t,e,2);var o=t.getByte();e--;var s=o&192,a=o&31;i=t.length();var c=Nl(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(cn(t,e,2),t.bytes(2)==="\0\0"){t.getBytes(2),e-=2;break}i=t.length(),u.push(Un(t,e,r+1,n)),e-=i-t.length()}else for(;c>0;)i=t.length(),u.push(Un(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&&(cn(t,e,1),y=t.getByte(),e--),y===0)try{i=t.length();var g={strict:!0,decodeBitStrings:!0},x=Un(t,e,r+1,g),m=i-t.length();e-=m,a==N.Type.BITSTRING&&m++;var v=x.tagClass;m===c&&(v===N.Class.UNIVERSAL||v===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)cn(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=ht.util.createBuffer(),r=t.tagClass|t.type,n=ht.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=ht.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=ht.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=ht.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=ht.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&&ht.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 Fa=/[^\\u0000-\\u00ff]/;N.prettyPrint=function(t,e,r){var n="";e=e||0,r=r||2,e>0&&(n+=`
|
|
6
|
-
`);for(var i="",o=0;o<e*r;++o)i+=" ";switch(n+=i+"Tag: ",t.tagClass){case
|
|
2
|
+
"use strict";var Libp2PAutonat=(()=>{var pp=Object.create;var Di=Object.defineProperty;var yp=Object.getOwnPropertyDescriptor;var mp=Object.getOwnPropertyNames;var xp=Object.getPrototypeOf,gp=Object.prototype.hasOwnProperty;var ft=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),F=(t,e)=>{for(var r in e)Di(t,r,{get:e[r],enumerable:!0})},qc=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of mp(e))!gp.call(t,i)&&i!==r&&Di(t,i,{get:()=>e[i],enumerable:!(n=yp(e,i))||n.enumerable});return t};var Mt=(t,e,r)=>(r=t!=null?pp(xp(t)):{},qc(e||!t||!t.__esModule?Di(r,"default",{value:t,enumerable:!0}):r,t)),bp=t=>qc(Di({},"__esModule",{value:!0}),t);var ut=ft((h3,yf)=>{yf.exports={options:{usePureJavaScript:!1}}});var gf=ft((l3,xf)=>{var bs={};xf.exports=bs;var mf={};bs.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=Cy(t,e);else{var i=0,o=e.length,s=e.charAt(0),a=[0];for(i=0;i<t.length;++i){for(var f=0,c=t[i];f<a.length;++f)c+=a[f]<<8,a[f]=c%o,c=c/o|0;for(;c>0;)a.push(c%o),c=c/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};bs.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=mf[e];if(!r){r=mf[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 f=0,c=a;f<s.length;++f)c+=s[f]*i,s[f]=c&255,c>>=8;for(;c>0;)s.push(c&255),c>>=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 Cy(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 f="";for(r=0;t.at(r)===0&&r<t.length()-1;++r)f+=i;for(r=o.length-1;r>=0;--r)f+=e[o[r]];return f}});var It=ft((d3,Ef)=>{var bf=ut(),vf=gf(),v=Ef.exports=bf.util=bf.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(f){if(f.source===window&&f.data===t){f.stopPropagation();var c=e.slice();e.length=0,c.forEach(function(u){u()})}};var s=a,t="forge.setImmediate",e=[];v.setImmediate=function(f){e.push(f),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 f=e.slice();e.length=0,f.forEach(function(c){c()})}).observe(i,{attributes:!0});var o=v.setImmediate;v.setImmediate=function(f){Date.now()-r>15?(r=Date.now(),o(f)):(e.push(f),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 Yn(t){if(!(t===8||t===16||t===24||t===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+t)}v.ByteBuffer=vs;function vs(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 vs||typeof t=="object"&&typeof t.data=="string"&&typeof t.read=="number")&&(this.data=t.data,this.read=t.read);this._constructedStringLength=0}v.ByteStringBuffer=vs;var Ty=4096;v.ByteStringBuffer.prototype._optimizeConstructedString=function(t){this._constructedStringLength+=t,this._constructedStringLength>Ty&&(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){Yn(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){Yn(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 Ry(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=Ry;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){Yn(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 Yn(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){Yn(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 rr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",nr=[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],wf="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+=rr.charAt(i>>2),r+=rr.charAt((i&3)<<4|o>>4),isNaN(o)?r+="==":(r+=rr.charAt((o&15)<<2|s>>6),r+=isNaN(s)?"=":rr.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=nr[t.charCodeAt(s++)-43],n=nr[t.charCodeAt(s++)-43],i=nr[t.charCodeAt(s++)-43],o=nr[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:vf.encode,decode:vf.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+=rr.charAt(i>>2),r+=rr.charAt((i&3)<<4|o>>4),isNaN(o)?r+="==":(r+=rr.charAt((o&15)<<2|s>>6),r+=isNaN(s)?"=":rr.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,f=0,c=r;f<t.length;)i=nr[t.charCodeAt(f++)-43],o=nr[t.charCodeAt(f++)-43],s=nr[t.charCodeAt(f++)-43],a=nr[t.charCodeAt(f++)-43],n[c++]=i<<2|o>>4,s!==64&&(n[c++]=(o&15)<<4|s>>2,a!==64&&(n[c++]=(s&3)<<6|a));return e?c-r:n.subarray(0,c)};v.binary.base58.encode=function(t,e){return v.binary.baseN.encode(t,wf,e)};v.binary.base58.decode=function(t,e){return v.binary.baseN.decode(t,wf,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 ws=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}},Es=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},Ly=function(t,e,r,n){var i=Es(t,e);i===null&&(i={}),i[r]=n,ws(t,e,i)},Dy=function(t,e,r){var n=Es(t,e);return n!==null&&(n=r in n?n[r]:null),n},_y=function(t,e,r){var n=Es(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),ws(t,e,n)}},Ny=function(t,e){ws(t,e,null)},ki=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(f){s=f}if(o)break}if(!o)throw s;return n};v.setItem=function(t,e,r,n,i){ki(Ly,arguments,i)};v.getItem=function(t,e,r,n){return ki(Dy,arguments,n)};v.removeItem=function(t,e,r,n){ki(_y,arguments,n)};v.clearItems=function(t,e,r){ki(Ny,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,f=i<0?"-":"",c=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",u=c.length>3?c.length%3:0;return f+(u?c.substr(0,u)+a:"")+c.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+a)+(o?s+Math.abs(i-c).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 f=r[n];f.end-f.start>0&&(e.splice(f.start,f.end-f.start+1,""),f.start===0&&e.unshift(""),f.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(),f=a+4;Date.now()<f;);self.postMessage({st:a,et:f})})}.toString(),")()"],{type:"application/javascript"}));n([],5,16);function n(s,a,f){if(a===0){var c=Math.floor(s.reduce(function(u,h){return u+h},0)/s.length);return v.cores=Math.max(1,c),URL.revokeObjectURL(r),e(null,v.cores)}i(f,function(u,h){s.push(o(f,h)),n(s,a-1,f)})}function i(s,a){for(var f=[],c=[],u=0;u<s;++u){var h=new Worker(r);h.addEventListener("message",function(y){if(c.push(y.data),c.length===s){for(var p=0;p<s;++p)f[p].terminate();a(null,c)}}),f.push(h)}for(var u=0;u<s;++u)f[u].postMessage(u)}function o(s,a){for(var f=[],c=0;c<s;++c)for(var u=a[c],h=f[c]=[],y=0;y<s;++y)if(c!==y){var p=a[y];(u.st>p.st&&u.st<p.et||p.st>u.st&&p.st<u.et)&&h.push(y)}return f.reduce(function(l,d){return Math.max(l,d.length)},0)}}});var Ui=ft((p3,Sf)=>{var Zn=ut();Zn.pki=Zn.pki||{};var Ss=Sf.exports=Zn.pki.oids=Zn.oids=Zn.oids||{};function D(t,e){Ss[t]=e,Ss[e]=t}function it(t,e){Ss[t]=e}D("1.2.840.113549.1.1.1","rsaEncryption");D("1.2.840.113549.1.1.4","md5WithRSAEncryption");D("1.2.840.113549.1.1.5","sha1WithRSAEncryption");D("1.2.840.113549.1.1.7","RSAES-OAEP");D("1.2.840.113549.1.1.8","mgf1");D("1.2.840.113549.1.1.9","pSpecified");D("1.2.840.113549.1.1.10","RSASSA-PSS");D("1.2.840.113549.1.1.11","sha256WithRSAEncryption");D("1.2.840.113549.1.1.12","sha384WithRSAEncryption");D("1.2.840.113549.1.1.13","sha512WithRSAEncryption");D("1.3.101.112","EdDSA25519");D("1.2.840.10040.4.3","dsa-with-sha1");D("1.3.14.3.2.7","desCBC");D("1.3.14.3.2.26","sha1");D("1.3.14.3.2.29","sha1WithRSASignature");D("2.16.840.1.101.3.4.2.1","sha256");D("2.16.840.1.101.3.4.2.2","sha384");D("2.16.840.1.101.3.4.2.3","sha512");D("2.16.840.1.101.3.4.2.4","sha224");D("2.16.840.1.101.3.4.2.5","sha512-224");D("2.16.840.1.101.3.4.2.6","sha512-256");D("1.2.840.113549.2.2","md2");D("1.2.840.113549.2.5","md5");D("1.2.840.113549.1.7.1","data");D("1.2.840.113549.1.7.2","signedData");D("1.2.840.113549.1.7.3","envelopedData");D("1.2.840.113549.1.7.4","signedAndEnvelopedData");D("1.2.840.113549.1.7.5","digestedData");D("1.2.840.113549.1.7.6","encryptedData");D("1.2.840.113549.1.9.1","emailAddress");D("1.2.840.113549.1.9.2","unstructuredName");D("1.2.840.113549.1.9.3","contentType");D("1.2.840.113549.1.9.4","messageDigest");D("1.2.840.113549.1.9.5","signingTime");D("1.2.840.113549.1.9.6","counterSignature");D("1.2.840.113549.1.9.7","challengePassword");D("1.2.840.113549.1.9.8","unstructuredAddress");D("1.2.840.113549.1.9.14","extensionRequest");D("1.2.840.113549.1.9.20","friendlyName");D("1.2.840.113549.1.9.21","localKeyId");D("1.2.840.113549.1.9.22.1","x509Certificate");D("1.2.840.113549.1.12.10.1.1","keyBag");D("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");D("1.2.840.113549.1.12.10.1.3","certBag");D("1.2.840.113549.1.12.10.1.4","crlBag");D("1.2.840.113549.1.12.10.1.5","secretBag");D("1.2.840.113549.1.12.10.1.6","safeContentsBag");D("1.2.840.113549.1.5.13","pkcs5PBES2");D("1.2.840.113549.1.5.12","pkcs5PBKDF2");D("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");D("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");D("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");D("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");D("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");D("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");D("1.2.840.113549.2.7","hmacWithSHA1");D("1.2.840.113549.2.8","hmacWithSHA224");D("1.2.840.113549.2.9","hmacWithSHA256");D("1.2.840.113549.2.10","hmacWithSHA384");D("1.2.840.113549.2.11","hmacWithSHA512");D("1.2.840.113549.3.7","des-EDE3-CBC");D("2.16.840.1.101.3.4.1.2","aes128-CBC");D("2.16.840.1.101.3.4.1.22","aes192-CBC");D("2.16.840.1.101.3.4.1.42","aes256-CBC");D("2.5.4.3","commonName");D("2.5.4.4","surname");D("2.5.4.5","serialNumber");D("2.5.4.6","countryName");D("2.5.4.7","localityName");D("2.5.4.8","stateOrProvinceName");D("2.5.4.9","streetAddress");D("2.5.4.10","organizationName");D("2.5.4.11","organizationalUnitName");D("2.5.4.12","title");D("2.5.4.13","description");D("2.5.4.15","businessCategory");D("2.5.4.17","postalCode");D("2.5.4.42","givenName");D("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");D("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");D("2.16.840.1.113730.1.1","nsCertType");D("2.16.840.1.113730.1.13","nsComment");it("2.5.29.1","authorityKeyIdentifier");it("2.5.29.2","keyAttributes");it("2.5.29.3","certificatePolicies");it("2.5.29.4","keyUsageRestriction");it("2.5.29.5","policyMapping");it("2.5.29.6","subtreesConstraint");it("2.5.29.7","subjectAltName");it("2.5.29.8","issuerAltName");it("2.5.29.9","subjectDirectoryAttributes");it("2.5.29.10","basicConstraints");it("2.5.29.11","nameConstraints");it("2.5.29.12","policyConstraints");it("2.5.29.13","basicConstraints");D("2.5.29.14","subjectKeyIdentifier");D("2.5.29.15","keyUsage");it("2.5.29.16","privateKeyUsagePeriod");D("2.5.29.17","subjectAltName");D("2.5.29.18","issuerAltName");D("2.5.29.19","basicConstraints");it("2.5.29.20","cRLNumber");it("2.5.29.21","cRLReason");it("2.5.29.22","expirationDate");it("2.5.29.23","instructionCode");it("2.5.29.24","invalidityDate");it("2.5.29.25","cRLDistributionPoints");it("2.5.29.26","issuingDistributionPoint");it("2.5.29.27","deltaCRLIndicator");it("2.5.29.28","issuingDistributionPoint");it("2.5.29.29","certificateIssuer");it("2.5.29.30","nameConstraints");D("2.5.29.31","cRLDistributionPoints");D("2.5.29.32","certificatePolicies");it("2.5.29.33","policyMappings");it("2.5.29.34","policyConstraints");D("2.5.29.35","authorityKeyIdentifier");it("2.5.29.36","policyConstraints");D("2.5.29.37","extKeyUsage");it("2.5.29.46","freshestCRL");it("2.5.29.54","inhibitAnyPolicy");D("1.3.6.1.4.1.11129.2.4.2","timestampList");D("1.3.6.1.5.5.7.1.1","authorityInfoAccess");D("1.3.6.1.5.5.7.3.1","serverAuth");D("1.3.6.1.5.5.7.3.2","clientAuth");D("1.3.6.1.5.5.7.3.3","codeSigning");D("1.3.6.1.5.5.7.3.4","emailProtection");D("1.3.6.1.5.5.7.3.8","timeStamping")});var Xn=ft((y3,Bf)=>{var dt=ut();It();Ui();var k=Bf.exports=dt.asn1=dt.asn1||{};k.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};k.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};k.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=k.copy(a)),a};k.copy=function(t,e){var r;if(dt.util.isArray(t)){r=[];for(var n=0;n<t.length;++n)r.push(k.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:k.copy(t.value,e)},e&&!e.excludeBitStringContents&&(r.bitStringContents=t.bitStringContents),r)};k.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(!k.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&&k.equals(t.value,e.value);return r&&r.includeBitStringContents&&(i=i&&t.bitStringContents===e.bitStringContents),i};k.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 Qn(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 Py=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;Qn(t,e,o),n=t.getInt(o<<3)}if(n<0)throw new Error("Negative length: "+n);return n}};k.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=Oi(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 Oi(t,e,r,n){var i;Qn(t,e,2);var o=t.getByte();e--;var s=o&192,a=o&31;i=t.length();var f=Py(t,e);if(e-=i-t.length(),f!==void 0&&f>e){if(n.strict){var c=new Error("Too few bytes to read ASN.1 value.");throw c.available=t.length(),c.remaining=e,c.requested=f,c}f=e}var u,h,y=(o&32)===32;if(y)if(u=[],f===void 0)for(;;){if(Qn(t,e,2),t.bytes(2)==="\0\0"){t.getBytes(2),e-=2;break}i=t.length(),u.push(Oi(t,e,r+1,n)),e-=i-t.length()}else for(;f>0;)i=t.length(),u.push(Oi(t,f,r+1,n)),e-=i-t.length(),f-=i-t.length();if(u===void 0&&s===k.Class.UNIVERSAL&&a===k.Type.BITSTRING&&(h=t.bytes(f)),u===void 0&&n.decodeBitStrings&&s===k.Class.UNIVERSAL&&a===k.Type.BITSTRING&&f>1){var p=t.read,l=e,d=0;if(a===k.Type.BITSTRING&&(Qn(t,e,1),d=t.getByte(),e--),d===0)try{i=t.length();var m={strict:!0,decodeBitStrings:!0},x=Oi(t,e,r+1,m),g=i-t.length();e-=g,a==k.Type.BITSTRING&&g++;var b=x.tagClass;g===f&&(b===k.Class.UNIVERSAL||b===k.Class.CONTEXT_SPECIFIC)&&(u=[x])}catch{}u===void 0&&(t.read=p,e=l)}if(u===void 0){if(f===void 0){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");f=e}if(a===k.Type.BMPSTRING)for(u="";f>0;f-=2)Qn(t,e,2),u+=String.fromCharCode(t.getInt16()),e-=2;else u=t.getBytes(f),e-=f}var A=h===void 0?null:{bitStringContents:h};return k.create(s,a,y,u,A)}k.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=k.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(k.toDer(t.value[o]))}else if(t.type===k.Type.BMPSTRING)for(var o=0;o<t.value.length;++o)n.putInt16(t.value.charCodeAt(o));else t.type===k.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};k.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 f=i.length-1;f>=0;--f)r.putByte(i[f])}return r};k.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};k.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 f=t.charAt(10),c=10;f!=="+"&&f!=="-"&&(a=parseInt(t.substr(10,2),10),c+=2)}if(e.setUTCFullYear(r,n,i),e.setUTCHours(o,s,a,0),c&&(f=t.charAt(c),f==="+"||f==="-")){var u=parseInt(t.substr(c+1,2),10),h=parseInt(t.substr(c+4,2),10),y=u*60+h;y*=6e4,f==="+"?e.setTime(+e-y):e.setTime(+e+y)}return e};k.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),f=0,c=0,u=!1;t.charAt(t.length-1)==="Z"&&(u=!0);var h=t.length-5,y=t.charAt(h);if(y==="+"||y==="-"){var p=parseInt(t.substr(h+1,2),10),l=parseInt(t.substr(h+4,2),10);c=p*60+l,c*=6e4,y==="+"&&(c*=-1),u=!0}return t.charAt(14)==="."&&(f=parseFloat(t.substr(14),10)*1e3),u?(e.setUTCFullYear(r,n,i),e.setUTCHours(o,s,a,f),e.setTime(+e+c)):(e.setFullYear(r,n,i),e.setHours(o,s,a,f)),e};k.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};k.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};k.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};k.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)};k.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=k.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 f=t.bitStringContents.charCodeAt(0);if(f!==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 Af=/[^\\u0000-\\u00ff]/;k.prettyPrint=function(t,e,r){var n="";e=e||0,r=r||2,e>0&&(n+=`
|
|
6
|
+
`);for(var i="",o=0;o<e*r;++o)i+=" ";switch(n+=i+"Tag: ",t.tagClass){case k.Class.UNIVERSAL:n+="Universal:";break;case k.Class.APPLICATION:n+="Application:";break;case k.Class.CONTEXT_SPECIFIC:n+="Context-Specific:";break;case k.Class.PRIVATE:n+="Private:";break}if(t.tagClass===k.Class.UNIVERSAL)switch(n+=t.type,t.type){case k.Type.NONE:n+=" (None)";break;case k.Type.BOOLEAN:n+=" (Boolean)";break;case k.Type.INTEGER:n+=" (Integer)";break;case k.Type.BITSTRING:n+=" (Bit string)";break;case k.Type.OCTETSTRING:n+=" (Octet string)";break;case k.Type.NULL:n+=" (Null)";break;case k.Type.OID:n+=" (Object Identifier)";break;case k.Type.ODESC:n+=" (Object Descriptor)";break;case k.Type.EXTERNAL:n+=" (External or Instance of)";break;case k.Type.REAL:n+=" (Real)";break;case k.Type.ENUMERATED:n+=" (Enumerated)";break;case k.Type.EMBEDDED:n+=" (Embedded PDV)";break;case k.Type.UTF8:n+=" (UTF8)";break;case k.Type.ROID:n+=" (Relative Object Identifier)";break;case k.Type.SEQUENCE:n+=" (Sequence)";break;case k.Type.SET:n+=" (Set)";break;case k.Type.PRINTABLESTRING:n+=" (Printable String)";break;case k.Type.IA5String:n+=" (IA5String (ASCII))";break;case k.Type.UTCTIME:n+=" (UTC time)";break;case k.Type.GENERALIZEDTIME:n+=" (Generalized time)";break;case k.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,ht.pki&&ht.pki.oids&&c in ht.pki.oids&&(n+=" ("+ht.pki.oids[c]+") ")}if(t.type===N.Type.INTEGER)try{n+=N.derToInteger(t.value)}catch{n+="0x"+ht.util.bytesToHex(t.value)}else if(t.type===N.Type.BITSTRING){if(t.value.length>1?n+="0x"+ht.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)Fa.test(t.value)||(n+="("+t.value+") "),n+="0x"+ht.util.bytesToHex(t.value);else if(t.type===N.Type.UTF8)try{n+=ht.util.decodeUtf8(t.value)}catch(u){if(u.message==="URI malformed")n+="0x"+ht.util.bytesToHex(t.value)+" (malformed UTF8)";else throw u}else t.type===N.Type.PRINTABLESTRING||t.type===N.Type.IA5String?n+=t.value:Fa.test(t.value)?n+="0x"+ht.util.bytesToHex(t.value):t.value.length===0?n+="[null]":n+=t.value}return n}});var yo=ft((Fg,Va)=>{var Tt=ct();wt();Va.exports=Tt.cipher=Tt.cipher||{};Tt.cipher.algorithms=Tt.cipher.algorithms||{};Tt.cipher.createCipher=function(t,e){var r=t;if(typeof r=="string"&&(r=Tt.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new Tt.cipher.BlockCipher({algorithm:r,key:e,decrypt:!1})};Tt.cipher.createDecipher=function(t,e){var r=t;if(typeof r=="string"&&(r=Tt.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new Tt.cipher.BlockCipher({algorithm:r,key:e,decrypt:!0})};Tt.cipher.registerAlgorithm=function(t,e){t=t.toUpperCase(),Tt.cipher.algorithms[t]=e};Tt.cipher.getAlgorithm=function(t){return t=t.toUpperCase(),t in Tt.cipher.algorithms?Tt.cipher.algorithms[t]:null};var po=Tt.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)};po.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=Tt.util.createBuffer(),this.output=t.output||Tt.util.createBuffer(),this.mode.start(e)};po.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()};po.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 xo=ft((Mg,qa)=>{var Ct=ct();wt();Ct.cipher=Ct.cipher||{};var Q=qa.exports=Ct.cipher.modes=Ct.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=On(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=Ct.util.createBuffer(),this._partialBytes=0};Q.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=On(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=Ct.util.createBuffer(),this._partialBytes=0};Q.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=On(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=Ct.util.createBuffer(),this._partialBytes=0};Q.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=On(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}Kn(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=Ct.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=Ct.util.createBuffer(t.iv);this._cipherLength=0;var r;if("additionalData"in t?r=Ct.util.createBuffer(t.additionalData):r=Ct.util.createBuffer(),"tagLength"in t?this._tagLength=t.tagLength:this._tagLength=128,this._tag=null,t.decrypt&&(this._tag=Ct.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(go(n*8)))}this._inBlock=this._j0.slice(0),Kn(this._inBlock),this._partialBytes=0,r=Ct.util.createBuffer(r),this._aDataLength=go(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),Kn(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),Kn(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=Ct.util.createBuffer();var n=this._aDataLength.concat(go(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 On(t,e){if(typeof t=="string"&&(t=Ct.util.createBuffer(t)),Ct.util.isArray(t)&&t.length>4){var r=t;t=Ct.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(!Ct.util.isArray(t)){for(var i=[],o=e/4,n=0;n<o;++n)i.push(t.getInt32());t=i}return t}function Kn(t){t[t.length-1]=t[t.length-1]+1&4294967295}function go(t){return[t/4294967296|0,t&4294967295]}});var wo=ft((Vg,Ga)=>{var lt=ct();yo();xo();wt();Ga.exports=lt.aes=lt.aes||{};lt.aes.startEncrypting=function(t,e,r,n){var i=Fn({key:t,output:r,decrypt:!1,mode:n});return i.start(e),i};lt.aes.createEncryptionCipher=function(t,e){return Fn({key:t,output:null,decrypt:!1,mode:e})};lt.aes.startDecrypting=function(t,e,r,n){var i=Fn({key:t,output:r,decrypt:!0,mode:n});return i.start(e),i};lt.aes.createDecryptionCipher=function(t,e){return Fn({key:t,output:null,decrypt:!0,mode:e})};lt.aes.Algorithm=function(t,e){vo||za();var r=this;r.name=t,r.mode=new e({blockSize:16,cipher:{encrypt:function(n,i){return bo(r._w,n,i,!1)},decrypt:function(n,i){return bo(r._w,n,i,!0)}}}),r._init=!1};lt.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=lt.util.createBuffer(e);else if(lt.util.isArray(e)&&(e.length===16||e.length===24||e.length===32)){r=e,e=lt.util.createBuffer();for(var n=0;n<r.length;++n)e.putByte(r[n])}if(!lt.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(!lt.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=$a(e,t.decrypt&&!s),this._init=!0}};lt.aes._expandKey=function(t,e){return vo||za(),$a(t,e)};lt.aes._updateBlock=bo;Pr("AES-ECB",lt.cipher.modes.ecb);Pr("AES-CBC",lt.cipher.modes.cbc);Pr("AES-CFB",lt.cipher.modes.cfb);Pr("AES-OFB",lt.cipher.modes.ofb);Pr("AES-CTR",lt.cipher.modes.ctr);Pr("AES-GCM",lt.cipher.modes.gcm);function Pr(t,e){var r=function(){return new lt.aes.Algorithm(t,e)};lt.cipher.registerAlgorithm(t,r)}var vo=!1,Dr=4,Ft,mo,Ha,ar,ne;function za(){vo=!0,Ha=[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;Ft=new Array(256),mo=new Array(256),ar=new Array(4),ne=new Array(4);for(var e=0;e<4;++e)ar[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,Ft[r]=a,mo[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,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 $a(t,e){for(var r=t.slice(0),n,i=1,o=r.length,s=o+6+1,a=Dr*s,c=o;c<a;++c)n=r[c-1],c%o===0?(n=Ft[n>>>16&255]<<24^Ft[n>>>8&255]<<16^Ft[n&255]<<8^Ft[n>>>24]^Ha[i]<<24,i++):o>6&&c%o===4&&(n=Ft[n>>>24]<<24^Ft[n>>>16&255]<<16^Ft[n>>>8&255]<<8^Ft[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-Dr;c<a;c+=Dr,y-=Dr)if(c===0||c===a-Dr)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<Dr;++g)f=r[y+g],h[c+(3&-g)]=u[Ft[f>>>24]]^l[Ft[f>>>16&255]]^p[Ft[f>>>8&255]]^d[Ft[f&255]];r=h}return r}function bo(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=mo):(o=ar[0],s=ar[1],a=ar[2],c=ar[3],f=Ft);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 Fn(t){t=t||{};var e=(t.mode||"CBC").toUpperCase(),r="AES-"+e,n;t.decrypt?n=lt.cipher.createDecipher(r,t.key):n=lt.cipher.createCipher(r,t.key);var i=n.start;return n.start=function(o,s){var a=null;s instanceof lt.util.ByteBuffer&&(a=s,s={}),s=s||{},s.output=a,s.iv=o,i.call(n,s)},n}});var Za=ft((qg,Ya)=>{var pt=ct();yo();xo();wt();Ya.exports=pt.des=pt.des||{};pt.des.startEncrypting=function(t,e,r,n){var i=Mn({key:t,output:r,decrypt:!1,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};pt.des.createEncryptionCipher=function(t,e){return Mn({key:t,output:null,decrypt:!1,mode:e})};pt.des.startDecrypting=function(t,e,r,n){var i=Mn({key:t,output:r,decrypt:!0,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};pt.des.createDecryptionCipher=function(t,e){return Mn({key:t,output:null,decrypt:!0,mode:e})};pt.des.Algorithm=function(t,e){var r=this;r.name=t,r.mode=new e({blockSize:8,cipher:{encrypt:function(n,i){return Wa(r._keys,n,i,!1)},decrypt:function(n,i){return Wa(r._keys,n,i,!0)}}}),r._init=!1};pt.des.Algorithm.prototype.initialize=function(t){if(!this._init){var e=pt.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=zl(e),this._init=!0}};ge("DES-ECB",pt.cipher.modes.ecb);ge("DES-CBC",pt.cipher.modes.cbc);ge("DES-CFB",pt.cipher.modes.cfb);ge("DES-OFB",pt.cipher.modes.ofb);ge("DES-CTR",pt.cipher.modes.ctr);ge("3DES-ECB",pt.cipher.modes.ecb);ge("3DES-CBC",pt.cipher.modes.cbc);ge("3DES-CFB",pt.cipher.modes.cfb);ge("3DES-OFB",pt.cipher.modes.ofb);ge("3DES-CTR",pt.cipher.modes.ctr);function ge(t,e){var r=function(){return new pt.des.Algorithm(t,e)};pt.cipher.registerAlgorithm(t,r)}var Ul=[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],Ol=[-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],Kl=[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],Fl=[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],Ml=[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],Vl=[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],ql=[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],Hl=[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 zl(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,v,_=0;_<y;_++){var E=t.getInt32(),S=t.getInt32();v=(E>>>4^S)&252645135,S^=v,E^=v<<4,v=(S>>>-16^E)&65535,E^=v,S^=v<<-16,v=(E>>>2^S)&858993459,S^=v,E^=v<<2,v=(S>>>-16^E)&65535,E^=v,S^=v<<-16,v=(E>>>1^S)&1431655765,S^=v,E^=v<<1,v=(S>>>8^E)&16711935,E^=v,S^=v<<8,v=(E>>>1^S)&1431655765,S^=v,E^=v<<1,v=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=v;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];v=(H>>>16^D)&65535,g[m++]=D^v,g[m++]=H^v<<16}}return g}function Wa(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^(Ol[d>>>24&63]|Fl[d>>>16&63]|Vl[d>>>8&63]|Hl[d&63]|Ul[h>>>24&63]|Kl[h>>>16&63]|Ml[h>>>8&63]|ql[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 Mn(t){t=t||{};var e=(t.mode||"CBC").toUpperCase(),r="DES-"+e,n;t.decrypt?n=pt.cipher.createDecipher(r,t.key):n=pt.cipher.createCipher(r,t.key);var i=n.start;return n.start=function(o,s){var a=null;s instanceof pt.util.ByteBuffer&&(a=s,s={}),s=s||{},s.output=a,s.iv=o,i.call(n,s)},n}});var fr=ft((Hg,Qa)=>{var Vn=ct();Qa.exports=Vn.md=Vn.md||{};Vn.md.algorithms=Vn.md.algorithms||{}});var Ja=ft((zg,Xa)=>{var Ie=ct();fr();wt();var $l=Xa.exports=Ie.hmac=Ie.hmac||{};$l.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 qn=ft(()=>{});var t0=ft((Wg,ja)=>{var Mt=ct();Ja();fr();wt();var Gl=Mt.pkcs5=Mt.pkcs5||{},Te;Mt.util.isNodejs&&!Mt.options.usePureJavaScript&&(Te=qn());ja.exports=Mt.pbkdf2=Gl.pbkdf2=function(t,e,r,n,i,o){if(typeof i=="function"&&(o=i,i=null),Mt.util.isNodejs&&!Mt.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(v,_){if(v)return o(v);o(null,_.toString("binary"))}):Te.pbkdf2(t,e,r,n,i,function(v,_){if(v)return o(v);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 Mt.md.algorithms))throw new Error("Unknown hash algorithm: "+i);i=Mt.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=Mt.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(Mt.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=Mt.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(Mt.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=Mt.util.xorBytes(p,d,s),h=d,++g,Mt.util.setImmediate(m);l+=y<c?p:p.substr(0,f),++y,x()}x()}});var n0=ft((Yg,r0)=>{var zn=ct();wt();var e0=r0.exports=zn.pem=zn.pem||{};e0.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+=
|
|
10
|
-
`),r
|
|
8
|
+
`,t.composed){for(var s=0,a="",o=0;o<t.value.length;++o)t.value[o]!==void 0&&(s+=1,a+=k.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===k.Type.OID){var f=k.derToOid(t.value);n+=f,dt.pki&&dt.pki.oids&&f in dt.pki.oids&&(n+=" ("+dt.pki.oids[f]+") ")}if(t.type===k.Type.INTEGER)try{n+=k.derToInteger(t.value)}catch{n+="0x"+dt.util.bytesToHex(t.value)}else if(t.type===k.Type.BITSTRING){if(t.value.length>1?n+="0x"+dt.util.bytesToHex(t.value.slice(1)):n+="(none)",t.value.length>0){var c=t.value.charCodeAt(0);c==1?n+=" (1 unused bit shown)":c>1&&(n+=" ("+c+" unused bits shown)")}}else if(t.type===k.Type.OCTETSTRING)Af.test(t.value)||(n+="("+t.value+") "),n+="0x"+dt.util.bytesToHex(t.value);else if(t.type===k.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===k.Type.PRINTABLESTRING||t.type===k.Type.IA5String?n+=t.value:Af.test(t.value)?n+="0x"+dt.util.bytesToHex(t.value):t.value.length===0?n+="[null]":n+=t.value}return n}});var Bs=ft((m3,If)=>{var Lt=ut();It();If.exports=Lt.cipher=Lt.cipher||{};Lt.cipher.algorithms=Lt.cipher.algorithms||{};Lt.cipher.createCipher=function(t,e){var r=t;if(typeof r=="string"&&(r=Lt.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new Lt.cipher.BlockCipher({algorithm:r,key:e,decrypt:!1})};Lt.cipher.createDecipher=function(t,e){var r=t;if(typeof r=="string"&&(r=Lt.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new Lt.cipher.BlockCipher({algorithm:r,key:e,decrypt:!0})};Lt.cipher.registerAlgorithm=function(t,e){t=t.toUpperCase(),Lt.cipher.algorithms[t]=e};Lt.cipher.getAlgorithm=function(t){return t=t.toUpperCase(),t in Lt.cipher.algorithms?Lt.cipher.algorithms[t]:null};var As=Lt.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)};As.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=Lt.util.createBuffer(),this.output=t.output||Lt.util.createBuffer(),this.mode.start(e)};As.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()};As.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 Cs=ft((x3,Cf)=>{var Dt=ut();It();Dt.cipher=Dt.cipher||{};var X=Cf.exports=Dt.cipher.modes=Dt.cipher.modes||{};X.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)};X.ecb.prototype.start=function(t){};X.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])};X.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])};X.ecb.prototype.pad=function(t,e){var r=t.length()===this.blockSize?this.blockSize:this.blockSize-t.length();return t.fillWithByte(r,r),!0};X.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)};X.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)};X.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=Fi(t.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")};X.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};X.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)};X.cbc.prototype.pad=function(t,e){var r=t.length()===this.blockSize?this.blockSize:this.blockSize-t.length();return t.fillWithByte(r,r),!0};X.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)};X.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=Dt.util.createBuffer(),this._partialBytes=0};X.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=Fi(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};X.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};X.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};X.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=Dt.util.createBuffer(),this._partialBytes=0};X.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=Fi(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};X.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};X.ofb.prototype.decrypt=X.ofb.prototype.encrypt;X.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=Dt.util.createBuffer(),this._partialBytes=0};X.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=Fi(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};X.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}Mi(this._inBlock)};X.ctr.prototype.decrypt=X.ctr.prototype.encrypt;X.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=Dt.util.createBuffer(),this._partialBytes=0,this._R=3774873600};X.gcm.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");var e=Dt.util.createBuffer(t.iv);this._cipherLength=0;var r;if("additionalData"in t?r=Dt.util.createBuffer(t.additionalData):r=Dt.util.createBuffer(),"tagLength"in t?this._tagLength=t.tagLength:this._tagLength=128,this._tag=null,t.decrypt&&(this._tag=Dt.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(Is(n*8)))}this._inBlock=this._j0.slice(0),Mi(this._inBlock),this._partialBytes=0,r=Dt.util.createBuffer(r),this._aDataLength=Is(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()])};X.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),Mi(this._inBlock)};X.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),Mi(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};X.gcm.prototype.afterFinish=function(t,e){var r=!0;e.decrypt&&e.overflow&&t.truncate(this.blockSize-e.overflow),this.tag=Dt.util.createBuffer();var n=this._aDataLength.concat(Is(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};X.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};X.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)};X.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};X.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)};X.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],f=s/n|0,c=(n-1-s%n)*e;a[f]=1<<e-1<<c,o[s]=this.generateSubHashTable(this.multiply(a,t),e)}return o};X.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],f=i[s];i[o+s]=[a[0]^f[0],a[1]^f[1],a[2]^f[2],a[3]^f[3]]}o*=2}for(i[0]=[0,0,0,0],o=n+1;o<r;++o){var c=i[o^n];i[o]=[t[0]^c[0],t[1]^c[1],t[2]^c[2],t[3]^c[3]]}return i};function Fi(t,e){if(typeof t=="string"&&(t=Dt.util.createBuffer(t)),Dt.util.isArray(t)&&t.length>4){var r=t;t=Dt.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(!Dt.util.isArray(t)){for(var i=[],o=e/4,n=0;n<o;++n)i.push(t.getInt32());t=i}return t}function Mi(t){t[t.length-1]=t[t.length-1]+1&4294967295}function Is(t){return[t/4294967296|0,t&4294967295]}});var Ds=ft((g3,Df)=>{var lt=ut();Bs();Cs();It();Df.exports=lt.aes=lt.aes||{};lt.aes.startEncrypting=function(t,e,r,n){var i=Ki({key:t,output:r,decrypt:!1,mode:n});return i.start(e),i};lt.aes.createEncryptionCipher=function(t,e){return Ki({key:t,output:null,decrypt:!1,mode:e})};lt.aes.startDecrypting=function(t,e,r,n){var i=Ki({key:t,output:r,decrypt:!0,mode:n});return i.start(e),i};lt.aes.createDecryptionCipher=function(t,e){return Ki({key:t,output:null,decrypt:!0,mode:e})};lt.aes.Algorithm=function(t,e){Ls||Rf();var r=this;r.name=t,r.mode=new e({blockSize:16,cipher:{encrypt:function(n,i){return Rs(r._w,n,i,!1)},decrypt:function(n,i){return Rs(r._w,n,i,!0)}}}),r._init=!1};lt.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=lt.util.createBuffer(e);else if(lt.util.isArray(e)&&(e.length===16||e.length===24||e.length===32)){r=e,e=lt.util.createBuffer();for(var n=0;n<r.length;++n)e.putByte(r[n])}if(!lt.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(!lt.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=Lf(e,t.decrypt&&!s),this._init=!0}};lt.aes._expandKey=function(t,e){return Ls||Rf(),Lf(t,e)};lt.aes._updateBlock=Rs;tn("AES-ECB",lt.cipher.modes.ecb);tn("AES-CBC",lt.cipher.modes.cbc);tn("AES-CFB",lt.cipher.modes.cfb);tn("AES-OFB",lt.cipher.modes.ofb);tn("AES-CTR",lt.cipher.modes.ctr);tn("AES-GCM",lt.cipher.modes.gcm);function tn(t,e){var r=function(){return new lt.aes.Algorithm(t,e)};lt.cipher.registerAlgorithm(t,r)}var Ls=!1,jr=4,Ht,Ts,Tf,Er,ae;function Rf(){Ls=!0,Tf=[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),Ts=new Array(256),Er=new Array(4),ae=new Array(4);for(var e=0;e<4;++e)Er[e]=new Array(256),ae[e]=new Array(256);for(var r=0,n=0,i,o,s,a,f,c,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,Ts[a]=r,f=t[a],i=t[r],o=t[i],s=t[o],c=f<<24^a<<16^a<<8^(a^f),u=(i^o^s)<<24^(r^s)<<16^(r^o^s)<<8^(r^i^s);for(var h=0;h<4;++h)Er[h][r]=c,ae[h][a]=u,c=c<<24|c>>>8,u=u<<24|u>>>8;r===0?r=n=1:(r=i^t[t[t[i^s]]],n^=t[t[n]])}}function Lf(t,e){for(var r=t.slice(0),n,i=1,o=r.length,s=o+6+1,a=jr*s,f=o;f<a;++f)n=r[f-1],f%o===0?(n=Ht[n>>>16&255]<<24^Ht[n>>>8&255]<<16^Ht[n&255]<<8^Ht[n>>>24]^Tf[i]<<24,i++):o>6&&f%o===4&&(n=Ht[n>>>24]<<24^Ht[n>>>16&255]<<16^Ht[n>>>8&255]<<8^Ht[n&255]),r[f]=r[f-o]^n;if(e){var c,u=ae[0],h=ae[1],y=ae[2],p=ae[3],l=r.slice(0);a=r.length;for(var f=0,d=a-jr;f<a;f+=jr,d-=jr)if(f===0||f===a-jr)l[f]=r[d],l[f+1]=r[d+3],l[f+2]=r[d+2],l[f+3]=r[d+1];else for(var m=0;m<jr;++m)c=r[d+m],l[f+(3&-m)]=u[Ht[c>>>24]]^h[Ht[c>>>16&255]]^y[Ht[c>>>8&255]]^p[Ht[c&255]];r=l}return r}function Rs(t,e,r,n){var i=t.length/4-1,o,s,a,f,c;n?(o=ae[0],s=ae[1],a=ae[2],f=ae[3],c=Ts):(o=Er[0],s=Er[1],a=Er[2],f=Er[3],c=Ht);var u,h,y,p,l,d,m;u=e[0]^t[0],h=e[n?3:1]^t[1],y=e[2]^t[2],p=e[n?1:3]^t[3];for(var x=3,g=1;g<i;++g)l=o[u>>>24]^s[h>>>16&255]^a[y>>>8&255]^f[p&255]^t[++x],d=o[h>>>24]^s[y>>>16&255]^a[p>>>8&255]^f[u&255]^t[++x],m=o[y>>>24]^s[p>>>16&255]^a[u>>>8&255]^f[h&255]^t[++x],p=o[p>>>24]^s[u>>>16&255]^a[h>>>8&255]^f[y&255]^t[++x],u=l,h=d,y=m;r[0]=c[u>>>24]<<24^c[h>>>16&255]<<16^c[y>>>8&255]<<8^c[p&255]^t[++x],r[n?3:1]=c[h>>>24]<<24^c[y>>>16&255]<<16^c[p>>>8&255]<<8^c[u&255]^t[++x],r[2]=c[y>>>24]<<24^c[p>>>16&255]<<16^c[u>>>8&255]<<8^c[h&255]^t[++x],r[n?1:3]=c[p>>>24]<<24^c[u>>>16&255]<<16^c[h>>>8&255]<<8^c[y&255]^t[++x]}function Ki(t){t=t||{};var e=(t.mode||"CBC").toUpperCase(),r="AES-"+e,n;t.decrypt?n=lt.cipher.createDecipher(r,t.key):n=lt.cipher.createCipher(r,t.key);var i=n.start;return n.start=function(o,s){var a=null;s instanceof lt.util.ByteBuffer&&(a=s,s={}),s=s||{},s.output=a,s.iv=o,i.call(n,s)},n}});var Pf=ft((b3,Nf)=>{var yt=ut();Bs();Cs();It();Nf.exports=yt.des=yt.des||{};yt.des.startEncrypting=function(t,e,r,n){var i=Vi({key:t,output:r,decrypt:!1,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};yt.des.createEncryptionCipher=function(t,e){return Vi({key:t,output:null,decrypt:!1,mode:e})};yt.des.startDecrypting=function(t,e,r,n){var i=Vi({key:t,output:r,decrypt:!0,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};yt.des.createDecryptionCipher=function(t,e){return Vi({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 _f(r._keys,n,i,!1)},decrypt:function(n,i){return _f(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=qy(e),this._init=!0}};ve("DES-ECB",yt.cipher.modes.ecb);ve("DES-CBC",yt.cipher.modes.cbc);ve("DES-CFB",yt.cipher.modes.cfb);ve("DES-OFB",yt.cipher.modes.ofb);ve("DES-CTR",yt.cipher.modes.ctr);ve("3DES-ECB",yt.cipher.modes.ecb);ve("3DES-CBC",yt.cipher.modes.cbc);ve("3DES-CFB",yt.cipher.modes.cfb);ve("3DES-OFB",yt.cipher.modes.ofb);ve("3DES-CTR",yt.cipher.modes.ctr);function ve(t,e){var r=function(){return new yt.des.Algorithm(t,e)};yt.cipher.registerAlgorithm(t,r)}var ky=[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],Uy=[-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],Oy=[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],Fy=[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],My=[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],Ky=[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],Vy=[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],zy=[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 qy(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],f=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],c=[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],h=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],y=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],p=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],l=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],d=t.length()>8?3:1,m=[],x=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],g=0,b,A=0;A<d;A++){var w=t.getInt32(),E=t.getInt32();b=(w>>>4^E)&252645135,E^=b,w^=b<<4,b=(E>>>-16^w)&65535,w^=b,E^=b<<-16,b=(w>>>2^E)&858993459,E^=b,w^=b<<2,b=(E>>>-16^w)&65535,w^=b,E^=b<<-16,b=(w>>>1^E)&1431655765,E^=b,w^=b<<1,b=(E>>>8^w)&16711935,w^=b,E^=b<<8,b=(w>>>1^E)&1431655765,E^=b,w^=b<<1,b=w<<8|E>>>20&240,w=E<<24|E<<8&16711680|E>>>8&65280|E>>>24&240,E=b;for(var B=0;B<x.length;++B){x[B]?(w=w<<2|w>>>26,E=E<<2|E>>>26):(w=w<<1|w>>>27,E=E<<1|E>>>27),w&=-15,E&=-15;var C=e[w>>>28]|r[w>>>24&15]|n[w>>>20&15]|i[w>>>16&15]|o[w>>>12&15]|s[w>>>8&15]|a[w>>>4&15],M=f[E>>>28]|c[E>>>24&15]|u[E>>>20&15]|h[E>>>16&15]|y[E>>>12&15]|p[E>>>8&15]|l[E>>>4&15];b=(M>>>16^C)&65535,m[g++]=C^b,m[g++]=M^b<<16}}return m}function _f(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],f=e[1];s=(a>>>4^f)&252645135,f^=s,a^=s<<4,s=(a>>>16^f)&65535,f^=s,a^=s<<16,s=(f>>>2^a)&858993459,a^=s,f^=s<<2,s=(f>>>8^a)&16711935,a^=s,f^=s<<8,s=(a>>>1^f)&1431655765,f^=s,a^=s<<1,a=a<<1|a>>>31,f=f<<1|f>>>31;for(var c=0;c<i;c+=3){for(var u=o[c+1],h=o[c+2],y=o[c];y!=u;y+=h){var p=f^t[y],l=(f>>>4|f<<28)^t[y+1];s=a,a=f,f=s^(Uy[p>>>24&63]|Fy[p>>>16&63]|Ky[p>>>8&63]|zy[p&63]|ky[l>>>24&63]|Oy[l>>>16&63]|My[l>>>8&63]|Vy[l&63])}s=a,a=f,f=s}a=a>>>1|a<<31,f=f>>>1|f<<31,s=(a>>>1^f)&1431655765,f^=s,a^=s<<1,s=(f>>>8^a)&16711935,a^=s,f^=s<<8,s=(f>>>2^a)&858993459,a^=s,f^=s<<2,s=(a>>>16^f)&65535,f^=s,a^=s<<16,s=(a>>>4^f)&252645135,f^=s,a^=s<<4,r[0]=a,r[1]=f}function Vi(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 Sr=ft((v3,kf)=>{var zi=ut();kf.exports=zi.md=zi.md||{};zi.md.algorithms=zi.md.algorithms||{}});var Of=ft((w3,Uf)=>{var Ne=ut();Sr();It();var Hy=Uf.exports=Ne.hmac=Ne.hmac||{};Hy.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 Ne.md.algorithms)e=Ne.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=Ne.util.createBuffer(s);else if(Ne.util.isArray(s)){var a=s;s=Ne.util.createBuffer();for(var f=0;f<a.length;++f)s.putByte(a[f])}var c=s.length();c>e.blockLength&&(e.start(),e.update(s.bytes()),s=e.digest()),r=Ne.util.createBuffer(),n=Ne.util.createBuffer(),c=s.length();for(var f=0;f<c;++f){var a=s.at(f);r.putByte(54^a),n.putByte(92^a)}if(c<e.blockLength)for(var a=e.blockLength-c,f=0;f<a;++f)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 qi=ft(()=>{});var Mf=ft((A3,Ff)=>{var $t=ut();Of();Sr();It();var $y=$t.pkcs5=$t.pkcs5||{},Pe;$t.util.isNodejs&&!$t.options.usePureJavaScript&&(Pe=qi());Ff.exports=$t.pbkdf2=$y.pbkdf2=function(t,e,r,n,i,o){if(typeof i=="function"&&(o=i,i=null),$t.util.isNodejs&&!$t.options.usePureJavaScript&&Pe.pbkdf2&&(i===null||typeof i!="object")&&(Pe.pbkdf2Sync.length>4||!i||i==="sha1"))return typeof i!="string"&&(i="sha1"),t=Buffer.from(t,"binary"),e=Buffer.from(e,"binary"),o?Pe.pbkdf2Sync.length===4?Pe.pbkdf2(t,e,r,n,function(b,A){if(b)return o(b);o(null,A.toString("binary"))}):Pe.pbkdf2(t,e,r,n,i,function(b,A){if(b)return o(b);o(null,A.toString("binary"))}):Pe.pbkdf2Sync.length===4?Pe.pbkdf2Sync(t,e,r,n).toString("binary"):Pe.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 f=Math.ceil(n/s),c=n-(f-1)*s,u=$t.hmac.create();u.start(i,t);var h="",y,p,l;if(!o){for(var d=1;d<=f;++d){u.start(null,null),u.update(e),u.update($t.util.int32ToBytes(d)),y=l=u.digest().getBytes();for(var m=2;m<=r;++m)u.start(null,null),u.update(l),p=u.digest().getBytes(),y=$t.util.xorBytes(y,p,s),l=p;h+=d<f?y:y.substr(0,c)}return h}var d=1,m;function x(){if(d>f)return o(null,h);u.start(null,null),u.update(e),u.update($t.util.int32ToBytes(d)),y=l=u.digest().getBytes(),m=2,g()}function g(){if(m<=r)return u.start(null,null),u.update(l),p=u.digest().getBytes(),y=$t.util.xorBytes(y,p,s),l=p,++m,$t.util.setImmediate(g);h+=d<f?y:y.substr(0,c),++d,x()}x()}});var zf=ft((B3,Vf)=>{var $i=ut();It();var Kf=Vf.exports=$i.pem=$i.pem||{};Kf.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+=Hi(n)),t.contentDomain&&(n={name:"Content-Domain",values:[t.contentDomain]},r+=Hi(n)),t.dekInfo&&(n={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&n.values.push(t.dekInfo.parameters),r+=Hi(n)),t.headers)for(var i=0;i<t.headers.length;++i)r+=Hi(t.headers[i]);return t.procType&&(r+=`\r
|
|
10
|
+
`),r+=$i.util.encode64(t.body,e.maxline||64)+`\r
|
|
11
11
|
`,r+="-----END "+t.type+`-----\r
|
|
12
|
-
`,r};
|
|
12
|
+
`,r};Kf.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:$i.util.decode64(o[3])};if(e.push(a),!!o[2]){for(var f=o[2].split(i),c=0;o&&c<f.length;){for(var u=f[c].replace(/\s+$/,""),h=c+1;h<f.length;++h){var y=f[h];if(!/\s/.test(y[0]))break;u+=y,c=h}if(o=u.match(n),o){for(var p={name:o[1],values:[]},l=o[2].split(","),d=0;d<l.length;++d)p.values.push(Gy(l[d]));if(a.procType)if(!a.contentDomain&&p.name==="Content-Domain")a.contentDomain=l[0]||"";else if(!a.dekInfo&&p.name==="DEK-Info"){if(p.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');a.dekInfo={algorithm:l[0],parameters:l[1]||null}}else a.headers.push(p);else{if(p.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(p.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');a.procType={version:l[0],type:l[1]}}}++c}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 Hi(t){for(var e=t.name+": ",r=[],n=function(f,c){return" "+c},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 Wl(t){return t.replace(/^\s+/,"")}});var c0=ft((Zg,f0)=>{var xe=ct();fr();wt();var o0=f0.exports=xe.sha256=xe.sha256||{};xe.md.sha256=xe.md.algorithms.sha256=o0;o0.create=function(){s0||Yl();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),i0(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(Eo.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};i0(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 Eo=null,s0=!1,a0=null;function Yl(){Eo="\x80",Eo+=xe.util.fillString("\0",64),a0=[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],s0=!0}function i0(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+a0[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 l0=ft((Qg,u0)=>{var me=ct();wt();var $n=null;me.util.isNodejs&&!me.options.usePureJavaScript&&!process.versions["node-webkit"]&&($n=qn());var Zl=u0.exports=me.prng=me.prng||{};Zl.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,v,_=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)v=_>>>(g<<3),v^=Math.floor(Math.random()*256),d.putByte(v&255)}return d.getBytes(f)}return $n?(e.seedFile=function(f,u){$n.randomBytes(f,function(l,p){if(l)return u(l);u(null,p.toString())})},e.seedFileSync=function(f){return $n.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 ln=ft((Xg,So)=>{var _t=ct();wo();c0();l0();wt();(function(){if(_t.random&&_t.random.getBytes){So.exports=_t.random;return}(function(t){var e={},r=new Array(4),n=_t.util.createBuffer();e.formatKey=function(l){var p=_t.util.createBuffer(l);return l=new Array(4),l[0]=p.getInt32(),l[1]=p.getInt32(),l[2]=p.getInt32(),l[3]=p.getInt32(),_t.aes._expandKey(l,!1)},e.formatSeed=function(l){var p=_t.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 _t.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=_t.md.sha256;function i(){var l=_t.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=_t.util.globalScope,c=a.crypto||a.msCrypto;if(c&&c.getRandomValues&&(s=function(l){return c.getRandomValues(l)}),_t.options.usePureJavaScript||!_t.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(!_t.random)_t.random=o;else for(var u in o)_t.random[u]=o[u];_t.random.createInstance=i,So.exports=_t.random})(typeof jQuery<"u"?jQuery:null)})()});var y0=ft((Jg,p0)=>{var qt=ct();wt();var Bo=[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],h0=[1,2,3,5],Ql=function(t,e){return t<<e&65535|(t&65535)>>16-e},Xl=function(t,e){return(t&65535)>>e|t<<16-e&65535};p0.exports=qt.rc2=qt.rc2||{};qt.rc2.expandKey=function(t,e){typeof t=="string"&&(t=qt.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(Bo[r.at(a-1)+r.at(a-n)&255]);for(r.setAt(128-o,Bo[r.at(128-o)&s]),a=127-o;a>=0;a--)r.setAt(a,Bo[r.at(a+1)^r.at(a+o)]);return r};var d0=function(t,e,r){var n=!1,i=null,o=null,s=null,a,c,f,u,l=[];for(t=qt.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]=Ql(h[f],h0[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]=Xl(h[f],h0[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=qt.util.createBuffer(h)),n=!1,i=qt.util.createBuffer(),o=y||new qt.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};qt.rc2.startEncrypting=function(t,e,r){var n=qt.rc2.createEncryptionCipher(t,128);return n.start(e,r),n};qt.rc2.createEncryptionCipher=function(t,e){return d0(t,e,!0)};qt.rc2.startDecrypting=function(t,e,r){var n=qt.rc2.createDecryptionCipher(t,128);return n.start(e,r),n};qt.rc2.createDecryptionCipher=function(t,e){return d0(t,e,!1)}});var Yn=ft((jg,S0)=>{var Ao=ct();S0.exports=Ao.jsbn=Ao.jsbn||{};var Ce,Jl=0xdeadbeefcafe,g0=(Jl&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))}Ao.jsbn.BigInteger=I;function et(){return new I(null)}function jl(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 th(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 x0(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=x0,Ce=28):g0&&navigator.appName=="Microsoft Internet Explorer"?(I.prototype.am=th,Ce=30):g0&&navigator.appName!="Netscape"?(I.prototype.am=jl,Ce=26):(I.prototype.am=x0,Ce=28);I.prototype.DB=Ce;I.prototype.DM=(1<<Ce)-1;I.prototype.DV=1<<Ce;var Io=52;I.prototype.FV=Math.pow(2,Io);I.prototype.F1=Io-Ce;I.prototype.F2=2*Ce-Io;var eh="0123456789abcdefghijklmnopqrstuvwxyz",Gn=new Array,kr,Jt;kr=48;for(Jt=0;Jt<=9;++Jt)Gn[kr++]=Jt;kr=97;for(Jt=10;Jt<36;++Jt)Gn[kr++]=Jt;kr=65;for(Jt=10;Jt<36;++Jt)Gn[kr++]=Jt;function m0(t){return eh.charAt(t)}function b0(t,e){var r=Gn[t.charCodeAt(e)];return r??-1}function rh(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 nh(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 ih(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:b0(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 oh(){for(var t=this.s&this.DM;this.t>0&&this.data[this.t-1]==t;)--this.t}function sh(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=m0(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+=m0(n));return i?o:"0"}function ah(){var t=et();return I.ZERO.subTo(this,t),t}function fh(){return this.s<0?this.negate():this}function ch(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 Wn(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 uh(){return this.t<=0?0:this.DB*(this.t-1)+Wn(this.data[this.t-1]^this.s&this.DM)}function lh(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 hh(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 dh(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 ph(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 yh(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 gh(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 xh(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 mh(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-Wn(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 bh(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 vh(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function wh(t){return t}function Eh(t){t.divRemTo(this.m,null,t)}function Sh(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function Bh(t,e){t.squareTo(e),this.reduce(e)}cr.prototype.convert=vh;cr.prototype.revert=wh;cr.prototype.reduce=Eh;cr.prototype.mulTo=Sh;cr.prototype.sqrTo=Bh;function Ah(){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 Ih(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 Th(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 _h(t,e){t.squareTo(e),this.reduce(e)}function Rh(t,e,r){t.multiplyTo(e,r),this.reduce(r)}ur.prototype.convert=Ih;ur.prototype.revert=Th;ur.prototype.reduce=Ch;ur.prototype.mulTo=Rh;ur.prototype.sqrTo=_h;function Lh(){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=Wn(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=rh;I.prototype.fromInt=nh;I.prototype.fromString=ih;I.prototype.clamp=oh;I.prototype.dlShiftTo=lh;I.prototype.drShiftTo=hh;I.prototype.lShiftTo=dh;I.prototype.rShiftTo=ph;I.prototype.subTo=yh;I.prototype.multiplyTo=gh;I.prototype.squareTo=xh;I.prototype.divRemTo=mh;I.prototype.invDigit=Ah;I.prototype.isEven=Lh;I.prototype.exp=Dh;I.prototype.toString=sh;I.prototype.negate=ah;I.prototype.abs=fh;I.prototype.compareTo=ch;I.prototype.bitLength=uh;I.prototype.mod=bh;I.prototype.modPowInt=Ph;I.ZERO=We(0);I.ONE=We(1);function kh(){var t=et();return this.copyTo(t),t}function Nh(){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 Uh(){return this.t==0?this.s:this.data[0]<<24>>24}function Oh(){return this.t==0?this.s:this.data[0]<<16>>16}function Kh(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function Fh(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function Mh(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 Vh(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=b0(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 qh(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),To,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 Hh(){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 zh(t){return this.compareTo(t)==0}function $h(t){return this.compareTo(t)<0?this:t}function Gh(t){return this.compareTo(t)>0?this:t}function Wh(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 Yh(t,e){return t&e}function Zh(t){var e=et();return this.bitwiseTo(t,Yh,e),e}function To(t,e){return t|e}function Qh(t){var e=et();return this.bitwiseTo(t,To,e),e}function v0(t,e){return t^e}function Xh(t){var e=et();return this.bitwiseTo(t,v0,e),e}function w0(t,e){return t&~e}function Jh(t){var e=et();return this.bitwiseTo(t,w0,e),e}function jh(){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 td(t){var e=et();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}function ed(t){var e=et();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}function rd(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 nd(){for(var t=0;t<this.t;++t)if(this.data[t]!=0)return t*this.DB+rd(this.data[t]);return this.s<0?this.t*this.DB:-1}function id(t){for(var e=0;t!=0;)t&=t-1,++e;return e}function od(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=id(this.data[r]^e);return t}function sd(t){var e=Math.floor(t/this.DB);return e>=this.t?this.s!=0:(this.data[e]&1<<t%this.DB)!=0}function ad(t,e){var r=I.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r}function fd(t){return this.changeBit(t,To)}function cd(t){return this.changeBit(t,w0)}function ud(t){return this.changeBit(t,v0)}function ld(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 hd(t){var e=et();return this.addTo(t,e),e}function dd(t){var e=et();return this.subTo(t,e),e}function pd(t){var e=et();return this.multiplyTo(t,e),e}function yd(t){var e=et();return this.divRemTo(t,e,null),e}function gd(t){var e=et();return this.divRemTo(t,null,e),e}function xd(t){var e=et(),r=et();return this.divRemTo(t,e,r),new Array(e,r)}function md(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function bd(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 hn(){}function E0(t){return t}function vd(t,e,r){t.multiplyTo(e,r)}function wd(t,e){t.squareTo(e)}hn.prototype.convert=E0;hn.prototype.revert=E0;hn.prototype.mulTo=vd;hn.prototype.sqrTo=wd;function Ed(t){return this.exp(t,new hn)}function Sd(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 Bd(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 Nr(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 Ad(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 Id(t){return t}function Td(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 _d(t,e,r){t.multiplyTo(e,r),this.reduce(r)}Nr.prototype.convert=Ad;Nr.prototype.revert=Id;Nr.prototype.reduce=Td;Nr.prototype.mulTo=_d;Nr.prototype.sqrTo=Cd;function Rd(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 Nr(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=Wn(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 Ld(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 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],kd=(1<<26)/ie[ie.length-1];function Nd(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<kd;)n*=ie[i++];for(n=r.modInt(n);e<i;)if(n%ie[e++]==0)return!1}return r.millerRabin(t)}function Ud(t){var e=this.subtract(I.ONE),r=e.getLowestSetBit();if(r<=0)return!1;for(var n=e.shiftRight(r),i=Od(),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 Od(){return{nextBytes:function(t){for(var e=0;e<t.length;++e)t[e]=Math.floor(Math.random()*256)}}}I.prototype.chunkSize=Kh;I.prototype.toRadix=Mh;I.prototype.fromRadix=Vh;I.prototype.fromNumber=qh;I.prototype.bitwiseTo=Wh;I.prototype.changeBit=ad;I.prototype.addTo=ld;I.prototype.dMultiply=md;I.prototype.dAddOffset=bd;I.prototype.multiplyLowerTo=Sd;I.prototype.multiplyUpperTo=Bd;I.prototype.modInt=Dd;I.prototype.millerRabin=Ud;I.prototype.clone=kh;I.prototype.intValue=Nh;I.prototype.byteValue=Uh;I.prototype.shortValue=Oh;I.prototype.signum=Fh;I.prototype.toByteArray=Hh;I.prototype.equals=zh;I.prototype.min=$h;I.prototype.max=Gh;I.prototype.and=Zh;I.prototype.or=Qh;I.prototype.xor=Xh;I.prototype.andNot=Jh;I.prototype.not=jh;I.prototype.shiftLeft=td;I.prototype.shiftRight=ed;I.prototype.getLowestSetBit=nd;I.prototype.bitCount=od;I.prototype.testBit=sd;I.prototype.setBit=fd;I.prototype.clearBit=cd;I.prototype.flipBit=ud;I.prototype.add=hd;I.prototype.subtract=dd;I.prototype.multiply=pd;I.prototype.divide=yd;I.prototype.remainder=gd;I.prototype.divideAndRemainder=xd;I.prototype.modPow=Rd;I.prototype.modInverse=Pd;I.prototype.pow=Ed;I.prototype.gcd=Ld;I.prototype.isProbablePrime=Nd});var C0=ft((tx,T0)=>{var be=ct();fr();wt();var A0=T0.exports=be.sha1=be.sha1||{};be.md.sha1=be.md.algorithms.sha1=A0;A0.create=function(){I0||Kd();var t=null,e=be.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=be.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},n},n.start(),n.update=function(i,o){o==="utf8"&&(i=be.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),B0(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var i=be.util.createBuffer();i.putBytes(e.bytes());var o=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,s=o&n.blockLength-1;i.putBytes(Co.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};B0(l,r,i);var p=be.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 Co=null,I0=!1;function Kd(){Co="\x80",Co+=be.util.fillString("\0",64),I0=!0}function B0(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 L0=ft((ex,R0)=>{var ve=ct();wt();ln();C0();var _0=R0.exports=ve.pkcs1=ve.pkcs1||{};_0.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=ve.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=ve.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=Zn(i,a-o.digestLength-1,s),g=ve.util.xorBytes(h,y,h.length),x=Zn(g,o.digestLength,s),m=ve.util.xorBytes(i,x,i.length);return"\0"+m+g};_0.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=ve.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=Zn(u,i.digestLength,o),p=ve.util.xorBytes(f,l,f.length),d=Zn(p,s-i.digestLength-1,o),h=ve.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,v=i.digestLength,_=i.digestLength;_<h.length;_++){var E=h.charCodeAt(_),S=E&1^1,L=m?65534:0;g|=E&L,m=m&S,v+=m}if(g||h.charCodeAt(v)!==1)throw new Error("Invalid RSAES-OAEP padding.");return h.substring(v+1)};function Zn(t,e,r){r||(r=ve.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 D0=ft((rx,_o)=>{var Ye=ct();wt();Yn();ln();(function(){if(Ye.prime){_o.exports=Ye.prime;return}var t=_o.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),v=0;v<x.length;++v)x[v]=m.charCodeAt(v)}};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,v=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(v);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 Xn=ft((nx,F0)=>{var F=ct();un();Yn();Nn();L0();D0();ln();wt();typeof tt>"u"&&(tt=F.jsbn.BigInteger);var tt,Ro=F.util.isNodejs?qn():null,w=F.asn1,jt=F.util;F.pki=F.pki||{};F0.exports=F.pki.rsa=F.rsa=F.rsa||{};var z=F.pki,Fd=[6,4,2,4,2,4,6,2],Md={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"}]},Vd={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"}]},qd={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"}]},Hd=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"}]}]},zd={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"}]},$d=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()},O0=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=K0(t,e,r)):(i=F.util.createBuffer(),i.putBytes(t));for(var s=new tt(i.toHex(),16),a=O0(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=O0(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?Qn(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(Wd(t.num.bitLength()))?++t.pqState:t.num.dAddOffset(Fd[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(P0("generateKeyPair"))return Ro.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(k0("generateKey")&&k0("exportKey"))return jt.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:U0(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(N0("generateKey")&&N0("exportKey")){var i=jt.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:U0(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(P0("generateKeyPairSync")){var o=Ro.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;Gd(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 K0(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=Qn(f,r,!0);var u=w.fromDer(f,{parseAllBytes:s._parseAllDigestBytes}),l={},p=[];if(!w.validate(u,zd,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=Qn(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:Qn};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:$d},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,Md,e,r)&&(t=w.fromDer(F.util.createBuffer(e.privateKey))),e={},r=[],!w.validate(t,Vd,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,Hd,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,qd,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 K0(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 Qn(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 Gd(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 Wd(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 P0(t){return F.util.isNodejs&&typeof Ro[t]=="function"}function k0(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 N0(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 U0(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 $0=ft((ix,z0)=>{var U=ct();wo();un();Za();fr();Nn();t0();n0();ln();y0();Xn();wt();typeof M0>"u"&&(M0=U.jsbn.BigInteger);var M0,B=U.asn1,G=U.pki=U.pki||{};z0.exports=G.pbe=U.pbe=U.pbe||{};var lr=G.oids,Yd={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"}]},Zd={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"}]}]},Qd={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=H0(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=Xd(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 v=new U.util.ByteBuffer(n),y=G.pbe.generatePkcs12Key(e,v,1,i,s),g=G.pbe.generatePkcs12Key(e,v,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,Yd,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 v=g;v.putBuffer(m);for(var _=Math.ceil(i/c),E=1;E<=_;E++){var S=new U.util.ByteBuffer;S.putBytes(h.bytes()),S.putBytes(v.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(v.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)}v=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,Zd,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=q0(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,Qd,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=q0(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=[V0(n,t+e)],o=16,s=1;o<r;++s,o+=16)i.push(V0(n,i[s-1]+t+e));return i.join("").substr(0,r)};function V0(t,e){return t.start().update(e).digest().getBytes()}function q0(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 H0(e)}function H0(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 Xd(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 Ff=ft((Lb,Kf)=>{var dt=ct();fr();wt();var vn=Kf.exports=dt.sha512=dt.sha512||{};dt.md.sha512=dt.md.algorithms.sha512=vn;var Uf=dt.sha384=dt.sha512.sha384=dt.sha512.sha384||{};Uf.create=function(){return vn.create("SHA-384")};dt.md.sha384=dt.md.algorithms.sha384=Uf;dt.sha512.sha256=dt.sha512.sha256||{create:function(){return vn.create("SHA-512/256")}};dt.md["sha512/256"]=dt.md.algorithms["sha512/256"]=dt.sha512.sha256;dt.sha512.sha224=dt.sha512.sha224||{create:function(){return vn.create("SHA-512/224")}};dt.md["sha512/224"]=dt.md.algorithms["sha512/224"]=dt.sha512.sha224;vn.create=function(t){if(Of||b1(),typeof t>"u"&&(t="SHA-512"),!(t in wr))throw new Error("Invalid SHA-512 algorithm: "+t);for(var e=wr[t],r=null,n=dt.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=dt.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=dt.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),Nf(r,i,n),(n.read>2048||n.length()===0)&&n.compact(),a},a.digest=function(){var c=dt.util.createBuffer();c.putBytes(n.bytes());var f=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,u=f&a.blockLength-1;c.putBytes(us.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);Nf(y,i,c);var g=dt.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 us=null,Of=!1,ls=null,wr=null;function b1(){us="\x80",us+=dt.util.fillString("\0",128),ls=[[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]],wr={},wr["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],wr["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],wr["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],wr["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],Of=!0}function Nf(t,e,r){for(var n,i,o,s,a,c,f,u,l,p,d,h,y,g,x,m,v,_,E,S,L,D,H,q,M,X,at,Lt,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],v=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],Lt=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|v&(y^x))>>>0,h=(g&m|_&(g^m))>>>0,R=Lt+u+p+ls[T][1]+e[T][1],n=at+f+l+ls[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,Lt=X,M=H,X=q,H=L,q=D,R=S+i,L=E+n+(R/4294967296>>>0)>>>0,D=R>>>0,E=v,S=_,v=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]+v+(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]+Lt,t[7][0]=t[7][0]+at+(R/4294967296>>>0)>>>0,t[7][1]=R>>>0,V-=128}}});var Hc=ft((s8,qc)=>{"use strict";function Vc(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function By(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 Vc(t,r)}catch{r.message=t.message,r.stack=t.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(t)),Vc(new i,r)}}qc.exports=By});var Zc=ft(_n=>{(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}(),_n.ip2long=s,_n.long2ip=a,_n.Netmask=t}).call(_n)});var jc=ft((Jc,ki)=>{(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,v;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(v=h-y,m=":";v--;)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,v;for(x=3;x>=0;x-=1)if(m=this.octets[x],m in g){if(v=g[m],y&&v!==0)return null;v!==8&&(y=!0),h+=v}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 v=0;v<x.length;v++)y=x[v],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 v=7;v>=0;v-=1)if(x=this.parts[v],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(v){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${v})`)}},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,v;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))&&(v=g[6]||"",h=c(g[1].slice(0,-1)+v,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,v;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(v=m[g],d.kind()===v[0].kind()&&d.match.apply(d,v))return x}return y},typeof ki<"u"&&ki.exports?ki.exports=p:t.ipaddr=p})(Jc)});var Qy={};It(Qy,{autoNAT:()=>Zy});var Jy=Symbol.for("@libp2p/connection");var t2=Symbol.for("@libp2p/content-routing");var n2=Symbol.for("@libp2p/peer-discovery");var sa=Symbol.for("@libp2p/peer-id");var s2=Symbol.for("@libp2p/peer-routing");var aa;(function(t){t.Accept="accept",t.Ignore="ignore",t.Reject="reject"})(aa||(aa={}));var u2=Symbol.for("@libp2p/transport");var fa;(function(t){t[t.FATAL_ALL=0]="FATAL_ALL",t[t.NO_FATAL=1]="NO_FATAL"})(fa||(fa={}));var $=class extends Error{code;props;constructor(e,r,n){super(e),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var Oi="ERR_TIMEOUT";var Ki=class extends Event{detail;constructor(e,r){super(e,r),this.detail=r?.detail}},d2=globalThis.CustomEvent??Ki;var Fi=(t,...e)=>{try{[...e]}catch{}};var zi={};It(zi,{base58btc:()=>Bt,base58flickr:()=>Iu});function wu(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 v=(m-x)*u+1>>>0,_=new Uint8Array(v);x!==m;){for(var E=h[x],S=0,L=v-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=v-g;D!==v&&_[D]===0;)D++;for(var H=c.repeat(y);D<v;++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,v=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*v[S]>>>0,v[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&&v[L]===0;)L++;for(var D=new Uint8Array(g+(m-L)),H=g;L!==m;)D[H++]=v[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 Eu=wu,Su=Eu,ca=Su;var z2=new Uint8Array(0);var ua=(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},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")};var la=t=>new TextEncoder().encode(t),ha=t=>new TextDecoder().decode(t);var Mi=class{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")}},Vi=class{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 pa(this,e)}},qi=class{constructor(e){this.decoders=e}or(e){return pa(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},pa=(t,e)=>new qi({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),Hi=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Mi(e,r,n),this.decoder=new Vi(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Ar=({name:t,prefix:e,encode:r,decode:n})=>new Hi(t,e,r,n),He=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=ca(r,e);return Ar({prefix:t,name:e,encode:n,decode:o=>Be(i(o))})},Bu=(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},Au=(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&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o},mt=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Ar({prefix:e,name:t,encode(i){return Au(i,n,r)},decode(i){return Bu(i,n,r,t)}});var Bt=He({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Iu=He({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var $i={};It($i,{base10:()=>Tu});var Tu=He({prefix:"9",name:"base10",alphabet:"0123456789"});var Gi={};It(Gi,{base16:()=>Cu,base16upper:()=>_u});var Cu=mt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),_u=mt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Wi={};It(Wi,{base2:()=>Ru});var Ru=mt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Yi={};It(Yi,{base256emoji:()=>Nu});var ya=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}"),Lu=ya.reduce((t,e,r)=>(t[r]=e,t),[]),Du=ya.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Pu(t){return t.reduce((e,r)=>(e+=Lu[r],e),"")}function ku(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 Nu=Ar({prefix:"\u{1F680}",name:"base256emoji",encode:Pu,decode:ku});var Zi={};It(Zi,{base32:()=>Ae,base32hex:()=>Fu,base32hexpad:()=>Vu,base32hexpadupper:()=>qu,base32hexupper:()=>Mu,base32pad:()=>Ou,base32padupper:()=>Ku,base32upper:()=>Uu,base32z:()=>Hu});var Ae=mt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Uu=mt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ou=mt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ku=mt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Fu=mt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Mu=mt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Vu=mt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),qu=mt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Hu=mt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Qi={};It(Qi,{base36:()=>zu,base36upper:()=>$u});var zu=He({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),$u=He({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Xi={};It(Xi,{base64:()=>Ln,base64pad:()=>Gu,base64url:()=>Wu,base64urlpad:()=>Yu});var Ln=mt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Gu=mt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Wu=mt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Yu=mt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ji={};It(Ji,{base8:()=>Zu});var Zu=mt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ji={};It(ji,{identity:()=>Qu});var Qu=Ar({prefix:"\0",name:"identity",encode:t=>ha(t),decode:t=>la(t)});var og=new TextEncoder,sg=new TextDecoder;var eo={};It(eo,{identity:()=>ze});var ju=ma,ga=128,tl=127,el=~tl,rl=Math.pow(2,31);function ma(t,e,r){e=e||[],r=r||0;for(var n=r;t>=rl;)e[r++]=t&255|ga,t/=128;for(;t⪙)e[r++]=t&255|ga,t>>>=7;return e[r]=t|0,ma.bytes=r-n+1,e}var nl=to,il=128,xa=127;function to(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw to.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&xa)<<i:(s&xa)*Math.pow(2,i),i+=7}while(s>=il);return to.bytes=o-n,r}var ol=Math.pow(2,7),sl=Math.pow(2,14),al=Math.pow(2,21),fl=Math.pow(2,28),cl=Math.pow(2,35),ul=Math.pow(2,42),ll=Math.pow(2,49),hl=Math.pow(2,56),dl=Math.pow(2,63),pl=function(t){return t<ol?1:t<sl?2:t<al?3:t<fl?4:t<cl?5:t<ul?6:t<ll?7:t<hl?8:t<dl?9:10},yl={encode:ju,decode:nl,encodingLength:pl},gl=yl,rn=gl;var nn=(t,e=0)=>[rn.decode(t,e),rn.decode.bytes],Ir=(t,e,r=0)=>(rn.encode(t,e,r),e),Tr=t=>rn.encodingLength(t);var ye=(t,e)=>{let r=e.byteLength,n=Tr(t),i=n+Tr(r),o=new Uint8Array(i+r);return Ir(t,o,0),Ir(r,o,n),o.set(e,i),new Cr(t,r,e,o)},or=t=>{let e=Be(t),[r,n]=nn(e),[i,o]=nn(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Cr(r,i,s,e)},ba=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&ua(t.bytes,r.bytes)}},Cr=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var va=0,xl="identity",wa=Be,ml=t=>ye(va,wa(t)),ze={code:va,name:xl,encode:wa,digest:ml};var io={};It(io,{sha256:()=>kt,sha512:()=>bl});var no=({name:t,code:e,encode:r})=>new ro(t,e,r),ro=class{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")}};var Sa=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),kt=no({name:"sha2-256",code:18,encode:Sa("SHA-256")}),bl=no({name:"sha2-512",code:19,encode:Sa("SHA-512")});var Ba=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return wl(r,oo(t),e||Bt.encoder);default:return El(r,oo(t),e||Ae.encoder)}};var Aa=new WeakMap,oo=t=>{let e=Aa.get(t);if(e==null){let r=new Map;return Aa.set(t,r),r}return e},re=class t{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!==on)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Sl)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&&e.code===n.code&&e.version===n.version&&ba(e.multihash,n.multihash)}toString(e){return Ba(this,e)}toJSON(){return{"/":Ba(this)}}link(){return this}get[Symbol.toStringTag](){return"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||Ia(n,i,o.bytes))}else if(r[Bl]===!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!==on)throw new Error(`Version 0 CID must use dag-pb (code: ${on}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=Ia(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,on,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)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 Cr(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]=nn(e.subarray(r));return r+=p,l},i=n(),o=on;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]=vl(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 oo(o).set(n,e),o}},vl=(t,e)=>{switch(t[0]){case"Q":{let r=e||Bt;return[Bt.prefix,r.decode(`${Bt.prefix}${t}`)]}case Bt.prefix:{let r=e||Bt;return[Bt.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)]}}},wl=(t,e,r)=>{let{prefix:n}=r;if(n!==Bt.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},El=(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},on=112,Sl=18,Ia=(t,e,r)=>{let n=Tr(t),i=n+Tr(e),o=new Uint8Array(i+r.byteLength);return Ir(t,o,0),Ir(e,o,n),o.set(r,i),o},Bl=Symbol.for("@ipld/js-cid/CID");var Vt={...ji,...Wi,...Ji,...$i,...Gi,...Zi,...Qi,...zi,...Xi,...Yi},Eg={...io,...eo};function Yt(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 Al=Symbol.for("nodejs.util.inspect.custom"),Ta=Object.values(Vt).map(t=>t.decoder).reduce((t,e)=>t.or(e),Vt.identity.decoder),Ca=114,so=36,ao=37,sn=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()})`}[sa]=!0;toString(){return this.string==null&&(this.string=Bt.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return re.createV1(Ca,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return Yt(this.multihash.bytes,e);if(typeof e=="string")return Il(e).equals(this);if(e?.multihash?.bytes!=null)return Yt(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[Al](){return`PeerId(${this.toString()})`}},_r=class extends sn{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},Rr=class extends sn{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},Lr=class extends sn{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}};function Il(t,e){if(e=e??Ta,t.charAt(0)==="1"||t.charAt(0)==="Q"){let r=or(Bt.decode(`z${t}`));return t.startsWith("12D")?new Rr({multihash:r}):t.startsWith("16U")?new Lr({multihash:r}):new _r({multihash:r})}return Pn(Ta.decode(t))}function Pn(t){try{let e=or(t);if(e.code===ze.code){if(e.digest.length===so)return new Rr({multihash:e});if(e.digest.length===ao)return new Lr({multihash:e})}if(e.code===kt.code)return new _r({multihash:e})}catch{return Tl(re.decode(t))}throw new Error("Supplied PeerID CID is invalid")}function Tl(t){if(t==null||t.multihash==null||t.version==null||t.version===1&&t.code!==Ca)throw new Error("Supplied PeerID CID is invalid");let e=t.multihash;if(e.code===kt.code)return new _r({multihash:t.multihash});if(e.code===ze.code){if(e.digest.length===so)return new Rr({multihash:t.multihash});if(e.digest.length===ao)return new Lr({multihash:t.multihash})}throw new Error("Supplied PeerID CID is invalid")}async function _a(t,e){return t.length===so?new Rr({multihash:ye(ze.code,t),privateKey:e}):t.length===ao?new Lr({multihash:ye(ze.code,t),privateKey:e}):new _r({multihash:await kt.digest(t),publicKey:t,privateKey:e})}var Kv=Ut(un(),1),Fv=Ut($0(),1);var $1=Ut(ct(),1);function hr(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Jn(t=0){return globalThis.Buffer?.allocUnsafe!=null?hr(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function W0(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var G0=W0("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Lo=W0("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=Jn(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Jd={utf8:G0,"utf-8":G0,hex:Vt.base16,latin1:Lo,ascii:Lo,binary:Lo,...Vt},jn=Jd;function Ht(t,e="utf8"){let r=jn[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 cs={};It(cs,{Ed25519PrivateKey:()=>vr,Ed25519PublicKey:()=>bn,generateKeyPair:()=>y1,generateKeyPairFromSeed:()=>kf,unmarshalEd25519PrivateKey:()=>d1,unmarshalEd25519PublicKey:()=>p1});var bx=Ut(wt(),1),vx=Ut(Yn(),1),Y0=Ut(ct(),1);function dr(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=Jn(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return hr(r)}function Zt(t,e="utf8"){let r=jn[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=dr([new Uint8Array(e-r.length),r])}return Zt(r,"base64url")}function Qt(t){let e=Z0(t);return new Y0.default.jsbn.BigInteger(Zt(e,"base16"),16)}function Z0(t,e){let r=Ht(t,"base64urlpad");if(e!=null){if(r.length>e)throw new Error("byte array longer than desired length");r=dr([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 Q0(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function jd(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function Do(t,...e){if(!jd(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 X0(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Q0(t.outputLen),Q0(t.blockLen)}function Ur(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 J0(t,e){Do(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var ti=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function j0(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var ei=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),se=(t,e)=>t<<32-e|t>>>e,tp=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!tp)throw new Error("Non little-endian hardware is not supported");function Po(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function dn(t){if(typeof t=="string"&&(t=Po(t)),!j0(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function ri(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];if(!j0(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 Or=class{clone(){return this._cloneInto()}},Cx={}.toString;function ni(t){let e=n=>t().update(dn(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function Kr(t=32){if(ti&&typeof ti.getRandomValues=="function")return ti.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}function ep(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 Fr=class extends Or{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=ei(this.buffer)}update(e){Ur(this);let{view:r,buffer:n,blockLen:i}=this;e=dn(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=ei(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){Ur(this),J0(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;ep(n,i-8,BigInt(this.length*8),o),this.process(n,0);let a=ei(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 ii=BigInt(4294967295),ko=BigInt(32);function tf(t,e=!1){return e?{h:Number(t&ii),l:Number(t>>ko&ii)}:{h:Number(t>>ko&ii)|0,l:Number(t&ii)|0}}function rp(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}=tf(t[i],e);[r[i],n[i]]=[o,s]}return[r,n]}var np=(t,e)=>BigInt(t>>>0)<<ko|BigInt(e>>>0),ip=(t,e,r)=>t>>>r,op=(t,e,r)=>t<<32-r|e>>>r,sp=(t,e,r)=>t>>>r|e<<32-r,ap=(t,e,r)=>t<<32-r|e>>>r,fp=(t,e,r)=>t<<64-r|e>>>r-32,cp=(t,e,r)=>t>>>r-32|e<<64-r,up=(t,e)=>e,lp=(t,e)=>t,hp=(t,e,r)=>t<<r|e>>>32-r,dp=(t,e,r)=>e<<r|t>>>32-r,pp=(t,e,r)=>e<<r-32|t>>>64-r,yp=(t,e,r)=>t<<r-32|e>>>64-r;function gp(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var xp=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),mp=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,bp=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),vp=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,wp=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),Ep=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0;var Sp={fromBig:tf,split:rp,toBig:np,shrSH:ip,shrSL:op,rotrSH:sp,rotrSL:ap,rotrBH:fp,rotrBL:cp,rotr32H:up,rotr32L:lp,rotlSH:hp,rotlSL:dp,rotlBH:pp,rotlBL:yp,add:gp,add3L:xp,add3H:mp,add4L:bp,add4H:vp,add5H:Ep,add5L:wp},W=Sp;var[Bp,Ap]=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),No=class extends Fr{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 v=0;v<16;v++,r+=4)Ze[v]=e.getUint32(r),Qe[v]=e.getUint32(r+=4);for(let v=16;v<80;v++){let _=Ze[v-15]|0,E=Qe[v-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[v-2]|0,H=Qe[v-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[v-7],Qe[v-16]),at=W.add4H(X,S,q,Ze[v-7],Ze[v-16]);Ze[v]=at|0,Qe[v]=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 v=0;v<80;v++){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,Ap[v],Qe[v]),H=W.add5H(D,x,_,S,Bp[v],Ze[v]),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,Lt=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,Lt);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 Uo=ni(()=>new No);var si={};It(si,{bitGet:()=>Dp,bitLen:()=>Lp,bitMask:()=>pn,bitSet:()=>Pp,bytesToHex:()=>Re,bytesToNumberBE:()=>Le,bytesToNumberLE:()=>Xe,concatBytes:()=>De,createHmacDrbg:()=>Fo,ensureBytes:()=>bt,equalBytes:()=>_p,hexToBytes:()=>pr,hexToNumber:()=>Ko,isBytes:()=>ae,numberToBytesBE:()=>Je,numberToBytesLE:()=>yr,numberToHexUnpadded:()=>of,numberToVarBytesBE:()=>Cp,utf8ToBytes:()=>Rp,validateObject:()=>Ee});var nf=BigInt(0),oi=BigInt(1),Ip=BigInt(2);function ae(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var Tp=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+=Tp[t[r]];return e}function of(t){let e=t.toString(16);return e.length&1?`0${e}`:e}function Ko(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 ef(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 pr(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=ef(t.charCodeAt(o)),a=ef(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 Ko(Re(t))}function Xe(t){if(!ae(t))throw new Error("Uint8Array expected");return Ko(Re(Uint8Array.from(t).reverse()))}function Je(t,e){return pr(t.toString(16).padStart(e*2,"0"))}function yr(t,e){return Je(t,e).reverse()}function Cp(t){return pr(of(t))}function bt(t,e,r){let n;if(typeof e=="string")try{n=pr(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 _p(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 Rp(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function Lp(t){let e;for(e=0;t>nf;t>>=oi,e+=1);return e}function Dp(t,e){return t>>BigInt(e)&oi}var Pp=(t,e,r)=>t|(r?oi:nf)<<BigInt(e),pn=t=>(Ip<<BigInt(t-1))-oi,Oo=t=>new Uint8Array(t),rf=t=>Uint8Array.from(t);function Fo(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=Oo(t),i=Oo(t),o=0,s=()=>{n.fill(1),i.fill(0),o=0},a=(...l)=>r(i,n,...l),c=(l=Oo())=>{i=a(rf([0]),l),n=a(),l.length!==0&&(i=a(rf([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 kp={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=kp[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 At=BigInt(0),yt=BigInt(1),gr=BigInt(2),Np=BigInt(3),Mo=BigInt(4),sf=BigInt(5),af=BigInt(8),Up=BigInt(9),Op=BigInt(16);function ut(t,e){let r=t%e;return r>=At?r:e+r}function Kp(t,e,r){if(r<=At||e<At)throw new Error("Expected power/modulo > 0");if(r===yt)return At;let n=yt;for(;e>At;)e&yt&&(n=n*t%r),t=t*t%r,e>>=yt;return n}function gt(t,e,r){let n=t;for(;e-- >At;)n*=n,n%=r;return n}function ai(t,e){if(t===At||e<=At)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=ut(t,e),n=e,i=At,o=yt,s=yt,a=At;for(;r!==At;){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!==yt)throw new Error("invert: does not exist");return ut(i,e)}function Fp(t){let e=(t-yt)/gr,r,n,i;for(r=t-yt,n=0;r%gr===At;r/=gr,n++);for(i=gr;i<t&&Kp(i,e,t)!==t-yt;i++);if(n===1){let s=(t+yt)/Mo;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+yt)/gr;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,yt<<BigInt(f-d-1));u=a.sqr(h),l=a.mul(l,h),p=a.mul(p,u),f=d}return l}}function Mp(t){if(t%Mo===Np){let e=(t+yt)/Mo;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%af===sf){let e=(t-sf)/af;return function(n,i){let o=n.mul(i,gr),s=n.pow(o,e),a=n.mul(i,s),c=n.mul(n.mul(a,gr),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%Op,Fp(t)}var ff=(t,e)=>(ut(t,e)&yt)===yt,Vp=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Vo(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=Vp.reduce((n,i)=>(n[i]="function",n),e);return Ee(t,r)}function qp(t,e,r){if(r<At)throw new Error("Expected power > 0");if(r===At)return t.ONE;if(r===yt)return e;let n=t.ONE,i=e;for(;r>At;)r&yt&&(n=t.mul(n,i)),i=t.sqr(i),r>>=yt;return n}function Hp(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 qo(t,e){let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function fi(t,e,r=!1,n={}){if(t<=At)throw new Error(`Expected Field ORDER > 0, got ${t}`);let{nBitLength:i,nByteLength:o}=qo(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");let s=Mp(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:pn(i),ZERO:At,ONE:yt,create:c=>ut(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return At<=c&&c<t},is0:c=>c===At,isOdd:c=>(c&yt)===yt,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)=>qp(a,c,f),div:(c,f)=>ut(c*ai(f,t),t),sqrN:c=>c*c,addN:(c,f)=>c+f,subN:(c,f)=>c-f,mulN:(c,f)=>c*f,inv:c=>ai(c,t),sqrt:n.sqrt||(c=>s(a,c)),invertBatch:c=>Hp(a,c),cmov:(c,f,u)=>u?f:c,toBytes:c=>r?yr(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 cf(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 uf(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 Ho(t){let e=uf(t);return e+Math.ceil(e/2)}function lf(t,e,r=!1){let n=t.length,i=uf(e),o=Ho(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-yt)+yt;return r?yr(a,i):Je(a,i)}var $p=BigInt(0),zo=BigInt(1);function ci(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>$p;)o&zo&&(s=s.add(a)),a=a.double(),o>>=zo;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+=zo);let x=y,m=y+Math.abs(g)-1,v=h%2!==0,_=g<0;g===0?u=u.add(r(v,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 yn(t){return Vo(t.Fp),Ee(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...qo(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}var fe=BigInt(0),Xt=BigInt(1),ui=BigInt(2),Gp=BigInt(8),Wp={zip215:!0};function Yp(t){let e=yn(t);return Ee(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function li(t){let e=Yp(t),{Fp:r,n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:c}=e,f=ui<<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 v=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,v.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),vt=u(rt*rt),xt=u(ot*A),Dt=u(rt*u(xt+j)),Pt=u(vt+u(O*u(ot*j)));if(Dt!==Pt)throw new Error("bad point: equation left != right (1)");let St=u(K*V),Nt=u(Z*J);if(St!==Nt)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),vt=u(K*ot),xt=u(J*V);return j===rt&&vt===xt}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(ui*u(V*V)),j=u(A*Z),rt=O+K,vt=u(u(rt*rt)-Z-J),xt=j+J,Dt=xt-ot,Pt=j-J,St=u(vt*Dt),Nt=u(xt*Pt),Se=u(vt*Pt),ir=u(Dt*xt);return new E(St,Nt,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:vt,et:xt}=A;if(O===BigInt(-1)){let Js=u((Z-V)*(rt+j)),js=u((Z+V)*(rt-j)),Ui=u(js-Js);if(Ui===fe)return this.double();let ta=u(J*ui*xt),ea=u(ot*ui*vt),ra=ea+ta,na=js+Js,ia=ea-ta,lu=u(ra*Ui),hu=u(na*ia),du=u(ra*ia),pu=u(Ui*na);return new E(lu,hu,pu,du)}let Dt=u(V*j),Pt=u(Z*rt),St=u(ot*K*xt),Nt=u(J*vt),Se=u((V+Z)*(j+rt)-Dt-Pt),ir=Nt-St,en=Nt+St,Xs=u(Pt-O*Dt),au=u(Se*ir),fu=u(en*Xs),cu=u(Se*Xs),uu=u(ir*en);return new E(au,fu,uu,cu)}subtract(A){return this.add(A.negate())}wNAF(A){return D.wNAFCached(this,v,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?Gp: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=Xe(J);j===fe||(O?x(j,f):x(j,r.ORDER));let rt=u(j*j),vt=u(rt-Xt),xt=u(K*rt-V),{isValid:Dt,value:Pt}=l(vt,xt);if(!Dt)throw new Error("Point.fromHex: invalid y coordinate");let St=(Pt&Xt)===Xt,Nt=(ot&128)!==0;if(!O&&Pt===fe&&Nt)throw new Error("Point.fromHex: x=0 and x_0=1");return Nt!==St&&(Pt=u(-Pt)),E.fromAffine({x:Pt,y:j})}static fromPrivateKey(A){return M(A).point}toRawBytes(){let{x:A,y:O}=this.toAffine(),K=yr(O,r.BYTES);return K[K.length-1]|=A&Xt?128:0,K}toHex(){return Re(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=ci(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 Lt(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 vt=De(ot,yr(rt,r.BYTES));return bt("result",vt,a*2)}let T=Wp;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,vt;try{j=E.fromHex(O,Z),rt=E.fromHex(P.slice(0,J),Z),vt=S.multiplyUnsafe(ot)}catch{return!1}if(!Z&&j.isSmallOrder())return!1;let xt=at(V,rt.toRawBytes(),j.toRawBytes(),A);return rt.add(j.multiplyUnsafe(xt)).subtract(vt).clearCofactor().equals(E.ZERO)}return S._setWindowSize(8),{CURVE:e,getPublicKey:X,sign:Lt,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 Go=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),hf=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Qx=BigInt(0),Zp=BigInt(1),$o=BigInt(2),Qp=BigInt(5),df=BigInt(10),Xp=BigInt(20),Jp=BigInt(40),pf=BigInt(80);function jp(t){let e=Go,n=t*t%e*t%e,i=gt(n,$o,e)*n%e,o=gt(i,Zp,e)*t%e,s=gt(o,Qp,e)*o%e,a=gt(s,df,e)*s%e,c=gt(a,Xp,e)*a%e,f=gt(c,Jp,e)*c%e,u=gt(f,pf,e)*f%e,l=gt(u,pf,e)*f%e,p=gt(l,df,e)*s%e;return{pow_p_5_8:gt(p,$o,e)*t%e,b2:n}}function t1(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function e1(t,e){let r=Go,n=ut(e*e*e,r),i=ut(n*n*e,r),o=jp(t*i).pow_p_5_8,s=ut(t*n*o,r),a=ut(e*s*s,r),c=s,f=ut(s*hf,r),u=a===t,l=a===ut(-t,r),p=a===ut(-t*hf,r);return u&&(s=c),(l||p)&&(s=f),ff(s,r)&&(s=ut(-s,r)),{isValid:u||l,value:s}}var Pe=fi(Go,void 0,!0),Wo={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Pe,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Uo,randomBytes:Kr,adjustScalarBytes:t1,uvRatio:e1},Mr=li(Wo);function yf(t,e,r){if(e.length>255)throw new Error("Context is too big");return ri(Po("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,e.length]),e,t)}var Xx=li({...Wo,domain:yf}),Jx=li({...Wo,domain:yf,prehash:Uo});var r1=(Pe.ORDER+BigInt(3))/BigInt(8),jx=Pe.pow($o,r1),tm=Pe.sqrt(Pe.neg(Pe.ONE)),em=(Pe.ORDER-BigInt(5))/BigInt(8),rm=BigInt(486662);var nm=cf(Pe,Pe.neg(BigInt(486664)));var im=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),om=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),sm=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),am=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");var fm=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Vr=32,ke=64,hi=32;function gf(){let t=Mr.utils.randomPrivateKey(),e=Mr.getPublicKey(t);return{privateKey:vf(t,e),publicKey:e}}function xf(t){if(t.length!==hi)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=Mr.getPublicKey(e);return{privateKey:vf(e,r),publicKey:r}}function mf(t,e){let r=t.subarray(0,hi);return Mr.sign(e instanceof Uint8Array?e:e.subarray(),r)}function bf(t,e,r){return Mr.verify(e,r instanceof Uint8Array?r:r.subarray(),t)}function vf(t,e){let r=new Uint8Array(ke);for(let n=0;n<hi;n++)r[n]=t[n],r[hi+n]=e[n];return r}var zt={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 Yo={alg:"A128GCM",ext:!0,k:"scm9jmO_4BJAgdwWGVulLg",key_ops:["encrypt","decrypt"],kty:"oct"};function Zo(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=zt.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=Ht(p));let g;if(p.length===0){g=await a.subtle.importKey("jwk",Yo,{name:"AES-GCM"},!0,["encrypt"]);try{let m={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},v=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);g=await a.subtle.deriveKey(m,v,{name:e,length:r},!0,["encrypt"])}catch{g=await a.subtle.importKey("jwk",Yo,{name:"AES-GCM"},!0,["encrypt"])}}else{let m={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},v=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);g=await a.subtle.deriveKey(m,v,{name:e,length:r},!0,["encrypt"])}let x=await a.subtle.encrypt(y,g,l);return dr([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=Ht(p));let x;if(p.length===0)try{let v={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},_=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);x=await a.subtle.deriveKey(v,_,{name:e,length:r},!0,["decrypt"])}catch{x=await a.subtle.importKey("jwk",Yo,{name:"AES-GCM"},!0,["decrypt"])}else{let v={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},_=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);x=await a.subtle.deriveKey(v,_,{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 qr(t,e){let n=await Zo().encrypt(t,e);return Ln.encode(n)}var Qo=new Float32Array([-0]),je=new Uint8Array(Qo.buffer);function Ef(t,e,r){Qo[0]=t,e[r]=je[0],e[r+1]=je[1],e[r+2]=je[2],e[r+3]=je[3]}function Sf(t,e){return je[0]=t[e],je[1]=t[e+1],je[2]=t[e+2],je[3]=t[e+3],Qo[0]}var Xo=new Float64Array([-0]),Ot=new Uint8Array(Xo.buffer);function Bf(t,e,r){Xo[0]=t,e[r]=Ot[0],e[r+1]=Ot[1],e[r+2]=Ot[2],e[r+3]=Ot[3],e[r+4]=Ot[4],e[r+5]=Ot[5],e[r+6]=Ot[6],e[r+7]=Ot[7]}function Af(t,e){return Ot[0]=t[e],Ot[1]=t[e+1],Ot[2]=t[e+2],Ot[3]=t[e+3],Ot[4]=t[e+4],Ot[5]=t[e+5],Ot[6]=t[e+6],Ot[7]=t[e+7],Xo[0]}var i1=BigInt(Number.MAX_SAFE_INTEGER),o1=BigInt(Number.MIN_SAFE_INTEGER),$t=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 xr;if(e<i1&&e>o1)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>If&&(i=0n,++n>If&&(n=0n))),new t(Number(i),Number(n))}static fromNumber(e){if(e===0)return xr;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):xr}},xr=new $t(0,0);xr.toBigInt=function(){return 0n};xr.zzEncode=xr.zzDecode=function(){return this};xr.length=function(){return 1};var If=4294967296n;function Tf(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 Cf(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 Jo(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 di(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}var jo=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 di(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw ce(this,4);return di(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw ce(this,4);let e=Sf(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw ce(this,4);let e=Af(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 Cf(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 $t(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=di(this.buf,this.pos+=4),r=di(this.buf,this.pos+=4);return new $t(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 ts(t){return new jo(t instanceof Uint8Array?t:t.subarray())}function ue(t,e){let r=ts(t);return e.decode(r)}function pi(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function mr(t=0){return globalThis.Buffer?.allocUnsafe!=null?pi(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Lf(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var Rf=Lf("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),es=Lf("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=mr(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),s1={utf8:Rf,"utf-8":Rf,hex:Vt.base16,latin1:es,ascii:es,binary:es,...Vt},Df=s1;function Pf(t,e="utf8"){let r=Df[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?pi(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function rs(t){let e=t??8192,r=e>>>1,n,i=e;return function(s){if(s<1||s>r)return mr(s);i+s>e&&(n=mr(e),i=0);let a=n.subarray(i,i+=s);return i&7&&(i=(i|7)+1),a}}var br=class{fn;len;next;val;constructor(e,r,n){this.fn=e,this.len=r,this.next=void 0,this.val=n}};function ns(){}var os=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},a1=rs();function f1(t){return globalThis.Buffer!=null?mr(t):a1(t)}var mn=class{len;head;tail;states;constructor(){this.len=0,this.head=new br(ns,0,0),this.tail=this.head,this.states=null}_push(e,r,n){return this.tail=this.tail.next=new br(e,r,n),this.len+=r,this}uint32(e){return this.len+=(this.tail=this.tail.next=new ss((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(gn,10,$t.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let r=$t.fromBigInt(e);return this._push(gn,r.length(),r)}uint64Number(e){let r=$t.fromNumber(e);return this._push(gn,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=$t.fromBigInt(e).zzEncode();return this._push(gn,r.length(),r)}sint64Number(e){let r=$t.fromNumber(e).zzEncode();return this._push(gn,r.length(),r)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(is,1,e?1:0)}fixed32(e){return this._push(xn,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let r=$t.fromBigInt(e);return this._push(xn,4,r.lo)._push(xn,4,r.hi)}fixed64Number(e){let r=$t.fromNumber(e);return this._push(xn,4,r.lo)._push(xn,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(Ef,4,e)}double(e){return this._push(Bf,8,e)}bytes(e){let r=e.length>>>0;return r===0?this._push(is,1,0):this.uint32(r)._push(u1,r,e)}string(e){let r=Tf(e);return r!==0?this.uint32(r)._push(Jo,r,e):this._push(is,1,0)}fork(){return this.states=new os(this),this.head=this.tail=new br(ns,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 br(ns,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=f1(this.len),n=0;for(;e!=null;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r}};function is(t,e,r){e[r]=t&255}function c1(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}var ss=class extends br{next;constructor(e,r){super(c1,e,r),this.next=void 0}};function gn(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 xn(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 u1(t,e,r){e.set(t,r)}globalThis.Buffer!=null&&(mn.prototype.bytes=function(t){let e=t.length>>>0;return this.uint32(e),e>0&&this._push(l1,e,t),this},mn.prototype.string=function(t){let e=globalThis.Buffer.byteLength(t);return this.uint32(e),e>0&&this._push(h1,e,t),this});function l1(t,e,r){e.set(t,r)}function h1(t,e,r){t.length<40?Jo(t,e,r):e.utf8Write!=null?e.utf8Write(t,r):e.set(Pf(t),r)}function as(){return new mn}function le(t,e){let r=as();return e.encode(t,r,{lengthDelimited:!1}),r.finish()}var Hr;(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"})(Hr||(Hr={}));function yi(t,e,r,n){return{name:t,type:e,encode:r,decode:n}}function zr(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 yi("enum",Hr.VARINT,r,n)}function he(t,e){return yi("message",Hr.LENGTH_DELIMITED,t,e)}var Rt;(function(t){t.RSA="RSA",t.Ed25519="Ed25519",t.Secp256k1="Secp256k1"})(Rt||(Rt={}));var fs;(function(t){t[t.RSA=0]="RSA",t[t.Ed25519=1]="Ed25519",t[t.Secp256k1=2]="Secp256k1"})(fs||(fs={}));(function(t){t.codec=()=>zr(fs)})(Rt||(Rt={}));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),Rt.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=Rt.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),Rt.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=Rt.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 bn=class{_key;constructor(e){this._key=$r(e,Vr)}verify(e,r){return bf(this._key,r,e)}marshal(){return this._key}get bytes(){return Ne.encode({Type:Rt.Ed25519,Data:this.marshal()}).subarray()}equals(e){return Yt(this.bytes,e.bytes)}hash(){let e=kt.digest(this.bytes);return te(e)?e.then(({bytes:r})=>r):e.bytes}},vr=class{_key;_publicKey;constructor(e,r){this._key=$r(e,ke),this._publicKey=$r(r,Vr)}sign(e){return mf(this._key,e)}get public(){return new bn(this._publicKey)}marshal(){return this._key}get bytes(){return Ue.encode({Type:Rt.Ed25519,Data:this.marshal()}).subarray()}equals(e){return Yt(this.bytes,e.bytes)}async hash(){let e=kt.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 Bt.encode(e.bytes).substring(1)}async export(e,r="libp2p-key"){if(r==="libp2p-key")return qr(this.bytes,e);throw new $(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}};function d1(t){if(t.length>ke){t=$r(t,ke+Vr);let n=t.subarray(0,ke),i=t.subarray(ke,t.length);return new vr(n,i)}t=$r(t,ke);let e=t.subarray(0,ke),r=t.subarray(Vr);return new vr(e,r)}function p1(t){return t=$r(t,Vr),new bn(t)}async function y1(){let{privateKey:t,publicKey:e}=gf();return new vr(t,e)}async function kf(t){let{privateKey:e,publicKey:r}=xf(t);return new vr(e,r)}function $r(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 g1={"P-256":256,"P-384":384,"P-521":521},x1=Object.keys(g1),yb=x1.join(" / ");var ps={};It(ps,{MAX_KEY_SIZE:()=>Sn,RsaPrivateKey:()=>Gr,RsaPublicKey:()=>En,fromJwk:()=>C1,generateKeyPair:()=>_1,unmarshalRsaPrivateKey:()=>I1,unmarshalRsaPublicKey:()=>T1});var wn=Ut(ct(),1);var jb=Ut(Ff(),1);function xi(t){if(isNaN(t)||t<=0)throw new $("random bytes length must be a Number bigger than 0","ERR_INVALID_LENGTH");return Kr(t)}var Nb=Ut(Xn(),1),hs=Ut(ct(),1);function Mf(t,e){return e.map(r=>Qt(t[r]))}function Vf(t){return hs.default.pki.setRsaPrivateKey(...Mf(t,["n","e","d","p","q","dp","dq","qi"]))}function qf(t){return hs.default.pki.setRsaPublicKey(...Mf(t,["n","e"]))}var Er={};It(Er,{jwkToPkcs1:()=>w1,jwkToPkix:()=>S1,pkcs1ToJwk:()=>v1,pkixToJwk:()=>E1});var Kb=Ut(un(),1),Fb=Ut(Xn(),1);var Oe=Ut(ct(),1);function v1(t){let e=Oe.default.asn1.fromDer(Zt(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 w1(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: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 Ht(Oe.default.asn1.toDer(e).getBytes(),"ascii")}function E1(t){let e=Oe.default.asn1.fromDer(Zt(t,"ascii")),r=Oe.default.pki.publicKeyFromAsn1(e);return{kty:"RSA",n:oe(r.n),e:oe(r.e)}}function S1(t){if(t.n==null||t.e==null)throw new $("JWK was missing components","ERR_INVALID_PARAMETERS");let e=Oe.default.pki.publicKeyToAsn1({n:Qt(t.n),e:Qt(t.e)});return Ht(Oe.default.asn1.toDer(e).getBytes(),"ascii")}async function Hf(t){let e=await zt.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 Gf(e);return{privateKey:r[0],publicKey:r[1]}}async function ds(t){let r=[await zt.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await B1(t)],n=await Gf({privateKey:r[0],publicKey:r[1]});return{privateKey:n[0],publicKey:n[1]}}async function zf(t,e){let r=await zt.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),n=await zt.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,e instanceof Uint8Array?e:e.subarray());return new Uint8Array(n,0,n.byteLength)}async function $f(t,e,r){let n=await zt.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return zt.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},n,e,r instanceof Uint8Array?r:r.subarray())}async function Gf(t){if(t.privateKey==null||t.publicKey==null)throw new $("Private and public key are required","ERR_INVALID_PARAMETERS");return Promise.all([zt.get().subtle.exportKey("jwk",t.privateKey),zt.get().subtle.exportKey("jwk",t.publicKey)])}async function B1(t){return zt.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 Wf(t,e,r,n){let i=e?qf(t):Vf(t),o=Zt(r instanceof Uint8Array?r:r.subarray(),"ascii"),s=n(o,i);return Ht(s,"ascii")}function Yf(t,e){return Wf(t,!0,e,(r,n)=>n.encrypt(r))}function Zf(t,e){return Wf(t,!1,e,(r,n)=>n.decrypt(r))}function mi(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 Ht(t.n,"base64url").length*8}var Sn=8192,En=class{_key;constructor(e){this._key=e}verify(e,r){return $f(this._key,r,e)}marshal(){return Er.jwkToPkix(this._key)}get bytes(){return Ne.encode({Type:Rt.RSA,Data:this.marshal()}).subarray()}encrypt(e){return Yf(this._key,e)}equals(e){return Yt(this.bytes,e.bytes)}hash(){let e=kt.digest(this.bytes);return te(e)?e.then(({bytes:r})=>r):e.bytes}},Gr=class{_key;_publicKey;constructor(e,r){this._key=e,this._publicKey=r}genSecret(){return xi(16)}sign(e){return zf(this._key,e)}get public(){if(this._publicKey==null)throw new $("public key not provided","ERR_PUBKEY_NOT_PROVIDED");return new En(this._publicKey)}decrypt(e){return Zf(this._key,e)}marshal(){return Er.jwkToPkcs1(this._key)}get bytes(){return Ue.encode({Type:Rt.RSA,Data:this.marshal()}).subarray()}equals(e){return Yt(this.bytes,e.bytes)}hash(){let e=kt.digest(this.bytes);return te(e)?e.then(({bytes:r})=>r):e.bytes}async id(){let e=await this.public.hash();return Zt(e,"base58btc")}async export(e,r="pkcs-8"){if(r==="pkcs-8"){let n=new wn.default.util.ByteBuffer(this.marshal()),i=wn.default.asn1.fromDer(n),o=wn.default.pki.privateKeyFromAsn1(i),s={algorithm:"aes256",count:1e4,saltSize:128/8,prfAlgorithm:"sha512"};return wn.default.pki.encryptRsaPrivateKey(o,e,s)}else{if(r==="libp2p-key")return qr(this.bytes,e);throw new $(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}}};async function I1(t){let e=Er.pkcs1ToJwk(t);if(mi(e)>Sn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let r=await ds(e);return new Gr(r.privateKey,r.publicKey)}function T1(t){let e=Er.pkixToJwk(t);if(mi(e)>Sn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");return new En(e)}async function C1(t){if(mi(t)>Sn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let e=await ds(t);return new Gr(e.privateKey,e.publicKey)}async function _1(t){if(t>Sn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let e=await Hf(t);return new Gr(e.privateKey,e.publicKey)}var vs={};It(vs,{Secp256k1PrivateKey:()=>An,Secp256k1PublicKey:()=>Bn,generateKeyPair:()=>z1,unmarshalSecp256k1PrivateKey:()=>q1,unmarshalSecp256k1PublicKey:()=>H1});var R1=(t,e,r)=>t&e^~t&r,L1=(t,e,r)=>t&e^t&r^e&r,D1=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),ys=class extends Fr{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+R1(a,c,f)+D1[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 Qf=ni(()=>new ys);function P1(t){let e=yn(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:k1,hexToBytes:N1}=si,Sr={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){let{Err:e}=Sr;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:k1(n),l:t.subarray(r+2)}},toSig(t){let{Err:e}=Sr,r=typeof t=="string"?N1(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}=Sr._parseInt(r.subarray(2)),{d:s,l:a}=Sr._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),ee=BigInt(1),cv=BigInt(2),Xf=BigInt(3),uv=BigInt(4);function U1(t){let e=P1(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 v;try{v=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&&(v=ut(v,m)),a(v),v}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=v=>r.eql(v,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:v,py:_,pz:E}=y,S=r.eql(r.mul(g,E),r.mul(v,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,Xf),{px:m,py:v,pz:_}=this,E=r.ZERO,S=r.ZERO,L=r.ZERO,D=r.mul(m,m),H=r.mul(v,v),q=r.mul(_,_),M=r.mul(m,v);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(v,_),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:v,py:_,pz:E}=y,S=r.ZERO,L=r.ZERO,D=r.ZERO,H=e.a,q=r.mul(e.b,Xf),M=r.mul(g,v),X=r.mul(x,_),at=r.mul(m,E),Lt=r.add(g,x),T=r.add(v,_);Lt=r.mul(Lt,T),T=r.add(M,X),Lt=r.sub(Lt,T),T=r.add(g,m);let k=r.add(v,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(Lt,S),S=r.sub(S,M),M=r.mul(Lt,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,v)=>m.toAffine(x[v])).map(l.fromAffine)})}multiplyUnsafe(y){let g=l.ZERO;if(y===Ke)return g;if(a(y),y===ee)return this;let{endo:x}=e;if(!x)return d.unsafeLadder(this,y);let{k1neg:m,k1:v,k2neg:_,k2:E}=x.splitScalar(y),S=g,L=g,D=this;for(;v>Ke||E>Ke;)v&ee&&(S=S.add(D)),E&ee&&(L=L.add(D)),D=D.double(),v>>=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:v}=e;if(v){let{k1neg:_,k1:E,k2neg:S,k2:L}=v.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,v.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,v=(E,S)=>S===Ke||S===ee||!E.equals(m)?E.multiplyUnsafe(S):E.multiply(S),_=v(this,g).add(v(y,x));return _.is0()?void 0:_}toAffine(y){let{px:g,py:x,pz:m}=this,v=this.is0();y==null&&(y=v?r.ONE:r.inv(m));let _=r.mul(g,y),E=r.mul(x,y),S=r.mul(m,y);if(v)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 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=ci(l,e.endo?Math.ceil(p/2):p);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:s}}function O1(t){let e=yn(t);return Ee(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Jf(t){let e=O1(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 ai(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=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&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=>Re(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)=>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}=Sr.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 pr(this.toDERHex())}toDERHex(){return Sr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return pr(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=Ho(e.n);return lf(e.randomBytes(T),e.n)},precompute(T=8,k=f.BASE){return k._setWindowSize(T),k.multiply(BigInt(3)),k}};function v(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=pn(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(xt=>xt 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 xt=V===!0?A(r.BYTES):V;ot.push(bt("extraEntropy",xt))}let j=De(...ot),rt=Z;function vt(xt){let Dt=S(xt);if(!p(Dt))return;let Pt=c(Dt),St=f.BASE.multiply(Dt).toAffine(),Nt=a(St.x);if(Nt===Ke)return;let Se=a(Pt*a(rt+Nt*J));if(Se===Ke)return;let ir=(St.x===Nt?0:2)|Number(St.y&ee),en=Se;return O&&h(Se)&&(en=y(Se),ir^=1),new x(Nt,en,ir)}return{seed:j,k2sig:vt}}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 Fo(O.hash.outputLen,O.nByteLength,O.hmac)(P,A)}f.BASE._setWindowSize(8);function Lt(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(St){if(!(St instanceof Sr.Err))throw St;V=x.fromCompact(A)}else if(typeof A=="object"&&typeof A.r=="bigint"&&typeof A.s=="bigint"){let{r:St,s:Nt}=A;V=new x(St,Nt)}else throw new Error("PARSE");Z=f.fromHex(R)}catch(St){if(St.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),vt=a(j*rt),xt=a(J*rt),Dt=f.BASE.multiplyAndAddUnsafe(Z,vt,xt)?.toAffine();return Dt?a(Dt.x)===J:!1}return{CURVE:e,getPublicKey:v,getSharedSecret:E,sign:at,verify:Lt,ProjectivePoint:f,Signature:x,utils:m}}var bi=class extends Or{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,X0(e);let n=dn(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 Ur(this),this.iHash.update(e),this}digestInto(e){Ur(this),Do(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()}},gs=(t,e,r)=>new bi(t,e).update(r).digest();gs.create=(t,e)=>new bi(t,e);function K1(t){return{hash:t,hmac:(e,...r)=>gs(t,e,ri(...r)),randomBytes:Kr}}function jf(t,e){let r=n=>Jf({...t,...K1(n)});return Object.freeze({...r(e),create:r})}var rc=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),tc=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),F1=BigInt(1),xs=BigInt(2),ec=(t,e)=>(t+e/xs)/e;function M1(t){let e=rc,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=gt(u,r,e)*u%e,p=gt(l,r,e)*u%e,d=gt(p,xs,e)*f%e,h=gt(d,i,e)*d%e,y=gt(h,o,e)*h%e,g=gt(y,a,e)*y%e,x=gt(g,c,e)*g%e,m=gt(x,a,e)*y%e,v=gt(m,r,e)*u%e,_=gt(v,s,e)*h%e,E=gt(_,n,e)*f%e,S=gt(E,xs,e);if(!ms.eql(ms.sqr(S),t))throw new Error("Cannot find square root");return S}var ms=fi(rc,void 0,void 0,{sqrt:M1}),de=jf({a:BigInt(0),b:BigInt(7),Fp:ms,n:tc,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=tc,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-F1*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),a=ec(o*t,e),c=ec(-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}}}},Qf),Ev=BigInt(0);var Sv=de.ProjectivePoint;function nc(){return de.utils.randomPrivateKey()}function ic(t,e){let r=kt.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 oc(t,e,r){let n=kt.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 sc(t){return de.ProjectivePoint.fromHex(t).toRawBytes(!0)}function ac(t){try{de.getPublicKey(t,!0)}catch(e){throw new $(String(e),"ERR_INVALID_PRIVATE_KEY")}}function bs(t){try{de.ProjectivePoint.fromHex(t)}catch(e){throw new $(String(e),"ERR_INVALID_PUBLIC_KEY")}}function fc(t){try{return de.getPublicKey(t,!0)}catch(e){throw new $(String(e),"ERR_INVALID_PRIVATE_KEY")}}var Bn=class{_key;constructor(e){bs(e),this._key=e}verify(e,r){return oc(this._key,r,e)}marshal(){return sc(this._key)}get bytes(){return Ne.encode({Type:Rt.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return Yt(this.bytes,e.bytes)}async hash(){let e=kt.digest(this.bytes),r;return te(e)?{bytes:r}=await e:r=e.bytes,r}},An=class{_key;_publicKey;constructor(e,r){this._key=e,this._publicKey=r??fc(e),ac(this._key),bs(this._publicKey)}sign(e){return ic(this._key,e)}get public(){return new Bn(this._publicKey)}marshal(){return this._key}get bytes(){return Ue.encode({Type:Rt.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return Yt(this.bytes,e.bytes)}hash(){let e=kt.digest(this.bytes);return te(e)?e.then(({bytes:r})=>r):e.bytes}async id(){let e=await this.public.hash();return Zt(e,"base58btc")}async export(e,r="libp2p-key"){if(r==="libp2p-key")return qr(this.bytes,e);throw new $(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}};function q1(t){return new An(t)}function H1(t){return new Bn(t)}async function z1(){let t=nc();return new An(t)}var cc={rsa:ps,ed25519:cs,secp256k1:vs};function G1(t){let e=Object.keys(cc).join(" / ");return new $(`invalid or unsupported key type ${t}. Must be ${e}`,"ERR_UNSUPPORTED_KEY_TYPE")}function ws(t){if(t=t.toLowerCase(),t==="rsa"||t==="ed25519"||t==="secp256k1")return cc[t];throw G1(t)}async function uc(t,e){return ws(t).generateKeyPair(e??2048)}function lc(t,e){return e=(e??"rsa").toLowerCase(),ws(e),t.bytes}function hc(t,e){return e=(e??"rsa").toLowerCase(),ws(e),t.bytes}var Es;(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())})(Es||(Es={}));var dc=async()=>{let t=await uc("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 _a(lc(t.public),hc(t))}function pc(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 Wr(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function vi(t=0){return globalThis.Buffer?.allocUnsafe!=null?Wr(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function gc(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var yc=gc("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Ss=gc("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=vi(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Y1={utf8:yc,"utf-8":yc,hex:Vt.base16,latin1:Ss,ascii:Ss,binary:Ss,...Vt},wi=Y1;function Gt(t,e="utf8"){let r=wi[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 xc(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function mc(t=0){return globalThis.Buffer?.allocUnsafe!=null?xc(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var Z1=Math.pow(2,7),Q1=Math.pow(2,14),X1=Math.pow(2,21),Bs=Math.pow(2,28),As=Math.pow(2,35),Is=Math.pow(2,42),Ts=Math.pow(2,49),it=128,Kt=127;function Wt(t){if(t<Z1)return 1;if(t<Q1)return 2;if(t<X1)return 3;if(t<Bs)return 4;if(t<As)return 5;if(t<Is)return 6;if(t<Ts)return 7;if(Number.MAX_SAFE_INTEGER!=null&&t>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function J1(t,e,r=0){switch(Wt(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 j1(t,e,r=0){switch(Wt(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 ty(t,e){let r=t[e],n=0;if(n+=r&Kt,r<it||(r=t[e+1],n+=(r&Kt)<<7,r<it)||(r=t[e+2],n+=(r&Kt)<<14,r<it)||(r=t[e+3],n+=(r&Kt)<<21,r<it)||(r=t[e+4],n+=(r&Kt)*Bs,r<it)||(r=t[e+5],n+=(r&Kt)*As,r<it)||(r=t[e+6],n+=(r&Kt)*Is,r<it)||(r=t[e+7],n+=(r&Kt)*Ts,r<it))return n;throw new RangeError("Could not decode varint")}function ey(t,e){let r=t.get(e),n=0;if(n+=r&Kt,r<it||(r=t.get(e+1),n+=(r&Kt)<<7,r<it)||(r=t.get(e+2),n+=(r&Kt)<<14,r<it)||(r=t.get(e+3),n+=(r&Kt)<<21,r<it)||(r=t.get(e+4),n+=(r&Kt)*Bs,r<it)||(r=t.get(e+5),n+=(r&Kt)*As,r<it)||(r=t.get(e+6),n+=(r&Kt)*Is,r<it)||(r=t.get(e+7),n+=(r&Kt)*Ts,r<it))return n;throw new RangeError("Could not decode varint")}function rr(t,e,r=0){return e==null&&(e=mc(Wt(t))),e instanceof Uint8Array?J1(t,e,r):j1(t,e,r)}function Fe(t,e=0){return t instanceof Uint8Array?ty(t,e):ey(t,e)}function Me(t,e){e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=vi(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Wr(r)}var Si=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 bc=45,ry=15,Yr=new Si;function Cs(t){if(!(t.length>ry))return Yr.new(t).parseWith(()=>Yr.readIPv4Addr())}function _s(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>bc))return Yr.new(t).parseWith(()=>Yr.readIPv6Addr())}function Bi(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>bc))return Yr.new(t).parseWith(()=>Yr.readIPAddr())}var Iw=parseInt("0xFFFF",16),Tw=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function Rs(t,e="utf8"){let r=wi[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Wr(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function Ec(t){return!!Cs(t)}function Sc(t){return!!_s(t)}function Zr(t){return!!Bi(t)}var Bc=Ec,ay=Sc,Ls=function(t){let e=0;if(t=t.toString().trim(),Bc(t)){let r=new Uint8Array(e+4);return t.split(/\./g).forEach(n=>{r[e++]=parseInt(n,10)&255}),r}if(ay(t)){let r=t.split(":",8),n;for(n=0;n<r.length;n++){let o=Bc(r[n]),s;o&&(s=Ls(r[n]),r[n]=Gt(s.slice(0,2),"base16")),s!=null&&++n<8&&r.splice(n,0,Gt(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")},Ac=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 Qr={},Ds={},cy=[[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"]];cy.forEach(t=>{let e=uy(...t);Ds[e.code]=e,Qr[e.name]=e});function uy(t,e,r,n,i){return{code:t,size:e,name:r,resolvable:!!n,path:!!i}}function st(t){if(typeof t=="number"){if(Ds[t]!=null)return Ds[t];throw new Error(`no protocol with code: ${t}`)}else if(typeof t=="string"){if(Qr[t]!=null)return Qr[t];throw new Error(`no protocol with name: ${t}`)}throw new Error(`invalid protocol id type: ${typeof t}`)}var d4=st("ip4"),p4=st("ip6"),y4=st("ipcidr");function ks(t,e){switch(st(t).code){case 4:case 41:return hy(e);case 42:return Cc(e);case 6:case 273:case 33:case 132:return Rc(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Cc(e);case 421:return gy(e);case 444:return _c(e);case 445:return _c(e);case 466:return yy(e);default:return Gt(e,"base16")}}function Ns(t,e){switch(st(t).code){case 4:return Ic(e);case 41:return Ic(e);case 42:return Tc(e);case 6:case 273:case 33:case 132:return Us(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Tc(e);case 421:return dy(e);case 444:return xy(e);case 445:return my(e);case 466:return py(e);default:return Rs(e,"base16")}}var Ps=Object.values(Vt).map(t=>t.decoder),ly=function(){let t=Ps[0].or(Ps[1]);return Ps.slice(2).forEach(e=>t=t.or(e)),t}();function Ic(t){if(!Zr(t))throw new Error("invalid ip address");return Ls(t)}function hy(t){let e=Ac(t,0,t.length);if(e==null)throw new Error("ipBuff is required");if(!Zr(e))throw new Error("invalid ip address");return e}function Us(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t),new Uint8Array(e)}function Rc(t){return new DataView(t.buffer).getUint16(t.byteOffset)}function Tc(t){let e=Rs(t),r=Uint8Array.from(rr(e.length));return Me([r,e],r.length+e.length)}function Cc(t){let e=Fe(t);if(t=t.slice(Wt(e)),t.length!==e)throw new Error("inconsistent lengths");return Gt(t)}function dy(t){let e;t[0]==="Q"||t[0]==="1"?e=or(Bt.decode(`z${t}`)).bytes:e=re.parse(t).multihash.bytes;let r=Uint8Array.from(rr(e.length));return Me([r,e],r.length+e.length)}function py(t){let e=ly.decode(t),r=Uint8Array.from(rr(e.length));return Me([r,e],r.length+e.length)}function yy(t){let e=Fe(t),r=t.slice(Wt(e));if(r.length!==e)throw new Error("inconsistent lengths");return"u"+Gt(r,"base64url")}function gy(t){let e=Fe(t),r=t.slice(Wt(e));if(r.length!==e)throw new Error("inconsistent lengths");return Gt(r,"base58btc")}function xy(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=Us(n);return Me([r,i],r.length+i.length)}function my(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=Us(n);return Me([r,i],r.length+i.length)}function _c(t){let e=t.slice(0,t.length-2),r=t.slice(t.length-2),n=Gt(e,"base32"),i=Rc(r);return`${n}:${i}`}function Lc(t){t=Os(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=Os(i.slice(o).join("/")),e.push([a.code,Ns(a.code,n)]),r.push([a.code,n]);break}let c=Ns(a.code,i[o]);e.push([a.code,c]),r.push([a.code,ks(a.code,c)])}return{string:Dc(r),bytes:Fs(e),tuples:e,stringTuples:r,path:n}}function Ks(t){let e=[],r=[],n=null,i=0;for(;i<t.length;){let o=Fe(t,i),s=Wt(o),a=st(o),c=by(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: "+Gt(t,"base16"));e.push([o,f]);let u=ks(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}),Os(e.join("/"))}function Fs(t){return Me(t.map(e=>{let r=st(e[0]),n=Uint8Array.from(rr(r.code));return e.length>1&&e[1]!=null&&(n=Me([n,e[1]])),n}))}function by(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+Wt(r)}}function Os(t){return"/"+t.trim().split("/").filter(e=>e).join("/")}function Pc(t){return new Error("Error parsing address: "+t)}var vy=Symbol.for("nodejs.util.inspect.custom"),Ms=Symbol.for("@multiformats/js-multiaddr/multiaddr"),wy=[st("dns").code,st("dns4").code,st("dns6").code,st("dnsaddr").code],Ai=class t{bytes;#e;#t;#r;#n;[Ms]=!0;constructor(e){e==null&&(e="");let r;if(e instanceof Uint8Array)r=Ks(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);r=Lc(e)}else if(Nc(e))r=Ks(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??""}`),wy.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(Fs(r.slice(0,n)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([n,i])=>{n===Qr.p2p.code&&e.push([n,i]),n===Qr["p2p-circuit"].code&&(e=[])});let r=e.pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?Gt(Bt.decode(`z${n}`),"base58btc"):Gt(re.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(e){return pc(this.bytes,e.bytes)}async resolve(e){let r=this.protos().find(o=>o.resolvable);if(r==null)return[this];let n=kc.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)}[vy](){return`Multiaddr(${this.#e})`}};var kc=new Map;function Nc(t){return!!t?.[Ms]}function Ii(t){return new Ai(t)}function Ey(t){return t[Symbol.asyncIterator]!=null}function Sy(t){if(Ey(t))return(async()=>{for await(let e of t)return e})();for(let e of t)return e}var Vs=Sy;function In(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Ve(t=0){return globalThis.Buffer?.alloc!=null?In(globalThis.Buffer.alloc(t)):new Uint8Array(t)}function Tn(t=0){return globalThis.Buffer?.allocUnsafe!=null?In(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function qs(t,e){e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=Tn(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return In(r)}function Uc(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 Kc=Symbol.for("@achingbrain/uint8arraylist");function Oc(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 Ti(t){return!!t?.[Kc]}var Xr=class t{bufs;length;[Kc]=!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(Ti(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(Ti(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=Oc(this.bufs,e);return r.buf[r.index]}set(e,r){let n=Oc(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(Ti(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 qs(n,i)}subarray(e,r){let{bufs:n,length:i}=this._subList(e,r);return n.length===1?n[0]:qs(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(!Ti(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=Tn(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=Ve(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=Ve(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=Ve(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=Tn(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=Ve(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=Ve(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=Ve(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=Ve(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=Ve(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(!Uc(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 Fc(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Mc(t=0){return globalThis.Buffer?.allocUnsafe!=null?Fc(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Ci(t){return t[Symbol.asyncIterator]!=null}var _i=t=>{let e=Wt(t),r=Mc(e);return rr(t,r),_i.bytes=e,r};_i.bytes=0;function Cn(t,e){e=e??{};let r=e.lengthEncoder??_i;function*n(i){let o=r(i.byteLength);o instanceof Uint8Array?yield o:yield*o,i instanceof Uint8Array?yield i:yield*i}return Ci(t)?async function*(){for await(let i of t)yield*n(i)}():function*(){for(let i of t)yield*n(i)}()}Cn.single=(t,e)=>{e=e??{};let r=e.lengthEncoder??_i;return new Xr(r(t.byteLength),t)};var Jr=Ut(Hc(),1);var Ay=8,Iy=1024*1024*4,Br;(function(t){t[t.LENGTH=0]="LENGTH",t[t.DATA=1]="DATA"})(Br||(Br={}));var Hs=t=>{let e=Fe(t);return Hs.bytes=Wt(e),e};Hs.bytes=0;function jr(t,e){let r=new Xr,n=Br.LENGTH,i=-1,o=e?.lengthDecoder??Hs,s=e?.maxLengthLength??Ay,a=e?.maxDataLength??Iy;function*c(){for(;r.byteLength>0;){if(n===Br.LENGTH)try{if(i=o(r),i<0)throw(0,Jr.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(i>a)throw(0,Jr.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=Br.DATA}catch(f){if(f instanceof RangeError){if(r.byteLength>s)throw(0,Jr.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw f}if(n===Br.DATA){if(r.byteLength<i)break;let f=r.sublist(0,i);r.consume(i),e?.onData!=null&&e.onData(f),yield f,n=Br.LENGTH}}}return Ci(t)?async function*(){for await(let f of t)r.append(f),yield*c();if(r.byteLength>0)throw(0,Jr.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,Jr.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}jr.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 jr(n,{...e??{},onLength:o=>{r=o}})};function Cy(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 zc=Cy;function _y(t){return t[Symbol.asyncIterator]!=null}function Ry(t,e){if(_y(t))return async function*(){for await(let a of t)yield e(a)}();let r=zc(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 $c=Ry;function qe(){let t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}var Ri=globalThis.CustomEvent??Event;async function*zs(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=qe(),a=qe(),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=qe(),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 Ri("task-complete"))},g=>{y.done=!0,y.err=g,i.dispatchEvent(new Ri("task-complete"))})}c=!0,i.dispatchEvent(new Ri("task-complete"))}catch(h){f=h,i.dispatchEvent(new Ri("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=qe(),await a.promise),f!=null)throw f;if(n?yield*p():yield*d(),c&&o.length===0)break}}var Li=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}},tn=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new Li(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 Li(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 $s=class extends Error{type;code;constructor(e,r){super(e??"The operation was aborted"),this.type="aborted",this.code=r??"ABORT_ERR"}};function Di(t={}){return Ly(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 Ly(t,e){e=e??{};let r=e.onEnd,n=new tn,i,o,s,a=qe(),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(v){x(v)}return i}}):t(n)}finally{n.isEmpty()&&queueMicrotask(()=>{a.resolve(),a=qe()})}},f=g=>o!=null?o(g):(n.push(g),i),u=g=>(n=new tn,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 tn,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,v;x!=null&&(m=new Promise((_,E)=>{v=()=>{E(new $s)},x.addEventListener("abort",v)}));try{await Promise.race([a.promise,m])}finally{v!=null&&x!=null&&x?.removeEventListener("abort",v)}}},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 Dy(t){return t[Symbol.asyncIterator]!=null}function Py(...t){let e=[];for(let r of t)Dy(r)||e.push(r);return e.length===t.length?function*(){for(let r of e)yield*r}():async function*(){let r=Di({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 Gc=Py;function Ws(t,...e){if(t==null)throw new Error("Empty pipeline");if(Gs(t)){let n=t;t=()=>n.source}else if(Yc(t)||Wc(t)){let n=t;t=()=>n}let r=[t,...e];if(r.length>1&&Gs(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++)Gs(r[n])&&(r[n]=Ny(r[n]));return ky(...r)}var ky=(...t)=>{let e;for(;t.length>0;)e=t.shift()(e);return e},Wc=t=>t?.[Symbol.asyncIterator]!=null,Yc=t=>t?.[Symbol.iterator]!=null,Gs=t=>t==null?!1:t.sink!=null&&t.source!=null,Ny=t=>e=>{let r=t.sink(e);if(r?.then!=null){let n=Di({objectMode:!0});r.then(()=>{n.end()},s=>{n.end(s)});let i,o=t.source;if(Wc(o))i=async function*(){yield*o,n.end()};else if(Yc(o))i=function*(){yield*o,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return Gc(n,i())}return t.source};var eu=Ut(Zc(),1);var Qc="[a-fA-F\\d:]",nr=t=>t&&t.includeBoundaries?`(?:(?<=\\s|^)(?=${Qc})|(?<=${Qc})(?=\\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}",Et="[a-fA-F\\d]{1,4}",Pi=`
|
|
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 Gy(t){return t.replace(/^\s+/,"")}});var Yf=ft((I3,Wf)=>{var we=ut();Sr();It();var Hf=Wf.exports=we.sha256=we.sha256||{};we.md.sha256=we.md.algorithms.sha256=Hf;Hf.create=function(){$f||Wy();var t=null,e=we.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=we.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=we.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),qf(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var i=we.util.createBuffer();i.putBytes(e.bytes());var o=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,s=o&n.blockLength-1;i.putBytes(_s.substr(0,n.blockLength-s));for(var a,f,c=n.fullMessageLength[0]*8,u=0;u<n.fullMessageLength.length-1;++u)a=n.fullMessageLength[u+1]*8,f=a/4294967296>>>0,c+=f,i.putInt32(c>>>0),c=a>>>0;i.putInt32(c);var h={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};qf(h,r,i);var y=we.util.createBuffer();return y.putInt32(h.h0),y.putInt32(h.h1),y.putInt32(h.h2),y.putInt32(h.h3),y.putInt32(h.h4),y.putInt32(h.h5),y.putInt32(h.h6),y.putInt32(h.h7),y},n};var _s=null,$f=!1,Gf=null;function Wy(){_s="\x80",_s+=we.util.fillString("\0",64),Gf=[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],$f=!0}function qf(t,e,r){for(var n,i,o,s,a,f,c,u,h,y,p,l,d,m,x,g=r.length();g>=64;){for(c=0;c<16;++c)e[c]=r.getInt32();for(;c<64;++c)n=e[c-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=e[c-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,e[c]=n+e[c-7]+i+e[c-16]|0;for(u=t.h0,h=t.h1,y=t.h2,p=t.h3,l=t.h4,d=t.h5,m=t.h6,x=t.h7,c=0;c<64;++c)s=(l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7),a=m^l&(d^m),o=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),f=u&h|y&(u^h),n=x+s+a+Gf[c]+e[c],i=o+f,x=m,m=d,d=l,l=p+n>>>0,p=y,y=h,h=u,u=n+i>>>0;t.h0=t.h0+u|0,t.h1=t.h1+h|0,t.h2=t.h2+y|0,t.h3=t.h3+p|0,t.h4=t.h4+l|0,t.h5=t.h5+d|0,t.h6=t.h6+m|0,t.h7=t.h7+x|0,g-=64}}});var Qf=ft((C3,Zf)=>{var Ee=ut();It();var Gi=null;Ee.util.isNodejs&&!Ee.options.usePureJavaScript&&!process.versions["node-webkit"]&&(Gi=qi());var Yy=Zf.exports=Ee.prng=Ee.prng||{};Yy.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(c,u){if(!u)return e.generateSync(c);var h=e.plugin.cipher,y=e.plugin.increment,p=e.plugin.formatKey,l=e.plugin.formatSeed,d=Ee.util.createBuffer();e.key=null,m();function m(x){if(x)return u(x);if(d.length()>=c)return u(null,d.getBytes(c));if(e.generated>1048575&&(e.key=null),e.key===null)return Ee.util.nextTick(function(){o(m)});var g=h(e.key,e.seed);e.generated+=g.length,d.putBytes(g),e.key=p(h(e.key,y(e.seed))),e.seed=l(h(e.key,e.seed)),Ee.util.setImmediate(m)}},e.generateSync=function(c){var u=e.plugin.cipher,h=e.plugin.increment,y=e.plugin.formatKey,p=e.plugin.formatSeed;e.key=null;for(var l=Ee.util.createBuffer();l.length()<c;){e.generated>1048575&&(e.key=null),e.key===null&&s();var d=u(e.key,e.seed);e.generated+=d.length,l.putBytes(d),e.key=y(u(e.key,h(e.seed))),e.seed=p(u(e.key,e.seed))}return l.getBytes(c)};function o(c){if(e.pools[0].messageLength>=32)return a(),c();var u=32-e.pools[0].messageLength<<5;e.seedFile(u,function(h,y){if(h)return c(h);e.collect(y),a(),c()})}function s(){if(e.pools[0].messageLength>=32)return a();var c=32-e.pools[0].messageLength<<5;e.collect(e.seedFileSync(c)),a()}function a(){e.reseeds=e.reseeds===4294967295?0:e.reseeds+1;var c=e.plugin.md.create();c.update(e.keyBytes);for(var u=1,h=0;h<32;++h)e.reseeds%u===0&&(c.update(e.pools[h].digest().getBytes()),e.pools[h].start()),u=u<<1;e.keyBytes=c.digest().getBytes(),c.start(),c.update(e.keyBytes);var y=c.digest().getBytes();e.key=e.plugin.formatKey(e.keyBytes),e.seed=e.plugin.formatSeed(y),e.generated=0}function f(c){var u=null,h=Ee.util.globalScope,y=h.crypto||h.msCrypto;y&&y.getRandomValues&&(u=function(w){return y.getRandomValues(w)});var p=Ee.util.createBuffer();if(u)for(;p.length()<c;){var l=Math.max(1,Math.min(c-p.length(),65536)/4),d=new Uint32Array(Math.floor(l));try{u(d);for(var m=0;m<d.length;++m)p.putInt32(d[m])}catch(w){if(!(typeof QuotaExceededError<"u"&&w instanceof QuotaExceededError))throw w}}if(p.length()<c)for(var x,g,b,A=Math.floor(Math.random()*65536);p.length()<c;){g=16807*(A&65535),x=16807*(A>>16),g+=(x&32767)<<16,g+=x>>15,g=(g&2147483647)+(g>>31),A=g&4294967295;for(var m=0;m<3;++m)b=A>>>(m<<3),b^=Math.floor(Math.random()*256),p.putByte(b&255)}return p.getBytes(c)}return Gi?(e.seedFile=function(c,u){Gi.randomBytes(c,function(h,y){if(h)return u(h);u(null,y.toString())})},e.seedFileSync=function(c){return Gi.randomBytes(c).toString()}):(e.seedFile=function(c,u){try{u(null,f(c))}catch(h){u(h)}},e.seedFileSync=f),e.collect=function(c){for(var u=c.length,h=0;h<u;++h)e.pools[e.pool].update(c.substr(h,1)),e.pool=e.pool===31?0:e.pool+1},e.collectInt=function(c,u){for(var h="",y=0;y<u;y+=8)h+=String.fromCharCode(c>>y&255);e.collect(h)},e.registerWorker=function(c){if(c===self)e.seedFile=function(h,y){function p(l){var d=l.data;d.forge&&d.forge.prng&&(self.removeEventListener("message",p),y(d.forge.prng.err,d.forge.prng.bytes))}self.addEventListener("message",p),self.postMessage({forge:{prng:{needed:h}}})};else{var u=function(h){var y=h.data;y.forge&&y.forge.prng&&e.seedFile(y.forge.prng.needed,function(p,l){c.postMessage({forge:{prng:{err:p,bytes:l}}})})};c.addEventListener("message",u)}},e}});var Jn=ft((T3,Ns)=>{var _t=ut();Ds();Yf();Qf();It();(function(){if(_t.random&&_t.random.getBytes){Ns.exports=_t.random;return}(function(t){var e={},r=new Array(4),n=_t.util.createBuffer();e.formatKey=function(h){var y=_t.util.createBuffer(h);return h=new Array(4),h[0]=y.getInt32(),h[1]=y.getInt32(),h[2]=y.getInt32(),h[3]=y.getInt32(),_t.aes._expandKey(h,!1)},e.formatSeed=function(h){var y=_t.util.createBuffer(h);return h=new Array(4),h[0]=y.getInt32(),h[1]=y.getInt32(),h[2]=y.getInt32(),h[3]=y.getInt32(),h},e.cipher=function(h,y){return _t.aes._updateBlock(h,y,r,!1),n.putInt32(r[0]),n.putInt32(r[1]),n.putInt32(r[2]),n.putInt32(r[3]),n.getBytes()},e.increment=function(h){return++h[3],h},e.md=_t.md.sha256;function i(){var h=_t.prng.create(e);return h.getBytes=function(y,p){return h.generate(y,p)},h.getBytesSync=function(y){return h.generate(y)},h}var o=i(),s=null,a=_t.util.globalScope,f=a.crypto||a.msCrypto;if(f&&f.getRandomValues&&(s=function(h){return f.getRandomValues(h)}),_t.options.usePureJavaScript||!_t.util.isNodejs&&!s){if(typeof window>"u"||window.document,o.collectInt(+new Date,32),typeof navigator<"u"){var c="";for(var u in navigator)try{typeof navigator[u]=="string"&&(c+=navigator[u])}catch{}o.collect(c),c=null}t&&(t().mousemove(function(h){o.collectInt(h.clientX,16),o.collectInt(h.clientY,16)}),t().keypress(function(h){o.collectInt(h.charCode,8)}))}if(!_t.random)_t.random=o;else for(var u in o)_t.random[u]=o[u];_t.random.createInstance=i,Ns.exports=_t.random})(typeof jQuery<"u"?jQuery:null)})()});var tu=ft((R3,jf)=>{var Gt=ut();It();var Ps=[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],Xf=[1,2,3,5],Zy=function(t,e){return t<<e&65535|(t&65535)>>16-e},Qy=function(t,e){return(t&65535)>>e|t<<16-e&65535};jf.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(Ps[r.at(a-1)+r.at(a-n)&255]);for(r.setAt(128-o,Ps[r.at(128-o)&s]),a=127-o;a>=0;a--)r.setAt(a,Ps[r.at(a+1)^r.at(a+o)]);return r};var Jf=function(t,e,r){var n=!1,i=null,o=null,s=null,a,f,c,u,h=[];for(t=Gt.rc2.expandKey(t,e),c=0;c<64;c++)h.push(t.getInt16Le());r?(a=function(l){for(c=0;c<4;c++)l[c]+=h[u]+(l[(c+3)%4]&l[(c+2)%4])+(~l[(c+3)%4]&l[(c+1)%4]),l[c]=Zy(l[c],Xf[c]),u++},f=function(l){for(c=0;c<4;c++)l[c]+=h[l[(c+3)%4]&63]}):(a=function(l){for(c=3;c>=0;c--)l[c]=Qy(l[c],Xf[c]),l[c]-=h[u]+(l[(c+3)%4]&l[(c+2)%4])+(~l[(c+3)%4]&l[(c+1)%4]),u--},f=function(l){for(c=3;c>=0;c--)l[c]-=h[l[(c+3)%4]&63]});var y=function(l){var d=[];for(c=0;c<4;c++){var m=i.getInt16Le();s!==null&&(r?m^=s.getInt16Le():s.putInt16Le(m)),d.push(m&65535)}u=r?0:63;for(var x=0;x<l.length;x++)for(var g=0;g<l[x][0];g++)l[x][1](d);for(c=0;c<4;c++)s!==null&&(r?s.putInt16Le(d[c]):d[c]^=s.getInt16Le()),o.putInt16Le(d[c])},p=null;return p={start:function(l,d){l&&typeof l=="string"&&(l=Gt.util.createBuffer(l)),n=!1,i=Gt.util.createBuffer(),o=d||new Gt.util.createBuffer,s=l,p.output=o},update:function(l){for(n||i.putBuffer(l);i.length()>=8;)y([[5,a],[1,f],[6,a],[1,f],[5,a]])},finish:function(l){var d=!0;if(r)if(l)d=l(8,i,!r);else{var m=i.length()===8?8:8-i.length();i.fillWithByte(m,m)}if(d&&(n=!0,p.update()),!r&&(d=i.length()===0,d))if(l)d=l(8,o,!r);else{var x=o.length(),g=o.at(x-1);g>x?d=!1:o.truncate(g)}return d}},p};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 Jf(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 Jf(t,e,!1)}});var Zi=ft((L3,cu)=>{var ks=ut();cu.exports=ks.jsbn=ks.jsbn||{};var ke,Xy=0xdeadbeefcafe,eu=(Xy&16777215)==15715070;function R(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))}ks.jsbn.BigInteger=R;function rt(){return new R(null)}function Jy(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 jy(t,e,r,n,i,o){for(var s=e&32767,a=e>>15;--o>=0;){var f=this.data[t]&32767,c=this.data[t++]>>15,u=a*f+c*s;f=s*f+((u&32767)<<15)+r.data[n]+(i&1073741823),i=(f>>>30)+(u>>>15)+a*c+(i>>>30),r.data[n++]=f&1073741823}return i}function ru(t,e,r,n,i,o){for(var s=e&16383,a=e>>14;--o>=0;){var f=this.data[t]&16383,c=this.data[t++]>>14,u=a*f+c*s;f=s*f+((u&16383)<<14)+r.data[n]+i,i=(f>>28)+(u>>14)+a*c,r.data[n++]=f&268435455}return i}typeof navigator>"u"?(R.prototype.am=ru,ke=28):eu&&navigator.appName=="Microsoft Internet Explorer"?(R.prototype.am=jy,ke=30):eu&&navigator.appName!="Netscape"?(R.prototype.am=Jy,ke=26):(R.prototype.am=ru,ke=28);R.prototype.DB=ke;R.prototype.DM=(1<<ke)-1;R.prototype.DV=1<<ke;var Us=52;R.prototype.FV=Math.pow(2,Us);R.prototype.F1=Us-ke;R.prototype.F2=2*ke-Us;var t1="0123456789abcdefghijklmnopqrstuvwxyz",Wi=new Array,en,re;en=48;for(re=0;re<=9;++re)Wi[en++]=re;en=97;for(re=10;re<36;++re)Wi[en++]=re;en=65;for(re=10;re<36;++re)Wi[en++]=re;function nu(t){return t1.charAt(t)}function iu(t,e){var r=Wi[t.charCodeAt(e)];return r??-1}function e1(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 r1(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 ir(t){var e=rt();return e.fromInt(t),e}function n1(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:iu(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&&R.ZERO.subTo(this,this)}function i1(){for(var t=this.s&this.DM;this.t>0&&this.data[this.t-1]==t;)--this.t}function o1(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=nu(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+=nu(n));return i?o:"0"}function s1(){var t=rt();return R.ZERO.subTo(this,t),t}function a1(){return this.s<0?this.negate():this}function c1(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 Yi(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 f1(){return this.t<=0?0:this.DB*(this.t-1)+Yi(this.data[this.t-1]^this.s&this.DM)}function u1(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 h1(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 l1(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 d1(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 p1(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 y1(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&&R.ZERO.subTo(e,e)}function m1(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 x1(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=rt());var o=rt(),s=this.s,a=t.s,f=this.DB-Yi(n.data[n.t-1]);f>0?(n.lShiftTo(f,o),i.lShiftTo(f,r)):(n.copyTo(o),i.copyTo(r));var c=o.t,u=o.data[c-1];if(u!=0){var h=u*(1<<this.F1)+(c>1?o.data[c-2]>>this.F2:0),y=this.FV/h,p=(1<<this.F1)/h,l=1<<this.F2,d=r.t,m=d-c,x=e??rt();for(o.dlShiftTo(m,x),r.compareTo(x)>=0&&(r.data[r.t++]=1,r.subTo(x,r)),R.ONE.dlShiftTo(c,x),x.subTo(o,o);o.t<c;)o.data[o.t++]=0;for(;--m>=0;){var g=r.data[--d]==u?this.DM:Math.floor(r.data[d]*y+(r.data[d-1]+l)*p);if((r.data[d]+=o.am(0,g,r,m,0,c))<g)for(o.dlShiftTo(m,x),r.subTo(x,r);r.data[d]<--g;)r.subTo(x,r)}e!=null&&(r.drShiftTo(c,e),s!=a&&R.ZERO.subTo(e,e)),r.t=c,r.clamp(),f>0&&r.rShiftTo(f,r),s<0&&R.ZERO.subTo(r,r)}}}function g1(t){var e=rt();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(R.ZERO)>0&&t.subTo(e,e),e}function Ar(t){this.m=t}function b1(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function v1(t){return t}function w1(t){t.divRemTo(this.m,null,t)}function E1(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function S1(t,e){t.squareTo(e),this.reduce(e)}Ar.prototype.convert=b1;Ar.prototype.revert=v1;Ar.prototype.reduce=w1;Ar.prototype.mulTo=E1;Ar.prototype.sqrTo=S1;function A1(){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 Br(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 B1(t){var e=rt();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(R.ZERO)>0&&this.m.subTo(e,e),e}function I1(t){var e=rt();return t.copyTo(e),this.reduce(e),e}function C1(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 T1(t,e){t.squareTo(e),this.reduce(e)}function R1(t,e,r){t.multiplyTo(e,r),this.reduce(r)}Br.prototype.convert=B1;Br.prototype.revert=I1;Br.prototype.reduce=C1;Br.prototype.mulTo=R1;Br.prototype.sqrTo=T1;function L1(){return(this.t>0?this.data[0]&1:this.s)==0}function D1(t,e){if(t>4294967295||t<1)return R.ONE;var r=rt(),n=rt(),i=e.convert(this),o=Yi(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 _1(t,e){var r;return t<256||e.isEven()?r=new Ar(e):r=new Br(e),this.exp(t,r)}R.prototype.copyTo=e1;R.prototype.fromInt=r1;R.prototype.fromString=n1;R.prototype.clamp=i1;R.prototype.dlShiftTo=u1;R.prototype.drShiftTo=h1;R.prototype.lShiftTo=l1;R.prototype.rShiftTo=d1;R.prototype.subTo=p1;R.prototype.multiplyTo=y1;R.prototype.squareTo=m1;R.prototype.divRemTo=x1;R.prototype.invDigit=A1;R.prototype.isEven=L1;R.prototype.exp=D1;R.prototype.toString=o1;R.prototype.negate=s1;R.prototype.abs=a1;R.prototype.compareTo=c1;R.prototype.bitLength=f1;R.prototype.mod=g1;R.prototype.modPowInt=_1;R.ZERO=ir(0);R.ONE=ir(1);function N1(){var t=rt();return this.copyTo(t),t}function P1(){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 k1(){return this.t==0?this.s:this.data[0]<<24>>24}function U1(){return this.t==0?this.s:this.data[0]<<16>>16}function O1(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function F1(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function M1(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=ir(r),i=rt(),o=rt(),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 K1(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 f=iu(t,a);if(f<0){t.charAt(a)=="-"&&this.signum()==0&&(i=!0);continue}s=e*s+f,++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&&R.ZERO.subTo(this,this)}function V1(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(R.ONE.shiftLeft(t-1),Os,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(R.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 z1(){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 q1(t){return this.compareTo(t)==0}function H1(t){return this.compareTo(t)<0?this:t}function $1(t){return this.compareTo(t)>0?this:t}function G1(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 W1(t,e){return t&e}function Y1(t){var e=rt();return this.bitwiseTo(t,W1,e),e}function Os(t,e){return t|e}function Z1(t){var e=rt();return this.bitwiseTo(t,Os,e),e}function ou(t,e){return t^e}function Q1(t){var e=rt();return this.bitwiseTo(t,ou,e),e}function su(t,e){return t&~e}function X1(t){var e=rt();return this.bitwiseTo(t,su,e),e}function J1(){for(var t=rt(),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 j1(t){var e=rt();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}function tm(t){var e=rt();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}function em(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 rm(){for(var t=0;t<this.t;++t)if(this.data[t]!=0)return t*this.DB+em(this.data[t]);return this.s<0?this.t*this.DB:-1}function nm(t){for(var e=0;t!=0;)t&=t-1,++e;return e}function im(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=nm(this.data[r]^e);return t}function om(t){var e=Math.floor(t/this.DB);return e>=this.t?this.s!=0:(this.data[e]&1<<t%this.DB)!=0}function sm(t,e){var r=R.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r}function am(t){return this.changeBit(t,Os)}function cm(t){return this.changeBit(t,su)}function fm(t){return this.changeBit(t,ou)}function um(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 hm(t){var e=rt();return this.addTo(t,e),e}function lm(t){var e=rt();return this.subTo(t,e),e}function dm(t){var e=rt();return this.multiplyTo(t,e),e}function pm(t){var e=rt();return this.divRemTo(t,e,null),e}function ym(t){var e=rt();return this.divRemTo(t,null,e),e}function mm(t){var e=rt(),r=rt();return this.divRemTo(t,e,r),new Array(e,r)}function xm(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function gm(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 jn(){}function au(t){return t}function bm(t,e,r){t.multiplyTo(e,r)}function vm(t,e){t.squareTo(e)}jn.prototype.convert=au;jn.prototype.revert=au;jn.prototype.mulTo=bm;jn.prototype.sqrTo=vm;function wm(t){return this.exp(t,new jn)}function Em(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 Sm(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 rn(t){this.r2=rt(),this.q3=rt(),R.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function Am(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=rt();return t.copyTo(e),this.reduce(e),e}function Bm(t){return t}function Im(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 Cm(t,e){t.squareTo(e),this.reduce(e)}function Tm(t,e,r){t.multiplyTo(e,r),this.reduce(r)}rn.prototype.convert=Am;rn.prototype.revert=Bm;rn.prototype.reduce=Im;rn.prototype.mulTo=Tm;rn.prototype.sqrTo=Cm;function Rm(t,e){var r=t.bitLength(),n,i=ir(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 Ar(e):e.isEven()?o=new rn(e):o=new Br(e);var s=new Array,a=3,f=n-1,c=(1<<n)-1;if(s[1]=o.convert(this),n>1){var u=rt();for(o.sqrTo(s[1],u);a<=c;)s[a]=rt(),o.mulTo(u,s[a-2],s[a]),a+=2}var h=t.t-1,y,p=!0,l=rt(),d;for(r=Yi(t.data[h])-1;h>=0;){for(r>=f?y=t.data[h]>>r-f&c:(y=(t.data[h]&(1<<r+1)-1)<<f-r,h>0&&(y|=t.data[h-1]>>this.DB+r-f)),a=n;!(y&1);)y>>=1,--a;if((r-=a)<0&&(r+=this.DB,--h),p)s[y].copyTo(i),p=!1;else{for(;a>1;)o.sqrTo(i,l),o.sqrTo(l,i),a-=2;a>0?o.sqrTo(i,l):(d=i,i=l,l=d),o.mulTo(l,s[y],i)}for(;h>=0&&!(t.data[h]&1<<r);)o.sqrTo(i,l),d=i,i=l,l=d,--r<0&&(r=this.DB-1,--h)}return o.revert(i)}function Lm(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 Dm(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 _m(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return R.ZERO;for(var r=t.clone(),n=this.clone(),i=ir(1),o=ir(0),s=ir(0),a=ir(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(R.ONE)!=0)return R.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 ce=[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],Nm=(1<<26)/ce[ce.length-1];function Pm(t){var e,r=this.abs();if(r.t==1&&r.data[0]<=ce[ce.length-1]){for(e=0;e<ce.length;++e)if(r.data[0]==ce[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<ce.length;){for(var n=ce[e],i=e+1;i<ce.length&&n<Nm;)n*=ce[i++];for(n=r.modInt(n);e<i;)if(n%ce[e++]==0)return!1}return r.millerRabin(t)}function km(t){var e=this.subtract(R.ONE),r=e.getLowestSetBit();if(r<=0)return!1;for(var n=e.shiftRight(r),i=Um(),o,s=0;s<t;++s){do o=new R(this.bitLength(),i);while(o.compareTo(R.ONE)<=0||o.compareTo(e)>=0);var a=o.modPow(n,this);if(a.compareTo(R.ONE)!=0&&a.compareTo(e)!=0){for(var f=1;f++<r&&a.compareTo(e)!=0;)if(a=a.modPowInt(2,this),a.compareTo(R.ONE)==0)return!1;if(a.compareTo(e)!=0)return!1}}return!0}function Um(){return{nextBytes:function(t){for(var e=0;e<t.length;++e)t[e]=Math.floor(Math.random()*256)}}}R.prototype.chunkSize=O1;R.prototype.toRadix=M1;R.prototype.fromRadix=K1;R.prototype.fromNumber=V1;R.prototype.bitwiseTo=G1;R.prototype.changeBit=sm;R.prototype.addTo=um;R.prototype.dMultiply=xm;R.prototype.dAddOffset=gm;R.prototype.multiplyLowerTo=Em;R.prototype.multiplyUpperTo=Sm;R.prototype.modInt=Dm;R.prototype.millerRabin=km;R.prototype.clone=N1;R.prototype.intValue=P1;R.prototype.byteValue=k1;R.prototype.shortValue=U1;R.prototype.signum=F1;R.prototype.toByteArray=z1;R.prototype.equals=q1;R.prototype.min=H1;R.prototype.max=$1;R.prototype.and=Y1;R.prototype.or=Z1;R.prototype.xor=Q1;R.prototype.andNot=X1;R.prototype.not=J1;R.prototype.shiftLeft=j1;R.prototype.shiftRight=tm;R.prototype.getLowestSetBit=rm;R.prototype.bitCount=im;R.prototype.testBit=om;R.prototype.setBit=am;R.prototype.clearBit=cm;R.prototype.flipBit=fm;R.prototype.add=hm;R.prototype.subtract=lm;R.prototype.multiply=dm;R.prototype.divide=pm;R.prototype.remainder=ym;R.prototype.divideAndRemainder=mm;R.prototype.modPow=Rm;R.prototype.modInverse=_m;R.prototype.pow=wm;R.prototype.gcd=Lm;R.prototype.isProbablePrime=Pm});var du=ft((D3,lu)=>{var Se=ut();Sr();It();var uu=lu.exports=Se.sha1=Se.sha1||{};Se.md.sha1=Se.md.algorithms.sha1=uu;uu.create=function(){hu||Om();var t=null,e=Se.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=Se.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},n},n.start(),n.update=function(i,o){o==="utf8"&&(i=Se.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),fu(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var i=Se.util.createBuffer();i.putBytes(e.bytes());var o=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,s=o&n.blockLength-1;i.putBytes(Fs.substr(0,n.blockLength-s));for(var a,f,c=n.fullMessageLength[0]*8,u=0;u<n.fullMessageLength.length-1;++u)a=n.fullMessageLength[u+1]*8,f=a/4294967296>>>0,c+=f,i.putInt32(c>>>0),c=a>>>0;i.putInt32(c);var h={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};fu(h,r,i);var y=Se.util.createBuffer();return y.putInt32(h.h0),y.putInt32(h.h1),y.putInt32(h.h2),y.putInt32(h.h3),y.putInt32(h.h4),y},n};var Fs=null,hu=!1;function Om(){Fs="\x80",Fs+=Se.util.fillString("\0",64),hu=!0}function fu(t,e,r){for(var n,i,o,s,a,f,c,u,h=r.length();h>=64;){for(i=t.h0,o=t.h1,s=t.h2,a=t.h3,f=t.h4,u=0;u<16;++u)n=r.getInt32(),e[u]=n,c=a^o&(s^a),n=(i<<5|i>>>27)+c+f+1518500249+n,f=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,c=a^o&(s^a),n=(i<<5|i>>>27)+c+f+1518500249+n,f=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,c=o^s^a,n=(i<<5|i>>>27)+c+f+1859775393+n,f=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,c=o^s^a,n=(i<<5|i>>>27)+c+f+1859775393+n,f=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,c=o&s|a&(o^s),n=(i<<5|i>>>27)+c+f+2400959708+n,f=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,c=o^s^a,n=(i<<5|i>>>27)+c+f+3395469782+n,f=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+f|0,h-=64}}});var mu=ft((_3,yu)=>{var Ae=ut();It();Jn();du();var pu=yu.exports=Ae.pkcs1=Ae.pkcs1||{};pu.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=Ae.md.sha1.create(),s||(s=o);var a=Math.ceil(t.n.bitLength()/8),f=a-2*o.digestLength-2;if(e.length>f){var c=new Error("RSAES-OAEP input message length is too long.");throw c.length=e.length,c.maxLength=f,c}n||(n=""),o.update(n,"raw");for(var u=o.digest(),h="",y=f-e.length,p=0;p<y;p++)h+="\0";var l=u.getBytes()+h+""+e;if(!i)i=Ae.random.getBytes(o.digestLength);else if(i.length!==o.digestLength){var c=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw c.seedLength=i.length,c.digestLength=o.digestLength,c}var d=Qi(i,a-o.digestLength-1,s),m=Ae.util.xorBytes(l,d,l.length),x=Qi(m,o.digestLength,s),g=Ae.util.xorBytes(i,x,i.length);return"\0"+g+m};pu.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 m=new Error("RSAES-OAEP encoded message length is invalid.");throw m.length=e.length,m.expectedLength=s,m}if(i===void 0?i=Ae.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(),f=e.charAt(0),c=e.substring(1,i.digestLength+1),u=e.substring(1+i.digestLength),h=Qi(u,i.digestLength,o),y=Ae.util.xorBytes(c,h,c.length),p=Qi(y,s-i.digestLength-1,o),l=Ae.util.xorBytes(u,p,u.length),d=l.substring(0,i.digestLength),m=f!=="\0",x=0;x<i.digestLength;++x)m|=a.charAt(x)!==d.charAt(x);for(var g=1,b=i.digestLength,A=i.digestLength;A<l.length;A++){var w=l.charCodeAt(A),E=w&1^1,B=g?65534:0;m|=w&B,g=g&E,b+=g}if(m||l.charCodeAt(b)!==1)throw new Error("Invalid RSAES-OAEP padding.");return l.substring(b+1)};function Qi(t,e,r){r||(r=Ae.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 xu=ft((N3,Ms)=>{var or=ut();It();Zi();Jn();(function(){if(or.prime){Ms.exports=or.prime;return}var t=Ms.exports=or.prime=or.prime||{},e=or.jsbn.BigInteger,r=[6,4,2,4,2,4,6,2],n=new e(null);n.fromInt(30);var i=function(h,y){return h|y};t.generateProbablePrime=function(h,y,p){typeof y=="function"&&(p=y,y={}),y=y||{};var l=y.algorithm||"PRIMEINC";typeof l=="string"&&(l={name:l}),l.options=l.options||{};var d=y.prng||or.random,m={nextBytes:function(x){for(var g=d.getBytesSync(x.length),b=0;b<x.length;++b)x[b]=g.charCodeAt(b)}};if(l.name==="PRIMEINC")return o(h,m,l.options,p);throw new Error("Invalid prime generation algorithm: "+l.name)};function o(h,y,p,l){return"workers"in p?f(h,y,p,l):s(h,y,p,l)}function s(h,y,p,l){var d=c(h,y),m=0,x=u(d.bitLength());"millerRabinTests"in p&&(x=p.millerRabinTests);var g=10;"maxBlockTime"in p&&(g=p.maxBlockTime),a(d,h,y,m,x,g,l)}function a(h,y,p,l,d,m,x){var g=+new Date;do{if(h.bitLength()>y&&(h=c(y,p)),h.isProbablePrime(d))return x(null,h);h.dAddOffset(r[l++%8],0)}while(m<0||+new Date-g<m);or.util.setImmediate(function(){a(h,y,p,l,d,m,x)})}function f(h,y,p,l){if(typeof Worker>"u")return s(h,y,p,l);var d=c(h,y),m=p.workers,x=p.workLoad||100,g=x*30/8,b=p.workerScript||"forge/prime.worker.js";if(m===-1)return or.util.estimateCores(function(w,E){w&&(E=2),m=E-1,A()});A();function A(){m=Math.max(1,m);for(var w=[],E=0;E<m;++E)w[E]=new Worker(b);for(var B=m,E=0;E<m;++E)w[E].addEventListener("message",M);var C=!1;function M(H){if(!C){--B;var z=H.data;if(z.found){for(var J=0;J<w.length;++J)w[J].terminate();return C=!0,l(null,new e(z.prime,16))}d.bitLength()>h&&(d=c(h,y));var ct=d.toString(16);H.target.postMessage({hex:ct,workLoad:x}),d.dAddOffset(g,0)}}}}function c(h,y){var p=new e(h,y),l=h-1;return p.testBit(l)||p.bitwiseTo(e.ONE.shiftLeft(l),i,p),p.dAddOffset(31-p.mod(n).byteValue(),0),p}function u(h){return h<=100?27:h<=150?18:h<=200?15:h<=250?12:h<=300?9:h<=350?8:h<=400?7:h<=500?6:h<=600?5:h<=800?4:h<=1250?3:2}})()});var Ji=ft((P3,Au)=>{var V=ut();Xn();Zi();Ui();mu();xu();Jn();It();typeof et>"u"&&(et=V.jsbn.BigInteger);var et,Ks=V.util.isNodejs?qi():null,S=V.asn1,ne=V.util;V.pki=V.pki||{};Au.exports=V.pki.rsa=V.rsa=V.rsa||{};var $=V.pki,Fm=[6,4,2,4,2,4,6,2],Mm={name:"PrivateKeyInfo",tagClass:S.Class.UNIVERSAL,type:S.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:S.Class.UNIVERSAL,type:S.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:S.Class.UNIVERSAL,type:S.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:S.Class.UNIVERSAL,type:S.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:S.Class.UNIVERSAL,type:S.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},Km={name:"RSAPrivateKey",tagClass:S.Class.UNIVERSAL,type:S.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:S.Class.UNIVERSAL,type:S.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:S.Class.UNIVERSAL,type:S.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:S.Class.UNIVERSAL,type:S.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:S.Class.UNIVERSAL,type:S.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:S.Class.UNIVERSAL,type:S.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:S.Class.UNIVERSAL,type:S.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:S.Class.UNIVERSAL,type:S.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:S.Class.UNIVERSAL,type:S.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:S.Class.UNIVERSAL,type:S.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},Vm={name:"RSAPublicKey",tagClass:S.Class.UNIVERSAL,type:S.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:S.Class.UNIVERSAL,type:S.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:S.Class.UNIVERSAL,type:S.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},zm=V.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:S.Class.UNIVERSAL,type:S.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:S.Class.UNIVERSAL,type:S.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:S.Class.UNIVERSAL,type:S.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:S.Class.UNIVERSAL,type:S.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:S.Class.UNIVERSAL,type:S.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},qm={name:"DigestInfo",tagClass:S.Class.UNIVERSAL,type:S.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:S.Class.UNIVERSAL,type:S.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:S.Class.UNIVERSAL,type:S.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:S.Class.UNIVERSAL,type:S.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:S.Class.UNIVERSAL,type:S.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},Hm=function(t){var e;if(t.algorithm in $.oids)e=$.oids[t.algorithm];else{var r=new Error("Unknown message digest algorithm.");throw r.algorithm=t.algorithm,r}var n=S.oidToDer(e).getBytes(),i=S.create(S.Class.UNIVERSAL,S.Type.SEQUENCE,!0,[]),o=S.create(S.Class.UNIVERSAL,S.Type.SEQUENCE,!0,[]);o.value.push(S.create(S.Class.UNIVERSAL,S.Type.OID,!1,n)),o.value.push(S.create(S.Class.UNIVERSAL,S.Type.NULL,!1,""));var s=S.create(S.Class.UNIVERSAL,S.Type.OCTETSTRING,!1,t.digest().getBytes());return i.value.push(o),i.value.push(s),S.toDer(i).getBytes()},Eu=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(et.ONE))),e.dQ||(e.dQ=e.d.mod(e.q.subtract(et.ONE))),e.qInv||(e.qInv=e.q.modInverse(e.p));var n;do n=new et(V.util.bytesToHex(V.random.getBytes(e.n.bitLength()/8)),16);while(n.compareTo(e.n)>=0||!n.gcd(e.n).equals(et.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};$.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=Su(t,e,r)):(i=V.util.createBuffer(),i.putBytes(t));for(var s=new et(i.toHex(),16),a=Eu(s,e,n),f=a.toString(16),c=V.util.createBuffer(),u=o-Math.ceil(f.length/2);u>0;)c.putByte(0),--u;return c.putBytes(V.util.hexToBytes(f)),c.getBytes()};$.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 et(V.util.createBuffer(t).toHex(),16);if(s.compareTo(e.n)>=0)throw new Error("Encrypted message is invalid.");for(var a=Eu(s,e,r),f=a.toString(16),c=V.util.createBuffer(),u=i-Math.ceil(f.length/2);u>0;)c.putByte(0),--u;return c.putBytes(V.util.hexToBytes(f)),n!==!1?Xi(c.getBytes(),e,r):c.getBytes()};$.rsa.createKeyPairGenerationState=function(t,e,r){typeof t=="string"&&(t=parseInt(t,10)),t=t||2048,r=r||{};var n=r.prng||V.random,i={nextBytes:function(a){for(var f=n.getBytesSync(a.length),c=0;c<a.length;++c)a[c]=f.charCodeAt(c)}},o=r.algorithm||"PRIMEINC",s;if(o==="PRIMEINC")s={algorithm:o,state:0,bits:t,rng:i,eInt:e||65537,e:new et(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};$.rsa.stepKeyPairGenerationState=function(t,e){"algorithm"in t||(t.algorithm="PRIMEINC");var r=new et(null);r.fromInt(30);for(var n=0,i=function(h,y){return h|y},o=+new Date,s,a=0;t.keys===null&&(e<=0||a<e);){if(t.state===0){var f=t.p===null?t.pBits:t.qBits,c=f-1;t.pqState===0?(t.num=new et(f,t.rng),t.num.testBit(c)||t.num.bitwiseTo(et.ONE.shiftLeft(c),i,t.num),t.num.dAddOffset(31-t.num.mod(r).byteValue(),0),n=0,++t.pqState):t.pqState===1?t.num.bitLength()>f?t.pqState=0:t.num.isProbablePrime(Gm(t.num.bitLength()))?++t.pqState:t.num.dAddOffset(Fm[n++%8],0):t.pqState===2?t.pqState=t.num.subtract(et.ONE).gcd(t.e).compareTo(et.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(et.ONE),t.q1=t.q.subtract(et.ONE),t.phi=t.p1.multiply(t.q1),++t.state;else if(t.state===3)t.phi.gcd(t.e).compareTo(et.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:$.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:$.rsa.setPublicKey(t.n,t.e)}}s=+new Date,a+=s-o,o=s}return t.keys!==null};$.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),!V.options.usePureJavaScript&&!r.prng&&t>=256&&t<=16384&&(e===65537||e===3)){if(n){if(gu("generateKeyPair"))return Ks.generateKeyPair("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(a,f,c){if(a)return n(a);n(null,{privateKey:$.privateKeyFromPem(c),publicKey:$.publicKeyFromPem(f)})});if(bu("generateKey")&&bu("exportKey"))return ne.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:wu(e),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(a){return ne.globalScope.crypto.subtle.exportKey("pkcs8",a.privateKey)}).then(void 0,function(a){n(a)}).then(function(a){if(a){var f=$.privateKeyFromAsn1(S.fromDer(V.util.createBuffer(a)));n(null,{privateKey:f,publicKey:$.setRsaPublicKey(f.n,f.e)})}});if(vu("generateKey")&&vu("exportKey")){var i=ne.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:wu(e),hash:{name:"SHA-256"}},!0,["sign","verify"]);i.oncomplete=function(a){var f=a.target.result,c=ne.globalScope.msCrypto.subtle.exportKey("pkcs8",f.privateKey);c.oncomplete=function(u){var h=u.target.result,y=$.privateKeyFromAsn1(S.fromDer(V.util.createBuffer(h)));n(null,{privateKey:y,publicKey:$.setRsaPublicKey(y.n,y.e)})},c.onerror=function(u){n(u)}},i.onerror=function(a){n(a)};return}}else if(gu("generateKeyPairSync")){var o=Ks.generateKeyPairSync("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:$.privateKeyFromPem(o.privateKey),publicKey:$.publicKeyFromPem(o.publicKey)}}}var s=$.rsa.createKeyPairGenerationState(t,e,r);if(!n)return $.rsa.stepKeyPairGenerationState(s,0),s.keys;$m(s,r,n)};$.setRsaPublicKey=$.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,f,c){return Su(a,f,2).getBytes()}};else if(i==="RSA-OAEP"||i==="RSAES-OAEP")i={encode:function(a,f){return V.pkcs1.encode_rsa_oaep(f,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 $.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(f,c){c=Xi(c,r,!0);var u=S.fromDer(c,{parseAllBytes:s._parseAllDigestBytes}),h={},y=[];if(!S.validate(u,qm,h,y)){var p=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw p.errors=y,p}var l=S.derToOid(h.algorithmIdentifier);if(!(l===V.oids.md2||l===V.oids.md5||l===V.oids.sha1||l===V.oids.sha224||l===V.oids.sha256||l===V.oids.sha384||l===V.oids.sha512||l===V.oids["sha512-224"]||l===V.oids["sha512-256"])){var p=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw p.oid=l,p}if((l===V.oids.md2||l===V.oids.md5)&&!("parameters"in h))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return f===h.digest}}:(o==="NONE"||o==="NULL"||o===null)&&(o={verify:function(f,c){return c=Xi(c,r,!0),f===c}});var a=$.rsa.decrypt(i,r,!0,!1);return o.verify(n,a,r.n.bitLength())},r};$.setRsaPrivateKey=$.rsa.setPrivateKey=function(t,e,r,n,i,o,s,a){var f={n:t,e,d:r,p:n,q:i,dP:o,dQ:s,qInv:a};return f.decrypt=function(c,u,h){typeof u=="string"?u=u.toUpperCase():u===void 0&&(u="RSAES-PKCS1-V1_5");var y=$.rsa.decrypt(c,f,!1,!1);if(u==="RSAES-PKCS1-V1_5")u={decode:Xi};else if(u==="RSA-OAEP"||u==="RSAES-OAEP")u={decode:function(p,l){return V.pkcs1.decode_rsa_oaep(l,p,h)}};else if(["RAW","NONE","NULL",null].indexOf(u)!==-1)u={decode:function(p){return p}};else throw new Error('Unsupported encryption scheme: "'+u+'".');return u.decode(y,f,!1)},f.sign=function(c,u){var h=!1;typeof u=="string"&&(u=u.toUpperCase()),u===void 0||u==="RSASSA-PKCS1-V1_5"?(u={encode:Hm},h=1):(u==="NONE"||u==="NULL"||u===null)&&(u={encode:function(){return c}},h=1);var y=u.encode(c,f.n.bitLength());return $.rsa.encrypt(y,f,h)},f};$.wrapRsaPrivateKey=function(t){return S.create(S.Class.UNIVERSAL,S.Type.SEQUENCE,!0,[S.create(S.Class.UNIVERSAL,S.Type.INTEGER,!1,S.integerToDer(0).getBytes()),S.create(S.Class.UNIVERSAL,S.Type.SEQUENCE,!0,[S.create(S.Class.UNIVERSAL,S.Type.OID,!1,S.oidToDer($.oids.rsaEncryption).getBytes()),S.create(S.Class.UNIVERSAL,S.Type.NULL,!1,"")]),S.create(S.Class.UNIVERSAL,S.Type.OCTETSTRING,!1,S.toDer(t).getBytes())])};$.privateKeyFromAsn1=function(t){var e={},r=[];if(S.validate(t,Mm,e,r)&&(t=S.fromDer(V.util.createBuffer(e.privateKey))),e={},r=[],!S.validate(t,Km,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,f,c,u,h;return i=V.util.createBuffer(e.privateKeyModulus).toHex(),o=V.util.createBuffer(e.privateKeyPublicExponent).toHex(),s=V.util.createBuffer(e.privateKeyPrivateExponent).toHex(),a=V.util.createBuffer(e.privateKeyPrime1).toHex(),f=V.util.createBuffer(e.privateKeyPrime2).toHex(),c=V.util.createBuffer(e.privateKeyExponent1).toHex(),u=V.util.createBuffer(e.privateKeyExponent2).toHex(),h=V.util.createBuffer(e.privateKeyCoefficient).toHex(),$.setRsaPrivateKey(new et(i,16),new et(o,16),new et(s,16),new et(a,16),new et(f,16),new et(c,16),new et(u,16),new et(h,16))};$.privateKeyToAsn1=$.privateKeyToRSAPrivateKey=function(t){return S.create(S.Class.UNIVERSAL,S.Type.SEQUENCE,!0,[S.create(S.Class.UNIVERSAL,S.Type.INTEGER,!1,S.integerToDer(0).getBytes()),S.create(S.Class.UNIVERSAL,S.Type.INTEGER,!1,Be(t.n)),S.create(S.Class.UNIVERSAL,S.Type.INTEGER,!1,Be(t.e)),S.create(S.Class.UNIVERSAL,S.Type.INTEGER,!1,Be(t.d)),S.create(S.Class.UNIVERSAL,S.Type.INTEGER,!1,Be(t.p)),S.create(S.Class.UNIVERSAL,S.Type.INTEGER,!1,Be(t.q)),S.create(S.Class.UNIVERSAL,S.Type.INTEGER,!1,Be(t.dP)),S.create(S.Class.UNIVERSAL,S.Type.INTEGER,!1,Be(t.dQ)),S.create(S.Class.UNIVERSAL,S.Type.INTEGER,!1,Be(t.qInv))])};$.publicKeyFromAsn1=function(t){var e={},r=[];if(S.validate(t,zm,e,r)){var n=S.derToOid(e.publicKeyOid);if(n!==$.oids.rsaEncryption){var i=new Error("Cannot read public key. Unknown OID.");throw i.oid=n,i}t=e.rsaPublicKey}if(r=[],!S.validate(t,Vm,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=V.util.createBuffer(e.publicKeyModulus).toHex(),s=V.util.createBuffer(e.publicKeyExponent).toHex();return $.setRsaPublicKey(new et(o,16),new et(s,16))};$.publicKeyToAsn1=$.publicKeyToSubjectPublicKeyInfo=function(t){return S.create(S.Class.UNIVERSAL,S.Type.SEQUENCE,!0,[S.create(S.Class.UNIVERSAL,S.Type.SEQUENCE,!0,[S.create(S.Class.UNIVERSAL,S.Type.OID,!1,S.oidToDer($.oids.rsaEncryption).getBytes()),S.create(S.Class.UNIVERSAL,S.Type.NULL,!1,"")]),S.create(S.Class.UNIVERSAL,S.Type.BITSTRING,!1,[$.publicKeyToRSAPublicKey(t)])])};$.publicKeyToRSAPublicKey=function(t){return S.create(S.Class.UNIVERSAL,S.Type.SEQUENCE,!0,[S.create(S.Class.UNIVERSAL,S.Type.INTEGER,!1,Be(t.n)),S.create(S.Class.UNIVERSAL,S.Type.INTEGER,!1,Be(t.e))])};function Su(t,e,r){var n=V.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 f=0;f<s;++f)n.putByte(a)}else for(;s>0;){for(var c=0,u=V.random.getBytes(s),f=0;f<s;++f)a=u.charCodeAt(f),a===0?++c:n.putByte(a);s=c}return n.putByte(0),n.putBytes(t),n}function Xi(t,e,r,n){var i=Math.ceil(e.n.bitLength()/8),o=V.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 f=0;if(a===0){f=i-3-n;for(var c=0;c<f;++c)if(o.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(a===1)for(f=0;o.length()>1;){if(o.getByte()!==255){--o.read;break}++f}else if(a===2)for(f=0;o.length()>1;){if(o.getByte()===0){--o.read;break}++f}var u=o.getByte();if(u!==0||f!==i-3-o.length())throw new Error("Encryption block is invalid.");return o.getBytes()}function $m(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,f){if(a)return r(a);if(t.p=f,t.q!==null)return s(a,t.q);o(t.qBits,s)})}function o(a,f){V.prime.generateProbablePrime(a,n,f)}function s(a,f){if(a)return r(a);if(t.q=f,t.p.compareTo(t.q)<0){var c=t.p;t.p=t.q,t.q=c}if(t.p.subtract(et.ONE).gcd(t.e).compareTo(et.ONE)!==0){t.p=null,i();return}if(t.q.subtract(et.ONE).gcd(t.e).compareTo(et.ONE)!==0){t.q=null,o(t.qBits,s);return}if(t.p1=t.p.subtract(et.ONE),t.q1=t.q.subtract(et.ONE),t.phi=t.p1.multiply(t.q1),t.phi.gcd(t.e).compareTo(et.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:$.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:$.rsa.setPublicKey(t.n,t.e)},r(null,t.keys)}}function Be(t){var e=t.toString(16);e[0]>="8"&&(e="00"+e);var r=V.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 Gm(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 gu(t){return V.util.isNodejs&&typeof Ks[t]=="function"}function bu(t){return typeof ne.globalScope<"u"&&typeof ne.globalScope.crypto=="object"&&typeof ne.globalScope.crypto.subtle=="object"&&typeof ne.globalScope.crypto.subtle[t]=="function"}function vu(t){return typeof ne.globalScope<"u"&&typeof ne.globalScope.msCrypto=="object"&&typeof ne.globalScope.msCrypto.subtle=="object"&&typeof ne.globalScope.msCrypto.subtle[t]=="function"}function wu(t){for(var e=V.util.hexToBytes(t.toString(16)),r=new Uint8Array(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}});var Lu=ft((k3,Ru)=>{var U=ut();Ds();Xn();Pf();Sr();Ui();Mf();zf();Jn();tu();Ji();It();typeof Bu>"u"&&(Bu=U.jsbn.BigInteger);var Bu,I=U.asn1,W=U.pki=U.pki||{};Ru.exports=W.pbe=U.pbe=U.pbe||{};var Ir=W.oids,Wm={name:"EncryptedPrivateKeyInfo",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},Ym={name:"PBES2Algorithms",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:I.Class.UNIVERSAL,type:I.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:I.Class.UNIVERSAL,type:I.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},Zm={name:"pkcs-12PbeParams",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:I.Class.UNIVERSAL,type:I.Type.INTEGER,constructed:!1,capture:"iterations"}]};W.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=I.integerToDer(i),s,a,f;if(r.algorithm.indexOf("aes")===0||r.algorithm==="des"){var c,u,h;switch(r.algorithm){case"aes128":s=16,c=16,u=Ir["aes128-CBC"],h=U.aes.createEncryptionCipher;break;case"aes192":s=24,c=16,u=Ir["aes192-CBC"],h=U.aes.createEncryptionCipher;break;case"aes256":s=32,c=16,u=Ir["aes256-CBC"],h=U.aes.createEncryptionCipher;break;case"des":s=8,c=8,u=Ir.desCBC,h=U.des.createEncryptionCipher;break;default:var y=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw y.algorithm=r.algorithm,y}var p="hmacWith"+r.prfAlgorithm.toUpperCase(),l=Tu(p),d=U.pkcs5.pbkdf2(e,n,i,s,l),m=U.random.getBytesSync(c),x=h(d);x.start(m),x.update(I.toDer(t)),x.finish(),f=x.output.getBytes();var g=Qm(n,o,s,p);a=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(Ir.pkcs5PBES2).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(Ir.pkcs5PBKDF2).getBytes()),g]),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(u).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,m)])])])}else if(r.algorithm==="3des"){s=24;var b=new U.util.ByteBuffer(n),d=W.pbe.generatePkcs12Key(e,b,1,i,s),m=W.pbe.generatePkcs12Key(e,b,2,i,s),x=U.des.createEncryptionCipher(d);x.start(m),x.update(I.toDer(t)),x.finish(),f=x.output.getBytes(),a=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(Ir["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,n),I.create(I.Class.UNIVERSAL,I.Type.INTEGER,!1,o.getBytes())])])}else{var y=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw y.algorithm=r.algorithm,y}var A=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[a,I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,f)]);return A};W.decryptPrivateKeyInfo=function(t,e){var r=null,n={},i=[];if(!I.validate(t,Wm,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=I.derToOid(n.encryptionOid),a=W.pbe.getCipher(s,n.encryptionParams,e),f=U.util.createBuffer(n.encryptedData);return a.update(f),a.finish()&&(r=I.fromDer(a.output)),r};W.encryptedPrivateKeyToPem=function(t,e){var r={type:"ENCRYPTED PRIVATE KEY",body:I.toDer(t).getBytes()};return U.pem.encode(r,{maxline:e})};W.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 I.fromDer(e.body)};W.encryptRsaPrivateKey=function(t,e,r){if(r=r||{},!r.legacy){var n=W.wrapRsaPrivateKey(W.privateKeyToAsn1(t));return n=W.encryptPrivateKeyInfo(n,e,r),W.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 f=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw f.algorithm=r.algorithm,f}var c=U.pbe.opensslDeriveBytes(e,o.substr(0,8),s),u=a(c);u.start(o),u.update(I.toDer(W.privateKeyToAsn1(t))),u.finish();var h={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(h)};W.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(h){return U.rc2.createDecryptionCipher(h,40)};break;case"RC2-64-CBC":o=8,s=function(h){return U.rc2.createDecryptionCipher(h,64)};break;case"RC2-128-CBC":o=16,s=function(h){return U.rc2.createDecryptionCipher(h,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),f=U.pbe.opensslDeriveBytes(e,a.substr(0,8),o),c=s(f);if(c.start(a),c.update(U.util.createBuffer(n.body)),c.finish())r=c.output.getBytes();else return r}else r=n.body;return n.type==="ENCRYPTED PRIVATE KEY"?r=W.decryptPrivateKeyInfo(I.fromDer(r),e):r=I.fromDer(r),r!==null&&(r=W.privateKeyFromAsn1(r)),r};W.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 f=o.digestLength,c=o.blockLength,u=new U.util.ByteBuffer,h=new U.util.ByteBuffer;if(t!=null){for(a=0;a<t.length;a++)h.putInt16(t.charCodeAt(a));h.putInt16(0)}var y=h.length(),p=e.length(),l=new U.util.ByteBuffer;l.fillWithByte(r,c);var d=c*Math.ceil(p/c),m=new U.util.ByteBuffer;for(a=0;a<d;a++)m.putByte(e.at(a%p));var x=c*Math.ceil(y/c),g=new U.util.ByteBuffer;for(a=0;a<x;a++)g.putByte(h.at(a%y));var b=m;b.putBuffer(g);for(var A=Math.ceil(i/f),w=1;w<=A;w++){var E=new U.util.ByteBuffer;E.putBytes(l.bytes()),E.putBytes(b.bytes());for(var B=0;B<n;B++)o.start(),o.update(E.getBytes()),E=o.digest();var C=new U.util.ByteBuffer;for(a=0;a<c;a++)C.putByte(E.at(a%f));var M=Math.ceil(p/c)+Math.ceil(y/c),H=new U.util.ByteBuffer;for(s=0;s<M;s++){var z=new U.util.ByteBuffer(b.getBytes(c)),J=511;for(a=C.length()-1;a>=0;a--)J=J>>8,J+=C.at(a)+z.at(a),z.setAt(a,J&255);H.putBuffer(z)}b=H,u.putBuffer(E)}return u.truncate(u.length()-i),u};W.pbe.getCipher=function(t,e,r){switch(t){case W.oids.pkcs5PBES2:return W.pbe.getCipherForPBES2(t,e,r);case W.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case W.oids["pbewithSHAAnd40BitRC2-CBC"]:return W.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}};W.pbe.getCipherForPBES2=function(t,e,r){var n={},i=[];if(!I.validate(e,Ym,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=I.derToOid(n.kdfOid),t!==W.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=I.derToOid(n.encOid),t!==W.oids["aes128-CBC"]&&t!==W.oids["aes192-CBC"]&&t!==W.oids["aes256-CBC"]&&t!==W.oids["des-EDE3-CBC"]&&t!==W.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 f,c;switch(W.oids[t]){case"aes128-CBC":f=16,c=U.aes.createDecryptionCipher;break;case"aes192-CBC":f=24,c=U.aes.createDecryptionCipher;break;case"aes256-CBC":f=32,c=U.aes.createDecryptionCipher;break;case"des-EDE3-CBC":f=24,c=U.des.createDecryptionCipher;break;case"desCBC":f=8,c=U.des.createDecryptionCipher;break}var u=Cu(n.prfOid),h=U.pkcs5.pbkdf2(r,s,a,f,u),y=n.encIv,p=c(h);return p.start(y),p};W.pbe.getCipherForPKCS12PBE=function(t,e,r){var n={},i=[];if(!I.validate(e,Zm,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 f,c,u;switch(t){case W.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:f=24,c=8,u=U.des.startDecrypting;break;case W.oids["pbewithSHAAnd40BitRC2-CBC"]:f=5,c=8,u=function(d,m){var x=U.rc2.createDecryptionCipher(d,40);return x.start(m,null),x};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=t,o}var h=Cu(n.prfOid),y=W.pbe.generatePkcs12Key(r,s,1,a,f,h);h.start();var p=W.pbe.generatePkcs12Key(r,s,2,a,c,h);return u(y,p)};W.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=[Iu(n,t+e)],o=16,s=1;o<r;++s,o+=16)i.push(Iu(n,i[s-1]+t+e));return i.join("").substr(0,r)};function Iu(t,e){return t.start().update(e).digest().getBytes()}function Cu(t){var e;if(!t)e="hmacWithSHA1";else if(e=W.oids[I.derToOid(t)],!e){var r=new Error("Unsupported PRF OID.");throw r.oid=t,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}return Tu(e)}function Tu(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 Qm(t,e,r,n){var i=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,t),I.create(I.Class.UNIVERSAL,I.Type.INTEGER,!1,e.getBytes())]);return n!=="hmacWithSHA1"&&i.value.push(I.create(I.Class.UNIVERSAL,I.Type.INTEGER,!1,U.util.hexToBytes(r.toString(16))),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(W.oids[n]).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.NULL,!1,"")])),i}});var ol=ft((BA,il)=>{var pt=ut();Sr();It();var mi=il.exports=pt.sha512=pt.sha512||{};pt.md.sha512=pt.md.algorithms.sha512=mi;var rl=pt.sha384=pt.sha512.sha384=pt.sha512.sha384||{};rl.create=function(){return mi.create("SHA-384")};pt.md.sha384=pt.md.algorithms.sha384=rl;pt.sha512.sha256=pt.sha512.sha256||{create:function(){return mi.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 mi.create("SHA-512/224")}};pt.md["sha512/224"]=pt.md.algorithms["sha512/224"]=pt.sha512.sha224;mi.create=function(t){if(nl||_b(),typeof t>"u"&&(t="SHA-512"),!(t in Fr))throw new Error("Invalid SHA-512 algorithm: "+t);for(var e=Fr[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 f=a.messageLengthSize/4,c=0;c<f;++c)a.fullMessageLength.push(0);n=pt.util.createBuffer(),r=new Array(e.length);for(var c=0;c<e.length;++c)r[c]=e[c].slice(0);return a},a.start(),a.update=function(f,c){c==="utf8"&&(f=pt.util.encodeUtf8(f));var u=f.length;a.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var h=a.fullMessageLength.length-1;h>=0;--h)a.fullMessageLength[h]+=u[1],u[1]=u[0]+(a.fullMessageLength[h]/4294967296>>>0),a.fullMessageLength[h]=a.fullMessageLength[h]>>>0,u[0]=u[1]/4294967296>>>0;return n.putBytes(f),el(r,i,n),(n.read>2048||n.length()===0)&&n.compact(),a},a.digest=function(){var f=pt.util.createBuffer();f.putBytes(n.bytes());var c=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,u=c&a.blockLength-1;f.putBytes(c0.substr(0,a.blockLength-u));for(var h,y,p=a.fullMessageLength[0]*8,l=0;l<a.fullMessageLength.length-1;++l)h=a.fullMessageLength[l+1]*8,y=h/4294967296>>>0,p+=y,f.putInt32(p>>>0),p=h>>>0;f.putInt32(p);for(var d=new Array(r.length),l=0;l<r.length;++l)d[l]=r[l].slice(0);el(d,i,f);var m=pt.util.createBuffer(),x;t==="SHA-512"?x=d.length:t==="SHA-384"?x=d.length-2:x=d.length-4;for(var l=0;l<x;++l)m.putInt32(d[l][0]),(l!==x-1||t!=="SHA-512/224")&&m.putInt32(d[l][1]);return m},a};var c0=null,nl=!1,f0=null,Fr=null;function _b(){c0="\x80",c0+=pt.util.fillString("\0",128),f0=[[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]],Fr={},Fr["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],Fr["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],Fr["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],Fr["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],nl=!0}function el(t,e,r){for(var n,i,o,s,a,f,c,u,h,y,p,l,d,m,x,g,b,A,w,E,B,C,M,H,z,J,ct,Pt,L,P,_,N,T,O,K,q=r.length();q>=128;){for(L=0;L<16;++L)e[L][0]=r.getInt32()>>>0,e[L][1]=r.getInt32()>>>0;for(;L<80;++L)N=e[L-2],P=N[0],_=N[1],n=((P>>>19|_<<13)^(_>>>29|P<<3)^P>>>6)>>>0,i=((P<<13|_>>>19)^(_<<3|P>>>29)^(P<<26|_>>>6))>>>0,O=e[L-15],P=O[0],_=O[1],o=((P>>>1|_<<31)^(P>>>8|_<<24)^P>>>7)>>>0,s=((P<<31|_>>>1)^(P<<24|_>>>8)^(P<<25|_>>>7))>>>0,T=e[L-7],K=e[L-16],_=i+T[1]+s+K[1],e[L][0]=n+T[0]+o+K[0]+(_/4294967296>>>0)>>>0,e[L][1]=_>>>0;for(d=t[0][0],m=t[0][1],x=t[1][0],g=t[1][1],b=t[2][0],A=t[2][1],w=t[3][0],E=t[3][1],B=t[4][0],C=t[4][1],M=t[5][0],H=t[5][1],z=t[6][0],J=t[6][1],ct=t[7][0],Pt=t[7][1],L=0;L<80;++L)c=((B>>>14|C<<18)^(B>>>18|C<<14)^(C>>>9|B<<23))>>>0,u=((B<<18|C>>>14)^(B<<14|C>>>18)^(C<<23|B>>>9))>>>0,h=(z^B&(M^z))>>>0,y=(J^C&(H^J))>>>0,a=((d>>>28|m<<4)^(m>>>2|d<<30)^(m>>>7|d<<25))>>>0,f=((d<<4|m>>>28)^(m<<30|d>>>2)^(m<<25|d>>>7))>>>0,p=(d&x|b&(d^x))>>>0,l=(m&g|A&(m^g))>>>0,_=Pt+u+y+f0[L][1]+e[L][1],n=ct+c+h+f0[L][0]+e[L][0]+(_/4294967296>>>0)>>>0,i=_>>>0,_=f+l,o=a+p+(_/4294967296>>>0)>>>0,s=_>>>0,ct=z,Pt=J,z=M,J=H,M=B,H=C,_=E+i,B=w+n+(_/4294967296>>>0)>>>0,C=_>>>0,w=b,E=A,b=x,A=g,x=d,g=m,_=i+s,d=n+o+(_/4294967296>>>0)>>>0,m=_>>>0;_=t[0][1]+m,t[0][0]=t[0][0]+d+(_/4294967296>>>0)>>>0,t[0][1]=_>>>0,_=t[1][1]+g,t[1][0]=t[1][0]+x+(_/4294967296>>>0)>>>0,t[1][1]=_>>>0,_=t[2][1]+A,t[2][0]=t[2][0]+b+(_/4294967296>>>0)>>>0,t[2][1]=_>>>0,_=t[3][1]+E,t[3][0]=t[3][0]+w+(_/4294967296>>>0)>>>0,t[3][1]=_>>>0,_=t[4][1]+C,t[4][0]=t[4][0]+B+(_/4294967296>>>0)>>>0,t[4][1]=_>>>0,_=t[5][1]+H,t[5][0]=t[5][0]+M+(_/4294967296>>>0)>>>0,t[5][1]=_>>>0,_=t[6][1]+J,t[6][0]=t[6][0]+z+(_/4294967296>>>0)>>>0,t[6][1]=_>>>0,_=t[7][1]+Pt,t[7][0]=t[7][0]+ct+(_/4294967296>>>0)>>>0,t[7][1]=_>>>0,q-=128}}});var zd=ft((sR,Vd)=>{"use strict";function Kd(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function Q4(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 Kd(t,r)}catch{r.message=t.message,r.stack=t.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(t)),Kd(new i,r)}}Vd.exports=Q4});var Yd=ft(Li=>{(function(){var t,e,r,n,i,o,s,a;a=function(f){var c,u,h,y;return c=(f&255<<24)>>>24,u=(f&255<<16)>>>16,h=(f&65280)>>>8,y=f&255,[c,u,h,y].join(".")},s=function(f){var c,u,h,y,p,l;for(c=[],h=y=0;y<=3&&f.length!==0;h=++y){if(h>0){if(f[0]!==".")throw new Error("Invalid IP");f=f.substring(1)}l=e(f),p=l[0],u=l[1],f=f.substring(u),c.push(p)}if(f.length!==0)throw new Error("Invalid IP");switch(c.length){case 1:if(c[0]>4294967295)throw new Error("Invalid IP");return c[0]>>>0;case 2:if(c[0]>255||c[1]>16777215)throw new Error("Invalid IP");return(c[0]<<24|c[1])>>>0;case 3:if(c[0]>255||c[1]>255||c[2]>65535)throw new Error("Invalid IP");return(c[0]<<24|c[1]<<16|c[2])>>>0;case 4:if(c[0]>255||c[1]>255||c[2]>255||c[3]>255)throw new Error("Invalid IP");return(c[0]<<24|c[1]<<16|c[2]<<8|c[3])>>>0;default:throw new Error("Invalid IP")}},r=function(f){return f.charCodeAt(0)},n=r("0"),o=r("a"),i=r("A"),e=function(f){var c,u,h,y,p;for(y=0,c=10,u="9",h=0,f.length>1&&f[h]==="0"&&(f[h+1]==="x"||f[h+1]==="X"?(h+=2,c=16):"0"<=f[h+1]&&f[h+1]<="9"&&(h++,c=8,u="7")),p=h;h<f.length;){if("0"<=f[h]&&f[h]<=u)y=y*c+(r(f[h])-n)>>>0;else if(c===16)if("a"<=f[h]&&f[h]<="f")y=y*c+(10+r(f[h])-o)>>>0;else if("A"<=f[h]&&f[h]<="F")y=y*c+(10+r(f[h])-i)>>>0;else break;else break;if(y>4294967295)throw new Error("too large");h++}if(h===p)throw new Error("empty octet");return[y,h]},t=function(){function f(c,u){var h,y,p,l;if(typeof c!="string")throw new Error("Missing `net' parameter");if(u||(l=c.split("/",2),c=l[0],u=l[1]),u||(u=32),typeof u=="string"&&u.indexOf(".")>-1){try{this.maskLong=s(u)}catch(d){throw h=d,new Error("Invalid mask: "+u)}for(y=p=32;p>=0;y=--p)if(this.maskLong===4294967295<<32-y>>>0){this.bitmask=y;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(c)&this.maskLong)>>>0}catch(d){throw h=d,new Error("Invalid net address: "+c)}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 f.prototype.contains=function(c){return typeof c=="string"&&(c.indexOf("/")>0||c.split(".").length!==4)&&(c=new f(c)),c instanceof f?this.contains(c.base)&&this.contains(c.broadcast||c.last):(s(c)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},f.prototype.next=function(c){return c==null&&(c=1),new f(a(this.netLong+this.size*c),this.mask)},f.prototype.forEach=function(c){var u,h,y;for(y=s(this.first),h=s(this.last),u=0;y<=h;)c(a(y),y,u),u++,y++},f.prototype.toString=function(){return this.base+"/"+this.bitmask},f}(),Li.ip2long=s,Li.long2ip=a,Li.Netmask=t}).call(Li)});var Jd=ft((Xd,qo)=>{(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 f(p,l){if(p.indexOf("::")!==p.lastIndexOf("::"))return null;let d=0,m=-1,x=(p.match(a.zoneIndex)||[])[0],g,b;for(x&&(x=x.substring(1),p=p.replace(/%.+$/,""));(m=p.indexOf(":",m+1))>=0;)d++;if(p.substr(0,2)==="::"&&d--,p.substr(-2,2)==="::"&&d--,d>l)return null;for(b=l-d,g=":";b--;)g+="0:";return p=p.replace("::",g),p[0]===":"&&(p=p.slice(1)),p[p.length-1]===":"&&(p=p.slice(0,-1)),l=function(){let A=p.split(":"),w=[];for(let E=0;E<A.length;E++)w.push(parseInt(A[E],16));return w}(),{parts:l,zoneId:x}}function c(p,l,d,m){if(p.length!==l.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let x=0,g;for(;m>0;){if(g=d-m,g<0&&(g=0),p[x]>>g!==l[x]>>g)return!1;m-=d,x+=1}return!0}function u(p){if(i.test(p))return parseInt(p,16);if(p[0]==="0"&&!isNaN(parseInt(p[1],10))){if(n.test(p))return parseInt(p,8);throw new Error(`ipaddr: cannot parse ${p} as octal`)}return parseInt(p,10)}function h(p,l){for(;p.length<l;)p=`0${p}`;return p}let y={};y.IPv4=function(){function p(l){if(l.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let d,m;for(d=0;d<l.length;d++)if(m=l[d],!(0<=m&&m<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=l}return p.prototype.SpecialRanges={unspecified:[[new p([0,0,0,0]),8]],broadcast:[[new p([255,255,255,255]),32]],multicast:[[new p([224,0,0,0]),4]],linkLocal:[[new p([169,254,0,0]),16]],loopback:[[new p([127,0,0,0]),8]],carrierGradeNat:[[new p([100,64,0,0]),10]],private:[[new p([10,0,0,0]),8],[new p([172,16,0,0]),12],[new p([192,168,0,0]),16]],reserved:[[new p([192,0,0,0]),24],[new p([192,0,2,0]),24],[new p([192,88,99,0]),24],[new p([198,18,0,0]),15],[new p([198,51,100,0]),24],[new p([203,0,113,0]),24],[new p([240,0,0,0]),4]]},p.prototype.kind=function(){return"ipv4"},p.prototype.match=function(l,d){let m;if(d===void 0&&(m=l,l=m[0],d=m[1]),l.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return c(this.octets,l.octets,8,d)},p.prototype.prefixLengthFromSubnetMask=function(){let l=0,d=!1,m={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},x,g,b;for(x=3;x>=0;x-=1)if(g=this.octets[x],g in m){if(b=m[g],d&&b!==0)return null;b!==8&&(d=!0),l+=b}else return null;return 32-l},p.prototype.range=function(){return y.subnetMatch(this,this.SpecialRanges)},p.prototype.toByteArray=function(){return this.octets.slice(0)},p.prototype.toIPv4MappedAddress=function(){return y.IPv6.parse(`::ffff:${this.toString()}`)},p.prototype.toNormalizedString=function(){return this.toString()},p.prototype.toString=function(){return this.octets.join(".")},p}(),y.IPv4.broadcastAddressFromCIDR=function(p){try{let l=this.parseCIDR(p),d=l[0].toByteArray(),m=this.subnetMaskFromPrefixLength(l[1]).toByteArray(),x=[],g=0;for(;g<4;)x.push(parseInt(d[g],10)|parseInt(m[g],10)^255),g++;return new this(x)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},y.IPv4.isIPv4=function(p){return this.parser(p)!==null},y.IPv4.isValid=function(p){try{return new this(this.parser(p)),!0}catch{return!1}},y.IPv4.isValidFourPartDecimal=function(p){return!!(y.IPv4.isValid(p)&&p.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},y.IPv4.networkAddressFromCIDR=function(p){let l,d,m,x,g;try{for(l=this.parseCIDR(p),m=l[0].toByteArray(),g=this.subnetMaskFromPrefixLength(l[1]).toByteArray(),x=[],d=0;d<4;)x.push(parseInt(m[d],10)&parseInt(g[d],10)),d++;return new this(x)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},y.IPv4.parse=function(p){let l=this.parser(p);if(l===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(l)},y.IPv4.parseCIDR=function(p){let l;if(l=p.match(/^(.+)\/(\d+)$/)){let d=parseInt(l[2]);if(d>=0&&d<=32){let m=[this.parse(l[1]),d];return Object.defineProperty(m,"toString",{value:function(){return this.join("/")}}),m}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},y.IPv4.parser=function(p){let l,d,m;if(l=p.match(r.fourOctet))return function(){let x=l.slice(1,6),g=[];for(let b=0;b<x.length;b++)d=x[b],g.push(u(d));return g}();if(l=p.match(r.longValue)){if(m=u(l[1]),m>4294967295||m<0)throw new Error("ipaddr: address outside defined range");return function(){let x=[],g;for(g=0;g<=24;g+=8)x.push(m>>g&255);return x}().reverse()}else return(l=p.match(r.twoOctet))?function(){let x=l.slice(1,4),g=[];if(m=u(x[1]),m>16777215||m<0)throw new Error("ipaddr: address outside defined range");return g.push(u(x[0])),g.push(m>>16&255),g.push(m>>8&255),g.push(m&255),g}():(l=p.match(r.threeOctet))?function(){let x=l.slice(1,5),g=[];if(m=u(x[2]),m>65535||m<0)throw new Error("ipaddr: address outside defined range");return g.push(u(x[0])),g.push(u(x[1])),g.push(m>>8&255),g.push(m&255),g}():null},y.IPv4.subnetMaskFromPrefixLength=function(p){if(p=parseInt(p),p<0||p>32)throw new Error("ipaddr: invalid IPv4 prefix length");let l=[0,0,0,0],d=0,m=Math.floor(p/8);for(;d<m;)l[d]=255,d++;return m<4&&(l[m]=Math.pow(2,p%8)-1<<8-p%8),new this(l)},y.IPv6=function(){function p(l,d){let m,x;if(l.length===16)for(this.parts=[],m=0;m<=14;m+=2)this.parts.push(l[m]<<8|l[m+1]);else if(l.length===8)this.parts=l;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(m=0;m<this.parts.length;m++)if(x=this.parts[m],!(0<=x&&x<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");d&&(this.zoneId=d)}return p.prototype.SpecialRanges={unspecified:[new p([0,0,0,0,0,0,0,0]),128],linkLocal:[new p([65152,0,0,0,0,0,0,0]),10],multicast:[new p([65280,0,0,0,0,0,0,0]),8],loopback:[new p([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new p([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new p([0,0,0,0,0,65535,0,0]),96],rfc6145:[new p([0,0,0,0,65535,0,0,0]),96],rfc6052:[new p([100,65435,0,0,0,0,0,0]),96],"6to4":[new p([8194,0,0,0,0,0,0,0]),16],teredo:[new p([8193,0,0,0,0,0,0,0]),32],reserved:[[new p([8193,3512,0,0,0,0,0,0]),32]],benchmarking:[new p([8193,2,0,0,0,0,0,0]),48],amt:[new p([8193,3,0,0,0,0,0,0]),32],as112v6:[new p([8193,4,274,0,0,0,0,0]),48],deprecated:[new p([8193,16,0,0,0,0,0,0]),28],orchid2:[new p([8193,32,0,0,0,0,0,0]),28]},p.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},p.prototype.kind=function(){return"ipv6"},p.prototype.match=function(l,d){let m;if(d===void 0&&(m=l,l=m[0],d=m[1]),l.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return c(this.parts,l.parts,16,d)},p.prototype.prefixLengthFromSubnetMask=function(){let l=0,d=!1,m={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,g;for(let b=7;b>=0;b-=1)if(x=this.parts[b],x in m){if(g=m[x],d&&g!==0)return null;g!==16&&(d=!0),l+=g}else return null;return 128-l},p.prototype.range=function(){return y.subnetMatch(this,this.SpecialRanges)},p.prototype.toByteArray=function(){let l,d=[],m=this.parts;for(let x=0;x<m.length;x++)l=m[x],d.push(l>>8),d.push(l&255);return d},p.prototype.toFixedLengthString=function(){let l=function(){let m=[];for(let x=0;x<this.parts.length;x++)m.push(h(this.parts[x].toString(16),4));return m}.call(this).join(":"),d="";return this.zoneId&&(d=`%${this.zoneId}`),l+d},p.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let l=this.parts.slice(-2),d=l[0],m=l[1];return new y.IPv4([d>>8,d&255,m>>8,m&255])},p.prototype.toNormalizedString=function(){let l=function(){let m=[];for(let x=0;x<this.parts.length;x++)m.push(this.parts[x].toString(16));return m}.call(this).join(":"),d="";return this.zoneId&&(d=`%${this.zoneId}`),l+d},p.prototype.toRFC5952String=function(){let l=/((^|:)(0(:|$)){2,})/g,d=this.toNormalizedString(),m=0,x=-1,g;for(;g=l.exec(d);)g[0].length>x&&(m=g.index,x=g[0].length);return x<0?d:`${d.substring(0,m)}::${d.substring(m+x)}`},p.prototype.toString=function(){return this.toRFC5952String()},p}(),y.IPv6.broadcastAddressFromCIDR=function(p){try{let l=this.parseCIDR(p),d=l[0].toByteArray(),m=this.subnetMaskFromPrefixLength(l[1]).toByteArray(),x=[],g=0;for(;g<16;)x.push(parseInt(d[g],10)|parseInt(m[g],10)^255),g++;return new this(x)}catch(l){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${l})`)}},y.IPv6.isIPv6=function(p){return this.parser(p)!==null},y.IPv6.isValid=function(p){if(typeof p=="string"&&p.indexOf(":")===-1)return!1;try{let l=this.parser(p);return new this(l.parts,l.zoneId),!0}catch{return!1}},y.IPv6.networkAddressFromCIDR=function(p){let l,d,m,x,g;try{for(l=this.parseCIDR(p),m=l[0].toByteArray(),g=this.subnetMaskFromPrefixLength(l[1]).toByteArray(),x=[],d=0;d<16;)x.push(parseInt(m[d],10)&parseInt(g[d],10)),d++;return new this(x)}catch(b){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${b})`)}},y.IPv6.parse=function(p){let l=this.parser(p);if(l.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(l.parts,l.zoneId)},y.IPv6.parseCIDR=function(p){let l,d,m;if((d=p.match(/^(.+)\/(\d+)$/))&&(l=parseInt(d[2]),l>=0&&l<=128))return m=[this.parse(d[1]),l],Object.defineProperty(m,"toString",{value:function(){return this.join("/")}}),m;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},y.IPv6.parser=function(p){let l,d,m,x,g,b;if(m=p.match(a.deprecatedTransitional))return this.parser(`::ffff:${m[1]}`);if(a.native.test(p))return f(p,8);if((m=p.match(a.transitional))&&(b=m[6]||"",l=f(m[1].slice(0,-1)+b,6),l.parts)){for(g=[parseInt(m[2]),parseInt(m[3]),parseInt(m[4]),parseInt(m[5])],d=0;d<g.length;d++)if(x=g[d],!(0<=x&&x<=255))return null;return l.parts.push(g[0]<<8|g[1]),l.parts.push(g[2]<<8|g[3]),{parts:l.parts,zoneId:l.zoneId}}return null},y.IPv6.subnetMaskFromPrefixLength=function(p){if(p=parseInt(p),p<0||p>128)throw new Error("ipaddr: invalid IPv6 prefix length");let l=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],d=0,m=Math.floor(p/8);for(;d<m;)l[d]=255,d++;return m<16&&(l[m]=Math.pow(2,p%8)-1<<8-p%8),new this(l)},y.fromByteArray=function(p){let l=p.length;if(l===4)return new y.IPv4(p);if(l===16)return new y.IPv6(p);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},y.isValid=function(p){return y.IPv6.isValid(p)||y.IPv4.isValid(p)},y.parse=function(p){if(y.IPv6.isValid(p))return y.IPv6.parse(p);if(y.IPv4.isValid(p))return y.IPv4.parse(p);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},y.parseCIDR=function(p){try{return y.IPv6.parseCIDR(p)}catch{try{return y.IPv4.parseCIDR(p)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},y.process=function(p){let l=this.parse(p);return l.kind()==="ipv6"&&l.isIPv4MappedAddress()?l.toIPv4Address():l},y.subnetMatch=function(p,l,d){let m,x,g,b;d==null&&(d="unicast");for(x in l)if(Object.prototype.hasOwnProperty.call(l,x)){for(g=l[x],g[0]&&!(g[0]instanceof Array)&&(g=[g]),m=0;m<g.length;m++)if(b=g[m],p.kind()===b[0].kind()&&p.match.apply(p,b))return x}return d},typeof qo<"u"&&qo.exports?qo.exports=y:t.ipaddr=y})(Xd)});var E8={};F(E8,{autoNAT:()=>w8});var A8=Symbol.for("@libp2p/connection");var I8=Symbol.for("@libp2p/content-routing");var R8=Symbol.for("@libp2p/peer-discovery");var Hc=Symbol.for("@libp2p/peer-id");var _8=Symbol.for("@libp2p/peer-routing");var $c;(function(t){t.Accept="accept",t.Ignore="ignore",t.Reject="reject"})($c||($c={}));var U8=Symbol.for("@libp2p/transport");var Gc;(function(t){t[t.FATAL_ALL=0]="FATAL_ALL",t[t.NO_FATAL=1]="NO_FATAL"})(Gc||(Gc={}));var G=class extends Error{code;props;constructor(e,r,n){super(e),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var Go="ERR_TIMEOUT";var Wo=class extends Event{detail;constructor(e,r){super(e,r),this.detail=r?.detail}},M8=globalThis.CustomEvent??Wo;var Yo=(t,...e)=>{try{[...e]}catch{}};var jo={};F(jo,{base58btc:()=>qt,base58flickr:()=>Bp});var yE=new Uint8Array(0);function Wc(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 _e(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 Yc(t){return new TextEncoder().encode(t)}function Zc(t){return new TextDecoder().decode(t)}function vp(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,f=t.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";for(var d=0,m=0,x=0,g=l.length;x!==g&&l[x]===0;)x++,d++;for(var b=(g-x)*u+1>>>0,A=new Uint8Array(b);x!==g;){for(var w=l[x],E=0,B=b-1;(w!==0||E<m)&&B!==-1;B--,E++)w+=256*A[B]>>>0,A[B]=w%a>>>0,w=w/a>>>0;if(w!==0)throw new Error("Non-zero carry");m=E,x++}for(var C=b-m;C!==b&&A[C]===0;)C++;for(var M=f.repeat(d);C<b;++C)M+=t.charAt(A[C]);return M}function y(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;var d=0;if(l[d]!==" "){for(var m=0,x=0;l[d]===f;)m++,d++;for(var g=(l.length-d)*c+1>>>0,b=new Uint8Array(g);l[d];){var A=r[l.charCodeAt(d)];if(A===255)return;for(var w=0,E=g-1;(A!==0||w<x)&&E!==-1;E--,w++)A+=a*b[E]>>>0,b[E]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");x=w,d++}if(l[d]!==" "){for(var B=g-x;B!==g&&b[B]===0;)B++;for(var C=new Uint8Array(m+(g-B)),M=m;B!==g;)C[M++]=b[B++];return C}}}function p(l){var d=y(l);if(d)return d;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:y,decode:p}}var wp=vp,Ep=wp,Xc=Ep;var Zo=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")}},Qo=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 Jc(this,e)}},Xo=class{decoders;constructor(e){this.decoders=e}or(e){return Jc(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 Jc(t,e){return new Xo({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var Jo=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 Zo(e,r,n),this.decoder=new Qo(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Hr({name:t,prefix:e,encode:r,decode:n}){return new Jo(t,e,r,n)}function tr({name:t,prefix:e,alphabet:r}){let{encode:n,decode:i}=Xc(r,t);return Hr({prefix:e,name:t,encode:n,decode:o=>_e(i(o))})}function Sp(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,f=0,c=0;for(let u=0;u<o;++u){let h=i[t[u]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<r|h,a+=r,a>=8&&(a-=8,s[c++]=255&f>>a)}if(a>=r||255&f<<8-a)throw new SyntaxError("Unexpected end of data");return s}function Ap(t,e,r){let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let f=0;f<t.length;++f)for(a=a<<8|t[f],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 bt({name:t,prefix:e,bitsPerChar:r,alphabet:n}){return Hr({prefix:e,name:t,encode(i){return Ap(i,n,r)},decode(i){return Sp(i,n,r,t)}})}var qt=tr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Bp=tr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ts={};F(ts,{base10:()=>Ip});var Ip=tr({prefix:"9",name:"base10",alphabet:"0123456789"});var es={};F(es,{base16:()=>Cp,base16upper:()=>Tp});var Cp=bt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Tp=bt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var rs={};F(rs,{base2:()=>Rp});var Rp=bt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ns={};F(ns,{base256emoji:()=>Pp});var jc=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}"),Lp=jc.reduce((t,e,r)=>(t[r]=e,t),[]),Dp=jc.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function _p(t){return t.reduce((e,r)=>(e+=Lp[r],e),"")}function Np(t){let e=[];for(let r of t){let n=Dp[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Pp=Hr({prefix:"\u{1F680}",name:"base256emoji",encode:_p,decode:Np});var is={};F(is,{base32:()=>$r,base32hex:()=>Fp,base32hexpad:()=>Kp,base32hexpadupper:()=>Vp,base32hexupper:()=>Mp,base32pad:()=>Up,base32padupper:()=>Op,base32upper:()=>kp,base32z:()=>zp});var $r=bt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),kp=bt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Up=bt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Op=bt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Fp=bt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Mp=bt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Kp=bt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Vp=bt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),zp=bt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var os={};F(os,{base36:()=>qp,base36upper:()=>Hp});var qp=tr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Hp=tr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var ss={};F(ss,{base64:()=>_i,base64pad:()=>$p,base64url:()=>Gp,base64urlpad:()=>Wp});var _i=bt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),$p=bt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Gp=bt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Wp=bt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var as={};F(as,{base8:()=>Yp});var Yp=bt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var cs={};F(cs,{identity:()=>Zp});var Zp=Hr({prefix:"\0",name:"identity",encode:t=>Zc(t),decode:t=>Yc(t)});var DE=new TextEncoder,_E=new TextDecoder;var us={};F(us,{identity:()=>er});var Jp=rf,tf=128,jp=127,ty=~jp,ey=Math.pow(2,31);function rf(t,e,r){e=e||[],r=r||0;for(var n=r;t>=ey;)e[r++]=t&255|tf,t/=128;for(;t&ty;)e[r++]=t&255|tf,t>>>=7;return e[r]=t|0,rf.bytes=r-n+1,e}var ry=fs,ny=128,ef=127;function fs(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw fs.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&ef)<<i:(s&ef)*Math.pow(2,i),i+=7}while(s>=ny);return fs.bytes=o-n,r}var iy=Math.pow(2,7),oy=Math.pow(2,14),sy=Math.pow(2,21),ay=Math.pow(2,28),cy=Math.pow(2,35),fy=Math.pow(2,42),uy=Math.pow(2,49),hy=Math.pow(2,56),ly=Math.pow(2,63),dy=function(t){return t<iy?1:t<oy?2:t<sy?3:t<ay?4:t<cy?5:t<fy?6:t<uy?7:t<hy?8:t<ly?9:10},py={encode:Jp,decode:ry,encodingLength:dy},yy=py,qn=yy;function Hn(t,e=0){return[qn.decode(t,e),qn.decode.bytes]}function Gr(t,e,r=0){return qn.encode(t,e,r),e}function Wr(t){return qn.encodingLength(t)}function be(t,e){let r=e.byteLength,n=Wr(t),i=n+Wr(r),o=new Uint8Array(i+r);return Gr(t,o,0),Gr(r,o,n),o.set(e,i),new Yr(t,r,e,o)}function $n(t){let e=_e(t),[r,n]=Hn(e),[i,o]=Hn(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Yr(r,i,s,e)}function nf(t,e){if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Wc(t.bytes,r.bytes)}}var Yr=class{code;size;digest;bytes;constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var of=0,my="identity",sf=_e;function xy(t){return be(of,sf(t))}var er={code:of,name:my,encode:sf,digest:xy};var ds={};F(ds,{sha256:()=>Ot,sha512:()=>gy});function ls({name:t,code:e,encode:r}){return new hs(t,e,r)}var hs=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?be(this.code,r):r.then(n=>be(this.code,n))}else throw Error("Unknown type, must be binary type")}};function cf(t){return async e=>new Uint8Array(await crypto.subtle.digest(t,e))}var Ot=ls({name:"sha2-256",code:18,encode:cf("SHA-256")}),gy=ls({name:"sha2-512",code:19,encode:cf("SHA-512")});function ff(t,e){let{bytes:r,version:n}=t;switch(n){case 0:return vy(r,ps(t),e??qt.encoder);default:return wy(r,ps(t),e??$r.encoder)}}var uf=new WeakMap;function ps(t){let e=uf.get(t);if(e==null){let r=new Map;return uf.set(t,r),r}return e}var wr=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!==Gn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Ey)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=be(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&&nf(e.multihash,n.multihash)}toString(e){return ff(this,e)}toJSON(){return{"/":ff(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??hf(n,i,o.bytes))}else if(r[Sy]===!0){let{version:n,multihash:i,code:o}=r,s=$n(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!==Gn)throw new Error(`Version 0 CID must use dag-pb (code: ${Gn}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=hf(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,Gn,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=_e(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 Yr(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[h,y]=Hn(e.subarray(r));return r+=y,h},i=n(),o=Gn;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(),f=n(),c=r+f,u=c-s;return{version:i,codec:o,multihashCode:a,digestSize:f,multihashSize:u,size:c}}static parse(e,r){let[n,i]=by(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 ps(o).set(n,e),o}};function by(t,e){switch(t[0]){case"Q":{let r=e??qt;return[qt.prefix,r.decode(`${qt.prefix}${t}`)]}case qt.prefix:{let r=e??qt;return[qt.prefix,r.decode(t)]}case $r.prefix:{let r=e??$r;return[$r.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 vy(t,e,r){let{prefix:n}=r;if(n!==qt.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 wy(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 Gn=112,Ey=18;function hf(t,e,r){let n=Wr(t),i=n+Wr(e),o=new Uint8Array(i+r.byteLength);return Gr(t,o,0),Gr(e,o,n),o.set(r,i),o}var Sy=Symbol.for("@ipld/js-cid/CID");var ys={...cs,...rs,...as,...ts,...es,...is,...os,...jo,...ss,...ns},jE={...ds,...us};function ms(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 Ay=Symbol.for("nodejs.util.inspect.custom"),lf=Object.values(ys).map(t=>t.decoder).reduce((t,e)=>t.or(e),ys.identity.decoder),df=114,xs=36,gs=37,Wn=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()})`}[Hc]=!0;toString(){return this.string==null&&(this.string=qt.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return wr.createV1(df,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return ms(this.multihash.bytes,e);if(typeof e=="string")return By(e).equals(this);if(e?.multihash?.bytes!=null)return ms(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[Ay](){return`PeerId(${this.toString()})`}},Qr=class extends Wn{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},Xr=class extends Wn{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},Jr=class extends Wn{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}};function By(t,e){if(e=e??lf,t.charAt(0)==="1"||t.charAt(0)==="Q"){let r=$n(qt.decode(`z${t}`));return t.startsWith("12D")?new Xr({multihash:r}):t.startsWith("16U")?new Jr({multihash:r}):new Qr({multihash:r})}return Pi(lf.decode(t))}function Pi(t){try{let e=$n(t);if(e.code===er.code){if(e.digest.length===xs)return new Xr({multihash:e});if(e.digest.length===gs)return new Jr({multihash:e})}if(e.code===Ot.code)return new Qr({multihash:e})}catch{return Iy(wr.decode(t))}throw new Error("Supplied PeerID CID is invalid")}function Iy(t){if(t==null||t.multihash==null||t.version==null||t.version===1&&t.code!==df)throw new Error("Supplied PeerID CID is invalid");let e=t.multihash;if(e.code===Ot.code)return new Qr({multihash:t.multihash});if(e.code===er.code){if(e.digest.length===xs)return new Xr({multihash:t.multihash});if(e.digest.length===gs)return new Jr({multihash:t.multihash})}throw new Error("Supplied PeerID CID is invalid")}async function pf(t,e){return t.length===xs?new Xr({multihash:be(er.code,t),privateKey:e}):t.length===gs?new Jr({multihash:be(er.code,t),privateKey:e}):new Qr({multihash:await Ot.digest(t),publicKey:t,privateKey:e})}var _B=Mt(Xn(),1),NB=Mt(Lu(),1);var iv=Mt(ut(),1);function Cr(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var $s={};F($s,{base10:()=>rx});function Xm(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,f=t.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";for(var d=0,m=0,x=0,g=l.length;x!==g&&l[x]===0;)x++,d++;for(var b=(g-x)*u+1>>>0,A=new Uint8Array(b);x!==g;){for(var w=l[x],E=0,B=b-1;(w!==0||E<m)&&B!==-1;B--,E++)w+=256*A[B]>>>0,A[B]=w%a>>>0,w=w/a>>>0;if(w!==0)throw new Error("Non-zero carry");m=E,x++}for(var C=b-m;C!==b&&A[C]===0;)C++;for(var M=f.repeat(d);C<b;++C)M+=t.charAt(A[C]);return M}function y(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;var d=0;if(l[d]!==" "){for(var m=0,x=0;l[d]===f;)m++,d++;for(var g=(l.length-d)*c+1>>>0,b=new Uint8Array(g);l[d];){var A=r[l.charCodeAt(d)];if(A===255)return;for(var w=0,E=g-1;(A!==0||w<x)&&E!==-1;E--,w++)A+=a*b[E]>>>0,b[E]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");x=w,d++}if(l[d]!==" "){for(var B=g-x;B!==g&&b[B]===0;)B++;for(var C=new Uint8Array(m+(g-B)),M=m;B!==g;)C[M++]=b[B++];return C}}}function p(l){var d=y(l);if(d)return d;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:y,decode:p}}var Jm=Xm,jm=Jm,Du=jm;var F3=new Uint8Array(0);var _u=(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},Ue=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")};var Nu=t=>new TextEncoder().encode(t),Pu=t=>new TextDecoder().decode(t);var Vs=class{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")}},zs=class{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 Uu(this,e)}},qs=class{constructor(e){this.decoders=e}or(e){return Uu(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Uu=(t,e)=>new qs({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),Hs=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Vs(e,r,n),this.decoder=new zs(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},nn=({name:t,prefix:e,encode:r,decode:n})=>new Hs(t,e,r,n),sr=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=Du(r,e);return nn({prefix:t,name:e,encode:n,decode:o=>Ue(i(o))})},tx=(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,f=0,c=0;for(let u=0;u<o;++u){let h=i[t[u]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<r|h,a+=r,a>=8&&(a-=8,s[c++]=255&f>>a)}if(a>=r||255&f<<8-a)throw new SyntaxError("Unexpected end of data");return s},ex=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let f=0;f<t.length;++f)for(a=a<<8|t[f],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o},vt=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>nn({prefix:e,name:t,encode(i){return ex(i,n,r)},decode(i){return tx(i,n,r,t)}});var rx=sr({prefix:"9",name:"base10",alphabet:"0123456789"});var Gs={};F(Gs,{base16:()=>nx,base16upper:()=>ix});var nx=vt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ix=vt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ws={};F(Ws,{base2:()=>ox});var ox=vt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ys={};F(Ys,{base256emoji:()=>ux});var Ou=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}"),sx=Ou.reduce((t,e,r)=>(t[r]=e,t),[]),ax=Ou.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function cx(t){return t.reduce((e,r)=>(e+=sx[r],e),"")}function fx(t){let e=[];for(let r of t){let n=ax[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var ux=nn({prefix:"\u{1F680}",name:"base256emoji",encode:cx,decode:fx});var Zs={};F(Zs,{base32:()=>on,base32hex:()=>px,base32hexpad:()=>mx,base32hexpadupper:()=>xx,base32hexupper:()=>yx,base32pad:()=>lx,base32padupper:()=>dx,base32upper:()=>hx,base32z:()=>gx});var on=vt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),hx=vt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),lx=vt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),dx=vt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),px=vt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),yx=vt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),mx=vt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),xx=vt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),gx=vt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Qs={};F(Qs,{base36:()=>bx,base36upper:()=>vx});var bx=sr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),vx=sr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Xs={};F(Xs,{base58btc:()=>Ie,base58flickr:()=>wx});var Ie=sr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),wx=sr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Js={};F(Js,{base64:()=>Ex,base64pad:()=>Sx,base64url:()=>Ax,base64urlpad:()=>Bx});var Ex=vt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Sx=vt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Ax=vt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Bx=vt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var js={};F(js,{base8:()=>Ix});var Ix=vt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ta={};F(ta,{identity:()=>Cx});var Cx=nn({prefix:"\0",name:"identity",encode:t=>Pu(t),decode:t=>Nu(t)});var j3=new TextEncoder,tS=new TextDecoder;var ra={};F(ra,{identity:()=>Qx});var Lx=Ku,Fu=128,Dx=127,_x=~Dx,Nx=Math.pow(2,31);function Ku(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Nx;)e[r++]=t&255|Fu,t/=128;for(;t&_x;)e[r++]=t&255|Fu,t>>>=7;return e[r]=t|0,Ku.bytes=r-n+1,e}var Px=ea,kx=128,Mu=127;function ea(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw ea.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&Mu)<<i:(s&Mu)*Math.pow(2,i),i+=7}while(s>=kx);return ea.bytes=o-n,r}var Ux=Math.pow(2,7),Ox=Math.pow(2,14),Fx=Math.pow(2,21),Mx=Math.pow(2,28),Kx=Math.pow(2,35),Vx=Math.pow(2,42),zx=Math.pow(2,49),qx=Math.pow(2,56),Hx=Math.pow(2,63),$x=function(t){return t<Ux?1:t<Ox?2:t<Fx?3:t<Mx?4:t<Kx?5:t<Vx?6:t<zx?7:t<qx?8:t<Hx?9:10},Gx={encode:Lx,decode:Px,encodingLength:$x},Wx=Gx,ti=Wx;var ei=(t,e=0)=>[ti.decode(t,e),ti.decode.bytes],sn=(t,e,r=0)=>(ti.encode(t,e,r),e),an=t=>ti.encodingLength(t);var Tr=(t,e)=>{let r=e.byteLength,n=an(t),i=n+an(r),o=new Uint8Array(i+r);return sn(t,o,0),sn(r,o,n),o.set(e,i),new cn(t,r,e,o)},Vu=t=>{let e=Ue(t),[r,n]=ei(e),[i,o]=ei(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new cn(r,i,s,e)},zu=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&_u(t.bytes,r.bytes)}},cn=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var qu=0,Yx="identity",Hu=Ue,Zx=t=>Tr(qu,Hu(t)),Qx={code:qu,name:Yx,encode:Hu,digest:Zx};var oa={};F(oa,{sha256:()=>Xx,sha512:()=>Jx});var ia=({name:t,code:e,encode:r})=>new na(t,e,r),na=class{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?Tr(this.code,r):r.then(n=>Tr(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Gu=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Xx=ia({name:"sha2-256",code:18,encode:Gu("SHA-256")}),Jx=ia({name:"sha2-512",code:19,encode:Gu("SHA-512")});var Wu=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return tg(r,sa(t),e||Ie.encoder);default:return eg(r,sa(t),e||on.encoder)}};var Yu=new WeakMap,sa=t=>{let e=Yu.get(t);if(e==null){let r=new Map;return Yu.set(t,r),r}return e},to=class t{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!==ni)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==rg)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=Tr(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&&e.code===n.code&&e.version===n.version&&zu(e.multihash,n.multihash)}toString(e){return Wu(this,e)}toJSON(){return{"/":Wu(this)}}link(){return this}get[Symbol.toStringTag](){return"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||Zu(n,i,o.bytes))}else if(r[ng]===!0){let{version:n,multihash:i,code:o}=r,s=Vu(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!==ni)throw new Error(`Version 0 CID must use dag-pb (code: ${ni}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=Zu(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,ni,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=Ue(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 cn(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[h,y]=ei(e.subarray(r));return r+=y,h},i=n(),o=ni;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(),f=n(),c=r+f,u=c-s;return{version:i,codec:o,multihashCode:a,digestSize:f,multihashSize:u,size:c}}static parse(e,r){let[n,i]=jx(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 sa(o).set(n,e),o}},jx=(t,e)=>{switch(t[0]){case"Q":{let r=e||Ie;return[Ie.prefix,r.decode(`${Ie.prefix}${t}`)]}case Ie.prefix:{let r=e||Ie;return[Ie.prefix,r.decode(t)]}case on.prefix:{let r=e||on;return[on.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)]}}},tg=(t,e,r)=>{let{prefix:n}=r;if(n!==Ie.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},eg=(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},ni=112,rg=18,Zu=(t,e,r)=>{let n=an(t),i=n+an(e),o=new Uint8Array(i+r.byteLength);return sn(t,o,0),sn(e,o,n),o.set(r,i),o},ng=Symbol.for("@ipld/js-cid/CID");var aa={...ta,...Ws,...js,...$s,...Gs,...Zs,...Qs,...Xs,...Js,...Ys},mS={...oa,...ra};function eo(t=0){return globalThis.Buffer?.allocUnsafe!=null?Cr(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Xu(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var Qu=Xu("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),ca=Xu("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=eo(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),ig={utf8:Qu,"utf-8":Qu,hex:aa.base16,latin1:ca,ascii:ca,binary:ca,...aa},ro=ig;function Jt(t,e="utf8"){let r=ro[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Cr(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var a0={};F(a0,{Ed25519PrivateKey:()=>Or,Ed25519PublicKey:()=>yi,generateKeyPair:()=>Tb,generateKeyPairFromSeed:()=>tl,unmarshalEd25519PrivateKey:()=>Ib,unmarshalEd25519PublicKey:()=>Cb});function Ce(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 _S=Mt(It(),1),NS=Mt(Zi(),1),Ju=Mt(ut(),1);function Rr(t,e){if(globalThis.Buffer!=null)return Cr(globalThis.Buffer.concat(t,e));e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=eo(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Cr(r)}function jt(t,e="utf8"){let r=ro[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 fe(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=Rr([new Uint8Array(e-r.length),r])}return jt(r,"base64url")}function te(t){let e=ju(t);return new Ju.default.jsbn.BigInteger(jt(e,"base16"),16)}function ju(t,e){let r=Jt(t,"base64urlpad");if(e!=null){if(r.length>e)throw new Error("byte array longer than desired length");r=Rr([new Uint8Array(e-r.length),r])}return r}function ie(t){return t==null?!1:typeof t.then=="function"&&typeof t.catch=="function"&&typeof t.finally=="function"}function th(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function og(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function fa(t,...e){if(!og(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 eh(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");th(t.outputLen),th(t.blockLen)}function fn(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 rh(t,e){fa(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var no=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function nh(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var io=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),ue=(t,e)=>t<<32-e|t>>>e,sg=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!sg)throw new Error("Non little-endian hardware is not supported");function ua(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function ii(t){if(typeof t=="string"&&(t=ua(t)),!nh(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function oo(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];if(!nh(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 un=class{clone(){return this._cloneInto()}},VS={}.toString;function so(t){let e=n=>t().update(ii(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function hn(t=32){if(no&&typeof no.getRandomValues=="function")return no.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}function ag(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),f=n?4:0,c=n?0:4;t.setUint32(e+f,s,n),t.setUint32(e+c,a,n)}var ln=class extends un{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=io(this.buffer)}update(e){fn(this);let{view:r,buffer:n,blockLen:i}=this;e=ii(e);let o=e.length;for(let s=0;s<o;){let a=Math.min(i-this.pos,o-s);if(a===i){let f=io(e);for(;i<=o-s;s+=i)this.process(f,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){fn(this),rh(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 h=s;h<i;h++)r[h]=0;ag(n,i-8,BigInt(this.length*8),o),this.process(n,0);let a=io(e),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let c=f/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<c;h++)a.setUint32(4*h,u[h],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 ao=BigInt(4294967295),ha=BigInt(32);function ih(t,e=!1){return e?{h:Number(t&ao),l:Number(t>>ha&ao)}:{h:Number(t>>ha&ao)|0,l:Number(t&ao)|0}}function cg(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}=ih(t[i],e);[r[i],n[i]]=[o,s]}return[r,n]}var fg=(t,e)=>BigInt(t>>>0)<<ha|BigInt(e>>>0),ug=(t,e,r)=>t>>>r,hg=(t,e,r)=>t<<32-r|e>>>r,lg=(t,e,r)=>t>>>r|e<<32-r,dg=(t,e,r)=>t<<32-r|e>>>r,pg=(t,e,r)=>t<<64-r|e>>>r-32,yg=(t,e,r)=>t>>>r-32|e<<64-r,mg=(t,e)=>e,xg=(t,e)=>t,gg=(t,e,r)=>t<<r|e>>>32-r,bg=(t,e,r)=>e<<r|t>>>32-r,vg=(t,e,r)=>e<<r-32|t>>>64-r,wg=(t,e,r)=>t<<r-32|e>>>64-r;function Eg(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var Sg=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),Ag=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,Bg=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),Ig=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,Cg=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),Tg=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0;var Rg={fromBig:ih,split:cg,toBig:fg,shrSH:ug,shrSL:hg,rotrSH:lg,rotrSL:dg,rotrBH:pg,rotrBL:yg,rotr32H:mg,rotr32L:xg,rotlSH:gg,rotlSL:bg,rotlBH:vg,rotlBL:wg,add:Eg,add3L:Sg,add3H:Ag,add4L:Bg,add4H:Ig,add5H:Tg,add5L:Cg},Y=Rg;var[Lg,Dg]=Y.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))),ar=new Uint32Array(80),cr=new Uint32Array(80),la=class extends ln{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:f,Eh:c,El:u,Fh:h,Fl:y,Gh:p,Gl:l,Hh:d,Hl:m}=this;return[e,r,n,i,o,s,a,f,c,u,h,y,p,l,d,m]}set(e,r,n,i,o,s,a,f,c,u,h,y,p,l,d,m){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=f|0,this.Eh=c|0,this.El=u|0,this.Fh=h|0,this.Fl=y|0,this.Gh=p|0,this.Gl=l|0,this.Hh=d|0,this.Hl=m|0}process(e,r){for(let b=0;b<16;b++,r+=4)ar[b]=e.getUint32(r),cr[b]=e.getUint32(r+=4);for(let b=16;b<80;b++){let A=ar[b-15]|0,w=cr[b-15]|0,E=Y.rotrSH(A,w,1)^Y.rotrSH(A,w,8)^Y.shrSH(A,w,7),B=Y.rotrSL(A,w,1)^Y.rotrSL(A,w,8)^Y.shrSL(A,w,7),C=ar[b-2]|0,M=cr[b-2]|0,H=Y.rotrSH(C,M,19)^Y.rotrBH(C,M,61)^Y.shrSH(C,M,6),z=Y.rotrSL(C,M,19)^Y.rotrBL(C,M,61)^Y.shrSL(C,M,6),J=Y.add4L(B,z,cr[b-7],cr[b-16]),ct=Y.add4H(J,E,H,ar[b-7],ar[b-16]);ar[b]=ct|0,cr[b]=J|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:f,Dh:c,Dl:u,Eh:h,El:y,Fh:p,Fl:l,Gh:d,Gl:m,Hh:x,Hl:g}=this;for(let b=0;b<80;b++){let A=Y.rotrSH(h,y,14)^Y.rotrSH(h,y,18)^Y.rotrBH(h,y,41),w=Y.rotrSL(h,y,14)^Y.rotrSL(h,y,18)^Y.rotrBL(h,y,41),E=h&p^~h&d,B=y&l^~y&m,C=Y.add5L(g,w,B,Dg[b],cr[b]),M=Y.add5H(C,x,A,E,Lg[b],ar[b]),H=C|0,z=Y.rotrSH(n,i,28)^Y.rotrBH(n,i,34)^Y.rotrBH(n,i,39),J=Y.rotrSL(n,i,28)^Y.rotrBL(n,i,34)^Y.rotrBL(n,i,39),ct=n&o^n&a^o&a,Pt=i&s^i&f^s&f;x=d|0,g=m|0,d=p|0,m=l|0,p=h|0,l=y|0,{h,l:y}=Y.add(c|0,u|0,M|0,H|0),c=a|0,u=f|0,a=o|0,f=s|0,o=n|0,s=i|0;let L=Y.add3L(H,J,Pt);n=Y.add3H(L,M,z,ct),i=L|0}({h:n,l:i}=Y.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=Y.add(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:f}=Y.add(this.Ch|0,this.Cl|0,a|0,f|0),{h:c,l:u}=Y.add(this.Dh|0,this.Dl|0,c|0,u|0),{h,l:y}=Y.add(this.Eh|0,this.El|0,h|0,y|0),{h:p,l}=Y.add(this.Fh|0,this.Fl|0,p|0,l|0),{h:d,l:m}=Y.add(this.Gh|0,this.Gl|0,d|0,m|0),{h:x,l:g}=Y.add(this.Hh|0,this.Hl|0,x|0,g|0),this.set(n,i,o,s,a,f,c,u,h,y,p,l,d,m,x,g)}roundClean(){ar.fill(0),cr.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 da=so(()=>new la);var fo={};F(fo,{bitGet:()=>Fg,bitLen:()=>Og,bitMask:()=>oi,bitSet:()=>Mg,bytesToHex:()=>Fe,bytesToNumberBE:()=>Me,bytesToNumberLE:()=>fr,concatBytes:()=>Ke,createHmacDrbg:()=>ma,ensureBytes:()=>wt,equalBytes:()=>kg,hexToBytes:()=>Lr,hexToNumber:()=>ya,isBytes:()=>he,numberToBytesBE:()=>ur,numberToBytesLE:()=>Dr,numberToHexUnpadded:()=>ch,numberToVarBytesBE:()=>Pg,utf8ToBytes:()=>Ug,validateObject:()=>Te});var ah=BigInt(0),co=BigInt(1),_g=BigInt(2);function he(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var Ng=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Fe(t){if(!he(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=Ng[t[r]];return e}function ch(t){let e=t.toString(16);return e.length&1?`0${e}`:e}function ya(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}var Oe={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function oh(t){if(t>=Oe._0&&t<=Oe._9)return t-Oe._0;if(t>=Oe._A&&t<=Oe._F)return t-(Oe._A-10);if(t>=Oe._a&&t<=Oe._f)return t-(Oe._a-10)}function Lr(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=oh(t.charCodeAt(o)),a=oh(t.charCodeAt(o+1));if(s===void 0||a===void 0){let f=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+f+'" at index '+o)}n[i]=s*16+a}return n}function Me(t){return ya(Fe(t))}function fr(t){if(!he(t))throw new Error("Uint8Array expected");return ya(Fe(Uint8Array.from(t).reverse()))}function ur(t,e){return Lr(t.toString(16).padStart(e*2,"0"))}function Dr(t,e){return ur(t,e).reverse()}function Pg(t){return Lr(ch(t))}function wt(t,e,r){let n;if(typeof e=="string")try{n=Lr(e)}catch(o){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${o}`)}else if(he(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 Ke(...t){let e=0;for(let i=0;i<t.length;i++){let o=t[i];if(!he(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 kg(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 Ug(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function Og(t){let e;for(e=0;t>ah;t>>=co,e+=1);return e}function Fg(t,e){return t>>BigInt(e)&co}var Mg=(t,e,r)=>t|(r?co:ah)<<BigInt(e),oi=t=>(_g<<BigInt(t-1))-co,pa=t=>new Uint8Array(t),sh=t=>Uint8Array.from(t);function ma(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=pa(t),i=pa(t),o=0,s=()=>{n.fill(1),i.fill(0),o=0},a=(...h)=>r(i,n,...h),f=(h=pa())=>{i=a(sh([0]),h),n=a(),h.length!==0&&(i=a(sh([1]),h),n=a())},c=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let h=0,y=[];for(;h<e;){n=a();let p=n.slice();y.push(p),h+=n.length}return Ke(...y)};return(h,y)=>{s(),f(h);let p;for(;!(p=y(c()));)f();return s(),p}}var Kg={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"||he(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 Te(t,e,r={}){let n=(i,o,s)=>{let a=Kg[o];if(typeof a!="function")throw new Error(`Invalid validator "${o}", expected function`);let f=t[i];if(!(s&&f===void 0)&&!a(f,t))throw new Error(`Invalid param ${String(i)}=${f} (${typeof f}), 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 Rt=BigInt(0),mt=BigInt(1),_r=BigInt(2),Vg=BigInt(3),xa=BigInt(4),fh=BigInt(5),uh=BigInt(8),zg=BigInt(9),qg=BigInt(16);function ht(t,e){let r=t%e;return r>=Rt?r:e+r}function Hg(t,e,r){if(r<=Rt||e<Rt)throw new Error("Expected power/modulo > 0");if(r===mt)return Rt;let n=mt;for(;e>Rt;)e&mt&&(n=n*t%r),t=t*t%r,e>>=mt;return n}function xt(t,e,r){let n=t;for(;e-- >Rt;)n*=n,n%=r;return n}function uo(t,e){if(t===Rt||e<=Rt)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=ht(t,e),n=e,i=Rt,o=mt,s=mt,a=Rt;for(;r!==Rt;){let c=n/r,u=n%r,h=i-s*c,y=o-a*c;n=r,r=u,i=s,o=a,s=h,a=y}if(n!==mt)throw new Error("invert: does not exist");return ht(i,e)}function $g(t){let e=(t-mt)/_r,r,n,i;for(r=t-mt,n=0;r%_r===Rt;r/=_r,n++);for(i=_r;i<t&&Hg(i,e,t)!==t-mt;i++);if(n===1){let s=(t+mt)/xa;return function(f,c){let u=f.pow(c,s);if(!f.eql(f.sqr(u),c))throw new Error("Cannot find square root");return u}}let o=(r+mt)/_r;return function(a,f){if(a.pow(f,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let c=n,u=a.pow(a.mul(a.ONE,i),r),h=a.pow(f,o),y=a.pow(f,r);for(;!a.eql(y,a.ONE);){if(a.eql(y,a.ZERO))return a.ZERO;let p=1;for(let d=a.sqr(y);p<c&&!a.eql(d,a.ONE);p++)d=a.sqr(d);let l=a.pow(u,mt<<BigInt(c-p-1));u=a.sqr(l),h=a.mul(h,l),y=a.mul(y,u),c=p}return h}}function Gg(t){if(t%xa===Vg){let e=(t+mt)/xa;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%uh===fh){let e=(t-fh)/uh;return function(n,i){let o=n.mul(i,_r),s=n.pow(o,e),a=n.mul(i,s),f=n.mul(n.mul(a,_r),s),c=n.mul(a,n.sub(f,n.ONE));if(!n.eql(n.sqr(c),i))throw new Error("Cannot find square root");return c}}return t%qg,$g(t)}var hh=(t,e)=>(ht(t,e)&mt)===mt,Wg=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function ga(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=Wg.reduce((n,i)=>(n[i]="function",n),e);return Te(t,r)}function Yg(t,e,r){if(r<Rt)throw new Error("Expected power > 0");if(r===Rt)return t.ONE;if(r===mt)return e;let n=t.ONE,i=e;for(;r>Rt;)r&mt&&(n=t.mul(n,i)),i=t.sqr(i),r>>=mt;return n}function Zg(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 ba(t,e){let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function ho(t,e,r=!1,n={}){if(t<=Rt)throw new Error(`Expected Field ORDER > 0, got ${t}`);let{nBitLength:i,nByteLength:o}=ba(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");let s=Gg(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:oi(i),ZERO:Rt,ONE:mt,create:f=>ht(f,t),isValid:f=>{if(typeof f!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof f}`);return Rt<=f&&f<t},is0:f=>f===Rt,isOdd:f=>(f&mt)===mt,neg:f=>ht(-f,t),eql:(f,c)=>f===c,sqr:f=>ht(f*f,t),add:(f,c)=>ht(f+c,t),sub:(f,c)=>ht(f-c,t),mul:(f,c)=>ht(f*c,t),pow:(f,c)=>Yg(a,f,c),div:(f,c)=>ht(f*uo(c,t),t),sqrN:f=>f*f,addN:(f,c)=>f+c,subN:(f,c)=>f-c,mulN:(f,c)=>f*c,inv:f=>uo(f,t),sqrt:n.sqrt||(f=>s(a,f)),invertBatch:f=>Zg(a,f),cmov:(f,c,u)=>u?c:f,toBytes:f=>r?Dr(f,o):ur(f,o),fromBytes:f=>{if(f.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${f.length}`);return r?fr(f):Me(f)}});return Object.freeze(a)}function lh(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 dh(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 va(t){let e=dh(t);return e+Math.ceil(e/2)}function ph(t,e,r=!1){let n=t.length,i=dh(e),o=va(e);if(n<16||n<o||n>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);let s=r?Me(t):fr(t),a=ht(s,e-mt)+mt;return r?Dr(a,i):ur(a,i)}var Xg=BigInt(0),wa=BigInt(1);function lo(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>Xg;)o&wa&&(s=s.add(a)),a=a.double(),o>>=wa;return s},precomputeWindow(i,o){let{windows:s,windowSize:a}=n(o),f=[],c=i,u=c;for(let h=0;h<s;h++){u=c,f.push(u);for(let y=1;y<a;y++)u=u.add(c),f.push(u);c=u.double()}return f},wNAF(i,o,s){let{windows:a,windowSize:f}=n(i),c=t.ZERO,u=t.BASE,h=BigInt(2**i-1),y=2**i,p=BigInt(i);for(let l=0;l<a;l++){let d=l*f,m=Number(s&h);s>>=p,m>f&&(m-=y,s+=wa);let x=d,g=d+Math.abs(m)-1,b=l%2!==0,A=m<0;m===0?u=u.add(r(b,o[x])):c=c.add(r(A,o[g]))}return{p:c,f:u}},wNAFCached(i,o,s,a){let f=i._WINDOW_SIZE||1,c=o.get(i);return c||(c=this.precomputeWindow(i,f),f!==1&&o.set(i,a(c))),this.wNAF(f,c,s)}}}function si(t){return ga(t.Fp),Te(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...ba(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}var le=BigInt(0),ee=BigInt(1),po=BigInt(2),Jg=BigInt(8),jg={zip215:!0};function t2(t){let e=si(t);return Te(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function yo(t){let e=t2(t),{Fp:r,n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:f}=e,c=po<<BigInt(a*8)-ee,u=r.create,h=e.uvRatio||((N,T)=>{try{return{isValid:!0,value:r.sqrt(N*r.inv(T))}}catch{return{isValid:!1,value:le}}}),y=e.adjustScalarBytes||(N=>N),p=e.domain||((N,T,O)=>{if(T.length||O)throw new Error("Contexts/pre-hash are not supported");return N}),l=N=>typeof N=="bigint"&&le<N,d=(N,T)=>l(N)&&l(T)&&N<T,m=N=>N===le||d(N,c);function x(N,T){if(d(N,T))return N;throw new Error(`Expected valid scalar < ${T}, got ${typeof N} ${N}`)}function g(N){return N===le?N:x(N,n)}let b=new Map;function A(N){if(!(N instanceof w))throw new Error("ExtendedPoint expected")}class w{constructor(T,O,K,q){if(this.ex=T,this.ey=O,this.ez=K,this.et=q,!m(T))throw new Error("x required");if(!m(O))throw new Error("y required");if(!m(K))throw new Error("z required");if(!m(q))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(T){if(T instanceof w)throw new Error("extended point not allowed");let{x:O,y:K}=T||{};if(!m(O)||!m(K))throw new Error("invalid affine point");return new w(O,K,ee,u(O*K))}static normalizeZ(T){let O=r.invertBatch(T.map(K=>K.ez));return T.map((K,q)=>K.toAffine(O[q])).map(w.fromAffine)}_setWindowSize(T){this._WINDOW_SIZE=T,b.delete(this)}assertValidity(){let{a:T,d:O}=e;if(this.is0())throw new Error("bad point: ZERO");let{ex:K,ey:q,ez:Q,et:j}=this,st=u(K*K),tt=u(q*q),nt=u(Q*Q),Bt=u(nt*nt),gt=u(st*T),kt=u(nt*u(gt+tt)),Ut=u(Bt+u(O*u(st*tt)));if(kt!==Ut)throw new Error("bad point: equation left != right (1)");let Tt=u(K*q),Ft=u(Q*j);if(Tt!==Ft)throw new Error("bad point: equation left != right (2)")}equals(T){A(T);let{ex:O,ey:K,ez:q}=this,{ex:Q,ey:j,ez:st}=T,tt=u(O*st),nt=u(Q*q),Bt=u(K*st),gt=u(j*q);return tt===nt&&Bt===gt}is0(){return this.equals(w.ZERO)}negate(){return new w(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:T}=e,{ex:O,ey:K,ez:q}=this,Q=u(O*O),j=u(K*K),st=u(po*u(q*q)),tt=u(T*Q),nt=O+K,Bt=u(u(nt*nt)-Q-j),gt=tt+j,kt=gt-st,Ut=tt-j,Tt=u(Bt*kt),Ft=u(gt*Ut),De=u(Bt*Ut),vr=u(kt*gt);return new w(Tt,Ft,vr,De)}add(T){A(T);let{a:O,d:K}=e,{ex:q,ey:Q,ez:j,et:st}=this,{ex:tt,ey:nt,ez:Bt,et:gt}=T;if(O===BigInt(-1)){let Uc=u((Q-q)*(nt+tt)),Oc=u((Q+q)*(nt-tt)),$o=u(Oc-Uc);if($o===le)return this.double();let Fc=u(j*po*gt),Mc=u(st*po*Bt),Kc=Mc+Fc,Vc=Oc+Uc,zc=Mc-Fc,up=u(Kc*$o),hp=u(Vc*zc),lp=u(Kc*zc),dp=u($o*Vc);return new w(up,hp,dp,lp)}let kt=u(q*tt),Ut=u(Q*nt),Tt=u(st*K*gt),Ft=u(j*Bt),De=u((q+Q)*(tt+nt)-kt-Ut),vr=Ft-Tt,zn=Ft+Tt,kc=u(Ut-O*kt),sp=u(De*vr),ap=u(zn*kc),cp=u(De*kc),fp=u(vr*zn);return new w(sp,ap,fp,cp)}subtract(T){return this.add(T.negate())}wNAF(T){return C.wNAFCached(this,b,T,w.normalizeZ)}multiply(T){let{p:O,f:K}=this.wNAF(x(T,n));return w.normalizeZ([O,K])[0]}multiplyUnsafe(T){let O=g(T);return O===le?B:this.equals(B)||O===ee?this:this.equals(E)?this.wNAF(O).p:C.unsafeLadder(this,O)}isSmallOrder(){return this.multiplyUnsafe(f).is0()}isTorsionFree(){return C.unsafeLadder(this,n).is0()}toAffine(T){let{ex:O,ey:K,ez:q}=this,Q=this.is0();T==null&&(T=Q?Jg:r.inv(q));let j=u(O*T),st=u(K*T),tt=u(q*T);if(Q)return{x:le,y:ee};if(tt!==ee)throw new Error("invZ was invalid");return{x:j,y:st}}clearCofactor(){let{h:T}=e;return T===ee?this:this.multiplyUnsafe(T)}static fromHex(T,O=!1){let{d:K,a:q}=e,Q=r.BYTES;T=wt("pointHex",T,Q);let j=T.slice(),st=T[Q-1];j[Q-1]=st&-129;let tt=fr(j);tt===le||(O?x(tt,c):x(tt,r.ORDER));let nt=u(tt*tt),Bt=u(nt-ee),gt=u(K*nt-q),{isValid:kt,value:Ut}=h(Bt,gt);if(!kt)throw new Error("Point.fromHex: invalid y coordinate");let Tt=(Ut&ee)===ee,Ft=(st&128)!==0;if(!O&&Ut===le&&Ft)throw new Error("Point.fromHex: x=0 and x_0=1");return Ft!==Tt&&(Ut=u(-Ut)),w.fromAffine({x:Ut,y:tt})}static fromPrivateKey(T){return z(T).point}toRawBytes(){let{x:T,y:O}=this.toAffine(),K=Dr(O,r.BYTES);return K[K.length-1]|=T&ee?128:0,K}toHex(){return Fe(this.toRawBytes())}}w.BASE=new w(e.Gx,e.Gy,ee,u(e.Gx*e.Gy)),w.ZERO=new w(le,ee,ee,le);let{BASE:E,ZERO:B}=w,C=lo(w,a*8);function M(N){return ht(N,n)}function H(N){return M(fr(N))}function z(N){let T=a;N=wt("private key",N,T);let O=wt("hashed private key",o(N),2*T),K=y(O.slice(0,T)),q=O.slice(T,2*T),Q=H(K),j=E.multiply(Q),st=j.toRawBytes();return{head:K,prefix:q,scalar:Q,point:j,pointBytes:st}}function J(N){return z(N).pointBytes}function ct(N=new Uint8Array,...T){let O=Ke(...T);return H(o(p(O,wt("context",N),!!i)))}function Pt(N,T,O={}){N=wt("message",N),i&&(N=i(N));let{prefix:K,scalar:q,pointBytes:Q}=z(T),j=ct(O.context,K,N),st=E.multiply(j).toRawBytes(),tt=ct(O.context,st,Q,N),nt=M(j+tt*q);g(nt);let Bt=Ke(st,Dr(nt,r.BYTES));return wt("result",Bt,a*2)}let L=jg;function P(N,T,O,K=L){let{context:q,zip215:Q}=K,j=r.BYTES;N=wt("signature",N,2*j),T=wt("message",T),i&&(T=i(T));let st=fr(N.slice(j,2*j)),tt,nt,Bt;try{tt=w.fromHex(O,Q),nt=w.fromHex(N.slice(0,j),Q),Bt=E.multiplyUnsafe(st)}catch{return!1}if(!Q&&tt.isSmallOrder())return!1;let gt=ct(q,nt.toRawBytes(),tt.toRawBytes(),T);return nt.add(tt.multiplyUnsafe(gt)).subtract(Bt).clearCofactor().equals(w.ZERO)}return E._setWindowSize(8),{CURVE:e,getPublicKey:J,sign:Pt,verify:P,ExtendedPoint:w,utils:{getExtendedPublicKey:z,randomPrivateKey:()=>s(r.BYTES),precompute(N=8,T=w.BASE){return T._setWindowSize(N),T.multiply(BigInt(3)),T}}}}var Sa=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),yh=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),f6=BigInt(0),e2=BigInt(1),Ea=BigInt(2),r2=BigInt(5),mh=BigInt(10),n2=BigInt(20),i2=BigInt(40),xh=BigInt(80);function o2(t){let e=Sa,n=t*t%e*t%e,i=xt(n,Ea,e)*n%e,o=xt(i,e2,e)*t%e,s=xt(o,r2,e)*o%e,a=xt(s,mh,e)*s%e,f=xt(a,n2,e)*a%e,c=xt(f,i2,e)*f%e,u=xt(c,xh,e)*c%e,h=xt(u,xh,e)*c%e,y=xt(h,mh,e)*s%e;return{pow_p_5_8:xt(y,Ea,e)*t%e,b2:n}}function s2(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function a2(t,e){let r=Sa,n=ht(e*e*e,r),i=ht(n*n*e,r),o=o2(t*i).pow_p_5_8,s=ht(t*n*o,r),a=ht(e*s*s,r),f=s,c=ht(s*yh,r),u=a===t,h=a===ht(-t,r),y=a===ht(-t*yh,r);return u&&(s=f),(h||y)&&(s=c),hh(s,r)&&(s=ht(-s,r)),{isValid:u||h,value:s}}var Ve=ho(Sa,void 0,!0),Aa={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Ve,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:da,randomBytes:hn,adjustScalarBytes:s2,uvRatio:a2},dn=yo(Aa);function gh(t,e,r){if(e.length>255)throw new Error("Context is too big");return oo(ua("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,e.length]),e,t)}var u6=yo({...Aa,domain:gh}),h6=yo({...Aa,domain:gh,prehash:da});var c2=(Ve.ORDER+BigInt(3))/BigInt(8),l6=Ve.pow(Ea,c2),d6=Ve.sqrt(Ve.neg(Ve.ONE)),p6=(Ve.ORDER-BigInt(5))/BigInt(8),y6=BigInt(486662);var m6=lh(Ve,Ve.neg(BigInt(486664)));var x6=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),g6=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),b6=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),v6=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");var w6=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var pn=32,ze=64,mo=32;function bh(){let t=dn.utils.randomPrivateKey(),e=dn.getPublicKey(t);return{privateKey:Sh(t,e),publicKey:e}}function vh(t){if(t.length!==mo)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=dn.getPublicKey(e);return{privateKey:Sh(e,r),publicKey:r}}function wh(t,e){let r=t.subarray(0,mo);return dn.sign(e instanceof Uint8Array?e:e.subarray(),r)}function Eh(t,e,r){return dn.verify(e,r instanceof Uint8Array?r:r.subarray(),t)}function Sh(t,e){let r=new Uint8Array(ze);for(let n=0;n<mo;n++)r[n]=t[n],r[mo+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 Ba={alg:"A128GCM",ext:!0,k:"scm9jmO_4BJAgdwWGVulLg",key_ops:["encrypt","decrypt"],kty:"oct"};function Ia(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 f(h,y){let p=a.getRandomValues(new Uint8Array(o)),l=a.getRandomValues(new Uint8Array(n)),d={name:e,iv:l};typeof y=="string"&&(y=Jt(y));let m;if(y.length===0){m=await a.subtle.importKey("jwk",Ba,{name:"AES-GCM"},!0,["encrypt"]);try{let g={name:"PBKDF2",salt:p,iterations:s,hash:{name:i}},b=await a.subtle.importKey("raw",y,{name:"PBKDF2"},!1,["deriveKey"]);m=await a.subtle.deriveKey(g,b,{name:e,length:r},!0,["encrypt"])}catch{m=await a.subtle.importKey("jwk",Ba,{name:"AES-GCM"},!0,["encrypt"])}}else{let g={name:"PBKDF2",salt:p,iterations:s,hash:{name:i}},b=await a.subtle.importKey("raw",y,{name:"PBKDF2"},!1,["deriveKey"]);m=await a.subtle.deriveKey(g,b,{name:e,length:r},!0,["encrypt"])}let x=await a.subtle.encrypt(d,m,h);return Rr([p,d.iv,new Uint8Array(x)])}async function c(h,y){let p=h.subarray(0,o),l=h.subarray(o,o+n),d=h.subarray(o+n),m={name:e,iv:l};typeof y=="string"&&(y=Jt(y));let x;if(y.length===0)try{let b={name:"PBKDF2",salt:p,iterations:s,hash:{name:i}},A=await a.subtle.importKey("raw",y,{name:"PBKDF2"},!1,["deriveKey"]);x=await a.subtle.deriveKey(b,A,{name:e,length:r},!0,["decrypt"])}catch{x=await a.subtle.importKey("jwk",Ba,{name:"AES-GCM"},!0,["decrypt"])}else{let b={name:"PBKDF2",salt:p,iterations:s,hash:{name:i}},A=await a.subtle.importKey("raw",y,{name:"PBKDF2"},!1,["deriveKey"]);x=await a.subtle.deriveKey(b,A,{name:e,length:r},!0,["decrypt"])}let g=await a.subtle.decrypt(m,x,d);return new Uint8Array(g)}return{encrypt:f,decrypt:c}}async function yn(t,e){let n=await Ia().encrypt(t,e);return _i.encode(n)}var Ca=new Float32Array([-0]),hr=new Uint8Array(Ca.buffer);function Bh(t,e,r){Ca[0]=t,e[r]=hr[0],e[r+1]=hr[1],e[r+2]=hr[2],e[r+3]=hr[3]}function Ih(t,e){return hr[0]=t[e],hr[1]=t[e+1],hr[2]=t[e+2],hr[3]=t[e+3],Ca[0]}var Ta=new Float64Array([-0]),Kt=new Uint8Array(Ta.buffer);function Ch(t,e,r){Ta[0]=t,e[r]=Kt[0],e[r+1]=Kt[1],e[r+2]=Kt[2],e[r+3]=Kt[3],e[r+4]=Kt[4],e[r+5]=Kt[5],e[r+6]=Kt[6],e[r+7]=Kt[7]}function Th(t,e){return Kt[0]=t[e],Kt[1]=t[e+1],Kt[2]=t[e+2],Kt[3]=t[e+3],Kt[4]=t[e+4],Kt[5]=t[e+5],Kt[6]=t[e+6],Kt[7]=t[e+7],Ta[0]}var u2=BigInt(Number.MAX_SAFE_INTEGER),h2=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 Nr;if(e<u2&&e>h2)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>Rh&&(i=0n,++n>Rh&&(n=0n))),new t(Number(i),Number(n))}static fromNumber(e){if(e===0)return Nr;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):Nr}},Nr=new Yt(0,0);Nr.toBigInt=function(){return 0n};Nr.zzEncode=Nr.zzDecode=function(){return this};Nr.length=function(){return 1};var Rh=4294967296n;function Lh(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 Dh(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 Ra(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 de(t,e){return RangeError(`index out of range: ${t.pos} + ${e??1} > ${t.len}`)}function xo(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}var La=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,de(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 de(this,4);return xo(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw de(this,4);return xo(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw de(this,4);let e=Ih(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw de(this,4);let e=Th(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 de(this,e);return this.pos+=e,r===n?new Uint8Array(0):this.buf.subarray(r,n)}string(){let e=this.bytes();return Dh(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw de(this,e);this.pos+=e}else do if(this.pos>=this.len)throw de(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 de(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 de(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 de(this,8);let e=xo(this.buf,this.pos+=4),r=xo(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 Da(t){return new La(t instanceof Uint8Array?t:t.subarray())}function pe(t,e){let r=Da(t);return e.decode(r)}function Pr(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function qe(t=0){return globalThis.Buffer?.alloc!=null?Pr(globalThis.Buffer.alloc(t)):new Uint8Array(t)}function Vt(t=0){return globalThis.Buffer?.allocUnsafe!=null?Pr(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var Ua={};F(Ua,{base10:()=>x2});function l2(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,f=t.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";for(var d=0,m=0,x=0,g=l.length;x!==g&&l[x]===0;)x++,d++;for(var b=(g-x)*u+1>>>0,A=new Uint8Array(b);x!==g;){for(var w=l[x],E=0,B=b-1;(w!==0||E<m)&&B!==-1;B--,E++)w+=256*A[B]>>>0,A[B]=w%a>>>0,w=w/a>>>0;if(w!==0)throw new Error("Non-zero carry");m=E,x++}for(var C=b-m;C!==b&&A[C]===0;)C++;for(var M=f.repeat(d);C<b;++C)M+=t.charAt(A[C]);return M}function y(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;var d=0;if(l[d]!==" "){for(var m=0,x=0;l[d]===f;)m++,d++;for(var g=(l.length-d)*c+1>>>0,b=new Uint8Array(g);l[d];){var A=r[l.charCodeAt(d)];if(A===255)return;for(var w=0,E=g-1;(A!==0||w<x)&&E!==-1;E--,w++)A+=a*b[E]>>>0,b[E]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");x=w,d++}if(l[d]!==" "){for(var B=g-x;B!==g&&b[B]===0;)B++;for(var C=new Uint8Array(m+(g-B)),M=m;B!==g;)C[M++]=b[B++];return C}}}function p(l){var d=y(l);if(d)return d;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:y,decode:p}}var d2=l2,p2=d2,Nh=p2;var V6=new Uint8Array(0);var Ph=(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},He=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")};var kh=t=>new TextEncoder().encode(t),Uh=t=>new TextDecoder().decode(t);var _a=class{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")}},Na=class{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 Fh(this,e)}},Pa=class{constructor(e){this.decoders=e}or(e){return Fh(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Fh=(t,e)=>new Pa({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),ka=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new _a(e,r,n),this.decoder=new Na(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},mn=({name:t,prefix:e,encode:r,decode:n})=>new ka(t,e,r,n),lr=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=Nh(r,e);return mn({prefix:t,name:e,encode:n,decode:o=>He(i(o))})},y2=(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,f=0,c=0;for(let u=0;u<o;++u){let h=i[t[u]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<r|h,a+=r,a>=8&&(a-=8,s[c++]=255&f>>a)}if(a>=r||255&f<<8-a)throw new SyntaxError("Unexpected end of data");return s},m2=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let f=0;f<t.length;++f)for(a=a<<8|t[f],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o},Et=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>mn({prefix:e,name:t,encode(i){return m2(i,n,r)},decode(i){return y2(i,n,r,t)}});var x2=lr({prefix:"9",name:"base10",alphabet:"0123456789"});var Oa={};F(Oa,{base16:()=>g2,base16upper:()=>b2});var g2=Et({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),b2=Et({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Fa={};F(Fa,{base2:()=>v2});var v2=Et({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ma={};F(Ma,{base256emoji:()=>B2});var Mh=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}"),w2=Mh.reduce((t,e,r)=>(t[r]=e,t),[]),E2=Mh.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function S2(t){return t.reduce((e,r)=>(e+=w2[r],e),"")}function A2(t){let e=[];for(let r of t){let n=E2[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var B2=mn({prefix:"\u{1F680}",name:"base256emoji",encode:S2,decode:A2});var Ka={};F(Ka,{base32:()=>xn,base32hex:()=>R2,base32hexpad:()=>D2,base32hexpadupper:()=>_2,base32hexupper:()=>L2,base32pad:()=>C2,base32padupper:()=>T2,base32upper:()=>I2,base32z:()=>N2});var xn=Et({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),I2=Et({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),C2=Et({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),T2=Et({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),R2=Et({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),L2=Et({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),D2=Et({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),_2=Et({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),N2=Et({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Va={};F(Va,{base36:()=>P2,base36upper:()=>k2});var P2=lr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),k2=lr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var za={};F(za,{base58btc:()=>Re,base58flickr:()=>U2});var Re=lr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),U2=lr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var qa={};F(qa,{base64:()=>O2,base64pad:()=>F2,base64url:()=>M2,base64urlpad:()=>K2});var O2=Et({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),F2=Et({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),M2=Et({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),K2=Et({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ha={};F(Ha,{base8:()=>V2});var V2=Et({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var $a={};F($a,{identity:()=>z2});var z2=mn({prefix:"\0",name:"identity",encode:t=>Uh(t),decode:t=>kh(t)});var r5=new TextEncoder,n5=new TextDecoder;var Wa={};F(Wa,{identity:()=>hb});var $2=zh,Kh=128,G2=127,W2=~G2,Y2=Math.pow(2,31);function zh(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Y2;)e[r++]=t&255|Kh,t/=128;for(;t&W2;)e[r++]=t&255|Kh,t>>>=7;return e[r]=t|0,zh.bytes=r-n+1,e}var Z2=Ga,Q2=128,Vh=127;function Ga(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw Ga.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&Vh)<<i:(s&Vh)*Math.pow(2,i),i+=7}while(s>=Q2);return Ga.bytes=o-n,r}var X2=Math.pow(2,7),J2=Math.pow(2,14),j2=Math.pow(2,21),tb=Math.pow(2,28),eb=Math.pow(2,35),rb=Math.pow(2,42),nb=Math.pow(2,49),ib=Math.pow(2,56),ob=Math.pow(2,63),sb=function(t){return t<X2?1:t<J2?2:t<j2?3:t<tb?4:t<eb?5:t<rb?6:t<nb?7:t<ib?8:t<ob?9:10},ab={encode:$2,decode:Z2,encodingLength:sb},cb=ab,ai=cb;var ci=(t,e=0)=>[ai.decode(t,e),ai.decode.bytes],gn=(t,e,r=0)=>(ai.encode(t,e,r),e),bn=t=>ai.encodingLength(t);var kr=(t,e)=>{let r=e.byteLength,n=bn(t),i=n+bn(r),o=new Uint8Array(i+r);return gn(t,o,0),gn(r,o,n),o.set(e,i),new vn(t,r,e,o)},qh=t=>{let e=He(t),[r,n]=ci(e),[i,o]=ci(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new vn(r,i,s,e)},Hh=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Ph(t.bytes,r.bytes)}},vn=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var $h=0,fb="identity",Gh=He,ub=t=>kr($h,Gh(t)),hb={code:$h,name:fb,encode:Gh,digest:ub};var Qa={};F(Qa,{sha256:()=>lb,sha512:()=>db});var Za=({name:t,code:e,encode:r})=>new Ya(t,e,r),Ya=class{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?kr(this.code,r):r.then(n=>kr(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Yh=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),lb=Za({name:"sha2-256",code:18,encode:Yh("SHA-256")}),db=Za({name:"sha2-512",code:19,encode:Yh("SHA-512")});var Zh=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return yb(r,Xa(t),e||Re.encoder);default:return mb(r,Xa(t),e||xn.encoder)}};var Qh=new WeakMap,Xa=t=>{let e=Qh.get(t);if(e==null){let r=new Map;return Qh.set(t,r),r}return e},bo=class t{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!==ui)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==xb)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=kr(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&&e.code===n.code&&e.version===n.version&&Hh(e.multihash,n.multihash)}toString(e){return Zh(this,e)}toJSON(){return{"/":Zh(this)}}link(){return this}get[Symbol.toStringTag](){return"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||Xh(n,i,o.bytes))}else if(r[gb]===!0){let{version:n,multihash:i,code:o}=r,s=qh(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!==ui)throw new Error(`Version 0 CID must use dag-pb (code: ${ui}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=Xh(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,ui,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=He(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 vn(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[h,y]=ci(e.subarray(r));return r+=y,h},i=n(),o=ui;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(),f=n(),c=r+f,u=c-s;return{version:i,codec:o,multihashCode:a,digestSize:f,multihashSize:u,size:c}}static parse(e,r){let[n,i]=pb(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 Xa(o).set(n,e),o}},pb=(t,e)=>{switch(t[0]){case"Q":{let r=e||Re;return[Re.prefix,r.decode(`${Re.prefix}${t}`)]}case Re.prefix:{let r=e||Re;return[Re.prefix,r.decode(t)]}case xn.prefix:{let r=e||xn;return[xn.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)]}}},yb=(t,e,r)=>{let{prefix:n}=r;if(n!==Re.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},mb=(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},ui=112,xb=18,Xh=(t,e,r)=>{let n=bn(t),i=n+bn(e),o=new Uint8Array(i+r.byteLength);return gn(t,o,0),gn(e,o,n),o.set(r,i),o},gb=Symbol.for("@ipld/js-cid/CID");var Ja={...$a,...Fa,...Ha,...Ua,...Oa,...Ka,...Va,...za,...qa,...Ma},b5={...Qa,...Wa};function jh(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var Jh=jh("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),ja=jh("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}),bb={utf8:Jh,"utf-8":Jh,hex:Ja.base16,latin1:ja,ascii:ja,binary:ja,...Ja},vo=bb;function hi(t,e="utf8"){let r=vo[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Pr(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function t0(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 Ur=class{fn;len;next;val;constructor(e,r,n){this.fn=e,this.len=r,this.next=void 0,this.val=n}};function e0(){}var n0=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},vb=t0();function wb(t){return globalThis.Buffer!=null?Vt(t):vb(t)}var pi=class{len;head;tail;states;constructor(){this.len=0,this.head=new Ur(e0,0,0),this.tail=this.head,this.states=null}_push(e,r,n){return this.tail=this.tail.next=new Ur(e,r,n),this.len+=r,this}uint32(e){return this.len+=(this.tail=this.tail.next=new i0((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(li,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(li,r.length(),r)}uint64Number(e){let r=Yt.fromNumber(e);return this._push(li,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(li,r.length(),r)}sint64Number(e){let r=Yt.fromNumber(e).zzEncode();return this._push(li,r.length(),r)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(r0,1,e?1:0)}fixed32(e){return this._push(di,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let r=Yt.fromBigInt(e);return this._push(di,4,r.lo)._push(di,4,r.hi)}fixed64Number(e){let r=Yt.fromNumber(e);return this._push(di,4,r.lo)._push(di,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(Bh,4,e)}double(e){return this._push(Ch,8,e)}bytes(e){let r=e.length>>>0;return r===0?this._push(r0,1,0):this.uint32(r)._push(Sb,r,e)}string(e){let r=Lh(e);return r!==0?this.uint32(r)._push(Ra,r,e):this._push(r0,1,0)}fork(){return this.states=new n0(this),this.head=this.tail=new Ur(e0,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 Ur(e0,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=wb(this.len),n=0;for(;e!=null;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r}};function r0(t,e,r){e[r]=t&255}function Eb(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}var i0=class extends Ur{next;constructor(e,r){super(Eb,e,r),this.next=void 0}};function li(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 di(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 Sb(t,e,r){e.set(t,r)}globalThis.Buffer!=null&&(pi.prototype.bytes=function(t){let e=t.length>>>0;return this.uint32(e),e>0&&this._push(Ab,e,t),this},pi.prototype.string=function(t){let e=globalThis.Buffer.byteLength(t);return this.uint32(e),e>0&&this._push(Bb,e,t),this});function Ab(t,e,r){e.set(t,r)}function Bb(t,e,r){t.length<40?Ra(t,e,r):e.utf8Write!=null?e.utf8Write(t,r):e.set(hi(t),r)}function o0(){return new pi}function ye(t,e){let r=o0();return e.encode(t,r,{lengthDelimited:!1}),r.finish()}var wn;(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"})(wn||(wn={}));function wo(t,e,r,n){return{name:t,type:e,encode:r,decode:n}}function En(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 wo("enum",wn.VARINT,r,n)}function me(t,e){return wo("message",wn.LENGTH_DELIMITED,t,e)}var Nt;(function(t){t.RSA="RSA",t.Ed25519="Ed25519",t.Secp256k1="Secp256k1"})(Nt||(Nt={}));var s0;(function(t){t[t.RSA=0]="RSA",t[t.Ed25519=1]="Ed25519",t[t.Secp256k1=2]="Secp256k1"})(s0||(s0={}));(function(t){t.codec=()=>En(s0)})(Nt||(Nt={}));var $e;(function(t){let e;t.codec=()=>(e==null&&(e=me((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),Nt.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=Nt.codec().decode(r);break;case 2:i.Data=r.bytes();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>ye(r,t.codec()),t.decode=r=>pe(r,t.codec())})($e||($e={}));var Ge;(function(t){let e;t.codec=()=>(e==null&&(e=me((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),Nt.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=Nt.codec().decode(r);break;case 2:i.Data=r.bytes();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>ye(r,t.codec()),t.decode=r=>pe(r,t.codec())})(Ge||(Ge={}));var yi=class{_key;constructor(e){this._key=Sn(e,pn)}verify(e,r){return Eh(this._key,r,e)}marshal(){return this._key}get bytes(){return $e.encode({Type:Nt.Ed25519,Data:this.marshal()}).subarray()}equals(e){return Ce(this.bytes,e.bytes)}hash(){let e=Ot.digest(this.bytes);return ie(e)?e.then(({bytes:r})=>r):e.bytes}},Or=class{_key;_publicKey;constructor(e,r){this._key=Sn(e,ze),this._publicKey=Sn(r,pn)}sign(e){return wh(this._key,e)}get public(){return new yi(this._publicKey)}marshal(){return this._key}get bytes(){return Ge.encode({Type:Nt.Ed25519,Data:this.marshal()}).subarray()}equals(e){return Ce(this.bytes,e.bytes)}async hash(){let e=Ot.digest(this.bytes),r;return ie(e)?{bytes:r}=await e:r=e.bytes,r}async id(){let e=er.digest(this.public.bytes);return qt.encode(e.bytes).substring(1)}async export(e,r="libp2p-key"){if(r==="libp2p-key")return yn(this.bytes,e);throw new G(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}};function Ib(t){if(t.length>ze){t=Sn(t,ze+pn);let n=t.subarray(0,ze),i=t.subarray(ze,t.length);return new Or(n,i)}t=Sn(t,ze);let e=t.subarray(0,ze),r=t.subarray(pn);return new Or(e,r)}function Cb(t){return t=Sn(t,pn),new yi(t)}async function Tb(){let{privateKey:t,publicKey:e}=bh();return new Or(t,e)}async function tl(t){let{privateKey:e,publicKey:r}=vh(t);return new Or(e,r)}function Sn(t,e){if(t=Uint8Array.from(t??[]),t.length!==e)throw new G(`Key must be a Uint8Array of length ${e}, got ${t.length}`,"ERR_INVALID_KEY_TYPE");return t}var Rb={"P-256":256,"P-384":384,"P-521":521},Lb=Object.keys(Rb),fA=Lb.join(" / ");var l0={};F(l0,{MAX_KEY_SIZE:()=>bi,RsaPrivateKey:()=>An,RsaPublicKey:()=>gi,fromJwk:()=>Vb,generateKeyPair:()=>zb,unmarshalRsaPrivateKey:()=>Mb,unmarshalRsaPublicKey:()=>Kb});var xi=Mt(ut(),1);var WA=Mt(ol(),1);function So(t){if(isNaN(t)||t<=0)throw new G("random bytes length must be a Number bigger than 0","ERR_INVALID_LENGTH");return hn(t)}var RA=Mt(Ji(),1),u0=Mt(ut(),1);function sl(t,e){return e.map(r=>te(t[r]))}function al(t){return u0.default.pki.setRsaPrivateKey(...sl(t,["n","e","d","p","q","dp","dq","qi"]))}function cl(t){return u0.default.pki.setRsaPublicKey(...sl(t,["n","e"]))}var Mr={};F(Mr,{jwkToPkcs1:()=>Pb,jwkToPkix:()=>Ub,pkcs1ToJwk:()=>Nb,pkixToJwk:()=>kb});var _A=Mt(Xn(),1),NA=Mt(Ji(),1);var We=Mt(ut(),1);function Nb(t){let e=We.default.asn1.fromDer(jt(t,"ascii")),r=We.default.pki.privateKeyFromAsn1(e);return{kty:"RSA",n:fe(r.n),e:fe(r.e),d:fe(r.d),p:fe(r.p),q:fe(r.q),dp:fe(r.dP),dq:fe(r.dQ),qi:fe(r.qInv),alg:"RS256"}}function Pb(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 G("JWK was missing components","ERR_INVALID_PARAMETERS");let e=We.default.pki.privateKeyToAsn1({n:te(t.n),e:te(t.e),d:te(t.d),p:te(t.p),q:te(t.q),dP:te(t.dp),dQ:te(t.dq),qInv:te(t.qi)});return Jt(We.default.asn1.toDer(e).getBytes(),"ascii")}function kb(t){let e=We.default.asn1.fromDer(jt(t,"ascii")),r=We.default.pki.publicKeyFromAsn1(e);return{kty:"RSA",n:fe(r.n),e:fe(r.e)}}function Ub(t){if(t.n==null||t.e==null)throw new G("JWK was missing components","ERR_INVALID_PARAMETERS");let e=We.default.pki.publicKeyToAsn1({n:te(t.n),e:te(t.e)});return Jt(We.default.asn1.toDer(e).getBytes(),"ascii")}async function fl(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 ll(e);return{privateKey:r[0],publicKey:r[1]}}async function h0(t){let r=[await Wt.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await Ob(t)],n=await ll({privateKey:r[0],publicKey:r[1]});return{privateKey:n[0],publicKey:n[1]}}async function ul(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 hl(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 ll(t){if(t.privateKey==null||t.publicKey==null)throw new G("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 Ob(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 dl(t,e,r,n){let i=e?cl(t):al(t),o=jt(r instanceof Uint8Array?r:r.subarray(),"ascii"),s=n(o,i);return Jt(s,"ascii")}function pl(t,e){return dl(t,!0,e,(r,n)=>n.encrypt(r))}function yl(t,e){return dl(t,!1,e,(r,n)=>n.decrypt(r))}function Ao(t){if(t.kty!=="RSA")throw new G("invalid key type","ERR_INVALID_KEY_TYPE");if(t.n==null)throw new G("invalid key modulus","ERR_INVALID_KEY_MODULUS");return Jt(t.n,"base64url").length*8}var bi=8192,gi=class{_key;constructor(e){this._key=e}verify(e,r){return hl(this._key,r,e)}marshal(){return Mr.jwkToPkix(this._key)}get bytes(){return $e.encode({Type:Nt.RSA,Data:this.marshal()}).subarray()}encrypt(e){return pl(this._key,e)}equals(e){return Ce(this.bytes,e.bytes)}hash(){let e=Ot.digest(this.bytes);return ie(e)?e.then(({bytes:r})=>r):e.bytes}},An=class{_key;_publicKey;constructor(e,r){this._key=e,this._publicKey=r}genSecret(){return So(16)}sign(e){return ul(this._key,e)}get public(){if(this._publicKey==null)throw new G("public key not provided","ERR_PUBKEY_NOT_PROVIDED");return new gi(this._publicKey)}decrypt(e){return yl(this._key,e)}marshal(){return Mr.jwkToPkcs1(this._key)}get bytes(){return Ge.encode({Type:Nt.RSA,Data:this.marshal()}).subarray()}equals(e){return Ce(this.bytes,e.bytes)}hash(){let e=Ot.digest(this.bytes);return ie(e)?e.then(({bytes:r})=>r):e.bytes}async id(){let e=await this.public.hash();return jt(e,"base58btc")}async export(e,r="pkcs-8"){if(r==="pkcs-8"){let n=new xi.default.util.ByteBuffer(this.marshal()),i=xi.default.asn1.fromDer(n),o=xi.default.pki.privateKeyFromAsn1(i),s={algorithm:"aes256",count:1e4,saltSize:128/8,prfAlgorithm:"sha512"};return xi.default.pki.encryptRsaPrivateKey(o,e,s)}else{if(r==="libp2p-key")return yn(this.bytes,e);throw new G(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}}};async function Mb(t){let e=Mr.pkcs1ToJwk(t);if(Ao(e)>bi)throw new G("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let r=await h0(e);return new An(r.privateKey,r.publicKey)}function Kb(t){let e=Mr.pkixToJwk(t);if(Ao(e)>bi)throw new G("key size is too large","ERR_KEY_SIZE_TOO_LARGE");return new gi(e)}async function Vb(t){if(Ao(t)>bi)throw new G("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let e=await h0(t);return new An(e.privateKey,e.publicKey)}async function zb(t){if(t>bi)throw new G("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let e=await fl(t);return new An(e.privateKey,e.publicKey)}var g0={};F(g0,{Secp256k1PrivateKey:()=>wi,Secp256k1PublicKey:()=>vi,generateKeyPair:()=>nv,unmarshalSecp256k1PrivateKey:()=>ev,unmarshalSecp256k1PublicKey:()=>rv});var qb=(t,e,r)=>t&e^~t&r,Hb=(t,e,r)=>t&e^t&r^e&r,$b=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]),dr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),pr=new Uint32Array(64),d0=class extends ln{constructor(){super(64,32,8,!1),this.A=dr[0]|0,this.B=dr[1]|0,this.C=dr[2]|0,this.D=dr[3]|0,this.E=dr[4]|0,this.F=dr[5]|0,this.G=dr[6]|0,this.H=dr[7]|0}get(){let{A:e,B:r,C:n,D:i,E:o,F:s,G:a,H:f}=this;return[e,r,n,i,o,s,a,f]}set(e,r,n,i,o,s,a,f){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=f|0}process(e,r){for(let h=0;h<16;h++,r+=4)pr[h]=e.getUint32(r,!1);for(let h=16;h<64;h++){let y=pr[h-15],p=pr[h-2],l=ue(y,7)^ue(y,18)^y>>>3,d=ue(p,17)^ue(p,19)^p>>>10;pr[h]=d+pr[h-7]+l+pr[h-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:f,G:c,H:u}=this;for(let h=0;h<64;h++){let y=ue(a,6)^ue(a,11)^ue(a,25),p=u+y+qb(a,f,c)+$b[h]+pr[h]|0,d=(ue(n,2)^ue(n,13)^ue(n,22))+Hb(n,i,o)|0;u=c,c=f,f=a,a=s+p|0,s=o,o=i,i=n,n=p+d|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,f=f+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(n,i,o,s,a,f,c,u)}roundClean(){pr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var ml=so(()=>new d0);function Gb(t){let e=si(t);Te(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:Wb,hexToBytes:Yb}=fo,Kr={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){let{Err:e}=Kr;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:Wb(n),l:t.subarray(r+2)}},toSig(t){let{Err:e}=Kr,r=typeof t=="string"?Yb(t):t;if(!he(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}=Kr._parseInt(r.subarray(2)),{d:s,l:a}=Kr._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){let e=c=>Number.parseInt(c[0],16)&8?"00"+c:c,r=c=>{let u=c.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),f=r(s);return`30${r(s+o+4)}02${f}${i}02${a}${n}`}},Ye=BigInt(0),oe=BigInt(1),nB=BigInt(2),xl=BigInt(3),iB=BigInt(4);function Zb(t){let e=Gb(t),{Fp:r}=e,n=e.toBytes||((l,d,m)=>{let x=d.toAffine();return Ke(Uint8Array.from([4]),r.toBytes(x.x),r.toBytes(x.y))}),i=e.fromBytes||(l=>{let d=l.subarray(1),m=r.fromBytes(d.subarray(0,r.BYTES)),x=r.fromBytes(d.subarray(r.BYTES,2*r.BYTES));return{x:m,y:x}});function o(l){let{a:d,b:m}=e,x=r.sqr(l),g=r.mul(x,l);return r.add(r.add(g,r.mul(l,d)),m)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(l){return typeof l=="bigint"&&Ye<l&&l<e.n}function a(l){if(!s(l))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function f(l){let{allowedPrivateKeyLengths:d,nByteLength:m,wrapPrivateKey:x,n:g}=e;if(d&&typeof l!="bigint"){if(he(l)&&(l=Fe(l)),typeof l!="string"||!d.includes(l.length))throw new Error("Invalid key");l=l.padStart(m*2,"0")}let b;try{b=typeof l=="bigint"?l:Me(wt("private key",l,m))}catch{throw new Error(`private key must be ${m} bytes, hex or bigint, not ${typeof l}`)}return x&&(b=ht(b,g)),a(b),b}let c=new Map;function u(l){if(!(l instanceof h))throw new Error("ProjectivePoint expected")}class h{constructor(d,m,x){if(this.px=d,this.py=m,this.pz=x,d==null||!r.isValid(d))throw new Error("x required");if(m==null||!r.isValid(m))throw new Error("y required");if(x==null||!r.isValid(x))throw new Error("z required")}static fromAffine(d){let{x:m,y:x}=d||{};if(!d||!r.isValid(m)||!r.isValid(x))throw new Error("invalid affine point");if(d instanceof h)throw new Error("projective point not allowed");let g=b=>r.eql(b,r.ZERO);return g(m)&&g(x)?h.ZERO:new h(m,x,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(d){let m=r.invertBatch(d.map(x=>x.pz));return d.map((x,g)=>x.toAffine(m[g])).map(h.fromAffine)}static fromHex(d){let m=h.fromAffine(i(wt("pointHex",d)));return m.assertValidity(),m}static fromPrivateKey(d){return h.BASE.multiply(f(d))}_setWindowSize(d){this._WINDOW_SIZE=d,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:d,y:m}=this.toAffine();if(!r.isValid(d)||!r.isValid(m))throw new Error("bad point: x or y not FE");let x=r.sqr(m),g=o(d);if(!r.eql(x,g))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:d}=this.toAffine();if(r.isOdd)return!r.isOdd(d);throw new Error("Field doesn't support isOdd")}equals(d){u(d);let{px:m,py:x,pz:g}=this,{px:b,py:A,pz:w}=d,E=r.eql(r.mul(m,w),r.mul(b,g)),B=r.eql(r.mul(x,w),r.mul(A,g));return E&&B}negate(){return new h(this.px,r.neg(this.py),this.pz)}double(){let{a:d,b:m}=e,x=r.mul(m,xl),{px:g,py:b,pz:A}=this,w=r.ZERO,E=r.ZERO,B=r.ZERO,C=r.mul(g,g),M=r.mul(b,b),H=r.mul(A,A),z=r.mul(g,b);return z=r.add(z,z),B=r.mul(g,A),B=r.add(B,B),w=r.mul(d,B),E=r.mul(x,H),E=r.add(w,E),w=r.sub(M,E),E=r.add(M,E),E=r.mul(w,E),w=r.mul(z,w),B=r.mul(x,B),H=r.mul(d,H),z=r.sub(C,H),z=r.mul(d,z),z=r.add(z,B),B=r.add(C,C),C=r.add(B,C),C=r.add(C,H),C=r.mul(C,z),E=r.add(E,C),H=r.mul(b,A),H=r.add(H,H),C=r.mul(H,z),w=r.sub(w,C),B=r.mul(H,M),B=r.add(B,B),B=r.add(B,B),new h(w,E,B)}add(d){u(d);let{px:m,py:x,pz:g}=this,{px:b,py:A,pz:w}=d,E=r.ZERO,B=r.ZERO,C=r.ZERO,M=e.a,H=r.mul(e.b,xl),z=r.mul(m,b),J=r.mul(x,A),ct=r.mul(g,w),Pt=r.add(m,x),L=r.add(b,A);Pt=r.mul(Pt,L),L=r.add(z,J),Pt=r.sub(Pt,L),L=r.add(m,g);let P=r.add(b,w);return L=r.mul(L,P),P=r.add(z,ct),L=r.sub(L,P),P=r.add(x,g),E=r.add(A,w),P=r.mul(P,E),E=r.add(J,ct),P=r.sub(P,E),C=r.mul(M,L),E=r.mul(H,ct),C=r.add(E,C),E=r.sub(J,C),C=r.add(J,C),B=r.mul(E,C),J=r.add(z,z),J=r.add(J,z),ct=r.mul(M,ct),L=r.mul(H,L),J=r.add(J,ct),ct=r.sub(z,ct),ct=r.mul(M,ct),L=r.add(L,ct),z=r.mul(J,L),B=r.add(B,z),z=r.mul(P,L),E=r.mul(Pt,E),E=r.sub(E,z),z=r.mul(Pt,J),C=r.mul(P,C),C=r.add(C,z),new h(E,B,C)}subtract(d){return this.add(d.negate())}is0(){return this.equals(h.ZERO)}wNAF(d){return p.wNAFCached(this,c,d,m=>{let x=r.invertBatch(m.map(g=>g.pz));return m.map((g,b)=>g.toAffine(x[b])).map(h.fromAffine)})}multiplyUnsafe(d){let m=h.ZERO;if(d===Ye)return m;if(a(d),d===oe)return this;let{endo:x}=e;if(!x)return p.unsafeLadder(this,d);let{k1neg:g,k1:b,k2neg:A,k2:w}=x.splitScalar(d),E=m,B=m,C=this;for(;b>Ye||w>Ye;)b&oe&&(E=E.add(C)),w&oe&&(B=B.add(C)),C=C.double(),b>>=oe,w>>=oe;return g&&(E=E.negate()),A&&(B=B.negate()),B=new h(r.mul(B.px,x.beta),B.py,B.pz),E.add(B)}multiply(d){a(d);let m=d,x,g,{endo:b}=e;if(b){let{k1neg:A,k1:w,k2neg:E,k2:B}=b.splitScalar(m),{p:C,f:M}=this.wNAF(w),{p:H,f:z}=this.wNAF(B);C=p.constTimeNegate(A,C),H=p.constTimeNegate(E,H),H=new h(r.mul(H.px,b.beta),H.py,H.pz),x=C.add(H),g=M.add(z)}else{let{p:A,f:w}=this.wNAF(m);x=A,g=w}return h.normalizeZ([x,g])[0]}multiplyAndAddUnsafe(d,m,x){let g=h.BASE,b=(w,E)=>E===Ye||E===oe||!w.equals(g)?w.multiplyUnsafe(E):w.multiply(E),A=b(this,m).add(b(d,x));return A.is0()?void 0:A}toAffine(d){let{px:m,py:x,pz:g}=this,b=this.is0();d==null&&(d=b?r.ONE:r.inv(g));let A=r.mul(m,d),w=r.mul(x,d),E=r.mul(g,d);if(b)return{x:r.ZERO,y:r.ZERO};if(!r.eql(E,r.ONE))throw new Error("invZ was invalid");return{x:A,y:w}}isTorsionFree(){let{h:d,isTorsionFree:m}=e;if(d===oe)return!0;if(m)return m(h,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:d,clearCofactor:m}=e;return d===oe?this:m?m(h,this):this.multiplyUnsafe(e.h)}toRawBytes(d=!0){return this.assertValidity(),n(h,this,d)}toHex(d=!0){return Fe(this.toRawBytes(d))}}h.BASE=new h(e.Gx,e.Gy,r.ONE),h.ZERO=new h(r.ZERO,r.ONE,r.ZERO);let y=e.nBitLength,p=lo(h,e.endo?Math.ceil(y/2):y);return{CURVE:e,ProjectivePoint:h,normPrivateKeyToScalar:f,weierstrassEquation:o,isWithinCurveOrder:s}}function Qb(t){let e=si(t);return Te(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function gl(t){let e=Qb(t),{Fp:r,n}=e,i=r.BYTES+1,o=2*r.BYTES+1;function s(L){return Ye<L&&L<r.ORDER}function a(L){return ht(L,n)}function f(L){return uo(L,n)}let{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:h,isWithinCurveOrder:y}=Zb({...e,toBytes(L,P,_){let N=P.toAffine(),T=r.toBytes(N.x),O=Ke;return _?O(Uint8Array.from([P.hasEvenY()?2:3]),T):O(Uint8Array.from([4]),T,r.toBytes(N.y))},fromBytes(L){let P=L.length,_=L[0],N=L.subarray(1);if(P===i&&(_===2||_===3)){let T=Me(N);if(!s(T))throw new Error("Point is not on curve");let O=h(T),K=r.sqrt(O),q=(K&oe)===oe;return(_&1)===1!==q&&(K=r.neg(K)),{x:T,y:K}}else if(P===o&&_===4){let T=r.fromBytes(N.subarray(0,r.BYTES)),O=r.fromBytes(N.subarray(r.BYTES,2*r.BYTES));return{x:T,y:O}}else throw new Error(`Point of length ${P} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}}),p=L=>Fe(ur(L,e.nByteLength));function l(L){let P=n>>oe;return L>P}function d(L){return l(L)?a(-L):L}let m=(L,P,_)=>Me(L.slice(P,_));class x{constructor(P,_,N){this.r=P,this.s=_,this.recovery=N,this.assertValidity()}static fromCompact(P){let _=e.nByteLength;return P=wt("compactSignature",P,_*2),new x(m(P,0,_),m(P,_,2*_))}static fromDER(P){let{r:_,s:N}=Kr.toSig(wt("DER",P));return new x(_,N)}assertValidity(){if(!y(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!y(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(P){return new x(this.r,this.s,P)}recoverPublicKey(P){let{r:_,s:N,recovery:T}=this,O=B(wt("msgHash",P));if(T==null||![0,1,2,3].includes(T))throw new Error("recovery id invalid");let K=T===2||T===3?_+e.n:_;if(K>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let q=T&1?"03":"02",Q=c.fromHex(q+p(K)),j=f(K),st=a(-O*j),tt=a(N*j),nt=c.BASE.multiplyAndAddUnsafe(Q,st,tt);if(!nt)throw new Error("point at infinify");return nt.assertValidity(),nt}hasHighS(){return l(this.s)}normalizeS(){return this.hasHighS()?new x(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Lr(this.toDERHex())}toDERHex(){return Kr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Lr(this.toCompactHex())}toCompactHex(){return p(this.r)+p(this.s)}}let g={isValidPrivateKey(L){try{return u(L),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{let L=va(e.n);return ph(e.randomBytes(L),e.n)},precompute(L=8,P=c.BASE){return P._setWindowSize(L),P.multiply(BigInt(3)),P}};function b(L,P=!0){return c.fromPrivateKey(L).toRawBytes(P)}function A(L){let P=he(L),_=typeof L=="string",N=(P||_)&&L.length;return P?N===i||N===o:_?N===2*i||N===2*o:L instanceof c}function w(L,P,_=!0){if(A(L))throw new Error("first arg must be private key");if(!A(P))throw new Error("second arg must be public key");return c.fromHex(P).multiply(u(L)).toRawBytes(_)}let E=e.bits2int||function(L){let P=Me(L),_=L.length*8-e.nBitLength;return _>0?P>>BigInt(_):P},B=e.bits2int_modN||function(L){return a(E(L))},C=oi(e.nBitLength);function M(L){if(typeof L!="bigint")throw new Error("bigint expected");if(!(Ye<=L&&L<C))throw new Error(`bigint expected < 2^${e.nBitLength}`);return ur(L,e.nByteLength)}function H(L,P,_=z){if(["recovered","canonical"].some(gt=>gt in _))throw new Error("sign() legacy options not supported");let{hash:N,randomBytes:T}=e,{lowS:O,prehash:K,extraEntropy:q}=_;O==null&&(O=!0),L=wt("msgHash",L),K&&(L=wt("prehashed msgHash",N(L)));let Q=B(L),j=u(P),st=[M(j),M(Q)];if(q!=null){let gt=q===!0?T(r.BYTES):q;st.push(wt("extraEntropy",gt))}let tt=Ke(...st),nt=Q;function Bt(gt){let kt=E(gt);if(!y(kt))return;let Ut=f(kt),Tt=c.BASE.multiply(kt).toAffine(),Ft=a(Tt.x);if(Ft===Ye)return;let De=a(Ut*a(nt+Ft*j));if(De===Ye)return;let vr=(Tt.x===Ft?0:2)|Number(Tt.y&oe),zn=De;return O&&l(De)&&(zn=d(De),vr^=1),new x(Ft,zn,vr)}return{seed:tt,k2sig:Bt}}let z={lowS:e.lowS,prehash:!1},J={lowS:e.lowS,prehash:!1};function ct(L,P,_=z){let{seed:N,k2sig:T}=H(L,P,_),O=e;return ma(O.hash.outputLen,O.nByteLength,O.hmac)(N,T)}c.BASE._setWindowSize(8);function Pt(L,P,_,N=J){let T=L;if(P=wt("msgHash",P),_=wt("publicKey",_),"strict"in N)throw new Error("options.strict was renamed to lowS");let{lowS:O,prehash:K}=N,q,Q;try{if(typeof T=="string"||he(T))try{q=x.fromDER(T)}catch(Tt){if(!(Tt instanceof Kr.Err))throw Tt;q=x.fromCompact(T)}else if(typeof T=="object"&&typeof T.r=="bigint"&&typeof T.s=="bigint"){let{r:Tt,s:Ft}=T;q=new x(Tt,Ft)}else throw new Error("PARSE");Q=c.fromHex(_)}catch(Tt){if(Tt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(O&&q.hasHighS())return!1;K&&(P=e.hash(P));let{r:j,s:st}=q,tt=B(P),nt=f(st),Bt=a(tt*nt),gt=a(j*nt),kt=c.BASE.multiplyAndAddUnsafe(Q,Bt,gt)?.toAffine();return kt?a(kt.x)===j:!1}return{CURVE:e,getPublicKey:b,getSharedSecret:w,sign:ct,verify:Pt,ProjectivePoint:c,Signature:x,utils:g}}var Bo=class extends un{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,eh(e);let n=ii(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 fn(this),this.iHash.update(e),this}digestInto(e){fn(this),fa(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()}},p0=(t,e,r)=>new Bo(t,e).update(r).digest();p0.create=(t,e)=>new Bo(t,e);function Xb(t){return{hash:t,hmac:(e,...r)=>p0(t,e,oo(...r)),randomBytes:hn}}function bl(t,e){let r=n=>gl({...t,...Xb(n)});return Object.freeze({...r(e),create:r})}var El=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),vl=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Jb=BigInt(1),y0=BigInt(2),wl=(t,e)=>(t+e/y0)/e;function jb(t){let e=El,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),f=BigInt(88),c=t*t*t%e,u=c*c*t%e,h=xt(u,r,e)*u%e,y=xt(h,r,e)*u%e,p=xt(y,y0,e)*c%e,l=xt(p,i,e)*p%e,d=xt(l,o,e)*l%e,m=xt(d,a,e)*d%e,x=xt(m,f,e)*m%e,g=xt(x,a,e)*d%e,b=xt(g,r,e)*u%e,A=xt(b,s,e)*l%e,w=xt(A,n,e)*c%e,E=xt(w,y0,e);if(!m0.eql(m0.sqr(E),t))throw new Error("Cannot find square root");return E}var m0=ho(El,void 0,void 0,{sqrt:jb}),xe=bl({a:BigInt(0),b:BigInt(7),Fp:m0,n:vl,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=vl,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Jb*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),a=wl(o*t,e),f=wl(-n*t,e),c=ht(t-a*r-f*i,e),u=ht(-a*n-f*o,e),h=c>s,y=u>s;if(h&&(c=e-c),y&&(u=e-u),c>s||u>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:h,k1:c,k2neg:y,k2:u}}}},ml),mB=BigInt(0);var xB=xe.ProjectivePoint;function Sl(){return xe.utils.randomPrivateKey()}function Al(t,e){let r=Ot.digest(e instanceof Uint8Array?e:e.subarray());if(ie(r))return r.then(({digest:n})=>xe.sign(n,t).toDERRawBytes()).catch(n=>{throw new G(String(n),"ERR_INVALID_INPUT")});try{return xe.sign(r.digest,t).toDERRawBytes()}catch(n){throw new G(String(n),"ERR_INVALID_INPUT")}}function Bl(t,e,r){let n=Ot.digest(r instanceof Uint8Array?r:r.subarray());if(ie(n))return n.then(({digest:i})=>xe.verify(e,i,t)).catch(i=>{throw new G(String(i),"ERR_INVALID_INPUT")});try{return xe.verify(e,n.digest,t)}catch(i){throw new G(String(i),"ERR_INVALID_INPUT")}}function Il(t){return xe.ProjectivePoint.fromHex(t).toRawBytes(!0)}function Cl(t){try{xe.getPublicKey(t,!0)}catch(e){throw new G(String(e),"ERR_INVALID_PRIVATE_KEY")}}function x0(t){try{xe.ProjectivePoint.fromHex(t)}catch(e){throw new G(String(e),"ERR_INVALID_PUBLIC_KEY")}}function Tl(t){try{return xe.getPublicKey(t,!0)}catch(e){throw new G(String(e),"ERR_INVALID_PRIVATE_KEY")}}var vi=class{_key;constructor(e){x0(e),this._key=e}verify(e,r){return Bl(this._key,r,e)}marshal(){return Il(this._key)}get bytes(){return $e.encode({Type:Nt.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return Ce(this.bytes,e.bytes)}async hash(){let e=Ot.digest(this.bytes),r;return ie(e)?{bytes:r}=await e:r=e.bytes,r}},wi=class{_key;_publicKey;constructor(e,r){this._key=e,this._publicKey=r??Tl(e),Cl(this._key),x0(this._publicKey)}sign(e){return Al(this._key,e)}get public(){return new vi(this._publicKey)}marshal(){return this._key}get bytes(){return Ge.encode({Type:Nt.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return Ce(this.bytes,e.bytes)}hash(){let e=Ot.digest(this.bytes);return ie(e)?e.then(({bytes:r})=>r):e.bytes}async id(){let e=await this.public.hash();return jt(e,"base58btc")}async export(e,r="libp2p-key"){if(r==="libp2p-key")return yn(this.bytes,e);throw new G(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}};function ev(t){return new wi(t)}function rv(t){return new vi(t)}async function nv(){let t=Sl();return new wi(t)}var Rl={rsa:l0,ed25519:a0,secp256k1:g0};function ov(t){let e=Object.keys(Rl).join(" / ");return new G(`invalid or unsupported key type ${t}. Must be ${e}`,"ERR_UNSUPPORTED_KEY_TYPE")}function b0(t){if(t=t.toLowerCase(),t==="rsa"||t==="ed25519"||t==="secp256k1")return Rl[t];throw ov(t)}async function Ll(t,e){return b0(t).generateKeyPair(e??2048)}function Dl(t,e){return e=(e??"rsa").toLowerCase(),b0(e),t.bytes}function _l(t,e){return e=(e??"rsa").toLowerCase(),b0(e),t.bytes}function v0(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var B0={};F(B0,{base10:()=>hv});function sv(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,f=t.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";for(var d=0,m=0,x=0,g=l.length;x!==g&&l[x]===0;)x++,d++;for(var b=(g-x)*u+1>>>0,A=new Uint8Array(b);x!==g;){for(var w=l[x],E=0,B=b-1;(w!==0||E<m)&&B!==-1;B--,E++)w+=256*A[B]>>>0,A[B]=w%a>>>0,w=w/a>>>0;if(w!==0)throw new Error("Non-zero carry");m=E,x++}for(var C=b-m;C!==b&&A[C]===0;)C++;for(var M=f.repeat(d);C<b;++C)M+=t.charAt(A[C]);return M}function y(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;var d=0;if(l[d]!==" "){for(var m=0,x=0;l[d]===f;)m++,d++;for(var g=(l.length-d)*c+1>>>0,b=new Uint8Array(g);l[d];){var A=r[l.charCodeAt(d)];if(A===255)return;for(var w=0,E=g-1;(A!==0||w<x)&&E!==-1;E--,w++)A+=a*b[E]>>>0,b[E]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");x=w,d++}if(l[d]!==" "){for(var B=g-x;B!==g&&b[B]===0;)B++;for(var C=new Uint8Array(m+(g-B)),M=m;B!==g;)C[M++]=b[B++];return C}}}function p(l){var d=y(l);if(d)return d;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:y,decode:p}}var av=sv,cv=av,Nl=cv;var zB=new Uint8Array(0);var Pl=(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},Ze=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")};var kl=t=>new TextEncoder().encode(t),Ul=t=>new TextDecoder().decode(t);var w0=class{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")}},E0=class{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 Fl(this,e)}},S0=class{constructor(e){this.decoders=e}or(e){return Fl(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Fl=(t,e)=>new S0({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),A0=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new w0(e,r,n),this.decoder=new E0(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Bn=({name:t,prefix:e,encode:r,decode:n})=>new A0(t,e,r,n),yr=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=Nl(r,e);return Bn({prefix:t,name:e,encode:n,decode:o=>Ze(i(o))})},fv=(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,f=0,c=0;for(let u=0;u<o;++u){let h=i[t[u]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<r|h,a+=r,a>=8&&(a-=8,s[c++]=255&f>>a)}if(a>=r||255&f<<8-a)throw new SyntaxError("Unexpected end of data");return s},uv=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let f=0;f<t.length;++f)for(a=a<<8|t[f],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o},St=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Bn({prefix:e,name:t,encode(i){return uv(i,n,r)},decode(i){return fv(i,n,r,t)}});var hv=yr({prefix:"9",name:"base10",alphabet:"0123456789"});var I0={};F(I0,{base16:()=>lv,base16upper:()=>dv});var lv=St({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),dv=St({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var C0={};F(C0,{base2:()=>pv});var pv=St({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var T0={};F(T0,{base256emoji:()=>bv});var Ml=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}"),yv=Ml.reduce((t,e,r)=>(t[r]=e,t),[]),mv=Ml.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function xv(t){return t.reduce((e,r)=>(e+=yv[r],e),"")}function gv(t){let e=[];for(let r of t){let n=mv[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var bv=Bn({prefix:"\u{1F680}",name:"base256emoji",encode:xv,decode:gv});var R0={};F(R0,{base32:()=>In,base32hex:()=>Sv,base32hexpad:()=>Bv,base32hexpadupper:()=>Iv,base32hexupper:()=>Av,base32pad:()=>wv,base32padupper:()=>Ev,base32upper:()=>vv,base32z:()=>Cv});var In=St({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),vv=St({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),wv=St({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ev=St({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Sv=St({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Av=St({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Bv=St({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Iv=St({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Cv=St({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var L0={};F(L0,{base36:()=>Tv,base36upper:()=>Rv});var Tv=yr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Rv=yr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var D0={};F(D0,{base58btc:()=>Le,base58flickr:()=>Lv});var Le=yr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Lv=yr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var _0={};F(_0,{base64:()=>Dv,base64pad:()=>_v,base64url:()=>Nv,base64urlpad:()=>Pv});var Dv=St({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),_v=St({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Nv=St({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Pv=St({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var N0={};F(N0,{base8:()=>kv});var kv=St({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var P0={};F(P0,{identity:()=>Uv});var Uv=Bn({prefix:"\0",name:"identity",encode:t=>Ul(t),decode:t=>kl(t)});var nI=new TextEncoder,iI=new TextDecoder;var U0={};F(U0,{identity:()=>ow});var Mv=zl,Kl=128,Kv=127,Vv=~Kv,zv=Math.pow(2,31);function zl(t,e,r){e=e||[],r=r||0;for(var n=r;t>=zv;)e[r++]=t&255|Kl,t/=128;for(;t&Vv;)e[r++]=t&255|Kl,t>>>=7;return e[r]=t|0,zl.bytes=r-n+1,e}var qv=k0,Hv=128,Vl=127;function k0(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw k0.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&Vl)<<i:(s&Vl)*Math.pow(2,i),i+=7}while(s>=Hv);return k0.bytes=o-n,r}var $v=Math.pow(2,7),Gv=Math.pow(2,14),Wv=Math.pow(2,21),Yv=Math.pow(2,28),Zv=Math.pow(2,35),Qv=Math.pow(2,42),Xv=Math.pow(2,49),Jv=Math.pow(2,56),jv=Math.pow(2,63),tw=function(t){return t<$v?1:t<Gv?2:t<Wv?3:t<Yv?4:t<Zv?5:t<Qv?6:t<Xv?7:t<Jv?8:t<jv?9:10},ew={encode:Mv,decode:qv,encodingLength:tw},rw=ew,Ei=rw;var Si=(t,e=0)=>[Ei.decode(t,e),Ei.decode.bytes],Cn=(t,e,r=0)=>(Ei.encode(t,e,r),e),Tn=t=>Ei.encodingLength(t);var Vr=(t,e)=>{let r=e.byteLength,n=Tn(t),i=n+Tn(r),o=new Uint8Array(i+r);return Cn(t,o,0),Cn(r,o,n),o.set(e,i),new Rn(t,r,e,o)},ql=t=>{let e=Ze(t),[r,n]=Si(e),[i,o]=Si(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Rn(r,i,s,e)},Hl=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Pl(t.bytes,r.bytes)}},Rn=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var $l=0,nw="identity",Gl=Ze,iw=t=>Vr($l,Gl(t)),ow={code:$l,name:nw,encode:Gl,digest:iw};var M0={};F(M0,{sha256:()=>sw,sha512:()=>aw});var F0=({name:t,code:e,encode:r})=>new O0(t,e,r),O0=class{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?Vr(this.code,r):r.then(n=>Vr(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Yl=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),sw=F0({name:"sha2-256",code:18,encode:Yl("SHA-256")}),aw=F0({name:"sha2-512",code:19,encode:Yl("SHA-512")});var Zl=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return fw(r,K0(t),e||Le.encoder);default:return uw(r,K0(t),e||In.encoder)}};var Ql=new WeakMap,K0=t=>{let e=Ql.get(t);if(e==null){let r=new Map;return Ql.set(t,r),r}return e},Co=class t{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!==Bi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==hw)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=Vr(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&&e.code===n.code&&e.version===n.version&&Hl(e.multihash,n.multihash)}toString(e){return Zl(this,e)}toJSON(){return{"/":Zl(this)}}link(){return this}get[Symbol.toStringTag](){return"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||Xl(n,i,o.bytes))}else if(r[lw]===!0){let{version:n,multihash:i,code:o}=r,s=ql(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!==Bi)throw new Error(`Version 0 CID must use dag-pb (code: ${Bi}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=Xl(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,Bi,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=Ze(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 Rn(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[h,y]=Si(e.subarray(r));return r+=y,h},i=n(),o=Bi;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(),f=n(),c=r+f,u=c-s;return{version:i,codec:o,multihashCode:a,digestSize:f,multihashSize:u,size:c}}static parse(e,r){let[n,i]=cw(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 K0(o).set(n,e),o}},cw=(t,e)=>{switch(t[0]){case"Q":{let r=e||Le;return[Le.prefix,r.decode(`${Le.prefix}${t}`)]}case Le.prefix:{let r=e||Le;return[Le.prefix,r.decode(t)]}case In.prefix:{let r=e||In;return[In.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)]}}},fw=(t,e,r)=>{let{prefix:n}=r;if(n!==Le.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},uw=(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},Bi=112,hw=18,Xl=(t,e,r)=>{let n=Tn(t),i=n+Tn(e),o=new Uint8Array(i+r.byteLength);return Cn(t,o,0),Cn(e,o,n),o.set(r,i),o},lw=Symbol.for("@ipld/js-cid/CID");var V0={...P0,...C0,...N0,...B0,...I0,...R0,...L0,...D0,..._0,...T0},vI={...M0,...U0};function Jl(t=0){return globalThis.Buffer?.allocUnsafe!=null?v0(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function td(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var jl=td("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),z0=td("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=Jl(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),II={utf8:jl,"utf-8":jl,hex:V0.base16,latin1:z0,ascii:z0,binary:z0,...V0};var q0;(function(t){let e;t.codec=()=>(e==null&&(e=me((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=>ye(r,t.codec()),t.decode=r=>pe(r,t.codec())})(q0||(q0={}));var ed=async()=>{let t=await Ll("Ed25519"),e=await dw(t);if(e.type==="Ed25519")return e;throw new Error(`Generated unexpected PeerId type "${e.type}"`)};async function dw(t){return pf(Dl(t.public),_l(t))}var Y0={};F(Y0,{base58btc:()=>Zt,base58flickr:()=>bw});function pw(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,f=t.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";for(var d=0,m=0,x=0,g=l.length;x!==g&&l[x]===0;)x++,d++;for(var b=(g-x)*u+1>>>0,A=new Uint8Array(b);x!==g;){for(var w=l[x],E=0,B=b-1;(w!==0||E<m)&&B!==-1;B--,E++)w+=256*A[B]>>>0,A[B]=w%a>>>0,w=w/a>>>0;if(w!==0)throw new Error("Non-zero carry");m=E,x++}for(var C=b-m;C!==b&&A[C]===0;)C++;for(var M=f.repeat(d);C<b;++C)M+=t.charAt(A[C]);return M}function y(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;var d=0;if(l[d]!==" "){for(var m=0,x=0;l[d]===f;)m++,d++;for(var g=(l.length-d)*c+1>>>0,b=new Uint8Array(g);l[d];){var A=r[l.charCodeAt(d)];if(A===255)return;for(var w=0,E=g-1;(A!==0||w<x)&&E!==-1;E--,w++)A+=a*b[E]>>>0,b[E]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");x=w,d++}if(l[d]!==" "){for(var B=g-x;B!==g&&b[B]===0;)B++;for(var C=new Uint8Array(m+(g-B)),M=m;B!==g;)C[M++]=b[B++];return C}}}function p(l){var d=y(l);if(d)return d;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:y,decode:p}}var yw=pw,mw=yw,rd=mw;var qI=new Uint8Array(0);var nd=(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},Qe=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")};var id=t=>new TextEncoder().encode(t),od=t=>new TextDecoder().decode(t);var H0=class{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")}},$0=class{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 ad(this,e)}},G0=class{constructor(e){this.decoders=e}or(e){return ad(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},ad=(t,e)=>new G0({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),W0=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new H0(e,r,n),this.decoder=new $0(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Ln=({name:t,prefix:e,encode:r,decode:n})=>new W0(t,e,r,n),mr=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=rd(r,e);return Ln({prefix:t,name:e,encode:n,decode:o=>Qe(i(o))})},xw=(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,f=0,c=0;for(let u=0;u<o;++u){let h=i[t[u]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<r|h,a+=r,a>=8&&(a-=8,s[c++]=255&f>>a)}if(a>=r||255&f<<8-a)throw new SyntaxError("Unexpected end of data");return s},gw=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let f=0;f<t.length;++f)for(a=a<<8|t[f],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o},At=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Ln({prefix:e,name:t,encode(i){return gw(i,n,r)},decode(i){return xw(i,n,r,t)}});var Zt=mr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),bw=mr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Z0={};F(Z0,{base32:()=>Xe,base32hex:()=>Sw,base32hexpad:()=>Bw,base32hexpadupper:()=>Iw,base32hexupper:()=>Aw,base32pad:()=>ww,base32padupper:()=>Ew,base32upper:()=>vw,base32z:()=>Cw});var Xe=At({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),vw=At({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ww=At({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ew=At({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Sw=At({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Aw=At({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Bw=At({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Iw=At({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Cw=At({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Tw=ud,cd=128,Rw=127,Lw=~Rw,Dw=Math.pow(2,31);function ud(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Dw;)e[r++]=t&255|cd,t/=128;for(;t&Lw;)e[r++]=t&255|cd,t>>>=7;return e[r]=t|0,ud.bytes=r-n+1,e}var _w=Q0,Nw=128,fd=127;function Q0(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw Q0.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&fd)<<i:(s&fd)*Math.pow(2,i),i+=7}while(s>=Nw);return Q0.bytes=o-n,r}var Pw=Math.pow(2,7),kw=Math.pow(2,14),Uw=Math.pow(2,21),Ow=Math.pow(2,28),Fw=Math.pow(2,35),Mw=Math.pow(2,42),Kw=Math.pow(2,49),Vw=Math.pow(2,56),zw=Math.pow(2,63),qw=function(t){return t<Pw?1:t<kw?2:t<Uw?3:t<Ow?4:t<Fw?5:t<Mw?6:t<Kw?7:t<Vw?8:t<zw?9:10},Hw={encode:Tw,decode:_w,encodingLength:qw},$w=Hw,Ii=$w;var Ci=(t,e=0)=>[Ii.decode(t,e),Ii.decode.bytes],Dn=(t,e,r=0)=>(Ii.encode(t,e,r),e),_n=t=>Ii.encodingLength(t);var zr=(t,e)=>{let r=e.byteLength,n=_n(t),i=n+_n(r),o=new Uint8Array(i+r);return Dn(t,o,0),Dn(r,o,n),o.set(e,i),new Nn(t,r,e,o)},Ro=t=>{let e=Qe(t),[r,n]=Ci(e),[i,o]=Ci(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Nn(r,i,s,e)},hd=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&nd(t.bytes,r.bytes)}},Nn=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var ld=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return Ww(r,X0(t),e||Zt.encoder);default:return Yw(r,X0(t),e||Xe.encoder)}};var dd=new WeakMap,X0=t=>{let e=dd.get(t);if(e==null){let r=new Map;return dd.set(t,r),r}return e},xr=class t{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!==Ti)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Zw)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=zr(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&&e.code===n.code&&e.version===n.version&&hd(e.multihash,n.multihash)}toString(e){return ld(this,e)}toJSON(){return{"/":ld(this)}}link(){return this}get[Symbol.toStringTag](){return"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||pd(n,i,o.bytes))}else if(r[Qw]===!0){let{version:n,multihash:i,code:o}=r,s=Ro(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!==Ti)throw new Error(`Version 0 CID must use dag-pb (code: ${Ti}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=pd(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,Ti,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=Qe(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 Nn(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[h,y]=Ci(e.subarray(r));return r+=y,h},i=n(),o=Ti;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(),f=n(),c=r+f,u=c-s;return{version:i,codec:o,multihashCode:a,digestSize:f,multihashSize:u,size:c}}static parse(e,r){let[n,i]=Gw(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 X0(o).set(n,e),o}},Gw=(t,e)=>{switch(t[0]){case"Q":{let r=e||Zt;return[Zt.prefix,r.decode(`${Zt.prefix}${t}`)]}case Zt.prefix:{let r=e||Zt;return[Zt.prefix,r.decode(t)]}case Xe.prefix:{let r=e||Xe;return[Xe.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)]}}},Ww=(t,e,r)=>{let{prefix:n}=r;if(n!==Zt.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},Yw=(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},Ti=112,Zw=18,pd=(t,e,r)=>{let n=_n(t),i=n+_n(e),o=new Uint8Array(i+r.byteLength);return Dn(t,o,0),Dn(e,o,n),o.set(r,i),o},Qw=Symbol.for("@ipld/js-cid/CID");function Lo(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 Qt(t,e="utf8"){let r=vo[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)}var Xw=Math.pow(2,7),Jw=Math.pow(2,14),jw=Math.pow(2,21),J0=Math.pow(2,28),j0=Math.pow(2,35),tc=Math.pow(2,42),ec=Math.pow(2,49),ot=128,zt=127;function Xt(t){if(t<Xw)return 1;if(t<Jw)return 2;if(t<jw)return 3;if(t<J0)return 4;if(t<j0)return 5;if(t<tc)return 6;if(t<ec)return 7;if(Number.MAX_SAFE_INTEGER!=null&&t>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function t4(t,e,r=0){switch(Xt(t)){case 8:e[r++]=t&255|ot,t/=128;case 7:e[r++]=t&255|ot,t/=128;case 6:e[r++]=t&255|ot,t/=128;case 5:e[r++]=t&255|ot,t/=128;case 4:e[r++]=t&255|ot,t>>>=7;case 3:e[r++]=t&255|ot,t>>>=7;case 2:e[r++]=t&255|ot,t>>>=7;case 1:{e[r++]=t&255,t>>>=7;break}default:throw new Error("unreachable")}return e}function e4(t,e,r=0){switch(Xt(t)){case 8:e.set(r++,t&255|ot),t/=128;case 7:e.set(r++,t&255|ot),t/=128;case 6:e.set(r++,t&255|ot),t/=128;case 5:e.set(r++,t&255|ot),t/=128;case 4:e.set(r++,t&255|ot),t>>>=7;case 3:e.set(r++,t&255|ot),t>>>=7;case 2:e.set(r++,t&255|ot),t>>>=7;case 1:{e.set(r++,t&255),t>>>=7;break}default:throw new Error("unreachable")}return e}function r4(t,e){let r=t[e],n=0;if(n+=r&zt,r<ot||(r=t[e+1],n+=(r&zt)<<7,r<ot)||(r=t[e+2],n+=(r&zt)<<14,r<ot)||(r=t[e+3],n+=(r&zt)<<21,r<ot)||(r=t[e+4],n+=(r&zt)*J0,r<ot)||(r=t[e+5],n+=(r&zt)*j0,r<ot)||(r=t[e+6],n+=(r&zt)*tc,r<ot)||(r=t[e+7],n+=(r&zt)*ec,r<ot))return n;throw new RangeError("Could not decode varint")}function n4(t,e){let r=t.get(e),n=0;if(n+=r&zt,r<ot||(r=t.get(e+1),n+=(r&zt)<<7,r<ot)||(r=t.get(e+2),n+=(r&zt)<<14,r<ot)||(r=t.get(e+3),n+=(r&zt)<<21,r<ot)||(r=t.get(e+4),n+=(r&zt)*J0,r<ot)||(r=t.get(e+5),n+=(r&zt)*j0,r<ot)||(r=t.get(e+6),n+=(r&zt)*tc,r<ot)||(r=t.get(e+7),n+=(r&zt)*ec,r<ot))return n;throw new RangeError("Could not decode varint")}function gr(t,e,r=0){return e==null&&(e=Vt(Xt(t))),e instanceof Uint8Array?t4(t,e,r):e4(t,e,r)}function Je(t,e=0){return t instanceof Uint8Array?r4(t,e):n4(t,e)}function se(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 Pr(r)}var _o=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 f=a==="0",c=2**(8*i)-1;for(;;){let u=this.readAtomically(()=>{let h=this.readChar();if(h===void 0)return;let y=Number.parseInt(h,e);if(!Number.isNaN(y))return y});if(u===void 0)break;if(o*=e,o+=u,o>c||(s+=1,r!==void 0&&s>r))return}if(s!==0)return!n&&f&&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 yd=45,i4=15,kn=new _o;function rc(t){if(!(t.length>i4))return kn.new(t).parseWith(()=>kn.readIPv4Addr())}function nc(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>yd))return kn.new(t).parseWith(()=>kn.readIPv6Addr())}function No(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>yd))return kn.new(t).parseWith(()=>kn.readIPAddr())}var bC=parseInt("0xFFFF",16),vC=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var ic={};F(ic,{base10:()=>f4});var f4=mr({prefix:"9",name:"base10",alphabet:"0123456789"});var oc={};F(oc,{base16:()=>u4,base16upper:()=>h4});var u4=At({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),h4=At({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var sc={};F(sc,{base2:()=>l4});var l4=At({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ac={};F(ac,{base256emoji:()=>x4});var gd=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}"),d4=gd.reduce((t,e,r)=>(t[r]=e,t),[]),p4=gd.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function y4(t){return t.reduce((e,r)=>(e+=d4[r],e),"")}function m4(t){let e=[];for(let r of t){let n=p4[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var x4=Ln({prefix:"\u{1F680}",name:"base256emoji",encode:y4,decode:m4});var cc={};F(cc,{base36:()=>g4,base36upper:()=>b4});var g4=mr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),b4=mr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var fc={};F(fc,{base64:()=>v4,base64pad:()=>w4,base64url:()=>E4,base64urlpad:()=>S4});var v4=At({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),w4=At({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),E4=At({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),S4=At({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var uc={};F(uc,{base8:()=>A4});var A4=At({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var hc={};F(hc,{identity:()=>B4});var B4=Ln({prefix:"\0",name:"identity",encode:t=>od(t),decode:t=>id(t)});var XC=new TextEncoder,JC=new TextDecoder;var lc={};F(lc,{identity:()=>L4});var bd=0,T4="identity",vd=Qe,R4=t=>zr(bd,vd(t)),L4={code:bd,name:T4,encode:vd,digest:R4};var yc={};F(yc,{sha256:()=>D4,sha512:()=>_4});var pc=({name:t,code:e,encode:r})=>new dc(t,e,r),dc=class{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?zr(this.code,r):r.then(n=>zr(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Ed=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),D4=pc({name:"sha2-256",code:18,encode:Ed("SHA-256")}),_4=pc({name:"sha2-512",code:19,encode:Ed("SHA-512")});var Sd={...hc,...sc,...uc,...ic,...oc,...Z0,...cc,...Y0,...fc,...ac},sT={...yc,...lc};function Ad(t){return!!rc(t)}function Bd(t){return!!nc(t)}function Un(t){return!!No(t)}var Id=Ad,N4=Bd,mc=function(t){let e=0;if(t=t.toString().trim(),Id(t)){let r=new Uint8Array(e+4);return t.split(/\./g).forEach(n=>{r[e++]=parseInt(n,10)&255}),r}if(N4(t)){let r=t.split(":",8),n;for(n=0;n<r.length;n++){let o=Id(r[n]),s;o&&(s=mc(r[n]),r[n]=Qt(s.slice(0,2),"base16")),s!=null&&++n<8&&r.splice(n,0,Qt(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")},Cd=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 On={},xc={},k4=[[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"]];k4.forEach(t=>{let e=U4(...t);xc[e.code]=e,On[e.name]=e});function U4(t,e,r,n,i){return{code:t,size:e,name:r,resolvable:!!n,path:!!i}}function at(t){if(typeof t=="number"){if(xc[t]!=null)return xc[t];throw new Error(`no protocol with code: ${t}`)}else if(typeof t=="string"){if(On[t]!=null)return On[t];throw new Error(`no protocol with name: ${t}`)}throw new Error(`invalid protocol id type: ${typeof t}`)}var ST=at("ip4"),AT=at("ip6"),BT=at("ipcidr");function bc(t,e){switch(at(t).code){case 4:case 41:return F4(e);case 42:return Ld(e);case 6:case 273:case 33:case 132:return _d(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Ld(e);case 421:return z4(e);case 444:return Dd(e);case 445:return Dd(e);case 466:return V4(e);default:return Qt(e,"base16")}}function vc(t,e){switch(at(t).code){case 4:return Td(e);case 41:return Td(e);case 42:return Rd(e);case 6:case 273:case 33:case 132:return wc(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Rd(e);case 421:return M4(e);case 444:return q4(e);case 445:return H4(e);case 466:return K4(e);default:return hi(e,"base16")}}var gc=Object.values(Sd).map(t=>t.decoder),O4=function(){let t=gc[0].or(gc[1]);return gc.slice(2).forEach(e=>t=t.or(e)),t}();function Td(t){if(!Un(t))throw new Error("invalid ip address");return mc(t)}function F4(t){let e=Cd(t,0,t.length);if(e==null)throw new Error("ipBuff is required");if(!Un(e))throw new Error("invalid ip address");return e}function wc(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t),new Uint8Array(e)}function _d(t){return new DataView(t.buffer).getUint16(t.byteOffset)}function Rd(t){let e=hi(t),r=Uint8Array.from(gr(e.length));return se([r,e],r.length+e.length)}function Ld(t){let e=Je(t);if(t=t.slice(Xt(e)),t.length!==e)throw new Error("inconsistent lengths");return Qt(t)}function M4(t){let e;t[0]==="Q"||t[0]==="1"?e=Ro(Zt.decode(`z${t}`)).bytes:e=xr.parse(t).multihash.bytes;let r=Uint8Array.from(gr(e.length));return se([r,e],r.length+e.length)}function K4(t){let e=O4.decode(t),r=Uint8Array.from(gr(e.length));return se([r,e],r.length+e.length)}function V4(t){let e=Je(t),r=t.slice(Xt(e));if(r.length!==e)throw new Error("inconsistent lengths");return"u"+Qt(r,"base64url")}function z4(t){let e=Je(t),r=t.slice(Xt(e));if(r.length!==e)throw new Error("inconsistent lengths");return Qt(r,"base58btc")}function q4(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=Xe.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=wc(n);return se([r,i],r.length+i.length)}function H4(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=Xe.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=wc(n);return se([r,i],r.length+i.length)}function Dd(t){let e=t.slice(0,t.length-2),r=t.slice(t.length-2),n=Qt(e,"base32"),i=_d(r);return`${n}:${i}`}function Nd(t){t=Ec(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=at(s);if(a.size===0){e.push([a.code]),r.push([a.code]);continue}if(o++,o>=i.length)throw kd("invalid address: "+t);if(a.path===!0){n=Ec(i.slice(o).join("/")),e.push([a.code,vc(a.code,n)]),r.push([a.code,n]);break}let f=vc(a.code,i[o]);e.push([a.code,f]),r.push([a.code,bc(a.code,f)])}return{string:Pd(r),bytes:Ac(e),tuples:e,stringTuples:r,path:n}}function Sc(t){let e=[],r=[],n=null,i=0;for(;i<t.length;){let o=Je(t,i),s=Xt(o),a=at(o),f=$4(a,t.slice(i+s));if(f===0){e.push([o]),r.push([o]),i+=s;continue}let c=t.slice(i+s,i+s+f);if(i+=f+s,i>t.length)throw kd("Invalid address Uint8Array: "+Qt(t,"base16"));e.push([o,c]);let u=bc(o,c);if(r.push([o,u]),a.path===!0){n=u;break}}return{bytes:Uint8Array.from(t),string:Pd(r),tuples:e,stringTuples:r,path:n}}function Pd(t){let e=[];return t.map(r=>{let n=at(r[0]);return e.push(n.name),r.length>1&&r[1]!=null&&e.push(r[1]),null}),Ec(e.join("/"))}function Ac(t){return se(t.map(e=>{let r=at(e[0]),n=Uint8Array.from(gr(r.code));return e.length>1&&e[1]!=null&&(n=se([n,e[1]])),n}))}function $4(t,e){if(t.size>0)return t.size/8;if(t.size===0)return 0;{let r=Je(e instanceof Uint8Array?e:Uint8Array.from(e));return r+Xt(r)}}function Ec(t){return"/"+t.trim().split("/").filter(e=>e).join("/")}function kd(t){return new Error("Error parsing address: "+t)}var G4=Symbol.for("nodejs.util.inspect.custom"),Bc=Symbol.for("@multiformats/js-multiaddr/multiaddr"),W4=[at("dns").code,at("dns4").code,at("dns6").code,at("dnsaddr").code],Po=class t{bytes;#e;#t;#r;#n;[Bc]=!0;constructor(e){e==null&&(e="");let r;if(e instanceof Uint8Array)r=Sc(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);r=Nd(e)}else if(Od(e))r=Sc(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=at("tcp"),a=at("udp"),f=at("ip4"),c=at("ip6"),u=at("dns6"),h=at("ip6zone");for(let[p,l]of this.stringTuples())p===h.code&&(o=`%${l??""}`),W4.includes(p)&&(r=s.name,i=443,n=`${l??""}${o}`,e=p===u.code?6:4),(p===s.code||p===a.code)&&(r=at(p).name,i=parseInt(l??"")),(p===f.code||p===c.code)&&(r=at(p).name,n=`${l??""}${o}`,e=p===c.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({},at(e)))}protoCodes(){return this.#t.map(([e])=>e)}protoNames(){return this.#t.map(([e])=>at(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(Ac(r.slice(0,n)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([n,i])=>{n===On.p2p.code&&e.push([n,i]),n===On["p2p-circuit"].code&&(e=[])});let r=e.pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?Qt(Zt.decode(`z${n}`),"base58btc"):Qt(xr.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(e){return Lo(this.bytes,e.bytes)}async resolve(e){let r=this.protos().find(o=>o.resolvable);if(r==null)return[this];let n=Ud.get(r.name);if(n==null)throw new G(`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)}[G4](){return`Multiaddr(${this.#e})`}};var Ud=new Map;function Od(t){return!!t?.[Bc]}function ko(t){return new Po(t)}function Y4(t){return t[Symbol.asyncIterator]!=null}function Z4(t){if(Y4(t))return(async()=>{for await(let e of t)return e})();for(let e of t)return e}var Ic=Z4;var Md=Symbol.for("@achingbrain/uint8arraylist");function Fd(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 Uo(t){return!!t?.[Md]}var Fn=class t{bufs;length;[Md]=!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(Uo(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(Uo(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=Fd(this.bufs,e);return r.buf[r.index]}set(e,r){let n=Fd(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(Uo(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 se(n,i)}subarray(e,r){let{bufs:n,length:i}=this._subList(e,r);return n.length===1?n[0]:se(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,f=a+s.byteLength;if(i=f,e>=f)continue;let c=e>=a&&e<f,u=r>a&&r<=f;if(c&&u){if(e===a&&r===f){n.push(s);break}let h=e-a;n.push(s.subarray(h,h+(r-e)));break}if(c){if(e===0){n.push(s);continue}n.push(s.subarray(e-a));continue}if(u){if(r===f){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(!Uo(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 h=0;h<o;h++)s[h]=-1;for(let h=0;h<i;h++)s[n[h]]=h;let a=s,f=this.byteLength-n.byteLength,c=n.byteLength-1,u;for(let h=r;h<=f;h+=u){u=0;for(let y=c;y>=0;y--){let p=this.get(h+y);if(n[y]!==p){u=Math.max(1,y-a[p]);break}}if(u===0)return h}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=qe(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=qe(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=qe(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=qe(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=qe(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=qe(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=qe(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=qe(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(!Lo(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 Oo(t){return t[Symbol.asyncIterator]!=null}var Fo=t=>{let e=Xt(t),r=Vt(e);return gr(t,r),Fo.bytes=e,r};Fo.bytes=0;function Ri(t,e){e=e??{};let r=e.lengthEncoder??Fo;function*n(i){let o=r(i.byteLength);o instanceof Uint8Array?yield o:yield*o,i instanceof Uint8Array?yield i:yield*i}return Oo(t)?async function*(){for await(let i of t)yield*n(i)}():function*(){for(let i of t)yield*n(i)}()}Ri.single=(t,e)=>{e=e??{};let r=e.lengthEncoder??Fo;return new Fn(r(t.byteLength),t)};var Mn=Mt(zd(),1);var X4=8,J4=1024*1024*4,qr;(function(t){t[t.LENGTH=0]="LENGTH",t[t.DATA=1]="DATA"})(qr||(qr={}));var Cc=t=>{let e=Je(t);return Cc.bytes=Xt(e),e};Cc.bytes=0;function Kn(t,e){let r=new Fn,n=qr.LENGTH,i=-1,o=e?.lengthDecoder??Cc,s=e?.maxLengthLength??X4,a=e?.maxDataLength??J4;function*f(){for(;r.byteLength>0;){if(n===qr.LENGTH)try{if(i=o(r),i<0)throw(0,Mn.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(i>a)throw(0,Mn.default)(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let c=o.bytes;r.consume(c),e?.onLength!=null&&e.onLength(i),n=qr.DATA}catch(c){if(c instanceof RangeError){if(r.byteLength>s)throw(0,Mn.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw c}if(n===qr.DATA){if(r.byteLength<i)break;let c=r.sublist(0,i);r.consume(i),e?.onData!=null&&e.onData(c),yield c,n=qr.LENGTH}}}return Oo(t)?async function*(){for await(let c of t)r.append(c),yield*f();if(r.byteLength>0)throw(0,Mn.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}():function*(){for(let c of t)r.append(c),yield*f();if(r.byteLength>0)throw(0,Mn.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}Kn.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 Kn(n,{...e??{},onLength:o=>{r=o}})};function t8(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 qd=t8;function e8(t){return t[Symbol.asyncIterator]!=null}function r8(t,e){if(e8(t))return async function*(){for await(let a of t)yield e(a)}();let r=qd(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 Hd=r8;function je(){let t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}var Mo=globalThis.CustomEvent??Event;async function*Tc(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=je(),a=je(),f=!1,c,u=!1;i.addEventListener("task-complete",()=>{a.resolve()}),Promise.resolve().then(async()=>{try{for await(let l of t){if(o.length===r&&(s=je(),await s.promise),u)break;let d={done:!1};o.push(d),l().then(m=>{d.done=!0,d.ok=!0,d.value=m,i.dispatchEvent(new Mo("task-complete"))},m=>{d.done=!0,d.err=m,i.dispatchEvent(new Mo("task-complete"))})}f=!0,i.dispatchEvent(new Mo("task-complete"))}catch(l){c=l,i.dispatchEvent(new Mo("task-complete"))}});function h(){return n?o[0]?.done:!!o.find(l=>l.done)}function*y(){for(;o.length>0&&o[0].done;){let l=o[0];if(o.shift(),l.ok)yield l.value;else throw u=!0,s.resolve(),l.err;s.resolve()}}function*p(){for(;h();)for(let l=0;l<o.length;l++)if(o[l].done){let d=o[l];if(o.splice(l,1),l--,d.ok)yield d.value;else throw u=!0,s.resolve(),d.err;s.resolve()}}for(;;){if(h()||(a=je(),await a.promise),c!=null)throw c;if(n?yield*y():yield*p(),f&&o.length===0)break}}var Ko=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}},Vn=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new Ko(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 Ko(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 Rc=class extends Error{type;code;constructor(e,r){super(e??"The operation was aborted"),this.type="aborted",this.code=r??"ABORT_ERR"}};function Vo(t={}){return n8(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 n8(t,e){e=e??{};let r=e.onEnd,n=new Vn,i,o,s,a=je(),f=async()=>{try{return n.isEmpty()?s?{done:!0}:await new Promise((m,x)=>{o=g=>{o=null,n.push(g);try{m(t(n))}catch(b){x(b)}return i}}):t(n)}finally{n.isEmpty()&&queueMicrotask(()=>{a.resolve(),a=je()})}},c=m=>o!=null?o(m):(n.push(m),i),u=m=>(n=new Vn,o!=null?o({error:m}):(n.push({error:m}),i)),h=m=>{if(s)return i;if(e?.objectMode!==!0&&m?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return c({done:!1,value:m})},y=m=>s?i:(s=!0,m!=null?u(m):c({done:!0})),p=()=>(n=new Vn,y(),{done:!0}),l=m=>(y(m),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:f,return:p,throw:l,push:h,end:y,get readableLength(){return n.size},onEmpty:async m=>{let x=m?.signal;if(x?.throwIfAborted(),n.isEmpty())return;let g,b;x!=null&&(g=new Promise((A,w)=>{b=()=>{w(new Rc)},x.addEventListener("abort",b)}));try{await Promise.race([a.promise,g])}finally{b!=null&&x!=null&&x?.removeEventListener("abort",b)}}},r==null)return i;let d=i;return i={[Symbol.asyncIterator](){return this},next(){return d.next()},throw(m){return d.throw(m),r!=null&&(r(m),r=void 0),{done:!0}},return(){return d.return(),r!=null&&(r(),r=void 0),{done:!0}},push:h,end(m){return d.end(m),r!=null&&(r(m),r=void 0),i},get readableLength(){return d.readableLength},onEmpty:m=>d.onEmpty(m)},i}function i8(t){return t[Symbol.asyncIterator]!=null}function o8(...t){let e=[];for(let r of t)i8(r)||e.push(r);return e.length===t.length?function*(){for(let r of e)yield*r}():async function*(){let r=Vo({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 $d=o8;function Dc(t,...e){if(t==null)throw new Error("Empty pipeline");if(Lc(t)){let n=t;t=()=>n.source}else if(Wd(t)||Gd(t)){let n=t;t=()=>n}let r=[t,...e];if(r.length>1&&Lc(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++)Lc(r[n])&&(r[n]=a8(r[n]));return s8(...r)}var s8=(...t)=>{let e;for(;t.length>0;)e=t.shift()(e);return e},Gd=t=>t?.[Symbol.asyncIterator]!=null,Wd=t=>t?.[Symbol.iterator]!=null,Lc=t=>t==null?!1:t.sink!=null&&t.source!=null,a8=t=>e=>{let r=t.sink(e);if(r?.then!=null){let n=Vo({objectMode:!0});r.then(()=>{n.end()},s=>{n.end(s)});let i,o=t.source;if(Gd(o))i=async function*(){yield*o,n.end()};else if(Wd(o))i=function*(){yield*o,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return $d(n,i())}return t.source};var tp=Mt(Yd(),1);var Zd="[a-fA-F\\d:]",br=t=>t&&t.includeBoundaries?`(?:(?<=\\s|^)(?=${Zd})|(?<=${Zd})(?=\\s|$))`:"",ge="(?: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}",Ct="[a-fA-F\\d]{1,4}",zo=`
|
|
16
16
|
(?:
|
|
17
|
-
(?:${
|
|
18
|
-
(?:${
|
|
19
|
-
(?:${
|
|
20
|
-
(?:${
|
|
21
|
-
(?:${
|
|
22
|
-
(?:${
|
|
23
|
-
(?:${
|
|
24
|
-
(?::(?:(?::${
|
|
17
|
+
(?:${Ct}:){7}(?:${Ct}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
|
|
18
|
+
(?:${Ct}:){6}(?:${ge}|:${Ct}|:)| // 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
|
|
19
|
+
(?:${Ct}:){5}(?::${ge}|(?::${Ct}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
|
|
20
|
+
(?:${Ct}:){4}(?:(?::${Ct}){0,1}:${ge}|(?::${Ct}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
|
|
21
|
+
(?:${Ct}:){3}(?:(?::${Ct}){0,2}:${ge}|(?::${Ct}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
|
|
22
|
+
(?:${Ct}:){2}(?:(?::${Ct}){0,3}:${ge}|(?::${Ct}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
|
|
23
|
+
(?:${Ct}:){1}(?:(?::${Ct}){0,4}:${ge}|(?::${Ct}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
|
|
24
|
+
(?::(?:(?::${Ct}){0,5}:${ge}|(?::${Ct}){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(),Uy=new RegExp(`(?:^${pe}$)|(?:^${Pi}$)`),Oy=new RegExp(`^${pe}$`),Ky=new RegExp(`^${Pi}$`),Ys=t=>t&&t.exact?Uy:new RegExp(`(?:${nr(t)}${pe}${nr(t)})|(?:${nr(t)}${Pi}${nr(t)})`,"g");Ys.v4=t=>t&&t.exact?Oy:new RegExp(`${nr(t)}${pe}${nr(t)}`,"g");Ys.v6=t=>t&&t.exact?Ky:new RegExp(`${nr(t)}${Pi}${nr(t)}`,"g");var Xc=Ys;var ru=Ut(jc(),1),{isValid:Fy,parse:My}=ru.default,Vy=["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"],qy=Vy.map(t=>new eu.Netmask(t));function Hy(t){for(let e of qy)if(e.contains(t))return!0;return!1}function tu(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 nu=t=>{if(Fy(t)){let e=My(t);if(e.kind()==="ipv4")return Hy(e.toNormalizedString());if(e.kind()==="ipv6")return tu(t)}else if(Zr(t)&&Xc.v6().test(t))return tu(t)};var Zs=nu;var iu="libp2p",ou="autonat",su="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=()=>zr(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=()=>zr(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 Qs=4,Ni=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??iu}/${ou}/${su}`,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",Oi))};r.addEventListener("abort",n,{once:!0}),Fi(1/0,r);let i=this.components.addressManager.getAddresses().map(o=>o.toOptions().host);try{let o=this;await Ws(e.stream,s=>jr(s),async function*(s){let a=await Vs(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=Pn(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=>Ii(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=!(Zs(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=>Cn(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!(Zs(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);Fi(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 dc()).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",Oi))},n.addEventListener("abort",p,{once:!0});let y=await Ws([o],x=>Cn(x),h,x=>jr(x),async x=>Vs(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 zs($c(this.components.peerRouting.getClosestPeers(a,{signal:n}),p=>async()=>u(p)),{concurrency:Qs}))try{if(l==null)continue;let p=l.addr==null?r[0]:Ii(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===Qs){this.log("%a is externally dialable",p),e.confirmObservedAddr(p);return}if(c[d].failure===Qs){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 Zy(t={}){return e=>new Ni(e,t)}return vu(Qy);})();
|
|
26
|
+
`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),c8=new RegExp(`(?:^${ge}$)|(?:^${zo}$)`),f8=new RegExp(`^${ge}$`),u8=new RegExp(`^${zo}$`),_c=t=>t&&t.exact?c8:new RegExp(`(?:${br(t)}${ge}${br(t)})|(?:${br(t)}${zo}${br(t)})`,"g");_c.v4=t=>t&&t.exact?f8:new RegExp(`${br(t)}${ge}${br(t)}`,"g");_c.v6=t=>t&&t.exact?u8:new RegExp(`${br(t)}${zo}${br(t)}`,"g");var Qd=_c;var ep=Mt(Jd(),1),{isValid:h8,parse:l8}=ep.default,d8=["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"],p8=d8.map(t=>new tp.Netmask(t));function y8(t){for(let e of p8)if(e.contains(t))return!0;return!1}function jd(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 rp=t=>{if(h8(t)){let e=l8(t);if(e.kind()==="ipv4")return y8(e.toNormalizedString());if(e.kind()==="ipv6")return jd(t)}else if(Un(t)&&Qd.v6().test(t))return jd(t)};var Nc=rp;var np="libp2p",ip="autonat",op="1.0.0";var Z;(function(t){let e;(function(c){c.DIAL="DIAL",c.DIAL_RESPONSE="DIAL_RESPONSE"})(e=t.MessageType||(t.MessageType={}));let r;(function(c){c[c.DIAL=0]="DIAL",c[c.DIAL_RESPONSE=1]="DIAL_RESPONSE"})(r||(r={})),function(c){c.codec=()=>En(r)}(e=t.MessageType||(t.MessageType={}));let n;(function(c){c.OK="OK",c.E_DIAL_ERROR="E_DIAL_ERROR",c.E_DIAL_REFUSED="E_DIAL_REFUSED",c.E_BAD_REQUEST="E_BAD_REQUEST",c.E_INTERNAL_ERROR="E_INTERNAL_ERROR"})(n=t.ResponseStatus||(t.ResponseStatus={}));let i;(function(c){c[c.OK=0]="OK",c[c.E_DIAL_ERROR=100]="E_DIAL_ERROR",c[c.E_DIAL_REFUSED=101]="E_DIAL_REFUSED",c[c.E_BAD_REQUEST=200]="E_BAD_REQUEST",c[c.E_INTERNAL_ERROR=300]="E_INTERNAL_ERROR"})(i||(i={})),function(c){c.codec=()=>En(i)}(n=t.ResponseStatus||(t.ResponseStatus={}));let o;(function(c){let u;c.codec=()=>(u==null&&(u=me((h,y,p={})=>{if(p.lengthDelimited!==!1&&y.fork(),h.id!=null&&(y.uint32(10),y.bytes(h.id)),h.addrs!=null)for(let l of h.addrs)y.uint32(18),y.bytes(l);p.lengthDelimited!==!1&&y.ldelim()},(h,y)=>{let p={addrs:[]},l=y==null?h.len:h.pos+y;for(;h.pos<l;){let d=h.uint32();switch(d>>>3){case 1:p.id=h.bytes();break;case 2:p.addrs.push(h.bytes());break;default:h.skipType(d&7);break}}return p})),u),c.encode=h=>ye(h,c.codec()),c.decode=h=>pe(h,c.codec())})(o=t.PeerInfo||(t.PeerInfo={}));let s;(function(c){let u;c.codec=()=>(u==null&&(u=me((h,y,p={})=>{p.lengthDelimited!==!1&&y.fork(),h.peer!=null&&(y.uint32(10),t.PeerInfo.codec().encode(h.peer,y)),p.lengthDelimited!==!1&&y.ldelim()},(h,y)=>{let p={},l=y==null?h.len:h.pos+y;for(;h.pos<l;){let d=h.uint32();switch(d>>>3){case 1:p.peer=t.PeerInfo.codec().decode(h,h.uint32());break;default:h.skipType(d&7);break}}return p})),u),c.encode=h=>ye(h,c.codec()),c.decode=h=>pe(h,c.codec())})(s=t.Dial||(t.Dial={}));let a;(function(c){let u;c.codec=()=>(u==null&&(u=me((h,y,p={})=>{p.lengthDelimited!==!1&&y.fork(),h.status!=null&&(y.uint32(8),t.ResponseStatus.codec().encode(h.status,y)),h.statusText!=null&&(y.uint32(18),y.string(h.statusText)),h.addr!=null&&(y.uint32(26),y.bytes(h.addr)),p.lengthDelimited!==!1&&y.ldelim()},(h,y)=>{let p={},l=y==null?h.len:h.pos+y;for(;h.pos<l;){let d=h.uint32();switch(d>>>3){case 1:p.status=t.ResponseStatus.codec().decode(h);break;case 2:p.statusText=h.string();break;case 3:p.addr=h.bytes();break;default:h.skipType(d&7);break}}return p})),u),c.encode=h=>ye(h,c.codec()),c.decode=h=>pe(h,c.codec())})(a=t.DialResponse||(t.DialResponse={}));let f;t.codec=()=>(f==null&&(f=me((c,u,h={})=>{h.lengthDelimited!==!1&&u.fork(),c.type!=null&&(u.uint32(8),t.MessageType.codec().encode(c.type,u)),c.dial!=null&&(u.uint32(18),t.Dial.codec().encode(c.dial,u)),c.dialResponse!=null&&(u.uint32(26),t.DialResponse.codec().encode(c.dialResponse,u)),h.lengthDelimited!==!1&&u.ldelim()},(c,u)=>{let h={},y=u==null?c.len:c.pos+u;for(;c.pos<y;){let p=c.uint32();switch(p>>>3){case 1:h.type=t.MessageType.codec().decode(c);break;case 2:h.dial=t.Dial.codec().decode(c,c.uint32());break;case 3:h.dialResponse=t.DialResponse.codec().decode(c,c.uint32());break;default:c.skipType(p&7);break}}return h})),f),t.encode=c=>ye(c,t.codec()),t.decode=c=>pe(c,t.codec())})(Z||(Z={}));var Pc=4,Ho=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??np}/${ip}/${op}`,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 G("handleIncomingAutonatStream timeout",Go))};r.addEventListener("abort",n,{once:!0}),Yo(1/0,r);let i=this.components.addressManager.getAddresses().map(o=>o.toOptions().host);try{let o=this;await Dc(e.stream,s=>Kn(s),async function*(s){let a=await Ic(s);if(a==null){o.log("no message received"),yield Z.encode({type:Z.MessageType.DIAL_RESPONSE,dialResponse:{status:Z.ResponseStatus.E_BAD_REQUEST,statusText:"No message was sent"}});return}let f;try{f=Z.decode(a)}catch(d){o.log.error("could not decode message",d),yield Z.encode({type:Z.MessageType.DIAL_RESPONSE,dialResponse:{status:Z.ResponseStatus.E_BAD_REQUEST,statusText:"Could not decode message"}});return}let c=f.dial;if(c==null){o.log.error("dial was missing from message"),yield Z.encode({type:Z.MessageType.DIAL_RESPONSE,dialResponse:{status:Z.ResponseStatus.E_BAD_REQUEST,statusText:"No Dial message found in message"}});return}let u,h=c.peer;if(h==null||h.id==null){o.log.error("PeerId missing from message"),yield Z.encode({type:Z.MessageType.DIAL_RESPONSE,dialResponse:{status:Z.ResponseStatus.E_BAD_REQUEST,statusText:"missing peer info"}});return}try{u=Pi(h.id)}catch(d){o.log.error("invalid PeerId",d),yield Z.encode({type:Z.MessageType.DIAL_RESPONSE,dialResponse:{status:Z.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 Z.encode({type:Z.MessageType.DIAL_RESPONSE,dialResponse:{status:Z.ResponseStatus.E_BAD_REQUEST,statusText:"peer id mismatch"}});return}let y=h.addrs.map(d=>ko(d)).filter(d=>{let m=d.toOptions().host===e.connection.remoteAddr.toOptions().host;return o.log.trace("request to dial %a was sent from %a is same host %s",d,e.connection.remoteAddr,m),m}).filter(d=>{let m=d.toOptions().host,x=!(Nc(m)??!1);return o.log.trace("host %s was public %s",m,x),x}).filter(d=>{let m=d.toOptions().host,x=!i.includes(m);return o.log.trace("host %s was not our host %s",m,x),x}).filter(d=>{let m=!!o.components.transportManager.transportForMultiaddr(d);return o.log.trace("transport for %a is supported %s",d,m),m}).map(d=>(d.getPeerId()==null&&(d=d.encapsulate(`/p2p/${u.toString()}`)),d));if(y.length===0){o.log("no valid multiaddrs for %p in message",u),yield Z.encode({type:Z.MessageType.DIAL_RESPONSE,dialResponse:{status:Z.ResponseStatus.E_DIAL_REFUSED,statusText:"no dialable addresses"}});return}o.log("dial multiaddrs %s for peer %p",y.map(d=>d.toString()).join(", "),u);let p="",l=y[0];for await(let d of y){let m;l=d;try{if(m=await o.components.connectionManager.openConnection(d,{signal:r}),!m.remoteAddr.equals(d))throw o.log.error("tried to dial %a but dialed %a",d,m.remoteAddr),new Error("Unexpected remote address");o.log("Success %p",u),yield Z.encode({type:Z.MessageType.DIAL_RESPONSE,dialResponse:{status:Z.ResponseStatus.OK,addr:m.remoteAddr.decapsulateCode(at("p2p").code).bytes}});return}catch(x){o.log("could not dial %p",u,x),p=x.message}finally{m!=null&&await m.close()}}yield Z.encode({type:Z.MessageType.DIAL_RESPONSE,dialResponse:{status:Z.ResponseStatus.E_DIAL_ERROR,statusText:p,addr:l.bytes}})},s=>Ri(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!(Nc(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);Yo(1/0,n);let i=this;try{this.log("verify multiaddrs %s",r.map(h=>h.toString()).join(", "));let o=Z.encode({type:Z.MessageType.DIAL,dial:{peer:{id:this.components.peerId.toBytes(),addrs:r.map(h=>h.bytes)}}}),a=(await ed()).toBytes(),f={},c=[],u=async h=>{let y=()=>{};try{this.log("asking %p to verify multiaddr",h.id);let p=await i.components.connectionManager.openConnection(h.id,{signal:n}),l=await p.newStream(this.protocol,{signal:n});y=()=>{l.abort(new G("verifyAddress timeout",Go))},n.addEventListener("abort",y,{once:!0});let d=await Dc([o],x=>Ri(x),l,x=>Kn(x),async x=>Ic(x));if(d==null){this.log("no response received from %p",p.remotePeer);return}let m=Z.decode(d);if(m.type!==Z.MessageType.DIAL_RESPONSE||m.dialResponse==null){this.log("invalid autonat response from %p",p.remotePeer);return}if(m.dialResponse.status===Z.ResponseStatus.OK){let x=p.remoteAddr.toOptions(),g;if(x.family===4)g=x.host.split(".")[0];else if(x.family===6)g=x.host.split(":")[0];else{this.log('remote address "%s" was not IP4 or IP6?',x.host);return}if(c.includes(g)){this.log("already have response from network segment %d - %s",g,x.host);return}c.push(g)}return m.dialResponse}catch(p){this.log.error("error asking remote to verify multiaddr",p)}finally{n.removeEventListener("abort",y)}};for await(let h of Tc(Hd(this.components.peerRouting.getClosestPeers(a,{signal:n}),y=>async()=>u(y)),{concurrency:Pc}))try{if(h==null)continue;let y=h.addr==null?r[0]:ko(h.addr);if(this.log("autonat response for %a is %s",y,h.status),h.status===Z.ResponseStatus.E_BAD_REQUEST||h.status===Z.ResponseStatus.E_DIAL_REFUSED||h.addr==null&&r.length>1)continue;if(!r.some(l=>l.equals(y))){this.log("peer reported %a as %s but it was not in our observed address list",y,h.status);continue}let p=y.toString();if(f[p]==null&&(f[p]={success:0,failure:0}),h.status===Z.ResponseStatus.OK?f[p].success++:h.status===Z.ResponseStatus.E_DIAL_ERROR&&f[p].failure++,f[p].success===Pc){this.log("%a is externally dialable",y),e.confirmObservedAddr(y);return}if(f[p].failure===Pc){this.log("%a is not externally dialable",y),e.removeObservedAddr(y);return}}catch(y){this.log.error("could not verify external address",y)}}finally{this.verifyAddressTimeout=setTimeout(this._verifyExternalAddresses,this.refreshInterval)}}};function w8(t={}){return e=>new Ho(e,t)}return bp(E8);})();
|
|
27
27
|
/*! Bundled license information:
|
|
28
28
|
|
|
29
29
|
@noble/hashes/esm/utils.js:
|