vendor: 4,160 bytes, lines 1-2
1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/secp256k1-DHguIJWT.js","assets/index-BHoJv5ng.js","assets/index-DFLhATEZ.css","assets/index-1_77FnWD.js"])))=>i.map(i=>d[i]); 2import{g as Ro,a as oh,_ as ah}from"./index-BHoJv5ng.js";var To={exports:{}},ki=typeof Reflect=="object"?Reflect:null,da=ki&&typeof ki.apply=="function"?ki.apply:function(e,i,r){return Function.prototype.apply.call(e,i,r)},ls;ki&&typeof ki.ownKeys=="function"?ls=ki.ownKeys:Object.getOwnPropertySymbols?ls=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:ls=function(e){return Object.getOwnPropertyNames(e)};function Yd(t){console&&console.warn&&console.warn(t)}var ch=Number.isNaN||function(e){return e!==e};function ie(){ie.init.call(this)}To.exports=ie;To.exports.once=Qd;ie.EventEmitter=ie;ie.prototype._events=void 0;ie.prototype._eventsCount=0;ie.prototype._maxListeners=void 0;var pa=10;function Cs(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ie,"defaultMaxListeners",{enumerable:!0,get:function(){return pa},set:function(t){if(typeof t!="number"||t<0||ch(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");pa=t}});ie.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};ie.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||ch(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 lh(t){return t._maxListeners===void 0?ie.defaultMaxListeners:t._maxListeners}ie.prototype.getMaxListeners=function(){return lh(this)};ie.prototype.emit=function(e){for(var i=[],r=1;r<arguments.length;r++)i.push(arguments[r]);var s=e==="error",n=this._events;if(n!==void 0)s=s&&n.error===void 0;else if(!s)return!1;if(s){var o;if(i.length>0&&(o=i[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=n[e];if(c===void 0)return!1;if(typeof c=="function")da(c,this,i);else for(var l=c.length,h=fh(c,l),r=0;r<l;++r)da(h[r],this,i);return!0};function hh(t,e,i,r){var s,n,o;if(Cs(i),n=t._events,n===void 0?(n=t._events=Object.create(null),t._eventsCount=0):(n.newListener!==void 0&&(t.emit("newListener",e,i.listener?i.listener:i),n=t._events),o=n[e]),o===void 0)o=n[e]=i,++t._eventsCount;else if(typeof o=="function"?o=n[e]=r?[i,o]:[o,i]:r?o.unshift(i):o.push(i),s=lh(t),s>0&&o.length>s&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,Yd(a)}return t}ie.prototype.addListener=function(e,i){return hh(this,e,i,!1)};ie.prototype.on=ie.prototype.addListener;ie.prototype.prependListener=function(e,i){return hh(this,e,i,!0)};function Jd(){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 uh(t,e,i){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:i},s=Jd.bind(r);return s.listener=i,r.wrapFn=s,s}ie.prototype.once=function(e,i){return Cs(i),this.on(e,uh(this,e,i)),this};ie.prototype.prependOnceListener=function(e,i){return Cs(i),this.prependListener(e,uh(this,e,i)),this};ie.prototype.removeListener=function(e,i){var r,s,n,o,a;if(Cs(i),s=this._events,s===void 0)return this;if(r=s[e],r===void 0)return this;if(r===i||r.listener===i)--this._eventsCount===0?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,r.listener||i));else if(typeof r!="function"){for(n=-1,o=r.length-1;o>=0;o--)if(r[o]===i||r[o].listener===i){a=r[o].listener,n=o;break}if(n<0)return this;n===0?r.shift():Zd(r,n),r.length===1&&(s[e]=r[0]),s.removeListener!==void 0&&this.emit
vendor: 13,220 bytes, lines 2-15
2("removeListener",e,a||i)}return this};ie.prototype.off=ie.prototype.removeListener;ie.prototype.removeAllListeners=function(e){var i,r,s;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var n=Object.keys(r),o;for(s=0;s<n.length;++s)o=n[s],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(i=r[e],typeof i=="function")this.removeListener(e,i);else if(i!==void 0)for(s=i.length-1;s>=0;s--)this.removeListener(e,i[s]);return this};function dh(t,e,i){var r=t._events;if(r===void 0)return[];var s=r[e];return s===void 0?[]:typeof s=="function"?i?[s.listener||s]:[s]:i?Xd(s):fh(s,s.length)}ie.prototype.listeners=function(e){return dh(this,e,!0)};ie.prototype.rawListeners=function(e){return dh(this,e,!1)};ie.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):ph.call(t,e)};ie.prototype.listenerCount=ph;function ph(t){var e=this._events;if(e!==void 0){var i=e[t];if(typeof i=="function")return 1;if(i!==void 0)return i.length}return 0}ie.prototype.eventNames=function(){return this._eventsCount>0?ls(this._events):[]};function fh(t,e){for(var i=new Array(e),r=0;r<e;++r)i[r]=t[r];return i}function Zd(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Xd(t){for(var e=new Array(t.length),i=0;i<e.length;++i)e[i]=t[i].listener||t[i];return e}function Qd(t,e){return new Promise(function(i,r){function s(o){t.removeListener(e,n),r(o)}function n(){typeof t.removeListener=="function"&&t.removeListener("error",s),i([].slice.call(arguments))}gh(t,e,n,{once:!0}),e!=="error"&&ep(t,s,{once:!0})})}function ep(t,e,i){typeof t.on=="function"&&gh(t,"error",e,i)}function gh(t,e,i,r){if(typeof t.on=="function")r.once?t.once(e,i):t.on(e,i);else if(typeof t.addEventListener=="function")t.addEventListener(e,function s(n){r.once&&t.removeEventListener(e,s),i(n)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var Je=To.exports;const No=Ro(Je);var fa=function(t,e,i){if(i||arguments.length===2)for(var r=0,s=e.length,n;r<s;r++)(n||!(r in e))&&(n||(n=Array.prototype.slice.call(e,0,r)),n[r]=e[r]);return t.concat(n||Array.prototype.slice.call(e))},tp=function(){function t(e,i,r){this.name=e,this.version=i,this.os=r,this.type="browser"}return t}(),ip=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return t}(),rp=function(){function t(e,i,r,s){this.name=e,this.version=i,this.os=r,this.bot=s,this.type="bot-device"}return t}(),sp=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),np=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),op=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,ap=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,ga=3,cp=[["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",op]],ya=[["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 lp(t){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new np:typeof navigator<"u"?up(navigator.userAgent):pp()}function hp(t){return t!==""&&cp.reduce(function(e,i){var r=i[0],s=i[1];if(e)return e;var n=s.exec(t);return!!n&&[r,n]},!1)}function up(t){var e=hp(t);if(!e)return null;var i=e[0],r=e[1];if(i==="searchbot")return new sp;var s=r[1]&&r[1].split(".").join("_").split("_").slice(0,3);s?s.length<ga&&(s=fa(fa([],s,!0),fp(ga-s.length),!0)):s=[];var n=s.join("."),o=dp(t),a=ap.exec(t);return a&&a[1]?new rp(i,n,o,a[1]):new tp(i,n,o)}function dp(t){for(var e=0,i=ya.length;e<i;e++){var r=ya[e],s=r[0],n=r[1],o=n.exec(t);if(o)return s}return null}function pp(){var t=typeof process<"u"&&process.version;return t?new ip(process.version.slice(1)):null}function fp(t){for(var e=[],i=0;i<t;i++)e.push("0");return e}var L={};/*! ***************************************************************************** 3Copyright (c) Microsoft Corporation. 4 5Permission to use, copy, modify, and/or distribute this software for any 6purpose with or without fee is hereby granted. 7 8THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 9REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 10AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 11INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 12LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 13OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 14PERFORMANCE OF THIS SOFTWARE. 15***************************************************************************** */var Bn=function(t,e){return Bn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)r.hasOwnProperty(s)&&(i[s]=r[s])},Bn(t,e)};function gp(t,e){Bn(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}var kn=function(){return kn=Object.assign||function(e){for(var i,r=1,s=arguments.length;r<s;r++){i=arguments[r];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},kn.apply(this,arguments)};function yp(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(i[r[s]]=t[r[s]]);return i}function mp(t,e,i,r){var s=arguments.length,n=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,i):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(n=(s<3?o(n):s>3?o(e,i,n):o(e,i))||n);return s>3&&n&&Object.defineProperty(e,i,n),n}function wp(t,e){return function(i,r){e(i,r,t)}}function bp(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function vp(t,e,i,r){function s(n){return n instanceof i?n:new i(function(o){o(n)})}return new(i||(i=Promise))(function(n,o){function a(h){try{l(r.next(h))}catch(u){o(u)}}function c(h){try{l(r.throw(h))}catch(u){o(u)}}function l(h){h.done?n(h.value):s(h.value).then(a,c)}l((r=r.apply(t,e||[])).next())})}function _p(t,e){var i={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},r,s,n,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(h){return c([l,h])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,s&&(n=l[0]&2?s.return:l[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,l[1])).done)return n;switch(s=0,n&&(l=[l[0]&2,n.value]),l[0]){case 0:case 1:n=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,s=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(n=i.trys,!(n=n.length>0&&n[n.length-1])&&(l[0]===6||l[0]===2)){i=0;continue}if(l[0]===3&&(!n||l[1]>n[0]&&l[1]<n[3])){i.label=l[1];break}if(l[0]===6&&i.label<n[1]){i.label=n[1],n=l;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(l);break}n[2]&&i.ops.pop(),i.trys.pop();continue}l=e.call(t,i)}catch(h){l=[6,h],s=0}finally{r=n=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Ep(t,e,i,r){r===void 0&&(r=i),t[r]=e[i]}function Ip(t,e){for(var i in t)i!=="default"&&!e.hasOwnProperty(i)&&(e[i]=t[i])}function Fn(t){var e=typeof Symbol=="function"&&Symbol.iterator,i=e&&t[e],r=0;if(i)return i.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function yh(t,e){var i=typeof Symbol=="function"&&t[Symbol.iterator];if(!i)return t;var r=i.call(t),s,n=[],o;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)n.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return n}function Sp(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(yh(arguments[e]));return t}function Op(){for(var t=0,e=0,i=arguments.length;e<i;e++)t+=arguments[e].length;for(var r=Array(t),s=0,e=0;e<i;e++)for(var n=arguments[e],o=0,a=n.length;o<a;o++,s++)r[s]=n[o];return r}function Er(t){return this instanceof Er?(this.v=t,this):new Er(t)}function Pp(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),s,n=[];return s={},o("next"),o("throw"),o("return"),s[Symbol.asyncIterator]=function(){return this},s;function o(d){r[d]&&(s[d]=function(f){return new Promise(function(p,y){n.push([d,f,p,y])>1||a(d,f)})})}function a(d,f){try{c(r[d](f))}catch(p){u(n[0][3],p)}}function c(d){d.value instanceof Er?Promise.resolve(d.value.v).then(l,h):u(n[0][2],d)}function l(d){a("next",d)}function h(d){a("throw",d)}function u(d,f){d(f),n.shift(),n.length&&a(n[0][0],n[0][1])}}function $p(t){var e,i;return e={},r("next"),r("throw",function(s){throw s}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(s,n){e[s]=t[s]?function(o){return(i=!i)?{value:Er(t[s](o)),done:s==="return"}:n?n(o):o}:n}}function Ap(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof Fn=="function"?Fn(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(n){i[n]=t[n]&&function(o){return new Promise(function(a,c){o=t[n](o),s(a,c,o.done,o.value)})}}function s(n,o,a,c){Promise.resolve(c).then(function(l){n({value:l,done:a})},o)}}function xp(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Cp(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var i in t)Object.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e.default=t,e}function Rp(t){return t&&t.__esModule?t:{default:t}}function Tp(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Np(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i}const Lp=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return kn},__asyncDelegator:$p,__asyncGenerator:Pp,__asyncValues:Ap,__await:Er,__awaiter:vp,__classPrivateFieldGet:Tp,__classPrivateFieldSet:Np,__createBinding:Ep,__decorate:mp,__exportStar:Ip,__extends:gp,__generator:_p,__importDefault:Rp,__importStar:C
15p,__makeTemplateObject:xp,__metadata:bp,__param:wp,__read:yh,__rest:yp,__spread:Sp,__spreadArrays:Op,__values:Fn},Symbol.toStringTag,{value:"Module"})),Rs=oh(Lp);var Zs={},rr={},ma;function Dp(){if(ma)return rr;ma=1,Object.defineProperty(rr,"__esModule",{value:!0}),rr.delay=void 0;function t(e){return new Promise(i=>{setTimeout(()=>{i(!0)},e)})}return rr.delay=t,rr}var Kt={},Xs={},Wt={},wa;function jp(){return wa||(wa=1,Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.ONE_THOUSAND=Wt.ONE_HUNDRED=void 0,Wt.ONE_HUNDRED=100,Wt.ONE_THOUSAND=1e3),Wt}var Qs={},ba;function Mp(){return ba||(ba=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}(Qs)),Qs}var va;function mh(){return va||(va=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Rs;e.__exportStar(jp(),t),e.__exportStar(Mp(),t)}(Xs)),Xs}var _a;function Up(){if(_a)return Kt;_a=1,Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.fromMiliseconds=Kt.toMiliseconds=void 0;const t=mh();function e(r){return r*t.ONE_THOUSAND}Kt.toMiliseconds=e;function i(r){return Math.floor(r/t.ONE_THOUSAND)}return Kt.fromMiliseconds=i,Kt}var Ea;function Bp(){return Ea||(Ea=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Rs;e.__exportStar(Dp(),t),e.__exportStar(Up(),t)}(Zs)),Zs}var gi={},Ia;function kp(){if(Ia)return gi;Ia=1,Object.defineProperty(gi,"__esModule",{value:!0}),gi.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(i){if(this.timestamps.has(i))throw new Error(`Watch already started for label: ${i}`);this.timestamps.set(i,{started:Date.now()})}stop(i){const r=this.get(i);if(typeof r.elapsed<"u")throw new Error(`Watch already stopped for label: ${i}`);const s=Date.now()-r.started;this.timestamps.set(i,{started:r.started,elapsed:s})}get(i){const r=this.timestamps.get(i);if(typeof r>"u")throw new Error(`No timestamp found for label: ${i}`);return r}elapsed(i){const r=this.get(i);return r.elapsed||Date.now()-r.started}}return gi.Watch=t,gi.default=t,gi}var en={},sr={},Sa;function Fp(){if(Sa)return sr;Sa=1,Object.defineProperty(sr,"__esModule",{value:!0}),sr.IWatch=void 0;class t{}return sr.IWatch=t,sr}var Oa;function qp(){return Oa||(Oa=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Rs.__exportStar(Fp(),t)}(en)),en}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Rs;e.__exportStar(Bp(),t),e.__exportStar(kp(),t),e.__exportStar(qp(),t),e.__exportStar(mh(),t)})(L);var ae={};Object.defineProperty(ae,"__esModule",{value:!0});ae.getLocalStorage=ae.getLocalStorageOrThrow=ae.getCrypto=ae.getCryptoOrThrow=wh=ae.getLocation=ae.getLocationOrThrow=Lo=ae.getNavigator=ae.getNavigatorOrThrow=Nr=ae.getDocument=ae.getDocumentOrThrow=ae.getFromWindowOrThrow=ae.getFromWindow=void 0;function li(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}ae.getFromWindow=li;function Yi(t){const e=li(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}ae.getFromWindowOrThrow=Yi;function zp(){return Yi("document")}ae.getDocumentOrThrow=zp;function Vp(){return li("document")}var Nr=ae.getDocument=Vp;function Hp(){return Yi("navigator")}ae.getNavigatorOrThrow=Hp;function Kp(){return li("navigator")}var Lo=ae.getNavigator=Kp;function Wp(){return Yi("location")}ae.getLocationOrThrow=Wp;function Gp(){return li("location")}var wh=ae.getLocation=Gp;function Yp(){return Yi("crypto")}ae.getCryptoOrThrow=Yp;function Jp(){return li("crypto")}ae.getCrypto=Jp;function Zp(){return Yi("localStorage")}ae.getLocalStorageOrThrow=Zp;function Xp(){return li("localStorage")}ae.getLocalStorage=Xp;var Do={};Object.defineProperty(Do,"__esModule",{value:!0});var bh=Do.getWindowMetadata=void 0;const Pa=ae;function Qp(){let t,e;
15try{t=Pa.getDocumentOrThrow(),e=Pa.getLocationOrThrow()}catch{return null}function i(){const u=t.getElementsByTagName("link"),d=[];for(let f=0;f<u.length;f++){const p=u[f],y=p.getAttribute("rel");if(y&&y.toLowerCase().indexOf("icon")>-1){const w=p.getAttribute("href");if(w)if(w.toLowerCase().indexOf("https:")===-1&&w.toLowerCase().indexOf("http:")===-1&&w.indexOf("//")!==0){let v=e.protocol+"//"+e.host;if(w.indexOf("/")===0)v+=w;else{const b=e.pathname.split("/");b.pop();const _=b.join("/");v+=_+"/"+w}d.push(v)}else if(w.indexOf("//")===0){const v=e.protocol+w;d.push(v)}else d.push(w)}}return d}function r(...u){const d=t.getElementsByTagName("meta");for(let f=0;f<d.length;f++){const p=d[f],y=["itemprop","property","name"].map(w=>p.getAttribute(w)).filter(w=>w?u.includes(w):!1);if(y.length&&y){const w=p.getAttribute("content");if(w)return w}}return""}function s(){let u=r("name","og:site_name","og:title","twitter:title");return u||(u=t.title),u}function n(){return r("description","og:description","twitter:description","keywords")}const o=s(),a=n(),c=e.origin,l=i();return{description:a,url:c,icons:l,name:o}}bh=Do.getWindowMetadata=Qp;function Ir(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function $a(t){return Ir(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const vh="2.23.2";let nr={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:i})=>e?`${t??"https://viem.sh"}${e}${i?`#${i}`:""}`:void 0,version:`viem@${vh}`};
15class si extends Error{constructor(e,i={}){var a;const r=(()=>{var c;return i.cause instanceof si?i.cause.details:(c=i.cause)!=null&&c.message?i.cause.message:i.details})(),s=i.cause instanceof si&&i.cause.docsPath||i.docsPath,n=(a=nr.getDocsUrl)==null?void 0:a.call(nr,{...i,docsPath:s}),o=[e||"An error occurred.","",...i.metaMessages?[...i.metaMessages,""]:[],...n?[`Docs: ${n}`]:[],...r?[`Details: ${r}`]:[],...nr.version?[`Version: ${nr.version}`]:[]].join(` 16`);super(o,i.cause?{cause:i.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=s,this.metaMessages=i.metaMessages,this.name=i.name??this.name,this.shortMessage=e,this.version=vh}walk(e){return _h(this,e)}}function _h(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?_h(t.cause,e):e?null:t}class Eh extends si{constructor({size:e,targetSize:i,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${i}).`,{name:"SizeExceedsPaddingSizeError"})}}function Ji(t,{dir:e,size:i=32}={}){return typeof t=="string"?ef(t,{dir:e,size:i}):tf(t,{dir:e,size:i})}function ef(t,{dir:e,size:i=32}={}){if(i===null)return t;const r=t.replace("0x","");if(r.length>i*2)throw new Eh({size:Math.ceil(r.length/2),targetSize:i,type:"hex"});return`0x${r[e==="right"?"padEnd":"padStart"](i*2,"0")}`}function tf(t,{dir:e,size:i=32}={}){if(i===null)return t;if(t.length>i)throw new Eh({size:t.length,targetSize:i,type:"bytes"});const r=new Uint8Array(i);for(let s=0;s<i;s++){const n=e==="right";r[n?s:i-s-1]=t[n?s:t.length-s-1]}return r}class rf extends si{constructor({max:e,min:i,signed:r,size:s,value:n}){super(`Number "${n}" is not in safe ${s?`${s*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${i} to ${e})`:`(above ${i})`}`,{name:"IntegerOutOfRangeError"})}}class sf extends si{constructor({givenSize:e,maxSize:i}){super(`Size cannot exceed ${i} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function Zi(t,{size:e}){if($a(t)>e)throw new sf({givenSize:$a(t),maxSize:e})}function qn(t,e={}){const{signed:i}=e;e.size&&Zi(t,{size:e.size});const r=BigInt(t);if(!i)return r;const s=(t.length-2)/2,n=(1n<<BigInt(s)*8n-1n)-1n;return r<=n?r:r-BigInt(`0x${"f".padStart(s*2,"f")}`)-1n}function nf(t,e={}){return Number(qn(t,e))}const of=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function zn(t,e={}){return typeof t=="number"||typeof t=="bigint"?Sh(t,e):typeof t=="string"?lf(t,e):typeof t=="boolean"?af(t,e):Ih(t,e)}function af(t,e={}){const i=`0x${Number(t)}`;return typeof e.size=="number"?(Zi(i,{size:e.size}),Ji(i,{size:e.size})):i}function Ih(t,e={}){let i="";for(let s=0;s<t.length;s++)i+=of[t[s]];const r=`0x${i}`;return typeof e.size=="number"?(Zi(r,{size:e.size}),Ji(r,{dir:"right",size:e.size})):r}function Sh(t,e={}){const{signed:i,size:r}=e,s=BigInt(t);let n;r?i?n=(1n<<BigInt(r)*8n-1n)-1n:n=2n**(BigInt(r)*8n)-1n:typeof t=="number"&&(n=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof n=="bigint"&&i?-n-1n:0;if(n&&s>n||s<o){const c=typeof t=="bigint"?"n":"";throw new rf({max:n?`${n}${c}`:void 0,min:`${o}${c}`,signed:i,size:r,value:`${t}${c}`})}const a=`0x${(i&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?Ji(a,{size:r}):a}const cf=new TextEncoder;function lf(t,e={}){const i=cf.encode(t);return Ih(i,e)}const hf=new TextEncoder;function uf(t,e={}){return typeof t=="number"||typeof t=="bigint"?pf(t,e):typeof t=="boolean"?df(t,e):Ir(t)?Oh(t,e):Ph(t,e)}function df(t,e={}){const i=new Uint8Array(1);return i[0]=Number(t),typeof e.size=="number"?(Zi(i,{size:e.size}),Ji(i,{size:e.size})):i}const St={zero:48,nine:57,A:65,F:70,a:97,f:102};function Aa(t){if(t>=St.zero&&t<=St.nine)return t-St.zero;if(t>=St.A&&t<=St.F)return t-(St.A-10);if(t>=St.a&&t<=St.f)return t-(St.a-10)}function Oh(t,e={}){let i=t;e.size&&(Zi(i,{size:e.size}),i=Ji(i,{dir:"right",size:e.size}));let r=i.slice(2);r.length%2&&(r=`0${r}`);const s=r.length/2,n=new Uint8Array(s);for(let o=0,a=0;o<s;o++){const c=Aa(r.charCodeAt(a++)),l=Aa(r.charCodeAt(a++));if(c===void 0||l===void 0)throw new si(`Invalid byte sequence ("${r[a-2]}${r[a-1]}" in "${r}").`);n[o]=c*16+l}return n}function pf(t,e){const i=Sh(t,e);return Oh(i)}function Ph(t,e={}){const i=hf.encode(t);return typeof e.size=="number"?(Zi(i,{size:e.size}),Ji(i,{dir:"right",size:e.size})):i}function ws(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function ff(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Ts(t,...e){if(!ff(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function D$(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ws(t.outputLen),ws(t.blockLen)}function xa(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function gf(t,e){Ts(t);const i=e.outputLen;if(t.length<i)throw new Error("digestInto() expects output buffer of length at least "+i)}const Wr=BigInt(2**32-1),Ca=BigInt(32);function yf(t,e=!1){return e?{h:Number(t&Wr),l:Number(t>>Ca&Wr)}:{h:Number(t>>Ca&Wr)|0,l:Number(t&Wr)|0}}
16function mf(t,e=!1){let i=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let s=0;s<t.length;s++){const{h:n,l:o}=yf(t[s],e);[i[s],r[s]]=[n,o]}return[i,r]}const wf=(t,e,i)=>t<<i|e>>>32-i,bf=(t,e,i)=>e<<i|t>>>32-i,vf=(t,e,i)=>e<<i-32|t>>>64-i,_f=(t,e,i)=>t<<i-32|e>>>64-i,yi=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ef(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function j$(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function M$(t,e){return t<<32-e|t>>>e}const Ra=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function If(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function Ta(t){for(let e=0;e<t.length;e++)t[e]=If(t[e])}function Sf(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function $h(t){return typeof t=="string"&&(t=Sf(t)),Ts(t),t}function U$(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];Ts(s),e+=s.length}const i=new Uint8Array(e);for(let r=0,s=0;r<t.length;r++){const n=t[r];i.set(n,s),s+=n.length}return i}class Of{clone(){return this._cloneInto()}}function Pf(t){const e=r=>t().update($h(r)).digest(),i=t();return e.outputLen=i.outputLen,e.blockLen=i.blockLen,e.create=()=>t(),e}function B$(t=32){if(yi&&typeof yi.getRandomValues=="function")return yi.getRandomValues(new Uint8Array(t));if(yi&&typeof yi.randomBytes=="function")return yi.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const Ah=[],xh=[],Ch=[],$f=BigInt(0),or=BigInt(1),Af=BigInt(2),xf=BigInt(7),Cf=BigInt(256),Rf=BigInt(113);for(let t=0,e=or,i=1,r=0;t<24;t++){[i,r]=[r,(2*i+3*r)%5],Ah.push(2*(5*r+i)),xh.push((t+1)*(t+2)/2%64);let s=$f;for(let n=0;n<7;n++)e=(e<<or^(e>>xf)*Rf)%Cf,e&Af&&(s^=or<<(or<<BigInt(n))-or);Ch.push(s)}const[Tf,Nf]=mf(Ch,!0),Na=(t,e,i)=>i>32?vf(t,e,i):wf(t,e,i),La=(t,e,i)=>i>32?_f(t,e,i):bf(t,e,i);function Lf(t,e=24){const i=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)i[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,l=i[c],h=i[c+1],u=Na(l,h,1)^i[a],d=La(l,h,1)^i[a+1];for(let f=0;f<50;f+=10)t[o+f]^=u,t[o+f+1]^=d}let s=t[2],n=t[3];for(let o=0;o<24;o++){const a=xh[o],c=Na(s,n,a),l=La(s,n,a),h=Ah[o];s=t[h],n=t[h+1],t[h]=c,t[h+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)i[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~i[(a+2)%10]&i[(a+4)%10]}t[0]^=Tf[r],t[1]^=Nf[r]}i.fill(0)}class jo extends Of{constructor(e,i,r,s=!1,n=24){if(super(),this.blockLen=e,this.suffix=i,this.outputLen=r,this.enableXOF=s,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ws(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Ef(this.state)}keccak(){Ra||Ta(this.state32),Lf(this.state32,this.rounds),Ra||Ta(this.state32),this.posOut=0,this.pos=0}update(e){xa(this);const{blockLen:i,state:r}=this;e=$h(e);const s=e.length;for(let n=0;n<s;){const o=Math.min(i-this.pos,s-n);for(let a=0;a<o;a++)r[this.pos++]^=e[n++];this.pos===i&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:i,pos:r,blockLen:s}=this;e[r]^=i,i&128&&r===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){xa(this,!1),Ts(e),this.finish();const i=this.state,{blockLen:r}=this;for(let s=0,n=e.length;s<n;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,n-s);e.set(i.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return ws(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(gf(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:i,suffix:r,outputLen:s,rounds:n,enableXOF:o}=this;return e||(e=new jo(i,r,s,o,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Df=(t,e,i)=>Pf(()=>new jo(e,t,i)),jf=Df(1,136,256/8);function Rh(t,e){const i=e||"hex",r=jf(Ir(t,{strict:!1})?uf(t):t);return i==="bytes"?r:zn(r)}class Mf extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const i=super.get(e);return super.has(e)&&i!==void 0&&(this.delete(e),super.set(e,i)),i}set(e,i){if(super.set(e,i),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const tn=new Mf(8192);function Uf(t,e){if(tn.has(`${t}.${e}`))return tn.get(`${t}.${e}`);const i=t.substring(2).toLowerCase(),r=Rh(Ph(i),"bytes"),s=i.split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&s[o]&&(s[o]=s[o].toUpperCase()),(r[o>>1]&15)>=8&&s[o+1]&&(s[o+1]=s[o+1].toUpperCase());const n=`0x${s.join("")}`;return tn.set(`${t}.${e}`,n),n}function Bf(t){const e=Rh(`0x${t.substring(4)}`).substring(26);return Uf(`0x${e}`)}async function kf({hash:t,signature:e}){const i=Ir(t)?t:zn(t),{secp256k1:r}=await ah(async()=>{const{secp256k1:o}=await import("./secp256k1-DHguIJWT.js");return{secp256k1:o}},__vite__mapDeps([0,1,2]));return`0x${(()=>
16{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:h,v:u,yParity:d}=e,f=Number(d??u),p=Da(f);return new r.Signature(qn(l),qn(h)).addRecoveryBit(p)}const o=Ir(e)?e:zn(e),a=nf(`0x${o.slice(130)}`),c=Da(a);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(i.substring(2)).toHex(!1)}`}function Da(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function Ff({hash:t,signature:e}){return Bf(await kf({hash:t,signature:e}))}function qf(t){if(t.length>=255)throw new TypeError("Alphabet too long");const e=new Uint8Array(256);for(let l=0;l<e.length;l++)e[l]=255;for(let l=0;l<t.length;l++){const h=t.charAt(l),u=h.charCodeAt(0);if(e[u]!==255)throw new TypeError(h+" is ambiguous");e[u]=l}const i=t.length,r=t.charAt(0),s=Math.log(i)/Math.log(256),n=Math.log(256)/Math.log(i);function o(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";let h=0,u=0,d=0;const f=l.length;for(;d!==f&&l[d]===0;)d++,h++;const p=(f-d)*n+1>>>0,y=new Uint8Array(p);for(;d!==f;){let b=l[d],_=0;for(let I=p-1;(b!==0||_<u)&&I!==-1;I--,_++)b+=256*y[I]>>>0,y[I]=b%i>>>0,b=b/i>>>0;if(b!==0)throw new Error("Non-zero carry");u=_,d++}let w=p-u;for(;w!==p&&y[w]===0;)w++;let v=r.repeat(h);for(;w<p;++w)v+=t.charAt(y[w]);return v}function a(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;let h=0,u=0,d=0;for(;l[h]===r;)u++,h++;const f=(l.length-h)*s+1>>>0,p=new Uint8Array(f);for(;h<l.length;){const b=l.charCodeAt(h);if(b>255)return;let _=e[b];if(_===255)return;let I=0;for(let A=f-1;(_!==0||I<d)&&A!==-1;A--,I++)_+=i*p[A]>>>0,p[A]=_%256>>>0,_=_/256>>>0;if(_!==0)throw new Error("Non-zero carry");d=I,h++}let y=f-d;for(;y!==f&&p[y]===0;)y++;const w=new Uint8Array(u+(f-y));let v=u;for(;y!==f;)w[v++]=p[y++];return w}function c(l){const h=a(l);if(h)return h;throw new Error("Non-base"+i+" character")}return{encode:o,decodeUnsafe:a,decode:c}}var zf="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const Vf=qf(zf),Hf=t=>JSON.stringify(t,(e,i)=>typeof i=="bigint"?i.toString()+"n":i),Kf=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,i=t.replace(e,'$1"$2n"$3');return JSON.parse(i,(r,s)=>typeof s=="string"&&s.match(/^\d+n$/)?BigInt(s.substring(0,s.length-1)):s)};function ni(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return Kf(t)}catch{return t}}function Dt(t){return typeof t=="string"?t:Hf(t)||""}function Wf(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Th(t,...e){if(!Wf(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function ja(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Gf(t,e){Th(t);const i=e.outputLen;if(t.length<i)throw new Error("digestInto() expects output buffer of length at least "+i)}const mi=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const rn=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);function Yf(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function Nh(t){return typeof t=="string"&&(t=Yf(t)),Th(t),t}let Jf=class{clone(){return this._cloneInto()}};function Zf(t){const e=r=>t().update(Nh(r)).digest(),i=t();return e.outputLen=i.outputLen,e.blockLen=i.blockLen,e.create=()=>t(),e}function Lh(t=32){if(mi&&typeof mi.getRandomValues=="function")return mi.getRandomValues(new Uint8Array(t));if(mi&&typeof mi.randomBytes=="function")return mi.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}function Xf(t,e,i,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,i,r);const s=BigInt(32),n=BigInt(4294967295),o=Number(i>>s&n),a=Number(i&n),c=r?4:0,l=r?0:4;t.setUint32(e+c,o,r),t.setUint32(e+l,a,r)}
vendor: 3,604 bytes, line 16
16let Qf=class extends Jf{constructor(e,i,r,s){super(),this.blockLen=e,this.outputLen=i,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=rn(this.buffer)}update(e){ja(this);const{view:i,buffer:r,blockLen:s}=this;e=Nh(e);const n=e.length;for(let o=0;o<n;){const a=Math.min(s-this.pos,n-o);if(a===s){const c=rn(e);for(;s<=n-o;o+=s)this.process(c,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(i,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){ja(this),Gf(e,this),this.finished=!0;const{buffer:i,view:r,blockLen:s,isLE:n}=this;let{pos:o}=this;i[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(r,0),o=0);for(let u=o;u<s;u++)i[u]=0;Xf(r,s-8,BigInt(this.length*8),n),this.process(r,0);const a=rn(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)a.setUint32(4*u,h[u],n)}digest(){const{buffer:e,outputLen:i}=this;this.digestInto(e);const r=e.slice(0,i);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:i,buffer:r,length:s,finished:n,destroyed:o,pos:a}=this;return e.length=s,e.pos=a,e.finished=n,e.destroyed=o,s%i&&e.buffer.set(r),e}};const Gr=BigInt(2**32-1),Vn=BigInt(32);function Dh(t,e=!1){return e?{h:Number(t&Gr),l:Number(t>>Vn&Gr)}:{h:Number(t>>Vn&Gr)|0,l:Number(t&Gr)|0}}function eg(t,e=!1){let i=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let s=0;s<t.length;s++){const{h:n,l:o}=Dh(t[s],e);[i[s],r[s]]=[n,o]}return[i,r]}const tg=(t,e)=>BigInt(t>>>0)<<Vn|BigInt(e>>>0),ig=(t,e,i)=>t>>>i,rg=(t,e,i)=>t<<32-i|e>>>i,sg=(t,e,i)=>t>>>i|e<<32-i,ng=(t,e,i)=>t<<32-i|e>>>i,og=(t,e,i)=>t<<64-i|e>>>i-32,ag=(t,e,i)=>t>>>i-32|e<<64-i,cg=(t,e)=>e,lg=(t,e)=>t,hg=(t,e,i)=>t<<i|e>>>32-i,ug=(t,e,i)=>e<<i|t>>>32-i,dg=(t,e,i)=>e<<i-32|t>>>64-i,pg=(t,e,i)=>t<<i-32|e>>>64-i;function fg(t,e,i,r){const s=(e>>>0)+(r>>>0);return{h:t+i+(s/2**32|0)|0,l:s|0}}const gg=(t,e,i)=>(t>>>0)+(e>>>0)+(i>>>0),yg=(t,e,i,r)=>e+i+r+(t/2**32|0)|0,mg=(t,e,i,r)=>(t>>>0)+(e>>>0)+(i>>>0)+(r>>>0),wg=(t,e,i,r,s)=>e+i+r+s+(t/2**32|0)|0,bg=(t,e,i,r,s)=>(t>>>0)+(e>>>0)+(i>>>0)+(r>>>0)+(s>>>0),vg=(t,e,i,r,s,n)=>e+i+r+s+n+(t/2**32|0)|0,H={fromBig:Dh,split:eg,toBig:tg,shrSH:ig,shrSL:rg,rotrSH:sg,rotrSL:ng,rotrBH:og,rotrBL:ag,rotr32H:cg,rotr32L:lg,rotlSH:hg,rotlSL:ug,rotlBH:dg,rotlBL:pg,add:fg,add3L:gg,add3H:yg,add4L:mg,add4H:wg,add5H:vg,add5L:bg},[_g,Eg]=H.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
165771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),jt=new Uint32Array(80),Mt=new Uint32Array(80);let Ig=class extends Qf{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:i,Bh:r,Bl:s,Ch:n,Cl:o,Dh:a,Dl:c,Eh:l,El:h,Fh:u,Fl:d,Gh:f,Gl:p,Hh:y,Hl:w}=this;return[e,i,r,s,n,o,a,c,l,h,u,d,f,p,y,w]}set(e,i,r,s,n,o,a,c,l,h,u,d,f,p,y,w){this.Ah=e|0,this.Al=i|0,this.Bh=r|0,this.Bl=s|0,this.Ch=n|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=h|0,this.Fh=u|0,this.Fl=d|0,this.Gh=f|0,this.Gl=p|0,this.Hh=y|0,this.Hl=w|0}process(e,i){for(let _=0;_<16;_++,i+=4)jt[_]=e.getUint32(i),Mt[_]=e.getUint32(i+=4);for(let _=16;_<80;_++){const I=jt[_-15]|0,A=Mt[_-15]|0,x=H.rotrSH(I,A,1)^H.rotrSH(I,A,8)^H.shrSH(I,A,7),$=H.rotrSL(I,A,1)^H.rotrSL(I,A,8)^H.shrSL(I,A,7),R=jt[_-2]|0,O=Mt[_-2]|0,F=H.rotrSH(R,O,19)^H.rotrBH(R,O,61)^H.shrSH(R,O,6),M=H.rotrSL(R,O,19)^H.rotrBL(R,O,61)^H.shrSL(R,O,6),j=H.add4L($,M,Mt[_-7],Mt[_-16]),q=H.add4H(j,x,F,jt[_-7],jt[_-16]);jt[_]=q|0,Mt[_]=j|0}let{Ah:r,Al:s,Bh:n,Bl:o,Ch:a,Cl:c,Dh:l,Dl:h,Eh:u,El:d,Fh:f,Fl:p,Gh:y,Gl:w,Hh:v,Hl:b}=this;for(let _=0;_<80;_++){const I=H.rotrSH(u,d,14)^H.rotrSH(u,d,18)^H.rotrBH(u,d,41),A=H.rotrSL(u,d,14)^H.rotrSL(u,d,18)^H.rotrBL(u,d,41),x=u&f^~u&y,$=d&p^~d&w,R=H.add5L(b,A,$,Eg[_],Mt[_]),O=H.add5H(R,v,I,x,_g[_],jt[_]),F=R|0,M=H.rotrSH(r,s,28)^H.rotrBH(r,s,34)^H.rotrBH(r,s,39),j=H.rotrSL(r,s,28)^H.rotrBL(r,s,34)^H.rotrBL(r,s,39),q=r&n^r&a^n&a,T=s&o^s&c^o&c;v=y|0,b=w|0,y=f|0,w=p|0,f=u|0,p=d|0,{h:u,l:d}=H.add(l|0,h|0,O|0,F|0),l=a|0,h=c|0,a=n|0,c=o|0,n=r|0,o=s|0;const g=H.add3L(F,j,T);r=H.add3H(g,O,M,q),s=g|0}({h:r,l:s}=H.add(this.Ah|0,this.Al|0,r|0,s|0)),{h:n,l:o}=H.add(this.Bh|0,this.Bl|0,n|0,o|0),{h:a,l:c}=H.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:h}=H.add(this.Dh|0,this.Dl|0,l|0,h|0),{h:u,l:d}=H.add(this.Eh|0,this.El|0,u|0,d|0),{h:f,l:p}=H.add(this.Fh|0,this.Fl|0,f|0,p|0),{h:y,l:w}=H.add(this.Gh|0,this.Gl|0,y|0,w|0),{h:v,l:b}=H.add(this.Hh|0,this.Hl|0,v|0,b|0),this.set(r,s,n,o,a,c,l,h,u,d,f,p,y,w,v,b)}roundClean(){jt.fill(0),Mt.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};const Sg=Zf(()=>new Ig);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mo=BigInt(0),jh=BigInt(1),Og=BigInt(2);function Uo(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Bo(t){if(!Uo(t))throw new Error("Uint8Array expected")}function sn(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}const Pg=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function ko(t){Bo(t);let e="";for(let i=0;i<t.length;i++)e+=Pg[t[i]];return e}function Mh(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?Mo:BigInt("0x"+t)}const Ot={_0:48,_9:57,A:65,F:70,a:97,f:102};function Ma(t){if(t>=Ot._0&&t<=Ot._9)return t-Ot._0;if(t>=Ot.A&&t<=Ot.F)return t-(Ot.A-10);if(t>=Ot.a&&t<=Ot.f)return t-(Ot.a-10)}function Uh(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,i=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);
vendor: 35,080 bytes, line 16
16const r=new Uint8Array(i);for(let s=0,n=0;s<i;s++,n+=2){const o=Ma(t.charCodeAt(n)),a=Ma(t.charCodeAt(n+1));if(o===void 0||a===void 0){const c=t[n]+t[n+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+n)}r[s]=o*16+a}return r}function $g(t){return Mh(ko(t))}function hs(t){return Bo(t),Mh(ko(Uint8Array.from(t).reverse()))}function Bh(t,e){return Uh(t.toString(16).padStart(e*2,"0"))}function Hn(t,e){return Bh(t,e).reverse()}function Pt(t,e,i){let r;if(typeof e=="string")try{r=Uh(e)}catch(n){throw new Error(t+" must be hex string or Uint8Array, cause: "+n)}else if(Uo(e))r=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const s=r.length;if(typeof i=="number"&&s!==i)throw new Error(t+" of length "+i+" expected, got "+s);return r}function Ua(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];Bo(s),e+=s.length}const i=new Uint8Array(e);for(let r=0,s=0;r<t.length;r++){const n=t[r];i.set(n,s),s+=n.length}return i}const nn=t=>typeof t=="bigint"&&Mo<=t;function Ag(t,e,i){return nn(t)&&nn(e)&&nn(i)&&e<=t&&t<i}function ar(t,e,i,r){if(!Ag(e,i,r))throw new Error("expected valid "+t+": "+i+" <= n < "+r+", got "+e)}function xg(t){let e;for(e=0;t>Mo;t>>=jh,e+=1);return e}const Cg=t=>(Og<<BigInt(t-1))-jh,Rg={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||Uo(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Fo(t,e,i={}){const r=(s,n,o)=>{const a=Rg[n];if(typeof a!="function")throw new Error("invalid validator function");const c=t[s];if(!(o&&c===void 0)&&!a(c,t))throw new Error("param "+String(s)+" is invalid. Expected "+n+", got "+c)};for(const[s,n]of Object.entries(e))r(s,n,!1);for(const[s,n]of Object.entries(i))r(s,n,!0);return t}function Ba(t){const e=new WeakMap;return(i,...r)=>{const s=e.get(i);if(s!==void 0)return s;const n=t(i,...r);return e.set(i,n),n}}const ve=BigInt(0),le=BigInt(1),Zt=BigInt(2),Tg=BigInt(3),Kn=BigInt(4),ka=BigInt(5),Fa=BigInt(8);function fe(t,e){const i=t%e;return i>=ve?i:e+i}function Ng(t,e,i){if(e<ve)throw new Error("invalid exponent, negatives unsupported");if(i<=ve)throw new Error("invalid modulus");if(i===le)return ve;let r=le;for(;e>ve;)e&le&&(r=r*t%i),t=t*t%i,e>>=le;return r}function ft(t,e,i){let r=t;for(;e-- >ve;)r*=r,r%=i;return r}function qa(t,e){if(t===ve)throw new Error("invert: expected non-zero number");if(e<=ve)throw new Error("invert: expected positive modulus, got "+e);let i=fe(t,e),r=e,s=ve,n=le;for(;i!==ve;){const o=r/i,a=r%i,c=s-n*o;r=i,i=a,s=n,n=c}if(r!==le)throw new Error("invert: does not exist");return fe(s,e)}function Lg(t){const e=(t-le)/Zt;let i,r,s;for(i=t-le,r=0;i%Zt===ve;i/=Zt,r++);for(s=Zt;s<t&&Ng(s,e,t)!==t-le;s++)if(s>1e3)throw new Error("Cannot find square root: likely non-prime P");if(r===1){const o=(t+le)/Kn;return function(a,c){const l=a.pow(c,o);if(!a.eql(a.sqr(l),c))throw new Error("Cannot find square root");return l}}const n=(i+le)/Zt;return function(o,a){if(o.pow(a,e)===o.neg(o.ONE))throw new Error("Cannot find square root");let c=r,l=o.pow(o.mul(o.ONE,s),i),h=o.pow(a,n),u=o.pow(a,i);for(;!o.eql(u,o.ONE);){if(o.eql(u,o.ZERO))return o.ZERO;let d=1;for(let p=o.sqr(u);d<c&&!o.eql(p,o.ONE);d++)p=o.sqr(p);const f=o.pow(l,le<<BigInt(c-d-1));l=o.sqr(f),h=o.mul(h,f),u=o.mul(u,l),c=d}return h}}function Dg(t){if(t%Kn===Tg){const e=(t+le)/Kn;return function(i,r){const s=i.pow(r,e);if(!i.eql(i.sqr(s),r))throw new Error("Cannot find square root");return s}}if(t%Fa===ka){const e=(t-ka)/Fa;return function(i,r){const s=i.mul(r,Zt),n=i.pow(s,e),o=i.mul(r,n),a=i.mul(i.mul(o,Zt),n),c=i.mul(o,i.sub(a,i.ONE));if(!i.eql(i.sqr(c),r))throw new Error("Cannot find square root");return c}}return Lg(t)}const jg=(t,e)=>(fe(t,e)&le)===le,Mg=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ug(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},i=Mg.reduce((r,s)=>(r[s]="function",r),e);return Fo(t,i)}function Bg(t,e,i){if(i<ve)throw new Error("invalid exponent, negatives unsupported");if(i===ve)return t.ONE;if(i===le)return e;let r=t.ONE,s=e;for(;i>ve;)i&le&&(r=t.mul(r,s)),s=t.sqr(s),i>>=le;return r}function kg(t,e){const i=new Array(e.length),r=e.reduce((n,o,a)=>t.is0(o)?n:(i[a]=n,t.mul(n,o)),t.ONE),s=t.inv(r);return e.reduceRight((n,o,a)=>t.is0(o)?n:(i[a]=t.mul(n,i[a]),t.mul(n,o)),s),i}function kh(t,e){const i=e!==void 0?e:t.toString(2).length,r=Math.ceil(i/8);return{nBitLength:i,nByteLength:r}}function Fh(t,e,i=!1,r={}){if(t<=ve)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:s,nByteLength:n}=kh(t,e);if(n>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:t,isLE:i,BITS:s,BYTES:n,MASK:Cg(s),ZERO:ve,ONE:le,create:c=>fe(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return ve<=c&&c<t},is0:c=>c===ve,isOdd:c=>(c&le)===le,neg:c=>fe(-c,t),eql:(c,l)=>c===l,sqr:c=>fe(c*c,t),add:(c,l)=>fe(c+l,t),sub:(c,l)=>fe(c-l,t),mul:(c,l)=>fe(c*l,t),pow:(c,l)=>Bg(a,c,l),div:(c,l)=>fe(c*qa(l,t),t),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>qa(c,t),sqrt:r.sqrt||(c=>(o||(o=Dg(t)),o(a,c))),invertBatch:c=>kg(a,c),cmov:(c,l,h)=>h?l:c,toBytes:c=>i?Hn(c,n):Bh(c,n),fromBytes:c=>{if(c.length!==n)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+c.length);return i?hs(c):$g(c)}});return Object.freeze(a)}const za=BigInt(0),Yr=BigInt(1);function on(t,e){const i=e.negate();return t?i:e}function qh(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function an(t,e){qh(t,e);const i=Math.ceil(e/t)+1,r=2**(t-1);return{windows:i,windowSize:r}}function Fg(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((i,r)=>{if(!(i instanceof e))throw new Error("invalid point at index "+r)})}function qg(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((i,r)=>{if(!e.isValid(i))throw new Error("invalid scalar at index "+r)})}const cn=new WeakMap,zh=new WeakMap;function ln(t){return zh.get(t)||1}function zg(t,e){return{constTimeNegate:on,hasPrecomputes(i){return ln(i)!==1},unsafeLadder(i,r,s=t.ZERO){let n=i;for(;r>za;)r&Yr&&(s=s.add(n)),n=n.double(),r>>=Yr;return s},precomputeWindow(i,r){const{windows:s,windowSize:n}=an(r,e),o=[];let a=i,c=a;for(let l=0;l<s;l++){c=a,o.push(c);for(let h=1;h<n;h++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(i,r,s){const{windows:n,windowSize:o}=an(i,e);let a=t.ZERO,c=t.BASE;const l=BigInt(2**i-1),h=2**i,u=BigInt(i);for(let d=0;d<n;d++){const f=d*o;let p=Number(s&l);s>>=u,p>o&&(p-=h,s+=Yr);const y=f,w=f+Math.abs(p)-1,v=d%2!==0,b=p<0;p===0?c=c.add(on(v,r[y])):a=a.add(on(b,r[w]))}return{p:a,f:c}},wNAFUnsafe(i,r,s,n=t.ZERO){const{windows:o,windowSize:a}=an(i,e),c=BigInt(2**i-1),l=2**i,h=BigInt(i);for(let u=0;u<o;u++){const d=u*a;if(s===za)break;let f=Number(s&c);if(s>>=h,f>a&&(f-=l,s+=Yr),f===0)continue;let p=r[d+Math.abs(f)-1];f<0&&(p=p.negate()),n=n.add(p)}return n},getPrecomputes(i,r,s){let n=cn.get(r);return n||(n=this.precomputeWindow(r,i),i!==1&&cn.set(r,s(n))),n},wNAFCached(i,r,s){const n=ln(i);return this.wNAF(n,this.getPrecomputes(n,i,s),r)},wNAFCachedUnsafe(i,r,s,n){const o=ln(i);return o===1?this.unsafeLadder(i,r,n):this.wNAFUnsafe(o,this.getPrecomputes(o,i,s),r,n)},setWindowSize(i,r){qh(r,e),zh.set(i,r),cn.delete(i)}}}function Vg(t,e,i,r){if(Fg(i,t),qg(r,e),i.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const s=t.ZERO,n=xg(BigInt(i.length)),o=n>12?n-3:n>4?n-2:n?2:1,a=(1<<o)-1,c=new Array(a+1).fill(s),l=Math.floor((e.BITS-1)/o)*o;let h=s;for(let u=l;u>=0;u-=o){c.fill(s);for(let f=0;f<r.length;f++){const p=r[f],y=Number(p>>BigInt(u)&BigInt(a));c[y]=c[y].add(i[f])}let d=s;for(let f=c.length-1,p=s;f>0;f--)p=p.add(c[f]),d=d.add(p);if(h=h.add(d),u!==0)for(let f=0;f<o;f++)h=h.double()}return h}function Hg(t){return Ug(t.Fp),Fo(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...kh(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}const ot=BigInt(0),je=BigInt(1),Jr=BigInt(2),Kg=BigInt(8),Wg={zip215:!0};function Gg(t){const e=Hg(t);return Fo(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function Yg(t){const e=Gg(t),{Fp:i,n:r,prehash:s,hash:n,randomBytes:o,nByteLength:a,h:c}=e,l=Jr<<BigInt(a*8)-je,h=i.create,u=Fh(e.n,e.nBitLength),d=e.uvRatio||((g,m)=>{try{return{isValid:!0,value:i.sqrt(g*i.inv(m))}}catch{return{isValid:!1,value:ot}}}),f=e.adjustScalarBytes||(g=>g),p=e.domain||((g,m,E)=>{if(sn("phflag",E),m.length||E)throw new Error("Contexts/pre-hash are not supported");return g});function y(g,m){ar("coordinate "+g,m,ot,l)}function w(g){if(!(g instanceof _))throw new Error("ExtendedPoint expected")}const v=Ba((g,m)=>{const{ex:E,ey:P,ez:S}=g,C=g.is0();m==null&&(m=C?Kg:i.inv(S));const U=h(E*m),k=h(P*m),z=h(S*m);if(C)return{x:ot,y:je};if(z!==je)throw new Error("invZ was invalid");return{x:U,y:k}}),b=Ba(g=>{const{a:m,d:E}=e;if(g.is0())throw new Error("bad point: ZERO");const{ex:P,ey:S,ez:C,et:U}=g,k=h(P*P),z=h(S*S),B=h(C*C),V=h(B*B),G=h(k*m),ne=h(B*h(G+z)),ee=h(V+h(E*h(k*z)));if(ne!==ee)throw new Error("bad point: equation left != right (1)");const Y=h(P*S),Ce=h(C*U);if(Y!==Ce)throw new Error("bad point: equation left != right (2)");return!0});class _{constructor(m,E,P,S){this.ex=m,this.ey=E,this.ez=P,this.et=S,y("x",m),y("y",E),y("z",P),y("t",S),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(m){if(m instanceof _)throw new Error("extended point not allowed");const{x:E,y:P}=m||{};return y("x",E),y("y",P),new _(E,P,je,h(E*P))}static normalizeZ(m){const E=i.invertBatch(m.map(P=>P.ez));return m.map((P,S)=>P.toAffine(E[S])).map(_.fromAffine)}static msm(m,E){return Vg(_,u,m,E)}_setWindowSize(m){x.setWindowSize(this,m)}assertValidity(){b(this)}equals(m){w(m);const{ex:E,ey:P,ez:S}=this,{ex:C,ey:U,ez:k}=m,z=h(E*k),B=h(C*S),V=h(P*k),G=h(U*S);return z===B&&V===G}is0(){return this.equals(_.ZERO)}negate(){return new _(h(-this.ex),this.ey,this.ez,h(-this.et))}double(){const{a:m}=e,{ex:E,ey:P,ez:S}=this,C=h(E*E),U=h(P*P),k=h(Jr*h(S*S)),z=h(m*C),B=E+P,V=h(h(B*B)-C-U),G=z+U,ne=G-k,ee=z-U,Y=h(V*ne),Ce=h(G*ee),Ee=h(V*ee),Te=h(ne*G);return new _(Y,Ce,Te,Ee)}add(m){w(m);const{a:E,d:P}=e,{ex:S,ey:C,ez:U,et:k}=this,{ex:z,ey:B,ez:V,et:G}=m;if(E===BigInt(-1)){const na=h((C-S)*(B+z)),oa=h((C+S)*(B-z)),Js=h(oa-na);if(Js===ot)return this.double();const aa=h(U*Jr*G),ca=h(k*Jr*V),la=ca+aa,ha=oa+na,ua=ca-aa,Hd=h(la*Js),Kd=h(ha*ua),Wd=h(la*ua),Gd=h(Js*ha);return new _(Hd,Kd,Gd,Wd)}const ne=h(S*z),ee=h(C*B),Y=h(k*P*G),Ce=h(U*V),Ee=h((S+C)*(z+B)-ne-ee),Te=Ce-Y,Ze=Ce+Y,Xe=h(ee-E*ne),fi=h(Ee*Te),qd=h(Ze*Xe),zd=h(Ee*Xe),Vd=h(Te*Ze);return new _(fi,qd,Vd,zd)}subtract(m){return this.add(m.negate())}wNAF(m){return x.wNAFCached(this,m,_.normalizeZ)}multiply(m){const E=m;ar("scalar",E,je,r);const{p:P,f:S}=this.wNAF(E);return _.normalizeZ([P,S])[0]}multiplyUnsafe(m,E=_.ZERO){const P=m;return ar("scalar",P,ot,r),P===ot?A:this.is0()||P===je?this:x.wNAFCachedUnsafe(this,P,_.normalizeZ,E)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return x.unsafeLadder(this,r).is0()}toAffine(m){return v(this,m)}clearCofactor(){const{h:m}=e;return m===je?this:this.multiplyUnsafe(m)}static fromHex(m,E=!1){const{d:P,a:S}=e,C=i.BYTES;m=Pt("pointHex",m,C),sn("zip215",E);const U=m.slice(),k=m[C-1];U[C-1]=k&-129;const z=hs(U),B=E?l:i.ORDER;ar("pointHex.y",z,ot,B);const V=h(z*z),G=h(V-je),ne=h(P*V-S);let{isValid:ee,value:Y}=d(G,ne);if(!ee)throw new Error("Point.fromHex: invalid y coordinate");const Ce=(Y&je)===je,Ee=(k&128)!==0;if(!E&&Y===ot&&Ee)throw new Error("Point.fromHex: x=0 and x_0=1");return Ee!==Ce&&(Y=h(-Y)),_.fromAffine({x:Y,y:z})}static fromPrivateKey(m){return O(m).point}toRawBytes(){const{x:m,y:E}=this.toAffine(),P=Hn(E,i.BYTES);return P[P.length-1]|=m&je?128:0,P}toHex(){return ko(this.toRawBytes())}}_.BASE=new _(e.Gx,e.Gy,je,h(e.Gx*e.Gy)),_.ZERO=new _(ot,je,je,ot);const{BASE:I,ZERO:A}=_,x=zg(_,a*8);function $(g){return fe(g,r)}function R(g){return $(hs(g))}function O(g){const m=i.BYTES;g=Pt("private key",g,m);const E=Pt("hashed private key",n(g),2*m),P=f(E.slice(0,m)),S=E.slice(m,2*m),C=R(P),U=I.multiply(C),k=U.toRawBytes();return{head:P,prefix:S,scalar:C,point:U,pointBytes:k}}function F(g){return O(g).pointBytes}function M(g=new Uint8Array,...m){const E=Ua(...m);return R(n(p(E,Pt("context",g),!!s)))}function j(g,m,E={}){g=Pt("message",g),s&&(g=s(g));const{prefix:P,scalar:S,pointBytes:C}=O(m),U=M(E.context,P,g),k=I.multiply(U).toRawBytes(),z=M(E.context,k,C,g),B=$(U+z*S);ar("signature.s",B,ot,r);const V=Ua(k,Hn(B,i.BYTES));return Pt("result",V,i.BYTES*2)}const q=Wg;function T(g,m,E,P=q){const{context:S,zip215:C}=P,U=i.BYTES;g=Pt("signature",g,2*U),m=Pt("message",m),E=Pt("publicKey",E,U),C!==void 0&&sn("zip215",C),s&&(m=s(m));const k=hs(g.slice(U,2*U));let z,B,V;try{z=_.fromHex(E,C),B=_.fromHex(g.slice(0,U),C),V=I.multiplyUnsafe(k)}catch{return!1}if(!C&&z.isSmallOrder())return!1;const G=M(S,B.toRawBytes(),z.toRawBytes(),m);return B.add(z.multiplyUnsafe(G)).subtract(V).clearCofactor().equals(_.ZERO)}return I._setWindowSize(8),{CURVE:e,getPublicKey:F,sign:j,verify:T,ExtendedPoint:_,utils:{getExtendedPublicKey:O,randomPrivateKey:()=>o(i.BYTES),precompute(g=8,m=_.BASE){return m._setWindowSize(g),m.multiply(BigInt(3)),m}}}}BigInt(0),BigInt(1);const qo=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Va=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const Jg=BigInt(1),Ha=BigInt(2);BigInt(3);const Zg=BigInt(5),Xg=BigInt(8);function Qg(t){const e=BigInt(10),i=BigInt(20),r=BigInt(40),s=BigInt(80),n=qo,o=t*t%n*t%n,a=ft(o,Ha,n)*o%n,c=ft(a,Jg,n)*t%n,l=ft(c,Zg,n)*c%n,h=ft(l,e,n)*l%n,u=ft(h,i,n)*h%n,d=ft(u,r,n)*u%n,f=ft(d,s,n)*d%n,p=ft(f,s,n)*d%n,y=ft(p,e,n)*l%n;return{pow_p_5_8:ft(y,Ha,n)*t%n,b2:o}}function ey(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function ty(t,e){const i=qo,r=fe(e*e*e,i),s=fe(r*r*e,i),n=Qg(t*s).pow_p_5_8;let o=fe(t*r*n,i);const a=fe(e*o*o,i),c=o,l=fe(o*Va,i),h=a===t,u=a===fe(-t,i),d=a===fe(-t*Va,i);return h&&(o=c),(u||d)&&(o=l),jg(o,i)&&(o=fe(-o,i)),{isValid:h||u,value:o}}const iy=Fh(qo,void 0,!0),ry={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:iy,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:Xg,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Sg,randomBytes:Lh,adjustScalarBytes:ey,uvRatio:ty},Vh=Yg(ry),sy="EdDSA",ny="JWT",bs=".",Ns="base64url",Hh="utf8",Kh="utf8",oy=":",ay="did",cy="key",Ka="base58btc",ly="z",hy="K36",uy=32;function zo(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Wh(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?zo(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Gh(t,e){e||(e=t.reduce((s,n)=>s+n.length,0));const i=Wh(e);let r=0;for(const s of t)i.set(s,r),r+=s.length;return zo(i)}function dy(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var i=new Uint8Array(256),r=0;r<i.length;r++)i[r]=255;for(var s=0;s<t.length;s++){var n=t.charAt(s),o=n.charCodeAt(0);if(i[o]!==255)throw new TypeError(n+" is ambiguous");i[o]=s}var a=t.length,c=t.charAt(0),l=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function u(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var y=0,w=0,v=0,b=p.length;v!==b&&p[v]===0;)v++,y++;for(var _=(b-v)*h+1>>>0,I=new Uint8Array(_);v!==b;){for(var A=p[v],x=0,$=_-1;(A!==0||x<w)&&$!==-1;$--,x++)A+=256*I[$]>>>0,I[$]=A%a>>>0,A=A/a>>>0;if(A!==0)throw new Error("Non-zero carry");w=x,v++}for(var R=_-w;R!==_&&I[R]===0;)R++;for(var O=c.repeat(y);R<_;++R)O+=t.charAt(I[R]);return O}function d(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var y=0;if(p[y]!==" "){for(var w=0,v=0;p[y]===c;)w++,y++;for(var b=(p.length-y)*l+1>>>0,_=new Uint8Array(b);p[y];){var I=i[p.charCodeAt(y)];if(I===255)return;for(var A=0,x=b-1;(I!==0||A<v)&&x!==-1;x--,A++)I+=a*_[x]>>>0,_[x]=I%256>>>0,I=I/256>>>0;if(I!==0)throw new Error("Non-zero carry");v=A,y++}if(p[y]!==" "){for(var $=b-v;$!==b&&_[$]===0;)$++;for(var R=new Uint8Array(w+(b-$)),O=w;$!==b;)R[O++]=_[$++];return R}}}function f(p){var y=d(p);if(y)return y;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:d,decode:f}}var py=dy,fy=py;const Yh=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")},gy=t=>new TextEncoder().encode(t),yy=t=>new TextDecoder().decode(t);let my=class{constructor(e,i,r){this.name=e,this.prefix=i,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},wy=class{constructor(e,i,r){if(this.name=e,this.prefix=i,i.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=i.codePointAt(0),this.baseDecode=r}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 Jh(this,e)}},by=class{constructor(e){this.decoders=e}or(e){return Jh(this,e)}decode(e){const i=e[0],r=this.decoders[i];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const Jh=(t,e)=>new by({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});let vy=class{constructor(e,i,r,s){this.name=e,this.prefix=i,this.baseEncode=r,this.baseDecode=s,this.encoder=new my(e,i,r),this.decoder=new wy(e,i,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};const Ls=({name:t,prefix:e,encode:i,decode:r})=>new vy(t,e,i,r),Lr=({prefix:t,name:e,alphabet:i})=>{const{encode:r,decode:s}=fy(i,e);return Ls({prefix:t,name:e,encode:r,decode:n=>Yh(s(n))})},_y=(t,e,i,r)=>{const s={};for(let h=0;h<e.length;++h)s[e[h]]=h;let n=t.length;for(;t[n-1]==="=";)--n;const o=new Uint8Array(n*i/8|0);let a=0,c=0,l=0;for(let h=0;h<n;++h){const u=s[t[h]];if(u===void 0)throw new SyntaxError(`Non-${r} character`);c=c<<i|u,a+=i,a>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=i||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},Ey=(t,e,i)=>{const r=e[e.length-1]==="=",s=(1<<i)-1;let n="",o=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],o+=8;o>i;)o-=i,n+=e[s&a>>o];if(o&&(n+=e[s&a<<i-o]),r)for(;n.length*i&7;)n+="=";return n},$e=({name:t,prefix:e,bitsPerChar:i,alphabet:r})=>Ls({prefix:e,name:t,encode(s){return Ey(s,r,i)},decode(s){return _y(s,r,i,t)}}),Iy=Ls({prefix:"\0",name:"identity",encode:t=>yy(t),decode:t=>gy(t)});var Sy=Object.freeze({__proto__:null,identity:Iy});const Oy=$e({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Py=Object.freeze({__proto__:null,base2:Oy});const $y=$e({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Ay=Object.freeze({__proto__:null,base8:$y});const xy=Lr({prefix:"9",name:"base10",alphabet:"0123456789"});var Cy=Object.freeze({__proto__:null,base10:xy});const Ry=$e({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ty=$e({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ny=Object.freeze({__proto__:null,base16:Ry,base16upper:Ty});const Ly=$e({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Dy=$e({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),jy=$e({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),My=$e({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Uy=$e({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),By=$e({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ky=$e({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Fy=$e({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),qy=$e({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var zy=Object.freeze({__proto__:null,base32:Ly,base32upper:Dy,base32pad:jy,base32padupper:My,base32hex:Uy,base32hexupper:By,base32hexpad:ky,base32hexpadupper:Fy,base32z:qy});const Vy=Lr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Hy=Lr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ky=Object.freeze({__proto__:null,base36:Vy,base36upper:Hy});const Wy=Lr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Gy=Lr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Yy=Object.freeze({__proto__:null,base58btc:Wy,base58flickr:Gy});const Jy=$e({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Zy=$e({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Xy=$e({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Qy=$e({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var em=Object.freeze({__proto__:null,base64:Jy,base64pad:Zy,base64url:Xy,base64urlpad:Qy});const Zh=Array.from("ððªâð°ðððððððððððððâð»ð¥ð¾ð¿ðâ¤ðð¤£ððððððð
ððð¥ð¥°ðððð¢ð¤ðððªðâºðð¤ððððð¹ð¤¦ððââ¨ð¤·ð±ðð¸ððððððððð¤©ððð¤ðð¯ððð¶ðð¤â£ððððªðð¥ððð©ð¡ð¤ªðð¥³ð¥ð¤¤ððð³âððð´ðð¬ððð·ð»ðââ
ð¥ºððð¤ð¦âð£ððâ¹ððð âððºðð»ððððð¹ð£ð«ðððµð¤ðð´ð¤ð¼ð«â½ð¤âðð¤«ðð®ðð»ðð¶ðð²ð¿ð§¡ðâ¡ððââðð°ð¤¨ð¶ð¤ð¶ð°ðð¢ð¤ðð¨ð¨ð¤¬âððºð¤ððð±ðð¶ð¥´â¶â¡âðð¸â¬ð¨ðð¦ð·ðºâ ð
ððµðð¤²ð¤ ð¤§ððµð
ð§ð¾ððð¤ðð¤¯ð·âð§ð¯ððð¤ððâð´ð£ð¸ððð¥ð¤¢ð
ð¡ð©ðð¸ð»ð¤ð¤®ð¼ð¥µð©ððð¼ðð£ð¥"),tm=Zh.reduce((t,e,i)=>(t[i]=e,t),[]),im=Zh.reduce((t,e,i)=>(t[e.codePointAt(0)]=i,t),[]);function rm(t){return t.reduce((e,i)=>(e+=tm[i],e),"")}function sm(t){const e=[];for(const i of t){const r=im[i.codePointAt(0)];if(r===void 0)throw new Error(`Non-base256emoji character: ${i}`);e.push(r)}return new Uint8Array(e)}const nm=Ls({prefix:"ð",name:"base256emoji",encode:rm,decode:sm});var om=Object.freeze({__proto__:null,base256emoji:nm}),am=Xh,Wa=128,cm=-128,lm=Math.pow(2,31);function Xh(t,e,i){e=e||[],i=i||0;for(var r=i;t>=lm;)e[i++]=t&255|Wa,t/=128;for(;t&cm;)e[i++]=t&255|Wa,t>>>=7;return e[i]=t|0,Xh.bytes=i-r+1,e}var hm=Wn,um=128,Ga=127;function Wn(t,r){var i=0,r=r||0,s=0,n=r,o,a=t.length;do{if(n>=a)throw Wn.bytes=0,new RangeError("Could not decode varint");o=t[n++],i+=s<28?(o&Ga)<<s:(o&Ga)*Math.pow(2,s),s+=7}while(o>=um);return Wn.bytes=n-r,i}var dm=Math.pow(2,7),pm=Math.pow(2,14),fm=Math.pow(2,21),gm=Math.pow(2,28),ym=Math.pow(2,35),mm=Math.pow(2,42),wm=Math.pow(2,49),bm=Math.pow(2,56),vm=Math.pow(2,63),_m=function(t){return t<dm?1:t<pm?2:t<fm?3:t<gm?4:t<ym?5:t<mm?6:t<wm?7:t<bm?8:t<vm?9:10},Em={encode:am,decode:hm,encodingLength:_m},Qh=Em;const Ya=(t,e,i=0)=>(Qh.encode(t,e,i),e),Ja=t=>Qh.encodingLength(t),Gn=(t,e)=>{const i=e.byteLength,r=Ja(t),s=r+Ja(i),n=new Uint8Array(s+i);return Ya(t,n,0),Ya(i,n,r),n.set(e,s),new Im(t,i,e,n)};let Im=class{constructor(e,i,r,s){this.code=e,this.size=i,this.digest=r,this.bytes=s}};const eu=({name:t,code:e,encode:i})=>new Sm(t,e,i);let Sm=class{constructor(e,i,r){this.name=e,this.code=i,this.encode=r}digest(e){if(e instanceof Uint8Array){const i=this.encode(e);return i instanceof Uint8Array?Gn(this.code,i):i.then(r=>Gn(this.code,r))}else throw Error("Unknown type, must be binary type")}};const tu=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Om=eu({name:"sha2-256",code:18,encode:tu("SHA-256")}),Pm=eu({name:"sha2-512",code:19,encode:tu("SHA-512")});var $m=Object.freeze({__proto__:null,sha256:Om,sha512:Pm});const iu=0,Am="identity",ru=Yh,xm=t=>Gn(iu,ru(t)),Cm={code:iu,name:Am,encode:ru,digest:xm};var Rm=Object.freeze({__proto__:null,identity:Cm});new TextEncoder,new TextDecoder;const Za={...Sy,...Py,...Ay,...Cy,...Ny,...zy,...Ky,...Yy,...em,...om};({...$m,...Rm});function su(t,e,i,r){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:i},decoder:{decode:r}}}const Xa=su("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),hn=su("ascii","a",t=>{let e="a";for(let i=0;i<t.length;i++)e+=String.fromCharCode(t[i]);return e},t=>{t=t.substring(1);const e=Wh(t.length);for(let i=0;i<t.length;i++)e[i]=t.charCodeAt(i);return e}),nu={utf8:Xa,"utf-8":Xa,hex:Za.base16,latin1:hn,ascii:hn,binary:hn,...Za};function Ds(t,e="utf8"){const i=nu[e];if(!i)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"):i.encoder.encode(t).substring(1)}function Xi(t,e="utf8"){const i=nu[e];if(!i)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?zo(globalThis.Buffer.from(t,"utf-8")):i.decoder.decode(`${i.prefix}${t}`)}function Qa(t){return ni(Ds(Xi(t,Ns),Hh))}function vs(t){return Ds(Xi(Dt(t),Hh),Ns)}function ou(t){const e=Xi(hy,Ka),i=ly+Ds(Gh([e,t]),Ka);return[ay,cy,i].join(oy)}function Tm(t){return Ds(t,Ns)}function Nm(t){return Xi(t,Ns)}function Lm(t){return Xi([vs(t.header),vs(t.payload)].join(bs),Kh)}function Dm(t){return[vs(t.header),vs(t.payload),Tm(t.signature)].join(bs)}function Yn(t){const e=t.split(bs),i=Qa(e[0]),r=Qa(e[1]),s=Nm(e[2]),n=Xi(e.slice(0,2).join(bs),Kh);return{header:i,payload:r,signature:s,data:n}}function ec(t=Lh(uy)){const e=Vh.getPublicKey(t);return{secretKey:Gh([t,e]),publicKey:e}}async function jm(t,e,i,r,s=L.fromMiliseconds(Date.now())){const n={alg:sy,typ:ny},o=ou(r.publicKey),a=s+i,c={iss:o,sub:t,aud:e,iat:s,exp:a},l=Lm({header:n,payload:c}),h=Vh.sign(l,r.secretKey.slice(0,32));return Dm({header:n,payload:c,signature:h})}function au(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function mr(t,e){e||(e=t.reduce((s,n)=>s+n.length,0));const i=au(e);let r=0;for(const s of t)i.set(s,r),r+=s.length;return i}function Mm(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var i=new Uint8Array(256),r=0;r<i.length;r++)i[r]=255;for(var s=0;s<t.length;s++){var n=t.charAt(s),o=n.charCodeAt(0);if(i[o]!==255)throw new TypeError(n+" is ambiguous");i[o]=s}var a=t.length,c=t.charAt(0),l=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function u(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var y=0,w=0,v=0,b=p.length;v!==b&&p[v]===0;)v++,y++;for(var _=(b-v)*h+1>>>0,I=new Uint8Array(_);v!==b;){for(var A=p[v],x=0,$=_-1;(A!==0||x<w)&&$!==-1;$--,x++)A+=256*I[$]>>>0,I[$]=A%a>>>0,A=A/a>>>0;if(A!==0)throw new Error("Non-zero carry");w=x,v++}for(var R=_-w;R!==_&&I[R]===0;)R++;for(var O=c.repeat(y);R<_;++R)O+=t.charAt(I[R]);return O}function d(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var y=0;if(p[y]!==" "){for(var w=0,v=0;p[y]===c;)w++,y++;for(var b=(p.length-y)*l+1>>>0,_=new Uint8Array(b);p[y];){var I=i[p.charCodeAt(y)];if(I===255)return;for(var A=0,x=b-1;(I!==0||A<v)&&x!==-1;x--,A++)I+=a*_[x]>>>0,_[x]=I%256>>>0,I=I/256>>>0;if(I!==0)throw new Error("Non-zero carry");v=A,y++}if(p[y]!==" "){for(var $=b-v;$!==b&&_[$]===0;)$++;for(var R=new Uint8Array(w+(b-$)),O=w;$!==b;)R[O++]=_[$++];return R}}}function f(p){var y=d(p);if(y)return y;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:d,decode:f}}var Um=Mm,Bm=Um;const km=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")},Fm=t=>new TextEncoder().encode(t),qm=t=>new TextDecoder().decode(t);class zm{constructor(e,i,r){this.name=e,this.prefix=i,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Vm{constructor(e,i,r){if(this.name=e,this.prefix=i,i.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=i.codePointAt(0),this.baseDecode=r}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 cu(this,e)}}class Hm{constructor(e){this.decoders=e}or(e){return cu(this,e)}decode(e){const i=e[0],r=this.decoders[i];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const cu=(t,e)=>new Hm({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class Km{constructor(e,i,r,s){this.name=e,this.prefix=i,this.baseEncode=r,this.baseDecode=s,this.encoder=new zm(e,i,r),this.decoder=new Vm(e,i,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const js=({name:t,prefix:e,encode:i,decode:r})=>new Km(t,e,i,r),Dr=({prefix:t,name:e,alphabet:i})=>{const{encode:r,decode:s}=Bm(i,e);return js({prefix:t,name:e,encode:r,decode:n=>km(s(n))})},Wm=(t,e,i,r)=>{const s={};for(let h=0;h<e.length;++h)s[e[h]]=h;let n=t.length;for(;t[n-1]==="=";)--n;const o=new Uint8Array(n*i/8|0);let a=0,c=0,l=0;for(let h=0;h<n;++h){const u=s[t[h]];if(u===void 0)throw new SyntaxError(`Non-${r} character`);c=c<<i|u,a+=i,a>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=i||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},Gm=(t,e,i)=>{const r=e[e.length-1]==="=",s=(1<<i)-1;let n="",o=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],o+=8;o>i;)o-=i,n+=e[s&a>>o];if(o&&(n+=e[s&a<<i-o]),r)for(;n.length*i&7;)n+="=";return n},Ae=({name:t,prefix:e,bitsPerChar:i,alphabet:r})=>js({prefix:e,name:t,encode(s){return Gm(s,r,i)},decode(s){return Wm(s,r,i,t)}}),Ym=js({prefix:"\0",name:"identity",encode:t=>qm(t),decode:t=>Fm(t)}),Jm=Object.freeze(Object.defineProperty({__proto__:null,identity:Ym},Symbol.toStringTag,{value:"Module"})),Zm=Ae({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),Xm=Object.freeze(Object.defineProperty({__proto__:null,base2:Zm},Symbol.toStringTag,{value:"Module"})),Qm=Ae({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),ew=Object.freeze(Object.defineProperty({__proto__:null,base8:Qm},Symbol.toStringTag,{value:"Module"})),tw=Dr({prefix:"9",name:"base10",alphabet:"0123456789"}),iw=Object.freeze(Object.defineProperty({__proto__:null,base10:tw},Symbol.toStringTag,{value:"Module"})),rw=Ae({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),sw=Ae({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),nw=Object.freeze(Object.defineProperty({__proto__:null,base16:rw,base16upper:sw},Symbol.toStringTag,{value:"Module"})),ow=Ae({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),aw=Ae({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),cw=Ae({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),lw=Ae({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),hw=Ae({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),uw=Ae({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),dw=Ae({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),pw=Ae({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),fw=Ae({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),gw=Object.freeze(Object.defineProperty({__proto__:null,base32:ow,base32hex:hw,base32hexpad:dw,base32hexpadupper:pw,base32hexupper:uw,base32pad:cw,base32padupper:lw,base32upper:aw,base32z:fw},Symbol.toStringTag,{value:"Module"})),yw=Dr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),mw=Dr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),ww=Object.freeze(Object.defineProperty({__proto__:null,base36:yw,base36upper:mw},Symbol.toStringTag,{value:"Module"})),bw=Dr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),vw=Dr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),_w=Object.freeze(Object.defineProperty({__proto__:null,base58btc:bw,base58flickr:vw},Symbol.toStringTag,{value:"Module"})),Ew=Ae({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
16+/",bitsPerChar:6}),Iw=Ae({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Sw=Ae({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Ow=Ae({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Pw=Object.freeze(Object.defineProperty({__proto__:null,base64:Ew,base64pad:Iw,base64url:Sw,base64urlpad:Ow},Symbol.toStringTag,{value:"Module"})),lu=Array.from("ððªâð°ðððððððððððððâð»ð¥ð¾ð¿ðâ¤ðð¤£ððððððð
ððð¥ð¥°ðððð¢ð¤ðððªðâºðð¤ððððð¹ð¤¦ððââ¨ð¤·ð±ðð¸ððððððððð¤©ððð¤ðð¯ððð¶ðð¤â£ððððªðð¥ððð©ð¡ð¤ªðð¥³ð¥ð¤¤ððð³âððð´ðð¬ððð·ð»ðââ
ð¥ºððð¤ð¦âð£ððâ¹ððð âððºðð»ððððð¹ð£ð«ðððµð¤ðð´ð¤ð¼ð«â½ð¤âðð¤«ðð®ðð»ðð¶ðð²ð¿ð§¡ðâ¡ððââðð°ð¤¨ð¶ð¤ð¶ð°ðð¢ð¤ðð¨ð¨ð¤¬âððºð¤ððð±ðð¶ð¥´â¶â¡âðð¸â¬ð¨ðð¦ð·ðºâ ð
ððµðð¤²ð¤ ð¤§ððµð
ð§ð¾ððð¤ðð¤¯ð·âð§ð¯ððð¤ððâð´ð£ð¸ððð¥ð¤¢ð
ð¡ð©ðð¸ð»ð¤ð¤®ð¼ð¥µð©ððð¼ðð£ð¥"),$w=lu.reduce((t,e,i)=>(t[i]=e,t),[]),Aw=lu.reduce((t,e,i)=>(t[e.codePointAt(0)]=i,t),[]);function xw(t){return t.reduce((e,i)=>(e+=$w[i],e),"")}function Cw(t){const e=[];for(const i of t){const r=Aw[i.codePointAt(0)];if(r===void 0)throw new Error(`Non-base256emoji character: ${i}`);e.push(r)}return new Uint8Array(e)}const Rw=js({prefix:"ð",name:"base256emoji",encode:xw,decode:Cw}),Tw=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:Rw},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const tc={...Jm,...Xm,...ew,...iw,...nw,...gw,...ww,..._w,...Pw,...Tw};function hu(t,e,i,r){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:i},decoder:{decode:r}}}const ic=hu("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),un=hu("ascii","a",t=>{let e="a";for(let i=0;i<t.length;i++)e+=String.fromCharCode(t[i]);return e},t=>{t=t.substring(1);const e=au(t.length);for(let i=0;i<t.length;i++)e[i]=t.charCodeAt(i);return e}),uu={utf8:ic,"utf-8":ic,hex:tc.base16,latin1:un,ascii:un,binary:un,...tc};function rt(t,e="utf8"){const i=uu[e];if(!i)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):i.decoder.decode(`${i.prefix}${t}`)}function Fe(t,e="utf8"){const i=uu[e];if(!i)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"):i.encoder.encode(t).substring(1)}const Nw={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"}};var Lw={};const Dw=":";function Fi(t){const[e,i]=t.split(Dw);return{namespace:e,reference:i}}function rc(t,e=[]){const i=[];return Object.keys(t).forEach(r=>{if(e.length&&!e.includes(r))return;const s=t[r];
16i.push(...s.accounts)}),i}function du(t,e){return t.includes(":")?[t]:e.chains||[]}var jw=Object.defineProperty,Mw=Object.defineProperties,Uw=Object.getOwnPropertyDescriptors,sc=Object.getOwnPropertySymbols,Bw=Object.prototype.hasOwnProperty,kw=Object.prototype.propertyIsEnumerable,nc=(t,e,i)=>e in t?jw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,oc=(t,e)=>{for(var i in e||(e={}))Bw.call(e,i)&&nc(t,i,e[i]);if(sc)for(var i of sc(e))kw.call(e,i)&&nc(t,i,e[i]);return t},Fw=(t,e)=>Mw(t,Uw(e));const qw="ReactNative",Ge={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},zw="js";function _s(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Ht(){return!Nr()&&!!Lo()&&navigator.product===qw}function Vw(){return Ht()&&typeof window<"u"&&typeof(window==null?void 0:window.Platform)<"u"&&(window==null?void 0:window.Platform.OS)==="android"}function Hw(){return Ht()&&typeof window<"u"&&typeof(window==null?void 0:window.Platform)<"u"&&(window==null?void 0:window.Platform.OS)==="ios"}function jr(){return!_s()&&!!Lo()&&!!Nr()}function Mr(){return Ht()?Ge.reactNative:_s()?Ge.node:jr()?Ge.browser:Ge.unknown}function ac(){var t;try{return Ht()&&typeof window<"u"&&typeof(window==null?void 0:window.Application)<"u"?(t=window.Application)==null?void 0:t.applicationId:void 0}catch{return}}function Kw(t,e){const i=new URLSearchParams(t);for(const r of Object.keys(e).sort())if(e.hasOwnProperty(r)){const s=e[r];s!==void 0&&i.set(r,s)}return i.toString()}function Ww(t){var e,i;const r=pu();try{return t!=null&&t.url&&r.url&&t.url!==r.url&&(console.warn(`The configured WalletConnect 'metadata.url':${t.url} differs from the actual page url:${r.url}. This is probably unintended and can lead to issues.`),t.url=r.url),(e=t==null?void 0:t.icons)!=null&&e.length&&t.icons.length>0&&(t.icons=t.icons.filter(s=>s!=="")),Fw(oc(oc({},r),t),{url:(t==null?void 0:t.url)||r.url,name:(t==null?void 0:t.name)||r.name,description:(t==null?void 0:t.description)||r.description,icons:(i=t==null?void 0:t.icons)!=null&&i.length&&t.icons.length>0?t.icons:r.icons})}catch(s){return console.warn("Error populating app metadata",s),t||r}}function pu(){return bh()||{name:"",description:"",url:"",icons:[""]}}function Gw(){if(Mr()===Ge.reactNative&&typeof window<"u"&&typeof(window==null?void 0:window.Platform)<"u"){const{OS:i,Version:r}=window.Platform;return[i,r].join("-")}const t=lp();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 Yw(){var t;const e=Mr();return e===Ge.browser?[e,((t=wh())==null?void 0:t.host)||"unknown"].join(":"):e}function fu(t,e,i){const r=Gw(),s=Yw();return[[t,e].join("-"),[zw,i].join("-"),r,s].join("/")}function Jw({protocol:t,version:e,relayUrl:i,sdkVersion:r,auth:s,projectId:n,useOnCloseEvent:o,bundleId:a,packageName:c}){const l=i.split("?"),h=fu(t,e,r),u={auth:s,ua:h,projectId:n,useOnCloseEvent:o,packageName:c||void 0,bundleId:a||void 0},d=Kw(l[1]||"",u);return l[0]+"?"+d}function ti(t,e){return t.filter(i=>e.includes(i)).length===t.length}function Jn(t){return Object.fromEntries(t.entries())}function Zn(t){return new Map(Object.entries(t))}function Jt(t=L.FIVE_MINUTES,e){const i=L.toMiliseconds(t||L.FIVE_MINUTES);let r,s,n,o;return{resolve:a=>{n&&r&&(clearTimeout(n),r(a),o=Promise.resolve(a))},reject:a=>{n&&s&&(clearTimeout(n),s(a))},done:()=>new Promise((a,c)=>{if(o)return a(o);n=setTimeout(()=>{const l=new Error(e);o=Promise.reject(l),c(l)},i),r=a,s=c})}}function qt(t,e,i){return new Promise(async(r,s)=>{const n=setTimeout(()=>s(new Error(i)),e);try{const o=await t;r(o)}catch(o){s(o)}clearTimeout(n)})}function gu(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 Zw(t){return gu("topic",t)}function Xw(t){return gu("id",t)}function yu(t){const[e,i]=t.split(":"),r={id:void 0,topic:void 0};if(e==="topic"&&typeof i=="string")r.topic=i;else if(e==="id"&&Number.isInteger(Number(i)))r.id=Number(i);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${i}`);return r}function pe(t,e){return L.fromMiliseconds(Date.now()+L.toMiliseconds(t))}function kt(t){return Date.now()>=L.toMiliseconds(t)}function Q(t,e){return`${t}${e?`:${e}`:""}`}function us(t=[],e=[]){return[...new Set([...t,...e])]}async function Qw({id:t,topic:e,wcDeepLink:i}){var r;try{if(!i)return;const s=typeof i=="string"?JSON.parse(i):i,n=s==null?void 0:s.href;
vendor: 2,644 bytes, line 16
16if(typeof n!="string")return;const o=eb(n,t,e),a=Mr();if(a===Ge.browser){if(!((r=Nr())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}tb(o)}else a===Ge.reactNative&&typeof(window==null?void 0:window.Linking)<"u"&&await window.Linking.openURL(o)}catch(s){console.error(s)}}function eb(t,e,i){const r=`requestId=${e}&sessionTopic=${i}`;t.endsWith("/")&&(t=t.slice(0,-1));let s=`${t}`;if(t.startsWith("https://t.me")){const n=t.includes("?")?"&startapp=":"?startapp=";s=`${s}${n}${nb(r,!0)}`}else s=`${s}/wc?${r}`;return s}function tb(t){let e="_self";sb()?e="_top":(rb()||t.startsWith("https://")||t.startsWith("http://"))&&(e="_blank"),window.open(t,e,"noreferrer noopener")}async function ib(t,e){let i="";try{if(jr()&&(i=localStorage.getItem(e),i))return i;i=await t.getItem(e)}catch(r){console.error(r)}return i}function cc(t,e){if(!t.includes(e))return null;const i=t.split(/([&,?,=])/),r=i.indexOf(e);return i[r+2]}function lc(){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 Vo(){return typeof process<"u"&&Lw.IS_VITEST==="true"}function rb(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function sb(){try{return window.self!==window.top}catch{return!1}}function nb(t,e=!1){const i=Buffer.from(t).toString("base64");return e?i.replace(/[=]/g,""):i}function mu(t){return Buffer.from(t,"base64").toString("utf-8")}function ob(t){return new Promise(e=>setTimeout(e,t))}function Sr(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function ab(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Ur(t,...e){if(!ab(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function Ho(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Sr(t.outputLen),Sr(t.blockLen)}function qi(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function wu(t,e){Ur(t);const i=e.outputLen;if(t.length<i)throw new Error("digestInto() expects output buffer of length at least "+i)}const Zr=BigInt(2**32-1),hc=BigInt(32);function cb(t,e=!1){return e?{h:Number(t&Zr),l:Number(t>>hc&Zr)}:{h:Number(t>>hc&Zr)|0,l:Number(t&Zr)|0}}
16function lb(t,e=!1){let i=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let s=0;s<t.length;s++){const{h:n,l:o}=cb(t[s],e);[i[s],r[s]]=[n,o]}return[i,r]}const hb=(t,e,i)=>t<<i|e>>>32-i,ub=(t,e,i)=>e<<i|t>>>32-i,db=(t,e,i)=>e<<i-32|t>>>64-i,pb=(t,e,i)=>t<<i-32|e>>>64-i,wi=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function fb(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function dn(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function gt(t,e){return t<<32-e|t>>>e}const uc=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function gb(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function dc(t){for(let e=0;e<t.length;e++)t[e]=gb(t[e])}function yb(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function zi(t){return typeof t=="string"&&(t=yb(t)),Ur(t),t}function mb(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];Ur(s),e+=s.length}const i=new Uint8Array(e);for(let r=0,s=0;r<t.length;r++){const n=t[r];i.set(n,s),s+=n.length}return i}let Ko=class{clone(){return this._cloneInto()}};function bu(t){const e=r=>t().update(zi(r)).digest(),i=t();return e.outputLen=i.outputLen,e.blockLen=i.blockLen,e.create=()=>t(),e}function Qi(t=32){if(wi&&typeof wi.getRandomValues=="function")return wi.getRandomValues(new Uint8Array(t));if(wi&&typeof wi.randomBytes=="function")return wi.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}const vu=[],_u=[],Eu=[],wb=BigInt(0),cr=BigInt(1),bb=BigInt(2),vb=BigInt(7),_b=BigInt(256),Eb=BigInt(113);for(let t=0,e=cr,i=1,r=0;t<24;t++){[i,r]=[r,(2*i+3*r)%5],vu.push(2*(5*r+i)),_u.push((t+1)*(t+2)/2%64);let s=wb;for(let n=0;n<7;n++)e=(e<<cr^(e>>vb)*Eb)%_b,e&bb&&(s^=cr<<(cr<<BigInt(n))-cr);Eu.push(s)}const[Ib,Sb]=lb(Eu,!0),pc=(t,e,i)=>i>32?db(t,e,i):hb(t,e,i),fc=(t,e,i)=>i>32?pb(t,e,i):ub(t,e,i);function Ob(t,e=24){const i=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)i[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,l=i[c],h=i[c+1],u=pc(l,h,1)^i[a],d=fc(l,h,1)^i[a+1];for(let f=0;f<50;f+=10)t[o+f]^=u,t[o+f+1]^=d}let s=t[2],n=t[3];for(let o=0;o<24;o++){const a=_u[o],c=pc(s,n,a),l=fc(s,n,a),h=vu[o];s=t[h],n=t[h+1],t[h]=c,t[h+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)i[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~i[(a+2)%10]&i[(a+4)%10]}t[0]^=Ib[r],t[1]^=Sb[r]}i.fill(0)}let Pb=class Iu extends Ko{constructor(e,i,r,s=!1,n=24){if(super(),this.blockLen=e,this.suffix=i,this.outputLen=r,this.enableXOF=s,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Sr(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=fb(this.state)}keccak(){uc||dc(this.state32),Ob(this.state32,this.rounds),uc||dc(this.state32),this.posOut=0,this.pos=0}update(e){qi(this);const{blockLen:i,state:r}=this;e=zi(e);const s=e.length;for(let n=0;n<s;){const o=Math.min(i-this.pos,s-n);for(let a=0;a<o;a++)r[this.pos++]^=e[n++];this.pos===i&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:i,pos:r,blockLen:s}=this;e[r]^=i,i&128&&r===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){qi(this,!1),Ur(e),this.finish();const i=this.state,{blockLen:r}=this;for(let s=0,n=e.length;s<n;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,n-s);e.set(i.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Sr(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(wu(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:i,suffix:r,outputLen:s,rounds:n,enableXOF:o}=this;return e||(e=new Iu(i,r,s,o,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}};const $b=(t,e,i)=>bu(()=>new Pb(e,t,i)),Ab=$b(1,136,256/8),xb="https://rpc.walletconnect.org/v1";function Su(t){const e=`�Ethereum Signed Message: 17${t.length}`,i=new TextEncoder().encode(e+t);return"0x"+Buffer.from(Ab(i)).toString("hex")}async function Cb(t,e,i,r,s,n){switch(i.t){case"eip191":return await Rb(t,e,i.s);case"eip1271":return await Tb(t,e,i.s,r,s,n);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${i.t}`)}}async function Rb(t,e,i){return(await Ff({hash:Su(e),signature:i})).toLowerCase()===t.toLowerCase()}async function Tb(t,e,i,r,s,n){const o=Fi(r);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const a="0x1626ba7e",c="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",h=i.substring(2),u=Su(e).substring(2),d=a+u+c+l+h,f=await fetch(`${n||xb}/?chainId=${r}&projectId=${s}`,{method:"POST",body:JSON.stringify({id:Nb(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:d},"latest"]})}),{result:p}=await f.json();return p?p.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function Nb(){return Date.now()+Math.floor(Math.random()*1e3)}
vendor: 13,019 bytes, lines 17-19
17function Lb(t){const e=atob(t),i=new Uint8Array(e.length);for(let o=0;o<e.length;o++)i[o]=e.charCodeAt(o);const r=i[0];if(r===0)throw new Error("No signatures found");const s=1+r*64;if(i.length<s)throw new Error("Transaction data too short for claimed signature count");if(i.length<100)throw new Error("Transaction too short");const n=Buffer.from(t,"base64").slice(1,65);return Vf.encode(n)}var Db=Object.defineProperty,jb=Object.defineProperties,Mb=Object.getOwnPropertyDescriptors,gc=Object.getOwnPropertySymbols,Ub=Object.prototype.hasOwnProperty,Bb=Object.prototype.propertyIsEnumerable,yc=(t,e,i)=>e in t?Db(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,kb=(t,e)=>{for(var i in e||(e={}))Ub.call(e,i)&&yc(t,i,e[i]);if(gc)for(var i of gc(e))Bb.call(e,i)&&yc(t,i,e[i]);return t},Fb=(t,e)=>jb(t,Mb(e));const qb="did:pkh:",Wo=t=>t==null?void 0:t.split(":"),zb=t=>{const e=t&&Wo(t);if(e)return t.includes(qb)?e[3]:e[1]},Xn=t=>{const e=t&&Wo(t);if(e)return e[2]+":"+e[3]},Es=t=>{const e=t&&Wo(t);if(e)return e.pop()};async function mc(t){const{cacao:e,projectId:i}=t,{s:r,p:s}=e,n=Ou(s,s.iss),o=Es(s.iss);return await Cb(o,n,r,Xn(s.iss),i)}const Ou=(t,e)=>{const i=`${t.domain} wants you to sign in with your Ethereum account:`,r=Es(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let s=t.statement||void 0;const n=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${zb(e)}`,c=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,h=t.exp?`Expiration Time: ${t.exp}`:void 0,u=t.nbf?`Not Before: ${t.nbf}`:void 0,d=t.requestId?`Request ID: ${t.requestId}`:void 0,f=t.resources?`Resources:${t.resources.map(y=>` 18- ${y}`).join("")}`:void 0,p=ds(t.resources);if(p){const y=Or(p);s=Xb(s,y)}return[i,r,"",s,"",n,o,a,c,l,h,u,d,f].filter(y=>y!=null).join(` 19`)};function Vb(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function Hb(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function oi(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(i=>{const r=t.att[i];if(Array.isArray(r))throw new Error(`Resource must be an object: ${i}`);if(typeof r!="object")throw new Error(`Resource must be an object: ${i}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${i}`);Object.keys(r).forEach(s=>{const n=r[s];if(!Array.isArray(n))throw new Error(`Ability limits ${s} must be an array of objects, found: ${n}`);if(!n.length)throw new Error(`Value of ${s} is empty array, must be an array with objects`);n.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${s}) must be an array of objects, found: ${o}`)})})})}function Kb(t,e,i,r={}){return i==null||i.sort((s,n)=>s.localeCompare(n)),{att:{[t]:Wb(e,i,r)}}}function Wb(t,e,i={}){e=e==null?void 0:e.sort((s,n)=>s.localeCompare(n));const r=e.map(s=>({[`${t}/${s}`]:[i]}));return Object.assign({},...r)}function Pu(t){return oi(t),`urn:recap:${Vb(t).replace(/=/g,"")}`}function Or(t){const e=Hb(t.replace("urn:recap:",""));return oi(e),e}function Gb(t,e,i){const r=Kb(t,e,i);return Pu(r)}function Yb(t){return t&&t.includes("urn:recap:")}function Jb(t,e){const i=Or(t),r=Or(e),s=Zb(i,r);return Pu(s)}function Zb(t,e){oi(t),oi(e);const i=Object.keys(t.att).concat(Object.keys(e.att)).sort((s,n)=>s.localeCompare(n)),r={att:{}};return i.forEach(s=>{var n,o;Object.keys(((n=t.att)==null?void 0:n[s])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[s])||{})).sort((a,c)=>a.localeCompare(c)).forEach(a=>{var c,l;r.att[s]=Fb(kb({},r.att[s]),{[a]:((c=t.att[s])==null?void 0:c[a])||((l=e.att[s])==null?void 0:l[a])})})}),r}function Xb(t="",e){oi(e);const i="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(i))return t;const r=[];let s=0;Object.keys(e.att).forEach(a=>{const c=Object.keys(e.att[a]).map(u=>({ability:u.split("/")[0],action:u.split("/")[1]}));c.sort((u,d)=>u.action.localeCompare(d.action));const l={};c.forEach(u=>{l[u.ability]||(l[u.ability]=[]),l[u.ability].push(u.action)});const h=Object.keys(l).map(u=>(s++,`(${s}) '${u}': '${l[u].join("', '")}' for '${a}'.`));r.push(h.join(", ").replace(".,","."))});const n=r.join(" "),o=`${i}${n}`;return`${t?t+" ":""}${o}`}function wc(t){var e;const i=Or(t);oi(i);const r=(e=i.att)==null?void 0:e.eip155;return r?Object.keys(r).map(s=>s.split("/")[1]):[]}function bc(t){const e=Or(t);oi(e);const i=[];return Object.values(e.att).forEach(r=>{Object.values(r).forEach(s=>{var n;(n=s==null?void 0:s[0])!=null&&n.chains&&i.push(s[0].chains)})}),[...new Set(i.flat())]}function ds(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return Yb(e)?e:void 0}function pn(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function $u(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function We(t,...e){if(!$u(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function vc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Qb(t,e){We(t);const i=e.outputLen;if(t.length<i)throw new Error("digestInto() expects output buffer of length at least "+i)}function _c(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}const Vt=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),ev=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),tv=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!tv)throw new Error("Non little-endian hardware is not supported");function iv(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function Qn(t){if(typeof t=="string")t=iv(t);else if($u(t))t=eo(t);else throw new Error("Uint8Array expected, got "+typeof t);return t}function rv(t,e){if(e==null||typeof e!="object")throw new Error("options must be defined");return Object.assign(t,e)}function sv(t,e){if(t.length!==e.length)return!1;let i=0;for(let r=0;r<t.length;r++)i|=t[r]^e[r];return i===0}const nv=(t,e)=>{function i(r,...s){if(We(r),t.nonceLength!==void 0){const l=s[0];if(!l)throw new Error("nonce / iv required");t.varSizeNonce?We(l):We(l,t.nonceLength)}const n=t.tagLength;n&&s[1]!==void 0&&We(s[1]);const o=e(r,...s),a=(l,h)=>{if(h!==void 0){if(l!==2)throw new Error("cipher output not supported");We(h)}};let c=!1;return{encrypt(l,h){if(c)throw new Error("cannot encrypt() twice with same key + nonce");return c=!0,We(l),a(o.encrypt.length,h),o.encrypt(l,h)},decrypt(l,h){if(We(l),n&&l.length<n)throw new Error("invalid ciphertext length: smaller than tagLength="+n);return a(o.decrypt.length,h),o.decrypt(l,h)}}}return Object.assign(i,t),i};function Ec(t,e,i=!0){if(e===void 0)return new Uint8Array(t);if(e.length!==t)throw new Error("invalid output length, expected "+t+", got: "+e.length);if(i&&!ov(e))throw new Error("invalid output, must be aligned");return e}function Ic(t,e,i,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,i,r);const s=BigInt(32),n=BigInt(4294967295),o=Number(i>>s&n),a=Number(i&n);t.setUint32(e+4,o,r),t.setUint32(e+0,a,r)}function ov(t){return t.byteOffset%4===0}function eo(t){return Uint8Array.from(t)}function Vi(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}const Au=t=>Uint8Array.from(t.split("").map(e=>e.charCodeAt(0))),av=Au("expand 16-byte k"),cv=Au("expand 32-byte k"),lv=Vt(av),hv=Vt(cv);function J(t,e){return t<<e|t>>>32-e}function to(t){return t.byteOffset%4===0}const Xr=64,uv=16,xu=2**32-1,Sc=new Uint32Array;function dv(t,e,i,r,s,n,o,a){const c=s.length,l=new Uint8Array(Xr),h=Vt(l),u=to(s)&&to(n),d=u?Vt(s):Sc,f=u?Vt(n):Sc;for(let p=0;p<c;o++){if(t(e,i,r,h,o,a),o>=xu)throw new Error("arx: counter overflow");const y=Math.min(Xr,c-p);if(u&&y===Xr){const w=p/4;if(p%4!==0)throw new Error("arx: invalid block position");for(let v=0,b;v<uv;v++)b=w+v,f[b]=d[b]^h[v];p+=Xr;continue}for(let w=0,v;w<y;w++)v=p+w,n[v]=s[v]^l[w];p+=y}}function pv(t,e){const{allowShortKeys:i,extendNonceFn:r,counterLength:s,counterRight:n,rounds:o}=rv({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if(typeof t!="function")throw new Error("core must be a function");return pn(s),pn(o),_c(n),_c(i),(a,c,l,h,u=0)=>{We(a),We(c),We(l);const d=l.length;if(h===void 0&&(h=new Uint8Array(d)),We(h),pn(u),u<0||u>=xu)throw new Error("arx: counter overflow");if(h.length<d)throw new Error(`arx: output (${h.length}) is shorter than data (${d})`);const f=[];let p=a.length,y,w;if(p===32)f.push(y=eo(a)),w=hv;else if(p===16&&i)y=new Uint8Array(32),y.set(a),y.set(a,16),w=lv,f.push(y);else throw new Error(`arx: invalid 32-byte key, got length=${p}`);to(c)||f.push(c=eo(c));const v=Vt(y);if(r){if(c.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(w,v,Vt(c.subarray(0,16)),v),c=c.subarray(16)}const b=16-s;if(b!==c.length)throw new Error(`arx: nonce must be ${b} or 16 bytes`);if(b!==12){const I=new Uint8Array(12);I.set(c,n?0:12-c.length),c=I,f.push(c)}const _=Vt(c);return dv(t,w,v,_,l,h,u,o),Vi(...f),h}}const Ie=(t,e)=>t[e++]&255|(t[e++]&255)<<8;class fv{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=Qn(e),We(e,32);const i=Ie(e,0),r=Ie(e,2),s=Ie(e,4),n=Ie(e,6),o=Ie(e,8),a=Ie(e,10),c=Ie(e,12),l=Ie(e,14);this.r[0]=i&8191,this.r[1]=(i>>>13|r<<3)&8191,this.r[2]=(r>>>10|s<<6)&7939,this.r[3]=(s>>>7|n<<9)&8191,this.r[4]=(n>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|a<<2)&8191,this.r[7]=(a>>>11|c<<5)&8065,this.r[8]=(c>>>8|l<<8)&8191,this.r[9]=l>>>5&127;for(let h=0;h<8;h++)this.pad[h]=Ie(e,16+2*h)}process(e,i,r=!1){const s=r?0:2048,{h:n,r:o}=this,a=o[0],c=o[1],l=o[2],h=o[3],u=o[4],d=o[5],f=o[6],p=o[7],y=o[8],w=o[9],v=Ie(e,i+0),b=Ie(e,i+2),_=Ie(e,i+4),I=Ie(e,i+6),A=Ie(e,i+8),x=Ie(e,i+10),$=Ie(e,i+12),R=Ie(e,i+14);let O=n[0]+(v&8191),F=n[1]+((v>>>13|b<<3)&8191),M=n[2]+((b>>>10|_<<6)&8191),j=n[3]+((_>>>7|I<<9)&8191),q=n[4]+((I>>>4|A<<12)&8191),T=n[5]+(A>>>1&8191),g=n[6]+((A>>>14|x<<2)&8191),m=n[7]+((x>>>11|$<<5)&8191),E=n[8]+(($>>>8|R<<8)&8191),P=n[9]+(R>>>5|s),S=0,C=S+O*a+F*(5*w)+M*(5*y)+j*(5*p)+q*(5*f);S=C>>>13,C&=8191,C+=T*(5*d)+g*(5*u)+m*(5*h)+E*(5*l)+P*(5*c),S+=C>>>13,C&=8191;let U=S+O*c+F*a+M*(5*w)+j*(5*y)+q*(5*p);S=U>>>13,U&=8191,U+=T*(5*f)+g*(5*d)+m*(5*u)+E*(5*h)+P*(5*l),S+=U>>>13,U&=8191;let k=S+O*l+F*c+M*a+j*(5*w)+q*(5*y);S=k>>>13,k&=8191,k+=T*(5*p)+g*(5*f)+m*(5*d)+E*(5*u)+P*(5*h),S+=k>>>13,k&=8191;let z=S+O*h+F*l+M*c+j*a+q*(5*w);S=z>>>13,z&=8191,z+=T*(5*y)+g*(5*p)+m*(5*f)+E*(5*d)+P*(5*u),S+=z>>>13,z&=8191;let B=S+O*u+F*h+M*l+j*c+q*a;S=B>>>13,B&=8191,B+=T*(5*w)+g*(5*y)+m*(5*p)+E*(5*f)+P*(5*d),S+=B>>>13,B&=8191;let V=S+O*d+F*u+M*h+j*l+q*c;S=V>>>13,V&=8191,V+=T*a+g*(5*w)+m*(5*y)+E*(5*p)+P*(5*f),S+=V>>>13,V&=8191;let G=S+O*f+F*d+M*u+j*h+q*l;S=G>>>13,G&=8191,G+=T*c+g*a+m*(5*w)+E*(5*y)+P*(5*p),S+=G>>>13,G&=8191;let ne=S+O*p+F*f+M*d+j*u+q*h;S=ne>>>13,ne&=8191,ne+=T*l+g*c+m*a+E*(5*w)+P*(5*y),S+=ne>>>13,ne&=8191;let ee=S+O*y+F*p+M*f+j*d+q*u;S=ee>>>13,ee&=8191,ee+=T*h+g*l+m*c+E*a+P*(5*w),S+=ee>>>13,ee&=8191;let Y=S+O*w+F*y+M*p+j*f+q*d;S=Y>>>13,Y&=8191,Y+=T*u+g*h+m*l+E*c+P*a,S+=Y>>>13,Y&=8191,S=(S<<2)+S|0,S=S+C|0,C=S&8191,S=S>>>13,U+=S,n[0]=C,n[1]=U,n[2]=k,n[3]=z,n[4]=B,n[5]=V,n[6]=G,n[7]=ne,n[8]=ee,n[9]=Y}finalize(){const{h:e,pad:i}=this,r=new Uint16Array(10);let s=e[1]>>>13;e[1]&=8191;for(let a=2;a<10;a++)e[a]+=s,s=e[a]>>>13,e[a]&=8191;e[0]+=s*5,s=e[0]>>>13,e[0]&=8191,e[1]+=s,s=e[1]>>>13,e[1]&=8191,e[2]+=s,r[0]=e[0]+5,s=r[0]>>>13,r[0]&=8191;for(let a=1;a<10;a++)r[a]=e[a]+s,s=r[a]>>>13,r[a]&=8191;r[9]-=8192;let n=(s^1)-1;for(let a=0;a<10;a++)r[a]&=n;n=~n;for(let a=0;a<10;a++)e[a]=e[a]&n|r[a];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let o=e[0]+i[0];e[0]=o&65535;for(let a=1;a<8;a++)o=(e[a]+i[a]|0)+(o>>>16)|0,e[a]=o&65535;Vi(r)}update(e){vc(this);const{buffer:i,blockLen:r}=this;e=Qn(e);const s=e.length;for(let n=0;n<s;){const o=Math.min(r-this.pos,s-n);if(o===r){for(;r<=s-n;n+=r)this.process(e,n);continue}i.set(e.subarray(n,n+o),this.pos),this.pos+=o,n+=o,this.pos===r&&(this.process(i,0,!1),this.pos=0)}return this}destroy(){Vi(this.h,this.r,this.buffer,this.pad)}digestInto(e){vc(this),Qb(e,this),this.finished=!0;const{buffer:i,h:r}=this;let{pos:s}=this;if(s){for(i[s++]=1;s<16;s++)i[s]=0;this.process(i,0,!0)}this.finalize();let n=0;for(let o=0;o<8;o++)e[n++]=r[o]>>>0,e[n++]=r[o]>>>8;return e}digest(){const{buffer:e,outputLen:i}=this;this.digestInto(e);const r=e.slice(0,i);return this.destroy(),r}}
19function gv(t){const e=(r,s)=>t(s).update(Qn(r)).digest(),i=t(new Uint8Array(32));return e.outputLen=i.outputLen,e.blockLen=i.blockLen,e.create=r=>t(r),e}const yv=gv(t=>new fv(t));function mv(t,e,i,r,s,n=20){let o=t[0],a=t[1],c=t[2],l=t[3],h=e[0],u=e[1],d=e[2],f=e[3],p=e[4],y=e[5],w=e[6],v=e[7],b=s,_=i[0],I=i[1],A=i[2],x=o,$=a,R=c,O=l,F=h,M=u,j=d,q=f,T=p,g=y,m=w,E=v,P=b,S=_,C=I,U=A;for(let z=0;z<n;z+=2)x=x+F|0,P=J(P^x,16),T=T+P|0,F=J(F^T,12),x=x+F|0,P=J(P^x,8),T=T+P|0,F=J(F^T,7),$=$+M|0,S=J(S^$,16),g=g+S|0,M=J(M^g,12),$=$+M|0,S=J(S^$,8),g=g+S|0,M=J(M^g,7),R=R+j|0,C=J(C^R,16),m=m+C|0,j=J(j^m,12),R=R+j|0,C=J(C^R,8),m=m+C|0,j=J(j^m,7),O=O+q|0,U=J(U^O,16),E=E+U|0,q=J(q^E,12),O=O+q|0,U=J(U^O,8),E=E+U|0,q=J(q^E,7),x=x+M|0,U=J(U^x,16),m=m+U|0,M=J(M^m,12),x=x+M|0,U=J(U^x,8),m=m+U|0,M=J(M^m,7),$=$+j|0,P=J(P^$,16),E=E+P|0,j=J(j^E,12),$=$+j|0,P=J(P^$,8),E=E+P|0,j=J(j^E,7),R=R+q|0,S=J(S^R,16),T=T+S|0,q=J(q^T,12),R=R+q|0,S=J(S^R,8),T=T+S|0,q=J(q^T,7),O=O+F|0,C=J(C^O,16),g=g+C|0,F=J(F^g,12),O=O+F|0,C=J(C^O,8),g=g+C|0,F=J(F^g,7);let k=0;r[k++]=o+x|0,r[k++]=a+$|0,r[k++]=c+R|0,r[k++]=l+O|0,r[k++]=h+F|0,r[k++]=u+M|0,r[k++]=d+j|0,r[k++]=f+q|0,r[k++]=p+T|0,r[k++]=y+g|0,r[k++]=w+m|0,r[k++]=v+E|0,r[k++]=b+P|0,r[k++]=_+S|0,r[k++]=I+C|0,r[k++]=A+U|0}const wv=pv(mv,{counterRight:!1,counterLength:4,allowShortKeys:!1}),bv=new Uint8Array(16),Oc=(t,e)=>{t.update(e);const i=e.length%16;i&&t.update(bv.subarray(i))},vv=new Uint8Array(32);function Pc(t,e,i,r,s){const n=t(e,i,vv),o=yv.create(n);s&&Oc(o,s),Oc(o,r);const a=new Uint8Array(16),c=ev(a);Ic(c,0,BigInt(s?s.length:0),!0),Ic(c,8,BigInt(r.length),!0),o.update(a);const l=o.digest();return Vi(n,a),l}const _v=t=>(e,i,r)=>({encrypt(s,n){const o=s.length;n=Ec(o+16,n,!1),n.set(s);const a=n.subarray(0,-16);t(e,i,a,a,1);const c=Pc(t,e,i,a,r);return n.set(c,o),Vi(c),n},decrypt(s,n){n=Ec(s.length-16,n,!1);const o=s.subarray(0,-16),a=s.subarray(-16),c=Pc(t,e,i,o,r);if(!sv(a,c))throw new Error("invalid tag");return n.set(s.subarray(0,-16)),t(e,i,n,n,1),Vi(c),n}}),Cu=nv({blockSize:64,nonceLength:12,tagLength:16},_v(wv));let Ru=class extends Ko{constructor(e,i){super(),this.finished=!1,this.destroyed=!1,Ho(e);const r=zi(i);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,n=new Uint8Array(s);n.set(r.length>s?e.create().update(r).digest():r);for(let o=0;o<n.length;o++)n[o]^=54;this.iHash.update(n),this.oHash=e.create();for(let o=0;o<n.length;o++)n[o]^=106;this.oHash.update(n),n.fill(0)}update(e){return qi(this),this.iHash.update(e),this}digestInto(e){qi(this),Ur(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:i,iHash:r,finished:s,destroyed:n,blockLen:o,outputLen:a}=this;return e=e,e.finished=s,e.destroyed=n,e.blockLen=o,e.outputLen=a,e.oHash=i._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const Ms=(t,e,i)=>new Ru(t,e).update(i).digest();Ms.create=(t,e)=>new Ru(t,e);function Ev(t,e,i){return Ho(t),i===void 0&&(i=new Uint8Array(t.outputLen)),Ms(t,zi(i),zi(e))}const fn=new Uint8Array([0]),$c=new Uint8Array;function Iv(t,e,i,r=32){if(Ho(t),Sr(r),r>255*t.outputLen)throw new Error("Length should be <= 255*HashLen");const s=Math.ceil(r/t.outputLen);i===void 0&&(i=$c);const n=new Uint8Array(s*t.outputLen),o=Ms.create(t,e),a=o._cloneInto(),c=new Uint8Array(o.outputLen);for(let l=0;l<s;l++)fn[0]=l+1,a.update(l===0?$c:c).update(i).update(fn).digestInto(c),n.set(c,t.outputLen*l),o._cloneInto(a);return o.destroy(),a.destroy(),c.fill(0),fn.fill(0),n.slice(0,r)}const Sv=(t,e,i,r,s)=>Iv(t,Ev(t,e,i),r,s);function Ov(t,e,i,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,i,r);const s=BigInt(32),n=BigInt(4294967295),o=Number(i>>s&n),a=Number(i&n),c=r?4:0,l=r?0:4;t.setUint32(e+c,o,r),t.setUint32(e+l,a,r)}function Pv(t,e,i){return t&e^~t&i}function $v(t,e,i){return t&e^t&i^e&i}
vendor: 9,977 bytes, line 19
19let Av=class extends Ko{constructor(e,i,r,s){super(),this.blockLen=e,this.outputLen=i,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=dn(this.buffer)}update(e){qi(this);const{view:i,buffer:r,blockLen:s}=this;e=zi(e);const n=e.length;for(let o=0;o<n;){const a=Math.min(s-this.pos,n-o);if(a===s){const c=dn(e);for(;s<=n-o;o+=s)this.process(c,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(i,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){qi(this),wu(e,this),this.finished=!0;const{buffer:i,view:r,blockLen:s,isLE:n}=this;let{pos:o}=this;i[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(r,0),o=0);for(let u=o;u<s;u++)i[u]=0;Ov(r,s-8,BigInt(this.length*8),n),this.process(r,0);const a=dn(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)a.setUint32(4*u,h[u],n)}digest(){const{buffer:e,outputLen:i}=this;this.digestInto(e);const r=e.slice(0,i);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:i,buffer:r,length:s,finished:n,destroyed:o,pos:a}=this;return e.length=s,e.pos=a,e.finished=n,e.destroyed=o,s%i&&e.buffer.set(r),e}};const xv=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ut=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Bt=new Uint32Array(64);class Cv extends Av{constructor(){super(64,32,8,!1),this.A=Ut[0]|0,this.B=Ut[1]|0,this.C=Ut[2]|0,this.D=Ut[3]|0,this.E=Ut[4]|0,this.F=Ut[5]|0,this.G=Ut[6]|0,this.H=Ut[7]|0}get(){const{A:e,B:i,C:r,D:s,E:n,F:o,G:a,H:c}=this;return[e,i,r,s,n,o,a,c]}set(e,i,r,s,n,o,a,c){this.A=e|0,this.B=i|0,this.C=r|0,this.D=s|0,this.E=n|0,this.F=o|0,this.G=a|0,this.H=c|0}process(e,i){for(let u=0;u<16;u++,i+=4)Bt[u]=e.getUint32(i,!1);for(let u=16;u<64;u++){const d=Bt[u-15],f=Bt[u-2],p=gt(d,7)^gt(d,18)^d>>>3,y=gt(f,17)^gt(f,19)^f>>>10;Bt[u]=y+Bt[u-7]+p+Bt[u-16]|0}let{A:r,B:s,C:n,D:o,E:a,F:c,G:l,H:h}=this;for(let u=0;u<64;u++){const d=gt(a,6)^gt(a,11)^gt(a,25),f=h+d+Pv(a,c,l)+xv[u]+Bt[u]|0,p=(gt(r,2)^gt(r,13)^gt(r,22))+$v(r,s,n)|0;h=l,l=c,c=a,a=o+f|0,o=n,n=s,s=r,r=f+p|0}r=r+this.A|0,s=s+this.B|0,n=n+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,h=h+this.H|0,this.set(r,s,n,o,a,c,l,h)}roundClean(){Bt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Br=bu(()=>new Cv);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Us=BigInt(0),Bs=BigInt(1),Rv=BigInt(2);function ai(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function kr(t){if(!ai(t))throw new Error("Uint8Array expected")}function Hi(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}const Tv=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Ki(t){kr(t);let e="";for(let i=0;i<t.length;i++)e+=Tv[t[i]];return e}function Ui(t){const e=t.toString(16);return e.length&1?"0"+e:e}function Go(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?Us:BigInt("0x"+t)}const $t={_0:48,_9:57,A:65,F:70,a:97,f:102};function Ac(t){if(t>=$t._0&&t<=$t._9)return t-$t._0;if(t>=$t.A&&t<=$t.F)return t-($t.A-10);if(t>=$t.a&&t<=$t.f)return t-($t.a-10)}function Wi(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,i=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(i);for(let s=0,n=0;s<i;s++,n+=2){const o=Ac(t.charCodeAt(n)),a=Ac(t.charCodeAt(n+1));if(o===void 0||a===void 0){const c=t[n]+t[n+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+n)}r[s]=o*16+a}return r}function ri(t){return Go(Ki(t))}function Pr(t){return kr(t),Go(Ki(Uint8Array.from(t).reverse()))}function Gi(t,e){return Wi(t.toString(16).padStart(e*2,"0"))}function ks(t,e){return Gi(t,e).reverse()}function Nv(t){return Wi(Ui(t))}function Ke(t,e,i){let r;if(typeof e=="string")try{r=Wi(e)}catch(n){throw new Error(t+" must be hex string or Uint8Array, cause: "+n)}else if(ai(e))r=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const s=r.length;if(typeof i=="number"&&s!==i)throw new Error(t+" of length "+i+" expected, got "+s);return r}function $r(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];kr(s),e+=s.length}const i=new Uint8Array(e);for(let r=0,s=0;r<t.length;r++){const n=t[r];i.set(n,s),s+=n.length}return i}function Lv(t,e){if(t.length!==e.length)return!1;let i=0;for(let r=0;r<t.length;r++)i|=t[r]^e[r];return i===0}function Dv(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}const gn=t=>typeof t=="bigint"&&Us<=t;function Fs(t,e,i){return gn(t)&&gn(e)&&gn(i)&&e<=t&&t<i}function Nt(t,e,i,r){if(!Fs(e,i,r))throw new Error("expected valid "+t+": "+i+" <= n < "+r+", got "+e)}function Tu(t){let e;for(e=0;t>Us;t>>=Bs,e+=1);return e}function jv(t,e){return t>>BigInt(e)&Bs}function Mv(t,e,i){return t|(i?Bs:Us)<<BigInt(e)}const Yo=t=>(Rv<<BigInt(t-1))-Bs,yn=t=>new Uint8Array(t),xc=t=>Uint8Array.from(t);function Nu(t,e,i){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof i!="function")throw new Error("hmacFn must be a function");let r=yn(t),s=yn(t),n=0;const o=()=>{r.fill(1),s.fill(0),n=0},a=(...h)=>i(s,r,...h),c=(h=yn())=>{s=a(xc([0]),h),r=a(),h.length!==0&&(s=a(xc([1]),h),r=a())},l=()=>{if(n++>=1e3)throw new Error("drbg: tried 1000 values");let h=0;const u=[];for(;h<e;){r=a();const d=r.slice();u.push(d),h+=r.length}return $r(...u)};return(h,u)=>{o(),c(h);let d;for(;!(d=u(l()));)c();return o(),d}}const Uv={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||ai(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function er(t,e,i={}){const r=(s,n,o)=>{const a=Uv[n];if(typeof a!="function")throw new Error("invalid validator function");const c=t[s];if(!(o&&c===void 0)&&!a(c,t))throw new Error("param "+String(s)+" is invalid. Expected "+n+", got "+c)};for(const[s,n]of Object.entries(e))r(s,n,!1);for(const[s,n]of Object.entries(i))r(s,n,!0);return t}const Bv=()=>{throw new Error("not implemented")};function io(t){const e=new WeakMap;return(i,...r)=>{const s=e.get(i);if(s!==void 0)return s;const n=t(i,...r);return e.set(i,n),n}}var kv=Object.freeze({__proto__:null,isBytes:ai,abytes:kr,abool:Hi,bytesToHex:Ki,numberToHexUnpadded:Ui,hexToNumber:Go,hexToBytes:Wi,bytesToNumberBE:ri,bytesToNumberLE:Pr,numberToBytesBE:Gi,numberToBytesLE:ks,numberToVarBytesBE:Nv,ensureBytes:Ke,concatBytes:$r,equalBytes:Lv,utf8ToBytes:Dv,inRange:Fs,aInRange:Nt,bitLen:Tu,bitGet:jv,bitSet:Mv,bitMask:Yo,createHmacDrbg:Nu,validateObject:er,notImplemented:Bv,memoized:io});const _e=BigInt(0),he=BigInt(1),Xt=BigInt(2),Fv=BigInt(3),ro=BigInt(4),Cc=BigInt(5),Rc=BigInt(8);function ke(t,e){const i=t%e;return i>=_e?i:e+i}function Lu(t,e,i){if(e<_e)throw new Error("invalid exponent, negatives unsupported");if(i<=_e)throw new Error("invalid modulus");if(i===he)return _e;let r=he;for(;e>_e;)e&he&&(r=r*t%i),t=t*t%i,e>>=he;return r}function ht(t,e,i){let r=t;for(;e-- >_e;)r*=r,r%=i;return r}function so(t,e){if(t===_e)throw new Error("invert: expected non-zero number");if(e<=_e)throw new Error("invert: expected positive modulus, got "+e);let i=ke(t,e),r=e,s=_e,n=he;for(;i!==_e;){const o=r/i,a=r%i,c=s-n*o;r=i,i=a,s=n,n=c}if(r!==he)throw new Error("invert: does not exist");return ke(s,e)}function qv(t){const e=(t-he)/Xt;let i,r,s;for(i=t-he,r=0;i%Xt===_e;i/=Xt,r++);for(s=Xt;s<t&&Lu(s,e,t)!==t-he;s++)if(s>1e3)throw new Error("Cannot find square root: likely non-prime P");if(r===1){const o=(t+he)/ro;return function(a,c){const l=a.pow(c,o);if(!a.eql(a.sqr(l),c))throw new Error("Cannot find square root");return l}}const n=(i+he)/Xt;return function(o,a){if(o.pow(a,e)===o.neg(o.ONE))throw new Error("Cannot find square root");let c=r,l=o.pow(o.mul(o.ONE,s),i),h=o.pow(a,n),u=o.pow(a,i);for(;!o.eql(u,o.ONE);){if(o.eql(u,o.ZERO))return o.ZERO;let d=1;for(let p=o.sqr(u);d<c&&!o.eql(p,o.ONE);d++)p=o.sqr(p);const f=o.pow(l,he<<BigInt(c-d-1));l=o.sqr(f),h=o.mul(h,f),u=o.mul(u,l),c=d}return h}}function zv(t){if(t%ro===Fv){const e=(t+he)/ro;return function(i,r){const s=i.pow(r,e);if(!i.eql(i.sqr(s),r))throw new Error("Cannot find square root");return s}}if(t%Rc===Cc){const e=(t-Cc)/Rc;return function(i,r){const s=i.mul(r,Xt),n=i.pow(s,e),o=i.mul(r,n),a=i.mul(i.mul(o,Xt),n),c=i.mul(o,i.sub(a,i.ONE));if(!i.eql(i.sqr(c),r))throw new Error("Cannot find square root");return c}}return qv(t)}const Vv=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Hv(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},i=Vv.reduce((r,s)=>(r[s]="function",r),e);
19return er(t,i)}function Kv(t,e,i){if(i<_e)throw new Error("invalid exponent, negatives unsupported");if(i===_e)return t.ONE;if(i===he)return e;let r=t.ONE,s=e;for(;i>_e;)i&he&&(r=t.mul(r,s)),s=t.sqr(s),i>>=he;return r}function Wv(t,e){const i=new Array(e.length),r=e.reduce((n,o,a)=>t.is0(o)?n:(i[a]=n,t.mul(n,o)),t.ONE),s=t.inv(r);return e.reduceRight((n,o,a)=>t.is0(o)?n:(i[a]=t.mul(n,i[a]),t.mul(n,o)),s),i}function Du(t,e){const i=e!==void 0?e:t.toString(2).length,r=Math.ceil(i/8);return{nBitLength:i,nByteLength:r}}function ju(t,e,i=!1,r={}){if(t<=_e)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:s,nByteLength:n}=Du(t,e);if(n>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:t,isLE:i,BITS:s,BYTES:n,MASK:Yo(s),ZERO:_e,ONE:he,create:c=>ke(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return _e<=c&&c<t},is0:c=>c===_e,isOdd:c=>(c&he)===he,neg:c=>ke(-c,t),eql:(c,l)=>c===l,sqr:c=>ke(c*c,t),add:(c,l)=>ke(c+l,t),sub:(c,l)=>ke(c-l,t),mul:(c,l)=>ke(c*l,t),pow:(c,l)=>Kv(a,c,l),div:(c,l)=>ke(c*so(l,t),t),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>so(c,t),sqrt:r.sqrt||(c=>(o||(o=zv(t)),o(a,c))),invertBatch:c=>Wv(a,c),cmov:(c,l,h)=>h?l:c,toBytes:c=>i?ks(c,n):Gi(c,n),fromBytes:c=>{if(c.length!==n)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+c.length);return i?Pr(c):ri(c)}});return Object.freeze(a)}function Mu(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function Uu(t){const e=Mu(t);return e+Math.ceil(e/2)}function Gv(t,e,i=!1){const r=t.length,s=Mu(e),n=Uu(e);if(r<16||r<n||r>1024)throw new Error("expected "+n+"-1024 bytes of input, got "+r);const o=i?Pr(t):ri(t),a=ke(o,e-he)+he;return i?ks(a,s):Gi(a,s)}const Tc=BigInt(0),Qr=BigInt(1);function mn(t,e){const i=e.negate();return t?i:e}function Bu(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function wn(t,e){Bu(t,e);const i=Math.ceil(e/t)+1,r=2**(t-1);return{windows:i,windowSize:r}}function Yv(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((i,r)=>{if(!(i instanceof e))throw new Error("invalid point at index "+r)})}function Jv(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((i,r)=>{if(!e.isValid(i))throw new Error("invalid scalar at index "+r)})}const bn=new WeakMap,ku=new WeakMap;function vn(t){return ku.get(t)||1}function Zv(t,e){return{constTimeNegate:mn,hasPrecomputes(i){return vn(i)!==1},unsafeLadder(i,r,s=t.ZERO){let n=i;for(;r>Tc;)r&Qr&&(s=s.add(n)),n=n.double(),r>>=Qr;return s},precomputeWindow(i,r){const{windows:s,windowSize:n}=wn(r,e),o=[];let a=i,c=a;for(let l=0;l<s;l++){c=a,o.push(c);for(let h=1;h<n;h++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(i,r,s){const{windows:n,windowSize:o}=wn(i,e);let a=t.ZERO,c=t.BASE;const l=BigInt(2**i-1),h=2**i,u=BigInt(i);for(let d=0;d<n;d++){const f=d*o;let p=Number(s&l);s>>=u,p>o&&(p-=h,s+=Qr);const y=f,w=f+Math.abs(p)-1,v=d%2!==0,b=p<0;p===0?c=c.add(mn(v,r[y])):a=a.add(mn(b,r[w]))}return{p:a,f:c}},wNAFUnsafe(i,r,s,n=t.ZERO){const{windows:o,windowSize:a}=wn(i,e),c=BigInt(2**i-1),l=2**i,h=BigInt(i);for(let u=0;u<o;u++){const d=u*a;if(s===Tc)break;let f=Number(s&c);if(s>>=h,f>a&&(f-=l,s+=Qr),f===0)continue;let p=r[d+Math.abs(f)-1];f<0&&(p=p.negate()),n=n.add(p)}return n},getPrecomputes(i,r,s){let n=bn.get(r);return n||(n=this.precomputeWindow(r,i),i!==1&&bn.set(r,s(n))),n},wNAFCached(i,r,s){const n=vn(i);return this.wNAF(n,this.getPrecomputes(n,i,s),r)},wNAFCachedUnsafe(i,r,s,n){const o=vn(i);return o===1?this.unsafeLadder(i,r,n):this.wNAFUnsafe(o,this.getPrecomputes(o,i,s),r,n)},setWindowSize(i,r){Bu(r,e),ku.set(i,r),bn.delete(i)}}}function Xv(t,e,i,r){if(Yv(i,t),Jv(r,e),i.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const s=t.ZERO,n=Tu(BigInt(i.length)),o=n>12?n-3:n>4?n-2:n?2:1,a=(1<<o)-1,c=new Array(a+1).fill(s),l=Math.floor((e.BITS-1)/o)*o;let h=s;for(let u=l;u>=0;u-=o){c.fill(s);for(let f=0;f<r.length;f++){const p=r[f],y=Number(p>>BigInt(u)&BigInt(a));c[y]=c[y].add(i[f])}let d=s;for(let f=c.length-1,p=s;f>0;f--)p=p.add(c[f]),d=d.add(p);if(h=h.add(d),u!==0)for(let f=0;f<o;f++)h=h.double()}return h}function Fu(t){return Hv(t.Fp),er(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Du(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}BigInt(0),BigInt(1),BigInt(2),BigInt(8);const bi=BigInt(0),_n=BigInt(1);function Qv(t){return er(t,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...t})}function e0(t){const e=Qv(t),{P:i}=e,r=b=>ke(b,i),s=e.montgomeryBits,n=Math.ceil(s/8),o=e.nByteLength,a=e.adjustScalarBytes||(b=>b),c=e.powPminus2||(b=>Lu(b,i-BigInt(2),i));function l(b,_,I){const A=r(b*(_-I));return _=r(_-A),I=r(I+A),[_,I]}const h=(e.a-BigInt(2))/BigInt(4);function u(b,_){Nt("u",b,bi,i),Nt("scalar",_,bi,i);const I=_,A=b;let x=_n,$=bi,R=b,O=_n,F=bi,M;for(let q=BigInt(s-1);q>=bi;q--){const T=I>>q&_n;F^=T,M=l(F,x,R),x=M[0],R=M[1],M=l(F,$,O),$=M[0],O=M[1],F=T;const g=x+$,m=r(g*g),E=x-$,P=r(E*E),S=m-P,C=R+O,U=R-O,k=r(U*g),z=r(C*E),B=k+z,V=k-z;R=r(B*B),O=r(A*r(V*V)),x=r(m*P),$=r(S*(m+r(h*S)))}M=l(F,x,R),x=M[0],R=M[1],M=l(F,$,O),$=M[0],O=M[1];const j=c($);return r(x*j)}function d(b){return ks(r(b),n)}function f(b){const _=Ke("u coordinate",b,n);return o===32&&(_[31]&=127),Pr(_)}function p(b){const _=Ke("scalar",b),I=_.length;if(I!==n&&I!==o){let A=""+n+" or "+o;throw new Error("invalid scalar, expected "+A+" bytes, got "+I)}return Pr(a(_))}function y(b,_){const I=f(_),A=p(b),x=u(I,A);if(x===bi)throw new Error("invalid private or public key received");return d(x)}const w=d(e.Gu);function v(b){return y(b,w)}return{scalarMult:y,scalarMultBase:v,getSharedSecret:(b,_)=>y(b,_),getPublicKey:b=>v(b),utils:{randomPrivateKey:()=>e.randomBytes(e.nByteLength)},GuBytes:w}}const no=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");BigInt(0);const t0=BigInt(1),Nc=BigInt(2),i0=BigInt(3),r0=BigInt(5);BigInt(8);function s0(t){const e=BigInt(10),i=BigInt(20),r=BigInt(40),s=BigInt(80),n=no,o=t*t%n*t%n,a=ht(o,Nc,n)*o%n,c=ht(a,t0,n)*t%n,l=ht
vendor: 8,428 bytes, line 19
19(c,r0,n)*c%n,h=ht(l,e,n)*l%n,u=ht(h,i,n)*h%n,d=ht(u,r,n)*u%n,f=ht(d,s,n)*d%n,p=ht(f,s,n)*d%n,y=ht(p,e,n)*l%n;return{pow_p_5_8:ht(y,Nc,n)*t%n,b2:o}}function n0(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}const oo=e0({P:no,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:t=>{const e=no,{pow_p_5_8:i,b2:r}=s0(t);return ke(ht(i,i0,e)*r,e)},adjustScalarBytes:n0,randomBytes:Qi});function Lc(t){t.lowS!==void 0&&Hi("lowS",t.lowS),t.prehash!==void 0&&Hi("prehash",t.prehash)}function o0(t){const e=Fu(t);er(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:i,Fp:r,a:s}=e;if(i){if(!r.eql(s,r.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof i!="object"||typeof i.beta!="bigint"||typeof i.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:a0,hexToBytes:c0}=kv;class l0 extends Error{constructor(e=""){super(e)}}const Rt={Err:l0,_tlv:{encode:(t,e)=>{const{Err:i}=Rt;if(t<0||t>256)throw new i("tlv.encode: wrong tag");if(e.length&1)throw new i("tlv.encode: unpadded data");const r=e.length/2,s=Ui(r);if(s.length/2&128)throw new i("tlv.encode: long form length too big");const n=r>127?Ui(s.length/2|128):"";return Ui(t)+n+s+e},decode(t,e){const{Err:i}=Rt;let r=0;if(t<0||t>256)throw new i("tlv.encode: wrong tag");if(e.length<2||e[r++]!==t)throw new i("tlv.decode: wrong tlv");const s=e[r++],n=!!(s&128);let o=0;if(!n)o=s;else{const c=s&127;if(!c)throw new i("tlv.decode(long): indefinite length not supported");if(c>4)throw new i("tlv.decode(long): byte length is too big");const l=e.subarray(r,r+c);if(l.length!==c)throw new i("tlv.decode: length bytes not complete");if(l[0]===0)throw new i("tlv.decode(long): zero leftmost byte");for(const h of l)o=o<<8|h;if(r+=c,o<128)throw new i("tlv.decode(long): not minimal encoding")}const a=e.subarray(r,r+o);if(a.length!==o)throw new i("tlv.decode: wrong value length");return{v:a,l:e.subarray(r+o)}}},_int:{encode(t){const{Err:e}=Rt;if(t<Tt)throw new e("integer: negative integers are not allowed");let i=Ui(t);if(Number.parseInt(i[0],16)&8&&(i="00"+i),i.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return i},decode(t){const{Err:e}=Rt;if(t[0]&128)throw new e("invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return a0(t)}},toSig(t){const{Err:e,_int:i,_tlv:r}=Rt,s=typeof t=="string"?c0(t):t;kr(s);const{v:n,l:o}=r.decode(48,s);if(o.length)throw new e("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,n),{v:l,l:h}=r.decode(2,c);if(h.length)throw new e("invalid signature: left bytes after parsing");return{r:i.decode(a),s:i.decode(l)}},hexFromSig(t){const{_tlv:e,_int:i}=Rt,r=e.encode(2,i.encode(t.r)),s=e.encode(2,i.encode(t.s)),n=r+s;return e.encode(48,n)}},Tt=BigInt(0),we=BigInt(1);BigInt(2);const Dc=BigInt(3);BigInt(4);function h0(t){const e=o0(t),{Fp:i}=e,r=ju(e.n,e.nBitLength),s=e.toBytes||((y,w,v)=>{const b=w.toAffine();return $r(Uint8Array.from([4]),i.toBytes(b.x),i.toBytes(b.y))}),n=e.fromBytes||(y=>{const w=y.subarray(1),v=i.fromBytes(w.subarray(0,i.BYTES)),b=i.fromBytes(w.subarray(i.BYTES,2*i.BYTES));return{x:v,y:b}});function o(y){const{a:w,b:v}=e,b=i.sqr(y),_=i.mul(b,y);return i.add(i.add(_,i.mul(y,w)),v)}if(!i.eql(i.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function a(y){return Fs(y,we,e.n)}function c(y){const{allowedPrivateKeyLengths:w,nByteLength:v,wrapPrivateKey:b,n:_}=e;if(w&&typeof y!="bigint"){if(ai(y)&&(y=Ki(y)),typeof y!="string"||!w.includes(y.length))throw new Error("invalid private key");y=y.padStart(v*2,"0")}let I;try{I=typeof y=="bigint"?y:ri(Ke("private key",y,v))}catch{throw new Error("invalid private key, expected hex or "+v+" bytes, got "+typeof y)}return b&&(I=ke(I,_)),Nt("private key",I,we,_),I}function l(y){if(!(y instanceof d))throw new Error("ProjectivePoint expected")}const h=io((y,w)=>{const{px:v,py:b,pz:_}=y;if(i.eql(_,i.ONE))return{x:v,y:b};const I=y.is0();w==null&&(w=I?i.ONE:i.inv(_));const A=i.mul(v,w),x=i.mul(b,w),$=i.mul(_,w);if(I)return{x:i.ZERO,y:i.ZERO};if(!i.eql($,i.ONE))throw new Error("invZ was invalid");return{x:A,y:x}}),u=io(y=>{if(y.is0()){if(e.allowInfinityPoint&&!i.is0(y.py))return;throw new Error("bad point: ZERO")}const{x:w,y:v}=y.toAffine();if(!i.isValid(w)||!i.isValid(v))throw new Error("bad point: x or y not FE");const b=i.sqr(v),_=o(w);if(!i.eql(b,_))throw new Error("bad point: equation left != right");if(!y.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class d{constructor(w,v,b){if(this.px=w,this.py=v,this.pz=b,w==null||!i.isValid(w))throw new Error("x required");if(v==null||!i.isValid(v))throw new Error("y required");if(b==null||!i.isValid(b))throw new Error("z required");Object.freeze(this)}static fromAffine(w){const{x:v,y:b}=w||{};if(!w||!i.isValid(v)||!i.isValid(b))throw new Error("invalid affine point");if(w instanceof d)throw new Error("projective point not allowed");const _=I=>i.eql(I,i.ZERO);return _(v)&&_(b)?d.ZERO:new d(v,b,i.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(w){const v=i.invertBatch(w.map(b=>b.pz));return w.map((b,_)=>b.toAffine(v[_])).map(d.fromAffine)}static fromHex(w){const v=d.fromAffine(n(Ke("pointHex",w)));return v.assertValidity(),v}static fromPrivateKey(w){return d.BASE.multiply(c(w))}static msm(w,v){return Xv(d,r,w,v)}_setWindowSize(w){p.setWindowSize(this,w)}assertValidity(){u(this)}hasEvenY(){const{y:w}=this.toAffine();if(i.isOdd)return!i.isOdd(w);throw new Error("Field doesn't support isOdd")}equals(w){l(w);const{px:v,py:b,pz:_}=this,{px:I,py:A,pz:x}=w,$=i.eql(i.mul(v,x),i.mul(I,_)),R=i.eql(i.mul(b,x),i.mul(A,_));return $&&R}negate(){return new d(this.px,i.neg(this.py),this.pz)}double(){const{a:w,b:v}=e,b=i.mul(v,Dc),{px:_,py:I,pz:A}=this;let x=i.ZERO,$=i.ZERO,R=i.ZERO,O=i.mul(_,_),F=i.mul(I,I),M=i.mul(A,A),j=i.mul(_,I);return j=i.add(j,j),R=i.mul(_,A),R=i.add(R,R),x=i.mul(w,R),$=i.mul(b,M),$=i.add(x,$),x=i.sub(F,$),$=i.add(F,$),$=i.mul(x,$),x=i.mul(j,x),R=i.mul(b,R),M=i.mul(w,M),j=i.sub(O,M),j=i.mul(w,j),j=i.add(j,R),R=i.add(O,O),O=i.add(R,O),O=i.add(O,M),O=i.mul(O,j),$=i.add($,O),M=i.mul(I,A),M=i.add(M,M),O=i.mul(M,j),x=i.sub(x,O),R=i.mul(M,F),R=i.add(R,R),R=i.add(R,R),new d(x,$,R)}add(w){l(w);const{px:v,py:b,pz:_}=this,{px:I,py:A,pz:x}=w;let $=i.ZERO,R=i.ZERO,O=i.ZERO;const F=e.a,M=i.mul(e.b,Dc);let j=i.mul(v,I),q=i.mul(b,A),T=i.mul(_,x),g=i.add(v,b),m=i.add(I,A);g=i.mul(g,m),m=i.add(j,q),g=i.sub(g,m),m=i.add(v,_);let E=i.add(I,x);return m=i.mul(m,E),E=i.add(j,T),m=i.sub(m,E),E=i.add(b,_),$=i.add(A,x),E=i.mul(E,$),$=i.add(q,T),E=i.sub(E,$),O=i.mul(F,m),$=i.mul(M,T),O=i.add($,O),$=i.sub(q,O),O=i.add(q,O),R=i.mul($,O),q=i.add(j,j),q=i.add(q,j),T=i.mul(F,T),m=i.mul(M,m),q=i.add(q,T),T=i.sub(j,T),T=i.mul(F,T),m=i.add(m,T),j=i.mul(q,m),R=i.add(R,j),j=i.mul(E,m),$=i.mul(g,$),$=i.sub($,j),j=i.mul(g,q),O=i.mul(E,O),O=i.add(O,j),new d($,R,O)}subtract(w){return this.add(w.negate())}is0(){return this.equals(d.ZERO)}wNAF(w){return p.wNAFCached(this,w,d.normalizeZ)}multiplyUnsafe(w){const{endo:v,n:b}=e;Nt("scalar",w,Tt,b);const _=d.ZERO;if(w===Tt)return _;if(this.is0()||w===we)return this;if(!v||p.hasPrecomputes(this))return p.wNAFCachedUnsafe(this,w,d.normalizeZ);let{k1neg:I,k1:A,k2neg:x,k2:$}=v.splitScalar(w),R=_,O=_,F=this;for(;A>Tt||$>Tt;)A&we&&(R=R.add(F)),$&we&&(O=O.add(F)),F=F.double(),A>>=we,$>>=we;return I&&(R=R.negate()),x&&(O=O.negate()),O=new d(i.mul(O.px,v.beta),O.py,O.pz),R.add(O)}multiply(w){const{endo:v,n:b}=e;Nt("scalar",w,we,b);let _,I;if(v){const{k1neg:A,k1:x,k2neg:$,k2:R}=v.splitScalar(w);let{p:O,f:F}=this.wNAF(x),{p:M,f:j}=this.wNAF(R);O=p.constTimeNegate(A,O),M=p.constTimeNegate($,M),M=new d(i.mul(M.px,v.beta),M.py,M.pz),_=O.add(M),I=F.add(j)}else{const{p:A,f:x}=this.wNAF(w);_=A,I=x}return d.normalizeZ([_,I])[0]}multiplyAndAddUnsafe(w,v,b){const _=d.BASE,I=(x,$)=>$===Tt||$===we||!x.equals(_)?x.multiplyUnsafe($):x.multiply($),A=I(this,v).add(I(w,b));return A.is0()?void 0:A}toAffine(w){return h(this,w)}isTorsionFree(){const{h:w,isTorsionFree:v}=e;if(w===we)return!0;
19if(v)return v(d,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:w,clearCofactor:v}=e;return w===we?this:v?v(d,this):this.multiplyUnsafe(e.h)}toRawBytes(w=!0){return Hi("isCompressed",w),this.assertValidity(),s(d,this,w)}toHex(w=!0){return Hi("isCompressed",w),Ki(this.toRawBytes(w))}}d.BASE=new d(e.Gx,e.Gy,i.ONE),d.ZERO=new d(i.ZERO,i.ONE,i.ZERO);const f=e.nBitLength,p=Zv(d,e.endo?Math.ceil(f/2):f);return{CURVE:e,ProjectivePoint:d,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:a}}function u0(t){const e=Fu(t);return er(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function d0(t){const e=u0(t),{Fp:i,n:r}=e,s=i.BYTES+1,n=2*i.BYTES+1;function o(T){return ke(T,r)}function a(T){return so(T,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:l,weierstrassEquation:h,isWithinCurveOrder:u}=h0({...e,toBytes(T,g,m){const E=g.toAffine(),P=i.toBytes(E.x),S=$r;return Hi("isCompressed",m),m?S(Uint8Array.from([g.hasEvenY()?2:3]),P):S(Uint8Array.from([4]),P,i.toBytes(E.y))},fromBytes(T){const g=T.length,m=T[0],E=T.subarray(1);if(g===s&&(m===2||m===3)){const P=ri(E);if(!Fs(P,we,i.ORDER))throw new Error("Point is not on curve");const S=h(P);let C;try{C=i.sqrt(S)}catch(k){const z=k instanceof Error?": "+k.message:"";throw new Error("Point is not on curve"+z)}const U=(C&we)===we;return(m&1)===1!==U&&(C=i.neg(C)),{x:P,y:C}}else if(g===n&&m===4){const P=i.fromBytes(E.subarray(0,i.BYTES)),S=i.fromBytes(E.subarray(i.BYTES,2*i.BYTES));return{x:P,y:S}}else{const P=s,S=n;throw new Error("invalid Point, expected length of "+P+", or uncompressed "+S+", got "+g)}}}),d=T=>Ki(Gi(T,e.nByteLength));function f(T){const g=r>>we;return T>g}function p(T){return f(T)?o(-T):T}const y=(T,g,m)=>ri(T.slice(g,m));class w{constructor(g,m,E){this.r=g,this.s=m,this.recovery=E,this.assertValidity()}static fromCompact(g){const m=e.nByteLength;return g=Ke("compactSignature",g,m*2),new w(y(g,0,m),y(g,m,2*m))}static fromDER(g){const{r:m,s:E}=Rt.toSig(Ke("DER",g));return new w(m,E)}assertValidity(){Nt("r",this.r,we,r),Nt("s",this.s,we,r)}addRecoveryBit(g){return new w(this.r,this.s,g)}recoverPublicKey(g){const{r:m,s:E,recovery:P}=this,S=x(Ke("msgHash",g));if(P==null||![0,1,2,3].includes(P))throw new Error("recovery id invalid");const C=P===2||P===3?m+e.n:m;if(C>=i.ORDER)throw new Error("recovery id 2 or 3 invalid");const U=P&1?"03":"02",k=c.fromHex(U+d(C)),z=a(C),B=o(-S*z),V=o(E*z),G=c.BASE.multiplyAndAddUnsafe(k,B,V);if(!G)throw new Error("point at infinify");return G.assertValidity(),G}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new w(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return Wi(this.toDERHex())}toDERHex(){return Rt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Wi(this.toCompactHex())}toCompactHex(){return d(this.r)+d(this.s)}}const v={isValidPrivateKey(T){try{return l(T),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const T=Uu(e.n);return Gv(e.randomBytes(T),e.n)},precompute(T=8,g=c.BASE){return g._setWindowSize(T),g.multiply(BigInt(3)),g}};function b(T,g=!0){return c.fromPrivateKey(T).toRawBytes(g)}function _(T){const g=ai(T),m=typeof T=="string",E=(g||m)&&T.length;return g?E===s||E===n:m?E===2*s||E===2*n:T instanceof c}function I(T,g,m=!0){if(_(T))throw new Error("first arg must be private key");if(!_(g))throw new Error("second arg must be public key");return c.fromHex(g).multiply(l(T)).toRawBytes(m)}const A=e.bits2int||function(T){if(T.length>8192)throw new Error("input is too large");const g=ri(T),m=T.length*8-e.nBitLength;return m>0?g>>BigInt(m):g},x=e.bits2int_modN||function(T){return o(A(T))},$=Yo(e.nBitLength);function R(T){return Nt("num < 2^"+e.nBitLength,T,Tt,$),Gi(T,e.nByteLength)}function O(T,g,m=F){if(["recovered","canonical"].some(ee=>ee in m))throw new Error("sign() legacy options not supported");const{hash:E,randomBytes:P}=e;let{lowS:S,prehash:C,extraEntropy:U}=m;S==null&&(S=!0),T=Ke("msgHash",T),Lc(m),C&&(T=Ke("prehashed msgHash",E(T)));const k=x(T),z=l(g),B=[R(z),R(k)];if(U!=null&&U!==!1){const ee=U===!0?P(i.BYTES):U;B.push(Ke("extraEntropy",ee))}const V=$r(...B),G=k;function ne(ee){const Y=A(ee);if(!u(Y))return;const Ce=a(Y),Ee=c.BASE.multiply(Y).toAffine(),Te=o(Ee.x);if(Te===Tt)return;const Ze=o(Ce*o(G+Te*z));if(Ze===Tt)return;let Xe=(Ee.x===Te?0:2)|Number(Ee.y&we),fi=Ze;return S&&f(Ze)&&(fi=p(Ze),Xe^=1),new w(Te,fi,Xe)}return{seed:V,k2sig:ne}}const F={lowS:e.lowS,prehash:!1},M={lowS:e.lowS,prehash:!1};function j(T,g,m=F){const{seed:E,k2sig:P}=O(T,g,m),S=e;return Nu(S.hash.outputLen,S.nByteLength,S.hmac)(E,P)}c.BASE._setWindowSize(8);function q(T,g,m,E=M){var Ze;const P=T;g=Ke("msgHash",g),m=Ke("publicKey",m);const{lowS:S,prehash:C,format:U}=E;
19if(Lc(E),"strict"in E)throw new Error("options.strict was renamed to lowS");if(U!==void 0&&U!=="compact"&&U!=="der")throw new Error("format must be compact or der");const k=typeof P=="string"||ai(P),z=!k&&!U&&typeof P=="object"&&P!==null&&typeof P.r=="bigint"&&typeof P.s=="bigint";if(!k&&!z)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let B,V;try{if(z&&(B=new w(P.r,P.s)),k){try{U!=="compact"&&(B=w.fromDER(P))}catch(Xe){if(!(Xe instanceof Rt.Err))throw Xe}!B&&U!=="der"&&(B=w.fromCompact(P))}V=c.fromHex(m)}catch{return!1}if(!B||S&&B.hasHighS())return!1;C&&(g=e.hash(g));const{r:G,s:ne}=B,ee=x(g),Y=a(ne),Ce=o(ee*Y),Ee=o(G*Y),Te=(Ze=c.BASE.multiplyAndAddUnsafe(V,Ce,Ee))==null?void 0:Ze.toAffine();return Te?o(Te.x)===G:!1}return{CURVE:e,getPublicKey:b,getSharedSecret:I,sign:j,verify:q,ProjectivePoint:c,Signature:w,utils:v}}function p0(t){return{hash:t,hmac:(e,...i)=>Ms(t,e,mb(...i)),randomBytes:Qi}}function f0(t,e){const i=r=>d0({...t,...p0(r)});return{...i(e),create:i}}const qu=ju(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),g0=qu.create(BigInt("-3")),y0=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),m0=f0({a:g0,b:y0,Fp:qu,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},Br),zu="base10",Le="base16",ut="base64pad",Ft="base64url",Fr="utf8",Vu=0,Lt=1,qr=2,w0=0,jc=1,wr=12,Jo=32;function b0(){const t=oo.utils.randomPrivateKey(),e=oo.getPublicKey(t);return{privateKey:Fe(t,Le),publicKey:Fe(e,Le)}}function ao(){const t=Qi(Jo);return Fe(t,Le)}function v0(t,e){const i=oo.getSharedSecret(rt(t,Le),rt(e,Le)),r=Sv(Br,i,void 0,void 0,Jo);return Fe(r,Le)}function ps(t){const e=Br(rt(t,Le));return Fe(e,Le)}function _t(t){const e=Br(rt(t,Fr));return Fe(e,Le)}function Hu(t){return rt(`${t}`,zu)}function ci(t){return Number(Fe(t,zu))}function Ku(t){return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Wu(t){const e=t.replace(/-/g,"+").replace(/_/g,"/"),i=(4-e.length%4)%4;return e+"=".repeat(i)}function _0(t){const e=Hu(typeof t.type<"u"?t.type:Vu);if(ci(e)===Lt&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const i=typeof t.senderPublicKey<"u"?rt(t.senderPublicKey,Le):void 0,r=typeof t.iv<"u"?rt(t.iv,Le):Qi(wr),s=rt(t.symKey,Le),n=Cu(s,r).encrypt(rt(t.message,Fr)),o=Gu({type:e,sealed:n,iv:r,senderPublicKey:i});return t.encoding===Ft?Ku(o):o}function E0(t){const e=rt(t.symKey,Le),{sealed:i,iv:r}=Ar({encoded:t.encoded,encoding:t.encoding}),s=Cu(e,r).decrypt(i);if(s===null)throw new Error("Failed to decrypt");return Fe(s,Fr)}function I0(t,e){const i=Hu(qr),r=Qi(wr),s=rt(t,Fr),n=Gu({type:i,sealed:s,iv:r});return e===Ft?Ku(n):n}function S0(t,e){const{sealed:i}=Ar({encoded:t,encoding:e});return Fe(i,Fr)}function Gu(t){if(ci(t.type)===qr)return Fe(mr([t.type,t.sealed]),ut);if(ci(t.type)===Lt){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Fe(mr([t.type,t.senderPublicKey,t.iv,t.sealed]),ut)}return Fe(mr([t.type,t.iv,t.sealed]),ut)}function Ar(t){const e=(t.encoding||ut)===Ft?Wu(t.encoded):t.encoded,i=rt(e,ut),r=i.slice(w0,jc),s=jc;if(ci(r)===Lt){const c=s+Jo,l=c+wr,h=i.slice(s,c),u=i.slice(c,l),d=i.slice(l);return{type:r,sealed:d,iv:u,senderPublicKey:h}}if(ci(r)===qr){const c=i.slice(s),l=Qi(wr);return{type:r,sealed:c,iv:l}}const n=s+wr,o=i.slice(s,n),a=i.slice(n);return{type:r,sealed:a,iv:o}}function O0(t,e){const i=Ar({encoded:t,encoding:e==null?void 0:e.encoding});return Yu({type:ci(i.type),senderPublicKey:typeof i.senderPublicKey<"u"?Fe(i.senderPublicKey,Le):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function Yu(t){const e=(t==null?void 0:t.type)||Vu;if(e===Lt){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function Mc(t){return t.type===Lt&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function Uc(t){return t.type===qr}function P0(t){const e=Buffer.from(t.x,"base64"),i=Buffer.from(t.y,"base64");return mr([new Uint8Array([4]),e,i])}function $0(t,e){const[i,r,s]=t.split("."),n=Buffer.from(Wu(s),"base64");if(n.length!==64)throw new Error("Invalid signature length");
19const o=n.slice(0,32),a=n.slice(32,64),c=`${i}.${r}`,l=Br(c),h=P0(e);if(!m0.verify(mr([o,a]),l,h))throw new Error("Invalid signature");return Yn(t).payload}const A0="irn";function Is(t){return(t==null?void 0:t.relay)||{protocol:A0}}function fr(t){const e=Nw[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}function x0(t,e="-"){const i={},r="relay"+e;return Object.keys(t).forEach(s=>{if(s.startsWith(r)){const n=s.replace(r,""),o=t[s];i[n]=o}}),i}function Bc(t){if(!t.includes("wc:")){const l=mu(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(":"),i=t.indexOf("?")!==-1?t.indexOf("?"):void 0,r=t.substring(0,e),s=t.substring(e+1,i).split("@"),n=typeof i<"u"?t.substring(i):"",o=new URLSearchParams(n),a={};o.forEach((l,h)=>{a[h]=l});const c=typeof a.methods=="string"?a.methods.split(","):void 0;return{protocol:r,topic:C0(s[0]),version:parseInt(s[1],10),symKey:a.symKey,relay:x0(a),methods:c,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function C0(t){return t.startsWith("//")?t.substring(2):t}function R0(t,e="-"){const i="relay",r={};return Object.keys(t).forEach(s=>{const n=s,o=i+e+n;t[n]&&(r[o]=t[n])}),r}function kc(t){const e=new URLSearchParams,i=R0(t.relay);Object.keys(i).sort().forEach(s=>{e.set(s,i[s])}),e.set("symKey",t.symKey),t.expiryTimestamp&&e.set("expiryTimestamp",t.expiryTimestamp.toString()),t.methods&&e.set("methods",t.methods.join(","));const r=e.toString();return`${t.protocol}:${t.topic}@${t.version}?${r}`}function es(t,e,i){return`${t}?wc_ev=${i}&topic=${e}`}function tr(t){const e=[];return t.forEach(i=>{const[r,s]=i.split(":");e.push(`${r}:${s}`)}),e}function T0(t){const e=[];return Object.values(t).forEach(i=>{e.push(...tr(i.accounts))}),e}function N0(t,e){const i=[];return Object.values(t).forEach(r=>{tr(r.accounts).includes(e)&&i.push(...r.methods)}),i}function L0(t,e){const i=[];return Object.values(t).forEach(r=>{tr(r.accounts).includes(e)&&i.push(...r.events)}),i}function Zo(t){return t.includes(":")}function gr(t){return Zo(t)?t.split(":")[0]:t}function D0(t){const e={};return t==null||t.forEach(i=>{var r;const[s,n]=i.split(":");e[s]||(e[s]={accounts:[],chains:[],events:[],methods:[]}),e[s].accounts.push(i),(r=e[s].chains)==null||r.push(`${s}:${n}`)}),e}function Fc(t,e){e=e.map(r=>r.replace("did:pkh:",""));const i=D0(e);for(const[r,s]of Object.entries(i))s.methods?s.methods=us(s.methods,t):s.methods=t,s.events=["chainChanged","accountsChanged"];return i}const j0={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}},M0={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 D(t,e){const{message:i,code:r}=M0[t];return{message:e?`${i} ${e}`:i,code:r}}function te(t,e){const{message:i,code:r}=j0[t];return{message:e?`${i} ${e}`:i,code:r}}function dt(t,e){return!!Array.isArray(t)}function xr(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Pe(t){return typeof t>"u"}function de(t,e){return e&&Pe(t)?!0:typeof t=="string"&&!!t.trim().length}function Xo(t,e){return e&&Pe(t)?!0:typeof t=="number"&&!isNaN(t)}function U0(t,e){const{requiredNamespaces:i}=e,r=Object.keys(t.namespaces),s=Object.keys(i);let n=!0;return ti(s,r)?(r.forEach(o=>{const{accounts:a,methods:c,events:l}=t.namespaces[o],h=tr(a),u=i[o];
vendor: 4,188 bytes, lines 19-25
19(!ti(du(o,u),h)||!ti(u.methods,c)||!ti(u.events,l))&&(n=!1)}),n):!1}function Ss(t){return de(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function B0(t){if(de(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const i=e[0]+":"+e[1];return!!e[2]&&Ss(i)}}return!1}function k0(t){function e(i){try{return typeof new URL(i)<"u"}catch{return!1}}try{if(de(t,!1)){if(e(t))return!0;const i=mu(t);return e(i)}}catch{}return!1}function F0(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function q0(t){return t==null?void 0:t.topic}function z0(t,e){let i=null;return de(t==null?void 0:t.publicKey,!1)||(i=D("MISSING_OR_INVALID",`${e} controller public key should be a string`)),i}function qc(t){let e=!0;return dt(t)?t.length&&(e=t.every(i=>de(i,!1))):e=!1,e}function V0(t,e,i){let r=null;return dt(e)&&e.length?e.forEach(s=>{r||Ss(s)||(r=te("UNSUPPORTED_CHAINS",`${i}, chain ${s} should be a string and conform to "namespace:chainId" format`))}):Ss(t)||(r=te("UNSUPPORTED_CHAINS",`${i}, 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"] }`)),r}function H0(t,e,i){let r=null;return Object.entries(t).forEach(([s,n])=>{if(r)return;const o=V0(s,du(s,n),`${e} ${i}`);o&&(r=o)}),r}function K0(t,e){let i=null;return dt(t)?t.forEach(r=>{i||B0(r)||(i=te("UNSUPPORTED_ACCOUNTS",`${e}, account ${r} should be a string and conform to "namespace:chainId:address" format`))}):i=te("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),i}function W0(t,e){let i=null;return Object.values(t).forEach(r=>{if(i)return;const s=K0(r==null?void 0:r.accounts,`${e} namespace`);s&&(i=s)}),i}function G0(t,e){let i=null;return qc(t==null?void 0:t.methods)?qc(t==null?void 0:t.events)||(i=te("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):i=te("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),i}function Ju(t,e){let i=null;return Object.values(t).forEach(r=>{if(i)return;const s=G0(r,`${e}, namespace`);s&&(i=s)}),i}function Y0(t,e,i){let r=null;if(t&&xr(t)){const s=Ju(t,e);s&&(r=s);const n=H0(t,e,i);n&&(r=n)}else r=D("MISSING_OR_INVALID",`${e}, ${i} should be an object with data`);return r}function En(t,e){let i=null;if(t&&xr(t)){const r=Ju(t,e);r&&(i=r);const s=W0(t,e);s&&(i=s)}else i=D("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return i}function Zu(t){return de(t.protocol,!0)}function J0(t,e){let i=!1;return t?t&&dt(t)&&t.length&&t.forEach(r=>{i=Zu(r)}):i=!0,i}function Z0(t){return typeof t=="number"}function Be(t){return typeof t<"u"&&typeof t!==null}function X0(t){return!(!t||typeof t!="object"||!t.code||!Xo(t.code,!1)||!t.message||!de(t.message,!1))}function Q0(t){return!(Pe(t)||!de(t.method,!1))}function e_(t){return!(Pe(t)||Pe(t.result)&&Pe(t.error)||!Xo(t.id,!1)||!de(t.jsonrpc,!1))}function t_(t){return!(Pe(t)||!de(t.name,!1))}function zc(t,e){return!(!Ss(e)||!T0(t).includes(e))}function i_(t,e,i){return de(i,!1)?N0(t,e).includes(i):!1}function r_(t,e,i){return de(i,!1)?L0(t,e).includes(i):!1}function Vc(t,e,i){let r=null;const s=s_(t),n=n_(e),o=Object.keys(s),a=Object.keys(n),c=Hc(Object.keys(t)),l=Hc(Object.keys(e)),h=c.filter(u=>!l.includes(u));return h.length&&(r=D("NON_CONFORMING_NAMESPACES",`${i} namespaces keys don't satisfy requiredNamespaces. 20 Required: ${h.toString()} 21 Received: ${Object.keys(e).toString()}`)),ti(o,a)||(r=D("NON_CONFORMING_NAMESPACES",`${i} namespaces chains don't satisfy required namespaces. 22 Required: ${o.toString()} 23 Approved: ${a.toString()}`)),Object.keys(e).forEach(u=>{if(!u.includes(":")||r)return;const d=tr(e[u].accounts);d.includes(u)||(r=D("NON_CONFORMING_NAMESPACES",`${i} namespaces accounts don't satisfy namespace accounts for ${u} 24 Required: ${u} 25 Approved: ${d.toString()}`))}),o.forEach(u=>{r||(ti(s[u].methods,n[u].methods)?ti(s[u].events,n[u].events)||(r=D("NON_CONFORMING_NAMESPACES",`${i} namespaces events don't satisfy namespace events for ${u}
25`)):r=D("NON_CONFORMING_NAMESPACES",`${i} namespaces methods don't satisfy namespace methods for ${u}`))}),r}function s_(t){const e={};return Object.keys(t).forEach(i=>{var r;i.includes(":")?e[i]=t[i]:(r=t[i].chains)==null||r.forEach(s=>{e[s]={methods:t[i].methods,events:t[i].events}})}),e}function Hc(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function n_(t){const e={};return Object.keys(t).forEach(i=>{if(i.includes(":"))e[i]=t[i];else{const r=tr(t[i].accounts);r==null||r.forEach(s=>{e[s]={accounts:t[i].accounts.filter(n=>n.includes(`${s}:`)),methods:t[i].methods,events:t[i].events}})}}),e}function o_(t,e){return Xo(t,!1)&&t<=e.max&&t>=e.min}function Kc(){const t=Mr();return new Promise(e=>{switch(t){case Ge.browser:e(a_());break;case Ge.reactNative:e(c_());break;case Ge.node:e(l_());break;default:e(!0)}})}function a_(){return jr()&&(navigator==null?void 0:navigator.onLine)}async function c_(){if(Ht()&&typeof window<"u"&&window!=null&&window.NetInfo){const t=await(window==null?void 0:window.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function l_(){return!0}function h_(t){switch(Mr()){case Ge.browser:u_(t);break;case Ge.reactNative:d_(t);break}}function u_(t){!Ht()&&jr()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function d_(t){Ht()&&typeof window<"u"&&window!=null&&window.NetInfo&&(window==null||window.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const In={};class lr{static get(e){return In[e]}static set(e,i){In[e]=i}static delete(e){delete In[e]}}class hi{}let p_=class extends hi{constructor(e){super()}};const Wc=L.FIVE_SECONDS,ir={pulse:"heartbeat_pulse"};let f_=class Xu extends p_{constructor(e){super(e),this.events=new Je.EventEmitter,this.interval=Wc,this.interval=(e==null?void 0:e.interval)||Wc}static async init(e){const i=new Xu(e);return await i.init(),i}
vendor: 14,832 bytes, line 25
25async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,i){this.events.on(e,i)}once(e,i){this.events.once(e,i)}off(e,i){this.events.off(e,i)}removeListener(e,i){this.events.removeListener(e,i)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),L.toMiliseconds(this.interval))}pulse(){this.events.emit(ir.pulse)}};const g_=/"(?:_|\\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*:/,y_=/"(?: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*:/,m_=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function w_(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){b_(t);return}return e}function b_(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function ts(t,e={}){if(typeof t!="string")return t;if(t[0]==='"'&&t[t.length-1]==='"'&&t.indexOf("\\")===-1)return t.slice(1,-1);const i=t.trim();if(i.length<=9)switch(i.toLowerCase()){case"true":return!0;case"false":return!1;case"undefined":return;case"null":return null;case"nan":return Number.NaN;case"infinity":return Number.POSITIVE_INFINITY;case"-infinity":return Number.NEGATIVE_INFINITY}if(!m_.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(g_.test(t)||y_.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,w_)}return JSON.parse(t)}catch(r){if(e.strict)throw r;return t}}function v_(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function me(t,...e){try{return v_(t(...e))}catch(i){return Promise.reject(i)}}function __(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function E_(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function fs(t){if(__(t))return String(t);if(E_(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return fs(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const co="base64:";function I_(t){return typeof t=="string"?t:co+P_(t)}function S_(t){return typeof t!="string"||!t.startsWith(co)?t:O_(t.slice(co.length))}function O_(t){return globalThis.Buffer?Buffer.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))}function P_(t){return globalThis.Buffer?Buffer.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))}function Ue(t){var e;return t&&((e=t.split("?")[0])==null?void 0:e.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function $_(...t){return Ue(t.join(":"))}function is(t){return t=Ue(t),t?t+":":""}function A_(t,e){if(e===void 0)return!0;let i=0,r=t.indexOf(":");for(;r>-1;)i++,r=t.indexOf(":",r+1);return i<=e}function x_(t,e){return e?t.startsWith(e)&&t[t.length-1]!=="$":t[t.length-1]!=="$"}const C_="memory",R_=()=>{const t=new Map;return{name:C_,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,i){t.set(e,i)},setItemRaw(e,i){t.set(e,i)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function T_(t={}){const e={mounts:{"":t.driver||R_()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},i=l=>{for(const h of e.mountpoints)if(l.startsWith(h))return{base:h,relativeKey:l.slice(h.length),driver:e.mounts[h]};return{base:"",relativeKey:l,driver:e.mounts[""]}},r=(l,h)=>e.mountpoints.filter(u=>u.startsWith(l)||h&&l.startsWith(u)).map(u=>({relativeBase:l.length>u.length?l.slice(u.length):void 0,mountpoint:u,driver:e.mounts[u]})),s=(l,h)=>{if(e.watching){h=Ue(h);for(const u of e.watchListeners)u(l,h)}},n=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await Gc(e.mounts[l],s,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,h,u)=>{const d=new Map,f=p=>{let y=d.get(p.base);return y||(y={driver:p.driver,base:p.base,items:[]},d.set(p.base,y)),y};for(const p of l){const y=typeof p=="string",w=Ue(y?p:p.key),v=y?void 0:p.value,b=y||!p.options?h:{...h,...p.options},_=i(w);f(_).items.push({key:w,value:v,relativeKey:_.relativeKey,options:b})}return Promise.all([...d.values()].map(p=>u(p))).then(p=>p.flat())},c={hasItem(l,h={}){l=Ue(l);const{relativeKey:u,driver:d}=i(l);return me(d.hasItem,u,h)},getItem(l,h={}){l=Ue(l);const{relativeKey:u,driver:d}=i(l);return me(d.getItem,u,h).then(f=>ts(f))},getItems(l,h={}){return a(l,h,u=>u.driver.getItems?me(u.driver.getItems,u.items.map(d=>({key:d.relativeKey,options:d.options})),h).then(d=>d.map(f=>({key:$_(u.base,f.key),value:ts(f.value)}))):Promise.all(u.items.map(d=>me(u.driver.getItem,d.relativeKey,d.options).then(f=>({key:d.key,value:ts(f)})))))},getItemRaw(l,h={}){l=Ue(l);const{relativeKey:u,driver:d}=i(l);return d.getItemRaw?me(d.getItemRaw,u,h):me(d.getItem,u,h).then(f=>S_(f))},async setItem(l,h,u={}){if(h===void 0)return c.removeItem(l);l=Ue(l);const{relativeKey:d,driver:f}=i(l);f.setItem&&(await me(f.setItem,d,fs(h),u),f.watch||s("update",l))},async setItems(l,h){await a(l,h,async u=>{if(u.driver.setItems)return me(u.driver.setItems,u.items.map(d=>({key:d.relativeKey,value:fs(d.value),options:d.options})),h);u.driver.setItem&&await Promise.all(u.items.map(d=>me(u.driver.setItem,d.relativeKey,fs(d.value),d.options)))})},async setItemRaw(l,h,u={}){if(h===void 0)return c.removeItem(l,u);l=Ue(l);const{relativeKey:d,driver:f}=i(l);if(f.setItemRaw)await me(f.setItemRaw,d,h,u);else if(f.setItem)await me(f.setItem,d,I_(h),u);else return;f.watch||s("update",l)},async removeItem(l,h={}){typeof h=="boolean"&&(h={removeMeta:h}),l=Ue(l);const{relativeKey:u,driver:d}=i(l);d.removeItem&&(await me(d.removeItem,u,h),(h.removeMeta||h.removeMata)&&await me(d.removeItem,u+"$",h),d.watch||s("remove",l))},async getMeta(l,h={}){typeof h=="boolean"&&(h={nativeOnly:h}),l=Ue(l);const{relativeKey:u,driver:d}=i(l),f=Object.create(null);if(d.getMeta&&Object.assign(f,await me(d.getMeta,u,h)),!h.nativeOnly){const p=await me(d.getItem,u+"$",h).then(y=>ts(y));p&&typeof p=="object"&&(typeof p.atime=="string"&&(p.atime=new Date(p.atime)),typeof p.mtime=="string"&&(p.mtime=new Date(p.mtime)),Object.assign(f,p))}return f},setMeta(l,h,u={}){return this.setItem(l+"$",h,u)},removeMeta(l,h={}){return this.removeItem(l+"$",h)},async getKeys(l,h={}){var w;l=is(l);const u=r(l,!0);let d=[];const f=[];let p=!0;for(const v of u){(w=v.driver.flags)!=null&&w.maxDepth||(p=!1);const b=await me(v.driver.getKeys,v.relativeBase,h);for(const _ of b){const I=v.mountpoint+Ue(_);d.some(A=>I.startsWith(A))||f.push(I)}d=[v.mountpoint,...d.filter(_=>!_.startsWith(v.mountpoint))]}const y=h.maxDepth!==void 0&&!p;return f.filter(v=>(!y||A_(v,h.maxDepth))&&x_(v,l))},async clear(l,h={}){l=is(l),await Promise.all(r(l,!1).map(async u=>{if(u.driver.clear)return me(u.driver.clear,u.relativeBase,h);if(u.driver.removeItem){const d=await u.driver.getKeys(u.relativeBase||"",h);return Promise.all(d.map(f=>u.driver.removeItem(f,h)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>Yc(l)))},async watch(l){return await n(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(h=>h!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,h){if(l=is(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((u,d)=>d.length-u.length)),e.mounts[l]=h,e.watching&&Promise.resolve(Gc(h,s,l)).then(u=>{e.unwatch[l]=u}).catch(console.error),c},async unmount(l,h=!0){var u,d;l=is(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&((d=(u=e.unwatch)[l])==null||d.call(u),delete e.unwatch[l]),h&&await Yc(e.mounts[l]),e.mountpoints=e.mountpoints.filter(f=>f!==l),delete e.mounts[l])},getMount(l=""){l=Ue(l)+":";const h=i(l);return{driver:h.driver,base:h.base}},getMounts(l="",h={}){return l=Ue(l),r(l,h.parents).map(d=>({driver:d.driver,base:d.mountpoint}))},keys:(l,h={})=>c.getKeys(l,h),get:(l,h={})=>c.getItem(l,h),set:(l,h,u={})=>c.setItem(l,h,u),has:(l,h={})=>c.hasItem(l,h),del:(l,h={})=>c.removeItem(l,h),remove:(l,h={})=>c.removeItem(l,h)};return c}function Gc(t,e,i){return t.watch?t.watch((r,s)=>e(r,i+s)):()=>{}}async function Yc(t){typeof t.dispose=="function"&&await me(t.dispose)}function ui(t){return new Promise((e,i)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>i(t.error)})}function Qu(t,e){const i=indexedDB.open(t);i.onupgradeneeded=()=>i.result.createObjectStore(e);const r=ui(i);return(s,n)=>r.then(o=>n(o.transaction(e,s).objectStore(e)))}let Sn;function zr(){return Sn||(Sn=Qu("keyval-store","keyval")),Sn}function Jc(t,e=zr()){return e("readonly",i=>ui(i.get(t)))}function N_(t,e,i=zr()){return i("readwrite",r=>(r.put(e,t),ui(r.transaction)))}function L_(t,e=zr()){return e("readwrite",i=>(i.delete(t),ui(i.transaction)))}function D_(t=zr()){return t("readwrite",e=>(e.clear(),ui(e.transaction)))}function j_(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},ui(t.transaction)}function M_(t=zr()){return t("readonly",e=>{if(e.getAllKeys)return ui(e.getAllKeys());const i=[];return j_(e,r=>i.push(r.key)).then(()=>i)})}const U_="idb-keyval";var B_=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",i=s=>e+s;let r;return t.dbName&&t.storeName&&(r=Qu(t.dbName,t.storeName)),{name:U_,options:t,async hasItem(s){return!(typeof await Jc(i(s),r)>"u")},async getItem(s){return await Jc(i(s),r)??null},setItem(s,n){return N_(i(s),n,r)},removeItem(s){return L_(i(s),r)},getKeys(){return M_(r)},clear(){return D_(r)}}};const k_="WALLET_CONNECT_V2_INDEXED_DB",F_="keyvaluestorage";let q_=class{constructor(){this.indexedDb=T_({driver:B_({dbName:k_,storeName:F_})})}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 i=await this.indexedDb.getItem(e);if(i!==null)return i}async setItem(e,i){await this.indexedDb.setItem(e,Dt(i))}async removeItem(e){await this.indexedDb.removeItem(e)}};var On=typeof globalThis<"u"?globalThis:typeof window<"u"||typeof window<"u"?window:typeof self<"u"?self:{},gs={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(i){return this.hasOwnProperty(i)?String(this[i]):null},t.prototype.setItem=function(i,r){this[i]=String(r)},t.prototype.removeItem=function(i){delete this[i]},t.prototype.clear=function(){const i=this;Object.keys(i).forEach(function(r){i[r]=void 0,delete i[r]})},t.prototype.key=function(i){return i=i||0,Object.keys(this)[i]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof On<"u"&&On.localStorage?gs.exports=On.localStorage:typeof window<"u"&&window.localStorage?gs.exports=window.localStorage:gs.exports=new e})();function z_(t){var e;return[t[0],ni((e=t[1])!=null?e:"")]}let V_=class{constructor(){this.localStorage=gs.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(z_)}async getItem(e){const i=this.localStorage.getItem(e);if(i!==null)return ni(i)}async setItem(e,i){this.localStorage.setItem(e,Dt(i))}async removeItem(e){this.localStorage.removeItem(e)}};const H_="wc_storage_version",Zc=1,K_=async(t,e,i)=>{const r=H_,s=await e.getItem(r);if(s&&s>=Zc){i(e);return}const n=await t.getKeys();if(!n.length){i(e);return}const o=[];for(;n.length;){const a=n.shift();if(!a)continue;const c=a.toLowerCase();if(c.includes("wc@")||c.includes("walletconnect")||c.includes("wc_")||c.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(r,Zc),i(e),W_(t,o)},W_=async(t,e)=>{e.length&&e.forEach(async i=>{await t.removeItem(i)})};let G_=class{constructor(){this.initialized=!1,this.setInitialized=i=>{this.storage=i,this.initialized=!0};const e=new V_;this.storage=e;try{const i=new q_;K_(e,i,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,i){return await this.initialize(),this.storage.setItem(e,i)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const i=setInterval(()=>{this.initialized&&(clearInterval(i),e())},20)})}};function Y_(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var J_=Z_;function Z_(t,e,i){var r=i&&i.stringify||Y_,s=1;if(typeof t=="object"&&t!==null){var n=e.length+s;if(n===1)return t;var o=new Array(n);o[0]=r(t);for(var a=1;a<n;a++)o[a]=r(e[a]);return o.join(" ")}if(typeof t!="string")return t;var c=e.length;if(c===0)return t;for(var l="",h=1-s,u=-1,d=t&&t.length||0,f=0;f<d;){if(t.charCodeAt(f)===37&&f+1<d){switch(u=u>-1?u:0,t.charCodeAt(f+1)){case 100:case 102:if(h>=c||e[h]==null)break;u<f&&(l+=t.slice(u,f)),l+=Number(e[h]),u=f+2,f++;break;case 105:if(h>=c||e[h]==null)break;u<f&&(l+=t.slice(u,f)),l+=Math.floor(Number(e[h])),u=f+2,f++;break;case 79:case 111:case 106:if(h>=c||e[h]===void 0)break;u<f&&(l+=t.slice(u,f));var p=typeof e[h];if(p==="string"){l+="'"+e[h]+"'",u=f+2,f++;break}if(p==="function"){l+=e[h].name||"<anonymous>",u=f+2,f++;break}l+=r(e[h]),u=f+2,f++;break;case 115:if(h>=c)break;u<f&&(l+=t.slice(u,f)),l+=String(e[h]),u=f+2,f++;break;case 37:u<f&&(l+=t.slice(u,f)),l+="%",u=f+2,f++,h--;break}++h}++f}return u===-1?t:(u<d&&(l+=t.slice(u)),l)}const Xc=J_;var Di=Et;const Cr=aE().console||{},X_={mapHttpRequest:rs,mapHttpResponse:rs,wrapRequestSerializer:Pn,wrapResponseSerializer:Pn,wrapErrorSerializer:Pn,req:rs,res:rs,err:rE};function Q_(t,e){return Array.isArray(t)?t.filter(function(r){return r!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function Et(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 i=t.browser.write||Cr;t.browser.write&&(t.browser.asObject=!0);const r=t.serializers||{},s=Q_(t.browser.serialize,r);let n=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(n=!1);const o=["error","fatal","warn","info","debug","trace"];typeof i=="function"&&(i.error=i.fatal=i.warn=i.info=i.debug=i.trace=i),t.enabled===!1&&(t.level="silent");const a=t.level||"info",c=Object.create(i);c.log||(c.log=Rr),Object.defineProperty(c,"levelVal",{get:h}),Object.defineProperty(c,"level",{get:u,set:d});const l={transmit:e,serialize:s,asObject:t.browser.asObject,levels:o,timestamp:sE(t)};
25c.levels=Et.levels,c.level=a,c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=Rr,c.serializers=r,c._serialize=s,c._stdErrSerialize=n,c.child=f,e&&(c._logEvent=lo());function h(){return this.level==="silent"?1/0:this.levels.values[this.level]}function u(){return this._level}function d(p){if(p!=="silent"&&!this.levels.values[p])throw Error("unknown level "+p);this._level=p,vi(l,c,"error","log"),vi(l,c,"fatal","error"),vi(l,c,"warn","error"),vi(l,c,"info","log"),vi(l,c,"debug","log"),vi(l,c,"trace","log")}function f(p,y){if(!p)throw new Error("missing bindings for child Pino");y=y||{},s&&p.serializers&&(y.serializers=p.serializers);const w=y.serializers;if(s&&w){var v=Object.assign({},r,w),b=t.browser.serialize===!0?Object.keys(v):s;delete p.serializers,qs([p],b,v,this._stdErrSerialize)}function _(I){this._childLevel=(I._childLevel|0)+1,this.error=_i(I,p,"error"),this.fatal=_i(I,p,"fatal"),this.warn=_i(I,p,"warn"),this.info=_i(I,p,"info"),this.debug=_i(I,p,"debug"),this.trace=_i(I,p,"trace"),v&&(this.serializers=v,this._serialize=b),e&&(this._logEvent=lo([].concat(I._logEvent.bindings,p)))}return _.prototype=this,new _(this)}return c}Et.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"}};Et.stdSerializers=X_;Et.stdTimeFunctions=Object.assign({},{nullTime:ed,epochTime:td,unixTime:nE,isoTime:oE});function vi(t,e,i,r){const s=Object.getPrototypeOf(e);e[i]=e.levelVal>e.levels.values[i]?Rr:s[i]?s[i]:Cr[i]||Cr[r]||Rr,eE(t,e,i)}function eE(t,e,i){!t.transmit&&e[i]===Rr||(e[i]=function(r){return function(){const n=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Cr?Cr:this;for(var c=0;c<o.length;c++)o[c]=arguments[c];if(t.serialize&&!t.asObject&&qs(o,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?r.call(a,tE(this,i,o,n)):r.apply(a,o),t.transmit){const l=t.transmit.level||e.level,h=Et.levels.values[l],u=Et.levels.values[i];if(u<h)return;iE(this,{ts:n,methodLevel:i,methodValue:u,transmitValue:Et.levels.values[t.transmit.level||e.level],send:t.transmit.send,val:e.levelVal},o)}}}(e[i]))}function tE(t,e,i,r){t._serialize&&qs(i,t._serialize,t.serializers,t._stdErrSerialize);const s=i.slice();let n=s[0];const o={};r&&(o.time=r),o.level=Et.levels.values[e];let a=(t._childLevel|0)+1;if(a<1&&(a=1),n!==null&&typeof n=="object"){for(;a--&&typeof s[0]=="object";)Object.assign(o,s.shift());n=s.length?Xc(s.shift(),s):void 0}else typeof n=="string"&&(n=Xc(s.shift(),s));return n!==void 0&&(o.msg=n),o}function qs(t,e,i,r){for(const s in t)if(r&&t[s]instanceof Error)t[s]=Et.stdSerializers.err(t[s]);else if(typeof t[s]=="object"&&!Array.isArray(t[s]))for(const n in t[s])e&&e.indexOf(n)>-1&&n in i&&(t[s][n]=i[n](t[s][n]))}function _i(t,e,i){return function(){const r=new Array(1+arguments.length);r[0]=e;for(var s=1;s<r.length;s++)r[s]=arguments[s-1];return t[i].apply(this,r)}}function iE(t,e,i){const r=e.send,s=e.ts,n=e.methodLevel,o=e.methodValue,a=e.val,c=t._logEvent.bindings;qs(i,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=s,t._logEvent.messages=i.filter(function(l){return c.indexOf(l)===-1}),t._logEvent.level.label=n,t._logEvent.level.value=o,r(n,t._logEvent,a),t._logEvent=lo(c)}function lo(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function rE(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const i in t)e[i]===void 0&&(e[i]=t[i]);return e}function sE(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?ed:td}function rs(){return{}}function Pn(t){return t}function Rr(){}function ed(){return!1}function td(){return Date.now()}function nE(){return Math.round(Date.now()/1e3)}function oE(){return new Date(Date.now()).toISOString()}function aE(){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 Vr=Ro(Di),cE={level:"info"},Hr="custom_context",Qo=1e3*1024;let lE=class{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}},Qc=class{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const i=new lE(e);if(i.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${i.size}`);for(;this.size+i.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=i),this.tail=i):(this.head=i,this.tail=i),this.lengthInNodes++,this.sizeInBytes+=i.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 i=this.head;for(;i!==null;)e.push(i.value),i=i.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 i=e.value;return e=e.next,{done:!1,value:i}}}}},id=class{constructor(e,i=Qo){this.level=e??"error",this.levelValue=Di.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=i,this.logs=new Qc(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,i){i===Di.levels.values.error?console.error(e):i===Di.levels.values.warn?console.warn(e):i===Di.levels.values.debug?console.debug(e):i===Di.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Dt({timestamp:new Date().toISOString(),log:e}));const i=typeof e=="string"?JSON.parse(e).level:e.level;i>=this.levelValue&&this.forwardToConsole(e,i)}getLogs(){return this.logs}clearLogs(){this.logs=new Qc(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const i=this.getLogArray();return i.push(Dt({extraMetadata:e})),new Blob(i,{type:"application/json"})}},hE=class{constructor(e,i=Qo){this.baseChunkLogger=new id(e,i)}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 i=URL.createObjectURL(this.logsToBlob(e)),r=document.createElement("a");r.href=i,r.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(i)}},uE=class{constructor(e,i=Qo){this.baseChunkLogger=new id(e,i)}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 dE=Object.defineProperty,pE=Object.defineProperties,fE=Object.getOwnPropertyDescriptors,el=Object.getOwnPropertySymbols,gE=Object.prototype.hasOwnProperty,yE=Object.prototype.propertyIsEnumerable,tl=(t,e,i)=>e in t?dE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Os=(t,e)=>{for(var i in e||(e={}))gE.call(e,i)&&tl(t,i,e[i]);if(el)for(var i of el(e))yE.call(e,i)&&tl(t,i,e[i]);return t},Ps=(t,e)=>pE(t,fE(e));function zs(t){return Ps(Os({},t),{level:(t==null?void 0:t.level)||cE.level})}function mE(t,e=Hr){return t[e]||""}
25function wE(t,e,i=Hr){return t[i]=e,t}function qe(t,e=Hr){let i="";return typeof t.bindings>"u"?i=mE(t,e):i=t.bindings().context||"",i}function bE(t,e,i=Hr){const r=qe(t,i);return r.trim()?`${r}/${e}`:e}function De(t,e,i=Hr){const r=bE(t,e,i),s=t.child({context:r});return wE(s,r,i)}function vE(t){var e,i;const r=new hE((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Vr(Ps(Os({},t.opts),{level:"trace",browser:Ps(Os({},(i=t.opts)==null?void 0:i.browser),{write:s=>r.write(s)})})),chunkLoggerController:r}}function _E(t){var e;const i=new uE((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Vr(Ps(Os({},t.opts),{level:"trace"}),i),chunkLoggerController:i}}function EE(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?vE(t):_E(t)}var IE=Object.defineProperty,SE=(t,e,i)=>e in t?IE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,il=(t,e,i)=>SE(t,typeof e!="symbol"?e+"":e,i);let OE=class extends hi{constructor(e){super(),this.opts=e,il(this,"protocol","wc"),il(this,"version",2)}};var PE=Object.defineProperty,$E=(t,e,i)=>e in t?PE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,AE=(t,e,i)=>$E(t,e+"",i);let xE=class extends hi{constructor(e,i){super(),this.core=e,this.logger=i,AE(this,"records",new Map)}},CE=class{constructor(e,i){this.logger=e,this.core=i}},RE=class extends hi{constructor(e,i){super(),this.relayer=e,this.logger=i}},TE=class extends hi{constructor(e){super()}},NE=class{constructor(e,i,r,s){this.core=e,this.logger=i,this.name=r}},LE=class extends hi{constructor(e,i){super(),this.relayer=e,this.logger=i}},DE=class extends hi{constructor(e,i){super(),this.core=e,this.logger=i}},jE=class{constructor(e,i,r){this.core=e,this.logger=i,this.store=r}},ME=class{constructor(e,i){this.projectId=e,this.logger=i}},UE=class{constructor(e,i,r){this.core=e,this.logger=i,this.telemetryEnabled=r}};var BE=Object.defineProperty,kE=(t,e,i)=>e in t?BE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,rl=(t,e,i)=>kE(t,typeof e!="symbol"?e+"":e,i);let FE=class{constructor(e){this.opts=e,rl(this,"protocol","wc"),rl(this,"version",2)}},qE=class{constructor(e){this.client=e}};const zE="PARSE_ERROR",VE="INVALID_REQUEST",HE="METHOD_NOT_FOUND",KE="INVALID_PARAMS",rd="INTERNAL_ERROR",ea="SERVER_ERROR",WE=[-32700,-32600,-32601,-32602,-32603],br={[zE]:{code:-32700,message:"Parse error"},[VE]:{code:-32600,message:"Invalid Request"},[HE]:{code:-32601,message:"Method not found"},[KE]:{code:-32602,message:"Invalid params"},[rd]:{code:-32603,message:"Internal error"},[ea]:{code:-32e3,message:"Server error"}},sd=ea;function GE(t){return WE.includes(t)}function sl(t){return Object.keys(br).includes(t)?br[t]:br[sd]}function YE(t){const e=Object.values(br).find(i=>i.code===t);return e||br[sd]}function nd(t,e,i){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${i} RPC url at ${e}`):t}var od={};/*! ***************************************************************************** 26Copyright (c) Microsoft Corporation. 27 28Permission to use, copy, modify, and/or distribute this software for any 29purpose with or without fee is hereby granted. 30 31THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 32REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 33AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 34INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 35LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 36OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 37PERFORMANCE OF THIS SOFTWARE. 38***************************************************************************** */var ho=function(t,e){return ho=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)r.hasOwnProperty(s)&&(i[s]=r[s])},ho(t,e)};function JE(t,e){ho(t,e);function i(){this.constructor=t}
vendor: 5,708 bytes, line 38
38t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}var uo=function(){return uo=Object.assign||function(e){for(var i,r=1,s=arguments.length;r<s;r++){i=arguments[r];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},uo.apply(this,arguments)};function ZE(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(i[r[s]]=t[r[s]]);return i}function XE(t,e,i,r){var s=arguments.length,n=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,i):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(n=(s<3?o(n):s>3?o(e,i,n):o(e,i))||n);return s>3&&n&&Object.defineProperty(e,i,n),n}function QE(t,e){return function(i,r){e(i,r,t)}}function e1(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function t1(t,e,i,r){function s(n){return n instanceof i?n:new i(function(o){o(n)})}return new(i||(i=Promise))(function(n,o){function a(h){try{l(r.next(h))}catch(u){o(u)}}function c(h){try{l(r.throw(h))}catch(u){o(u)}}function l(h){h.done?n(h.value):s(h.value).then(a,c)}l((r=r.apply(t,e||[])).next())})}function i1(t,e){var i={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},r,s,n,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(h){return c([l,h])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,s&&(n=l[0]&2?s.return:l[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,l[1])).done)return n;switch(s=0,n&&(l=[l[0]&2,n.value]),l[0]){case 0:case 1:n=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,s=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(n=i.trys,!(n=n.length>0&&n[n.length-1])&&(l[0]===6||l[0]===2)){i=0;continue}if(l[0]===3&&(!n||l[1]>n[0]&&l[1]<n[3])){i.label=l[1];break}if(l[0]===6&&i.label<n[1]){i.label=n[1],n=l;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(l);break}n[2]&&i.ops.pop(),i.trys.pop();continue}l=e.call(t,i)}catch(h){l=[6,h],s=0}finally{r=n=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function r1(t,e,i,r){r===void 0&&(r=i),t[r]=e[i]}function s1(t,e){for(var i in t)i!=="default"&&!e.hasOwnProperty(i)&&(e[i]=t[i])}function po(t){var e=typeof Symbol=="function"&&Symbol.iterator,i=e&&t[e],r=0;if(i)return i.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ad(t,e){var i=typeof Symbol=="function"&&t[Symbol.iterator];if(!i)return t;var r=i.call(t),s,n=[],o;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)n.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return n}function n1(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(ad(arguments[e]));return t}function o1(){for(var t=0,e=0,i=arguments.length;e<i;e++)t+=arguments[e].length;for(var r=Array(t),s=0,e=0;e<i;e++)for(var n=arguments[e],o=0,a=n.length;o<a;o++,s++)r[s]=n[o];return r}function Tr(t){return this instanceof Tr?(this.v=t,this):new Tr(t)}function a1(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),s,n=[];return s={},o("next"),o("throw"),o("return"),s[Symbol.asyncIterator]=function(){return this},s;function o(d){r[d]&&(s[d]=function(f){return new Promise(function(p,y){n.push([d,f,p,y])>1||a(d,f)})})}function a(d,f){try{c(r[d](f))}catch(p){u(n[0][3],p)}}function c(d){d.value instanceof Tr?Promise.resolve(d.value.v).then(l,h):u(n[0][2],d)}function l(d){a("next",d)}function h(d){a("throw",d)}function u(d,f){d(f),n.shift(),n.length&&a(n[0][0],n[0][1])}}function c1(t){var e,i;return e={},r("next"),r("throw",function(s){throw s}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(s,n){e[s]=t[s]?function(o){return(i=!i)?{value:Tr(t[s](o)),done:s==="return"}:n?n(o):o}:n}}function l1(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof po=="function"?po(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(n){i[n]=t[n]&&function(o){return new Promise(function(a,c){o=t[n](o),s(a,c,o.done,o.value)})}}function s(n,o,a,c){Promise.resolve(c).then(function(l){n({value:l,done:a})},o)}}function h1(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function u1(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var i in t)Object.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e.default=t,e}function d1(t){return t&&t.__esModule?t:{default:t}}function p1(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function f1(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i}const g1=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return uo},__asyncDelegator:c1,__asyncGenerator:a1,__asyncValues:l1,__await:Tr,__awaiter:t1,__classPrivateFieldGet:p1,__classPrivateFieldSet:f1,__createBinding:r1,__decorate:XE,__exportStar:s1,__extends:JE,__generator:i1,__importDefault:d1,__importStar:u1,__makeTemplateOb
38ject:h1,__metadata:e1,__param:QE,__read:ad,__rest:ZE,__spread:n1,__spreadArrays:o1,__values:po},Symbol.toStringTag,{value:"Module"})),y1=oh(g1);var At={},nl;function m1(){if(nl)return At;nl=1,Object.defineProperty(At,"__esModule",{value:!0}),At.isBrowserCryptoAvailable=At.getSubtleCrypto=At.getBrowerCrypto=void 0;function t(){return(window==null?void 0:window.crypto)||(window==null?void 0:window.msCrypto)||{}}At.getBrowerCrypto=t;function e(){const r=t();return r.subtle||r.webkitSubtle}At.getSubtleCrypto=e;function i(){return!!t()&&!!e()}return At.isBrowserCryptoAvailable=i,At}var xt={},ol;function w1(){if(ol)return xt;ol=1,Object.defineProperty(xt,"__esModule",{value:!0}),xt.isBrowser=xt.isNode=xt.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}xt.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}xt.isNode=e;function i(){return!t()&&!e()}return xt.isBrowser=i,xt}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=y1;e.__exportStar(m1(),t),e.__exportStar(w1(),t)})(od);function bt(t=3){const e=Date.now()*Math.pow(10,t),i=Math.floor(Math.random()*Math.pow(10,t));return e+i}function ii(t=6){return BigInt(bt(t))}function zt(t,e,i){return{id:i||bt(),jsonrpc:"2.0",method:t,params:e}}function Vs(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Hs(t,e,i){return{id:t,jsonrpc:"2.0",error:b1(e)}}function b1(t,e){return typeof t>"u"?sl(rd):(typeof t=="string"&&(t=Object.assign(Object.assign({},sl(ea)),{message:t})),GE(t.code)&&(t=YE(t.code)),t)}class v1{}class _1 extends v1{constructor(){super()}}class E1 extends _1{constructor(e){super()}}const I1="^https?:",S1="^wss?:";function O1(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function cd(t,e){const i=O1(t);return typeof i>"u"?!1:new RegExp(e).test(i)}function al(t){return cd(t,I1)}function cl(t){return cd(t,S1)}function P1(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function ld(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function ta(t){return ld(t)&&"method"in t}function Ks(t){return ld(t)&&(vt(t)||it(t))}function vt(t){return"result"in t}function it(t){return"error"in t}let st=class extends E1{constructor(e){super(e),this.events=new Je.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,i){this.events.on(e,i)}
vendor: 7,369 bytes, lines 38-41
38once(e,i){this.events.once(e,i)}off(e,i){this.events.off(e,i)}removeListener(e,i){this.events.removeListener(e,i)}async request(e,i){return this.requestStrict(zt(e.method,e.params||[],e.id||ii().toString()),i)}async requestStrict(e,i){return new Promise(async(r,s)=>{if(!this.connection.connected)try{await this.open()}catch(n){s(n)}this.events.on(`${e.id}`,n=>{it(n)?s(n.error):r(n.result)});try{await this.connection.send(e,i)}catch(n){s(n)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Ks(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 $1=()=>typeof WebSocket<"u"?WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),A1=()=>typeof WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",ll=t=>t.split("?")[0],hl=10,x1=$1();let C1=class{constructor(e){if(this.url=e,this.events=new Je.EventEmitter,this.registering=!1,!cl(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,i){this.events.on(e,i)}once(e,i){this.events.once(e,i)}off(e,i){this.events.off(e,i)}removeListener(e,i){this.events.removeListener(e,i)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,i)=>{if(typeof this.socket>"u"){i(new Error("Connection already closed"));return}this.socket.onclose=r=>{this.onClose(r),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Dt(e))}catch(i){this.onError(e.id,i)}}register(e=this.url){if(!cl(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const i=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=i||this.events.listenerCount("open")>=i)&&this.events.setMaxListeners(i+1),new Promise((r,s)=>{this.events.once("register_error",n=>{this.resetMaxListeners(),s(n)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return s(new Error("WebSocket connection is missing or invalid"));r(this.socket)})})}return this.url=e,this.registering=!0,new Promise((i,r)=>{const s=od.isReactNative()?void 0:{rejectUnauthorized:!P1(e)},n=new x1(e,[],s);A1()?n.onerror=o=>{const a=o;r(this.emitError(a.error))}:n.on("error",o=>{r(this.emitError(o))}),n.onopen=()=>{this.onOpen(n),i(n)}})}onOpen(e){e.onmessage=i=>this.onPayload(i),e.onclose=i=>this.onClose(i),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 i=typeof e.data=="string"?ni(e.data):e.data;this.events.emit("payload",i)}onError(e,i){const r=this.parseError(i),s=r.message||r.toString(),n=Hs(e,s);this.events.emit("payload",n)}parseError(e,i=this.url){return nd(e,ll(i),"WS")}resetMaxListeners(){this.events.getMaxListeners()>hl&&this.events.setMaxListeners(hl)}emitError(e){const i=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${ll(this.url)}`));return this.events.emit("register_error",i),i}};var R1={CI_COMMIT_SHORT_SHA:"fdeeacf8",CI_SERVER_REVISION:"47403677d65",CI_COMMIT_TAG_MESSAGE:"",CI_SERVER_VERSION_PATCH:"10",GITLAB_USER_LOGIN:"bink",FF_POSIXLY_CORRECT_ESCAPES:"false",FF_USE_WINDOWS_LEGACY_PROCESS_STRATEGY:"true",FF_SCRIPT_SECTIONS:"false",npm_package_dependencies_redux_persist:"^6.0.0",npm_package_dependencies_decimal_js:"^10.4.3",npm_package_dependencies__reduxjs_toolkit:"^2.2.1",CI_DEPENDENCY_PROXY_SERVER:"code.apowo.com:443",CI_DEPENDENCY_PROXY_PASSWORD:"glcbt-64_7XAtN1qSPGz4YshnyL_7",npm_package_scripts_localhost:"vite --mode localhost",MAIL:"/var/mail/root",USER:"root",npm_package_dependencies_react_toastify:"^10.0.5",npm_config_version_commit_hooks:"true",npm_config_user_agent:"yarn/1.22.19 npm/? node/v16.20.1 linux x64",CI_SHARED_ENVIRONMENT:"true",CI_SERVER_PROTOCOL:"https",CI:"true",FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY:"false",CI_RUNNER_REVISION:"865283c5",CI_PROJECT_NAME:"main",npm_package_dependencies_react_infinite_scroll_component:"^6.1.0",npm_package_dependencies__csstools_normalize_css:"^12.1.1",npm_config_bin_links:"true",CI_COMMIT_DESCRIPTION:` 39Devel 40 41See merge request DigiNation/Websites/main!70`,CI_PROJECT_DESCRIPTION:"",CI_JOB_STAGE:"build_release",npm_node_execpath:"/usr/local/bin/node",npm_config_init_version:"1.0.0",CI_SERVER_VERSION:"16.11.10",CI_DEPENDENCY_PROXY_USER:"gitlab-ci-token",SHLVL:"2",npm_package_dependencies_wagmi:"^2.12.2",npm_package_dependencies_react_hook_form:"^7.51.2",npm_package_dependencies_loadable_image:"^3.2.3",OLDPWD:"/home/gitlab-runner",HOME:"/root",CI_PROJECT_ROOT_NAMESPACE:"DigiNation",FF_DISABLE_POWERSHELL_STDIN:"false",npm_package_dependencies_moment_timezone:"^0.5.45",npm_package_dependencies_ethers:"5.7",FF_NETWORK_PER_BUILD:"false",CI_SERVER_HOST:"code.apowo.com",CI_COMMIT_REF_NAME:"release-2025-0421-1338",CI_JOB_ID:"324507",CI_RUNNER_VERSION:"16.1.0",CI_PIPELINE_SOURCE:"push",FF_RESOLVE_FULL_TLS_CHAIN:"true",npm_config_init_license:"MIT",CI_DEFAULT_BRANCH:"main",CI_BUILDS_DIR:"/home/gitlab-runner/builds",CI_SERVER_VERSION_MAJOR:"16",FF_SKIP_NOOP_BUILD_STAGES:"true",FF_USE_FASTZIP:"false",YARN_WRAP_OUTPUT:"false",npm_config_version_tag_prefix:"v",CI_REGISTRY_PASSWORD:"glcbt-64_7XAtN1qSPGz4YshnyL_7",CI_COMMIT_REF_PROTECTED:"false",CI_SERVER_URL:"https://code.apowo.com",CI_TEMPLATE_REGISTRY_HOST:"registry.gitlab.com",npm_package_dependencies_canvas_confetti:"^1.9.2",CI_PROJECT_ID:"463",GITLAB_FEATURES:"",CI_REGISTRY_IMAGE:"docker.apowo.com/digination/websites/main",DBUS_SESSION_BUS_ADDRESS:"unix:path=/run/user/0/bus",npm_package_devDependencies_eslint_plugin_react_hooks:"^4.6.0",npm_package_dependencies_moment:"^2.30.1",npm_package_dependencies_dayjs:"^1.11.11",GITLAB_CI:"true",CI_COMMIT_SHA:"fdeeacf8e1ee68db45038ed85b2a30315872a9da",CI_COMMIT_TAG:"release-2025-0421-1338",npm_package_description:"This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.",npm_package_devDependencies_tailwindcss:"^3.4.1",npm_package_dependencies_react_router_dom:"^6.22.1",CI_CONCURRENT_ID:"0",npm_package_readmeFilename:"README.md",
41npm_package_devDependencies__types_react_dom:"^18.2.19",npm_package_scripts_dev_build:"vite build --mode development",CI_REGISTRY_USER:"gitlab-ci-token",FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR:"false",CI_SERVER_PORT:"443",npm_package_scripts_dev:"vite --mode localhost",CI_PROJECT_PATH:"DigiNation/Websites/main",LOGNAME:"root",CI_PROJECT_DIR:"/home/gitlab-runner/builds/9Xxs78eUA/0/DigiNation/Websites/main",npm_package_devDependencies__vitejs_plugin_react:"^4.2.1",npm_package_scripts_prod:"vite --mode production",npm_package_type:"module",CI_COMMIT_TIMESTAMP:"2025-04-21T05:38:52+00:00",JOURNAL_STREAM:"9:23861",CI_PROJECT_NAMESPACE:"DigiNation/Websites",FF_ENABLE_JOB_CLEANUP:"false",_:"/usr/bin/yarn",npm_package_devDependencies_autoprefixer:"^10.4.17",npm_package_private:"true",CI_JOB_TOKEN:"glcbt-64_7XAtN1qSPGz4YshnyL_7",FF_USE_DIRECT_DOWNLOAD:"true",CI_SERVER_NAME:"GitLab",FF_USE_DYNAMIC_TRACE_FORCE_SEND_INTERVAL:"false",CI_NODE_TOTAL:"1",npm_package_dependencies_date_fns_tz:"^2.0.1",npm_package_scripts_lint:"eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",npm_config_registry:"https://registry.npmmirror.com",XDG_SESSION_ID:"c757",CI_PIPELINE_CREATED_AT:"2025-04-21T05:39:06Z",CI_PROJECT_NAMESPACE_ID:"465",FF_USE_IMPROVED_URL_MASKING:"false",RUNNER_TEMP_PROJECT_DIR:"/home/gitlab-runner/builds/9Xxs78eUA/0/DigiNation/Websites/main.tmp",CI_JOB_NAME_SLUG:"build-release",CI_CONCURRENT_PROJECT_ID:"0",GIT_STRATEGY:"clone",npm_package_devDependencies_eslint_plugin_react_refresh:"^0.4.5",npm_config_ignore_scripts:"",CI_PIPELINE_URL:"https://code.apowo.com/DigiNation/Websites/main/-/pipelines/216044",FF_KUBERNETES_HONOR_ENTRYPOINT:"false",npm_package_dependencies_axios:"^1.6.8",PATH:"/tmp/yarn--1745213991911-0.0678749672023149:/home/gitlab-runner/builds/9Xxs78eUA/0/DigiNation/Websites/main/node_modules/.bin:/usr/local/share/.config/yarn/link/node_modules/.bin:/usr/local/libexec/lib/node_modules/npm/bin/node-gyp-bin:/usr/local/lib/node_modules/npm/bin/node-gyp-bin:/usr/local/bin/node_modules/npm/bin/node-gyp-bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",NODE:"/usr/local/bin/node",INVOCATION_ID:"bb4c70a7696b44fe82a50ba60862da41",CONFIG_FILE:"/etc/gitlab-runner/config.toml",CI_JOB_STARTED_AT:"2025-04-21T05:39:07Z",CI_SERVER_VERSION_MINOR:"11",CI_RUNNER_DESCRIPTION:"digination-internal-runner",npm_package_dependencies_swiper:"^11.0.7",npm_package_name:"my-project",CI_COMMIT_TITLE:"Merge branch 'devel' into 'main'",CI_PROJECT_TITLE:"main",CI_PROJECT_VISIBILITY:"private",GIT_SUBMODULE_STRATEGY:"recursive",GITLAB_USER_EMAIL:"[email protected]",FF_USE_NEW_BASH_EVAL_STRATEGY:"false",XDG_RUNTIME_DIR:"/run/user/0",npm_package_dependencies_viem:"2.x",npm_package_dependencies_react_redux:"^9.1.0",CI_SERVER:"yes",npm_package_dependencies_react_tweet:"^3.2.0",LANG:"en_US.UTF-8",FF_CMD_DISABLE_DELAYED_ERROR_LEVEL_EXPANSION:"false",CI_PAGES_URL:"http://digination.example.com/Websites/main",CI_PROJECT_REPOSITORY_LANGUAGES:"javascript,css,html",npm_package_devDependencies_eslint:"^8.56.0",npm_package_dependencies_react_dom:"^18.2.0",CI_COMMIT_AUTHOR:"Bink Wang <[email protected]>",FF_SET_PERMISSIONS_BEFORE_CLEANUP:"true",CI_SERVER_FQDN:"code.apowo.com",npm_lifecycle_script:"vite build --mode production",CI_PAGES_DOMAIN:"example.com",CI_RUNNER_SHORT_TOKEN:"9Xxs78eUA",npm_config_version_git_message:"v%s",CI_JOB_TIMEOUT:"3600",CI_PIPELINE_NAME:"",CI_PROJECT_CLASSIFICATION_LABEL:"",CI_REPOSITORY_URL:"https://gitlab-ci-token:[email protected]/DigiNation/Websites/main.git",SHELL:"/bin/bash",npm_lifecycle_event:"build",npm_package_devDependencies__types_react:"^18.2.56",npm_package_version:"0.0.0",npm_config_ignore_engines:"true",CI_API_GRAPHQL_URL:"https://code.apowo.com/api/graphql",FF_USE_POWERSHELL_PATH_RESOLVER:"false",CI_RUNNER_ID:"166",npm_config_argv:'{"remain":[],"cooked":["run","build"],"original":["build"]}',npm_package_scripts_build:"vite build --mode production",CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX:"code.apowo.com:443/digination/websites/dependency_proxy/containers",CI_REGISTRY:"docker.apowo.com",GITLAB_USER_NAME:"Bink Wang",CI_API_V4_URL:"https://code.apowo.com/api/v4",CI_JOB_JWT_V1:"eyJraWQiOiJaN1hBcURHUE4wdE1weVAwS2l4VVhfakFoMmRqRWtjTlprZm4xSG9CcDNZIiwidHlwIjoiSldUIiwiYWxnIjoiUlMyNTYifQ.eyJuYW1lc3BhY2VfaWQiOiI0NjUiLCJuYW1lc3BhY2VfcGF0aCI6IkRpZ2lOYXRpb24vV2Vic2l0ZXMiLCJwcm9qZWN0X2lkIjoiNDYzIiwicHJvamVjdF9wYXRoIjoiRGlnaU5hdGlvbi9XZWJzaXRlcy9tYWluIiwidXNlcl9pZCI6IjE2IiwidXNlcl9sb2dpbiI6ImJpbmsiLCJ1c2VyX2VtYWlsIjoid2FuZ3l1QGFwb3dvLmNvbSIsInVzZXJfYWNjZXNzX2xldmVsIjoib3duZXIiLCJwaXBlbGluZV9pZCI6IjIxNjA0NCIsInBpcGVsaW5lX3NvdXJjZSI6InB1c2giLCJqb2JfaWQiOiIzMjQ1MDciLCJyZWYiOiJyZWxlYXNlLTIwMjUtMDQyMS0xMzM4IiwicmVmX3R5cGUiOiJ0YWciLCJyZWZfcGF0aCI6InJlZnMvdGFncy9yZWxlYXNlLTIwMjUtMDQyMS0xMzM4IiwicmVmX3Byb3RlY3RlZCI6ImZhbHNlIiwianRpIjoiMmJmMDI2ODItNGZkMi00NzAzLTkyMDMtMDE2MjRmMWZiNGZkIiwiaXNzIjoiY29kZS5hcG93by5jb20iLCJpYXQiOjE3NDUyMTM5NDcsIm5iZiI6MTc0NTIxMzk0MiwiZXhwIjoxNzQ1MjE3NTQ3LCJzdWIiOiJqb2JfMzI0NTA3In0.fvRmXYGEMmWexjkHUpupiZZZoQFbuoIEpFZ5L8nJEIWofwfIE1e1UICd5YpYLLg8uydDwoe1BtREzPxPEcVJ5GTmoQHYah6uiF86edR7ju35Je3_Q1aFIAcfxI0_YDeGpKcv1_PikTf7ehZoj98lT91wz4UZNkY0h4I0cLvY-KzE1YkmzRfQxtzpcoHfXAOvO-5qseNf35RpGgbcmIHX89gl0pppf0NxHlEhhrNXd3uHLMH8hHQuHhmIXbqFUFtnpRH7FkSDu2QQ2-SEZ0DdDb4ifSS1bMFM158wqzyfTHHn5lupehFG0LuJWLuTpgwiP5SOEUS1tTtawZFAZpBxRQ",npm_package_dependencies_vite:"5.3.4",npm_package_dependencies_lodash:"^4.17.21",npm_package_dependencies_aos:"^2.3.4",CI_PIPELINE_IID:"213",CI_JOB_JWT_V2:"eyJraWQiOiJaN1hBcURHUE4wdE1weVAwS2l4VVhfakFoMmRqRWtjTlprZm4xSG9CcDNZIiwidHlwIjoiSldUIiwiYWxnIjoiUlMyNTYifQ.eyJuYW1lc3BhY2VfaWQiOiI0NjUiLCJuYW1lc3BhY2VfcGF0aCI6IkRpZ2lOYXRpb24vV2Vic2l0ZXMiLCJwcm9qZWN0X2lkIjoiNDYzIiwicHJvamVjdF9wYXRoIjoiRGlnaU5hdGlvbi9XZWJzaXRlcy9tYWluIiwidXNlcl9pZCI6IjE2IiwidXNlcl9sb2dpbiI6ImJpbmsiLCJ1c2VyX2VtYWlsIjoid2FuZ3l1QGFwb3dvLmNvbSIsInVzZXJfYWNjZXNzX2xldmVsIjoib3duZXIiLCJwaXBlbGluZV9pZCI6IjIxNjA0NCIsInBpcGVsaW5lX3NvdXJjZSI6InB1c2giLCJqb2JfaWQiOiIzMjQ1MDciLCJyZWYiOiJyZWxlYXNlLTIwMjUtMDQyMS0xMzM4IiwicmVmX3R5cGUiOiJ0YWciLCJyZWZfcGF0aCI6InJlZnMvdGFncy9yZWxlYXNlLTIwMjUtMDQyMS0xMzM4IiwicmVmX3Byb3RlY3RlZCI6ImZhbHNlIiwicnVubmVyX2lkIjoxNjYsInJ1bm5lcl9lbnZpcm9ubWVudCI6InNlbGYtaG9zdGVkIiwic2hhIjoiZmRlZWFjZjhlMWVlNjhkYjQ1MDM4ZWQ4NWIyYTMwMzE1ODcyYTlkYSIsInByb2plY3RfdmlzaWJpbGl0eSI6InByaXZhdGUiLCJjaV9jb25maWdfcmVmX3VyaSI6ImNvZGUuYXBvd28uY29tL0RpZ2lOYXRpb24vV2Vic2l0ZXMvbWFpbi8vLmdpdGxhYi1jaS55bWxAcmVmcy90YWdzL3JlbGVhc2UtMjAyNS0wNDIxLTEzMzgiLCJjaV9jb25maWdfc2hhIjoiZmRlZWFjZjhlMWVlNjhkYjQ1MDM4ZWQ4NWIyYTMwMzE1ODcyYTlkYSIsImp0aSI6Ijg3NGIwMmE3LWFkNDAtNDY4ZC1iYTUwLTZhZjVjNWNlYTlhMCIsImlzcyI6Imh0dHBzOi8vY29kZS5hcG93by5jb20iLCJpYXQiOjE3NDUyMTM5NDcsIm5iZiI6MTc0NTIxMzk0MiwiZXhwIjoxNzQ1MjE3NTQ3LCJzdWIiOiJwcm9qZWN0X3BhdGg6RGlnaU5hdGlvbi9XZWJzaXRlcy9tYWluOnJlZl90eXBlOnRhZzpyZWY6cmVsZWFzZS0yMDI1LTA0MjEtMTMzOCIsImF1ZCI6Imh0dHBzOi8vY29kZS5hcG93by5jb20ifQ.0ZkIas0sOBPUhtd69mGpZ14OqX02SQNnNp15iGup9aOjhKuXXxXkyurDLzLofT0lM9eXc7_hvbva3u358-rcUeqVfMA4QZXOtP5Nfn9M54u7JGTuZekzviZ0kj8O-51AVXCk_Qnw4J22i4ZbM0OvoixYP_e2tC7byRTLo9tef8bo8bY3mS-ndCQplOb7JNtPPFzti8hxR8jjvLmwkGLWLKdV8GSDaolDfYp5SuOeT_RLj8YXCof0GGQWtR0_39ay1IMdb5WbS6pxg9s_x66PfPTtkoCkYkhwetH8GOGCBbJOO0
41DSFym6EMHErd7BWakg_TWR3kF_EJnd4yhjoZ68NQ",npm_package_dependencies_qrcode_react:"^3.1.0",npm_package_dependencies__tanstack_react_query:"^5.51.15",npm_config_version_git_tag:"true",npm_config_version_git_sign:"",CI_RUNNER_EXECUTABLE_ARCH:"linux/amd64",CI_SERVER_SHELL_SSH_HOST:"code.apowo.com",CI_JOB_URL:"https://code.apowo.com/DigiNation/Websites/main/-/jobs/324507",FF_USE_POD_ACTIVE_DEADLINE_SECONDS:"false",FF_USE_ADVANCED_POD_SPEC_CONFIGURATION:"false",npm_package_devDependencies_eslint_plugin_react:"^7.33.2",npm_package_dependencies_classnames:"^2.5.1",npm_config_strict_ssl:"true",npm_config_config:"set",npm_package_dependencies_react_select:"^5.8.0",npm_package_dependencies_crypto_js:"^4.2.0",CI_COMMIT_REF_SLUG:"release-2025-0421-1338",PWD:"/home/gitlab-runner/builds/9Xxs78eUA/0/DigiNation/Websites/main",CI_JOB_JWT:"eyJraWQiOiJaN1hBcURHUE4wdE1weVAwS2l4VVhfakFoMmRqRWtjTlprZm4xSG9CcDNZIiwidHlwIjoiSldUIiwiYWxnIjoiUlMyNTYifQ.eyJuYW1lc3BhY2VfaWQiOiI0NjUiLCJuYW1lc3BhY2VfcGF0aCI6IkRpZ2lOYXRpb24vV2Vic2l0ZXMiLCJwcm9qZWN0X2lkIjoiNDYzIiwicHJvamVjdF9wYXRoIjoiRGlnaU5hdGlvbi9XZWJzaXRlcy9tYWluIiwidXNlcl9pZCI6IjE2IiwidXNlcl9sb2dpbiI6ImJpbmsiLCJ1c2VyX2VtYWlsIjoid2FuZ3l1QGFwb3dvLmNvbSIsInVzZXJfYWNjZXNzX2xldmVsIjoib3duZXIiLCJwaXBlbGluZV9pZCI6IjIxNjA0NCIsInBpcGVsaW5lX3NvdXJjZSI6InB1c2giLCJqb2JfaWQiOiIzMjQ1MDciLCJyZWYiOiJyZWxlYXNlLTIwMjUtMDQyMS0xMzM4IiwicmVmX3R5cGUiOiJ0YWciLCJyZWZfcGF0aCI6InJlZnMvdGFncy9yZWxlYXNlLTIwMjUtMDQyMS0xMzM4IiwicmVmX3Byb3RlY3RlZCI6ImZhbHNlIiwianRpIjoiMmJmMDI2ODItNGZkMi00NzAzLTkyMDMtMDE2MjRmMWZiNGZkIiwiaXNzIjoiY29kZS5hcG93by5jb20iLCJpYXQiOjE3NDUyMTM5NDcsIm5iZiI6MTc0NTIxMzk0MiwiZXhwIjoxNzQ1MjE3NTQ3LCJzdWIiOiJqb2JfMzI0NTA3In0.fvRmXYGEMmWexjkHUpupiZZZoQFbuoIEpFZ5L8nJEIWofwfIE1e1UICd5YpYLLg8uydDwoe1BtREzPxPEcVJ5GTmoQHYah6uiF86edR7ju35Je3_Q1aFIAcfxI0_YDeGpKcv1_PikTf7ehZoj98lT91wz4UZNkY0h4I0cLvY-KzE1YkmzRfQxtzpcoHfXAOvO-5qseNf35RpGgbcmIHX89gl0pppf0NxHlEhhrNXd3uHLMH8hHQuHhmIXbqFUFtnpRH7FkSDu2QQ2-SEZ0DdDb4ifSS1bMFM158wqzyfTHHn5lupehFG0LuJWLuTpgwiP5SOEUS1tTtawZFAZpBxRQ",npm_execpath:"/usr/share/yarn/bin/yarn.js",CI_RUNNER_TAGS:'["internal-runner"]',FF_USE_NEW_SHELL_ESCAPE:"false",XDG_DATA_DIRS:"/usr/local/share:/usr/share:/var/lib/snapd/desktop",FF_SECRET_RESOLVING_FAILS_IF_MISSING:"true",npm_package_dependencies_react_ga4:"^2.1.0",npm_package_dependencies_react_countdown:"^2.3.5",CI_PROJECT_URL:"https://code.apowo.com/DigiNation/Websites/main",CI_PIPELINE_ID:"216044",CI_COMMIT_BEFORE_SHA:"0000000000000000000000000000000000000000",CI_PROJECT_PATH_SLUG:"digination-websites-main",CI_SERVER_TLS_CA_FILE:"/home/gitlab-runner/builds/9Xxs78eUA/0/DigiNation/Websites/main.tmp/CI_SERVER_TLS_CA_FILE",CI_CONFIG_PATH:".gitlab-ci.yml",npm_package_devDependencies_postcss:"^8.4.35",npm_package_dependencies_util:"^0.12.5",npm_config_save_prefix:"^",npm_config_ignore_optional:"",CI_COMMIT_MESSAGE:`Merge branch 'devel' into 'main' 42 43Devel 44 45See merge request DigiNation/Websites/main!70`,npm_package_dependencies_web3:"^4.9.0",npm_package_scripts_preview:"vite preview",FF_ENABLE_BASH_EXIT_CODE_CHECK:"false",CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX:"code.apowo.com:443/digination/dependency_proxy/containers",GITLAB_USER_ID:"16",npm_package_dependencies_web_vitals:"^3.5.2",INIT_CWD:"/home/gitlab-runner/builds/9Xxs78eUA/0/DigiNation/Websites/main",CI_JOB_NAME:"build:release",CI_SERVER_SHELL_SSH_PORT:"22",CI_JOB_STATUS:"running",npm_package_dependencies_react:"^18.2.0",npm_package_dependencies_luxon:"^3.5.0",NODE_ENV:"production"};const hd="wc",ud=2,fo="core",It=`${hd}@2:${fo}:`,T1={logger:"error"},N1={database:":memory:"},L1="crypto",ul="client_ed25519_seed",D1=L.ONE_DAY,j1="keychain",M1="0.3",U1="messages",B1="0.3",dl=L.SIX_HOURS,k1="publisher",dd="irn",F1="error",pd="wss://relay.walletconnect.org",q1="relayer",be={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"},z1="_subscription",Qe={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},V1=.1,go="2.19.2",ce={link_mode:"link_mode",relay:"relay"},ys={inbound:"inbound",outbound:"outbound"},H1="0.3",K1="WALLETCONNECT_CLIENT_ID",pl="WALLETCONNECT_LINK_MODE_APPS",He={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},W1="subscription",G1="0.3",Y1="pairing",J1="0.3",hr={wc_pairingDelete:{req:{ttl:L.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:L.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:L.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:L.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:L.ONE_DAY,prompt:!1,tag:0},res:{ttl:L.ONE_DAY,prompt:!1,tag:0}}},Qt={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},at={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},Z1="history",X1="0.3",Q1="expirer",tt={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},eI="0.3",tI="verify-api",iI="https://verify.walletconnect.com",fd="https://verify.walletconnect.org",vr=fd,rI=`${vr}/v3`,sI=[iI,fd],nI="echo",oI="https://echo.walletconnect.com",wt={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"},Ct={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"},ct={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"},Gt={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"},Yt={authenticated_session_approve_started:"authenticated_session_approve_started",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"}
vendor: 6,995 bytes, line 45
45,ur={no_internet_connection:"no_internet_connection",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"},aI=.1,cI="event-client",lI=86400,hI="https://pulse.walletconnect.org/batch";function uI(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var i=new Uint8Array(256),r=0;r<i.length;r++)i[r]=255;for(var s=0;s<t.length;s++){var n=t.charAt(s),o=n.charCodeAt(0);if(i[o]!==255)throw new TypeError(n+" is ambiguous");i[o]=s}var a=t.length,c=t.charAt(0),l=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function u(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var y=0,w=0,v=0,b=p.length;v!==b&&p[v]===0;)v++,y++;for(var _=(b-v)*h+1>>>0,I=new Uint8Array(_);v!==b;){for(var A=p[v],x=0,$=_-1;(A!==0||x<w)&&$!==-1;$--,x++)A+=256*I[$]>>>0,I[$]=A%a>>>0,A=A/a>>>0;if(A!==0)throw new Error("Non-zero carry");w=x,v++}for(var R=_-w;R!==_&&I[R]===0;)R++;for(var O=c.repeat(y);R<_;++R)O+=t.charAt(I[R]);return O}function d(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var y=0;if(p[y]!==" "){for(var w=0,v=0;p[y]===c;)w++,y++;for(var b=(p.length-y)*l+1>>>0,_=new Uint8Array(b);p[y];){var I=i[p.charCodeAt(y)];if(I===255)return;for(var A=0,x=b-1;(I!==0||A<v)&&x!==-1;x--,A++)I+=a*_[x]>>>0,_[x]=I%256>>>0,I=I/256>>>0;if(I!==0)throw new Error("Non-zero carry");v=A,y++}if(p[y]!==" "){for(var $=b-v;$!==b&&_[$]===0;)$++;for(var R=new Uint8Array(w+(b-$)),O=w;$!==b;)R[O++]=_[$++];return R}}}function f(p){var y=d(p);if(y)return y;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:d,decode:f}}var dI=uI,pI=dI;const gd=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")},fI=t=>new TextEncoder().encode(t),gI=t=>new TextDecoder().decode(t);class yI{constructor(e,i,r){this.name=e,this.prefix=i,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class mI{constructor(e,i,r){if(this.name=e,this.prefix=i,i.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=i.codePointAt(0),this.baseDecode=r}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 yd(this,e)}}class wI{constructor(e){this.decoders=e}or(e){return yd(this,e)}decode(e){const i=e[0],r=this.decoders[i];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const yd=(t,e)=>new wI({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class bI{constructor(e,i,r,s){this.name=e,this.prefix=i,this.baseEncode=r,this.baseDecode=s,this.encoder=new yI(e,i,r),this.decoder=new mI(e,i,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Ws=({name:t,prefix:e,encode:i,decode:r})=>new bI(t,e,i,r),Kr=({prefix:t,name:e,alphabet:i})=>{const{encode:r,decode:s}=pI(i,e);return Ws({prefix:t,name:e,encode:r,decode:n=>gd(s(n))})},vI=(t,e,i,r)=>{const s={};for(let h=0;h<e.length;++h)s[e[h]]=h;let n=t.length;for(;t[n-1]==="=";)--n;const o=new Uint8Array(n*i/8|0);let a=0,c=0,l=0;for(let h=0;h<n;++h){const u=s[t[h]];if(u===void 0)throw new SyntaxError(`Non-${r} character`);c=c<<i|u,a+=i,a>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=i||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},_I=(t,e,i)=>{const r=e[e.length-1]==="=",s=(1<<i)-1;let n="",o=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],o+=8;o>i;)o-=i,n+=e[s&a>>o];if(o&&(n+=e[s&a<<i-o]),r)for(;n.length*i&7;)n+="=";return n},xe=({name:t,prefix:e,bitsPerChar:i,alphabet:r})=>Ws({prefix:e,name:t,encode(s){return _I(s,r,i)},decode(s){return vI(s,r,i,t)}}),EI=Ws({prefix:"\0",name:"identity",encode:t=>gI(t),decode:t=>fI(t)});var II=Object.freeze({__proto__:null,identity:EI});const SI=xe({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var OI=Object.freeze({__proto__:null,base2:SI});const PI=xe({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var $I=Object.freeze({__proto__:null,base8:PI});const AI=Kr({prefix:"9",name:"base10",alphabet:"0123456789"});var xI=Object.freeze({__proto__:null,base10:AI});const CI=xe({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),RI=xe({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var TI=Object.freeze({__proto__:null,base16:CI,base16upper:RI});const NI=xe({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),LI=xe({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),DI=xe({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),jI=xe({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),MI=xe({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),UI=xe({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),BI=xe({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),kI=xe({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),FI=xe({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var qI=Object.freeze({__proto__:null,base32:NI,base32upper:LI,base32pad:DI,base32padupper:jI,base32hex:MI,base32hexupper:UI,base32hexpad:BI,base32hexpadupper:kI,base32z:FI});const zI=Kr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),VI=Kr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var HI=Object.freeze({__proto__:null,base36:zI,base36upper:VI});const KI=Kr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),WI=Kr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var GI=Object.freeze({__proto__:null,base58btc:KI,base58flickr:WI});const YI=xe({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
45+/",bitsPerChar:6}),JI=xe({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ZI=xe({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),XI=xe({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var QI=Object.freeze({__proto__:null,base64:YI,base64pad:JI,base64url:ZI,base64urlpad:XI});const md=Array.from("ððªâð°ðððððððððððððâð»ð¥ð¾ð¿ðâ¤ðð¤£ððððððð
ððð¥ð¥°ðððð¢ð¤ðððªðâºðð¤ððððð¹ð¤¦ððââ¨ð¤·ð±ðð¸ððððððððð¤©ððð¤ðð¯ððð¶ðð¤â£ððððªðð¥ððð©ð¡ð¤ªðð¥³ð¥ð¤¤ððð³âððð´ðð¬ððð·ð»ðââ
ð¥ºððð¤ð¦âð£ððâ¹ððð âððºðð»ððððð¹ð£ð«ðððµð¤ðð´ð¤ð¼ð«â½ð¤âðð¤«ðð®ðð»ðð¶ðð²ð¿ð§¡ðâ¡ððââðð°ð¤¨ð¶ð¤ð¶ð°ðð¢ð¤ðð¨ð¨ð¤¬âððºð¤ððð±ðð¶ð¥´â¶â¡âðð¸â¬ð¨ðð¦ð·ðºâ ð
ððµðð¤²ð¤ ð¤§ððµð
ð§ð¾ððð¤ðð¤¯ð·âð§ð¯ððð¤ððâð´ð£ð¸ððð¥ð¤¢ð
ð¡ð©ðð¸ð»ð¤ð¤®ð¼ð¥µð©ððð¼ðð£ð¥"),eS=md.reduce((t,e,i)=>(t[i]=e,t),[]),tS=md.reduce((t,e,i)=>(t[e.codePointAt(0)]=i,t),[]);function iS(t){return t.reduce((e,i)=>(e+=eS[i],e),"")}function rS(t){const e=[];for(const i of t){const r=tS[i.codePointAt(0)];if(r===void 0)throw new Error(`Non-base256emoji character: ${i}`);e.push(r)}return new Uint8Array(e)}const sS=Ws({prefix:"ð",name:"base256emoji",encode:iS,decode:rS});var nS=Object.freeze({__proto__:null,base256emoji:sS}),oS=wd,fl=128,aS=-128,cS=Math.pow(2,31);function wd(t,e,i){e=e||[],i=i||0;for(var r=i;t>=cS;)e[i++]=t&255|fl,t/=128;for(;t&aS;)e[i++]=t&255|fl,t>>>=7;return e[i]=t|0,wd.bytes=i-r+1,e}var lS=yo,hS=128,gl=127;function yo(t,r){var i=0,r=r||0,s=0,n=r,o,a=t.length;do{if(n>=a)throw yo.bytes=0,new RangeError("Could not decode varint");o=t[n++],i+=s<28?(o&gl)<<s:(o&gl)*Math.pow(2,s),s+=7}while(o>=hS);return yo.bytes=n-r,i}var uS=Math.pow(2,7),dS=Math.pow(2,14),pS=Math.pow(2,21),fS=Math.pow(2,28),gS=Math.pow(2,35),yS=Math.pow(2,42),mS=Math.pow(2,49),wS=Math.pow(2,56),bS=Math.pow(2,63),vS=function(t){return t<uS?1:t<dS?2:t<pS?3:t<fS?4:t<gS?5:t<yS?6:t<mS?7:t<wS?8:t<bS?9:10},_S={encode:oS,decode:lS,encodingLength:vS},bd=_S;const yl=(t,e,i=0)=>(bd.encode(t,e,i),e),ml=t=>bd.encodingLength(t),mo=(t,e)=>{const i=e.byteLength,r=ml(t),s=r+ml(i),n=new Uint8Array(s+i);return yl(t,n,0),yl(i,n,r),n.set(e,s),new ES(t,i,e,n)};class ES{constructor(e,i,r,s){this.code=e,this.size=i,this.digest=r,this.bytes=s}}const vd=({name:t,code:e,encode:i})=>new IS(t,e,i);class IS{constructor(e,i,r){this.name=e,this.code=i,this.encode=r}digest(e){if(e instanceof Uint8Array){const i=this.encode(e);return i instanceof Uint8Array?mo(this.code,i):i.then(r=>mo(this.code,r))}else throw Error("Unknown type, must be binary type")}}const _d=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),SS=vd({name:"sha2-256",code:18,encode:_d("SHA-256")}),OS=vd({name:"sha2-512",code:19,encode:_d("SHA-512")});var PS=Object.freeze({__proto__:null,sha256:SS,sha512:OS});const Ed=0,$S="identity",Id=gd,AS=t=>mo(Ed,Id(t)),xS={code:Ed,name:$S,encode:Id,digest:AS};var CS=Object.freeze({__proto__:null,identity:xS});new TextEncoder,new TextDecoder;const wl={...II,...OI,...$I,...xI,...TI,...qI,...HI,...GI,...QI,...nS};({...PS,...CS});function RS(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Sd(t,e,i,r){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:i},decoder:{decode:r}}}const bl=Sd("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),$n=Sd("ascii","a",t=>{let e="a";for(let i=0;i<t.length;i++)e+=String.fromCharCode(t[i]);return e},t=>{t=t.substring(1);const e=RS(t.length);for(let i=0;i<t.length;i++)e[i]=t.charCodeAt(i);return e}),TS={utf8:bl,"utf-8":bl,hex:wl.base16,latin1:$n,ascii:$n,binary:$n,...wl};function NS(t,e="utf8"){const i=TS[e];if(!i)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):i.decoder.decode(`${i.prefix}${t}`)}var LS=Object.defineProperty,DS=(t,e,i)=>e in t?LS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,yt=(t,e,i)=>DS(t,typeof e!="symbol"?e+"":e,i);
vendor: 4,314 bytes, line 45
45class jS{constructor(e,i){this.core=e,this.logger=i,yt(this,"keychain",new Map),yt(this,"name",j1),yt(this,"version",M1),yt(this,"initialized",!1),yt(this,"storagePrefix",It),yt(this,"init",async()=>{if(!this.initialized){const r=await this.getKeyChain();typeof r<"u"&&(this.keychain=r),this.initialized=!0}}),yt(this,"has",r=>(this.isInitialized(),this.keychain.has(r))),yt(this,"set",async(r,s)=>{this.isInitialized(),this.keychain.set(r,s),await this.persist()}),yt(this,"get",r=>{this.isInitialized();const s=this.keychain.get(r);if(typeof s>"u"){const{message:n}=D("NO_MATCHING_KEY",`${this.name}: ${r}`);throw new Error(n)}return s}),yt(this,"del",async r=>{this.isInitialized(),this.keychain.delete(r),await this.persist()}),this.core=e,this.logger=De(i,this.name)}get context(){return qe(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Jn(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Zn(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=D("NOT_INITIALIZED",this.name);throw new Error(e)}}}var MS=Object.defineProperty,US=(t,e,i)=>e in t?MS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Se=(t,e,i)=>US(t,typeof e!="symbol"?e+"":e,i);class BS{constructor(e,i,r){this.core=e,this.logger=i,Se(this,"name",L1),Se(this,"keychain"),Se(this,"randomSessionIdentifier",ao()),Se(this,"initialized",!1),Se(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),Se(this,"hasKeys",s=>(this.isInitialized(),this.keychain.has(s))),Se(this,"getClientId",async()=>{this.isInitialized();const s=await this.getClientSeed(),n=ec(s);return ou(n.publicKey)}),Se(this,"generateKeyPair",()=>{this.isInitialized();const s=b0();return this.setPrivateKey(s.publicKey,s.privateKey)}),Se(this,"signJWT",async s=>{this.isInitialized();const n=await this.getClientSeed(),o=ec(n),a=this.randomSessionIdentifier;return await jm(a,s,D1,o)}),Se(this,"generateSharedKey",(s,n,o)=>{this.isInitialized();const a=this.getPrivateKey(s),c=v0(a,n);return this.setSymKey(c,o)}),Se(this,"setSymKey",async(s,n)=>{this.isInitialized();const o=n||ps(s);return await this.keychain.set(o,s),o}),Se(this,"deleteKeyPair",async s=>{this.isInitialized(),await this.keychain.del(s)}),Se(this,"deleteSymKey",async s=>{this.isInitialized(),await this.keychain.del(s)}),Se(this,"encode",async(s,n,o)=>{this.isInitialized();const a=Yu(o),c=Dt(n);if(Uc(a))return I0(c,o==null?void 0:o.encoding);if(Mc(a)){const d=a.senderPublicKey,f=a.receiverPublicKey;s=await this.generateSharedKey(d,f)}const l=this.getSymKey(s),{type:h,senderPublicKey:u}=a;return _0({type:h,symKey:l,message:c,senderPublicKey:u,encoding:o==null?void 0:o.encoding})}),Se(this,"decode",async(s,n,o)=>{this.isInitialized();const a=O0(n,o);if(Uc(a)){const c=S0(n,o==null?void 0:o.encoding);return ni(c)}if(Mc(a)){const c=a.receiverPublicKey,l=a.senderPublicKey;s=await this.generateSharedKey(c,l)}try{const c=this.getSymKey(s),l=E0({symKey:c,encoded:n,encoding:o==null?void 0:o.encoding});return ni(l)}catch(c){this.logger.error(`Failed to decode message from topic: '${s}', clientId: '${await this.getClientId()}'`),this.logger.error(c)}}),Se(this,"getPayloadType",(s,n=ut)=>{const o=Ar({encoded:s,encoding:n});return ci(o.type)}),Se(this,"getPayloadSenderPublicKey",(s,n=ut)=>{const o=Ar({encoded:s,encoding:n});return o.senderPublicKey?Fe(o.senderPublicKey,Le):void 0}),this.core=e,this.logger=De(i,this.name),this.keychain=r||new jS(this.core,this.logger)}get context(){return qe(this.logger)}async setPrivateKey(e,i){return await this.keychain.set(e,i),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(ul)}catch{e=ao(),await this.keychain.set(ul,e)}return NS(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=D("NOT_INITIALIZED",this.name);throw new Error(e)}}}var kS=Object.defineProperty,FS=Object.defineProperties,qS=Object.getOwnPropertyDescriptors,vl=Object.getOwnPropertySymbols,zS=Object.prototype.hasOwnProperty,VS=Object.prototype.propertyIsEnumerable,wo=(t,e,
45i)=>e in t?kS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,HS=(t,e)=>{for(var i in e||(e={}))zS.call(e,i)&&wo(t,i,e[i]);if(vl)for(var i of vl(e))VS.call(e,i)&&wo(t,i,e[i]);return t},KS=(t,e)=>FS(t,qS(e)),ze=(t,e,i)=>wo(t,typeof e!="symbol"?e+"":e,i);class WS extends CE{constructor(e,i){super(e,i),this.logger=e,this.core=i,ze(this,"messages",new Map),ze(this,"messagesWithoutClientAck",new Map),ze(this,"name",U1),ze(this,"version",B1),ze(this,"initialized",!1),ze(this,"storagePrefix",It),ze(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const r=await this.getRelayerMessages();typeof r<"u"&&(this.messages=r);const s=await this.getRelayerMessagesWithoutClientAck();typeof s<"u"&&(this.messagesWithoutClientAck=s),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(r){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(r)}finally{this.initialized=!0}}}),ze(this,"set",async(r,s,n)=>{this.isInitialized();const o=_t(s);let a=this.messages.get(r);if(typeof a>"u"&&(a={}),typeof a[o]<"u")return o;if(a[o]=s,this.messages.set(r,a),n===ys.inbound){const c=this.messagesWithoutClientAck.get(r)||{};this.messagesWithoutClientAck.set(r,KS(HS({},c),{[o]:s}))}return await this.persist(),o}),ze(this,"get",r=>{this.isInitialized();let s=this.messages.get(r);return typeof s>"u"&&(s={}),s}),ze(this,"getWithoutAck",r=>{this.isInitialized();const s={};for(const n of r){const o=this.messagesWithoutClientAck.get(n)||{};s[n]=Object.values(o)}return s}),ze(this,"has",(r,s)=>{this.isInitialized();const n=this.get(r),o=_t(s);return typeof n[o]<"u"}),ze(this,"ack",async(r,s)=>{this.isInitialized();const n=this.messagesWithoutClientAck.get(r);if(typeof n>"u")return;const o=_t(s);delete n[o],Object.keys(n).length===0?this.messagesWithoutClientAck.delete(r):this.messagesWithoutClientAck.set(r,n),await this.persist()}),ze(this,"del",async r=>{this.isInitialized(),this.messages.delete(r),this.messagesWithoutClientAck.delete(r),await this.persist()}),this.logger=De(e,this.name),this.core=i}get context(){return qe(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Jn(e))}async setRelayerMessagesWithoutClientAck(e){await this.core.storage.setItem(this.storageKeyWithoutClientAck,Jn(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Zn(e):void 0}async getRelayerMessagesWithoutClientAck(){const e=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof e<"u"?Zn(e):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:e}=D("NOT_INITIALIZED",this.name);throw new Error(e)}}}var GS=Object.defineProperty,YS=Object.defineProperties,JS=Object.getOwnPropertyDescriptors,_l=Object.getOwnPropertySymbols,ZS=Object.prototype.hasOwnProperty,XS=Object.prototype.propertyIsEnumerable,bo=(t,e,i)=>e in t?GS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ss=(t,e)=>{for(var i in e||(e={}))ZS.call(e,i)&&bo(t,i,e[i]);if(_l)for(var i of _l(e))XS.call(e,i)&&bo(t,i,e[i]);return t},An=(t,e)=>YS(t,JS(e)),lt=(t,e,i)=>bo(t,typeof e!="symbol"?e+"":e,i);class QS extends RE{constructor(e,i){super(e,i),this.relayer=e,this.logger=i,lt(this,"events",new Je.EventEmitter),lt(this,"name",k1),lt(this,"queue",new Map),lt(this,"publishTimeout",L.toMiliseconds(L.ONE_MINUTE)),lt(this,"initialPublishTimeout",L.toMiliseconds(L.ONE_SECOND*15)),lt(this,"needsTransportRestart",!1),lt(this,"publish",async(r,s,n)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:r,message:s,opts:n}});const a=(n==null?void 0:n.ttl)||dl,c=Is(n),l=(n==null?void 0:n.prompt)||!1,h=(n==null?void 0:n.tag)||0,u=(n==null?void 0:n.id)||ii().toString(),d={topic:r,message:s,opts:{ttl:a,relay:c,prompt:l,tag:h,id:u,attestation:n==null?void 0:n.attestation,tvf:n==null?void 0:n.tvf}},f=`Failed to publish payload, please try again. id:${u} tag:${h}`;try{const p=new Promise(async y=>{const w=({id:b})=>{d.opts.id===b&&(this.removeRequestFromQueue(b),this.relayer.events.removeListener(be.publish,w),y(d))};this.relayer.events.on(be.publish,w);const v=qt(new Promise((b,_)=>{this.rpcPublish({topic:r,message:s,ttl:a,prompt:l,tag:h,id:u,attestation:n==null?void 0:n.attestation,tvf:n==null?void 0:n.tvf}).then(b).catch(I=>{this.logger.warn(I,I==null?void 0:I.message),_(I)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${u} tag:${h}`);try{await v,this.events.removeListener(be.publish,w)}catch(b){this.queue.set(u,An(ss({},d),{attempt:1})),this.logger.warn(b,b==null?void 0:b.message)}});this.logger.trace({type:"method",method:"publish",params:{id:u,topic:r,message:s,opts:n}}),await qt(p,this.publishTimeout,f)}catch(p){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(p),(o=n==null?void 0:n.internal)!=null&&o.throwOnFailedPublish)throw p}finally{this.queue.delete(u)}}),lt(this,"on",(r,s)=>{this.events.on(r,s)}),lt(this,"once",(r,s)=>{this.events.once(r,s)}),lt(this,"off",(r,s)=>{this.events.off(r,s)}),lt(this,"removeListener",(r,s)=>{this.events.removeListener(r,s)}),this.relayer=e,this.logger=De(i,this.name),this.registerEventListeners()}get context(){return qe(this.logger)}async rpcPublish(e){var i,r,s,n;const{topic:o,message:a,ttl:c=dl,prompt:l,tag:h,id:u,attestation:d,tvf:f}=e,p={method:fr(Is().protocol).publish,params:ss({topic:o,message:a,ttl:c,prompt:l,tag:h,attestation:d},f),id:u};Pe((i=p.params)==null?void 0:i.prompt)&&((r=p.params)==null||delete r.prompt),Pe((s=p.params)==null?void 0:s.tag)&&((n=p.params)==null||delete n.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:p});const y=await this.relayer.request(p);return this.relayer.events.emit(be.publish,e),this.logger.debug("Successfully Published Payload"),y}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async(e,i)=>{const r=e.attempt+1;this.queue.set(i,An(ss({},e),{attempt:r}));const{topic:s,message:n,opts:o,attestation:a}=e;this.logger.warn({},`Publisher: queue->publishing: ${e.opts.id}, tag: ${e.opts.tag}, attempt: ${r}`),await this.rpcPublish(An(ss({},e),{topic:s,message:n,ttl:o.ttl,prompt:o.prompt,tag:o.tag,id:o.id,attestation:a,tvf:o.tvf})),this.logger.warn({},`Publisher: queue->published: ${e.opts.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(ir.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(be.connection_stalled);return}this.checkQueue()}),this.relayer.on(be.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}var eO=Object.defineProperty,tO=(t,e,i)=>e in t?eO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ei=(t,e,i)=>tO(t,typeof e!="symbol"?e+"":e,i);class iO{constructor(){Ei(this,"map",new Map),Ei(this,"set",(e,i)=>{const r=this.get(e);this.exists(e,i)||this.map.set(e,[...r,i])}),Ei(this,"get",e=>
vendor: 9,925 bytes, line 45
45this.map.get(e)||[]),Ei(this,"exists",(e,i)=>this.get(e).includes(i)),Ei(this,"delete",(e,i)=>{if(typeof i>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const r=this.get(e);if(!this.exists(e,i))return;const s=r.filter(n=>n!==i);if(!s.length){this.map.delete(e);return}this.map.set(e,s)}),Ei(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var rO=Object.defineProperty,sO=Object.defineProperties,nO=Object.getOwnPropertyDescriptors,El=Object.getOwnPropertySymbols,oO=Object.prototype.hasOwnProperty,aO=Object.prototype.propertyIsEnumerable,vo=(t,e,i)=>e in t?rO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,dr=(t,e)=>{for(var i in e||(e={}))oO.call(e,i)&&vo(t,i,e[i]);if(El)for(var i of El(e))aO.call(e,i)&&vo(t,i,e[i]);return t},xn=(t,e)=>sO(t,nO(e)),re=(t,e,i)=>vo(t,typeof e!="symbol"?e+"":e,i);class cO extends LE{constructor(e,i){super(e,i),this.relayer=e,this.logger=i,re(this,"subscriptions",new Map),re(this,"topicMap",new iO),re(this,"events",new Je.EventEmitter),re(this,"name",W1),re(this,"version",G1),re(this,"pending",new Map),re(this,"cached",[]),re(this,"initialized",!1),re(this,"storagePrefix",It),re(this,"subscribeTimeout",L.toMiliseconds(L.ONE_MINUTE)),re(this,"initialSubscribeTimeout",L.toMiliseconds(L.ONE_SECOND*15)),re(this,"clientId"),re(this,"batchSubscribeTopicsLimit",500),re(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),re(this,"subscribe",async(r,s)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:s}});try{const n=Is(s),o={topic:r,relay:n,transportType:s==null?void 0:s.transportType};this.pending.set(r,o);const a=await this.rpcSubscribe(r,n,s);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:s}})),a}catch(n){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(n),n}}),re(this,"unsubscribe",async(r,s)=>{this.isInitialized(),typeof(s==null?void 0:s.id)<"u"?await this.unsubscribeById(r,s.id,s):await this.unsubscribeByTopic(r,s)}),re(this,"isSubscribed",r=>new Promise(s=>{s(this.topicMap.topics.includes(r))})),re(this,"isKnownTopic",r=>new Promise(s=>{s(this.topicMap.topics.includes(r)||this.pending.has(r)||this.cached.some(n=>n.topic===r))})),re(this,"on",(r,s)=>{this.events.on(r,s)}),re(this,"once",(r,s)=>{this.events.once(r,s)}),re(this,"off",(r,s)=>{this.events.off(r,s)}),re(this,"removeListener",(r,s)=>{this.events.removeListener(r,s)}),re(this,"start",async()=>{await this.onConnect()}),re(this,"stop",async()=>{await this.onDisconnect()}),re(this,"restart",async()=>{await this.restore(),await this.onRestart()}),re(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const r=[];this.pending.forEach(s=>{r.push(s)}),await this.batchSubscribe(r)}),re(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(ir.pulse,async()=>{await this.checkPending()}),this.events.on(He.created,async r=>{const s=He.created;this.logger.info(`Emitting ${s}`),this.logger.debug({type:"event",event:s,data:r}),await this.persist()}),this.events.on(He.deleted,async r=>{const s=He.deleted;this.logger.info(`Emitting ${s}`),this.logger.debug({type:"event",event:s,data:r}),await this.persist()})}),this.relayer=e,this.logger=De(i,this.name),this.clientId=""}get context(){return qe(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}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(e,i){let r=!1;try{r=this.getSubscription(e).topic===i}catch{}return r}reset(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,i){const r=this.topicMap.get(e);await Promise.all(r.map(async s=>await this.unsubscribeById(e,s,i)))}async unsubscribeById(e,i,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:i,opts:r}});try{const s=Is(r);await this.restartToComplete({topic:e,id:i,relay:s}),await this.rpcUnsubscribe(e,i,s);const n=te("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,i,n),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:i,opts:r}})}catch(s){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(s),s}}async rpcSubscribe(e,i,r){var s;(!r||(r==null?void 0:r.transportType)===ce.relay)&&await this.restartToComplete({topic:e,id:e,relay:i});const n={method:fr(i.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});const o=(s=r==null?void 0:r.internal)==null?void 0:s.throwOnFailedPublish;try{const a=await this.getSubscriptionId(e);if((r==null?void 0:r.transportType)===ce.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(n).catch(h=>this.logger.warn(h))},L.toMiliseconds(L.ONE_SECOND)),a;const c=new Promise(async h=>{const u=d=>{d.topic===e&&(this.events.removeListener(He.created,u),h(d.id))};this.events.on(He.created,u);try{const d=await qt(new Promise((f,p)=>{this.relayer.request(n).catch(y=>{this.logger.warn(y,y==null?void 0:y.message),p(y)}).then(f)}),this.initialSubscribeTimeout,`Subscribing to ${e} failed, please try again`);this.events.removeListener(He.created,u),h(d)}catch{}}),l=await qt(c,this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!l&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return l?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(be.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const i=e[0].relay,r={method:fr(i.protocol).batchSubscribe,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{await await qt(new Promise(s=>{this.relayer.request(r).catch(n=>this.logger.warn(n)).then(s)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(be.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const i=e[0].relay,r={method:fr(i.protocol).batchFetchMessages,params:{topics:e.map(n=>n.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});let s;try{s=await await qt(new Promise((n,o)=>{this.relayer.request(r).catch(a=>{this.logger.warn(a),o(a)}).then(n)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(be.connection_stalled)}return s}rpcUnsubscribe(e,i,r){const s={method:fr(r.protocol).unsubscribe,params:{topic:e,id:i}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s}),this.relayer.request(s)}onSubscribe(e,i){this.setSubscription(e,xn(dr({},i),{id:e})),this.pending.delete(i.topic)}onBatchSubscribe(e){e.length&&e.forEach(i=>{this.setSubscription(i.id,dr({},i)),this.pending.delete(i.topic)})}async onUnsubscribe(e,i,r){this.events.removeAllListeners(i),this.hasSubscription(i,e)&&this.deleteSubscription(i,r),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,i){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:i}),this.addSubscription(e,i)}addSubscription(e,i){this.subscriptions.set(e,dr({},i)),this.topicMap.set(i.topic,e),this.events.emit(He.created,i)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const i=this.subscriptions.get(e);if(!i){const{message:r}=D("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(r)}return i}deleteSubscription(e,i){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:i});const r=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(r.topic,e),this.events.emit(He.deleted,xn(dr({},r),{reason:i}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(He.sync)}async onRestart(){if(this.cached.length){const e=[...this.cached],i=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<i;r++){const s=e.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(s)}}this.events.emit(He.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:i}=D("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(i),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(i)}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(await Promise.all(e.map(async i=>xn(dr({}
45,i),{id:await this.getSubscriptionId(i.topic)})))))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const i=await this.rpcBatchFetchMessages(e);i&&i.messages&&(await ob(L.toMiliseconds(L.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(i.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:e}=D("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(e){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(e),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(e){return _t(e+await this.getClientId())}}var lO=Object.defineProperty,Il=Object.getOwnPropertySymbols,hO=Object.prototype.hasOwnProperty,uO=Object.prototype.propertyIsEnumerable,_o=(t,e,i)=>e in t?lO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Sl=(t,e)=>{for(var i in e||(e={}))hO.call(e,i)&&_o(t,i,e[i]);if(Il)for(var i of Il(e))uO.call(e,i)&&_o(t,i,e[i]);return t},Z=(t,e,i)=>_o(t,typeof e!="symbol"?e+"":e,i);class dO extends TE{constructor(e){super(e),Z(this,"protocol","wc"),Z(this,"version",2),Z(this,"core"),Z(this,"logger"),Z(this,"events",new Je.EventEmitter),Z(this,"provider"),Z(this,"messages"),Z(this,"subscriber"),Z(this,"publisher"),Z(this,"name",q1),Z(this,"transportExplicitlyClosed",!1),Z(this,"initialized",!1),Z(this,"connectionAttemptInProgress",!1),Z(this,"relayUrl"),Z(this,"projectId"),Z(this,"packageName"),Z(this,"bundleId"),Z(this,"hasExperiencedNetworkDisruption",!1),Z(this,"pingTimeout"),Z(this,"heartBeatTimeout",L.toMiliseconds(L.THIRTY_SECONDS+L.FIVE_SECONDS)),Z(this,"reconnectTimeout"),Z(this,"connectPromise"),Z(this,"reconnectInProgress",!1),Z(this,"requestsInFlight",[]),Z(this,"connectTimeout",L.toMiliseconds(L.ONE_SECOND*15)),Z(this,"request",async i=>{var r,s;this.logger.debug("Publishing Request Payload");const n=i.id||ii().toString();await this.toEstablishConnection();try{this.logger.trace({id:n,method:i.method,topic:(r=i.params)==null?void 0:r.topic},"relayer.request - publishing...");const o=`${n}:${((s=i.params)==null?void 0:s.tag)||""}`;this.requestsInFlight.push(o);const a=await this.provider.request(i);return this.requestsInFlight=this.requestsInFlight.filter(c=>c!==o),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${n}`),o}}),Z(this,"resetPingTimeout",()=>{_s()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var i,r,s,n;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(n=(s=(r=(i=this.provider)==null?void 0:i.connection)==null?void 0:r.socket)==null?void 0:s.terminate)==null||n.call(s)}catch(o){this.logger.warn(o,o==null?void 0:o.message)}},this.heartBeatTimeout))}),Z(this,"onPayloadHandler",i=>{this.onProviderPayload(i),this.resetPingTimeout()}),Z(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected ð"),this.startPingTimeout(),this.events.emit(be.connect)}),Z(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected ð"),this.requestsInFlight=[],this.onProviderDisconnect()}),Z(this,"onProviderErrorHandler",i=>{this.logger.fatal(`Fatal socket error: ${i.message}`),this.events.emit(be.error,i),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),Z(this,"registerProviderListeners",()=>{this.provider.on(Qe.payload,this.onPayloadHandler),this.provider.on(Qe.connect,this.onConnectHandler),this.provider.on(Qe.disconnect,this.onDisconnectHandler),this.provider.on(Qe.error,this.onProviderErrorHandler)}),this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?De(e.logger,this.name):Vr(zs({level:e.logger||F1})),this.messages=new WS(this.logger,e.core),this.subscriber=new cO(this,this.logger),this.publisher=new QS(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||pd,this.projectId=e.projectId,Vw()?this.packageName=ac():Hw()&&(this.bundleId=ac()),this.provider={}}
45async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.hasAnyTopics)try{await this.transportOpen()}catch(e){this.logger.warn(e,e==null?void 0:e.message)}}get context(){return qe(this.logger)}get connected(){var e,i,r;return((r=(i=(e=this.provider)==null?void 0:e.connection)==null?void 0:i.socket)==null?void 0:r.readyState)===1||!1}get connecting(){var e,i,r;return((r=(i=(e=this.provider)==null?void 0:e.connection)==null?void 0:i.socket)==null?void 0:r.readyState)===0||this.connectPromise!==void 0||!1}async publish(e,i,r){this.isInitialized(),await this.publisher.publish(e,i,r),await this.recordMessageEvent({topic:e,message:i,publishedAt:Date.now(),transportType:ce.relay},ys.outbound)}async subscribe(e,i){var r,s,n;this.isInitialized(),(!(i!=null&&i.transportType)||(i==null?void 0:i.transportType)==="relay")&&await this.toEstablishConnection();const o=typeof((r=i==null?void 0:i.internal)==null?void 0:r.throwOnFailedPublish)>"u"?!0:(s=i==null?void 0:i.internal)==null?void 0:s.throwOnFailedPublish;let a=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"",c;const l=h=>{h.topic===e&&(this.subscriber.off(He.created,l),c())};return await Promise.all([new Promise(h=>{c=h,this.subscriber.on(He.created,l)}),new Promise(async(h,u)=>{a=await this.subscriber.subscribe(e,Sl({internal:{throwOnFailedPublish:o}},i)).catch(d=>{o&&u(d)})||a,h()})]),a}async unsubscribe(e,i){this.isInitialized(),await this.subscriber.unsubscribe(e,i)}on(e,i){this.events.on(e,i)}
vendor: 27,555 bytes, line 45
45once(e,i){this.events.once(e,i)}off(e,i){this.events.off(e,i)}removeListener(e,i){this.events.removeListener(e,i)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await qt(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){if(!this.subscriber.hasAnyTopics){this.logger.warn("Starting WS connection skipped because the client has no topics to work with.");return}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(i,r)=>{await this.connect(e).then(i).catch(r).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 Kc())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const i=e.sort((r,s)=>r.publishedAt-s.publishedAt);this.logger.debug(`Batch of ${i.length} message events sorted`);for(const r of i)try{await this.onMessageEvent(r)}catch(s){this.logger.warn(s,"Error while processing batch message event: "+(s==null?void 0:s.message))}this.logger.trace(`Batch of ${i.length} message events processed`)}async onLinkMessageEvent(e,i){const{topic:r}=e;if(!i.sessionExists){const s=pe(L.FIVE_MINUTES),n={topic:r,expiry:s,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(r,n)}this.events.emit(be.message,e),await this.recordMessageEvent(e,ys.inbound)}async connect(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let i=1;for(;i<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${i}...`),await this.createProvider(),await new Promise(async(r,s)=>{const n=()=>{s(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Qe.disconnect,n),await qt(new Promise((o,a)=>{this.provider.connect().then(o).catch(a)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{s(o)}).finally(()=>{this.provider.off(Qe.disconnect,n),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,a)=>{const c=()=>{a(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Qe.disconnect,c),await this.subscriber.start().then(o).catch(a).finally(()=>{this.provider.off(Qe.disconnect,c)})}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){await this.subscriber.stop();const s=r;this.logger.warn({},s.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${i}`);break}await new Promise(r=>setTimeout(r,L.toMiliseconds(i*1))),i++}}startPingTimeout(){var e,i,r,s,n;if(_s())try{(i=(e=this.provider)==null?void 0:e.connection)!=null&&i.socket&&((n=(s=(r=this.provider)==null?void 0:r.connection)==null?void 0:s.socket)==null||n.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o==null?void 0:o.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new st(new C1(Jw({sdkVersion:go,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(e,i){const{topic:r,message:s}=e;await this.messages.set(r,s,i)}async shouldIgnoreMessageEvent(e){const{topic:i,message:r}=e;if(!r||r.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isKnownTopic(i))return this.logger.warn(`Ignoring message for unknown topic ${i}`),!0;const s=this.messages.has(i,r);return s&&this.logger.warn(`Ignoring duplicate message: ${r}`),s}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),ta(e)){if(!e.method.endsWith(z1))return;const i=e.params,{topic:r,message:s,publishedAt:n,attestation:o}=i.data,a={topic:r,message:s,publishedAt:n,transportType:ce.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Sl({type:"event",event:i.id},a)),this.events.emit(i.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else Ks(e)&&this.events.emit(be.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(await this.recordMessageEvent(e,ys.inbound),this.events.emit(be.message,e))}async acknowledgePayload(e){const i=Vs(e.id,!0);await this.provider.connection.send(i)}unregisterProviderListeners(){this.provider.off(Qe.payload,this.onPayloadHandler),this.provider.off(Qe.connect,this.onConnectHandler),this.provider.off(Qe.disconnect,this.onDisconnectHandler),this.provider.off(Qe.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await Kc();h_(async i=>{e!==i&&(e=i,i?await this.transportOpen().catch(r=>this.logger.error(r,r==null?void 0:r.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(be.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e,e==null?void 0:e.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},L.toMiliseconds(V1)))))}isInitialized(){if(!this.initialized){const{message:e}=D("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&await this.connect()}}function pO(){}function Ol(t){if(!t||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.prototype||Object.getPrototypeOf(e)===null?Object.prototype.toString.call(t)==="[object Object]":!1}function Pl(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function $l(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const fO="[object RegExp]",gO="[object String]",yO="[object Number]",mO="[object Boolean]",Al="[object Arguments]",wO="[object Symbol]",bO="[object Date]",vO="[object Map]",_O="[object Set]",EO="[object Array]",IO="[object Function]",SO="[object ArrayBuffer]",Cn="[object Object]",OO="[object Error]",PO="[object DataView]",$O="[object Uint8Array]",AO="[object Uint8ClampedArray]",xO="[object Uint16Array]",CO="[object Uint32Array]",RO="[object BigUint64Array]",TO="[object Int8Array]",NO="[object Int16Array]",LO="[object Int32Array]",DO="[object BigInt64Array]",jO="[object Float32Array]",MO="[object Float64Array]";function UO(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}function BO(t,e,i){return yr(t,e,void 0,void 0,void 0,void 0,i)}function yr(t,e,i,r,s,n,o){const a=o(t,e,i,r,s,n);if(a!==void 0)return a;if(typeof t==typeof e)switch(typeof t){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return t===e;case"number":return t===e||Object.is(t,e);case"function":return t===e;case"object":return _r(t,e,n,o)}return _r(t,e,n,o)}function _r(t,e,i,r){if(Object.is(t,e))return!0;let s=$l(t),n=$l(e);if(s===Al&&(s=Cn),n===Al&&(n=Cn),s!==n)return!1;switch(s){case gO:return t.toString()===e.toString();case yO:{const c=t.valueOf(),l=e.valueOf();return UO(c,l)}case mO:case bO:case wO:return Object.is(t.valueOf(),e.valueOf());case fO:return t.source===e.source&&t.flags===e.flags;case IO:return t===e}i=i??new Map;const o=i.get(t),a=i.get(e);if(o!=null&&a!=null)return o===e;i.set(t,e),i.set(e,t);try{switch(s){case vO:{if(t.size!==e.size)return!1;for(const[c,l]of t.entries())if(!e.has(c)||!yr(l,e.get(c),c,t,e,i,r))return!1;return!0}case _O:{if(t.size!==e.size)return!1;const c=Array.from(t.values()),l=Array.from(e.values());for(let h=0;h<c.length;h++){const u=c[h],d=l.findIndex(f=>yr(u,f,void 0,t,e,i,r));if(d===-1)return!1;l.splice(d,1)}return!0}case EO:case $O:case AO:case xO:case CO:case RO:case TO:case NO:case LO:case DO:case jO:case MO:{if(typeof Buffer<"u"&&Buffer.isBuffer(t)!==Buffer.isBuffer(e)||t.length!==e.length)return!1;for(let c=0;c<t.length;c++)if(!yr(t[c],e[c],c,t,e,i,r))return!1;return!0}case SO:return t.byteLength!==e.byteLength?!1:_r(new Uint8Array(t),new Uint8Array(e),i,r);case PO:return t.byteLength!==e.byteLength||t.byteOffset!==e.byteOffset?!1:_r(new Uint8Array(t),new Uint8Array(e),i,r);case OO:return t.name===e.name&&t.message===e.message;case Cn:{if(!(_r(t.constructor,e.constructor,i,r)||Ol(t)&&Ol(e)))return!1;const c=[...Object.keys(t),...Pl(t)],l=[...Object.keys(e),...Pl(e)];if(c.length!==l.length)return!1;for(let h=0;h<c.length;h++){const u=c[h],d=t[u];if(!Object.hasOwn(e,u))return!1;const f=e[u];if(!yr(d,f,u,t,e,i,r))return!1}return!0}default:return!1}}finally{i.delete(t),i.delete(e)}}function kO(t,e){return BO(t,e,pO)}var FO=Object.defineProperty,xl=Object.getOwnPropertySymbols,qO=Object.prototype.hasOwnProperty,zO=Object.prototype.propertyIsEnumerable,Eo=(t,e,i)=>e in t?FO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Cl=(t,e)=>{for(var i in e||(e={}))qO.call(e,i)&&Eo(t,i,e[i]);if(xl)for(var i of xl(e))zO.call(e,i)&&Eo(t,i,e[i]);return t},Me=(t,e,i)=>Eo(t,typeof e!="symbol"?e+"":e,i);class di extends NE{constructor(e,i,r,s=It,n=void 0){super(e,i,r,s),this.core=e,this.logger=i,this.name=r,Me(this,"map",new Map),Me(this,"version",H1),Me(this,"cached",[]),Me(this,"initialized",!1),Me(this,"getKey"),Me(this,"storagePrefix",It),Me(this,"recentlyDeleted",[]),Me(this,"recentlyDeletedLimit",200),Me(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!Pe(o)?this.map.set(this.getKey(o),o):F0(o)?this.map.set(o.id,o):q0(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),Me(this,"set",async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())}),Me(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),Me(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(c=>kO(a[c],o[c]))):this.values)),Me(this,"update",async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const c=Cl(Cl({},this.getData(o)),a);this.map.set(o,c),await this.persist()}),Me(this,"delete",async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())}),this.logger=De(i,this.name),this.storagePrefix=s,this.getKey=n}get context(){return qe(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 i=this.map.get(e);if(!i){if(this.recentlyDeleted.includes(e)){const{message:s}=D("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(s),new Error(s)}const{message:r}=D("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(r),new Error(r)}return i}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:i}=D("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(i),new Error(i)}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}=D("NOT_INITIALIZED",this.name);throw new Error(e)}}}var VO=Object.defineProperty,HO=(t,e,i)=>e in t?VO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,K=(t,e,i)=>HO(t,typeof e!="symbol"?e+"":e,i);class KO{constructor(e,i){this.core=e,this.logger=i,K(this,"name",Y1),K(this,"version",J1),K(this,"events",new No),K(this,"pairings"),K(this,"initialized",!1),K(this,"storagePrefix",It),K(this,"ignoredPayloadTypes",[Lt]),K(this,"registeredMethods",[]),K(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),K(this,"register",({methods:r})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...r])]}),K(this,"create",async r=>{this.isInitialized();const s=ao(),n=await this.core.crypto.setSymKey(s),o=pe(L.FIVE_MINUTES),a={protocol:dd},c={topic:n,expiry:o,relay:a,active:!1,methods:r==null?void 0:r.methods},l=kc({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:s,relay:a,expiryTimestamp:o,methods:r==null?void 0:r.methods});return this.events.emit(Qt.create,c),this.core.expirer.set(n,o),await this.pairings.set(n,c),await this.core.relayer.subscribe(n,{transportType:r==null?void 0:r.transportType}),{topic:n,uri:l}}),K(this,"pair",async r=>{this.isInitialized();const s=this.core.eventClient.createEvent({properties:{topic:r==null?void 0:r.uri,trace:[wt.pairing_started]}});this.isValidPair(r,s);const{topic:n,symKey:o,relay:a,expiryTimestamp:c,methods:l}=Bc(r.uri);s.props.properties.topic=n,s.addTrace(wt.pairing_uri_validation_success),s.addTrace(wt.pairing_uri_not_expired);let h;if(this.pairings.keys.includes(n)){if(h=this.pairings.get(n),s.addTrace(wt.existing_pairing),h.active)throw s.setError(Ct.active_pairing_already_exists),new Error(`Pairing already exists: ${n}. Please try again with a new connection URI.`);s.addTrace(wt.pairing_not_expired)}const u=c||pe(L.FIVE_MINUTES),d={topic:n,relay:a,expiry:u,active:!1,methods:l};this.core.expirer.set(n,u),await this.pairings.set(n,d),s.addTrace(wt.store_new_pairing),r.activatePairing&&await this.activate({topic:n}),this.events.emit(Qt.create,d),s.addTrace(wt.emit_inactive_pairing),this.core.crypto.keychain.has(n)||await this.core.crypto.setSymKey(o,n),s.addTrace(wt.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{s.setError(Ct.no_internet_connection)}try{await this.core.relayer.subscribe(n,{relay:a})}catch(f){throw s.setError(Ct.subscribe_pairing_topic_failure),f}return s.addTrace(wt.subscribe_pairing_topic_success),d}),K(this,"activate",async({topic:r})=>{this.isInitialized();const s=pe(L.FIVE_MINUTES);this.core.expirer.set(r,s),await this.pairings.update(r,{active:!0,expiry:s})}),K(this,"ping",async r=>{this.isInitialized(),await this.isValidPing(r),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:s}=r;if(this.pairings.keys.includes(s)){const n=await this.sendRequest(s,"wc_pairingPing",{}),{done:o,resolve:a,reject:c}=Jt();this.events.once(Q("pairing_ping",n),({error:l})=>{l?c(l):a()}),await o()}}),K(this,"updateExpiry",async({topic:r,expiry:s})=>{this.isInitialized(),await this.pairings.update(r,{expiry:s})}),K(this,"updateMetadata",async({topic:r,metadata:s})=>{this.isInitialized(),await this.pairings.update(r,{peerMetadata:s})}),K(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),K(this,"disconnect",async r=>{this.isInitialized(),await this.isValidDisconnect(r);const{topic:s}=r;this.pairings.keys.includes(s)&&(await this.sendRequest(s,"wc_pairingDelete",te("USER_DISCONNECTED")),await this.deletePairing(s))}),K(this,"formatUriFromPairing",r=>{this.isInitialized();const{topic:s,relay:n,expiry:o,methods:a}=r,c=this.core.crypto.keychain.get(s);return kc({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:c,relay:n,expiryTimestamp:o,methods:a})}),K(this,"sendRequest",async(r,s,n)=>{const o=zt(s,n),a=await this.core.crypto.encode(r,o),c=hr[s].req;return this.core.history.set(r,o),this.core.relayer.publish(r,a,c),o.id}),K(this,"sendResult",async(r,s,n)=>{const o=Vs(r,n),a=await this.core.crypto.encode(s,o),c=(await this.core.history.get(s,r)).request.method,l=hr[c].res;await this.core.relayer.publish(s,a,l),await this.core.history.resolve(o)}),K(this,"sendError",async(r,s,n)=>{const o=Hs(r,n),a=await this.core.crypto.encode(s,o),c=(await this.core.history.get(s,r)).request.method,l=hr[c]?hr[c].res:hr.unregistered_method.res;await this.core.relayer.publish(s,a,l),await this.core.history.resolve(o)}),K(this,"deletePairing",async(r,s)=>{await this.core.relayer.unsubscribe(r),await Promise.all([this.pairings.delete(r,te("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(r),s?Promise.resolve():this.core.expirer.del(r)])}),K(this,"cleanup",async()=>{const r=this.pairings.getAll().filter(s=>kt(s.expiry));await Promise.all(r.map(s=>this.deletePairing(s.topic)))}),K(this,"onRelayEventRequest",async r=>{const{topic:s,payload:n}=r;switch(n.method){case"wc_pairingPing":return await this.onPairingPingRequest(s,n);case"wc_pairingDelete":return await this.onPairingDeleteRequest(s,n);default:return await this.onUnknownRpcMethodRequest(s,n)}}),K(this,"onRelayEventResponse",async r=>{const{topic:s,payload:n}=r,o=(await this.core.history.get(s,n.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(s,n);default:return this.onUnknownRpcMethodResponse(o)}}),K(this,"onPairingPingRequest",async(r,s)=>{const{id:n}=s;try{this.isValidPing({topic:r}),await this.sendResult(n,r,!0),this.events.emit(Qt.ping,{id:n,topic:r})}catch(o){await this.sendError(n,r,o),this.logger.error(o)}}),K(this,"onPairingPingResponse",(r,s)=>{const{id:n}=s;setTimeout(()=>{vt(s)?this.events.emit(Q("pairing_ping",n),{}):it(s)&&this.events.emit(Q("pairing_ping",n),{error:s.error})},500)}),K(this,"onPairingDeleteRequest",async(r,s)=>{const{id:n}=s;try{this.isValidDisconnect({topic:r}),await this.deletePairing(r),this.events.emit(Qt.delete,{id:n,topic:r})}catch(o){await this.sendError(n,r,o),this.logger.error(o)}}),K(this,"onUnknownRpcMethodRequest",async(r,s)=>{const{id:n,method:o}=s;try{if(this.registeredMethods.includes(o))return;const a=te("WC_METHOD_UNSUPPORTED",o);await this.sendError(n,r,a),this.logger.error(a)}catch(a){await this.sendError(n,r,a),this.logger.error(a)}}),K(this,"onUnknownRpcMethodResponse",r=>{this.registeredMethods.includes(r)||this.logger.error(te("WC_METHOD_UNSUPPORTED",r))}),K(this,"isValidPair",(r,s)=>{var n;if(!Be(r)){const{message:a}=D("MISSING_OR_INVALID",`pair() params: ${r}`);throw s.setError(Ct.malformed_pairing_uri),new Error(a)}if(!k0(r.uri)){const{message:a}=D("MISSING_OR_INVALID",`pair() uri: ${r.uri}`);throw s.setError(Ct.malformed_pairing_uri),new Error(a)}const o=Bc(r==null?void 0:r.uri);if(!((n=o==null?void 0:o.relay)!=null&&n.protocol)){const{message:a}=D("MISSING_OR_INVALID","pair() uri#relay-protocol");throw s.setError(Ct.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=D("MISSING_OR_INVALID","pair() uri#symKey");throw s.setError(Ct.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&L.toMiliseconds(o==null?void 0:o.expiryTimestamp)<Date.now()){s.setError(Ct.pairing_expired);const{message:a}=D("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(a)}}),K(this,"isValidPing",async r=>{if(!Be(r)){const{message:n}=D("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(n)}const{topic:s}=r;await this.isValidPairingTopic(s)}),K(this,"isValidDisconnect",async r=>{if(!Be(r)){const{message:n}=D("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(n)}const{topic:s}=r;await this.isValidPairingTopic(s)}),K(this,"isValidPairingTopic",async r=>{if(!de(r,!1)){const{message:s}=D("MISSING_OR_INVALID",`pairing topic should be a string: ${r}`);throw new Error(s)}if(!this.pairings.keys.includes(r)){const{message:s}=D("NO_MATCHING_KEY",`pairing topic doesn't exist: ${r}`);throw new Error(s)}if(kt(this.pairings.get(r).expiry)){await this.deletePairing(r);const{message:s}=D("EXPIRED",`pairing topic: ${r}`);throw new Error(s)}}),this.core=e,this.logger=De(i,this.name),this.pairings=new di(this.core,this.logger,this.name,this.storagePrefix)}get context(){return qe(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=D("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(be.message,async e=>{const{topic:i,message:r,transportType:s}=e;if(this.pairings.keys.includes(i)&&s!==ce.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))try{const n=await this.core.crypto.decode(i,r);ta(n)?(this.core.history.set(i,n),await this.onRelayEventRequest({topic:i,payload:n})):Ks(n)&&(await this.core.history.resolve(n),await this.onRelayEventResponse({topic:i,payload:n}),this.core.history.delete(i,n.id)),await this.core.relayer.messages.ack(i,r)}catch(n){this.logger.error(n)}})}registerExpirerEvents(){this.core.expirer.on(tt.expired,async e=>{const{topic:i}=yu(e.target);i&&this.pairings.keys.includes(i)&&(await this.deletePairing(i,!0),this.events.emit(Qt.expire,{topic:i}))})}}var WO=Object.defineProperty,GO=(t,e,i)=>e in t?WO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Oe=(t,e,i)=>GO(t,typeof e!="symbol"?e+"":e,i);class YO extends xE{constructor(e,i){super(e,i),this.core=e,this.logger=i,Oe(this,"records",new Map),Oe(this,"events",new Je.EventEmitter),Oe(this,"name",Z1),Oe(this,"version",X1),Oe(this,"cached",[]),Oe(this,"initialized",!1),Oe(this,"storagePrefix",It),Oe(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(r=>this.records.set(r.id,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Oe(this,"set",(r,s,n)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:r,request:s,chainId:n}),this.records.has(s.id))return;const o={id:s.id,topic:r,request:{method:s.method,params:s.params||null},chainId:n,expiry:pe(L.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(at.created,o)}),Oe(this,"resolve",async r=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:r}),!this.records.has(r.id))return;const s=await this.getRecord(r.id);typeof s.response>"u"&&(s.response=it(r)?{error:r.error}:{result:r.result},this.records.set(s.id,s),this.persist(),this.events.emit(at.updated,s))}),Oe(this,"get",async(r,s)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:r,id:s}),await this.getRecord(s))),Oe(this,"delete",(r,s)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:s}),this.values.forEach(n=>{if(n.topic===r){if(typeof s<"u"&&n.id!==s)return;this.records.delete(n.id),this.events.emit(at.deleted,n)}}),this.persist()}),Oe(this,"exists",async(r,s)=>(this.isInitialized(),this.records.has(s)?(await this.getRecord(s)).topic===r:!1)),Oe(this,"on",(r,s)=>{this.events.on(r,s)}),Oe(this,"once",(r,s)=>{this.events.once(r,s)}),Oe(this,"off",(r,s)=>{this.events.off(r,s)}),Oe(this,"removeListener",(r,s)=>{this.events.removeListener(r,s)}),this.logger=De(i,this.name)}get context(){return qe(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(i=>{if(typeof i.response<"u")return;const r={topic:i.topic,request:zt(i.request.method,i.request.params,i.id),chainId:i.chainId};return e.push(r)}),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 i=this.records.get(e);if(!i){const{message:r}=D("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(r)}return i}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(at.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:i}=D("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(i),new Error(i)}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(at.created,e=>{const i=at.created;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,record:e})}),this.events.on(at.updated,e=>{const i=at.updated;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,record:e})}),this.events.on(at.deleted,e=>{const i=at.deleted;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,record:e})}),this.core.heartbeat.on(ir.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(i=>{L.toMiliseconds(i.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${i.id}`),this.records.delete(i.id),this.events.emit(at.deleted,i,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=D("NOT_INITIALIZED",this.name);throw new Error(e)}}}var JO=Object.defineProperty,ZO=(t,e,i)=>e in t?JO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Re=(t,e,i)=>ZO(t,typeof e!="symbol"?e+"":e,i);class XO extends DE{constructor(e,i){super(e,i),this.core=e,this.logger=i,Re(this,"expirations",new Map),Re(this,"events",new Je.EventEmitter),Re(this,"name",Q1),Re(this,"version",eI),Re(this,"cac
45hed",[]),Re(this,"initialized",!1),Re(this,"storagePrefix",It),Re(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(r=>this.expirations.set(r.target,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Re(this,"has",r=>{try{const s=this.formatTarget(r);return typeof this.getExpiration(s)<"u"}catch{return!1}}),Re(this,"set",(r,s)=>{this.isInitialized();const n=this.formatTarget(r),o={target:n,expiry:s};this.expirations.set(n,o),this.checkExpiry(n,o),this.events.emit(tt.created,{target:n,expiration:o})}),Re(this,"get",r=>{this.isInitialized();const s=this.formatTarget(r);return this.getExpiration(s)}),Re(this,"del",r=>{if(this.isInitialized(),this.has(r)){const s=this.formatTarget(r),n=this.getExpiration(s);this.expirations.delete(s),this.events.emit(tt.deleted,{target:s,expiration:n})}}),Re(this,"on",(r,s)=>{this.events.on(r,s)}),Re(this,"once",(r,s)=>{this.events.once(r,s)}),Re(this,"off",(r,s)=>{this.events.off(r,s)}),Re(this,"removeListener",(r,s)=>{this.events.removeListener(r,s)}),this.logger=De(i,this.name)}get context(){return qe(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 Zw(e);if(typeof e=="number")return Xw(e);const{message:i}=D("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(i)}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(tt.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:i}=D("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(i),new Error(i)}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 i=this.expirations.get(e);if(!i){const{message:r}=D("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(r),new Error(r)}return i}checkExpiry(e,i){const{expiry:r}=i;L.toMiliseconds(r)-Date.now()<=0&&this.expire(e,i)}expire(e,i){this.expirations.delete(e),this.events.emit(tt.expired,{target:e,expiration:i})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,i)=>this.checkExpiry(i,e))}registerEventListeners(){this.core.heartbeat.on(ir.pulse,()=>this.checkExpirations()),this.events.on(tt.created,e=>{const i=tt.created;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:e}),this.persist()}),this.events.on(tt.expired,e=>{const i=tt.expired;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:e}),this.persist()}),this.events.on(tt.deleted,e=>{const i=tt.deleted;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=D("NOT_INITIALIZED",this.name);throw new Error(e)}}}var QO=Object.defineProperty,e2=(t,e,i)=>e in t?QO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ue=(t,e,i)=>e2(t,typeof e!="symbol"?e+"":e,i);class t2 extends jE{constructor(e,i,r){super(e,i,r),this.core=e,this.logger=i,this.store=r,ue(this,"name",tI),ue(this,"abortController"),ue(this,"isDevEnv"),ue(this,"verifyUrlV3",rI),ue(this,"storagePrefix",It),ue(this,"version",ud),ue(this,"publicKey"),ue(this,"fetchPromise"),ue(this,"init",async()=>{var s;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&L.toMiliseconds((s=this.publicKey)==null?void 0:s.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),ue(this,"register",async s=>{if(!jr()||this.isDevEnv)return;const n=window.location.origin,{id:o,decryptedId:a}=s,c=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${n}&id=${o}&decryptedId=${a}`;try{const l=Nr(),h=this.startAbortTimer(L.ONE_SECOND*5),u=await new Promise((d,f)=>{const p=()=>{window.removeEventListener("message",w),l.body.removeChild(y),f("attestation aborted")};this.abortController.signal.addEventListener("abort",p);const y=l.createElement("iframe");y.src=c,y.style.display="none",y.addEventListener("error",p,{signal:this.abortController.signal});const w=v=>
vendor: 8,753 bytes, line 45
45{if(v.data&&typeof v.data=="string")try{const b=JSON.parse(v.data);if(b.type==="verify_attestation"){if(Yn(b.attestation).payload.id!==o)return;clearInterval(h),l.body.removeChild(y),this.abortController.signal.removeEventListener("abort",p),window.removeEventListener("message",w),d(b.attestation===null?"":b.attestation)}}catch(b){this.logger.warn(b)}};l.body.appendChild(y),window.addEventListener("message",w,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",u),u}catch(l){this.logger.warn(l)}return""}),ue(this,"resolve",async s=>{if(this.isDevEnv)return"";const{attestationId:n,hash:o,encryptedId:a}=s;if(n===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(n){if(Yn(n).payload.id!==a)return;const l=await this.isValidJwtAttestation(n);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const c=this.getVerifyUrl(s==null?void 0:s.verifyUrl);return this.fetchAttestation(o,c)}),ue(this,"fetchAttestation",async(s,n)=>{this.logger.debug(`resolving attestation: ${s} from url: ${n}`);const o=this.startAbortTimer(L.ONE_SECOND*5),a=await fetch(`${n}/attestation/${s}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0}),ue(this,"getVerifyUrl",s=>{let n=s||vr;return sI.includes(n)||(this.logger.info(`verify url: ${n}, not included in trusted list, assigning default: ${vr}`),n=vr),n}),ue(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const s=this.startAbortTimer(L.FIVE_SECONDS),n=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(s),await n.json()}catch(s){this.logger.warn(s)}}),ue(this,"persistPublicKey",async s=>{this.logger.debug("persisting public key to local storage",s),await this.store.setItem(this.storeKey,s),this.publicKey=s}),ue(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),ue(this,"isValidJwtAttestation",async s=>{const n=await this.getPublicKey();try{if(n)return this.validateAttestation(s,n)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(s,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}}),ue(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),ue(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async n=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),n(o))});const s=await this.fetchPromise;return this.fetchPromise=void 0,s}),ue(this,"validateAttestation",(s,n)=>{const o=$0(s,n.publicKey),a={hasExpired:L.toMiliseconds(o.exp)<Date.now(),payload:o};if(a.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:a.payload.origin,isScam:a.payload.isScam,isVerified:a.payload.isVerified}}),this.logger=De(i,this.name),this.abortController=new AbortController,this.isDevEnv=Vo(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return qe(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),L.toMiliseconds(e))}}var i2=Object.defineProperty,r2=(t,e,i)=>e in t?i2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Rl=(t,e,i)=>r2(t,typeof e!="symbol"?e+"":e,i);class s2 extends ME{constructor(e,i){super(e,i),this.projectId=e,this.logger=i,Rl(this,"context",nI),Rl(this,"registerDeviceToken",async r=>{const{clientId:s,token:n,notificationType:o,enableEncrypted:a=!1}=r,c=`${oI}/${this.projectId}/clients`;await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:s,type:o,token:n,always_raw:a})})}),this.logger=De(i,this.context)}}var n2=Object.defineProperty,Tl=Object.getOwnPropertySymbols,o2=Object.prototype.hasOwnProperty,a2=Object.prototype.propertyIsEnumerable,Io=(t,e,i)=>e in t?n2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,pr=(t,e)=>{for(var i in e||(e={}))o2.call(e,i)&&Io(t,i,e[i]);if(Tl)for(var i of Tl(e))a2.call(e,i)&&Io(t,i,e[i]);return t},ge=(t,e,i)=>Io(t,typeof e!="symbol"?e+"":e,i);class c2 extends UE{constructor(e,i,r=!0){super(e,i,r),this.core=e,this.logger=i,ge(this,"context",cI),ge(this,"storagePrefix",It),ge(this,"storageVersion",aI),ge(this,"events",new Map),ge(this,"shouldPersist",!1),ge(this,"init",async()=>{if(!Vo())try{const s={eventId:lc(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:fu(this.core.relayer.protocol,this.core.relayer.version,go)}}};await this.sendEvent([s])}catch(s){this.logger.warn(s)}}),ge(this,"createEvent",s=>{const{event:n="ERROR",type:o="",properties:{topic:a,trace:c}}=s,l=lc(),h=this.core.projectId||"",u=Date.now(),d=pr({eventId:l,timestamp:u,props:{event:n,type:o,properties:{topic:a,trace:c}},bundleId:h,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,d),this.shouldPersist=!0),d}),ge(this,"getEvent",s=>{const{eventId:n,topic:o}=s;if(n)return this.events.get(n);const a=Array.from(this.events.values()).find(c=>c.props.properties.topic===o);if(a)return pr(pr({},a),this.setMethods(a.eventId))}),ge(this,"deleteEvent",s=>{const{eventId:n}=s;this.events.delete(n),this.shouldPersist=!0}),ge(this,"setEventListeners",()=>{this.core.heartbeat.on(ir.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(s=>{L.fromMiliseconds(Date.now())-L.fromMiliseconds(s.timestamp)>lI&&(this.events.delete(s.eventId),this.shouldPersist=!0)})})}),ge(this,"setMethods",s=>({addTrace:n=>this.addTrace(s,n),setError:n=>this.setError(s,n)})),ge(this,"addTrace",(s,n)=>{const o=this.events.get(s);o&&(o.props.properties.trace.push(n),this.events.set(s,o),this.shouldPersist=!0)}),ge(this,"setError",(s,n)=>{const o=this.events.get(s);o&&(o.props.type=n,o.timestamp=Date.now(),this.events.set(s,o),this.shouldPersist=!0)}),ge(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),ge(this,"restore",async()=>{try{const s=await this.core.storage.getItem(this.storageKey)||[];if(!s.length)return;s.forEach(n=>{this.events.set(n.eventId,pr(pr({},n),this.setMethods(n.eventId)))})}catch(s){this.logger.warn(s)}}),ge(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const s=[];for(const[n,o]of this.events)o.props.type&&s.push(o);if(s.length!==0)try{if((await this.sendEvent(s)).ok)for(const n of s)this.events.delete(n.eventId),this.shouldPersist=!0}catch(n){this.logger.warn(n)}}),ge(this,"sendEvent",async s=>{const n=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${hI}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${go}${n}`,{method:"POST",body:JSON.stringify(s)})}),ge(this,"getAppDomain",()=>pu().url),this.logger=De(i,this.context),this.telemetryEnabled=r,r?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var l2=Object.defineProperty,Nl=Object.getOwnPropertySymbols,h2=Object.prototype.hasOwnProperty,u2=Object.prototype.propertyIsEnumerable,So=(t,e,i)=>e in t?l2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ll=(t,e)=>{for(var i in e||(e={}))h2.call(e,i)&&So(t,i,e[i]);if(Nl)for(var i of Nl(e))u2.call(e,i)&&So(t,i,e[i]);return t},oe=(t,e,i)=>So(t,typeof e!="symbol"?e+"":e,i);let d2=class Od extends OE{constructor(e){var i;super(e),oe(this,"protocol",hd),oe(this,"version",ud),oe(this,"name",fo),oe(this,"relayUrl"),oe(this,"projectId"),oe(this,"customStoragePrefix"),oe(this,"events",new Je.EventEmitter),oe(this,"logger"),oe(this,"heartbeat"),oe(this,"relayer"),oe(this,"crypto"),oe(this,"storage"),oe(this,"history"),oe(this,"expirer"),oe(this,"pairing"),oe(this,"verify"),oe(this,"echoClient"),oe(this,"linkModeSupportedApps"),oe(this,"eventClient"),oe(this,"initialized",!1),oe(this,"logChunkController"),oe(this,"on",(a,c)=>this.events.on(a,c)),oe(this,"once",(a,c)=>this.events.once(a,c)),oe(this,"off",(a,c)=>this.events.off(a,c)),oe(this,"removeListener",(a,c)=>this.events.removeListener(a,c)),oe(this,"dispatchEnvelope",({topic:a,message:c,sessionExists:l})=>
45{if(!a||!c)return;const h={topic:a,message:c,publishedAt:Date.now(),transportType:ce.link_mode};this.relayer.onLinkMessageEvent(h,{sessionExists:l})});const r=this.getGlobalCore(e==null?void 0:e.customStoragePrefix);if(r)try{return this.customStoragePrefix=r.customStoragePrefix,this.logger=r.logger,this.heartbeat=r.heartbeat,this.crypto=r.crypto,this.history=r.history,this.expirer=r.expirer,this.storage=r.storage,this.relayer=r.relayer,this.pairing=r.pairing,this.verify=r.verify,this.echoClient=r.echoClient,this.linkModeSupportedApps=r.linkModeSupportedApps,this.eventClient=r.eventClient,this.initialized=r.initialized,this.logChunkController=r.logChunkController,r}catch(a){console.warn("Failed to copy global core",a)}this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||pd,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const s=zs({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:T1.logger,name:fo}),{logger:n,chunkLoggerController:o}=EE({opts:s,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=o,(i=this.logChunkController)!=null&&i.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var a,c;(a=this.logChunkController)!=null&&a.downloadLogsBlobInBrowser&&((c=this.logChunkController)==null||c.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=De(n,this.name),this.heartbeat=new f_,this.crypto=new BS(this,this.logger,e==null?void 0:e.keychain),this.history=new YO(this,this.logger),this.expirer=new XO(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new G_(Ll(Ll({},N1),e==null?void 0:e.storageOptions)),this.relayer=new dO({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new KO(this,this.logger),this.verify=new t2(this,this.logger,this.storage),this.echoClient=new s2(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new c2(this,this.logger,e==null?void 0:e.telemetryEnabled),this.setGlobalCore(this)}static async init(e){const i=new Od(e);await i.initialize();const r=await i.crypto.getClientId();return await i.storage.setItem(K1,r),i}get context(){return qe(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(pl,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.linkModeSupportedApps=await this.storage.getItem(pl)||[],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}}getGlobalCore(e=""){try{if(this.isGlobalCoreDisabled())return;const i=`_walletConnectCore_${e}`,r=`${i}_count`;return globalThis[r]=(globalThis[r]||0)+1,globalThis[r]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[r]} times.`),globalThis[i]}catch(i){console.warn("Failed to get global WalletConnect core",i);return}}setGlobalCore(e){var i;try{if(this.isGlobalCoreDisabled())return;const r=`_walletConnectCore_${((i=e.opts)==null?void 0:i.customStoragePrefix)||""}`;globalThis[r]=e}catch(r){console.warn("Failed to set global WalletConnect core",r)}}isGlobalCoreDisabled(){try{return typeof process<"u"&&R1.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}};const p2=d2,Pd="wc",$d=2,Ad="client",ia=`${Pd}@${$d}:${Ad}:`,Rn={name:Ad,logger:"error"},Dl="WALLETCONNECT_DEEPLINK_CHOICE",f2="proposal",jl="Proposal expired",g2="session",Ii=L.SEVEN_DAYS,y2="engine",ye={wc_sessionPropose:{req:{ttl:L.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:L.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:L.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:L.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:L.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:L.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:L.ONE_DAY,prompt:!1,tag:1104},res:{ttl:L.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:L.ONE_DAY,prompt:!1,tag:1106},res:{ttl:L.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:L.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:L.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:L.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:L.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:L.ONE_DAY,prompt:!1,tag:1112},res:{ttl:L.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:L.ONE_DAY,prompt:!1,tag:1114},res:{ttl:L.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:L.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:L.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:L.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:L.FIVE_MINUTES,prompt:!1,tag:1119}}},Tn={min:L.FIVE_MINUTES,max:L.SEVEN_DAYS},mt={idle:"IDLE",active:"ACTIVE"},Ml={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"}},m2="request",w2=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],b2="wc",v2="auth",_2="authKeys",E2="pairingTopics",I2="requests",Gs=`${b2}@${1.5}:${v2}:`,ms=`${Gs}:PUB_KEY`;var S2=Object.defineProperty,O2=Object.defineProperties,P2=Object.getOwnPropertyDescriptors,Ul=Object.getOwnPropertySymbols,$2=Object.prototype.hasOwnProperty,A2=Object.prototype.propertyIsEnumerable,Oo=(t,e,i)=>e in t?S2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,se=(t,e)=>{for(var i in e||(e={}))$2.call(e,i)&&Oo(t,i,e[i]);if(Ul)for(var i of Ul(e))A2.call(e,i)&&Oo(t,i,e[i]);return t},Ne=(t,e)=>O2(t,P2(e)),N=(t,e,i)=>Oo(t,typeof e!="symbol"?e+"":e,i);class x2 extends qE{constructor(e){super(e),N(this,"name",y2),N(this,"events",new No),N(this,"initialized",!1),N(this,"requestQueue",{state:mt.idle,queue:[]}),N(this,"sessionRequestQueue",{state:mt.idle,queue:[]}),N(this,"requestQueueDelay",L.ONE_SECOND),N(this,"expectedPairingMethodMap",new Map),N(this,"recentlyDeletedMap",new Map),N(this,"recentlyDeletedLimit",200),N(this,"relayMessageCache",[]),N(this,"pendingSessions",new Map),N(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(ye)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},L.toMiliseconds(this.requestQueueDelay)))}),N(this,"connect",async i=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const r=Ne(se({},i),{requiredNamespaces:i.requiredNamespaces||{},optionalNamespaces:i.optionalNamespaces||{}});await this.isValidConnect(r);const{pairingTopic:s,requiredNamespaces:n,optionalNamespaces:o,sessionProperties:a,scopedProperties:c,relays:l}=r;let h=s,u,d=!1;try{if(h){const x=this.client.core.pairing.pairings.get(h);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),d=x.active}}catch(x){throw this.client.logger.error(`connect() -> pairing.get(${h}) failed`),x}if(!h||!d){const{topic:x,uri:$}=await this.client.core.pairing.create();h=x,u=$}if(!h){const{message:x}=D("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(x)}const f=await this.client.core.crypto.generateKeyPair(),p=ye.wc_sessionPropose.req.ttl||L.FIVE_MINUTES,y=pe(p),w=Ne(se(se({requiredNamespaces:n,optionalNamespaces:o,relays:l??[{protocol:dd}],proposer:{publicKey:f,metadata:this.client.metadata},expiryTimestamp:y,pairingTopic:h},a&&{sessionProperties:a}),c&&{scopedProperties:c}),{id:bt()}),v=Q("session_connect",w.id),{reject:b,resolve:_,done:I}=Jt(p,jl),A=({id:x})=>{x===w.id&&(this.client.events.off("proposal_expire",A),this.pendingSessions.delete(w.id),this.events.emit(v,{error:{message:jl,code:0}}))};return this.client.events.on("proposal_expire",A),this.events.once(v,({error:x,session:$})=>{this.client.events.off("proposal_expire",A),x?b(x):$&&_($)}
45),await this.sendRequest({topic:h,method:"wc_sessionPropose",params:w,throwOnFailedPublish:!0,clientRpcId:w.id}),await this.setProposal(w.id,w),{uri:u,approval:I}}),N(this,"pair",async i=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(i)}catch(r){throw this.client.logger.error("pair() failed"),r}}),N(this,"approve",async i=>{var r,s,n;const o=this.client.core.eventClient.createEvent({properties:{topic:(r=i==null?void 0:i.id)==null?void 0:r.toString(),trace:[ct.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(O){throw o.setError(Gt.no_internet_connection),O}try{await this.isValidProposalId(i==null?void 0:i.id)}catch(O){throw this.client.logger.error(`approve() -> proposal.get(${i==null?void 0:i.id}) failed`),o.setError(Gt.proposal_not_found),O}try{await this.isValidApprove(i)}catch(O){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(Gt.session_approve_namespace_validation_failure),O}const{id:a,relayProtocol:c,namespaces:l,sessionProperties:h,scopedProperties:u,sessionConfig:d}=i,f=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:p,proposer:y,requiredNamespaces:w,optionalNamespaces:v}=f;let b=(s=this.client.core.eventClient)==null?void 0:s.getEvent({topic:p});b||(b=(n=this.client.core.eventClient)==null?void 0:n.createEvent({type:ct.session_approve_started,properties:{topic:p,trace:[ct.session_approve_started,ct.session_namespaces_validation_success]}}));const _=await this.client.core.crypto.generateKeyPair(),I=y.publicKey,A=await this.client.core.crypto.generateSharedKey(_,I),x=se(se(se({relay:{protocol:c??"irn"},namespaces:l,controller:{publicKey:_,metadata:this.client.metadata},expiry:pe(Ii)},h&&{sessionProperties:h}),u&&{scopedProperties:u}),d&&{sessionConfig:d}),$=ce.relay;b.addTrace(ct.subscribing_session_topic);try{await this.client.core.relayer.subscribe(A,{transportType:$})}catch(O){throw b.setError(Gt.subscribe_session_topic_failure),O}b.addTrace(ct.subscribe_session_topic_success);const R=Ne(se({},x),{topic:A,requiredNamespaces:w,optionalNamespaces:v,pairingTopic:p,acknowledged:!1,self:x.controller,peer:{publicKey:y.publicKey,metadata:y.metadata},controller:_,transportType:ce.relay});await this.client.session.set(A,R),b.addTrace(ct.store_session);try{b.addTrace(ct.publishing_session_settle),await this.sendRequest({topic:A,method:"wc_sessionSettle",params:x,throwOnFailedPublish:!0}).catch(O=>{throw b==null||b.setError(Gt.session_settle_publish_failure),O}),b.addTrace(ct.session_settle_publish_success),b.addTrace(ct.publishing_session_approve),await this.sendResult({id:a,topic:p,result:{relay:{protocol:c??"irn"},responderPublicKey:_},throwOnFailedPublish:!0}).catch(O=>{throw b==null||b.setError(Gt.session_approve_publish_failure),O}),b.addTrace(ct.session_approve_publish_success)}catch(O){throw this.client.logger.error(O),this.client.session.delete(A,te("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(A),O}return this.client.core.eventClient.deleteEvent({eventId:b.eventId}),await this.client.core.pairing.updateMetadata({topic:p,metadata:y.metadata}),await this.client.proposal.delete(a,te("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:p}),await this.setExpiry(A,pe(Ii)),{topic:A,acknowledged:()=>Promise.resolve(this.client.session.get(A))}}),N(this,"reject",async i=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(i)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:r,reason:s}=i;let n;try{n=this.client.proposal.get(r).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${r}) failed`),o}n&&(await this.sendError({id:r,topic:n,error:s,rpcOpts:ye.wc_sessionPropose.reject}),await this.client.proposal.delete(r,te("USER_DISCONNECTED")))}),N(this,"update",async i=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(i)}catch(u){throw this.client.logger.error("update() -> isValidUpdate() failed"),u}const{topic:r,namespaces:s}=i,{done:n,resolve:o,reject:a}=Jt(),c=bt(),l=ii().toString(),h=this.client.session.get(r).namespaces;return this.events.once(Q("session_update",c),({error:u})=>{u?a(u):o()}),await this.client.session.update(r,{namespaces:s}),await this.sendRequest({topic:r,method:"wc_sessionUpdate",params:{namespaces:s},throwOnFailedPublish:!0,clientRpcId:c,relayRpcId:l}).catch(u=>{this.client.logger.error(u),this.client.session.update(r,{namespaces:h}),a(u)}),{acknowledged:n}}),N(this,"extend",async i=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(i)}catch(c){throw this.client.logger.error("extend() -> isValidExtend() failed"),c}const{topic:r}=i,s=bt(),{done:n,resolve:o,reject:a}=Jt();return this.events.once(Q("session_extend",s),({error:c})=>{c?a(c):o()}),await this.setExpiry(r,pe(Ii)),this.sendRequest({topic:r,method:"wc_sessionExtend",params:{},clientRpcId:s,throwOnFailedPublish:!0}).catch(c=>{a(c)}),{acknowledged:n}}),N(this,"request",async i=>{this.isInitialized();try{await this.isValidRequest(i)}catch(v){throw this.client.logger.error("request() -> isValidRequest() failed"),v}const{chainId:r,request:s,topic:n,expiry:o=ye.wc_sessionRequest.req.ttl}=i,a=this.client.session.get(n);(a==null?void 0:a.transportType)===ce.relay&&await this.confirmOnlineStateOrThrow();const c=bt(),l=ii().toString(),{done:h,resolve:u,reject:d}=Jt(o,"Request expired. Please try again.");this.events.once(Q("session_request",c),({error:v,result:b})=>{v?d(v):u(b)});const f="wc_sessionRequest",p=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);if(p)return await this.sendRequest({clientRpcId:c,relayRpcId:l,topic:n,method:f,params:{request:Ne(se({},s),{expiryTimestamp:pe(o)}),chainId:r},expiry:o,throwOnFailedPublish:!0,appLink:p}).catch(v=>d(v)),this.client.events.emit("session_request_sent",{topic:n,request:s,chainId:r,id:c}),await h();const y={request:Ne(se({},s),{expiryTimestamp:pe(o)}),chainId:r},w=this.shouldSetTVF(f,y);return await Promise.all([new Promise(async v=>{await this.sendRequest(se({clientRpcId:c,relayRpcId:l,topic:n,method:f,params:y,expiry:o,throwOnFailedPublish:!0},w&&{tvf:this.getTVFParams(c,y)})).catch(b=>d(b)),this.client.events.emit("session_request_sent",{topic:n,request:s,chainId:r,id:c}),v()}),new Promise(async v=>{var b;if(!((b=a.sessionConfig)!=null&&b.disableDeepLink)){const _=await ib(this.client.core.storage,Dl);await Qw({id:c,topic:n,wcDeepLink:_})}v()}),h()]).then(v=>v[2])}),N(this,"respond",async i=>{this.isInitialized(),await this.isValidRespond(i);const{topic:r,response:s}=i,{id:n}=s,o=this.client.session.get(r);o.transportType===ce.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);vt(s)?await this.sendResult({id:n,topic:r,result:s.result,throwOnFailedPublish:!0,appLink:a}
vendor: 10,940 bytes, line 45
45):it(s)&&await this.sendError({id:n,topic:r,error:s.error,appLink:a}),this.cleanupAfterResponse(i)}),N(this,"ping",async i=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(i)}catch(s){throw this.client.logger.error("ping() -> isValidPing() failed"),s}const{topic:r}=i;if(this.client.session.keys.includes(r)){const s=bt(),n=ii().toString(),{done:o,resolve:a,reject:c}=Jt();this.events.once(Q("session_ping",s),({error:l})=>{l?c(l):a()}),await Promise.all([this.sendRequest({topic:r,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:s,relayRpcId:n}),o()])}else this.client.core.pairing.pairings.keys.includes(r)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:r}))}),N(this,"emit",async i=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(i);const{topic:r,event:s,chainId:n}=i,o=ii().toString(),a=bt();await this.sendRequest({topic:r,method:"wc_sessionEvent",params:{event:s,chainId:n},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:a})}),N(this,"disconnect",async i=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(i);const{topic:r}=i;if(this.client.session.keys.includes(r))await this.sendRequest({topic:r,method:"wc_sessionDelete",params:te("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:r,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(r))await this.client.core.pairing.disconnect({topic:r});else{const{message:s}=D("MISMATCHED_TOPIC",`Session or pairing topic not found: ${r}`);throw new Error(s)}}),N(this,"find",i=>(this.isInitialized(),this.client.session.getAll().filter(r=>U0(r,i)))),N(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),N(this,"authenticate",async(i,r)=>{var s;this.isInitialized(),this.isValidAuthenticate(i);const n=r&&this.client.core.linkModeSupportedApps.includes(r)&&((s=this.client.metadata.redirect)==null?void 0:s.linkMode),o=n?ce.link_mode:ce.relay;o===ce.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:c="",uri:l,domain:h,nonce:u,type:d,exp:f,nbf:p,methods:y=[],expiry:w}=i,v=[...i.resources||[]],{topic:b,uri:_}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:b,uri:_}});const I=await this.client.core.crypto.generateKeyPair(),A=ps(I);if(await Promise.all([this.client.auth.authKeys.set(ms,{responseTopic:A,publicKey:I}),this.client.auth.pairingTopics.set(A,{topic:A,pairingTopic:b})]),await this.client.core.relayer.subscribe(A,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${b}`),y.length>0){const{namespace:S}=Fi(a[0]);let C=Gb(S,"request",y);ds(v)&&(C=Jb(C,v.pop())),v.push(C)}const x=w&&w>ye.wc_sessionAuthenticate.req.ttl?w:ye.wc_sessionAuthenticate.req.ttl,$={authPayload:{type:d??"caip122",chains:a,statement:c,aud:l,domain:h,version:"1",nonce:u,iat:new Date().toISOString(),exp:f,nbf:p,resources:v},requester:{publicKey:I,metadata:this.client.metadata},expiryTimestamp:pe(x)},R={eip155:{chains:a,methods:[...new Set(["personal_sign",...y])],events:["chainChanged","accountsChanged"]}},O={requiredNamespaces:{},optionalNamespaces:R,relays:[{protocol:"irn"}],pairingTopic:b,proposer:{publicKey:I,metadata:this.client.metadata},expiryTimestamp:pe(ye.wc_sessionPropose.req.ttl),id:bt()},{done:F,resolve:M,reject:j}=Jt(x,"Request expired"),q=bt(),T=Q("session_connect",O.id),g=Q("session_request",q),m=async({error:S,session:C})=>{this.events.off(g,E),S?j(S):C&&M({session:C})},E=async S=>{var C,U,k;if(await this.deletePendingAuthRequest(q,{message:"fulfilled",code:0}),S.error){const Y=te("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return S.error.code===Y.code?void 0:(this.events.off(T,m),j(S.error.message))}await this.deleteProposal(O.id),this.events.off(T,m);const{cacaos:z,responder:B}=S.result,V=[],G=[];for(const Y of z){await mc({cacao:Y,projectId:this.client.core.projectId})||(this.client.logger.error(Y,"Signature verification failed"),j(te("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Ce}=Y,Ee=ds(Ce.resources),Te=[Xn(Ce.iss)],Ze=Es(Ce.iss);if(Ee){const Xe=wc(Ee),fi=bc(Ee);V.push(...Xe),Te.push(...fi)}for(const Xe of Te)G.push(`${Xe}:${Ze}`)}const ne=await this.client.core.crypto.generateSharedKey(I,B.publicKey);let ee;V.length>0&&(ee={topic:ne,acknowledged:!0,self:{publicKey:I,metadata:this.client.metadata},peer:B,controller:B.publicKey,expiry:pe(Ii),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:b,namespaces:Fc([...new Set(V)],[...new Set(G)]),transportType:o},await this.client.core.relayer.subscribe(ne,{transportType:o}),await this.client.session.set(ne,ee),b&&await this.client.core.pairing.updateMetadata({topic:b,metadata:B.metadata}),ee=this.client.session.get(ne)),(C=this.client.metadata.redirect)!=null&&C.linkMode&&(U=B.metadata.redirect)!=null&&U.linkMode&&(k=B.metadata.redirect)!=null&&k.universal&&r&&(this.client.core.addLinkModeSupportedApp(B.metadata.redirect.universal),this.client.session.update(ne,{transportType:ce.link_mode})),M({auths:z,session:ee})};this.events.once(T,m),this.events.once(g,E);let P;try{if(n){const S=zt("wc_sessionAuthenticate",$,q);this.client.core.history.set(b,S);const C=await this.client.core.crypto.encode("",S,{type:qr,encoding:Ft});P=es(r,b,C)}else await Promise.all([this.sendRequest({topic:b,method:"wc_sessionAuthenticate",params:$,expiry:i.expiry,throwOnFailedPublish:!0,clientRpcId:q}),this.sendRequest({topic:b,method:"wc_sessionPropose",params:O,expiry:ye.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:O.id})])}catch(S){throw this.events.off(T,m),this.events.off(g,E),S}return await this.setProposal(O.id,O),await this.setAuthRequest(q,{request:Ne(se({},$),{verifyContext:{}}),pairingTopic:b,transportType:o}),{uri:P??_,response:F}}),N(this,"approveSessionAuthenticate",async i=>{const{id:r,auths:s}=i,n=this.client.core.eventClient.createEvent({properties:{topic:r.toString(),trace:[Yt.authenticated_session_approve_started]}});try{this.isInitialized()}catch(w){throw n.setError(ur.no_internet_connection),w}const o=this.getPendingAuthRequest(r);if(!o)throw n.setError(ur.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${r}`);const a=o.transportType||ce.relay;a===ce.relay&&await this.confirmOnlineStateOrThrow();const c=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),h=ps(c),u={type:Lt,receiverPublicKey:c,senderPublicKey:l},d=[],f=[];for(const w of s){if(!await mc({cacao:w,projectId:this.client.core.projectId})){n.setError(ur.invalid_cacao);const A=te("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:r,topic:h,error:A,encodeOpts:u}),new Error(A.message)}n.addTrace(Yt.cacaos_verified);const{p:v}=w,b=ds(v.resources),_=[Xn(v.iss)],I=Es(v.iss);if(b){const A=wc(b),x=bc(b);d.push(...A),_.push(...x)}for(const A of _)f.push(`${A}:${I}`)}const p=await this.client.core.crypto.generateSharedKey(l,c);n.addTrace(Yt.create_authenticated_session_topic);let y;if((d==null?void 0:d.length)>0){y={topic:p,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:c,metadata:o.requester.metadata},controller:c,expiry:pe(Ii),authentication:s,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Fc([...new Set(d)],[...new Set(f)]),transportType:a},n.addTrace(Yt.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(p,{transportType:a})}catch(w){throw n.setError(ur.subscribe_authenticated_session_topic_failure),w}n.addTrace(Yt.subscribe_authenticated_session_topic_success),await this.client.session.set(p,y),n.addTrace(Yt.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}n.addTrace(Yt.publishing_authenticated_session_approve);try{await this.sendResult({topic:h,id:r,result:{cacaos:s,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:u,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(w){throw n.setError(ur.authenticated_session_approve_publish_failure),w}return await this.client.auth.requests.delete(r,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:n.eventId}),{session:y}}),N(this,"rejectSessionAuthenticate",async i=>{this.isInitialized();const{id:r,reason:s}=i,n=this.getPendingAuthRequest(r);if(!n)throw new Error(`Could not find pending auth request with id ${r}`);n.transportType===ce.relay&&await this.confirmOnlineStateOrThrow();const o=n.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),c=ps(o),l={type:Lt,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:r,topic:c,error:s,encodeOpts:l,rpcOpts:ye.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(n.requester.metadata,n.transportType)}),await this.client.auth.requests.delete(r,{message:"rejected",code:0}),await this.client.proposal.delete(r,te("USER_DISCONNECTED"))}),N(this,"formatAuthMessage",i=>{this.isInitialized();const{request:r,iss:s}=i;return Ou(r,s)}),N(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const i=this.relayMessageCache.shift();i&&await this.onRelayMessage(i)}catch(i){this.client.logger.error(i)}},50)}),N(this,"cleanupDuplicatePairings",async i=>{if(i.pairingTopic)try{const r=this.client.core.pairing.pairings.get(i.pairingTopic),s=this.client.core.pairing.pairings.getAll().filter(n=>{var o,a;return((o=n.peerMetadata)==null?void 0:o.url)&&((a=n.peerMetadata)==null?void 0:a.url)===i.peer.metadata.url&&n.topic&&n.topic!==r.topic});if(s.length===0)return;this.client.logger.info(`Cleaning up ${s.length} duplicate pairing(s)`),await Promise.all(s.map(n=>this.client.core.pairing.disconnect({topic:n.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(r){this.client.logger.error(r)}}),N(this,"deleteSession",async i=>{var r;const{topic:s,expirerHasDeleted:n=!1,emitEvent:o=!0,id:a=0}=i,{self:c}=this.client.session.get(s);await this.client.core.relayer.unsubscribe(s),await this.client.session.delete(s,te("USER_DISCONNECTED")),this.addToRecentlyDeleted(s,"session"),this.client.core.crypto.keychain.has(c.publicKey)&&await this.client.core.crypto.deleteKeyPair(c.publicKey),this.client.core.crypto.keychain.has(s)&&await this.client.core.crypto.deleteSymKey(s),n||this.client.core.expirer.del(s),this.client.core.storage.removeItem(Dl).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEac
45h(l=>{l.topic===s&&this.deletePendingSessionRequest(l.id,te("USER_DISCONNECTED"))}),s===((r=this.sessionRequestQueue.queue[0])==null?void 0:r.topic)&&(this.sessionRequestQueue.state=mt.idle),o&&this.client.events.emit("session_delete",{id:a,topic:s})}),N(this,"deleteProposal",async(i,r)=>{if(r)try{const s=this.client.proposal.get(i),n=this.client.core.eventClient.getEvent({topic:s.pairingTopic});n==null||n.setError(Gt.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(i,te("USER_DISCONNECTED")),r?Promise.resolve():this.client.core.expirer.del(i)]),this.addToRecentlyDeleted(i,"proposal")}),N(this,"deletePendingSessionRequest",async(i,r,s=!1)=>{await Promise.all([this.client.pendingRequest.delete(i,r),s?Promise.resolve():this.client.core.expirer.del(i)]),this.addToRecentlyDeleted(i,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(n=>n.id!==i),s&&(this.sessionRequestQueue.state=mt.idle,this.client.events.emit("session_request_expire",{id:i}))}),N(this,"deletePendingAuthRequest",async(i,r,s=!1)=>{await Promise.all([this.client.auth.requests.delete(i,r),s?Promise.resolve():this.client.core.expirer.del(i)])}),N(this,"setExpiry",async(i,r)=>{this.client.session.keys.includes(i)&&(this.client.core.expirer.set(i,r),await this.client.session.update(i,{expiry:r}))}),N(this,"setProposal",async(i,r)=>{this.client.core.expirer.set(i,pe(ye.wc_sessionPropose.req.ttl)),await this.client.proposal.set(i,r)}),N(this,"setAuthRequest",async(i,r)=>{const{request:s,pairingTopic:n,transportType:o=ce.relay}=r;this.client.core.expirer.set(i,s.expiryTimestamp),await this.client.auth.requests.set(i,{authPayload:s.authPayload,requester:s.requester,expiryTimestamp:s.expiryTimestamp,id:i,pairingTopic:n,verifyContext:s.verifyContext,transportType:o})}),N(this,"setPendingSessionRequest",async i=>{const{id:r,topic:s,params:n,verifyContext:o}=i,a=n.request.expiryTimestamp||pe(ye.wc_sessionRequest.req.ttl);this.client.core.expirer.set(r,a),await this.client.pendingRequest.set(r,{id:r,topic:s,params:n,verifyContext:o})}),N(this,"sendRequest",async i=>{const{topic:r,method:s,params:n,expiry:o,relayRpcId:a,clientRpcId:c,throwOnFailedPublish:l,appLink:h,tvf:u}=i,d=zt(s,n,c);let f;const p=!!h;try{const v=p?Ft:ut;f=await this.client.core.crypto.encode(r,d,{encoding:v})}catch(v){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${r} failed`),v}let y;if(w2.includes(s)){const v=_t(JSON.stringify(d)),b=_t(f);y=await this.client.core.verify.register({id:b,decryptedId:v})}const w=ye[s].req;if(w.attestation=y,o&&(w.ttl=o),a&&(w.id=a),this.client.core.history.set(r,d),p){const v=es(h,r,f);await window.Linking.openURL(v,this.client.name)}else{const v=ye[s].req;o&&(v.ttl=o),a&&(v.id=a),v.tvf=Ne(se({},u),{correlationId:d.id}),l?(v.internal=Ne(se({},v.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,f,v)):this.client.core.relayer.publish(r,f,v).catch(b=>this.client.logger.error(b))}return d.id}),N(this,"sendResult",async i=>{const{id:r,topic:s,result:n,throwOnFailedPublish:o,encodeOpts:a,appLink:c}=i,l=Vs(r,n);let h;const u=c&&typeof(window==null?void 0:window.Linking)<"u";try{const p=u?Ft:ut;h=await this.client.core.crypto.encode(s,l,Ne(se({},a||{}),{encoding:p}))}catch(p){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${s} failed`),p}let d,f;try{d=await this.client.core.history.get(s,r);const p=d.request;try{this.shouldSetTVF(p.method,p.params)&&(f=this.getTVFParams(r,p.params,n))}catch(y){this.client.logger.warn("sendResult() -> getTVFParams() failed",y)}}catch(p){throw this.client.logger.error(`sendResult() -> history.get(${s}, ${r}) failed`),p}if(u){const p=es(c,s,h);await window.Linking.openURL(p,this.client.name)}else{const p=d.request.method,y=ye[p].res;y.tvf=Ne(se({},f),{correlationId:r}),o?(y.internal=Ne(se({},y.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(s,h,y)):this.client.core.relayer.publish(s,h,y).catch(w=>this.client.logger.error(w))}await this.client.core.history.resolve(l)}),N(this,"sendError",async i=>{const{id:r,topic:s,error:n,encodeOpts:o,rpcOpts:a,appLink:c}=i,l=Hs(r,n);let h;
vendor: 14,704 bytes, line 45
45const u=c&&typeof(window==null?void 0:window.Linking)<"u";try{const f=u?Ft:ut;h=await this.client.core.crypto.encode(s,l,Ne(se({},o||{}),{encoding:f}))}catch(f){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${s} failed`),f}let d;try{d=await this.client.core.history.get(s,r)}catch(f){throw this.client.logger.error(`sendError() -> history.get(${s}, ${r}) failed`),f}if(u){const f=es(c,s,h);await window.Linking.openURL(f,this.client.name)}else{const f=d.request.method,p=a||ye[f].res;this.client.core.relayer.publish(s,h,p)}await this.client.core.history.resolve(l)}),N(this,"cleanup",async()=>{const i=[],r=[];this.client.session.getAll().forEach(s=>{let n=!1;kt(s.expiry)&&(n=!0),this.client.core.crypto.keychain.has(s.topic)||(n=!0),n&&i.push(s.topic)}),this.client.proposal.getAll().forEach(s=>{kt(s.expiryTimestamp)&&r.push(s.id)}),await Promise.all([...i.map(s=>this.deleteSession({topic:s})),...r.map(s=>this.deleteProposal(s))])}),N(this,"onProviderMessageEvent",async i=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(i):await this.onRelayMessage(i)}),N(this,"onRelayEventRequest",async i=>{this.requestQueue.queue.push(i),await this.processRequestsQueue()}),N(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===mt.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=mt.active;const i=this.requestQueue.queue.shift();if(i)try{await this.processRequest(i)}catch(r){this.client.logger.warn(r)}}this.requestQueue.state=mt.idle}),N(this,"processRequest",async i=>{const{topic:r,payload:s,attestation:n,transportType:o,encryptedId:a}=i,c=s.method;if(!this.shouldIgnorePairingRequest({topic:r,requestMethod:c}))switch(c){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:r,payload:s,attestation:n,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(r,s);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(r,s);case"wc_sessionExtend":return await this.onSessionExtendRequest(r,s);case"wc_sessionPing":return await this.onSessionPingRequest(r,s);case"wc_sessionDelete":return await this.onSessionDeleteRequest(r,s);case"wc_sessionRequest":return await this.onSessionRequest({topic:r,payload:s,attestation:n,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(r,s);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:r,payload:s,attestation:n,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${c}`)}}),N(this,"onRelayEventResponse",async i=>{const{topic:r,payload:s,transportType:n}=i,o=(await this.client.core.history.get(r,s.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(r,s,n);case"wc_sessionSettle":return this.onSessionSettleResponse(r,s);case"wc_sessionUpdate":return this.onSessionUpdateResponse(r,s);case"wc_sessionExtend":return this.onSessionExtendResponse(r,s);case"wc_sessionPing":return this.onSessionPingResponse(r,s);case"wc_sessionRequest":return this.onSessionRequestResponse(r,s);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(r,s);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),N(this,"onRelayEventUnknownPayload",i=>{const{topic:r}=i,{message:s}=D("MISSING_OR_INVALID",`Decoded payload on topic ${r} is not identifiable as a JSON-RPC request or a response.`);throw new Error(s)}),N(this,"shouldIgnorePairingRequest",i=>{const{topic:r,requestMethod:s}=i,n=this.expectedPairingMethodMap.get(r);return!n||n.includes(s)?!1:!!(n.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),N(this,"onSessionProposeRequest",async i=>{const{topic:r,payload:s,attestation:n,encryptedId:o}=i,{params:a,id:c}=s;try{const l=this.client.core.eventClient.getEvent({topic:r});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(Ct.proposal_listener_not_found)),this.isValidConnect(se({},s.params));const h=a.expiryTimestamp||pe(ye.wc_sessionPropose.req.ttl),u=se({id:c,pairingTopic:r,expiryTimestamp:h},a);await this.setProposal(c,u);const d=await this.getVerifyContext({attestationId:n,hash:_t(JSON.stringify(s)),encryptedId:o,metadata:u.proposer.metadata});l==null||l.addTrace(wt.emit_session_proposal),this.client.events.emit("session_proposal",{id:c,params:u,verifyContext:d})}catch(l){await this.sendError({id:c,topic:r,error:l,rpcOpts:ye.wc_sessionPropose.autoReject}),this.client.logger.error(l)}}),N(this,"onSessionProposeResponse",async(i,r,s)=>{const{id:n}=r;if(vt(r)){const{result:o}=r;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(n);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const c=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:c});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const h=await this.client.core.crypto.generateSharedKey(c,l);this.pendingSessions.set(n,{sessionTopic:h,pairingTopic:i,proposalId:n,publicKey:c});const u=await this.client.core.relayer.subscribe(h,{transportType:s});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:u}),await this.client.core.pairing.activate({topic:i})}else if(it(r)){await this.client.proposal.delete(n,te("USER_DISCONNECTED"));const o=Q("session_connect",n);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:r.error})}}),N(this,"onSessionSettleRequest",async(i,r)=>{const{id:s,params:n}=r;try{this.isValidSessionSettleRequest(n);const{relay:o,controller:a,expiry:c,namespaces:l,sessionProperties:h,scopedProperties:u,sessionConfig:d}=r.params,f=[...this.pendingSessions.values()].find(w=>w.sessionTopic===i);if(!f)return this.client.logger.error(`Pending session not found for topic ${i}`);const p=this.client.proposal.get(f.proposalId),y=Ne(se(se(se({topic:i,relay:o,expiry:c,namespaces:l,acknowledged:!0,pairingTopic:f.pairingTopic,requiredNamespaces:p.requiredNamespaces,optionalNamespaces:p.optionalNamespaces,controller:a.publicKey,self:{publicKey:f.publicKey,metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},h&&{sessionProperties:h}),u&&{scopedProperties:u}),d&&{sessionConfig:d}),{transportType:ce.relay});await this.client.session.set(y.topic,y),await this.setExpiry(y.topic,y.expiry),await this.client.core.pairing.updateMetadata({topic:f.pairingTopic,metadata:y.peer.metadata}),this.client.events.emit("session_connect",{session:y}),this.events.emit(Q("session_connect",f.proposalId),{session:y}),this.pendingSessions.delete(f.proposalId),this.deleteProposal(f.proposalId,!1),this.cleanupDuplicatePairings(y),await this.sendResult({id:r.id,topic:i,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:s,topic:i,error:o}),this.client.logger.error(o)}}),N(this,"onSessionSettleResponse",async(i,r)=>{const{id:s}=r;vt(r)?(await this.client.session.update(i,{acknowledged:!0}),this.events.emit(Q("session_approve",s),{})):it(r)&&(await this.client.session.delete(i,te("USER_DISCONNECTED")),this.events.emit(Q("session_approve",s),{error:r.error}))}),N(this,"onSessionUpdateRequest",async(i,r)=>{const{params:s,id:n}=r;try{const o=`${i}_session_update`,a=lr.get(o);if(a&&this.isRequestOutOfSync(a,n)){this.client.logger.warn(`Discarding out of sync request - ${n}`),this.sendError({id:n,topic:i,error:te("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(se({topic:i},s));try{lr.set(o,n),await this.client.session.update(i,{namespaces:s.namespaces}),await this.sendResult({id:n,topic:i,result:!0,throwOnFailedPublish:!0})}catch(c){throw lr.delete(o),c}this.client.events.emit("session_update",{id:n,topic:i,params:s})}catch(o){await this.sendError({id:n,topic:i,error:o}),this.client.logger.error(o)}}),N(this,"isRequestOutOfSync",(i,r)=>r.toString().slice(0,-3)<i.toString().slice(0,-3)),N(this,"onSessionUpdateResponse",(i,r)=>{const{id:s}=r,n=Q("session_update",s);if(this.events.listenerCount(n)===0)throw new Error(`emitting ${n} without any listeners`);vt(r)?this.events.emit(Q("session_update",s),{}):it(r)&&this.events.emit(Q("session_update",s),{error:r.error})}),N(this,"onSessionExtendRequest",async(i,r)=>{const{id:s}=r;try{this.isValidExtend({topic:i}),await this.setExpiry(i,pe(Ii)),await this.sendResult({id:s,topic:i,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:s,topic:i})}catch(n){await this.sendError({id:s,topic:i,error:n}),this.client.logger.error(n)}}),N(this,"onSessionExtendResponse",(i,r)=>{const{id:s}=r,n=Q("session_extend",s);if(this.events.listenerCount(n)===0)throw new Error(`emitting ${n} without any listeners`);vt(r)?this.events.emit(Q("session_extend",s),{}):it(r)&&this.events.emit(Q("session_extend",s),{error:r.error})}),N(this,"onSessionPingRequest",async(i,r)=>{const{id:s}=r;try{this.isValidPing({topic:i}),await this.sendResult({id:s,topic:i,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:s,topic:i})}catch(n){await this.sendError({id:s,topic:i,error:n}),this.client.logger.error(n)}}),N(this,"onSessionPingResponse",(i,r)=>{const{id:s}=r,n=Q("session_ping",s);setTimeout(()=>{if(this.events.listenerCount(n)===0)throw new Error(`emitting ${n} without any listeners 2176`);vt(r)?this.events.emit(Q("session_ping",s),{}):it(r)&&this.events.emit(Q("session_ping",s),{error:r.error})},500)}),N(this,"onSessionDeleteRequest",async(i,r)=>{const{id:s}=r;try{this.isValidDisconnect({topic:i,reason:r.params}),Promise.all([new Promise(n=>{this.client.core.relayer.once(be.publish,async()=>{n(await this.deleteSession({topic:i,id:s}))})}),this.sendResult({id:s,topic:i,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:i,error:te("USER_DISCONNECTED")})]).catch(n=>this.client.logger.error(n))}catch(n){this.client.logger.error(n)}}),N(this,"onSessionRequest",async i=>{var r,s,n;const{topic:o,payload:a,attestation:c,encryptedId:l,transportType:h}=i,{id:u,params:d}=a;try{await this.isValidRequest(se({topic:o},d));const f=this.client.session.get(o),p=await this.getVerifyContext({attestationId:c,hash:_t(JSON.stringify(zt("wc_sessionRequest",d,u))),encryptedId:l,metadata:f.peer.metadata,transportType:h}),y={id:u,topic:o,params:d,verifyContext:p};await this.setPendingSessionRequest(y),h===ce.link_mode&&(r=f.peer.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp((s=f.peer.metadata.redirect)==null?void 0:s.universal),(n=this.client.signConfig)!=null&&n.disableRequestQueue?this.emitSessionRequest(y):(this.addSessionRequestToSessionRequestQueue(y),this.processSessionRequestQueue())}catch(f){await this.sendError({id:u,topic:o,error:f}),this.client.logger.error(f)}}),N(this,"onSessionRequestResponse",(i,r)=>{const{id:s}=r,n=Q("session_request",s);if(this.events.listenerCount(n)===0)throw new Error(`emitting ${n} without any listeners`);vt(r)?this.events.emit(Q("session_request",s),{result:r.result}):it(r)&&this.events.emit(Q("session_request",s),{error:r.error})}),N(this,"onSessionEventRequest",async(i,r)=>{const{id:s,params:n}=r;try{const o=`${i}_session_event_${n.event.name}`,a=lr.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidEmit(se({topic:i},n)),this.client.events.emit("session_event",{id:s,topic:i,params:n}),lr.set(o,s)}catch(o){await this.sendError({id:s,topic:i,error:o}),this.client.logger.error(o)}}),N(this,"onSessionAuthenticateResponse",(i,r)=>{const{id:s}=r;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:i,payload:r}),vt(r)?this.events.emit(Q("session_request",s),{result:r.result}):it(r)&&this.events.emit(Q("session_request",s),{error:r.error})}),N(this,"onSessionAuthenticateRequest",async i=>{var r;const{topic:s,payload:n,attestation:o,encryptedId:a,transportType:c}=i;try{const{requester:l,authPayload:h,expiryTimestamp:u}=n.params,d=await this.getVerifyContext({attestationId:o,hash:_t(JSON.stringify(n)),encryptedId:a,metadata:l.metadata,transportType:c}),f={requester:l,pairingTopic:s,id:n.id,authPayload:h,verifyContext:d,expiryTimestamp:u};await this.setAuthRequest(n.id,{request:f,pairingTopic:s,transportType:c}),c===ce.link_mode&&(r=l.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:s,params:n.params,id:n.id,verifyContext:d})}catch(l){this.client.logger.error(l);const h=n.params.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),d=this.getAppLinkIfEnabled(n.params.requester.metadata,c),f={type:Lt,receiverPublicKey:h,senderPublicKey:u};await this.sendError({id:n.id,topic:s,error:l,encodeOpts:f,rpcOpts:ye.wc_sessionAuthenticate.autoReject,appLink:d})}}),N(this,"addSessionRequestToSessionRequestQueue",i=>{this.sessionRequestQueue.queue.push(i)}),N(this,"cleanupAfterResponse",i=>{this.deletePendingSessionRequest(i.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=mt.idle,this.processSessionRequestQueue()},L.toMiliseconds(this.requestQueueDelay))}),N(this,"cleanupPendingSentRequestsForTopic",({topic:i,error:r})=>{const s=this.client.core.history.pending;s.length>0&&s.filter(n=>n.topic===i&&n.request.method==="wc_sessionRequest").forEach(n=>{const o=n.request.id,a=Q("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(Q("session_request",n.request.id),{error:r})})}),N(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===mt.active){this.client.logger.info("session request queue is already active.");return}const i=this.sessionRequestQueue.queue[0];if(!i){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=mt.active,this.emitSessionRequest(i)}catch(r){this.client.logger.error(r)}}),N(this,"emitSessionRequest",i=>{this.client.events.emit("session_request",i)}),N(this,"onPairingCreated",i=>{if(i.methods&&this.expectedPairingMethodMap.set(i.topic,i.methods),i.active)return;const r=this.client.proposal.getAll().find(s=>s.pairingTopic===i.topic);
45r&&this.onSessionProposeRequest({topic:i.topic,payload:zt("wc_sessionPropose",Ne(se({},r),{requiredNamespaces:r.requiredNamespaces,optionalNamespaces:r.optionalNamespaces,relays:r.relays,proposer:r.proposer,sessionProperties:r.sessionProperties,scopedProperties:r.scopedProperties}),r.id)})}),N(this,"isValidConnect",async i=>{if(!Be(i)){const{message:l}=D("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(i)}`);throw new Error(l)}const{pairingTopic:r,requiredNamespaces:s,optionalNamespaces:n,sessionProperties:o,scopedProperties:a,relays:c}=i;if(Pe(r)||await this.isValidPairingTopic(r),!J0(c)){const{message:l}=D("MISSING_OR_INVALID",`connect() relays: ${c}`);throw new Error(l)}if(!Pe(s)&&xr(s)!==0&&this.validateNamespaces(s,"requiredNamespaces"),!Pe(n)&&xr(n)!==0&&this.validateNamespaces(n,"optionalNamespaces"),Pe(o)||this.validateSessionProps(o,"sessionProperties"),!Pe(a)){this.validateSessionProps(a,"scopedProperties");const l=Object.keys(s||{}).concat(Object.keys(n||{}));if(!Object.keys(a).every(h=>l.includes(h)))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(a)}, required/optional namespaces: ${JSON.stringify(l)}`)}}),N(this,"validateNamespaces",(i,r)=>{const s=Y0(i,"connect()",r);if(s)throw new Error(s.message)}),N(this,"isValidApprove",async i=>{if(!Be(i))throw new Error(D("MISSING_OR_INVALID",`approve() params: ${i}`).message);const{id:r,namespaces:s,relayProtocol:n,sessionProperties:o,scopedProperties:a}=i;this.checkRecentlyDeleted(r),await this.isValidProposalId(r);const c=this.client.proposal.get(r),l=En(s,"approve()");if(l)throw new Error(l.message);const h=Vc(c.requiredNamespaces,s,"approve()");if(h)throw new Error(h.message);if(!de(n,!0)){const{message:u}=D("MISSING_OR_INVALID",`approve() relayProtocol: ${n}`);throw new Error(u)}if(Pe(o)||this.validateSessionProps(o,"sessionProperties"),!Pe(a)){this.validateSessionProps(a,"scopedProperties");const u=new Set(Object.keys(s));if(!Object.keys(a).every(d=>u.has(d)))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(a)}, approved namespaces: ${Array.from(u).join(", ")}`)}}),N(this,"isValidReject",async i=>{if(!Be(i)){const{message:n}=D("MISSING_OR_INVALID",`reject() params: ${i}`);throw new Error(n)}const{id:r,reason:s}=i;if(this.checkRecentlyDeleted(r),await this.isValidProposalId(r),!X0(s)){const{message:n}=D("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(s)}`);throw new Error(n)}}),N(this,"isValidSessionSettleRequest",i=>{if(!Be(i)){const{message:l}=D("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${i}`);throw new Error(l)}const{relay:r,controller:s,namespaces:n,expiry:o}=i;if(!Zu(r)){const{message:l}=D("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=z0(s,"onSessionSettleRequest()");if(a)throw new Error(a.message);const c=En(n,"onSessionSettleRequest()");if(c)throw new Error(c.message);if(kt(o)){const{message:l}=D("EXPIRED","onSessionSettleRequest()");throw new Error(l)}}),N(this,"isValidUpdate",async i=>{if(!Be(i)){const{message:c}=D("MISSING_OR_INVALID",`update() params: ${i}`);throw new Error(c)}const{topic:r,namespaces:s}=i;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const n=this.client.session.get(r),o=En(s,"update()");if(o)throw new Error(o.message);const a=Vc(n.requiredNamespaces,s,"update()");if(a)throw new Error(a.message)}),N(this,"isValidExtend",async i=>{if(!Be(i)){const{message:s}=D("MISSING_OR_INVALID",`extend() params: ${i}`);throw new Error(s)}const{topic:r}=i;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r)}),N(this,"isValidRequest",async i=>{if(!Be(i)){const{message:c}=D("MISSING_OR_INVALID",`request() params: ${i}`);throw new Error(c)}const{topic:r,request:s,chainId:n,expiry:o}=i;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const{namespaces:a}=this.client.session.get(r);if(!zc(a,n)){const{message:c}=D("MISSING_OR_INVALID",`request() chainId: ${n}`);throw new Error(c)}if(!Q0(s)){const{message:c}=D("MISSING_OR_INVALID",`request() ${JSON.stringify(s)}`);throw new Error(c)}if(!i_(a,n,s.method)){const{message:c}=D("MISSING_OR_INVALID",`request() method: ${s.method}`);throw new Error(c)}if(o&&!o_(o,Tn)){const{message:c}=D("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Tn.min} and ${Tn.max}`);throw new Error(c)}}),N(this,"isValidRespond",async i=>{var r;if(!Be(i)){const{message:o}=D("MISSING_OR_INVALID",`respond() params: ${i}`);throw new Error(o)}const{topic:s,response:n}=i;try{await this.isValidSessionTopic(s)}catch(o){throw(r=i==null?void 0:i.response)!=null&&r.id&&this.cleanupAfterResponse(i),o}if(!e_(n)){const{message:o}=D("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(n)}`);throw new Error(o)}}),N(this,"isValidPing",async i=>{if(!Be(i)){const{message:s}=D("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(s)}const{topic:r}=i;await this.isValidSessionOrPairingTopic(r)}),N(this,"isValidEmit",async i=>{if(!Be(i)){const{message:a}=D("MISSING_OR_INVALID",`emit() params: ${i}`);throw new Error(a)}const{topic:r,event:s,chainId:n}=i;await this.isValidSessionTopic(r);const{namespaces:o}=this.client.session.get(r);
45if(!zc(o,n)){const{message:a}=D("MISSING_OR_INVALID",`emit() chainId: ${n}`);throw new Error(a)}if(!t_(s)){const{message:a}=D("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(a)}if(!r_(o,n,s.name)){const{message:a}=D("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(a)}}),N(this,"isValidDisconnect",async i=>{if(!Be(i)){const{message:s}=D("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(s)}const{topic:r}=i;await this.isValidSessionOrPairingTopic(r)}),N(this,"isValidAuthenticate",i=>{const{chains:r,uri:s,domain:n,nonce:o}=i;if(!Array.isArray(r)||r.length===0)throw new Error("chains is required and must be a non-empty array");if(!de(s,!1))throw new Error("uri is required parameter");if(!de(n,!1))throw new Error("domain is required parameter");if(!de(o,!1))throw new Error("nonce is required parameter");if([...new Set(r.map(c=>Fi(c).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Fi(r[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),N(this,"getVerifyContext",async i=>{const{attestationId:r,hash:s,encryptedId:n,metadata:o,transportType:a}=i,c={verified:{verifyUrl:o.verifyUrl||vr,validation:"UNKNOWN",origin:o.url||""}};try{if(a===ce.link_mode){const h=this.getAppLinkIfEnabled(o,a);return c.verified.validation=h&&new URL(h).origin===new URL(o.url).origin?"VALID":"INVALID",c}const l=await this.client.core.verify.resolve({attestationId:r,hash:s,encryptedId:n,verifyUrl:o.verifyUrl});l&&(c.verified.origin=l.origin,c.verified.isScam=l.isScam,c.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(c)}`),c}),N(this,"validateSessionProps",(i,r)=>{Object.values(i).forEach((s,n)=>{if(s==null){const{message:o}=D("MISSING_OR_INVALID",`${r} must contain an existing value for each key. Received: ${s} for key ${Object.keys(i)[n]}`);throw new Error(o)}})}),N(this,"getPendingAuthRequest",i=>{const r=this.client.auth.requests.get(i);return typeof r=="object"?r:void 0}),N(this,"addToRecentlyDeleted",(i,r)=>{if(this.recentlyDeletedMap.set(i,r),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let s=0;const n=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(s++>=n)break;this.recentlyDeletedMap.delete(o)}}}),N(this,"checkRecentlyDeleted",i=>{const r=this.recentlyDeletedMap.get(i);if(r){const{message:s}=D("MISSING_OR_INVALID",`Record was recently deleted - ${r}: ${i}`);throw new Error(s)}}),N(this,"isLinkModeEnabled",(i,r)=>{var s,n,o,a,c,l,h,u,d;return!i||r!==ce.link_mode?!1:((n=(s=this.client.metadata)==null?void 0:s.redirect)==null?void 0:n.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(c=this.client.metadata)==null?void 0:c.redirect)==null?void 0:l.universal)!==""&&((h=i==null?void 0:i.redirect)==null?void 0:h.universal)!==void 0&&((u=i==null?void 0:i.redirect)==null?void 0:u.universal)!==""&&((d=i==null?void 0:i.redirect)==null?void 0:d.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(i.redirect.universal)&&typeof(window==null?void 0:window.Linking)<"u"}),N(this,"getAppLinkIfEnabled",(i,r)=>{var s;return this.isLinkModeEnabled(i,r)?(s=i==null?void 0:i.redirect)==null?void 0:s.universal:void 0}),N(this,"handleLinkModeMessage",({url:i})=>{if(!i||!i.includes("wc_ev")||!i.includes("topic"))return;const r=cc(i,"topic")||"",s=decodeURIComponent(cc(i,"wc_ev")||""),n=this.client.session.keys.includes(r);n&&this.client.session.update(r,{transportType:ce.link_mode}),this.client.core.dispatchEnvelope({topic:r,message:s,sessionExists:n})}),N(this,"registerLinkModeListeners",async()=>{var i;if(Vo()||Ht()&&(i=this.client.metadata.redirect)!=null&&i.linkMode){const r=window==null?void 0:window.Linking;if(typeof r<"u"){r.addEventListener("url",this.handleLinkModeMessage,this.client.name);const s=await r.getInitialURL();s&&setTimeout(()=>{this.handleLinkModeMessage({url:s})},50)}}}),N(this,"shouldSetTVF",(i,r)=>{if(!r||i!=="wc_sessionRequest")return!1;const{request:s}=r;return Object.keys(Ml).includes(s.method)}),N(this,"getTVFParams",(i,r,s)=>{var n,o;try{const a=r.request.method,c=this.extractTxHashesFromResult(a,s);return Ne(se({correlationId:i,rpcMethods:[a],chainId:r.chainId},this.isValidContractData(r.request.params)&&{contractAddresses:[(o=(n=r.request.params)==null?void 0:n[0])==null?void 0:o.to]}),{txHashes:c})}catch(a){this.client.logger.warn("Error getting TVF params",a)}return{}}),N(this,"isValidContractData",i=>{var r;if(!i)return!1;try{const s=(i==null?void 0:i.data)||((r=i==null?void 0:i[0])==null?void 0:r.data);if(!s.startsWith("0x"))return!1;const n=s.slice(2);return/^[0-9a-fA-F]*$/.test(n)?n.length%2===0:!1}catch{}return!1}),N(this,"extractTxHashesFromResult",(i,r)=>{try{const s=Ml[i];if(typeof r=="string")return[r];
vendor: 5,353 bytes, line 45
45const n=r[s.key];if(dt(n))return i==="solana_signAllTransactions"?n.map(o=>Lb(o)):n;if(typeof n=="string")return[n]}catch(s){this.client.logger.warn("Error extracting tx hashes from result",s)}return[]})}async processPendingMessageEvents(){try{const e=this.client.session.keys,i=this.client.core.relayer.messages.getWithoutAck(e);for(const[r,s]of Object.entries(i))for(const n of s)try{await this.onProviderMessageEvent({topic:r,message:n,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${r}, message: ${n}`)}}catch(e){this.client.logger.warn("processPendingMessageEvents failed",e)}}isInitialized(){if(!this.initialized){const{message:e}=D("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(be.message,e=>{this.onProviderMessageEvent(e)})}async onRelayMessage(e){const{topic:i,message:r,attestation:s,transportType:n}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(ms)?this.client.auth.authKeys.get(ms):{publicKey:void 0};try{const a=await this.client.core.crypto.decode(i,r,{receiverPublicKey:o,encoding:n===ce.link_mode?Ft:ut});ta(a)?(this.client.core.history.set(i,a),await this.onRelayEventRequest({topic:i,payload:a,attestation:s,transportType:n,encryptedId:_t(r)})):Ks(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:i,payload:a,transportType:n}),this.client.core.history.delete(i,a.id)):await this.onRelayEventUnknownPayload({topic:i,payload:a,transportType:n}),await this.client.core.relayer.messages.ack(i,r)}catch(a){this.client.logger.error(a)}}registerExpirerEvents(){this.client.core.expirer.on(tt.expired,async e=>{const{topic:i,id:r}=yu(e.target);if(r&&this.client.pendingRequest.keys.includes(r))return await this.deletePendingSessionRequest(r,D("EXPIRED"),!0);if(r&&this.client.auth.requests.keys.includes(r))return await this.deletePendingAuthRequest(r,D("EXPIRED"),!0);i?this.client.session.keys.includes(i)&&(await this.deleteSession({topic:i,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:i})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r}))})}registerPairingEvents(){this.client.core.pairing.events.on(Qt.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(Qt.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!de(e,!1)){const{message:i}=D("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(i)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:i}=D("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(i)}if(kt(this.client.core.pairing.pairings.get(e).expiry)){const{message:i}=D("EXPIRED",`pairing topic: ${e}`);throw new Error(i)}}async isValidSessionTopic(e){if(!de(e,!1)){const{message:i}=D("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(i)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:i}=D("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(i)}if(kt(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:i}=D("EXPIRED",`session topic: ${e}`);throw new Error(i)}if(!this.client.core.crypto.keychain.has(e)){const{message:i}=D("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(i)}}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(de(e,!1)){const{message:i}=D("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(i)}else{const{message:i}=D("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(i)}}async isValidProposalId(e){if(!Z0(e)){const{message:i}=D("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(i)}if(!this.client.proposal.keys.includes(e)){const{message:i}=D("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(i)}if(kt(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:i}=D("EXPIRED",`proposal id: ${e}`);throw new Error(i)}}}class C2 extends di{constructor(e,i){super(e,i,f2,ia),this.core=e,this.logger=i}}let R2=class extends di{constructor(e,i){super(e,i,g2,ia),this.core=e,this.logger=i}};class T2 extends di{constructor(e,i){super(e,i,m2,ia,r=>r.id),this.core=e,this.logger=i}}class N2 extends di{constructor(e,i){super(e,i,_2,Gs,()=>ms),this.core=e,this.logger=i}}class L2 extends di{constructor(e,i){super(e,i,E2,Gs),this.core=e,this.logger=i}}class D2 extends di{constructor(e,i){super(e,i,I2,Gs,r=>r.id),this.core=e,this.logger=i}}var j2=Object.defineProperty,M2=(t,e,i)=>e in t?j2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Nn=(t,e,i)=>M2(t,typeof e!="symbol"?e+"":e,i);class U2{constructor(e,i){this.core=e,this.logger=i,Nn(this,"authKeys"),Nn(this,"pairingTopics"),Nn(this,"requests"),this.authKeys=new N2(this.core,this.logger),this.pairingTopics=new L2(this.core,this.logger),this.requests=new D2(this.core,this.logger)}
45async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var B2=Object.defineProperty,k2=(t,e,i)=>e in t?B2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,W=(t,e,i)=>k2(t,typeof e!="symbol"?e+"":e,i);let F2=class xd extends FE{constructor(e){super(e),W(this,"protocol",Pd),W(this,"version",$d),W(this,"name",Rn.name),W(this,"metadata"),W(this,"core"),W(this,"logger"),W(this,"events",new Je.EventEmitter),W(this,"engine"),W(this,"session"),W(this,"proposal"),W(this,"pendingRequest"),W(this,"auth"),W(this,"signConfig"),W(this,"on",(r,s)=>this.events.on(r,s)),W(this,"once",(r,s)=>this.events.once(r,s)),W(this,"off",(r,s)=>this.events.off(r,s)),W(this,"removeListener",(r,s)=>this.events.removeListener(r,s)),W(this,"removeAllListeners",r=>this.events.removeAllListeners(r)),W(this,"connect",async r=>{try{return await this.engine.connect(r)}catch(s){throw this.logger.error(s.message),s}}),W(this,"pair",async r=>{try{return await this.engine.pair(r)}catch(s){throw this.logger.error(s.message),s}}),W(this,"approve",async r=>{try{return await this.engine.approve(r)}catch(s){throw this.logger.error(s.message),s}}),W(this,"reject",async r=>{try{return await this.engine.reject(r)}catch(s){throw this.logger.error(s.message),s}}),W(this,"update",async r=>{try{return await this.engine.update(r)}catch(s){throw this.logger.error(s.message),s}}),W(this,"extend",async r=>{try{return await this.engine.extend(r)}catch(s){throw this.logger.error(s.message),s}}),W(this,"request",async r=>{try{return await this.engine.request(r)}catch(s){throw this.logger.error(s.message),s}}),W(this,"respond",async r=>{try{return await this.engine.respond(r)}catch(s){throw this.logger.error(s.message),s}}),W(this,"ping",async r=>{try{return await this.engine.ping(r)}catch(s){throw this.logger.error(s.message),s}}),W(this,"emit",async r=>{try{return await this.engine.emit(r)}catch(s){throw this.logger.error(s.message),s}}),W(this,"disconnect",async r=>{try{return await this.engine.disconnect(r)}catch(s){throw this.logger.error(s.message),s}}),W(this,"find",r=>{try{return this.engine.find(r)}catch(s){throw this.logger.error(s.message),s}}),W(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(r){throw this.logger.error(r.message),r}}),W(this,"authenticate",async(r,s)=>{try{return await this.engine.authenticate(r,s)}catch(n){throw this.logger.error(n.message),n}}),W(this,"formatAuthMessage",r=>{try{return this.engine.formatAuthMessage(r)}catch(s){throw this.logger.error(s.message),s}}),W(this,"approveSessionAuthenticate",async r=>{try{return await this.engine.approveSessionAuthenticate(r)}catch(s){throw this.logger.error(s.message),s}}),W(this,"rejectSessionAuthenticate",async r=>{try{return await this.engine.rejectSessionAuthenticate(r)}catch(s){throw this.logger.error(s.message),s}}),this.name=(e==null?void 0:e.name)||Rn.name,this.metadata=Ww(e==null?void 0:e.metadata),this.signConfig=e==null?void 0:e.signConfig;const i=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Vr(zs({level:(e==null?void 0:e.logger)||Rn.logger}));this.core=(e==null?void 0:e.core)||new p2(e),this.logger=De(i,this.name),this.session=new R2(this.core,this.logger),this.proposal=new C2(this.core,this.logger),this.pendingRequest=new T2(this.core,this.logger),this.engine=new x2(this),this.auth=new U2(this.core,this.logger)}static async init(e){const i=new xd(e);return await i.initialize(),i}get context(){return qe(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()},L.toMiliseconds(L.ONE_SECOND))}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}};var Po={exports:{}};(function(t,e){var i=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof window<"u"&&window,r=function(){function n(){this.fetch=!1,this.DOMException=i.DOMException}return n.prototype=i,new n}();(function(n){(function(o){var a=typeof n<"u"&&n||typeof self<"u"&&self||typeof window<"u"&&window||{},c={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function l(g){return g&&DataView.prototype.isPrototypeOf(g)}if(c.arrayBuffer)var h=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array
45]"],u=ArrayBuffer.isView||function(g){return g&&h.indexOf(Object.prototype.toString.call(g))>-1};function d(g){if(typeof g!="string"&&(g=String(g)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(g)||g==="")throw new TypeError('Invalid character in header field name: "'+g+'"');return g.toLowerCase()}function f(g){return typeof g!="string"&&(g=String(g)),g}function p(g){var m={next:function(){var E=g.shift();return{done:E===void 0,value:E}}};return c.iterable&&(m[Symbol.iterator]=function(){return m}),m}function y(g){this.map={},g instanceof y?g.forEach(function(m,E){this.append(E,m)},this):Array.isArray(g)?g.forEach(function(m){if(m.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+m.length);this.append(m[0],m[1])},this):g&&Object.getOwnPropertyNames(g).forEach(function(m){this.append(m,g[m])},this)}y.prototype.append=function(g,m){g=d(g),m=f(m);var E=this.map[g];this.map[g]=E?E+", "+m:m},y.prototype.delete=function(g){delete this.map[d(g)]},y.prototype.get=function(g){return g=d(g),this.has(g)?this.map[g]:null},y.prototype.has=function(g){return this.map.hasOwnProperty(d(g))},y.prototype.set=function(g,m){this.map[d(g)]=f(m)},y.prototype.forEach=function(g,m){for(var E in this.map)this.map.hasOwnProperty(E)&&g.call(m,this.map[E],E,this)},y.prototype.keys=function(){var g=[];return this.forEach(function(m,E){g.push(E)}),p(g)},y.prototype.values=function(){var g=[];return this.forEach(function(m){g.push(m)}),p(g)},y.prototype.entries=function(){var g=[];return this.forEach(function(m,E){g.push([E,m])}),p(g)},c.iterable&&(y.prototype[Symbol.iterator]=y.prototype.entries);function w(g){if(!g._noBody){if(g.bodyUsed)return Promise.reject(new TypeError("Already read"));g.bodyUsed=!0}}function v(g){return new Promise(function(m,E){g.onload=function(){m(g.result)},g.onerror=function(){E(g.error)}})}function b(g){var m=new FileReader,E=v(m);return m.readAsArrayBuffer(g),E}function _(g){var m=new FileReader,E=v(m),P=/charset=([A-Za-z0-9_-]+)/.exec(g.type),S=P?P[1]:"utf-8";return m.readAsText(g,S),E}function I(g){for(var m=new Uint8Array(g),E=new Array(m.length),P=0;P<m.length;P++)E[P]=String.fromCharCode(m[P]);return E.join("")}function A(g){if(g.slice)return g.slice(0);var m=new Uint8Array(g.byteLength);return m.set(new Uint8Array(g)),m.buffer}function x(){return this.bodyUsed=!1,this._initBody=function(g){this.bodyUsed=this.bodyUsed,this._bodyInit=g,g?typeof g=="string"?this._bodyText=g:c.blob&&Blob.prototype.isPrototypeOf(g)?this._bodyBlob=g:c.formData&&FormData.prototype.isPrototypeOf(g)?this._bodyFormData=g:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(g)?this._bodyText=g.toString():c.arrayBuffer&&c.blob&&l(g)?(this._bodyArrayBuffer=A(g.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(g)||u(g))?this._bodyArrayBuffer=A(g):this._bodyText=g=Object.prototype.toString.call(g):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof g=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(g)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var g=w(this);if(g)return g;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var g=w(this);return g||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(c.blob)return this.blob().then(b);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var g=w(this);if(g)return g;if(this._bodyBlob)return _(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(I(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(F)}),this.json=function(){return this.text().then(JSON.parse)},this}var $=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function R(g){var m=g.toUpperCase();return $.indexOf(m)>-1?m:g}function O(g,m){if(!(this instanceof O))throw new TypeError('Please use the "new" operator, this DOM object c
45onstructor cannot be called as a function.');m=m||{};var E=m.body;if(g instanceof O){if(g.bodyUsed)throw new TypeError("Already read");this.url=g.url,this.credentials=g.credentials,m.headers||(this.headers=new y(g.headers)),this.method=g.method,this.mode=g.mode,this.signal=g.signal,!E&&g._bodyInit!=null&&(E=g._bodyInit,g.bodyUsed=!0)}else this.url=String(g);if(this.credentials=m.credentials||this.credentials||"same-origin",(m.headers||!this.headers)&&(this.headers=new y(m.headers)),this.method=R(m.method||this.method||"GET"),this.mode=m.mode||this.mode||null,this.signal=m.signal||this.signal||function(){if("AbortController"in a){var C=new AbortController;return C.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&E)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(E),(this.method==="GET"||this.method==="HEAD")&&(m.cache==="no-store"||m.cache==="no-cache")){var P=/([?&])_=[^&]*/;if(P.test(this.url))this.url=this.url.replace(P,"$1_="+new Date().getTime());else{var S=/\?/;this.url+=(S.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}O.prototype.clone=function(){return new O(this,{body:this._bodyInit})};function F(g){var m=new FormData;return g.trim().split("&").forEach(function(E){if(E){var P=E.split("="),S=P.shift().replace(/\+/g," "),C=P.join("=").replace(/\+/g," ");m.append(decodeURIComponent(S),decodeURIComponent(C))}}),m}function M(g){var m=new y,E=g.replace(/\r?\n[\t ]+/g," ");return E.split("\r").map(function(P){return P.indexOf(` 46`)===0?P.substr(1,P.length):P}
vendor: 9,223 bytes, line 46
46).forEach(function(P){var S=P.split(":"),C=S.shift().trim();if(C){var U=S.join(":").trim();try{m.append(C,U)}catch(k){console.warn("Response "+k.message)}}}),m}x.call(O.prototype);function j(g,m){if(!(this instanceof j))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(m||(m={}),this.type="default",this.status=m.status===void 0?200:m.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=m.statusText===void 0?"":""+m.statusText,this.headers=new y(m.headers),this.url=m.url||"",this._initBody(g)}x.call(j.prototype),j.prototype.clone=function(){return new j(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},j.error=function(){var g=new j(null,{status:200,statusText:""});return g.ok=!1,g.status=0,g.type="error",g};var q=[301,302,303,307,308];j.redirect=function(g,m){if(q.indexOf(m)===-1)throw new RangeError("Invalid status code");return new j(null,{status:m,headers:{location:g}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(m,E){this.message=m,this.name=E;var P=Error(m);this.stack=P.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function T(g,m){return new Promise(function(E,P){var S=new O(g,m);if(S.signal&&S.signal.aborted)return P(new o.DOMException("Aborted","AbortError"));var C=new XMLHttpRequest;function U(){C.abort()}C.onload=function(){var B={statusText:C.statusText,headers:M(C.getAllResponseHeaders()||"")};S.url.indexOf("file://")===0&&(C.status<200||C.status>599)?B.status=200:B.status=C.status,B.url="responseURL"in C?C.responseURL:B.headers.get("X-Request-URL");var V="response"in C?C.response:C.responseText;setTimeout(function(){E(new j(V,B))},0)},C.onerror=function(){setTimeout(function(){P(new TypeError("Network request failed"))},0)},C.ontimeout=function(){setTimeout(function(){P(new TypeError("Network request timed out"))},0)},C.onabort=function(){setTimeout(function(){P(new o.DOMException("Aborted","AbortError"))},0)};function k(B){try{return B===""&&a.location.href?a.location.href:B}catch{return B}}if(C.open(S.method,k(S.url),!0),S.credentials==="include"?C.withCredentials=!0:S.credentials==="omit"&&(C.withCredentials=!1),"responseType"in C&&(c.blob?C.responseType="blob":c.arrayBuffer&&(C.responseType="arraybuffer")),m&&typeof m.headers=="object"&&!(m.headers instanceof y||a.Headers&&m.headers instanceof a.Headers)){var z=[];Object.getOwnPropertyNames(m.headers).forEach(function(B){z.push(d(B)),C.setRequestHeader(B,f(m.headers[B]))}),S.headers.forEach(function(B,V){z.indexOf(V)===-1&&C.setRequestHeader(V,B)})}else S.headers.forEach(function(B,V){C.setRequestHeader(V,B)});S.signal&&(S.signal.addEventListener("abort",U),C.onreadystatechange=function(){C.readyState===4&&S.signal.removeEventListener("abort",U)}),C.send(typeof S._bodyInit>"u"?null:S._bodyInit)})}return T.polyfill=!0,a.fetch||(a.fetch=T,a.Headers=y,a.Request=O,a.Response=j),o.Headers=y,o.Request=O,o.Response=j,o.fetch=T,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var s=i.fetch?i:r;e=s.fetch,e.default=s.fetch,e.fetch=s.fetch,e.Headers=s.Headers,e.Request=s.Request,e.Response=s.Response,t.exports=e})(Po,Po.exports);var q2=Po.exports;const Bl=Ro(q2);var z2=Object.defineProperty,V2=Object.defineProperties,H2=Object.getOwnPropertyDescriptors,kl=Object.getOwnPropertySymbols,K2=Object.prototype.hasOwnProperty,W2=Object.prototype.propertyIsEnumerable,Fl=(t,e,i)=>e in t?z2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ql=(t,e)=>{for(var i in e||(e={}))K2.call(e,i)&&Fl(t,i,e[i]);if(kl)for(var i of kl(e))W2.call(e,i)&&Fl(t,i,e[i]);return t},zl=(t,e)=>V2(t,H2(e));const G2={Accept:"application/json","Content-Type":"application/json"},Y2="POST",Vl={headers:G2,method:Y2},Hl=10;class pt{constructor(e,i=!1){if(this.url=e,this.disableProviderPing=i,this.events=new Je.EventEmitter,this.isAvailable=!1,this.registering=!1,!al(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=i}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,i){this.events.on(e,i)}once(e,i){this.events.once(e,i)}off(e,i){this.events.off(e,i)}removeListener(e,i){this.events.removeListener(e,i)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const i=Dt(e),r=await(await Bl(this.url,zl(ql({},Vl),{body:i}))).json();this.onPayload({data:r})}catch(i){this.onError(e.id,i)}}async register(e=this.url){if(!al(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const i=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=i||this.events.listenerCount("open")>=i)&&this.events.setMaxListeners(i+1),new Promise((r,s)=>{this.events.once("register_error",n=>{this.resetMaxListeners(),s(n)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return s(new Error("HTTP connection is missing or invalid"));r()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const i=Dt({id:1,jsonrpc:"2.0",method:"test",params:[]});await Bl(e,zl(ql({},Vl),{body:i}))}this.onOpen()}catch(i){const r=this.parseError(i);throw this.events.emit("register_error",r),this.onClose(),r}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const i=typeof e.data=="string"?ni(e.data):e.data;this.events.emit("payload",i)}onError(e,i){const r=this.parseError(i),s=r.message||r.toString(),n=Hs(e,s);this.events.emit("payload",n)}parseError(e,i=this.url){return nd(e,i,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>Hl&&this.events.setMaxListeners(Hl)}}const Kl="error",J2="wss://relay.walletconnect.org",Z2="wc",X2="universal_provider",ns=`${Z2}@2:${X2}:`,Cd="https://rpc.walletconnect.org/v1/",ji="generic",Q2=`${Cd}bundler`,nt={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};function eP(){}function ra(t){return t==null||typeof t!="object"&&typeof t!="function"}function sa(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function tP(t){if(ra(t))return t;if(Array.isArray(t)||sa(t)||t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);const e=Object.getPrototypeOf(t),i=e.constructor;if(t instanceof Date||t instanceof Map||t instanceof Set)return new i(t);if(t instanceof RegExp){const r=new i(t);return r.lastIndex=t.lastIndex,r}if(t instanceof DataView)return new i(t.buffer.slice(0));if(t instanceof Error){const r=new i(t.message);return r.stack=t.stack,r.name=t.name,r.cause=t.cause,r}if(typeof File<"u"&&t instanceof File)return new i([t],t.name,{type:t.type,lastModified:t.lastModified});if(typeof t=="object"){const r=Object.create(e);return Object.assign(r,t)}return t}function Wl(t){return typeof t=="object"&&t!==null}function Rd(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function Td(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const iP="[object RegExp]",Nd="[object String]",Ld="[object Number]",Dd="[object Boolean]",jd="[object Arguments]",rP="[object Symbol]",sP="[object Date]",nP="[object Map]",oP="[object Set]",aP="[object Array]",cP="[object ArrayBuffer]",lP="[object Object]",hP="[object DataView]",uP="[object Uint8Array]",dP="[object Uint8ClampedArray]",pP="[object Uint16Array]",fP="[object Uint32Array]",gP="[object Int8Array]",yP="[object Int16Array]",mP="[object Int32Array]",wP="[object Float32Array]",bP="[object Float64Array]";function vP(t,e){return Bi(t,void 0,t,new Map,e)}function Bi(t,e,i,r=new Map,s=void 0){const n=s==null?void 0:s(t,e,i,r);if(n!=null)return n;if(ra(t))return t;if(r.has(t))return r.get(t);if(Array.isArray(t)){const o=new Array(t.length);r.set(t,o);for(let a=0;a<t.length;a++)o[a]=Bi(t[a],a,i,r,s);return Object.hasOwn(t,"index")&&(o.index=t.index),Object.hasOwn(t,"input")&&(o.input=t.input),o}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const o=new RegExp(t.source,t.flags);return o.lastIndex=t.lastIndex,o}if(t instanceof Map){const o=new Map;r.set(t,o);for(const[a,c]of t)o.set(a,Bi(c,a,i,r,s));return o}if(t instanceof Set){const o=new Set;r.set(t,o);for(const a of t)o.add(Bi(a,void 0,i,r,s));return o}if(typeof Buffer<"u"&&Buffer.isBuffer(t))return t.subarray();if(sa(t)){const o=new(Object.getPrototypeOf(t)).constructor(t.length);r.set(t,o);for(let a=0;a<t.length;a++)o[a]=Bi(t[a],a,i,r,s);return o}if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){const o=new DataView(t.buffer.slice(0),t.byteOffset,t.byteLength);
46return r.set(t,o),ei(o,t,i,r,s),o}if(typeof File<"u"&&t instanceof File){const o=new File([t],t.name,{type:t.type});return r.set(t,o),ei(o,t,i,r,s),o}if(t instanceof Blob){const o=new Blob([t],{type:t.type});return r.set(t,o),ei(o,t,i,r,s),o}if(t instanceof Error){const o=new t.constructor;return r.set(t,o),o.message=t.message,o.name=t.name,o.stack=t.stack,o.cause=t.cause,ei(o,t,i,r,s),o}if(typeof t=="object"&&_P(t)){const o=Object.create(Object.getPrototypeOf(t));return r.set(t,o),ei(o,t,i,r,s),o}return t}function ei(t,e,i=t,r,s){const n=[...Object.keys(e),...Rd(e)];for(let o=0;o<n.length;o++){const a=n[o],c=Object.getOwnPropertyDescriptor(t,a);(c==null||c.writable)&&(t[a]=Bi(e[a],a,i,r,s))}}function _P(t){switch(Td(t)){case jd:case aP:case cP:case hP:case Dd:case sP:case wP:case bP:case gP:case yP:case mP:case nP:case Ld:case lP:case iP:case oP:case Nd:case rP:case uP:case dP:case pP:case fP:return!0;default:return!1}}function EP(t,e){return vP(t,(i,r,s,n)=>{if(typeof t=="object")switch(Object.prototype.toString.call(t)){case Ld:case Nd:case Dd:{const o=new t.constructor(t==null?void 0:t.valueOf());return ei(o,t),o}case jd:{const o={};return ei(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}})}function Gl(t){return EP(t)}function Yl(t){return t!==null&&typeof t=="object"&&Td(t)==="[object Arguments]"}function IP(t){return sa(t)}function SP(t){var i;if(typeof t!="object"||t==null)return!1;if(Object.getPrototypeOf(t)===null)return!0;if(Object.prototype.toString.call(t)!=="[object Object]"){const r=t[Symbol.toStringTag];return r==null||!((i=Object.getOwnPropertyDescriptor(t,Symbol.toStringTag))!=null&&i.writable)?!1:t.toString()===`[object ${r}]`}let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function OP(t,...e){const i=e.slice(0,-1),r=e[e.length-1];let s=t;for(let n=0;n<i.length;n++){const o=i[n];s=$o(s,o,r,new Map)}return s}function $o(t,e,i,r){if(ra(t)&&(t=Object(t)),e==null||typeof e!="object")return t;if(r.has(e))return tP(r.get(e));if(r.set(e,t),Array.isArray(e)){e=e.slice();for(let n=0;n<e.length;n++)e[n]=e[n]??void 0}const s=[...Object.keys(e),...Rd(e)];for(let n=0;n<s.length;n++){const o=s[n];let a=e[o],c=t[o];if(Yl(a)&&(a={...a}),Yl(c)&&(c={...c}),typeof Buffer<"u"&&Buffer.isBuffer(a)&&(a=Gl(a)),Array.isArray(a))if(typeof c=="object"&&c!=null){const h=[],u=Reflect.ownKeys(c);for(let d=0;d<u.length;d++){const f=u[d];h[f]=c[f]}c=h}else c=[];const l=i(c,a,o,t,e,r);l!=null?t[o]=l:Array.isArray(a)||Wl(c)&&Wl(a)?t[o]=$o(c,a,i,r):c==null&&SP(a)?t[o]=$o({},a,i,r):c==null&&IP(a)?t[o]=Gl(a):(c===void 0||a!==void 0)&&(t[o]=a)}return t}function PP(t,...e){return OP(t,...e,eP)}var $P=Object.defineProperty,AP=Object.defineProperties,xP=Object.getOwnPropertyDescriptors,Jl=Object.getOwnPropertySymbols,CP=Object.prototype.hasOwnProperty,RP=Object.prototype.propertyIsEnumerable,Zl=(t,e,i)=>e in t?$P(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,os=(t,e)=>{for(var i in e||(e={}))CP.call(e,i)&&Zl(t,i,e[i]);if(Jl)for(var i of Jl(e))RP.call(e,i)&&Zl(t,i,e[i]);return t},TP=(t,e)=>AP(t,xP(e));function Ye(t,e,i){var r;const s=Fi(t);return((r=e.rpcMap)==null?void 0:r[s.reference])||`${Cd}?chainId=${s.namespace}:${s.reference}&projectId=${i}`}function pi(t){return t.includes(":")?t.split(":")[1]:t}function Md(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function NP(t,e){const i=Object.keys(e.namespaces).filter(s=>s.includes(t));if(!i.length)return[];const r=[];return i.forEach(s=>{const n=e.namespaces[s].accounts;r.push(...n)}),r}function Ln(t={},e={}){const i=Xl(t),r=Xl(e);return PP(i,r)}function Xl(t){var e,i,r,s;const n={};if(!xr(t))return n;for(const[o,a]of Object.entries(t)){const c=Zo(o)?[o]:a.chains,l=a.methods||[],h=a.events||[],u=a.rpcMap||{},d=gr(o);n[d]=TP(os(os({},n[d]),a),{chains:us(c,(e=n[d])==null?void 0:e.chains),methods:us(l,(i=n[d])==null?void 0:i.methods),events:us(h,(r=n[d])==null?void 0:r.events),rpcMap:os(os({},u),(s=n[d])==null?void 0:s.rpcMap)})}return n}function Ql(t){return t.includes(":")?t.split(":")[2]:t}function eh(t){const e={};for(const[i,r]of Object.entries(t)){const s=r.methods||[],n=r.events||[],o=r.accounts||[],a=Zo(i)?[i]:r.chains?r.chains:Md(r.accounts);e[i]={chains:a,methods:s,events:n,accounts:o}}return e}function Dn(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const Ud={},X=t=>Ud[t],jn=(t,e)=>{Ud[t]=e};var LP=Object.defineProperty,DP=(t,e,i)=>e in t?LP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Si=(t,e,i)=>DP(t,typeof e!="symbol"?e+"":e,i);
46class jP{constructor(e){Si(this,"name","polkadot"),Si(this,"client"),Si(this,"httpProviders"),Si(this,"events"),Si(this,"namespace"),Si(this,"chainId"),this.namespace=e.namespace,this.events=X("events"),this.client=X("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,i){this.httpProviders[e]||this.setHttpProvider(e,i),this.chainId=e,this.events.emit(nt.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(i=>{var r;const s=pi(i);e[s]=this.createHttpProvider(s,(r=this.namespace.rpcMap)==null?void 0:r[i])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,i=this.httpProviders[e];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return i}setHttpProvider(e,i){const r=this.createHttpProvider(e,i);r&&(this.httpProviders[e]=r)}createHttpProvider(e,i){const r=i||Ye(e,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new st(new pt(r,X("disableProviderPing")))}}var MP=Object.defineProperty,UP=Object.defineProperties,BP=Object.getOwnPropertyDescriptors,th=Object.getOwnPropertySymbols,kP=Object.prototype.hasOwnProperty,FP=Object.prototype.propertyIsEnumerable,Ao=(t,e,i)=>e in t?MP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ih=(t,e)=>{for(var i in e||(e={}))kP.call(e,i)&&Ao(t,i,e[i]);if(th)for(var i of th(e))FP.call(e,i)&&Ao(t,i,e[i]);return t},rh=(t,e)=>UP(t,BP(e)),Oi=(t,e,i)=>Ao(t,typeof e!="symbol"?e+"":e,i);class qP{constructor(e){Oi(this,"name","eip155"),Oi(this,"client"),Oi(this,"chainId"),Oi(this,"namespace"),Oi(this,"httpProviders"),Oi(this,"events"),this.namespace=e.namespace,this.events=X("events"),this.client=X("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,i){this.httpProviders[e]||this.setHttpProvider(parseInt(e),i),this.chainId=parseInt(e),this.events.emit(nt.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,i){const r=i||Ye(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new st(new pt(r,X("disableProviderPing")))}setHttpProvider(e,i){const r=this.createHttpProvider(e,i);r&&(this.httpProviders[e]=r)}createHttpProviders(){const e={};return this.namespace.chains.forEach(i=>{var r;const s=parseInt(pi(i));e[s]=this.createHttpProvider(s,(r=this.namespace.rpcMap)==null?void 0:r[i])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,i=this.httpProviders[e];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return i}async handleSwitchChain(e){var i,r;let s=e.request.params?(i=e.request.params[0])==null?void 0:i.chainId:"0x0";s=s.startsWith("0x")?s:`0x${s}`;const n=parseInt(s,16);if(this.isChainApproved(n))this.setDefaultChain(`${n}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:s}]},chainId:(r=this.namespace.chains)==null?void 0:r[0]}),this.setDefaultChain(`${n}`);else throw new Error(`Failed to switch to chain 'eip155:${n}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var i,r,s;const n=(r=(i=e.request)==null?void 0:i.params)==null?void 0:r[0];if(!n)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((s=o==null?void 0:o.sessionProperties)==null?void 0:s.capabilities)||{};if(a!=null&&a[n])return a==null?void 0:a[n];const c=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:rh(ih({},o.sessionProperties||{}),{capabilities:rh(ih({},a||{}),{[n]:c})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return c}async getCallStatus(e){var i,r;const s=this.client.session.get(e.topic),n=(i=s.sessionProperties)==null?void 0:i.bundler_name;if(n){const a=this.getBundlerUrl(e.chainId,n);try{return await this.getUserOperationReceipt(a,e)}catch(c){console.warn("Failed to fetch call status from bundler",c,a)}}const o=(r=s.sessionProperties)==null?void 0:r.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,i){var r;const s=new URL(e),n=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(zt("eth_getUserOperationReceipt",[(r=i.request.params)==null?void 0:r[0]]))});if(!n.ok)throw new Error(`Failed to fetch user operation receipt - ${n.status}`);return await n.json()}
46getBundlerUrl(e,i){return`${Q2}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${i}`}}var zP=Object.defineProperty,VP=(t,e,i)=>e in t?zP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Pi=(t,e,i)=>VP(t,typeof e!="symbol"?e+"":e,i);class HP{constructor(e){Pi(this,"name","solana"),Pi(this,"client"),Pi(this,"httpProviders"),Pi(this,"events"),Pi(this,"namespace"),Pi(this,"chainId"),this.namespace=e.namespace,this.events=X("events"),this.client=X("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,i){this.httpProviders[e]||this.setHttpProvider(e,i),this.chainId=e,this.events.emit(nt.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(i=>{var r;const s=pi(i);e[s]=this.createHttpProvider(s,(r=this.namespace.rpcMap)==null?void 0:r[i])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,i=this.httpProviders[e];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return i}setHttpProvider(e,i){const r=this.createHttpProvider(e,i);r&&(this.httpProviders[e]=r)}createHttpProvider(e,i){const r=i||Ye(e,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new st(new pt(r,X("disableProviderPing")))}}var KP=Object.defineProperty,WP=(t,e,i)=>e in t?KP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,$i=(t,e,i)=>WP(t,typeof e!="symbol"?e+"":e,i);class GP{constructor(e){$i(this,"name","cosmos"),$i(this,"client"),$i(this,"httpProviders"),$i(this,"events"),$i(this,"namespace"),$i(this,"chainId"),this.namespace=e.namespace,this.events=X("events"),this.client=X("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,i){this.httpProviders[e]||this.setHttpProvider(e,i),this.chainId=e,this.events.emit(nt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(i=>{var r;const s=pi(i);e[s]=this.createHttpProvider(s,(r=this.namespace.rpcMap)==null?void 0:r[i])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,i=this.httpProviders[e];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return i}setHttpProvider(e,i){const r=this.createHttpProvider(e,i);r&&(this.httpProviders[e]=r)}createHttpProvider(e,i){const r=i||Ye(e,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new st(new pt(r,X("disableProviderPing")))}}var YP=Object.defineProperty,JP=(t,e,i)=>e in t?YP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ai=(t,e,i)=>JP(t,typeof e!="symbol"?e+"":e,i);class ZP{constructor(e){Ai(this,"name","algorand"),Ai(this,"client"),Ai(this,"httpProviders"),Ai(this,"events"),Ai(this,"namespace"),Ai(this,"chainId"),this.namespace=e.namespace,this.events=X("events"),this.client=X("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,i){if(!this.httpProviders[e]){const r=i||Ye(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.chainId=e,this.events.emit(nt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(i=>
46{var r;e[i]=this.createHttpProvider(i,(r=this.namespace.rpcMap)==null?void 0:r[i])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,i=this.httpProviders[e];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return i}setHttpProvider(e,i){const r=this.createHttpProvider(e,i);r&&(this.httpProviders[e]=r)}createHttpProvider(e,i){const r=i||Ye(e,this.namespace,this.client.core.projectId);return typeof r>"u"?void 0:new st(new pt(r,X("disableProviderPing")))}}var XP=Object.defineProperty,QP=(t,e,i)=>e in t?XP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,xi=(t,e,i)=>QP(t,typeof e!="symbol"?e+"":e,i);class e${constructor(e){xi(this,"name","cip34"),xi(this,"client"),xi(this,"httpProviders"),xi(this,"events"),xi(this,"namespace"),xi(this,"chainId"),this.namespace=e.namespace,this.events=X("events"),this.client=X("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,i){this.httpProviders[e]||this.setHttpProvider(e,i),this.chainId=e,this.events.emit(nt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(i=>{const r=this.getCardanoRPCUrl(i),s=pi(i);e[s]=this.createHttpProvider(s,r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,i=this.httpProviders[e];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return i}getCardanoRPCUrl(e){const i=this.namespace.rpcMap;if(i)return i[e]}setHttpProvider(e,i){const r=this.createHttpProvider(e,i);r&&(this.httpProviders[e]=r)}createHttpProvider(e,i){const r=i||this.getCardanoRPCUrl(e);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new st(new pt(r,X("disableProviderPing")))}}var t$=Object.defineProperty,i$=(t,e,i)=>e in t?t$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ci=(t,e,i)=>i$(t,typeof e!="symbol"?e+"":e,i);class r${constructor(e){Ci(this,"name","elrond"),Ci(this,"client"),Ci(this,"httpProviders"),Ci(this,"events"),Ci(this,"namespace"),Ci(this,"chainId"),this.namespace=e.namespace,this.events=X("events"),this.client=X("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,i){this.httpProviders[e]||this.setHttpProvider(e,i),this.chainId=e,this.events.emit(nt.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(i=>{var r;const s=pi(i);e[s]=this.createHttpProvider(s,(r=this.namespace.rpcMap)==null?void 0:r[i])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,i=this.httpProviders[e];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return i}setHttpProvider(e,i){const r=this.createHttpProvider(e,i);r&&(this.httpProviders[e]=r)}createHttpProvider(e,i){const r=i||Ye(e,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new st(new pt(r,X("disableProviderPing")))}}var s$=Object.defineProperty,n$=(t,e,i)=>e in t?s$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ri=(t,e,i)=>n$(t,typeof e!="symbol"?e+"":e,i);class o${constructor(e){Ri(this,"name","multiversx"),Ri(this,"client"),Ri(this,"httpProviders"),Ri(this,"events"),Ri(this,"namespace"),Ri(this,"chainId"),this.namespace=e.namespace,this.events=X("events"),this.client=X("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,i){this.httpProviders[e]||this.setHttpProvider(e,i),this.chainId=e,this.events.emit(nt.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(i=>
46{var r;const s=pi(i);e[s]=this.createHttpProvider(s,(r=this.namespace.rpcMap)==null?void 0:r[i])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,i=this.httpProviders[e];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return i}setHttpProvider(e,i){const r=this.createHttpProvider(e,i);r&&(this.httpProviders[e]=r)}createHttpProvider(e,i){const r=i||Ye(e,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new st(new pt(r,X("disableProviderPing")))}}var a$=Object.defineProperty,c$=(t,e,i)=>e in t?a$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ti=(t,e,i)=>c$(t,typeof e!="symbol"?e+"":e,i);class l${constructor(e){Ti(this,"name","near"),Ti(this,"client"),Ti(this,"httpProviders"),Ti(this,"events"),Ti(this,"namespace"),Ti(this,"chainId"),this.namespace=e.namespace,this.events=X("events"),this.client=X("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,i){if(this.chainId=e,!this.httpProviders[e]){const r=i||Ye(`${this.name}:${e}`,this.namespace);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.events.emit(nt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(i=>{var r;e[i]=this.createHttpProvider(i,(r=this.namespace.rpcMap)==null?void 0:r[i])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,i=this.httpProviders[e];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return i}setHttpProvider(e,i){const r=this.createHttpProvider(e,i);r&&(this.httpProviders[e]=r)}createHttpProvider(e,i){const r=i||Ye(e,this.namespace);return typeof r>"u"?void 0:new st(new pt(r,X("disableProviderPing")))}}var h$=Object.defineProperty,u$=(t,e,i)=>e in t?h$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ni=(t,e,i)=>u$(t,typeof e!="symbol"?e+"":e,i);class d${constructor(e){Ni(this,"name","tezos"),Ni(this,"client"),Ni(this,"httpProviders"),Ni(this,"events"),Ni(this,"namespace"),Ni(this,"chainId"),this.namespace=e.namespace,this.events=X("events"),this.client=X("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,i){if(this.chainId=e,!this.httpProviders[e]){const r=i||Ye(`${this.name}:${e}`,this.namespace);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.events.emit(nt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(i=>{e[i]=this.createHttpProvider(i)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,i=this.httpProviders[e];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return i}setHttpProvider(e,i){const r=this.createHttpProvider(e,i);r&&(this.httpProviders[e]=r)}createHttpProvider(e,i){const r=i||Ye(e,this.namespace);return typeof r>"u"?void 0:new st(new pt(r))}}var p$=Object.defineProperty,f$=(t,e,i)=>e in t?p$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Li=(t,e,i)=>f$(t,typeof e!="symbol"?e+"":e,i);class g${constructor(e){Li(this,"name",ji),Li(this,"client"),Li(this,"httpProviders"),Li(this,"events"),Li(this,"namespace"),Li(this,"chainId"),this.namespace=e.namespace,this.events=X("events"),this.client=X("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,i){this.httpProviders[e]||this.setHttpProvider(e,i),this.chainId=e,this.events.emit(nt.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}createHttpProviders(){var e,i;const r={};return(i=(e=this.namespace)==null?void 0:e.accounts)==null||i.forEac
46h(s=>{const n=Fi(s);r[`${n.namespace}:${n.reference}`]=this.createHttpProvider(s)}),r}getHttpProvider(e){const i=this.httpProviders[e];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return i}setHttpProvider(e,i){const r=this.createHttpProvider(e,i);r&&(this.httpProviders[e]=r)}createHttpProvider(e,i){const r=i||Ye(e,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new st(new pt(r,X("disableProviderPing")))}}var y$=Object.defineProperty,m$=Object.defineProperties,w$=Object.getOwnPropertyDescriptors,sh=Object.getOwnPropertySymbols,b$=Object.prototype.hasOwnProperty,v$=Object.prototype.propertyIsEnumerable,xo=(t,e,i)=>e in t?y$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,as=(t,e)=>{for(var i in e||(e={}))b$.call(e,i)&&xo(t,i,e[i]);if(sh)for(var i of sh(e))v$.call(e,i)&&xo(t,i,e[i]);return t},Mn=(t,e)=>m$(t,w$(e)),et=(t,e,i)=>xo(t,typeof e!="symbol"?e+"":e,i);let _$=class Bd{constructor(e){et(this,"client"),et(this,"namespaces"),et(this,"optionalNamespaces"),et(this,"sessionProperties"),et(this,"scopedProperties"),et(this,"events",new No),et(this,"rpcProviders",{}),et(this,"session"),et(this,"providerOpts"),et(this,"logger"),et(this,"uri"),et(this,"disableProviderPing",!1),this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Vr(zs({level:(e==null?void 0:e.logger)||Kl})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const i=new Bd(e);return await i.initialize(),i}async request(e,i,r){const[s,n]=this.validateChain(i);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:as({},e),chainId:`${s}:${n}`,topic:this.session.topic,expiry:r})}sendAsync(e,i,r,s){const n=new Date().getTime();this.request(e,r,s).then(o=>i(null,Vs(n,o))).catch(o=>i(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:te("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,i){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:r,response:s}=await this.client.authenticate(e,i);r&&(this.uri=r,this.events.emit("display_uri",r));const n=await s();if(this.session=n.session,this.session){const o=eh(this.session.namespaces);this.namespaces=Ln(this.namespaces,o),await this.persist("namespaces",this.namespaces),this.onConnect()}return n}on(e,i){this.events.on(e,i)}
vendor: 5,189 bytes, line 46
46once(e,i){this.events.once(e,i)}removeListener(e,i){this.events.removeListener(e,i)}off(e,i){this.events.off(e,i)}get isWalletConnect(){return!0}async pair(e){const{uri:i,approval:r}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties});i&&(this.uri=i,this.events.emit("display_uri",i));const s=await r();this.session=s;const n=eh(s.namespaces);return this.namespaces=Ln(this.namespaces,n),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(e,i){try{if(!this.session)return;const[r,s]=this.validateChain(e),n=this.getProvider(r);n.name===ji?n.setDefaultChain(`${r}:${s}`,i):n.setDefaultChain(s,i)}catch(r){if(!/Please call connect/.test(r.message))throw r}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const i=this.client.pairing.getAll();if(dt(i)){for(const r of i)e.deletePairings?this.client.core.expirer.set(r.topic,0):await this.client.core.relayer.subscriber.unsubscribe(r.topic);this.logger.info(`Inactive pairings cleared: ${i.length}`)}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var e,i;if(this.client=this.providerOpts.client||await F2.init({core:this.providerOpts.core,logger:this.providerOpts.logger||Kl,relayUrl:this.providerOpts.relayUrl||J2,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(r){throw this.logger.error("Failed to get session",r),new Error(`The provided session: ${(i=(e=this.providerOpts)==null?void 0:e.session)==null?void 0:i.topic} doesn't exist in the Sign client`)}else{const r=this.client.session.getAll();this.session=r[0]}this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(i=>gr(i)))];jn("client",this.client),jn("events",this.events),jn("disableProviderPing",this.disableProviderPing),e.forEach(i=>{if(!this.session)return;const r=NP(i,this.session),s=Md(r),n=Ln(this.namespaces,this.optionalNamespaces),o=Mn(as({},n[i]),{accounts:r,chains:s});switch(i){case"eip155":this.rpcProviders[i]=new qP({namespace:o});break;case"algorand":this.rpcProviders[i]=new ZP({namespace:o});break;case"solana":this.rpcProviders[i]=new HP({namespace:o});break;case"cosmos":this.rpcProviders[i]=new GP({namespace:o});break;case"polkadot":this.rpcProviders[i]=new jP({namespace:o});break;case"cip34":this.rpcProviders[i]=new e$({namespace:o});break;case"elrond":this.rpcProviders[i]=new r$({namespace:o});break;case"multiversx":this.rpcProviders[i]=new o$({namespace:o});break;case"near":this.rpcProviders[i]=new l$({namespace:o});break;case"tezos":this.rpcProviders[i]=new d$({namespace:o});break;default:this.rpcProviders[ji]?this.rpcProviders[ji].updateNamespace(o):this.rpcProviders[ji]=new g$({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{var i;const{topic:r}=e;r===((i=this.session)==null?void 0:i.topic)&&this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{var i;const{params:r,topic:s}=e;if(s!==((i=this.session)==null?void 0:i.topic))return;const{event:n}=r;if(n.name==="accountsChanged"){const o=n.data;o&&dt(o)&&this.events.emit("accountsChanged",o.map(Ql))}else if(n.name==="chainChanged"){const o=r.chainId,a=r.event.data,c=gr(o),l=Dn(o)!==Dn(a)?`${c}:${Dn(a)}`:o;this.onChainChanged(l)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:i})=>{var r,s;if(e!==((r=this.session)==null?void 0:r.topic))return;const{namespaces:n}=i,o=(s=this.client)==null?void 0:s.session.get(e);this.session=Mn(as({},o),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:i})}),this.client.on("session_delete",async e=>{var i;e.topic===((i=this.session)==null?void 0:i.topic)&&(await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",Mn(as({},te("USER_DISCONNECTED")),{data:e.topic})))}),this.on(nt.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[ji]}
46onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var i;this.getProvider(e).updateNamespace((i=this.session)==null?void 0:i.namespaces[e])})}setNamespaces(e){const{namespaces:i,optionalNamespaces:r,sessionProperties:s,scopedProperties:n}=e;i&&Object.keys(i).length&&(this.namespaces=i),r&&Object.keys(r).length&&(this.optionalNamespaces=r),this.sessionProperties=s,this.scopedProperties=n}validateChain(e){const[i,r]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[i,r];if(i&&!Object.keys(this.namespaces||{}).map(o=>gr(o)).includes(i))throw new Error(`Namespace '${i}' is not configured. Please call connect() first with namespace config.`);if(i&&r)return[i,r];const s=gr(Object.keys(this.namespaces)[0]),n=this.rpcProviders[s].getDefaultChain();return[s,n]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}async onChainChanged(e,i=!1){if(!this.namespaces)return;const[r,s]=this.validateChain(e);if(!s)return;this.updateNamespaceChain(r,s),this.events.emit("chainChanged",s);const n=this.getProvider(r).getDefaultChain();i||this.getProvider(r).setDefaultChain(s),this.emitAccountsChangedOnChainChange({namespace:r,previousChainId:n,newChainId:e}),await this.persist("namespaces",this.namespaces)}emitAccountsChangedOnChainChange({namespace:e,previousChainId:i,newChainId:r}){var s,n;try{if(i===r)return;const o=(n=(s=this.session)==null?void 0:s.namespaces[e])==null?void 0:n.accounts;if(!o)return;const a=o.filter(c=>c.includes(`${r}:`)).map(Ql);if(!dt(a))return;this.events.emit("accountsChanged",a)}catch(o){this.logger.warn("Failed to emit accountsChanged on chain change",o)}}updateNamespaceChain(e,i){if(!this.namespaces)return;const r=this.namespaces[e]?e:`${e}:${i}`,s={chains:[],methods:[],events:[],defaultChain:i};this.namespaces[r]?this.namespaces[r]&&(this.namespaces[r].defaultChain=i):this.namespaces[r]=s}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,await this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(e,i){var r;const s=((r=this.session)==null?void 0:r.topic)||"";await this.client.core.storage.setItem(`${ns}/${e}${s}`,i)}async getFromStore(e){var i;const r=((i=this.session)==null?void 0:i.topic)||"";return await this.client.core.storage.getItem(`${ns}/${e}${r}`)}async deleteFromStore(e){var i;const r=((i=this.session)==null?void 0:i.topic)||"";await this.client.core.storage.removeItem(`${ns}/${e}${r}`)}async cleanupStorage(){var e;try{if(((e=this.client)==null?void 0:e.session.length)>0)return;const i=await this.client.core.storage.getKeys();for(const r of i)r.startsWith(ns)&&await this.client.core.storage.removeItem(r)}catch(i){this.logger.warn("Failed to cleanup storage",i)}}};const E$=_$,I$="wc",S$="ethereum_provider",O$=`${I$}@2:${S$}:`,P$="https://rpc.walletconnect.org/v1/",$s=["eth_sendTransaction","personal_sign"],kd=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],As=["chainChanged","accountsChanged"],Fd=["chainChanged","accountsChanged","message","disconnect","connect"];var $$=Object.defineProperty,A$=Object.defineProperties,x$=Object.getOwnPropertyDescriptors,nh=Object.getOwnPropertySymbols,C$=Object.prototype.hasOwnProperty,R$=Object.prototype.propertyIsEnumerable,Co=(t,e,i)=>e in t?$$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Mi=(t,e)=>{for(var i in e||(e={}))C$.call(e,i)&&Co(t,i,e[i]);if(nh)for(var i of nh(e))R$.call(e,i)&&Co(t,i,e[i]);return t},Un=(t,e)=>A$(t,x$(e)),Ve=(t,e,i)=>Co(t,typeof e!="symbol"?e+"":e,i);function xs(t){return Number(t[0].split(":")[1])}function cs(t){return`0x${t.toString(16)}`}function T$(t){const{chains:e,optionalChains:i,methods:r,optionalMethods:s,events:n,optionalEvents:o,rpcMap:a}=t;if(!dt(e))throw new Error("Invalid chains");const c={chains:e,methods:r||$s,events:n||As,rpcMap:Mi({},e.length?{[xs(e)]:a[xs(e)]}:{})},l=n==null?void 0:n.filter(f=>!As.includes(f)),h=r==null?void 0:r.filter(f=>!$s.includes(f));if(!i&&!o&&!s&&!(l!=null&&l.length)&&!(h!=null&&h.length))return{required:e.length?c:void 0};const u=(l==null?void 0:l.length)&&(h==null?void 0:h.length)||!i,d={chains:[...new Set(u?c.chains.concat(i||[]):i)],methods:[...new Set(c.methods.concat(s!=null&&s.length?s:kd))],events:[...new Set(c.events.concat(o!=null&&o.length?o:Fd))],rpcMap:a};return{required:e.length?c:void 0,optional:i.length?d:void 0}}class Ys{constructor(){Ve(this,"events",new Je.EventEmitter),Ve(this,"namespace","eip155"),Ve(this,"accounts",[]),Ve(this,"signer"),Ve(this,"chainId",1),Ve(this,"modal"),Ve(this,"rpc"),Ve(this,"STORAGE_KEY",O$),Ve(this,"on",(e,i)=>(this.events.on(e,i),this)),Ve(this,"once",(e,i)=>(this.events.once(e,i),this)),Ve(this,"removeListener",(e,i)=>(this.events.removeListener(e,i),this)),Ve(this,"off",(e,i)=>(this.events.off(e,i),this)),Ve(this,"parseAccount",e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e),this.signer={},this.rpc={}}static async init(e){const i=new Ys;return await i.initialize(e),i}async request(e,i){return await this.signer.request(e,this.formatChainId(this.chainId),i)}sendAsync(e,i,r){this.signer.sendAsync(e,i,this.formatChainId(this.chainId),r)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:i,optional:r}=T$(this.rpc);try{const s=await new Promise(async(o,a)=>{var c;this.rpc.showQrModal&&((c=this.modal)==null||c.subscribeModal(h=>{!h.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))}));const l=e!=null&&e.scopedProperties?{[this.namespace]:e.scopedProperties}:void 0;await this.signer.connect(Un(Mi({namespaces:Mi({},i&&{[this.namespace]:i})},r&&{optionalNamespaces:{[this.namespace]:r}}),{pairingTopic:e==null?void 0:e.pairingTopic,scopedProperties:l})).then(h=>{o(h)}).catch(h=>{a(new Error(h.message))})});if(!s)return;const n=rc(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:n),this.setAccounts(n),this.events.emit("connect",{chainId:cs(this.chainId)})}catch(s){throw this.signer.logger.error(s),s}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,i){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const r=await new Promise(async(n,o)=>{var a;this.rpc.showQrModal&&((a=this.modal)==null||a.subscribeModal(c=>{!c.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),o(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(Un(Mi({},e),{chains:this.rpc.chains}),i).then(c=>{n(c)}).catch(c=>{o(new Error(c.message))})}),s=r.session;if(s){const n=rc(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:n),this.setAccounts(n),this.events.emit("connect",{chainId:cs(this.chainId)})}return r}catch(r){throw this.signer.logger.error(r),r}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:i}=e,{event:r}=i;r.name==="accountsChanged"?(this.accounts=this.parseAccounts(r.data),this.events.emit("accountsChanged",this.accounts)):r.name==="chainChanged"?this.setChainId(this.formatChainId(r.data)):this.events.emit(r.name,r.data),this.events.emit("session_event",e)}),this.signer.on("accountsChanged",e=>{this.accounts=this.parseAccounts(e),this.events.emit("accountsChanged",this.accounts)}),this.signer.on("chainChanged",e=>{const i=parseInt(e);this.chainId=i,this.events.emit("chainChanged",cs(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",Un(Mi({},te("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var i,r;this.rpc.showQrModal&&((i=this.modal)==null||i.closeModal(),(r=this.modal)==null||r.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const i=e.filter(r=>this.isCompatibleChainId(r)).map(r=>this.parseChainId(r));i.length&&(this.chainId=i[0],this.events.emit("chainChanged",cs(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const i=this.parseChainId(e);this.chainId=i,this.switchEthereumChain(i)}}parseAccountId(e){const[i,r,s]=e.split(":");return{chainId:`${i}:${r}`,address:s}}setAccounts(e){this.accounts=e.filter(i=>this.parseChainId(this.parseAccountId(i).chainId)===this.chainId).map(i=>this.parseAccountId(i).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var i,r;const s=(i=e==null?void 0:e.chains)!=null?i:[],n=(r=e==null?void 0:e.optionalChains)!=null?r:[],o=s.concat(n);if(!o.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const a=s.length?(e==null?void 0:e.methods)||$s:[],c=s.length?(e==null?void 0:e.events)||As:[],l=(e==null?void 0:e.optionalMethods)||[],h=(e==null?void 0:e.optionalEvents)||[],u=(e==null?void 0:e.rpcMap)||this.buildRpcMap(o,e.projectId),d=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:s==null?void 0:s.map(f=>this.formatChainId(f)),optionalChains:n.map(f=>this.formatChainId(f)),methods:a,events:c,optionalMethods:l,optionalEvents:h,rpcMap:u,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:d,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,i){const r={};return e.forEach(s=>{r[s]=this.getRpcUrl(s,i)}),r}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?xs(this.rpc.chains):xs(this.rpc.optionalChains),this.signer=await E$.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storage:e.storage,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled,logger:e.logger}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let i;
46try{const{WalletConnectModal:r}=await ah(()=>import("./index-1_77FnWD.js").then(s=>s.i),__vite__mapDeps([3,1,2]));i=r}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(i)try{this.modal=new i(Mi({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(r){throw this.signer.logger.error(r),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:i,optionalChains:r,rpcMap:s}=e;i&&dt(i)&&(this.rpc.chains=i.map(n=>this.formatChainId(n)),i.forEach(n=>{this.rpc.rpcMap[n]=(s==null?void 0:s[n])||this.getRpcUrl(n)})),r&&dt(r)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=r==null?void 0:r.map(n=>this.formatChainId(n)),r.forEach(n=>{this.rpc.rpcMap[n]=(s==null?void 0:s[n])||this.getRpcUrl(n)}))}getRpcUrl(e,i){var r;return((r=this.rpc.rpcMap)==null?void 0:r[e])||`${P$}?chainId=eip155:${e}&projectId=${i||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),i=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:i==null?void 0:i.accounts),this.setAccounts(i==null?void 0:i.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(i=>this.signer.logger.warn(i))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(i=>this.parseAccount(i))}}const N$=Ys,IA=Object.freeze(Object.defineProperty({__proto__:null,EthereumProvider:N$,OPTIONAL_EVENTS:Fd,OPTIONAL_METHODS:kd,REQUIRED_EVENTS:As,REQUIRED_METHODS:$s,default:Ys},Symbol.toStringTag,{value:"Module"}));export{Of as H,xa as a,gf as b,j$ as c,D$ as d,Ts as e,B$ as f,U$ as g,IA as i,M$ as r,$h as t,Pf as w};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.