@reown/walletkit 1.1.0-canary-1 → 1.1.1-canary-ca-0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(Ut,Ot){typeof exports=="object"&&typeof module<"u"?Ot(exports):typeof define=="function"&&define.amd?define(["exports"],Ot):(Ut=typeof globalThis<"u"?globalThis:Ut||self,Ot(Ut["@reown/walletkit"]={}))})(this,function(Ut){"use strict";var Ot=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ba(r){var e=r.default;if(typeof e=="function"){var t=function(){return e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var n=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return r[i]}})}),t}var Ft={exports:{}},sn=typeof Reflect=="object"?Reflect:null,If=sn&&typeof sn.apply=="function"?sn.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},As;sn&&typeof sn.ownKeys=="function"?As=sn.ownKeys:Object.getOwnPropertySymbols?As=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:As=function(e){return Object.getOwnPropertyNames(e)};function xl(r){console&&console.warn&&console.warn(r)}var Rf=Number.isNaN||function(e){return e!==e};function st(){st.init.call(this)}Ft.exports=st,Ft.exports.once=Ml,st.EventEmitter=st,st.prototype._events=void 0,st.prototype._eventsCount=0,st.prototype._maxListeners=void 0;var Of=10;function Ss(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(st,"defaultMaxListeners",{enumerable:!0,get:function(){return Of},set:function(r){if(typeof r!="number"||r<0||Rf(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");Of=r}}),st.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},st.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Rf(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Nf(r){return r._maxListeners===void 0?st.defaultMaxListeners:r._maxListeners}st.prototype.getMaxListeners=function(){return Nf(this)},st.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var n=e==="error",s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var f=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw f.context=o,f}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")If(u,this,t);else for(var h=u.length,p=Lf(u,h),i=0;i<h;++i)If(p[i],this,t);return!0};function Cf(r,e,t,i){var n,s,o;if(Ss(t),s=r._events,s===void 0?(s=r._events=Object.create(null),r._eventsCount=0):(s.newListener!==void 0&&(r.emit("newListener",e,t.listener?t.listener:t),s=r._events),o=s[e]),o===void 0)o=s[e]=t,++r._eventsCount;else if(typeof o=="function"?o=s[e]=i?[t,o]:[o,t]:i?o.unshift(t):o.push(t),n=Nf(r),n>0&&o.length>n&&!o.warned){o.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=r,f.type=e,f.count=o.length,xl(f)}return r}st.prototype.addListener=function(e,t){return Cf(this,e,t,!1)},st.prototype.on=st.prototype.addListener,st.prototype.prependListener=function(e,t){return Cf(this,e,t,!0)};function Al(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Pf(r,e,t){var i={fired:!1,wrapFn:void 0,target:r,type:e,listener:t},n=Al.bind(i);return n.listener=t,i.wrapFn=n,n}st.prototype.once=function(e,t){return Ss(t),this.on(e,Pf(this,e,t)),this},st.prototype.prependOnceListener=function(e,t){return Ss(t),this.prependListener(e,Pf(this,e,t)),this},st.prototype.removeListener=function(e,t){var i,n,s,o,f;if(Ss(t),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(s=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){f=i[o].listener,s=o;break}if(s<0)return this;s===0?i.shift():Sl(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,f||t)}return this},st.prototype.off=st.prototype.removeListener,st.prototype.removeAllListeners=function(e){var t,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),o;for(n=0;n<s.length;++n)o=s[n],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=i[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this};function Tf(r,e,t){var i=r._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?t?[n.listener||n]:[n]:t?Dl(n):Lf(n,n.length)}st.prototype.listeners=function(e){return Tf(this,e,!0)},st.prototype.rawListeners=function(e){return Tf(this,e,!1)},st.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):Bf.call(r,e)},st.prototype.listenerCount=Bf;function Bf(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}st.prototype.eventNames=function(){return this._eventsCount>0?As(this._events):[]};function Lf(r,e){for(var t=new Array(e),i=0;i<e;++i)t[i]=r[i];return t}function Sl(r,e){for(;e+1<r.length;e++)r[e]=r[e+1];r.pop()}function Dl(r){for(var e=new Array(r.length),t=0;t<e.length;++t)e[t]=r[t].listener||r[t];return e}function Ml(r,e){return new Promise(function(t,i){function n(o){r.removeListener(e,s),i(o)}function s(){typeof r.removeListener=="function"&&r.removeListener("error",n),t([].slice.call(arguments))}Uf(r,e,s,{once:!0}),e!=="error"&&Il(r,n,{once:!0})})}function Il(r,e,t){typeof r.on=="function"&&Uf(r,"error",e,t)}function Uf(r,e,t,i){if(typeof r.on=="function")i.once?r.once(e,t):r.on(e,t);else if(typeof r.addEventListener=="function")r.addEventListener(e,function n(s){i.once&&r.removeEventListener(e,n),t(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof r)}const Ff="wc",Rl=2,La="WalletKit",Ol=`${Ff}@2:${La}:`,Nl={database:":memory:"},Cl="request";var ae={};/*! *****************************************************************************
1
+ (function(Lt,Bt){typeof exports=="object"&&typeof module<"u"?Bt(exports):typeof define=="function"&&define.amd?define(["exports"],Bt):(Lt=typeof globalThis<"u"?globalThis:Lt||self,Bt(Lt["@reown/walletkit"]={}))})(this,function(Lt){"use strict";var Bt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function If(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}),r}var Nf={exports:{}},Os=typeof Reflect=="object"?Reflect:null,du=Os&&typeof Os.apply=="function"?Os.apply:function(e,r,i){return Function.prototype.apply.call(e,r,i)},Of;Os&&typeof Os.ownKeys=="function"?Of=Os.ownKeys:Object.getOwnPropertySymbols?Of=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Of=function(e){return Object.getOwnPropertyNames(e)};function U2(t){console&&console.warn&&console.warn(t)}var lu=Number.isNaN||function(e){return e!==e};function ut(){ut.init.call(this)}Nf.exports=ut,Nf.exports.once=k2,ut.EventEmitter=ut,ut.prototype._events=void 0,ut.prototype._eventsCount=0,ut.prototype._maxListeners=void 0;var pu=10;function Rf(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ut,"defaultMaxListeners",{enumerable:!0,get:function(){return pu},set:function(t){if(typeof t!="number"||t<0||lu(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");pu=t}}),ut.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ut.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||lu(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function bu(t){return t._maxListeners===void 0?ut.defaultMaxListeners:t._maxListeners}ut.prototype.getMaxListeners=function(){return bu(this)},ut.prototype.emit=function(e){for(var r=[],i=1;i<arguments.length;i++)r.push(arguments[i]);var n=e==="error",s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var h=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw h.context=o,h}var l=s[e];if(l===void 0)return!1;if(typeof l=="function")du(l,this,r);else for(var p=l.length,w=wu(l,p),i=0;i<p;++i)du(w[i],this,r);return!0};function vu(t,e,r,i){var n,s,o;if(Rf(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),n=bu(t),n>0&&o.length>n&&!o.warned){o.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=o.length,U2(h)}return t}ut.prototype.addListener=function(e,r){return vu(this,e,r,!1)},ut.prototype.on=ut.prototype.addListener,ut.prototype.prependListener=function(e,r){return vu(this,e,r,!0)};function $2(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function gu(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=$2.bind(i);return n.listener=r,i.wrapFn=n,n}ut.prototype.once=function(e,r){return Rf(r),this.on(e,gu(this,e,r)),this},ut.prototype.prependOnceListener=function(e,r){return Rf(r),this.prependListener(e,gu(this,e,r)),this},ut.prototype.removeListener=function(e,r){var i,n,s,o,h;if(Rf(r),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===r||i.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||r));else if(typeof i!="function"){for(s=-1,o=i.length-1;o>=0;o--)if(i[o]===r||i[o].listener===r){h=i[o].listener,s=o;break}if(s<0)return this;s===0?i.shift():q2(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,h||r)}return this},ut.prototype.off=ut.prototype.removeListener,ut.prototype.removeAllListeners=function(e){var r,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),o;for(n=0;n<s.length;++n)o=s[n],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=i[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(n=r.length-1;n>=0;n--)this.removeListener(e,r[n]);return this};function mu(t,e,r){var i=t._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?r?[n.listener||n]:[n]:r?z2(n):wu(n,n.length)}ut.prototype.listeners=function(e){return mu(this,e,!0)},ut.prototype.rawListeners=function(e){return mu(this,e,!1)},ut.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):yu.call(t,e)},ut.prototype.listenerCount=yu;function yu(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}ut.prototype.eventNames=function(){return this._eventsCount>0?Of(this._events):[]};function wu(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function q2(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function z2(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function k2(t,e){return new Promise(function(r,i){function n(o){t.removeListener(e,s),i(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",n),r([].slice.call(arguments))}_u(t,e,s,{once:!0}),e!=="error"&&K2(t,n,{once:!0})})}function K2(t,e,r){typeof t.on=="function"&&_u(t,"error",e,r)}function _u(t,e,r,i){if(typeof t.on=="function")i.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function n(s){i.once&&t.removeEventListener(e,n),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}const xu="wc",H2=2,E0="WalletKit",j2=`${xu}@2:${E0}:`,G2={database:":memory:"},V2="request",Au={completed:"completed",pending:"pending",error:"error"},Rs={not_required:"not_required",available:"available",error:"error"};var Or={exports:{}},Cs=typeof Reflect=="object"?Reflect:null,Mu=Cs&&typeof Cs.apply=="function"?Cs.apply:function(e,r,i){return Function.prototype.apply.call(e,r,i)},Cf;Cs&&typeof Cs.ownKeys=="function"?Cf=Cs.ownKeys:Object.getOwnPropertySymbols?Cf=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Cf=function(e){return Object.getOwnPropertyNames(e)};function Y2(t){console&&console.warn&&console.warn(t)}var Eu=Number.isNaN||function(e){return e!==e};function dt(){dt.init.call(this)}Or.exports=dt,Or.exports.once=X2,dt.EventEmitter=dt,dt.prototype._events=void 0,dt.prototype._eventsCount=0,dt.prototype._maxListeners=void 0;var Su=10;function Pf(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(dt,"defaultMaxListeners",{enumerable:!0,get:function(){return Su},set:function(t){if(typeof t!="number"||t<0||Eu(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Su=t}}),dt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},dt.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Eu(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Du(t){return t._maxListeners===void 0?dt.defaultMaxListeners:t._maxListeners}dt.prototype.getMaxListeners=function(){return Du(this)},dt.prototype.emit=function(e){for(var r=[],i=1;i<arguments.length;i++)r.push(arguments[i]);var n=e==="error",s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var h=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw h.context=o,h}var l=s[e];if(l===void 0)return!1;if(typeof l=="function")Mu(l,this,r);else for(var p=l.length,w=Cu(l,p),i=0;i<p;++i)Mu(w[i],this,r);return!0};function Iu(t,e,r,i){var n,s,o;if(Pf(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),n=Du(t),n>0&&o.length>n&&!o.warned){o.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=o.length,Y2(h)}return t}dt.prototype.addListener=function(e,r){return Iu(this,e,r,!1)},dt.prototype.on=dt.prototype.addListener,dt.prototype.prependListener=function(e,r){return Iu(this,e,r,!0)};function J2(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Nu(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=J2.bind(i);return n.listener=r,i.wrapFn=n,n}dt.prototype.once=function(e,r){return Pf(r),this.on(e,Nu(this,e,r)),this},dt.prototype.prependOnceListener=function(e,r){return Pf(r),this.prependListener(e,Nu(this,e,r)),this},dt.prototype.removeListener=function(e,r){var i,n,s,o,h;if(Pf(r),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===r||i.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||r));else if(typeof i!="function"){for(s=-1,o=i.length-1;o>=0;o--)if(i[o]===r||i[o].listener===r){h=i[o].listener,s=o;break}if(s<0)return this;s===0?i.shift():W2(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,h||r)}return this},dt.prototype.off=dt.prototype.removeListener,dt.prototype.removeAllListeners=function(e){var r,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),o;for(n=0;n<s.length;++n)o=s[n],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=i[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(n=r.length-1;n>=0;n--)this.removeListener(e,r[n]);return this};function Ou(t,e,r){var i=t._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?r?[n.listener||n]:[n]:r?Q2(n):Cu(n,n.length)}dt.prototype.listeners=function(e){return Ou(this,e,!0)},dt.prototype.rawListeners=function(e){return Ou(this,e,!1)},dt.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Ru.call(t,e)},dt.prototype.listenerCount=Ru;function Ru(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}dt.prototype.eventNames=function(){return this._eventsCount>0?Cf(this._events):[]};function Cu(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function W2(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Q2(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function X2(t,e){return new Promise(function(r,i){function n(o){t.removeListener(e,s),i(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",n),r([].slice.call(arguments))}Pu(t,e,s,{once:!0}),e!=="error"&&Z2(t,n,{once:!0})})}function Z2(t,e,r){typeof t.on=="function"&&Pu(t,"error",e,r)}function Pu(t,e,r,i){if(typeof t.on=="function")i.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function n(s){i.once&&t.removeEventListener(e,n),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var ze={};/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -11,23 +11,23 @@
11
11
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
12
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
13
  PERFORMANCE OF THIS SOFTWARE.
14
- ***************************************************************************** */var Ua=function(r,e){return Ua=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Ua(r,e)};function Pl(r,e){Ua(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Fa=function(){return Fa=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},Fa.apply(this,arguments)};function Tl(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}function Bl(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var f=r.length-1;f>=0;f--)(o=r[f])&&(s=(n<3?o(s):n>3?o(e,t,s):o(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}function Ll(r,e){return function(t,i){e(t,i,r)}}function Ul(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function Fl(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function f(p){try{h(i.next(p))}catch(y){o(y)}}function u(p){try{h(i.throw(p))}catch(y){o(y)}}function h(p){p.done?s(p.value):n(p.value).then(f,u)}h((i=i.apply(r,e||[])).next())})}function ql(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,o;return o={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function f(h){return function(p){return u([h,p])}}function u(h){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=h[0]&2?n.return:h[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,h[1])).done)return s;switch(n=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,n=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){t.label=h[1];break}if(h[0]===6&&t.label<s[1]){t.label=s[1],s=h;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(h);break}s[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(r,t)}catch(p){h=[6,p],n=0}finally{i=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function $l(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}function zl(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function qa(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function qf(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(f){o={error:f}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return s}function Kl(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(qf(arguments[e]));return r}function kl(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var i=Array(r),n=0,e=0;e<t;e++)for(var s=arguments[e],o=0,f=s.length;o<f;o++,n++)i[n]=s[o];return i}function Tn(r){return this instanceof Tn?(this.v=r,this):new Tn(r)}function jl(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(r,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(M){i[M]&&(n[M]=function(D){return new Promise(function(I,C){s.push([M,D,I,C])>1||f(M,D)})})}function f(M,D){try{u(i[M](D))}catch(I){y(s[0][3],I)}}function u(M){M.value instanceof Tn?Promise.resolve(M.value.v).then(h,p):y(s[0][2],M)}function h(M){f("next",M)}function p(M){f("throw",M)}function y(M,D){M(D),s.shift(),s.length&&f(s[0][0],s[0][1])}}function Vl(r){var e,t;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=r[n]?function(o){return(t=!t)?{value:Tn(r[n](o)),done:n==="return"}:s?s(o):o}:s}}function Hl(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof qa=="function"?qa(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(s){t[s]=r[s]&&function(o){return new Promise(function(f,u){o=r[s](o),n(f,u,o.done,o.value)})}}function n(s,o,f,u){Promise.resolve(u).then(function(h){s({value:h,done:f})},o)}}function Gl(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function Yl(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function Wl(r){return r&&r.__esModule?r:{default:r}}function Jl(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function Ql(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var Xl=Object.freeze({__proto__:null,__extends:Pl,get __assign(){return Fa},__rest:Tl,__decorate:Bl,__param:Ll,__metadata:Ul,__awaiter:Fl,__generator:ql,__createBinding:$l,__exportStar:zl,__values:qa,__read:qf,__spread:Kl,__spreadArrays:kl,__await:Tn,__asyncGenerator:jl,__asyncDelegator:Vl,__asyncValues:Hl,__makeTemplateObject:Gl,__importStar:Yl,__importDefault:Wl,__classPrivateFieldGet:Jl,__classPrivateFieldSet:Ql}),Ds=Ba(Xl),$a={},Bn={},$f;function Zl(){if($f)return Bn;$f=1,Object.defineProperty(Bn,"__esModule",{value:!0}),Bn.delay=void 0;function r(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}return Bn.delay=r,Bn}var Pi={},za={},Ti={},zf;function e0(){return zf||(zf=1,Object.defineProperty(Ti,"__esModule",{value:!0}),Ti.ONE_THOUSAND=Ti.ONE_HUNDRED=void 0,Ti.ONE_HUNDRED=100,Ti.ONE_THOUSAND=1e3),Ti}var Ka={},Kf;function t0(){return Kf||(Kf=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ONE_YEAR=r.FOUR_WEEKS=r.THREE_WEEKS=r.TWO_WEEKS=r.ONE_WEEK=r.THIRTY_DAYS=r.SEVEN_DAYS=r.FIVE_DAYS=r.THREE_DAYS=r.ONE_DAY=r.TWENTY_FOUR_HOURS=r.TWELVE_HOURS=r.SIX_HOURS=r.THREE_HOURS=r.ONE_HOUR=r.SIXTY_MINUTES=r.THIRTY_MINUTES=r.TEN_MINUTES=r.FIVE_MINUTES=r.ONE_MINUTE=r.SIXTY_SECONDS=r.THIRTY_SECONDS=r.TEN_SECONDS=r.FIVE_SECONDS=r.ONE_SECOND=void 0,r.ONE_SECOND=1,r.FIVE_SECONDS=5,r.TEN_SECONDS=10,r.THIRTY_SECONDS=30,r.SIXTY_SECONDS=60,r.ONE_MINUTE=r.SIXTY_SECONDS,r.FIVE_MINUTES=r.ONE_MINUTE*5,r.TEN_MINUTES=r.ONE_MINUTE*10,r.THIRTY_MINUTES=r.ONE_MINUTE*30,r.SIXTY_MINUTES=r.ONE_MINUTE*60,r.ONE_HOUR=r.SIXTY_MINUTES,r.THREE_HOURS=r.ONE_HOUR*3,r.SIX_HOURS=r.ONE_HOUR*6,r.TWELVE_HOURS=r.ONE_HOUR*12,r.TWENTY_FOUR_HOURS=r.ONE_HOUR*24,r.ONE_DAY=r.TWENTY_FOUR_HOURS,r.THREE_DAYS=r.ONE_DAY*3,r.FIVE_DAYS=r.ONE_DAY*5,r.SEVEN_DAYS=r.ONE_DAY*7,r.THIRTY_DAYS=r.ONE_DAY*30,r.ONE_WEEK=r.SEVEN_DAYS,r.TWO_WEEKS=r.ONE_WEEK*2,r.THREE_WEEKS=r.ONE_WEEK*3,r.FOUR_WEEKS=r.ONE_WEEK*4,r.ONE_YEAR=r.ONE_DAY*365}(Ka)),Ka}var kf;function jf(){return kf||(kf=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Ds;e.__exportStar(e0(),r),e.__exportStar(t0(),r)}(za)),za}var Vf;function r0(){if(Vf)return Pi;Vf=1,Object.defineProperty(Pi,"__esModule",{value:!0}),Pi.fromMiliseconds=Pi.toMiliseconds=void 0;const r=jf();function e(i){return i*r.ONE_THOUSAND}Pi.toMiliseconds=e;function t(i){return Math.floor(i/r.ONE_THOUSAND)}return Pi.fromMiliseconds=t,Pi}var Hf;function i0(){return Hf||(Hf=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Ds;e.__exportStar(Zl(),r),e.__exportStar(r0(),r)}($a)),$a}var an={},Gf;function n0(){if(Gf)return an;Gf=1,Object.defineProperty(an,"__esModule",{value:!0}),an.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(t){if(this.timestamps.has(t))throw new Error(`Watch already started for label: ${t}`);this.timestamps.set(t,{started:Date.now()})}stop(t){const i=this.get(t);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${t}`);const n=Date.now()-i.started;this.timestamps.set(t,{started:i.started,elapsed:n})}get(t){const i=this.timestamps.get(t);if(typeof i>"u")throw new Error(`No timestamp found for label: ${t}`);return i}elapsed(t){const i=this.get(t);return i.elapsed||Date.now()-i.started}}return an.Watch=r,an.default=r,an}var ka={},Ln={},Yf;function s0(){if(Yf)return Ln;Yf=1,Object.defineProperty(Ln,"__esModule",{value:!0}),Ln.IWatch=void 0;class r{}return Ln.IWatch=r,Ln}var Wf;function a0(){return Wf||(Wf=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),Ds.__exportStar(s0(),r)}(ka)),ka}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Ds;e.__exportStar(i0(),r),e.__exportStar(n0(),r),e.__exportStar(a0(),r),e.__exportStar(jf(),r)})(ae);class Bi{}class o0 extends Bi{constructor(e){super()}}const Jf=ae.FIVE_SECONDS,on={pulse:"heartbeat_pulse"};class ja extends o0{constructor(e){super(e),this.events=new Ft.exports.EventEmitter,this.interval=Jf,this.interval=e?.interval||Jf}static async init(e){const t=new ja(e);return await t.init(),t}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),ae.toMiliseconds(this.interval))}pulse(){this.events.emit(on.pulse)}}const f0=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,c0=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,h0=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function u0(r,e){if(r==="__proto__"||r==="constructor"&&e&&typeof e=="object"&&"prototype"in e){d0(r);return}return e}function d0(r){console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`)}function Ms(r,e={}){if(typeof r!="string")return r;const t=r.trim();if(r[0]==='"'&&r.endsWith('"')&&!r.includes("\\"))return t.slice(1,-1);if(t.length<=9){const i=t.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;if(i==="undefined")return;if(i==="null")return null;if(i==="nan")return Number.NaN;if(i==="infinity")return Number.POSITIVE_INFINITY;if(i==="-infinity")return Number.NEGATIVE_INFINITY}if(!h0.test(r)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return r}try{if(f0.test(r)||c0.test(r)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(r,u0)}return JSON.parse(r)}catch(i){if(e.strict)throw i;return r}}function l0(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function _t(r,...e){try{return l0(r(...e))}catch(t){return Promise.reject(t)}}function p0(r){const e=typeof r;return r===null||e!=="object"&&e!=="function"}function g0(r){const e=Object.getPrototypeOf(r);return!e||e.isPrototypeOf(Object)}function Is(r){if(p0(r))return String(r);if(g0(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return Is(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Qf(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const Va="base64:";function v0(r){if(typeof r=="string")return r;Qf();const e=Buffer.from(r).toString("base64");return Va+e}function b0(r){return typeof r!="string"||!r.startsWith(Va)?r:(Qf(),Buffer.from(r.slice(Va.length),"base64"))}function Jt(r){return r?r.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function m0(...r){return Jt(r.join(":"))}function Rs(r){return r=Jt(r),r?r+":":""}function o4(r){return r}const y0="memory",w0=()=>{const r=new Map;return{name:y0,getInstance:()=>r,hasItem(e){return r.has(e)},getItem(e){return r.get(e)??null},getItemRaw(e){return r.get(e)??null},setItem(e,t){r.set(e,t)},setItemRaw(e,t){r.set(e,t)},removeItem(e){r.delete(e)},getKeys(){return[...r.keys()]},clear(){r.clear()},dispose(){r.clear()}}};function _0(r={}){const e={mounts:{"":r.driver||w0()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},t=h=>{for(const p of e.mountpoints)if(h.startsWith(p))return{base:p,relativeKey:h.slice(p.length),driver:e.mounts[p]};return{base:"",relativeKey:h,driver:e.mounts[""]}},i=(h,p)=>e.mountpoints.filter(y=>y.startsWith(h)||p&&h.startsWith(y)).map(y=>({relativeBase:h.length>y.length?h.slice(y.length):void 0,mountpoint:y,driver:e.mounts[y]})),n=(h,p)=>{if(e.watching){p=Jt(p);for(const y of e.watchListeners)y(h,p)}},s=async()=>{if(!e.watching){e.watching=!0;for(const h in e.mounts)e.unwatch[h]=await Xf(e.mounts[h],n,h)}},o=async()=>{if(e.watching){for(const h in e.unwatch)await e.unwatch[h]();e.unwatch={},e.watching=!1}},f=(h,p,y)=>{const M=new Map,D=I=>{let C=M.get(I.base);return C||(C={driver:I.driver,base:I.base,items:[]},M.set(I.base,C)),C};for(const I of h){const C=typeof I=="string",K=Jt(C?I:I.key),j=C?void 0:I.value,B=C||!I.options?p:{...p,...I.options},k=t(K);D(k).items.push({key:K,value:j,relativeKey:k.relativeKey,options:B})}return Promise.all([...M.values()].map(I=>y(I))).then(I=>I.flat())},u={hasItem(h,p={}){h=Jt(h);const{relativeKey:y,driver:M}=t(h);return _t(M.hasItem,y,p)},getItem(h,p={}){h=Jt(h);const{relativeKey:y,driver:M}=t(h);return _t(M.getItem,y,p).then(D=>Ms(D))},getItems(h,p){return f(h,p,y=>y.driver.getItems?_t(y.driver.getItems,y.items.map(M=>({key:M.relativeKey,options:M.options})),p).then(M=>M.map(D=>({key:m0(y.base,D.key),value:Ms(D.value)}))):Promise.all(y.items.map(M=>_t(y.driver.getItem,M.relativeKey,M.options).then(D=>({key:M.key,value:Ms(D)})))))},getItemRaw(h,p={}){h=Jt(h);const{relativeKey:y,driver:M}=t(h);return M.getItemRaw?_t(M.getItemRaw,y,p):_t(M.getItem,y,p).then(D=>b0(D))},async setItem(h,p,y={}){if(p===void 0)return u.removeItem(h);h=Jt(h);const{relativeKey:M,driver:D}=t(h);D.setItem&&(await _t(D.setItem,M,Is(p),y),D.watch||n("update",h))},async setItems(h,p){await f(h,p,async y=>{if(y.driver.setItems)return _t(y.driver.setItems,y.items.map(M=>({key:M.relativeKey,value:Is(M.value),options:M.options})),p);y.driver.setItem&&await Promise.all(y.items.map(M=>_t(y.driver.setItem,M.relativeKey,Is(M.value),M.options)))})},async setItemRaw(h,p,y={}){if(p===void 0)return u.removeItem(h,y);h=Jt(h);const{relativeKey:M,driver:D}=t(h);if(D.setItemRaw)await _t(D.setItemRaw,M,p,y);else if(D.setItem)await _t(D.setItem,M,v0(p),y);else return;D.watch||n("update",h)},async removeItem(h,p={}){typeof p=="boolean"&&(p={removeMeta:p}),h=Jt(h);const{relativeKey:y,driver:M}=t(h);M.removeItem&&(await _t(M.removeItem,y,p),(p.removeMeta||p.removeMata)&&await _t(M.removeItem,y+"$",p),M.watch||n("remove",h))},async getMeta(h,p={}){typeof p=="boolean"&&(p={nativeOnly:p}),h=Jt(h);const{relativeKey:y,driver:M}=t(h),D=Object.create(null);if(M.getMeta&&Object.assign(D,await _t(M.getMeta,y,p)),!p.nativeOnly){const I=await _t(M.getItem,y+"$",p).then(C=>Ms(C));I&&typeof I=="object"&&(typeof I.atime=="string"&&(I.atime=new Date(I.atime)),typeof I.mtime=="string"&&(I.mtime=new Date(I.mtime)),Object.assign(D,I))}return D},setMeta(h,p,y={}){return this.setItem(h+"$",p,y)},removeMeta(h,p={}){return this.removeItem(h+"$",p)},async getKeys(h,p={}){h=Rs(h);const y=i(h,!0);let M=[];const D=[];for(const I of y){const C=await _t(I.driver.getKeys,I.relativeBase,p);for(const K of C){const j=I.mountpoint+Jt(K);M.some(B=>j.startsWith(B))||D.push(j)}M=[I.mountpoint,...M.filter(K=>!K.startsWith(I.mountpoint))]}return h?D.filter(I=>I.startsWith(h)&&I[I.length-1]!=="$"):D.filter(I=>I[I.length-1]!=="$")},async clear(h,p={}){h=Rs(h),await Promise.all(i(h,!1).map(async y=>{if(y.driver.clear)return _t(y.driver.clear,y.relativeBase,p);if(y.driver.removeItem){const M=await y.driver.getKeys(y.relativeBase||"",p);return Promise.all(M.map(D=>y.driver.removeItem(D,p)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(h=>Zf(h)))},async watch(h){return await s(),e.watchListeners.push(h),async()=>{e.watchListeners=e.watchListeners.filter(p=>p!==h),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(h,p){if(h=Rs(h),h&&e.mounts[h])throw new Error(`already mounted at ${h}`);return h&&(e.mountpoints.push(h),e.mountpoints.sort((y,M)=>M.length-y.length)),e.mounts[h]=p,e.watching&&Promise.resolve(Xf(p,n,h)).then(y=>{e.unwatch[h]=y}).catch(console.error),u},async unmount(h,p=!0){h=Rs(h),!(!h||!e.mounts[h])&&(e.watching&&h in e.unwatch&&(e.unwatch[h](),delete e.unwatch[h]),p&&await Zf(e.mounts[h]),e.mountpoints=e.mountpoints.filter(y=>y!==h),delete e.mounts[h])},getMount(h=""){h=Jt(h)+":";const p=t(h);return{driver:p.driver,base:p.base}},getMounts(h="",p={}){return h=Jt(h),i(h,p.parents).map(M=>({driver:M.driver,base:M.mountpoint}))},keys:(h,p={})=>u.getKeys(h,p),get:(h,p={})=>u.getItem(h,p),set:(h,p,y={})=>u.setItem(h,p,y),has:(h,p={})=>u.hasItem(h,p),del:(h,p={})=>u.removeItem(h,p),remove:(h,p={})=>u.removeItem(h,p)};return u}function Xf(r,e,t){return r.watch?r.watch((i,n)=>e(i,t+n)):()=>{}}async function Zf(r){typeof r.dispose=="function"&&await _t(r.dispose)}function Li(r){return new Promise((e,t)=>{r.oncomplete=r.onsuccess=()=>e(r.result),r.onabort=r.onerror=()=>t(r.error)})}function ec(r,e){const t=indexedDB.open(r);t.onupgradeneeded=()=>t.result.createObjectStore(e);const i=Li(t);return(n,s)=>i.then(o=>s(o.transaction(e,n).objectStore(e)))}let Ha;function Un(){return Ha||(Ha=ec("keyval-store","keyval")),Ha}function tc(r,e=Un()){return e("readonly",t=>Li(t.get(r)))}function E0(r,e,t=Un()){return t("readwrite",i=>(i.put(e,r),Li(i.transaction)))}function x0(r,e=Un()){return e("readwrite",t=>(t.delete(r),Li(t.transaction)))}function A0(r=Un()){return r("readwrite",e=>(e.clear(),Li(e.transaction)))}function S0(r,e){return r.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Li(r.transaction)}function D0(r=Un()){return r("readonly",e=>{if(e.getAllKeys)return Li(e.getAllKeys());const t=[];return S0(e,i=>t.push(i.key)).then(()=>t)})}const M0=r=>JSON.stringify(r,(e,t)=>typeof t=="bigint"?t.toString()+"n":t),I0=r=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,t=r.replace(e,'$1"$2n"$3');return JSON.parse(t,(i,n)=>typeof n=="string"&&n.match(/^\d+n$/)?BigInt(n.substring(0,n.length-1)):n)};function fn(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return I0(r)}catch{return r}}function Ui(r){return typeof r=="string"?r:M0(r)||""}const R0="idb-keyval";var O0=(r={})=>{const e=r.base&&r.base.length>0?`${r.base}:`:"",t=n=>e+n;let i;return r.dbName&&r.storeName&&(i=ec(r.dbName,r.storeName)),{name:R0,options:r,async hasItem(n){return!(typeof await tc(t(n),i)>"u")},async getItem(n){return await tc(t(n),i)??null},setItem(n,s){return E0(t(n),s,i)},removeItem(n){return x0(t(n),i)},getKeys(){return D0(i)},clear(){return A0(i)}}};const N0="WALLET_CONNECT_V2_INDEXED_DB",C0="keyvaluestorage";class P0{constructor(){this.indexedDb=_0({driver:O0({dbName:N0,storeName:C0})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const t=await this.indexedDb.getItem(e);if(t!==null)return t}async setItem(e,t){await this.indexedDb.setItem(e,Ui(t))}async removeItem(e){await this.indexedDb.removeItem(e)}}var Ga=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Os={exports:{}};(function(){let r;function e(){}r=e,r.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},r.prototype.setItem=function(t,i){this[t]=String(i)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){const t=this;Object.keys(t).forEach(function(i){t[i]=void 0,delete t[i]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Ga<"u"&&Ga.localStorage?Os.exports=Ga.localStorage:typeof window<"u"&&window.localStorage?Os.exports=window.localStorage:Os.exports=new e})();function T0(r){var e;return[r[0],fn((e=r[1])!=null?e:"")]}class B0{constructor(){this.localStorage=Os.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(T0)}async getItem(e){const t=this.localStorage.getItem(e);if(t!==null)return fn(t)}async setItem(e,t){this.localStorage.setItem(e,Ui(t))}async removeItem(e){this.localStorage.removeItem(e)}}const L0="wc_storage_version",rc=1,U0=async(r,e,t)=>{const i=L0,n=await e.getItem(i);if(n&&n>=rc){t(e);return}const s=await r.getKeys();if(!s.length){t(e);return}const o=[];for(;s.length;){const f=s.shift();if(!f)continue;const u=f.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){const h=await r.getItem(f);await e.setItem(f,h),o.push(f)}}await e.setItem(i,rc),t(e),F0(r,o)},F0=async(r,e)=>{e.length&&e.forEach(async t=>{await r.removeItem(t)})};class q0{constructor(){this.initialized=!1,this.setInitialized=t=>{this.storage=t,this.initialized=!0};const e=new B0;this.storage=e;try{const t=new P0;U0(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}}function $0(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}var z0=K0;function K0(r,e,t){var i=t&&t.stringify||$0,n=1;if(typeof r=="object"&&r!==null){var s=e.length+n;if(s===1)return r;var o=new Array(s);o[0]=i(r);for(var f=1;f<s;f++)o[f]=i(e[f]);return o.join(" ")}if(typeof r!="string")return r;var u=e.length;if(u===0)return r;for(var h="",p=1-n,y=-1,M=r&&r.length||0,D=0;D<M;){if(r.charCodeAt(D)===37&&D+1<M){switch(y=y>-1?y:0,r.charCodeAt(D+1)){case 100:case 102:if(p>=u||e[p]==null)break;y<D&&(h+=r.slice(y,D)),h+=Number(e[p]),y=D+2,D++;break;case 105:if(p>=u||e[p]==null)break;y<D&&(h+=r.slice(y,D)),h+=Math.floor(Number(e[p])),y=D+2,D++;break;case 79:case 111:case 106:if(p>=u||e[p]===void 0)break;y<D&&(h+=r.slice(y,D));var I=typeof e[p];if(I==="string"){h+="'"+e[p]+"'",y=D+2,D++;break}if(I==="function"){h+=e[p].name||"<anonymous>",y=D+2,D++;break}h+=i(e[p]),y=D+2,D++;break;case 115:if(p>=u)break;y<D&&(h+=r.slice(y,D)),h+=String(e[p]),y=D+2,D++;break;case 37:y<D&&(h+=r.slice(y,D)),h+="%",y=D+2,D++,p--;break}++p}++D}return y===-1?r:(y<M&&(h+=r.slice(y)),h)}const ic=z0;var Xr=Tr;const Fn=X0().console||{},k0={mapHttpRequest:Cs,mapHttpResponse:Cs,wrapRequestSerializer:Wa,wrapResponseSerializer:Wa,wrapErrorSerializer:Wa,req:Cs,res:Cs,err:Y0};function j0(r,e){return Array.isArray(r)?r.filter(function(i){return i!=="!stdSerializers.err"}):r===!0?Object.keys(e):!1}function Tr(r){r=r||{},r.browser=r.browser||{};const e=r.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const t=r.browser.write||Fn;r.browser.write&&(r.browser.asObject=!0);const i=r.serializers||{},n=j0(r.browser.serialize,i);let s=r.browser.serialize;Array.isArray(r.browser.serialize)&&r.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof t=="function"&&(t.error=t.fatal=t.warn=t.info=t.debug=t.trace=t),r.enabled===!1&&(r.level="silent");const f=r.level||"info",u=Object.create(t);u.log||(u.log=qn),Object.defineProperty(u,"levelVal",{get:p}),Object.defineProperty(u,"level",{get:y,set:M});const h={transmit:e,serialize:n,asObject:r.browser.asObject,levels:o,timestamp:W0(r)};u.levels=Tr.levels,u.level=f,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=qn,u.serializers=i,u._serialize=n,u._stdErrSerialize=s,u.child=D,e&&(u._logEvent=Ya());function p(){return this.level==="silent"?1/0:this.levels.values[this.level]}function y(){return this._level}function M(I){if(I!=="silent"&&!this.levels.values[I])throw Error("unknown level "+I);this._level=I,cn(h,u,"error","log"),cn(h,u,"fatal","error"),cn(h,u,"warn","error"),cn(h,u,"info","log"),cn(h,u,"debug","log"),cn(h,u,"trace","log")}function D(I,C){if(!I)throw new Error("missing bindings for child Pino");C=C||{},n&&I.serializers&&(C.serializers=I.serializers);const K=C.serializers;if(n&&K){var j=Object.assign({},i,K),B=r.browser.serialize===!0?Object.keys(j):n;delete I.serializers,Ns([I],B,j,this._stdErrSerialize)}function k(T){this._childLevel=(T._childLevel|0)+1,this.error=hn(T,I,"error"),this.fatal=hn(T,I,"fatal"),this.warn=hn(T,I,"warn"),this.info=hn(T,I,"info"),this.debug=hn(T,I,"debug"),this.trace=hn(T,I,"trace"),j&&(this.serializers=j,this._serialize=B),e&&(this._logEvent=Ya([].concat(T._logEvent.bindings,I)))}return k.prototype=this,new k(this)}return u}Tr.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},Tr.stdSerializers=k0,Tr.stdTimeFunctions=Object.assign({},{nullTime:nc,epochTime:sc,unixTime:J0,isoTime:Q0});function cn(r,e,t,i){const n=Object.getPrototypeOf(e);e[t]=e.levelVal>e.levels.values[t]?qn:n[t]?n[t]:Fn[t]||Fn[i]||qn,V0(r,e,t)}function V0(r,e,t){!r.transmit&&e[t]===qn||(e[t]=function(i){return function(){const s=r.timestamp(),o=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Fn?Fn:this;for(var u=0;u<o.length;u++)o[u]=arguments[u];if(r.serialize&&!r.asObject&&Ns(o,this._serialize,this.serializers,this._stdErrSerialize),r.asObject?i.call(f,H0(this,t,o,s)):i.apply(f,o),r.transmit){const h=r.transmit.level||e.level,p=Tr.levels.values[h],y=Tr.levels.values[t];if(y<p)return;G0(this,{ts:s,methodLevel:t,methodValue:y,transmitLevel:h,transmitValue:Tr.levels.values[r.transmit.level||e.level],send:r.transmit.send,val:e.levelVal},o)}}}(e[t]))}function H0(r,e,t,i){r._serialize&&Ns(t,r._serialize,r.serializers,r._stdErrSerialize);const n=t.slice();let s=n[0];const o={};i&&(o.time=i),o.level=Tr.levels.values[e];let f=(r._childLevel|0)+1;if(f<1&&(f=1),s!==null&&typeof s=="object"){for(;f--&&typeof n[0]=="object";)Object.assign(o,n.shift());s=n.length?ic(n.shift(),n):void 0}else typeof s=="string"&&(s=ic(n.shift(),n));return s!==void 0&&(o.msg=s),o}function Ns(r,e,t,i){for(const n in r)if(i&&r[n]instanceof Error)r[n]=Tr.stdSerializers.err(r[n]);else if(typeof r[n]=="object"&&!Array.isArray(r[n]))for(const s in r[n])e&&e.indexOf(s)>-1&&s in t&&(r[n][s]=t[s](r[n][s]))}function hn(r,e,t){return function(){const i=new Array(1+arguments.length);i[0]=e;for(var n=1;n<i.length;n++)i[n]=arguments[n-1];return r[t].apply(this,i)}}function G0(r,e,t){const i=e.send,n=e.ts,s=e.methodLevel,o=e.methodValue,f=e.val,u=r._logEvent.bindings;Ns(t,r._serialize||Object.keys(r.serializers),r.serializers,r._stdErrSerialize===void 0?!0:r._stdErrSerialize),r._logEvent.ts=n,r._logEvent.messages=t.filter(function(h){return u.indexOf(h)===-1}),r._logEvent.level.label=s,r._logEvent.level.value=o,i(s,r._logEvent,f),r._logEvent=Ya(u)}function Ya(r){return{ts:0,messages:[],bindings:r||[],level:{label:"",value:0}}}function Y0(r){const e={type:r.constructor.name,msg:r.message,stack:r.stack};for(const t in r)e[t]===void 0&&(e[t]=r[t]);return e}function W0(r){return typeof r.timestamp=="function"?r.timestamp:r.timestamp===!1?nc:sc}function Cs(){return{}}function Wa(r){return r}function qn(){}function nc(){return!1}function sc(){return Date.now()}function J0(){return Math.round(Date.now()/1e3)}function Q0(){return new Date(Date.now()).toISOString()}function X0(){function r(e){return typeof e<"u"&&e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return r(self)||r(window)||r(this)||{}}}const Z0={level:"info"},$n="custom_context",Ja=1e3*1024;class ep{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class ac{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new ep(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}}class oc{constructor(e,t=Ja){this.level=e??"error",this.levelValue=Xr.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new ac(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===Xr.levels.values.error?console.error(e):t===Xr.levels.values.warn?console.warn(e):t===Xr.levels.values.debug?console.debug(e):t===Xr.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Ui({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new ac(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(Ui({extraMetadata:e})),new Blob(t,{type:"application/json"})}}class tp{constructor(e,t=Ja){this.baseChunkLogger=new oc(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),i=document.createElement("a");i.href=t,i.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(t)}}class rp{constructor(e,t=Ja){this.baseChunkLogger=new oc(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var ip=Object.defineProperty,np=Object.defineProperties,sp=Object.getOwnPropertyDescriptors,fc=Object.getOwnPropertySymbols,ap=Object.prototype.hasOwnProperty,op=Object.prototype.propertyIsEnumerable,cc=(r,e,t)=>e in r?ip(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ps=(r,e)=>{for(var t in e||(e={}))ap.call(e,t)&&cc(r,t,e[t]);if(fc)for(var t of fc(e))op.call(e,t)&&cc(r,t,e[t]);return r},Ts=(r,e)=>np(r,sp(e));function Qa(r){return Ts(Ps({},r),{level:r?.level||Z0.level})}function fp(r,e=$n){return r[e]||""}function cp(r,e,t=$n){return r[t]=e,r}function Qt(r,e=$n){let t="";return typeof r.bindings>"u"?t=fp(r,e):t=r.bindings().context||"",t}function hp(r,e,t=$n){const i=Qt(r,t);return i.trim()?`${i}/${e}`:e}function jt(r,e,t=$n){const i=hp(r,e,t),n=r.child({context:i});return cp(n,i,t)}function up(r){var e,t;const i=new tp((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:Xr(Ts(Ps({},r.opts),{level:"trace",browser:Ts(Ps({},(t=r.opts)==null?void 0:t.browser),{write:n=>i.write(n)})})),chunkLoggerController:i}}function dp(r){var e;const t=new rp((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:Xr(Ts(Ps({},r.opts),{level:"trace"})),chunkLoggerController:t}}function lp(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?up(r):dp(r)}class pp extends Bi{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class gp extends Bi{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}}class vp{constructor(e,t){this.logger=e,this.core=t}}class bp extends Bi{constructor(e,t){super(),this.relayer=e,this.logger=t}}class mp extends Bi{constructor(e){super()}}class yp{constructor(e,t,i,n){this.core=e,this.logger=t,this.name=i}}class wp extends Bi{constructor(e,t){super(),this.relayer=e,this.logger=t}}class _p extends Bi{constructor(e,t){super(),this.core=e,this.logger=t}}class Ep{constructor(e,t,i){this.core=e,this.logger=t,this.store=i}}class xp{constructor(e,t){this.projectId=e,this.logger=t}}class Ap{constructor(e,t,i){this.core=e,this.logger=t,this.telemetryEnabled=i}}class Sp{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class Dp{constructor(e){this.client=e}}var Xa={},wi={},Bs={},Ls={};Object.defineProperty(Ls,"__esModule",{value:!0}),Ls.BrowserRandomSource=void 0;const hc=65536;class Mp{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let i=0;i<t.length;i+=hc)this._crypto.getRandomValues(t.subarray(i,i+Math.min(t.length-i,hc)));return t}}Ls.BrowserRandomSource=Mp;function Ip(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Us={},ar={};Object.defineProperty(ar,"__esModule",{value:!0});function Rp(r){for(var e=0;e<r.length;e++)r[e]=0;return r}ar.wipe=Rp;var Op={},Np=Object.freeze({__proto__:null,default:Op}),Fs=Ba(Np);Object.defineProperty(Us,"__esModule",{value:!0}),Us.NodeRandomSource=void 0;const Cp=ar;class Pp{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Ip<"u"){const e=Fs;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const i=new Uint8Array(e);for(let n=0;n<i.length;n++)i[n]=t[n];return(0,Cp.wipe)(t),i}}Us.NodeRandomSource=Pp,Object.defineProperty(Bs,"__esModule",{value:!0}),Bs.SystemRandomSource=void 0;const Tp=Ls,Bp=Us;class Lp{constructor(){if(this.isAvailable=!1,this.name="",this._source=new Tp.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new Bp.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}Bs.SystemRandomSource=Lp;var Ve={},uc={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});function e(f,u){var h=f>>>16&65535,p=f&65535,y=u>>>16&65535,M=u&65535;return p*M+(h*M+p*y<<16>>>0)|0}r.mul=Math.imul||e;function t(f,u){return f+u|0}r.add=t;function i(f,u){return f-u|0}r.sub=i;function n(f,u){return f<<u|f>>>32-u}r.rotl=n;function s(f,u){return f<<32-u|f>>>u}r.rotr=s;function o(f){return typeof f=="number"&&isFinite(f)&&Math.floor(f)===f}r.isInteger=Number.isInteger||o,r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(f){return r.isInteger(f)&&f>=-r.MAX_SAFE_INTEGER&&f<=r.MAX_SAFE_INTEGER}})(uc),Object.defineProperty(Ve,"__esModule",{value:!0});var dc=uc;function Up(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}Ve.readInt16BE=Up;function Fp(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}Ve.readUint16BE=Fp;function qp(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}Ve.readInt16LE=qp;function $p(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}Ve.readUint16LE=$p;function lc(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}Ve.writeUint16BE=lc,Ve.writeInt16BE=lc;function pc(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}Ve.writeUint16LE=pc,Ve.writeInt16LE=pc;function Za(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}Ve.readInt32BE=Za;function eo(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}Ve.readUint32BE=eo;function to(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}Ve.readInt32LE=to;function ro(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}Ve.readUint32LE=ro;function qs(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}Ve.writeUint32BE=qs,Ve.writeInt32BE=qs;function $s(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}Ve.writeUint32LE=$s,Ve.writeInt32LE=$s;function zp(r,e){e===void 0&&(e=0);var t=Za(r,e),i=Za(r,e+4);return t*4294967296+i-(i>>31)*4294967296}Ve.readInt64BE=zp;function Kp(r,e){e===void 0&&(e=0);var t=eo(r,e),i=eo(r,e+4);return t*4294967296+i}Ve.readUint64BE=Kp;function kp(r,e){e===void 0&&(e=0);var t=to(r,e),i=to(r,e+4);return i*4294967296+t-(t>>31)*4294967296}Ve.readInt64LE=kp;function jp(r,e){e===void 0&&(e=0);var t=ro(r,e),i=ro(r,e+4);return i*4294967296+t}Ve.readUint64LE=jp;function gc(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),qs(r/4294967296>>>0,e,t),qs(r>>>0,e,t+4),e}Ve.writeUint64BE=gc,Ve.writeInt64BE=gc;function vc(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),$s(r>>>0,e,t),$s(r/4294967296>>>0,e,t+4),e}Ve.writeUint64LE=vc,Ve.writeInt64LE=vc;function Vp(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=r/8+t-1;s>=t;s--)i+=e[s]*n,n*=256;return i}Ve.readUintBE=Vp;function Hp(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=t;s<t+r/8;s++)i+=e[s]*n,n*=256;return i}Ve.readUintLE=Hp;function Gp(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!dc.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var n=1,s=r/8+i-1;s>=i;s--)t[s]=e/n&255,n*=256;return t}Ve.writeUintBE=Gp;function Yp(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!dc.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var n=1,s=i;s<i+r/8;s++)t[s]=e/n&255,n*=256;return t}Ve.writeUintLE=Yp;function Wp(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e)}Ve.readFloat32BE=Wp;function Jp(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e,!0)}Ve.readFloat32LE=Jp;function Qp(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e)}Ve.readFloat64BE=Qp;function Xp(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e,!0)}Ve.readFloat64LE=Xp;function Zp(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(t,r),e}Ve.writeFloat32BE=Zp;function e1(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(t,r,!0),e}Ve.writeFloat32LE=e1;function t1(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(t,r),e}Ve.writeFloat64BE=t1;function r1(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(t,r,!0),e}Ve.writeFloat64LE=r1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.randomStringForEntropy=r.randomString=r.randomUint32=r.randomBytes=r.defaultRandomSource=void 0;const e=Bs,t=Ve,i=ar;r.defaultRandomSource=new e.SystemRandomSource;function n(h,p=r.defaultRandomSource){return p.randomBytes(h)}r.randomBytes=n;function s(h=r.defaultRandomSource){const p=n(4,h),y=(0,t.readUint32LE)(p);return(0,i.wipe)(p),y}r.randomUint32=s;const o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function f(h,p=o,y=r.defaultRandomSource){if(p.length<2)throw new Error("randomString charset is too short");if(p.length>256)throw new Error("randomString charset is too long");let M="";const D=p.length,I=256-256%D;for(;h>0;){const C=n(Math.ceil(h*256/I),y);for(let K=0;K<C.length&&h>0;K++){const j=C[K];j<I&&(M+=p.charAt(j%D),h--)}(0,i.wipe)(C)}return M}r.randomString=f;function u(h,p=o,y=r.defaultRandomSource){const M=Math.ceil(h/(Math.log(p.length)/Math.LN2));return f(M,p,y)}r.randomStringForEntropy=u}(wi);var bc={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Ve,t=ar;r.DIGEST_LENGTH=64,r.BLOCK_SIZE=128;var i=function(){function f(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return f.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._tempHi),t.wipe(this._tempLo),this.reset()},f.prototype.update=function(u,h){if(h===void 0&&(h=u.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var p=0;if(this._bytesHashed+=h,this._bufferLength>0){for(;this._bufferLength<r.BLOCK_SIZE&&h>0;)this._buffer[this._bufferLength++]=u[p++],h--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(h>=this.blockSize&&(p=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,u,p,h),h%=this.blockSize);h>0;)this._buffer[this._bufferLength++]=u[p++],h--;return this},f.prototype.finish=function(u){if(!this._finished){var h=this._bytesHashed,p=this._bufferLength,y=h/536870912|0,M=h<<3,D=h%128<112?128:256;this._buffer[p]=128;for(var I=p+1;I<D-8;I++)this._buffer[I]=0;e.writeUint32BE(y,this._buffer,D-8),e.writeUint32BE(M,this._buffer,D-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,D),this._finished=!0}for(var I=0;I<this.digestLength/8;I++)e.writeUint32BE(this._stateHi[I],u,I*8),e.writeUint32BE(this._stateLo[I],u,I*8+4);return this},f.prototype.digest=function(){var u=new Uint8Array(this.digestLength);return this.finish(u),u},f.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(u){return this._stateHi.set(u.stateHi),this._stateLo.set(u.stateLo),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},f.prototype.cleanSavedState=function(u){t.wipe(u.stateHi),t.wipe(u.stateLo),u.buffer&&t.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},f}();r.SHA512=i;var n=new Int32Array([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]);function s(f,u,h,p,y,M,D){for(var I=h[0],C=h[1],K=h[2],j=h[3],B=h[4],k=h[5],T=h[6],q=h[7],$=p[0],_=p[1],O=p[2],W=p[3],X=p[4],N=p[5],g=p[6],l=p[7],a,c,v,x,A,E,d,w;D>=128;){for(var b=0;b<16;b++){var R=8*b+M;f[b]=e.readUint32BE(y,R),u[b]=e.readUint32BE(y,R+4)}for(var b=0;b<80;b++){var Y=I,S=C,V=K,P=j,F=B,L=k,m=T,U=q,G=$,J=_,Q=O,ee=W,we=X,Se=N,he=g,Ne=l;if(a=q,c=l,A=c&65535,E=c>>>16,d=a&65535,w=a>>>16,a=(B>>>14|X<<32-14)^(B>>>18|X<<32-18)^(X>>>41-32|B<<32-(41-32)),c=(X>>>14|B<<32-14)^(X>>>18|B<<32-18)^(B>>>41-32|X<<32-(41-32)),A+=c&65535,E+=c>>>16,d+=a&65535,w+=a>>>16,a=B&k^~B&T,c=X&N^~X&g,A+=c&65535,E+=c>>>16,d+=a&65535,w+=a>>>16,a=n[b*2],c=n[b*2+1],A+=c&65535,E+=c>>>16,d+=a&65535,w+=a>>>16,a=f[b%16],c=u[b%16],A+=c&65535,E+=c>>>16,d+=a&65535,w+=a>>>16,E+=A>>>16,d+=E>>>16,w+=d>>>16,v=d&65535|w<<16,x=A&65535|E<<16,a=v,c=x,A=c&65535,E=c>>>16,d=a&65535,w=a>>>16,a=(I>>>28|$<<32-28)^($>>>34-32|I<<32-(34-32))^($>>>39-32|I<<32-(39-32)),c=($>>>28|I<<32-28)^(I>>>34-32|$<<32-(34-32))^(I>>>39-32|$<<32-(39-32)),A+=c&65535,E+=c>>>16,d+=a&65535,w+=a>>>16,a=I&C^I&K^C&K,c=$&_^$&O^_&O,A+=c&65535,E+=c>>>16,d+=a&65535,w+=a>>>16,E+=A>>>16,d+=E>>>16,w+=d>>>16,U=d&65535|w<<16,Ne=A&65535|E<<16,a=P,c=ee,A=c&65535,E=c>>>16,d=a&65535,w=a>>>16,a=v,c=x,A+=c&65535,E+=c>>>16,d+=a&65535,w+=a>>>16,E+=A>>>16,d+=E>>>16,w+=d>>>16,P=d&65535|w<<16,ee=A&65535|E<<16,C=Y,K=S,j=V,B=P,k=F,T=L,q=m,I=U,_=G,O=J,W=Q,X=ee,N=we,g=Se,l=he,$=Ne,b%16===15)for(var R=0;R<16;R++)a=f[R],c=u[R],A=c&65535,E=c>>>16,d=a&65535,w=a>>>16,a=f[(R+9)%16],c=u[(R+9)%16],A+=c&65535,E+=c>>>16,d+=a&65535,w+=a>>>16,v=f[(R+1)%16],x=u[(R+1)%16],a=(v>>>1|x<<32-1)^(v>>>8|x<<32-8)^v>>>7,c=(x>>>1|v<<32-1)^(x>>>8|v<<32-8)^(x>>>7|v<<32-7),A+=c&65535,E+=c>>>16,d+=a&65535,w+=a>>>16,v=f[(R+14)%16],x=u[(R+14)%16],a=(v>>>19|x<<32-19)^(x>>>61-32|v<<32-(61-32))^v>>>6,c=(x>>>19|v<<32-19)^(v>>>61-32|x<<32-(61-32))^(x>>>6|v<<32-6),A+=c&65535,E+=c>>>16,d+=a&65535,w+=a>>>16,E+=A>>>16,d+=E>>>16,w+=d>>>16,f[R]=d&65535|w<<16,u[R]=A&65535|E<<16}a=I,c=$,A=c&65535,E=c>>>16,d=a&65535,w=a>>>16,a=h[0],c=p[0],A+=c&65535,E+=c>>>16,d+=a&65535,w+=a>>>16,E+=A>>>16,d+=E>>>16,w+=d>>>16,h[0]=I=d&65535|w<<16,p[0]=$=A&65535|E<<16,a=C,c=_,A=c&65535,E=c>>>16,d=a&65535,w=a>>>16,a=h[1],c=p[1],A+=c&65535,E+=c>>>16,d+=a&65535,w+=a>>>16,E+=A>>>16,d+=E>>>16,w+=d>>>16,h[1]=C=d&65535|w<<16,p[1]=_=A&65535|E<<16,a=K,c=O,A=c&65535,E=c>>>16,d=a&65535,w=a>>>16,a=h[2],c=p[2],A+=c&65535,E+=c>>>16,d+=a&65535,w+=a>>>16,E+=A>>>16,d+=E>>>16,w+=d>>>16,h[2]=K=d&65535|w<<16,p[2]=O=A&65535|E<<16,a=j,c=W,A=c&65535,E=c>>>16,d=a&65535,w=a>>>16,a=h[3],c=p[3],A+=c&65535,E+=c>>>16,d+=a&65535,w+=a>>>16,E+=A>>>16,d+=E>>>16,w+=d>>>16,h[3]=j=d&65535|w<<16,p[3]=W=A&65535|E<<16,a=B,c=X,A=c&65535,E=c>>>16,d=a&65535,w=a>>>16,a=h[4],c=p[4],A+=c&65535,E+=c>>>16,d+=a&65535,w+=a>>>16,E+=A>>>16,d+=E>>>16,w+=d>>>16,h[4]=B=d&65535|w<<16,p[4]=X=A&65535|E<<16,a=k,c=N,A=c&65535,E=c>>>16,d=a&65535,w=a>>>16,a=h[5],c=p[5],A+=c&65535,E+=c>>>16,d+=a&65535,w+=a>>>16,E+=A>>>16,d+=E>>>16,w+=d>>>16,h[5]=k=d&65535|w<<16,p[5]=N=A&65535|E<<16,a=T,c=g,A=c&65535,E=c>>>16,d=a&65535,w=a>>>16,a=h[6],c=p[6],A+=c&65535,E+=c>>>16,d+=a&65535,w+=a>>>16,E+=A>>>16,d+=E>>>16,w+=d>>>16,h[6]=T=d&65535|w<<16,p[6]=g=A&65535|E<<16,a=q,c=l,A=c&65535,E=c>>>16,d=a&65535,w=a>>>16,a=h[7],c=p[7],A+=c&65535,E+=c>>>16,d+=a&65535,w+=a>>>16,E+=A>>>16,d+=E>>>16,w+=d>>>16,h[7]=q=d&65535|w<<16,p[7]=l=A&65535|E<<16,M+=128,D-=128}return M}function o(f){var u=new i;u.update(f);var h=u.digest();return u.clean(),h}r.hash=o})(bc),function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertSecretKeyToX25519=r.convertPublicKeyToX25519=r.verify=r.sign=r.extractPublicKeyFromSecretKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.SEED_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=r.SIGNATURE_LENGTH=void 0;const e=wi,t=bc,i=ar;r.SIGNATURE_LENGTH=64,r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=64,r.SEED_LENGTH=32;function n(P){const F=new Float64Array(16);if(P)for(let L=0;L<P.length;L++)F[L]=P[L];return F}const s=new Uint8Array(32);s[0]=9;const o=n(),f=n([1]),u=n([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=n([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),p=n([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=n([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),M=n([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function D(P,F){for(let L=0;L<16;L++)P[L]=F[L]|0}function I(P){let F=1;for(let L=0;L<16;L++){let m=P[L]+F+65535;F=Math.floor(m/65536),P[L]=m-F*65536}P[0]+=F-1+37*(F-1)}function C(P,F,L){const m=~(L-1);for(let U=0;U<16;U++){const G=m&(P[U]^F[U]);P[U]^=G,F[U]^=G}}function K(P,F){const L=n(),m=n();for(let U=0;U<16;U++)m[U]=F[U];I(m),I(m),I(m);for(let U=0;U<2;U++){L[0]=m[0]-65517;for(let J=1;J<15;J++)L[J]=m[J]-65535-(L[J-1]>>16&1),L[J-1]&=65535;L[15]=m[15]-32767-(L[14]>>16&1);const G=L[15]>>16&1;L[14]&=65535,C(m,L,1-G)}for(let U=0;U<16;U++)P[2*U]=m[U]&255,P[2*U+1]=m[U]>>8}function j(P,F){let L=0;for(let m=0;m<32;m++)L|=P[m]^F[m];return(1&L-1>>>8)-1}function B(P,F){const L=new Uint8Array(32),m=new Uint8Array(32);return K(L,P),K(m,F),j(L,m)}function k(P){const F=new Uint8Array(32);return K(F,P),F[0]&1}function T(P,F){for(let L=0;L<16;L++)P[L]=F[2*L]+(F[2*L+1]<<8);P[15]&=32767}function q(P,F,L){for(let m=0;m<16;m++)P[m]=F[m]+L[m]}function $(P,F,L){for(let m=0;m<16;m++)P[m]=F[m]-L[m]}function _(P,F,L){let m,U,G=0,J=0,Q=0,ee=0,we=0,Se=0,he=0,Ne=0,Ee=0,se=0,be=0,le=0,ie=0,ue=0,fe=0,te=0,pe=0,_e=0,re=0,xe=0,Ae=0,oe=0,Ie=0,De=0,Re=0,Ye=0,Qe=0,Me=0,et=0,tt=0,Ce=0,Te=L[0],Pe=L[1],de=L[2],Be=L[3],Le=L[4],ce=L[5],qe=L[6],$e=L[7],me=L[8],ze=L[9],Ke=L[10],ge=L[11],Ue=L[12],Oe=L[13],ye=L[14],ke=L[15];m=F[0],G+=m*Te,J+=m*Pe,Q+=m*de,ee+=m*Be,we+=m*Le,Se+=m*ce,he+=m*qe,Ne+=m*$e,Ee+=m*me,se+=m*ze,be+=m*Ke,le+=m*ge,ie+=m*Ue,ue+=m*Oe,fe+=m*ye,te+=m*ke,m=F[1],J+=m*Te,Q+=m*Pe,ee+=m*de,we+=m*Be,Se+=m*Le,he+=m*ce,Ne+=m*qe,Ee+=m*$e,se+=m*me,be+=m*ze,le+=m*Ke,ie+=m*ge,ue+=m*Ue,fe+=m*Oe,te+=m*ye,pe+=m*ke,m=F[2],Q+=m*Te,ee+=m*Pe,we+=m*de,Se+=m*Be,he+=m*Le,Ne+=m*ce,Ee+=m*qe,se+=m*$e,be+=m*me,le+=m*ze,ie+=m*Ke,ue+=m*ge,fe+=m*Ue,te+=m*Oe,pe+=m*ye,_e+=m*ke,m=F[3],ee+=m*Te,we+=m*Pe,Se+=m*de,he+=m*Be,Ne+=m*Le,Ee+=m*ce,se+=m*qe,be+=m*$e,le+=m*me,ie+=m*ze,ue+=m*Ke,fe+=m*ge,te+=m*Ue,pe+=m*Oe,_e+=m*ye,re+=m*ke,m=F[4],we+=m*Te,Se+=m*Pe,he+=m*de,Ne+=m*Be,Ee+=m*Le,se+=m*ce,be+=m*qe,le+=m*$e,ie+=m*me,ue+=m*ze,fe+=m*Ke,te+=m*ge,pe+=m*Ue,_e+=m*Oe,re+=m*ye,xe+=m*ke,m=F[5],Se+=m*Te,he+=m*Pe,Ne+=m*de,Ee+=m*Be,se+=m*Le,be+=m*ce,le+=m*qe,ie+=m*$e,ue+=m*me,fe+=m*ze,te+=m*Ke,pe+=m*ge,_e+=m*Ue,re+=m*Oe,xe+=m*ye,Ae+=m*ke,m=F[6],he+=m*Te,Ne+=m*Pe,Ee+=m*de,se+=m*Be,be+=m*Le,le+=m*ce,ie+=m*qe,ue+=m*$e,fe+=m*me,te+=m*ze,pe+=m*Ke,_e+=m*ge,re+=m*Ue,xe+=m*Oe,Ae+=m*ye,oe+=m*ke,m=F[7],Ne+=m*Te,Ee+=m*Pe,se+=m*de,be+=m*Be,le+=m*Le,ie+=m*ce,ue+=m*qe,fe+=m*$e,te+=m*me,pe+=m*ze,_e+=m*Ke,re+=m*ge,xe+=m*Ue,Ae+=m*Oe,oe+=m*ye,Ie+=m*ke,m=F[8],Ee+=m*Te,se+=m*Pe,be+=m*de,le+=m*Be,ie+=m*Le,ue+=m*ce,fe+=m*qe,te+=m*$e,pe+=m*me,_e+=m*ze,re+=m*Ke,xe+=m*ge,Ae+=m*Ue,oe+=m*Oe,Ie+=m*ye,De+=m*ke,m=F[9],se+=m*Te,be+=m*Pe,le+=m*de,ie+=m*Be,ue+=m*Le,fe+=m*ce,te+=m*qe,pe+=m*$e,_e+=m*me,re+=m*ze,xe+=m*Ke,Ae+=m*ge,oe+=m*Ue,Ie+=m*Oe,De+=m*ye,Re+=m*ke,m=F[10],be+=m*Te,le+=m*Pe,ie+=m*de,ue+=m*Be,fe+=m*Le,te+=m*ce,pe+=m*qe,_e+=m*$e,re+=m*me,xe+=m*ze,Ae+=m*Ke,oe+=m*ge,Ie+=m*Ue,De+=m*Oe,Re+=m*ye,Ye+=m*ke,m=F[11],le+=m*Te,ie+=m*Pe,ue+=m*de,fe+=m*Be,te+=m*Le,pe+=m*ce,_e+=m*qe,re+=m*$e,xe+=m*me,Ae+=m*ze,oe+=m*Ke,Ie+=m*ge,De+=m*Ue,Re+=m*Oe,Ye+=m*ye,Qe+=m*ke,m=F[12],ie+=m*Te,ue+=m*Pe,fe+=m*de,te+=m*Be,pe+=m*Le,_e+=m*ce,re+=m*qe,xe+=m*$e,Ae+=m*me,oe+=m*ze,Ie+=m*Ke,De+=m*ge,Re+=m*Ue,Ye+=m*Oe,Qe+=m*ye,Me+=m*ke,m=F[13],ue+=m*Te,fe+=m*Pe,te+=m*de,pe+=m*Be,_e+=m*Le,re+=m*ce,xe+=m*qe,Ae+=m*$e,oe+=m*me,Ie+=m*ze,De+=m*Ke,Re+=m*ge,Ye+=m*Ue,Qe+=m*Oe,Me+=m*ye,et+=m*ke,m=F[14],fe+=m*Te,te+=m*Pe,pe+=m*de,_e+=m*Be,re+=m*Le,xe+=m*ce,Ae+=m*qe,oe+=m*$e,Ie+=m*me,De+=m*ze,Re+=m*Ke,Ye+=m*ge,Qe+=m*Ue,Me+=m*Oe,et+=m*ye,tt+=m*ke,m=F[15],te+=m*Te,pe+=m*Pe,_e+=m*de,re+=m*Be,xe+=m*Le,Ae+=m*ce,oe+=m*qe,Ie+=m*$e,De+=m*me,Re+=m*ze,Ye+=m*Ke,Qe+=m*ge,Me+=m*Ue,et+=m*Oe,tt+=m*ye,Ce+=m*ke,G+=38*pe,J+=38*_e,Q+=38*re,ee+=38*xe,we+=38*Ae,Se+=38*oe,he+=38*Ie,Ne+=38*De,Ee+=38*Re,se+=38*Ye,be+=38*Qe,le+=38*Me,ie+=38*et,ue+=38*tt,fe+=38*Ce,U=1,m=G+U+65535,U=Math.floor(m/65536),G=m-U*65536,m=J+U+65535,U=Math.floor(m/65536),J=m-U*65536,m=Q+U+65535,U=Math.floor(m/65536),Q=m-U*65536,m=ee+U+65535,U=Math.floor(m/65536),ee=m-U*65536,m=we+U+65535,U=Math.floor(m/65536),we=m-U*65536,m=Se+U+65535,U=Math.floor(m/65536),Se=m-U*65536,m=he+U+65535,U=Math.floor(m/65536),he=m-U*65536,m=Ne+U+65535,U=Math.floor(m/65536),Ne=m-U*65536,m=Ee+U+65535,U=Math.floor(m/65536),Ee=m-U*65536,m=se+U+65535,U=Math.floor(m/65536),se=m-U*65536,m=be+U+65535,U=Math.floor(m/65536),be=m-U*65536,m=le+U+65535,U=Math.floor(m/65536),le=m-U*65536,m=ie+U+65535,U=Math.floor(m/65536),ie=m-U*65536,m=ue+U+65535,U=Math.floor(m/65536),ue=m-U*65536,m=fe+U+65535,U=Math.floor(m/65536),fe=m-U*65536,m=te+U+65535,U=Math.floor(m/65536),te=m-U*65536,G+=U-1+37*(U-1),U=1,m=G+U+65535,U=Math.floor(m/65536),G=m-U*65536,m=J+U+65535,U=Math.floor(m/65536),J=m-U*65536,m=Q+U+65535,U=Math.floor(m/65536),Q=m-U*65536,m=ee+U+65535,U=Math.floor(m/65536),ee=m-U*65536,m=we+U+65535,U=Math.floor(m/65536),we=m-U*65536,m=Se+U+65535,U=Math.floor(m/65536),Se=m-U*65536,m=he+U+65535,U=Math.floor(m/65536),he=m-U*65536,m=Ne+U+65535,U=Math.floor(m/65536),Ne=m-U*65536,m=Ee+U+65535,U=Math.floor(m/65536),Ee=m-U*65536,m=se+U+65535,U=Math.floor(m/65536),se=m-U*65536,m=be+U+65535,U=Math.floor(m/65536),be=m-U*65536,m=le+U+65535,U=Math.floor(m/65536),le=m-U*65536,m=ie+U+65535,U=Math.floor(m/65536),ie=m-U*65536,m=ue+U+65535,U=Math.floor(m/65536),ue=m-U*65536,m=fe+U+65535,U=Math.floor(m/65536),fe=m-U*65536,m=te+U+65535,U=Math.floor(m/65536),te=m-U*65536,G+=U-1+37*(U-1),P[0]=G,P[1]=J,P[2]=Q,P[3]=ee,P[4]=we,P[5]=Se,P[6]=he,P[7]=Ne,P[8]=Ee,P[9]=se,P[10]=be,P[11]=le,P[12]=ie,P[13]=ue,P[14]=fe,P[15]=te}function O(P,F){_(P,F,F)}function W(P,F){const L=n();let m;for(m=0;m<16;m++)L[m]=F[m];for(m=253;m>=0;m--)O(L,L),m!==2&&m!==4&&_(L,L,F);for(m=0;m<16;m++)P[m]=L[m]}function X(P,F){const L=n();let m;for(m=0;m<16;m++)L[m]=F[m];for(m=250;m>=0;m--)O(L,L),m!==1&&_(L,L,F);for(m=0;m<16;m++)P[m]=L[m]}function N(P,F){const L=n(),m=n(),U=n(),G=n(),J=n(),Q=n(),ee=n(),we=n(),Se=n();$(L,P[1],P[0]),$(Se,F[1],F[0]),_(L,L,Se),q(m,P[0],P[1]),q(Se,F[0],F[1]),_(m,m,Se),_(U,P[3],F[3]),_(U,U,h),_(G,P[2],F[2]),q(G,G,G),$(J,m,L),$(Q,G,U),q(ee,G,U),q(we,m,L),_(P[0],J,Q),_(P[1],we,ee),_(P[2],ee,Q),_(P[3],J,we)}function g(P,F,L){for(let m=0;m<4;m++)C(P[m],F[m],L)}function l(P,F){const L=n(),m=n(),U=n();W(U,F[2]),_(L,F[0],U),_(m,F[1],U),K(P,m),P[31]^=k(L)<<7}function a(P,F,L){D(P[0],o),D(P[1],f),D(P[2],f),D(P[3],o);for(let m=255;m>=0;--m){const U=L[m/8|0]>>(m&7)&1;g(P,F,U),N(F,P),N(P,P),g(P,F,U)}}function c(P,F){const L=[n(),n(),n(),n()];D(L[0],p),D(L[1],y),D(L[2],f),_(L[3],p,y),a(P,L,F)}function v(P){if(P.length!==r.SEED_LENGTH)throw new Error(`ed25519: seed must be ${r.SEED_LENGTH} bytes`);const F=(0,t.hash)(P);F[0]&=248,F[31]&=127,F[31]|=64;const L=new Uint8Array(32),m=[n(),n(),n(),n()];c(m,F),l(L,m);const U=new Uint8Array(64);return U.set(P),U.set(L,32),{publicKey:L,secretKey:U}}r.generateKeyPairFromSeed=v;function x(P){const F=(0,e.randomBytes)(32,P),L=v(F);return(0,i.wipe)(F),L}r.generateKeyPair=x;function A(P){if(P.length!==r.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${r.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(P.subarray(32))}r.extractPublicKeyFromSecretKey=A;const E=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function d(P,F){let L,m,U,G;for(m=63;m>=32;--m){for(L=0,U=m-32,G=m-12;U<G;++U)F[U]+=L-16*F[m]*E[U-(m-32)],L=Math.floor((F[U]+128)/256),F[U]-=L*256;F[U]+=L,F[m]=0}for(L=0,U=0;U<32;U++)F[U]+=L-(F[31]>>4)*E[U],L=F[U]>>8,F[U]&=255;for(U=0;U<32;U++)F[U]-=L*E[U];for(m=0;m<32;m++)F[m+1]+=F[m]>>8,P[m]=F[m]&255}function w(P){const F=new Float64Array(64);for(let L=0;L<64;L++)F[L]=P[L];for(let L=0;L<64;L++)P[L]=0;d(P,F)}function b(P,F){const L=new Float64Array(64),m=[n(),n(),n(),n()],U=(0,t.hash)(P.subarray(0,32));U[0]&=248,U[31]&=127,U[31]|=64;const G=new Uint8Array(64);G.set(U.subarray(32),32);const J=new t.SHA512;J.update(G.subarray(32)),J.update(F);const Q=J.digest();J.clean(),w(Q),c(m,Q),l(G,m),J.reset(),J.update(G.subarray(0,32)),J.update(P.subarray(32)),J.update(F);const ee=J.digest();w(ee);for(let we=0;we<32;we++)L[we]=Q[we];for(let we=0;we<32;we++)for(let Se=0;Se<32;Se++)L[we+Se]+=ee[we]*U[Se];return d(G.subarray(32),L),G}r.sign=b;function R(P,F){const L=n(),m=n(),U=n(),G=n(),J=n(),Q=n(),ee=n();return D(P[2],f),T(P[1],F),O(U,P[1]),_(G,U,u),$(U,U,P[2]),q(G,P[2],G),O(J,G),O(Q,J),_(ee,Q,J),_(L,ee,U),_(L,L,G),X(L,L),_(L,L,U),_(L,L,G),_(L,L,G),_(P[0],L,G),O(m,P[0]),_(m,m,G),B(m,U)&&_(P[0],P[0],M),O(m,P[0]),_(m,m,G),B(m,U)?-1:(k(P[0])===F[31]>>7&&$(P[0],o,P[0]),_(P[3],P[0],P[1]),0)}function Y(P,F,L){const m=new Uint8Array(32),U=[n(),n(),n(),n()],G=[n(),n(),n(),n()];if(L.length!==r.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${r.SIGNATURE_LENGTH} bytes`);if(R(G,P))return!1;const J=new t.SHA512;J.update(L.subarray(0,32)),J.update(P),J.update(F);const Q=J.digest();return w(Q),a(U,G,Q),c(G,L.subarray(32)),N(U,G),l(m,U),!j(L,m)}r.verify=Y;function S(P){let F=[n(),n(),n(),n()];if(R(F,P))throw new Error("Ed25519: invalid public key");let L=n(),m=n(),U=F[1];q(L,f,U),$(m,f,U),W(m,m),_(L,L,m);let G=new Uint8Array(32);return K(G,L),G}r.convertPublicKeyToX25519=S;function V(P){const F=(0,t.hash)(P.subarray(0,32));F[0]&=248,F[31]&=127,F[31]|=64;const L=new Uint8Array(F.subarray(0,32));return(0,i.wipe)(F),L}r.convertSecretKeyToX25519=V}(Xa);const i1="EdDSA",n1="JWT",zs=".",Ks="base64url",mc="utf8",yc="utf8",s1=":",a1="did",o1="key",wc="base58btc",f1="z",c1="K36",h1=32;function _c(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function ks(r,e){e||(e=r.reduce((n,s)=>n+s.length,0));const t=_c(e);let i=0;for(const n of r)t.set(n,i),i+=n.length;return t}function u1(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var n=0;n<r.length;n++){var s=r.charAt(n),o=s.charCodeAt(0);if(t[o]!==255)throw new TypeError(s+" is ambiguous");t[o]=n}var f=r.length,u=r.charAt(0),h=Math.log(f)/Math.log(256),p=Math.log(256)/Math.log(f);function y(I){if(I instanceof Uint8Array||(ArrayBuffer.isView(I)?I=new Uint8Array(I.buffer,I.byteOffset,I.byteLength):Array.isArray(I)&&(I=Uint8Array.from(I))),!(I instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(I.length===0)return"";for(var C=0,K=0,j=0,B=I.length;j!==B&&I[j]===0;)j++,C++;for(var k=(B-j)*p+1>>>0,T=new Uint8Array(k);j!==B;){for(var q=I[j],$=0,_=k-1;(q!==0||$<K)&&_!==-1;_--,$++)q+=256*T[_]>>>0,T[_]=q%f>>>0,q=q/f>>>0;if(q!==0)throw new Error("Non-zero carry");K=$,j++}for(var O=k-K;O!==k&&T[O]===0;)O++;for(var W=u.repeat(C);O<k;++O)W+=r.charAt(T[O]);return W}function M(I){if(typeof I!="string")throw new TypeError("Expected String");if(I.length===0)return new Uint8Array;var C=0;if(I[C]!==" "){for(var K=0,j=0;I[C]===u;)K++,C++;for(var B=(I.length-C)*h+1>>>0,k=new Uint8Array(B);I[C];){var T=t[I.charCodeAt(C)];if(T===255)return;for(var q=0,$=B-1;(T!==0||q<j)&&$!==-1;$--,q++)T+=f*k[$]>>>0,k[$]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");j=q,C++}if(I[C]!==" "){for(var _=B-j;_!==B&&k[_]===0;)_++;for(var O=new Uint8Array(K+(B-_)),W=K;_!==B;)O[W++]=k[_++];return O}}}function D(I){var C=M(I);if(C)return C;throw new Error(`Non-${e} character`)}return{encode:y,decodeUnsafe:M,decode:D}}var d1=u1,l1=d1;const Ec=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},p1=r=>new TextEncoder().encode(r),g1=r=>new TextDecoder().decode(r);class v1{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class b1{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}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 xc(this,e)}}class m1{constructor(e){this.decoders=e}or(e){return xc(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const xc=(r,e)=>new m1({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class y1{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new v1(e,t,i),this.decoder=new b1(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const js=({name:r,prefix:e,encode:t,decode:i})=>new y1(r,e,t,i),zn=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:n}=l1(t,e);return js({prefix:r,name:e,encode:i,decode:s=>Ec(n(s))})},w1=(r,e,t,i)=>{const n={};for(let p=0;p<e.length;++p)n[e[p]]=p;let s=r.length;for(;r[s-1]==="=";)--s;const o=new Uint8Array(s*t/8|0);let f=0,u=0,h=0;for(let p=0;p<s;++p){const y=n[r[p]];if(y===void 0)throw new SyntaxError(`Non-${i} character`);u=u<<t|y,f+=t,f>=8&&(f-=8,o[h++]=255&u>>f)}if(f>=t||255&u<<8-f)throw new SyntaxError("Unexpected end of data");return o},_1=(r,e,t)=>{const i=e[e.length-1]==="=",n=(1<<t)-1;let s="",o=0,f=0;for(let u=0;u<r.length;++u)for(f=f<<8|r[u],o+=8;o>t;)o-=t,s+=e[n&f>>o];if(o&&(s+=e[n&f<<t-o]),i)for(;s.length*t&7;)s+="=";return s},Nt=({name:r,prefix:e,bitsPerChar:t,alphabet:i})=>js({prefix:e,name:r,encode(n){return _1(n,i,t)},decode(n){return w1(n,i,t,r)}}),E1=js({prefix:"\0",name:"identity",encode:r=>g1(r),decode:r=>p1(r)});var x1=Object.freeze({__proto__:null,identity:E1});const A1=Nt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var S1=Object.freeze({__proto__:null,base2:A1});const D1=Nt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var M1=Object.freeze({__proto__:null,base8:D1});const I1=zn({prefix:"9",name:"base10",alphabet:"0123456789"});var R1=Object.freeze({__proto__:null,base10:I1});const O1=Nt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),N1=Nt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var C1=Object.freeze({__proto__:null,base16:O1,base16upper:N1});const P1=Nt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),T1=Nt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),B1=Nt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),L1=Nt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),U1=Nt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),F1=Nt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),q1=Nt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),$1=Nt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),z1=Nt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var K1=Object.freeze({__proto__:null,base32:P1,base32upper:T1,base32pad:B1,base32padupper:L1,base32hex:U1,base32hexupper:F1,base32hexpad:q1,base32hexpadupper:$1,base32z:z1});const k1=zn({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),j1=zn({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var V1=Object.freeze({__proto__:null,base36:k1,base36upper:j1});const H1=zn({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),G1=zn({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Y1=Object.freeze({__proto__:null,base58btc:H1,base58flickr:G1});const W1=Nt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),J1=Nt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Q1=Nt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),X1=Nt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Z1=Object.freeze({__proto__:null,base64:W1,base64pad:J1,base64url:Q1,base64urlpad:X1});const Ac=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}"),eg=Ac.reduce((r,e,t)=>(r[t]=e,r),[]),tg=Ac.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function rg(r){return r.reduce((e,t)=>(e+=eg[t],e),"")}function ig(r){const e=[];for(const t of r){const i=tg[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const ng=js({prefix:"\u{1F680}",name:"base256emoji",encode:rg,decode:ig});var sg=Object.freeze({__proto__:null,base256emoji:ng}),ag=Dc,Sc=128,og=127,fg=~og,cg=Math.pow(2,31);function Dc(r,e,t){e=e||[],t=t||0;for(var i=t;r>=cg;)e[t++]=r&255|Sc,r/=128;for(;r&fg;)e[t++]=r&255|Sc,r>>>=7;return e[t]=r|0,Dc.bytes=t-i+1,e}var hg=io,ug=128,Mc=127;function io(r,i){var t=0,i=i||0,n=0,s=i,o,f=r.length;do{if(s>=f)throw io.bytes=0,new RangeError("Could not decode varint");o=r[s++],t+=n<28?(o&Mc)<<n:(o&Mc)*Math.pow(2,n),n+=7}while(o>=ug);return io.bytes=s-i,t}var dg=Math.pow(2,7),lg=Math.pow(2,14),pg=Math.pow(2,21),gg=Math.pow(2,28),vg=Math.pow(2,35),bg=Math.pow(2,42),mg=Math.pow(2,49),yg=Math.pow(2,56),wg=Math.pow(2,63),_g=function(r){return r<dg?1:r<lg?2:r<pg?3:r<gg?4:r<vg?5:r<bg?6:r<mg?7:r<yg?8:r<wg?9:10},Eg={encode:ag,decode:hg,encodingLength:_g},Ic=Eg;const Rc=(r,e,t=0)=>(Ic.encode(r,e,t),e),Oc=r=>Ic.encodingLength(r),no=(r,e)=>{const t=e.byteLength,i=Oc(r),n=i+Oc(t),s=new Uint8Array(n+t);return Rc(r,s,0),Rc(t,s,i),s.set(e,n),new xg(r,t,e,s)};class xg{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}}const Nc=({name:r,code:e,encode:t})=>new Ag(r,e,t);class Ag{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?no(this.code,t):t.then(i=>no(this.code,i))}else throw Error("Unknown type, must be binary type")}}const Cc=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),Sg=Nc({name:"sha2-256",code:18,encode:Cc("SHA-256")}),Dg=Nc({name:"sha2-512",code:19,encode:Cc("SHA-512")});var Mg=Object.freeze({__proto__:null,sha256:Sg,sha512:Dg});const Pc=0,Ig="identity",Tc=Ec;var Rg=Object.freeze({__proto__:null,identity:{code:Pc,name:Ig,encode:Tc,digest:r=>no(Pc,Tc(r))}});new TextEncoder,new TextDecoder;const Bc={...x1,...S1,...M1,...R1,...C1,...K1,...V1,...Y1,...Z1,...sg};({...Mg,...Rg});function Lc(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const Uc=Lc("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),so=Lc("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=_c(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Fc={utf8:Uc,"utf-8":Uc,hex:Bc.base16,latin1:so,ascii:so,binary:so,...Bc};function Et(r,e="utf8"){const t=Fc[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}function xt(r,e="utf8"){const t=Fc[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}function qc(r){return fn(Et(xt(r,Ks),mc))}function Vs(r){return Et(xt(Ui(r),mc),Ks)}function $c(r){const e=xt(c1,wc),t=f1+Et(ks([e,r]),wc);return[a1,o1,t].join(s1)}function Og(r){return Et(r,Ks)}function Ng(r){return xt(r,Ks)}function Cg(r){return xt([Vs(r.header),Vs(r.payload)].join(zs),yc)}function Pg(r){return[Vs(r.header),Vs(r.payload),Og(r.signature)].join(zs)}function ao(r){const e=r.split(zs),t=qc(e[0]),i=qc(e[1]),n=Ng(e[2]),s=xt(e.slice(0,2).join(zs),yc);return{header:t,payload:i,signature:n,data:s}}function zc(r=wi.randomBytes(h1)){return Xa.generateKeyPairFromSeed(r)}async function Tg(r,e,t,i,n=ae.fromMiliseconds(Date.now())){const s={alg:i1,typ:n1},o=$c(i.publicKey),f=n+t,u={iss:o,sub:r,aud:e,iat:n,exp:f},h=Cg({header:s,payload:u}),p=Xa.sign(i.secretKey,h);return Pg({header:s,payload:u,signature:p})}var Kc=function(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,s;i<n;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return r.concat(s||Array.prototype.slice.call(e))},Bg=function(){function r(e,t,i){this.name=e,this.version=t,this.os=i,this.type="browser"}return r}(),Lg=function(){function r(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return r}(),Ug=function(){function r(e,t,i,n){this.name=e,this.version=t,this.os=i,this.bot=n,this.type="bot-device"}return r}(),Fg=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),qg=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),$g=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,zg=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,kc=3,Kg=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",$g]],jc=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function kg(r){return r?Vc(r):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new qg:typeof navigator<"u"?Vc(navigator.userAgent):Hg()}function jg(r){return r!==""&&Kg.reduce(function(e,t){var i=t[0],n=t[1];if(e)return e;var s=n.exec(r);return!!s&&[i,s]},!1)}function Vc(r){var e=jg(r);if(!e)return null;var t=e[0],i=e[1];if(t==="searchbot")return new Fg;var n=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);n?n.length<kc&&(n=Kc(Kc([],n,!0),Gg(kc-n.length),!0)):n=[];var s=n.join("."),o=Vg(r),f=zg.exec(r);return f&&f[1]?new Ug(t,s,o,f[1]):new Bg(t,s,o)}function Vg(r){for(var e=0,t=jc.length;e<t;e++){var i=jc[e],n=i[0],s=i[1],o=s.exec(r);if(o)return n}return null}function Hg(){var r=typeof process<"u"&&process.version;return r?new Lg(process.version.slice(1)):null}function Gg(r){for(var e=[],t=0;t<r;t++)e.push("0");return e}var at={};Object.defineProperty(at,"__esModule",{value:!0}),at.getLocalStorage=at.getLocalStorageOrThrow=at.getCrypto=at.getCryptoOrThrow=Hc=at.getLocation=at.getLocationOrThrow=oo=at.getNavigator=at.getNavigatorOrThrow=Kn=at.getDocument=at.getDocumentOrThrow=at.getFromWindowOrThrow=at.getFromWindow=void 0;function Fi(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}at.getFromWindow=Fi;function un(r){const e=Fi(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}at.getFromWindowOrThrow=un;function Yg(){return un("document")}at.getDocumentOrThrow=Yg;function Wg(){return Fi("document")}var Kn=at.getDocument=Wg;function Jg(){return un("navigator")}at.getNavigatorOrThrow=Jg;function Qg(){return Fi("navigator")}var oo=at.getNavigator=Qg;function Xg(){return un("location")}at.getLocationOrThrow=Xg;function Zg(){return Fi("location")}var Hc=at.getLocation=Zg;function ev(){return un("crypto")}at.getCryptoOrThrow=ev;function tv(){return Fi("crypto")}at.getCrypto=tv;function rv(){return un("localStorage")}at.getLocalStorageOrThrow=rv;function iv(){return Fi("localStorage")}at.getLocalStorage=iv;var fo={};Object.defineProperty(fo,"__esModule",{value:!0});var Gc=fo.getWindowMetadata=void 0;const Yc=at;function nv(){let r,e;try{r=Yc.getDocumentOrThrow(),e=Yc.getLocationOrThrow()}catch{return null}function t(){const y=r.getElementsByTagName("link"),M=[];for(let D=0;D<y.length;D++){const I=y[D],C=I.getAttribute("rel");if(C&&C.toLowerCase().indexOf("icon")>-1){const K=I.getAttribute("href");if(K)if(K.toLowerCase().indexOf("https:")===-1&&K.toLowerCase().indexOf("http:")===-1&&K.indexOf("//")!==0){let j=e.protocol+"//"+e.host;if(K.indexOf("/")===0)j+=K;else{const B=e.pathname.split("/");B.pop();const k=B.join("/");j+=k+"/"+K}M.push(j)}else if(K.indexOf("//")===0){const j=e.protocol+K;M.push(j)}else M.push(K)}}return M}function i(...y){const M=r.getElementsByTagName("meta");for(let D=0;D<M.length;D++){const I=M[D],C=["itemprop","property","name"].map(K=>I.getAttribute(K)).filter(K=>K?y.includes(K):!1);if(C.length&&C){const K=I.getAttribute("content");if(K)return K}}return""}function n(){let y=i("name","og:site_name","og:title","twitter:title");return y||(y=r.title),y}function s(){return i("description","og:description","twitter:description","keywords")}const o=n(),f=s(),u=e.origin,h=t();return{description:f,url:u,icons:h,name:o}}Gc=fo.getWindowMetadata=nv;var kn={},sv=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Wc="%[a-f0-9]{2}",Jc=new RegExp("("+Wc+")|([^%]+?)","gi"),Qc=new RegExp("("+Wc+")+","gi");function co(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),i=r.slice(e);return Array.prototype.concat.call([],co(t),co(i))}function av(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(Jc)||[],t=1;t<e.length;t++)r=co(e,t).join(""),e=r.match(Jc)||[];return r}}function ov(r){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},t=Qc.exec(r);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{var i=av(t[0]);i!==t[0]&&(e[t[0]]=i)}t=Qc.exec(r)}e["%C2"]="\uFFFD";for(var n=Object.keys(e),s=0;s<n.length;s++){var o=n[s];r=r.replace(new RegExp(o,"g"),e[o])}return r}var fv=function(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch{return ov(r)}},cv=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];const t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]},hv=function(r,e){for(var t={},i=Object.keys(r),n=Array.isArray(e),s=0;s<i.length;s++){var o=i[s],f=r[o];(n?e.indexOf(o)!==-1:e(o,f,r))&&(t[o]=f)}return t};(function(r){const e=sv,t=fv,i=cv,n=hv,s=B=>B==null,o=Symbol("encodeFragmentIdentifier");function f(B){switch(B.arrayFormat){case"index":return k=>(T,q)=>{const $=T.length;return q===void 0||B.skipNull&&q===null||B.skipEmptyString&&q===""?T:q===null?[...T,[p(k,B),"[",$,"]"].join("")]:[...T,[p(k,B),"[",p($,B),"]=",p(q,B)].join("")]};case"bracket":return k=>(T,q)=>q===void 0||B.skipNull&&q===null||B.skipEmptyString&&q===""?T:q===null?[...T,[p(k,B),"[]"].join("")]:[...T,[p(k,B),"[]=",p(q,B)].join("")];case"colon-list-separator":return k=>(T,q)=>q===void 0||B.skipNull&&q===null||B.skipEmptyString&&q===""?T:q===null?[...T,[p(k,B),":list="].join("")]:[...T,[p(k,B),":list=",p(q,B)].join("")];case"comma":case"separator":case"bracket-separator":{const k=B.arrayFormat==="bracket-separator"?"[]=":"=";return T=>(q,$)=>$===void 0||B.skipNull&&$===null||B.skipEmptyString&&$===""?q:($=$===null?"":$,q.length===0?[[p(T,B),k,p($,B)].join("")]:[[q,p($,B)].join(B.arrayFormatSeparator)])}default:return k=>(T,q)=>q===void 0||B.skipNull&&q===null||B.skipEmptyString&&q===""?T:q===null?[...T,p(k,B)]:[...T,[p(k,B),"=",p(q,B)].join("")]}}function u(B){let k;switch(B.arrayFormat){case"index":return(T,q,$)=>{if(k=/\[(\d*)\]$/.exec(T),T=T.replace(/\[\d*\]$/,""),!k){$[T]=q;return}$[T]===void 0&&($[T]={}),$[T][k[1]]=q};case"bracket":return(T,q,$)=>{if(k=/(\[\])$/.exec(T),T=T.replace(/\[\]$/,""),!k){$[T]=q;return}if($[T]===void 0){$[T]=[q];return}$[T]=[].concat($[T],q)};case"colon-list-separator":return(T,q,$)=>{if(k=/(:list)$/.exec(T),T=T.replace(/:list$/,""),!k){$[T]=q;return}if($[T]===void 0){$[T]=[q];return}$[T]=[].concat($[T],q)};case"comma":case"separator":return(T,q,$)=>{const _=typeof q=="string"&&q.includes(B.arrayFormatSeparator),O=typeof q=="string"&&!_&&y(q,B).includes(B.arrayFormatSeparator);q=O?y(q,B):q;const W=_||O?q.split(B.arrayFormatSeparator).map(X=>y(X,B)):q===null?q:y(q,B);$[T]=W};case"bracket-separator":return(T,q,$)=>{const _=/(\[\])$/.test(T);if(T=T.replace(/\[\]$/,""),!_){$[T]=q&&y(q,B);return}const O=q===null?[]:q.split(B.arrayFormatSeparator).map(W=>y(W,B));if($[T]===void 0){$[T]=O;return}$[T]=[].concat($[T],O)};default:return(T,q,$)=>{if($[T]===void 0){$[T]=q;return}$[T]=[].concat($[T],q)}}}function h(B){if(typeof B!="string"||B.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function p(B,k){return k.encode?k.strict?e(B):encodeURIComponent(B):B}function y(B,k){return k.decode?t(B):B}function M(B){return Array.isArray(B)?B.sort():typeof B=="object"?M(Object.keys(B)).sort((k,T)=>Number(k)-Number(T)).map(k=>B[k]):B}function D(B){const k=B.indexOf("#");return k!==-1&&(B=B.slice(0,k)),B}function I(B){let k="";const T=B.indexOf("#");return T!==-1&&(k=B.slice(T)),k}function C(B){B=D(B);const k=B.indexOf("?");return k===-1?"":B.slice(k+1)}function K(B,k){return k.parseNumbers&&!Number.isNaN(Number(B))&&typeof B=="string"&&B.trim()!==""?B=Number(B):k.parseBooleans&&B!==null&&(B.toLowerCase()==="true"||B.toLowerCase()==="false")&&(B=B.toLowerCase()==="true"),B}function j(B,k){k=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},k),h(k.arrayFormatSeparator);const T=u(k),q=Object.create(null);if(typeof B!="string"||(B=B.trim().replace(/^[?#&]/,""),!B))return q;for(const $ of B.split("&")){if($==="")continue;let[_,O]=i(k.decode?$.replace(/\+/g," "):$,"=");O=O===void 0?null:["comma","separator","bracket-separator"].includes(k.arrayFormat)?O:y(O,k),T(y(_,k),O,q)}for(const $ of Object.keys(q)){const _=q[$];if(typeof _=="object"&&_!==null)for(const O of Object.keys(_))_[O]=K(_[O],k);else q[$]=K(_,k)}return k.sort===!1?q:(k.sort===!0?Object.keys(q).sort():Object.keys(q).sort(k.sort)).reduce(($,_)=>{const O=q[_];return O&&typeof O=="object"&&!Array.isArray(O)?$[_]=M(O):$[_]=O,$},Object.create(null))}r.extract=C,r.parse=j,r.stringify=(B,k)=>{if(!B)return"";k=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},k),h(k.arrayFormatSeparator);const T=O=>k.skipNull&&s(B[O])||k.skipEmptyString&&B[O]==="",q=f(k),$={};for(const O of Object.keys(B))T(O)||($[O]=B[O]);const _=Object.keys($);return k.sort!==!1&&_.sort(k.sort),_.map(O=>{const W=B[O];return W===void 0?"":W===null?p(O,k):Array.isArray(W)?W.length===0&&k.arrayFormat==="bracket-separator"?p(O,k)+"[]":W.reduce(q(O),[]).join("&"):p(O,k)+"="+p(W,k)}).filter(O=>O.length>0).join("&")},r.parseUrl=(B,k)=>{k=Object.assign({decode:!0},k);const[T,q]=i(B,"#");return Object.assign({url:T.split("?")[0]||"",query:j(C(B),k)},k&&k.parseFragmentIdentifier&&q?{fragmentIdentifier:y(q,k)}:{})},r.stringifyUrl=(B,k)=>{k=Object.assign({encode:!0,strict:!0,[o]:!0},k);const T=D(B.url).split("?")[0]||"",q=r.extract(B.url),$=r.parse(q,{sort:!1}),_=Object.assign($,B.query);let O=r.stringify(_,k);O&&(O=`?${O}`);let W=I(B.url);return B.fragmentIdentifier&&(W=`#${k[o]?p(B.fragmentIdentifier,k):B.fragmentIdentifier}`),`${T}${O}${W}`},r.pick=(B,k,T)=>{T=Object.assign({parseFragmentIdentifier:!0,[o]:!1},T);const{url:q,query:$,fragmentIdentifier:_}=r.parseUrl(B,T);return r.stringifyUrl({url:q,query:n($,k),fragmentIdentifier:_},T)},r.exclude=(B,k,T)=>{const q=Array.isArray(k)?$=>!k.includes($):($,_)=>!k($,_);return r.pick(B,q,T)}})(kn);var Xc={exports:{}};/**
14
+ ***************************************************************************** */var S0=function(t,e){return S0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},S0(t,e)};function e3(t,e){S0(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var D0=function(){return D0=Object.assign||function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},D0.apply(this,arguments)};function t3(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}function r3(t,e,r,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,i);else for(var h=t.length-1;h>=0;h--)(o=t[h])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s}function i3(t,e){return function(r,i){e(r,i,t)}}function n3(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function s3(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function h(w){try{p(i.next(w))}catch(M){o(M)}}function l(w){try{p(i.throw(w))}catch(M){o(M)}}function p(w){w.done?s(w.value):n(w.value).then(h,l)}p((i=i.apply(t,e||[])).next())})}function a3(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,o;return o={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function h(p){return function(w){return l([p,w])}}function l(p){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=p[0]&2?n.return:p[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,p[1])).done)return s;switch(n=0,s&&(p=[p[0]&2,s.value]),p[0]){case 0:case 1:s=p;break;case 4:return r.label++,{value:p[1],done:!1};case 5:r.label++,n=p[1],p=[0];continue;case 7:p=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(p[0]===6||p[0]===2)){r=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]<s[3])){r.label=p[1];break}if(p[0]===6&&r.label<s[1]){r.label=s[1],s=p;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(p);break}s[2]&&r.ops.pop(),r.trys.pop();continue}p=e.call(t,r)}catch(w){p=[6,w],n=0}finally{i=s=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function f3(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}function o3(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function I0(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Tu(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(h){o={error:h}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function h3(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Tu(arguments[e]));return t}function c3(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],o=0,h=s.length;o<h;o++,n++)i[n]=s[o];return i}function Sa(t){return this instanceof Sa?(this.v=t,this):new Sa(t)}function u3(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(I){i[I]&&(n[I]=function(D){return new Promise(function(N,U){s.push([I,D,N,U])>1||h(I,D)})})}function h(I,D){try{l(i[I](D))}catch(N){M(s[0][3],N)}}function l(I){I.value instanceof Sa?Promise.resolve(I.value.v).then(p,w):M(s[0][2],I)}function p(I){h("next",I)}function w(I){h("throw",I)}function M(I,D){I(D),s.shift(),s.length&&h(s[0][0],s[0][1])}}function d3(t){var e,r;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=t[n]?function(o){return(r=!r)?{value:Sa(t[n](o)),done:n==="return"}:s?s(o):o}:s}}function l3(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof I0=="function"?I0(t):t[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(s){r[s]=t[s]&&function(o){return new Promise(function(h,l){o=t[s](o),n(h,l,o.done,o.value)})}}function n(s,o,h,l){Promise.resolve(l).then(function(p){s({value:p,done:h})},o)}}function p3(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function b3(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function v3(t){return t&&t.__esModule?t:{default:t}}function g3(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function m3(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var y3=Object.freeze({__proto__:null,__extends:e3,get __assign(){return D0},__rest:t3,__decorate:r3,__param:i3,__metadata:n3,__awaiter:s3,__generator:a3,__createBinding:f3,__exportStar:o3,__values:I0,__read:Tu,__spread:h3,__spreadArrays:c3,__await:Sa,__asyncGenerator:u3,__asyncDelegator:d3,__asyncValues:l3,__makeTemplateObject:p3,__importStar:b3,__importDefault:v3,__classPrivateFieldGet:g3,__classPrivateFieldSet:m3}),Tf=If(y3),N0={},Da={},Bu;function w3(){if(Bu)return Da;Bu=1,Object.defineProperty(Da,"__esModule",{value:!0}),Da.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Da.delay=t,Da}var Wn={},O0={},Qn={},Fu;function _3(){return Fu||(Fu=1,Object.defineProperty(Qn,"__esModule",{value:!0}),Qn.ONE_THOUSAND=Qn.ONE_HUNDRED=void 0,Qn.ONE_HUNDRED=100,Qn.ONE_THOUSAND=1e3),Qn}var R0={},Lu;function x3(){return Lu||(Lu=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(R0)),R0}var Uu;function $u(){return Uu||(Uu=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Tf;e.__exportStar(_3(),t),e.__exportStar(x3(),t)}(O0)),O0}var qu;function A3(){if(qu)return Wn;qu=1,Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.fromMiliseconds=Wn.toMiliseconds=void 0;const t=$u();function e(i){return i*t.ONE_THOUSAND}Wn.toMiliseconds=e;function r(i){return Math.floor(i/t.ONE_THOUSAND)}return Wn.fromMiliseconds=r,Wn}var zu;function M3(){return zu||(zu=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Tf;e.__exportStar(w3(),t),e.__exportStar(A3(),t)}(N0)),N0}var Ps={},ku;function E3(){if(ku)return Ps;ku=1,Object.defineProperty(Ps,"__esModule",{value:!0}),Ps.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const i=this.get(r);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const n=Date.now()-i.started;this.timestamps.set(r,{started:i.started,elapsed:n})}get(r){const i=this.timestamps.get(r);if(typeof i>"u")throw new Error(`No timestamp found for label: ${r}`);return i}elapsed(r){const i=this.get(r);return i.elapsed||Date.now()-i.started}}return Ps.Watch=t,Ps.default=t,Ps}var C0={},Ia={},Ku;function S3(){if(Ku)return Ia;Ku=1,Object.defineProperty(Ia,"__esModule",{value:!0}),Ia.IWatch=void 0;class t{}return Ia.IWatch=t,Ia}var Hu;function D3(){return Hu||(Hu=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Tf.__exportStar(S3(),t)}(C0)),C0}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Tf;e.__exportStar(M3(),t),e.__exportStar(E3(),t),e.__exportStar(D3(),t),e.__exportStar($u(),t)})(ze);class Xn{}class I3 extends Xn{constructor(e){super()}}const ju=ze.FIVE_SECONDS,Ts={pulse:"heartbeat_pulse"};class P0 extends I3{constructor(e){super(e),this.events=new Or.exports.EventEmitter,this.interval=ju,this.interval=e?.interval||ju}static async init(e){const r=new P0(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),ze.toMiliseconds(this.interval))}pulse(){this.events.emit(Ts.pulse)}}const N3=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,O3=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,R3=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function C3(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){P3(t);return}return e}function P3(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Bf(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.at(-1)==='"'&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const i=r.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;if(i==="undefined")return;if(i==="null")return null;if(i==="nan")return Number.NaN;if(i==="infinity")return Number.POSITIVE_INFINITY;if(i==="-infinity")return Number.NEGATIVE_INFINITY}if(!R3.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(N3.test(t)||O3.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,C3)}return JSON.parse(t)}catch(i){if(e.strict)throw i;return t}}function T3(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function $t(t,...e){try{return T3(t(...e))}catch(r){return Promise.reject(r)}}function B3(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function F3(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Ff(t){if(B3(t))return String(t);if(F3(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Ff(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Gu(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const T0="base64:";function L3(t){if(typeof t=="string")return t;Gu();const e=Buffer.from(t).toString("base64");return T0+e}function U3(t){return typeof t!="string"||!t.startsWith(T0)?t:(Gu(),Buffer.from(t.slice(T0.length),"base64"))}function Rr(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function $3(...t){return Rr(t.join(":"))}function Lf(t){return t=Rr(t),t?t+":":""}function sR(t){return t}const q3="memory",z3=()=>{const t=new Map;return{name:q3,options:{},hasItem(e){return t.has(e)},getItem(e){return t.get(e)||null},getItemRaw(e){return t.get(e)||null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return Array.from(t.keys())},clear(){t.clear()},dispose(){t.clear()}}};function k3(t={}){const e={mounts:{"":t.driver||z3()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=p=>{for(const w of e.mountpoints)if(p.startsWith(w))return{base:w,relativeKey:p.slice(w.length),driver:e.mounts[w]};return{base:"",relativeKey:p,driver:e.mounts[""]}},i=(p,w)=>e.mountpoints.filter(M=>M.startsWith(p)||w&&p.startsWith(M)).map(M=>({relativeBase:p.length>M.length?p.slice(M.length):void 0,mountpoint:M,driver:e.mounts[M]})),n=(p,w)=>{if(e.watching){w=Rr(w);for(const M of e.watchListeners)M(p,w)}},s=async()=>{if(!e.watching){e.watching=!0;for(const p in e.mounts)e.unwatch[p]=await Vu(e.mounts[p],n,p)}},o=async()=>{if(e.watching){for(const p in e.unwatch)await e.unwatch[p]();e.unwatch={},e.watching=!1}},h=(p,w,M)=>{const I=new Map,D=N=>{let U=I.get(N.base);return U||(U={driver:N.driver,base:N.base,items:[]},I.set(N.base,U)),U};for(const N of p){const U=typeof N=="string",z=Rr(U?N:N.key),H=U?void 0:N.value,L=U||!N.options?w:{...w,...N.options},K=r(z);D(K).items.push({key:z,value:H,relativeKey:K.relativeKey,options:L})}return Promise.all([...I.values()].map(N=>M(N))).then(N=>N.flat())},l={hasItem(p,w={}){p=Rr(p);const{relativeKey:M,driver:I}=r(p);return $t(I.hasItem,M,w)},getItem(p,w={}){p=Rr(p);const{relativeKey:M,driver:I}=r(p);return $t(I.getItem,M,w).then(D=>Bf(D))},getItems(p,w){return h(p,w,M=>M.driver.getItems?$t(M.driver.getItems,M.items.map(I=>({key:I.relativeKey,options:I.options})),w).then(I=>I.map(D=>({key:$3(M.base,D.key),value:Bf(D.value)}))):Promise.all(M.items.map(I=>$t(M.driver.getItem,I.relativeKey,I.options).then(D=>({key:I.key,value:Bf(D)})))))},getItemRaw(p,w={}){p=Rr(p);const{relativeKey:M,driver:I}=r(p);return I.getItemRaw?$t(I.getItemRaw,M,w):$t(I.getItem,M,w).then(D=>U3(D))},async setItem(p,w,M={}){if(w===void 0)return l.removeItem(p);p=Rr(p);const{relativeKey:I,driver:D}=r(p);D.setItem&&(await $t(D.setItem,I,Ff(w),M),D.watch||n("update",p))},async setItems(p,w){await h(p,w,async M=>{M.driver.setItems&&await $t(M.driver.setItems,M.items.map(I=>({key:I.relativeKey,value:Ff(I.value),options:I.options})),w),M.driver.setItem&&await Promise.all(M.items.map(I=>$t(M.driver.setItem,I.relativeKey,Ff(I.value),I.options)))})},async setItemRaw(p,w,M={}){if(w===void 0)return l.removeItem(p,M);p=Rr(p);const{relativeKey:I,driver:D}=r(p);if(D.setItemRaw)await $t(D.setItemRaw,I,w,M);else if(D.setItem)await $t(D.setItem,I,L3(w),M);else return;D.watch||n("update",p)},async removeItem(p,w={}){typeof w=="boolean"&&(w={removeMeta:w}),p=Rr(p);const{relativeKey:M,driver:I}=r(p);I.removeItem&&(await $t(I.removeItem,M,w),(w.removeMeta||w.removeMata)&&await $t(I.removeItem,M+"$",w),I.watch||n("remove",p))},async getMeta(p,w={}){typeof w=="boolean"&&(w={nativeOnly:w}),p=Rr(p);const{relativeKey:M,driver:I}=r(p),D=Object.create(null);if(I.getMeta&&Object.assign(D,await $t(I.getMeta,M,w)),!w.nativeOnly){const N=await $t(I.getItem,M+"$",w).then(U=>Bf(U));N&&typeof N=="object"&&(typeof N.atime=="string"&&(N.atime=new Date(N.atime)),typeof N.mtime=="string"&&(N.mtime=new Date(N.mtime)),Object.assign(D,N))}return D},setMeta(p,w,M={}){return this.setItem(p+"$",w,M)},removeMeta(p,w={}){return this.removeItem(p+"$",w)},async getKeys(p,w={}){p=Lf(p);const M=i(p,!0);let I=[];const D=[];for(const N of M){const z=(await $t(N.driver.getKeys,N.relativeBase,w)).map(H=>N.mountpoint+Rr(H)).filter(H=>!I.some(L=>H.startsWith(L)));D.push(...z),I=[N.mountpoint,...I.filter(H=>!H.startsWith(N.mountpoint))]}return p?D.filter(N=>N.startsWith(p)&&!N.endsWith("$")):D.filter(N=>!N.endsWith("$"))},async clear(p,w={}){p=Lf(p),await Promise.all(i(p,!1).map(async M=>{if(M.driver.clear)return $t(M.driver.clear,M.relativeBase,w);if(M.driver.removeItem){const I=await M.driver.getKeys(M.relativeBase||"",w);return Promise.all(I.map(D=>M.driver.removeItem(D,w)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(p=>Yu(p)))},async watch(p){return await s(),e.watchListeners.push(p),async()=>{e.watchListeners=e.watchListeners.filter(w=>w!==p),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(p,w){if(p=Lf(p),p&&e.mounts[p])throw new Error(`already mounted at ${p}`);return p&&(e.mountpoints.push(p),e.mountpoints.sort((M,I)=>I.length-M.length)),e.mounts[p]=w,e.watching&&Promise.resolve(Vu(w,n,p)).then(M=>{e.unwatch[p]=M}).catch(console.error),l},async unmount(p,w=!0){p=Lf(p),!(!p||!e.mounts[p])&&(e.watching&&p in e.unwatch&&(e.unwatch[p](),delete e.unwatch[p]),w&&await Yu(e.mounts[p]),e.mountpoints=e.mountpoints.filter(M=>M!==p),delete e.mounts[p])},getMount(p=""){p=Rr(p)+":";const w=r(p);return{driver:w.driver,base:w.base}},getMounts(p="",w={}){return p=Rr(p),i(p,w.parents).map(I=>({driver:I.driver,base:I.mountpoint}))}};return l}function Vu(t,e,r){return t.watch?t.watch((i,n)=>e(i,r+n)):()=>{}}async function Yu(t){typeof t.dispose=="function"&&await $t(t.dispose)}function Zn(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function Ju(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const i=Zn(r);return(n,s)=>i.then(o=>s(o.transaction(e,n).objectStore(e)))}let B0;function Na(){return B0||(B0=Ju("keyval-store","keyval")),B0}function Wu(t,e=Na()){return e("readonly",r=>Zn(r.get(t)))}function K3(t,e,r=Na()){return r("readwrite",i=>(i.put(e,t),Zn(i.transaction)))}function H3(t,e=Na()){return e("readwrite",r=>(r.delete(t),Zn(r.transaction)))}function j3(t=Na()){return t("readwrite",e=>(e.clear(),Zn(e.transaction)))}function G3(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Zn(t.transaction)}function V3(t=Na()){return t("readonly",e=>{if(e.getAllKeys)return Zn(e.getAllKeys());const r=[];return G3(e,i=>r.push(i.key)).then(()=>r)})}const Y3=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),J3=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(i,n)=>typeof n=="string"&&n.match(/^\d+n$/)?BigInt(n.substring(0,n.length-1)):n)};function Bs(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return J3(t)}catch{return t}}function es(t){return typeof t=="string"?t:Y3(t)||""}const W3="idb-keyval";var Q3=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=n=>e+n;let i;return t.dbName&&t.storeName&&(i=Ju(t.dbName,t.storeName)),{name:W3,options:t,async hasItem(n){return!(typeof await Wu(r(n),i)>"u")},async getItem(n){return await Wu(r(n),i)??null},setItem(n,s){return K3(r(n),s,i)},removeItem(n){return H3(r(n),i)},getKeys(){return V3(i)},clear(){return j3(i)}}};const X3="WALLET_CONNECT_V2_INDEXED_DB",Z3="keyvaluestorage";class e6{constructor(){this.indexedDb=k3({driver:Q3({dbName:X3,storeName:Z3})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,es(r))}async removeItem(e){await this.indexedDb.removeItem(e)}}var F0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Uf={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,i){this[r]=String(i)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(i){r[i]=void 0,delete r[i]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof F0<"u"&&F0.localStorage?Uf.exports=F0.localStorage:typeof window<"u"&&window.localStorage?Uf.exports=window.localStorage:Uf.exports=new e})();function t6(t){var e;return[t[0],Bs((e=t[1])!=null?e:"")]}class r6{constructor(){this.localStorage=Uf.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(t6)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Bs(r)}async setItem(e,r){this.localStorage.setItem(e,es(r))}async removeItem(e){this.localStorage.removeItem(e)}}const i6="wc_storage_version",Qu=1,n6=async(t,e,r)=>{const i=i6,n=await e.getItem(i);if(n&&n>=Qu){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const h=s.shift();if(!h)continue;const l=h.toLowerCase();if(l.includes("wc@")||l.includes("walletconnect")||l.includes("wc_")||l.includes("wallet_connect")){const p=await t.getItem(h);await e.setItem(h,p),o.push(h)}}await e.setItem(i,Qu),r(e),s6(t,o)},s6=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};class a6{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new r6;this.storage=e;try{const r=new e6;n6(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}}function f6(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var o6=h6;function h6(t,e,r){var i=r&&r.stringify||f6,n=1;if(typeof t=="object"&&t!==null){var s=e.length+n;if(s===1)return t;var o=new Array(s);o[0]=i(t);for(var h=1;h<s;h++)o[h]=i(e[h]);return o.join(" ")}if(typeof t!="string")return t;var l=e.length;if(l===0)return t;for(var p="",w=1-n,M=-1,I=t&&t.length||0,D=0;D<I;){if(t.charCodeAt(D)===37&&D+1<I){switch(M=M>-1?M:0,t.charCodeAt(D+1)){case 100:case 102:if(w>=l||e[w]==null)break;M<D&&(p+=t.slice(M,D)),p+=Number(e[w]),M=D+2,D++;break;case 105:if(w>=l||e[w]==null)break;M<D&&(p+=t.slice(M,D)),p+=Math.floor(Number(e[w])),M=D+2,D++;break;case 79:case 111:case 106:if(w>=l||e[w]===void 0)break;M<D&&(p+=t.slice(M,D));var N=typeof e[w];if(N==="string"){p+="'"+e[w]+"'",M=D+2,D++;break}if(N==="function"){p+=e[w].name||"<anonymous>",M=D+2,D++;break}p+=i(e[w]),M=D+2,D++;break;case 115:if(w>=l)break;M<D&&(p+=t.slice(M,D)),p+=String(e[w]),M=D+2,D++;break;case 37:M<D&&(p+=t.slice(M,D)),p+="%",M=D+2,D++,w--;break}++w}++D}return M===-1?t:(M<I&&(p+=t.slice(M)),p)}const Xu=o6;var an=Ci;const Oa=y6().console||{},c6={mapHttpRequest:qf,mapHttpResponse:qf,wrapRequestSerializer:U0,wrapResponseSerializer:U0,wrapErrorSerializer:U0,req:qf,res:qf,err:b6};function u6(t,e){return Array.isArray(t)?t.filter(function(i){return i!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function Ci(t){t=t||{},t.browser=t.browser||{};const e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const r=t.browser.write||Oa;t.browser.write&&(t.browser.asObject=!0);const i=t.serializers||{},n=u6(t.browser.serialize,i);let s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const h=t.level||"info",l=Object.create(r);l.log||(l.log=Ra),Object.defineProperty(l,"levelVal",{get:w}),Object.defineProperty(l,"level",{get:M,set:I});const p={transmit:e,serialize:n,asObject:t.browser.asObject,levels:o,timestamp:v6(t)};l.levels=Ci.levels,l.level=h,l.setMaxListeners=l.getMaxListeners=l.emit=l.addListener=l.on=l.prependListener=l.once=l.prependOnceListener=l.removeListener=l.removeAllListeners=l.listeners=l.listenerCount=l.eventNames=l.write=l.flush=Ra,l.serializers=i,l._serialize=n,l._stdErrSerialize=s,l.child=D,e&&(l._logEvent=L0());function w(){return this.level==="silent"?1/0:this.levels.values[this.level]}function M(){return this._level}function I(N){if(N!=="silent"&&!this.levels.values[N])throw Error("unknown level "+N);this._level=N,Fs(p,l,"error","log"),Fs(p,l,"fatal","error"),Fs(p,l,"warn","error"),Fs(p,l,"info","log"),Fs(p,l,"debug","log"),Fs(p,l,"trace","log")}function D(N,U){if(!N)throw new Error("missing bindings for child Pino");U=U||{},n&&N.serializers&&(U.serializers=N.serializers);const z=U.serializers;if(n&&z){var H=Object.assign({},i,z),L=t.browser.serialize===!0?Object.keys(H):n;delete N.serializers,$f([N],L,H,this._stdErrSerialize)}function K(F){this._childLevel=(F._childLevel|0)+1,this.error=Ls(F,N,"error"),this.fatal=Ls(F,N,"fatal"),this.warn=Ls(F,N,"warn"),this.info=Ls(F,N,"info"),this.debug=Ls(F,N,"debug"),this.trace=Ls(F,N,"trace"),H&&(this.serializers=H,this._serialize=L),e&&(this._logEvent=L0([].concat(F._logEvent.bindings,N)))}return K.prototype=this,new K(this)}return l}Ci.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},Ci.stdSerializers=c6,Ci.stdTimeFunctions=Object.assign({},{nullTime:Zu,epochTime:ed,unixTime:g6,isoTime:m6});function Fs(t,e,r,i){const n=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Ra:n[r]?n[r]:Oa[r]||Oa[i]||Ra,d6(t,e,r)}function d6(t,e,r){!t.transmit&&e[r]===Ra||(e[r]=function(i){return function(){const s=t.timestamp(),o=new Array(arguments.length),h=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Oa?Oa:this;for(var l=0;l<o.length;l++)o[l]=arguments[l];if(t.serialize&&!t.asObject&&$f(o,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?i.call(h,l6(this,r,o,s)):i.apply(h,o),t.transmit){const p=t.transmit.level||e.level,w=Ci.levels.values[p],M=Ci.levels.values[r];if(M<w)return;p6(this,{ts:s,methodLevel:r,methodValue:M,transmitLevel:p,transmitValue:Ci.levels.values[t.transmit.level||e.level],send:t.transmit.send,val:e.levelVal},o)}}}(e[r]))}function l6(t,e,r,i){t._serialize&&$f(r,t._serialize,t.serializers,t._stdErrSerialize);const n=r.slice();let s=n[0];const o={};i&&(o.time=i),o.level=Ci.levels.values[e];let h=(t._childLevel|0)+1;if(h<1&&(h=1),s!==null&&typeof s=="object"){for(;h--&&typeof n[0]=="object";)Object.assign(o,n.shift());s=n.length?Xu(n.shift(),n):void 0}else typeof s=="string"&&(s=Xu(n.shift(),n));return s!==void 0&&(o.msg=s),o}function $f(t,e,r,i){for(const n in t)if(i&&t[n]instanceof Error)t[n]=Ci.stdSerializers.err(t[n]);else if(typeof t[n]=="object"&&!Array.isArray(t[n]))for(const s in t[n])e&&e.indexOf(s)>-1&&s in r&&(t[n][s]=r[s](t[n][s]))}function Ls(t,e,r){return function(){const i=new Array(1+arguments.length);i[0]=e;for(var n=1;n<i.length;n++)i[n]=arguments[n-1];return t[r].apply(this,i)}}function p6(t,e,r){const i=e.send,n=e.ts,s=e.methodLevel,o=e.methodValue,h=e.val,l=t._logEvent.bindings;$f(r,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=n,t._logEvent.messages=r.filter(function(p){return l.indexOf(p)===-1}),t._logEvent.level.label=s,t._logEvent.level.value=o,i(s,t._logEvent,h),t._logEvent=L0(l)}function L0(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function b6(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const r in t)e[r]===void 0&&(e[r]=t[r]);return e}function v6(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?Zu:ed}function qf(){return{}}function U0(t){return t}function Ra(){}function Zu(){return!1}function ed(){return Date.now()}function g6(){return Math.round(Date.now()/1e3)}function m6(){return new Date(Date.now()).toISOString()}function y6(){function t(e){return typeof e<"u"&&e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return t(self)||t(window)||t(this)||{}}}const w6={level:"info"},Ca="custom_context",$0=1e3*1024;class _6{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class td{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const r=new _6(e);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}}class rd{constructor(e,r=$0){this.level=e??"error",this.levelValue=an.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new td(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===an.levels.values.error?console.error(e):r===an.levels.values.warn?console.warn(e):r===an.levels.values.debug?console.debug(e):r===an.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(es({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new td(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(es({extraMetadata:e})),new Blob(r,{type:"application/json"})}}class x6{constructor(e,r=$0){this.baseChunkLogger=new rd(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),i=document.createElement("a");i.href=r,i.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}}class A6{constructor(e,r=$0){this.baseChunkLogger=new rd(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var M6=Object.defineProperty,E6=Object.defineProperties,S6=Object.getOwnPropertyDescriptors,id=Object.getOwnPropertySymbols,D6=Object.prototype.hasOwnProperty,I6=Object.prototype.propertyIsEnumerable,nd=(t,e,r)=>e in t?M6(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zf=(t,e)=>{for(var r in e||(e={}))D6.call(e,r)&&nd(t,r,e[r]);if(id)for(var r of id(e))I6.call(e,r)&&nd(t,r,e[r]);return t},kf=(t,e)=>E6(t,S6(e));function sd(t){return kf(zf({},t),{level:t?.level||w6.level})}function N6(t,e=Ca){return t[e]||""}function O6(t,e,r=Ca){return t[r]=e,t}function qr(t,e=Ca){let r="";return typeof t.bindings>"u"?r=N6(t,e):r=t.bindings().context||"",r}function R6(t,e,r=Ca){const i=qr(t,r);return i.trim()?`${i}/${e}`:e}function Cr(t,e,r=Ca){const i=R6(t,e,r),n=t.child({context:i});return O6(n,i,r)}function C6(t){var e,r;const i=new x6((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:an(kf(zf({},t.opts),{level:"trace",browser:kf(zf({},(r=t.opts)==null?void 0:r.browser),{write:n=>i.write(n)})})),chunkLoggerController:i}}function P6(t){var e;const r=new A6((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:an(kf(zf({},t.opts),{level:"trace"})),chunkLoggerController:r}}function T6(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?C6(t):P6(t)}class B6 extends Xn{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class F6 extends Xn{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}}class L6{constructor(e,r){this.logger=e,this.core=r}}class U6 extends Xn{constructor(e,r){super(),this.relayer=e,this.logger=r}}class $6 extends Xn{constructor(e){super()}}class q6{constructor(e,r,i,n){this.core=e,this.logger=r,this.name=i}}class z6 extends Xn{constructor(e,r){super(),this.relayer=e,this.logger=r}}class k6 extends Xn{constructor(e,r){super(),this.core=e,this.logger=r}}class K6{constructor(e,r,i){this.core=e,this.logger=r,this.store=i}}class H6{constructor(e,r){this.projectId=e,this.logger=r}}class j6{constructor(e,r,i){this.core=e,this.logger=r,this.telemetryEnabled=i}}class G6{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class V6{constructor(e){this.client=e}}var q0={},In={},Kf={},Hf={};Object.defineProperty(Hf,"__esModule",{value:!0}),Hf.BrowserRandomSource=void 0;const ad=65536;class Y6{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let i=0;i<r.length;i+=ad)this._crypto.getRandomValues(r.subarray(i,i+Math.min(r.length-i,ad)));return r}}Hf.BrowserRandomSource=Y6;function fd(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var jf={},zr={};Object.defineProperty(zr,"__esModule",{value:!0});function J6(t){for(var e=0;e<t.length;e++)t[e]=0;return t}zr.wipe=J6;var W6={},Q6=Object.freeze({__proto__:null,default:W6}),Nn=If(Q6);Object.defineProperty(jf,"__esModule",{value:!0}),jf.NodeRandomSource=void 0;const X6=zr;class Z6{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof fd<"u"){const e=Nn;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const i=new Uint8Array(e);for(let n=0;n<i.length;n++)i[n]=r[n];return(0,X6.wipe)(r),i}}jf.NodeRandomSource=Z6,Object.defineProperty(Kf,"__esModule",{value:!0}),Kf.SystemRandomSource=void 0;const eg=Hf,tg=jf;class rg{constructor(){if(this.isAvailable=!1,this.name="",this._source=new eg.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new tg.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}Kf.SystemRandomSource=rg;var et={},od={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(h,l){var p=h>>>16&65535,w=h&65535,M=l>>>16&65535,I=l&65535;return w*I+(p*I+w*M<<16>>>0)|0}t.mul=Math.imul||e;function r(h,l){return h+l|0}t.add=r;function i(h,l){return h-l|0}t.sub=i;function n(h,l){return h<<l|h>>>32-l}t.rotl=n;function s(h,l){return h<<32-l|h>>>l}t.rotr=s;function o(h){return typeof h=="number"&&isFinite(h)&&Math.floor(h)===h}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(h){return t.isInteger(h)&&h>=-t.MAX_SAFE_INTEGER&&h<=t.MAX_SAFE_INTEGER}})(od),Object.defineProperty(et,"__esModule",{value:!0});var hd=od;function ig(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}et.readInt16BE=ig;function ng(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}et.readUint16BE=ng;function sg(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}et.readInt16LE=sg;function ag(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}et.readUint16LE=ag;function cd(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}et.writeUint16BE=cd,et.writeInt16BE=cd;function ud(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}et.writeUint16LE=ud,et.writeInt16LE=ud;function z0(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}et.readInt32BE=z0;function k0(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}et.readUint32BE=k0;function K0(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}et.readInt32LE=K0;function H0(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}et.readUint32LE=H0;function Gf(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}et.writeUint32BE=Gf,et.writeInt32BE=Gf;function Vf(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}et.writeUint32LE=Vf,et.writeInt32LE=Vf;function fg(t,e){e===void 0&&(e=0);var r=z0(t,e),i=z0(t,e+4);return r*4294967296+i-(i>>31)*4294967296}et.readInt64BE=fg;function og(t,e){e===void 0&&(e=0);var r=k0(t,e),i=k0(t,e+4);return r*4294967296+i}et.readUint64BE=og;function hg(t,e){e===void 0&&(e=0);var r=K0(t,e),i=K0(t,e+4);return i*4294967296+r-(r>>31)*4294967296}et.readInt64LE=hg;function cg(t,e){e===void 0&&(e=0);var r=H0(t,e),i=H0(t,e+4);return i*4294967296+r}et.readUint64LE=cg;function dd(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Gf(t/4294967296>>>0,e,r),Gf(t>>>0,e,r+4),e}et.writeUint64BE=dd,et.writeInt64BE=dd;function ld(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Vf(t>>>0,e,r),Vf(t/4294967296>>>0,e,r+4),e}et.writeUint64LE=ld,et.writeInt64LE=ld;function ug(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=t/8+r-1;s>=r;s--)i+=e[s]*n,n*=256;return i}et.readUintBE=ug;function dg(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=r;s<r+t/8;s++)i+=e[s]*n,n*=256;return i}et.readUintLE=dg;function lg(t,e,r,i){if(r===void 0&&(r=new Uint8Array(t/8)),i===void 0&&(i=0),t%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!hd.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var n=1,s=t/8+i-1;s>=i;s--)r[s]=e/n&255,n*=256;return r}et.writeUintBE=lg;function pg(t,e,r,i){if(r===void 0&&(r=new Uint8Array(t/8)),i===void 0&&(i=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!hd.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var n=1,s=i;s<i+t/8;s++)r[s]=e/n&255,n*=256;return r}et.writeUintLE=pg;function bg(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e)}et.readFloat32BE=bg;function vg(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e,!0)}et.readFloat32LE=vg;function gg(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e)}et.readFloat64BE=gg;function mg(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e,!0)}et.readFloat64LE=mg;function yg(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(r,t),e}et.writeFloat32BE=yg;function wg(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(r,t,!0),e}et.writeFloat32LE=wg;function _g(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(r,t),e}et.writeFloat64BE=_g;function xg(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(r,t,!0),e}et.writeFloat64LE=xg,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const e=Kf,r=et,i=zr;t.defaultRandomSource=new e.SystemRandomSource;function n(p,w=t.defaultRandomSource){return w.randomBytes(p)}t.randomBytes=n;function s(p=t.defaultRandomSource){const w=n(4,p),M=(0,r.readUint32LE)(w);return(0,i.wipe)(w),M}t.randomUint32=s;const o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function h(p,w=o,M=t.defaultRandomSource){if(w.length<2)throw new Error("randomString charset is too short");if(w.length>256)throw new Error("randomString charset is too long");let I="";const D=w.length,N=256-256%D;for(;p>0;){const U=n(Math.ceil(p*256/N),M);for(let z=0;z<U.length&&p>0;z++){const H=U[z];H<N&&(I+=w.charAt(H%D),p--)}(0,i.wipe)(U)}return I}t.randomString=h;function l(p,w=o,M=t.defaultRandomSource){const I=Math.ceil(p/(Math.log(w.length)/Math.LN2));return h(I,w,M)}t.randomStringForEntropy=l}(In);var pd={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=et,r=zr;t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var i=function(){function h(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return h.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},h.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},h.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},h.prototype.update=function(l,p){if(p===void 0&&(p=l.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var w=0;if(this._bytesHashed+=p,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&p>0;)this._buffer[this._bufferLength++]=l[w++],p--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(p>=this.blockSize&&(w=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,l,w,p),p%=this.blockSize);p>0;)this._buffer[this._bufferLength++]=l[w++],p--;return this},h.prototype.finish=function(l){if(!this._finished){var p=this._bytesHashed,w=this._bufferLength,M=p/536870912|0,I=p<<3,D=p%128<112?128:256;this._buffer[w]=128;for(var N=w+1;N<D-8;N++)this._buffer[N]=0;e.writeUint32BE(M,this._buffer,D-8),e.writeUint32BE(I,this._buffer,D-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,D),this._finished=!0}for(var N=0;N<this.digestLength/8;N++)e.writeUint32BE(this._stateHi[N],l,N*8),e.writeUint32BE(this._stateLo[N],l,N*8+4);return this},h.prototype.digest=function(){var l=new Uint8Array(this.digestLength);return this.finish(l),l},h.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},h.prototype.restoreState=function(l){return this._stateHi.set(l.stateHi),this._stateLo.set(l.stateLo),this._bufferLength=l.bufferLength,l.buffer&&this._buffer.set(l.buffer),this._bytesHashed=l.bytesHashed,this._finished=!1,this},h.prototype.cleanSavedState=function(l){r.wipe(l.stateHi),r.wipe(l.stateLo),l.buffer&&r.wipe(l.buffer),l.bufferLength=0,l.bytesHashed=0},h}();t.SHA512=i;var n=new Int32Array([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]);function s(h,l,p,w,M,I,D){for(var N=p[0],U=p[1],z=p[2],H=p[3],L=p[4],K=p[5],F=p[6],$=p[7],q=w[0],y=w[1],R=w[2],V=w[3],Q=w[4],O=w[5],d=w[6],u=w[7],a,f,b,x,A,_,c,m;D>=128;){for(var v=0;v<16;v++){var S=8*v+I;h[v]=e.readUint32BE(M,S),l[v]=e.readUint32BE(M,S+4)}for(var v=0;v<80;v++){var G=N,E=U,k=z,C=H,B=L,P=K,g=F,T=$,j=q,J=y,W=R,X=V,ve=Q,_e=O,ae=d,De=u;if(a=$,f=u,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=(L>>>14|Q<<32-14)^(L>>>18|Q<<32-18)^(Q>>>41-32|L<<32-(41-32)),f=(Q>>>14|L<<32-14)^(Q>>>18|L<<32-18)^(L>>>41-32|Q<<32-(41-32)),A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,a=L&K^~L&F,f=Q&O^~Q&d,A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,a=n[v*2],f=n[v*2+1],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,a=h[v%16],f=l[v%16],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,b=c&65535|m<<16,x=A&65535|_<<16,a=b,f=x,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=(N>>>28|q<<32-28)^(q>>>34-32|N<<32-(34-32))^(q>>>39-32|N<<32-(39-32)),f=(q>>>28|N<<32-28)^(N>>>34-32|q<<32-(34-32))^(N>>>39-32|q<<32-(39-32)),A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,a=N&U^N&z^U&z,f=q&y^q&R^y&R,A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,T=c&65535|m<<16,De=A&65535|_<<16,a=C,f=X,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=b,f=x,A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,C=c&65535|m<<16,X=A&65535|_<<16,U=G,z=E,H=k,L=C,K=B,F=P,$=g,N=T,y=j,R=J,V=W,Q=X,O=ve,d=_e,u=ae,q=De,v%16===15)for(var S=0;S<16;S++)a=h[S],f=l[S],A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=h[(S+9)%16],f=l[(S+9)%16],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,b=h[(S+1)%16],x=l[(S+1)%16],a=(b>>>1|x<<32-1)^(b>>>8|x<<32-8)^b>>>7,f=(x>>>1|b<<32-1)^(x>>>8|b<<32-8)^(x>>>7|b<<32-7),A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,b=h[(S+14)%16],x=l[(S+14)%16],a=(b>>>19|x<<32-19)^(x>>>61-32|b<<32-(61-32))^b>>>6,f=(x>>>19|b<<32-19)^(b>>>61-32|x<<32-(61-32))^(x>>>6|b<<32-6),A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,h[S]=c&65535|m<<16,l[S]=A&65535|_<<16}a=N,f=q,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=p[0],f=w[0],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,p[0]=N=c&65535|m<<16,w[0]=q=A&65535|_<<16,a=U,f=y,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=p[1],f=w[1],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,p[1]=U=c&65535|m<<16,w[1]=y=A&65535|_<<16,a=z,f=R,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=p[2],f=w[2],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,p[2]=z=c&65535|m<<16,w[2]=R=A&65535|_<<16,a=H,f=V,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=p[3],f=w[3],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,p[3]=H=c&65535|m<<16,w[3]=V=A&65535|_<<16,a=L,f=Q,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=p[4],f=w[4],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,p[4]=L=c&65535|m<<16,w[4]=Q=A&65535|_<<16,a=K,f=O,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=p[5],f=w[5],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,p[5]=K=c&65535|m<<16,w[5]=O=A&65535|_<<16,a=F,f=d,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=p[6],f=w[6],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,p[6]=F=c&65535|m<<16,w[6]=d=A&65535|_<<16,a=$,f=u,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=p[7],f=w[7],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,p[7]=$=c&65535|m<<16,w[7]=u=A&65535|_<<16,I+=128,D-=128}return I}function o(h){var l=new i;l.update(h);var p=l.digest();return l.clean(),p}t.hash=o})(pd),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=In,r=pd,i=zr;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function n(C){const B=new Float64Array(16);if(C)for(let P=0;P<C.length;P++)B[P]=C[P];return B}const s=new Uint8Array(32);s[0]=9;const o=n(),h=n([1]),l=n([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),p=n([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),w=n([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),M=n([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),I=n([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function D(C,B){for(let P=0;P<16;P++)C[P]=B[P]|0}function N(C){let B=1;for(let P=0;P<16;P++){let g=C[P]+B+65535;B=Math.floor(g/65536),C[P]=g-B*65536}C[0]+=B-1+37*(B-1)}function U(C,B,P){const g=~(P-1);for(let T=0;T<16;T++){const j=g&(C[T]^B[T]);C[T]^=j,B[T]^=j}}function z(C,B){const P=n(),g=n();for(let T=0;T<16;T++)g[T]=B[T];N(g),N(g),N(g);for(let T=0;T<2;T++){P[0]=g[0]-65517;for(let J=1;J<15;J++)P[J]=g[J]-65535-(P[J-1]>>16&1),P[J-1]&=65535;P[15]=g[15]-32767-(P[14]>>16&1);const j=P[15]>>16&1;P[14]&=65535,U(g,P,1-j)}for(let T=0;T<16;T++)C[2*T]=g[T]&255,C[2*T+1]=g[T]>>8}function H(C,B){let P=0;for(let g=0;g<32;g++)P|=C[g]^B[g];return(1&P-1>>>8)-1}function L(C,B){const P=new Uint8Array(32),g=new Uint8Array(32);return z(P,C),z(g,B),H(P,g)}function K(C){const B=new Uint8Array(32);return z(B,C),B[0]&1}function F(C,B){for(let P=0;P<16;P++)C[P]=B[2*P]+(B[2*P+1]<<8);C[15]&=32767}function $(C,B,P){for(let g=0;g<16;g++)C[g]=B[g]+P[g]}function q(C,B,P){for(let g=0;g<16;g++)C[g]=B[g]-P[g]}function y(C,B,P){let g,T,j=0,J=0,W=0,X=0,ve=0,_e=0,ae=0,De=0,me=0,ie=0,de=0,he=0,te=0,fe=0,se=0,ee=0,le=0,ge=0,re=0,ye=0,we=0,ne=0,xe=0,Ae=0,Me=0,Ke=0,He=0,Ee=0,je=0,Ve=0,Ie=0,Re=P[0],Oe=P[1],ce=P[2],Ce=P[3],Pe=P[4],oe=P[5],Fe=P[6],Le=P[7],pe=P[8],Ue=P[9],$e=P[10],ue=P[11],Te=P[12],Ne=P[13],be=P[14],qe=P[15];g=B[0],j+=g*Re,J+=g*Oe,W+=g*ce,X+=g*Ce,ve+=g*Pe,_e+=g*oe,ae+=g*Fe,De+=g*Le,me+=g*pe,ie+=g*Ue,de+=g*$e,he+=g*ue,te+=g*Te,fe+=g*Ne,se+=g*be,ee+=g*qe,g=B[1],J+=g*Re,W+=g*Oe,X+=g*ce,ve+=g*Ce,_e+=g*Pe,ae+=g*oe,De+=g*Fe,me+=g*Le,ie+=g*pe,de+=g*Ue,he+=g*$e,te+=g*ue,fe+=g*Te,se+=g*Ne,ee+=g*be,le+=g*qe,g=B[2],W+=g*Re,X+=g*Oe,ve+=g*ce,_e+=g*Ce,ae+=g*Pe,De+=g*oe,me+=g*Fe,ie+=g*Le,de+=g*pe,he+=g*Ue,te+=g*$e,fe+=g*ue,se+=g*Te,ee+=g*Ne,le+=g*be,ge+=g*qe,g=B[3],X+=g*Re,ve+=g*Oe,_e+=g*ce,ae+=g*Ce,De+=g*Pe,me+=g*oe,ie+=g*Fe,de+=g*Le,he+=g*pe,te+=g*Ue,fe+=g*$e,se+=g*ue,ee+=g*Te,le+=g*Ne,ge+=g*be,re+=g*qe,g=B[4],ve+=g*Re,_e+=g*Oe,ae+=g*ce,De+=g*Ce,me+=g*Pe,ie+=g*oe,de+=g*Fe,he+=g*Le,te+=g*pe,fe+=g*Ue,se+=g*$e,ee+=g*ue,le+=g*Te,ge+=g*Ne,re+=g*be,ye+=g*qe,g=B[5],_e+=g*Re,ae+=g*Oe,De+=g*ce,me+=g*Ce,ie+=g*Pe,de+=g*oe,he+=g*Fe,te+=g*Le,fe+=g*pe,se+=g*Ue,ee+=g*$e,le+=g*ue,ge+=g*Te,re+=g*Ne,ye+=g*be,we+=g*qe,g=B[6],ae+=g*Re,De+=g*Oe,me+=g*ce,ie+=g*Ce,de+=g*Pe,he+=g*oe,te+=g*Fe,fe+=g*Le,se+=g*pe,ee+=g*Ue,le+=g*$e,ge+=g*ue,re+=g*Te,ye+=g*Ne,we+=g*be,ne+=g*qe,g=B[7],De+=g*Re,me+=g*Oe,ie+=g*ce,de+=g*Ce,he+=g*Pe,te+=g*oe,fe+=g*Fe,se+=g*Le,ee+=g*pe,le+=g*Ue,ge+=g*$e,re+=g*ue,ye+=g*Te,we+=g*Ne,ne+=g*be,xe+=g*qe,g=B[8],me+=g*Re,ie+=g*Oe,de+=g*ce,he+=g*Ce,te+=g*Pe,fe+=g*oe,se+=g*Fe,ee+=g*Le,le+=g*pe,ge+=g*Ue,re+=g*$e,ye+=g*ue,we+=g*Te,ne+=g*Ne,xe+=g*be,Ae+=g*qe,g=B[9],ie+=g*Re,de+=g*Oe,he+=g*ce,te+=g*Ce,fe+=g*Pe,se+=g*oe,ee+=g*Fe,le+=g*Le,ge+=g*pe,re+=g*Ue,ye+=g*$e,we+=g*ue,ne+=g*Te,xe+=g*Ne,Ae+=g*be,Me+=g*qe,g=B[10],de+=g*Re,he+=g*Oe,te+=g*ce,fe+=g*Ce,se+=g*Pe,ee+=g*oe,le+=g*Fe,ge+=g*Le,re+=g*pe,ye+=g*Ue,we+=g*$e,ne+=g*ue,xe+=g*Te,Ae+=g*Ne,Me+=g*be,Ke+=g*qe,g=B[11],he+=g*Re,te+=g*Oe,fe+=g*ce,se+=g*Ce,ee+=g*Pe,le+=g*oe,ge+=g*Fe,re+=g*Le,ye+=g*pe,we+=g*Ue,ne+=g*$e,xe+=g*ue,Ae+=g*Te,Me+=g*Ne,Ke+=g*be,He+=g*qe,g=B[12],te+=g*Re,fe+=g*Oe,se+=g*ce,ee+=g*Ce,le+=g*Pe,ge+=g*oe,re+=g*Fe,ye+=g*Le,we+=g*pe,ne+=g*Ue,xe+=g*$e,Ae+=g*ue,Me+=g*Te,Ke+=g*Ne,He+=g*be,Ee+=g*qe,g=B[13],fe+=g*Re,se+=g*Oe,ee+=g*ce,le+=g*Ce,ge+=g*Pe,re+=g*oe,ye+=g*Fe,we+=g*Le,ne+=g*pe,xe+=g*Ue,Ae+=g*$e,Me+=g*ue,Ke+=g*Te,He+=g*Ne,Ee+=g*be,je+=g*qe,g=B[14],se+=g*Re,ee+=g*Oe,le+=g*ce,ge+=g*Ce,re+=g*Pe,ye+=g*oe,we+=g*Fe,ne+=g*Le,xe+=g*pe,Ae+=g*Ue,Me+=g*$e,Ke+=g*ue,He+=g*Te,Ee+=g*Ne,je+=g*be,Ve+=g*qe,g=B[15],ee+=g*Re,le+=g*Oe,ge+=g*ce,re+=g*Ce,ye+=g*Pe,we+=g*oe,ne+=g*Fe,xe+=g*Le,Ae+=g*pe,Me+=g*Ue,Ke+=g*$e,He+=g*ue,Ee+=g*Te,je+=g*Ne,Ve+=g*be,Ie+=g*qe,j+=38*le,J+=38*ge,W+=38*re,X+=38*ye,ve+=38*we,_e+=38*ne,ae+=38*xe,De+=38*Ae,me+=38*Me,ie+=38*Ke,de+=38*He,he+=38*Ee,te+=38*je,fe+=38*Ve,se+=38*Ie,T=1,g=j+T+65535,T=Math.floor(g/65536),j=g-T*65536,g=J+T+65535,T=Math.floor(g/65536),J=g-T*65536,g=W+T+65535,T=Math.floor(g/65536),W=g-T*65536,g=X+T+65535,T=Math.floor(g/65536),X=g-T*65536,g=ve+T+65535,T=Math.floor(g/65536),ve=g-T*65536,g=_e+T+65535,T=Math.floor(g/65536),_e=g-T*65536,g=ae+T+65535,T=Math.floor(g/65536),ae=g-T*65536,g=De+T+65535,T=Math.floor(g/65536),De=g-T*65536,g=me+T+65535,T=Math.floor(g/65536),me=g-T*65536,g=ie+T+65535,T=Math.floor(g/65536),ie=g-T*65536,g=de+T+65535,T=Math.floor(g/65536),de=g-T*65536,g=he+T+65535,T=Math.floor(g/65536),he=g-T*65536,g=te+T+65535,T=Math.floor(g/65536),te=g-T*65536,g=fe+T+65535,T=Math.floor(g/65536),fe=g-T*65536,g=se+T+65535,T=Math.floor(g/65536),se=g-T*65536,g=ee+T+65535,T=Math.floor(g/65536),ee=g-T*65536,j+=T-1+37*(T-1),T=1,g=j+T+65535,T=Math.floor(g/65536),j=g-T*65536,g=J+T+65535,T=Math.floor(g/65536),J=g-T*65536,g=W+T+65535,T=Math.floor(g/65536),W=g-T*65536,g=X+T+65535,T=Math.floor(g/65536),X=g-T*65536,g=ve+T+65535,T=Math.floor(g/65536),ve=g-T*65536,g=_e+T+65535,T=Math.floor(g/65536),_e=g-T*65536,g=ae+T+65535,T=Math.floor(g/65536),ae=g-T*65536,g=De+T+65535,T=Math.floor(g/65536),De=g-T*65536,g=me+T+65535,T=Math.floor(g/65536),me=g-T*65536,g=ie+T+65535,T=Math.floor(g/65536),ie=g-T*65536,g=de+T+65535,T=Math.floor(g/65536),de=g-T*65536,g=he+T+65535,T=Math.floor(g/65536),he=g-T*65536,g=te+T+65535,T=Math.floor(g/65536),te=g-T*65536,g=fe+T+65535,T=Math.floor(g/65536),fe=g-T*65536,g=se+T+65535,T=Math.floor(g/65536),se=g-T*65536,g=ee+T+65535,T=Math.floor(g/65536),ee=g-T*65536,j+=T-1+37*(T-1),C[0]=j,C[1]=J,C[2]=W,C[3]=X,C[4]=ve,C[5]=_e,C[6]=ae,C[7]=De,C[8]=me,C[9]=ie,C[10]=de,C[11]=he,C[12]=te,C[13]=fe,C[14]=se,C[15]=ee}function R(C,B){y(C,B,B)}function V(C,B){const P=n();let g;for(g=0;g<16;g++)P[g]=B[g];for(g=253;g>=0;g--)R(P,P),g!==2&&g!==4&&y(P,P,B);for(g=0;g<16;g++)C[g]=P[g]}function Q(C,B){const P=n();let g;for(g=0;g<16;g++)P[g]=B[g];for(g=250;g>=0;g--)R(P,P),g!==1&&y(P,P,B);for(g=0;g<16;g++)C[g]=P[g]}function O(C,B){const P=n(),g=n(),T=n(),j=n(),J=n(),W=n(),X=n(),ve=n(),_e=n();q(P,C[1],C[0]),q(_e,B[1],B[0]),y(P,P,_e),$(g,C[0],C[1]),$(_e,B[0],B[1]),y(g,g,_e),y(T,C[3],B[3]),y(T,T,p),y(j,C[2],B[2]),$(j,j,j),q(J,g,P),q(W,j,T),$(X,j,T),$(ve,g,P),y(C[0],J,W),y(C[1],ve,X),y(C[2],X,W),y(C[3],J,ve)}function d(C,B,P){for(let g=0;g<4;g++)U(C[g],B[g],P)}function u(C,B){const P=n(),g=n(),T=n();V(T,B[2]),y(P,B[0],T),y(g,B[1],T),z(C,g),C[31]^=K(P)<<7}function a(C,B,P){D(C[0],o),D(C[1],h),D(C[2],h),D(C[3],o);for(let g=255;g>=0;--g){const T=P[g/8|0]>>(g&7)&1;d(C,B,T),O(B,C),O(C,C),d(C,B,T)}}function f(C,B){const P=[n(),n(),n(),n()];D(P[0],w),D(P[1],M),D(P[2],h),y(P[3],w,M),a(C,P,B)}function b(C){if(C.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const B=(0,r.hash)(C);B[0]&=248,B[31]&=127,B[31]|=64;const P=new Uint8Array(32),g=[n(),n(),n(),n()];f(g,B),u(P,g);const T=new Uint8Array(64);return T.set(C),T.set(P,32),{publicKey:P,secretKey:T}}t.generateKeyPairFromSeed=b;function x(C){const B=(0,e.randomBytes)(32,C),P=b(B);return(0,i.wipe)(B),P}t.generateKeyPair=x;function A(C){if(C.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(C.subarray(32))}t.extractPublicKeyFromSecretKey=A;const _=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function c(C,B){let P,g,T,j;for(g=63;g>=32;--g){for(P=0,T=g-32,j=g-12;T<j;++T)B[T]+=P-16*B[g]*_[T-(g-32)],P=Math.floor((B[T]+128)/256),B[T]-=P*256;B[T]+=P,B[g]=0}for(P=0,T=0;T<32;T++)B[T]+=P-(B[31]>>4)*_[T],P=B[T]>>8,B[T]&=255;for(T=0;T<32;T++)B[T]-=P*_[T];for(g=0;g<32;g++)B[g+1]+=B[g]>>8,C[g]=B[g]&255}function m(C){const B=new Float64Array(64);for(let P=0;P<64;P++)B[P]=C[P];for(let P=0;P<64;P++)C[P]=0;c(C,B)}function v(C,B){const P=new Float64Array(64),g=[n(),n(),n(),n()],T=(0,r.hash)(C.subarray(0,32));T[0]&=248,T[31]&=127,T[31]|=64;const j=new Uint8Array(64);j.set(T.subarray(32),32);const J=new r.SHA512;J.update(j.subarray(32)),J.update(B);const W=J.digest();J.clean(),m(W),f(g,W),u(j,g),J.reset(),J.update(j.subarray(0,32)),J.update(C.subarray(32)),J.update(B);const X=J.digest();m(X);for(let ve=0;ve<32;ve++)P[ve]=W[ve];for(let ve=0;ve<32;ve++)for(let _e=0;_e<32;_e++)P[ve+_e]+=X[ve]*T[_e];return c(j.subarray(32),P),j}t.sign=v;function S(C,B){const P=n(),g=n(),T=n(),j=n(),J=n(),W=n(),X=n();return D(C[2],h),F(C[1],B),R(T,C[1]),y(j,T,l),q(T,T,C[2]),$(j,C[2],j),R(J,j),R(W,J),y(X,W,J),y(P,X,T),y(P,P,j),Q(P,P),y(P,P,T),y(P,P,j),y(P,P,j),y(C[0],P,j),R(g,C[0]),y(g,g,j),L(g,T)&&y(C[0],C[0],I),R(g,C[0]),y(g,g,j),L(g,T)?-1:(K(C[0])===B[31]>>7&&q(C[0],o,C[0]),y(C[3],C[0],C[1]),0)}function G(C,B,P){const g=new Uint8Array(32),T=[n(),n(),n(),n()],j=[n(),n(),n(),n()];if(P.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(S(j,C))return!1;const J=new r.SHA512;J.update(P.subarray(0,32)),J.update(C),J.update(B);const W=J.digest();return m(W),a(T,j,W),f(j,P.subarray(32)),O(T,j),u(g,T),!H(P,g)}t.verify=G;function E(C){let B=[n(),n(),n(),n()];if(S(B,C))throw new Error("Ed25519: invalid public key");let P=n(),g=n(),T=B[1];$(P,h,T),q(g,h,T),V(g,g),y(P,P,g);let j=new Uint8Array(32);return z(j,P),j}t.convertPublicKeyToX25519=E;function k(C){const B=(0,r.hash)(C.subarray(0,32));B[0]&=248,B[31]&=127,B[31]|=64;const P=new Uint8Array(B.subarray(0,32));return(0,i.wipe)(B),P}t.convertSecretKeyToX25519=k}(q0);const Ag="EdDSA",Mg="JWT",Yf=".",Jf="base64url",bd="utf8",vd="utf8",Eg=":",Sg="did",Dg="key",gd="base58btc",Ig="z",Ng="K36",Og=32;function j0(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function md(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?j0(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Rg(t,e){e||(e=t.reduce((n,s)=>n+s.length,0));const r=md(e);let i=0;for(const n of t)r.set(n,i),i+=n.length;return j0(r)}function Cg(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<t.length;n++){var s=t.charAt(n),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=n}var h=t.length,l=t.charAt(0),p=Math.log(h)/Math.log(256),w=Math.log(256)/Math.log(h);function M(N){if(N instanceof Uint8Array||(ArrayBuffer.isView(N)?N=new Uint8Array(N.buffer,N.byteOffset,N.byteLength):Array.isArray(N)&&(N=Uint8Array.from(N))),!(N instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(N.length===0)return"";for(var U=0,z=0,H=0,L=N.length;H!==L&&N[H]===0;)H++,U++;for(var K=(L-H)*w+1>>>0,F=new Uint8Array(K);H!==L;){for(var $=N[H],q=0,y=K-1;($!==0||q<z)&&y!==-1;y--,q++)$+=256*F[y]>>>0,F[y]=$%h>>>0,$=$/h>>>0;if($!==0)throw new Error("Non-zero carry");z=q,H++}for(var R=K-z;R!==K&&F[R]===0;)R++;for(var V=l.repeat(U);R<K;++R)V+=t.charAt(F[R]);return V}function I(N){if(typeof N!="string")throw new TypeError("Expected String");if(N.length===0)return new Uint8Array;var U=0;if(N[U]!==" "){for(var z=0,H=0;N[U]===l;)z++,U++;for(var L=(N.length-U)*p+1>>>0,K=new Uint8Array(L);N[U];){var F=r[N.charCodeAt(U)];if(F===255)return;for(var $=0,q=L-1;(F!==0||$<H)&&q!==-1;q--,$++)F+=h*K[q]>>>0,K[q]=F%256>>>0,F=F/256>>>0;if(F!==0)throw new Error("Non-zero carry");H=$,U++}if(N[U]!==" "){for(var y=L-H;y!==L&&K[y]===0;)y++;for(var R=new Uint8Array(z+(L-y)),V=z;y!==L;)R[V++]=K[y++];return R}}}function D(N){var U=I(N);if(U)return U;throw new Error(`Non-${e} character`)}return{encode:M,decodeUnsafe:I,decode:D}}var Pg=Cg,Tg=Pg;const yd=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")},Bg=t=>new TextEncoder().encode(t),Fg=t=>new TextDecoder().decode(t);class Lg{constructor(e,r,i){this.name=e,this.prefix=r,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Ug{constructor(e,r,i){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=i}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 wd(this,e)}}class $g{constructor(e){this.decoders=e}or(e){return wd(this,e)}decode(e){const r=e[0],i=this.decoders[r];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const wd=(t,e)=>new $g({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class qg{constructor(e,r,i,n){this.name=e,this.prefix=r,this.baseEncode=i,this.baseDecode=n,this.encoder=new Lg(e,r,i),this.decoder=new Ug(e,r,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Wf=({name:t,prefix:e,encode:r,decode:i})=>new qg(t,e,r,i),Pa=({prefix:t,name:e,alphabet:r})=>{const{encode:i,decode:n}=Tg(r,e);return Wf({prefix:t,name:e,encode:i,decode:s=>yd(n(s))})},zg=(t,e,r,i)=>{const n={};for(let w=0;w<e.length;++w)n[e[w]]=w;let s=t.length;for(;t[s-1]==="=";)--s;const o=new Uint8Array(s*r/8|0);let h=0,l=0,p=0;for(let w=0;w<s;++w){const M=n[t[w]];if(M===void 0)throw new SyntaxError(`Non-${i} character`);l=l<<r|M,h+=r,h>=8&&(h-=8,o[p++]=255&l>>h)}if(h>=r||255&l<<8-h)throw new SyntaxError("Unexpected end of data");return o},kg=(t,e,r)=>{const i=e[e.length-1]==="=",n=(1<<r)-1;let s="",o=0,h=0;for(let l=0;l<t.length;++l)for(h=h<<8|t[l],o+=8;o>r;)o-=r,s+=e[n&h>>o];if(o&&(s+=e[n&h<<r-o]),i)for(;s.length*r&7;)s+="=";return s},Qt=({name:t,prefix:e,bitsPerChar:r,alphabet:i})=>Wf({prefix:e,name:t,encode(n){return kg(n,i,r)},decode(n){return zg(n,i,r,t)}}),Kg=Wf({prefix:"\0",name:"identity",encode:t=>Fg(t),decode:t=>Bg(t)});var Hg=Object.freeze({__proto__:null,identity:Kg});const jg=Qt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Gg=Object.freeze({__proto__:null,base2:jg});const Vg=Qt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Yg=Object.freeze({__proto__:null,base8:Vg});const Jg=Pa({prefix:"9",name:"base10",alphabet:"0123456789"});var Wg=Object.freeze({__proto__:null,base10:Jg});const Qg=Qt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Xg=Qt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Zg=Object.freeze({__proto__:null,base16:Qg,base16upper:Xg});const e5=Qt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),t5=Qt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),r5=Qt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),i5=Qt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),n5=Qt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),s5=Qt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),a5=Qt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),f5=Qt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),o5=Qt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var h5=Object.freeze({__proto__:null,base32:e5,base32upper:t5,base32pad:r5,base32padupper:i5,base32hex:n5,base32hexupper:s5,base32hexpad:a5,base32hexpadupper:f5,base32z:o5});const c5=Pa({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),u5=Pa({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var d5=Object.freeze({__proto__:null,base36:c5,base36upper:u5});const l5=Pa({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),p5=Pa({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var b5=Object.freeze({__proto__:null,base58btc:l5,base58flickr:p5});const v5=Qt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),g5=Qt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),m5=Qt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),y5=Qt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var w5=Object.freeze({__proto__:null,base64:v5,base64pad:g5,base64url:m5,base64urlpad:y5});const _d=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}"),_5=_d.reduce((t,e,r)=>(t[r]=e,t),[]),x5=_d.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function A5(t){return t.reduce((e,r)=>(e+=_5[r],e),"")}function M5(t){const e=[];for(const r of t){const i=x5[r.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(i)}return new Uint8Array(e)}const E5=Wf({prefix:"\u{1F680}",name:"base256emoji",encode:A5,decode:M5});var S5=Object.freeze({__proto__:null,base256emoji:E5}),D5=Ad,xd=128,I5=127,N5=~I5,O5=Math.pow(2,31);function Ad(t,e,r){e=e||[],r=r||0;for(var i=r;t>=O5;)e[r++]=t&255|xd,t/=128;for(;t&N5;)e[r++]=t&255|xd,t>>>=7;return e[r]=t|0,Ad.bytes=r-i+1,e}var R5=G0,C5=128,Md=127;function G0(t,i){var r=0,i=i||0,n=0,s=i,o,h=t.length;do{if(s>=h)throw G0.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=n<28?(o&Md)<<n:(o&Md)*Math.pow(2,n),n+=7}while(o>=C5);return G0.bytes=s-i,r}var P5=Math.pow(2,7),T5=Math.pow(2,14),B5=Math.pow(2,21),F5=Math.pow(2,28),L5=Math.pow(2,35),U5=Math.pow(2,42),$5=Math.pow(2,49),q5=Math.pow(2,56),z5=Math.pow(2,63),k5=function(t){return t<P5?1:t<T5?2:t<B5?3:t<F5?4:t<L5?5:t<U5?6:t<$5?7:t<q5?8:t<z5?9:10},K5={encode:D5,decode:R5,encodingLength:k5},Ed=K5;const Sd=(t,e,r=0)=>(Ed.encode(t,e,r),e),Dd=t=>Ed.encodingLength(t),V0=(t,e)=>{const r=e.byteLength,i=Dd(t),n=i+Dd(r),s=new Uint8Array(n+r);return Sd(t,s,0),Sd(r,s,i),s.set(e,n),new H5(t,r,e,s)};class H5{constructor(e,r,i,n){this.code=e,this.size=r,this.digest=i,this.bytes=n}}const Id=({name:t,code:e,encode:r})=>new j5(t,e,r);class j5{constructor(e,r,i){this.name=e,this.code=r,this.encode=i}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?V0(this.code,r):r.then(i=>V0(this.code,i))}else throw Error("Unknown type, must be binary type")}}const Nd=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),G5=Id({name:"sha2-256",code:18,encode:Nd("SHA-256")}),V5=Id({name:"sha2-512",code:19,encode:Nd("SHA-512")});var Y5=Object.freeze({__proto__:null,sha256:G5,sha512:V5});const Od=0,J5="identity",Rd=yd;var W5=Object.freeze({__proto__:null,identity:{code:Od,name:J5,encode:Rd,digest:t=>V0(Od,Rd(t))}});new TextEncoder,new TextDecoder;const Us={...Hg,...Gg,...Yg,...Wg,...Zg,...h5,...d5,...b5,...w5,...S5};({...Y5,...W5});function Cd(t,e,r,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:i}}}const Pd=Cd("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Y0=Cd("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);const e=md(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Td={utf8:Pd,"utf-8":Pd,hex:Us.base16,latin1:Y0,ascii:Y0,binary:Y0,...Us};function Qf(t,e="utf8"){const r=Td[e];if(!r)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 $s(t,e="utf8"){const r=Td[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?j0(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function Bd(t){return Bs(Qf($s(t,Jf),bd))}function Xf(t){return Qf($s(es(t),bd),Jf)}function Fd(t){const e=$s(Ng,gd),r=Ig+Qf(Rg([e,t]),gd);return[Sg,Dg,r].join(Eg)}function Q5(t){return Qf(t,Jf)}function X5(t){return $s(t,Jf)}function Z5(t){return $s([Xf(t.header),Xf(t.payload)].join(Yf),vd)}function e8(t){return[Xf(t.header),Xf(t.payload),Q5(t.signature)].join(Yf)}function J0(t){const e=t.split(Yf),r=Bd(e[0]),i=Bd(e[1]),n=X5(e[2]),s=$s(e.slice(0,2).join(Yf),vd);return{header:r,payload:i,signature:n,data:s}}function Ld(t=In.randomBytes(Og)){return q0.generateKeyPairFromSeed(t)}async function t8(t,e,r,i,n=ze.fromMiliseconds(Date.now())){const s={alg:Ag,typ:Mg},o=Fd(i.publicKey),h=n+r,l={iss:o,sub:t,aud:e,iat:n,exp:h},p=Z5({header:s,payload:l}),w=q0.sign(i.secretKey,p);return e8({header:s,payload:l,signature:w})}var Ud=function(t,e,r){if(r||arguments.length===2)for(var i=0,n=e.length,s;i<n;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return t.concat(s||Array.prototype.slice.call(e))},r8=function(){function t(e,r,i){this.name=e,this.version=r,this.os=i,this.type="browser"}return t}(),i8=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return t}(),n8=function(){function t(e,r,i,n){this.name=e,this.version=r,this.os=i,this.bot=n,this.type="bot-device"}return t}(),s8=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),a8=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),f8=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,o8=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,$d=3,h8=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",f8]],qd=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function c8(t){return t?zd(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new a8:typeof navigator<"u"?zd(navigator.userAgent):l8()}function u8(t){return t!==""&&h8.reduce(function(e,r){var i=r[0],n=r[1];if(e)return e;var s=n.exec(t);return!!s&&[i,s]},!1)}function zd(t){var e=u8(t);if(!e)return null;var r=e[0],i=e[1];if(r==="searchbot")return new s8;var n=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);n?n.length<$d&&(n=Ud(Ud([],n,!0),p8($d-n.length),!0)):n=[];var s=n.join("."),o=d8(t),h=o8.exec(t);return h&&h[1]?new n8(r,s,o,h[1]):new r8(r,s,o)}function d8(t){for(var e=0,r=qd.length;e<r;e++){var i=qd[e],n=i[0],s=i[1],o=s.exec(t);if(o)return n}return null}function l8(){var t=typeof process<"u"&&process.version;return t?new i8(process.version.slice(1)):null}function p8(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}var gt={};Object.defineProperty(gt,"__esModule",{value:!0}),gt.getLocalStorage=gt.getLocalStorageOrThrow=gt.getCrypto=gt.getCryptoOrThrow=kd=gt.getLocation=gt.getLocationOrThrow=W0=gt.getNavigator=gt.getNavigatorOrThrow=Ta=gt.getDocument=gt.getDocumentOrThrow=gt.getFromWindowOrThrow=gt.getFromWindow=void 0;function ts(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}gt.getFromWindow=ts;function qs(t){const e=ts(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}gt.getFromWindowOrThrow=qs;function b8(){return qs("document")}gt.getDocumentOrThrow=b8;function v8(){return ts("document")}var Ta=gt.getDocument=v8;function g8(){return qs("navigator")}gt.getNavigatorOrThrow=g8;function m8(){return ts("navigator")}var W0=gt.getNavigator=m8;function y8(){return qs("location")}gt.getLocationOrThrow=y8;function w8(){return ts("location")}var kd=gt.getLocation=w8;function _8(){return qs("crypto")}gt.getCryptoOrThrow=_8;function x8(){return ts("crypto")}gt.getCrypto=x8;function A8(){return qs("localStorage")}gt.getLocalStorageOrThrow=A8;function M8(){return ts("localStorage")}gt.getLocalStorage=M8;var Q0={};Object.defineProperty(Q0,"__esModule",{value:!0});var Kd=Q0.getWindowMetadata=void 0;const Hd=gt;function E8(){let t,e;try{t=Hd.getDocumentOrThrow(),e=Hd.getLocationOrThrow()}catch{return null}function r(){const M=t.getElementsByTagName("link"),I=[];for(let D=0;D<M.length;D++){const N=M[D],U=N.getAttribute("rel");if(U&&U.toLowerCase().indexOf("icon")>-1){const z=N.getAttribute("href");if(z)if(z.toLowerCase().indexOf("https:")===-1&&z.toLowerCase().indexOf("http:")===-1&&z.indexOf("//")!==0){let H=e.protocol+"//"+e.host;if(z.indexOf("/")===0)H+=z;else{const L=e.pathname.split("/");L.pop();const K=L.join("/");H+=K+"/"+z}I.push(H)}else if(z.indexOf("//")===0){const H=e.protocol+z;I.push(H)}else I.push(z)}}return I}function i(...M){const I=t.getElementsByTagName("meta");for(let D=0;D<I.length;D++){const N=I[D],U=["itemprop","property","name"].map(z=>N.getAttribute(z)).filter(z=>z?M.includes(z):!1);if(U.length&&U){const z=N.getAttribute("content");if(z)return z}}return""}function n(){let M=i("name","og:site_name","og:title","twitter:title");return M||(M=t.title),M}function s(){return i("description","og:description","twitter:description","keywords")}const o=n(),h=s(),l=e.origin,p=r();return{description:h,url:l,icons:p,name:o}}Kd=Q0.getWindowMetadata=E8;var Ba={},S8=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),jd="%[a-f0-9]{2}",Gd=new RegExp("("+jd+")|([^%]+?)","gi"),Vd=new RegExp("("+jd+")+","gi");function X0(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),i=t.slice(e);return Array.prototype.concat.call([],X0(r),X0(i))}function D8(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(Gd)||[],r=1;r<e.length;r++)t=X0(e,r).join(""),e=t.match(Gd)||[];return t}}function I8(t){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},r=Vd.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch{var i=D8(r[0]);i!==r[0]&&(e[r[0]]=i)}r=Vd.exec(t)}e["%C2"]="\uFFFD";for(var n=Object.keys(e),s=0;s<n.length;s++){var o=n[s];t=t.replace(new RegExp(o,"g"),e[o])}return t}var N8=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return I8(t)}},O8=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},R8=function(t,e){for(var r={},i=Object.keys(t),n=Array.isArray(e),s=0;s<i.length;s++){var o=i[s],h=t[o];(n?e.indexOf(o)!==-1:e(o,h,t))&&(r[o]=h)}return r};(function(t){const e=S8,r=N8,i=O8,n=R8,s=L=>L==null,o=Symbol("encodeFragmentIdentifier");function h(L){switch(L.arrayFormat){case"index":return K=>(F,$)=>{const q=F.length;return $===void 0||L.skipNull&&$===null||L.skipEmptyString&&$===""?F:$===null?[...F,[w(K,L),"[",q,"]"].join("")]:[...F,[w(K,L),"[",w(q,L),"]=",w($,L)].join("")]};case"bracket":return K=>(F,$)=>$===void 0||L.skipNull&&$===null||L.skipEmptyString&&$===""?F:$===null?[...F,[w(K,L),"[]"].join("")]:[...F,[w(K,L),"[]=",w($,L)].join("")];case"colon-list-separator":return K=>(F,$)=>$===void 0||L.skipNull&&$===null||L.skipEmptyString&&$===""?F:$===null?[...F,[w(K,L),":list="].join("")]:[...F,[w(K,L),":list=",w($,L)].join("")];case"comma":case"separator":case"bracket-separator":{const K=L.arrayFormat==="bracket-separator"?"[]=":"=";return F=>($,q)=>q===void 0||L.skipNull&&q===null||L.skipEmptyString&&q===""?$:(q=q===null?"":q,$.length===0?[[w(F,L),K,w(q,L)].join("")]:[[$,w(q,L)].join(L.arrayFormatSeparator)])}default:return K=>(F,$)=>$===void 0||L.skipNull&&$===null||L.skipEmptyString&&$===""?F:$===null?[...F,w(K,L)]:[...F,[w(K,L),"=",w($,L)].join("")]}}function l(L){let K;switch(L.arrayFormat){case"index":return(F,$,q)=>{if(K=/\[(\d*)\]$/.exec(F),F=F.replace(/\[\d*\]$/,""),!K){q[F]=$;return}q[F]===void 0&&(q[F]={}),q[F][K[1]]=$};case"bracket":return(F,$,q)=>{if(K=/(\[\])$/.exec(F),F=F.replace(/\[\]$/,""),!K){q[F]=$;return}if(q[F]===void 0){q[F]=[$];return}q[F]=[].concat(q[F],$)};case"colon-list-separator":return(F,$,q)=>{if(K=/(:list)$/.exec(F),F=F.replace(/:list$/,""),!K){q[F]=$;return}if(q[F]===void 0){q[F]=[$];return}q[F]=[].concat(q[F],$)};case"comma":case"separator":return(F,$,q)=>{const y=typeof $=="string"&&$.includes(L.arrayFormatSeparator),R=typeof $=="string"&&!y&&M($,L).includes(L.arrayFormatSeparator);$=R?M($,L):$;const V=y||R?$.split(L.arrayFormatSeparator).map(Q=>M(Q,L)):$===null?$:M($,L);q[F]=V};case"bracket-separator":return(F,$,q)=>{const y=/(\[\])$/.test(F);if(F=F.replace(/\[\]$/,""),!y){q[F]=$&&M($,L);return}const R=$===null?[]:$.split(L.arrayFormatSeparator).map(V=>M(V,L));if(q[F]===void 0){q[F]=R;return}q[F]=[].concat(q[F],R)};default:return(F,$,q)=>{if(q[F]===void 0){q[F]=$;return}q[F]=[].concat(q[F],$)}}}function p(L){if(typeof L!="string"||L.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function w(L,K){return K.encode?K.strict?e(L):encodeURIComponent(L):L}function M(L,K){return K.decode?r(L):L}function I(L){return Array.isArray(L)?L.sort():typeof L=="object"?I(Object.keys(L)).sort((K,F)=>Number(K)-Number(F)).map(K=>L[K]):L}function D(L){const K=L.indexOf("#");return K!==-1&&(L=L.slice(0,K)),L}function N(L){let K="";const F=L.indexOf("#");return F!==-1&&(K=L.slice(F)),K}function U(L){L=D(L);const K=L.indexOf("?");return K===-1?"":L.slice(K+1)}function z(L,K){return K.parseNumbers&&!Number.isNaN(Number(L))&&typeof L=="string"&&L.trim()!==""?L=Number(L):K.parseBooleans&&L!==null&&(L.toLowerCase()==="true"||L.toLowerCase()==="false")&&(L=L.toLowerCase()==="true"),L}function H(L,K){K=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},K),p(K.arrayFormatSeparator);const F=l(K),$=Object.create(null);if(typeof L!="string"||(L=L.trim().replace(/^[?#&]/,""),!L))return $;for(const q of L.split("&")){if(q==="")continue;let[y,R]=i(K.decode?q.replace(/\+/g," "):q,"=");R=R===void 0?null:["comma","separator","bracket-separator"].includes(K.arrayFormat)?R:M(R,K),F(M(y,K),R,$)}for(const q of Object.keys($)){const y=$[q];if(typeof y=="object"&&y!==null)for(const R of Object.keys(y))y[R]=z(y[R],K);else $[q]=z(y,K)}return K.sort===!1?$:(K.sort===!0?Object.keys($).sort():Object.keys($).sort(K.sort)).reduce((q,y)=>{const R=$[y];return R&&typeof R=="object"&&!Array.isArray(R)?q[y]=I(R):q[y]=R,q},Object.create(null))}t.extract=U,t.parse=H,t.stringify=(L,K)=>{if(!L)return"";K=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},K),p(K.arrayFormatSeparator);const F=R=>K.skipNull&&s(L[R])||K.skipEmptyString&&L[R]==="",$=h(K),q={};for(const R of Object.keys(L))F(R)||(q[R]=L[R]);const y=Object.keys(q);return K.sort!==!1&&y.sort(K.sort),y.map(R=>{const V=L[R];return V===void 0?"":V===null?w(R,K):Array.isArray(V)?V.length===0&&K.arrayFormat==="bracket-separator"?w(R,K)+"[]":V.reduce($(R),[]).join("&"):w(R,K)+"="+w(V,K)}).filter(R=>R.length>0).join("&")},t.parseUrl=(L,K)=>{K=Object.assign({decode:!0},K);const[F,$]=i(L,"#");return Object.assign({url:F.split("?")[0]||"",query:H(U(L),K)},K&&K.parseFragmentIdentifier&&$?{fragmentIdentifier:M($,K)}:{})},t.stringifyUrl=(L,K)=>{K=Object.assign({encode:!0,strict:!0,[o]:!0},K);const F=D(L.url).split("?")[0]||"",$=t.extract(L.url),q=t.parse($,{sort:!1}),y=Object.assign(q,L.query);let R=t.stringify(y,K);R&&(R=`?${R}`);let V=N(L.url);return L.fragmentIdentifier&&(V=`#${K[o]?w(L.fragmentIdentifier,K):L.fragmentIdentifier}`),`${F}${R}${V}`},t.pick=(L,K,F)=>{F=Object.assign({parseFragmentIdentifier:!0,[o]:!1},F);const{url:$,query:q,fragmentIdentifier:y}=t.parseUrl(L,F);return t.stringifyUrl({url:$,query:n(q,K),fragmentIdentifier:y},F)},t.exclude=(L,K,F)=>{const $=Array.isArray(K)?q=>!K.includes(q):(q,y)=>!K(q,y);return t.pick(L,$,F)}})(Ba);var Yd={exports:{}};/**
15
15
  * [js-sha3]{@link https://github.com/emn178/js-sha3}
16
16
  *
17
17
  * @version 0.8.0
18
18
  * @author Chen, Yi-Cyuan [emn178@gmail.com]
19
19
  * @copyright Chen, Yi-Cyuan 2015-2018
20
20
  * @license MIT
21
- */(function(r){(function(){var e="input is invalid type",t="finalize already called",i=typeof window=="object",n=i?window:{};n.JS_SHA3_NO_WINDOW&&(i=!1);var s=!i&&typeof self=="object",o=!n.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?n=Ot:s&&(n=self);var f=!n.JS_SHA3_NO_COMMON_JS&&!0&&r.exports,u=!n.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",h="0123456789abcdef".split(""),p=[31,7936,2031616,520093696],y=[4,1024,262144,67108864],M=[1,256,65536,16777216],D=[6,1536,393216,100663296],I=[0,8,16,24],C=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],K=[224,256,384,512],j=[128,256],B=["hex","buffer","arrayBuffer","array","digest"],k={128:168,256:136};(n.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(S){return Object.prototype.toString.call(S)==="[object Array]"}),u&&(n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(S){return typeof S=="object"&&S.buffer&&S.buffer.constructor===ArrayBuffer});for(var T=function(S,V,P){return function(F){return new b(S,V,S).update(F)[P]()}},q=function(S,V,P){return function(F,L){return new b(S,V,L).update(F)[P]()}},$=function(S,V,P){return function(F,L,m,U){return a["cshake"+S].update(F,L,m,U)[P]()}},_=function(S,V,P){return function(F,L,m,U){return a["kmac"+S].update(F,L,m,U)[P]()}},O=function(S,V,P,F){for(var L=0;L<B.length;++L){var m=B[L];S[m]=V(P,F,m)}return S},W=function(S,V){var P=T(S,V,"hex");return P.create=function(){return new b(S,V,S)},P.update=function(F){return P.create().update(F)},O(P,T,S,V)},X=function(S,V){var P=q(S,V,"hex");return P.create=function(F){return new b(S,V,F)},P.update=function(F,L){return P.create(L).update(F)},O(P,q,S,V)},N=function(S,V){var P=k[S],F=$(S,V,"hex");return F.create=function(L,m,U){return!m&&!U?a["shake"+S].create(L):new b(S,V,L).bytepad([m,U],P)},F.update=function(L,m,U,G){return F.create(m,U,G).update(L)},O(F,$,S,V)},g=function(S,V){var P=k[S],F=_(S,V,"hex");return F.create=function(L,m,U){return new R(S,V,m).bytepad(["KMAC",U],P).bytepad([L],P)},F.update=function(L,m,U,G){return F.create(L,U,G).update(m)},O(F,_,S,V)},l=[{name:"keccak",padding:M,bits:K,createMethod:W},{name:"sha3",padding:D,bits:K,createMethod:W},{name:"shake",padding:p,bits:j,createMethod:X},{name:"cshake",padding:y,bits:j,createMethod:N},{name:"kmac",padding:y,bits:j,createMethod:g}],a={},c=[],v=0;v<l.length;++v)for(var x=l[v],A=x.bits,E=0;E<A.length;++E){var d=x.name+"_"+A[E];if(c.push(d),a[d]=x.createMethod(A[E],x.padding),x.name!=="sha3"){var w=x.name+A[E];c.push(w),a[w]=a[d]}}function b(S,V,P){this.blocks=[],this.s=[],this.padding=V,this.outputBits=P,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(S<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=P>>5,this.extraBytes=(P&31)>>3;for(var F=0;F<50;++F)this.s[F]=0}b.prototype.update=function(S){if(this.finalized)throw new Error(t);var V,P=typeof S;if(P!=="string"){if(P==="object"){if(S===null)throw new Error(e);if(u&&S.constructor===ArrayBuffer)S=new Uint8Array(S);else if(!Array.isArray(S)&&(!u||!ArrayBuffer.isView(S)))throw new Error(e)}else throw new Error(e);V=!0}for(var F=this.blocks,L=this.byteCount,m=S.length,U=this.blockCount,G=0,J=this.s,Q,ee;G<m;){if(this.reset)for(this.reset=!1,F[0]=this.block,Q=1;Q<U+1;++Q)F[Q]=0;if(V)for(Q=this.start;G<m&&Q<L;++G)F[Q>>2]|=S[G]<<I[Q++&3];else for(Q=this.start;G<m&&Q<L;++G)ee=S.charCodeAt(G),ee<128?F[Q>>2]|=ee<<I[Q++&3]:ee<2048?(F[Q>>2]|=(192|ee>>6)<<I[Q++&3],F[Q>>2]|=(128|ee&63)<<I[Q++&3]):ee<55296||ee>=57344?(F[Q>>2]|=(224|ee>>12)<<I[Q++&3],F[Q>>2]|=(128|ee>>6&63)<<I[Q++&3],F[Q>>2]|=(128|ee&63)<<I[Q++&3]):(ee=65536+((ee&1023)<<10|S.charCodeAt(++G)&1023),F[Q>>2]|=(240|ee>>18)<<I[Q++&3],F[Q>>2]|=(128|ee>>12&63)<<I[Q++&3],F[Q>>2]|=(128|ee>>6&63)<<I[Q++&3],F[Q>>2]|=(128|ee&63)<<I[Q++&3]);if(this.lastByteIndex=Q,Q>=L){for(this.start=Q-L,this.block=F[U],Q=0;Q<U;++Q)J[Q]^=F[Q];Y(J),this.reset=!0}else this.start=Q}return this},b.prototype.encode=function(S,V){var P=S&255,F=1,L=[P];for(S=S>>8,P=S&255;P>0;)L.unshift(P),S=S>>8,P=S&255,++F;return V?L.push(F):L.unshift(F),this.update(L),L.length},b.prototype.encodeString=function(S){var V,P=typeof S;if(P!=="string"){if(P==="object"){if(S===null)throw new Error(e);if(u&&S.constructor===ArrayBuffer)S=new Uint8Array(S);else if(!Array.isArray(S)&&(!u||!ArrayBuffer.isView(S)))throw new Error(e)}else throw new Error(e);V=!0}var F=0,L=S.length;if(V)F=L;else for(var m=0;m<S.length;++m){var U=S.charCodeAt(m);U<128?F+=1:U<2048?F+=2:U<55296||U>=57344?F+=3:(U=65536+((U&1023)<<10|S.charCodeAt(++m)&1023),F+=4)}return F+=this.encode(F*8),this.update(S),F},b.prototype.bytepad=function(S,V){for(var P=this.encode(V),F=0;F<S.length;++F)P+=this.encodeString(S[F]);var L=V-P%V,m=[];return m.length=L,this.update(m),this},b.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var S=this.blocks,V=this.lastByteIndex,P=this.blockCount,F=this.s;if(S[V>>2]|=this.padding[V&3],this.lastByteIndex===this.byteCount)for(S[0]=S[P],V=1;V<P+1;++V)S[V]=0;for(S[P-1]|=2147483648,V=0;V<P;++V)F[V]^=S[V];Y(F)}},b.prototype.toString=b.prototype.hex=function(){this.finalize();for(var S=this.blockCount,V=this.s,P=this.outputBlocks,F=this.extraBytes,L=0,m=0,U="",G;m<P;){for(L=0;L<S&&m<P;++L,++m)G=V[L],U+=h[G>>4&15]+h[G&15]+h[G>>12&15]+h[G>>8&15]+h[G>>20&15]+h[G>>16&15]+h[G>>28&15]+h[G>>24&15];m%S===0&&(Y(V),L=0)}return F&&(G=V[L],U+=h[G>>4&15]+h[G&15],F>1&&(U+=h[G>>12&15]+h[G>>8&15]),F>2&&(U+=h[G>>20&15]+h[G>>16&15])),U},b.prototype.arrayBuffer=function(){this.finalize();var S=this.blockCount,V=this.s,P=this.outputBlocks,F=this.extraBytes,L=0,m=0,U=this.outputBits>>3,G;F?G=new ArrayBuffer(P+1<<2):G=new ArrayBuffer(U);for(var J=new Uint32Array(G);m<P;){for(L=0;L<S&&m<P;++L,++m)J[m]=V[L];m%S===0&&Y(V)}return F&&(J[L]=V[L],G=G.slice(0,U)),G},b.prototype.buffer=b.prototype.arrayBuffer,b.prototype.digest=b.prototype.array=function(){this.finalize();for(var S=this.blockCount,V=this.s,P=this.outputBlocks,F=this.extraBytes,L=0,m=0,U=[],G,J;m<P;){for(L=0;L<S&&m<P;++L,++m)G=m<<2,J=V[L],U[G]=J&255,U[G+1]=J>>8&255,U[G+2]=J>>16&255,U[G+3]=J>>24&255;m%S===0&&Y(V)}return F&&(G=m<<2,J=V[L],U[G]=J&255,F>1&&(U[G+1]=J>>8&255),F>2&&(U[G+2]=J>>16&255)),U};function R(S,V,P){b.call(this,S,V,P)}R.prototype=new b,R.prototype.finalize=function(){return this.encode(this.outputBits,!0),b.prototype.finalize.call(this)};var Y=function(S){var V,P,F,L,m,U,G,J,Q,ee,we,Se,he,Ne,Ee,se,be,le,ie,ue,fe,te,pe,_e,re,xe,Ae,oe,Ie,De,Re,Ye,Qe,Me,et,tt,Ce,Te,Pe,de,Be,Le,ce,qe,$e,me,ze,Ke,ge,Ue,Oe,ye,ke,it,Fe,nt,We,rt,rr,ir,nr,sr,yt;for(F=0;F<48;F+=2)L=S[0]^S[10]^S[20]^S[30]^S[40],m=S[1]^S[11]^S[21]^S[31]^S[41],U=S[2]^S[12]^S[22]^S[32]^S[42],G=S[3]^S[13]^S[23]^S[33]^S[43],J=S[4]^S[14]^S[24]^S[34]^S[44],Q=S[5]^S[15]^S[25]^S[35]^S[45],ee=S[6]^S[16]^S[26]^S[36]^S[46],we=S[7]^S[17]^S[27]^S[37]^S[47],Se=S[8]^S[18]^S[28]^S[38]^S[48],he=S[9]^S[19]^S[29]^S[39]^S[49],V=Se^(U<<1|G>>>31),P=he^(G<<1|U>>>31),S[0]^=V,S[1]^=P,S[10]^=V,S[11]^=P,S[20]^=V,S[21]^=P,S[30]^=V,S[31]^=P,S[40]^=V,S[41]^=P,V=L^(J<<1|Q>>>31),P=m^(Q<<1|J>>>31),S[2]^=V,S[3]^=P,S[12]^=V,S[13]^=P,S[22]^=V,S[23]^=P,S[32]^=V,S[33]^=P,S[42]^=V,S[43]^=P,V=U^(ee<<1|we>>>31),P=G^(we<<1|ee>>>31),S[4]^=V,S[5]^=P,S[14]^=V,S[15]^=P,S[24]^=V,S[25]^=P,S[34]^=V,S[35]^=P,S[44]^=V,S[45]^=P,V=J^(Se<<1|he>>>31),P=Q^(he<<1|Se>>>31),S[6]^=V,S[7]^=P,S[16]^=V,S[17]^=P,S[26]^=V,S[27]^=P,S[36]^=V,S[37]^=P,S[46]^=V,S[47]^=P,V=ee^(L<<1|m>>>31),P=we^(m<<1|L>>>31),S[8]^=V,S[9]^=P,S[18]^=V,S[19]^=P,S[28]^=V,S[29]^=P,S[38]^=V,S[39]^=P,S[48]^=V,S[49]^=P,Ne=S[0],Ee=S[1],me=S[11]<<4|S[10]>>>28,ze=S[10]<<4|S[11]>>>28,oe=S[20]<<3|S[21]>>>29,Ie=S[21]<<3|S[20]>>>29,ir=S[31]<<9|S[30]>>>23,nr=S[30]<<9|S[31]>>>23,Le=S[40]<<18|S[41]>>>14,ce=S[41]<<18|S[40]>>>14,Me=S[2]<<1|S[3]>>>31,et=S[3]<<1|S[2]>>>31,se=S[13]<<12|S[12]>>>20,be=S[12]<<12|S[13]>>>20,Ke=S[22]<<10|S[23]>>>22,ge=S[23]<<10|S[22]>>>22,De=S[33]<<13|S[32]>>>19,Re=S[32]<<13|S[33]>>>19,sr=S[42]<<2|S[43]>>>30,yt=S[43]<<2|S[42]>>>30,it=S[5]<<30|S[4]>>>2,Fe=S[4]<<30|S[5]>>>2,tt=S[14]<<6|S[15]>>>26,Ce=S[15]<<6|S[14]>>>26,le=S[25]<<11|S[24]>>>21,ie=S[24]<<11|S[25]>>>21,Ue=S[34]<<15|S[35]>>>17,Oe=S[35]<<15|S[34]>>>17,Ye=S[45]<<29|S[44]>>>3,Qe=S[44]<<29|S[45]>>>3,_e=S[6]<<28|S[7]>>>4,re=S[7]<<28|S[6]>>>4,nt=S[17]<<23|S[16]>>>9,We=S[16]<<23|S[17]>>>9,Te=S[26]<<25|S[27]>>>7,Pe=S[27]<<25|S[26]>>>7,ue=S[36]<<21|S[37]>>>11,fe=S[37]<<21|S[36]>>>11,ye=S[47]<<24|S[46]>>>8,ke=S[46]<<24|S[47]>>>8,qe=S[8]<<27|S[9]>>>5,$e=S[9]<<27|S[8]>>>5,xe=S[18]<<20|S[19]>>>12,Ae=S[19]<<20|S[18]>>>12,rt=S[29]<<7|S[28]>>>25,rr=S[28]<<7|S[29]>>>25,de=S[38]<<8|S[39]>>>24,Be=S[39]<<8|S[38]>>>24,te=S[48]<<14|S[49]>>>18,pe=S[49]<<14|S[48]>>>18,S[0]=Ne^~se&le,S[1]=Ee^~be&ie,S[10]=_e^~xe&oe,S[11]=re^~Ae&Ie,S[20]=Me^~tt&Te,S[21]=et^~Ce&Pe,S[30]=qe^~me&Ke,S[31]=$e^~ze&ge,S[40]=it^~nt&rt,S[41]=Fe^~We&rr,S[2]=se^~le&ue,S[3]=be^~ie&fe,S[12]=xe^~oe&De,S[13]=Ae^~Ie&Re,S[22]=tt^~Te&de,S[23]=Ce^~Pe&Be,S[32]=me^~Ke&Ue,S[33]=ze^~ge&Oe,S[42]=nt^~rt&ir,S[43]=We^~rr&nr,S[4]=le^~ue&te,S[5]=ie^~fe&pe,S[14]=oe^~De&Ye,S[15]=Ie^~Re&Qe,S[24]=Te^~de&Le,S[25]=Pe^~Be&ce,S[34]=Ke^~Ue&ye,S[35]=ge^~Oe&ke,S[44]=rt^~ir&sr,S[45]=rr^~nr&yt,S[6]=ue^~te&Ne,S[7]=fe^~pe&Ee,S[16]=De^~Ye&_e,S[17]=Re^~Qe&re,S[26]=de^~Le&Me,S[27]=Be^~ce&et,S[36]=Ue^~ye&qe,S[37]=Oe^~ke&$e,S[46]=ir^~sr&it,S[47]=nr^~yt&Fe,S[8]=te^~Ne&se,S[9]=pe^~Ee&be,S[18]=Ye^~_e&xe,S[19]=Qe^~re&Ae,S[28]=Le^~Me&tt,S[29]=ce^~et&Ce,S[38]=ye^~qe&me,S[39]=ke^~$e&ze,S[48]=sr^~it&nt,S[49]=yt^~Fe&We,S[0]^=C[F],S[1]^=C[F+1]};if(f)r.exports=a;else for(v=0;v<c.length;++v)n[c[v]]=a[c[v]]})()})(Xc);var uv=Xc.exports;const dv="logger/5.7.0";let Zc=!1,eh=!1;const Hs={debug:1,default:2,info:2,warning:3,error:4,off:5};let th=Hs.default,ho=null;function lv(){try{const r=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{r.push(e)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}const rh=lv();var uo;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(uo||(uo={}));var Dr;(function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"})(Dr||(Dr={}));const ih="0123456789abcdef";class He{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const i=e.toLowerCase();Hs[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(th>Hs[i])&&console.log.apply(console,t)}debug(...e){this._log(He.levels.DEBUG,e)}info(...e){this._log(He.levels.INFO,e)}warn(...e){this._log(He.levels.WARNING,e)}makeError(e,t,i){if(eh)return this.makeError("censored error",t,{});t||(t=He.errors.UNKNOWN_ERROR),i||(i={});const n=[];Object.keys(i).forEach(u=>{const h=i[u];try{if(h instanceof Uint8Array){let p="";for(let y=0;y<h.length;y++)p+=ih[h[y]>>4],p+=ih[h[y]&15];n.push(u+"=Uint8Array(0x"+p+")")}else n.push(u+"="+JSON.stringify(h))}catch{n.push(u+"="+JSON.stringify(i[u].toString()))}}),n.push(`code=${t}`),n.push(`version=${this.version}`);const s=e;let o="";switch(t){case Dr.NUMERIC_FAULT:{o="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case Dr.CALL_EXCEPTION:case Dr.INSUFFICIENT_FUNDS:case Dr.MISSING_NEW:case Dr.NONCE_EXPIRED:case Dr.REPLACEMENT_UNDERPRICED:case Dr.TRANSACTION_REPLACED:case Dr.UNPREDICTABLE_GAS_LIMIT:o=t;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const f=new Error(e);return f.reason=s,f.code=t,Object.keys(i).forEach(function(u){f[u]=i[u]}),f}throwError(e,t,i){throw this.makeError(e,t,i)}throwArgumentError(e,t,i){return this.throwError(e,He.errors.INVALID_ARGUMENT,{argument:t,value:i})}assert(e,t,i,n){e||this.throwError(t,i,n)}assertArgument(e,t,i,n){e||this.throwArgumentError(t,i,n)}checkNormalize(e){rh&&this.throwError("platform missing String.prototype.normalize",He.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:rh})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,He.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,He.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,i){i?i=": "+i:i="",e<t&&this.throwError("missing argument"+i,He.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+i,He.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",He.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",He.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",He.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return ho||(ho=new He(dv)),ho}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",He.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Zc){if(!e)return;this.globalLogger().throwError("error censorship permanent",He.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}eh=!!e,Zc=!!t}static setLogLevel(e){const t=Hs[e.toLowerCase()];if(t==null){He.globalLogger().warn("invalid log level - "+e);return}th=t}static from(e){return new He(e)}}He.errors=Dr,He.levels=uo;const pv="bytes/5.7.0",bt=new He(pv);function nh(r){return!!r.toHexString}function dn(r){return r.slice||(r.slice=function(){const e=Array.prototype.slice.call(arguments);return dn(new Uint8Array(Array.prototype.slice.apply(r,e)))}),r}function gv(r){return or(r)&&!(r.length%2)||ln(r)}function sh(r){return typeof r=="number"&&r==r&&r%1===0}function ln(r){if(r==null)return!1;if(r.constructor===Uint8Array)return!0;if(typeof r=="string"||!sh(r.length)||r.length<0)return!1;for(let e=0;e<r.length;e++){const t=r[e];if(!sh(t)||t<0||t>=256)return!1}return!0}function lt(r,e){if(e||(e={}),typeof r=="number"){bt.checkSafeUint53(r,"invalid arrayify value");const t=[];for(;r;)t.unshift(r&255),r=parseInt(String(r/256));return t.length===0&&t.push(0),dn(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),nh(r)&&(r=r.toHexString()),or(r)){let t=r.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":bt.throwArgumentError("hex data is odd-length","value",r));const i=[];for(let n=0;n<t.length;n+=2)i.push(parseInt(t.substring(n,n+2),16));return dn(new Uint8Array(i))}return ln(r)?dn(new Uint8Array(r)):bt.throwArgumentError("invalid arrayify value","value",r)}function vv(r){const e=r.map(n=>lt(n)),t=e.reduce((n,s)=>n+s.length,0),i=new Uint8Array(t);return e.reduce((n,s)=>(i.set(s,n),n+s.length),0),dn(i)}function bv(r,e){r=lt(r),r.length>e&&bt.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(r,e-r.length),dn(t)}function or(r,e){return!(typeof r!="string"||!r.match(/^0x[0-9A-Fa-f]*$/)||e&&r.length!==2+2*e)}const lo="0123456789abcdef";function Vt(r,e){if(e||(e={}),typeof r=="number"){bt.checkSafeUint53(r,"invalid hexlify value");let t="";for(;r;)t=lo[r&15]+t,r=Math.floor(r/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(typeof r=="bigint")return r=r.toString(16),r.length%2?"0x0"+r:"0x"+r;if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),nh(r))return r.toHexString();if(or(r))return r.length%2&&(e.hexPad==="left"?r="0x0"+r.substring(2):e.hexPad==="right"?r+="0":bt.throwArgumentError("hex data is odd-length","value",r)),r.toLowerCase();if(ln(r)){let t="0x";for(let i=0;i<r.length;i++){let n=r[i];t+=lo[(n&240)>>4]+lo[n&15]}return t}return bt.throwArgumentError("invalid hexlify value","value",r)}function mv(r){if(typeof r!="string")r=Vt(r);else if(!or(r)||r.length%2)return null;return(r.length-2)/2}function ah(r,e,t){return typeof r!="string"?r=Vt(r):(!or(r)||r.length%2)&&bt.throwArgumentError("invalid hexData","value",r),e=2+2*e,t!=null?"0x"+r.substring(e,2+2*t):"0x"+r.substring(e)}function Br(r,e){for(typeof r!="string"?r=Vt(r):or(r)||bt.throwArgumentError("invalid hex string","value",r),r.length>2*e+2&&bt.throwArgumentError("value out of range","value",arguments[1]);r.length<2*e+2;)r="0x0"+r.substring(2);return r}function oh(r){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(gv(r)){let t=lt(r);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=Vt(t.slice(0,32)),e.s=Vt(t.slice(32,64))):t.length===65?(e.r=Vt(t.slice(0,32)),e.s=Vt(t.slice(32,64)),e.v=t[64]):bt.throwArgumentError("invalid signature string","signature",r),e.v<27&&(e.v===0||e.v===1?e.v+=27:bt.throwArgumentError("signature invalid v byte","signature",r)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=Vt(t.slice(32,64))}else{if(e.r=r.r,e.s=r.s,e.v=r.v,e.recoveryParam=r.recoveryParam,e._vs=r._vs,e._vs!=null){const n=bv(lt(e._vs),32);e._vs=Vt(n);const s=n[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&bt.throwArgumentError("signature recoveryParam mismatch _vs","signature",r),n[0]&=127;const o=Vt(n);e.s==null?e.s=o:e.s!==o&&bt.throwArgumentError("signature v mismatch _vs","signature",r)}if(e.recoveryParam==null)e.v==null?bt.throwArgumentError("signature missing v and recoveryParam","signature",r):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const n=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==n&&bt.throwArgumentError("signature recoveryParam mismatch v","signature",r)}e.r==null||!or(e.r)?bt.throwArgumentError("signature missing or invalid r","signature",r):e.r=Br(e.r,32),e.s==null||!or(e.s)?bt.throwArgumentError("signature missing or invalid s","signature",r):e.s=Br(e.s,32);const t=lt(e.s);t[0]>=128&&bt.throwArgumentError("signature s out of range","signature",r),e.recoveryParam&&(t[0]|=128);const i=Vt(t);e._vs&&(or(e._vs)||bt.throwArgumentError("signature invalid _vs","signature",r),e._vs=Br(e._vs,32)),e._vs==null?e._vs=i:e._vs!==i&&bt.throwArgumentError("signature _vs mismatch v and s","signature",r)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function po(r){return"0x"+uv.keccak_256(lt(r))}var fh={exports:{}};(function(r){(function(e,t){function i(l,a){if(!l)throw new Error(a||"Assertion failed")}function n(l,a){l.super_=a;var c=function(){};c.prototype=a.prototype,l.prototype=new c,l.prototype.constructor=l}function s(l,a,c){if(s.isBN(l))return l;this.negative=0,this.words=null,this.length=0,this.red=null,l!==null&&((a==="le"||a==="be")&&(c=a,a=10),this._init(l||0,a||10,c||"be"))}typeof e=="object"?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=Fs.Buffer}catch{}s.isBN=function(a){return a instanceof s?!0:a!==null&&typeof a=="object"&&a.constructor.wordSize===s.wordSize&&Array.isArray(a.words)},s.max=function(a,c){return a.cmp(c)>0?a:c},s.min=function(a,c){return a.cmp(c)<0?a:c},s.prototype._init=function(a,c,v){if(typeof a=="number")return this._initNumber(a,c,v);if(typeof a=="object")return this._initArray(a,c,v);c==="hex"&&(c=16),i(c===(c|0)&&c>=2&&c<=36),a=a.toString().replace(/\s+/g,"");var x=0;a[0]==="-"&&(x++,this.negative=1),x<a.length&&(c===16?this._parseHex(a,x,v):(this._parseBase(a,c,x),v==="le"&&this._initArray(this.toArray(),c,v)))},s.prototype._initNumber=function(a,c,v){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[a&67108863],this.length=1):a<4503599627370496?(this.words=[a&67108863,a/67108864&67108863],this.length=2):(i(a<9007199254740992),this.words=[a&67108863,a/67108864&67108863,1],this.length=3),v==="le"&&this._initArray(this.toArray(),c,v)},s.prototype._initArray=function(a,c,v){if(i(typeof a.length=="number"),a.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(a.length/3),this.words=new Array(this.length);for(var x=0;x<this.length;x++)this.words[x]=0;var A,E,d=0;if(v==="be")for(x=a.length-1,A=0;x>=0;x-=3)E=a[x]|a[x-1]<<8|a[x-2]<<16,this.words[A]|=E<<d&67108863,this.words[A+1]=E>>>26-d&67108863,d+=24,d>=26&&(d-=26,A++);else if(v==="le")for(x=0,A=0;x<a.length;x+=3)E=a[x]|a[x+1]<<8|a[x+2]<<16,this.words[A]|=E<<d&67108863,this.words[A+1]=E>>>26-d&67108863,d+=24,d>=26&&(d-=26,A++);return this._strip()};function f(l,a){var c=l.charCodeAt(a);if(c>=48&&c<=57)return c-48;if(c>=65&&c<=70)return c-55;if(c>=97&&c<=102)return c-87;i(!1,"Invalid character in "+l)}function u(l,a,c){var v=f(l,c);return c-1>=a&&(v|=f(l,c-1)<<4),v}s.prototype._parseHex=function(a,c,v){this.length=Math.ceil((a.length-c)/6),this.words=new Array(this.length);for(var x=0;x<this.length;x++)this.words[x]=0;var A=0,E=0,d;if(v==="be")for(x=a.length-1;x>=c;x-=2)d=u(a,c,x)<<A,this.words[E]|=d&67108863,A>=18?(A-=18,E+=1,this.words[E]|=d>>>26):A+=8;else{var w=a.length-c;for(x=w%2===0?c+1:c;x<a.length;x+=2)d=u(a,c,x)<<A,this.words[E]|=d&67108863,A>=18?(A-=18,E+=1,this.words[E]|=d>>>26):A+=8}this._strip()};function h(l,a,c,v){for(var x=0,A=0,E=Math.min(l.length,c),d=a;d<E;d++){var w=l.charCodeAt(d)-48;x*=v,w>=49?A=w-49+10:w>=17?A=w-17+10:A=w,i(w>=0&&A<v,"Invalid character"),x+=A}return x}s.prototype._parseBase=function(a,c,v){this.words=[0],this.length=1;for(var x=0,A=1;A<=67108863;A*=c)x++;x--,A=A/c|0;for(var E=a.length-v,d=E%x,w=Math.min(E,E-d)+v,b=0,R=v;R<w;R+=x)b=h(a,R,R+x,c),this.imuln(A),this.words[0]+b<67108864?this.words[0]+=b:this._iaddn(b);if(d!==0){var Y=1;for(b=h(a,R,a.length,c),R=0;R<d;R++)Y*=c;this.imuln(Y),this.words[0]+b<67108864?this.words[0]+=b:this._iaddn(b)}this._strip()},s.prototype.copy=function(a){a.words=new Array(this.length);for(var c=0;c<this.length;c++)a.words[c]=this.words[c];a.length=this.length,a.negative=this.negative,a.red=this.red};function p(l,a){l.words=a.words,l.length=a.length,l.negative=a.negative,l.red=a.red}if(s.prototype._move=function(a){p(a,this)},s.prototype.clone=function(){var a=new s(null);return this.copy(a),a},s.prototype._expand=function(a){for(;this.length<a;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=y}catch{s.prototype.inspect=y}else s.prototype.inspect=y;function y(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var M=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],D=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],I=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(a,c){a=a||10,c=c|0||1;var v;if(a===16||a==="hex"){v="";for(var x=0,A=0,E=0;E<this.length;E++){var d=this.words[E],w=((d<<x|A)&16777215).toString(16);A=d>>>24-x&16777215,x+=2,x>=26&&(x-=26,E--),A!==0||E!==this.length-1?v=M[6-w.length]+w+v:v=w+v}for(A!==0&&(v=A.toString(16)+v);v.length%c!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(a===(a|0)&&a>=2&&a<=36){var b=D[a],R=I[a];v="";var Y=this.clone();for(Y.negative=0;!Y.isZero();){var S=Y.modrn(R).toString(a);Y=Y.idivn(R),Y.isZero()?v=S+v:v=M[b-S.length]+S+v}for(this.isZero()&&(v="0"+v);v.length%c!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var a=this.words[0];return this.length===2?a+=this.words[1]*67108864:this.length===3&&this.words[2]===1?a+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-a:a},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(a,c){return this.toArrayLike(o,a,c)}),s.prototype.toArray=function(a,c){return this.toArrayLike(Array,a,c)};var C=function(a,c){return a.allocUnsafe?a.allocUnsafe(c):new a(c)};s.prototype.toArrayLike=function(a,c,v){this._strip();var x=this.byteLength(),A=v||Math.max(1,x);i(x<=A,"byte array longer than desired length"),i(A>0,"Requested array length <= 0");var E=C(a,A),d=c==="le"?"LE":"BE";return this["_toArrayLike"+d](E,x),E},s.prototype._toArrayLikeLE=function(a,c){for(var v=0,x=0,A=0,E=0;A<this.length;A++){var d=this.words[A]<<E|x;a[v++]=d&255,v<a.length&&(a[v++]=d>>8&255),v<a.length&&(a[v++]=d>>16&255),E===6?(v<a.length&&(a[v++]=d>>24&255),x=0,E=0):(x=d>>>24,E+=2)}if(v<a.length)for(a[v++]=x;v<a.length;)a[v++]=0},s.prototype._toArrayLikeBE=function(a,c){for(var v=a.length-1,x=0,A=0,E=0;A<this.length;A++){var d=this.words[A]<<E|x;a[v--]=d&255,v>=0&&(a[v--]=d>>8&255),v>=0&&(a[v--]=d>>16&255),E===6?(v>=0&&(a[v--]=d>>24&255),x=0,E=0):(x=d>>>24,E+=2)}if(v>=0)for(a[v--]=x;v>=0;)a[v--]=0},Math.clz32?s.prototype._countBits=function(a){return 32-Math.clz32(a)}:s.prototype._countBits=function(a){var c=a,v=0;return c>=4096&&(v+=13,c>>>=13),c>=64&&(v+=7,c>>>=7),c>=8&&(v+=4,c>>>=4),c>=2&&(v+=2,c>>>=2),v+c},s.prototype._zeroBits=function(a){if(a===0)return 26;var c=a,v=0;return c&8191||(v+=13,c>>>=13),c&127||(v+=7,c>>>=7),c&15||(v+=4,c>>>=4),c&3||(v+=2,c>>>=2),c&1||v++,v},s.prototype.bitLength=function(){var a=this.words[this.length-1],c=this._countBits(a);return(this.length-1)*26+c};function K(l){for(var a=new Array(l.bitLength()),c=0;c<a.length;c++){var v=c/26|0,x=c%26;a[c]=l.words[v]>>>x&1}return a}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var a=0,c=0;c<this.length;c++){var v=this._zeroBits(this.words[c]);if(a+=v,v!==26)break}return a},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(a){return this.negative!==0?this.abs().inotn(a).iaddn(1):this.clone()},s.prototype.fromTwos=function(a){return this.testn(a-1)?this.notn(a).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(a){for(;this.length<a.length;)this.words[this.length++]=0;for(var c=0;c<a.length;c++)this.words[c]=this.words[c]|a.words[c];return this._strip()},s.prototype.ior=function(a){return i((this.negative|a.negative)===0),this.iuor(a)},s.prototype.or=function(a){return this.length>a.length?this.clone().ior(a):a.clone().ior(this)},s.prototype.uor=function(a){return this.length>a.length?this.clone().iuor(a):a.clone().iuor(this)},s.prototype.iuand=function(a){var c;this.length>a.length?c=a:c=this;for(var v=0;v<c.length;v++)this.words[v]=this.words[v]&a.words[v];return this.length=c.length,this._strip()},s.prototype.iand=function(a){return i((this.negative|a.negative)===0),this.iuand(a)},s.prototype.and=function(a){return this.length>a.length?this.clone().iand(a):a.clone().iand(this)},s.prototype.uand=function(a){return this.length>a.length?this.clone().iuand(a):a.clone().iuand(this)},s.prototype.iuxor=function(a){var c,v;this.length>a.length?(c=this,v=a):(c=a,v=this);for(var x=0;x<v.length;x++)this.words[x]=c.words[x]^v.words[x];if(this!==c)for(;x<c.length;x++)this.words[x]=c.words[x];return this.length=c.length,this._strip()},s.prototype.ixor=function(a){return i((this.negative|a.negative)===0),this.iuxor(a)},s.prototype.xor=function(a){return this.length>a.length?this.clone().ixor(a):a.clone().ixor(this)},s.prototype.uxor=function(a){return this.length>a.length?this.clone().iuxor(a):a.clone().iuxor(this)},s.prototype.inotn=function(a){i(typeof a=="number"&&a>=0);var c=Math.ceil(a/26)|0,v=a%26;this._expand(c),v>0&&c--;for(var x=0;x<c;x++)this.words[x]=~this.words[x]&67108863;return v>0&&(this.words[x]=~this.words[x]&67108863>>26-v),this._strip()},s.prototype.notn=function(a){return this.clone().inotn(a)},s.prototype.setn=function(a,c){i(typeof a=="number"&&a>=0);var v=a/26|0,x=a%26;return this._expand(v+1),c?this.words[v]=this.words[v]|1<<x:this.words[v]=this.words[v]&~(1<<x),this._strip()},s.prototype.iadd=function(a){var c;if(this.negative!==0&&a.negative===0)return this.negative=0,c=this.isub(a),this.negative^=1,this._normSign();if(this.negative===0&&a.negative!==0)return a.negative=0,c=this.isub(a),a.negative=1,c._normSign();var v,x;this.length>a.length?(v=this,x=a):(v=a,x=this);for(var A=0,E=0;E<x.length;E++)c=(v.words[E]|0)+(x.words[E]|0)+A,this.words[E]=c&67108863,A=c>>>26;for(;A!==0&&E<v.length;E++)c=(v.words[E]|0)+A,this.words[E]=c&67108863,A=c>>>26;if(this.length=v.length,A!==0)this.words[this.length]=A,this.length++;else if(v!==this)for(;E<v.length;E++)this.words[E]=v.words[E];return this},s.prototype.add=function(a){var c;return a.negative!==0&&this.negative===0?(a.negative=0,c=this.sub(a),a.negative^=1,c):a.negative===0&&this.negative!==0?(this.negative=0,c=a.sub(this),this.negative=1,c):this.length>a.length?this.clone().iadd(a):a.clone().iadd(this)},s.prototype.isub=function(a){if(a.negative!==0){a.negative=0;var c=this.iadd(a);return a.negative=1,c._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(a),this.negative=1,this._normSign();var v=this.cmp(a);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,A;v>0?(x=this,A=a):(x=a,A=this);for(var E=0,d=0;d<A.length;d++)c=(x.words[d]|0)-(A.words[d]|0)+E,E=c>>26,this.words[d]=c&67108863;for(;E!==0&&d<x.length;d++)c=(x.words[d]|0)+E,E=c>>26,this.words[d]=c&67108863;if(E===0&&d<x.length&&x!==this)for(;d<x.length;d++)this.words[d]=x.words[d];return this.length=Math.max(this.length,d),x!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(a){return this.clone().isub(a)};function j(l,a,c){c.negative=a.negative^l.negative;var v=l.length+a.length|0;c.length=v,v=v-1|0;var x=l.words[0]|0,A=a.words[0]|0,E=x*A,d=E&67108863,w=E/67108864|0;c.words[0]=d;for(var b=1;b<v;b++){for(var R=w>>>26,Y=w&67108863,S=Math.min(b,a.length-1),V=Math.max(0,b-l.length+1);V<=S;V++){var P=b-V|0;x=l.words[P]|0,A=a.words[V]|0,E=x*A+Y,R+=E/67108864|0,Y=E&67108863}c.words[b]=Y|0,w=R|0}return w!==0?c.words[b]=w|0:c.length--,c._strip()}var B=function(a,c,v){var x=a.words,A=c.words,E=v.words,d=0,w,b,R,Y=x[0]|0,S=Y&8191,V=Y>>>13,P=x[1]|0,F=P&8191,L=P>>>13,m=x[2]|0,U=m&8191,G=m>>>13,J=x[3]|0,Q=J&8191,ee=J>>>13,we=x[4]|0,Se=we&8191,he=we>>>13,Ne=x[5]|0,Ee=Ne&8191,se=Ne>>>13,be=x[6]|0,le=be&8191,ie=be>>>13,ue=x[7]|0,fe=ue&8191,te=ue>>>13,pe=x[8]|0,_e=pe&8191,re=pe>>>13,xe=x[9]|0,Ae=xe&8191,oe=xe>>>13,Ie=A[0]|0,De=Ie&8191,Re=Ie>>>13,Ye=A[1]|0,Qe=Ye&8191,Me=Ye>>>13,et=A[2]|0,tt=et&8191,Ce=et>>>13,Te=A[3]|0,Pe=Te&8191,de=Te>>>13,Be=A[4]|0,Le=Be&8191,ce=Be>>>13,qe=A[5]|0,$e=qe&8191,me=qe>>>13,ze=A[6]|0,Ke=ze&8191,ge=ze>>>13,Ue=A[7]|0,Oe=Ue&8191,ye=Ue>>>13,ke=A[8]|0,it=ke&8191,Fe=ke>>>13,nt=A[9]|0,We=nt&8191,rt=nt>>>13;v.negative=a.negative^c.negative,v.length=19,w=Math.imul(S,De),b=Math.imul(S,Re),b=b+Math.imul(V,De)|0,R=Math.imul(V,Re);var rr=(d+w|0)+((b&8191)<<13)|0;d=(R+(b>>>13)|0)+(rr>>>26)|0,rr&=67108863,w=Math.imul(F,De),b=Math.imul(F,Re),b=b+Math.imul(L,De)|0,R=Math.imul(L,Re),w=w+Math.imul(S,Qe)|0,b=b+Math.imul(S,Me)|0,b=b+Math.imul(V,Qe)|0,R=R+Math.imul(V,Me)|0;var ir=(d+w|0)+((b&8191)<<13)|0;d=(R+(b>>>13)|0)+(ir>>>26)|0,ir&=67108863,w=Math.imul(U,De),b=Math.imul(U,Re),b=b+Math.imul(G,De)|0,R=Math.imul(G,Re),w=w+Math.imul(F,Qe)|0,b=b+Math.imul(F,Me)|0,b=b+Math.imul(L,Qe)|0,R=R+Math.imul(L,Me)|0,w=w+Math.imul(S,tt)|0,b=b+Math.imul(S,Ce)|0,b=b+Math.imul(V,tt)|0,R=R+Math.imul(V,Ce)|0;var nr=(d+w|0)+((b&8191)<<13)|0;d=(R+(b>>>13)|0)+(nr>>>26)|0,nr&=67108863,w=Math.imul(Q,De),b=Math.imul(Q,Re),b=b+Math.imul(ee,De)|0,R=Math.imul(ee,Re),w=w+Math.imul(U,Qe)|0,b=b+Math.imul(U,Me)|0,b=b+Math.imul(G,Qe)|0,R=R+Math.imul(G,Me)|0,w=w+Math.imul(F,tt)|0,b=b+Math.imul(F,Ce)|0,b=b+Math.imul(L,tt)|0,R=R+Math.imul(L,Ce)|0,w=w+Math.imul(S,Pe)|0,b=b+Math.imul(S,de)|0,b=b+Math.imul(V,Pe)|0,R=R+Math.imul(V,de)|0;var sr=(d+w|0)+((b&8191)<<13)|0;d=(R+(b>>>13)|0)+(sr>>>26)|0,sr&=67108863,w=Math.imul(Se,De),b=Math.imul(Se,Re),b=b+Math.imul(he,De)|0,R=Math.imul(he,Re),w=w+Math.imul(Q,Qe)|0,b=b+Math.imul(Q,Me)|0,b=b+Math.imul(ee,Qe)|0,R=R+Math.imul(ee,Me)|0,w=w+Math.imul(U,tt)|0,b=b+Math.imul(U,Ce)|0,b=b+Math.imul(G,tt)|0,R=R+Math.imul(G,Ce)|0,w=w+Math.imul(F,Pe)|0,b=b+Math.imul(F,de)|0,b=b+Math.imul(L,Pe)|0,R=R+Math.imul(L,de)|0,w=w+Math.imul(S,Le)|0,b=b+Math.imul(S,ce)|0,b=b+Math.imul(V,Le)|0,R=R+Math.imul(V,ce)|0;var yt=(d+w|0)+((b&8191)<<13)|0;d=(R+(b>>>13)|0)+(yt>>>26)|0,yt&=67108863,w=Math.imul(Ee,De),b=Math.imul(Ee,Re),b=b+Math.imul(se,De)|0,R=Math.imul(se,Re),w=w+Math.imul(Se,Qe)|0,b=b+Math.imul(Se,Me)|0,b=b+Math.imul(he,Qe)|0,R=R+Math.imul(he,Me)|0,w=w+Math.imul(Q,tt)|0,b=b+Math.imul(Q,Ce)|0,b=b+Math.imul(ee,tt)|0,R=R+Math.imul(ee,Ce)|0,w=w+Math.imul(U,Pe)|0,b=b+Math.imul(U,de)|0,b=b+Math.imul(G,Pe)|0,R=R+Math.imul(G,de)|0,w=w+Math.imul(F,Le)|0,b=b+Math.imul(F,ce)|0,b=b+Math.imul(L,Le)|0,R=R+Math.imul(L,ce)|0,w=w+Math.imul(S,$e)|0,b=b+Math.imul(S,me)|0,b=b+Math.imul(V,$e)|0,R=R+Math.imul(V,me)|0;var ci=(d+w|0)+((b&8191)<<13)|0;d=(R+(b>>>13)|0)+(ci>>>26)|0,ci&=67108863,w=Math.imul(le,De),b=Math.imul(le,Re),b=b+Math.imul(ie,De)|0,R=Math.imul(ie,Re),w=w+Math.imul(Ee,Qe)|0,b=b+Math.imul(Ee,Me)|0,b=b+Math.imul(se,Qe)|0,R=R+Math.imul(se,Me)|0,w=w+Math.imul(Se,tt)|0,b=b+Math.imul(Se,Ce)|0,b=b+Math.imul(he,tt)|0,R=R+Math.imul(he,Ce)|0,w=w+Math.imul(Q,Pe)|0,b=b+Math.imul(Q,de)|0,b=b+Math.imul(ee,Pe)|0,R=R+Math.imul(ee,de)|0,w=w+Math.imul(U,Le)|0,b=b+Math.imul(U,ce)|0,b=b+Math.imul(G,Le)|0,R=R+Math.imul(G,ce)|0,w=w+Math.imul(F,$e)|0,b=b+Math.imul(F,me)|0,b=b+Math.imul(L,$e)|0,R=R+Math.imul(L,me)|0,w=w+Math.imul(S,Ke)|0,b=b+Math.imul(S,ge)|0,b=b+Math.imul(V,Ke)|0,R=R+Math.imul(V,ge)|0;var hi=(d+w|0)+((b&8191)<<13)|0;d=(R+(b>>>13)|0)+(hi>>>26)|0,hi&=67108863,w=Math.imul(fe,De),b=Math.imul(fe,Re),b=b+Math.imul(te,De)|0,R=Math.imul(te,Re),w=w+Math.imul(le,Qe)|0,b=b+Math.imul(le,Me)|0,b=b+Math.imul(ie,Qe)|0,R=R+Math.imul(ie,Me)|0,w=w+Math.imul(Ee,tt)|0,b=b+Math.imul(Ee,Ce)|0,b=b+Math.imul(se,tt)|0,R=R+Math.imul(se,Ce)|0,w=w+Math.imul(Se,Pe)|0,b=b+Math.imul(Se,de)|0,b=b+Math.imul(he,Pe)|0,R=R+Math.imul(he,de)|0,w=w+Math.imul(Q,Le)|0,b=b+Math.imul(Q,ce)|0,b=b+Math.imul(ee,Le)|0,R=R+Math.imul(ee,ce)|0,w=w+Math.imul(U,$e)|0,b=b+Math.imul(U,me)|0,b=b+Math.imul(G,$e)|0,R=R+Math.imul(G,me)|0,w=w+Math.imul(F,Ke)|0,b=b+Math.imul(F,ge)|0,b=b+Math.imul(L,Ke)|0,R=R+Math.imul(L,ge)|0,w=w+Math.imul(S,Oe)|0,b=b+Math.imul(S,ye)|0,b=b+Math.imul(V,Oe)|0,R=R+Math.imul(V,ye)|0;var ui=(d+w|0)+((b&8191)<<13)|0;d=(R+(b>>>13)|0)+(ui>>>26)|0,ui&=67108863,w=Math.imul(_e,De),b=Math.imul(_e,Re),b=b+Math.imul(re,De)|0,R=Math.imul(re,Re),w=w+Math.imul(fe,Qe)|0,b=b+Math.imul(fe,Me)|0,b=b+Math.imul(te,Qe)|0,R=R+Math.imul(te,Me)|0,w=w+Math.imul(le,tt)|0,b=b+Math.imul(le,Ce)|0,b=b+Math.imul(ie,tt)|0,R=R+Math.imul(ie,Ce)|0,w=w+Math.imul(Ee,Pe)|0,b=b+Math.imul(Ee,de)|0,b=b+Math.imul(se,Pe)|0,R=R+Math.imul(se,de)|0,w=w+Math.imul(Se,Le)|0,b=b+Math.imul(Se,ce)|0,b=b+Math.imul(he,Le)|0,R=R+Math.imul(he,ce)|0,w=w+Math.imul(Q,$e)|0,b=b+Math.imul(Q,me)|0,b=b+Math.imul(ee,$e)|0,R=R+Math.imul(ee,me)|0,w=w+Math.imul(U,Ke)|0,b=b+Math.imul(U,ge)|0,b=b+Math.imul(G,Ke)|0,R=R+Math.imul(G,ge)|0,w=w+Math.imul(F,Oe)|0,b=b+Math.imul(F,ye)|0,b=b+Math.imul(L,Oe)|0,R=R+Math.imul(L,ye)|0,w=w+Math.imul(S,it)|0,b=b+Math.imul(S,Fe)|0,b=b+Math.imul(V,it)|0,R=R+Math.imul(V,Fe)|0;var di=(d+w|0)+((b&8191)<<13)|0;d=(R+(b>>>13)|0)+(di>>>26)|0,di&=67108863,w=Math.imul(Ae,De),b=Math.imul(Ae,Re),b=b+Math.imul(oe,De)|0,R=Math.imul(oe,Re),w=w+Math.imul(_e,Qe)|0,b=b+Math.imul(_e,Me)|0,b=b+Math.imul(re,Qe)|0,R=R+Math.imul(re,Me)|0,w=w+Math.imul(fe,tt)|0,b=b+Math.imul(fe,Ce)|0,b=b+Math.imul(te,tt)|0,R=R+Math.imul(te,Ce)|0,w=w+Math.imul(le,Pe)|0,b=b+Math.imul(le,de)|0,b=b+Math.imul(ie,Pe)|0,R=R+Math.imul(ie,de)|0,w=w+Math.imul(Ee,Le)|0,b=b+Math.imul(Ee,ce)|0,b=b+Math.imul(se,Le)|0,R=R+Math.imul(se,ce)|0,w=w+Math.imul(Se,$e)|0,b=b+Math.imul(Se,me)|0,b=b+Math.imul(he,$e)|0,R=R+Math.imul(he,me)|0,w=w+Math.imul(Q,Ke)|0,b=b+Math.imul(Q,ge)|0,b=b+Math.imul(ee,Ke)|0,R=R+Math.imul(ee,ge)|0,w=w+Math.imul(U,Oe)|0,b=b+Math.imul(U,ye)|0,b=b+Math.imul(G,Oe)|0,R=R+Math.imul(G,ye)|0,w=w+Math.imul(F,it)|0,b=b+Math.imul(F,Fe)|0,b=b+Math.imul(L,it)|0,R=R+Math.imul(L,Fe)|0,w=w+Math.imul(S,We)|0,b=b+Math.imul(S,rt)|0,b=b+Math.imul(V,We)|0,R=R+Math.imul(V,rt)|0;var li=(d+w|0)+((b&8191)<<13)|0;d=(R+(b>>>13)|0)+(li>>>26)|0,li&=67108863,w=Math.imul(Ae,Qe),b=Math.imul(Ae,Me),b=b+Math.imul(oe,Qe)|0,R=Math.imul(oe,Me),w=w+Math.imul(_e,tt)|0,b=b+Math.imul(_e,Ce)|0,b=b+Math.imul(re,tt)|0,R=R+Math.imul(re,Ce)|0,w=w+Math.imul(fe,Pe)|0,b=b+Math.imul(fe,de)|0,b=b+Math.imul(te,Pe)|0,R=R+Math.imul(te,de)|0,w=w+Math.imul(le,Le)|0,b=b+Math.imul(le,ce)|0,b=b+Math.imul(ie,Le)|0,R=R+Math.imul(ie,ce)|0,w=w+Math.imul(Ee,$e)|0,b=b+Math.imul(Ee,me)|0,b=b+Math.imul(se,$e)|0,R=R+Math.imul(se,me)|0,w=w+Math.imul(Se,Ke)|0,b=b+Math.imul(Se,ge)|0,b=b+Math.imul(he,Ke)|0,R=R+Math.imul(he,ge)|0,w=w+Math.imul(Q,Oe)|0,b=b+Math.imul(Q,ye)|0,b=b+Math.imul(ee,Oe)|0,R=R+Math.imul(ee,ye)|0,w=w+Math.imul(U,it)|0,b=b+Math.imul(U,Fe)|0,b=b+Math.imul(G,it)|0,R=R+Math.imul(G,Fe)|0,w=w+Math.imul(F,We)|0,b=b+Math.imul(F,rt)|0,b=b+Math.imul(L,We)|0,R=R+Math.imul(L,rt)|0;var xr=(d+w|0)+((b&8191)<<13)|0;d=(R+(b>>>13)|0)+(xr>>>26)|0,xr&=67108863,w=Math.imul(Ae,tt),b=Math.imul(Ae,Ce),b=b+Math.imul(oe,tt)|0,R=Math.imul(oe,Ce),w=w+Math.imul(_e,Pe)|0,b=b+Math.imul(_e,de)|0,b=b+Math.imul(re,Pe)|0,R=R+Math.imul(re,de)|0,w=w+Math.imul(fe,Le)|0,b=b+Math.imul(fe,ce)|0,b=b+Math.imul(te,Le)|0,R=R+Math.imul(te,ce)|0,w=w+Math.imul(le,$e)|0,b=b+Math.imul(le,me)|0,b=b+Math.imul(ie,$e)|0,R=R+Math.imul(ie,me)|0,w=w+Math.imul(Ee,Ke)|0,b=b+Math.imul(Ee,ge)|0,b=b+Math.imul(se,Ke)|0,R=R+Math.imul(se,ge)|0,w=w+Math.imul(Se,Oe)|0,b=b+Math.imul(Se,ye)|0,b=b+Math.imul(he,Oe)|0,R=R+Math.imul(he,ye)|0,w=w+Math.imul(Q,it)|0,b=b+Math.imul(Q,Fe)|0,b=b+Math.imul(ee,it)|0,R=R+Math.imul(ee,Fe)|0,w=w+Math.imul(U,We)|0,b=b+Math.imul(U,rt)|0,b=b+Math.imul(G,We)|0,R=R+Math.imul(G,rt)|0;var pi=(d+w|0)+((b&8191)<<13)|0;d=(R+(b>>>13)|0)+(pi>>>26)|0,pi&=67108863,w=Math.imul(Ae,Pe),b=Math.imul(Ae,de),b=b+Math.imul(oe,Pe)|0,R=Math.imul(oe,de),w=w+Math.imul(_e,Le)|0,b=b+Math.imul(_e,ce)|0,b=b+Math.imul(re,Le)|0,R=R+Math.imul(re,ce)|0,w=w+Math.imul(fe,$e)|0,b=b+Math.imul(fe,me)|0,b=b+Math.imul(te,$e)|0,R=R+Math.imul(te,me)|0,w=w+Math.imul(le,Ke)|0,b=b+Math.imul(le,ge)|0,b=b+Math.imul(ie,Ke)|0,R=R+Math.imul(ie,ge)|0,w=w+Math.imul(Ee,Oe)|0,b=b+Math.imul(Ee,ye)|0,b=b+Math.imul(se,Oe)|0,R=R+Math.imul(se,ye)|0,w=w+Math.imul(Se,it)|0,b=b+Math.imul(Se,Fe)|0,b=b+Math.imul(he,it)|0,R=R+Math.imul(he,Fe)|0,w=w+Math.imul(Q,We)|0,b=b+Math.imul(Q,rt)|0,b=b+Math.imul(ee,We)|0,R=R+Math.imul(ee,rt)|0;var gi=(d+w|0)+((b&8191)<<13)|0;d=(R+(b>>>13)|0)+(gi>>>26)|0,gi&=67108863,w=Math.imul(Ae,Le),b=Math.imul(Ae,ce),b=b+Math.imul(oe,Le)|0,R=Math.imul(oe,ce),w=w+Math.imul(_e,$e)|0,b=b+Math.imul(_e,me)|0,b=b+Math.imul(re,$e)|0,R=R+Math.imul(re,me)|0,w=w+Math.imul(fe,Ke)|0,b=b+Math.imul(fe,ge)|0,b=b+Math.imul(te,Ke)|0,R=R+Math.imul(te,ge)|0,w=w+Math.imul(le,Oe)|0,b=b+Math.imul(le,ye)|0,b=b+Math.imul(ie,Oe)|0,R=R+Math.imul(ie,ye)|0,w=w+Math.imul(Ee,it)|0,b=b+Math.imul(Ee,Fe)|0,b=b+Math.imul(se,it)|0,R=R+Math.imul(se,Fe)|0,w=w+Math.imul(Se,We)|0,b=b+Math.imul(Se,rt)|0,b=b+Math.imul(he,We)|0,R=R+Math.imul(he,rt)|0;var Kt=(d+w|0)+((b&8191)<<13)|0;d=(R+(b>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,w=Math.imul(Ae,$e),b=Math.imul(Ae,me),b=b+Math.imul(oe,$e)|0,R=Math.imul(oe,me),w=w+Math.imul(_e,Ke)|0,b=b+Math.imul(_e,ge)|0,b=b+Math.imul(re,Ke)|0,R=R+Math.imul(re,ge)|0,w=w+Math.imul(fe,Oe)|0,b=b+Math.imul(fe,ye)|0,b=b+Math.imul(te,Oe)|0,R=R+Math.imul(te,ye)|0,w=w+Math.imul(le,it)|0,b=b+Math.imul(le,Fe)|0,b=b+Math.imul(ie,it)|0,R=R+Math.imul(ie,Fe)|0,w=w+Math.imul(Ee,We)|0,b=b+Math.imul(Ee,rt)|0,b=b+Math.imul(se,We)|0,R=R+Math.imul(se,rt)|0;var vi=(d+w|0)+((b&8191)<<13)|0;d=(R+(b>>>13)|0)+(vi>>>26)|0,vi&=67108863,w=Math.imul(Ae,Ke),b=Math.imul(Ae,ge),b=b+Math.imul(oe,Ke)|0,R=Math.imul(oe,ge),w=w+Math.imul(_e,Oe)|0,b=b+Math.imul(_e,ye)|0,b=b+Math.imul(re,Oe)|0,R=R+Math.imul(re,ye)|0,w=w+Math.imul(fe,it)|0,b=b+Math.imul(fe,Fe)|0,b=b+Math.imul(te,it)|0,R=R+Math.imul(te,Fe)|0,w=w+Math.imul(le,We)|0,b=b+Math.imul(le,rt)|0,b=b+Math.imul(ie,We)|0,R=R+Math.imul(ie,rt)|0;var bi=(d+w|0)+((b&8191)<<13)|0;d=(R+(b>>>13)|0)+(bi>>>26)|0,bi&=67108863,w=Math.imul(Ae,Oe),b=Math.imul(Ae,ye),b=b+Math.imul(oe,Oe)|0,R=Math.imul(oe,ye),w=w+Math.imul(_e,it)|0,b=b+Math.imul(_e,Fe)|0,b=b+Math.imul(re,it)|0,R=R+Math.imul(re,Fe)|0,w=w+Math.imul(fe,We)|0,b=b+Math.imul(fe,rt)|0,b=b+Math.imul(te,We)|0,R=R+Math.imul(te,rt)|0;var mi=(d+w|0)+((b&8191)<<13)|0;d=(R+(b>>>13)|0)+(mi>>>26)|0,mi&=67108863,w=Math.imul(Ae,it),b=Math.imul(Ae,Fe),b=b+Math.imul(oe,it)|0,R=Math.imul(oe,Fe),w=w+Math.imul(_e,We)|0,b=b+Math.imul(_e,rt)|0,b=b+Math.imul(re,We)|0,R=R+Math.imul(re,rt)|0;var ws=(d+w|0)+((b&8191)<<13)|0;d=(R+(b>>>13)|0)+(ws>>>26)|0,ws&=67108863,w=Math.imul(Ae,We),b=Math.imul(Ae,rt),b=b+Math.imul(oe,We)|0,R=Math.imul(oe,rt);var _s=(d+w|0)+((b&8191)<<13)|0;return d=(R+(b>>>13)|0)+(_s>>>26)|0,_s&=67108863,E[0]=rr,E[1]=ir,E[2]=nr,E[3]=sr,E[4]=yt,E[5]=ci,E[6]=hi,E[7]=ui,E[8]=di,E[9]=li,E[10]=xr,E[11]=pi,E[12]=gi,E[13]=Kt,E[14]=vi,E[15]=bi,E[16]=mi,E[17]=ws,E[18]=_s,d!==0&&(E[19]=d,v.length++),v};Math.imul||(B=j);function k(l,a,c){c.negative=a.negative^l.negative,c.length=l.length+a.length;for(var v=0,x=0,A=0;A<c.length-1;A++){var E=x;x=0;for(var d=v&67108863,w=Math.min(A,a.length-1),b=Math.max(0,A-l.length+1);b<=w;b++){var R=A-b,Y=l.words[R]|0,S=a.words[b]|0,V=Y*S,P=V&67108863;E=E+(V/67108864|0)|0,P=P+d|0,d=P&67108863,E=E+(P>>>26)|0,x+=E>>>26,E&=67108863}c.words[A]=d,v=E,E=x}return v!==0?c.words[A]=v:c.length--,c._strip()}function T(l,a,c){return k(l,a,c)}s.prototype.mulTo=function(a,c){var v,x=this.length+a.length;return this.length===10&&a.length===10?v=B(this,a,c):x<63?v=j(this,a,c):x<1024?v=k(this,a,c):v=T(this,a,c),v},s.prototype.mul=function(a){var c=new s(null);return c.words=new Array(this.length+a.length),this.mulTo(a,c)},s.prototype.mulf=function(a){var c=new s(null);return c.words=new Array(this.length+a.length),T(this,a,c)},s.prototype.imul=function(a){return this.clone().mulTo(a,this)},s.prototype.imuln=function(a){var c=a<0;c&&(a=-a),i(typeof a=="number"),i(a<67108864);for(var v=0,x=0;x<this.length;x++){var A=(this.words[x]|0)*a,E=(A&67108863)+(v&67108863);v>>=26,v+=A/67108864|0,v+=E>>>26,this.words[x]=E&67108863}return v!==0&&(this.words[x]=v,this.length++),c?this.ineg():this},s.prototype.muln=function(a){return this.clone().imuln(a)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(a){var c=K(a);if(c.length===0)return new s(1);for(var v=this,x=0;x<c.length&&c[x]===0;x++,v=v.sqr());if(++x<c.length)for(var A=v.sqr();x<c.length;x++,A=A.sqr())c[x]!==0&&(v=v.mul(A));return v},s.prototype.iushln=function(a){i(typeof a=="number"&&a>=0);var c=a%26,v=(a-c)/26,x=67108863>>>26-c<<26-c,A;if(c!==0){var E=0;for(A=0;A<this.length;A++){var d=this.words[A]&x,w=(this.words[A]|0)-d<<c;this.words[A]=w|E,E=d>>>26-c}E&&(this.words[A]=E,this.length++)}if(v!==0){for(A=this.length-1;A>=0;A--)this.words[A+v]=this.words[A];for(A=0;A<v;A++)this.words[A]=0;this.length+=v}return this._strip()},s.prototype.ishln=function(a){return i(this.negative===0),this.iushln(a)},s.prototype.iushrn=function(a,c,v){i(typeof a=="number"&&a>=0);var x;c?x=(c-c%26)/26:x=0;var A=a%26,E=Math.min((a-A)/26,this.length),d=67108863^67108863>>>A<<A,w=v;if(x-=E,x=Math.max(0,x),w){for(var b=0;b<E;b++)w.words[b]=this.words[b];w.length=E}if(E!==0)if(this.length>E)for(this.length-=E,b=0;b<this.length;b++)this.words[b]=this.words[b+E];else this.words[0]=0,this.length=1;var R=0;for(b=this.length-1;b>=0&&(R!==0||b>=x);b--){var Y=this.words[b]|0;this.words[b]=R<<26-A|Y>>>A,R=Y&d}return w&&R!==0&&(w.words[w.length++]=R),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(a,c,v){return i(this.negative===0),this.iushrn(a,c,v)},s.prototype.shln=function(a){return this.clone().ishln(a)},s.prototype.ushln=function(a){return this.clone().iushln(a)},s.prototype.shrn=function(a){return this.clone().ishrn(a)},s.prototype.ushrn=function(a){return this.clone().iushrn(a)},s.prototype.testn=function(a){i(typeof a=="number"&&a>=0);var c=a%26,v=(a-c)/26,x=1<<c;if(this.length<=v)return!1;var A=this.words[v];return!!(A&x)},s.prototype.imaskn=function(a){i(typeof a=="number"&&a>=0);var c=a%26,v=(a-c)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(c!==0&&v++,this.length=Math.min(v,this.length),c!==0){var x=67108863^67108863>>>c<<c;this.words[this.length-1]&=x}return this._strip()},s.prototype.maskn=function(a){return this.clone().imaskn(a)},s.prototype.iaddn=function(a){return i(typeof a=="number"),i(a<67108864),a<0?this.isubn(-a):this.negative!==0?this.length===1&&(this.words[0]|0)<=a?(this.words[0]=a-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(a),this.negative=1,this):this._iaddn(a)},s.prototype._iaddn=function(a){this.words[0]+=a;for(var c=0;c<this.length&&this.words[c]>=67108864;c++)this.words[c]-=67108864,c===this.length-1?this.words[c+1]=1:this.words[c+1]++;return this.length=Math.max(this.length,c+1),this},s.prototype.isubn=function(a){if(i(typeof a=="number"),i(a<67108864),a<0)return this.iaddn(-a);if(this.negative!==0)return this.negative=0,this.iaddn(a),this.negative=1,this;if(this.words[0]-=a,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var c=0;c<this.length&&this.words[c]<0;c++)this.words[c]+=67108864,this.words[c+1]-=1;return this._strip()},s.prototype.addn=function(a){return this.clone().iaddn(a)},s.prototype.subn=function(a){return this.clone().isubn(a)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(a,c,v){var x=a.length+v,A;this._expand(x);var E,d=0;for(A=0;A<a.length;A++){E=(this.words[A+v]|0)+d;var w=(a.words[A]|0)*c;E-=w&67108863,d=(E>>26)-(w/67108864|0),this.words[A+v]=E&67108863}for(;A<this.length-v;A++)E=(this.words[A+v]|0)+d,d=E>>26,this.words[A+v]=E&67108863;if(d===0)return this._strip();for(i(d===-1),d=0,A=0;A<this.length;A++)E=-(this.words[A]|0)+d,d=E>>26,this.words[A]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(a,c){var v=this.length-a.length,x=this.clone(),A=a,E=A.words[A.length-1]|0,d=this._countBits(E);v=26-d,v!==0&&(A=A.ushln(v),x.iushln(v),E=A.words[A.length-1]|0);var w=x.length-A.length,b;if(c!=="mod"){b=new s(null),b.length=w+1,b.words=new Array(b.length);for(var R=0;R<b.length;R++)b.words[R]=0}var Y=x.clone()._ishlnsubmul(A,1,w);Y.negative===0&&(x=Y,b&&(b.words[w]=1));for(var S=w-1;S>=0;S--){var V=(x.words[A.length+S]|0)*67108864+(x.words[A.length+S-1]|0);for(V=Math.min(V/E|0,67108863),x._ishlnsubmul(A,V,S);x.negative!==0;)V--,x.negative=0,x._ishlnsubmul(A,1,S),x.isZero()||(x.negative^=1);b&&(b.words[S]=V)}return b&&b._strip(),x._strip(),c!=="div"&&v!==0&&x.iushrn(v),{div:b||null,mod:x}},s.prototype.divmod=function(a,c,v){if(i(!a.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,A,E;return this.negative!==0&&a.negative===0?(E=this.neg().divmod(a,c),c!=="mod"&&(x=E.div.neg()),c!=="div"&&(A=E.mod.neg(),v&&A.negative!==0&&A.iadd(a)),{div:x,mod:A}):this.negative===0&&a.negative!==0?(E=this.divmod(a.neg(),c),c!=="mod"&&(x=E.div.neg()),{div:x,mod:E.mod}):this.negative&a.negative?(E=this.neg().divmod(a.neg(),c),c!=="div"&&(A=E.mod.neg(),v&&A.negative!==0&&A.isub(a)),{div:E.div,mod:A}):a.length>this.length||this.cmp(a)<0?{div:new s(0),mod:this}:a.length===1?c==="div"?{div:this.divn(a.words[0]),mod:null}:c==="mod"?{div:null,mod:new s(this.modrn(a.words[0]))}:{div:this.divn(a.words[0]),mod:new s(this.modrn(a.words[0]))}:this._wordDiv(a,c)},s.prototype.div=function(a){return this.divmod(a,"div",!1).div},s.prototype.mod=function(a){return this.divmod(a,"mod",!1).mod},s.prototype.umod=function(a){return this.divmod(a,"mod",!0).mod},s.prototype.divRound=function(a){var c=this.divmod(a);if(c.mod.isZero())return c.div;var v=c.div.negative!==0?c.mod.isub(a):c.mod,x=a.ushrn(1),A=a.andln(1),E=v.cmp(x);return E<0||A===1&&E===0?c.div:c.div.negative!==0?c.div.isubn(1):c.div.iaddn(1)},s.prototype.modrn=function(a){var c=a<0;c&&(a=-a),i(a<=67108863);for(var v=(1<<26)%a,x=0,A=this.length-1;A>=0;A--)x=(v*x+(this.words[A]|0))%a;return c?-x:x},s.prototype.modn=function(a){return this.modrn(a)},s.prototype.idivn=function(a){var c=a<0;c&&(a=-a),i(a<=67108863);for(var v=0,x=this.length-1;x>=0;x--){var A=(this.words[x]|0)+v*67108864;this.words[x]=A/a|0,v=A%a}return this._strip(),c?this.ineg():this},s.prototype.divn=function(a){return this.clone().idivn(a)},s.prototype.egcd=function(a){i(a.negative===0),i(!a.isZero());var c=this,v=a.clone();c.negative!==0?c=c.umod(a):c=c.clone();for(var x=new s(1),A=new s(0),E=new s(0),d=new s(1),w=0;c.isEven()&&v.isEven();)c.iushrn(1),v.iushrn(1),++w;for(var b=v.clone(),R=c.clone();!c.isZero();){for(var Y=0,S=1;!(c.words[0]&S)&&Y<26;++Y,S<<=1);if(Y>0)for(c.iushrn(Y);Y-- >0;)(x.isOdd()||A.isOdd())&&(x.iadd(b),A.isub(R)),x.iushrn(1),A.iushrn(1);for(var V=0,P=1;!(v.words[0]&P)&&V<26;++V,P<<=1);if(V>0)for(v.iushrn(V);V-- >0;)(E.isOdd()||d.isOdd())&&(E.iadd(b),d.isub(R)),E.iushrn(1),d.iushrn(1);c.cmp(v)>=0?(c.isub(v),x.isub(E),A.isub(d)):(v.isub(c),E.isub(x),d.isub(A))}return{a:E,b:d,gcd:v.iushln(w)}},s.prototype._invmp=function(a){i(a.negative===0),i(!a.isZero());var c=this,v=a.clone();c.negative!==0?c=c.umod(a):c=c.clone();for(var x=new s(1),A=new s(0),E=v.clone();c.cmpn(1)>0&&v.cmpn(1)>0;){for(var d=0,w=1;!(c.words[0]&w)&&d<26;++d,w<<=1);if(d>0)for(c.iushrn(d);d-- >0;)x.isOdd()&&x.iadd(E),x.iushrn(1);for(var b=0,R=1;!(v.words[0]&R)&&b<26;++b,R<<=1);if(b>0)for(v.iushrn(b);b-- >0;)A.isOdd()&&A.iadd(E),A.iushrn(1);c.cmp(v)>=0?(c.isub(v),x.isub(A)):(v.isub(c),A.isub(x))}var Y;return c.cmpn(1)===0?Y=x:Y=A,Y.cmpn(0)<0&&Y.iadd(a),Y},s.prototype.gcd=function(a){if(this.isZero())return a.abs();if(a.isZero())return this.abs();var c=this.clone(),v=a.clone();c.negative=0,v.negative=0;for(var x=0;c.isEven()&&v.isEven();x++)c.iushrn(1),v.iushrn(1);do{for(;c.isEven();)c.iushrn(1);for(;v.isEven();)v.iushrn(1);var A=c.cmp(v);if(A<0){var E=c;c=v,v=E}else if(A===0||v.cmpn(1)===0)break;c.isub(v)}while(!0);return v.iushln(x)},s.prototype.invm=function(a){return this.egcd(a).a.umod(a)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(a){return this.words[0]&a},s.prototype.bincn=function(a){i(typeof a=="number");var c=a%26,v=(a-c)/26,x=1<<c;if(this.length<=v)return this._expand(v+1),this.words[v]|=x,this;for(var A=x,E=v;A!==0&&E<this.length;E++){var d=this.words[E]|0;d+=A,A=d>>>26,d&=67108863,this.words[E]=d}return A!==0&&(this.words[E]=A,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(a){var c=a<0;if(this.negative!==0&&!c)return-1;if(this.negative===0&&c)return 1;this._strip();var v;if(this.length>1)v=1;else{c&&(a=-a),i(a<=67108863,"Number is too big");var x=this.words[0]|0;v=x===a?0:x<a?-1:1}return this.negative!==0?-v|0:v},s.prototype.cmp=function(a){if(this.negative!==0&&a.negative===0)return-1;if(this.negative===0&&a.negative!==0)return 1;var c=this.ucmp(a);return this.negative!==0?-c|0:c},s.prototype.ucmp=function(a){if(this.length>a.length)return 1;if(this.length<a.length)return-1;for(var c=0,v=this.length-1;v>=0;v--){var x=this.words[v]|0,A=a.words[v]|0;if(x!==A){x<A?c=-1:x>A&&(c=1);break}}return c},s.prototype.gtn=function(a){return this.cmpn(a)===1},s.prototype.gt=function(a){return this.cmp(a)===1},s.prototype.gten=function(a){return this.cmpn(a)>=0},s.prototype.gte=function(a){return this.cmp(a)>=0},s.prototype.ltn=function(a){return this.cmpn(a)===-1},s.prototype.lt=function(a){return this.cmp(a)===-1},s.prototype.lten=function(a){return this.cmpn(a)<=0},s.prototype.lte=function(a){return this.cmp(a)<=0},s.prototype.eqn=function(a){return this.cmpn(a)===0},s.prototype.eq=function(a){return this.cmp(a)===0},s.red=function(a){return new N(a)},s.prototype.toRed=function(a){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),a.convertTo(this)._forceRed(a)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(a){return this.red=a,this},s.prototype.forceRed=function(a){return i(!this.red,"Already a number in reduction context"),this._forceRed(a)},s.prototype.redAdd=function(a){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,a)},s.prototype.redIAdd=function(a){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,a)},s.prototype.redSub=function(a){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,a)},s.prototype.redISub=function(a){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,a)},s.prototype.redShl=function(a){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,a)},s.prototype.redMul=function(a){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.mul(this,a)},s.prototype.redIMul=function(a){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.imul(this,a)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(a){return i(this.red&&!a.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,a)};var q={k256:null,p224:null,p192:null,p25519:null};function $(l,a){this.name=l,this.p=new s(a,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}$.prototype._tmp=function(){var a=new s(null);return a.words=new Array(Math.ceil(this.n/13)),a},$.prototype.ireduce=function(a){var c=a,v;do this.split(c,this.tmp),c=this.imulK(c),c=c.iadd(this.tmp),v=c.bitLength();while(v>this.n);var x=v<this.n?-1:c.ucmp(this.p);return x===0?(c.words[0]=0,c.length=1):x>0?c.isub(this.p):c.strip!==void 0?c.strip():c._strip(),c},$.prototype.split=function(a,c){a.iushrn(this.n,0,c)},$.prototype.imulK=function(a){return a.imul(this.k)};function _(){$.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(_,$),_.prototype.split=function(a,c){for(var v=4194303,x=Math.min(a.length,9),A=0;A<x;A++)c.words[A]=a.words[A];if(c.length=x,a.length<=9){a.words[0]=0,a.length=1;return}var E=a.words[9];for(c.words[c.length++]=E&v,A=10;A<a.length;A++){var d=a.words[A]|0;a.words[A-10]=(d&v)<<4|E>>>22,E=d}E>>>=22,a.words[A-10]=E,E===0&&a.length>10?a.length-=10:a.length-=9},_.prototype.imulK=function(a){a.words[a.length]=0,a.words[a.length+1]=0,a.length+=2;for(var c=0,v=0;v<a.length;v++){var x=a.words[v]|0;c+=x*977,a.words[v]=c&67108863,c=x*64+(c/67108864|0)}return a.words[a.length-1]===0&&(a.length--,a.words[a.length-1]===0&&a.length--),a};function O(){$.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(O,$);function W(){$.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(W,$);function X(){$.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(X,$),X.prototype.imulK=function(a){for(var c=0,v=0;v<a.length;v++){var x=(a.words[v]|0)*19+c,A=x&67108863;x>>>=26,a.words[v]=A,c=x}return c!==0&&(a.words[a.length++]=c),a},s._prime=function(a){if(q[a])return q[a];var c;if(a==="k256")c=new _;else if(a==="p224")c=new O;else if(a==="p192")c=new W;else if(a==="p25519")c=new X;else throw new Error("Unknown prime "+a);return q[a]=c,c};function N(l){if(typeof l=="string"){var a=s._prime(l);this.m=a.p,this.prime=a}else i(l.gtn(1),"modulus must be greater than 1"),this.m=l,this.prime=null}N.prototype._verify1=function(a){i(a.negative===0,"red works only with positives"),i(a.red,"red works only with red numbers")},N.prototype._verify2=function(a,c){i((a.negative|c.negative)===0,"red works only with positives"),i(a.red&&a.red===c.red,"red works only with red numbers")},N.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):(p(a,a.umod(this.m)._forceRed(this)),a)},N.prototype.neg=function(a){return a.isZero()?a.clone():this.m.sub(a)._forceRed(this)},N.prototype.add=function(a,c){this._verify2(a,c);var v=a.add(c);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},N.prototype.iadd=function(a,c){this._verify2(a,c);var v=a.iadd(c);return v.cmp(this.m)>=0&&v.isub(this.m),v},N.prototype.sub=function(a,c){this._verify2(a,c);var v=a.sub(c);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},N.prototype.isub=function(a,c){this._verify2(a,c);var v=a.isub(c);return v.cmpn(0)<0&&v.iadd(this.m),v},N.prototype.shl=function(a,c){return this._verify1(a),this.imod(a.ushln(c))},N.prototype.imul=function(a,c){return this._verify2(a,c),this.imod(a.imul(c))},N.prototype.mul=function(a,c){return this._verify2(a,c),this.imod(a.mul(c))},N.prototype.isqr=function(a){return this.imul(a,a.clone())},N.prototype.sqr=function(a){return this.mul(a,a)},N.prototype.sqrt=function(a){if(a.isZero())return a.clone();var c=this.m.andln(3);if(i(c%2===1),c===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(a,v)}for(var x=this.m.subn(1),A=0;!x.isZero()&&x.andln(1)===0;)A++,x.iushrn(1);i(!x.isZero());var E=new s(1).toRed(this),d=E.redNeg(),w=this.m.subn(1).iushrn(1),b=this.m.bitLength();for(b=new s(2*b*b).toRed(this);this.pow(b,w).cmp(d)!==0;)b.redIAdd(d);for(var R=this.pow(b,x),Y=this.pow(a,x.addn(1).iushrn(1)),S=this.pow(a,x),V=A;S.cmp(E)!==0;){for(var P=S,F=0;P.cmp(E)!==0;F++)P=P.redSqr();i(F<V);var L=this.pow(R,new s(1).iushln(V-F-1));Y=Y.redMul(L),R=L.redSqr(),S=S.redMul(R),V=F}return Y},N.prototype.invm=function(a){var c=a._invmp(this.m);return c.negative!==0?(c.negative=0,this.imod(c).redNeg()):this.imod(c)},N.prototype.pow=function(a,c){if(c.isZero())return new s(1).toRed(this);if(c.cmpn(1)===0)return a.clone();var v=4,x=new Array(1<<v);x[0]=new s(1).toRed(this),x[1]=a;for(var A=2;A<x.length;A++)x[A]=this.mul(x[A-1],a);var E=x[0],d=0,w=0,b=c.bitLength()%26;for(b===0&&(b=26),A=c.length-1;A>=0;A--){for(var R=c.words[A],Y=b-1;Y>=0;Y--){var S=R>>Y&1;if(E!==x[0]&&(E=this.sqr(E)),S===0&&d===0){w=0;continue}d<<=1,d|=S,w++,!(w!==v&&(A!==0||Y!==0))&&(E=this.mul(E,x[d]),w=0,d=0)}b=26}return E},N.prototype.convertTo=function(a){var c=a.umod(this.m);return c===a?c.clone():c},N.prototype.convertFrom=function(a){var c=a.clone();return c.red=null,c},s.mont=function(a){return new g(a)};function g(l){N.call(this,l),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(g,N),g.prototype.convertTo=function(a){return this.imod(a.ushln(this.shift))},g.prototype.convertFrom=function(a){var c=this.imod(a.mul(this.rinv));return c.red=null,c},g.prototype.imul=function(a,c){if(a.isZero()||c.isZero())return a.words[0]=0,a.length=1,a;var v=a.imul(c),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),A=v.isub(x).iushrn(this.shift),E=A;return A.cmp(this.m)>=0?E=A.isub(this.m):A.cmpn(0)<0&&(E=A.iadd(this.m)),E._forceRed(this)},g.prototype.mul=function(a,c){if(a.isZero()||c.isZero())return new s(0)._forceRed(this);var v=a.mul(c),x=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),A=v.isub(x).iushrn(this.shift),E=A;return A.cmp(this.m)>=0?E=A.isub(this.m):A.cmpn(0)<0&&(E=A.iadd(this.m)),E._forceRed(this)},g.prototype.invm=function(a){var c=this.imod(a._invmp(this.m).mul(this.r2));return c._forceRed(this)}})(r,Ot)})(fh);var je=fh.exports;const ch="bignumber/5.7.0";var Gs=je.BN;const Zr=new He(ch),go={},hh=9007199254740991;function yv(r){return r!=null&&(ot.isBigNumber(r)||typeof r=="number"&&r%1===0||typeof r=="string"&&!!r.match(/^-?[0-9]+$/)||or(r)||typeof r=="bigint"||ln(r))}let uh=!1;class ot{constructor(e,t){e!==go&&Zr.throwError("cannot call constructor directly; use BigNumber.from",He.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Xt(Xe(this).fromTwos(e))}toTwos(e){return Xt(Xe(this).toTwos(e))}abs(){return this._hex[0]==="-"?ot.from(this._hex.substring(1)):this}add(e){return Xt(Xe(this).add(Xe(e)))}sub(e){return Xt(Xe(this).sub(Xe(e)))}div(e){return ot.from(e).isZero()&&lr("division-by-zero","div"),Xt(Xe(this).div(Xe(e)))}mul(e){return Xt(Xe(this).mul(Xe(e)))}mod(e){const t=Xe(e);return t.isNeg()&&lr("division-by-zero","mod"),Xt(Xe(this).umod(t))}pow(e){const t=Xe(e);return t.isNeg()&&lr("negative-power","pow"),Xt(Xe(this).pow(t))}and(e){const t=Xe(e);return(this.isNegative()||t.isNeg())&&lr("unbound-bitwise-result","and"),Xt(Xe(this).and(t))}or(e){const t=Xe(e);return(this.isNegative()||t.isNeg())&&lr("unbound-bitwise-result","or"),Xt(Xe(this).or(t))}xor(e){const t=Xe(e);return(this.isNegative()||t.isNeg())&&lr("unbound-bitwise-result","xor"),Xt(Xe(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&lr("negative-width","mask"),Xt(Xe(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&lr("negative-width","shl"),Xt(Xe(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&lr("negative-width","shr"),Xt(Xe(this).shrn(e))}eq(e){return Xe(this).eq(Xe(e))}lt(e){return Xe(this).lt(Xe(e))}lte(e){return Xe(this).lte(Xe(e))}gt(e){return Xe(this).gt(Xe(e))}gte(e){return Xe(this).gte(Xe(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Xe(this).isZero()}toNumber(){try{return Xe(this).toNumber()}catch{lr("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Zr.throwError("this platform does not support BigInt",He.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?uh||(uh=!0,Zr.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Zr.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",He.errors.UNEXPECTED_ARGUMENT,{}):Zr.throwError("BigNumber.toString does not accept parameters",He.errors.UNEXPECTED_ARGUMENT,{})),Xe(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof ot)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new ot(go,jn(e)):e.match(/^-?[0-9]+$/)?new ot(go,jn(new Gs(e))):Zr.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&lr("underflow","BigNumber.from",e),(e>=hh||e<=-hh)&&lr("overflow","BigNumber.from",e),ot.from(String(e));const t=e;if(typeof t=="bigint")return ot.from(t.toString());if(ln(t))return ot.from(Vt(t));if(t)if(t.toHexString){const i=t.toHexString();if(typeof i=="string")return ot.from(i)}else{let i=t._hex;if(i==null&&t.type==="BigNumber"&&(i=t.hex),typeof i=="string"&&(or(i)||i[0]==="-"&&or(i.substring(1))))return ot.from(i)}return Zr.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function jn(r){if(typeof r!="string")return jn(r.toString(16));if(r[0]==="-")return r=r.substring(1),r[0]==="-"&&Zr.throwArgumentError("invalid hex","value",r),r=jn(r),r==="0x00"?r:"-"+r;if(r.substring(0,2)!=="0x"&&(r="0x"+r),r==="0x")return"0x00";for(r.length%2&&(r="0x0"+r.substring(2));r.length>4&&r.substring(0,4)==="0x00";)r="0x"+r.substring(4);return r}function Xt(r){return ot.from(jn(r))}function Xe(r){const e=ot.from(r).toHexString();return e[0]==="-"?new Gs("-"+e.substring(3),16):new Gs(e.substring(2),16)}function lr(r,e,t){const i={fault:r,operation:e};return t!=null&&(i.value=t),Zr.throwError(r,He.errors.NUMERIC_FAULT,i)}function wv(r){return new Gs(r,36).toString(16)}const Ht=new He(ch),Vn={},dh=ot.from(0),lh=ot.from(-1);function ph(r,e,t,i){const n={fault:e,operation:t};return i!==void 0&&(n.value=i),Ht.throwError(r,He.errors.NUMERIC_FAULT,n)}let Hn="0";for(;Hn.length<256;)Hn+=Hn;function vo(r){if(typeof r!="number")try{r=ot.from(r).toNumber()}catch{}return typeof r=="number"&&r>=0&&r<=256&&!(r%1)?"1"+Hn.substring(0,r):Ht.throwArgumentError("invalid decimal size","decimals",r)}function bo(r,e){e==null&&(e=0);const t=vo(e);r=ot.from(r);const i=r.lt(dh);i&&(r=r.mul(lh));let n=r.mod(t).toString();for(;n.length<t.length-1;)n="0"+n;n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=r.div(t).toString();return t.length===1?r=s:r=s+"."+n,i&&(r="-"+r),r}function ei(r,e){e==null&&(e=0);const t=vo(e);(typeof r!="string"||!r.match(/^-?[0-9.]+$/))&&Ht.throwArgumentError("invalid decimal value","value",r);const i=r.substring(0,1)==="-";i&&(r=r.substring(1)),r==="."&&Ht.throwArgumentError("missing value","value",r);const n=r.split(".");n.length>2&&Ht.throwArgumentError("too many decimal points","value",r);let s=n[0],o=n[1];for(s||(s="0"),o||(o="0");o[o.length-1]==="0";)o=o.substring(0,o.length-1);for(o.length>t.length-1&&ph("fractional component exceeds decimals","underflow","parseFixed"),o===""&&(o="0");o.length<t.length-1;)o+="0";const f=ot.from(s),u=ot.from(o);let h=f.mul(t).add(u);return i&&(h=h.mul(lh)),h}class pn{constructor(e,t,i,n){e!==Vn&&Ht.throwError("cannot use FixedFormat constructor; use FixedFormat.from",He.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=i,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(i)+"x"+String(n),this._multiplier=vo(n),Object.freeze(this)}static from(e){if(e instanceof pn)return e;typeof e=="number"&&(e=`fixed128x${e}`);let t=!0,i=128,n=18;if(typeof e=="string"){if(e!=="fixed")if(e==="ufixed")t=!1;else{const s=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);s||Ht.throwArgumentError("invalid fixed format","format",e),t=s[1]!=="u",i=parseInt(s[2]),n=parseInt(s[3])}}else if(e){const s=(o,f,u)=>e[o]==null?u:(typeof e[o]!==f&&Ht.throwArgumentError("invalid fixed format ("+o+" not "+f+")","format."+o,e[o]),e[o]);t=s("signed","boolean",t),i=s("width","number",i),n=s("decimals","number",n)}return i%8&&Ht.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",i),n>80&&Ht.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new pn(Vn,t,i,n)}}class Ct{constructor(e,t,i,n){e!==Vn&&Ht.throwError("cannot use FixedNumber constructor; use FixedNumber.from",He.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=i,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&Ht.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=ei(this._value,this.format.decimals),i=ei(e._value,e.format.decimals);return Ct.fromValue(t.add(i),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=ei(this._value,this.format.decimals),i=ei(e._value,e.format.decimals);return Ct.fromValue(t.sub(i),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=ei(this._value,this.format.decimals),i=ei(e._value,e.format.decimals);return Ct.fromValue(t.mul(i).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=ei(this._value,this.format.decimals),i=ei(e._value,e.format.decimals);return Ct.fromValue(t.mul(this.format._multiplier).div(i),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let t=Ct.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return this.isNegative()&&i&&(t=t.subUnsafe(gh.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let t=Ct.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return!this.isNegative()&&i&&(t=t.addUnsafe(gh.toFormat(t.format))),t}round(e){e==null&&(e=0);const t=this.toString().split(".");if(t.length===1&&t.push("0"),(e<0||e>80||e%1)&&Ht.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const i=Ct.from("1"+Hn.substring(0,e),this.format),n=_v.toFormat(this.format);return this.mulUnsafe(i).addUnsafe(n).floor().divUnsafe(i)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&Ht.throwArgumentError("invalid byte width","width",e);const t=ot.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return Br(t,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Ct.fromString(this._value,e)}static fromValue(e,t,i){return i==null&&t!=null&&!yv(t)&&(i=t,t=null),t==null&&(t=0),i==null&&(i="fixed"),Ct.fromString(bo(e,t),pn.from(i))}static fromString(e,t){t==null&&(t="fixed");const i=pn.from(t),n=ei(e,i.decimals);!i.signed&&n.lt(dh)&&ph("unsigned value cannot be negative","overflow","value",e);let s=null;i.signed?s=n.toTwos(i.width).toHexString():(s=n.toHexString(),s=Br(s,i.width/8));const o=bo(n,i.decimals);return new Ct(Vn,s,o,i)}static fromBytes(e,t){t==null&&(t="fixed");const i=pn.from(t);if(lt(e).length>i.width/8)throw new Error("overflow");let n=ot.from(e);i.signed&&(n=n.fromTwos(i.width));const s=n.toTwos((i.signed?0:1)+i.width).toHexString(),o=bo(n,i.decimals);return new Ct(Vn,s,o,i)}static from(e,t){if(typeof e=="string")return Ct.fromString(e,t);if(ln(e))return Ct.fromBytes(e,t);try{return Ct.fromValue(e,0,t)}catch(i){if(i.code!==He.errors.INVALID_ARGUMENT)throw i}return Ht.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}}const gh=Ct.from(1),_v=Ct.from("0.5"),Ev="strings/5.7.0",vh=new He(Ev);var Ys;(function(r){r.current="",r.NFC="NFC",r.NFD="NFD",r.NFKC="NFKC",r.NFKD="NFKD"})(Ys||(Ys={}));var gn;(function(r){r.UNEXPECTED_CONTINUE="unexpected continuation byte",r.BAD_PREFIX="bad codepoint prefix",r.OVERRUN="string overrun",r.MISSING_CONTINUE="missing continuation byte",r.OUT_OF_RANGE="out of UTF-8 range",r.UTF16_SURROGATE="UTF-16 surrogate",r.OVERLONG="overlong representation"})(gn||(gn={}));function xv(r,e,t,i,n){return vh.throwArgumentError(`invalid codepoint at offset ${e}; ${r}`,"bytes",t)}function bh(r,e,t,i,n){if(r===gn.BAD_PREFIX||r===gn.UNEXPECTED_CONTINUE){let s=0;for(let o=e+1;o<t.length&&t[o]>>6===2;o++)s++;return s}return r===gn.OVERRUN?t.length-e-1:0}function Av(r,e,t,i,n){return r===gn.OVERLONG?(i.push(n),0):(i.push(65533),bh(r,e,t))}Object.freeze({error:xv,ignore:bh,replace:Av});function mo(r,e=Ys.current){e!=Ys.current&&(vh.checkNormalize(),r=r.normalize(e));let t=[];for(let i=0;i<r.length;i++){const n=r.charCodeAt(i);if(n<128)t.push(n);else if(n<2048)t.push(n>>6|192),t.push(n&63|128);else if((n&64512)==55296){i++;const s=r.charCodeAt(i);if(i>=r.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((n&1023)<<10)+(s&1023);t.push(o>>18|240),t.push(o>>12&63|128),t.push(o>>6&63|128),t.push(o&63|128)}else t.push(n>>12|224),t.push(n>>6&63|128),t.push(n&63|128)}return lt(t)}function Sv(r){if(r.length%4!==0)throw new Error("bad data");let e=[];for(let t=0;t<r.length;t+=4)e.push(parseInt(r.substring(t,t+4),16));return e}function yo(r,e){e||(e=function(n){return[parseInt(n,16)]});let t=0,i={};return r.split(",").forEach(n=>{let s=n.split(":");t+=parseInt(s[0],16),i[t]=e(s[1])}),i}function mh(r){let e=0;return r.split(",").map(t=>{let i=t.split("-");i.length===1?i[1]="0":i[1]===""&&(i[1]="1");let n=e+parseInt(i[0],16);return e=parseInt(i[1],16),{l:n,h:e}})}mh("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(r=>parseInt(r,16)),yo("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),yo("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),yo("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",Sv),mh("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");const yh="hash/5.7.0";function Dv(r){r=atob(r);const e=[];for(let t=0;t<r.length;t++)e.push(r.charCodeAt(t));return lt(e)}function wh(r,e){e==null&&(e=1);const t=[],i=t.forEach,n=function(s,o){i.call(s,function(f){o>0&&Array.isArray(f)?n(f,o-1):t.push(f)})};return n(r,e),t}function Mv(r){const e={};for(let t=0;t<r.length;t++){const i=r[t];e[i[0]]=i[1]}return e}function Iv(r){let e=0;function t(){return r[e++]<<8|r[e++]}let i=t(),n=1,s=[0,1];for(let q=1;q<i;q++)s.push(n+=t());let o=t(),f=e;e+=o;let u=0,h=0;function p(){return u==0&&(h=h<<8|r[e++],u=8),h>>--u&1}const y=31,M=Math.pow(2,y),D=M>>>1,I=D>>1,C=M-1;let K=0;for(let q=0;q<y;q++)K=K<<1|p();let j=[],B=0,k=M;for(;;){let q=Math.floor(((K-B+1)*n-1)/k),$=0,_=i;for(;_-$>1;){let X=$+_>>>1;q<s[X]?_=X:$=X}if($==0)break;j.push($);let O=B+Math.floor(k*s[$]/n),W=B+Math.floor(k*s[$+1]/n)-1;for(;!((O^W)&D);)K=K<<1&C|p(),O=O<<1&C,W=W<<1&C|1;for(;O&~W&I;)K=K&D|K<<1&C>>>1|p(),O=O<<1^D,W=(W^D)<<1|D|1;B=O,k=1+W-O}let T=i-4;return j.map(q=>{switch(q-T){case 3:return T+65792+(r[f++]<<16|r[f++]<<8|r[f++]);case 2:return T+256+(r[f++]<<8|r[f++]);case 1:return T+r[f++];default:return q-1}})}function Rv(r){let e=0;return()=>r[e++]}function Ov(r){return Rv(Iv(r))}function Nv(r){return r&1?~r>>1:r>>1}function Cv(r,e){let t=Array(r);for(let i=0;i<r;i++)t[i]=1+e();return t}function _h(r,e){let t=Array(r);for(let i=0,n=-1;i<r;i++)t[i]=n+=1+e();return t}function Pv(r,e){let t=Array(r);for(let i=0,n=0;i<r;i++)t[i]=n+=Nv(e());return t}function Ws(r,e){let t=_h(r(),r),i=r(),n=_h(i,r),s=Cv(i,r);for(let o=0;o<i;o++)for(let f=0;f<s[o];f++)t.push(n[o]+f);return e?t.map(o=>e[o]):t}function Tv(r){let e=[];for(;;){let t=r();if(t==0)break;e.push(Lv(t,r))}for(;;){let t=r()-1;if(t<0)break;e.push(Uv(t,r))}return Mv(wh(e))}function Bv(r){let e=[];for(;;){let t=r();if(t==0)break;e.push(t)}return e}function Eh(r,e,t){let i=Array(r).fill(void 0).map(()=>[]);for(let n=0;n<e;n++)Pv(r,t).forEach((s,o)=>i[o].push(s));return i}function Lv(r,e){let t=1+e(),i=e(),n=Bv(e),s=Eh(n.length,1+r,e);return wh(s.map((o,f)=>{const u=o[0],h=o.slice(1);return Array(n[f]).fill(void 0).map((p,y)=>{let M=y*i;return[u+y*t,h.map(D=>D+M)]})}))}function Uv(r,e){let t=1+e();return Eh(t,1+r,e).map(n=>[n[0],n.slice(1)])}function Fv(r){let e=Ws(r).sort((i,n)=>i-n);return t();function t(){let i=[];for(;;){let h=Ws(r,e);if(h.length==0)break;i.push({set:new Set(h),node:t()})}i.sort((h,p)=>p.set.size-h.set.size);let n=r(),s=n%3;n=n/3|0;let o=!!(n&1);n>>=1;let f=n==1,u=n==2;return{branches:i,valid:s,fe0f:o,save:f,check:u}}}function qv(){return Ov(Dv("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Js=qv();new Set(Ws(Js)),new Set(Ws(Js)),Tv(Js),Fv(Js),new He(yh),new Uint8Array(32).fill(0);const $v=`Ethereum Signed Message:
22
- `;function xh(r){return typeof r=="string"&&(r=mo(r)),po(vv([mo($v),mo(String(r.length)),r]))}const zv="rlp/5.7.0";new He(zv);const Kv="address/5.7.0",Gn=new He(Kv);function Ah(r){or(r,20)||Gn.throwArgumentError("invalid address","address",r),r=r.toLowerCase();const e=r.substring(2).split(""),t=new Uint8Array(40);for(let n=0;n<40;n++)t[n]=e[n].charCodeAt(0);const i=lt(po(t));for(let n=0;n<40;n+=2)i[n>>1]>>4>=8&&(e[n]=e[n].toUpperCase()),(i[n>>1]&15)>=8&&(e[n+1]=e[n+1].toUpperCase());return"0x"+e.join("")}const kv=9007199254740991;function jv(r){return Math.log10?Math.log10(r):Math.log(r)/Math.LN10}const wo={};for(let r=0;r<10;r++)wo[String(r)]=String(r);for(let r=0;r<26;r++)wo[String.fromCharCode(65+r)]=String(10+r);const Sh=Math.floor(jv(kv));function Vv(r){r=r.toUpperCase(),r=r.substring(4)+r.substring(0,2)+"00";let e=r.split("").map(i=>wo[i]).join("");for(;e.length>=Sh;){let i=e.substring(0,Sh);e=parseInt(i,10)%97+e.substring(i.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}function Hv(r){let e=null;if(typeof r!="string"&&Gn.throwArgumentError("invalid address","address",r),r.match(/^(0x)?[0-9a-fA-F]{40}$/))r.substring(0,2)!=="0x"&&(r="0x"+r),e=Ah(r),r.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==r&&Gn.throwArgumentError("bad address checksum","address",r);else if(r.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(r.substring(2,4)!==Vv(r)&&Gn.throwArgumentError("bad icap checksum","address",r),e=wv(r.substring(4));e.length<40;)e="0"+e;e=Ah("0x"+e)}else Gn.throwArgumentError("invalid address","address",r);return e}const Gv="properties/5.7.0";new He(Gv);function Yn(r,e,t){Object.defineProperty(r,e,{enumerable:!0,value:t,writable:!1})}new He(yh),new Uint8Array(32).fill(0),ot.from(-1);const Yv=ot.from(0),Wv=ot.from(1);ot.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Br(Wv.toHexString(),32),Br(Yv.toHexString(),32);var fr={},Ze={},qi=Dh;function Dh(r,e){if(!r)throw new Error(e||"Assertion failed")}Dh.equal=function(e,t,i){if(e!=t)throw new Error(i||"Assertion failed: "+e+" != "+t)};var vn={exports:{}};typeof Object.create=="function"?vn.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:vn.exports=function(e,t){if(t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}};var Jv=qi,Qv=vn.exports;Ze.inherits=Qv;function Xv(r,e){return(r.charCodeAt(e)&64512)!==55296||e<0||e+1>=r.length?!1:(r.charCodeAt(e+1)&64512)===56320}function Zv(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if(typeof r=="string")if(e){if(e==="hex")for(r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r),n=0;n<r.length;n+=2)t.push(parseInt(r[n]+r[n+1],16))}else for(var i=0,n=0;n<r.length;n++){var s=r.charCodeAt(n);s<128?t[i++]=s:s<2048?(t[i++]=s>>6|192,t[i++]=s&63|128):Xv(r,n)?(s=65536+((s&1023)<<10)+(r.charCodeAt(++n)&1023),t[i++]=s>>18|240,t[i++]=s>>12&63|128,t[i++]=s>>6&63|128,t[i++]=s&63|128):(t[i++]=s>>12|224,t[i++]=s>>6&63|128,t[i++]=s&63|128)}else for(n=0;n<r.length;n++)t[n]=r[n]|0;return t}Ze.toArray=Zv;function eb(r){for(var e="",t=0;t<r.length;t++)e+=Ih(r[t].toString(16));return e}Ze.toHex=eb;function Mh(r){var e=r>>>24|r>>>8&65280|r<<8&16711680|(r&255)<<24;return e>>>0}Ze.htonl=Mh;function tb(r,e){for(var t="",i=0;i<r.length;i++){var n=r[i];e==="little"&&(n=Mh(n)),t+=Rh(n.toString(16))}return t}Ze.toHex32=tb;function Ih(r){return r.length===1?"0"+r:r}Ze.zero2=Ih;function Rh(r){return r.length===7?"0"+r:r.length===6?"00"+r:r.length===5?"000"+r:r.length===4?"0000"+r:r.length===3?"00000"+r:r.length===2?"000000"+r:r.length===1?"0000000"+r:r}Ze.zero8=Rh;function rb(r,e,t,i){var n=t-e;Jv(n%4===0);for(var s=new Array(n/4),o=0,f=e;o<s.length;o++,f+=4){var u;i==="big"?u=r[f]<<24|r[f+1]<<16|r[f+2]<<8|r[f+3]:u=r[f+3]<<24|r[f+2]<<16|r[f+1]<<8|r[f],s[o]=u>>>0}return s}Ze.join32=rb;function ib(r,e){for(var t=new Array(r.length*4),i=0,n=0;i<r.length;i++,n+=4){var s=r[i];e==="big"?(t[n]=s>>>24,t[n+1]=s>>>16&255,t[n+2]=s>>>8&255,t[n+3]=s&255):(t[n+3]=s>>>24,t[n+2]=s>>>16&255,t[n+1]=s>>>8&255,t[n]=s&255)}return t}Ze.split32=ib;function nb(r,e){return r>>>e|r<<32-e}Ze.rotr32=nb;function sb(r,e){return r<<e|r>>>32-e}Ze.rotl32=sb;function ab(r,e){return r+e>>>0}Ze.sum32=ab;function ob(r,e,t){return r+e+t>>>0}Ze.sum32_3=ob;function fb(r,e,t,i){return r+e+t+i>>>0}Ze.sum32_4=fb;function cb(r,e,t,i,n){return r+e+t+i+n>>>0}Ze.sum32_5=cb;function hb(r,e,t,i){var n=r[e],s=r[e+1],o=i+s>>>0,f=(o<i?1:0)+t+n;r[e]=f>>>0,r[e+1]=o}Ze.sum64=hb;function ub(r,e,t,i){var n=e+i>>>0,s=(n<e?1:0)+r+t;return s>>>0}Ze.sum64_hi=ub;function db(r,e,t,i){var n=e+i;return n>>>0}Ze.sum64_lo=db;function lb(r,e,t,i,n,s,o,f){var u=0,h=e;h=h+i>>>0,u+=h<e?1:0,h=h+s>>>0,u+=h<s?1:0,h=h+f>>>0,u+=h<f?1:0;var p=r+t+n+o+u;return p>>>0}Ze.sum64_4_hi=lb;function pb(r,e,t,i,n,s,o,f){var u=e+i+s+f;return u>>>0}Ze.sum64_4_lo=pb;function gb(r,e,t,i,n,s,o,f,u,h){var p=0,y=e;y=y+i>>>0,p+=y<e?1:0,y=y+s>>>0,p+=y<s?1:0,y=y+f>>>0,p+=y<f?1:0,y=y+h>>>0,p+=y<h?1:0;var M=r+t+n+o+u+p;return M>>>0}Ze.sum64_5_hi=gb;function vb(r,e,t,i,n,s,o,f,u,h){var p=e+i+s+f+h;return p>>>0}Ze.sum64_5_lo=vb;function bb(r,e,t){var i=e<<32-t|r>>>t;return i>>>0}Ze.rotr64_hi=bb;function mb(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}Ze.rotr64_lo=mb;function yb(r,e,t){return r>>>t}Ze.shr64_hi=yb;function wb(r,e,t){var i=r<<32-t|e>>>t;return i>>>0}Ze.shr64_lo=wb;var bn={},Oh=Ze,_b=qi;function Qs(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}bn.BlockHash=Qs,Qs.prototype.update=function(e,t){if(e=Oh.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var i=e.length%this._delta8;this.pending=e.slice(e.length-i,e.length),this.pending.length===0&&(this.pending=null),e=Oh.join32(e,0,e.length-i,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},Qs.prototype.digest=function(e){return this.update(this._pad()),_b(this.pending===null),this._digest(e)},Qs.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,i=t-(e+this.padLength)%t,n=new Array(i+this.padLength);n[0]=128;for(var s=1;s<i;s++)n[s]=0;if(e<<=3,this.endian==="big"){for(var o=8;o<this.padLength;o++)n[s++]=0;n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=e>>>24&255,n[s++]=e>>>16&255,n[s++]=e>>>8&255,n[s++]=e&255}else for(n[s++]=e&255,n[s++]=e>>>8&255,n[s++]=e>>>16&255,n[s++]=e>>>24&255,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,o=8;o<this.padLength;o++)n[s++]=0;return n};var mn={},Lr={},Eb=Ze,Ur=Eb.rotr32;function xb(r,e,t,i){if(r===0)return Nh(e,t,i);if(r===1||r===3)return Ph(e,t,i);if(r===2)return Ch(e,t,i)}Lr.ft_1=xb;function Nh(r,e,t){return r&e^~r&t}Lr.ch32=Nh;function Ch(r,e,t){return r&e^r&t^e&t}Lr.maj32=Ch;function Ph(r,e,t){return r^e^t}Lr.p32=Ph;function Ab(r){return Ur(r,2)^Ur(r,13)^Ur(r,22)}Lr.s0_256=Ab;function Sb(r){return Ur(r,6)^Ur(r,11)^Ur(r,25)}Lr.s1_256=Sb;function Db(r){return Ur(r,7)^Ur(r,18)^r>>>3}Lr.g0_256=Db;function Mb(r){return Ur(r,17)^Ur(r,19)^r>>>10}Lr.g1_256=Mb;var yn=Ze,Ib=bn,Rb=Lr,_o=yn.rotl32,Wn=yn.sum32,Ob=yn.sum32_5,Nb=Rb.ft_1,Th=Ib.BlockHash,Cb=[1518500249,1859775393,2400959708,3395469782];function Fr(){if(!(this instanceof Fr))return new Fr;Th.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}yn.inherits(Fr,Th);var Pb=Fr;Fr.blockSize=512,Fr.outSize=160,Fr.hmacStrength=80,Fr.padLength=64,Fr.prototype._update=function(e,t){for(var i=this.W,n=0;n<16;n++)i[n]=e[t+n];for(;n<i.length;n++)i[n]=_o(i[n-3]^i[n-8]^i[n-14]^i[n-16],1);var s=this.h[0],o=this.h[1],f=this.h[2],u=this.h[3],h=this.h[4];for(n=0;n<i.length;n++){var p=~~(n/20),y=Ob(_o(s,5),Nb(p,o,f,u),h,i[n],Cb[p]);h=u,u=f,f=_o(o,30),o=s,s=y}this.h[0]=Wn(this.h[0],s),this.h[1]=Wn(this.h[1],o),this.h[2]=Wn(this.h[2],f),this.h[3]=Wn(this.h[3],u),this.h[4]=Wn(this.h[4],h)},Fr.prototype._digest=function(e){return e==="hex"?yn.toHex32(this.h,"big"):yn.split32(this.h,"big")};var wn=Ze,Tb=bn,_n=Lr,Bb=qi,Mr=wn.sum32,Lb=wn.sum32_4,Ub=wn.sum32_5,Fb=_n.ch32,qb=_n.maj32,$b=_n.s0_256,zb=_n.s1_256,Kb=_n.g0_256,kb=_n.g1_256,Bh=Tb.BlockHash,jb=[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];function qr(){if(!(this instanceof qr))return new qr;Bh.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=jb,this.W=new Array(64)}wn.inherits(qr,Bh);var Lh=qr;qr.blockSize=512,qr.outSize=256,qr.hmacStrength=192,qr.padLength=64,qr.prototype._update=function(e,t){for(var i=this.W,n=0;n<16;n++)i[n]=e[t+n];for(;n<i.length;n++)i[n]=Lb(kb(i[n-2]),i[n-7],Kb(i[n-15]),i[n-16]);var s=this.h[0],o=this.h[1],f=this.h[2],u=this.h[3],h=this.h[4],p=this.h[5],y=this.h[6],M=this.h[7];for(Bb(this.k.length===i.length),n=0;n<i.length;n++){var D=Ub(M,zb(h),Fb(h,p,y),this.k[n],i[n]),I=Mr($b(s),qb(s,o,f));M=y,y=p,p=h,h=Mr(u,D),u=f,f=o,o=s,s=Mr(D,I)}this.h[0]=Mr(this.h[0],s),this.h[1]=Mr(this.h[1],o),this.h[2]=Mr(this.h[2],f),this.h[3]=Mr(this.h[3],u),this.h[4]=Mr(this.h[4],h),this.h[5]=Mr(this.h[5],p),this.h[6]=Mr(this.h[6],y),this.h[7]=Mr(this.h[7],M)},qr.prototype._digest=function(e){return e==="hex"?wn.toHex32(this.h,"big"):wn.split32(this.h,"big")};var Eo=Ze,Uh=Lh;function ti(){if(!(this instanceof ti))return new ti;Uh.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Eo.inherits(ti,Uh);var Vb=ti;ti.blockSize=512,ti.outSize=224,ti.hmacStrength=192,ti.padLength=64,ti.prototype._digest=function(e){return e==="hex"?Eo.toHex32(this.h.slice(0,7),"big"):Eo.split32(this.h.slice(0,7),"big")};var Zt=Ze,Hb=bn,Gb=qi,$r=Zt.rotr64_hi,zr=Zt.rotr64_lo,Fh=Zt.shr64_hi,qh=Zt.shr64_lo,_i=Zt.sum64,xo=Zt.sum64_hi,Ao=Zt.sum64_lo,Yb=Zt.sum64_4_hi,Wb=Zt.sum64_4_lo,Jb=Zt.sum64_5_hi,Qb=Zt.sum64_5_lo,$h=Hb.BlockHash,Xb=[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];function Ir(){if(!(this instanceof Ir))return new Ir;$h.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=Xb,this.W=new Array(160)}Zt.inherits(Ir,$h);var zh=Ir;Ir.blockSize=1024,Ir.outSize=512,Ir.hmacStrength=192,Ir.padLength=128,Ir.prototype._prepareBlock=function(e,t){for(var i=this.W,n=0;n<32;n++)i[n]=e[t+n];for(;n<i.length;n+=2){var s=c3(i[n-4],i[n-3]),o=h3(i[n-4],i[n-3]),f=i[n-14],u=i[n-13],h=o3(i[n-30],i[n-29]),p=f3(i[n-30],i[n-29]),y=i[n-32],M=i[n-31];i[n]=Yb(s,o,f,u,h,p,y,M),i[n+1]=Wb(s,o,f,u,h,p,y,M)}},Ir.prototype._update=function(e,t){this._prepareBlock(e,t);var i=this.W,n=this.h[0],s=this.h[1],o=this.h[2],f=this.h[3],u=this.h[4],h=this.h[5],p=this.h[6],y=this.h[7],M=this.h[8],D=this.h[9],I=this.h[10],C=this.h[11],K=this.h[12],j=this.h[13],B=this.h[14],k=this.h[15];Gb(this.k.length===i.length);for(var T=0;T<i.length;T+=2){var q=B,$=k,_=s3(M,D),O=a3(M,D),W=Zb(M,D,I,C,K),X=e3(M,D,I,C,K,j),N=this.k[T],g=this.k[T+1],l=i[T],a=i[T+1],c=Jb(q,$,_,O,W,X,N,g,l,a),v=Qb(q,$,_,O,W,X,N,g,l,a);q=i3(n,s),$=n3(n,s),_=t3(n,s,o,f,u),O=r3(n,s,o,f,u,h);var x=xo(q,$,_,O),A=Ao(q,$,_,O);B=K,k=j,K=I,j=C,I=M,C=D,M=xo(p,y,c,v),D=Ao(y,y,c,v),p=u,y=h,u=o,h=f,o=n,f=s,n=xo(c,v,x,A),s=Ao(c,v,x,A)}_i(this.h,0,n,s),_i(this.h,2,o,f),_i(this.h,4,u,h),_i(this.h,6,p,y),_i(this.h,8,M,D),_i(this.h,10,I,C),_i(this.h,12,K,j),_i(this.h,14,B,k)},Ir.prototype._digest=function(e){return e==="hex"?Zt.toHex32(this.h,"big"):Zt.split32(this.h,"big")};function Zb(r,e,t,i,n){var s=r&t^~r&n;return s<0&&(s+=4294967296),s}function e3(r,e,t,i,n,s){var o=e&i^~e&s;return o<0&&(o+=4294967296),o}function t3(r,e,t,i,n){var s=r&t^r&n^t&n;return s<0&&(s+=4294967296),s}function r3(r,e,t,i,n,s){var o=e&i^e&s^i&s;return o<0&&(o+=4294967296),o}function i3(r,e){var t=$r(r,e,28),i=$r(e,r,2),n=$r(e,r,7),s=t^i^n;return s<0&&(s+=4294967296),s}function n3(r,e){var t=zr(r,e,28),i=zr(e,r,2),n=zr(e,r,7),s=t^i^n;return s<0&&(s+=4294967296),s}function s3(r,e){var t=$r(r,e,14),i=$r(r,e,18),n=$r(e,r,9),s=t^i^n;return s<0&&(s+=4294967296),s}function a3(r,e){var t=zr(r,e,14),i=zr(r,e,18),n=zr(e,r,9),s=t^i^n;return s<0&&(s+=4294967296),s}function o3(r,e){var t=$r(r,e,1),i=$r(r,e,8),n=Fh(r,e,7),s=t^i^n;return s<0&&(s+=4294967296),s}function f3(r,e){var t=zr(r,e,1),i=zr(r,e,8),n=qh(r,e,7),s=t^i^n;return s<0&&(s+=4294967296),s}function c3(r,e){var t=$r(r,e,19),i=$r(e,r,29),n=Fh(r,e,6),s=t^i^n;return s<0&&(s+=4294967296),s}function h3(r,e){var t=zr(r,e,19),i=zr(e,r,29),n=qh(r,e,6),s=t^i^n;return s<0&&(s+=4294967296),s}var So=Ze,Kh=zh;function ri(){if(!(this instanceof ri))return new ri;Kh.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}So.inherits(ri,Kh);var u3=ri;ri.blockSize=1024,ri.outSize=384,ri.hmacStrength=192,ri.padLength=128,ri.prototype._digest=function(e){return e==="hex"?So.toHex32(this.h.slice(0,12),"big"):So.split32(this.h.slice(0,12),"big")},mn.sha1=Pb,mn.sha224=Vb,mn.sha256=Lh,mn.sha384=u3,mn.sha512=zh;var kh={},$i=Ze,d3=bn,Xs=$i.rotl32,jh=$i.sum32,Jn=$i.sum32_3,Vh=$i.sum32_4,Hh=d3.BlockHash;function Kr(){if(!(this instanceof Kr))return new Kr;Hh.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}$i.inherits(Kr,Hh),kh.ripemd160=Kr,Kr.blockSize=512,Kr.outSize=160,Kr.hmacStrength=192,Kr.padLength=64,Kr.prototype._update=function(e,t){for(var i=this.h[0],n=this.h[1],s=this.h[2],o=this.h[3],f=this.h[4],u=i,h=n,p=s,y=o,M=f,D=0;D<80;D++){var I=jh(Xs(Vh(i,Gh(D,n,s,o),e[g3[D]+t],l3(D)),b3[D]),f);i=f,f=o,o=Xs(s,10),s=n,n=I,I=jh(Xs(Vh(u,Gh(79-D,h,p,y),e[v3[D]+t],p3(D)),m3[D]),M),u=M,M=y,y=Xs(p,10),p=h,h=I}I=Jn(this.h[1],s,y),this.h[1]=Jn(this.h[2],o,M),this.h[2]=Jn(this.h[3],f,u),this.h[3]=Jn(this.h[4],i,h),this.h[4]=Jn(this.h[0],n,p),this.h[0]=I},Kr.prototype._digest=function(e){return e==="hex"?$i.toHex32(this.h,"little"):$i.split32(this.h,"little")};function Gh(r,e,t,i){return r<=15?e^t^i:r<=31?e&t|~e&i:r<=47?(e|~t)^i:r<=63?e&i|t&~i:e^(t|~i)}function l3(r){return r<=15?0:r<=31?1518500249:r<=47?1859775393:r<=63?2400959708:2840853838}function p3(r){return r<=15?1352829926:r<=31?1548603684:r<=47?1836072691:r<=63?2053994217:0}var g3=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],v3=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],b3=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],m3=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],y3=Ze,w3=qi;function En(r,e,t){if(!(this instanceof En))return new En(r,e,t);this.Hash=r,this.blockSize=r.blockSize/8,this.outSize=r.outSize/8,this.inner=null,this.outer=null,this._init(y3.toArray(e,t))}var _3=En;En.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),w3(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new this.Hash().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},En.prototype.update=function(e,t){return this.inner.update(e,t),this},En.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(r){var e=r;e.utils=Ze,e.common=bn,e.sha=mn,e.ripemd=kh,e.hmac=_3,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(fr);function xn(r,e,t){return t={path:e,exports:{},require:function(i,n){return E3(i,n??t.path)}},r(t,t.exports),t.exports}function E3(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var Do=Yh;function Yh(r,e){if(!r)throw new Error(e||"Assertion failed")}Yh.equal=function(e,t,i){if(e!=t)throw new Error(i||"Assertion failed: "+e+" != "+t)};var Rr=xn(function(r,e){var t=e;function i(o,f){if(Array.isArray(o))return o.slice();if(!o)return[];var u=[];if(typeof o!="string"){for(var h=0;h<o.length;h++)u[h]=o[h]|0;return u}if(f==="hex"){o=o.replace(/[^a-z0-9]+/ig,""),o.length%2!==0&&(o="0"+o);for(var h=0;h<o.length;h+=2)u.push(parseInt(o[h]+o[h+1],16))}else for(var h=0;h<o.length;h++){var p=o.charCodeAt(h),y=p>>8,M=p&255;y?u.push(y,M):u.push(M)}return u}t.toArray=i;function n(o){return o.length===1?"0"+o:o}t.zero2=n;function s(o){for(var f="",u=0;u<o.length;u++)f+=n(o[u].toString(16));return f}t.toHex=s,t.encode=function(f,u){return u==="hex"?s(f):f}}),cr=xn(function(r,e){var t=e;t.assert=Do,t.toArray=Rr.toArray,t.zero2=Rr.zero2,t.toHex=Rr.toHex,t.encode=Rr.encode;function i(u,h,p){var y=new Array(Math.max(u.bitLength(),p)+1);y.fill(0);for(var M=1<<h+1,D=u.clone(),I=0;I<y.length;I++){var C,K=D.andln(M-1);D.isOdd()?(K>(M>>1)-1?C=(M>>1)-K:C=K,D.isubn(C)):C=0,y[I]=C,D.iushrn(1)}return y}t.getNAF=i;function n(u,h){var p=[[],[]];u=u.clone(),h=h.clone();for(var y=0,M=0,D;u.cmpn(-y)>0||h.cmpn(-M)>0;){var I=u.andln(3)+y&3,C=h.andln(3)+M&3;I===3&&(I=-1),C===3&&(C=-1);var K;I&1?(D=u.andln(7)+y&7,(D===3||D===5)&&C===2?K=-I:K=I):K=0,p[0].push(K);var j;C&1?(D=h.andln(7)+M&7,(D===3||D===5)&&I===2?j=-C:j=C):j=0,p[1].push(j),2*y===K+1&&(y=1-y),2*M===j+1&&(M=1-M),u.iushrn(1),h.iushrn(1)}return p}t.getJSF=n;function s(u,h,p){var y="_"+h;u.prototype[h]=function(){return this[y]!==void 0?this[y]:this[y]=p.call(this)}}t.cachedProperty=s;function o(u){return typeof u=="string"?t.toArray(u,"hex"):u}t.parseBytes=o;function f(u){return new je(u,"hex","le")}t.intFromLE=f}),Zs=cr.getNAF,x3=cr.getJSF,ea=cr.assert;function Ei(r,e){this.type=r,this.p=new je(e.p,16),this.red=e.prime?je.red(e.prime):je.mont(this.p),this.zero=new je(0).toRed(this.red),this.one=new je(1).toRed(this.red),this.two=new je(2).toRed(this.red),this.n=e.n&&new je(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var zi=Ei;Ei.prototype.point=function(){throw new Error("Not implemented")},Ei.prototype.validate=function(){throw new Error("Not implemented")},Ei.prototype._fixedNafMul=function(e,t){ea(e.precomputed);var i=e._getDoubles(),n=Zs(t,1,this._bitLength),s=(1<<i.step+1)-(i.step%2===0?2:1);s/=3;var o=[],f,u;for(f=0;f<n.length;f+=i.step){u=0;for(var h=f+i.step-1;h>=f;h--)u=(u<<1)+n[h];o.push(u)}for(var p=this.jpoint(null,null,null),y=this.jpoint(null,null,null),M=s;M>0;M--){for(f=0;f<o.length;f++)u=o[f],u===M?y=y.mixedAdd(i.points[f]):u===-M&&(y=y.mixedAdd(i.points[f].neg()));p=p.add(y)}return p.toP()},Ei.prototype._wnafMul=function(e,t){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var s=n.points,o=Zs(t,i,this._bitLength),f=this.jpoint(null,null,null),u=o.length-1;u>=0;u--){for(var h=0;u>=0&&o[u]===0;u--)h++;if(u>=0&&h++,f=f.dblp(h),u<0)break;var p=o[u];ea(p!==0),e.type==="affine"?p>0?f=f.mixedAdd(s[p-1>>1]):f=f.mixedAdd(s[-p-1>>1].neg()):p>0?f=f.add(s[p-1>>1]):f=f.add(s[-p-1>>1].neg())}return e.type==="affine"?f.toP():f},Ei.prototype._wnafMulAdd=function(e,t,i,n,s){var o=this._wnafT1,f=this._wnafT2,u=this._wnafT3,h=0,p,y,M;for(p=0;p<n;p++){M=t[p];var D=M._getNAFPoints(e);o[p]=D.wnd,f[p]=D.points}for(p=n-1;p>=1;p-=2){var I=p-1,C=p;if(o[I]!==1||o[C]!==1){u[I]=Zs(i[I],o[I],this._bitLength),u[C]=Zs(i[C],o[C],this._bitLength),h=Math.max(u[I].length,h),h=Math.max(u[C].length,h);continue}var K=[t[I],null,null,t[C]];t[I].y.cmp(t[C].y)===0?(K[1]=t[I].add(t[C]),K[2]=t[I].toJ().mixedAdd(t[C].neg())):t[I].y.cmp(t[C].y.redNeg())===0?(K[1]=t[I].toJ().mixedAdd(t[C]),K[2]=t[I].add(t[C].neg())):(K[1]=t[I].toJ().mixedAdd(t[C]),K[2]=t[I].toJ().mixedAdd(t[C].neg()));var j=[-3,-1,-5,-7,0,7,5,1,3],B=x3(i[I],i[C]);for(h=Math.max(B[0].length,h),u[I]=new Array(h),u[C]=new Array(h),y=0;y<h;y++){var k=B[0][y]|0,T=B[1][y]|0;u[I][y]=j[(k+1)*3+(T+1)],u[C][y]=0,f[I]=K}}var q=this.jpoint(null,null,null),$=this._wnafT4;for(p=h;p>=0;p--){for(var _=0;p>=0;){var O=!0;for(y=0;y<n;y++)$[y]=u[y][p]|0,$[y]!==0&&(O=!1);if(!O)break;_++,p--}if(p>=0&&_++,q=q.dblp(_),p<0)break;for(y=0;y<n;y++){var W=$[y];W!==0&&(W>0?M=f[y][W-1>>1]:W<0&&(M=f[y][-W-1>>1].neg()),M.type==="affine"?q=q.mixedAdd(M):q=q.add(M))}}for(p=0;p<n;p++)f[p]=null;return s?q:q.toP()};function pr(r,e){this.curve=r,this.type=e,this.precomputed=null}Ei.BasePoint=pr,pr.prototype.eq=function(){throw new Error("Not implemented")},pr.prototype.validate=function(){return this.curve.validate(this)},Ei.prototype.decodePoint=function(e,t){e=cr.toArray(e,t);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?ea(e[e.length-1]%2===0):e[0]===7&&ea(e[e.length-1]%2===1);var n=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return n}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")},pr.prototype.encodeCompressed=function(e){return this.encode(e,!0)},pr.prototype._encode=function(e){var t=this.curve.p.byteLength(),i=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",t))},pr.prototype.encode=function(e,t){return cr.encode(this._encode(t),e)},pr.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},pr.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},pr.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,s=0;s<t;s+=e){for(var o=0;o<e;o++)n=n.dbl();i.push(n)}return{step:e,points:i}},pr.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),s=1;s<i;s++)t[s]=t[s-1].add(n);return{wnd:e,points:t}},pr.prototype._getBeta=function(){return null},pr.prototype.dblp=function(e){for(var t=this,i=0;i<e;i++)t=t.dbl();return t};var Mo=xn(function(r){typeof Object.create=="function"?r.exports=function(t,i){i&&(t.super_=i,t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:r.exports=function(t,i){if(i){t.super_=i;var n=function(){};n.prototype=i.prototype,t.prototype=new n,t.prototype.constructor=t}}}),A3=cr.assert;function gr(r){zi.call(this,"short",r),this.a=new je(r.a,16).toRed(this.red),this.b=new je(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Mo(gr,zi);var S3=gr;gr.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,i;if(e.beta)t=new je(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=n[0].cmp(n[1])<0?n[0]:n[1],t=t.toRed(this.red)}if(e.lambda)i=new je(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))===0?i=s[0]:(i=s[1],A3(this.g.mul(i).x.cmp(this.g.x.redMul(t))===0))}var o;return e.basis?o=e.basis.map(function(f){return{a:new je(f.a,16),b:new je(f.b,16)}}):o=this._getEndoBasis(i),{beta:t,lambda:i,basis:o}}},gr.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:je.mont(e),i=new je(2).toRed(t).redInvm(),n=i.redNeg(),s=new je(3).toRed(t).redNeg().redSqrt().redMul(i),o=n.redAdd(s).fromRed(),f=n.redSub(s).fromRed();return[o,f]},gr.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),s=new je(1),o=new je(0),f=new je(0),u=new je(1),h,p,y,M,D,I,C,K=0,j,B;i.cmpn(0)!==0;){var k=n.div(i);j=n.sub(k.mul(i)),B=f.sub(k.mul(s));var T=u.sub(k.mul(o));if(!y&&j.cmp(t)<0)h=C.neg(),p=s,y=j.neg(),M=B;else if(y&&++K===2)break;C=j,n=i,i=j,f=s,s=B,u=o,o=T}D=j.neg(),I=B;var q=y.sqr().add(M.sqr()),$=D.sqr().add(I.sqr());return $.cmp(q)>=0&&(D=h,I=p),y.negative&&(y=y.neg(),M=M.neg()),D.negative&&(D=D.neg(),I=I.neg()),[{a:y,b:M},{a:D,b:I}]},gr.prototype._endoSplit=function(e){var t=this.endo.basis,i=t[0],n=t[1],s=n.b.mul(e).divRound(this.n),o=i.b.neg().mul(e).divRound(this.n),f=s.mul(i.a),u=o.mul(n.a),h=s.mul(i.b),p=o.mul(n.b),y=e.sub(f).sub(u),M=h.add(p).neg();return{k1:y,k2:M}},gr.prototype.pointFromX=function(e,t){e=new je(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var s=n.fromRed().isOdd();return(t&&!s||!t&&s)&&(n=n.redNeg()),this.point(e,n)},gr.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,i=e.y,n=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(s).cmpn(0)===0},gr.prototype._endoWnafMulAdd=function(e,t,i){for(var n=this._endoWnafT1,s=this._endoWnafT2,o=0;o<e.length;o++){var f=this._endoSplit(t[o]),u=e[o],h=u._getBeta();f.k1.negative&&(f.k1.ineg(),u=u.neg(!0)),f.k2.negative&&(f.k2.ineg(),h=h.neg(!0)),n[o*2]=u,n[o*2+1]=h,s[o*2]=f.k1,s[o*2+1]=f.k2}for(var p=this._wnafMulAdd(1,n,s,o*2,i),y=0;y<o*2;y++)n[y]=null,s[y]=null;return p};function At(r,e,t,i){zi.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new je(e,16),this.y=new je(t,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}Mo(At,zi.BasePoint),gr.prototype.point=function(e,t,i){return new At(this,e,t,i)},gr.prototype.pointFromJSON=function(e,t){return At.fromJSON(this,e,t)},At.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,n=function(s){return i.point(s.x.redMul(i.endo.beta),s.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},At.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},At.fromJSON=function(e,t,i){typeof t=="string"&&(t=JSON.parse(t));var n=e.point(t[0],t[1],i);if(!t[2])return n;function s(f){return e.point(f[0],f[1],i)}var o=t[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(s))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(s))}},n},At.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},At.prototype.isInfinity=function(){return this.inf},At.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var i=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)},At.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),s=i.redAdd(i).redIAdd(i).redIAdd(t).redMul(n),o=s.redSqr().redISub(this.x.redAdd(this.x)),f=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,f)},At.prototype.getX=function(){return this.x.fromRed()},At.prototype.getY=function(){return this.y.fromRed()},At.prototype.mul=function(e){return e=new je(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},At.prototype.mulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)},At.prototype.jmulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)},At.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},At.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(s){return s.neg()};t.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return t},At.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Pt(r,e,t,i){zi.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new je(0)):(this.x=new je(e,16),this.y=new je(t,16),this.z=new je(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Mo(Pt,zi.BasePoint),gr.prototype.jpoint=function(e,t,i){return new Pt(this,e,t,i)},Pt.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),i=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(i,n)},Pt.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Pt.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(t),s=e.x.redMul(i),o=this.y.redMul(t.redMul(e.z)),f=e.y.redMul(i.redMul(this.z)),u=n.redSub(s),h=o.redSub(f);if(u.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var p=u.redSqr(),y=p.redMul(u),M=n.redMul(p),D=h.redSqr().redIAdd(y).redISub(M).redISub(M),I=h.redMul(M.redISub(D)).redISub(o.redMul(y)),C=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(D,I,C)},Pt.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),i=this.x,n=e.x.redMul(t),s=this.y,o=e.y.redMul(t).redMul(this.z),f=i.redSub(n),u=s.redSub(o);if(f.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var h=f.redSqr(),p=h.redMul(f),y=i.redMul(h),M=u.redSqr().redIAdd(p).redISub(y).redISub(y),D=u.redMul(y.redISub(M)).redISub(s.redMul(p)),I=this.z.redMul(f);return this.curve.jpoint(M,D,I)},Pt.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var i=this;for(t=0;t<e;t++)i=i.dbl();return i}var n=this.curve.a,s=this.curve.tinv,o=this.x,f=this.y,u=this.z,h=u.redSqr().redSqr(),p=f.redAdd(f);for(t=0;t<e;t++){var y=o.redSqr(),M=p.redSqr(),D=M.redSqr(),I=y.redAdd(y).redIAdd(y).redIAdd(n.redMul(h)),C=o.redMul(M),K=I.redSqr().redISub(C.redAdd(C)),j=C.redISub(K),B=I.redMul(j);B=B.redIAdd(B).redISub(D);var k=p.redMul(u);t+1<e&&(h=h.redMul(D)),o=K,u=k,p=B}return this.curve.jpoint(o,p.redMul(s),u)},Pt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Pt.prototype._zeroDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),o=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(o);f=f.redIAdd(f);var u=n.redAdd(n).redIAdd(n),h=u.redSqr().redISub(f).redISub(f),p=o.redIAdd(o);p=p.redIAdd(p),p=p.redIAdd(p),e=h,t=u.redMul(f.redISub(h)).redISub(p),i=this.y.redAdd(this.y)}else{var y=this.x.redSqr(),M=this.y.redSqr(),D=M.redSqr(),I=this.x.redAdd(M).redSqr().redISub(y).redISub(D);I=I.redIAdd(I);var C=y.redAdd(y).redIAdd(y),K=C.redSqr(),j=D.redIAdd(D);j=j.redIAdd(j),j=j.redIAdd(j),e=K.redISub(I).redISub(I),t=C.redMul(I.redISub(e)).redISub(j),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,t,i)},Pt.prototype._threeDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),o=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(o);f=f.redIAdd(f);var u=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),h=u.redSqr().redISub(f).redISub(f);e=h;var p=o.redIAdd(o);p=p.redIAdd(p),p=p.redIAdd(p),t=u.redMul(f.redISub(h)).redISub(p),i=this.y.redAdd(this.y)}else{var y=this.z.redSqr(),M=this.y.redSqr(),D=this.x.redMul(M),I=this.x.redSub(y).redMul(this.x.redAdd(y));I=I.redAdd(I).redIAdd(I);var C=D.redIAdd(D);C=C.redIAdd(C);var K=C.redAdd(C);e=I.redSqr().redISub(K),i=this.y.redAdd(this.z).redSqr().redISub(M).redISub(y);var j=M.redSqr();j=j.redIAdd(j),j=j.redIAdd(j),j=j.redIAdd(j),t=I.redMul(C.redISub(e)).redISub(j)}return this.curve.jpoint(e,t,i)},Pt.prototype._dbl=function(){var e=this.curve.a,t=this.x,i=this.y,n=this.z,s=n.redSqr().redSqr(),o=t.redSqr(),f=i.redSqr(),u=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(s)),h=t.redAdd(t);h=h.redIAdd(h);var p=h.redMul(f),y=u.redSqr().redISub(p.redAdd(p)),M=p.redISub(y),D=f.redSqr();D=D.redIAdd(D),D=D.redIAdd(D),D=D.redIAdd(D);var I=u.redMul(M).redISub(D),C=i.redAdd(i).redMul(n);return this.curve.jpoint(y,I,C)},Pt.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr(),n=t.redSqr(),s=e.redAdd(e).redIAdd(e),o=s.redSqr(),f=this.x.redAdd(t).redSqr().redISub(e).redISub(n);f=f.redIAdd(f),f=f.redAdd(f).redIAdd(f),f=f.redISub(o);var u=f.redSqr(),h=n.redIAdd(n);h=h.redIAdd(h),h=h.redIAdd(h),h=h.redIAdd(h);var p=s.redIAdd(f).redSqr().redISub(o).redISub(u).redISub(h),y=t.redMul(p);y=y.redIAdd(y),y=y.redIAdd(y);var M=this.x.redMul(u).redISub(y);M=M.redIAdd(M),M=M.redIAdd(M);var D=this.y.redMul(p.redMul(h.redISub(p)).redISub(f.redMul(u)));D=D.redIAdd(D),D=D.redIAdd(D),D=D.redIAdd(D);var I=this.z.redAdd(f).redSqr().redISub(i).redISub(u);return this.curve.jpoint(M,D,I)},Pt.prototype.mul=function(e,t){return e=new je(e,t),this.curve._wnafMul(this,e)},Pt.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var n=t.redMul(this.z),s=i.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0},Pt.prototype.eqXToP=function(e){var t=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(s),this.x.cmp(i)===0)return!0}},Pt.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},Pt.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var ta=xn(function(r,e){var t=e;t.base=zi,t.short=S3,t.mont=null,t.edwards=null}),ra=xn(function(r,e){var t=e,i=cr.assert;function n(f){f.type==="short"?this.curve=new ta.short(f):f.type==="edwards"?this.curve=new ta.edwards(f):this.curve=new ta.mont(f),this.g=this.curve.g,this.n=this.curve.n,this.hash=f.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}t.PresetCurve=n;function s(f,u){Object.defineProperty(t,f,{configurable:!0,enumerable:!0,get:function(){var h=new n(u);return Object.defineProperty(t,f,{configurable:!0,enumerable:!0,value:h}),h}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:fr.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:fr.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:fr.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:fr.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:fr.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:fr.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:fr.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:fr.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function xi(r){if(!(this instanceof xi))return new xi(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Rr.toArray(r.entropy,r.entropyEnc||"hex"),t=Rr.toArray(r.nonce,r.nonceEnc||"hex"),i=Rr.toArray(r.pers,r.persEnc||"hex");Do(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,i)}var Wh=xi;xi.prototype._init=function(e,t,i){var n=e.concat(t).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},xi.prototype._hmac=function(){return new fr.hmac(this.hash,this.K)},xi.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},xi.prototype.reseed=function(e,t,i,n){typeof t!="string"&&(n=i,i=t,t=null),e=Rr.toArray(e,t),i=Rr.toArray(i,n),Do(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1},xi.prototype.generate=function(e,t,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(n=i,i=t,t=null),i&&(i=Rr.toArray(i,n||"hex"),this._update(i));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var o=s.slice(0,e);return this._update(i),this._reseed++,Rr.encode(o,t)};var Io=cr.assert;function qt(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var Ro=qt;qt.fromPublic=function(e,t,i){return t instanceof qt?t:new qt(e,{pub:t,pubEnc:i})},qt.fromPrivate=function(e,t,i){return t instanceof qt?t:new qt(e,{priv:t,privEnc:i})},qt.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},qt.prototype.getPublic=function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},qt.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},qt.prototype._importPrivate=function(e,t){this.priv=new je(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},qt.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?Io(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Io(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},qt.prototype.derive=function(e){return e.validate()||Io(e.validate(),"public point not validated"),e.mul(this.priv).getX()},qt.prototype.sign=function(e,t,i){return this.ec.sign(e,this,t,i)},qt.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},qt.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var D3=cr.assert;function ia(r,e){if(r instanceof ia)return r;this._importDER(r,e)||(D3(r.r&&r.s,"Signature without r or s"),this.r=new je(r.r,16),this.s=new je(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var na=ia;function M3(){this.place=0}function Oo(r,e){var t=r[e.place++];if(!(t&128))return t;var i=t&15;if(i===0||i>4)return!1;for(var n=0,s=0,o=e.place;s<i;s++,o++)n<<=8,n|=r[o],n>>>=0;return n<=127?!1:(e.place=o,n)}function Jh(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}ia.prototype._importDER=function(e,t){e=cr.toArray(e,t);var i=new M3;if(e[i.place++]!==48)return!1;var n=Oo(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var s=Oo(e,i);if(s===!1)return!1;var o=e.slice(i.place,s+i.place);if(i.place+=s,e[i.place++]!==2)return!1;var f=Oo(e,i);if(f===!1||e.length!==f+i.place)return!1;var u=e.slice(i.place,f+i.place);if(o[0]===0)if(o[1]&128)o=o.slice(1);else return!1;if(u[0]===0)if(u[1]&128)u=u.slice(1);else return!1;return this.r=new je(o),this.s=new je(u),this.recoveryParam=null,!0};function No(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}ia.prototype.toDER=function(e){var t=this.r.toArray(),i=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),i[0]&128&&(i=[0].concat(i)),t=Jh(t),i=Jh(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];No(n,t.length),n=n.concat(t),n.push(2),No(n,i.length);var s=n.concat(i),o=[48];return No(o,s.length),o=o.concat(s),cr.encode(o,e)};var I3=function(){throw new Error("unsupported")},Qh=cr.assert;function vr(r){if(!(this instanceof vr))return new vr(r);typeof r=="string"&&(Qh(Object.prototype.hasOwnProperty.call(ra,r),"Unknown curve "+r),r=ra[r]),r instanceof ra.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}var R3=vr;vr.prototype.keyPair=function(e){return new Ro(this,e)},vr.prototype.keyFromPrivate=function(e,t){return Ro.fromPrivate(this,e,t)},vr.prototype.keyFromPublic=function(e,t){return Ro.fromPublic(this,e,t)},vr.prototype.genKeyPair=function(e){e||(e={});for(var t=new Wh({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||I3(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new je(2));;){var s=new je(t.generate(i));if(!(s.cmp(n)>0))return s.iaddn(1),this.keyFromPrivate(s)}},vr.prototype._truncateToN=function(e,t){var i=e.byteLength()*8-this.n.bitLength();return i>0&&(e=e.ushrn(i)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},vr.prototype.sign=function(e,t,i,n){typeof i=="object"&&(n=i,i=null),n||(n={}),t=this.keyFromPrivate(t,i),e=this._truncateToN(new je(e,16));for(var s=this.n.byteLength(),o=t.getPrivate().toArray("be",s),f=e.toArray("be",s),u=new Wh({hash:this.hash,entropy:o,nonce:f,pers:n.pers,persEnc:n.persEnc||"utf8"}),h=this.n.sub(new je(1)),p=0;;p++){var y=n.k?n.k(p):new je(u.generate(this.n.byteLength()));if(y=this._truncateToN(y,!0),!(y.cmpn(1)<=0||y.cmp(h)>=0)){var M=this.g.mul(y);if(!M.isInfinity()){var D=M.getX(),I=D.umod(this.n);if(I.cmpn(0)!==0){var C=y.invm(this.n).mul(I.mul(t.getPrivate()).iadd(e));if(C=C.umod(this.n),C.cmpn(0)!==0){var K=(M.getY().isOdd()?1:0)|(D.cmp(I)!==0?2:0);return n.canonical&&C.cmp(this.nh)>0&&(C=this.n.sub(C),K^=1),new na({r:I,s:C,recoveryParam:K})}}}}}},vr.prototype.verify=function(e,t,i,n){e=this._truncateToN(new je(e,16)),i=this.keyFromPublic(i,n),t=new na(t,"hex");var s=t.r,o=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var f=o.invm(this.n),u=f.mul(e).umod(this.n),h=f.mul(s).umod(this.n),p;return this.curve._maxwellTrick?(p=this.g.jmulAdd(u,i.getPublic(),h),p.isInfinity()?!1:p.eqXToP(s)):(p=this.g.mulAdd(u,i.getPublic(),h),p.isInfinity()?!1:p.getX().umod(this.n).cmp(s)===0)},vr.prototype.recoverPubKey=function(r,e,t,i){Qh((3&t)===t,"The recovery param is more than two bits"),e=new na(e,i);var n=this.n,s=new je(r),o=e.r,f=e.s,u=t&1,h=t>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");h?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var p=e.r.invm(n),y=n.sub(s).mul(p).umod(n),M=f.mul(p).umod(n);return this.g.mulAdd(y,o,M)},vr.prototype.getKeyRecoveryParam=function(r,e,t,i){if(e=new na(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(r,e,n)}catch{continue}if(s.eq(t))return n}throw new Error("Unable to find valid recovery factor")};var O3=xn(function(r,e){var t=e;t.version="6.5.4",t.utils=cr,t.rand=function(){throw new Error("unsupported")},t.curve=ta,t.curves=ra,t.ec=R3,t.eddsa=null}),N3=O3.ec;const C3="signing-key/5.7.0",Co=new He(C3);let Po=null;function kr(){return Po||(Po=new N3("secp256k1")),Po}class P3{constructor(e){Yn(this,"curve","secp256k1"),Yn(this,"privateKey",Vt(e)),mv(this.privateKey)!==32&&Co.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=kr().keyFromPrivate(lt(this.privateKey));Yn(this,"publicKey","0x"+t.getPublic(!1,"hex")),Yn(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Yn(this,"_isSigningKey",!0)}_addPoint(e){const t=kr().keyFromPublic(lt(this.publicKey)),i=kr().keyFromPublic(lt(e));return"0x"+t.pub.add(i.pub).encodeCompressed("hex")}signDigest(e){const t=kr().keyFromPrivate(lt(this.privateKey)),i=lt(e);i.length!==32&&Co.throwArgumentError("bad digest length","digest",e);const n=t.sign(i,{canonical:!0});return oh({recoveryParam:n.recoveryParam,r:Br("0x"+n.r.toString(16),32),s:Br("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=kr().keyFromPrivate(lt(this.privateKey)),i=kr().keyFromPublic(lt(Xh(e)));return Br("0x"+t.derive(i.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function T3(r,e){const t=oh(e),i={r:lt(t.r),s:lt(t.s)};return"0x"+kr().recoverPubKey(lt(r),i,t.recoveryParam).encode("hex",!1)}function Xh(r,e){const t=lt(r);if(t.length===32){const i=new P3(t);return e?"0x"+kr().keyFromPrivate(t).getPublic(!0,"hex"):i.publicKey}else{if(t.length===33)return e?Vt(t):"0x"+kr().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+kr().keyFromPublic(t).getPublic(!0,"hex"):Vt(t)}return Co.throwArgumentError("invalid public or private key","key","[REDACTED]")}const B3="transactions/5.7.0";new He(B3);var Zh;(function(r){r[r.legacy=0]="legacy",r[r.eip2930=1]="eip2930",r[r.eip1559=2]="eip1559"})(Zh||(Zh={}));function L3(r){const e=Xh(r);return Hv(ah(po(ah(e,1)),12))}function U3(r,e){return L3(T3(lt(r),e))}var To={},sa={};Object.defineProperty(sa,"__esModule",{value:!0});var $t=Ve,Bo=ar,F3=20;function q3(r,e,t){for(var i=1634760805,n=857760878,s=2036477234,o=1797285236,f=t[3]<<24|t[2]<<16|t[1]<<8|t[0],u=t[7]<<24|t[6]<<16|t[5]<<8|t[4],h=t[11]<<24|t[10]<<16|t[9]<<8|t[8],p=t[15]<<24|t[14]<<16|t[13]<<8|t[12],y=t[19]<<24|t[18]<<16|t[17]<<8|t[16],M=t[23]<<24|t[22]<<16|t[21]<<8|t[20],D=t[27]<<24|t[26]<<16|t[25]<<8|t[24],I=t[31]<<24|t[30]<<16|t[29]<<8|t[28],C=e[3]<<24|e[2]<<16|e[1]<<8|e[0],K=e[7]<<24|e[6]<<16|e[5]<<8|e[4],j=e[11]<<24|e[10]<<16|e[9]<<8|e[8],B=e[15]<<24|e[14]<<16|e[13]<<8|e[12],k=i,T=n,q=s,$=o,_=f,O=u,W=h,X=p,N=y,g=M,l=D,a=I,c=C,v=K,x=j,A=B,E=0;E<F3;E+=2)k=k+_|0,c^=k,c=c>>>32-16|c<<16,N=N+c|0,_^=N,_=_>>>32-12|_<<12,T=T+O|0,v^=T,v=v>>>32-16|v<<16,g=g+v|0,O^=g,O=O>>>32-12|O<<12,q=q+W|0,x^=q,x=x>>>32-16|x<<16,l=l+x|0,W^=l,W=W>>>32-12|W<<12,$=$+X|0,A^=$,A=A>>>32-16|A<<16,a=a+A|0,X^=a,X=X>>>32-12|X<<12,q=q+W|0,x^=q,x=x>>>32-8|x<<8,l=l+x|0,W^=l,W=W>>>32-7|W<<7,$=$+X|0,A^=$,A=A>>>32-8|A<<8,a=a+A|0,X^=a,X=X>>>32-7|X<<7,T=T+O|0,v^=T,v=v>>>32-8|v<<8,g=g+v|0,O^=g,O=O>>>32-7|O<<7,k=k+_|0,c^=k,c=c>>>32-8|c<<8,N=N+c|0,_^=N,_=_>>>32-7|_<<7,k=k+O|0,A^=k,A=A>>>32-16|A<<16,l=l+A|0,O^=l,O=O>>>32-12|O<<12,T=T+W|0,c^=T,c=c>>>32-16|c<<16,a=a+c|0,W^=a,W=W>>>32-12|W<<12,q=q+X|0,v^=q,v=v>>>32-16|v<<16,N=N+v|0,X^=N,X=X>>>32-12|X<<12,$=$+_|0,x^=$,x=x>>>32-16|x<<16,g=g+x|0,_^=g,_=_>>>32-12|_<<12,q=q+X|0,v^=q,v=v>>>32-8|v<<8,N=N+v|0,X^=N,X=X>>>32-7|X<<7,$=$+_|0,x^=$,x=x>>>32-8|x<<8,g=g+x|0,_^=g,_=_>>>32-7|_<<7,T=T+W|0,c^=T,c=c>>>32-8|c<<8,a=a+c|0,W^=a,W=W>>>32-7|W<<7,k=k+O|0,A^=k,A=A>>>32-8|A<<8,l=l+A|0,O^=l,O=O>>>32-7|O<<7;$t.writeUint32LE(k+i|0,r,0),$t.writeUint32LE(T+n|0,r,4),$t.writeUint32LE(q+s|0,r,8),$t.writeUint32LE($+o|0,r,12),$t.writeUint32LE(_+f|0,r,16),$t.writeUint32LE(O+u|0,r,20),$t.writeUint32LE(W+h|0,r,24),$t.writeUint32LE(X+p|0,r,28),$t.writeUint32LE(N+y|0,r,32),$t.writeUint32LE(g+M|0,r,36),$t.writeUint32LE(l+D|0,r,40),$t.writeUint32LE(a+I|0,r,44),$t.writeUint32LE(c+C|0,r,48),$t.writeUint32LE(v+K|0,r,52),$t.writeUint32LE(x+j|0,r,56),$t.writeUint32LE(A+B|0,r,60)}function eu(r,e,t,i,n){if(n===void 0&&(n=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<t.length)throw new Error("ChaCha: destination is shorter than source");var s,o;if(n===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=new Uint8Array(16),o=s.length-e.length,s.set(e,o)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,o=n}for(var f=new Uint8Array(64),u=0;u<t.length;u+=64){q3(f,s,r);for(var h=u;h<u+64&&h<t.length;h++)i[h]=t[h]^f[h-u];z3(s,0,o)}return Bo.wipe(f),n===0&&Bo.wipe(s),i}sa.streamXOR=eu;function $3(r,e,t,i){return i===void 0&&(i=0),Bo.wipe(t),eu(r,e,t,t,i)}sa.stream=$3;function z3(r,e,t){for(var i=1;t--;)i=i+(r[e]&255)|0,r[e]=i&255,i>>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}var tu={},Ai={};Object.defineProperty(Ai,"__esModule",{value:!0});function K3(r,e,t){return~(r-1)&e|r-1&t}Ai.select=K3;function k3(r,e){return(r|0)-(e|0)-1>>>31&1}Ai.lessOrEqual=k3;function ru(r,e){if(r.length!==e.length)return 0;for(var t=0,i=0;i<r.length;i++)t|=r[i]^e[i];return 1&t-1>>>8}Ai.compare=ru;function j3(r,e){return r.length===0||e.length===0?!1:ru(r,e)!==0}Ai.equal=j3,function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Ai,t=ar;r.DIGEST_LENGTH=16;var i=function(){function o(f){this.digestLength=r.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var u=f[0]|f[1]<<8;this._r[0]=u&8191;var h=f[2]|f[3]<<8;this._r[1]=(u>>>13|h<<3)&8191;var p=f[4]|f[5]<<8;this._r[2]=(h>>>10|p<<6)&7939;var y=f[6]|f[7]<<8;this._r[3]=(p>>>7|y<<9)&8191;var M=f[8]|f[9]<<8;this._r[4]=(y>>>4|M<<12)&255,this._r[5]=M>>>1&8190;var D=f[10]|f[11]<<8;this._r[6]=(M>>>14|D<<2)&8191;var I=f[12]|f[13]<<8;this._r[7]=(D>>>11|I<<5)&8065;var C=f[14]|f[15]<<8;this._r[8]=(I>>>8|C<<8)&8191,this._r[9]=C>>>5&127,this._pad[0]=f[16]|f[17]<<8,this._pad[1]=f[18]|f[19]<<8,this._pad[2]=f[20]|f[21]<<8,this._pad[3]=f[22]|f[23]<<8,this._pad[4]=f[24]|f[25]<<8,this._pad[5]=f[26]|f[27]<<8,this._pad[6]=f[28]|f[29]<<8,this._pad[7]=f[30]|f[31]<<8}return o.prototype._blocks=function(f,u,h){for(var p=this._fin?0:2048,y=this._h[0],M=this._h[1],D=this._h[2],I=this._h[3],C=this._h[4],K=this._h[5],j=this._h[6],B=this._h[7],k=this._h[8],T=this._h[9],q=this._r[0],$=this._r[1],_=this._r[2],O=this._r[3],W=this._r[4],X=this._r[5],N=this._r[6],g=this._r[7],l=this._r[8],a=this._r[9];h>=16;){var c=f[u+0]|f[u+1]<<8;y+=c&8191;var v=f[u+2]|f[u+3]<<8;M+=(c>>>13|v<<3)&8191;var x=f[u+4]|f[u+5]<<8;D+=(v>>>10|x<<6)&8191;var A=f[u+6]|f[u+7]<<8;I+=(x>>>7|A<<9)&8191;var E=f[u+8]|f[u+9]<<8;C+=(A>>>4|E<<12)&8191,K+=E>>>1&8191;var d=f[u+10]|f[u+11]<<8;j+=(E>>>14|d<<2)&8191;var w=f[u+12]|f[u+13]<<8;B+=(d>>>11|w<<5)&8191;var b=f[u+14]|f[u+15]<<8;k+=(w>>>8|b<<8)&8191,T+=b>>>5|p;var R=0,Y=R;Y+=y*q,Y+=M*(5*a),Y+=D*(5*l),Y+=I*(5*g),Y+=C*(5*N),R=Y>>>13,Y&=8191,Y+=K*(5*X),Y+=j*(5*W),Y+=B*(5*O),Y+=k*(5*_),Y+=T*(5*$),R+=Y>>>13,Y&=8191;var S=R;S+=y*$,S+=M*q,S+=D*(5*a),S+=I*(5*l),S+=C*(5*g),R=S>>>13,S&=8191,S+=K*(5*N),S+=j*(5*X),S+=B*(5*W),S+=k*(5*O),S+=T*(5*_),R+=S>>>13,S&=8191;var V=R;V+=y*_,V+=M*$,V+=D*q,V+=I*(5*a),V+=C*(5*l),R=V>>>13,V&=8191,V+=K*(5*g),V+=j*(5*N),V+=B*(5*X),V+=k*(5*W),V+=T*(5*O),R+=V>>>13,V&=8191;var P=R;P+=y*O,P+=M*_,P+=D*$,P+=I*q,P+=C*(5*a),R=P>>>13,P&=8191,P+=K*(5*l),P+=j*(5*g),P+=B*(5*N),P+=k*(5*X),P+=T*(5*W),R+=P>>>13,P&=8191;var F=R;F+=y*W,F+=M*O,F+=D*_,F+=I*$,F+=C*q,R=F>>>13,F&=8191,F+=K*(5*a),F+=j*(5*l),F+=B*(5*g),F+=k*(5*N),F+=T*(5*X),R+=F>>>13,F&=8191;var L=R;L+=y*X,L+=M*W,L+=D*O,L+=I*_,L+=C*$,R=L>>>13,L&=8191,L+=K*q,L+=j*(5*a),L+=B*(5*l),L+=k*(5*g),L+=T*(5*N),R+=L>>>13,L&=8191;var m=R;m+=y*N,m+=M*X,m+=D*W,m+=I*O,m+=C*_,R=m>>>13,m&=8191,m+=K*$,m+=j*q,m+=B*(5*a),m+=k*(5*l),m+=T*(5*g),R+=m>>>13,m&=8191;var U=R;U+=y*g,U+=M*N,U+=D*X,U+=I*W,U+=C*O,R=U>>>13,U&=8191,U+=K*_,U+=j*$,U+=B*q,U+=k*(5*a),U+=T*(5*l),R+=U>>>13,U&=8191;var G=R;G+=y*l,G+=M*g,G+=D*N,G+=I*X,G+=C*W,R=G>>>13,G&=8191,G+=K*O,G+=j*_,G+=B*$,G+=k*q,G+=T*(5*a),R+=G>>>13,G&=8191;var J=R;J+=y*a,J+=M*l,J+=D*g,J+=I*N,J+=C*X,R=J>>>13,J&=8191,J+=K*W,J+=j*O,J+=B*_,J+=k*$,J+=T*q,R+=J>>>13,J&=8191,R=(R<<2)+R|0,R=R+Y|0,Y=R&8191,R=R>>>13,S+=R,y=Y,M=S,D=V,I=P,C=F,K=L,j=m,B=U,k=G,T=J,u+=16,h-=16}this._h[0]=y,this._h[1]=M,this._h[2]=D,this._h[3]=I,this._h[4]=C,this._h[5]=K,this._h[6]=j,this._h[7]=B,this._h[8]=k,this._h[9]=T},o.prototype.finish=function(f,u){u===void 0&&(u=0);var h=new Uint16Array(10),p,y,M,D;if(this._leftover){for(D=this._leftover,this._buffer[D++]=1;D<16;D++)this._buffer[D]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(p=this._h[1]>>>13,this._h[1]&=8191,D=2;D<10;D++)this._h[D]+=p,p=this._h[D]>>>13,this._h[D]&=8191;for(this._h[0]+=p*5,p=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=p,p=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=p,h[0]=this._h[0]+5,p=h[0]>>>13,h[0]&=8191,D=1;D<10;D++)h[D]=this._h[D]+p,p=h[D]>>>13,h[D]&=8191;for(h[9]-=8192,y=(p^1)-1,D=0;D<10;D++)h[D]&=y;for(y=~y,D=0;D<10;D++)this._h[D]=this._h[D]&y|h[D];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,M=this._h[0]+this._pad[0],this._h[0]=M&65535,D=1;D<8;D++)M=(this._h[D]+this._pad[D]|0)+(M>>>16)|0,this._h[D]=M&65535;return f[u+0]=this._h[0]>>>0,f[u+1]=this._h[0]>>>8,f[u+2]=this._h[1]>>>0,f[u+3]=this._h[1]>>>8,f[u+4]=this._h[2]>>>0,f[u+5]=this._h[2]>>>8,f[u+6]=this._h[3]>>>0,f[u+7]=this._h[3]>>>8,f[u+8]=this._h[4]>>>0,f[u+9]=this._h[4]>>>8,f[u+10]=this._h[5]>>>0,f[u+11]=this._h[5]>>>8,f[u+12]=this._h[6]>>>0,f[u+13]=this._h[6]>>>8,f[u+14]=this._h[7]>>>0,f[u+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(f){var u=0,h=f.length,p;if(this._leftover){p=16-this._leftover,p>h&&(p=h);for(var y=0;y<p;y++)this._buffer[this._leftover+y]=f[u+y];if(h-=p,u+=p,this._leftover+=p,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(h>=16&&(p=h-h%16,this._blocks(f,u,p),u+=p,h-=p),h){for(var y=0;y<h;y++)this._buffer[this._leftover+y]=f[u+y];this._leftover+=h}return this},o.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var f=new Uint8Array(16);return this.finish(f),f},o.prototype.clean=function(){return t.wipe(this._buffer),t.wipe(this._r),t.wipe(this._h),t.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},o}();r.Poly1305=i;function n(o,f){var u=new i(o);u.update(f);var h=u.digest();return u.clean(),h}r.oneTimeAuth=n;function s(o,f){return o.length!==r.DIGEST_LENGTH||f.length!==r.DIGEST_LENGTH?!1:e.equal(o,f)}r.equal=s}(tu),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=sa,t=tu,i=ar,n=Ve,s=Ai;r.KEY_LENGTH=32,r.NONCE_LENGTH=12,r.TAG_LENGTH=16;var o=new Uint8Array(16),f=function(){function u(h){if(this.nonceLength=r.NONCE_LENGTH,this.tagLength=r.TAG_LENGTH,h.length!==r.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(h)}return u.prototype.seal=function(h,p,y,M){if(h.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var D=new Uint8Array(16);D.set(h,D.length-h.length);var I=new Uint8Array(32);e.stream(this._key,D,I,4);var C=p.length+this.tagLength,K;if(M){if(M.length!==C)throw new Error("ChaCha20Poly1305: incorrect destination length");K=M}else K=new Uint8Array(C);return e.streamXOR(this._key,D,p,K,4),this._authenticate(K.subarray(K.length-this.tagLength,K.length),I,K.subarray(0,K.length-this.tagLength),y),i.wipe(D),K},u.prototype.open=function(h,p,y,M){if(h.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(p.length<this.tagLength)return null;var D=new Uint8Array(16);D.set(h,D.length-h.length);var I=new Uint8Array(32);e.stream(this._key,D,I,4);var C=new Uint8Array(this.tagLength);if(this._authenticate(C,I,p.subarray(0,p.length-this.tagLength),y),!s.equal(C,p.subarray(p.length-this.tagLength,p.length)))return null;var K=p.length-this.tagLength,j;if(M){if(M.length!==K)throw new Error("ChaCha20Poly1305: incorrect destination length");j=M}else j=new Uint8Array(K);return e.streamXOR(this._key,D,p.subarray(0,p.length-this.tagLength),j,4),i.wipe(D),j},u.prototype.clean=function(){return i.wipe(this._key),this},u.prototype._authenticate=function(h,p,y,M){var D=new t.Poly1305(p);M&&(D.update(M),M.length%16>0&&D.update(o.subarray(M.length%16))),D.update(y),y.length%16>0&&D.update(o.subarray(y.length%16));var I=new Uint8Array(8);M&&n.writeUint64LE(M.length,I),D.update(I),n.writeUint64LE(y.length,I),D.update(I);for(var C=D.digest(),K=0;K<C.length;K++)h[K]=C[K];D.clean(),i.wipe(C),i.wipe(I)},u}();r.ChaCha20Poly1305=f}(To);var iu={},Qn={},Lo={};Object.defineProperty(Lo,"__esModule",{value:!0});function V3(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}Lo.isSerializableHash=V3,Object.defineProperty(Qn,"__esModule",{value:!0});var jr=Lo,H3=Ai,G3=ar,nu=function(){function r(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(i).clean():i.set(t);for(var n=0;n<i.length;n++)i[n]^=54;this._inner.update(i);for(var n=0;n<i.length;n++)i[n]^=106;this._outer.update(i),jr.isSerializableHash(this._inner)&&jr.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),G3.wipe(i)}return r.prototype.reset=function(){if(!jr.isSerializableHash(this._inner)||!jr.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.clean=function(){jr.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),jr.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},r.prototype.update=function(e){return this._inner.update(e),this},r.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(!jr.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},r.prototype.restoreState=function(e){if(!jr.isSerializableHash(this._inner)||!jr.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.cleanSavedState=function(e){if(!jr.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},r}();Qn.HMAC=nu;function Y3(r,e,t){var i=new nu(r,e);i.update(t);var n=i.digest();return i.clean(),n}Qn.hmac=Y3,Qn.equal=H3.equal,Object.defineProperty(iu,"__esModule",{value:!0});var su=Qn,au=ar,W3=function(){function r(e,t,i,n){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=su.hmac(this._hash,i,t);this._hmac=new su.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},r.prototype.expand=function(e){for(var t=new Uint8Array(e),i=0;i<t.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[i]=this._buffer[this._bufpos++];return t},r.prototype.clean=function(){this._hmac.clean(),au.wipe(this._buffer),au.wipe(this._counter),this._bufpos=0},r}(),J3=iu.HKDF=W3,Xn={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Ve,t=ar;r.DIGEST_LENGTH=32,r.BLOCK_SIZE=64;var i=function(){function f(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return f.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._temp),this.reset()},f.prototype.update=function(u,h){if(h===void 0&&(h=u.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var p=0;if(this._bytesHashed+=h,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&h>0;)this._buffer[this._bufferLength++]=u[p++],h--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(h>=this.blockSize&&(p=s(this._temp,this._state,u,p,h),h%=this.blockSize);h>0;)this._buffer[this._bufferLength++]=u[p++],h--;return this},f.prototype.finish=function(u){if(!this._finished){var h=this._bytesHashed,p=this._bufferLength,y=h/536870912|0,M=h<<3,D=h%64<56?64:128;this._buffer[p]=128;for(var I=p+1;I<D-8;I++)this._buffer[I]=0;e.writeUint32BE(y,this._buffer,D-8),e.writeUint32BE(M,this._buffer,D-4),s(this._temp,this._state,this._buffer,0,D),this._finished=!0}for(var I=0;I<this.digestLength/4;I++)e.writeUint32BE(this._state[I],u,I*4);return this},f.prototype.digest=function(){var u=new Uint8Array(this.digestLength);return this.finish(u),u},f.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(u){return this._state.set(u.state),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},f.prototype.cleanSavedState=function(u){t.wipe(u.state),u.buffer&&t.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},f}();r.SHA256=i;var n=new Int32Array([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]);function s(f,u,h,p,y){for(;y>=64;){for(var M=u[0],D=u[1],I=u[2],C=u[3],K=u[4],j=u[5],B=u[6],k=u[7],T=0;T<16;T++){var q=p+T*4;f[T]=e.readUint32BE(h,q)}for(var T=16;T<64;T++){var $=f[T-2],_=($>>>17|$<<32-17)^($>>>19|$<<32-19)^$>>>10;$=f[T-15];var O=($>>>7|$<<32-7)^($>>>18|$<<32-18)^$>>>3;f[T]=(_+f[T-7]|0)+(O+f[T-16]|0)}for(var T=0;T<64;T++){var _=(((K>>>6|K<<26)^(K>>>11|K<<21)^(K>>>25|K<<7))+(K&j^~K&B)|0)+(k+(n[T]+f[T]|0)|0)|0,O=((M>>>2|M<<32-2)^(M>>>13|M<<32-13)^(M>>>22|M<<32-22))+(M&D^M&I^D&I)|0;k=B,B=j,j=K,K=C+_|0,C=I,I=D,D=M,M=_+O|0}u[0]+=M,u[1]+=D,u[2]+=I,u[3]+=C,u[4]+=K,u[5]+=j,u[6]+=B,u[7]+=k,p+=64,y-=64}return p}function o(f){var u=new i;u.update(f);var h=u.digest();return u.clean(),h}r.hash=o})(Xn);var Uo={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.sharedKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.scalarMultBase=r.scalarMult=r.SHARED_KEY_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=void 0;const e=wi,t=ar;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function i(T){const q=new Float64Array(16);if(T)for(let $=0;$<T.length;$++)q[$]=T[$];return q}const n=new Uint8Array(32);n[0]=9;const s=i([56129,1]);function o(T){let q=1;for(let $=0;$<16;$++){let _=T[$]+q+65535;q=Math.floor(_/65536),T[$]=_-q*65536}T[0]+=q-1+37*(q-1)}function f(T,q,$){const _=~($-1);for(let O=0;O<16;O++){const W=_&(T[O]^q[O]);T[O]^=W,q[O]^=W}}function u(T,q){const $=i(),_=i();for(let O=0;O<16;O++)_[O]=q[O];o(_),o(_),o(_);for(let O=0;O<2;O++){$[0]=_[0]-65517;for(let X=1;X<15;X++)$[X]=_[X]-65535-($[X-1]>>16&1),$[X-1]&=65535;$[15]=_[15]-32767-($[14]>>16&1);const W=$[15]>>16&1;$[14]&=65535,f(_,$,1-W)}for(let O=0;O<16;O++)T[2*O]=_[O]&255,T[2*O+1]=_[O]>>8}function h(T,q){for(let $=0;$<16;$++)T[$]=q[2*$]+(q[2*$+1]<<8);T[15]&=32767}function p(T,q,$){for(let _=0;_<16;_++)T[_]=q[_]+$[_]}function y(T,q,$){for(let _=0;_<16;_++)T[_]=q[_]-$[_]}function M(T,q,$){let _,O,W=0,X=0,N=0,g=0,l=0,a=0,c=0,v=0,x=0,A=0,E=0,d=0,w=0,b=0,R=0,Y=0,S=0,V=0,P=0,F=0,L=0,m=0,U=0,G=0,J=0,Q=0,ee=0,we=0,Se=0,he=0,Ne=0,Ee=$[0],se=$[1],be=$[2],le=$[3],ie=$[4],ue=$[5],fe=$[6],te=$[7],pe=$[8],_e=$[9],re=$[10],xe=$[11],Ae=$[12],oe=$[13],Ie=$[14],De=$[15];_=q[0],W+=_*Ee,X+=_*se,N+=_*be,g+=_*le,l+=_*ie,a+=_*ue,c+=_*fe,v+=_*te,x+=_*pe,A+=_*_e,E+=_*re,d+=_*xe,w+=_*Ae,b+=_*oe,R+=_*Ie,Y+=_*De,_=q[1],X+=_*Ee,N+=_*se,g+=_*be,l+=_*le,a+=_*ie,c+=_*ue,v+=_*fe,x+=_*te,A+=_*pe,E+=_*_e,d+=_*re,w+=_*xe,b+=_*Ae,R+=_*oe,Y+=_*Ie,S+=_*De,_=q[2],N+=_*Ee,g+=_*se,l+=_*be,a+=_*le,c+=_*ie,v+=_*ue,x+=_*fe,A+=_*te,E+=_*pe,d+=_*_e,w+=_*re,b+=_*xe,R+=_*Ae,Y+=_*oe,S+=_*Ie,V+=_*De,_=q[3],g+=_*Ee,l+=_*se,a+=_*be,c+=_*le,v+=_*ie,x+=_*ue,A+=_*fe,E+=_*te,d+=_*pe,w+=_*_e,b+=_*re,R+=_*xe,Y+=_*Ae,S+=_*oe,V+=_*Ie,P+=_*De,_=q[4],l+=_*Ee,a+=_*se,c+=_*be,v+=_*le,x+=_*ie,A+=_*ue,E+=_*fe,d+=_*te,w+=_*pe,b+=_*_e,R+=_*re,Y+=_*xe,S+=_*Ae,V+=_*oe,P+=_*Ie,F+=_*De,_=q[5],a+=_*Ee,c+=_*se,v+=_*be,x+=_*le,A+=_*ie,E+=_*ue,d+=_*fe,w+=_*te,b+=_*pe,R+=_*_e,Y+=_*re,S+=_*xe,V+=_*Ae,P+=_*oe,F+=_*Ie,L+=_*De,_=q[6],c+=_*Ee,v+=_*se,x+=_*be,A+=_*le,E+=_*ie,d+=_*ue,w+=_*fe,b+=_*te,R+=_*pe,Y+=_*_e,S+=_*re,V+=_*xe,P+=_*Ae,F+=_*oe,L+=_*Ie,m+=_*De,_=q[7],v+=_*Ee,x+=_*se,A+=_*be,E+=_*le,d+=_*ie,w+=_*ue,b+=_*fe,R+=_*te,Y+=_*pe,S+=_*_e,V+=_*re,P+=_*xe,F+=_*Ae,L+=_*oe,m+=_*Ie,U+=_*De,_=q[8],x+=_*Ee,A+=_*se,E+=_*be,d+=_*le,w+=_*ie,b+=_*ue,R+=_*fe,Y+=_*te,S+=_*pe,V+=_*_e,P+=_*re,F+=_*xe,L+=_*Ae,m+=_*oe,U+=_*Ie,G+=_*De,_=q[9],A+=_*Ee,E+=_*se,d+=_*be,w+=_*le,b+=_*ie,R+=_*ue,Y+=_*fe,S+=_*te,V+=_*pe,P+=_*_e,F+=_*re,L+=_*xe,m+=_*Ae,U+=_*oe,G+=_*Ie,J+=_*De,_=q[10],E+=_*Ee,d+=_*se,w+=_*be,b+=_*le,R+=_*ie,Y+=_*ue,S+=_*fe,V+=_*te,P+=_*pe,F+=_*_e,L+=_*re,m+=_*xe,U+=_*Ae,G+=_*oe,J+=_*Ie,Q+=_*De,_=q[11],d+=_*Ee,w+=_*se,b+=_*be,R+=_*le,Y+=_*ie,S+=_*ue,V+=_*fe,P+=_*te,F+=_*pe,L+=_*_e,m+=_*re,U+=_*xe,G+=_*Ae,J+=_*oe,Q+=_*Ie,ee+=_*De,_=q[12],w+=_*Ee,b+=_*se,R+=_*be,Y+=_*le,S+=_*ie,V+=_*ue,P+=_*fe,F+=_*te,L+=_*pe,m+=_*_e,U+=_*re,G+=_*xe,J+=_*Ae,Q+=_*oe,ee+=_*Ie,we+=_*De,_=q[13],b+=_*Ee,R+=_*se,Y+=_*be,S+=_*le,V+=_*ie,P+=_*ue,F+=_*fe,L+=_*te,m+=_*pe,U+=_*_e,G+=_*re,J+=_*xe,Q+=_*Ae,ee+=_*oe,we+=_*Ie,Se+=_*De,_=q[14],R+=_*Ee,Y+=_*se,S+=_*be,V+=_*le,P+=_*ie,F+=_*ue,L+=_*fe,m+=_*te,U+=_*pe,G+=_*_e,J+=_*re,Q+=_*xe,ee+=_*Ae,we+=_*oe,Se+=_*Ie,he+=_*De,_=q[15],Y+=_*Ee,S+=_*se,V+=_*be,P+=_*le,F+=_*ie,L+=_*ue,m+=_*fe,U+=_*te,G+=_*pe,J+=_*_e,Q+=_*re,ee+=_*xe,we+=_*Ae,Se+=_*oe,he+=_*Ie,Ne+=_*De,W+=38*S,X+=38*V,N+=38*P,g+=38*F,l+=38*L,a+=38*m,c+=38*U,v+=38*G,x+=38*J,A+=38*Q,E+=38*ee,d+=38*we,w+=38*Se,b+=38*he,R+=38*Ne,O=1,_=W+O+65535,O=Math.floor(_/65536),W=_-O*65536,_=X+O+65535,O=Math.floor(_/65536),X=_-O*65536,_=N+O+65535,O=Math.floor(_/65536),N=_-O*65536,_=g+O+65535,O=Math.floor(_/65536),g=_-O*65536,_=l+O+65535,O=Math.floor(_/65536),l=_-O*65536,_=a+O+65535,O=Math.floor(_/65536),a=_-O*65536,_=c+O+65535,O=Math.floor(_/65536),c=_-O*65536,_=v+O+65535,O=Math.floor(_/65536),v=_-O*65536,_=x+O+65535,O=Math.floor(_/65536),x=_-O*65536,_=A+O+65535,O=Math.floor(_/65536),A=_-O*65536,_=E+O+65535,O=Math.floor(_/65536),E=_-O*65536,_=d+O+65535,O=Math.floor(_/65536),d=_-O*65536,_=w+O+65535,O=Math.floor(_/65536),w=_-O*65536,_=b+O+65535,O=Math.floor(_/65536),b=_-O*65536,_=R+O+65535,O=Math.floor(_/65536),R=_-O*65536,_=Y+O+65535,O=Math.floor(_/65536),Y=_-O*65536,W+=O-1+37*(O-1),O=1,_=W+O+65535,O=Math.floor(_/65536),W=_-O*65536,_=X+O+65535,O=Math.floor(_/65536),X=_-O*65536,_=N+O+65535,O=Math.floor(_/65536),N=_-O*65536,_=g+O+65535,O=Math.floor(_/65536),g=_-O*65536,_=l+O+65535,O=Math.floor(_/65536),l=_-O*65536,_=a+O+65535,O=Math.floor(_/65536),a=_-O*65536,_=c+O+65535,O=Math.floor(_/65536),c=_-O*65536,_=v+O+65535,O=Math.floor(_/65536),v=_-O*65536,_=x+O+65535,O=Math.floor(_/65536),x=_-O*65536,_=A+O+65535,O=Math.floor(_/65536),A=_-O*65536,_=E+O+65535,O=Math.floor(_/65536),E=_-O*65536,_=d+O+65535,O=Math.floor(_/65536),d=_-O*65536,_=w+O+65535,O=Math.floor(_/65536),w=_-O*65536,_=b+O+65535,O=Math.floor(_/65536),b=_-O*65536,_=R+O+65535,O=Math.floor(_/65536),R=_-O*65536,_=Y+O+65535,O=Math.floor(_/65536),Y=_-O*65536,W+=O-1+37*(O-1),T[0]=W,T[1]=X,T[2]=N,T[3]=g,T[4]=l,T[5]=a,T[6]=c,T[7]=v,T[8]=x,T[9]=A,T[10]=E,T[11]=d,T[12]=w,T[13]=b,T[14]=R,T[15]=Y}function D(T,q){M(T,q,q)}function I(T,q){const $=i();for(let _=0;_<16;_++)$[_]=q[_];for(let _=253;_>=0;_--)D($,$),_!==2&&_!==4&&M($,$,q);for(let _=0;_<16;_++)T[_]=$[_]}function C(T,q){const $=new Uint8Array(32),_=new Float64Array(80),O=i(),W=i(),X=i(),N=i(),g=i(),l=i();for(let x=0;x<31;x++)$[x]=T[x];$[31]=T[31]&127|64,$[0]&=248,h(_,q);for(let x=0;x<16;x++)W[x]=_[x];O[0]=N[0]=1;for(let x=254;x>=0;--x){const A=$[x>>>3]>>>(x&7)&1;f(O,W,A),f(X,N,A),p(g,O,X),y(O,O,X),p(X,W,N),y(W,W,N),D(N,g),D(l,O),M(O,X,O),M(X,W,g),p(g,O,X),y(O,O,X),D(W,O),y(X,N,l),M(O,X,s),p(O,O,N),M(X,X,O),M(O,N,l),M(N,W,_),D(W,g),f(O,W,A),f(X,N,A)}for(let x=0;x<16;x++)_[x+16]=O[x],_[x+32]=X[x],_[x+48]=W[x],_[x+64]=N[x];const a=_.subarray(32),c=_.subarray(16);I(a,a),M(c,c,a);const v=new Uint8Array(32);return u(v,c),v}r.scalarMult=C;function K(T){return C(T,n)}r.scalarMultBase=K;function j(T){if(T.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const q=new Uint8Array(T);return{publicKey:K(q),secretKey:q}}r.generateKeyPairFromSeed=j;function B(T){const q=(0,e.randomBytes)(32,T),$=j(q);return(0,t.wipe)(q),$}r.generateKeyPair=B;function k(T,q,$=!1){if(T.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(q.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const _=C(T,q);if($){let O=0;for(let W=0;W<_.length;W++)O|=_[W];if(O===0)throw new Error("X25519: invalid shared key")}return _}r.sharedKey=k})(Uo);var ou={},Q3="elliptic",X3="6.5.7",Z3="EC cryptography",e2="lib/elliptic.js",t2=["lib"],r2={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},i2={type:"git",url:"git@github.com:indutny/elliptic"},n2=["EC","Elliptic","curve","Cryptography"],s2="Fedor Indutny <fedor@indutny.com>",a2="MIT",o2={url:"https://github.com/indutny/elliptic/issues"},f2="https://github.com/indutny/elliptic",c2={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},h2={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},u2={name:Q3,version:X3,description:Z3,main:e2,files:t2,scripts:r2,repository:i2,keywords:n2,author:s2,license:a2,bugs:o2,homepage:f2,devDependencies:c2,dependencies:h2},hr={},Vr={exports:{}};(function(r){(function(e,t){function i(N,g){if(!N)throw new Error(g||"Assertion failed")}function n(N,g){N.super_=g;var l=function(){};l.prototype=g.prototype,N.prototype=new l,N.prototype.constructor=N}function s(N,g,l){if(s.isBN(N))return N;this.negative=0,this.words=null,this.length=0,this.red=null,N!==null&&((g==="le"||g==="be")&&(l=g,g=10),this._init(N||0,g||10,l||"be"))}typeof e=="object"?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=Fs.Buffer}catch{}s.isBN=function(g){return g instanceof s?!0:g!==null&&typeof g=="object"&&g.constructor.wordSize===s.wordSize&&Array.isArray(g.words)},s.max=function(g,l){return g.cmp(l)>0?g:l},s.min=function(g,l){return g.cmp(l)<0?g:l},s.prototype._init=function(g,l,a){if(typeof g=="number")return this._initNumber(g,l,a);if(typeof g=="object")return this._initArray(g,l,a);l==="hex"&&(l=16),i(l===(l|0)&&l>=2&&l<=36),g=g.toString().replace(/\s+/g,"");var c=0;g[0]==="-"&&(c++,this.negative=1),c<g.length&&(l===16?this._parseHex(g,c,a):(this._parseBase(g,l,c),a==="le"&&this._initArray(this.toArray(),l,a)))},s.prototype._initNumber=function(g,l,a){g<0&&(this.negative=1,g=-g),g<67108864?(this.words=[g&67108863],this.length=1):g<4503599627370496?(this.words=[g&67108863,g/67108864&67108863],this.length=2):(i(g<9007199254740992),this.words=[g&67108863,g/67108864&67108863,1],this.length=3),a==="le"&&this._initArray(this.toArray(),l,a)},s.prototype._initArray=function(g,l,a){if(i(typeof g.length=="number"),g.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(g.length/3),this.words=new Array(this.length);for(var c=0;c<this.length;c++)this.words[c]=0;var v,x,A=0;if(a==="be")for(c=g.length-1,v=0;c>=0;c-=3)x=g[c]|g[c-1]<<8|g[c-2]<<16,this.words[v]|=x<<A&67108863,this.words[v+1]=x>>>26-A&67108863,A+=24,A>=26&&(A-=26,v++);else if(a==="le")for(c=0,v=0;c<g.length;c+=3)x=g[c]|g[c+1]<<8|g[c+2]<<16,this.words[v]|=x<<A&67108863,this.words[v+1]=x>>>26-A&67108863,A+=24,A>=26&&(A-=26,v++);return this.strip()};function f(N,g){var l=N.charCodeAt(g);return l>=65&&l<=70?l-55:l>=97&&l<=102?l-87:l-48&15}function u(N,g,l){var a=f(N,l);return l-1>=g&&(a|=f(N,l-1)<<4),a}s.prototype._parseHex=function(g,l,a){this.length=Math.ceil((g.length-l)/6),this.words=new Array(this.length);for(var c=0;c<this.length;c++)this.words[c]=0;var v=0,x=0,A;if(a==="be")for(c=g.length-1;c>=l;c-=2)A=u(g,l,c)<<v,this.words[x]|=A&67108863,v>=18?(v-=18,x+=1,this.words[x]|=A>>>26):v+=8;else{var E=g.length-l;for(c=E%2===0?l+1:l;c<g.length;c+=2)A=u(g,l,c)<<v,this.words[x]|=A&67108863,v>=18?(v-=18,x+=1,this.words[x]|=A>>>26):v+=8}this.strip()};function h(N,g,l,a){for(var c=0,v=Math.min(N.length,l),x=g;x<v;x++){var A=N.charCodeAt(x)-48;c*=a,A>=49?c+=A-49+10:A>=17?c+=A-17+10:c+=A}return c}s.prototype._parseBase=function(g,l,a){this.words=[0],this.length=1;for(var c=0,v=1;v<=67108863;v*=l)c++;c--,v=v/l|0;for(var x=g.length-a,A=x%c,E=Math.min(x,x-A)+a,d=0,w=a;w<E;w+=c)d=h(g,w,w+c,l),this.imuln(v),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d);if(A!==0){var b=1;for(d=h(g,w,g.length,l),w=0;w<A;w++)b*=l;this.imuln(b),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d)}this.strip()},s.prototype.copy=function(g){g.words=new Array(this.length);for(var l=0;l<this.length;l++)g.words[l]=this.words[l];g.length=this.length,g.negative=this.negative,g.red=this.red},s.prototype.clone=function(){var g=new s(null);return this.copy(g),g},s.prototype._expand=function(g){for(;this.length<g;)this.words[this.length++]=0;return this},s.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],y=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(g,l){g=g||10,l=l|0||1;var a;if(g===16||g==="hex"){a="";for(var c=0,v=0,x=0;x<this.length;x++){var A=this.words[x],E=((A<<c|v)&16777215).toString(16);v=A>>>24-c&16777215,v!==0||x!==this.length-1?a=p[6-E.length]+E+a:a=E+a,c+=2,c>=26&&(c-=26,x--)}for(v!==0&&(a=v.toString(16)+a);a.length%l!==0;)a="0"+a;return this.negative!==0&&(a="-"+a),a}if(g===(g|0)&&g>=2&&g<=36){var d=y[g],w=M[g];a="";var b=this.clone();for(b.negative=0;!b.isZero();){var R=b.modn(w).toString(g);b=b.idivn(w),b.isZero()?a=R+a:a=p[d-R.length]+R+a}for(this.isZero()&&(a="0"+a);a.length%l!==0;)a="0"+a;return this.negative!==0&&(a="-"+a),a}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var g=this.words[0];return this.length===2?g+=this.words[1]*67108864:this.length===3&&this.words[2]===1?g+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-g:g},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(g,l){return i(typeof o<"u"),this.toArrayLike(o,g,l)},s.prototype.toArray=function(g,l){return this.toArrayLike(Array,g,l)},s.prototype.toArrayLike=function(g,l,a){var c=this.byteLength(),v=a||Math.max(1,c);i(c<=v,"byte array longer than desired length"),i(v>0,"Requested array length <= 0"),this.strip();var x=l==="le",A=new g(v),E,d,w=this.clone();if(x){for(d=0;!w.isZero();d++)E=w.andln(255),w.iushrn(8),A[d]=E;for(;d<v;d++)A[d]=0}else{for(d=0;d<v-c;d++)A[d]=0;for(d=0;!w.isZero();d++)E=w.andln(255),w.iushrn(8),A[v-d-1]=E}return A},Math.clz32?s.prototype._countBits=function(g){return 32-Math.clz32(g)}:s.prototype._countBits=function(g){var l=g,a=0;return l>=4096&&(a+=13,l>>>=13),l>=64&&(a+=7,l>>>=7),l>=8&&(a+=4,l>>>=4),l>=2&&(a+=2,l>>>=2),a+l},s.prototype._zeroBits=function(g){if(g===0)return 26;var l=g,a=0;return l&8191||(a+=13,l>>>=13),l&127||(a+=7,l>>>=7),l&15||(a+=4,l>>>=4),l&3||(a+=2,l>>>=2),l&1||a++,a},s.prototype.bitLength=function(){var g=this.words[this.length-1],l=this._countBits(g);return(this.length-1)*26+l};function D(N){for(var g=new Array(N.bitLength()),l=0;l<g.length;l++){var a=l/26|0,c=l%26;g[l]=(N.words[a]&1<<c)>>>c}return g}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var g=0,l=0;l<this.length;l++){var a=this._zeroBits(this.words[l]);if(g+=a,a!==26)break}return g},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(g){return this.negative!==0?this.abs().inotn(g).iaddn(1):this.clone()},s.prototype.fromTwos=function(g){return this.testn(g-1)?this.notn(g).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(g){for(;this.length<g.length;)this.words[this.length++]=0;for(var l=0;l<g.length;l++)this.words[l]=this.words[l]|g.words[l];return this.strip()},s.prototype.ior=function(g){return i((this.negative|g.negative)===0),this.iuor(g)},s.prototype.or=function(g){return this.length>g.length?this.clone().ior(g):g.clone().ior(this)},s.prototype.uor=function(g){return this.length>g.length?this.clone().iuor(g):g.clone().iuor(this)},s.prototype.iuand=function(g){var l;this.length>g.length?l=g:l=this;for(var a=0;a<l.length;a++)this.words[a]=this.words[a]&g.words[a];return this.length=l.length,this.strip()},s.prototype.iand=function(g){return i((this.negative|g.negative)===0),this.iuand(g)},s.prototype.and=function(g){return this.length>g.length?this.clone().iand(g):g.clone().iand(this)},s.prototype.uand=function(g){return this.length>g.length?this.clone().iuand(g):g.clone().iuand(this)},s.prototype.iuxor=function(g){var l,a;this.length>g.length?(l=this,a=g):(l=g,a=this);for(var c=0;c<a.length;c++)this.words[c]=l.words[c]^a.words[c];if(this!==l)for(;c<l.length;c++)this.words[c]=l.words[c];return this.length=l.length,this.strip()},s.prototype.ixor=function(g){return i((this.negative|g.negative)===0),this.iuxor(g)},s.prototype.xor=function(g){return this.length>g.length?this.clone().ixor(g):g.clone().ixor(this)},s.prototype.uxor=function(g){return this.length>g.length?this.clone().iuxor(g):g.clone().iuxor(this)},s.prototype.inotn=function(g){i(typeof g=="number"&&g>=0);var l=Math.ceil(g/26)|0,a=g%26;this._expand(l),a>0&&l--;for(var c=0;c<l;c++)this.words[c]=~this.words[c]&67108863;return a>0&&(this.words[c]=~this.words[c]&67108863>>26-a),this.strip()},s.prototype.notn=function(g){return this.clone().inotn(g)},s.prototype.setn=function(g,l){i(typeof g=="number"&&g>=0);var a=g/26|0,c=g%26;return this._expand(a+1),l?this.words[a]=this.words[a]|1<<c:this.words[a]=this.words[a]&~(1<<c),this.strip()},s.prototype.iadd=function(g){var l;if(this.negative!==0&&g.negative===0)return this.negative=0,l=this.isub(g),this.negative^=1,this._normSign();if(this.negative===0&&g.negative!==0)return g.negative=0,l=this.isub(g),g.negative=1,l._normSign();var a,c;this.length>g.length?(a=this,c=g):(a=g,c=this);for(var v=0,x=0;x<c.length;x++)l=(a.words[x]|0)+(c.words[x]|0)+v,this.words[x]=l&67108863,v=l>>>26;for(;v!==0&&x<a.length;x++)l=(a.words[x]|0)+v,this.words[x]=l&67108863,v=l>>>26;if(this.length=a.length,v!==0)this.words[this.length]=v,this.length++;else if(a!==this)for(;x<a.length;x++)this.words[x]=a.words[x];return this},s.prototype.add=function(g){var l;return g.negative!==0&&this.negative===0?(g.negative=0,l=this.sub(g),g.negative^=1,l):g.negative===0&&this.negative!==0?(this.negative=0,l=g.sub(this),this.negative=1,l):this.length>g.length?this.clone().iadd(g):g.clone().iadd(this)},s.prototype.isub=function(g){if(g.negative!==0){g.negative=0;var l=this.iadd(g);return g.negative=1,l._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(g),this.negative=1,this._normSign();var a=this.cmp(g);if(a===0)return this.negative=0,this.length=1,this.words[0]=0,this;var c,v;a>0?(c=this,v=g):(c=g,v=this);for(var x=0,A=0;A<v.length;A++)l=(c.words[A]|0)-(v.words[A]|0)+x,x=l>>26,this.words[A]=l&67108863;for(;x!==0&&A<c.length;A++)l=(c.words[A]|0)+x,x=l>>26,this.words[A]=l&67108863;if(x===0&&A<c.length&&c!==this)for(;A<c.length;A++)this.words[A]=c.words[A];return this.length=Math.max(this.length,A),c!==this&&(this.negative=1),this.strip()},s.prototype.sub=function(g){return this.clone().isub(g)};function I(N,g,l){l.negative=g.negative^N.negative;var a=N.length+g.length|0;l.length=a,a=a-1|0;var c=N.words[0]|0,v=g.words[0]|0,x=c*v,A=x&67108863,E=x/67108864|0;l.words[0]=A;for(var d=1;d<a;d++){for(var w=E>>>26,b=E&67108863,R=Math.min(d,g.length-1),Y=Math.max(0,d-N.length+1);Y<=R;Y++){var S=d-Y|0;c=N.words[S]|0,v=g.words[Y]|0,x=c*v+b,w+=x/67108864|0,b=x&67108863}l.words[d]=b|0,E=w|0}return E!==0?l.words[d]=E|0:l.length--,l.strip()}var C=function(g,l,a){var c=g.words,v=l.words,x=a.words,A=0,E,d,w,b=c[0]|0,R=b&8191,Y=b>>>13,S=c[1]|0,V=S&8191,P=S>>>13,F=c[2]|0,L=F&8191,m=F>>>13,U=c[3]|0,G=U&8191,J=U>>>13,Q=c[4]|0,ee=Q&8191,we=Q>>>13,Se=c[5]|0,he=Se&8191,Ne=Se>>>13,Ee=c[6]|0,se=Ee&8191,be=Ee>>>13,le=c[7]|0,ie=le&8191,ue=le>>>13,fe=c[8]|0,te=fe&8191,pe=fe>>>13,_e=c[9]|0,re=_e&8191,xe=_e>>>13,Ae=v[0]|0,oe=Ae&8191,Ie=Ae>>>13,De=v[1]|0,Re=De&8191,Ye=De>>>13,Qe=v[2]|0,Me=Qe&8191,et=Qe>>>13,tt=v[3]|0,Ce=tt&8191,Te=tt>>>13,Pe=v[4]|0,de=Pe&8191,Be=Pe>>>13,Le=v[5]|0,ce=Le&8191,qe=Le>>>13,$e=v[6]|0,me=$e&8191,ze=$e>>>13,Ke=v[7]|0,ge=Ke&8191,Ue=Ke>>>13,Oe=v[8]|0,ye=Oe&8191,ke=Oe>>>13,it=v[9]|0,Fe=it&8191,nt=it>>>13;a.negative=g.negative^l.negative,a.length=19,E=Math.imul(R,oe),d=Math.imul(R,Ie),d=d+Math.imul(Y,oe)|0,w=Math.imul(Y,Ie);var We=(A+E|0)+((d&8191)<<13)|0;A=(w+(d>>>13)|0)+(We>>>26)|0,We&=67108863,E=Math.imul(V,oe),d=Math.imul(V,Ie),d=d+Math.imul(P,oe)|0,w=Math.imul(P,Ie),E=E+Math.imul(R,Re)|0,d=d+Math.imul(R,Ye)|0,d=d+Math.imul(Y,Re)|0,w=w+Math.imul(Y,Ye)|0;var rt=(A+E|0)+((d&8191)<<13)|0;A=(w+(d>>>13)|0)+(rt>>>26)|0,rt&=67108863,E=Math.imul(L,oe),d=Math.imul(L,Ie),d=d+Math.imul(m,oe)|0,w=Math.imul(m,Ie),E=E+Math.imul(V,Re)|0,d=d+Math.imul(V,Ye)|0,d=d+Math.imul(P,Re)|0,w=w+Math.imul(P,Ye)|0,E=E+Math.imul(R,Me)|0,d=d+Math.imul(R,et)|0,d=d+Math.imul(Y,Me)|0,w=w+Math.imul(Y,et)|0;var rr=(A+E|0)+((d&8191)<<13)|0;A=(w+(d>>>13)|0)+(rr>>>26)|0,rr&=67108863,E=Math.imul(G,oe),d=Math.imul(G,Ie),d=d+Math.imul(J,oe)|0,w=Math.imul(J,Ie),E=E+Math.imul(L,Re)|0,d=d+Math.imul(L,Ye)|0,d=d+Math.imul(m,Re)|0,w=w+Math.imul(m,Ye)|0,E=E+Math.imul(V,Me)|0,d=d+Math.imul(V,et)|0,d=d+Math.imul(P,Me)|0,w=w+Math.imul(P,et)|0,E=E+Math.imul(R,Ce)|0,d=d+Math.imul(R,Te)|0,d=d+Math.imul(Y,Ce)|0,w=w+Math.imul(Y,Te)|0;var ir=(A+E|0)+((d&8191)<<13)|0;A=(w+(d>>>13)|0)+(ir>>>26)|0,ir&=67108863,E=Math.imul(ee,oe),d=Math.imul(ee,Ie),d=d+Math.imul(we,oe)|0,w=Math.imul(we,Ie),E=E+Math.imul(G,Re)|0,d=d+Math.imul(G,Ye)|0,d=d+Math.imul(J,Re)|0,w=w+Math.imul(J,Ye)|0,E=E+Math.imul(L,Me)|0,d=d+Math.imul(L,et)|0,d=d+Math.imul(m,Me)|0,w=w+Math.imul(m,et)|0,E=E+Math.imul(V,Ce)|0,d=d+Math.imul(V,Te)|0,d=d+Math.imul(P,Ce)|0,w=w+Math.imul(P,Te)|0,E=E+Math.imul(R,de)|0,d=d+Math.imul(R,Be)|0,d=d+Math.imul(Y,de)|0,w=w+Math.imul(Y,Be)|0;var nr=(A+E|0)+((d&8191)<<13)|0;A=(w+(d>>>13)|0)+(nr>>>26)|0,nr&=67108863,E=Math.imul(he,oe),d=Math.imul(he,Ie),d=d+Math.imul(Ne,oe)|0,w=Math.imul(Ne,Ie),E=E+Math.imul(ee,Re)|0,d=d+Math.imul(ee,Ye)|0,d=d+Math.imul(we,Re)|0,w=w+Math.imul(we,Ye)|0,E=E+Math.imul(G,Me)|0,d=d+Math.imul(G,et)|0,d=d+Math.imul(J,Me)|0,w=w+Math.imul(J,et)|0,E=E+Math.imul(L,Ce)|0,d=d+Math.imul(L,Te)|0,d=d+Math.imul(m,Ce)|0,w=w+Math.imul(m,Te)|0,E=E+Math.imul(V,de)|0,d=d+Math.imul(V,Be)|0,d=d+Math.imul(P,de)|0,w=w+Math.imul(P,Be)|0,E=E+Math.imul(R,ce)|0,d=d+Math.imul(R,qe)|0,d=d+Math.imul(Y,ce)|0,w=w+Math.imul(Y,qe)|0;var sr=(A+E|0)+((d&8191)<<13)|0;A=(w+(d>>>13)|0)+(sr>>>26)|0,sr&=67108863,E=Math.imul(se,oe),d=Math.imul(se,Ie),d=d+Math.imul(be,oe)|0,w=Math.imul(be,Ie),E=E+Math.imul(he,Re)|0,d=d+Math.imul(he,Ye)|0,d=d+Math.imul(Ne,Re)|0,w=w+Math.imul(Ne,Ye)|0,E=E+Math.imul(ee,Me)|0,d=d+Math.imul(ee,et)|0,d=d+Math.imul(we,Me)|0,w=w+Math.imul(we,et)|0,E=E+Math.imul(G,Ce)|0,d=d+Math.imul(G,Te)|0,d=d+Math.imul(J,Ce)|0,w=w+Math.imul(J,Te)|0,E=E+Math.imul(L,de)|0,d=d+Math.imul(L,Be)|0,d=d+Math.imul(m,de)|0,w=w+Math.imul(m,Be)|0,E=E+Math.imul(V,ce)|0,d=d+Math.imul(V,qe)|0,d=d+Math.imul(P,ce)|0,w=w+Math.imul(P,qe)|0,E=E+Math.imul(R,me)|0,d=d+Math.imul(R,ze)|0,d=d+Math.imul(Y,me)|0,w=w+Math.imul(Y,ze)|0;var yt=(A+E|0)+((d&8191)<<13)|0;A=(w+(d>>>13)|0)+(yt>>>26)|0,yt&=67108863,E=Math.imul(ie,oe),d=Math.imul(ie,Ie),d=d+Math.imul(ue,oe)|0,w=Math.imul(ue,Ie),E=E+Math.imul(se,Re)|0,d=d+Math.imul(se,Ye)|0,d=d+Math.imul(be,Re)|0,w=w+Math.imul(be,Ye)|0,E=E+Math.imul(he,Me)|0,d=d+Math.imul(he,et)|0,d=d+Math.imul(Ne,Me)|0,w=w+Math.imul(Ne,et)|0,E=E+Math.imul(ee,Ce)|0,d=d+Math.imul(ee,Te)|0,d=d+Math.imul(we,Ce)|0,w=w+Math.imul(we,Te)|0,E=E+Math.imul(G,de)|0,d=d+Math.imul(G,Be)|0,d=d+Math.imul(J,de)|0,w=w+Math.imul(J,Be)|0,E=E+Math.imul(L,ce)|0,d=d+Math.imul(L,qe)|0,d=d+Math.imul(m,ce)|0,w=w+Math.imul(m,qe)|0,E=E+Math.imul(V,me)|0,d=d+Math.imul(V,ze)|0,d=d+Math.imul(P,me)|0,w=w+Math.imul(P,ze)|0,E=E+Math.imul(R,ge)|0,d=d+Math.imul(R,Ue)|0,d=d+Math.imul(Y,ge)|0,w=w+Math.imul(Y,Ue)|0;var ci=(A+E|0)+((d&8191)<<13)|0;A=(w+(d>>>13)|0)+(ci>>>26)|0,ci&=67108863,E=Math.imul(te,oe),d=Math.imul(te,Ie),d=d+Math.imul(pe,oe)|0,w=Math.imul(pe,Ie),E=E+Math.imul(ie,Re)|0,d=d+Math.imul(ie,Ye)|0,d=d+Math.imul(ue,Re)|0,w=w+Math.imul(ue,Ye)|0,E=E+Math.imul(se,Me)|0,d=d+Math.imul(se,et)|0,d=d+Math.imul(be,Me)|0,w=w+Math.imul(be,et)|0,E=E+Math.imul(he,Ce)|0,d=d+Math.imul(he,Te)|0,d=d+Math.imul(Ne,Ce)|0,w=w+Math.imul(Ne,Te)|0,E=E+Math.imul(ee,de)|0,d=d+Math.imul(ee,Be)|0,d=d+Math.imul(we,de)|0,w=w+Math.imul(we,Be)|0,E=E+Math.imul(G,ce)|0,d=d+Math.imul(G,qe)|0,d=d+Math.imul(J,ce)|0,w=w+Math.imul(J,qe)|0,E=E+Math.imul(L,me)|0,d=d+Math.imul(L,ze)|0,d=d+Math.imul(m,me)|0,w=w+Math.imul(m,ze)|0,E=E+Math.imul(V,ge)|0,d=d+Math.imul(V,Ue)|0,d=d+Math.imul(P,ge)|0,w=w+Math.imul(P,Ue)|0,E=E+Math.imul(R,ye)|0,d=d+Math.imul(R,ke)|0,d=d+Math.imul(Y,ye)|0,w=w+Math.imul(Y,ke)|0;var hi=(A+E|0)+((d&8191)<<13)|0;A=(w+(d>>>13)|0)+(hi>>>26)|0,hi&=67108863,E=Math.imul(re,oe),d=Math.imul(re,Ie),d=d+Math.imul(xe,oe)|0,w=Math.imul(xe,Ie),E=E+Math.imul(te,Re)|0,d=d+Math.imul(te,Ye)|0,d=d+Math.imul(pe,Re)|0,w=w+Math.imul(pe,Ye)|0,E=E+Math.imul(ie,Me)|0,d=d+Math.imul(ie,et)|0,d=d+Math.imul(ue,Me)|0,w=w+Math.imul(ue,et)|0,E=E+Math.imul(se,Ce)|0,d=d+Math.imul(se,Te)|0,d=d+Math.imul(be,Ce)|0,w=w+Math.imul(be,Te)|0,E=E+Math.imul(he,de)|0,d=d+Math.imul(he,Be)|0,d=d+Math.imul(Ne,de)|0,w=w+Math.imul(Ne,Be)|0,E=E+Math.imul(ee,ce)|0,d=d+Math.imul(ee,qe)|0,d=d+Math.imul(we,ce)|0,w=w+Math.imul(we,qe)|0,E=E+Math.imul(G,me)|0,d=d+Math.imul(G,ze)|0,d=d+Math.imul(J,me)|0,w=w+Math.imul(J,ze)|0,E=E+Math.imul(L,ge)|0,d=d+Math.imul(L,Ue)|0,d=d+Math.imul(m,ge)|0,w=w+Math.imul(m,Ue)|0,E=E+Math.imul(V,ye)|0,d=d+Math.imul(V,ke)|0,d=d+Math.imul(P,ye)|0,w=w+Math.imul(P,ke)|0,E=E+Math.imul(R,Fe)|0,d=d+Math.imul(R,nt)|0,d=d+Math.imul(Y,Fe)|0,w=w+Math.imul(Y,nt)|0;var ui=(A+E|0)+((d&8191)<<13)|0;A=(w+(d>>>13)|0)+(ui>>>26)|0,ui&=67108863,E=Math.imul(re,Re),d=Math.imul(re,Ye),d=d+Math.imul(xe,Re)|0,w=Math.imul(xe,Ye),E=E+Math.imul(te,Me)|0,d=d+Math.imul(te,et)|0,d=d+Math.imul(pe,Me)|0,w=w+Math.imul(pe,et)|0,E=E+Math.imul(ie,Ce)|0,d=d+Math.imul(ie,Te)|0,d=d+Math.imul(ue,Ce)|0,w=w+Math.imul(ue,Te)|0,E=E+Math.imul(se,de)|0,d=d+Math.imul(se,Be)|0,d=d+Math.imul(be,de)|0,w=w+Math.imul(be,Be)|0,E=E+Math.imul(he,ce)|0,d=d+Math.imul(he,qe)|0,d=d+Math.imul(Ne,ce)|0,w=w+Math.imul(Ne,qe)|0,E=E+Math.imul(ee,me)|0,d=d+Math.imul(ee,ze)|0,d=d+Math.imul(we,me)|0,w=w+Math.imul(we,ze)|0,E=E+Math.imul(G,ge)|0,d=d+Math.imul(G,Ue)|0,d=d+Math.imul(J,ge)|0,w=w+Math.imul(J,Ue)|0,E=E+Math.imul(L,ye)|0,d=d+Math.imul(L,ke)|0,d=d+Math.imul(m,ye)|0,w=w+Math.imul(m,ke)|0,E=E+Math.imul(V,Fe)|0,d=d+Math.imul(V,nt)|0,d=d+Math.imul(P,Fe)|0,w=w+Math.imul(P,nt)|0;var di=(A+E|0)+((d&8191)<<13)|0;A=(w+(d>>>13)|0)+(di>>>26)|0,di&=67108863,E=Math.imul(re,Me),d=Math.imul(re,et),d=d+Math.imul(xe,Me)|0,w=Math.imul(xe,et),E=E+Math.imul(te,Ce)|0,d=d+Math.imul(te,Te)|0,d=d+Math.imul(pe,Ce)|0,w=w+Math.imul(pe,Te)|0,E=E+Math.imul(ie,de)|0,d=d+Math.imul(ie,Be)|0,d=d+Math.imul(ue,de)|0,w=w+Math.imul(ue,Be)|0,E=E+Math.imul(se,ce)|0,d=d+Math.imul(se,qe)|0,d=d+Math.imul(be,ce)|0,w=w+Math.imul(be,qe)|0,E=E+Math.imul(he,me)|0,d=d+Math.imul(he,ze)|0,d=d+Math.imul(Ne,me)|0,w=w+Math.imul(Ne,ze)|0,E=E+Math.imul(ee,ge)|0,d=d+Math.imul(ee,Ue)|0,d=d+Math.imul(we,ge)|0,w=w+Math.imul(we,Ue)|0,E=E+Math.imul(G,ye)|0,d=d+Math.imul(G,ke)|0,d=d+Math.imul(J,ye)|0,w=w+Math.imul(J,ke)|0,E=E+Math.imul(L,Fe)|0,d=d+Math.imul(L,nt)|0,d=d+Math.imul(m,Fe)|0,w=w+Math.imul(m,nt)|0;var li=(A+E|0)+((d&8191)<<13)|0;A=(w+(d>>>13)|0)+(li>>>26)|0,li&=67108863,E=Math.imul(re,Ce),d=Math.imul(re,Te),d=d+Math.imul(xe,Ce)|0,w=Math.imul(xe,Te),E=E+Math.imul(te,de)|0,d=d+Math.imul(te,Be)|0,d=d+Math.imul(pe,de)|0,w=w+Math.imul(pe,Be)|0,E=E+Math.imul(ie,ce)|0,d=d+Math.imul(ie,qe)|0,d=d+Math.imul(ue,ce)|0,w=w+Math.imul(ue,qe)|0,E=E+Math.imul(se,me)|0,d=d+Math.imul(se,ze)|0,d=d+Math.imul(be,me)|0,w=w+Math.imul(be,ze)|0,E=E+Math.imul(he,ge)|0,d=d+Math.imul(he,Ue)|0,d=d+Math.imul(Ne,ge)|0,w=w+Math.imul(Ne,Ue)|0,E=E+Math.imul(ee,ye)|0,d=d+Math.imul(ee,ke)|0,d=d+Math.imul(we,ye)|0,w=w+Math.imul(we,ke)|0,E=E+Math.imul(G,Fe)|0,d=d+Math.imul(G,nt)|0,d=d+Math.imul(J,Fe)|0,w=w+Math.imul(J,nt)|0;var xr=(A+E|0)+((d&8191)<<13)|0;A=(w+(d>>>13)|0)+(xr>>>26)|0,xr&=67108863,E=Math.imul(re,de),d=Math.imul(re,Be),d=d+Math.imul(xe,de)|0,w=Math.imul(xe,Be),E=E+Math.imul(te,ce)|0,d=d+Math.imul(te,qe)|0,d=d+Math.imul(pe,ce)|0,w=w+Math.imul(pe,qe)|0,E=E+Math.imul(ie,me)|0,d=d+Math.imul(ie,ze)|0,d=d+Math.imul(ue,me)|0,w=w+Math.imul(ue,ze)|0,E=E+Math.imul(se,ge)|0,d=d+Math.imul(se,Ue)|0,d=d+Math.imul(be,ge)|0,w=w+Math.imul(be,Ue)|0,E=E+Math.imul(he,ye)|0,d=d+Math.imul(he,ke)|0,d=d+Math.imul(Ne,ye)|0,w=w+Math.imul(Ne,ke)|0,E=E+Math.imul(ee,Fe)|0,d=d+Math.imul(ee,nt)|0,d=d+Math.imul(we,Fe)|0,w=w+Math.imul(we,nt)|0;var pi=(A+E|0)+((d&8191)<<13)|0;A=(w+(d>>>13)|0)+(pi>>>26)|0,pi&=67108863,E=Math.imul(re,ce),d=Math.imul(re,qe),d=d+Math.imul(xe,ce)|0,w=Math.imul(xe,qe),E=E+Math.imul(te,me)|0,d=d+Math.imul(te,ze)|0,d=d+Math.imul(pe,me)|0,w=w+Math.imul(pe,ze)|0,E=E+Math.imul(ie,ge)|0,d=d+Math.imul(ie,Ue)|0,d=d+Math.imul(ue,ge)|0,w=w+Math.imul(ue,Ue)|0,E=E+Math.imul(se,ye)|0,d=d+Math.imul(se,ke)|0,d=d+Math.imul(be,ye)|0,w=w+Math.imul(be,ke)|0,E=E+Math.imul(he,Fe)|0,d=d+Math.imul(he,nt)|0,d=d+Math.imul(Ne,Fe)|0,w=w+Math.imul(Ne,nt)|0;var gi=(A+E|0)+((d&8191)<<13)|0;A=(w+(d>>>13)|0)+(gi>>>26)|0,gi&=67108863,E=Math.imul(re,me),d=Math.imul(re,ze),d=d+Math.imul(xe,me)|0,w=Math.imul(xe,ze),E=E+Math.imul(te,ge)|0,d=d+Math.imul(te,Ue)|0,d=d+Math.imul(pe,ge)|0,w=w+Math.imul(pe,Ue)|0,E=E+Math.imul(ie,ye)|0,d=d+Math.imul(ie,ke)|0,d=d+Math.imul(ue,ye)|0,w=w+Math.imul(ue,ke)|0,E=E+Math.imul(se,Fe)|0,d=d+Math.imul(se,nt)|0,d=d+Math.imul(be,Fe)|0,w=w+Math.imul(be,nt)|0;var Kt=(A+E|0)+((d&8191)<<13)|0;A=(w+(d>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,E=Math.imul(re,ge),d=Math.imul(re,Ue),d=d+Math.imul(xe,ge)|0,w=Math.imul(xe,Ue),E=E+Math.imul(te,ye)|0,d=d+Math.imul(te,ke)|0,d=d+Math.imul(pe,ye)|0,w=w+Math.imul(pe,ke)|0,E=E+Math.imul(ie,Fe)|0,d=d+Math.imul(ie,nt)|0,d=d+Math.imul(ue,Fe)|0,w=w+Math.imul(ue,nt)|0;var vi=(A+E|0)+((d&8191)<<13)|0;A=(w+(d>>>13)|0)+(vi>>>26)|0,vi&=67108863,E=Math.imul(re,ye),d=Math.imul(re,ke),d=d+Math.imul(xe,ye)|0,w=Math.imul(xe,ke),E=E+Math.imul(te,Fe)|0,d=d+Math.imul(te,nt)|0,d=d+Math.imul(pe,Fe)|0,w=w+Math.imul(pe,nt)|0;var bi=(A+E|0)+((d&8191)<<13)|0;A=(w+(d>>>13)|0)+(bi>>>26)|0,bi&=67108863,E=Math.imul(re,Fe),d=Math.imul(re,nt),d=d+Math.imul(xe,Fe)|0,w=Math.imul(xe,nt);var mi=(A+E|0)+((d&8191)<<13)|0;return A=(w+(d>>>13)|0)+(mi>>>26)|0,mi&=67108863,x[0]=We,x[1]=rt,x[2]=rr,x[3]=ir,x[4]=nr,x[5]=sr,x[6]=yt,x[7]=ci,x[8]=hi,x[9]=ui,x[10]=di,x[11]=li,x[12]=xr,x[13]=pi,x[14]=gi,x[15]=Kt,x[16]=vi,x[17]=bi,x[18]=mi,A!==0&&(x[19]=A,a.length++),a};Math.imul||(C=I);function K(N,g,l){l.negative=g.negative^N.negative,l.length=N.length+g.length;for(var a=0,c=0,v=0;v<l.length-1;v++){var x=c;c=0;for(var A=a&67108863,E=Math.min(v,g.length-1),d=Math.max(0,v-N.length+1);d<=E;d++){var w=v-d,b=N.words[w]|0,R=g.words[d]|0,Y=b*R,S=Y&67108863;x=x+(Y/67108864|0)|0,S=S+A|0,A=S&67108863,x=x+(S>>>26)|0,c+=x>>>26,x&=67108863}l.words[v]=A,a=x,x=c}return a!==0?l.words[v]=a:l.length--,l.strip()}function j(N,g,l){var a=new B;return a.mulp(N,g,l)}s.prototype.mulTo=function(g,l){var a,c=this.length+g.length;return this.length===10&&g.length===10?a=C(this,g,l):c<63?a=I(this,g,l):c<1024?a=K(this,g,l):a=j(this,g,l),a};function B(N,g){this.x=N,this.y=g}B.prototype.makeRBT=function(g){for(var l=new Array(g),a=s.prototype._countBits(g)-1,c=0;c<g;c++)l[c]=this.revBin(c,a,g);return l},B.prototype.revBin=function(g,l,a){if(g===0||g===a-1)return g;for(var c=0,v=0;v<l;v++)c|=(g&1)<<l-v-1,g>>=1;return c},B.prototype.permute=function(g,l,a,c,v,x){for(var A=0;A<x;A++)c[A]=l[g[A]],v[A]=a[g[A]]},B.prototype.transform=function(g,l,a,c,v,x){this.permute(x,g,l,a,c,v);for(var A=1;A<v;A<<=1)for(var E=A<<1,d=Math.cos(2*Math.PI/E),w=Math.sin(2*Math.PI/E),b=0;b<v;b+=E)for(var R=d,Y=w,S=0;S<A;S++){var V=a[b+S],P=c[b+S],F=a[b+S+A],L=c[b+S+A],m=R*F-Y*L;L=R*L+Y*F,F=m,a[b+S]=V+F,c[b+S]=P+L,a[b+S+A]=V-F,c[b+S+A]=P-L,S!==E&&(m=d*R-w*Y,Y=d*Y+w*R,R=m)}},B.prototype.guessLen13b=function(g,l){var a=Math.max(l,g)|1,c=a&1,v=0;for(a=a/2|0;a;a=a>>>1)v++;return 1<<v+1+c},B.prototype.conjugate=function(g,l,a){if(!(a<=1))for(var c=0;c<a/2;c++){var v=g[c];g[c]=g[a-c-1],g[a-c-1]=v,v=l[c],l[c]=-l[a-c-1],l[a-c-1]=-v}},B.prototype.normalize13b=function(g,l){for(var a=0,c=0;c<l/2;c++){var v=Math.round(g[2*c+1]/l)*8192+Math.round(g[2*c]/l)+a;g[c]=v&67108863,v<67108864?a=0:a=v/67108864|0}return g},B.prototype.convert13b=function(g,l,a,c){for(var v=0,x=0;x<l;x++)v=v+(g[x]|0),a[2*x]=v&8191,v=v>>>13,a[2*x+1]=v&8191,v=v>>>13;for(x=2*l;x<c;++x)a[x]=0;i(v===0),i((v&-8192)===0)},B.prototype.stub=function(g){for(var l=new Array(g),a=0;a<g;a++)l[a]=0;return l},B.prototype.mulp=function(g,l,a){var c=2*this.guessLen13b(g.length,l.length),v=this.makeRBT(c),x=this.stub(c),A=new Array(c),E=new Array(c),d=new Array(c),w=new Array(c),b=new Array(c),R=new Array(c),Y=a.words;Y.length=c,this.convert13b(g.words,g.length,A,c),this.convert13b(l.words,l.length,w,c),this.transform(A,x,E,d,c,v),this.transform(w,x,b,R,c,v);for(var S=0;S<c;S++){var V=E[S]*b[S]-d[S]*R[S];d[S]=E[S]*R[S]+d[S]*b[S],E[S]=V}return this.conjugate(E,d,c),this.transform(E,d,Y,x,c,v),this.conjugate(Y,x,c),this.normalize13b(Y,c),a.negative=g.negative^l.negative,a.length=g.length+l.length,a.strip()},s.prototype.mul=function(g){var l=new s(null);return l.words=new Array(this.length+g.length),this.mulTo(g,l)},s.prototype.mulf=function(g){var l=new s(null);return l.words=new Array(this.length+g.length),j(this,g,l)},s.prototype.imul=function(g){return this.clone().mulTo(g,this)},s.prototype.imuln=function(g){i(typeof g=="number"),i(g<67108864);for(var l=0,a=0;a<this.length;a++){var c=(this.words[a]|0)*g,v=(c&67108863)+(l&67108863);l>>=26,l+=c/67108864|0,l+=v>>>26,this.words[a]=v&67108863}return l!==0&&(this.words[a]=l,this.length++),this},s.prototype.muln=function(g){return this.clone().imuln(g)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(g){var l=D(g);if(l.length===0)return new s(1);for(var a=this,c=0;c<l.length&&l[c]===0;c++,a=a.sqr());if(++c<l.length)for(var v=a.sqr();c<l.length;c++,v=v.sqr())l[c]!==0&&(a=a.mul(v));return a},s.prototype.iushln=function(g){i(typeof g=="number"&&g>=0);var l=g%26,a=(g-l)/26,c=67108863>>>26-l<<26-l,v;if(l!==0){var x=0;for(v=0;v<this.length;v++){var A=this.words[v]&c,E=(this.words[v]|0)-A<<l;this.words[v]=E|x,x=A>>>26-l}x&&(this.words[v]=x,this.length++)}if(a!==0){for(v=this.length-1;v>=0;v--)this.words[v+a]=this.words[v];for(v=0;v<a;v++)this.words[v]=0;this.length+=a}return this.strip()},s.prototype.ishln=function(g){return i(this.negative===0),this.iushln(g)},s.prototype.iushrn=function(g,l,a){i(typeof g=="number"&&g>=0);var c;l?c=(l-l%26)/26:c=0;var v=g%26,x=Math.min((g-v)/26,this.length),A=67108863^67108863>>>v<<v,E=a;if(c-=x,c=Math.max(0,c),E){for(var d=0;d<x;d++)E.words[d]=this.words[d];E.length=x}if(x!==0)if(this.length>x)for(this.length-=x,d=0;d<this.length;d++)this.words[d]=this.words[d+x];else this.words[0]=0,this.length=1;var w=0;for(d=this.length-1;d>=0&&(w!==0||d>=c);d--){var b=this.words[d]|0;this.words[d]=w<<26-v|b>>>v,w=b&A}return E&&w!==0&&(E.words[E.length++]=w),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(g,l,a){return i(this.negative===0),this.iushrn(g,l,a)},s.prototype.shln=function(g){return this.clone().ishln(g)},s.prototype.ushln=function(g){return this.clone().iushln(g)},s.prototype.shrn=function(g){return this.clone().ishrn(g)},s.prototype.ushrn=function(g){return this.clone().iushrn(g)},s.prototype.testn=function(g){i(typeof g=="number"&&g>=0);var l=g%26,a=(g-l)/26,c=1<<l;if(this.length<=a)return!1;var v=this.words[a];return!!(v&c)},s.prototype.imaskn=function(g){i(typeof g=="number"&&g>=0);var l=g%26,a=(g-l)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=a)return this;if(l!==0&&a++,this.length=Math.min(a,this.length),l!==0){var c=67108863^67108863>>>l<<l;this.words[this.length-1]&=c}return this.strip()},s.prototype.maskn=function(g){return this.clone().imaskn(g)},s.prototype.iaddn=function(g){return i(typeof g=="number"),i(g<67108864),g<0?this.isubn(-g):this.negative!==0?this.length===1&&(this.words[0]|0)<g?(this.words[0]=g-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(g),this.negative=1,this):this._iaddn(g)},s.prototype._iaddn=function(g){this.words[0]+=g;for(var l=0;l<this.length&&this.words[l]>=67108864;l++)this.words[l]-=67108864,l===this.length-1?this.words[l+1]=1:this.words[l+1]++;return this.length=Math.max(this.length,l+1),this},s.prototype.isubn=function(g){if(i(typeof g=="number"),i(g<67108864),g<0)return this.iaddn(-g);if(this.negative!==0)return this.negative=0,this.iaddn(g),this.negative=1,this;if(this.words[0]-=g,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var l=0;l<this.length&&this.words[l]<0;l++)this.words[l]+=67108864,this.words[l+1]-=1;return this.strip()},s.prototype.addn=function(g){return this.clone().iaddn(g)},s.prototype.subn=function(g){return this.clone().isubn(g)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(g,l,a){var c=g.length+a,v;this._expand(c);var x,A=0;for(v=0;v<g.length;v++){x=(this.words[v+a]|0)+A;var E=(g.words[v]|0)*l;x-=E&67108863,A=(x>>26)-(E/67108864|0),this.words[v+a]=x&67108863}for(;v<this.length-a;v++)x=(this.words[v+a]|0)+A,A=x>>26,this.words[v+a]=x&67108863;if(A===0)return this.strip();for(i(A===-1),A=0,v=0;v<this.length;v++)x=-(this.words[v]|0)+A,A=x>>26,this.words[v]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(g,l){var a=this.length-g.length,c=this.clone(),v=g,x=v.words[v.length-1]|0,A=this._countBits(x);a=26-A,a!==0&&(v=v.ushln(a),c.iushln(a),x=v.words[v.length-1]|0);var E=c.length-v.length,d;if(l!=="mod"){d=new s(null),d.length=E+1,d.words=new Array(d.length);for(var w=0;w<d.length;w++)d.words[w]=0}var b=c.clone()._ishlnsubmul(v,1,E);b.negative===0&&(c=b,d&&(d.words[E]=1));for(var R=E-1;R>=0;R--){var Y=(c.words[v.length+R]|0)*67108864+(c.words[v.length+R-1]|0);for(Y=Math.min(Y/x|0,67108863),c._ishlnsubmul(v,Y,R);c.negative!==0;)Y--,c.negative=0,c._ishlnsubmul(v,1,R),c.isZero()||(c.negative^=1);d&&(d.words[R]=Y)}return d&&d.strip(),c.strip(),l!=="div"&&a!==0&&c.iushrn(a),{div:d||null,mod:c}},s.prototype.divmod=function(g,l,a){if(i(!g.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var c,v,x;return this.negative!==0&&g.negative===0?(x=this.neg().divmod(g,l),l!=="mod"&&(c=x.div.neg()),l!=="div"&&(v=x.mod.neg(),a&&v.negative!==0&&v.iadd(g)),{div:c,mod:v}):this.negative===0&&g.negative!==0?(x=this.divmod(g.neg(),l),l!=="mod"&&(c=x.div.neg()),{div:c,mod:x.mod}):this.negative&g.negative?(x=this.neg().divmod(g.neg(),l),l!=="div"&&(v=x.mod.neg(),a&&v.negative!==0&&v.isub(g)),{div:x.div,mod:v}):g.length>this.length||this.cmp(g)<0?{div:new s(0),mod:this}:g.length===1?l==="div"?{div:this.divn(g.words[0]),mod:null}:l==="mod"?{div:null,mod:new s(this.modn(g.words[0]))}:{div:this.divn(g.words[0]),mod:new s(this.modn(g.words[0]))}:this._wordDiv(g,l)},s.prototype.div=function(g){return this.divmod(g,"div",!1).div},s.prototype.mod=function(g){return this.divmod(g,"mod",!1).mod},s.prototype.umod=function(g){return this.divmod(g,"mod",!0).mod},s.prototype.divRound=function(g){var l=this.divmod(g);if(l.mod.isZero())return l.div;var a=l.div.negative!==0?l.mod.isub(g):l.mod,c=g.ushrn(1),v=g.andln(1),x=a.cmp(c);return x<0||v===1&&x===0?l.div:l.div.negative!==0?l.div.isubn(1):l.div.iaddn(1)},s.prototype.modn=function(g){i(g<=67108863);for(var l=(1<<26)%g,a=0,c=this.length-1;c>=0;c--)a=(l*a+(this.words[c]|0))%g;return a},s.prototype.idivn=function(g){i(g<=67108863);for(var l=0,a=this.length-1;a>=0;a--){var c=(this.words[a]|0)+l*67108864;this.words[a]=c/g|0,l=c%g}return this.strip()},s.prototype.divn=function(g){return this.clone().idivn(g)},s.prototype.egcd=function(g){i(g.negative===0),i(!g.isZero());var l=this,a=g.clone();l.negative!==0?l=l.umod(g):l=l.clone();for(var c=new s(1),v=new s(0),x=new s(0),A=new s(1),E=0;l.isEven()&&a.isEven();)l.iushrn(1),a.iushrn(1),++E;for(var d=a.clone(),w=l.clone();!l.isZero();){for(var b=0,R=1;!(l.words[0]&R)&&b<26;++b,R<<=1);if(b>0)for(l.iushrn(b);b-- >0;)(c.isOdd()||v.isOdd())&&(c.iadd(d),v.isub(w)),c.iushrn(1),v.iushrn(1);for(var Y=0,S=1;!(a.words[0]&S)&&Y<26;++Y,S<<=1);if(Y>0)for(a.iushrn(Y);Y-- >0;)(x.isOdd()||A.isOdd())&&(x.iadd(d),A.isub(w)),x.iushrn(1),A.iushrn(1);l.cmp(a)>=0?(l.isub(a),c.isub(x),v.isub(A)):(a.isub(l),x.isub(c),A.isub(v))}return{a:x,b:A,gcd:a.iushln(E)}},s.prototype._invmp=function(g){i(g.negative===0),i(!g.isZero());var l=this,a=g.clone();l.negative!==0?l=l.umod(g):l=l.clone();for(var c=new s(1),v=new s(0),x=a.clone();l.cmpn(1)>0&&a.cmpn(1)>0;){for(var A=0,E=1;!(l.words[0]&E)&&A<26;++A,E<<=1);if(A>0)for(l.iushrn(A);A-- >0;)c.isOdd()&&c.iadd(x),c.iushrn(1);for(var d=0,w=1;!(a.words[0]&w)&&d<26;++d,w<<=1);if(d>0)for(a.iushrn(d);d-- >0;)v.isOdd()&&v.iadd(x),v.iushrn(1);l.cmp(a)>=0?(l.isub(a),c.isub(v)):(a.isub(l),v.isub(c))}var b;return l.cmpn(1)===0?b=c:b=v,b.cmpn(0)<0&&b.iadd(g),b},s.prototype.gcd=function(g){if(this.isZero())return g.abs();if(g.isZero())return this.abs();var l=this.clone(),a=g.clone();l.negative=0,a.negative=0;for(var c=0;l.isEven()&&a.isEven();c++)l.iushrn(1),a.iushrn(1);do{for(;l.isEven();)l.iushrn(1);for(;a.isEven();)a.iushrn(1);var v=l.cmp(a);if(v<0){var x=l;l=a,a=x}else if(v===0||a.cmpn(1)===0)break;l.isub(a)}while(!0);return a.iushln(c)},s.prototype.invm=function(g){return this.egcd(g).a.umod(g)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(g){return this.words[0]&g},s.prototype.bincn=function(g){i(typeof g=="number");var l=g%26,a=(g-l)/26,c=1<<l;if(this.length<=a)return this._expand(a+1),this.words[a]|=c,this;for(var v=c,x=a;v!==0&&x<this.length;x++){var A=this.words[x]|0;A+=v,v=A>>>26,A&=67108863,this.words[x]=A}return v!==0&&(this.words[x]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(g){var l=g<0;if(this.negative!==0&&!l)return-1;if(this.negative===0&&l)return 1;this.strip();var a;if(this.length>1)a=1;else{l&&(g=-g),i(g<=67108863,"Number is too big");var c=this.words[0]|0;a=c===g?0:c<g?-1:1}return this.negative!==0?-a|0:a},s.prototype.cmp=function(g){if(this.negative!==0&&g.negative===0)return-1;if(this.negative===0&&g.negative!==0)return 1;var l=this.ucmp(g);return this.negative!==0?-l|0:l},s.prototype.ucmp=function(g){if(this.length>g.length)return 1;if(this.length<g.length)return-1;for(var l=0,a=this.length-1;a>=0;a--){var c=this.words[a]|0,v=g.words[a]|0;if(c!==v){c<v?l=-1:c>v&&(l=1);break}}return l},s.prototype.gtn=function(g){return this.cmpn(g)===1},s.prototype.gt=function(g){return this.cmp(g)===1},s.prototype.gten=function(g){return this.cmpn(g)>=0},s.prototype.gte=function(g){return this.cmp(g)>=0},s.prototype.ltn=function(g){return this.cmpn(g)===-1},s.prototype.lt=function(g){return this.cmp(g)===-1},s.prototype.lten=function(g){return this.cmpn(g)<=0},s.prototype.lte=function(g){return this.cmp(g)<=0},s.prototype.eqn=function(g){return this.cmpn(g)===0},s.prototype.eq=function(g){return this.cmp(g)===0},s.red=function(g){return new W(g)},s.prototype.toRed=function(g){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),g.convertTo(this)._forceRed(g)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(g){return this.red=g,this},s.prototype.forceRed=function(g){return i(!this.red,"Already a number in reduction context"),this._forceRed(g)},s.prototype.redAdd=function(g){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,g)},s.prototype.redIAdd=function(g){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,g)},s.prototype.redSub=function(g){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,g)},s.prototype.redISub=function(g){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,g)},s.prototype.redShl=function(g){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,g)},s.prototype.redMul=function(g){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.mul(this,g)},s.prototype.redIMul=function(g){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.imul(this,g)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(g){return i(this.red&&!g.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,g)};var k={k256:null,p224:null,p192:null,p25519:null};function T(N,g){this.name=N,this.p=new s(g,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}T.prototype._tmp=function(){var g=new s(null);return g.words=new Array(Math.ceil(this.n/13)),g},T.prototype.ireduce=function(g){var l=g,a;do this.split(l,this.tmp),l=this.imulK(l),l=l.iadd(this.tmp),a=l.bitLength();while(a>this.n);var c=a<this.n?-1:l.ucmp(this.p);return c===0?(l.words[0]=0,l.length=1):c>0?l.isub(this.p):l.strip!==void 0?l.strip():l._strip(),l},T.prototype.split=function(g,l){g.iushrn(this.n,0,l)},T.prototype.imulK=function(g){return g.imul(this.k)};function q(){T.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(q,T),q.prototype.split=function(g,l){for(var a=4194303,c=Math.min(g.length,9),v=0;v<c;v++)l.words[v]=g.words[v];if(l.length=c,g.length<=9){g.words[0]=0,g.length=1;return}var x=g.words[9];for(l.words[l.length++]=x&a,v=10;v<g.length;v++){var A=g.words[v]|0;g.words[v-10]=(A&a)<<4|x>>>22,x=A}x>>>=22,g.words[v-10]=x,x===0&&g.length>10?g.length-=10:g.length-=9},q.prototype.imulK=function(g){g.words[g.length]=0,g.words[g.length+1]=0,g.length+=2;for(var l=0,a=0;a<g.length;a++){var c=g.words[a]|0;l+=c*977,g.words[a]=l&67108863,l=c*64+(l/67108864|0)}return g.words[g.length-1]===0&&(g.length--,g.words[g.length-1]===0&&g.length--),g};function $(){T.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n($,T);function _(){T.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(_,T);function O(){T.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(O,T),O.prototype.imulK=function(g){for(var l=0,a=0;a<g.length;a++){var c=(g.words[a]|0)*19+l,v=c&67108863;c>>>=26,g.words[a]=v,l=c}return l!==0&&(g.words[g.length++]=l),g},s._prime=function(g){if(k[g])return k[g];var l;if(g==="k256")l=new q;else if(g==="p224")l=new $;else if(g==="p192")l=new _;else if(g==="p25519")l=new O;else throw new Error("Unknown prime "+g);return k[g]=l,l};function W(N){if(typeof N=="string"){var g=s._prime(N);this.m=g.p,this.prime=g}else i(N.gtn(1),"modulus must be greater than 1"),this.m=N,this.prime=null}W.prototype._verify1=function(g){i(g.negative===0,"red works only with positives"),i(g.red,"red works only with red numbers")},W.prototype._verify2=function(g,l){i((g.negative|l.negative)===0,"red works only with positives"),i(g.red&&g.red===l.red,"red works only with red numbers")},W.prototype.imod=function(g){return this.prime?this.prime.ireduce(g)._forceRed(this):g.umod(this.m)._forceRed(this)},W.prototype.neg=function(g){return g.isZero()?g.clone():this.m.sub(g)._forceRed(this)},W.prototype.add=function(g,l){this._verify2(g,l);var a=g.add(l);return a.cmp(this.m)>=0&&a.isub(this.m),a._forceRed(this)},W.prototype.iadd=function(g,l){this._verify2(g,l);var a=g.iadd(l);return a.cmp(this.m)>=0&&a.isub(this.m),a},W.prototype.sub=function(g,l){this._verify2(g,l);var a=g.sub(l);return a.cmpn(0)<0&&a.iadd(this.m),a._forceRed(this)},W.prototype.isub=function(g,l){this._verify2(g,l);var a=g.isub(l);return a.cmpn(0)<0&&a.iadd(this.m),a},W.prototype.shl=function(g,l){return this._verify1(g),this.imod(g.ushln(l))},W.prototype.imul=function(g,l){return this._verify2(g,l),this.imod(g.imul(l))},W.prototype.mul=function(g,l){return this._verify2(g,l),this.imod(g.mul(l))},W.prototype.isqr=function(g){return this.imul(g,g.clone())},W.prototype.sqr=function(g){return this.mul(g,g)},W.prototype.sqrt=function(g){if(g.isZero())return g.clone();var l=this.m.andln(3);if(i(l%2===1),l===3){var a=this.m.add(new s(1)).iushrn(2);return this.pow(g,a)}for(var c=this.m.subn(1),v=0;!c.isZero()&&c.andln(1)===0;)v++,c.iushrn(1);i(!c.isZero());var x=new s(1).toRed(this),A=x.redNeg(),E=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new s(2*d*d).toRed(this);this.pow(d,E).cmp(A)!==0;)d.redIAdd(A);for(var w=this.pow(d,c),b=this.pow(g,c.addn(1).iushrn(1)),R=this.pow(g,c),Y=v;R.cmp(x)!==0;){for(var S=R,V=0;S.cmp(x)!==0;V++)S=S.redSqr();i(V<Y);var P=this.pow(w,new s(1).iushln(Y-V-1));b=b.redMul(P),w=P.redSqr(),R=R.redMul(w),Y=V}return b},W.prototype.invm=function(g){var l=g._invmp(this.m);return l.negative!==0?(l.negative=0,this.imod(l).redNeg()):this.imod(l)},W.prototype.pow=function(g,l){if(l.isZero())return new s(1).toRed(this);if(l.cmpn(1)===0)return g.clone();var a=4,c=new Array(1<<a);c[0]=new s(1).toRed(this),c[1]=g;for(var v=2;v<c.length;v++)c[v]=this.mul(c[v-1],g);var x=c[0],A=0,E=0,d=l.bitLength()%26;for(d===0&&(d=26),v=l.length-1;v>=0;v--){for(var w=l.words[v],b=d-1;b>=0;b--){var R=w>>b&1;if(x!==c[0]&&(x=this.sqr(x)),R===0&&A===0){E=0;continue}A<<=1,A|=R,E++,!(E!==a&&(v!==0||b!==0))&&(x=this.mul(x,c[A]),E=0,A=0)}d=26}return x},W.prototype.convertTo=function(g){var l=g.umod(this.m);return l===g?l.clone():l},W.prototype.convertFrom=function(g){var l=g.clone();return l.red=null,l},s.mont=function(g){return new X(g)};function X(N){W.call(this,N),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(X,W),X.prototype.convertTo=function(g){return this.imod(g.ushln(this.shift))},X.prototype.convertFrom=function(g){var l=this.imod(g.mul(this.rinv));return l.red=null,l},X.prototype.imul=function(g,l){if(g.isZero()||l.isZero())return g.words[0]=0,g.length=1,g;var a=g.imul(l),c=a.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=a.isub(c).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},X.prototype.mul=function(g,l){if(g.isZero()||l.isZero())return new s(0)._forceRed(this);var a=g.mul(l),c=a.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=a.isub(c).iushrn(this.shift),x=v;return v.cmp(this.m)>=0?x=v.isub(this.m):v.cmpn(0)<0&&(x=v.iadd(this.m)),x._forceRed(this)},X.prototype.invm=function(g){var l=this.imod(g._invmp(this.m).mul(this.r2));return l._forceRed(this)}})(r,Ot)})(Vr);var Fo={};(function(r){var e=r;function t(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var f=[];if(typeof s!="string"){for(var u=0;u<s.length;u++)f[u]=s[u]|0;return f}if(o==="hex"){s=s.replace(/[^a-z0-9]+/ig,""),s.length%2!==0&&(s="0"+s);for(var u=0;u<s.length;u+=2)f.push(parseInt(s[u]+s[u+1],16))}else for(var u=0;u<s.length;u++){var h=s.charCodeAt(u),p=h>>8,y=h&255;p?f.push(p,y):f.push(y)}return f}e.toArray=t;function i(s){return s.length===1?"0"+s:s}e.zero2=i;function n(s){for(var o="",f=0;f<s.length;f++)o+=i(s[f].toString(16));return o}e.toHex=n,e.encode=function(o,f){return f==="hex"?n(o):o}})(Fo),function(r){var e=r,t=Vr.exports,i=qi,n=Fo;e.assert=i,e.toArray=n.toArray,e.zero2=n.zero2,e.toHex=n.toHex,e.encode=n.encode;function s(p,y,M){var D=new Array(Math.max(p.bitLength(),M)+1),I;for(I=0;I<D.length;I+=1)D[I]=0;var C=1<<y+1,K=p.clone();for(I=0;I<D.length;I++){var j,B=K.andln(C-1);K.isOdd()?(B>(C>>1)-1?j=(C>>1)-B:j=B,K.isubn(j)):j=0,D[I]=j,K.iushrn(1)}return D}e.getNAF=s;function o(p,y){var M=[[],[]];p=p.clone(),y=y.clone();for(var D=0,I=0,C;p.cmpn(-D)>0||y.cmpn(-I)>0;){var K=p.andln(3)+D&3,j=y.andln(3)+I&3;K===3&&(K=-1),j===3&&(j=-1);var B;K&1?(C=p.andln(7)+D&7,(C===3||C===5)&&j===2?B=-K:B=K):B=0,M[0].push(B);var k;j&1?(C=y.andln(7)+I&7,(C===3||C===5)&&K===2?k=-j:k=j):k=0,M[1].push(k),2*D===B+1&&(D=1-D),2*I===k+1&&(I=1-I),p.iushrn(1),y.iushrn(1)}return M}e.getJSF=o;function f(p,y,M){var D="_"+y;p.prototype[y]=function(){return this[D]!==void 0?this[D]:this[D]=M.call(this)}}e.cachedProperty=f;function u(p){return typeof p=="string"?e.toArray(p,"hex"):p}e.parseBytes=u;function h(p){return new t(p,"hex","le")}e.intFromLE=h}(hr);var aa={exports:{}},qo;aa.exports=function(e){return qo||(qo=new Si(null)),qo.generate(e)};function Si(r){this.rand=r}if(aa.exports.Rand=Si,Si.prototype.generate=function(e){return this._rand(e)},Si.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),i=0;i<t.length;i++)t[i]=this.rand.getByte();return t},typeof self=="object")self.crypto&&self.crypto.getRandomValues?Si.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?Si.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:typeof window=="object"&&(Si.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var fu=Fs;if(typeof fu.randomBytes!="function")throw new Error("Not supported");Si.prototype._rand=function(e){return fu.randomBytes(e)}}catch{}var $o={},Ki=Vr.exports,Zn=hr,oa=Zn.getNAF,d2=Zn.getJSF,fa=Zn.assert;function Di(r,e){this.type=r,this.p=new Ki(e.p,16),this.red=e.prime?Ki.red(e.prime):Ki.mont(this.p),this.zero=new Ki(0).toRed(this.red),this.one=new Ki(1).toRed(this.red),this.two=new Ki(2).toRed(this.red),this.n=e.n&&new Ki(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var ca=Di;Di.prototype.point=function(){throw new Error("Not implemented")},Di.prototype.validate=function(){throw new Error("Not implemented")},Di.prototype._fixedNafMul=function(e,t){fa(e.precomputed);var i=e._getDoubles(),n=oa(t,1,this._bitLength),s=(1<<i.step+1)-(i.step%2===0?2:1);s/=3;var o=[],f,u;for(f=0;f<n.length;f+=i.step){u=0;for(var h=f+i.step-1;h>=f;h--)u=(u<<1)+n[h];o.push(u)}for(var p=this.jpoint(null,null,null),y=this.jpoint(null,null,null),M=s;M>0;M--){for(f=0;f<o.length;f++)u=o[f],u===M?y=y.mixedAdd(i.points[f]):u===-M&&(y=y.mixedAdd(i.points[f].neg()));p=p.add(y)}return p.toP()},Di.prototype._wnafMul=function(e,t){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var s=n.points,o=oa(t,i,this._bitLength),f=this.jpoint(null,null,null),u=o.length-1;u>=0;u--){for(var h=0;u>=0&&o[u]===0;u--)h++;if(u>=0&&h++,f=f.dblp(h),u<0)break;var p=o[u];fa(p!==0),e.type==="affine"?p>0?f=f.mixedAdd(s[p-1>>1]):f=f.mixedAdd(s[-p-1>>1].neg()):p>0?f=f.add(s[p-1>>1]):f=f.add(s[-p-1>>1].neg())}return e.type==="affine"?f.toP():f},Di.prototype._wnafMulAdd=function(e,t,i,n,s){var o=this._wnafT1,f=this._wnafT2,u=this._wnafT3,h=0,p,y,M;for(p=0;p<n;p++){M=t[p];var D=M._getNAFPoints(e);o[p]=D.wnd,f[p]=D.points}for(p=n-1;p>=1;p-=2){var I=p-1,C=p;if(o[I]!==1||o[C]!==1){u[I]=oa(i[I],o[I],this._bitLength),u[C]=oa(i[C],o[C],this._bitLength),h=Math.max(u[I].length,h),h=Math.max(u[C].length,h);continue}var K=[t[I],null,null,t[C]];t[I].y.cmp(t[C].y)===0?(K[1]=t[I].add(t[C]),K[2]=t[I].toJ().mixedAdd(t[C].neg())):t[I].y.cmp(t[C].y.redNeg())===0?(K[1]=t[I].toJ().mixedAdd(t[C]),K[2]=t[I].add(t[C].neg())):(K[1]=t[I].toJ().mixedAdd(t[C]),K[2]=t[I].toJ().mixedAdd(t[C].neg()));var j=[-3,-1,-5,-7,0,7,5,1,3],B=d2(i[I],i[C]);for(h=Math.max(B[0].length,h),u[I]=new Array(h),u[C]=new Array(h),y=0;y<h;y++){var k=B[0][y]|0,T=B[1][y]|0;u[I][y]=j[(k+1)*3+(T+1)],u[C][y]=0,f[I]=K}}var q=this.jpoint(null,null,null),$=this._wnafT4;for(p=h;p>=0;p--){for(var _=0;p>=0;){var O=!0;for(y=0;y<n;y++)$[y]=u[y][p]|0,$[y]!==0&&(O=!1);if(!O)break;_++,p--}if(p>=0&&_++,q=q.dblp(_),p<0)break;for(y=0;y<n;y++){var W=$[y];W!==0&&(W>0?M=f[y][W-1>>1]:W<0&&(M=f[y][-W-1>>1].neg()),M.type==="affine"?q=q.mixedAdd(M):q=q.add(M))}}for(p=0;p<n;p++)f[p]=null;return s?q:q.toP()};function br(r,e){this.curve=r,this.type=e,this.precomputed=null}Di.BasePoint=br,br.prototype.eq=function(){throw new Error("Not implemented")},br.prototype.validate=function(){return this.curve.validate(this)},Di.prototype.decodePoint=function(e,t){e=Zn.toArray(e,t);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?fa(e[e.length-1]%2===0):e[0]===7&&fa(e[e.length-1]%2===1);var n=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return n}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")},br.prototype.encodeCompressed=function(e){return this.encode(e,!0)},br.prototype._encode=function(e){var t=this.curve.p.byteLength(),i=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",t))},br.prototype.encode=function(e,t){return Zn.encode(this._encode(t),e)},br.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},br.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},br.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,s=0;s<t;s+=e){for(var o=0;o<e;o++)n=n.dbl();i.push(n)}return{step:e,points:i}},br.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),s=1;s<i;s++)t[s]=t[s-1].add(n);return{wnd:e,points:t}},br.prototype._getBeta=function(){return null},br.prototype.dblp=function(e){for(var t=this,i=0;i<e;i++)t=t.dbl();return t};var l2=hr,pt=Vr.exports,zo=vn.exports,An=ca,p2=l2.assert;function mr(r){An.call(this,"short",r),this.a=new pt(r.a,16).toRed(this.red),this.b=new pt(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}zo(mr,An);var g2=mr;mr.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,i;if(e.beta)t=new pt(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=n[0].cmp(n[1])<0?n[0]:n[1],t=t.toRed(this.red)}if(e.lambda)i=new pt(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))===0?i=s[0]:(i=s[1],p2(this.g.mul(i).x.cmp(this.g.x.redMul(t))===0))}var o;return e.basis?o=e.basis.map(function(f){return{a:new pt(f.a,16),b:new pt(f.b,16)}}):o=this._getEndoBasis(i),{beta:t,lambda:i,basis:o}}},mr.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:pt.mont(e),i=new pt(2).toRed(t).redInvm(),n=i.redNeg(),s=new pt(3).toRed(t).redNeg().redSqrt().redMul(i),o=n.redAdd(s).fromRed(),f=n.redSub(s).fromRed();return[o,f]},mr.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),s=new pt(1),o=new pt(0),f=new pt(0),u=new pt(1),h,p,y,M,D,I,C,K=0,j,B;i.cmpn(0)!==0;){var k=n.div(i);j=n.sub(k.mul(i)),B=f.sub(k.mul(s));var T=u.sub(k.mul(o));if(!y&&j.cmp(t)<0)h=C.neg(),p=s,y=j.neg(),M=B;else if(y&&++K===2)break;C=j,n=i,i=j,f=s,s=B,u=o,o=T}D=j.neg(),I=B;var q=y.sqr().add(M.sqr()),$=D.sqr().add(I.sqr());return $.cmp(q)>=0&&(D=h,I=p),y.negative&&(y=y.neg(),M=M.neg()),D.negative&&(D=D.neg(),I=I.neg()),[{a:y,b:M},{a:D,b:I}]},mr.prototype._endoSplit=function(e){var t=this.endo.basis,i=t[0],n=t[1],s=n.b.mul(e).divRound(this.n),o=i.b.neg().mul(e).divRound(this.n),f=s.mul(i.a),u=o.mul(n.a),h=s.mul(i.b),p=o.mul(n.b),y=e.sub(f).sub(u),M=h.add(p).neg();return{k1:y,k2:M}},mr.prototype.pointFromX=function(e,t){e=new pt(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var s=n.fromRed().isOdd();return(t&&!s||!t&&s)&&(n=n.redNeg()),this.point(e,n)},mr.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,i=e.y,n=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(s).cmpn(0)===0},mr.prototype._endoWnafMulAdd=function(e,t,i){for(var n=this._endoWnafT1,s=this._endoWnafT2,o=0;o<e.length;o++){var f=this._endoSplit(t[o]),u=e[o],h=u._getBeta();f.k1.negative&&(f.k1.ineg(),u=u.neg(!0)),f.k2.negative&&(f.k2.ineg(),h=h.neg(!0)),n[o*2]=u,n[o*2+1]=h,s[o*2]=f.k1,s[o*2+1]=f.k2}for(var p=this._wnafMulAdd(1,n,s,o*2,i),y=0;y<o*2;y++)n[y]=null,s[y]=null;return p};function St(r,e,t,i){An.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new pt(e,16),this.y=new pt(t,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}zo(St,An.BasePoint),mr.prototype.point=function(e,t,i){return new St(this,e,t,i)},mr.prototype.pointFromJSON=function(e,t){return St.fromJSON(this,e,t)},St.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,n=function(s){return i.point(s.x.redMul(i.endo.beta),s.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},St.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},St.fromJSON=function(e,t,i){typeof t=="string"&&(t=JSON.parse(t));var n=e.point(t[0],t[1],i);if(!t[2])return n;function s(f){return e.point(f[0],f[1],i)}var o=t[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(s))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(s))}},n},St.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},St.prototype.isInfinity=function(){return this.inf},St.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var i=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)},St.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),s=i.redAdd(i).redIAdd(i).redIAdd(t).redMul(n),o=s.redSqr().redISub(this.x.redAdd(this.x)),f=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,f)},St.prototype.getX=function(){return this.x.fromRed()},St.prototype.getY=function(){return this.y.fromRed()},St.prototype.mul=function(e){return e=new pt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},St.prototype.mulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)},St.prototype.jmulAdd=function(e,t,i){var n=[this,t],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)},St.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},St.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(s){return s.neg()};t.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return t},St.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Tt(r,e,t,i){An.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new pt(0)):(this.x=new pt(e,16),this.y=new pt(t,16),this.z=new pt(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}zo(Tt,An.BasePoint),mr.prototype.jpoint=function(e,t,i){return new Tt(this,e,t,i)},Tt.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),i=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(i,n)},Tt.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Tt.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(t),s=e.x.redMul(i),o=this.y.redMul(t.redMul(e.z)),f=e.y.redMul(i.redMul(this.z)),u=n.redSub(s),h=o.redSub(f);if(u.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var p=u.redSqr(),y=p.redMul(u),M=n.redMul(p),D=h.redSqr().redIAdd(y).redISub(M).redISub(M),I=h.redMul(M.redISub(D)).redISub(o.redMul(y)),C=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(D,I,C)},Tt.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),i=this.x,n=e.x.redMul(t),s=this.y,o=e.y.redMul(t).redMul(this.z),f=i.redSub(n),u=s.redSub(o);if(f.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var h=f.redSqr(),p=h.redMul(f),y=i.redMul(h),M=u.redSqr().redIAdd(p).redISub(y).redISub(y),D=u.redMul(y.redISub(M)).redISub(s.redMul(p)),I=this.z.redMul(f);return this.curve.jpoint(M,D,I)},Tt.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var i=this;for(t=0;t<e;t++)i=i.dbl();return i}var n=this.curve.a,s=this.curve.tinv,o=this.x,f=this.y,u=this.z,h=u.redSqr().redSqr(),p=f.redAdd(f);for(t=0;t<e;t++){var y=o.redSqr(),M=p.redSqr(),D=M.redSqr(),I=y.redAdd(y).redIAdd(y).redIAdd(n.redMul(h)),C=o.redMul(M),K=I.redSqr().redISub(C.redAdd(C)),j=C.redISub(K),B=I.redMul(j);B=B.redIAdd(B).redISub(D);var k=p.redMul(u);t+1<e&&(h=h.redMul(D)),o=K,u=k,p=B}return this.curve.jpoint(o,p.redMul(s),u)},Tt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Tt.prototype._zeroDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),o=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(o);f=f.redIAdd(f);var u=n.redAdd(n).redIAdd(n),h=u.redSqr().redISub(f).redISub(f),p=o.redIAdd(o);p=p.redIAdd(p),p=p.redIAdd(p),e=h,t=u.redMul(f.redISub(h)).redISub(p),i=this.y.redAdd(this.y)}else{var y=this.x.redSqr(),M=this.y.redSqr(),D=M.redSqr(),I=this.x.redAdd(M).redSqr().redISub(y).redISub(D);I=I.redIAdd(I);var C=y.redAdd(y).redIAdd(y),K=C.redSqr(),j=D.redIAdd(D);j=j.redIAdd(j),j=j.redIAdd(j),e=K.redISub(I).redISub(I),t=C.redMul(I.redISub(e)).redISub(j),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,t,i)},Tt.prototype._threeDbl=function(){var e,t,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),o=s.redSqr(),f=this.x.redAdd(s).redSqr().redISub(n).redISub(o);f=f.redIAdd(f);var u=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),h=u.redSqr().redISub(f).redISub(f);e=h;var p=o.redIAdd(o);p=p.redIAdd(p),p=p.redIAdd(p),t=u.redMul(f.redISub(h)).redISub(p),i=this.y.redAdd(this.y)}else{var y=this.z.redSqr(),M=this.y.redSqr(),D=this.x.redMul(M),I=this.x.redSub(y).redMul(this.x.redAdd(y));I=I.redAdd(I).redIAdd(I);var C=D.redIAdd(D);C=C.redIAdd(C);var K=C.redAdd(C);e=I.redSqr().redISub(K),i=this.y.redAdd(this.z).redSqr().redISub(M).redISub(y);var j=M.redSqr();j=j.redIAdd(j),j=j.redIAdd(j),j=j.redIAdd(j),t=I.redMul(C.redISub(e)).redISub(j)}return this.curve.jpoint(e,t,i)},Tt.prototype._dbl=function(){var e=this.curve.a,t=this.x,i=this.y,n=this.z,s=n.redSqr().redSqr(),o=t.redSqr(),f=i.redSqr(),u=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(s)),h=t.redAdd(t);h=h.redIAdd(h);var p=h.redMul(f),y=u.redSqr().redISub(p.redAdd(p)),M=p.redISub(y),D=f.redSqr();D=D.redIAdd(D),D=D.redIAdd(D),D=D.redIAdd(D);var I=u.redMul(M).redISub(D),C=i.redAdd(i).redMul(n);return this.curve.jpoint(y,I,C)},Tt.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr(),n=t.redSqr(),s=e.redAdd(e).redIAdd(e),o=s.redSqr(),f=this.x.redAdd(t).redSqr().redISub(e).redISub(n);f=f.redIAdd(f),f=f.redAdd(f).redIAdd(f),f=f.redISub(o);var u=f.redSqr(),h=n.redIAdd(n);h=h.redIAdd(h),h=h.redIAdd(h),h=h.redIAdd(h);var p=s.redIAdd(f).redSqr().redISub(o).redISub(u).redISub(h),y=t.redMul(p);y=y.redIAdd(y),y=y.redIAdd(y);var M=this.x.redMul(u).redISub(y);M=M.redIAdd(M),M=M.redIAdd(M);var D=this.y.redMul(p.redMul(h.redISub(p)).redISub(f.redMul(u)));D=D.redIAdd(D),D=D.redIAdd(D),D=D.redIAdd(D);var I=this.z.redAdd(f).redSqr().redISub(i).redISub(u);return this.curve.jpoint(M,D,I)},Tt.prototype.mul=function(e,t){return e=new pt(e,t),this.curve._wnafMul(this,e)},Tt.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var n=t.redMul(this.z),s=i.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0},Tt.prototype.eqXToP=function(e){var t=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(s),this.x.cmp(i)===0)return!0}},Tt.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},Tt.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Sn=Vr.exports,cu=vn.exports,ha=ca,v2=hr;function Dn(r){ha.call(this,"mont",r),this.a=new Sn(r.a,16).toRed(this.red),this.b=new Sn(r.b,16).toRed(this.red),this.i4=new Sn(4).toRed(this.red).redInvm(),this.two=new Sn(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}cu(Dn,ha);var b2=Dn;Dn.prototype.validate=function(e){var t=e.normalize().x,i=t.redSqr(),n=i.redMul(t).redAdd(i.redMul(this.a)).redAdd(t),s=n.redSqrt();return s.redSqr().cmp(n)===0};function Dt(r,e,t){ha.BasePoint.call(this,r,"projective"),e===null&&t===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Sn(e,16),this.z=new Sn(t,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}cu(Dt,ha.BasePoint),Dn.prototype.decodePoint=function(e,t){return this.point(v2.toArray(e,t),1)},Dn.prototype.point=function(e,t){return new Dt(this,e,t)},Dn.prototype.pointFromJSON=function(e){return Dt.fromJSON(this,e)},Dt.prototype.precompute=function(){},Dt.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Dt.fromJSON=function(e,t){return new Dt(e,t[0],t[1]||e.one)},Dt.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Dt.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Dt.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),i=this.x.redSub(this.z),n=i.redSqr(),s=t.redSub(n),o=t.redMul(n),f=s.redMul(n.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,f)},Dt.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Dt.prototype.diffAdd=function(e,t){var i=this.x.redAdd(this.z),n=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),f=o.redMul(i),u=s.redMul(n),h=t.z.redMul(f.redAdd(u).redSqr()),p=t.x.redMul(f.redISub(u).redSqr());return this.curve.point(h,p)},Dt.prototype.mul=function(e){for(var t=e.clone(),i=this,n=this.curve.point(null,null),s=this,o=[];t.cmpn(0)!==0;t.iushrn(1))o.push(t.andln(1));for(var f=o.length-1;f>=0;f--)o[f]===0?(i=i.diffAdd(n,s),n=n.dbl()):(n=i.diffAdd(n,s),i=i.dbl());return n},Dt.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Dt.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Dt.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Dt.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Dt.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var m2=hr,ii=Vr.exports,hu=vn.exports,ua=ca,y2=m2.assert;function Hr(r){this.twisted=(r.a|0)!==1,this.mOneA=this.twisted&&(r.a|0)===-1,this.extended=this.mOneA,ua.call(this,"edwards",r),this.a=new ii(r.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new ii(r.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new ii(r.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),y2(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(r.c|0)===1}hu(Hr,ua);var w2=Hr;Hr.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},Hr.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},Hr.prototype.jpoint=function(e,t,i,n){return this.point(e,t,i,n)},Hr.prototype.pointFromX=function(e,t){e=new ii(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=this.c2.redSub(this.a.redMul(i)),s=this.one.redSub(this.c2.redMul(this.d).redMul(i)),o=n.redMul(s.redInvm()),f=o.redSqrt();if(f.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var u=f.fromRed().isOdd();return(t&&!u||!t&&u)&&(f=f.redNeg()),this.point(e,f)},Hr.prototype.pointFromY=function(e,t){e=new ii(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=i.redSub(this.c2),s=i.redMul(this.d).redMul(this.c2).redSub(this.a),o=n.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var f=o.redSqrt();if(f.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return f.fromRed().isOdd()!==t&&(f=f.redNeg()),this.point(f,e)},Hr.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),i=e.y.redSqr(),n=t.redMul(this.a).redAdd(i),s=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(i)));return n.cmp(s)===0};function ft(r,e,t,i,n){ua.BasePoint.call(this,r,"projective"),e===null&&t===null&&i===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new ii(e,16),this.y=new ii(t,16),this.z=i?new ii(i,16):this.curve.one,this.t=n&&new ii(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}hu(ft,ua.BasePoint),Hr.prototype.pointFromJSON=function(e){return ft.fromJSON(this,e)},Hr.prototype.point=function(e,t,i,n){return new ft(this,e,t,i,n)},ft.fromJSON=function(e,t){return new ft(e,t[0],t[1],t[2])},ft.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},ft.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},ft.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr();i=i.redIAdd(i);var n=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),f=o.redSub(i),u=n.redSub(t),h=s.redMul(f),p=o.redMul(u),y=s.redMul(u),M=f.redMul(o);return this.curve.point(h,p,M,y)},ft.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),t=this.x.redSqr(),i=this.y.redSqr(),n,s,o,f,u,h;if(this.curve.twisted){f=this.curve._mulA(t);var p=f.redAdd(i);this.zOne?(n=e.redSub(t).redSub(i).redMul(p.redSub(this.curve.two)),s=p.redMul(f.redSub(i)),o=p.redSqr().redSub(p).redSub(p)):(u=this.z.redSqr(),h=p.redSub(u).redISub(u),n=e.redSub(t).redISub(i).redMul(h),s=p.redMul(f.redSub(i)),o=p.redMul(h))}else f=t.redAdd(i),u=this.curve._mulC(this.z).redSqr(),h=f.redSub(u).redSub(u),n=this.curve._mulC(e.redISub(f)).redMul(h),s=this.curve._mulC(f).redMul(t.redISub(i)),o=f.redMul(h);return this.curve.point(n,s,o)},ft.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},ft.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),i=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=i.redSub(t),f=s.redSub(n),u=s.redAdd(n),h=i.redAdd(t),p=o.redMul(f),y=u.redMul(h),M=o.redMul(h),D=f.redMul(u);return this.curve.point(p,y,D,M)},ft.prototype._projAdd=function(e){var t=this.z.redMul(e.z),i=t.redSqr(),n=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(n).redMul(s),f=i.redSub(o),u=i.redAdd(o),h=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(n).redISub(s),p=t.redMul(f).redMul(h),y,M;return this.curve.twisted?(y=t.redMul(u).redMul(s.redSub(this.curve._mulA(n))),M=f.redMul(u)):(y=t.redMul(u).redMul(s.redSub(n)),M=this.curve._mulC(f).redMul(u)),this.curve.point(p,y,M)},ft.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},ft.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},ft.prototype.mulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!1)},ft.prototype.jmulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!0)},ft.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},ft.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},ft.prototype.getX=function(){return this.normalize(),this.x.fromRed()},ft.prototype.getY=function(){return this.normalize(),this.y.fromRed()},ft.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},ft.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var i=e.clone(),n=this.curve.redN.redMul(this.z);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),this.x.cmp(t)===0)return!0}},ft.prototype.toP=ft.prototype.normalize,ft.prototype.mixedAdd=ft.prototype.add,function(r){var e=r;e.base=ca,e.short=g2,e.mont=b2,e.edwards=w2}($o);var da={},Ko,uu;function _2(){return uu||(uu=1,Ko={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Ko}(function(r){var e=r,t=fr,i=$o,n=hr,s=n.assert;function o(h){h.type==="short"?this.curve=new i.short(h):h.type==="edwards"?this.curve=new i.edwards(h):this.curve=new i.mont(h),this.g=this.curve.g,this.n=this.curve.n,this.hash=h.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function f(h,p){Object.defineProperty(e,h,{configurable:!0,enumerable:!0,get:function(){var y=new o(p);return Object.defineProperty(e,h,{configurable:!0,enumerable:!0,value:y}),y}})}f("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:t.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),f("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:t.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),f("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:t.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),f("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:t.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),f("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:t.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),f("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:t.sha256,gRed:!1,g:["9"]}),f("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:t.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=_2()}catch{u=void 0}f("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:t.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})})(da);var E2=fr,ki=Fo,du=qi;function Mi(r){if(!(this instanceof Mi))return new Mi(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ki.toArray(r.entropy,r.entropyEnc||"hex"),t=ki.toArray(r.nonce,r.nonceEnc||"hex"),i=ki.toArray(r.pers,r.persEnc||"hex");du(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,i)}var x2=Mi;Mi.prototype._init=function(e,t,i){var n=e.concat(t).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},Mi.prototype._hmac=function(){return new E2.hmac(this.hash,this.K)},Mi.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},Mi.prototype.reseed=function(e,t,i,n){typeof t!="string"&&(n=i,i=t,t=null),e=ki.toArray(e,t),i=ki.toArray(i,n),du(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1},Mi.prototype.generate=function(e,t,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(n=i,i=t,t=null),i&&(i=ki.toArray(i,n||"hex"),this._update(i));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var o=s.slice(0,e);return this._update(i),this._reseed++,ki.encode(o,t)};var A2=Vr.exports,S2=hr,ko=S2.assert;function zt(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var D2=zt;zt.fromPublic=function(e,t,i){return t instanceof zt?t:new zt(e,{pub:t,pubEnc:i})},zt.fromPrivate=function(e,t,i){return t instanceof zt?t:new zt(e,{priv:t,privEnc:i})},zt.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},zt.prototype.getPublic=function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},zt.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},zt.prototype._importPrivate=function(e,t){this.priv=new A2(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},zt.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?ko(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&ko(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},zt.prototype.derive=function(e){return e.validate()||ko(e.validate(),"public point not validated"),e.mul(this.priv).getX()},zt.prototype.sign=function(e,t,i){return this.ec.sign(e,this,t,i)},zt.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},zt.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var la=Vr.exports,jo=hr,M2=jo.assert;function pa(r,e){if(r instanceof pa)return r;this._importDER(r,e)||(M2(r.r&&r.s,"Signature without r or s"),this.r=new la(r.r,16),this.s=new la(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var I2=pa;function R2(){this.place=0}function Vo(r,e){var t=r[e.place++];if(!(t&128))return t;var i=t&15;if(i===0||i>4||r[e.place]===0)return!1;for(var n=0,s=0,o=e.place;s<i;s++,o++)n<<=8,n|=r[o],n>>>=0;return n<=127?!1:(e.place=o,n)}function lu(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}pa.prototype._importDER=function(e,t){e=jo.toArray(e,t);var i=new R2;if(e[i.place++]!==48)return!1;var n=Vo(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var s=Vo(e,i);if(s===!1||e[i.place]&128)return!1;var o=e.slice(i.place,s+i.place);if(i.place+=s,e[i.place++]!==2)return!1;var f=Vo(e,i);if(f===!1||e.length!==f+i.place||e[i.place]&128)return!1;var u=e.slice(i.place,f+i.place);if(o[0]===0)if(o[1]&128)o=o.slice(1);else return!1;if(u[0]===0)if(u[1]&128)u=u.slice(1);else return!1;return this.r=new la(o),this.s=new la(u),this.recoveryParam=null,!0};function Ho(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}pa.prototype.toDER=function(e){var t=this.r.toArray(),i=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),i[0]&128&&(i=[0].concat(i)),t=lu(t),i=lu(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];Ho(n,t.length),n=n.concat(t),n.push(2),Ho(n,i.length);var s=n.concat(i),o=[48];return Ho(o,s.length),o=o.concat(s),jo.encode(o,e)};var ji=Vr.exports,pu=x2,O2=hr,Go=da,N2=aa.exports,gu=O2.assert,Yo=D2,ga=I2;function yr(r){if(!(this instanceof yr))return new yr(r);typeof r=="string"&&(gu(Object.prototype.hasOwnProperty.call(Go,r),"Unknown curve "+r),r=Go[r]),r instanceof Go.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}var C2=yr;yr.prototype.keyPair=function(e){return new Yo(this,e)},yr.prototype.keyFromPrivate=function(e,t){return Yo.fromPrivate(this,e,t)},yr.prototype.keyFromPublic=function(e,t){return Yo.fromPublic(this,e,t)},yr.prototype.genKeyPair=function(e){e||(e={});for(var t=new pu({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||N2(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new ji(2));;){var s=new ji(t.generate(i));if(!(s.cmp(n)>0))return s.iaddn(1),this.keyFromPrivate(s)}},yr.prototype._truncateToN=function(e,t){var i=e.byteLength()*8-this.n.bitLength();return i>0&&(e=e.ushrn(i)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},yr.prototype.sign=function(e,t,i,n){typeof i=="object"&&(n=i,i=null),n||(n={}),t=this.keyFromPrivate(t,i),e=this._truncateToN(new ji(e,16));for(var s=this.n.byteLength(),o=t.getPrivate().toArray("be",s),f=e.toArray("be",s),u=new pu({hash:this.hash,entropy:o,nonce:f,pers:n.pers,persEnc:n.persEnc||"utf8"}),h=this.n.sub(new ji(1)),p=0;;p++){var y=n.k?n.k(p):new ji(u.generate(this.n.byteLength()));if(y=this._truncateToN(y,!0),!(y.cmpn(1)<=0||y.cmp(h)>=0)){var M=this.g.mul(y);if(!M.isInfinity()){var D=M.getX(),I=D.umod(this.n);if(I.cmpn(0)!==0){var C=y.invm(this.n).mul(I.mul(t.getPrivate()).iadd(e));if(C=C.umod(this.n),C.cmpn(0)!==0){var K=(M.getY().isOdd()?1:0)|(D.cmp(I)!==0?2:0);return n.canonical&&C.cmp(this.nh)>0&&(C=this.n.sub(C),K^=1),new ga({r:I,s:C,recoveryParam:K})}}}}}},yr.prototype.verify=function(e,t,i,n){e=this._truncateToN(new ji(e,16)),i=this.keyFromPublic(i,n),t=new ga(t,"hex");var s=t.r,o=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var f=o.invm(this.n),u=f.mul(e).umod(this.n),h=f.mul(s).umod(this.n),p;return this.curve._maxwellTrick?(p=this.g.jmulAdd(u,i.getPublic(),h),p.isInfinity()?!1:p.eqXToP(s)):(p=this.g.mulAdd(u,i.getPublic(),h),p.isInfinity()?!1:p.getX().umod(this.n).cmp(s)===0)},yr.prototype.recoverPubKey=function(r,e,t,i){gu((3&t)===t,"The recovery param is more than two bits"),e=new ga(e,i);var n=this.n,s=new ji(r),o=e.r,f=e.s,u=t&1,h=t>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");h?o=this.curve.pointFromX(o.add(this.curve.n),u):o=this.curve.pointFromX(o,u);var p=e.r.invm(n),y=n.sub(s).mul(p).umod(n),M=f.mul(p).umod(n);return this.g.mulAdd(y,o,M)},yr.prototype.getKeyRecoveryParam=function(r,e,t,i){if(e=new ga(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(r,e,n)}catch{continue}if(s.eq(t))return n}throw new Error("Unable to find valid recovery factor")};var es=hr,vu=es.assert,bu=es.parseBytes,Mn=es.cachedProperty;function Mt(r,e){this.eddsa=r,this._secret=bu(e.secret),r.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=bu(e.pub)}Mt.fromPublic=function(e,t){return t instanceof Mt?t:new Mt(e,{pub:t})},Mt.fromSecret=function(e,t){return t instanceof Mt?t:new Mt(e,{secret:t})},Mt.prototype.secret=function(){return this._secret},Mn(Mt,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),Mn(Mt,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),Mn(Mt,"privBytes",function(){var e=this.eddsa,t=this.hash(),i=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[i]&=127,n[i]|=64,n}),Mn(Mt,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),Mn(Mt,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),Mn(Mt,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Mt.prototype.sign=function(e){return vu(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Mt.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},Mt.prototype.getSecret=function(e){return vu(this._secret,"KeyPair is public only"),es.encode(this.secret(),e)},Mt.prototype.getPublic=function(e){return es.encode(this.pubBytes(),e)};var P2=Mt,T2=Vr.exports,va=hr,mu=va.assert,ba=va.cachedProperty,B2=va.parseBytes;function Vi(r,e){this.eddsa=r,typeof e!="object"&&(e=B2(e)),Array.isArray(e)&&(mu(e.length===r.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,r.encodingLength),S:e.slice(r.encodingLength)}),mu(e.R&&e.S,"Signature without R or S"),r.isPoint(e.R)&&(this._R=e.R),e.S instanceof T2&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}ba(Vi,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),ba(Vi,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),ba(Vi,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),ba(Vi,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Vi.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Vi.prototype.toHex=function(){return va.encode(this.toBytes(),"hex").toUpperCase()};var L2=Vi,U2=fr,F2=da,In=hr,q2=In.assert,yu=In.parseBytes,wu=P2,_u=L2;function er(r){if(q2(r==="ed25519","only tested with ed25519 so far"),!(this instanceof er))return new er(r);r=F2[r].curve,this.curve=r,this.g=r.g,this.g.precompute(r.n.bitLength()+1),this.pointClass=r.point().constructor,this.encodingLength=Math.ceil(r.n.bitLength()/8),this.hash=U2.sha512}var $2=er;er.prototype.sign=function(e,t){e=yu(e);var i=this.keyFromSecret(t),n=this.hashInt(i.messagePrefix(),e),s=this.g.mul(n),o=this.encodePoint(s),f=this.hashInt(o,i.pubBytes(),e).mul(i.priv()),u=n.add(f).umod(this.curve.n);return this.makeSignature({R:s,S:u,Rencoded:o})},er.prototype.verify=function(e,t,i){if(e=yu(e),t=this.makeSignature(t),t.S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var n=this.keyFromPublic(i),s=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S()),f=t.R().add(n.pub().mul(s));return f.eq(o)},er.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return In.intFromLE(e.digest()).umod(this.curve.n)},er.prototype.keyFromPublic=function(e){return wu.fromPublic(this,e)},er.prototype.keyFromSecret=function(e){return wu.fromSecret(this,e)},er.prototype.makeSignature=function(e){return e instanceof _u?e:new _u(this,e)},er.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},er.prototype.decodePoint=function(e){e=In.parseBytes(e);var t=e.length-1,i=e.slice(0,t).concat(e[t]&-129),n=(e[t]&128)!==0,s=In.intFromLE(i);return this.curve.pointFromY(s,n)},er.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},er.prototype.decodeInt=function(e){return In.intFromLE(e)},er.prototype.isPoint=function(e){return e instanceof this.pointClass},function(r){var e=r;e.version=u2.version,e.utils=hr,e.rand=aa.exports,e.curve=$o,e.curves=da,e.ec=C2,e.eddsa=$2}(ou);const z2={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},K2=":";function ma(r){const[e,t]=r.split(K2);return{namespace:e,reference:t}}function Eu(r,e){return r.includes(":")?[r]:e.chains||[]}var k2=Object.defineProperty,xu=Object.getOwnPropertySymbols,j2=Object.prototype.hasOwnProperty,V2=Object.prototype.propertyIsEnumerable,Au=(r,e,t)=>e in r?k2(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Su=(r,e)=>{for(var t in e||(e={}))j2.call(e,t)&&Au(r,t,e[t]);if(xu)for(var t of xu(e))V2.call(e,t)&&Au(r,t,e[t]);return r};const H2="ReactNative",ur={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},G2="js";function ya(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Rn(){return!Kn()&&!!oo()&&navigator.product===H2}function ts(){return!ya()&&!!oo()&&!!Kn()}function rs(){return Rn()?ur.reactNative:ya()?ur.node:ts()?ur.browser:ur.unknown}function Y2(){var r;try{return Rn()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(r=global.Application)==null?void 0:r.applicationId:void 0}catch{return}}function W2(r,e){let t=kn.parse(r);return t=Su(Su({},t),e),r=kn.stringify(t),r}function Du(){return Gc()||{name:"",description:"",url:"",icons:[""]}}function J2(){if(rs()===ur.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:i,Version:n}=global.Platform;return[i,n].join("-")}const e=kg();if(e===null)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return e.type==="browser"?[t,e.name,e.version].join("-"):[t,e.version].join("-")}function Q2(){var r;const e=rs();return e===ur.browser?[e,((r=Hc())==null?void 0:r.host)||"unknown"].join(":"):e}function Mu(r,e,t){const i=J2(),n=Q2();return[[r,e].join("-"),[G2,t].join("-"),i,n].join("/")}function X2({protocol:r,version:e,relayUrl:t,sdkVersion:i,auth:n,projectId:s,useOnCloseEvent:o,bundleId:f}){const u=t.split("?"),h=Mu(r,e,i),p={auth:n,ua:h,projectId:s,useOnCloseEvent:o||void 0,origin:f||void 0},y=W2(u[1]||"",p);return u[0]+"?"+y}function Hi(r,e){return r.filter(i=>e.includes(i)).length===r.length}function Iu(r){return Object.fromEntries(r.entries())}function Ru(r){return new Map(Object.entries(r))}function Gi(r=ae.FIVE_MINUTES,e){const t=ae.toMiliseconds(r||ae.FIVE_MINUTES);let i,n,s;return{resolve:h=>{s&&i&&(clearTimeout(s),i(h))},reject:h=>{s&&n&&(clearTimeout(s),n(h))},done:()=>new Promise((h,p)=>{s=setTimeout(()=>{p(new Error(e))},t),i=h,n=p})}}function On(r,e,t){return new Promise(async(i,n)=>{const s=Math.floor(Math.random()*1e6);console.log("Creating expiring promise",s);const o=setTimeout(()=>{console.log("Expired",s),n(new Error(t))},e);try{const f=await r;console.log("Resolved",s),i(f)}catch(f){n(f)}clearTimeout(o)})}function Ou(r,e){if(typeof e=="string"&&e.startsWith(`${r}:`))return e;if(r.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(r.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${r}`)}function Z2(r){return Ou("topic",r)}function em(r){return Ou("id",r)}function Nu(r){const[e,t]=r.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function wt(r,e){return ae.fromMiliseconds((e||Date.now())+ae.toMiliseconds(r))}function Ii(r){return Date.now()>=ae.toMiliseconds(r)}function Je(r,e){return`${r}${e?`:${e}`:""}`}function tm(r=[],e=[]){return[...new Set([...r,...e])]}async function rm({id:r,topic:e,wcDeepLink:t}){var i;try{if(!t)return;const n=typeof t=="string"?JSON.parse(t):t,s=n?.href;if(typeof s!="string")return;const o=im(s,r,e),f=rs();if(f===ur.browser){if(!((i=Kn())!=null&&i.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,sm()?"_blank":"_self","noreferrer noopener")}else f===ur.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(n){console.error(n)}}function im(r,e,t){const i=`requestId=${e}&sessionTopic=${t}`;r.endsWith("/")&&(r=r.slice(0,-1));let n=`${r}`;if(r.startsWith("https://t.me")){const s=r.includes("?")?"&startapp=":"?startapp=";n=`${n}${s}${am(i,!0)}`}else n=`${n}/wc?${i}`;return n}async function nm(r,e){let t="";try{if(ts()&&(t=localStorage.getItem(e),t))return t;t=await r.getItem(e)}catch(i){console.error(i)}return t}function Cu(r,e){if(!r.includes(e))return null;const i=r.split(/([&,?,=])/),n=i.indexOf(e);return i[n+2]}function Pu(){return typeof crypto<"u"&&(crypto!=null&&crypto.randomUUID)?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,r=>{const e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function Wo(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function sm(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function am(r,e=!1){const t=Buffer.from(r).toString("base64");return e?t.replace(/[=]/g,""):t}function Tu(r){return Buffer.from(r,"base64").toString("utf-8")}const om="https://rpc.walletconnect.org/v1";async function fm(r,e,t,i,n,s){switch(t.t){case"eip191":return cm(r,e,t.s);case"eip1271":return await hm(r,e,t.s,i,n,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${t.t}`)}}function cm(r,e,t){return U3(xh(e),t).toLowerCase()===r.toLowerCase()}async function hm(r,e,t,i,n,s){const o=ma(i);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${i}`);try{const f="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",h="0000000000000000000000000000000000000000000000000000000000000041",p=t.substring(2),y=xh(e).substring(2),M=f+y+u+h+p,D=await fetch(`${s||om}/?chainId=${i}&projectId=${n}`,{method:"POST",body:JSON.stringify({id:um(),jsonrpc:"2.0",method:"eth_call",params:[{to:r,data:M},"latest"]})}),{result:I}=await D.json();return I?I.slice(0,f.length).toLowerCase()===f.toLowerCase():!1}catch(f){return console.error("isValidEip1271Signature: ",f),!1}}function um(){return Date.now()+Math.floor(Math.random()*1e3)}var dm=Object.defineProperty,lm=Object.defineProperties,pm=Object.getOwnPropertyDescriptors,Bu=Object.getOwnPropertySymbols,gm=Object.prototype.hasOwnProperty,vm=Object.prototype.propertyIsEnumerable,Lu=(r,e,t)=>e in r?dm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,bm=(r,e)=>{for(var t in e||(e={}))gm.call(e,t)&&Lu(r,t,e[t]);if(Bu)for(var t of Bu(e))vm.call(e,t)&&Lu(r,t,e[t]);return r},mm=(r,e)=>lm(r,pm(e));const ym="did:pkh:",Jo=r=>r?.split(":"),wm=r=>{const e=r&&Jo(r);if(e)return r.includes(ym)?e[3]:e[1]},Qo=r=>{const e=r&&Jo(r);if(e)return e[2]+":"+e[3]},wa=r=>{const e=r&&Jo(r);if(e)return e.pop()};async function Uu(r){const{cacao:e,projectId:t}=r,{s:i,p:n}=e,s=Fu(n,n.iss),o=wa(n.iss);return await fm(o,s,i,Qo(n.iss),t)}const Fu=(r,e)=>{const t=`${r.domain} wants you to sign in with your Ethereum account:`,i=wa(e);if(!r.aud&&!r.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let n=r.statement||void 0;const s=`URI: ${r.aud||r.uri}`,o=`Version: ${r.version}`,f=`Chain ID: ${wm(e)}`,u=`Nonce: ${r.nonce}`,h=`Issued At: ${r.iat}`,p=r.exp?`Expiration Time: ${r.exp}`:void 0,y=r.nbf?`Not Before: ${r.nbf}`:void 0,M=r.requestId?`Request ID: ${r.requestId}`:void 0,D=r.resources?`Resources:${r.resources.map(K=>`
23
- - ${K}`).join("")}`:void 0,I=_a(r.resources);if(I){const K=is(I);n=Rm(n,K)}return[t,i,"",n,"",s,o,f,u,h,p,y,M,D].filter(K=>K!=null).join(`
24
- `)};function _m(r){return Buffer.from(JSON.stringify(r)).toString("base64")}function Em(r){return JSON.parse(Buffer.from(r,"base64").toString("utf-8"))}function Yi(r){if(!r)throw new Error("No recap provided, value is undefined");if(!r.att)throw new Error("No `att` property found");const e=Object.keys(r.att);if(!e?.length)throw new Error("No resources found in `att` property");e.forEach(t=>{const i=r.att[t];if(Array.isArray(i))throw new Error(`Resource must be an object: ${t}`);if(typeof i!="object")throw new Error(`Resource must be an object: ${t}`);if(!Object.keys(i).length)throw new Error(`Resource object is empty: ${t}`);Object.keys(i).forEach(n=>{const s=i[n];if(!Array.isArray(s))throw new Error(`Ability limits ${n} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${n} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${n}) must be an array of objects, found: ${o}`)})})})}function xm(r,e,t,i={}){return t?.sort((n,s)=>n.localeCompare(s)),{att:{[r]:Am(e,t,i)}}}function Am(r,e,t={}){e=e?.sort((n,s)=>n.localeCompare(s));const i=e.map(n=>({[`${r}/${n}`]:[t]}));return Object.assign({},...i)}function qu(r){return Yi(r),`urn:recap:${_m(r).replace(/=/g,"")}`}function is(r){const e=Em(r.replace("urn:recap:",""));return Yi(e),e}function Sm(r,e,t){const i=xm(r,e,t);return qu(i)}function Dm(r){return r&&r.includes("urn:recap:")}function Mm(r,e){const t=is(r),i=is(e),n=Im(t,i);return qu(n)}function Im(r,e){Yi(r),Yi(e);const t=Object.keys(r.att).concat(Object.keys(e.att)).sort((n,s)=>n.localeCompare(s)),i={att:{}};return t.forEach(n=>{var s,o;Object.keys(((s=r.att)==null?void 0:s[n])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[n])||{})).sort((u,h)=>u.localeCompare(h)).forEach(u=>{var h,p;i.att[n]=mm(bm({},i.att[n]),{[u]:((h=r.att[n])==null?void 0:h[u])||((p=e.att[n])==null?void 0:p[u])})})}),i}function Rm(r="",e){Yi(e);const t="I further authorize the stated URI to perform the following actions on my behalf: ";if(r.includes(t))return r;const i=[];let n=0;Object.keys(e.att).forEach(f=>{const u=Object.keys(e.att[f]).map(y=>({ability:y.split("/")[0],action:y.split("/")[1]}));u.sort((y,M)=>y.action.localeCompare(M.action));const h={};u.forEach(y=>{h[y.ability]||(h[y.ability]=[]),h[y.ability].push(y.action)});const p=Object.keys(h).map(y=>(n++,`(${n}) '${y}': '${h[y].join("', '")}' for '${f}'.`));i.push(p.join(", ").replace(".,","."))});const s=i.join(" "),o=`${t}${s}`;return`${r?r+" ":""}${o}`}function $u(r){var e;const t=is(r);Yi(t);const i=(e=t.att)==null?void 0:e.eip155;return i?Object.keys(i).map(n=>n.split("/")[1]):[]}function zu(r){const e=is(r);Yi(e);const t=[];return Object.values(e.att).forEach(i=>{Object.values(i).forEach(n=>{var s;(s=n?.[0])!=null&&s.chains&&t.push(n[0].chains)})}),[...new Set(t.flat())]}function _a(r){if(!r)return;const e=r?.[r.length-1];return Dm(e)?e:void 0}const Ku="base10",Gt="base16",Ri="base64pad",ns="base64url",ss="utf8",ku=0,ni=1,as=2,Om=0,ju=1,os=12,Xo=32;function Nm(){const r=Uo.generateKeyPair();return{privateKey:Et(r.secretKey,Gt),publicKey:Et(r.publicKey,Gt)}}function Zo(){const r=wi.randomBytes(Xo);return Et(r,Gt)}function Cm(r,e){const t=Uo.sharedKey(xt(r,Gt),xt(e,Gt),!0),n=new J3(Xn.SHA256,t).expand(Xo);return Et(n,Gt)}function Ea(r){const e=Xn.hash(xt(r,Gt));return Et(e,Gt)}function si(r){const e=Xn.hash(xt(r,ss));return Et(e,Gt)}function Vu(r){return xt(`${r}`,Ku)}function Wi(r){return Number(Et(r,Ku))}function Pm(r){const e=Vu(typeof r.type<"u"?r.type:ku);if(Wi(e)===ni&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const t=typeof r.senderPublicKey<"u"?xt(r.senderPublicKey,Gt):void 0,i=typeof r.iv<"u"?xt(r.iv,Gt):wi.randomBytes(os),s=new To.ChaCha20Poly1305(xt(r.symKey,Gt)).seal(i,xt(r.message,ss));return Hu({type:e,sealed:s,iv:i,senderPublicKey:t,encoding:r.encoding})}function Tm(r,e){const t=Vu(as),i=wi.randomBytes(os),n=xt(r,ss);return Hu({type:t,sealed:n,iv:i,encoding:e})}function Bm(r){const e=new To.ChaCha20Poly1305(xt(r.symKey,Gt)),{sealed:t,iv:i}=fs({encoded:r.encoded,encoding:r?.encoding}),n=e.open(i,t);if(n===null)throw new Error("Failed to decrypt");return Et(n,ss)}function Lm(r,e){const{sealed:t}=fs({encoded:r,encoding:e});return Et(t,ss)}function Hu(r){const{encoding:e=Ri}=r;if(Wi(r.type)===as)return Et(ks([r.type,r.sealed]),e);if(Wi(r.type)===ni){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Et(ks([r.type,r.senderPublicKey,r.iv,r.sealed]),e)}return Et(ks([r.type,r.iv,r.sealed]),e)}function fs(r){const{encoded:e,encoding:t=Ri}=r,i=xt(e,t),n=i.slice(Om,ju),s=ju;if(Wi(n)===ni){const h=s+Xo,p=h+os,y=i.slice(s,h),M=i.slice(h,p),D=i.slice(p);return{type:n,sealed:D,iv:M,senderPublicKey:y}}if(Wi(n)===as){const h=i.slice(s),p=wi.randomBytes(os);return{type:n,sealed:h,iv:p}}const o=s+os,f=i.slice(s,o),u=i.slice(o);return{type:n,sealed:u,iv:f}}function Um(r,e){const t=fs({encoded:r,encoding:e?.encoding});return Gu({type:Wi(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?Et(t.senderPublicKey,Gt):void 0,receiverPublicKey:e?.receiverPublicKey})}function Gu(r){const e=r?.type||ku;if(e===ni){if(typeof r?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof r?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:r?.senderPublicKey,receiverPublicKey:r?.receiverPublicKey}}function Yu(r){return r.type===ni&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}function Wu(r){return r.type===as}function Fm(r){return new ou.ec("p256").keyFromPublic({x:Buffer.from(r.x,"base64").toString("hex"),y:Buffer.from(r.y,"base64").toString("hex")},"hex")}function qm(r){let e=r.replace(/-/g,"+").replace(/_/g,"/");const t=e.length%4;return t>0&&(e+="=".repeat(4-t)),e}function $m(r){return Buffer.from(qm(r),"base64")}function zm(r,e){const[t,i,n]=r.split("."),s=$m(n);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),f=s.slice(32,64).toString("hex"),u=`${t}.${i}`,p=new Xn.SHA256().update(Buffer.from(u)).digest(),y=Fm(e),M=Buffer.from(p).toString("hex");if(!y.verify(M,{r:o,s:f}))throw new Error("Invalid signature");return ao(r).payload}const Km="irn";function ef(r){return r?.relay||{protocol:Km}}function cs(r){const e=z2[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var km=Object.defineProperty,jm=Object.defineProperties,Vm=Object.getOwnPropertyDescriptors,Ju=Object.getOwnPropertySymbols,Hm=Object.prototype.hasOwnProperty,Gm=Object.prototype.propertyIsEnumerable,Qu=(r,e,t)=>e in r?km(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Xu=(r,e)=>{for(var t in e||(e={}))Hm.call(e,t)&&Qu(r,t,e[t]);if(Ju)for(var t of Ju(e))Gm.call(e,t)&&Qu(r,t,e[t]);return r},Ym=(r,e)=>jm(r,Vm(e));function Wm(r,e="-"){const t={},i="relay"+e;return Object.keys(r).forEach(n=>{if(n.startsWith(i)){const s=n.replace(i,""),o=r[n];t[s]=o}}),t}function Zu(r){if(!r.includes("wc:")){const p=Tu(r);p?.includes("wc:")&&(r=p)}r=r.includes("wc://")?r.replace("wc://",""):r,r=r.includes("wc:")?r.replace("wc:",""):r;const e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,i=r.substring(0,e),s=r.substring(e+1,t).split("@"),o=typeof t<"u"?r.substring(t):"",f=kn.parse(o),u=typeof f.methods=="string"?f.methods.split(","):void 0;return{protocol:i,topic:Jm(s[0]),version:parseInt(s[1],10),symKey:f.symKey,relay:Wm(f),methods:u,expiryTimestamp:f.expiryTimestamp?parseInt(f.expiryTimestamp,10):void 0}}function Jm(r){return r.startsWith("//")?r.substring(2):r}function Qm(r,e="-"){const t="relay",i={};return Object.keys(r).forEach(n=>{const s=t+e+n;r[n]&&(i[s]=r[n])}),i}function ed(r){return`${r.protocol}:${r.topic}@${r.version}?`+kn.stringify(Xu(Ym(Xu({symKey:r.symKey},Qm(r.relay)),{expiryTimestamp:r.expiryTimestamp}),r.methods?{methods:r.methods.join(",")}:{}))}function xa(r,e,t){return`${r}?wc_ev=${t}&topic=${e}`}function Nn(r){const e=[];return r.forEach(t=>{const[i,n]=t.split(":");e.push(`${i}:${n}`)}),e}function Xm(r){const e=[];return Object.values(r).forEach(t=>{e.push(...Nn(t.accounts))}),e}function Zm(r,e){const t=[];return Object.values(r).forEach(i=>{Nn(i.accounts).includes(e)&&t.push(...i.methods)}),t}function e6(r,e){const t=[];return Object.values(r).forEach(i=>{Nn(i.accounts).includes(e)&&t.push(...i.events)}),t}function t6(r){const e={};return r?.forEach(t=>{const[i,n]=t.split(":");e[i]||(e[i]={accounts:[],chains:[],events:[]}),e[i].accounts.push(t),e[i].chains.push(`${i}:${n}`)}),e}function td(r,e){e=e.map(i=>i.replace("did:pkh:",""));const t=t6(e);for(const[i,n]of Object.entries(t))n.methods?n.methods=tm(n.methods,r):n.methods=r,n.events=["chainChanged","accountsChanged"];return t}const r6={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},i6={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ne(r,e){const{message:t,code:i}=i6[r];return{message:e?`${t} ${e}`:t,code:i}}function ct(r,e){const{message:t,code:i}=r6[r];return{message:e?`${t} ${e}`:t,code:i}}function hs(r,e){return Array.isArray(r)?typeof e<"u"&&r.length?r.every(e):!0:!1}function Aa(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function Yt(r){return typeof r>"u"}function mt(r,e){return e&&Yt(r)?!0:typeof r=="string"&&!!r.trim().length}function tf(r,e){return e&&Yt(r)?!0:typeof r=="number"&&!isNaN(r)}function n6(r,e){const{requiredNamespaces:t}=e,i=Object.keys(r.namespaces),n=Object.keys(t);let s=!0;return Hi(n,i)?(i.forEach(o=>{const{accounts:f,methods:u,events:h}=r.namespaces[o],p=Nn(f),y=t[o];(!Hi(Eu(o,y),p)||!Hi(y.methods,u)||!Hi(y.events,h))&&(s=!1)}),s):!1}function Sa(r){return mt(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function s6(r){if(mt(r,!1)&&r.includes(":")){const e=r.split(":");if(e.length===3){const t=e[0]+":"+e[1];return!!e[2]&&Sa(t)}}return!1}function a6(r){function e(t){try{return typeof new URL(t)<"u"}catch{return!1}}try{if(mt(r,!1)){if(e(r))return!0;const i=Tu(r);return e(i)}}catch{}return!1}function o6(r){var e;return(e=r?.proposer)==null?void 0:e.publicKey}function f6(r){return r?.topic}function c6(r,e){let t=null;return mt(r?.publicKey,!1)||(t=ne("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function rd(r){let e=!0;return hs(r)?r.length&&(e=r.every(t=>mt(t,!1))):e=!1,e}function h6(r,e,t){let i=null;return hs(e)&&e.length?e.forEach(n=>{i||Sa(n)||(i=ct("UNSUPPORTED_CHAINS",`${t}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):Sa(r)||(i=ct("UNSUPPORTED_CHAINS",`${t}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}function u6(r,e,t){let i=null;return Object.entries(r).forEach(([n,s])=>{if(i)return;const o=h6(n,Eu(n,s),`${e} ${t}`);o&&(i=o)}),i}function d6(r,e){let t=null;return hs(r)?r.forEach(i=>{t||s6(i)||(t=ct("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):t=ct("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function l6(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const n=d6(i?.accounts,`${e} namespace`);n&&(t=n)}),t}function p6(r,e){let t=null;return rd(r?.methods)?rd(r?.events)||(t=ct("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=ct("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function id(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const n=p6(i,`${e}, namespace`);n&&(t=n)}),t}function g6(r,e,t){let i=null;if(r&&Aa(r)){const n=id(r,e);n&&(i=n);const s=u6(r,e,t);s&&(i=s)}else i=ne("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return i}function rf(r,e){let t=null;if(r&&Aa(r)){const i=id(r,e);i&&(t=i);const n=l6(r,e);n&&(t=n)}else t=ne("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function nd(r){return mt(r.protocol,!0)}function v6(r,e){let t=!1;return e&&!r?t=!0:r&&hs(r)&&r.length&&r.forEach(i=>{t=nd(i)}),t}function b6(r){return typeof r=="number"}function tr(r){return typeof r<"u"&&typeof r!==null}function m6(r){return!(!r||typeof r!="object"||!r.code||!tf(r.code,!1)||!r.message||!mt(r.message,!1))}function y6(r){return!(Yt(r)||!mt(r.method,!1))}function w6(r){return!(Yt(r)||Yt(r.result)&&Yt(r.error)||!tf(r.id,!1)||!mt(r.jsonrpc,!1))}function _6(r){return!(Yt(r)||!mt(r.name,!1))}function sd(r,e){return!(!Sa(e)||!Xm(r).includes(e))}function E6(r,e,t){return mt(t,!1)?Zm(r,e).includes(t):!1}function x6(r,e,t){return mt(t,!1)?e6(r,e).includes(t):!1}function ad(r,e,t){let i=null;const n=A6(r),s=S6(e),o=Object.keys(n),f=Object.keys(s),u=od(Object.keys(r)),h=od(Object.keys(e)),p=u.filter(y=>!h.includes(y));return p.length&&(i=ne("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces.
25
- Required: ${p.toString()}
26
- Received: ${Object.keys(e).toString()}`)),Hi(o,f)||(i=ne("NON_CONFORMING_NAMESPACES",`${t} namespaces chains don't satisfy required namespaces.
21
+ */(function(t){(function(){var e="input is invalid type",r="finalize already called",i=typeof window=="object",n=i?window:{};n.JS_SHA3_NO_WINDOW&&(i=!1);var s=!i&&typeof self=="object",o=!n.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?n=Bt:s&&(n=self);var h=!n.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,l=!n.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),w=[31,7936,2031616,520093696],M=[4,1024,262144,67108864],I=[1,256,65536,16777216],D=[6,1536,393216,100663296],N=[0,8,16,24],U=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],z=[224,256,384,512],H=[128,256],L=["hex","buffer","arrayBuffer","array","digest"],K={128:168,256:136};(n.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(E){return Object.prototype.toString.call(E)==="[object Array]"}),l&&(n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(E){return typeof E=="object"&&E.buffer&&E.buffer.constructor===ArrayBuffer});for(var F=function(E,k,C){return function(B){return new v(E,k,E).update(B)[C]()}},$=function(E,k,C){return function(B,P){return new v(E,k,P).update(B)[C]()}},q=function(E,k,C){return function(B,P,g,T){return a["cshake"+E].update(B,P,g,T)[C]()}},y=function(E,k,C){return function(B,P,g,T){return a["kmac"+E].update(B,P,g,T)[C]()}},R=function(E,k,C,B){for(var P=0;P<L.length;++P){var g=L[P];E[g]=k(C,B,g)}return E},V=function(E,k){var C=F(E,k,"hex");return C.create=function(){return new v(E,k,E)},C.update=function(B){return C.create().update(B)},R(C,F,E,k)},Q=function(E,k){var C=$(E,k,"hex");return C.create=function(B){return new v(E,k,B)},C.update=function(B,P){return C.create(P).update(B)},R(C,$,E,k)},O=function(E,k){var C=K[E],B=q(E,k,"hex");return B.create=function(P,g,T){return!g&&!T?a["shake"+E].create(P):new v(E,k,P).bytepad([g,T],C)},B.update=function(P,g,T,j){return B.create(g,T,j).update(P)},R(B,q,E,k)},d=function(E,k){var C=K[E],B=y(E,k,"hex");return B.create=function(P,g,T){return new S(E,k,g).bytepad(["KMAC",T],C).bytepad([P],C)},B.update=function(P,g,T,j){return B.create(P,T,j).update(g)},R(B,y,E,k)},u=[{name:"keccak",padding:I,bits:z,createMethod:V},{name:"sha3",padding:D,bits:z,createMethod:V},{name:"shake",padding:w,bits:H,createMethod:Q},{name:"cshake",padding:M,bits:H,createMethod:O},{name:"kmac",padding:M,bits:H,createMethod:d}],a={},f=[],b=0;b<u.length;++b)for(var x=u[b],A=x.bits,_=0;_<A.length;++_){var c=x.name+"_"+A[_];if(f.push(c),a[c]=x.createMethod(A[_],x.padding),x.name!=="sha3"){var m=x.name+A[_];f.push(m),a[m]=a[c]}}function v(E,k,C){this.blocks=[],this.s=[],this.padding=k,this.outputBits=C,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(E<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=C>>5,this.extraBytes=(C&31)>>3;for(var B=0;B<50;++B)this.s[B]=0}v.prototype.update=function(E){if(this.finalized)throw new Error(r);var k,C=typeof E;if(C!=="string"){if(C==="object"){if(E===null)throw new Error(e);if(l&&E.constructor===ArrayBuffer)E=new Uint8Array(E);else if(!Array.isArray(E)&&(!l||!ArrayBuffer.isView(E)))throw new Error(e)}else throw new Error(e);k=!0}for(var B=this.blocks,P=this.byteCount,g=E.length,T=this.blockCount,j=0,J=this.s,W,X;j<g;){if(this.reset)for(this.reset=!1,B[0]=this.block,W=1;W<T+1;++W)B[W]=0;if(k)for(W=this.start;j<g&&W<P;++j)B[W>>2]|=E[j]<<N[W++&3];else for(W=this.start;j<g&&W<P;++j)X=E.charCodeAt(j),X<128?B[W>>2]|=X<<N[W++&3]:X<2048?(B[W>>2]|=(192|X>>6)<<N[W++&3],B[W>>2]|=(128|X&63)<<N[W++&3]):X<55296||X>=57344?(B[W>>2]|=(224|X>>12)<<N[W++&3],B[W>>2]|=(128|X>>6&63)<<N[W++&3],B[W>>2]|=(128|X&63)<<N[W++&3]):(X=65536+((X&1023)<<10|E.charCodeAt(++j)&1023),B[W>>2]|=(240|X>>18)<<N[W++&3],B[W>>2]|=(128|X>>12&63)<<N[W++&3],B[W>>2]|=(128|X>>6&63)<<N[W++&3],B[W>>2]|=(128|X&63)<<N[W++&3]);if(this.lastByteIndex=W,W>=P){for(this.start=W-P,this.block=B[T],W=0;W<T;++W)J[W]^=B[W];G(J),this.reset=!0}else this.start=W}return this},v.prototype.encode=function(E,k){var C=E&255,B=1,P=[C];for(E=E>>8,C=E&255;C>0;)P.unshift(C),E=E>>8,C=E&255,++B;return k?P.push(B):P.unshift(B),this.update(P),P.length},v.prototype.encodeString=function(E){var k,C=typeof E;if(C!=="string"){if(C==="object"){if(E===null)throw new Error(e);if(l&&E.constructor===ArrayBuffer)E=new Uint8Array(E);else if(!Array.isArray(E)&&(!l||!ArrayBuffer.isView(E)))throw new Error(e)}else throw new Error(e);k=!0}var B=0,P=E.length;if(k)B=P;else for(var g=0;g<E.length;++g){var T=E.charCodeAt(g);T<128?B+=1:T<2048?B+=2:T<55296||T>=57344?B+=3:(T=65536+((T&1023)<<10|E.charCodeAt(++g)&1023),B+=4)}return B+=this.encode(B*8),this.update(E),B},v.prototype.bytepad=function(E,k){for(var C=this.encode(k),B=0;B<E.length;++B)C+=this.encodeString(E[B]);var P=k-C%k,g=[];return g.length=P,this.update(g),this},v.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var E=this.blocks,k=this.lastByteIndex,C=this.blockCount,B=this.s;if(E[k>>2]|=this.padding[k&3],this.lastByteIndex===this.byteCount)for(E[0]=E[C],k=1;k<C+1;++k)E[k]=0;for(E[C-1]|=2147483648,k=0;k<C;++k)B[k]^=E[k];G(B)}},v.prototype.toString=v.prototype.hex=function(){this.finalize();for(var E=this.blockCount,k=this.s,C=this.outputBlocks,B=this.extraBytes,P=0,g=0,T="",j;g<C;){for(P=0;P<E&&g<C;++P,++g)j=k[P],T+=p[j>>4&15]+p[j&15]+p[j>>12&15]+p[j>>8&15]+p[j>>20&15]+p[j>>16&15]+p[j>>28&15]+p[j>>24&15];g%E===0&&(G(k),P=0)}return B&&(j=k[P],T+=p[j>>4&15]+p[j&15],B>1&&(T+=p[j>>12&15]+p[j>>8&15]),B>2&&(T+=p[j>>20&15]+p[j>>16&15])),T},v.prototype.arrayBuffer=function(){this.finalize();var E=this.blockCount,k=this.s,C=this.outputBlocks,B=this.extraBytes,P=0,g=0,T=this.outputBits>>3,j;B?j=new ArrayBuffer(C+1<<2):j=new ArrayBuffer(T);for(var J=new Uint32Array(j);g<C;){for(P=0;P<E&&g<C;++P,++g)J[g]=k[P];g%E===0&&G(k)}return B&&(J[P]=k[P],j=j.slice(0,T)),j},v.prototype.buffer=v.prototype.arrayBuffer,v.prototype.digest=v.prototype.array=function(){this.finalize();for(var E=this.blockCount,k=this.s,C=this.outputBlocks,B=this.extraBytes,P=0,g=0,T=[],j,J;g<C;){for(P=0;P<E&&g<C;++P,++g)j=g<<2,J=k[P],T[j]=J&255,T[j+1]=J>>8&255,T[j+2]=J>>16&255,T[j+3]=J>>24&255;g%E===0&&G(k)}return B&&(j=g<<2,J=k[P],T[j]=J&255,B>1&&(T[j+1]=J>>8&255),B>2&&(T[j+2]=J>>16&255)),T};function S(E,k,C){v.call(this,E,k,C)}S.prototype=new v,S.prototype.finalize=function(){return this.encode(this.outputBits,!0),v.prototype.finalize.call(this)};var G=function(E){var k,C,B,P,g,T,j,J,W,X,ve,_e,ae,De,me,ie,de,he,te,fe,se,ee,le,ge,re,ye,we,ne,xe,Ae,Me,Ke,He,Ee,je,Ve,Ie,Re,Oe,ce,Ce,Pe,oe,Fe,Le,pe,Ue,$e,ue,Te,Ne,be,qe,We,Be,Qe,Ge,Je,lt,pt,bt,vt,ct;for(B=0;B<48;B+=2)P=E[0]^E[10]^E[20]^E[30]^E[40],g=E[1]^E[11]^E[21]^E[31]^E[41],T=E[2]^E[12]^E[22]^E[32]^E[42],j=E[3]^E[13]^E[23]^E[33]^E[43],J=E[4]^E[14]^E[24]^E[34]^E[44],W=E[5]^E[15]^E[25]^E[35]^E[45],X=E[6]^E[16]^E[26]^E[36]^E[46],ve=E[7]^E[17]^E[27]^E[37]^E[47],_e=E[8]^E[18]^E[28]^E[38]^E[48],ae=E[9]^E[19]^E[29]^E[39]^E[49],k=_e^(T<<1|j>>>31),C=ae^(j<<1|T>>>31),E[0]^=k,E[1]^=C,E[10]^=k,E[11]^=C,E[20]^=k,E[21]^=C,E[30]^=k,E[31]^=C,E[40]^=k,E[41]^=C,k=P^(J<<1|W>>>31),C=g^(W<<1|J>>>31),E[2]^=k,E[3]^=C,E[12]^=k,E[13]^=C,E[22]^=k,E[23]^=C,E[32]^=k,E[33]^=C,E[42]^=k,E[43]^=C,k=T^(X<<1|ve>>>31),C=j^(ve<<1|X>>>31),E[4]^=k,E[5]^=C,E[14]^=k,E[15]^=C,E[24]^=k,E[25]^=C,E[34]^=k,E[35]^=C,E[44]^=k,E[45]^=C,k=J^(_e<<1|ae>>>31),C=W^(ae<<1|_e>>>31),E[6]^=k,E[7]^=C,E[16]^=k,E[17]^=C,E[26]^=k,E[27]^=C,E[36]^=k,E[37]^=C,E[46]^=k,E[47]^=C,k=X^(P<<1|g>>>31),C=ve^(g<<1|P>>>31),E[8]^=k,E[9]^=C,E[18]^=k,E[19]^=C,E[28]^=k,E[29]^=C,E[38]^=k,E[39]^=C,E[48]^=k,E[49]^=C,De=E[0],me=E[1],pe=E[11]<<4|E[10]>>>28,Ue=E[10]<<4|E[11]>>>28,ne=E[20]<<3|E[21]>>>29,xe=E[21]<<3|E[20]>>>29,pt=E[31]<<9|E[30]>>>23,bt=E[30]<<9|E[31]>>>23,Pe=E[40]<<18|E[41]>>>14,oe=E[41]<<18|E[40]>>>14,Ee=E[2]<<1|E[3]>>>31,je=E[3]<<1|E[2]>>>31,ie=E[13]<<12|E[12]>>>20,de=E[12]<<12|E[13]>>>20,$e=E[22]<<10|E[23]>>>22,ue=E[23]<<10|E[22]>>>22,Ae=E[33]<<13|E[32]>>>19,Me=E[32]<<13|E[33]>>>19,vt=E[42]<<2|E[43]>>>30,ct=E[43]<<2|E[42]>>>30,We=E[5]<<30|E[4]>>>2,Be=E[4]<<30|E[5]>>>2,Ve=E[14]<<6|E[15]>>>26,Ie=E[15]<<6|E[14]>>>26,he=E[25]<<11|E[24]>>>21,te=E[24]<<11|E[25]>>>21,Te=E[34]<<15|E[35]>>>17,Ne=E[35]<<15|E[34]>>>17,Ke=E[45]<<29|E[44]>>>3,He=E[44]<<29|E[45]>>>3,ge=E[6]<<28|E[7]>>>4,re=E[7]<<28|E[6]>>>4,Qe=E[17]<<23|E[16]>>>9,Ge=E[16]<<23|E[17]>>>9,Re=E[26]<<25|E[27]>>>7,Oe=E[27]<<25|E[26]>>>7,fe=E[36]<<21|E[37]>>>11,se=E[37]<<21|E[36]>>>11,be=E[47]<<24|E[46]>>>8,qe=E[46]<<24|E[47]>>>8,Fe=E[8]<<27|E[9]>>>5,Le=E[9]<<27|E[8]>>>5,ye=E[18]<<20|E[19]>>>12,we=E[19]<<20|E[18]>>>12,Je=E[29]<<7|E[28]>>>25,lt=E[28]<<7|E[29]>>>25,ce=E[38]<<8|E[39]>>>24,Ce=E[39]<<8|E[38]>>>24,ee=E[48]<<14|E[49]>>>18,le=E[49]<<14|E[48]>>>18,E[0]=De^~ie&he,E[1]=me^~de&te,E[10]=ge^~ye&ne,E[11]=re^~we&xe,E[20]=Ee^~Ve&Re,E[21]=je^~Ie&Oe,E[30]=Fe^~pe&$e,E[31]=Le^~Ue&ue,E[40]=We^~Qe&Je,E[41]=Be^~Ge&lt,E[2]=ie^~he&fe,E[3]=de^~te&se,E[12]=ye^~ne&Ae,E[13]=we^~xe&Me,E[22]=Ve^~Re&ce,E[23]=Ie^~Oe&Ce,E[32]=pe^~$e&Te,E[33]=Ue^~ue&Ne,E[42]=Qe^~Je&pt,E[43]=Ge^~lt&bt,E[4]=he^~fe&ee,E[5]=te^~se&le,E[14]=ne^~Ae&Ke,E[15]=xe^~Me&He,E[24]=Re^~ce&Pe,E[25]=Oe^~Ce&oe,E[34]=$e^~Te&be,E[35]=ue^~Ne&qe,E[44]=Je^~pt&vt,E[45]=lt^~bt&ct,E[6]=fe^~ee&De,E[7]=se^~le&me,E[16]=Ae^~Ke&ge,E[17]=Me^~He&re,E[26]=ce^~Pe&Ee,E[27]=Ce^~oe&je,E[36]=Te^~be&Fe,E[37]=Ne^~qe&Le,E[46]=pt^~vt&We,E[47]=bt^~ct&Be,E[8]=ee^~De&ie,E[9]=le^~me&de,E[18]=Ke^~ge&ye,E[19]=He^~re&we,E[28]=Pe^~Ee&Ve,E[29]=oe^~je&Ie,E[38]=be^~Fe&pe,E[39]=qe^~Le&Ue,E[48]=vt^~We&Qe,E[49]=ct^~Be&Ge,E[0]^=U[B],E[1]^=U[B+1]};if(h)t.exports=a;else for(b=0;b<f.length;++b)n[f[b]]=a[f[b]]})()})(Yd);var C8=Yd.exports;const P8="logger/5.7.0";let Jd=!1,Wd=!1;const Zf={debug:1,default:2,info:2,warning:3,error:4,off:5};let Qd=Zf.default,Z0=null;function T8(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}const Xd=T8();var eh;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(eh||(eh={}));var yi;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(yi||(yi={}));const Zd="0123456789abcdef";class rt{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const i=e.toLowerCase();Zf[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Qd>Zf[i])&&console.log.apply(console,r)}debug(...e){this._log(rt.levels.DEBUG,e)}info(...e){this._log(rt.levels.INFO,e)}warn(...e){this._log(rt.levels.WARNING,e)}makeError(e,r,i){if(Wd)return this.makeError("censored error",r,{});r||(r=rt.errors.UNKNOWN_ERROR),i||(i={});const n=[];Object.keys(i).forEach(l=>{const p=i[l];try{if(p instanceof Uint8Array){let w="";for(let M=0;M<p.length;M++)w+=Zd[p[M]>>4],w+=Zd[p[M]&15];n.push(l+"=Uint8Array(0x"+w+")")}else n.push(l+"="+JSON.stringify(p))}catch{n.push(l+"="+JSON.stringify(i[l].toString()))}}),n.push(`code=${r}`),n.push(`version=${this.version}`);const s=e;let o="";switch(r){case yi.NUMERIC_FAULT:{o="NUMERIC_FAULT";const l=e;switch(l){case"overflow":case"underflow":case"division-by-zero":o+="-"+l;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case yi.CALL_EXCEPTION:case yi.INSUFFICIENT_FUNDS:case yi.MISSING_NEW:case yi.NONCE_EXPIRED:case yi.REPLACEMENT_UNDERPRICED:case yi.TRANSACTION_REPLACED:case yi.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const h=new Error(e);return h.reason=s,h.code=r,Object.keys(i).forEach(function(l){h[l]=i[l]}),h}throwError(e,r,i){throw this.makeError(e,r,i)}throwArgumentError(e,r,i){return this.throwError(e,rt.errors.INVALID_ARGUMENT,{argument:r,value:i})}assert(e,r,i,n){e||this.throwError(r,i,n)}assertArgument(e,r,i,n){e||this.throwArgumentError(r,i,n)}checkNormalize(e){Xd&&this.throwError("platform missing String.prototype.normalize",rt.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Xd})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,rt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,rt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,i){i?i=": "+i:i="",e<r&&this.throwError("missing argument"+i,rt.errors.MISSING_ARGUMENT,{count:e,expectedCount:r}),e>r&&this.throwError("too many arguments"+i,rt.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",rt.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",rt.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",rt.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return Z0||(Z0=new rt(P8)),Z0}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",rt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Jd){if(!e)return;this.globalLogger().throwError("error censorship permanent",rt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Wd=!!e,Jd=!!r}static setLogLevel(e){const r=Zf[e.toLowerCase()];if(r==null){rt.globalLogger().warn("invalid log level - "+e);return}Qd=r}static from(e){return new rt(e)}}rt.errors=yi,rt.levels=eh;const B8="bytes/5.7.0",Pt=new rt(B8);function el(t){return!!t.toHexString}function zs(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return zs(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function F8(t){return kr(t)&&!(t.length%2)||ks(t)}function tl(t){return typeof t=="number"&&t==t&&t%1===0}function ks(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!tl(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!tl(r)||r<0||r>=256)return!1}return!0}function It(t,e){if(e||(e={}),typeof t=="number"){Pt.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),zs(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),el(t)&&(t=t.toHexString()),kr(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":Pt.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let n=0;n<r.length;n+=2)i.push(parseInt(r.substring(n,n+2),16));return zs(new Uint8Array(i))}return ks(t)?zs(new Uint8Array(t)):Pt.throwArgumentError("invalid arrayify value","value",t)}function L8(t){const e=t.map(n=>It(n)),r=e.reduce((n,s)=>n+s.length,0),i=new Uint8Array(r);return e.reduce((n,s)=>(i.set(s,n),n+s.length),0),zs(i)}function U8(t,e){t=It(t),t.length>e&&Pt.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),zs(r)}function kr(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const th="0123456789abcdef";function Mr(t,e){if(e||(e={}),typeof t=="number"){Pt.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=th[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),el(t))return t.toHexString();if(kr(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":Pt.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(ks(t)){let r="0x";for(let i=0;i<t.length;i++){let n=t[i];r+=th[(n&240)>>4]+th[n&15]}return r}return Pt.throwArgumentError("invalid hexlify value","value",t)}function $8(t){if(typeof t!="string")t=Mr(t);else if(!kr(t)||t.length%2)return null;return(t.length-2)/2}function rl(t,e,r){return typeof t!="string"?t=Mr(t):(!kr(t)||t.length%2)&&Pt.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Pi(t,e){for(typeof t!="string"?t=Mr(t):kr(t)||Pt.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&Pt.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function il(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(F8(t)){let r=It(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Mr(r.slice(0,32)),e.s=Mr(r.slice(32,64))):r.length===65?(e.r=Mr(r.slice(0,32)),e.s=Mr(r.slice(32,64)),e.v=r[64]):Pt.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:Pt.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Mr(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const n=U8(It(e._vs),32);e._vs=Mr(n);const s=n[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&Pt.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),n[0]&=127;const o=Mr(n);e.s==null?e.s=o:e.s!==o&&Pt.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?Pt.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const n=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==n&&Pt.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!kr(e.r)?Pt.throwArgumentError("signature missing or invalid r","signature",t):e.r=Pi(e.r,32),e.s==null||!kr(e.s)?Pt.throwArgumentError("signature missing or invalid s","signature",t):e.s=Pi(e.s,32);const r=It(e.s);r[0]>=128&&Pt.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const i=Mr(r);e._vs&&(kr(e._vs)||Pt.throwArgumentError("signature invalid _vs","signature",t),e._vs=Pi(e._vs,32)),e._vs==null?e._vs=i:e._vs!==i&&Pt.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function rh(t){return"0x"+C8.keccak_256(It(t))}var nl={exports:{}};(function(t){(function(e,r){function i(u,a){if(!u)throw new Error(a||"Assertion failed")}function n(u,a){u.super_=a;var f=function(){};f.prototype=a.prototype,u.prototype=new f,u.prototype.constructor=u}function s(u,a,f){if(s.isBN(u))return u;this.negative=0,this.words=null,this.length=0,this.red=null,u!==null&&((a==="le"||a==="be")&&(f=a,a=10),this._init(u||0,a||10,f||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=Nn.Buffer}catch{}s.isBN=function(a){return a instanceof s?!0:a!==null&&typeof a=="object"&&a.constructor.wordSize===s.wordSize&&Array.isArray(a.words)},s.max=function(a,f){return a.cmp(f)>0?a:f},s.min=function(a,f){return a.cmp(f)<0?a:f},s.prototype._init=function(a,f,b){if(typeof a=="number")return this._initNumber(a,f,b);if(typeof a=="object")return this._initArray(a,f,b);f==="hex"&&(f=16),i(f===(f|0)&&f>=2&&f<=36),a=a.toString().replace(/\s+/g,"");var x=0;a[0]==="-"&&(x++,this.negative=1),x<a.length&&(f===16?this._parseHex(a,x,b):(this._parseBase(a,f,x),b==="le"&&this._initArray(this.toArray(),f,b)))},s.prototype._initNumber=function(a,f,b){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[a&67108863],this.length=1):a<4503599627370496?(this.words=[a&67108863,a/67108864&67108863],this.length=2):(i(a<9007199254740992),this.words=[a&67108863,a/67108864&67108863,1],this.length=3),b==="le"&&this._initArray(this.toArray(),f,b)},s.prototype._initArray=function(a,f,b){if(i(typeof a.length=="number"),a.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(a.length/3),this.words=new Array(this.length);for(var x=0;x<this.length;x++)this.words[x]=0;var A,_,c=0;if(b==="be")for(x=a.length-1,A=0;x>=0;x-=3)_=a[x]|a[x-1]<<8|a[x-2]<<16,this.words[A]|=_<<c&67108863,this.words[A+1]=_>>>26-c&67108863,c+=24,c>=26&&(c-=26,A++);else if(b==="le")for(x=0,A=0;x<a.length;x+=3)_=a[x]|a[x+1]<<8|a[x+2]<<16,this.words[A]|=_<<c&67108863,this.words[A+1]=_>>>26-c&67108863,c+=24,c>=26&&(c-=26,A++);return this._strip()};function h(u,a){var f=u.charCodeAt(a);if(f>=48&&f<=57)return f-48;if(f>=65&&f<=70)return f-55;if(f>=97&&f<=102)return f-87;i(!1,"Invalid character in "+u)}function l(u,a,f){var b=h(u,f);return f-1>=a&&(b|=h(u,f-1)<<4),b}s.prototype._parseHex=function(a,f,b){this.length=Math.ceil((a.length-f)/6),this.words=new Array(this.length);for(var x=0;x<this.length;x++)this.words[x]=0;var A=0,_=0,c;if(b==="be")for(x=a.length-1;x>=f;x-=2)c=l(a,f,x)<<A,this.words[_]|=c&67108863,A>=18?(A-=18,_+=1,this.words[_]|=c>>>26):A+=8;else{var m=a.length-f;for(x=m%2===0?f+1:f;x<a.length;x+=2)c=l(a,f,x)<<A,this.words[_]|=c&67108863,A>=18?(A-=18,_+=1,this.words[_]|=c>>>26):A+=8}this._strip()};function p(u,a,f,b){for(var x=0,A=0,_=Math.min(u.length,f),c=a;c<_;c++){var m=u.charCodeAt(c)-48;x*=b,m>=49?A=m-49+10:m>=17?A=m-17+10:A=m,i(m>=0&&A<b,"Invalid character"),x+=A}return x}s.prototype._parseBase=function(a,f,b){this.words=[0],this.length=1;for(var x=0,A=1;A<=67108863;A*=f)x++;x--,A=A/f|0;for(var _=a.length-b,c=_%x,m=Math.min(_,_-c)+b,v=0,S=b;S<m;S+=x)v=p(a,S,S+x,f),this.imuln(A),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v);if(c!==0){var G=1;for(v=p(a,S,a.length,f),S=0;S<c;S++)G*=f;this.imuln(G),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v)}this._strip()},s.prototype.copy=function(a){a.words=new Array(this.length);for(var f=0;f<this.length;f++)a.words[f]=this.words[f];a.length=this.length,a.negative=this.negative,a.red=this.red};function w(u,a){u.words=a.words,u.length=a.length,u.negative=a.negative,u.red=a.red}if(s.prototype._move=function(a){w(a,this)},s.prototype.clone=function(){var a=new s(null);return this.copy(a),a},s.prototype._expand=function(a){for(;this.length<a;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=M}catch{s.prototype.inspect=M}else s.prototype.inspect=M;function M(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var I=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],D=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],N=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(a,f){a=a||10,f=f|0||1;var b;if(a===16||a==="hex"){b="";for(var x=0,A=0,_=0;_<this.length;_++){var c=this.words[_],m=((c<<x|A)&16777215).toString(16);A=c>>>24-x&16777215,x+=2,x>=26&&(x-=26,_--),A!==0||_!==this.length-1?b=I[6-m.length]+m+b:b=m+b}for(A!==0&&(b=A.toString(16)+b);b.length%f!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}if(a===(a|0)&&a>=2&&a<=36){var v=D[a],S=N[a];b="";var G=this.clone();for(G.negative=0;!G.isZero();){var E=G.modrn(S).toString(a);G=G.idivn(S),G.isZero()?b=E+b:b=I[v-E.length]+E+b}for(this.isZero()&&(b="0"+b);b.length%f!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var a=this.words[0];return this.length===2?a+=this.words[1]*67108864:this.length===3&&this.words[2]===1?a+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-a:a},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(a,f){return this.toArrayLike(o,a,f)}),s.prototype.toArray=function(a,f){return this.toArrayLike(Array,a,f)};var U=function(a,f){return a.allocUnsafe?a.allocUnsafe(f):new a(f)};s.prototype.toArrayLike=function(a,f,b){this._strip();var x=this.byteLength(),A=b||Math.max(1,x);i(x<=A,"byte array longer than desired length"),i(A>0,"Requested array length <= 0");var _=U(a,A),c=f==="le"?"LE":"BE";return this["_toArrayLike"+c](_,x),_},s.prototype._toArrayLikeLE=function(a,f){for(var b=0,x=0,A=0,_=0;A<this.length;A++){var c=this.words[A]<<_|x;a[b++]=c&255,b<a.length&&(a[b++]=c>>8&255),b<a.length&&(a[b++]=c>>16&255),_===6?(b<a.length&&(a[b++]=c>>24&255),x=0,_=0):(x=c>>>24,_+=2)}if(b<a.length)for(a[b++]=x;b<a.length;)a[b++]=0},s.prototype._toArrayLikeBE=function(a,f){for(var b=a.length-1,x=0,A=0,_=0;A<this.length;A++){var c=this.words[A]<<_|x;a[b--]=c&255,b>=0&&(a[b--]=c>>8&255),b>=0&&(a[b--]=c>>16&255),_===6?(b>=0&&(a[b--]=c>>24&255),x=0,_=0):(x=c>>>24,_+=2)}if(b>=0)for(a[b--]=x;b>=0;)a[b--]=0},Math.clz32?s.prototype._countBits=function(a){return 32-Math.clz32(a)}:s.prototype._countBits=function(a){var f=a,b=0;return f>=4096&&(b+=13,f>>>=13),f>=64&&(b+=7,f>>>=7),f>=8&&(b+=4,f>>>=4),f>=2&&(b+=2,f>>>=2),b+f},s.prototype._zeroBits=function(a){if(a===0)return 26;var f=a,b=0;return f&8191||(b+=13,f>>>=13),f&127||(b+=7,f>>>=7),f&15||(b+=4,f>>>=4),f&3||(b+=2,f>>>=2),f&1||b++,b},s.prototype.bitLength=function(){var a=this.words[this.length-1],f=this._countBits(a);return(this.length-1)*26+f};function z(u){for(var a=new Array(u.bitLength()),f=0;f<a.length;f++){var b=f/26|0,x=f%26;a[f]=u.words[b]>>>x&1}return a}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var a=0,f=0;f<this.length;f++){var b=this._zeroBits(this.words[f]);if(a+=b,b!==26)break}return a},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(a){return this.negative!==0?this.abs().inotn(a).iaddn(1):this.clone()},s.prototype.fromTwos=function(a){return this.testn(a-1)?this.notn(a).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(a){for(;this.length<a.length;)this.words[this.length++]=0;for(var f=0;f<a.length;f++)this.words[f]=this.words[f]|a.words[f];return this._strip()},s.prototype.ior=function(a){return i((this.negative|a.negative)===0),this.iuor(a)},s.prototype.or=function(a){return this.length>a.length?this.clone().ior(a):a.clone().ior(this)},s.prototype.uor=function(a){return this.length>a.length?this.clone().iuor(a):a.clone().iuor(this)},s.prototype.iuand=function(a){var f;this.length>a.length?f=a:f=this;for(var b=0;b<f.length;b++)this.words[b]=this.words[b]&a.words[b];return this.length=f.length,this._strip()},s.prototype.iand=function(a){return i((this.negative|a.negative)===0),this.iuand(a)},s.prototype.and=function(a){return this.length>a.length?this.clone().iand(a):a.clone().iand(this)},s.prototype.uand=function(a){return this.length>a.length?this.clone().iuand(a):a.clone().iuand(this)},s.prototype.iuxor=function(a){var f,b;this.length>a.length?(f=this,b=a):(f=a,b=this);for(var x=0;x<b.length;x++)this.words[x]=f.words[x]^b.words[x];if(this!==f)for(;x<f.length;x++)this.words[x]=f.words[x];return this.length=f.length,this._strip()},s.prototype.ixor=function(a){return i((this.negative|a.negative)===0),this.iuxor(a)},s.prototype.xor=function(a){return this.length>a.length?this.clone().ixor(a):a.clone().ixor(this)},s.prototype.uxor=function(a){return this.length>a.length?this.clone().iuxor(a):a.clone().iuxor(this)},s.prototype.inotn=function(a){i(typeof a=="number"&&a>=0);var f=Math.ceil(a/26)|0,b=a%26;this._expand(f),b>0&&f--;for(var x=0;x<f;x++)this.words[x]=~this.words[x]&67108863;return b>0&&(this.words[x]=~this.words[x]&67108863>>26-b),this._strip()},s.prototype.notn=function(a){return this.clone().inotn(a)},s.prototype.setn=function(a,f){i(typeof a=="number"&&a>=0);var b=a/26|0,x=a%26;return this._expand(b+1),f?this.words[b]=this.words[b]|1<<x:this.words[b]=this.words[b]&~(1<<x),this._strip()},s.prototype.iadd=function(a){var f;if(this.negative!==0&&a.negative===0)return this.negative=0,f=this.isub(a),this.negative^=1,this._normSign();if(this.negative===0&&a.negative!==0)return a.negative=0,f=this.isub(a),a.negative=1,f._normSign();var b,x;this.length>a.length?(b=this,x=a):(b=a,x=this);for(var A=0,_=0;_<x.length;_++)f=(b.words[_]|0)+(x.words[_]|0)+A,this.words[_]=f&67108863,A=f>>>26;for(;A!==0&&_<b.length;_++)f=(b.words[_]|0)+A,this.words[_]=f&67108863,A=f>>>26;if(this.length=b.length,A!==0)this.words[this.length]=A,this.length++;else if(b!==this)for(;_<b.length;_++)this.words[_]=b.words[_];return this},s.prototype.add=function(a){var f;return a.negative!==0&&this.negative===0?(a.negative=0,f=this.sub(a),a.negative^=1,f):a.negative===0&&this.negative!==0?(this.negative=0,f=a.sub(this),this.negative=1,f):this.length>a.length?this.clone().iadd(a):a.clone().iadd(this)},s.prototype.isub=function(a){if(a.negative!==0){a.negative=0;var f=this.iadd(a);return a.negative=1,f._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(a),this.negative=1,this._normSign();var b=this.cmp(a);if(b===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,A;b>0?(x=this,A=a):(x=a,A=this);for(var _=0,c=0;c<A.length;c++)f=(x.words[c]|0)-(A.words[c]|0)+_,_=f>>26,this.words[c]=f&67108863;for(;_!==0&&c<x.length;c++)f=(x.words[c]|0)+_,_=f>>26,this.words[c]=f&67108863;if(_===0&&c<x.length&&x!==this)for(;c<x.length;c++)this.words[c]=x.words[c];return this.length=Math.max(this.length,c),x!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(a){return this.clone().isub(a)};function H(u,a,f){f.negative=a.negative^u.negative;var b=u.length+a.length|0;f.length=b,b=b-1|0;var x=u.words[0]|0,A=a.words[0]|0,_=x*A,c=_&67108863,m=_/67108864|0;f.words[0]=c;for(var v=1;v<b;v++){for(var S=m>>>26,G=m&67108863,E=Math.min(v,a.length-1),k=Math.max(0,v-u.length+1);k<=E;k++){var C=v-k|0;x=u.words[C]|0,A=a.words[k]|0,_=x*A+G,S+=_/67108864|0,G=_&67108863}f.words[v]=G|0,m=S|0}return m!==0?f.words[v]=m|0:f.length--,f._strip()}var L=function(a,f,b){var x=a.words,A=f.words,_=b.words,c=0,m,v,S,G=x[0]|0,E=G&8191,k=G>>>13,C=x[1]|0,B=C&8191,P=C>>>13,g=x[2]|0,T=g&8191,j=g>>>13,J=x[3]|0,W=J&8191,X=J>>>13,ve=x[4]|0,_e=ve&8191,ae=ve>>>13,De=x[5]|0,me=De&8191,ie=De>>>13,de=x[6]|0,he=de&8191,te=de>>>13,fe=x[7]|0,se=fe&8191,ee=fe>>>13,le=x[8]|0,ge=le&8191,re=le>>>13,ye=x[9]|0,we=ye&8191,ne=ye>>>13,xe=A[0]|0,Ae=xe&8191,Me=xe>>>13,Ke=A[1]|0,He=Ke&8191,Ee=Ke>>>13,je=A[2]|0,Ve=je&8191,Ie=je>>>13,Re=A[3]|0,Oe=Re&8191,ce=Re>>>13,Ce=A[4]|0,Pe=Ce&8191,oe=Ce>>>13,Fe=A[5]|0,Le=Fe&8191,pe=Fe>>>13,Ue=A[6]|0,$e=Ue&8191,ue=Ue>>>13,Te=A[7]|0,Ne=Te&8191,be=Te>>>13,qe=A[8]|0,We=qe&8191,Be=qe>>>13,Qe=A[9]|0,Ge=Qe&8191,Je=Qe>>>13;b.negative=a.negative^f.negative,b.length=19,m=Math.imul(E,Ae),v=Math.imul(E,Me),v=v+Math.imul(k,Ae)|0,S=Math.imul(k,Me);var lt=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(lt>>>26)|0,lt&=67108863,m=Math.imul(B,Ae),v=Math.imul(B,Me),v=v+Math.imul(P,Ae)|0,S=Math.imul(P,Me),m=m+Math.imul(E,He)|0,v=v+Math.imul(E,Ee)|0,v=v+Math.imul(k,He)|0,S=S+Math.imul(k,Ee)|0;var pt=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(pt>>>26)|0,pt&=67108863,m=Math.imul(T,Ae),v=Math.imul(T,Me),v=v+Math.imul(j,Ae)|0,S=Math.imul(j,Me),m=m+Math.imul(B,He)|0,v=v+Math.imul(B,Ee)|0,v=v+Math.imul(P,He)|0,S=S+Math.imul(P,Ee)|0,m=m+Math.imul(E,Ve)|0,v=v+Math.imul(E,Ie)|0,v=v+Math.imul(k,Ve)|0,S=S+Math.imul(k,Ie)|0;var bt=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(bt>>>26)|0,bt&=67108863,m=Math.imul(W,Ae),v=Math.imul(W,Me),v=v+Math.imul(X,Ae)|0,S=Math.imul(X,Me),m=m+Math.imul(T,He)|0,v=v+Math.imul(T,Ee)|0,v=v+Math.imul(j,He)|0,S=S+Math.imul(j,Ee)|0,m=m+Math.imul(B,Ve)|0,v=v+Math.imul(B,Ie)|0,v=v+Math.imul(P,Ve)|0,S=S+Math.imul(P,Ie)|0,m=m+Math.imul(E,Oe)|0,v=v+Math.imul(E,ce)|0,v=v+Math.imul(k,Oe)|0,S=S+Math.imul(k,ce)|0;var vt=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(vt>>>26)|0,vt&=67108863,m=Math.imul(_e,Ae),v=Math.imul(_e,Me),v=v+Math.imul(ae,Ae)|0,S=Math.imul(ae,Me),m=m+Math.imul(W,He)|0,v=v+Math.imul(W,Ee)|0,v=v+Math.imul(X,He)|0,S=S+Math.imul(X,Ee)|0,m=m+Math.imul(T,Ve)|0,v=v+Math.imul(T,Ie)|0,v=v+Math.imul(j,Ve)|0,S=S+Math.imul(j,Ie)|0,m=m+Math.imul(B,Oe)|0,v=v+Math.imul(B,ce)|0,v=v+Math.imul(P,Oe)|0,S=S+Math.imul(P,ce)|0,m=m+Math.imul(E,Pe)|0,v=v+Math.imul(E,oe)|0,v=v+Math.imul(k,Pe)|0,S=S+Math.imul(k,oe)|0;var ct=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(ct>>>26)|0,ct&=67108863,m=Math.imul(me,Ae),v=Math.imul(me,Me),v=v+Math.imul(ie,Ae)|0,S=Math.imul(ie,Me),m=m+Math.imul(_e,He)|0,v=v+Math.imul(_e,Ee)|0,v=v+Math.imul(ae,He)|0,S=S+Math.imul(ae,Ee)|0,m=m+Math.imul(W,Ve)|0,v=v+Math.imul(W,Ie)|0,v=v+Math.imul(X,Ve)|0,S=S+Math.imul(X,Ie)|0,m=m+Math.imul(T,Oe)|0,v=v+Math.imul(T,ce)|0,v=v+Math.imul(j,Oe)|0,S=S+Math.imul(j,ce)|0,m=m+Math.imul(B,Pe)|0,v=v+Math.imul(B,oe)|0,v=v+Math.imul(P,Pe)|0,S=S+Math.imul(P,oe)|0,m=m+Math.imul(E,Le)|0,v=v+Math.imul(E,pe)|0,v=v+Math.imul(k,Le)|0,S=S+Math.imul(k,pe)|0;var ar=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(ar>>>26)|0,ar&=67108863,m=Math.imul(he,Ae),v=Math.imul(he,Me),v=v+Math.imul(te,Ae)|0,S=Math.imul(te,Me),m=m+Math.imul(me,He)|0,v=v+Math.imul(me,Ee)|0,v=v+Math.imul(ie,He)|0,S=S+Math.imul(ie,Ee)|0,m=m+Math.imul(_e,Ve)|0,v=v+Math.imul(_e,Ie)|0,v=v+Math.imul(ae,Ve)|0,S=S+Math.imul(ae,Ie)|0,m=m+Math.imul(W,Oe)|0,v=v+Math.imul(W,ce)|0,v=v+Math.imul(X,Oe)|0,S=S+Math.imul(X,ce)|0,m=m+Math.imul(T,Pe)|0,v=v+Math.imul(T,oe)|0,v=v+Math.imul(j,Pe)|0,S=S+Math.imul(j,oe)|0,m=m+Math.imul(B,Le)|0,v=v+Math.imul(B,pe)|0,v=v+Math.imul(P,Le)|0,S=S+Math.imul(P,pe)|0,m=m+Math.imul(E,$e)|0,v=v+Math.imul(E,ue)|0,v=v+Math.imul(k,$e)|0,S=S+Math.imul(k,ue)|0;var fr=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(fr>>>26)|0,fr&=67108863,m=Math.imul(se,Ae),v=Math.imul(se,Me),v=v+Math.imul(ee,Ae)|0,S=Math.imul(ee,Me),m=m+Math.imul(he,He)|0,v=v+Math.imul(he,Ee)|0,v=v+Math.imul(te,He)|0,S=S+Math.imul(te,Ee)|0,m=m+Math.imul(me,Ve)|0,v=v+Math.imul(me,Ie)|0,v=v+Math.imul(ie,Ve)|0,S=S+Math.imul(ie,Ie)|0,m=m+Math.imul(_e,Oe)|0,v=v+Math.imul(_e,ce)|0,v=v+Math.imul(ae,Oe)|0,S=S+Math.imul(ae,ce)|0,m=m+Math.imul(W,Pe)|0,v=v+Math.imul(W,oe)|0,v=v+Math.imul(X,Pe)|0,S=S+Math.imul(X,oe)|0,m=m+Math.imul(T,Le)|0,v=v+Math.imul(T,pe)|0,v=v+Math.imul(j,Le)|0,S=S+Math.imul(j,pe)|0,m=m+Math.imul(B,$e)|0,v=v+Math.imul(B,ue)|0,v=v+Math.imul(P,$e)|0,S=S+Math.imul(P,ue)|0,m=m+Math.imul(E,Ne)|0,v=v+Math.imul(E,be)|0,v=v+Math.imul(k,Ne)|0,S=S+Math.imul(k,be)|0;var or=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(or>>>26)|0,or&=67108863,m=Math.imul(ge,Ae),v=Math.imul(ge,Me),v=v+Math.imul(re,Ae)|0,S=Math.imul(re,Me),m=m+Math.imul(se,He)|0,v=v+Math.imul(se,Ee)|0,v=v+Math.imul(ee,He)|0,S=S+Math.imul(ee,Ee)|0,m=m+Math.imul(he,Ve)|0,v=v+Math.imul(he,Ie)|0,v=v+Math.imul(te,Ve)|0,S=S+Math.imul(te,Ie)|0,m=m+Math.imul(me,Oe)|0,v=v+Math.imul(me,ce)|0,v=v+Math.imul(ie,Oe)|0,S=S+Math.imul(ie,ce)|0,m=m+Math.imul(_e,Pe)|0,v=v+Math.imul(_e,oe)|0,v=v+Math.imul(ae,Pe)|0,S=S+Math.imul(ae,oe)|0,m=m+Math.imul(W,Le)|0,v=v+Math.imul(W,pe)|0,v=v+Math.imul(X,Le)|0,S=S+Math.imul(X,pe)|0,m=m+Math.imul(T,$e)|0,v=v+Math.imul(T,ue)|0,v=v+Math.imul(j,$e)|0,S=S+Math.imul(j,ue)|0,m=m+Math.imul(B,Ne)|0,v=v+Math.imul(B,be)|0,v=v+Math.imul(P,Ne)|0,S=S+Math.imul(P,be)|0,m=m+Math.imul(E,We)|0,v=v+Math.imul(E,Be)|0,v=v+Math.imul(k,We)|0,S=S+Math.imul(k,Be)|0;var hr=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(hr>>>26)|0,hr&=67108863,m=Math.imul(we,Ae),v=Math.imul(we,Me),v=v+Math.imul(ne,Ae)|0,S=Math.imul(ne,Me),m=m+Math.imul(ge,He)|0,v=v+Math.imul(ge,Ee)|0,v=v+Math.imul(re,He)|0,S=S+Math.imul(re,Ee)|0,m=m+Math.imul(se,Ve)|0,v=v+Math.imul(se,Ie)|0,v=v+Math.imul(ee,Ve)|0,S=S+Math.imul(ee,Ie)|0,m=m+Math.imul(he,Oe)|0,v=v+Math.imul(he,ce)|0,v=v+Math.imul(te,Oe)|0,S=S+Math.imul(te,ce)|0,m=m+Math.imul(me,Pe)|0,v=v+Math.imul(me,oe)|0,v=v+Math.imul(ie,Pe)|0,S=S+Math.imul(ie,oe)|0,m=m+Math.imul(_e,Le)|0,v=v+Math.imul(_e,pe)|0,v=v+Math.imul(ae,Le)|0,S=S+Math.imul(ae,pe)|0,m=m+Math.imul(W,$e)|0,v=v+Math.imul(W,ue)|0,v=v+Math.imul(X,$e)|0,S=S+Math.imul(X,ue)|0,m=m+Math.imul(T,Ne)|0,v=v+Math.imul(T,be)|0,v=v+Math.imul(j,Ne)|0,S=S+Math.imul(j,be)|0,m=m+Math.imul(B,We)|0,v=v+Math.imul(B,Be)|0,v=v+Math.imul(P,We)|0,S=S+Math.imul(P,Be)|0,m=m+Math.imul(E,Ge)|0,v=v+Math.imul(E,Je)|0,v=v+Math.imul(k,Ge)|0,S=S+Math.imul(k,Je)|0;var cr=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(cr>>>26)|0,cr&=67108863,m=Math.imul(we,He),v=Math.imul(we,Ee),v=v+Math.imul(ne,He)|0,S=Math.imul(ne,Ee),m=m+Math.imul(ge,Ve)|0,v=v+Math.imul(ge,Ie)|0,v=v+Math.imul(re,Ve)|0,S=S+Math.imul(re,Ie)|0,m=m+Math.imul(se,Oe)|0,v=v+Math.imul(se,ce)|0,v=v+Math.imul(ee,Oe)|0,S=S+Math.imul(ee,ce)|0,m=m+Math.imul(he,Pe)|0,v=v+Math.imul(he,oe)|0,v=v+Math.imul(te,Pe)|0,S=S+Math.imul(te,oe)|0,m=m+Math.imul(me,Le)|0,v=v+Math.imul(me,pe)|0,v=v+Math.imul(ie,Le)|0,S=S+Math.imul(ie,pe)|0,m=m+Math.imul(_e,$e)|0,v=v+Math.imul(_e,ue)|0,v=v+Math.imul(ae,$e)|0,S=S+Math.imul(ae,ue)|0,m=m+Math.imul(W,Ne)|0,v=v+Math.imul(W,be)|0,v=v+Math.imul(X,Ne)|0,S=S+Math.imul(X,be)|0,m=m+Math.imul(T,We)|0,v=v+Math.imul(T,Be)|0,v=v+Math.imul(j,We)|0,S=S+Math.imul(j,Be)|0,m=m+Math.imul(B,Ge)|0,v=v+Math.imul(B,Je)|0,v=v+Math.imul(P,Ge)|0,S=S+Math.imul(P,Je)|0;var Ft=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,m=Math.imul(we,Ve),v=Math.imul(we,Ie),v=v+Math.imul(ne,Ve)|0,S=Math.imul(ne,Ie),m=m+Math.imul(ge,Oe)|0,v=v+Math.imul(ge,ce)|0,v=v+Math.imul(re,Oe)|0,S=S+Math.imul(re,ce)|0,m=m+Math.imul(se,Pe)|0,v=v+Math.imul(se,oe)|0,v=v+Math.imul(ee,Pe)|0,S=S+Math.imul(ee,oe)|0,m=m+Math.imul(he,Le)|0,v=v+Math.imul(he,pe)|0,v=v+Math.imul(te,Le)|0,S=S+Math.imul(te,pe)|0,m=m+Math.imul(me,$e)|0,v=v+Math.imul(me,ue)|0,v=v+Math.imul(ie,$e)|0,S=S+Math.imul(ie,ue)|0,m=m+Math.imul(_e,Ne)|0,v=v+Math.imul(_e,be)|0,v=v+Math.imul(ae,Ne)|0,S=S+Math.imul(ae,be)|0,m=m+Math.imul(W,We)|0,v=v+Math.imul(W,Be)|0,v=v+Math.imul(X,We)|0,S=S+Math.imul(X,Be)|0,m=m+Math.imul(T,Ge)|0,v=v+Math.imul(T,Je)|0,v=v+Math.imul(j,Ge)|0,S=S+Math.imul(j,Je)|0;var ur=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(ur>>>26)|0,ur&=67108863,m=Math.imul(we,Oe),v=Math.imul(we,ce),v=v+Math.imul(ne,Oe)|0,S=Math.imul(ne,ce),m=m+Math.imul(ge,Pe)|0,v=v+Math.imul(ge,oe)|0,v=v+Math.imul(re,Pe)|0,S=S+Math.imul(re,oe)|0,m=m+Math.imul(se,Le)|0,v=v+Math.imul(se,pe)|0,v=v+Math.imul(ee,Le)|0,S=S+Math.imul(ee,pe)|0,m=m+Math.imul(he,$e)|0,v=v+Math.imul(he,ue)|0,v=v+Math.imul(te,$e)|0,S=S+Math.imul(te,ue)|0,m=m+Math.imul(me,Ne)|0,v=v+Math.imul(me,be)|0,v=v+Math.imul(ie,Ne)|0,S=S+Math.imul(ie,be)|0,m=m+Math.imul(_e,We)|0,v=v+Math.imul(_e,Be)|0,v=v+Math.imul(ae,We)|0,S=S+Math.imul(ae,Be)|0,m=m+Math.imul(W,Ge)|0,v=v+Math.imul(W,Je)|0,v=v+Math.imul(X,Ge)|0,S=S+Math.imul(X,Je)|0;var dr=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(dr>>>26)|0,dr&=67108863,m=Math.imul(we,Pe),v=Math.imul(we,oe),v=v+Math.imul(ne,Pe)|0,S=Math.imul(ne,oe),m=m+Math.imul(ge,Le)|0,v=v+Math.imul(ge,pe)|0,v=v+Math.imul(re,Le)|0,S=S+Math.imul(re,pe)|0,m=m+Math.imul(se,$e)|0,v=v+Math.imul(se,ue)|0,v=v+Math.imul(ee,$e)|0,S=S+Math.imul(ee,ue)|0,m=m+Math.imul(he,Ne)|0,v=v+Math.imul(he,be)|0,v=v+Math.imul(te,Ne)|0,S=S+Math.imul(te,be)|0,m=m+Math.imul(me,We)|0,v=v+Math.imul(me,Be)|0,v=v+Math.imul(ie,We)|0,S=S+Math.imul(ie,Be)|0,m=m+Math.imul(_e,Ge)|0,v=v+Math.imul(_e,Je)|0,v=v+Math.imul(ae,Ge)|0,S=S+Math.imul(ae,Je)|0;var St=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(St>>>26)|0,St&=67108863,m=Math.imul(we,Le),v=Math.imul(we,pe),v=v+Math.imul(ne,Le)|0,S=Math.imul(ne,pe),m=m+Math.imul(ge,$e)|0,v=v+Math.imul(ge,ue)|0,v=v+Math.imul(re,$e)|0,S=S+Math.imul(re,ue)|0,m=m+Math.imul(se,Ne)|0,v=v+Math.imul(se,be)|0,v=v+Math.imul(ee,Ne)|0,S=S+Math.imul(ee,be)|0,m=m+Math.imul(he,We)|0,v=v+Math.imul(he,Be)|0,v=v+Math.imul(te,We)|0,S=S+Math.imul(te,Be)|0,m=m+Math.imul(me,Ge)|0,v=v+Math.imul(me,Je)|0,v=v+Math.imul(ie,Ge)|0,S=S+Math.imul(ie,Je)|0;var lr=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(lr>>>26)|0,lr&=67108863,m=Math.imul(we,$e),v=Math.imul(we,ue),v=v+Math.imul(ne,$e)|0,S=Math.imul(ne,ue),m=m+Math.imul(ge,Ne)|0,v=v+Math.imul(ge,be)|0,v=v+Math.imul(re,Ne)|0,S=S+Math.imul(re,be)|0,m=m+Math.imul(se,We)|0,v=v+Math.imul(se,Be)|0,v=v+Math.imul(ee,We)|0,S=S+Math.imul(ee,Be)|0,m=m+Math.imul(he,Ge)|0,v=v+Math.imul(he,Je)|0,v=v+Math.imul(te,Ge)|0,S=S+Math.imul(te,Je)|0;var pr=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(pr>>>26)|0,pr&=67108863,m=Math.imul(we,Ne),v=Math.imul(we,be),v=v+Math.imul(ne,Ne)|0,S=Math.imul(ne,be),m=m+Math.imul(ge,We)|0,v=v+Math.imul(ge,Be)|0,v=v+Math.imul(re,We)|0,S=S+Math.imul(re,Be)|0,m=m+Math.imul(se,Ge)|0,v=v+Math.imul(se,Je)|0,v=v+Math.imul(ee,Ge)|0,S=S+Math.imul(ee,Je)|0;var br=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(br>>>26)|0,br&=67108863,m=Math.imul(we,We),v=Math.imul(we,Be),v=v+Math.imul(ne,We)|0,S=Math.imul(ne,Be),m=m+Math.imul(ge,Ge)|0,v=v+Math.imul(ge,Je)|0,v=v+Math.imul(re,Ge)|0,S=S+Math.imul(re,Je)|0;var En=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(En>>>26)|0,En&=67108863,m=Math.imul(we,Ge),v=Math.imul(we,Je),v=v+Math.imul(ne,Ge)|0,S=Math.imul(ne,Je);var Sn=(c+m|0)+((v&8191)<<13)|0;return c=(S+(v>>>13)|0)+(Sn>>>26)|0,Sn&=67108863,_[0]=lt,_[1]=pt,_[2]=bt,_[3]=vt,_[4]=ct,_[5]=ar,_[6]=fr,_[7]=or,_[8]=hr,_[9]=cr,_[10]=Ft,_[11]=ur,_[12]=dr,_[13]=St,_[14]=lr,_[15]=pr,_[16]=br,_[17]=En,_[18]=Sn,c!==0&&(_[19]=c,b.length++),b};Math.imul||(L=H);function K(u,a,f){f.negative=a.negative^u.negative,f.length=u.length+a.length;for(var b=0,x=0,A=0;A<f.length-1;A++){var _=x;x=0;for(var c=b&67108863,m=Math.min(A,a.length-1),v=Math.max(0,A-u.length+1);v<=m;v++){var S=A-v,G=u.words[S]|0,E=a.words[v]|0,k=G*E,C=k&67108863;_=_+(k/67108864|0)|0,C=C+c|0,c=C&67108863,_=_+(C>>>26)|0,x+=_>>>26,_&=67108863}f.words[A]=c,b=_,_=x}return b!==0?f.words[A]=b:f.length--,f._strip()}function F(u,a,f){return K(u,a,f)}s.prototype.mulTo=function(a,f){var b,x=this.length+a.length;return this.length===10&&a.length===10?b=L(this,a,f):x<63?b=H(this,a,f):x<1024?b=K(this,a,f):b=F(this,a,f),b},s.prototype.mul=function(a){var f=new s(null);return f.words=new Array(this.length+a.length),this.mulTo(a,f)},s.prototype.mulf=function(a){var f=new s(null);return f.words=new Array(this.length+a.length),F(this,a,f)},s.prototype.imul=function(a){return this.clone().mulTo(a,this)},s.prototype.imuln=function(a){var f=a<0;f&&(a=-a),i(typeof a=="number"),i(a<67108864);for(var b=0,x=0;x<this.length;x++){var A=(this.words[x]|0)*a,_=(A&67108863)+(b&67108863);b>>=26,b+=A/67108864|0,b+=_>>>26,this.words[x]=_&67108863}return b!==0&&(this.words[x]=b,this.length++),f?this.ineg():this},s.prototype.muln=function(a){return this.clone().imuln(a)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(a){var f=z(a);if(f.length===0)return new s(1);for(var b=this,x=0;x<f.length&&f[x]===0;x++,b=b.sqr());if(++x<f.length)for(var A=b.sqr();x<f.length;x++,A=A.sqr())f[x]!==0&&(b=b.mul(A));return b},s.prototype.iushln=function(a){i(typeof a=="number"&&a>=0);var f=a%26,b=(a-f)/26,x=67108863>>>26-f<<26-f,A;if(f!==0){var _=0;for(A=0;A<this.length;A++){var c=this.words[A]&x,m=(this.words[A]|0)-c<<f;this.words[A]=m|_,_=c>>>26-f}_&&(this.words[A]=_,this.length++)}if(b!==0){for(A=this.length-1;A>=0;A--)this.words[A+b]=this.words[A];for(A=0;A<b;A++)this.words[A]=0;this.length+=b}return this._strip()},s.prototype.ishln=function(a){return i(this.negative===0),this.iushln(a)},s.prototype.iushrn=function(a,f,b){i(typeof a=="number"&&a>=0);var x;f?x=(f-f%26)/26:x=0;var A=a%26,_=Math.min((a-A)/26,this.length),c=67108863^67108863>>>A<<A,m=b;if(x-=_,x=Math.max(0,x),m){for(var v=0;v<_;v++)m.words[v]=this.words[v];m.length=_}if(_!==0)if(this.length>_)for(this.length-=_,v=0;v<this.length;v++)this.words[v]=this.words[v+_];else this.words[0]=0,this.length=1;var S=0;for(v=this.length-1;v>=0&&(S!==0||v>=x);v--){var G=this.words[v]|0;this.words[v]=S<<26-A|G>>>A,S=G&c}return m&&S!==0&&(m.words[m.length++]=S),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(a,f,b){return i(this.negative===0),this.iushrn(a,f,b)},s.prototype.shln=function(a){return this.clone().ishln(a)},s.prototype.ushln=function(a){return this.clone().iushln(a)},s.prototype.shrn=function(a){return this.clone().ishrn(a)},s.prototype.ushrn=function(a){return this.clone().iushrn(a)},s.prototype.testn=function(a){i(typeof a=="number"&&a>=0);var f=a%26,b=(a-f)/26,x=1<<f;if(this.length<=b)return!1;var A=this.words[b];return!!(A&x)},s.prototype.imaskn=function(a){i(typeof a=="number"&&a>=0);var f=a%26,b=(a-f)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=b)return this;if(f!==0&&b++,this.length=Math.min(b,this.length),f!==0){var x=67108863^67108863>>>f<<f;this.words[this.length-1]&=x}return this._strip()},s.prototype.maskn=function(a){return this.clone().imaskn(a)},s.prototype.iaddn=function(a){return i(typeof a=="number"),i(a<67108864),a<0?this.isubn(-a):this.negative!==0?this.length===1&&(this.words[0]|0)<=a?(this.words[0]=a-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(a),this.negative=1,this):this._iaddn(a)},s.prototype._iaddn=function(a){this.words[0]+=a;for(var f=0;f<this.length&&this.words[f]>=67108864;f++)this.words[f]-=67108864,f===this.length-1?this.words[f+1]=1:this.words[f+1]++;return this.length=Math.max(this.length,f+1),this},s.prototype.isubn=function(a){if(i(typeof a=="number"),i(a<67108864),a<0)return this.iaddn(-a);if(this.negative!==0)return this.negative=0,this.iaddn(a),this.negative=1,this;if(this.words[0]-=a,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var f=0;f<this.length&&this.words[f]<0;f++)this.words[f]+=67108864,this.words[f+1]-=1;return this._strip()},s.prototype.addn=function(a){return this.clone().iaddn(a)},s.prototype.subn=function(a){return this.clone().isubn(a)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(a,f,b){var x=a.length+b,A;this._expand(x);var _,c=0;for(A=0;A<a.length;A++){_=(this.words[A+b]|0)+c;var m=(a.words[A]|0)*f;_-=m&67108863,c=(_>>26)-(m/67108864|0),this.words[A+b]=_&67108863}for(;A<this.length-b;A++)_=(this.words[A+b]|0)+c,c=_>>26,this.words[A+b]=_&67108863;if(c===0)return this._strip();for(i(c===-1),c=0,A=0;A<this.length;A++)_=-(this.words[A]|0)+c,c=_>>26,this.words[A]=_&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(a,f){var b=this.length-a.length,x=this.clone(),A=a,_=A.words[A.length-1]|0,c=this._countBits(_);b=26-c,b!==0&&(A=A.ushln(b),x.iushln(b),_=A.words[A.length-1]|0);var m=x.length-A.length,v;if(f!=="mod"){v=new s(null),v.length=m+1,v.words=new Array(v.length);for(var S=0;S<v.length;S++)v.words[S]=0}var G=x.clone()._ishlnsubmul(A,1,m);G.negative===0&&(x=G,v&&(v.words[m]=1));for(var E=m-1;E>=0;E--){var k=(x.words[A.length+E]|0)*67108864+(x.words[A.length+E-1]|0);for(k=Math.min(k/_|0,67108863),x._ishlnsubmul(A,k,E);x.negative!==0;)k--,x.negative=0,x._ishlnsubmul(A,1,E),x.isZero()||(x.negative^=1);v&&(v.words[E]=k)}return v&&v._strip(),x._strip(),f!=="div"&&b!==0&&x.iushrn(b),{div:v||null,mod:x}},s.prototype.divmod=function(a,f,b){if(i(!a.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,A,_;return this.negative!==0&&a.negative===0?(_=this.neg().divmod(a,f),f!=="mod"&&(x=_.div.neg()),f!=="div"&&(A=_.mod.neg(),b&&A.negative!==0&&A.iadd(a)),{div:x,mod:A}):this.negative===0&&a.negative!==0?(_=this.divmod(a.neg(),f),f!=="mod"&&(x=_.div.neg()),{div:x,mod:_.mod}):this.negative&a.negative?(_=this.neg().divmod(a.neg(),f),f!=="div"&&(A=_.mod.neg(),b&&A.negative!==0&&A.isub(a)),{div:_.div,mod:A}):a.length>this.length||this.cmp(a)<0?{div:new s(0),mod:this}:a.length===1?f==="div"?{div:this.divn(a.words[0]),mod:null}:f==="mod"?{div:null,mod:new s(this.modrn(a.words[0]))}:{div:this.divn(a.words[0]),mod:new s(this.modrn(a.words[0]))}:this._wordDiv(a,f)},s.prototype.div=function(a){return this.divmod(a,"div",!1).div},s.prototype.mod=function(a){return this.divmod(a,"mod",!1).mod},s.prototype.umod=function(a){return this.divmod(a,"mod",!0).mod},s.prototype.divRound=function(a){var f=this.divmod(a);if(f.mod.isZero())return f.div;var b=f.div.negative!==0?f.mod.isub(a):f.mod,x=a.ushrn(1),A=a.andln(1),_=b.cmp(x);return _<0||A===1&&_===0?f.div:f.div.negative!==0?f.div.isubn(1):f.div.iaddn(1)},s.prototype.modrn=function(a){var f=a<0;f&&(a=-a),i(a<=67108863);for(var b=(1<<26)%a,x=0,A=this.length-1;A>=0;A--)x=(b*x+(this.words[A]|0))%a;return f?-x:x},s.prototype.modn=function(a){return this.modrn(a)},s.prototype.idivn=function(a){var f=a<0;f&&(a=-a),i(a<=67108863);for(var b=0,x=this.length-1;x>=0;x--){var A=(this.words[x]|0)+b*67108864;this.words[x]=A/a|0,b=A%a}return this._strip(),f?this.ineg():this},s.prototype.divn=function(a){return this.clone().idivn(a)},s.prototype.egcd=function(a){i(a.negative===0),i(!a.isZero());var f=this,b=a.clone();f.negative!==0?f=f.umod(a):f=f.clone();for(var x=new s(1),A=new s(0),_=new s(0),c=new s(1),m=0;f.isEven()&&b.isEven();)f.iushrn(1),b.iushrn(1),++m;for(var v=b.clone(),S=f.clone();!f.isZero();){for(var G=0,E=1;!(f.words[0]&E)&&G<26;++G,E<<=1);if(G>0)for(f.iushrn(G);G-- >0;)(x.isOdd()||A.isOdd())&&(x.iadd(v),A.isub(S)),x.iushrn(1),A.iushrn(1);for(var k=0,C=1;!(b.words[0]&C)&&k<26;++k,C<<=1);if(k>0)for(b.iushrn(k);k-- >0;)(_.isOdd()||c.isOdd())&&(_.iadd(v),c.isub(S)),_.iushrn(1),c.iushrn(1);f.cmp(b)>=0?(f.isub(b),x.isub(_),A.isub(c)):(b.isub(f),_.isub(x),c.isub(A))}return{a:_,b:c,gcd:b.iushln(m)}},s.prototype._invmp=function(a){i(a.negative===0),i(!a.isZero());var f=this,b=a.clone();f.negative!==0?f=f.umod(a):f=f.clone();for(var x=new s(1),A=new s(0),_=b.clone();f.cmpn(1)>0&&b.cmpn(1)>0;){for(var c=0,m=1;!(f.words[0]&m)&&c<26;++c,m<<=1);if(c>0)for(f.iushrn(c);c-- >0;)x.isOdd()&&x.iadd(_),x.iushrn(1);for(var v=0,S=1;!(b.words[0]&S)&&v<26;++v,S<<=1);if(v>0)for(b.iushrn(v);v-- >0;)A.isOdd()&&A.iadd(_),A.iushrn(1);f.cmp(b)>=0?(f.isub(b),x.isub(A)):(b.isub(f),A.isub(x))}var G;return f.cmpn(1)===0?G=x:G=A,G.cmpn(0)<0&&G.iadd(a),G},s.prototype.gcd=function(a){if(this.isZero())return a.abs();if(a.isZero())return this.abs();var f=this.clone(),b=a.clone();f.negative=0,b.negative=0;for(var x=0;f.isEven()&&b.isEven();x++)f.iushrn(1),b.iushrn(1);do{for(;f.isEven();)f.iushrn(1);for(;b.isEven();)b.iushrn(1);var A=f.cmp(b);if(A<0){var _=f;f=b,b=_}else if(A===0||b.cmpn(1)===0)break;f.isub(b)}while(!0);return b.iushln(x)},s.prototype.invm=function(a){return this.egcd(a).a.umod(a)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(a){return this.words[0]&a},s.prototype.bincn=function(a){i(typeof a=="number");var f=a%26,b=(a-f)/26,x=1<<f;if(this.length<=b)return this._expand(b+1),this.words[b]|=x,this;for(var A=x,_=b;A!==0&&_<this.length;_++){var c=this.words[_]|0;c+=A,A=c>>>26,c&=67108863,this.words[_]=c}return A!==0&&(this.words[_]=A,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(a){var f=a<0;if(this.negative!==0&&!f)return-1;if(this.negative===0&&f)return 1;this._strip();var b;if(this.length>1)b=1;else{f&&(a=-a),i(a<=67108863,"Number is too big");var x=this.words[0]|0;b=x===a?0:x<a?-1:1}return this.negative!==0?-b|0:b},s.prototype.cmp=function(a){if(this.negative!==0&&a.negative===0)return-1;if(this.negative===0&&a.negative!==0)return 1;var f=this.ucmp(a);return this.negative!==0?-f|0:f},s.prototype.ucmp=function(a){if(this.length>a.length)return 1;if(this.length<a.length)return-1;for(var f=0,b=this.length-1;b>=0;b--){var x=this.words[b]|0,A=a.words[b]|0;if(x!==A){x<A?f=-1:x>A&&(f=1);break}}return f},s.prototype.gtn=function(a){return this.cmpn(a)===1},s.prototype.gt=function(a){return this.cmp(a)===1},s.prototype.gten=function(a){return this.cmpn(a)>=0},s.prototype.gte=function(a){return this.cmp(a)>=0},s.prototype.ltn=function(a){return this.cmpn(a)===-1},s.prototype.lt=function(a){return this.cmp(a)===-1},s.prototype.lten=function(a){return this.cmpn(a)<=0},s.prototype.lte=function(a){return this.cmp(a)<=0},s.prototype.eqn=function(a){return this.cmpn(a)===0},s.prototype.eq=function(a){return this.cmp(a)===0},s.red=function(a){return new O(a)},s.prototype.toRed=function(a){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),a.convertTo(this)._forceRed(a)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(a){return this.red=a,this},s.prototype.forceRed=function(a){return i(!this.red,"Already a number in reduction context"),this._forceRed(a)},s.prototype.redAdd=function(a){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,a)},s.prototype.redIAdd=function(a){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,a)},s.prototype.redSub=function(a){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,a)},s.prototype.redISub=function(a){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,a)},s.prototype.redShl=function(a){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,a)},s.prototype.redMul=function(a){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.mul(this,a)},s.prototype.redIMul=function(a){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.imul(this,a)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(a){return i(this.red&&!a.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,a)};var $={k256:null,p224:null,p192:null,p25519:null};function q(u,a){this.name=u,this.p=new s(a,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}q.prototype._tmp=function(){var a=new s(null);return a.words=new Array(Math.ceil(this.n/13)),a},q.prototype.ireduce=function(a){var f=a,b;do this.split(f,this.tmp),f=this.imulK(f),f=f.iadd(this.tmp),b=f.bitLength();while(b>this.n);var x=b<this.n?-1:f.ucmp(this.p);return x===0?(f.words[0]=0,f.length=1):x>0?f.isub(this.p):f.strip!==void 0?f.strip():f._strip(),f},q.prototype.split=function(a,f){a.iushrn(this.n,0,f)},q.prototype.imulK=function(a){return a.imul(this.k)};function y(){q.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(y,q),y.prototype.split=function(a,f){for(var b=4194303,x=Math.min(a.length,9),A=0;A<x;A++)f.words[A]=a.words[A];if(f.length=x,a.length<=9){a.words[0]=0,a.length=1;return}var _=a.words[9];for(f.words[f.length++]=_&b,A=10;A<a.length;A++){var c=a.words[A]|0;a.words[A-10]=(c&b)<<4|_>>>22,_=c}_>>>=22,a.words[A-10]=_,_===0&&a.length>10?a.length-=10:a.length-=9},y.prototype.imulK=function(a){a.words[a.length]=0,a.words[a.length+1]=0,a.length+=2;for(var f=0,b=0;b<a.length;b++){var x=a.words[b]|0;f+=x*977,a.words[b]=f&67108863,f=x*64+(f/67108864|0)}return a.words[a.length-1]===0&&(a.length--,a.words[a.length-1]===0&&a.length--),a};function R(){q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(R,q);function V(){q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(V,q);function Q(){q.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(Q,q),Q.prototype.imulK=function(a){for(var f=0,b=0;b<a.length;b++){var x=(a.words[b]|0)*19+f,A=x&67108863;x>>>=26,a.words[b]=A,f=x}return f!==0&&(a.words[a.length++]=f),a},s._prime=function(a){if($[a])return $[a];var f;if(a==="k256")f=new y;else if(a==="p224")f=new R;else if(a==="p192")f=new V;else if(a==="p25519")f=new Q;else throw new Error("Unknown prime "+a);return $[a]=f,f};function O(u){if(typeof u=="string"){var a=s._prime(u);this.m=a.p,this.prime=a}else i(u.gtn(1),"modulus must be greater than 1"),this.m=u,this.prime=null}O.prototype._verify1=function(a){i(a.negative===0,"red works only with positives"),i(a.red,"red works only with red numbers")},O.prototype._verify2=function(a,f){i((a.negative|f.negative)===0,"red works only with positives"),i(a.red&&a.red===f.red,"red works only with red numbers")},O.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):(w(a,a.umod(this.m)._forceRed(this)),a)},O.prototype.neg=function(a){return a.isZero()?a.clone():this.m.sub(a)._forceRed(this)},O.prototype.add=function(a,f){this._verify2(a,f);var b=a.add(f);return b.cmp(this.m)>=0&&b.isub(this.m),b._forceRed(this)},O.prototype.iadd=function(a,f){this._verify2(a,f);var b=a.iadd(f);return b.cmp(this.m)>=0&&b.isub(this.m),b},O.prototype.sub=function(a,f){this._verify2(a,f);var b=a.sub(f);return b.cmpn(0)<0&&b.iadd(this.m),b._forceRed(this)},O.prototype.isub=function(a,f){this._verify2(a,f);var b=a.isub(f);return b.cmpn(0)<0&&b.iadd(this.m),b},O.prototype.shl=function(a,f){return this._verify1(a),this.imod(a.ushln(f))},O.prototype.imul=function(a,f){return this._verify2(a,f),this.imod(a.imul(f))},O.prototype.mul=function(a,f){return this._verify2(a,f),this.imod(a.mul(f))},O.prototype.isqr=function(a){return this.imul(a,a.clone())},O.prototype.sqr=function(a){return this.mul(a,a)},O.prototype.sqrt=function(a){if(a.isZero())return a.clone();var f=this.m.andln(3);if(i(f%2===1),f===3){var b=this.m.add(new s(1)).iushrn(2);return this.pow(a,b)}for(var x=this.m.subn(1),A=0;!x.isZero()&&x.andln(1)===0;)A++,x.iushrn(1);i(!x.isZero());var _=new s(1).toRed(this),c=_.redNeg(),m=this.m.subn(1).iushrn(1),v=this.m.bitLength();for(v=new s(2*v*v).toRed(this);this.pow(v,m).cmp(c)!==0;)v.redIAdd(c);for(var S=this.pow(v,x),G=this.pow(a,x.addn(1).iushrn(1)),E=this.pow(a,x),k=A;E.cmp(_)!==0;){for(var C=E,B=0;C.cmp(_)!==0;B++)C=C.redSqr();i(B<k);var P=this.pow(S,new s(1).iushln(k-B-1));G=G.redMul(P),S=P.redSqr(),E=E.redMul(S),k=B}return G},O.prototype.invm=function(a){var f=a._invmp(this.m);return f.negative!==0?(f.negative=0,this.imod(f).redNeg()):this.imod(f)},O.prototype.pow=function(a,f){if(f.isZero())return new s(1).toRed(this);if(f.cmpn(1)===0)return a.clone();var b=4,x=new Array(1<<b);x[0]=new s(1).toRed(this),x[1]=a;for(var A=2;A<x.length;A++)x[A]=this.mul(x[A-1],a);var _=x[0],c=0,m=0,v=f.bitLength()%26;for(v===0&&(v=26),A=f.length-1;A>=0;A--){for(var S=f.words[A],G=v-1;G>=0;G--){var E=S>>G&1;if(_!==x[0]&&(_=this.sqr(_)),E===0&&c===0){m=0;continue}c<<=1,c|=E,m++,!(m!==b&&(A!==0||G!==0))&&(_=this.mul(_,x[c]),m=0,c=0)}v=26}return _},O.prototype.convertTo=function(a){var f=a.umod(this.m);return f===a?f.clone():f},O.prototype.convertFrom=function(a){var f=a.clone();return f.red=null,f},s.mont=function(a){return new d(a)};function d(u){O.call(this,u),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(d,O),d.prototype.convertTo=function(a){return this.imod(a.ushln(this.shift))},d.prototype.convertFrom=function(a){var f=this.imod(a.mul(this.rinv));return f.red=null,f},d.prototype.imul=function(a,f){if(a.isZero()||f.isZero())return a.words[0]=0,a.length=1,a;var b=a.imul(f),x=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),A=b.isub(x).iushrn(this.shift),_=A;return A.cmp(this.m)>=0?_=A.isub(this.m):A.cmpn(0)<0&&(_=A.iadd(this.m)),_._forceRed(this)},d.prototype.mul=function(a,f){if(a.isZero()||f.isZero())return new s(0)._forceRed(this);var b=a.mul(f),x=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),A=b.isub(x).iushrn(this.shift),_=A;return A.cmp(this.m)>=0?_=A.isub(this.m):A.cmpn(0)<0&&(_=A.iadd(this.m)),_._forceRed(this)},d.prototype.invm=function(a){var f=this.imod(a._invmp(this.m).mul(this.r2));return f._forceRed(this)}})(t,Bt)})(nl);var Xe=nl.exports;const sl="bignumber/5.7.0";var eo=Xe.BN;const fn=new rt(sl),ih={},al=9007199254740991;function q8(t){return t!=null&&(mt.isBigNumber(t)||typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||kr(t)||typeof t=="bigint"||ks(t))}let fl=!1;class mt{constructor(e,r){e!==ih&&fn.throwError("cannot call constructor directly; use BigNumber.from",rt.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Pr(at(this).fromTwos(e))}toTwos(e){return Pr(at(this).toTwos(e))}abs(){return this._hex[0]==="-"?mt.from(this._hex.substring(1)):this}add(e){return Pr(at(this).add(at(e)))}sub(e){return Pr(at(this).sub(at(e)))}div(e){return mt.from(e).isZero()&&ei("division-by-zero","div"),Pr(at(this).div(at(e)))}mul(e){return Pr(at(this).mul(at(e)))}mod(e){const r=at(e);return r.isNeg()&&ei("division-by-zero","mod"),Pr(at(this).umod(r))}pow(e){const r=at(e);return r.isNeg()&&ei("negative-power","pow"),Pr(at(this).pow(r))}and(e){const r=at(e);return(this.isNegative()||r.isNeg())&&ei("unbound-bitwise-result","and"),Pr(at(this).and(r))}or(e){const r=at(e);return(this.isNegative()||r.isNeg())&&ei("unbound-bitwise-result","or"),Pr(at(this).or(r))}xor(e){const r=at(e);return(this.isNegative()||r.isNeg())&&ei("unbound-bitwise-result","xor"),Pr(at(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&ei("negative-width","mask"),Pr(at(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&ei("negative-width","shl"),Pr(at(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&ei("negative-width","shr"),Pr(at(this).shrn(e))}eq(e){return at(this).eq(at(e))}lt(e){return at(this).lt(at(e))}lte(e){return at(this).lte(at(e))}gt(e){return at(this).gt(at(e))}gte(e){return at(this).gte(at(e))}isNegative(){return this._hex[0]==="-"}isZero(){return at(this).isZero()}toNumber(){try{return at(this).toNumber()}catch{ei("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return fn.throwError("this platform does not support BigInt",rt.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?fl||(fl=!0,fn.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?fn.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",rt.errors.UNEXPECTED_ARGUMENT,{}):fn.throwError("BigNumber.toString does not accept parameters",rt.errors.UNEXPECTED_ARGUMENT,{})),at(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof mt)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new mt(ih,Fa(e)):e.match(/^-?[0-9]+$/)?new mt(ih,Fa(new eo(e))):fn.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&ei("underflow","BigNumber.from",e),(e>=al||e<=-al)&&ei("overflow","BigNumber.from",e),mt.from(String(e));const r=e;if(typeof r=="bigint")return mt.from(r.toString());if(ks(r))return mt.from(Mr(r));if(r)if(r.toHexString){const i=r.toHexString();if(typeof i=="string")return mt.from(i)}else{let i=r._hex;if(i==null&&r.type==="BigNumber"&&(i=r.hex),typeof i=="string"&&(kr(i)||i[0]==="-"&&kr(i.substring(1))))return mt.from(i)}return fn.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function Fa(t){if(typeof t!="string")return Fa(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&fn.throwArgumentError("invalid hex","value",t),t=Fa(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function Pr(t){return mt.from(Fa(t))}function at(t){const e=mt.from(t).toHexString();return e[0]==="-"?new eo("-"+e.substring(3),16):new eo(e.substring(2),16)}function ei(t,e,r){const i={fault:t,operation:e};return r!=null&&(i.value=r),fn.throwError(t,rt.errors.NUMERIC_FAULT,i)}function z8(t){return new eo(t,36).toString(16)}const Er=new rt(sl),La={},ol=mt.from(0),hl=mt.from(-1);function cl(t,e,r,i){const n={fault:e,operation:r};return i!==void 0&&(n.value=i),Er.throwError(t,rt.errors.NUMERIC_FAULT,n)}let Ua="0";for(;Ua.length<256;)Ua+=Ua;function nh(t){if(typeof t!="number")try{t=mt.from(t).toNumber()}catch{}return typeof t=="number"&&t>=0&&t<=256&&!(t%1)?"1"+Ua.substring(0,t):Er.throwArgumentError("invalid decimal size","decimals",t)}function sh(t,e){e==null&&(e=0);const r=nh(e);t=mt.from(t);const i=t.lt(ol);i&&(t=t.mul(hl));let n=t.mod(r).toString();for(;n.length<r.length-1;)n="0"+n;n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=t.div(r).toString();return r.length===1?t=s:t=s+"."+n,i&&(t="-"+t),t}function on(t,e){e==null&&(e=0);const r=nh(e);(typeof t!="string"||!t.match(/^-?[0-9.]+$/))&&Er.throwArgumentError("invalid decimal value","value",t);const i=t.substring(0,1)==="-";i&&(t=t.substring(1)),t==="."&&Er.throwArgumentError("missing value","value",t);const n=t.split(".");n.length>2&&Er.throwArgumentError("too many decimal points","value",t);let s=n[0],o=n[1];for(s||(s="0"),o||(o="0");o[o.length-1]==="0";)o=o.substring(0,o.length-1);for(o.length>r.length-1&&cl("fractional component exceeds decimals","underflow","parseFixed"),o===""&&(o="0");o.length<r.length-1;)o+="0";const h=mt.from(s),l=mt.from(o);let p=h.mul(r).add(l);return i&&(p=p.mul(hl)),p}class Ks{constructor(e,r,i,n){e!==La&&Er.throwError("cannot use FixedFormat constructor; use FixedFormat.from",rt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=r,this.width=i,this.decimals=n,this.name=(r?"":"u")+"fixed"+String(i)+"x"+String(n),this._multiplier=nh(n),Object.freeze(this)}static from(e){if(e instanceof Ks)return e;typeof e=="number"&&(e=`fixed128x${e}`);let r=!0,i=128,n=18;if(typeof e=="string"){if(e!=="fixed")if(e==="ufixed")r=!1;else{const s=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);s||Er.throwArgumentError("invalid fixed format","format",e),r=s[1]!=="u",i=parseInt(s[2]),n=parseInt(s[3])}}else if(e){const s=(o,h,l)=>e[o]==null?l:(typeof e[o]!==h&&Er.throwArgumentError("invalid fixed format ("+o+" not "+h+")","format."+o,e[o]),e[o]);r=s("signed","boolean",r),i=s("width","number",i),n=s("decimals","number",n)}return i%8&&Er.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",i),n>80&&Er.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new Ks(La,r,i,n)}}class Xt{constructor(e,r,i,n){e!==La&&Er.throwError("cannot use FixedNumber constructor; use FixedNumber.from",rt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=r,this._value=i,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&Er.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const r=on(this._value,this.format.decimals),i=on(e._value,e.format.decimals);return Xt.fromValue(r.add(i),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const r=on(this._value,this.format.decimals),i=on(e._value,e.format.decimals);return Xt.fromValue(r.sub(i),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const r=on(this._value,this.format.decimals),i=on(e._value,e.format.decimals);return Xt.fromValue(r.mul(i).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const r=on(this._value,this.format.decimals),i=on(e._value,e.format.decimals);return Xt.fromValue(r.mul(this.format._multiplier).div(i),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=Xt.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return this.isNegative()&&i&&(r=r.subUnsafe(ul.toFormat(r.format))),r}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=Xt.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return!this.isNegative()&&i&&(r=r.addUnsafe(ul.toFormat(r.format))),r}round(e){e==null&&(e=0);const r=this.toString().split(".");if(r.length===1&&r.push("0"),(e<0||e>80||e%1)&&Er.throwArgumentError("invalid decimal count","decimals",e),r[1].length<=e)return this;const i=Xt.from("1"+Ua.substring(0,e),this.format),n=k8.toFormat(this.format);return this.mulUnsafe(i).addUnsafe(n).floor().divUnsafe(i)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&Er.throwArgumentError("invalid byte width","width",e);const r=mt.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return Pi(r,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Xt.fromString(this._value,e)}static fromValue(e,r,i){return i==null&&r!=null&&!q8(r)&&(i=r,r=null),r==null&&(r=0),i==null&&(i="fixed"),Xt.fromString(sh(e,r),Ks.from(i))}static fromString(e,r){r==null&&(r="fixed");const i=Ks.from(r),n=on(e,i.decimals);!i.signed&&n.lt(ol)&&cl("unsigned value cannot be negative","overflow","value",e);let s=null;i.signed?s=n.toTwos(i.width).toHexString():(s=n.toHexString(),s=Pi(s,i.width/8));const o=sh(n,i.decimals);return new Xt(La,s,o,i)}static fromBytes(e,r){r==null&&(r="fixed");const i=Ks.from(r);if(It(e).length>i.width/8)throw new Error("overflow");let n=mt.from(e);i.signed&&(n=n.fromTwos(i.width));const s=n.toTwos((i.signed?0:1)+i.width).toHexString(),o=sh(n,i.decimals);return new Xt(La,s,o,i)}static from(e,r){if(typeof e=="string")return Xt.fromString(e,r);if(ks(e))return Xt.fromBytes(e,r);try{return Xt.fromValue(e,0,r)}catch(i){if(i.code!==rt.errors.INVALID_ARGUMENT)throw i}return Er.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}}const ul=Xt.from(1),k8=Xt.from("0.5"),K8="strings/5.7.0",dl=new rt(K8);var to;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(to||(to={}));var Hs;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(Hs||(Hs={}));function H8(t,e,r,i,n){return dl.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function ll(t,e,r,i,n){if(t===Hs.BAD_PREFIX||t===Hs.UNEXPECTED_CONTINUE){let s=0;for(let o=e+1;o<r.length&&r[o]>>6===2;o++)s++;return s}return t===Hs.OVERRUN?r.length-e-1:0}function j8(t,e,r,i,n){return t===Hs.OVERLONG?(i.push(n),0):(i.push(65533),ll(t,e,r))}Object.freeze({error:H8,ignore:ll,replace:j8});function ah(t,e=to.current){e!=to.current&&(dl.checkNormalize(),t=t.normalize(e));let r=[];for(let i=0;i<t.length;i++){const n=t.charCodeAt(i);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(n&63|128);else if((n&64512)==55296){i++;const s=t.charCodeAt(i);if(i>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((n&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(n&63|128)}return It(r)}function G8(t){if(t.length%4!==0)throw new Error("bad data");let e=[];for(let r=0;r<t.length;r+=4)e.push(parseInt(t.substring(r,r+4),16));return e}function fh(t,e){e||(e=function(n){return[parseInt(n,16)]});let r=0,i={};return t.split(",").forEach(n=>{let s=n.split(":");r+=parseInt(s[0],16),i[r]=e(s[1])}),i}function pl(t){let e=0;return t.split(",").map(r=>{let i=r.split("-");i.length===1?i[1]="0":i[1]===""&&(i[1]="1");let n=e+parseInt(i[0],16);return e=parseInt(i[1],16),{l:n,h:e}})}pl("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(t=>parseInt(t,16)),fh("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),fh("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),fh("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",G8),pl("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");const bl="hash/5.7.0";function V8(t){t=atob(t);const e=[];for(let r=0;r<t.length;r++)e.push(t.charCodeAt(r));return It(e)}function vl(t,e){e==null&&(e=1);const r=[],i=r.forEach,n=function(s,o){i.call(s,function(h){o>0&&Array.isArray(h)?n(h,o-1):r.push(h)})};return n(t,e),r}function Y8(t){const e={};for(let r=0;r<t.length;r++){const i=t[r];e[i[0]]=i[1]}return e}function J8(t){let e=0;function r(){return t[e++]<<8|t[e++]}let i=r(),n=1,s=[0,1];for(let $=1;$<i;$++)s.push(n+=r());let o=r(),h=e;e+=o;let l=0,p=0;function w(){return l==0&&(p=p<<8|t[e++],l=8),p>>--l&1}const M=31,I=Math.pow(2,M),D=I>>>1,N=D>>1,U=I-1;let z=0;for(let $=0;$<M;$++)z=z<<1|w();let H=[],L=0,K=I;for(;;){let $=Math.floor(((z-L+1)*n-1)/K),q=0,y=i;for(;y-q>1;){let Q=q+y>>>1;$<s[Q]?y=Q:q=Q}if(q==0)break;H.push(q);let R=L+Math.floor(K*s[q]/n),V=L+Math.floor(K*s[q+1]/n)-1;for(;!((R^V)&D);)z=z<<1&U|w(),R=R<<1&U,V=V<<1&U|1;for(;R&~V&N;)z=z&D|z<<1&U>>>1|w(),R=R<<1^D,V=(V^D)<<1|D|1;L=R,K=1+V-R}let F=i-4;return H.map($=>{switch($-F){case 3:return F+65792+(t[h++]<<16|t[h++]<<8|t[h++]);case 2:return F+256+(t[h++]<<8|t[h++]);case 1:return F+t[h++];default:return $-1}})}function W8(t){let e=0;return()=>t[e++]}function Q8(t){return W8(J8(t))}function X8(t){return t&1?~t>>1:t>>1}function Z8(t,e){let r=Array(t);for(let i=0;i<t;i++)r[i]=1+e();return r}function gl(t,e){let r=Array(t);for(let i=0,n=-1;i<t;i++)r[i]=n+=1+e();return r}function em(t,e){let r=Array(t);for(let i=0,n=0;i<t;i++)r[i]=n+=X8(e());return r}function ro(t,e){let r=gl(t(),t),i=t(),n=gl(i,t),s=Z8(i,t);for(let o=0;o<i;o++)for(let h=0;h<s[o];h++)r.push(n[o]+h);return e?r.map(o=>e[o]):r}function tm(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(im(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(nm(r,t))}return Y8(vl(e))}function rm(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function ml(t,e,r){let i=Array(t).fill(void 0).map(()=>[]);for(let n=0;n<e;n++)em(t,r).forEach((s,o)=>i[o].push(s));return i}function im(t,e){let r=1+e(),i=e(),n=rm(e),s=ml(n.length,1+t,e);return vl(s.map((o,h)=>{const l=o[0],p=o.slice(1);return Array(n[h]).fill(void 0).map((w,M)=>{let I=M*i;return[l+M*r,p.map(D=>D+I)]})}))}function nm(t,e){let r=1+e();return ml(r,1+t,e).map(n=>[n[0],n.slice(1)])}function sm(t){let e=ro(t).sort((i,n)=>i-n);return r();function r(){let i=[];for(;;){let p=ro(t,e);if(p.length==0)break;i.push({set:new Set(p),node:r()})}i.sort((p,w)=>w.set.size-p.set.size);let n=t(),s=n%3;n=n/3|0;let o=!!(n&1);n>>=1;let h=n==1,l=n==2;return{branches:i,valid:s,fe0f:o,save:h,check:l}}}function am(){return Q8(V8("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const io=am();new Set(ro(io)),new Set(ro(io)),tm(io),sm(io),new rt(bl),new Uint8Array(32).fill(0);const fm=`Ethereum Signed Message:
22
+ `;function yl(t){return typeof t=="string"&&(t=ah(t)),rh(L8([ah(fm),ah(String(t.length)),t]))}const om="rlp/5.7.0";new rt(om);const hm="address/5.7.0",$a=new rt(hm);function wl(t){kr(t,20)||$a.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let n=0;n<40;n++)r[n]=e[n].charCodeAt(0);const i=It(rh(r));for(let n=0;n<40;n+=2)i[n>>1]>>4>=8&&(e[n]=e[n].toUpperCase()),(i[n>>1]&15)>=8&&(e[n+1]=e[n+1].toUpperCase());return"0x"+e.join("")}const cm=9007199254740991;function um(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const oh={};for(let t=0;t<10;t++)oh[String(t)]=String(t);for(let t=0;t<26;t++)oh[String.fromCharCode(65+t)]=String(10+t);const _l=Math.floor(um(cm));function dm(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(i=>oh[i]).join("");for(;e.length>=_l;){let i=e.substring(0,_l);e=parseInt(i,10)%97+e.substring(i.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function lm(t){let e=null;if(typeof t!="string"&&$a.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=wl(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&$a.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==dm(t)&&$a.throwArgumentError("bad icap checksum","address",t),e=z8(t.substring(4));e.length<40;)e="0"+e;e=wl("0x"+e)}else $a.throwArgumentError("invalid address","address",t);return e}const pm="properties/5.7.0";new rt(pm);function qa(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}new rt(bl),new Uint8Array(32).fill(0),mt.from(-1);const bm=mt.from(0),vm=mt.from(1);mt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Pi(vm.toHexString(),32),Pi(bm.toHexString(),32);var Kr={},ft={},rs=xl;function xl(t,e){if(!t)throw new Error(e||"Assertion failed")}xl.equal=function(e,r,i){if(e!=r)throw new Error(i||"Assertion failed: "+e+" != "+r)};var js={exports:{}};typeof Object.create=="function"?js.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:js.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}};var gm=rs,mm=js.exports;ft.inherits=mm;function ym(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function wm(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var i=0,n=0;n<t.length;n++){var s=t.charCodeAt(n);s<128?r[i++]=s:s<2048?(r[i++]=s>>6|192,r[i++]=s&63|128):ym(t,n)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++n)&1023),r[i++]=s>>18|240,r[i++]=s>>12&63|128,r[i++]=s>>6&63|128,r[i++]=s&63|128):(r[i++]=s>>12|224,r[i++]=s>>6&63|128,r[i++]=s&63|128)}else for(n=0;n<t.length;n++)r[n]=t[n]|0;return r}ft.toArray=wm;function _m(t){for(var e="",r=0;r<t.length;r++)e+=Ml(t[r].toString(16));return e}ft.toHex=_m;function Al(t){var e=t>>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}ft.htonl=Al;function xm(t,e){for(var r="",i=0;i<t.length;i++){var n=t[i];e==="little"&&(n=Al(n)),r+=El(n.toString(16))}return r}ft.toHex32=xm;function Ml(t){return t.length===1?"0"+t:t}ft.zero2=Ml;function El(t){return t.length===7?"0"+t:t.length===6?"00"+t:t.length===5?"000"+t:t.length===4?"0000"+t:t.length===3?"00000"+t:t.length===2?"000000"+t:t.length===1?"0000000"+t:t}ft.zero8=El;function Am(t,e,r,i){var n=r-e;gm(n%4===0);for(var s=new Array(n/4),o=0,h=e;o<s.length;o++,h+=4){var l;i==="big"?l=t[h]<<24|t[h+1]<<16|t[h+2]<<8|t[h+3]:l=t[h+3]<<24|t[h+2]<<16|t[h+1]<<8|t[h],s[o]=l>>>0}return s}ft.join32=Am;function Mm(t,e){for(var r=new Array(t.length*4),i=0,n=0;i<t.length;i++,n+=4){var s=t[i];e==="big"?(r[n]=s>>>24,r[n+1]=s>>>16&255,r[n+2]=s>>>8&255,r[n+3]=s&255):(r[n+3]=s>>>24,r[n+2]=s>>>16&255,r[n+1]=s>>>8&255,r[n]=s&255)}return r}ft.split32=Mm;function Em(t,e){return t>>>e|t<<32-e}ft.rotr32=Em;function Sm(t,e){return t<<e|t>>>32-e}ft.rotl32=Sm;function Dm(t,e){return t+e>>>0}ft.sum32=Dm;function Im(t,e,r){return t+e+r>>>0}ft.sum32_3=Im;function Nm(t,e,r,i){return t+e+r+i>>>0}ft.sum32_4=Nm;function Om(t,e,r,i,n){return t+e+r+i+n>>>0}ft.sum32_5=Om;function Rm(t,e,r,i){var n=t[e],s=t[e+1],o=i+s>>>0,h=(o<i?1:0)+r+n;t[e]=h>>>0,t[e+1]=o}ft.sum64=Rm;function Cm(t,e,r,i){var n=e+i>>>0,s=(n<e?1:0)+t+r;return s>>>0}ft.sum64_hi=Cm;function Pm(t,e,r,i){var n=e+i;return n>>>0}ft.sum64_lo=Pm;function Tm(t,e,r,i,n,s,o,h){var l=0,p=e;p=p+i>>>0,l+=p<e?1:0,p=p+s>>>0,l+=p<s?1:0,p=p+h>>>0,l+=p<h?1:0;var w=t+r+n+o+l;return w>>>0}ft.sum64_4_hi=Tm;function Bm(t,e,r,i,n,s,o,h){var l=e+i+s+h;return l>>>0}ft.sum64_4_lo=Bm;function Fm(t,e,r,i,n,s,o,h,l,p){var w=0,M=e;M=M+i>>>0,w+=M<e?1:0,M=M+s>>>0,w+=M<s?1:0,M=M+h>>>0,w+=M<h?1:0,M=M+p>>>0,w+=M<p?1:0;var I=t+r+n+o+l+w;return I>>>0}ft.sum64_5_hi=Fm;function Lm(t,e,r,i,n,s,o,h,l,p){var w=e+i+s+h+p;return w>>>0}ft.sum64_5_lo=Lm;function Um(t,e,r){var i=e<<32-r|t>>>r;return i>>>0}ft.rotr64_hi=Um;function $m(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}ft.rotr64_lo=$m;function qm(t,e,r){return t>>>r}ft.shr64_hi=qm;function zm(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}ft.shr64_lo=zm;var Gs={},Sl=ft,km=rs;function no(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Gs.BlockHash=no,no.prototype.update=function(e,r){if(e=Sl.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var i=e.length%this._delta8;this.pending=e.slice(e.length-i,e.length),this.pending.length===0&&(this.pending=null),e=Sl.join32(e,0,e.length-i,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},no.prototype.digest=function(e){return this.update(this._pad()),km(this.pending===null),this._digest(e)},no.prototype._pad=function(){var e=this.pendingTotal,r=this._delta8,i=r-(e+this.padLength)%r,n=new Array(i+this.padLength);n[0]=128;for(var s=1;s<i;s++)n[s]=0;if(e<<=3,this.endian==="big"){for(var o=8;o<this.padLength;o++)n[s++]=0;n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=e>>>24&255,n[s++]=e>>>16&255,n[s++]=e>>>8&255,n[s++]=e&255}else for(n[s++]=e&255,n[s++]=e>>>8&255,n[s++]=e>>>16&255,n[s++]=e>>>24&255,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,o=8;o<this.padLength;o++)n[s++]=0;return n};var Vs={},Ti={},Km=ft,Bi=Km.rotr32;function Hm(t,e,r,i){if(t===0)return Dl(e,r,i);if(t===1||t===3)return Nl(e,r,i);if(t===2)return Il(e,r,i)}Ti.ft_1=Hm;function Dl(t,e,r){return t&e^~t&r}Ti.ch32=Dl;function Il(t,e,r){return t&e^t&r^e&r}Ti.maj32=Il;function Nl(t,e,r){return t^e^r}Ti.p32=Nl;function jm(t){return Bi(t,2)^Bi(t,13)^Bi(t,22)}Ti.s0_256=jm;function Gm(t){return Bi(t,6)^Bi(t,11)^Bi(t,25)}Ti.s1_256=Gm;function Vm(t){return Bi(t,7)^Bi(t,18)^t>>>3}Ti.g0_256=Vm;function Ym(t){return Bi(t,17)^Bi(t,19)^t>>>10}Ti.g1_256=Ym;var Ys=ft,Jm=Gs,Wm=Ti,hh=Ys.rotl32,za=Ys.sum32,Qm=Ys.sum32_5,Xm=Wm.ft_1,Ol=Jm.BlockHash,Zm=[1518500249,1859775393,2400959708,3395469782];function Fi(){if(!(this instanceof Fi))return new Fi;Ol.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Ys.inherits(Fi,Ol);var e4=Fi;Fi.blockSize=512,Fi.outSize=160,Fi.hmacStrength=80,Fi.padLength=64,Fi.prototype._update=function(e,r){for(var i=this.W,n=0;n<16;n++)i[n]=e[r+n];for(;n<i.length;n++)i[n]=hh(i[n-3]^i[n-8]^i[n-14]^i[n-16],1);var s=this.h[0],o=this.h[1],h=this.h[2],l=this.h[3],p=this.h[4];for(n=0;n<i.length;n++){var w=~~(n/20),M=Qm(hh(s,5),Xm(w,o,h,l),p,i[n],Zm[w]);p=l,l=h,h=hh(o,30),o=s,s=M}this.h[0]=za(this.h[0],s),this.h[1]=za(this.h[1],o),this.h[2]=za(this.h[2],h),this.h[3]=za(this.h[3],l),this.h[4]=za(this.h[4],p)},Fi.prototype._digest=function(e){return e==="hex"?Ys.toHex32(this.h,"big"):Ys.split32(this.h,"big")};var Js=ft,t4=Gs,Ws=Ti,r4=rs,wi=Js.sum32,i4=Js.sum32_4,n4=Js.sum32_5,s4=Ws.ch32,a4=Ws.maj32,f4=Ws.s0_256,o4=Ws.s1_256,h4=Ws.g0_256,c4=Ws.g1_256,Rl=t4.BlockHash,u4=[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];function Li(){if(!(this instanceof Li))return new Li;Rl.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=u4,this.W=new Array(64)}Js.inherits(Li,Rl);var Cl=Li;Li.blockSize=512,Li.outSize=256,Li.hmacStrength=192,Li.padLength=64,Li.prototype._update=function(e,r){for(var i=this.W,n=0;n<16;n++)i[n]=e[r+n];for(;n<i.length;n++)i[n]=i4(c4(i[n-2]),i[n-7],h4(i[n-15]),i[n-16]);var s=this.h[0],o=this.h[1],h=this.h[2],l=this.h[3],p=this.h[4],w=this.h[5],M=this.h[6],I=this.h[7];for(r4(this.k.length===i.length),n=0;n<i.length;n++){var D=n4(I,o4(p),s4(p,w,M),this.k[n],i[n]),N=wi(f4(s),a4(s,o,h));I=M,M=w,w=p,p=wi(l,D),l=h,h=o,o=s,s=wi(D,N)}this.h[0]=wi(this.h[0],s),this.h[1]=wi(this.h[1],o),this.h[2]=wi(this.h[2],h),this.h[3]=wi(this.h[3],l),this.h[4]=wi(this.h[4],p),this.h[5]=wi(this.h[5],w),this.h[6]=wi(this.h[6],M),this.h[7]=wi(this.h[7],I)},Li.prototype._digest=function(e){return e==="hex"?Js.toHex32(this.h,"big"):Js.split32(this.h,"big")};var ch=ft,Pl=Cl;function hn(){if(!(this instanceof hn))return new hn;Pl.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}ch.inherits(hn,Pl);var d4=hn;hn.blockSize=512,hn.outSize=224,hn.hmacStrength=192,hn.padLength=64,hn.prototype._digest=function(e){return e==="hex"?ch.toHex32(this.h.slice(0,7),"big"):ch.split32(this.h.slice(0,7),"big")};var Tr=ft,l4=Gs,p4=rs,Ui=Tr.rotr64_hi,$i=Tr.rotr64_lo,Tl=Tr.shr64_hi,Bl=Tr.shr64_lo,On=Tr.sum64,uh=Tr.sum64_hi,dh=Tr.sum64_lo,b4=Tr.sum64_4_hi,v4=Tr.sum64_4_lo,g4=Tr.sum64_5_hi,m4=Tr.sum64_5_lo,Fl=l4.BlockHash,y4=[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];function _i(){if(!(this instanceof _i))return new _i;Fl.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=y4,this.W=new Array(160)}Tr.inherits(_i,Fl);var Ll=_i;_i.blockSize=1024,_i.outSize=512,_i.hmacStrength=192,_i.padLength=128,_i.prototype._prepareBlock=function(e,r){for(var i=this.W,n=0;n<32;n++)i[n]=e[r+n];for(;n<i.length;n+=2){var s=O4(i[n-4],i[n-3]),o=R4(i[n-4],i[n-3]),h=i[n-14],l=i[n-13],p=I4(i[n-30],i[n-29]),w=N4(i[n-30],i[n-29]),M=i[n-32],I=i[n-31];i[n]=b4(s,o,h,l,p,w,M,I),i[n+1]=v4(s,o,h,l,p,w,M,I)}},_i.prototype._update=function(e,r){this._prepareBlock(e,r);var i=this.W,n=this.h[0],s=this.h[1],o=this.h[2],h=this.h[3],l=this.h[4],p=this.h[5],w=this.h[6],M=this.h[7],I=this.h[8],D=this.h[9],N=this.h[10],U=this.h[11],z=this.h[12],H=this.h[13],L=this.h[14],K=this.h[15];p4(this.k.length===i.length);for(var F=0;F<i.length;F+=2){var $=L,q=K,y=S4(I,D),R=D4(I,D),V=w4(I,D,N,U,z),Q=_4(I,D,N,U,z,H),O=this.k[F],d=this.k[F+1],u=i[F],a=i[F+1],f=g4($,q,y,R,V,Q,O,d,u,a),b=m4($,q,y,R,V,Q,O,d,u,a);$=M4(n,s),q=E4(n,s),y=x4(n,s,o,h,l),R=A4(n,s,o,h,l,p);var x=uh($,q,y,R),A=dh($,q,y,R);L=z,K=H,z=N,H=U,N=I,U=D,I=uh(w,M,f,b),D=dh(M,M,f,b),w=l,M=p,l=o,p=h,o=n,h=s,n=uh(f,b,x,A),s=dh(f,b,x,A)}On(this.h,0,n,s),On(this.h,2,o,h),On(this.h,4,l,p),On(this.h,6,w,M),On(this.h,8,I,D),On(this.h,10,N,U),On(this.h,12,z,H),On(this.h,14,L,K)},_i.prototype._digest=function(e){return e==="hex"?Tr.toHex32(this.h,"big"):Tr.split32(this.h,"big")};function w4(t,e,r,i,n){var s=t&r^~t&n;return s<0&&(s+=4294967296),s}function _4(t,e,r,i,n,s){var o=e&i^~e&s;return o<0&&(o+=4294967296),o}function x4(t,e,r,i,n){var s=t&r^t&n^r&n;return s<0&&(s+=4294967296),s}function A4(t,e,r,i,n,s){var o=e&i^e&s^i&s;return o<0&&(o+=4294967296),o}function M4(t,e){var r=Ui(t,e,28),i=Ui(e,t,2),n=Ui(e,t,7),s=r^i^n;return s<0&&(s+=4294967296),s}function E4(t,e){var r=$i(t,e,28),i=$i(e,t,2),n=$i(e,t,7),s=r^i^n;return s<0&&(s+=4294967296),s}function S4(t,e){var r=Ui(t,e,14),i=Ui(t,e,18),n=Ui(e,t,9),s=r^i^n;return s<0&&(s+=4294967296),s}function D4(t,e){var r=$i(t,e,14),i=$i(t,e,18),n=$i(e,t,9),s=r^i^n;return s<0&&(s+=4294967296),s}function I4(t,e){var r=Ui(t,e,1),i=Ui(t,e,8),n=Tl(t,e,7),s=r^i^n;return s<0&&(s+=4294967296),s}function N4(t,e){var r=$i(t,e,1),i=$i(t,e,8),n=Bl(t,e,7),s=r^i^n;return s<0&&(s+=4294967296),s}function O4(t,e){var r=Ui(t,e,19),i=Ui(e,t,29),n=Tl(t,e,6),s=r^i^n;return s<0&&(s+=4294967296),s}function R4(t,e){var r=$i(t,e,19),i=$i(e,t,29),n=Bl(t,e,6),s=r^i^n;return s<0&&(s+=4294967296),s}var lh=ft,Ul=Ll;function cn(){if(!(this instanceof cn))return new cn;Ul.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}lh.inherits(cn,Ul);var C4=cn;cn.blockSize=1024,cn.outSize=384,cn.hmacStrength=192,cn.padLength=128,cn.prototype._digest=function(e){return e==="hex"?lh.toHex32(this.h.slice(0,12),"big"):lh.split32(this.h.slice(0,12),"big")},Vs.sha1=e4,Vs.sha224=d4,Vs.sha256=Cl,Vs.sha384=C4,Vs.sha512=Ll;var $l={},is=ft,P4=Gs,so=is.rotl32,ql=is.sum32,ka=is.sum32_3,zl=is.sum32_4,kl=P4.BlockHash;function qi(){if(!(this instanceof qi))return new qi;kl.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}is.inherits(qi,kl),$l.ripemd160=qi,qi.blockSize=512,qi.outSize=160,qi.hmacStrength=192,qi.padLength=64,qi.prototype._update=function(e,r){for(var i=this.h[0],n=this.h[1],s=this.h[2],o=this.h[3],h=this.h[4],l=i,p=n,w=s,M=o,I=h,D=0;D<80;D++){var N=ql(so(zl(i,Kl(D,n,s,o),e[F4[D]+r],T4(D)),U4[D]),h);i=h,h=o,o=so(s,10),s=n,n=N,N=ql(so(zl(l,Kl(79-D,p,w,M),e[L4[D]+r],B4(D)),$4[D]),I),l=I,I=M,M=so(w,10),w=p,p=N}N=ka(this.h[1],s,M),this.h[1]=ka(this.h[2],o,I),this.h[2]=ka(this.h[3],h,l),this.h[3]=ka(this.h[4],i,p),this.h[4]=ka(this.h[0],n,w),this.h[0]=N},qi.prototype._digest=function(e){return e==="hex"?is.toHex32(this.h,"little"):is.split32(this.h,"little")};function Kl(t,e,r,i){return t<=15?e^r^i:t<=31?e&r|~e&i:t<=47?(e|~r)^i:t<=63?e&i|r&~i:e^(r|~i)}function T4(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function B4(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}var F4=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],L4=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],U4=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],$4=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],q4=ft,z4=rs;function Qs(t,e,r){if(!(this instanceof Qs))return new Qs(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(q4.toArray(e,r))}var k4=Qs;Qs.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),z4(e.length<=this.blockSize);for(var r=e.length;r<this.blockSize;r++)e.push(0);for(r=0;r<e.length;r++)e[r]^=54;for(this.inner=new this.Hash().update(e),r=0;r<e.length;r++)e[r]^=106;this.outer=new this.Hash().update(e)},Qs.prototype.update=function(e,r){return this.inner.update(e,r),this},Qs.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(t){var e=t;e.utils=ft,e.common=Gs,e.sha=Vs,e.ripemd=$l,e.hmac=k4,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(Kr);function Xs(t,e,r){return r={path:e,exports:{},require:function(i,n){return K4(i,n??r.path)}},t(r,r.exports),r.exports}function K4(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var ph=Hl;function Hl(t,e){if(!t)throw new Error(e||"Assertion failed")}Hl.equal=function(e,r,i){if(e!=r)throw new Error(i||"Assertion failed: "+e+" != "+r)};var xi=Xs(function(t,e){var r=e;function i(o,h){if(Array.isArray(o))return o.slice();if(!o)return[];var l=[];if(typeof o!="string"){for(var p=0;p<o.length;p++)l[p]=o[p]|0;return l}if(h==="hex"){o=o.replace(/[^a-z0-9]+/ig,""),o.length%2!==0&&(o="0"+o);for(var p=0;p<o.length;p+=2)l.push(parseInt(o[p]+o[p+1],16))}else for(var p=0;p<o.length;p++){var w=o.charCodeAt(p),M=w>>8,I=w&255;M?l.push(M,I):l.push(I)}return l}r.toArray=i;function n(o){return o.length===1?"0"+o:o}r.zero2=n;function s(o){for(var h="",l=0;l<o.length;l++)h+=n(o[l].toString(16));return h}r.toHex=s,r.encode=function(h,l){return l==="hex"?s(h):h}}),Hr=Xs(function(t,e){var r=e;r.assert=ph,r.toArray=xi.toArray,r.zero2=xi.zero2,r.toHex=xi.toHex,r.encode=xi.encode;function i(l,p,w){var M=new Array(Math.max(l.bitLength(),w)+1);M.fill(0);for(var I=1<<p+1,D=l.clone(),N=0;N<M.length;N++){var U,z=D.andln(I-1);D.isOdd()?(z>(I>>1)-1?U=(I>>1)-z:U=z,D.isubn(U)):U=0,M[N]=U,D.iushrn(1)}return M}r.getNAF=i;function n(l,p){var w=[[],[]];l=l.clone(),p=p.clone();for(var M=0,I=0,D;l.cmpn(-M)>0||p.cmpn(-I)>0;){var N=l.andln(3)+M&3,U=p.andln(3)+I&3;N===3&&(N=-1),U===3&&(U=-1);var z;N&1?(D=l.andln(7)+M&7,(D===3||D===5)&&U===2?z=-N:z=N):z=0,w[0].push(z);var H;U&1?(D=p.andln(7)+I&7,(D===3||D===5)&&N===2?H=-U:H=U):H=0,w[1].push(H),2*M===z+1&&(M=1-M),2*I===H+1&&(I=1-I),l.iushrn(1),p.iushrn(1)}return w}r.getJSF=n;function s(l,p,w){var M="_"+p;l.prototype[p]=function(){return this[M]!==void 0?this[M]:this[M]=w.call(this)}}r.cachedProperty=s;function o(l){return typeof l=="string"?r.toArray(l,"hex"):l}r.parseBytes=o;function h(l){return new Xe(l,"hex","le")}r.intFromLE=h}),ao=Hr.getNAF,H4=Hr.getJSF,fo=Hr.assert;function Rn(t,e){this.type=t,this.p=new Xe(e.p,16),this.red=e.prime?Xe.red(e.prime):Xe.mont(this.p),this.zero=new Xe(0).toRed(this.red),this.one=new Xe(1).toRed(this.red),this.two=new Xe(2).toRed(this.red),this.n=e.n&&new Xe(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var ns=Rn;Rn.prototype.point=function(){throw new Error("Not implemented")},Rn.prototype.validate=function(){throw new Error("Not implemented")},Rn.prototype._fixedNafMul=function(e,r){fo(e.precomputed);var i=e._getDoubles(),n=ao(r,1,this._bitLength),s=(1<<i.step+1)-(i.step%2===0?2:1);s/=3;var o=[],h,l;for(h=0;h<n.length;h+=i.step){l=0;for(var p=h+i.step-1;p>=h;p--)l=(l<<1)+n[p];o.push(l)}for(var w=this.jpoint(null,null,null),M=this.jpoint(null,null,null),I=s;I>0;I--){for(h=0;h<o.length;h++)l=o[h],l===I?M=M.mixedAdd(i.points[h]):l===-I&&(M=M.mixedAdd(i.points[h].neg()));w=w.add(M)}return w.toP()},Rn.prototype._wnafMul=function(e,r){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var s=n.points,o=ao(r,i,this._bitLength),h=this.jpoint(null,null,null),l=o.length-1;l>=0;l--){for(var p=0;l>=0&&o[l]===0;l--)p++;if(l>=0&&p++,h=h.dblp(p),l<0)break;var w=o[l];fo(w!==0),e.type==="affine"?w>0?h=h.mixedAdd(s[w-1>>1]):h=h.mixedAdd(s[-w-1>>1].neg()):w>0?h=h.add(s[w-1>>1]):h=h.add(s[-w-1>>1].neg())}return e.type==="affine"?h.toP():h},Rn.prototype._wnafMulAdd=function(e,r,i,n,s){var o=this._wnafT1,h=this._wnafT2,l=this._wnafT3,p=0,w,M,I;for(w=0;w<n;w++){I=r[w];var D=I._getNAFPoints(e);o[w]=D.wnd,h[w]=D.points}for(w=n-1;w>=1;w-=2){var N=w-1,U=w;if(o[N]!==1||o[U]!==1){l[N]=ao(i[N],o[N],this._bitLength),l[U]=ao(i[U],o[U],this._bitLength),p=Math.max(l[N].length,p),p=Math.max(l[U].length,p);continue}var z=[r[N],null,null,r[U]];r[N].y.cmp(r[U].y)===0?(z[1]=r[N].add(r[U]),z[2]=r[N].toJ().mixedAdd(r[U].neg())):r[N].y.cmp(r[U].y.redNeg())===0?(z[1]=r[N].toJ().mixedAdd(r[U]),z[2]=r[N].add(r[U].neg())):(z[1]=r[N].toJ().mixedAdd(r[U]),z[2]=r[N].toJ().mixedAdd(r[U].neg()));var H=[-3,-1,-5,-7,0,7,5,1,3],L=H4(i[N],i[U]);for(p=Math.max(L[0].length,p),l[N]=new Array(p),l[U]=new Array(p),M=0;M<p;M++){var K=L[0][M]|0,F=L[1][M]|0;l[N][M]=H[(K+1)*3+(F+1)],l[U][M]=0,h[N]=z}}var $=this.jpoint(null,null,null),q=this._wnafT4;for(w=p;w>=0;w--){for(var y=0;w>=0;){var R=!0;for(M=0;M<n;M++)q[M]=l[M][w]|0,q[M]!==0&&(R=!1);if(!R)break;y++,w--}if(w>=0&&y++,$=$.dblp(y),w<0)break;for(M=0;M<n;M++){var V=q[M];V!==0&&(V>0?I=h[M][V-1>>1]:V<0&&(I=h[M][-V-1>>1].neg()),I.type==="affine"?$=$.mixedAdd(I):$=$.add(I))}}for(w=0;w<n;w++)h[w]=null;return s?$:$.toP()};function ti(t,e){this.curve=t,this.type=e,this.precomputed=null}Rn.BasePoint=ti,ti.prototype.eq=function(){throw new Error("Not implemented")},ti.prototype.validate=function(){return this.curve.validate(this)},Rn.prototype.decodePoint=function(e,r){e=Hr.toArray(e,r);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?fo(e[e.length-1]%2===0):e[0]===7&&fo(e[e.length-1]%2===1);var n=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return n}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")},ti.prototype.encodeCompressed=function(e){return this.encode(e,!0)},ti.prototype._encode=function(e){var r=this.curve.p.byteLength(),i=this.getX().toArray("be",r);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",r))},ti.prototype.encode=function(e,r){return Hr.encode(this._encode(r),e)},ti.prototype.precompute=function(e){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,e),r.beta=this._getBeta(),this.precomputed=r,this},ti.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return r?r.points.length>=Math.ceil((e.bitLength()+1)/r.step):!1},ti.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,s=0;s<r;s+=e){for(var o=0;o<e;o++)n=n.dbl();i.push(n)}return{step:e,points:i}},ti.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),s=1;s<i;s++)r[s]=r[s-1].add(n);return{wnd:e,points:r}},ti.prototype._getBeta=function(){return null},ti.prototype.dblp=function(e){for(var r=this,i=0;i<e;i++)r=r.dbl();return r};var bh=Xs(function(t){typeof Object.create=="function"?t.exports=function(r,i){i&&(r.super_=i,r.prototype=Object.create(i.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(r,i){if(i){r.super_=i;var n=function(){};n.prototype=i.prototype,r.prototype=new n,r.prototype.constructor=r}}}),j4=Hr.assert;function ri(t){ns.call(this,"short",t),this.a=new Xe(t.a,16).toRed(this.red),this.b=new Xe(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}bh(ri,ns);var G4=ri;ri.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,i;if(e.beta)r=new Xe(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);r=n[0].cmp(n[1])<0?n[0]:n[1],r=r.toRed(this.red)}if(e.lambda)i=new Xe(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(r))===0?i=s[0]:(i=s[1],j4(this.g.mul(i).x.cmp(this.g.x.redMul(r))===0))}var o;return e.basis?o=e.basis.map(function(h){return{a:new Xe(h.a,16),b:new Xe(h.b,16)}}):o=this._getEndoBasis(i),{beta:r,lambda:i,basis:o}}},ri.prototype._getEndoRoots=function(e){var r=e===this.p?this.red:Xe.mont(e),i=new Xe(2).toRed(r).redInvm(),n=i.redNeg(),s=new Xe(3).toRed(r).redNeg().redSqrt().redMul(i),o=n.redAdd(s).fromRed(),h=n.redSub(s).fromRed();return[o,h]},ri.prototype._getEndoBasis=function(e){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),s=new Xe(1),o=new Xe(0),h=new Xe(0),l=new Xe(1),p,w,M,I,D,N,U,z=0,H,L;i.cmpn(0)!==0;){var K=n.div(i);H=n.sub(K.mul(i)),L=h.sub(K.mul(s));var F=l.sub(K.mul(o));if(!M&&H.cmp(r)<0)p=U.neg(),w=s,M=H.neg(),I=L;else if(M&&++z===2)break;U=H,n=i,i=H,h=s,s=L,l=o,o=F}D=H.neg(),N=L;var $=M.sqr().add(I.sqr()),q=D.sqr().add(N.sqr());return q.cmp($)>=0&&(D=p,N=w),M.negative&&(M=M.neg(),I=I.neg()),D.negative&&(D=D.neg(),N=N.neg()),[{a:M,b:I},{a:D,b:N}]},ri.prototype._endoSplit=function(e){var r=this.endo.basis,i=r[0],n=r[1],s=n.b.mul(e).divRound(this.n),o=i.b.neg().mul(e).divRound(this.n),h=s.mul(i.a),l=o.mul(n.a),p=s.mul(i.b),w=o.mul(n.b),M=e.sub(h).sub(l),I=p.add(w).neg();return{k1:M,k2:I}},ri.prototype.pointFromX=function(e,r){e=new Xe(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var s=n.fromRed().isOdd();return(r&&!s||!r&&s)&&(n=n.redNeg()),this.point(e,n)},ri.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,i=e.y,n=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(s).cmpn(0)===0},ri.prototype._endoWnafMulAdd=function(e,r,i){for(var n=this._endoWnafT1,s=this._endoWnafT2,o=0;o<e.length;o++){var h=this._endoSplit(r[o]),l=e[o],p=l._getBeta();h.k1.negative&&(h.k1.ineg(),l=l.neg(!0)),h.k2.negative&&(h.k2.ineg(),p=p.neg(!0)),n[o*2]=l,n[o*2+1]=p,s[o*2]=h.k1,s[o*2+1]=h.k2}for(var w=this._wnafMulAdd(1,n,s,o*2,i),M=0;M<o*2;M++)n[M]=null,s[M]=null;return w};function qt(t,e,r,i){ns.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Xe(e,16),this.y=new Xe(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}bh(qt,ns.BasePoint),ri.prototype.point=function(e,r,i){return new qt(this,e,r,i)},ri.prototype.pointFromJSON=function(e,r){return qt.fromJSON(this,e,r)},qt.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var r=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,n=function(s){return i.point(s.x.redMul(i.endo.beta),s.y)};e.beta=r,r.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return r}},qt.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},qt.fromJSON=function(e,r,i){typeof r=="string"&&(r=JSON.parse(r));var n=e.point(r[0],r[1],i);if(!r[2])return n;function s(h){return e.point(h[0],h[1],i)}var o=r[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(s))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(s))}},n},qt.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},qt.prototype.isInfinity=function(){return this.inf},qt.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var i=r.redSqr().redISub(this.x).redISub(e.x),n=r.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)},qt.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),s=i.redAdd(i).redIAdd(i).redIAdd(r).redMul(n),o=s.redSqr().redISub(this.x.redAdd(this.x)),h=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,h)},qt.prototype.getX=function(){return this.x.fromRed()},qt.prototype.getY=function(){return this.y.fromRed()},qt.prototype.mul=function(e){return e=new Xe(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},qt.prototype.mulAdd=function(e,r,i){var n=[this,r],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)},qt.prototype.jmulAdd=function(e,r,i){var n=[this,r],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)},qt.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},qt.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(s){return s.neg()};r.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return r},qt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Zt(t,e,r,i){ns.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Xe(0)):(this.x=new Xe(e,16),this.y=new Xe(r,16),this.z=new Xe(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}bh(Zt,ns.BasePoint),ri.prototype.jpoint=function(e,r,i){return new Zt(this,e,r,i)},Zt.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),i=this.x.redMul(r),n=this.y.redMul(r).redMul(e);return this.curve.point(i,n)},Zt.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Zt.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(r),s=e.x.redMul(i),o=this.y.redMul(r.redMul(e.z)),h=e.y.redMul(i.redMul(this.z)),l=n.redSub(s),p=o.redSub(h);if(l.cmpn(0)===0)return p.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var w=l.redSqr(),M=w.redMul(l),I=n.redMul(w),D=p.redSqr().redIAdd(M).redISub(I).redISub(I),N=p.redMul(I.redISub(D)).redISub(o.redMul(M)),U=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(D,N,U)},Zt.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),i=this.x,n=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),h=i.redSub(n),l=s.redSub(o);if(h.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var p=h.redSqr(),w=p.redMul(h),M=i.redMul(p),I=l.redSqr().redIAdd(w).redISub(M).redISub(M),D=l.redMul(M.redISub(I)).redISub(s.redMul(w)),N=this.z.redMul(h);return this.curve.jpoint(I,D,N)},Zt.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var i=this;for(r=0;r<e;r++)i=i.dbl();return i}var n=this.curve.a,s=this.curve.tinv,o=this.x,h=this.y,l=this.z,p=l.redSqr().redSqr(),w=h.redAdd(h);for(r=0;r<e;r++){var M=o.redSqr(),I=w.redSqr(),D=I.redSqr(),N=M.redAdd(M).redIAdd(M).redIAdd(n.redMul(p)),U=o.redMul(I),z=N.redSqr().redISub(U.redAdd(U)),H=U.redISub(z),L=N.redMul(H);L=L.redIAdd(L).redISub(D);var K=w.redMul(l);r+1<e&&(p=p.redMul(D)),o=z,l=K,w=L}return this.curve.jpoint(o,w.redMul(s),l)},Zt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Zt.prototype._zeroDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),o=s.redSqr(),h=this.x.redAdd(s).redSqr().redISub(n).redISub(o);h=h.redIAdd(h);var l=n.redAdd(n).redIAdd(n),p=l.redSqr().redISub(h).redISub(h),w=o.redIAdd(o);w=w.redIAdd(w),w=w.redIAdd(w),e=p,r=l.redMul(h.redISub(p)).redISub(w),i=this.y.redAdd(this.y)}else{var M=this.x.redSqr(),I=this.y.redSqr(),D=I.redSqr(),N=this.x.redAdd(I).redSqr().redISub(M).redISub(D);N=N.redIAdd(N);var U=M.redAdd(M).redIAdd(M),z=U.redSqr(),H=D.redIAdd(D);H=H.redIAdd(H),H=H.redIAdd(H),e=z.redISub(N).redISub(N),r=U.redMul(N.redISub(e)).redISub(H),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,r,i)},Zt.prototype._threeDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),o=s.redSqr(),h=this.x.redAdd(s).redSqr().redISub(n).redISub(o);h=h.redIAdd(h);var l=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),p=l.redSqr().redISub(h).redISub(h);e=p;var w=o.redIAdd(o);w=w.redIAdd(w),w=w.redIAdd(w),r=l.redMul(h.redISub(p)).redISub(w),i=this.y.redAdd(this.y)}else{var M=this.z.redSqr(),I=this.y.redSqr(),D=this.x.redMul(I),N=this.x.redSub(M).redMul(this.x.redAdd(M));N=N.redAdd(N).redIAdd(N);var U=D.redIAdd(D);U=U.redIAdd(U);var z=U.redAdd(U);e=N.redSqr().redISub(z),i=this.y.redAdd(this.z).redSqr().redISub(I).redISub(M);var H=I.redSqr();H=H.redIAdd(H),H=H.redIAdd(H),H=H.redIAdd(H),r=N.redMul(U.redISub(e)).redISub(H)}return this.curve.jpoint(e,r,i)},Zt.prototype._dbl=function(){var e=this.curve.a,r=this.x,i=this.y,n=this.z,s=n.redSqr().redSqr(),o=r.redSqr(),h=i.redSqr(),l=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(s)),p=r.redAdd(r);p=p.redIAdd(p);var w=p.redMul(h),M=l.redSqr().redISub(w.redAdd(w)),I=w.redISub(M),D=h.redSqr();D=D.redIAdd(D),D=D.redIAdd(D),D=D.redIAdd(D);var N=l.redMul(I).redISub(D),U=i.redAdd(i).redMul(n);return this.curve.jpoint(M,N,U)},Zt.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),r=this.y.redSqr(),i=this.z.redSqr(),n=r.redSqr(),s=e.redAdd(e).redIAdd(e),o=s.redSqr(),h=this.x.redAdd(r).redSqr().redISub(e).redISub(n);h=h.redIAdd(h),h=h.redAdd(h).redIAdd(h),h=h.redISub(o);var l=h.redSqr(),p=n.redIAdd(n);p=p.redIAdd(p),p=p.redIAdd(p),p=p.redIAdd(p);var w=s.redIAdd(h).redSqr().redISub(o).redISub(l).redISub(p),M=r.redMul(w);M=M.redIAdd(M),M=M.redIAdd(M);var I=this.x.redMul(l).redISub(M);I=I.redIAdd(I),I=I.redIAdd(I);var D=this.y.redMul(w.redMul(p.redISub(w)).redISub(h.redMul(l)));D=D.redIAdd(D),D=D.redIAdd(D),D=D.redIAdd(D);var N=this.z.redAdd(h).redSqr().redISub(i).redISub(l);return this.curve.jpoint(I,D,N)},Zt.prototype.mul=function(e,r){return e=new Xe(e,r),this.curve._wnafMul(this,e)},Zt.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var r=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(r)).cmpn(0)!==0)return!1;var n=r.redMul(this.z),s=i.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0},Zt.prototype.eqXToP=function(e){var r=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(r);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(r);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(s),this.x.cmp(i)===0)return!0}},Zt.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},Zt.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var oo=Xs(function(t,e){var r=e;r.base=ns,r.short=G4,r.mont=null,r.edwards=null}),ho=Xs(function(t,e){var r=e,i=Hr.assert;function n(h){h.type==="short"?this.curve=new oo.short(h):h.type==="edwards"?this.curve=new oo.edwards(h):this.curve=new oo.mont(h),this.g=this.curve.g,this.n=this.curve.n,this.hash=h.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=n;function s(h,l){Object.defineProperty(r,h,{configurable:!0,enumerable:!0,get:function(){var p=new n(l);return Object.defineProperty(r,h,{configurable:!0,enumerable:!0,value:p}),p}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Kr.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Kr.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Kr.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Kr.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Kr.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Kr.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Kr.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Kr.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function Cn(t){if(!(this instanceof Cn))return new Cn(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=xi.toArray(t.entropy,t.entropyEnc||"hex"),r=xi.toArray(t.nonce,t.nonceEnc||"hex"),i=xi.toArray(t.pers,t.persEnc||"hex");ph(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var jl=Cn;Cn.prototype._init=function(e,r,i){var n=e.concat(r).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},Cn.prototype._hmac=function(){return new Kr.hmac(this.hash,this.K)},Cn.prototype._update=function(e){var r=this._hmac().update(this.V).update([0]);e&&(r=r.update(e)),this.K=r.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},Cn.prototype.reseed=function(e,r,i,n){typeof r!="string"&&(n=i,i=r,r=null),e=xi.toArray(e,r),i=xi.toArray(i,n),ph(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1},Cn.prototype.generate=function(e,r,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(n=i,i=r,r=null),i&&(i=xi.toArray(i,n||"hex"),this._update(i));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var o=s.slice(0,e);return this._update(i),this._reseed++,xi.encode(o,r)};var vh=Hr.assert;function gr(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var gh=gr;gr.fromPublic=function(e,r,i){return r instanceof gr?r:new gr(e,{pub:r,pubEnc:i})},gr.fromPrivate=function(e,r,i){return r instanceof gr?r:new gr(e,{priv:r,privEnc:i})},gr.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},gr.prototype.getPublic=function(e,r){return typeof e=="string"&&(r=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,e):this.pub},gr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},gr.prototype._importPrivate=function(e,r){this.priv=new Xe(e,r||16),this.priv=this.priv.umod(this.ec.curve.n)},gr.prototype._importPublic=function(e,r){if(e.x||e.y){this.ec.curve.type==="mont"?vh(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&vh(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,r)},gr.prototype.derive=function(e){return e.validate()||vh(e.validate(),"public point not validated"),e.mul(this.priv).getX()},gr.prototype.sign=function(e,r,i){return this.ec.sign(e,this,r,i)},gr.prototype.verify=function(e,r){return this.ec.verify(e,r,this)},gr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var V4=Hr.assert;function co(t,e){if(t instanceof co)return t;this._importDER(t,e)||(V4(t.r&&t.s,"Signature without r or s"),this.r=new Xe(t.r,16),this.s=new Xe(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var uo=co;function Y4(){this.place=0}function mh(t,e){var r=t[e.place++];if(!(r&128))return r;var i=r&15;if(i===0||i>4)return!1;for(var n=0,s=0,o=e.place;s<i;s++,o++)n<<=8,n|=t[o],n>>>=0;return n<=127?!1:(e.place=o,n)}function Gl(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}co.prototype._importDER=function(e,r){e=Hr.toArray(e,r);var i=new Y4;if(e[i.place++]!==48)return!1;var n=mh(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var s=mh(e,i);if(s===!1)return!1;var o=e.slice(i.place,s+i.place);if(i.place+=s,e[i.place++]!==2)return!1;var h=mh(e,i);if(h===!1||e.length!==h+i.place)return!1;var l=e.slice(i.place,h+i.place);if(o[0]===0)if(o[1]&128)o=o.slice(1);else return!1;if(l[0]===0)if(l[1]&128)l=l.slice(1);else return!1;return this.r=new Xe(o),this.s=new Xe(l),this.recoveryParam=null,!0};function yh(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}co.prototype.toDER=function(e){var r=this.r.toArray(),i=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),i[0]&128&&(i=[0].concat(i)),r=Gl(r),i=Gl(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];yh(n,r.length),n=n.concat(r),n.push(2),yh(n,i.length);var s=n.concat(i),o=[48];return yh(o,s.length),o=o.concat(s),Hr.encode(o,e)};var J4=function(){throw new Error("unsupported")},Vl=Hr.assert;function ii(t){if(!(this instanceof ii))return new ii(t);typeof t=="string"&&(Vl(Object.prototype.hasOwnProperty.call(ho,t),"Unknown curve "+t),t=ho[t]),t instanceof ho.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var W4=ii;ii.prototype.keyPair=function(e){return new gh(this,e)},ii.prototype.keyFromPrivate=function(e,r){return gh.fromPrivate(this,e,r)},ii.prototype.keyFromPublic=function(e,r){return gh.fromPublic(this,e,r)},ii.prototype.genKeyPair=function(e){e||(e={});for(var r=new jl({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||J4(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new Xe(2));;){var s=new Xe(r.generate(i));if(!(s.cmp(n)>0))return s.iaddn(1),this.keyFromPrivate(s)}},ii.prototype._truncateToN=function(e,r){var i=e.byteLength()*8-this.n.bitLength();return i>0&&(e=e.ushrn(i)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},ii.prototype.sign=function(e,r,i,n){typeof i=="object"&&(n=i,i=null),n||(n={}),r=this.keyFromPrivate(r,i),e=this._truncateToN(new Xe(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),h=e.toArray("be",s),l=new jl({hash:this.hash,entropy:o,nonce:h,pers:n.pers,persEnc:n.persEnc||"utf8"}),p=this.n.sub(new Xe(1)),w=0;;w++){var M=n.k?n.k(w):new Xe(l.generate(this.n.byteLength()));if(M=this._truncateToN(M,!0),!(M.cmpn(1)<=0||M.cmp(p)>=0)){var I=this.g.mul(M);if(!I.isInfinity()){var D=I.getX(),N=D.umod(this.n);if(N.cmpn(0)!==0){var U=M.invm(this.n).mul(N.mul(r.getPrivate()).iadd(e));if(U=U.umod(this.n),U.cmpn(0)!==0){var z=(I.getY().isOdd()?1:0)|(D.cmp(N)!==0?2:0);return n.canonical&&U.cmp(this.nh)>0&&(U=this.n.sub(U),z^=1),new uo({r:N,s:U,recoveryParam:z})}}}}}},ii.prototype.verify=function(e,r,i,n){e=this._truncateToN(new Xe(e,16)),i=this.keyFromPublic(i,n),r=new uo(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var h=o.invm(this.n),l=h.mul(e).umod(this.n),p=h.mul(s).umod(this.n),w;return this.curve._maxwellTrick?(w=this.g.jmulAdd(l,i.getPublic(),p),w.isInfinity()?!1:w.eqXToP(s)):(w=this.g.mulAdd(l,i.getPublic(),p),w.isInfinity()?!1:w.getX().umod(this.n).cmp(s)===0)},ii.prototype.recoverPubKey=function(t,e,r,i){Vl((3&r)===r,"The recovery param is more than two bits"),e=new uo(e,i);var n=this.n,s=new Xe(t),o=e.r,h=e.s,l=r&1,p=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&p)throw new Error("Unable to find sencond key candinate");p?o=this.curve.pointFromX(o.add(this.curve.n),l):o=this.curve.pointFromX(o,l);var w=e.r.invm(n),M=n.sub(s).mul(w).umod(n),I=h.mul(w).umod(n);return this.g.mulAdd(M,o,I)},ii.prototype.getKeyRecoveryParam=function(t,e,r,i){if(e=new uo(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(t,e,n)}catch{continue}if(s.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var Q4=Xs(function(t,e){var r=e;r.version="6.5.4",r.utils=Hr,r.rand=function(){throw new Error("unsupported")},r.curve=oo,r.curves=ho,r.ec=W4,r.eddsa=null}),X4=Q4.ec;const Z4="signing-key/5.7.0",wh=new rt(Z4);let _h=null;function zi(){return _h||(_h=new X4("secp256k1")),_h}class ey{constructor(e){qa(this,"curve","secp256k1"),qa(this,"privateKey",Mr(e)),$8(this.privateKey)!==32&&wh.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=zi().keyFromPrivate(It(this.privateKey));qa(this,"publicKey","0x"+r.getPublic(!1,"hex")),qa(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),qa(this,"_isSigningKey",!0)}_addPoint(e){const r=zi().keyFromPublic(It(this.publicKey)),i=zi().keyFromPublic(It(e));return"0x"+r.pub.add(i.pub).encodeCompressed("hex")}signDigest(e){const r=zi().keyFromPrivate(It(this.privateKey)),i=It(e);i.length!==32&&wh.throwArgumentError("bad digest length","digest",e);const n=r.sign(i,{canonical:!0});return il({recoveryParam:n.recoveryParam,r:Pi("0x"+n.r.toString(16),32),s:Pi("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const r=zi().keyFromPrivate(It(this.privateKey)),i=zi().keyFromPublic(It(Yl(e)));return Pi("0x"+r.derive(i.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function ty(t,e){const r=il(e),i={r:It(r.r),s:It(r.s)};return"0x"+zi().recoverPubKey(It(t),i,r.recoveryParam).encode("hex",!1)}function Yl(t,e){const r=It(t);if(r.length===32){const i=new ey(r);return e?"0x"+zi().keyFromPrivate(r).getPublic(!0,"hex"):i.publicKey}else{if(r.length===33)return e?Mr(r):"0x"+zi().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+zi().keyFromPublic(r).getPublic(!0,"hex"):Mr(r)}return wh.throwArgumentError("invalid public or private key","key","[REDACTED]")}const ry="transactions/5.7.0";new rt(ry);var Jl;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Jl||(Jl={}));function iy(t){const e=Yl(t);return lm(rl(rh(rl(e,1)),12))}function ny(t,e){return iy(ty(It(t),e))}var xh={},lo={};Object.defineProperty(lo,"__esModule",{value:!0});var mr=et,Ah=zr,sy=20;function ay(t,e,r){for(var i=1634760805,n=857760878,s=2036477234,o=1797285236,h=r[3]<<24|r[2]<<16|r[1]<<8|r[0],l=r[7]<<24|r[6]<<16|r[5]<<8|r[4],p=r[11]<<24|r[10]<<16|r[9]<<8|r[8],w=r[15]<<24|r[14]<<16|r[13]<<8|r[12],M=r[19]<<24|r[18]<<16|r[17]<<8|r[16],I=r[23]<<24|r[22]<<16|r[21]<<8|r[20],D=r[27]<<24|r[26]<<16|r[25]<<8|r[24],N=r[31]<<24|r[30]<<16|r[29]<<8|r[28],U=e[3]<<24|e[2]<<16|e[1]<<8|e[0],z=e[7]<<24|e[6]<<16|e[5]<<8|e[4],H=e[11]<<24|e[10]<<16|e[9]<<8|e[8],L=e[15]<<24|e[14]<<16|e[13]<<8|e[12],K=i,F=n,$=s,q=o,y=h,R=l,V=p,Q=w,O=M,d=I,u=D,a=N,f=U,b=z,x=H,A=L,_=0;_<sy;_+=2)K=K+y|0,f^=K,f=f>>>32-16|f<<16,O=O+f|0,y^=O,y=y>>>32-12|y<<12,F=F+R|0,b^=F,b=b>>>32-16|b<<16,d=d+b|0,R^=d,R=R>>>32-12|R<<12,$=$+V|0,x^=$,x=x>>>32-16|x<<16,u=u+x|0,V^=u,V=V>>>32-12|V<<12,q=q+Q|0,A^=q,A=A>>>32-16|A<<16,a=a+A|0,Q^=a,Q=Q>>>32-12|Q<<12,$=$+V|0,x^=$,x=x>>>32-8|x<<8,u=u+x|0,V^=u,V=V>>>32-7|V<<7,q=q+Q|0,A^=q,A=A>>>32-8|A<<8,a=a+A|0,Q^=a,Q=Q>>>32-7|Q<<7,F=F+R|0,b^=F,b=b>>>32-8|b<<8,d=d+b|0,R^=d,R=R>>>32-7|R<<7,K=K+y|0,f^=K,f=f>>>32-8|f<<8,O=O+f|0,y^=O,y=y>>>32-7|y<<7,K=K+R|0,A^=K,A=A>>>32-16|A<<16,u=u+A|0,R^=u,R=R>>>32-12|R<<12,F=F+V|0,f^=F,f=f>>>32-16|f<<16,a=a+f|0,V^=a,V=V>>>32-12|V<<12,$=$+Q|0,b^=$,b=b>>>32-16|b<<16,O=O+b|0,Q^=O,Q=Q>>>32-12|Q<<12,q=q+y|0,x^=q,x=x>>>32-16|x<<16,d=d+x|0,y^=d,y=y>>>32-12|y<<12,$=$+Q|0,b^=$,b=b>>>32-8|b<<8,O=O+b|0,Q^=O,Q=Q>>>32-7|Q<<7,q=q+y|0,x^=q,x=x>>>32-8|x<<8,d=d+x|0,y^=d,y=y>>>32-7|y<<7,F=F+V|0,f^=F,f=f>>>32-8|f<<8,a=a+f|0,V^=a,V=V>>>32-7|V<<7,K=K+R|0,A^=K,A=A>>>32-8|A<<8,u=u+A|0,R^=u,R=R>>>32-7|R<<7;mr.writeUint32LE(K+i|0,t,0),mr.writeUint32LE(F+n|0,t,4),mr.writeUint32LE($+s|0,t,8),mr.writeUint32LE(q+o|0,t,12),mr.writeUint32LE(y+h|0,t,16),mr.writeUint32LE(R+l|0,t,20),mr.writeUint32LE(V+p|0,t,24),mr.writeUint32LE(Q+w|0,t,28),mr.writeUint32LE(O+M|0,t,32),mr.writeUint32LE(d+I|0,t,36),mr.writeUint32LE(u+D|0,t,40),mr.writeUint32LE(a+N|0,t,44),mr.writeUint32LE(f+U|0,t,48),mr.writeUint32LE(b+z|0,t,52),mr.writeUint32LE(x+H|0,t,56),mr.writeUint32LE(A+L|0,t,60)}function Wl(t,e,r,i,n){if(n===void 0&&(n=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<r.length)throw new Error("ChaCha: destination is shorter than source");var s,o;if(n===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=new Uint8Array(16),o=s.length-e.length,s.set(e,o)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,o=n}for(var h=new Uint8Array(64),l=0;l<r.length;l+=64){ay(h,s,t);for(var p=l;p<l+64&&p<r.length;p++)i[p]=r[p]^h[p-l];oy(s,0,o)}return Ah.wipe(h),n===0&&Ah.wipe(s),i}lo.streamXOR=Wl;function fy(t,e,r,i){return i===void 0&&(i=0),Ah.wipe(r),Wl(t,e,r,r,i)}lo.stream=fy;function oy(t,e,r){for(var i=1;r--;)i=i+(t[e]&255)|0,t[e]=i&255,i>>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}var Ql={},Pn={};Object.defineProperty(Pn,"__esModule",{value:!0});function hy(t,e,r){return~(t-1)&e|t-1&r}Pn.select=hy;function cy(t,e){return(t|0)-(e|0)-1>>>31&1}Pn.lessOrEqual=cy;function Xl(t,e){if(t.length!==e.length)return 0;for(var r=0,i=0;i<t.length;i++)r|=t[i]^e[i];return 1&r-1>>>8}Pn.compare=Xl;function uy(t,e){return t.length===0||e.length===0?!1:Xl(t,e)!==0}Pn.equal=uy,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Pn,r=zr;t.DIGEST_LENGTH=16;var i=function(){function o(h){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var l=h[0]|h[1]<<8;this._r[0]=l&8191;var p=h[2]|h[3]<<8;this._r[1]=(l>>>13|p<<3)&8191;var w=h[4]|h[5]<<8;this._r[2]=(p>>>10|w<<6)&7939;var M=h[6]|h[7]<<8;this._r[3]=(w>>>7|M<<9)&8191;var I=h[8]|h[9]<<8;this._r[4]=(M>>>4|I<<12)&255,this._r[5]=I>>>1&8190;var D=h[10]|h[11]<<8;this._r[6]=(I>>>14|D<<2)&8191;var N=h[12]|h[13]<<8;this._r[7]=(D>>>11|N<<5)&8065;var U=h[14]|h[15]<<8;this._r[8]=(N>>>8|U<<8)&8191,this._r[9]=U>>>5&127,this._pad[0]=h[16]|h[17]<<8,this._pad[1]=h[18]|h[19]<<8,this._pad[2]=h[20]|h[21]<<8,this._pad[3]=h[22]|h[23]<<8,this._pad[4]=h[24]|h[25]<<8,this._pad[5]=h[26]|h[27]<<8,this._pad[6]=h[28]|h[29]<<8,this._pad[7]=h[30]|h[31]<<8}return o.prototype._blocks=function(h,l,p){for(var w=this._fin?0:2048,M=this._h[0],I=this._h[1],D=this._h[2],N=this._h[3],U=this._h[4],z=this._h[5],H=this._h[6],L=this._h[7],K=this._h[8],F=this._h[9],$=this._r[0],q=this._r[1],y=this._r[2],R=this._r[3],V=this._r[4],Q=this._r[5],O=this._r[6],d=this._r[7],u=this._r[8],a=this._r[9];p>=16;){var f=h[l+0]|h[l+1]<<8;M+=f&8191;var b=h[l+2]|h[l+3]<<8;I+=(f>>>13|b<<3)&8191;var x=h[l+4]|h[l+5]<<8;D+=(b>>>10|x<<6)&8191;var A=h[l+6]|h[l+7]<<8;N+=(x>>>7|A<<9)&8191;var _=h[l+8]|h[l+9]<<8;U+=(A>>>4|_<<12)&8191,z+=_>>>1&8191;var c=h[l+10]|h[l+11]<<8;H+=(_>>>14|c<<2)&8191;var m=h[l+12]|h[l+13]<<8;L+=(c>>>11|m<<5)&8191;var v=h[l+14]|h[l+15]<<8;K+=(m>>>8|v<<8)&8191,F+=v>>>5|w;var S=0,G=S;G+=M*$,G+=I*(5*a),G+=D*(5*u),G+=N*(5*d),G+=U*(5*O),S=G>>>13,G&=8191,G+=z*(5*Q),G+=H*(5*V),G+=L*(5*R),G+=K*(5*y),G+=F*(5*q),S+=G>>>13,G&=8191;var E=S;E+=M*q,E+=I*$,E+=D*(5*a),E+=N*(5*u),E+=U*(5*d),S=E>>>13,E&=8191,E+=z*(5*O),E+=H*(5*Q),E+=L*(5*V),E+=K*(5*R),E+=F*(5*y),S+=E>>>13,E&=8191;var k=S;k+=M*y,k+=I*q,k+=D*$,k+=N*(5*a),k+=U*(5*u),S=k>>>13,k&=8191,k+=z*(5*d),k+=H*(5*O),k+=L*(5*Q),k+=K*(5*V),k+=F*(5*R),S+=k>>>13,k&=8191;var C=S;C+=M*R,C+=I*y,C+=D*q,C+=N*$,C+=U*(5*a),S=C>>>13,C&=8191,C+=z*(5*u),C+=H*(5*d),C+=L*(5*O),C+=K*(5*Q),C+=F*(5*V),S+=C>>>13,C&=8191;var B=S;B+=M*V,B+=I*R,B+=D*y,B+=N*q,B+=U*$,S=B>>>13,B&=8191,B+=z*(5*a),B+=H*(5*u),B+=L*(5*d),B+=K*(5*O),B+=F*(5*Q),S+=B>>>13,B&=8191;var P=S;P+=M*Q,P+=I*V,P+=D*R,P+=N*y,P+=U*q,S=P>>>13,P&=8191,P+=z*$,P+=H*(5*a),P+=L*(5*u),P+=K*(5*d),P+=F*(5*O),S+=P>>>13,P&=8191;var g=S;g+=M*O,g+=I*Q,g+=D*V,g+=N*R,g+=U*y,S=g>>>13,g&=8191,g+=z*q,g+=H*$,g+=L*(5*a),g+=K*(5*u),g+=F*(5*d),S+=g>>>13,g&=8191;var T=S;T+=M*d,T+=I*O,T+=D*Q,T+=N*V,T+=U*R,S=T>>>13,T&=8191,T+=z*y,T+=H*q,T+=L*$,T+=K*(5*a),T+=F*(5*u),S+=T>>>13,T&=8191;var j=S;j+=M*u,j+=I*d,j+=D*O,j+=N*Q,j+=U*V,S=j>>>13,j&=8191,j+=z*R,j+=H*y,j+=L*q,j+=K*$,j+=F*(5*a),S+=j>>>13,j&=8191;var J=S;J+=M*a,J+=I*u,J+=D*d,J+=N*O,J+=U*Q,S=J>>>13,J&=8191,J+=z*V,J+=H*R,J+=L*y,J+=K*q,J+=F*$,S+=J>>>13,J&=8191,S=(S<<2)+S|0,S=S+G|0,G=S&8191,S=S>>>13,E+=S,M=G,I=E,D=k,N=C,U=B,z=P,H=g,L=T,K=j,F=J,l+=16,p-=16}this._h[0]=M,this._h[1]=I,this._h[2]=D,this._h[3]=N,this._h[4]=U,this._h[5]=z,this._h[6]=H,this._h[7]=L,this._h[8]=K,this._h[9]=F},o.prototype.finish=function(h,l){l===void 0&&(l=0);var p=new Uint16Array(10),w,M,I,D;if(this._leftover){for(D=this._leftover,this._buffer[D++]=1;D<16;D++)this._buffer[D]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(w=this._h[1]>>>13,this._h[1]&=8191,D=2;D<10;D++)this._h[D]+=w,w=this._h[D]>>>13,this._h[D]&=8191;for(this._h[0]+=w*5,w=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=w,w=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=w,p[0]=this._h[0]+5,w=p[0]>>>13,p[0]&=8191,D=1;D<10;D++)p[D]=this._h[D]+w,w=p[D]>>>13,p[D]&=8191;for(p[9]-=8192,M=(w^1)-1,D=0;D<10;D++)p[D]&=M;for(M=~M,D=0;D<10;D++)this._h[D]=this._h[D]&M|p[D];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,I=this._h[0]+this._pad[0],this._h[0]=I&65535,D=1;D<8;D++)I=(this._h[D]+this._pad[D]|0)+(I>>>16)|0,this._h[D]=I&65535;return h[l+0]=this._h[0]>>>0,h[l+1]=this._h[0]>>>8,h[l+2]=this._h[1]>>>0,h[l+3]=this._h[1]>>>8,h[l+4]=this._h[2]>>>0,h[l+5]=this._h[2]>>>8,h[l+6]=this._h[3]>>>0,h[l+7]=this._h[3]>>>8,h[l+8]=this._h[4]>>>0,h[l+9]=this._h[4]>>>8,h[l+10]=this._h[5]>>>0,h[l+11]=this._h[5]>>>8,h[l+12]=this._h[6]>>>0,h[l+13]=this._h[6]>>>8,h[l+14]=this._h[7]>>>0,h[l+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(h){var l=0,p=h.length,w;if(this._leftover){w=16-this._leftover,w>p&&(w=p);for(var M=0;M<w;M++)this._buffer[this._leftover+M]=h[l+M];if(p-=w,l+=w,this._leftover+=w,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(p>=16&&(w=p-p%16,this._blocks(h,l,w),l+=w,p-=w),p){for(var M=0;M<p;M++)this._buffer[this._leftover+M]=h[l+M];this._leftover+=p}return this},o.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var h=new Uint8Array(16);return this.finish(h),h},o.prototype.clean=function(){return r.wipe(this._buffer),r.wipe(this._r),r.wipe(this._h),r.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},o}();t.Poly1305=i;function n(o,h){var l=new i(o);l.update(h);var p=l.digest();return l.clean(),p}t.oneTimeAuth=n;function s(o,h){return o.length!==t.DIGEST_LENGTH||h.length!==t.DIGEST_LENGTH?!1:e.equal(o,h)}t.equal=s}(Ql),function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=lo,r=Ql,i=zr,n=et,s=Pn;t.KEY_LENGTH=32,t.NONCE_LENGTH=12,t.TAG_LENGTH=16;var o=new Uint8Array(16),h=function(){function l(p){if(this.nonceLength=t.NONCE_LENGTH,this.tagLength=t.TAG_LENGTH,p.length!==t.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(p)}return l.prototype.seal=function(p,w,M,I){if(p.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var D=new Uint8Array(16);D.set(p,D.length-p.length);var N=new Uint8Array(32);e.stream(this._key,D,N,4);var U=w.length+this.tagLength,z;if(I){if(I.length!==U)throw new Error("ChaCha20Poly1305: incorrect destination length");z=I}else z=new Uint8Array(U);return e.streamXOR(this._key,D,w,z,4),this._authenticate(z.subarray(z.length-this.tagLength,z.length),N,z.subarray(0,z.length-this.tagLength),M),i.wipe(D),z},l.prototype.open=function(p,w,M,I){if(p.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(w.length<this.tagLength)return null;var D=new Uint8Array(16);D.set(p,D.length-p.length);var N=new Uint8Array(32);e.stream(this._key,D,N,4);var U=new Uint8Array(this.tagLength);if(this._authenticate(U,N,w.subarray(0,w.length-this.tagLength),M),!s.equal(U,w.subarray(w.length-this.tagLength,w.length)))return null;var z=w.length-this.tagLength,H;if(I){if(I.length!==z)throw new Error("ChaCha20Poly1305: incorrect destination length");H=I}else H=new Uint8Array(z);return e.streamXOR(this._key,D,w.subarray(0,w.length-this.tagLength),H,4),i.wipe(D),H},l.prototype.clean=function(){return i.wipe(this._key),this},l.prototype._authenticate=function(p,w,M,I){var D=new r.Poly1305(w);I&&(D.update(I),I.length%16>0&&D.update(o.subarray(I.length%16))),D.update(M),M.length%16>0&&D.update(o.subarray(M.length%16));var N=new Uint8Array(8);I&&n.writeUint64LE(I.length,N),D.update(N),n.writeUint64LE(M.length,N),D.update(N);for(var U=D.digest(),z=0;z<U.length;z++)p[z]=U[z];D.clean(),i.wipe(U),i.wipe(N)},l}();t.ChaCha20Poly1305=h}(xh);var Zl={},Ka={},Mh={};Object.defineProperty(Mh,"__esModule",{value:!0});function dy(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}Mh.isSerializableHash=dy,Object.defineProperty(Ka,"__esModule",{value:!0});var ki=Mh,ly=Pn,py=zr,e1=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(i).clean():i.set(r);for(var n=0;n<i.length;n++)i[n]^=54;this._inner.update(i);for(var n=0;n<i.length;n++)i[n]^=106;this._outer.update(i),ki.isSerializableHash(this._inner)&&ki.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),py.wipe(i)}return t.prototype.reset=function(){if(!ki.isSerializableHash(this._inner)||!ki.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.clean=function(){ki.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),ki.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},t.prototype.update=function(e){return this._inner.update(e),this},t.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype.saveState=function(){if(!ki.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},t.prototype.restoreState=function(e){if(!ki.isSerializableHash(this._inner)||!ki.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.cleanSavedState=function(e){if(!ki.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},t}();Ka.HMAC=e1;function by(t,e,r){var i=new e1(t,e);i.update(r);var n=i.digest();return i.clean(),n}Ka.hmac=by,Ka.equal=ly.equal,Object.defineProperty(Zl,"__esModule",{value:!0});var t1=Ka,r1=zr,vy=function(){function t(e,r,i,n){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=t1.hmac(this._hash,i,r);this._hmac=new t1.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),i=0;i<r.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),r[i]=this._buffer[this._bufpos++];return r},t.prototype.clean=function(){this._hmac.clean(),r1.wipe(this._buffer),r1.wipe(this._counter),this._bufpos=0},t}(),gy=Zl.HKDF=vy,Ha={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=et,r=zr;t.DIGEST_LENGTH=32,t.BLOCK_SIZE=64;var i=function(){function h(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return h.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},h.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},h.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._temp),this.reset()},h.prototype.update=function(l,p){if(p===void 0&&(p=l.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var w=0;if(this._bytesHashed+=p,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&p>0;)this._buffer[this._bufferLength++]=l[w++],p--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(p>=this.blockSize&&(w=s(this._temp,this._state,l,w,p),p%=this.blockSize);p>0;)this._buffer[this._bufferLength++]=l[w++],p--;return this},h.prototype.finish=function(l){if(!this._finished){var p=this._bytesHashed,w=this._bufferLength,M=p/536870912|0,I=p<<3,D=p%64<56?64:128;this._buffer[w]=128;for(var N=w+1;N<D-8;N++)this._buffer[N]=0;e.writeUint32BE(M,this._buffer,D-8),e.writeUint32BE(I,this._buffer,D-4),s(this._temp,this._state,this._buffer,0,D),this._finished=!0}for(var N=0;N<this.digestLength/4;N++)e.writeUint32BE(this._state[N],l,N*4);return this},h.prototype.digest=function(){var l=new Uint8Array(this.digestLength);return this.finish(l),l},h.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},h.prototype.restoreState=function(l){return this._state.set(l.state),this._bufferLength=l.bufferLength,l.buffer&&this._buffer.set(l.buffer),this._bytesHashed=l.bytesHashed,this._finished=!1,this},h.prototype.cleanSavedState=function(l){r.wipe(l.state),l.buffer&&r.wipe(l.buffer),l.bufferLength=0,l.bytesHashed=0},h}();t.SHA256=i;var n=new Int32Array([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]);function s(h,l,p,w,M){for(;M>=64;){for(var I=l[0],D=l[1],N=l[2],U=l[3],z=l[4],H=l[5],L=l[6],K=l[7],F=0;F<16;F++){var $=w+F*4;h[F]=e.readUint32BE(p,$)}for(var F=16;F<64;F++){var q=h[F-2],y=(q>>>17|q<<32-17)^(q>>>19|q<<32-19)^q>>>10;q=h[F-15];var R=(q>>>7|q<<32-7)^(q>>>18|q<<32-18)^q>>>3;h[F]=(y+h[F-7]|0)+(R+h[F-16]|0)}for(var F=0;F<64;F++){var y=(((z>>>6|z<<26)^(z>>>11|z<<21)^(z>>>25|z<<7))+(z&H^~z&L)|0)+(K+(n[F]+h[F]|0)|0)|0,R=((I>>>2|I<<32-2)^(I>>>13|I<<32-13)^(I>>>22|I<<32-22))+(I&D^I&N^D&N)|0;K=L,L=H,H=z,z=U+y|0,U=N,N=D,D=I,I=y+R|0}l[0]+=I,l[1]+=D,l[2]+=N,l[3]+=U,l[4]+=z,l[5]+=H,l[6]+=L,l[7]+=K,w+=64,M-=64}return w}function o(h){var l=new i;l.update(h);var p=l.digest();return l.clean(),p}t.hash=o})(Ha);var Eh={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=In,r=zr;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function i(F){const $=new Float64Array(16);if(F)for(let q=0;q<F.length;q++)$[q]=F[q];return $}const n=new Uint8Array(32);n[0]=9;const s=i([56129,1]);function o(F){let $=1;for(let q=0;q<16;q++){let y=F[q]+$+65535;$=Math.floor(y/65536),F[q]=y-$*65536}F[0]+=$-1+37*($-1)}function h(F,$,q){const y=~(q-1);for(let R=0;R<16;R++){const V=y&(F[R]^$[R]);F[R]^=V,$[R]^=V}}function l(F,$){const q=i(),y=i();for(let R=0;R<16;R++)y[R]=$[R];o(y),o(y),o(y);for(let R=0;R<2;R++){q[0]=y[0]-65517;for(let Q=1;Q<15;Q++)q[Q]=y[Q]-65535-(q[Q-1]>>16&1),q[Q-1]&=65535;q[15]=y[15]-32767-(q[14]>>16&1);const V=q[15]>>16&1;q[14]&=65535,h(y,q,1-V)}for(let R=0;R<16;R++)F[2*R]=y[R]&255,F[2*R+1]=y[R]>>8}function p(F,$){for(let q=0;q<16;q++)F[q]=$[2*q]+($[2*q+1]<<8);F[15]&=32767}function w(F,$,q){for(let y=0;y<16;y++)F[y]=$[y]+q[y]}function M(F,$,q){for(let y=0;y<16;y++)F[y]=$[y]-q[y]}function I(F,$,q){let y,R,V=0,Q=0,O=0,d=0,u=0,a=0,f=0,b=0,x=0,A=0,_=0,c=0,m=0,v=0,S=0,G=0,E=0,k=0,C=0,B=0,P=0,g=0,T=0,j=0,J=0,W=0,X=0,ve=0,_e=0,ae=0,De=0,me=q[0],ie=q[1],de=q[2],he=q[3],te=q[4],fe=q[5],se=q[6],ee=q[7],le=q[8],ge=q[9],re=q[10],ye=q[11],we=q[12],ne=q[13],xe=q[14],Ae=q[15];y=$[0],V+=y*me,Q+=y*ie,O+=y*de,d+=y*he,u+=y*te,a+=y*fe,f+=y*se,b+=y*ee,x+=y*le,A+=y*ge,_+=y*re,c+=y*ye,m+=y*we,v+=y*ne,S+=y*xe,G+=y*Ae,y=$[1],Q+=y*me,O+=y*ie,d+=y*de,u+=y*he,a+=y*te,f+=y*fe,b+=y*se,x+=y*ee,A+=y*le,_+=y*ge,c+=y*re,m+=y*ye,v+=y*we,S+=y*ne,G+=y*xe,E+=y*Ae,y=$[2],O+=y*me,d+=y*ie,u+=y*de,a+=y*he,f+=y*te,b+=y*fe,x+=y*se,A+=y*ee,_+=y*le,c+=y*ge,m+=y*re,v+=y*ye,S+=y*we,G+=y*ne,E+=y*xe,k+=y*Ae,y=$[3],d+=y*me,u+=y*ie,a+=y*de,f+=y*he,b+=y*te,x+=y*fe,A+=y*se,_+=y*ee,c+=y*le,m+=y*ge,v+=y*re,S+=y*ye,G+=y*we,E+=y*ne,k+=y*xe,C+=y*Ae,y=$[4],u+=y*me,a+=y*ie,f+=y*de,b+=y*he,x+=y*te,A+=y*fe,_+=y*se,c+=y*ee,m+=y*le,v+=y*ge,S+=y*re,G+=y*ye,E+=y*we,k+=y*ne,C+=y*xe,B+=y*Ae,y=$[5],a+=y*me,f+=y*ie,b+=y*de,x+=y*he,A+=y*te,_+=y*fe,c+=y*se,m+=y*ee,v+=y*le,S+=y*ge,G+=y*re,E+=y*ye,k+=y*we,C+=y*ne,B+=y*xe,P+=y*Ae,y=$[6],f+=y*me,b+=y*ie,x+=y*de,A+=y*he,_+=y*te,c+=y*fe,m+=y*se,v+=y*ee,S+=y*le,G+=y*ge,E+=y*re,k+=y*ye,C+=y*we,B+=y*ne,P+=y*xe,g+=y*Ae,y=$[7],b+=y*me,x+=y*ie,A+=y*de,_+=y*he,c+=y*te,m+=y*fe,v+=y*se,S+=y*ee,G+=y*le,E+=y*ge,k+=y*re,C+=y*ye,B+=y*we,P+=y*ne,g+=y*xe,T+=y*Ae,y=$[8],x+=y*me,A+=y*ie,_+=y*de,c+=y*he,m+=y*te,v+=y*fe,S+=y*se,G+=y*ee,E+=y*le,k+=y*ge,C+=y*re,B+=y*ye,P+=y*we,g+=y*ne,T+=y*xe,j+=y*Ae,y=$[9],A+=y*me,_+=y*ie,c+=y*de,m+=y*he,v+=y*te,S+=y*fe,G+=y*se,E+=y*ee,k+=y*le,C+=y*ge,B+=y*re,P+=y*ye,g+=y*we,T+=y*ne,j+=y*xe,J+=y*Ae,y=$[10],_+=y*me,c+=y*ie,m+=y*de,v+=y*he,S+=y*te,G+=y*fe,E+=y*se,k+=y*ee,C+=y*le,B+=y*ge,P+=y*re,g+=y*ye,T+=y*we,j+=y*ne,J+=y*xe,W+=y*Ae,y=$[11],c+=y*me,m+=y*ie,v+=y*de,S+=y*he,G+=y*te,E+=y*fe,k+=y*se,C+=y*ee,B+=y*le,P+=y*ge,g+=y*re,T+=y*ye,j+=y*we,J+=y*ne,W+=y*xe,X+=y*Ae,y=$[12],m+=y*me,v+=y*ie,S+=y*de,G+=y*he,E+=y*te,k+=y*fe,C+=y*se,B+=y*ee,P+=y*le,g+=y*ge,T+=y*re,j+=y*ye,J+=y*we,W+=y*ne,X+=y*xe,ve+=y*Ae,y=$[13],v+=y*me,S+=y*ie,G+=y*de,E+=y*he,k+=y*te,C+=y*fe,B+=y*se,P+=y*ee,g+=y*le,T+=y*ge,j+=y*re,J+=y*ye,W+=y*we,X+=y*ne,ve+=y*xe,_e+=y*Ae,y=$[14],S+=y*me,G+=y*ie,E+=y*de,k+=y*he,C+=y*te,B+=y*fe,P+=y*se,g+=y*ee,T+=y*le,j+=y*ge,J+=y*re,W+=y*ye,X+=y*we,ve+=y*ne,_e+=y*xe,ae+=y*Ae,y=$[15],G+=y*me,E+=y*ie,k+=y*de,C+=y*he,B+=y*te,P+=y*fe,g+=y*se,T+=y*ee,j+=y*le,J+=y*ge,W+=y*re,X+=y*ye,ve+=y*we,_e+=y*ne,ae+=y*xe,De+=y*Ae,V+=38*E,Q+=38*k,O+=38*C,d+=38*B,u+=38*P,a+=38*g,f+=38*T,b+=38*j,x+=38*J,A+=38*W,_+=38*X,c+=38*ve,m+=38*_e,v+=38*ae,S+=38*De,R=1,y=V+R+65535,R=Math.floor(y/65536),V=y-R*65536,y=Q+R+65535,R=Math.floor(y/65536),Q=y-R*65536,y=O+R+65535,R=Math.floor(y/65536),O=y-R*65536,y=d+R+65535,R=Math.floor(y/65536),d=y-R*65536,y=u+R+65535,R=Math.floor(y/65536),u=y-R*65536,y=a+R+65535,R=Math.floor(y/65536),a=y-R*65536,y=f+R+65535,R=Math.floor(y/65536),f=y-R*65536,y=b+R+65535,R=Math.floor(y/65536),b=y-R*65536,y=x+R+65535,R=Math.floor(y/65536),x=y-R*65536,y=A+R+65535,R=Math.floor(y/65536),A=y-R*65536,y=_+R+65535,R=Math.floor(y/65536),_=y-R*65536,y=c+R+65535,R=Math.floor(y/65536),c=y-R*65536,y=m+R+65535,R=Math.floor(y/65536),m=y-R*65536,y=v+R+65535,R=Math.floor(y/65536),v=y-R*65536,y=S+R+65535,R=Math.floor(y/65536),S=y-R*65536,y=G+R+65535,R=Math.floor(y/65536),G=y-R*65536,V+=R-1+37*(R-1),R=1,y=V+R+65535,R=Math.floor(y/65536),V=y-R*65536,y=Q+R+65535,R=Math.floor(y/65536),Q=y-R*65536,y=O+R+65535,R=Math.floor(y/65536),O=y-R*65536,y=d+R+65535,R=Math.floor(y/65536),d=y-R*65536,y=u+R+65535,R=Math.floor(y/65536),u=y-R*65536,y=a+R+65535,R=Math.floor(y/65536),a=y-R*65536,y=f+R+65535,R=Math.floor(y/65536),f=y-R*65536,y=b+R+65535,R=Math.floor(y/65536),b=y-R*65536,y=x+R+65535,R=Math.floor(y/65536),x=y-R*65536,y=A+R+65535,R=Math.floor(y/65536),A=y-R*65536,y=_+R+65535,R=Math.floor(y/65536),_=y-R*65536,y=c+R+65535,R=Math.floor(y/65536),c=y-R*65536,y=m+R+65535,R=Math.floor(y/65536),m=y-R*65536,y=v+R+65535,R=Math.floor(y/65536),v=y-R*65536,y=S+R+65535,R=Math.floor(y/65536),S=y-R*65536,y=G+R+65535,R=Math.floor(y/65536),G=y-R*65536,V+=R-1+37*(R-1),F[0]=V,F[1]=Q,F[2]=O,F[3]=d,F[4]=u,F[5]=a,F[6]=f,F[7]=b,F[8]=x,F[9]=A,F[10]=_,F[11]=c,F[12]=m,F[13]=v,F[14]=S,F[15]=G}function D(F,$){I(F,$,$)}function N(F,$){const q=i();for(let y=0;y<16;y++)q[y]=$[y];for(let y=253;y>=0;y--)D(q,q),y!==2&&y!==4&&I(q,q,$);for(let y=0;y<16;y++)F[y]=q[y]}function U(F,$){const q=new Uint8Array(32),y=new Float64Array(80),R=i(),V=i(),Q=i(),O=i(),d=i(),u=i();for(let x=0;x<31;x++)q[x]=F[x];q[31]=F[31]&127|64,q[0]&=248,p(y,$);for(let x=0;x<16;x++)V[x]=y[x];R[0]=O[0]=1;for(let x=254;x>=0;--x){const A=q[x>>>3]>>>(x&7)&1;h(R,V,A),h(Q,O,A),w(d,R,Q),M(R,R,Q),w(Q,V,O),M(V,V,O),D(O,d),D(u,R),I(R,Q,R),I(Q,V,d),w(d,R,Q),M(R,R,Q),D(V,R),M(Q,O,u),I(R,Q,s),w(R,R,O),I(Q,Q,R),I(R,O,u),I(O,V,y),D(V,d),h(R,V,A),h(Q,O,A)}for(let x=0;x<16;x++)y[x+16]=R[x],y[x+32]=Q[x],y[x+48]=V[x],y[x+64]=O[x];const a=y.subarray(32),f=y.subarray(16);N(a,a),I(f,f,a);const b=new Uint8Array(32);return l(b,f),b}t.scalarMult=U;function z(F){return U(F,n)}t.scalarMultBase=z;function H(F){if(F.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const $=new Uint8Array(F);return{publicKey:z($),secretKey:$}}t.generateKeyPairFromSeed=H;function L(F){const $=(0,e.randomBytes)(32,F),q=H($);return(0,r.wipe)($),q}t.generateKeyPair=L;function K(F,$,q=!1){if(F.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if($.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const y=U(F,$);if(q){let R=0;for(let V=0;V<y.length;V++)R|=y[V];if(R===0)throw new Error("X25519: invalid shared key")}return y}t.sharedKey=K})(Eh);function i1(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Sh(t,e){e||(e=t.reduce((n,s)=>n+s.length,0));const r=i1(e);let i=0;for(const n of t)r.set(n,i),i+=n.length;return r}function n1(t,e,r,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:i}}}const s1=n1("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Dh=n1("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);const e=i1(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),a1={utf8:s1,"utf-8":s1,hex:Us.base16,latin1:Dh,ascii:Dh,binary:Dh,...Us};function ni(t,e="utf8"){const r=a1[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}function jr(t,e="utf8"){const r=a1[e];if(!r)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 f1={},my="elliptic",yy="6.6.0",wy="EC cryptography",_y="lib/elliptic.js",xy=["lib"],Ay={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},My={type:"git",url:"git@github.com:indutny/elliptic"},Ey=["EC","Elliptic","curve","Cryptography"],Sy="Fedor Indutny <fedor@indutny.com>",Dy="MIT",Iy={url:"https://github.com/indutny/elliptic/issues"},Ny="https://github.com/indutny/elliptic",Oy={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},Ry={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},Cy={name:my,version:yy,description:wy,main:_y,files:xy,scripts:Ay,repository:My,keywords:Ey,author:Sy,license:Dy,bugs:Iy,homepage:Ny,devDependencies:Oy,dependencies:Ry},Gr={},Ki={exports:{}};(function(t){(function(e,r){function i(O,d){if(!O)throw new Error(d||"Assertion failed")}function n(O,d){O.super_=d;var u=function(){};u.prototype=d.prototype,O.prototype=new u,O.prototype.constructor=O}function s(O,d,u){if(s.isBN(O))return O;this.negative=0,this.words=null,this.length=0,this.red=null,O!==null&&((d==="le"||d==="be")&&(u=d,d=10),this._init(O||0,d||10,u||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=Nn.Buffer}catch{}s.isBN=function(d){return d instanceof s?!0:d!==null&&typeof d=="object"&&d.constructor.wordSize===s.wordSize&&Array.isArray(d.words)},s.max=function(d,u){return d.cmp(u)>0?d:u},s.min=function(d,u){return d.cmp(u)<0?d:u},s.prototype._init=function(d,u,a){if(typeof d=="number")return this._initNumber(d,u,a);if(typeof d=="object")return this._initArray(d,u,a);u==="hex"&&(u=16),i(u===(u|0)&&u>=2&&u<=36),d=d.toString().replace(/\s+/g,"");var f=0;d[0]==="-"&&(f++,this.negative=1),f<d.length&&(u===16?this._parseHex(d,f,a):(this._parseBase(d,u,f),a==="le"&&this._initArray(this.toArray(),u,a)))},s.prototype._initNumber=function(d,u,a){d<0&&(this.negative=1,d=-d),d<67108864?(this.words=[d&67108863],this.length=1):d<4503599627370496?(this.words=[d&67108863,d/67108864&67108863],this.length=2):(i(d<9007199254740992),this.words=[d&67108863,d/67108864&67108863,1],this.length=3),a==="le"&&this._initArray(this.toArray(),u,a)},s.prototype._initArray=function(d,u,a){if(i(typeof d.length=="number"),d.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(d.length/3),this.words=new Array(this.length);for(var f=0;f<this.length;f++)this.words[f]=0;var b,x,A=0;if(a==="be")for(f=d.length-1,b=0;f>=0;f-=3)x=d[f]|d[f-1]<<8|d[f-2]<<16,this.words[b]|=x<<A&67108863,this.words[b+1]=x>>>26-A&67108863,A+=24,A>=26&&(A-=26,b++);else if(a==="le")for(f=0,b=0;f<d.length;f+=3)x=d[f]|d[f+1]<<8|d[f+2]<<16,this.words[b]|=x<<A&67108863,this.words[b+1]=x>>>26-A&67108863,A+=24,A>=26&&(A-=26,b++);return this.strip()};function h(O,d){var u=O.charCodeAt(d);return u>=65&&u<=70?u-55:u>=97&&u<=102?u-87:u-48&15}function l(O,d,u){var a=h(O,u);return u-1>=d&&(a|=h(O,u-1)<<4),a}s.prototype._parseHex=function(d,u,a){this.length=Math.ceil((d.length-u)/6),this.words=new Array(this.length);for(var f=0;f<this.length;f++)this.words[f]=0;var b=0,x=0,A;if(a==="be")for(f=d.length-1;f>=u;f-=2)A=l(d,u,f)<<b,this.words[x]|=A&67108863,b>=18?(b-=18,x+=1,this.words[x]|=A>>>26):b+=8;else{var _=d.length-u;for(f=_%2===0?u+1:u;f<d.length;f+=2)A=l(d,u,f)<<b,this.words[x]|=A&67108863,b>=18?(b-=18,x+=1,this.words[x]|=A>>>26):b+=8}this.strip()};function p(O,d,u,a){for(var f=0,b=Math.min(O.length,u),x=d;x<b;x++){var A=O.charCodeAt(x)-48;f*=a,A>=49?f+=A-49+10:A>=17?f+=A-17+10:f+=A}return f}s.prototype._parseBase=function(d,u,a){this.words=[0],this.length=1;for(var f=0,b=1;b<=67108863;b*=u)f++;f--,b=b/u|0;for(var x=d.length-a,A=x%f,_=Math.min(x,x-A)+a,c=0,m=a;m<_;m+=f)c=p(d,m,m+f,u),this.imuln(b),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(A!==0){var v=1;for(c=p(d,m,d.length,u),m=0;m<A;m++)v*=u;this.imuln(v),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},s.prototype.copy=function(d){d.words=new Array(this.length);for(var u=0;u<this.length;u++)d.words[u]=this.words[u];d.length=this.length,d.negative=this.negative,d.red=this.red},s.prototype.clone=function(){var d=new s(null);return this.copy(d),d},s.prototype._expand=function(d){for(;this.length<d;)this.words[this.length++]=0;return this},s.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var w=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],M=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],I=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(d,u){d=d||10,u=u|0||1;var a;if(d===16||d==="hex"){a="";for(var f=0,b=0,x=0;x<this.length;x++){var A=this.words[x],_=((A<<f|b)&16777215).toString(16);b=A>>>24-f&16777215,b!==0||x!==this.length-1?a=w[6-_.length]+_+a:a=_+a,f+=2,f>=26&&(f-=26,x--)}for(b!==0&&(a=b.toString(16)+a);a.length%u!==0;)a="0"+a;return this.negative!==0&&(a="-"+a),a}if(d===(d|0)&&d>=2&&d<=36){var c=M[d],m=I[d];a="";var v=this.clone();for(v.negative=0;!v.isZero();){var S=v.modn(m).toString(d);v=v.idivn(m),v.isZero()?a=S+a:a=w[c-S.length]+S+a}for(this.isZero()&&(a="0"+a);a.length%u!==0;)a="0"+a;return this.negative!==0&&(a="-"+a),a}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var d=this.words[0];return this.length===2?d+=this.words[1]*67108864:this.length===3&&this.words[2]===1?d+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-d:d},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(d,u){return i(typeof o<"u"),this.toArrayLike(o,d,u)},s.prototype.toArray=function(d,u){return this.toArrayLike(Array,d,u)},s.prototype.toArrayLike=function(d,u,a){var f=this.byteLength(),b=a||Math.max(1,f);i(f<=b,"byte array longer than desired length"),i(b>0,"Requested array length <= 0"),this.strip();var x=u==="le",A=new d(b),_,c,m=this.clone();if(x){for(c=0;!m.isZero();c++)_=m.andln(255),m.iushrn(8),A[c]=_;for(;c<b;c++)A[c]=0}else{for(c=0;c<b-f;c++)A[c]=0;for(c=0;!m.isZero();c++)_=m.andln(255),m.iushrn(8),A[b-c-1]=_}return A},Math.clz32?s.prototype._countBits=function(d){return 32-Math.clz32(d)}:s.prototype._countBits=function(d){var u=d,a=0;return u>=4096&&(a+=13,u>>>=13),u>=64&&(a+=7,u>>>=7),u>=8&&(a+=4,u>>>=4),u>=2&&(a+=2,u>>>=2),a+u},s.prototype._zeroBits=function(d){if(d===0)return 26;var u=d,a=0;return u&8191||(a+=13,u>>>=13),u&127||(a+=7,u>>>=7),u&15||(a+=4,u>>>=4),u&3||(a+=2,u>>>=2),u&1||a++,a},s.prototype.bitLength=function(){var d=this.words[this.length-1],u=this._countBits(d);return(this.length-1)*26+u};function D(O){for(var d=new Array(O.bitLength()),u=0;u<d.length;u++){var a=u/26|0,f=u%26;d[u]=(O.words[a]&1<<f)>>>f}return d}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var d=0,u=0;u<this.length;u++){var a=this._zeroBits(this.words[u]);if(d+=a,a!==26)break}return d},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(d){return this.negative!==0?this.abs().inotn(d).iaddn(1):this.clone()},s.prototype.fromTwos=function(d){return this.testn(d-1)?this.notn(d).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(d){for(;this.length<d.length;)this.words[this.length++]=0;for(var u=0;u<d.length;u++)this.words[u]=this.words[u]|d.words[u];return this.strip()},s.prototype.ior=function(d){return i((this.negative|d.negative)===0),this.iuor(d)},s.prototype.or=function(d){return this.length>d.length?this.clone().ior(d):d.clone().ior(this)},s.prototype.uor=function(d){return this.length>d.length?this.clone().iuor(d):d.clone().iuor(this)},s.prototype.iuand=function(d){var u;this.length>d.length?u=d:u=this;for(var a=0;a<u.length;a++)this.words[a]=this.words[a]&d.words[a];return this.length=u.length,this.strip()},s.prototype.iand=function(d){return i((this.negative|d.negative)===0),this.iuand(d)},s.prototype.and=function(d){return this.length>d.length?this.clone().iand(d):d.clone().iand(this)},s.prototype.uand=function(d){return this.length>d.length?this.clone().iuand(d):d.clone().iuand(this)},s.prototype.iuxor=function(d){var u,a;this.length>d.length?(u=this,a=d):(u=d,a=this);for(var f=0;f<a.length;f++)this.words[f]=u.words[f]^a.words[f];if(this!==u)for(;f<u.length;f++)this.words[f]=u.words[f];return this.length=u.length,this.strip()},s.prototype.ixor=function(d){return i((this.negative|d.negative)===0),this.iuxor(d)},s.prototype.xor=function(d){return this.length>d.length?this.clone().ixor(d):d.clone().ixor(this)},s.prototype.uxor=function(d){return this.length>d.length?this.clone().iuxor(d):d.clone().iuxor(this)},s.prototype.inotn=function(d){i(typeof d=="number"&&d>=0);var u=Math.ceil(d/26)|0,a=d%26;this._expand(u),a>0&&u--;for(var f=0;f<u;f++)this.words[f]=~this.words[f]&67108863;return a>0&&(this.words[f]=~this.words[f]&67108863>>26-a),this.strip()},s.prototype.notn=function(d){return this.clone().inotn(d)},s.prototype.setn=function(d,u){i(typeof d=="number"&&d>=0);var a=d/26|0,f=d%26;return this._expand(a+1),u?this.words[a]=this.words[a]|1<<f:this.words[a]=this.words[a]&~(1<<f),this.strip()},s.prototype.iadd=function(d){var u;if(this.negative!==0&&d.negative===0)return this.negative=0,u=this.isub(d),this.negative^=1,this._normSign();if(this.negative===0&&d.negative!==0)return d.negative=0,u=this.isub(d),d.negative=1,u._normSign();var a,f;this.length>d.length?(a=this,f=d):(a=d,f=this);for(var b=0,x=0;x<f.length;x++)u=(a.words[x]|0)+(f.words[x]|0)+b,this.words[x]=u&67108863,b=u>>>26;for(;b!==0&&x<a.length;x++)u=(a.words[x]|0)+b,this.words[x]=u&67108863,b=u>>>26;if(this.length=a.length,b!==0)this.words[this.length]=b,this.length++;else if(a!==this)for(;x<a.length;x++)this.words[x]=a.words[x];return this},s.prototype.add=function(d){var u;return d.negative!==0&&this.negative===0?(d.negative=0,u=this.sub(d),d.negative^=1,u):d.negative===0&&this.negative!==0?(this.negative=0,u=d.sub(this),this.negative=1,u):this.length>d.length?this.clone().iadd(d):d.clone().iadd(this)},s.prototype.isub=function(d){if(d.negative!==0){d.negative=0;var u=this.iadd(d);return d.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(d),this.negative=1,this._normSign();var a=this.cmp(d);if(a===0)return this.negative=0,this.length=1,this.words[0]=0,this;var f,b;a>0?(f=this,b=d):(f=d,b=this);for(var x=0,A=0;A<b.length;A++)u=(f.words[A]|0)-(b.words[A]|0)+x,x=u>>26,this.words[A]=u&67108863;for(;x!==0&&A<f.length;A++)u=(f.words[A]|0)+x,x=u>>26,this.words[A]=u&67108863;if(x===0&&A<f.length&&f!==this)for(;A<f.length;A++)this.words[A]=f.words[A];return this.length=Math.max(this.length,A),f!==this&&(this.negative=1),this.strip()},s.prototype.sub=function(d){return this.clone().isub(d)};function N(O,d,u){u.negative=d.negative^O.negative;var a=O.length+d.length|0;u.length=a,a=a-1|0;var f=O.words[0]|0,b=d.words[0]|0,x=f*b,A=x&67108863,_=x/67108864|0;u.words[0]=A;for(var c=1;c<a;c++){for(var m=_>>>26,v=_&67108863,S=Math.min(c,d.length-1),G=Math.max(0,c-O.length+1);G<=S;G++){var E=c-G|0;f=O.words[E]|0,b=d.words[G]|0,x=f*b+v,m+=x/67108864|0,v=x&67108863}u.words[c]=v|0,_=m|0}return _!==0?u.words[c]=_|0:u.length--,u.strip()}var U=function(d,u,a){var f=d.words,b=u.words,x=a.words,A=0,_,c,m,v=f[0]|0,S=v&8191,G=v>>>13,E=f[1]|0,k=E&8191,C=E>>>13,B=f[2]|0,P=B&8191,g=B>>>13,T=f[3]|0,j=T&8191,J=T>>>13,W=f[4]|0,X=W&8191,ve=W>>>13,_e=f[5]|0,ae=_e&8191,De=_e>>>13,me=f[6]|0,ie=me&8191,de=me>>>13,he=f[7]|0,te=he&8191,fe=he>>>13,se=f[8]|0,ee=se&8191,le=se>>>13,ge=f[9]|0,re=ge&8191,ye=ge>>>13,we=b[0]|0,ne=we&8191,xe=we>>>13,Ae=b[1]|0,Me=Ae&8191,Ke=Ae>>>13,He=b[2]|0,Ee=He&8191,je=He>>>13,Ve=b[3]|0,Ie=Ve&8191,Re=Ve>>>13,Oe=b[4]|0,ce=Oe&8191,Ce=Oe>>>13,Pe=b[5]|0,oe=Pe&8191,Fe=Pe>>>13,Le=b[6]|0,pe=Le&8191,Ue=Le>>>13,$e=b[7]|0,ue=$e&8191,Te=$e>>>13,Ne=b[8]|0,be=Ne&8191,qe=Ne>>>13,We=b[9]|0,Be=We&8191,Qe=We>>>13;a.negative=d.negative^u.negative,a.length=19,_=Math.imul(S,ne),c=Math.imul(S,xe),c=c+Math.imul(G,ne)|0,m=Math.imul(G,xe);var Ge=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,_=Math.imul(k,ne),c=Math.imul(k,xe),c=c+Math.imul(C,ne)|0,m=Math.imul(C,xe),_=_+Math.imul(S,Me)|0,c=c+Math.imul(S,Ke)|0,c=c+Math.imul(G,Me)|0,m=m+Math.imul(G,Ke)|0;var Je=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(Je>>>26)|0,Je&=67108863,_=Math.imul(P,ne),c=Math.imul(P,xe),c=c+Math.imul(g,ne)|0,m=Math.imul(g,xe),_=_+Math.imul(k,Me)|0,c=c+Math.imul(k,Ke)|0,c=c+Math.imul(C,Me)|0,m=m+Math.imul(C,Ke)|0,_=_+Math.imul(S,Ee)|0,c=c+Math.imul(S,je)|0,c=c+Math.imul(G,Ee)|0,m=m+Math.imul(G,je)|0;var lt=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(lt>>>26)|0,lt&=67108863,_=Math.imul(j,ne),c=Math.imul(j,xe),c=c+Math.imul(J,ne)|0,m=Math.imul(J,xe),_=_+Math.imul(P,Me)|0,c=c+Math.imul(P,Ke)|0,c=c+Math.imul(g,Me)|0,m=m+Math.imul(g,Ke)|0,_=_+Math.imul(k,Ee)|0,c=c+Math.imul(k,je)|0,c=c+Math.imul(C,Ee)|0,m=m+Math.imul(C,je)|0,_=_+Math.imul(S,Ie)|0,c=c+Math.imul(S,Re)|0,c=c+Math.imul(G,Ie)|0,m=m+Math.imul(G,Re)|0;var pt=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(pt>>>26)|0,pt&=67108863,_=Math.imul(X,ne),c=Math.imul(X,xe),c=c+Math.imul(ve,ne)|0,m=Math.imul(ve,xe),_=_+Math.imul(j,Me)|0,c=c+Math.imul(j,Ke)|0,c=c+Math.imul(J,Me)|0,m=m+Math.imul(J,Ke)|0,_=_+Math.imul(P,Ee)|0,c=c+Math.imul(P,je)|0,c=c+Math.imul(g,Ee)|0,m=m+Math.imul(g,je)|0,_=_+Math.imul(k,Ie)|0,c=c+Math.imul(k,Re)|0,c=c+Math.imul(C,Ie)|0,m=m+Math.imul(C,Re)|0,_=_+Math.imul(S,ce)|0,c=c+Math.imul(S,Ce)|0,c=c+Math.imul(G,ce)|0,m=m+Math.imul(G,Ce)|0;var bt=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(bt>>>26)|0,bt&=67108863,_=Math.imul(ae,ne),c=Math.imul(ae,xe),c=c+Math.imul(De,ne)|0,m=Math.imul(De,xe),_=_+Math.imul(X,Me)|0,c=c+Math.imul(X,Ke)|0,c=c+Math.imul(ve,Me)|0,m=m+Math.imul(ve,Ke)|0,_=_+Math.imul(j,Ee)|0,c=c+Math.imul(j,je)|0,c=c+Math.imul(J,Ee)|0,m=m+Math.imul(J,je)|0,_=_+Math.imul(P,Ie)|0,c=c+Math.imul(P,Re)|0,c=c+Math.imul(g,Ie)|0,m=m+Math.imul(g,Re)|0,_=_+Math.imul(k,ce)|0,c=c+Math.imul(k,Ce)|0,c=c+Math.imul(C,ce)|0,m=m+Math.imul(C,Ce)|0,_=_+Math.imul(S,oe)|0,c=c+Math.imul(S,Fe)|0,c=c+Math.imul(G,oe)|0,m=m+Math.imul(G,Fe)|0;var vt=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(vt>>>26)|0,vt&=67108863,_=Math.imul(ie,ne),c=Math.imul(ie,xe),c=c+Math.imul(de,ne)|0,m=Math.imul(de,xe),_=_+Math.imul(ae,Me)|0,c=c+Math.imul(ae,Ke)|0,c=c+Math.imul(De,Me)|0,m=m+Math.imul(De,Ke)|0,_=_+Math.imul(X,Ee)|0,c=c+Math.imul(X,je)|0,c=c+Math.imul(ve,Ee)|0,m=m+Math.imul(ve,je)|0,_=_+Math.imul(j,Ie)|0,c=c+Math.imul(j,Re)|0,c=c+Math.imul(J,Ie)|0,m=m+Math.imul(J,Re)|0,_=_+Math.imul(P,ce)|0,c=c+Math.imul(P,Ce)|0,c=c+Math.imul(g,ce)|0,m=m+Math.imul(g,Ce)|0,_=_+Math.imul(k,oe)|0,c=c+Math.imul(k,Fe)|0,c=c+Math.imul(C,oe)|0,m=m+Math.imul(C,Fe)|0,_=_+Math.imul(S,pe)|0,c=c+Math.imul(S,Ue)|0,c=c+Math.imul(G,pe)|0,m=m+Math.imul(G,Ue)|0;var ct=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(ct>>>26)|0,ct&=67108863,_=Math.imul(te,ne),c=Math.imul(te,xe),c=c+Math.imul(fe,ne)|0,m=Math.imul(fe,xe),_=_+Math.imul(ie,Me)|0,c=c+Math.imul(ie,Ke)|0,c=c+Math.imul(de,Me)|0,m=m+Math.imul(de,Ke)|0,_=_+Math.imul(ae,Ee)|0,c=c+Math.imul(ae,je)|0,c=c+Math.imul(De,Ee)|0,m=m+Math.imul(De,je)|0,_=_+Math.imul(X,Ie)|0,c=c+Math.imul(X,Re)|0,c=c+Math.imul(ve,Ie)|0,m=m+Math.imul(ve,Re)|0,_=_+Math.imul(j,ce)|0,c=c+Math.imul(j,Ce)|0,c=c+Math.imul(J,ce)|0,m=m+Math.imul(J,Ce)|0,_=_+Math.imul(P,oe)|0,c=c+Math.imul(P,Fe)|0,c=c+Math.imul(g,oe)|0,m=m+Math.imul(g,Fe)|0,_=_+Math.imul(k,pe)|0,c=c+Math.imul(k,Ue)|0,c=c+Math.imul(C,pe)|0,m=m+Math.imul(C,Ue)|0,_=_+Math.imul(S,ue)|0,c=c+Math.imul(S,Te)|0,c=c+Math.imul(G,ue)|0,m=m+Math.imul(G,Te)|0;var ar=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(ar>>>26)|0,ar&=67108863,_=Math.imul(ee,ne),c=Math.imul(ee,xe),c=c+Math.imul(le,ne)|0,m=Math.imul(le,xe),_=_+Math.imul(te,Me)|0,c=c+Math.imul(te,Ke)|0,c=c+Math.imul(fe,Me)|0,m=m+Math.imul(fe,Ke)|0,_=_+Math.imul(ie,Ee)|0,c=c+Math.imul(ie,je)|0,c=c+Math.imul(de,Ee)|0,m=m+Math.imul(de,je)|0,_=_+Math.imul(ae,Ie)|0,c=c+Math.imul(ae,Re)|0,c=c+Math.imul(De,Ie)|0,m=m+Math.imul(De,Re)|0,_=_+Math.imul(X,ce)|0,c=c+Math.imul(X,Ce)|0,c=c+Math.imul(ve,ce)|0,m=m+Math.imul(ve,Ce)|0,_=_+Math.imul(j,oe)|0,c=c+Math.imul(j,Fe)|0,c=c+Math.imul(J,oe)|0,m=m+Math.imul(J,Fe)|0,_=_+Math.imul(P,pe)|0,c=c+Math.imul(P,Ue)|0,c=c+Math.imul(g,pe)|0,m=m+Math.imul(g,Ue)|0,_=_+Math.imul(k,ue)|0,c=c+Math.imul(k,Te)|0,c=c+Math.imul(C,ue)|0,m=m+Math.imul(C,Te)|0,_=_+Math.imul(S,be)|0,c=c+Math.imul(S,qe)|0,c=c+Math.imul(G,be)|0,m=m+Math.imul(G,qe)|0;var fr=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(fr>>>26)|0,fr&=67108863,_=Math.imul(re,ne),c=Math.imul(re,xe),c=c+Math.imul(ye,ne)|0,m=Math.imul(ye,xe),_=_+Math.imul(ee,Me)|0,c=c+Math.imul(ee,Ke)|0,c=c+Math.imul(le,Me)|0,m=m+Math.imul(le,Ke)|0,_=_+Math.imul(te,Ee)|0,c=c+Math.imul(te,je)|0,c=c+Math.imul(fe,Ee)|0,m=m+Math.imul(fe,je)|0,_=_+Math.imul(ie,Ie)|0,c=c+Math.imul(ie,Re)|0,c=c+Math.imul(de,Ie)|0,m=m+Math.imul(de,Re)|0,_=_+Math.imul(ae,ce)|0,c=c+Math.imul(ae,Ce)|0,c=c+Math.imul(De,ce)|0,m=m+Math.imul(De,Ce)|0,_=_+Math.imul(X,oe)|0,c=c+Math.imul(X,Fe)|0,c=c+Math.imul(ve,oe)|0,m=m+Math.imul(ve,Fe)|0,_=_+Math.imul(j,pe)|0,c=c+Math.imul(j,Ue)|0,c=c+Math.imul(J,pe)|0,m=m+Math.imul(J,Ue)|0,_=_+Math.imul(P,ue)|0,c=c+Math.imul(P,Te)|0,c=c+Math.imul(g,ue)|0,m=m+Math.imul(g,Te)|0,_=_+Math.imul(k,be)|0,c=c+Math.imul(k,qe)|0,c=c+Math.imul(C,be)|0,m=m+Math.imul(C,qe)|0,_=_+Math.imul(S,Be)|0,c=c+Math.imul(S,Qe)|0,c=c+Math.imul(G,Be)|0,m=m+Math.imul(G,Qe)|0;var or=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(or>>>26)|0,or&=67108863,_=Math.imul(re,Me),c=Math.imul(re,Ke),c=c+Math.imul(ye,Me)|0,m=Math.imul(ye,Ke),_=_+Math.imul(ee,Ee)|0,c=c+Math.imul(ee,je)|0,c=c+Math.imul(le,Ee)|0,m=m+Math.imul(le,je)|0,_=_+Math.imul(te,Ie)|0,c=c+Math.imul(te,Re)|0,c=c+Math.imul(fe,Ie)|0,m=m+Math.imul(fe,Re)|0,_=_+Math.imul(ie,ce)|0,c=c+Math.imul(ie,Ce)|0,c=c+Math.imul(de,ce)|0,m=m+Math.imul(de,Ce)|0,_=_+Math.imul(ae,oe)|0,c=c+Math.imul(ae,Fe)|0,c=c+Math.imul(De,oe)|0,m=m+Math.imul(De,Fe)|0,_=_+Math.imul(X,pe)|0,c=c+Math.imul(X,Ue)|0,c=c+Math.imul(ve,pe)|0,m=m+Math.imul(ve,Ue)|0,_=_+Math.imul(j,ue)|0,c=c+Math.imul(j,Te)|0,c=c+Math.imul(J,ue)|0,m=m+Math.imul(J,Te)|0,_=_+Math.imul(P,be)|0,c=c+Math.imul(P,qe)|0,c=c+Math.imul(g,be)|0,m=m+Math.imul(g,qe)|0,_=_+Math.imul(k,Be)|0,c=c+Math.imul(k,Qe)|0,c=c+Math.imul(C,Be)|0,m=m+Math.imul(C,Qe)|0;var hr=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(hr>>>26)|0,hr&=67108863,_=Math.imul(re,Ee),c=Math.imul(re,je),c=c+Math.imul(ye,Ee)|0,m=Math.imul(ye,je),_=_+Math.imul(ee,Ie)|0,c=c+Math.imul(ee,Re)|0,c=c+Math.imul(le,Ie)|0,m=m+Math.imul(le,Re)|0,_=_+Math.imul(te,ce)|0,c=c+Math.imul(te,Ce)|0,c=c+Math.imul(fe,ce)|0,m=m+Math.imul(fe,Ce)|0,_=_+Math.imul(ie,oe)|0,c=c+Math.imul(ie,Fe)|0,c=c+Math.imul(de,oe)|0,m=m+Math.imul(de,Fe)|0,_=_+Math.imul(ae,pe)|0,c=c+Math.imul(ae,Ue)|0,c=c+Math.imul(De,pe)|0,m=m+Math.imul(De,Ue)|0,_=_+Math.imul(X,ue)|0,c=c+Math.imul(X,Te)|0,c=c+Math.imul(ve,ue)|0,m=m+Math.imul(ve,Te)|0,_=_+Math.imul(j,be)|0,c=c+Math.imul(j,qe)|0,c=c+Math.imul(J,be)|0,m=m+Math.imul(J,qe)|0,_=_+Math.imul(P,Be)|0,c=c+Math.imul(P,Qe)|0,c=c+Math.imul(g,Be)|0,m=m+Math.imul(g,Qe)|0;var cr=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(cr>>>26)|0,cr&=67108863,_=Math.imul(re,Ie),c=Math.imul(re,Re),c=c+Math.imul(ye,Ie)|0,m=Math.imul(ye,Re),_=_+Math.imul(ee,ce)|0,c=c+Math.imul(ee,Ce)|0,c=c+Math.imul(le,ce)|0,m=m+Math.imul(le,Ce)|0,_=_+Math.imul(te,oe)|0,c=c+Math.imul(te,Fe)|0,c=c+Math.imul(fe,oe)|0,m=m+Math.imul(fe,Fe)|0,_=_+Math.imul(ie,pe)|0,c=c+Math.imul(ie,Ue)|0,c=c+Math.imul(de,pe)|0,m=m+Math.imul(de,Ue)|0,_=_+Math.imul(ae,ue)|0,c=c+Math.imul(ae,Te)|0,c=c+Math.imul(De,ue)|0,m=m+Math.imul(De,Te)|0,_=_+Math.imul(X,be)|0,c=c+Math.imul(X,qe)|0,c=c+Math.imul(ve,be)|0,m=m+Math.imul(ve,qe)|0,_=_+Math.imul(j,Be)|0,c=c+Math.imul(j,Qe)|0,c=c+Math.imul(J,Be)|0,m=m+Math.imul(J,Qe)|0;var Ft=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,_=Math.imul(re,ce),c=Math.imul(re,Ce),c=c+Math.imul(ye,ce)|0,m=Math.imul(ye,Ce),_=_+Math.imul(ee,oe)|0,c=c+Math.imul(ee,Fe)|0,c=c+Math.imul(le,oe)|0,m=m+Math.imul(le,Fe)|0,_=_+Math.imul(te,pe)|0,c=c+Math.imul(te,Ue)|0,c=c+Math.imul(fe,pe)|0,m=m+Math.imul(fe,Ue)|0,_=_+Math.imul(ie,ue)|0,c=c+Math.imul(ie,Te)|0,c=c+Math.imul(de,ue)|0,m=m+Math.imul(de,Te)|0,_=_+Math.imul(ae,be)|0,c=c+Math.imul(ae,qe)|0,c=c+Math.imul(De,be)|0,m=m+Math.imul(De,qe)|0,_=_+Math.imul(X,Be)|0,c=c+Math.imul(X,Qe)|0,c=c+Math.imul(ve,Be)|0,m=m+Math.imul(ve,Qe)|0;var ur=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(ur>>>26)|0,ur&=67108863,_=Math.imul(re,oe),c=Math.imul(re,Fe),c=c+Math.imul(ye,oe)|0,m=Math.imul(ye,Fe),_=_+Math.imul(ee,pe)|0,c=c+Math.imul(ee,Ue)|0,c=c+Math.imul(le,pe)|0,m=m+Math.imul(le,Ue)|0,_=_+Math.imul(te,ue)|0,c=c+Math.imul(te,Te)|0,c=c+Math.imul(fe,ue)|0,m=m+Math.imul(fe,Te)|0,_=_+Math.imul(ie,be)|0,c=c+Math.imul(ie,qe)|0,c=c+Math.imul(de,be)|0,m=m+Math.imul(de,qe)|0,_=_+Math.imul(ae,Be)|0,c=c+Math.imul(ae,Qe)|0,c=c+Math.imul(De,Be)|0,m=m+Math.imul(De,Qe)|0;var dr=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(dr>>>26)|0,dr&=67108863,_=Math.imul(re,pe),c=Math.imul(re,Ue),c=c+Math.imul(ye,pe)|0,m=Math.imul(ye,Ue),_=_+Math.imul(ee,ue)|0,c=c+Math.imul(ee,Te)|0,c=c+Math.imul(le,ue)|0,m=m+Math.imul(le,Te)|0,_=_+Math.imul(te,be)|0,c=c+Math.imul(te,qe)|0,c=c+Math.imul(fe,be)|0,m=m+Math.imul(fe,qe)|0,_=_+Math.imul(ie,Be)|0,c=c+Math.imul(ie,Qe)|0,c=c+Math.imul(de,Be)|0,m=m+Math.imul(de,Qe)|0;var St=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(St>>>26)|0,St&=67108863,_=Math.imul(re,ue),c=Math.imul(re,Te),c=c+Math.imul(ye,ue)|0,m=Math.imul(ye,Te),_=_+Math.imul(ee,be)|0,c=c+Math.imul(ee,qe)|0,c=c+Math.imul(le,be)|0,m=m+Math.imul(le,qe)|0,_=_+Math.imul(te,Be)|0,c=c+Math.imul(te,Qe)|0,c=c+Math.imul(fe,Be)|0,m=m+Math.imul(fe,Qe)|0;var lr=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(lr>>>26)|0,lr&=67108863,_=Math.imul(re,be),c=Math.imul(re,qe),c=c+Math.imul(ye,be)|0,m=Math.imul(ye,qe),_=_+Math.imul(ee,Be)|0,c=c+Math.imul(ee,Qe)|0,c=c+Math.imul(le,Be)|0,m=m+Math.imul(le,Qe)|0;var pr=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(pr>>>26)|0,pr&=67108863,_=Math.imul(re,Be),c=Math.imul(re,Qe),c=c+Math.imul(ye,Be)|0,m=Math.imul(ye,Qe);var br=(A+_|0)+((c&8191)<<13)|0;return A=(m+(c>>>13)|0)+(br>>>26)|0,br&=67108863,x[0]=Ge,x[1]=Je,x[2]=lt,x[3]=pt,x[4]=bt,x[5]=vt,x[6]=ct,x[7]=ar,x[8]=fr,x[9]=or,x[10]=hr,x[11]=cr,x[12]=Ft,x[13]=ur,x[14]=dr,x[15]=St,x[16]=lr,x[17]=pr,x[18]=br,A!==0&&(x[19]=A,a.length++),a};Math.imul||(U=N);function z(O,d,u){u.negative=d.negative^O.negative,u.length=O.length+d.length;for(var a=0,f=0,b=0;b<u.length-1;b++){var x=f;f=0;for(var A=a&67108863,_=Math.min(b,d.length-1),c=Math.max(0,b-O.length+1);c<=_;c++){var m=b-c,v=O.words[m]|0,S=d.words[c]|0,G=v*S,E=G&67108863;x=x+(G/67108864|0)|0,E=E+A|0,A=E&67108863,x=x+(E>>>26)|0,f+=x>>>26,x&=67108863}u.words[b]=A,a=x,x=f}return a!==0?u.words[b]=a:u.length--,u.strip()}function H(O,d,u){var a=new L;return a.mulp(O,d,u)}s.prototype.mulTo=function(d,u){var a,f=this.length+d.length;return this.length===10&&d.length===10?a=U(this,d,u):f<63?a=N(this,d,u):f<1024?a=z(this,d,u):a=H(this,d,u),a};function L(O,d){this.x=O,this.y=d}L.prototype.makeRBT=function(d){for(var u=new Array(d),a=s.prototype._countBits(d)-1,f=0;f<d;f++)u[f]=this.revBin(f,a,d);return u},L.prototype.revBin=function(d,u,a){if(d===0||d===a-1)return d;for(var f=0,b=0;b<u;b++)f|=(d&1)<<u-b-1,d>>=1;return f},L.prototype.permute=function(d,u,a,f,b,x){for(var A=0;A<x;A++)f[A]=u[d[A]],b[A]=a[d[A]]},L.prototype.transform=function(d,u,a,f,b,x){this.permute(x,d,u,a,f,b);for(var A=1;A<b;A<<=1)for(var _=A<<1,c=Math.cos(2*Math.PI/_),m=Math.sin(2*Math.PI/_),v=0;v<b;v+=_)for(var S=c,G=m,E=0;E<A;E++){var k=a[v+E],C=f[v+E],B=a[v+E+A],P=f[v+E+A],g=S*B-G*P;P=S*P+G*B,B=g,a[v+E]=k+B,f[v+E]=C+P,a[v+E+A]=k-B,f[v+E+A]=C-P,E!==_&&(g=c*S-m*G,G=c*G+m*S,S=g)}},L.prototype.guessLen13b=function(d,u){var a=Math.max(u,d)|1,f=a&1,b=0;for(a=a/2|0;a;a=a>>>1)b++;return 1<<b+1+f},L.prototype.conjugate=function(d,u,a){if(!(a<=1))for(var f=0;f<a/2;f++){var b=d[f];d[f]=d[a-f-1],d[a-f-1]=b,b=u[f],u[f]=-u[a-f-1],u[a-f-1]=-b}},L.prototype.normalize13b=function(d,u){for(var a=0,f=0;f<u/2;f++){var b=Math.round(d[2*f+1]/u)*8192+Math.round(d[2*f]/u)+a;d[f]=b&67108863,b<67108864?a=0:a=b/67108864|0}return d},L.prototype.convert13b=function(d,u,a,f){for(var b=0,x=0;x<u;x++)b=b+(d[x]|0),a[2*x]=b&8191,b=b>>>13,a[2*x+1]=b&8191,b=b>>>13;for(x=2*u;x<f;++x)a[x]=0;i(b===0),i((b&-8192)===0)},L.prototype.stub=function(d){for(var u=new Array(d),a=0;a<d;a++)u[a]=0;return u},L.prototype.mulp=function(d,u,a){var f=2*this.guessLen13b(d.length,u.length),b=this.makeRBT(f),x=this.stub(f),A=new Array(f),_=new Array(f),c=new Array(f),m=new Array(f),v=new Array(f),S=new Array(f),G=a.words;G.length=f,this.convert13b(d.words,d.length,A,f),this.convert13b(u.words,u.length,m,f),this.transform(A,x,_,c,f,b),this.transform(m,x,v,S,f,b);for(var E=0;E<f;E++){var k=_[E]*v[E]-c[E]*S[E];c[E]=_[E]*S[E]+c[E]*v[E],_[E]=k}return this.conjugate(_,c,f),this.transform(_,c,G,x,f,b),this.conjugate(G,x,f),this.normalize13b(G,f),a.negative=d.negative^u.negative,a.length=d.length+u.length,a.strip()},s.prototype.mul=function(d){var u=new s(null);return u.words=new Array(this.length+d.length),this.mulTo(d,u)},s.prototype.mulf=function(d){var u=new s(null);return u.words=new Array(this.length+d.length),H(this,d,u)},s.prototype.imul=function(d){return this.clone().mulTo(d,this)},s.prototype.imuln=function(d){i(typeof d=="number"),i(d<67108864);for(var u=0,a=0;a<this.length;a++){var f=(this.words[a]|0)*d,b=(f&67108863)+(u&67108863);u>>=26,u+=f/67108864|0,u+=b>>>26,this.words[a]=b&67108863}return u!==0&&(this.words[a]=u,this.length++),this},s.prototype.muln=function(d){return this.clone().imuln(d)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(d){var u=D(d);if(u.length===0)return new s(1);for(var a=this,f=0;f<u.length&&u[f]===0;f++,a=a.sqr());if(++f<u.length)for(var b=a.sqr();f<u.length;f++,b=b.sqr())u[f]!==0&&(a=a.mul(b));return a},s.prototype.iushln=function(d){i(typeof d=="number"&&d>=0);var u=d%26,a=(d-u)/26,f=67108863>>>26-u<<26-u,b;if(u!==0){var x=0;for(b=0;b<this.length;b++){var A=this.words[b]&f,_=(this.words[b]|0)-A<<u;this.words[b]=_|x,x=A>>>26-u}x&&(this.words[b]=x,this.length++)}if(a!==0){for(b=this.length-1;b>=0;b--)this.words[b+a]=this.words[b];for(b=0;b<a;b++)this.words[b]=0;this.length+=a}return this.strip()},s.prototype.ishln=function(d){return i(this.negative===0),this.iushln(d)},s.prototype.iushrn=function(d,u,a){i(typeof d=="number"&&d>=0);var f;u?f=(u-u%26)/26:f=0;var b=d%26,x=Math.min((d-b)/26,this.length),A=67108863^67108863>>>b<<b,_=a;if(f-=x,f=Math.max(0,f),_){for(var c=0;c<x;c++)_.words[c]=this.words[c];_.length=x}if(x!==0)if(this.length>x)for(this.length-=x,c=0;c<this.length;c++)this.words[c]=this.words[c+x];else this.words[0]=0,this.length=1;var m=0;for(c=this.length-1;c>=0&&(m!==0||c>=f);c--){var v=this.words[c]|0;this.words[c]=m<<26-b|v>>>b,m=v&A}return _&&m!==0&&(_.words[_.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(d,u,a){return i(this.negative===0),this.iushrn(d,u,a)},s.prototype.shln=function(d){return this.clone().ishln(d)},s.prototype.ushln=function(d){return this.clone().iushln(d)},s.prototype.shrn=function(d){return this.clone().ishrn(d)},s.prototype.ushrn=function(d){return this.clone().iushrn(d)},s.prototype.testn=function(d){i(typeof d=="number"&&d>=0);var u=d%26,a=(d-u)/26,f=1<<u;if(this.length<=a)return!1;var b=this.words[a];return!!(b&f)},s.prototype.imaskn=function(d){i(typeof d=="number"&&d>=0);var u=d%26,a=(d-u)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=a)return this;if(u!==0&&a++,this.length=Math.min(a,this.length),u!==0){var f=67108863^67108863>>>u<<u;this.words[this.length-1]&=f}return this.strip()},s.prototype.maskn=function(d){return this.clone().imaskn(d)},s.prototype.iaddn=function(d){return i(typeof d=="number"),i(d<67108864),d<0?this.isubn(-d):this.negative!==0?this.length===1&&(this.words[0]|0)<d?(this.words[0]=d-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(d),this.negative=1,this):this._iaddn(d)},s.prototype._iaddn=function(d){this.words[0]+=d;for(var u=0;u<this.length&&this.words[u]>=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},s.prototype.isubn=function(d){if(i(typeof d=="number"),i(d<67108864),d<0)return this.iaddn(-d);if(this.negative!==0)return this.negative=0,this.iaddn(d),this.negative=1,this;if(this.words[0]-=d,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u<this.length&&this.words[u]<0;u++)this.words[u]+=67108864,this.words[u+1]-=1;return this.strip()},s.prototype.addn=function(d){return this.clone().iaddn(d)},s.prototype.subn=function(d){return this.clone().isubn(d)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(d,u,a){var f=d.length+a,b;this._expand(f);var x,A=0;for(b=0;b<d.length;b++){x=(this.words[b+a]|0)+A;var _=(d.words[b]|0)*u;x-=_&67108863,A=(x>>26)-(_/67108864|0),this.words[b+a]=x&67108863}for(;b<this.length-a;b++)x=(this.words[b+a]|0)+A,A=x>>26,this.words[b+a]=x&67108863;if(A===0)return this.strip();for(i(A===-1),A=0,b=0;b<this.length;b++)x=-(this.words[b]|0)+A,A=x>>26,this.words[b]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(d,u){var a=this.length-d.length,f=this.clone(),b=d,x=b.words[b.length-1]|0,A=this._countBits(x);a=26-A,a!==0&&(b=b.ushln(a),f.iushln(a),x=b.words[b.length-1]|0);var _=f.length-b.length,c;if(u!=="mod"){c=new s(null),c.length=_+1,c.words=new Array(c.length);for(var m=0;m<c.length;m++)c.words[m]=0}var v=f.clone()._ishlnsubmul(b,1,_);v.negative===0&&(f=v,c&&(c.words[_]=1));for(var S=_-1;S>=0;S--){var G=(f.words[b.length+S]|0)*67108864+(f.words[b.length+S-1]|0);for(G=Math.min(G/x|0,67108863),f._ishlnsubmul(b,G,S);f.negative!==0;)G--,f.negative=0,f._ishlnsubmul(b,1,S),f.isZero()||(f.negative^=1);c&&(c.words[S]=G)}return c&&c.strip(),f.strip(),u!=="div"&&a!==0&&f.iushrn(a),{div:c||null,mod:f}},s.prototype.divmod=function(d,u,a){if(i(!d.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var f,b,x;return this.negative!==0&&d.negative===0?(x=this.neg().divmod(d,u),u!=="mod"&&(f=x.div.neg()),u!=="div"&&(b=x.mod.neg(),a&&b.negative!==0&&b.iadd(d)),{div:f,mod:b}):this.negative===0&&d.negative!==0?(x=this.divmod(d.neg(),u),u!=="mod"&&(f=x.div.neg()),{div:f,mod:x.mod}):this.negative&d.negative?(x=this.neg().divmod(d.neg(),u),u!=="div"&&(b=x.mod.neg(),a&&b.negative!==0&&b.isub(d)),{div:x.div,mod:b}):d.length>this.length||this.cmp(d)<0?{div:new s(0),mod:this}:d.length===1?u==="div"?{div:this.divn(d.words[0]),mod:null}:u==="mod"?{div:null,mod:new s(this.modn(d.words[0]))}:{div:this.divn(d.words[0]),mod:new s(this.modn(d.words[0]))}:this._wordDiv(d,u)},s.prototype.div=function(d){return this.divmod(d,"div",!1).div},s.prototype.mod=function(d){return this.divmod(d,"mod",!1).mod},s.prototype.umod=function(d){return this.divmod(d,"mod",!0).mod},s.prototype.divRound=function(d){var u=this.divmod(d);if(u.mod.isZero())return u.div;var a=u.div.negative!==0?u.mod.isub(d):u.mod,f=d.ushrn(1),b=d.andln(1),x=a.cmp(f);return x<0||b===1&&x===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},s.prototype.modn=function(d){i(d<=67108863);for(var u=(1<<26)%d,a=0,f=this.length-1;f>=0;f--)a=(u*a+(this.words[f]|0))%d;return a},s.prototype.idivn=function(d){i(d<=67108863);for(var u=0,a=this.length-1;a>=0;a--){var f=(this.words[a]|0)+u*67108864;this.words[a]=f/d|0,u=f%d}return this.strip()},s.prototype.divn=function(d){return this.clone().idivn(d)},s.prototype.egcd=function(d){i(d.negative===0),i(!d.isZero());var u=this,a=d.clone();u.negative!==0?u=u.umod(d):u=u.clone();for(var f=new s(1),b=new s(0),x=new s(0),A=new s(1),_=0;u.isEven()&&a.isEven();)u.iushrn(1),a.iushrn(1),++_;for(var c=a.clone(),m=u.clone();!u.isZero();){for(var v=0,S=1;!(u.words[0]&S)&&v<26;++v,S<<=1);if(v>0)for(u.iushrn(v);v-- >0;)(f.isOdd()||b.isOdd())&&(f.iadd(c),b.isub(m)),f.iushrn(1),b.iushrn(1);for(var G=0,E=1;!(a.words[0]&E)&&G<26;++G,E<<=1);if(G>0)for(a.iushrn(G);G-- >0;)(x.isOdd()||A.isOdd())&&(x.iadd(c),A.isub(m)),x.iushrn(1),A.iushrn(1);u.cmp(a)>=0?(u.isub(a),f.isub(x),b.isub(A)):(a.isub(u),x.isub(f),A.isub(b))}return{a:x,b:A,gcd:a.iushln(_)}},s.prototype._invmp=function(d){i(d.negative===0),i(!d.isZero());var u=this,a=d.clone();u.negative!==0?u=u.umod(d):u=u.clone();for(var f=new s(1),b=new s(0),x=a.clone();u.cmpn(1)>0&&a.cmpn(1)>0;){for(var A=0,_=1;!(u.words[0]&_)&&A<26;++A,_<<=1);if(A>0)for(u.iushrn(A);A-- >0;)f.isOdd()&&f.iadd(x),f.iushrn(1);for(var c=0,m=1;!(a.words[0]&m)&&c<26;++c,m<<=1);if(c>0)for(a.iushrn(c);c-- >0;)b.isOdd()&&b.iadd(x),b.iushrn(1);u.cmp(a)>=0?(u.isub(a),f.isub(b)):(a.isub(u),b.isub(f))}var v;return u.cmpn(1)===0?v=f:v=b,v.cmpn(0)<0&&v.iadd(d),v},s.prototype.gcd=function(d){if(this.isZero())return d.abs();if(d.isZero())return this.abs();var u=this.clone(),a=d.clone();u.negative=0,a.negative=0;for(var f=0;u.isEven()&&a.isEven();f++)u.iushrn(1),a.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;a.isEven();)a.iushrn(1);var b=u.cmp(a);if(b<0){var x=u;u=a,a=x}else if(b===0||a.cmpn(1)===0)break;u.isub(a)}while(!0);return a.iushln(f)},s.prototype.invm=function(d){return this.egcd(d).a.umod(d)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(d){return this.words[0]&d},s.prototype.bincn=function(d){i(typeof d=="number");var u=d%26,a=(d-u)/26,f=1<<u;if(this.length<=a)return this._expand(a+1),this.words[a]|=f,this;for(var b=f,x=a;b!==0&&x<this.length;x++){var A=this.words[x]|0;A+=b,b=A>>>26,A&=67108863,this.words[x]=A}return b!==0&&(this.words[x]=b,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(d){var u=d<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this.strip();var a;if(this.length>1)a=1;else{u&&(d=-d),i(d<=67108863,"Number is too big");var f=this.words[0]|0;a=f===d?0:f<d?-1:1}return this.negative!==0?-a|0:a},s.prototype.cmp=function(d){if(this.negative!==0&&d.negative===0)return-1;if(this.negative===0&&d.negative!==0)return 1;var u=this.ucmp(d);return this.negative!==0?-u|0:u},s.prototype.ucmp=function(d){if(this.length>d.length)return 1;if(this.length<d.length)return-1;for(var u=0,a=this.length-1;a>=0;a--){var f=this.words[a]|0,b=d.words[a]|0;if(f!==b){f<b?u=-1:f>b&&(u=1);break}}return u},s.prototype.gtn=function(d){return this.cmpn(d)===1},s.prototype.gt=function(d){return this.cmp(d)===1},s.prototype.gten=function(d){return this.cmpn(d)>=0},s.prototype.gte=function(d){return this.cmp(d)>=0},s.prototype.ltn=function(d){return this.cmpn(d)===-1},s.prototype.lt=function(d){return this.cmp(d)===-1},s.prototype.lten=function(d){return this.cmpn(d)<=0},s.prototype.lte=function(d){return this.cmp(d)<=0},s.prototype.eqn=function(d){return this.cmpn(d)===0},s.prototype.eq=function(d){return this.cmp(d)===0},s.red=function(d){return new V(d)},s.prototype.toRed=function(d){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),d.convertTo(this)._forceRed(d)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(d){return this.red=d,this},s.prototype.forceRed=function(d){return i(!this.red,"Already a number in reduction context"),this._forceRed(d)},s.prototype.redAdd=function(d){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,d)},s.prototype.redIAdd=function(d){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,d)},s.prototype.redSub=function(d){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,d)},s.prototype.redISub=function(d){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,d)},s.prototype.redShl=function(d){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,d)},s.prototype.redMul=function(d){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.mul(this,d)},s.prototype.redIMul=function(d){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.imul(this,d)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(d){return i(this.red&&!d.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,d)};var K={k256:null,p224:null,p192:null,p25519:null};function F(O,d){this.name=O,this.p=new s(d,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}F.prototype._tmp=function(){var d=new s(null);return d.words=new Array(Math.ceil(this.n/13)),d},F.prototype.ireduce=function(d){var u=d,a;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),a=u.bitLength();while(a>this.n);var f=a<this.n?-1:u.ucmp(this.p);return f===0?(u.words[0]=0,u.length=1):f>0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},F.prototype.split=function(d,u){d.iushrn(this.n,0,u)},F.prototype.imulK=function(d){return d.imul(this.k)};function $(){F.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n($,F),$.prototype.split=function(d,u){for(var a=4194303,f=Math.min(d.length,9),b=0;b<f;b++)u.words[b]=d.words[b];if(u.length=f,d.length<=9){d.words[0]=0,d.length=1;return}var x=d.words[9];for(u.words[u.length++]=x&a,b=10;b<d.length;b++){var A=d.words[b]|0;d.words[b-10]=(A&a)<<4|x>>>22,x=A}x>>>=22,d.words[b-10]=x,x===0&&d.length>10?d.length-=10:d.length-=9},$.prototype.imulK=function(d){d.words[d.length]=0,d.words[d.length+1]=0,d.length+=2;for(var u=0,a=0;a<d.length;a++){var f=d.words[a]|0;u+=f*977,d.words[a]=u&67108863,u=f*64+(u/67108864|0)}return d.words[d.length-1]===0&&(d.length--,d.words[d.length-1]===0&&d.length--),d};function q(){F.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(q,F);function y(){F.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(y,F);function R(){F.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(R,F),R.prototype.imulK=function(d){for(var u=0,a=0;a<d.length;a++){var f=(d.words[a]|0)*19+u,b=f&67108863;f>>>=26,d.words[a]=b,u=f}return u!==0&&(d.words[d.length++]=u),d},s._prime=function(d){if(K[d])return K[d];var u;if(d==="k256")u=new $;else if(d==="p224")u=new q;else if(d==="p192")u=new y;else if(d==="p25519")u=new R;else throw new Error("Unknown prime "+d);return K[d]=u,u};function V(O){if(typeof O=="string"){var d=s._prime(O);this.m=d.p,this.prime=d}else i(O.gtn(1),"modulus must be greater than 1"),this.m=O,this.prime=null}V.prototype._verify1=function(d){i(d.negative===0,"red works only with positives"),i(d.red,"red works only with red numbers")},V.prototype._verify2=function(d,u){i((d.negative|u.negative)===0,"red works only with positives"),i(d.red&&d.red===u.red,"red works only with red numbers")},V.prototype.imod=function(d){return this.prime?this.prime.ireduce(d)._forceRed(this):d.umod(this.m)._forceRed(this)},V.prototype.neg=function(d){return d.isZero()?d.clone():this.m.sub(d)._forceRed(this)},V.prototype.add=function(d,u){this._verify2(d,u);var a=d.add(u);return a.cmp(this.m)>=0&&a.isub(this.m),a._forceRed(this)},V.prototype.iadd=function(d,u){this._verify2(d,u);var a=d.iadd(u);return a.cmp(this.m)>=0&&a.isub(this.m),a},V.prototype.sub=function(d,u){this._verify2(d,u);var a=d.sub(u);return a.cmpn(0)<0&&a.iadd(this.m),a._forceRed(this)},V.prototype.isub=function(d,u){this._verify2(d,u);var a=d.isub(u);return a.cmpn(0)<0&&a.iadd(this.m),a},V.prototype.shl=function(d,u){return this._verify1(d),this.imod(d.ushln(u))},V.prototype.imul=function(d,u){return this._verify2(d,u),this.imod(d.imul(u))},V.prototype.mul=function(d,u){return this._verify2(d,u),this.imod(d.mul(u))},V.prototype.isqr=function(d){return this.imul(d,d.clone())},V.prototype.sqr=function(d){return this.mul(d,d)},V.prototype.sqrt=function(d){if(d.isZero())return d.clone();var u=this.m.andln(3);if(i(u%2===1),u===3){var a=this.m.add(new s(1)).iushrn(2);return this.pow(d,a)}for(var f=this.m.subn(1),b=0;!f.isZero()&&f.andln(1)===0;)b++,f.iushrn(1);i(!f.isZero());var x=new s(1).toRed(this),A=x.redNeg(),_=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new s(2*c*c).toRed(this);this.pow(c,_).cmp(A)!==0;)c.redIAdd(A);for(var m=this.pow(c,f),v=this.pow(d,f.addn(1).iushrn(1)),S=this.pow(d,f),G=b;S.cmp(x)!==0;){for(var E=S,k=0;E.cmp(x)!==0;k++)E=E.redSqr();i(k<G);var C=this.pow(m,new s(1).iushln(G-k-1));v=v.redMul(C),m=C.redSqr(),S=S.redMul(m),G=k}return v},V.prototype.invm=function(d){var u=d._invmp(this.m);return u.negative!==0?(u.negative=0,this.imod(u).redNeg()):this.imod(u)},V.prototype.pow=function(d,u){if(u.isZero())return new s(1).toRed(this);if(u.cmpn(1)===0)return d.clone();var a=4,f=new Array(1<<a);f[0]=new s(1).toRed(this),f[1]=d;for(var b=2;b<f.length;b++)f[b]=this.mul(f[b-1],d);var x=f[0],A=0,_=0,c=u.bitLength()%26;for(c===0&&(c=26),b=u.length-1;b>=0;b--){for(var m=u.words[b],v=c-1;v>=0;v--){var S=m>>v&1;if(x!==f[0]&&(x=this.sqr(x)),S===0&&A===0){_=0;continue}A<<=1,A|=S,_++,!(_!==a&&(b!==0||v!==0))&&(x=this.mul(x,f[A]),_=0,A=0)}c=26}return x},V.prototype.convertTo=function(d){var u=d.umod(this.m);return u===d?u.clone():u},V.prototype.convertFrom=function(d){var u=d.clone();return u.red=null,u},s.mont=function(d){return new Q(d)};function Q(O){V.call(this,O),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(Q,V),Q.prototype.convertTo=function(d){return this.imod(d.ushln(this.shift))},Q.prototype.convertFrom=function(d){var u=this.imod(d.mul(this.rinv));return u.red=null,u},Q.prototype.imul=function(d,u){if(d.isZero()||u.isZero())return d.words[0]=0,d.length=1,d;var a=d.imul(u),f=a.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=a.isub(f).iushrn(this.shift),x=b;return b.cmp(this.m)>=0?x=b.isub(this.m):b.cmpn(0)<0&&(x=b.iadd(this.m)),x._forceRed(this)},Q.prototype.mul=function(d,u){if(d.isZero()||u.isZero())return new s(0)._forceRed(this);var a=d.mul(u),f=a.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=a.isub(f).iushrn(this.shift),x=b;return b.cmp(this.m)>=0?x=b.isub(this.m):b.cmpn(0)<0&&(x=b.iadd(this.m)),x._forceRed(this)},Q.prototype.invm=function(d){var u=this.imod(d._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(t,Bt)})(Ki);var Ih={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var h=[];if(typeof s!="string"){for(var l=0;l<s.length;l++)h[l]=s[l]|0;return h}if(o==="hex"){s=s.replace(/[^a-z0-9]+/ig,""),s.length%2!==0&&(s="0"+s);for(var l=0;l<s.length;l+=2)h.push(parseInt(s[l]+s[l+1],16))}else for(var l=0;l<s.length;l++){var p=s.charCodeAt(l),w=p>>8,M=p&255;w?h.push(w,M):h.push(M)}return h}e.toArray=r;function i(s){return s.length===1?"0"+s:s}e.zero2=i;function n(s){for(var o="",h=0;h<s.length;h++)o+=i(s[h].toString(16));return o}e.toHex=n,e.encode=function(o,h){return h==="hex"?n(o):o}})(Ih),function(t){var e=t,r=Ki.exports,i=rs,n=Ih;e.assert=i,e.toArray=n.toArray,e.zero2=n.zero2,e.toHex=n.toHex,e.encode=n.encode;function s(w,M,I){var D=new Array(Math.max(w.bitLength(),I)+1),N;for(N=0;N<D.length;N+=1)D[N]=0;var U=1<<M+1,z=w.clone();for(N=0;N<D.length;N++){var H,L=z.andln(U-1);z.isOdd()?(L>(U>>1)-1?H=(U>>1)-L:H=L,z.isubn(H)):H=0,D[N]=H,z.iushrn(1)}return D}e.getNAF=s;function o(w,M){var I=[[],[]];w=w.clone(),M=M.clone();for(var D=0,N=0,U;w.cmpn(-D)>0||M.cmpn(-N)>0;){var z=w.andln(3)+D&3,H=M.andln(3)+N&3;z===3&&(z=-1),H===3&&(H=-1);var L;z&1?(U=w.andln(7)+D&7,(U===3||U===5)&&H===2?L=-z:L=z):L=0,I[0].push(L);var K;H&1?(U=M.andln(7)+N&7,(U===3||U===5)&&z===2?K=-H:K=H):K=0,I[1].push(K),2*D===L+1&&(D=1-D),2*N===K+1&&(N=1-N),w.iushrn(1),M.iushrn(1)}return I}e.getJSF=o;function h(w,M,I){var D="_"+M;w.prototype[M]=function(){return this[D]!==void 0?this[D]:this[D]=I.call(this)}}e.cachedProperty=h;function l(w){return typeof w=="string"?e.toArray(w,"hex"):w}e.parseBytes=l;function p(w){return new r(w,"hex","le")}e.intFromLE=p}(Gr);var po={exports:{}},Nh;po.exports=function(e){return Nh||(Nh=new Tn(null)),Nh.generate(e)};function Tn(t){this.rand=t}if(po.exports.Rand=Tn,Tn.prototype.generate=function(e){return this._rand(e)},Tn.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),i=0;i<r.length;i++)r[i]=this.rand.getByte();return r},typeof self=="object")self.crypto&&self.crypto.getRandomValues?Tn.prototype._rand=function(e){var r=new Uint8Array(e);return self.crypto.getRandomValues(r),r}:self.msCrypto&&self.msCrypto.getRandomValues?Tn.prototype._rand=function(e){var r=new Uint8Array(e);return self.msCrypto.getRandomValues(r),r}:typeof window=="object"&&(Tn.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o1=Nn;if(typeof o1.randomBytes!="function")throw new Error("Not supported");Tn.prototype._rand=function(e){return o1.randomBytes(e)}}catch{}var Oh={},ss=Ki.exports,ja=Gr,bo=ja.getNAF,Py=ja.getJSF,vo=ja.assert;function Bn(t,e){this.type=t,this.p=new ss(e.p,16),this.red=e.prime?ss.red(e.prime):ss.mont(this.p),this.zero=new ss(0).toRed(this.red),this.one=new ss(1).toRed(this.red),this.two=new ss(2).toRed(this.red),this.n=e.n&&new ss(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var go=Bn;Bn.prototype.point=function(){throw new Error("Not implemented")},Bn.prototype.validate=function(){throw new Error("Not implemented")},Bn.prototype._fixedNafMul=function(e,r){vo(e.precomputed);var i=e._getDoubles(),n=bo(r,1,this._bitLength),s=(1<<i.step+1)-(i.step%2===0?2:1);s/=3;var o=[],h,l;for(h=0;h<n.length;h+=i.step){l=0;for(var p=h+i.step-1;p>=h;p--)l=(l<<1)+n[p];o.push(l)}for(var w=this.jpoint(null,null,null),M=this.jpoint(null,null,null),I=s;I>0;I--){for(h=0;h<o.length;h++)l=o[h],l===I?M=M.mixedAdd(i.points[h]):l===-I&&(M=M.mixedAdd(i.points[h].neg()));w=w.add(M)}return w.toP()},Bn.prototype._wnafMul=function(e,r){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var s=n.points,o=bo(r,i,this._bitLength),h=this.jpoint(null,null,null),l=o.length-1;l>=0;l--){for(var p=0;l>=0&&o[l]===0;l--)p++;if(l>=0&&p++,h=h.dblp(p),l<0)break;var w=o[l];vo(w!==0),e.type==="affine"?w>0?h=h.mixedAdd(s[w-1>>1]):h=h.mixedAdd(s[-w-1>>1].neg()):w>0?h=h.add(s[w-1>>1]):h=h.add(s[-w-1>>1].neg())}return e.type==="affine"?h.toP():h},Bn.prototype._wnafMulAdd=function(e,r,i,n,s){var o=this._wnafT1,h=this._wnafT2,l=this._wnafT3,p=0,w,M,I;for(w=0;w<n;w++){I=r[w];var D=I._getNAFPoints(e);o[w]=D.wnd,h[w]=D.points}for(w=n-1;w>=1;w-=2){var N=w-1,U=w;if(o[N]!==1||o[U]!==1){l[N]=bo(i[N],o[N],this._bitLength),l[U]=bo(i[U],o[U],this._bitLength),p=Math.max(l[N].length,p),p=Math.max(l[U].length,p);continue}var z=[r[N],null,null,r[U]];r[N].y.cmp(r[U].y)===0?(z[1]=r[N].add(r[U]),z[2]=r[N].toJ().mixedAdd(r[U].neg())):r[N].y.cmp(r[U].y.redNeg())===0?(z[1]=r[N].toJ().mixedAdd(r[U]),z[2]=r[N].add(r[U].neg())):(z[1]=r[N].toJ().mixedAdd(r[U]),z[2]=r[N].toJ().mixedAdd(r[U].neg()));var H=[-3,-1,-5,-7,0,7,5,1,3],L=Py(i[N],i[U]);for(p=Math.max(L[0].length,p),l[N]=new Array(p),l[U]=new Array(p),M=0;M<p;M++){var K=L[0][M]|0,F=L[1][M]|0;l[N][M]=H[(K+1)*3+(F+1)],l[U][M]=0,h[N]=z}}var $=this.jpoint(null,null,null),q=this._wnafT4;for(w=p;w>=0;w--){for(var y=0;w>=0;){var R=!0;for(M=0;M<n;M++)q[M]=l[M][w]|0,q[M]!==0&&(R=!1);if(!R)break;y++,w--}if(w>=0&&y++,$=$.dblp(y),w<0)break;for(M=0;M<n;M++){var V=q[M];V!==0&&(V>0?I=h[M][V-1>>1]:V<0&&(I=h[M][-V-1>>1].neg()),I.type==="affine"?$=$.mixedAdd(I):$=$.add(I))}}for(w=0;w<n;w++)h[w]=null;return s?$:$.toP()};function si(t,e){this.curve=t,this.type=e,this.precomputed=null}Bn.BasePoint=si,si.prototype.eq=function(){throw new Error("Not implemented")},si.prototype.validate=function(){return this.curve.validate(this)},Bn.prototype.decodePoint=function(e,r){e=ja.toArray(e,r);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?vo(e[e.length-1]%2===0):e[0]===7&&vo(e[e.length-1]%2===1);var n=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return n}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")},si.prototype.encodeCompressed=function(e){return this.encode(e,!0)},si.prototype._encode=function(e){var r=this.curve.p.byteLength(),i=this.getX().toArray("be",r);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",r))},si.prototype.encode=function(e,r){return ja.encode(this._encode(r),e)},si.prototype.precompute=function(e){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,e),r.beta=this._getBeta(),this.precomputed=r,this},si.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return r?r.points.length>=Math.ceil((e.bitLength()+1)/r.step):!1},si.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,s=0;s<r;s+=e){for(var o=0;o<e;o++)n=n.dbl();i.push(n)}return{step:e,points:i}},si.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),s=1;s<i;s++)r[s]=r[s-1].add(n);return{wnd:e,points:r}},si.prototype._getBeta=function(){return null},si.prototype.dblp=function(e){for(var r=this,i=0;i<e;i++)r=r.dbl();return r};var Ty=Gr,Nt=Ki.exports,Rh=js.exports,Zs=go,By=Ty.assert;function ai(t){Zs.call(this,"short",t),this.a=new Nt(t.a,16).toRed(this.red),this.b=new Nt(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Rh(ai,Zs);var Fy=ai;ai.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,i;if(e.beta)r=new Nt(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);r=n[0].cmp(n[1])<0?n[0]:n[1],r=r.toRed(this.red)}if(e.lambda)i=new Nt(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(r))===0?i=s[0]:(i=s[1],By(this.g.mul(i).x.cmp(this.g.x.redMul(r))===0))}var o;return e.basis?o=e.basis.map(function(h){return{a:new Nt(h.a,16),b:new Nt(h.b,16)}}):o=this._getEndoBasis(i),{beta:r,lambda:i,basis:o}}},ai.prototype._getEndoRoots=function(e){var r=e===this.p?this.red:Nt.mont(e),i=new Nt(2).toRed(r).redInvm(),n=i.redNeg(),s=new Nt(3).toRed(r).redNeg().redSqrt().redMul(i),o=n.redAdd(s).fromRed(),h=n.redSub(s).fromRed();return[o,h]},ai.prototype._getEndoBasis=function(e){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),s=new Nt(1),o=new Nt(0),h=new Nt(0),l=new Nt(1),p,w,M,I,D,N,U,z=0,H,L;i.cmpn(0)!==0;){var K=n.div(i);H=n.sub(K.mul(i)),L=h.sub(K.mul(s));var F=l.sub(K.mul(o));if(!M&&H.cmp(r)<0)p=U.neg(),w=s,M=H.neg(),I=L;else if(M&&++z===2)break;U=H,n=i,i=H,h=s,s=L,l=o,o=F}D=H.neg(),N=L;var $=M.sqr().add(I.sqr()),q=D.sqr().add(N.sqr());return q.cmp($)>=0&&(D=p,N=w),M.negative&&(M=M.neg(),I=I.neg()),D.negative&&(D=D.neg(),N=N.neg()),[{a:M,b:I},{a:D,b:N}]},ai.prototype._endoSplit=function(e){var r=this.endo.basis,i=r[0],n=r[1],s=n.b.mul(e).divRound(this.n),o=i.b.neg().mul(e).divRound(this.n),h=s.mul(i.a),l=o.mul(n.a),p=s.mul(i.b),w=o.mul(n.b),M=e.sub(h).sub(l),I=p.add(w).neg();return{k1:M,k2:I}},ai.prototype.pointFromX=function(e,r){e=new Nt(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var s=n.fromRed().isOdd();return(r&&!s||!r&&s)&&(n=n.redNeg()),this.point(e,n)},ai.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,i=e.y,n=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(s).cmpn(0)===0},ai.prototype._endoWnafMulAdd=function(e,r,i){for(var n=this._endoWnafT1,s=this._endoWnafT2,o=0;o<e.length;o++){var h=this._endoSplit(r[o]),l=e[o],p=l._getBeta();h.k1.negative&&(h.k1.ineg(),l=l.neg(!0)),h.k2.negative&&(h.k2.ineg(),p=p.neg(!0)),n[o*2]=l,n[o*2+1]=p,s[o*2]=h.k1,s[o*2+1]=h.k2}for(var w=this._wnafMulAdd(1,n,s,o*2,i),M=0;M<o*2;M++)n[M]=null,s[M]=null;return w};function zt(t,e,r,i){Zs.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Nt(e,16),this.y=new Nt(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}Rh(zt,Zs.BasePoint),ai.prototype.point=function(e,r,i){return new zt(this,e,r,i)},ai.prototype.pointFromJSON=function(e,r){return zt.fromJSON(this,e,r)},zt.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var r=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,n=function(s){return i.point(s.x.redMul(i.endo.beta),s.y)};e.beta=r,r.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return r}},zt.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},zt.fromJSON=function(e,r,i){typeof r=="string"&&(r=JSON.parse(r));var n=e.point(r[0],r[1],i);if(!r[2])return n;function s(h){return e.point(h[0],h[1],i)}var o=r[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(s))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(s))}},n},zt.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},zt.prototype.isInfinity=function(){return this.inf},zt.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var i=r.redSqr().redISub(this.x).redISub(e.x),n=r.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)},zt.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),s=i.redAdd(i).redIAdd(i).redIAdd(r).redMul(n),o=s.redSqr().redISub(this.x.redAdd(this.x)),h=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,h)},zt.prototype.getX=function(){return this.x.fromRed()},zt.prototype.getY=function(){return this.y.fromRed()},zt.prototype.mul=function(e){return e=new Nt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},zt.prototype.mulAdd=function(e,r,i){var n=[this,r],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)},zt.prototype.jmulAdd=function(e,r,i){var n=[this,r],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)},zt.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},zt.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(s){return s.neg()};r.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return r},zt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function er(t,e,r,i){Zs.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Nt(0)):(this.x=new Nt(e,16),this.y=new Nt(r,16),this.z=new Nt(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Rh(er,Zs.BasePoint),ai.prototype.jpoint=function(e,r,i){return new er(this,e,r,i)},er.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),i=this.x.redMul(r),n=this.y.redMul(r).redMul(e);return this.curve.point(i,n)},er.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},er.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(r),s=e.x.redMul(i),o=this.y.redMul(r.redMul(e.z)),h=e.y.redMul(i.redMul(this.z)),l=n.redSub(s),p=o.redSub(h);if(l.cmpn(0)===0)return p.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var w=l.redSqr(),M=w.redMul(l),I=n.redMul(w),D=p.redSqr().redIAdd(M).redISub(I).redISub(I),N=p.redMul(I.redISub(D)).redISub(o.redMul(M)),U=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(D,N,U)},er.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),i=this.x,n=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),h=i.redSub(n),l=s.redSub(o);if(h.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var p=h.redSqr(),w=p.redMul(h),M=i.redMul(p),I=l.redSqr().redIAdd(w).redISub(M).redISub(M),D=l.redMul(M.redISub(I)).redISub(s.redMul(w)),N=this.z.redMul(h);return this.curve.jpoint(I,D,N)},er.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var i=this;for(r=0;r<e;r++)i=i.dbl();return i}var n=this.curve.a,s=this.curve.tinv,o=this.x,h=this.y,l=this.z,p=l.redSqr().redSqr(),w=h.redAdd(h);for(r=0;r<e;r++){var M=o.redSqr(),I=w.redSqr(),D=I.redSqr(),N=M.redAdd(M).redIAdd(M).redIAdd(n.redMul(p)),U=o.redMul(I),z=N.redSqr().redISub(U.redAdd(U)),H=U.redISub(z),L=N.redMul(H);L=L.redIAdd(L).redISub(D);var K=w.redMul(l);r+1<e&&(p=p.redMul(D)),o=z,l=K,w=L}return this.curve.jpoint(o,w.redMul(s),l)},er.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},er.prototype._zeroDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),o=s.redSqr(),h=this.x.redAdd(s).redSqr().redISub(n).redISub(o);h=h.redIAdd(h);var l=n.redAdd(n).redIAdd(n),p=l.redSqr().redISub(h).redISub(h),w=o.redIAdd(o);w=w.redIAdd(w),w=w.redIAdd(w),e=p,r=l.redMul(h.redISub(p)).redISub(w),i=this.y.redAdd(this.y)}else{var M=this.x.redSqr(),I=this.y.redSqr(),D=I.redSqr(),N=this.x.redAdd(I).redSqr().redISub(M).redISub(D);N=N.redIAdd(N);var U=M.redAdd(M).redIAdd(M),z=U.redSqr(),H=D.redIAdd(D);H=H.redIAdd(H),H=H.redIAdd(H),e=z.redISub(N).redISub(N),r=U.redMul(N.redISub(e)).redISub(H),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,r,i)},er.prototype._threeDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),o=s.redSqr(),h=this.x.redAdd(s).redSqr().redISub(n).redISub(o);h=h.redIAdd(h);var l=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),p=l.redSqr().redISub(h).redISub(h);e=p;var w=o.redIAdd(o);w=w.redIAdd(w),w=w.redIAdd(w),r=l.redMul(h.redISub(p)).redISub(w),i=this.y.redAdd(this.y)}else{var M=this.z.redSqr(),I=this.y.redSqr(),D=this.x.redMul(I),N=this.x.redSub(M).redMul(this.x.redAdd(M));N=N.redAdd(N).redIAdd(N);var U=D.redIAdd(D);U=U.redIAdd(U);var z=U.redAdd(U);e=N.redSqr().redISub(z),i=this.y.redAdd(this.z).redSqr().redISub(I).redISub(M);var H=I.redSqr();H=H.redIAdd(H),H=H.redIAdd(H),H=H.redIAdd(H),r=N.redMul(U.redISub(e)).redISub(H)}return this.curve.jpoint(e,r,i)},er.prototype._dbl=function(){var e=this.curve.a,r=this.x,i=this.y,n=this.z,s=n.redSqr().redSqr(),o=r.redSqr(),h=i.redSqr(),l=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(s)),p=r.redAdd(r);p=p.redIAdd(p);var w=p.redMul(h),M=l.redSqr().redISub(w.redAdd(w)),I=w.redISub(M),D=h.redSqr();D=D.redIAdd(D),D=D.redIAdd(D),D=D.redIAdd(D);var N=l.redMul(I).redISub(D),U=i.redAdd(i).redMul(n);return this.curve.jpoint(M,N,U)},er.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),r=this.y.redSqr(),i=this.z.redSqr(),n=r.redSqr(),s=e.redAdd(e).redIAdd(e),o=s.redSqr(),h=this.x.redAdd(r).redSqr().redISub(e).redISub(n);h=h.redIAdd(h),h=h.redAdd(h).redIAdd(h),h=h.redISub(o);var l=h.redSqr(),p=n.redIAdd(n);p=p.redIAdd(p),p=p.redIAdd(p),p=p.redIAdd(p);var w=s.redIAdd(h).redSqr().redISub(o).redISub(l).redISub(p),M=r.redMul(w);M=M.redIAdd(M),M=M.redIAdd(M);var I=this.x.redMul(l).redISub(M);I=I.redIAdd(I),I=I.redIAdd(I);var D=this.y.redMul(w.redMul(p.redISub(w)).redISub(h.redMul(l)));D=D.redIAdd(D),D=D.redIAdd(D),D=D.redIAdd(D);var N=this.z.redAdd(h).redSqr().redISub(i).redISub(l);return this.curve.jpoint(I,D,N)},er.prototype.mul=function(e,r){return e=new Nt(e,r),this.curve._wnafMul(this,e)},er.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var r=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(r)).cmpn(0)!==0)return!1;var n=r.redMul(this.z),s=i.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0},er.prototype.eqXToP=function(e){var r=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(r);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(r);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(s),this.x.cmp(i)===0)return!0}},er.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},er.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var ea=Ki.exports,h1=js.exports,mo=go,Ly=Gr;function ta(t){mo.call(this,"mont",t),this.a=new ea(t.a,16).toRed(this.red),this.b=new ea(t.b,16).toRed(this.red),this.i4=new ea(4).toRed(this.red).redInvm(),this.two=new ea(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}h1(ta,mo);var Uy=ta;ta.prototype.validate=function(e){var r=e.normalize().x,i=r.redSqr(),n=i.redMul(r).redAdd(i.redMul(this.a)).redAdd(r),s=n.redSqrt();return s.redSqr().cmp(n)===0};function kt(t,e,r){mo.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new ea(e,16),this.z=new ea(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}h1(kt,mo.BasePoint),ta.prototype.decodePoint=function(e,r){return this.point(Ly.toArray(e,r),1)},ta.prototype.point=function(e,r){return new kt(this,e,r)},ta.prototype.pointFromJSON=function(e){return kt.fromJSON(this,e)},kt.prototype.precompute=function(){},kt.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},kt.fromJSON=function(e,r){return new kt(e,r[0],r[1]||e.one)},kt.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},kt.prototype.isInfinity=function(){return this.z.cmpn(0)===0},kt.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),i=this.x.redSub(this.z),n=i.redSqr(),s=r.redSub(n),o=r.redMul(n),h=s.redMul(n.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,h)},kt.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},kt.prototype.diffAdd=function(e,r){var i=this.x.redAdd(this.z),n=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),h=o.redMul(i),l=s.redMul(n),p=r.z.redMul(h.redAdd(l).redSqr()),w=r.x.redMul(h.redISub(l).redSqr());return this.curve.point(p,w)},kt.prototype.mul=function(e){for(var r=e.clone(),i=this,n=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var h=o.length-1;h>=0;h--)o[h]===0?(i=i.diffAdd(n,s),n=n.dbl()):(n=i.diffAdd(n,s),i=i.dbl());return n},kt.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},kt.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},kt.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},kt.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},kt.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var $y=Gr,un=Ki.exports,c1=js.exports,yo=go,qy=$y.assert;function Hi(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,yo.call(this,"edwards",t),this.a=new un(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new un(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new un(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),qy(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}c1(Hi,yo);var zy=Hi;Hi.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},Hi.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},Hi.prototype.jpoint=function(e,r,i,n){return this.point(e,r,i,n)},Hi.prototype.pointFromX=function(e,r){e=new un(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=this.c2.redSub(this.a.redMul(i)),s=this.one.redSub(this.c2.redMul(this.d).redMul(i)),o=n.redMul(s.redInvm()),h=o.redSqrt();if(h.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var l=h.fromRed().isOdd();return(r&&!l||!r&&l)&&(h=h.redNeg()),this.point(e,h)},Hi.prototype.pointFromY=function(e,r){e=new un(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=i.redSub(this.c2),s=i.redMul(this.d).redMul(this.c2).redSub(this.a),o=n.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var h=o.redSqrt();if(h.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return h.fromRed().isOdd()!==r&&(h=h.redNeg()),this.point(h,e)},Hi.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),i=e.y.redSqr(),n=r.redMul(this.a).redAdd(i),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(i)));return n.cmp(s)===0};function yt(t,e,r,i,n){yo.BasePoint.call(this,t,"projective"),e===null&&r===null&&i===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new un(e,16),this.y=new un(r,16),this.z=i?new un(i,16):this.curve.one,this.t=n&&new un(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}c1(yt,yo.BasePoint),Hi.prototype.pointFromJSON=function(e){return yt.fromJSON(this,e)},Hi.prototype.point=function(e,r,i,n){return new yt(this,e,r,i,n)},yt.fromJSON=function(e,r){return new yt(e,r[0],r[1],r[2])},yt.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},yt.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},yt.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),i=this.z.redSqr();i=i.redIAdd(i);var n=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=n.redAdd(r),h=o.redSub(i),l=n.redSub(r),p=s.redMul(h),w=o.redMul(l),M=s.redMul(l),I=h.redMul(o);return this.curve.point(p,w,I,M)},yt.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),i=this.y.redSqr(),n,s,o,h,l,p;if(this.curve.twisted){h=this.curve._mulA(r);var w=h.redAdd(i);this.zOne?(n=e.redSub(r).redSub(i).redMul(w.redSub(this.curve.two)),s=w.redMul(h.redSub(i)),o=w.redSqr().redSub(w).redSub(w)):(l=this.z.redSqr(),p=w.redSub(l).redISub(l),n=e.redSub(r).redISub(i).redMul(p),s=w.redMul(h.redSub(i)),o=w.redMul(p))}else h=r.redAdd(i),l=this.curve._mulC(this.z).redSqr(),p=h.redSub(l).redSub(l),n=this.curve._mulC(e.redISub(h)).redMul(p),s=this.curve._mulC(h).redMul(r.redISub(i)),o=h.redMul(p);return this.curve.point(n,s,o)},yt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},yt.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),i=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=i.redSub(r),h=s.redSub(n),l=s.redAdd(n),p=i.redAdd(r),w=o.redMul(h),M=l.redMul(p),I=o.redMul(p),D=h.redMul(l);return this.curve.point(w,M,D,I)},yt.prototype._projAdd=function(e){var r=this.z.redMul(e.z),i=r.redSqr(),n=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(n).redMul(s),h=i.redSub(o),l=i.redAdd(o),p=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(n).redISub(s),w=r.redMul(h).redMul(p),M,I;return this.curve.twisted?(M=r.redMul(l).redMul(s.redSub(this.curve._mulA(n))),I=h.redMul(l)):(M=r.redMul(l).redMul(s.redSub(n)),I=this.curve._mulC(h).redMul(l)),this.curve.point(w,M,I)},yt.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},yt.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},yt.prototype.mulAdd=function(e,r,i){return this.curve._wnafMulAdd(1,[this,r],[e,i],2,!1)},yt.prototype.jmulAdd=function(e,r,i){return this.curve._wnafMulAdd(1,[this,r],[e,i],2,!0)},yt.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},yt.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},yt.prototype.getX=function(){return this.normalize(),this.x.fromRed()},yt.prototype.getY=function(){return this.normalize(),this.y.fromRed()},yt.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},yt.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var i=e.clone(),n=this.curve.redN.redMul(this.z);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),this.x.cmp(r)===0)return!0}},yt.prototype.toP=yt.prototype.normalize,yt.prototype.mixedAdd=yt.prototype.add,function(t){var e=t;e.base=go,e.short=Fy,e.mont=Uy,e.edwards=zy}(Oh);var wo={},Ch,u1;function ky(){return u1||(u1=1,Ch={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Ch}(function(t){var e=t,r=Kr,i=Oh,n=Gr,s=n.assert;function o(p){p.type==="short"?this.curve=new i.short(p):p.type==="edwards"?this.curve=new i.edwards(p):this.curve=new i.mont(p),this.g=this.curve.g,this.n=this.curve.n,this.hash=p.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function h(p,w){Object.defineProperty(e,p,{configurable:!0,enumerable:!0,get:function(){var M=new o(w);return Object.defineProperty(e,p,{configurable:!0,enumerable:!0,value:M}),M}})}h("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),h("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),h("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),h("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),h("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),h("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),h("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var l;try{l=ky()}catch{l=void 0}h("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",l]})})(wo);var Ky=Kr,as=Ih,d1=rs;function Fn(t){if(!(this instanceof Fn))return new Fn(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=as.toArray(t.entropy,t.entropyEnc||"hex"),r=as.toArray(t.nonce,t.nonceEnc||"hex"),i=as.toArray(t.pers,t.persEnc||"hex");d1(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var Hy=Fn;Fn.prototype._init=function(e,r,i){var n=e.concat(r).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},Fn.prototype._hmac=function(){return new Ky.hmac(this.hash,this.K)},Fn.prototype._update=function(e){var r=this._hmac().update(this.V).update([0]);e&&(r=r.update(e)),this.K=r.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},Fn.prototype.reseed=function(e,r,i,n){typeof r!="string"&&(n=i,i=r,r=null),e=as.toArray(e,r),i=as.toArray(i,n),d1(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1},Fn.prototype.generate=function(e,r,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(n=i,i=r,r=null),i&&(i=as.toArray(i,n||"hex"),this._update(i));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var o=s.slice(0,e);return this._update(i),this._reseed++,as.encode(o,r)};var jy=Ki.exports,Gy=Gr,Ph=Gy.assert;function yr(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var Vy=yr;yr.fromPublic=function(e,r,i){return r instanceof yr?r:new yr(e,{pub:r,pubEnc:i})},yr.fromPrivate=function(e,r,i){return r instanceof yr?r:new yr(e,{priv:r,privEnc:i})},yr.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},yr.prototype.getPublic=function(e,r){return typeof e=="string"&&(r=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,e):this.pub},yr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},yr.prototype._importPrivate=function(e,r){this.priv=new jy(e,r||16),this.priv=this.priv.umod(this.ec.curve.n)},yr.prototype._importPublic=function(e,r){if(e.x||e.y){this.ec.curve.type==="mont"?Ph(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Ph(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,r)},yr.prototype.derive=function(e){return e.validate()||Ph(e.validate(),"public point not validated"),e.mul(this.priv).getX()},yr.prototype.sign=function(e,r,i){return this.ec.sign(e,this,r,i)},yr.prototype.verify=function(e,r,i){return this.ec.verify(e,r,this,void 0,i)},yr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var _o=Ki.exports,Th=Gr,Yy=Th.assert;function xo(t,e){if(t instanceof xo)return t;this._importDER(t,e)||(Yy(t.r&&t.s,"Signature without r or s"),this.r=new _o(t.r,16),this.s=new _o(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Jy=xo;function Wy(){this.place=0}function Bh(t,e){var r=t[e.place++];if(!(r&128))return r;var i=r&15;if(i===0||i>4||t[e.place]===0)return!1;for(var n=0,s=0,o=e.place;s<i;s++,o++)n<<=8,n|=t[o],n>>>=0;return n<=127?!1:(e.place=o,n)}function l1(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}xo.prototype._importDER=function(e,r){e=Th.toArray(e,r);var i=new Wy;if(e[i.place++]!==48)return!1;var n=Bh(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var s=Bh(e,i);if(s===!1||e[i.place]&128)return!1;var o=e.slice(i.place,s+i.place);if(i.place+=s,e[i.place++]!==2)return!1;var h=Bh(e,i);if(h===!1||e.length!==h+i.place||e[i.place]&128)return!1;var l=e.slice(i.place,h+i.place);if(o[0]===0)if(o[1]&128)o=o.slice(1);else return!1;if(l[0]===0)if(l[1]&128)l=l.slice(1);else return!1;return this.r=new _o(o),this.s=new _o(l),this.recoveryParam=null,!0};function Fh(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}xo.prototype.toDER=function(e){var r=this.r.toArray(),i=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),i[0]&128&&(i=[0].concat(i)),r=l1(r),i=l1(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];Fh(n,r.length),n=n.concat(r),n.push(2),Fh(n,i.length);var s=n.concat(i),o=[48];return Fh(o,s.length),o=o.concat(s),Th.encode(o,e)};var dn=Ki.exports,p1=Hy,Qy=Gr,Lh=wo,Xy=po.exports,b1=Qy.assert,Uh=Vy,Ao=Jy;function fi(t){if(!(this instanceof fi))return new fi(t);typeof t=="string"&&(b1(Object.prototype.hasOwnProperty.call(Lh,t),"Unknown curve "+t),t=Lh[t]),t instanceof Lh.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Zy=fi;fi.prototype.keyPair=function(e){return new Uh(this,e)},fi.prototype.keyFromPrivate=function(e,r){return Uh.fromPrivate(this,e,r)},fi.prototype.keyFromPublic=function(e,r){return Uh.fromPublic(this,e,r)},fi.prototype.genKeyPair=function(e){e||(e={});for(var r=new p1({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Xy(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new dn(2));;){var s=new dn(r.generate(i));if(!(s.cmp(n)>0))return s.iaddn(1),this.keyFromPrivate(s)}},fi.prototype._truncateToN=function(e,r,i){var n;if(dn.isBN(e)||typeof e=="number")e=new dn(e,16),n=e.byteLength();else if(typeof e=="object")n=e.length,e=new dn(e,16);else{var s=e.toString();n=s.length+1>>>1,e=new dn(s,16)}typeof i!="number"&&(i=n*8);var o=i-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},fi.prototype.sign=function(e,r,i,n){typeof i=="object"&&(n=i,i=null),n||(n={}),r=this.keyFromPrivate(r,i),e=this._truncateToN(e,!1,n.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),h=e.toArray("be",s),l=new p1({hash:this.hash,entropy:o,nonce:h,pers:n.pers,persEnc:n.persEnc||"utf8"}),p=this.n.sub(new dn(1)),w=0;;w++){var M=n.k?n.k(w):new dn(l.generate(this.n.byteLength()));if(M=this._truncateToN(M,!0),!(M.cmpn(1)<=0||M.cmp(p)>=0)){var I=this.g.mul(M);if(!I.isInfinity()){var D=I.getX(),N=D.umod(this.n);if(N.cmpn(0)!==0){var U=M.invm(this.n).mul(N.mul(r.getPrivate()).iadd(e));if(U=U.umod(this.n),U.cmpn(0)!==0){var z=(I.getY().isOdd()?1:0)|(D.cmp(N)!==0?2:0);return n.canonical&&U.cmp(this.nh)>0&&(U=this.n.sub(U),z^=1),new Ao({r:N,s:U,recoveryParam:z})}}}}}},fi.prototype.verify=function(e,r,i,n,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),i=this.keyFromPublic(i,n),r=new Ao(r,"hex");var o=r.r,h=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||h.cmpn(1)<0||h.cmp(this.n)>=0)return!1;var l=h.invm(this.n),p=l.mul(e).umod(this.n),w=l.mul(o).umod(this.n),M;return this.curve._maxwellTrick?(M=this.g.jmulAdd(p,i.getPublic(),w),M.isInfinity()?!1:M.eqXToP(o)):(M=this.g.mulAdd(p,i.getPublic(),w),M.isInfinity()?!1:M.getX().umod(this.n).cmp(o)===0)},fi.prototype.recoverPubKey=function(t,e,r,i){b1((3&r)===r,"The recovery param is more than two bits"),e=new Ao(e,i);var n=this.n,s=new dn(t),o=e.r,h=e.s,l=r&1,p=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&p)throw new Error("Unable to find sencond key candinate");p?o=this.curve.pointFromX(o.add(this.curve.n),l):o=this.curve.pointFromX(o,l);var w=e.r.invm(n),M=n.sub(s).mul(w).umod(n),I=h.mul(w).umod(n);return this.g.mulAdd(M,o,I)},fi.prototype.getKeyRecoveryParam=function(t,e,r,i){if(e=new Ao(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(t,e,n)}catch{continue}if(s.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var Ga=Gr,v1=Ga.assert,g1=Ga.parseBytes,ra=Ga.cachedProperty;function Kt(t,e){this.eddsa=t,this._secret=g1(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=g1(e.pub)}Kt.fromPublic=function(e,r){return r instanceof Kt?r:new Kt(e,{pub:r})},Kt.fromSecret=function(e,r){return r instanceof Kt?r:new Kt(e,{secret:r})},Kt.prototype.secret=function(){return this._secret},ra(Kt,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),ra(Kt,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),ra(Kt,"privBytes",function(){var e=this.eddsa,r=this.hash(),i=e.encodingLength-1,n=r.slice(0,e.encodingLength);return n[0]&=248,n[i]&=127,n[i]|=64,n}),ra(Kt,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),ra(Kt,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),ra(Kt,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Kt.prototype.sign=function(e){return v1(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Kt.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},Kt.prototype.getSecret=function(e){return v1(this._secret,"KeyPair is public only"),Ga.encode(this.secret(),e)},Kt.prototype.getPublic=function(e){return Ga.encode(this.pubBytes(),e)};var ew=Kt,tw=Ki.exports,Mo=Gr,m1=Mo.assert,Eo=Mo.cachedProperty,rw=Mo.parseBytes;function fs(t,e){this.eddsa=t,typeof e!="object"&&(e=rw(e)),Array.isArray(e)&&(m1(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),m1(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof tw&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Eo(fs,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Eo(fs,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Eo(fs,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Eo(fs,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),fs.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},fs.prototype.toHex=function(){return Mo.encode(this.toBytes(),"hex").toUpperCase()};var iw=fs,nw=Kr,sw=wo,ia=Gr,aw=ia.assert,y1=ia.parseBytes,w1=ew,_1=iw;function Br(t){if(aw(t==="ed25519","only tested with ed25519 so far"),!(this instanceof Br))return new Br(t);t=sw[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=nw.sha512}var fw=Br;Br.prototype.sign=function(e,r){e=y1(e);var i=this.keyFromSecret(r),n=this.hashInt(i.messagePrefix(),e),s=this.g.mul(n),o=this.encodePoint(s),h=this.hashInt(o,i.pubBytes(),e).mul(i.priv()),l=n.add(h).umod(this.curve.n);return this.makeSignature({R:s,S:l,Rencoded:o})},Br.prototype.verify=function(e,r,i){if(e=y1(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var n=this.keyFromPublic(i),s=this.hashInt(r.Rencoded(),n.pubBytes(),e),o=this.g.mul(r.S()),h=r.R().add(n.pub().mul(s));return h.eq(o)},Br.prototype.hashInt=function(){for(var e=this.hash(),r=0;r<arguments.length;r++)e.update(arguments[r]);return ia.intFromLE(e.digest()).umod(this.curve.n)},Br.prototype.keyFromPublic=function(e){return w1.fromPublic(this,e)},Br.prototype.keyFromSecret=function(e){return w1.fromSecret(this,e)},Br.prototype.makeSignature=function(e){return e instanceof _1?e:new _1(this,e)},Br.prototype.encodePoint=function(e){var r=e.getY().toArray("le",this.encodingLength);return r[this.encodingLength-1]|=e.getX().isOdd()?128:0,r},Br.prototype.decodePoint=function(e){e=ia.parseBytes(e);var r=e.length-1,i=e.slice(0,r).concat(e[r]&-129),n=(e[r]&128)!==0,s=ia.intFromLE(i);return this.curve.pointFromY(s,n)},Br.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},Br.prototype.decodeInt=function(e){return ia.intFromLE(e)},Br.prototype.isPoint=function(e){return e instanceof this.pointClass},function(t){var e=t;e.version=Cy.version,e.utils=Gr,e.rand=po.exports,e.curve=Oh,e.curves=wo,e.ec=Zy,e.eddsa=fw}(f1);const ow={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},hw=":";function So(t){const[e,r]=t.split(hw);return{namespace:e,reference:r}}function x1(t,e){return t.includes(":")?[t]:e.chains||[]}var cw=Object.defineProperty,A1=Object.getOwnPropertySymbols,uw=Object.prototype.hasOwnProperty,dw=Object.prototype.propertyIsEnumerable,M1=(t,e,r)=>e in t?cw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,E1=(t,e)=>{for(var r in e||(e={}))uw.call(e,r)&&M1(t,r,e[r]);if(A1)for(var r of A1(e))dw.call(e,r)&&M1(t,r,e[r]);return t};const lw="ReactNative",Vr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},pw="js";function Do(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function na(){return!Ta()&&!!W0()&&navigator.product===lw}function Va(){return!Do()&&!!W0()&&!!Ta()}function Ya(){return na()?Vr.reactNative:Do()?Vr.node:Va()?Vr.browser:Vr.unknown}function bw(){var t;try{return na()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function vw(t,e){let r=Ba.parse(t);return r=E1(E1({},r),e),t=Ba.stringify(r),t}function S1(){return Kd()||{name:"",description:"",url:"",icons:[""]}}function gw(){if(Ya()===Vr.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:i}=global.Platform;return[r,i].join("-")}const t=c8();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function mw(){var t;const e=Ya();return e===Vr.browser?[e,((t=kd())==null?void 0:t.host)||"unknown"].join(":"):e}function D1(t,e,r){const i=gw(),n=mw();return[[t,e].join("-"),[pw,r].join("-"),i,n].join("/")}function yw({protocol:t,version:e,relayUrl:r,sdkVersion:i,auth:n,projectId:s,useOnCloseEvent:o,bundleId:h}){const l=r.split("?"),p=D1(t,e,i),w={auth:n,ua:p,projectId:s,useOnCloseEvent:o||void 0,origin:h||void 0},M=vw(l[1]||"",w);return l[0]+"?"+M}function os(t,e){return t.filter(r=>e.includes(r)).length===t.length}function I1(t){return Object.fromEntries(t.entries())}function N1(t){return new Map(Object.entries(t))}function hs(t=ze.FIVE_MINUTES,e){const r=ze.toMiliseconds(t||ze.FIVE_MINUTES);let i,n,s,o;return{resolve:h=>{s&&i&&(clearTimeout(s),i(h),o=Promise.resolve(h))},reject:h=>{s&&n&&(clearTimeout(s),n(h))},done:()=>new Promise((h,l)=>{if(o)return h(o);s=setTimeout(()=>{const p=new Error(e);o=Promise.reject(p),l(p)},r),i=h,n=l})}}function Ln(t,e,r){return new Promise(async(i,n)=>{const s=setTimeout(()=>n(new Error(r)),e);try{const o=await t;i(o)}catch(o){n(o)}clearTimeout(s)})}function O1(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function ww(t){return O1("topic",t)}function _w(t){return O1("id",t)}function R1(t){const[e,r]=t.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")i.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))i.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return i}function Ut(t,e){return ze.fromMiliseconds((e||Date.now())+ze.toMiliseconds(t))}function Un(t){return Date.now()>=ze.toMiliseconds(t)}function st(t,e){return`${t}${e?`:${e}`:""}`}function xw(t=[],e=[]){return[...new Set([...t,...e])]}async function Aw({id:t,topic:e,wcDeepLink:r}){var i;try{if(!r)return;const n=typeof r=="string"?JSON.parse(r):r,s=n?.href;if(typeof s!="string")return;const o=Mw(s,t,e),h=Ya();if(h===Vr.browser){if(!((i=Ta())!=null&&i.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,Sw()?"_blank":"_self","noreferrer noopener")}else h===Vr.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(n){console.error(n)}}function Mw(t,e,r){const i=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let n=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";n=`${n}${s}${Dw(i,!0)}`}else n=`${n}/wc?${i}`;return n}async function Ew(t,e){let r="";try{if(Va()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(i){console.error(i)}return r}function C1(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),i=r.indexOf(e);return r[i+2]}function P1(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function $h(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function Sw(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function Dw(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function T1(t){return Buffer.from(t,"base64").toString("utf-8")}const Iw="https://rpc.walletconnect.org/v1";async function Nw(t,e,r,i,n,s){switch(r.t){case"eip191":return Ow(t,e,r.s);case"eip1271":return await Rw(t,e,r.s,i,n,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function Ow(t,e,r){return ny(yl(e),r).toLowerCase()===t.toLowerCase()}async function Rw(t,e,r,i,n,s){const o=So(i);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${i}`);try{const h="0x1626ba7e",l="0000000000000000000000000000000000000000000000000000000000000040",p="0000000000000000000000000000000000000000000000000000000000000041",w=r.substring(2),M=yl(e).substring(2),I=h+M+l+p+w,D=await fetch(`${s||Iw}/?chainId=${i}&projectId=${n}`,{method:"POST",body:JSON.stringify({id:Cw(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:I},"latest"]})}),{result:N}=await D.json();return N?N.slice(0,h.length).toLowerCase()===h.toLowerCase():!1}catch(h){return console.error("isValidEip1271Signature: ",h),!1}}function Cw(){return Date.now()+Math.floor(Math.random()*1e3)}var Pw=Object.defineProperty,Tw=Object.defineProperties,Bw=Object.getOwnPropertyDescriptors,B1=Object.getOwnPropertySymbols,Fw=Object.prototype.hasOwnProperty,Lw=Object.prototype.propertyIsEnumerable,F1=(t,e,r)=>e in t?Pw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Uw=(t,e)=>{for(var r in e||(e={}))Fw.call(e,r)&&F1(t,r,e[r]);if(B1)for(var r of B1(e))Lw.call(e,r)&&F1(t,r,e[r]);return t},$w=(t,e)=>Tw(t,Bw(e));const qw="did:pkh:",qh=t=>t?.split(":"),zw=t=>{const e=t&&qh(t);if(e)return t.includes(qw)?e[3]:e[1]},zh=t=>{const e=t&&qh(t);if(e)return e[2]+":"+e[3]},Io=t=>{const e=t&&qh(t);if(e)return e.pop()};async function L1(t){const{cacao:e,projectId:r}=t,{s:i,p:n}=e,s=U1(n,n.iss),o=Io(n.iss);return await Nw(o,s,i,zh(n.iss),r)}const U1=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,i=Io(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let n=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,h=`Chain ID: ${zw(e)}`,l=`Nonce: ${t.nonce}`,p=`Issued At: ${t.iat}`,w=t.exp?`Expiration Time: ${t.exp}`:void 0,M=t.nbf?`Not Before: ${t.nbf}`:void 0,I=t.requestId?`Request ID: ${t.requestId}`:void 0,D=t.resources?`Resources:${t.resources.map(U=>`
23
+ - ${U}`).join("")}`:void 0,N=No(t.resources);if(N){const U=Ja(N);n=Ww(n,U)}return[r,i,"",n,"",s,o,h,l,p,w,M,I,D].filter(U=>U!=null).join(`
24
+ `)};function kw(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function Kw(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function cs(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const i=t.att[r];if(Array.isArray(i))throw new Error(`Resource must be an object: ${r}`);if(typeof i!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(i).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(i).forEach(n=>{const s=i[n];if(!Array.isArray(s))throw new Error(`Ability limits ${n} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${n} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${n}) must be an array of objects, found: ${o}`)})})})}function Hw(t,e,r,i={}){return r?.sort((n,s)=>n.localeCompare(s)),{att:{[t]:jw(e,r,i)}}}function jw(t,e,r={}){e=e?.sort((n,s)=>n.localeCompare(s));const i=e.map(n=>({[`${t}/${n}`]:[r]}));return Object.assign({},...i)}function $1(t){return cs(t),`urn:recap:${kw(t).replace(/=/g,"")}`}function Ja(t){const e=Kw(t.replace("urn:recap:",""));return cs(e),e}function Gw(t,e,r){const i=Hw(t,e,r);return $1(i)}function Vw(t){return t&&t.includes("urn:recap:")}function Yw(t,e){const r=Ja(t),i=Ja(e),n=Jw(r,i);return $1(n)}function Jw(t,e){cs(t),cs(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((n,s)=>n.localeCompare(s)),i={att:{}};return r.forEach(n=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[n])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[n])||{})).sort((h,l)=>h.localeCompare(l)).forEach(h=>{var l,p;i.att[n]=$w(Uw({},i.att[n]),{[h]:((l=t.att[n])==null?void 0:l[h])||((p=e.att[n])==null?void 0:p[h])})})}),i}function Ww(t="",e){cs(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const i=[];let n=0;Object.keys(e.att).forEach(h=>{const l=Object.keys(e.att[h]).map(M=>({ability:M.split("/")[0],action:M.split("/")[1]}));l.sort((M,I)=>M.action.localeCompare(I.action));const p={};l.forEach(M=>{p[M.ability]||(p[M.ability]=[]),p[M.ability].push(M.action)});const w=Object.keys(p).map(M=>(n++,`(${n}) '${M}': '${p[M].join("', '")}' for '${h}'.`));i.push(w.join(", ").replace(".,","."))});const s=i.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function q1(t){var e;const r=Ja(t);cs(r);const i=(e=r.att)==null?void 0:e.eip155;return i?Object.keys(i).map(n=>n.split("/")[1]):[]}function z1(t){const e=Ja(t);cs(e);const r=[];return Object.values(e.att).forEach(i=>{Object.values(i).forEach(n=>{var s;(s=n?.[0])!=null&&s.chains&&r.push(n[0].chains)})}),[...new Set(r.flat())]}function No(t){if(!t)return;const e=t?.[t.length-1];return Vw(e)?e:void 0}const k1="base10",Sr="base16",$n="base64pad",Wa="base64url",Qa="utf8",K1=0,ln=1,Xa=2,Qw=0,H1=1,Za=12,kh=32;function Xw(){const t=Eh.generateKeyPair();return{privateKey:jr(t.secretKey,Sr),publicKey:jr(t.publicKey,Sr)}}function Kh(){const t=In.randomBytes(kh);return jr(t,Sr)}function Zw(t,e){const r=Eh.sharedKey(ni(t,Sr),ni(e,Sr),!0),i=new gy(Ha.SHA256,r).expand(kh);return jr(i,Sr)}function Oo(t){const e=Ha.hash(ni(t,Sr));return jr(e,Sr)}function pn(t){const e=Ha.hash(ni(t,Qa));return jr(e,Sr)}function j1(t){return ni(`${t}`,k1)}function us(t){return Number(jr(t,k1))}function e7(t){const e=j1(typeof t.type<"u"?t.type:K1);if(us(e)===ln&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?ni(t.senderPublicKey,Sr):void 0,i=typeof t.iv<"u"?ni(t.iv,Sr):In.randomBytes(Za),n=new xh.ChaCha20Poly1305(ni(t.symKey,Sr)).seal(i,ni(t.message,Qa));return G1({type:e,sealed:n,iv:i,senderPublicKey:r,encoding:t.encoding})}function t7(t,e){const r=j1(Xa),i=In.randomBytes(Za),n=ni(t,Qa);return G1({type:r,sealed:n,iv:i,encoding:e})}function r7(t){const e=new xh.ChaCha20Poly1305(ni(t.symKey,Sr)),{sealed:r,iv:i}=ef({encoded:t.encoded,encoding:t?.encoding}),n=e.open(i,r);if(n===null)throw new Error("Failed to decrypt");return jr(n,Qa)}function i7(t,e){const{sealed:r}=ef({encoded:t,encoding:e});return jr(r,Qa)}function G1(t){const{encoding:e=$n}=t;if(us(t.type)===Xa)return jr(Sh([t.type,t.sealed]),e);if(us(t.type)===ln){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return jr(Sh([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return jr(Sh([t.type,t.iv,t.sealed]),e)}function ef(t){const{encoded:e,encoding:r=$n}=t,i=ni(e,r),n=i.slice(Qw,H1),s=H1;if(us(n)===ln){const p=s+kh,w=p+Za,M=i.slice(s,p),I=i.slice(p,w),D=i.slice(w);return{type:n,sealed:D,iv:I,senderPublicKey:M}}if(us(n)===Xa){const p=i.slice(s),w=In.randomBytes(Za);return{type:n,sealed:p,iv:w}}const o=s+Za,h=i.slice(s,o),l=i.slice(o);return{type:n,sealed:l,iv:h}}function n7(t,e){const r=ef({encoded:t,encoding:e?.encoding});return V1({type:us(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?jr(r.senderPublicKey,Sr):void 0,receiverPublicKey:e?.receiverPublicKey})}function V1(t){const e=t?.type||K1;if(e===ln){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function Y1(t){return t.type===ln&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function J1(t){return t.type===Xa}function s7(t){return new f1.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function a7(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function f7(t){return Buffer.from(a7(t),"base64")}function o7(t,e){const[r,i,n]=t.split("."),s=f7(n);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),h=s.slice(32,64).toString("hex"),l=`${r}.${i}`,p=new Ha.SHA256().update(Buffer.from(l)).digest(),w=s7(e),M=Buffer.from(p).toString("hex");if(!w.verify(M,{r:o,s:h}))throw new Error("Invalid signature");return J0(t).payload}const h7="irn";function Ro(t){return t?.relay||{protocol:h7}}function tf(t){const e=ow[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var c7=Object.defineProperty,u7=Object.defineProperties,d7=Object.getOwnPropertyDescriptors,W1=Object.getOwnPropertySymbols,l7=Object.prototype.hasOwnProperty,p7=Object.prototype.propertyIsEnumerable,Q1=(t,e,r)=>e in t?c7(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,X1=(t,e)=>{for(var r in e||(e={}))l7.call(e,r)&&Q1(t,r,e[r]);if(W1)for(var r of W1(e))p7.call(e,r)&&Q1(t,r,e[r]);return t},b7=(t,e)=>u7(t,d7(e));function v7(t,e="-"){const r={},i="relay"+e;return Object.keys(t).forEach(n=>{if(n.startsWith(i)){const s=n.replace(i,""),o=t[n];r[s]=o}}),r}function Z1(t){if(!t.includes("wc:")){const l=T1(t);l!=null&&l.includes("wc:")&&(t=l)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,i=t.substring(0,e),n=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=Ba.parse(s),h=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:i,topic:g7(n[0]),version:parseInt(n[1],10),symKey:o.symKey,relay:v7(o),methods:h,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function g7(t){return t.startsWith("//")?t.substring(2):t}function m7(t,e="-"){const r="relay",i={};return Object.keys(t).forEach(n=>{const s=r+e+n;t[n]&&(i[s]=t[n])}),i}function ep(t){return`${t.protocol}:${t.topic}@${t.version}?`+Ba.stringify(X1(b7(X1({symKey:t.symKey},m7(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Co(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function sa(t){const e=[];return t.forEach(r=>{const[i,n]=r.split(":");e.push(`${i}:${n}`)}),e}function y7(t){const e=[];return Object.values(t).forEach(r=>{e.push(...sa(r.accounts))}),e}function w7(t,e){const r=[];return Object.values(t).forEach(i=>{sa(i.accounts).includes(e)&&r.push(...i.methods)}),r}function _7(t,e){const r=[];return Object.values(t).forEach(i=>{sa(i.accounts).includes(e)&&r.push(...i.events)}),r}function x7(t){const e={};return t?.forEach(r=>{const[i,n]=r.split(":");e[i]||(e[i]={accounts:[],chains:[],events:[]}),e[i].accounts.push(r),e[i].chains.push(`${i}:${n}`)}),e}function tp(t,e){e=e.map(i=>i.replace("did:pkh:",""));const r=x7(e);for(const[i,n]of Object.entries(r))n.methods?n.methods=xw(n.methods,t):n.methods=t,n.events=["chainChanged","accountsChanged"];return r}const A7={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},M7={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ke(t,e){const{message:r,code:i}=M7[t];return{message:e?`${r} ${e}`:r,code:i}}function wt(t,e){const{message:r,code:i}=A7[t];return{message:e?`${r} ${e}`:r,code:i}}function Po(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function To(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Dr(t){return typeof t>"u"}function Tt(t,e){return e&&Dr(t)?!0:typeof t=="string"&&!!t.trim().length}function Hh(t,e){return e&&Dr(t)?!0:typeof t=="number"&&!isNaN(t)}function E7(t,e){const{requiredNamespaces:r}=e,i=Object.keys(t.namespaces),n=Object.keys(r);let s=!0;return os(n,i)?(i.forEach(o=>{const{accounts:h,methods:l,events:p}=t.namespaces[o],w=sa(h),M=r[o];(!os(x1(o,M),w)||!os(M.methods,l)||!os(M.events,p))&&(s=!1)}),s):!1}function Bo(t){return Tt(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function S7(t){if(Tt(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Bo(r)}}return!1}function D7(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(Tt(t,!1)){if(e(t))return!0;const r=T1(t);return e(r)}}catch{}return!1}function I7(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function N7(t){return t?.topic}function O7(t,e){let r=null;return Tt(t?.publicKey,!1)||(r=ke("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function rp(t){let e=!0;return Po(t)?t.length&&(e=t.every(r=>Tt(r,!1))):e=!1,e}function R7(t,e,r){let i=null;return Po(e)&&e.length?e.forEach(n=>{i||Bo(n)||(i=wt("UNSUPPORTED_CHAINS",`${r}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):Bo(t)||(i=wt("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}function C7(t,e,r){let i=null;return Object.entries(t).forEach(([n,s])=>{if(i)return;const o=R7(n,x1(n,s),`${e} ${r}`);o&&(i=o)}),i}function P7(t,e){let r=null;return Po(t)?t.forEach(i=>{r||S7(i)||(r=wt("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):r=wt("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function T7(t,e){let r=null;return Object.values(t).forEach(i=>{if(r)return;const n=P7(i?.accounts,`${e} namespace`);n&&(r=n)}),r}function B7(t,e){let r=null;return rp(t?.methods)?rp(t?.events)||(r=wt("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=wt("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function ip(t,e){let r=null;return Object.values(t).forEach(i=>{if(r)return;const n=B7(i,`${e}, namespace`);n&&(r=n)}),r}function F7(t,e,r){let i=null;if(t&&To(t)){const n=ip(t,e);n&&(i=n);const s=C7(t,e,r);s&&(i=s)}else i=ke("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return i}function jh(t,e){let r=null;if(t&&To(t)){const i=ip(t,e);i&&(r=i);const n=T7(t,e);n&&(r=n)}else r=ke("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function np(t){return Tt(t.protocol,!0)}function L7(t,e){let r=!1;return e&&!t?r=!0:t&&Po(t)&&t.length&&t.forEach(i=>{r=np(i)}),r}function U7(t){return typeof t=="number"}function Fr(t){return typeof t<"u"&&typeof t!==null}function $7(t){return!(!t||typeof t!="object"||!t.code||!Hh(t.code,!1)||!t.message||!Tt(t.message,!1))}function q7(t){return!(Dr(t)||!Tt(t.method,!1))}function z7(t){return!(Dr(t)||Dr(t.result)&&Dr(t.error)||!Hh(t.id,!1)||!Tt(t.jsonrpc,!1))}function k7(t){return!(Dr(t)||!Tt(t.name,!1))}function sp(t,e){return!(!Bo(e)||!y7(t).includes(e))}function K7(t,e,r){return Tt(r,!1)?w7(t,e).includes(r):!1}function H7(t,e,r){return Tt(r,!1)?_7(t,e).includes(r):!1}function ap(t,e,r){let i=null;const n=j7(t),s=G7(e),o=Object.keys(n),h=Object.keys(s),l=fp(Object.keys(t)),p=fp(Object.keys(e)),w=l.filter(M=>!p.includes(M));return w.length&&(i=ke("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.
25
+ Required: ${w.toString()}
26
+ Received: ${Object.keys(e).toString()}`)),os(o,h)||(i=ke("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces.
27
27
  Required: ${o.toString()}
28
- Approved: ${f.toString()}`)),Object.keys(e).forEach(y=>{if(!y.includes(":")||i)return;const M=Nn(e[y].accounts);M.includes(y)||(i=ne("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy namespace accounts for ${y}
29
- Required: ${y}
30
- Approved: ${M.toString()}`))}),o.forEach(y=>{i||(Hi(n[y].methods,s[y].methods)?Hi(n[y].events,s[y].events)||(i=ne("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${y}`)):i=ne("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${y}`))}),i}function A6(r){const e={};return Object.keys(r).forEach(t=>{var i;t.includes(":")?e[t]=r[t]:(i=r[t].chains)==null||i.forEach(s=>{e[s]={methods:r[t].methods,events:r[t].events}})}),e}function od(r){return[...new Set(r.map(e=>e.includes(":")?e.split(":")[0]:e))]}function S6(r){const e={};return Object.keys(r).forEach(t=>{if(t.includes(":"))e[t]=r[t];else{const n=Nn(r[t].accounts);n?.forEach(s=>{e[s]={accounts:r[t].accounts.filter(o=>o.includes(`${s}:`)),methods:r[t].methods,events:r[t].events}})}}),e}function D6(r,e){return tf(r,!1)&&r<=e.max&&r>=e.min}function fd(){const r=rs();return new Promise(e=>{switch(r){case ur.browser:e(M6());break;case ur.reactNative:e(I6());break;case ur.node:e(R6());break;default:e(!0)}})}function M6(){return ts()&&navigator?.onLine}async function I6(){if(Rn()&&typeof global<"u"&&(global!=null&&global.NetInfo)){const r=await(global==null?void 0:global.NetInfo.fetch());return r?.isConnected}return!0}function R6(){return!0}function O6(r){switch(rs()){case ur.browser:N6(r);break;case ur.reactNative:C6(r);break}}function N6(r){!Rn()&&ts()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function C6(r){Rn()&&typeof global<"u"&&(global!=null&&global.NetInfo)&&global?.NetInfo.addEventListener(e=>r(e?.isConnected))}const nf={};class us{static get(e){return nf[e]}static set(e,t){nf[e]=t}static delete(e){delete nf[e]}}const P6="PARSE_ERROR",T6="INVALID_REQUEST",B6="METHOD_NOT_FOUND",L6="INVALID_PARAMS",cd="INTERNAL_ERROR",sf="SERVER_ERROR",U6=[-32700,-32600,-32601,-32602,-32603],ds={[P6]:{code:-32700,message:"Parse error"},[T6]:{code:-32600,message:"Invalid Request"},[B6]:{code:-32601,message:"Method not found"},[L6]:{code:-32602,message:"Invalid params"},[cd]:{code:-32603,message:"Internal error"},[sf]:{code:-32e3,message:"Server error"}},hd=sf;function F6(r){return U6.includes(r)}function ud(r){return Object.keys(ds).includes(r)?ds[r]:ds[hd]}function q6(r){const e=Object.values(ds).find(t=>t.code===r);return e||ds[hd]}function $6(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var dd={};/*! *****************************************************************************
28
+ Approved: ${h.toString()}`)),Object.keys(e).forEach(M=>{if(!M.includes(":")||i)return;const I=sa(e[M].accounts);I.includes(M)||(i=ke("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${M}
29
+ Required: ${M}
30
+ Approved: ${I.toString()}`))}),o.forEach(M=>{i||(os(n[M].methods,s[M].methods)?os(n[M].events,s[M].events)||(i=ke("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${M}`)):i=ke("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${M}`))}),i}function j7(t){const e={};return Object.keys(t).forEach(r=>{var i;r.includes(":")?e[r]=t[r]:(i=t[r].chains)==null||i.forEach(n=>{e[n]={methods:t[r].methods,events:t[r].events}})}),e}function fp(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function G7(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const i=sa(t[r].accounts);i?.forEach(n=>{e[n]={accounts:t[r].accounts.filter(s=>s.includes(`${n}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function V7(t,e){return Hh(t,!1)&&t<=e.max&&t>=e.min}function op(){const t=Ya();return new Promise(e=>{switch(t){case Vr.browser:e(Y7());break;case Vr.reactNative:e(J7());break;case Vr.node:e(W7());break;default:e(!0)}})}function Y7(){return Va()&&navigator?.onLine}async function J7(){if(na()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t?.isConnected}return!0}function W7(){return!0}function Q7(t){switch(Ya()){case Vr.browser:X7(t);break;case Vr.reactNative:Z7(t);break}}function X7(t){!na()&&Va()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function Z7(t){na()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}const Gh={};class rf{static get(e){return Gh[e]}static set(e,r){Gh[e]=r}static delete(e){delete Gh[e]}}function e9(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function hp(t,e,r,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:i}}}const cp=hp("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Vh=hp("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);const e=e9(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),t9={utf8:cp,"utf-8":cp,hex:Us.base16,latin1:Vh,ascii:Vh,binary:Vh,...Us};function r9(t,e="utf8"){const r=t9[e];if(!r)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)}const i9="PARSE_ERROR",n9="INVALID_REQUEST",s9="METHOD_NOT_FOUND",a9="INVALID_PARAMS",up="INTERNAL_ERROR",Yh="SERVER_ERROR",f9=[-32700,-32600,-32601,-32602,-32603],nf={[i9]:{code:-32700,message:"Parse error"},[n9]:{code:-32600,message:"Invalid Request"},[s9]:{code:-32601,message:"Method not found"},[a9]:{code:-32602,message:"Invalid params"},[up]:{code:-32603,message:"Internal error"},[Yh]:{code:-32e3,message:"Server error"}},dp=Yh;function o9(t){return f9.includes(t)}function lp(t){return Object.keys(nf).includes(t)?nf[t]:nf[dp]}function h9(t){const e=Object.values(nf).find(r=>r.code===t);return e||nf[dp]}function c9(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var pp={};/*! *****************************************************************************
31
31
  Copyright (c) Microsoft Corporation.
32
32
 
33
33
  Permission to use, copy, modify, and/or distribute this software for any
@@ -40,5 +40,25 @@
40
40
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
41
41
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
42
42
  PERFORMANCE OF THIS SOFTWARE.
43
- ***************************************************************************** */var af=function(r,e){return af=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},af(r,e)};function z6(r,e){af(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var of=function(){return of=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},of.apply(this,arguments)};function K6(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}function k6(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var f=r.length-1;f>=0;f--)(o=r[f])&&(s=(n<3?o(s):n>3?o(e,t,s):o(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}function j6(r,e){return function(t,i){e(t,i,r)}}function V6(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function H6(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function f(p){try{h(i.next(p))}catch(y){o(y)}}function u(p){try{h(i.throw(p))}catch(y){o(y)}}function h(p){p.done?s(p.value):n(p.value).then(f,u)}h((i=i.apply(r,e||[])).next())})}function G6(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,o;return o={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function f(h){return function(p){return u([h,p])}}function u(h){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=h[0]&2?n.return:h[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,h[1])).done)return s;switch(n=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,n=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){t.label=h[1];break}if(h[0]===6&&t.label<s[1]){t.label=s[1],s=h;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(h);break}s[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(r,t)}catch(p){h=[6,p],n=0}finally{i=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function Y6(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}function W6(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function ff(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ld(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(f){o={error:f}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return s}function J6(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(ld(arguments[e]));return r}function Q6(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var i=Array(r),n=0,e=0;e<t;e++)for(var s=arguments[e],o=0,f=s.length;o<f;o++,n++)i[n]=s[o];return i}function ls(r){return this instanceof ls?(this.v=r,this):new ls(r)}function X6(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(r,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(M){i[M]&&(n[M]=function(D){return new Promise(function(I,C){s.push([M,D,I,C])>1||f(M,D)})})}function f(M,D){try{u(i[M](D))}catch(I){y(s[0][3],I)}}function u(M){M.value instanceof ls?Promise.resolve(M.value.v).then(h,p):y(s[0][2],M)}function h(M){f("next",M)}function p(M){f("throw",M)}function y(M,D){M(D),s.shift(),s.length&&f(s[0][0],s[0][1])}}function Z6(r){var e,t;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=r[n]?function(o){return(t=!t)?{value:ls(r[n](o)),done:n==="return"}:s?s(o):o}:s}}function ey(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof ff=="function"?ff(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(s){t[s]=r[s]&&function(o){return new Promise(function(f,u){o=r[s](o),n(f,u,o.done,o.value)})}}function n(s,o,f,u){Promise.resolve(u).then(function(h){s({value:h,done:f})},o)}}function ty(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function ry(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function iy(r){return r&&r.__esModule?r:{default:r}}function ny(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function sy(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var ay=Object.freeze({__proto__:null,__extends:z6,get __assign(){return of},__rest:K6,__decorate:k6,__param:j6,__metadata:V6,__awaiter:H6,__generator:G6,__createBinding:Y6,__exportStar:W6,__values:ff,__read:ld,__spread:J6,__spreadArrays:Q6,__await:ls,__asyncGenerator:X6,__asyncDelegator:Z6,__asyncValues:ey,__makeTemplateObject:ty,__importStar:ry,__importDefault:iy,__classPrivateFieldGet:ny,__classPrivateFieldSet:sy}),oy=Ba(ay),ai={},pd;function fy(){if(pd)return ai;pd=1,Object.defineProperty(ai,"__esModule",{value:!0}),ai.isBrowserCryptoAvailable=ai.getSubtleCrypto=ai.getBrowerCrypto=void 0;function r(){return Ot?.crypto||Ot?.msCrypto||{}}ai.getBrowerCrypto=r;function e(){const i=r();return i.subtle||i.webkitSubtle}ai.getSubtleCrypto=e;function t(){return!!r()&&!!e()}return ai.isBrowserCryptoAvailable=t,ai}var oi={},gd;function cy(){if(gd)return oi;gd=1,Object.defineProperty(oi,"__esModule",{value:!0}),oi.isBrowser=oi.isNode=oi.isReactNative=void 0;function r(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}oi.isReactNative=r;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}oi.isNode=e;function t(){return!r()&&!e()}return oi.isBrowser=t,oi}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=oy;e.__exportStar(fy(),r),e.__exportStar(cy(),r)})(dd);function Oi(r=3){const e=Date.now()*Math.pow(10,r),t=Math.floor(Math.random()*Math.pow(10,r));return e+t}function Ji(r=6){return BigInt(Oi(r))}function Qi(r,e,t){return{id:t||Oi(),jsonrpc:"2.0",method:r,params:e}}function cf(r,e){return{id:r,jsonrpc:"2.0",result:e}}function hf(r,e,t){return{id:r,jsonrpc:"2.0",error:hy(e,t)}}function hy(r,e){return typeof r>"u"?ud(cd):(typeof r=="string"&&(r=Object.assign(Object.assign({},ud(sf)),{message:r})),typeof e<"u"&&(r.data=e),F6(r.code)&&(r=q6(r.code)),r)}class uy{}class dy extends uy{constructor(){super()}}class ly extends dy{constructor(e){super()}}const py="^wss?:";function gy(r){const e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function vy(r,e){const t=gy(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function vd(r){return vy(r,py)}function by(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}function bd(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function uf(r){return bd(r)&&"method"in r}function Da(r){return bd(r)&&(Gr(r)||wr(r))}function Gr(r){return"result"in r}function wr(r){return"error"in r}class my extends ly{constructor(e){super(e),this.events=new Ft.exports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(Qi(e.method,e.params||[],e.id||Ji().toString()),t)}async requestStrict(e,t){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{wr(s)?n(s.error):i(s.result)});try{await this.connection.send(e,t)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Da(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}const yy=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),wy=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",md=r=>r.split("?")[0],yd=10,_y=yy();class Ey{constructor(e){if(this.url=e,this.events=new Ft.exports.EventEmitter,this.registering=!1,!vd(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=i=>{this.onClose(i),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Ui(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!vd(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,n)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),n(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return n(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,i)=>{const n=new URLSearchParams(e).get("origin"),s=dd.isReactNative()?{headers:{origin:n}}:{rejectUnauthorized:!by(e)},o=new _y(e,[],s);wy()?o.onerror=f=>{const u=f;i(this.emitError(u.error))}:o.on("error",f=>{i(this.emitError(f))}),o.onopen=()=>{this.onOpen(o),t(o)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=t=>this.onClose(t),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?fn(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),n=i.message||i.toString(),s=hf(e,n);this.events.emit("payload",s)}parseError(e,t=this.url){return $6(e,md(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>yd&&this.events.setMaxListeners(yd)}emitError(e){const t=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${md(this.url)}`));return this.events.emit("register_error",t),t}}var df={exports:{}};(function(r,e){var t=200,i="__lodash_hash_undefined__",n=1,s=2,o=9007199254740991,f="[object Arguments]",u="[object Array]",h="[object AsyncFunction]",p="[object Boolean]",y="[object Date]",M="[object Error]",D="[object Function]",I="[object GeneratorFunction]",C="[object Map]",K="[object Number]",j="[object Null]",B="[object Object]",k="[object Promise]",T="[object Proxy]",q="[object RegExp]",$="[object Set]",_="[object String]",O="[object Symbol]",W="[object Undefined]",X="[object WeakMap]",N="[object ArrayBuffer]",g="[object DataView]",l="[object Float32Array]",a="[object Float64Array]",c="[object Int8Array]",v="[object Int16Array]",x="[object Int32Array]",A="[object Uint8Array]",E="[object Uint8ClampedArray]",d="[object Uint16Array]",w="[object Uint32Array]",b=/[\\^$.*+?()[\]{}|]/g,R=/^\[object .+?Constructor\]$/,Y=/^(?:0|[1-9]\d*)$/,S={};S[l]=S[a]=S[c]=S[v]=S[x]=S[A]=S[E]=S[d]=S[w]=!0,S[f]=S[u]=S[N]=S[p]=S[g]=S[y]=S[M]=S[D]=S[C]=S[K]=S[B]=S[q]=S[$]=S[_]=S[X]=!1;var V=typeof Ot=="object"&&Ot&&Ot.Object===Object&&Ot,P=typeof self=="object"&&self&&self.Object===Object&&self,F=V||P||Function("return this")(),L=e&&!e.nodeType&&e,m=L&&!0&&r&&!r.nodeType&&r,U=m&&m.exports===L,G=U&&V.process,J=function(){try{return G&&G.binding&&G.binding("util")}catch{}}(),Q=J&&J.isTypedArray;function ee(z,H){for(var Z=-1,ve=z==null?0:z.length,ut=0,Ge=[];++Z<ve;){var vt=z[Z];H(vt,Z,z)&&(Ge[ut++]=vt)}return Ge}function we(z,H){for(var Z=-1,ve=H.length,ut=z.length;++Z<ve;)z[ut+Z]=H[Z];return z}function Se(z,H){for(var Z=-1,ve=z==null?0:z.length;++Z<ve;)if(H(z[Z],Z,z))return!0;return!1}function he(z,H){for(var Z=-1,ve=Array(z);++Z<z;)ve[Z]=H(Z);return ve}function Ne(z){return function(H){return z(H)}}function Ee(z,H){return z.has(H)}function se(z,H){return z?.[H]}function be(z){var H=-1,Z=Array(z.size);return z.forEach(function(ve,ut){Z[++H]=[ut,ve]}),Z}function le(z,H){return function(Z){return z(H(Z))}}function ie(z){var H=-1,Z=Array(z.size);return z.forEach(function(ve){Z[++H]=ve}),Z}var ue=Array.prototype,fe=Function.prototype,te=Object.prototype,pe=F["__core-js_shared__"],_e=fe.toString,re=te.hasOwnProperty,xe=function(){var z=/[^.]+$/.exec(pe&&pe.keys&&pe.keys.IE_PROTO||"");return z?"Symbol(src)_1."+z:""}(),Ae=te.toString,oe=RegExp("^"+_e.call(re).replace(b,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ie=U?F.Buffer:void 0,De=F.Symbol,Re=F.Uint8Array,Ye=te.propertyIsEnumerable,Qe=ue.splice,Me=De?De.toStringTag:void 0,et=Object.getOwnPropertySymbols,tt=Ie?Ie.isBuffer:void 0,Ce=le(Object.keys,Object),Te=Pn(F,"DataView"),Pe=Pn(F,"Map"),de=Pn(F,"Promise"),Be=Pn(F,"Set"),Le=Pn(F,"WeakMap"),ce=Pn(Object,"create"),qe=rn(Te),$e=rn(Pe),me=rn(de),ze=rn(Be),Ke=rn(Le),ge=De?De.prototype:void 0,Ue=ge?ge.valueOf:void 0;function Oe(z){var H=-1,Z=z==null?0:z.length;for(this.clear();++H<Z;){var ve=z[H];this.set(ve[0],ve[1])}}function ye(){this.__data__=ce?ce(null):{},this.size=0}function ke(z){var H=this.has(z)&&delete this.__data__[z];return this.size-=H?1:0,H}function it(z){var H=this.__data__;if(ce){var Z=H[z];return Z===i?void 0:Z}return re.call(H,z)?H[z]:void 0}function Fe(z){var H=this.__data__;return ce?H[z]!==void 0:re.call(H,z)}function nt(z,H){var Z=this.__data__;return this.size+=this.has(z)?0:1,Z[z]=ce&&H===void 0?i:H,this}Oe.prototype.clear=ye,Oe.prototype.delete=ke,Oe.prototype.get=it,Oe.prototype.has=Fe,Oe.prototype.set=nt;function We(z){var H=-1,Z=z==null?0:z.length;for(this.clear();++H<Z;){var ve=z[H];this.set(ve[0],ve[1])}}function rt(){this.__data__=[],this.size=0}function rr(z){var H=this.__data__,Z=Oa(H,z);if(Z<0)return!1;var ve=H.length-1;return Z==ve?H.pop():Qe.call(H,Z,1),--this.size,!0}function ir(z){var H=this.__data__,Z=Oa(H,z);return Z<0?void 0:H[Z][1]}function nr(z){return Oa(this.__data__,z)>-1}function sr(z,H){var Z=this.__data__,ve=Oa(Z,z);return ve<0?(++this.size,Z.push([z,H])):Z[ve][1]=H,this}We.prototype.clear=rt,We.prototype.delete=rr,We.prototype.get=ir,We.prototype.has=nr,We.prototype.set=sr;function yt(z){var H=-1,Z=z==null?0:z.length;for(this.clear();++H<Z;){var ve=z[H];this.set(ve[0],ve[1])}}function ci(){this.size=0,this.__data__={hash:new Oe,map:new(Pe||We),string:new Oe}}function hi(z){var H=Na(this,z).delete(z);return this.size-=H?1:0,H}function ui(z){return Na(this,z).get(z)}function di(z){return Na(this,z).has(z)}function li(z,H){var Z=Na(this,z),ve=Z.size;return Z.set(z,H),this.size+=Z.size==ve?0:1,this}yt.prototype.clear=ci,yt.prototype.delete=hi,yt.prototype.get=ui,yt.prototype.has=di,yt.prototype.set=li;function xr(z){var H=-1,Z=z==null?0:z.length;for(this.__data__=new yt;++H<Z;)this.add(z[H])}function pi(z){return this.__data__.set(z,i),this}function gi(z){return this.__data__.has(z)}xr.prototype.add=xr.prototype.push=pi,xr.prototype.has=gi;function Kt(z){var H=this.__data__=new We(z);this.size=H.size}function vi(){this.__data__=new We,this.size=0}function bi(z){var H=this.__data__,Z=H.delete(z);return this.size=H.size,Z}function mi(z){return this.__data__.get(z)}function ws(z){return this.__data__.has(z)}function _s(z,H){var Z=this.__data__;if(Z instanceof We){var ve=Z.__data__;if(!Pe||ve.length<t-1)return ve.push([z,H]),this.size=++Z.size,this;Z=this.__data__=new yt(ve)}return Z.set(z,H),this.size=Z.size,this}Kt.prototype.clear=vi,Kt.prototype.delete=bi,Kt.prototype.get=mi,Kt.prototype.has=ws,Kt.prototype.set=_s;function $5(z,H){var Z=Ca(z),ve=!Z&&t4(z),ut=!Z&&!ve&&Mf(z),Ge=!Z&&!ve&&!ut&&_l(z),vt=Z||ve||ut||Ge,Rt=vt?he(z.length,String):[],Lt=Rt.length;for(var dt in z)(H||re.call(z,dt))&&!(vt&&(dt=="length"||ut&&(dt=="offset"||dt=="parent")||Ge&&(dt=="buffer"||dt=="byteLength"||dt=="byteOffset")||J5(dt,Lt)))&&Rt.push(dt);return Rt}function Oa(z,H){for(var Z=z.length;Z--;)if(bl(z[Z][0],H))return Z;return-1}function z5(z,H,Z){var ve=H(z);return Ca(z)?ve:we(ve,Z(z))}function Es(z){return z==null?z===void 0?W:j:Me&&Me in Object(z)?Y5(z):e4(z)}function ll(z){return xs(z)&&Es(z)==f}function pl(z,H,Z,ve,ut){return z===H?!0:z==null||H==null||!xs(z)&&!xs(H)?z!==z&&H!==H:K5(z,H,Z,ve,pl,ut)}function K5(z,H,Z,ve,ut,Ge){var vt=Ca(z),Rt=Ca(H),Lt=vt?u:Ni(z),dt=Rt?u:Ni(H);Lt=Lt==f?B:Lt,dt=dt==f?B:dt;var dr=Lt==B,Pr=dt==B,kt=Lt==dt;if(kt&&Mf(z)){if(!Mf(H))return!1;vt=!0,dr=!1}if(kt&&!dr)return Ge||(Ge=new Kt),vt||_l(z)?gl(z,H,Z,ve,ut,Ge):H5(z,H,Lt,Z,ve,ut,Ge);if(!(Z&n)){var Ar=dr&&re.call(z,"__wrapped__"),Sr=Pr&&re.call(H,"__wrapped__");if(Ar||Sr){var Ci=Ar?z.value():z,yi=Sr?H.value():H;return Ge||(Ge=new Kt),ut(Ci,yi,Z,ve,Ge)}}return kt?(Ge||(Ge=new Kt),G5(z,H,Z,ve,ut,Ge)):!1}function k5(z){if(!wl(z)||X5(z))return!1;var H=ml(z)?oe:R;return H.test(rn(z))}function j5(z){return xs(z)&&yl(z.length)&&!!S[Es(z)]}function V5(z){if(!Z5(z))return Ce(z);var H=[];for(var Z in Object(z))re.call(z,Z)&&Z!="constructor"&&H.push(Z);return H}function gl(z,H,Z,ve,ut,Ge){var vt=Z&n,Rt=z.length,Lt=H.length;if(Rt!=Lt&&!(vt&&Lt>Rt))return!1;var dt=Ge.get(z);if(dt&&Ge.get(H))return dt==H;var dr=-1,Pr=!0,kt=Z&s?new xr:void 0;for(Ge.set(z,H),Ge.set(H,z);++dr<Rt;){var Ar=z[dr],Sr=H[dr];if(ve)var Ci=vt?ve(Sr,Ar,dr,H,z,Ge):ve(Ar,Sr,dr,z,H,Ge);if(Ci!==void 0){if(Ci)continue;Pr=!1;break}if(kt){if(!Se(H,function(yi,nn){if(!Ee(kt,nn)&&(Ar===yi||ut(Ar,yi,Z,ve,Ge)))return kt.push(nn)})){Pr=!1;break}}else if(!(Ar===Sr||ut(Ar,Sr,Z,ve,Ge))){Pr=!1;break}}return Ge.delete(z),Ge.delete(H),Pr}function H5(z,H,Z,ve,ut,Ge,vt){switch(Z){case g:if(z.byteLength!=H.byteLength||z.byteOffset!=H.byteOffset)return!1;z=z.buffer,H=H.buffer;case N:return!(z.byteLength!=H.byteLength||!Ge(new Re(z),new Re(H)));case p:case y:case K:return bl(+z,+H);case M:return z.name==H.name&&z.message==H.message;case q:case _:return z==H+"";case C:var Rt=be;case $:var Lt=ve&n;if(Rt||(Rt=ie),z.size!=H.size&&!Lt)return!1;var dt=vt.get(z);if(dt)return dt==H;ve|=s,vt.set(z,H);var dr=gl(Rt(z),Rt(H),ve,ut,Ge,vt);return vt.delete(z),dr;case O:if(Ue)return Ue.call(z)==Ue.call(H)}return!1}function G5(z,H,Z,ve,ut,Ge){var vt=Z&n,Rt=vl(z),Lt=Rt.length,dt=vl(H),dr=dt.length;if(Lt!=dr&&!vt)return!1;for(var Pr=Lt;Pr--;){var kt=Rt[Pr];if(!(vt?kt in H:re.call(H,kt)))return!1}var Ar=Ge.get(z);if(Ar&&Ge.get(H))return Ar==H;var Sr=!0;Ge.set(z,H),Ge.set(H,z);for(var Ci=vt;++Pr<Lt;){kt=Rt[Pr];var yi=z[kt],nn=H[kt];if(ve)var El=vt?ve(nn,yi,kt,H,z,Ge):ve(yi,nn,kt,z,H,Ge);if(!(El===void 0?yi===nn||ut(yi,nn,Z,ve,Ge):El)){Sr=!1;break}Ci||(Ci=kt=="constructor")}if(Sr&&!Ci){var Pa=z.constructor,Ta=H.constructor;Pa!=Ta&&"constructor"in z&&"constructor"in H&&!(typeof Pa=="function"&&Pa instanceof Pa&&typeof Ta=="function"&&Ta instanceof Ta)&&(Sr=!1)}return Ge.delete(z),Ge.delete(H),Sr}function vl(z){return z5(z,n4,W5)}function Na(z,H){var Z=z.__data__;return Q5(H)?Z[typeof H=="string"?"string":"hash"]:Z.map}function Pn(z,H){var Z=se(z,H);return k5(Z)?Z:void 0}function Y5(z){var H=re.call(z,Me),Z=z[Me];try{z[Me]=void 0;var ve=!0}catch{}var ut=Ae.call(z);return ve&&(H?z[Me]=Z:delete z[Me]),ut}var W5=et?function(z){return z==null?[]:(z=Object(z),ee(et(z),function(H){return Ye.call(z,H)}))}:s4,Ni=Es;(Te&&Ni(new Te(new ArrayBuffer(1)))!=g||Pe&&Ni(new Pe)!=C||de&&Ni(de.resolve())!=k||Be&&Ni(new Be)!=$||Le&&Ni(new Le)!=X)&&(Ni=function(z){var H=Es(z),Z=H==B?z.constructor:void 0,ve=Z?rn(Z):"";if(ve)switch(ve){case qe:return g;case $e:return C;case me:return k;case ze:return $;case Ke:return X}return H});function J5(z,H){return H=H??o,!!H&&(typeof z=="number"||Y.test(z))&&z>-1&&z%1==0&&z<H}function Q5(z){var H=typeof z;return H=="string"||H=="number"||H=="symbol"||H=="boolean"?z!=="__proto__":z===null}function X5(z){return!!xe&&xe in z}function Z5(z){var H=z&&z.constructor,Z=typeof H=="function"&&H.prototype||te;return z===Z}function e4(z){return Ae.call(z)}function rn(z){if(z!=null){try{return _e.call(z)}catch{}try{return z+""}catch{}}return""}function bl(z,H){return z===H||z!==z&&H!==H}var t4=ll(function(){return arguments}())?ll:function(z){return xs(z)&&re.call(z,"callee")&&!Ye.call(z,"callee")},Ca=Array.isArray;function r4(z){return z!=null&&yl(z.length)&&!ml(z)}var Mf=tt||a4;function i4(z,H){return pl(z,H)}function ml(z){if(!wl(z))return!1;var H=Es(z);return H==D||H==I||H==h||H==T}function yl(z){return typeof z=="number"&&z>-1&&z%1==0&&z<=o}function wl(z){var H=typeof z;return z!=null&&(H=="object"||H=="function")}function xs(z){return z!=null&&typeof z=="object"}var _l=Q?Ne(Q):j5;function n4(z){return r4(z)?$5(z):V5(z)}function s4(){return[]}function a4(){return!1}r.exports=i4})(df,df.exports);var xy=df.exports;const wd="wc",lf=2,pf="core",Yr=`${wd}@${lf}:${pf}:`,Ay={name:pf,logger:"error"},Sy={database:":memory:"},Dy="crypto",_d="client_ed25519_seed",My=ae.ONE_DAY,Iy="keychain",Ry="0.3",Oy="messages",Ny="0.3",Cy=ae.SIX_HOURS,Py="publisher",Ed="irn",Ty="error",xd="wss://relay.walletconnect.org",By="relayer",Wt={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},Ly="_subscription",_r={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},Uy=.1,gf="2.17.1-canary-0",ht={link_mode:"link_mode",relay:"relay"},Fy="0.3",qy="WALLETCONNECT_CLIENT_ID",Ad="WALLETCONNECT_LINK_MODE_APPS",Wr={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},$y="subscription",zy="0.3",Ky=ae.FIVE_SECONDS*1e3,ky="pairing",jy="0.3",ps={wc_pairingDelete:{req:{ttl:ae.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:ae.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:ae.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:ae.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:ae.ONE_DAY,prompt:!1,tag:0},res:{ttl:ae.ONE_DAY,prompt:!1,tag:0}}},Xi={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Or={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},Vy="history",Hy="0.3",Gy="expirer",Er={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},Yy="0.3",Wy="verify-api",Jy="https://verify.walletconnect.com",Sd="https://verify.walletconnect.org",gs=Sd,Qy=`${gs}/v3`,Xy=[Jy,Sd],Zy="echo",ew="https://echo.walletconnect.com",Jr={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},fi={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},Nr={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},Zi={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},en={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},vs={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},tw=.1,rw="event-client",iw=86400,nw="https://pulse.walletconnect.org/batch";function sw(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var n=0;n<r.length;n++){var s=r.charAt(n),o=s.charCodeAt(0);if(t[o]!==255)throw new TypeError(s+" is ambiguous");t[o]=n}var f=r.length,u=r.charAt(0),h=Math.log(f)/Math.log(256),p=Math.log(256)/Math.log(f);function y(I){if(I instanceof Uint8Array||(ArrayBuffer.isView(I)?I=new Uint8Array(I.buffer,I.byteOffset,I.byteLength):Array.isArray(I)&&(I=Uint8Array.from(I))),!(I instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(I.length===0)return"";for(var C=0,K=0,j=0,B=I.length;j!==B&&I[j]===0;)j++,C++;for(var k=(B-j)*p+1>>>0,T=new Uint8Array(k);j!==B;){for(var q=I[j],$=0,_=k-1;(q!==0||$<K)&&_!==-1;_--,$++)q+=256*T[_]>>>0,T[_]=q%f>>>0,q=q/f>>>0;if(q!==0)throw new Error("Non-zero carry");K=$,j++}for(var O=k-K;O!==k&&T[O]===0;)O++;for(var W=u.repeat(C);O<k;++O)W+=r.charAt(T[O]);return W}function M(I){if(typeof I!="string")throw new TypeError("Expected String");if(I.length===0)return new Uint8Array;var C=0;if(I[C]!==" "){for(var K=0,j=0;I[C]===u;)K++,C++;for(var B=(I.length-C)*h+1>>>0,k=new Uint8Array(B);I[C];){var T=t[I.charCodeAt(C)];if(T===255)return;for(var q=0,$=B-1;(T!==0||q<j)&&$!==-1;$--,q++)T+=f*k[$]>>>0,k[$]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");j=q,C++}if(I[C]!==" "){for(var _=B-j;_!==B&&k[_]===0;)_++;for(var O=new Uint8Array(K+(B-_)),W=K;_!==B;)O[W++]=k[_++];return O}}}function D(I){var C=M(I);if(C)return C;throw new Error(`Non-${e} character`)}return{encode:y,decodeUnsafe:M,decode:D}}var aw=sw,ow=aw;const Dd=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},fw=r=>new TextEncoder().encode(r),cw=r=>new TextDecoder().decode(r);class hw{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class uw{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}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 Md(this,e)}}class dw{constructor(e){this.decoders=e}or(e){return Md(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Md=(r,e)=>new dw({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class lw{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new hw(e,t,i),this.decoder=new uw(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Ma=({name:r,prefix:e,encode:t,decode:i})=>new lw(r,e,t,i),bs=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:n}=ow(t,e);return Ma({prefix:r,name:e,encode:i,decode:s=>Dd(n(s))})},pw=(r,e,t,i)=>{const n={};for(let p=0;p<e.length;++p)n[e[p]]=p;let s=r.length;for(;r[s-1]==="=";)--s;const o=new Uint8Array(s*t/8|0);let f=0,u=0,h=0;for(let p=0;p<s;++p){const y=n[r[p]];if(y===void 0)throw new SyntaxError(`Non-${i} character`);u=u<<t|y,f+=t,f>=8&&(f-=8,o[h++]=255&u>>f)}if(f>=t||255&u<<8-f)throw new SyntaxError("Unexpected end of data");return o},gw=(r,e,t)=>{const i=e[e.length-1]==="=",n=(1<<t)-1;let s="",o=0,f=0;for(let u=0;u<r.length;++u)for(f=f<<8|r[u],o+=8;o>t;)o-=t,s+=e[n&f>>o];if(o&&(s+=e[n&f<<t-o]),i)for(;s.length*t&7;)s+="=";return s},Bt=({name:r,prefix:e,bitsPerChar:t,alphabet:i})=>Ma({prefix:e,name:r,encode(n){return gw(n,i,t)},decode(n){return pw(n,i,t,r)}}),vw=Ma({prefix:"\0",name:"identity",encode:r=>cw(r),decode:r=>fw(r)});var bw=Object.freeze({__proto__:null,identity:vw});const mw=Bt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var yw=Object.freeze({__proto__:null,base2:mw});const ww=Bt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var _w=Object.freeze({__proto__:null,base8:ww});const Ew=bs({prefix:"9",name:"base10",alphabet:"0123456789"});var xw=Object.freeze({__proto__:null,base10:Ew});const Aw=Bt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Sw=Bt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Dw=Object.freeze({__proto__:null,base16:Aw,base16upper:Sw});const Mw=Bt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Iw=Bt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Rw=Bt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ow=Bt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Nw=Bt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Cw=Bt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Pw=Bt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Tw=Bt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Bw=Bt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Lw=Object.freeze({__proto__:null,base32:Mw,base32upper:Iw,base32pad:Rw,base32padupper:Ow,base32hex:Nw,base32hexupper:Cw,base32hexpad:Pw,base32hexpadupper:Tw,base32z:Bw});const Uw=bs({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Fw=bs({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var qw=Object.freeze({__proto__:null,base36:Uw,base36upper:Fw});const $w=bs({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),zw=bs({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Kw=Object.freeze({__proto__:null,base58btc:$w,base58flickr:zw});const kw=Bt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),jw=Bt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Vw=Bt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Hw=Bt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Gw=Object.freeze({__proto__:null,base64:kw,base64pad:jw,base64url:Vw,base64urlpad:Hw});const Id=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}"),Yw=Id.reduce((r,e,t)=>(r[t]=e,r),[]),Ww=Id.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function Jw(r){return r.reduce((e,t)=>(e+=Yw[t],e),"")}function Qw(r){const e=[];for(const t of r){const i=Ww[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const Xw=Ma({prefix:"\u{1F680}",name:"base256emoji",encode:Jw,decode:Qw});var Zw=Object.freeze({__proto__:null,base256emoji:Xw}),e8=Od,Rd=128,t8=127,r8=~t8,i8=Math.pow(2,31);function Od(r,e,t){e=e||[],t=t||0;for(var i=t;r>=i8;)e[t++]=r&255|Rd,r/=128;for(;r&r8;)e[t++]=r&255|Rd,r>>>=7;return e[t]=r|0,Od.bytes=t-i+1,e}var n8=vf,s8=128,Nd=127;function vf(r,i){var t=0,i=i||0,n=0,s=i,o,f=r.length;do{if(s>=f)throw vf.bytes=0,new RangeError("Could not decode varint");o=r[s++],t+=n<28?(o&Nd)<<n:(o&Nd)*Math.pow(2,n),n+=7}while(o>=s8);return vf.bytes=s-i,t}var a8=Math.pow(2,7),o8=Math.pow(2,14),f8=Math.pow(2,21),c8=Math.pow(2,28),h8=Math.pow(2,35),u8=Math.pow(2,42),d8=Math.pow(2,49),l8=Math.pow(2,56),p8=Math.pow(2,63),g8=function(r){return r<a8?1:r<o8?2:r<f8?3:r<c8?4:r<h8?5:r<u8?6:r<d8?7:r<l8?8:r<p8?9:10},v8={encode:e8,decode:n8,encodingLength:g8},Cd=v8;const Pd=(r,e,t=0)=>(Cd.encode(r,e,t),e),Td=r=>Cd.encodingLength(r),bf=(r,e)=>{const t=e.byteLength,i=Td(r),n=i+Td(t),s=new Uint8Array(n+t);return Pd(r,s,0),Pd(t,s,i),s.set(e,n),new b8(r,t,e,s)};class b8{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}}const Bd=({name:r,code:e,encode:t})=>new m8(r,e,t);class m8{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?bf(this.code,t):t.then(i=>bf(this.code,i))}else throw Error("Unknown type, must be binary type")}}const Ld=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),y8=Bd({name:"sha2-256",code:18,encode:Ld("SHA-256")}),w8=Bd({name:"sha2-512",code:19,encode:Ld("SHA-512")});var _8=Object.freeze({__proto__:null,sha256:y8,sha512:w8});const Ud=0,E8="identity",Fd=Dd;var x8=Object.freeze({__proto__:null,identity:{code:Ud,name:E8,encode:Fd,digest:r=>bf(Ud,Fd(r))}});new TextEncoder,new TextDecoder;const qd={...bw,...yw,..._w,...xw,...Dw,...Lw,...qw,...Kw,...Gw,...Zw};({..._8,...x8});function A8(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function $d(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const zd=$d("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),mf=$d("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=A8(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),S8={utf8:zd,"utf-8":zd,hex:qd.base16,latin1:mf,ascii:mf,binary:mf,...qd};function D8(r,e="utf8"){const t=S8[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}class M8{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name=Iy,this.version=Ry,this.initialized=!1,this.storagePrefix=Yr,this.init=async()=>{if(!this.initialized){const i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,n)=>{this.isInitialized(),this.keychain.set(i,n),await this.persist()},this.get=i=>{this.isInitialized();const n=this.keychain.get(i);if(typeof n>"u"){const{message:s}=ne("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(s)}return n},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=e,this.logger=jt(t,this.name)}get context(){return Qt(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Iu(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Ru(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ne("NOT_INITIALIZED",this.name);throw new Error(e)}}}class I8{constructor(e,t,i){this.core=e,this.logger=t,this.name=Dy,this.randomSessionIdentifier=Zo(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=n=>(this.isInitialized(),this.keychain.has(n)),this.getClientId=async()=>{this.isInitialized();const n=await this.getClientSeed(),s=zc(n);return $c(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const n=Nm();return this.setPrivateKey(n.publicKey,n.privateKey)},this.signJWT=async n=>{this.isInitialized();const s=await this.getClientSeed(),o=zc(s),f=this.randomSessionIdentifier;return await Tg(f,n,My,o)},this.generateSharedKey=(n,s,o)=>{this.isInitialized();const f=this.getPrivateKey(n),u=Cm(f,s);return this.setSymKey(u,o)},this.setSymKey=async(n,s)=>{this.isInitialized();const o=s||Ea(n);return await this.keychain.set(o,n),o},this.deleteKeyPair=async n=>{this.isInitialized(),await this.keychain.del(n)},this.deleteSymKey=async n=>{this.isInitialized(),await this.keychain.del(n)},this.encode=async(n,s,o)=>{this.isInitialized();const f=Gu(o),u=Ui(s);if(Wu(f))return Tm(u,o?.encoding);if(Yu(f)){const D=f.senderPublicKey,I=f.receiverPublicKey;n=await this.generateSharedKey(D,I)}const h=this.getSymKey(n),{type:p,senderPublicKey:y}=f;return Pm({type:p,symKey:h,message:u,senderPublicKey:y,encoding:o?.encoding})},this.decode=async(n,s,o)=>{this.isInitialized();const f=Um(s,o);if(Wu(f)){const u=Lm(s,o?.encoding);return fn(u)}if(Yu(f)){const u=f.receiverPublicKey,h=f.senderPublicKey;n=await this.generateSharedKey(u,h)}try{const u=this.getSymKey(n),h=Bm({symKey:u,encoded:s,encoding:o?.encoding});return fn(h)}catch(u){this.logger.error(`Failed to decode message from topic: '${n}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=(n,s=Ri)=>{const o=fs({encoded:n,encoding:s});return Wi(o.type)},this.getPayloadSenderPublicKey=(n,s=Ri)=>{const o=fs({encoded:n,encoding:s});return o.senderPublicKey?Et(o.senderPublicKey,Gt):void 0},this.core=e,this.logger=jt(t,this.name),this.keychain=i||new M8(this.core,this.logger)}get context(){return Qt(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(_d)}catch{e=Zo(),await this.keychain.set(_d,e)}return D8(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ne("NOT_INITIALIZED",this.name);throw new Error(e)}}}class R8 extends vp{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=Oy,this.version=Ny,this.initialized=!1,this.storagePrefix=Yr,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,n)=>{this.isInitialized();const s=si(n);let o=this.messages.get(i);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=n,this.messages.set(i,o),await this.persist()),s},this.get=i=>{this.isInitialized();let n=this.messages.get(i);return typeof n>"u"&&(n={}),n},this.has=(i,n)=>{this.isInitialized();const s=this.get(i),o=si(n);return typeof s[o]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=jt(e,this.name),this.core=t}get context(){return Qt(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Iu(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Ru(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ne("NOT_INITIALIZED",this.name);throw new Error(e)}}}class O8 extends bp{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new Ft.exports.EventEmitter,this.name=Py,this.queue=new Map,this.publishTimeout=ae.toMiliseconds(ae.ONE_MINUTE),this.failedPublishTimeout=ae.toMiliseconds(ae.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(i,n,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}});const f=s?.ttl||Cy,u=ef(s),h=s?.prompt||!1,p=s?.tag||0,y=s?.id||Ji().toString(),M={topic:i,message:n,opts:{ttl:f,relay:u,prompt:h,tag:p,id:y,attestation:s?.attestation}},D=`Failed to publish payload, please try again. id:${y} tag:${p}`,I=Date.now();let C,K=1;try{for(;C===void 0;){if(Date.now()-I>this.publishTimeout)throw new Error(D);this.logger.trace({id:y,attempts:K},`publisher.publish - attempt ${K}`),C=await await On(this.rpcPublish(i,n,f,u,h,p,y,s?.attestation).catch(B=>this.logger.warn(B)),this.publishTimeout,D),K++,C||await new Promise(B=>setTimeout(B,this.failedPublishTimeout))}this.relayer.events.emit(Wt.publish,M),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:y,topic:i,message:n,opts:s}})}catch(j){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(j),(o=s?.internal)!=null&&o.throwOnFailedPublish)throw j;this.queue.set(y,M)}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.relayer=e,this.logger=jt(t,this.name),this.registerEventListeners()}get context(){return Qt(this.logger)}rpcPublish(e,t,i,n,s,o,f,u){var h,p,y,M;const I={method:cs(n.protocol).publish,params:{topic:e,message:t,ttl:i,prompt:s,tag:o,attestation:u},id:f};return Yt((h=I.params)==null?void 0:h.prompt)&&((p=I.params)==null||delete p.prompt),Yt((y=I.params)==null?void 0:y.tag)&&((M=I.params)==null||delete M.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:I}),this.relayer.request(I)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:t,message:i,opts:n}=e;await this.publish(t,i,n)})}registerEventListeners(){this.relayer.core.heartbeat.on(on.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Wt.connection_stalled);return}this.checkQueue()}),this.relayer.on(Wt.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class N8{constructor(){this.map=new Map,this.set=(e,t)=>{const i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const i=this.get(e);if(!this.exists(e,t))return;const n=i.filter(s=>s!==t);if(!n.length){this.map.delete(e);return}this.map.set(e,n)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var C8=Object.defineProperty,P8=Object.defineProperties,T8=Object.getOwnPropertyDescriptors,Kd=Object.getOwnPropertySymbols,B8=Object.prototype.hasOwnProperty,L8=Object.prototype.propertyIsEnumerable,kd=(r,e,t)=>e in r?C8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ms=(r,e)=>{for(var t in e||(e={}))B8.call(e,t)&&kd(r,t,e[t]);if(Kd)for(var t of Kd(e))L8.call(e,t)&&kd(r,t,e[t]);return r},yf=(r,e)=>P8(r,T8(e));class U8 extends wp{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new N8,this.events=new Ft.exports.EventEmitter,this.name=$y,this.version=zy,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Yr,this.subscribeTimeout=ae.toMiliseconds(ae.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(i,n)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}});try{const s=ef(n),o={topic:i,relay:s,transportType:n?.transportType};this.pending.set(i,o);const f=await this.rpcSubscribe(i,s,n);return typeof f=="string"&&(this.onSubscribe(f,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}})),f}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(i,n)=>{await this.restartToComplete(),this.isInitialized(),typeof n?.id<"u"?await this.unsubscribeById(i,n.id,n):await this.unsubscribeByTopic(i,n)},this.isSubscribed=async i=>{if(this.topics.includes(i))return!0;const n=`${this.pendingSubscriptionWatchLabel}_${i}`;return await new Promise((o,f)=>{const u=new ae.Watch;u.start(n);const h=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(h),u.stop(n),o(!0)),u.elapsed(n)>=Ky&&(clearInterval(h),u.stop(n),f(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=jt(t,this.name),this.clientId=""}get context(){return Qt(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let i=!1;try{i=this.getSubscription(e).topic===t}catch{}return i}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const i=this.topicMap.get(e);await Promise.all(i.map(async n=>await this.unsubscribeById(e,n,t)))}async unsubscribeById(e,t,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});try{const n=ef(i);await this.rpcUnsubscribe(e,t,n);const s=ct("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(e,t,i){var n;i?.transportType===ht.relay&&await this.restartToComplete();const o={method:cs(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:o});const f=(n=i?.internal)==null?void 0:n.throwOnFailedPublish;try{const u=si(e+this.clientId);if(i?.transportType===ht.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(o).catch(y=>this.logger.warn(y))},ae.toMiliseconds(ae.ONE_SECOND)),u;const p=await On(this.relayer.request(o).catch(y=>this.logger.warn(y)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!p&&f)throw new Error(`Subscribing to ${e} failed, please try again`);return p?u:null}catch(u){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Wt.connection_stalled),f)throw u}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t=e[0].relay,n={method:cs(t.protocol).batchSubscribe,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await On(this.relayer.request(n).catch(o=>this.logger.warn(o)),this.subscribeTimeout)}catch{this.relayer.events.emit(Wt.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const t=e[0].relay,n={method:cs(t.protocol).batchFetchMessages,params:{topics:e.map(o=>o.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let s;try{s=await await On(this.relayer.request(n).catch(f=>this.logger.warn(f)),this.subscribeTimeout)}catch{this.relayer.events.emit(Wt.connection_stalled)}return s}rpcUnsubscribe(e,t,i){const s={method:cs(i.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s}),this.relayer.request(s)}onSubscribe(e,t){this.setSubscription(e,yf(ms({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(t=>{this.setSubscription(t.id,ms({},t)),this.pending.delete(t.topic)})}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,ms({},t)),this.topicMap.set(t.topic,e),this.events.emit(Wr.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:i}=ne("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(Wr.deleted,yf(ms({},i),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Wr.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t<e;t++){const i=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchFetchMessages(i),await this.batchSubscribe(i)}}this.events.emit(Wr.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:t}=ne("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);hs(t)&&this.onBatchSubscribe(t.map((i,n)=>yf(ms({},e[n]),{id:i})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const t=await this.rpcBatchFetchMessages(e);t&&t.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(t.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(on.pulse,async()=>{await this.checkPending()}),this.events.on(Wr.created,async e=>{const t=Wr.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(Wr.deleted,async e=>{const t=Wr.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ne("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e())},this.pollingInterval)})}}var F8=Object.defineProperty,jd=Object.getOwnPropertySymbols,q8=Object.prototype.hasOwnProperty,$8=Object.prototype.propertyIsEnumerable,Vd=(r,e,t)=>e in r?F8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Hd=(r,e)=>{for(var t in e||(e={}))q8.call(e,t)&&Vd(r,t,e[t]);if(jd)for(var t of jd(e))$8.call(e,t)&&Vd(r,t,e[t]);return r};class z8 extends mp{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Ft.exports.EventEmitter,this.name=By,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=ae.toMiliseconds(ae.THIRTY_SECONDS+ae.ONE_SECOND),this.request=async t=>{var i,n;this.logger.debug("Publishing Request Payload");const s=t.id||Ji().toString();await this.toEstablishConnection();try{const o=this.provider.request(t);this.requestsInFlight.set(s,{promise:o,request:t}),this.logger.trace({id:s,method:t.method,topic:(i=t.params)==null?void 0:i.topic},"relayer.request - attempt to publish...");const f=await new Promise(async(u,h)=>{const p=()=>{h(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(_r.disconnect,p);const y=await o;this.provider.off(_r.disconnect,p),u(y)});return this.logger.trace({id:s,method:t.method,topic:(n=t.params)==null?void 0:n.topic},"relayer.request - published"),f}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(ya())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var t,i,n;(n=(i=(t=this.provider)==null?void 0:t.connection)==null?void 0:i.socket)==null||n.terminate()},this.heartBeatTimeout)}catch(t){this.logger.warn(t)}},this.onPayloadHandler=t=>{this.onProviderPayload(t),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(Wt.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=t=>{this.logger.error(t),this.events.emit(Wt.error,t),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(_r.payload,this.onPayloadHandler),this.provider.on(_r.connect,this.onConnectHandler),this.provider.on(_r.disconnect,this.onDisconnectHandler),this.provider.on(_r.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?jt(e.logger,this.name):Xr(Qa({level:e.logger||Ty})),this.messages=new R8(this.logger,e.core),this.subscriber=new U8(this,this.logger),this.publisher=new O8(this,this.logger),this.relayUrl=e?.relayUrl||xd,this.projectId=e.projectId,this.bundleId=Y2(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return Qt(this.logger)}get connected(){var e,t,i;return((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===1}get connecting(){var e,t,i;return((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===0}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:ht.relay})}async subscribe(e,t){var i,n,s;this.isInitialized(),t?.transportType==="relay"&&await this.toEstablishConnection();const o=typeof((i=t?.internal)==null?void 0:i.throwOnFailedPublish)>"u"?!0:(n=t?.internal)==null?void 0:n.throwOnFailedPublish;let f=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",u;const h=p=>{p.topic===e&&(this.subscriber.off(Wr.created,h),u())};return await Promise.all([new Promise(p=>{u=p,this.subscriber.on(Wr.created,h)}),new Promise(async(p,y)=>{f=await this.subscriber.subscribe(e,Hd({internal:{throwOnFailedPublish:o}},t)).catch(D=>{o&&y(D)})||f,p()})]),f}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await On(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(t,i)=>{const n=()=>{this.provider.off(_r.disconnect,n),i(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(_r.disconnect,n),await On(this.provider.connect(),ae.toMiliseconds(ae.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{i(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,t()})}catch(t){this.logger.error(t);const i=t;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(i.message))throw t}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await fd())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(e?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const t=e.sort((i,n)=>i.publishedAt-n.publishedAt);this.logger.trace(`Batch of ${t.length} message events sorted`);for(const i of t)try{await this.onMessageEvent(i)}catch(n){this.logger.warn(n)}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){const{topic:i}=e;if(!t.sessionExists){const n=wt(ae.FIVE_MINUTES),s={topic:i,expiry:n,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(i,s)}this.events.emit(Wt.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,t,i,n,s;if(ya())try{(t=(e=this.provider)==null?void 0:e.connection)!=null&&t.socket&&((s=(n=(i=this.provider)==null?void 0:i.connection)==null?void 0:n.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(t=>e.includes(t))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new my(new Ey(X2({sdkVersion:gf,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:i}=e;await this.messages.set(t,i)}async shouldIgnoreMessageEvent(e){const{topic:t,message:i}=e;if(!i||i.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const n=this.messages.has(t,i);return n&&this.logger.debug(`Ignoring duplicate message: ${i}`),n}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),uf(e)){if(!e.method.endsWith(Ly))return;const t=e.params,{topic:i,message:n,publishedAt:s,attestation:o}=t.data,f={topic:i,message:n,publishedAt:s,transportType:ht.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Hd({type:"event",event:t.id},f)),this.events.emit(t.id,f),await this.acknowledgePayload(e),await this.onMessageEvent(f)}else Da(e)&&this.events.emit(Wt.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Wt.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=cf(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(_r.payload,this.onPayloadHandler),this.provider.off(_r.connect,this.onConnectHandler),this.provider.off(_r.disconnect,this.onDisconnectHandler),this.provider.off(_r.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await fd();O6(async t=>{e!==t&&(e=t,t?await this.restartTransport().catch(i=>this.logger.error(i)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(Wt.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},ae.toMiliseconds(Uy))))}isInitialized(){if(!this.initialized){const{message:e}=ne("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.connected&&(clearInterval(t),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var K8=Object.defineProperty,Gd=Object.getOwnPropertySymbols,k8=Object.prototype.hasOwnProperty,j8=Object.prototype.propertyIsEnumerable,Yd=(r,e,t)=>e in r?K8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wd=(r,e)=>{for(var t in e||(e={}))k8.call(e,t)&&Yd(r,t,e[t]);if(Gd)for(var t of Gd(e))j8.call(e,t)&&Yd(r,t,e[t]);return r};class tn extends yp{constructor(e,t,i,n=Yr,s=void 0){super(e,t,i,n),this.core=e,this.logger=t,this.name=i,this.map=new Map,this.version=Fy,this.cached=[],this.initialized=!1,this.storagePrefix=Yr,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!Yt(o)?this.map.set(this.getKey(o),o):o6(o)?this.map.set(o.id,o):f6(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,f)=>{this.isInitialized(),this.map.has(o)?await this.update(o,f):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:f}),this.map.set(o,f),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(f=>Object.keys(o).every(u=>xy(f[u],o[u]))):this.values),this.update=async(o,f)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:f});const u=Wd(Wd({},this.getData(o)),f);this.map.set(o,u),await this.persist()},this.delete=async(o,f)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:f}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=jt(t,this.name),this.storagePrefix=n,this.getKey=s}get context(){return Qt(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){const{message:n}=ne("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}const{message:i}=ne("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:t}=ne("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ne("NOT_INITIALIZED",this.name);throw new Error(e)}}}class V8{constructor(e,t){this.core=e,this.logger=t,this.name=ky,this.version=jy,this.events=new Ft.exports,this.initialized=!1,this.storagePrefix=Yr,this.ignoredPayloadTypes=[ni],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async i=>{this.isInitialized();const n=Zo(),s=await this.core.crypto.setSymKey(n),o=wt(ae.FIVE_MINUTES),f={protocol:Ed},u={topic:s,expiry:o,relay:f,active:!1,methods:i?.methods},h=ed({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:n,relay:f,expiryTimestamp:o,methods:i?.methods});return this.events.emit(Xi.create,u),this.core.expirer.set(s,o),await this.pairings.set(s,u),await this.core.relayer.subscribe(s,{transportType:i?.transportType}),{topic:s,uri:h}},this.pair=async i=>{this.isInitialized();const n=this.core.eventClient.createEvent({properties:{topic:i?.uri,trace:[Jr.pairing_started]}});this.isValidPair(i,n);const{topic:s,symKey:o,relay:f,expiryTimestamp:u,methods:h}=Zu(i.uri);n.props.properties.topic=s,n.addTrace(Jr.pairing_uri_validation_success),n.addTrace(Jr.pairing_uri_not_expired);let p;if(this.pairings.keys.includes(s)){if(p=this.pairings.get(s),n.addTrace(Jr.existing_pairing),p.active)throw n.setError(fi.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);n.addTrace(Jr.pairing_not_expired)}const y=u||wt(ae.FIVE_MINUTES),M={topic:s,relay:f,expiry:y,active:!1,methods:h};this.core.expirer.set(s,y),await this.pairings.set(s,M),n.addTrace(Jr.store_new_pairing),i.activatePairing&&await this.activate({topic:s}),this.events.emit(Xi.create,M),n.addTrace(Jr.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),n.addTrace(Jr.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{n.setError(fi.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:f})}catch(D){throw n.setError(fi.subscribe_pairing_topic_failure),D}return n.addTrace(Jr.subscribe_pairing_topic_success),M},this.activate=async({topic:i})=>{this.isInitialized();const n=wt(ae.THIRTY_DAYS);this.core.expirer.set(i,n),await this.pairings.update(i,{active:!0,expiry:n})},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);const{topic:n}=i;if(this.pairings.keys.includes(n)){const s=await this.sendRequest(n,"wc_pairingPing",{}),{done:o,resolve:f,reject:u}=Gi();this.events.once(Je("pairing_ping",s),({error:h})=>{h?u(h):f()}),await o()}},this.updateExpiry=async({topic:i,expiry:n})=>{this.isInitialized(),await this.pairings.update(i,{expiry:n})},this.updateMetadata=async({topic:i,metadata:n})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:n})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:n}=i;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",ct("USER_DISCONNECTED")),await this.deletePairing(n))},this.formatUriFromPairing=i=>{this.isInitialized();const{topic:n,relay:s,expiry:o,methods:f}=i,u=this.core.crypto.keychain.get(n);return ed({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:u,relay:s,expiryTimestamp:o,methods:f})},this.sendRequest=async(i,n,s)=>{const o=Qi(n,s),f=await this.core.crypto.encode(i,o),u=ps[n].req;return this.core.history.set(i,o),this.core.relayer.publish(i,f,u),o.id},this.sendResult=async(i,n,s)=>{const o=cf(i,s),f=await this.core.crypto.encode(n,o),u=await this.core.history.get(n,i),h=ps[u.request.method].res;await this.core.relayer.publish(n,f,h),await this.core.history.resolve(o)},this.sendError=async(i,n,s)=>{const o=hf(i,s),f=await this.core.crypto.encode(n,o),u=await this.core.history.get(n,i),h=ps[u.request.method]?ps[u.request.method].res:ps.unregistered_method.res;await this.core.relayer.publish(n,f,h),await this.core.history.resolve(o)},this.deletePairing=async(i,n)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,ct("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),n?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{const i=this.pairings.getAll().filter(n=>Ii(n.expiry));await Promise.all(i.map(n=>this.deletePairing(n.topic)))},this.onRelayEventRequest=i=>{const{topic:n,payload:s}=i;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(n,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(n,s);default:return this.onUnknownRpcMethodRequest(n,s)}},this.onRelayEventResponse=async i=>{const{topic:n,payload:s}=i,f=(await this.core.history.get(n,s.id)).request.method;switch(f){case"wc_pairingPing":return this.onPairingPingResponse(n,s);default:return this.onUnknownRpcMethodResponse(f)}},this.onPairingPingRequest=async(i,n)=>{const{id:s}=n;try{this.isValidPing({topic:i}),await this.sendResult(s,i,!0),this.events.emit(Xi.ping,{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}},this.onPairingPingResponse=(i,n)=>{const{id:s}=n;setTimeout(()=>{Gr(n)?this.events.emit(Je("pairing_ping",s),{}):wr(n)&&this.events.emit(Je("pairing_ping",s),{error:n.error})},500)},this.onPairingDeleteRequest=async(i,n)=>{const{id:s}=n;try{this.isValidDisconnect({topic:i}),await this.deletePairing(i),this.events.emit(Xi.delete,{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(i,n)=>{const{id:s,method:o}=n;try{if(this.registeredMethods.includes(o))return;const f=ct("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,i,f),this.logger.error(f)}catch(f){await this.sendError(s,i,f),this.logger.error(f)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(ct("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=(i,n)=>{var s;if(!tr(i)){const{message:f}=ne("MISSING_OR_INVALID",`pair() params: ${i}`);throw n.setError(fi.malformed_pairing_uri),new Error(f)}if(!a6(i.uri)){const{message:f}=ne("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw n.setError(fi.malformed_pairing_uri),new Error(f)}const o=Zu(i?.uri);if(!((s=o?.relay)!=null&&s.protocol)){const{message:f}=ne("MISSING_OR_INVALID","pair() uri#relay-protocol");throw n.setError(fi.malformed_pairing_uri),new Error(f)}if(!o?.symKey){const{message:f}=ne("MISSING_OR_INVALID","pair() uri#symKey");throw n.setError(fi.malformed_pairing_uri),new Error(f)}if(o?.expiryTimestamp&&ae.toMiliseconds(o?.expiryTimestamp)<Date.now()){n.setError(fi.pairing_expired);const{message:u}=ne("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(u)}},this.isValidPing=async i=>{if(!tr(i)){const{message:s}=ne("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidDisconnect=async i=>{if(!tr(i)){const{message:s}=ne("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidPairingTopic=async i=>{if(!mt(i,!1)){const{message:n}=ne("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(n)}if(!this.pairings.keys.includes(i)){const{message:n}=ne("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(n)}if(Ii(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:n}=ne("EXPIRED",`pairing topic: ${i}`);throw new Error(n)}},this.core=e,this.logger=jt(t,this.name),this.pairings=new tn(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Qt(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ne("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Wt.message,async e=>{const{topic:t,message:i,transportType:n}=e;if(!this.pairings.keys.includes(t)||n===ht.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;const s=await this.core.crypto.decode(t,i);try{uf(s)?(this.core.history.set(t,s),this.onRelayEventRequest({topic:t,payload:s})):Da(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:t,payload:s}),this.core.history.delete(t,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Er.expired,async e=>{const{topic:t}=Nu(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(Xi.expire,{topic:t}))})}}class H8 extends gp{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new Ft.exports.EventEmitter,this.name=Vy,this.version=Hy,this.cached=[],this.initialized=!1,this.storagePrefix=Yr,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,n,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:n,chainId:s}),this.records.has(n.id))return;const o={id:n.id,topic:i,request:{method:n.method,params:n.params||null},chainId:s,expiry:wt(ae.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(Or.created,o)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;const n=await this.getRecord(i.id);typeof n.response<"u"||(n.response=wr(i)?{error:i.error}:{result:i.result},this.records.set(n.id,n),this.persist(),this.events.emit(Or.updated,n))},this.get=async(i,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:n}),await this.getRecord(n)),this.delete=(i,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(s=>{if(s.topic===i){if(typeof n<"u"&&s.id!==n)return;this.records.delete(s.id),this.events.emit(Or.deleted,s)}}),this.persist()},this.exists=async(i,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===i:!1),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=jt(t,this.name)}get context(){return Qt(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(t=>{if(typeof t.response<"u")return;const i={topic:t.topic,request:Qi(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:i}=ne("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Or.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:t}=ne("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Or.created,e=>{const t=Or.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(Or.updated,e=>{const t=Or.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(Or.deleted,e=>{const t=Or.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.core.heartbeat.on(on.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{ae.toMiliseconds(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(Or.deleted,t,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ne("NOT_INITIALIZED",this.name);throw new Error(e)}}}class G8 extends _p{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new Ft.exports.EventEmitter,this.name=Gy,this.version=Yy,this.cached=[],this.initialized=!1,this.storagePrefix=Yr,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{const n=this.formatTarget(i);return typeof this.getExpiration(n)<"u"}catch{return!1}},this.set=(i,n)=>{this.isInitialized();const s=this.formatTarget(i),o={target:s,expiry:n};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Er.created,{target:s,expiration:o})},this.get=i=>{this.isInitialized();const n=this.formatTarget(i);return this.getExpiration(n)},this.del=i=>{if(this.isInitialized(),this.has(i)){const s=this.formatTarget(i),o=this.getExpiration(s);this.expirations.delete(s),this.events.emit(Er.deleted,{target:s,expiration:o})}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=jt(t,this.name)}get context(){return Qt(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return Z2(e);if(typeof e=="number")return em(e);const{message:t}=ne("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Er.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:t}=ne("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:i}=ne("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(i),new Error(i)}return t}checkExpiry(e,t){const{expiry:i}=t;ae.toMiliseconds(i)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(Er.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(on.pulse,()=>this.checkExpirations()),this.events.on(Er.created,e=>{const t=Er.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Er.expired,e=>{const t=Er.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Er.deleted,e=>{const t=Er.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ne("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Y8 extends Ep{constructor(e,t,i){super(e,t,i),this.core=e,this.logger=t,this.store=i,this.name=Wy,this.verifyUrlV3=Qy,this.storagePrefix=Yr,this.version=lf,this.init=async()=>{var n;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&ae.toMiliseconds((n=this.publicKey)==null?void 0:n.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))},this.register=async n=>{if(!ts()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:f}=n,u=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${f}`;try{const h=Kn(),p=this.startAbortTimer(ae.ONE_SECOND*5),y=await new Promise((M,D)=>{const I=()=>{window.removeEventListener("message",K),h.body.removeChild(C),D("attestation aborted")};this.abortController.signal.addEventListener("abort",I);const C=h.createElement("iframe");C.src=u,C.style.display="none",C.addEventListener("error",I,{signal:this.abortController.signal});const K=j=>{if(j.data&&typeof j.data=="string")try{const B=JSON.parse(j.data);if(B.type==="verify_attestation"){if(ao(B.attestation).payload.id!==o)return;clearInterval(p),h.body.removeChild(C),this.abortController.signal.removeEventListener("abort",I),window.removeEventListener("message",K),M(B.attestation===null?"":B.attestation)}}catch(B){this.logger.warn(B)}};h.body.appendChild(C),window.addEventListener("message",K,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",y),y}catch(h){this.logger.warn(h)}return""},this.resolve=async n=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:f}=n;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(ao(s).payload.id!==f)return;const p=await this.isValidJwtAttestation(s);if(p){if(!p.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return p}}if(!o)return;const u=this.getVerifyUrl(n?.verifyUrl);return this.fetchAttestation(o,u)},this.fetchAttestation=async(n,s)=>{this.logger.debug(`resolving attestation: ${n} from url: ${s}`);const o=this.startAbortTimer(ae.ONE_SECOND*5),f=await fetch(`${s}/attestation/${n}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),f.status===200?await f.json():void 0},this.getVerifyUrl=n=>{let s=n||gs;return Xy.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${gs}`),s=gs),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const n=this.startAbortTimer(ae.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(n),await s.json()}catch(n){this.logger.warn(n)}},this.persistPublicKey=async n=>{this.logger.debug("persisting public key to local storage",n),await this.store.setItem(this.storeKey,n),this.publicKey=n},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async n=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(n,s)}catch(f){this.logger.error(f),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(n,o)}catch(f){this.logger.error(f),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const n=await this.fetchPromise;return this.fetchPromise=void 0,n},this.validateAttestation=(n,s)=>{const o=zm(n,s.publicKey),f={hasExpired:ae.toMiliseconds(o.exp)<Date.now(),payload:o};if(f.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:f.payload.origin,isScam:f.payload.isScam,isVerified:f.payload.isVerified}},this.logger=jt(t,this.name),this.abortController=new AbortController,this.isDevEnv=Wo(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return Qt(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),ae.toMiliseconds(e))}}class W8 extends xp{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context=Zy,this.registerDeviceToken=async i=>{const{clientId:n,token:s,notificationType:o,enableEncrypted:f=!1}=i,u=`${ew}/${this.projectId}/clients`;await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:n,type:o,token:s,always_raw:f})})},this.logger=jt(t,this.context)}}var J8=Object.defineProperty,Jd=Object.getOwnPropertySymbols,Q8=Object.prototype.hasOwnProperty,X8=Object.prototype.propertyIsEnumerable,Qd=(r,e,t)=>e in r?J8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ys=(r,e)=>{for(var t in e||(e={}))Q8.call(e,t)&&Qd(r,t,e[t]);if(Jd)for(var t of Jd(e))X8.call(e,t)&&Qd(r,t,e[t]);return r};class Z8 extends Ap{constructor(e,t,i=!0){super(e,t,i),this.core=e,this.logger=t,this.context=rw,this.storagePrefix=Yr,this.storageVersion=tw,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!Wo())try{const n={eventId:Pu(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Mu(this.core.relayer.protocol,this.core.relayer.version,gf)}}};await this.sendEvent([n])}catch(n){this.logger.warn(n)}},this.createEvent=n=>{const{event:s="ERROR",type:o="",properties:{topic:f,trace:u}}=n,h=Pu(),p=this.core.projectId||"",y=Date.now(),D=ys({eventId:h,timestamp:y,props:{event:s,type:o,properties:{topic:f,trace:u}},bundleId:p,domain:this.getAppDomain()},this.setMethods(h));return this.telemetryEnabled&&(this.events.set(h,D),this.shouldPersist=!0),D},this.getEvent=n=>{const{eventId:s,topic:o}=n;if(s)return this.events.get(s);const f=Array.from(this.events.values()).find(u=>u.props.properties.topic===o);if(f)return ys(ys({},f),this.setMethods(f.eventId))},this.deleteEvent=n=>{const{eventId:s}=n;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(on.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(n=>{ae.fromMiliseconds(Date.now())-ae.fromMiliseconds(n.timestamp)>iw&&(this.events.delete(n.eventId),this.shouldPersist=!0)})})},this.setMethods=n=>({addTrace:s=>this.addTrace(n,s),setError:s=>this.setError(n,s)}),this.addTrace=(n,s)=>{const o=this.events.get(n);o&&(o.props.properties.trace.push(s),this.events.set(n,o),this.shouldPersist=!0)},this.setError=(n,s)=>{const o=this.events.get(n);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(n,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const n=await this.core.storage.getItem(this.storageKey)||[];if(!n.length)return;n.forEach(s=>{this.events.set(s.eventId,ys(ys({},s),this.setMethods(s.eventId)))})}catch(n){this.logger.warn(n)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const n=[];for(const[s,o]of this.events)o.props.type&&n.push(o);if(n.length!==0)try{if((await this.sendEvent(n)).ok)for(const o of n)this.events.delete(o.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async n=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${nw}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${gf}${s}`,{method:"POST",body:JSON.stringify(n)})},this.getAppDomain=()=>Du().url,this.logger=jt(t,this.context),this.telemetryEnabled=i,i?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var e5=Object.defineProperty,Xd=Object.getOwnPropertySymbols,t5=Object.prototype.hasOwnProperty,r5=Object.prototype.propertyIsEnumerable,Zd=(r,e,t)=>e in r?e5(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,el=(r,e)=>{for(var t in e||(e={}))t5.call(e,t)&&Zd(r,t,e[t]);if(Xd)for(var t of Xd(e))r5.call(e,t)&&Zd(r,t,e[t]);return r};class wf extends pp{constructor(e){var t;super(e),this.protocol=wd,this.version=lf,this.name=pf,this.events=new Ft.exports.EventEmitter,this.initialized=!1,this.on=(o,f)=>this.events.on(o,f),this.once=(o,f)=>this.events.once(o,f),this.off=(o,f)=>this.events.off(o,f),this.removeListener=(o,f)=>this.events.removeListener(o,f),this.dispatchEnvelope=({topic:o,message:f,sessionExists:u})=>{if(!o||!f)return;const h={topic:o,message:f,publishedAt:Date.now(),transportType:ht.link_mode};this.relayer.onLinkMessageEvent(h,{sessionExists:u})},this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||xd,this.customStoragePrefix=e?.customStoragePrefix?`:${e.customStoragePrefix}`:"";const i=Qa({level:typeof e?.logger=="string"&&e.logger?e.logger:Ay.logger}),{logger:n,chunkLoggerController:s}=lp({opts:i,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=s,(t=this.logChunkController)!=null&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,f;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((f=this.logChunkController)==null||f.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=jt(n,this.name),this.heartbeat=new ja,this.crypto=new I8(this,this.logger,e?.keychain),this.history=new H8(this,this.logger),this.expirer=new G8(this,this.logger),this.storage=e?.storage?e.storage:new q0(el(el({},Sy),e?.storageOptions)),this.relayer=new z8({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new V8(this,this.logger),this.verify=new Y8(this,this.logger,this.storage),this.echoClient=new W8(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new Z8(this,this.logger,e?.telemetryEnabled)}static async init(e){const t=new wf(e);await t.initialize();const i=await t.crypto.getClientId();return await t.storage.setItem(qy,i),t}get context(){return Qt(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(Ad,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(Ad)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const _f=wf,tl="wc",rl=2,il="client",Ef=`${tl}@${rl}:${il}:`,xf={name:il,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},nl="WALLETCONNECT_DEEPLINK_CHOICE",i5="proposal",n5="Proposal expired",s5="session",Cn=ae.SEVEN_DAYS,a5="engine",It={wc_sessionPropose:{req:{ttl:ae.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ae.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:ae.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:ae.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:ae.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ae.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ae.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ae.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ae.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ae.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ae.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:ae.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ae.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ae.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ae.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ae.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ae.ONE_DAY,prompt:!1,tag:1114},res:{ttl:ae.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:ae.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:ae.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:ae.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:ae.FIVE_MINUTES,prompt:!1,tag:1119}}},Af={min:ae.FIVE_MINUTES,max:ae.SEVEN_DAYS},Qr={idle:"IDLE",active:"ACTIVE"},o5="request",f5=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],c5="wc",h5=1.5,u5="auth",d5="authKeys",l5="pairingTopics",p5="requests",Ia=`${c5}@${h5}:${u5}:`,Ra=`${Ia}:PUB_KEY`;var g5=Object.defineProperty,v5=Object.defineProperties,b5=Object.getOwnPropertyDescriptors,sl=Object.getOwnPropertySymbols,m5=Object.prototype.hasOwnProperty,y5=Object.prototype.propertyIsEnumerable,al=(r,e,t)=>e in r?g5(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,gt=(r,e)=>{for(var t in e||(e={}))m5.call(e,t)&&al(r,t,e[t]);if(sl)for(var t of sl(e))y5.call(e,t)&&al(r,t,e[t]);return r},Cr=(r,e)=>v5(r,b5(e));class w5 extends Dp{constructor(e){super(e),this.name=a5,this.events=new Ft.exports,this.initialized=!1,this.requestQueue={state:Qr.idle,queue:[]},this.sessionRequestQueue={state:Qr.idle,queue:[]},this.requestQueueDelay=ae.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(It)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},ae.toMiliseconds(this.requestQueueDelay)))},this.connect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const i=Cr(gt({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(i);const{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:f,relays:u}=i;let h=n,p,y=!1;try{h&&(y=this.client.core.pairing.pairings.get(h).active)}catch(T){throw this.client.logger.error(`connect() -> pairing.get(${h}) failed`),T}if(!h||!y){const{topic:T,uri:q}=await this.client.core.pairing.create();h=T,p=q}if(!h){const{message:T}=ne("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(T)}const M=await this.client.core.crypto.generateKeyPair(),D=It.wc_sessionPropose.req.ttl||ae.FIVE_MINUTES,I=wt(D),C=gt({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Ed}],proposer:{publicKey:M,metadata:this.client.metadata},expiryTimestamp:I,pairingTopic:h},f&&{sessionProperties:f}),{reject:K,resolve:j,done:B}=Gi(D,n5);this.events.once(Je("session_connect"),async({error:T,session:q})=>{if(T)K(T);else if(q){q.self.publicKey=M;const $=Cr(gt({},q),{pairingTopic:C.pairingTopic,requiredNamespaces:C.requiredNamespaces,optionalNamespaces:C.optionalNamespaces,transportType:ht.relay});await this.client.session.set(q.topic,$),await this.setExpiry(q.topic,q.expiry),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:q.peer.metadata}),this.cleanupDuplicatePairings($),j($)}});const k=await this.sendRequest({topic:h,method:"wc_sessionPropose",params:C,throwOnFailedPublish:!0});return await this.setProposal(k,gt({id:k},C)),{uri:p,approval:B}},this.pair=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(t)}catch(i){throw this.client.logger.error("pair() failed"),i}},this.approve=async t=>{var i,n,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(i=t?.id)==null?void 0:i.toString(),trace:[Nr.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(O){throw o.setError(Zi.no_internet_connection),O}try{await this.isValidProposalId(t?.id)}catch(O){throw this.client.logger.error(`approve() -> proposal.get(${t?.id}) failed`),o.setError(Zi.proposal_not_found),O}try{await this.isValidApprove(t)}catch(O){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(Zi.session_approve_namespace_validation_failure),O}const{id:f,relayProtocol:u,namespaces:h,sessionProperties:p,sessionConfig:y}=t,M=this.client.proposal.get(f);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:D,proposer:I,requiredNamespaces:C,optionalNamespaces:K}=M;let j=(n=this.client.core.eventClient)==null?void 0:n.getEvent({topic:D});j||(j=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:Nr.session_approve_started,properties:{topic:D,trace:[Nr.session_approve_started,Nr.session_namespaces_validation_success]}}));const B=await this.client.core.crypto.generateKeyPair(),k=I.publicKey,T=await this.client.core.crypto.generateSharedKey(B,k),q=gt(gt({relay:{protocol:u??"irn"},namespaces:h,controller:{publicKey:B,metadata:this.client.metadata},expiry:wt(Cn)},p&&{sessionProperties:p}),y&&{sessionConfig:y}),$=ht.relay;j.addTrace(Nr.subscribing_session_topic);try{await this.client.core.relayer.subscribe(T,{transportType:$})}catch(O){throw j.setError(Zi.subscribe_session_topic_failure),O}j.addTrace(Nr.subscribe_session_topic_success);const _=Cr(gt({},q),{topic:T,requiredNamespaces:C,optionalNamespaces:K,pairingTopic:D,acknowledged:!1,self:q.controller,peer:{publicKey:I.publicKey,metadata:I.metadata},controller:B,transportType:ht.relay});await this.client.session.set(T,_),j.addTrace(Nr.store_session);try{j.addTrace(Nr.publishing_session_settle),await this.sendRequest({topic:T,method:"wc_sessionSettle",params:q,throwOnFailedPublish:!0}).catch(O=>{throw j?.setError(Zi.session_settle_publish_failure),O}),j.addTrace(Nr.session_settle_publish_success),j.addTrace(Nr.publishing_session_approve),await this.sendResult({id:f,topic:D,result:{relay:{protocol:u??"irn"},responderPublicKey:B},throwOnFailedPublish:!0}).catch(O=>{throw j?.setError(Zi.session_approve_publish_failure),O}),j.addTrace(Nr.session_approve_publish_success)}catch(O){throw this.client.logger.error(O),this.client.session.delete(T,ct("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(T),O}return this.client.core.eventClient.deleteEvent({eventId:j.eventId}),await this.client.core.pairing.updateMetadata({topic:D,metadata:I.metadata}),await this.client.proposal.delete(f,ct("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:D}),await this.setExpiry(T,wt(Cn)),{topic:T,acknowledged:()=>Promise.resolve(this.client.session.get(T))}},this.reject=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(t)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:i,reason:n}=t;let s;try{s=this.client.proposal.get(i).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${i}) failed`),o}s&&(await this.sendError({id:i,topic:s,error:n,rpcOpts:It.wc_sessionPropose.reject}),await this.client.proposal.delete(i,ct("USER_DISCONNECTED")))},this.update=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(t)}catch(y){throw this.client.logger.error("update() -> isValidUpdate() failed"),y}const{topic:i,namespaces:n}=t,{done:s,resolve:o,reject:f}=Gi(),u=Oi(),h=Ji().toString(),p=this.client.session.get(i).namespaces;return this.events.once(Je("session_update",u),({error:y})=>{y?f(y):o()}),await this.client.session.update(i,{namespaces:n}),await this.sendRequest({topic:i,method:"wc_sessionUpdate",params:{namespaces:n},throwOnFailedPublish:!0,clientRpcId:u,relayRpcId:h}).catch(y=>{this.client.logger.error(y),this.client.session.update(i,{namespaces:p}),f(y)}),{acknowledged:s}},this.extend=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(t)}catch(u){throw this.client.logger.error("extend() -> isValidExtend() failed"),u}const{topic:i}=t,n=Oi(),{done:s,resolve:o,reject:f}=Gi();return this.events.once(Je("session_extend",n),({error:u})=>{u?f(u):o()}),await this.setExpiry(i,wt(Cn)),this.sendRequest({topic:i,method:"wc_sessionExtend",params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch(u=>{f(u)}),{acknowledged:s}},this.request=async t=>{this.isInitialized();try{await this.isValidRequest(t)}catch(I){throw this.client.logger.error("request() -> isValidRequest() failed"),I}const{chainId:i,request:n,topic:s,expiry:o=It.wc_sessionRequest.req.ttl}=t,f=this.client.session.get(s);f?.transportType===ht.relay&&await this.confirmOnlineStateOrThrow();const u=Oi(),h=Ji().toString(),{done:p,resolve:y,reject:M}=Gi(o,"Request expired. Please try again.");this.events.once(Je("session_request",u),({error:I,result:C})=>{I?M(I):y(C)});const D=this.getAppLinkIfEnabled(f.peer.metadata,f.transportType);return D?(await this.sendRequest({clientRpcId:u,relayRpcId:h,topic:s,method:"wc_sessionRequest",params:{request:Cr(gt({},n),{expiryTimestamp:wt(o)}),chainId:i},expiry:o,throwOnFailedPublish:!0,appLink:D}).catch(C=>M(C)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:u}),await p()):await Promise.all([new Promise(async I=>{await this.sendRequest({clientRpcId:u,relayRpcId:h,topic:s,method:"wc_sessionRequest",params:{request:Cr(gt({},n),{expiryTimestamp:wt(o)}),chainId:i},expiry:o,throwOnFailedPublish:!0}).catch(C=>M(C)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:u}),I()}),new Promise(async I=>{var C;if(!((C=f.sessionConfig)!=null&&C.disableDeepLink)){const K=await nm(this.client.core.storage,nl);await rm({id:u,topic:s,wcDeepLink:K})}I()}),p()]).then(I=>I[2])},this.respond=async t=>{this.isInitialized(),await this.isValidRespond(t);const{topic:i,response:n}=t,{id:s}=n,o=this.client.session.get(i);o.transportType===ht.relay&&await this.confirmOnlineStateOrThrow();const f=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);Gr(n)?await this.sendResult({id:s,topic:i,result:n.result,throwOnFailedPublish:!0,appLink:f}):wr(n)&&await this.sendError({id:s,topic:i,error:n.error,appLink:f}),this.cleanupAfterResponse(t)},this.ping=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(t)}catch(n){throw this.client.logger.error("ping() -> isValidPing() failed"),n}const{topic:i}=t;if(this.client.session.keys.includes(i)){const n=Oi(),s=Ji().toString(),{done:o,resolve:f,reject:u}=Gi();this.events.once(Je("session_ping",n),({error:h})=>{h?u(h):f()}),await Promise.all([this.sendRequest({topic:i,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:n,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(i)&&await this.client.core.pairing.ping({topic:i})},this.emit=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(t);const{topic:i,event:n,chainId:s}=t,o=Ji().toString();await this.sendRequest({topic:i,method:"wc_sessionEvent",params:{event:n,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(t);const{topic:i}=t;if(this.client.session.keys.includes(i))await this.sendRequest({topic:i,method:"wc_sessionDelete",params:ct("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:i,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(i))await this.client.core.pairing.disconnect({topic:i});else{const{message:n}=ne("MISMATCHED_TOPIC",`Session or pairing topic not found: ${i}`);throw new Error(n)}},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(i=>n6(i,t))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(t,i)=>{var n;this.isInitialized(),this.isValidAuthenticate(t);const s=i&&this.client.core.linkModeSupportedApps.includes(i)&&((n=this.client.metadata.redirect)==null?void 0:n.linkMode),o=s?ht.link_mode:ht.relay;o===ht.relay&&await this.confirmOnlineStateOrThrow();const{chains:f,statement:u="",uri:h,domain:p,nonce:y,type:M,exp:D,nbf:I,methods:C=[],expiry:K}=t,j=[...t.resources||[]],{topic:B,uri:k}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:B,uri:k}});const T=await this.client.core.crypto.generateKeyPair(),q=Ea(T);if(await Promise.all([this.client.auth.authKeys.set(Ra,{responseTopic:q,publicKey:T}),this.client.auth.pairingTopics.set(q,{topic:q,pairingTopic:B})]),await this.client.core.relayer.subscribe(q,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${B}`),C.length>0){const{namespace:A}=ma(f[0]);let E=Sm(A,"request",C);_a(j)&&(E=Mm(E,j.pop())),j.push(E)}const $=K&&K>It.wc_sessionAuthenticate.req.ttl?K:It.wc_sessionAuthenticate.req.ttl,_={authPayload:{type:M??"caip122",chains:f,statement:u,aud:h,domain:p,version:"1",nonce:y,iat:new Date().toISOString(),exp:D,nbf:I,resources:j},requester:{publicKey:T,metadata:this.client.metadata},expiryTimestamp:wt($)},O={eip155:{chains:f,methods:[...new Set(["personal_sign",...C])],events:["chainChanged","accountsChanged"]}},W={requiredNamespaces:{},optionalNamespaces:O,relays:[{protocol:"irn"}],pairingTopic:B,proposer:{publicKey:T,metadata:this.client.metadata},expiryTimestamp:wt(It.wc_sessionPropose.req.ttl)},{done:X,resolve:N,reject:g}=Gi($,"Request expired"),l=async({error:A,session:E})=>{if(this.events.off(Je("session_request",c),a),A)g(A);else if(E){E.self.publicKey=T,await this.client.session.set(E.topic,E),await this.setExpiry(E.topic,E.expiry),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:E.peer.metadata});const d=this.client.session.get(E.topic);await this.deleteProposal(v),N({session:d})}},a=async A=>{var E,d,w;if(await this.deletePendingAuthRequest(c,{message:"fulfilled",code:0}),A.error){const F=ct("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return A.error.code===F.code?void 0:(this.events.off(Je("session_connect"),l),g(A.error.message))}await this.deleteProposal(v),this.events.off(Je("session_connect"),l);const{cacaos:b,responder:R}=A.result,Y=[],S=[];for(const F of b){await Uu({cacao:F,projectId:this.client.core.projectId})||(this.client.logger.error(F,"Signature verification failed"),g(ct("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:m}=F,U=_a(m.resources),G=[Qo(m.iss)],J=wa(m.iss);if(U){const Q=$u(U),ee=zu(U);Y.push(...Q),G.push(...ee)}for(const Q of G)S.push(`${Q}:${J}`)}const V=await this.client.core.crypto.generateSharedKey(T,R.publicKey);let P;Y.length>0&&(P={topic:V,acknowledged:!0,self:{publicKey:T,metadata:this.client.metadata},peer:R,controller:R.publicKey,expiry:wt(Cn),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:B,namespaces:td([...new Set(Y)],[...new Set(S)]),transportType:o},await this.client.core.relayer.subscribe(V,{transportType:o}),await this.client.session.set(V,P),B&&await this.client.core.pairing.updateMetadata({topic:B,metadata:R.metadata}),P=this.client.session.get(V)),(E=this.client.metadata.redirect)!=null&&E.linkMode&&((d=R.metadata.redirect)!=null&&d.linkMode)&&((w=R.metadata.redirect)!=null&&w.universal)&&i&&(this.client.core.addLinkModeSupportedApp(R.metadata.redirect.universal),this.client.session.update(V,{transportType:ht.link_mode})),N({auths:b,session:P})},c=Oi(),v=Oi();this.events.once(Je("session_connect"),l),this.events.once(Je("session_request",c),a);let x;try{if(s){const A=Qi("wc_sessionAuthenticate",_,c);this.client.core.history.set(B,A);const E=await this.client.core.crypto.encode("",A,{type:as,encoding:ns});x=xa(i,B,E)}else await Promise.all([this.sendRequest({topic:B,method:"wc_sessionAuthenticate",params:_,expiry:t.expiry,throwOnFailedPublish:!0,clientRpcId:c}),this.sendRequest({topic:B,method:"wc_sessionPropose",params:W,expiry:It.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:v})])}catch(A){throw this.events.off(Je("session_connect"),l),this.events.off(Je("session_request",c),a),A}return await this.setProposal(v,gt({id:v},W)),await this.setAuthRequest(c,{request:Cr(gt({},_),{verifyContext:{}}),pairingTopic:B,transportType:o}),{uri:x??k,response:X}},this.approveSessionAuthenticate=async t=>{const{id:i,auths:n}=t,s=this.client.core.eventClient.createEvent({properties:{topic:i.toString(),trace:[en.authenticated_session_approve_started]}});try{this.isInitialized()}catch(K){throw s.setError(vs.no_internet_connection),K}const o=this.getPendingAuthRequest(i);if(!o)throw s.setError(vs.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${i}`);const f=o.transportType||ht.relay;f===ht.relay&&await this.confirmOnlineStateOrThrow();const u=o.requester.publicKey,h=await this.client.core.crypto.generateKeyPair(),p=Ea(u),y={type:ni,receiverPublicKey:u,senderPublicKey:h},M=[],D=[];for(const K of n){if(!await Uu({cacao:K,projectId:this.client.core.projectId})){s.setError(vs.invalid_cacao);const $=ct("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:i,topic:p,error:$,encodeOpts:y}),new Error($.message)}s.addTrace(en.cacaos_verified);const{p:B}=K,k=_a(B.resources),T=[Qo(B.iss)],q=wa(B.iss);if(k){const $=$u(k),_=zu(k);M.push(...$),T.push(..._)}for(const $ of T)D.push(`${$}:${q}`)}const I=await this.client.core.crypto.generateSharedKey(h,u);s.addTrace(en.create_authenticated_session_topic);let C;if(M?.length>0){C={topic:I,acknowledged:!0,self:{publicKey:h,metadata:this.client.metadata},peer:{publicKey:u,metadata:o.requester.metadata},controller:u,expiry:wt(Cn),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:td([...new Set(M)],[...new Set(D)]),transportType:f},s.addTrace(en.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(I,{transportType:f})}catch(K){throw s.setError(vs.subscribe_authenticated_session_topic_failure),K}s.addTrace(en.subscribe_authenticated_session_topic_success),await this.client.session.set(I,C),s.addTrace(en.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(en.publishing_authenticated_session_approve);try{await this.sendResult({topic:p,id:i,result:{cacaos:n,responder:{publicKey:h,metadata:this.client.metadata}},encodeOpts:y,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,f)})}catch(K){throw s.setError(vs.authenticated_session_approve_publish_failure),K}return await this.client.auth.requests.delete(i,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:C}},this.rejectSessionAuthenticate=async t=>{this.isInitialized();const{id:i,reason:n}=t,s=this.getPendingAuthRequest(i);if(!s)throw new Error(`Could not find pending auth request with id ${i}`);s.transportType===ht.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,f=await this.client.core.crypto.generateKeyPair(),u=Ea(o),h={type:ni,receiverPublicKey:o,senderPublicKey:f};await this.sendError({id:i,topic:u,error:n,encodeOpts:h,rpcOpts:It.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(i,{message:"rejected",code:0}),await this.client.proposal.delete(i,ct("USER_DISCONNECTED"))},this.formatAuthMessage=t=>{this.isInitialized();const{request:i,iss:n}=t;return Fu(i,n)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const t=this.relayMessageCache.shift();t&&await this.onRelayMessage(t)}catch(t){this.client.logger.error(t)}},50)},this.cleanupDuplicatePairings=async t=>{if(t.pairingTopic)try{const i=this.client.core.pairing.pairings.get(t.pairingTopic),s=this.client.core.pairing.pairings.getAll().filter(o=>{var f,u;return((f=o.peerMetadata)==null?void 0:f.url)&&((u=o.peerMetadata)==null?void 0:u.url)===t.peer.metadata.url&&o.topic&&o.topic!==i.topic});if(s.length===0)return;this.client.logger.info(`Cleaning up ${s.length} duplicate pairing(s)`),await Promise.all(s.map(o=>this.client.core.pairing.disconnect({topic:o.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(i){this.client.logger.error(i)}},this.deleteSession=async t=>{var i;const{topic:n,expirerHasDeleted:s=!1,emitEvent:o=!0,id:f=0}=t,{self:u}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,ct("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),s||this.client.core.expirer.del(n),this.client.core.storage.removeItem(nl).catch(h=>this.client.logger.warn(h)),this.getPendingSessionRequests().forEach(h=>{h.topic===n&&this.deletePendingSessionRequest(h.id,ct("USER_DISCONNECTED"))}),n===((i=this.sessionRequestQueue.queue[0])==null?void 0:i.topic)&&(this.sessionRequestQueue.state=Qr.idle),o&&this.client.events.emit("session_delete",{id:f,topic:n})},this.deleteProposal=async(t,i)=>{if(i)try{const n=this.client.proposal.get(t),s=this.client.core.eventClient.getEvent({topic:n.pairingTopic});s?.setError(Zi.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(t,ct("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"proposal")},this.deletePendingSessionRequest=async(t,i,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,i),n?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==t),n&&(this.sessionRequestQueue.state=Qr.idle,this.client.events.emit("session_request_expire",{id:t}))},this.deletePendingAuthRequest=async(t,i,n=!1)=>{await Promise.all([this.client.auth.requests.delete(t,i),n?Promise.resolve():this.client.core.expirer.del(t)])},this.setExpiry=async(t,i)=>{this.client.session.keys.includes(t)&&(this.client.core.expirer.set(t,i),await this.client.session.update(t,{expiry:i}))},this.setProposal=async(t,i)=>{this.client.core.expirer.set(t,wt(It.wc_sessionPropose.req.ttl)),await this.client.proposal.set(t,i)},this.setAuthRequest=async(t,i)=>{const{request:n,pairingTopic:s,transportType:o=ht.relay}=i;this.client.core.expirer.set(t,n.expiryTimestamp),await this.client.auth.requests.set(t,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:t,pairingTopic:s,verifyContext:n.verifyContext,transportType:o})},this.setPendingSessionRequest=async t=>{const{id:i,topic:n,params:s,verifyContext:o}=t,f=s.request.expiryTimestamp||wt(It.wc_sessionRequest.req.ttl);this.client.core.expirer.set(i,f),await this.client.pendingRequest.set(i,{id:i,topic:n,params:s,verifyContext:o})},this.sendRequest=async t=>{const{topic:i,method:n,params:s,expiry:o,relayRpcId:f,clientRpcId:u,throwOnFailedPublish:h,appLink:p}=t,y=Qi(n,s,u);let M;const D=!!p;try{const K=D?ns:Ri;M=await this.client.core.crypto.encode(i,y,{encoding:K})}catch(K){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${i} failed`),K}let I;if(f5.includes(n)){const K=si(JSON.stringify(y)),j=si(M);I=await this.client.core.verify.register({id:j,decryptedId:K})}const C=It[n].req;if(C.attestation=I,o&&(C.ttl=o),f&&(C.id=f),this.client.core.history.set(i,y),D){const K=xa(p,i,M);await global.Linking.openURL(K,this.client.name)}else{const K=It[n].req;o&&(K.ttl=o),f&&(K.id=f),h?(K.internal=Cr(gt({},K.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,M,K)):this.client.core.relayer.publish(i,M,K).catch(j=>this.client.logger.error(j))}return y.id},this.sendResult=async t=>{const{id:i,topic:n,result:s,throwOnFailedPublish:o,encodeOpts:f,appLink:u}=t,h=cf(i,s);let p;const y=u&&typeof(global==null?void 0:global.Linking)<"u";try{const D=y?ns:Ri;p=await this.client.core.crypto.encode(n,h,Cr(gt({},f||{}),{encoding:D}))}catch(D){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${n} failed`),D}let M;try{M=await this.client.core.history.get(n,i)}catch(D){throw this.client.logger.error(`sendResult() -> history.get(${n}, ${i}) failed`),D}if(y){const D=xa(u,n,p);await global.Linking.openURL(D,this.client.name)}else{const D=It[M.request.method].res;o?(D.internal=Cr(gt({},D.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,p,D)):this.client.core.relayer.publish(n,p,D).catch(I=>this.client.logger.error(I))}await this.client.core.history.resolve(h)},this.sendError=async t=>{const{id:i,topic:n,error:s,encodeOpts:o,rpcOpts:f,appLink:u}=t,h=hf(i,s);let p;const y=u&&typeof(global==null?void 0:global.Linking)<"u";try{const D=y?ns:Ri;p=await this.client.core.crypto.encode(n,h,Cr(gt({},o||{}),{encoding:D}))}catch(D){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${n} failed`),D}let M;try{M=await this.client.core.history.get(n,i)}catch(D){throw this.client.logger.error(`sendError() -> history.get(${n}, ${i}) failed`),D}if(y){const D=xa(u,n,p);await global.Linking.openURL(D,this.client.name)}else{const D=f||It[M.request.method].res;this.client.core.relayer.publish(n,p,D)}await this.client.core.history.resolve(h)},this.cleanup=async()=>{const t=[],i=[];this.client.session.getAll().forEach(n=>{let s=!1;Ii(n.expiry)&&(s=!0),this.client.core.crypto.keychain.has(n.topic)||(s=!0),s&&t.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{Ii(n.expiryTimestamp)&&i.push(n.id)}),await Promise.all([...t.map(n=>this.deleteSession({topic:n})),...i.map(n=>this.deleteProposal(n))])},this.onRelayEventRequest=async t=>{this.requestQueue.queue.push(t),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Qr.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Qr.active;const t=this.requestQueue.queue.shift();if(t)try{await this.processRequest(t)}catch(i){this.client.logger.warn(i)}}this.requestQueue.state=Qr.idle},this.processRequest=async t=>{const{topic:i,payload:n,attestation:s,transportType:o,encryptedId:f}=t,u=n.method;if(!this.shouldIgnorePairingRequest({topic:i,requestMethod:u}))switch(u){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:i,payload:n,attestation:s,encryptedId:f});case"wc_sessionSettle":return await this.onSessionSettleRequest(i,n);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(i,n);case"wc_sessionExtend":return await this.onSessionExtendRequest(i,n);case"wc_sessionPing":return await this.onSessionPingRequest(i,n);case"wc_sessionDelete":return await this.onSessionDeleteRequest(i,n);case"wc_sessionRequest":return await this.onSessionRequest({topic:i,payload:n,attestation:s,encryptedId:f,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(i,n);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:i,payload:n,attestation:s,encryptedId:f,transportType:o});default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async t=>{const{topic:i,payload:n,transportType:s}=t,f=(await this.client.core.history.get(i,n.id)).request.method;switch(f){case"wc_sessionPropose":return this.onSessionProposeResponse(i,n,s);case"wc_sessionSettle":return this.onSessionSettleResponse(i,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,n);case"wc_sessionExtend":return this.onSessionExtendResponse(i,n);case"wc_sessionPing":return this.onSessionPingResponse(i,n);case"wc_sessionRequest":return this.onSessionRequestResponse(i,n);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(i,n);default:return this.client.logger.info(`Unsupported response method ${f}`)}},this.onRelayEventUnknownPayload=t=>{const{topic:i}=t,{message:n}=ne("MISSING_OR_INVALID",`Decoded payload on topic ${i} is not identifiable as a JSON-RPC request or a response.`);throw new Error(n)},this.shouldIgnorePairingRequest=t=>{const{topic:i,requestMethod:n}=t,s=this.expectedPairingMethodMap.get(i);return!s||s.includes(n)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async t=>{const{topic:i,payload:n,attestation:s,encryptedId:o}=t,{params:f,id:u}=n;try{const h=this.client.core.eventClient.getEvent({topic:i});this.isValidConnect(gt({},n.params));const p=f.expiryTimestamp||wt(It.wc_sessionPropose.req.ttl),y=gt({id:u,pairingTopic:i,expiryTimestamp:p},f);await this.setProposal(u,y);const M=await this.getVerifyContext({attestationId:s,hash:si(JSON.stringify(n)),encryptedId:o,metadata:y.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),h?.setError(fi.proposal_listener_not_found)),h?.addTrace(Jr.emit_session_proposal),this.client.events.emit("session_proposal",{id:u,params:y,verifyContext:M})}catch(h){await this.sendError({id:u,topic:i,error:h,rpcOpts:It.wc_sessionPropose.autoReject}),this.client.logger.error(h)}},this.onSessionProposeResponse=async(t,i,n)=>{const{id:s}=i;if(Gr(i)){const{result:o}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const f=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:f});const u=f.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const h=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:h});const p=await this.client.core.crypto.generateSharedKey(u,h);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:p});const y=await this.client.core.relayer.subscribe(p,{transportType:n});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:y}),await this.client.core.pairing.activate({topic:t})}else if(wr(i)){await this.client.proposal.delete(s,ct("USER_DISCONNECTED"));const o=Je("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(Je("session_connect"),{error:i.error})}},this.onSessionSettleRequest=async(t,i)=>{const{id:n,params:s}=i;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:f,expiry:u,namespaces:h,sessionProperties:p,sessionConfig:y}=i.params,M=Cr(gt(gt({topic:t,relay:o,expiry:u,namespaces:h,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:f.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:f.publicKey,metadata:f.metadata}},p&&{sessionProperties:p}),y&&{sessionConfig:y}),{transportType:ht.relay}),D=Je("session_connect");if(this.events.listenerCount(D)===0)throw new Error(`emitting ${D} without any listeners 997`);this.events.emit(Je("session_connect"),{session:M}),await this.sendResult({id:i.id,topic:t,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:n,topic:t,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(t,i)=>{const{id:n}=i;Gr(i)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(Je("session_approve",n),{})):wr(i)&&(await this.client.session.delete(t,ct("USER_DISCONNECTED")),this.events.emit(Je("session_approve",n),{error:i.error}))},this.onSessionUpdateRequest=async(t,i)=>{const{params:n,id:s}=i;try{const o=`${t}_session_update`,f=us.get(o);if(f&&this.isRequestOutOfSync(f,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:t,error:ct("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(gt({topic:t},n));try{us.set(o,s),await this.client.session.update(t,{namespaces:n.namespaces}),await this.sendResult({id:s,topic:t,result:!0,throwOnFailedPublish:!0})}catch(u){throw us.delete(o),u}this.client.events.emit("session_update",{id:s,topic:t,params:n})}catch(o){await this.sendError({id:s,topic:t,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(t,i)=>parseInt(i.toString().slice(0,-3))<=parseInt(t.toString().slice(0,-3)),this.onSessionUpdateResponse=(t,i)=>{const{id:n}=i,s=Je("session_update",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Gr(i)?this.events.emit(Je("session_update",n),{}):wr(i)&&this.events.emit(Je("session_update",n),{error:i.error})},this.onSessionExtendRequest=async(t,i)=>{const{id:n}=i;try{this.isValidExtend({topic:t}),await this.setExpiry(t,wt(Cn)),await this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:n,topic:t})}catch(s){await this.sendError({id:n,topic:t,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(t,i)=>{const{id:n}=i,s=Je("session_extend",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Gr(i)?this.events.emit(Je("session_extend",n),{}):wr(i)&&this.events.emit(Je("session_extend",n),{error:i.error})},this.onSessionPingRequest=async(t,i)=>{const{id:n}=i;try{this.isValidPing({topic:t}),await this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:n,topic:t})}catch(s){await this.sendError({id:n,topic:t,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(t,i)=>{const{id:n}=i,s=Je("session_ping",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{Gr(i)?this.events.emit(Je("session_ping",n),{}):wr(i)&&this.events.emit(Je("session_ping",n),{error:i.error})},500)},this.onSessionDeleteRequest=async(t,i)=>{const{id:n}=i;try{this.isValidDisconnect({topic:t,reason:i.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(Wt.publish,async()=>{s(await this.deleteSession({topic:t,id:n}))})}),this.sendResult({id:n,topic:t,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:t,error:ct("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async t=>{var i,n,s;const{topic:o,payload:f,attestation:u,encryptedId:h,transportType:p}=t,{id:y,params:M}=f;try{await this.isValidRequest(gt({topic:o},M));const D=this.client.session.get(o),I=await this.getVerifyContext({attestationId:u,hash:si(JSON.stringify(Qi("wc_sessionRequest",M,y))),encryptedId:h,metadata:D.peer.metadata,transportType:p}),C={id:y,topic:o,params:M,verifyContext:I};await this.setPendingSessionRequest(C),p===ht.link_mode&&((i=D.peer.metadata.redirect)!=null&&i.universal)&&this.client.core.addLinkModeSupportedApp((n=D.peer.metadata.redirect)==null?void 0:n.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(C):(this.addSessionRequestToSessionRequestQueue(C),this.processSessionRequestQueue())}catch(D){await this.sendError({id:y,topic:o,error:D}),this.client.logger.error(D)}},this.onSessionRequestResponse=(t,i)=>{const{id:n}=i,s=Je("session_request",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Gr(i)?this.events.emit(Je("session_request",n),{result:i.result}):wr(i)&&this.events.emit(Je("session_request",n),{error:i.error})},this.onSessionEventRequest=async(t,i)=>{const{id:n,params:s}=i;try{const o=`${t}_session_event_${s.event.name}`,f=us.get(o);if(f&&this.isRequestOutOfSync(f,n)){this.client.logger.info(`Discarding out of sync request - ${n}`);return}this.isValidEmit(gt({topic:t},s)),this.client.events.emit("session_event",{id:n,topic:t,params:s}),us.set(o,n)}catch(o){await this.sendError({id:n,topic:t,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(t,i)=>{const{id:n}=i;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:t,payload:i}),Gr(i)?this.events.emit(Je("session_request",n),{result:i.result}):wr(i)&&this.events.emit(Je("session_request",n),{error:i.error})},this.onSessionAuthenticateRequest=async t=>{var i;const{topic:n,payload:s,attestation:o,encryptedId:f,transportType:u}=t;try{const{requester:h,authPayload:p,expiryTimestamp:y}=s.params,M=await this.getVerifyContext({attestationId:o,hash:si(JSON.stringify(s)),encryptedId:f,metadata:h.metadata,transportType:u}),D={requester:h,pairingTopic:n,id:s.id,authPayload:p,verifyContext:M,expiryTimestamp:y};await this.setAuthRequest(s.id,{request:D,pairingTopic:n,transportType:u}),u===ht.link_mode&&((i=h.metadata.redirect)!=null&&i.universal)&&this.client.core.addLinkModeSupportedApp(h.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:n,params:s.params,id:s.id,verifyContext:M})}catch(h){this.client.logger.error(h);const p=s.params.requester.publicKey,y=await this.client.core.crypto.generateKeyPair(),M=this.getAppLinkIfEnabled(s.params.requester.metadata,u),D={type:ni,receiverPublicKey:p,senderPublicKey:y};await this.sendError({id:s.id,topic:n,error:h,encodeOpts:D,rpcOpts:It.wc_sessionAuthenticate.autoReject,appLink:M})}},this.addSessionRequestToSessionRequestQueue=t=>{this.sessionRequestQueue.queue.push(t)},this.cleanupAfterResponse=t=>{this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Qr.idle,this.processSessionRequestQueue()},ae.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:t,error:i})=>{const n=this.client.core.history.pending;n.length>0&&n.filter(o=>o.topic===t&&o.request.method==="wc_sessionRequest").forEach(o=>{const f=o.request.id,u=Je("session_request",f);if(this.events.listenerCount(u)===0)throw new Error(`emitting ${u} without any listeners`);this.events.emit(Je("session_request",o.request.id),{error:i})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Qr.active){this.client.logger.info("session request queue is already active.");return}const t=this.sessionRequestQueue.queue[0];if(!t){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Qr.active,this.emitSessionRequest(t)}catch(i){this.client.logger.error(i)}},this.emitSessionRequest=t=>{this.client.events.emit("session_request",t)},this.onPairingCreated=t=>{if(t.methods&&this.expectedPairingMethodMap.set(t.topic,t.methods),t.active)return;const n=this.client.proposal.getAll().find(s=>s.pairingTopic===t.topic);n&&this.onSessionProposeRequest({topic:t.topic,payload:Qi("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async t=>{if(!tr(t)){const{message:u}=ne("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(u)}const{pairingTopic:i,requiredNamespaces:n,optionalNamespaces:s,sessionProperties:o,relays:f}=t;if(Yt(i)||await this.isValidPairingTopic(i),!v6(f,!0)){const{message:u}=ne("MISSING_OR_INVALID",`connect() relays: ${f}`);throw new Error(u)}!Yt(n)&&Aa(n)!==0&&this.validateNamespaces(n,"requiredNamespaces"),!Yt(s)&&Aa(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),Yt(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(t,i)=>{const n=g6(t,"connect()",i);if(n)throw new Error(n.message)},this.isValidApprove=async t=>{if(!tr(t))throw new Error(ne("MISSING_OR_INVALID",`approve() params: ${t}`).message);const{id:i,namespaces:n,relayProtocol:s,sessionProperties:o}=t;this.checkRecentlyDeleted(i),await this.isValidProposalId(i);const f=this.client.proposal.get(i),u=rf(n,"approve()");if(u)throw new Error(u.message);const h=ad(f.requiredNamespaces,n,"approve()");if(h)throw new Error(h.message);if(!mt(s,!0)){const{message:p}=ne("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(p)}Yt(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async t=>{if(!tr(t)){const{message:s}=ne("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(s)}const{id:i,reason:n}=t;if(this.checkRecentlyDeleted(i),await this.isValidProposalId(i),!m6(n)){const{message:s}=ne("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidSessionSettleRequest=t=>{if(!tr(t)){const{message:h}=ne("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(h)}const{relay:i,controller:n,namespaces:s,expiry:o}=t;if(!nd(i)){const{message:h}=ne("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(h)}const f=c6(n,"onSessionSettleRequest()");if(f)throw new Error(f.message);const u=rf(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(Ii(o)){const{message:h}=ne("EXPIRED","onSessionSettleRequest()");throw new Error(h)}},this.isValidUpdate=async t=>{if(!tr(t)){const{message:u}=ne("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(u)}const{topic:i,namespaces:n}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const s=this.client.session.get(i),o=rf(n,"update()");if(o)throw new Error(o.message);const f=ad(s.requiredNamespaces,n,"update()");if(f)throw new Error(f.message)},this.isValidExtend=async t=>{if(!tr(t)){const{message:n}=ne("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(n)}const{topic:i}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i)},this.isValidRequest=async t=>{if(!tr(t)){const{message:u}=ne("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(u)}const{topic:i,request:n,chainId:s,expiry:o}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const{namespaces:f}=this.client.session.get(i);if(!sd(f,s)){const{message:u}=ne("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!y6(n)){const{message:u}=ne("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(u)}if(!E6(f,s,n.method)){const{message:u}=ne("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(u)}if(o&&!D6(o,Af)){const{message:u}=ne("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Af.min} and ${Af.max}`);throw new Error(u)}},this.isValidRespond=async t=>{var i;if(!tr(t)){const{message:o}=ne("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(o)}const{topic:n,response:s}=t;try{await this.isValidSessionTopic(n)}catch(o){throw(i=t?.response)!=null&&i.id&&this.cleanupAfterResponse(t),o}if(!w6(s)){const{message:o}=ne("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async t=>{if(!tr(t)){const{message:n}=ne("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(n)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async t=>{if(!tr(t)){const{message:f}=ne("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(f)}const{topic:i,event:n,chainId:s}=t;await this.isValidSessionTopic(i);const{namespaces:o}=this.client.session.get(i);if(!sd(o,s)){const{message:f}=ne("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(f)}if(!_6(n)){const{message:f}=ne("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(f)}if(!x6(o,s,n.name)){const{message:f}=ne("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(f)}},this.isValidDisconnect=async t=>{if(!tr(t)){const{message:n}=ne("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(n)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidAuthenticate=t=>{const{chains:i,uri:n,domain:s,nonce:o}=t;if(!Array.isArray(i)||i.length===0)throw new Error("chains is required and must be a non-empty array");if(!mt(n,!1))throw new Error("uri is required parameter");if(!mt(s,!1))throw new Error("domain is required parameter");if(!mt(o,!1))throw new Error("nonce is required parameter");if([...new Set(i.map(h=>ma(h).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:u}=ma(i[0]);if(u!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async t=>{const{attestationId:i,hash:n,encryptedId:s,metadata:o,transportType:f}=t,u={verified:{verifyUrl:o.verifyUrl||gs,validation:"UNKNOWN",origin:o.url||""}};try{if(f===ht.link_mode){const p=this.getAppLinkIfEnabled(o,f);return u.verified.validation=p&&new URL(p).origin===new URL(o.url).origin?"VALID":"INVALID",u}const h=await this.client.core.verify.resolve({attestationId:i,hash:n,encryptedId:s,verifyUrl:o.verifyUrl});h&&(u.verified.origin=h.origin,u.verified.isScam=h.isScam,u.verified.validation=h.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(h){this.client.logger.warn(h)}return this.client.logger.debug(`Verify context: ${JSON.stringify(u)}`),u},this.validateSessionProps=(t,i)=>{Object.values(t).forEach(n=>{if(!mt(n,!1)){const{message:s}=ne("MISSING_OR_INVALID",`${i} must be in Record<string, string> format. Received: ${JSON.stringify(n)}`);throw new Error(s)}})},this.getPendingAuthRequest=t=>{const i=this.client.auth.requests.get(t);return typeof i=="object"?i:void 0},this.addToRecentlyDeleted=(t,i)=>{if(this.recentlyDeletedMap.set(t,i),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let n=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(n++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=t=>{const i=this.recentlyDeletedMap.get(t);if(i){const{message:n}=ne("MISSING_OR_INVALID",`Record was recently deleted - ${i}: ${t}`);throw new Error(n)}},this.isLinkModeEnabled=(t,i)=>{var n,s,o,f,u,h,p,y,M;return!t||i!==ht.link_mode?!1:((s=(n=this.client.metadata)==null?void 0:n.redirect)==null?void 0:s.linkMode)===!0&&((f=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:f.universal)!==void 0&&((h=(u=this.client.metadata)==null?void 0:u.redirect)==null?void 0:h.universal)!==""&&((p=t?.redirect)==null?void 0:p.universal)!==void 0&&((y=t?.redirect)==null?void 0:y.universal)!==""&&((M=t?.redirect)==null?void 0:M.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(t.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(t,i)=>{var n;return this.isLinkModeEnabled(t,i)?(n=t?.redirect)==null?void 0:n.universal:void 0},this.handleLinkModeMessage=({url:t})=>{if(!t||!t.includes("wc_ev")||!t.includes("topic"))return;const i=Cu(t,"topic")||"",n=decodeURIComponent(Cu(t,"wc_ev")||""),s=this.client.session.keys.includes(i);s&&this.client.session.update(i,{transportType:ht.link_mode}),this.client.core.dispatchEnvelope({topic:i,message:n,sessionExists:s})},this.registerLinkModeListeners=async()=>{var t;if(Wo()||Rn()&&((t=this.client.metadata.redirect)!=null&&t.linkMode)){const i=global==null?void 0:global.Linking;if(typeof i<"u"){i.addEventListener("url",this.handleLinkModeMessage,this.client.name);const n=await i.getInitialURL();n&&setTimeout(()=>{this.handleLinkModeMessage({url:n})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ne("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Wt.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:t,message:i,attestation:n,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(Ra)?this.client.auth.authKeys.get(Ra):{responseTopic:void 0,publicKey:void 0},f=await this.client.core.crypto.decode(t,i,{receiverPublicKey:o,encoding:s===ht.link_mode?ns:Ri});try{uf(f)?(this.client.core.history.set(t,f),this.onRelayEventRequest({topic:t,payload:f,attestation:n,transportType:s,encryptedId:si(i)})):Da(f)?(await this.client.core.history.resolve(f),await this.onRelayEventResponse({topic:t,payload:f,transportType:s}),this.client.core.history.delete(t,f.id)):this.onRelayEventUnknownPayload({topic:t,payload:f,transportType:s})}catch(u){this.client.logger.error(u)}}registerExpirerEvents(){this.client.core.expirer.on(Er.expired,async e=>{const{topic:t,id:i}=Nu(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,ne("EXPIRED"),!0);if(i&&this.client.auth.requests.keys.includes(i))return await this.deletePendingAuthRequest(i,ne("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}registerPairingEvents(){this.client.core.pairing.events.on(Xi.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(Xi.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!mt(e,!1)){const{message:t}=ne("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=ne("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(Ii(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=ne("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!mt(e,!1)){const{message:t}=ne("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:t}=ne("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(Ii(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=ne("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=ne("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(mt(e,!1)){const{message:t}=ne("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{const{message:t}=ne("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!b6(e)){const{message:t}=ne("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=ne("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(Ii(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=ne("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class _5 extends tn{constructor(e,t){super(e,t,i5,Ef),this.core=e,this.logger=t}}class ol extends tn{constructor(e,t){super(e,t,s5,Ef),this.core=e,this.logger=t}}class E5 extends tn{constructor(e,t){super(e,t,o5,Ef,i=>i.id),this.core=e,this.logger=t}}class x5 extends tn{constructor(e,t){super(e,t,d5,Ia,()=>Ra),this.core=e,this.logger=t}}class A5 extends tn{constructor(e,t){super(e,t,l5,Ia),this.core=e,this.logger=t}}class S5 extends tn{constructor(e,t){super(e,t,p5,Ia,i=>i.id),this.core=e,this.logger=t}}class D5{constructor(e,t){this.core=e,this.logger=t,this.authKeys=new x5(this.core,this.logger),this.pairingTopics=new A5(this.core,this.logger),this.requests=new S5(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class Sf extends Sp{constructor(e){super(e),this.protocol=tl,this.version=rl,this.name=xf.name,this.events=new Ft.exports.EventEmitter,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.removeAllListeners=i=>this.events.removeAllListeners(i),this.connect=async i=>{try{return await this.engine.connect(i)}catch(n){throw this.logger.error(n.message),n}},this.pair=async i=>{try{return await this.engine.pair(i)}catch(n){throw this.logger.error(n.message),n}},this.approve=async i=>{try{return await this.engine.approve(i)}catch(n){throw this.logger.error(n.message),n}},this.reject=async i=>{try{return await this.engine.reject(i)}catch(n){throw this.logger.error(n.message),n}},this.update=async i=>{try{return await this.engine.update(i)}catch(n){throw this.logger.error(n.message),n}},this.extend=async i=>{try{return await this.engine.extend(i)}catch(n){throw this.logger.error(n.message),n}},this.request=async i=>{try{return await this.engine.request(i)}catch(n){throw this.logger.error(n.message),n}},this.respond=async i=>{try{return await this.engine.respond(i)}catch(n){throw this.logger.error(n.message),n}},this.ping=async i=>{try{return await this.engine.ping(i)}catch(n){throw this.logger.error(n.message),n}},this.emit=async i=>{try{return await this.engine.emit(i)}catch(n){throw this.logger.error(n.message),n}},this.disconnect=async i=>{try{return await this.engine.disconnect(i)}catch(n){throw this.logger.error(n.message),n}},this.find=i=>{try{return this.engine.find(i)}catch(n){throw this.logger.error(n.message),n}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}},this.authenticate=async(i,n)=>{try{return await this.engine.authenticate(i,n)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=i=>{try{return this.engine.formatAuthMessage(i)}catch(n){throw this.logger.error(n.message),n}},this.approveSessionAuthenticate=async i=>{try{return await this.engine.approveSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}},this.rejectSessionAuthenticate=async i=>{try{return await this.engine.rejectSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||xf.name,this.metadata=e?.metadata||Du(),this.signConfig=e?.signConfig;const t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Xr(Qa({level:e?.logger||xf.logger}));this.core=e?.core||new _f(e),this.logger=jt(t,this.name),this.session=new ol(this.core,this.logger),this.proposal=new _5(this.core,this.logger),this.pendingRequest=new E5(this.core,this.logger),this.engine=new w5(this),this.auth=new D5(this.core,this.logger)}static async init(e){const t=new Sf(e);return await t.initialize(),t}get context(){return Qt(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}const M5=ol,I5=Sf;class R5 extends Ft.exports{constructor(){super()}}class fl{constructor(e){this.opts=e}}class cl{constructor(e){this.client=e}}var O5=Object.defineProperty,N5=Object.defineProperties,C5=Object.getOwnPropertyDescriptors,hl=Object.getOwnPropertySymbols,P5=Object.prototype.hasOwnProperty,T5=Object.prototype.propertyIsEnumerable,ul=(r,e,t)=>e in r?O5(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,B5=(r,e)=>{for(var t in e||(e={}))P5.call(e,t)&&ul(r,t,e[t]);if(hl)for(var t of hl(e))T5.call(e,t)&&ul(r,t,e[t]);return r},L5=(r,e)=>N5(r,C5(e));class U5 extends cl{constructor(e){super(e),this.init=async()=>{this.signClient=await I5.init({core:this.client.core,metadata:this.client.metadata,signConfig:this.client.signConfig})},this.pair=async t=>{await this.client.core.pairing.pair(t)},this.approveSession=async t=>{const{topic:i,acknowledged:n}=await this.signClient.approve(L5(B5({},t),{id:t.id,namespaces:t.namespaces,sessionProperties:t.sessionProperties,sessionConfig:t.sessionConfig}));return await n(),this.signClient.session.get(i)},this.rejectSession=async t=>await this.signClient.reject(t),this.updateSession=async t=>await this.signClient.update(t),this.extendSession=async t=>await this.signClient.extend(t),this.respondSessionRequest=async t=>await this.signClient.respond(t),this.disconnectSession=async t=>await this.signClient.disconnect(t),this.emitSessionEvent=async t=>await this.signClient.emit(t),this.getActiveSessions=()=>this.signClient.session.getAll().reduce((t,i)=>(t[i.topic]=i,t),{}),this.getPendingSessionProposals=()=>this.signClient.proposal.getAll(),this.getPendingSessionRequests=()=>this.signClient.getPendingSessionRequests(),this.approveSessionAuthenticate=async t=>await this.signClient.approveSessionAuthenticate(t),this.rejectSessionAuthenticate=async t=>await this.signClient.rejectSessionAuthenticate(t),this.formatAuthMessage=t=>this.signClient.formatAuthMessage(t),this.registerDeviceToken=t=>this.client.core.echoClient.registerDeviceToken(t),this.on=(t,i)=>(this.setEvent(t,"off"),this.setEvent(t,"on"),this.client.events.on(t,i)),this.once=(t,i)=>(this.setEvent(t,"off"),this.setEvent(t,"once"),this.client.events.once(t,i)),this.off=(t,i)=>(this.setEvent(t,"off"),this.client.events.off(t,i)),this.removeListener=(t,i)=>(this.setEvent(t,"removeListener"),this.client.events.removeListener(t,i)),this.onSessionRequest=t=>{this.client.events.emit("session_request",t)},this.onSessionProposal=t=>{this.client.events.emit("session_proposal",t)},this.onSessionDelete=t=>{this.client.events.emit("session_delete",t)},this.onProposalExpire=t=>{this.client.events.emit("proposal_expire",t)},this.onSessionRequestExpire=t=>{this.client.events.emit("session_request_expire",t)},this.onSessionRequestAuthenticate=t=>{this.client.events.emit("session_authenticate",t)},this.setEvent=(t,i)=>{switch(t){case"session_request":this.signClient.events[i]("session_request",this.onSessionRequest);break;case"session_proposal":this.signClient.events[i]("session_proposal",this.onSessionProposal);break;case"session_delete":this.signClient.events[i]("session_delete",this.onSessionDelete);break;case"proposal_expire":this.signClient.events[i]("proposal_expire",this.onProposalExpire);break;case"session_request_expire":this.signClient.events[i]("session_request_expire",this.onSessionRequestExpire);break;case"session_authenticate":this.signClient.events[i]("session_authenticate",this.onSessionRequestAuthenticate);break}},this.signClient={}}}const F5={decryptMessage:async r=>{const e={core:new _f({storageOptions:r.storageOptions,storage:r.storage})};await e.core.crypto.init();const t=e.core.crypto.decode(r.topic,r.encryptedMessage);return e.core=null,t},getMetadata:async r=>{const e={core:new _f({storageOptions:r.storageOptions,storage:r.storage}),sessionStore:null};e.sessionStore=new M5(e.core,e.core.logger),await e.sessionStore.init();const t=e.sessionStore.get(r.topic),i=t?.peer.metadata;return e.core=null,e.sessionStore=null,i}},dl=class extends fl{constructor(r){super(r),this.events=new Ft.exports,this.on=(e,t)=>this.engine.on(e,t),this.once=(e,t)=>this.engine.once(e,t),this.off=(e,t)=>this.engine.off(e,t),this.removeListener=(e,t)=>this.engine.removeListener(e,t),this.pair=async e=>{try{return await this.engine.pair(e)}catch(t){throw this.logger.error(t.message),t}},this.approveSession=async e=>{try{return await this.engine.approveSession(e)}catch(t){throw this.logger.error(t.message),t}},this.rejectSession=async e=>{try{return await this.engine.rejectSession(e)}catch(t){throw this.logger.error(t.message),t}},this.updateSession=async e=>{try{return await this.engine.updateSession(e)}catch(t){throw this.logger.error(t.message),t}},this.extendSession=async e=>{try{return await this.engine.extendSession(e)}catch(t){throw this.logger.error(t.message),t}},this.respondSessionRequest=async e=>{try{return await this.engine.respondSessionRequest(e)}catch(t){throw this.logger.error(t.message),t}},this.disconnectSession=async e=>{try{return await this.engine.disconnectSession(e)}catch(t){throw this.logger.error(t.message),t}},this.emitSessionEvent=async e=>{try{return await this.engine.emitSessionEvent(e)}catch(t){throw this.logger.error(t.message),t}},this.getActiveSessions=()=>{try{return this.engine.getActiveSessions()}catch(e){throw this.logger.error(e.message),e}},this.getPendingSessionProposals=()=>{try{return this.engine.getPendingSessionProposals()}catch(e){throw this.logger.error(e.message),e}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}},this.registerDeviceToken=e=>{try{return this.engine.registerDeviceToken(e)}catch(t){throw this.logger.error(t.message),t}},this.approveSessionAuthenticate=e=>{try{return this.engine.approveSessionAuthenticate(e)}catch(t){throw this.logger.error(t.message),t}},this.rejectSessionAuthenticate=e=>{try{return this.engine.rejectSessionAuthenticate(e)}catch(t){throw this.logger.error(t.message),t}},this.formatAuthMessage=e=>{try{return this.engine.formatAuthMessage(e)}catch(t){throw this.logger.error(t.message),t}},this.metadata=r.metadata,this.name=r.name||La,this.signConfig=r.signConfig,this.core=r.core,this.logger=this.core.logger,this.engine=new U5(this)}static async init(r){const e=new dl(r);return await e.initialize(),e}async initialize(){this.logger.trace("Initialized");try{await this.engine.init(),this.logger.info("WalletKit Initialization Success")}catch(r){throw this.logger.info("WalletKit Initialization Failure"),this.logger.error(r.message),r}}};let Df=dl;Df.notifications=F5;const q5=Df;Ut.CLIENT_CONTEXT=La,Ut.CLIENT_STORAGE_OPTIONS=Nl,Ut.CLIENT_STORAGE_PREFIX=Ol,Ut.IWalletKit=fl,Ut.IWalletKitEngine=cl,Ut.IWalletKitEvents=R5,Ut.PROTOCOL=Ff,Ut.PROTOCOL_VERSION=Rl,Ut.REQUEST_CONTEXT=Cl,Ut.WalletKit=q5,Ut.default=Df,Object.defineProperty(Ut,"__esModule",{value:!0})});
43
+ ***************************************************************************** */var Jh=function(t,e){return Jh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},Jh(t,e)};function u9(t,e){Jh(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Wh=function(){return Wh=Object.assign||function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Wh.apply(this,arguments)};function d9(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}function l9(t,e,r,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,i);else for(var h=t.length-1;h>=0;h--)(o=t[h])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s}function p9(t,e){return function(r,i){e(r,i,t)}}function b9(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function v9(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function h(w){try{p(i.next(w))}catch(M){o(M)}}function l(w){try{p(i.throw(w))}catch(M){o(M)}}function p(w){w.done?s(w.value):n(w.value).then(h,l)}p((i=i.apply(t,e||[])).next())})}function g9(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,o;return o={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function h(p){return function(w){return l([p,w])}}function l(p){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=p[0]&2?n.return:p[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,p[1])).done)return s;switch(n=0,s&&(p=[p[0]&2,s.value]),p[0]){case 0:case 1:s=p;break;case 4:return r.label++,{value:p[1],done:!1};case 5:r.label++,n=p[1],p=[0];continue;case 7:p=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(p[0]===6||p[0]===2)){r=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]<s[3])){r.label=p[1];break}if(p[0]===6&&r.label<s[1]){r.label=s[1],s=p;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(p);break}s[2]&&r.ops.pop(),r.trys.pop();continue}p=e.call(t,r)}catch(w){p=[6,w],n=0}finally{i=s=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function m9(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}function y9(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Qh(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function bp(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(h){o={error:h}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function w9(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(bp(arguments[e]));return t}function _9(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],o=0,h=s.length;o<h;o++,n++)i[n]=s[o];return i}function sf(t){return this instanceof sf?(this.v=t,this):new sf(t)}function x9(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(I){i[I]&&(n[I]=function(D){return new Promise(function(N,U){s.push([I,D,N,U])>1||h(I,D)})})}function h(I,D){try{l(i[I](D))}catch(N){M(s[0][3],N)}}function l(I){I.value instanceof sf?Promise.resolve(I.value.v).then(p,w):M(s[0][2],I)}function p(I){h("next",I)}function w(I){h("throw",I)}function M(I,D){I(D),s.shift(),s.length&&h(s[0][0],s[0][1])}}function A9(t){var e,r;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=t[n]?function(o){return(r=!r)?{value:sf(t[n](o)),done:n==="return"}:s?s(o):o}:s}}function M9(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Qh=="function"?Qh(t):t[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(s){r[s]=t[s]&&function(o){return new Promise(function(h,l){o=t[s](o),n(h,l,o.done,o.value)})}}function n(s,o,h,l){Promise.resolve(l).then(function(p){s({value:p,done:h})},o)}}function E9(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function S9(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function D9(t){return t&&t.__esModule?t:{default:t}}function I9(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function N9(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var O9=Object.freeze({__proto__:null,__extends:u9,get __assign(){return Wh},__rest:d9,__decorate:l9,__param:p9,__metadata:b9,__awaiter:v9,__generator:g9,__createBinding:m9,__exportStar:y9,__values:Qh,__read:bp,__spread:w9,__spreadArrays:_9,__await:sf,__asyncGenerator:x9,__asyncDelegator:A9,__asyncValues:M9,__makeTemplateObject:E9,__importStar:S9,__importDefault:D9,__classPrivateFieldGet:I9,__classPrivateFieldSet:N9}),R9=If(O9),bn={},vp;function C9(){if(vp)return bn;vp=1,Object.defineProperty(bn,"__esModule",{value:!0}),bn.isBrowserCryptoAvailable=bn.getSubtleCrypto=bn.getBrowerCrypto=void 0;function t(){return Bt?.crypto||Bt?.msCrypto||{}}bn.getBrowerCrypto=t;function e(){const i=t();return i.subtle||i.webkitSubtle}bn.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return bn.isBrowserCryptoAvailable=r,bn}var vn={},gp;function P9(){if(gp)return vn;gp=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.isBrowser=vn.isNode=vn.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}vn.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}vn.isNode=e;function r(){return!t()&&!e()}return vn.isBrowser=r,vn}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=R9;e.__exportStar(C9(),t),e.__exportStar(P9(),t)})(pp);function gn(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function ds(t=6){return BigInt(gn(t))}function ls(t,e,r){return{id:r||gn(),jsonrpc:"2.0",method:t,params:e}}function Xh(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Zh(t,e,r){return{id:t,jsonrpc:"2.0",error:T9(e,r)}}function T9(t,e){return typeof t>"u"?lp(up):(typeof t=="string"&&(t=Object.assign(Object.assign({},lp(Yh)),{message:t})),typeof e<"u"&&(t.data=e),o9(t.code)&&(t=h9(t.code)),t)}class B9{}class F9 extends B9{constructor(){super()}}class L9 extends F9{constructor(e){super()}}const U9="^wss?:";function $9(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function q9(t,e){const r=$9(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function mp(t){return q9(t,U9)}function z9(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function yp(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function ec(t){return yp(t)&&"method"in t}function Fo(t){return yp(t)&&(ji(t)||oi(t))}function ji(t){return"result"in t}function oi(t){return"error"in t}class k9 extends L9{constructor(e){super(e),this.events=new Or.exports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(ls(e.method,e.params||[],e.id||ds().toString()),r)}async requestStrict(e,r){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{oi(s)?n(s.error):i(s.result)});try{await this.connection.send(e,r)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Fo(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}const K9=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),H9=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",wp=t=>t.split("?")[0],_p=10,j9=K9();class G9{constructor(e){if(this.url=e,this.events=new Or.exports.EventEmitter,this.registering=!1,!mp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=i=>{this.onClose(i),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(es(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!mp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((i,n)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),n(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return n(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,i)=>{const n=new URLSearchParams(e).get("origin"),s=pp.isReactNative()?{headers:{origin:n}}:{rejectUnauthorized:!z9(e)},o=new j9(e,[],s);H9()?o.onerror=h=>{const l=h;i(this.emitError(l.error))}:o.on("error",h=>{i(this.emitError(h))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Bs(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const i=this.parseError(r),n=i.message||i.toString(),s=Zh(e,n);this.events.emit("payload",s)}parseError(e,r=this.url){return c9(e,wp(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>_p&&this.events.setMaxListeners(_p)}emitError(e){const r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${wp(this.url)}`));return this.events.emit("register_error",r),r}}var tc={exports:{}};(function(t,e){var r=200,i="__lodash_hash_undefined__",n=1,s=2,o=9007199254740991,h="[object Arguments]",l="[object Array]",p="[object AsyncFunction]",w="[object Boolean]",M="[object Date]",I="[object Error]",D="[object Function]",N="[object GeneratorFunction]",U="[object Map]",z="[object Number]",H="[object Null]",L="[object Object]",K="[object Promise]",F="[object Proxy]",$="[object RegExp]",q="[object Set]",y="[object String]",R="[object Symbol]",V="[object Undefined]",Q="[object WeakMap]",O="[object ArrayBuffer]",d="[object DataView]",u="[object Float32Array]",a="[object Float64Array]",f="[object Int8Array]",b="[object Int16Array]",x="[object Int32Array]",A="[object Uint8Array]",_="[object Uint8ClampedArray]",c="[object Uint16Array]",m="[object Uint32Array]",v=/[\\^$.*+?()[\]{}|]/g,S=/^\[object .+?Constructor\]$/,G=/^(?:0|[1-9]\d*)$/,E={};E[u]=E[a]=E[f]=E[b]=E[x]=E[A]=E[_]=E[c]=E[m]=!0,E[h]=E[l]=E[O]=E[w]=E[d]=E[M]=E[I]=E[D]=E[U]=E[z]=E[L]=E[$]=E[q]=E[y]=E[Q]=!1;var k=typeof Bt=="object"&&Bt&&Bt.Object===Object&&Bt,C=typeof self=="object"&&self&&self.Object===Object&&self,B=k||C||Function("return this")(),P=e&&!e.nodeType&&e,g=P&&!0&&t&&!t.nodeType&&t,T=g&&g.exports===P,j=T&&k.process,J=function(){try{return j&&j.binding&&j.binding("util")}catch{}}(),W=J&&J.isTypedArray;function X(Y,Z){for(var Se=-1,Ye=Y==null?0:Y.length,Et=0,nt=[];++Se<Ye;){var Ct=Y[Se];Z(Ct,Se,Y)&&(nt[Et++]=Ct)}return nt}function ve(Y,Z){for(var Se=-1,Ye=Z.length,Et=Y.length;++Se<Ye;)Y[Et+Se]=Z[Se];return Y}function _e(Y,Z){for(var Se=-1,Ye=Y==null?0:Y.length;++Se<Ye;)if(Z(Y[Se],Se,Y))return!0;return!1}function ae(Y,Z){for(var Se=-1,Ye=Array(Y);++Se<Y;)Ye[Se]=Z(Se);return Ye}function De(Y){return function(Z){return Y(Z)}}function me(Y,Z){return Y.has(Z)}function ie(Y,Z){return Y?.[Z]}function de(Y){var Z=-1,Se=Array(Y.size);return Y.forEach(function(Ye,Et){Se[++Z]=[Et,Ye]}),Se}function he(Y,Z){return function(Se){return Y(Z(Se))}}function te(Y){var Z=-1,Se=Array(Y.size);return Y.forEach(function(Ye){Se[++Z]=Ye}),Se}var fe=Array.prototype,se=Function.prototype,ee=Object.prototype,le=B["__core-js_shared__"],ge=se.toString,re=ee.hasOwnProperty,ye=function(){var Y=/[^.]+$/.exec(le&&le.keys&&le.keys.IE_PROTO||"");return Y?"Symbol(src)_1."+Y:""}(),we=ee.toString,ne=RegExp("^"+ge.call(re).replace(v,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xe=T?B.Buffer:void 0,Ae=B.Symbol,Me=B.Uint8Array,Ke=ee.propertyIsEnumerable,He=fe.splice,Ee=Ae?Ae.toStringTag:void 0,je=Object.getOwnPropertySymbols,Ve=xe?xe.isBuffer:void 0,Ie=he(Object.keys,Object),Re=Ea(B,"DataView"),Oe=Ea(B,"Map"),ce=Ea(B,"Promise"),Ce=Ea(B,"Set"),Pe=Ea(B,"WeakMap"),oe=Ea(Object,"create"),Fe=Is(Re),Le=Is(Oe),pe=Is(ce),Ue=Is(Ce),$e=Is(Pe),ue=Ae?Ae.prototype:void 0,Te=ue?ue.valueOf:void 0;function Ne(Y){var Z=-1,Se=Y==null?0:Y.length;for(this.clear();++Z<Se;){var Ye=Y[Z];this.set(Ye[0],Ye[1])}}function be(){this.__data__=oe?oe(null):{},this.size=0}function qe(Y){var Z=this.has(Y)&&delete this.__data__[Y];return this.size-=Z?1:0,Z}function We(Y){var Z=this.__data__;if(oe){var Se=Z[Y];return Se===i?void 0:Se}return re.call(Z,Y)?Z[Y]:void 0}function Be(Y){var Z=this.__data__;return oe?Z[Y]!==void 0:re.call(Z,Y)}function Qe(Y,Z){var Se=this.__data__;return this.size+=this.has(Y)?0:1,Se[Y]=oe&&Z===void 0?i:Z,this}Ne.prototype.clear=be,Ne.prototype.delete=qe,Ne.prototype.get=We,Ne.prototype.has=Be,Ne.prototype.set=Qe;function Ge(Y){var Z=-1,Se=Y==null?0:Y.length;for(this.clear();++Z<Se;){var Ye=Y[Z];this.set(Ye[0],Ye[1])}}function Je(){this.__data__=[],this.size=0}function lt(Y){var Z=this.__data__,Se=w0(Z,Y);if(Se<0)return!1;var Ye=Z.length-1;return Se==Ye?Z.pop():He.call(Z,Se,1),--this.size,!0}function pt(Y){var Z=this.__data__,Se=w0(Z,Y);return Se<0?void 0:Z[Se][1]}function bt(Y){return w0(this.__data__,Y)>-1}function vt(Y,Z){var Se=this.__data__,Ye=w0(Se,Y);return Ye<0?(++this.size,Se.push([Y,Z])):Se[Ye][1]=Z,this}Ge.prototype.clear=Je,Ge.prototype.delete=lt,Ge.prototype.get=pt,Ge.prototype.has=bt,Ge.prototype.set=vt;function ct(Y){var Z=-1,Se=Y==null?0:Y.length;for(this.clear();++Z<Se;){var Ye=Y[Z];this.set(Ye[0],Ye[1])}}function ar(){this.size=0,this.__data__={hash:new Ne,map:new(Oe||Ge),string:new Ne}}function fr(Y){var Z=_0(this,Y).delete(Y);return this.size-=Z?1:0,Z}function or(Y){return _0(this,Y).get(Y)}function hr(Y){return _0(this,Y).has(Y)}function cr(Y,Z){var Se=_0(this,Y),Ye=Se.size;return Se.set(Y,Z),this.size+=Se.size==Ye?0:1,this}ct.prototype.clear=ar,ct.prototype.delete=fr,ct.prototype.get=or,ct.prototype.has=hr,ct.prototype.set=cr;function Ft(Y){var Z=-1,Se=Y==null?0:Y.length;for(this.__data__=new ct;++Z<Se;)this.add(Y[Z])}function ur(Y){return this.__data__.set(Y,i),this}function dr(Y){return this.__data__.has(Y)}Ft.prototype.add=Ft.prototype.push=ur,Ft.prototype.has=dr;function St(Y){var Z=this.__data__=new Ge(Y);this.size=Z.size}function lr(){this.__data__=new Ge,this.size=0}function pr(Y){var Z=this.__data__,Se=Z.delete(Y);return this.size=Z.size,Se}function br(Y){return this.__data__.get(Y)}function En(Y){return this.__data__.has(Y)}function Sn(Y,Z){var Se=this.__data__;if(Se instanceof Ge){var Ye=Se.__data__;if(!Oe||Ye.length<r-1)return Ye.push([Y,Z]),this.size=++Se.size,this;Se=this.__data__=new ct(Ye)}return Se.set(Y,Z),this.size=Se.size,this}St.prototype.clear=lr,St.prototype.delete=pr,St.prototype.get=br,St.prototype.has=En,St.prototype.set=Sn;function UO(Y,Z){var Se=x0(Y),Ye=!Se&&ZO(Y),Et=!Se&&!Ye&&uu(Y),nt=!Se&&!Ye&&!Et&&F2(Y),Ct=Se||Ye||Et||nt,Wt=Ct?ae(Y.length,String):[],vr=Wt.length;for(var Dt in Y)(Z||re.call(Y,Dt))&&!(Ct&&(Dt=="length"||Et&&(Dt=="offset"||Dt=="parent")||nt&&(Dt=="buffer"||Dt=="byteLength"||Dt=="byteOffset")||YO(Dt,vr)))&&Wt.push(Dt);return Wt}function w0(Y,Z){for(var Se=Y.length;Se--;)if(C2(Y[Se][0],Z))return Se;return-1}function $O(Y,Z,Se){var Ye=Z(Y);return x0(Y)?Ye:ve(Ye,Se(Y))}function Sf(Y){return Y==null?Y===void 0?V:H:Ee&&Ee in Object(Y)?GO(Y):XO(Y)}function I2(Y){return Df(Y)&&Sf(Y)==h}function N2(Y,Z,Se,Ye,Et){return Y===Z?!0:Y==null||Z==null||!Df(Y)&&!Df(Z)?Y!==Y&&Z!==Z:qO(Y,Z,Se,Ye,N2,Et)}function qO(Y,Z,Se,Ye,Et,nt){var Ct=x0(Y),Wt=x0(Z),vr=Ct?l:Yn(Y),Dt=Wt?l:Yn(Z);vr=vr==h?L:vr,Dt=Dt==h?L:Dt;var Zr=vr==L,Ri=Dt==L,Ar=vr==Dt;if(Ar&&uu(Y)){if(!uu(Z))return!1;Ct=!0,Zr=!1}if(Ar&&!Zr)return nt||(nt=new St),Ct||F2(Y)?O2(Y,Z,Se,Ye,Et,nt):HO(Y,Z,vr,Se,Ye,Et,nt);if(!(Se&n)){var gi=Zr&&re.call(Y,"__wrapped__"),mi=Ri&&re.call(Z,"__wrapped__");if(gi||mi){var Jn=gi?Y.value():Y,Dn=mi?Z.value():Z;return nt||(nt=new St),Et(Jn,Dn,Se,Ye,nt)}}return Ar?(nt||(nt=new St),jO(Y,Z,Se,Ye,Et,nt)):!1}function zO(Y){if(!B2(Y)||WO(Y))return!1;var Z=P2(Y)?ne:S;return Z.test(Is(Y))}function kO(Y){return Df(Y)&&T2(Y.length)&&!!E[Sf(Y)]}function KO(Y){if(!QO(Y))return Ie(Y);var Z=[];for(var Se in Object(Y))re.call(Y,Se)&&Se!="constructor"&&Z.push(Se);return Z}function O2(Y,Z,Se,Ye,Et,nt){var Ct=Se&n,Wt=Y.length,vr=Z.length;if(Wt!=vr&&!(Ct&&vr>Wt))return!1;var Dt=nt.get(Y);if(Dt&&nt.get(Z))return Dt==Z;var Zr=-1,Ri=!0,Ar=Se&s?new Ft:void 0;for(nt.set(Y,Z),nt.set(Z,Y);++Zr<Wt;){var gi=Y[Zr],mi=Z[Zr];if(Ye)var Jn=Ct?Ye(mi,gi,Zr,Z,Y,nt):Ye(gi,mi,Zr,Y,Z,nt);if(Jn!==void 0){if(Jn)continue;Ri=!1;break}if(Ar){if(!_e(Z,function(Dn,Ns){if(!me(Ar,Ns)&&(gi===Dn||Et(gi,Dn,Se,Ye,nt)))return Ar.push(Ns)})){Ri=!1;break}}else if(!(gi===mi||Et(gi,mi,Se,Ye,nt))){Ri=!1;break}}return nt.delete(Y),nt.delete(Z),Ri}function HO(Y,Z,Se,Ye,Et,nt,Ct){switch(Se){case d:if(Y.byteLength!=Z.byteLength||Y.byteOffset!=Z.byteOffset)return!1;Y=Y.buffer,Z=Z.buffer;case O:return!(Y.byteLength!=Z.byteLength||!nt(new Me(Y),new Me(Z)));case w:case M:case z:return C2(+Y,+Z);case I:return Y.name==Z.name&&Y.message==Z.message;case $:case y:return Y==Z+"";case U:var Wt=de;case q:var vr=Ye&n;if(Wt||(Wt=te),Y.size!=Z.size&&!vr)return!1;var Dt=Ct.get(Y);if(Dt)return Dt==Z;Ye|=s,Ct.set(Y,Z);var Zr=O2(Wt(Y),Wt(Z),Ye,Et,nt,Ct);return Ct.delete(Y),Zr;case R:if(Te)return Te.call(Y)==Te.call(Z)}return!1}function jO(Y,Z,Se,Ye,Et,nt){var Ct=Se&n,Wt=R2(Y),vr=Wt.length,Dt=R2(Z),Zr=Dt.length;if(vr!=Zr&&!Ct)return!1;for(var Ri=vr;Ri--;){var Ar=Wt[Ri];if(!(Ct?Ar in Z:re.call(Z,Ar)))return!1}var gi=nt.get(Y);if(gi&&nt.get(Z))return gi==Z;var mi=!0;nt.set(Y,Z),nt.set(Z,Y);for(var Jn=Ct;++Ri<vr;){Ar=Wt[Ri];var Dn=Y[Ar],Ns=Z[Ar];if(Ye)var L2=Ct?Ye(Ns,Dn,Ar,Z,Y,nt):Ye(Dn,Ns,Ar,Y,Z,nt);if(!(L2===void 0?Dn===Ns||Et(Dn,Ns,Se,Ye,nt):L2)){mi=!1;break}Jn||(Jn=Ar=="constructor")}if(mi&&!Jn){var A0=Y.constructor,M0=Z.constructor;A0!=M0&&"constructor"in Y&&"constructor"in Z&&!(typeof A0=="function"&&A0 instanceof A0&&typeof M0=="function"&&M0 instanceof M0)&&(mi=!1)}return nt.delete(Y),nt.delete(Z),mi}function R2(Y){return $O(Y,rR,VO)}function _0(Y,Z){var Se=Y.__data__;return JO(Z)?Se[typeof Z=="string"?"string":"hash"]:Se.map}function Ea(Y,Z){var Se=ie(Y,Z);return zO(Se)?Se:void 0}function GO(Y){var Z=re.call(Y,Ee),Se=Y[Ee];try{Y[Ee]=void 0;var Ye=!0}catch{}var Et=we.call(Y);return Ye&&(Z?Y[Ee]=Se:delete Y[Ee]),Et}var VO=je?function(Y){return Y==null?[]:(Y=Object(Y),X(je(Y),function(Z){return Ke.call(Y,Z)}))}:iR,Yn=Sf;(Re&&Yn(new Re(new ArrayBuffer(1)))!=d||Oe&&Yn(new Oe)!=U||ce&&Yn(ce.resolve())!=K||Ce&&Yn(new Ce)!=q||Pe&&Yn(new Pe)!=Q)&&(Yn=function(Y){var Z=Sf(Y),Se=Z==L?Y.constructor:void 0,Ye=Se?Is(Se):"";if(Ye)switch(Ye){case Fe:return d;case Le:return U;case pe:return K;case Ue:return q;case $e:return Q}return Z});function YO(Y,Z){return Z=Z??o,!!Z&&(typeof Y=="number"||G.test(Y))&&Y>-1&&Y%1==0&&Y<Z}function JO(Y){var Z=typeof Y;return Z=="string"||Z=="number"||Z=="symbol"||Z=="boolean"?Y!=="__proto__":Y===null}function WO(Y){return!!ye&&ye in Y}function QO(Y){var Z=Y&&Y.constructor,Se=typeof Z=="function"&&Z.prototype||ee;return Y===Se}function XO(Y){return we.call(Y)}function Is(Y){if(Y!=null){try{return ge.call(Y)}catch{}try{return Y+""}catch{}}return""}function C2(Y,Z){return Y===Z||Y!==Y&&Z!==Z}var ZO=I2(function(){return arguments}())?I2:function(Y){return Df(Y)&&re.call(Y,"callee")&&!Ke.call(Y,"callee")},x0=Array.isArray;function eR(Y){return Y!=null&&T2(Y.length)&&!P2(Y)}var uu=Ve||nR;function tR(Y,Z){return N2(Y,Z)}function P2(Y){if(!B2(Y))return!1;var Z=Sf(Y);return Z==D||Z==N||Z==p||Z==F}function T2(Y){return typeof Y=="number"&&Y>-1&&Y%1==0&&Y<=o}function B2(Y){var Z=typeof Y;return Y!=null&&(Z=="object"||Z=="function")}function Df(Y){return Y!=null&&typeof Y=="object"}var F2=W?De(W):kO;function rR(Y){return eR(Y)?UO(Y):KO(Y)}function iR(){return[]}function nR(){return!1}t.exports=tR})(tc,tc.exports);var V9=tc.exports,Y9=Object.defineProperty,xp=Object.getOwnPropertySymbols,J9=Object.prototype.hasOwnProperty,W9=Object.prototype.propertyIsEnumerable,Ap=(t,e,r)=>e in t?Y9(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ir=(t,e)=>{for(var r in e||(e={}))J9.call(e,r)&&Ap(t,r,e[r]);if(xp)for(var r of xp(e))W9.call(e,r)&&Ap(t,r,e[r]);return t};const Mp="wc",Ep=2,Lo="core",Gi=`${Mp}@2:${Lo}:`,Q9={name:Lo,logger:"error"},X9={database:":memory:"},Z9="crypto",Sp="client_ed25519_seed",e_=ze.ONE_DAY,t_="keychain",r_="0.3",i_="messages",n_="0.3",Dp=ze.SIX_HOURS,s_="publisher",Ip="irn",a_="error",Np="wss://relay.walletconnect.org",f_="relayer",Ht={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},o_="_subscription",Ai={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},h_=.1,rc="2.17.2-canary-rcnt-3",_t={link_mode:"link_mode",relay:"relay"},c_="0.3",u_="WALLETCONNECT_CLIENT_ID",Op="WALLETCONNECT_LINK_MODE_APPS",Yr={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},d_="subscription",l_="0.3",p_=ze.FIVE_SECONDS*1e3,b_="pairing",v_="0.3",af={wc_pairingDelete:{req:{ttl:ze.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:ze.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:ze.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:ze.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:ze.ONE_DAY,prompt:!1,tag:0},res:{ttl:ze.ONE_DAY,prompt:!1,tag:0}}},ps={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Mi={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},g_="history",m_="0.3",y_="expirer",hi={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},w_="0.3",__="verify-api",x_="https://verify.walletconnect.com",Rp="https://verify.walletconnect.org",ff=Rp,A_=`${ff}/v3`,M_=[x_,Rp],E_="echo",S_="https://echo.walletconnect.com",Vi={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},mn={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},Ei={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},bs={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},vs={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},of={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},D_=.1,I_="event-client",N_=86400,O_="https://pulse.walletconnect.org/batch";function R_(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<t.length;n++){var s=t.charAt(n),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=n}var h=t.length,l=t.charAt(0),p=Math.log(h)/Math.log(256),w=Math.log(256)/Math.log(h);function M(N){if(N instanceof Uint8Array||(ArrayBuffer.isView(N)?N=new Uint8Array(N.buffer,N.byteOffset,N.byteLength):Array.isArray(N)&&(N=Uint8Array.from(N))),!(N instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(N.length===0)return"";for(var U=0,z=0,H=0,L=N.length;H!==L&&N[H]===0;)H++,U++;for(var K=(L-H)*w+1>>>0,F=new Uint8Array(K);H!==L;){for(var $=N[H],q=0,y=K-1;($!==0||q<z)&&y!==-1;y--,q++)$+=256*F[y]>>>0,F[y]=$%h>>>0,$=$/h>>>0;if($!==0)throw new Error("Non-zero carry");z=q,H++}for(var R=K-z;R!==K&&F[R]===0;)R++;for(var V=l.repeat(U);R<K;++R)V+=t.charAt(F[R]);return V}function I(N){if(typeof N!="string")throw new TypeError("Expected String");if(N.length===0)return new Uint8Array;var U=0;if(N[U]!==" "){for(var z=0,H=0;N[U]===l;)z++,U++;for(var L=(N.length-U)*p+1>>>0,K=new Uint8Array(L);N[U];){var F=r[N.charCodeAt(U)];if(F===255)return;for(var $=0,q=L-1;(F!==0||$<H)&&q!==-1;q--,$++)F+=h*K[q]>>>0,K[q]=F%256>>>0,F=F/256>>>0;if(F!==0)throw new Error("Non-zero carry");H=$,U++}if(N[U]!==" "){for(var y=L-H;y!==L&&K[y]===0;)y++;for(var R=new Uint8Array(z+(L-y)),V=z;y!==L;)R[V++]=K[y++];return R}}}function D(N){var U=I(N);if(U)return U;throw new Error(`Non-${e} character`)}return{encode:M,decodeUnsafe:I,decode:D}}var C_=R_,P_=C_;const Cp=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")},T_=t=>new TextEncoder().encode(t),B_=t=>new TextDecoder().decode(t);class F_{constructor(e,r,i){this.name=e,this.prefix=r,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class L_{constructor(e,r,i){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=i}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 Pp(this,e)}}class U_{constructor(e){this.decoders=e}or(e){return Pp(this,e)}decode(e){const r=e[0],i=this.decoders[r];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Pp=(t,e)=>new U_(Ir(Ir({},t.decoders||{[t.prefix]:t}),e.decoders||{[e.prefix]:e}));class $_{constructor(e,r,i,n){this.name=e,this.prefix=r,this.baseEncode=i,this.baseDecode=n,this.encoder=new F_(e,r,i),this.decoder=new L_(e,r,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Uo=({name:t,prefix:e,encode:r,decode:i})=>new $_(t,e,r,i),hf=({prefix:t,name:e,alphabet:r})=>{const{encode:i,decode:n}=P_(r,e);return Uo({prefix:t,name:e,encode:i,decode:s=>Cp(n(s))})},q_=(t,e,r,i)=>{const n={};for(let w=0;w<e.length;++w)n[e[w]]=w;let s=t.length;for(;t[s-1]==="=";)--s;const o=new Uint8Array(s*r/8|0);let h=0,l=0,p=0;for(let w=0;w<s;++w){const M=n[t[w]];if(M===void 0)throw new SyntaxError(`Non-${i} character`);l=l<<r|M,h+=r,h>=8&&(h-=8,o[p++]=255&l>>h)}if(h>=r||255&l<<8-h)throw new SyntaxError("Unexpected end of data");return o},z_=(t,e,r)=>{const i=e[e.length-1]==="=",n=(1<<r)-1;let s="",o=0,h=0;for(let l=0;l<t.length;++l)for(h=h<<8|t[l],o+=8;o>r;)o-=r,s+=e[n&h>>o];if(o&&(s+=e[n&h<<r-o]),i)for(;s.length*r&7;)s+="=";return s},tr=({name:t,prefix:e,bitsPerChar:r,alphabet:i})=>Uo({prefix:e,name:t,encode(n){return z_(n,i,r)},decode(n){return q_(n,i,r,t)}}),k_=Uo({prefix:"\0",name:"identity",encode:t=>B_(t),decode:t=>T_(t)});var K_=Object.freeze({__proto__:null,identity:k_});const H_=tr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var j_=Object.freeze({__proto__:null,base2:H_});const G_=tr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var V_=Object.freeze({__proto__:null,base8:G_});const Y_=hf({prefix:"9",name:"base10",alphabet:"0123456789"});var J_=Object.freeze({__proto__:null,base10:Y_});const W_=tr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Q_=tr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var X_=Object.freeze({__proto__:null,base16:W_,base16upper:Q_});const Z_=tr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ex=tr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),tx=tr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),rx=tr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ix=tr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),nx=tr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),sx=tr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ax=tr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),fx=tr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ox=Object.freeze({__proto__:null,base32:Z_,base32upper:ex,base32pad:tx,base32padupper:rx,base32hex:ix,base32hexupper:nx,base32hexpad:sx,base32hexpadupper:ax,base32z:fx});const hx=hf({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),cx=hf({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var ux=Object.freeze({__proto__:null,base36:hx,base36upper:cx});const dx=hf({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),lx=hf({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var px=Object.freeze({__proto__:null,base58btc:dx,base58flickr:lx});const bx=tr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),vx=tr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),gx=tr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),mx=tr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var yx=Object.freeze({__proto__:null,base64:bx,base64pad:vx,base64url:gx,base64urlpad:mx});const Tp=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}"),wx=Tp.reduce((t,e,r)=>(t[r]=e,t),[]),_x=Tp.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function xx(t){return t.reduce((e,r)=>(e+=wx[r],e),"")}function Ax(t){const e=[];for(const r of t){const i=_x[r.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(i)}return new Uint8Array(e)}const Mx=Uo({prefix:"\u{1F680}",name:"base256emoji",encode:xx,decode:Ax});var Ex=Object.freeze({__proto__:null,base256emoji:Mx}),Sx=Fp,Bp=128,Dx=127,Ix=~Dx,Nx=Math.pow(2,31);function Fp(t,e,r){e=e||[],r=r||0;for(var i=r;t>=Nx;)e[r++]=t&255|Bp,t/=128;for(;t&Ix;)e[r++]=t&255|Bp,t>>>=7;return e[r]=t|0,Fp.bytes=r-i+1,e}var Ox=ic,Rx=128,Lp=127;function ic(t,i){var r=0,i=i||0,n=0,s=i,o,h=t.length;do{if(s>=h)throw ic.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=n<28?(o&Lp)<<n:(o&Lp)*Math.pow(2,n),n+=7}while(o>=Rx);return ic.bytes=s-i,r}var Cx=Math.pow(2,7),Px=Math.pow(2,14),Tx=Math.pow(2,21),Bx=Math.pow(2,28),Fx=Math.pow(2,35),Lx=Math.pow(2,42),Ux=Math.pow(2,49),$x=Math.pow(2,56),qx=Math.pow(2,63),zx=function(t){return t<Cx?1:t<Px?2:t<Tx?3:t<Bx?4:t<Fx?5:t<Lx?6:t<Ux?7:t<$x?8:t<qx?9:10},kx={encode:Sx,decode:Ox,encodingLength:zx},Up=kx;const $p=(t,e,r=0)=>(Up.encode(t,e,r),e),qp=t=>Up.encodingLength(t),nc=(t,e)=>{const r=e.byteLength,i=qp(t),n=i+qp(r),s=new Uint8Array(n+r);return $p(t,s,0),$p(r,s,i),s.set(e,n),new Kx(t,r,e,s)};class Kx{constructor(e,r,i,n){this.code=e,this.size=r,this.digest=i,this.bytes=n}}const zp=({name:t,code:e,encode:r})=>new Hx(t,e,r);class Hx{constructor(e,r,i){this.name=e,this.code=r,this.encode=i}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?nc(this.code,r):r.then(i=>nc(this.code,i))}else throw Error("Unknown type, must be binary type")}}const kp=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),jx=zp({name:"sha2-256",code:18,encode:kp("SHA-256")}),Gx=zp({name:"sha2-512",code:19,encode:kp("SHA-512")});var Vx=Object.freeze({__proto__:null,sha256:jx,sha512:Gx});const Kp=0,Yx="identity",Hp=Cp;var Jx=Object.freeze({__proto__:null,identity:{code:Kp,name:Yx,encode:Hp,digest:t=>nc(Kp,Hp(t))}});new TextEncoder,new TextDecoder;const jp=Ir(Ir(Ir(Ir(Ir(Ir(Ir(Ir(Ir(Ir({},K_),j_),V_),J_),X_),ox),ux),px),yx),Ex);Ir(Ir({},Vx),Jx);function Wx(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Gp(t,e,r,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:i}}}const Vp=Gp("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),sc=Gp("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);const e=Wx(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Qx=Ir({utf8:Vp,"utf-8":Vp,hex:jp.base16,latin1:sc,ascii:sc,binary:sc},jp);function Xx(t,e="utf8"){const r=Qx[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}class Zx{constructor(e,r){this.core=e,this.logger=r,this.keychain=new Map,this.name=t_,this.version=r_,this.initialized=!1,this.storagePrefix=Gi,this.init=async()=>{if(!this.initialized){const i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,n)=>{this.isInitialized(),this.keychain.set(i,n),await this.persist()},this.get=i=>{this.isInitialized();const n=this.keychain.get(i);if(typeof n>"u"){const{message:s}=ke("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(s)}return n},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=e,this.logger=Cr(r,this.name)}get context(){return qr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,I1(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?N1(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ke("NOT_INITIALIZED",this.name);throw new Error(e)}}}class eA{constructor(e,r,i){this.core=e,this.logger=r,this.name=Z9,this.randomSessionIdentifier=Kh(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=n=>(this.isInitialized(),this.keychain.has(n)),this.getClientId=async()=>{this.isInitialized();const n=await this.getClientSeed(),s=Ld(n);return Fd(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const n=Xw();return this.setPrivateKey(n.publicKey,n.privateKey)},this.signJWT=async n=>{this.isInitialized();const s=await this.getClientSeed(),o=Ld(s),h=this.randomSessionIdentifier;return await t8(h,n,e_,o)},this.generateSharedKey=(n,s,o)=>{this.isInitialized();const h=this.getPrivateKey(n),l=Zw(h,s);return this.setSymKey(l,o)},this.setSymKey=async(n,s)=>{this.isInitialized();const o=s||Oo(n);return await this.keychain.set(o,n),o},this.deleteKeyPair=async n=>{this.isInitialized(),await this.keychain.del(n)},this.deleteSymKey=async n=>{this.isInitialized(),await this.keychain.del(n)},this.encode=async(n,s,o)=>{this.isInitialized();const h=V1(o),l=es(s);if(J1(h))return t7(l,o?.encoding);if(Y1(h)){const I=h.senderPublicKey,D=h.receiverPublicKey;n=await this.generateSharedKey(I,D)}const p=this.getSymKey(n),{type:w,senderPublicKey:M}=h;return e7({type:w,symKey:p,message:l,senderPublicKey:M,encoding:o?.encoding})},this.decode=async(n,s,o)=>{this.isInitialized();const h=n7(s,o);if(J1(h)){const l=i7(s,o?.encoding);return Bs(l)}if(Y1(h)){const l=h.receiverPublicKey,p=h.senderPublicKey;n=await this.generateSharedKey(l,p)}try{const l=this.getSymKey(n),p=r7({symKey:l,encoded:s,encoding:o?.encoding});return Bs(p)}catch(l){this.logger.error(`Failed to decode message from topic: '${n}', clientId: '${await this.getClientId()}'`),this.logger.error(l)}},this.getPayloadType=(n,s=$n)=>{const o=ef({encoded:n,encoding:s});return us(o.type)},this.getPayloadSenderPublicKey=(n,s=$n)=>{const o=ef({encoded:n,encoding:s});return o.senderPublicKey?r9(o.senderPublicKey,Sr):void 0},this.core=e,this.logger=Cr(r,this.name),this.keychain=i||new Zx(this.core,this.logger)}get context(){return qr(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(Sp)}catch{e=Kh(),await this.keychain.set(Sp,e)}return Xx(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ke("NOT_INITIALIZED",this.name);throw new Error(e)}}}class tA extends L6{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=i_,this.version=n_,this.initialized=!1,this.storagePrefix=Gi,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,n)=>{this.isInitialized();const s=pn(n);let o=this.messages.get(i);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=n,this.messages.set(i,o),await this.persist()),s},this.get=i=>{this.isInitialized();let n=this.messages.get(i);return typeof n>"u"&&(n={}),n},this.has=(i,n)=>{this.isInitialized();const s=this.get(i),o=pn(n);return typeof s[o]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=Cr(e,this.name),this.core=r}get context(){return qr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,I1(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?N1(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ke("NOT_INITIALIZED",this.name);throw new Error(e)}}}var rA=Object.defineProperty,iA=Object.defineProperties,nA=Object.getOwnPropertyDescriptors,Yp=Object.getOwnPropertySymbols,sA=Object.prototype.hasOwnProperty,aA=Object.prototype.propertyIsEnumerable,Jp=(t,e,r)=>e in t?rA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Wp=(t,e)=>{for(var r in e||(e={}))sA.call(e,r)&&Jp(t,r,e[r]);if(Yp)for(var r of Yp(e))aA.call(e,r)&&Jp(t,r,e[r]);return t},Qp=(t,e)=>iA(t,nA(e));class fA extends U6{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new Or.exports.EventEmitter,this.name=s_,this.queue=new Map,this.publishTimeout=ze.toMiliseconds(ze.ONE_MINUTE),this.initialPublishTimeout=ze.toMiliseconds(ze.ONE_SECOND*15),this.needsTransportRestart=!1,this.publish=async(i,n,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}});const h=s?.ttl||Dp,l=Ro(s),p=s?.prompt||!1,w=s?.tag||0,M=s?.id||ds().toString(),I={topic:i,message:n,opts:{ttl:h,relay:l,prompt:p,tag:w,id:M,attestation:s?.attestation}},D=`Failed to publish payload, please try again. id:${M} tag:${w}`;try{const N=new Promise(async U=>{const z=({id:H})=>{I.opts.id===H&&(this.removeRequestFromQueue(H),this.relayer.events.removeListener(Ht.publish,z),U(I))};this.relayer.events.on(Ht.publish,z),await Ln(new Promise((H,L)=>{this.rpcPublish({topic:i,message:n,ttl:h,prompt:p,tag:w,id:M,attestation:s?.attestation}).catch(K=>{this.logger.warn(K,K?.message),L(K)}).then(H)}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${M} tag:${w}`).then(H=>{this.events.removeListener(Ht.publish,z),U(H)}).catch(H=>{this.queue.set(M,Qp(Wp({},I),{attempt:1})),this.logger.warn(H,H?.message)})});this.logger.trace({type:"method",method:"publish",params:{id:M,topic:i,message:n,opts:s}}),await Ln(N,this.publishTimeout,D)}catch(N){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(N),(o=s?.internal)!=null&&o.throwOnFailedPublish)throw N}finally{this.queue.delete(M)}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.relayer=e,this.logger=Cr(r,this.name),this.registerEventListeners()}get context(){return qr(this.logger)}async rpcPublish(e){var r,i,n,s;const{topic:o,message:h,ttl:l=Dp,prompt:p,tag:w,id:M,attestation:I}=e,D={method:tf(Ro().protocol).publish,params:{topic:o,message:h,ttl:l,prompt:p,tag:w,attestation:I},id:M};Dr((r=D.params)==null?void 0:r.prompt)&&((i=D.params)==null||delete i.prompt),Dr((n=D.params)==null?void 0:n.tag)&&((s=D.params)==null||delete s.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:D});const N=await this.relayer.request(D);return this.relayer.events.emit(Ht.publish,e),this.logger.debug("Successfully Published Payload"),N}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async(e,r)=>{const i=e.attempt+1;this.queue.set(r,Qp(Wp({},e),{attempt:i}));const{topic:n,message:s,opts:o,attestation:h}=e;this.logger.warn({},`Publisher: queue->publishing: ${e.opts.id}, tag: ${e.opts.tag}, attempt: ${i}`),await this.rpcPublish({topic:n,message:s,ttl:o.ttl,prompt:o.prompt,tag:o.tag,id:o.id,attestation:h}),this.logger.warn({},`Publisher: queue->published: ${e.opts.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Ts.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Ht.connection_stalled);return}this.checkQueue()}),this.relayer.on(Ht.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class oA{constructor(){this.map=new Map,this.set=(e,r)=>{const i=this.get(e);this.exists(e,r)||this.map.set(e,[...i,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const i=this.get(e);if(!this.exists(e,r))return;const n=i.filter(s=>s!==r);if(!n.length){this.map.delete(e);return}this.map.set(e,n)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var hA=Object.defineProperty,cA=Object.defineProperties,uA=Object.getOwnPropertyDescriptors,Xp=Object.getOwnPropertySymbols,dA=Object.prototype.hasOwnProperty,lA=Object.prototype.propertyIsEnumerable,Zp=(t,e,r)=>e in t?hA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,cf=(t,e)=>{for(var r in e||(e={}))dA.call(e,r)&&Zp(t,r,e[r]);if(Xp)for(var r of Xp(e))lA.call(e,r)&&Zp(t,r,e[r]);return t},ac=(t,e)=>cA(t,uA(e));class pA extends z6{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new oA,this.events=new Or.exports.EventEmitter,this.name=d_,this.version=l_,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Gi,this.subscribeTimeout=ze.toMiliseconds(ze.ONE_MINUTE),this.initialSubscribeTimeout=ze.toMiliseconds(ze.ONE_SECOND*15),this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(i,n)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}});try{const s=Ro(n),o={topic:i,relay:s,transportType:n?.transportType};this.pending.set(i,o);const h=await this.rpcSubscribe(i,s,n);return typeof h=="string"&&(this.onSubscribe(h,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}})),h}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(i,n)=>{await this.restartToComplete(),this.isInitialized(),typeof n?.id<"u"?await this.unsubscribeById(i,n.id,n):await this.unsubscribeByTopic(i,n)},this.isSubscribed=async i=>{if(this.topics.includes(i))return!0;const n=`${this.pendingSubscriptionWatchLabel}_${i}`;return await new Promise((s,o)=>{const h=new ze.Watch;h.start(n);const l=setInterval(()=>{(!this.pending.has(i)&&this.topics.includes(i)||this.cached.some(p=>p.topic===i))&&(clearInterval(l),h.stop(n),s(!0)),h.elapsed(n)>=p_&&(clearInterval(l),h.stop(n),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{await this.restore(),await this.onRestart()},this.checkPending=async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const i=[];this.pending.forEach(n=>{i.push(n)}),await this.batchSubscribe(i)},this.registerEventListeners=()=>{this.relayer.core.heartbeat.on(Ts.pulse,async()=>{await this.checkPending()}),this.events.on(Yr.created,async i=>{const n=Yr.created;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:i}),await this.persist()}),this.events.on(Yr.deleted,async i=>{const n=Yr.deleted;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:i}),await this.persist()})},this.relayer=e,this.logger=Cr(r,this.name),this.clientId=""}get context(){return qr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let i=!1;try{i=this.getSubscription(e).topic===r}catch{}return i}reset(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const i=this.topicMap.get(e);await Promise.all(i.map(async n=>await this.unsubscribeById(e,n,r)))}async unsubscribeById(e,r,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:i}});try{const n=Ro(i);await this.rpcUnsubscribe(e,r,n);const s=wt("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:i}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(e,r,i){var n;i?.transportType===_t.relay&&await this.restartToComplete();const s={method:tf(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(n=i?.internal)==null?void 0:n.throwOnFailedPublish;try{const h=this.getSubscriptionId(e);if(i?.transportType===_t.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(w=>this.logger.warn(w))},ze.toMiliseconds(ze.ONE_SECOND)),h;const l=new Promise(async w=>{const M=I=>{I.topic===e&&(this.events.removeListener(Yr.created,M),w(I.id))};this.events.on(Yr.created,M);try{const I=await Ln(new Promise((D,N)=>{this.relayer.request(s).catch(U=>{this.logger.warn(U,U?.message),N(U)}).then(D)}),this.initialSubscribeTimeout,`Subscribing to ${e} failed, please try again`);this.events.removeListener(Yr.created,M),w(I)}catch{}}),p=await Ln(l,this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!p&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return p?h:null}catch(h){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Ht.connection_stalled),o)throw h}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,i={method:tf(r.protocol).batchSubscribe,params:{topics:e.map(n=>n.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{await await Ln(new Promise(n=>{this.relayer.request(i).catch(s=>this.logger.warn(s)).then(n)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(Ht.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,i={method:tf(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});let n;try{n=await await Ln(new Promise((s,o)=>{this.relayer.request(i).catch(h=>{this.logger.warn(h),o(h)}).then(s)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(Ht.connection_stalled)}return n}rpcUnsubscribe(e,r,i){const n={method:tf(i.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.request(n)}onSubscribe(e,r){this.setSubscription(e,ac(cf({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,cf({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,i){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,i),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,cf({},r)),this.topicMap.set(r.topic,e),this.events.emit(Yr.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:i}=ke("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(Yr.deleted,ac(cf({},i),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Yr.sync)}async onRestart(){if(this.cached.length){const e=[...this.cached],r=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let i=0;i<r;i++){const n=e.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(n)}}this.events.emit(Yr.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=ke("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){e.length&&(await this.rpcBatchSubscribe(e),this.onBatchSubscribe(e.map(r=>ac(cf({},r),{id:this.getSubscriptionId(r.topic)}))))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&await new Promise(i=>{setTimeout(async()=>{await this.relayer.handleBatchMessageEvents(r.messages),i()},1e3)})}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:e}=ke("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen()}getSubscriptionId(e){return pn(e+this.clientId)}}var bA=Object.defineProperty,eb=Object.getOwnPropertySymbols,vA=Object.prototype.hasOwnProperty,gA=Object.prototype.propertyIsEnumerable,tb=(t,e,r)=>e in t?bA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,rb=(t,e)=>{for(var r in e||(e={}))vA.call(e,r)&&tb(t,r,e[r]);if(eb)for(var r of eb(e))gA.call(e,r)&&tb(t,r,e[r]);return t};class mA extends $6{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Or.exports.EventEmitter,this.name=f_,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1,this.heartBeatTimeout=ze.toMiliseconds(ze.THIRTY_SECONDS+ze.ONE_SECOND),this.requestsInFlight=[],this.connectTimeout=ze.toMiliseconds(ze.ONE_SECOND*15),this.request=async r=>{var i,n;this.logger.debug("Publishing Request Payload");const s=r.id||ds().toString();await this.toEstablishConnection();try{this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - publishing...");const o=`${s}:${((n=r.params)==null?void 0:n.tag)||""}`;this.requestsInFlight.push(o);const h=await this.provider.request(r);return this.requestsInFlight=this.requestsInFlight.filter(l=>l!==o),h}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}},this.resetPingTimeout=()=>{if(Do())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,i,n;this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(n=(i=(r=this.provider)==null?void 0:r.connection)==null?void 0:i.socket)==null||n.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r,r?.message)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.warn({},"Relayer connected \u{1F6DC}"),this.startPingTimeout(),this.events.emit(Ht.connect)},this.onDisconnectHandler=()=>{this.logger.warn({},"Relayer disconnected \u{1F6D1}"),this.requestsInFlight=[],this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.fatal(r,`Fatal socket error: ${r?.message}`),this.events.emit(Ht.error,r),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Ai.payload,this.onPayloadHandler),this.provider.on(Ai.connect,this.onConnectHandler),this.provider.on(Ai.disconnect,this.onDisconnectHandler),this.provider.on(Ai.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Cr(e.logger,this.name):an(sd({level:e.logger||a_})),this.messages=new tA(this.logger,e.core),this.subscriber=new pA(this,this.logger),this.publisher=new fA(this,this.logger),this.relayUrl=e?.relayUrl||Np,this.projectId=e.projectId,this.bundleId=bw(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e,e?.message)}}get context(){return qr(this.logger)}get connected(){var e,r,i;return((i=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:i.readyState)===1}get connecting(){var e,r,i;return((i=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:i.readyState)===0}async publish(e,r,i){this.isInitialized(),await this.publisher.publish(e,r,i),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:_t.relay})}async subscribe(e,r){var i,n,s;this.isInitialized(),(!(r!=null&&r.transportType)||r?.transportType==="relay")&&await this.toEstablishConnection();const o=typeof((i=r?.internal)==null?void 0:i.throwOnFailedPublish)>"u"?!0:(n=r?.internal)==null?void 0:n.throwOnFailedPublish;let h=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",l;const p=w=>{w.topic===e&&(this.subscriber.off(Yr.created,p),l())};return await Promise.all([new Promise(w=>{l=w,this.subscriber.on(Yr.created,p)}),new Promise(async(w,M)=>{h=await this.subscriber.subscribe(e,rb({internal:{throwOnFailedPublish:o}},r)).catch(I=>{o&&M(I)})||h,w()})]),h}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Ln(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(r,i)=>{await this.connect(e).then(r).catch(i).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(e){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await op())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(e?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((i,n)=>i.publishedAt-n.publishedAt);this.logger.debug(`Batch of ${r.length} message events sorted`);for(const i of r)try{await this.onMessageEvent(i)}catch(n){this.logger.warn(n,"Error while processing batch message event: "+n?.message)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:i}=e;if(!r.sessionExists){const n=Ut(ze.FIVE_MINUTES),s={topic:i,expiry:n,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(i,s)}this.events.emit(Ht.message,e),await this.recordMessageEvent(e)}async connect(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let r=1;for(;r<6;){try{this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${r}...`),await this.createProvider(),await new Promise(async(i,n)=>{const s=()=>{n(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Ai.disconnect,s),await Ln(new Promise((o,h)=>{this.provider.connect().then(o).catch(h)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{n(o)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),await new Promise(async(o,h)=>{const l=()=>{h(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Ai.disconnect,l),await this.subscriber.start().then(o).catch(h).finally(()=>{this.provider.off(Ai.disconnect,l)})}),this.hasExperiencedNetworkDisruption=!1,i()})}catch(i){await this.subscriber.stop();const n=i;this.logger.warn(n,n.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${r}`);break}await new Promise(i=>setTimeout(i,ze.toMiliseconds(r*1))),r++}}startPingTimeout(){var e,r,i,n,s;if(Do())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(n=(i=this.provider)==null?void 0:i.connection)==null?void 0:n.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o?.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new k9(new G9(yw({sdkVersion:rc,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:i}=e;await this.messages.set(r,i)}async shouldIgnoreMessageEvent(e){const{topic:r,message:i}=e;if(!i||i.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.warn(`Ignoring message for non-subscribed topic ${r}`),!0;const n=this.messages.has(r,i);return n&&this.logger.warn(`Ignoring duplicate message: ${i}`),n}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),ec(e)){if(!e.method.endsWith(o_))return;const r=e.params,{topic:i,message:n,publishedAt:s,attestation:o}=r.data,h={topic:i,message:n,publishedAt:s,transportType:_t.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(rb({type:"event",event:r.id},h)),this.events.emit(r.id,h),await this.acknowledgePayload(e),await this.onMessageEvent(h)}else Fo(e)&&this.events.emit(Ht.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Ht.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Xh(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Ai.payload,this.onPayloadHandler),this.provider.off(Ai.connect,this.onConnectHandler),this.provider.off(Ai.disconnect,this.onDisconnectHandler),this.provider.off(Ai.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await op();Q7(async r=>{e!==r&&(e=r,r?await this.transportOpen().catch(i=>this.logger.error(i,i?.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),clearTimeout(this.pingTimeout),this.events.emit(Ht.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||this.connectPromise||(this.reconnectTimeout=setTimeout(async()=>{clearTimeout(this.reconnectTimeout),await this.transportOpen().catch(e=>this.logger.error(e,e?.message))},ze.toMiliseconds(h_))))}isInitialized(){if(!this.initialized){const{message:e}=ke("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&await this.transportOpen()}}var yA=Object.defineProperty,ib=Object.getOwnPropertySymbols,wA=Object.prototype.hasOwnProperty,_A=Object.prototype.propertyIsEnumerable,nb=(t,e,r)=>e in t?yA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,sb=(t,e)=>{for(var r in e||(e={}))wA.call(e,r)&&nb(t,r,e[r]);if(ib)for(var r of ib(e))_A.call(e,r)&&nb(t,r,e[r]);return t};class gs extends q6{constructor(e,r,i,n=Gi,s=void 0){super(e,r,i,n),this.core=e,this.logger=r,this.name=i,this.map=new Map,this.version=c_,this.cached=[],this.initialized=!1,this.storagePrefix=Gi,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!Dr(o)?this.map.set(this.getKey(o),o):I7(o)?this.map.set(o.id,o):N7(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,h)=>{this.isInitialized(),this.map.has(o)?await this.update(o,h):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:h}),this.map.set(o,h),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(h=>Object.keys(o).every(l=>V9(h[l],o[l]))):this.values),this.update=async(o,h)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:h});const l=sb(sb({},this.getData(o)),h);this.map.set(o,l),await this.persist()},this.delete=async(o,h)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:h}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=Cr(r,this.name),this.storagePrefix=n,this.getKey=s}get context(){return qr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:n}=ke("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}const{message:i}=ke("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=ke("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ke("NOT_INITIALIZED",this.name);throw new Error(e)}}}class xA{constructor(e,r){this.core=e,this.logger=r,this.name=b_,this.version=v_,this.events=new Or.exports,this.initialized=!1,this.storagePrefix=Gi,this.ignoredPayloadTypes=[ln],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async i=>{this.isInitialized();const n=Kh(),s=await this.core.crypto.setSymKey(n),o=Ut(ze.FIVE_MINUTES),h={protocol:Ip},l={topic:s,expiry:o,relay:h,active:!1,methods:i?.methods},p=ep({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:n,relay:h,expiryTimestamp:o,methods:i?.methods});return this.events.emit(ps.create,l),this.core.expirer.set(s,o),await this.pairings.set(s,l),await this.core.relayer.subscribe(s,{transportType:i?.transportType}),{topic:s,uri:p}},this.pair=async i=>{this.isInitialized();const n=this.core.eventClient.createEvent({properties:{topic:i?.uri,trace:[Vi.pairing_started]}});this.isValidPair(i,n);const{topic:s,symKey:o,relay:h,expiryTimestamp:l,methods:p}=Z1(i.uri);n.props.properties.topic=s,n.addTrace(Vi.pairing_uri_validation_success),n.addTrace(Vi.pairing_uri_not_expired);let w;if(this.pairings.keys.includes(s)){if(w=this.pairings.get(s),n.addTrace(Vi.existing_pairing),w.active)throw n.setError(mn.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);n.addTrace(Vi.pairing_not_expired)}const M=l||Ut(ze.FIVE_MINUTES),I={topic:s,relay:h,expiry:M,active:!1,methods:p};this.core.expirer.set(s,M),await this.pairings.set(s,I),n.addTrace(Vi.store_new_pairing),i.activatePairing&&await this.activate({topic:s}),this.events.emit(ps.create,I),n.addTrace(Vi.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),n.addTrace(Vi.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{n.setError(mn.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:h})}catch(D){throw n.setError(mn.subscribe_pairing_topic_failure),D}return n.addTrace(Vi.subscribe_pairing_topic_success),I},this.activate=async({topic:i})=>{this.isInitialized();const n=Ut(ze.THIRTY_DAYS);this.core.expirer.set(i,n),await this.pairings.update(i,{active:!0,expiry:n})},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);const{topic:n}=i;if(this.pairings.keys.includes(n)){const s=await this.sendRequest(n,"wc_pairingPing",{}),{done:o,resolve:h,reject:l}=hs();this.events.once(st("pairing_ping",s),({error:p})=>{p?l(p):h()}),await o()}},this.updateExpiry=async({topic:i,expiry:n})=>{this.isInitialized(),await this.pairings.update(i,{expiry:n})},this.updateMetadata=async({topic:i,metadata:n})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:n})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:n}=i;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",wt("USER_DISCONNECTED")),await this.deletePairing(n))},this.formatUriFromPairing=i=>{this.isInitialized();const{topic:n,relay:s,expiry:o,methods:h}=i,l=this.core.crypto.keychain.get(n);return ep({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:l,relay:s,expiryTimestamp:o,methods:h})},this.sendRequest=async(i,n,s)=>{const o=ls(n,s),h=await this.core.crypto.encode(i,o),l=af[n].req;return this.core.history.set(i,o),this.core.relayer.publish(i,h,l),o.id},this.sendResult=async(i,n,s)=>{const o=Xh(i,s),h=await this.core.crypto.encode(n,o),l=await this.core.history.get(n,i),p=af[l.request.method].res;await this.core.relayer.publish(n,h,p),await this.core.history.resolve(o)},this.sendError=async(i,n,s)=>{const o=Zh(i,s),h=await this.core.crypto.encode(n,o),l=await this.core.history.get(n,i),p=af[l.request.method]?af[l.request.method].res:af.unregistered_method.res;await this.core.relayer.publish(n,h,p),await this.core.history.resolve(o)},this.deletePairing=async(i,n)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,wt("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),n?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{const i=this.pairings.getAll().filter(n=>Un(n.expiry));await Promise.all(i.map(n=>this.deletePairing(n.topic)))},this.onRelayEventRequest=i=>{const{topic:n,payload:s}=i;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(n,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(n,s);default:return this.onUnknownRpcMethodRequest(n,s)}},this.onRelayEventResponse=async i=>{const{topic:n,payload:s}=i,o=(await this.core.history.get(n,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(n,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(i,n)=>{const{id:s}=n;try{this.isValidPing({topic:i}),await this.sendResult(s,i,!0),this.events.emit(ps.ping,{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}},this.onPairingPingResponse=(i,n)=>{const{id:s}=n;setTimeout(()=>{ji(n)?this.events.emit(st("pairing_ping",s),{}):oi(n)&&this.events.emit(st("pairing_ping",s),{error:n.error})},500)},this.onPairingDeleteRequest=async(i,n)=>{const{id:s}=n;try{this.isValidDisconnect({topic:i}),await this.deletePairing(i),this.events.emit(ps.delete,{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(i,n)=>{const{id:s,method:o}=n;try{if(this.registeredMethods.includes(o))return;const h=wt("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,i,h),this.logger.error(h)}catch(h){await this.sendError(s,i,h),this.logger.error(h)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(wt("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=(i,n)=>{var s;if(!Fr(i)){const{message:h}=ke("MISSING_OR_INVALID",`pair() params: ${i}`);throw n.setError(mn.malformed_pairing_uri),new Error(h)}if(!D7(i.uri)){const{message:h}=ke("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw n.setError(mn.malformed_pairing_uri),new Error(h)}const o=Z1(i?.uri);if(!((s=o?.relay)!=null&&s.protocol)){const{message:h}=ke("MISSING_OR_INVALID","pair() uri#relay-protocol");throw n.setError(mn.malformed_pairing_uri),new Error(h)}if(!(o!=null&&o.symKey)){const{message:h}=ke("MISSING_OR_INVALID","pair() uri#symKey");throw n.setError(mn.malformed_pairing_uri),new Error(h)}if(o!=null&&o.expiryTimestamp&&ze.toMiliseconds(o?.expiryTimestamp)<Date.now()){n.setError(mn.pairing_expired);const{message:h}=ke("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(h)}},this.isValidPing=async i=>{if(!Fr(i)){const{message:s}=ke("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidDisconnect=async i=>{if(!Fr(i)){const{message:s}=ke("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidPairingTopic=async i=>{if(!Tt(i,!1)){const{message:n}=ke("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(n)}if(!this.pairings.keys.includes(i)){const{message:n}=ke("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(n)}if(Un(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:n}=ke("EXPIRED",`pairing topic: ${i}`);throw new Error(n)}},this.core=e,this.logger=Cr(r,this.name),this.pairings=new gs(this.core,this.logger,this.name,this.storagePrefix)}get context(){return qr(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ke("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Ht.message,async e=>{const{topic:r,message:i,transportType:n}=e;if(!this.pairings.keys.includes(r)||n===_t.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;const s=await this.core.crypto.decode(r,i);try{ec(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):Fo(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(hi.expired,async e=>{const{topic:r}=R1(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(ps.expire,{topic:r}))})}}class AA extends F6{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new Or.exports.EventEmitter,this.name=g_,this.version=m_,this.cached=[],this.initialized=!1,this.storagePrefix=Gi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,n,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:n,chainId:s}),this.records.has(n.id))return;const o={id:n.id,topic:i,request:{method:n.method,params:n.params||null},chainId:s,expiry:Ut(ze.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(Mi.created,o)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;const n=await this.getRecord(i.id);typeof n.response>"u"&&(n.response=oi(i)?{error:i.error}:{result:i.result},this.records.set(n.id,n),this.persist(),this.events.emit(Mi.updated,n))},this.get=async(i,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:n}),await this.getRecord(n)),this.delete=(i,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(s=>{if(s.topic===i){if(typeof n<"u"&&s.id!==n)return;this.records.delete(s.id),this.events.emit(Mi.deleted,s)}}),this.persist()},this.exists=async(i,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===i:!1),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=Cr(r,this.name)}get context(){return qr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const i={topic:r.topic,request:ls(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(i)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:i}=ke("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Mi.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=ke("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Mi.created,e=>{const r=Mi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Mi.updated,e=>{const r=Mi.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Mi.deleted,e=>{const r=Mi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(Ts.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{ze.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(Mi.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ke("NOT_INITIALIZED",this.name);throw new Error(e)}}}class MA extends k6{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new Or.exports.EventEmitter,this.name=y_,this.version=w_,this.cached=[],this.initialized=!1,this.storagePrefix=Gi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{const n=this.formatTarget(i);return typeof this.getExpiration(n)<"u"}catch{return!1}},this.set=(i,n)=>{this.isInitialized();const s=this.formatTarget(i),o={target:s,expiry:n};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(hi.created,{target:s,expiration:o})},this.get=i=>{this.isInitialized();const n=this.formatTarget(i);return this.getExpiration(n)},this.del=i=>{if(this.isInitialized(),this.has(i)){const n=this.formatTarget(i),s=this.getExpiration(n);this.expirations.delete(n),this.events.emit(hi.deleted,{target:n,expiration:s})}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=Cr(r,this.name)}get context(){return qr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return ww(e);if(typeof e=="number")return _w(e);const{message:r}=ke("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(hi.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=ke("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:i}=ke("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(i),new Error(i)}return r}checkExpiry(e,r){const{expiry:i}=r;ze.toMiliseconds(i)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(hi.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(Ts.pulse,()=>this.checkExpirations()),this.events.on(hi.created,e=>{const r=hi.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(hi.expired,e=>{const r=hi.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(hi.deleted,e=>{const r=hi.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ke("NOT_INITIALIZED",this.name);throw new Error(e)}}}class EA extends K6{constructor(e,r,i){super(e,r,i),this.core=e,this.logger=r,this.store=i,this.name=__,this.verifyUrlV3=A_,this.storagePrefix=Gi,this.version=Ep,this.init=async()=>{var n;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&ze.toMiliseconds((n=this.publicKey)==null?void 0:n.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))},this.register=async n=>{if(!Va()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:h}=n,l=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${h}`;try{const p=Ta(),w=this.startAbortTimer(ze.ONE_SECOND*5),M=await new Promise((I,D)=>{const N=()=>{window.removeEventListener("message",z),p.body.removeChild(U),D("attestation aborted")};this.abortController.signal.addEventListener("abort",N);const U=p.createElement("iframe");U.src=l,U.style.display="none",U.addEventListener("error",N,{signal:this.abortController.signal});const z=H=>{if(H.data&&typeof H.data=="string")try{const L=JSON.parse(H.data);if(L.type==="verify_attestation"){if(J0(L.attestation).payload.id!==o)return;clearInterval(w),p.body.removeChild(U),this.abortController.signal.removeEventListener("abort",N),window.removeEventListener("message",z),I(L.attestation===null?"":L.attestation)}}catch(L){this.logger.warn(L)}};p.body.appendChild(U),window.addEventListener("message",z,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",M),M}catch(p){this.logger.warn(p)}return""},this.resolve=async n=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:h}=n;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(J0(s).payload.id!==h)return;const p=await this.isValidJwtAttestation(s);if(p){if(!p.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return p}}if(!o)return;const l=this.getVerifyUrl(n?.verifyUrl);return this.fetchAttestation(o,l)},this.fetchAttestation=async(n,s)=>{this.logger.debug(`resolving attestation: ${n} from url: ${s}`);const o=this.startAbortTimer(ze.ONE_SECOND*5),h=await fetch(`${s}/attestation/${n}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),h.status===200?await h.json():void 0},this.getVerifyUrl=n=>{let s=n||ff;return M_.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${ff}`),s=ff),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const n=this.startAbortTimer(ze.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(n),await s.json()}catch(n){this.logger.warn(n)}},this.persistPublicKey=async n=>{this.logger.debug("persisting public key to local storage",n),await this.store.setItem(this.storeKey,n),this.publicKey=n},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async n=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(n,s)}catch(h){this.logger.error(h),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(n,o)}catch(h){this.logger.error(h),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const n=await this.fetchPromise;return this.fetchPromise=void 0,n},this.validateAttestation=(n,s)=>{const o=o7(n,s.publicKey),h={hasExpired:ze.toMiliseconds(o.exp)<Date.now(),payload:o};if(h.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:h.payload.origin,isScam:h.payload.isScam,isVerified:h.payload.isVerified}},this.logger=Cr(r,this.name),this.abortController=new AbortController,this.isDevEnv=$h(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return qr(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),ze.toMiliseconds(e))}}class SA extends H6{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=E_,this.registerDeviceToken=async i=>{const{clientId:n,token:s,notificationType:o,enableEncrypted:h=!1}=i,l=`${S_}/${this.projectId}/clients`;await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:n,type:o,token:s,always_raw:h})})},this.logger=Cr(r,this.context)}}var DA=Object.defineProperty,ab=Object.getOwnPropertySymbols,IA=Object.prototype.hasOwnProperty,NA=Object.prototype.propertyIsEnumerable,fb=(t,e,r)=>e in t?DA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,uf=(t,e)=>{for(var r in e||(e={}))IA.call(e,r)&&fb(t,r,e[r]);if(ab)for(var r of ab(e))NA.call(e,r)&&fb(t,r,e[r]);return t};class OA extends j6{constructor(e,r,i=!0){super(e,r,i),this.core=e,this.logger=r,this.context=I_,this.storagePrefix=Gi,this.storageVersion=D_,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!$h())try{const n={eventId:P1(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:D1(this.core.relayer.protocol,this.core.relayer.version,rc)}}};await this.sendEvent([n])}catch(n){this.logger.warn(n)}},this.createEvent=n=>{const{event:s="ERROR",type:o="",properties:{topic:h,trace:l}}=n,p=P1(),w=this.core.projectId||"",M=Date.now(),I=uf({eventId:p,timestamp:M,props:{event:s,type:o,properties:{topic:h,trace:l}},bundleId:w,domain:this.getAppDomain()},this.setMethods(p));return this.telemetryEnabled&&(this.events.set(p,I),this.shouldPersist=!0),I},this.getEvent=n=>{const{eventId:s,topic:o}=n;if(s)return this.events.get(s);const h=Array.from(this.events.values()).find(l=>l.props.properties.topic===o);if(h)return uf(uf({},h),this.setMethods(h.eventId))},this.deleteEvent=n=>{const{eventId:s}=n;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(Ts.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(n=>{ze.fromMiliseconds(Date.now())-ze.fromMiliseconds(n.timestamp)>N_&&(this.events.delete(n.eventId),this.shouldPersist=!0)})})},this.setMethods=n=>({addTrace:s=>this.addTrace(n,s),setError:s=>this.setError(n,s)}),this.addTrace=(n,s)=>{const o=this.events.get(n);o&&(o.props.properties.trace.push(s),this.events.set(n,o),this.shouldPersist=!0)},this.setError=(n,s)=>{const o=this.events.get(n);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(n,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const n=await this.core.storage.getItem(this.storageKey)||[];if(!n.length)return;n.forEach(s=>{this.events.set(s.eventId,uf(uf({},s),this.setMethods(s.eventId)))})}catch(n){this.logger.warn(n)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const n=[];for(const[s,o]of this.events)o.props.type&&n.push(o);if(n.length!==0)try{if((await this.sendEvent(n)).ok)for(const s of n)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async n=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${O_}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${rc}${s}`,{method:"POST",body:JSON.stringify(n)})},this.getAppDomain=()=>S1().url,this.logger=Cr(r,this.context),this.telemetryEnabled=i,i?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var RA=Object.defineProperty,ob=Object.getOwnPropertySymbols,CA=Object.prototype.hasOwnProperty,PA=Object.prototype.propertyIsEnumerable,hb=(t,e,r)=>e in t?RA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,cb=(t,e)=>{for(var r in e||(e={}))CA.call(e,r)&&hb(t,r,e[r]);if(ob)for(var r of ob(e))PA.call(e,r)&&hb(t,r,e[r]);return t};class fc extends B6{constructor(e){var r;super(e),this.protocol=Mp,this.version=Ep,this.name=Lo,this.events=new Or.exports.EventEmitter,this.initialized=!1,this.on=(o,h)=>this.events.on(o,h),this.once=(o,h)=>this.events.once(o,h),this.off=(o,h)=>this.events.off(o,h),this.removeListener=(o,h)=>this.events.removeListener(o,h),this.dispatchEnvelope=({topic:o,message:h,sessionExists:l})=>{if(!o||!h)return;const p={topic:o,message:h,publishedAt:Date.now(),transportType:_t.link_mode};this.relayer.onLinkMessageEvent(p,{sessionExists:l})},this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||Np,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const i=sd({level:typeof e?.logger=="string"&&e.logger?e.logger:Q9.logger,name:Lo}),{logger:n,chunkLoggerController:s}=T6({opts:i,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,h;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((h=this.logChunkController)==null||h.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Cr(n,this.name),this.heartbeat=new P0,this.crypto=new eA(this,this.logger,e?.keychain),this.history=new AA(this,this.logger),this.expirer=new MA(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new a6(cb(cb({},X9),e?.storageOptions)),this.relayer=new mA({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new xA(this,this.logger),this.verify=new EA(this,this.logger,this.storage),this.echoClient=new SA(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new OA(this,this.logger,e?.telemetryEnabled)}static async init(e){const r=new fc(e);await r.initialize();const i=await r.crypto.getClientId();return await r.storage.setItem(u_,i),r}get context(){return qr(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(Op,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(Op)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const oc=fc,TA={level:"info"},df="custom_context";var BA=Object.defineProperty,FA=Object.defineProperties,LA=Object.getOwnPropertyDescriptors,ub=Object.getOwnPropertySymbols,UA=Object.prototype.hasOwnProperty,$A=Object.prototype.propertyIsEnumerable,db=(t,e,r)=>e in t?BA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qA=(t,e)=>{for(var r in e||(e={}))UA.call(e,r)&&db(t,r,e[r]);if(ub)for(var r of ub(e))$A.call(e,r)&&db(t,r,e[r]);return t},zA=(t,e)=>FA(t,LA(e));function kA(t){return zA(qA({},t),{level:t?.level||TA.level})}function KA(t,e=df){return t[e]||""}function HA(t,e,r=df){return t[r]=e,t}function lb(t,e=df){let r="";return typeof t.bindings>"u"?r=KA(t,e):r=t.bindings().context||"",r}function jA(t,e,r=df){const i=lb(t,r);return i.trim()?`${i}/${e}`:e}function GA(t,e,r=df){const i=jA(t,e,r),n=t.child({context:i});return HA(n,i,r)}const pb="wc",bb=2,vb="client",hc=`${pb}@${bb}:${vb}:`,cc={name:vb,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},gb="WALLETCONNECT_DEEPLINK_CHOICE",VA="proposal",YA="Proposal expired",JA="session",aa=ze.SEVEN_DAYS,WA="engine",jt={wc_sessionPropose:{req:{ttl:ze.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ze.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:ze.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:ze.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:ze.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ze.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ze.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ze.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ze.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ze.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ze.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:ze.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ze.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ze.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ze.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ze.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ze.ONE_DAY,prompt:!1,tag:1114},res:{ttl:ze.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:ze.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:ze.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:ze.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:ze.FIVE_MINUTES,prompt:!1,tag:1119}}},uc={min:ze.FIVE_MINUTES,max:ze.SEVEN_DAYS},Yi={idle:"IDLE",active:"ACTIVE"},QA="request",XA=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],ZA="wc",eM="auth",tM="authKeys",rM="pairingTopics",iM="requests",$o=`${ZA}@${1.5}:${eM}:`,qo=`${$o}:PUB_KEY`;var nM=Object.defineProperty,sM=Object.defineProperties,aM=Object.getOwnPropertyDescriptors,mb=Object.getOwnPropertySymbols,fM=Object.prototype.hasOwnProperty,oM=Object.prototype.propertyIsEnumerable,yb=(t,e,r)=>e in t?nM(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ot=(t,e)=>{for(var r in e||(e={}))fM.call(e,r)&&yb(t,r,e[r]);if(mb)for(var r of mb(e))oM.call(e,r)&&yb(t,r,e[r]);return t},Si=(t,e)=>sM(t,aM(e));class hM extends V6{constructor(e){super(e),this.name=WA,this.events=new Or.exports,this.initialized=!1,this.requestQueue={state:Yi.idle,queue:[]},this.sessionRequestQueue={state:Yi.idle,queue:[]},this.requestQueueDelay=ze.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(jt)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},ze.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const i=Si(Ot({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(i);const{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:h,relays:l}=i;let p=n,w,M=!1;try{p&&(M=this.client.core.pairing.pairings.get(p).active)}catch(F){throw this.client.logger.error(`connect() -> pairing.get(${p}) failed`),F}if(!p||!M){const{topic:F,uri:$}=await this.client.core.pairing.create();p=F,w=$}if(!p){const{message:F}=ke("NO_MATCHING_KEY",`connect() pairing topic: ${p}`);throw new Error(F)}const I=await this.client.core.crypto.generateKeyPair(),D=jt.wc_sessionPropose.req.ttl||ze.FIVE_MINUTES,N=Ut(D),U=Ot({requiredNamespaces:s,optionalNamespaces:o,relays:l??[{protocol:Ip}],proposer:{publicKey:I,metadata:this.client.metadata},expiryTimestamp:N,pairingTopic:p},h&&{sessionProperties:h}),{reject:z,resolve:H,done:L}=hs(D,YA);this.events.once(st("session_connect"),async({error:F,session:$})=>{if(F)z(F);else if($){$.self.publicKey=I;const q=Si(Ot({},$),{pairingTopic:U.pairingTopic,requiredNamespaces:U.requiredNamespaces,optionalNamespaces:U.optionalNamespaces,transportType:_t.relay});await this.client.session.set($.topic,q),await this.setExpiry($.topic,$.expiry),p&&await this.client.core.pairing.updateMetadata({topic:p,metadata:$.peer.metadata}),this.cleanupDuplicatePairings(q),H(q)}});const K=await this.sendRequest({topic:p,method:"wc_sessionPropose",params:U,throwOnFailedPublish:!0});return await this.setProposal(K,Ot({id:K},U)),{uri:w,approval:L}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(i){throw this.client.logger.error("pair() failed"),i}},this.approve=async r=>{var i,n,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(i=r?.id)==null?void 0:i.toString(),trace:[Ei.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(R){throw o.setError(bs.no_internet_connection),R}try{await this.isValidProposalId(r?.id)}catch(R){throw this.client.logger.error(`approve() -> proposal.get(${r?.id}) failed`),o.setError(bs.proposal_not_found),R}try{await this.isValidApprove(r)}catch(R){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(bs.session_approve_namespace_validation_failure),R}const{id:h,relayProtocol:l,namespaces:p,sessionProperties:w,sessionConfig:M}=r,I=this.client.proposal.get(h);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:D,proposer:N,requiredNamespaces:U,optionalNamespaces:z}=I;let H=(n=this.client.core.eventClient)==null?void 0:n.getEvent({topic:D});H||(H=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:Ei.session_approve_started,properties:{topic:D,trace:[Ei.session_approve_started,Ei.session_namespaces_validation_success]}}));const L=await this.client.core.crypto.generateKeyPair(),K=N.publicKey,F=await this.client.core.crypto.generateSharedKey(L,K),$=Ot(Ot({relay:{protocol:l??"irn"},namespaces:p,controller:{publicKey:L,metadata:this.client.metadata},expiry:Ut(aa)},w&&{sessionProperties:w}),M&&{sessionConfig:M}),q=_t.relay;H.addTrace(Ei.subscribing_session_topic);try{await this.client.core.relayer.subscribe(F,{transportType:q})}catch(R){throw H.setError(bs.subscribe_session_topic_failure),R}H.addTrace(Ei.subscribe_session_topic_success);const y=Si(Ot({},$),{topic:F,requiredNamespaces:U,optionalNamespaces:z,pairingTopic:D,acknowledged:!1,self:$.controller,peer:{publicKey:N.publicKey,metadata:N.metadata},controller:L,transportType:_t.relay});await this.client.session.set(F,y),H.addTrace(Ei.store_session);try{H.addTrace(Ei.publishing_session_settle),await this.sendRequest({topic:F,method:"wc_sessionSettle",params:$,throwOnFailedPublish:!0}).catch(R=>{throw H?.setError(bs.session_settle_publish_failure),R}),H.addTrace(Ei.session_settle_publish_success),H.addTrace(Ei.publishing_session_approve),await this.sendResult({id:h,topic:D,result:{relay:{protocol:l??"irn"},responderPublicKey:L},throwOnFailedPublish:!0}).catch(R=>{throw H?.setError(bs.session_approve_publish_failure),R}),H.addTrace(Ei.session_approve_publish_success)}catch(R){throw this.client.logger.error(R),this.client.session.delete(F,wt("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(F),R}return this.client.core.eventClient.deleteEvent({eventId:H.eventId}),await this.client.core.pairing.updateMetadata({topic:D,metadata:N.metadata}),await this.client.proposal.delete(h,wt("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:D}),await this.setExpiry(F,Ut(aa)),{topic:F,acknowledged:()=>Promise.resolve(this.client.session.get(F))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:i,reason:n}=r;let s;try{s=this.client.proposal.get(i).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${i}) failed`),o}s&&(await this.sendError({id:i,topic:s,error:n,rpcOpts:jt.wc_sessionPropose.reject}),await this.client.proposal.delete(i,wt("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(M){throw this.client.logger.error("update() -> isValidUpdate() failed"),M}const{topic:i,namespaces:n}=r,{done:s,resolve:o,reject:h}=hs(),l=gn(),p=ds().toString(),w=this.client.session.get(i).namespaces;return this.events.once(st("session_update",l),({error:M})=>{M?h(M):o()}),await this.client.session.update(i,{namespaces:n}),await this.sendRequest({topic:i,method:"wc_sessionUpdate",params:{namespaces:n},throwOnFailedPublish:!0,clientRpcId:l,relayRpcId:p}).catch(M=>{this.client.logger.error(M),this.client.session.update(i,{namespaces:w}),h(M)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(l){throw this.client.logger.error("extend() -> isValidExtend() failed"),l}const{topic:i}=r,n=gn(),{done:s,resolve:o,reject:h}=hs();return this.events.once(st("session_extend",n),({error:l})=>{l?h(l):o()}),await this.setExpiry(i,Ut(aa)),this.sendRequest({topic:i,method:"wc_sessionExtend",params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch(l=>{h(l)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(N){throw this.client.logger.error("request() -> isValidRequest() failed"),N}const{chainId:i,request:n,topic:s,expiry:o=jt.wc_sessionRequest.req.ttl}=r,h=this.client.session.get(s);h?.transportType===_t.relay&&await this.confirmOnlineStateOrThrow();const l=gn(),p=ds().toString(),{done:w,resolve:M,reject:I}=hs(o,"Request expired. Please try again.");this.events.once(st("session_request",l),({error:N,result:U})=>{N?I(N):M(U)});const D=this.getAppLinkIfEnabled(h.peer.metadata,h.transportType);return D?(await this.sendRequest({clientRpcId:l,relayRpcId:p,topic:s,method:"wc_sessionRequest",params:{request:Si(Ot({},n),{expiryTimestamp:Ut(o)}),chainId:i},expiry:o,throwOnFailedPublish:!0,appLink:D}).catch(N=>I(N)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:l}),await w()):await Promise.all([new Promise(async N=>{await this.sendRequest({clientRpcId:l,relayRpcId:p,topic:s,method:"wc_sessionRequest",params:{request:Si(Ot({},n),{expiryTimestamp:Ut(o)}),chainId:i},expiry:o,throwOnFailedPublish:!0}).catch(U=>I(U)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:l}),N()}),new Promise(async N=>{var U;if(!((U=h.sessionConfig)!=null&&U.disableDeepLink)){const z=await Ew(this.client.core.storage,gb);await Aw({id:l,topic:s,wcDeepLink:z})}N()}),w()]).then(N=>N[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:i,response:n}=r,{id:s}=n,o=this.client.session.get(i);o.transportType===_t.relay&&await this.confirmOnlineStateOrThrow();const h=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);ji(n)?await this.sendResult({id:s,topic:i,result:n.result,throwOnFailedPublish:!0,appLink:h}):oi(n)&&await this.sendError({id:s,topic:i,error:n.error,appLink:h}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(n){throw this.client.logger.error("ping() -> isValidPing() failed"),n}const{topic:i}=r;if(this.client.session.keys.includes(i)){const n=gn(),s=ds().toString(),{done:o,resolve:h,reject:l}=hs();this.events.once(st("session_ping",n),({error:p})=>{p?l(p):h()}),await Promise.all([this.sendRequest({topic:i,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:n,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(i)&&await this.client.core.pairing.ping({topic:i})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:i,event:n,chainId:s}=r,o=ds().toString(),h=gn();await this.sendRequest({topic:i,method:"wc_sessionEvent",params:{event:n,chainId:s},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:h})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:i}=r;if(this.client.session.keys.includes(i))await this.sendRequest({topic:i,method:"wc_sessionDelete",params:wt("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:i,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(i))await this.client.core.pairing.disconnect({topic:i});else{const{message:n}=ke("MISMATCHED_TOPIC",`Session or pairing topic not found: ${i}`);throw new Error(n)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(i=>E7(i,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,i)=>{var n;this.isInitialized(),this.isValidAuthenticate(r);const s=i&&this.client.core.linkModeSupportedApps.includes(i)&&((n=this.client.metadata.redirect)==null?void 0:n.linkMode),o=s?_t.link_mode:_t.relay;o===_t.relay&&await this.confirmOnlineStateOrThrow();const{chains:h,statement:l="",uri:p,domain:w,nonce:M,type:I,exp:D,nbf:N,methods:U=[],expiry:z}=r,H=[...r.resources||[]],{topic:L,uri:K}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:L,uri:K}});const F=await this.client.core.crypto.generateKeyPair(),$=Oo(F);if(await Promise.all([this.client.auth.authKeys.set(qo,{responseTopic:$,publicKey:F}),this.client.auth.pairingTopics.set($,{topic:$,pairingTopic:L})]),await this.client.core.relayer.subscribe($,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${L}`),U.length>0){const{namespace:A}=So(h[0]);let _=Gw(A,"request",U);No(H)&&(_=Yw(_,H.pop())),H.push(_)}const q=z&&z>jt.wc_sessionAuthenticate.req.ttl?z:jt.wc_sessionAuthenticate.req.ttl,y={authPayload:{type:I??"caip122",chains:h,statement:l,aud:p,domain:w,version:"1",nonce:M,iat:new Date().toISOString(),exp:D,nbf:N,resources:H},requester:{publicKey:F,metadata:this.client.metadata},expiryTimestamp:Ut(q)},R={eip155:{chains:h,methods:[...new Set(["personal_sign",...U])],events:["chainChanged","accountsChanged"]}},V={requiredNamespaces:{},optionalNamespaces:R,relays:[{protocol:"irn"}],pairingTopic:L,proposer:{publicKey:F,metadata:this.client.metadata},expiryTimestamp:Ut(jt.wc_sessionPropose.req.ttl)},{done:Q,resolve:O,reject:d}=hs(q,"Request expired"),u=async({error:A,session:_})=>{if(this.events.off(st("session_request",f),a),A)d(A);else if(_){_.self.publicKey=F,await this.client.session.set(_.topic,_),await this.setExpiry(_.topic,_.expiry),L&&await this.client.core.pairing.updateMetadata({topic:L,metadata:_.peer.metadata});const c=this.client.session.get(_.topic);await this.deleteProposal(b),O({session:c})}},a=async A=>{var _,c,m;if(await this.deletePendingAuthRequest(f,{message:"fulfilled",code:0}),A.error){const B=wt("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return A.error.code===B.code?void 0:(this.events.off(st("session_connect"),u),d(A.error.message))}await this.deleteProposal(b),this.events.off(st("session_connect"),u);const{cacaos:v,responder:S}=A.result,G=[],E=[];for(const B of v){await L1({cacao:B,projectId:this.client.core.projectId})||(this.client.logger.error(B,"Signature verification failed"),d(wt("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:P}=B,g=No(P.resources),T=[zh(P.iss)],j=Io(P.iss);if(g){const J=q1(g),W=z1(g);G.push(...J),T.push(...W)}for(const J of T)E.push(`${J}:${j}`)}const k=await this.client.core.crypto.generateSharedKey(F,S.publicKey);let C;G.length>0&&(C={topic:k,acknowledged:!0,self:{publicKey:F,metadata:this.client.metadata},peer:S,controller:S.publicKey,expiry:Ut(aa),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:L,namespaces:tp([...new Set(G)],[...new Set(E)]),transportType:o},await this.client.core.relayer.subscribe(k,{transportType:o}),await this.client.session.set(k,C),L&&await this.client.core.pairing.updateMetadata({topic:L,metadata:S.metadata}),C=this.client.session.get(k)),(_=this.client.metadata.redirect)!=null&&_.linkMode&&(c=S.metadata.redirect)!=null&&c.linkMode&&(m=S.metadata.redirect)!=null&&m.universal&&i&&(this.client.core.addLinkModeSupportedApp(S.metadata.redirect.universal),this.client.session.update(k,{transportType:_t.link_mode})),O({auths:v,session:C})},f=gn(),b=gn();this.events.once(st("session_connect"),u),this.events.once(st("session_request",f),a);let x;try{if(s){const A=ls("wc_sessionAuthenticate",y,f);this.client.core.history.set(L,A);const _=await this.client.core.crypto.encode("",A,{type:Xa,encoding:Wa});x=Co(i,L,_)}else await Promise.all([this.sendRequest({topic:L,method:"wc_sessionAuthenticate",params:y,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:f}),this.sendRequest({topic:L,method:"wc_sessionPropose",params:V,expiry:jt.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:b})])}catch(A){throw this.events.off(st("session_connect"),u),this.events.off(st("session_request",f),a),A}return await this.setProposal(b,Ot({id:b},V)),await this.setAuthRequest(f,{request:Si(Ot({},y),{verifyContext:{}}),pairingTopic:L,transportType:o}),{uri:x??K,response:Q}},this.approveSessionAuthenticate=async r=>{const{id:i,auths:n}=r,s=this.client.core.eventClient.createEvent({properties:{topic:i.toString(),trace:[vs.authenticated_session_approve_started]}});try{this.isInitialized()}catch(z){throw s.setError(of.no_internet_connection),z}const o=this.getPendingAuthRequest(i);if(!o)throw s.setError(of.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${i}`);const h=o.transportType||_t.relay;h===_t.relay&&await this.confirmOnlineStateOrThrow();const l=o.requester.publicKey,p=await this.client.core.crypto.generateKeyPair(),w=Oo(l),M={type:ln,receiverPublicKey:l,senderPublicKey:p},I=[],D=[];for(const z of n){if(!await L1({cacao:z,projectId:this.client.core.projectId})){s.setError(of.invalid_cacao);const $=wt("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:i,topic:w,error:$,encodeOpts:M}),new Error($.message)}s.addTrace(vs.cacaos_verified);const{p:H}=z,L=No(H.resources),K=[zh(H.iss)],F=Io(H.iss);if(L){const $=q1(L),q=z1(L);I.push(...$),K.push(...q)}for(const $ of K)D.push(`${$}:${F}`)}const N=await this.client.core.crypto.generateSharedKey(p,l);s.addTrace(vs.create_authenticated_session_topic);let U;if(I?.length>0){U={topic:N,acknowledged:!0,self:{publicKey:p,metadata:this.client.metadata},peer:{publicKey:l,metadata:o.requester.metadata},controller:l,expiry:Ut(aa),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:tp([...new Set(I)],[...new Set(D)]),transportType:h},s.addTrace(vs.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(N,{transportType:h})}catch(z){throw s.setError(of.subscribe_authenticated_session_topic_failure),z}s.addTrace(vs.subscribe_authenticated_session_topic_success),await this.client.session.set(N,U),s.addTrace(vs.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(vs.publishing_authenticated_session_approve);try{await this.sendResult({topic:w,id:i,result:{cacaos:n,responder:{publicKey:p,metadata:this.client.metadata}},encodeOpts:M,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,h)})}catch(z){throw s.setError(of.authenticated_session_approve_publish_failure),z}return await this.client.auth.requests.delete(i,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:U}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:i,reason:n}=r,s=this.getPendingAuthRequest(i);if(!s)throw new Error(`Could not find pending auth request with id ${i}`);s.transportType===_t.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,h=await this.client.core.crypto.generateKeyPair(),l=Oo(o),p={type:ln,receiverPublicKey:o,senderPublicKey:h};await this.sendError({id:i,topic:l,error:n,encodeOpts:p,rpcOpts:jt.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(i,{message:"rejected",code:0}),await this.client.proposal.delete(i,wt("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:i,iss:n}=r;return U1(i,n)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const i=this.client.core.pairing.pairings.get(r.pairingTopic),n=this.client.core.pairing.pairings.getAll().filter(s=>{var o,h;return((o=s.peerMetadata)==null?void 0:o.url)&&((h=s.peerMetadata)==null?void 0:h.url)===r.peer.metadata.url&&s.topic&&s.topic!==i.topic});if(n.length===0)return;this.client.logger.info(`Cleaning up ${n.length} duplicate pairing(s)`),await Promise.all(n.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(i){this.client.logger.error(i)}},this.deleteSession=async r=>{var i;const{topic:n,expirerHasDeleted:s=!1,emitEvent:o=!0,id:h=0}=r,{self:l}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,wt("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(l.publicKey)&&await this.client.core.crypto.deleteKeyPair(l.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),s||this.client.core.expirer.del(n),this.client.core.storage.removeItem(gb).catch(p=>this.client.logger.warn(p)),this.getPendingSessionRequests().forEach(p=>{p.topic===n&&this.deletePendingSessionRequest(p.id,wt("USER_DISCONNECTED"))}),n===((i=this.sessionRequestQueue.queue[0])==null?void 0:i.topic)&&(this.sessionRequestQueue.state=Yi.idle),o&&this.client.events.emit("session_delete",{id:h,topic:n})},this.deleteProposal=async(r,i)=>{if(i)try{const n=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:n.pairingTopic});s?.setError(bs.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,wt("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,i,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,i),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),n&&(this.sessionRequestQueue.state=Yi.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,i,n=!1)=>{await Promise.all([this.client.auth.requests.delete(r,i),n?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,i)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,i),await this.client.session.update(r,{expiry:i}))},this.setProposal=async(r,i)=>{this.client.core.expirer.set(r,Ut(jt.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,i)},this.setAuthRequest=async(r,i)=>{const{request:n,pairingTopic:s,transportType:o=_t.relay}=i;this.client.core.expirer.set(r,n.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:r,pairingTopic:s,verifyContext:n.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:i,topic:n,params:s,verifyContext:o}=r,h=s.request.expiryTimestamp||Ut(jt.wc_sessionRequest.req.ttl);this.client.core.expirer.set(i,h),await this.client.pendingRequest.set(i,{id:i,topic:n,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:i,method:n,params:s,expiry:o,relayRpcId:h,clientRpcId:l,throwOnFailedPublish:p,appLink:w}=r,M=ls(n,s,l);let I;const D=!!w;try{const z=D?Wa:$n;I=await this.client.core.crypto.encode(i,M,{encoding:z})}catch(z){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${i} failed`),z}let N;if(XA.includes(n)){const z=pn(JSON.stringify(M)),H=pn(I);N=await this.client.core.verify.register({id:H,decryptedId:z})}const U=jt[n].req;if(U.attestation=N,o&&(U.ttl=o),h&&(U.id=h),this.client.core.history.set(i,M),D){const z=Co(w,i,I);await global.Linking.openURL(z,this.client.name)}else{const z=jt[n].req;o&&(z.ttl=o),h&&(z.id=h),p?(z.internal=Si(Ot({},z.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,I,z)):this.client.core.relayer.publish(i,I,z).catch(H=>this.client.logger.error(H))}return M.id},this.sendResult=async r=>{const{id:i,topic:n,result:s,throwOnFailedPublish:o,encodeOpts:h,appLink:l}=r,p=Xh(i,s);let w;const M=l&&typeof(global==null?void 0:global.Linking)<"u";try{const D=M?Wa:$n;w=await this.client.core.crypto.encode(n,p,Si(Ot({},h||{}),{encoding:D}))}catch(D){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${n} failed`),D}let I;try{I=await this.client.core.history.get(n,i)}catch(D){throw this.client.logger.error(`sendResult() -> history.get(${n}, ${i}) failed`),D}if(M){const D=Co(l,n,w);await global.Linking.openURL(D,this.client.name)}else{const D=jt[I.request.method].res;o?(D.internal=Si(Ot({},D.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,w,D)):this.client.core.relayer.publish(n,w,D).catch(N=>this.client.logger.error(N))}await this.client.core.history.resolve(p)},this.sendError=async r=>{const{id:i,topic:n,error:s,encodeOpts:o,rpcOpts:h,appLink:l}=r,p=Zh(i,s);let w;const M=l&&typeof(global==null?void 0:global.Linking)<"u";try{const D=M?Wa:$n;w=await this.client.core.crypto.encode(n,p,Si(Ot({},o||{}),{encoding:D}))}catch(D){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${n} failed`),D}let I;try{I=await this.client.core.history.get(n,i)}catch(D){throw this.client.logger.error(`sendError() -> history.get(${n}, ${i}) failed`),D}if(M){const D=Co(l,n,w);await global.Linking.openURL(D,this.client.name)}else{const D=h||jt[I.request.method].res;this.client.core.relayer.publish(n,w,D)}await this.client.core.history.resolve(p)},this.cleanup=async()=>{const r=[],i=[];this.client.session.getAll().forEach(n=>{let s=!1;Un(n.expiry)&&(s=!0),this.client.core.crypto.keychain.has(n.topic)||(s=!0),s&&r.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{Un(n.expiryTimestamp)&&i.push(n.id)}),await Promise.all([...r.map(n=>this.deleteSession({topic:n})),...i.map(n=>this.deleteProposal(n))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Yi.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Yi.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(i){this.client.logger.warn(i)}}this.requestQueue.state=Yi.idle},this.processRequest=async r=>{const{topic:i,payload:n,attestation:s,transportType:o,encryptedId:h}=r,l=n.method;if(!this.shouldIgnorePairingRequest({topic:i,requestMethod:l}))switch(l){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:i,payload:n,attestation:s,encryptedId:h});case"wc_sessionSettle":return await this.onSessionSettleRequest(i,n);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(i,n);case"wc_sessionExtend":return await this.onSessionExtendRequest(i,n);case"wc_sessionPing":return await this.onSessionPingRequest(i,n);case"wc_sessionDelete":return await this.onSessionDeleteRequest(i,n);case"wc_sessionRequest":return await this.onSessionRequest({topic:i,payload:n,attestation:s,encryptedId:h,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(i,n);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:i,payload:n,attestation:s,encryptedId:h,transportType:o});default:return this.client.logger.info(`Unsupported request method ${l}`)}},this.onRelayEventResponse=async r=>{const{topic:i,payload:n,transportType:s}=r,o=(await this.client.core.history.get(i,n.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(i,n,s);case"wc_sessionSettle":return this.onSessionSettleResponse(i,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,n);case"wc_sessionExtend":return this.onSessionExtendResponse(i,n);case"wc_sessionPing":return this.onSessionPingResponse(i,n);case"wc_sessionRequest":return this.onSessionRequestResponse(i,n);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(i,n);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:i}=r,{message:n}=ke("MISSING_OR_INVALID",`Decoded payload on topic ${i} is not identifiable as a JSON-RPC request or a response.`);throw new Error(n)},this.shouldIgnorePairingRequest=r=>{const{topic:i,requestMethod:n}=r,s=this.expectedPairingMethodMap.get(i);return!s||s.includes(n)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:i,payload:n,attestation:s,encryptedId:o}=r,{params:h,id:l}=n;try{const p=this.client.core.eventClient.getEvent({topic:i});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),p?.setError(mn.proposal_listener_not_found)),this.isValidConnect(Ot({},n.params));const w=h.expiryTimestamp||Ut(jt.wc_sessionPropose.req.ttl),M=Ot({id:l,pairingTopic:i,expiryTimestamp:w},h);await this.setProposal(l,M);const I=await this.getVerifyContext({attestationId:s,hash:pn(JSON.stringify(n)),encryptedId:o,metadata:M.proposer.metadata});p?.addTrace(Vi.emit_session_proposal),this.client.events.emit("session_proposal",{id:l,params:M,verifyContext:I})}catch(p){await this.sendError({id:l,topic:i,error:p,rpcOpts:jt.wc_sessionPropose.autoReject}),this.client.logger.error(p)}},this.onSessionProposeResponse=async(r,i,n)=>{const{id:s}=i;if(ji(i)){const{result:o}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const h=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:h});const l=h.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:l});const p=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:p});const w=await this.client.core.crypto.generateSharedKey(l,p);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:w});const M=await this.client.core.relayer.subscribe(w,{transportType:n});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:M}),await this.client.core.pairing.activate({topic:r})}else if(oi(i)){await this.client.proposal.delete(s,wt("USER_DISCONNECTED"));const o=st("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(st("session_connect"),{error:i.error})}},this.onSessionSettleRequest=async(r,i)=>{const{id:n,params:s}=i;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:h,expiry:l,namespaces:p,sessionProperties:w,sessionConfig:M}=i.params,I=Si(Ot(Ot({topic:r,relay:o,expiry:l,namespaces:p,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:h.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:h.publicKey,metadata:h.metadata}},w&&{sessionProperties:w}),M&&{sessionConfig:M}),{transportType:_t.relay}),D=st("session_connect");if(this.events.listenerCount(D)===0)throw new Error(`emitting ${D} without any listeners 997`);this.events.emit(st("session_connect"),{session:I}),await this.sendResult({id:i.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:n,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,i)=>{const{id:n}=i;ji(i)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(st("session_approve",n),{})):oi(i)&&(await this.client.session.delete(r,wt("USER_DISCONNECTED")),this.events.emit(st("session_approve",n),{error:i.error}))},this.onSessionUpdateRequest=async(r,i)=>{const{params:n,id:s}=i;try{const o=`${r}_session_update`,h=rf.get(o);if(h&&this.isRequestOutOfSync(h,s)){this.client.logger.warn(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:wt("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(Ot({topic:r},n));try{rf.set(o,s),await this.client.session.update(r,{namespaces:n.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(l){throw rf.delete(o),l}this.client.events.emit("session_update",{id:s,topic:r,params:n})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,i)=>i.toString().slice(0,-3)<r.toString().slice(0,-3),this.onSessionUpdateResponse=(r,i)=>{const{id:n}=i,s=st("session_update",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);ji(i)?this.events.emit(st("session_update",n),{}):oi(i)&&this.events.emit(st("session_update",n),{error:i.error})},this.onSessionExtendRequest=async(r,i)=>{const{id:n}=i;try{this.isValidExtend({topic:r}),await this.setExpiry(r,Ut(aa)),await this.sendResult({id:n,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:n,topic:r})}catch(s){await this.sendError({id:n,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,i)=>{const{id:n}=i,s=st("session_extend",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);ji(i)?this.events.emit(st("session_extend",n),{}):oi(i)&&this.events.emit(st("session_extend",n),{error:i.error})},this.onSessionPingRequest=async(r,i)=>{const{id:n}=i;try{this.isValidPing({topic:r}),await this.sendResult({id:n,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:n,topic:r})}catch(s){await this.sendError({id:n,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,i)=>{const{id:n}=i,s=st("session_ping",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{ji(i)?this.events.emit(st("session_ping",n),{}):oi(i)&&this.events.emit(st("session_ping",n),{error:i.error})},500)},this.onSessionDeleteRequest=async(r,i)=>{const{id:n}=i;try{this.isValidDisconnect({topic:r,reason:i.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(Ht.publish,async()=>{s(await this.deleteSession({topic:r,id:n}))})}),this.sendResult({id:n,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:wt("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var i,n,s;const{topic:o,payload:h,attestation:l,encryptedId:p,transportType:w}=r,{id:M,params:I}=h;try{await this.isValidRequest(Ot({topic:o},I));const D=this.client.session.get(o),N=await this.getVerifyContext({attestationId:l,hash:pn(JSON.stringify(ls("wc_sessionRequest",I,M))),encryptedId:p,metadata:D.peer.metadata,transportType:w}),U={id:M,topic:o,params:I,verifyContext:N};await this.setPendingSessionRequest(U),w===_t.link_mode&&(i=D.peer.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp((n=D.peer.metadata.redirect)==null?void 0:n.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(U):(this.addSessionRequestToSessionRequestQueue(U),this.processSessionRequestQueue())}catch(D){await this.sendError({id:M,topic:o,error:D}),this.client.logger.error(D)}},this.onSessionRequestResponse=(r,i)=>{const{id:n}=i,s=st("session_request",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);ji(i)?this.events.emit(st("session_request",n),{result:i.result}):oi(i)&&this.events.emit(st("session_request",n),{error:i.error})},this.onSessionEventRequest=async(r,i)=>{const{id:n,params:s}=i;try{const o=`${r}_session_event_${s.event.name}`,h=rf.get(o);if(h&&this.isRequestOutOfSync(h,n)){this.client.logger.info(`Discarding out of sync request - ${n}`);return}this.isValidEmit(Ot({topic:r},s)),this.client.events.emit("session_event",{id:n,topic:r,params:s}),rf.set(o,n)}catch(o){await this.sendError({id:n,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,i)=>{const{id:n}=i;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:i}),ji(i)?this.events.emit(st("session_request",n),{result:i.result}):oi(i)&&this.events.emit(st("session_request",n),{error:i.error})},this.onSessionAuthenticateRequest=async r=>{var i;const{topic:n,payload:s,attestation:o,encryptedId:h,transportType:l}=r;try{const{requester:p,authPayload:w,expiryTimestamp:M}=s.params,I=await this.getVerifyContext({attestationId:o,hash:pn(JSON.stringify(s)),encryptedId:h,metadata:p.metadata,transportType:l}),D={requester:p,pairingTopic:n,id:s.id,authPayload:w,verifyContext:I,expiryTimestamp:M};await this.setAuthRequest(s.id,{request:D,pairingTopic:n,transportType:l}),l===_t.link_mode&&(i=p.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp(p.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:n,params:s.params,id:s.id,verifyContext:I})}catch(p){this.client.logger.error(p);const w=s.params.requester.publicKey,M=await this.client.core.crypto.generateKeyPair(),I=this.getAppLinkIfEnabled(s.params.requester.metadata,l),D={type:ln,receiverPublicKey:w,senderPublicKey:M};await this.sendError({id:s.id,topic:n,error:p,encodeOpts:D,rpcOpts:jt.wc_sessionAuthenticate.autoReject,appLink:I})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Yi.idle,this.processSessionRequestQueue()},ze.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:i})=>{const n=this.client.core.history.pending;n.length>0&&n.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,h=st("session_request",o);if(this.events.listenerCount(h)===0)throw new Error(`emitting ${h} without any listeners`);this.events.emit(st("session_request",s.request.id),{error:i})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Yi.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Yi.active,this.emitSessionRequest(r)}catch(i){this.client.logger.error(i)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const i=this.client.proposal.getAll().find(n=>n.pairingTopic===r.topic);i&&this.onSessionProposeRequest({topic:r.topic,payload:ls("wc_sessionPropose",{requiredNamespaces:i.requiredNamespaces,optionalNamespaces:i.optionalNamespaces,relays:i.relays,proposer:i.proposer,sessionProperties:i.sessionProperties},i.id)})},this.isValidConnect=async r=>{if(!Fr(r)){const{message:l}=ke("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(l)}const{pairingTopic:i,requiredNamespaces:n,optionalNamespaces:s,sessionProperties:o,relays:h}=r;if(Dr(i)||await this.isValidPairingTopic(i),!L7(h,!0)){const{message:l}=ke("MISSING_OR_INVALID",`connect() relays: ${h}`);throw new Error(l)}!Dr(n)&&To(n)!==0&&this.validateNamespaces(n,"requiredNamespaces"),!Dr(s)&&To(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),Dr(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,i)=>{const n=F7(r,"connect()",i);if(n)throw new Error(n.message)},this.isValidApprove=async r=>{if(!Fr(r))throw new Error(ke("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:i,namespaces:n,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(i),await this.isValidProposalId(i);const h=this.client.proposal.get(i),l=jh(n,"approve()");if(l)throw new Error(l.message);const p=ap(h.requiredNamespaces,n,"approve()");if(p)throw new Error(p.message);if(!Tt(s,!0)){const{message:w}=ke("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(w)}Dr(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!Fr(r)){const{message:s}=ke("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:i,reason:n}=r;if(this.checkRecentlyDeleted(i),await this.isValidProposalId(i),!$7(n)){const{message:s}=ke("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!Fr(r)){const{message:p}=ke("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(p)}const{relay:i,controller:n,namespaces:s,expiry:o}=r;if(!np(i)){const{message:p}=ke("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(p)}const h=O7(n,"onSessionSettleRequest()");if(h)throw new Error(h.message);const l=jh(s,"onSessionSettleRequest()");if(l)throw new Error(l.message);if(Un(o)){const{message:p}=ke("EXPIRED","onSessionSettleRequest()");throw new Error(p)}},this.isValidUpdate=async r=>{if(!Fr(r)){const{message:l}=ke("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(l)}const{topic:i,namespaces:n}=r;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const s=this.client.session.get(i),o=jh(n,"update()");if(o)throw new Error(o.message);const h=ap(s.requiredNamespaces,n,"update()");if(h)throw new Error(h.message)},this.isValidExtend=async r=>{if(!Fr(r)){const{message:n}=ke("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(n)}const{topic:i}=r;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i)},this.isValidRequest=async r=>{if(!Fr(r)){const{message:l}=ke("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(l)}const{topic:i,request:n,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const{namespaces:h}=this.client.session.get(i);if(!sp(h,s)){const{message:l}=ke("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(l)}if(!q7(n)){const{message:l}=ke("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(l)}if(!K7(h,s,n.method)){const{message:l}=ke("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(l)}if(o&&!V7(o,uc)){const{message:l}=ke("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${uc.min} and ${uc.max}`);throw new Error(l)}},this.isValidRespond=async r=>{var i;if(!Fr(r)){const{message:o}=ke("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:n,response:s}=r;try{await this.isValidSessionTopic(n)}catch(o){throw(i=r?.response)!=null&&i.id&&this.cleanupAfterResponse(r),o}if(!z7(s)){const{message:o}=ke("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!Fr(r)){const{message:n}=ke("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(n)}const{topic:i}=r;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async r=>{if(!Fr(r)){const{message:h}=ke("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(h)}const{topic:i,event:n,chainId:s}=r;await this.isValidSessionTopic(i);const{namespaces:o}=this.client.session.get(i);if(!sp(o,s)){const{message:h}=ke("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(h)}if(!k7(n)){const{message:h}=ke("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(h)}if(!H7(o,s,n.name)){const{message:h}=ke("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(h)}},this.isValidDisconnect=async r=>{if(!Fr(r)){const{message:n}=ke("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(n)}const{topic:i}=r;await this.isValidSessionOrPairingTopic(i)},this.isValidAuthenticate=r=>{const{chains:i,uri:n,domain:s,nonce:o}=r;if(!Array.isArray(i)||i.length===0)throw new Error("chains is required and must be a non-empty array");if(!Tt(n,!1))throw new Error("uri is required parameter");if(!Tt(s,!1))throw new Error("domain is required parameter");if(!Tt(o,!1))throw new Error("nonce is required parameter");if([...new Set(i.map(l=>So(l).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:h}=So(i[0]);if(h!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:i,hash:n,encryptedId:s,metadata:o,transportType:h}=r,l={verified:{verifyUrl:o.verifyUrl||ff,validation:"UNKNOWN",origin:o.url||""}};try{if(h===_t.link_mode){const w=this.getAppLinkIfEnabled(o,h);return l.verified.validation=w&&new URL(w).origin===new URL(o.url).origin?"VALID":"INVALID",l}const p=await this.client.core.verify.resolve({attestationId:i,hash:n,encryptedId:s,verifyUrl:o.verifyUrl});p&&(l.verified.origin=p.origin,l.verified.isScam=p.isScam,l.verified.validation=p.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(p){this.client.logger.warn(p)}return this.client.logger.debug(`Verify context: ${JSON.stringify(l)}`),l},this.validateSessionProps=(r,i)=>{Object.values(r).forEach(n=>{if(!Tt(n,!1)){const{message:s}=ke("MISSING_OR_INVALID",`${i} must be in Record<string, string> format. Received: ${JSON.stringify(n)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const i=this.client.auth.requests.get(r);return typeof i=="object"?i:void 0},this.addToRecentlyDeleted=(r,i)=>{if(this.recentlyDeletedMap.set(r,i),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let n=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(n++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const i=this.recentlyDeletedMap.get(r);if(i){const{message:n}=ke("MISSING_OR_INVALID",`Record was recently deleted - ${i}: ${r}`);throw new Error(n)}},this.isLinkModeEnabled=(r,i)=>{var n,s,o,h,l,p,w,M,I;return!r||i!==_t.link_mode?!1:((s=(n=this.client.metadata)==null?void 0:n.redirect)==null?void 0:s.linkMode)===!0&&((h=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:h.universal)!==void 0&&((p=(l=this.client.metadata)==null?void 0:l.redirect)==null?void 0:p.universal)!==""&&((w=r?.redirect)==null?void 0:w.universal)!==void 0&&((M=r?.redirect)==null?void 0:M.universal)!==""&&((I=r?.redirect)==null?void 0:I.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,i)=>{var n;return this.isLinkModeEnabled(r,i)?(n=r?.redirect)==null?void 0:n.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const i=C1(r,"topic")||"",n=decodeURIComponent(C1(r,"wc_ev")||""),s=this.client.session.keys.includes(i);s&&this.client.session.update(i,{transportType:_t.link_mode}),this.client.core.dispatchEnvelope({topic:i,message:n,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if($h()||na()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const i=global==null?void 0:global.Linking;if(typeof i<"u"){i.addEventListener("url",this.handleLinkModeMessage,this.client.name);const n=await i.getInitialURL();n&&setTimeout(()=>{this.handleLinkModeMessage({url:n})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=ke("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Ht.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:i,attestation:n,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(qo)?this.client.auth.authKeys.get(qo):{responseTopic:void 0,publicKey:void 0},h=await this.client.core.crypto.decode(r,i,{receiverPublicKey:o,encoding:s===_t.link_mode?Wa:$n});try{ec(h)?(this.client.core.history.set(r,h),this.onRelayEventRequest({topic:r,payload:h,attestation:n,transportType:s,encryptedId:pn(i)})):Fo(h)?(await this.client.core.history.resolve(h),await this.onRelayEventResponse({topic:r,payload:h,transportType:s}),this.client.core.history.delete(r,h.id)):this.onRelayEventUnknownPayload({topic:r,payload:h,transportType:s})}catch(l){this.client.logger.error(l)}}registerExpirerEvents(){this.client.core.expirer.on(hi.expired,async e=>{const{topic:r,id:i}=R1(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,ke("EXPIRED"),!0);if(i&&this.client.auth.requests.keys.includes(i))return await this.deletePendingAuthRequest(i,ke("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}registerPairingEvents(){this.client.core.pairing.events.on(ps.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(ps.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!Tt(e,!1)){const{message:r}=ke("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=ke("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(Un(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=ke("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!Tt(e,!1)){const{message:r}=ke("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=ke("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(Un(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=ke("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=ke("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(Tt(e,!1)){const{message:r}=ke("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=ke("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!U7(e)){const{message:r}=ke("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=ke("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(Un(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=ke("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class cM extends gs{constructor(e,r){super(e,r,VA,hc),this.core=e,this.logger=r}}class wb extends gs{constructor(e,r){super(e,r,JA,hc),this.core=e,this.logger=r}}class uM extends gs{constructor(e,r){super(e,r,QA,hc,i=>i.id),this.core=e,this.logger=r}}class dM extends gs{constructor(e,r){super(e,r,tM,$o,()=>qo),this.core=e,this.logger=r}}class lM extends gs{constructor(e,r){super(e,r,rM,$o),this.core=e,this.logger=r}}class pM extends gs{constructor(e,r){super(e,r,iM,$o,i=>i.id),this.core=e,this.logger=r}}class bM{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new dM(this.core,this.logger),this.pairingTopics=new lM(this.core,this.logger),this.requests=new pM(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class dc extends G6{constructor(e){super(e),this.protocol=pb,this.version=bb,this.name=cc.name,this.events=new Or.exports.EventEmitter,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.removeAllListeners=i=>this.events.removeAllListeners(i),this.connect=async i=>{try{return await this.engine.connect(i)}catch(n){throw this.logger.error(n.message),n}},this.pair=async i=>{try{return await this.engine.pair(i)}catch(n){throw this.logger.error(n.message),n}},this.approve=async i=>{try{return await this.engine.approve(i)}catch(n){throw this.logger.error(n.message),n}},this.reject=async i=>{try{return await this.engine.reject(i)}catch(n){throw this.logger.error(n.message),n}},this.update=async i=>{try{return await this.engine.update(i)}catch(n){throw this.logger.error(n.message),n}},this.extend=async i=>{try{return await this.engine.extend(i)}catch(n){throw this.logger.error(n.message),n}},this.request=async i=>{try{return await this.engine.request(i)}catch(n){throw this.logger.error(n.message),n}},this.respond=async i=>{try{return await this.engine.respond(i)}catch(n){throw this.logger.error(n.message),n}},this.ping=async i=>{try{return await this.engine.ping(i)}catch(n){throw this.logger.error(n.message),n}},this.emit=async i=>{try{return await this.engine.emit(i)}catch(n){throw this.logger.error(n.message),n}},this.disconnect=async i=>{try{return await this.engine.disconnect(i)}catch(n){throw this.logger.error(n.message),n}},this.find=i=>{try{return this.engine.find(i)}catch(n){throw this.logger.error(n.message),n}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}},this.authenticate=async(i,n)=>{try{return await this.engine.authenticate(i,n)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=i=>{try{return this.engine.formatAuthMessage(i)}catch(n){throw this.logger.error(n.message),n}},this.approveSessionAuthenticate=async i=>{try{return await this.engine.approveSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}},this.rejectSessionAuthenticate=async i=>{try{return await this.engine.rejectSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||cc.name,this.metadata=e?.metadata||S1(),this.signConfig=e?.signConfig;const r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:an(kA({level:e?.logger||cc.logger}));this.core=e?.core||new oc(e),this.logger=GA(r,this.name),this.session=new wb(this.core,this.logger),this.proposal=new cM(this.core,this.logger),this.pendingRequest=new uM(this.core,this.logger),this.engine=new hM(this),this.auth=new bM(this.core,this.logger)}static async init(e){const r=new dc(e);return await r.initialize(),r}get context(){return lb(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),setTimeout(()=>{this.engine.processRelayMessageCache()},1e3)}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}const vM=wb,gM=dc;class mM extends Nf.exports{constructor(){super()}}class _b{constructor(e){this.opts=e}}class xb{constructor(e){this.client=e}}class Ab{constructor(e){this.engine=e}}var yM={};/*! *****************************************************************************
44
+ Copyright (c) Microsoft Corporation.
45
+
46
+ Permission to use, copy, modify, and/or distribute this software for any
47
+ purpose with or without fee is hereby granted.
48
+
49
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
50
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
51
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
52
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
53
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
54
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
55
+ PERFORMANCE OF THIS SOFTWARE.
56
+ ***************************************************************************** */var lc=function(t,e){return lc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},lc(t,e)};function wM(t,e){lc(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var pc=function(){return pc=Object.assign||function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},pc.apply(this,arguments)};function _M(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}function xM(t,e,r,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,i);else for(var h=t.length-1;h>=0;h--)(o=t[h])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s}function AM(t,e){return function(r,i){e(r,i,t)}}function MM(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function EM(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function h(w){try{p(i.next(w))}catch(M){o(M)}}function l(w){try{p(i.throw(w))}catch(M){o(M)}}function p(w){w.done?s(w.value):n(w.value).then(h,l)}p((i=i.apply(t,e||[])).next())})}function SM(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,o;return o={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function h(p){return function(w){return l([p,w])}}function l(p){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=p[0]&2?n.return:p[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,p[1])).done)return s;switch(n=0,s&&(p=[p[0]&2,s.value]),p[0]){case 0:case 1:s=p;break;case 4:return r.label++,{value:p[1],done:!1};case 5:r.label++,n=p[1],p=[0];continue;case 7:p=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(p[0]===6||p[0]===2)){r=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]<s[3])){r.label=p[1];break}if(p[0]===6&&r.label<s[1]){r.label=s[1],s=p;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(p);break}s[2]&&r.ops.pop(),r.trys.pop();continue}p=e.call(t,r)}catch(w){p=[6,w],n=0}finally{i=s=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function DM(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}function IM(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function bc(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Mb(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(h){o={error:h}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function NM(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Mb(arguments[e]));return t}function OM(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],o=0,h=s.length;o<h;o++,n++)i[n]=s[o];return i}function lf(t){return this instanceof lf?(this.v=t,this):new lf(t)}function RM(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(I){i[I]&&(n[I]=function(D){return new Promise(function(N,U){s.push([I,D,N,U])>1||h(I,D)})})}function h(I,D){try{l(i[I](D))}catch(N){M(s[0][3],N)}}function l(I){I.value instanceof lf?Promise.resolve(I.value.v).then(p,w):M(s[0][2],I)}function p(I){h("next",I)}function w(I){h("throw",I)}function M(I,D){I(D),s.shift(),s.length&&h(s[0][0],s[0][1])}}function CM(t){var e,r;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=t[n]?function(o){return(r=!r)?{value:lf(t[n](o)),done:n==="return"}:s?s(o):o}:s}}function PM(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof bc=="function"?bc(t):t[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(s){r[s]=t[s]&&function(o){return new Promise(function(h,l){o=t[s](o),n(h,l,o.done,o.value)})}}function n(s,o,h,l){Promise.resolve(l).then(function(p){s({value:p,done:h})},o)}}function TM(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function BM(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function FM(t){return t&&t.__esModule?t:{default:t}}function LM(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function UM(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var $M=Object.freeze({__proto__:null,__extends:wM,get __assign(){return pc},__rest:_M,__decorate:xM,__param:AM,__metadata:MM,__awaiter:EM,__generator:SM,__createBinding:DM,__exportStar:IM,__values:bc,__read:Mb,__spread:NM,__spreadArrays:OM,__await:lf,__asyncGenerator:RM,__asyncDelegator:CM,__asyncValues:PM,__makeTemplateObject:TM,__importStar:BM,__importDefault:FM,__classPrivateFieldGet:LM,__classPrivateFieldSet:UM}),zo=If($M),vc={},pf={},Eb;function qM(){if(Eb)return pf;Eb=1,Object.defineProperty(pf,"__esModule",{value:!0}),pf.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return pf.delay=t,pf}var ms={},gc={},ys={},Sb;function zM(){return Sb||(Sb=1,Object.defineProperty(ys,"__esModule",{value:!0}),ys.ONE_THOUSAND=ys.ONE_HUNDRED=void 0,ys.ONE_HUNDRED=100,ys.ONE_THOUSAND=1e3),ys}var mc={},Db;function kM(){return Db||(Db=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(mc)),mc}var Ib;function Nb(){return Ib||(Ib=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=zo;e.__exportStar(zM(),t),e.__exportStar(kM(),t)}(gc)),gc}var Ob;function KM(){if(Ob)return ms;Ob=1,Object.defineProperty(ms,"__esModule",{value:!0}),ms.fromMiliseconds=ms.toMiliseconds=void 0;const t=Nb();function e(i){return i*t.ONE_THOUSAND}ms.toMiliseconds=e;function r(i){return Math.floor(i/t.ONE_THOUSAND)}return ms.fromMiliseconds=r,ms}var Rb;function HM(){return Rb||(Rb=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=zo;e.__exportStar(qM(),t),e.__exportStar(KM(),t)}(vc)),vc}var fa={},Cb;function jM(){if(Cb)return fa;Cb=1,Object.defineProperty(fa,"__esModule",{value:!0}),fa.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const i=this.get(r);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const n=Date.now()-i.started;this.timestamps.set(r,{started:i.started,elapsed:n})}get(r){const i=this.timestamps.get(r);if(typeof i>"u")throw new Error(`No timestamp found for label: ${r}`);return i}elapsed(r){const i=this.get(r);return i.elapsed||Date.now()-i.started}}return fa.Watch=t,fa.default=t,fa}var yc={},bf={},Pb;function GM(){if(Pb)return bf;Pb=1,Object.defineProperty(bf,"__esModule",{value:!0}),bf.IWatch=void 0;class t{}return bf.IWatch=t,bf}var Tb;function VM(){return Tb||(Tb=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),zo.__exportStar(GM(),t)}(yc)),yc}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=zo;e.__exportStar(HM(),t),e.__exportStar(jM(),t),e.__exportStar(VM(),t),e.__exportStar(Nb(),t)})(yM);var xt={};Object.defineProperty(xt,"__esModule",{value:!0}),xt.getLocalStorage=xt.getLocalStorageOrThrow=xt.getCrypto=xt.getCryptoOrThrow=xt.getLocation=xt.getLocationOrThrow=_c=xt.getNavigator=xt.getNavigatorOrThrow=wc=xt.getDocument=xt.getDocumentOrThrow=xt.getFromWindowOrThrow=xt.getFromWindow=void 0;function ws(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}xt.getFromWindow=ws;function oa(t){const e=ws(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}xt.getFromWindowOrThrow=oa;function YM(){return oa("document")}xt.getDocumentOrThrow=YM;function JM(){return ws("document")}var wc=xt.getDocument=JM;function WM(){return oa("navigator")}xt.getNavigatorOrThrow=WM;function QM(){return ws("navigator")}var _c=xt.getNavigator=QM;function XM(){return oa("location")}xt.getLocationOrThrow=XM;function ZM(){return ws("location")}xt.getLocation=ZM;function eE(){return oa("crypto")}xt.getCryptoOrThrow=eE;function tE(){return ws("crypto")}xt.getCrypto=tE;function rE(){return oa("localStorage")}xt.getLocalStorageOrThrow=rE;function iE(){return ws("localStorage")}xt.getLocalStorage=iE;var xc={};Object.defineProperty(xc,"__esModule",{value:!0}),xc.getWindowMetadata=void 0;const Bb=xt;function nE(){let t,e;try{t=Bb.getDocumentOrThrow(),e=Bb.getLocationOrThrow()}catch{return null}function r(){const M=t.getElementsByTagName("link"),I=[];for(let D=0;D<M.length;D++){const N=M[D],U=N.getAttribute("rel");if(U&&U.toLowerCase().indexOf("icon")>-1){const z=N.getAttribute("href");if(z)if(z.toLowerCase().indexOf("https:")===-1&&z.toLowerCase().indexOf("http:")===-1&&z.indexOf("//")!==0){let H=e.protocol+"//"+e.host;if(z.indexOf("/")===0)H+=z;else{const L=e.pathname.split("/");L.pop();const K=L.join("/");H+=K+"/"+z}I.push(H)}else if(z.indexOf("//")===0){const H=e.protocol+z;I.push(H)}else I.push(z)}}return I}function i(...M){const I=t.getElementsByTagName("meta");for(let D=0;D<I.length;D++){const N=I[D],U=["itemprop","property","name"].map(z=>N.getAttribute(z)).filter(z=>z?M.includes(z):!1);if(U.length&&U){const z=N.getAttribute("content");if(z)return z}}return""}function n(){let M=i("name","og:site_name","og:title","twitter:title");return M||(M=t.title),M}function s(){return i("description","og:description","twitter:description","keywords")}const o=n(),h=s(),l=e.origin,p=r();return{description:h,url:l,icons:p,name:o}}xc.getWindowMetadata=nE;var sE={},aE=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Fb="%[a-f0-9]{2}",Lb=new RegExp("("+Fb+")|([^%]+?)","gi"),Ub=new RegExp("("+Fb+")+","gi");function Ac(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),i=t.slice(e);return Array.prototype.concat.call([],Ac(r),Ac(i))}function fE(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(Lb)||[],r=1;r<e.length;r++)t=Ac(e,r).join(""),e=t.match(Lb)||[];return t}}function oE(t){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},r=Ub.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch{var i=fE(r[0]);i!==r[0]&&(e[r[0]]=i)}r=Ub.exec(t)}e["%C2"]="\uFFFD";for(var n=Object.keys(e),s=0;s<n.length;s++){var o=n[s];t=t.replace(new RegExp(o,"g"),e[o])}return t}var hE=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return oE(t)}},cE=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},uE=function(t,e){for(var r={},i=Object.keys(t),n=Array.isArray(e),s=0;s<i.length;s++){var o=i[s],h=t[o];(n?e.indexOf(o)!==-1:e(o,h,t))&&(r[o]=h)}return r};(function(t){const e=aE,r=hE,i=cE,n=uE,s=L=>L==null,o=Symbol("encodeFragmentIdentifier");function h(L){switch(L.arrayFormat){case"index":return K=>(F,$)=>{const q=F.length;return $===void 0||L.skipNull&&$===null||L.skipEmptyString&&$===""?F:$===null?[...F,[w(K,L),"[",q,"]"].join("")]:[...F,[w(K,L),"[",w(q,L),"]=",w($,L)].join("")]};case"bracket":return K=>(F,$)=>$===void 0||L.skipNull&&$===null||L.skipEmptyString&&$===""?F:$===null?[...F,[w(K,L),"[]"].join("")]:[...F,[w(K,L),"[]=",w($,L)].join("")];case"colon-list-separator":return K=>(F,$)=>$===void 0||L.skipNull&&$===null||L.skipEmptyString&&$===""?F:$===null?[...F,[w(K,L),":list="].join("")]:[...F,[w(K,L),":list=",w($,L)].join("")];case"comma":case"separator":case"bracket-separator":{const K=L.arrayFormat==="bracket-separator"?"[]=":"=";return F=>($,q)=>q===void 0||L.skipNull&&q===null||L.skipEmptyString&&q===""?$:(q=q===null?"":q,$.length===0?[[w(F,L),K,w(q,L)].join("")]:[[$,w(q,L)].join(L.arrayFormatSeparator)])}default:return K=>(F,$)=>$===void 0||L.skipNull&&$===null||L.skipEmptyString&&$===""?F:$===null?[...F,w(K,L)]:[...F,[w(K,L),"=",w($,L)].join("")]}}function l(L){let K;switch(L.arrayFormat){case"index":return(F,$,q)=>{if(K=/\[(\d*)\]$/.exec(F),F=F.replace(/\[\d*\]$/,""),!K){q[F]=$;return}q[F]===void 0&&(q[F]={}),q[F][K[1]]=$};case"bracket":return(F,$,q)=>{if(K=/(\[\])$/.exec(F),F=F.replace(/\[\]$/,""),!K){q[F]=$;return}if(q[F]===void 0){q[F]=[$];return}q[F]=[].concat(q[F],$)};case"colon-list-separator":return(F,$,q)=>{if(K=/(:list)$/.exec(F),F=F.replace(/:list$/,""),!K){q[F]=$;return}if(q[F]===void 0){q[F]=[$];return}q[F]=[].concat(q[F],$)};case"comma":case"separator":return(F,$,q)=>{const y=typeof $=="string"&&$.includes(L.arrayFormatSeparator),R=typeof $=="string"&&!y&&M($,L).includes(L.arrayFormatSeparator);$=R?M($,L):$;const V=y||R?$.split(L.arrayFormatSeparator).map(Q=>M(Q,L)):$===null?$:M($,L);q[F]=V};case"bracket-separator":return(F,$,q)=>{const y=/(\[\])$/.test(F);if(F=F.replace(/\[\]$/,""),!y){q[F]=$&&M($,L);return}const R=$===null?[]:$.split(L.arrayFormatSeparator).map(V=>M(V,L));if(q[F]===void 0){q[F]=R;return}q[F]=[].concat(q[F],R)};default:return(F,$,q)=>{if(q[F]===void 0){q[F]=$;return}q[F]=[].concat(q[F],$)}}}function p(L){if(typeof L!="string"||L.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function w(L,K){return K.encode?K.strict?e(L):encodeURIComponent(L):L}function M(L,K){return K.decode?r(L):L}function I(L){return Array.isArray(L)?L.sort():typeof L=="object"?I(Object.keys(L)).sort((K,F)=>Number(K)-Number(F)).map(K=>L[K]):L}function D(L){const K=L.indexOf("#");return K!==-1&&(L=L.slice(0,K)),L}function N(L){let K="";const F=L.indexOf("#");return F!==-1&&(K=L.slice(F)),K}function U(L){L=D(L);const K=L.indexOf("?");return K===-1?"":L.slice(K+1)}function z(L,K){return K.parseNumbers&&!Number.isNaN(Number(L))&&typeof L=="string"&&L.trim()!==""?L=Number(L):K.parseBooleans&&L!==null&&(L.toLowerCase()==="true"||L.toLowerCase()==="false")&&(L=L.toLowerCase()==="true"),L}function H(L,K){K=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},K),p(K.arrayFormatSeparator);const F=l(K),$=Object.create(null);if(typeof L!="string"||(L=L.trim().replace(/^[?#&]/,""),!L))return $;for(const q of L.split("&")){if(q==="")continue;let[y,R]=i(K.decode?q.replace(/\+/g," "):q,"=");R=R===void 0?null:["comma","separator","bracket-separator"].includes(K.arrayFormat)?R:M(R,K),F(M(y,K),R,$)}for(const q of Object.keys($)){const y=$[q];if(typeof y=="object"&&y!==null)for(const R of Object.keys(y))y[R]=z(y[R],K);else $[q]=z(y,K)}return K.sort===!1?$:(K.sort===!0?Object.keys($).sort():Object.keys($).sort(K.sort)).reduce((q,y)=>{const R=$[y];return R&&typeof R=="object"&&!Array.isArray(R)?q[y]=I(R):q[y]=R,q},Object.create(null))}t.extract=U,t.parse=H,t.stringify=(L,K)=>{if(!L)return"";K=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},K),p(K.arrayFormatSeparator);const F=R=>K.skipNull&&s(L[R])||K.skipEmptyString&&L[R]==="",$=h(K),q={};for(const R of Object.keys(L))F(R)||(q[R]=L[R]);const y=Object.keys(q);return K.sort!==!1&&y.sort(K.sort),y.map(R=>{const V=L[R];return V===void 0?"":V===null?w(R,K):Array.isArray(V)?V.length===0&&K.arrayFormat==="bracket-separator"?w(R,K)+"[]":V.reduce($(R),[]).join("&"):w(R,K)+"="+w(V,K)}).filter(R=>R.length>0).join("&")},t.parseUrl=(L,K)=>{K=Object.assign({decode:!0},K);const[F,$]=i(L,"#");return Object.assign({url:F.split("?")[0]||"",query:H(U(L),K)},K&&K.parseFragmentIdentifier&&$?{fragmentIdentifier:M($,K)}:{})},t.stringifyUrl=(L,K)=>{K=Object.assign({encode:!0,strict:!0,[o]:!0},K);const F=D(L.url).split("?")[0]||"",$=t.extract(L.url),q=t.parse($,{sort:!1}),y=Object.assign(q,L.query);let R=t.stringify(y,K);R&&(R=`?${R}`);let V=N(L.url);return L.fragmentIdentifier&&(V=`#${K[o]?w(L.fragmentIdentifier,K):L.fragmentIdentifier}`),`${F}${R}${V}`},t.pick=(L,K,F)=>{F=Object.assign({parseFragmentIdentifier:!0,[o]:!1},F);const{url:$,query:q,fragmentIdentifier:y}=t.parseUrl(L,F);return t.stringifyUrl({url:$,query:n(q,K),fragmentIdentifier:y},F)},t.exclude=(L,K,F)=>{const $=Array.isArray(K)?q=>!K.includes(q):(q,y)=>!K(q,y);return t.pick(L,$,F)}})(sE);var dE={exports:{}};/**
57
+ * [js-sha3]{@link https://github.com/emn178/js-sha3}
58
+ *
59
+ * @version 0.8.0
60
+ * @author Chen, Yi-Cyuan [emn178@gmail.com]
61
+ * @copyright Chen, Yi-Cyuan 2015-2018
62
+ * @license MIT
63
+ */(function(t){(function(){var e="input is invalid type",r="finalize already called",i=typeof window=="object",n=i?window:{};n.JS_SHA3_NO_WINDOW&&(i=!1);var s=!i&&typeof self=="object",o=!n.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?n=Bt:s&&(n=self);var h=!n.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,l=!n.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),w=[31,7936,2031616,520093696],M=[4,1024,262144,67108864],I=[1,256,65536,16777216],D=[6,1536,393216,100663296],N=[0,8,16,24],U=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],z=[224,256,384,512],H=[128,256],L=["hex","buffer","arrayBuffer","array","digest"],K={128:168,256:136};(n.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(E){return Object.prototype.toString.call(E)==="[object Array]"}),l&&(n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(E){return typeof E=="object"&&E.buffer&&E.buffer.constructor===ArrayBuffer});for(var F=function(E,k,C){return function(B){return new v(E,k,E).update(B)[C]()}},$=function(E,k,C){return function(B,P){return new v(E,k,P).update(B)[C]()}},q=function(E,k,C){return function(B,P,g,T){return a["cshake"+E].update(B,P,g,T)[C]()}},y=function(E,k,C){return function(B,P,g,T){return a["kmac"+E].update(B,P,g,T)[C]()}},R=function(E,k,C,B){for(var P=0;P<L.length;++P){var g=L[P];E[g]=k(C,B,g)}return E},V=function(E,k){var C=F(E,k,"hex");return C.create=function(){return new v(E,k,E)},C.update=function(B){return C.create().update(B)},R(C,F,E,k)},Q=function(E,k){var C=$(E,k,"hex");return C.create=function(B){return new v(E,k,B)},C.update=function(B,P){return C.create(P).update(B)},R(C,$,E,k)},O=function(E,k){var C=K[E],B=q(E,k,"hex");return B.create=function(P,g,T){return!g&&!T?a["shake"+E].create(P):new v(E,k,P).bytepad([g,T],C)},B.update=function(P,g,T,j){return B.create(g,T,j).update(P)},R(B,q,E,k)},d=function(E,k){var C=K[E],B=y(E,k,"hex");return B.create=function(P,g,T){return new S(E,k,g).bytepad(["KMAC",T],C).bytepad([P],C)},B.update=function(P,g,T,j){return B.create(P,T,j).update(g)},R(B,y,E,k)},u=[{name:"keccak",padding:I,bits:z,createMethod:V},{name:"sha3",padding:D,bits:z,createMethod:V},{name:"shake",padding:w,bits:H,createMethod:Q},{name:"cshake",padding:M,bits:H,createMethod:O},{name:"kmac",padding:M,bits:H,createMethod:d}],a={},f=[],b=0;b<u.length;++b)for(var x=u[b],A=x.bits,_=0;_<A.length;++_){var c=x.name+"_"+A[_];if(f.push(c),a[c]=x.createMethod(A[_],x.padding),x.name!=="sha3"){var m=x.name+A[_];f.push(m),a[m]=a[c]}}function v(E,k,C){this.blocks=[],this.s=[],this.padding=k,this.outputBits=C,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(E<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=C>>5,this.extraBytes=(C&31)>>3;for(var B=0;B<50;++B)this.s[B]=0}v.prototype.update=function(E){if(this.finalized)throw new Error(r);var k,C=typeof E;if(C!=="string"){if(C==="object"){if(E===null)throw new Error(e);if(l&&E.constructor===ArrayBuffer)E=new Uint8Array(E);else if(!Array.isArray(E)&&(!l||!ArrayBuffer.isView(E)))throw new Error(e)}else throw new Error(e);k=!0}for(var B=this.blocks,P=this.byteCount,g=E.length,T=this.blockCount,j=0,J=this.s,W,X;j<g;){if(this.reset)for(this.reset=!1,B[0]=this.block,W=1;W<T+1;++W)B[W]=0;if(k)for(W=this.start;j<g&&W<P;++j)B[W>>2]|=E[j]<<N[W++&3];else for(W=this.start;j<g&&W<P;++j)X=E.charCodeAt(j),X<128?B[W>>2]|=X<<N[W++&3]:X<2048?(B[W>>2]|=(192|X>>6)<<N[W++&3],B[W>>2]|=(128|X&63)<<N[W++&3]):X<55296||X>=57344?(B[W>>2]|=(224|X>>12)<<N[W++&3],B[W>>2]|=(128|X>>6&63)<<N[W++&3],B[W>>2]|=(128|X&63)<<N[W++&3]):(X=65536+((X&1023)<<10|E.charCodeAt(++j)&1023),B[W>>2]|=(240|X>>18)<<N[W++&3],B[W>>2]|=(128|X>>12&63)<<N[W++&3],B[W>>2]|=(128|X>>6&63)<<N[W++&3],B[W>>2]|=(128|X&63)<<N[W++&3]);if(this.lastByteIndex=W,W>=P){for(this.start=W-P,this.block=B[T],W=0;W<T;++W)J[W]^=B[W];G(J),this.reset=!0}else this.start=W}return this},v.prototype.encode=function(E,k){var C=E&255,B=1,P=[C];for(E=E>>8,C=E&255;C>0;)P.unshift(C),E=E>>8,C=E&255,++B;return k?P.push(B):P.unshift(B),this.update(P),P.length},v.prototype.encodeString=function(E){var k,C=typeof E;if(C!=="string"){if(C==="object"){if(E===null)throw new Error(e);if(l&&E.constructor===ArrayBuffer)E=new Uint8Array(E);else if(!Array.isArray(E)&&(!l||!ArrayBuffer.isView(E)))throw new Error(e)}else throw new Error(e);k=!0}var B=0,P=E.length;if(k)B=P;else for(var g=0;g<E.length;++g){var T=E.charCodeAt(g);T<128?B+=1:T<2048?B+=2:T<55296||T>=57344?B+=3:(T=65536+((T&1023)<<10|E.charCodeAt(++g)&1023),B+=4)}return B+=this.encode(B*8),this.update(E),B},v.prototype.bytepad=function(E,k){for(var C=this.encode(k),B=0;B<E.length;++B)C+=this.encodeString(E[B]);var P=k-C%k,g=[];return g.length=P,this.update(g),this},v.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var E=this.blocks,k=this.lastByteIndex,C=this.blockCount,B=this.s;if(E[k>>2]|=this.padding[k&3],this.lastByteIndex===this.byteCount)for(E[0]=E[C],k=1;k<C+1;++k)E[k]=0;for(E[C-1]|=2147483648,k=0;k<C;++k)B[k]^=E[k];G(B)}},v.prototype.toString=v.prototype.hex=function(){this.finalize();for(var E=this.blockCount,k=this.s,C=this.outputBlocks,B=this.extraBytes,P=0,g=0,T="",j;g<C;){for(P=0;P<E&&g<C;++P,++g)j=k[P],T+=p[j>>4&15]+p[j&15]+p[j>>12&15]+p[j>>8&15]+p[j>>20&15]+p[j>>16&15]+p[j>>28&15]+p[j>>24&15];g%E===0&&(G(k),P=0)}return B&&(j=k[P],T+=p[j>>4&15]+p[j&15],B>1&&(T+=p[j>>12&15]+p[j>>8&15]),B>2&&(T+=p[j>>20&15]+p[j>>16&15])),T},v.prototype.arrayBuffer=function(){this.finalize();var E=this.blockCount,k=this.s,C=this.outputBlocks,B=this.extraBytes,P=0,g=0,T=this.outputBits>>3,j;B?j=new ArrayBuffer(C+1<<2):j=new ArrayBuffer(T);for(var J=new Uint32Array(j);g<C;){for(P=0;P<E&&g<C;++P,++g)J[g]=k[P];g%E===0&&G(k)}return B&&(J[P]=k[P],j=j.slice(0,T)),j},v.prototype.buffer=v.prototype.arrayBuffer,v.prototype.digest=v.prototype.array=function(){this.finalize();for(var E=this.blockCount,k=this.s,C=this.outputBlocks,B=this.extraBytes,P=0,g=0,T=[],j,J;g<C;){for(P=0;P<E&&g<C;++P,++g)j=g<<2,J=k[P],T[j]=J&255,T[j+1]=J>>8&255,T[j+2]=J>>16&255,T[j+3]=J>>24&255;g%E===0&&G(k)}return B&&(j=g<<2,J=k[P],T[j]=J&255,B>1&&(T[j+1]=J>>8&255),B>2&&(T[j+2]=J>>16&255)),T};function S(E,k,C){v.call(this,E,k,C)}S.prototype=new v,S.prototype.finalize=function(){return this.encode(this.outputBits,!0),v.prototype.finalize.call(this)};var G=function(E){var k,C,B,P,g,T,j,J,W,X,ve,_e,ae,De,me,ie,de,he,te,fe,se,ee,le,ge,re,ye,we,ne,xe,Ae,Me,Ke,He,Ee,je,Ve,Ie,Re,Oe,ce,Ce,Pe,oe,Fe,Le,pe,Ue,$e,ue,Te,Ne,be,qe,We,Be,Qe,Ge,Je,lt,pt,bt,vt,ct;for(B=0;B<48;B+=2)P=E[0]^E[10]^E[20]^E[30]^E[40],g=E[1]^E[11]^E[21]^E[31]^E[41],T=E[2]^E[12]^E[22]^E[32]^E[42],j=E[3]^E[13]^E[23]^E[33]^E[43],J=E[4]^E[14]^E[24]^E[34]^E[44],W=E[5]^E[15]^E[25]^E[35]^E[45],X=E[6]^E[16]^E[26]^E[36]^E[46],ve=E[7]^E[17]^E[27]^E[37]^E[47],_e=E[8]^E[18]^E[28]^E[38]^E[48],ae=E[9]^E[19]^E[29]^E[39]^E[49],k=_e^(T<<1|j>>>31),C=ae^(j<<1|T>>>31),E[0]^=k,E[1]^=C,E[10]^=k,E[11]^=C,E[20]^=k,E[21]^=C,E[30]^=k,E[31]^=C,E[40]^=k,E[41]^=C,k=P^(J<<1|W>>>31),C=g^(W<<1|J>>>31),E[2]^=k,E[3]^=C,E[12]^=k,E[13]^=C,E[22]^=k,E[23]^=C,E[32]^=k,E[33]^=C,E[42]^=k,E[43]^=C,k=T^(X<<1|ve>>>31),C=j^(ve<<1|X>>>31),E[4]^=k,E[5]^=C,E[14]^=k,E[15]^=C,E[24]^=k,E[25]^=C,E[34]^=k,E[35]^=C,E[44]^=k,E[45]^=C,k=J^(_e<<1|ae>>>31),C=W^(ae<<1|_e>>>31),E[6]^=k,E[7]^=C,E[16]^=k,E[17]^=C,E[26]^=k,E[27]^=C,E[36]^=k,E[37]^=C,E[46]^=k,E[47]^=C,k=X^(P<<1|g>>>31),C=ve^(g<<1|P>>>31),E[8]^=k,E[9]^=C,E[18]^=k,E[19]^=C,E[28]^=k,E[29]^=C,E[38]^=k,E[39]^=C,E[48]^=k,E[49]^=C,De=E[0],me=E[1],pe=E[11]<<4|E[10]>>>28,Ue=E[10]<<4|E[11]>>>28,ne=E[20]<<3|E[21]>>>29,xe=E[21]<<3|E[20]>>>29,pt=E[31]<<9|E[30]>>>23,bt=E[30]<<9|E[31]>>>23,Pe=E[40]<<18|E[41]>>>14,oe=E[41]<<18|E[40]>>>14,Ee=E[2]<<1|E[3]>>>31,je=E[3]<<1|E[2]>>>31,ie=E[13]<<12|E[12]>>>20,de=E[12]<<12|E[13]>>>20,$e=E[22]<<10|E[23]>>>22,ue=E[23]<<10|E[22]>>>22,Ae=E[33]<<13|E[32]>>>19,Me=E[32]<<13|E[33]>>>19,vt=E[42]<<2|E[43]>>>30,ct=E[43]<<2|E[42]>>>30,We=E[5]<<30|E[4]>>>2,Be=E[4]<<30|E[5]>>>2,Ve=E[14]<<6|E[15]>>>26,Ie=E[15]<<6|E[14]>>>26,he=E[25]<<11|E[24]>>>21,te=E[24]<<11|E[25]>>>21,Te=E[34]<<15|E[35]>>>17,Ne=E[35]<<15|E[34]>>>17,Ke=E[45]<<29|E[44]>>>3,He=E[44]<<29|E[45]>>>3,ge=E[6]<<28|E[7]>>>4,re=E[7]<<28|E[6]>>>4,Qe=E[17]<<23|E[16]>>>9,Ge=E[16]<<23|E[17]>>>9,Re=E[26]<<25|E[27]>>>7,Oe=E[27]<<25|E[26]>>>7,fe=E[36]<<21|E[37]>>>11,se=E[37]<<21|E[36]>>>11,be=E[47]<<24|E[46]>>>8,qe=E[46]<<24|E[47]>>>8,Fe=E[8]<<27|E[9]>>>5,Le=E[9]<<27|E[8]>>>5,ye=E[18]<<20|E[19]>>>12,we=E[19]<<20|E[18]>>>12,Je=E[29]<<7|E[28]>>>25,lt=E[28]<<7|E[29]>>>25,ce=E[38]<<8|E[39]>>>24,Ce=E[39]<<8|E[38]>>>24,ee=E[48]<<14|E[49]>>>18,le=E[49]<<14|E[48]>>>18,E[0]=De^~ie&he,E[1]=me^~de&te,E[10]=ge^~ye&ne,E[11]=re^~we&xe,E[20]=Ee^~Ve&Re,E[21]=je^~Ie&Oe,E[30]=Fe^~pe&$e,E[31]=Le^~Ue&ue,E[40]=We^~Qe&Je,E[41]=Be^~Ge&lt,E[2]=ie^~he&fe,E[3]=de^~te&se,E[12]=ye^~ne&Ae,E[13]=we^~xe&Me,E[22]=Ve^~Re&ce,E[23]=Ie^~Oe&Ce,E[32]=pe^~$e&Te,E[33]=Ue^~ue&Ne,E[42]=Qe^~Je&pt,E[43]=Ge^~lt&bt,E[4]=he^~fe&ee,E[5]=te^~se&le,E[14]=ne^~Ae&Ke,E[15]=xe^~Me&He,E[24]=Re^~ce&Pe,E[25]=Oe^~Ce&oe,E[34]=$e^~Te&be,E[35]=ue^~Ne&qe,E[44]=Je^~pt&vt,E[45]=lt^~bt&ct,E[6]=fe^~ee&De,E[7]=se^~le&me,E[16]=Ae^~Ke&ge,E[17]=Me^~He&re,E[26]=ce^~Pe&Ee,E[27]=Ce^~oe&je,E[36]=Te^~be&Fe,E[37]=Ne^~qe&Le,E[46]=pt^~vt&We,E[47]=bt^~ct&Be,E[8]=ee^~De&ie,E[9]=le^~me&de,E[18]=Ke^~ge&ye,E[19]=He^~re&we,E[28]=Pe^~Ee&Ve,E[29]=oe^~je&Ie,E[38]=be^~Fe&pe,E[39]=qe^~Le&Ue,E[48]=vt^~We&Qe,E[49]=ct^~Be&Ge,E[0]^=U[B],E[1]^=U[B+1]};if(h)t.exports=a;else for(b=0;b<f.length;++b)n[f[b]]=a[f[b]]})()})(dE);const lE="logger/5.7.0";let $b=!1,qb=!1;const ko={debug:1,default:2,info:2,warning:3,error:4,off:5};let zb=ko.default,Mc=null;function pE(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}const kb=pE();var Ec;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(Ec||(Ec={}));var Di;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(Di||(Di={}));const Kb="0123456789abcdef";class it{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const i=e.toLowerCase();ko[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(zb>ko[i])&&console.log.apply(console,r)}debug(...e){this._log(it.levels.DEBUG,e)}info(...e){this._log(it.levels.INFO,e)}warn(...e){this._log(it.levels.WARNING,e)}makeError(e,r,i){if(qb)return this.makeError("censored error",r,{});r||(r=it.errors.UNKNOWN_ERROR),i||(i={});const n=[];Object.keys(i).forEach(l=>{const p=i[l];try{if(p instanceof Uint8Array){let w="";for(let M=0;M<p.length;M++)w+=Kb[p[M]>>4],w+=Kb[p[M]&15];n.push(l+"=Uint8Array(0x"+w+")")}else n.push(l+"="+JSON.stringify(p))}catch{n.push(l+"="+JSON.stringify(i[l].toString()))}}),n.push(`code=${r}`),n.push(`version=${this.version}`);const s=e;let o="";switch(r){case Di.NUMERIC_FAULT:{o="NUMERIC_FAULT";const l=e;switch(l){case"overflow":case"underflow":case"division-by-zero":o+="-"+l;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case Di.CALL_EXCEPTION:case Di.INSUFFICIENT_FUNDS:case Di.MISSING_NEW:case Di.NONCE_EXPIRED:case Di.REPLACEMENT_UNDERPRICED:case Di.TRANSACTION_REPLACED:case Di.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const h=new Error(e);return h.reason=s,h.code=r,Object.keys(i).forEach(function(l){h[l]=i[l]}),h}throwError(e,r,i){throw this.makeError(e,r,i)}throwArgumentError(e,r,i){return this.throwError(e,it.errors.INVALID_ARGUMENT,{argument:r,value:i})}assert(e,r,i,n){e||this.throwError(r,i,n)}assertArgument(e,r,i,n){e||this.throwArgumentError(r,i,n)}checkNormalize(e){kb&&this.throwError("platform missing String.prototype.normalize",it.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:kb})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,it.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,it.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,i){i?i=": "+i:i="",e<r&&this.throwError("missing argument"+i,it.errors.MISSING_ARGUMENT,{count:e,expectedCount:r}),e>r&&this.throwError("too many arguments"+i,it.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",it.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",it.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",it.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return Mc||(Mc=new it(lE)),Mc}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",it.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),$b){if(!e)return;this.globalLogger().throwError("error censorship permanent",it.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}qb=!!e,$b=!!r}static setLogLevel(e){const r=ko[e.toLowerCase()];if(r==null){it.globalLogger().warn("invalid log level - "+e);return}zb=r}static from(e){return new it(e)}}it.errors=Di,it.levels=Ec;const bE="bytes/5.7.0",qn=new it(bE);function Hb(t){return!!t.toHexString}function Ko(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ko(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function jb(t){return typeof t=="number"&&t==t&&t%1===0}function vf(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!jb(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!jb(r)||r<0||r>=256)return!1}return!0}function Gb(t,e){if(e||(e={}),typeof t=="number"){qn.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Ko(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),Hb(t)&&(t=t.toHexString()),ha(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":qn.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let n=0;n<r.length;n+=2)i.push(parseInt(r.substring(n,n+2),16));return Ko(new Uint8Array(i))}return vf(t)?Ko(new Uint8Array(t)):qn.throwArgumentError("invalid arrayify value","value",t)}function ha(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Sc="0123456789abcdef";function Vb(t,e){if(e||(e={}),typeof t=="number"){qn.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=Sc[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),Hb(t))return t.toHexString();if(ha(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":qn.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(vf(t)){let r="0x";for(let i=0;i<t.length;i++){let n=t[i];r+=Sc[(n&240)>>4]+Sc[n&15]}return r}return qn.throwArgumentError("invalid hexlify value","value",t)}function Ho(t,e){for(typeof t!="string"?t=Vb(t):ha(t)||qn.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&qn.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}var Yb={exports:{}};(function(t){(function(e,r){function i(u,a){if(!u)throw new Error(a||"Assertion failed")}function n(u,a){u.super_=a;var f=function(){};f.prototype=a.prototype,u.prototype=new f,u.prototype.constructor=u}function s(u,a,f){if(s.isBN(u))return u;this.negative=0,this.words=null,this.length=0,this.red=null,u!==null&&((a==="le"||a==="be")&&(f=a,a=10),this._init(u||0,a||10,f||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=Nn.Buffer}catch{}s.isBN=function(a){return a instanceof s?!0:a!==null&&typeof a=="object"&&a.constructor.wordSize===s.wordSize&&Array.isArray(a.words)},s.max=function(a,f){return a.cmp(f)>0?a:f},s.min=function(a,f){return a.cmp(f)<0?a:f},s.prototype._init=function(a,f,b){if(typeof a=="number")return this._initNumber(a,f,b);if(typeof a=="object")return this._initArray(a,f,b);f==="hex"&&(f=16),i(f===(f|0)&&f>=2&&f<=36),a=a.toString().replace(/\s+/g,"");var x=0;a[0]==="-"&&(x++,this.negative=1),x<a.length&&(f===16?this._parseHex(a,x,b):(this._parseBase(a,f,x),b==="le"&&this._initArray(this.toArray(),f,b)))},s.prototype._initNumber=function(a,f,b){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[a&67108863],this.length=1):a<4503599627370496?(this.words=[a&67108863,a/67108864&67108863],this.length=2):(i(a<9007199254740992),this.words=[a&67108863,a/67108864&67108863,1],this.length=3),b==="le"&&this._initArray(this.toArray(),f,b)},s.prototype._initArray=function(a,f,b){if(i(typeof a.length=="number"),a.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(a.length/3),this.words=new Array(this.length);for(var x=0;x<this.length;x++)this.words[x]=0;var A,_,c=0;if(b==="be")for(x=a.length-1,A=0;x>=0;x-=3)_=a[x]|a[x-1]<<8|a[x-2]<<16,this.words[A]|=_<<c&67108863,this.words[A+1]=_>>>26-c&67108863,c+=24,c>=26&&(c-=26,A++);else if(b==="le")for(x=0,A=0;x<a.length;x+=3)_=a[x]|a[x+1]<<8|a[x+2]<<16,this.words[A]|=_<<c&67108863,this.words[A+1]=_>>>26-c&67108863,c+=24,c>=26&&(c-=26,A++);return this._strip()};function h(u,a){var f=u.charCodeAt(a);if(f>=48&&f<=57)return f-48;if(f>=65&&f<=70)return f-55;if(f>=97&&f<=102)return f-87;i(!1,"Invalid character in "+u)}function l(u,a,f){var b=h(u,f);return f-1>=a&&(b|=h(u,f-1)<<4),b}s.prototype._parseHex=function(a,f,b){this.length=Math.ceil((a.length-f)/6),this.words=new Array(this.length);for(var x=0;x<this.length;x++)this.words[x]=0;var A=0,_=0,c;if(b==="be")for(x=a.length-1;x>=f;x-=2)c=l(a,f,x)<<A,this.words[_]|=c&67108863,A>=18?(A-=18,_+=1,this.words[_]|=c>>>26):A+=8;else{var m=a.length-f;for(x=m%2===0?f+1:f;x<a.length;x+=2)c=l(a,f,x)<<A,this.words[_]|=c&67108863,A>=18?(A-=18,_+=1,this.words[_]|=c>>>26):A+=8}this._strip()};function p(u,a,f,b){for(var x=0,A=0,_=Math.min(u.length,f),c=a;c<_;c++){var m=u.charCodeAt(c)-48;x*=b,m>=49?A=m-49+10:m>=17?A=m-17+10:A=m,i(m>=0&&A<b,"Invalid character"),x+=A}return x}s.prototype._parseBase=function(a,f,b){this.words=[0],this.length=1;for(var x=0,A=1;A<=67108863;A*=f)x++;x--,A=A/f|0;for(var _=a.length-b,c=_%x,m=Math.min(_,_-c)+b,v=0,S=b;S<m;S+=x)v=p(a,S,S+x,f),this.imuln(A),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v);if(c!==0){var G=1;for(v=p(a,S,a.length,f),S=0;S<c;S++)G*=f;this.imuln(G),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v)}this._strip()},s.prototype.copy=function(a){a.words=new Array(this.length);for(var f=0;f<this.length;f++)a.words[f]=this.words[f];a.length=this.length,a.negative=this.negative,a.red=this.red};function w(u,a){u.words=a.words,u.length=a.length,u.negative=a.negative,u.red=a.red}if(s.prototype._move=function(a){w(a,this)},s.prototype.clone=function(){var a=new s(null);return this.copy(a),a},s.prototype._expand=function(a){for(;this.length<a;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=M}catch{s.prototype.inspect=M}else s.prototype.inspect=M;function M(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var I=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],D=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],N=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(a,f){a=a||10,f=f|0||1;var b;if(a===16||a==="hex"){b="";for(var x=0,A=0,_=0;_<this.length;_++){var c=this.words[_],m=((c<<x|A)&16777215).toString(16);A=c>>>24-x&16777215,x+=2,x>=26&&(x-=26,_--),A!==0||_!==this.length-1?b=I[6-m.length]+m+b:b=m+b}for(A!==0&&(b=A.toString(16)+b);b.length%f!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}if(a===(a|0)&&a>=2&&a<=36){var v=D[a],S=N[a];b="";var G=this.clone();for(G.negative=0;!G.isZero();){var E=G.modrn(S).toString(a);G=G.idivn(S),G.isZero()?b=E+b:b=I[v-E.length]+E+b}for(this.isZero()&&(b="0"+b);b.length%f!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var a=this.words[0];return this.length===2?a+=this.words[1]*67108864:this.length===3&&this.words[2]===1?a+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-a:a},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(a,f){return this.toArrayLike(o,a,f)}),s.prototype.toArray=function(a,f){return this.toArrayLike(Array,a,f)};var U=function(a,f){return a.allocUnsafe?a.allocUnsafe(f):new a(f)};s.prototype.toArrayLike=function(a,f,b){this._strip();var x=this.byteLength(),A=b||Math.max(1,x);i(x<=A,"byte array longer than desired length"),i(A>0,"Requested array length <= 0");var _=U(a,A),c=f==="le"?"LE":"BE";return this["_toArrayLike"+c](_,x),_},s.prototype._toArrayLikeLE=function(a,f){for(var b=0,x=0,A=0,_=0;A<this.length;A++){var c=this.words[A]<<_|x;a[b++]=c&255,b<a.length&&(a[b++]=c>>8&255),b<a.length&&(a[b++]=c>>16&255),_===6?(b<a.length&&(a[b++]=c>>24&255),x=0,_=0):(x=c>>>24,_+=2)}if(b<a.length)for(a[b++]=x;b<a.length;)a[b++]=0},s.prototype._toArrayLikeBE=function(a,f){for(var b=a.length-1,x=0,A=0,_=0;A<this.length;A++){var c=this.words[A]<<_|x;a[b--]=c&255,b>=0&&(a[b--]=c>>8&255),b>=0&&(a[b--]=c>>16&255),_===6?(b>=0&&(a[b--]=c>>24&255),x=0,_=0):(x=c>>>24,_+=2)}if(b>=0)for(a[b--]=x;b>=0;)a[b--]=0},Math.clz32?s.prototype._countBits=function(a){return 32-Math.clz32(a)}:s.prototype._countBits=function(a){var f=a,b=0;return f>=4096&&(b+=13,f>>>=13),f>=64&&(b+=7,f>>>=7),f>=8&&(b+=4,f>>>=4),f>=2&&(b+=2,f>>>=2),b+f},s.prototype._zeroBits=function(a){if(a===0)return 26;var f=a,b=0;return f&8191||(b+=13,f>>>=13),f&127||(b+=7,f>>>=7),f&15||(b+=4,f>>>=4),f&3||(b+=2,f>>>=2),f&1||b++,b},s.prototype.bitLength=function(){var a=this.words[this.length-1],f=this._countBits(a);return(this.length-1)*26+f};function z(u){for(var a=new Array(u.bitLength()),f=0;f<a.length;f++){var b=f/26|0,x=f%26;a[f]=u.words[b]>>>x&1}return a}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var a=0,f=0;f<this.length;f++){var b=this._zeroBits(this.words[f]);if(a+=b,b!==26)break}return a},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(a){return this.negative!==0?this.abs().inotn(a).iaddn(1):this.clone()},s.prototype.fromTwos=function(a){return this.testn(a-1)?this.notn(a).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(a){for(;this.length<a.length;)this.words[this.length++]=0;for(var f=0;f<a.length;f++)this.words[f]=this.words[f]|a.words[f];return this._strip()},s.prototype.ior=function(a){return i((this.negative|a.negative)===0),this.iuor(a)},s.prototype.or=function(a){return this.length>a.length?this.clone().ior(a):a.clone().ior(this)},s.prototype.uor=function(a){return this.length>a.length?this.clone().iuor(a):a.clone().iuor(this)},s.prototype.iuand=function(a){var f;this.length>a.length?f=a:f=this;for(var b=0;b<f.length;b++)this.words[b]=this.words[b]&a.words[b];return this.length=f.length,this._strip()},s.prototype.iand=function(a){return i((this.negative|a.negative)===0),this.iuand(a)},s.prototype.and=function(a){return this.length>a.length?this.clone().iand(a):a.clone().iand(this)},s.prototype.uand=function(a){return this.length>a.length?this.clone().iuand(a):a.clone().iuand(this)},s.prototype.iuxor=function(a){var f,b;this.length>a.length?(f=this,b=a):(f=a,b=this);for(var x=0;x<b.length;x++)this.words[x]=f.words[x]^b.words[x];if(this!==f)for(;x<f.length;x++)this.words[x]=f.words[x];return this.length=f.length,this._strip()},s.prototype.ixor=function(a){return i((this.negative|a.negative)===0),this.iuxor(a)},s.prototype.xor=function(a){return this.length>a.length?this.clone().ixor(a):a.clone().ixor(this)},s.prototype.uxor=function(a){return this.length>a.length?this.clone().iuxor(a):a.clone().iuxor(this)},s.prototype.inotn=function(a){i(typeof a=="number"&&a>=0);var f=Math.ceil(a/26)|0,b=a%26;this._expand(f),b>0&&f--;for(var x=0;x<f;x++)this.words[x]=~this.words[x]&67108863;return b>0&&(this.words[x]=~this.words[x]&67108863>>26-b),this._strip()},s.prototype.notn=function(a){return this.clone().inotn(a)},s.prototype.setn=function(a,f){i(typeof a=="number"&&a>=0);var b=a/26|0,x=a%26;return this._expand(b+1),f?this.words[b]=this.words[b]|1<<x:this.words[b]=this.words[b]&~(1<<x),this._strip()},s.prototype.iadd=function(a){var f;if(this.negative!==0&&a.negative===0)return this.negative=0,f=this.isub(a),this.negative^=1,this._normSign();if(this.negative===0&&a.negative!==0)return a.negative=0,f=this.isub(a),a.negative=1,f._normSign();var b,x;this.length>a.length?(b=this,x=a):(b=a,x=this);for(var A=0,_=0;_<x.length;_++)f=(b.words[_]|0)+(x.words[_]|0)+A,this.words[_]=f&67108863,A=f>>>26;for(;A!==0&&_<b.length;_++)f=(b.words[_]|0)+A,this.words[_]=f&67108863,A=f>>>26;if(this.length=b.length,A!==0)this.words[this.length]=A,this.length++;else if(b!==this)for(;_<b.length;_++)this.words[_]=b.words[_];return this},s.prototype.add=function(a){var f;return a.negative!==0&&this.negative===0?(a.negative=0,f=this.sub(a),a.negative^=1,f):a.negative===0&&this.negative!==0?(this.negative=0,f=a.sub(this),this.negative=1,f):this.length>a.length?this.clone().iadd(a):a.clone().iadd(this)},s.prototype.isub=function(a){if(a.negative!==0){a.negative=0;var f=this.iadd(a);return a.negative=1,f._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(a),this.negative=1,this._normSign();var b=this.cmp(a);if(b===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,A;b>0?(x=this,A=a):(x=a,A=this);for(var _=0,c=0;c<A.length;c++)f=(x.words[c]|0)-(A.words[c]|0)+_,_=f>>26,this.words[c]=f&67108863;for(;_!==0&&c<x.length;c++)f=(x.words[c]|0)+_,_=f>>26,this.words[c]=f&67108863;if(_===0&&c<x.length&&x!==this)for(;c<x.length;c++)this.words[c]=x.words[c];return this.length=Math.max(this.length,c),x!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(a){return this.clone().isub(a)};function H(u,a,f){f.negative=a.negative^u.negative;var b=u.length+a.length|0;f.length=b,b=b-1|0;var x=u.words[0]|0,A=a.words[0]|0,_=x*A,c=_&67108863,m=_/67108864|0;f.words[0]=c;for(var v=1;v<b;v++){for(var S=m>>>26,G=m&67108863,E=Math.min(v,a.length-1),k=Math.max(0,v-u.length+1);k<=E;k++){var C=v-k|0;x=u.words[C]|0,A=a.words[k]|0,_=x*A+G,S+=_/67108864|0,G=_&67108863}f.words[v]=G|0,m=S|0}return m!==0?f.words[v]=m|0:f.length--,f._strip()}var L=function(a,f,b){var x=a.words,A=f.words,_=b.words,c=0,m,v,S,G=x[0]|0,E=G&8191,k=G>>>13,C=x[1]|0,B=C&8191,P=C>>>13,g=x[2]|0,T=g&8191,j=g>>>13,J=x[3]|0,W=J&8191,X=J>>>13,ve=x[4]|0,_e=ve&8191,ae=ve>>>13,De=x[5]|0,me=De&8191,ie=De>>>13,de=x[6]|0,he=de&8191,te=de>>>13,fe=x[7]|0,se=fe&8191,ee=fe>>>13,le=x[8]|0,ge=le&8191,re=le>>>13,ye=x[9]|0,we=ye&8191,ne=ye>>>13,xe=A[0]|0,Ae=xe&8191,Me=xe>>>13,Ke=A[1]|0,He=Ke&8191,Ee=Ke>>>13,je=A[2]|0,Ve=je&8191,Ie=je>>>13,Re=A[3]|0,Oe=Re&8191,ce=Re>>>13,Ce=A[4]|0,Pe=Ce&8191,oe=Ce>>>13,Fe=A[5]|0,Le=Fe&8191,pe=Fe>>>13,Ue=A[6]|0,$e=Ue&8191,ue=Ue>>>13,Te=A[7]|0,Ne=Te&8191,be=Te>>>13,qe=A[8]|0,We=qe&8191,Be=qe>>>13,Qe=A[9]|0,Ge=Qe&8191,Je=Qe>>>13;b.negative=a.negative^f.negative,b.length=19,m=Math.imul(E,Ae),v=Math.imul(E,Me),v=v+Math.imul(k,Ae)|0,S=Math.imul(k,Me);var lt=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(lt>>>26)|0,lt&=67108863,m=Math.imul(B,Ae),v=Math.imul(B,Me),v=v+Math.imul(P,Ae)|0,S=Math.imul(P,Me),m=m+Math.imul(E,He)|0,v=v+Math.imul(E,Ee)|0,v=v+Math.imul(k,He)|0,S=S+Math.imul(k,Ee)|0;var pt=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(pt>>>26)|0,pt&=67108863,m=Math.imul(T,Ae),v=Math.imul(T,Me),v=v+Math.imul(j,Ae)|0,S=Math.imul(j,Me),m=m+Math.imul(B,He)|0,v=v+Math.imul(B,Ee)|0,v=v+Math.imul(P,He)|0,S=S+Math.imul(P,Ee)|0,m=m+Math.imul(E,Ve)|0,v=v+Math.imul(E,Ie)|0,v=v+Math.imul(k,Ve)|0,S=S+Math.imul(k,Ie)|0;var bt=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(bt>>>26)|0,bt&=67108863,m=Math.imul(W,Ae),v=Math.imul(W,Me),v=v+Math.imul(X,Ae)|0,S=Math.imul(X,Me),m=m+Math.imul(T,He)|0,v=v+Math.imul(T,Ee)|0,v=v+Math.imul(j,He)|0,S=S+Math.imul(j,Ee)|0,m=m+Math.imul(B,Ve)|0,v=v+Math.imul(B,Ie)|0,v=v+Math.imul(P,Ve)|0,S=S+Math.imul(P,Ie)|0,m=m+Math.imul(E,Oe)|0,v=v+Math.imul(E,ce)|0,v=v+Math.imul(k,Oe)|0,S=S+Math.imul(k,ce)|0;var vt=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(vt>>>26)|0,vt&=67108863,m=Math.imul(_e,Ae),v=Math.imul(_e,Me),v=v+Math.imul(ae,Ae)|0,S=Math.imul(ae,Me),m=m+Math.imul(W,He)|0,v=v+Math.imul(W,Ee)|0,v=v+Math.imul(X,He)|0,S=S+Math.imul(X,Ee)|0,m=m+Math.imul(T,Ve)|0,v=v+Math.imul(T,Ie)|0,v=v+Math.imul(j,Ve)|0,S=S+Math.imul(j,Ie)|0,m=m+Math.imul(B,Oe)|0,v=v+Math.imul(B,ce)|0,v=v+Math.imul(P,Oe)|0,S=S+Math.imul(P,ce)|0,m=m+Math.imul(E,Pe)|0,v=v+Math.imul(E,oe)|0,v=v+Math.imul(k,Pe)|0,S=S+Math.imul(k,oe)|0;var ct=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(ct>>>26)|0,ct&=67108863,m=Math.imul(me,Ae),v=Math.imul(me,Me),v=v+Math.imul(ie,Ae)|0,S=Math.imul(ie,Me),m=m+Math.imul(_e,He)|0,v=v+Math.imul(_e,Ee)|0,v=v+Math.imul(ae,He)|0,S=S+Math.imul(ae,Ee)|0,m=m+Math.imul(W,Ve)|0,v=v+Math.imul(W,Ie)|0,v=v+Math.imul(X,Ve)|0,S=S+Math.imul(X,Ie)|0,m=m+Math.imul(T,Oe)|0,v=v+Math.imul(T,ce)|0,v=v+Math.imul(j,Oe)|0,S=S+Math.imul(j,ce)|0,m=m+Math.imul(B,Pe)|0,v=v+Math.imul(B,oe)|0,v=v+Math.imul(P,Pe)|0,S=S+Math.imul(P,oe)|0,m=m+Math.imul(E,Le)|0,v=v+Math.imul(E,pe)|0,v=v+Math.imul(k,Le)|0,S=S+Math.imul(k,pe)|0;var ar=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(ar>>>26)|0,ar&=67108863,m=Math.imul(he,Ae),v=Math.imul(he,Me),v=v+Math.imul(te,Ae)|0,S=Math.imul(te,Me),m=m+Math.imul(me,He)|0,v=v+Math.imul(me,Ee)|0,v=v+Math.imul(ie,He)|0,S=S+Math.imul(ie,Ee)|0,m=m+Math.imul(_e,Ve)|0,v=v+Math.imul(_e,Ie)|0,v=v+Math.imul(ae,Ve)|0,S=S+Math.imul(ae,Ie)|0,m=m+Math.imul(W,Oe)|0,v=v+Math.imul(W,ce)|0,v=v+Math.imul(X,Oe)|0,S=S+Math.imul(X,ce)|0,m=m+Math.imul(T,Pe)|0,v=v+Math.imul(T,oe)|0,v=v+Math.imul(j,Pe)|0,S=S+Math.imul(j,oe)|0,m=m+Math.imul(B,Le)|0,v=v+Math.imul(B,pe)|0,v=v+Math.imul(P,Le)|0,S=S+Math.imul(P,pe)|0,m=m+Math.imul(E,$e)|0,v=v+Math.imul(E,ue)|0,v=v+Math.imul(k,$e)|0,S=S+Math.imul(k,ue)|0;var fr=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(fr>>>26)|0,fr&=67108863,m=Math.imul(se,Ae),v=Math.imul(se,Me),v=v+Math.imul(ee,Ae)|0,S=Math.imul(ee,Me),m=m+Math.imul(he,He)|0,v=v+Math.imul(he,Ee)|0,v=v+Math.imul(te,He)|0,S=S+Math.imul(te,Ee)|0,m=m+Math.imul(me,Ve)|0,v=v+Math.imul(me,Ie)|0,v=v+Math.imul(ie,Ve)|0,S=S+Math.imul(ie,Ie)|0,m=m+Math.imul(_e,Oe)|0,v=v+Math.imul(_e,ce)|0,v=v+Math.imul(ae,Oe)|0,S=S+Math.imul(ae,ce)|0,m=m+Math.imul(W,Pe)|0,v=v+Math.imul(W,oe)|0,v=v+Math.imul(X,Pe)|0,S=S+Math.imul(X,oe)|0,m=m+Math.imul(T,Le)|0,v=v+Math.imul(T,pe)|0,v=v+Math.imul(j,Le)|0,S=S+Math.imul(j,pe)|0,m=m+Math.imul(B,$e)|0,v=v+Math.imul(B,ue)|0,v=v+Math.imul(P,$e)|0,S=S+Math.imul(P,ue)|0,m=m+Math.imul(E,Ne)|0,v=v+Math.imul(E,be)|0,v=v+Math.imul(k,Ne)|0,S=S+Math.imul(k,be)|0;var or=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(or>>>26)|0,or&=67108863,m=Math.imul(ge,Ae),v=Math.imul(ge,Me),v=v+Math.imul(re,Ae)|0,S=Math.imul(re,Me),m=m+Math.imul(se,He)|0,v=v+Math.imul(se,Ee)|0,v=v+Math.imul(ee,He)|0,S=S+Math.imul(ee,Ee)|0,m=m+Math.imul(he,Ve)|0,v=v+Math.imul(he,Ie)|0,v=v+Math.imul(te,Ve)|0,S=S+Math.imul(te,Ie)|0,m=m+Math.imul(me,Oe)|0,v=v+Math.imul(me,ce)|0,v=v+Math.imul(ie,Oe)|0,S=S+Math.imul(ie,ce)|0,m=m+Math.imul(_e,Pe)|0,v=v+Math.imul(_e,oe)|0,v=v+Math.imul(ae,Pe)|0,S=S+Math.imul(ae,oe)|0,m=m+Math.imul(W,Le)|0,v=v+Math.imul(W,pe)|0,v=v+Math.imul(X,Le)|0,S=S+Math.imul(X,pe)|0,m=m+Math.imul(T,$e)|0,v=v+Math.imul(T,ue)|0,v=v+Math.imul(j,$e)|0,S=S+Math.imul(j,ue)|0,m=m+Math.imul(B,Ne)|0,v=v+Math.imul(B,be)|0,v=v+Math.imul(P,Ne)|0,S=S+Math.imul(P,be)|0,m=m+Math.imul(E,We)|0,v=v+Math.imul(E,Be)|0,v=v+Math.imul(k,We)|0,S=S+Math.imul(k,Be)|0;var hr=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(hr>>>26)|0,hr&=67108863,m=Math.imul(we,Ae),v=Math.imul(we,Me),v=v+Math.imul(ne,Ae)|0,S=Math.imul(ne,Me),m=m+Math.imul(ge,He)|0,v=v+Math.imul(ge,Ee)|0,v=v+Math.imul(re,He)|0,S=S+Math.imul(re,Ee)|0,m=m+Math.imul(se,Ve)|0,v=v+Math.imul(se,Ie)|0,v=v+Math.imul(ee,Ve)|0,S=S+Math.imul(ee,Ie)|0,m=m+Math.imul(he,Oe)|0,v=v+Math.imul(he,ce)|0,v=v+Math.imul(te,Oe)|0,S=S+Math.imul(te,ce)|0,m=m+Math.imul(me,Pe)|0,v=v+Math.imul(me,oe)|0,v=v+Math.imul(ie,Pe)|0,S=S+Math.imul(ie,oe)|0,m=m+Math.imul(_e,Le)|0,v=v+Math.imul(_e,pe)|0,v=v+Math.imul(ae,Le)|0,S=S+Math.imul(ae,pe)|0,m=m+Math.imul(W,$e)|0,v=v+Math.imul(W,ue)|0,v=v+Math.imul(X,$e)|0,S=S+Math.imul(X,ue)|0,m=m+Math.imul(T,Ne)|0,v=v+Math.imul(T,be)|0,v=v+Math.imul(j,Ne)|0,S=S+Math.imul(j,be)|0,m=m+Math.imul(B,We)|0,v=v+Math.imul(B,Be)|0,v=v+Math.imul(P,We)|0,S=S+Math.imul(P,Be)|0,m=m+Math.imul(E,Ge)|0,v=v+Math.imul(E,Je)|0,v=v+Math.imul(k,Ge)|0,S=S+Math.imul(k,Je)|0;var cr=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(cr>>>26)|0,cr&=67108863,m=Math.imul(we,He),v=Math.imul(we,Ee),v=v+Math.imul(ne,He)|0,S=Math.imul(ne,Ee),m=m+Math.imul(ge,Ve)|0,v=v+Math.imul(ge,Ie)|0,v=v+Math.imul(re,Ve)|0,S=S+Math.imul(re,Ie)|0,m=m+Math.imul(se,Oe)|0,v=v+Math.imul(se,ce)|0,v=v+Math.imul(ee,Oe)|0,S=S+Math.imul(ee,ce)|0,m=m+Math.imul(he,Pe)|0,v=v+Math.imul(he,oe)|0,v=v+Math.imul(te,Pe)|0,S=S+Math.imul(te,oe)|0,m=m+Math.imul(me,Le)|0,v=v+Math.imul(me,pe)|0,v=v+Math.imul(ie,Le)|0,S=S+Math.imul(ie,pe)|0,m=m+Math.imul(_e,$e)|0,v=v+Math.imul(_e,ue)|0,v=v+Math.imul(ae,$e)|0,S=S+Math.imul(ae,ue)|0,m=m+Math.imul(W,Ne)|0,v=v+Math.imul(W,be)|0,v=v+Math.imul(X,Ne)|0,S=S+Math.imul(X,be)|0,m=m+Math.imul(T,We)|0,v=v+Math.imul(T,Be)|0,v=v+Math.imul(j,We)|0,S=S+Math.imul(j,Be)|0,m=m+Math.imul(B,Ge)|0,v=v+Math.imul(B,Je)|0,v=v+Math.imul(P,Ge)|0,S=S+Math.imul(P,Je)|0;var Ft=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,m=Math.imul(we,Ve),v=Math.imul(we,Ie),v=v+Math.imul(ne,Ve)|0,S=Math.imul(ne,Ie),m=m+Math.imul(ge,Oe)|0,v=v+Math.imul(ge,ce)|0,v=v+Math.imul(re,Oe)|0,S=S+Math.imul(re,ce)|0,m=m+Math.imul(se,Pe)|0,v=v+Math.imul(se,oe)|0,v=v+Math.imul(ee,Pe)|0,S=S+Math.imul(ee,oe)|0,m=m+Math.imul(he,Le)|0,v=v+Math.imul(he,pe)|0,v=v+Math.imul(te,Le)|0,S=S+Math.imul(te,pe)|0,m=m+Math.imul(me,$e)|0,v=v+Math.imul(me,ue)|0,v=v+Math.imul(ie,$e)|0,S=S+Math.imul(ie,ue)|0,m=m+Math.imul(_e,Ne)|0,v=v+Math.imul(_e,be)|0,v=v+Math.imul(ae,Ne)|0,S=S+Math.imul(ae,be)|0,m=m+Math.imul(W,We)|0,v=v+Math.imul(W,Be)|0,v=v+Math.imul(X,We)|0,S=S+Math.imul(X,Be)|0,m=m+Math.imul(T,Ge)|0,v=v+Math.imul(T,Je)|0,v=v+Math.imul(j,Ge)|0,S=S+Math.imul(j,Je)|0;var ur=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(ur>>>26)|0,ur&=67108863,m=Math.imul(we,Oe),v=Math.imul(we,ce),v=v+Math.imul(ne,Oe)|0,S=Math.imul(ne,ce),m=m+Math.imul(ge,Pe)|0,v=v+Math.imul(ge,oe)|0,v=v+Math.imul(re,Pe)|0,S=S+Math.imul(re,oe)|0,m=m+Math.imul(se,Le)|0,v=v+Math.imul(se,pe)|0,v=v+Math.imul(ee,Le)|0,S=S+Math.imul(ee,pe)|0,m=m+Math.imul(he,$e)|0,v=v+Math.imul(he,ue)|0,v=v+Math.imul(te,$e)|0,S=S+Math.imul(te,ue)|0,m=m+Math.imul(me,Ne)|0,v=v+Math.imul(me,be)|0,v=v+Math.imul(ie,Ne)|0,S=S+Math.imul(ie,be)|0,m=m+Math.imul(_e,We)|0,v=v+Math.imul(_e,Be)|0,v=v+Math.imul(ae,We)|0,S=S+Math.imul(ae,Be)|0,m=m+Math.imul(W,Ge)|0,v=v+Math.imul(W,Je)|0,v=v+Math.imul(X,Ge)|0,S=S+Math.imul(X,Je)|0;var dr=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(dr>>>26)|0,dr&=67108863,m=Math.imul(we,Pe),v=Math.imul(we,oe),v=v+Math.imul(ne,Pe)|0,S=Math.imul(ne,oe),m=m+Math.imul(ge,Le)|0,v=v+Math.imul(ge,pe)|0,v=v+Math.imul(re,Le)|0,S=S+Math.imul(re,pe)|0,m=m+Math.imul(se,$e)|0,v=v+Math.imul(se,ue)|0,v=v+Math.imul(ee,$e)|0,S=S+Math.imul(ee,ue)|0,m=m+Math.imul(he,Ne)|0,v=v+Math.imul(he,be)|0,v=v+Math.imul(te,Ne)|0,S=S+Math.imul(te,be)|0,m=m+Math.imul(me,We)|0,v=v+Math.imul(me,Be)|0,v=v+Math.imul(ie,We)|0,S=S+Math.imul(ie,Be)|0,m=m+Math.imul(_e,Ge)|0,v=v+Math.imul(_e,Je)|0,v=v+Math.imul(ae,Ge)|0,S=S+Math.imul(ae,Je)|0;var St=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(St>>>26)|0,St&=67108863,m=Math.imul(we,Le),v=Math.imul(we,pe),v=v+Math.imul(ne,Le)|0,S=Math.imul(ne,pe),m=m+Math.imul(ge,$e)|0,v=v+Math.imul(ge,ue)|0,v=v+Math.imul(re,$e)|0,S=S+Math.imul(re,ue)|0,m=m+Math.imul(se,Ne)|0,v=v+Math.imul(se,be)|0,v=v+Math.imul(ee,Ne)|0,S=S+Math.imul(ee,be)|0,m=m+Math.imul(he,We)|0,v=v+Math.imul(he,Be)|0,v=v+Math.imul(te,We)|0,S=S+Math.imul(te,Be)|0,m=m+Math.imul(me,Ge)|0,v=v+Math.imul(me,Je)|0,v=v+Math.imul(ie,Ge)|0,S=S+Math.imul(ie,Je)|0;var lr=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(lr>>>26)|0,lr&=67108863,m=Math.imul(we,$e),v=Math.imul(we,ue),v=v+Math.imul(ne,$e)|0,S=Math.imul(ne,ue),m=m+Math.imul(ge,Ne)|0,v=v+Math.imul(ge,be)|0,v=v+Math.imul(re,Ne)|0,S=S+Math.imul(re,be)|0,m=m+Math.imul(se,We)|0,v=v+Math.imul(se,Be)|0,v=v+Math.imul(ee,We)|0,S=S+Math.imul(ee,Be)|0,m=m+Math.imul(he,Ge)|0,v=v+Math.imul(he,Je)|0,v=v+Math.imul(te,Ge)|0,S=S+Math.imul(te,Je)|0;var pr=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(pr>>>26)|0,pr&=67108863,m=Math.imul(we,Ne),v=Math.imul(we,be),v=v+Math.imul(ne,Ne)|0,S=Math.imul(ne,be),m=m+Math.imul(ge,We)|0,v=v+Math.imul(ge,Be)|0,v=v+Math.imul(re,We)|0,S=S+Math.imul(re,Be)|0,m=m+Math.imul(se,Ge)|0,v=v+Math.imul(se,Je)|0,v=v+Math.imul(ee,Ge)|0,S=S+Math.imul(ee,Je)|0;var br=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(br>>>26)|0,br&=67108863,m=Math.imul(we,We),v=Math.imul(we,Be),v=v+Math.imul(ne,We)|0,S=Math.imul(ne,Be),m=m+Math.imul(ge,Ge)|0,v=v+Math.imul(ge,Je)|0,v=v+Math.imul(re,Ge)|0,S=S+Math.imul(re,Je)|0;var En=(c+m|0)+((v&8191)<<13)|0;c=(S+(v>>>13)|0)+(En>>>26)|0,En&=67108863,m=Math.imul(we,Ge),v=Math.imul(we,Je),v=v+Math.imul(ne,Ge)|0,S=Math.imul(ne,Je);var Sn=(c+m|0)+((v&8191)<<13)|0;return c=(S+(v>>>13)|0)+(Sn>>>26)|0,Sn&=67108863,_[0]=lt,_[1]=pt,_[2]=bt,_[3]=vt,_[4]=ct,_[5]=ar,_[6]=fr,_[7]=or,_[8]=hr,_[9]=cr,_[10]=Ft,_[11]=ur,_[12]=dr,_[13]=St,_[14]=lr,_[15]=pr,_[16]=br,_[17]=En,_[18]=Sn,c!==0&&(_[19]=c,b.length++),b};Math.imul||(L=H);function K(u,a,f){f.negative=a.negative^u.negative,f.length=u.length+a.length;for(var b=0,x=0,A=0;A<f.length-1;A++){var _=x;x=0;for(var c=b&67108863,m=Math.min(A,a.length-1),v=Math.max(0,A-u.length+1);v<=m;v++){var S=A-v,G=u.words[S]|0,E=a.words[v]|0,k=G*E,C=k&67108863;_=_+(k/67108864|0)|0,C=C+c|0,c=C&67108863,_=_+(C>>>26)|0,x+=_>>>26,_&=67108863}f.words[A]=c,b=_,_=x}return b!==0?f.words[A]=b:f.length--,f._strip()}function F(u,a,f){return K(u,a,f)}s.prototype.mulTo=function(a,f){var b,x=this.length+a.length;return this.length===10&&a.length===10?b=L(this,a,f):x<63?b=H(this,a,f):x<1024?b=K(this,a,f):b=F(this,a,f),b},s.prototype.mul=function(a){var f=new s(null);return f.words=new Array(this.length+a.length),this.mulTo(a,f)},s.prototype.mulf=function(a){var f=new s(null);return f.words=new Array(this.length+a.length),F(this,a,f)},s.prototype.imul=function(a){return this.clone().mulTo(a,this)},s.prototype.imuln=function(a){var f=a<0;f&&(a=-a),i(typeof a=="number"),i(a<67108864);for(var b=0,x=0;x<this.length;x++){var A=(this.words[x]|0)*a,_=(A&67108863)+(b&67108863);b>>=26,b+=A/67108864|0,b+=_>>>26,this.words[x]=_&67108863}return b!==0&&(this.words[x]=b,this.length++),f?this.ineg():this},s.prototype.muln=function(a){return this.clone().imuln(a)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(a){var f=z(a);if(f.length===0)return new s(1);for(var b=this,x=0;x<f.length&&f[x]===0;x++,b=b.sqr());if(++x<f.length)for(var A=b.sqr();x<f.length;x++,A=A.sqr())f[x]!==0&&(b=b.mul(A));return b},s.prototype.iushln=function(a){i(typeof a=="number"&&a>=0);var f=a%26,b=(a-f)/26,x=67108863>>>26-f<<26-f,A;if(f!==0){var _=0;for(A=0;A<this.length;A++){var c=this.words[A]&x,m=(this.words[A]|0)-c<<f;this.words[A]=m|_,_=c>>>26-f}_&&(this.words[A]=_,this.length++)}if(b!==0){for(A=this.length-1;A>=0;A--)this.words[A+b]=this.words[A];for(A=0;A<b;A++)this.words[A]=0;this.length+=b}return this._strip()},s.prototype.ishln=function(a){return i(this.negative===0),this.iushln(a)},s.prototype.iushrn=function(a,f,b){i(typeof a=="number"&&a>=0);var x;f?x=(f-f%26)/26:x=0;var A=a%26,_=Math.min((a-A)/26,this.length),c=67108863^67108863>>>A<<A,m=b;if(x-=_,x=Math.max(0,x),m){for(var v=0;v<_;v++)m.words[v]=this.words[v];m.length=_}if(_!==0)if(this.length>_)for(this.length-=_,v=0;v<this.length;v++)this.words[v]=this.words[v+_];else this.words[0]=0,this.length=1;var S=0;for(v=this.length-1;v>=0&&(S!==0||v>=x);v--){var G=this.words[v]|0;this.words[v]=S<<26-A|G>>>A,S=G&c}return m&&S!==0&&(m.words[m.length++]=S),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(a,f,b){return i(this.negative===0),this.iushrn(a,f,b)},s.prototype.shln=function(a){return this.clone().ishln(a)},s.prototype.ushln=function(a){return this.clone().iushln(a)},s.prototype.shrn=function(a){return this.clone().ishrn(a)},s.prototype.ushrn=function(a){return this.clone().iushrn(a)},s.prototype.testn=function(a){i(typeof a=="number"&&a>=0);var f=a%26,b=(a-f)/26,x=1<<f;if(this.length<=b)return!1;var A=this.words[b];return!!(A&x)},s.prototype.imaskn=function(a){i(typeof a=="number"&&a>=0);var f=a%26,b=(a-f)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=b)return this;if(f!==0&&b++,this.length=Math.min(b,this.length),f!==0){var x=67108863^67108863>>>f<<f;this.words[this.length-1]&=x}return this._strip()},s.prototype.maskn=function(a){return this.clone().imaskn(a)},s.prototype.iaddn=function(a){return i(typeof a=="number"),i(a<67108864),a<0?this.isubn(-a):this.negative!==0?this.length===1&&(this.words[0]|0)<=a?(this.words[0]=a-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(a),this.negative=1,this):this._iaddn(a)},s.prototype._iaddn=function(a){this.words[0]+=a;for(var f=0;f<this.length&&this.words[f]>=67108864;f++)this.words[f]-=67108864,f===this.length-1?this.words[f+1]=1:this.words[f+1]++;return this.length=Math.max(this.length,f+1),this},s.prototype.isubn=function(a){if(i(typeof a=="number"),i(a<67108864),a<0)return this.iaddn(-a);if(this.negative!==0)return this.negative=0,this.iaddn(a),this.negative=1,this;if(this.words[0]-=a,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var f=0;f<this.length&&this.words[f]<0;f++)this.words[f]+=67108864,this.words[f+1]-=1;return this._strip()},s.prototype.addn=function(a){return this.clone().iaddn(a)},s.prototype.subn=function(a){return this.clone().isubn(a)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(a,f,b){var x=a.length+b,A;this._expand(x);var _,c=0;for(A=0;A<a.length;A++){_=(this.words[A+b]|0)+c;var m=(a.words[A]|0)*f;_-=m&67108863,c=(_>>26)-(m/67108864|0),this.words[A+b]=_&67108863}for(;A<this.length-b;A++)_=(this.words[A+b]|0)+c,c=_>>26,this.words[A+b]=_&67108863;if(c===0)return this._strip();for(i(c===-1),c=0,A=0;A<this.length;A++)_=-(this.words[A]|0)+c,c=_>>26,this.words[A]=_&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(a,f){var b=this.length-a.length,x=this.clone(),A=a,_=A.words[A.length-1]|0,c=this._countBits(_);b=26-c,b!==0&&(A=A.ushln(b),x.iushln(b),_=A.words[A.length-1]|0);var m=x.length-A.length,v;if(f!=="mod"){v=new s(null),v.length=m+1,v.words=new Array(v.length);for(var S=0;S<v.length;S++)v.words[S]=0}var G=x.clone()._ishlnsubmul(A,1,m);G.negative===0&&(x=G,v&&(v.words[m]=1));for(var E=m-1;E>=0;E--){var k=(x.words[A.length+E]|0)*67108864+(x.words[A.length+E-1]|0);for(k=Math.min(k/_|0,67108863),x._ishlnsubmul(A,k,E);x.negative!==0;)k--,x.negative=0,x._ishlnsubmul(A,1,E),x.isZero()||(x.negative^=1);v&&(v.words[E]=k)}return v&&v._strip(),x._strip(),f!=="div"&&b!==0&&x.iushrn(b),{div:v||null,mod:x}},s.prototype.divmod=function(a,f,b){if(i(!a.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,A,_;return this.negative!==0&&a.negative===0?(_=this.neg().divmod(a,f),f!=="mod"&&(x=_.div.neg()),f!=="div"&&(A=_.mod.neg(),b&&A.negative!==0&&A.iadd(a)),{div:x,mod:A}):this.negative===0&&a.negative!==0?(_=this.divmod(a.neg(),f),f!=="mod"&&(x=_.div.neg()),{div:x,mod:_.mod}):this.negative&a.negative?(_=this.neg().divmod(a.neg(),f),f!=="div"&&(A=_.mod.neg(),b&&A.negative!==0&&A.isub(a)),{div:_.div,mod:A}):a.length>this.length||this.cmp(a)<0?{div:new s(0),mod:this}:a.length===1?f==="div"?{div:this.divn(a.words[0]),mod:null}:f==="mod"?{div:null,mod:new s(this.modrn(a.words[0]))}:{div:this.divn(a.words[0]),mod:new s(this.modrn(a.words[0]))}:this._wordDiv(a,f)},s.prototype.div=function(a){return this.divmod(a,"div",!1).div},s.prototype.mod=function(a){return this.divmod(a,"mod",!1).mod},s.prototype.umod=function(a){return this.divmod(a,"mod",!0).mod},s.prototype.divRound=function(a){var f=this.divmod(a);if(f.mod.isZero())return f.div;var b=f.div.negative!==0?f.mod.isub(a):f.mod,x=a.ushrn(1),A=a.andln(1),_=b.cmp(x);return _<0||A===1&&_===0?f.div:f.div.negative!==0?f.div.isubn(1):f.div.iaddn(1)},s.prototype.modrn=function(a){var f=a<0;f&&(a=-a),i(a<=67108863);for(var b=(1<<26)%a,x=0,A=this.length-1;A>=0;A--)x=(b*x+(this.words[A]|0))%a;return f?-x:x},s.prototype.modn=function(a){return this.modrn(a)},s.prototype.idivn=function(a){var f=a<0;f&&(a=-a),i(a<=67108863);for(var b=0,x=this.length-1;x>=0;x--){var A=(this.words[x]|0)+b*67108864;this.words[x]=A/a|0,b=A%a}return this._strip(),f?this.ineg():this},s.prototype.divn=function(a){return this.clone().idivn(a)},s.prototype.egcd=function(a){i(a.negative===0),i(!a.isZero());var f=this,b=a.clone();f.negative!==0?f=f.umod(a):f=f.clone();for(var x=new s(1),A=new s(0),_=new s(0),c=new s(1),m=0;f.isEven()&&b.isEven();)f.iushrn(1),b.iushrn(1),++m;for(var v=b.clone(),S=f.clone();!f.isZero();){for(var G=0,E=1;!(f.words[0]&E)&&G<26;++G,E<<=1);if(G>0)for(f.iushrn(G);G-- >0;)(x.isOdd()||A.isOdd())&&(x.iadd(v),A.isub(S)),x.iushrn(1),A.iushrn(1);for(var k=0,C=1;!(b.words[0]&C)&&k<26;++k,C<<=1);if(k>0)for(b.iushrn(k);k-- >0;)(_.isOdd()||c.isOdd())&&(_.iadd(v),c.isub(S)),_.iushrn(1),c.iushrn(1);f.cmp(b)>=0?(f.isub(b),x.isub(_),A.isub(c)):(b.isub(f),_.isub(x),c.isub(A))}return{a:_,b:c,gcd:b.iushln(m)}},s.prototype._invmp=function(a){i(a.negative===0),i(!a.isZero());var f=this,b=a.clone();f.negative!==0?f=f.umod(a):f=f.clone();for(var x=new s(1),A=new s(0),_=b.clone();f.cmpn(1)>0&&b.cmpn(1)>0;){for(var c=0,m=1;!(f.words[0]&m)&&c<26;++c,m<<=1);if(c>0)for(f.iushrn(c);c-- >0;)x.isOdd()&&x.iadd(_),x.iushrn(1);for(var v=0,S=1;!(b.words[0]&S)&&v<26;++v,S<<=1);if(v>0)for(b.iushrn(v);v-- >0;)A.isOdd()&&A.iadd(_),A.iushrn(1);f.cmp(b)>=0?(f.isub(b),x.isub(A)):(b.isub(f),A.isub(x))}var G;return f.cmpn(1)===0?G=x:G=A,G.cmpn(0)<0&&G.iadd(a),G},s.prototype.gcd=function(a){if(this.isZero())return a.abs();if(a.isZero())return this.abs();var f=this.clone(),b=a.clone();f.negative=0,b.negative=0;for(var x=0;f.isEven()&&b.isEven();x++)f.iushrn(1),b.iushrn(1);do{for(;f.isEven();)f.iushrn(1);for(;b.isEven();)b.iushrn(1);var A=f.cmp(b);if(A<0){var _=f;f=b,b=_}else if(A===0||b.cmpn(1)===0)break;f.isub(b)}while(!0);return b.iushln(x)},s.prototype.invm=function(a){return this.egcd(a).a.umod(a)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(a){return this.words[0]&a},s.prototype.bincn=function(a){i(typeof a=="number");var f=a%26,b=(a-f)/26,x=1<<f;if(this.length<=b)return this._expand(b+1),this.words[b]|=x,this;for(var A=x,_=b;A!==0&&_<this.length;_++){var c=this.words[_]|0;c+=A,A=c>>>26,c&=67108863,this.words[_]=c}return A!==0&&(this.words[_]=A,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(a){var f=a<0;if(this.negative!==0&&!f)return-1;if(this.negative===0&&f)return 1;this._strip();var b;if(this.length>1)b=1;else{f&&(a=-a),i(a<=67108863,"Number is too big");var x=this.words[0]|0;b=x===a?0:x<a?-1:1}return this.negative!==0?-b|0:b},s.prototype.cmp=function(a){if(this.negative!==0&&a.negative===0)return-1;if(this.negative===0&&a.negative!==0)return 1;var f=this.ucmp(a);return this.negative!==0?-f|0:f},s.prototype.ucmp=function(a){if(this.length>a.length)return 1;if(this.length<a.length)return-1;for(var f=0,b=this.length-1;b>=0;b--){var x=this.words[b]|0,A=a.words[b]|0;if(x!==A){x<A?f=-1:x>A&&(f=1);break}}return f},s.prototype.gtn=function(a){return this.cmpn(a)===1},s.prototype.gt=function(a){return this.cmp(a)===1},s.prototype.gten=function(a){return this.cmpn(a)>=0},s.prototype.gte=function(a){return this.cmp(a)>=0},s.prototype.ltn=function(a){return this.cmpn(a)===-1},s.prototype.lt=function(a){return this.cmp(a)===-1},s.prototype.lten=function(a){return this.cmpn(a)<=0},s.prototype.lte=function(a){return this.cmp(a)<=0},s.prototype.eqn=function(a){return this.cmpn(a)===0},s.prototype.eq=function(a){return this.cmp(a)===0},s.red=function(a){return new O(a)},s.prototype.toRed=function(a){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),a.convertTo(this)._forceRed(a)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(a){return this.red=a,this},s.prototype.forceRed=function(a){return i(!this.red,"Already a number in reduction context"),this._forceRed(a)},s.prototype.redAdd=function(a){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,a)},s.prototype.redIAdd=function(a){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,a)},s.prototype.redSub=function(a){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,a)},s.prototype.redISub=function(a){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,a)},s.prototype.redShl=function(a){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,a)},s.prototype.redMul=function(a){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.mul(this,a)},s.prototype.redIMul=function(a){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.imul(this,a)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(a){return i(this.red&&!a.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,a)};var $={k256:null,p224:null,p192:null,p25519:null};function q(u,a){this.name=u,this.p=new s(a,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}q.prototype._tmp=function(){var a=new s(null);return a.words=new Array(Math.ceil(this.n/13)),a},q.prototype.ireduce=function(a){var f=a,b;do this.split(f,this.tmp),f=this.imulK(f),f=f.iadd(this.tmp),b=f.bitLength();while(b>this.n);var x=b<this.n?-1:f.ucmp(this.p);return x===0?(f.words[0]=0,f.length=1):x>0?f.isub(this.p):f.strip!==void 0?f.strip():f._strip(),f},q.prototype.split=function(a,f){a.iushrn(this.n,0,f)},q.prototype.imulK=function(a){return a.imul(this.k)};function y(){q.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(y,q),y.prototype.split=function(a,f){for(var b=4194303,x=Math.min(a.length,9),A=0;A<x;A++)f.words[A]=a.words[A];if(f.length=x,a.length<=9){a.words[0]=0,a.length=1;return}var _=a.words[9];for(f.words[f.length++]=_&b,A=10;A<a.length;A++){var c=a.words[A]|0;a.words[A-10]=(c&b)<<4|_>>>22,_=c}_>>>=22,a.words[A-10]=_,_===0&&a.length>10?a.length-=10:a.length-=9},y.prototype.imulK=function(a){a.words[a.length]=0,a.words[a.length+1]=0,a.length+=2;for(var f=0,b=0;b<a.length;b++){var x=a.words[b]|0;f+=x*977,a.words[b]=f&67108863,f=x*64+(f/67108864|0)}return a.words[a.length-1]===0&&(a.length--,a.words[a.length-1]===0&&a.length--),a};function R(){q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(R,q);function V(){q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(V,q);function Q(){q.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(Q,q),Q.prototype.imulK=function(a){for(var f=0,b=0;b<a.length;b++){var x=(a.words[b]|0)*19+f,A=x&67108863;x>>>=26,a.words[b]=A,f=x}return f!==0&&(a.words[a.length++]=f),a},s._prime=function(a){if($[a])return $[a];var f;if(a==="k256")f=new y;else if(a==="p224")f=new R;else if(a==="p192")f=new V;else if(a==="p25519")f=new Q;else throw new Error("Unknown prime "+a);return $[a]=f,f};function O(u){if(typeof u=="string"){var a=s._prime(u);this.m=a.p,this.prime=a}else i(u.gtn(1),"modulus must be greater than 1"),this.m=u,this.prime=null}O.prototype._verify1=function(a){i(a.negative===0,"red works only with positives"),i(a.red,"red works only with red numbers")},O.prototype._verify2=function(a,f){i((a.negative|f.negative)===0,"red works only with positives"),i(a.red&&a.red===f.red,"red works only with red numbers")},O.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):(w(a,a.umod(this.m)._forceRed(this)),a)},O.prototype.neg=function(a){return a.isZero()?a.clone():this.m.sub(a)._forceRed(this)},O.prototype.add=function(a,f){this._verify2(a,f);var b=a.add(f);return b.cmp(this.m)>=0&&b.isub(this.m),b._forceRed(this)},O.prototype.iadd=function(a,f){this._verify2(a,f);var b=a.iadd(f);return b.cmp(this.m)>=0&&b.isub(this.m),b},O.prototype.sub=function(a,f){this._verify2(a,f);var b=a.sub(f);return b.cmpn(0)<0&&b.iadd(this.m),b._forceRed(this)},O.prototype.isub=function(a,f){this._verify2(a,f);var b=a.isub(f);return b.cmpn(0)<0&&b.iadd(this.m),b},O.prototype.shl=function(a,f){return this._verify1(a),this.imod(a.ushln(f))},O.prototype.imul=function(a,f){return this._verify2(a,f),this.imod(a.imul(f))},O.prototype.mul=function(a,f){return this._verify2(a,f),this.imod(a.mul(f))},O.prototype.isqr=function(a){return this.imul(a,a.clone())},O.prototype.sqr=function(a){return this.mul(a,a)},O.prototype.sqrt=function(a){if(a.isZero())return a.clone();var f=this.m.andln(3);if(i(f%2===1),f===3){var b=this.m.add(new s(1)).iushrn(2);return this.pow(a,b)}for(var x=this.m.subn(1),A=0;!x.isZero()&&x.andln(1)===0;)A++,x.iushrn(1);i(!x.isZero());var _=new s(1).toRed(this),c=_.redNeg(),m=this.m.subn(1).iushrn(1),v=this.m.bitLength();for(v=new s(2*v*v).toRed(this);this.pow(v,m).cmp(c)!==0;)v.redIAdd(c);for(var S=this.pow(v,x),G=this.pow(a,x.addn(1).iushrn(1)),E=this.pow(a,x),k=A;E.cmp(_)!==0;){for(var C=E,B=0;C.cmp(_)!==0;B++)C=C.redSqr();i(B<k);var P=this.pow(S,new s(1).iushln(k-B-1));G=G.redMul(P),S=P.redSqr(),E=E.redMul(S),k=B}return G},O.prototype.invm=function(a){var f=a._invmp(this.m);return f.negative!==0?(f.negative=0,this.imod(f).redNeg()):this.imod(f)},O.prototype.pow=function(a,f){if(f.isZero())return new s(1).toRed(this);if(f.cmpn(1)===0)return a.clone();var b=4,x=new Array(1<<b);x[0]=new s(1).toRed(this),x[1]=a;for(var A=2;A<x.length;A++)x[A]=this.mul(x[A-1],a);var _=x[0],c=0,m=0,v=f.bitLength()%26;for(v===0&&(v=26),A=f.length-1;A>=0;A--){for(var S=f.words[A],G=v-1;G>=0;G--){var E=S>>G&1;if(_!==x[0]&&(_=this.sqr(_)),E===0&&c===0){m=0;continue}c<<=1,c|=E,m++,!(m!==b&&(A!==0||G!==0))&&(_=this.mul(_,x[c]),m=0,c=0)}v=26}return _},O.prototype.convertTo=function(a){var f=a.umod(this.m);return f===a?f.clone():f},O.prototype.convertFrom=function(a){var f=a.clone();return f.red=null,f},s.mont=function(a){return new d(a)};function d(u){O.call(this,u),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(d,O),d.prototype.convertTo=function(a){return this.imod(a.ushln(this.shift))},d.prototype.convertFrom=function(a){var f=this.imod(a.mul(this.rinv));return f.red=null,f},d.prototype.imul=function(a,f){if(a.isZero()||f.isZero())return a.words[0]=0,a.length=1,a;var b=a.imul(f),x=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),A=b.isub(x).iushrn(this.shift),_=A;return A.cmp(this.m)>=0?_=A.isub(this.m):A.cmpn(0)<0&&(_=A.iadd(this.m)),_._forceRed(this)},d.prototype.mul=function(a,f){if(a.isZero()||f.isZero())return new s(0)._forceRed(this);var b=a.mul(f),x=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),A=b.isub(x).iushrn(this.shift),_=A;return A.cmp(this.m)>=0?_=A.isub(this.m):A.cmpn(0)<0&&(_=A.iadd(this.m)),_._forceRed(this)},d.prototype.invm=function(a){var f=this.imod(a._invmp(this.m).mul(this.r2));return f._forceRed(this)}})(t,Bt)})(Yb);var Ze=Yb.exports;const Jb="bignumber/5.7.0";var Dc=Ze.BN;const yn=new it(Jb),Ic={},Wb=9007199254740991;function vE(t){return t!=null&&(At.isBigNumber(t)||typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||ha(t)||typeof t=="bigint"||vf(t))}let Qb=!1;class At{constructor(e,r){e!==Ic&&yn.throwError("cannot call constructor directly; use BigNumber.from",it.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Lr(ot(this).fromTwos(e))}toTwos(e){return Lr(ot(this).toTwos(e))}abs(){return this._hex[0]==="-"?At.from(this._hex.substring(1)):this}add(e){return Lr(ot(this).add(ot(e)))}sub(e){return Lr(ot(this).sub(ot(e)))}div(e){return At.from(e).isZero()&&ci("division-by-zero","div"),Lr(ot(this).div(ot(e)))}mul(e){return Lr(ot(this).mul(ot(e)))}mod(e){const r=ot(e);return r.isNeg()&&ci("division-by-zero","mod"),Lr(ot(this).umod(r))}pow(e){const r=ot(e);return r.isNeg()&&ci("negative-power","pow"),Lr(ot(this).pow(r))}and(e){const r=ot(e);return(this.isNegative()||r.isNeg())&&ci("unbound-bitwise-result","and"),Lr(ot(this).and(r))}or(e){const r=ot(e);return(this.isNegative()||r.isNeg())&&ci("unbound-bitwise-result","or"),Lr(ot(this).or(r))}xor(e){const r=ot(e);return(this.isNegative()||r.isNeg())&&ci("unbound-bitwise-result","xor"),Lr(ot(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&ci("negative-width","mask"),Lr(ot(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&ci("negative-width","shl"),Lr(ot(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&ci("negative-width","shr"),Lr(ot(this).shrn(e))}eq(e){return ot(this).eq(ot(e))}lt(e){return ot(this).lt(ot(e))}lte(e){return ot(this).lte(ot(e))}gt(e){return ot(this).gt(ot(e))}gte(e){return ot(this).gte(ot(e))}isNegative(){return this._hex[0]==="-"}isZero(){return ot(this).isZero()}toNumber(){try{return ot(this).toNumber()}catch{ci("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return yn.throwError("this platform does not support BigInt",it.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Qb||(Qb=!0,yn.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?yn.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",it.errors.UNEXPECTED_ARGUMENT,{}):yn.throwError("BigNumber.toString does not accept parameters",it.errors.UNEXPECTED_ARGUMENT,{})),ot(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof At)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new At(Ic,gf(e)):e.match(/^-?[0-9]+$/)?new At(Ic,gf(new Dc(e))):yn.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&ci("underflow","BigNumber.from",e),(e>=Wb||e<=-Wb)&&ci("overflow","BigNumber.from",e),At.from(String(e));const r=e;if(typeof r=="bigint")return At.from(r.toString());if(vf(r))return At.from(Vb(r));if(r)if(r.toHexString){const i=r.toHexString();if(typeof i=="string")return At.from(i)}else{let i=r._hex;if(i==null&&r.type==="BigNumber"&&(i=r.hex),typeof i=="string"&&(ha(i)||i[0]==="-"&&ha(i.substring(1))))return At.from(i)}return yn.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function gf(t){if(typeof t!="string")return gf(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&yn.throwArgumentError("invalid hex","value",t),t=gf(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function Lr(t){return At.from(gf(t))}function ot(t){const e=At.from(t).toHexString();return e[0]==="-"?new Dc("-"+e.substring(3),16):new Dc(e.substring(2),16)}function ci(t,e,r){const i={fault:t,operation:e};return r!=null&&(i.value=r),yn.throwError(t,it.errors.NUMERIC_FAULT,i)}const Nr=new it(Jb),mf={},Xb=At.from(0),Zb=At.from(-1);function ev(t,e,r,i){const n={fault:e,operation:r};return i!==void 0&&(n.value=i),Nr.throwError(t,it.errors.NUMERIC_FAULT,n)}let yf="0";for(;yf.length<256;)yf+=yf;function Nc(t){if(typeof t!="number")try{t=At.from(t).toNumber()}catch{}return typeof t=="number"&&t>=0&&t<=256&&!(t%1)?"1"+yf.substring(0,t):Nr.throwArgumentError("invalid decimal size","decimals",t)}function Oc(t,e){e==null&&(e=0);const r=Nc(e);t=At.from(t);const i=t.lt(Xb);i&&(t=t.mul(Zb));let n=t.mod(r).toString();for(;n.length<r.length-1;)n="0"+n;n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=t.div(r).toString();return r.length===1?t=s:t=s+"."+n,i&&(t="-"+t),t}function wn(t,e){e==null&&(e=0);const r=Nc(e);(typeof t!="string"||!t.match(/^-?[0-9.]+$/))&&Nr.throwArgumentError("invalid decimal value","value",t);const i=t.substring(0,1)==="-";i&&(t=t.substring(1)),t==="."&&Nr.throwArgumentError("missing value","value",t);const n=t.split(".");n.length>2&&Nr.throwArgumentError("too many decimal points","value",t);let s=n[0],o=n[1];for(s||(s="0"),o||(o="0");o[o.length-1]==="0";)o=o.substring(0,o.length-1);for(o.length>r.length-1&&ev("fractional component exceeds decimals","underflow","parseFixed"),o===""&&(o="0");o.length<r.length-1;)o+="0";const h=At.from(s),l=At.from(o);let p=h.mul(r).add(l);return i&&(p=p.mul(Zb)),p}class ca{constructor(e,r,i,n){e!==mf&&Nr.throwError("cannot use FixedFormat constructor; use FixedFormat.from",it.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=r,this.width=i,this.decimals=n,this.name=(r?"":"u")+"fixed"+String(i)+"x"+String(n),this._multiplier=Nc(n),Object.freeze(this)}static from(e){if(e instanceof ca)return e;typeof e=="number"&&(e=`fixed128x${e}`);let r=!0,i=128,n=18;if(typeof e=="string"){if(e!=="fixed")if(e==="ufixed")r=!1;else{const s=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);s||Nr.throwArgumentError("invalid fixed format","format",e),r=s[1]!=="u",i=parseInt(s[2]),n=parseInt(s[3])}}else if(e){const s=(o,h,l)=>e[o]==null?l:(typeof e[o]!==h&&Nr.throwArgumentError("invalid fixed format ("+o+" not "+h+")","format."+o,e[o]),e[o]);r=s("signed","boolean",r),i=s("width","number",i),n=s("decimals","number",n)}return i%8&&Nr.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",i),n>80&&Nr.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new ca(mf,r,i,n)}}class rr{constructor(e,r,i,n){e!==mf&&Nr.throwError("cannot use FixedNumber constructor; use FixedNumber.from",it.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=r,this._value=i,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&Nr.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const r=wn(this._value,this.format.decimals),i=wn(e._value,e.format.decimals);return rr.fromValue(r.add(i),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const r=wn(this._value,this.format.decimals),i=wn(e._value,e.format.decimals);return rr.fromValue(r.sub(i),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const r=wn(this._value,this.format.decimals),i=wn(e._value,e.format.decimals);return rr.fromValue(r.mul(i).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const r=wn(this._value,this.format.decimals),i=wn(e._value,e.format.decimals);return rr.fromValue(r.mul(this.format._multiplier).div(i),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=rr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return this.isNegative()&&i&&(r=r.subUnsafe(tv.toFormat(r.format))),r}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=rr.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return!this.isNegative()&&i&&(r=r.addUnsafe(tv.toFormat(r.format))),r}round(e){e==null&&(e=0);const r=this.toString().split(".");if(r.length===1&&r.push("0"),(e<0||e>80||e%1)&&Nr.throwArgumentError("invalid decimal count","decimals",e),r[1].length<=e)return this;const i=rr.from("1"+yf.substring(0,e),this.format),n=gE.toFormat(this.format);return this.mulUnsafe(i).addUnsafe(n).floor().divUnsafe(i)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&Nr.throwArgumentError("invalid byte width","width",e);const r=At.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return Ho(r,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return rr.fromString(this._value,e)}static fromValue(e,r,i){return i==null&&r!=null&&!vE(r)&&(i=r,r=null),r==null&&(r=0),i==null&&(i="fixed"),rr.fromString(Oc(e,r),ca.from(i))}static fromString(e,r){r==null&&(r="fixed");const i=ca.from(r),n=wn(e,i.decimals);!i.signed&&n.lt(Xb)&&ev("unsigned value cannot be negative","overflow","value",e);let s=null;i.signed?s=n.toTwos(i.width).toHexString():(s=n.toHexString(),s=Ho(s,i.width/8));const o=Oc(n,i.decimals);return new rr(mf,s,o,i)}static fromBytes(e,r){r==null&&(r="fixed");const i=ca.from(r);if(Gb(e).length>i.width/8)throw new Error("overflow");let n=At.from(e);i.signed&&(n=n.fromTwos(i.width));const s=n.toTwos((i.signed?0:1)+i.width).toHexString(),o=Oc(n,i.decimals);return new rr(mf,s,o,i)}static from(e,r){if(typeof e=="string")return rr.fromString(e,r);if(vf(e))return rr.fromBytes(e,r);try{return rr.fromValue(e,0,r)}catch(i){if(i.code!==it.errors.INVALID_ARGUMENT)throw i}return Nr.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}}const tv=rr.from(1),gE=rr.from("0.5"),mE="strings/5.7.0",yE=new it(mE);var rv;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(rv||(rv={}));var ua;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(ua||(ua={}));function wE(t,e,r,i,n){return yE.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function iv(t,e,r,i,n){if(t===ua.BAD_PREFIX||t===ua.UNEXPECTED_CONTINUE){let s=0;for(let o=e+1;o<r.length&&r[o]>>6===2;o++)s++;return s}return t===ua.OVERRUN?r.length-e-1:0}function _E(t,e,r,i,n){return t===ua.OVERLONG?(i.push(n),0):(i.push(65533),iv(t,e,r))}Object.freeze({error:wE,ignore:iv,replace:_E});function xE(t){if(t.length%4!==0)throw new Error("bad data");let e=[];for(let r=0;r<t.length;r+=4)e.push(parseInt(t.substring(r,r+4),16));return e}function Rc(t,e){e||(e=function(n){return[parseInt(n,16)]});let r=0,i={};return t.split(",").forEach(n=>{let s=n.split(":");r+=parseInt(s[0],16),i[r]=e(s[1])}),i}function nv(t){let e=0;return t.split(",").map(r=>{let i=r.split("-");i.length===1?i[1]="0":i[1]===""&&(i[1]="1");let n=e+parseInt(i[0],16);return e=parseInt(i[1],16),{l:n,h:e}})}nv("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(t=>parseInt(t,16)),Rc("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),Rc("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),Rc("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",xE),nv("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");const sv="hash/5.7.0";function AE(t){t=atob(t);const e=[];for(let r=0;r<t.length;r++)e.push(t.charCodeAt(r));return Gb(e)}function av(t,e){e==null&&(e=1);const r=[],i=r.forEach,n=function(s,o){i.call(s,function(h){o>0&&Array.isArray(h)?n(h,o-1):r.push(h)})};return n(t,e),r}function ME(t){const e={};for(let r=0;r<t.length;r++){const i=t[r];e[i[0]]=i[1]}return e}function EE(t){let e=0;function r(){return t[e++]<<8|t[e++]}let i=r(),n=1,s=[0,1];for(let $=1;$<i;$++)s.push(n+=r());let o=r(),h=e;e+=o;let l=0,p=0;function w(){return l==0&&(p=p<<8|t[e++],l=8),p>>--l&1}const M=31,I=Math.pow(2,M),D=I>>>1,N=D>>1,U=I-1;let z=0;for(let $=0;$<M;$++)z=z<<1|w();let H=[],L=0,K=I;for(;;){let $=Math.floor(((z-L+1)*n-1)/K),q=0,y=i;for(;y-q>1;){let Q=q+y>>>1;$<s[Q]?y=Q:q=Q}if(q==0)break;H.push(q);let R=L+Math.floor(K*s[q]/n),V=L+Math.floor(K*s[q+1]/n)-1;for(;!((R^V)&D);)z=z<<1&U|w(),R=R<<1&U,V=V<<1&U|1;for(;R&~V&N;)z=z&D|z<<1&U>>>1|w(),R=R<<1^D,V=(V^D)<<1|D|1;L=R,K=1+V-R}let F=i-4;return H.map($=>{switch($-F){case 3:return F+65792+(t[h++]<<16|t[h++]<<8|t[h++]);case 2:return F+256+(t[h++]<<8|t[h++]);case 1:return F+t[h++];default:return $-1}})}function SE(t){let e=0;return()=>t[e++]}function DE(t){return SE(EE(t))}function IE(t){return t&1?~t>>1:t>>1}function NE(t,e){let r=Array(t);for(let i=0;i<t;i++)r[i]=1+e();return r}function fv(t,e){let r=Array(t);for(let i=0,n=-1;i<t;i++)r[i]=n+=1+e();return r}function OE(t,e){let r=Array(t);for(let i=0,n=0;i<t;i++)r[i]=n+=IE(e());return r}function jo(t,e){let r=fv(t(),t),i=t(),n=fv(i,t),s=NE(i,t);for(let o=0;o<i;o++)for(let h=0;h<s[o];h++)r.push(n[o]+h);return e?r.map(o=>e[o]):r}function RE(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(PE(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(TE(r,t))}return ME(av(e))}function CE(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function ov(t,e,r){let i=Array(t).fill(void 0).map(()=>[]);for(let n=0;n<e;n++)OE(t,r).forEach((s,o)=>i[o].push(s));return i}function PE(t,e){let r=1+e(),i=e(),n=CE(e),s=ov(n.length,1+t,e);return av(s.map((o,h)=>{const l=o[0],p=o.slice(1);return Array(n[h]).fill(void 0).map((w,M)=>{let I=M*i;return[l+M*r,p.map(D=>D+I)]})}))}function TE(t,e){let r=1+e();return ov(r,1+t,e).map(n=>[n[0],n.slice(1)])}function BE(t){let e=jo(t).sort((i,n)=>i-n);return r();function r(){let i=[];for(;;){let p=jo(t,e);if(p.length==0)break;i.push({set:new Set(p),node:r()})}i.sort((p,w)=>w.set.size-p.set.size);let n=t(),s=n%3;n=n/3|0;let o=!!(n&1);n>>=1;let h=n==1,l=n==2;return{branches:i,valid:s,fe0f:o,save:h,check:l}}}function FE(){return DE(AE("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Go=FE();new Set(jo(Go)),new Set(jo(Go)),RE(Go),BE(Go),new it(sv),new Uint8Array(32).fill(0);const LE="rlp/5.7.0";new it(LE);const UE="address/5.7.0";new it(UE);const $E="properties/5.7.0";new it($E),new it(sv),new Uint8Array(32).fill(0),At.from(-1);const qE=At.from(0),zE=At.from(1);At.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Ho(zE.toHexString(),32),Ho(qE.toHexString(),32);var Jr={},ht={},_s=hv;function hv(t,e){if(!t)throw new Error(e||"Assertion failed")}hv.equal=function(e,r,i){if(e!=r)throw new Error(i||"Assertion failed: "+e+" != "+r)};var da={exports:{}};typeof Object.create=="function"?da.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:da.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}};var kE=_s,KE=da.exports;ht.inherits=KE;function HE(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function jE(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var i=0,n=0;n<t.length;n++){var s=t.charCodeAt(n);s<128?r[i++]=s:s<2048?(r[i++]=s>>6|192,r[i++]=s&63|128):HE(t,n)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++n)&1023),r[i++]=s>>18|240,r[i++]=s>>12&63|128,r[i++]=s>>6&63|128,r[i++]=s&63|128):(r[i++]=s>>12|224,r[i++]=s>>6&63|128,r[i++]=s&63|128)}else for(n=0;n<t.length;n++)r[n]=t[n]|0;return r}ht.toArray=jE;function GE(t){for(var e="",r=0;r<t.length;r++)e+=uv(t[r].toString(16));return e}ht.toHex=GE;function cv(t){var e=t>>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}ht.htonl=cv;function VE(t,e){for(var r="",i=0;i<t.length;i++){var n=t[i];e==="little"&&(n=cv(n)),r+=dv(n.toString(16))}return r}ht.toHex32=VE;function uv(t){return t.length===1?"0"+t:t}ht.zero2=uv;function dv(t){return t.length===7?"0"+t:t.length===6?"00"+t:t.length===5?"000"+t:t.length===4?"0000"+t:t.length===3?"00000"+t:t.length===2?"000000"+t:t.length===1?"0000000"+t:t}ht.zero8=dv;function YE(t,e,r,i){var n=r-e;kE(n%4===0);for(var s=new Array(n/4),o=0,h=e;o<s.length;o++,h+=4){var l;i==="big"?l=t[h]<<24|t[h+1]<<16|t[h+2]<<8|t[h+3]:l=t[h+3]<<24|t[h+2]<<16|t[h+1]<<8|t[h],s[o]=l>>>0}return s}ht.join32=YE;function JE(t,e){for(var r=new Array(t.length*4),i=0,n=0;i<t.length;i++,n+=4){var s=t[i];e==="big"?(r[n]=s>>>24,r[n+1]=s>>>16&255,r[n+2]=s>>>8&255,r[n+3]=s&255):(r[n+3]=s>>>24,r[n+2]=s>>>16&255,r[n+1]=s>>>8&255,r[n]=s&255)}return r}ht.split32=JE;function WE(t,e){return t>>>e|t<<32-e}ht.rotr32=WE;function QE(t,e){return t<<e|t>>>32-e}ht.rotl32=QE;function XE(t,e){return t+e>>>0}ht.sum32=XE;function ZE(t,e,r){return t+e+r>>>0}ht.sum32_3=ZE;function eS(t,e,r,i){return t+e+r+i>>>0}ht.sum32_4=eS;function tS(t,e,r,i,n){return t+e+r+i+n>>>0}ht.sum32_5=tS;function rS(t,e,r,i){var n=t[e],s=t[e+1],o=i+s>>>0,h=(o<i?1:0)+r+n;t[e]=h>>>0,t[e+1]=o}ht.sum64=rS;function iS(t,e,r,i){var n=e+i>>>0,s=(n<e?1:0)+t+r;return s>>>0}ht.sum64_hi=iS;function nS(t,e,r,i){var n=e+i;return n>>>0}ht.sum64_lo=nS;function sS(t,e,r,i,n,s,o,h){var l=0,p=e;p=p+i>>>0,l+=p<e?1:0,p=p+s>>>0,l+=p<s?1:0,p=p+h>>>0,l+=p<h?1:0;var w=t+r+n+o+l;return w>>>0}ht.sum64_4_hi=sS;function aS(t,e,r,i,n,s,o,h){var l=e+i+s+h;return l>>>0}ht.sum64_4_lo=aS;function fS(t,e,r,i,n,s,o,h,l,p){var w=0,M=e;M=M+i>>>0,w+=M<e?1:0,M=M+s>>>0,w+=M<s?1:0,M=M+h>>>0,w+=M<h?1:0,M=M+p>>>0,w+=M<p?1:0;var I=t+r+n+o+l+w;return I>>>0}ht.sum64_5_hi=fS;function oS(t,e,r,i,n,s,o,h,l,p){var w=e+i+s+h+p;return w>>>0}ht.sum64_5_lo=oS;function hS(t,e,r){var i=e<<32-r|t>>>r;return i>>>0}ht.rotr64_hi=hS;function cS(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}ht.rotr64_lo=cS;function uS(t,e,r){return t>>>r}ht.shr64_hi=uS;function dS(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}ht.shr64_lo=dS;var la={},lv=ht,lS=_s;function Vo(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}la.BlockHash=Vo,Vo.prototype.update=function(e,r){if(e=lv.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var i=e.length%this._delta8;this.pending=e.slice(e.length-i,e.length),this.pending.length===0&&(this.pending=null),e=lv.join32(e,0,e.length-i,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},Vo.prototype.digest=function(e){return this.update(this._pad()),lS(this.pending===null),this._digest(e)},Vo.prototype._pad=function(){var e=this.pendingTotal,r=this._delta8,i=r-(e+this.padLength)%r,n=new Array(i+this.padLength);n[0]=128;for(var s=1;s<i;s++)n[s]=0;if(e<<=3,this.endian==="big"){for(var o=8;o<this.padLength;o++)n[s++]=0;n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=e>>>24&255,n[s++]=e>>>16&255,n[s++]=e>>>8&255,n[s++]=e&255}else for(n[s++]=e&255,n[s++]=e>>>8&255,n[s++]=e>>>16&255,n[s++]=e>>>24&255,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,o=8;o<this.padLength;o++)n[s++]=0;return n};var pa={},Ji={},pS=ht,Wi=pS.rotr32;function bS(t,e,r,i){if(t===0)return pv(e,r,i);if(t===1||t===3)return vv(e,r,i);if(t===2)return bv(e,r,i)}Ji.ft_1=bS;function pv(t,e,r){return t&e^~t&r}Ji.ch32=pv;function bv(t,e,r){return t&e^t&r^e&r}Ji.maj32=bv;function vv(t,e,r){return t^e^r}Ji.p32=vv;function vS(t){return Wi(t,2)^Wi(t,13)^Wi(t,22)}Ji.s0_256=vS;function gS(t){return Wi(t,6)^Wi(t,11)^Wi(t,25)}Ji.s1_256=gS;function mS(t){return Wi(t,7)^Wi(t,18)^t>>>3}Ji.g0_256=mS;function yS(t){return Wi(t,17)^Wi(t,19)^t>>>10}Ji.g1_256=yS;var ba=ht,wS=la,_S=Ji,Cc=ba.rotl32,wf=ba.sum32,xS=ba.sum32_5,AS=_S.ft_1,gv=wS.BlockHash,MS=[1518500249,1859775393,2400959708,3395469782];function Qi(){if(!(this instanceof Qi))return new Qi;gv.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}ba.inherits(Qi,gv);var ES=Qi;Qi.blockSize=512,Qi.outSize=160,Qi.hmacStrength=80,Qi.padLength=64,Qi.prototype._update=function(e,r){for(var i=this.W,n=0;n<16;n++)i[n]=e[r+n];for(;n<i.length;n++)i[n]=Cc(i[n-3]^i[n-8]^i[n-14]^i[n-16],1);var s=this.h[0],o=this.h[1],h=this.h[2],l=this.h[3],p=this.h[4];for(n=0;n<i.length;n++){var w=~~(n/20),M=xS(Cc(s,5),AS(w,o,h,l),p,i[n],MS[w]);p=l,l=h,h=Cc(o,30),o=s,s=M}this.h[0]=wf(this.h[0],s),this.h[1]=wf(this.h[1],o),this.h[2]=wf(this.h[2],h),this.h[3]=wf(this.h[3],l),this.h[4]=wf(this.h[4],p)},Qi.prototype._digest=function(e){return e==="hex"?ba.toHex32(this.h,"big"):ba.split32(this.h,"big")};var va=ht,SS=la,ga=Ji,DS=_s,Ii=va.sum32,IS=va.sum32_4,NS=va.sum32_5,OS=ga.ch32,RS=ga.maj32,CS=ga.s0_256,PS=ga.s1_256,TS=ga.g0_256,BS=ga.g1_256,mv=SS.BlockHash,FS=[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];function Xi(){if(!(this instanceof Xi))return new Xi;mv.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=FS,this.W=new Array(64)}va.inherits(Xi,mv);var yv=Xi;Xi.blockSize=512,Xi.outSize=256,Xi.hmacStrength=192,Xi.padLength=64,Xi.prototype._update=function(e,r){for(var i=this.W,n=0;n<16;n++)i[n]=e[r+n];for(;n<i.length;n++)i[n]=IS(BS(i[n-2]),i[n-7],TS(i[n-15]),i[n-16]);var s=this.h[0],o=this.h[1],h=this.h[2],l=this.h[3],p=this.h[4],w=this.h[5],M=this.h[6],I=this.h[7];for(DS(this.k.length===i.length),n=0;n<i.length;n++){var D=NS(I,PS(p),OS(p,w,M),this.k[n],i[n]),N=Ii(CS(s),RS(s,o,h));I=M,M=w,w=p,p=Ii(l,D),l=h,h=o,o=s,s=Ii(D,N)}this.h[0]=Ii(this.h[0],s),this.h[1]=Ii(this.h[1],o),this.h[2]=Ii(this.h[2],h),this.h[3]=Ii(this.h[3],l),this.h[4]=Ii(this.h[4],p),this.h[5]=Ii(this.h[5],w),this.h[6]=Ii(this.h[6],M),this.h[7]=Ii(this.h[7],I)},Xi.prototype._digest=function(e){return e==="hex"?va.toHex32(this.h,"big"):va.split32(this.h,"big")};var Pc=ht,wv=yv;function _n(){if(!(this instanceof _n))return new _n;wv.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Pc.inherits(_n,wv);var LS=_n;_n.blockSize=512,_n.outSize=224,_n.hmacStrength=192,_n.padLength=64,_n.prototype._digest=function(e){return e==="hex"?Pc.toHex32(this.h.slice(0,7),"big"):Pc.split32(this.h.slice(0,7),"big")};var Ur=ht,US=la,$S=_s,Zi=Ur.rotr64_hi,en=Ur.rotr64_lo,_v=Ur.shr64_hi,xv=Ur.shr64_lo,zn=Ur.sum64,Tc=Ur.sum64_hi,Bc=Ur.sum64_lo,qS=Ur.sum64_4_hi,zS=Ur.sum64_4_lo,kS=Ur.sum64_5_hi,KS=Ur.sum64_5_lo,Av=US.BlockHash,HS=[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];function Ni(){if(!(this instanceof Ni))return new Ni;Av.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=HS,this.W=new Array(160)}Ur.inherits(Ni,Av);var Mv=Ni;Ni.blockSize=1024,Ni.outSize=512,Ni.hmacStrength=192,Ni.padLength=128,Ni.prototype._prepareBlock=function(e,r){for(var i=this.W,n=0;n<32;n++)i[n]=e[r+n];for(;n<i.length;n+=2){var s=tD(i[n-4],i[n-3]),o=rD(i[n-4],i[n-3]),h=i[n-14],l=i[n-13],p=ZS(i[n-30],i[n-29]),w=eD(i[n-30],i[n-29]),M=i[n-32],I=i[n-31];i[n]=qS(s,o,h,l,p,w,M,I),i[n+1]=zS(s,o,h,l,p,w,M,I)}},Ni.prototype._update=function(e,r){this._prepareBlock(e,r);var i=this.W,n=this.h[0],s=this.h[1],o=this.h[2],h=this.h[3],l=this.h[4],p=this.h[5],w=this.h[6],M=this.h[7],I=this.h[8],D=this.h[9],N=this.h[10],U=this.h[11],z=this.h[12],H=this.h[13],L=this.h[14],K=this.h[15];$S(this.k.length===i.length);for(var F=0;F<i.length;F+=2){var $=L,q=K,y=QS(I,D),R=XS(I,D),V=jS(I,D,N,U,z),Q=GS(I,D,N,U,z,H),O=this.k[F],d=this.k[F+1],u=i[F],a=i[F+1],f=kS($,q,y,R,V,Q,O,d,u,a),b=KS($,q,y,R,V,Q,O,d,u,a);$=JS(n,s),q=WS(n,s),y=VS(n,s,o,h,l),R=YS(n,s,o,h,l,p);var x=Tc($,q,y,R),A=Bc($,q,y,R);L=z,K=H,z=N,H=U,N=I,U=D,I=Tc(w,M,f,b),D=Bc(M,M,f,b),w=l,M=p,l=o,p=h,o=n,h=s,n=Tc(f,b,x,A),s=Bc(f,b,x,A)}zn(this.h,0,n,s),zn(this.h,2,o,h),zn(this.h,4,l,p),zn(this.h,6,w,M),zn(this.h,8,I,D),zn(this.h,10,N,U),zn(this.h,12,z,H),zn(this.h,14,L,K)},Ni.prototype._digest=function(e){return e==="hex"?Ur.toHex32(this.h,"big"):Ur.split32(this.h,"big")};function jS(t,e,r,i,n){var s=t&r^~t&n;return s<0&&(s+=4294967296),s}function GS(t,e,r,i,n,s){var o=e&i^~e&s;return o<0&&(o+=4294967296),o}function VS(t,e,r,i,n){var s=t&r^t&n^r&n;return s<0&&(s+=4294967296),s}function YS(t,e,r,i,n,s){var o=e&i^e&s^i&s;return o<0&&(o+=4294967296),o}function JS(t,e){var r=Zi(t,e,28),i=Zi(e,t,2),n=Zi(e,t,7),s=r^i^n;return s<0&&(s+=4294967296),s}function WS(t,e){var r=en(t,e,28),i=en(e,t,2),n=en(e,t,7),s=r^i^n;return s<0&&(s+=4294967296),s}function QS(t,e){var r=Zi(t,e,14),i=Zi(t,e,18),n=Zi(e,t,9),s=r^i^n;return s<0&&(s+=4294967296),s}function XS(t,e){var r=en(t,e,14),i=en(t,e,18),n=en(e,t,9),s=r^i^n;return s<0&&(s+=4294967296),s}function ZS(t,e){var r=Zi(t,e,1),i=Zi(t,e,8),n=_v(t,e,7),s=r^i^n;return s<0&&(s+=4294967296),s}function eD(t,e){var r=en(t,e,1),i=en(t,e,8),n=xv(t,e,7),s=r^i^n;return s<0&&(s+=4294967296),s}function tD(t,e){var r=Zi(t,e,19),i=Zi(e,t,29),n=_v(t,e,6),s=r^i^n;return s<0&&(s+=4294967296),s}function rD(t,e){var r=en(t,e,19),i=en(e,t,29),n=xv(t,e,6),s=r^i^n;return s<0&&(s+=4294967296),s}var Fc=ht,Ev=Mv;function xn(){if(!(this instanceof xn))return new xn;Ev.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Fc.inherits(xn,Ev);var iD=xn;xn.blockSize=1024,xn.outSize=384,xn.hmacStrength=192,xn.padLength=128,xn.prototype._digest=function(e){return e==="hex"?Fc.toHex32(this.h.slice(0,12),"big"):Fc.split32(this.h.slice(0,12),"big")},pa.sha1=ES,pa.sha224=LS,pa.sha256=yv,pa.sha384=iD,pa.sha512=Mv;var Sv={},xs=ht,nD=la,Yo=xs.rotl32,Dv=xs.sum32,_f=xs.sum32_3,Iv=xs.sum32_4,Nv=nD.BlockHash;function tn(){if(!(this instanceof tn))return new tn;Nv.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}xs.inherits(tn,Nv),Sv.ripemd160=tn,tn.blockSize=512,tn.outSize=160,tn.hmacStrength=192,tn.padLength=64,tn.prototype._update=function(e,r){for(var i=this.h[0],n=this.h[1],s=this.h[2],o=this.h[3],h=this.h[4],l=i,p=n,w=s,M=o,I=h,D=0;D<80;D++){var N=Dv(Yo(Iv(i,Ov(D,n,s,o),e[fD[D]+r],sD(D)),hD[D]),h);i=h,h=o,o=Yo(s,10),s=n,n=N,N=Dv(Yo(Iv(l,Ov(79-D,p,w,M),e[oD[D]+r],aD(D)),cD[D]),I),l=I,I=M,M=Yo(w,10),w=p,p=N}N=_f(this.h[1],s,M),this.h[1]=_f(this.h[2],o,I),this.h[2]=_f(this.h[3],h,l),this.h[3]=_f(this.h[4],i,p),this.h[4]=_f(this.h[0],n,w),this.h[0]=N},tn.prototype._digest=function(e){return e==="hex"?xs.toHex32(this.h,"little"):xs.split32(this.h,"little")};function Ov(t,e,r,i){return t<=15?e^r^i:t<=31?e&r|~e&i:t<=47?(e|~r)^i:t<=63?e&i|r&~i:e^(r|~i)}function sD(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function aD(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}var fD=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],oD=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],hD=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],cD=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],uD=ht,dD=_s;function ma(t,e,r){if(!(this instanceof ma))return new ma(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(uD.toArray(e,r))}var lD=ma;ma.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),dD(e.length<=this.blockSize);for(var r=e.length;r<this.blockSize;r++)e.push(0);for(r=0;r<e.length;r++)e[r]^=54;for(this.inner=new this.Hash().update(e),r=0;r<e.length;r++)e[r]^=106;this.outer=new this.Hash().update(e)},ma.prototype.update=function(e,r){return this.inner.update(e,r),this},ma.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(t){var e=t;e.utils=ht,e.common=la,e.sha=pa,e.ripemd=Sv,e.hmac=lD,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(Jr);function ya(t,e,r){return r={path:e,exports:{},require:function(i,n){return pD(i,n??r.path)}},t(r,r.exports),r.exports}function pD(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var Lc=Rv;function Rv(t,e){if(!t)throw new Error(e||"Assertion failed")}Rv.equal=function(e,r,i){if(e!=r)throw new Error(i||"Assertion failed: "+e+" != "+r)};var Oi=ya(function(t,e){var r=e;function i(o,h){if(Array.isArray(o))return o.slice();if(!o)return[];var l=[];if(typeof o!="string"){for(var p=0;p<o.length;p++)l[p]=o[p]|0;return l}if(h==="hex"){o=o.replace(/[^a-z0-9]+/ig,""),o.length%2!==0&&(o="0"+o);for(var p=0;p<o.length;p+=2)l.push(parseInt(o[p]+o[p+1],16))}else for(var p=0;p<o.length;p++){var w=o.charCodeAt(p),M=w>>8,I=w&255;M?l.push(M,I):l.push(I)}return l}r.toArray=i;function n(o){return o.length===1?"0"+o:o}r.zero2=n;function s(o){for(var h="",l=0;l<o.length;l++)h+=n(o[l].toString(16));return h}r.toHex=s,r.encode=function(h,l){return l==="hex"?s(h):h}}),Wr=ya(function(t,e){var r=e;r.assert=Lc,r.toArray=Oi.toArray,r.zero2=Oi.zero2,r.toHex=Oi.toHex,r.encode=Oi.encode;function i(l,p,w){var M=new Array(Math.max(l.bitLength(),w)+1);M.fill(0);for(var I=1<<p+1,D=l.clone(),N=0;N<M.length;N++){var U,z=D.andln(I-1);D.isOdd()?(z>(I>>1)-1?U=(I>>1)-z:U=z,D.isubn(U)):U=0,M[N]=U,D.iushrn(1)}return M}r.getNAF=i;function n(l,p){var w=[[],[]];l=l.clone(),p=p.clone();for(var M=0,I=0,D;l.cmpn(-M)>0||p.cmpn(-I)>0;){var N=l.andln(3)+M&3,U=p.andln(3)+I&3;N===3&&(N=-1),U===3&&(U=-1);var z;N&1?(D=l.andln(7)+M&7,(D===3||D===5)&&U===2?z=-N:z=N):z=0,w[0].push(z);var H;U&1?(D=p.andln(7)+I&7,(D===3||D===5)&&N===2?H=-U:H=U):H=0,w[1].push(H),2*M===z+1&&(M=1-M),2*I===H+1&&(I=1-I),l.iushrn(1),p.iushrn(1)}return w}r.getJSF=n;function s(l,p,w){var M="_"+p;l.prototype[p]=function(){return this[M]!==void 0?this[M]:this[M]=w.call(this)}}r.cachedProperty=s;function o(l){return typeof l=="string"?r.toArray(l,"hex"):l}r.parseBytes=o;function h(l){return new Ze(l,"hex","le")}r.intFromLE=h}),Jo=Wr.getNAF,bD=Wr.getJSF,Wo=Wr.assert;function kn(t,e){this.type=t,this.p=new Ze(e.p,16),this.red=e.prime?Ze.red(e.prime):Ze.mont(this.p),this.zero=new Ze(0).toRed(this.red),this.one=new Ze(1).toRed(this.red),this.two=new Ze(2).toRed(this.red),this.n=e.n&&new Ze(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var As=kn;kn.prototype.point=function(){throw new Error("Not implemented")},kn.prototype.validate=function(){throw new Error("Not implemented")},kn.prototype._fixedNafMul=function(e,r){Wo(e.precomputed);var i=e._getDoubles(),n=Jo(r,1,this._bitLength),s=(1<<i.step+1)-(i.step%2===0?2:1);s/=3;var o=[],h,l;for(h=0;h<n.length;h+=i.step){l=0;for(var p=h+i.step-1;p>=h;p--)l=(l<<1)+n[p];o.push(l)}for(var w=this.jpoint(null,null,null),M=this.jpoint(null,null,null),I=s;I>0;I--){for(h=0;h<o.length;h++)l=o[h],l===I?M=M.mixedAdd(i.points[h]):l===-I&&(M=M.mixedAdd(i.points[h].neg()));w=w.add(M)}return w.toP()},kn.prototype._wnafMul=function(e,r){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var s=n.points,o=Jo(r,i,this._bitLength),h=this.jpoint(null,null,null),l=o.length-1;l>=0;l--){for(var p=0;l>=0&&o[l]===0;l--)p++;if(l>=0&&p++,h=h.dblp(p),l<0)break;var w=o[l];Wo(w!==0),e.type==="affine"?w>0?h=h.mixedAdd(s[w-1>>1]):h=h.mixedAdd(s[-w-1>>1].neg()):w>0?h=h.add(s[w-1>>1]):h=h.add(s[-w-1>>1].neg())}return e.type==="affine"?h.toP():h},kn.prototype._wnafMulAdd=function(e,r,i,n,s){var o=this._wnafT1,h=this._wnafT2,l=this._wnafT3,p=0,w,M,I;for(w=0;w<n;w++){I=r[w];var D=I._getNAFPoints(e);o[w]=D.wnd,h[w]=D.points}for(w=n-1;w>=1;w-=2){var N=w-1,U=w;if(o[N]!==1||o[U]!==1){l[N]=Jo(i[N],o[N],this._bitLength),l[U]=Jo(i[U],o[U],this._bitLength),p=Math.max(l[N].length,p),p=Math.max(l[U].length,p);continue}var z=[r[N],null,null,r[U]];r[N].y.cmp(r[U].y)===0?(z[1]=r[N].add(r[U]),z[2]=r[N].toJ().mixedAdd(r[U].neg())):r[N].y.cmp(r[U].y.redNeg())===0?(z[1]=r[N].toJ().mixedAdd(r[U]),z[2]=r[N].add(r[U].neg())):(z[1]=r[N].toJ().mixedAdd(r[U]),z[2]=r[N].toJ().mixedAdd(r[U].neg()));var H=[-3,-1,-5,-7,0,7,5,1,3],L=bD(i[N],i[U]);for(p=Math.max(L[0].length,p),l[N]=new Array(p),l[U]=new Array(p),M=0;M<p;M++){var K=L[0][M]|0,F=L[1][M]|0;l[N][M]=H[(K+1)*3+(F+1)],l[U][M]=0,h[N]=z}}var $=this.jpoint(null,null,null),q=this._wnafT4;for(w=p;w>=0;w--){for(var y=0;w>=0;){var R=!0;for(M=0;M<n;M++)q[M]=l[M][w]|0,q[M]!==0&&(R=!1);if(!R)break;y++,w--}if(w>=0&&y++,$=$.dblp(y),w<0)break;for(M=0;M<n;M++){var V=q[M];V!==0&&(V>0?I=h[M][V-1>>1]:V<0&&(I=h[M][-V-1>>1].neg()),I.type==="affine"?$=$.mixedAdd(I):$=$.add(I))}}for(w=0;w<n;w++)h[w]=null;return s?$:$.toP()};function ui(t,e){this.curve=t,this.type=e,this.precomputed=null}kn.BasePoint=ui,ui.prototype.eq=function(){throw new Error("Not implemented")},ui.prototype.validate=function(){return this.curve.validate(this)},kn.prototype.decodePoint=function(e,r){e=Wr.toArray(e,r);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?Wo(e[e.length-1]%2===0):e[0]===7&&Wo(e[e.length-1]%2===1);var n=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return n}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")},ui.prototype.encodeCompressed=function(e){return this.encode(e,!0)},ui.prototype._encode=function(e){var r=this.curve.p.byteLength(),i=this.getX().toArray("be",r);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",r))},ui.prototype.encode=function(e,r){return Wr.encode(this._encode(r),e)},ui.prototype.precompute=function(e){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,e),r.beta=this._getBeta(),this.precomputed=r,this},ui.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return r?r.points.length>=Math.ceil((e.bitLength()+1)/r.step):!1},ui.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,s=0;s<r;s+=e){for(var o=0;o<e;o++)n=n.dbl();i.push(n)}return{step:e,points:i}},ui.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),s=1;s<i;s++)r[s]=r[s-1].add(n);return{wnd:e,points:r}},ui.prototype._getBeta=function(){return null},ui.prototype.dblp=function(e){for(var r=this,i=0;i<e;i++)r=r.dbl();return r};var Uc=ya(function(t){typeof Object.create=="function"?t.exports=function(r,i){i&&(r.super_=i,r.prototype=Object.create(i.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(r,i){if(i){r.super_=i;var n=function(){};n.prototype=i.prototype,r.prototype=new n,r.prototype.constructor=r}}}),vD=Wr.assert;function di(t){As.call(this,"short",t),this.a=new Ze(t.a,16).toRed(this.red),this.b=new Ze(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Uc(di,As);var gD=di;di.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,i;if(e.beta)r=new Ze(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);r=n[0].cmp(n[1])<0?n[0]:n[1],r=r.toRed(this.red)}if(e.lambda)i=new Ze(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(r))===0?i=s[0]:(i=s[1],vD(this.g.mul(i).x.cmp(this.g.x.redMul(r))===0))}var o;return e.basis?o=e.basis.map(function(h){return{a:new Ze(h.a,16),b:new Ze(h.b,16)}}):o=this._getEndoBasis(i),{beta:r,lambda:i,basis:o}}},di.prototype._getEndoRoots=function(e){var r=e===this.p?this.red:Ze.mont(e),i=new Ze(2).toRed(r).redInvm(),n=i.redNeg(),s=new Ze(3).toRed(r).redNeg().redSqrt().redMul(i),o=n.redAdd(s).fromRed(),h=n.redSub(s).fromRed();return[o,h]},di.prototype._getEndoBasis=function(e){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),s=new Ze(1),o=new Ze(0),h=new Ze(0),l=new Ze(1),p,w,M,I,D,N,U,z=0,H,L;i.cmpn(0)!==0;){var K=n.div(i);H=n.sub(K.mul(i)),L=h.sub(K.mul(s));var F=l.sub(K.mul(o));if(!M&&H.cmp(r)<0)p=U.neg(),w=s,M=H.neg(),I=L;else if(M&&++z===2)break;U=H,n=i,i=H,h=s,s=L,l=o,o=F}D=H.neg(),N=L;var $=M.sqr().add(I.sqr()),q=D.sqr().add(N.sqr());return q.cmp($)>=0&&(D=p,N=w),M.negative&&(M=M.neg(),I=I.neg()),D.negative&&(D=D.neg(),N=N.neg()),[{a:M,b:I},{a:D,b:N}]},di.prototype._endoSplit=function(e){var r=this.endo.basis,i=r[0],n=r[1],s=n.b.mul(e).divRound(this.n),o=i.b.neg().mul(e).divRound(this.n),h=s.mul(i.a),l=o.mul(n.a),p=s.mul(i.b),w=o.mul(n.b),M=e.sub(h).sub(l),I=p.add(w).neg();return{k1:M,k2:I}},di.prototype.pointFromX=function(e,r){e=new Ze(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var s=n.fromRed().isOdd();return(r&&!s||!r&&s)&&(n=n.redNeg()),this.point(e,n)},di.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,i=e.y,n=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(s).cmpn(0)===0},di.prototype._endoWnafMulAdd=function(e,r,i){for(var n=this._endoWnafT1,s=this._endoWnafT2,o=0;o<e.length;o++){var h=this._endoSplit(r[o]),l=e[o],p=l._getBeta();h.k1.negative&&(h.k1.ineg(),l=l.neg(!0)),h.k2.negative&&(h.k2.ineg(),p=p.neg(!0)),n[o*2]=l,n[o*2+1]=p,s[o*2]=h.k1,s[o*2+1]=h.k2}for(var w=this._wnafMulAdd(1,n,s,o*2,i),M=0;M<o*2;M++)n[M]=null,s[M]=null;return w};function Gt(t,e,r,i){As.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Ze(e,16),this.y=new Ze(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}Uc(Gt,As.BasePoint),di.prototype.point=function(e,r,i){return new Gt(this,e,r,i)},di.prototype.pointFromJSON=function(e,r){return Gt.fromJSON(this,e,r)},Gt.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var r=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,n=function(s){return i.point(s.x.redMul(i.endo.beta),s.y)};e.beta=r,r.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return r}},Gt.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Gt.fromJSON=function(e,r,i){typeof r=="string"&&(r=JSON.parse(r));var n=e.point(r[0],r[1],i);if(!r[2])return n;function s(h){return e.point(h[0],h[1],i)}var o=r[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(s))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(s))}},n},Gt.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Gt.prototype.isInfinity=function(){return this.inf},Gt.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var i=r.redSqr().redISub(this.x).redISub(e.x),n=r.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)},Gt.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),s=i.redAdd(i).redIAdd(i).redIAdd(r).redMul(n),o=s.redSqr().redISub(this.x.redAdd(this.x)),h=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,h)},Gt.prototype.getX=function(){return this.x.fromRed()},Gt.prototype.getY=function(){return this.y.fromRed()},Gt.prototype.mul=function(e){return e=new Ze(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Gt.prototype.mulAdd=function(e,r,i){var n=[this,r],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)},Gt.prototype.jmulAdd=function(e,r,i){var n=[this,r],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)},Gt.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Gt.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(s){return s.neg()};r.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return r},Gt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function ir(t,e,r,i){As.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Ze(0)):(this.x=new Ze(e,16),this.y=new Ze(r,16),this.z=new Ze(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Uc(ir,As.BasePoint),di.prototype.jpoint=function(e,r,i){return new ir(this,e,r,i)},ir.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),i=this.x.redMul(r),n=this.y.redMul(r).redMul(e);return this.curve.point(i,n)},ir.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},ir.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(r),s=e.x.redMul(i),o=this.y.redMul(r.redMul(e.z)),h=e.y.redMul(i.redMul(this.z)),l=n.redSub(s),p=o.redSub(h);if(l.cmpn(0)===0)return p.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var w=l.redSqr(),M=w.redMul(l),I=n.redMul(w),D=p.redSqr().redIAdd(M).redISub(I).redISub(I),N=p.redMul(I.redISub(D)).redISub(o.redMul(M)),U=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(D,N,U)},ir.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),i=this.x,n=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),h=i.redSub(n),l=s.redSub(o);if(h.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var p=h.redSqr(),w=p.redMul(h),M=i.redMul(p),I=l.redSqr().redIAdd(w).redISub(M).redISub(M),D=l.redMul(M.redISub(I)).redISub(s.redMul(w)),N=this.z.redMul(h);return this.curve.jpoint(I,D,N)},ir.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var i=this;for(r=0;r<e;r++)i=i.dbl();return i}var n=this.curve.a,s=this.curve.tinv,o=this.x,h=this.y,l=this.z,p=l.redSqr().redSqr(),w=h.redAdd(h);for(r=0;r<e;r++){var M=o.redSqr(),I=w.redSqr(),D=I.redSqr(),N=M.redAdd(M).redIAdd(M).redIAdd(n.redMul(p)),U=o.redMul(I),z=N.redSqr().redISub(U.redAdd(U)),H=U.redISub(z),L=N.redMul(H);L=L.redIAdd(L).redISub(D);var K=w.redMul(l);r+1<e&&(p=p.redMul(D)),o=z,l=K,w=L}return this.curve.jpoint(o,w.redMul(s),l)},ir.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},ir.prototype._zeroDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),o=s.redSqr(),h=this.x.redAdd(s).redSqr().redISub(n).redISub(o);h=h.redIAdd(h);var l=n.redAdd(n).redIAdd(n),p=l.redSqr().redISub(h).redISub(h),w=o.redIAdd(o);w=w.redIAdd(w),w=w.redIAdd(w),e=p,r=l.redMul(h.redISub(p)).redISub(w),i=this.y.redAdd(this.y)}else{var M=this.x.redSqr(),I=this.y.redSqr(),D=I.redSqr(),N=this.x.redAdd(I).redSqr().redISub(M).redISub(D);N=N.redIAdd(N);var U=M.redAdd(M).redIAdd(M),z=U.redSqr(),H=D.redIAdd(D);H=H.redIAdd(H),H=H.redIAdd(H),e=z.redISub(N).redISub(N),r=U.redMul(N.redISub(e)).redISub(H),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,r,i)},ir.prototype._threeDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),o=s.redSqr(),h=this.x.redAdd(s).redSqr().redISub(n).redISub(o);h=h.redIAdd(h);var l=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),p=l.redSqr().redISub(h).redISub(h);e=p;var w=o.redIAdd(o);w=w.redIAdd(w),w=w.redIAdd(w),r=l.redMul(h.redISub(p)).redISub(w),i=this.y.redAdd(this.y)}else{var M=this.z.redSqr(),I=this.y.redSqr(),D=this.x.redMul(I),N=this.x.redSub(M).redMul(this.x.redAdd(M));N=N.redAdd(N).redIAdd(N);var U=D.redIAdd(D);U=U.redIAdd(U);var z=U.redAdd(U);e=N.redSqr().redISub(z),i=this.y.redAdd(this.z).redSqr().redISub(I).redISub(M);var H=I.redSqr();H=H.redIAdd(H),H=H.redIAdd(H),H=H.redIAdd(H),r=N.redMul(U.redISub(e)).redISub(H)}return this.curve.jpoint(e,r,i)},ir.prototype._dbl=function(){var e=this.curve.a,r=this.x,i=this.y,n=this.z,s=n.redSqr().redSqr(),o=r.redSqr(),h=i.redSqr(),l=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(s)),p=r.redAdd(r);p=p.redIAdd(p);var w=p.redMul(h),M=l.redSqr().redISub(w.redAdd(w)),I=w.redISub(M),D=h.redSqr();D=D.redIAdd(D),D=D.redIAdd(D),D=D.redIAdd(D);var N=l.redMul(I).redISub(D),U=i.redAdd(i).redMul(n);return this.curve.jpoint(M,N,U)},ir.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),r=this.y.redSqr(),i=this.z.redSqr(),n=r.redSqr(),s=e.redAdd(e).redIAdd(e),o=s.redSqr(),h=this.x.redAdd(r).redSqr().redISub(e).redISub(n);h=h.redIAdd(h),h=h.redAdd(h).redIAdd(h),h=h.redISub(o);var l=h.redSqr(),p=n.redIAdd(n);p=p.redIAdd(p),p=p.redIAdd(p),p=p.redIAdd(p);var w=s.redIAdd(h).redSqr().redISub(o).redISub(l).redISub(p),M=r.redMul(w);M=M.redIAdd(M),M=M.redIAdd(M);var I=this.x.redMul(l).redISub(M);I=I.redIAdd(I),I=I.redIAdd(I);var D=this.y.redMul(w.redMul(p.redISub(w)).redISub(h.redMul(l)));D=D.redIAdd(D),D=D.redIAdd(D),D=D.redIAdd(D);var N=this.z.redAdd(h).redSqr().redISub(i).redISub(l);return this.curve.jpoint(I,D,N)},ir.prototype.mul=function(e,r){return e=new Ze(e,r),this.curve._wnafMul(this,e)},ir.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var r=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(r)).cmpn(0)!==0)return!1;var n=r.redMul(this.z),s=i.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0},ir.prototype.eqXToP=function(e){var r=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(r);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(r);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(s),this.x.cmp(i)===0)return!0}},ir.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},ir.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Qo=ya(function(t,e){var r=e;r.base=As,r.short=gD,r.mont=null,r.edwards=null}),Xo=ya(function(t,e){var r=e,i=Wr.assert;function n(h){h.type==="short"?this.curve=new Qo.short(h):h.type==="edwards"?this.curve=new Qo.edwards(h):this.curve=new Qo.mont(h),this.g=this.curve.g,this.n=this.curve.n,this.hash=h.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=n;function s(h,l){Object.defineProperty(r,h,{configurable:!0,enumerable:!0,get:function(){var p=new n(l);return Object.defineProperty(r,h,{configurable:!0,enumerable:!0,value:p}),p}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Jr.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Jr.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Jr.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Jr.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Jr.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Jr.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Jr.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Jr.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function Kn(t){if(!(this instanceof Kn))return new Kn(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Oi.toArray(t.entropy,t.entropyEnc||"hex"),r=Oi.toArray(t.nonce,t.nonceEnc||"hex"),i=Oi.toArray(t.pers,t.persEnc||"hex");Lc(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var Cv=Kn;Kn.prototype._init=function(e,r,i){var n=e.concat(r).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},Kn.prototype._hmac=function(){return new Jr.hmac(this.hash,this.K)},Kn.prototype._update=function(e){var r=this._hmac().update(this.V).update([0]);e&&(r=r.update(e)),this.K=r.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},Kn.prototype.reseed=function(e,r,i,n){typeof r!="string"&&(n=i,i=r,r=null),e=Oi.toArray(e,r),i=Oi.toArray(i,n),Lc(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1},Kn.prototype.generate=function(e,r,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(n=i,i=r,r=null),i&&(i=Oi.toArray(i,n||"hex"),this._update(i));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var o=s.slice(0,e);return this._update(i),this._reseed++,Oi.encode(o,r)};var $c=Wr.assert;function wr(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var qc=wr;wr.fromPublic=function(e,r,i){return r instanceof wr?r:new wr(e,{pub:r,pubEnc:i})},wr.fromPrivate=function(e,r,i){return r instanceof wr?r:new wr(e,{priv:r,privEnc:i})},wr.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},wr.prototype.getPublic=function(e,r){return typeof e=="string"&&(r=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,e):this.pub},wr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},wr.prototype._importPrivate=function(e,r){this.priv=new Ze(e,r||16),this.priv=this.priv.umod(this.ec.curve.n)},wr.prototype._importPublic=function(e,r){if(e.x||e.y){this.ec.curve.type==="mont"?$c(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&$c(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,r)},wr.prototype.derive=function(e){return e.validate()||$c(e.validate(),"public point not validated"),e.mul(this.priv).getX()},wr.prototype.sign=function(e,r,i){return this.ec.sign(e,this,r,i)},wr.prototype.verify=function(e,r){return this.ec.verify(e,r,this)},wr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var mD=Wr.assert;function Zo(t,e){if(t instanceof Zo)return t;this._importDER(t,e)||(mD(t.r&&t.s,"Signature without r or s"),this.r=new Ze(t.r,16),this.s=new Ze(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var e0=Zo;function yD(){this.place=0}function zc(t,e){var r=t[e.place++];if(!(r&128))return r;var i=r&15;if(i===0||i>4)return!1;for(var n=0,s=0,o=e.place;s<i;s++,o++)n<<=8,n|=t[o],n>>>=0;return n<=127?!1:(e.place=o,n)}function Pv(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}Zo.prototype._importDER=function(e,r){e=Wr.toArray(e,r);var i=new yD;if(e[i.place++]!==48)return!1;var n=zc(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var s=zc(e,i);if(s===!1)return!1;var o=e.slice(i.place,s+i.place);if(i.place+=s,e[i.place++]!==2)return!1;var h=zc(e,i);if(h===!1||e.length!==h+i.place)return!1;var l=e.slice(i.place,h+i.place);if(o[0]===0)if(o[1]&128)o=o.slice(1);else return!1;if(l[0]===0)if(l[1]&128)l=l.slice(1);else return!1;return this.r=new Ze(o),this.s=new Ze(l),this.recoveryParam=null,!0};function kc(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Zo.prototype.toDER=function(e){var r=this.r.toArray(),i=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),i[0]&128&&(i=[0].concat(i)),r=Pv(r),i=Pv(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];kc(n,r.length),n=n.concat(r),n.push(2),kc(n,i.length);var s=n.concat(i),o=[48];return kc(o,s.length),o=o.concat(s),Wr.encode(o,e)};var wD=function(){throw new Error("unsupported")},Tv=Wr.assert;function li(t){if(!(this instanceof li))return new li(t);typeof t=="string"&&(Tv(Object.prototype.hasOwnProperty.call(Xo,t),"Unknown curve "+t),t=Xo[t]),t instanceof Xo.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var _D=li;li.prototype.keyPair=function(e){return new qc(this,e)},li.prototype.keyFromPrivate=function(e,r){return qc.fromPrivate(this,e,r)},li.prototype.keyFromPublic=function(e,r){return qc.fromPublic(this,e,r)},li.prototype.genKeyPair=function(e){e||(e={});for(var r=new Cv({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||wD(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new Ze(2));;){var s=new Ze(r.generate(i));if(!(s.cmp(n)>0))return s.iaddn(1),this.keyFromPrivate(s)}},li.prototype._truncateToN=function(e,r){var i=e.byteLength()*8-this.n.bitLength();return i>0&&(e=e.ushrn(i)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},li.prototype.sign=function(e,r,i,n){typeof i=="object"&&(n=i,i=null),n||(n={}),r=this.keyFromPrivate(r,i),e=this._truncateToN(new Ze(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),h=e.toArray("be",s),l=new Cv({hash:this.hash,entropy:o,nonce:h,pers:n.pers,persEnc:n.persEnc||"utf8"}),p=this.n.sub(new Ze(1)),w=0;;w++){var M=n.k?n.k(w):new Ze(l.generate(this.n.byteLength()));if(M=this._truncateToN(M,!0),!(M.cmpn(1)<=0||M.cmp(p)>=0)){var I=this.g.mul(M);if(!I.isInfinity()){var D=I.getX(),N=D.umod(this.n);if(N.cmpn(0)!==0){var U=M.invm(this.n).mul(N.mul(r.getPrivate()).iadd(e));if(U=U.umod(this.n),U.cmpn(0)!==0){var z=(I.getY().isOdd()?1:0)|(D.cmp(N)!==0?2:0);return n.canonical&&U.cmp(this.nh)>0&&(U=this.n.sub(U),z^=1),new e0({r:N,s:U,recoveryParam:z})}}}}}},li.prototype.verify=function(e,r,i,n){e=this._truncateToN(new Ze(e,16)),i=this.keyFromPublic(i,n),r=new e0(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var h=o.invm(this.n),l=h.mul(e).umod(this.n),p=h.mul(s).umod(this.n),w;return this.curve._maxwellTrick?(w=this.g.jmulAdd(l,i.getPublic(),p),w.isInfinity()?!1:w.eqXToP(s)):(w=this.g.mulAdd(l,i.getPublic(),p),w.isInfinity()?!1:w.getX().umod(this.n).cmp(s)===0)},li.prototype.recoverPubKey=function(t,e,r,i){Tv((3&r)===r,"The recovery param is more than two bits"),e=new e0(e,i);var n=this.n,s=new Ze(t),o=e.r,h=e.s,l=r&1,p=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&p)throw new Error("Unable to find sencond key candinate");p?o=this.curve.pointFromX(o.add(this.curve.n),l):o=this.curve.pointFromX(o,l);var w=e.r.invm(n),M=n.sub(s).mul(w).umod(n),I=h.mul(w).umod(n);return this.g.mulAdd(M,o,I)},li.prototype.getKeyRecoveryParam=function(t,e,r,i){if(e=new e0(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(t,e,n)}catch{continue}if(s.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var xD=ya(function(t,e){var r=e;r.version="6.5.4",r.utils=Wr,r.rand=function(){throw new Error("unsupported")},r.curve=Qo,r.curves=Xo,r.ec=_D,r.eddsa=null});xD.ec;const AD="signing-key/5.7.0";new it(AD);const MD="transactions/5.7.0";new it(MD);var Bv;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Bv||(Bv={}));var ED={},t0={},tt={},Fv={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(h,l){var p=h>>>16&65535,w=h&65535,M=l>>>16&65535,I=l&65535;return w*I+(p*I+w*M<<16>>>0)|0}t.mul=Math.imul||e;function r(h,l){return h+l|0}t.add=r;function i(h,l){return h-l|0}t.sub=i;function n(h,l){return h<<l|h>>>32-l}t.rotl=n;function s(h,l){return h<<32-l|h>>>l}t.rotr=s;function o(h){return typeof h=="number"&&isFinite(h)&&Math.floor(h)===h}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(h){return t.isInteger(h)&&h>=-t.MAX_SAFE_INTEGER&&h<=t.MAX_SAFE_INTEGER}})(Fv),Object.defineProperty(tt,"__esModule",{value:!0});var Lv=Fv;function SD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}tt.readInt16BE=SD;function DD(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}tt.readUint16BE=DD;function ID(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}tt.readInt16LE=ID;function ND(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}tt.readUint16LE=ND;function Uv(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}tt.writeUint16BE=Uv,tt.writeInt16BE=Uv;function $v(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}tt.writeUint16LE=$v,tt.writeInt16LE=$v;function Kc(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}tt.readInt32BE=Kc;function Hc(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}tt.readUint32BE=Hc;function jc(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}tt.readInt32LE=jc;function Gc(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}tt.readUint32LE=Gc;function r0(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}tt.writeUint32BE=r0,tt.writeInt32BE=r0;function i0(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}tt.writeUint32LE=i0,tt.writeInt32LE=i0;function OD(t,e){e===void 0&&(e=0);var r=Kc(t,e),i=Kc(t,e+4);return r*4294967296+i-(i>>31)*4294967296}tt.readInt64BE=OD;function RD(t,e){e===void 0&&(e=0);var r=Hc(t,e),i=Hc(t,e+4);return r*4294967296+i}tt.readUint64BE=RD;function CD(t,e){e===void 0&&(e=0);var r=jc(t,e),i=jc(t,e+4);return i*4294967296+r-(r>>31)*4294967296}tt.readInt64LE=CD;function PD(t,e){e===void 0&&(e=0);var r=Gc(t,e),i=Gc(t,e+4);return i*4294967296+r}tt.readUint64LE=PD;function qv(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),r0(t/4294967296>>>0,e,r),r0(t>>>0,e,r+4),e}tt.writeUint64BE=qv,tt.writeInt64BE=qv;function zv(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),i0(t>>>0,e,r),i0(t/4294967296>>>0,e,r+4),e}tt.writeUint64LE=zv,tt.writeInt64LE=zv;function TD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=t/8+r-1;s>=r;s--)i+=e[s]*n,n*=256;return i}tt.readUintBE=TD;function BD(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=r;s<r+t/8;s++)i+=e[s]*n,n*=256;return i}tt.readUintLE=BD;function FD(t,e,r,i){if(r===void 0&&(r=new Uint8Array(t/8)),i===void 0&&(i=0),t%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Lv.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var n=1,s=t/8+i-1;s>=i;s--)r[s]=e/n&255,n*=256;return r}tt.writeUintBE=FD;function LD(t,e,r,i){if(r===void 0&&(r=new Uint8Array(t/8)),i===void 0&&(i=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Lv.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var n=1,s=i;s<i+t/8;s++)r[s]=e/n&255,n*=256;return r}tt.writeUintLE=LD;function UD(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e)}tt.readFloat32BE=UD;function $D(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e,!0)}tt.readFloat32LE=$D;function qD(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e)}tt.readFloat64BE=qD;function zD(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e,!0)}tt.readFloat64LE=zD;function kD(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(r,t),e}tt.writeFloat32BE=kD;function KD(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(r,t,!0),e}tt.writeFloat32LE=KD;function HD(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(r,t),e}tt.writeFloat64BE=HD;function jD(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(r,t,!0),e}tt.writeFloat64LE=jD;var Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});function GD(t){for(var e=0;e<t.length;e++)t[e]=0;return t}Qr.wipe=GD,Object.defineProperty(t0,"__esModule",{value:!0});var _r=tt,Vc=Qr,VD=20;function YD(t,e,r){for(var i=1634760805,n=857760878,s=2036477234,o=1797285236,h=r[3]<<24|r[2]<<16|r[1]<<8|r[0],l=r[7]<<24|r[6]<<16|r[5]<<8|r[4],p=r[11]<<24|r[10]<<16|r[9]<<8|r[8],w=r[15]<<24|r[14]<<16|r[13]<<8|r[12],M=r[19]<<24|r[18]<<16|r[17]<<8|r[16],I=r[23]<<24|r[22]<<16|r[21]<<8|r[20],D=r[27]<<24|r[26]<<16|r[25]<<8|r[24],N=r[31]<<24|r[30]<<16|r[29]<<8|r[28],U=e[3]<<24|e[2]<<16|e[1]<<8|e[0],z=e[7]<<24|e[6]<<16|e[5]<<8|e[4],H=e[11]<<24|e[10]<<16|e[9]<<8|e[8],L=e[15]<<24|e[14]<<16|e[13]<<8|e[12],K=i,F=n,$=s,q=o,y=h,R=l,V=p,Q=w,O=M,d=I,u=D,a=N,f=U,b=z,x=H,A=L,_=0;_<VD;_+=2)K=K+y|0,f^=K,f=f>>>32-16|f<<16,O=O+f|0,y^=O,y=y>>>32-12|y<<12,F=F+R|0,b^=F,b=b>>>32-16|b<<16,d=d+b|0,R^=d,R=R>>>32-12|R<<12,$=$+V|0,x^=$,x=x>>>32-16|x<<16,u=u+x|0,V^=u,V=V>>>32-12|V<<12,q=q+Q|0,A^=q,A=A>>>32-16|A<<16,a=a+A|0,Q^=a,Q=Q>>>32-12|Q<<12,$=$+V|0,x^=$,x=x>>>32-8|x<<8,u=u+x|0,V^=u,V=V>>>32-7|V<<7,q=q+Q|0,A^=q,A=A>>>32-8|A<<8,a=a+A|0,Q^=a,Q=Q>>>32-7|Q<<7,F=F+R|0,b^=F,b=b>>>32-8|b<<8,d=d+b|0,R^=d,R=R>>>32-7|R<<7,K=K+y|0,f^=K,f=f>>>32-8|f<<8,O=O+f|0,y^=O,y=y>>>32-7|y<<7,K=K+R|0,A^=K,A=A>>>32-16|A<<16,u=u+A|0,R^=u,R=R>>>32-12|R<<12,F=F+V|0,f^=F,f=f>>>32-16|f<<16,a=a+f|0,V^=a,V=V>>>32-12|V<<12,$=$+Q|0,b^=$,b=b>>>32-16|b<<16,O=O+b|0,Q^=O,Q=Q>>>32-12|Q<<12,q=q+y|0,x^=q,x=x>>>32-16|x<<16,d=d+x|0,y^=d,y=y>>>32-12|y<<12,$=$+Q|0,b^=$,b=b>>>32-8|b<<8,O=O+b|0,Q^=O,Q=Q>>>32-7|Q<<7,q=q+y|0,x^=q,x=x>>>32-8|x<<8,d=d+x|0,y^=d,y=y>>>32-7|y<<7,F=F+V|0,f^=F,f=f>>>32-8|f<<8,a=a+f|0,V^=a,V=V>>>32-7|V<<7,K=K+R|0,A^=K,A=A>>>32-8|A<<8,u=u+A|0,R^=u,R=R>>>32-7|R<<7;_r.writeUint32LE(K+i|0,t,0),_r.writeUint32LE(F+n|0,t,4),_r.writeUint32LE($+s|0,t,8),_r.writeUint32LE(q+o|0,t,12),_r.writeUint32LE(y+h|0,t,16),_r.writeUint32LE(R+l|0,t,20),_r.writeUint32LE(V+p|0,t,24),_r.writeUint32LE(Q+w|0,t,28),_r.writeUint32LE(O+M|0,t,32),_r.writeUint32LE(d+I|0,t,36),_r.writeUint32LE(u+D|0,t,40),_r.writeUint32LE(a+N|0,t,44),_r.writeUint32LE(f+U|0,t,48),_r.writeUint32LE(b+z|0,t,52),_r.writeUint32LE(x+H|0,t,56),_r.writeUint32LE(A+L|0,t,60)}function kv(t,e,r,i,n){if(n===void 0&&(n=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<r.length)throw new Error("ChaCha: destination is shorter than source");var s,o;if(n===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=new Uint8Array(16),o=s.length-e.length,s.set(e,o)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,o=n}for(var h=new Uint8Array(64),l=0;l<r.length;l+=64){YD(h,s,t);for(var p=l;p<l+64&&p<r.length;p++)i[p]=r[p]^h[p-l];WD(s,0,o)}return Vc.wipe(h),n===0&&Vc.wipe(s),i}t0.streamXOR=kv;function JD(t,e,r,i){return i===void 0&&(i=0),Vc.wipe(r),kv(t,e,r,r,i)}t0.stream=JD;function WD(t,e,r){for(var i=1;r--;)i=i+(t[e]&255)|0,t[e]=i&255,i>>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}var Kv={},Hn={};Object.defineProperty(Hn,"__esModule",{value:!0});function QD(t,e,r){return~(t-1)&e|t-1&r}Hn.select=QD;function XD(t,e){return(t|0)-(e|0)-1>>>31&1}Hn.lessOrEqual=XD;function Hv(t,e){if(t.length!==e.length)return 0;for(var r=0,i=0;i<t.length;i++)r|=t[i]^e[i];return 1&r-1>>>8}Hn.compare=Hv;function ZD(t,e){return t.length===0||e.length===0?!1:Hv(t,e)!==0}Hn.equal=ZD,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Hn,r=Qr;t.DIGEST_LENGTH=16;var i=function(){function o(h){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var l=h[0]|h[1]<<8;this._r[0]=l&8191;var p=h[2]|h[3]<<8;this._r[1]=(l>>>13|p<<3)&8191;var w=h[4]|h[5]<<8;this._r[2]=(p>>>10|w<<6)&7939;var M=h[6]|h[7]<<8;this._r[3]=(w>>>7|M<<9)&8191;var I=h[8]|h[9]<<8;this._r[4]=(M>>>4|I<<12)&255,this._r[5]=I>>>1&8190;var D=h[10]|h[11]<<8;this._r[6]=(I>>>14|D<<2)&8191;var N=h[12]|h[13]<<8;this._r[7]=(D>>>11|N<<5)&8065;var U=h[14]|h[15]<<8;this._r[8]=(N>>>8|U<<8)&8191,this._r[9]=U>>>5&127,this._pad[0]=h[16]|h[17]<<8,this._pad[1]=h[18]|h[19]<<8,this._pad[2]=h[20]|h[21]<<8,this._pad[3]=h[22]|h[23]<<8,this._pad[4]=h[24]|h[25]<<8,this._pad[5]=h[26]|h[27]<<8,this._pad[6]=h[28]|h[29]<<8,this._pad[7]=h[30]|h[31]<<8}return o.prototype._blocks=function(h,l,p){for(var w=this._fin?0:2048,M=this._h[0],I=this._h[1],D=this._h[2],N=this._h[3],U=this._h[4],z=this._h[5],H=this._h[6],L=this._h[7],K=this._h[8],F=this._h[9],$=this._r[0],q=this._r[1],y=this._r[2],R=this._r[3],V=this._r[4],Q=this._r[5],O=this._r[6],d=this._r[7],u=this._r[8],a=this._r[9];p>=16;){var f=h[l+0]|h[l+1]<<8;M+=f&8191;var b=h[l+2]|h[l+3]<<8;I+=(f>>>13|b<<3)&8191;var x=h[l+4]|h[l+5]<<8;D+=(b>>>10|x<<6)&8191;var A=h[l+6]|h[l+7]<<8;N+=(x>>>7|A<<9)&8191;var _=h[l+8]|h[l+9]<<8;U+=(A>>>4|_<<12)&8191,z+=_>>>1&8191;var c=h[l+10]|h[l+11]<<8;H+=(_>>>14|c<<2)&8191;var m=h[l+12]|h[l+13]<<8;L+=(c>>>11|m<<5)&8191;var v=h[l+14]|h[l+15]<<8;K+=(m>>>8|v<<8)&8191,F+=v>>>5|w;var S=0,G=S;G+=M*$,G+=I*(5*a),G+=D*(5*u),G+=N*(5*d),G+=U*(5*O),S=G>>>13,G&=8191,G+=z*(5*Q),G+=H*(5*V),G+=L*(5*R),G+=K*(5*y),G+=F*(5*q),S+=G>>>13,G&=8191;var E=S;E+=M*q,E+=I*$,E+=D*(5*a),E+=N*(5*u),E+=U*(5*d),S=E>>>13,E&=8191,E+=z*(5*O),E+=H*(5*Q),E+=L*(5*V),E+=K*(5*R),E+=F*(5*y),S+=E>>>13,E&=8191;var k=S;k+=M*y,k+=I*q,k+=D*$,k+=N*(5*a),k+=U*(5*u),S=k>>>13,k&=8191,k+=z*(5*d),k+=H*(5*O),k+=L*(5*Q),k+=K*(5*V),k+=F*(5*R),S+=k>>>13,k&=8191;var C=S;C+=M*R,C+=I*y,C+=D*q,C+=N*$,C+=U*(5*a),S=C>>>13,C&=8191,C+=z*(5*u),C+=H*(5*d),C+=L*(5*O),C+=K*(5*Q),C+=F*(5*V),S+=C>>>13,C&=8191;var B=S;B+=M*V,B+=I*R,B+=D*y,B+=N*q,B+=U*$,S=B>>>13,B&=8191,B+=z*(5*a),B+=H*(5*u),B+=L*(5*d),B+=K*(5*O),B+=F*(5*Q),S+=B>>>13,B&=8191;var P=S;P+=M*Q,P+=I*V,P+=D*R,P+=N*y,P+=U*q,S=P>>>13,P&=8191,P+=z*$,P+=H*(5*a),P+=L*(5*u),P+=K*(5*d),P+=F*(5*O),S+=P>>>13,P&=8191;var g=S;g+=M*O,g+=I*Q,g+=D*V,g+=N*R,g+=U*y,S=g>>>13,g&=8191,g+=z*q,g+=H*$,g+=L*(5*a),g+=K*(5*u),g+=F*(5*d),S+=g>>>13,g&=8191;var T=S;T+=M*d,T+=I*O,T+=D*Q,T+=N*V,T+=U*R,S=T>>>13,T&=8191,T+=z*y,T+=H*q,T+=L*$,T+=K*(5*a),T+=F*(5*u),S+=T>>>13,T&=8191;var j=S;j+=M*u,j+=I*d,j+=D*O,j+=N*Q,j+=U*V,S=j>>>13,j&=8191,j+=z*R,j+=H*y,j+=L*q,j+=K*$,j+=F*(5*a),S+=j>>>13,j&=8191;var J=S;J+=M*a,J+=I*u,J+=D*d,J+=N*O,J+=U*Q,S=J>>>13,J&=8191,J+=z*V,J+=H*R,J+=L*y,J+=K*q,J+=F*$,S+=J>>>13,J&=8191,S=(S<<2)+S|0,S=S+G|0,G=S&8191,S=S>>>13,E+=S,M=G,I=E,D=k,N=C,U=B,z=P,H=g,L=T,K=j,F=J,l+=16,p-=16}this._h[0]=M,this._h[1]=I,this._h[2]=D,this._h[3]=N,this._h[4]=U,this._h[5]=z,this._h[6]=H,this._h[7]=L,this._h[8]=K,this._h[9]=F},o.prototype.finish=function(h,l){l===void 0&&(l=0);var p=new Uint16Array(10),w,M,I,D;if(this._leftover){for(D=this._leftover,this._buffer[D++]=1;D<16;D++)this._buffer[D]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(w=this._h[1]>>>13,this._h[1]&=8191,D=2;D<10;D++)this._h[D]+=w,w=this._h[D]>>>13,this._h[D]&=8191;for(this._h[0]+=w*5,w=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=w,w=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=w,p[0]=this._h[0]+5,w=p[0]>>>13,p[0]&=8191,D=1;D<10;D++)p[D]=this._h[D]+w,w=p[D]>>>13,p[D]&=8191;for(p[9]-=8192,M=(w^1)-1,D=0;D<10;D++)p[D]&=M;for(M=~M,D=0;D<10;D++)this._h[D]=this._h[D]&M|p[D];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,I=this._h[0]+this._pad[0],this._h[0]=I&65535,D=1;D<8;D++)I=(this._h[D]+this._pad[D]|0)+(I>>>16)|0,this._h[D]=I&65535;return h[l+0]=this._h[0]>>>0,h[l+1]=this._h[0]>>>8,h[l+2]=this._h[1]>>>0,h[l+3]=this._h[1]>>>8,h[l+4]=this._h[2]>>>0,h[l+5]=this._h[2]>>>8,h[l+6]=this._h[3]>>>0,h[l+7]=this._h[3]>>>8,h[l+8]=this._h[4]>>>0,h[l+9]=this._h[4]>>>8,h[l+10]=this._h[5]>>>0,h[l+11]=this._h[5]>>>8,h[l+12]=this._h[6]>>>0,h[l+13]=this._h[6]>>>8,h[l+14]=this._h[7]>>>0,h[l+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(h){var l=0,p=h.length,w;if(this._leftover){w=16-this._leftover,w>p&&(w=p);for(var M=0;M<w;M++)this._buffer[this._leftover+M]=h[l+M];if(p-=w,l+=w,this._leftover+=w,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(p>=16&&(w=p-p%16,this._blocks(h,l,w),l+=w,p-=w),p){for(var M=0;M<p;M++)this._buffer[this._leftover+M]=h[l+M];this._leftover+=p}return this},o.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var h=new Uint8Array(16);return this.finish(h),h},o.prototype.clean=function(){return r.wipe(this._buffer),r.wipe(this._r),r.wipe(this._h),r.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},o}();t.Poly1305=i;function n(o,h){var l=new i(o);l.update(h);var p=l.digest();return l.clean(),p}t.oneTimeAuth=n;function s(o,h){return o.length!==t.DIGEST_LENGTH||h.length!==t.DIGEST_LENGTH?!1:e.equal(o,h)}t.equal=s}(Kv),function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=t0,r=Kv,i=Qr,n=tt,s=Hn;t.KEY_LENGTH=32,t.NONCE_LENGTH=12,t.TAG_LENGTH=16;var o=new Uint8Array(16),h=function(){function l(p){if(this.nonceLength=t.NONCE_LENGTH,this.tagLength=t.TAG_LENGTH,p.length!==t.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(p)}return l.prototype.seal=function(p,w,M,I){if(p.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var D=new Uint8Array(16);D.set(p,D.length-p.length);var N=new Uint8Array(32);e.stream(this._key,D,N,4);var U=w.length+this.tagLength,z;if(I){if(I.length!==U)throw new Error("ChaCha20Poly1305: incorrect destination length");z=I}else z=new Uint8Array(U);return e.streamXOR(this._key,D,w,z,4),this._authenticate(z.subarray(z.length-this.tagLength,z.length),N,z.subarray(0,z.length-this.tagLength),M),i.wipe(D),z},l.prototype.open=function(p,w,M,I){if(p.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(w.length<this.tagLength)return null;var D=new Uint8Array(16);D.set(p,D.length-p.length);var N=new Uint8Array(32);e.stream(this._key,D,N,4);var U=new Uint8Array(this.tagLength);if(this._authenticate(U,N,w.subarray(0,w.length-this.tagLength),M),!s.equal(U,w.subarray(w.length-this.tagLength,w.length)))return null;var z=w.length-this.tagLength,H;if(I){if(I.length!==z)throw new Error("ChaCha20Poly1305: incorrect destination length");H=I}else H=new Uint8Array(z);return e.streamXOR(this._key,D,w.subarray(0,w.length-this.tagLength),H,4),i.wipe(D),H},l.prototype.clean=function(){return i.wipe(this._key),this},l.prototype._authenticate=function(p,w,M,I){var D=new r.Poly1305(w);I&&(D.update(I),I.length%16>0&&D.update(o.subarray(I.length%16))),D.update(M),M.length%16>0&&D.update(o.subarray(M.length%16));var N=new Uint8Array(8);I&&n.writeUint64LE(I.length,N),D.update(N),n.writeUint64LE(M.length,N),D.update(N);for(var U=D.digest(),z=0;z<U.length;z++)p[z]=U[z];D.clean(),i.wipe(U),i.wipe(N)},l}();t.ChaCha20Poly1305=h}(ED);var jv={},xf={},Yc={};Object.defineProperty(Yc,"__esModule",{value:!0});function eI(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}Yc.isSerializableHash=eI,Object.defineProperty(xf,"__esModule",{value:!0});var rn=Yc,tI=Hn,rI=Qr,Gv=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(i).clean():i.set(r);for(var n=0;n<i.length;n++)i[n]^=54;this._inner.update(i);for(var n=0;n<i.length;n++)i[n]^=106;this._outer.update(i),rn.isSerializableHash(this._inner)&&rn.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),rI.wipe(i)}return t.prototype.reset=function(){if(!rn.isSerializableHash(this._inner)||!rn.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.clean=function(){rn.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),rn.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},t.prototype.update=function(e){return this._inner.update(e),this},t.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype.saveState=function(){if(!rn.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},t.prototype.restoreState=function(e){if(!rn.isSerializableHash(this._inner)||!rn.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.cleanSavedState=function(e){if(!rn.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},t}();xf.HMAC=Gv;function iI(t,e,r){var i=new Gv(t,e);i.update(r);var n=i.digest();return i.clean(),n}xf.hmac=iI,xf.equal=tI.equal,Object.defineProperty(jv,"__esModule",{value:!0});var Vv=xf,Yv=Qr,nI=function(){function t(e,r,i,n){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=Vv.hmac(this._hash,i,r);this._hmac=new Vv.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),i=0;i<r.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),r[i]=this._buffer[this._bufpos++];return r},t.prototype.clean=function(){this._hmac.clean(),Yv.wipe(this._buffer),Yv.wipe(this._counter),this._bufpos=0},t}();jv.HKDF=nI;var Jc={},n0={},s0={};Object.defineProperty(s0,"__esModule",{value:!0}),s0.BrowserRandomSource=void 0;const Jv=65536;class sI{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let i=0;i<r.length;i+=Jv)this._crypto.getRandomValues(r.subarray(i,i+Math.min(r.length-i,Jv)));return r}}s0.BrowserRandomSource=sI;var a0={};Object.defineProperty(a0,"__esModule",{value:!0}),a0.NodeRandomSource=void 0;const aI=Qr;class fI{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof fd<"u"){const e=Nn;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const i=new Uint8Array(e);for(let n=0;n<i.length;n++)i[n]=r[n];return(0,aI.wipe)(r),i}}a0.NodeRandomSource=fI,Object.defineProperty(n0,"__esModule",{value:!0}),n0.SystemRandomSource=void 0;const oI=s0,hI=a0;class cI{constructor(){if(this.isAvailable=!1,this.name="",this._source=new oI.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new hI.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}n0.SystemRandomSource=cI,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const e=n0,r=tt,i=Qr;t.defaultRandomSource=new e.SystemRandomSource;function n(p,w=t.defaultRandomSource){return w.randomBytes(p)}t.randomBytes=n;function s(p=t.defaultRandomSource){const w=n(4,p),M=(0,r.readUint32LE)(w);return(0,i.wipe)(w),M}t.randomUint32=s;const o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function h(p,w=o,M=t.defaultRandomSource){if(w.length<2)throw new Error("randomString charset is too short");if(w.length>256)throw new Error("randomString charset is too long");let I="";const D=w.length,N=256-256%D;for(;p>0;){const U=n(Math.ceil(p*256/N),M);for(let z=0;z<U.length&&p>0;z++){const H=U[z];H<N&&(I+=w.charAt(H%D),p--)}(0,i.wipe)(U)}return I}t.randomString=h;function l(p,w=o,M=t.defaultRandomSource){const I=Math.ceil(p/(Math.log(w.length)/Math.LN2));return h(I,w,M)}t.randomStringForEntropy=l}(Jc);var uI={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=tt,r=Qr;t.DIGEST_LENGTH=32,t.BLOCK_SIZE=64;var i=function(){function h(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return h.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},h.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},h.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._temp),this.reset()},h.prototype.update=function(l,p){if(p===void 0&&(p=l.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var w=0;if(this._bytesHashed+=p,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&p>0;)this._buffer[this._bufferLength++]=l[w++],p--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(p>=this.blockSize&&(w=s(this._temp,this._state,l,w,p),p%=this.blockSize);p>0;)this._buffer[this._bufferLength++]=l[w++],p--;return this},h.prototype.finish=function(l){if(!this._finished){var p=this._bytesHashed,w=this._bufferLength,M=p/536870912|0,I=p<<3,D=p%64<56?64:128;this._buffer[w]=128;for(var N=w+1;N<D-8;N++)this._buffer[N]=0;e.writeUint32BE(M,this._buffer,D-8),e.writeUint32BE(I,this._buffer,D-4),s(this._temp,this._state,this._buffer,0,D),this._finished=!0}for(var N=0;N<this.digestLength/4;N++)e.writeUint32BE(this._state[N],l,N*4);return this},h.prototype.digest=function(){var l=new Uint8Array(this.digestLength);return this.finish(l),l},h.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},h.prototype.restoreState=function(l){return this._state.set(l.state),this._bufferLength=l.bufferLength,l.buffer&&this._buffer.set(l.buffer),this._bytesHashed=l.bytesHashed,this._finished=!1,this},h.prototype.cleanSavedState=function(l){r.wipe(l.state),l.buffer&&r.wipe(l.buffer),l.bufferLength=0,l.bytesHashed=0},h}();t.SHA256=i;var n=new Int32Array([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]);function s(h,l,p,w,M){for(;M>=64;){for(var I=l[0],D=l[1],N=l[2],U=l[3],z=l[4],H=l[5],L=l[6],K=l[7],F=0;F<16;F++){var $=w+F*4;h[F]=e.readUint32BE(p,$)}for(var F=16;F<64;F++){var q=h[F-2],y=(q>>>17|q<<32-17)^(q>>>19|q<<32-19)^q>>>10;q=h[F-15];var R=(q>>>7|q<<32-7)^(q>>>18|q<<32-18)^q>>>3;h[F]=(y+h[F-7]|0)+(R+h[F-16]|0)}for(var F=0;F<64;F++){var y=(((z>>>6|z<<26)^(z>>>11|z<<21)^(z>>>25|z<<7))+(z&H^~z&L)|0)+(K+(n[F]+h[F]|0)|0)|0,R=((I>>>2|I<<32-2)^(I>>>13|I<<32-13)^(I>>>22|I<<32-22))+(I&D^I&N^D&N)|0;K=L,L=H,H=z,z=U+y|0,U=N,N=D,D=I,I=y+R|0}l[0]+=I,l[1]+=D,l[2]+=N,l[3]+=U,l[4]+=z,l[5]+=H,l[6]+=L,l[7]+=K,w+=64,M-=64}return w}function o(h){var l=new i;l.update(h);var p=l.digest();return l.clean(),p}t.hash=o})(uI);var dI={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=Jc,r=Qr;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function i(F){const $=new Float64Array(16);if(F)for(let q=0;q<F.length;q++)$[q]=F[q];return $}const n=new Uint8Array(32);n[0]=9;const s=i([56129,1]);function o(F){let $=1;for(let q=0;q<16;q++){let y=F[q]+$+65535;$=Math.floor(y/65536),F[q]=y-$*65536}F[0]+=$-1+37*($-1)}function h(F,$,q){const y=~(q-1);for(let R=0;R<16;R++){const V=y&(F[R]^$[R]);F[R]^=V,$[R]^=V}}function l(F,$){const q=i(),y=i();for(let R=0;R<16;R++)y[R]=$[R];o(y),o(y),o(y);for(let R=0;R<2;R++){q[0]=y[0]-65517;for(let Q=1;Q<15;Q++)q[Q]=y[Q]-65535-(q[Q-1]>>16&1),q[Q-1]&=65535;q[15]=y[15]-32767-(q[14]>>16&1);const V=q[15]>>16&1;q[14]&=65535,h(y,q,1-V)}for(let R=0;R<16;R++)F[2*R]=y[R]&255,F[2*R+1]=y[R]>>8}function p(F,$){for(let q=0;q<16;q++)F[q]=$[2*q]+($[2*q+1]<<8);F[15]&=32767}function w(F,$,q){for(let y=0;y<16;y++)F[y]=$[y]+q[y]}function M(F,$,q){for(let y=0;y<16;y++)F[y]=$[y]-q[y]}function I(F,$,q){let y,R,V=0,Q=0,O=0,d=0,u=0,a=0,f=0,b=0,x=0,A=0,_=0,c=0,m=0,v=0,S=0,G=0,E=0,k=0,C=0,B=0,P=0,g=0,T=0,j=0,J=0,W=0,X=0,ve=0,_e=0,ae=0,De=0,me=q[0],ie=q[1],de=q[2],he=q[3],te=q[4],fe=q[5],se=q[6],ee=q[7],le=q[8],ge=q[9],re=q[10],ye=q[11],we=q[12],ne=q[13],xe=q[14],Ae=q[15];y=$[0],V+=y*me,Q+=y*ie,O+=y*de,d+=y*he,u+=y*te,a+=y*fe,f+=y*se,b+=y*ee,x+=y*le,A+=y*ge,_+=y*re,c+=y*ye,m+=y*we,v+=y*ne,S+=y*xe,G+=y*Ae,y=$[1],Q+=y*me,O+=y*ie,d+=y*de,u+=y*he,a+=y*te,f+=y*fe,b+=y*se,x+=y*ee,A+=y*le,_+=y*ge,c+=y*re,m+=y*ye,v+=y*we,S+=y*ne,G+=y*xe,E+=y*Ae,y=$[2],O+=y*me,d+=y*ie,u+=y*de,a+=y*he,f+=y*te,b+=y*fe,x+=y*se,A+=y*ee,_+=y*le,c+=y*ge,m+=y*re,v+=y*ye,S+=y*we,G+=y*ne,E+=y*xe,k+=y*Ae,y=$[3],d+=y*me,u+=y*ie,a+=y*de,f+=y*he,b+=y*te,x+=y*fe,A+=y*se,_+=y*ee,c+=y*le,m+=y*ge,v+=y*re,S+=y*ye,G+=y*we,E+=y*ne,k+=y*xe,C+=y*Ae,y=$[4],u+=y*me,a+=y*ie,f+=y*de,b+=y*he,x+=y*te,A+=y*fe,_+=y*se,c+=y*ee,m+=y*le,v+=y*ge,S+=y*re,G+=y*ye,E+=y*we,k+=y*ne,C+=y*xe,B+=y*Ae,y=$[5],a+=y*me,f+=y*ie,b+=y*de,x+=y*he,A+=y*te,_+=y*fe,c+=y*se,m+=y*ee,v+=y*le,S+=y*ge,G+=y*re,E+=y*ye,k+=y*we,C+=y*ne,B+=y*xe,P+=y*Ae,y=$[6],f+=y*me,b+=y*ie,x+=y*de,A+=y*he,_+=y*te,c+=y*fe,m+=y*se,v+=y*ee,S+=y*le,G+=y*ge,E+=y*re,k+=y*ye,C+=y*we,B+=y*ne,P+=y*xe,g+=y*Ae,y=$[7],b+=y*me,x+=y*ie,A+=y*de,_+=y*he,c+=y*te,m+=y*fe,v+=y*se,S+=y*ee,G+=y*le,E+=y*ge,k+=y*re,C+=y*ye,B+=y*we,P+=y*ne,g+=y*xe,T+=y*Ae,y=$[8],x+=y*me,A+=y*ie,_+=y*de,c+=y*he,m+=y*te,v+=y*fe,S+=y*se,G+=y*ee,E+=y*le,k+=y*ge,C+=y*re,B+=y*ye,P+=y*we,g+=y*ne,T+=y*xe,j+=y*Ae,y=$[9],A+=y*me,_+=y*ie,c+=y*de,m+=y*he,v+=y*te,S+=y*fe,G+=y*se,E+=y*ee,k+=y*le,C+=y*ge,B+=y*re,P+=y*ye,g+=y*we,T+=y*ne,j+=y*xe,J+=y*Ae,y=$[10],_+=y*me,c+=y*ie,m+=y*de,v+=y*he,S+=y*te,G+=y*fe,E+=y*se,k+=y*ee,C+=y*le,B+=y*ge,P+=y*re,g+=y*ye,T+=y*we,j+=y*ne,J+=y*xe,W+=y*Ae,y=$[11],c+=y*me,m+=y*ie,v+=y*de,S+=y*he,G+=y*te,E+=y*fe,k+=y*se,C+=y*ee,B+=y*le,P+=y*ge,g+=y*re,T+=y*ye,j+=y*we,J+=y*ne,W+=y*xe,X+=y*Ae,y=$[12],m+=y*me,v+=y*ie,S+=y*de,G+=y*he,E+=y*te,k+=y*fe,C+=y*se,B+=y*ee,P+=y*le,g+=y*ge,T+=y*re,j+=y*ye,J+=y*we,W+=y*ne,X+=y*xe,ve+=y*Ae,y=$[13],v+=y*me,S+=y*ie,G+=y*de,E+=y*he,k+=y*te,C+=y*fe,B+=y*se,P+=y*ee,g+=y*le,T+=y*ge,j+=y*re,J+=y*ye,W+=y*we,X+=y*ne,ve+=y*xe,_e+=y*Ae,y=$[14],S+=y*me,G+=y*ie,E+=y*de,k+=y*he,C+=y*te,B+=y*fe,P+=y*se,g+=y*ee,T+=y*le,j+=y*ge,J+=y*re,W+=y*ye,X+=y*we,ve+=y*ne,_e+=y*xe,ae+=y*Ae,y=$[15],G+=y*me,E+=y*ie,k+=y*de,C+=y*he,B+=y*te,P+=y*fe,g+=y*se,T+=y*ee,j+=y*le,J+=y*ge,W+=y*re,X+=y*ye,ve+=y*we,_e+=y*ne,ae+=y*xe,De+=y*Ae,V+=38*E,Q+=38*k,O+=38*C,d+=38*B,u+=38*P,a+=38*g,f+=38*T,b+=38*j,x+=38*J,A+=38*W,_+=38*X,c+=38*ve,m+=38*_e,v+=38*ae,S+=38*De,R=1,y=V+R+65535,R=Math.floor(y/65536),V=y-R*65536,y=Q+R+65535,R=Math.floor(y/65536),Q=y-R*65536,y=O+R+65535,R=Math.floor(y/65536),O=y-R*65536,y=d+R+65535,R=Math.floor(y/65536),d=y-R*65536,y=u+R+65535,R=Math.floor(y/65536),u=y-R*65536,y=a+R+65535,R=Math.floor(y/65536),a=y-R*65536,y=f+R+65535,R=Math.floor(y/65536),f=y-R*65536,y=b+R+65535,R=Math.floor(y/65536),b=y-R*65536,y=x+R+65535,R=Math.floor(y/65536),x=y-R*65536,y=A+R+65535,R=Math.floor(y/65536),A=y-R*65536,y=_+R+65535,R=Math.floor(y/65536),_=y-R*65536,y=c+R+65535,R=Math.floor(y/65536),c=y-R*65536,y=m+R+65535,R=Math.floor(y/65536),m=y-R*65536,y=v+R+65535,R=Math.floor(y/65536),v=y-R*65536,y=S+R+65535,R=Math.floor(y/65536),S=y-R*65536,y=G+R+65535,R=Math.floor(y/65536),G=y-R*65536,V+=R-1+37*(R-1),R=1,y=V+R+65535,R=Math.floor(y/65536),V=y-R*65536,y=Q+R+65535,R=Math.floor(y/65536),Q=y-R*65536,y=O+R+65535,R=Math.floor(y/65536),O=y-R*65536,y=d+R+65535,R=Math.floor(y/65536),d=y-R*65536,y=u+R+65535,R=Math.floor(y/65536),u=y-R*65536,y=a+R+65535,R=Math.floor(y/65536),a=y-R*65536,y=f+R+65535,R=Math.floor(y/65536),f=y-R*65536,y=b+R+65535,R=Math.floor(y/65536),b=y-R*65536,y=x+R+65535,R=Math.floor(y/65536),x=y-R*65536,y=A+R+65535,R=Math.floor(y/65536),A=y-R*65536,y=_+R+65535,R=Math.floor(y/65536),_=y-R*65536,y=c+R+65535,R=Math.floor(y/65536),c=y-R*65536,y=m+R+65535,R=Math.floor(y/65536),m=y-R*65536,y=v+R+65535,R=Math.floor(y/65536),v=y-R*65536,y=S+R+65535,R=Math.floor(y/65536),S=y-R*65536,y=G+R+65535,R=Math.floor(y/65536),G=y-R*65536,V+=R-1+37*(R-1),F[0]=V,F[1]=Q,F[2]=O,F[3]=d,F[4]=u,F[5]=a,F[6]=f,F[7]=b,F[8]=x,F[9]=A,F[10]=_,F[11]=c,F[12]=m,F[13]=v,F[14]=S,F[15]=G}function D(F,$){I(F,$,$)}function N(F,$){const q=i();for(let y=0;y<16;y++)q[y]=$[y];for(let y=253;y>=0;y--)D(q,q),y!==2&&y!==4&&I(q,q,$);for(let y=0;y<16;y++)F[y]=q[y]}function U(F,$){const q=new Uint8Array(32),y=new Float64Array(80),R=i(),V=i(),Q=i(),O=i(),d=i(),u=i();for(let x=0;x<31;x++)q[x]=F[x];q[31]=F[31]&127|64,q[0]&=248,p(y,$);for(let x=0;x<16;x++)V[x]=y[x];R[0]=O[0]=1;for(let x=254;x>=0;--x){const A=q[x>>>3]>>>(x&7)&1;h(R,V,A),h(Q,O,A),w(d,R,Q),M(R,R,Q),w(Q,V,O),M(V,V,O),D(O,d),D(u,R),I(R,Q,R),I(Q,V,d),w(d,R,Q),M(R,R,Q),D(V,R),M(Q,O,u),I(R,Q,s),w(R,R,O),I(Q,Q,R),I(R,O,u),I(O,V,y),D(V,d),h(R,V,A),h(Q,O,A)}for(let x=0;x<16;x++)y[x+16]=R[x],y[x+32]=Q[x],y[x+48]=V[x],y[x+64]=O[x];const a=y.subarray(32),f=y.subarray(16);N(a,a),I(f,f,a);const b=new Uint8Array(32);return l(b,f),b}t.scalarMult=U;function z(F){return U(F,n)}t.scalarMultBase=z;function H(F){if(F.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const $=new Uint8Array(F);return{publicKey:z($),secretKey:$}}t.generateKeyPairFromSeed=H;function L(F){const $=(0,e.randomBytes)(32,F),q=H($);return(0,r.wipe)($),q}t.generateKeyPair=L;function K(F,$,q=!1){if(F.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if($.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const y=U(F,$);if(q){let R=0;for(let V=0;V<y.length;V++)R|=y[V];if(R===0)throw new Error("X25519: invalid shared key")}return y}t.sharedKey=K})(dI);function lI(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<t.length;n++){var s=t.charAt(n),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=n}var h=t.length,l=t.charAt(0),p=Math.log(h)/Math.log(256),w=Math.log(256)/Math.log(h);function M(N){if(N instanceof Uint8Array||(ArrayBuffer.isView(N)?N=new Uint8Array(N.buffer,N.byteOffset,N.byteLength):Array.isArray(N)&&(N=Uint8Array.from(N))),!(N instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(N.length===0)return"";for(var U=0,z=0,H=0,L=N.length;H!==L&&N[H]===0;)H++,U++;for(var K=(L-H)*w+1>>>0,F=new Uint8Array(K);H!==L;){for(var $=N[H],q=0,y=K-1;($!==0||q<z)&&y!==-1;y--,q++)$+=256*F[y]>>>0,F[y]=$%h>>>0,$=$/h>>>0;if($!==0)throw new Error("Non-zero carry");z=q,H++}for(var R=K-z;R!==K&&F[R]===0;)R++;for(var V=l.repeat(U);R<K;++R)V+=t.charAt(F[R]);return V}function I(N){if(typeof N!="string")throw new TypeError("Expected String");if(N.length===0)return new Uint8Array;var U=0;if(N[U]!==" "){for(var z=0,H=0;N[U]===l;)z++,U++;for(var L=(N.length-U)*p+1>>>0,K=new Uint8Array(L);N[U];){var F=r[N.charCodeAt(U)];if(F===255)return;for(var $=0,q=L-1;(F!==0||$<H)&&q!==-1;q--,$++)F+=h*K[q]>>>0,K[q]=F%256>>>0,F=F/256>>>0;if(F!==0)throw new Error("Non-zero carry");H=$,U++}if(N[U]!==" "){for(var y=L-H;y!==L&&K[y]===0;)y++;for(var R=new Uint8Array(z+(L-y)),V=z;y!==L;)R[V++]=K[y++];return R}}}function D(N){var U=I(N);if(U)return U;throw new Error(`Non-${e} character`)}return{encode:M,decodeUnsafe:I,decode:D}}var pI=lI,bI=pI;const Wv=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")},vI=t=>new TextEncoder().encode(t),gI=t=>new TextDecoder().decode(t);class mI{constructor(e,r,i){this.name=e,this.prefix=r,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class yI{constructor(e,r,i){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=i}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 Qv(this,e)}}class wI{constructor(e){this.decoders=e}or(e){return Qv(this,e)}decode(e){const r=e[0],i=this.decoders[r];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Qv=(t,e)=>new wI({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class _I{constructor(e,r,i,n){this.name=e,this.prefix=r,this.baseEncode=i,this.baseDecode=n,this.encoder=new mI(e,r,i),this.decoder=new yI(e,r,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const f0=({name:t,prefix:e,encode:r,decode:i})=>new _I(t,e,r,i),Af=({prefix:t,name:e,alphabet:r})=>{const{encode:i,decode:n}=bI(r,e);return f0({prefix:t,name:e,encode:i,decode:s=>Wv(n(s))})},xI=(t,e,r,i)=>{const n={};for(let w=0;w<e.length;++w)n[e[w]]=w;let s=t.length;for(;t[s-1]==="=";)--s;const o=new Uint8Array(s*r/8|0);let h=0,l=0,p=0;for(let w=0;w<s;++w){const M=n[t[w]];if(M===void 0)throw new SyntaxError(`Non-${i} character`);l=l<<r|M,h+=r,h>=8&&(h-=8,o[p++]=255&l>>h)}if(h>=r||255&l<<8-h)throw new SyntaxError("Unexpected end of data");return o},AI=(t,e,r)=>{const i=e[e.length-1]==="=",n=(1<<r)-1;let s="",o=0,h=0;for(let l=0;l<t.length;++l)for(h=h<<8|t[l],o+=8;o>r;)o-=r,s+=e[n&h>>o];if(o&&(s+=e[n&h<<r-o]),i)for(;s.length*r&7;)s+="=";return s},nr=({name:t,prefix:e,bitsPerChar:r,alphabet:i})=>f0({prefix:e,name:t,encode(n){return AI(n,i,r)},decode(n){return xI(n,i,r,t)}}),MI=f0({prefix:"\0",name:"identity",encode:t=>gI(t),decode:t=>vI(t)});var EI=Object.freeze({__proto__:null,identity:MI});const SI=nr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var DI=Object.freeze({__proto__:null,base2:SI});const II=nr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var NI=Object.freeze({__proto__:null,base8:II});const OI=Af({prefix:"9",name:"base10",alphabet:"0123456789"});var RI=Object.freeze({__proto__:null,base10:OI});const CI=nr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),PI=nr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var TI=Object.freeze({__proto__:null,base16:CI,base16upper:PI});const BI=nr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),FI=nr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),LI=nr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),UI=nr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),$I=nr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),qI=nr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),zI=nr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),kI=nr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),KI=nr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var HI=Object.freeze({__proto__:null,base32:BI,base32upper:FI,base32pad:LI,base32padupper:UI,base32hex:$I,base32hexupper:qI,base32hexpad:zI,base32hexpadupper:kI,base32z:KI});const jI=Af({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),GI=Af({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var VI=Object.freeze({__proto__:null,base36:jI,base36upper:GI});const YI=Af({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),JI=Af({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var WI=Object.freeze({__proto__:null,base58btc:YI,base58flickr:JI});const QI=nr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),XI=nr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ZI=nr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),eN=nr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var tN=Object.freeze({__proto__:null,base64:QI,base64pad:XI,base64url:ZI,base64urlpad:eN});const Xv=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}"),rN=Xv.reduce((t,e,r)=>(t[r]=e,t),[]),iN=Xv.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function nN(t){return t.reduce((e,r)=>(e+=rN[r],e),"")}function sN(t){const e=[];for(const r of t){const i=iN[r.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(i)}return new Uint8Array(e)}const aN=f0({prefix:"\u{1F680}",name:"base256emoji",encode:nN,decode:sN});var fN=Object.freeze({__proto__:null,base256emoji:aN}),oN=e2,Zv=128,hN=127,cN=~hN,uN=Math.pow(2,31);function e2(t,e,r){e=e||[],r=r||0;for(var i=r;t>=uN;)e[r++]=t&255|Zv,t/=128;for(;t&cN;)e[r++]=t&255|Zv,t>>>=7;return e[r]=t|0,e2.bytes=r-i+1,e}var dN=Wc,lN=128,t2=127;function Wc(t,i){var r=0,i=i||0,n=0,s=i,o,h=t.length;do{if(s>=h)throw Wc.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=n<28?(o&t2)<<n:(o&t2)*Math.pow(2,n),n+=7}while(o>=lN);return Wc.bytes=s-i,r}var pN=Math.pow(2,7),bN=Math.pow(2,14),vN=Math.pow(2,21),gN=Math.pow(2,28),mN=Math.pow(2,35),yN=Math.pow(2,42),wN=Math.pow(2,49),_N=Math.pow(2,56),xN=Math.pow(2,63),AN=function(t){return t<pN?1:t<bN?2:t<vN?3:t<gN?4:t<mN?5:t<yN?6:t<wN?7:t<_N?8:t<xN?9:10},MN={encode:oN,decode:dN,encodingLength:AN},r2=MN;const i2=(t,e,r=0)=>(r2.encode(t,e,r),e),n2=t=>r2.encodingLength(t),Qc=(t,e)=>{const r=e.byteLength,i=n2(t),n=i+n2(r),s=new Uint8Array(n+r);return i2(t,s,0),i2(r,s,i),s.set(e,n),new EN(t,r,e,s)};class EN{constructor(e,r,i,n){this.code=e,this.size=r,this.digest=i,this.bytes=n}}const s2=({name:t,code:e,encode:r})=>new SN(t,e,r);class SN{constructor(e,r,i){this.name=e,this.code=r,this.encode=i}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?Qc(this.code,r):r.then(i=>Qc(this.code,i))}else throw Error("Unknown type, must be binary type")}}const a2=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),DN=s2({name:"sha2-256",code:18,encode:a2("SHA-256")}),IN=s2({name:"sha2-512",code:19,encode:a2("SHA-512")});var NN=Object.freeze({__proto__:null,sha256:DN,sha512:IN});const f2=0,ON="identity",o2=Wv;var RN=Object.freeze({__proto__:null,identity:{code:f2,name:ON,encode:o2,digest:t=>Qc(f2,o2(t))}});new TextEncoder,new TextDecoder,{...EI,...DI,...NI,...RI,...TI,...HI,...VI,...WI,...tN,...fN},{...NN,...RN};var CN={},PN="elliptic",TN="6.6.0",BN="EC cryptography",FN="lib/elliptic.js",LN=["lib"],UN={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},$N={type:"git",url:"git@github.com:indutny/elliptic"},qN=["EC","Elliptic","curve","Cryptography"],zN="Fedor Indutny <fedor@indutny.com>",kN="MIT",KN={url:"https://github.com/indutny/elliptic/issues"},HN="https://github.com/indutny/elliptic",jN={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},GN={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},VN={name:PN,version:TN,description:BN,main:FN,files:LN,scripts:UN,repository:$N,keywords:qN,author:zN,license:kN,bugs:KN,homepage:HN,devDependencies:jN,dependencies:GN},Xr={},nn={exports:{}};(function(t){(function(e,r){function i(O,d){if(!O)throw new Error(d||"Assertion failed")}function n(O,d){O.super_=d;var u=function(){};u.prototype=d.prototype,O.prototype=new u,O.prototype.constructor=O}function s(O,d,u){if(s.isBN(O))return O;this.negative=0,this.words=null,this.length=0,this.red=null,O!==null&&((d==="le"||d==="be")&&(u=d,d=10),this._init(O||0,d||10,u||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=Nn.Buffer}catch{}s.isBN=function(d){return d instanceof s?!0:d!==null&&typeof d=="object"&&d.constructor.wordSize===s.wordSize&&Array.isArray(d.words)},s.max=function(d,u){return d.cmp(u)>0?d:u},s.min=function(d,u){return d.cmp(u)<0?d:u},s.prototype._init=function(d,u,a){if(typeof d=="number")return this._initNumber(d,u,a);if(typeof d=="object")return this._initArray(d,u,a);u==="hex"&&(u=16),i(u===(u|0)&&u>=2&&u<=36),d=d.toString().replace(/\s+/g,"");var f=0;d[0]==="-"&&(f++,this.negative=1),f<d.length&&(u===16?this._parseHex(d,f,a):(this._parseBase(d,u,f),a==="le"&&this._initArray(this.toArray(),u,a)))},s.prototype._initNumber=function(d,u,a){d<0&&(this.negative=1,d=-d),d<67108864?(this.words=[d&67108863],this.length=1):d<4503599627370496?(this.words=[d&67108863,d/67108864&67108863],this.length=2):(i(d<9007199254740992),this.words=[d&67108863,d/67108864&67108863,1],this.length=3),a==="le"&&this._initArray(this.toArray(),u,a)},s.prototype._initArray=function(d,u,a){if(i(typeof d.length=="number"),d.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(d.length/3),this.words=new Array(this.length);for(var f=0;f<this.length;f++)this.words[f]=0;var b,x,A=0;if(a==="be")for(f=d.length-1,b=0;f>=0;f-=3)x=d[f]|d[f-1]<<8|d[f-2]<<16,this.words[b]|=x<<A&67108863,this.words[b+1]=x>>>26-A&67108863,A+=24,A>=26&&(A-=26,b++);else if(a==="le")for(f=0,b=0;f<d.length;f+=3)x=d[f]|d[f+1]<<8|d[f+2]<<16,this.words[b]|=x<<A&67108863,this.words[b+1]=x>>>26-A&67108863,A+=24,A>=26&&(A-=26,b++);return this.strip()};function h(O,d){var u=O.charCodeAt(d);return u>=65&&u<=70?u-55:u>=97&&u<=102?u-87:u-48&15}function l(O,d,u){var a=h(O,u);return u-1>=d&&(a|=h(O,u-1)<<4),a}s.prototype._parseHex=function(d,u,a){this.length=Math.ceil((d.length-u)/6),this.words=new Array(this.length);for(var f=0;f<this.length;f++)this.words[f]=0;var b=0,x=0,A;if(a==="be")for(f=d.length-1;f>=u;f-=2)A=l(d,u,f)<<b,this.words[x]|=A&67108863,b>=18?(b-=18,x+=1,this.words[x]|=A>>>26):b+=8;else{var _=d.length-u;for(f=_%2===0?u+1:u;f<d.length;f+=2)A=l(d,u,f)<<b,this.words[x]|=A&67108863,b>=18?(b-=18,x+=1,this.words[x]|=A>>>26):b+=8}this.strip()};function p(O,d,u,a){for(var f=0,b=Math.min(O.length,u),x=d;x<b;x++){var A=O.charCodeAt(x)-48;f*=a,A>=49?f+=A-49+10:A>=17?f+=A-17+10:f+=A}return f}s.prototype._parseBase=function(d,u,a){this.words=[0],this.length=1;for(var f=0,b=1;b<=67108863;b*=u)f++;f--,b=b/u|0;for(var x=d.length-a,A=x%f,_=Math.min(x,x-A)+a,c=0,m=a;m<_;m+=f)c=p(d,m,m+f,u),this.imuln(b),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(A!==0){var v=1;for(c=p(d,m,d.length,u),m=0;m<A;m++)v*=u;this.imuln(v),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},s.prototype.copy=function(d){d.words=new Array(this.length);for(var u=0;u<this.length;u++)d.words[u]=this.words[u];d.length=this.length,d.negative=this.negative,d.red=this.red},s.prototype.clone=function(){var d=new s(null);return this.copy(d),d},s.prototype._expand=function(d){for(;this.length<d;)this.words[this.length++]=0;return this},s.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var w=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],M=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],I=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(d,u){d=d||10,u=u|0||1;var a;if(d===16||d==="hex"){a="";for(var f=0,b=0,x=0;x<this.length;x++){var A=this.words[x],_=((A<<f|b)&16777215).toString(16);b=A>>>24-f&16777215,b!==0||x!==this.length-1?a=w[6-_.length]+_+a:a=_+a,f+=2,f>=26&&(f-=26,x--)}for(b!==0&&(a=b.toString(16)+a);a.length%u!==0;)a="0"+a;return this.negative!==0&&(a="-"+a),a}if(d===(d|0)&&d>=2&&d<=36){var c=M[d],m=I[d];a="";var v=this.clone();for(v.negative=0;!v.isZero();){var S=v.modn(m).toString(d);v=v.idivn(m),v.isZero()?a=S+a:a=w[c-S.length]+S+a}for(this.isZero()&&(a="0"+a);a.length%u!==0;)a="0"+a;return this.negative!==0&&(a="-"+a),a}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var d=this.words[0];return this.length===2?d+=this.words[1]*67108864:this.length===3&&this.words[2]===1?d+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-d:d},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(d,u){return i(typeof o<"u"),this.toArrayLike(o,d,u)},s.prototype.toArray=function(d,u){return this.toArrayLike(Array,d,u)},s.prototype.toArrayLike=function(d,u,a){var f=this.byteLength(),b=a||Math.max(1,f);i(f<=b,"byte array longer than desired length"),i(b>0,"Requested array length <= 0"),this.strip();var x=u==="le",A=new d(b),_,c,m=this.clone();if(x){for(c=0;!m.isZero();c++)_=m.andln(255),m.iushrn(8),A[c]=_;for(;c<b;c++)A[c]=0}else{for(c=0;c<b-f;c++)A[c]=0;for(c=0;!m.isZero();c++)_=m.andln(255),m.iushrn(8),A[b-c-1]=_}return A},Math.clz32?s.prototype._countBits=function(d){return 32-Math.clz32(d)}:s.prototype._countBits=function(d){var u=d,a=0;return u>=4096&&(a+=13,u>>>=13),u>=64&&(a+=7,u>>>=7),u>=8&&(a+=4,u>>>=4),u>=2&&(a+=2,u>>>=2),a+u},s.prototype._zeroBits=function(d){if(d===0)return 26;var u=d,a=0;return u&8191||(a+=13,u>>>=13),u&127||(a+=7,u>>>=7),u&15||(a+=4,u>>>=4),u&3||(a+=2,u>>>=2),u&1||a++,a},s.prototype.bitLength=function(){var d=this.words[this.length-1],u=this._countBits(d);return(this.length-1)*26+u};function D(O){for(var d=new Array(O.bitLength()),u=0;u<d.length;u++){var a=u/26|0,f=u%26;d[u]=(O.words[a]&1<<f)>>>f}return d}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var d=0,u=0;u<this.length;u++){var a=this._zeroBits(this.words[u]);if(d+=a,a!==26)break}return d},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(d){return this.negative!==0?this.abs().inotn(d).iaddn(1):this.clone()},s.prototype.fromTwos=function(d){return this.testn(d-1)?this.notn(d).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(d){for(;this.length<d.length;)this.words[this.length++]=0;for(var u=0;u<d.length;u++)this.words[u]=this.words[u]|d.words[u];return this.strip()},s.prototype.ior=function(d){return i((this.negative|d.negative)===0),this.iuor(d)},s.prototype.or=function(d){return this.length>d.length?this.clone().ior(d):d.clone().ior(this)},s.prototype.uor=function(d){return this.length>d.length?this.clone().iuor(d):d.clone().iuor(this)},s.prototype.iuand=function(d){var u;this.length>d.length?u=d:u=this;for(var a=0;a<u.length;a++)this.words[a]=this.words[a]&d.words[a];return this.length=u.length,this.strip()},s.prototype.iand=function(d){return i((this.negative|d.negative)===0),this.iuand(d)},s.prototype.and=function(d){return this.length>d.length?this.clone().iand(d):d.clone().iand(this)},s.prototype.uand=function(d){return this.length>d.length?this.clone().iuand(d):d.clone().iuand(this)},s.prototype.iuxor=function(d){var u,a;this.length>d.length?(u=this,a=d):(u=d,a=this);for(var f=0;f<a.length;f++)this.words[f]=u.words[f]^a.words[f];if(this!==u)for(;f<u.length;f++)this.words[f]=u.words[f];return this.length=u.length,this.strip()},s.prototype.ixor=function(d){return i((this.negative|d.negative)===0),this.iuxor(d)},s.prototype.xor=function(d){return this.length>d.length?this.clone().ixor(d):d.clone().ixor(this)},s.prototype.uxor=function(d){return this.length>d.length?this.clone().iuxor(d):d.clone().iuxor(this)},s.prototype.inotn=function(d){i(typeof d=="number"&&d>=0);var u=Math.ceil(d/26)|0,a=d%26;this._expand(u),a>0&&u--;for(var f=0;f<u;f++)this.words[f]=~this.words[f]&67108863;return a>0&&(this.words[f]=~this.words[f]&67108863>>26-a),this.strip()},s.prototype.notn=function(d){return this.clone().inotn(d)},s.prototype.setn=function(d,u){i(typeof d=="number"&&d>=0);var a=d/26|0,f=d%26;return this._expand(a+1),u?this.words[a]=this.words[a]|1<<f:this.words[a]=this.words[a]&~(1<<f),this.strip()},s.prototype.iadd=function(d){var u;if(this.negative!==0&&d.negative===0)return this.negative=0,u=this.isub(d),this.negative^=1,this._normSign();if(this.negative===0&&d.negative!==0)return d.negative=0,u=this.isub(d),d.negative=1,u._normSign();var a,f;this.length>d.length?(a=this,f=d):(a=d,f=this);for(var b=0,x=0;x<f.length;x++)u=(a.words[x]|0)+(f.words[x]|0)+b,this.words[x]=u&67108863,b=u>>>26;for(;b!==0&&x<a.length;x++)u=(a.words[x]|0)+b,this.words[x]=u&67108863,b=u>>>26;if(this.length=a.length,b!==0)this.words[this.length]=b,this.length++;else if(a!==this)for(;x<a.length;x++)this.words[x]=a.words[x];return this},s.prototype.add=function(d){var u;return d.negative!==0&&this.negative===0?(d.negative=0,u=this.sub(d),d.negative^=1,u):d.negative===0&&this.negative!==0?(this.negative=0,u=d.sub(this),this.negative=1,u):this.length>d.length?this.clone().iadd(d):d.clone().iadd(this)},s.prototype.isub=function(d){if(d.negative!==0){d.negative=0;var u=this.iadd(d);return d.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(d),this.negative=1,this._normSign();var a=this.cmp(d);if(a===0)return this.negative=0,this.length=1,this.words[0]=0,this;var f,b;a>0?(f=this,b=d):(f=d,b=this);for(var x=0,A=0;A<b.length;A++)u=(f.words[A]|0)-(b.words[A]|0)+x,x=u>>26,this.words[A]=u&67108863;for(;x!==0&&A<f.length;A++)u=(f.words[A]|0)+x,x=u>>26,this.words[A]=u&67108863;if(x===0&&A<f.length&&f!==this)for(;A<f.length;A++)this.words[A]=f.words[A];return this.length=Math.max(this.length,A),f!==this&&(this.negative=1),this.strip()},s.prototype.sub=function(d){return this.clone().isub(d)};function N(O,d,u){u.negative=d.negative^O.negative;var a=O.length+d.length|0;u.length=a,a=a-1|0;var f=O.words[0]|0,b=d.words[0]|0,x=f*b,A=x&67108863,_=x/67108864|0;u.words[0]=A;for(var c=1;c<a;c++){for(var m=_>>>26,v=_&67108863,S=Math.min(c,d.length-1),G=Math.max(0,c-O.length+1);G<=S;G++){var E=c-G|0;f=O.words[E]|0,b=d.words[G]|0,x=f*b+v,m+=x/67108864|0,v=x&67108863}u.words[c]=v|0,_=m|0}return _!==0?u.words[c]=_|0:u.length--,u.strip()}var U=function(d,u,a){var f=d.words,b=u.words,x=a.words,A=0,_,c,m,v=f[0]|0,S=v&8191,G=v>>>13,E=f[1]|0,k=E&8191,C=E>>>13,B=f[2]|0,P=B&8191,g=B>>>13,T=f[3]|0,j=T&8191,J=T>>>13,W=f[4]|0,X=W&8191,ve=W>>>13,_e=f[5]|0,ae=_e&8191,De=_e>>>13,me=f[6]|0,ie=me&8191,de=me>>>13,he=f[7]|0,te=he&8191,fe=he>>>13,se=f[8]|0,ee=se&8191,le=se>>>13,ge=f[9]|0,re=ge&8191,ye=ge>>>13,we=b[0]|0,ne=we&8191,xe=we>>>13,Ae=b[1]|0,Me=Ae&8191,Ke=Ae>>>13,He=b[2]|0,Ee=He&8191,je=He>>>13,Ve=b[3]|0,Ie=Ve&8191,Re=Ve>>>13,Oe=b[4]|0,ce=Oe&8191,Ce=Oe>>>13,Pe=b[5]|0,oe=Pe&8191,Fe=Pe>>>13,Le=b[6]|0,pe=Le&8191,Ue=Le>>>13,$e=b[7]|0,ue=$e&8191,Te=$e>>>13,Ne=b[8]|0,be=Ne&8191,qe=Ne>>>13,We=b[9]|0,Be=We&8191,Qe=We>>>13;a.negative=d.negative^u.negative,a.length=19,_=Math.imul(S,ne),c=Math.imul(S,xe),c=c+Math.imul(G,ne)|0,m=Math.imul(G,xe);var Ge=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,_=Math.imul(k,ne),c=Math.imul(k,xe),c=c+Math.imul(C,ne)|0,m=Math.imul(C,xe),_=_+Math.imul(S,Me)|0,c=c+Math.imul(S,Ke)|0,c=c+Math.imul(G,Me)|0,m=m+Math.imul(G,Ke)|0;var Je=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(Je>>>26)|0,Je&=67108863,_=Math.imul(P,ne),c=Math.imul(P,xe),c=c+Math.imul(g,ne)|0,m=Math.imul(g,xe),_=_+Math.imul(k,Me)|0,c=c+Math.imul(k,Ke)|0,c=c+Math.imul(C,Me)|0,m=m+Math.imul(C,Ke)|0,_=_+Math.imul(S,Ee)|0,c=c+Math.imul(S,je)|0,c=c+Math.imul(G,Ee)|0,m=m+Math.imul(G,je)|0;var lt=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(lt>>>26)|0,lt&=67108863,_=Math.imul(j,ne),c=Math.imul(j,xe),c=c+Math.imul(J,ne)|0,m=Math.imul(J,xe),_=_+Math.imul(P,Me)|0,c=c+Math.imul(P,Ke)|0,c=c+Math.imul(g,Me)|0,m=m+Math.imul(g,Ke)|0,_=_+Math.imul(k,Ee)|0,c=c+Math.imul(k,je)|0,c=c+Math.imul(C,Ee)|0,m=m+Math.imul(C,je)|0,_=_+Math.imul(S,Ie)|0,c=c+Math.imul(S,Re)|0,c=c+Math.imul(G,Ie)|0,m=m+Math.imul(G,Re)|0;var pt=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(pt>>>26)|0,pt&=67108863,_=Math.imul(X,ne),c=Math.imul(X,xe),c=c+Math.imul(ve,ne)|0,m=Math.imul(ve,xe),_=_+Math.imul(j,Me)|0,c=c+Math.imul(j,Ke)|0,c=c+Math.imul(J,Me)|0,m=m+Math.imul(J,Ke)|0,_=_+Math.imul(P,Ee)|0,c=c+Math.imul(P,je)|0,c=c+Math.imul(g,Ee)|0,m=m+Math.imul(g,je)|0,_=_+Math.imul(k,Ie)|0,c=c+Math.imul(k,Re)|0,c=c+Math.imul(C,Ie)|0,m=m+Math.imul(C,Re)|0,_=_+Math.imul(S,ce)|0,c=c+Math.imul(S,Ce)|0,c=c+Math.imul(G,ce)|0,m=m+Math.imul(G,Ce)|0;var bt=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(bt>>>26)|0,bt&=67108863,_=Math.imul(ae,ne),c=Math.imul(ae,xe),c=c+Math.imul(De,ne)|0,m=Math.imul(De,xe),_=_+Math.imul(X,Me)|0,c=c+Math.imul(X,Ke)|0,c=c+Math.imul(ve,Me)|0,m=m+Math.imul(ve,Ke)|0,_=_+Math.imul(j,Ee)|0,c=c+Math.imul(j,je)|0,c=c+Math.imul(J,Ee)|0,m=m+Math.imul(J,je)|0,_=_+Math.imul(P,Ie)|0,c=c+Math.imul(P,Re)|0,c=c+Math.imul(g,Ie)|0,m=m+Math.imul(g,Re)|0,_=_+Math.imul(k,ce)|0,c=c+Math.imul(k,Ce)|0,c=c+Math.imul(C,ce)|0,m=m+Math.imul(C,Ce)|0,_=_+Math.imul(S,oe)|0,c=c+Math.imul(S,Fe)|0,c=c+Math.imul(G,oe)|0,m=m+Math.imul(G,Fe)|0;var vt=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(vt>>>26)|0,vt&=67108863,_=Math.imul(ie,ne),c=Math.imul(ie,xe),c=c+Math.imul(de,ne)|0,m=Math.imul(de,xe),_=_+Math.imul(ae,Me)|0,c=c+Math.imul(ae,Ke)|0,c=c+Math.imul(De,Me)|0,m=m+Math.imul(De,Ke)|0,_=_+Math.imul(X,Ee)|0,c=c+Math.imul(X,je)|0,c=c+Math.imul(ve,Ee)|0,m=m+Math.imul(ve,je)|0,_=_+Math.imul(j,Ie)|0,c=c+Math.imul(j,Re)|0,c=c+Math.imul(J,Ie)|0,m=m+Math.imul(J,Re)|0,_=_+Math.imul(P,ce)|0,c=c+Math.imul(P,Ce)|0,c=c+Math.imul(g,ce)|0,m=m+Math.imul(g,Ce)|0,_=_+Math.imul(k,oe)|0,c=c+Math.imul(k,Fe)|0,c=c+Math.imul(C,oe)|0,m=m+Math.imul(C,Fe)|0,_=_+Math.imul(S,pe)|0,c=c+Math.imul(S,Ue)|0,c=c+Math.imul(G,pe)|0,m=m+Math.imul(G,Ue)|0;var ct=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(ct>>>26)|0,ct&=67108863,_=Math.imul(te,ne),c=Math.imul(te,xe),c=c+Math.imul(fe,ne)|0,m=Math.imul(fe,xe),_=_+Math.imul(ie,Me)|0,c=c+Math.imul(ie,Ke)|0,c=c+Math.imul(de,Me)|0,m=m+Math.imul(de,Ke)|0,_=_+Math.imul(ae,Ee)|0,c=c+Math.imul(ae,je)|0,c=c+Math.imul(De,Ee)|0,m=m+Math.imul(De,je)|0,_=_+Math.imul(X,Ie)|0,c=c+Math.imul(X,Re)|0,c=c+Math.imul(ve,Ie)|0,m=m+Math.imul(ve,Re)|0,_=_+Math.imul(j,ce)|0,c=c+Math.imul(j,Ce)|0,c=c+Math.imul(J,ce)|0,m=m+Math.imul(J,Ce)|0,_=_+Math.imul(P,oe)|0,c=c+Math.imul(P,Fe)|0,c=c+Math.imul(g,oe)|0,m=m+Math.imul(g,Fe)|0,_=_+Math.imul(k,pe)|0,c=c+Math.imul(k,Ue)|0,c=c+Math.imul(C,pe)|0,m=m+Math.imul(C,Ue)|0,_=_+Math.imul(S,ue)|0,c=c+Math.imul(S,Te)|0,c=c+Math.imul(G,ue)|0,m=m+Math.imul(G,Te)|0;var ar=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(ar>>>26)|0,ar&=67108863,_=Math.imul(ee,ne),c=Math.imul(ee,xe),c=c+Math.imul(le,ne)|0,m=Math.imul(le,xe),_=_+Math.imul(te,Me)|0,c=c+Math.imul(te,Ke)|0,c=c+Math.imul(fe,Me)|0,m=m+Math.imul(fe,Ke)|0,_=_+Math.imul(ie,Ee)|0,c=c+Math.imul(ie,je)|0,c=c+Math.imul(de,Ee)|0,m=m+Math.imul(de,je)|0,_=_+Math.imul(ae,Ie)|0,c=c+Math.imul(ae,Re)|0,c=c+Math.imul(De,Ie)|0,m=m+Math.imul(De,Re)|0,_=_+Math.imul(X,ce)|0,c=c+Math.imul(X,Ce)|0,c=c+Math.imul(ve,ce)|0,m=m+Math.imul(ve,Ce)|0,_=_+Math.imul(j,oe)|0,c=c+Math.imul(j,Fe)|0,c=c+Math.imul(J,oe)|0,m=m+Math.imul(J,Fe)|0,_=_+Math.imul(P,pe)|0,c=c+Math.imul(P,Ue)|0,c=c+Math.imul(g,pe)|0,m=m+Math.imul(g,Ue)|0,_=_+Math.imul(k,ue)|0,c=c+Math.imul(k,Te)|0,c=c+Math.imul(C,ue)|0,m=m+Math.imul(C,Te)|0,_=_+Math.imul(S,be)|0,c=c+Math.imul(S,qe)|0,c=c+Math.imul(G,be)|0,m=m+Math.imul(G,qe)|0;var fr=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(fr>>>26)|0,fr&=67108863,_=Math.imul(re,ne),c=Math.imul(re,xe),c=c+Math.imul(ye,ne)|0,m=Math.imul(ye,xe),_=_+Math.imul(ee,Me)|0,c=c+Math.imul(ee,Ke)|0,c=c+Math.imul(le,Me)|0,m=m+Math.imul(le,Ke)|0,_=_+Math.imul(te,Ee)|0,c=c+Math.imul(te,je)|0,c=c+Math.imul(fe,Ee)|0,m=m+Math.imul(fe,je)|0,_=_+Math.imul(ie,Ie)|0,c=c+Math.imul(ie,Re)|0,c=c+Math.imul(de,Ie)|0,m=m+Math.imul(de,Re)|0,_=_+Math.imul(ae,ce)|0,c=c+Math.imul(ae,Ce)|0,c=c+Math.imul(De,ce)|0,m=m+Math.imul(De,Ce)|0,_=_+Math.imul(X,oe)|0,c=c+Math.imul(X,Fe)|0,c=c+Math.imul(ve,oe)|0,m=m+Math.imul(ve,Fe)|0,_=_+Math.imul(j,pe)|0,c=c+Math.imul(j,Ue)|0,c=c+Math.imul(J,pe)|0,m=m+Math.imul(J,Ue)|0,_=_+Math.imul(P,ue)|0,c=c+Math.imul(P,Te)|0,c=c+Math.imul(g,ue)|0,m=m+Math.imul(g,Te)|0,_=_+Math.imul(k,be)|0,c=c+Math.imul(k,qe)|0,c=c+Math.imul(C,be)|0,m=m+Math.imul(C,qe)|0,_=_+Math.imul(S,Be)|0,c=c+Math.imul(S,Qe)|0,c=c+Math.imul(G,Be)|0,m=m+Math.imul(G,Qe)|0;var or=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(or>>>26)|0,or&=67108863,_=Math.imul(re,Me),c=Math.imul(re,Ke),c=c+Math.imul(ye,Me)|0,m=Math.imul(ye,Ke),_=_+Math.imul(ee,Ee)|0,c=c+Math.imul(ee,je)|0,c=c+Math.imul(le,Ee)|0,m=m+Math.imul(le,je)|0,_=_+Math.imul(te,Ie)|0,c=c+Math.imul(te,Re)|0,c=c+Math.imul(fe,Ie)|0,m=m+Math.imul(fe,Re)|0,_=_+Math.imul(ie,ce)|0,c=c+Math.imul(ie,Ce)|0,c=c+Math.imul(de,ce)|0,m=m+Math.imul(de,Ce)|0,_=_+Math.imul(ae,oe)|0,c=c+Math.imul(ae,Fe)|0,c=c+Math.imul(De,oe)|0,m=m+Math.imul(De,Fe)|0,_=_+Math.imul(X,pe)|0,c=c+Math.imul(X,Ue)|0,c=c+Math.imul(ve,pe)|0,m=m+Math.imul(ve,Ue)|0,_=_+Math.imul(j,ue)|0,c=c+Math.imul(j,Te)|0,c=c+Math.imul(J,ue)|0,m=m+Math.imul(J,Te)|0,_=_+Math.imul(P,be)|0,c=c+Math.imul(P,qe)|0,c=c+Math.imul(g,be)|0,m=m+Math.imul(g,qe)|0,_=_+Math.imul(k,Be)|0,c=c+Math.imul(k,Qe)|0,c=c+Math.imul(C,Be)|0,m=m+Math.imul(C,Qe)|0;var hr=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(hr>>>26)|0,hr&=67108863,_=Math.imul(re,Ee),c=Math.imul(re,je),c=c+Math.imul(ye,Ee)|0,m=Math.imul(ye,je),_=_+Math.imul(ee,Ie)|0,c=c+Math.imul(ee,Re)|0,c=c+Math.imul(le,Ie)|0,m=m+Math.imul(le,Re)|0,_=_+Math.imul(te,ce)|0,c=c+Math.imul(te,Ce)|0,c=c+Math.imul(fe,ce)|0,m=m+Math.imul(fe,Ce)|0,_=_+Math.imul(ie,oe)|0,c=c+Math.imul(ie,Fe)|0,c=c+Math.imul(de,oe)|0,m=m+Math.imul(de,Fe)|0,_=_+Math.imul(ae,pe)|0,c=c+Math.imul(ae,Ue)|0,c=c+Math.imul(De,pe)|0,m=m+Math.imul(De,Ue)|0,_=_+Math.imul(X,ue)|0,c=c+Math.imul(X,Te)|0,c=c+Math.imul(ve,ue)|0,m=m+Math.imul(ve,Te)|0,_=_+Math.imul(j,be)|0,c=c+Math.imul(j,qe)|0,c=c+Math.imul(J,be)|0,m=m+Math.imul(J,qe)|0,_=_+Math.imul(P,Be)|0,c=c+Math.imul(P,Qe)|0,c=c+Math.imul(g,Be)|0,m=m+Math.imul(g,Qe)|0;var cr=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(cr>>>26)|0,cr&=67108863,_=Math.imul(re,Ie),c=Math.imul(re,Re),c=c+Math.imul(ye,Ie)|0,m=Math.imul(ye,Re),_=_+Math.imul(ee,ce)|0,c=c+Math.imul(ee,Ce)|0,c=c+Math.imul(le,ce)|0,m=m+Math.imul(le,Ce)|0,_=_+Math.imul(te,oe)|0,c=c+Math.imul(te,Fe)|0,c=c+Math.imul(fe,oe)|0,m=m+Math.imul(fe,Fe)|0,_=_+Math.imul(ie,pe)|0,c=c+Math.imul(ie,Ue)|0,c=c+Math.imul(de,pe)|0,m=m+Math.imul(de,Ue)|0,_=_+Math.imul(ae,ue)|0,c=c+Math.imul(ae,Te)|0,c=c+Math.imul(De,ue)|0,m=m+Math.imul(De,Te)|0,_=_+Math.imul(X,be)|0,c=c+Math.imul(X,qe)|0,c=c+Math.imul(ve,be)|0,m=m+Math.imul(ve,qe)|0,_=_+Math.imul(j,Be)|0,c=c+Math.imul(j,Qe)|0,c=c+Math.imul(J,Be)|0,m=m+Math.imul(J,Qe)|0;var Ft=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,_=Math.imul(re,ce),c=Math.imul(re,Ce),c=c+Math.imul(ye,ce)|0,m=Math.imul(ye,Ce),_=_+Math.imul(ee,oe)|0,c=c+Math.imul(ee,Fe)|0,c=c+Math.imul(le,oe)|0,m=m+Math.imul(le,Fe)|0,_=_+Math.imul(te,pe)|0,c=c+Math.imul(te,Ue)|0,c=c+Math.imul(fe,pe)|0,m=m+Math.imul(fe,Ue)|0,_=_+Math.imul(ie,ue)|0,c=c+Math.imul(ie,Te)|0,c=c+Math.imul(de,ue)|0,m=m+Math.imul(de,Te)|0,_=_+Math.imul(ae,be)|0,c=c+Math.imul(ae,qe)|0,c=c+Math.imul(De,be)|0,m=m+Math.imul(De,qe)|0,_=_+Math.imul(X,Be)|0,c=c+Math.imul(X,Qe)|0,c=c+Math.imul(ve,Be)|0,m=m+Math.imul(ve,Qe)|0;var ur=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(ur>>>26)|0,ur&=67108863,_=Math.imul(re,oe),c=Math.imul(re,Fe),c=c+Math.imul(ye,oe)|0,m=Math.imul(ye,Fe),_=_+Math.imul(ee,pe)|0,c=c+Math.imul(ee,Ue)|0,c=c+Math.imul(le,pe)|0,m=m+Math.imul(le,Ue)|0,_=_+Math.imul(te,ue)|0,c=c+Math.imul(te,Te)|0,c=c+Math.imul(fe,ue)|0,m=m+Math.imul(fe,Te)|0,_=_+Math.imul(ie,be)|0,c=c+Math.imul(ie,qe)|0,c=c+Math.imul(de,be)|0,m=m+Math.imul(de,qe)|0,_=_+Math.imul(ae,Be)|0,c=c+Math.imul(ae,Qe)|0,c=c+Math.imul(De,Be)|0,m=m+Math.imul(De,Qe)|0;var dr=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(dr>>>26)|0,dr&=67108863,_=Math.imul(re,pe),c=Math.imul(re,Ue),c=c+Math.imul(ye,pe)|0,m=Math.imul(ye,Ue),_=_+Math.imul(ee,ue)|0,c=c+Math.imul(ee,Te)|0,c=c+Math.imul(le,ue)|0,m=m+Math.imul(le,Te)|0,_=_+Math.imul(te,be)|0,c=c+Math.imul(te,qe)|0,c=c+Math.imul(fe,be)|0,m=m+Math.imul(fe,qe)|0,_=_+Math.imul(ie,Be)|0,c=c+Math.imul(ie,Qe)|0,c=c+Math.imul(de,Be)|0,m=m+Math.imul(de,Qe)|0;var St=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(St>>>26)|0,St&=67108863,_=Math.imul(re,ue),c=Math.imul(re,Te),c=c+Math.imul(ye,ue)|0,m=Math.imul(ye,Te),_=_+Math.imul(ee,be)|0,c=c+Math.imul(ee,qe)|0,c=c+Math.imul(le,be)|0,m=m+Math.imul(le,qe)|0,_=_+Math.imul(te,Be)|0,c=c+Math.imul(te,Qe)|0,c=c+Math.imul(fe,Be)|0,m=m+Math.imul(fe,Qe)|0;var lr=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(lr>>>26)|0,lr&=67108863,_=Math.imul(re,be),c=Math.imul(re,qe),c=c+Math.imul(ye,be)|0,m=Math.imul(ye,qe),_=_+Math.imul(ee,Be)|0,c=c+Math.imul(ee,Qe)|0,c=c+Math.imul(le,Be)|0,m=m+Math.imul(le,Qe)|0;var pr=(A+_|0)+((c&8191)<<13)|0;A=(m+(c>>>13)|0)+(pr>>>26)|0,pr&=67108863,_=Math.imul(re,Be),c=Math.imul(re,Qe),c=c+Math.imul(ye,Be)|0,m=Math.imul(ye,Qe);var br=(A+_|0)+((c&8191)<<13)|0;return A=(m+(c>>>13)|0)+(br>>>26)|0,br&=67108863,x[0]=Ge,x[1]=Je,x[2]=lt,x[3]=pt,x[4]=bt,x[5]=vt,x[6]=ct,x[7]=ar,x[8]=fr,x[9]=or,x[10]=hr,x[11]=cr,x[12]=Ft,x[13]=ur,x[14]=dr,x[15]=St,x[16]=lr,x[17]=pr,x[18]=br,A!==0&&(x[19]=A,a.length++),a};Math.imul||(U=N);function z(O,d,u){u.negative=d.negative^O.negative,u.length=O.length+d.length;for(var a=0,f=0,b=0;b<u.length-1;b++){var x=f;f=0;for(var A=a&67108863,_=Math.min(b,d.length-1),c=Math.max(0,b-O.length+1);c<=_;c++){var m=b-c,v=O.words[m]|0,S=d.words[c]|0,G=v*S,E=G&67108863;x=x+(G/67108864|0)|0,E=E+A|0,A=E&67108863,x=x+(E>>>26)|0,f+=x>>>26,x&=67108863}u.words[b]=A,a=x,x=f}return a!==0?u.words[b]=a:u.length--,u.strip()}function H(O,d,u){var a=new L;return a.mulp(O,d,u)}s.prototype.mulTo=function(d,u){var a,f=this.length+d.length;return this.length===10&&d.length===10?a=U(this,d,u):f<63?a=N(this,d,u):f<1024?a=z(this,d,u):a=H(this,d,u),a};function L(O,d){this.x=O,this.y=d}L.prototype.makeRBT=function(d){for(var u=new Array(d),a=s.prototype._countBits(d)-1,f=0;f<d;f++)u[f]=this.revBin(f,a,d);return u},L.prototype.revBin=function(d,u,a){if(d===0||d===a-1)return d;for(var f=0,b=0;b<u;b++)f|=(d&1)<<u-b-1,d>>=1;return f},L.prototype.permute=function(d,u,a,f,b,x){for(var A=0;A<x;A++)f[A]=u[d[A]],b[A]=a[d[A]]},L.prototype.transform=function(d,u,a,f,b,x){this.permute(x,d,u,a,f,b);for(var A=1;A<b;A<<=1)for(var _=A<<1,c=Math.cos(2*Math.PI/_),m=Math.sin(2*Math.PI/_),v=0;v<b;v+=_)for(var S=c,G=m,E=0;E<A;E++){var k=a[v+E],C=f[v+E],B=a[v+E+A],P=f[v+E+A],g=S*B-G*P;P=S*P+G*B,B=g,a[v+E]=k+B,f[v+E]=C+P,a[v+E+A]=k-B,f[v+E+A]=C-P,E!==_&&(g=c*S-m*G,G=c*G+m*S,S=g)}},L.prototype.guessLen13b=function(d,u){var a=Math.max(u,d)|1,f=a&1,b=0;for(a=a/2|0;a;a=a>>>1)b++;return 1<<b+1+f},L.prototype.conjugate=function(d,u,a){if(!(a<=1))for(var f=0;f<a/2;f++){var b=d[f];d[f]=d[a-f-1],d[a-f-1]=b,b=u[f],u[f]=-u[a-f-1],u[a-f-1]=-b}},L.prototype.normalize13b=function(d,u){for(var a=0,f=0;f<u/2;f++){var b=Math.round(d[2*f+1]/u)*8192+Math.round(d[2*f]/u)+a;d[f]=b&67108863,b<67108864?a=0:a=b/67108864|0}return d},L.prototype.convert13b=function(d,u,a,f){for(var b=0,x=0;x<u;x++)b=b+(d[x]|0),a[2*x]=b&8191,b=b>>>13,a[2*x+1]=b&8191,b=b>>>13;for(x=2*u;x<f;++x)a[x]=0;i(b===0),i((b&-8192)===0)},L.prototype.stub=function(d){for(var u=new Array(d),a=0;a<d;a++)u[a]=0;return u},L.prototype.mulp=function(d,u,a){var f=2*this.guessLen13b(d.length,u.length),b=this.makeRBT(f),x=this.stub(f),A=new Array(f),_=new Array(f),c=new Array(f),m=new Array(f),v=new Array(f),S=new Array(f),G=a.words;G.length=f,this.convert13b(d.words,d.length,A,f),this.convert13b(u.words,u.length,m,f),this.transform(A,x,_,c,f,b),this.transform(m,x,v,S,f,b);for(var E=0;E<f;E++){var k=_[E]*v[E]-c[E]*S[E];c[E]=_[E]*S[E]+c[E]*v[E],_[E]=k}return this.conjugate(_,c,f),this.transform(_,c,G,x,f,b),this.conjugate(G,x,f),this.normalize13b(G,f),a.negative=d.negative^u.negative,a.length=d.length+u.length,a.strip()},s.prototype.mul=function(d){var u=new s(null);return u.words=new Array(this.length+d.length),this.mulTo(d,u)},s.prototype.mulf=function(d){var u=new s(null);return u.words=new Array(this.length+d.length),H(this,d,u)},s.prototype.imul=function(d){return this.clone().mulTo(d,this)},s.prototype.imuln=function(d){i(typeof d=="number"),i(d<67108864);for(var u=0,a=0;a<this.length;a++){var f=(this.words[a]|0)*d,b=(f&67108863)+(u&67108863);u>>=26,u+=f/67108864|0,u+=b>>>26,this.words[a]=b&67108863}return u!==0&&(this.words[a]=u,this.length++),this},s.prototype.muln=function(d){return this.clone().imuln(d)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(d){var u=D(d);if(u.length===0)return new s(1);for(var a=this,f=0;f<u.length&&u[f]===0;f++,a=a.sqr());if(++f<u.length)for(var b=a.sqr();f<u.length;f++,b=b.sqr())u[f]!==0&&(a=a.mul(b));return a},s.prototype.iushln=function(d){i(typeof d=="number"&&d>=0);var u=d%26,a=(d-u)/26,f=67108863>>>26-u<<26-u,b;if(u!==0){var x=0;for(b=0;b<this.length;b++){var A=this.words[b]&f,_=(this.words[b]|0)-A<<u;this.words[b]=_|x,x=A>>>26-u}x&&(this.words[b]=x,this.length++)}if(a!==0){for(b=this.length-1;b>=0;b--)this.words[b+a]=this.words[b];for(b=0;b<a;b++)this.words[b]=0;this.length+=a}return this.strip()},s.prototype.ishln=function(d){return i(this.negative===0),this.iushln(d)},s.prototype.iushrn=function(d,u,a){i(typeof d=="number"&&d>=0);var f;u?f=(u-u%26)/26:f=0;var b=d%26,x=Math.min((d-b)/26,this.length),A=67108863^67108863>>>b<<b,_=a;if(f-=x,f=Math.max(0,f),_){for(var c=0;c<x;c++)_.words[c]=this.words[c];_.length=x}if(x!==0)if(this.length>x)for(this.length-=x,c=0;c<this.length;c++)this.words[c]=this.words[c+x];else this.words[0]=0,this.length=1;var m=0;for(c=this.length-1;c>=0&&(m!==0||c>=f);c--){var v=this.words[c]|0;this.words[c]=m<<26-b|v>>>b,m=v&A}return _&&m!==0&&(_.words[_.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(d,u,a){return i(this.negative===0),this.iushrn(d,u,a)},s.prototype.shln=function(d){return this.clone().ishln(d)},s.prototype.ushln=function(d){return this.clone().iushln(d)},s.prototype.shrn=function(d){return this.clone().ishrn(d)},s.prototype.ushrn=function(d){return this.clone().iushrn(d)},s.prototype.testn=function(d){i(typeof d=="number"&&d>=0);var u=d%26,a=(d-u)/26,f=1<<u;if(this.length<=a)return!1;var b=this.words[a];return!!(b&f)},s.prototype.imaskn=function(d){i(typeof d=="number"&&d>=0);var u=d%26,a=(d-u)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=a)return this;if(u!==0&&a++,this.length=Math.min(a,this.length),u!==0){var f=67108863^67108863>>>u<<u;this.words[this.length-1]&=f}return this.strip()},s.prototype.maskn=function(d){return this.clone().imaskn(d)},s.prototype.iaddn=function(d){return i(typeof d=="number"),i(d<67108864),d<0?this.isubn(-d):this.negative!==0?this.length===1&&(this.words[0]|0)<d?(this.words[0]=d-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(d),this.negative=1,this):this._iaddn(d)},s.prototype._iaddn=function(d){this.words[0]+=d;for(var u=0;u<this.length&&this.words[u]>=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},s.prototype.isubn=function(d){if(i(typeof d=="number"),i(d<67108864),d<0)return this.iaddn(-d);if(this.negative!==0)return this.negative=0,this.iaddn(d),this.negative=1,this;if(this.words[0]-=d,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u<this.length&&this.words[u]<0;u++)this.words[u]+=67108864,this.words[u+1]-=1;return this.strip()},s.prototype.addn=function(d){return this.clone().iaddn(d)},s.prototype.subn=function(d){return this.clone().isubn(d)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(d,u,a){var f=d.length+a,b;this._expand(f);var x,A=0;for(b=0;b<d.length;b++){x=(this.words[b+a]|0)+A;var _=(d.words[b]|0)*u;x-=_&67108863,A=(x>>26)-(_/67108864|0),this.words[b+a]=x&67108863}for(;b<this.length-a;b++)x=(this.words[b+a]|0)+A,A=x>>26,this.words[b+a]=x&67108863;if(A===0)return this.strip();for(i(A===-1),A=0,b=0;b<this.length;b++)x=-(this.words[b]|0)+A,A=x>>26,this.words[b]=x&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(d,u){var a=this.length-d.length,f=this.clone(),b=d,x=b.words[b.length-1]|0,A=this._countBits(x);a=26-A,a!==0&&(b=b.ushln(a),f.iushln(a),x=b.words[b.length-1]|0);var _=f.length-b.length,c;if(u!=="mod"){c=new s(null),c.length=_+1,c.words=new Array(c.length);for(var m=0;m<c.length;m++)c.words[m]=0}var v=f.clone()._ishlnsubmul(b,1,_);v.negative===0&&(f=v,c&&(c.words[_]=1));for(var S=_-1;S>=0;S--){var G=(f.words[b.length+S]|0)*67108864+(f.words[b.length+S-1]|0);for(G=Math.min(G/x|0,67108863),f._ishlnsubmul(b,G,S);f.negative!==0;)G--,f.negative=0,f._ishlnsubmul(b,1,S),f.isZero()||(f.negative^=1);c&&(c.words[S]=G)}return c&&c.strip(),f.strip(),u!=="div"&&a!==0&&f.iushrn(a),{div:c||null,mod:f}},s.prototype.divmod=function(d,u,a){if(i(!d.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var f,b,x;return this.negative!==0&&d.negative===0?(x=this.neg().divmod(d,u),u!=="mod"&&(f=x.div.neg()),u!=="div"&&(b=x.mod.neg(),a&&b.negative!==0&&b.iadd(d)),{div:f,mod:b}):this.negative===0&&d.negative!==0?(x=this.divmod(d.neg(),u),u!=="mod"&&(f=x.div.neg()),{div:f,mod:x.mod}):this.negative&d.negative?(x=this.neg().divmod(d.neg(),u),u!=="div"&&(b=x.mod.neg(),a&&b.negative!==0&&b.isub(d)),{div:x.div,mod:b}):d.length>this.length||this.cmp(d)<0?{div:new s(0),mod:this}:d.length===1?u==="div"?{div:this.divn(d.words[0]),mod:null}:u==="mod"?{div:null,mod:new s(this.modn(d.words[0]))}:{div:this.divn(d.words[0]),mod:new s(this.modn(d.words[0]))}:this._wordDiv(d,u)},s.prototype.div=function(d){return this.divmod(d,"div",!1).div},s.prototype.mod=function(d){return this.divmod(d,"mod",!1).mod},s.prototype.umod=function(d){return this.divmod(d,"mod",!0).mod},s.prototype.divRound=function(d){var u=this.divmod(d);if(u.mod.isZero())return u.div;var a=u.div.negative!==0?u.mod.isub(d):u.mod,f=d.ushrn(1),b=d.andln(1),x=a.cmp(f);return x<0||b===1&&x===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},s.prototype.modn=function(d){i(d<=67108863);for(var u=(1<<26)%d,a=0,f=this.length-1;f>=0;f--)a=(u*a+(this.words[f]|0))%d;return a},s.prototype.idivn=function(d){i(d<=67108863);for(var u=0,a=this.length-1;a>=0;a--){var f=(this.words[a]|0)+u*67108864;this.words[a]=f/d|0,u=f%d}return this.strip()},s.prototype.divn=function(d){return this.clone().idivn(d)},s.prototype.egcd=function(d){i(d.negative===0),i(!d.isZero());var u=this,a=d.clone();u.negative!==0?u=u.umod(d):u=u.clone();for(var f=new s(1),b=new s(0),x=new s(0),A=new s(1),_=0;u.isEven()&&a.isEven();)u.iushrn(1),a.iushrn(1),++_;for(var c=a.clone(),m=u.clone();!u.isZero();){for(var v=0,S=1;!(u.words[0]&S)&&v<26;++v,S<<=1);if(v>0)for(u.iushrn(v);v-- >0;)(f.isOdd()||b.isOdd())&&(f.iadd(c),b.isub(m)),f.iushrn(1),b.iushrn(1);for(var G=0,E=1;!(a.words[0]&E)&&G<26;++G,E<<=1);if(G>0)for(a.iushrn(G);G-- >0;)(x.isOdd()||A.isOdd())&&(x.iadd(c),A.isub(m)),x.iushrn(1),A.iushrn(1);u.cmp(a)>=0?(u.isub(a),f.isub(x),b.isub(A)):(a.isub(u),x.isub(f),A.isub(b))}return{a:x,b:A,gcd:a.iushln(_)}},s.prototype._invmp=function(d){i(d.negative===0),i(!d.isZero());var u=this,a=d.clone();u.negative!==0?u=u.umod(d):u=u.clone();for(var f=new s(1),b=new s(0),x=a.clone();u.cmpn(1)>0&&a.cmpn(1)>0;){for(var A=0,_=1;!(u.words[0]&_)&&A<26;++A,_<<=1);if(A>0)for(u.iushrn(A);A-- >0;)f.isOdd()&&f.iadd(x),f.iushrn(1);for(var c=0,m=1;!(a.words[0]&m)&&c<26;++c,m<<=1);if(c>0)for(a.iushrn(c);c-- >0;)b.isOdd()&&b.iadd(x),b.iushrn(1);u.cmp(a)>=0?(u.isub(a),f.isub(b)):(a.isub(u),b.isub(f))}var v;return u.cmpn(1)===0?v=f:v=b,v.cmpn(0)<0&&v.iadd(d),v},s.prototype.gcd=function(d){if(this.isZero())return d.abs();if(d.isZero())return this.abs();var u=this.clone(),a=d.clone();u.negative=0,a.negative=0;for(var f=0;u.isEven()&&a.isEven();f++)u.iushrn(1),a.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;a.isEven();)a.iushrn(1);var b=u.cmp(a);if(b<0){var x=u;u=a,a=x}else if(b===0||a.cmpn(1)===0)break;u.isub(a)}while(!0);return a.iushln(f)},s.prototype.invm=function(d){return this.egcd(d).a.umod(d)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(d){return this.words[0]&d},s.prototype.bincn=function(d){i(typeof d=="number");var u=d%26,a=(d-u)/26,f=1<<u;if(this.length<=a)return this._expand(a+1),this.words[a]|=f,this;for(var b=f,x=a;b!==0&&x<this.length;x++){var A=this.words[x]|0;A+=b,b=A>>>26,A&=67108863,this.words[x]=A}return b!==0&&(this.words[x]=b,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(d){var u=d<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this.strip();var a;if(this.length>1)a=1;else{u&&(d=-d),i(d<=67108863,"Number is too big");var f=this.words[0]|0;a=f===d?0:f<d?-1:1}return this.negative!==0?-a|0:a},s.prototype.cmp=function(d){if(this.negative!==0&&d.negative===0)return-1;if(this.negative===0&&d.negative!==0)return 1;var u=this.ucmp(d);return this.negative!==0?-u|0:u},s.prototype.ucmp=function(d){if(this.length>d.length)return 1;if(this.length<d.length)return-1;for(var u=0,a=this.length-1;a>=0;a--){var f=this.words[a]|0,b=d.words[a]|0;if(f!==b){f<b?u=-1:f>b&&(u=1);break}}return u},s.prototype.gtn=function(d){return this.cmpn(d)===1},s.prototype.gt=function(d){return this.cmp(d)===1},s.prototype.gten=function(d){return this.cmpn(d)>=0},s.prototype.gte=function(d){return this.cmp(d)>=0},s.prototype.ltn=function(d){return this.cmpn(d)===-1},s.prototype.lt=function(d){return this.cmp(d)===-1},s.prototype.lten=function(d){return this.cmpn(d)<=0},s.prototype.lte=function(d){return this.cmp(d)<=0},s.prototype.eqn=function(d){return this.cmpn(d)===0},s.prototype.eq=function(d){return this.cmp(d)===0},s.red=function(d){return new V(d)},s.prototype.toRed=function(d){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),d.convertTo(this)._forceRed(d)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(d){return this.red=d,this},s.prototype.forceRed=function(d){return i(!this.red,"Already a number in reduction context"),this._forceRed(d)},s.prototype.redAdd=function(d){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,d)},s.prototype.redIAdd=function(d){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,d)},s.prototype.redSub=function(d){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,d)},s.prototype.redISub=function(d){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,d)},s.prototype.redShl=function(d){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,d)},s.prototype.redMul=function(d){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.mul(this,d)},s.prototype.redIMul=function(d){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.imul(this,d)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(d){return i(this.red&&!d.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,d)};var K={k256:null,p224:null,p192:null,p25519:null};function F(O,d){this.name=O,this.p=new s(d,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}F.prototype._tmp=function(){var d=new s(null);return d.words=new Array(Math.ceil(this.n/13)),d},F.prototype.ireduce=function(d){var u=d,a;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),a=u.bitLength();while(a>this.n);var f=a<this.n?-1:u.ucmp(this.p);return f===0?(u.words[0]=0,u.length=1):f>0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},F.prototype.split=function(d,u){d.iushrn(this.n,0,u)},F.prototype.imulK=function(d){return d.imul(this.k)};function $(){F.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n($,F),$.prototype.split=function(d,u){for(var a=4194303,f=Math.min(d.length,9),b=0;b<f;b++)u.words[b]=d.words[b];if(u.length=f,d.length<=9){d.words[0]=0,d.length=1;return}var x=d.words[9];for(u.words[u.length++]=x&a,b=10;b<d.length;b++){var A=d.words[b]|0;d.words[b-10]=(A&a)<<4|x>>>22,x=A}x>>>=22,d.words[b-10]=x,x===0&&d.length>10?d.length-=10:d.length-=9},$.prototype.imulK=function(d){d.words[d.length]=0,d.words[d.length+1]=0,d.length+=2;for(var u=0,a=0;a<d.length;a++){var f=d.words[a]|0;u+=f*977,d.words[a]=u&67108863,u=f*64+(u/67108864|0)}return d.words[d.length-1]===0&&(d.length--,d.words[d.length-1]===0&&d.length--),d};function q(){F.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(q,F);function y(){F.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(y,F);function R(){F.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(R,F),R.prototype.imulK=function(d){for(var u=0,a=0;a<d.length;a++){var f=(d.words[a]|0)*19+u,b=f&67108863;f>>>=26,d.words[a]=b,u=f}return u!==0&&(d.words[d.length++]=u),d},s._prime=function(d){if(K[d])return K[d];var u;if(d==="k256")u=new $;else if(d==="p224")u=new q;else if(d==="p192")u=new y;else if(d==="p25519")u=new R;else throw new Error("Unknown prime "+d);return K[d]=u,u};function V(O){if(typeof O=="string"){var d=s._prime(O);this.m=d.p,this.prime=d}else i(O.gtn(1),"modulus must be greater than 1"),this.m=O,this.prime=null}V.prototype._verify1=function(d){i(d.negative===0,"red works only with positives"),i(d.red,"red works only with red numbers")},V.prototype._verify2=function(d,u){i((d.negative|u.negative)===0,"red works only with positives"),i(d.red&&d.red===u.red,"red works only with red numbers")},V.prototype.imod=function(d){return this.prime?this.prime.ireduce(d)._forceRed(this):d.umod(this.m)._forceRed(this)},V.prototype.neg=function(d){return d.isZero()?d.clone():this.m.sub(d)._forceRed(this)},V.prototype.add=function(d,u){this._verify2(d,u);var a=d.add(u);return a.cmp(this.m)>=0&&a.isub(this.m),a._forceRed(this)},V.prototype.iadd=function(d,u){this._verify2(d,u);var a=d.iadd(u);return a.cmp(this.m)>=0&&a.isub(this.m),a},V.prototype.sub=function(d,u){this._verify2(d,u);var a=d.sub(u);return a.cmpn(0)<0&&a.iadd(this.m),a._forceRed(this)},V.prototype.isub=function(d,u){this._verify2(d,u);var a=d.isub(u);return a.cmpn(0)<0&&a.iadd(this.m),a},V.prototype.shl=function(d,u){return this._verify1(d),this.imod(d.ushln(u))},V.prototype.imul=function(d,u){return this._verify2(d,u),this.imod(d.imul(u))},V.prototype.mul=function(d,u){return this._verify2(d,u),this.imod(d.mul(u))},V.prototype.isqr=function(d){return this.imul(d,d.clone())},V.prototype.sqr=function(d){return this.mul(d,d)},V.prototype.sqrt=function(d){if(d.isZero())return d.clone();var u=this.m.andln(3);if(i(u%2===1),u===3){var a=this.m.add(new s(1)).iushrn(2);return this.pow(d,a)}for(var f=this.m.subn(1),b=0;!f.isZero()&&f.andln(1)===0;)b++,f.iushrn(1);i(!f.isZero());var x=new s(1).toRed(this),A=x.redNeg(),_=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new s(2*c*c).toRed(this);this.pow(c,_).cmp(A)!==0;)c.redIAdd(A);for(var m=this.pow(c,f),v=this.pow(d,f.addn(1).iushrn(1)),S=this.pow(d,f),G=b;S.cmp(x)!==0;){for(var E=S,k=0;E.cmp(x)!==0;k++)E=E.redSqr();i(k<G);var C=this.pow(m,new s(1).iushln(G-k-1));v=v.redMul(C),m=C.redSqr(),S=S.redMul(m),G=k}return v},V.prototype.invm=function(d){var u=d._invmp(this.m);return u.negative!==0?(u.negative=0,this.imod(u).redNeg()):this.imod(u)},V.prototype.pow=function(d,u){if(u.isZero())return new s(1).toRed(this);if(u.cmpn(1)===0)return d.clone();var a=4,f=new Array(1<<a);f[0]=new s(1).toRed(this),f[1]=d;for(var b=2;b<f.length;b++)f[b]=this.mul(f[b-1],d);var x=f[0],A=0,_=0,c=u.bitLength()%26;for(c===0&&(c=26),b=u.length-1;b>=0;b--){for(var m=u.words[b],v=c-1;v>=0;v--){var S=m>>v&1;if(x!==f[0]&&(x=this.sqr(x)),S===0&&A===0){_=0;continue}A<<=1,A|=S,_++,!(_!==a&&(b!==0||v!==0))&&(x=this.mul(x,f[A]),_=0,A=0)}c=26}return x},V.prototype.convertTo=function(d){var u=d.umod(this.m);return u===d?u.clone():u},V.prototype.convertFrom=function(d){var u=d.clone();return u.red=null,u},s.mont=function(d){return new Q(d)};function Q(O){V.call(this,O),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(Q,V),Q.prototype.convertTo=function(d){return this.imod(d.ushln(this.shift))},Q.prototype.convertFrom=function(d){var u=this.imod(d.mul(this.rinv));return u.red=null,u},Q.prototype.imul=function(d,u){if(d.isZero()||u.isZero())return d.words[0]=0,d.length=1,d;var a=d.imul(u),f=a.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=a.isub(f).iushrn(this.shift),x=b;return b.cmp(this.m)>=0?x=b.isub(this.m):b.cmpn(0)<0&&(x=b.iadd(this.m)),x._forceRed(this)},Q.prototype.mul=function(d,u){if(d.isZero()||u.isZero())return new s(0)._forceRed(this);var a=d.mul(u),f=a.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=a.isub(f).iushrn(this.shift),x=b;return b.cmp(this.m)>=0?x=b.isub(this.m):b.cmpn(0)<0&&(x=b.iadd(this.m)),x._forceRed(this)},Q.prototype.invm=function(d){var u=this.imod(d._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(t,Bt)})(nn);var Xc={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var h=[];if(typeof s!="string"){for(var l=0;l<s.length;l++)h[l]=s[l]|0;return h}if(o==="hex"){s=s.replace(/[^a-z0-9]+/ig,""),s.length%2!==0&&(s="0"+s);for(var l=0;l<s.length;l+=2)h.push(parseInt(s[l]+s[l+1],16))}else for(var l=0;l<s.length;l++){var p=s.charCodeAt(l),w=p>>8,M=p&255;w?h.push(w,M):h.push(M)}return h}e.toArray=r;function i(s){return s.length===1?"0"+s:s}e.zero2=i;function n(s){for(var o="",h=0;h<s.length;h++)o+=i(s[h].toString(16));return o}e.toHex=n,e.encode=function(o,h){return h==="hex"?n(o):o}})(Xc),function(t){var e=t,r=nn.exports,i=_s,n=Xc;e.assert=i,e.toArray=n.toArray,e.zero2=n.zero2,e.toHex=n.toHex,e.encode=n.encode;function s(w,M,I){var D=new Array(Math.max(w.bitLength(),I)+1),N;for(N=0;N<D.length;N+=1)D[N]=0;var U=1<<M+1,z=w.clone();for(N=0;N<D.length;N++){var H,L=z.andln(U-1);z.isOdd()?(L>(U>>1)-1?H=(U>>1)-L:H=L,z.isubn(H)):H=0,D[N]=H,z.iushrn(1)}return D}e.getNAF=s;function o(w,M){var I=[[],[]];w=w.clone(),M=M.clone();for(var D=0,N=0,U;w.cmpn(-D)>0||M.cmpn(-N)>0;){var z=w.andln(3)+D&3,H=M.andln(3)+N&3;z===3&&(z=-1),H===3&&(H=-1);var L;z&1?(U=w.andln(7)+D&7,(U===3||U===5)&&H===2?L=-z:L=z):L=0,I[0].push(L);var K;H&1?(U=M.andln(7)+N&7,(U===3||U===5)&&z===2?K=-H:K=H):K=0,I[1].push(K),2*D===L+1&&(D=1-D),2*N===K+1&&(N=1-N),w.iushrn(1),M.iushrn(1)}return I}e.getJSF=o;function h(w,M,I){var D="_"+M;w.prototype[M]=function(){return this[D]!==void 0?this[D]:this[D]=I.call(this)}}e.cachedProperty=h;function l(w){return typeof w=="string"?e.toArray(w,"hex"):w}e.parseBytes=l;function p(w){return new r(w,"hex","le")}e.intFromLE=p}(Xr);var o0={exports:{}},Zc;o0.exports=function(e){return Zc||(Zc=new jn(null)),Zc.generate(e)};function jn(t){this.rand=t}if(o0.exports.Rand=jn,jn.prototype.generate=function(e){return this._rand(e)},jn.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),i=0;i<r.length;i++)r[i]=this.rand.getByte();return r},typeof self=="object")self.crypto&&self.crypto.getRandomValues?jn.prototype._rand=function(e){var r=new Uint8Array(e);return self.crypto.getRandomValues(r),r}:self.msCrypto&&self.msCrypto.getRandomValues?jn.prototype._rand=function(e){var r=new Uint8Array(e);return self.msCrypto.getRandomValues(r),r}:typeof window=="object"&&(jn.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var h2=Nn;if(typeof h2.randomBytes!="function")throw new Error("Not supported");jn.prototype._rand=function(e){return h2.randomBytes(e)}}catch{}var eu={},Ms=nn.exports,Mf=Xr,h0=Mf.getNAF,YN=Mf.getJSF,c0=Mf.assert;function Gn(t,e){this.type=t,this.p=new Ms(e.p,16),this.red=e.prime?Ms.red(e.prime):Ms.mont(this.p),this.zero=new Ms(0).toRed(this.red),this.one=new Ms(1).toRed(this.red),this.two=new Ms(2).toRed(this.red),this.n=e.n&&new Ms(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var u0=Gn;Gn.prototype.point=function(){throw new Error("Not implemented")},Gn.prototype.validate=function(){throw new Error("Not implemented")},Gn.prototype._fixedNafMul=function(e,r){c0(e.precomputed);var i=e._getDoubles(),n=h0(r,1,this._bitLength),s=(1<<i.step+1)-(i.step%2===0?2:1);s/=3;var o=[],h,l;for(h=0;h<n.length;h+=i.step){l=0;for(var p=h+i.step-1;p>=h;p--)l=(l<<1)+n[p];o.push(l)}for(var w=this.jpoint(null,null,null),M=this.jpoint(null,null,null),I=s;I>0;I--){for(h=0;h<o.length;h++)l=o[h],l===I?M=M.mixedAdd(i.points[h]):l===-I&&(M=M.mixedAdd(i.points[h].neg()));w=w.add(M)}return w.toP()},Gn.prototype._wnafMul=function(e,r){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var s=n.points,o=h0(r,i,this._bitLength),h=this.jpoint(null,null,null),l=o.length-1;l>=0;l--){for(var p=0;l>=0&&o[l]===0;l--)p++;if(l>=0&&p++,h=h.dblp(p),l<0)break;var w=o[l];c0(w!==0),e.type==="affine"?w>0?h=h.mixedAdd(s[w-1>>1]):h=h.mixedAdd(s[-w-1>>1].neg()):w>0?h=h.add(s[w-1>>1]):h=h.add(s[-w-1>>1].neg())}return e.type==="affine"?h.toP():h},Gn.prototype._wnafMulAdd=function(e,r,i,n,s){var o=this._wnafT1,h=this._wnafT2,l=this._wnafT3,p=0,w,M,I;for(w=0;w<n;w++){I=r[w];var D=I._getNAFPoints(e);o[w]=D.wnd,h[w]=D.points}for(w=n-1;w>=1;w-=2){var N=w-1,U=w;if(o[N]!==1||o[U]!==1){l[N]=h0(i[N],o[N],this._bitLength),l[U]=h0(i[U],o[U],this._bitLength),p=Math.max(l[N].length,p),p=Math.max(l[U].length,p);continue}var z=[r[N],null,null,r[U]];r[N].y.cmp(r[U].y)===0?(z[1]=r[N].add(r[U]),z[2]=r[N].toJ().mixedAdd(r[U].neg())):r[N].y.cmp(r[U].y.redNeg())===0?(z[1]=r[N].toJ().mixedAdd(r[U]),z[2]=r[N].add(r[U].neg())):(z[1]=r[N].toJ().mixedAdd(r[U]),z[2]=r[N].toJ().mixedAdd(r[U].neg()));var H=[-3,-1,-5,-7,0,7,5,1,3],L=YN(i[N],i[U]);for(p=Math.max(L[0].length,p),l[N]=new Array(p),l[U]=new Array(p),M=0;M<p;M++){var K=L[0][M]|0,F=L[1][M]|0;l[N][M]=H[(K+1)*3+(F+1)],l[U][M]=0,h[N]=z}}var $=this.jpoint(null,null,null),q=this._wnafT4;for(w=p;w>=0;w--){for(var y=0;w>=0;){var R=!0;for(M=0;M<n;M++)q[M]=l[M][w]|0,q[M]!==0&&(R=!1);if(!R)break;y++,w--}if(w>=0&&y++,$=$.dblp(y),w<0)break;for(M=0;M<n;M++){var V=q[M];V!==0&&(V>0?I=h[M][V-1>>1]:V<0&&(I=h[M][-V-1>>1].neg()),I.type==="affine"?$=$.mixedAdd(I):$=$.add(I))}}for(w=0;w<n;w++)h[w]=null;return s?$:$.toP()};function pi(t,e){this.curve=t,this.type=e,this.precomputed=null}Gn.BasePoint=pi,pi.prototype.eq=function(){throw new Error("Not implemented")},pi.prototype.validate=function(){return this.curve.validate(this)},Gn.prototype.decodePoint=function(e,r){e=Mf.toArray(e,r);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?c0(e[e.length-1]%2===0):e[0]===7&&c0(e[e.length-1]%2===1);var n=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return n}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")},pi.prototype.encodeCompressed=function(e){return this.encode(e,!0)},pi.prototype._encode=function(e){var r=this.curve.p.byteLength(),i=this.getX().toArray("be",r);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",r))},pi.prototype.encode=function(e,r){return Mf.encode(this._encode(r),e)},pi.prototype.precompute=function(e){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,e),r.beta=this._getBeta(),this.precomputed=r,this},pi.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return r?r.points.length>=Math.ceil((e.bitLength()+1)/r.step):!1},pi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,s=0;s<r;s+=e){for(var o=0;o<e;o++)n=n.dbl();i.push(n)}return{step:e,points:i}},pi.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),s=1;s<i;s++)r[s]=r[s-1].add(n);return{wnd:e,points:r}},pi.prototype._getBeta=function(){return null},pi.prototype.dblp=function(e){for(var r=this,i=0;i<e;i++)r=r.dbl();return r};var JN=Xr,Rt=nn.exports,tu=da.exports,wa=u0,WN=JN.assert;function bi(t){wa.call(this,"short",t),this.a=new Rt(t.a,16).toRed(this.red),this.b=new Rt(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}tu(bi,wa);var QN=bi;bi.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,i;if(e.beta)r=new Rt(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);r=n[0].cmp(n[1])<0?n[0]:n[1],r=r.toRed(this.red)}if(e.lambda)i=new Rt(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(r))===0?i=s[0]:(i=s[1],WN(this.g.mul(i).x.cmp(this.g.x.redMul(r))===0))}var o;return e.basis?o=e.basis.map(function(h){return{a:new Rt(h.a,16),b:new Rt(h.b,16)}}):o=this._getEndoBasis(i),{beta:r,lambda:i,basis:o}}},bi.prototype._getEndoRoots=function(e){var r=e===this.p?this.red:Rt.mont(e),i=new Rt(2).toRed(r).redInvm(),n=i.redNeg(),s=new Rt(3).toRed(r).redNeg().redSqrt().redMul(i),o=n.redAdd(s).fromRed(),h=n.redSub(s).fromRed();return[o,h]},bi.prototype._getEndoBasis=function(e){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),s=new Rt(1),o=new Rt(0),h=new Rt(0),l=new Rt(1),p,w,M,I,D,N,U,z=0,H,L;i.cmpn(0)!==0;){var K=n.div(i);H=n.sub(K.mul(i)),L=h.sub(K.mul(s));var F=l.sub(K.mul(o));if(!M&&H.cmp(r)<0)p=U.neg(),w=s,M=H.neg(),I=L;else if(M&&++z===2)break;U=H,n=i,i=H,h=s,s=L,l=o,o=F}D=H.neg(),N=L;var $=M.sqr().add(I.sqr()),q=D.sqr().add(N.sqr());return q.cmp($)>=0&&(D=p,N=w),M.negative&&(M=M.neg(),I=I.neg()),D.negative&&(D=D.neg(),N=N.neg()),[{a:M,b:I},{a:D,b:N}]},bi.prototype._endoSplit=function(e){var r=this.endo.basis,i=r[0],n=r[1],s=n.b.mul(e).divRound(this.n),o=i.b.neg().mul(e).divRound(this.n),h=s.mul(i.a),l=o.mul(n.a),p=s.mul(i.b),w=o.mul(n.b),M=e.sub(h).sub(l),I=p.add(w).neg();return{k1:M,k2:I}},bi.prototype.pointFromX=function(e,r){e=new Rt(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var s=n.fromRed().isOdd();return(r&&!s||!r&&s)&&(n=n.redNeg()),this.point(e,n)},bi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,i=e.y,n=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(s).cmpn(0)===0},bi.prototype._endoWnafMulAdd=function(e,r,i){for(var n=this._endoWnafT1,s=this._endoWnafT2,o=0;o<e.length;o++){var h=this._endoSplit(r[o]),l=e[o],p=l._getBeta();h.k1.negative&&(h.k1.ineg(),l=l.neg(!0)),h.k2.negative&&(h.k2.ineg(),p=p.neg(!0)),n[o*2]=l,n[o*2+1]=p,s[o*2]=h.k1,s[o*2+1]=h.k2}for(var w=this._wnafMulAdd(1,n,s,o*2,i),M=0;M<o*2;M++)n[M]=null,s[M]=null;return w};function Vt(t,e,r,i){wa.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Rt(e,16),this.y=new Rt(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}tu(Vt,wa.BasePoint),bi.prototype.point=function(e,r,i){return new Vt(this,e,r,i)},bi.prototype.pointFromJSON=function(e,r){return Vt.fromJSON(this,e,r)},Vt.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var r=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,n=function(s){return i.point(s.x.redMul(i.endo.beta),s.y)};e.beta=r,r.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return r}},Vt.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Vt.fromJSON=function(e,r,i){typeof r=="string"&&(r=JSON.parse(r));var n=e.point(r[0],r[1],i);if(!r[2])return n;function s(h){return e.point(h[0],h[1],i)}var o=r[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(s))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(s))}},n},Vt.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Vt.prototype.isInfinity=function(){return this.inf},Vt.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var i=r.redSqr().redISub(this.x).redISub(e.x),n=r.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)},Vt.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),s=i.redAdd(i).redIAdd(i).redIAdd(r).redMul(n),o=s.redSqr().redISub(this.x.redAdd(this.x)),h=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,h)},Vt.prototype.getX=function(){return this.x.fromRed()},Vt.prototype.getY=function(){return this.y.fromRed()},Vt.prototype.mul=function(e){return e=new Rt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Vt.prototype.mulAdd=function(e,r,i){var n=[this,r],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)},Vt.prototype.jmulAdd=function(e,r,i){var n=[this,r],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)},Vt.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Vt.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(s){return s.neg()};r.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return r},Vt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function sr(t,e,r,i){wa.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Rt(0)):(this.x=new Rt(e,16),this.y=new Rt(r,16),this.z=new Rt(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}tu(sr,wa.BasePoint),bi.prototype.jpoint=function(e,r,i){return new sr(this,e,r,i)},sr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),i=this.x.redMul(r),n=this.y.redMul(r).redMul(e);return this.curve.point(i,n)},sr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},sr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(r),s=e.x.redMul(i),o=this.y.redMul(r.redMul(e.z)),h=e.y.redMul(i.redMul(this.z)),l=n.redSub(s),p=o.redSub(h);if(l.cmpn(0)===0)return p.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var w=l.redSqr(),M=w.redMul(l),I=n.redMul(w),D=p.redSqr().redIAdd(M).redISub(I).redISub(I),N=p.redMul(I.redISub(D)).redISub(o.redMul(M)),U=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(D,N,U)},sr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),i=this.x,n=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),h=i.redSub(n),l=s.redSub(o);if(h.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var p=h.redSqr(),w=p.redMul(h),M=i.redMul(p),I=l.redSqr().redIAdd(w).redISub(M).redISub(M),D=l.redMul(M.redISub(I)).redISub(s.redMul(w)),N=this.z.redMul(h);return this.curve.jpoint(I,D,N)},sr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var i=this;for(r=0;r<e;r++)i=i.dbl();return i}var n=this.curve.a,s=this.curve.tinv,o=this.x,h=this.y,l=this.z,p=l.redSqr().redSqr(),w=h.redAdd(h);for(r=0;r<e;r++){var M=o.redSqr(),I=w.redSqr(),D=I.redSqr(),N=M.redAdd(M).redIAdd(M).redIAdd(n.redMul(p)),U=o.redMul(I),z=N.redSqr().redISub(U.redAdd(U)),H=U.redISub(z),L=N.redMul(H);L=L.redIAdd(L).redISub(D);var K=w.redMul(l);r+1<e&&(p=p.redMul(D)),o=z,l=K,w=L}return this.curve.jpoint(o,w.redMul(s),l)},sr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},sr.prototype._zeroDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),o=s.redSqr(),h=this.x.redAdd(s).redSqr().redISub(n).redISub(o);h=h.redIAdd(h);var l=n.redAdd(n).redIAdd(n),p=l.redSqr().redISub(h).redISub(h),w=o.redIAdd(o);w=w.redIAdd(w),w=w.redIAdd(w),e=p,r=l.redMul(h.redISub(p)).redISub(w),i=this.y.redAdd(this.y)}else{var M=this.x.redSqr(),I=this.y.redSqr(),D=I.redSqr(),N=this.x.redAdd(I).redSqr().redISub(M).redISub(D);N=N.redIAdd(N);var U=M.redAdd(M).redIAdd(M),z=U.redSqr(),H=D.redIAdd(D);H=H.redIAdd(H),H=H.redIAdd(H),e=z.redISub(N).redISub(N),r=U.redMul(N.redISub(e)).redISub(H),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,r,i)},sr.prototype._threeDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),o=s.redSqr(),h=this.x.redAdd(s).redSqr().redISub(n).redISub(o);h=h.redIAdd(h);var l=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),p=l.redSqr().redISub(h).redISub(h);e=p;var w=o.redIAdd(o);w=w.redIAdd(w),w=w.redIAdd(w),r=l.redMul(h.redISub(p)).redISub(w),i=this.y.redAdd(this.y)}else{var M=this.z.redSqr(),I=this.y.redSqr(),D=this.x.redMul(I),N=this.x.redSub(M).redMul(this.x.redAdd(M));N=N.redAdd(N).redIAdd(N);var U=D.redIAdd(D);U=U.redIAdd(U);var z=U.redAdd(U);e=N.redSqr().redISub(z),i=this.y.redAdd(this.z).redSqr().redISub(I).redISub(M);var H=I.redSqr();H=H.redIAdd(H),H=H.redIAdd(H),H=H.redIAdd(H),r=N.redMul(U.redISub(e)).redISub(H)}return this.curve.jpoint(e,r,i)},sr.prototype._dbl=function(){var e=this.curve.a,r=this.x,i=this.y,n=this.z,s=n.redSqr().redSqr(),o=r.redSqr(),h=i.redSqr(),l=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(s)),p=r.redAdd(r);p=p.redIAdd(p);var w=p.redMul(h),M=l.redSqr().redISub(w.redAdd(w)),I=w.redISub(M),D=h.redSqr();D=D.redIAdd(D),D=D.redIAdd(D),D=D.redIAdd(D);var N=l.redMul(I).redISub(D),U=i.redAdd(i).redMul(n);return this.curve.jpoint(M,N,U)},sr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),r=this.y.redSqr(),i=this.z.redSqr(),n=r.redSqr(),s=e.redAdd(e).redIAdd(e),o=s.redSqr(),h=this.x.redAdd(r).redSqr().redISub(e).redISub(n);h=h.redIAdd(h),h=h.redAdd(h).redIAdd(h),h=h.redISub(o);var l=h.redSqr(),p=n.redIAdd(n);p=p.redIAdd(p),p=p.redIAdd(p),p=p.redIAdd(p);var w=s.redIAdd(h).redSqr().redISub(o).redISub(l).redISub(p),M=r.redMul(w);M=M.redIAdd(M),M=M.redIAdd(M);var I=this.x.redMul(l).redISub(M);I=I.redIAdd(I),I=I.redIAdd(I);var D=this.y.redMul(w.redMul(p.redISub(w)).redISub(h.redMul(l)));D=D.redIAdd(D),D=D.redIAdd(D),D=D.redIAdd(D);var N=this.z.redAdd(h).redSqr().redISub(i).redISub(l);return this.curve.jpoint(I,D,N)},sr.prototype.mul=function(e,r){return e=new Rt(e,r),this.curve._wnafMul(this,e)},sr.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var r=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(r)).cmpn(0)!==0)return!1;var n=r.redMul(this.z),s=i.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0},sr.prototype.eqXToP=function(e){var r=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(r);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(r);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(s),this.x.cmp(i)===0)return!0}},sr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},sr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var _a=nn.exports,c2=da.exports,d0=u0,XN=Xr;function xa(t){d0.call(this,"mont",t),this.a=new _a(t.a,16).toRed(this.red),this.b=new _a(t.b,16).toRed(this.red),this.i4=new _a(4).toRed(this.red).redInvm(),this.two=new _a(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}c2(xa,d0);var ZN=xa;xa.prototype.validate=function(e){var r=e.normalize().x,i=r.redSqr(),n=i.redMul(r).redAdd(i.redMul(this.a)).redAdd(r),s=n.redSqrt();return s.redSqr().cmp(n)===0};function Yt(t,e,r){d0.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new _a(e,16),this.z=new _a(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}c2(Yt,d0.BasePoint),xa.prototype.decodePoint=function(e,r){return this.point(XN.toArray(e,r),1)},xa.prototype.point=function(e,r){return new Yt(this,e,r)},xa.prototype.pointFromJSON=function(e){return Yt.fromJSON(this,e)},Yt.prototype.precompute=function(){},Yt.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Yt.fromJSON=function(e,r){return new Yt(e,r[0],r[1]||e.one)},Yt.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Yt.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Yt.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),i=this.x.redSub(this.z),n=i.redSqr(),s=r.redSub(n),o=r.redMul(n),h=s.redMul(n.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,h)},Yt.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Yt.prototype.diffAdd=function(e,r){var i=this.x.redAdd(this.z),n=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),h=o.redMul(i),l=s.redMul(n),p=r.z.redMul(h.redAdd(l).redSqr()),w=r.x.redMul(h.redISub(l).redSqr());return this.curve.point(p,w)},Yt.prototype.mul=function(e){for(var r=e.clone(),i=this,n=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var h=o.length-1;h>=0;h--)o[h]===0?(i=i.diffAdd(n,s),n=n.dbl()):(n=i.diffAdd(n,s),i=i.dbl());return n},Yt.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Yt.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Yt.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Yt.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Yt.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var eO=Xr,An=nn.exports,u2=da.exports,l0=u0,tO=eO.assert;function sn(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,l0.call(this,"edwards",t),this.a=new An(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new An(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new An(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),tO(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}u2(sn,l0);var rO=sn;sn.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},sn.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},sn.prototype.jpoint=function(e,r,i,n){return this.point(e,r,i,n)},sn.prototype.pointFromX=function(e,r){e=new An(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=this.c2.redSub(this.a.redMul(i)),s=this.one.redSub(this.c2.redMul(this.d).redMul(i)),o=n.redMul(s.redInvm()),h=o.redSqrt();if(h.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var l=h.fromRed().isOdd();return(r&&!l||!r&&l)&&(h=h.redNeg()),this.point(e,h)},sn.prototype.pointFromY=function(e,r){e=new An(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=i.redSub(this.c2),s=i.redMul(this.d).redMul(this.c2).redSub(this.a),o=n.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var h=o.redSqrt();if(h.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return h.fromRed().isOdd()!==r&&(h=h.redNeg()),this.point(h,e)},sn.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),i=e.y.redSqr(),n=r.redMul(this.a).redAdd(i),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(i)));return n.cmp(s)===0};function Mt(t,e,r,i,n){l0.BasePoint.call(this,t,"projective"),e===null&&r===null&&i===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new An(e,16),this.y=new An(r,16),this.z=i?new An(i,16):this.curve.one,this.t=n&&new An(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}u2(Mt,l0.BasePoint),sn.prototype.pointFromJSON=function(e){return Mt.fromJSON(this,e)},sn.prototype.point=function(e,r,i,n){return new Mt(this,e,r,i,n)},Mt.fromJSON=function(e,r){return new Mt(e,r[0],r[1],r[2])},Mt.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Mt.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Mt.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),i=this.z.redSqr();i=i.redIAdd(i);var n=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=n.redAdd(r),h=o.redSub(i),l=n.redSub(r),p=s.redMul(h),w=o.redMul(l),M=s.redMul(l),I=h.redMul(o);return this.curve.point(p,w,I,M)},Mt.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),i=this.y.redSqr(),n,s,o,h,l,p;if(this.curve.twisted){h=this.curve._mulA(r);var w=h.redAdd(i);this.zOne?(n=e.redSub(r).redSub(i).redMul(w.redSub(this.curve.two)),s=w.redMul(h.redSub(i)),o=w.redSqr().redSub(w).redSub(w)):(l=this.z.redSqr(),p=w.redSub(l).redISub(l),n=e.redSub(r).redISub(i).redMul(p),s=w.redMul(h.redSub(i)),o=w.redMul(p))}else h=r.redAdd(i),l=this.curve._mulC(this.z).redSqr(),p=h.redSub(l).redSub(l),n=this.curve._mulC(e.redISub(h)).redMul(p),s=this.curve._mulC(h).redMul(r.redISub(i)),o=h.redMul(p);return this.curve.point(n,s,o)},Mt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Mt.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),i=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=i.redSub(r),h=s.redSub(n),l=s.redAdd(n),p=i.redAdd(r),w=o.redMul(h),M=l.redMul(p),I=o.redMul(p),D=h.redMul(l);return this.curve.point(w,M,D,I)},Mt.prototype._projAdd=function(e){var r=this.z.redMul(e.z),i=r.redSqr(),n=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(n).redMul(s),h=i.redSub(o),l=i.redAdd(o),p=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(n).redISub(s),w=r.redMul(h).redMul(p),M,I;return this.curve.twisted?(M=r.redMul(l).redMul(s.redSub(this.curve._mulA(n))),I=h.redMul(l)):(M=r.redMul(l).redMul(s.redSub(n)),I=this.curve._mulC(h).redMul(l)),this.curve.point(w,M,I)},Mt.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Mt.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Mt.prototype.mulAdd=function(e,r,i){return this.curve._wnafMulAdd(1,[this,r],[e,i],2,!1)},Mt.prototype.jmulAdd=function(e,r,i){return this.curve._wnafMulAdd(1,[this,r],[e,i],2,!0)},Mt.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Mt.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Mt.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Mt.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Mt.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Mt.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var i=e.clone(),n=this.curve.redN.redMul(this.z);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),this.x.cmp(r)===0)return!0}},Mt.prototype.toP=Mt.prototype.normalize,Mt.prototype.mixedAdd=Mt.prototype.add,function(t){var e=t;e.base=u0,e.short=QN,e.mont=ZN,e.edwards=rO}(eu);var p0={},ru,d2;function iO(){return d2||(d2=1,ru={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),ru}(function(t){var e=t,r=Jr,i=eu,n=Xr,s=n.assert;function o(p){p.type==="short"?this.curve=new i.short(p):p.type==="edwards"?this.curve=new i.edwards(p):this.curve=new i.mont(p),this.g=this.curve.g,this.n=this.curve.n,this.hash=p.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function h(p,w){Object.defineProperty(e,p,{configurable:!0,enumerable:!0,get:function(){var M=new o(w);return Object.defineProperty(e,p,{configurable:!0,enumerable:!0,value:M}),M}})}h("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),h("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),h("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),h("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),h("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),h("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),h("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var l;try{l=iO()}catch{l=void 0}h("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",l]})})(p0);var nO=Jr,Es=Xc,l2=_s;function Vn(t){if(!(this instanceof Vn))return new Vn(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Es.toArray(t.entropy,t.entropyEnc||"hex"),r=Es.toArray(t.nonce,t.nonceEnc||"hex"),i=Es.toArray(t.pers,t.persEnc||"hex");l2(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var sO=Vn;Vn.prototype._init=function(e,r,i){var n=e.concat(r).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},Vn.prototype._hmac=function(){return new nO.hmac(this.hash,this.K)},Vn.prototype._update=function(e){var r=this._hmac().update(this.V).update([0]);e&&(r=r.update(e)),this.K=r.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},Vn.prototype.reseed=function(e,r,i,n){typeof r!="string"&&(n=i,i=r,r=null),e=Es.toArray(e,r),i=Es.toArray(i,n),l2(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1},Vn.prototype.generate=function(e,r,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(n=i,i=r,r=null),i&&(i=Es.toArray(i,n||"hex"),this._update(i));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var o=s.slice(0,e);return this._update(i),this._reseed++,Es.encode(o,r)};var aO=nn.exports,fO=Xr,iu=fO.assert;function xr(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var oO=xr;xr.fromPublic=function(e,r,i){return r instanceof xr?r:new xr(e,{pub:r,pubEnc:i})},xr.fromPrivate=function(e,r,i){return r instanceof xr?r:new xr(e,{priv:r,privEnc:i})},xr.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},xr.prototype.getPublic=function(e,r){return typeof e=="string"&&(r=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,e):this.pub},xr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},xr.prototype._importPrivate=function(e,r){this.priv=new aO(e,r||16),this.priv=this.priv.umod(this.ec.curve.n)},xr.prototype._importPublic=function(e,r){if(e.x||e.y){this.ec.curve.type==="mont"?iu(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&iu(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,r)},xr.prototype.derive=function(e){return e.validate()||iu(e.validate(),"public point not validated"),e.mul(this.priv).getX()},xr.prototype.sign=function(e,r,i){return this.ec.sign(e,this,r,i)},xr.prototype.verify=function(e,r,i){return this.ec.verify(e,r,this,void 0,i)},xr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var b0=nn.exports,nu=Xr,hO=nu.assert;function v0(t,e){if(t instanceof v0)return t;this._importDER(t,e)||(hO(t.r&&t.s,"Signature without r or s"),this.r=new b0(t.r,16),this.s=new b0(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var cO=v0;function uO(){this.place=0}function su(t,e){var r=t[e.place++];if(!(r&128))return r;var i=r&15;if(i===0||i>4||t[e.place]===0)return!1;for(var n=0,s=0,o=e.place;s<i;s++,o++)n<<=8,n|=t[o],n>>>=0;return n<=127?!1:(e.place=o,n)}function p2(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}v0.prototype._importDER=function(e,r){e=nu.toArray(e,r);var i=new uO;if(e[i.place++]!==48)return!1;var n=su(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var s=su(e,i);if(s===!1||e[i.place]&128)return!1;var o=e.slice(i.place,s+i.place);if(i.place+=s,e[i.place++]!==2)return!1;var h=su(e,i);if(h===!1||e.length!==h+i.place||e[i.place]&128)return!1;var l=e.slice(i.place,h+i.place);if(o[0]===0)if(o[1]&128)o=o.slice(1);else return!1;if(l[0]===0)if(l[1]&128)l=l.slice(1);else return!1;return this.r=new b0(o),this.s=new b0(l),this.recoveryParam=null,!0};function au(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}v0.prototype.toDER=function(e){var r=this.r.toArray(),i=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),i[0]&128&&(i=[0].concat(i)),r=p2(r),i=p2(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];au(n,r.length),n=n.concat(r),n.push(2),au(n,i.length);var s=n.concat(i),o=[48];return au(o,s.length),o=o.concat(s),nu.encode(o,e)};var Mn=nn.exports,b2=sO,dO=Xr,fu=p0,lO=o0.exports,v2=dO.assert,ou=oO,g0=cO;function vi(t){if(!(this instanceof vi))return new vi(t);typeof t=="string"&&(v2(Object.prototype.hasOwnProperty.call(fu,t),"Unknown curve "+t),t=fu[t]),t instanceof fu.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var pO=vi;vi.prototype.keyPair=function(e){return new ou(this,e)},vi.prototype.keyFromPrivate=function(e,r){return ou.fromPrivate(this,e,r)},vi.prototype.keyFromPublic=function(e,r){return ou.fromPublic(this,e,r)},vi.prototype.genKeyPair=function(e){e||(e={});for(var r=new b2({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||lO(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new Mn(2));;){var s=new Mn(r.generate(i));if(!(s.cmp(n)>0))return s.iaddn(1),this.keyFromPrivate(s)}},vi.prototype._truncateToN=function(e,r,i){var n;if(Mn.isBN(e)||typeof e=="number")e=new Mn(e,16),n=e.byteLength();else if(typeof e=="object")n=e.length,e=new Mn(e,16);else{var s=e.toString();n=s.length+1>>>1,e=new Mn(s,16)}typeof i!="number"&&(i=n*8);var o=i-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},vi.prototype.sign=function(e,r,i,n){typeof i=="object"&&(n=i,i=null),n||(n={}),r=this.keyFromPrivate(r,i),e=this._truncateToN(e,!1,n.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),h=e.toArray("be",s),l=new b2({hash:this.hash,entropy:o,nonce:h,pers:n.pers,persEnc:n.persEnc||"utf8"}),p=this.n.sub(new Mn(1)),w=0;;w++){var M=n.k?n.k(w):new Mn(l.generate(this.n.byteLength()));if(M=this._truncateToN(M,!0),!(M.cmpn(1)<=0||M.cmp(p)>=0)){var I=this.g.mul(M);if(!I.isInfinity()){var D=I.getX(),N=D.umod(this.n);if(N.cmpn(0)!==0){var U=M.invm(this.n).mul(N.mul(r.getPrivate()).iadd(e));if(U=U.umod(this.n),U.cmpn(0)!==0){var z=(I.getY().isOdd()?1:0)|(D.cmp(N)!==0?2:0);return n.canonical&&U.cmp(this.nh)>0&&(U=this.n.sub(U),z^=1),new g0({r:N,s:U,recoveryParam:z})}}}}}},vi.prototype.verify=function(e,r,i,n,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),i=this.keyFromPublic(i,n),r=new g0(r,"hex");var o=r.r,h=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||h.cmpn(1)<0||h.cmp(this.n)>=0)return!1;var l=h.invm(this.n),p=l.mul(e).umod(this.n),w=l.mul(o).umod(this.n),M;return this.curve._maxwellTrick?(M=this.g.jmulAdd(p,i.getPublic(),w),M.isInfinity()?!1:M.eqXToP(o)):(M=this.g.mulAdd(p,i.getPublic(),w),M.isInfinity()?!1:M.getX().umod(this.n).cmp(o)===0)},vi.prototype.recoverPubKey=function(t,e,r,i){v2((3&r)===r,"The recovery param is more than two bits"),e=new g0(e,i);var n=this.n,s=new Mn(t),o=e.r,h=e.s,l=r&1,p=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&p)throw new Error("Unable to find sencond key candinate");p?o=this.curve.pointFromX(o.add(this.curve.n),l):o=this.curve.pointFromX(o,l);var w=e.r.invm(n),M=n.sub(s).mul(w).umod(n),I=h.mul(w).umod(n);return this.g.mulAdd(M,o,I)},vi.prototype.getKeyRecoveryParam=function(t,e,r,i){if(e=new g0(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(t,e,n)}catch{continue}if(s.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var Ef=Xr,g2=Ef.assert,m2=Ef.parseBytes,Aa=Ef.cachedProperty;function Jt(t,e){this.eddsa=t,this._secret=m2(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=m2(e.pub)}Jt.fromPublic=function(e,r){return r instanceof Jt?r:new Jt(e,{pub:r})},Jt.fromSecret=function(e,r){return r instanceof Jt?r:new Jt(e,{secret:r})},Jt.prototype.secret=function(){return this._secret},Aa(Jt,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),Aa(Jt,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),Aa(Jt,"privBytes",function(){var e=this.eddsa,r=this.hash(),i=e.encodingLength-1,n=r.slice(0,e.encodingLength);return n[0]&=248,n[i]&=127,n[i]|=64,n}),Aa(Jt,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),Aa(Jt,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),Aa(Jt,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Jt.prototype.sign=function(e){return g2(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Jt.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)},Jt.prototype.getSecret=function(e){return g2(this._secret,"KeyPair is public only"),Ef.encode(this.secret(),e)},Jt.prototype.getPublic=function(e){return Ef.encode(this.pubBytes(),e)};var bO=Jt,vO=nn.exports,m0=Xr,y2=m0.assert,y0=m0.cachedProperty,gO=m0.parseBytes;function Ss(t,e){this.eddsa=t,typeof e!="object"&&(e=gO(e)),Array.isArray(e)&&(y2(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),y2(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof vO&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}y0(Ss,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),y0(Ss,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),y0(Ss,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),y0(Ss,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Ss.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Ss.prototype.toHex=function(){return m0.encode(this.toBytes(),"hex").toUpperCase()};var mO=Ss,yO=Jr,wO=p0,Ma=Xr,_O=Ma.assert,w2=Ma.parseBytes,_2=bO,x2=mO;function $r(t){if(_O(t==="ed25519","only tested with ed25519 so far"),!(this instanceof $r))return new $r(t);t=wO[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=yO.sha512}var xO=$r;$r.prototype.sign=function(e,r){e=w2(e);var i=this.keyFromSecret(r),n=this.hashInt(i.messagePrefix(),e),s=this.g.mul(n),o=this.encodePoint(s),h=this.hashInt(o,i.pubBytes(),e).mul(i.priv()),l=n.add(h).umod(this.curve.n);return this.makeSignature({R:s,S:l,Rencoded:o})},$r.prototype.verify=function(e,r,i){if(e=w2(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var n=this.keyFromPublic(i),s=this.hashInt(r.Rencoded(),n.pubBytes(),e),o=this.g.mul(r.S()),h=r.R().add(n.pub().mul(s));return h.eq(o)},$r.prototype.hashInt=function(){for(var e=this.hash(),r=0;r<arguments.length;r++)e.update(arguments[r]);return Ma.intFromLE(e.digest()).umod(this.curve.n)},$r.prototype.keyFromPublic=function(e){return _2.fromPublic(this,e)},$r.prototype.keyFromSecret=function(e){return _2.fromSecret(this,e)},$r.prototype.makeSignature=function(e){return e instanceof x2?e:new x2(this,e)},$r.prototype.encodePoint=function(e){var r=e.getY().toArray("le",this.encodingLength);return r[this.encodingLength-1]|=e.getX().isOdd()?128:0,r},$r.prototype.decodePoint=function(e){e=Ma.parseBytes(e);var r=e.length-1,i=e.slice(0,r).concat(e[r]&-129),n=(e[r]&128)!==0,s=Ma.intFromLE(i);return this.curve.pointFromY(s,n)},$r.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},$r.prototype.decodeInt=function(e){return Ma.intFromLE(e)},$r.prototype.isPoint=function(e){return e instanceof this.pointClass},function(t){var e=t;e.version=VN.version,e.utils=Xr,e.rand=o0.exports,e.curve=eu,e.curves=p0,e.ec=pO,e.eddsa=xO}(CN);var AO={},A2={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=tt,r=Qr;t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var i=function(){function h(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return h.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},h.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},h.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},h.prototype.update=function(l,p){if(p===void 0&&(p=l.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var w=0;if(this._bytesHashed+=p,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&p>0;)this._buffer[this._bufferLength++]=l[w++],p--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(p>=this.blockSize&&(w=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,l,w,p),p%=this.blockSize);p>0;)this._buffer[this._bufferLength++]=l[w++],p--;return this},h.prototype.finish=function(l){if(!this._finished){var p=this._bytesHashed,w=this._bufferLength,M=p/536870912|0,I=p<<3,D=p%128<112?128:256;this._buffer[w]=128;for(var N=w+1;N<D-8;N++)this._buffer[N]=0;e.writeUint32BE(M,this._buffer,D-8),e.writeUint32BE(I,this._buffer,D-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,D),this._finished=!0}for(var N=0;N<this.digestLength/8;N++)e.writeUint32BE(this._stateHi[N],l,N*8),e.writeUint32BE(this._stateLo[N],l,N*8+4);return this},h.prototype.digest=function(){var l=new Uint8Array(this.digestLength);return this.finish(l),l},h.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},h.prototype.restoreState=function(l){return this._stateHi.set(l.stateHi),this._stateLo.set(l.stateLo),this._bufferLength=l.bufferLength,l.buffer&&this._buffer.set(l.buffer),this._bytesHashed=l.bytesHashed,this._finished=!1,this},h.prototype.cleanSavedState=function(l){r.wipe(l.stateHi),r.wipe(l.stateLo),l.buffer&&r.wipe(l.buffer),l.bufferLength=0,l.bytesHashed=0},h}();t.SHA512=i;var n=new Int32Array([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]);function s(h,l,p,w,M,I,D){for(var N=p[0],U=p[1],z=p[2],H=p[3],L=p[4],K=p[5],F=p[6],$=p[7],q=w[0],y=w[1],R=w[2],V=w[3],Q=w[4],O=w[5],d=w[6],u=w[7],a,f,b,x,A,_,c,m;D>=128;){for(var v=0;v<16;v++){var S=8*v+I;h[v]=e.readUint32BE(M,S),l[v]=e.readUint32BE(M,S+4)}for(var v=0;v<80;v++){var G=N,E=U,k=z,C=H,B=L,P=K,g=F,T=$,j=q,J=y,W=R,X=V,ve=Q,_e=O,ae=d,De=u;if(a=$,f=u,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=(L>>>14|Q<<32-14)^(L>>>18|Q<<32-18)^(Q>>>41-32|L<<32-(41-32)),f=(Q>>>14|L<<32-14)^(Q>>>18|L<<32-18)^(L>>>41-32|Q<<32-(41-32)),A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,a=L&K^~L&F,f=Q&O^~Q&d,A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,a=n[v*2],f=n[v*2+1],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,a=h[v%16],f=l[v%16],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,b=c&65535|m<<16,x=A&65535|_<<16,a=b,f=x,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=(N>>>28|q<<32-28)^(q>>>34-32|N<<32-(34-32))^(q>>>39-32|N<<32-(39-32)),f=(q>>>28|N<<32-28)^(N>>>34-32|q<<32-(34-32))^(N>>>39-32|q<<32-(39-32)),A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,a=N&U^N&z^U&z,f=q&y^q&R^y&R,A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,T=c&65535|m<<16,De=A&65535|_<<16,a=C,f=X,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=b,f=x,A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,C=c&65535|m<<16,X=A&65535|_<<16,U=G,z=E,H=k,L=C,K=B,F=P,$=g,N=T,y=j,R=J,V=W,Q=X,O=ve,d=_e,u=ae,q=De,v%16===15)for(var S=0;S<16;S++)a=h[S],f=l[S],A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=h[(S+9)%16],f=l[(S+9)%16],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,b=h[(S+1)%16],x=l[(S+1)%16],a=(b>>>1|x<<32-1)^(b>>>8|x<<32-8)^b>>>7,f=(x>>>1|b<<32-1)^(x>>>8|b<<32-8)^(x>>>7|b<<32-7),A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,b=h[(S+14)%16],x=l[(S+14)%16],a=(b>>>19|x<<32-19)^(x>>>61-32|b<<32-(61-32))^b>>>6,f=(x>>>19|b<<32-19)^(b>>>61-32|x<<32-(61-32))^(x>>>6|b<<32-6),A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,h[S]=c&65535|m<<16,l[S]=A&65535|_<<16}a=N,f=q,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=p[0],f=w[0],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,p[0]=N=c&65535|m<<16,w[0]=q=A&65535|_<<16,a=U,f=y,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=p[1],f=w[1],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,p[1]=U=c&65535|m<<16,w[1]=y=A&65535|_<<16,a=z,f=R,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=p[2],f=w[2],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,p[2]=z=c&65535|m<<16,w[2]=R=A&65535|_<<16,a=H,f=V,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=p[3],f=w[3],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,p[3]=H=c&65535|m<<16,w[3]=V=A&65535|_<<16,a=L,f=Q,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=p[4],f=w[4],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,p[4]=L=c&65535|m<<16,w[4]=Q=A&65535|_<<16,a=K,f=O,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=p[5],f=w[5],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,p[5]=K=c&65535|m<<16,w[5]=O=A&65535|_<<16,a=F,f=d,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=p[6],f=w[6],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,p[6]=F=c&65535|m<<16,w[6]=d=A&65535|_<<16,a=$,f=u,A=f&65535,_=f>>>16,c=a&65535,m=a>>>16,a=p[7],f=w[7],A+=f&65535,_+=f>>>16,c+=a&65535,m+=a>>>16,_+=A>>>16,c+=_>>>16,m+=c>>>16,p[7]=$=c&65535|m<<16,w[7]=u=A&65535|_<<16,I+=128,D-=128}return I}function o(h){var l=new i;l.update(h);var p=l.digest();return l.clean(),p}t.hash=o})(A2),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=Jc,r=A2,i=Qr;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function n(C){const B=new Float64Array(16);if(C)for(let P=0;P<C.length;P++)B[P]=C[P];return B}const s=new Uint8Array(32);s[0]=9;const o=n(),h=n([1]),l=n([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),p=n([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),w=n([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),M=n([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),I=n([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function D(C,B){for(let P=0;P<16;P++)C[P]=B[P]|0}function N(C){let B=1;for(let P=0;P<16;P++){let g=C[P]+B+65535;B=Math.floor(g/65536),C[P]=g-B*65536}C[0]+=B-1+37*(B-1)}function U(C,B,P){const g=~(P-1);for(let T=0;T<16;T++){const j=g&(C[T]^B[T]);C[T]^=j,B[T]^=j}}function z(C,B){const P=n(),g=n();for(let T=0;T<16;T++)g[T]=B[T];N(g),N(g),N(g);for(let T=0;T<2;T++){P[0]=g[0]-65517;for(let J=1;J<15;J++)P[J]=g[J]-65535-(P[J-1]>>16&1),P[J-1]&=65535;P[15]=g[15]-32767-(P[14]>>16&1);const j=P[15]>>16&1;P[14]&=65535,U(g,P,1-j)}for(let T=0;T<16;T++)C[2*T]=g[T]&255,C[2*T+1]=g[T]>>8}function H(C,B){let P=0;for(let g=0;g<32;g++)P|=C[g]^B[g];return(1&P-1>>>8)-1}function L(C,B){const P=new Uint8Array(32),g=new Uint8Array(32);return z(P,C),z(g,B),H(P,g)}function K(C){const B=new Uint8Array(32);return z(B,C),B[0]&1}function F(C,B){for(let P=0;P<16;P++)C[P]=B[2*P]+(B[2*P+1]<<8);C[15]&=32767}function $(C,B,P){for(let g=0;g<16;g++)C[g]=B[g]+P[g]}function q(C,B,P){for(let g=0;g<16;g++)C[g]=B[g]-P[g]}function y(C,B,P){let g,T,j=0,J=0,W=0,X=0,ve=0,_e=0,ae=0,De=0,me=0,ie=0,de=0,he=0,te=0,fe=0,se=0,ee=0,le=0,ge=0,re=0,ye=0,we=0,ne=0,xe=0,Ae=0,Me=0,Ke=0,He=0,Ee=0,je=0,Ve=0,Ie=0,Re=P[0],Oe=P[1],ce=P[2],Ce=P[3],Pe=P[4],oe=P[5],Fe=P[6],Le=P[7],pe=P[8],Ue=P[9],$e=P[10],ue=P[11],Te=P[12],Ne=P[13],be=P[14],qe=P[15];g=B[0],j+=g*Re,J+=g*Oe,W+=g*ce,X+=g*Ce,ve+=g*Pe,_e+=g*oe,ae+=g*Fe,De+=g*Le,me+=g*pe,ie+=g*Ue,de+=g*$e,he+=g*ue,te+=g*Te,fe+=g*Ne,se+=g*be,ee+=g*qe,g=B[1],J+=g*Re,W+=g*Oe,X+=g*ce,ve+=g*Ce,_e+=g*Pe,ae+=g*oe,De+=g*Fe,me+=g*Le,ie+=g*pe,de+=g*Ue,he+=g*$e,te+=g*ue,fe+=g*Te,se+=g*Ne,ee+=g*be,le+=g*qe,g=B[2],W+=g*Re,X+=g*Oe,ve+=g*ce,_e+=g*Ce,ae+=g*Pe,De+=g*oe,me+=g*Fe,ie+=g*Le,de+=g*pe,he+=g*Ue,te+=g*$e,fe+=g*ue,se+=g*Te,ee+=g*Ne,le+=g*be,ge+=g*qe,g=B[3],X+=g*Re,ve+=g*Oe,_e+=g*ce,ae+=g*Ce,De+=g*Pe,me+=g*oe,ie+=g*Fe,de+=g*Le,he+=g*pe,te+=g*Ue,fe+=g*$e,se+=g*ue,ee+=g*Te,le+=g*Ne,ge+=g*be,re+=g*qe,g=B[4],ve+=g*Re,_e+=g*Oe,ae+=g*ce,De+=g*Ce,me+=g*Pe,ie+=g*oe,de+=g*Fe,he+=g*Le,te+=g*pe,fe+=g*Ue,se+=g*$e,ee+=g*ue,le+=g*Te,ge+=g*Ne,re+=g*be,ye+=g*qe,g=B[5],_e+=g*Re,ae+=g*Oe,De+=g*ce,me+=g*Ce,ie+=g*Pe,de+=g*oe,he+=g*Fe,te+=g*Le,fe+=g*pe,se+=g*Ue,ee+=g*$e,le+=g*ue,ge+=g*Te,re+=g*Ne,ye+=g*be,we+=g*qe,g=B[6],ae+=g*Re,De+=g*Oe,me+=g*ce,ie+=g*Ce,de+=g*Pe,he+=g*oe,te+=g*Fe,fe+=g*Le,se+=g*pe,ee+=g*Ue,le+=g*$e,ge+=g*ue,re+=g*Te,ye+=g*Ne,we+=g*be,ne+=g*qe,g=B[7],De+=g*Re,me+=g*Oe,ie+=g*ce,de+=g*Ce,he+=g*Pe,te+=g*oe,fe+=g*Fe,se+=g*Le,ee+=g*pe,le+=g*Ue,ge+=g*$e,re+=g*ue,ye+=g*Te,we+=g*Ne,ne+=g*be,xe+=g*qe,g=B[8],me+=g*Re,ie+=g*Oe,de+=g*ce,he+=g*Ce,te+=g*Pe,fe+=g*oe,se+=g*Fe,ee+=g*Le,le+=g*pe,ge+=g*Ue,re+=g*$e,ye+=g*ue,we+=g*Te,ne+=g*Ne,xe+=g*be,Ae+=g*qe,g=B[9],ie+=g*Re,de+=g*Oe,he+=g*ce,te+=g*Ce,fe+=g*Pe,se+=g*oe,ee+=g*Fe,le+=g*Le,ge+=g*pe,re+=g*Ue,ye+=g*$e,we+=g*ue,ne+=g*Te,xe+=g*Ne,Ae+=g*be,Me+=g*qe,g=B[10],de+=g*Re,he+=g*Oe,te+=g*ce,fe+=g*Ce,se+=g*Pe,ee+=g*oe,le+=g*Fe,ge+=g*Le,re+=g*pe,ye+=g*Ue,we+=g*$e,ne+=g*ue,xe+=g*Te,Ae+=g*Ne,Me+=g*be,Ke+=g*qe,g=B[11],he+=g*Re,te+=g*Oe,fe+=g*ce,se+=g*Ce,ee+=g*Pe,le+=g*oe,ge+=g*Fe,re+=g*Le,ye+=g*pe,we+=g*Ue,ne+=g*$e,xe+=g*ue,Ae+=g*Te,Me+=g*Ne,Ke+=g*be,He+=g*qe,g=B[12],te+=g*Re,fe+=g*Oe,se+=g*ce,ee+=g*Ce,le+=g*Pe,ge+=g*oe,re+=g*Fe,ye+=g*Le,we+=g*pe,ne+=g*Ue,xe+=g*$e,Ae+=g*ue,Me+=g*Te,Ke+=g*Ne,He+=g*be,Ee+=g*qe,g=B[13],fe+=g*Re,se+=g*Oe,ee+=g*ce,le+=g*Ce,ge+=g*Pe,re+=g*oe,ye+=g*Fe,we+=g*Le,ne+=g*pe,xe+=g*Ue,Ae+=g*$e,Me+=g*ue,Ke+=g*Te,He+=g*Ne,Ee+=g*be,je+=g*qe,g=B[14],se+=g*Re,ee+=g*Oe,le+=g*ce,ge+=g*Ce,re+=g*Pe,ye+=g*oe,we+=g*Fe,ne+=g*Le,xe+=g*pe,Ae+=g*Ue,Me+=g*$e,Ke+=g*ue,He+=g*Te,Ee+=g*Ne,je+=g*be,Ve+=g*qe,g=B[15],ee+=g*Re,le+=g*Oe,ge+=g*ce,re+=g*Ce,ye+=g*Pe,we+=g*oe,ne+=g*Fe,xe+=g*Le,Ae+=g*pe,Me+=g*Ue,Ke+=g*$e,He+=g*ue,Ee+=g*Te,je+=g*Ne,Ve+=g*be,Ie+=g*qe,j+=38*le,J+=38*ge,W+=38*re,X+=38*ye,ve+=38*we,_e+=38*ne,ae+=38*xe,De+=38*Ae,me+=38*Me,ie+=38*Ke,de+=38*He,he+=38*Ee,te+=38*je,fe+=38*Ve,se+=38*Ie,T=1,g=j+T+65535,T=Math.floor(g/65536),j=g-T*65536,g=J+T+65535,T=Math.floor(g/65536),J=g-T*65536,g=W+T+65535,T=Math.floor(g/65536),W=g-T*65536,g=X+T+65535,T=Math.floor(g/65536),X=g-T*65536,g=ve+T+65535,T=Math.floor(g/65536),ve=g-T*65536,g=_e+T+65535,T=Math.floor(g/65536),_e=g-T*65536,g=ae+T+65535,T=Math.floor(g/65536),ae=g-T*65536,g=De+T+65535,T=Math.floor(g/65536),De=g-T*65536,g=me+T+65535,T=Math.floor(g/65536),me=g-T*65536,g=ie+T+65535,T=Math.floor(g/65536),ie=g-T*65536,g=de+T+65535,T=Math.floor(g/65536),de=g-T*65536,g=he+T+65535,T=Math.floor(g/65536),he=g-T*65536,g=te+T+65535,T=Math.floor(g/65536),te=g-T*65536,g=fe+T+65535,T=Math.floor(g/65536),fe=g-T*65536,g=se+T+65535,T=Math.floor(g/65536),se=g-T*65536,g=ee+T+65535,T=Math.floor(g/65536),ee=g-T*65536,j+=T-1+37*(T-1),T=1,g=j+T+65535,T=Math.floor(g/65536),j=g-T*65536,g=J+T+65535,T=Math.floor(g/65536),J=g-T*65536,g=W+T+65535,T=Math.floor(g/65536),W=g-T*65536,g=X+T+65535,T=Math.floor(g/65536),X=g-T*65536,g=ve+T+65535,T=Math.floor(g/65536),ve=g-T*65536,g=_e+T+65535,T=Math.floor(g/65536),_e=g-T*65536,g=ae+T+65535,T=Math.floor(g/65536),ae=g-T*65536,g=De+T+65535,T=Math.floor(g/65536),De=g-T*65536,g=me+T+65535,T=Math.floor(g/65536),me=g-T*65536,g=ie+T+65535,T=Math.floor(g/65536),ie=g-T*65536,g=de+T+65535,T=Math.floor(g/65536),de=g-T*65536,g=he+T+65535,T=Math.floor(g/65536),he=g-T*65536,g=te+T+65535,T=Math.floor(g/65536),te=g-T*65536,g=fe+T+65535,T=Math.floor(g/65536),fe=g-T*65536,g=se+T+65535,T=Math.floor(g/65536),se=g-T*65536,g=ee+T+65535,T=Math.floor(g/65536),ee=g-T*65536,j+=T-1+37*(T-1),C[0]=j,C[1]=J,C[2]=W,C[3]=X,C[4]=ve,C[5]=_e,C[6]=ae,C[7]=De,C[8]=me,C[9]=ie,C[10]=de,C[11]=he,C[12]=te,C[13]=fe,C[14]=se,C[15]=ee}function R(C,B){y(C,B,B)}function V(C,B){const P=n();let g;for(g=0;g<16;g++)P[g]=B[g];for(g=253;g>=0;g--)R(P,P),g!==2&&g!==4&&y(P,P,B);for(g=0;g<16;g++)C[g]=P[g]}function Q(C,B){const P=n();let g;for(g=0;g<16;g++)P[g]=B[g];for(g=250;g>=0;g--)R(P,P),g!==1&&y(P,P,B);for(g=0;g<16;g++)C[g]=P[g]}function O(C,B){const P=n(),g=n(),T=n(),j=n(),J=n(),W=n(),X=n(),ve=n(),_e=n();q(P,C[1],C[0]),q(_e,B[1],B[0]),y(P,P,_e),$(g,C[0],C[1]),$(_e,B[0],B[1]),y(g,g,_e),y(T,C[3],B[3]),y(T,T,p),y(j,C[2],B[2]),$(j,j,j),q(J,g,P),q(W,j,T),$(X,j,T),$(ve,g,P),y(C[0],J,W),y(C[1],ve,X),y(C[2],X,W),y(C[3],J,ve)}function d(C,B,P){for(let g=0;g<4;g++)U(C[g],B[g],P)}function u(C,B){const P=n(),g=n(),T=n();V(T,B[2]),y(P,B[0],T),y(g,B[1],T),z(C,g),C[31]^=K(P)<<7}function a(C,B,P){D(C[0],o),D(C[1],h),D(C[2],h),D(C[3],o);for(let g=255;g>=0;--g){const T=P[g/8|0]>>(g&7)&1;d(C,B,T),O(B,C),O(C,C),d(C,B,T)}}function f(C,B){const P=[n(),n(),n(),n()];D(P[0],w),D(P[1],M),D(P[2],h),y(P[3],w,M),a(C,P,B)}function b(C){if(C.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const B=(0,r.hash)(C);B[0]&=248,B[31]&=127,B[31]|=64;const P=new Uint8Array(32),g=[n(),n(),n(),n()];f(g,B),u(P,g);const T=new Uint8Array(64);return T.set(C),T.set(P,32),{publicKey:P,secretKey:T}}t.generateKeyPairFromSeed=b;function x(C){const B=(0,e.randomBytes)(32,C),P=b(B);return(0,i.wipe)(B),P}t.generateKeyPair=x;function A(C){if(C.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(C.subarray(32))}t.extractPublicKeyFromSecretKey=A;const _=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function c(C,B){let P,g,T,j;for(g=63;g>=32;--g){for(P=0,T=g-32,j=g-12;T<j;++T)B[T]+=P-16*B[g]*_[T-(g-32)],P=Math.floor((B[T]+128)/256),B[T]-=P*256;B[T]+=P,B[g]=0}for(P=0,T=0;T<32;T++)B[T]+=P-(B[31]>>4)*_[T],P=B[T]>>8,B[T]&=255;for(T=0;T<32;T++)B[T]-=P*_[T];for(g=0;g<32;g++)B[g+1]+=B[g]>>8,C[g]=B[g]&255}function m(C){const B=new Float64Array(64);for(let P=0;P<64;P++)B[P]=C[P];for(let P=0;P<64;P++)C[P]=0;c(C,B)}function v(C,B){const P=new Float64Array(64),g=[n(),n(),n(),n()],T=(0,r.hash)(C.subarray(0,32));T[0]&=248,T[31]&=127,T[31]|=64;const j=new Uint8Array(64);j.set(T.subarray(32),32);const J=new r.SHA512;J.update(j.subarray(32)),J.update(B);const W=J.digest();J.clean(),m(W),f(g,W),u(j,g),J.reset(),J.update(j.subarray(0,32)),J.update(C.subarray(32)),J.update(B);const X=J.digest();m(X);for(let ve=0;ve<32;ve++)P[ve]=W[ve];for(let ve=0;ve<32;ve++)for(let _e=0;_e<32;_e++)P[ve+_e]+=X[ve]*T[_e];return c(j.subarray(32),P),j}t.sign=v;function S(C,B){const P=n(),g=n(),T=n(),j=n(),J=n(),W=n(),X=n();return D(C[2],h),F(C[1],B),R(T,C[1]),y(j,T,l),q(T,T,C[2]),$(j,C[2],j),R(J,j),R(W,J),y(X,W,J),y(P,X,T),y(P,P,j),Q(P,P),y(P,P,T),y(P,P,j),y(P,P,j),y(C[0],P,j),R(g,C[0]),y(g,g,j),L(g,T)&&y(C[0],C[0],I),R(g,C[0]),y(g,g,j),L(g,T)?-1:(K(C[0])===B[31]>>7&&q(C[0],o,C[0]),y(C[3],C[0],C[1]),0)}function G(C,B,P){const g=new Uint8Array(32),T=[n(),n(),n(),n()],j=[n(),n(),n(),n()];if(P.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(S(j,C))return!1;const J=new r.SHA512;J.update(P.subarray(0,32)),J.update(C),J.update(B);const W=J.digest();return m(W),a(T,j,W),f(j,P.subarray(32)),O(T,j),u(g,T),!H(P,g)}t.verify=G;function E(C){let B=[n(),n(),n(),n()];if(S(B,C))throw new Error("Ed25519: invalid public key");let P=n(),g=n(),T=B[1];$(P,h,T),q(g,h,T),V(g,g),y(P,P,g);let j=new Uint8Array(32);return z(j,P),j}t.convertPublicKeyToX25519=E;function k(C){const B=(0,r.hash)(C.subarray(0,32));B[0]&=248,B[31]&=127,B[31]|=64;const P=new Uint8Array(B.subarray(0,32));return(0,i.wipe)(B),P}t.convertSecretKeyToX25519=k}(AO);const MO="ReactNative",Ds={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"};function M2(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function EO(){return!wc()&&!!_c()&&navigator.product===MO}function SO(){return!M2()&&!!_c()&&!!wc()}function hu(){return EO()?Ds.reactNative:M2()?Ds.node:SO()?Ds.browser:Ds.unknown}class DO extends Ab{constructor(e){super(e),this.engine=e,this.canFulfil=async r=>{if(console.log("canFulfil",r),!this.canFulfilHandler)throw new Error(`canFulfilHandler not found for environment: '${hu()}'`);const{transaction:i}=r,n=await this.canFulfilHandler({transaction:i,projectId:this.projectId});switch(console.log("canFulfil processing result..",n),n.status){case Rs.error:throw new Error(n.reason);case Rs.not_required:return{status:Rs.not_required};case Rs.available:return{status:Rs.available,data:{fulfilmentId:n.data.orchestrationId,checkIn:n.data.checkIn,transactions:n.data.transactions,funding:n.data.metadata.fundingFrom}};default:throw new Error(`Invalid canFulfil status: ${JSON.stringify(n)}`)}},this.fulfilmentStatus=async r=>{if(!this.fulfilmentStatusHandler)throw new Error(`fulfilmentStatusHandler not found for environment: '${hu()}'`);const{fulfilmentId:i}=r;console.log("fulfilmentStatus",r);const n=await this.fulfilmentStatusHandler({orchestrationId:i,projectId:this.projectId});if(n.status===Au.error)throw new Error(n.reason);return console.log("fulfilmentStatus result",n),n},this.loadHandlers=()=>{switch(hu()){case Ds.reactNative:return this.ReactNative();case Ds.browser:return this.Browser();case Ds.node:return this.Node()}},this.ReactNative=()=>{const r=global==null?void 0:global.yttrium;if(!r){console.warn("React Native Yttrium not found in global scope");return}this.canFulfilHandler=r.checkRoute,this.fulfilmentStatusHandler=r.checkStatus},this.Browser=()=>{console.warn("Yttrium not available in browser environment")},this.Node=()=>{const r=global==null?void 0:global.yttrium;r||console.warn("Yttrium not available in node environment"),this.canFulfilHandler=r.checkRoute,this.fulfilmentStatusHandler=r.checkStatus},this.loadHandlers(),this.projectId=this.engine.client.core.projectId||""}}var IO=Object.defineProperty,NO=Object.defineProperties,OO=Object.getOwnPropertyDescriptors,E2=Object.getOwnPropertySymbols,RO=Object.prototype.hasOwnProperty,CO=Object.prototype.propertyIsEnumerable,S2=(t,e,r)=>e in t?IO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,PO=(t,e)=>{for(var r in e||(e={}))RO.call(e,r)&&S2(t,r,e[r]);if(E2)for(var r of E2(e))CO.call(e,r)&&S2(t,r,e[r]);return t},TO=(t,e)=>NO(t,OO(e));class BO extends xb{constructor(e){super(e),this.init=async()=>{this.signClient=await gM.init({core:this.client.core,metadata:this.client.metadata,signConfig:this.client.signConfig})},this.pair=async r=>{await this.client.core.pairing.pair(r)},this.approveSession=async r=>{const{topic:i,acknowledged:n}=await this.signClient.approve(TO(PO({},r),{id:r.id,namespaces:r.namespaces,sessionProperties:r.sessionProperties,sessionConfig:r.sessionConfig}));return await n(),this.signClient.session.get(i)},this.rejectSession=async r=>await this.signClient.reject(r),this.updateSession=async r=>await this.signClient.update(r),this.extendSession=async r=>await this.signClient.extend(r),this.respondSessionRequest=async r=>await this.signClient.respond(r),this.disconnectSession=async r=>await this.signClient.disconnect(r),this.emitSessionEvent=async r=>await this.signClient.emit(r),this.getActiveSessions=()=>this.signClient.session.getAll().reduce((r,i)=>(r[i.topic]=i,r),{}),this.getPendingSessionProposals=()=>this.signClient.proposal.getAll(),this.getPendingSessionRequests=()=>this.signClient.getPendingSessionRequests(),this.approveSessionAuthenticate=async r=>await this.signClient.approveSessionAuthenticate(r),this.rejectSessionAuthenticate=async r=>await this.signClient.rejectSessionAuthenticate(r),this.formatAuthMessage=r=>this.signClient.formatAuthMessage(r),this.registerDeviceToken=r=>this.client.core.echoClient.registerDeviceToken(r),this.on=(r,i)=>(this.setEvent(r,"off"),this.setEvent(r,"on"),this.client.events.on(r,i)),this.once=(r,i)=>(this.setEvent(r,"off"),this.setEvent(r,"once"),this.client.events.once(r,i)),this.off=(r,i)=>(this.setEvent(r,"off"),this.client.events.off(r,i)),this.removeListener=(r,i)=>(this.setEvent(r,"removeListener"),this.client.events.removeListener(r,i)),this.canFulfil=async r=>await this.chainAbstraction.canFulfil(r),this.fulfilmentStatus=async r=>await this.chainAbstraction.fulfilmentStatus(r),this.onSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onSessionProposal=r=>{this.client.events.emit("session_proposal",r)},this.onSessionDelete=r=>{this.client.events.emit("session_delete",r)},this.onProposalExpire=r=>{this.client.events.emit("proposal_expire",r)},this.onSessionRequestExpire=r=>{this.client.events.emit("session_request_expire",r)},this.onSessionRequestAuthenticate=r=>{this.client.events.emit("session_authenticate",r)},this.setEvent=(r,i)=>{switch(r){case"session_request":this.signClient.events[i]("session_request",this.onSessionRequest);break;case"session_proposal":this.signClient.events[i]("session_proposal",this.onSessionProposal);break;case"session_delete":this.signClient.events[i]("session_delete",this.onSessionDelete);break;case"proposal_expire":this.signClient.events[i]("proposal_expire",this.onProposalExpire);break;case"session_request_expire":this.signClient.events[i]("session_request_expire",this.onSessionRequestExpire);break;case"session_authenticate":this.signClient.events[i]("session_authenticate",this.onSessionRequestAuthenticate);break}},this.signClient={},this.chainAbstraction=new DO(this)}}const FO={decryptMessage:async t=>{const e={core:new oc({storageOptions:t.storageOptions,storage:t.storage})};await e.core.crypto.init();const r=e.core.crypto.decode(t.topic,t.encryptedMessage);return e.core=null,r},getMetadata:async t=>{const e={core:new oc({storageOptions:t.storageOptions,storage:t.storage}),sessionStore:null};e.sessionStore=new vM(e.core,e.core.logger),await e.sessionStore.init();const r=e.sessionStore.get(t.topic),i=r?.peer.metadata;return e.core=null,e.sessionStore=null,i}},D2=class extends _b{constructor(t){super(t),this.events=new Nf.exports,this.on=(e,r)=>this.engine.on(e,r),this.once=(e,r)=>this.engine.once(e,r),this.off=(e,r)=>this.engine.off(e,r),this.removeListener=(e,r)=>this.engine.removeListener(e,r),this.pair=async e=>{try{return await this.engine.pair(e)}catch(r){throw this.logger.error(r.message),r}},this.approveSession=async e=>{try{return await this.engine.approveSession(e)}catch(r){throw this.logger.error(r.message),r}},this.rejectSession=async e=>{try{return await this.engine.rejectSession(e)}catch(r){throw this.logger.error(r.message),r}},this.updateSession=async e=>{try{return await this.engine.updateSession(e)}catch(r){throw this.logger.error(r.message),r}},this.extendSession=async e=>{try{return await this.engine.extendSession(e)}catch(r){throw this.logger.error(r.message),r}},this.respondSessionRequest=async e=>{try{return await this.engine.respondSessionRequest(e)}catch(r){throw this.logger.error(r.message),r}},this.disconnectSession=async e=>{try{return await this.engine.disconnectSession(e)}catch(r){throw this.logger.error(r.message),r}},this.emitSessionEvent=async e=>{try{return await this.engine.emitSessionEvent(e)}catch(r){throw this.logger.error(r.message),r}},this.getActiveSessions=()=>{try{return this.engine.getActiveSessions()}catch(e){throw this.logger.error(e.message),e}},this.getPendingSessionProposals=()=>{try{return this.engine.getPendingSessionProposals()}catch(e){throw this.logger.error(e.message),e}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}},this.registerDeviceToken=e=>{try{return this.engine.registerDeviceToken(e)}catch(r){throw this.logger.error(r.message),r}},this.approveSessionAuthenticate=e=>{try{return this.engine.approveSessionAuthenticate(e)}catch(r){throw this.logger.error(r.message),r}},this.rejectSessionAuthenticate=e=>{try{return this.engine.rejectSessionAuthenticate(e)}catch(r){throw this.logger.error(r.message),r}},this.formatAuthMessage=e=>{try{return this.engine.formatAuthMessage(e)}catch(r){throw this.logger.error(r.message),r}},this.canFulfil=async e=>{try{return await this.engine.canFulfil(e)}catch(r){throw this.logger.error(r.message),r}},this.fulfilmentStatus=async e=>{try{return await this.engine.fulfilmentStatus(e)}catch(r){throw this.logger.error(r.message),r}},this.metadata=t.metadata,this.name=t.name||E0,this.signConfig=t.signConfig,this.core=t.core,this.logger=this.core.logger,this.engine=new BO(this)}static async init(t){const e=new D2(t);return await e.initialize(),e}async initialize(){this.logger.trace("Initialized");try{await this.engine.init(),this.logger.info("WalletKit Initialization Success")}catch(t){throw this.logger.info("WalletKit Initialization Failure"),this.logger.error(t.message),t}}};let cu=D2;cu.notifications=FO;const LO=cu;Lt.CAN_FULFIL_STATUS=Rs,Lt.CLIENT_CONTEXT=E0,Lt.CLIENT_STORAGE_OPTIONS=G2,Lt.CLIENT_STORAGE_PREFIX=j2,Lt.FULFILMENT_STATUS=Au,Lt.IChainAbstraction=Ab,Lt.IWalletKit=_b,Lt.IWalletKitEngine=xb,Lt.IWalletKitEvents=mM,Lt.PROTOCOL=xu,Lt.PROTOCOL_VERSION=H2,Lt.REQUEST_CONTEXT=V2,Lt.WalletKit=LO,Lt.default=cu,Object.defineProperty(Lt,"__esModule",{value:!0})});
44
64
  //# sourceMappingURL=index.umd.js.map