@hashgraphonline/hashinal-wc 1.0.95 → 1.0.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -103,7 +103,7 @@ function utilFromBase(e,t){let r=0;if(1===e.length)return e[0];for(let n=e.lengt
|
|
|
103
103
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
104
104
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
105
105
|
PERFORMANCE OF THIS SOFTWARE.
|
|
106
|
-
***************************************************************************** */function __extends(e,t){function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var __assign=function(){return __assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},__assign.apply(this,arguments)};function __rest(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}function __decorate(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function __param(e,t){return function(r,n){t(r,n,e)}}function __metadata(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function __awaiter(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e2){i(e2)}}function s(e){try{c(n.throw(e))}catch(e2){i(e2)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function __generator(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e2){i=[6,e2],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function __createBinding(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}function __exportStar(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||(t[r]=e[r])}function __values(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(s){o={error:s}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}function __spreadArrays$1(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function __await(e){return this instanceof __await?(this.v=e,this):new __await(e)}function __asyncGenerator(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),i=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){i.push([e,t,r,n])>1||s(e,t)}))})}function s(e,t){try{(r=o[e](t)).value instanceof __await?Promise.resolve(r.value.v).then(c,u):l(i[0][2],r)}catch(e2){l(i[0][3],e2)}var r}function c(e){s("next",e)}function u(e){s("throw",e)}function l(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function __asyncDelegator(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:__await(e[n](t)),done:"return"===n}:o?o(t):t}:o}}function __asyncValues(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,o,(t=e[r](t)).done,t.value)}))}}}function __makeTemplateObject(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function __importStar(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function __importDefault(e){return e&&e.__esModule?e:{default:e}}function __classPrivateFieldGet(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function __classPrivateFieldSet(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r}const tslib_es6=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return __assign},__asyncDelegator:__asyncDelegator,__asyncGenerator:__asyncGenerator,__asyncValues:__asyncValues,__await:__await,__awaiter:__awaiter,__classPrivateFieldGet:__classPrivateFieldGet,__classPrivateFieldSet:__classPrivateFieldSet,__createBinding:__createBinding,__decorate:__decorate,__exportStar:__exportStar,__extends:__extends,__generator:__generator,__importDefault:__importDefault,__importStar:__importStar,__makeTemplateObject:__makeTemplateObject,__metadata:__metadata,__param:__param,__read:__read,__rest:__rest,__spread:__spread,__spreadArrays:__spreadArrays$1,__values:__values},Symbol.toStringTag,{value:"Module"})),require$$0$4=getAugmentedNamespace(tslib_es6);var utils$q={},delay={},hasRequiredDelay;function requireDelay(){if(hasRequiredDelay)return delay;return hasRequiredDelay=1,Object.defineProperty(delay,"__esModule",{value:!0}),delay.delay=void 0,delay.delay=function(e){return new Promise((t=>{setTimeout((()=>{t(!0)}),e)}))},delay}var convert={},constants={},misc={},hasRequiredMisc;function requireMisc(){return hasRequiredMisc||(hasRequiredMisc=1,Object.defineProperty(misc,"__esModule",{value:!0}),misc.ONE_THOUSAND=misc.ONE_HUNDRED=void 0,misc.ONE_HUNDRED=100,misc.ONE_THOUSAND=1e3),misc}var time$1={},hasRequiredTime,hasRequiredConstants,hasRequiredConvert,hasRequiredUtils;function requireTime(){return hasRequiredTime||(hasRequiredTime=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ONE_YEAR=e.FOUR_WEEKS=e.THREE_WEEKS=e.TWO_WEEKS=e.ONE_WEEK=e.THIRTY_DAYS=e.SEVEN_DAYS=e.FIVE_DAYS=e.THREE_DAYS=e.ONE_DAY=e.TWENTY_FOUR_HOURS=e.TWELVE_HOURS=e.SIX_HOURS=e.THREE_HOURS=e.ONE_HOUR=e.SIXTY_MINUTES=e.THIRTY_MINUTES=e.TEN_MINUTES=e.FIVE_MINUTES=e.ONE_MINUTE=e.SIXTY_SECONDS=e.THIRTY_SECONDS=e.TEN_SECONDS=e.FIVE_SECONDS=e.ONE_SECOND=void 0,e.ONE_SECOND=1,e.FIVE_SECONDS=5,e.TEN_SECONDS=10,e.THIRTY_SECONDS=30,e.SIXTY_SECONDS=60,e.ONE_MINUTE=e.SIXTY_SECONDS,e.FIVE_MINUTES=5*e.ONE_MINUTE,e.TEN_MINUTES=10*e.ONE_MINUTE,e.THIRTY_MINUTES=30*e.ONE_MINUTE,e.SIXTY_MINUTES=60*e.ONE_MINUTE,e.ONE_HOUR=e.SIXTY_MINUTES,e.THREE_HOURS=3*e.ONE_HOUR,e.SIX_HOURS=6*e.ONE_HOUR,e.TWELVE_HOURS=12*e.ONE_HOUR,e.TWENTY_FOUR_HOURS=24*e.ONE_HOUR,e.ONE_DAY=e.TWENTY_FOUR_HOURS,e.THREE_DAYS=3*e.ONE_DAY,e.FIVE_DAYS=5*e.ONE_DAY,e.SEVEN_DAYS=7*e.ONE_DAY,e.THIRTY_DAYS=30*e.ONE_DAY,e.ONE_WEEK=e.SEVEN_DAYS,e.TWO_WEEKS=2*e.ONE_WEEK,e.THREE_WEEKS=3*e.ONE_WEEK,e.FOUR_WEEKS=4*e.ONE_WEEK,e.ONE_YEAR=365*e.ONE_DAY}(time$1)),time$1}function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=require$$0$4;t.__exportStar(requireMisc(),e),t.__exportStar(requireTime(),e)}(constants)),constants}function requireConvert(){if(hasRequiredConvert)return convert;hasRequiredConvert=1,Object.defineProperty(convert,"__esModule",{value:!0}),convert.fromMiliseconds=convert.toMiliseconds=void 0;const e=requireConstants();return convert.toMiliseconds=function(t){return t*e.ONE_THOUSAND},convert.fromMiliseconds=function(t){return Math.floor(t/e.ONE_THOUSAND)},convert}function requireUtils(){return hasRequiredUtils||(hasRequiredUtils=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=require$$0$4;t.__exportStar(requireDelay(),e),t.__exportStar(requireConvert(),e)}(utils$q)),utils$q}var watch$2={},hasRequiredWatch$1;function requireWatch$1(){if(hasRequiredWatch$1)return watch$2;hasRequiredWatch$1=1,Object.defineProperty(watch$2,"__esModule",{value:!0}),watch$2.Watch=void 0;class e{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){const t=this.get(e);if(void 0!==t.elapsed)throw new Error(`Watch already stopped for label: ${e}`);const r=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:r})}get(e){const t=this.timestamps.get(e);if(void 0===t)throw new Error(`No timestamp found for label: ${e}`);return t}elapsed(e){const t=this.get(e);return t.elapsed||Date.now()-t.started}}return watch$2.Watch=e,watch$2.default=e,watch$2}var types={},watch$1={},hasRequiredWatch,hasRequiredTypes;function requireWatch(){if(hasRequiredWatch)return watch$1;hasRequiredWatch=1,Object.defineProperty(watch$1,"__esModule",{value:!0}),watch$1.IWatch=void 0;return watch$1.IWatch=class{},watch$1}function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});require$$0$4.__exportStar(requireWatch(),e)}(types)),types}!function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=require$$0$4;t.__exportStar(requireUtils(),e),t.__exportStar(requireWatch$1(),e),t.__exportStar(requireTypes(),e),t.__exportStar(requireConstants(),e)}(cjs$7);class IEvents{}let n$a=class extends IEvents{constructor(e){super()}};const s$7=cjs$7.FIVE_SECONDS,r$6={pulse:"heartbeat_pulse"};let i$7=class e extends n$a{constructor(e){super(e),this.events=new eventsExports.EventEmitter,this.interval=s$7,this.interval=(null==e?void 0:e.interval)||s$7}static async init(t){const r=new e(t);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval((()=>this.pulse()),cjs$7.toMiliseconds(this.interval))}pulse(){this.events.emit(r$6.pulse)}};const suspectProtoRx=/"(?:_|\\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*:/,suspectConstructorRx=/"(?: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*:/,JsonSigRx=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function jsonParseTransform(e,t){if(!("__proto__"===e||"constructor"===e&&t&&"object"==typeof t&&"prototype"in t))return t;warnKeyDropped(e)}function warnKeyDropped(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}function destr(e,t={}){if("string"!=typeof e)return e;const r=e.trim();if('"'===e[0]&&e.endsWith('"')&&!e.includes("\\"))return r.slice(1,-1);if(r.length<=9){const e=r.toLowerCase();if("true"===e)return!0;if("false"===e)return!1;if("undefined"===e)return;if("null"===e)return null;if("nan"===e)return Number.NaN;if("infinity"===e)return Number.POSITIVE_INFINITY;if("-infinity"===e)return Number.NEGATIVE_INFINITY}if(!JsonSigRx.test(e)){if(t.strict)throw new SyntaxError("[destr] Invalid JSON");return e}try{if(suspectProtoRx.test(e)||suspectConstructorRx.test(e)){if(t.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(e,jsonParseTransform)}return JSON.parse(e)}catch(n){if(t.strict)throw n;return e}}function wrapToPromise(e){return e&&"function"==typeof e.then?e:Promise.resolve(e)}function asyncCall(e,...t){try{return wrapToPromise(e(...t))}catch(r){return Promise.reject(r)}}function isPrimitive(e){const t=typeof e;return null===e||"object"!==t&&"function"!==t}function isPureObject(e){const t=Object.getPrototypeOf(e);return!t||t.isPrototypeOf(Object)}function stringify(e){if(isPrimitive(e))return String(e);if(isPureObject(e)||Array.isArray(e))return JSON.stringify(e);if("function"==typeof e.toJSON)return stringify(e.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const BASE64_PREFIX="base64:";function serializeRaw(e){return"string"==typeof e?e:BASE64_PREFIX+base64Encode(e)}function deserializeRaw(e){return"string"!=typeof e?e:e.startsWith(BASE64_PREFIX)?base64Decode(e.slice(BASE64_PREFIX.length)):e}function base64Decode(e){return globalThis.Buffer?Buffer$2.from(e,"base64"):Uint8Array.from(globalThis.atob(e),(e=>e.codePointAt(0)))}function base64Encode(e){return globalThis.Buffer?Buffer$2.from(e).toString("base64"):globalThis.btoa(String.fromCodePoint(...e))}function normalizeKey(e){var t;return e&&(null==(t=e.split("?")[0])?void 0:t.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function joinKeys(...e){return normalizeKey(e.join(":"))}function normalizeBaseKey(e){return(e=normalizeKey(e))?e+":":""}function defineDriver(e){return e}const DRIVER_NAME="memory",memory=defineDriver((()=>{const e=new Map;return{name:DRIVER_NAME,getInstance:()=>e,hasItem:t=>e.has(t),getItem:t=>e.get(t)??null,getItemRaw:t=>e.get(t)??null,setItem(t,r){e.set(t,r)},setItemRaw(t,r){e.set(t,r)},removeItem(t){e.delete(t)},getKeys:()=>[...e.keys()],clear(){e.clear()},dispose(){e.clear()}}}));function createStorage(e={}){const t={mounts:{"":e.driver||memory()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=e=>{for(const r of t.mountpoints)if(e.startsWith(r))return{base:r,relativeKey:e.slice(r.length),driver:t.mounts[r]};return{base:"",relativeKey:e,driver:t.mounts[""]}},n=(e,r)=>t.mountpoints.filter((t=>t.startsWith(e)||r&&e.startsWith(t))).map((r=>({relativeBase:e.length>r.length?e.slice(r.length):void 0,mountpoint:r,driver:t.mounts[r]}))),o=(e,r)=>{if(t.watching){r=normalizeKey(r);for(const n of t.watchListeners)n(e,r)}},i=async()=>{if(t.watching){for(const e in t.unwatch)await t.unwatch[e]();t.unwatch={},t.watching=!1}},a=(e,t,n)=>{const o=new Map,i=e=>{let t=o.get(e.base);return t||(t={driver:e.driver,base:e.base,items:[]},o.set(e.base,t)),t};for(const a of e){const e="string"==typeof a,n=normalizeKey(e?a:a.key),o=e?void 0:a.value,s=e||!a.options?t:{...t,...a.options},c=r(n);i(c).items.push({key:n,value:o,relativeKey:c.relativeKey,options:s})}return Promise.all([...o.values()].map((e=>n(e)))).then((e=>e.flat()))},s={hasItem(e,t={}){e=normalizeKey(e);const{relativeKey:n,driver:o}=r(e);return asyncCall(o.hasItem,n,t)},getItem(e,t={}){e=normalizeKey(e);const{relativeKey:n,driver:o}=r(e);return asyncCall(o.getItem,n,t).then((e=>destr(e)))},getItems:(e,t={})=>a(e,t,(e=>e.driver.getItems?asyncCall(e.driver.getItems,e.items.map((e=>({key:e.relativeKey,options:e.options}))),t).then((t=>t.map((t=>({key:joinKeys(e.base,t.key),value:destr(t.value)}))))):Promise.all(e.items.map((t=>asyncCall(e.driver.getItem,t.relativeKey,t.options).then((e=>({key:t.key,value:destr(e)})))))))),getItemRaw(e,t={}){e=normalizeKey(e);const{relativeKey:n,driver:o}=r(e);return o.getItemRaw?asyncCall(o.getItemRaw,n,t):asyncCall(o.getItem,n,t).then((e=>deserializeRaw(e)))},async setItem(e,t,n={}){if(void 0===t)return s.removeItem(e);e=normalizeKey(e);const{relativeKey:i,driver:a}=r(e);a.setItem&&(await asyncCall(a.setItem,i,stringify(t),n),a.watch||o("update",e))},async setItems(e,t){await a(e,t,(async e=>{if(e.driver.setItems)return asyncCall(e.driver.setItems,e.items.map((e=>({key:e.relativeKey,value:stringify(e.value),options:e.options}))),t);e.driver.setItem&&await Promise.all(e.items.map((t=>asyncCall(e.driver.setItem,t.relativeKey,stringify(t.value),t.options))))}))},async setItemRaw(e,t,n={}){if(void 0===t)return s.removeItem(e,n);e=normalizeKey(e);const{relativeKey:i,driver:a}=r(e);if(a.setItemRaw)await asyncCall(a.setItemRaw,i,t,n);else{if(!a.setItem)return;await asyncCall(a.setItem,i,serializeRaw(t),n)}a.watch||o("update",e)},async removeItem(e,t={}){"boolean"==typeof t&&(t={removeMeta:t}),e=normalizeKey(e);const{relativeKey:n,driver:i}=r(e);i.removeItem&&(await asyncCall(i.removeItem,n,t),(t.removeMeta||t.removeMata)&&await asyncCall(i.removeItem,n+"$",t),i.watch||o("remove",e))},async getMeta(e,t={}){"boolean"==typeof t&&(t={nativeOnly:t}),e=normalizeKey(e);const{relativeKey:n,driver:o}=r(e),i=Object.create(null);if(o.getMeta&&Object.assign(i,await asyncCall(o.getMeta,n,t)),!t.nativeOnly){const e=await asyncCall(o.getItem,n+"$",t).then((e=>destr(e)));e&&"object"==typeof e&&("string"==typeof e.atime&&(e.atime=new Date(e.atime)),"string"==typeof e.mtime&&(e.mtime=new Date(e.mtime)),Object.assign(i,e))}return i},setMeta(e,t,r={}){return this.setItem(e+"$",t,r)},removeMeta(e,t={}){return this.removeItem(e+"$",t)},async getKeys(e,t={}){e=normalizeBaseKey(e);const r=n(e,!0);let o=[];const i=[];for(const n of r){const e=await asyncCall(n.driver.getKeys,n.relativeBase,t);for(const t of e){const e=n.mountpoint+normalizeKey(t);o.some((t=>e.startsWith(t)))||i.push(e)}o=[n.mountpoint,...o.filter((e=>!e.startsWith(n.mountpoint)))]}return e?i.filter((t=>t.startsWith(e)&&"$"!==t[t.length-1])):i.filter((e=>"$"!==e[e.length-1]))},async clear(e,t={}){e=normalizeBaseKey(e),await Promise.all(n(e,!1).map((async e=>{if(e.driver.clear)return asyncCall(e.driver.clear,e.relativeBase,t);if(e.driver.removeItem){const r=await e.driver.getKeys(e.relativeBase||"",t);return Promise.all(r.map((r=>e.driver.removeItem(r,t))))}})))},async dispose(){await Promise.all(Object.values(t.mounts).map((e=>dispose(e))))},watch:async e=>(await(async()=>{if(!t.watching){t.watching=!0;for(const e in t.mounts)t.unwatch[e]=await watch(t.mounts[e],o,e)}})(),t.watchListeners.push(e),async()=>{t.watchListeners=t.watchListeners.filter((t=>t!==e)),0===t.watchListeners.length&&await i()}),async unwatch(){t.watchListeners=[],await i()},mount(e,r){if((e=normalizeBaseKey(e))&&t.mounts[e])throw new Error(`already mounted at ${e}`);return e&&(t.mountpoints.push(e),t.mountpoints.sort(((e,t)=>t.length-e.length))),t.mounts[e]=r,t.watching&&Promise.resolve(watch(r,o,e)).then((r=>{t.unwatch[e]=r})).catch(console.error),s},async unmount(e,r=!0){var n,o;(e=normalizeBaseKey(e))&&t.mounts[e]&&(t.watching&&e in t.unwatch&&(null==(o=(n=t.unwatch)[e])||o.call(n),delete t.unwatch[e]),r&&await dispose(t.mounts[e]),t.mountpoints=t.mountpoints.filter((t=>t!==e)),delete t.mounts[e])},getMount(e=""){e=normalizeKey(e)+":";const t=r(e);return{driver:t.driver,base:t.base}},getMounts(e="",t={}){e=normalizeKey(e);return n(e,t.parents).map((e=>({driver:e.driver,base:e.mountpoint})))},keys:(e,t={})=>s.getKeys(e,t),get:(e,t={})=>s.getItem(e,t),set:(e,t,r={})=>s.setItem(e,t,r),has:(e,t={})=>s.hasItem(e,t),del:(e,t={})=>s.removeItem(e,t),remove:(e,t={})=>s.removeItem(e,t)};return s}function watch(e,t,r){return e.watch?e.watch(((e,n)=>t(e,r+n))):()=>{}}async function dispose(e){"function"==typeof e.dispose&&await asyncCall(e.dispose)}function promisifyRequest(e){return new Promise(((t,r)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>r(e.error)}))}function createStore(e,t){const r=indexedDB.open(e);r.onupgradeneeded=()=>r.result.createObjectStore(t);const n=promisifyRequest(r);return(e,r)=>n.then((n=>r(n.transaction(t,e).objectStore(t))))}let defaultGetStoreFunc;function defaultGetStore(){return defaultGetStoreFunc||(defaultGetStoreFunc=createStore("keyval-store","keyval")),defaultGetStoreFunc}function get(e,t=defaultGetStore()){return t("readonly",(t=>promisifyRequest(t.get(e))))}function set$1(e,t,r=defaultGetStore()){return r("readwrite",(r=>(r.put(t,e),promisifyRequest(r.transaction))))}function del(e,t=defaultGetStore()){return t("readwrite",(t=>(t.delete(e),promisifyRequest(t.transaction))))}function clear(e=defaultGetStore()){return e("readwrite",(e=>(e.clear(),promisifyRequest(e.transaction))))}function eachCursor(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},promisifyRequest(e.transaction)}function keys(e=defaultGetStore()){return e("readonly",(e=>{if(e.getAllKeys)return promisifyRequest(e.getAllKeys());const t=[];return eachCursor(e,(e=>t.push(e.key))).then((()=>t))}))}const JSONStringify=e=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString()+"n":t)),JSONParse=e=>{const t=e.replace(/([\[:])?(\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,'$1"$2n"$3');return JSON.parse(t,((e,t)=>"string"==typeof t&&t.match(/^\d+n$/)?BigInt(t.substring(0,t.length-1)):t))};function safeJsonParse$2(e){if("string"!=typeof e)throw new Error("Cannot safe json parse value of type "+typeof e);try{return JSONParse(e)}catch(t){return e}}function safeJsonStringify$2(e){return"string"==typeof e?e:JSONStringify(e)||""}const x$7="idb-keyval";var z$8=(e={})=>{const t=e.base&&e.base.length>0?`${e.base}:`:"",r=e=>t+e;let n;return e.dbName&&e.storeName&&(n=createStore(e.dbName,e.storeName)),{name:x$7,options:e,hasItem:async e=>!(typeof(await get(r(e),n))>"u"),getItem:async e=>await get(r(e),n)??null,setItem:(e,t)=>set$1(r(e),t,n),removeItem:e=>del(r(e),n),getKeys:()=>keys(n),clear:()=>clear(n)}};const D$6="WALLET_CONNECT_V2_INDEXED_DB",E$6="keyvaluestorage";let _$8=class{constructor(){this.indexedDb=createStorage({driver:z$8({dbName:D$6,storeName:E$6})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map((e=>[e.key,e.value]))}async getItem(e){const t=await this.indexedDb.getItem(e);if(null!==t)return t}async setItem(e,t){await this.indexedDb.setItem(e,safeJsonStringify$2(t))}async removeItem(e){await this.indexedDb.removeItem(e)}};var l$8=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global$1<"u"?global$1:typeof self<"u"?self:{},c$7={exports:{}};function k$6(e){var t;return[e[0],safeJsonParse$2(null!=(t=e[1])?t:"")]}!function(){let e;function t(){}e=t,e.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},e.prototype.setItem=function(e,t){this[e]=String(t)},e.prototype.removeItem=function(e){delete this[e]},e.prototype.clear=function(){const e=this;Object.keys(e).forEach((function(t){e[t]=void 0,delete e[t]}))},e.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},e.prototype.__defineGetter__("length",(function(){return Object.keys(this).length})),typeof l$8<"u"&&l$8.localStorage?c$7.exports=l$8.localStorage:typeof window<"u"&&window.localStorage?c$7.exports=window.localStorage:c$7.exports=new t}();let K$3=class{constructor(){this.localStorage=c$7.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(k$6)}async getItem(e){const t=this.localStorage.getItem(e);if(null!==t)return safeJsonParse$2(t)}async setItem(e,t){this.localStorage.setItem(e,safeJsonStringify$2(t))}async removeItem(e){this.localStorage.removeItem(e)}};const N$4="wc_storage_version",y$8=1,O$6=async(e,t,r)=>{const n=N$4,o=await t.getItem(n);if(o&&o>=y$8)return void r(t);const i=await e.getKeys();if(!i.length)return void r(t);const a=[];for(;i.length;){const r=i.shift();if(!r)continue;const n=r.toLowerCase();if(n.includes("wc@")||n.includes("walletconnect")||n.includes("wc_")||n.includes("wallet_connect")){const n=await e.getItem(r);await t.setItem(r,n),a.push(r)}}await t.setItem(n,y$8),r(t),j$3(e,a)},j$3=async(e,t)=>{t.length&&t.forEach((async t=>{await e.removeItem(t)}))};let h$7=class{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};const e=new K$3;this.storage=e;try{const t=new _$8;O$6(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise((e=>{const t=setInterval((()=>{this.initialized&&(clearInterval(t),e())}),20)}))}};const format$1=quickFormatUnescaped;var browser$3=pino;const _console=pfGlobalThisOrFallback().console||{},stdSerializers={mapHttpRequest:mock,mapHttpResponse:mock,wrapRequestSerializer:passthrough,wrapResponseSerializer:passthrough,wrapErrorSerializer:passthrough,req:mock,res:mock,err:asErrValue};function shouldSerialize(e,t){if(Array.isArray(e)){return e.filter((function(e){return"!stdSerializers.err"!==e}))}return!0===e&&Object.keys(t)}function pino(e){(e=e||{}).browser=e.browser||{};const t=e.browser.transmit;if(t&&"function"!=typeof t.send)throw Error("pino: transmit option must have a send function");const r=e.browser.write||_console;e.browser.write&&(e.browser.asObject=!0);const n=e.serializers||{},o=shouldSerialize(e.browser.serialize,n);let i=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);"function"==typeof r&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),!1===e.enabled&&(e.level="silent");const a=e.level||"info",s=Object.create(r);s.log||(s.log=noop$1),Object.defineProperty(s,"levelVal",{get:function(){return"silent"===this.level?1/0:this.levels.values[this.level]}}),Object.defineProperty(s,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,set(c,s,"error","log"),set(c,s,"fatal","error"),set(c,s,"warn","error"),set(c,s,"info","log"),set(c,s,"debug","log"),set(c,s,"trace","log")}});const c={transmit:t,serialize:o,asObject:e.browser.asObject,levels:["error","fatal","warn","info","debug","trace"],timestamp:getTimeFunction(e)};return s.levels=pino.levels,s.level=a,s.setMaxListeners=s.getMaxListeners=s.emit=s.addListener=s.on=s.prependListener=s.once=s.prependOnceListener=s.removeListener=s.removeAllListeners=s.listeners=s.listenerCount=s.eventNames=s.write=s.flush=noop$1,s.serializers=n,s._serialize=o,s._stdErrSerialize=i,s.child=function(r,i){if(!r)throw new Error("missing bindings for child Pino");i=i||{},o&&r.serializers&&(i.serializers=r.serializers);const a=i.serializers;if(o&&a){var s=Object.assign({},n,a),c=!0===e.browser.serialize?Object.keys(s):o;delete r.serializers,applySerializers([r],c,s,this._stdErrSerialize)}function u(e){this._childLevel=1+(0|e._childLevel),this.error=bind(e,r,"error"),this.fatal=bind(e,r,"fatal"),this.warn=bind(e,r,"warn"),this.info=bind(e,r,"info"),this.debug=bind(e,r,"debug"),this.trace=bind(e,r,"trace"),s&&(this.serializers=s,this._serialize=c),t&&(this._logEvent=createLogEventShape([].concat(e._logEvent.bindings,r)))}return u.prototype=this,new u(this)},t&&(s._logEvent=createLogEventShape()),s}function set(e,t,r,n){const o=Object.getPrototypeOf(t);t[r]=t.levelVal>t.levels.values[r]?noop$1:o[r]?o[r]:_console[r]||_console[n]||noop$1,wrap$1(e,t,r)}function wrap$1(e,t,r){(e.transmit||t[r]!==noop$1)&&(t[r]=function(n){return function(){const o=e.timestamp(),i=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===_console?_console:this;for(var s=0;s<i.length;s++)i[s]=arguments[s];if(e.serialize&&!e.asObject&&applySerializers(i,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?n.call(a,asObject(this,r,i,o)):n.apply(a,i),e.transmit){const n=e.transmit.level||t.level,a=pino.levels.values[n],s=pino.levels.values[r];if(s<a)return;transmit(this,{ts:o,methodLevel:r,methodValue:s,transmitLevel:n,transmitValue:pino.levels.values[e.transmit.level||t.level],send:e.transmit.send,val:t.levelVal},i)}}}(t[r]))}function asObject(e,t,r,n){e._serialize&&applySerializers(r,e._serialize,e.serializers,e._stdErrSerialize);const o=r.slice();let i=o[0];const a={};n&&(a.time=n),a.level=pino.levels.values[t];let s=1+(0|e._childLevel);if(s<1&&(s=1),null!==i&&"object"==typeof i){for(;s--&&"object"==typeof o[0];)Object.assign(a,o.shift());i=o.length?format$1(o.shift(),o):void 0}else"string"==typeof i&&(i=format$1(o.shift(),o));return void 0!==i&&(a.msg=i),a}function applySerializers(e,t,r,n){for(const o in e)if(n&&e[o]instanceof Error)e[o]=pino.stdSerializers.err(e[o]);else if("object"==typeof e[o]&&!Array.isArray(e[o]))for(const n in e[o])t&&t.indexOf(n)>-1&&n in r&&(e[o][n]=r[n](e[o][n]))}function bind(e,t,r){return function(){const n=new Array(1+arguments.length);n[0]=t;for(var o=1;o<n.length;o++)n[o]=arguments[o-1];return e[r].apply(this,n)}}function transmit(e,t,r){const n=t.send,o=t.ts,i=t.methodLevel,a=t.methodValue,s=t.val,c=e._logEvent.bindings;applySerializers(r,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=o,e._logEvent.messages=r.filter((function(e){return-1===c.indexOf(e)})),e._logEvent.level.label=i,e._logEvent.level.value=a,n(i,e._logEvent,s),e._logEvent=createLogEventShape(c)}function createLogEventShape(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function asErrValue(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const r in e)void 0===t[r]&&(t[r]=e[r]);return t}function getTimeFunction(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?nullTime:epochTime}function mock(){return{}}function passthrough(e){return e}function noop$1(){}function nullTime(){return!1}function epochTime(){return Date.now()}function unixTime(){return Math.round(Date.now()/1e3)}function isoTime(){return new Date(Date.now()).toISOString()}function pfGlobalThisOrFallback(){function e(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(e2){return e(self)||e(window)||e(this)||{}}}pino.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"}},pino.stdSerializers=stdSerializers,pino.stdTimeFunctions=Object.assign({},{nullTime:nullTime,epochTime:epochTime,unixTime:unixTime,isoTime:isoTime});const _i=getDefaultExportFromCjs$1(browser$3),c$6={level:"info"},n$9="custom_context",l$7=1024e3;let O$5=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}},d$6=class{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new O$5(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;null!==t;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}},L$5=class{constructor(e,t=l$7){this.level=e??"error",this.levelValue=browser$3.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new d$6(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===browser$3.levels.values.error?console.error(e):t===browser$3.levels.values.warn?console.warn(e):t===browser$3.levels.values.debug?console.debug(e):t===browser$3.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(safeJsonStringify$2({timestamp:(new Date).toISOString(),log:e}));const t="string"==typeof e?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new d$6(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(safeJsonStringify$2({extraMetadata:e})),new Blob(t,{type:"application/json"})}},m$3=class{constructor(e,t=l$7){this.baseChunkLogger=new L$5(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),r=document.createElement("a");r.href=t,r.download=`walletconnect-logs-${(new Date).toISOString()}.txt`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(t)}},B$3=class{constructor(e,t=l$7){this.baseChunkLogger=new L$5(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var x$6=Object.defineProperty,S$8=Object.defineProperties,_$7=Object.getOwnPropertyDescriptors,p$4=Object.getOwnPropertySymbols,T$5=Object.prototype.hasOwnProperty,z$7=Object.prototype.propertyIsEnumerable,f$6=(e,t,r)=>t in e?x$6(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i$6=(e,t)=>{for(var r in t||(t={}))T$5.call(t,r)&&f$6(e,r,t[r]);if(p$4)for(var r of p$4(t))z$7.call(t,r)&&f$6(e,r,t[r]);return e},g$6=(e,t)=>S$8(e,_$7(t));function k$5(e){return g$6(i$6({},e),{level:(null==e?void 0:e.level)||c$6.level})}function v$6(e,t=n$9){return e[t]||""}function b$5(e,t,r=n$9){return e[r]=t,e}function y$7(e,t=n$9){let r="";return r=typeof e.bindings>"u"?v$6(e,t):e.bindings().context||"",r}function w$6(e,t,r=n$9){const n=y$7(e,r);return n.trim()?`${n}/${t}`:t}function E$5(e,t,r=n$9){const n=w$6(e,t,r);return b$5(e.child({context:n}),n,r)}function C$7(e){var t,r;const n=new m$3(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:_i(g$6(i$6({},e.opts),{level:"trace",browser:g$6(i$6({},null==(r=e.opts)?void 0:r.browser),{write:e=>n.write(e)})})),chunkLoggerController:n}}function I$6(e){var t;const r=new B$3(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:_i(g$6(i$6({},e.opts),{level:"trace"}),r),chunkLoggerController:r}}function A$5(e){return typeof e.loggerOverride<"u"&&"string"!=typeof e.loggerOverride?{logger:e.loggerOverride,chunkLoggerController:null}:typeof window<"u"?C$7(e):I$6(e)}var ed25519={},random={},system={},browser$2={};Object.defineProperty(browser$2,"__esModule",{value:!0}),browser$2.BrowserRandomSource=void 0;const QUOTA=65536;class BrowserRandomSource{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e="undefined"!=typeof self?self.crypto||self.msCrypto:null;e&&void 0!==e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let r=0;r<t.length;r+=QUOTA)this._crypto.getRandomValues(t.subarray(r,r+Math.min(t.length-r,QUOTA)));return t}}browser$2.BrowserRandomSource=BrowserRandomSource;var node={},wipe$1={};function wipe(e){for(var t=0;t<e.length;t++)e[t]=0;return e}Object.defineProperty(wipe$1,"__esModule",{value:!0}),wipe$1.wipe=wipe,Object.defineProperty(node,"__esModule",{value:!0}),node.NodeRandomSource=void 0;const wipe_1$3=wipe$1;class NodeRandomSource{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,void 0!==commonjsRequire$1){const e=requireCryptoBrowserify();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const r=new Uint8Array(e);for(let n=0;n<r.length;n++)r[n]=t[n];return(0,wipe_1$3.wipe)(t),r}}node.NodeRandomSource=NodeRandomSource,Object.defineProperty(system,"__esModule",{value:!0}),system.SystemRandomSource=void 0;const browser_1=browser$2,node_1=node;class SystemRandomSource{constructor(){return this.isAvailable=!1,this.name="",this._source=new browser_1.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new node_1.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}system.SystemRandomSource=SystemRandomSource;var binary={},int={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mul=Math.imul||function(e,t){var r=65535&e,n=65535&t;return r*n+((e>>>16&65535)*n+r*(t>>>16&65535)<<16>>>0)|0},e.add=function(e,t){return e+t|0},e.sub=function(e,t){return e-t|0},e.rotl=function(e,t){return e<<t|e>>>32-t},e.rotr=function(e,t){return e<<32-t|e>>>t},e.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(t){return e.isInteger(t)&&t>=-e.MAX_SAFE_INTEGER&&t<=e.MAX_SAFE_INTEGER}}(int),Object.defineProperty(binary,"__esModule",{value:!0});var int_1=int;function readInt16BE(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16}function readUint16BE(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0}function readInt16LE(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16}function readUint16LE(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0}function writeUint16BE(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>8,t[r+1]=e>>>0,t}function writeUint16LE(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}function readInt32BE(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function readUint32BE(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function readInt32LE(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function readUint32LE(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function writeUint32BE(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>24,t[r+1]=e>>>16,t[r+2]=e>>>8,t[r+3]=e>>>0,t}function writeUint32LE(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}function readInt64BE(e,t){void 0===t&&(t=0);var r=readInt32BE(e,t),n=readInt32BE(e,t+4);return 4294967296*r+n-4294967296*(n>>31)}function readUint64BE(e,t){return void 0===t&&(t=0),4294967296*readUint32BE(e,t)+readUint32BE(e,t+4)}function readInt64LE(e,t){void 0===t&&(t=0);var r=readInt32LE(e,t);return 4294967296*readInt32LE(e,t+4)+r-4294967296*(r>>31)}function readUint64LE(e,t){void 0===t&&(t=0);var r=readUint32LE(e,t);return 4294967296*readUint32LE(e,t+4)+r}function writeUint64BE(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),writeUint32BE(e/4294967296>>>0,t,r),writeUint32BE(e>>>0,t,r+4),t}function writeUint64LE(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),writeUint32LE(e>>>0,t,r),writeUint32LE(e/4294967296>>>0,t,r+4),t}function readUintBE(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,o=1,i=e/8+r-1;i>=r;i--)n+=t[i]*o,o*=256;return n}function readUintLE(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,o=1,i=r;i<r+e/8;i++)n+=t[i]*o,o*=256;return n}function writeUintBE(e,t,r,n){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===n&&(n=0),e%8!=0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!int_1.isSafeInteger(t))throw new Error("writeUintBE value must be an integer");for(var o=1,i=e/8+n-1;i>=n;i--)r[i]=t/o&255,o*=256;return r}function writeUintLE(e,t,r,n){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===n&&(n=0),e%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!int_1.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var o=1,i=n;i<n+e/8;i++)r[i]=t/o&255,o*=256;return r}function readFloat32BE(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t)}function readFloat32LE(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t,!0)}function readFloat64BE(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t)}function readFloat64LE(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t,!0)}function writeFloat32BE(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(r,e),t}function writeFloat32LE(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(r,e,!0),t}function writeFloat64BE(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(r,e),t}function writeFloat64LE(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(r,e,!0),t}binary.readInt16BE=readInt16BE,binary.readUint16BE=readUint16BE,binary.readInt16LE=readInt16LE,binary.readUint16LE=readUint16LE,binary.writeUint16BE=writeUint16BE,binary.writeInt16BE=writeUint16BE,binary.writeUint16LE=writeUint16LE,binary.writeInt16LE=writeUint16LE,binary.readInt32BE=readInt32BE,binary.readUint32BE=readUint32BE,binary.readInt32LE=readInt32LE,binary.readUint32LE=readUint32LE,binary.writeUint32BE=writeUint32BE,binary.writeInt32BE=writeUint32BE,binary.writeUint32LE=writeUint32LE,binary.writeInt32LE=writeUint32LE,binary.readInt64BE=readInt64BE,binary.readUint64BE=readUint64BE,binary.readInt64LE=readInt64LE,binary.readUint64LE=readUint64LE,binary.writeUint64BE=writeUint64BE,binary.writeInt64BE=writeUint64BE,binary.writeUint64LE=writeUint64LE,binary.writeInt64LE=writeUint64LE,binary.readUintBE=readUintBE,binary.readUintLE=readUintLE,binary.writeUintBE=writeUintBE,binary.writeUintLE=writeUintLE,binary.readFloat32BE=readFloat32BE,binary.readFloat32LE=readFloat32LE,binary.readFloat64BE=readFloat64BE,binary.readFloat64LE=readFloat64LE,binary.writeFloat32BE=writeFloat32BE,binary.writeFloat32LE=writeFloat32LE,binary.writeFloat64BE=writeFloat64BE,binary.writeFloat64LE=writeFloat64LE,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.randomStringForEntropy=e.randomString=e.randomUint32=e.randomBytes=e.defaultRandomSource=void 0;const t=system,r=binary,n=wipe$1;function o(t,r=e.defaultRandomSource){return r.randomBytes(t)}e.defaultRandomSource=new t.SystemRandomSource,e.randomBytes=o,e.randomUint32=function(t=e.defaultRandomSource){const i=o(4,t),a=(0,r.readUint32LE)(i);return(0,n.wipe)(i),a};const i="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function a(t,r=i,a=e.defaultRandomSource){if(r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");let s="";const c=r.length,u=256-256%c;for(;t>0;){const e=o(Math.ceil(256*t/u),a);for(let n=0;n<e.length&&t>0;n++){const o=e[n];o<u&&(s+=r.charAt(o%c),t--)}(0,n.wipe)(e)}return s}e.randomString=a,e.randomStringForEntropy=function(t,r=i,n=e.defaultRandomSource){return a(Math.ceil(t/(Math.log(r.length)/Math.LN2)),r,n)}}(random);var sha512={};!function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=binary,r=wipe$1;e.DIGEST_LENGTH=64,e.BLOCK_SIZE=128;var n=function(){function n(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return n.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},n.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},n.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},n.prototype.update=function(t,r){if(void 0===r&&(r=t.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength<e.BLOCK_SIZE&&r>0;)this._buffer[this._bufferLength++]=t[n++],r--;this._bufferLength===this.blockSize&&(i(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=i(this._tempHi,this._tempLo,this._stateHi,this._stateLo,t,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=t[n++],r--;return this},n.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,o=r/536870912|0,a=r<<3,s=r%128<112?128:256;this._buffer[n]=128;for(var c=n+1;c<s-8;c++)this._buffer[c]=0;t.writeUint32BE(o,this._buffer,s-8),t.writeUint32BE(a,this._buffer,s-4),i(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,s),this._finished=!0}for(c=0;c<this.digestLength/8;c++)t.writeUint32BE(this._stateHi[c],e,8*c),t.writeUint32BE(this._stateLo[c],e,8*c+4);return this},n.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},n.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},n.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},n.prototype.cleanSavedState=function(e){r.wipe(e.stateHi),r.wipe(e.stateLo),e.buffer&&r.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},n}();e.SHA512=n;var o=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function i(e,r,n,i,a,s,c){for(var u,l,d,f,h,p,y,m,g=n[0],b=n[1],v=n[2],w=n[3],_=n[4],I=n[5],T=n[6],k=n[7],$=i[0],S=i[1],A=i[2],E=i[3],C=i[4],R=i[5],O=i[6],N=i[7];c>=128;){for(var P=0;P<16;P++){var M=8*P+s;e[P]=t.readUint32BE(a,M),r[P]=t.readUint32BE(a,M+4)}for(P=0;P<80;P++){var B,D,x=g,L=b,U=v,j=w,F=_,q=I,K=T,H=$,G=S,z=A,V=E,W=C,Q=R,Y=O;if(h=65535&(l=N),p=l>>>16,y=65535&(u=k),m=u>>>16,h+=65535&(l=(C>>>14|_<<18)^(C>>>18|_<<14)^(_>>>9|C<<23)),p+=l>>>16,y+=65535&(u=(_>>>14|C<<18)^(_>>>18|C<<14)^(C>>>9|_<<23)),m+=u>>>16,h+=65535&(l=C&R^~C&O),p+=l>>>16,y+=65535&(u=_&I^~_&T),m+=u>>>16,u=o[2*P],h+=65535&(l=o[2*P+1]),p+=l>>>16,y+=65535&u,m+=u>>>16,u=e[P%16],p+=(l=r[P%16])>>>16,y+=65535&u,m+=u>>>16,y+=(p+=(h+=65535&l)>>>16)>>>16,h=65535&(l=f=65535&h|p<<16),p=l>>>16,y=65535&(u=d=65535&y|(m+=y>>>16)<<16),m=u>>>16,h+=65535&(l=($>>>28|g<<4)^(g>>>2|$<<30)^(g>>>7|$<<25)),p+=l>>>16,y+=65535&(u=(g>>>28|$<<4)^($>>>2|g<<30)^($>>>7|g<<25)),m+=u>>>16,p+=(l=$&S^$&A^S&A)>>>16,y+=65535&(u=g&b^g&v^b&v),m+=u>>>16,B=65535&(y+=(p+=(h+=65535&l)>>>16)>>>16)|(m+=y>>>16)<<16,D=65535&h|p<<16,h=65535&(l=V),p=l>>>16,y=65535&(u=j),m=u>>>16,p+=(l=f)>>>16,y+=65535&(u=d),m+=u>>>16,b=x,v=L,w=U,_=j=65535&(y+=(p+=(h+=65535&l)>>>16)>>>16)|(m+=y>>>16)<<16,I=F,T=q,k=K,g=B,S=H,A=G,E=z,C=V=65535&h|p<<16,R=W,O=Q,N=Y,$=D,P%16==15)for(M=0;M<16;M++)u=e[M],h=65535&(l=r[M]),p=l>>>16,y=65535&u,m=u>>>16,u=e[(M+9)%16],h+=65535&(l=r[(M+9)%16]),p+=l>>>16,y+=65535&u,m+=u>>>16,d=e[(M+1)%16],h+=65535&(l=((f=r[(M+1)%16])>>>1|d<<31)^(f>>>8|d<<24)^(f>>>7|d<<25)),p+=l>>>16,y+=65535&(u=(d>>>1|f<<31)^(d>>>8|f<<24)^d>>>7),m+=u>>>16,d=e[(M+14)%16],p+=(l=((f=r[(M+14)%16])>>>19|d<<13)^(d>>>29|f<<3)^(f>>>6|d<<26))>>>16,y+=65535&(u=(d>>>19|f<<13)^(f>>>29|d<<3)^d>>>6),m+=u>>>16,m+=(y+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,e[M]=65535&y|m<<16,r[M]=65535&h|p<<16}h=65535&(l=$),p=l>>>16,y=65535&(u=g),m=u>>>16,u=n[0],p+=(l=i[0])>>>16,y+=65535&u,m+=u>>>16,m+=(y+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[0]=g=65535&y|m<<16,i[0]=$=65535&h|p<<16,h=65535&(l=S),p=l>>>16,y=65535&(u=b),m=u>>>16,u=n[1],p+=(l=i[1])>>>16,y+=65535&u,m+=u>>>16,m+=(y+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[1]=b=65535&y|m<<16,i[1]=S=65535&h|p<<16,h=65535&(l=A),p=l>>>16,y=65535&(u=v),m=u>>>16,u=n[2],p+=(l=i[2])>>>16,y+=65535&u,m+=u>>>16,m+=(y+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[2]=v=65535&y|m<<16,i[2]=A=65535&h|p<<16,h=65535&(l=E),p=l>>>16,y=65535&(u=w),m=u>>>16,u=n[3],p+=(l=i[3])>>>16,y+=65535&u,m+=u>>>16,m+=(y+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[3]=w=65535&y|m<<16,i[3]=E=65535&h|p<<16,h=65535&(l=C),p=l>>>16,y=65535&(u=_),m=u>>>16,u=n[4],p+=(l=i[4])>>>16,y+=65535&u,m+=u>>>16,m+=(y+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[4]=_=65535&y|m<<16,i[4]=C=65535&h|p<<16,h=65535&(l=R),p=l>>>16,y=65535&(u=I),m=u>>>16,u=n[5],p+=(l=i[5])>>>16,y+=65535&u,m+=u>>>16,m+=(y+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[5]=I=65535&y|m<<16,i[5]=R=65535&h|p<<16,h=65535&(l=O),p=l>>>16,y=65535&(u=T),m=u>>>16,u=n[6],p+=(l=i[6])>>>16,y+=65535&u,m+=u>>>16,m+=(y+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[6]=T=65535&y|m<<16,i[6]=O=65535&h|p<<16,h=65535&(l=N),p=l>>>16,y=65535&(u=k),m=u>>>16,u=n[7],p+=(l=i[7])>>>16,y+=65535&u,m+=u>>>16,m+=(y+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[7]=k=65535&y|m<<16,i[7]=N=65535&h|p<<16,s+=128,c-=128}return s}e.hash=function(e){var t=new n;t.update(e);var r=t.digest();return t.clean(),r}}(sha512),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.convertSecretKeyToX25519=e.convertPublicKeyToX25519=e.verify=e.sign=e.extractPublicKeyFromSecretKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.SEED_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=e.SIGNATURE_LENGTH=void 0;const t=random,r=sha512,n=wipe$1;function o(e){const t=new Float64Array(16);if(e)for(let r=0;r<e.length;r++)t[r]=e[r];return t}e.SIGNATURE_LENGTH=64,e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=64,e.SEED_LENGTH=32;new Uint8Array(32)[0]=9;const i=o(),a=o([1]),s=o([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),c=o([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=o([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),l=o([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),d=o([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function f(e,t){for(let r=0;r<16;r++)e[r]=0|t[r]}function h(e){let t=1;for(let r=0;r<16;r++){let n=e[r]+t+65535;t=Math.floor(n/65536),e[r]=n-65536*t}e[0]+=t-1+37*(t-1)}function p(e,t,r){const n=~(r-1);for(let o=0;o<16;o++){const r=n&(e[o]^t[o]);e[o]^=r,t[o]^=r}}function y(e,t){const r=o(),n=o();for(let o=0;o<16;o++)n[o]=t[o];h(n),h(n),h(n);for(let o=0;o<2;o++){r[0]=n[0]-65517;for(let t=1;t<15;t++)r[t]=n[t]-65535-(r[t-1]>>16&1),r[t-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);const e=r[15]>>16&1;r[14]&=65535,p(n,r,1-e)}for(let o=0;o<16;o++)e[2*o]=255&n[o],e[2*o+1]=n[o]>>8}function m(e,t){let r=0;for(let n=0;n<32;n++)r|=e[n]^t[n];return(1&r-1>>>8)-1}function g(e,t){const r=new Uint8Array(32),n=new Uint8Array(32);return y(r,e),y(n,t),m(r,n)}function b(e){const t=new Uint8Array(32);return y(t,e),1&t[0]}function v(e,t,r){for(let n=0;n<16;n++)e[n]=t[n]+r[n]}function w(e,t,r){for(let n=0;n<16;n++)e[n]=t[n]-r[n]}function _(e,t,r){let n,o,i=0,a=0,s=0,c=0,u=0,l=0,d=0,f=0,h=0,p=0,y=0,m=0,g=0,b=0,v=0,w=0,_=0,I=0,T=0,k=0,$=0,S=0,A=0,E=0,C=0,R=0,O=0,N=0,P=0,M=0,B=0,D=r[0],x=r[1],L=r[2],U=r[3],j=r[4],F=r[5],q=r[6],K=r[7],H=r[8],G=r[9],z=r[10],V=r[11],W=r[12],Q=r[13],Y=r[14],X=r[15];n=t[0],i+=n*D,a+=n*x,s+=n*L,c+=n*U,u+=n*j,l+=n*F,d+=n*q,f+=n*K,h+=n*H,p+=n*G,y+=n*z,m+=n*V,g+=n*W,b+=n*Q,v+=n*Y,w+=n*X,n=t[1],a+=n*D,s+=n*x,c+=n*L,u+=n*U,l+=n*j,d+=n*F,f+=n*q,h+=n*K,p+=n*H,y+=n*G,m+=n*z,g+=n*V,b+=n*W,v+=n*Q,w+=n*Y,_+=n*X,n=t[2],s+=n*D,c+=n*x,u+=n*L,l+=n*U,d+=n*j,f+=n*F,h+=n*q,p+=n*K,y+=n*H,m+=n*G,g+=n*z,b+=n*V,v+=n*W,w+=n*Q,_+=n*Y,I+=n*X,n=t[3],c+=n*D,u+=n*x,l+=n*L,d+=n*U,f+=n*j,h+=n*F,p+=n*q,y+=n*K,m+=n*H,g+=n*G,b+=n*z,v+=n*V,w+=n*W,_+=n*Q,I+=n*Y,T+=n*X,n=t[4],u+=n*D,l+=n*x,d+=n*L,f+=n*U,h+=n*j,p+=n*F,y+=n*q,m+=n*K,g+=n*H,b+=n*G,v+=n*z,w+=n*V,_+=n*W,I+=n*Q,T+=n*Y,k+=n*X,n=t[5],l+=n*D,d+=n*x,f+=n*L,h+=n*U,p+=n*j,y+=n*F,m+=n*q,g+=n*K,b+=n*H,v+=n*G,w+=n*z,_+=n*V,I+=n*W,T+=n*Q,k+=n*Y,$+=n*X,n=t[6],d+=n*D,f+=n*x,h+=n*L,p+=n*U,y+=n*j,m+=n*F,g+=n*q,b+=n*K,v+=n*H,w+=n*G,_+=n*z,I+=n*V,T+=n*W,k+=n*Q,$+=n*Y,S+=n*X,n=t[7],f+=n*D,h+=n*x,p+=n*L,y+=n*U,m+=n*j,g+=n*F,b+=n*q,v+=n*K,w+=n*H,_+=n*G,I+=n*z,T+=n*V,k+=n*W,$+=n*Q,S+=n*Y,A+=n*X,n=t[8],h+=n*D,p+=n*x,y+=n*L,m+=n*U,g+=n*j,b+=n*F,v+=n*q,w+=n*K,_+=n*H,I+=n*G,T+=n*z,k+=n*V,$+=n*W,S+=n*Q,A+=n*Y,E+=n*X,n=t[9],p+=n*D,y+=n*x,m+=n*L,g+=n*U,b+=n*j,v+=n*F,w+=n*q,_+=n*K,I+=n*H,T+=n*G,k+=n*z,$+=n*V,S+=n*W,A+=n*Q,E+=n*Y,C+=n*X,n=t[10],y+=n*D,m+=n*x,g+=n*L,b+=n*U,v+=n*j,w+=n*F,_+=n*q,I+=n*K,T+=n*H,k+=n*G,$+=n*z,S+=n*V,A+=n*W,E+=n*Q,C+=n*Y,R+=n*X,n=t[11],m+=n*D,g+=n*x,b+=n*L,v+=n*U,w+=n*j,_+=n*F,I+=n*q,T+=n*K,k+=n*H,$+=n*G,S+=n*z,A+=n*V,E+=n*W,C+=n*Q,R+=n*Y,O+=n*X,n=t[12],g+=n*D,b+=n*x,v+=n*L,w+=n*U,_+=n*j,I+=n*F,T+=n*q,k+=n*K,$+=n*H,S+=n*G,A+=n*z,E+=n*V,C+=n*W,R+=n*Q,O+=n*Y,N+=n*X,n=t[13],b+=n*D,v+=n*x,w+=n*L,_+=n*U,I+=n*j,T+=n*F,k+=n*q,$+=n*K,S+=n*H,A+=n*G,E+=n*z,C+=n*V,R+=n*W,O+=n*Q,N+=n*Y,P+=n*X,n=t[14],v+=n*D,w+=n*x,_+=n*L,I+=n*U,T+=n*j,k+=n*F,$+=n*q,S+=n*K,A+=n*H,E+=n*G,C+=n*z,R+=n*V,O+=n*W,N+=n*Q,P+=n*Y,M+=n*X,n=t[15],w+=n*D,_+=n*x,I+=n*L,T+=n*U,k+=n*j,$+=n*F,S+=n*q,A+=n*K,E+=n*H,C+=n*G,R+=n*z,O+=n*V,N+=n*W,P+=n*Q,M+=n*Y,B+=n*X,i+=38*_,a+=38*I,s+=38*T,c+=38*k,u+=38*$,l+=38*S,d+=38*A,f+=38*E,h+=38*C,p+=38*R,y+=38*O,m+=38*N,g+=38*P,b+=38*M,v+=38*B,o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=p+o+65535,o=Math.floor(n/65536),p=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=m+o+65535,o=Math.floor(n/65536),m=n-65536*o,n=g+o+65535,o=Math.floor(n/65536),g=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,i+=o-1+37*(o-1),o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=p+o+65535,o=Math.floor(n/65536),p=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=m+o+65535,o=Math.floor(n/65536),m=n-65536*o,n=g+o+65535,o=Math.floor(n/65536),g=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,i+=o-1+37*(o-1),e[0]=i,e[1]=a,e[2]=s,e[3]=c,e[4]=u,e[5]=l,e[6]=d,e[7]=f,e[8]=h,e[9]=p,e[10]=y,e[11]=m,e[12]=g,e[13]=b,e[14]=v,e[15]=w}function I(e,t){_(e,t,t)}function T(e,t){const r=o();let n;for(n=0;n<16;n++)r[n]=t[n];for(n=253;n>=0;n--)I(r,r),2!==n&&4!==n&&_(r,r,t);for(n=0;n<16;n++)e[n]=r[n]}function k(e,t){const r=o(),n=o(),i=o(),a=o(),s=o(),u=o(),l=o(),d=o(),f=o();w(r,e[1],e[0]),w(f,t[1],t[0]),_(r,r,f),v(n,e[0],e[1]),v(f,t[0],t[1]),_(n,n,f),_(i,e[3],t[3]),_(i,i,c),_(a,e[2],t[2]),v(a,a,a),w(s,n,r),w(u,a,i),v(l,a,i),v(d,n,r),_(e[0],s,u),_(e[1],d,l),_(e[2],l,u),_(e[3],s,d)}function $(e,t,r){for(let n=0;n<4;n++)p(e[n],t[n],r)}function S(e,t){const r=o(),n=o(),i=o();T(i,t[2]),_(r,t[0],i),_(n,t[1],i),y(e,n),e[31]^=b(r)<<7}function A(e,t,r){f(e[0],i),f(e[1],a),f(e[2],a),f(e[3],i);for(let n=255;n>=0;--n){const o=r[n/8|0]>>(7&n)&1;$(e,t,o),k(t,e),k(e,e),$(e,t,o)}}function E(e,t){const r=[o(),o(),o(),o()];f(r[0],u),f(r[1],l),f(r[2],a),_(r[3],u,l),A(e,r,t)}function C(t){if(t.length!==e.SEED_LENGTH)throw new Error(`ed25519: seed must be ${e.SEED_LENGTH} bytes`);const n=(0,r.hash)(t);n[0]&=248,n[31]&=127,n[31]|=64;const i=new Uint8Array(32),a=[o(),o(),o(),o()];E(a,n),S(i,a);const s=new Uint8Array(64);return s.set(t),s.set(i,32),{publicKey:i,secretKey:s}}e.generateKeyPairFromSeed=C,e.generateKeyPair=function(e){const r=(0,t.randomBytes)(32,e),o=C(r);return(0,n.wipe)(r),o},e.extractPublicKeyFromSecretKey=function(t){if(t.length!==e.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${e.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))};const R=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function O(e,t){let r,n,o,i;for(n=63;n>=32;--n){for(r=0,o=n-32,i=n-12;o<i;++o)t[o]+=r-16*t[n]*R[o-(n-32)],r=Math.floor((t[o]+128)/256),t[o]-=256*r;t[o]+=r,t[n]=0}for(r=0,o=0;o<32;o++)t[o]+=r-(t[31]>>4)*R[o],r=t[o]>>8,t[o]&=255;for(o=0;o<32;o++)t[o]-=r*R[o];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function N(e){const t=new Float64Array(64);for(let r=0;r<64;r++)t[r]=e[r];for(let r=0;r<64;r++)e[r]=0;O(e,t)}function P(e,t){const r=o(),n=o(),c=o(),u=o(),l=o(),h=o(),p=o();return f(e[2],a),function(e,t){for(let r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(e[1],t),I(c,e[1]),_(u,c,s),w(c,c,e[2]),v(u,e[2],u),I(l,u),I(h,l),_(p,h,l),_(r,p,c),_(r,r,u),function(e,t){const r=o();let n;for(n=0;n<16;n++)r[n]=t[n];for(n=250;n>=0;n--)I(r,r),1!==n&&_(r,r,t);for(n=0;n<16;n++)e[n]=r[n]}(r,r),_(r,r,c),_(r,r,u),_(r,r,u),_(e[0],r,u),I(n,e[0]),_(n,n,u),g(n,c)&&_(e[0],e[0],d),I(n,e[0]),_(n,n,u),g(n,c)?-1:(b(e[0])===t[31]>>7&&w(e[0],i,e[0]),_(e[3],e[0],e[1]),0)}e.sign=function(e,t){const n=new Float64Array(64),i=[o(),o(),o(),o()],a=(0,r.hash)(e.subarray(0,32));a[0]&=248,a[31]&=127,a[31]|=64;const s=new Uint8Array(64);s.set(a.subarray(32),32);const c=new r.SHA512;c.update(s.subarray(32)),c.update(t);const u=c.digest();c.clean(),N(u),E(i,u),S(s,i),c.reset(),c.update(s.subarray(0,32)),c.update(e.subarray(32)),c.update(t);const l=c.digest();N(l);for(let r=0;r<32;r++)n[r]=u[r];for(let r=0;r<32;r++)for(let e=0;e<32;e++)n[r+e]+=l[r]*a[e];return O(s.subarray(32),n),s},e.verify=function(t,n,i){const a=new Uint8Array(32),s=[o(),o(),o(),o()],c=[o(),o(),o(),o()];if(i.length!==e.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${e.SIGNATURE_LENGTH} bytes`);if(P(c,t))return!1;const u=new r.SHA512;u.update(i.subarray(0,32)),u.update(t),u.update(n);const l=u.digest();return N(l),A(s,c,l),E(c,i.subarray(32)),k(s,c),S(a,s),!m(i,a)},e.convertPublicKeyToX25519=function(e){let t=[o(),o(),o(),o()];if(P(t,e))throw new Error("Ed25519: invalid public key");let r=o(),n=o(),i=t[1];v(r,a,i),w(n,a,i),T(n,n),_(r,r,n);let s=new Uint8Array(32);return y(s,r),s},e.convertSecretKeyToX25519=function(e){const t=(0,r.hash)(e.subarray(0,32));t[0]&=248,t[31]&=127,t[31]|=64;const o=new Uint8Array(t.subarray(0,32));return(0,n.wipe)(t),o}}(ed25519);const JWT_IRIDIUM_ALG="EdDSA",JWT_IRIDIUM_TYP="JWT",JWT_DELIMITER=".",JWT_ENCODING="base64url",JSON_ENCODING="utf8",DATA_ENCODING="utf8",DID_DELIMITER=":",DID_PREFIX="did",DID_METHOD="key",MULTICODEC_ED25519_ENCODING="base58btc",MULTICODEC_ED25519_BASE="z",MULTICODEC_ED25519_HEADER="K36",KEY_PAIR_SEED_LENGTH=32;function allocUnsafe$1(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}function concat(e,t){t||(t=e.reduce(((e,t)=>e+t.length),0));const r=allocUnsafe$1(t);let n=0;for(const o of e)r.set(o,n),n+=o.length;return r}function base$3(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<e.length;o++){var i=e.charAt(o),a=i.charCodeAt(0);if(255!==r[a])throw new TypeError(i+" is ambiguous");r[a]=o}var s=e.length,c=e.charAt(0),u=Math.log(s)/Math.log(256),l=Math.log(256)/Math.log(s);function d(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,o=0;e[t]===c;)n++,t++;for(var i=(e.length-t)*u+1>>>0,a=new Uint8Array(i);e[t];){var l=r[e.charCodeAt(t)];if(255===l)return;for(var d=0,f=i-1;(0!==l||d<o)&&-1!==f;f--,d++)l+=s*a[f]>>>0,a[f]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=d,t++}if(" "!==e[t]){for(var h=i-o;h!==i&&0===a[h];)h++;for(var p=new Uint8Array(n+(i-h)),y=n;h!==i;)p[y++]=a[h++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,o=0,i=t.length;o!==i&&0===t[o];)o++,r++;for(var a=(i-o)*l+1>>>0,u=new Uint8Array(a);o!==i;){for(var d=t[o],f=0,h=a-1;(0!==d||f<n)&&-1!==h;h--,f++)d+=256*u[h]>>>0,u[h]=d%s>>>0,d=d/s>>>0;if(0!==d)throw new Error("Non-zero carry");n=f,o++}for(var p=a-n;p!==a&&0===u[p];)p++;for(var y=c.repeat(r);p<a;++p)y+=e.charAt(u[p]);return y},decodeUnsafe:d,decode:function(e){var r=d(e);if(r)return r;throw new Error(`Non-${t} character`)}}}var src=base$3,_brrp__multiformats_scope_baseX=src;const coerce=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},fromString$2=e=>(new TextEncoder).encode(e),toString$2=e=>(new TextDecoder).decode(e);class Encoder{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Decoder{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){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))}throw Error("Can only multibase decode strings")}or(e){return or$2(this,e)}}class ComposedDecoder{constructor(e){this.decoders=e}or(e){return or$2(this,e)}decode(e){const t=e[0],r=this.decoders[t];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 or$2=(e,t)=>new ComposedDecoder({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class Codec{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new Encoder(e,t,r),this.decoder=new Decoder(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const from$1=({name:e,prefix:t,encode:r,decode:n})=>new Codec(e,t,r,n),baseX=({prefix:e,name:t,alphabet:r})=>{const{encode:n,decode:o}=_brrp__multiformats_scope_baseX(r,t);return from$1({prefix:e,name:t,encode:n,decode:e=>coerce(o(e))})},decode$2=(e,t,r,n)=>{const o={};for(let l=0;l<t.length;++l)o[t[l]]=l;let i=e.length;for(;"="===e[i-1];)--i;const a=new Uint8Array(i*r/8|0);let s=0,c=0,u=0;for(let l=0;l<i;++l){const t=o[e[l]];if(void 0===t)throw new SyntaxError(`Non-${n} character`);c=c<<r|t,s+=r,s>=8&&(s-=8,a[u++]=255&c>>s)}if(s>=r||255&c<<8-s)throw new SyntaxError("Unexpected end of data");return a},encode$1=(e,t,r)=>{const n="="===t[t.length-1],o=(1<<r)-1;let i="",a=0,s=0;for(let c=0;c<e.length;++c)for(s=s<<8|e[c],a+=8;a>r;)a-=r,i+=t[o&s>>a];if(a&&(i+=t[o&s<<r-a]),n)for(;i.length*r&7;)i+="=";return i},rfc4648=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>from$1({prefix:t,name:e,encode:e=>encode$1(e,n,r),decode:t=>decode$2(t,n,r,e)}),identity=from$1({prefix:"\0",name:"identity",encode:e=>toString$2(e),decode:e=>fromString$2(e)}),identityBase=Object.freeze(Object.defineProperty({__proto__:null,identity:identity},Symbol.toStringTag,{value:"Module"})),base2=rfc4648({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),base2$1=Object.freeze(Object.defineProperty({__proto__:null,base2:base2},Symbol.toStringTag,{value:"Module"})),base8=rfc4648({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$1=Object.freeze(Object.defineProperty({__proto__:null,base8:base8},Symbol.toStringTag,{value:"Module"})),base10=baseX({prefix:"9",name:"base10",alphabet:"0123456789"}),base10$1=Object.freeze(Object.defineProperty({__proto__:null,base10:base10},Symbol.toStringTag,{value:"Module"})),base16=rfc4648({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper=rfc4648({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),base16$1=Object.freeze(Object.defineProperty({__proto__:null,base16:base16,base16upper:base16upper},Symbol.toStringTag,{value:"Module"})),base32=rfc4648({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper=rfc4648({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad=rfc4648({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper=rfc4648({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex=rfc4648({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper=rfc4648({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad=rfc4648({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper=rfc4648({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z=rfc4648({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base32$1=Object.freeze(Object.defineProperty({__proto__:null,base32:base32,base32hex:base32hex,base32hexpad:base32hexpad,base32hexpadupper:base32hexpadupper,base32hexupper:base32hexupper,base32pad:base32pad,base32padupper:base32padupper,base32upper:base32upper,base32z:base32z},Symbol.toStringTag,{value:"Module"})),base36=baseX({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper=baseX({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$1=Object.freeze(Object.defineProperty({__proto__:null,base36:base36,base36upper:base36upper},Symbol.toStringTag,{value:"Module"})),base58btc=baseX({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr=baseX({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base58=Object.freeze(Object.defineProperty({__proto__:null,base58btc:base58btc,base58flickr:base58flickr},Symbol.toStringTag,{value:"Module"})),base64=rfc4648({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad=rfc4648({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url=rfc4648({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad=rfc4648({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$1=Object.freeze(Object.defineProperty({__proto__:null,base64:base64,base64pad:base64pad,base64url:base64url,base64urlpad:base64urlpad},Symbol.toStringTag,{value:"Module"})),alphabet=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),alphabetBytesToChars=alphabet.reduce(((e,t,r)=>(e[r]=t,e)),[]),alphabetCharsToBytes=alphabet.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]);function encode(e){return e.reduce(((e,t)=>e+=alphabetBytesToChars[t]),"")}function decode$1(e){const t=[];for(const r of e){const e=alphabetCharsToBytes[r.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}const base256emoji=from$1({prefix:"🚀",name:"base256emoji",encode:encode,decode:decode$1}),base256emoji$1=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:base256emoji},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const bases={...identityBase,...base2$1,...base8$1,...base10$1,...base16$1,...base32$1,...base36$1,...base58,...base64$1,...base256emoji$1};function createCodec(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const string=createCodec("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),ascii=createCodec("ascii","a",(e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}),(e=>{const t=allocUnsafe$1((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t})),BASES={utf8:string,"utf-8":string,hex:bases.base16,latin1:ascii,ascii:ascii,binary:ascii,...bases};function toString$1(e,t="utf8"){const r=BASES[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.encoder.encode(e).substring(1):globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8")}function fromString$1(e,t="utf8"){const r=BASES[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.decoder.decode(`${r.prefix}${e}`):globalThis.Buffer.from(e,"utf8")}function decodeJSON(e){return safeJsonParse$2(toString$1(fromString$1(e,JWT_ENCODING),JSON_ENCODING))}function encodeJSON(e){return toString$1(fromString$1(safeJsonStringify$2(e),JSON_ENCODING),JWT_ENCODING)}function encodeIss(e){const t=fromString$1(MULTICODEC_ED25519_HEADER,MULTICODEC_ED25519_ENCODING),r=MULTICODEC_ED25519_BASE+toString$1(concat([t,e]),MULTICODEC_ED25519_ENCODING);return[DID_PREFIX,DID_METHOD,r].join(DID_DELIMITER)}function encodeSig(e){return toString$1(e,JWT_ENCODING)}function decodeSig(e){return fromString$1(e,JWT_ENCODING)}function encodeData(e){return fromString$1([encodeJSON(e.header),encodeJSON(e.payload)].join(JWT_DELIMITER),DATA_ENCODING)}function encodeJWT(e){return[encodeJSON(e.header),encodeJSON(e.payload),encodeSig(e.signature)].join(JWT_DELIMITER)}function decodeJWT(e){const t=e.split(JWT_DELIMITER);return{header:decodeJSON(t[0]),payload:decodeJSON(t[1]),signature:decodeSig(t[2]),data:fromString$1(t.slice(0,2).join(JWT_DELIMITER),DATA_ENCODING)}}function generateKeyPair(e=random.randomBytes(KEY_PAIR_SEED_LENGTH)){return ed25519.generateKeyPairFromSeed(e)}async function signJWT(e,t,r,n,o=cjs$7.fromMiliseconds(Date.now())){const i={alg:JWT_IRIDIUM_ALG,typ:JWT_IRIDIUM_TYP},a={iss:encodeIss(n.publicKey),sub:e,aud:t,iat:o,exp:o+r},s=encodeData({header:i,payload:a});return encodeJWT({header:i,payload:a,signature:ed25519.sign(n.secretKey,s)})}var cjs$6={};function getFromWindow$2(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}function getFromWindowOrThrow$2(e){const t=getFromWindow$2(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}function getDocumentOrThrow$2(){return getFromWindowOrThrow$2("document")}function getDocument$2(){return getFromWindow$2("document")}Object.defineProperty(cjs$6,"__esModule",{value:!0}),cjs$6.getLocalStorage=cjs$6.getLocalStorageOrThrow=cjs$6.getCrypto=cjs$6.getCryptoOrThrow=getLocation_1$1=cjs$6.getLocation=cjs$6.getLocationOrThrow=getNavigator_1$1=cjs$6.getNavigator=cjs$6.getNavigatorOrThrow=getDocument_1$1=cjs$6.getDocument=cjs$6.getDocumentOrThrow=cjs$6.getFromWindowOrThrow=cjs$6.getFromWindow=void 0,cjs$6.getFromWindow=getFromWindow$2,cjs$6.getFromWindowOrThrow=getFromWindowOrThrow$2,cjs$6.getDocumentOrThrow=getDocumentOrThrow$2;var getDocument_1$1=cjs$6.getDocument=getDocument$2;function getNavigatorOrThrow$2(){return getFromWindowOrThrow$2("navigator")}function getNavigator$2(){return getFromWindow$2("navigator")}cjs$6.getNavigatorOrThrow=getNavigatorOrThrow$2;var getNavigator_1$1=cjs$6.getNavigator=getNavigator$2;function getLocationOrThrow$2(){return getFromWindowOrThrow$2("location")}function getLocation$2(){return getFromWindow$2("location")}cjs$6.getLocationOrThrow=getLocationOrThrow$2;var getLocation_1$1=cjs$6.getLocation=getLocation$2;function getCryptoOrThrow$2(){return getFromWindowOrThrow$2("crypto")}function getCrypto$2(){return getFromWindow$2("crypto")}function getLocalStorageOrThrow$2(){return getFromWindowOrThrow$2("localStorage")}function getLocalStorage$2(){return getFromWindow$2("localStorage")}cjs$6.getCryptoOrThrow=getCryptoOrThrow$2,cjs$6.getCrypto=getCrypto$2,cjs$6.getLocalStorageOrThrow=getLocalStorageOrThrow$2,cjs$6.getLocalStorage=getLocalStorage$2;var cjs$5={};Object.defineProperty(cjs$5,"__esModule",{value:!0}),cjs$5.getWindowMetadata=void 0;const window_getters_1$2=cjs$6;function getWindowMetadata$2(){let e,t;try{e=window_getters_1$2.getDocumentOrThrow(),t=window_getters_1$2.getLocationOrThrow()}catch(e2){return null}function r(...t){const r=e.getElementsByTagName("meta");for(let e=0;e<r.length;e++){const n=r[e],o=["itemprop","property","name"].map((e=>n.getAttribute(e))).filter((e=>!!e&&t.includes(e)));if(o.length&&o){const e=n.getAttribute("content");if(e)return e}}return""}const n=function(){let t=r("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}();return{description:r("description","og:description","twitter:description","keywords"),url:t.origin,icons:function(){const r=e.getElementsByTagName("link"),n=[];for(let e=0;e<r.length;e++){const o=r[e],i=o.getAttribute("rel");if(i&&i.toLowerCase().indexOf("icon")>-1){const e=o.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let r=t.protocol+"//"+t.host;if(0===e.indexOf("/"))r+=e;else{const n=t.pathname.split("/");n.pop();r+=n.join("/")+"/"+e}n.push(r)}else if(0===e.indexOf("//")){const r=t.protocol+e;n.push(r)}else n.push(e)}}return n}(),name:n}}cjs$5.getWindowMetadata=getWindowMetadata$2;var queryString={},strictUriEncode=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)),token="%[a-f0-9]{2}",singleMatcher=new RegExp("("+token+")|([^%]+?)","gi"),multiMatcher=new RegExp("("+token+")+","gi");function decodeComponents(e,t){try{return[decodeURIComponent(e.join(""))]}catch(o){}if(1===e.length)return e;t=t||1;var r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],decodeComponents(r),decodeComponents(n))}function decode(e){try{return decodeURIComponent(e)}catch(n){for(var t=e.match(singleMatcher)||[],r=1;r<t.length;r++)t=(e=decodeComponents(t,r).join("")).match(singleMatcher)||[];return e}}function customDecodeURIComponent(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},r=multiMatcher.exec(e);r;){try{t[r[0]]=decodeURIComponent(r[0])}catch(s){var n=decode(r[0]);n!==r[0]&&(t[r[0]]=n)}r=multiMatcher.exec(e)}t["%C2"]="�";for(var o=Object.keys(t),i=0;i<o.length;i++){var a=o[i];e=e.replace(new RegExp(a,"g"),t[a])}return e}var decodeUriComponent=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return customDecodeURIComponent(e)}},splitOnFirst=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const r=e.indexOf(t);return-1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]},filterObj=function(e,t){for(var r={},n=Object.keys(e),o=Array.isArray(t),i=0;i<n.length;i++){var a=n[i],s=e[a];(o?-1!==t.indexOf(a):t(a,s,e))&&(r[a]=s)}return r};function createCommonjsModule(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return commonjsRequire(e,null==t?r.path:t)}},r.exports),r.exports}function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}!function(e){const t=strictUriEncode,r=decodeUriComponent,n=splitOnFirst,o=filterObj,i=Symbol("encodeFragmentIdentifier");function a(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function s(e,r){return r.encode?r.strict?t(e):encodeURIComponent(e):e}function c(e,t){return t.decode?r(e):e}function u(e){return Array.isArray(e)?e.sort():"object"==typeof e?u(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function l(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function d(e){const t=(e=l(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function f(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function h(e,t){a((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):n[e]=r};case"bracket":return(e,r,n)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"colon-list-separator":return(e,r,n)=>{t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"comma":case"separator":return(t,r,n)=>{const o="string"==typeof r&&r.includes(e.arrayFormatSeparator),i="string"==typeof r&&!o&&c(r,e).includes(e.arrayFormatSeparator);r=i?c(r,e):r;const a=o||i?r.split(e.arrayFormatSeparator).map((t=>c(t,e))):null===r?r:c(r,e);n[t]=a};case"bracket-separator":return(t,r,n)=>{const o=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!o)return void(n[t]=r?c(r,e):r);const i=null===r?[]:r.split(e.arrayFormatSeparator).map((t=>c(t,e)));void 0!==n[t]?n[t]=[].concat(n[t],i):n[t]=i};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),o=Object.create(null);if("string"!=typeof e)return o;if(!(e=e.trim().replace(/^[?#&]/,"")))return o;for(const i of e.split("&")){if(""===i)continue;let[e,a]=n(t.decode?i.replace(/\+/g," "):i,"=");a=void 0===a?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?a:c(a,t),r(c(e,t),a,o)}for(const n of Object.keys(o)){const e=o[n];if("object"==typeof e&&null!==e)for(const r of Object.keys(e))e[r]=f(e[r],t);else o[n]=f(e,t)}return!1===t.sort?o:(!0===t.sort?Object.keys(o).sort():Object.keys(o).sort(t.sort)).reduce(((e,t)=>{const r=o[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=u(r):e[t]=r,e}),Object.create(null))}e.extract=d,e.parse=h,e.stringify=(e,t)=>{if(!e)return"";a((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const o=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[s(t,e),"[",o,"]"].join("")]:[...r,[s(t,e),"[",s(o,e),"]=",s(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[s(t,e),"[]"].join("")]:[...r,[s(t,e),"[]=",s(n,e)].join("")];case"colon-list-separator":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[s(t,e),":list="].join("")]:[...r,[s(t,e),":list=",s(n,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return r=>(n,o)=>void 0===o||e.skipNull&&null===o||e.skipEmptyString&&""===o?n:(o=null===o?"":o,0===n.length?[[s(r,e),t,s(o,e)].join("")]:[[n,s(o,e)].join(e.arrayFormatSeparator)])}default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,s(t,e)]:[...r,[s(t,e),"=",s(n,e)].join("")]}}(t),o={};for(const a of Object.keys(e))r(a)||(o[a]=e[a]);const i=Object.keys(o);return!1!==t.sort&&i.sort(t.sort),i.map((r=>{const o=e[r];return void 0===o?"":null===o?s(r,t):Array.isArray(o)?0===o.length&&"bracket-separator"===t.arrayFormat?s(r,t)+"[]":o.reduce(n(r),[]).join("&"):s(r,t)+"="+s(o,t)})).filter((e=>e.length>0)).join("&")},e.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,o]=n(e,"#");return Object.assign({url:r.split("?")[0]||"",query:h(d(e),t)},t&&t.parseFragmentIdentifier&&o?{fragmentIdentifier:c(o,t)}:{})},e.stringifyUrl=(t,r)=>{r=Object.assign({encode:!0,strict:!0,[i]:!0},r);const n=l(t.url).split("?")[0]||"",o=e.extract(t.url),a=e.parse(o,{sort:!1}),c=Object.assign(a,t.query);let u=e.stringify(c,r);u&&(u=`?${u}`);let d=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(t.url);return t.fragmentIdentifier&&(d=`#${r[i]?s(t.fragmentIdentifier,r):t.fragmentIdentifier}`),`${n}${u}${d}`},e.pick=(t,r,n)=>{n=Object.assign({parseFragmentIdentifier:!0,[i]:!1},n);const{url:a,query:s,fragmentIdentifier:c}=e.parseUrl(t,n);return e.stringifyUrl({url:a,query:o(s,r),fragmentIdentifier:c},n)},e.exclude=(t,r,n)=>{const o=Array.isArray(r)?e=>!r.includes(e):(e,t)=>!r(e,t);return e.pick(t,o,n)}}(queryString);var minimalisticAssert=assert$i;function assert$i(e,t){if(!e)throw new Error(t||"Assertion failed")}assert$i.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var utils_1=createCommonjsModule((function(e,t){var r=t;function n(e){return 1===e.length?"0"+e:e}function o(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(n=0;n<e.length;n++){var o=e.charCodeAt(n),i=o>>8,a=255&o;i?r.push(i,a):r.push(a)}return r},r.zero2=n,r.toHex=o,r.encode=function(e,t){return"hex"===t?o(e):e}})),utils_1$1=createCommonjsModule((function(e,t){var r=t;r.assert=minimalisticAssert,r.toArray=utils_1.toArray,r.zero2=utils_1.zero2,r.toHex=utils_1.toHex,r.encode=utils_1.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var o=1<<t+1,i=e.clone(),a=0;a<n.length;a++){var s,c=i.andln(o-1);i.isOdd()?(s=c>(o>>1)-1?(o>>1)-c:c,i.isubn(s)):s=0,n[a]=s,i.iushrn(1)}return n},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,o=0,i=0;e.cmpn(-o)>0||t.cmpn(-i)>0;){var a,s,c=e.andln(3)+o&3,u=t.andln(3)+i&3;3===c&&(c=-1),3===u&&(u=-1),a=1&c?3!==(n=e.andln(7)+o&7)&&5!==n||2!==u?c:-c:0,r[0].push(a),s=1&u?3!==(n=t.andln(7)+i&7)&&5!==n||2!==c?u:-u:0,r[1].push(s),2*o===a+1&&(o=1-o),2*i===s+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r},r.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new BN$o(e,"hex","le")}})),getNAF$2=utils_1$1.getNAF,getJSF$2=utils_1$1.getJSF,assert$1$1=utils_1$1.assert;function BaseCurve$2(e,t){this.type=e,this.p=new BN$o(t.p,16),this.red=t.prime?BN$o.red(t.prime):BN$o.mont(this.p),this.zero=new BN$o(0).toRed(this.red),this.one=new BN$o(1).toRed(this.red),this.two=new BN$o(2).toRed(this.red),this.n=t.n&&new BN$o(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base$2=BaseCurve$2;function BasePoint$2(e,t){this.curve=e,this.type=t,this.precomputed=null}BaseCurve$2.prototype.point=function(){throw new Error("Not implemented")},BaseCurve$2.prototype.validate=function(){throw new Error("Not implemented")},BaseCurve$2.prototype._fixedNafMul=function(e,t){assert$1$1(e.precomputed);var r=e._getDoubles(),n=getNAF$2(t,1,this._bitLength),o=(1<<r.step+1)-(r.step%2==0?2:1);o/=3;var i,a,s=[];for(i=0;i<n.length;i+=r.step){a=0;for(var c=i+r.step-1;c>=i;c--)a=(a<<1)+n[c];s.push(a)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=o;d>0;d--){for(i=0;i<s.length;i++)(a=s[i])===d?l=l.mixedAdd(r.points[i]):a===-d&&(l=l.mixedAdd(r.points[i].neg()));u=u.add(l)}return u.toP()},BaseCurve$2.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var o=n.points,i=getNAF$2(t,r,this._bitLength),a=this.jpoint(null,null,null),s=i.length-1;s>=0;s--){for(var c=0;s>=0&&0===i[s];s--)c++;if(s>=0&&c++,a=a.dblp(c),s<0)break;var u=i[s];assert$1$1(0!==u),a="affine"===e.type?u>0?a.mixedAdd(o[u-1>>1]):a.mixedAdd(o[-u-1>>1].neg()):u>0?a.add(o[u-1>>1]):a.add(o[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},BaseCurve$2.prototype._wnafMulAdd=function(e,t,r,n,o){var i,a,s,c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,d=0;for(i=0;i<n;i++){var f=(s=t[i])._getNAFPoints(e);c[i]=f.wnd,u[i]=f.points}for(i=n-1;i>=1;i-=2){var h=i-1,p=i;if(1===c[h]&&1===c[p]){var y=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(y[1]=t[h].add(t[p]),y[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(y[1]=t[h].toJ().mixedAdd(t[p]),y[2]=t[h].add(t[p].neg())):(y[1]=t[h].toJ().mixedAdd(t[p]),y[2]=t[h].toJ().mixedAdd(t[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=getJSF$2(r[h],r[p]);for(d=Math.max(g[0].length,d),l[h]=new Array(d),l[p]=new Array(d),a=0;a<d;a++){var b=0|g[0][a],v=0|g[1][a];l[h][a]=m[3*(b+1)+(v+1)],l[p][a]=0,u[h]=y}}else l[h]=getNAF$2(r[h],c[h],this._bitLength),l[p]=getNAF$2(r[p],c[p],this._bitLength),d=Math.max(l[h].length,d),d=Math.max(l[p].length,d)}var w=this.jpoint(null,null,null),_=this._wnafT4;for(i=d;i>=0;i--){for(var I=0;i>=0;){var T=!0;for(a=0;a<n;a++)_[a]=0|l[a][i],0!==_[a]&&(T=!1);if(!T)break;I++,i--}if(i>=0&&I++,w=w.dblp(I),i<0)break;for(a=0;a<n;a++){var k=_[a];0!==k&&(k>0?s=u[a][k-1>>1]:k<0&&(s=u[a][-k-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(i=0;i<n;i++)u[i]=null;return o?w:w.toP()},BaseCurve$2.BasePoint=BasePoint$2,BasePoint$2.prototype.eq=function(){throw new Error("Not implemented")},BasePoint$2.prototype.validate=function(){return this.curve.validate(this)},BaseCurve$2.prototype.decodePoint=function(e,t){e=utils_1$1.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?assert$1$1(e[e.length-1]%2==0):7===e[0]&&assert$1$1(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},BasePoint$2.prototype.encodeCompressed=function(e){return this.encode(e,!0)},BasePoint$2.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},BasePoint$2.prototype.encode=function(e,t){return utils_1$1.encode(this._encode(t),e)},BasePoint$2.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},BasePoint$2.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},BasePoint$2.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,o=0;o<t;o+=e){for(var i=0;i<e;i++)n=n.dbl();r.push(n)}return{step:e,points:r}},BasePoint$2.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),o=1;o<r;o++)t[o]=t[o-1].add(n);return{wnd:e,points:t}},BasePoint$2.prototype._getBeta=function(){return null},BasePoint$2.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var inherits_browser=createCommonjsModule((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}})),assert$2$1=utils_1$1.assert;function ShortCurve$2(e){base$2.call(this,"short",e),this.a=new BN$o(e.a,16).toRed(this.red),this.b=new BN$o(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}inherits_browser(ShortCurve$2,base$2);var short_1=ShortCurve$2;function Point$6(e,t,r,n){base$2.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new BN$o(t,16),this.y=new BN$o(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function JPoint$2(e,t,r,n){base$2.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$o(0)):(this.x=new BN$o(t,16),this.y=new BN$o(r,16),this.z=new BN$o(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}ShortCurve$2.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new BN$o(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new BN$o(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],assert$2$1(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new BN$o(e.a,16),b:new BN$o(e.b,16)}})):this._getEndoBasis(r)}}},ShortCurve$2.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:BN$o.mont(e),r=new BN$o(2).toRed(t).redInvm(),n=r.redNeg(),o=new BN$o(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},ShortCurve$2.prototype._getEndoBasis=function(e){for(var t,r,n,o,i,a,s,c,u,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,f=this.n.clone(),h=new BN$o(1),p=new BN$o(0),y=new BN$o(0),m=new BN$o(1),g=0;0!==d.cmpn(0);){var b=f.div(d);c=f.sub(b.mul(d)),u=y.sub(b.mul(h));var v=m.sub(b.mul(p));if(!n&&c.cmp(l)<0)t=s.neg(),r=h,n=c.neg(),o=u;else if(n&&2==++g)break;s=c,f=d,d=c,y=h,h=u,m=p,p=v}i=c.neg(),a=u;var w=n.sqr().add(o.sqr());return i.sqr().add(a.sqr()).cmp(w)>=0&&(i=t,a=r),n.negative&&(n=n.neg(),o=o.neg()),i.negative&&(i=i.neg(),a=a.neg()),[{a:n,b:o},{a:i,b:a}]},ShortCurve$2.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],o=n.b.mul(e).divRound(this.n),i=r.b.neg().mul(e).divRound(this.n),a=o.mul(r.a),s=i.mul(n.a),c=o.mul(r.b),u=i.mul(n.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},ShortCurve$2.prototype.pointFromX=function(e,t){(e=new BN$o(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(t&&!o||!t&&o)&&(n=n.redNeg()),this.point(e,n)},ShortCurve$2.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(o).cmpn(0)},ShortCurve$2.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,o=this._endoWnafT2,i=0;i<e.length;i++){var a=this._endoSplit(t[i]),s=e[i],c=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),c=c.neg(!0)),n[2*i]=s,n[2*i+1]=c,o[2*i]=a.k1,o[2*i+1]=a.k2}for(var u=this._wnafMulAdd(1,n,o,2*i,r),l=0;l<2*i;l++)n[l]=null,o[l]=null;return u},inherits_browser(Point$6,base$2.BasePoint),ShortCurve$2.prototype.point=function(e,t,r){return new Point$6(this,e,t,r)},ShortCurve$2.prototype.pointFromJSON=function(e,t){return Point$6.fromJSON(this,e,t)},Point$6.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Point$6.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Point$6.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function o(t){return e.point(t[0],t[1],r)}var i=t[2];return n.precomputed={beta:null,doubles:i.doubles&&{step:i.doubles.step,points:[n].concat(i.doubles.points.map(o))},naf:i.naf&&{wnd:i.naf.wnd,points:[n].concat(i.naf.points.map(o))}},n},Point$6.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Point$6.prototype.isInfinity=function(){return this.inf},Point$6.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Point$6.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),o=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),i=o.redSqr().redISub(this.x.redAdd(this.x)),a=o.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,a)},Point$6.prototype.getX=function(){return this.x.fromRed()},Point$6.prototype.getY=function(){return this.y.fromRed()},Point$6.prototype.mul=function(e){return e=new BN$o(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Point$6.prototype.mulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o):this.curve._wnafMulAdd(1,n,o,2)},Point$6.prototype.jmulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o,!0):this.curve._wnafMulAdd(1,n,o,2,!0)},Point$6.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},Point$6.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},Point$6.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},inherits_browser(JPoint$2,base$2.BasePoint),ShortCurve$2.prototype.jpoint=function(e,t,r){return new JPoint$2(this,e,t,r)},JPoint$2.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},JPoint$2.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint$2.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),o=e.x.redMul(r),i=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(o),c=i.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),d=n.redMul(u),f=c.redSqr().redIAdd(l).redISub(d).redISub(d),h=c.redMul(d.redISub(f)).redISub(i.redMul(l)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(f,h,p)},JPoint$2.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),o=this.y,i=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=o.redSub(i);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),l=r.redMul(c),d=s.redSqr().redIAdd(u).redISub(l).redISub(l),f=s.redMul(l.redISub(d)).redISub(o.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(d,f,h)},JPoint$2.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var n=this.curve.a,o=this.curve.tinv,i=this.x,a=this.y,s=this.z,c=s.redSqr().redSqr(),u=a.redAdd(a);for(t=0;t<e;t++){var l=i.redSqr(),d=u.redSqr(),f=d.redSqr(),h=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(c)),p=i.redMul(d),y=h.redSqr().redISub(p.redAdd(p)),m=p.redISub(y),g=h.redMul(m);g=g.redIAdd(g).redISub(f);var b=u.redMul(s);t+1<e&&(c=c.redMul(f)),i=y,s=b,u=g}return this.curve.jpoint(i,u.redMul(o),s)},JPoint$2.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},JPoint$2.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),i=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(n).redISub(i);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n),c=s.redSqr().redISub(a).redISub(a),u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),e=c,t=s.redMul(a.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),d=this.y.redSqr(),f=d.redSqr(),h=this.x.redAdd(d).redSqr().redISub(l).redISub(f);h=h.redIAdd(h);var p=l.redAdd(l).redIAdd(l),y=p.redSqr(),m=f.redIAdd(f);m=(m=m.redIAdd(m)).redIAdd(m),e=y.redISub(h).redISub(h),t=p.redMul(h.redISub(e)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},JPoint$2.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),i=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(n).redISub(i);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),c=s.redSqr().redISub(a).redISub(a);e=c;var u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),t=s.redMul(a.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),d=this.y.redSqr(),f=this.x.redMul(d),h=this.x.redSub(l).redMul(this.x.redAdd(l));h=h.redAdd(h).redIAdd(h);var p=f.redIAdd(f),y=(p=p.redIAdd(p)).redAdd(p);e=h.redSqr().redISub(y),r=this.y.redAdd(this.z).redSqr().redISub(d).redISub(l);var m=d.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),t=h.redMul(p.redISub(e)).redISub(m)}return this.curve.jpoint(e,t,r)},JPoint$2.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,o=n.redSqr().redSqr(),i=t.redSqr(),a=r.redSqr(),s=i.redAdd(i).redIAdd(i).redIAdd(e.redMul(o)),c=t.redAdd(t),u=(c=c.redIAdd(c)).redMul(a),l=s.redSqr().redISub(u.redAdd(u)),d=u.redISub(l),f=a.redSqr();f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var h=s.redMul(d).redISub(f),p=r.redAdd(r).redMul(n);return this.curve.jpoint(l,h,p)},JPoint$2.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),o=e.redAdd(e).redIAdd(e),i=o.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).redISub(n),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(i)).redSqr(),c=n.redIAdd(n);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var u=o.redIAdd(a).redSqr().redISub(i).redISub(s).redISub(c),l=t.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var d=this.x.redMul(s).redISub(l);d=(d=d.redIAdd(d)).redIAdd(d);var f=this.y.redMul(u.redMul(c.redISub(u)).redISub(a.redMul(s)));f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var h=this.z.redAdd(a).redSqr().redISub(r).redISub(s);return this.curve.jpoint(d,f,h)},JPoint$2.prototype.mul=function(e,t){return e=new BN$o(e,t),this.curve._wnafMul(this,e)},JPoint$2.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),o=r.redMul(e.z);return 0===this.y.redMul(o).redISub(e.y.redMul(n)).cmpn(0)},JPoint$2.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),o=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(o),0===this.x.cmp(r))return!0}},JPoint$2.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},JPoint$2.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var curve_1=createCommonjsModule((function(e,t){var r=t;r.base=base$2,r.short=short_1,r.mont=null,r.edwards=null})),curves_1=createCommonjsModule((function(e,t){var r,n=t,o=utils_1$1.assert;function i(e){"short"===e.type?this.curve=new curve_1.short(e):"edwards"===e.type?this.curve=new curve_1.edwards(e):this.curve=new curve_1.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new i(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=i,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:hash$7.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:hash$7.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:hash$7.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:hash$7.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:hash$7.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash$7.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash$7.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(e2){r=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:hash$7.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function HmacDRBG$2(e){if(!(this instanceof HmacDRBG$2))return new HmacDRBG$2(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=utils_1.toArray(e.entropy,e.entropyEnc||"hex"),r=utils_1.toArray(e.nonce,e.nonceEnc||"hex"),n=utils_1.toArray(e.pers,e.persEnc||"hex");minimalisticAssert(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var hmacDrbg=HmacDRBG$2;HmacDRBG$2.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o<this.V.length;o++)this.K[o]=0,this.V[o]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},HmacDRBG$2.prototype._hmac=function(){return new hash$7.hmac(this.hash,this.K)},HmacDRBG$2.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},HmacDRBG$2.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=utils_1.toArray(e,t),r=utils_1.toArray(r,n),minimalisticAssert(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},HmacDRBG$2.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=utils_1.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length<e;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var i=o.slice(0,e);return this._update(r),this._reseed++,utils_1.encode(i,t)};var assert$3$1=utils_1$1.assert;function KeyPair$8(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var key$4=KeyPair$8;KeyPair$8.fromPublic=function(e,t,r){return t instanceof KeyPair$8?t:new KeyPair$8(e,{pub:t,pubEnc:r})},KeyPair$8.fromPrivate=function(e,t,r){return t instanceof KeyPair$8?t:new KeyPair$8(e,{priv:t,privEnc:r})},KeyPair$8.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},KeyPair$8.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},KeyPair$8.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},KeyPair$8.prototype._importPrivate=function(e,t){this.priv=new BN$o(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},KeyPair$8.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?assert$3$1(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||assert$3$1(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},KeyPair$8.prototype.derive=function(e){return e.validate()||assert$3$1(e.validate(),"public point not validated"),e.mul(this.priv).getX()},KeyPair$8.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},KeyPair$8.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},KeyPair$8.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var assert$4$1=utils_1$1.assert;function Signature$8(e,t){if(e instanceof Signature$8)return e;this._importDER(e,t)||(assert$4$1(e.r&&e.s,"Signature without r or s"),this.r=new BN$o(e.r,16),this.s=new BN$o(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var signature$4=Signature$8;function Position$2(){this.place=0}function getLength$2(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var o=0,i=0,a=t.place;i<n;i++,a++)o<<=8,o|=e[a],o>>>=0;return!(o<=127)&&(t.place=a,o)}function rmPadding$2(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function constructLength$2(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}Signature$8.prototype._importDER=function(e,t){e=utils_1$1.toArray(e,t);var r=new Position$2;if(48!==e[r.place++])return!1;var n=getLength$2(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var o=getLength$2(e,r);if(!1===o)return!1;var i=e.slice(r.place,o+r.place);if(r.place+=o,2!==e[r.place++])return!1;var a=getLength$2(e,r);if(!1===a)return!1;if(e.length!==a+r.place)return!1;var s=e.slice(r.place,a+r.place);if(0===i[0]){if(!(128&i[1]))return!1;i=i.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new BN$o(i),this.s=new BN$o(s),this.recoveryParam=null,!0},Signature$8.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=rmPadding$2(t),r=rmPadding$2(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];constructLength$2(n,t.length),(n=n.concat(t)).push(2),constructLength$2(n,r.length);var o=n.concat(r),i=[48];return constructLength$2(i,o.length),i=i.concat(o),utils_1$1.encode(i,e)};var rand$2=function(){throw new Error("unsupported")},assert$5$1=utils_1$1.assert;function EC$2(e){if(!(this instanceof EC$2))return new EC$2(e);"string"==typeof e&&(assert$5$1(Object.prototype.hasOwnProperty.call(curves_1,e),"Unknown curve "+e),e=curves_1[e]),e instanceof curves_1.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var ec$2=EC$2;EC$2.prototype.keyPair=function(e){return new key$4(this,e)},EC$2.prototype.keyFromPrivate=function(e,t){return key$4.fromPrivate(this,e,t)},EC$2.prototype.keyFromPublic=function(e,t){return key$4.fromPublic(this,e,t)},EC$2.prototype.genKeyPair=function(e){e||(e={});for(var t=new hmacDrbg({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||rand$2(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new BN$o(2));;){var o=new BN$o(t.generate(r));if(!(o.cmp(n)>0))return o.iaddn(1),this.keyFromPrivate(o)}},EC$2.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},EC$2.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new BN$o(e,16));for(var o=this.n.byteLength(),i=t.getPrivate().toArray("be",o),a=e.toArray("be",o),s=new hmacDrbg({hash:this.hash,entropy:i,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(new BN$o(1)),u=0;;u++){var l=n.k?n.k(u):new BN$o(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(c)>=0)){var d=this.g.mul(l);if(!d.isInfinity()){var f=d.getX(),h=f.umod(this.n);if(0!==h.cmpn(0)){var p=l.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var y=(d.getY().isOdd()?1:0)|(0!==f.cmp(h)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),y^=1),new signature$4({r:h,s:p,recoveryParam:y})}}}}}},EC$2.prototype.verify=function(e,t,r,n){e=this._truncateToN(new BN$o(e,16)),r=this.keyFromPublic(r,n);var o=(t=new signature$4(t,"hex")).r,i=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;var a,s=i.invm(this.n),c=s.mul(e).umod(this.n),u=s.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,r.getPublic(),u)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(c,r.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},EC$2.prototype.recoverPubKey=function(e,t,r,n){assert$5$1((3&r)===r,"The recovery param is more than two bits"),t=new signature$4(t,n);var o=this.n,i=new BN$o(e),a=t.r,s=t.s,c=1&r,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var l=t.r.invm(o),d=o.sub(i).mul(l).umod(o),f=s.mul(l).umod(o);return this.g.mulAdd(d,a,f)},EC$2.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new signature$4(t,n)).recoveryParam)return t.recoveryParam;for(var o=0;o<4;o++){var i;try{i=this.recoverPubKey(e,t,o)}catch(a){continue}if(i.eq(r))return o}throw new Error("Unable to find valid recovery factor")};var elliptic_1=createCommonjsModule((function(e,t){var r=t;r.version="6.5.4",r.utils=utils_1$1,r.rand=function(){throw new Error("unsupported")},r.curve=curve_1,r.curves=curves_1,r.ec=ec$2,r.eddsa=null})),EC$1$1=elliptic_1.ec;const version$4="signing-key/5.7.0",logger=new Logger$1(version$4);let _curve=null;function getCurve(){return _curve||(_curve=new EC$1$1("secp256k1")),_curve}class SigningKey{constructor(e){defineReadOnly(this,"curve","secp256k1"),defineReadOnly(this,"privateKey",hexlify(e)),32!==hexDataLength(this.privateKey)&&logger.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=getCurve().keyFromPrivate(arrayify(this.privateKey));defineReadOnly(this,"publicKey","0x"+t.getPublic(!1,"hex")),defineReadOnly(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),defineReadOnly(this,"_isSigningKey",!0)}_addPoint(e){const t=getCurve().keyFromPublic(arrayify(this.publicKey)),r=getCurve().keyFromPublic(arrayify(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=getCurve().keyFromPrivate(arrayify(this.privateKey)),r=arrayify(e);32!==r.length&&logger.throwArgumentError("bad digest length","digest",e);const n=t.sign(r,{canonical:!0});return splitSignature({recoveryParam:n.recoveryParam,r:hexZeroPad("0x"+n.r.toString(16),32),s:hexZeroPad("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=getCurve().keyFromPrivate(arrayify(this.privateKey)),r=getCurve().keyFromPublic(arrayify(computePublicKey(e)));return hexZeroPad("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function recoverPublicKey(e,t){const r=splitSignature(t),n={r:arrayify(r.r),s:arrayify(r.s)};return"0x"+getCurve().recoverPubKey(arrayify(e),n,r.recoveryParam).encode("hex",!1)}function computePublicKey(e,t){const r=arrayify(e);if(32===r.length){return new SigningKey(r).publicKey}return 33===r.length?"0x"+getCurve().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?hexlify(r):logger.throwArgumentError("invalid public or private key","key","[REDACTED]")}var TransactionTypes,TransactionTypes2;function computeAddress(e){return getAddress(hexDataSlice(keccak256$1(hexDataSlice(computePublicKey(e),1)),12))}function recoverAddress(e,t){return computeAddress(recoverPublicKey(arrayify(e),t))}TransactionTypes2=TransactionTypes||(TransactionTypes={}),TransactionTypes2[TransactionTypes2.legacy=0]="legacy",TransactionTypes2[TransactionTypes2.eip2930=1]="eip2930",TransactionTypes2[TransactionTypes2.eip1559=2]="eip1559";var chacha20poly1305={},chacha={};Object.defineProperty(chacha,"__esModule",{value:!0});var binary_1=binary,wipe_1$2=wipe$1,ROUNDS=20;function core(e,t,r){for(var n=1634760805,o=857760878,i=2036477234,a=1797285236,s=r[3]<<24|r[2]<<16|r[1]<<8|r[0],c=r[7]<<24|r[6]<<16|r[5]<<8|r[4],u=r[11]<<24|r[10]<<16|r[9]<<8|r[8],l=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],f=r[23]<<24|r[22]<<16|r[21]<<8|r[20],h=r[27]<<24|r[26]<<16|r[25]<<8|r[24],p=r[31]<<24|r[30]<<16|r[29]<<8|r[28],y=t[3]<<24|t[2]<<16|t[1]<<8|t[0],m=t[7]<<24|t[6]<<16|t[5]<<8|t[4],g=t[11]<<24|t[10]<<16|t[9]<<8|t[8],b=t[15]<<24|t[14]<<16|t[13]<<8|t[12],v=n,w=o,_=i,I=a,T=s,k=c,$=u,S=l,A=d,E=f,C=h,R=p,O=y,N=m,P=g,M=b,B=0;B<ROUNDS;B+=2)T=(T^=A=A+(O=(O^=v=v+T|0)>>>16|O<<16)|0)>>>20|T<<12,k=(k^=E=E+(N=(N^=w=w+k|0)>>>16|N<<16)|0)>>>20|k<<12,$=($^=C=C+(P=(P^=_=_+$|0)>>>16|P<<16)|0)>>>20|$<<12,S=(S^=R=R+(M=(M^=I=I+S|0)>>>16|M<<16)|0)>>>20|S<<12,$=($^=C=C+(P=(P^=_=_+$|0)>>>24|P<<8)|0)>>>25|$<<7,S=(S^=R=R+(M=(M^=I=I+S|0)>>>24|M<<8)|0)>>>25|S<<7,k=(k^=E=E+(N=(N^=w=w+k|0)>>>24|N<<8)|0)>>>25|k<<7,T=(T^=A=A+(O=(O^=v=v+T|0)>>>24|O<<8)|0)>>>25|T<<7,k=(k^=C=C+(M=(M^=v=v+k|0)>>>16|M<<16)|0)>>>20|k<<12,$=($^=R=R+(O=(O^=w=w+$|0)>>>16|O<<16)|0)>>>20|$<<12,S=(S^=A=A+(N=(N^=_=_+S|0)>>>16|N<<16)|0)>>>20|S<<12,T=(T^=E=E+(P=(P^=I=I+T|0)>>>16|P<<16)|0)>>>20|T<<12,S=(S^=A=A+(N=(N^=_=_+S|0)>>>24|N<<8)|0)>>>25|S<<7,T=(T^=E=E+(P=(P^=I=I+T|0)>>>24|P<<8)|0)>>>25|T<<7,$=($^=R=R+(O=(O^=w=w+$|0)>>>24|O<<8)|0)>>>25|$<<7,k=(k^=C=C+(M=(M^=v=v+k|0)>>>24|M<<8)|0)>>>25|k<<7;binary_1.writeUint32LE(v+n|0,e,0),binary_1.writeUint32LE(w+o|0,e,4),binary_1.writeUint32LE(_+i|0,e,8),binary_1.writeUint32LE(I+a|0,e,12),binary_1.writeUint32LE(T+s|0,e,16),binary_1.writeUint32LE(k+c|0,e,20),binary_1.writeUint32LE($+u|0,e,24),binary_1.writeUint32LE(S+l|0,e,28),binary_1.writeUint32LE(A+d|0,e,32),binary_1.writeUint32LE(E+f|0,e,36),binary_1.writeUint32LE(C+h|0,e,40),binary_1.writeUint32LE(R+p|0,e,44),binary_1.writeUint32LE(O+y|0,e,48),binary_1.writeUint32LE(N+m|0,e,52),binary_1.writeUint32LE(P+g|0,e,56),binary_1.writeUint32LE(M+b|0,e,60)}function streamXOR(e,t,r,n,o){if(void 0===o&&(o=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<r.length)throw new Error("ChaCha: destination is shorter than source");var i,a;if(0===o){if(8!==t.length&&12!==t.length)throw new Error("ChaCha nonce must be 8 or 12 bytes");a=(i=new Uint8Array(16)).length-t.length,i.set(t,a)}else{if(16!==t.length)throw new Error("ChaCha nonce with counter must be 16 bytes");i=t,a=o}for(var s=new Uint8Array(64),c=0;c<r.length;c+=64){core(s,i,e);for(var u=c;u<c+64&&u<r.length;u++)n[u]=r[u]^s[u-c];incrementCounter(i,0,a)}return wipe_1$2.wipe(s),0===o&&wipe_1$2.wipe(i),n}function stream(e,t,r,n){return void 0===n&&(n=0),wipe_1$2.wipe(r),streamXOR(e,t,r,r,n)}function incrementCounter(e,t,r){for(var n=1;r--;)n=n+(255&e[t])|0,e[t]=255&n,n>>>=8,t++;if(n>0)throw new Error("ChaCha: counter overflow")}chacha.streamXOR=streamXOR,chacha.stream=stream;var poly1305={},constantTime={};function select(e,t,r){return~(e-1)&t|e-1&r}function lessOrEqual(e,t){return(0|e)-(0|t)-1>>>31&1}function compare(e,t){if(e.length!==t.length)return 0;for(var r=0,n=0;n<e.length;n++)r|=e[n]^t[n];return 1&r-1>>>8}function equal(e,t){return 0!==e.length&&0!==t.length&&0!==compare(e,t)}Object.defineProperty(constantTime,"__esModule",{value:!0}),constantTime.select=select,constantTime.lessOrEqual=lessOrEqual,constantTime.compare=compare,constantTime.equal=equal,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=constantTime,r=wipe$1;e.DIGEST_LENGTH=16;var n=function(){function t(t){this.digestLength=e.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=t[0]|t[1]<<8;this._r[0]=8191&r;var n=t[2]|t[3]<<8;this._r[1]=8191&(r>>>13|n<<3);var o=t[4]|t[5]<<8;this._r[2]=7939&(n>>>10|o<<6);var i=t[6]|t[7]<<8;this._r[3]=8191&(o>>>7|i<<9);var a=t[8]|t[9]<<8;this._r[4]=255&(i>>>4|a<<12),this._r[5]=a>>>1&8190;var s=t[10]|t[11]<<8;this._r[6]=8191&(a>>>14|s<<2);var c=t[12]|t[13]<<8;this._r[7]=8065&(s>>>11|c<<5);var u=t[14]|t[15]<<8;this._r[8]=8191&(c>>>8|u<<8),this._r[9]=u>>>5&127,this._pad[0]=t[16]|t[17]<<8,this._pad[1]=t[18]|t[19]<<8,this._pad[2]=t[20]|t[21]<<8,this._pad[3]=t[22]|t[23]<<8,this._pad[4]=t[24]|t[25]<<8,this._pad[5]=t[26]|t[27]<<8,this._pad[6]=t[28]|t[29]<<8,this._pad[7]=t[30]|t[31]<<8}return t.prototype._blocks=function(e,t,r){for(var n=this._fin?0:2048,o=this._h[0],i=this._h[1],a=this._h[2],s=this._h[3],c=this._h[4],u=this._h[5],l=this._h[6],d=this._h[7],f=this._h[8],h=this._h[9],p=this._r[0],y=this._r[1],m=this._r[2],g=this._r[3],b=this._r[4],v=this._r[5],w=this._r[6],_=this._r[7],I=this._r[8],T=this._r[9];r>=16;){var k=e[t+0]|e[t+1]<<8;o+=8191&k;var $=e[t+2]|e[t+3]<<8;i+=8191&(k>>>13|$<<3);var S=e[t+4]|e[t+5]<<8;a+=8191&($>>>10|S<<6);var A=e[t+6]|e[t+7]<<8;s+=8191&(S>>>7|A<<9);var E=e[t+8]|e[t+9]<<8;c+=8191&(A>>>4|E<<12),u+=E>>>1&8191;var C=e[t+10]|e[t+11]<<8;l+=8191&(E>>>14|C<<2);var R=e[t+12]|e[t+13]<<8;d+=8191&(C>>>11|R<<5);var O=e[t+14]|e[t+15]<<8,N=0,P=N;P+=o*p,P+=i*(5*T),P+=a*(5*I),P+=s*(5*_),N=(P+=c*(5*w))>>>13,P&=8191,P+=u*(5*v),P+=l*(5*b),P+=d*(5*g),P+=(f+=8191&(R>>>8|O<<8))*(5*m);var M=N+=(P+=(h+=O>>>5|n)*(5*y))>>>13;M+=o*y,M+=i*p,M+=a*(5*T),M+=s*(5*I),N=(M+=c*(5*_))>>>13,M&=8191,M+=u*(5*w),M+=l*(5*v),M+=d*(5*b),M+=f*(5*g),N+=(M+=h*(5*m))>>>13,M&=8191;var B=N;B+=o*m,B+=i*y,B+=a*p,B+=s*(5*T),N=(B+=c*(5*I))>>>13,B&=8191,B+=u*(5*_),B+=l*(5*w),B+=d*(5*v),B+=f*(5*b);var D=N+=(B+=h*(5*g))>>>13;D+=o*g,D+=i*m,D+=a*y,D+=s*p,N=(D+=c*(5*T))>>>13,D&=8191,D+=u*(5*I),D+=l*(5*_),D+=d*(5*w),D+=f*(5*v);var x=N+=(D+=h*(5*b))>>>13;x+=o*b,x+=i*g,x+=a*m,x+=s*y,N=(x+=c*p)>>>13,x&=8191,x+=u*(5*T),x+=l*(5*I),x+=d*(5*_),x+=f*(5*w);var L=N+=(x+=h*(5*v))>>>13;L+=o*v,L+=i*b,L+=a*g,L+=s*m,N=(L+=c*y)>>>13,L&=8191,L+=u*p,L+=l*(5*T),L+=d*(5*I),L+=f*(5*_);var U=N+=(L+=h*(5*w))>>>13;U+=o*w,U+=i*v,U+=a*b,U+=s*g,N=(U+=c*m)>>>13,U&=8191,U+=u*y,U+=l*p,U+=d*(5*T),U+=f*(5*I);var j=N+=(U+=h*(5*_))>>>13;j+=o*_,j+=i*w,j+=a*v,j+=s*b,N=(j+=c*g)>>>13,j&=8191,j+=u*m,j+=l*y,j+=d*p,j+=f*(5*T);var F=N+=(j+=h*(5*I))>>>13;F+=o*I,F+=i*_,F+=a*w,F+=s*v,N=(F+=c*b)>>>13,F&=8191,F+=u*g,F+=l*m,F+=d*y,F+=f*p;var q=N+=(F+=h*(5*T))>>>13;q+=o*T,q+=i*I,q+=a*_,q+=s*w,N=(q+=c*v)>>>13,q&=8191,q+=u*b,q+=l*g,q+=d*m,q+=f*y,o=P=8191&(N=(N=((N+=(q+=h*p)>>>13)<<2)+N|0)+(P&=8191)|0),i=M+=N>>>=13,a=B&=8191,s=D&=8191,c=x&=8191,u=L&=8191,l=U&=8191,d=j&=8191,f=F&=8191,h=q&=8191,t+=16,r-=16}this._h[0]=o,this._h[1]=i,this._h[2]=a,this._h[3]=s,this._h[4]=c,this._h[5]=u,this._h[6]=l,this._h[7]=d,this._h[8]=f,this._h[9]=h},t.prototype.finish=function(e,t){void 0===t&&(t=0);var r,n,o,i,a=new Uint16Array(10);if(this._leftover){for(i=this._leftover,this._buffer[i++]=1;i<16;i++)this._buffer[i]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(r=this._h[1]>>>13,this._h[1]&=8191,i=2;i<10;i++)this._h[i]+=r,r=this._h[i]>>>13,this._h[i]&=8191;for(this._h[0]+=5*r,r=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=r,r=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=r,a[0]=this._h[0]+5,r=a[0]>>>13,a[0]&=8191,i=1;i<10;i++)a[i]=this._h[i]+r,r=a[i]>>>13,a[i]&=8191;for(a[9]-=8192,n=(1^r)-1,i=0;i<10;i++)a[i]&=n;for(n=~n,i=0;i<10;i++)this._h[i]=this._h[i]&n|a[i];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),o=this._h[0]+this._pad[0],this._h[0]=65535&o,i=1;i<8;i++)o=(this._h[i]+this._pad[i]|0)+(o>>>16)|0,this._h[i]=65535&o;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var t,r=0,n=e.length;if(this._leftover){(t=16-this._leftover)>n&&(t=n);for(var o=0;o<t;o++)this._buffer[this._leftover+o]=e[r+o];if(n-=t,r+=t,this._leftover+=t,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(n>=16&&(t=n-n%16,this._blocks(e,r,t),r+=t,n-=t),n){for(o=0;o<n;o++)this._buffer[this._leftover+o]=e[r+o];this._leftover+=n}return this},t.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var e=new Uint8Array(16);return this.finish(e),e},t.prototype.clean=function(){return r.wipe(this._buffer),r.wipe(this._r),r.wipe(this._h),r.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},t}();e.Poly1305=n,e.oneTimeAuth=function(e,t){var r=new n(e);r.update(t);var o=r.digest();return r.clean(),o},e.equal=function(r,n){return r.length===e.DIGEST_LENGTH&&n.length===e.DIGEST_LENGTH&&t.equal(r,n)}}(poly1305),function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=chacha,r=poly1305,n=wipe$1,o=binary,i=constantTime;e.KEY_LENGTH=32,e.NONCE_LENGTH=12,e.TAG_LENGTH=16;var a=new Uint8Array(16),s=function(){function s(t){if(this.nonceLength=e.NONCE_LENGTH,this.tagLength=e.TAG_LENGTH,t.length!==e.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(t)}return s.prototype.seal=function(e,r,o,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var a=new Uint8Array(16);a.set(e,a.length-e.length);var s=new Uint8Array(32);t.stream(this._key,a,s,4);var c,u=r.length+this.tagLength;if(i){if(i.length!==u)throw new Error("ChaCha20Poly1305: incorrect destination length");c=i}else c=new Uint8Array(u);return t.streamXOR(this._key,a,r,c,4),this._authenticate(c.subarray(c.length-this.tagLength,c.length),s,c.subarray(0,c.length-this.tagLength),o),n.wipe(a),c},s.prototype.open=function(e,r,o,a){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(r.length<this.tagLength)return null;var s=new Uint8Array(16);s.set(e,s.length-e.length);var c=new Uint8Array(32);t.stream(this._key,s,c,4);var u=new Uint8Array(this.tagLength);if(this._authenticate(u,c,r.subarray(0,r.length-this.tagLength),o),!i.equal(u,r.subarray(r.length-this.tagLength,r.length)))return null;var l,d=r.length-this.tagLength;if(a){if(a.length!==d)throw new Error("ChaCha20Poly1305: incorrect destination length");l=a}else l=new Uint8Array(d);return t.streamXOR(this._key,s,r.subarray(0,r.length-this.tagLength),l,4),n.wipe(s),l},s.prototype.clean=function(){return n.wipe(this._key),this},s.prototype._authenticate=function(e,t,i,s){var c=new r.Poly1305(t);s&&(c.update(s),s.length%16>0&&c.update(a.subarray(s.length%16))),c.update(i),i.length%16>0&&c.update(a.subarray(i.length%16));var u=new Uint8Array(8);s&&o.writeUint64LE(s.length,u),c.update(u),o.writeUint64LE(i.length,u),c.update(u);for(var l=c.digest(),d=0;d<l.length;d++)e[d]=l[d];c.clean(),n.wipe(l),n.wipe(u)},s}();e.ChaCha20Poly1305=s}(chacha20poly1305);var hkdf={},hmac$1={},hash$2={};function isSerializableHash(e){return void 0!==e.saveState&&void 0!==e.restoreState&&void 0!==e.cleanSavedState}Object.defineProperty(hash$2,"__esModule",{value:!0}),hash$2.isSerializableHash=isSerializableHash,Object.defineProperty(hmac$1,"__esModule",{value:!0});var hash_1=hash$2,constant_time_1=constantTime,wipe_1$1=wipe$1,HMAC=function(){function e(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var r=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(r).clean():r.set(t);for(var n=0;n<r.length;n++)r[n]^=54;this._inner.update(r);for(n=0;n<r.length;n++)r[n]^=106;this._outer.update(r),hash_1.isSerializableHash(this._inner)&&hash_1.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),wipe_1$1.wipe(r)}return e.prototype.reset=function(){if(!hash_1.isSerializableHash(this._inner)||!hash_1.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.clean=function(){hash_1.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),hash_1.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},e.prototype.update=function(e){return this._inner.update(e),this},e.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e.prototype.saveState=function(){if(!hash_1.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},e.prototype.restoreState=function(e){if(!hash_1.isSerializableHash(this._inner)||!hash_1.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.cleanSavedState=function(e){if(!hash_1.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},e}();function hmac(e,t,r){var n=new HMAC(e,t);n.update(r);var o=n.digest();return n.clean(),o}hmac$1.HMAC=HMAC,hmac$1.hmac=hmac,hmac$1.equal=constant_time_1.equal,Object.defineProperty(hkdf,"__esModule",{value:!0});var hmac_1=hmac$1,wipe_1=wipe$1,HKDF=function(){function e(e,t,r,n){void 0===r&&(r=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var o=hmac_1.hmac(this._hash,r,t);this._hmac=new hmac_1.HMAC(e,o),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(0===e)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(e){for(var t=new Uint8Array(e),r=0;r<t.length;r++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[r]=this._buffer[this._bufpos++];return t},e.prototype.clean=function(){this._hmac.clean(),wipe_1.wipe(this._buffer),wipe_1.wipe(this._counter),this._bufpos=0},e}(),HKDF_1=hkdf.HKDF=HKDF,sha256={};!function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=binary,r=wipe$1;e.DIGEST_LENGTH=32,e.BLOCK_SIZE=64;var n=function(){function n(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return n.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},n.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},n.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._temp),this.reset()},n.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var r=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&t>0;)this._buffer[this._bufferLength++]=e[r++],t--;this._bufferLength===this.blockSize&&(i(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(r=i(this._temp,this._state,e,r,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[r++],t--;return this},n.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,o=r/536870912|0,a=r<<3,s=r%64<56?64:128;this._buffer[n]=128;for(var c=n+1;c<s-8;c++)this._buffer[c]=0;t.writeUint32BE(o,this._buffer,s-8),t.writeUint32BE(a,this._buffer,s-4),i(this._temp,this._state,this._buffer,0,s),this._finished=!0}for(c=0;c<this.digestLength/4;c++)t.writeUint32BE(this._state[c],e,4*c);return this},n.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},n.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},n.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},n.prototype.cleanSavedState=function(e){r.wipe(e.state),e.buffer&&r.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},n}();e.SHA256=n;var o=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function i(e,r,n,i,a){for(;a>=64;){for(var s=r[0],c=r[1],u=r[2],l=r[3],d=r[4],f=r[5],h=r[6],p=r[7],y=0;y<16;y++){var m=i+4*y;e[y]=t.readUint32BE(n,m)}for(y=16;y<64;y++){var g=e[y-2],b=(g>>>17|g<<15)^(g>>>19|g<<13)^g>>>10,v=((g=e[y-15])>>>7|g<<25)^(g>>>18|g<<14)^g>>>3;e[y]=(b+e[y-7]|0)+(v+e[y-16]|0)}for(y=0;y<64;y++){b=(((d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(d&f^~d&h)|0)+(p+(o[y]+e[y]|0)|0)|0,v=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&c^s&u^c&u)|0;p=h,h=f,f=d,d=l+b|0,l=u,u=c,c=s,s=b+v|0}r[0]+=s,r[1]+=c,r[2]+=u,r[3]+=l,r[4]+=d,r[5]+=f,r[6]+=h,r[7]+=p,i+=64,a-=64}return i}e.hash=function(e){var t=new n;t.update(e);var r=t.digest();return t.clean(),r}}(sha256);var x25519={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sharedKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.scalarMultBase=e.scalarMult=e.SHARED_KEY_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=void 0;const t=random,r=wipe$1;function n(e){const t=new Float64Array(16);if(e)for(let r=0;r<e.length;r++)t[r]=e[r];return t}e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=32,e.SHARED_KEY_LENGTH=32;const o=new Uint8Array(32);o[0]=9;const i=n([56129,1]);function a(e){let t=1;for(let r=0;r<16;r++){let n=e[r]+t+65535;t=Math.floor(n/65536),e[r]=n-65536*t}e[0]+=t-1+37*(t-1)}function s(e,t,r){const n=~(r-1);for(let o=0;o<16;o++){const r=n&(e[o]^t[o]);e[o]^=r,t[o]^=r}}function c(e,t,r){for(let n=0;n<16;n++)e[n]=t[n]+r[n]}function u(e,t,r){for(let n=0;n<16;n++)e[n]=t[n]-r[n]}function l(e,t,r){let n,o,i=0,a=0,s=0,c=0,u=0,l=0,d=0,f=0,h=0,p=0,y=0,m=0,g=0,b=0,v=0,w=0,_=0,I=0,T=0,k=0,$=0,S=0,A=0,E=0,C=0,R=0,O=0,N=0,P=0,M=0,B=0,D=r[0],x=r[1],L=r[2],U=r[3],j=r[4],F=r[5],q=r[6],K=r[7],H=r[8],G=r[9],z=r[10],V=r[11],W=r[12],Q=r[13],Y=r[14],X=r[15];n=t[0],i+=n*D,a+=n*x,s+=n*L,c+=n*U,u+=n*j,l+=n*F,d+=n*q,f+=n*K,h+=n*H,p+=n*G,y+=n*z,m+=n*V,g+=n*W,b+=n*Q,v+=n*Y,w+=n*X,n=t[1],a+=n*D,s+=n*x,c+=n*L,u+=n*U,l+=n*j,d+=n*F,f+=n*q,h+=n*K,p+=n*H,y+=n*G,m+=n*z,g+=n*V,b+=n*W,v+=n*Q,w+=n*Y,_+=n*X,n=t[2],s+=n*D,c+=n*x,u+=n*L,l+=n*U,d+=n*j,f+=n*F,h+=n*q,p+=n*K,y+=n*H,m+=n*G,g+=n*z,b+=n*V,v+=n*W,w+=n*Q,_+=n*Y,I+=n*X,n=t[3],c+=n*D,u+=n*x,l+=n*L,d+=n*U,f+=n*j,h+=n*F,p+=n*q,y+=n*K,m+=n*H,g+=n*G,b+=n*z,v+=n*V,w+=n*W,_+=n*Q,I+=n*Y,T+=n*X,n=t[4],u+=n*D,l+=n*x,d+=n*L,f+=n*U,h+=n*j,p+=n*F,y+=n*q,m+=n*K,g+=n*H,b+=n*G,v+=n*z,w+=n*V,_+=n*W,I+=n*Q,T+=n*Y,k+=n*X,n=t[5],l+=n*D,d+=n*x,f+=n*L,h+=n*U,p+=n*j,y+=n*F,m+=n*q,g+=n*K,b+=n*H,v+=n*G,w+=n*z,_+=n*V,I+=n*W,T+=n*Q,k+=n*Y,$+=n*X,n=t[6],d+=n*D,f+=n*x,h+=n*L,p+=n*U,y+=n*j,m+=n*F,g+=n*q,b+=n*K,v+=n*H,w+=n*G,_+=n*z,I+=n*V,T+=n*W,k+=n*Q,$+=n*Y,S+=n*X,n=t[7],f+=n*D,h+=n*x,p+=n*L,y+=n*U,m+=n*j,g+=n*F,b+=n*q,v+=n*K,w+=n*H,_+=n*G,I+=n*z,T+=n*V,k+=n*W,$+=n*Q,S+=n*Y,A+=n*X,n=t[8],h+=n*D,p+=n*x,y+=n*L,m+=n*U,g+=n*j,b+=n*F,v+=n*q,w+=n*K,_+=n*H,I+=n*G,T+=n*z,k+=n*V,$+=n*W,S+=n*Q,A+=n*Y,E+=n*X,n=t[9],p+=n*D,y+=n*x,m+=n*L,g+=n*U,b+=n*j,v+=n*F,w+=n*q,_+=n*K,I+=n*H,T+=n*G,k+=n*z,$+=n*V,S+=n*W,A+=n*Q,E+=n*Y,C+=n*X,n=t[10],y+=n*D,m+=n*x,g+=n*L,b+=n*U,v+=n*j,w+=n*F,_+=n*q,I+=n*K,T+=n*H,k+=n*G,$+=n*z,S+=n*V,A+=n*W,E+=n*Q,C+=n*Y,R+=n*X,n=t[11],m+=n*D,g+=n*x,b+=n*L,v+=n*U,w+=n*j,_+=n*F,I+=n*q,T+=n*K,k+=n*H,$+=n*G,S+=n*z,A+=n*V,E+=n*W,C+=n*Q,R+=n*Y,O+=n*X,n=t[12],g+=n*D,b+=n*x,v+=n*L,w+=n*U,_+=n*j,I+=n*F,T+=n*q,k+=n*K,$+=n*H,S+=n*G,A+=n*z,E+=n*V,C+=n*W,R+=n*Q,O+=n*Y,N+=n*X,n=t[13],b+=n*D,v+=n*x,w+=n*L,_+=n*U,I+=n*j,T+=n*F,k+=n*q,$+=n*K,S+=n*H,A+=n*G,E+=n*z,C+=n*V,R+=n*W,O+=n*Q,N+=n*Y,P+=n*X,n=t[14],v+=n*D,w+=n*x,_+=n*L,I+=n*U,T+=n*j,k+=n*F,$+=n*q,S+=n*K,A+=n*H,E+=n*G,C+=n*z,R+=n*V,O+=n*W,N+=n*Q,P+=n*Y,M+=n*X,n=t[15],w+=n*D,_+=n*x,I+=n*L,T+=n*U,k+=n*j,$+=n*F,S+=n*q,A+=n*K,E+=n*H,C+=n*G,R+=n*z,O+=n*V,N+=n*W,P+=n*Q,M+=n*Y,B+=n*X,i+=38*_,a+=38*I,s+=38*T,c+=38*k,u+=38*$,l+=38*S,d+=38*A,f+=38*E,h+=38*C,p+=38*R,y+=38*O,m+=38*N,g+=38*P,b+=38*M,v+=38*B,o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=p+o+65535,o=Math.floor(n/65536),p=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=m+o+65535,o=Math.floor(n/65536),m=n-65536*o,n=g+o+65535,o=Math.floor(n/65536),g=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,i+=o-1+37*(o-1),o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=p+o+65535,o=Math.floor(n/65536),p=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=m+o+65535,o=Math.floor(n/65536),m=n-65536*o,n=g+o+65535,o=Math.floor(n/65536),g=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,i+=o-1+37*(o-1),e[0]=i,e[1]=a,e[2]=s,e[3]=c,e[4]=u,e[5]=l,e[6]=d,e[7]=f,e[8]=h,e[9]=p,e[10]=y,e[11]=m,e[12]=g,e[13]=b,e[14]=v,e[15]=w}function d(e,t){l(e,t,t)}function f(e,t){const r=new Uint8Array(32),o=new Float64Array(80),f=n(),h=n(),p=n(),y=n(),m=n(),g=n();for(let n=0;n<31;n++)r[n]=e[n];r[31]=127&e[31]|64,r[0]&=248,function(e,t){for(let r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(o,t);for(let n=0;n<16;n++)h[n]=o[n];f[0]=y[0]=1;for(let n=254;n>=0;--n){const e=r[n>>>3]>>>(7&n)&1;s(f,h,e),s(p,y,e),c(m,f,p),u(f,f,p),c(p,h,y),u(h,h,y),d(y,m),d(g,f),l(f,p,f),l(p,h,m),c(m,f,p),u(f,f,p),d(h,f),u(p,y,g),l(f,p,i),c(f,f,y),l(p,p,f),l(f,y,g),l(y,h,o),d(h,m),s(f,h,e),s(p,y,e)}for(let n=0;n<16;n++)o[n+16]=f[n],o[n+32]=p[n],o[n+48]=h[n],o[n+64]=y[n];const b=o.subarray(32),v=o.subarray(16);!function(e,t){const r=n();for(let n=0;n<16;n++)r[n]=t[n];for(let n=253;n>=0;n--)d(r,r),2!==n&&4!==n&&l(r,r,t);for(let n=0;n<16;n++)e[n]=r[n]}(b,b),l(v,v,b);const w=new Uint8Array(32);return function(e,t){const r=n(),o=n();for(let n=0;n<16;n++)o[n]=t[n];a(o),a(o),a(o);for(let n=0;n<2;n++){r[0]=o[0]-65517;for(let t=1;t<15;t++)r[t]=o[t]-65535-(r[t-1]>>16&1),r[t-1]&=65535;r[15]=o[15]-32767-(r[14]>>16&1);const e=r[15]>>16&1;r[14]&=65535,s(o,r,1-e)}for(let n=0;n<16;n++)e[2*n]=255&o[n],e[2*n+1]=o[n]>>8}(w,v),w}function h(e){return f(e,o)}function p(t){if(t.length!==e.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${e.SECRET_KEY_LENGTH} bytes`);const r=new Uint8Array(t);return{publicKey:h(r),secretKey:r}}e.scalarMult=f,e.scalarMultBase=h,e.generateKeyPairFromSeed=p,e.generateKeyPair=function(e){const n=(0,t.randomBytes)(32,e),o=p(n);return(0,r.wipe)(n),o},e.sharedKey=function(t,r,n=!1){if(t.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(r.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const o=f(t,r);if(n){let e=0;for(let t=0;t<o.length;t++)e|=o[t];if(0===e)throw new Error("X25519: invalid shared key")}return o}}(x25519);var elliptic$1={};const name$1="elliptic",version$3="6.6.1",description$1="EC cryptography",main$1="lib/elliptic.js",files$1=["lib"],scripts$1={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository$1={type:"git",url:"git@github.com:indutny/elliptic"},keywords$1=["EC","Elliptic","curve","Cryptography"],author$1="Fedor Indutny <fedor@indutny.com>",license$1="MIT",bugs$1={url:"https://github.com/indutny/elliptic/issues"},homepage$1="https://github.com/indutny/elliptic",devDependencies$1={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies$1={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0$3={name:name$1,version:version$3,description:description$1,main:main$1,files:files$1,scripts:scripts$1,repository:repository$1,keywords:keywords$1,author:author$1,license:license$1,bugs:bugs$1,homepage:homepage$1,devDependencies:devDependencies$1,dependencies:dependencies$1};var utils$p={},bn$3={exports:{}};bn$3.exports,function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var i;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$2$1.Buffer}catch(e2){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function c(e,t,r,n){for(var o=0,i=Math.min(e.length,r),a=t;a<i;a++){var s=e.charCodeAt(a)-48;o*=n,o+=s>=49?s-49+10:s>=17?s-17+10:s}return o}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var o=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(o++,this.negative=1),o<e.length&&(16===t?this._parseHex(e,o,n):(this._parseBase(e,t,o),"le"===n&&this._initArray(this.toArray(),t,n)))},o.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var i,a,s=0;if("be"===n)for(o=e.length-1,i=0;o>=0;o-=3)a=e[o]|e[o-1]<<8|e[o-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===n)for(o=0,i=0;o<e.length;o+=3)a=e[o]|e[o+1]<<8|e[o+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this.strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,i=0,a=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)o=s(e,t,n)<<i,this.words[a]|=67108863&o,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)o=s(e,t,n)<<i,this.words[a]|=67108863&o,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,o=1;o<=67108863;o*=t)n++;n--,o=o/t|0;for(var i=e.length-r,a=i%n,s=Math.min(i,i-a)+r,u=0,l=r;l<s;l+=n)u=c(e,l,l+n,t),this.imuln(o),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var o=0|e.words[0],i=0|t.words[0],a=o*i,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u<n;u++){for(var l=c>>>26,d=67108863&c,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;l+=(a=(o=0|e.words[p])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var o=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<o|i)).toString(16);i=s>>>24-o&16777215,(o+=2)>=26&&(o-=26,a--),n=0!==i||a!==this.length-1?u[6-c.length]+c+n:c+n}for(0!==i&&(n=i.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var f=l[e],h=d[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modn(h).toString(e);n=(p=p.idivn(h)).isZero()?y+n:u[f-y.length]+y+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return r(void 0!==i),this.toArrayLike(i,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,n){var o=this.byteLength(),i=n||Math.max(1,o);r(o<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(i),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s<i;s++)u[s]=0}else{for(s=0;s<i-o;s++)u[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[i-s-1]=a}return u},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var o=0;o<t;o++)this.words[o]=67108863&~this.words[o];return n>0&&(this.words[o]=~this.words[o]&67108863>>26-n),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,o=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<o:this.words[n]&~(1<<o),this.strip()},o.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var o=0,i=0;i<n.length;i++)t=(0|r.words[i])+(0|n.words[i])+o,this.words[i]=67108863&t,o=t>>>26;for(;0!==o&&i<r.length;i++)t=(0|r.words[i])+o,this.words[i]=67108863&t,o=t>>>26;if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,o=this.cmp(e);if(0===o)return this.negative=0,this.length=1,this.words[0]=0,this;o>0?(r=this,n=e):(r=e,n=this);for(var i=0,a=0;a<n.length;a++)i=(t=(0|r.words[a])-(0|n.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<r.length;a++)i=(t=(0|r.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var n,o,i,a=e.words,s=t.words,c=r.words,u=0,l=0|a[0],d=8191&l,f=l>>>13,h=0|a[1],p=8191&h,y=h>>>13,m=0|a[2],g=8191&m,b=m>>>13,v=0|a[3],w=8191&v,_=v>>>13,I=0|a[4],T=8191&I,k=I>>>13,$=0|a[5],S=8191&$,A=$>>>13,E=0|a[6],C=8191&E,R=E>>>13,O=0|a[7],N=8191&O,P=O>>>13,M=0|a[8],B=8191&M,D=M>>>13,x=0|a[9],L=8191&x,U=x>>>13,j=0|s[0],F=8191&j,q=j>>>13,K=0|s[1],H=8191&K,G=K>>>13,z=0|s[2],V=8191&z,W=z>>>13,Q=0|s[3],Y=8191&Q,X=Q>>>13,J=0|s[4],Z=8191&J,ee=J>>>13,te=0|s[5],re=8191&te,ne=te>>>13,oe=0|s[6],ie=8191&oe,ae=oe>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,fe=le>>>13,he=0|s[9],pe=8191&he,ye=he>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(u+(n=Math.imul(d,F))|0)+((8191&(o=(o=Math.imul(d,q))+Math.imul(f,F)|0))<<13)|0;u=((i=Math.imul(f,q))+(o>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(p,F),o=(o=Math.imul(p,q))+Math.imul(y,F)|0,i=Math.imul(y,q);var ge=(u+(n=n+Math.imul(d,H)|0)|0)+((8191&(o=(o=o+Math.imul(d,G)|0)+Math.imul(f,H)|0))<<13)|0;u=((i=i+Math.imul(f,G)|0)+(o>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(g,F),o=(o=Math.imul(g,q))+Math.imul(b,F)|0,i=Math.imul(b,q),n=n+Math.imul(p,H)|0,o=(o=o+Math.imul(p,G)|0)+Math.imul(y,H)|0,i=i+Math.imul(y,G)|0;var be=(u+(n=n+Math.imul(d,V)|0)|0)+((8191&(o=(o=o+Math.imul(d,W)|0)+Math.imul(f,V)|0))<<13)|0;u=((i=i+Math.imul(f,W)|0)+(o>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(w,F),o=(o=Math.imul(w,q))+Math.imul(_,F)|0,i=Math.imul(_,q),n=n+Math.imul(g,H)|0,o=(o=o+Math.imul(g,G)|0)+Math.imul(b,H)|0,i=i+Math.imul(b,G)|0,n=n+Math.imul(p,V)|0,o=(o=o+Math.imul(p,W)|0)+Math.imul(y,V)|0,i=i+Math.imul(y,W)|0;var ve=(u+(n=n+Math.imul(d,Y)|0)|0)+((8191&(o=(o=o+Math.imul(d,X)|0)+Math.imul(f,Y)|0))<<13)|0;u=((i=i+Math.imul(f,X)|0)+(o>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(T,F),o=(o=Math.imul(T,q))+Math.imul(k,F)|0,i=Math.imul(k,q),n=n+Math.imul(w,H)|0,o=(o=o+Math.imul(w,G)|0)+Math.imul(_,H)|0,i=i+Math.imul(_,G)|0,n=n+Math.imul(g,V)|0,o=(o=o+Math.imul(g,W)|0)+Math.imul(b,V)|0,i=i+Math.imul(b,W)|0,n=n+Math.imul(p,Y)|0,o=(o=o+Math.imul(p,X)|0)+Math.imul(y,Y)|0,i=i+Math.imul(y,X)|0;var we=(u+(n=n+Math.imul(d,Z)|0)|0)+((8191&(o=(o=o+Math.imul(d,ee)|0)+Math.imul(f,Z)|0))<<13)|0;u=((i=i+Math.imul(f,ee)|0)+(o>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(S,F),o=(o=Math.imul(S,q))+Math.imul(A,F)|0,i=Math.imul(A,q),n=n+Math.imul(T,H)|0,o=(o=o+Math.imul(T,G)|0)+Math.imul(k,H)|0,i=i+Math.imul(k,G)|0,n=n+Math.imul(w,V)|0,o=(o=o+Math.imul(w,W)|0)+Math.imul(_,V)|0,i=i+Math.imul(_,W)|0,n=n+Math.imul(g,Y)|0,o=(o=o+Math.imul(g,X)|0)+Math.imul(b,Y)|0,i=i+Math.imul(b,X)|0,n=n+Math.imul(p,Z)|0,o=(o=o+Math.imul(p,ee)|0)+Math.imul(y,Z)|0,i=i+Math.imul(y,ee)|0;var _e=(u+(n=n+Math.imul(d,re)|0)|0)+((8191&(o=(o=o+Math.imul(d,ne)|0)+Math.imul(f,re)|0))<<13)|0;u=((i=i+Math.imul(f,ne)|0)+(o>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(C,F),o=(o=Math.imul(C,q))+Math.imul(R,F)|0,i=Math.imul(R,q),n=n+Math.imul(S,H)|0,o=(o=o+Math.imul(S,G)|0)+Math.imul(A,H)|0,i=i+Math.imul(A,G)|0,n=n+Math.imul(T,V)|0,o=(o=o+Math.imul(T,W)|0)+Math.imul(k,V)|0,i=i+Math.imul(k,W)|0,n=n+Math.imul(w,Y)|0,o=(o=o+Math.imul(w,X)|0)+Math.imul(_,Y)|0,i=i+Math.imul(_,X)|0,n=n+Math.imul(g,Z)|0,o=(o=o+Math.imul(g,ee)|0)+Math.imul(b,Z)|0,i=i+Math.imul(b,ee)|0,n=n+Math.imul(p,re)|0,o=(o=o+Math.imul(p,ne)|0)+Math.imul(y,re)|0,i=i+Math.imul(y,ne)|0;var Ie=(u+(n=n+Math.imul(d,ie)|0)|0)+((8191&(o=(o=o+Math.imul(d,ae)|0)+Math.imul(f,ie)|0))<<13)|0;u=((i=i+Math.imul(f,ae)|0)+(o>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(N,F),o=(o=Math.imul(N,q))+Math.imul(P,F)|0,i=Math.imul(P,q),n=n+Math.imul(C,H)|0,o=(o=o+Math.imul(C,G)|0)+Math.imul(R,H)|0,i=i+Math.imul(R,G)|0,n=n+Math.imul(S,V)|0,o=(o=o+Math.imul(S,W)|0)+Math.imul(A,V)|0,i=i+Math.imul(A,W)|0,n=n+Math.imul(T,Y)|0,o=(o=o+Math.imul(T,X)|0)+Math.imul(k,Y)|0,i=i+Math.imul(k,X)|0,n=n+Math.imul(w,Z)|0,o=(o=o+Math.imul(w,ee)|0)+Math.imul(_,Z)|0,i=i+Math.imul(_,ee)|0,n=n+Math.imul(g,re)|0,o=(o=o+Math.imul(g,ne)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,ne)|0,n=n+Math.imul(p,ie)|0,o=(o=o+Math.imul(p,ae)|0)+Math.imul(y,ie)|0,i=i+Math.imul(y,ae)|0;var Te=(u+(n=n+Math.imul(d,ce)|0)|0)+((8191&(o=(o=o+Math.imul(d,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((i=i+Math.imul(f,ue)|0)+(o>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(B,F),o=(o=Math.imul(B,q))+Math.imul(D,F)|0,i=Math.imul(D,q),n=n+Math.imul(N,H)|0,o=(o=o+Math.imul(N,G)|0)+Math.imul(P,H)|0,i=i+Math.imul(P,G)|0,n=n+Math.imul(C,V)|0,o=(o=o+Math.imul(C,W)|0)+Math.imul(R,V)|0,i=i+Math.imul(R,W)|0,n=n+Math.imul(S,Y)|0,o=(o=o+Math.imul(S,X)|0)+Math.imul(A,Y)|0,i=i+Math.imul(A,X)|0,n=n+Math.imul(T,Z)|0,o=(o=o+Math.imul(T,ee)|0)+Math.imul(k,Z)|0,i=i+Math.imul(k,ee)|0,n=n+Math.imul(w,re)|0,o=(o=o+Math.imul(w,ne)|0)+Math.imul(_,re)|0,i=i+Math.imul(_,ne)|0,n=n+Math.imul(g,ie)|0,o=(o=o+Math.imul(g,ae)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,ae)|0,n=n+Math.imul(p,ce)|0,o=(o=o+Math.imul(p,ue)|0)+Math.imul(y,ce)|0,i=i+Math.imul(y,ue)|0;var ke=(u+(n=n+Math.imul(d,de)|0)|0)+((8191&(o=(o=o+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;u=((i=i+Math.imul(f,fe)|0)+(o>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(L,F),o=(o=Math.imul(L,q))+Math.imul(U,F)|0,i=Math.imul(U,q),n=n+Math.imul(B,H)|0,o=(o=o+Math.imul(B,G)|0)+Math.imul(D,H)|0,i=i+Math.imul(D,G)|0,n=n+Math.imul(N,V)|0,o=(o=o+Math.imul(N,W)|0)+Math.imul(P,V)|0,i=i+Math.imul(P,W)|0,n=n+Math.imul(C,Y)|0,o=(o=o+Math.imul(C,X)|0)+Math.imul(R,Y)|0,i=i+Math.imul(R,X)|0,n=n+Math.imul(S,Z)|0,o=(o=o+Math.imul(S,ee)|0)+Math.imul(A,Z)|0,i=i+Math.imul(A,ee)|0,n=n+Math.imul(T,re)|0,o=(o=o+Math.imul(T,ne)|0)+Math.imul(k,re)|0,i=i+Math.imul(k,ne)|0,n=n+Math.imul(w,ie)|0,o=(o=o+Math.imul(w,ae)|0)+Math.imul(_,ie)|0,i=i+Math.imul(_,ae)|0,n=n+Math.imul(g,ce)|0,o=(o=o+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,n=n+Math.imul(p,de)|0,o=(o=o+Math.imul(p,fe)|0)+Math.imul(y,de)|0,i=i+Math.imul(y,fe)|0;var $e=(u+(n=n+Math.imul(d,pe)|0)|0)+((8191&(o=(o=o+Math.imul(d,ye)|0)+Math.imul(f,pe)|0))<<13)|0;u=((i=i+Math.imul(f,ye)|0)+(o>>>13)|0)+($e>>>26)|0,$e&=67108863,n=Math.imul(L,H),o=(o=Math.imul(L,G))+Math.imul(U,H)|0,i=Math.imul(U,G),n=n+Math.imul(B,V)|0,o=(o=o+Math.imul(B,W)|0)+Math.imul(D,V)|0,i=i+Math.imul(D,W)|0,n=n+Math.imul(N,Y)|0,o=(o=o+Math.imul(N,X)|0)+Math.imul(P,Y)|0,i=i+Math.imul(P,X)|0,n=n+Math.imul(C,Z)|0,o=(o=o+Math.imul(C,ee)|0)+Math.imul(R,Z)|0,i=i+Math.imul(R,ee)|0,n=n+Math.imul(S,re)|0,o=(o=o+Math.imul(S,ne)|0)+Math.imul(A,re)|0,i=i+Math.imul(A,ne)|0,n=n+Math.imul(T,ie)|0,o=(o=o+Math.imul(T,ae)|0)+Math.imul(k,ie)|0,i=i+Math.imul(k,ae)|0,n=n+Math.imul(w,ce)|0,o=(o=o+Math.imul(w,ue)|0)+Math.imul(_,ce)|0,i=i+Math.imul(_,ue)|0,n=n+Math.imul(g,de)|0,o=(o=o+Math.imul(g,fe)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,fe)|0;var Se=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(o=(o=o+Math.imul(p,ye)|0)+Math.imul(y,pe)|0))<<13)|0;u=((i=i+Math.imul(y,ye)|0)+(o>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(L,V),o=(o=Math.imul(L,W))+Math.imul(U,V)|0,i=Math.imul(U,W),n=n+Math.imul(B,Y)|0,o=(o=o+Math.imul(B,X)|0)+Math.imul(D,Y)|0,i=i+Math.imul(D,X)|0,n=n+Math.imul(N,Z)|0,o=(o=o+Math.imul(N,ee)|0)+Math.imul(P,Z)|0,i=i+Math.imul(P,ee)|0,n=n+Math.imul(C,re)|0,o=(o=o+Math.imul(C,ne)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,ne)|0,n=n+Math.imul(S,ie)|0,o=(o=o+Math.imul(S,ae)|0)+Math.imul(A,ie)|0,i=i+Math.imul(A,ae)|0,n=n+Math.imul(T,ce)|0,o=(o=o+Math.imul(T,ue)|0)+Math.imul(k,ce)|0,i=i+Math.imul(k,ue)|0,n=n+Math.imul(w,de)|0,o=(o=o+Math.imul(w,fe)|0)+Math.imul(_,de)|0,i=i+Math.imul(_,fe)|0;var Ae=(u+(n=n+Math.imul(g,pe)|0)|0)+((8191&(o=(o=o+Math.imul(g,ye)|0)+Math.imul(b,pe)|0))<<13)|0;u=((i=i+Math.imul(b,ye)|0)+(o>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(L,Y),o=(o=Math.imul(L,X))+Math.imul(U,Y)|0,i=Math.imul(U,X),n=n+Math.imul(B,Z)|0,o=(o=o+Math.imul(B,ee)|0)+Math.imul(D,Z)|0,i=i+Math.imul(D,ee)|0,n=n+Math.imul(N,re)|0,o=(o=o+Math.imul(N,ne)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,ne)|0,n=n+Math.imul(C,ie)|0,o=(o=o+Math.imul(C,ae)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,ae)|0,n=n+Math.imul(S,ce)|0,o=(o=o+Math.imul(S,ue)|0)+Math.imul(A,ce)|0,i=i+Math.imul(A,ue)|0,n=n+Math.imul(T,de)|0,o=(o=o+Math.imul(T,fe)|0)+Math.imul(k,de)|0,i=i+Math.imul(k,fe)|0;var Ee=(u+(n=n+Math.imul(w,pe)|0)|0)+((8191&(o=(o=o+Math.imul(w,ye)|0)+Math.imul(_,pe)|0))<<13)|0;u=((i=i+Math.imul(_,ye)|0)+(o>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(L,Z),o=(o=Math.imul(L,ee))+Math.imul(U,Z)|0,i=Math.imul(U,ee),n=n+Math.imul(B,re)|0,o=(o=o+Math.imul(B,ne)|0)+Math.imul(D,re)|0,i=i+Math.imul(D,ne)|0,n=n+Math.imul(N,ie)|0,o=(o=o+Math.imul(N,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,n=n+Math.imul(C,ce)|0,o=(o=o+Math.imul(C,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,n=n+Math.imul(S,de)|0,o=(o=o+Math.imul(S,fe)|0)+Math.imul(A,de)|0,i=i+Math.imul(A,fe)|0;var Ce=(u+(n=n+Math.imul(T,pe)|0)|0)+((8191&(o=(o=o+Math.imul(T,ye)|0)+Math.imul(k,pe)|0))<<13)|0;u=((i=i+Math.imul(k,ye)|0)+(o>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(L,re),o=(o=Math.imul(L,ne))+Math.imul(U,re)|0,i=Math.imul(U,ne),n=n+Math.imul(B,ie)|0,o=(o=o+Math.imul(B,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,n=n+Math.imul(N,ce)|0,o=(o=o+Math.imul(N,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,n=n+Math.imul(C,de)|0,o=(o=o+Math.imul(C,fe)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,fe)|0;var Re=(u+(n=n+Math.imul(S,pe)|0)|0)+((8191&(o=(o=o+Math.imul(S,ye)|0)+Math.imul(A,pe)|0))<<13)|0;u=((i=i+Math.imul(A,ye)|0)+(o>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(L,ie),o=(o=Math.imul(L,ae))+Math.imul(U,ie)|0,i=Math.imul(U,ae),n=n+Math.imul(B,ce)|0,o=(o=o+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,n=n+Math.imul(N,de)|0,o=(o=o+Math.imul(N,fe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,fe)|0;var Oe=(u+(n=n+Math.imul(C,pe)|0)|0)+((8191&(o=(o=o+Math.imul(C,ye)|0)+Math.imul(R,pe)|0))<<13)|0;u=((i=i+Math.imul(R,ye)|0)+(o>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(L,ce),o=(o=Math.imul(L,ue))+Math.imul(U,ce)|0,i=Math.imul(U,ue),n=n+Math.imul(B,de)|0,o=(o=o+Math.imul(B,fe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,fe)|0;var Ne=(u+(n=n+Math.imul(N,pe)|0)|0)+((8191&(o=(o=o+Math.imul(N,ye)|0)+Math.imul(P,pe)|0))<<13)|0;u=((i=i+Math.imul(P,ye)|0)+(o>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(L,de),o=(o=Math.imul(L,fe))+Math.imul(U,de)|0,i=Math.imul(U,fe);var Pe=(u+(n=n+Math.imul(B,pe)|0)|0)+((8191&(o=(o=o+Math.imul(B,ye)|0)+Math.imul(D,pe)|0))<<13)|0;u=((i=i+Math.imul(D,ye)|0)+(o>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Me=(u+(n=Math.imul(L,pe))|0)+((8191&(o=(o=Math.imul(L,ye))+Math.imul(U,pe)|0))<<13)|0;return u=((i=Math.imul(U,ye))+(o>>>13)|0)+(Me>>>26)|0,Me&=67108863,c[0]=me,c[1]=ge,c[2]=be,c[3]=ve,c[4]=we,c[5]=_e,c[6]=Ie,c[7]=Te,c[8]=ke,c[9]=$e,c[10]=Se,c[11]=Ae,c[12]=Ee,c[13]=Ce,c[14]=Re,c[15]=Oe,c[16]=Ne,c[17]=Pe,c[18]=Me,0!==u&&(c[19]=u,r.length++),r};function p(e,t,r){return(new y).mulp(e,t,r)}function y(e,t){this.x=e,this.y=t}Math.imul||(h=f),o.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):n<63?f(this,e,t):n<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,o=0,i=0;i<r.length-1;i++){var a=o;o=0;for(var s=67108863&n,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),f=67108863&d;s=67108863&(f=f+s|0),o+=(a=(a=a+(d/67108864|0)|0)+(f>>>26)|0)>>>26,a&=67108863}r.words[i]=s,n=a,a=o}return 0!==n?r.words[i]=n:r.length--,r.strip()}(this,e,t):p(this,e,t),r},y.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},y.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,o=0;o<t;o++)n|=(1&e)<<t-o-1,e>>=1;return n},y.prototype.permute=function(e,t,r,n,o,i){for(var a=0;a<i;a++)n[a]=t[e[a]],o[a]=r[e[a]]},y.prototype.transform=function(e,t,r,n,o,i){this.permute(i,e,t,r,n,o);for(var a=1;a<o;a<<=1)for(var s=a<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),l=0;l<o;l+=s)for(var d=c,f=u,h=0;h<a;h++){var p=r[l+h],y=n[l+h],m=r[l+h+a],g=n[l+h+a],b=d*m-f*g;g=d*g+f*m,m=b,r[l+h]=p+m,n[l+h]=y+g,r[l+h+a]=p-m,n[l+h+a]=y-g,h!==s&&(b=c*d-u*f,f=c*f+u*d,d=b)}},y.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),n=1&r,o=0;for(r=r/2|0;r;r>>>=1)o++;return 1<<o+1+n},y.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var o=e[n];e[n]=e[r-n-1],e[r-n-1]=o,o=t[n],t[n]=-t[r-n-1],t[r-n-1]=-o}},y.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var o=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=67108863&o,r=o<67108864?0:o/67108864|0}return e},y.prototype.convert13b=function(e,t,n,o){for(var i=0,a=0;a<t;a++)i+=0|e[a],n[2*a]=8191&i,i>>>=13,n[2*a+1]=8191&i,i>>>=13;for(a=2*t;a<o;++a)n[a]=0;r(0===i),r(!(-8192&i))},y.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},y.prototype.mulp=function(e,t,r){var n=2*this.guessLen13b(e.length,t.length),o=this.makeRBT(n),i=this.stub(n),a=new Array(n),s=new Array(n),c=new Array(n),u=new Array(n),l=new Array(n),d=new Array(n),f=r.words;f.length=n,this.convert13b(e.words,e.length,a,n),this.convert13b(t.words,t.length,u,n),this.transform(a,i,s,c,n,o),this.transform(u,i,l,d,n,o);for(var h=0;h<n;h++){var p=s[h]*l[h]-c[h]*d[h];c[h]=s[h]*d[h]+c[h]*l[h],s[h]=p}return this.conjugate(s,c,n),this.transform(s,c,f,i,n,o),this.conjugate(f,i,n),this.normalize13b(f,n),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),p(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,n=0;n<this.length;n++){var o=(0|this.words[n])*e,i=(67108863&o)+(67108863&t);t>>=26,t+=o/67108864|0,t+=i>>>26,this.words[n]=67108863&i}return 0!==t&&(this.words[n]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,o=r%26;t[r]=(e.words[n]&1<<o)>>>o}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var i=r.sqr();n<t.length;n++,i=i.sqr())0!==t[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,o=(e-n)/26,i=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<n;this.words[t]=c|a,a=s>>>26-n}a&&(this.words[t]=a,this.length++)}if(0!==o){for(t=this.length-1;t>=0;t--)this.words[t+o]=this.words[t];for(t=0;t<o;t++)this.words[t]=0;this.length+=o}return this.strip()},o.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,n){var o;r("number"==typeof e&&e>=0),o=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=n;if(o-=a,o=Math.max(0,o),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=o);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,o=1<<t;return!(this.length<=n)&&!!(this.words[n]&o)},o.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var o=67108863^67108863>>>t<<t;this.words[this.length-1]&=o}return this.strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,n){var o,i,a=e.length+n;this._expand(a);var s=0;for(o=0;o<e.length;o++){i=(0|this.words[o+n])+s;var c=(0|e.words[o])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[o+n]=67108863&i}for(;o<this.length-n;o++)s=(i=(0|this.words[o+n])+s)>>26,this.words[o+n]=67108863&i;if(0===s)return this.strip();for(r(-1===s),s=0,o=0;o<this.length;o++)s=(i=-(0|this.words[o])+s)>>26,this.words[o]=67108863&i;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,c=n.length-i.length;if("mod"!==t){(s=new o(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=n.clone()._ishlnsubmul(i,1,c);0===l.negative&&(n=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var f=67108864*(0|n.words[i.length+d])+(0|n.words[i.length+d-1]);for(f=Math.min(f/a|0,67108863),n._ishlnsubmul(i,f,d);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,d),n.isZero()||(n.negative^=1);s&&(s.words[d]=f)}return s&&s.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),o=e.andln(1),i=r.cmp(n);return i<0||1===o&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,o=this.length-1;o>=0;o--)n=(t*n+(0|this.words[o]))%e;return n},o.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*t;this.words[n]=o/e|0,t=o%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),a=new o(0),s=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;!(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var p=0,y=1;!(n.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(s),a.isub(c)):(n.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new o(1),s=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,f=1;!(n.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(n.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s)):(n.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var o=t.cmp(r);if(o<0){var i=t;t=r,r=i}else if(0===o||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,o=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=o,this;for(var i=o,a=n;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var o=0|this.words[0];t=o===e?0:o<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],o=0|e.words[r];if(n!==o){n<o?t=-1:n>o&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new I(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function T(e){I.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},n(b,g),b.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),o=0;o<n;o++)t.words[o]=e.words[o];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,o=10;o<e.length;o++){var a=0|e.words[o];e.words[o-10]=(a&r)<<4|i>>>22,i=a}i>>>=22,e.words[o-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(v,g),n(w,g),n(_,g),_.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,o=67108863&n;n>>>=26,e.words[r]=o,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(m[e])return m[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return m[e]=t,t},I.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},I.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},I.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},I.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},I.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},I.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},I.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},I.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},I.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},I.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},I.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},I.prototype.isqr=function(e){return this.imul(e,e.clone())},I.prototype.sqr=function(e){return this.mul(e,e)},I.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),f=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=a;0!==h.cmp(s);){for(var y=h,m=0;0!==y.cmp(s);m++)y=y.redSqr();r(m<p);var g=this.pow(d,new o(1).iushln(p-m-1));f=f.redMul(g),d=g.redSqr(),h=h.redMul(d),p=m}return f},I.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},I.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var i=r[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),n=t.length-1;n>=0;n--){for(var u=t.words[n],l=c-1;l>=0;l--){var d=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4===++s||0===n&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}c=26}return i},I.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},I.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new T(e)},n(T,I),T.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},T.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},T.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),i=o;return o.cmp(this.m)>=0?i=o.isub(this.m):o.cmpn(0)<0&&(i=o.iadd(this.m)),i._forceRed(this)},T.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},T.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,commonjsGlobal)}(bn$3);var bnExports$1=bn$3.exports;!function(e){var t=e,r=bnExports$1,n=minimalisticAssert$1,o=utils$O;t.assert=n,t.toArray=o.toArray,t.zero2=o.zero2,t.toHex=o.toHex,t.encode=o.encode,t.getNAF=function(e,t,r){var n,o=new Array(Math.max(e.bitLength(),r)+1);for(n=0;n<o.length;n+=1)o[n]=0;var i=1<<t+1,a=e.clone();for(n=0;n<o.length;n++){var s,c=a.andln(i-1);a.isOdd()?(s=c>(i>>1)-1?(i>>1)-c:c,a.isubn(s)):s=0,o[n]=s,a.iushrn(1)}return o},t.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,o=0,i=0;e.cmpn(-o)>0||t.cmpn(-i)>0;){var a,s,c=e.andln(3)+o&3,u=t.andln(3)+i&3;3===c&&(c=-1),3===u&&(u=-1),a=1&c?3!==(n=e.andln(7)+o&7)&&5!==n||2!==u?c:-c:0,r[0].push(a),s=1&u?3!==(n=t.andln(7)+i&7)&&5!==n||2!==c?u:-u:0,r[1].push(s),2*o===a+1&&(o=1-o),2*i===s+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r},t.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},t.parseBytes=function(e){return"string"==typeof e?t.toArray(e,"hex"):e},t.intFromLE=function(e){return new r(e,"hex","le")}}(utils$p);var curve$1={},BN$f=bnExports$1,utils$o=utils$p,getNAF$1=utils$o.getNAF,getJSF$1=utils$o.getJSF,assert$h=utils$o.assert;function BaseCurve$1(e,t){this.type=e,this.p=new BN$f(t.p,16),this.red=t.prime?BN$f.red(t.prime):BN$f.mont(this.p),this.zero=new BN$f(0).toRed(this.red),this.one=new BN$f(1).toRed(this.red),this.two=new BN$f(2).toRed(this.red),this.n=t.n&&new BN$f(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base$1=BaseCurve$1;function BasePoint$1(e,t){this.curve=e,this.type=t,this.precomputed=null}BaseCurve$1.prototype.point=function(){throw new Error("Not implemented")},BaseCurve$1.prototype.validate=function(){throw new Error("Not implemented")},BaseCurve$1.prototype._fixedNafMul=function(e,t){assert$h(e.precomputed);var r=e._getDoubles(),n=getNAF$1(t,1,this._bitLength),o=(1<<r.step+1)-(r.step%2==0?2:1);o/=3;var i,a,s=[];for(i=0;i<n.length;i+=r.step){a=0;for(var c=i+r.step-1;c>=i;c--)a=(a<<1)+n[c];s.push(a)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=o;d>0;d--){for(i=0;i<s.length;i++)(a=s[i])===d?l=l.mixedAdd(r.points[i]):a===-d&&(l=l.mixedAdd(r.points[i].neg()));u=u.add(l)}return u.toP()},BaseCurve$1.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var o=n.points,i=getNAF$1(t,r,this._bitLength),a=this.jpoint(null,null,null),s=i.length-1;s>=0;s--){for(var c=0;s>=0&&0===i[s];s--)c++;if(s>=0&&c++,a=a.dblp(c),s<0)break;var u=i[s];assert$h(0!==u),a="affine"===e.type?u>0?a.mixedAdd(o[u-1>>1]):a.mixedAdd(o[-u-1>>1].neg()):u>0?a.add(o[u-1>>1]):a.add(o[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},BaseCurve$1.prototype._wnafMulAdd=function(e,t,r,n,o){var i,a,s,c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,d=0;for(i=0;i<n;i++){var f=(s=t[i])._getNAFPoints(e);c[i]=f.wnd,u[i]=f.points}for(i=n-1;i>=1;i-=2){var h=i-1,p=i;if(1===c[h]&&1===c[p]){var y=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(y[1]=t[h].add(t[p]),y[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(y[1]=t[h].toJ().mixedAdd(t[p]),y[2]=t[h].add(t[p].neg())):(y[1]=t[h].toJ().mixedAdd(t[p]),y[2]=t[h].toJ().mixedAdd(t[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=getJSF$1(r[h],r[p]);for(d=Math.max(g[0].length,d),l[h]=new Array(d),l[p]=new Array(d),a=0;a<d;a++){var b=0|g[0][a],v=0|g[1][a];l[h][a]=m[3*(b+1)+(v+1)],l[p][a]=0,u[h]=y}}else l[h]=getNAF$1(r[h],c[h],this._bitLength),l[p]=getNAF$1(r[p],c[p],this._bitLength),d=Math.max(l[h].length,d),d=Math.max(l[p].length,d)}var w=this.jpoint(null,null,null),_=this._wnafT4;for(i=d;i>=0;i--){for(var I=0;i>=0;){var T=!0;for(a=0;a<n;a++)_[a]=0|l[a][i],0!==_[a]&&(T=!1);if(!T)break;I++,i--}if(i>=0&&I++,w=w.dblp(I),i<0)break;for(a=0;a<n;a++){var k=_[a];0!==k&&(k>0?s=u[a][k-1>>1]:k<0&&(s=u[a][-k-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(i=0;i<n;i++)u[i]=null;return o?w:w.toP()},BaseCurve$1.BasePoint=BasePoint$1,BasePoint$1.prototype.eq=function(){throw new Error("Not implemented")},BasePoint$1.prototype.validate=function(){return this.curve.validate(this)},BaseCurve$1.prototype.decodePoint=function(e,t){e=utils$o.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?assert$h(e[e.length-1]%2==0):7===e[0]&&assert$h(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},BasePoint$1.prototype.encodeCompressed=function(e){return this.encode(e,!0)},BasePoint$1.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},BasePoint$1.prototype.encode=function(e,t){return utils$o.encode(this._encode(t),e)},BasePoint$1.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},BasePoint$1.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},BasePoint$1.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,o=0;o<t;o+=e){for(var i=0;i<e;i++)n=n.dbl();r.push(n)}return{step:e,points:r}},BasePoint$1.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),o=1;o<r;o++)t[o]=t[o-1].add(n);return{wnd:e,points:t}},BasePoint$1.prototype._getBeta=function(){return null},BasePoint$1.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var utils$n=utils$p,BN$e=bnExports$1,inherits$5=inherits_browserExports,Base$5=base$1,assert$g=utils$n.assert;function ShortCurve$1(e){Base$5.call(this,"short",e),this.a=new BN$e(e.a,16).toRed(this.red),this.b=new BN$e(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}inherits$5(ShortCurve$1,Base$5);var short$1=ShortCurve$1;function Point$5(e,t,r,n){Base$5.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new BN$e(t,16),this.y=new BN$e(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function JPoint$1(e,t,r,n){Base$5.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$e(0)):(this.x=new BN$e(t,16),this.y=new BN$e(r,16),this.z=new BN$e(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}ShortCurve$1.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new BN$e(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new BN$e(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],assert$g(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new BN$e(e.a,16),b:new BN$e(e.b,16)}})):this._getEndoBasis(r)}}},ShortCurve$1.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:BN$e.mont(e),r=new BN$e(2).toRed(t).redInvm(),n=r.redNeg(),o=new BN$e(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},ShortCurve$1.prototype._getEndoBasis=function(e){for(var t,r,n,o,i,a,s,c,u,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,f=this.n.clone(),h=new BN$e(1),p=new BN$e(0),y=new BN$e(0),m=new BN$e(1),g=0;0!==d.cmpn(0);){var b=f.div(d);c=f.sub(b.mul(d)),u=y.sub(b.mul(h));var v=m.sub(b.mul(p));if(!n&&c.cmp(l)<0)t=s.neg(),r=h,n=c.neg(),o=u;else if(n&&2==++g)break;s=c,f=d,d=c,y=h,h=u,m=p,p=v}i=c.neg(),a=u;var w=n.sqr().add(o.sqr());return i.sqr().add(a.sqr()).cmp(w)>=0&&(i=t,a=r),n.negative&&(n=n.neg(),o=o.neg()),i.negative&&(i=i.neg(),a=a.neg()),[{a:n,b:o},{a:i,b:a}]},ShortCurve$1.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],o=n.b.mul(e).divRound(this.n),i=r.b.neg().mul(e).divRound(this.n),a=o.mul(r.a),s=i.mul(n.a),c=o.mul(r.b),u=i.mul(n.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},ShortCurve$1.prototype.pointFromX=function(e,t){(e=new BN$e(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(t&&!o||!t&&o)&&(n=n.redNeg()),this.point(e,n)},ShortCurve$1.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(o).cmpn(0)},ShortCurve$1.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,o=this._endoWnafT2,i=0;i<e.length;i++){var a=this._endoSplit(t[i]),s=e[i],c=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),c=c.neg(!0)),n[2*i]=s,n[2*i+1]=c,o[2*i]=a.k1,o[2*i+1]=a.k2}for(var u=this._wnafMulAdd(1,n,o,2*i,r),l=0;l<2*i;l++)n[l]=null,o[l]=null;return u},inherits$5(Point$5,Base$5.BasePoint),ShortCurve$1.prototype.point=function(e,t,r){return new Point$5(this,e,t,r)},ShortCurve$1.prototype.pointFromJSON=function(e,t){return Point$5.fromJSON(this,e,t)},Point$5.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Point$5.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Point$5.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function o(t){return e.point(t[0],t[1],r)}var i=t[2];return n.precomputed={beta:null,doubles:i.doubles&&{step:i.doubles.step,points:[n].concat(i.doubles.points.map(o))},naf:i.naf&&{wnd:i.naf.wnd,points:[n].concat(i.naf.points.map(o))}},n},Point$5.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Point$5.prototype.isInfinity=function(){return this.inf},Point$5.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Point$5.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),o=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),i=o.redSqr().redISub(this.x.redAdd(this.x)),a=o.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,a)},Point$5.prototype.getX=function(){return this.x.fromRed()},Point$5.prototype.getY=function(){return this.y.fromRed()},Point$5.prototype.mul=function(e){return e=new BN$e(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Point$5.prototype.mulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o):this.curve._wnafMulAdd(1,n,o,2)},Point$5.prototype.jmulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o,!0):this.curve._wnafMulAdd(1,n,o,2,!0)},Point$5.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},Point$5.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},Point$5.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},inherits$5(JPoint$1,Base$5.BasePoint),ShortCurve$1.prototype.jpoint=function(e,t,r){return new JPoint$1(this,e,t,r)},JPoint$1.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},JPoint$1.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint$1.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),o=e.x.redMul(r),i=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(o),c=i.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),d=n.redMul(u),f=c.redSqr().redIAdd(l).redISub(d).redISub(d),h=c.redMul(d.redISub(f)).redISub(i.redMul(l)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(f,h,p)},JPoint$1.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),o=this.y,i=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=o.redSub(i);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),l=r.redMul(c),d=s.redSqr().redIAdd(u).redISub(l).redISub(l),f=s.redMul(l.redISub(d)).redISub(o.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(d,f,h)},JPoint$1.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var n=this.curve.a,o=this.curve.tinv,i=this.x,a=this.y,s=this.z,c=s.redSqr().redSqr(),u=a.redAdd(a);for(t=0;t<e;t++){var l=i.redSqr(),d=u.redSqr(),f=d.redSqr(),h=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(c)),p=i.redMul(d),y=h.redSqr().redISub(p.redAdd(p)),m=p.redISub(y),g=h.redMul(m);g=g.redIAdd(g).redISub(f);var b=u.redMul(s);t+1<e&&(c=c.redMul(f)),i=y,s=b,u=g}return this.curve.jpoint(i,u.redMul(o),s)},JPoint$1.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},JPoint$1.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),i=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(n).redISub(i);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n),c=s.redSqr().redISub(a).redISub(a),u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),e=c,t=s.redMul(a.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),d=this.y.redSqr(),f=d.redSqr(),h=this.x.redAdd(d).redSqr().redISub(l).redISub(f);h=h.redIAdd(h);var p=l.redAdd(l).redIAdd(l),y=p.redSqr(),m=f.redIAdd(f);m=(m=m.redIAdd(m)).redIAdd(m),e=y.redISub(h).redISub(h),t=p.redMul(h.redISub(e)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},JPoint$1.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),i=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(n).redISub(i);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),c=s.redSqr().redISub(a).redISub(a);e=c;var u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),t=s.redMul(a.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),d=this.y.redSqr(),f=this.x.redMul(d),h=this.x.redSub(l).redMul(this.x.redAdd(l));h=h.redAdd(h).redIAdd(h);var p=f.redIAdd(f),y=(p=p.redIAdd(p)).redAdd(p);e=h.redSqr().redISub(y),r=this.y.redAdd(this.z).redSqr().redISub(d).redISub(l);var m=d.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),t=h.redMul(p.redISub(e)).redISub(m)}return this.curve.jpoint(e,t,r)},JPoint$1.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,o=n.redSqr().redSqr(),i=t.redSqr(),a=r.redSqr(),s=i.redAdd(i).redIAdd(i).redIAdd(e.redMul(o)),c=t.redAdd(t),u=(c=c.redIAdd(c)).redMul(a),l=s.redSqr().redISub(u.redAdd(u)),d=u.redISub(l),f=a.redSqr();f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var h=s.redMul(d).redISub(f),p=r.redAdd(r).redMul(n);return this.curve.jpoint(l,h,p)},JPoint$1.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),o=e.redAdd(e).redIAdd(e),i=o.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).redISub(n),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(i)).redSqr(),c=n.redIAdd(n);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var u=o.redIAdd(a).redSqr().redISub(i).redISub(s).redISub(c),l=t.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var d=this.x.redMul(s).redISub(l);d=(d=d.redIAdd(d)).redIAdd(d);var f=this.y.redMul(u.redMul(c.redISub(u)).redISub(a.redMul(s)));f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var h=this.z.redAdd(a).redSqr().redISub(r).redISub(s);return this.curve.jpoint(d,f,h)},JPoint$1.prototype.mul=function(e,t){return e=new BN$e(e,t),this.curve._wnafMul(this,e)},JPoint$1.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),o=r.redMul(e.z);return 0===this.y.redMul(o).redISub(e.y.redMul(n)).cmpn(0)},JPoint$1.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),o=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(o),0===this.x.cmp(r))return!0}},JPoint$1.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},JPoint$1.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var BN$d=bnExports$1,inherits$4=inherits_browserExports,Base$4=base$1,utils$m=utils$p;function MontCurve$1(e){Base$4.call(this,"mont",e),this.a=new BN$d(e.a,16).toRed(this.red),this.b=new BN$d(e.b,16).toRed(this.red),this.i4=new BN$d(4).toRed(this.red).redInvm(),this.two=new BN$d(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits$4(MontCurve$1,Base$4);var mont$1=MontCurve$1;function Point$4(e,t,r){Base$4.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN$d(t,16),this.z=new BN$d(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}MontCurve$1.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},inherits$4(Point$4,Base$4.BasePoint),MontCurve$1.prototype.decodePoint=function(e,t){return this.point(utils$m.toArray(e,t),1)},MontCurve$1.prototype.point=function(e,t){return new Point$4(this,e,t)},MontCurve$1.prototype.pointFromJSON=function(e){return Point$4.fromJSON(this,e)},Point$4.prototype.precompute=function(){},Point$4.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Point$4.fromJSON=function(e,t){return new Point$4(e,t[0],t[1]||e.one)},Point$4.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Point$4.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Point$4.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),o=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,o)},Point$4.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Point$4.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),o=e.x.redAdd(e.z),i=e.x.redSub(e.z).redMul(r),a=o.redMul(n),s=t.z.redMul(i.redAdd(a).redSqr()),c=t.x.redMul(i.redISub(a).redSqr());return this.curve.point(s,c)},Point$4.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),o=[];0!==t.cmpn(0);t.iushrn(1))o.push(t.andln(1));for(var i=o.length-1;i>=0;i--)0===o[i]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},Point$4.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Point$4.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Point$4.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},Point$4.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Point$4.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var utils$l=utils$p,BN$c=bnExports$1,inherits$3=inherits_browserExports,Base$3=base$1,assert$f=utils$l.assert;function EdwardsCurve$1(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,Base$3.call(this,"edwards",e),this.a=new BN$c(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN$c(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN$c(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert$f(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}inherits$3(EdwardsCurve$1,Base$3);var edwards$1=EdwardsCurve$1;function Point$3(e,t,r,n,o){Base$3.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new BN$c(t,16),this.y=new BN$c(r,16),this.z=n?new BN$c(n,16):this.curve.one,this.t=o&&new BN$c(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}EdwardsCurve$1.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},EdwardsCurve$1.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},EdwardsCurve$1.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},EdwardsCurve$1.prototype.pointFromX=function(e,t){(e=new BN$c(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),i=n.redMul(o.redInvm()),a=i.redSqrt();if(0!==a.redSqr().redSub(i).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(t&&!s||!t&&s)&&(a=a.redNeg()),this.point(e,a)},EdwardsCurve$1.prototype.pointFromY=function(e,t){(e=new BN$c(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),i=n.redMul(o.redInvm());if(0===i.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=i.redSqrt();if(0!==a.redSqr().redSub(i).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},EdwardsCurve$1.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),o=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(o)},inherits$3(Point$3,Base$3.BasePoint),EdwardsCurve$1.prototype.pointFromJSON=function(e){return Point$3.fromJSON(this,e)},EdwardsCurve$1.prototype.point=function(e,t,r,n){return new Point$3(this,e,t,r,n)},Point$3.fromJSON=function(e,t){return new Point$3(e,t[0],t[1],t[2])},Point$3.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Point$3.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},Point$3.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),o=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),i=n.redAdd(t),a=i.redSub(r),s=n.redSub(t),c=o.redMul(a),u=i.redMul(s),l=o.redMul(s),d=a.redMul(i);return this.curve.point(c,u,d,l)},Point$3.prototype._projDbl=function(){var e,t,r,n,o,i,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(s)).redAdd(c);this.zOne?(e=a.redSub(s).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(n.redSub(c)),r=u.redSqr().redSub(u).redSub(u)):(o=this.z.redSqr(),i=u.redSub(o).redISub(o),e=a.redSub(s).redISub(c).redMul(i),t=u.redMul(n.redSub(c)),r=u.redMul(i))}else n=s.redAdd(c),o=this.curve._mulC(this.z).redSqr(),i=n.redSub(o).redSub(o),e=this.curve._mulC(a.redISub(n)).redMul(i),t=this.curve._mulC(n).redMul(s.redISub(c)),r=n.redMul(i);return this.curve.point(e,t,r)},Point$3.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Point$3.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),o=this.z.redMul(e.z.redAdd(e.z)),i=r.redSub(t),a=o.redSub(n),s=o.redAdd(n),c=r.redAdd(t),u=i.redMul(a),l=s.redMul(c),d=i.redMul(c),f=a.redMul(s);return this.curve.point(u,l,f,d)},Point$3.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),o=n.redSqr(),i=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(i).redMul(a),c=o.redSub(s),u=o.redAdd(s),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(a),d=n.redMul(c).redMul(l);return this.curve.twisted?(t=n.redMul(u).redMul(a.redSub(this.curve._mulA(i))),r=c.redMul(u)):(t=n.redMul(u).redMul(a.redSub(i)),r=this.curve._mulC(c).redMul(u)),this.curve.point(d,t,r)},Point$3.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Point$3.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Point$3.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},Point$3.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},Point$3.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Point$3.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Point$3.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Point$3.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Point$3.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},Point$3.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},Point$3.prototype.toP=Point$3.prototype.normalize,Point$3.prototype.mixedAdd=Point$3.prototype.add,function(e){var t=e;t.base=base$1,t.short=short$1,t.mont=mont$1,t.edwards=edwards$1}(curve$1);var curves$5={},secp256k1$1,hasRequiredSecp256k1$1;function requireSecp256k1$1(){return hasRequiredSecp256k1$1?secp256k1$1:(hasRequiredSecp256k1$1=1,secp256k1$1={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}})}!function(e){var t,r=e,n=hash$8,o=curve$1,i=utils$p.assert;function a(e){"short"===e.type?this.curve=new o.short(e):"edwards"===e.type?this.curve=new o.edwards(e):this.curve=new o.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var n=new a(t);return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=a,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:n.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:n.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:n.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:n.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:n.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:n.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:n.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{t=requireSecp256k1$1()}catch(e2){t=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:n.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",t]})}(curves$5);var BN$b=bnExports$1,utils$k=utils$p,assert$e=utils$k.assert;function KeyPair$7(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var key$3=KeyPair$7;KeyPair$7.fromPublic=function(e,t,r){return t instanceof KeyPair$7?t:new KeyPair$7(e,{pub:t,pubEnc:r})},KeyPair$7.fromPrivate=function(e,t,r){return t instanceof KeyPair$7?t:new KeyPair$7(e,{priv:t,privEnc:r})},KeyPair$7.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},KeyPair$7.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},KeyPair$7.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},KeyPair$7.prototype._importPrivate=function(e,t){this.priv=new BN$b(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},KeyPair$7.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?assert$e(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||assert$e(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},KeyPair$7.prototype.derive=function(e){return e.validate()||assert$e(e.validate(),"public point not validated"),e.mul(this.priv).getX()},KeyPair$7.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},KeyPair$7.prototype.verify=function(e,t,r){return this.ec.verify(e,t,this,void 0,r)},KeyPair$7.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var BN$a=bnExports$1,utils$j=utils$p,assert$d=utils$j.assert;function Signature$7(e,t){if(e instanceof Signature$7)return e;this._importDER(e,t)||(assert$d(e.r&&e.s,"Signature without r or s"),this.r=new BN$a(e.r,16),this.s=new BN$a(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var signature$3=Signature$7;function Position$1(){this.place=0}function getLength$1(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;if(0===e[t.place])return!1;for(var o=0,i=0,a=t.place;i<n;i++,a++)o<<=8,o|=e[a],o>>>=0;return!(o<=127)&&(t.place=a,o)}function rmPadding$1(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function constructLength$1(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}Signature$7.prototype._importDER=function(e,t){e=utils$j.toArray(e,t);var r=new Position$1;if(48!==e[r.place++])return!1;var n=getLength$1(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var o=getLength$1(e,r);if(!1===o)return!1;if(128&e[r.place])return!1;var i=e.slice(r.place,o+r.place);if(r.place+=o,2!==e[r.place++])return!1;var a=getLength$1(e,r);if(!1===a)return!1;if(e.length!==a+r.place)return!1;if(128&e[r.place])return!1;var s=e.slice(r.place,a+r.place);if(0===i[0]){if(!(128&i[1]))return!1;i=i.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new BN$a(i),this.s=new BN$a(s),this.recoveryParam=null,!0},Signature$7.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=rmPadding$1(t),r=rmPadding$1(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];constructLength$1(n,t.length),(n=n.concat(t)).push(2),constructLength$1(n,r.length);var o=n.concat(r),i=[48];return constructLength$1(i,o.length),i=i.concat(o),utils$j.encode(i,e)};var BN$9=bnExports$1,HmacDRBG$1=hmacDrbg$1,utils$i=utils$p,curves$4=curves$5,rand$1=requireBrorand(),assert$c=utils$i.assert,KeyPair$6=key$3,Signature$6=signature$3;function EC$1(e){if(!(this instanceof EC$1))return new EC$1(e);"string"==typeof e&&(assert$c(Object.prototype.hasOwnProperty.call(curves$4,e),"Unknown curve "+e),e=curves$4[e]),e instanceof curves$4.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var ec$1=EC$1;EC$1.prototype.keyPair=function(e){return new KeyPair$6(this,e)},EC$1.prototype.keyFromPrivate=function(e,t){return KeyPair$6.fromPrivate(this,e,t)},EC$1.prototype.keyFromPublic=function(e,t){return KeyPair$6.fromPublic(this,e,t)},EC$1.prototype.genKeyPair=function(e){e||(e={});for(var t=new HmacDRBG$1({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||rand$1(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new BN$9(2));;){var o=new BN$9(t.generate(r));if(!(o.cmp(n)>0))return o.iaddn(1),this.keyFromPrivate(o)}},EC$1.prototype._truncateToN=function(e,t,r){var n;if(BN$9.isBN(e)||"number"==typeof e)n=(e=new BN$9(e,16)).byteLength();else if("object"==typeof e)n=e.length,e=new BN$9(e,16);else{var o=e.toString();n=o.length+1>>>1,e=new BN$9(o,16)}"number"!=typeof r&&(r=8*n);var i=r-this.n.bitLength();return i>0&&(e=e.ushrn(i)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},EC$1.prototype.sign=function(e,t,r,n){if("object"==typeof r&&(n=r,r=null),n||(n={}),"string"!=typeof e&&"number"!=typeof e&&!BN$9.isBN(e)){assert$c("object"==typeof e&&e&&"number"==typeof e.length,"Expected message to be an array-like, a hex string, or a BN instance"),assert$c(e.length>>>0===e.length);for(var o=0;o<e.length;o++)assert$c((255&e[o])===e[o])}t=this.keyFromPrivate(t,r),e=this._truncateToN(e,!1,n.msgBitLength),assert$c(!e.isNeg(),"Can not sign a negative message");var i=this.n.byteLength(),a=t.getPrivate().toArray("be",i),s=e.toArray("be",i);assert$c(new BN$9(s).eq(e),"Can not sign message");for(var c=new HmacDRBG$1({hash:this.hash,entropy:a,nonce:s,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new BN$9(1)),l=0;;l++){var d=n.k?n.k(l):new BN$9(c.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(u)>=0)){var f=this.g.mul(d);if(!f.isInfinity()){var h=f.getX(),p=h.umod(this.n);if(0!==p.cmpn(0)){var y=d.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e));if(0!==(y=y.umod(this.n)).cmpn(0)){var m=(f.getY().isOdd()?1:0)|(0!==h.cmp(p)?2:0);return n.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),m^=1),new Signature$6({r:p,s:y,recoveryParam:m})}}}}}},EC$1.prototype.verify=function(e,t,r,n,o){o||(o={}),e=this._truncateToN(e,!1,o.msgBitLength),r=this.keyFromPublic(r,n);var i=(t=new Signature$6(t,"hex")).r,a=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var s,c=a.invm(this.n),u=c.mul(e).umod(this.n),l=c.mul(i).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(u,r.getPublic(),l)).isInfinity()&&s.eqXToP(i):!(s=this.g.mulAdd(u,r.getPublic(),l)).isInfinity()&&0===s.getX().umod(this.n).cmp(i)},EC$1.prototype.recoverPubKey=function(e,t,r,n){assert$c((3&r)===r,"The recovery param is more than two bits"),t=new Signature$6(t,n);var o=this.n,i=new BN$9(e),a=t.r,s=t.s,c=1&r,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var l=t.r.invm(o),d=o.sub(i).mul(l).umod(o),f=s.mul(l).umod(o);return this.g.mulAdd(d,a,f)},EC$1.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new Signature$6(t,n)).recoveryParam)return t.recoveryParam;for(var o=0;o<4;o++){var i;try{i=this.recoverPubKey(e,t,o)}catch(a){continue}if(i.eq(r))return o}throw new Error("Unable to find valid recovery factor")};var utils$h=utils$p,assert$b=utils$h.assert,parseBytes$5=utils$h.parseBytes,cachedProperty$3=utils$h.cachedProperty;function KeyPair$5(e,t){this.eddsa=e,this._secret=parseBytes$5(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=parseBytes$5(t.pub)}KeyPair$5.fromPublic=function(e,t){return t instanceof KeyPair$5?t:new KeyPair$5(e,{pub:t})},KeyPair$5.fromSecret=function(e,t){return t instanceof KeyPair$5?t:new KeyPair$5(e,{secret:t})},KeyPair$5.prototype.secret=function(){return this._secret},cachedProperty$3(KeyPair$5,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),cachedProperty$3(KeyPair$5,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),cachedProperty$3(KeyPair$5,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),cachedProperty$3(KeyPair$5,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),cachedProperty$3(KeyPair$5,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),cachedProperty$3(KeyPair$5,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),KeyPair$5.prototype.sign=function(e){return assert$b(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},KeyPair$5.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},KeyPair$5.prototype.getSecret=function(e){return assert$b(this._secret,"KeyPair is public only"),utils$h.encode(this.secret(),e)},KeyPair$5.prototype.getPublic=function(e){return utils$h.encode(this.pubBytes(),e)};var key$2=KeyPair$5,BN$8=bnExports$1,utils$g=utils$p,assert$a=utils$g.assert,cachedProperty$2=utils$g.cachedProperty,parseBytes$4=utils$g.parseBytes;function Signature$5(e,t){this.eddsa=e,"object"!=typeof t&&(t=parseBytes$4(t)),Array.isArray(t)&&(assert$a(t.length===2*e.encodingLength,"Signature has invalid size"),t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),assert$a(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof BN$8&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}cachedProperty$2(Signature$5,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),cachedProperty$2(Signature$5,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),cachedProperty$2(Signature$5,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),cachedProperty$2(Signature$5,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),Signature$5.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Signature$5.prototype.toHex=function(){return utils$g.encode(this.toBytes(),"hex").toUpperCase()};var signature$2=Signature$5,hash$1=hash$8,curves$3=curves$5,utils$f=utils$p,assert$9=utils$f.assert,parseBytes$3=utils$f.parseBytes,KeyPair$4=key$2,Signature$4=signature$2;function EDDSA$1(e){if(assert$9("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof EDDSA$1))return new EDDSA$1(e);e=curves$3[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=hash$1.sha512}var eddsa$1=EDDSA$1;EDDSA$1.prototype.sign=function(e,t){e=parseBytes$3(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),o=this.g.mul(n),i=this.encodePoint(o),a=this.hashInt(i,r.pubBytes(),e).mul(r.priv()),s=n.add(a).umod(this.curve.n);return this.makeSignature({R:o,S:s,Rencoded:i})},EDDSA$1.prototype.verify=function(e,t,r){if(e=parseBytes$3(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var n=this.keyFromPublic(r),o=this.hashInt(t.Rencoded(),n.pubBytes(),e),i=this.g.mul(t.S());return t.R().add(n.pub().mul(o)).eq(i)},EDDSA$1.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return utils$f.intFromLE(e.digest()).umod(this.curve.n)},EDDSA$1.prototype.keyFromPublic=function(e){return KeyPair$4.fromPublic(this,e)},EDDSA$1.prototype.keyFromSecret=function(e){return KeyPair$4.fromSecret(this,e)},EDDSA$1.prototype.makeSignature=function(e){return e instanceof Signature$4?e:new Signature$4(this,e)},EDDSA$1.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},EDDSA$1.prototype.decodePoint=function(e){var t=(e=utils$f.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),n=!!(128&e[t]),o=utils$f.intFromLE(r);return this.curve.pointFromY(o,n)},EDDSA$1.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},EDDSA$1.prototype.decodeInt=function(e){return utils$f.intFromLE(e)},EDDSA$1.prototype.isPoint=function(e){return e instanceof this.pointClass},function(e){var t=e;t.version=require$$0$3.version,t.utils=utils$p,t.rand=requireBrorand(),t.curve=curve$1,t.curves=curves$5,t.ec=ec$1,t.eddsa=eddsa$1}(elliptic$1);const C$6={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"}},Vn$1={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}};function _$6(e,t){const{message:r,code:n}=Vn$1[e];return{message:t?`${r} ${t}`:r,code:n}}const PARSE_ERROR="PARSE_ERROR",INVALID_REQUEST="INVALID_REQUEST",METHOD_NOT_FOUND="METHOD_NOT_FOUND",INVALID_PARAMS="INVALID_PARAMS",INTERNAL_ERROR="INTERNAL_ERROR",SERVER_ERROR="SERVER_ERROR",RESERVED_ERROR_CODES=[-32700,-32600,-32601,-32602,-32603],STANDARD_ERROR_MAP={[PARSE_ERROR]:{code:-32700,message:"Parse error"},[INVALID_REQUEST]:{code:-32600,message:"Invalid Request"},[METHOD_NOT_FOUND]:{code:-32601,message:"Method not found"},[INVALID_PARAMS]:{code:-32602,message:"Invalid params"},[INTERNAL_ERROR]:{code:-32603,message:"Internal error"},[SERVER_ERROR]:{code:-32e3,message:"Server error"}},DEFAULT_ERROR=SERVER_ERROR;function isReservedErrorCode(e){return RESERVED_ERROR_CODES.includes(e)}function getError(e){return Object.keys(STANDARD_ERROR_MAP).includes(e)?STANDARD_ERROR_MAP[e]:STANDARD_ERROR_MAP[DEFAULT_ERROR]}function getErrorByCode(e){const t=Object.values(STANDARD_ERROR_MAP).find((t=>t.code===e));return t||STANDARD_ERROR_MAP[DEFAULT_ERROR]}function parseConnectionError(e,t,r){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${t}`):e}var cjs$4={},crypto$1={},hasRequiredCrypto;function requireCrypto(){if(hasRequiredCrypto)return crypto$1;function e(){return(null==commonjsGlobal?void 0:commonjsGlobal.crypto)||(null==commonjsGlobal?void 0:commonjsGlobal.msCrypto)||{}}function t(){const t=e();return t.subtle||t.webkitSubtle}return hasRequiredCrypto=1,Object.defineProperty(crypto$1,"__esModule",{value:!0}),crypto$1.isBrowserCryptoAvailable=crypto$1.getSubtleCrypto=crypto$1.getBrowerCrypto=void 0,crypto$1.getBrowerCrypto=e,crypto$1.getSubtleCrypto=t,crypto$1.isBrowserCryptoAvailable=function(){return!!e()&&!!t()},crypto$1}var env={},hasRequiredEnv;function requireEnv(){if(hasRequiredEnv)return env;function e(){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product}function t(){return void 0!==process$1&&void 0!==process$1.versions&&void 0!==process$1.versions.node}return hasRequiredEnv=1,Object.defineProperty(env,"__esModule",{value:!0}),env.isBrowser=env.isNode=env.isReactNative=void 0,env.isReactNative=e,env.isNode=t,env.isBrowser=function(){return!e()&&!t()},env}function payloadId(e=3){return Date.now()*Math.pow(10,e)+Math.floor(Math.random()*Math.pow(10,e))}function getBigIntRpcId(e=6){return BigInt(payloadId(e))}function formatJsonRpcRequest(e,t,r){return{id:r||payloadId(),jsonrpc:"2.0",method:e,params:t}}function formatJsonRpcResult(e,t){return{id:e,jsonrpc:"2.0",result:t}}function formatJsonRpcError(e,t,r){return{id:e,jsonrpc:"2.0",error:formatErrorMessage(t)}}function formatErrorMessage(e,t){return void 0===e?getError(INTERNAL_ERROR):("string"==typeof e&&(e=Object.assign(Object.assign({},getError(SERVER_ERROR)),{message:e})),isReservedErrorCode(e.code)&&(e=getErrorByCode(e.code)),e)}!function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=require$$0$4;t.__exportStar(requireCrypto(),e),t.__exportStar(requireEnv(),e)}(cjs$4);let e$8=class{},n$8=class extends e$8{constructor(){super()}},r$5=class extends n$8{constructor(e){super()}};const WS_REGEX="^wss?:";function getUrlProtocol(e){const t=e.match(new RegExp(/^\w+:/,"gi"));if(t&&t.length)return t[0]}function matchRegexProtocol(e,t){const r=getUrlProtocol(e);return void 0!==r&&new RegExp(t).test(r)}function isWsUrl(e){return matchRegexProtocol(e,WS_REGEX)}function isLocalhostUrl(e){return new RegExp("wss?://localhost(:d{2,5})?").test(e)}function isJsonRpcPayload(e){return"object"==typeof e&&"id"in e&&"jsonrpc"in e&&"2.0"===e.jsonrpc}function isJsonRpcRequest(e){return isJsonRpcPayload(e)&&"method"in e}function isJsonRpcResponse(e){return isJsonRpcPayload(e)&&(isJsonRpcResult(e)||isJsonRpcError(e))}function isJsonRpcResult(e){return"result"in e}function isJsonRpcError(e){return"error"in e}let o$8=class extends r$5{constructor(e){super(e),this.events=new eventsExports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(formatJsonRpcRequest(e.method,e.params||[],e.id||getBigIntRpcId().toString()),t)}async requestStrict(e,t){return new Promise((async(r,n)=>{if(!this.connection.connected)try{await this.open()}catch(o){n(o)}this.events.on(`${e.id}`,(e=>{isJsonRpcError(e)?n(e.error):r(e.result)}));try{await this.connection.send(e,t)}catch(o){n(o)}}))}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),isJsonRpcResponse(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&3e3===e.code&&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(),"string"==typeof e&&(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)}};var lodash_isequal={exports:{}};lodash_isequal.exports,function(e,t){var r="__lodash_hash_undefined__",n=9007199254740991,o="[object Arguments]",i="[object Array]",a="[object Boolean]",s="[object Date]",c="[object Error]",u="[object Function]",l="[object Map]",d="[object Number]",f="[object Object]",h="[object Promise]",p="[object RegExp]",y="[object Set]",m="[object String]",g="[object Symbol]",b="[object WeakMap]",v="[object ArrayBuffer]",w="[object DataView]",_=/^\[object .+?Constructor\]$/,I=/^(?:0|[1-9]\d*)$/,T={};T["[object Float32Array]"]=T["[object Float64Array]"]=T["[object Int8Array]"]=T["[object Int16Array]"]=T["[object Int32Array]"]=T["[object Uint8Array]"]=T["[object Uint8ClampedArray]"]=T["[object Uint16Array]"]=T["[object Uint32Array]"]=!0,T[o]=T[i]=T[v]=T[a]=T[w]=T[s]=T[c]=T[u]=T[l]=T[d]=T[f]=T[p]=T[y]=T[m]=T[b]=!1;var k="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,$="object"==typeof self&&self&&self.Object===Object&&self,S=k||$||Function("return this")(),A=t&&!t.nodeType&&t,E=A&&e&&!e.nodeType&&e,C=E&&E.exports===A,R=C&&k.process,O=function(){try{return R&&R.binding&&R.binding("util")}catch(e2){}}(),N=O&&O.isTypedArray;function P(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function M(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function B(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var D,x,L,U=Array.prototype,j=Function.prototype,F=Object.prototype,q=S["__core-js_shared__"],K=j.toString,H=F.hasOwnProperty,G=(D=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||""))?"Symbol(src)_1."+D:"",z=F.toString,V=RegExp("^"+K.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),W=C?S.Buffer:void 0,Q=S.Symbol,Y=S.Uint8Array,X=F.propertyIsEnumerable,J=U.splice,Z=Q?Q.toStringTag:void 0,ee=Object.getOwnPropertySymbols,te=W?W.isBuffer:void 0,re=(x=Object.keys,L=Object,function(e){return x(L(e))}),ne=Oe(S,"DataView"),oe=Oe(S,"Map"),ie=Oe(S,"Promise"),ae=Oe(S,"Set"),se=Oe(S,"WeakMap"),ce=Oe(Object,"create"),ue=Be(ne),le=Be(oe),de=Be(ie),fe=Be(ae),he=Be(se),pe=Q?Q.prototype:void 0,ye=pe?pe.valueOf:void 0;function me(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ge(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function be(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ve(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new be;++t<r;)this.add(e[t])}function we(e){var t=this.__data__=new ge(e);this.size=t.size}function _e(e,t){var r=Le(e),n=!r&&xe(e),o=!r&&!n&&Ue(e),i=!r&&!n&&!o&&He(e),a=r||n||o||i,s=a?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var u in e)!H.call(e,u)||a&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Me(u,c))||s.push(u);return s}function Ie(e,t){for(var r=e.length;r--;)if(De(e[r][0],t))return r;return-1}function Te(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Z&&Z in Object(e)?function(e){var t=H.call(e,Z),r=e[Z];try{e[Z]=void 0;var n=!0}catch(e2){}var o=z.call(e);n&&(t?e[Z]=r:delete e[Z]);return o}(e):function(e){return z.call(e)}(e)}function ke(e){return Ke(e)&&Te(e)==o}function $e(e,t,r,n,u){return e===t||(null==e||null==t||!Ke(e)&&!Ke(t)?e!=e&&t!=t:function(e,t,r,n,u,h){var b=Le(e),_=Le(t),I=b?i:Pe(e),T=_?i:Pe(t),k=(I=I==o?f:I)==f,$=(T=T==o?f:T)==f,S=I==T;if(S&&Ue(e)){if(!Ue(t))return!1;b=!0,k=!1}if(S&&!k)return h||(h=new we),b||He(e)?Ee(e,t,r,n,u,h):function(e,t,r,n,o,i,u){switch(r){case w:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case v:return!(e.byteLength!=t.byteLength||!i(new Y(e),new Y(t)));case a:case s:case d:return De(+e,+t);case c:return e.name==t.name&&e.message==t.message;case p:case m:return e==t+"";case l:var f=M;case y:var h=1&n;if(f||(f=B),e.size!=t.size&&!h)return!1;var b=u.get(e);if(b)return b==t;n|=2,u.set(e,t);var _=Ee(f(e),f(t),n,o,i,u);return u.delete(e),_;case g:if(ye)return ye.call(e)==ye.call(t)}return!1}(e,t,I,r,n,u,h);if(!(1&r)){var A=k&&H.call(e,"__wrapped__"),E=$&&H.call(t,"__wrapped__");if(A||E){var C=A?e.value():e,R=E?t.value():t;return h||(h=new we),u(C,R,r,n,h)}}if(!S)return!1;return h||(h=new we),function(e,t,r,n,o,i){var a=1&r,s=Ce(e),c=s.length,u=Ce(t),l=u.length;if(c!=l&&!a)return!1;var d=c;for(;d--;){var f=s[d];if(!(a?f in t:H.call(t,f)))return!1}var h=i.get(e);if(h&&i.get(t))return h==t;var p=!0;i.set(e,t),i.set(t,e);var y=a;for(;++d<c;){var m=e[f=s[d]],g=t[f];if(n)var b=a?n(g,m,f,t,e,i):n(m,g,f,e,t,i);if(!(void 0===b?m===g||o(m,g,r,n,i):b)){p=!1;break}y||(y="constructor"==f)}if(p&&!y){var v=e.constructor,w=t.constructor;v==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof w&&w instanceof w||(p=!1)}return i.delete(e),i.delete(t),p}(e,t,r,n,u,h)}(e,t,r,n,$e,u))}function Se(e){return!(!qe(e)||function(e){return!!G&&G in e}(e))&&(je(e)?V:_).test(Be(e))}function Ae(e){if(r=(t=e)&&t.constructor,n="function"==typeof r&&r.prototype||F,t!==n)return re(e);var t,r,n,o=[];for(var i in Object(e))H.call(e,i)&&"constructor"!=i&&o.push(i);return o}function Ee(e,t,r,n,o,i){var a=1&r,s=e.length,c=t.length;if(s!=c&&!(a&&c>s))return!1;var u=i.get(e);if(u&&i.get(t))return u==t;var l=-1,d=!0,f=2&r?new ve:void 0;for(i.set(e,t),i.set(t,e);++l<s;){var h=e[l],p=t[l];if(n)var y=a?n(p,h,l,t,e,i):n(h,p,l,e,t,i);if(void 0!==y){if(y)continue;d=!1;break}if(f){if(!P(t,(function(e,t){if(a=t,!f.has(a)&&(h===e||o(h,e,r,n,i)))return f.push(t);var a}))){d=!1;break}}else if(h!==p&&!o(h,p,r,n,i)){d=!1;break}}return i.delete(e),i.delete(t),d}function Ce(e){return function(e,t,r){var n=t(e);return Le(e)?n:function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}(n,r(e))}(e,Ge,Ne)}function Re(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function Oe(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return Se(r)?r:void 0}me.prototype.clear=function(){this.__data__=ce?ce(null):{},this.size=0},me.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},me.prototype.get=function(e){var t=this.__data__;if(ce){var n=t[e];return n===r?void 0:n}return H.call(t,e)?t[e]:void 0},me.prototype.has=function(e){var t=this.__data__;return ce?void 0!==t[e]:H.call(t,e)},me.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=ce&&void 0===t?r:t,this},ge.prototype.clear=function(){this.__data__=[],this.size=0},ge.prototype.delete=function(e){var t=this.__data__,r=Ie(t,e);return!(r<0)&&(r==t.length-1?t.pop():J.call(t,r,1),--this.size,!0)},ge.prototype.get=function(e){var t=this.__data__,r=Ie(t,e);return r<0?void 0:t[r][1]},ge.prototype.has=function(e){return Ie(this.__data__,e)>-1},ge.prototype.set=function(e,t){var r=this.__data__,n=Ie(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},be.prototype.clear=function(){this.size=0,this.__data__={hash:new me,map:new(oe||ge),string:new me}},be.prototype.delete=function(e){var t=Re(this,e).delete(e);return this.size-=t?1:0,t},be.prototype.get=function(e){return Re(this,e).get(e)},be.prototype.has=function(e){return Re(this,e).has(e)},be.prototype.set=function(e,t){var r=Re(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},ve.prototype.add=ve.prototype.push=function(e){return this.__data__.set(e,r),this},ve.prototype.has=function(e){return this.__data__.has(e)},we.prototype.clear=function(){this.__data__=new ge,this.size=0},we.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},we.prototype.get=function(e){return this.__data__.get(e)},we.prototype.has=function(e){return this.__data__.has(e)},we.prototype.set=function(e,t){var r=this.__data__;if(r instanceof ge){var n=r.__data__;if(!oe||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new be(n)}return r.set(e,t),this.size=r.size,this};var Ne=ee?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,i=[];++r<n;){var a=e[r];t(a,r,e)&&(i[o++]=a)}return i}(ee(e),(function(t){return X.call(e,t)})))}:function(){return[]},Pe=Te;function Me(e,t){return!!(t=null==t?n:t)&&("number"==typeof e||I.test(e))&&e>-1&&e%1==0&&e<t}function Be(e){if(null!=e){try{return K.call(e)}catch(e2){}try{return e+""}catch(e2){}}return""}function De(e,t){return e===t||e!=e&&t!=t}(ne&&Pe(new ne(new ArrayBuffer(1)))!=w||oe&&Pe(new oe)!=l||ie&&Pe(ie.resolve())!=h||ae&&Pe(new ae)!=y||se&&Pe(new se)!=b)&&(Pe=function(e){var t=Te(e),r=t==f?e.constructor:void 0,n=r?Be(r):"";if(n)switch(n){case ue:return w;case le:return l;case de:return h;case fe:return y;case he:return b}return t});var xe=ke(function(){return arguments}())?ke:function(e){return Ke(e)&&H.call(e,"callee")&&!X.call(e,"callee")},Le=Array.isArray;var Ue=te||function(){return!1};function je(e){if(!qe(e))return!1;var t=Te(e);return t==u||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Fe(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}function qe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ke(e){return null!=e&&"object"==typeof e}var He=N?function(e){return function(t){return e(t)}}(N):function(e){return Ke(e)&&Fe(e.length)&&!!T[Te(e)]};function Ge(e){return null!=(t=e)&&Fe(t.length)&&!je(t)?_e(e):Ae(e);var t}e.exports=function(e,t){return $e(e,t)}}(lodash_isequal,lodash_isequal.exports);var lodash_isequalExports=lodash_isequal.exports;const ys$1=getDefaultExportFromCjs$1(lodash_isequalExports);function unfetch_module(e,t){return t=t||{},new Promise((function(r,n){var o=new XMLHttpRequest,i=[],a=[],s={},c=function(){return{ok:2==(o.status/100|0),statusText:o.statusText,status:o.status,url:o.responseURL,text:function(){return Promise.resolve(o.responseText)},json:function(){return Promise.resolve(o.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([o.response]))},clone:c,headers:{keys:function(){return i},entries:function(){return a},get:function(e){return s[e.toLowerCase()]},has:function(e){return e.toLowerCase()in s}}}};for(var u in o.open(t.method||"get",e,!0),o.onload=function(){o.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,r){i.push(t=t.toLowerCase()),a.push([t,r]),s[t]=s[t]?s[t]+","+r:r})),r(c())},o.onerror=n,o.withCredentials="include"==t.credentials,t.headers)o.setRequestHeader(u,t.headers[u]);o.send(t.body||null)}))}const unfetch_module$1=Object.freeze(Object.defineProperty({__proto__:null,default:unfetch_module},Symbol.toStringTag,{value:"Module"})),require$$0$2=getAugmentedNamespace(unfetch_module$1);function ut$2(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<e.length;o++){var i=e.charAt(o),a=i.charCodeAt(0);if(255!==r[a])throw new TypeError(i+" is ambiguous");r[a]=o}var s=e.length,c=e.charAt(0),u=Math.log(s)/Math.log(256),l=Math.log(256)/Math.log(s);function d(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,o=0;e[t]===c;)n++,t++;for(var i=(e.length-t)*u+1>>>0,a=new Uint8Array(i);e[t];){var l=r[e.charCodeAt(t)];if(255===l)return;for(var d=0,f=i-1;(0!==l||d<o)&&-1!==f;f--,d++)l+=s*a[f]>>>0,a[f]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=d,t++}if(" "!==e[t]){for(var h=i-o;h!==i&&0===a[h];)h++;for(var p=new Uint8Array(n+(i-h)),y=n;h!==i;)p[y++]=a[h++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,o=0,i=t.length;o!==i&&0===t[o];)o++,r++;for(var a=(i-o)*l+1>>>0,u=new Uint8Array(a);o!==i;){for(var d=t[o],f=0,h=a-1;(0!==d||f<n)&&-1!==h;h--,f++)d+=256*u[h]>>>0,u[h]=d%s>>>0,d=d/s>>>0;if(0!==d)throw new Error("Non-zero carry");n=f,o++}for(var p=a-n;p!==a&&0===u[p];)p++;for(var y=c.repeat(r);p<a;++p)y+=e.charAt(u[p]);return y},decodeUnsafe:d,decode:function(e){var r=d(e);if(r)return r;throw new Error(`Non-${t} character`)}}}self.fetch||(self.fetch=require$$0$2.default||require$$0$2);var at$2=ut$2,Dt$2=at$2;const re$2=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},ct$2=e=>(new TextEncoder).encode(e),ht$2=e=>(new TextDecoder).decode(e);let lt$2=class{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},dt$2=class{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){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))}throw Error("Can only multibase decode strings")}or(e){return ie$1(this,e)}},pt$3=class{constructor(e){this.decoders=e}or(e){return ie$1(this,e)}decode(e){const t=e[0],r=this.decoders[t];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 ie$1=(e,t)=>new pt$3({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});let ft$1=class{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new lt$2(e,t,r),this.decoder=new dt$2(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};const O$4=({name:e,prefix:t,encode:r,decode:n})=>new ft$1(e,t,r,n),T$4=({prefix:e,name:t,alphabet:r})=>{const{encode:n,decode:o}=Dt$2(r,t);return O$4({prefix:e,name:t,encode:n,decode:e=>re$2(o(e))})},gt$3=(e,t,r,n)=>{const o={};for(let l=0;l<t.length;++l)o[t[l]]=l;let i=e.length;for(;"="===e[i-1];)--i;const a=new Uint8Array(i*r/8|0);let s=0,c=0,u=0;for(let l=0;l<i;++l){const t=o[e[l]];if(void 0===t)throw new SyntaxError(`Non-${n} character`);c=c<<r|t,s+=r,s>=8&&(s-=8,a[u++]=255&c>>s)}if(s>=r||255&c<<8-s)throw new SyntaxError("Unexpected end of data");return a},Et$1=(e,t,r)=>{const n="="===t[t.length-1],o=(1<<r)-1;let i="",a=0,s=0;for(let c=0;c<e.length;++c)for(s=s<<8|e[c],a+=8;a>r;)a-=r,i+=t[o&s>>a];if(a&&(i+=t[o&s<<r-a]),n)for(;i.length*r&7;)i+="=";return i},d$5=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>O$4({prefix:t,name:e,encode:e=>Et$1(e,n,r),decode:t=>gt$3(t,n,r,e)}),bt$2=O$4({prefix:"\0",name:"identity",encode:e=>ht$2(e),decode:e=>ct$2(e)});var yt$2=Object.freeze({__proto__:null,identity:bt$2});const wt$1=d$5({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ct$1=Object.freeze({__proto__:null,base2:wt$1});const mt$1=d$5({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var vt$2=Object.freeze({__proto__:null,base8:mt$1});const At$1=T$4({prefix:"9",name:"base10",alphabet:"0123456789"});var _t$2=Object.freeze({__proto__:null,base10:At$1});const xt$2=d$5({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Rt$1=d$5({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ft$2=Object.freeze({__proto__:null,base16:xt$2,base16upper:Rt$1});const Tt$2=d$5({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),It$1=d$5({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),qt$2=d$5({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ut$1=d$5({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ot$2=d$5({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),St$1=d$5({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Pt$2=d$5({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Nt$2=d$5({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),$t$2=d$5({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Bt$2=Object.freeze({__proto__:null,base32:Tt$2,base32upper:It$1,base32pad:qt$2,base32padupper:Ut$1,base32hex:Ot$2,base32hexupper:St$1,base32hexpad:Pt$2,base32hexpadupper:Nt$2,base32z:$t$2});const zt$2=T$4({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),jt$1=T$4({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Mt$2=Object.freeze({__proto__:null,base36:zt$2,base36upper:jt$1});const Lt$2=T$4({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Kt$2=T$4({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Vt$2=Object.freeze({__proto__:null,base58btc:Lt$2,base58flickr:Kt$2});const kt$2=d$5({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Jt$2=d$5({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Xt$2=d$5({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Gt$2=d$5({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ht$2=Object.freeze({__proto__:null,base64:kt$2,base64pad:Jt$2,base64url:Xt$2,base64urlpad:Gt$2});const ne$1=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Yt$2=ne$1.reduce(((e,t,r)=>(e[r]=t,e)),[]),Qt$2=ne$1.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]);function Zt$2(e){return e.reduce(((e,t)=>e+=Yt$2[t]),"")}function Wt$2(e){const t=[];for(const r of e){const e=Qt$2[r.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}const er$2=O$4({prefix:"🚀",name:"base256emoji",encode:Zt$2,decode:Wt$2});var tr$1=Object.freeze({__proto__:null,base256emoji:er$2}),rr$1=oe$1,se$1=128,ir$2=127,nr$2=~ir$2,sr$1=Math.pow(2,31);function oe$1(e,t,r){t=t||[];for(var n=r=r||0;e>=sr$1;)t[r++]=255&e|se$1,e/=128;for(;e&nr$2;)t[r++]=255&e|se$1,e>>>=7;return t[r]=0|e,oe$1.bytes=r-n+1,t}var or$1=j$2,ur$2=128,ue=127;function j$2(e,t){var r,n=0,o=0,i=t=t||0,a=e.length;do{if(i>=a)throw j$2.bytes=0,new RangeError("Could not decode varint");r=e[i++],n+=o<28?(r&ue)<<o:(r&ue)*Math.pow(2,o),o+=7}while(r>=ur$2);return j$2.bytes=i-t,n}var ar$2=Math.pow(2,7),Dr$2=Math.pow(2,14),cr$2=Math.pow(2,21),hr$2=Math.pow(2,28),lr$2=Math.pow(2,35),dr$2=Math.pow(2,42),pr$2=Math.pow(2,49),fr$3=Math.pow(2,56),gr$2=Math.pow(2,63),Er$2=function(e){return e<ar$2?1:e<Dr$2?2:e<cr$2?3:e<hr$2?4:e<lr$2?5:e<dr$2?6:e<pr$2?7:e<fr$3?8:e<gr$2?9:10},br$2={encode:rr$1,decode:or$1,encodingLength:Er$2},ae$2=br$2;const De$1=(e,t,r=0)=>(ae$2.encode(e,t,r),t),ce$1=e=>ae$2.encodingLength(e),M$6=(e,t)=>{const r=t.byteLength,n=ce$1(e),o=n+ce$1(r),i=new Uint8Array(o+r);return De$1(e,i,0),De$1(r,i,n),i.set(t,o),new yr$2(e,r,t,i)};let yr$2=class{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};const he$1=({name:e,code:t,encode:r})=>new wr$2(e,t,r);let wr$2=class{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?M$6(this.code,t):t.then((e=>M$6(this.code,e)))}throw Error("Unknown type, must be binary type")}};const le$1=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Cr$2=he$1({name:"sha2-256",code:18,encode:le$1("SHA-256")}),mr$2=he$1({name:"sha2-512",code:19,encode:le$1("SHA-512")});var vr$2=Object.freeze({__proto__:null,sha256:Cr$2,sha512:mr$2});const de$2=0,Ar$2="identity",pe$1=re$2,_r$2=e=>M$6(de$2,pe$1(e)),xr$2={code:de$2,name:Ar$2,encode:pe$1,digest:_r$2};var Rr$2=Object.freeze({__proto__:null,identity:xr$2});new TextEncoder,new TextDecoder;let n$7=class extends IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},h$6=class extends IEvents{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}},a$5=class{constructor(e,t){this.logger=e,this.core=t}},g$5=class extends IEvents{constructor(e,t){super(),this.relayer=e,this.logger=t}},u$4=class extends IEvents{constructor(e){super()}},p$3=class{constructor(e,t,r,n){this.core=e,this.logger=t,this.name=r}},d$4=class extends IEvents{constructor(e,t){super(),this.relayer=e,this.logger=t}},x$5=class extends IEvents{constructor(e,t){super(),this.core=e,this.logger=t}},y$6=class{constructor(e,t,r){this.core=e,this.logger=t,this.store=r}},v$5=class{constructor(e,t){this.projectId=e,this.logger=t}},C$5=class{constructor(e,t,r){this.core=e,this.logger=t,this.telemetryEnabled=r}},S$7=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},M$5=class{constructor(e){this.client=e}};var __spreadArray=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},BrowserInfo$1=function(){return function(e,t,r){this.name=e,this.version=t,this.os=r,this.type="browser"}}(),NodeInfo$1=function(){return function(e){this.version=e,this.type="node",this.name="node",this.os=process$1.platform}}(),SearchBotDeviceInfo$1=function(){return function(e,t,r,n){this.name=e,this.version=t,this.os=r,this.bot=n,this.type="bot-device"}}(),BotInfo$1=function(){return function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}}(),ReactNativeInfo$1=function(){return function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}}(),SEARCHBOX_UA_REGEX$1=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,SEARCHBOT_OS_REGEX$1=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,REQUIRED_VERSION_PARTS$1=3,userAgentRules$1=[["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",SEARCHBOX_UA_REGEX$1]],operatingSystemRules$1=[["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 detect$1(e){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new ReactNativeInfo$1:"undefined"!=typeof navigator?parseUserAgent$1(navigator.userAgent):getNodeVersion$1()}function matchUserAgent$1(e){return""!==e&&userAgentRules$1.reduce((function(t,r){var n=r[0],o=r[1];if(t)return t;var i=o.exec(e);return!!i&&[n,i]}),!1)}function parseUserAgent$1(e){var t=matchUserAgent$1(e);if(!t)return null;var r=t[0],n=t[1];if("searchbot"===r)return new BotInfo$1;var o=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);o?o.length<REQUIRED_VERSION_PARTS$1&&(o=__spreadArray(__spreadArray([],o,!0),createVersionParts$1(REQUIRED_VERSION_PARTS$1-o.length),!0)):o=[];var i=o.join("."),a=detectOS$2(e),s=SEARCHBOT_OS_REGEX$1.exec(e);return s&&s[1]?new SearchBotDeviceInfo$1(r,i,a,s[1]):new BrowserInfo$1(r,i,a)}function detectOS$2(e){for(var t=0,r=operatingSystemRules$1.length;t<r;t++){var n=operatingSystemRules$1[t],o=n[0];if(n[1].exec(e))return o}return null}function getNodeVersion$1(){return void 0!==process$1&&process$1.version?new NodeInfo$1(process$1.version.slice(1)):null}function createVersionParts$1(e){for(var t=[],r=0;r<e;r++)t.push("0");return t}var cjs$3={};Object.defineProperty(cjs$3,"__esModule",{value:!0});var getWindowMetadata_1$1=cjs$3.getWindowMetadata=void 0;const window_getters_1$1=cjs$6;function getWindowMetadata$1(){let e,t;try{e=window_getters_1$1.getDocumentOrThrow(),t=window_getters_1$1.getLocationOrThrow()}catch(e2){return null}function r(...t){const r=e.getElementsByTagName("meta");for(let e=0;e<r.length;e++){const n=r[e],o=["itemprop","property","name"].map((e=>n.getAttribute(e))).filter((e=>!!e&&t.includes(e)));if(o.length&&o){const e=n.getAttribute("content");if(e)return e}}return""}const n=function(){let t=r("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}();return{description:r("description","og:description","twitter:description","keywords"),url:t.origin,icons:function(){const r=e.getElementsByTagName("link"),n=[];for(let e=0;e<r.length;e++){const o=r[e],i=o.getAttribute("rel");if(i&&i.toLowerCase().indexOf("icon")>-1){const e=o.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let r=t.protocol+"//"+t.host;if(0===e.indexOf("/"))r+=e;else{const n=t.pathname.split("/");n.pop();r+=n.join("/")+"/"+e}n.push(r)}else if(0===e.indexOf("//")){const r=t.protocol+e;n.push(r)}else n.push(e)}}return n}(),name:n}}getWindowMetadata_1$1=cjs$3.getWindowMetadata=getWindowMetadata$1;var elliptic={};const name="elliptic",version$2="6.5.7",description="EC cryptography",main="lib/elliptic.js",files=["lib"],scripts={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository={type:"git",url:"git@github.com:indutny/elliptic"},keywords=["EC","Elliptic","curve","Cryptography"],author="Fedor Indutny <fedor@indutny.com>",license="MIT",bugs={url:"https://github.com/indutny/elliptic/issues"},homepage="https://github.com/indutny/elliptic",devDependencies={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0$1={name:name,version:version$2,description:description,main:main,files:files,scripts:scripts,repository:repository,keywords:keywords,author:author,license:license,bugs:bugs,homepage:homepage,devDependencies:devDependencies,dependencies:dependencies};var utils$e={},bn$2={exports:{}};bn$2.exports,function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var i;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$2$1.Buffer}catch(e2){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function c(e,t,r,n){for(var o=0,i=Math.min(e.length,r),a=t;a<i;a++){var s=e.charCodeAt(a)-48;o*=n,o+=s>=49?s-49+10:s>=17?s-17+10:s}return o}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var o=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(o++,this.negative=1),o<e.length&&(16===t?this._parseHex(e,o,n):(this._parseBase(e,t,o),"le"===n&&this._initArray(this.toArray(),t,n)))},o.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var i,a,s=0;if("be"===n)for(o=e.length-1,i=0;o>=0;o-=3)a=e[o]|e[o-1]<<8|e[o-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===n)for(o=0,i=0;o<e.length;o+=3)a=e[o]|e[o+1]<<8|e[o+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this.strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,i=0,a=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)o=s(e,t,n)<<i,this.words[a]|=67108863&o,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)o=s(e,t,n)<<i,this.words[a]|=67108863&o,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,o=1;o<=67108863;o*=t)n++;n--,o=o/t|0;for(var i=e.length-r,a=i%n,s=Math.min(i,i-a)+r,u=0,l=r;l<s;l+=n)u=c(e,l,l+n,t),this.imuln(o),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var o=0|e.words[0],i=0|t.words[0],a=o*i,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u<n;u++){for(var l=c>>>26,d=67108863&c,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;l+=(a=(o=0|e.words[p])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var o=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<o|i)).toString(16);i=s>>>24-o&16777215,(o+=2)>=26&&(o-=26,a--),n=0!==i||a!==this.length-1?u[6-c.length]+c+n:c+n}for(0!==i&&(n=i.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var f=l[e],h=d[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modn(h).toString(e);n=(p=p.idivn(h)).isZero()?y+n:u[f-y.length]+y+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return r(void 0!==i),this.toArrayLike(i,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,n){var o=this.byteLength(),i=n||Math.max(1,o);r(o<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(i),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s<i;s++)u[s]=0}else{for(s=0;s<i-o;s++)u[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[i-s-1]=a}return u},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var o=0;o<t;o++)this.words[o]=67108863&~this.words[o];return n>0&&(this.words[o]=~this.words[o]&67108863>>26-n),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,o=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<o:this.words[n]&~(1<<o),this.strip()},o.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var o=0,i=0;i<n.length;i++)t=(0|r.words[i])+(0|n.words[i])+o,this.words[i]=67108863&t,o=t>>>26;for(;0!==o&&i<r.length;i++)t=(0|r.words[i])+o,this.words[i]=67108863&t,o=t>>>26;if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,o=this.cmp(e);if(0===o)return this.negative=0,this.length=1,this.words[0]=0,this;o>0?(r=this,n=e):(r=e,n=this);for(var i=0,a=0;a<n.length;a++)i=(t=(0|r.words[a])-(0|n.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<r.length;a++)i=(t=(0|r.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var n,o,i,a=e.words,s=t.words,c=r.words,u=0,l=0|a[0],d=8191&l,f=l>>>13,h=0|a[1],p=8191&h,y=h>>>13,m=0|a[2],g=8191&m,b=m>>>13,v=0|a[3],w=8191&v,_=v>>>13,I=0|a[4],T=8191&I,k=I>>>13,$=0|a[5],S=8191&$,A=$>>>13,E=0|a[6],C=8191&E,R=E>>>13,O=0|a[7],N=8191&O,P=O>>>13,M=0|a[8],B=8191&M,D=M>>>13,x=0|a[9],L=8191&x,U=x>>>13,j=0|s[0],F=8191&j,q=j>>>13,K=0|s[1],H=8191&K,G=K>>>13,z=0|s[2],V=8191&z,W=z>>>13,Q=0|s[3],Y=8191&Q,X=Q>>>13,J=0|s[4],Z=8191&J,ee=J>>>13,te=0|s[5],re=8191&te,ne=te>>>13,oe=0|s[6],ie=8191&oe,ae=oe>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,fe=le>>>13,he=0|s[9],pe=8191&he,ye=he>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(u+(n=Math.imul(d,F))|0)+((8191&(o=(o=Math.imul(d,q))+Math.imul(f,F)|0))<<13)|0;u=((i=Math.imul(f,q))+(o>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(p,F),o=(o=Math.imul(p,q))+Math.imul(y,F)|0,i=Math.imul(y,q);var ge=(u+(n=n+Math.imul(d,H)|0)|0)+((8191&(o=(o=o+Math.imul(d,G)|0)+Math.imul(f,H)|0))<<13)|0;u=((i=i+Math.imul(f,G)|0)+(o>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(g,F),o=(o=Math.imul(g,q))+Math.imul(b,F)|0,i=Math.imul(b,q),n=n+Math.imul(p,H)|0,o=(o=o+Math.imul(p,G)|0)+Math.imul(y,H)|0,i=i+Math.imul(y,G)|0;var be=(u+(n=n+Math.imul(d,V)|0)|0)+((8191&(o=(o=o+Math.imul(d,W)|0)+Math.imul(f,V)|0))<<13)|0;u=((i=i+Math.imul(f,W)|0)+(o>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(w,F),o=(o=Math.imul(w,q))+Math.imul(_,F)|0,i=Math.imul(_,q),n=n+Math.imul(g,H)|0,o=(o=o+Math.imul(g,G)|0)+Math.imul(b,H)|0,i=i+Math.imul(b,G)|0,n=n+Math.imul(p,V)|0,o=(o=o+Math.imul(p,W)|0)+Math.imul(y,V)|0,i=i+Math.imul(y,W)|0;var ve=(u+(n=n+Math.imul(d,Y)|0)|0)+((8191&(o=(o=o+Math.imul(d,X)|0)+Math.imul(f,Y)|0))<<13)|0;u=((i=i+Math.imul(f,X)|0)+(o>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(T,F),o=(o=Math.imul(T,q))+Math.imul(k,F)|0,i=Math.imul(k,q),n=n+Math.imul(w,H)|0,o=(o=o+Math.imul(w,G)|0)+Math.imul(_,H)|0,i=i+Math.imul(_,G)|0,n=n+Math.imul(g,V)|0,o=(o=o+Math.imul(g,W)|0)+Math.imul(b,V)|0,i=i+Math.imul(b,W)|0,n=n+Math.imul(p,Y)|0,o=(o=o+Math.imul(p,X)|0)+Math.imul(y,Y)|0,i=i+Math.imul(y,X)|0;var we=(u+(n=n+Math.imul(d,Z)|0)|0)+((8191&(o=(o=o+Math.imul(d,ee)|0)+Math.imul(f,Z)|0))<<13)|0;u=((i=i+Math.imul(f,ee)|0)+(o>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(S,F),o=(o=Math.imul(S,q))+Math.imul(A,F)|0,i=Math.imul(A,q),n=n+Math.imul(T,H)|0,o=(o=o+Math.imul(T,G)|0)+Math.imul(k,H)|0,i=i+Math.imul(k,G)|0,n=n+Math.imul(w,V)|0,o=(o=o+Math.imul(w,W)|0)+Math.imul(_,V)|0,i=i+Math.imul(_,W)|0,n=n+Math.imul(g,Y)|0,o=(o=o+Math.imul(g,X)|0)+Math.imul(b,Y)|0,i=i+Math.imul(b,X)|0,n=n+Math.imul(p,Z)|0,o=(o=o+Math.imul(p,ee)|0)+Math.imul(y,Z)|0,i=i+Math.imul(y,ee)|0;var _e=(u+(n=n+Math.imul(d,re)|0)|0)+((8191&(o=(o=o+Math.imul(d,ne)|0)+Math.imul(f,re)|0))<<13)|0;u=((i=i+Math.imul(f,ne)|0)+(o>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(C,F),o=(o=Math.imul(C,q))+Math.imul(R,F)|0,i=Math.imul(R,q),n=n+Math.imul(S,H)|0,o=(o=o+Math.imul(S,G)|0)+Math.imul(A,H)|0,i=i+Math.imul(A,G)|0,n=n+Math.imul(T,V)|0,o=(o=o+Math.imul(T,W)|0)+Math.imul(k,V)|0,i=i+Math.imul(k,W)|0,n=n+Math.imul(w,Y)|0,o=(o=o+Math.imul(w,X)|0)+Math.imul(_,Y)|0,i=i+Math.imul(_,X)|0,n=n+Math.imul(g,Z)|0,o=(o=o+Math.imul(g,ee)|0)+Math.imul(b,Z)|0,i=i+Math.imul(b,ee)|0,n=n+Math.imul(p,re)|0,o=(o=o+Math.imul(p,ne)|0)+Math.imul(y,re)|0,i=i+Math.imul(y,ne)|0;var Ie=(u+(n=n+Math.imul(d,ie)|0)|0)+((8191&(o=(o=o+Math.imul(d,ae)|0)+Math.imul(f,ie)|0))<<13)|0;u=((i=i+Math.imul(f,ae)|0)+(o>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(N,F),o=(o=Math.imul(N,q))+Math.imul(P,F)|0,i=Math.imul(P,q),n=n+Math.imul(C,H)|0,o=(o=o+Math.imul(C,G)|0)+Math.imul(R,H)|0,i=i+Math.imul(R,G)|0,n=n+Math.imul(S,V)|0,o=(o=o+Math.imul(S,W)|0)+Math.imul(A,V)|0,i=i+Math.imul(A,W)|0,n=n+Math.imul(T,Y)|0,o=(o=o+Math.imul(T,X)|0)+Math.imul(k,Y)|0,i=i+Math.imul(k,X)|0,n=n+Math.imul(w,Z)|0,o=(o=o+Math.imul(w,ee)|0)+Math.imul(_,Z)|0,i=i+Math.imul(_,ee)|0,n=n+Math.imul(g,re)|0,o=(o=o+Math.imul(g,ne)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,ne)|0,n=n+Math.imul(p,ie)|0,o=(o=o+Math.imul(p,ae)|0)+Math.imul(y,ie)|0,i=i+Math.imul(y,ae)|0;var Te=(u+(n=n+Math.imul(d,ce)|0)|0)+((8191&(o=(o=o+Math.imul(d,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((i=i+Math.imul(f,ue)|0)+(o>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(B,F),o=(o=Math.imul(B,q))+Math.imul(D,F)|0,i=Math.imul(D,q),n=n+Math.imul(N,H)|0,o=(o=o+Math.imul(N,G)|0)+Math.imul(P,H)|0,i=i+Math.imul(P,G)|0,n=n+Math.imul(C,V)|0,o=(o=o+Math.imul(C,W)|0)+Math.imul(R,V)|0,i=i+Math.imul(R,W)|0,n=n+Math.imul(S,Y)|0,o=(o=o+Math.imul(S,X)|0)+Math.imul(A,Y)|0,i=i+Math.imul(A,X)|0,n=n+Math.imul(T,Z)|0,o=(o=o+Math.imul(T,ee)|0)+Math.imul(k,Z)|0,i=i+Math.imul(k,ee)|0,n=n+Math.imul(w,re)|0,o=(o=o+Math.imul(w,ne)|0)+Math.imul(_,re)|0,i=i+Math.imul(_,ne)|0,n=n+Math.imul(g,ie)|0,o=(o=o+Math.imul(g,ae)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,ae)|0,n=n+Math.imul(p,ce)|0,o=(o=o+Math.imul(p,ue)|0)+Math.imul(y,ce)|0,i=i+Math.imul(y,ue)|0;var ke=(u+(n=n+Math.imul(d,de)|0)|0)+((8191&(o=(o=o+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;u=((i=i+Math.imul(f,fe)|0)+(o>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(L,F),o=(o=Math.imul(L,q))+Math.imul(U,F)|0,i=Math.imul(U,q),n=n+Math.imul(B,H)|0,o=(o=o+Math.imul(B,G)|0)+Math.imul(D,H)|0,i=i+Math.imul(D,G)|0,n=n+Math.imul(N,V)|0,o=(o=o+Math.imul(N,W)|0)+Math.imul(P,V)|0,i=i+Math.imul(P,W)|0,n=n+Math.imul(C,Y)|0,o=(o=o+Math.imul(C,X)|0)+Math.imul(R,Y)|0,i=i+Math.imul(R,X)|0,n=n+Math.imul(S,Z)|0,o=(o=o+Math.imul(S,ee)|0)+Math.imul(A,Z)|0,i=i+Math.imul(A,ee)|0,n=n+Math.imul(T,re)|0,o=(o=o+Math.imul(T,ne)|0)+Math.imul(k,re)|0,i=i+Math.imul(k,ne)|0,n=n+Math.imul(w,ie)|0,o=(o=o+Math.imul(w,ae)|0)+Math.imul(_,ie)|0,i=i+Math.imul(_,ae)|0,n=n+Math.imul(g,ce)|0,o=(o=o+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,n=n+Math.imul(p,de)|0,o=(o=o+Math.imul(p,fe)|0)+Math.imul(y,de)|0,i=i+Math.imul(y,fe)|0;var $e=(u+(n=n+Math.imul(d,pe)|0)|0)+((8191&(o=(o=o+Math.imul(d,ye)|0)+Math.imul(f,pe)|0))<<13)|0;u=((i=i+Math.imul(f,ye)|0)+(o>>>13)|0)+($e>>>26)|0,$e&=67108863,n=Math.imul(L,H),o=(o=Math.imul(L,G))+Math.imul(U,H)|0,i=Math.imul(U,G),n=n+Math.imul(B,V)|0,o=(o=o+Math.imul(B,W)|0)+Math.imul(D,V)|0,i=i+Math.imul(D,W)|0,n=n+Math.imul(N,Y)|0,o=(o=o+Math.imul(N,X)|0)+Math.imul(P,Y)|0,i=i+Math.imul(P,X)|0,n=n+Math.imul(C,Z)|0,o=(o=o+Math.imul(C,ee)|0)+Math.imul(R,Z)|0,i=i+Math.imul(R,ee)|0,n=n+Math.imul(S,re)|0,o=(o=o+Math.imul(S,ne)|0)+Math.imul(A,re)|0,i=i+Math.imul(A,ne)|0,n=n+Math.imul(T,ie)|0,o=(o=o+Math.imul(T,ae)|0)+Math.imul(k,ie)|0,i=i+Math.imul(k,ae)|0,n=n+Math.imul(w,ce)|0,o=(o=o+Math.imul(w,ue)|0)+Math.imul(_,ce)|0,i=i+Math.imul(_,ue)|0,n=n+Math.imul(g,de)|0,o=(o=o+Math.imul(g,fe)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,fe)|0;var Se=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(o=(o=o+Math.imul(p,ye)|0)+Math.imul(y,pe)|0))<<13)|0;u=((i=i+Math.imul(y,ye)|0)+(o>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(L,V),o=(o=Math.imul(L,W))+Math.imul(U,V)|0,i=Math.imul(U,W),n=n+Math.imul(B,Y)|0,o=(o=o+Math.imul(B,X)|0)+Math.imul(D,Y)|0,i=i+Math.imul(D,X)|0,n=n+Math.imul(N,Z)|0,o=(o=o+Math.imul(N,ee)|0)+Math.imul(P,Z)|0,i=i+Math.imul(P,ee)|0,n=n+Math.imul(C,re)|0,o=(o=o+Math.imul(C,ne)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,ne)|0,n=n+Math.imul(S,ie)|0,o=(o=o+Math.imul(S,ae)|0)+Math.imul(A,ie)|0,i=i+Math.imul(A,ae)|0,n=n+Math.imul(T,ce)|0,o=(o=o+Math.imul(T,ue)|0)+Math.imul(k,ce)|0,i=i+Math.imul(k,ue)|0,n=n+Math.imul(w,de)|0,o=(o=o+Math.imul(w,fe)|0)+Math.imul(_,de)|0,i=i+Math.imul(_,fe)|0;var Ae=(u+(n=n+Math.imul(g,pe)|0)|0)+((8191&(o=(o=o+Math.imul(g,ye)|0)+Math.imul(b,pe)|0))<<13)|0;u=((i=i+Math.imul(b,ye)|0)+(o>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(L,Y),o=(o=Math.imul(L,X))+Math.imul(U,Y)|0,i=Math.imul(U,X),n=n+Math.imul(B,Z)|0,o=(o=o+Math.imul(B,ee)|0)+Math.imul(D,Z)|0,i=i+Math.imul(D,ee)|0,n=n+Math.imul(N,re)|0,o=(o=o+Math.imul(N,ne)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,ne)|0,n=n+Math.imul(C,ie)|0,o=(o=o+Math.imul(C,ae)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,ae)|0,n=n+Math.imul(S,ce)|0,o=(o=o+Math.imul(S,ue)|0)+Math.imul(A,ce)|0,i=i+Math.imul(A,ue)|0,n=n+Math.imul(T,de)|0,o=(o=o+Math.imul(T,fe)|0)+Math.imul(k,de)|0,i=i+Math.imul(k,fe)|0;var Ee=(u+(n=n+Math.imul(w,pe)|0)|0)+((8191&(o=(o=o+Math.imul(w,ye)|0)+Math.imul(_,pe)|0))<<13)|0;u=((i=i+Math.imul(_,ye)|0)+(o>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(L,Z),o=(o=Math.imul(L,ee))+Math.imul(U,Z)|0,i=Math.imul(U,ee),n=n+Math.imul(B,re)|0,o=(o=o+Math.imul(B,ne)|0)+Math.imul(D,re)|0,i=i+Math.imul(D,ne)|0,n=n+Math.imul(N,ie)|0,o=(o=o+Math.imul(N,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,n=n+Math.imul(C,ce)|0,o=(o=o+Math.imul(C,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,n=n+Math.imul(S,de)|0,o=(o=o+Math.imul(S,fe)|0)+Math.imul(A,de)|0,i=i+Math.imul(A,fe)|0;var Ce=(u+(n=n+Math.imul(T,pe)|0)|0)+((8191&(o=(o=o+Math.imul(T,ye)|0)+Math.imul(k,pe)|0))<<13)|0;u=((i=i+Math.imul(k,ye)|0)+(o>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(L,re),o=(o=Math.imul(L,ne))+Math.imul(U,re)|0,i=Math.imul(U,ne),n=n+Math.imul(B,ie)|0,o=(o=o+Math.imul(B,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,n=n+Math.imul(N,ce)|0,o=(o=o+Math.imul(N,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,n=n+Math.imul(C,de)|0,o=(o=o+Math.imul(C,fe)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,fe)|0;var Re=(u+(n=n+Math.imul(S,pe)|0)|0)+((8191&(o=(o=o+Math.imul(S,ye)|0)+Math.imul(A,pe)|0))<<13)|0;u=((i=i+Math.imul(A,ye)|0)+(o>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(L,ie),o=(o=Math.imul(L,ae))+Math.imul(U,ie)|0,i=Math.imul(U,ae),n=n+Math.imul(B,ce)|0,o=(o=o+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,n=n+Math.imul(N,de)|0,o=(o=o+Math.imul(N,fe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,fe)|0;var Oe=(u+(n=n+Math.imul(C,pe)|0)|0)+((8191&(o=(o=o+Math.imul(C,ye)|0)+Math.imul(R,pe)|0))<<13)|0;u=((i=i+Math.imul(R,ye)|0)+(o>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(L,ce),o=(o=Math.imul(L,ue))+Math.imul(U,ce)|0,i=Math.imul(U,ue),n=n+Math.imul(B,de)|0,o=(o=o+Math.imul(B,fe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,fe)|0;var Ne=(u+(n=n+Math.imul(N,pe)|0)|0)+((8191&(o=(o=o+Math.imul(N,ye)|0)+Math.imul(P,pe)|0))<<13)|0;u=((i=i+Math.imul(P,ye)|0)+(o>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(L,de),o=(o=Math.imul(L,fe))+Math.imul(U,de)|0,i=Math.imul(U,fe);var Pe=(u+(n=n+Math.imul(B,pe)|0)|0)+((8191&(o=(o=o+Math.imul(B,ye)|0)+Math.imul(D,pe)|0))<<13)|0;u=((i=i+Math.imul(D,ye)|0)+(o>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Me=(u+(n=Math.imul(L,pe))|0)+((8191&(o=(o=Math.imul(L,ye))+Math.imul(U,pe)|0))<<13)|0;return u=((i=Math.imul(U,ye))+(o>>>13)|0)+(Me>>>26)|0,Me&=67108863,c[0]=me,c[1]=ge,c[2]=be,c[3]=ve,c[4]=we,c[5]=_e,c[6]=Ie,c[7]=Te,c[8]=ke,c[9]=$e,c[10]=Se,c[11]=Ae,c[12]=Ee,c[13]=Ce,c[14]=Re,c[15]=Oe,c[16]=Ne,c[17]=Pe,c[18]=Me,0!==u&&(c[19]=u,r.length++),r};function p(e,t,r){return(new y).mulp(e,t,r)}function y(e,t){this.x=e,this.y=t}Math.imul||(h=f),o.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):n<63?f(this,e,t):n<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,o=0,i=0;i<r.length-1;i++){var a=o;o=0;for(var s=67108863&n,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),f=67108863&d;s=67108863&(f=f+s|0),o+=(a=(a=a+(d/67108864|0)|0)+(f>>>26)|0)>>>26,a&=67108863}r.words[i]=s,n=a,a=o}return 0!==n?r.words[i]=n:r.length--,r.strip()}(this,e,t):p(this,e,t),r},y.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},y.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,o=0;o<t;o++)n|=(1&e)<<t-o-1,e>>=1;return n},y.prototype.permute=function(e,t,r,n,o,i){for(var a=0;a<i;a++)n[a]=t[e[a]],o[a]=r[e[a]]},y.prototype.transform=function(e,t,r,n,o,i){this.permute(i,e,t,r,n,o);for(var a=1;a<o;a<<=1)for(var s=a<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),l=0;l<o;l+=s)for(var d=c,f=u,h=0;h<a;h++){var p=r[l+h],y=n[l+h],m=r[l+h+a],g=n[l+h+a],b=d*m-f*g;g=d*g+f*m,m=b,r[l+h]=p+m,n[l+h]=y+g,r[l+h+a]=p-m,n[l+h+a]=y-g,h!==s&&(b=c*d-u*f,f=c*f+u*d,d=b)}},y.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),n=1&r,o=0;for(r=r/2|0;r;r>>>=1)o++;return 1<<o+1+n},y.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var o=e[n];e[n]=e[r-n-1],e[r-n-1]=o,o=t[n],t[n]=-t[r-n-1],t[r-n-1]=-o}},y.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var o=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=67108863&o,r=o<67108864?0:o/67108864|0}return e},y.prototype.convert13b=function(e,t,n,o){for(var i=0,a=0;a<t;a++)i+=0|e[a],n[2*a]=8191&i,i>>>=13,n[2*a+1]=8191&i,i>>>=13;for(a=2*t;a<o;++a)n[a]=0;r(0===i),r(!(-8192&i))},y.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},y.prototype.mulp=function(e,t,r){var n=2*this.guessLen13b(e.length,t.length),o=this.makeRBT(n),i=this.stub(n),a=new Array(n),s=new Array(n),c=new Array(n),u=new Array(n),l=new Array(n),d=new Array(n),f=r.words;f.length=n,this.convert13b(e.words,e.length,a,n),this.convert13b(t.words,t.length,u,n),this.transform(a,i,s,c,n,o),this.transform(u,i,l,d,n,o);for(var h=0;h<n;h++){var p=s[h]*l[h]-c[h]*d[h];c[h]=s[h]*d[h]+c[h]*l[h],s[h]=p}return this.conjugate(s,c,n),this.transform(s,c,f,i,n,o),this.conjugate(f,i,n),this.normalize13b(f,n),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),p(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,n=0;n<this.length;n++){var o=(0|this.words[n])*e,i=(67108863&o)+(67108863&t);t>>=26,t+=o/67108864|0,t+=i>>>26,this.words[n]=67108863&i}return 0!==t&&(this.words[n]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,o=r%26;t[r]=(e.words[n]&1<<o)>>>o}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var i=r.sqr();n<t.length;n++,i=i.sqr())0!==t[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,o=(e-n)/26,i=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<n;this.words[t]=c|a,a=s>>>26-n}a&&(this.words[t]=a,this.length++)}if(0!==o){for(t=this.length-1;t>=0;t--)this.words[t+o]=this.words[t];for(t=0;t<o;t++)this.words[t]=0;this.length+=o}return this.strip()},o.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,n){var o;r("number"==typeof e&&e>=0),o=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=n;if(o-=a,o=Math.max(0,o),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=o);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,o=1<<t;return!(this.length<=n)&&!!(this.words[n]&o)},o.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var o=67108863^67108863>>>t<<t;this.words[this.length-1]&=o}return this.strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,n){var o,i,a=e.length+n;this._expand(a);var s=0;for(o=0;o<e.length;o++){i=(0|this.words[o+n])+s;var c=(0|e.words[o])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[o+n]=67108863&i}for(;o<this.length-n;o++)s=(i=(0|this.words[o+n])+s)>>26,this.words[o+n]=67108863&i;if(0===s)return this.strip();for(r(-1===s),s=0,o=0;o<this.length;o++)s=(i=-(0|this.words[o])+s)>>26,this.words[o]=67108863&i;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,c=n.length-i.length;if("mod"!==t){(s=new o(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=n.clone()._ishlnsubmul(i,1,c);0===l.negative&&(n=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var f=67108864*(0|n.words[i.length+d])+(0|n.words[i.length+d-1]);for(f=Math.min(f/a|0,67108863),n._ishlnsubmul(i,f,d);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,d),n.isZero()||(n.negative^=1);s&&(s.words[d]=f)}return s&&s.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),o=e.andln(1),i=r.cmp(n);return i<0||1===o&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,o=this.length-1;o>=0;o--)n=(t*n+(0|this.words[o]))%e;return n},o.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*t;this.words[n]=o/e|0,t=o%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),a=new o(0),s=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;!(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var p=0,y=1;!(n.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(s),a.isub(c)):(n.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new o(1),s=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,f=1;!(n.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(n.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s)):(n.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var o=t.cmp(r);if(o<0){var i=t;t=r,r=i}else if(0===o||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,o=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=o,this;for(var i=o,a=n;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var o=0|this.words[0];t=o===e?0:o<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],o=0|e.words[r];if(n!==o){n<o?t=-1:n>o&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new I(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function T(e){I.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},n(b,g),b.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),o=0;o<n;o++)t.words[o]=e.words[o];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,o=10;o<e.length;o++){var a=0|e.words[o];e.words[o-10]=(a&r)<<4|i>>>22,i=a}i>>>=22,e.words[o-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(v,g),n(w,g),n(_,g),_.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,o=67108863&n;n>>>=26,e.words[r]=o,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(m[e])return m[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return m[e]=t,t},I.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},I.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},I.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},I.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},I.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},I.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},I.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},I.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},I.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},I.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},I.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},I.prototype.isqr=function(e){return this.imul(e,e.clone())},I.prototype.sqr=function(e){return this.mul(e,e)},I.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),f=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=a;0!==h.cmp(s);){for(var y=h,m=0;0!==y.cmp(s);m++)y=y.redSqr();r(m<p);var g=this.pow(d,new o(1).iushln(p-m-1));f=f.redMul(g),d=g.redSqr(),h=h.redMul(d),p=m}return f},I.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},I.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var i=r[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),n=t.length-1;n>=0;n--){for(var u=t.words[n],l=c-1;l>=0;l--){var d=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4===++s||0===n&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}c=26}return i},I.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},I.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new T(e)},n(T,I),T.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},T.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},T.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),i=o;return o.cmp(this.m)>=0?i=o.isub(this.m):o.cmpn(0)<0&&(i=o.iadd(this.m)),i._forceRed(this)},T.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},T.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,commonjsGlobal)}(bn$2);var bnExports=bn$2.exports;!function(e){var t=e,r=bnExports,n=minimalisticAssert$1,o=utils$O;t.assert=n,t.toArray=o.toArray,t.zero2=o.zero2,t.toHex=o.toHex,t.encode=o.encode,t.getNAF=function(e,t,r){var n,o=new Array(Math.max(e.bitLength(),r)+1);for(n=0;n<o.length;n+=1)o[n]=0;var i=1<<t+1,a=e.clone();for(n=0;n<o.length;n++){var s,c=a.andln(i-1);a.isOdd()?(s=c>(i>>1)-1?(i>>1)-c:c,a.isubn(s)):s=0,o[n]=s,a.iushrn(1)}return o},t.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,o=0,i=0;e.cmpn(-o)>0||t.cmpn(-i)>0;){var a,s,c=e.andln(3)+o&3,u=t.andln(3)+i&3;3===c&&(c=-1),3===u&&(u=-1),a=1&c?3!==(n=e.andln(7)+o&7)&&5!==n||2!==u?c:-c:0,r[0].push(a),s=1&u?3!==(n=t.andln(7)+i&7)&&5!==n||2!==c?u:-u:0,r[1].push(s),2*o===a+1&&(o=1-o),2*i===s+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r},t.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},t.parseBytes=function(e){return"string"==typeof e?t.toArray(e,"hex"):e},t.intFromLE=function(e){return new r(e,"hex","le")}}(utils$e);var curve={},BN$7=bnExports,utils$d=utils$e,getNAF=utils$d.getNAF,getJSF=utils$d.getJSF,assert$8=utils$d.assert;function BaseCurve(e,t){this.type=e,this.p=new BN$7(t.p,16),this.red=t.prime?BN$7.red(t.prime):BN$7.mont(this.p),this.zero=new BN$7(0).toRed(this.red),this.one=new BN$7(1).toRed(this.red),this.two=new BN$7(2).toRed(this.red),this.n=t.n&&new BN$7(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base=BaseCurve;function BasePoint(e,t){this.curve=e,this.type=t,this.precomputed=null}BaseCurve.prototype.point=function(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function(e,t){assert$8(e.precomputed);var r=e._getDoubles(),n=getNAF(t,1,this._bitLength),o=(1<<r.step+1)-(r.step%2==0?2:1);o/=3;var i,a,s=[];for(i=0;i<n.length;i+=r.step){a=0;for(var c=i+r.step-1;c>=i;c--)a=(a<<1)+n[c];s.push(a)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=o;d>0;d--){for(i=0;i<s.length;i++)(a=s[i])===d?l=l.mixedAdd(r.points[i]):a===-d&&(l=l.mixedAdd(r.points[i].neg()));u=u.add(l)}return u.toP()},BaseCurve.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var o=n.points,i=getNAF(t,r,this._bitLength),a=this.jpoint(null,null,null),s=i.length-1;s>=0;s--){for(var c=0;s>=0&&0===i[s];s--)c++;if(s>=0&&c++,a=a.dblp(c),s<0)break;var u=i[s];assert$8(0!==u),a="affine"===e.type?u>0?a.mixedAdd(o[u-1>>1]):a.mixedAdd(o[-u-1>>1].neg()):u>0?a.add(o[u-1>>1]):a.add(o[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},BaseCurve.prototype._wnafMulAdd=function(e,t,r,n,o){var i,a,s,c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,d=0;for(i=0;i<n;i++){var f=(s=t[i])._getNAFPoints(e);c[i]=f.wnd,u[i]=f.points}for(i=n-1;i>=1;i-=2){var h=i-1,p=i;if(1===c[h]&&1===c[p]){var y=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(y[1]=t[h].add(t[p]),y[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(y[1]=t[h].toJ().mixedAdd(t[p]),y[2]=t[h].add(t[p].neg())):(y[1]=t[h].toJ().mixedAdd(t[p]),y[2]=t[h].toJ().mixedAdd(t[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=getJSF(r[h],r[p]);for(d=Math.max(g[0].length,d),l[h]=new Array(d),l[p]=new Array(d),a=0;a<d;a++){var b=0|g[0][a],v=0|g[1][a];l[h][a]=m[3*(b+1)+(v+1)],l[p][a]=0,u[h]=y}}else l[h]=getNAF(r[h],c[h],this._bitLength),l[p]=getNAF(r[p],c[p],this._bitLength),d=Math.max(l[h].length,d),d=Math.max(l[p].length,d)}var w=this.jpoint(null,null,null),_=this._wnafT4;for(i=d;i>=0;i--){for(var I=0;i>=0;){var T=!0;for(a=0;a<n;a++)_[a]=0|l[a][i],0!==_[a]&&(T=!1);if(!T)break;I++,i--}if(i>=0&&I++,w=w.dblp(I),i<0)break;for(a=0;a<n;a++){var k=_[a];0!==k&&(k>0?s=u[a][k-1>>1]:k<0&&(s=u[a][-k-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(i=0;i<n;i++)u[i]=null;return o?w:w.toP()},BaseCurve.BasePoint=BasePoint,BasePoint.prototype.eq=function(){throw new Error("Not implemented")},BasePoint.prototype.validate=function(){return this.curve.validate(this)},BaseCurve.prototype.decodePoint=function(e,t){e=utils$d.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?assert$8(e[e.length-1]%2==0):7===e[0]&&assert$8(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},BasePoint.prototype.encodeCompressed=function(e){return this.encode(e,!0)},BasePoint.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},BasePoint.prototype.encode=function(e,t){return utils$d.encode(this._encode(t),e)},BasePoint.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},BasePoint.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},BasePoint.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,o=0;o<t;o+=e){for(var i=0;i<e;i++)n=n.dbl();r.push(n)}return{step:e,points:r}},BasePoint.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),o=1;o<r;o++)t[o]=t[o-1].add(n);return{wnd:e,points:t}},BasePoint.prototype._getBeta=function(){return null},BasePoint.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var utils$c=utils$e,BN$6=bnExports,inherits$2=inherits_browserExports,Base$2=base,assert$7=utils$c.assert;function ShortCurve(e){Base$2.call(this,"short",e),this.a=new BN$6(e.a,16).toRed(this.red),this.b=new BN$6(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}inherits$2(ShortCurve,Base$2);var short=ShortCurve;function Point$2(e,t,r,n){Base$2.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new BN$6(t,16),this.y=new BN$6(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function JPoint(e,t,r,n){Base$2.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$6(0)):(this.x=new BN$6(t,16),this.y=new BN$6(r,16),this.z=new BN$6(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}ShortCurve.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new BN$6(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new BN$6(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],assert$7(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new BN$6(e.a,16),b:new BN$6(e.b,16)}})):this._getEndoBasis(r)}}},ShortCurve.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:BN$6.mont(e),r=new BN$6(2).toRed(t).redInvm(),n=r.redNeg(),o=new BN$6(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},ShortCurve.prototype._getEndoBasis=function(e){for(var t,r,n,o,i,a,s,c,u,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,f=this.n.clone(),h=new BN$6(1),p=new BN$6(0),y=new BN$6(0),m=new BN$6(1),g=0;0!==d.cmpn(0);){var b=f.div(d);c=f.sub(b.mul(d)),u=y.sub(b.mul(h));var v=m.sub(b.mul(p));if(!n&&c.cmp(l)<0)t=s.neg(),r=h,n=c.neg(),o=u;else if(n&&2==++g)break;s=c,f=d,d=c,y=h,h=u,m=p,p=v}i=c.neg(),a=u;var w=n.sqr().add(o.sqr());return i.sqr().add(a.sqr()).cmp(w)>=0&&(i=t,a=r),n.negative&&(n=n.neg(),o=o.neg()),i.negative&&(i=i.neg(),a=a.neg()),[{a:n,b:o},{a:i,b:a}]},ShortCurve.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],o=n.b.mul(e).divRound(this.n),i=r.b.neg().mul(e).divRound(this.n),a=o.mul(r.a),s=i.mul(n.a),c=o.mul(r.b),u=i.mul(n.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},ShortCurve.prototype.pointFromX=function(e,t){(e=new BN$6(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(t&&!o||!t&&o)&&(n=n.redNeg()),this.point(e,n)},ShortCurve.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(o).cmpn(0)},ShortCurve.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,o=this._endoWnafT2,i=0;i<e.length;i++){var a=this._endoSplit(t[i]),s=e[i],c=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),c=c.neg(!0)),n[2*i]=s,n[2*i+1]=c,o[2*i]=a.k1,o[2*i+1]=a.k2}for(var u=this._wnafMulAdd(1,n,o,2*i,r),l=0;l<2*i;l++)n[l]=null,o[l]=null;return u},inherits$2(Point$2,Base$2.BasePoint),ShortCurve.prototype.point=function(e,t,r){return new Point$2(this,e,t,r)},ShortCurve.prototype.pointFromJSON=function(e,t){return Point$2.fromJSON(this,e,t)},Point$2.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Point$2.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Point$2.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function o(t){return e.point(t[0],t[1],r)}var i=t[2];return n.precomputed={beta:null,doubles:i.doubles&&{step:i.doubles.step,points:[n].concat(i.doubles.points.map(o))},naf:i.naf&&{wnd:i.naf.wnd,points:[n].concat(i.naf.points.map(o))}},n},Point$2.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Point$2.prototype.isInfinity=function(){return this.inf},Point$2.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Point$2.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),o=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),i=o.redSqr().redISub(this.x.redAdd(this.x)),a=o.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,a)},Point$2.prototype.getX=function(){return this.x.fromRed()},Point$2.prototype.getY=function(){return this.y.fromRed()},Point$2.prototype.mul=function(e){return e=new BN$6(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Point$2.prototype.mulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o):this.curve._wnafMulAdd(1,n,o,2)},Point$2.prototype.jmulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o,!0):this.curve._wnafMulAdd(1,n,o,2,!0)},Point$2.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},Point$2.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},Point$2.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},inherits$2(JPoint,Base$2.BasePoint),ShortCurve.prototype.jpoint=function(e,t,r){return new JPoint(this,e,t,r)},JPoint.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},JPoint.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),o=e.x.redMul(r),i=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(o),c=i.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),d=n.redMul(u),f=c.redSqr().redIAdd(l).redISub(d).redISub(d),h=c.redMul(d.redISub(f)).redISub(i.redMul(l)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(f,h,p)},JPoint.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),o=this.y,i=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=o.redSub(i);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),l=r.redMul(c),d=s.redSqr().redIAdd(u).redISub(l).redISub(l),f=s.redMul(l.redISub(d)).redISub(o.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(d,f,h)},JPoint.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var n=this.curve.a,o=this.curve.tinv,i=this.x,a=this.y,s=this.z,c=s.redSqr().redSqr(),u=a.redAdd(a);for(t=0;t<e;t++){var l=i.redSqr(),d=u.redSqr(),f=d.redSqr(),h=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(c)),p=i.redMul(d),y=h.redSqr().redISub(p.redAdd(p)),m=p.redISub(y),g=h.redMul(m);g=g.redIAdd(g).redISub(f);var b=u.redMul(s);t+1<e&&(c=c.redMul(f)),i=y,s=b,u=g}return this.curve.jpoint(i,u.redMul(o),s)},JPoint.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},JPoint.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),i=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(n).redISub(i);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n),c=s.redSqr().redISub(a).redISub(a),u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),e=c,t=s.redMul(a.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),d=this.y.redSqr(),f=d.redSqr(),h=this.x.redAdd(d).redSqr().redISub(l).redISub(f);h=h.redIAdd(h);var p=l.redAdd(l).redIAdd(l),y=p.redSqr(),m=f.redIAdd(f);m=(m=m.redIAdd(m)).redIAdd(m),e=y.redISub(h).redISub(h),t=p.redMul(h.redISub(e)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},JPoint.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),i=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(n).redISub(i);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),c=s.redSqr().redISub(a).redISub(a);e=c;var u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),t=s.redMul(a.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),d=this.y.redSqr(),f=this.x.redMul(d),h=this.x.redSub(l).redMul(this.x.redAdd(l));h=h.redAdd(h).redIAdd(h);var p=f.redIAdd(f),y=(p=p.redIAdd(p)).redAdd(p);e=h.redSqr().redISub(y),r=this.y.redAdd(this.z).redSqr().redISub(d).redISub(l);var m=d.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),t=h.redMul(p.redISub(e)).redISub(m)}return this.curve.jpoint(e,t,r)},JPoint.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,o=n.redSqr().redSqr(),i=t.redSqr(),a=r.redSqr(),s=i.redAdd(i).redIAdd(i).redIAdd(e.redMul(o)),c=t.redAdd(t),u=(c=c.redIAdd(c)).redMul(a),l=s.redSqr().redISub(u.redAdd(u)),d=u.redISub(l),f=a.redSqr();f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var h=s.redMul(d).redISub(f),p=r.redAdd(r).redMul(n);return this.curve.jpoint(l,h,p)},JPoint.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),o=e.redAdd(e).redIAdd(e),i=o.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).redISub(n),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(i)).redSqr(),c=n.redIAdd(n);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var u=o.redIAdd(a).redSqr().redISub(i).redISub(s).redISub(c),l=t.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var d=this.x.redMul(s).redISub(l);d=(d=d.redIAdd(d)).redIAdd(d);var f=this.y.redMul(u.redMul(c.redISub(u)).redISub(a.redMul(s)));f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var h=this.z.redAdd(a).redSqr().redISub(r).redISub(s);return this.curve.jpoint(d,f,h)},JPoint.prototype.mul=function(e,t){return e=new BN$6(e,t),this.curve._wnafMul(this,e)},JPoint.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),o=r.redMul(e.z);return 0===this.y.redMul(o).redISub(e.y.redMul(n)).cmpn(0)},JPoint.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),o=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(o),0===this.x.cmp(r))return!0}},JPoint.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},JPoint.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var BN$5=bnExports,inherits$1=inherits_browserExports,Base$1=base,utils$b=utils$e;function MontCurve(e){Base$1.call(this,"mont",e),this.a=new BN$5(e.a,16).toRed(this.red),this.b=new BN$5(e.b,16).toRed(this.red),this.i4=new BN$5(4).toRed(this.red).redInvm(),this.two=new BN$5(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits$1(MontCurve,Base$1);var mont=MontCurve;function Point$1(e,t,r){Base$1.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN$5(t,16),this.z=new BN$5(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}MontCurve.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},inherits$1(Point$1,Base$1.BasePoint),MontCurve.prototype.decodePoint=function(e,t){return this.point(utils$b.toArray(e,t),1)},MontCurve.prototype.point=function(e,t){return new Point$1(this,e,t)},MontCurve.prototype.pointFromJSON=function(e){return Point$1.fromJSON(this,e)},Point$1.prototype.precompute=function(){},Point$1.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Point$1.fromJSON=function(e,t){return new Point$1(e,t[0],t[1]||e.one)},Point$1.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Point$1.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Point$1.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),o=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,o)},Point$1.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Point$1.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),o=e.x.redAdd(e.z),i=e.x.redSub(e.z).redMul(r),a=o.redMul(n),s=t.z.redMul(i.redAdd(a).redSqr()),c=t.x.redMul(i.redISub(a).redSqr());return this.curve.point(s,c)},Point$1.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),o=[];0!==t.cmpn(0);t.iushrn(1))o.push(t.andln(1));for(var i=o.length-1;i>=0;i--)0===o[i]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},Point$1.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Point$1.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Point$1.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},Point$1.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Point$1.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var utils$a=utils$e,BN$4=bnExports,inherits=inherits_browserExports,Base=base,assert$6=utils$a.assert;function EdwardsCurve(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,Base.call(this,"edwards",e),this.a=new BN$4(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN$4(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN$4(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert$6(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}inherits(EdwardsCurve,Base);var edwards=EdwardsCurve;function Point(e,t,r,n,o){Base.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new BN$4(t,16),this.y=new BN$4(r,16),this.z=n?new BN$4(n,16):this.curve.one,this.t=o&&new BN$4(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}EdwardsCurve.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},EdwardsCurve.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},EdwardsCurve.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},EdwardsCurve.prototype.pointFromX=function(e,t){(e=new BN$4(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),i=n.redMul(o.redInvm()),a=i.redSqrt();if(0!==a.redSqr().redSub(i).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(t&&!s||!t&&s)&&(a=a.redNeg()),this.point(e,a)},EdwardsCurve.prototype.pointFromY=function(e,t){(e=new BN$4(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),i=n.redMul(o.redInvm());if(0===i.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=i.redSqrt();if(0!==a.redSqr().redSub(i).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},EdwardsCurve.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),o=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(o)},inherits(Point,Base.BasePoint),EdwardsCurve.prototype.pointFromJSON=function(e){return Point.fromJSON(this,e)},EdwardsCurve.prototype.point=function(e,t,r,n){return new Point(this,e,t,r,n)},Point.fromJSON=function(e,t){return new Point(e,t[0],t[1],t[2])},Point.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Point.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},Point.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),o=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),i=n.redAdd(t),a=i.redSub(r),s=n.redSub(t),c=o.redMul(a),u=i.redMul(s),l=o.redMul(s),d=a.redMul(i);return this.curve.point(c,u,d,l)},Point.prototype._projDbl=function(){var e,t,r,n,o,i,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(s)).redAdd(c);this.zOne?(e=a.redSub(s).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(n.redSub(c)),r=u.redSqr().redSub(u).redSub(u)):(o=this.z.redSqr(),i=u.redSub(o).redISub(o),e=a.redSub(s).redISub(c).redMul(i),t=u.redMul(n.redSub(c)),r=u.redMul(i))}else n=s.redAdd(c),o=this.curve._mulC(this.z).redSqr(),i=n.redSub(o).redSub(o),e=this.curve._mulC(a.redISub(n)).redMul(i),t=this.curve._mulC(n).redMul(s.redISub(c)),r=n.redMul(i);return this.curve.point(e,t,r)},Point.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Point.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),o=this.z.redMul(e.z.redAdd(e.z)),i=r.redSub(t),a=o.redSub(n),s=o.redAdd(n),c=r.redAdd(t),u=i.redMul(a),l=s.redMul(c),d=i.redMul(c),f=a.redMul(s);return this.curve.point(u,l,f,d)},Point.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),o=n.redSqr(),i=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(i).redMul(a),c=o.redSub(s),u=o.redAdd(s),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(a),d=n.redMul(c).redMul(l);return this.curve.twisted?(t=n.redMul(u).redMul(a.redSub(this.curve._mulA(i))),r=c.redMul(u)):(t=n.redMul(u).redMul(a.redSub(i)),r=this.curve._mulC(c).redMul(u)),this.curve.point(d,t,r)},Point.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Point.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Point.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},Point.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},Point.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Point.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Point.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Point.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},Point.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},Point.prototype.toP=Point.prototype.normalize,Point.prototype.mixedAdd=Point.prototype.add,function(e){var t=e;t.base=base,t.short=short,t.mont=mont,t.edwards=edwards}(curve);var curves$2={},secp256k1,hasRequiredSecp256k1;function requireSecp256k1(){return hasRequiredSecp256k1?secp256k1:(hasRequiredSecp256k1=1,secp256k1={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}})}!function(e){var t,r=e,n=hash$8,o=curve,i=utils$e.assert;function a(e){"short"===e.type?this.curve=new o.short(e):"edwards"===e.type?this.curve=new o.edwards(e):this.curve=new o.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var n=new a(t);return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=a,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:n.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:n.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:n.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:n.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:n.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:n.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:n.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{t=requireSecp256k1()}catch(e2){t=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:n.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",t]})}(curves$2);var BN$3=bnExports,utils$9=utils$e,assert$5=utils$9.assert;function KeyPair$3(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var key$1=KeyPair$3;KeyPair$3.fromPublic=function(e,t,r){return t instanceof KeyPair$3?t:new KeyPair$3(e,{pub:t,pubEnc:r})},KeyPair$3.fromPrivate=function(e,t,r){return t instanceof KeyPair$3?t:new KeyPair$3(e,{priv:t,privEnc:r})},KeyPair$3.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},KeyPair$3.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},KeyPair$3.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},KeyPair$3.prototype._importPrivate=function(e,t){this.priv=new BN$3(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},KeyPair$3.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?assert$5(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||assert$5(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},KeyPair$3.prototype.derive=function(e){return e.validate()||assert$5(e.validate(),"public point not validated"),e.mul(this.priv).getX()},KeyPair$3.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},KeyPair$3.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},KeyPair$3.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var BN$2=bnExports,utils$8=utils$e,assert$4=utils$8.assert;function Signature$3(e,t){if(e instanceof Signature$3)return e;this._importDER(e,t)||(assert$4(e.r&&e.s,"Signature without r or s"),this.r=new BN$2(e.r,16),this.s=new BN$2(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var signature$1=Signature$3;function Position(){this.place=0}function getLength(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;if(0===e[t.place])return!1;for(var o=0,i=0,a=t.place;i<n;i++,a++)o<<=8,o|=e[a],o>>>=0;return!(o<=127)&&(t.place=a,o)}function rmPadding(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function constructLength(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}Signature$3.prototype._importDER=function(e,t){e=utils$8.toArray(e,t);var r=new Position;if(48!==e[r.place++])return!1;var n=getLength(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var o=getLength(e,r);if(!1===o)return!1;if(128&e[r.place])return!1;var i=e.slice(r.place,o+r.place);if(r.place+=o,2!==e[r.place++])return!1;var a=getLength(e,r);if(!1===a)return!1;if(e.length!==a+r.place)return!1;if(128&e[r.place])return!1;var s=e.slice(r.place,a+r.place);if(0===i[0]){if(!(128&i[1]))return!1;i=i.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new BN$2(i),this.s=new BN$2(s),this.recoveryParam=null,!0},Signature$3.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=rmPadding(t),r=rmPadding(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];constructLength(n,t.length),(n=n.concat(t)).push(2),constructLength(n,r.length);var o=n.concat(r),i=[48];return constructLength(i,o.length),i=i.concat(o),utils$8.encode(i,e)};var BN$1=bnExports,HmacDRBG=hmacDrbg$1,utils$7=utils$e,curves$1=curves$2,rand=requireBrorand(),assert$3=utils$7.assert,KeyPair$2=key$1,Signature$2=signature$1;function EC(e){if(!(this instanceof EC))return new EC(e);"string"==typeof e&&(assert$3(Object.prototype.hasOwnProperty.call(curves$1,e),"Unknown curve "+e),e=curves$1[e]),e instanceof curves$1.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var ec=EC;EC.prototype.keyPair=function(e){return new KeyPair$2(this,e)},EC.prototype.keyFromPrivate=function(e,t){return KeyPair$2.fromPrivate(this,e,t)},EC.prototype.keyFromPublic=function(e,t){return KeyPair$2.fromPublic(this,e,t)},EC.prototype.genKeyPair=function(e){e||(e={});for(var t=new HmacDRBG({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||rand(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new BN$1(2));;){var o=new BN$1(t.generate(r));if(!(o.cmp(n)>0))return o.iaddn(1),this.keyFromPrivate(o)}},EC.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},EC.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new BN$1(e,16));for(var o=this.n.byteLength(),i=t.getPrivate().toArray("be",o),a=e.toArray("be",o),s=new HmacDRBG({hash:this.hash,entropy:i,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(new BN$1(1)),u=0;;u++){var l=n.k?n.k(u):new BN$1(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(c)>=0)){var d=this.g.mul(l);if(!d.isInfinity()){var f=d.getX(),h=f.umod(this.n);if(0!==h.cmpn(0)){var p=l.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var y=(d.getY().isOdd()?1:0)|(0!==f.cmp(h)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),y^=1),new Signature$2({r:h,s:p,recoveryParam:y})}}}}}},EC.prototype.verify=function(e,t,r,n){e=this._truncateToN(new BN$1(e,16)),r=this.keyFromPublic(r,n);var o=(t=new Signature$2(t,"hex")).r,i=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;var a,s=i.invm(this.n),c=s.mul(e).umod(this.n),u=s.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,r.getPublic(),u)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(c,r.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},EC.prototype.recoverPubKey=function(e,t,r,n){assert$3((3&r)===r,"The recovery param is more than two bits"),t=new Signature$2(t,n);var o=this.n,i=new BN$1(e),a=t.r,s=t.s,c=1&r,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var l=t.r.invm(o),d=o.sub(i).mul(l).umod(o),f=s.mul(l).umod(o);return this.g.mulAdd(d,a,f)},EC.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new Signature$2(t,n)).recoveryParam)return t.recoveryParam;for(var o=0;o<4;o++){var i;try{i=this.recoverPubKey(e,t,o)}catch(a){continue}if(i.eq(r))return o}throw new Error("Unable to find valid recovery factor")};var utils$6=utils$e,assert$2=utils$6.assert,parseBytes$2=utils$6.parseBytes,cachedProperty$1=utils$6.cachedProperty;function KeyPair$1(e,t){this.eddsa=e,this._secret=parseBytes$2(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=parseBytes$2(t.pub)}KeyPair$1.fromPublic=function(e,t){return t instanceof KeyPair$1?t:new KeyPair$1(e,{pub:t})},KeyPair$1.fromSecret=function(e,t){return t instanceof KeyPair$1?t:new KeyPair$1(e,{secret:t})},KeyPair$1.prototype.secret=function(){return this._secret},cachedProperty$1(KeyPair$1,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),cachedProperty$1(KeyPair$1,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),cachedProperty$1(KeyPair$1,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),cachedProperty$1(KeyPair$1,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),cachedProperty$1(KeyPair$1,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),cachedProperty$1(KeyPair$1,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),KeyPair$1.prototype.sign=function(e){return assert$2(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},KeyPair$1.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},KeyPair$1.prototype.getSecret=function(e){return assert$2(this._secret,"KeyPair is public only"),utils$6.encode(this.secret(),e)},KeyPair$1.prototype.getPublic=function(e){return utils$6.encode(this.pubBytes(),e)};var key=KeyPair$1,BN=bnExports,utils$5=utils$e,assert$1=utils$5.assert,cachedProperty=utils$5.cachedProperty,parseBytes$1=utils$5.parseBytes;function Signature$1(e,t){this.eddsa=e,"object"!=typeof t&&(t=parseBytes$1(t)),Array.isArray(t)&&(assert$1(t.length===2*e.encodingLength,"Signature has invalid size"),t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),assert$1(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof BN&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}cachedProperty(Signature$1,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),cachedProperty(Signature$1,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),cachedProperty(Signature$1,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),cachedProperty(Signature$1,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),Signature$1.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Signature$1.prototype.toHex=function(){return utils$5.encode(this.toBytes(),"hex").toUpperCase()};var signature=Signature$1,hash=hash$8,curves=curves$2,utils$4=utils$e,assert=utils$4.assert,parseBytes=utils$4.parseBytes,KeyPair=key,Signature=signature;function EDDSA(e){if(assert("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(e);e=curves[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=hash.sha512}var eddsa=EDDSA;EDDSA.prototype.sign=function(e,t){e=parseBytes(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),o=this.g.mul(n),i=this.encodePoint(o),a=this.hashInt(i,r.pubBytes(),e).mul(r.priv()),s=n.add(a).umod(this.curve.n);return this.makeSignature({R:o,S:s,Rencoded:i})},EDDSA.prototype.verify=function(e,t,r){if(e=parseBytes(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var n=this.keyFromPublic(r),o=this.hashInt(t.Rencoded(),n.pubBytes(),e),i=this.g.mul(t.S());return t.R().add(n.pub().mul(o)).eq(i)},EDDSA.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return utils$4.intFromLE(e.digest()).umod(this.curve.n)},EDDSA.prototype.keyFromPublic=function(e){return KeyPair.fromPublic(this,e)},EDDSA.prototype.keyFromSecret=function(e){return KeyPair.fromSecret(this,e)},EDDSA.prototype.makeSignature=function(e){return e instanceof Signature?e:new Signature(this,e)},EDDSA.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},EDDSA.prototype.decodePoint=function(e){var t=(e=utils$4.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),n=!!(128&e[t]),o=utils$4.intFromLE(r);return this.curve.pointFromY(o,n)},EDDSA.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},EDDSA.prototype.decodeInt=function(e){return utils$4.intFromLE(e)},EDDSA.prototype.isPoint=function(e){return e instanceof this.pointClass},function(e){var t=e;t.version=require$$0$1.version,t.utils=utils$e,t.rand=requireBrorand(),t.curve=curve,t.curves=curves$2,t.ec=ec,t.eddsa=eddsa}(elliptic);const H$3=":";function re$1(e){const[t,r]=e.split(H$3);return{namespace:t,reference:r}}function W$2(e,t){return e.includes(":")?[e]:t.chains||[]}var gt$2=Object.defineProperty,Ke=Object.getOwnPropertySymbols,vt$1=Object.prototype.hasOwnProperty,bt$1=Object.prototype.propertyIsEnumerable,Le$1=(e,t,r)=>t in e?gt$2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Fe=(e,t)=>{for(var r in t||(t={}))vt$1.call(t,r)&&Le$1(e,r,t[r]);if(Ke)for(var r of Ke(t))bt$1.call(t,r)&&Le$1(e,r,t[r]);return e};const qe="ReactNative",y$5={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},He="js";function ce(){return typeof process$1<"u"&&typeof process$1.versions<"u"&&typeof process$1.versions.node<"u"}function _$5(){return!getDocument_1$1()&&!!getNavigator_1$1()&&navigator.product===qe}function V$3(){return!ce()&&!!getNavigator_1$1()&&!!getDocument_1$1()}function P$4(){return _$5()?y$5.reactNative:ce()?y$5.node:V$3()?y$5.browser:y$5.unknown}function Ot$1(){var e;try{return _$5()&&typeof global$1<"u"&&typeof(null==global$1?void 0:global$1.Application)<"u"?null==(e=global$1.Application)?void 0:e.applicationId:void 0}catch{return}}function We$1(e,t){let r=queryString.parse(e);return r=Fe(Fe({},r),t),e=queryString.stringify(r)}function Nt$1(){return getWindowMetadata_1$1()||{name:"",description:"",url:"",icons:[""]}}function Je$1(){if(P$4()===y$5.reactNative&&typeof global$1<"u"&&typeof(null==global$1?void 0:global$1.Platform)<"u"){const{OS:e,Version:t}=global$1.Platform;return[e,t].join("-")}const e=detect$1();if(null===e)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return"browser"===e.type?[t,e.name,e.version].join("-"):[t,e.version].join("-")}function ze(){var e;const t=P$4();return t===y$5.browser?[t,(null==(e=getLocation_1$1())?void 0:e.host)||"unknown"].join(":"):t}function Ge(e,t,r){const n=Je$1(),o=ze();return[[e,t].join("-"),[He,r].join("-"),n,o].join("/")}function $t$1({protocol:e,version:t,relayUrl:r,sdkVersion:n,auth:o,projectId:i,useOnCloseEvent:a,bundleId:s}){const c=r.split("?"),u={auth:o,ua:Ge(e,t,n),projectId:i,useOnCloseEvent:a||void 0,origin:s||void 0},l=We$1(c[1]||"",u);return c[0]+"?"+l}function $$4(e,t){return e.filter((e=>t.includes(e))).length===e.length}function Tt$1(e){return Object.fromEntries(e.entries())}function Pt$1(e){return new Map(Object.entries(e))}function _t$1(e=cjs$7.FIVE_MINUTES,t){const r=cjs$7.toMiliseconds(e||cjs$7.FIVE_MINUTES);let n,o,i;return{resolve:e=>{i&&n&&(clearTimeout(i),n(e))},reject:e=>{i&&o&&(clearTimeout(i),o(e))},done:()=>new Promise(((e,a)=>{i=setTimeout((()=>{a(new Error(t))}),r),n=e,o=a}))}}function kt$1(e,t,r){return new Promise((async(n,o)=>{const i=setTimeout((()=>o(new Error(r))),t);try{n(await e)}catch(a){o(a)}clearTimeout(i)}))}function ae$1(e,t){if("string"==typeof t&&t.startsWith(`${e}:`))return t;if("topic"===e.toLowerCase()){if("string"!=typeof t)throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}if("id"===e.toLowerCase()){if("number"!=typeof t)throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${e}`)}function Dt$1(e){return ae$1("topic",e)}function xt$1(e){return ae$1("id",e)}function Vt$1(e){const[t,r]=e.split(":"),n={id:void 0,topic:void 0};if("topic"===t&&"string"==typeof r)n.topic=r;else{if("id"!==t||!Number.isInteger(Number(r)))throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${r}`);n.id=Number(r)}return n}function Mt$1(e,t){return cjs$7.fromMiliseconds(Date.now()+cjs$7.toMiliseconds(e))}function Kt$1(e){return Date.now()>=cjs$7.toMiliseconds(e)}function Lt$1(e,t){return`${e}${t?`:${t}`:""}`}function N$3(e=[],t=[]){return[...new Set([...e,...t])]}async function Ft$1({id:e,topic:t,wcDeepLink:r}){var n;try{if(!r)return;const o="string"==typeof r?JSON.parse(r):r,i=null==o?void 0:o.href;if("string"!=typeof i)return;const a=Xe$1(i,e,t),s=P$4();if(s===y$5.browser){if(null==(n=getDocument_1$1())||!n.hasFocus())return void console.warn("Document does not have focus, skipping deeplink.");a.startsWith("https://")||a.startsWith("http://")?window.open(a,"_blank","noreferrer noopener"):window.open(a,en$2()?"_blank":"_self","noreferrer noopener")}else s===y$5.reactNative&&typeof(null==global$1?void 0:global$1.Linking)<"u"&&await global$1.Linking.openURL(a)}catch(o){console.error(o)}}function Xe$1(e,t,r){const n=`requestId=${t}&sessionTopic=${r}`;e.endsWith("/")&&(e=e.slice(0,-1));let o=`${e}`;if(e.startsWith("https://t.me")){o=`${o}${e.includes("?")?"&startapp=":"?startapp="}${nn$1(n,!0)}`}else o=`${o}/wc?${n}`;return o}async function qt$1(e,t){let r="";try{if(V$3()&&(r=localStorage.getItem(t),r))return r;r=await e.getItem(t)}catch(n){console.error(n)}return r}function Bt$1(e,t){if(!e.includes(t))return null;const r=e.split(/([&,?,=])/),n=r.indexOf(t);return r[n+2]}function Ht$1(){return typeof crypto<"u"&&null!=crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function Wt$1(){return typeof process$1<"u"&&"true"===process$1.env.IS_VITEST}function en$2(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function nn$1(e,t=!1){const r=Buffer$2.from(e).toString("base64");return t?r.replace(/[=]/g,""):r}function le(e){return Buffer$2.from(e,"base64").toString("utf-8")}const Jt$1="https://rpc.walletconnect.org/v1";async function tn$1(e,t,r,n,o,i){switch(r.t){case"eip191":return rn$1(e,t,r.s);case"eip1271":return await on$1(e,t,r.s,n,o,i);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function rn$1(e,t,r){return recoverAddress(hashMessage(t),r).toLowerCase()===e.toLowerCase()}async function on$1(e,t,r,n,o,i){const a=re$1(n);if(!a.namespace||!a.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",s="0000000000000000000000000000000000000000000000000000000000000040",c="0000000000000000000000000000000000000000000000000000000000000041",u=r.substring(2),l=a+hashMessage(t).substring(2)+s+c+u,d=await fetch(`${i||Jt$1}/?chainId=${n}&projectId=${o}`,{method:"POST",body:JSON.stringify({id:zt$1(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:l},"latest"]})}),{result:f}=await d.json();return!!f&&f.slice(0,a.length).toLowerCase()===a.toLowerCase()}catch(s){return console.error("isValidEip1271Signature: ",s),!1}}function zt$1(){return Date.now()+Math.floor(1e3*Math.random())}var Gt$1=Object.defineProperty,Yt$1=Object.defineProperties,Qt$1=Object.getOwnPropertyDescriptors,sn$1=Object.getOwnPropertySymbols,Zt$1=Object.prototype.hasOwnProperty,Xt$1=Object.prototype.propertyIsEnumerable,cn$1=(e,t,r)=>t in e?Gt$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,de$1=(e,t)=>{for(var r in t||(t={}))Zt$1.call(t,r)&&cn$1(e,r,t[r]);if(sn$1)for(var r of sn$1(t))Xt$1.call(t,r)&&cn$1(e,r,t[r]);return e},an$1=(e,t)=>Yt$1(e,Qt$1(t));const er$1="did:pkh:",z$6=e=>null==e?void 0:e.split(":"),un$1=e=>{const t=e&&z$6(e);if(t)return e.includes(er$1)?t[3]:t[1]},ln$1=e=>{const t=e&&z$6(e);if(t)return t[2]+":"+t[3]},fe$1=e=>{const t=e&&z$6(e);if(t)return t.pop()};async function nr$1(e){const{cacao:t,projectId:r}=e,{s:n,p:o}=t,i=dn$1(o,o.iss),a=fe$1(o.iss);return await tn$1(a,i,n,ln$1(o.iss),r)}const dn$1=(e,t)=>{const r=`${e.domain} wants you to sign in with your Ethereum account:`,n=fe$1(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let o=e.statement||void 0;const i=`URI: ${e.aud||e.uri}`,a=`Version: ${e.version}`,s=`Chain ID: ${un$1(t)}`,c=`Nonce: ${e.nonce}`,u=`Issued At: ${e.iat}`,l=e.exp?`Expiration Time: ${e.exp}`:void 0,d=e.nbf?`Not Before: ${e.nbf}`:void 0,f=e.requestId?`Request ID: ${e.requestId}`:void 0,h=e.resources?`Resources:${e.resources.map((e=>`\n- ${e}`)).join("")}`:void 0,p=Y$1(e.resources);if(p){o=he(o,R$3(p))}return[r,n,"",o,"",i,a,s,c,u,l,d,f,h].filter((e=>null!=e)).join("\n")};function hn$1(e){return Buffer$2.from(JSON.stringify(e)).toString("base64")}function yn$1(e){return JSON.parse(Buffer$2.from(e,"base64").toString("utf-8"))}function O$3(e){if(!e)throw new Error("No recap provided, value is undefined");if(!e.att)throw new Error("No `att` property found");const t=Object.keys(e.att);if(null==t||!t.length)throw new Error("No resources found in `att` property");t.forEach((t=>{const r=e.att[t];if(Array.isArray(r))throw new Error(`Resource must be an object: ${t}`);if("object"!=typeof r)throw new Error(`Resource must be an object: ${t}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${t}`);Object.keys(r).forEach((e=>{const t=r[e];if(!Array.isArray(t))throw new Error(`Ability limits ${e} must be an array of objects, found: ${t}`);if(!t.length)throw new Error(`Value of ${e} is empty array, must be an array with objects`);t.forEach((t=>{if("object"!=typeof t)throw new Error(`Ability limits (${e}) must be an array of objects, found: ${t}`)}))}))}))}function gn$1(e,t,r,n={}){return null==r||r.sort(((e,t)=>e.localeCompare(t))),{att:{[e]:pe(t,r,n)}}}function pe(e,t,r={}){const n=(t=null==t?void 0:t.sort(((e,t)=>e.localeCompare(t)))).map((t=>({[`${e}/${t}`]:[r]})));return Object.assign({},...n)}function G$1(e){return O$3(e),`urn:recap:${hn$1(e).replace(/=/g,"")}`}function R$3(e){const t=yn$1(e.replace("urn:recap:",""));return O$3(t),t}function ir$1(e,t,r){return G$1(gn$1(e,t,r))}function me$2(e){return e&&e.includes("urn:recap:")}function cr$1(e,t){return G$1(bn$1(R$3(e),R$3(t)))}function bn$1(e,t){O$3(e),O$3(t);const r=Object.keys(e.att).concat(Object.keys(t.att)).sort(((e,t)=>e.localeCompare(t))),n={att:{}};return r.forEach((r=>{var o,i;Object.keys((null==(o=e.att)?void 0:o[r])||{}).concat(Object.keys((null==(i=t.att)?void 0:i[r])||{})).sort(((e,t)=>e.localeCompare(t))).forEach((o=>{var i,a;n.att[r]=an$1(de$1({},n.att[r]),{[o]:(null==(i=e.att[r])?void 0:i[o])||(null==(a=t.att[r])?void 0:a[o])})}))})),n}function he(e="",t){O$3(t);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(r))return e;const n=[];let o=0;Object.keys(t.att).forEach((e=>{const r=Object.keys(t.att[e]).map((e=>({ability:e.split("/")[0],action:e.split("/")[1]})));r.sort(((e,t)=>e.action.localeCompare(t.action)));const i={};r.forEach((e=>{i[e.ability]||(i[e.ability]=[]),i[e.ability].push(e.action)}));const a=Object.keys(i).map((t=>(o++,`(${o}) '${t}': '${i[t].join("', '")}' for '${e}'.`)));n.push(a.join(", ").replace(".,","."))}));return`${e?e+" ":""}${`${r}${n.join(" ")}`}`}function ar$1(e){var t;const r=R$3(e);O$3(r);const n=null==(t=r.att)?void 0:t.eip155;return n?Object.keys(n).map((e=>e.split("/")[1])):[]}function ur$1(e){const t=R$3(e);O$3(t);const r=[];return Object.values(t.att).forEach((e=>{Object.values(e).forEach((e=>{var t;null!=(t=null==e?void 0:e[0])&&t.chains&&r.push(e[0].chains)}))})),[...new Set(r.flat())]}function Y$1(e){if(!e)return;const t=null==e?void 0:e[e.length-1];return me$2(t)?t:void 0}const ye$2="base10",g$4="base16",ge="base64pad",lr$1="base64url",k$4="utf8",ve$1=0,D$5=1,M$4=2,dr$1=0,wn=1,K$2=12,be$2=32;function fr$2(){const e=x25519.generateKeyPair();return{privateKey:toString$1(e.secretKey,g$4),publicKey:toString$1(e.publicKey,g$4)}}function pr$1(){return toString$1(random.randomBytes(be$2),g$4)}function mr$1(e,t){const r=x25519.sharedKey(fromString$1(e,g$4),fromString$1(t,g$4),!0);return toString$1(new HKDF_1(sha256.SHA256,r).expand(be$2),g$4)}function hr$1(e){return toString$1(sha256.hash(fromString$1(e,g$4)),g$4)}function yr$1(e){return toString$1(sha256.hash(fromString$1(e,k$4)),g$4)}function Ee$1(e){return fromString$1(`${e}`,ye$2)}function A$4(e){return Number(toString$1(e,ye$2))}function gr$1(e){const t=Ee$1(typeof e.type<"u"?e.type:ve$1);if(A$4(t)===D$5&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof e.senderPublicKey<"u"?fromString$1(e.senderPublicKey,g$4):void 0,n=typeof e.iv<"u"?fromString$1(e.iv,g$4):random.randomBytes(K$2);return we$2({type:t,sealed:new chacha20poly1305.ChaCha20Poly1305(fromString$1(e.symKey,g$4)).seal(n,fromString$1(e.message,k$4)),iv:n,senderPublicKey:r,encoding:e.encoding})}function vr$1(e,t){const r=Ee$1(M$4),n=random.randomBytes(K$2);return we$2({type:r,sealed:fromString$1(e,k$4),iv:n,encoding:t})}function br$1(e){const t=new chacha20poly1305.ChaCha20Poly1305(fromString$1(e.symKey,g$4)),{sealed:r,iv:n}=Q$1({encoded:e.encoded,encoding:null==e?void 0:e.encoding}),o=t.open(n,r);if(null===o)throw new Error("Failed to decrypt");return toString$1(o,k$4)}function Er$1(e,t){const{sealed:r}=Q$1({encoded:e,encoding:t});return toString$1(r,k$4)}function we$2(e){const{encoding:t=ge}=e;if(A$4(e.type)===M$4)return toString$1(concat([e.type,e.sealed]),t);if(A$4(e.type)===D$5){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return toString$1(concat([e.type,e.senderPublicKey,e.iv,e.sealed]),t)}return toString$1(concat([e.type,e.iv,e.sealed]),t)}function Q$1(e){const{encoded:t,encoding:r=ge}=e,n=fromString$1(t,r),o=n.slice(dr$1,wn),i=wn;if(A$4(o)===D$5){const e=i+be$2,t=e+K$2,r=n.slice(i,e),a=n.slice(e,t);return{type:o,sealed:n.slice(t),iv:a,senderPublicKey:r}}if(A$4(o)===M$4){return{type:o,sealed:n.slice(i),iv:random.randomBytes(K$2)}}const a=i+K$2,s=n.slice(i,a);return{type:o,sealed:n.slice(a),iv:s}}function wr$1(e,t){const r=Q$1({encoded:e,encoding:null==t?void 0:t.encoding});return On({type:A$4(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?toString$1(r.senderPublicKey,g$4):void 0,receiverPublicKey:null==t?void 0:t.receiverPublicKey})}function On(e){const t=(null==e?void 0:e.type)||ve$1;if(t===D$5){if(typeof(null==e?void 0:e.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(null==e?void 0:e.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:null==e?void 0:e.senderPublicKey,receiverPublicKey:null==e?void 0:e.receiverPublicKey}}function Or$1(e){return e.type===D$5&&"string"==typeof e.senderPublicKey&&"string"==typeof e.receiverPublicKey}function Nr$1(e){return e.type===M$4}function Nn(e){return new elliptic.ec("p256").keyFromPublic({x:Buffer$2.from(e.x,"base64").toString("hex"),y:Buffer$2.from(e.y,"base64").toString("hex")},"hex")}function Sr$1(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");const r=t.length%4;return r>0&&(t+="=".repeat(4-r)),t}function $r$1(e){return Buffer$2.from(Sr$1(e),"base64")}function Rr$1(e,t){const[r,n,o]=e.split("."),i=$r$1(o);if(64!==i.length)throw new Error("Invalid signature length");const a=i.slice(0,32).toString("hex"),s=i.slice(32,64).toString("hex"),c=`${r}.${n}`,u=(new sha256.SHA256).update(Buffer$2.from(c)).digest(),l=Nn(t),d=Buffer$2.from(u).toString("hex");if(!l.verify(d,{r:a,s:s}))throw new Error("Invalid signature");return decodeJWT(e).payload}const Sn="irn";function Ir$1(e){return(null==e?void 0:e.relay)||{protocol:Sn}}function jr$1(e){const t=C$6[e];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${e}`);return t}var Tr$1=Object.defineProperty,Pr$1=Object.defineProperties,Ar$1=Object.getOwnPropertyDescriptors,$n=Object.getOwnPropertySymbols,Cr$1=Object.prototype.hasOwnProperty,Ur$1=Object.prototype.propertyIsEnumerable,Rn=(e,t,r)=>t in e?Tr$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,In=(e,t)=>{for(var r in t||(t={}))Cr$1.call(t,r)&&Rn(e,r,t[r]);if($n)for(var r of $n(t))Ur$1.call(t,r)&&Rn(e,r,t[r]);return e},_r$1=(e,t)=>Pr$1(e,Ar$1(t));function jn(e,t="-"){const r={},n="relay"+t;return Object.keys(e).forEach((t=>{if(t.startsWith(n)){const o=t.replace(n,""),i=e[t];r[o]=i}})),r}function kr$1(e){if(!e.includes("wc:")){const t=le(e);null!=t&&t.includes("wc:")&&(e=t)}const t=(e=(e=e.includes("wc://")?e.replace("wc://",""):e).includes("wc:")?e.replace("wc:",""):e).indexOf(":"),r=-1!==e.indexOf("?")?e.indexOf("?"):void 0,n=e.substring(0,t),o=e.substring(t+1,r).split("@"),i=typeof r<"u"?e.substring(r):"",a=queryString.parse(i),s="string"==typeof a.methods?a.methods.split(","):void 0;return{protocol:n,topic:Tn(o[0]),version:parseInt(o[1],10),symKey:a.symKey,relay:jn(a),methods:s,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function Tn(e){return e.startsWith("//")?e.substring(2):e}function Pn(e,t="-"){const r={};return Object.keys(e).forEach((n=>{const o="relay"+t+n;e[n]&&(r[o]=e[n])})),r}function Dr$1(e){return`${e.protocol}:${e.topic}@${e.version}?`+queryString.stringify(In(_r$1(In({symKey:e.symKey},Pn(e.relay)),{expiryTimestamp:e.expiryTimestamp}),e.methods?{methods:e.methods.join(",")}:{}))}function xr$1(e,t,r){return`${e}?wc_ev=${r}&topic=${t}`}function C$4(e){const t=[];return e.forEach((e=>{const[r,n]=e.split(":");t.push(`${r}:${n}`)})),t}function Un(e){const t=[];return Object.values(e).forEach((e=>{t.push(...C$4(e.accounts))})),t}function _n(e,t){const r=[];return Object.values(e).forEach((e=>{C$4(e.accounts).includes(t)&&r.push(...e.methods)})),r}function kn(e,t){const r=[];return Object.values(e).forEach((e=>{C$4(e.accounts).includes(t)&&r.push(...e.events)})),r}function xn(e){const t={};return null==e||e.forEach((e=>{const[r,n]=e.split(":");t[r]||(t[r]={accounts:[],chains:[],events:[]}),t[r].accounts.push(e),t[r].chains.push(`${r}:${n}`)})),t}function Jr$1(e,t){const r=xn(t=t.map((e=>e.replace("did:pkh:",""))));for(const[n,o]of Object.entries(r))o.methods?o.methods=N$3(o.methods,e):o.methods=e,o.events=["chainChanged","accountsChanged"];return r}const Vn={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}},Mn={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 S$6(e,t){const{message:r,code:n}=Mn[e];return{message:t?`${r} ${t}`:r,code:n}}function U$2(e,t){const{message:r,code:n}=Vn[e];return{message:t?`${r} ${t}`:r,code:n}}function L$4(e,t){return!!Array.isArray(e)}function Z$3(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function I$5(e){return typeof e>"u"}function b$4(e,t){return!(!t||!I$5(e))||"string"==typeof e&&!!e.trim().length}function X$2(e,t){return!(!t||!I$5(e))||"number"==typeof e&&!isNaN(e)}function zr$1(e,t){const{requiredNamespaces:r}=t,n=Object.keys(e.namespaces),o=Object.keys(r);let i=!0;return!!$$4(o,n)&&(n.forEach((t=>{const{accounts:n,methods:o,events:a}=e.namespaces[t],s=C$4(n),c=r[t];$$4(W$2(t,c),s)&&$$4(c.methods,o)&&$$4(c.events,a)||(i=!1)})),i)}function F$3(e){return!(!b$4(e,!1)||!e.includes(":"))&&2===e.split(":").length}function Kn(e){if(b$4(e,!1)&&e.includes(":")){const t=e.split(":");if(3===t.length){const e=t[0]+":"+t[1];return!!t[2]&&F$3(e)}}return!1}function Gr$1(e){function t(e){try{return typeof new URL(e)<"u"}catch{return!1}}try{if(b$4(e,!1)){if(t(e))return!0;return t(le(e))}}catch{}return!1}function Yr$1(e){var t;return null==(t=null==e?void 0:e.proposer)?void 0:t.publicKey}function Qr$1(e){return null==e?void 0:e.topic}function Zr$1(e,t){let r=null;return b$4(null==e?void 0:e.publicKey,!1)||(r=S$6("MISSING_OR_INVALID",`${t} controller public key should be a string`)),r}function Se(e){let t=!0;return L$4(e)?e.length&&(t=e.every((e=>b$4(e,!1)))):t=!1,t}function Ln(e,t,r){let n=null;return L$4(t)&&t.length?t.forEach((e=>{n||F$3(e)||(n=U$2("UNSUPPORTED_CHAINS",`${r}, chain ${e} should be a string and conform to "namespace:chainId" format`))})):F$3(e)||(n=U$2("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function Fn(e,t,r){let n=null;return Object.entries(e).forEach((([e,o])=>{if(n)return;const i=Ln(e,W$2(e,o),`${t} ${r}`);i&&(n=i)})),n}function qn(e,t){let r=null;return L$4(e)?e.forEach((e=>{r||Kn(e)||(r=U$2("UNSUPPORTED_ACCOUNTS",`${t}, account ${e} should be a string and conform to "namespace:chainId:address" format`))})):r=U$2("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function Bn(e,t){let r=null;return Object.values(e).forEach((e=>{if(r)return;const n=qn(null==e?void 0:e.accounts,`${t} namespace`);n&&(r=n)})),r}function Hn(e,t){let r=null;return Se(null==e?void 0:e.methods)?Se(null==e?void 0:e.events)||(r=U$2("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):r=U$2("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),r}function $e(e,t){let r=null;return Object.values(e).forEach((e=>{if(r)return;const n=Hn(e,`${t}, namespace`);n&&(r=n)})),r}function Xr$1(e,t,r){let n=null;if(e&&Z$3(e)){const o=$e(e,t);o&&(n=o);const i=Fn(e,t,r);i&&(n=i)}else n=S$6("MISSING_OR_INVALID",`${t}, ${r} should be an object with data`);return n}function Wn(e,t){let r=null;if(e&&Z$3(e)){const n=$e(e,t);n&&(r=n);const o=Bn(e,t);o&&(r=o)}else r=S$6("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return r}function Jn(e){return b$4(e.protocol,!0)}function eo(e,t){let r=!1;return e?e&&L$4(e)&&e.length&&e.forEach((e=>{r=Jn(e)})):r=!0,r}function no(e){return"number"==typeof e}function to(e){return typeof e<"u"&&null!==typeof e}function ro(e){return!!(e&&"object"==typeof e&&e.code&&X$2(e.code,!1)&&e.message&&b$4(e.message,!1))}function oo(e){return!(I$5(e)||!b$4(e.method,!1))}function so(e){return!(I$5(e)||I$5(e.result)&&I$5(e.error)||!X$2(e.id,!1)||!b$4(e.jsonrpc,!1))}function io(e){return!(I$5(e)||!b$4(e.name,!1))}function co(e,t){return!(!F$3(t)||!Un(e).includes(t))}function ao(e,t,r){return!!b$4(r,!1)&&_n(e,t).includes(r)}function uo(e,t,r){return!!b$4(r,!1)&&kn(e,t).includes(r)}function zn(e,t,r){let n=null;const o=lo(e),i=fo(t),a=Object.keys(o),s=Object.keys(i),c=Gn(Object.keys(e)),u=Gn(Object.keys(t)),l=c.filter((e=>!u.includes(e)));return l.length&&(n=S$6("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.\n Required: ${l.toString()}\n Received: ${Object.keys(t).toString()}`)),$$4(a,s)||(n=S$6("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces.\n Required: ${a.toString()}\n Approved: ${s.toString()}`)),Object.keys(t).forEach((e=>{if(!e.includes(":")||n)return;const o=C$4(t[e].accounts);o.includes(e)||(n=S$6("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${e}\n Required: ${e}\n Approved: ${o.toString()}`))})),a.forEach((e=>{n||($$4(o[e].methods,i[e].methods)?$$4(o[e].events,i[e].events)||(n=S$6("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${e}`)):n=S$6("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${e}`))})),n}function lo(e){const t={};return Object.keys(e).forEach((r=>{var n;r.includes(":")?t[r]=e[r]:null==(n=e[r].chains)||n.forEach((n=>{t[n]={methods:e[r].methods,events:e[r].events}}))})),t}function Gn(e){return[...new Set(e.map((e=>e.includes(":")?e.split(":")[0]:e)))]}function fo(e){const t={};return Object.keys(e).forEach((r=>{if(r.includes(":"))t[r]=e[r];else{const n=C$4(e[r].accounts);null==n||n.forEach((n=>{t[n]={accounts:e[r].accounts.filter((e=>e.includes(`${n}:`))),methods:e[r].methods,events:e[r].events}}))}})),t}function po(e,t){return X$2(e,!1)&&e<=t.max&&e>=t.min}function mo(){const e=P$4();return new Promise((t=>{switch(e){case y$5.browser:t(Yn());break;case y$5.reactNative:t(Qn());break;case y$5.node:t(Zn());break;default:t(!0)}}))}function Yn(){return V$3()&&(null==navigator?void 0:navigator.onLine)}async function Qn(){if(_$5()&&typeof global$1<"u"&&null!=global$1&&global$1.NetInfo){const e=await(null==global$1?void 0:global$1.NetInfo.fetch());return null==e?void 0:e.isConnected}return!0}function Zn(){return!0}function ho(e){switch(P$4()){case y$5.browser:Xn(e);break;case y$5.reactNative:et$1(e)}}function Xn(e){!_$5()&&V$3()&&(window.addEventListener("online",(()=>e(!0))),window.addEventListener("offline",(()=>e(!1))))}function et$1(e){_$5()&&typeof global$1<"u"&&null!=global$1&&global$1.NetInfo&&(null==global$1||global$1.NetInfo.addEventListener((t=>e(null==t?void 0:t.isConnected))))}const Re={};class yo{static get(e){return Re[e]}static set(e,t){Re[e]=t}static delete(e){delete Re[e]}}const w$5=()=>typeof WebSocket<"u"?WebSocket:typeof global$1<"u"&&typeof global$1.WebSocket<"u"?global$1.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),b$3=()=>typeof WebSocket<"u"||typeof global$1<"u"&&typeof global$1.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",a$4=e=>e.split("?")[0],h$5=10,S$5=w$5();let f$5=class{constructor(e){if(this.url=e,this.events=new eventsExports.EventEmitter,this.registering=!1,!isWsUrl(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise(((e,t)=>{typeof this.socket>"u"?t(new Error("Connection already closed")):(this.socket.onclose=t=>{this.onClose(t),e()},this.socket.close())}))}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(safeJsonStringify$2(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!isWsUrl(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise(((e,t)=>{this.events.once("register_error",(e=>{this.resetMaxListeners(),t(e)})),this.events.once("open",(()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return t(new Error("WebSocket connection is missing or invalid"));e(this.socket)}))}))}return this.url=e,this.registering=!0,new Promise(((t,r)=>{const n=new URLSearchParams(e).get("origin"),o=cjs$4.isReactNative()?{headers:{origin:n}}:{rejectUnauthorized:!isLocalhostUrl(e)},i=new S$5(e,[],o);b$3()?i.onerror=e=>{const t=e;r(this.emitError(t.error))}:i.on("error",(e=>{r(this.emitError(e))})),i.onopen=()=>{this.onOpen(i),t(i)}}))}onOpen(e){e.onmessage=e=>this.onPayload(e),e.onclose=e=>this.onClose(e),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const t="string"==typeof e.data?safeJsonParse$2(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const r=this.parseError(t),n=formatJsonRpcError(e,r.message||r.toString());this.events.emit("payload",n)}parseError(e,t=this.url){return parseConnectionError(e,a$4(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>h$5&&this.events.setMaxListeners(h$5)}emitError(e){const t=this.parseError(new Error((null==e?void 0:e.message)||`WebSocket connection failed for host: ${a$4(this.url)}`));return this.events.emit("register_error",t),t}};const ye$1="wc",De=2,ie="core",x$4=`${ye$1}@2:${ie}:`,Ye={name:ie,logger:"error"},Je={database:":memory:"},Xe="crypto",me$1="client_ed25519_seed",We=cjs$7.ONE_DAY,Ze="keychain",Qe="0.3",et="messages",tt="0.3",it$1=cjs$7.SIX_HOURS,st$1="publisher",rt$1="irn",nt$1="error",be$1="wss://relay.walletconnect.org",ot$1="relayer",v$4={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"},at$1="_subscription",I$4={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},ht$1=.1,se="2.17.1",M$3={link_mode:"link_mode",relay:"relay"},ct$1="0.3",lt$1="WALLETCONNECT_CLIENT_ID",fe="WALLETCONNECT_LINK_MODE_APPS",O$2={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},ut$1="subscription",dt$1="0.3",pt$2=1e3*cjs$7.FIVE_SECONDS,gt$1="pairing",yt$1="0.3",B$2={wc_pairingDelete:{req:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:cjs$7.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:cjs$7.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:0},res:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:0}}},V$2={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},P$3={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},Dt="history",mt="0.3",bt="expirer",S$4={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},ft="0.3",_t="verify-api",vs$1="https://verify.walletconnect.com",Et="https://verify.walletconnect.org",J$1=Et,vt=`${J$1}/v3`,wt=[vs$1,Et],It="echo",Tt="https://echo.walletconnect.com",z$5={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"},$$3={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"},Is$1={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"},Ts$1={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"},Cs={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},Ps={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},Ct=.1,Pt="event-client",St=86400,Rt="https://pulse.walletconnect.org/batch";function Ss$1(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<e.length;o++){var i=e.charAt(o),a=i.charCodeAt(0);if(255!==r[a])throw new TypeError(i+" is ambiguous");r[a]=o}var s=e.length,c=e.charAt(0),u=Math.log(s)/Math.log(256),l=Math.log(256)/Math.log(s);function d(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,o=0;e[t]===c;)n++,t++;for(var i=(e.length-t)*u+1>>>0,a=new Uint8Array(i);e[t];){var l=r[e.charCodeAt(t)];if(255===l)return;for(var d=0,f=i-1;(0!==l||d<o)&&-1!==f;f--,d++)l+=s*a[f]>>>0,a[f]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=d,t++}if(" "!==e[t]){for(var h=i-o;h!==i&&0===a[h];)h++;for(var p=new Uint8Array(n+(i-h)),y=n;h!==i;)p[y++]=a[h++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,o=0,i=t.length;o!==i&&0===t[o];)o++,r++;for(var a=(i-o)*l+1>>>0,u=new Uint8Array(a);o!==i;){for(var d=t[o],f=0,h=a-1;(0!==d||f<n)&&-1!==h;h--,f++)d+=256*u[h]>>>0,u[h]=d%s>>>0,d=d/s>>>0;if(0!==d)throw new Error("Non-zero carry");n=f,o++}for(var p=a-n;p!==a&&0===u[p];)p++;for(var y=c.repeat(r);p<a;++p)y+=e.charAt(u[p]);return y},decodeUnsafe:d,decode:function(e){var r=d(e);if(r)return r;throw new Error(`Non-${t} character`)}}}var Rs$1=Ss$1,xs=Rs$1;const xt=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},Os=e=>(new TextEncoder).encode(e),As=e=>(new TextDecoder).decode(e);class Ns{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class zs{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){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))}throw Error("Can only multibase decode strings")}or(e){return Ot(this,e)}}class Ls{constructor(e){this.decoders=e}or(e){return Ot(this,e)}decode(e){const t=e[0],r=this.decoders[t];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 Ot=(e,t)=>new Ls({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class $s{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new Ns(e,t,r),this.decoder=new zs(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const re=({name:e,prefix:t,encode:r,decode:n})=>new $s(e,t,r,n),X$1=({prefix:e,name:t,alphabet:r})=>{const{encode:n,decode:o}=xs(r,t);return re({prefix:e,name:t,encode:n,decode:e=>xt(o(e))})},ks=(e,t,r,n)=>{const o={};for(let l=0;l<t.length;++l)o[t[l]]=l;let i=e.length;for(;"="===e[i-1];)--i;const a=new Uint8Array(i*r/8|0);let s=0,c=0,u=0;for(let l=0;l<i;++l){const t=o[e[l]];if(void 0===t)throw new SyntaxError(`Non-${n} character`);c=c<<r|t,s+=r,s>=8&&(s-=8,a[u++]=255&c>>s)}if(s>=r||255&c<<8-s)throw new SyntaxError("Unexpected end of data");return a},Ms=(e,t,r)=>{const n="="===t[t.length-1],o=(1<<r)-1;let i="",a=0,s=0;for(let c=0;c<e.length;++c)for(s=s<<8|e[c],a+=8;a>r;)a-=r,i+=t[o&s>>a];if(a&&(i+=t[o&s<<r-a]),n)for(;i.length*r&7;)i+="=";return i},f$4=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>re({prefix:t,name:e,encode:e=>Ms(e,n,r),decode:t=>ks(t,n,r,e)}),Us=re({prefix:"\0",name:"identity",encode:e=>As(e),decode:e=>Os(e)});var Fs=Object.freeze({__proto__:null,identity:Us});const Ks=f$4({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Bs=Object.freeze({__proto__:null,base2:Ks});const Vs=f$4({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var js=Object.freeze({__proto__:null,base8:Vs});const qs$1=X$1({prefix:"9",name:"base10",alphabet:"0123456789"});var Gs=Object.freeze({__proto__:null,base10:qs$1});const Hs=f$4({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ys=f$4({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Js=Object.freeze({__proto__:null,base16:Hs,base16upper:Ys});const Xs=f$4({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ws=f$4({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Zs=f$4({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Qs=f$4({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),er=f$4({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),tr=f$4({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ir=f$4({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),sr=f$4({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),rr=f$4({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var nr=Object.freeze({__proto__:null,base32:Xs,base32upper:Ws,base32pad:Zs,base32padupper:Qs,base32hex:er,base32hexupper:tr,base32hexpad:ir,base32hexpadupper:sr,base32z:rr});const or=X$1({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ar=X$1({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var hr=Object.freeze({__proto__:null,base36:or,base36upper:ar});const cr=X$1({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),lr=X$1({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ur=Object.freeze({__proto__:null,base58btc:cr,base58flickr:lr});const dr=f$4({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),pr=f$4({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),gr=f$4({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),yr=f$4({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Dr=Object.freeze({__proto__:null,base64:dr,base64pad:pr,base64url:gr,base64urlpad:yr});const At=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),mr=At.reduce(((e,t,r)=>(e[r]=t,e)),[]),br=At.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]);function fr$1(e){return e.reduce(((e,t)=>e+=mr[t]),"")}function _r(e){const t=[];for(const r of e){const e=br[r.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}const Er=re({prefix:"🚀",name:"base256emoji",encode:fr$1,decode:_r});var vr=Object.freeze({__proto__:null,base256emoji:Er}),wr=zt,Nt=128,Ir=127,Tr=~Ir,Cr=Math.pow(2,31);function zt(e,t,r){t=t||[];for(var n=r=r||0;e>=Cr;)t[r++]=255&e|Nt,e/=128;for(;e&Tr;)t[r++]=255&e|Nt,e>>>=7;return t[r]=0|e,zt.bytes=r-n+1,t}var Pr=_e$1,Sr=128,Lt=127;function _e$1(e,t){var r,n=0,o=0,i=t=t||0,a=e.length;do{if(i>=a)throw _e$1.bytes=0,new RangeError("Could not decode varint");r=e[i++],n+=o<28?(r&Lt)<<o:(r&Lt)*Math.pow(2,o),o+=7}while(r>=Sr);return _e$1.bytes=i-t,n}var Rr=Math.pow(2,7),xr=Math.pow(2,14),Or=Math.pow(2,21),Ar=Math.pow(2,28),Nr=Math.pow(2,35),zr=Math.pow(2,42),Lr=Math.pow(2,49),$r=Math.pow(2,56),kr=Math.pow(2,63),Mr=function(e){return e<Rr?1:e<xr?2:e<Or?3:e<Ar?4:e<Nr?5:e<zr?6:e<Lr?7:e<$r?8:e<kr?9:10},Ur={encode:wr,decode:Pr,encodingLength:Mr},$t=Ur;const kt=(e,t,r=0)=>($t.encode(e,t,r),t),Mt=e=>$t.encodingLength(e),Ee=(e,t)=>{const r=t.byteLength,n=Mt(e),o=n+Mt(r),i=new Uint8Array(o+r);return kt(e,i,0),kt(r,i,n),i.set(t,o),new Fr(e,r,t,i)};class Fr{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}}const Ut=({name:e,code:t,encode:r})=>new Kr(e,t,r);class Kr{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Ee(this.code,t):t.then((e=>Ee(this.code,e)))}throw Error("Unknown type, must be binary type")}}const Ft=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Br=Ut({name:"sha2-256",code:18,encode:Ft("SHA-256")}),Vr=Ut({name:"sha2-512",code:19,encode:Ft("SHA-512")});var jr=Object.freeze({__proto__:null,sha256:Br,sha512:Vr});const Kt=0,qr="identity",Bt=xt,Gr=e=>Ee(Kt,Bt(e)),Hr={code:Kt,name:qr,encode:Bt,digest:Gr};var Yr=Object.freeze({__proto__:null,identity:Hr});new TextEncoder,new TextDecoder;const Vt={...Fs,...Bs,...js,...Gs,...Js,...nr,...hr,...ur,...Dr,...vr};function Jr(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}function jt(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const qt=jt("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),ve=jt("ascii","a",(e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}),(e=>{const t=Jr((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t})),Xr={utf8:qt,"utf-8":qt,hex:Vt.base16,latin1:ve,ascii:ve,binary:ve,...Vt};function Wr(e,t="utf8"){const r=Xr[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.decoder.decode(`${r.prefix}${e}`):globalThis.Buffer.from(e,"utf8")}class Gt{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name=Ze,this.version=Qe,this.initialized=!1,this.storagePrefix=x$4,this.init=async()=>{if(!this.initialized){const e=await this.getKeyChain();typeof e<"u"&&(this.keychain=e),this.initialized=!0}},this.has=e=>(this.isInitialized(),this.keychain.has(e)),this.set=async(e,t)=>{this.isInitialized(),this.keychain.set(e,t),await this.persist()},this.get=e=>{this.isInitialized();const t=this.keychain.get(e);if(typeof t>"u"){const{message:t}=S$6("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t},this.del=async e=>{this.isInitialized(),this.keychain.delete(e),await this.persist()},this.core=e,this.logger=E$5(t,this.name)}get context(){return y$7(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Tt$1(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Pt$1(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Ht{constructor(e,t,r){this.core=e,this.logger=t,this.name=Xe,this.randomSessionIdentifier=pr$1(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=e=>(this.isInitialized(),this.keychain.has(e)),this.getClientId=async()=>{this.isInitialized();return encodeIss(generateKeyPair(await this.getClientSeed()).publicKey)},this.generateKeyPair=()=>{this.isInitialized();const e=fr$2();return this.setPrivateKey(e.publicKey,e.privateKey)},this.signJWT=async e=>{this.isInitialized();const t=generateKeyPair(await this.getClientSeed()),r=this.randomSessionIdentifier,n=We;return await signJWT(r,e,n,t)},this.generateSharedKey=(e,t,r)=>{this.isInitialized();const n=mr$1(this.getPrivateKey(e),t);return this.setSymKey(n,r)},this.setSymKey=async(e,t)=>{this.isInitialized();const r=t||hr$1(e);return await this.keychain.set(r,e),r},this.deleteKeyPair=async e=>{this.isInitialized(),await this.keychain.del(e)},this.deleteSymKey=async e=>{this.isInitialized(),await this.keychain.del(e)},this.encode=async(e,t,r)=>{this.isInitialized();const n=On(r),o=safeJsonStringify$2(t);if(Nr$1(n))return vr$1(o,null==r?void 0:r.encoding);if(Or$1(n)){const t=n.senderPublicKey,r=n.receiverPublicKey;e=await this.generateSharedKey(t,r)}const i=this.getSymKey(e),{type:a,senderPublicKey:s}=n;return gr$1({type:a,symKey:i,message:o,senderPublicKey:s,encoding:null==r?void 0:r.encoding})},this.decode=async(e,t,r)=>{this.isInitialized();const n=wr$1(t,r);if(Nr$1(n)){return safeJsonParse$2(Er$1(t,null==r?void 0:r.encoding))}if(Or$1(n)){const t=n.receiverPublicKey,r=n.senderPublicKey;e=await this.generateSharedKey(t,r)}try{const n=this.getSymKey(e);return safeJsonParse$2(br$1({symKey:n,encoded:t,encoding:null==r?void 0:r.encoding}))}catch(o){this.logger.error(`Failed to decode message from topic: '${e}', clientId: '${await this.getClientId()}'`),this.logger.error(o)}},this.getPayloadType=(e,t=ge)=>A$4(Q$1({encoded:e,encoding:t}).type),this.getPayloadSenderPublicKey=(e,t=ge)=>{const r=Q$1({encoded:e,encoding:t});return r.senderPublicKey?toString$1(r.senderPublicKey,g$4):void 0},this.core=e,this.logger=E$5(t,this.name),this.keychain=r||new Gt(this.core,this.logger)}get context(){return y$7(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(me$1)}catch{e=pr$1(),await this.keychain.set(me$1,e)}return Wr(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Yt extends a$5{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=et,this.version=tt,this.initialized=!1,this.storagePrefix=x$4,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const e=await this.getRelayerMessages();typeof e<"u"&&(this.messages=e),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}finally{this.initialized=!0}}},this.set=async(e,t)=>{this.isInitialized();const r=yr$1(t);let n=this.messages.get(e);return typeof n>"u"&&(n={}),typeof n[r]<"u"||(n[r]=t,this.messages.set(e,n),await this.persist()),r},this.get=e=>{this.isInitialized();let t=this.messages.get(e);return typeof t>"u"&&(t={}),t},this.has=(e,t)=>{this.isInitialized();return typeof this.get(e)[yr$1(t)]<"u"},this.del=async e=>{this.isInitialized(),this.messages.delete(e),await this.persist()},this.logger=E$5(e,this.name),this.core=t}get context(){return y$7(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Tt$1(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Pt$1(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Zr extends g$5{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new eventsExports.EventEmitter,this.name=st$1,this.queue=new Map,this.publishTimeout=cjs$7.toMiliseconds(cjs$7.ONE_MINUTE),this.failedPublishTimeout=cjs$7.toMiliseconds(cjs$7.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(e,t,r)=>{var n;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:r}});const o=(null==r?void 0:r.ttl)||it$1,i=Ir$1(r),a=(null==r?void 0:r.prompt)||!1,s=(null==r?void 0:r.tag)||0,c=(null==r?void 0:r.id)||getBigIntRpcId().toString(),u={topic:e,message:t,opts:{ttl:o,relay:i,prompt:a,tag:s,id:c,attestation:null==r?void 0:r.attestation}},l=`Failed to publish payload, please try again. id:${c} tag:${s}`,d=Date.now();let f,h=1;try{for(;void 0===f;){if(Date.now()-d>this.publishTimeout)throw new Error(l);this.logger.trace({id:c,attempts:h},`publisher.publish - attempt ${h}`),f=await await kt$1(this.rpcPublish(e,t,o,i,a,s,c,null==r?void 0:r.attestation).catch((e=>this.logger.warn(e))),this.publishTimeout,l),h++,f||await new Promise((e=>setTimeout(e,this.failedPublishTimeout)))}this.relayer.events.emit(v$4.publish,u),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:c,topic:e,message:t,opts:r}})}catch(p){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(p),null!=(n=null==r?void 0:r.internal)&&n.throwOnFailedPublish)throw p;this.queue.set(c,u)}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.relayer=e,this.logger=E$5(t,this.name),this.registerEventListeners()}get context(){return y$7(this.logger)}rpcPublish(e,t,r,n,o,i,a,s){var c,u,l,d;const f={method:jr$1(n.protocol).publish,params:{topic:e,message:t,ttl:r,prompt:o,tag:i,attestation:s},id:a};return I$5(null==(c=f.params)?void 0:c.prompt)&&(null==(u=f.params)||delete u.prompt),I$5(null==(l=f.params)?void 0:l.tag)&&(null==(d=f.params)||delete d.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:f}),this.relayer.request(f)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach((async e=>{const{topic:t,message:r,opts:n}=e;await this.publish(t,r,n)}))}registerEventListeners(){this.relayer.core.heartbeat.on(r$6.pulse,(()=>{if(this.needsTransportRestart)return this.needsTransportRestart=!1,void this.relayer.events.emit(v$4.connection_stalled);this.checkQueue()})),this.relayer.on(v$4.message_ack,(e=>{this.removeRequestFromQueue(e.id.toString())}))}}class Qr{constructor(){this.map=new Map,this.set=(e,t)=>{const r=this.get(e);this.exists(e,t)||this.map.set(e,[...r,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u")return void this.map.delete(e);if(!this.map.has(e))return;const r=this.get(e);if(!this.exists(e,t))return;const n=r.filter((e=>e!==t));n.length?this.map.set(e,n):this.map.delete(e)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var en$1=Object.defineProperty,tn=Object.defineProperties,sn=Object.getOwnPropertyDescriptors,Jt=Object.getOwnPropertySymbols,rn=Object.prototype.hasOwnProperty,nn=Object.prototype.propertyIsEnumerable,Xt=(e,t,r)=>t in e?en$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,W$1=(e,t)=>{for(var r in t||(t={}))rn.call(t,r)&&Xt(e,r,t[r]);if(Jt)for(var r of Jt(t))nn.call(t,r)&&Xt(e,r,t[r]);return e},we$1=(e,t)=>tn(e,sn(t));class Wt extends d$4{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new Qr,this.events=new eventsExports.EventEmitter,this.name=ut$1,this.version=dt$1,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=x$4,this.subscribeTimeout=cjs$7.toMiliseconds(cjs$7.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(e,t)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}});try{const r=Ir$1(t),n={topic:e,relay:r,transportType:null==t?void 0:t.transportType};this.pending.set(e,n);const o=await this.rpcSubscribe(e,r,t);return"string"==typeof o&&(this.onSubscribe(o,n),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}})),o}catch(r){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(r),r}},this.unsubscribe=async(e,t)=>{await this.restartToComplete(),this.isInitialized(),typeof(null==t?void 0:t.id)<"u"?await this.unsubscribeById(e,t.id,t):await this.unsubscribeByTopic(e,t)},this.isSubscribed=async e=>{if(this.topics.includes(e))return!0;const t=`${this.pendingSubscriptionWatchLabel}_${e}`;return await new Promise(((r,n)=>{const o=new cjs$7.Watch;o.start(t);const i=setInterval((()=>{!this.pending.has(e)&&this.topics.includes(e)&&(clearInterval(i),o.stop(t),r(!0)),o.elapsed(t)>=pt$2&&(clearInterval(i),o.stop(t),n(new Error("Subscription resolution timeout")))}),this.pollingInterval)})).catch((()=>!1))},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=E$5(t,this.name),this.clientId=""}get context(){return y$7(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let r=!1;try{r=this.getSubscription(e).topic===t}catch{}return r}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const r=this.topicMap.get(e);await Promise.all(r.map((async r=>await this.unsubscribeById(e,r,t))))}async unsubscribeById(e,t,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}});try{const n=Ir$1(r);await this.rpcUnsubscribe(e,t,n);const o=U$2("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,o),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(e,t,r){var n;(null==r?void 0:r.transportType)===M$3.relay&&await this.restartToComplete();const o={method:jr$1(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:o});const i=null==(n=null==r?void 0:r.internal)?void 0:n.throwOnFailedPublish;try{const t=yr$1(e+this.clientId);if((null==r?void 0:r.transportType)===M$3.link_mode)return setTimeout((()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(o).catch((e=>this.logger.warn(e)))}),cjs$7.toMiliseconds(cjs$7.ONE_SECOND)),t;const n=await kt$1(this.relayer.request(o).catch((e=>this.logger.warn(e))),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!n&&i)throw new Error(`Subscribing to ${e} failed, please try again`);return n?t:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(v$4.connection_stalled),i)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t={method:jr$1(e[0].relay.protocol).batchSubscribe,params:{topics:e.map((e=>e.topic))}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:t});try{return await await kt$1(this.relayer.request(t).catch((e=>this.logger.warn(e))),this.subscribeTimeout)}catch{this.relayer.events.emit(v$4.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const t={method:jr$1(e[0].relay.protocol).batchFetchMessages,params:{topics:e.map((e=>e.topic))}};let r;this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:t});try{r=await await kt$1(this.relayer.request(t).catch((e=>this.logger.warn(e))),this.subscribeTimeout)}catch{this.relayer.events.emit(v$4.connection_stalled)}return r}rpcUnsubscribe(e,t,r){const n={method:jr$1(r.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.request(n)}onSubscribe(e,t){this.setSubscription(e,we$1(W$1({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach((e=>{this.setSubscription(e.id,W$1({},e)),this.pending.delete(e.topic)}))}async onUnsubscribe(e,t,r){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,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,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,W$1({},t)),this.topicMap.set(t.topic,e),this.events.emit(O$2.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:t}=S$6("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const r=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(r.topic,e),this.events.emit(O$2.deleted,we$1(W$1({},r),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(O$2.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t<e;t++){const e=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchFetchMessages(e),await this.batchSubscribe(e)}}this.events.emit(O$2.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:e}=S$6("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e2){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e2)}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);L$4(t)&&this.onBatchSubscribe(t.map(((t,r)=>we$1(W$1({},e[r]),{id:t}))))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const t=await this.rpcBatchFetchMessages(e);t&&t.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(t.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach((t=>{e.push(t)})),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(r$6.pulse,(async()=>{await this.checkPending()})),this.events.on(O$2.created,(async e=>{const t=O$2.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})),this.events.on(O$2.deleted,(async e=>{const t=O$2.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}))}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise((e=>{const t=setInterval((()=>{this.restartInProgress||(clearInterval(t),e())}),this.pollingInterval)}))}}var on=Object.defineProperty,Zt=Object.getOwnPropertySymbols,an=Object.prototype.hasOwnProperty,hn=Object.prototype.propertyIsEnumerable,Qt=(e,t,r)=>t in e?on(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ei=(e,t)=>{for(var r in t||(t={}))an.call(t,r)&&Qt(e,r,t[r]);if(Zt)for(var r of Zt(t))hn.call(t,r)&&Qt(e,r,t[r]);return e};class ti extends u$4{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new eventsExports.EventEmitter,this.name=ot$1,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=cjs$7.toMiliseconds(cjs$7.THIRTY_SECONDS+cjs$7.ONE_SECOND),this.request=async e=>{var t,r;this.logger.debug("Publishing Request Payload");const n=e.id||getBigIntRpcId().toString();await this.toEstablishConnection();try{const o=this.provider.request(e);this.requestsInFlight.set(n,{promise:o,request:e}),this.logger.trace({id:n,method:e.method,topic:null==(t=e.params)?void 0:t.topic},"relayer.request - attempt to publish...");const i=await new Promise((async(e,t)=>{const r=()=>{t(new Error(`relayer.request - publish interrupted, id: ${n}`))};this.provider.on(I$4.disconnect,r);const i=await o;this.provider.off(I$4.disconnect,r),e(i)}));return this.logger.trace({id:n,method:e.method,topic:null==(r=e.params)?void 0:r.topic},"relayer.request - published"),i}catch(o){throw this.logger.debug(`Failed to Publish Request: ${n}`),o}finally{this.requestsInFlight.delete(n)}},this.resetPingTimeout=()=>{if(ce())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout((()=>{var e,t,r;null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)||r.terminate()}),this.heartBeatTimeout)}catch(e){this.logger.warn(e)}},this.onPayloadHandler=e=>{this.onProviderPayload(e),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(v$4.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=e=>{this.logger.error(e),this.events.emit(v$4.error,e),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(I$4.payload,this.onPayloadHandler),this.provider.on(I$4.connect,this.onConnectHandler),this.provider.on(I$4.disconnect,this.onDisconnectHandler),this.provider.on(I$4.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&"string"!=typeof e.logger?E$5(e.logger,this.name):_i(k$5({level:e.logger||nt$1})),this.messages=new Yt(this.logger,e.core),this.subscriber=new Wt(this,this.logger),this.publisher=new Zr(this,this.logger),this.relayUrl=(null==e?void 0:e.relayUrl)||be$1,this.projectId=e.projectId,this.bundleId=Ot$1(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e2){this.logger.warn(e2)}}get context(){return y$7(this.logger)}get connected(){var e,t,r;return 1===(null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:r.readyState)}get connecting(){var e,t,r;return 0===(null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:r.readyState)}async publish(e,t,r){this.isInitialized(),await this.publisher.publish(e,t,r),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:M$3.relay})}async subscribe(e,t){var r,n,o;this.isInitialized(),"relay"===(null==t?void 0:t.transportType)&&await this.toEstablishConnection();const i=typeof(null==(r=null==t?void 0:t.internal)?void 0:r.throwOnFailedPublish)>"u"||(null==(n=null==t?void 0:t.internal)?void 0:n.throwOnFailedPublish);let a,s=(null==(o=this.subscriber.topicMap.get(e))?void 0:o[0])||"";const c=t=>{t.topic===e&&(this.subscriber.off(O$2.created,c),a())};return await Promise.all([new Promise((e=>{a=e,this.subscriber.on(O$2.created,c)})),new Promise((async(r,n)=>{s=await this.subscriber.subscribe(e,ei({internal:{throwOnFailedPublish:i}},t)).catch((e=>{i&&n(e)}))||s,r()}))]),s}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map((e=>e.promise)))}catch(e2){this.logger.warn(e2)}this.hasExperiencedNetworkDisruption||this.connected?await kt$1(this.provider.disconnect(),2e3,"provider.disconnect()").catch((()=>this.onProviderDisconnect())):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise((async(e,t)=>{const r=()=>{this.provider.off(I$4.disconnect,r),t(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(I$4.disconnect,r),await kt$1(this.provider.connect(),cjs$7.toMiliseconds(cjs$7.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch((e=>{t(e)})).finally((()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0})),this.subscriber.start().catch((e=>{this.logger.error(e),this.onDisconnectHandler()})),this.hasExperiencedNetworkDisruption=!1,e()}))}catch(t){this.logger.error(t);const e=t;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(e.message))throw t}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!(await mo()))throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(0===(null==e?void 0:e.length))return void this.logger.trace("Batch message events is empty. Ignoring...");const t=e.sort(((e,t)=>e.publishedAt-t.publishedAt));this.logger.trace(`Batch of ${t.length} message events sorted`);for(const n of t)try{await this.onMessageEvent(n)}catch(r){this.logger.warn(r)}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){const{topic:r}=e;if(!t.sessionExists){const e={topic:r,expiry:Mt$1(cjs$7.FIVE_MINUTES),relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(r,e)}this.events.emit(v$4.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,t,r,n,o;if(ce())try{null!=(t=null==(e=this.provider)?void 0:e.connection)&&t.socket&&(null==(o=null==(n=null==(r=this.provider)?void 0:r.connection)?void 0:n.socket)||o.once("ping",(()=>{this.resetPingTimeout()}))),this.resetPingTimeout()}catch(i){this.logger.warn(i)}}isConnectionStalled(e){return this.staleConnectionErrors.some((t=>e.includes(t)))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new o$8(new f$5($t$1({sdkVersion:se,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:r}=e;await this.messages.set(t,r)}async shouldIgnoreMessageEvent(e){const{topic:t,message:r}=e;if(!r||0===r.length)return this.logger.debug(`Ignoring invalid/empty message: ${r}`),!0;if(!(await this.subscriber.isSubscribed(t)))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const n=this.messages.has(t,r);return n&&this.logger.debug(`Ignoring duplicate message: ${r}`),n}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),isJsonRpcRequest(e)){if(!e.method.endsWith(at$1))return;const t=e.params,{topic:r,message:n,publishedAt:o,attestation:i}=t.data,a={topic:r,message:n,publishedAt:o,transportType:M$3.relay,attestation:i};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(ei({type:"event",event:t.id},a)),this.events.emit(t.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else isJsonRpcResponse(e)&&this.events.emit(v$4.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(v$4.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=formatJsonRpcResult(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(I$4.payload,this.onPayloadHandler),this.provider.off(I$4.connect,this.onConnectHandler),this.provider.off(I$4.disconnect,this.onDisconnectHandler),this.provider.off(I$4.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await mo();ho((async t=>{e!==t&&(e=t,t?await this.restartTransport().catch((e=>this.logger.error(e))):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}))}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(v$4.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout((async()=>{await this.transportOpen().catch((e=>this.logger.error(e)))}),cjs$7.toMiliseconds(ht$1))))}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise((e=>{const t=setInterval((()=>{this.connected&&(clearInterval(t),e())}),this.connectionStatusPollingInterval)})),await this.transportOpen())}}var cn=Object.defineProperty,ii=Object.getOwnPropertySymbols,ln=Object.prototype.hasOwnProperty,un=Object.prototype.propertyIsEnumerable,si=(e,t,r)=>t in e?cn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ri=(e,t)=>{for(var r in t||(t={}))ln.call(t,r)&&si(e,r,t[r]);if(ii)for(var r of ii(t))un.call(t,r)&&si(e,r,t[r]);return e};class ni extends p$3{constructor(e,t,r,n=x$4,o=void 0){super(e,t,r,n),this.core=e,this.logger=t,this.name=r,this.map=new Map,this.version=ct$1,this.cached=[],this.initialized=!1,this.storagePrefix=x$4,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>{this.getKey&&null!==e&&!I$5(e)?this.map.set(this.getKey(e),e):Yr$1(e)?this.map.set(e.id,e):Qr$1(e)&&this.map.set(e.topic,e)})),this.cached=[],this.initialized=!0)},this.set=async(e,t)=>{this.isInitialized(),this.map.has(e)?await this.update(e,t):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:e,value:t}),this.map.set(e,t),await this.persist())},this.get=e=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:e}),this.getData(e)),this.getAll=e=>(this.isInitialized(),e?this.values.filter((t=>Object.keys(e).every((r=>ys$1(t[r],e[r]))))):this.values),this.update=async(e,t)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:e,update:t});const r=ri(ri({},this.getData(e)),t);this.map.set(e,r),await this.persist()},this.delete=async(e,t)=>{this.isInitialized(),this.map.has(e)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:e,reason:t}),this.map.delete(e),this.addToRecentlyDeleted(e),await this.persist())},this.logger=E$5(t,this.name),this.storagePrefix=n,this.getKey=o}get context(){return y$7(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){const{message:t}=S$6("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(t),new Error(t)}const{message:t}=S$6("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),new Error(t)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:e}=S$6("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e2){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e2)}}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}}class oi{constructor(e,t){this.core=e,this.logger=t,this.name=gt$1,this.version=yt$1,this.events=new mi,this.initialized=!1,this.storagePrefix=x$4,this.ignoredPayloadTypes=[D$5],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:e})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...e])]},this.create=async e=>{this.isInitialized();const t=pr$1(),r=await this.core.crypto.setSymKey(t),n=Mt$1(cjs$7.FIVE_MINUTES),o={protocol:rt$1},i={topic:r,expiry:n,relay:o,active:!1,methods:null==e?void 0:e.methods},a=Dr$1({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:t,relay:o,expiryTimestamp:n,methods:null==e?void 0:e.methods});return this.events.emit(V$2.create,i),this.core.expirer.set(r,n),await this.pairings.set(r,i),await this.core.relayer.subscribe(r,{transportType:null==e?void 0:e.transportType}),{topic:r,uri:a}},this.pair=async e=>{this.isInitialized();const t=this.core.eventClient.createEvent({properties:{topic:null==e?void 0:e.uri,trace:[z$5.pairing_started]}});this.isValidPair(e,t);const{topic:r,symKey:n,relay:o,expiryTimestamp:i,methods:a}=kr$1(e.uri);let s;if(t.props.properties.topic=r,t.addTrace(z$5.pairing_uri_validation_success),t.addTrace(z$5.pairing_uri_not_expired),this.pairings.keys.includes(r)){if(s=this.pairings.get(r),t.addTrace(z$5.existing_pairing),s.active)throw t.setError($$3.active_pairing_already_exists),new Error(`Pairing already exists: ${r}. Please try again with a new connection URI.`);t.addTrace(z$5.pairing_not_expired)}const c=i||Mt$1(cjs$7.FIVE_MINUTES),u={topic:r,relay:o,expiry:c,active:!1,methods:a};this.core.expirer.set(r,c),await this.pairings.set(r,u),t.addTrace(z$5.store_new_pairing),e.activatePairing&&await this.activate({topic:r}),this.events.emit(V$2.create,u),t.addTrace(z$5.emit_inactive_pairing),this.core.crypto.keychain.has(r)||await this.core.crypto.setSymKey(n,r),t.addTrace(z$5.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{t.setError($$3.no_internet_connection)}try{await this.core.relayer.subscribe(r,{relay:o})}catch(l){throw t.setError($$3.subscribe_pairing_topic_failure),l}return t.addTrace(z$5.subscribe_pairing_topic_success),u},this.activate=async({topic:e})=>{this.isInitialized();const t=Mt$1(cjs$7.THIRTY_DAYS);this.core.expirer.set(e,t),await this.pairings.update(e,{active:!0,expiry:t})},this.ping=async e=>{this.isInitialized(),await this.isValidPing(e);const{topic:t}=e;if(this.pairings.keys.includes(t)){const e=await this.sendRequest(t,"wc_pairingPing",{}),{done:r,resolve:n,reject:o}=_t$1();this.events.once(Lt$1("pairing_ping",e),(({error:e})=>{e?o(e):n()})),await r()}},this.updateExpiry=async({topic:e,expiry:t})=>{this.isInitialized(),await this.pairings.update(e,{expiry:t})},this.updateMetadata=async({topic:e,metadata:t})=>{this.isInitialized(),await this.pairings.update(e,{peerMetadata:t})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async e=>{this.isInitialized(),await this.isValidDisconnect(e);const{topic:t}=e;this.pairings.keys.includes(t)&&(await this.sendRequest(t,"wc_pairingDelete",U$2("USER_DISCONNECTED")),await this.deletePairing(t))},this.formatUriFromPairing=e=>{this.isInitialized();const{topic:t,relay:r,expiry:n,methods:o}=e,i=this.core.crypto.keychain.get(t);return Dr$1({protocol:this.core.protocol,version:this.core.version,topic:t,symKey:i,relay:r,expiryTimestamp:n,methods:o})},this.sendRequest=async(e,t,r)=>{const n=formatJsonRpcRequest(t,r),o=await this.core.crypto.encode(e,n),i=B$2[t].req;return this.core.history.set(e,n),this.core.relayer.publish(e,o,i),n.id},this.sendResult=async(e,t,r)=>{const n=formatJsonRpcResult(e,r),o=await this.core.crypto.encode(t,n),i=await this.core.history.get(t,e),a=B$2[i.request.method].res;await this.core.relayer.publish(t,o,a),await this.core.history.resolve(n)},this.sendError=async(e,t,r)=>{const n=formatJsonRpcError(e,r),o=await this.core.crypto.encode(t,n),i=await this.core.history.get(t,e),a=B$2[i.request.method]?B$2[i.request.method].res:B$2.unregistered_method.res;await this.core.relayer.publish(t,o,a),await this.core.history.resolve(n)},this.deletePairing=async(e,t)=>{await this.core.relayer.unsubscribe(e),await Promise.all([this.pairings.delete(e,U$2("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(e),t?Promise.resolve():this.core.expirer.del(e)])},this.cleanup=async()=>{const e=this.pairings.getAll().filter((e=>Kt$1(e.expiry)));await Promise.all(e.map((e=>this.deletePairing(e.topic))))},this.onRelayEventRequest=e=>{const{topic:t,payload:r}=e;switch(r.method){case"wc_pairingPing":return this.onPairingPingRequest(t,r);case"wc_pairingDelete":return this.onPairingDeleteRequest(t,r);default:return this.onUnknownRpcMethodRequest(t,r)}},this.onRelayEventResponse=async e=>{const{topic:t,payload:r}=e,n=(await this.core.history.get(t,r.id)).request.method;return"wc_pairingPing"===n?this.onPairingPingResponse(t,r):this.onUnknownRpcMethodResponse(n)},this.onPairingPingRequest=async(e,t)=>{const{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult(r,e,!0),this.events.emit(V$2.ping,{id:r,topic:e})}catch(n){await this.sendError(r,e,n),this.logger.error(n)}},this.onPairingPingResponse=(e,t)=>{const{id:r}=t;setTimeout((()=>{isJsonRpcResult(t)?this.events.emit(Lt$1("pairing_ping",r),{}):isJsonRpcError(t)&&this.events.emit(Lt$1("pairing_ping",r),{error:t.error})}),500)},this.onPairingDeleteRequest=async(e,t)=>{const{id:r}=t;try{this.isValidDisconnect({topic:e}),await this.deletePairing(e),this.events.emit(V$2.delete,{id:r,topic:e})}catch(n){await this.sendError(r,e,n),this.logger.error(n)}},this.onUnknownRpcMethodRequest=async(e,t)=>{const{id:r,method:n}=t;try{if(this.registeredMethods.includes(n))return;const t=U$2("WC_METHOD_UNSUPPORTED",n);await this.sendError(r,e,t),this.logger.error(t)}catch(o){await this.sendError(r,e,o),this.logger.error(o)}},this.onUnknownRpcMethodResponse=e=>{this.registeredMethods.includes(e)||this.logger.error(U$2("WC_METHOD_UNSUPPORTED",e))},this.isValidPair=(e,t)=>{var r;if(!to(e)){const{message:r}=S$6("MISSING_OR_INVALID",`pair() params: ${e}`);throw t.setError($$3.malformed_pairing_uri),new Error(r)}if(!Gr$1(e.uri)){const{message:r}=S$6("MISSING_OR_INVALID",`pair() uri: ${e.uri}`);throw t.setError($$3.malformed_pairing_uri),new Error(r)}const n=kr$1(null==e?void 0:e.uri);if(null==(r=null==n?void 0:n.relay)||!r.protocol){const{message:e}=S$6("MISSING_OR_INVALID","pair() uri#relay-protocol");throw t.setError($$3.malformed_pairing_uri),new Error(e)}if(null==n||!n.symKey){const{message:e}=S$6("MISSING_OR_INVALID","pair() uri#symKey");throw t.setError($$3.malformed_pairing_uri),new Error(e)}if(null!=n&&n.expiryTimestamp&&cjs$7.toMiliseconds(null==n?void 0:n.expiryTimestamp)<Date.now()){t.setError($$3.pairing_expired);const{message:e}=S$6("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(e)}},this.isValidPing=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidDisconnect=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidPairingTopic=async e=>{if(!b$4(e,!1)){const{message:t}=S$6("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.pairings.keys.includes(e)){const{message:t}=S$6("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(Kt$1(this.pairings.get(e).expiry)){await this.deletePairing(e);const{message:t}=S$6("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}},this.core=e,this.logger=E$5(t,this.name),this.pairings=new ni(this.core,this.logger,this.name,this.storagePrefix)}get context(){return y$7(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(v$4.message,(async e=>{const{topic:t,message:r,transportType:n}=e;if(!this.pairings.keys.includes(t)||n===M$3.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))return;const o=await this.core.crypto.decode(t,r);try{isJsonRpcRequest(o)?(this.core.history.set(t,o),this.onRelayEventRequest({topic:t,payload:o})):isJsonRpcResponse(o)&&(await this.core.history.resolve(o),await this.onRelayEventResponse({topic:t,payload:o}),this.core.history.delete(t,o.id))}catch(i){this.logger.error(i)}}))}registerExpirerEvents(){this.core.expirer.on(S$4.expired,(async e=>{const{topic:t}=Vt$1(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(V$2.expire,{topic:t}))}))}}class ai extends h$6{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new eventsExports.EventEmitter,this.name=Dt,this.version=mt,this.cached=[],this.initialized=!1,this.storagePrefix=x$4,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>this.records.set(e.id,e))),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(e,t,r)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:e,request:t,chainId:r}),this.records.has(t.id))return;const n={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:r,expiry:Mt$1(cjs$7.THIRTY_DAYS)};this.records.set(n.id,n),this.persist(),this.events.emit(P$3.created,n)},this.resolve=async e=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:e}),!this.records.has(e.id))return;const t=await this.getRecord(e.id);typeof t.response>"u"&&(t.response=isJsonRpcError(e)?{error:e.error}:{result:e.result},this.records.set(t.id,t),this.persist(),this.events.emit(P$3.updated,t))},this.get=async(e,t)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:e,id:t}),await this.getRecord(t)),this.delete=(e,t)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:t}),this.values.forEach((r=>{if(r.topic===e){if(typeof t<"u"&&r.id!==t)return;this.records.delete(r.id),this.events.emit(P$3.deleted,r)}})),this.persist()},this.exists=async(e,t)=>(this.isInitialized(),!!this.records.has(t)&&(await this.getRecord(t)).topic===e),this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=E$5(t,this.name)}get context(){return y$7(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach((t=>{if(typeof t.response<"u")return;const r={topic:t.topic,request:formatJsonRpcRequest(t.request.method,t.request.params,t.id),chainId:t.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 t=this.records.get(e);if(!t){const{message:t}=S$6("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(P$3.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:e}=S$6("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e2){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e2)}}registerEventListeners(){this.events.on(P$3.created,(e=>{const t=P$3.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})})),this.events.on(P$3.updated,(e=>{const t=P$3.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})})),this.events.on(P$3.deleted,(e=>{const t=P$3.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})})),this.core.heartbeat.on(r$6.pulse,(()=>{this.cleanup()}))}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach((t=>{cjs$7.toMiliseconds(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(P$3.deleted,t,!1),e=!0)})),e&&this.persist()}catch(e2){this.logger.warn(e2)}}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}}class hi extends x$5{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new eventsExports.EventEmitter,this.name=bt,this.version=ft,this.cached=[],this.initialized=!1,this.storagePrefix=x$4,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>this.expirations.set(e.target,e))),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=e=>{try{const t=this.formatTarget(e);return typeof this.getExpiration(t)<"u"}catch{return!1}},this.set=(e,t)=>{this.isInitialized();const r=this.formatTarget(e),n={target:r,expiry:t};this.expirations.set(r,n),this.checkExpiry(r,n),this.events.emit(S$4.created,{target:r,expiration:n})},this.get=e=>{this.isInitialized();const t=this.formatTarget(e);return this.getExpiration(t)},this.del=e=>{if(this.isInitialized(),this.has(e)){const t=this.formatTarget(e),r=this.getExpiration(t);this.expirations.delete(t),this.events.emit(S$4.deleted,{target:t,expiration:r})}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=E$5(t,this.name)}get context(){return y$7(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("string"==typeof e)return Dt$1(e);if("number"==typeof e)return xt$1(e);const{message:t}=S$6("UNKNOWN_TYPE","Target type: "+typeof e);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(S$4.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:e}=S$6("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e2){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e2)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:t}=S$6("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(t),new Error(t)}return t}checkExpiry(e,t){const{expiry:r}=t;cjs$7.toMiliseconds(r)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(S$4.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach(((e,t)=>this.checkExpiry(t,e)))}registerEventListeners(){this.core.heartbeat.on(r$6.pulse,(()=>this.checkExpirations())),this.events.on(S$4.created,(e=>{const t=S$4.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})),this.events.on(S$4.expired,(e=>{const t=S$4.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})),this.events.on(S$4.deleted,(e=>{const t=S$4.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}))}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}}class ci extends y$6{constructor(e,t,r){super(e,t,r),this.core=e,this.logger=t,this.store=r,this.name=_t,this.verifyUrlV3=vt,this.storagePrefix=x$4,this.version=De,this.init=async()=>{var e;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&cjs$7.toMiliseconds(null==(e=this.publicKey)?void 0:e.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))},this.register=async e=>{if(!V$3()||this.isDevEnv)return;const t=window.location.origin,{id:r,decryptedId:n}=e,o=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${t}&id=${r}&decryptedId=${n}`;try{const e=getDocument_1$1(),t=this.startAbortTimer(5*cjs$7.ONE_SECOND),n=await new Promise(((n,i)=>{const a=()=>{window.removeEventListener("message",c),e.body.removeChild(s),i("attestation aborted")};this.abortController.signal.addEventListener("abort",a);const s=e.createElement("iframe");s.src=o,s.style.display="none",s.addEventListener("error",a,{signal:this.abortController.signal});const c=o=>{if(o.data&&"string"==typeof o.data)try{const i=JSON.parse(o.data);if("verify_attestation"===i.type){if(decodeJWT(i.attestation).payload.id!==r)return;clearInterval(t),e.body.removeChild(s),this.abortController.signal.removeEventListener("abort",a),window.removeEventListener("message",c),n(null===i.attestation?"":i.attestation)}}catch(i){this.logger.warn(i)}};e.body.appendChild(s),window.addEventListener("message",c,{signal:this.abortController.signal})}));return this.logger.debug("jwt attestation",n),n}catch(i){this.logger.warn(i)}return""},this.resolve=async e=>{if(this.isDevEnv)return"";const{attestationId:t,hash:r,encryptedId:n}=e;if(""===t)return void this.logger.debug("resolve: attestationId is empty, skipping");if(t){if(decodeJWT(t).payload.id!==n)return;const e=await this.isValidJwtAttestation(t);if(e)return e.isVerified?e:void this.logger.warn("resolve: jwt attestation: origin url not verified")}if(!r)return;const o=this.getVerifyUrl(null==e?void 0:e.verifyUrl);return this.fetchAttestation(r,o)},this.fetchAttestation=async(e,t)=>{this.logger.debug(`resolving attestation: ${e} from url: ${t}`);const r=this.startAbortTimer(5*cjs$7.ONE_SECOND),n=await fetch(`${t}/attestation/${e}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(r),200===n.status?await n.json():void 0},this.getVerifyUrl=e=>{let t=e||J$1;return wt.includes(t)||(this.logger.info(`verify url: ${t}, not included in trusted list, assigning default: ${J$1}`),t=J$1),t},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const e=this.startAbortTimer(cjs$7.FIVE_SECONDS),t=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(e),await t.json()}catch(e){this.logger.warn(e)}},this.persistPublicKey=async e=>{this.logger.debug("persisting public key to local storage",e),await this.store.setItem(this.storeKey,e),this.publicKey=e},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async e=>{const t=await this.getPublicKey();try{if(t)return this.validateAttestation(e,t)}catch(n){this.logger.error(n),this.logger.warn("error validating attestation")}const r=await this.fetchAndPersistPublicKey();try{if(r)return this.validateAttestation(e,r)}catch(n){this.logger.error(n),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise((async e=>{const t=await this.fetchPublicKey();t&&(await this.persistPublicKey(t),e(t))}));const e=await this.fetchPromise;return this.fetchPromise=void 0,e},this.validateAttestation=(e,t)=>{const r=Rr$1(e,t.publicKey),n={hasExpired:cjs$7.toMiliseconds(r.exp)<Date.now(),payload:r};if(n.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:n.payload.origin,isScam:n.payload.isScam,isVerified:n.payload.isVerified}},this.logger=E$5(t,this.name),this.abortController=new AbortController,this.isDevEnv=Wt$1(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return y$7(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout((()=>this.abortController.abort()),cjs$7.toMiliseconds(e))}}class li extends v$5{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context=It,this.registerDeviceToken=async e=>{const{clientId:t,token:r,notificationType:n,enableEncrypted:o=!1}=e,i=`${Tt}/${this.projectId}/clients`;await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:t,type:n,token:r,always_raw:o})})},this.logger=E$5(t,this.context)}}var dn=Object.defineProperty,ui=Object.getOwnPropertySymbols,pn=Object.prototype.hasOwnProperty,gn=Object.prototype.propertyIsEnumerable,di=(e,t,r)=>t in e?dn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Z$2=(e,t)=>{for(var r in t||(t={}))pn.call(t,r)&&di(e,r,t[r]);if(ui)for(var r of ui(t))gn.call(t,r)&&di(e,r,t[r]);return e};class pi extends C$5{constructor(e,t,r=!0){super(e,t,r),this.core=e,this.logger=t,this.context=Pt,this.storagePrefix=x$4,this.storageVersion=Ct,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!Wt$1())try{const e={eventId:Ht$1(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Ge(this.core.relayer.protocol,this.core.relayer.version,se)}}};await this.sendEvent([e])}catch(e){this.logger.warn(e)}},this.createEvent=e=>{const{event:t="ERROR",type:r="",properties:{topic:n,trace:o}}=e,i=Ht$1(),a=this.core.projectId||"",s=Date.now(),c=Z$2({eventId:i,timestamp:s,props:{event:t,type:r,properties:{topic:n,trace:o}},bundleId:a,domain:this.getAppDomain()},this.setMethods(i));return this.telemetryEnabled&&(this.events.set(i,c),this.shouldPersist=!0),c},this.getEvent=e=>{const{eventId:t,topic:r}=e;if(t)return this.events.get(t);const n=Array.from(this.events.values()).find((e=>e.props.properties.topic===r));return n?Z$2(Z$2({},n),this.setMethods(n.eventId)):void 0},this.deleteEvent=e=>{const{eventId:t}=e;this.events.delete(t),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(r$6.pulse,(async()=>{this.shouldPersist&&await this.persist(),this.events.forEach((e=>{cjs$7.fromMiliseconds(Date.now())-cjs$7.fromMiliseconds(e.timestamp)>St&&(this.events.delete(e.eventId),this.shouldPersist=!0)}))}))},this.setMethods=e=>({addTrace:t=>this.addTrace(e,t),setError:t=>this.setError(e,t)}),this.addTrace=(e,t)=>{const r=this.events.get(e);r&&(r.props.properties.trace.push(t),this.events.set(e,r),this.shouldPersist=!0)},this.setError=(e,t)=>{const r=this.events.get(e);r&&(r.props.type=t,r.timestamp=Date.now(),this.events.set(e,r),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const e=await this.core.storage.getItem(this.storageKey)||[];if(!e.length)return;e.forEach((e=>{this.events.set(e.eventId,Z$2(Z$2({},e),this.setMethods(e.eventId)))}))}catch(e){this.logger.warn(e)}},this.submit=async()=>{if(!this.telemetryEnabled||0===this.events.size)return;const e=[];for(const[r,n]of this.events)n.props.type&&e.push(n);if(0!==e.length)try{if((await this.sendEvent(e)).ok)for(const t of e)this.events.delete(t.eventId),this.shouldPersist=!0}catch(t){this.logger.warn(t)}},this.sendEvent=async e=>{const t=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${Rt}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${se}${t}`,{method:"POST",body:JSON.stringify(e)})},this.getAppDomain=()=>Nt$1().url,this.logger=E$5(t,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 yn=Object.defineProperty,gi=Object.getOwnPropertySymbols,Dn=Object.prototype.hasOwnProperty,mn=Object.prototype.propertyIsEnumerable,yi=(e,t,r)=>t in e?yn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Di=(e,t)=>{for(var r in t||(t={}))Dn.call(t,r)&&yi(e,r,t[r]);if(gi)for(var r of gi(t))mn.call(t,r)&&yi(e,r,t[r]);return e};class ne extends n$7{constructor(e){var t;super(e),this.protocol=ye$1,this.version=De,this.name=ie,this.events=new eventsExports.EventEmitter,this.initialized=!1,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.dispatchEnvelope=({topic:e,message:t,sessionExists:r})=>{if(!e||!t)return;const n={topic:e,message:t,publishedAt:Date.now(),transportType:M$3.link_mode};this.relayer.onLinkMessageEvent(n,{sessionExists:r})},this.projectId=null==e?void 0:e.projectId,this.relayUrl=(null==e?void 0:e.relayUrl)||be$1,this.customStoragePrefix=null!=e&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const r=k$5({level:"string"==typeof(null==e?void 0:e.logger)&&e.logger?e.logger:Ye.logger}),{logger:n,chunkLoggerController:o}=A$5({opts:r,maxSizeInBytes:null==e?void 0:e.maxLogBlobSizeInBytes,loggerOverride:null==e?void 0:e.logger});this.logChunkController=o,null!=(t=this.logChunkController)&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var e,t;null!=(e=this.logChunkController)&&e.downloadLogsBlobInBrowser&&(null==(t=this.logChunkController)||t.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=E$5(n,this.name),this.heartbeat=new i$7,this.crypto=new Ht(this,this.logger,null==e?void 0:e.keychain),this.history=new ai(this,this.logger),this.expirer=new hi(this,this.logger),this.storage=null!=e&&e.storage?e.storage:new h$7(Di(Di({},Je),null==e?void 0:e.storageOptions)),this.relayer=new ti({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new oi(this,this.logger),this.verify=new ci(this,this.logger,this.storage),this.echoClient=new li(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new pi(this,this.logger,null==e?void 0:e.telemetryEnabled)}static async init(e){const t=new ne(e);await t.initialize();const r=await t.crypto.getClientId();return await t.storage.setItem(lt$1,r),t}get context(){return y$7(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return null==(e=this.logChunkController)?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(fe,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(fe)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e2){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e2),this.logger.error(e2.message),e2}}}const bn=ne,be="wc",Ce=2,Le="client",ye=`${be}@${Ce}:${Le}:`,we={name:Le,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},xe="WALLETCONNECT_DEEPLINK_CHOICE",st="proposal",it="Proposal expired",rt="session",z$4=cjs$7.SEVEN_DAYS,nt="engine",v$3={wc_sessionPropose:{req:{ttl:cjs$7.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:cjs$7.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:cjs$7.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:cjs$7.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:cjs$7.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:cjs$7.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1104},res:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1106},res:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:cjs$7.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:cjs$7.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:cjs$7.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:cjs$7.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1112},res:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1114},res:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:cjs$7.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:cjs$7.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:cjs$7.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:cjs$7.FIVE_MINUTES,prompt:!1,tag:1119}}},me={min:cjs$7.FIVE_MINUTES,max:cjs$7.SEVEN_DAYS},x$3={idle:"IDLE",active:"ACTIVE"},ot="request",at=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],ct="wc",lt="auth",pt$1="authKeys",ht="pairingTopics",dt="requests",oe=`${ct}@1.5:${lt}:`,ae=`${oe}:PUB_KEY`;var ys=Object.defineProperty,ws=Object.defineProperties,ms=Object.getOwnPropertyDescriptors,ut=Object.getOwnPropertySymbols,_s=Object.prototype.hasOwnProperty,Es=Object.prototype.propertyIsEnumerable,gt=(e,t,r)=>t in e?ys(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,I$3=(e,t)=>{for(var r in t||(t={}))_s.call(t,r)&>(e,r,t[r]);if(ut)for(var r of ut(t))Es.call(t,r)&>(e,r,t[r]);return e},D$4=(e,t)=>ws(e,ms(t));class Rs extends M$5{constructor(e){super(e),this.name=nt,this.events=new mi,this.initialized=!1,this.requestQueue={state:x$3.idle,queue:[]},this.sessionRequestQueue={state:x$3.idle,queue:[]},this.requestQueueDelay=cjs$7.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(v$3)}),this.initialized=!0,setTimeout((()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()}),cjs$7.toMiliseconds(this.requestQueueDelay)))},this.connect=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const t=D$4(I$3({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(t);const{pairingTopic:r,requiredNamespaces:n,optionalNamespaces:o,sessionProperties:i,relays:a}=t;let s,c=r,u=!1;try{c&&(u=this.client.core.pairing.pairings.get(c).active)}catch(b){throw this.client.logger.error(`connect() -> pairing.get(${c}) failed`),b}if(!c||!u){const{topic:e,uri:t}=await this.client.core.pairing.create();c=e,s=t}if(!c){const{message:e}=S$6("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw new Error(e)}const l=await this.client.core.crypto.generateKeyPair(),d=v$3.wc_sessionPropose.req.ttl||cjs$7.FIVE_MINUTES,f=Mt$1(d),h=I$3({requiredNamespaces:n,optionalNamespaces:o,relays:a??[{protocol:rt$1}],proposer:{publicKey:l,metadata:this.client.metadata},expiryTimestamp:f,pairingTopic:c},i&&{sessionProperties:i}),{reject:p,resolve:y,done:m}=_t$1(d,it);this.events.once(Lt$1("session_connect"),(async({error:e,session:t})=>{if(e)p(e);else if(t){t.self.publicKey=l;const e=D$4(I$3({},t),{pairingTopic:h.pairingTopic,requiredNamespaces:h.requiredNamespaces,optionalNamespaces:h.optionalNamespaces,transportType:M$3.relay});await this.client.session.set(t.topic,e),await this.setExpiry(t.topic,t.expiry),c&&await this.client.core.pairing.updateMetadata({topic:c,metadata:t.peer.metadata}),this.cleanupDuplicatePairings(e),y(e)}}));const g=await this.sendRequest({topic:c,method:"wc_sessionPropose",params:h,throwOnFailedPublish:!0});return await this.setProposal(g,I$3({id:g},h)),{uri:s,approval:m}},this.pair=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(t){throw this.client.logger.error("pair() failed"),t}},this.approve=async e=>{var t,r,n;const o=this.client.core.eventClient.createEvent({properties:{topic:null==(t=null==e?void 0:e.id)?void 0:t.toString(),trace:[Is$1.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(I){throw o.setError(Ts$1.no_internet_connection),I}try{await this.isValidProposalId(null==e?void 0:e.id)}catch(I){throw this.client.logger.error(`approve() -> proposal.get(${null==e?void 0:e.id}) failed`),o.setError(Ts$1.proposal_not_found),I}try{await this.isValidApprove(e)}catch(I){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(Ts$1.session_approve_namespace_validation_failure),I}const{id:i,relayProtocol:a,namespaces:s,sessionProperties:c,sessionConfig:u}=e,l=this.client.proposal.get(i);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:d,proposer:f,requiredNamespaces:h,optionalNamespaces:p}=l;let y=null==(r=this.client.core.eventClient)?void 0:r.getEvent({topic:d});y||(y=null==(n=this.client.core.eventClient)?void 0:n.createEvent({type:Is$1.session_approve_started,properties:{topic:d,trace:[Is$1.session_approve_started,Is$1.session_namespaces_validation_success]}}));const m=await this.client.core.crypto.generateKeyPair(),g=f.publicKey,b=await this.client.core.crypto.generateSharedKey(m,g),v=I$3(I$3({relay:{protocol:a??"irn"},namespaces:s,controller:{publicKey:m,metadata:this.client.metadata},expiry:Mt$1(z$4)},c&&{sessionProperties:c}),u&&{sessionConfig:u}),w=M$3.relay;y.addTrace(Is$1.subscribing_session_topic);try{await this.client.core.relayer.subscribe(b,{transportType:w})}catch(I){throw y.setError(Ts$1.subscribe_session_topic_failure),I}y.addTrace(Is$1.subscribe_session_topic_success);const _=D$4(I$3({},v),{topic:b,requiredNamespaces:h,optionalNamespaces:p,pairingTopic:d,acknowledged:!1,self:v.controller,peer:{publicKey:f.publicKey,metadata:f.metadata},controller:m,transportType:M$3.relay});await this.client.session.set(b,_),y.addTrace(Is$1.store_session);try{y.addTrace(Is$1.publishing_session_settle),await this.sendRequest({topic:b,method:"wc_sessionSettle",params:v,throwOnFailedPublish:!0}).catch((e=>{throw null==y||y.setError(Ts$1.session_settle_publish_failure),e})),y.addTrace(Is$1.session_settle_publish_success),y.addTrace(Is$1.publishing_session_approve),await this.sendResult({id:i,topic:d,result:{relay:{protocol:a??"irn"},responderPublicKey:m},throwOnFailedPublish:!0}).catch((e=>{throw null==y||y.setError(Ts$1.session_approve_publish_failure),e})),y.addTrace(Is$1.session_approve_publish_success)}catch(I){throw this.client.logger.error(I),this.client.session.delete(b,U$2("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(b),I}return this.client.core.eventClient.deleteEvent({eventId:y.eventId}),await this.client.core.pairing.updateMetadata({topic:d,metadata:f.metadata}),await this.client.proposal.delete(i,U$2("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:d}),await this.setExpiry(b,Mt$1(z$4)),{topic:b,acknowledged:()=>Promise.resolve(this.client.session.get(b))}},this.reject=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:t,reason:r}=e;let n;try{n=this.client.proposal.get(t).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${t}) failed`),o}n&&(await this.sendError({id:t,topic:n,error:r,rpcOpts:v$3.wc_sessionPropose.reject}),await this.client.proposal.delete(t,U$2("USER_DISCONNECTED")))},this.update=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(u){throw this.client.logger.error("update() -> isValidUpdate() failed"),u}const{topic:t,namespaces:r}=e,{done:n,resolve:o,reject:i}=_t$1(),a=payloadId(),s=getBigIntRpcId().toString(),c=this.client.session.get(t).namespaces;return this.events.once(Lt$1("session_update",a),(({error:e})=>{e?i(e):o()})),await this.client.session.update(t,{namespaces:r}),await this.sendRequest({topic:t,method:"wc_sessionUpdate",params:{namespaces:r},throwOnFailedPublish:!0,clientRpcId:a,relayRpcId:s}).catch((e=>{this.client.logger.error(e),this.client.session.update(t,{namespaces:c}),i(e)})),{acknowledged:n}},this.extend=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(a){throw this.client.logger.error("extend() -> isValidExtend() failed"),a}const{topic:t}=e,r=payloadId(),{done:n,resolve:o,reject:i}=_t$1();return this.events.once(Lt$1("session_extend",r),(({error:e})=>{e?i(e):o()})),await this.setExpiry(t,Mt$1(z$4)),this.sendRequest({topic:t,method:"wc_sessionExtend",params:{},clientRpcId:r,throwOnFailedPublish:!0}).catch((e=>{i(e)})),{acknowledged:n}},this.request=async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(f){throw this.client.logger.error("request() -> isValidRequest() failed"),f}const{chainId:t,request:r,topic:n,expiry:o=v$3.wc_sessionRequest.req.ttl}=e,i=this.client.session.get(n);(null==i?void 0:i.transportType)===M$3.relay&&await this.confirmOnlineStateOrThrow();const a=payloadId(),s=getBigIntRpcId().toString(),{done:c,resolve:u,reject:l}=_t$1(o,"Request expired. Please try again.");this.events.once(Lt$1("session_request",a),(({error:e,result:t})=>{e?l(e):u(t)}));const d=this.getAppLinkIfEnabled(i.peer.metadata,i.transportType);return d?(await this.sendRequest({clientRpcId:a,relayRpcId:s,topic:n,method:"wc_sessionRequest",params:{request:D$4(I$3({},r),{expiryTimestamp:Mt$1(o)}),chainId:t},expiry:o,throwOnFailedPublish:!0,appLink:d}).catch((e=>l(e))),this.client.events.emit("session_request_sent",{topic:n,request:r,chainId:t,id:a}),await c()):await Promise.all([new Promise((async e=>{await this.sendRequest({clientRpcId:a,relayRpcId:s,topic:n,method:"wc_sessionRequest",params:{request:D$4(I$3({},r),{expiryTimestamp:Mt$1(o)}),chainId:t},expiry:o,throwOnFailedPublish:!0}).catch((e=>l(e))),this.client.events.emit("session_request_sent",{topic:n,request:r,chainId:t,id:a}),e()})),new Promise((async e=>{var t;if(null==(t=i.sessionConfig)||!t.disableDeepLink){const e=await qt$1(this.client.core.storage,xe);await Ft$1({id:a,topic:n,wcDeepLink:e})}e()})),c()]).then((e=>e[2]))},this.respond=async e=>{this.isInitialized(),await this.isValidRespond(e);const{topic:t,response:r}=e,{id:n}=r,o=this.client.session.get(t);o.transportType===M$3.relay&&await this.confirmOnlineStateOrThrow();const i=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);isJsonRpcResult(r)?await this.sendResult({id:n,topic:t,result:r.result,throwOnFailedPublish:!0,appLink:i}):isJsonRpcError(r)&&await this.sendError({id:n,topic:t,error:r.error,appLink:i}),this.cleanupAfterResponse(e)},this.ping=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(r){throw this.client.logger.error("ping() -> isValidPing() failed"),r}const{topic:t}=e;if(this.client.session.keys.includes(t)){const e=payloadId(),r=getBigIntRpcId().toString(),{done:n,resolve:o,reject:i}=_t$1();this.events.once(Lt$1("session_ping",e),(({error:e})=>{e?i(e):o()})),await Promise.all([this.sendRequest({topic:t,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:e,relayRpcId:r}),n()])}else this.client.core.pairing.pairings.keys.includes(t)&&await this.client.core.pairing.ping({topic:t})},this.emit=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);const{topic:t,event:r,chainId:n}=e,o=getBigIntRpcId().toString();await this.sendRequest({topic:t,method:"wc_sessionEvent",params:{event:r,chainId:n},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);const{topic:t}=e;if(this.client.session.keys.includes(t))await this.sendRequest({topic:t,method:"wc_sessionDelete",params:U$2("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:t,emitEvent:!1});else{if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:e}=S$6("MISMATCHED_TOPIC",`Session or pairing topic not found: ${t}`);throw new Error(e)}await this.client.core.pairing.disconnect({topic:t})}},this.find=e=>(this.isInitialized(),this.client.session.getAll().filter((t=>zr$1(t,e)))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(e,t)=>{var r;this.isInitialized(),this.isValidAuthenticate(e);const n=t&&this.client.core.linkModeSupportedApps.includes(t)&&(null==(r=this.client.metadata.redirect)?void 0:r.linkMode),o=n?M$3.link_mode:M$3.relay;o===M$3.relay&&await this.confirmOnlineStateOrThrow();const{chains:i,statement:a="",uri:s,domain:c,nonce:u,type:l,exp:d,nbf:f,methods:h=[],expiry:p}=e,y=[...e.resources||[]],{topic:m,uri:g}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:m,uri:g}});const b=await this.client.core.crypto.generateKeyPair(),v=hr$1(b);if(await Promise.all([this.client.auth.authKeys.set(ae,{responseTopic:v,publicKey:b}),this.client.auth.pairingTopics.set(v,{topic:v,pairingTopic:m})]),await this.client.core.relayer.subscribe(v,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${m}`),h.length>0){const{namespace:e}=re$1(i[0]);let t=ir$1(e,"request",h);Y$1(y)&&(t=cr$1(t,y.pop())),y.push(t)}const w=p&&p>v$3.wc_sessionAuthenticate.req.ttl?p:v$3.wc_sessionAuthenticate.req.ttl,_={authPayload:{type:l??"caip122",chains:i,statement:a,aud:s,domain:c,version:"1",nonce:u,iat:(new Date).toISOString(),exp:d,nbf:f,resources:y},requester:{publicKey:b,metadata:this.client.metadata},expiryTimestamp:Mt$1(w)},I={requiredNamespaces:{},optionalNamespaces:{eip155:{chains:i,methods:[...new Set(["personal_sign",...h])],events:["chainChanged","accountsChanged"]}},relays:[{protocol:"irn"}],pairingTopic:m,proposer:{publicKey:b,metadata:this.client.metadata},expiryTimestamp:Mt$1(v$3.wc_sessionPropose.req.ttl)},{done:T,resolve:k,reject:$}=_t$1(w,"Request expired"),S=async({error:e,session:t})=>{if(this.events.off(Lt$1("session_request",E),A),e)$(e);else if(t){t.self.publicKey=b,await this.client.session.set(t.topic,t),await this.setExpiry(t.topic,t.expiry),m&&await this.client.core.pairing.updateMetadata({topic:m,metadata:t.peer.metadata});const e=this.client.session.get(t.topic);await this.deleteProposal(C),k({session:e})}},A=async e=>{var r,n,i;if(await this.deletePendingAuthRequest(E,{message:"fulfilled",code:0}),e.error){const t=U$2("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return e.error.code===t.code?void 0:(this.events.off(Lt$1("session_connect"),S),$(e.error.message))}await this.deleteProposal(C),this.events.off(Lt$1("session_connect"),S);const{cacaos:a,responder:s}=e.result,c=[],u=[];for(const t of a){await nr$1({cacao:t,projectId:this.client.core.projectId})||(this.client.logger.error(t,"Signature verification failed"),$(U$2("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:e}=t,r=Y$1(e.resources),n=[ln$1(e.iss)],o=fe$1(e.iss);if(r){const e=ar$1(r),t=ur$1(r);c.push(...e),n.push(...t)}for(const t of n)u.push(`${t}:${o}`)}const l=await this.client.core.crypto.generateSharedKey(b,s.publicKey);let d;c.length>0&&(d={topic:l,acknowledged:!0,self:{publicKey:b,metadata:this.client.metadata},peer:s,controller:s.publicKey,expiry:Mt$1(z$4),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:m,namespaces:Jr$1([...new Set(c)],[...new Set(u)]),transportType:o},await this.client.core.relayer.subscribe(l,{transportType:o}),await this.client.session.set(l,d),m&&await this.client.core.pairing.updateMetadata({topic:m,metadata:s.metadata}),d=this.client.session.get(l)),null!=(r=this.client.metadata.redirect)&&r.linkMode&&null!=(n=s.metadata.redirect)&&n.linkMode&&null!=(i=s.metadata.redirect)&&i.universal&&t&&(this.client.core.addLinkModeSupportedApp(s.metadata.redirect.universal),this.client.session.update(l,{transportType:M$3.link_mode})),k({auths:a,session:d})},E=payloadId(),C=payloadId();let R;this.events.once(Lt$1("session_connect"),S),this.events.once(Lt$1("session_request",E),A);try{if(n){const e=formatJsonRpcRequest("wc_sessionAuthenticate",_,E);this.client.core.history.set(m,e);const r=await this.client.core.crypto.encode("",e,{type:M$4,encoding:lr$1});R=xr$1(t,m,r)}else await Promise.all([this.sendRequest({topic:m,method:"wc_sessionAuthenticate",params:_,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:E}),this.sendRequest({topic:m,method:"wc_sessionPropose",params:I,expiry:v$3.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:C})])}catch(O){throw this.events.off(Lt$1("session_connect"),S),this.events.off(Lt$1("session_request",E),A),O}return await this.setProposal(C,I$3({id:C},I)),await this.setAuthRequest(E,{request:D$4(I$3({},_),{verifyContext:{}}),pairingTopic:m,transportType:o}),{uri:R??g,response:T}},this.approveSessionAuthenticate=async e=>{const{id:t,auths:r}=e,n=this.client.core.eventClient.createEvent({properties:{topic:t.toString(),trace:[Cs.authenticated_session_approve_started]}});try{this.isInitialized()}catch(p){throw n.setError(Ps.no_internet_connection),p}const o=this.getPendingAuthRequest(t);if(!o)throw n.setError(Ps.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${t}`);const i=o.transportType||M$3.relay;i===M$3.relay&&await this.confirmOnlineStateOrThrow();const a=o.requester.publicKey,s=await this.client.core.crypto.generateKeyPair(),c=hr$1(a),u={type:D$5,receiverPublicKey:a,senderPublicKey:s},l=[],d=[];for(const y of r){if(!(await nr$1({cacao:y,projectId:this.client.core.projectId}))){n.setError(Ps.invalid_cacao);const e=U$2("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:t,topic:c,error:e,encodeOpts:u}),new Error(e.message)}n.addTrace(Cs.cacaos_verified);const{p:e}=y,r=Y$1(e.resources),o=[ln$1(e.iss)],i=fe$1(e.iss);if(r){const e=ar$1(r),t=ur$1(r);l.push(...e),o.push(...t)}for(const t of o)d.push(`${t}:${i}`)}const f=await this.client.core.crypto.generateSharedKey(s,a);let h;if(n.addTrace(Cs.create_authenticated_session_topic),(null==l?void 0:l.length)>0){h={topic:f,acknowledged:!0,self:{publicKey:s,metadata:this.client.metadata},peer:{publicKey:a,metadata:o.requester.metadata},controller:a,expiry:Mt$1(z$4),authentication:r,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Jr$1([...new Set(l)],[...new Set(d)]),transportType:i},n.addTrace(Cs.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(f,{transportType:i})}catch(p){throw n.setError(Ps.subscribe_authenticated_session_topic_failure),p}n.addTrace(Cs.subscribe_authenticated_session_topic_success),await this.client.session.set(f,h),n.addTrace(Cs.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}n.addTrace(Cs.publishing_authenticated_session_approve);try{await this.sendResult({topic:c,id:t,result:{cacaos:r,responder:{publicKey:s,metadata:this.client.metadata}},encodeOpts:u,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,i)})}catch(p){throw n.setError(Ps.authenticated_session_approve_publish_failure),p}return await this.client.auth.requests.delete(t,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:n.eventId}),{session:h}},this.rejectSessionAuthenticate=async e=>{this.isInitialized();const{id:t,reason:r}=e,n=this.getPendingAuthRequest(t);if(!n)throw new Error(`Could not find pending auth request with id ${t}`);n.transportType===M$3.relay&&await this.confirmOnlineStateOrThrow();const o=n.requester.publicKey,i=await this.client.core.crypto.generateKeyPair(),a=hr$1(o),s={type:D$5,receiverPublicKey:o,senderPublicKey:i};await this.sendError({id:t,topic:a,error:r,encodeOpts:s,rpcOpts:v$3.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(n.requester.metadata,n.transportType)}),await this.client.auth.requests.delete(t,{message:"rejected",code:0}),await this.client.proposal.delete(t,U$2("USER_DISCONNECTED"))},this.formatAuthMessage=e=>{this.isInitialized();const{request:t,iss:r}=e;return dn$1(t,r)},this.processRelayMessageCache=()=>{setTimeout((async()=>{if(0!==this.relayMessageCache.length)for(;this.relayMessageCache.length>0;)try{const e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e2){this.client.logger.error(e2)}}),50)},this.cleanupDuplicatePairings=async e=>{if(e.pairingTopic)try{const t=this.client.core.pairing.pairings.get(e.pairingTopic),r=this.client.core.pairing.pairings.getAll().filter((r=>{var n,o;return(null==(n=r.peerMetadata)?void 0:n.url)&&(null==(o=r.peerMetadata)?void 0:o.url)===e.peer.metadata.url&&r.topic&&r.topic!==t.topic}));if(0===r.length)return;this.client.logger.info(`Cleaning up ${r.length} duplicate pairing(s)`),await Promise.all(r.map((e=>this.client.core.pairing.disconnect({topic:e.topic})))),this.client.logger.info("Duplicate pairings clean up finished")}catch(t){this.client.logger.error(t)}},this.deleteSession=async e=>{var t;const{topic:r,expirerHasDeleted:n=!1,emitEvent:o=!0,id:i=0}=e,{self:a}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await this.client.session.delete(r,U$2("USER_DISCONNECTED")),this.addToRecentlyDeleted(r,"session"),this.client.core.crypto.keychain.has(a.publicKey)&&await this.client.core.crypto.deleteKeyPair(a.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),n||this.client.core.expirer.del(r),this.client.core.storage.removeItem(xe).catch((e=>this.client.logger.warn(e))),this.getPendingSessionRequests().forEach((e=>{e.topic===r&&this.deletePendingSessionRequest(e.id,U$2("USER_DISCONNECTED"))})),r===(null==(t=this.sessionRequestQueue.queue[0])?void 0:t.topic)&&(this.sessionRequestQueue.state=x$3.idle),o&&this.client.events.emit("session_delete",{id:i,topic:r})},this.deleteProposal=async(e,t)=>{if(t)try{const t=this.client.proposal.get(e),r=this.client.core.eventClient.getEvent({topic:t.pairingTopic});null==r||r.setError(Ts$1.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,U$2("USER_DISCONNECTED")),t?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")},this.deletePendingSessionRequest=async(e,t,r=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter((t=>t.id!==e)),r&&(this.sessionRequestQueue.state=x$3.idle,this.client.events.emit("session_request_expire",{id:e}))},this.deletePendingAuthRequest=async(e,t,r=!1)=>{await Promise.all([this.client.auth.requests.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)])},this.setExpiry=async(e,t)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,t),await this.client.session.update(e,{expiry:t}))},this.setProposal=async(e,t)=>{this.client.core.expirer.set(e,Mt$1(v$3.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,t)},this.setAuthRequest=async(e,t)=>{const{request:r,pairingTopic:n,transportType:o=M$3.relay}=t;this.client.core.expirer.set(e,r.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:r.authPayload,requester:r.requester,expiryTimestamp:r.expiryTimestamp,id:e,pairingTopic:n,verifyContext:r.verifyContext,transportType:o})},this.setPendingSessionRequest=async e=>{const{id:t,topic:r,params:n,verifyContext:o}=e,i=n.request.expiryTimestamp||Mt$1(v$3.wc_sessionRequest.req.ttl);this.client.core.expirer.set(t,i),await this.client.pendingRequest.set(t,{id:t,topic:r,params:n,verifyContext:o})},this.sendRequest=async e=>{const{topic:t,method:r,params:n,expiry:o,relayRpcId:i,clientRpcId:a,throwOnFailedPublish:s,appLink:c}=e,u=formatJsonRpcRequest(r,n,a);let l;const d=!!c;try{const e=d?lr$1:ge;l=await this.client.core.crypto.encode(t,u,{encoding:e})}catch(p){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${t} failed`),p}let f;if(at.includes(r)){const e=yr$1(JSON.stringify(u)),t=yr$1(l);f=await this.client.core.verify.register({id:t,decryptedId:e})}const h=v$3[r].req;if(h.attestation=f,o&&(h.ttl=o),i&&(h.id=i),this.client.core.history.set(t,u),d){const e=xr$1(c,t,l);await global$1.Linking.openURL(e,this.client.name)}else{const e=v$3[r].req;o&&(e.ttl=o),i&&(e.id=i),s?(e.internal=D$4(I$3({},e.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(t,l,e)):this.client.core.relayer.publish(t,l,e).catch((e=>this.client.logger.error(e)))}return u.id},this.sendResult=async e=>{const{id:t,topic:r,result:n,throwOnFailedPublish:o,encodeOpts:i,appLink:a}=e,s=formatJsonRpcResult(t,n);let c;const u=a&&typeof(null==global$1?void 0:global$1.Linking)<"u";try{const e=u?lr$1:ge;c=await this.client.core.crypto.encode(r,s,D$4(I$3({},i||{}),{encoding:e}))}catch(d){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${r} failed`),d}let l;try{l=await this.client.core.history.get(r,t)}catch(d){throw this.client.logger.error(`sendResult() -> history.get(${r}, ${t}) failed`),d}if(u){const e=xr$1(a,r,c);await global$1.Linking.openURL(e,this.client.name)}else{const e=v$3[l.request.method].res;o?(e.internal=D$4(I$3({},e.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,c,e)):this.client.core.relayer.publish(r,c,e).catch((e=>this.client.logger.error(e)))}await this.client.core.history.resolve(s)},this.sendError=async e=>{const{id:t,topic:r,error:n,encodeOpts:o,rpcOpts:i,appLink:a}=e,s=formatJsonRpcError(t,n);let c;const u=a&&typeof(null==global$1?void 0:global$1.Linking)<"u";try{const e=u?lr$1:ge;c=await this.client.core.crypto.encode(r,s,D$4(I$3({},o||{}),{encoding:e}))}catch(d){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${r} failed`),d}let l;try{l=await this.client.core.history.get(r,t)}catch(d){throw this.client.logger.error(`sendError() -> history.get(${r}, ${t}) failed`),d}if(u){const e=xr$1(a,r,c);await global$1.Linking.openURL(e,this.client.name)}else{const e=i||v$3[l.request.method].res;this.client.core.relayer.publish(r,c,e)}await this.client.core.history.resolve(s)},this.cleanup=async()=>{const e=[],t=[];this.client.session.getAll().forEach((t=>{let r=!1;Kt$1(t.expiry)&&(r=!0),this.client.core.crypto.keychain.has(t.topic)||(r=!0),r&&e.push(t.topic)})),this.client.proposal.getAll().forEach((e=>{Kt$1(e.expiryTimestamp)&&t.push(e.id)})),await Promise.all([...e.map((e=>this.deleteSession({topic:e}))),...t.map((e=>this.deleteProposal(e)))])},this.onRelayEventRequest=async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state!==x$3.active){for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=x$3.active;const t=this.requestQueue.queue.shift();if(t)try{await this.processRequest(t)}catch(e){this.client.logger.warn(e)}}this.requestQueue.state=x$3.idle}else this.client.logger.info("Request queue already active, skipping...")},this.processRequest=async e=>{const{topic:t,payload:r,attestation:n,transportType:o,encryptedId:i}=e,a=r.method;if(!this.shouldIgnorePairingRequest({topic:t,requestMethod:a}))switch(a){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:t,payload:r,attestation:n,encryptedId:i});case"wc_sessionSettle":return await this.onSessionSettleRequest(t,r);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(t,r);case"wc_sessionExtend":return await this.onSessionExtendRequest(t,r);case"wc_sessionPing":return await this.onSessionPingRequest(t,r);case"wc_sessionDelete":return await this.onSessionDeleteRequest(t,r);case"wc_sessionRequest":return await this.onSessionRequest({topic:t,payload:r,attestation:n,encryptedId:i,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(t,r);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:t,payload:r,attestation:n,encryptedId:i,transportType:o});default:return this.client.logger.info(`Unsupported request method ${a}`)}},this.onRelayEventResponse=async e=>{const{topic:t,payload:r,transportType:n}=e,o=(await this.client.core.history.get(t,r.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(t,r,n);case"wc_sessionSettle":return this.onSessionSettleResponse(t,r);case"wc_sessionUpdate":return this.onSessionUpdateResponse(t,r);case"wc_sessionExtend":return this.onSessionExtendResponse(t,r);case"wc_sessionPing":return this.onSessionPingResponse(t,r);case"wc_sessionRequest":return this.onSessionRequestResponse(t,r);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(t,r);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=e=>{const{topic:t}=e,{message:r}=S$6("MISSING_OR_INVALID",`Decoded payload on topic ${t} is not identifiable as a JSON-RPC request or a response.`);throw new Error(r)},this.shouldIgnorePairingRequest=e=>{const{topic:t,requestMethod:r}=e,n=this.expectedPairingMethodMap.get(t);return!(!n||n.includes(r))&&!!(n.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async e=>{const{topic:t,payload:r,attestation:n,encryptedId:o}=e,{params:i,id:a}=r;try{const e=this.client.core.eventClient.getEvent({topic:t});this.isValidConnect(I$3({},r.params));const s=i.expiryTimestamp||Mt$1(v$3.wc_sessionPropose.req.ttl),c=I$3({id:a,pairingTopic:t,expiryTimestamp:s},i);await this.setProposal(a,c);const u=await this.getVerifyContext({attestationId:n,hash:yr$1(JSON.stringify(r)),encryptedId:o,metadata:c.proposer.metadata});0===this.client.events.listenerCount("session_proposal")&&(console.warn("No listener for session_proposal event"),null==e||e.setError($$3.proposal_listener_not_found)),null==e||e.addTrace(z$5.emit_session_proposal),this.client.events.emit("session_proposal",{id:a,params:c,verifyContext:u})}catch(s){await this.sendError({id:a,topic:t,error:s,rpcOpts:v$3.wc_sessionPropose.autoReject}),this.client.logger.error(s)}},this.onSessionProposeResponse=async(e,t,r)=>{const{id:n}=t;if(isJsonRpcResult(t)){const{result:o}=t;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const i=this.client.proposal.get(n);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:i});const a=i.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});const s=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:s});const c=await this.client.core.crypto.generateSharedKey(a,s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:c});const u=await this.client.core.relayer.subscribe(c,{transportType:r});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:u}),await this.client.core.pairing.activate({topic:e})}else if(isJsonRpcError(t)){await this.client.proposal.delete(n,U$2("USER_DISCONNECTED"));const e=Lt$1("session_connect");if(0===this.events.listenerCount(e))throw new Error(`emitting ${e} without any listeners, 954`);this.events.emit(Lt$1("session_connect"),{error:t.error})}},this.onSessionSettleRequest=async(e,t)=>{const{id:r,params:n}=t;try{this.isValidSessionSettleRequest(n);const{relay:r,controller:o,expiry:i,namespaces:a,sessionProperties:s,sessionConfig:c}=t.params,u=D$4(I$3(I$3({topic:e,relay:r,expiry:i,namespaces:a,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:o.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:o.publicKey,metadata:o.metadata}},s&&{sessionProperties:s}),c&&{sessionConfig:c}),{transportType:M$3.relay}),l=Lt$1("session_connect");if(0===this.events.listenerCount(l))throw new Error(`emitting ${l} without any listeners 997`);this.events.emit(Lt$1("session_connect"),{session:u}),await this.sendResult({id:t.id,topic:e,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:r,topic:e,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(e,t)=>{const{id:r}=t;isJsonRpcResult(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(Lt$1("session_approve",r),{})):isJsonRpcError(t)&&(await this.client.session.delete(e,U$2("USER_DISCONNECTED")),this.events.emit(Lt$1("session_approve",r),{error:t.error}))},this.onSessionUpdateRequest=async(e,t)=>{const{params:r,id:n}=t;try{const t=`${e}_session_update`,i=yo.get(t);if(i&&this.isRequestOutOfSync(i,n))return this.client.logger.info(`Discarding out of sync request - ${n}`),void this.sendError({id:n,topic:e,error:U$2("INVALID_UPDATE_REQUEST")});this.isValidUpdate(I$3({topic:e},r));try{yo.set(t,n),await this.client.session.update(e,{namespaces:r.namespaces}),await this.sendResult({id:n,topic:e,result:!0,throwOnFailedPublish:!0})}catch(o){throw yo.delete(t),o}this.client.events.emit("session_update",{id:n,topic:e,params:r})}catch(i){await this.sendError({id:n,topic:e,error:i}),this.client.logger.error(i)}},this.isRequestOutOfSync=(e,t)=>parseInt(t.toString().slice(0,-3))<=parseInt(e.toString().slice(0,-3)),this.onSessionUpdateResponse=(e,t)=>{const{id:r}=t,n=Lt$1("session_update",r);if(0===this.events.listenerCount(n))throw new Error(`emitting ${n} without any listeners`);isJsonRpcResult(t)?this.events.emit(Lt$1("session_update",r),{}):isJsonRpcError(t)&&this.events.emit(Lt$1("session_update",r),{error:t.error})},this.onSessionExtendRequest=async(e,t)=>{const{id:r}=t;try{this.isValidExtend({topic:e}),await this.setExpiry(e,Mt$1(z$4)),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:r,topic:e})}catch(n){await this.sendError({id:r,topic:e,error:n}),this.client.logger.error(n)}},this.onSessionExtendResponse=(e,t)=>{const{id:r}=t,n=Lt$1("session_extend",r);if(0===this.events.listenerCount(n))throw new Error(`emitting ${n} without any listeners`);isJsonRpcResult(t)?this.events.emit(Lt$1("session_extend",r),{}):isJsonRpcError(t)&&this.events.emit(Lt$1("session_extend",r),{error:t.error})},this.onSessionPingRequest=async(e,t)=>{const{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:r,topic:e})}catch(n){await this.sendError({id:r,topic:e,error:n}),this.client.logger.error(n)}},this.onSessionPingResponse=(e,t)=>{const{id:r}=t,n=Lt$1("session_ping",r);if(0===this.events.listenerCount(n))throw new Error(`emitting ${n} without any listeners`);setTimeout((()=>{isJsonRpcResult(t)?this.events.emit(Lt$1("session_ping",r),{}):isJsonRpcError(t)&&this.events.emit(Lt$1("session_ping",r),{error:t.error})}),500)},this.onSessionDeleteRequest=async(e,t)=>{const{id:r}=t;try{this.isValidDisconnect({topic:e,reason:t.params}),Promise.all([new Promise((t=>{this.client.core.relayer.once(v$4.publish,(async()=>{t(await this.deleteSession({topic:e,id:r}))}))})),this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:U$2("USER_DISCONNECTED")})]).catch((e=>this.client.logger.error(e)))}catch(n){this.client.logger.error(n)}},this.onSessionRequest=async e=>{var t,r,n;const{topic:o,payload:i,attestation:a,encryptedId:s,transportType:c}=e,{id:u,params:l}=i;try{await this.isValidRequest(I$3({topic:o},l));const e=this.client.session.get(o),i={id:u,topic:o,params:l,verifyContext:await this.getVerifyContext({attestationId:a,hash:yr$1(JSON.stringify(formatJsonRpcRequest("wc_sessionRequest",l,u))),encryptedId:s,metadata:e.peer.metadata,transportType:c})};await this.setPendingSessionRequest(i),c===M$3.link_mode&&null!=(t=e.peer.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(null==(r=e.peer.metadata.redirect)?void 0:r.universal),null!=(n=this.client.signConfig)&&n.disableRequestQueue?this.emitSessionRequest(i):(this.addSessionRequestToSessionRequestQueue(i),this.processSessionRequestQueue())}catch(d){await this.sendError({id:u,topic:o,error:d}),this.client.logger.error(d)}},this.onSessionRequestResponse=(e,t)=>{const{id:r}=t,n=Lt$1("session_request",r);if(0===this.events.listenerCount(n))throw new Error(`emitting ${n} without any listeners`);isJsonRpcResult(t)?this.events.emit(Lt$1("session_request",r),{result:t.result}):isJsonRpcError(t)&&this.events.emit(Lt$1("session_request",r),{error:t.error})},this.onSessionEventRequest=async(e,t)=>{const{id:r,params:n}=t;try{const t=`${e}_session_event_${n.event.name}`,o=yo.get(t);if(o&&this.isRequestOutOfSync(o,r))return void this.client.logger.info(`Discarding out of sync request - ${r}`);this.isValidEmit(I$3({topic:e},n)),this.client.events.emit("session_event",{id:r,topic:e,params:n}),yo.set(t,r)}catch(o){await this.sendError({id:r,topic:e,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(e,t)=>{const{id:r}=t;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:t}),isJsonRpcResult(t)?this.events.emit(Lt$1("session_request",r),{result:t.result}):isJsonRpcError(t)&&this.events.emit(Lt$1("session_request",r),{error:t.error})},this.onSessionAuthenticateRequest=async e=>{var t;const{topic:r,payload:n,attestation:o,encryptedId:i,transportType:a}=e;try{const{requester:e,authPayload:s,expiryTimestamp:c}=n.params,u=await this.getVerifyContext({attestationId:o,hash:yr$1(JSON.stringify(n)),encryptedId:i,metadata:e.metadata,transportType:a}),l={requester:e,pairingTopic:r,id:n.id,authPayload:s,verifyContext:u,expiryTimestamp:c};await this.setAuthRequest(n.id,{request:l,pairingTopic:r,transportType:a}),a===M$3.link_mode&&null!=(t=e.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(e.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:r,params:n.params,id:n.id,verifyContext:u})}catch(s){this.client.logger.error(s);const e=n.params.requester.publicKey,t=await this.client.core.crypto.generateKeyPair(),o=this.getAppLinkIfEnabled(n.params.requester.metadata,a),i={type:D$5,receiverPublicKey:e,senderPublicKey:t};await this.sendError({id:n.id,topic:r,error:s,encodeOpts:i,rpcOpts:v$3.wc_sessionAuthenticate.autoReject,appLink:o})}},this.addSessionRequestToSessionRequestQueue=e=>{this.sessionRequestQueue.queue.push(e)},this.cleanupAfterResponse=e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout((()=>{this.sessionRequestQueue.state=x$3.idle,this.processSessionRequestQueue()}),cjs$7.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:e,error:t})=>{const r=this.client.core.history.pending;r.length>0&&r.filter((t=>t.topic===e&&"wc_sessionRequest"===t.request.method)).forEach((e=>{const r=Lt$1("session_request",e.request.id);if(0===this.events.listenerCount(r))throw new Error(`emitting ${r} without any listeners`);this.events.emit(Lt$1("session_request",e.request.id),{error:t})}))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===x$3.active)return void this.client.logger.info("session request queue is already active.");const e=this.sessionRequestQueue.queue[0];if(e)try{this.sessionRequestQueue.state=x$3.active,this.emitSessionRequest(e)}catch(t){this.client.logger.error(t)}else this.client.logger.info("session request queue is empty.")},this.emitSessionRequest=e=>{this.client.events.emit("session_request",e)},this.onPairingCreated=e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const t=this.client.proposal.getAll().find((t=>t.pairingTopic===e.topic));t&&this.onSessionProposeRequest({topic:e.topic,payload:formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces,relays:t.relays,proposer:t.proposer,sessionProperties:t.sessionProperties},t.id)})},this.isValidConnect=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(t)}const{pairingTopic:t,requiredNamespaces:r,optionalNamespaces:n,sessionProperties:o,relays:i}=e;if(I$5(t)||await this.isValidPairingTopic(t),!eo(i)){const{message:e}=S$6("MISSING_OR_INVALID",`connect() relays: ${i}`);throw new Error(e)}!I$5(r)&&0!==Z$3(r)&&this.validateNamespaces(r,"requiredNamespaces"),!I$5(n)&&0!==Z$3(n)&&this.validateNamespaces(n,"optionalNamespaces"),I$5(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(e,t)=>{const r=Xr$1(e,"connect()",t);if(r)throw new Error(r.message)},this.isValidApprove=async e=>{if(!to(e))throw new Error(S$6("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:t,namespaces:r,relayProtocol:n,sessionProperties:o}=e;this.checkRecentlyDeleted(t),await this.isValidProposalId(t);const i=this.client.proposal.get(t),a=Wn(r,"approve()");if(a)throw new Error(a.message);const s=zn(i.requiredNamespaces,r,"approve()");if(s)throw new Error(s.message);if(!b$4(n,!0)){const{message:e}=S$6("MISSING_OR_INVALID",`approve() relayProtocol: ${n}`);throw new Error(e)}I$5(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(t)}const{id:t,reason:r}=e;if(this.checkRecentlyDeleted(t),await this.isValidProposalId(t),!ro(r)){const{message:e}=S$6("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(r)}`);throw new Error(e)}},this.isValidSessionSettleRequest=e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(t)}const{relay:t,controller:r,namespaces:n,expiry:o}=e;if(!Jn(t)){const{message:e}=S$6("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(e)}const i=Zr$1(r,"onSessionSettleRequest()");if(i)throw new Error(i.message);const a=Wn(n,"onSessionSettleRequest()");if(a)throw new Error(a.message);if(Kt$1(o)){const{message:e}=S$6("EXPIRED","onSessionSettleRequest()");throw new Error(e)}},this.isValidUpdate=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(t)}const{topic:t,namespaces:r}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);const n=this.client.session.get(t),o=Wn(r,"update()");if(o)throw new Error(o.message);const i=zn(n.requiredNamespaces,r,"update()");if(i)throw new Error(i.message)},this.isValidExtend=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(t)}const{topic:t}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t)},this.isValidRequest=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(t)}const{topic:t,request:r,chainId:n,expiry:o}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);const{namespaces:i}=this.client.session.get(t);if(!co(i,n)){const{message:e}=S$6("MISSING_OR_INVALID",`request() chainId: ${n}`);throw new Error(e)}if(!oo(r)){const{message:e}=S$6("MISSING_OR_INVALID",`request() ${JSON.stringify(r)}`);throw new Error(e)}if(!ao(i,n,r.method)){const{message:e}=S$6("MISSING_OR_INVALID",`request() method: ${r.method}`);throw new Error(e)}if(o&&!po(o,me)){const{message:e}=S$6("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${me.min} and ${me.max}`);throw new Error(e)}},this.isValidRespond=async e=>{var t;if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(t)}const{topic:r,response:n}=e;try{await this.isValidSessionTopic(r)}catch(o){throw null!=(t=null==e?void 0:e.response)&&t.id&&this.cleanupAfterResponse(e),o}if(!so(n)){const{message:e}=S$6("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(n)}`);throw new Error(e)}},this.isValidPing=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidEmit=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(t)}const{topic:t,event:r,chainId:n}=e;await this.isValidSessionTopic(t);const{namespaces:o}=this.client.session.get(t);if(!co(o,n)){const{message:e}=S$6("MISSING_OR_INVALID",`emit() chainId: ${n}`);throw new Error(e)}if(!io(r)){const{message:e}=S$6("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(e)}if(!uo(o,n,r.name)){const{message:e}=S$6("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(e)}},this.isValidDisconnect=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidAuthenticate=e=>{const{chains:t,uri:r,domain:n,nonce:o}=e;if(!Array.isArray(t)||0===t.length)throw new Error("chains is required and must be a non-empty array");if(!b$4(r,!1))throw new Error("uri is required parameter");if(!b$4(n,!1))throw new Error("domain is required parameter");if(!b$4(o,!1))throw new Error("nonce is required parameter");if([...new Set(t.map((e=>re$1(e).namespace)))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:i}=re$1(t[0]);if("eip155"!==i)throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async e=>{const{attestationId:t,hash:r,encryptedId:n,metadata:o,transportType:i}=e,a={verified:{verifyUrl:o.verifyUrl||J$1,validation:"UNKNOWN",origin:o.url||""}};try{if(i===M$3.link_mode){const e=this.getAppLinkIfEnabled(o,i);return a.verified.validation=e&&new URL(e).origin===new URL(o.url).origin?"VALID":"INVALID",a}const e=await this.client.core.verify.resolve({attestationId:t,hash:r,encryptedId:n,verifyUrl:o.verifyUrl});e&&(a.verified.origin=e.origin,a.verified.isScam=e.isScam,a.verified.validation=e.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(s){this.client.logger.warn(s)}return this.client.logger.debug(`Verify context: ${JSON.stringify(a)}`),a},this.validateSessionProps=(e,t)=>{Object.values(e).forEach((e=>{if(!b$4(e,!1)){const{message:r}=S$6("MISSING_OR_INVALID",`${t} must be in Record<string, string> format. Received: ${JSON.stringify(e)}`);throw new Error(r)}}))},this.getPendingAuthRequest=e=>{const t=this.client.auth.requests.get(e);return"object"==typeof t?t:void 0},this.addToRecentlyDeleted=(e,t)=>{if(this.recentlyDeletedMap.set(e,t),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let e=0;const t=this.recentlyDeletedLimit/2;for(const r of this.recentlyDeletedMap.keys()){if(e++>=t)break;this.recentlyDeletedMap.delete(r)}}},this.checkRecentlyDeleted=e=>{const t=this.recentlyDeletedMap.get(e);if(t){const{message:r}=S$6("MISSING_OR_INVALID",`Record was recently deleted - ${t}: ${e}`);throw new Error(r)}},this.isLinkModeEnabled=(e,t)=>{var r,n,o,i,a,s,c,u,l;return!(!e||t!==M$3.link_mode)&&(!0===(null==(n=null==(r=this.client.metadata)?void 0:r.redirect)?void 0:n.linkMode)&&void 0!==(null==(i=null==(o=this.client.metadata)?void 0:o.redirect)?void 0:i.universal)&&""!==(null==(s=null==(a=this.client.metadata)?void 0:a.redirect)?void 0:s.universal)&&void 0!==(null==(c=null==e?void 0:e.redirect)?void 0:c.universal)&&""!==(null==(u=null==e?void 0:e.redirect)?void 0:u.universal)&&!0===(null==(l=null==e?void 0:e.redirect)?void 0:l.linkMode)&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&typeof(null==global$1?void 0:global$1.Linking)<"u")},this.getAppLinkIfEnabled=(e,t)=>{var r;return this.isLinkModeEnabled(e,t)?null==(r=null==e?void 0:e.redirect)?void 0:r.universal:void 0},this.handleLinkModeMessage=({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;const t=Bt$1(e,"topic")||"",r=decodeURIComponent(Bt$1(e,"wc_ev")||""),n=this.client.session.keys.includes(t);n&&this.client.session.update(t,{transportType:M$3.link_mode}),this.client.core.dispatchEnvelope({topic:t,message:r,sessionExists:n})},this.registerLinkModeListeners=async()=>{var e;if(Wt$1()||_$5()&&null!=(e=this.client.metadata.redirect)&&e.linkMode){const e=null==global$1?void 0:global$1.Linking;if(typeof e<"u"){e.addEventListener("url",this.handleLinkModeMessage,this.client.name);const t=await e.getInitialURL();t&&setTimeout((()=>{this.handleLinkModeMessage({url:t})}),50)}}}}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(v$4.message,(e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)}))}async onRelayMessage(e){const{topic:t,message:r,attestation:n,transportType:o}=e,{publicKey:i}=this.client.auth.authKeys.keys.includes(ae)?this.client.auth.authKeys.get(ae):{responseTopic:void 0,publicKey:void 0},a=await this.client.core.crypto.decode(t,r,{receiverPublicKey:i,encoding:o===M$3.link_mode?lr$1:ge});try{isJsonRpcRequest(a)?(this.client.core.history.set(t,a),this.onRelayEventRequest({topic:t,payload:a,attestation:n,transportType:o,encryptedId:yr$1(r)})):isJsonRpcResponse(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:t,payload:a,transportType:o}),this.client.core.history.delete(t,a.id)):this.onRelayEventUnknownPayload({topic:t,payload:a,transportType:o})}catch(s){this.client.logger.error(s)}}registerExpirerEvents(){this.client.core.expirer.on(S$4.expired,(async e=>{const{topic:t,id:r}=Vt$1(e.target);return r&&this.client.pendingRequest.keys.includes(r)?await this.deletePendingSessionRequest(r,S$6("EXPIRED"),!0):r&&this.client.auth.requests.keys.includes(r)?await this.deletePendingAuthRequest(r,S$6("EXPIRED"),!0):void(t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r})))}))}registerPairingEvents(){this.client.core.pairing.events.on(V$2.create,(e=>this.onPairingCreated(e))),this.client.core.pairing.events.on(V$2.delete,(e=>{this.addToRecentlyDeleted(e.topic,"pairing")}))}isValidPairingTopic(e){if(!b$4(e,!1)){const{message:t}=S$6("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=S$6("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(Kt$1(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=S$6("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!b$4(e,!1)){const{message:t}=S$6("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:t}=S$6("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(Kt$1(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=S$6("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=S$6("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else{if(!this.client.core.pairing.pairings.keys.includes(e)){if(b$4(e,!1)){const{message:t}=S$6("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}{const{message:t}=S$6("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}this.isValidPairingTopic(e)}}async isValidProposalId(e){if(!no(e)){const{message:t}=S$6("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=S$6("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(Kt$1(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=S$6("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class Ss extends ni{constructor(e,t){super(e,t,st,ye),this.core=e,this.logger=t}}class yt extends ni{constructor(e,t){super(e,t,rt,ye),this.core=e,this.logger=t}}class Is extends ni{constructor(e,t){super(e,t,ot,ye,(e=>e.id)),this.core=e,this.logger=t}}class fs extends ni{constructor(e,t){super(e,t,pt$1,oe,(()=>ae)),this.core=e,this.logger=t}}class vs extends ni{constructor(e,t){super(e,t,ht,oe),this.core=e,this.logger=t}}class qs extends ni{constructor(e,t){super(e,t,dt,oe,(e=>e.id)),this.core=e,this.logger=t}}class Ts{constructor(e,t){this.core=e,this.logger=t,this.authKeys=new fs(this.core,this.logger),this.pairingTopics=new vs(this.core,this.logger),this.requests=new qs(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class _e extends S$7{constructor(e){super(e),this.protocol=be,this.version=Ce,this.name=we.name,this.events=new eventsExports.EventEmitter,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.removeAllListeners=e=>this.events.removeAllListeners(e),this.connect=async e=>{try{return await this.engine.connect(e)}catch(t){throw this.logger.error(t.message),t}},this.pair=async e=>{try{return await this.engine.pair(e)}catch(t){throw this.logger.error(t.message),t}},this.approve=async e=>{try{return await this.engine.approve(e)}catch(t){throw this.logger.error(t.message),t}},this.reject=async e=>{try{return await this.engine.reject(e)}catch(t){throw this.logger.error(t.message),t}},this.update=async e=>{try{return await this.engine.update(e)}catch(t){throw this.logger.error(t.message),t}},this.extend=async e=>{try{return await this.engine.extend(e)}catch(t){throw this.logger.error(t.message),t}},this.request=async e=>{try{return await this.engine.request(e)}catch(t){throw this.logger.error(t.message),t}},this.respond=async e=>{try{return await this.engine.respond(e)}catch(t){throw this.logger.error(t.message),t}},this.ping=async e=>{try{return await this.engine.ping(e)}catch(t){throw this.logger.error(t.message),t}},this.emit=async e=>{try{return await this.engine.emit(e)}catch(t){throw this.logger.error(t.message),t}},this.disconnect=async e=>{try{return await this.engine.disconnect(e)}catch(t){throw this.logger.error(t.message),t}},this.find=e=>{try{return this.engine.find(e)}catch(t){throw this.logger.error(t.message),t}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}},this.authenticate=async(e,t)=>{try{return await this.engine.authenticate(e,t)}catch(r){throw this.logger.error(r.message),r}},this.formatAuthMessage=e=>{try{return this.engine.formatAuthMessage(e)}catch(t){throw this.logger.error(t.message),t}},this.approveSessionAuthenticate=async e=>{try{return await this.engine.approveSessionAuthenticate(e)}catch(t){throw this.logger.error(t.message),t}},this.rejectSessionAuthenticate=async e=>{try{return await this.engine.rejectSessionAuthenticate(e)}catch(t){throw this.logger.error(t.message),t}},this.name=(null==e?void 0:e.name)||we.name,this.metadata=(null==e?void 0:e.metadata)||Nt$1(),this.signConfig=null==e?void 0:e.signConfig;const t=typeof(null==e?void 0:e.logger)<"u"&&"string"!=typeof(null==e?void 0:e.logger)?e.logger:_i(k$5({level:(null==e?void 0:e.logger)||we.logger}));this.core=(null==e?void 0:e.core)||new bn(e),this.logger=E$5(t,this.name),this.session=new yt(this.core,this.logger),this.proposal=new Ss(this.core,this.logger),this.pendingRequest=new Is(this.core,this.logger),this.engine=new Rs(this),this.auth=new Ts(this.core,this.logger)}static async init(e){const t=new _e(e);return await t.initialize(),t}get context(){return y$7(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var l$6={exports:{}},c$5="object"==typeof Reflect?Reflect:null,y$4=c$5&&"function"==typeof c$5.apply?c$5.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},f$3;function k$3(e){console&&console.warn&&console.warn(e)}f$3=c$5&&"function"==typeof c$5.ownKeys?c$5.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var w$4=Number.isNaN||function(e){return e!=e};function o$7(){o$7.init.call(this)}l$6.exports=o$7,l$6.exports.once=K$1,o$7.EventEmitter=o$7,o$7.prototype._events=void 0,o$7.prototype._eventsCount=0,o$7.prototype._maxListeners=void 0;var L$3=10;function g$3(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function _$4(e){return void 0===e._maxListeners?o$7.defaultMaxListeners:e._maxListeners}function S$3(e,t,r,n){var o,i,a;if(g$3(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),a=i[t]),void 0===a)a=i[t]=r,++e._eventsCount;else if("function"==typeof a?a=i[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(o=_$4(e))>0&&a.length>o&&!a.warned){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=a.length,k$3(s)}return e}function D$3(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function C$3(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=D$3.bind(n);return o.listener=r,n.wrapFn=o,o}function b$2(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?z$3(o):O$1(o,o.length)}function E$4(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function O$1(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function F$2(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function z$3(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function K$1(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,i),n(r)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}R$2(e,t,i,{once:!0}),"error"!==t&&U$1(e,o,{once:!0})}))}function U$1(e,t,r){"function"==typeof e.on&&R$2(e,"error",t,r)}function R$2(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(i){n.once&&e.removeEventListener(t,o),r(i)}))}}Object.defineProperty(o$7,"defaultMaxListeners",{enumerable:!0,get:function(){return L$3},set:function(e){if("number"!=typeof e||e<0||w$4(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");L$3=e}}),o$7.init=function(){(void 0===this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o$7.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||w$4(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},o$7.prototype.getMaxListeners=function(){return _$4(this)},o$7.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,o=this._events;if(void 0!==o)n=n&&void 0===o.error;else if(!n)return!1;if(n){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var a=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw a.context=i,a}var s=o[e];if(void 0===s)return!1;if("function"==typeof s)y$4(s,this,t);else{var c=s.length,u=O$1(s,c);for(r=0;r<c;++r)y$4(u[r],this,t)}return!0},o$7.prototype.addListener=function(e,t){return S$3(this,e,t,!1)},o$7.prototype.on=o$7.prototype.addListener,o$7.prototype.prependListener=function(e,t){return S$3(this,e,t,!0)},o$7.prototype.once=function(e,t){return g$3(t),this.on(e,C$3(this,e,t)),this},o$7.prototype.prependOnceListener=function(e,t){return g$3(t),this.prependListener(e,C$3(this,e,t)),this},o$7.prototype.removeListener=function(e,t){var r,n,o,i,a;if(g$3(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){a=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():F$2(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},o$7.prototype.off=o$7.prototype.removeListener,o$7.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o$7.prototype.listeners=function(e){return b$2(this,e,!0)},o$7.prototype.rawListeners=function(e){return b$2(this,e,!1)},o$7.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):E$4.call(e,t)},o$7.prototype.listenerCount=E$4,o$7.prototype.eventNames=function(){return this._eventsCount>0?f$3(this._events):[]};var cjs$2={};Object.defineProperty(cjs$2,"__esModule",{value:!0});var getWindowMetadata_1=cjs$2.getWindowMetadata=void 0;const window_getters_1=cjs$6;function getWindowMetadata(){let e,t;try{e=window_getters_1.getDocumentOrThrow(),t=window_getters_1.getLocationOrThrow()}catch(e2){return null}function r(...t){const r=e.getElementsByTagName("meta");for(let e=0;e<r.length;e++){const n=r[e],o=["itemprop","property","name"].map((e=>n.getAttribute(e))).filter((e=>!!e&&t.includes(e)));if(o.length&&o){const e=n.getAttribute("content");if(e)return e}}return""}const n=function(){let t=r("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}();return{description:r("description","og:description","twitter:description","keywords"),url:t.origin,icons:function(){const r=e.getElementsByTagName("link"),n=[];for(let e=0;e<r.length;e++){const o=r[e],i=o.getAttribute("rel");if(i&&i.toLowerCase().indexOf("icon")>-1){const e=o.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let r=t.protocol+"//"+t.host;if(0===e.indexOf("/"))r+=e;else{const n=t.pathname.split("/");n.pop();r+=n.join("/")+"/"+e}n.push(r)}else if(0===e.indexOf("//")){const r=t.protocol+e;n.push(r)}else n.push(e)}}return n}(),name:n}}getWindowMetadata_1=cjs$2.getWindowMetadata=getWindowMetadata;var cjs$1={};Object.defineProperty(cjs$1,"__esModule",{value:!0});var getLocalStorage_1=cjs$1.getLocalStorage=getLocalStorageOrThrow_1=cjs$1.getLocalStorageOrThrow=getCrypto_1=cjs$1.getCrypto=getCryptoOrThrow_1=cjs$1.getCryptoOrThrow=getLocation_1=cjs$1.getLocation=getLocationOrThrow_1=cjs$1.getLocationOrThrow=getNavigator_1=cjs$1.getNavigator=getNavigatorOrThrow_1=cjs$1.getNavigatorOrThrow=getDocument_1=cjs$1.getDocument=getDocumentOrThrow_1=cjs$1.getDocumentOrThrow=getFromWindowOrThrow_1=cjs$1.getFromWindowOrThrow=getFromWindow_1=cjs$1.getFromWindow=void 0;function getFromWindow$1(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}var getFromWindow_1=cjs$1.getFromWindow=getFromWindow$1;function getFromWindowOrThrow$1(e){const t=getFromWindow$1(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}var getFromWindowOrThrow_1=cjs$1.getFromWindowOrThrow=getFromWindowOrThrow$1;function getDocumentOrThrow$1(){return getFromWindowOrThrow$1("document")}var getDocumentOrThrow_1=cjs$1.getDocumentOrThrow=getDocumentOrThrow$1;function getDocument$1(){return getFromWindow$1("document")}var getDocument_1=cjs$1.getDocument=getDocument$1;function getNavigatorOrThrow$1(){return getFromWindowOrThrow$1("navigator")}var getNavigatorOrThrow_1=cjs$1.getNavigatorOrThrow=getNavigatorOrThrow$1;function getNavigator$1(){return getFromWindow$1("navigator")}var getNavigator_1=cjs$1.getNavigator=getNavigator$1;function getLocationOrThrow$1(){return getFromWindowOrThrow$1("location")}var getLocationOrThrow_1=cjs$1.getLocationOrThrow=getLocationOrThrow$1;function getLocation$1(){return getFromWindow$1("location")}var getLocation_1=cjs$1.getLocation=getLocation$1;function getCryptoOrThrow$1(){return getFromWindowOrThrow$1("crypto")}var getCryptoOrThrow_1=cjs$1.getCryptoOrThrow=getCryptoOrThrow$1;function getCrypto$1(){return getFromWindow$1("crypto")}var getCrypto_1=cjs$1.getCrypto=getCrypto$1;function getLocalStorageOrThrow$1(){return getFromWindowOrThrow$1("localStorage")}var getLocalStorageOrThrow_1=cjs$1.getLocalStorageOrThrow=getLocalStorageOrThrow$1;function getLocalStorage$1(){return getFromWindow$1("localStorage")}getLocalStorage_1=cjs$1.getLocalStorage=getLocalStorage$1;var __spreadArrays=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n},BrowserInfo=function(){return function(e,t,r){this.name=e,this.version=t,this.os=r,this.type="browser"}}(),NodeInfo=function(){return function(e){this.version=e,this.type="node",this.name="node",this.os=process$1.platform}}(),SearchBotDeviceInfo=function(){return function(e,t,r,n){this.name=e,this.version=t,this.os=r,this.bot=n,this.type="bot-device"}}(),BotInfo=function(){return function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}}(),ReactNativeInfo=function(){return function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}}(),SEARCHBOX_UA_REGEX=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,SEARCHBOT_OS_REGEX=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,REQUIRED_VERSION_PARTS=3,userAgentRules=[["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|$)/],["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",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",SEARCHBOX_UA_REGEX]],operatingSystemRules=[["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/],["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 detect(e){return e?parseUserAgent(e):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new ReactNativeInfo:"undefined"!=typeof navigator?parseUserAgent(navigator.userAgent):getNodeVersion()}function matchUserAgent(e){return""!==e&&userAgentRules.reduce((function(t,r){var n=r[0],o=r[1];if(t)return t;var i=o.exec(e);return!!i&&[n,i]}),!1)}function parseUserAgent(e){var t=matchUserAgent(e);if(!t)return null;var r=t[0],n=t[1];if("searchbot"===r)return new BotInfo;var o=n[1]&&n[1].split(/[._]/).slice(0,3);o?o.length<REQUIRED_VERSION_PARTS&&(o=__spreadArrays(o,createVersionParts(REQUIRED_VERSION_PARTS-o.length))):o=[];var i=o.join("."),a=detectOS$1(e),s=SEARCHBOT_OS_REGEX.exec(e);return s&&s[1]?new SearchBotDeviceInfo(r,i,a,s[1]):new BrowserInfo(r,i,a)}function detectOS$1(e){for(var t=0,r=operatingSystemRules.length;t<r;t++){var n=operatingSystemRules[t],o=n[0];if(n[1].exec(e))return o}return null}function getNodeVersion(){return void 0!==process$1&&process$1.version?new NodeInfo(process$1.version.slice(1)):null}function createVersionParts(e){for(var t=[],r=0;r<e;r++)t.push("0");return t}function detectEnv(e){return detect(e)}function detectOS(){const e=detectEnv();return e&&e.os?e.os:void 0}function isAndroid(){const e=detectOS();return!!e&&e.toLowerCase().includes("android")}function isIOS(){const e=detectOS();return!!e&&(e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1)}function isMobile$1(){return!!detectOS()&&(isAndroid()||isIOS())}function isNode$1(){const e=detectEnv();return!(!e||!e.name)&&"node"===e.name.toLowerCase()}function isBrowser(){return!isNode$1()&&!!getNavigator()}const getFromWindow=getFromWindow_1,getFromWindowOrThrow=getFromWindowOrThrow_1,getDocumentOrThrow=getDocumentOrThrow_1,getDocument=getDocument_1,getNavigatorOrThrow=getNavigatorOrThrow_1,getNavigator=getNavigator_1,getLocationOrThrow=getLocationOrThrow_1,getLocation=getLocation_1,getCryptoOrThrow=getCryptoOrThrow_1,getCrypto=getCrypto_1,getLocalStorageOrThrow=getLocalStorageOrThrow_1,getLocalStorage=getLocalStorage_1;function getClientMeta(){return getWindowMetadata_1()}function safeJsonParse$1(e){if("string"!=typeof e)throw new Error("Cannot safe json parse value of type "+typeof e);try{return JSON.parse(e)}catch(t){return e}}function safeJsonStringify$1(e){return"string"==typeof e?e:JSON.stringify(e)}const safeJsonParse=safeJsonParse$1,safeJsonStringify=safeJsonStringify$1;function setLocal(e,t){const r=safeJsonStringify(t),n=getLocalStorage();n&&n.setItem(e,r)}function getLocal(e){let t=null,r=null;const n=getLocalStorage();return n&&(r=n.getItem(e)),t=r?safeJsonParse(r):r,t}function removeLocal(e){const t=getLocalStorage();t&&t.removeItem(e)}const mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function formatIOSMobile(e,t){const r=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${r}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${r}`:""}function saveMobileLinkInfo(e){const t=e.href.split("?")[0];setLocal(mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}function getMobileRegistryEntry(e,t){return e.filter((e=>e.name.toLowerCase().includes(t.toLowerCase())))[0]}function getMobileLinkRegistry(e,t){let r=e;return t&&(r=t.map((t=>getMobileRegistryEntry(e,t))).filter(Boolean)),r}const API_URL="https://registry.walletconnect.com";function getWalletRegistryUrl(){return API_URL+"/api/v2/wallets"}function getDappRegistryUrl(){return API_URL+"/api/v2/dapps"}function formatMobileRegistryEntry(e,t="mobile"){var r;return{name:e.name||"",shortName:e.metadata.shortName||"",color:e.metadata.colors.primary||"",logo:null!==(r=e.image_url.sm)&&void 0!==r?r:"",universalLink:e[t].universal||"",deepLink:e[t].native||""}}function formatMobileRegistry(e,t="mobile"){return Object.values(e).filter((e=>!!e[t].universal||!!e[t].native)).map((e=>formatMobileRegistryEntry(e,t)))}const esm=Object.freeze(Object.defineProperty({__proto__:null,detectEnv:detectEnv,detectOS:detectOS,formatIOSMobile:formatIOSMobile,formatMobileRegistry:formatMobileRegistry,formatMobileRegistryEntry:formatMobileRegistryEntry,getClientMeta:getClientMeta,getCrypto:getCrypto,getCryptoOrThrow:getCryptoOrThrow,getDappRegistryUrl:getDappRegistryUrl,getDocument:getDocument,getDocumentOrThrow:getDocumentOrThrow,getFromWindow:getFromWindow,getFromWindowOrThrow:getFromWindowOrThrow,getLocal:getLocal,getLocalStorage:getLocalStorage,getLocalStorageOrThrow:getLocalStorageOrThrow,getLocation:getLocation,getLocationOrThrow:getLocationOrThrow,getMobileLinkRegistry:getMobileLinkRegistry,getMobileRegistryEntry:getMobileRegistryEntry,getNavigator:getNavigator,getNavigatorOrThrow:getNavigatorOrThrow,getWalletRegistryUrl:getWalletRegistryUrl,isAndroid:isAndroid,isBrowser:isBrowser,isIOS:isIOS,isMobile:isMobile$1,isNode:isNode$1,mobileLinkChoiceKey:mobileLinkChoiceKey,removeLocal:removeLocal,safeJsonParse:safeJsonParse,safeJsonStringify:safeJsonStringify,saveMobileLinkInfo:saveMobileLinkInfo,setLocal:setLocal},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(esm);var browser$1={},canPromise$3=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},qrcode$1={},typedarrayBuffer={},toString={}.toString,isarray=Array.isArray||function(e){return"[object Array]"==toString.call(e)},isArray$1=isarray;function typedArraySupport(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e2){return!1}}Buffer$1.TYPED_ARRAY_SUPPORT=typedArraySupport();var K_MAX_LENGTH=Buffer$1.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function Buffer$1(e,t,r){return Buffer$1.TYPED_ARRAY_SUPPORT||this instanceof Buffer$1?"number"==typeof e?allocUnsafe(this,e):from(this,e,t,r):new Buffer$1(e,t,r)}function checked(e){if(e>=K_MAX_LENGTH)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K_MAX_LENGTH.toString(16)+" bytes");return 0|e}function isnan(e){return e!=e}function createBuffer(e,t){var r;return Buffer$1.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(t)).__proto__=Buffer$1.prototype:(null===(r=e)&&(r=new Buffer$1(t)),r.length=t),r}function allocUnsafe(e,t){var r=createBuffer(e,t<0?0:0|checked(t));if(!Buffer$1.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)r[n]=0;return r}function fromString(e,t){var r=0|byteLength(t),n=createBuffer(e,r),o=n.write(t);return o!==r&&(n=n.slice(0,o)),n}function fromArrayLike(e,t){for(var r=t.length<0?0:0|checked(t.length),n=createBuffer(e,r),o=0;o<r;o+=1)n[o]=255&t[o];return n}function fromArrayBuffer(e,t,r,n){if(r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");var o;return o=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),Buffer$1.TYPED_ARRAY_SUPPORT?o.__proto__=Buffer$1.prototype:o=fromArrayLike(e,o),o}function fromObject(e,t){if(Buffer$1.isBuffer(t)){var r=0|checked(t.length),n=createBuffer(e,r);return 0===n.length||t.copy(n,0,0,r),n}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||isnan(t.length)?createBuffer(e,0):fromArrayLike(e,t);if("Buffer"===t.type&&Array.isArray(t.data))return fromArrayLike(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function utf8ToBytes(e,t){var r;t=t||1/0;for(var n=e.length,o=null,i=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function byteLength(e){return Buffer$1.isBuffer(e)?e.length:"undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)?e.byteLength:("string"!=typeof e&&(e=""+e),0===e.length?0:utf8ToBytes(e).length)}function blitBuffer(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function utf8Write(e,t,r,n){return blitBuffer(utf8ToBytes(t,e.length-r),e,r,n)}function from(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?fromArrayBuffer(e,t,r,n):"string"==typeof t?fromString(e,t):fromObject(e,t)}Buffer$1.TYPED_ARRAY_SUPPORT&&(Buffer$1.prototype.__proto__=Uint8Array.prototype,Buffer$1.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Buffer$1[Symbol.species]===Buffer$1&&Object.defineProperty(Buffer$1,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1})),Buffer$1.prototype.write=function(e,t,r){void 0===t||void 0===r&&"string"==typeof t?(r=this.length,t=0):isFinite(t)&&(t|=0,isFinite(r)?r|=0:r=void 0);var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");return utf8Write(this,e,t,r)},Buffer$1.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),Buffer$1.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=Buffer$1.prototype;else{var o=t-e;r=new Buffer$1(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+e]}return r},Buffer$1.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o,i=n-r;if(this===e&&r<t&&t<n)for(o=i-1;o>=0;--o)e[o+t]=this[o+r];else if(i<1e3||!Buffer$1.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+i),t);return i},Buffer$1.prototype.fill=function(e,t,r){if("string"==typeof e){if("string"==typeof t?(t=0,r=this.length):"string"==typeof r&&(r=this.length),1===e.length){var n=e.charCodeAt(0);n<256&&(e=n)}}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var i=Buffer$1.isBuffer(e)?e:new Buffer$1(e),a=i.length;for(o=0;o<r-t;++o)this[o+t]=i[o%a]}return this},Buffer$1.concat=function(e,t){if(!isArray$1(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return createBuffer(null,0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=allocUnsafe(null,t),o=0;for(r=0;r<e.length;++r){var i=e[r];if(!Buffer$1.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},Buffer$1.byteLength=byteLength,Buffer$1.prototype._isBuffer=!0,Buffer$1.isBuffer=function(e){return!(null==e||!e._isBuffer)},typedarrayBuffer.alloc=function(e){var t=new Buffer$1(e);return t.fill(0),t},typedarrayBuffer.from=function(e){return new Buffer$1(e)};var utils$3={},toSJISFunction$1,CODEWORDS_COUNT$1=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];utils$3.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},utils$3.getSymbolTotalCodewords=function(e){return CODEWORDS_COUNT$1[e]},utils$3.getBCHDigit=function(e){for(var t=0;0!==e;)t++,e>>>=1;return t},utils$3.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');toSJISFunction$1=e},utils$3.isKanjiModeEnabled=function(){return void 0!==toSJISFunction$1},utils$3.toSJIS=function(e){return toSJISFunction$1(e)};var errorCorrectionLevel$1={};function BitBuffer$3(){this.buffer=[],this.length=0}!function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2},e.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},e.from=function(t,r){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+t)}}(t)}catch(e2){return r}}}(errorCorrectionLevel$1),BitBuffer$3.prototype={get:function(e){var t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(var r=0;r<t;r++)this.putBit(1==(e>>>t-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var bitBuffer$1=BitBuffer$3,BufferUtil$4=typedarrayBuffer;function BitMatrix$3(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=BufferUtil$4.alloc(e*e),this.reservedBit=BufferUtil$4.alloc(e*e)}BitMatrix$3.prototype.set=function(e,t,r,n){var o=e*this.size+t;this.data[o]=r,n&&(this.reservedBit[o]=!0)},BitMatrix$3.prototype.get=function(e,t){return this.data[e*this.size+t]},BitMatrix$3.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r},BitMatrix$3.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var bitMatrix$1=BitMatrix$3,alignmentPattern$1={};!function(e){var t=utils$3.getSymbolSize;e.getRowColCoords=function(e){if(1===e)return[];for(var r=Math.floor(e/7)+2,n=t(e),o=145===n?26:2*Math.ceil((n-13)/(2*r-2)),i=[n-7],a=1;a<r-1;a++)i[a]=i[a-1]-o;return i.push(6),i.reverse()},e.getPositions=function(t){for(var r=[],n=e.getRowColCoords(t),o=n.length,i=0;i<o;i++)for(var a=0;a<o;a++)0===i&&0===a||0===i&&a===o-1||i===o-1&&0===a||r.push([n[i],n[a]]);return r}}(alignmentPattern$1);var finderPattern$1={},getSymbolSize$1=utils$3.getSymbolSize,FINDER_PATTERN_SIZE$1=7;finderPattern$1.getPositions=function(e){var t=getSymbolSize$1(e);return[[0,0],[t-FINDER_PATTERN_SIZE$1,0],[0,t-FINDER_PATTERN_SIZE$1]]};var maskPattern$1={};!function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t=3,r=3,n=40,o=10;function i(t,r,n){switch(t){case e.Patterns.PATTERN000:return(r+n)%2==0;case e.Patterns.PATTERN001:return r%2==0;case e.Patterns.PATTERN010:return n%3==0;case e.Patterns.PATTERN011:return(r+n)%3==0;case e.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(n/3))%2==0;case e.Patterns.PATTERN101:return r*n%2+r*n%3==0;case e.Patterns.PATTERN110:return(r*n%2+r*n%3)%2==0;case e.Patterns.PATTERN111:return(r*n%3+(r+n)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}}e.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){for(var r=e.size,n=0,o=0,i=0,a=null,s=null,c=0;c<r;c++){o=i=0,a=s=null;for(var u=0;u<r;u++){var l=e.get(c,u);l===a?o++:(o>=5&&(n+=t+(o-5)),a=l,o=1),(l=e.get(u,c))===s?i++:(i>=5&&(n+=t+(i-5)),s=l,i=1)}o>=5&&(n+=t+(o-5)),i>=5&&(n+=t+(i-5))}return n},e.getPenaltyN2=function(e){for(var t=e.size,n=0,o=0;o<t-1;o++)for(var i=0;i<t-1;i++){var a=e.get(o,i)+e.get(o,i+1)+e.get(o+1,i)+e.get(o+1,i+1);4!==a&&0!==a||n++}return n*r},e.getPenaltyN3=function(e){for(var t=e.size,r=0,o=0,i=0,a=0;a<t;a++){o=i=0;for(var s=0;s<t;s++)o=o<<1&2047|e.get(a,s),s>=10&&(1488===o||93===o)&&r++,i=i<<1&2047|e.get(s,a),s>=10&&(1488===i||93===i)&&r++}return r*n},e.getPenaltyN4=function(e){for(var t=0,r=e.data.length,n=0;n<r;n++)t+=e.data[n];return Math.abs(Math.ceil(100*t/r/5)-10)*o},e.applyMask=function(e,t){for(var r=t.size,n=0;n<r;n++)for(var o=0;o<r;o++)t.isReserved(o,n)||t.xor(o,n,i(e,o,n))},e.getBestMask=function(t,r){for(var n=Object.keys(e.Patterns).length,o=0,i=1/0,a=0;a<n;a++){r(a),e.applyMask(a,t);var s=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(a,t),s<i&&(i=s,o=a)}return o}}(maskPattern$1);var errorCorrectionCode$1={},ECLevel$3=errorCorrectionLevel$1,EC_BLOCKS_TABLE$1=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],EC_CODEWORDS_TABLE$1=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];errorCorrectionCode$1.getBlocksCount=function(e,t){switch(t){case ECLevel$3.L:return EC_BLOCKS_TABLE$1[4*(e-1)+0];case ECLevel$3.M:return EC_BLOCKS_TABLE$1[4*(e-1)+1];case ECLevel$3.Q:return EC_BLOCKS_TABLE$1[4*(e-1)+2];case ECLevel$3.H:return EC_BLOCKS_TABLE$1[4*(e-1)+3];default:return}},errorCorrectionCode$1.getTotalCodewordsCount=function(e,t){switch(t){case ECLevel$3.L:return EC_CODEWORDS_TABLE$1[4*(e-1)+0];case ECLevel$3.M:return EC_CODEWORDS_TABLE$1[4*(e-1)+1];case ECLevel$3.Q:return EC_CODEWORDS_TABLE$1[4*(e-1)+2];case ECLevel$3.H:return EC_CODEWORDS_TABLE$1[4*(e-1)+3];default:return}};var polynomial$1={},galoisField$1={},BufferUtil$3=typedarrayBuffer,EXP_TABLE$1=BufferUtil$3.alloc(512),LOG_TABLE$1=BufferUtil$3.alloc(256);!function(){for(var e=1,t=0;t<255;t++)EXP_TABLE$1[t]=e,LOG_TABLE$1[e]=t,256&(e<<=1)&&(e^=285);for(t=255;t<512;t++)EXP_TABLE$1[t]=EXP_TABLE$1[t-255]}(),galoisField$1.log=function(e){if(e<1)throw new Error("log("+e+")");return LOG_TABLE$1[e]},galoisField$1.exp=function(e){return EXP_TABLE$1[e]},galoisField$1.mul=function(e,t){return 0===e||0===t?0:EXP_TABLE$1[LOG_TABLE$1[e]+LOG_TABLE$1[t]]},function(e){var t=typedarrayBuffer,r=galoisField$1;e.mul=function(e,n){for(var o=t.alloc(e.length+n.length-1),i=0;i<e.length;i++)for(var a=0;a<n.length;a++)o[i+a]^=r.mul(e[i],n[a]);return o},e.mod=function(e,n){for(var o=t.from(e);o.length-n.length>=0;){for(var i=o[0],a=0;a<n.length;a++)o[a]^=r.mul(n[a],i);for(var s=0;s<o.length&&0===o[s];)s++;o=o.slice(s)}return o},e.generateECPolynomial=function(n){for(var o=t.from([1]),i=0;i<n;i++)o=e.mul(o,[1,r.exp(i)]);return o}}(polynomial$1);var BufferUtil$2=typedarrayBuffer,Polynomial$1=polynomial$1,Buffer=require$$2$1.Buffer;function ReedSolomonEncoder$3(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}ReedSolomonEncoder$3.prototype.initialize=function(e){this.degree=e,this.genPoly=Polynomial$1.generateECPolynomial(this.degree)},ReedSolomonEncoder$3.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");var t=BufferUtil$2.alloc(this.degree),r=Buffer.concat([e,t],e.length+this.degree),n=Polynomial$1.mod(r,this.genPoly),o=this.degree-n.length;if(o>0){var i=BufferUtil$2.alloc(this.degree);return n.copy(i,o),i}return n};var reedSolomonEncoder$1=ReedSolomonEncoder$3,version$1={},mode$1={},versionCheck$1={isValid:function(e){return!isNaN(e)&&e>=1&&e<=40}},regex$1={},numeric$1="[0-9]+",alphanumeric$1="[A-Z $%*+\\-./:]+",kanji$1="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";kanji$1=kanji$1.replace(/u/g,"\\u");var byte$1="(?:(?![A-Z0-9 $%*+\\-./:]|"+kanji$1+")(?:.|[\r\n]))+";regex$1.KANJI=new RegExp(kanji$1,"g"),regex$1.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),regex$1.BYTE=new RegExp(byte$1,"g"),regex$1.NUMERIC=new RegExp(numeric$1,"g"),regex$1.ALPHANUMERIC=new RegExp(alphanumeric$1,"g");var TEST_KANJI$1=new RegExp("^"+kanji$1+"$"),TEST_NUMERIC$1=new RegExp("^"+numeric$1+"$"),TEST_ALPHANUMERIC$1=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");regex$1.testKanji=function(e){return TEST_KANJI$1.test(e)},regex$1.testNumeric=function(e){return TEST_NUMERIC$1.test(e)},regex$1.testAlphanumeric=function(e){return TEST_ALPHANUMERIC$1.test(e)},function(e){var t=versionCheck$1,r=regex$1;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!t.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return r.testNumeric(t)?e.NUMERIC:r.testAlphanumeric(t)?e.ALPHANUMERIC:r.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},e.isValid=function(e){return e&&e.bit&&e.ccBits},e.from=function(t,r){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(e2){return r}}}(mode$1),function(e){var t=utils$3,r=errorCorrectionCode$1,n=errorCorrectionLevel$1,o=mode$1,i=versionCheck$1,a=isarray,s=t.getBCHDigit(7973);function c(e,t){return o.getCharCountIndicator(e,t)+4}function u(e,t){var r=0;return e.forEach((function(e){var n=c(e.mode,t);r+=n+e.getBitsLength()})),r}e.from=function(e,t){return i.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,n,a){if(!i.isValid(e))throw new Error("Invalid QR Code version");void 0===a&&(a=o.BYTE);var s=8*(t.getSymbolTotalCodewords(e)-r.getTotalCodewordsCount(e,n));if(a===o.MIXED)return s;var u=s-c(a,e);switch(a){case o.NUMERIC:return Math.floor(u/10*3);case o.ALPHANUMERIC:return Math.floor(u/11*2);case o.KANJI:return Math.floor(u/13);case o.BYTE:default:return Math.floor(u/8)}},e.getBestVersionForData=function(t,r){var i,s=n.from(r,n.M);if(a(t)){if(t.length>1)return function(t,r){for(var n=1;n<=40;n++)if(u(t,n)<=e.getCapacity(n,r,o.MIXED))return n}(t,s);if(0===t.length)return 1;i=t[0]}else i=t;return function(t,r,n){for(var o=1;o<=40;o++)if(r<=e.getCapacity(o,n,t))return o}(i.mode,i.getLength(),s)},e.getEncodedBits=function(e){if(!i.isValid(e)||e<7)throw new Error("Invalid QR Code version");for(var r=e<<12;t.getBCHDigit(r)-s>=0;)r^=7973<<t.getBCHDigit(r)-s;return e<<12|r}}(version$1);var formatInfo$1={},Utils$7=utils$3,G15$1=1335,G15_MASK$1=21522,G15_BCH$1=Utils$7.getBCHDigit(G15$1);formatInfo$1.getEncodedBits=function(e,t){for(var r=e.bit<<3|t,n=r<<10;Utils$7.getBCHDigit(n)-G15_BCH$1>=0;)n^=G15$1<<Utils$7.getBCHDigit(n)-G15_BCH$1;return(r<<10|n)^G15_MASK$1};var segments$1={},Mode$9=mode$1;function NumericData$1(e){this.mode=Mode$9.NUMERIC,this.data=e.toString()}NumericData$1.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},NumericData$1.prototype.getLength=function(){return this.data.length},NumericData$1.prototype.getBitsLength=function(){return NumericData$1.getBitsLength(this.data.length)},NumericData$1.prototype.write=function(e){var t,r,n;for(t=0;t+3<=this.data.length;t+=3)r=this.data.substr(t,3),n=parseInt(r,10),e.put(n,10);var o=this.data.length-t;o>0&&(r=this.data.substr(t),n=parseInt(r,10),e.put(n,3*o+1))};var numericData$1=NumericData$1,Mode$8=mode$1,ALPHA_NUM_CHARS$1=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function AlphanumericData$1(e){this.mode=Mode$8.ALPHANUMERIC,this.data=e}AlphanumericData$1.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},AlphanumericData$1.prototype.getLength=function(){return this.data.length},AlphanumericData$1.prototype.getBitsLength=function(){return AlphanumericData$1.getBitsLength(this.data.length)},AlphanumericData$1.prototype.write=function(e){var t;for(t=0;t+2<=this.data.length;t+=2){var r=45*ALPHA_NUM_CHARS$1.indexOf(this.data[t]);r+=ALPHA_NUM_CHARS$1.indexOf(this.data[t+1]),e.put(r,11)}this.data.length%2&&e.put(ALPHA_NUM_CHARS$1.indexOf(this.data[t]),6)};var alphanumericData$1=AlphanumericData$1,BufferUtil$1=typedarrayBuffer,Mode$7=mode$1;function ByteData$1(e){this.mode=Mode$7.BYTE,this.data=BufferUtil$1.from(e)}ByteData$1.getBitsLength=function(e){return 8*e},ByteData$1.prototype.getLength=function(){return this.data.length},ByteData$1.prototype.getBitsLength=function(){return ByteData$1.getBitsLength(this.data.length)},ByteData$1.prototype.write=function(e){for(var t=0,r=this.data.length;t<r;t++)e.put(this.data[t],8)};var byteData$1=ByteData$1,Mode$6=mode$1,Utils$6=utils$3;function KanjiData$1(e){this.mode=Mode$6.KANJI,this.data=e}KanjiData$1.getBitsLength=function(e){return 13*e},KanjiData$1.prototype.getLength=function(){return this.data.length},KanjiData$1.prototype.getBitsLength=function(){return KanjiData$1.getBitsLength(this.data.length)},KanjiData$1.prototype.write=function(e){var t;for(t=0;t<this.data.length;t++){var r=Utils$6.toSJIS(this.data[t]);if(r>=33088&&r<=40956)r-=33088;else{if(!(r>=57408&&r<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");r-=49472}r=192*(r>>>8&255)+(255&r),e.put(r,13)}};var kanjiData$1=KanjiData$1,dijkstra={exports:{}};!function(e){var t={single_source_shortest_paths:function(e,r,n){var o={},i={};i[r]=0;var a,s,c,u,l,d,f,h=t.PriorityQueue.make();for(h.push(r,0);!h.empty();)for(c in s=(a=h.pop()).value,u=a.cost,l=e[s]||{})l.hasOwnProperty(c)&&(d=u+l[c],f=i[c],(void 0===i[c]||f>d)&&(i[c]=d,h.push(c,d),o[c]=s));if(void 0!==n&&void 0===i[n]){var p=["Could not find a path from ",r," to ",n,"."].join("");throw new Error(p)}return o},extract_shortest_path_from_predecessor_list:function(e,t){for(var r=[],n=t;n;)r.push(n),e[n],n=e[n];return r.reverse(),r},find_path:function(e,r,n){var o=t.single_source_shortest_paths(e,r,n);return t.extract_shortest_path_from_predecessor_list(o,n)},PriorityQueue:{make:function(e){var r,n=t.PriorityQueue,o={};for(r in e=e||{},n)n.hasOwnProperty(r)&&(o[r]=n[r]);return o.queue=[],o.sorter=e.sorter||n.default_sorter,o},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var r={value:e,cost:t};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t}(dijkstra);var dijkstraExports=dijkstra.exports;!function(e){var t=mode$1,r=numericData$1,n=alphanumericData$1,o=byteData$1,i=kanjiData$1,a=regex$1,s=utils$3,c=dijkstraExports;function u(e){return unescape(encodeURIComponent(e)).length}function l(e,t,r){for(var n,o=[];null!==(n=e.exec(r));)o.push({data:n[0],index:n.index,mode:t,length:n[0].length});return o}function d(e){var r,n,o=l(a.NUMERIC,t.NUMERIC,e),i=l(a.ALPHANUMERIC,t.ALPHANUMERIC,e);return s.isKanjiModeEnabled()?(r=l(a.BYTE,t.BYTE,e),n=l(a.KANJI,t.KANJI,e)):(r=l(a.BYTE_KANJI,t.BYTE,e),n=[]),o.concat(i,r,n).sort((function(e,t){return e.index-t.index})).map((function(e){return{data:e.data,mode:e.mode,length:e.length}}))}function f(e,a){switch(a){case t.NUMERIC:return r.getBitsLength(e);case t.ALPHANUMERIC:return n.getBitsLength(e);case t.KANJI:return i.getBitsLength(e);case t.BYTE:return o.getBitsLength(e)}}function h(e,a){var c,u=t.getBestModeForData(e);if((c=t.from(a,u))!==t.BYTE&&c.bit<u.bit)throw new Error('"'+e+'" cannot be encoded with mode '+t.toString(c)+".\n Suggested mode is: "+t.toString(u));switch(c!==t.KANJI||s.isKanjiModeEnabled()||(c=t.BYTE),c){case t.NUMERIC:return new r(e);case t.ALPHANUMERIC:return new n(e);case t.KANJI:return new i(e);case t.BYTE:return new o(e)}}e.fromArray=function(e){return e.reduce((function(e,t){return"string"==typeof t?e.push(h(t,null)):t.data&&e.push(h(t.data,t.mode)),e}),[])},e.fromString=function(r,n){for(var o=function(e){for(var r=[],n=0;n<e.length;n++){var o=e[n];switch(o.mode){case t.NUMERIC:r.push([o,{data:o.data,mode:t.ALPHANUMERIC,length:o.length},{data:o.data,mode:t.BYTE,length:o.length}]);break;case t.ALPHANUMERIC:r.push([o,{data:o.data,mode:t.BYTE,length:o.length}]);break;case t.KANJI:r.push([o,{data:o.data,mode:t.BYTE,length:u(o.data)}]);break;case t.BYTE:r.push([{data:o.data,mode:t.BYTE,length:u(o.data)}])}}return r}(d(r,s.isKanjiModeEnabled())),i=function(e,r){for(var n={},o={start:{}},i=["start"],a=0;a<e.length;a++){for(var s=e[a],c=[],u=0;u<s.length;u++){var l=s[u],d=""+a+u;c.push(d),n[d]={node:l,lastCount:0},o[d]={};for(var h=0;h<i.length;h++){var p=i[h];n[p]&&n[p].node.mode===l.mode?(o[p][d]=f(n[p].lastCount+l.length,l.mode)-f(n[p].lastCount,l.mode),n[p].lastCount+=l.length):(n[p]&&(n[p].lastCount=l.length),o[p][d]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,r))}}i=c}for(h=0;h<i.length;h++)o[i[h]].end=0;return{map:o,table:n}}(o,n),a=c.find_path(i.map,"start","end"),l=[],h=1;h<a.length-1;h++)l.push(i.table[a[h]].node);return e.fromArray(function(e){return e.reduce((function(e,t){var r=e.length-1>=0?e[e.length-1]:null;return r&&r.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[])}(l))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}}(segments$1);var BufferUtil=typedarrayBuffer,Utils$5=utils$3,ECLevel$2=errorCorrectionLevel$1,BitBuffer$2=bitBuffer$1,BitMatrix$2=bitMatrix$1,AlignmentPattern$1=alignmentPattern$1,FinderPattern$1=finderPattern$1,MaskPattern$1=maskPattern$1,ECCode$1=errorCorrectionCode$1,ReedSolomonEncoder$2=reedSolomonEncoder$1,Version$1=version$1,FormatInfo$1=formatInfo$1,Mode$5=mode$1,Segments$1=segments$1,isArray=isarray;function setupFinderPattern$1(e,t){for(var r=e.size,n=FinderPattern$1.getPositions(t),o=0;o<n.length;o++)for(var i=n[o][0],a=n[o][1],s=-1;s<=7;s++)if(!(i+s<=-1||r<=i+s))for(var c=-1;c<=7;c++)a+c<=-1||r<=a+c||(s>=0&&s<=6&&(0===c||6===c)||c>=0&&c<=6&&(0===s||6===s)||s>=2&&s<=4&&c>=2&&c<=4?e.set(i+s,a+c,!0,!0):e.set(i+s,a+c,!1,!0))}function setupTimingPattern$1(e){for(var t=e.size,r=8;r<t-8;r++){var n=r%2==0;e.set(r,6,n,!0),e.set(6,r,n,!0)}}function setupAlignmentPattern$1(e,t){for(var r=AlignmentPattern$1.getPositions(t),n=0;n<r.length;n++)for(var o=r[n][0],i=r[n][1],a=-2;a<=2;a++)for(var s=-2;s<=2;s++)-2===a||2===a||-2===s||2===s||0===a&&0===s?e.set(o+a,i+s,!0,!0):e.set(o+a,i+s,!1,!0)}function setupVersionInfo$1(e,t){for(var r,n,o,i=e.size,a=Version$1.getEncodedBits(t),s=0;s<18;s++)r=Math.floor(s/3),n=s%3+i-8-3,o=1==(a>>s&1),e.set(r,n,o,!0),e.set(n,r,o,!0)}function setupFormatInfo$1(e,t,r){var n,o,i=e.size,a=FormatInfo$1.getEncodedBits(t,r);for(n=0;n<15;n++)o=1==(a>>n&1),n<6?e.set(n,8,o,!0):n<8?e.set(n+1,8,o,!0):e.set(i-15+n,8,o,!0),n<8?e.set(8,i-n-1,o,!0):n<9?e.set(8,15-n-1+1,o,!0):e.set(8,15-n-1,o,!0);e.set(i-8,8,1,!0)}function setupData$1(e,t){for(var r=e.size,n=-1,o=r-1,i=7,a=0,s=r-1;s>0;s-=2)for(6===s&&s--;;){for(var c=0;c<2;c++)if(!e.isReserved(o,s-c)){var u=!1;a<t.length&&(u=1==(t[a]>>>i&1)),e.set(o,s-c,u),-1===--i&&(a++,i=7)}if((o+=n)<0||r<=o){o-=n,n=-n;break}}}function createData$1(e,t,r){var n=new BitBuffer$2;r.forEach((function(t){n.put(t.mode.bit,4),n.put(t.getLength(),Mode$5.getCharCountIndicator(t.mode,e)),t.write(n)}));var o=8*(Utils$5.getSymbolTotalCodewords(e)-ECCode$1.getTotalCodewordsCount(e,t));for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(0);for(var i=(o-n.getLengthInBits())/8,a=0;a<i;a++)n.put(a%2?17:236,8);return createCodewords$1(n,e,t)}function createCodewords$1(e,t,r){for(var n=Utils$5.getSymbolTotalCodewords(t),o=n-ECCode$1.getTotalCodewordsCount(t,r),i=ECCode$1.getBlocksCount(t,r),a=i-n%i,s=Math.floor(n/i),c=Math.floor(o/i),u=c+1,l=s-c,d=new ReedSolomonEncoder$2(l),f=0,h=new Array(i),p=new Array(i),y=0,m=BufferUtil.from(e.buffer),g=0;g<i;g++){var b=g<a?c:u;h[g]=m.slice(f,f+b),p[g]=d.encode(h[g]),f+=b,y=Math.max(y,b)}var v,w,_=BufferUtil.alloc(n),I=0;for(v=0;v<y;v++)for(w=0;w<i;w++)v<h[w].length&&(_[I++]=h[w][v]);for(v=0;v<l;v++)for(w=0;w<i;w++)_[I++]=p[w][v];return _}function createSymbol$1(e,t,r,n){var o;if(isArray(e))o=Segments$1.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");var i=t;if(!i){var a=Segments$1.rawSplit(e);i=Version$1.getBestVersionForData(a,r)}o=Segments$1.fromString(e,i||40)}var s=Version$1.getBestVersionForData(o,r);if(!s)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<s)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+s+".\n")}else t=s;var c=createData$1(t,r,o),u=Utils$5.getSymbolSize(t),l=new BitMatrix$2(u);return setupFinderPattern$1(l,t),setupTimingPattern$1(l),setupAlignmentPattern$1(l,t),setupFormatInfo$1(l,r,0),t>=7&&setupVersionInfo$1(l,t),setupData$1(l,c),isNaN(n)&&(n=MaskPattern$1.getBestMask(l,setupFormatInfo$1.bind(null,l,r))),MaskPattern$1.applyMask(n,l),setupFormatInfo$1(l,r,n),{modules:l,version:t,errorCorrectionLevel:r,maskPattern:n,segments:o}}qrcode$1.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");var r,n,o=ECLevel$2.M;return void 0!==t&&(o=ECLevel$2.from(t.errorCorrectionLevel,ECLevel$2.M),r=Version$1.from(t.version),n=MaskPattern$1.from(t.maskPattern),t.toSJISFunc&&Utils$5.setToSJISFunction(t.toSJISFunc)),createSymbol$1(e,r,o,n)};var canvas$1={},utils$2={};!function(e){function t(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");var t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");var r=parseInt(t.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+t.slice(0,6).join("")}}e.getOptions=function(e){e||(e={}),e.color||(e.color={});var r=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,o=e.scale||4;return{width:n,scale:n?4:o,margin:r,color:{dark:t(e.color.dark||"#000000ff"),light:t(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},e.getImageWidth=function(t,r){var n=e.getScale(t,r);return Math.floor((t+2*r.margin)*n)},e.qrToImageData=function(t,r,n){for(var o=r.modules.size,i=r.modules.data,a=e.getScale(o,n),s=Math.floor((o+2*n.margin)*a),c=n.margin*a,u=[n.color.light,n.color.dark],l=0;l<s;l++)for(var d=0;d<s;d++){var f=4*(l*s+d),h=n.color.light;if(l>=c&&d>=c&&l<s-c&&d<s-c)h=u[i[Math.floor((l-c)/a)*o+Math.floor((d-c)/a)]?1:0];t[f++]=h.r,t[f++]=h.g,t[f++]=h.b,t[f]=h.a}}}(utils$2),function(e){var t=utils$2;e.render=function(e,r,n){var o=n,i=r;void 0!==o||r&&r.getContext||(o=r,r=void 0),r||(i=function(){try{return document.createElement("canvas")}catch(e2){throw new Error("You need to specify a canvas element")}}()),o=t.getOptions(o);var a=t.getImageWidth(e.modules.size,o),s=i.getContext("2d"),c=s.createImageData(a,a);return t.qrToImageData(c.data,e,o),function(e,t,r){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=r,t.width=r,t.style.height=r+"px",t.style.width=r+"px"}(s,i,a),s.putImageData(c,0,0),i},e.renderToDataURL=function(t,r,n){var o=n;void 0!==o||r&&r.getContext||(o=r,r=void 0),o||(o={});var i=e.render(t,r,o),a=o.type||"image/png",s=o.rendererOpts||{};return i.toDataURL(a,s.quality)}}(canvas$1);var svgTag$1={},Utils$4=utils$2;function getColorAttrib$1(e,t){var r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function svgCmd$1(e,t,r){var n=e+t;return void 0!==r&&(n+=" "+r),n}function qrToPath$1(e,t,r){for(var n="",o=0,i=!1,a=0,s=0;s<e.length;s++){var c=Math.floor(s%t),u=Math.floor(s/t);c||i||(i=!0),e[s]?(a++,s>0&&c>0&&e[s-1]||(n+=i?svgCmd$1("M",c+r,.5+u+r):svgCmd$1("m",o,0),o=0,i=!1),c+1<t&&e[s+1]||(n+=svgCmd$1("h",a),a=0)):o++}return n}svgTag$1.render=function(e,t,r){var n=Utils$4.getOptions(t),o=e.modules.size,i=e.modules.data,a=o+2*n.margin,s=n.color.light.a?"<path "+getColorAttrib$1(n.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",c="<path "+getColorAttrib$1(n.color.dark,"stroke")+' d="'+qrToPath$1(i,o,n.margin)+'"/>',u='viewBox="0 0 '+a+" "+a+'"',l='<svg xmlns="http://www.w3.org/2000/svg" '+(n.width?'width="'+n.width+'" height="'+n.width+'" ':"")+u+' shape-rendering="crispEdges">'+s+c+"</svg>\n";return"function"==typeof r&&r(null,l),l};var canPromise$2=canPromise$3,QRCode$2=qrcode$1,CanvasRenderer$1=canvas$1,SvgRenderer$1=svgTag$1;function renderCanvas$1(e,t,r,n,o){var i=[].slice.call(arguments,1),a=i.length,s="function"==typeof i[a-1];if(!s&&!canPromise$2())throw new Error("Callback required as last argument");if(!s){if(a<1)throw new Error("Too few arguments provided");return 1===a?(r=t,t=n=void 0):2!==a||t.getContext||(n=r,r=t,t=void 0),new Promise((function(o,i){try{var a=QRCode$2.create(r,n);o(e(a,t,n))}catch(e2){i(e2)}}))}if(a<2)throw new Error("Too few arguments provided");2===a?(o=r,r=t,t=n=void 0):3===a&&(t.getContext&&void 0===o?(o=n,n=void 0):(o=n,n=r,r=t,t=void 0));try{var c=QRCode$2.create(r,n);o(null,e(c,t,n))}catch(e2){o(e2)}}browser$1.create=QRCode$2.create,browser$1.toCanvas=renderCanvas$1.bind(null,CanvasRenderer$1.render),browser$1.toDataURL=renderCanvas$1.bind(null,CanvasRenderer$1.renderToDataURL),browser$1.toString=renderCanvas$1.bind(null,(function(e,t,r){return SvgRenderer$1.render(e,r)}));var toggleSelection=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n<e.rangeCount;n++)r.push(e.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||r.forEach((function(t){e.addRange(t)})),t&&t.focus()}},deselectCurrent=toggleSelection,clipboardToIE11Formatting={"text/plain":"Text","text/html":"Url",default:"Text"},defaultMessage="Copy to clipboard: #{key}, Enter";function format(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function copy$1(e,t){var r,n,o,i,a,s,c=!1;t||(t={}),r=t.debug||!1;try{if(o=deselectCurrent(),i=document.createRange(),a=document.getSelection(),(s=document.createElement("span")).textContent=e,s.ariaHidden="true",s.style.all="unset",s.style.position="fixed",s.style.top=0,s.style.clip="rect(0, 0, 0, 0)",s.style.whiteSpace="pre",s.style.webkitUserSelect="text",s.style.MozUserSelect="text",s.style.msUserSelect="text",s.style.userSelect="text",s.addEventListener("copy",(function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=clipboardToIE11Formatting[t.format]||clipboardToIE11Formatting.default;window.clipboardData.setData(o,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))})),document.body.appendChild(s),i.selectNodeContents(s),a.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");c=!0}catch(u){r&&console.error("unable to copy using execCommand: ",u),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(l){r&&console.error("unable to copy using clipboardData: ",l),r&&console.error("falling back to prompt"),n=format("message"in t?t.message:defaultMessage),window.prompt(n,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(i):a.removeAllRanges()),s&&document.body.removeChild(s),o()}return c}var copyToClipboard=copy$1,n$6,u$3,i$5,t$6,r$4,o$6,f$2,e$7={},c$4=[],s$6=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function a$3(e,t){for(var r in t)e[r]=t[r];return e}function v$2(e){var t=e.parentNode;t&&t.removeChild(e)}function h$4(e,t,r){var n,o=arguments,i={};for(n in t)"key"!==n&&"ref"!==n&&(i[n]=t[n]);if(arguments.length>3)for(r=[r],n=3;n<arguments.length;n++)r.push(o[n]);if(null!=r&&(i.children=r),"function"==typeof e&&null!=e.defaultProps)for(n in e.defaultProps)void 0===i[n]&&(i[n]=e.defaultProps[n]);return p$2(e,i,t&&t.key,t&&t.ref,null)}function p$2(e,t,r,n,o){var i={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o};return null==o&&(i.__v=i),n$6.vnode&&n$6.vnode(i),i}function y$3(){return{}}function d$3(e){return e.children}function m$2(e,t){this.props=e,this.context=t}function w$3(e,t){if(null==t)return e.__?w$3(e.__,e.__.__k.indexOf(e)+1):null;for(var r;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e)return r.__e;return"function"==typeof e.type?w$3(e):null}function k$2(e){var t,r;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e){e.__e=e.__c.base=r.__e;break}return k$2(e)}}function g$2(e){(!e.__d&&(e.__d=!0)&&u$3.push(e)&&!i$5++||r$4!==n$6.debounceRendering)&&((r$4=n$6.debounceRendering)||t$6)(_$3)}function _$3(){for(var e;i$5=u$3.length;)e=u$3.sort((function(e,t){return e.__v.__b-t.__v.__b})),u$3=[],e.some((function(e){var t,r,n,o,i,a,s;e.__d&&(a=(i=(t=e).__v).__e,(s=t.__P)&&(r=[],(n=a$3({},i)).__v=n,o=A$3(s,i,n,t.__n,void 0!==s.ownerSVGElement,null,r,null==a?w$3(i):a),T$3(r,i),o!=a&&k$2(i)))}))}function b$1(e,t,r,n,o,i,a,s,c){var u,l,d,f,h,p,y,m=r&&r.__k||c$4,g=m.length;if(s==e$7&&(s=null!=i?i[0]:g?w$3(r,0):null),u=0,t.__k=x$2(t.__k,(function(r){if(null!=r){if(r.__=t,r.__b=t.__b+1,null===(d=m[u])||d&&r.key==d.key&&r.type===d.type)m[u]=void 0;else for(l=0;l<g;l++){if((d=m[l])&&r.key==d.key&&r.type===d.type){m[l]=void 0;break}d=null}if(f=A$3(e,r,d=d||e$7,n,o,i,a,s,c),(l=r.ref)&&d.ref!=l&&(y||(y=[]),d.ref&&y.push(d.ref,null,r),y.push(l,r.__c||f,r)),null!=f){var b;if(null==p&&(p=f),void 0!==r.__d)b=r.__d,r.__d=void 0;else if(i==d||f!=s||null==f.parentNode){e:if(null==s||s.parentNode!==e)e.appendChild(f),b=null;else{for(h=s,l=0;(h=h.nextSibling)&&l<g;l+=2)if(h==f)break e;e.insertBefore(f,s),b=s}"option"==t.type&&(e.value="")}s=void 0!==b?b:f.nextSibling,"function"==typeof t.type&&(t.__d=s)}else s&&d.__e==s&&s.parentNode!=e&&(s=w$3(d))}return u++,r})),t.__e=p,null!=i&&"function"!=typeof t.type)for(u=i.length;u--;)null!=i[u]&&v$2(i[u]);for(u=g;u--;)null!=m[u]&&D$2(m[u],m[u]);if(y)for(u=0;u<y.length;u++)j$1(y[u],y[++u],y[++u])}function x$2(e,t,r){if(null==r&&(r=[]),null==e||"boolean"==typeof e)t&&r.push(t(null));else if(Array.isArray(e))for(var n=0;n<e.length;n++)x$2(e[n],t,r);else r.push(t?t("string"==typeof e||"number"==typeof e?p$2(null,e,null,null,e):null!=e.__e||null!=e.__c?p$2(e.type,e.props,e.key,null,e.__v):e):e);return r}function P$2(e,t,r,n,o){var i;for(i in r)"children"===i||"key"===i||i in t||N$2(e,i,null,r[i],n);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||r[i]===t[i]||N$2(e,i,t[i],r[i],n)}function C$2(e,t,r){"-"===t[0]?e.setProperty(t,r):e[t]="number"==typeof r&&!1===s$6.test(t)?r+"px":null==r?"":r}function N$2(e,t,r,n,o){var i,a,s,c,u;if(o?"className"===t&&(t="class"):"class"===t&&(t="className"),"style"===t)if(i=e.style,"string"==typeof r)i.cssText=r;else{if("string"==typeof n&&(i.cssText="",n=null),n)for(c in n)r&&c in r||C$2(i,c,"");if(r)for(u in r)n&&r[u]===n[u]||C$2(i,u,r[u])}else"o"===t[0]&&"n"===t[1]?(a=t!==(t=t.replace(/Capture$/,"")),s=t.toLowerCase(),t=(s in e?s:t).slice(2),r?(n||e.addEventListener(t,z$2,a),(e.l||(e.l={}))[t]=r):e.removeEventListener(t,z$2,a)):"list"!==t&&"tagName"!==t&&"form"!==t&&"type"!==t&&"size"!==t&&!o&&t in e?e[t]=null==r?"":r:"function"!=typeof r&&"dangerouslySetInnerHTML"!==t&&(t!==(t=t.replace(/^xlink:?/,""))?null==r||!1===r?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),r):null==r||!1===r&&!/^ar/.test(t)?e.removeAttribute(t):e.setAttribute(t,r))}function z$2(e){this.l[e.type](n$6.event?n$6.event(e):e)}function A$3(e,t,r,n,o,i,a,s,c){var u,l,d,f,h,p,y,m,g,b,v=t.type;if(void 0!==t.constructor)return null;(u=n$6.__b)&&u(t);try{e:if("function"==typeof v){if(m=t.props,g=(u=v.contextType)&&n[u.__c],b=u?g?g.props.value:u.__:n,r.__c?y=(l=t.__c=r.__c).__=l.__E:("prototype"in v&&v.prototype.render?t.__c=l=new v(m,b):(t.__c=l=new m$2(m,b),l.constructor=v,l.render=E$3),g&&g.sub(l),l.props=m,l.state||(l.state={}),l.context=b,l.__n=n,d=l.__d=!0,l.__h=[]),null==l.__s&&(l.__s=l.state),null!=v.getDerivedStateFromProps&&(l.__s==l.state&&(l.__s=a$3({},l.__s)),a$3(l.__s,v.getDerivedStateFromProps(m,l.__s))),f=l.props,h=l.state,d)null==v.getDerivedStateFromProps&&null!=l.componentWillMount&&l.componentWillMount(),null!=l.componentDidMount&&l.__h.push(l.componentDidMount);else{if(null==v.getDerivedStateFromProps&&m!==f&&null!=l.componentWillReceiveProps&&l.componentWillReceiveProps(m,b),!l.__e&&null!=l.shouldComponentUpdate&&!1===l.shouldComponentUpdate(m,l.__s,b)||t.__v===r.__v&&!l.__){for(l.props=m,l.state=l.__s,t.__v!==r.__v&&(l.__d=!1),l.__v=t,t.__e=r.__e,t.__k=r.__k,l.__h.length&&a.push(l),u=0;u<t.__k.length;u++)t.__k[u]&&(t.__k[u].__=t);break e}null!=l.componentWillUpdate&&l.componentWillUpdate(m,l.__s,b),null!=l.componentDidUpdate&&l.__h.push((function(){l.componentDidUpdate(f,h,p)}))}l.context=b,l.props=m,l.state=l.__s,(u=n$6.__r)&&u(t),l.__d=!1,l.__v=t,l.__P=e,u=l.render(l.props,l.state,l.context),t.__k=null!=u&&u.type==d$3&&null==u.key?u.props.children:Array.isArray(u)?u:[u],null!=l.getChildContext&&(n=a$3(a$3({},n),l.getChildContext())),d||null==l.getSnapshotBeforeUpdate||(p=l.getSnapshotBeforeUpdate(f,h)),b$1(e,t,r,n,o,i,a,s,c),l.base=t.__e,l.__h.length&&a.push(l),y&&(l.__E=l.__=null),l.__e=!1}else null==i&&t.__v===r.__v?(t.__k=r.__k,t.__e=r.__e):t.__e=$$2(r.__e,t,r,n,o,i,a,c);(u=n$6.diffed)&&u(t)}catch(w){t.__v=null,n$6.__e(w,t,r)}return t.__e}function T$3(e,t){n$6.__c&&n$6.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(r){n$6.__e(r,t.__v)}}))}function $$2(e,t,r,n,o,i,a,s){var c,u,l,d,f,h=r.props,p=t.props;if(o="svg"===t.type||o,null!=i)for(c=0;c<i.length;c++)if(null!=(u=i[c])&&((null===t.type?3===u.nodeType:u.localName===t.type)||e==u)){e=u,i[c]=null;break}if(null==e){if(null===t.type)return document.createTextNode(p);e=o?document.createElementNS("http://www.w3.org/2000/svg",t.type):document.createElement(t.type,p.is&&{is:p.is}),i=null,s=!1}if(null===t.type)h!==p&&e.data!=p&&(e.data=p);else{if(null!=i&&(i=c$4.slice.call(e.childNodes)),l=(h=r.props||e$7).dangerouslySetInnerHTML,d=p.dangerouslySetInnerHTML,!s){if(h===e$7)for(h={},f=0;f<e.attributes.length;f++)h[e.attributes[f].name]=e.attributes[f].value;(d||l)&&(d&&l&&d.__html==l.__html||(e.innerHTML=d&&d.__html||""))}P$2(e,p,h,o,s),d?t.__k=[]:(t.__k=t.props.children,b$1(e,t,r,n,"foreignObject"!==t.type&&o,i,a,e$7,s)),s||("value"in p&&void 0!==(c=p.value)&&c!==e.value&&N$2(e,"value",c,h.value,!1),"checked"in p&&void 0!==(c=p.checked)&&c!==e.checked&&N$2(e,"checked",c,h.checked,!1))}return e}function j$1(e,t,r){try{"function"==typeof e?e(t):e.current=t}catch(n){n$6.__e(n,r)}}function D$2(e,t,r){var n,o,i;if(n$6.unmount&&n$6.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||j$1(n,null,t)),r||"function"==typeof e.type||(r=null!=(o=e.__e)),e.__e=e.__d=void 0,null!=(n=e.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(a){n$6.__e(a,t)}n.base=n.__P=null}if(n=e.__k)for(i=0;i<n.length;i++)n[i]&&D$2(n[i],t,r);null!=o&&v$2(o)}function E$3(e,t,r){return this.constructor(e,r)}function H$2(e,t,r){var n,o,i;n$6.__&&n$6.__(e,t),o=(n=r===o$6)?null:r&&r.__k||t.__k,e=h$4(d$3,null,[e]),i=[],A$3(t,(n?t:r||t).__k=e,o||e$7,e$7,void 0!==t.ownerSVGElement,r&&!n?[r]:o?null:c$4.slice.call(t.childNodes),i,r||e$7,n),T$3(i,e)}function I$2(e,t){H$2(e,t,o$6)}function L$2(e,t){var r,n;for(n in t=a$3(a$3({},e.props),t),arguments.length>2&&(t.children=c$4.slice.call(arguments,2)),r={},t)"key"!==n&&"ref"!==n&&(r[n]=t[n]);return p$2(e.type,r,t.key||e.key,t.ref||e.ref,null)}function M$2(e){var t={},r={__c:"__cC"+f$2++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,o=this;return this.getChildContext||(n=[],this.getChildContext=function(){return t[r.__c]=o,t},this.shouldComponentUpdate=function(e){o.props.value!==e.value&&n.some((function(t){t.context=e.value,g$2(t)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return r.Consumer.contextType=r,r.Provider.__=r,r}n$6={__e:function(e,t){for(var r,n;t=t.__;)if((r=t.__c)&&!r.__)try{if(r.constructor&&null!=r.constructor.getDerivedStateFromError&&(n=!0,r.setState(r.constructor.getDerivedStateFromError(e))),null!=r.componentDidCatch&&(n=!0,r.componentDidCatch(e)),n)return g$2(r.__E=r)}catch(o){e=o}throw e}},m$2.prototype.setState=function(e,t){var r;r=this.__s!==this.state?this.__s:this.__s=a$3({},this.state),"function"==typeof e&&(e=e(r,this.props)),e&&a$3(r,e),null!=e&&this.__v&&(t&&this.__h.push(t),g$2(this))},m$2.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),g$2(this))},m$2.prototype.render=d$3,u$3=[],i$5=0,t$6="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,o$6=e$7,f$2=0;var t$5,u$2,r$3,i$4=0,o$5=[],c$3=n$6.__r,f$1=n$6.diffed,e$6=n$6.__c,a$2=n$6.unmount;function v$1(e,t){n$6.__h&&n$6.__h(u$2,e,i$4||t),i$4=0;var r=u$2.__H||(u$2.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function m$1(e){return i$4=1,p$1(E$2,e)}function p$1(e,t,r){var n=v$1(t$5++,2);return n.__c||(n.__c=u$2,n.__=[r?r(t):E$2(void 0,t),function(t){var r=e(n.__[0],t);n.__[0]!==r&&(n.__[0]=r,n.__c.setState({}))}]),n.__}function l$5(e,t){var r=v$1(t$5++,3);!n$6.__s&&x$1(r.__H,t)&&(r.__=e,r.__H=t,u$2.__H.__h.push(r))}function y$2(e,t){var r=v$1(t$5++,4);!n$6.__s&&x$1(r.__H,t)&&(r.__=e,r.__H=t,u$2.__h.push(r))}function d$2(e){return i$4=5,h$3((function(){return{current:e}}),[])}function s$5(e,t,r){i$4=6,y$2((function(){"function"==typeof e?e(t()):e&&(e.current=t())}),null==r?r:r.concat(e))}function h$3(e,t){var r=v$1(t$5++,7);return x$1(r.__H,t)?(r.__H=t,r.__h=e,r.__=e()):r.__}function T$2(e,t){return i$4=8,h$3((function(){return e}),t)}function w$2(e){var t=u$2.context[e.__c],r=v$1(t$5++,9);return r.__c=e,t?(null==r.__&&(r.__=!0,t.sub(u$2)),t.props.value):e.__}function A$2(e,t){n$6.useDebugValue&&n$6.useDebugValue(t?t(e):e)}function F$1(e){var t=v$1(t$5++,10),r=m$1();return t.__=e,u$2.componentDidCatch||(u$2.componentDidCatch=function(e){t.__&&t.__(e),r[1](e)}),[r[0],function(){r[1](void 0)}]}function _$2(){o$5.some((function(e){if(e.__P)try{e.__H.__h.forEach(g$1),e.__H.__h.forEach(q$1),e.__H.__h=[]}catch(t){return e.__H.__h=[],n$6.__e(t,e.__v),!0}})),o$5=[]}function g$1(e){e.t&&e.t()}function q$1(e){var t=e.__();"function"==typeof t&&(e.t=t)}function x$1(e,t){return!e||t.some((function(t,r){return t!==e[r]}))}function E$2(e,t){return"function"==typeof t?t(e):t}function E$1(e,t){for(var r in t)e[r]=t[r];return e}function w$1(e,t){for(var r in e)if("__source"!==r&&!(r in t))return!0;for(var n in t)if("__source"!==n&&e[n]!==t[n])return!0;return!1}n$6.__r=function(e){c$3&&c$3(e),t$5=0,(u$2=e.__c).__H&&(u$2.__H.__h.forEach(g$1),u$2.__H.__h.forEach(q$1),u$2.__H.__h=[])},n$6.diffed=function(e){f$1&&f$1(e);var t=e.__c;if(t){var r=t.__H;r&&r.__h.length&&(1!==o$5.push(t)&&r$3===n$6.requestAnimationFrame||((r$3=n$6.requestAnimationFrame)||function(e){var t,r=function(){clearTimeout(n),cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);"undefined"!=typeof window&&(t=requestAnimationFrame(r))})(_$2))}},n$6.__c=function(e,t){t.some((function(e){try{e.__h.forEach(g$1),e.__h=e.__h.filter((function(e){return!e.__||q$1(e)}))}catch(r){t.some((function(e){e.__h&&(e.__h=[])})),t=[],n$6.__e(r,e.__v)}})),e$6&&e$6(e,t)},n$6.unmount=function(e){a$2&&a$2(e);var t=e.__c;if(t){var r=t.__H;if(r)try{r.__.forEach((function(e){return e.t&&e.t()}))}catch(n){n$6.__e(n,t.__v)}}};var C$1=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).isPureReactComponent=!0,r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.prototype.shouldComponentUpdate=function(e,t){return w$1(this.props,e)||w$1(this.state,t)},n}(m$2);function _$1(e,t){function r(e){var r=this.props.ref,n=r==e.ref;return!n&&r&&(r.call?r(null):r.current=null),t?!t(this.props,e)||!n:w$1(this.props,e)}function n(t){return this.shouldComponentUpdate=r,h$4(e,E$1({},t))}return n.prototype.isReactComponent=!0,n.displayName="Memo("+(e.displayName||e.name)+")",n.t=!0,n}var A$1=n$6.__b;function S$2(e){function t(t){var r=E$1({},t);return delete r.ref,e(r,t.ref)}return t.prototype.isReactComponent=t.t=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}n$6.__b=function(e){e.type&&e.type.t&&e.ref&&(e.props.ref=e.ref,e.ref=null),A$1&&A$1(e)};var k$1=function(e,t){return e?x$2(e).reduce((function(e,r,n){return e.concat(t(r,n))}),[]):null},R$1={map:k$1,forEach:k$1,count:function(e){return e?x$2(e).length:0},only:function(e){if(1!==(e=x$2(e)).length)throw new Error("Children.only() expects only one child.");return e[0]},toArray:x$2},F=n$6.__e;function N$1(e){return e&&((e=E$1({},e)).__c=null,e.__k=e.__k&&e.__k.map(N$1)),e}function U(){this.__u=0,this.o=null,this.__b=null}function M$1(e){var t=e.__.__c;return t&&t.u&&t.u(e)}function L$1(e){var t,r,n;function o(o){if(t||(t=e()).then((function(e){r=e.default||e}),(function(e){n=e})),n)throw n;if(!r)throw t;return h$4(r,o)}return o.displayName="Lazy",o.t=!0,o}function O(){this.i=null,this.l=null}n$6.__e=function(e,t,r){if(e.then)for(var n,o=t;o=o.__;)if((n=o.__c)&&n.__c)return n.__c(e,t.__c);F(e,t,r)},(U.prototype=new m$2).__c=function(e,t){var r=this;null==r.o&&(r.o=[]),r.o.push(t);var n=M$1(r.__v),o=!1,i=function(){o||(o=!0,n?n(a):a())};t.__c=t.componentWillUnmount,t.componentWillUnmount=function(){i(),t.__c&&t.__c()};var a=function(){var e;if(! --r.__u)for(r.__v.__k[0]=r.state.u,r.setState({u:r.__b=null});e=r.o.pop();)e.forceUpdate()};r.__u++||r.setState({u:r.__b=r.__v.__k[0]}),e.then(i,i)},U.prototype.render=function(e,t){return this.__b&&(this.__v.__k[0]=N$1(this.__b),this.__b=null),[h$4(m$2,null,t.u?null:e.children),t.u&&e.fallback]};var P$1=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};(O.prototype=new m$2).u=function(e){var t=this,r=M$1(t.__v),n=t.l.get(e);return n[0]++,function(o){var i=function(){t.props.revealOrder?(n.push(o),P$1(t,e,n)):o()};r?r(i):i()}},O.prototype.render=function(e){this.i=null,this.l=new Map;var t=x$2(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},O.prototype.componentDidUpdate=O.prototype.componentDidMount=function(){var e=this;e.l.forEach((function(t,r){P$1(e,r,t)}))};var W=function(){function e(){}var t=e.prototype;return t.getChildContext=function(){return this.props.context},t.render=function(e){return e.children},e}();function j(e){var t=this,r=e.container,n=h$4(W,{context:t.context},e.vnode);return t.s&&t.s!==r&&(t.v.parentNode&&t.s.removeChild(t.v),D$2(t.h),t.p=!1),e.vnode?t.p?(r.__k=t.__k,H$2(n,r),t.__k=r.__k):(t.v=document.createTextNode(""),I$2("",r),r.appendChild(t.v),t.p=!0,t.s=r,H$2(n,r,t.v),t.__k=t.v.__k):t.p&&(t.v.parentNode&&t.s.removeChild(t.v),D$2(t.h)),t.h=n,t.componentWillUnmount=function(){t.v.parentNode&&t.s.removeChild(t.v),D$2(t.h)},null}function z$1(e,t){return h$4(j,{vnode:e,container:t})}var D$1=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;m$2.prototype.isReactComponent={};var H$1="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;function T$1(e,t,r){if(null==t.__k)for(;t.firstChild;)t.removeChild(t.firstChild);return H$2(e,t),"function"==typeof r&&r(),e?e.__c:null}function V$1(e,t,r){return I$2(e,t),"function"==typeof r&&r(),e?e.__c:null}var Z$1=n$6.event;function I$1(e,t){e["UNSAFE_"+t]&&!e[t]&&Object.defineProperty(e,t,{configurable:!1,get:function(){return this["UNSAFE_"+t]},set:function(e){this["UNSAFE_"+t]=e}})}n$6.event=function(e){Z$1&&(e=Z$1(e)),e.persist=function(){};var t=!1,r=!1,n=e.stopPropagation;e.stopPropagation=function(){n.call(e),t=!0};var o=e.preventDefault;return e.preventDefault=function(){o.call(e),r=!0},e.isPropagationStopped=function(){return t},e.isDefaultPrevented=function(){return r},e.nativeEvent=e};var $$1={configurable:!0,get:function(){return this.class}},q=n$6.vnode;n$6.vnode=function(e){e.$$typeof=H$1;var t=e.type,r=e.props;if(t){if(r.class!=r.className&&($$1.enumerable="className"in r,null!=r.className&&(r.class=r.className),Object.defineProperty(r,"className",$$1)),"function"!=typeof t){var n,o,i;for(i in r.defaultValue&&void 0!==r.value&&(r.value||0===r.value||(r.value=r.defaultValue),delete r.defaultValue),Array.isArray(r.value)&&r.multiple&&"select"===t&&(x$2(r.children).forEach((function(e){-1!=r.value.indexOf(e.props.value)&&(e.props.selected=!0)})),delete r.value),r)if(n=D$1.test(i))break;if(n)for(i in o=e.props={},r)o[D$1.test(i)?i.replace(/[A-Z0-9]/,"-$&").toLowerCase():i]=r[i]}!function(){var t=e.type,r=e.props;if(r&&"string"==typeof t){var n={};for(var o in r)/^on(Ani|Tra|Tou)/.test(o)&&(r[o.toLowerCase()]=r[o],delete r[o]),n[o.toLowerCase()]=o;if(n.ondoubleclick&&(r.ondblclick=r[n.ondoubleclick],delete r[n.ondoubleclick]),n.onbeforeinput&&(r.onbeforeinput=r[n.onbeforeinput],delete r[n.onbeforeinput]),n.onchange&&("textarea"===t||"input"===t.toLowerCase()&&!/^fil|che|ra/i.test(r.type))){var i=n.oninput||"oninput";r[i]||(r[i]=r[n.onchange],delete r[n.onchange])}}}(),"function"==typeof t&&!t.m&&t.prototype&&(I$1(t.prototype,"componentWillMount"),I$1(t.prototype,"componentWillReceiveProps"),I$1(t.prototype,"componentWillUpdate"),t.m=!0)}q&&q(e)};var B$1="16.8.0";function G(e){return h$4.bind(null,e)}function J(e){return!!e&&e.$$typeof===H$1}function K(e){return J(e)?L$2.apply(null,arguments):e}function Q(e){return!!e.__k&&(H$2(null,e),!0)}function X(e){return e&&(e.base||1===e.nodeType&&e)||null}var Y=function(e,t){return e(t)};const compat_module={useState:m$1,useReducer:p$1,useEffect:l$5,useLayoutEffect:y$2,useRef:d$2,useImperativeHandle:s$5,useMemo:h$3,useCallback:T$2,useContext:w$2,useDebugValue:A$2,version:"16.8.0",Children:R$1,render:T$1,hydrate:T$1,unmountComponentAtNode:Q,createPortal:z$1,createElement:h$4,createContext:M$2,createFactory:G,cloneElement:K,createRef:y$3,Fragment:d$3,isValidElement:J,findDOMNode:X,Component:m$2,PureComponent:C$1,memo:_$1,forwardRef:S$2,unstable_batchedUpdates:Y,Suspense:U,SuspenseList:O,lazy:L$1},compat_module$1=Object.freeze(Object.defineProperty({__proto__:null,Children:R$1,Component:m$2,Fragment:d$3,PureComponent:C$1,Suspense:U,SuspenseList:O,cloneElement:K,createContext:M$2,createElement:h$4,createFactory:G,createPortal:z$1,createRef:y$3,default:compat_module,findDOMNode:X,forwardRef:S$2,hydrate:V$1,isValidElement:J,lazy:L$1,memo:_$1,render:T$1,unmountComponentAtNode:Q,unstable_batchedUpdates:Y,useCallback:T$2,useContext:w$2,useDebugValue:A$2,useEffect:l$5,useErrorBoundary:F$1,useImperativeHandle:s$5,useLayoutEffect:y$2,useMemo:h$3,useReducer:p$1,useRef:d$2,useState:m$1,version:B$1},Symbol.toStringTag,{value:"Module"})),require$$3=getAugmentedNamespace(compat_module$1);function _interopDefault$1(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var browserUtils=require$$0,QRCode$1=_interopDefault$1(browser$1),copy=_interopDefault$1(copyToClipboard),React=require$$3;function open(e){QRCode$1.toString(e,{type:"terminal"}).then(console.log)}var WALLETCONNECT_STYLE_SHEET=':root {\n --animation-duration: 300ms;\n}\n\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes fadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n.animated {\n animation-duration: var(--animation-duration);\n animation-fill-mode: both;\n}\n\n.fadeIn {\n animation-name: fadeIn;\n}\n\n.fadeOut {\n animation-name: fadeOut;\n}\n\n#walletconnect-wrapper {\n -webkit-user-select: none;\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n left: 0;\n pointer-events: none;\n position: fixed;\n top: 0;\n user-select: none;\n width: 100%;\n z-index: 99999999999999;\n}\n\n.walletconnect-modal__headerLogo {\n height: 21px;\n}\n\n.walletconnect-modal__header p {\n color: #ffffff;\n font-size: 20px;\n font-weight: 600;\n margin: 0;\n align-items: flex-start;\n display: flex;\n flex: 1;\n margin-left: 5px;\n}\n\n.walletconnect-modal__close__wrapper {\n position: absolute;\n top: 0px;\n right: 0px;\n z-index: 10000;\n background: white;\n border-radius: 26px;\n padding: 6px;\n box-sizing: border-box;\n width: 26px;\n height: 26px;\n cursor: pointer;\n}\n\n.walletconnect-modal__close__icon {\n position: relative;\n top: 7px;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n transform: rotate(45deg);\n}\n\n.walletconnect-modal__close__line1 {\n position: absolute;\n width: 100%;\n border: 1px solid rgb(48, 52, 59);\n}\n\n.walletconnect-modal__close__line2 {\n position: absolute;\n width: 100%;\n border: 1px solid rgb(48, 52, 59);\n transform: rotate(90deg);\n}\n\n.walletconnect-qrcode__base {\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n background: rgba(37, 41, 46, 0.95);\n height: 100%;\n left: 0;\n pointer-events: auto;\n position: fixed;\n top: 0;\n transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);\n width: 100%;\n will-change: opacity;\n padding: 40px;\n box-sizing: border-box;\n}\n\n.walletconnect-qrcode__text {\n color: rgba(60, 66, 82, 0.6);\n font-size: 16px;\n font-weight: 600;\n letter-spacing: 0;\n line-height: 1.1875em;\n margin: 10px 0 20px 0;\n text-align: center;\n width: 100%;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-qrcode__text {\n font-size: 4vw;\n }\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-qrcode__text {\n font-size: 14px;\n }\n}\n\n.walletconnect-qrcode__image {\n width: calc(100% - 30px);\n box-sizing: border-box;\n cursor: none;\n margin: 0 auto;\n}\n\n.walletconnect-qrcode__notification {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n font-size: 16px;\n padding: 16px 20px;\n border-radius: 16px;\n text-align: center;\n transition: all 0.1s ease-in-out;\n background: white;\n color: black;\n margin-bottom: -60px;\n opacity: 0;\n}\n\n.walletconnect-qrcode__notification.notification__show {\n opacity: 1;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-modal__header {\n height: 130px;\n }\n .walletconnect-modal__base {\n overflow: auto;\n }\n}\n\n@media only screen and (min-device-width: 415px) and (max-width: 768px) {\n #content {\n max-width: 768px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (min-width: 375px) and (max-width: 415px) {\n #content {\n max-width: 414px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (min-width: 320px) and (max-width: 375px) {\n #content {\n max-width: 375px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (max-width: 320px) {\n #content {\n max-width: 320px;\n box-sizing: border-box;\n }\n}\n\n.walletconnect-modal__base {\n -webkit-font-smoothing: antialiased;\n background: #ffffff;\n border-radius: 24px;\n box-shadow: 0 10px 50px 5px rgba(0, 0, 0, 0.4);\n font-family: ui-rounded, "SF Pro Rounded", "SF Pro Text", medium-content-sans-serif-font,\n -apple-system, BlinkMacSystemFont, ui-sans-serif, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell,\n "Open Sans", "Helvetica Neue", sans-serif;\n margin-top: 41px;\n padding: 24px 24px 22px;\n pointer-events: auto;\n position: relative;\n text-align: center;\n transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);\n will-change: transform;\n overflow: visible;\n transform: translateY(-50%);\n top: 50%;\n max-width: 500px;\n margin: auto;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-modal__base {\n padding: 24px 12px;\n }\n}\n\n.walletconnect-modal__base .hidden {\n transform: translateY(150%);\n transition: 0.125s cubic-bezier(0.4, 0, 1, 1);\n}\n\n.walletconnect-modal__header {\n align-items: center;\n display: flex;\n height: 26px;\n left: 0;\n justify-content: space-between;\n position: absolute;\n top: -42px;\n width: 100%;\n}\n\n.walletconnect-modal__base .wc-logo {\n align-items: center;\n display: flex;\n height: 26px;\n margin-top: 15px;\n padding-bottom: 15px;\n pointer-events: auto;\n}\n\n.walletconnect-modal__base .wc-logo div {\n background-color: #3399ff;\n height: 21px;\n margin-right: 5px;\n mask-image: url("images/wc-logo.svg") center no-repeat;\n width: 32px;\n}\n\n.walletconnect-modal__base .wc-logo p {\n color: #ffffff;\n font-size: 20px;\n font-weight: 600;\n margin: 0;\n}\n\n.walletconnect-modal__base h2 {\n color: rgba(60, 66, 82, 0.6);\n font-size: 16px;\n font-weight: 600;\n letter-spacing: 0;\n line-height: 1.1875em;\n margin: 0 0 19px 0;\n text-align: center;\n width: 100%;\n}\n\n.walletconnect-modal__base__row {\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n align-items: center;\n border-radius: 20px;\n cursor: pointer;\n display: flex;\n height: 56px;\n justify-content: space-between;\n padding: 0 15px;\n position: relative;\n margin: 0px 0px 8px;\n text-align: left;\n transition: 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n will-change: transform;\n text-decoration: none;\n}\n\n.walletconnect-modal__base__row:hover {\n background: rgba(60, 66, 82, 0.06);\n}\n\n.walletconnect-modal__base__row:active {\n background: rgba(60, 66, 82, 0.06);\n transform: scale(0.975);\n transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n}\n\n.walletconnect-modal__base__row__h3 {\n color: #25292e;\n font-size: 20px;\n font-weight: 700;\n margin: 0;\n padding-bottom: 3px;\n}\n\n.walletconnect-modal__base__row__right {\n align-items: center;\n display: flex;\n justify-content: center;\n}\n\n.walletconnect-modal__base__row__right__app-icon {\n border-radius: 8px;\n height: 34px;\n margin: 0 11px 2px 0;\n width: 34px;\n background-size: 100%;\n box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);\n}\n\n.walletconnect-modal__base__row__right__caret {\n height: 18px;\n opacity: 0.3;\n transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n width: 8px;\n will-change: opacity;\n}\n\n.walletconnect-modal__base__row:hover .caret,\n.walletconnect-modal__base__row:active .caret {\n opacity: 0.6;\n}\n\n.walletconnect-modal__mobile__toggle {\n width: 80%;\n display: flex;\n margin: 0 auto;\n position: relative;\n overflow: hidden;\n border-radius: 8px;\n margin-bottom: 18px;\n background: #d4d5d9;\n}\n\n.walletconnect-modal__single_wallet {\n display: flex;\n justify-content: center;\n margin-top: 7px;\n margin-bottom: 18px;\n}\n\n.walletconnect-modal__single_wallet a {\n cursor: pointer;\n color: rgb(64, 153, 255);\n font-size: 21px;\n font-weight: 800;\n text-decoration: none !important;\n margin: 0 auto;\n}\n\n.walletconnect-modal__mobile__toggle_selector {\n width: calc(50% - 8px);\n background: white;\n position: absolute;\n border-radius: 5px;\n height: calc(100% - 8px);\n top: 4px;\n transition: all 0.2s ease-in-out;\n transform: translate3d(4px, 0, 0);\n}\n\n.walletconnect-modal__mobile__toggle.right__selected .walletconnect-modal__mobile__toggle_selector {\n transform: translate3d(calc(100% + 12px), 0, 0);\n}\n\n.walletconnect-modal__mobile__toggle a {\n font-size: 12px;\n width: 50%;\n text-align: center;\n padding: 8px;\n margin: 0;\n font-weight: 600;\n z-index: 1;\n}\n\n.walletconnect-modal__footer {\n display: flex;\n justify-content: center;\n margin-top: 20px;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-modal__footer {\n margin-top: 5vw;\n }\n}\n\n.walletconnect-modal__footer a {\n cursor: pointer;\n color: #898d97;\n font-size: 15px;\n margin: 0 auto;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-modal__footer a {\n font-size: 14px;\n }\n}\n\n.walletconnect-connect__buttons__wrapper {\n max-height: 44vh;\n}\n\n.walletconnect-connect__buttons__wrapper__android {\n margin: 50% 0;\n}\n\n.walletconnect-connect__buttons__wrapper__wrap {\n display: grid;\n grid-template-columns: repeat(4, 1fr);\n margin: 10px 0;\n}\n\n@media only screen and (min-width: 768px) {\n .walletconnect-connect__buttons__wrapper__wrap {\n margin-top: 40px;\n }\n}\n\n.walletconnect-connect__button {\n background-color: rgb(64, 153, 255);\n padding: 12px;\n border-radius: 8px;\n text-decoration: none;\n color: rgb(255, 255, 255);\n font-weight: 500;\n}\n\n.walletconnect-connect__button__icon_anchor {\n cursor: pointer;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n margin: 8px;\n width: 42px;\n justify-self: center;\n flex-direction: column;\n text-decoration: none !important;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-connect__button__icon_anchor {\n margin: 4px;\n }\n}\n\n.walletconnect-connect__button__icon {\n border-radius: 10px;\n height: 42px;\n margin: 0;\n width: 42px;\n background-size: cover !important;\n box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);\n}\n\n.walletconnect-connect__button__text {\n color: #424952;\n font-size: 2.7vw;\n text-decoration: none !important;\n padding: 0;\n margin-top: 1.8vw;\n font-weight: 600;\n}\n\n@media only screen and (min-width: 768px) {\n .walletconnect-connect__button__text {\n font-size: 16px;\n margin-top: 12px;\n }\n}\n\n.walletconnect-search__input {\n border: none;\n background: #d4d5d9;\n border-style: none;\n padding: 8px 16px;\n outline: none;\n font-style: normal;\n font-stretch: normal;\n font-size: 16px;\n font-style: normal;\n font-stretch: normal;\n line-height: normal;\n letter-spacing: normal;\n text-align: left;\n border-radius: 8px;\n width: calc(100% - 16px);\n margin: 0;\n margin-bottom: 8px;\n}\n';function _catch(e,t){try{var r=e()}catch(e2){return t(e2)}return r&&r.then?r.then(void 0,t):r}"undefined"==typeof Symbol||(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"==typeof Symbol||(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var WALLETCONNECT_LOGO_SVG_URL="data:image/svg+xml,%3Csvg height='185' viewBox='0 0 300 185' width='300' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m61.4385429 36.2562612c48.9112241-47.8881663 128.2119871-47.8881663 177.1232091 0l5.886545 5.7634174c2.445561 2.3944081 2.445561 6.2765112 0 8.6709204l-20.136695 19.715503c-1.222781 1.1972051-3.2053 1.1972051-4.428081 0l-8.100584-7.9311479c-34.121692-33.4079817-89.443886-33.4079817-123.5655788 0l-8.6750562 8.4936051c-1.2227816 1.1972041-3.205301 1.1972041-4.4280806 0l-20.1366949-19.7155031c-2.4455612-2.3944092-2.4455612-6.2765122 0-8.6709204zm218.7677961 40.7737449 17.921697 17.546897c2.445549 2.3943969 2.445563 6.2764769.000031 8.6708899l-80.810171 79.121134c-2.445544 2.394426-6.410582 2.394453-8.85616.000062-.00001-.00001-.000022-.000022-.000032-.000032l-57.354143-56.154572c-.61139-.598602-1.60265-.598602-2.21404 0-.000004.000004-.000007.000008-.000011.000011l-57.3529212 56.154531c-2.4455368 2.394432-6.4105755 2.394472-8.8561612.000087-.0000143-.000014-.0000296-.000028-.0000449-.000044l-80.81241943-79.122185c-2.44556021-2.394408-2.44556021-6.2765115 0-8.6709197l17.92172963-17.5468673c2.4455602-2.3944082 6.4105989-2.3944082 8.8561602 0l57.3549775 56.155357c.6113908.598602 1.602649.598602 2.2140398 0 .0000092-.000009.0000174-.000017.0000265-.000024l57.3521031-56.155333c2.445505-2.3944633 6.410544-2.3945531 8.856161-.0002.000034.0000336.000068.0000673.000101.000101l57.354902 56.155432c.61139.598601 1.60265.598601 2.21404 0l57.353975-56.1543249c2.445561-2.3944092 6.410599-2.3944092 8.85616 0z' fill='%233b99fc'/%3E%3C/svg%3E",WALLETCONNECT_HEADER_TEXT="WalletConnect",ANIMATION_DURATION=300,DEFAULT_BUTTON_COLOR="rgb(64, 153, 255)",WALLETCONNECT_WRAPPER_ID="walletconnect-wrapper",WALLETCONNECT_STYLE_ID="walletconnect-style-sheet",WALLETCONNECT_MODAL_ID="walletconnect-qrcode-modal",WALLETCONNECT_CLOSE_BUTTON_ID="walletconnect-qrcode-close",WALLETCONNECT_CTA_TEXT_ID="walletconnect-qrcode-text",WALLETCONNECT_CONNECT_BUTTON_ID="walletconnect-connect-button";function Header(e){return React.createElement("div",{className:"walletconnect-modal__header"},React.createElement("img",{src:WALLETCONNECT_LOGO_SVG_URL,className:"walletconnect-modal__headerLogo"}),React.createElement("p",null,WALLETCONNECT_HEADER_TEXT),React.createElement("div",{className:"walletconnect-modal__close__wrapper",onClick:e.onClose},React.createElement("div",{id:WALLETCONNECT_CLOSE_BUTTON_ID,className:"walletconnect-modal__close__icon"},React.createElement("div",{className:"walletconnect-modal__close__line1"}),React.createElement("div",{className:"walletconnect-modal__close__line2"}))))}function ConnectButton(e){return React.createElement("a",{className:"walletconnect-connect__button",href:e.href,id:WALLETCONNECT_CONNECT_BUTTON_ID+"-"+e.name,onClick:e.onClick,rel:"noopener noreferrer",style:{backgroundColor:e.color},target:"_blank"},e.name)}var CARET_SVG_URL="data:image/svg+xml,%3Csvg fill='none' height='18' viewBox='0 0 8 18' width='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath clip-rule='evenodd' d='m.586301.213898c-.435947.33907-.5144813.967342-.175411 1.403292l4.87831 6.27212c.28087.36111.28087.86677 0 1.22788l-4.878311 6.27211c-.33907.436-.260536 1.0642.175412 1.4033.435949.3391 1.064219.2605 1.403289-.1754l4.87832-6.2721c.84259-1.08336.84259-2.60034 0-3.68367l-4.87832-6.27212c-.33907-.4359474-.96734-.514482-1.403289-.175412z' fill='%233c4252' fill-rule='evenodd'/%3E%3C/svg%3E";function WalletButton(e){var t=e.color,r=e.href,n=e.name,o=e.logo,i=e.onClick;return React.createElement("a",{className:"walletconnect-modal__base__row",href:r,onClick:i,rel:"noopener noreferrer",target:"_blank"},React.createElement("h3",{className:"walletconnect-modal__base__row__h3"},n),React.createElement("div",{className:"walletconnect-modal__base__row__right"},React.createElement("div",{className:"walletconnect-modal__base__row__right__app-icon",style:{background:"url('"+o+"') "+t,backgroundSize:"100%"}}),React.createElement("img",{src:CARET_SVG_URL,className:"walletconnect-modal__base__row__right__caret"})))}function WalletIcon(e){var t=e.color,r=e.href,n=e.name,o=e.logo,i=e.onClick,a=window.innerWidth<768?(n.length>8?2.5:2.7)+"vw":"inherit";return React.createElement("a",{className:"walletconnect-connect__button__icon_anchor",href:r,onClick:i,rel:"noopener noreferrer",target:"_blank"},React.createElement("div",{className:"walletconnect-connect__button__icon",style:{background:"url('"+o+"') "+t,backgroundSize:"100%"}}),React.createElement("div",{style:{fontSize:a},className:"walletconnect-connect__button__text"},n))}var GRID_MIN_COUNT=5,LINKS_PER_PAGE=12;function LinkDisplay(e){var t=browserUtils.isAndroid(),r=React.useState(""),n=r[0],o=r[1],i=React.useState(""),a=i[0],s=i[1],c=React.useState(1),u=c[0],l=c[1],d=a?e.links.filter((function(e){return e.name.toLowerCase().includes(a.toLowerCase())})):e.links,f=e.errorMessage,h=a||d.length>GRID_MIN_COUNT,p=Math.ceil(d.length/LINKS_PER_PAGE),y=[(u-1)*LINKS_PER_PAGE+1,u*LINKS_PER_PAGE],m=d.length?d.filter((function(e,t){return t+1>=y[0]&&t+1<=y[1]})):[],g=!(t||!(p>1)),b=void 0;return React.createElement("div",null,React.createElement("p",{id:WALLETCONNECT_CTA_TEXT_ID,className:"walletconnect-qrcode__text"},t?e.text.connect_mobile_wallet:e.text.choose_preferred_wallet),!t&&React.createElement("input",{className:"walletconnect-search__input",placeholder:"Search",value:n,onChange:function(e){o(e.target.value),clearTimeout(b),e.target.value?b=setTimeout((function(){s(e.target.value),l(1)}),1e3):(o(""),s(""),l(1))}}),React.createElement("div",{className:"walletconnect-connect__buttons__wrapper"+(t?"__android":h&&d.length?"__wrap":"")},t?React.createElement(ConnectButton,{name:e.text.connect,color:DEFAULT_BUTTON_COLOR,href:e.uri,onClick:React.useCallback((function(){browserUtils.saveMobileLinkInfo({name:"Unknown",href:e.uri})}),[])}):m.length?m.map((function(t){var r=t.color,n=t.name,o=t.shortName,i=t.logo,a=browserUtils.formatIOSMobile(e.uri,t),s=React.useCallback((function(){browserUtils.saveMobileLinkInfo({name:n,href:a})}),[m]);return h?React.createElement(WalletIcon,{color:r,href:a,name:o||n,logo:i,onClick:s}):React.createElement(WalletButton,{color:r,href:a,name:n,logo:i,onClick:s})})):React.createElement(React.Fragment,null,React.createElement("p",null,f.length?e.errorMessage:e.links.length&&!d.length?e.text.no_wallets_found:e.text.loading))),g&&React.createElement("div",{className:"walletconnect-modal__footer"},Array(p).fill(0).map((function(e,t){var r=t+1,n=u===r;return React.createElement("a",{style:{margin:"auto 10px",fontWeight:n?"bold":"normal"},onClick:function(){return l(r)}},r)}))))}function Notification(e){var t=!!e.message.trim();return React.createElement("div",{className:"walletconnect-qrcode__notification"+(t?" notification__show":"")},e.message)}var formatQRCodeImage=function(e){try{var t="";return Promise.resolve(QRCode$1.toString(e,{margin:0,type:"svg"})).then((function(e){return"string"==typeof e&&(t=e.replace("<svg",'<svg class="walletconnect-qrcode__image"')),t}))}catch(e2){return Promise.reject(e2)}};function QRCodeDisplay(e){var t=React.useState(""),r=t[0],n=t[1],o=React.useState(""),i=o[0],a=o[1];React.useEffect((function(){try{return Promise.resolve(formatQRCodeImage(e.uri)).then((function(e){a(e)}))}catch(e2){Promise.reject(e2)}}),[]);return React.createElement("div",null,React.createElement("p",{id:WALLETCONNECT_CTA_TEXT_ID,className:"walletconnect-qrcode__text"},e.text.scan_qrcode_with_wallet),React.createElement("div",{dangerouslySetInnerHTML:{__html:i}}),React.createElement("div",{className:"walletconnect-modal__footer"},React.createElement("a",{onClick:function(){copy(e.uri)?(n(e.text.copied_to_clipboard),setInterval((function(){return n("")}),1200)):(n("Error"),setInterval((function(){return n("")}),1200))}},e.text.copy_to_clipboard)),React.createElement(Notification,{message:r}))}function Modal(e){var t=browserUtils.isAndroid(),r=browserUtils.isMobile(),n=r?e.qrcodeModalOptions&&e.qrcodeModalOptions.mobileLinks?e.qrcodeModalOptions.mobileLinks:void 0:e.qrcodeModalOptions&&e.qrcodeModalOptions.desktopLinks?e.qrcodeModalOptions.desktopLinks:void 0,o=React.useState(!1),i=o[0],a=o[1],s=React.useState(!1),c=s[0],u=s[1],l=React.useState(!r),d=l[0],f=l[1],h={mobile:r,text:e.text,uri:e.uri,qrcodeModalOptions:e.qrcodeModalOptions},p=React.useState(""),y=p[0],m=p[1],g=React.useState(!1),b=g[0],v=g[1],w=React.useState([]),_=w[0],I=w[1],T=React.useState(""),k=T[0],$=T[1],S=function(){c||i||n&&!n.length||_.length>0||React.useEffect((function(){!function(){try{if(t)return Promise.resolve();a(!0);var o=_catch((function(){var t=e.qrcodeModalOptions&&e.qrcodeModalOptions.registryUrl?e.qrcodeModalOptions.registryUrl:browserUtils.getWalletRegistryUrl();return Promise.resolve(fetch(t)).then((function(t){return Promise.resolve(t.json()).then((function(t){var o=t.listings,i=r?"mobile":"desktop",s=browserUtils.getMobileLinkRegistry(browserUtils.formatMobileRegistry(o,i),n);a(!1),u(!0),$(s.length?"":e.text.no_supported_wallets),I(s);var c=1===s.length;c&&(m(browserUtils.formatIOSMobile(e.uri,s[0])),f(!0)),v(c)}))}))}),(function(t){a(!1),u(!0),$(e.text.something_went_wrong),console.error(t)}));return Promise.resolve(o&&o.then?o.then((function(){})):void 0)}catch(e2){return Promise.reject(e2)}}()}))};S();var A=r?d:!d;return React.createElement("div",{id:WALLETCONNECT_MODAL_ID,className:"walletconnect-qrcode__base animated fadeIn"},React.createElement("div",{className:"walletconnect-modal__base"},React.createElement(Header,{onClose:e.onClose}),b&&d?React.createElement("div",{className:"walletconnect-modal__single_wallet"},React.createElement("a",{onClick:function(){return browserUtils.saveMobileLinkInfo({name:_[0].name,href:y})},href:y,rel:"noopener noreferrer",target:"_blank"},e.text.connect_with+" "+(b?_[0].name:"")+" ›")):t||i||!i&&_.length?React.createElement("div",{className:"walletconnect-modal__mobile__toggle"+(A?" right__selected":"")},React.createElement("div",{className:"walletconnect-modal__mobile__toggle_selector"}),r?React.createElement(React.Fragment,null,React.createElement("a",{onClick:function(){return f(!1),S()}},e.text.mobile),React.createElement("a",{onClick:function(){return f(!0)}},e.text.qrcode)):React.createElement(React.Fragment,null,React.createElement("a",{onClick:function(){return f(!0)}},e.text.qrcode),React.createElement("a",{onClick:function(){return f(!1),S()}},e.text.desktop))):null,React.createElement("div",null,d||!t&&!i&&!_.length?React.createElement(QRCodeDisplay,Object.assign({},h)):React.createElement(LinkDisplay,Object.assign({},h,{links:_,errorMessage:k})))))}var de={choose_preferred_wallet:"Wähle bevorzugte Wallet",connect_mobile_wallet:"Verbinde mit Mobile Wallet",scan_qrcode_with_wallet:"Scanne den QR-code mit einer WalletConnect kompatiblen Wallet",connect:"Verbinden",qrcode:"QR-Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"In die Zwischenablage kopieren",copied_to_clipboard:"In die Zwischenablage kopiert!",connect_with:"Verbinden mit Hilfe von",loading:"Laden...",something_went_wrong:"Etwas ist schief gelaufen",no_supported_wallets:"Es gibt noch keine unterstützten Wallet",no_wallets_found:"keine Wallet gefunden"},en={choose_preferred_wallet:"Choose your preferred wallet",connect_mobile_wallet:"Connect to Mobile Wallet",scan_qrcode_with_wallet:"Scan QR code with a WalletConnect-compatible wallet",connect:"Connect",qrcode:"QR Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"Copy to clipboard",copied_to_clipboard:"Copied to clipboard!",connect_with:"Connect with",loading:"Loading...",something_went_wrong:"Something went wrong",no_supported_wallets:"There are no supported wallets yet",no_wallets_found:"No wallets found"},es={choose_preferred_wallet:"Elige tu billetera preferida",connect_mobile_wallet:"Conectar a billetera móvil",scan_qrcode_with_wallet:"Escanea el código QR con una billetera compatible con WalletConnect",connect:"Conectar",qrcode:"Código QR",mobile:"Móvil",desktop:"Desktop",copy_to_clipboard:"Copiar",copied_to_clipboard:"Copiado!",connect_with:"Conectar mediante",loading:"Cargando...",something_went_wrong:"Algo salió mal",no_supported_wallets:"Todavía no hay billeteras compatibles",no_wallets_found:"No se encontraron billeteras"},fr={choose_preferred_wallet:"Choisissez votre portefeuille préféré",connect_mobile_wallet:"Se connecter au portefeuille mobile",scan_qrcode_with_wallet:"Scannez le QR code avec un portefeuille compatible WalletConnect",connect:"Se connecter",qrcode:"QR Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"Copier",copied_to_clipboard:"Copié!",connect_with:"Connectez-vous à l'aide de",loading:"Chargement...",something_went_wrong:"Quelque chose a mal tourné",no_supported_wallets:"Il n'y a pas encore de portefeuilles pris en charge",no_wallets_found:"Aucun portefeuille trouvé"},ko={choose_preferred_wallet:"원하는 지갑을 선택하세요",connect_mobile_wallet:"모바일 지갑과 연결",scan_qrcode_with_wallet:"WalletConnect 지원 지갑에서 QR코드를 스캔하세요",connect:"연결",qrcode:"QR 코드",mobile:"모바일",desktop:"데스크탑",copy_to_clipboard:"클립보드에 복사",copied_to_clipboard:"클립보드에 복사되었습니다!",connect_with:"와 연결하다",loading:"로드 중...",something_went_wrong:"문제가 발생했습니다.",no_supported_wallets:"아직 지원되는 지갑이 없습니다",no_wallets_found:"지갑을 찾을 수 없습니다"},pt={choose_preferred_wallet:"Escolha sua carteira preferida",connect_mobile_wallet:"Conectar-se à carteira móvel",scan_qrcode_with_wallet:"Ler o código QR com uma carteira compatível com WalletConnect",connect:"Conectar",qrcode:"Código QR",mobile:"Móvel",desktop:"Desktop",copy_to_clipboard:"Copiar",copied_to_clipboard:"Copiado!",connect_with:"Ligar por meio de",loading:"Carregamento...",something_went_wrong:"Algo correu mal",no_supported_wallets:"Ainda não há carteiras suportadas",no_wallets_found:"Nenhuma carteira encontrada"},zh={choose_preferred_wallet:"选择你的钱包",connect_mobile_wallet:"连接至移动端钱包",scan_qrcode_with_wallet:"使用兼容 WalletConnect 的钱包扫描二维码",connect:"连接",qrcode:"二维码",mobile:"移动",desktop:"桌面",copy_to_clipboard:"复制到剪贴板",copied_to_clipboard:"复制到剪贴板成功!",connect_with:"通过以下方式连接",loading:"正在加载...",something_went_wrong:"出了问题",no_supported_wallets:"目前还没有支持的钱包",no_wallets_found:"没有找到钱包"},fa={choose_preferred_wallet:"کیف پول مورد نظر خود را انتخاب کنید",connect_mobile_wallet:"به کیف پول موبایل وصل شوید",scan_qrcode_with_wallet:"کد QR را با یک کیف پول سازگار با WalletConnect اسکن کنید",connect:"اتصال",qrcode:"کد QR",mobile:"سیار",desktop:"دسکتاپ",copy_to_clipboard:"کپی به کلیپ بورد",copied_to_clipboard:"در کلیپ بورد کپی شد!",connect_with:"ارتباط با",loading:"...بارگذاری",something_went_wrong:"مشکلی پیش آمد",no_supported_wallets:"هنوز هیچ کیف پول پشتیبانی شده ای وجود ندارد",no_wallets_found:"هیچ کیف پولی پیدا نشد"},languages={de:de,en:en,es:es,fr:fr,ko:ko,pt:pt,zh:zh,fa:fa};function injectStyleSheet(){var e=browserUtils.getDocumentOrThrow(),t=e.getElementById(WALLETCONNECT_STYLE_ID);t&&e.head.removeChild(t);var r=e.createElement("style");r.setAttribute("id",WALLETCONNECT_STYLE_ID),r.innerText=WALLETCONNECT_STYLE_SHEET,e.head.appendChild(r)}function renderWrapper(){var e=browserUtils.getDocumentOrThrow(),t=e.createElement("div");return t.setAttribute("id",WALLETCONNECT_WRAPPER_ID),e.body.appendChild(t),t}function triggerCloseAnimation(){var e=browserUtils.getDocumentOrThrow(),t=e.getElementById(WALLETCONNECT_MODAL_ID);t&&(t.className=t.className.replace("fadeIn","fadeOut"),setTimeout((function(){var t=e.getElementById(WALLETCONNECT_WRAPPER_ID);t&&e.body.removeChild(t)}),ANIMATION_DURATION))}function getWrappedCallback(e){return function(){triggerCloseAnimation(),e&&e()}}function getText(){var e=browserUtils.getNavigatorOrThrow().language.split("-")[0]||"en";return languages[e]||languages.en}function open$1(e,t,r){injectStyleSheet();var n=renderWrapper();React.render(React.createElement(Modal,{text:getText(),uri:e,onClose:getWrappedCallback(t),qrcodeModalOptions:r}),n)}function close$1(){triggerCloseAnimation()}var isNode=function(){return void 0!==process$1&&void 0!==process$1.versions&&void 0!==process$1.versions.node};function open$2(e,t,r){console.log(e),isNode()?open(e):open$1(e,t,r)}function close$2(){isNode()||close$1()}var index$1={open:open$2,close:close$2},cjs=index$1;const QRCodeModal=getDefaultExportFromCjs$1(cjs),t$4=Symbol(),s$4=Object.getPrototypeOf,c$2=new WeakMap,l$4=e=>e&&(c$2.has(e)?c$2.get(e):s$4(e)===Object.prototype||s$4(e)===Array.prototype),y$1=e=>l$4(e)&&e[t$4]||null,h$2=(e,t=!0)=>{c$2.set(e,t)},isObject=e=>"object"==typeof e&&null!==e,proxyStateMap=new WeakMap,refSet=new WeakSet,buildProxyFunction=(e=Object.is,t=(e,t)=>new Proxy(e,t),r=e=>isObject(e)&&!refSet.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer),n=e=>{switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e}},o=new WeakMap,i=(e,t,r=n)=>{const a=o.get(e);if((null==a?void 0:a[0])===t)return a[1];const s=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return h$2(s,!0),o.set(e,[t,s]),Reflect.ownKeys(e).forEach((t=>{if(Object.getOwnPropertyDescriptor(s,t))return;const n=Reflect.get(e,t),o={value:n,enumerable:!0,configurable:!0};if(refSet.has(n))h$2(n,!1);else if(n instanceof Promise)delete o.value,o.get=()=>r(n);else if(proxyStateMap.has(n)){const[e,t]=proxyStateMap.get(n);o.value=i(e,t(),r)}Object.defineProperty(s,t,o)})),Object.preventExtensions(s)},a=new WeakMap,s=[1,1],c=n=>{if(!isObject(n))throw new Error("object required");const o=a.get(n);if(o)return o;let u=s[0];const l=new Set,d=(e,t=++s[0])=>{u!==t&&(u=t,l.forEach((r=>r(e,t))))};let f=s[1];const h=e=>(t,r)=>{const n=[...t];n[1]=[e,...n[1]],d(n,r)},p=new Map,y=e=>{var t;const r=p.get(e);r&&(p.delete(e),null==(t=r[1])||t.call(r))},m=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),g=t(m,{deleteProperty(e,t){const r=Reflect.get(e,t);y(t);const n=Reflect.deleteProperty(e,t);return n&&d(["delete",[t],r]),n},set(t,n,o,i){const s=Reflect.has(t,n),u=Reflect.get(t,n,i);if(s&&(e(u,o)||a.has(o)&&e(u,a.get(o))))return!0;y(n),isObject(o)&&(o=y$1(o)||o);let f=o;if(o instanceof Promise)o.then((e=>{o.status="fulfilled",o.value=e,d(["resolve",[n],e])})).catch((e=>{o.status="rejected",o.reason=e,d(["reject",[n],e])}));else{!proxyStateMap.has(o)&&r(o)&&(f=c(o));const e=!refSet.has(f)&&proxyStateMap.get(f);e&&((e,t)=>{if(l.size){const r=t[3](h(e));p.set(e,[t,r])}else p.set(e,[t])})(n,e)}return Reflect.set(t,n,f,i),d(["set",[n],o,u]),!0}});a.set(n,g);const b=[m,(e=++s[1])=>(f===e||l.size||(f=e,p.forEach((([t])=>{const r=t[1](e);r>u&&(u=r)}))),u),i,e=>{l.add(e),1===l.size&&p.forEach((([e,t],r)=>{const n=e[3](h(r));p.set(r,[e,n])}));return()=>{l.delete(e),0===l.size&&p.forEach((([e,t],r)=>{t&&(t(),p.set(r,[e]))}))}}];return proxyStateMap.set(g,b),Reflect.ownKeys(n).forEach((e=>{const t=Object.getOwnPropertyDescriptor(n,e);"value"in t&&(g[e]=n[e],delete t.value,delete t.writable),Object.defineProperty(m,e,t)})),g})=>[c,proxyStateMap,refSet,e,t,r,n,o,i,a,s],[defaultProxyFunction]=buildProxyFunction();function proxy(e={}){return defaultProxyFunction(e)}function subscribe(e,t,r){const n=proxyStateMap.get(e);let o;const i=[],a=n[3];let s=!1;const c=a((e=>{i.push(e),o||(o=Promise.resolve().then((()=>{o=void 0,s&&t(i.splice(0))})))}));return s=!0,()=>{s=!1,c()}}function snapshot(e,t){const r=proxyStateMap.get(e),[n,o,i]=r;return i(n,o(),t)}const state$7=proxy({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),RouterCtrl={state:state$7,subscribe:e=>subscribe(state$7,(()=>e(state$7))),push(e,t){e!==state$7.view&&(state$7.view=e,t&&(state$7.data=t),state$7.history.push(e))},reset(e){state$7.view=e,state$7.history=[e]},replace(e){state$7.history.length>1&&(state$7.history[state$7.history.length-1]=e,state$7.view=e)},goBack(){if(state$7.history.length>1){state$7.history.pop();const[e]=state$7.history.slice(-1);state$7.view=e}},setData(e){state$7.data=e}},CoreUtil={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile:()=>"undefined"!=typeof window&&Boolean(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)),isAndroid:()=>CoreUtil.isMobile()&&navigator.userAgent.toLowerCase().includes("android"),isIos(){const e=navigator.userAgent.toLowerCase();return CoreUtil.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl:e=>e.startsWith("http://")||e.startsWith("https://"),isArray:e=>Array.isArray(e)&&e.length>0,isTelegram:()=>"undefined"!=typeof window&&(Boolean(window.TelegramWebviewProxy)||Boolean(window.Telegram)||Boolean(window.TelegramWebviewProxyProto)),formatNativeUrl(e,t,r){if(CoreUtil.isHttpUrl(e))return this.formatUniversalUrl(e,t,r);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,r);return`${n}wc?uri=${encodeURIComponent(t)}`},formatUniversalUrl(e,t,r){if(!CoreUtil.isHttpUrl(e))return this.formatNativeUrl(e,t,r);let n=e;if(n.startsWith("https://t.me")){const e=Buffer$2.from(t).toString("base64").replace(/[=]/g,"");n.endsWith("/")&&(n=n.slice(0,-1)),this.setWalletConnectDeepLink(n,r);const o=new URL(n);o.searchParams.set("startapp",e);return o.toString()}n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,r);return`${n}wc?uri=${encodeURIComponent(t)}`},wait:async e=>new Promise((t=>{setTimeout(t,e)})),openHref(e,t){const r=this.isTelegram()?"_blank":t;window.open(e,r,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(CoreUtil.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch(e2){console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(CoreUtil.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch(e2){console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(CoreUtil.WALLETCONNECT_DEEPLINK_CHOICE)}catch(e2){console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{"undefined"!=typeof localStorage&&localStorage.setItem(CoreUtil.WCM_VERSION,"2.7.0")}catch(e2){console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=null==(e=RouterCtrl.state.data)?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},isEnabled="undefined"!=typeof location&&(location.hostname.includes("localhost")||location.protocol.includes("https")),state$6=proxy({enabled:isEnabled,userSessionId:"",events:[],connectedWalletId:void 0}),EventsCtrl={state:state$6,subscribe:e=>subscribe(state$6.events,(()=>e(snapshot(state$6.events[state$6.events.length-1])))),initialize(){state$6.enabled&&void 0!==(null==crypto?void 0:crypto.randomUUID)&&(state$6.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){state$6.connectedWalletId=e},click(e){if(state$6.enabled){const t={type:"CLICK",name:e.name,userSessionId:state$6.userSessionId,timestamp:Date.now(),data:e};state$6.events.push(t)}},track(e){if(state$6.enabled){const t={type:"TRACK",name:e.name,userSessionId:state$6.userSessionId,timestamp:Date.now(),data:e};state$6.events.push(t)}},view(e){if(state$6.enabled){const t={type:"VIEW",name:e.name,userSessionId:state$6.userSessionId,timestamp:Date.now(),data:e};state$6.events.push(t)}}},state$5=proxy({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),OptionsCtrl={state:state$5,subscribe:e=>subscribe(state$5,(()=>e(state$5))),setChains(e){state$5.chains=e},setWalletConnectUri(e){state$5.walletConnectUri=e},setIsCustomDesktop(e){state$5.isCustomDesktop=e},setIsCustomMobile(e){state$5.isCustomMobile=e},setIsDataLoaded(e){state$5.isDataLoaded=e},setIsUiLoaded(e){state$5.isUiLoaded=e},setIsAuth(e){state$5.isAuth=e}},state$4=proxy({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),ConfigCtrl={state:state$4,subscribe:e=>subscribe(state$4,(()=>e(state$4))),setConfig(e){var t,r;EventsCtrl.initialize(),OptionsCtrl.setChains(e.chains),OptionsCtrl.setIsAuth(Boolean(e.enableAuthMode)),OptionsCtrl.setIsCustomMobile(Boolean(null==(t=e.mobileWallets)?void 0:t.length)),OptionsCtrl.setIsCustomDesktop(Boolean(null==(r=e.desktopWallets)?void 0:r.length)),CoreUtil.setModalVersionInStorage(),Object.assign(state$4,e)}};var __defProp$2$1=Object.defineProperty,__getOwnPropSymbols$2=Object.getOwnPropertySymbols,__hasOwnProp$2=Object.prototype.hasOwnProperty,__propIsEnum$2=Object.prototype.propertyIsEnumerable,__defNormalProp$2=(e,t,r)=>t in e?__defProp$2$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues$2=(e,t)=>{for(var r in t||(t={}))__hasOwnProp$2.call(t,r)&&__defNormalProp$2(e,r,t[r]);if(__getOwnPropSymbols$2)for(var r of __getOwnPropSymbols$2(t))__propIsEnum$2.call(t,r)&&__defNormalProp$2(e,r,t[r]);return e};const W3M_API="https://explorer-api.walletconnect.com",SDK_TYPE="wcm",SDK_VERSION="js-2.7.0";async function fetchListings(e,t){const r=__spreadValues$2({sdkType:SDK_TYPE,sdkVersion:SDK_VERSION},t),n=new URL(e,W3M_API);n.searchParams.append("projectId",ConfigCtrl.state.projectId),Object.entries(r).forEach((([e,t])=>{t&&n.searchParams.append(e,String(t))}));return(await fetch(n)).json()}const ExplorerUtil={getDesktopListings:async e=>fetchListings("/w3m/v1/getDesktopListings",e),getMobileListings:async e=>fetchListings("/w3m/v1/getMobileListings",e),getInjectedListings:async e=>fetchListings("/w3m/v1/getInjectedListings",e),getAllListings:async e=>fetchListings("/w3m/v1/getAllListings",e),getWalletImageUrl:e=>`${W3M_API}/w3m/v1/getWalletImage/${e}?projectId=${ConfigCtrl.state.projectId}&sdkType=${SDK_TYPE}&sdkVersion=${SDK_VERSION}`,getAssetImageUrl:e=>`${W3M_API}/w3m/v1/getAssetImage/${e}?projectId=${ConfigCtrl.state.projectId}&sdkType=${SDK_TYPE}&sdkVersion=${SDK_VERSION}`};var __defProp$1$1=Object.defineProperty,__getOwnPropSymbols$1=Object.getOwnPropertySymbols,__hasOwnProp$1=Object.prototype.hasOwnProperty,__propIsEnum$1=Object.prototype.propertyIsEnumerable,__defNormalProp$1=(e,t,r)=>t in e?__defProp$1$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues$1=(e,t)=>{for(var r in t||(t={}))__hasOwnProp$1.call(t,r)&&__defNormalProp$1(e,r,t[r]);if(__getOwnPropSymbols$1)for(var r of __getOwnPropSymbols$1(t))__propIsEnum$1.call(t,r)&&__defNormalProp$1(e,r,t[r]);return e};const isMobile=CoreUtil.isMobile(),state$3=proxy({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),ExplorerCtrl={state:state$3,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=ConfigCtrl.state;if("NONE"===e||"ALL"===t&&!e)return state$3.recomendedWallets;if(CoreUtil.isArray(e)){const t={recommendedIds:e.join(",")},{listings:r}=await ExplorerUtil.getAllListings(t),n=Object.values(r);n.sort(((t,r)=>e.indexOf(t.id)-e.indexOf(r.id))),state$3.recomendedWallets=n}else{const{chains:e,isAuth:r}=OptionsCtrl.state,n=null==e?void 0:e.join(","),o=CoreUtil.isArray(t),i={page:1,sdks:r?"auth_v1":void 0,entries:CoreUtil.RECOMMENDED_WALLET_AMOUNT,chains:n,version:2,excludedIds:o?t.join(","):void 0},{listings:a}=isMobile?await ExplorerUtil.getMobileListings(i):await ExplorerUtil.getDesktopListings(i);state$3.recomendedWallets=Object.values(a)}return state$3.recomendedWallets},async getWallets(e){const t=__spreadValues$1({},e),{explorerRecommendedWalletIds:r,explorerExcludedWalletIds:n}=ConfigCtrl.state,{recomendedWallets:o}=state$3;if("ALL"===n)return state$3.wallets;o.length?t.excludedIds=o.map((e=>e.id)).join(","):CoreUtil.isArray(r)&&(t.excludedIds=r.join(",")),CoreUtil.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),OptionsCtrl.state.isAuth&&(t.sdks="auth_v1");const{page:i,search:a}=e,{listings:s,total:c}=isMobile?await ExplorerUtil.getMobileListings(t):await ExplorerUtil.getDesktopListings(t),u=Object.values(s),l=a?"search":"wallets";return state$3[l]={listings:[...state$3[l].listings,...u],total:c,page:null!=i?i:1},{listings:u,total:c}},getWalletImageUrl:e=>ExplorerUtil.getWalletImageUrl(e),getAssetImageUrl:e=>ExplorerUtil.getAssetImageUrl(e),resetSearch(){state$3.search={listings:[],total:0,page:1}}},state$2=proxy({open:!1}),ModalCtrl={state:state$2,subscribe:e=>subscribe(state$2,(()=>e(state$2))),open:async e=>new Promise((t=>{const{isUiLoaded:r,isDataLoaded:n}=OptionsCtrl.state;if(CoreUtil.removeWalletConnectDeepLink(),OptionsCtrl.setWalletConnectUri(null==e?void 0:e.uri),OptionsCtrl.setChains(null==e?void 0:e.chains),RouterCtrl.reset("ConnectWallet"),r&&n)state$2.open=!0,t();else{const e=setInterval((()=>{const r=OptionsCtrl.state;r.isUiLoaded&&r.isDataLoaded&&(clearInterval(e),state$2.open=!0,t())}),200)}})),close(){state$2.open=!1}};var __defProp$z=Object.defineProperty,__getOwnPropSymbols$3=Object.getOwnPropertySymbols,__hasOwnProp$3=Object.prototype.hasOwnProperty,__propIsEnum$3=Object.prototype.propertyIsEnumerable,__defNormalProp$3=(e,t,r)=>t in e?__defProp$z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues$3=(e,t)=>{for(var r in t||(t={}))__hasOwnProp$3.call(t,r)&&__defNormalProp$3(e,r,t[r]);if(__getOwnPropSymbols$3)for(var r of __getOwnPropSymbols$3(t))__propIsEnum$3.call(t,r)&&__defNormalProp$3(e,r,t[r]);return e};function isDarkMode(){return"undefined"!=typeof matchMedia&&matchMedia("(prefers-color-scheme: dark)").matches}const state$1=proxy({themeMode:isDarkMode()?"dark":"light"}),ThemeCtrl={state:state$1,subscribe:e=>subscribe(state$1,(()=>e(state$1))),setThemeConfig(e){const{themeMode:t,themeVariables:r}=e;t&&(state$1.themeMode=t),r&&(state$1.themeVariables=__spreadValues$3({},r))}},state=proxy({open:!1,message:"",variant:"success"}),ToastCtrl={state:state,subscribe:e=>subscribe(state,(()=>e(state))),openToast(e,t){state.open=!0,state.message=e,state.variant=t},closeToast(){state.open=!1}};class WalletConnectModal{constructor(e){this.openModal=ModalCtrl.open,this.closeModal=ModalCtrl.close,this.subscribeModal=ModalCtrl.subscribe,this.setTheme=ThemeCtrl.setThemeConfig,ThemeCtrl.setThemeConfig(e),ConfigCtrl.setConfig(e),this.initUi()}async initUi(){if("undefined"!=typeof window){await Promise.resolve().then((()=>index));const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),OptionsCtrl.setIsUiLoaded(!0)}}}let DefaultLogger$1=class{constructor(e="info"){this.logLevel="info",this.logLevel=e}setLogLevel(e){this.logLevel=e}getLogLevel(){return this.logLevel}error(e,...t){["error","warn","info","debug"].includes(this.logLevel)&&console.error(`[ERROR] ${e}`,...t)}warn(e,...t){["warn","info","debug"].includes(this.logLevel)&&console.warn(`[WARN] ${e}`,...t)}info(e,...t){["info","debug"].includes(this.logLevel)&&console.info(`[INFO] ${e}`,...t)}debug(e,...t){"debug"===this.logLevel&&console.debug(`[DEBUG] ${e}`,...t)}};class SessionNotFoundError extends Error{constructor(e){super(e),this.name="SessionNotFoundError"}}const clients={};class DAppSigner{constructor(e,t,r,n=LedgerId.MAINNET,o,i="debug"){this.accountId=e,this.signClient=t,this.topic=r,this.ledgerId=n,this.extensionId=o,this.logger=new DefaultLogger$1(i)}setLogLevel(e){this.logger instanceof DefaultLogger$1&&this.logger.setLogLevel(e)}_getHederaClient(){const e=this.ledgerId.toString();return clients[e]||(clients[e]=WebClient.forName(e)),clients[e]}get _signerAccountId(){return`${ledgerIdToCAIPChainId(this.ledgerId)}:${this.accountId.toString()}`}_getRandomNodes(e){const t=Object.values(this._getHederaClient().network).map((e=>"string"==typeof e?AccountId.fromString(e):e));for(let r=t.length-1;r>0;r--){const e=Math.floor(Math.random()*(r+1));[t[r],t[e]]=[t[e],t[r]]}return t.slice(0,e)}request(e){var t,r;if(!(null===(r=null===(t=null==this?void 0:this.signClient)||void 0===t?void 0:t.session)||void 0===r?void 0:r.get(this.topic)))throw this.logger.error("Session no longer exists, signer will be removed. Please reconnect to the wallet."),this.signClient.emit({topic:this.topic,event:{name:"session_delete",data:{topic:this.topic}},chainId:ledgerIdToCAIPChainId(this.ledgerId)}),new SessionNotFoundError("Session no longer exists. Please reconnect to the wallet.");return this.extensionId&&extensionOpen(this.extensionId),this.signClient.request({topic:this.topic,request:e,chainId:ledgerIdToCAIPChainId(this.ledgerId)})}getAccountId(){return this.accountId}getAccountKey(){throw new Error("Method not implemented.")}getLedgerId(){return this.ledgerId}getNetwork(){return this._getHederaClient().network}getMirrorNetwork(){return this._getHederaClient().mirrorNetwork}getAccountBalance(){return this.call((new AccountBalanceQuery).setAccountId(this.accountId))}getAccountInfo(){return this.call((new AccountInfoQuery).setAccountId(this.accountId))}getAccountRecords(){return this.call((new AccountRecordsQuery).setAccountId(this.accountId))}getMetadata(){return this.signClient.metadata}async sign(e,t={encoding:"utf-8"}){try{const r="base64"===t.encoding?Uint8ArrayToBase64String(e[0]):Uint8ArrayToString(e[0]),{signatureMap:n}=await this.request({method:HederaJsonRpcMethod.SignMessage,params:{signerAccountId:this._signerAccountId,message:r}}),o=base64StringToSignatureMap(n),i=new SignerSignature({accountId:this.getAccountId(),publicKey:PublicKey.fromBytes(o.sigPair[0].pubKeyPrefix),signature:o.sigPair[0].ed25519||o.sigPair[0].ECDSASecp256k1});return this.logger.debug("Data signed successfully"),[i]}catch(r){throw this.logger.error("Error signing data:",r),r}}async checkTransaction(e){throw new Error("Method not implemented.")}async populateTransaction(e){return e.setNodeAccountIds(this._getRandomNodes(10)).setTransactionId(TransactionId.generate(this.getAccountId()))}async signTransaction(e){let t;t=e.nodeAccountIds&&0!==e.nodeAccountIds.length?e.nodeAccountIds[0]:this._getRandomNodes(1)[0];const r=transactionToTransactionBody(e,t);if(!r)throw new Error("Failed to serialize transaction body");const n=transactionBodyToBase64String(r),{signatureMap:o}=await this.request({method:HederaJsonRpcMethod.SignTransaction,params:{signerAccountId:this._signerAccountId,transactionBody:n}}),i=base64StringToSignatureMap(o),a=base64StringToUint8Array(n),s=lib.proto.Transaction.encode({bodyBytes:a,sigMap:i}).finish();return Transaction.fromBytes(s)}async _tryExecuteTransactionRequest(e){try{const t=e.toBytes();this.logger.debug("Creating transaction from bytes",t,e);const r=Transaction.fromBytes(t);this.logger.debug("Executing transaction request",r);const n=await this.request({method:HederaJsonRpcMethod.SignAndExecuteTransaction,params:{signerAccountId:this._signerAccountId,transactionList:transactionToBase64String(r)}});return this.logger.debug("Transaction request completed successfully"),{result:TransactionResponse.fromJSON(n)}}catch(t){return this.logger.error("Error executing transaction request:",t),{error:t}}}async _parseQueryResponse(e,t){if(e instanceof AccountRecordsQuery){return t.split(",").map((e=>base64StringToUint8Array(e))).map((e=>TransactionRecord.fromBytes(e)))}const r=base64StringToUint8Array(t);if(e instanceof AccountBalanceQuery)return AccountBalance.fromBytes(r);if(e instanceof AccountInfoQuery)return AccountInfo.fromBytes(r);if(e instanceof TransactionReceiptQuery)return TransactionReceipt.fromBytes(r);if(e instanceof TransactionRecordQuery)return TransactionRecord.fromBytes(r);throw new Error("Unsupported query type")}async executeReceiptQueryFromRequest(e){try{const t=this.ledgerId===LedgerId.MAINNET?WebClient.forMainnet():WebClient.forTestnet(),r=TransactionReceiptQuery.fromBytes(e.toBytes());return{result:await r.execute(t)}}catch(t){return{error:t}}}async _tryExecuteQueryRequest(e){try{const t=e instanceof TransactionReceiptQuery;if(t){this.logger.debug("Attempting to execute free receipt query",e);const t=await this.executeReceiptQueryFromRequest(e);if(!(null==t?void 0:t.error))return{result:t.result};this.logger.error("Error executing free receipt query. Sending to wallet.",t.error)}const r=t?TransactionReceiptQuery.fromBytes(e.toBytes()):Query.fromBytes(e.toBytes());this.logger.debug("Executing query request",r,queryToBase64String(r),t);const n=await this.request({method:HederaJsonRpcMethod.SignAndExecuteQuery,params:{signerAccountId:this._signerAccountId,query:queryToBase64String(r)}});return this.logger.debug("Query request completed successfully",n),{result:this._parseQueryResponse(r,n.response)}}catch(t){return this.logger.error("Error executing query request:",t),{error:t}}}async call(e){var t,r,n,o,i,a,s,c,u;const l=e instanceof TransactionReceiptQuery;let d;if(!l&&(d=await this._tryExecuteTransactionRequest(e),d.result))return d.result;const f=await this._tryExecuteQueryRequest(e);if(f.result)return f.result;if(l)throw new Error("Error executing receipt query: \n"+JSON.stringify({queryError:{name:null===(t=f.error)||void 0===t?void 0:t.name,message:null===(r=f.error)||void 0===r?void 0:r.message,stack:null===(n=f.error)||void 0===n?void 0:n.stack}}));throw new Error("Error executing transaction or query: \n"+JSON.stringify({txError:{name:null===(o=null==d?void 0:d.error)||void 0===o?void 0:o.name,message:null===(i=null==d?void 0:d.error)||void 0===i?void 0:i.message,stack:null===(a=null==d?void 0:d.error)||void 0===a?void 0:a.stack},queryError:{name:null===(s=f.error)||void 0===s?void 0:s.name,message:null===(c=f.error)||void 0===c?void 0:c.message,stack:null===(u=f.error)||void 0===u?void 0:u.stack}},null,2))}}class DAppConnector{constructor(e,t,r,n,o,i,a="debug"){this.network=LedgerId.TESTNET,this.supportedMethods=[],this.supportedEvents=[],this.supportedChains=[],this.extensions=[],this.onSessionIframeCreated=null,this.signers=[],this.isInitializing=!1,this.abortableConnect=async e=>new Promise((async(t,r)=>{const n=48e4,o=setTimeout((()=>{QRCodeModal.close(),r(new Error("Connect timed out after 480000(ms)"))}),n);try{return t(await e())}catch(i){r(i)}finally{clearTimeout(o)}})),this.logger=new DefaultLogger$1(a),this.dAppMetadata=e,this.network=t,this.projectId=r,this.supportedMethods=null!=n?n:Object.values(HederaJsonRpcMethod),this.supportedEvents=null!=o?o:[],this.supportedChains=null!=i?i:[],this.extensions=[],this.walletConnectModal=new WalletConnectModal({projectId:r,chains:i}),findExtensions(((e,t)=>{this.extensions.push(Object.assign(Object.assign({},e),{available:!0,availableInIframe:t}))}))}setLogLevel(e){this.logger instanceof DefaultLogger$1&&this.logger.setLogLevel(e)}async init({logger:e}={}){try{if(this.isInitializing=!0,!this.projectId)throw new Error("Project ID is not defined");this.walletConnectClient=await _e.init({logger:e,relayUrl:"wss://relay.walletconnect.com",projectId:this.projectId,metadata:this.dAppMetadata});const t=this.walletConnectClient.session.getAll();t.length>0?this.signers=t.flatMap((e=>this.createSigners(e))):this.checkIframeConnect(),this.walletConnectClient.on("session_event",this.handleSessionEvent.bind(this)),this.walletConnectClient.on("session_update",this.handleSessionUpdate.bind(this)),this.walletConnectClient.on("session_delete",this.handleSessionDelete.bind(this)),this.walletConnectClient.core.events.on("session_delete",this.handleSessionDelete.bind(this)),this.walletConnectClient.core.pairing.events.on("pairing_delete",this.handlePairingDelete.bind(this))}catch(e2){this.logger.error("Error initializing DAppConnector:",e2)}finally{this.isInitializing=!1}}getSigner(e){if(this.isInitializing)throw new Error("DAppConnector is not initialized yet. Try again later.");const t=this.signers.find((t=>t.getAccountId().equals(e)));if(!t)throw new Error("Signer is not found for this accountId");return t}async connectQR(e){return this.abortableConnect((async()=>{try{const{uri:t,approval:r}=await this.connectURI(e);if(!t)throw new Error("URI is not defined");QRCodeModal.open(t,(()=>{throw new Error("User rejected pairing")})),await this.onSessionConnected(await r())}finally{QRCodeModal.close()}}))}async openModal(e){try{const{uri:t,approval:r}=await this.connectURI(e);this.walletConnectModal.openModal({uri:t});const n=await r();return await this.onSessionConnected(n),n}finally{this.walletConnectModal.closeModal()}}async connect(e,t,r){return this.abortableConnect((async()=>{var n;const{uri:o,approval:i}=await this.connectURI(t);if(!o)throw new Error("URI is not defined");e(o);const a=await i();if(r){const e=Object.assign(Object.assign({},a.sessionProperties),{extensionId:r});a.sessionProperties=e,await(null===(n=this.walletConnectClient)||void 0===n?void 0:n.session.update(a.topic,{sessionProperties:e}))}return await this.onSessionConnected(a),a}))}async connectExtension(e,t){const r=this.extensions.find((t=>t.id===e));if(!r||!r.available)throw new Error("Extension is not available");return this.connect((e=>{extensionConnect(r.id,r.availableInIframe,e)}),t,r.availableInIframe?void 0:e)}validateSession(e){try{if(!this.walletConnectClient)return!1;const t=this.walletConnectClient.session.get(e),r=this.signers.some((t=>t.topic===e));return t?!!r||(this.logger.warn(`Session exists but no signer found for topic: ${e}`),!1):(r&&(this.logger.warn(`Signer exists but no session found for topic: ${e}`),this.handleSessionDelete({topic:e})),!1)}catch(e2){return this.logger.error("Error validating session:",e2),!1}}validateAndRefreshSigners(){this.signers=this.signers.filter((e=>this.validateSession(e.topic)))}async checkIframeConnect(){const e=this.extensions.find((e=>e.availableInIframe));if(e){const t=await this.connectExtension(e.id);this.onSessionIframeCreated&&this.onSessionIframeCreated(t)}}async disconnect(e){try{if(!this.walletConnectClient)throw new Error("WalletConnect is not initialized");return await this.walletConnectClient.disconnect({topic:e,reason:_$6("USER_DISCONNECTED")}),!0}catch(e2){return this.logger.error("Either the session was already disconnected or the topic is invalid",e2),!1}}async disconnectAll(){if(!this.walletConnectClient)throw new Error("WalletConnect is not initialized");const e=this.walletConnectClient.session.getAll(),t=this.walletConnectClient.core.pairing.getPairings();if(!(null==e?void 0:e.length)&&!(null==t?void 0:t.length))throw new Error("There is no active session/pairing. Connect to the wallet at first.");const r=[];for(const n of this.walletConnectClient.session.getAll()){this.logger.info(`Disconnecting from session: ${n}`);const e=this.disconnect(n.topic);r.push(e)}for(const n of t){const e=this.disconnect(n.topic);r.push(e)}await Promise.all(r),this.signers=[]}createSigners(e){return accountAndLedgerFromSession(e).map((({account:t,network:r})=>{var n;return new DAppSigner(t,this.walletConnectClient,e.topic,r,null===(n=e.sessionProperties)||void 0===n?void 0:n.extensionId,this.logger instanceof DefaultLogger$1?this.logger.getLogLevel():"debug")}))}async onSessionConnected(e){const t=this.createSigners(e);for(const r of t){const e=this.signers.filter((e=>{var t,n;const o=(null===(t=null==e?void 0:e.getAccountId())||void 0===t?void 0:t.toString())===(null===(n=null==r?void 0:r.getAccountId())||void 0===n?void 0:n.toString()),i=r.extensionId===e.extensionId,a=r.getMetadata(),s=e.getMetadata(),c=(null==a?void 0:a.name)===(null==s?void 0:s.name);return e.topic===r.topic&&this.logger.error("The topic was already connected. This is a weird error. Please report it.",r.getAccountId().toString()),o&&i&&c}));for(const t of e)this.logger.debug(`Disconnecting duplicate signer for account ${t.getAccountId().toString()}`),await this.disconnect(t.topic),this.signers=this.signers.filter((e=>e.topic!==t.topic))}this.signers.push(...t),this.logger.debug(`Current signers after connection: ${this.signers.map((e=>`${e.getAccountId().toString()}:${e.topic}`)).join(", ")}`)}async connectURI(e){if(!this.walletConnectClient)throw new Error("WalletConnect is not initialized");return this.walletConnectClient.connect({pairingTopic:e,requiredNamespaces:networkNamespaces(this.network,this.supportedMethods,this.supportedEvents)})}async request({method:e,params:t}){var r,n,o;let i;if(this.logger.debug(`Requesting method: ${e} with params: ${JSON.stringify(t)}`),null==t?void 0:t.signerAccountId){const e=null===(n=null===(r=null==t?void 0:t.signerAccountId)||void 0===r?void 0:r.split(":"))||void 0===n?void 0:n.pop();if(i=this.signers.find((t=>{var r;return(null===(r=null==t?void 0:t.getAccountId())||void 0===r?void 0:r.toString())===e})),this.logger.debug(`Found signer: ${null===(o=null==i?void 0:i.getAccountId())||void 0===o?void 0:o.toString()}`),!i)throw new Error(`Signer not found for account ID: ${null==t?void 0:t.signerAccountId}. Did you use the correct format? e.g hedera:<network>:<address> `)}else i=this.signers[this.signers.length-1];if(!i)throw new Error("There is no active session. Connect to the wallet at first.");return this.logger.debug(`Using signer: ${i.getAccountId().toString()}: ${i.topic} - about to request.`),await i.request({method:e,params:t})}async getNodeAddresses(){return await this.request({method:HederaJsonRpcMethod.GetNodeAddresses,params:void 0})}async executeTransaction(e){return await this.request({method:HederaJsonRpcMethod.ExecuteTransaction,params:e})}async signMessage(e){return await this.request({method:HederaJsonRpcMethod.SignMessage,params:e})}async signAndExecuteQuery(e){return await this.request({method:HederaJsonRpcMethod.SignAndExecuteQuery,params:e})}async signAndExecuteTransaction(e){return await this.request({method:HederaJsonRpcMethod.SignAndExecuteTransaction,params:e})}async signTransaction(e){var t,r;if("string"==typeof(null==e?void 0:e.transactionBody))return this.logger.warn("Transaction body is a string. This is not recommended, please migrate to passing a transaction object directly."),await this.request({method:HederaJsonRpcMethod.SignTransaction,params:e});if((null==e?void 0:e.transactionBody)instanceof Transaction){const n=null===(r=null===(t=null==e?void 0:e.signerAccountId)||void 0===t?void 0:t.split(":"))||void 0===r?void 0:r.pop(),o=this.signers.find((e=>{var t;return(null===(t=null==e?void 0:e.getAccountId())||void 0===t?void 0:t.toString())===n}));if(!o)throw new Error(`No signer found for account ${n}`);if(!(null==e?void 0:e.transactionBody))throw new Error("No transaction provided");return await o.signTransaction(e.transactionBody)}throw new Error("Transaction sent in incorrect format. Ensure transaction body is either a base64 transaction body or Transaction object.")}handleSessionEvent(e){this.logger.debug("Session event received:",e),this.validateAndRefreshSigners()}handleSessionUpdate({topic:e,params:t}){const{namespaces:r}=t,n=this.walletConnectClient.session.get(e),o=Object.assign(Object.assign({},n),{namespaces:r});this.logger.info("Session updated:",o),this.signers=this.signers.filter((t=>t.topic!==e)),this.signers.push(...this.createSigners(o))}handleSessionDelete(e){this.logger.info("Session deleted:",e);let t=!1;if(this.signers=this.signers.filter((r=>r.topic!==e.topic||(t=!0,!1))),t){try{this.disconnect(e.topic)}catch(e2){this.logger.error("Error disconnecting session:",e2)}this.logger.info("Session deleted and signer removed")}}handlePairingDelete(e){this.logger.info("Pairing deleted:",e),this.signers=this.signers.filter((t=>t.topic!==e.topic));try{this.disconnect(e.topic)}catch(e2){this.logger.error("Error disconnecting pairing:",e2)}this.logger.info("Pairing deleted by wallet")}}class DefaultLogger{constructor(){this.logLevel="info"}setLogLevel(e){this.logLevel=e}error(e,...t){["error","warn","info","debug"].includes(this.logLevel)&&console.error(`[ERROR] ${e}`,...t)}warn(e,...t){["warn","info","debug"].includes(this.logLevel)&&console.warn(`[WARN] ${e}`,...t)}info(e,...t){["info","debug"].includes(this.logLevel)&&console.info(`[INFO] ${e}`,...t)}debug(e,...t){"debug"===this.logLevel&&console.debug(`[DEBUG] ${e}`,...t)}}var fetchRetry_umd={exports:{}};!function(e,t){e.exports=function(){function e(e){return Number.isInteger(e)&&e>=0}function t(e){this.name="ArgumentError",this.message=e}return function(r,n){if(n=n||{},"function"!=typeof r)throw new t("fetch must be a function");if("object"!=typeof n)throw new t("defaults must be an object");if(void 0!==n.retries&&!e(n.retries))throw new t("retries must be a positive integer");if(void 0!==n.retryDelay&&!e(n.retryDelay)&&"function"!=typeof n.retryDelay)throw new t("retryDelay must be a positive integer or a function returning a positive integer");if(void 0!==n.retryOn&&!Array.isArray(n.retryOn)&&"function"!=typeof n.retryOn)throw new t("retryOn property expects an array or function");var o={retries:3,retryDelay:1e3,retryOn:[]};return n=Object.assign(o,n),function(o,i){var a=n.retries,s=n.retryDelay,c=n.retryOn;if(i&&void 0!==i.retries){if(!e(i.retries))throw new t("retries must be a positive integer");a=i.retries}if(i&&void 0!==i.retryDelay){if(!e(i.retryDelay)&&"function"!=typeof i.retryDelay)throw new t("retryDelay must be a positive integer or a function returning a positive integer");s=i.retryDelay}if(i&&i.retryOn){if(!Array.isArray(i.retryOn)&&"function"!=typeof i.retryOn)throw new t("retryOn property expects an array or function");c=i.retryOn}return new Promise((function(e,t){var n=function(n){var s="undefined"!=typeof Request&&o instanceof Request?o.clone():o;r(s,i).then((function(r){if(Array.isArray(c)&&-1===c.indexOf(r.status))e(r);else if("function"==typeof c)try{return Promise.resolve(c(n,null,r)).then((function(t){t?u(n,null,r):e(r)})).catch(t)}catch(o){t(o)}else n<a?u(n,null,r):e(r)})).catch((function(e){if("function"==typeof c)try{Promise.resolve(c(n,e,null)).then((function(r){r?u(n,e,null):t(e)})).catch((function(e){t(e)}))}catch(r){t(r)}else n<a?u(n,e,null):t(e)}))};function u(e,t,r){var o="function"==typeof s?s(e,t,r):s;setTimeout((function(){n(++e)}),o)}n(0)}))}}}()}(fetchRetry_umd);var fetchRetry_umdExports=fetchRetry_umd.exports;const retryFetch=getDefaultExportFromCjs$1(fetchRetry_umdExports),fetchWithRetry=()=>retryFetch(fetch,{retries:3});var Name=(e=>(e.Contractcall="CONTRACTCALL",e.Cryptotransfer="CRYPTOTRANSFER",e))(Name||{}),Result=(e=>(e.Success="SUCCESS",e))(Result||{});class HashinalsWalletConnectSDK{constructor(e,t){this.extensionCheckInterval=null,this.hasCalledExtensionCallback=!1,this.logger=e||new DefaultLogger,this.network=t||LedgerId.MAINNET}get dAppConnector(){return HashinalsWalletConnectSDK.dAppConnectorInstance}static getInstance(e,t){let r=null==HashinalsWalletConnectSDK?void 0:HashinalsWalletConnectSDK.instance;return r||(HashinalsWalletConnectSDK.instance=new HashinalsWalletConnectSDK(e,t),r=HashinalsWalletConnectSDK.instance),t&&r.setNetwork(t),r}setLogger(e){this.logger=e}setNetwork(e){this.network=e}getNetwork(){return this.network}setLogLevel(e){this.logger instanceof DefaultLogger?this.logger.setLogLevel(e):this.logger.warn("setLogLevel is only available for the default logger")}async init(e,t,r,n){const o=r||this.network,i="mainnet"===o.toString();return HashinalsWalletConnectSDK.dAppConnectorInstance||(HashinalsWalletConnectSDK.dAppConnectorInstance=new DAppConnector(t,o,e,Object.values(HederaJsonRpcMethod),[HederaSessionEvent.ChainChanged,HederaSessionEvent.AccountsChanged],[i?HederaChainId.Mainnet:HederaChainId.Testnet],"debug"),await HashinalsWalletConnectSDK.dAppConnectorInstance.init({logger:"error"}),HashinalsWalletConnectSDK.dAppConnectorInstance.onSessionIframeCreated=e=>{this.logger.info("new session from from iframe",e),this.handleNewSession(e),n&&n(e)},this.logger.info(`Hedera Wallet Connect SDK initialized on ${o}`)),HashinalsWalletConnectSDK.dAppConnectorInstance}async connect(){this.ensureInitialized();const e=await this.dAppConnector.openModal();return this.handleNewSession(e),e}async disconnect(){var e,t;try{this.ensureInitialized();const r=this.getAccountInfo(),n=null==r?void 0:r.accountId,o=null==r?void 0:r.network,i=null==(e=null==this?void 0:this.dAppConnector)?void 0:e.signers.find((e=>e.getAccountId().toString()===n));return await(null==(t=this.dAppConnector)?void 0:t.disconnect(null==i?void 0:i.topic)),this.logger.info(`Disconnected from ${n} on ${o}`),!0}catch(e2){return this.logger.error("Failed to disconnect",e2),!1}}async disconnectAll(){var e;try{return this.ensureInitialized(),await(null==(e=this.dAppConnector)?void 0:e.disconnectAll()),this.logger.info("Disconnected from all wallets"),!0}catch(e2){return this.logger.error("Failed to disconnect",e2),!1}}async executeTransaction(e,t=!1){this.ensureInitialized();const r=this.getAccountInfo(),n=null==r?void 0:r.accountId,o=this.dAppConnector.signers.find((e=>e.getAccountId().toString()===n));if(t){const t=await e.executeWithSigner(o);return await t.getReceiptWithSigner(o)}{const t=await e.freezeWithSigner(o),r=await t.executeWithSigner(o);return await r.getReceiptWithSigner(o)}}async executeTransactionWithErrorHandling(e,t){var r;try{return{result:await this.executeTransaction(e,t),error:void 0}}catch(e2){const t=null==(r=e2.message)?void 0:r.toLowerCase();if(this.logger.error("Failed to execute transaction",e2),this.logger.error("Failure reason for transaction is",t),t.includes("insufficient payer balance"))return{result:void 0,error:"Insufficient balance to complete the transaction."};if(t.includes("reject"))return{result:void 0,error:"You rejected the transaction"};if(t.includes("invalid signature"))return{result:void 0,error:"Invalid signature. Please check your account and try again."};if(t.includes("transaction expired"))return{result:void 0,error:"Transaction expired. Please try again."};if(t.includes("account not found"))return{result:void 0,error:"Account not found. Please check the account ID and try again."};if(t.includes("unauthorized"))return{result:void 0,error:"Unauthorized. You may not have the necessary permissions for this action."};if(t.includes("busy"))return{result:void 0,error:"The network is busy. Please try again later."};if(t.includes("invalid transaction"))return{result:void 0,error:"Invalid transaction. Please check your inputs and try again."}}}async submitMessageToTopic(e,t,r){this.ensureInitialized();let n=(new TopicMessageSubmitTransaction).setTopicId(TopicId.fromString(e)).setMessage(t);return r&&(n=await n.sign(r)),this.executeTransaction(n)}async transferHbar(e,t,r){this.ensureInitialized();const n=(new TransferTransaction).setTransactionId(TransactionId.generate(e)).addHbarTransfer(AccountId.fromString(e),new Hbar(-r)).addHbarTransfer(AccountId.fromString(t),new Hbar(r));return this.executeTransaction(n)}async executeSmartContract(e,t,r,n=1e5){this.ensureInitialized();const o=(new ContractExecuteTransaction).setContractId(ContractId.fromString(e)).setGas(n).setFunction(t,r);return this.executeTransaction(o)}handleNewSession(e){var t,r,n;const o=null==(n=null==(r=null==(t=e.namespaces)?void 0:t.hedera)?void 0:r.accounts)?void 0:n[0],i=null==o?void 0:o.split(":"),a=i.pop(),s=i.pop();this.logger.info("sessionAccount is",a,s),a?this.saveConnectionInfo(a,s):this.logger.error("No account id found in the session")}getNetworkPrefix(){const e=this.getAccountInfo(),t=null==e?void 0:e.network;if(!t){this.logger.warn("Network is not set on SDK, defaulting.");const e=localStorage.getItem("connectedNetwork");return e||"mainnet-public"}return t!==this.network&&(this.logger.warn("Detected network mismatch, reverting to signer network",t),this.network=t),t.isMainnet()?"mainnet-public":"testnet"}async requestAccount(e){try{const t=`https://${this.getNetworkPrefix()}.mirrornode.hedera.com/api/v1/accounts/${e}`,r=await fetchWithRetry()(t);if(!r.ok)throw new Error(`Failed to make request to mirror node for account: ${r.status}`);return await r.json()}catch(e2){throw this.logger.error("Failed to fetch account",e2),e2}}async getAccountBalance(){this.ensureInitialized();const e=this.getAccountInfo(),t=null==e?void 0:e.accountId;if(!t)return null;const r=await this.requestAccount(t);if(!r)throw new Error("Failed to fetch account. Try again or check if the Account ID is valid.");const n=r.balance.balance/10**8;return Number(n).toLocaleString("en-US")}getAccountInfo(){var e,t;const{accountId:r}=this.loadConnectionInfo();if(!r)return null;const n=null==(e=null==this?void 0:this.dAppConnector)?void 0:e.signers;if(!(null==n?void 0:n.length))return null;const o=this.dAppConnector.signers.find((e=>e.getAccountId().toString()===r)),i=null==(t=null==o?void 0:o.getAccountId())?void 0:t.toString();if(!i)return null;return{accountId:i,network:o.getLedgerId()}}async createTopic(e,t,r){this.ensureInitialized();let n=(new TopicCreateTransaction).setTopicMemo(e||"");if(t){const e=PrivateKey.fromString(t);n.setAdminKey(e.publicKey),n=await n.sign(e)}r&&n.setSubmitKey(PrivateKey.fromString(r).publicKey);return(await this.executeTransaction(n)).topicId.toString()}async createToken(e,t,r,n,o,i,a){this.ensureInitialized();let s=(new TokenCreateTransaction).setTokenName(e).setTokenSymbol(t).setDecimals(n).setInitialSupply(r).setTreasuryAccountId(AccountId.fromString(o)).setTokenType(TokenType.NonFungibleUnique).setSupplyType(TokenSupplyType.Finite);a&&(s=s.setSupplyKey(PrivateKey.fromString(a))),i&&(s=s.setAdminKey(PrivateKey.fromString(i)),s=await s.sign(PrivateKey.fromString(i)));return(await this.executeTransaction(s)).tokenId.toString()}async mintNFT(e,t,r){this.ensureInitialized();let n=await(new TokenMintTransaction).setTokenId(e).setMetadata([Buffer$1$1.from(t,"utf-8")]).sign(r);return this.executeTransaction(n)}async getMessages(e,t,r=!1,n){var o,i;const a=`${`https://${n||this.getNetworkPrefix()}.mirrornode.hedera.com`}/api/v1/topics/${e}/messages?limit=200${Number(t)>0&&!r?`×tamp=gt:${t}`:""}`;try{const t=await fetchWithRetry()(a);if(!t.ok)throw new Error(`Failed to make request to mirror node: ${t.status}`);const n=await t.json(),s=(null==n?void 0:n.messages)||[],c=null==(o=null==n?void 0:n.links)?void 0:o.next,u=s.map((e=>({...JSON.parse(atob(e.message)),payer:e.payer_account_id,created:new Date(1e3*Number(e.consensus_timestamp)),consensus_timestamp:e.consensus_timestamp,sequence_number:e.sequence_number})));if(c){const t=await this.getMessages(e,Number(null==(i=u[u.length-1])?void 0:i.consensus_timestamp),r);u.push(...t.messages)}return{messages:u.sort(((e,t)=>e.sequence_number-t.sequence_number)),error:""}}catch(s){return this.logger.error("Error fetching topic data:",s),{messages:[],error:s.toString()}}}async signMessage(e){const t=this.dAppConnector;if(!t)throw new Error("No active connection or signer");const r=this.getAccountInfo(),n=null==r?void 0:r.accountId,o={signerAccountId:`hedera:${this.network}:${n}`,message:e};return{userSignature:(await t.signMessage(o)).signatureMap}}saveConnectionInfo(e,t){if(e){const r=null==t?void 0:t.replace(/['"]+/g,"");localStorage.setItem("connectedNetwork",r),localStorage.setItem("connectedAccountId",e)}else localStorage.removeItem("connectedAccountId"),localStorage.removeItem("connectedNetwork")}loadConnectionInfo(){return{accountId:localStorage.getItem("connectedAccountId"),network:localStorage.getItem("connectedNetwork")}}async connectWallet(e,t,r){try{await this.init(e,t,r);const n=await this.connect(),o=this.getAccountInfo(),i=null==o?void 0:o.accountId,a=await this.getAccountBalance(),s=this.getNetworkPrefix();return this.saveConnectionInfo(i,s),{accountId:i,balance:a,session:n}}catch(n){throw this.logger.error("Failed to connect wallet:",n),n}}async disconnectWallet(e=!0){try{const t=await this.disconnect();return t&&e&&localStorage.clear(),this.saveConnectionInfo(void 0),t}catch(t){return this.logger.error("Failed to disconnect wallet:",t),!1}}async initAccount(e,t,r,n=()=>{}){const{accountId:o,network:i}=this.loadConnectionInfo();if(o&&i)try{const a="mainnet"===i?LedgerId.MAINNET:LedgerId.TESTNET,s=r||a;await this.init(e,t,s,n);return{accountId:o,balance:await this.getAccountBalance()}}catch(a){return this.logger.error("Failed to reconnect:",a),this.saveConnectionInfo(void 0,void 0),null}else if(r)try{this.logger.info("initializing normally through override.",r),await this.init(e,t,r,n),this.logger.info("initialized",r),await this.connectViaDappBrowser(),this.logger.info("connected via dapp browser")}catch(a){return this.logger.error("Failed to fallback connect:",a),this.saveConnectionInfo(void 0,void 0),null}return null}subscribeToExtensions(e){return this.extensionCheckInterval&&clearInterval(this.extensionCheckInterval),this.hasCalledExtensionCallback=!1,this.extensionCheckInterval=setInterval((()=>{var t;const r=((null==(t=this.dAppConnector)?void 0:t.extensions)||[]).find((e=>e.availableInIframe));r&&!this.hasCalledExtensionCallback&&(this.hasCalledExtensionCallback=!0,e(r),this.extensionCheckInterval&&(clearInterval(this.extensionCheckInterval),this.extensionCheckInterval=null))}),1e3),()=>{this.extensionCheckInterval&&(clearInterval(this.extensionCheckInterval),this.extensionCheckInterval=null),this.hasCalledExtensionCallback=!1}}async connectViaDappBrowser(){const e=this.dAppConnector.extensions||[],t=e.find((e=>(this.logger.info("Checking extension",e),e.availableInIframe)));this.logger.info("extensions are",e,t),t?await this.connectToExtension(t):this.subscribeToExtensions((async e=>{await this.connectToExtension(e)}))}async connectToExtension(e){this.logger.info("found extension, connecting to iframe.",e);const t=await this.dAppConnector.connectExtension(e.id),r=this.dAppConnector.onSessionIframeCreated;r&&r(t)}ensureInitialized(){if(!this.dAppConnector)throw new Error("SDK not initialized. Call init() first.")}static run(){try{"undefined"!=typeof window&&(window.HashinalsWalletConnectSDK=HashinalsWalletConnectSDK.getInstance(),window.HashgraphSDK=HashgraphSDK)}catch(e2){console.error("[ERROR]: failed setting sdk on window")}}async transferToken(e,t,r,n){this.ensureInitialized();const o=(new TransferTransaction).setTransactionId(TransactionId.generate(t)).addTokenTransfer(TokenId.fromString(e),AccountId.fromString(t),-n).addTokenTransfer(TokenId.fromString(e),AccountId.fromString(r),n);return this.executeTransaction(o)}async createAccount(e){this.ensureInitialized();const t=(new AccountCreateTransaction).setInitialBalance(new Hbar(e));return this.executeTransaction(t)}async associateTokenToAccount(e,t){this.ensureInitialized();const r=(new TokenAssociateTransaction).setAccountId(AccountId.fromString(e)).setTokenIds([TokenId.fromString(t)]);return this.executeTransaction(r)}async dissociateTokenFromAccount(e,t){this.ensureInitialized();const r=(new TokenDissociateTransaction).setAccountId(AccountId.fromString(e)).setTokenIds([TokenId.fromString(t)]);return this.executeTransaction(r)}async updateAccount(e,t){this.ensureInitialized();const r=(new AccountUpdateTransaction).setAccountId(AccountId.fromString(e)).setMaxAutomaticTokenAssociations(t);return this.executeTransaction(r)}async approveAllowance(e,t,r,n){this.ensureInitialized();const o=(new AccountAllowanceApproveTransaction).approveTokenAllowance(TokenId.fromString(t),AccountId.fromString(n),AccountId.fromString(e),r);return this.executeTransaction(o)}async getAccountTokens(e){var t,r;this.ensureInitialized();const n=`https://${this.getNetworkPrefix()}.mirrornode.hedera.com`,o=`${n}/api/v1/accounts/${e}/tokens?limit=200`;try{const e=await fetchWithRetry()(o);if(!e.ok)throw new Error(`Failed to make request to mirror node for account tokens: ${e.status}`);const i=await e.json(),a=[];for(const t of i.tokens)t.token_id&&a.push({tokenId:t.token_id,balance:t.balance,decimals:t.decimals,formatted_balance:(t.balance/10**t.decimals).toLocaleString("en-US"),created_timestamp:new Date(1e3*Number(t.created_timestamp))});let s=null==(t=i.links)?void 0:t.next;for(;s;){const e=`${n}${s}`,t=await fetchWithRetry()(e);if(!t.ok)throw new Error(`Failed to make request to mirror node for account tokens: ${t.status}, page: ${e}`);const o=await t.json();for(const r of o.tokens)r.token_id&&a.push({tokenId:r.token_id,balance:r.balance,decimals:r.decimals,formatted_balance:(r.balance/10**r.decimals).toLocaleString("en-US"),created_timestamp:new Date(1e3*Number(r.created_timestamp))});s=null==(r=o.links)?void 0:r.next}return{tokens:a}}catch(i){throw this.logger.error("Error fetching account tokens:",i),i}}async getTransaction(e){try{const t=`https://${this.getNetworkPrefix()}.mirrornode.hedera.com/api/v1/transactions/${e}`;this.logger.debug("Fetching transaction",t);const r=await fetchWithRetry()(t);if(!r.ok)throw new Error(`Failed to fetch transaction: ${r.status}`);return await r.json()}catch(e2){return this.logger.error("Failed to get transaction",e2),null}}async getTransactionByTimestamp(e){var t;try{const r=`https://${this.getNetworkPrefix()}.mirrornode.hedera.com/api/v1/transactions?timestamp=${e}`;this.logger.debug("Fetching transaction by timestamp",r);const n=await fetchWithRetry()(r);if(!n.ok)throw new Error(`Failed to fetch transaction by timestamp: ${n.status}`);const o=await n.json(),i=null==(t=null==o?void 0:o.transactions)?void 0:t[0];return i?await this.getTransaction(i.transaction_id):null}catch(e2){return this.logger.error("Failed to get transaction by timestamp",e2),null}}async getAccountNFTs(e,t){var r,n,o;try{const i=this.getNetworkPrefix(),a=`https://${i}.mirrornode.hedera.com/api/v1/accounts/${e}/nfts?limit=200${t?`&token.id=${t}`:""}`,s=await fetchWithRetry()(a);if(!s.ok)throw new Error(`Failed to fetch NFTs for account: ${s.status}`);const c=await s.json();let u=(null==(r=null==c?void 0:c.links)?void 0:r.next)||null,l=c.nfts;for(;u;)try{const e=await fetchWithRetry()(`https://${i}.mirrornode.hedera.com${u}`);if(!e.ok)throw new Error(`Failed to fetch next page of NFTs: ${e.status}`);const t=await e.json();l=[...l,...(null==t?void 0:t.nfts)||[]],u=(null==(n=null==t?void 0:t.links)?void 0:n.next)&&u!==(null==(o=null==t?void 0:t.links)?void 0:o.next)?t.links.next:null}catch(e2){this.logger.error("Failed to fetch next page of NFTs",e2);break}return l.map((e=>{try{e.token_uri=Buffer$1$1.from(e.metadata,"base64").toString("ascii")}catch(e2){this.logger.error("Failed to decode NFT metadata",e2)}return e}))}catch(e2){return this.logger.error("Failed to get account NFTs",e2),[]}}async validateNFTOwnership(e,t,r){return(await this.getAccountNFTs(t,r)).find((t=>t.token_id===r&&t.serial_number.toString()===e))||null}async readSmartContract(e,t,r,n=!0,o=0){try{const i=this.getNetworkPrefix(),a={block:"latest",data:e,estimate:n,from:t.toSolidityAddress(),to:r.toSolidityAddress(),value:o};n||(a.gas=3e5,a.gasPrice=1e8);const s=`https://${i}.mirrornode.hedera.com/api/v1/contracts/call`,c=await fetchWithRetry()(s,{method:"POST",body:JSON.stringify(a),headers:{"Content-Type":"application/json"}});if(!c.ok)throw new Error(`Failed to make contract call: ${c.status}`);return await c.json()}catch(e2){return this.logger.error("Failed to make contract call",e2),null}}}HashinalsWalletConnectSDK.run();
|
|
106
|
+
***************************************************************************** */function __extends(e,t){function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var __assign=function(){return __assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},__assign.apply(this,arguments)};function __rest(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}function __decorate(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function __param(e,t){return function(r,n){t(r,n,e)}}function __metadata(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function __awaiter(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e2){i(e2)}}function s(e){try{c(n.throw(e))}catch(e2){i(e2)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function __generator(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e2){i=[6,e2],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function __createBinding(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}function __exportStar(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||(t[r]=e[r])}function __values(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(s){o={error:s}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}function __spreadArrays$1(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function __await(e){return this instanceof __await?(this.v=e,this):new __await(e)}function __asyncGenerator(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),i=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){i.push([e,t,r,n])>1||s(e,t)}))})}function s(e,t){try{(r=o[e](t)).value instanceof __await?Promise.resolve(r.value.v).then(c,u):l(i[0][2],r)}catch(e2){l(i[0][3],e2)}var r}function c(e){s("next",e)}function u(e){s("throw",e)}function l(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function __asyncDelegator(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:__await(e[n](t)),done:"return"===n}:o?o(t):t}:o}}function __asyncValues(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,o,(t=e[r](t)).done,t.value)}))}}}function __makeTemplateObject(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function __importStar(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function __importDefault(e){return e&&e.__esModule?e:{default:e}}function __classPrivateFieldGet(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function __classPrivateFieldSet(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r}const tslib_es6=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return __assign},__asyncDelegator:__asyncDelegator,__asyncGenerator:__asyncGenerator,__asyncValues:__asyncValues,__await:__await,__awaiter:__awaiter,__classPrivateFieldGet:__classPrivateFieldGet,__classPrivateFieldSet:__classPrivateFieldSet,__createBinding:__createBinding,__decorate:__decorate,__exportStar:__exportStar,__extends:__extends,__generator:__generator,__importDefault:__importDefault,__importStar:__importStar,__makeTemplateObject:__makeTemplateObject,__metadata:__metadata,__param:__param,__read:__read,__rest:__rest,__spread:__spread,__spreadArrays:__spreadArrays$1,__values:__values},Symbol.toStringTag,{value:"Module"})),require$$0$4=getAugmentedNamespace(tslib_es6);var utils$q={},delay={},hasRequiredDelay;function requireDelay(){if(hasRequiredDelay)return delay;return hasRequiredDelay=1,Object.defineProperty(delay,"__esModule",{value:!0}),delay.delay=void 0,delay.delay=function(e){return new Promise((t=>{setTimeout((()=>{t(!0)}),e)}))},delay}var convert={},constants={},misc={},hasRequiredMisc;function requireMisc(){return hasRequiredMisc||(hasRequiredMisc=1,Object.defineProperty(misc,"__esModule",{value:!0}),misc.ONE_THOUSAND=misc.ONE_HUNDRED=void 0,misc.ONE_HUNDRED=100,misc.ONE_THOUSAND=1e3),misc}var time$1={},hasRequiredTime,hasRequiredConstants,hasRequiredConvert,hasRequiredUtils;function requireTime(){return hasRequiredTime||(hasRequiredTime=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ONE_YEAR=e.FOUR_WEEKS=e.THREE_WEEKS=e.TWO_WEEKS=e.ONE_WEEK=e.THIRTY_DAYS=e.SEVEN_DAYS=e.FIVE_DAYS=e.THREE_DAYS=e.ONE_DAY=e.TWENTY_FOUR_HOURS=e.TWELVE_HOURS=e.SIX_HOURS=e.THREE_HOURS=e.ONE_HOUR=e.SIXTY_MINUTES=e.THIRTY_MINUTES=e.TEN_MINUTES=e.FIVE_MINUTES=e.ONE_MINUTE=e.SIXTY_SECONDS=e.THIRTY_SECONDS=e.TEN_SECONDS=e.FIVE_SECONDS=e.ONE_SECOND=void 0,e.ONE_SECOND=1,e.FIVE_SECONDS=5,e.TEN_SECONDS=10,e.THIRTY_SECONDS=30,e.SIXTY_SECONDS=60,e.ONE_MINUTE=e.SIXTY_SECONDS,e.FIVE_MINUTES=5*e.ONE_MINUTE,e.TEN_MINUTES=10*e.ONE_MINUTE,e.THIRTY_MINUTES=30*e.ONE_MINUTE,e.SIXTY_MINUTES=60*e.ONE_MINUTE,e.ONE_HOUR=e.SIXTY_MINUTES,e.THREE_HOURS=3*e.ONE_HOUR,e.SIX_HOURS=6*e.ONE_HOUR,e.TWELVE_HOURS=12*e.ONE_HOUR,e.TWENTY_FOUR_HOURS=24*e.ONE_HOUR,e.ONE_DAY=e.TWENTY_FOUR_HOURS,e.THREE_DAYS=3*e.ONE_DAY,e.FIVE_DAYS=5*e.ONE_DAY,e.SEVEN_DAYS=7*e.ONE_DAY,e.THIRTY_DAYS=30*e.ONE_DAY,e.ONE_WEEK=e.SEVEN_DAYS,e.TWO_WEEKS=2*e.ONE_WEEK,e.THREE_WEEKS=3*e.ONE_WEEK,e.FOUR_WEEKS=4*e.ONE_WEEK,e.ONE_YEAR=365*e.ONE_DAY}(time$1)),time$1}function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=require$$0$4;t.__exportStar(requireMisc(),e),t.__exportStar(requireTime(),e)}(constants)),constants}function requireConvert(){if(hasRequiredConvert)return convert;hasRequiredConvert=1,Object.defineProperty(convert,"__esModule",{value:!0}),convert.fromMiliseconds=convert.toMiliseconds=void 0;const e=requireConstants();return convert.toMiliseconds=function(t){return t*e.ONE_THOUSAND},convert.fromMiliseconds=function(t){return Math.floor(t/e.ONE_THOUSAND)},convert}function requireUtils(){return hasRequiredUtils||(hasRequiredUtils=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=require$$0$4;t.__exportStar(requireDelay(),e),t.__exportStar(requireConvert(),e)}(utils$q)),utils$q}var watch$2={},hasRequiredWatch$1;function requireWatch$1(){if(hasRequiredWatch$1)return watch$2;hasRequiredWatch$1=1,Object.defineProperty(watch$2,"__esModule",{value:!0}),watch$2.Watch=void 0;class e{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){const t=this.get(e);if(void 0!==t.elapsed)throw new Error(`Watch already stopped for label: ${e}`);const r=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:r})}get(e){const t=this.timestamps.get(e);if(void 0===t)throw new Error(`No timestamp found for label: ${e}`);return t}elapsed(e){const t=this.get(e);return t.elapsed||Date.now()-t.started}}return watch$2.Watch=e,watch$2.default=e,watch$2}var types={},watch$1={},hasRequiredWatch,hasRequiredTypes;function requireWatch(){if(hasRequiredWatch)return watch$1;hasRequiredWatch=1,Object.defineProperty(watch$1,"__esModule",{value:!0}),watch$1.IWatch=void 0;return watch$1.IWatch=class{},watch$1}function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});require$$0$4.__exportStar(requireWatch(),e)}(types)),types}!function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=require$$0$4;t.__exportStar(requireUtils(),e),t.__exportStar(requireWatch$1(),e),t.__exportStar(requireTypes(),e),t.__exportStar(requireConstants(),e)}(cjs$7);class IEvents{}let n$a=class extends IEvents{constructor(e){super()}};const s$7=cjs$7.FIVE_SECONDS,r$6={pulse:"heartbeat_pulse"};let i$7=class e extends n$a{constructor(e){super(e),this.events=new eventsExports.EventEmitter,this.interval=s$7,this.interval=(null==e?void 0:e.interval)||s$7}static async init(t){const r=new e(t);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval((()=>this.pulse()),cjs$7.toMiliseconds(this.interval))}pulse(){this.events.emit(r$6.pulse)}};const suspectProtoRx=/"(?:_|\\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*:/,suspectConstructorRx=/"(?: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*:/,JsonSigRx=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function jsonParseTransform(e,t){if(!("__proto__"===e||"constructor"===e&&t&&"object"==typeof t&&"prototype"in t))return t;warnKeyDropped(e)}function warnKeyDropped(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}function destr(e,t={}){if("string"!=typeof e)return e;const r=e.trim();if('"'===e[0]&&e.endsWith('"')&&!e.includes("\\"))return r.slice(1,-1);if(r.length<=9){const e=r.toLowerCase();if("true"===e)return!0;if("false"===e)return!1;if("undefined"===e)return;if("null"===e)return null;if("nan"===e)return Number.NaN;if("infinity"===e)return Number.POSITIVE_INFINITY;if("-infinity"===e)return Number.NEGATIVE_INFINITY}if(!JsonSigRx.test(e)){if(t.strict)throw new SyntaxError("[destr] Invalid JSON");return e}try{if(suspectProtoRx.test(e)||suspectConstructorRx.test(e)){if(t.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(e,jsonParseTransform)}return JSON.parse(e)}catch(n){if(t.strict)throw n;return e}}function wrapToPromise(e){return e&&"function"==typeof e.then?e:Promise.resolve(e)}function asyncCall(e,...t){try{return wrapToPromise(e(...t))}catch(r){return Promise.reject(r)}}function isPrimitive(e){const t=typeof e;return null===e||"object"!==t&&"function"!==t}function isPureObject(e){const t=Object.getPrototypeOf(e);return!t||t.isPrototypeOf(Object)}function stringify(e){if(isPrimitive(e))return String(e);if(isPureObject(e)||Array.isArray(e))return JSON.stringify(e);if("function"==typeof e.toJSON)return stringify(e.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const BASE64_PREFIX="base64:";function serializeRaw(e){return"string"==typeof e?e:BASE64_PREFIX+base64Encode(e)}function deserializeRaw(e){return"string"!=typeof e?e:e.startsWith(BASE64_PREFIX)?base64Decode(e.slice(BASE64_PREFIX.length)):e}function base64Decode(e){return globalThis.Buffer?Buffer$2.from(e,"base64"):Uint8Array.from(globalThis.atob(e),(e=>e.codePointAt(0)))}function base64Encode(e){return globalThis.Buffer?Buffer$2.from(e).toString("base64"):globalThis.btoa(String.fromCodePoint(...e))}function normalizeKey(e){var t;return e&&(null==(t=e.split("?")[0])?void 0:t.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function joinKeys(...e){return normalizeKey(e.join(":"))}function normalizeBaseKey(e){return(e=normalizeKey(e))?e+":":""}function defineDriver(e){return e}const DRIVER_NAME="memory",memory=defineDriver((()=>{const e=new Map;return{name:DRIVER_NAME,getInstance:()=>e,hasItem:t=>e.has(t),getItem:t=>e.get(t)??null,getItemRaw:t=>e.get(t)??null,setItem(t,r){e.set(t,r)},setItemRaw(t,r){e.set(t,r)},removeItem(t){e.delete(t)},getKeys:()=>[...e.keys()],clear(){e.clear()},dispose(){e.clear()}}}));function createStorage(e={}){const t={mounts:{"":e.driver||memory()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=e=>{for(const r of t.mountpoints)if(e.startsWith(r))return{base:r,relativeKey:e.slice(r.length),driver:t.mounts[r]};return{base:"",relativeKey:e,driver:t.mounts[""]}},n=(e,r)=>t.mountpoints.filter((t=>t.startsWith(e)||r&&e.startsWith(t))).map((r=>({relativeBase:e.length>r.length?e.slice(r.length):void 0,mountpoint:r,driver:t.mounts[r]}))),o=(e,r)=>{if(t.watching){r=normalizeKey(r);for(const n of t.watchListeners)n(e,r)}},i=async()=>{if(t.watching){for(const e in t.unwatch)await t.unwatch[e]();t.unwatch={},t.watching=!1}},a=(e,t,n)=>{const o=new Map,i=e=>{let t=o.get(e.base);return t||(t={driver:e.driver,base:e.base,items:[]},o.set(e.base,t)),t};for(const a of e){const e="string"==typeof a,n=normalizeKey(e?a:a.key),o=e?void 0:a.value,s=e||!a.options?t:{...t,...a.options},c=r(n);i(c).items.push({key:n,value:o,relativeKey:c.relativeKey,options:s})}return Promise.all([...o.values()].map((e=>n(e)))).then((e=>e.flat()))},s={hasItem(e,t={}){e=normalizeKey(e);const{relativeKey:n,driver:o}=r(e);return asyncCall(o.hasItem,n,t)},getItem(e,t={}){e=normalizeKey(e);const{relativeKey:n,driver:o}=r(e);return asyncCall(o.getItem,n,t).then((e=>destr(e)))},getItems:(e,t={})=>a(e,t,(e=>e.driver.getItems?asyncCall(e.driver.getItems,e.items.map((e=>({key:e.relativeKey,options:e.options}))),t).then((t=>t.map((t=>({key:joinKeys(e.base,t.key),value:destr(t.value)}))))):Promise.all(e.items.map((t=>asyncCall(e.driver.getItem,t.relativeKey,t.options).then((e=>({key:t.key,value:destr(e)})))))))),getItemRaw(e,t={}){e=normalizeKey(e);const{relativeKey:n,driver:o}=r(e);return o.getItemRaw?asyncCall(o.getItemRaw,n,t):asyncCall(o.getItem,n,t).then((e=>deserializeRaw(e)))},async setItem(e,t,n={}){if(void 0===t)return s.removeItem(e);e=normalizeKey(e);const{relativeKey:i,driver:a}=r(e);a.setItem&&(await asyncCall(a.setItem,i,stringify(t),n),a.watch||o("update",e))},async setItems(e,t){await a(e,t,(async e=>{if(e.driver.setItems)return asyncCall(e.driver.setItems,e.items.map((e=>({key:e.relativeKey,value:stringify(e.value),options:e.options}))),t);e.driver.setItem&&await Promise.all(e.items.map((t=>asyncCall(e.driver.setItem,t.relativeKey,stringify(t.value),t.options))))}))},async setItemRaw(e,t,n={}){if(void 0===t)return s.removeItem(e,n);e=normalizeKey(e);const{relativeKey:i,driver:a}=r(e);if(a.setItemRaw)await asyncCall(a.setItemRaw,i,t,n);else{if(!a.setItem)return;await asyncCall(a.setItem,i,serializeRaw(t),n)}a.watch||o("update",e)},async removeItem(e,t={}){"boolean"==typeof t&&(t={removeMeta:t}),e=normalizeKey(e);const{relativeKey:n,driver:i}=r(e);i.removeItem&&(await asyncCall(i.removeItem,n,t),(t.removeMeta||t.removeMata)&&await asyncCall(i.removeItem,n+"$",t),i.watch||o("remove",e))},async getMeta(e,t={}){"boolean"==typeof t&&(t={nativeOnly:t}),e=normalizeKey(e);const{relativeKey:n,driver:o}=r(e),i=Object.create(null);if(o.getMeta&&Object.assign(i,await asyncCall(o.getMeta,n,t)),!t.nativeOnly){const e=await asyncCall(o.getItem,n+"$",t).then((e=>destr(e)));e&&"object"==typeof e&&("string"==typeof e.atime&&(e.atime=new Date(e.atime)),"string"==typeof e.mtime&&(e.mtime=new Date(e.mtime)),Object.assign(i,e))}return i},setMeta(e,t,r={}){return this.setItem(e+"$",t,r)},removeMeta(e,t={}){return this.removeItem(e+"$",t)},async getKeys(e,t={}){e=normalizeBaseKey(e);const r=n(e,!0);let o=[];const i=[];for(const n of r){const e=await asyncCall(n.driver.getKeys,n.relativeBase,t);for(const t of e){const e=n.mountpoint+normalizeKey(t);o.some((t=>e.startsWith(t)))||i.push(e)}o=[n.mountpoint,...o.filter((e=>!e.startsWith(n.mountpoint)))]}return e?i.filter((t=>t.startsWith(e)&&"$"!==t[t.length-1])):i.filter((e=>"$"!==e[e.length-1]))},async clear(e,t={}){e=normalizeBaseKey(e),await Promise.all(n(e,!1).map((async e=>{if(e.driver.clear)return asyncCall(e.driver.clear,e.relativeBase,t);if(e.driver.removeItem){const r=await e.driver.getKeys(e.relativeBase||"",t);return Promise.all(r.map((r=>e.driver.removeItem(r,t))))}})))},async dispose(){await Promise.all(Object.values(t.mounts).map((e=>dispose(e))))},watch:async e=>(await(async()=>{if(!t.watching){t.watching=!0;for(const e in t.mounts)t.unwatch[e]=await watch(t.mounts[e],o,e)}})(),t.watchListeners.push(e),async()=>{t.watchListeners=t.watchListeners.filter((t=>t!==e)),0===t.watchListeners.length&&await i()}),async unwatch(){t.watchListeners=[],await i()},mount(e,r){if((e=normalizeBaseKey(e))&&t.mounts[e])throw new Error(`already mounted at ${e}`);return e&&(t.mountpoints.push(e),t.mountpoints.sort(((e,t)=>t.length-e.length))),t.mounts[e]=r,t.watching&&Promise.resolve(watch(r,o,e)).then((r=>{t.unwatch[e]=r})).catch(console.error),s},async unmount(e,r=!0){var n,o;(e=normalizeBaseKey(e))&&t.mounts[e]&&(t.watching&&e in t.unwatch&&(null==(o=(n=t.unwatch)[e])||o.call(n),delete t.unwatch[e]),r&&await dispose(t.mounts[e]),t.mountpoints=t.mountpoints.filter((t=>t!==e)),delete t.mounts[e])},getMount(e=""){e=normalizeKey(e)+":";const t=r(e);return{driver:t.driver,base:t.base}},getMounts(e="",t={}){e=normalizeKey(e);return n(e,t.parents).map((e=>({driver:e.driver,base:e.mountpoint})))},keys:(e,t={})=>s.getKeys(e,t),get:(e,t={})=>s.getItem(e,t),set:(e,t,r={})=>s.setItem(e,t,r),has:(e,t={})=>s.hasItem(e,t),del:(e,t={})=>s.removeItem(e,t),remove:(e,t={})=>s.removeItem(e,t)};return s}function watch(e,t,r){return e.watch?e.watch(((e,n)=>t(e,r+n))):()=>{}}async function dispose(e){"function"==typeof e.dispose&&await asyncCall(e.dispose)}function promisifyRequest(e){return new Promise(((t,r)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>r(e.error)}))}function createStore(e,t){const r=indexedDB.open(e);r.onupgradeneeded=()=>r.result.createObjectStore(t);const n=promisifyRequest(r);return(e,r)=>n.then((n=>r(n.transaction(t,e).objectStore(t))))}let defaultGetStoreFunc;function defaultGetStore(){return defaultGetStoreFunc||(defaultGetStoreFunc=createStore("keyval-store","keyval")),defaultGetStoreFunc}function get(e,t=defaultGetStore()){return t("readonly",(t=>promisifyRequest(t.get(e))))}function set$1(e,t,r=defaultGetStore()){return r("readwrite",(r=>(r.put(t,e),promisifyRequest(r.transaction))))}function del(e,t=defaultGetStore()){return t("readwrite",(t=>(t.delete(e),promisifyRequest(t.transaction))))}function clear(e=defaultGetStore()){return e("readwrite",(e=>(e.clear(),promisifyRequest(e.transaction))))}function eachCursor(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},promisifyRequest(e.transaction)}function keys(e=defaultGetStore()){return e("readonly",(e=>{if(e.getAllKeys)return promisifyRequest(e.getAllKeys());const t=[];return eachCursor(e,(e=>t.push(e.key))).then((()=>t))}))}const JSONStringify=e=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString()+"n":t)),JSONParse=e=>{const t=e.replace(/([\[:])?(\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,'$1"$2n"$3');return JSON.parse(t,((e,t)=>"string"==typeof t&&t.match(/^\d+n$/)?BigInt(t.substring(0,t.length-1)):t))};function safeJsonParse$2(e){if("string"!=typeof e)throw new Error("Cannot safe json parse value of type "+typeof e);try{return JSONParse(e)}catch(t){return e}}function safeJsonStringify$2(e){return"string"==typeof e?e:JSONStringify(e)||""}const x$7="idb-keyval";var z$8=(e={})=>{const t=e.base&&e.base.length>0?`${e.base}:`:"",r=e=>t+e;let n;return e.dbName&&e.storeName&&(n=createStore(e.dbName,e.storeName)),{name:x$7,options:e,hasItem:async e=>!(typeof(await get(r(e),n))>"u"),getItem:async e=>await get(r(e),n)??null,setItem:(e,t)=>set$1(r(e),t,n),removeItem:e=>del(r(e),n),getKeys:()=>keys(n),clear:()=>clear(n)}};const D$6="WALLET_CONNECT_V2_INDEXED_DB",E$6="keyvaluestorage";let _$8=class{constructor(){this.indexedDb=createStorage({driver:z$8({dbName:D$6,storeName:E$6})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map((e=>[e.key,e.value]))}async getItem(e){const t=await this.indexedDb.getItem(e);if(null!==t)return t}async setItem(e,t){await this.indexedDb.setItem(e,safeJsonStringify$2(t))}async removeItem(e){await this.indexedDb.removeItem(e)}};var l$8=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global$1<"u"?global$1:typeof self<"u"?self:{},c$7={exports:{}};function k$6(e){var t;return[e[0],safeJsonParse$2(null!=(t=e[1])?t:"")]}!function(){let e;function t(){}e=t,e.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},e.prototype.setItem=function(e,t){this[e]=String(t)},e.prototype.removeItem=function(e){delete this[e]},e.prototype.clear=function(){const e=this;Object.keys(e).forEach((function(t){e[t]=void 0,delete e[t]}))},e.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},e.prototype.__defineGetter__("length",(function(){return Object.keys(this).length})),typeof l$8<"u"&&l$8.localStorage?c$7.exports=l$8.localStorage:typeof window<"u"&&window.localStorage?c$7.exports=window.localStorage:c$7.exports=new t}();let K$3=class{constructor(){this.localStorage=c$7.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(k$6)}async getItem(e){const t=this.localStorage.getItem(e);if(null!==t)return safeJsonParse$2(t)}async setItem(e,t){this.localStorage.setItem(e,safeJsonStringify$2(t))}async removeItem(e){this.localStorage.removeItem(e)}};const N$4="wc_storage_version",y$8=1,O$6=async(e,t,r)=>{const n=N$4,o=await t.getItem(n);if(o&&o>=y$8)return void r(t);const i=await e.getKeys();if(!i.length)return void r(t);const a=[];for(;i.length;){const r=i.shift();if(!r)continue;const n=r.toLowerCase();if(n.includes("wc@")||n.includes("walletconnect")||n.includes("wc_")||n.includes("wallet_connect")){const n=await e.getItem(r);await t.setItem(r,n),a.push(r)}}await t.setItem(n,y$8),r(t),j$3(e,a)},j$3=async(e,t)=>{t.length&&t.forEach((async t=>{await e.removeItem(t)}))};let h$7=class{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};const e=new K$3;this.storage=e;try{const t=new _$8;O$6(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise((e=>{const t=setInterval((()=>{this.initialized&&(clearInterval(t),e())}),20)}))}};const format$1=quickFormatUnescaped;var browser$3=pino;const _console=pfGlobalThisOrFallback().console||{},stdSerializers={mapHttpRequest:mock,mapHttpResponse:mock,wrapRequestSerializer:passthrough,wrapResponseSerializer:passthrough,wrapErrorSerializer:passthrough,req:mock,res:mock,err:asErrValue};function shouldSerialize(e,t){if(Array.isArray(e)){return e.filter((function(e){return"!stdSerializers.err"!==e}))}return!0===e&&Object.keys(t)}function pino(e){(e=e||{}).browser=e.browser||{};const t=e.browser.transmit;if(t&&"function"!=typeof t.send)throw Error("pino: transmit option must have a send function");const r=e.browser.write||_console;e.browser.write&&(e.browser.asObject=!0);const n=e.serializers||{},o=shouldSerialize(e.browser.serialize,n);let i=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);"function"==typeof r&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),!1===e.enabled&&(e.level="silent");const a=e.level||"info",s=Object.create(r);s.log||(s.log=noop$1),Object.defineProperty(s,"levelVal",{get:function(){return"silent"===this.level?1/0:this.levels.values[this.level]}}),Object.defineProperty(s,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,set(c,s,"error","log"),set(c,s,"fatal","error"),set(c,s,"warn","error"),set(c,s,"info","log"),set(c,s,"debug","log"),set(c,s,"trace","log")}});const c={transmit:t,serialize:o,asObject:e.browser.asObject,levels:["error","fatal","warn","info","debug","trace"],timestamp:getTimeFunction(e)};return s.levels=pino.levels,s.level=a,s.setMaxListeners=s.getMaxListeners=s.emit=s.addListener=s.on=s.prependListener=s.once=s.prependOnceListener=s.removeListener=s.removeAllListeners=s.listeners=s.listenerCount=s.eventNames=s.write=s.flush=noop$1,s.serializers=n,s._serialize=o,s._stdErrSerialize=i,s.child=function(r,i){if(!r)throw new Error("missing bindings for child Pino");i=i||{},o&&r.serializers&&(i.serializers=r.serializers);const a=i.serializers;if(o&&a){var s=Object.assign({},n,a),c=!0===e.browser.serialize?Object.keys(s):o;delete r.serializers,applySerializers([r],c,s,this._stdErrSerialize)}function u(e){this._childLevel=1+(0|e._childLevel),this.error=bind(e,r,"error"),this.fatal=bind(e,r,"fatal"),this.warn=bind(e,r,"warn"),this.info=bind(e,r,"info"),this.debug=bind(e,r,"debug"),this.trace=bind(e,r,"trace"),s&&(this.serializers=s,this._serialize=c),t&&(this._logEvent=createLogEventShape([].concat(e._logEvent.bindings,r)))}return u.prototype=this,new u(this)},t&&(s._logEvent=createLogEventShape()),s}function set(e,t,r,n){const o=Object.getPrototypeOf(t);t[r]=t.levelVal>t.levels.values[r]?noop$1:o[r]?o[r]:_console[r]||_console[n]||noop$1,wrap$1(e,t,r)}function wrap$1(e,t,r){(e.transmit||t[r]!==noop$1)&&(t[r]=function(n){return function(){const o=e.timestamp(),i=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===_console?_console:this;for(var s=0;s<i.length;s++)i[s]=arguments[s];if(e.serialize&&!e.asObject&&applySerializers(i,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?n.call(a,asObject(this,r,i,o)):n.apply(a,i),e.transmit){const n=e.transmit.level||t.level,a=pino.levels.values[n],s=pino.levels.values[r];if(s<a)return;transmit(this,{ts:o,methodLevel:r,methodValue:s,transmitLevel:n,transmitValue:pino.levels.values[e.transmit.level||t.level],send:e.transmit.send,val:t.levelVal},i)}}}(t[r]))}function asObject(e,t,r,n){e._serialize&&applySerializers(r,e._serialize,e.serializers,e._stdErrSerialize);const o=r.slice();let i=o[0];const a={};n&&(a.time=n),a.level=pino.levels.values[t];let s=1+(0|e._childLevel);if(s<1&&(s=1),null!==i&&"object"==typeof i){for(;s--&&"object"==typeof o[0];)Object.assign(a,o.shift());i=o.length?format$1(o.shift(),o):void 0}else"string"==typeof i&&(i=format$1(o.shift(),o));return void 0!==i&&(a.msg=i),a}function applySerializers(e,t,r,n){for(const o in e)if(n&&e[o]instanceof Error)e[o]=pino.stdSerializers.err(e[o]);else if("object"==typeof e[o]&&!Array.isArray(e[o]))for(const n in e[o])t&&t.indexOf(n)>-1&&n in r&&(e[o][n]=r[n](e[o][n]))}function bind(e,t,r){return function(){const n=new Array(1+arguments.length);n[0]=t;for(var o=1;o<n.length;o++)n[o]=arguments[o-1];return e[r].apply(this,n)}}function transmit(e,t,r){const n=t.send,o=t.ts,i=t.methodLevel,a=t.methodValue,s=t.val,c=e._logEvent.bindings;applySerializers(r,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=o,e._logEvent.messages=r.filter((function(e){return-1===c.indexOf(e)})),e._logEvent.level.label=i,e._logEvent.level.value=a,n(i,e._logEvent,s),e._logEvent=createLogEventShape(c)}function createLogEventShape(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function asErrValue(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const r in e)void 0===t[r]&&(t[r]=e[r]);return t}function getTimeFunction(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?nullTime:epochTime}function mock(){return{}}function passthrough(e){return e}function noop$1(){}function nullTime(){return!1}function epochTime(){return Date.now()}function unixTime(){return Math.round(Date.now()/1e3)}function isoTime(){return new Date(Date.now()).toISOString()}function pfGlobalThisOrFallback(){function e(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(e2){return e(self)||e(window)||e(this)||{}}}pino.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"}},pino.stdSerializers=stdSerializers,pino.stdTimeFunctions=Object.assign({},{nullTime:nullTime,epochTime:epochTime,unixTime:unixTime,isoTime:isoTime});const _i=getDefaultExportFromCjs$1(browser$3),c$6={level:"info"},n$9="custom_context",l$7=1024e3;let O$5=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}},d$6=class{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new O$5(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;null!==t;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}},L$5=class{constructor(e,t=l$7){this.level=e??"error",this.levelValue=browser$3.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new d$6(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===browser$3.levels.values.error?console.error(e):t===browser$3.levels.values.warn?console.warn(e):t===browser$3.levels.values.debug?console.debug(e):t===browser$3.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(safeJsonStringify$2({timestamp:(new Date).toISOString(),log:e}));const t="string"==typeof e?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new d$6(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(safeJsonStringify$2({extraMetadata:e})),new Blob(t,{type:"application/json"})}},m$3=class{constructor(e,t=l$7){this.baseChunkLogger=new L$5(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),r=document.createElement("a");r.href=t,r.download=`walletconnect-logs-${(new Date).toISOString()}.txt`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(t)}},B$3=class{constructor(e,t=l$7){this.baseChunkLogger=new L$5(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var x$6=Object.defineProperty,S$8=Object.defineProperties,_$7=Object.getOwnPropertyDescriptors,p$4=Object.getOwnPropertySymbols,T$5=Object.prototype.hasOwnProperty,z$7=Object.prototype.propertyIsEnumerable,f$6=(e,t,r)=>t in e?x$6(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i$6=(e,t)=>{for(var r in t||(t={}))T$5.call(t,r)&&f$6(e,r,t[r]);if(p$4)for(var r of p$4(t))z$7.call(t,r)&&f$6(e,r,t[r]);return e},g$6=(e,t)=>S$8(e,_$7(t));function k$5(e){return g$6(i$6({},e),{level:(null==e?void 0:e.level)||c$6.level})}function v$6(e,t=n$9){return e[t]||""}function b$5(e,t,r=n$9){return e[r]=t,e}function y$7(e,t=n$9){let r="";return r=typeof e.bindings>"u"?v$6(e,t):e.bindings().context||"",r}function w$6(e,t,r=n$9){const n=y$7(e,r);return n.trim()?`${n}/${t}`:t}function E$5(e,t,r=n$9){const n=w$6(e,t,r);return b$5(e.child({context:n}),n,r)}function C$7(e){var t,r;const n=new m$3(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:_i(g$6(i$6({},e.opts),{level:"trace",browser:g$6(i$6({},null==(r=e.opts)?void 0:r.browser),{write:e=>n.write(e)})})),chunkLoggerController:n}}function I$6(e){var t;const r=new B$3(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:_i(g$6(i$6({},e.opts),{level:"trace"}),r),chunkLoggerController:r}}function A$5(e){return typeof e.loggerOverride<"u"&&"string"!=typeof e.loggerOverride?{logger:e.loggerOverride,chunkLoggerController:null}:typeof window<"u"?C$7(e):I$6(e)}var ed25519={},random={},system={},browser$2={};Object.defineProperty(browser$2,"__esModule",{value:!0}),browser$2.BrowserRandomSource=void 0;const QUOTA=65536;class BrowserRandomSource{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e="undefined"!=typeof self?self.crypto||self.msCrypto:null;e&&void 0!==e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let r=0;r<t.length;r+=QUOTA)this._crypto.getRandomValues(t.subarray(r,r+Math.min(t.length-r,QUOTA)));return t}}browser$2.BrowserRandomSource=BrowserRandomSource;var node={},wipe$1={};function wipe(e){for(var t=0;t<e.length;t++)e[t]=0;return e}Object.defineProperty(wipe$1,"__esModule",{value:!0}),wipe$1.wipe=wipe,Object.defineProperty(node,"__esModule",{value:!0}),node.NodeRandomSource=void 0;const wipe_1$3=wipe$1;class NodeRandomSource{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,void 0!==commonjsRequire$1){const e=requireCryptoBrowserify();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const r=new Uint8Array(e);for(let n=0;n<r.length;n++)r[n]=t[n];return(0,wipe_1$3.wipe)(t),r}}node.NodeRandomSource=NodeRandomSource,Object.defineProperty(system,"__esModule",{value:!0}),system.SystemRandomSource=void 0;const browser_1=browser$2,node_1=node;class SystemRandomSource{constructor(){return this.isAvailable=!1,this.name="",this._source=new browser_1.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new node_1.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}system.SystemRandomSource=SystemRandomSource;var binary={},int={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mul=Math.imul||function(e,t){var r=65535&e,n=65535&t;return r*n+((e>>>16&65535)*n+r*(t>>>16&65535)<<16>>>0)|0},e.add=function(e,t){return e+t|0},e.sub=function(e,t){return e-t|0},e.rotl=function(e,t){return e<<t|e>>>32-t},e.rotr=function(e,t){return e<<32-t|e>>>t},e.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(t){return e.isInteger(t)&&t>=-e.MAX_SAFE_INTEGER&&t<=e.MAX_SAFE_INTEGER}}(int),Object.defineProperty(binary,"__esModule",{value:!0});var int_1=int;function readInt16BE(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16}function readUint16BE(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0}function readInt16LE(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16}function readUint16LE(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0}function writeUint16BE(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>8,t[r+1]=e>>>0,t}function writeUint16LE(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}function readInt32BE(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function readUint32BE(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function readInt32LE(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function readUint32LE(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function writeUint32BE(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>24,t[r+1]=e>>>16,t[r+2]=e>>>8,t[r+3]=e>>>0,t}function writeUint32LE(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}function readInt64BE(e,t){void 0===t&&(t=0);var r=readInt32BE(e,t),n=readInt32BE(e,t+4);return 4294967296*r+n-4294967296*(n>>31)}function readUint64BE(e,t){return void 0===t&&(t=0),4294967296*readUint32BE(e,t)+readUint32BE(e,t+4)}function readInt64LE(e,t){void 0===t&&(t=0);var r=readInt32LE(e,t);return 4294967296*readInt32LE(e,t+4)+r-4294967296*(r>>31)}function readUint64LE(e,t){void 0===t&&(t=0);var r=readUint32LE(e,t);return 4294967296*readUint32LE(e,t+4)+r}function writeUint64BE(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),writeUint32BE(e/4294967296>>>0,t,r),writeUint32BE(e>>>0,t,r+4),t}function writeUint64LE(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),writeUint32LE(e>>>0,t,r),writeUint32LE(e/4294967296>>>0,t,r+4),t}function readUintBE(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,o=1,i=e/8+r-1;i>=r;i--)n+=t[i]*o,o*=256;return n}function readUintLE(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,o=1,i=r;i<r+e/8;i++)n+=t[i]*o,o*=256;return n}function writeUintBE(e,t,r,n){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===n&&(n=0),e%8!=0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!int_1.isSafeInteger(t))throw new Error("writeUintBE value must be an integer");for(var o=1,i=e/8+n-1;i>=n;i--)r[i]=t/o&255,o*=256;return r}function writeUintLE(e,t,r,n){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===n&&(n=0),e%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!int_1.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var o=1,i=n;i<n+e/8;i++)r[i]=t/o&255,o*=256;return r}function readFloat32BE(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t)}function readFloat32LE(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t,!0)}function readFloat64BE(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t)}function readFloat64LE(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t,!0)}function writeFloat32BE(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(r,e),t}function writeFloat32LE(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(r,e,!0),t}function writeFloat64BE(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(r,e),t}function writeFloat64LE(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(r,e,!0),t}binary.readInt16BE=readInt16BE,binary.readUint16BE=readUint16BE,binary.readInt16LE=readInt16LE,binary.readUint16LE=readUint16LE,binary.writeUint16BE=writeUint16BE,binary.writeInt16BE=writeUint16BE,binary.writeUint16LE=writeUint16LE,binary.writeInt16LE=writeUint16LE,binary.readInt32BE=readInt32BE,binary.readUint32BE=readUint32BE,binary.readInt32LE=readInt32LE,binary.readUint32LE=readUint32LE,binary.writeUint32BE=writeUint32BE,binary.writeInt32BE=writeUint32BE,binary.writeUint32LE=writeUint32LE,binary.writeInt32LE=writeUint32LE,binary.readInt64BE=readInt64BE,binary.readUint64BE=readUint64BE,binary.readInt64LE=readInt64LE,binary.readUint64LE=readUint64LE,binary.writeUint64BE=writeUint64BE,binary.writeInt64BE=writeUint64BE,binary.writeUint64LE=writeUint64LE,binary.writeInt64LE=writeUint64LE,binary.readUintBE=readUintBE,binary.readUintLE=readUintLE,binary.writeUintBE=writeUintBE,binary.writeUintLE=writeUintLE,binary.readFloat32BE=readFloat32BE,binary.readFloat32LE=readFloat32LE,binary.readFloat64BE=readFloat64BE,binary.readFloat64LE=readFloat64LE,binary.writeFloat32BE=writeFloat32BE,binary.writeFloat32LE=writeFloat32LE,binary.writeFloat64BE=writeFloat64BE,binary.writeFloat64LE=writeFloat64LE,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.randomStringForEntropy=e.randomString=e.randomUint32=e.randomBytes=e.defaultRandomSource=void 0;const t=system,r=binary,n=wipe$1;function o(t,r=e.defaultRandomSource){return r.randomBytes(t)}e.defaultRandomSource=new t.SystemRandomSource,e.randomBytes=o,e.randomUint32=function(t=e.defaultRandomSource){const i=o(4,t),a=(0,r.readUint32LE)(i);return(0,n.wipe)(i),a};const i="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function a(t,r=i,a=e.defaultRandomSource){if(r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");let s="";const c=r.length,u=256-256%c;for(;t>0;){const e=o(Math.ceil(256*t/u),a);for(let n=0;n<e.length&&t>0;n++){const o=e[n];o<u&&(s+=r.charAt(o%c),t--)}(0,n.wipe)(e)}return s}e.randomString=a,e.randomStringForEntropy=function(t,r=i,n=e.defaultRandomSource){return a(Math.ceil(t/(Math.log(r.length)/Math.LN2)),r,n)}}(random);var sha512={};!function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=binary,r=wipe$1;e.DIGEST_LENGTH=64,e.BLOCK_SIZE=128;var n=function(){function n(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return n.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},n.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},n.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},n.prototype.update=function(t,r){if(void 0===r&&(r=t.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength<e.BLOCK_SIZE&&r>0;)this._buffer[this._bufferLength++]=t[n++],r--;this._bufferLength===this.blockSize&&(i(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=i(this._tempHi,this._tempLo,this._stateHi,this._stateLo,t,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=t[n++],r--;return this},n.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,o=r/536870912|0,a=r<<3,s=r%128<112?128:256;this._buffer[n]=128;for(var c=n+1;c<s-8;c++)this._buffer[c]=0;t.writeUint32BE(o,this._buffer,s-8),t.writeUint32BE(a,this._buffer,s-4),i(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,s),this._finished=!0}for(c=0;c<this.digestLength/8;c++)t.writeUint32BE(this._stateHi[c],e,8*c),t.writeUint32BE(this._stateLo[c],e,8*c+4);return this},n.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},n.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},n.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},n.prototype.cleanSavedState=function(e){r.wipe(e.stateHi),r.wipe(e.stateLo),e.buffer&&r.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},n}();e.SHA512=n;var o=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function i(e,r,n,i,a,s,c){for(var u,l,d,f,h,p,y,m,g=n[0],b=n[1],v=n[2],w=n[3],_=n[4],I=n[5],T=n[6],k=n[7],$=i[0],S=i[1],A=i[2],E=i[3],C=i[4],R=i[5],O=i[6],N=i[7];c>=128;){for(var P=0;P<16;P++){var M=8*P+s;e[P]=t.readUint32BE(a,M),r[P]=t.readUint32BE(a,M+4)}for(P=0;P<80;P++){var B,D,x=g,L=b,U=v,j=w,F=_,q=I,K=T,H=$,G=S,z=A,V=E,W=C,Q=R,Y=O;if(h=65535&(l=N),p=l>>>16,y=65535&(u=k),m=u>>>16,h+=65535&(l=(C>>>14|_<<18)^(C>>>18|_<<14)^(_>>>9|C<<23)),p+=l>>>16,y+=65535&(u=(_>>>14|C<<18)^(_>>>18|C<<14)^(C>>>9|_<<23)),m+=u>>>16,h+=65535&(l=C&R^~C&O),p+=l>>>16,y+=65535&(u=_&I^~_&T),m+=u>>>16,u=o[2*P],h+=65535&(l=o[2*P+1]),p+=l>>>16,y+=65535&u,m+=u>>>16,u=e[P%16],p+=(l=r[P%16])>>>16,y+=65535&u,m+=u>>>16,y+=(p+=(h+=65535&l)>>>16)>>>16,h=65535&(l=f=65535&h|p<<16),p=l>>>16,y=65535&(u=d=65535&y|(m+=y>>>16)<<16),m=u>>>16,h+=65535&(l=($>>>28|g<<4)^(g>>>2|$<<30)^(g>>>7|$<<25)),p+=l>>>16,y+=65535&(u=(g>>>28|$<<4)^($>>>2|g<<30)^($>>>7|g<<25)),m+=u>>>16,p+=(l=$&S^$&A^S&A)>>>16,y+=65535&(u=g&b^g&v^b&v),m+=u>>>16,B=65535&(y+=(p+=(h+=65535&l)>>>16)>>>16)|(m+=y>>>16)<<16,D=65535&h|p<<16,h=65535&(l=V),p=l>>>16,y=65535&(u=j),m=u>>>16,p+=(l=f)>>>16,y+=65535&(u=d),m+=u>>>16,b=x,v=L,w=U,_=j=65535&(y+=(p+=(h+=65535&l)>>>16)>>>16)|(m+=y>>>16)<<16,I=F,T=q,k=K,g=B,S=H,A=G,E=z,C=V=65535&h|p<<16,R=W,O=Q,N=Y,$=D,P%16==15)for(M=0;M<16;M++)u=e[M],h=65535&(l=r[M]),p=l>>>16,y=65535&u,m=u>>>16,u=e[(M+9)%16],h+=65535&(l=r[(M+9)%16]),p+=l>>>16,y+=65535&u,m+=u>>>16,d=e[(M+1)%16],h+=65535&(l=((f=r[(M+1)%16])>>>1|d<<31)^(f>>>8|d<<24)^(f>>>7|d<<25)),p+=l>>>16,y+=65535&(u=(d>>>1|f<<31)^(d>>>8|f<<24)^d>>>7),m+=u>>>16,d=e[(M+14)%16],p+=(l=((f=r[(M+14)%16])>>>19|d<<13)^(d>>>29|f<<3)^(f>>>6|d<<26))>>>16,y+=65535&(u=(d>>>19|f<<13)^(f>>>29|d<<3)^d>>>6),m+=u>>>16,m+=(y+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,e[M]=65535&y|m<<16,r[M]=65535&h|p<<16}h=65535&(l=$),p=l>>>16,y=65535&(u=g),m=u>>>16,u=n[0],p+=(l=i[0])>>>16,y+=65535&u,m+=u>>>16,m+=(y+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[0]=g=65535&y|m<<16,i[0]=$=65535&h|p<<16,h=65535&(l=S),p=l>>>16,y=65535&(u=b),m=u>>>16,u=n[1],p+=(l=i[1])>>>16,y+=65535&u,m+=u>>>16,m+=(y+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[1]=b=65535&y|m<<16,i[1]=S=65535&h|p<<16,h=65535&(l=A),p=l>>>16,y=65535&(u=v),m=u>>>16,u=n[2],p+=(l=i[2])>>>16,y+=65535&u,m+=u>>>16,m+=(y+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[2]=v=65535&y|m<<16,i[2]=A=65535&h|p<<16,h=65535&(l=E),p=l>>>16,y=65535&(u=w),m=u>>>16,u=n[3],p+=(l=i[3])>>>16,y+=65535&u,m+=u>>>16,m+=(y+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[3]=w=65535&y|m<<16,i[3]=E=65535&h|p<<16,h=65535&(l=C),p=l>>>16,y=65535&(u=_),m=u>>>16,u=n[4],p+=(l=i[4])>>>16,y+=65535&u,m+=u>>>16,m+=(y+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[4]=_=65535&y|m<<16,i[4]=C=65535&h|p<<16,h=65535&(l=R),p=l>>>16,y=65535&(u=I),m=u>>>16,u=n[5],p+=(l=i[5])>>>16,y+=65535&u,m+=u>>>16,m+=(y+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[5]=I=65535&y|m<<16,i[5]=R=65535&h|p<<16,h=65535&(l=O),p=l>>>16,y=65535&(u=T),m=u>>>16,u=n[6],p+=(l=i[6])>>>16,y+=65535&u,m+=u>>>16,m+=(y+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[6]=T=65535&y|m<<16,i[6]=O=65535&h|p<<16,h=65535&(l=N),p=l>>>16,y=65535&(u=k),m=u>>>16,u=n[7],p+=(l=i[7])>>>16,y+=65535&u,m+=u>>>16,m+=(y+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,n[7]=k=65535&y|m<<16,i[7]=N=65535&h|p<<16,s+=128,c-=128}return s}e.hash=function(e){var t=new n;t.update(e);var r=t.digest();return t.clean(),r}}(sha512),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.convertSecretKeyToX25519=e.convertPublicKeyToX25519=e.verify=e.sign=e.extractPublicKeyFromSecretKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.SEED_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=e.SIGNATURE_LENGTH=void 0;const t=random,r=sha512,n=wipe$1;function o(e){const t=new Float64Array(16);if(e)for(let r=0;r<e.length;r++)t[r]=e[r];return t}e.SIGNATURE_LENGTH=64,e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=64,e.SEED_LENGTH=32;new Uint8Array(32)[0]=9;const i=o(),a=o([1]),s=o([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),c=o([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=o([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),l=o([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),d=o([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function f(e,t){for(let r=0;r<16;r++)e[r]=0|t[r]}function h(e){let t=1;for(let r=0;r<16;r++){let n=e[r]+t+65535;t=Math.floor(n/65536),e[r]=n-65536*t}e[0]+=t-1+37*(t-1)}function p(e,t,r){const n=~(r-1);for(let o=0;o<16;o++){const r=n&(e[o]^t[o]);e[o]^=r,t[o]^=r}}function y(e,t){const r=o(),n=o();for(let o=0;o<16;o++)n[o]=t[o];h(n),h(n),h(n);for(let o=0;o<2;o++){r[0]=n[0]-65517;for(let t=1;t<15;t++)r[t]=n[t]-65535-(r[t-1]>>16&1),r[t-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);const e=r[15]>>16&1;r[14]&=65535,p(n,r,1-e)}for(let o=0;o<16;o++)e[2*o]=255&n[o],e[2*o+1]=n[o]>>8}function m(e,t){let r=0;for(let n=0;n<32;n++)r|=e[n]^t[n];return(1&r-1>>>8)-1}function g(e,t){const r=new Uint8Array(32),n=new Uint8Array(32);return y(r,e),y(n,t),m(r,n)}function b(e){const t=new Uint8Array(32);return y(t,e),1&t[0]}function v(e,t,r){for(let n=0;n<16;n++)e[n]=t[n]+r[n]}function w(e,t,r){for(let n=0;n<16;n++)e[n]=t[n]-r[n]}function _(e,t,r){let n,o,i=0,a=0,s=0,c=0,u=0,l=0,d=0,f=0,h=0,p=0,y=0,m=0,g=0,b=0,v=0,w=0,_=0,I=0,T=0,k=0,$=0,S=0,A=0,E=0,C=0,R=0,O=0,N=0,P=0,M=0,B=0,D=r[0],x=r[1],L=r[2],U=r[3],j=r[4],F=r[5],q=r[6],K=r[7],H=r[8],G=r[9],z=r[10],V=r[11],W=r[12],Q=r[13],Y=r[14],X=r[15];n=t[0],i+=n*D,a+=n*x,s+=n*L,c+=n*U,u+=n*j,l+=n*F,d+=n*q,f+=n*K,h+=n*H,p+=n*G,y+=n*z,m+=n*V,g+=n*W,b+=n*Q,v+=n*Y,w+=n*X,n=t[1],a+=n*D,s+=n*x,c+=n*L,u+=n*U,l+=n*j,d+=n*F,f+=n*q,h+=n*K,p+=n*H,y+=n*G,m+=n*z,g+=n*V,b+=n*W,v+=n*Q,w+=n*Y,_+=n*X,n=t[2],s+=n*D,c+=n*x,u+=n*L,l+=n*U,d+=n*j,f+=n*F,h+=n*q,p+=n*K,y+=n*H,m+=n*G,g+=n*z,b+=n*V,v+=n*W,w+=n*Q,_+=n*Y,I+=n*X,n=t[3],c+=n*D,u+=n*x,l+=n*L,d+=n*U,f+=n*j,h+=n*F,p+=n*q,y+=n*K,m+=n*H,g+=n*G,b+=n*z,v+=n*V,w+=n*W,_+=n*Q,I+=n*Y,T+=n*X,n=t[4],u+=n*D,l+=n*x,d+=n*L,f+=n*U,h+=n*j,p+=n*F,y+=n*q,m+=n*K,g+=n*H,b+=n*G,v+=n*z,w+=n*V,_+=n*W,I+=n*Q,T+=n*Y,k+=n*X,n=t[5],l+=n*D,d+=n*x,f+=n*L,h+=n*U,p+=n*j,y+=n*F,m+=n*q,g+=n*K,b+=n*H,v+=n*G,w+=n*z,_+=n*V,I+=n*W,T+=n*Q,k+=n*Y,$+=n*X,n=t[6],d+=n*D,f+=n*x,h+=n*L,p+=n*U,y+=n*j,m+=n*F,g+=n*q,b+=n*K,v+=n*H,w+=n*G,_+=n*z,I+=n*V,T+=n*W,k+=n*Q,$+=n*Y,S+=n*X,n=t[7],f+=n*D,h+=n*x,p+=n*L,y+=n*U,m+=n*j,g+=n*F,b+=n*q,v+=n*K,w+=n*H,_+=n*G,I+=n*z,T+=n*V,k+=n*W,$+=n*Q,S+=n*Y,A+=n*X,n=t[8],h+=n*D,p+=n*x,y+=n*L,m+=n*U,g+=n*j,b+=n*F,v+=n*q,w+=n*K,_+=n*H,I+=n*G,T+=n*z,k+=n*V,$+=n*W,S+=n*Q,A+=n*Y,E+=n*X,n=t[9],p+=n*D,y+=n*x,m+=n*L,g+=n*U,b+=n*j,v+=n*F,w+=n*q,_+=n*K,I+=n*H,T+=n*G,k+=n*z,$+=n*V,S+=n*W,A+=n*Q,E+=n*Y,C+=n*X,n=t[10],y+=n*D,m+=n*x,g+=n*L,b+=n*U,v+=n*j,w+=n*F,_+=n*q,I+=n*K,T+=n*H,k+=n*G,$+=n*z,S+=n*V,A+=n*W,E+=n*Q,C+=n*Y,R+=n*X,n=t[11],m+=n*D,g+=n*x,b+=n*L,v+=n*U,w+=n*j,_+=n*F,I+=n*q,T+=n*K,k+=n*H,$+=n*G,S+=n*z,A+=n*V,E+=n*W,C+=n*Q,R+=n*Y,O+=n*X,n=t[12],g+=n*D,b+=n*x,v+=n*L,w+=n*U,_+=n*j,I+=n*F,T+=n*q,k+=n*K,$+=n*H,S+=n*G,A+=n*z,E+=n*V,C+=n*W,R+=n*Q,O+=n*Y,N+=n*X,n=t[13],b+=n*D,v+=n*x,w+=n*L,_+=n*U,I+=n*j,T+=n*F,k+=n*q,$+=n*K,S+=n*H,A+=n*G,E+=n*z,C+=n*V,R+=n*W,O+=n*Q,N+=n*Y,P+=n*X,n=t[14],v+=n*D,w+=n*x,_+=n*L,I+=n*U,T+=n*j,k+=n*F,$+=n*q,S+=n*K,A+=n*H,E+=n*G,C+=n*z,R+=n*V,O+=n*W,N+=n*Q,P+=n*Y,M+=n*X,n=t[15],w+=n*D,_+=n*x,I+=n*L,T+=n*U,k+=n*j,$+=n*F,S+=n*q,A+=n*K,E+=n*H,C+=n*G,R+=n*z,O+=n*V,N+=n*W,P+=n*Q,M+=n*Y,B+=n*X,i+=38*_,a+=38*I,s+=38*T,c+=38*k,u+=38*$,l+=38*S,d+=38*A,f+=38*E,h+=38*C,p+=38*R,y+=38*O,m+=38*N,g+=38*P,b+=38*M,v+=38*B,o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=p+o+65535,o=Math.floor(n/65536),p=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=m+o+65535,o=Math.floor(n/65536),m=n-65536*o,n=g+o+65535,o=Math.floor(n/65536),g=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,i+=o-1+37*(o-1),o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=p+o+65535,o=Math.floor(n/65536),p=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=m+o+65535,o=Math.floor(n/65536),m=n-65536*o,n=g+o+65535,o=Math.floor(n/65536),g=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,i+=o-1+37*(o-1),e[0]=i,e[1]=a,e[2]=s,e[3]=c,e[4]=u,e[5]=l,e[6]=d,e[7]=f,e[8]=h,e[9]=p,e[10]=y,e[11]=m,e[12]=g,e[13]=b,e[14]=v,e[15]=w}function I(e,t){_(e,t,t)}function T(e,t){const r=o();let n;for(n=0;n<16;n++)r[n]=t[n];for(n=253;n>=0;n--)I(r,r),2!==n&&4!==n&&_(r,r,t);for(n=0;n<16;n++)e[n]=r[n]}function k(e,t){const r=o(),n=o(),i=o(),a=o(),s=o(),u=o(),l=o(),d=o(),f=o();w(r,e[1],e[0]),w(f,t[1],t[0]),_(r,r,f),v(n,e[0],e[1]),v(f,t[0],t[1]),_(n,n,f),_(i,e[3],t[3]),_(i,i,c),_(a,e[2],t[2]),v(a,a,a),w(s,n,r),w(u,a,i),v(l,a,i),v(d,n,r),_(e[0],s,u),_(e[1],d,l),_(e[2],l,u),_(e[3],s,d)}function $(e,t,r){for(let n=0;n<4;n++)p(e[n],t[n],r)}function S(e,t){const r=o(),n=o(),i=o();T(i,t[2]),_(r,t[0],i),_(n,t[1],i),y(e,n),e[31]^=b(r)<<7}function A(e,t,r){f(e[0],i),f(e[1],a),f(e[2],a),f(e[3],i);for(let n=255;n>=0;--n){const o=r[n/8|0]>>(7&n)&1;$(e,t,o),k(t,e),k(e,e),$(e,t,o)}}function E(e,t){const r=[o(),o(),o(),o()];f(r[0],u),f(r[1],l),f(r[2],a),_(r[3],u,l),A(e,r,t)}function C(t){if(t.length!==e.SEED_LENGTH)throw new Error(`ed25519: seed must be ${e.SEED_LENGTH} bytes`);const n=(0,r.hash)(t);n[0]&=248,n[31]&=127,n[31]|=64;const i=new Uint8Array(32),a=[o(),o(),o(),o()];E(a,n),S(i,a);const s=new Uint8Array(64);return s.set(t),s.set(i,32),{publicKey:i,secretKey:s}}e.generateKeyPairFromSeed=C,e.generateKeyPair=function(e){const r=(0,t.randomBytes)(32,e),o=C(r);return(0,n.wipe)(r),o},e.extractPublicKeyFromSecretKey=function(t){if(t.length!==e.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${e.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))};const R=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function O(e,t){let r,n,o,i;for(n=63;n>=32;--n){for(r=0,o=n-32,i=n-12;o<i;++o)t[o]+=r-16*t[n]*R[o-(n-32)],r=Math.floor((t[o]+128)/256),t[o]-=256*r;t[o]+=r,t[n]=0}for(r=0,o=0;o<32;o++)t[o]+=r-(t[31]>>4)*R[o],r=t[o]>>8,t[o]&=255;for(o=0;o<32;o++)t[o]-=r*R[o];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function N(e){const t=new Float64Array(64);for(let r=0;r<64;r++)t[r]=e[r];for(let r=0;r<64;r++)e[r]=0;O(e,t)}function P(e,t){const r=o(),n=o(),c=o(),u=o(),l=o(),h=o(),p=o();return f(e[2],a),function(e,t){for(let r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(e[1],t),I(c,e[1]),_(u,c,s),w(c,c,e[2]),v(u,e[2],u),I(l,u),I(h,l),_(p,h,l),_(r,p,c),_(r,r,u),function(e,t){const r=o();let n;for(n=0;n<16;n++)r[n]=t[n];for(n=250;n>=0;n--)I(r,r),1!==n&&_(r,r,t);for(n=0;n<16;n++)e[n]=r[n]}(r,r),_(r,r,c),_(r,r,u),_(r,r,u),_(e[0],r,u),I(n,e[0]),_(n,n,u),g(n,c)&&_(e[0],e[0],d),I(n,e[0]),_(n,n,u),g(n,c)?-1:(b(e[0])===t[31]>>7&&w(e[0],i,e[0]),_(e[3],e[0],e[1]),0)}e.sign=function(e,t){const n=new Float64Array(64),i=[o(),o(),o(),o()],a=(0,r.hash)(e.subarray(0,32));a[0]&=248,a[31]&=127,a[31]|=64;const s=new Uint8Array(64);s.set(a.subarray(32),32);const c=new r.SHA512;c.update(s.subarray(32)),c.update(t);const u=c.digest();c.clean(),N(u),E(i,u),S(s,i),c.reset(),c.update(s.subarray(0,32)),c.update(e.subarray(32)),c.update(t);const l=c.digest();N(l);for(let r=0;r<32;r++)n[r]=u[r];for(let r=0;r<32;r++)for(let e=0;e<32;e++)n[r+e]+=l[r]*a[e];return O(s.subarray(32),n),s},e.verify=function(t,n,i){const a=new Uint8Array(32),s=[o(),o(),o(),o()],c=[o(),o(),o(),o()];if(i.length!==e.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${e.SIGNATURE_LENGTH} bytes`);if(P(c,t))return!1;const u=new r.SHA512;u.update(i.subarray(0,32)),u.update(t),u.update(n);const l=u.digest();return N(l),A(s,c,l),E(c,i.subarray(32)),k(s,c),S(a,s),!m(i,a)},e.convertPublicKeyToX25519=function(e){let t=[o(),o(),o(),o()];if(P(t,e))throw new Error("Ed25519: invalid public key");let r=o(),n=o(),i=t[1];v(r,a,i),w(n,a,i),T(n,n),_(r,r,n);let s=new Uint8Array(32);return y(s,r),s},e.convertSecretKeyToX25519=function(e){const t=(0,r.hash)(e.subarray(0,32));t[0]&=248,t[31]&=127,t[31]|=64;const o=new Uint8Array(t.subarray(0,32));return(0,n.wipe)(t),o}}(ed25519);const JWT_IRIDIUM_ALG="EdDSA",JWT_IRIDIUM_TYP="JWT",JWT_DELIMITER=".",JWT_ENCODING="base64url",JSON_ENCODING="utf8",DATA_ENCODING="utf8",DID_DELIMITER=":",DID_PREFIX="did",DID_METHOD="key",MULTICODEC_ED25519_ENCODING="base58btc",MULTICODEC_ED25519_BASE="z",MULTICODEC_ED25519_HEADER="K36",KEY_PAIR_SEED_LENGTH=32;function allocUnsafe$1(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}function concat(e,t){t||(t=e.reduce(((e,t)=>e+t.length),0));const r=allocUnsafe$1(t);let n=0;for(const o of e)r.set(o,n),n+=o.length;return r}function base$3(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<e.length;o++){var i=e.charAt(o),a=i.charCodeAt(0);if(255!==r[a])throw new TypeError(i+" is ambiguous");r[a]=o}var s=e.length,c=e.charAt(0),u=Math.log(s)/Math.log(256),l=Math.log(256)/Math.log(s);function d(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,o=0;e[t]===c;)n++,t++;for(var i=(e.length-t)*u+1>>>0,a=new Uint8Array(i);e[t];){var l=r[e.charCodeAt(t)];if(255===l)return;for(var d=0,f=i-1;(0!==l||d<o)&&-1!==f;f--,d++)l+=s*a[f]>>>0,a[f]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=d,t++}if(" "!==e[t]){for(var h=i-o;h!==i&&0===a[h];)h++;for(var p=new Uint8Array(n+(i-h)),y=n;h!==i;)p[y++]=a[h++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,o=0,i=t.length;o!==i&&0===t[o];)o++,r++;for(var a=(i-o)*l+1>>>0,u=new Uint8Array(a);o!==i;){for(var d=t[o],f=0,h=a-1;(0!==d||f<n)&&-1!==h;h--,f++)d+=256*u[h]>>>0,u[h]=d%s>>>0,d=d/s>>>0;if(0!==d)throw new Error("Non-zero carry");n=f,o++}for(var p=a-n;p!==a&&0===u[p];)p++;for(var y=c.repeat(r);p<a;++p)y+=e.charAt(u[p]);return y},decodeUnsafe:d,decode:function(e){var r=d(e);if(r)return r;throw new Error(`Non-${t} character`)}}}var src=base$3,_brrp__multiformats_scope_baseX=src;const coerce=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},fromString$2=e=>(new TextEncoder).encode(e),toString$2=e=>(new TextDecoder).decode(e);class Encoder{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Decoder{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){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))}throw Error("Can only multibase decode strings")}or(e){return or$2(this,e)}}class ComposedDecoder{constructor(e){this.decoders=e}or(e){return or$2(this,e)}decode(e){const t=e[0],r=this.decoders[t];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 or$2=(e,t)=>new ComposedDecoder({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class Codec{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new Encoder(e,t,r),this.decoder=new Decoder(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const from$1=({name:e,prefix:t,encode:r,decode:n})=>new Codec(e,t,r,n),baseX=({prefix:e,name:t,alphabet:r})=>{const{encode:n,decode:o}=_brrp__multiformats_scope_baseX(r,t);return from$1({prefix:e,name:t,encode:n,decode:e=>coerce(o(e))})},decode$2=(e,t,r,n)=>{const o={};for(let l=0;l<t.length;++l)o[t[l]]=l;let i=e.length;for(;"="===e[i-1];)--i;const a=new Uint8Array(i*r/8|0);let s=0,c=0,u=0;for(let l=0;l<i;++l){const t=o[e[l]];if(void 0===t)throw new SyntaxError(`Non-${n} character`);c=c<<r|t,s+=r,s>=8&&(s-=8,a[u++]=255&c>>s)}if(s>=r||255&c<<8-s)throw new SyntaxError("Unexpected end of data");return a},encode$1=(e,t,r)=>{const n="="===t[t.length-1],o=(1<<r)-1;let i="",a=0,s=0;for(let c=0;c<e.length;++c)for(s=s<<8|e[c],a+=8;a>r;)a-=r,i+=t[o&s>>a];if(a&&(i+=t[o&s<<r-a]),n)for(;i.length*r&7;)i+="=";return i},rfc4648=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>from$1({prefix:t,name:e,encode:e=>encode$1(e,n,r),decode:t=>decode$2(t,n,r,e)}),identity=from$1({prefix:"\0",name:"identity",encode:e=>toString$2(e),decode:e=>fromString$2(e)}),identityBase=Object.freeze(Object.defineProperty({__proto__:null,identity:identity},Symbol.toStringTag,{value:"Module"})),base2=rfc4648({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),base2$1=Object.freeze(Object.defineProperty({__proto__:null,base2:base2},Symbol.toStringTag,{value:"Module"})),base8=rfc4648({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$1=Object.freeze(Object.defineProperty({__proto__:null,base8:base8},Symbol.toStringTag,{value:"Module"})),base10=baseX({prefix:"9",name:"base10",alphabet:"0123456789"}),base10$1=Object.freeze(Object.defineProperty({__proto__:null,base10:base10},Symbol.toStringTag,{value:"Module"})),base16=rfc4648({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper=rfc4648({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),base16$1=Object.freeze(Object.defineProperty({__proto__:null,base16:base16,base16upper:base16upper},Symbol.toStringTag,{value:"Module"})),base32=rfc4648({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper=rfc4648({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad=rfc4648({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper=rfc4648({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex=rfc4648({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper=rfc4648({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad=rfc4648({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper=rfc4648({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z=rfc4648({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base32$1=Object.freeze(Object.defineProperty({__proto__:null,base32:base32,base32hex:base32hex,base32hexpad:base32hexpad,base32hexpadupper:base32hexpadupper,base32hexupper:base32hexupper,base32pad:base32pad,base32padupper:base32padupper,base32upper:base32upper,base32z:base32z},Symbol.toStringTag,{value:"Module"})),base36=baseX({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper=baseX({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$1=Object.freeze(Object.defineProperty({__proto__:null,base36:base36,base36upper:base36upper},Symbol.toStringTag,{value:"Module"})),base58btc=baseX({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr=baseX({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base58=Object.freeze(Object.defineProperty({__proto__:null,base58btc:base58btc,base58flickr:base58flickr},Symbol.toStringTag,{value:"Module"})),base64=rfc4648({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad=rfc4648({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url=rfc4648({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad=rfc4648({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$1=Object.freeze(Object.defineProperty({__proto__:null,base64:base64,base64pad:base64pad,base64url:base64url,base64urlpad:base64urlpad},Symbol.toStringTag,{value:"Module"})),alphabet=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),alphabetBytesToChars=alphabet.reduce(((e,t,r)=>(e[r]=t,e)),[]),alphabetCharsToBytes=alphabet.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]);function encode(e){return e.reduce(((e,t)=>e+=alphabetBytesToChars[t]),"")}function decode$1(e){const t=[];for(const r of e){const e=alphabetCharsToBytes[r.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}const base256emoji=from$1({prefix:"🚀",name:"base256emoji",encode:encode,decode:decode$1}),base256emoji$1=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:base256emoji},Symbol.toStringTag,{value:"Module"}));new TextEncoder,new TextDecoder;const bases={...identityBase,...base2$1,...base8$1,...base10$1,...base16$1,...base32$1,...base36$1,...base58,...base64$1,...base256emoji$1};function createCodec(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const string=createCodec("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),ascii=createCodec("ascii","a",(e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}),(e=>{const t=allocUnsafe$1((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t})),BASES={utf8:string,"utf-8":string,hex:bases.base16,latin1:ascii,ascii:ascii,binary:ascii,...bases};function toString$1(e,t="utf8"){const r=BASES[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.encoder.encode(e).substring(1):globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8")}function fromString$1(e,t="utf8"){const r=BASES[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.decoder.decode(`${r.prefix}${e}`):globalThis.Buffer.from(e,"utf8")}function decodeJSON(e){return safeJsonParse$2(toString$1(fromString$1(e,JWT_ENCODING),JSON_ENCODING))}function encodeJSON(e){return toString$1(fromString$1(safeJsonStringify$2(e),JSON_ENCODING),JWT_ENCODING)}function encodeIss(e){const t=fromString$1(MULTICODEC_ED25519_HEADER,MULTICODEC_ED25519_ENCODING),r=MULTICODEC_ED25519_BASE+toString$1(concat([t,e]),MULTICODEC_ED25519_ENCODING);return[DID_PREFIX,DID_METHOD,r].join(DID_DELIMITER)}function encodeSig(e){return toString$1(e,JWT_ENCODING)}function decodeSig(e){return fromString$1(e,JWT_ENCODING)}function encodeData(e){return fromString$1([encodeJSON(e.header),encodeJSON(e.payload)].join(JWT_DELIMITER),DATA_ENCODING)}function encodeJWT(e){return[encodeJSON(e.header),encodeJSON(e.payload),encodeSig(e.signature)].join(JWT_DELIMITER)}function decodeJWT(e){const t=e.split(JWT_DELIMITER);return{header:decodeJSON(t[0]),payload:decodeJSON(t[1]),signature:decodeSig(t[2]),data:fromString$1(t.slice(0,2).join(JWT_DELIMITER),DATA_ENCODING)}}function generateKeyPair(e=random.randomBytes(KEY_PAIR_SEED_LENGTH)){return ed25519.generateKeyPairFromSeed(e)}async function signJWT(e,t,r,n,o=cjs$7.fromMiliseconds(Date.now())){const i={alg:JWT_IRIDIUM_ALG,typ:JWT_IRIDIUM_TYP},a={iss:encodeIss(n.publicKey),sub:e,aud:t,iat:o,exp:o+r},s=encodeData({header:i,payload:a});return encodeJWT({header:i,payload:a,signature:ed25519.sign(n.secretKey,s)})}var cjs$6={};function getFromWindow$2(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}function getFromWindowOrThrow$2(e){const t=getFromWindow$2(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}function getDocumentOrThrow$2(){return getFromWindowOrThrow$2("document")}function getDocument$2(){return getFromWindow$2("document")}Object.defineProperty(cjs$6,"__esModule",{value:!0}),cjs$6.getLocalStorage=cjs$6.getLocalStorageOrThrow=cjs$6.getCrypto=cjs$6.getCryptoOrThrow=getLocation_1$1=cjs$6.getLocation=cjs$6.getLocationOrThrow=getNavigator_1$1=cjs$6.getNavigator=cjs$6.getNavigatorOrThrow=getDocument_1$1=cjs$6.getDocument=cjs$6.getDocumentOrThrow=cjs$6.getFromWindowOrThrow=cjs$6.getFromWindow=void 0,cjs$6.getFromWindow=getFromWindow$2,cjs$6.getFromWindowOrThrow=getFromWindowOrThrow$2,cjs$6.getDocumentOrThrow=getDocumentOrThrow$2;var getDocument_1$1=cjs$6.getDocument=getDocument$2;function getNavigatorOrThrow$2(){return getFromWindowOrThrow$2("navigator")}function getNavigator$2(){return getFromWindow$2("navigator")}cjs$6.getNavigatorOrThrow=getNavigatorOrThrow$2;var getNavigator_1$1=cjs$6.getNavigator=getNavigator$2;function getLocationOrThrow$2(){return getFromWindowOrThrow$2("location")}function getLocation$2(){return getFromWindow$2("location")}cjs$6.getLocationOrThrow=getLocationOrThrow$2;var getLocation_1$1=cjs$6.getLocation=getLocation$2;function getCryptoOrThrow$2(){return getFromWindowOrThrow$2("crypto")}function getCrypto$2(){return getFromWindow$2("crypto")}function getLocalStorageOrThrow$2(){return getFromWindowOrThrow$2("localStorage")}function getLocalStorage$2(){return getFromWindow$2("localStorage")}cjs$6.getCryptoOrThrow=getCryptoOrThrow$2,cjs$6.getCrypto=getCrypto$2,cjs$6.getLocalStorageOrThrow=getLocalStorageOrThrow$2,cjs$6.getLocalStorage=getLocalStorage$2;var cjs$5={};Object.defineProperty(cjs$5,"__esModule",{value:!0}),cjs$5.getWindowMetadata=void 0;const window_getters_1$2=cjs$6;function getWindowMetadata$2(){let e,t;try{e=window_getters_1$2.getDocumentOrThrow(),t=window_getters_1$2.getLocationOrThrow()}catch(e2){return null}function r(...t){const r=e.getElementsByTagName("meta");for(let e=0;e<r.length;e++){const n=r[e],o=["itemprop","property","name"].map((e=>n.getAttribute(e))).filter((e=>!!e&&t.includes(e)));if(o.length&&o){const e=n.getAttribute("content");if(e)return e}}return""}const n=function(){let t=r("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}();return{description:r("description","og:description","twitter:description","keywords"),url:t.origin,icons:function(){const r=e.getElementsByTagName("link"),n=[];for(let e=0;e<r.length;e++){const o=r[e],i=o.getAttribute("rel");if(i&&i.toLowerCase().indexOf("icon")>-1){const e=o.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let r=t.protocol+"//"+t.host;if(0===e.indexOf("/"))r+=e;else{const n=t.pathname.split("/");n.pop();r+=n.join("/")+"/"+e}n.push(r)}else if(0===e.indexOf("//")){const r=t.protocol+e;n.push(r)}else n.push(e)}}return n}(),name:n}}cjs$5.getWindowMetadata=getWindowMetadata$2;var queryString={},strictUriEncode=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)),token="%[a-f0-9]{2}",singleMatcher=new RegExp("("+token+")|([^%]+?)","gi"),multiMatcher=new RegExp("("+token+")+","gi");function decodeComponents(e,t){try{return[decodeURIComponent(e.join(""))]}catch(o){}if(1===e.length)return e;t=t||1;var r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],decodeComponents(r),decodeComponents(n))}function decode(e){try{return decodeURIComponent(e)}catch(n){for(var t=e.match(singleMatcher)||[],r=1;r<t.length;r++)t=(e=decodeComponents(t,r).join("")).match(singleMatcher)||[];return e}}function customDecodeURIComponent(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},r=multiMatcher.exec(e);r;){try{t[r[0]]=decodeURIComponent(r[0])}catch(s){var n=decode(r[0]);n!==r[0]&&(t[r[0]]=n)}r=multiMatcher.exec(e)}t["%C2"]="�";for(var o=Object.keys(t),i=0;i<o.length;i++){var a=o[i];e=e.replace(new RegExp(a,"g"),t[a])}return e}var decodeUriComponent=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return customDecodeURIComponent(e)}},splitOnFirst=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const r=e.indexOf(t);return-1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]},filterObj=function(e,t){for(var r={},n=Object.keys(e),o=Array.isArray(t),i=0;i<n.length;i++){var a=n[i],s=e[a];(o?-1!==t.indexOf(a):t(a,s,e))&&(r[a]=s)}return r};function createCommonjsModule(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return commonjsRequire(e,null==t?r.path:t)}},r.exports),r.exports}function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}!function(e){const t=strictUriEncode,r=decodeUriComponent,n=splitOnFirst,o=filterObj,i=Symbol("encodeFragmentIdentifier");function a(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function s(e,r){return r.encode?r.strict?t(e):encodeURIComponent(e):e}function c(e,t){return t.decode?r(e):e}function u(e){return Array.isArray(e)?e.sort():"object"==typeof e?u(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function l(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function d(e){const t=(e=l(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function f(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function h(e,t){a((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):n[e]=r};case"bracket":return(e,r,n)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"colon-list-separator":return(e,r,n)=>{t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"comma":case"separator":return(t,r,n)=>{const o="string"==typeof r&&r.includes(e.arrayFormatSeparator),i="string"==typeof r&&!o&&c(r,e).includes(e.arrayFormatSeparator);r=i?c(r,e):r;const a=o||i?r.split(e.arrayFormatSeparator).map((t=>c(t,e))):null===r?r:c(r,e);n[t]=a};case"bracket-separator":return(t,r,n)=>{const o=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!o)return void(n[t]=r?c(r,e):r);const i=null===r?[]:r.split(e.arrayFormatSeparator).map((t=>c(t,e)));void 0!==n[t]?n[t]=[].concat(n[t],i):n[t]=i};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),o=Object.create(null);if("string"!=typeof e)return o;if(!(e=e.trim().replace(/^[?#&]/,"")))return o;for(const i of e.split("&")){if(""===i)continue;let[e,a]=n(t.decode?i.replace(/\+/g," "):i,"=");a=void 0===a?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?a:c(a,t),r(c(e,t),a,o)}for(const n of Object.keys(o)){const e=o[n];if("object"==typeof e&&null!==e)for(const r of Object.keys(e))e[r]=f(e[r],t);else o[n]=f(e,t)}return!1===t.sort?o:(!0===t.sort?Object.keys(o).sort():Object.keys(o).sort(t.sort)).reduce(((e,t)=>{const r=o[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=u(r):e[t]=r,e}),Object.create(null))}e.extract=d,e.parse=h,e.stringify=(e,t)=>{if(!e)return"";a((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const o=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[s(t,e),"[",o,"]"].join("")]:[...r,[s(t,e),"[",s(o,e),"]=",s(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[s(t,e),"[]"].join("")]:[...r,[s(t,e),"[]=",s(n,e)].join("")];case"colon-list-separator":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[s(t,e),":list="].join("")]:[...r,[s(t,e),":list=",s(n,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return r=>(n,o)=>void 0===o||e.skipNull&&null===o||e.skipEmptyString&&""===o?n:(o=null===o?"":o,0===n.length?[[s(r,e),t,s(o,e)].join("")]:[[n,s(o,e)].join(e.arrayFormatSeparator)])}default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,s(t,e)]:[...r,[s(t,e),"=",s(n,e)].join("")]}}(t),o={};for(const a of Object.keys(e))r(a)||(o[a]=e[a]);const i=Object.keys(o);return!1!==t.sort&&i.sort(t.sort),i.map((r=>{const o=e[r];return void 0===o?"":null===o?s(r,t):Array.isArray(o)?0===o.length&&"bracket-separator"===t.arrayFormat?s(r,t)+"[]":o.reduce(n(r),[]).join("&"):s(r,t)+"="+s(o,t)})).filter((e=>e.length>0)).join("&")},e.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,o]=n(e,"#");return Object.assign({url:r.split("?")[0]||"",query:h(d(e),t)},t&&t.parseFragmentIdentifier&&o?{fragmentIdentifier:c(o,t)}:{})},e.stringifyUrl=(t,r)=>{r=Object.assign({encode:!0,strict:!0,[i]:!0},r);const n=l(t.url).split("?")[0]||"",o=e.extract(t.url),a=e.parse(o,{sort:!1}),c=Object.assign(a,t.query);let u=e.stringify(c,r);u&&(u=`?${u}`);let d=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(t.url);return t.fragmentIdentifier&&(d=`#${r[i]?s(t.fragmentIdentifier,r):t.fragmentIdentifier}`),`${n}${u}${d}`},e.pick=(t,r,n)=>{n=Object.assign({parseFragmentIdentifier:!0,[i]:!1},n);const{url:a,query:s,fragmentIdentifier:c}=e.parseUrl(t,n);return e.stringifyUrl({url:a,query:o(s,r),fragmentIdentifier:c},n)},e.exclude=(t,r,n)=>{const o=Array.isArray(r)?e=>!r.includes(e):(e,t)=>!r(e,t);return e.pick(t,o,n)}}(queryString);var minimalisticAssert=assert$i;function assert$i(e,t){if(!e)throw new Error(t||"Assertion failed")}assert$i.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var utils_1=createCommonjsModule((function(e,t){var r=t;function n(e){return 1===e.length?"0"+e:e}function o(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(n=0;n<e.length;n++){var o=e.charCodeAt(n),i=o>>8,a=255&o;i?r.push(i,a):r.push(a)}return r},r.zero2=n,r.toHex=o,r.encode=function(e,t){return"hex"===t?o(e):e}})),utils_1$1=createCommonjsModule((function(e,t){var r=t;r.assert=minimalisticAssert,r.toArray=utils_1.toArray,r.zero2=utils_1.zero2,r.toHex=utils_1.toHex,r.encode=utils_1.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var o=1<<t+1,i=e.clone(),a=0;a<n.length;a++){var s,c=i.andln(o-1);i.isOdd()?(s=c>(o>>1)-1?(o>>1)-c:c,i.isubn(s)):s=0,n[a]=s,i.iushrn(1)}return n},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,o=0,i=0;e.cmpn(-o)>0||t.cmpn(-i)>0;){var a,s,c=e.andln(3)+o&3,u=t.andln(3)+i&3;3===c&&(c=-1),3===u&&(u=-1),a=1&c?3!==(n=e.andln(7)+o&7)&&5!==n||2!==u?c:-c:0,r[0].push(a),s=1&u?3!==(n=t.andln(7)+i&7)&&5!==n||2!==c?u:-u:0,r[1].push(s),2*o===a+1&&(o=1-o),2*i===s+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r},r.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new BN$o(e,"hex","le")}})),getNAF$2=utils_1$1.getNAF,getJSF$2=utils_1$1.getJSF,assert$1$1=utils_1$1.assert;function BaseCurve$2(e,t){this.type=e,this.p=new BN$o(t.p,16),this.red=t.prime?BN$o.red(t.prime):BN$o.mont(this.p),this.zero=new BN$o(0).toRed(this.red),this.one=new BN$o(1).toRed(this.red),this.two=new BN$o(2).toRed(this.red),this.n=t.n&&new BN$o(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base$2=BaseCurve$2;function BasePoint$2(e,t){this.curve=e,this.type=t,this.precomputed=null}BaseCurve$2.prototype.point=function(){throw new Error("Not implemented")},BaseCurve$2.prototype.validate=function(){throw new Error("Not implemented")},BaseCurve$2.prototype._fixedNafMul=function(e,t){assert$1$1(e.precomputed);var r=e._getDoubles(),n=getNAF$2(t,1,this._bitLength),o=(1<<r.step+1)-(r.step%2==0?2:1);o/=3;var i,a,s=[];for(i=0;i<n.length;i+=r.step){a=0;for(var c=i+r.step-1;c>=i;c--)a=(a<<1)+n[c];s.push(a)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=o;d>0;d--){for(i=0;i<s.length;i++)(a=s[i])===d?l=l.mixedAdd(r.points[i]):a===-d&&(l=l.mixedAdd(r.points[i].neg()));u=u.add(l)}return u.toP()},BaseCurve$2.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var o=n.points,i=getNAF$2(t,r,this._bitLength),a=this.jpoint(null,null,null),s=i.length-1;s>=0;s--){for(var c=0;s>=0&&0===i[s];s--)c++;if(s>=0&&c++,a=a.dblp(c),s<0)break;var u=i[s];assert$1$1(0!==u),a="affine"===e.type?u>0?a.mixedAdd(o[u-1>>1]):a.mixedAdd(o[-u-1>>1].neg()):u>0?a.add(o[u-1>>1]):a.add(o[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},BaseCurve$2.prototype._wnafMulAdd=function(e,t,r,n,o){var i,a,s,c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,d=0;for(i=0;i<n;i++){var f=(s=t[i])._getNAFPoints(e);c[i]=f.wnd,u[i]=f.points}for(i=n-1;i>=1;i-=2){var h=i-1,p=i;if(1===c[h]&&1===c[p]){var y=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(y[1]=t[h].add(t[p]),y[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(y[1]=t[h].toJ().mixedAdd(t[p]),y[2]=t[h].add(t[p].neg())):(y[1]=t[h].toJ().mixedAdd(t[p]),y[2]=t[h].toJ().mixedAdd(t[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=getJSF$2(r[h],r[p]);for(d=Math.max(g[0].length,d),l[h]=new Array(d),l[p]=new Array(d),a=0;a<d;a++){var b=0|g[0][a],v=0|g[1][a];l[h][a]=m[3*(b+1)+(v+1)],l[p][a]=0,u[h]=y}}else l[h]=getNAF$2(r[h],c[h],this._bitLength),l[p]=getNAF$2(r[p],c[p],this._bitLength),d=Math.max(l[h].length,d),d=Math.max(l[p].length,d)}var w=this.jpoint(null,null,null),_=this._wnafT4;for(i=d;i>=0;i--){for(var I=0;i>=0;){var T=!0;for(a=0;a<n;a++)_[a]=0|l[a][i],0!==_[a]&&(T=!1);if(!T)break;I++,i--}if(i>=0&&I++,w=w.dblp(I),i<0)break;for(a=0;a<n;a++){var k=_[a];0!==k&&(k>0?s=u[a][k-1>>1]:k<0&&(s=u[a][-k-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(i=0;i<n;i++)u[i]=null;return o?w:w.toP()},BaseCurve$2.BasePoint=BasePoint$2,BasePoint$2.prototype.eq=function(){throw new Error("Not implemented")},BasePoint$2.prototype.validate=function(){return this.curve.validate(this)},BaseCurve$2.prototype.decodePoint=function(e,t){e=utils_1$1.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?assert$1$1(e[e.length-1]%2==0):7===e[0]&&assert$1$1(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},BasePoint$2.prototype.encodeCompressed=function(e){return this.encode(e,!0)},BasePoint$2.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},BasePoint$2.prototype.encode=function(e,t){return utils_1$1.encode(this._encode(t),e)},BasePoint$2.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},BasePoint$2.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},BasePoint$2.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,o=0;o<t;o+=e){for(var i=0;i<e;i++)n=n.dbl();r.push(n)}return{step:e,points:r}},BasePoint$2.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),o=1;o<r;o++)t[o]=t[o-1].add(n);return{wnd:e,points:t}},BasePoint$2.prototype._getBeta=function(){return null},BasePoint$2.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var inherits_browser=createCommonjsModule((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}})),assert$2$1=utils_1$1.assert;function ShortCurve$2(e){base$2.call(this,"short",e),this.a=new BN$o(e.a,16).toRed(this.red),this.b=new BN$o(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}inherits_browser(ShortCurve$2,base$2);var short_1=ShortCurve$2;function Point$6(e,t,r,n){base$2.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new BN$o(t,16),this.y=new BN$o(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function JPoint$2(e,t,r,n){base$2.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$o(0)):(this.x=new BN$o(t,16),this.y=new BN$o(r,16),this.z=new BN$o(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}ShortCurve$2.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new BN$o(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new BN$o(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],assert$2$1(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new BN$o(e.a,16),b:new BN$o(e.b,16)}})):this._getEndoBasis(r)}}},ShortCurve$2.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:BN$o.mont(e),r=new BN$o(2).toRed(t).redInvm(),n=r.redNeg(),o=new BN$o(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},ShortCurve$2.prototype._getEndoBasis=function(e){for(var t,r,n,o,i,a,s,c,u,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,f=this.n.clone(),h=new BN$o(1),p=new BN$o(0),y=new BN$o(0),m=new BN$o(1),g=0;0!==d.cmpn(0);){var b=f.div(d);c=f.sub(b.mul(d)),u=y.sub(b.mul(h));var v=m.sub(b.mul(p));if(!n&&c.cmp(l)<0)t=s.neg(),r=h,n=c.neg(),o=u;else if(n&&2==++g)break;s=c,f=d,d=c,y=h,h=u,m=p,p=v}i=c.neg(),a=u;var w=n.sqr().add(o.sqr());return i.sqr().add(a.sqr()).cmp(w)>=0&&(i=t,a=r),n.negative&&(n=n.neg(),o=o.neg()),i.negative&&(i=i.neg(),a=a.neg()),[{a:n,b:o},{a:i,b:a}]},ShortCurve$2.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],o=n.b.mul(e).divRound(this.n),i=r.b.neg().mul(e).divRound(this.n),a=o.mul(r.a),s=i.mul(n.a),c=o.mul(r.b),u=i.mul(n.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},ShortCurve$2.prototype.pointFromX=function(e,t){(e=new BN$o(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(t&&!o||!t&&o)&&(n=n.redNeg()),this.point(e,n)},ShortCurve$2.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(o).cmpn(0)},ShortCurve$2.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,o=this._endoWnafT2,i=0;i<e.length;i++){var a=this._endoSplit(t[i]),s=e[i],c=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),c=c.neg(!0)),n[2*i]=s,n[2*i+1]=c,o[2*i]=a.k1,o[2*i+1]=a.k2}for(var u=this._wnafMulAdd(1,n,o,2*i,r),l=0;l<2*i;l++)n[l]=null,o[l]=null;return u},inherits_browser(Point$6,base$2.BasePoint),ShortCurve$2.prototype.point=function(e,t,r){return new Point$6(this,e,t,r)},ShortCurve$2.prototype.pointFromJSON=function(e,t){return Point$6.fromJSON(this,e,t)},Point$6.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Point$6.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Point$6.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function o(t){return e.point(t[0],t[1],r)}var i=t[2];return n.precomputed={beta:null,doubles:i.doubles&&{step:i.doubles.step,points:[n].concat(i.doubles.points.map(o))},naf:i.naf&&{wnd:i.naf.wnd,points:[n].concat(i.naf.points.map(o))}},n},Point$6.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Point$6.prototype.isInfinity=function(){return this.inf},Point$6.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Point$6.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),o=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),i=o.redSqr().redISub(this.x.redAdd(this.x)),a=o.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,a)},Point$6.prototype.getX=function(){return this.x.fromRed()},Point$6.prototype.getY=function(){return this.y.fromRed()},Point$6.prototype.mul=function(e){return e=new BN$o(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Point$6.prototype.mulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o):this.curve._wnafMulAdd(1,n,o,2)},Point$6.prototype.jmulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o,!0):this.curve._wnafMulAdd(1,n,o,2,!0)},Point$6.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},Point$6.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},Point$6.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},inherits_browser(JPoint$2,base$2.BasePoint),ShortCurve$2.prototype.jpoint=function(e,t,r){return new JPoint$2(this,e,t,r)},JPoint$2.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},JPoint$2.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint$2.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),o=e.x.redMul(r),i=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(o),c=i.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),d=n.redMul(u),f=c.redSqr().redIAdd(l).redISub(d).redISub(d),h=c.redMul(d.redISub(f)).redISub(i.redMul(l)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(f,h,p)},JPoint$2.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),o=this.y,i=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=o.redSub(i);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),l=r.redMul(c),d=s.redSqr().redIAdd(u).redISub(l).redISub(l),f=s.redMul(l.redISub(d)).redISub(o.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(d,f,h)},JPoint$2.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var n=this.curve.a,o=this.curve.tinv,i=this.x,a=this.y,s=this.z,c=s.redSqr().redSqr(),u=a.redAdd(a);for(t=0;t<e;t++){var l=i.redSqr(),d=u.redSqr(),f=d.redSqr(),h=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(c)),p=i.redMul(d),y=h.redSqr().redISub(p.redAdd(p)),m=p.redISub(y),g=h.redMul(m);g=g.redIAdd(g).redISub(f);var b=u.redMul(s);t+1<e&&(c=c.redMul(f)),i=y,s=b,u=g}return this.curve.jpoint(i,u.redMul(o),s)},JPoint$2.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},JPoint$2.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),i=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(n).redISub(i);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n),c=s.redSqr().redISub(a).redISub(a),u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),e=c,t=s.redMul(a.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),d=this.y.redSqr(),f=d.redSqr(),h=this.x.redAdd(d).redSqr().redISub(l).redISub(f);h=h.redIAdd(h);var p=l.redAdd(l).redIAdd(l),y=p.redSqr(),m=f.redIAdd(f);m=(m=m.redIAdd(m)).redIAdd(m),e=y.redISub(h).redISub(h),t=p.redMul(h.redISub(e)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},JPoint$2.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),i=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(n).redISub(i);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),c=s.redSqr().redISub(a).redISub(a);e=c;var u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),t=s.redMul(a.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),d=this.y.redSqr(),f=this.x.redMul(d),h=this.x.redSub(l).redMul(this.x.redAdd(l));h=h.redAdd(h).redIAdd(h);var p=f.redIAdd(f),y=(p=p.redIAdd(p)).redAdd(p);e=h.redSqr().redISub(y),r=this.y.redAdd(this.z).redSqr().redISub(d).redISub(l);var m=d.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),t=h.redMul(p.redISub(e)).redISub(m)}return this.curve.jpoint(e,t,r)},JPoint$2.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,o=n.redSqr().redSqr(),i=t.redSqr(),a=r.redSqr(),s=i.redAdd(i).redIAdd(i).redIAdd(e.redMul(o)),c=t.redAdd(t),u=(c=c.redIAdd(c)).redMul(a),l=s.redSqr().redISub(u.redAdd(u)),d=u.redISub(l),f=a.redSqr();f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var h=s.redMul(d).redISub(f),p=r.redAdd(r).redMul(n);return this.curve.jpoint(l,h,p)},JPoint$2.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),o=e.redAdd(e).redIAdd(e),i=o.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).redISub(n),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(i)).redSqr(),c=n.redIAdd(n);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var u=o.redIAdd(a).redSqr().redISub(i).redISub(s).redISub(c),l=t.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var d=this.x.redMul(s).redISub(l);d=(d=d.redIAdd(d)).redIAdd(d);var f=this.y.redMul(u.redMul(c.redISub(u)).redISub(a.redMul(s)));f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var h=this.z.redAdd(a).redSqr().redISub(r).redISub(s);return this.curve.jpoint(d,f,h)},JPoint$2.prototype.mul=function(e,t){return e=new BN$o(e,t),this.curve._wnafMul(this,e)},JPoint$2.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),o=r.redMul(e.z);return 0===this.y.redMul(o).redISub(e.y.redMul(n)).cmpn(0)},JPoint$2.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),o=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(o),0===this.x.cmp(r))return!0}},JPoint$2.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},JPoint$2.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var curve_1=createCommonjsModule((function(e,t){var r=t;r.base=base$2,r.short=short_1,r.mont=null,r.edwards=null})),curves_1=createCommonjsModule((function(e,t){var r,n=t,o=utils_1$1.assert;function i(e){"short"===e.type?this.curve=new curve_1.short(e):"edwards"===e.type?this.curve=new curve_1.edwards(e):this.curve=new curve_1.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new i(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=i,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:hash$7.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:hash$7.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:hash$7.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:hash$7.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:hash$7.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash$7.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash$7.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(e2){r=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:hash$7.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function HmacDRBG$2(e){if(!(this instanceof HmacDRBG$2))return new HmacDRBG$2(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=utils_1.toArray(e.entropy,e.entropyEnc||"hex"),r=utils_1.toArray(e.nonce,e.nonceEnc||"hex"),n=utils_1.toArray(e.pers,e.persEnc||"hex");minimalisticAssert(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var hmacDrbg=HmacDRBG$2;HmacDRBG$2.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o<this.V.length;o++)this.K[o]=0,this.V[o]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},HmacDRBG$2.prototype._hmac=function(){return new hash$7.hmac(this.hash,this.K)},HmacDRBG$2.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},HmacDRBG$2.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=utils_1.toArray(e,t),r=utils_1.toArray(r,n),minimalisticAssert(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},HmacDRBG$2.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=utils_1.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length<e;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var i=o.slice(0,e);return this._update(r),this._reseed++,utils_1.encode(i,t)};var assert$3$1=utils_1$1.assert;function KeyPair$8(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var key$4=KeyPair$8;KeyPair$8.fromPublic=function(e,t,r){return t instanceof KeyPair$8?t:new KeyPair$8(e,{pub:t,pubEnc:r})},KeyPair$8.fromPrivate=function(e,t,r){return t instanceof KeyPair$8?t:new KeyPair$8(e,{priv:t,privEnc:r})},KeyPair$8.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},KeyPair$8.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},KeyPair$8.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},KeyPair$8.prototype._importPrivate=function(e,t){this.priv=new BN$o(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},KeyPair$8.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?assert$3$1(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||assert$3$1(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},KeyPair$8.prototype.derive=function(e){return e.validate()||assert$3$1(e.validate(),"public point not validated"),e.mul(this.priv).getX()},KeyPair$8.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},KeyPair$8.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},KeyPair$8.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var assert$4$1=utils_1$1.assert;function Signature$8(e,t){if(e instanceof Signature$8)return e;this._importDER(e,t)||(assert$4$1(e.r&&e.s,"Signature without r or s"),this.r=new BN$o(e.r,16),this.s=new BN$o(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var signature$4=Signature$8;function Position$2(){this.place=0}function getLength$2(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var o=0,i=0,a=t.place;i<n;i++,a++)o<<=8,o|=e[a],o>>>=0;return!(o<=127)&&(t.place=a,o)}function rmPadding$2(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function constructLength$2(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}Signature$8.prototype._importDER=function(e,t){e=utils_1$1.toArray(e,t);var r=new Position$2;if(48!==e[r.place++])return!1;var n=getLength$2(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var o=getLength$2(e,r);if(!1===o)return!1;var i=e.slice(r.place,o+r.place);if(r.place+=o,2!==e[r.place++])return!1;var a=getLength$2(e,r);if(!1===a)return!1;if(e.length!==a+r.place)return!1;var s=e.slice(r.place,a+r.place);if(0===i[0]){if(!(128&i[1]))return!1;i=i.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new BN$o(i),this.s=new BN$o(s),this.recoveryParam=null,!0},Signature$8.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=rmPadding$2(t),r=rmPadding$2(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];constructLength$2(n,t.length),(n=n.concat(t)).push(2),constructLength$2(n,r.length);var o=n.concat(r),i=[48];return constructLength$2(i,o.length),i=i.concat(o),utils_1$1.encode(i,e)};var rand$2=function(){throw new Error("unsupported")},assert$5$1=utils_1$1.assert;function EC$2(e){if(!(this instanceof EC$2))return new EC$2(e);"string"==typeof e&&(assert$5$1(Object.prototype.hasOwnProperty.call(curves_1,e),"Unknown curve "+e),e=curves_1[e]),e instanceof curves_1.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var ec$2=EC$2;EC$2.prototype.keyPair=function(e){return new key$4(this,e)},EC$2.prototype.keyFromPrivate=function(e,t){return key$4.fromPrivate(this,e,t)},EC$2.prototype.keyFromPublic=function(e,t){return key$4.fromPublic(this,e,t)},EC$2.prototype.genKeyPair=function(e){e||(e={});for(var t=new hmacDrbg({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||rand$2(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new BN$o(2));;){var o=new BN$o(t.generate(r));if(!(o.cmp(n)>0))return o.iaddn(1),this.keyFromPrivate(o)}},EC$2.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},EC$2.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new BN$o(e,16));for(var o=this.n.byteLength(),i=t.getPrivate().toArray("be",o),a=e.toArray("be",o),s=new hmacDrbg({hash:this.hash,entropy:i,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(new BN$o(1)),u=0;;u++){var l=n.k?n.k(u):new BN$o(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(c)>=0)){var d=this.g.mul(l);if(!d.isInfinity()){var f=d.getX(),h=f.umod(this.n);if(0!==h.cmpn(0)){var p=l.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var y=(d.getY().isOdd()?1:0)|(0!==f.cmp(h)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),y^=1),new signature$4({r:h,s:p,recoveryParam:y})}}}}}},EC$2.prototype.verify=function(e,t,r,n){e=this._truncateToN(new BN$o(e,16)),r=this.keyFromPublic(r,n);var o=(t=new signature$4(t,"hex")).r,i=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;var a,s=i.invm(this.n),c=s.mul(e).umod(this.n),u=s.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,r.getPublic(),u)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(c,r.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},EC$2.prototype.recoverPubKey=function(e,t,r,n){assert$5$1((3&r)===r,"The recovery param is more than two bits"),t=new signature$4(t,n);var o=this.n,i=new BN$o(e),a=t.r,s=t.s,c=1&r,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var l=t.r.invm(o),d=o.sub(i).mul(l).umod(o),f=s.mul(l).umod(o);return this.g.mulAdd(d,a,f)},EC$2.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new signature$4(t,n)).recoveryParam)return t.recoveryParam;for(var o=0;o<4;o++){var i;try{i=this.recoverPubKey(e,t,o)}catch(a){continue}if(i.eq(r))return o}throw new Error("Unable to find valid recovery factor")};var elliptic_1=createCommonjsModule((function(e,t){var r=t;r.version="6.5.4",r.utils=utils_1$1,r.rand=function(){throw new Error("unsupported")},r.curve=curve_1,r.curves=curves_1,r.ec=ec$2,r.eddsa=null})),EC$1$1=elliptic_1.ec;const version$4="signing-key/5.7.0",logger=new Logger$1(version$4);let _curve=null;function getCurve(){return _curve||(_curve=new EC$1$1("secp256k1")),_curve}class SigningKey{constructor(e){defineReadOnly(this,"curve","secp256k1"),defineReadOnly(this,"privateKey",hexlify(e)),32!==hexDataLength(this.privateKey)&&logger.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=getCurve().keyFromPrivate(arrayify(this.privateKey));defineReadOnly(this,"publicKey","0x"+t.getPublic(!1,"hex")),defineReadOnly(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),defineReadOnly(this,"_isSigningKey",!0)}_addPoint(e){const t=getCurve().keyFromPublic(arrayify(this.publicKey)),r=getCurve().keyFromPublic(arrayify(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=getCurve().keyFromPrivate(arrayify(this.privateKey)),r=arrayify(e);32!==r.length&&logger.throwArgumentError("bad digest length","digest",e);const n=t.sign(r,{canonical:!0});return splitSignature({recoveryParam:n.recoveryParam,r:hexZeroPad("0x"+n.r.toString(16),32),s:hexZeroPad("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=getCurve().keyFromPrivate(arrayify(this.privateKey)),r=getCurve().keyFromPublic(arrayify(computePublicKey(e)));return hexZeroPad("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function recoverPublicKey(e,t){const r=splitSignature(t),n={r:arrayify(r.r),s:arrayify(r.s)};return"0x"+getCurve().recoverPubKey(arrayify(e),n,r.recoveryParam).encode("hex",!1)}function computePublicKey(e,t){const r=arrayify(e);if(32===r.length){return new SigningKey(r).publicKey}return 33===r.length?"0x"+getCurve().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?hexlify(r):logger.throwArgumentError("invalid public or private key","key","[REDACTED]")}var TransactionTypes,TransactionTypes2;function computeAddress(e){return getAddress(hexDataSlice(keccak256$1(hexDataSlice(computePublicKey(e),1)),12))}function recoverAddress(e,t){return computeAddress(recoverPublicKey(arrayify(e),t))}TransactionTypes2=TransactionTypes||(TransactionTypes={}),TransactionTypes2[TransactionTypes2.legacy=0]="legacy",TransactionTypes2[TransactionTypes2.eip2930=1]="eip2930",TransactionTypes2[TransactionTypes2.eip1559=2]="eip1559";var chacha20poly1305={},chacha={};Object.defineProperty(chacha,"__esModule",{value:!0});var binary_1=binary,wipe_1$2=wipe$1,ROUNDS=20;function core(e,t,r){for(var n=1634760805,o=857760878,i=2036477234,a=1797285236,s=r[3]<<24|r[2]<<16|r[1]<<8|r[0],c=r[7]<<24|r[6]<<16|r[5]<<8|r[4],u=r[11]<<24|r[10]<<16|r[9]<<8|r[8],l=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],f=r[23]<<24|r[22]<<16|r[21]<<8|r[20],h=r[27]<<24|r[26]<<16|r[25]<<8|r[24],p=r[31]<<24|r[30]<<16|r[29]<<8|r[28],y=t[3]<<24|t[2]<<16|t[1]<<8|t[0],m=t[7]<<24|t[6]<<16|t[5]<<8|t[4],g=t[11]<<24|t[10]<<16|t[9]<<8|t[8],b=t[15]<<24|t[14]<<16|t[13]<<8|t[12],v=n,w=o,_=i,I=a,T=s,k=c,$=u,S=l,A=d,E=f,C=h,R=p,O=y,N=m,P=g,M=b,B=0;B<ROUNDS;B+=2)T=(T^=A=A+(O=(O^=v=v+T|0)>>>16|O<<16)|0)>>>20|T<<12,k=(k^=E=E+(N=(N^=w=w+k|0)>>>16|N<<16)|0)>>>20|k<<12,$=($^=C=C+(P=(P^=_=_+$|0)>>>16|P<<16)|0)>>>20|$<<12,S=(S^=R=R+(M=(M^=I=I+S|0)>>>16|M<<16)|0)>>>20|S<<12,$=($^=C=C+(P=(P^=_=_+$|0)>>>24|P<<8)|0)>>>25|$<<7,S=(S^=R=R+(M=(M^=I=I+S|0)>>>24|M<<8)|0)>>>25|S<<7,k=(k^=E=E+(N=(N^=w=w+k|0)>>>24|N<<8)|0)>>>25|k<<7,T=(T^=A=A+(O=(O^=v=v+T|0)>>>24|O<<8)|0)>>>25|T<<7,k=(k^=C=C+(M=(M^=v=v+k|0)>>>16|M<<16)|0)>>>20|k<<12,$=($^=R=R+(O=(O^=w=w+$|0)>>>16|O<<16)|0)>>>20|$<<12,S=(S^=A=A+(N=(N^=_=_+S|0)>>>16|N<<16)|0)>>>20|S<<12,T=(T^=E=E+(P=(P^=I=I+T|0)>>>16|P<<16)|0)>>>20|T<<12,S=(S^=A=A+(N=(N^=_=_+S|0)>>>24|N<<8)|0)>>>25|S<<7,T=(T^=E=E+(P=(P^=I=I+T|0)>>>24|P<<8)|0)>>>25|T<<7,$=($^=R=R+(O=(O^=w=w+$|0)>>>24|O<<8)|0)>>>25|$<<7,k=(k^=C=C+(M=(M^=v=v+k|0)>>>24|M<<8)|0)>>>25|k<<7;binary_1.writeUint32LE(v+n|0,e,0),binary_1.writeUint32LE(w+o|0,e,4),binary_1.writeUint32LE(_+i|0,e,8),binary_1.writeUint32LE(I+a|0,e,12),binary_1.writeUint32LE(T+s|0,e,16),binary_1.writeUint32LE(k+c|0,e,20),binary_1.writeUint32LE($+u|0,e,24),binary_1.writeUint32LE(S+l|0,e,28),binary_1.writeUint32LE(A+d|0,e,32),binary_1.writeUint32LE(E+f|0,e,36),binary_1.writeUint32LE(C+h|0,e,40),binary_1.writeUint32LE(R+p|0,e,44),binary_1.writeUint32LE(O+y|0,e,48),binary_1.writeUint32LE(N+m|0,e,52),binary_1.writeUint32LE(P+g|0,e,56),binary_1.writeUint32LE(M+b|0,e,60)}function streamXOR(e,t,r,n,o){if(void 0===o&&(o=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<r.length)throw new Error("ChaCha: destination is shorter than source");var i,a;if(0===o){if(8!==t.length&&12!==t.length)throw new Error("ChaCha nonce must be 8 or 12 bytes");a=(i=new Uint8Array(16)).length-t.length,i.set(t,a)}else{if(16!==t.length)throw new Error("ChaCha nonce with counter must be 16 bytes");i=t,a=o}for(var s=new Uint8Array(64),c=0;c<r.length;c+=64){core(s,i,e);for(var u=c;u<c+64&&u<r.length;u++)n[u]=r[u]^s[u-c];incrementCounter(i,0,a)}return wipe_1$2.wipe(s),0===o&&wipe_1$2.wipe(i),n}function stream(e,t,r,n){return void 0===n&&(n=0),wipe_1$2.wipe(r),streamXOR(e,t,r,r,n)}function incrementCounter(e,t,r){for(var n=1;r--;)n=n+(255&e[t])|0,e[t]=255&n,n>>>=8,t++;if(n>0)throw new Error("ChaCha: counter overflow")}chacha.streamXOR=streamXOR,chacha.stream=stream;var poly1305={},constantTime={};function select(e,t,r){return~(e-1)&t|e-1&r}function lessOrEqual(e,t){return(0|e)-(0|t)-1>>>31&1}function compare(e,t){if(e.length!==t.length)return 0;for(var r=0,n=0;n<e.length;n++)r|=e[n]^t[n];return 1&r-1>>>8}function equal(e,t){return 0!==e.length&&0!==t.length&&0!==compare(e,t)}Object.defineProperty(constantTime,"__esModule",{value:!0}),constantTime.select=select,constantTime.lessOrEqual=lessOrEqual,constantTime.compare=compare,constantTime.equal=equal,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=constantTime,r=wipe$1;e.DIGEST_LENGTH=16;var n=function(){function t(t){this.digestLength=e.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=t[0]|t[1]<<8;this._r[0]=8191&r;var n=t[2]|t[3]<<8;this._r[1]=8191&(r>>>13|n<<3);var o=t[4]|t[5]<<8;this._r[2]=7939&(n>>>10|o<<6);var i=t[6]|t[7]<<8;this._r[3]=8191&(o>>>7|i<<9);var a=t[8]|t[9]<<8;this._r[4]=255&(i>>>4|a<<12),this._r[5]=a>>>1&8190;var s=t[10]|t[11]<<8;this._r[6]=8191&(a>>>14|s<<2);var c=t[12]|t[13]<<8;this._r[7]=8065&(s>>>11|c<<5);var u=t[14]|t[15]<<8;this._r[8]=8191&(c>>>8|u<<8),this._r[9]=u>>>5&127,this._pad[0]=t[16]|t[17]<<8,this._pad[1]=t[18]|t[19]<<8,this._pad[2]=t[20]|t[21]<<8,this._pad[3]=t[22]|t[23]<<8,this._pad[4]=t[24]|t[25]<<8,this._pad[5]=t[26]|t[27]<<8,this._pad[6]=t[28]|t[29]<<8,this._pad[7]=t[30]|t[31]<<8}return t.prototype._blocks=function(e,t,r){for(var n=this._fin?0:2048,o=this._h[0],i=this._h[1],a=this._h[2],s=this._h[3],c=this._h[4],u=this._h[5],l=this._h[6],d=this._h[7],f=this._h[8],h=this._h[9],p=this._r[0],y=this._r[1],m=this._r[2],g=this._r[3],b=this._r[4],v=this._r[5],w=this._r[6],_=this._r[7],I=this._r[8],T=this._r[9];r>=16;){var k=e[t+0]|e[t+1]<<8;o+=8191&k;var $=e[t+2]|e[t+3]<<8;i+=8191&(k>>>13|$<<3);var S=e[t+4]|e[t+5]<<8;a+=8191&($>>>10|S<<6);var A=e[t+6]|e[t+7]<<8;s+=8191&(S>>>7|A<<9);var E=e[t+8]|e[t+9]<<8;c+=8191&(A>>>4|E<<12),u+=E>>>1&8191;var C=e[t+10]|e[t+11]<<8;l+=8191&(E>>>14|C<<2);var R=e[t+12]|e[t+13]<<8;d+=8191&(C>>>11|R<<5);var O=e[t+14]|e[t+15]<<8,N=0,P=N;P+=o*p,P+=i*(5*T),P+=a*(5*I),P+=s*(5*_),N=(P+=c*(5*w))>>>13,P&=8191,P+=u*(5*v),P+=l*(5*b),P+=d*(5*g),P+=(f+=8191&(R>>>8|O<<8))*(5*m);var M=N+=(P+=(h+=O>>>5|n)*(5*y))>>>13;M+=o*y,M+=i*p,M+=a*(5*T),M+=s*(5*I),N=(M+=c*(5*_))>>>13,M&=8191,M+=u*(5*w),M+=l*(5*v),M+=d*(5*b),M+=f*(5*g),N+=(M+=h*(5*m))>>>13,M&=8191;var B=N;B+=o*m,B+=i*y,B+=a*p,B+=s*(5*T),N=(B+=c*(5*I))>>>13,B&=8191,B+=u*(5*_),B+=l*(5*w),B+=d*(5*v),B+=f*(5*b);var D=N+=(B+=h*(5*g))>>>13;D+=o*g,D+=i*m,D+=a*y,D+=s*p,N=(D+=c*(5*T))>>>13,D&=8191,D+=u*(5*I),D+=l*(5*_),D+=d*(5*w),D+=f*(5*v);var x=N+=(D+=h*(5*b))>>>13;x+=o*b,x+=i*g,x+=a*m,x+=s*y,N=(x+=c*p)>>>13,x&=8191,x+=u*(5*T),x+=l*(5*I),x+=d*(5*_),x+=f*(5*w);var L=N+=(x+=h*(5*v))>>>13;L+=o*v,L+=i*b,L+=a*g,L+=s*m,N=(L+=c*y)>>>13,L&=8191,L+=u*p,L+=l*(5*T),L+=d*(5*I),L+=f*(5*_);var U=N+=(L+=h*(5*w))>>>13;U+=o*w,U+=i*v,U+=a*b,U+=s*g,N=(U+=c*m)>>>13,U&=8191,U+=u*y,U+=l*p,U+=d*(5*T),U+=f*(5*I);var j=N+=(U+=h*(5*_))>>>13;j+=o*_,j+=i*w,j+=a*v,j+=s*b,N=(j+=c*g)>>>13,j&=8191,j+=u*m,j+=l*y,j+=d*p,j+=f*(5*T);var F=N+=(j+=h*(5*I))>>>13;F+=o*I,F+=i*_,F+=a*w,F+=s*v,N=(F+=c*b)>>>13,F&=8191,F+=u*g,F+=l*m,F+=d*y,F+=f*p;var q=N+=(F+=h*(5*T))>>>13;q+=o*T,q+=i*I,q+=a*_,q+=s*w,N=(q+=c*v)>>>13,q&=8191,q+=u*b,q+=l*g,q+=d*m,q+=f*y,o=P=8191&(N=(N=((N+=(q+=h*p)>>>13)<<2)+N|0)+(P&=8191)|0),i=M+=N>>>=13,a=B&=8191,s=D&=8191,c=x&=8191,u=L&=8191,l=U&=8191,d=j&=8191,f=F&=8191,h=q&=8191,t+=16,r-=16}this._h[0]=o,this._h[1]=i,this._h[2]=a,this._h[3]=s,this._h[4]=c,this._h[5]=u,this._h[6]=l,this._h[7]=d,this._h[8]=f,this._h[9]=h},t.prototype.finish=function(e,t){void 0===t&&(t=0);var r,n,o,i,a=new Uint16Array(10);if(this._leftover){for(i=this._leftover,this._buffer[i++]=1;i<16;i++)this._buffer[i]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(r=this._h[1]>>>13,this._h[1]&=8191,i=2;i<10;i++)this._h[i]+=r,r=this._h[i]>>>13,this._h[i]&=8191;for(this._h[0]+=5*r,r=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=r,r=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=r,a[0]=this._h[0]+5,r=a[0]>>>13,a[0]&=8191,i=1;i<10;i++)a[i]=this._h[i]+r,r=a[i]>>>13,a[i]&=8191;for(a[9]-=8192,n=(1^r)-1,i=0;i<10;i++)a[i]&=n;for(n=~n,i=0;i<10;i++)this._h[i]=this._h[i]&n|a[i];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),o=this._h[0]+this._pad[0],this._h[0]=65535&o,i=1;i<8;i++)o=(this._h[i]+this._pad[i]|0)+(o>>>16)|0,this._h[i]=65535&o;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var t,r=0,n=e.length;if(this._leftover){(t=16-this._leftover)>n&&(t=n);for(var o=0;o<t;o++)this._buffer[this._leftover+o]=e[r+o];if(n-=t,r+=t,this._leftover+=t,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(n>=16&&(t=n-n%16,this._blocks(e,r,t),r+=t,n-=t),n){for(o=0;o<n;o++)this._buffer[this._leftover+o]=e[r+o];this._leftover+=n}return this},t.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var e=new Uint8Array(16);return this.finish(e),e},t.prototype.clean=function(){return r.wipe(this._buffer),r.wipe(this._r),r.wipe(this._h),r.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},t}();e.Poly1305=n,e.oneTimeAuth=function(e,t){var r=new n(e);r.update(t);var o=r.digest();return r.clean(),o},e.equal=function(r,n){return r.length===e.DIGEST_LENGTH&&n.length===e.DIGEST_LENGTH&&t.equal(r,n)}}(poly1305),function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=chacha,r=poly1305,n=wipe$1,o=binary,i=constantTime;e.KEY_LENGTH=32,e.NONCE_LENGTH=12,e.TAG_LENGTH=16;var a=new Uint8Array(16),s=function(){function s(t){if(this.nonceLength=e.NONCE_LENGTH,this.tagLength=e.TAG_LENGTH,t.length!==e.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(t)}return s.prototype.seal=function(e,r,o,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var a=new Uint8Array(16);a.set(e,a.length-e.length);var s=new Uint8Array(32);t.stream(this._key,a,s,4);var c,u=r.length+this.tagLength;if(i){if(i.length!==u)throw new Error("ChaCha20Poly1305: incorrect destination length");c=i}else c=new Uint8Array(u);return t.streamXOR(this._key,a,r,c,4),this._authenticate(c.subarray(c.length-this.tagLength,c.length),s,c.subarray(0,c.length-this.tagLength),o),n.wipe(a),c},s.prototype.open=function(e,r,o,a){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(r.length<this.tagLength)return null;var s=new Uint8Array(16);s.set(e,s.length-e.length);var c=new Uint8Array(32);t.stream(this._key,s,c,4);var u=new Uint8Array(this.tagLength);if(this._authenticate(u,c,r.subarray(0,r.length-this.tagLength),o),!i.equal(u,r.subarray(r.length-this.tagLength,r.length)))return null;var l,d=r.length-this.tagLength;if(a){if(a.length!==d)throw new Error("ChaCha20Poly1305: incorrect destination length");l=a}else l=new Uint8Array(d);return t.streamXOR(this._key,s,r.subarray(0,r.length-this.tagLength),l,4),n.wipe(s),l},s.prototype.clean=function(){return n.wipe(this._key),this},s.prototype._authenticate=function(e,t,i,s){var c=new r.Poly1305(t);s&&(c.update(s),s.length%16>0&&c.update(a.subarray(s.length%16))),c.update(i),i.length%16>0&&c.update(a.subarray(i.length%16));var u=new Uint8Array(8);s&&o.writeUint64LE(s.length,u),c.update(u),o.writeUint64LE(i.length,u),c.update(u);for(var l=c.digest(),d=0;d<l.length;d++)e[d]=l[d];c.clean(),n.wipe(l),n.wipe(u)},s}();e.ChaCha20Poly1305=s}(chacha20poly1305);var hkdf={},hmac$1={},hash$2={};function isSerializableHash(e){return void 0!==e.saveState&&void 0!==e.restoreState&&void 0!==e.cleanSavedState}Object.defineProperty(hash$2,"__esModule",{value:!0}),hash$2.isSerializableHash=isSerializableHash,Object.defineProperty(hmac$1,"__esModule",{value:!0});var hash_1=hash$2,constant_time_1=constantTime,wipe_1$1=wipe$1,HMAC=function(){function e(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var r=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(r).clean():r.set(t);for(var n=0;n<r.length;n++)r[n]^=54;this._inner.update(r);for(n=0;n<r.length;n++)r[n]^=106;this._outer.update(r),hash_1.isSerializableHash(this._inner)&&hash_1.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),wipe_1$1.wipe(r)}return e.prototype.reset=function(){if(!hash_1.isSerializableHash(this._inner)||!hash_1.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.clean=function(){hash_1.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),hash_1.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},e.prototype.update=function(e){return this._inner.update(e),this},e.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e.prototype.saveState=function(){if(!hash_1.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},e.prototype.restoreState=function(e){if(!hash_1.isSerializableHash(this._inner)||!hash_1.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.cleanSavedState=function(e){if(!hash_1.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},e}();function hmac(e,t,r){var n=new HMAC(e,t);n.update(r);var o=n.digest();return n.clean(),o}hmac$1.HMAC=HMAC,hmac$1.hmac=hmac,hmac$1.equal=constant_time_1.equal,Object.defineProperty(hkdf,"__esModule",{value:!0});var hmac_1=hmac$1,wipe_1=wipe$1,HKDF=function(){function e(e,t,r,n){void 0===r&&(r=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var o=hmac_1.hmac(this._hash,r,t);this._hmac=new hmac_1.HMAC(e,o),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(0===e)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(e){for(var t=new Uint8Array(e),r=0;r<t.length;r++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[r]=this._buffer[this._bufpos++];return t},e.prototype.clean=function(){this._hmac.clean(),wipe_1.wipe(this._buffer),wipe_1.wipe(this._counter),this._bufpos=0},e}(),HKDF_1=hkdf.HKDF=HKDF,sha256={};!function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=binary,r=wipe$1;e.DIGEST_LENGTH=32,e.BLOCK_SIZE=64;var n=function(){function n(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return n.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},n.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},n.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._temp),this.reset()},n.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var r=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&t>0;)this._buffer[this._bufferLength++]=e[r++],t--;this._bufferLength===this.blockSize&&(i(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(r=i(this._temp,this._state,e,r,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[r++],t--;return this},n.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,o=r/536870912|0,a=r<<3,s=r%64<56?64:128;this._buffer[n]=128;for(var c=n+1;c<s-8;c++)this._buffer[c]=0;t.writeUint32BE(o,this._buffer,s-8),t.writeUint32BE(a,this._buffer,s-4),i(this._temp,this._state,this._buffer,0,s),this._finished=!0}for(c=0;c<this.digestLength/4;c++)t.writeUint32BE(this._state[c],e,4*c);return this},n.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},n.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},n.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},n.prototype.cleanSavedState=function(e){r.wipe(e.state),e.buffer&&r.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},n}();e.SHA256=n;var o=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function i(e,r,n,i,a){for(;a>=64;){for(var s=r[0],c=r[1],u=r[2],l=r[3],d=r[4],f=r[5],h=r[6],p=r[7],y=0;y<16;y++){var m=i+4*y;e[y]=t.readUint32BE(n,m)}for(y=16;y<64;y++){var g=e[y-2],b=(g>>>17|g<<15)^(g>>>19|g<<13)^g>>>10,v=((g=e[y-15])>>>7|g<<25)^(g>>>18|g<<14)^g>>>3;e[y]=(b+e[y-7]|0)+(v+e[y-16]|0)}for(y=0;y<64;y++){b=(((d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(d&f^~d&h)|0)+(p+(o[y]+e[y]|0)|0)|0,v=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&c^s&u^c&u)|0;p=h,h=f,f=d,d=l+b|0,l=u,u=c,c=s,s=b+v|0}r[0]+=s,r[1]+=c,r[2]+=u,r[3]+=l,r[4]+=d,r[5]+=f,r[6]+=h,r[7]+=p,i+=64,a-=64}return i}e.hash=function(e){var t=new n;t.update(e);var r=t.digest();return t.clean(),r}}(sha256);var x25519={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sharedKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.scalarMultBase=e.scalarMult=e.SHARED_KEY_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=void 0;const t=random,r=wipe$1;function n(e){const t=new Float64Array(16);if(e)for(let r=0;r<e.length;r++)t[r]=e[r];return t}e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=32,e.SHARED_KEY_LENGTH=32;const o=new Uint8Array(32);o[0]=9;const i=n([56129,1]);function a(e){let t=1;for(let r=0;r<16;r++){let n=e[r]+t+65535;t=Math.floor(n/65536),e[r]=n-65536*t}e[0]+=t-1+37*(t-1)}function s(e,t,r){const n=~(r-1);for(let o=0;o<16;o++){const r=n&(e[o]^t[o]);e[o]^=r,t[o]^=r}}function c(e,t,r){for(let n=0;n<16;n++)e[n]=t[n]+r[n]}function u(e,t,r){for(let n=0;n<16;n++)e[n]=t[n]-r[n]}function l(e,t,r){let n,o,i=0,a=0,s=0,c=0,u=0,l=0,d=0,f=0,h=0,p=0,y=0,m=0,g=0,b=0,v=0,w=0,_=0,I=0,T=0,k=0,$=0,S=0,A=0,E=0,C=0,R=0,O=0,N=0,P=0,M=0,B=0,D=r[0],x=r[1],L=r[2],U=r[3],j=r[4],F=r[5],q=r[6],K=r[7],H=r[8],G=r[9],z=r[10],V=r[11],W=r[12],Q=r[13],Y=r[14],X=r[15];n=t[0],i+=n*D,a+=n*x,s+=n*L,c+=n*U,u+=n*j,l+=n*F,d+=n*q,f+=n*K,h+=n*H,p+=n*G,y+=n*z,m+=n*V,g+=n*W,b+=n*Q,v+=n*Y,w+=n*X,n=t[1],a+=n*D,s+=n*x,c+=n*L,u+=n*U,l+=n*j,d+=n*F,f+=n*q,h+=n*K,p+=n*H,y+=n*G,m+=n*z,g+=n*V,b+=n*W,v+=n*Q,w+=n*Y,_+=n*X,n=t[2],s+=n*D,c+=n*x,u+=n*L,l+=n*U,d+=n*j,f+=n*F,h+=n*q,p+=n*K,y+=n*H,m+=n*G,g+=n*z,b+=n*V,v+=n*W,w+=n*Q,_+=n*Y,I+=n*X,n=t[3],c+=n*D,u+=n*x,l+=n*L,d+=n*U,f+=n*j,h+=n*F,p+=n*q,y+=n*K,m+=n*H,g+=n*G,b+=n*z,v+=n*V,w+=n*W,_+=n*Q,I+=n*Y,T+=n*X,n=t[4],u+=n*D,l+=n*x,d+=n*L,f+=n*U,h+=n*j,p+=n*F,y+=n*q,m+=n*K,g+=n*H,b+=n*G,v+=n*z,w+=n*V,_+=n*W,I+=n*Q,T+=n*Y,k+=n*X,n=t[5],l+=n*D,d+=n*x,f+=n*L,h+=n*U,p+=n*j,y+=n*F,m+=n*q,g+=n*K,b+=n*H,v+=n*G,w+=n*z,_+=n*V,I+=n*W,T+=n*Q,k+=n*Y,$+=n*X,n=t[6],d+=n*D,f+=n*x,h+=n*L,p+=n*U,y+=n*j,m+=n*F,g+=n*q,b+=n*K,v+=n*H,w+=n*G,_+=n*z,I+=n*V,T+=n*W,k+=n*Q,$+=n*Y,S+=n*X,n=t[7],f+=n*D,h+=n*x,p+=n*L,y+=n*U,m+=n*j,g+=n*F,b+=n*q,v+=n*K,w+=n*H,_+=n*G,I+=n*z,T+=n*V,k+=n*W,$+=n*Q,S+=n*Y,A+=n*X,n=t[8],h+=n*D,p+=n*x,y+=n*L,m+=n*U,g+=n*j,b+=n*F,v+=n*q,w+=n*K,_+=n*H,I+=n*G,T+=n*z,k+=n*V,$+=n*W,S+=n*Q,A+=n*Y,E+=n*X,n=t[9],p+=n*D,y+=n*x,m+=n*L,g+=n*U,b+=n*j,v+=n*F,w+=n*q,_+=n*K,I+=n*H,T+=n*G,k+=n*z,$+=n*V,S+=n*W,A+=n*Q,E+=n*Y,C+=n*X,n=t[10],y+=n*D,m+=n*x,g+=n*L,b+=n*U,v+=n*j,w+=n*F,_+=n*q,I+=n*K,T+=n*H,k+=n*G,$+=n*z,S+=n*V,A+=n*W,E+=n*Q,C+=n*Y,R+=n*X,n=t[11],m+=n*D,g+=n*x,b+=n*L,v+=n*U,w+=n*j,_+=n*F,I+=n*q,T+=n*K,k+=n*H,$+=n*G,S+=n*z,A+=n*V,E+=n*W,C+=n*Q,R+=n*Y,O+=n*X,n=t[12],g+=n*D,b+=n*x,v+=n*L,w+=n*U,_+=n*j,I+=n*F,T+=n*q,k+=n*K,$+=n*H,S+=n*G,A+=n*z,E+=n*V,C+=n*W,R+=n*Q,O+=n*Y,N+=n*X,n=t[13],b+=n*D,v+=n*x,w+=n*L,_+=n*U,I+=n*j,T+=n*F,k+=n*q,$+=n*K,S+=n*H,A+=n*G,E+=n*z,C+=n*V,R+=n*W,O+=n*Q,N+=n*Y,P+=n*X,n=t[14],v+=n*D,w+=n*x,_+=n*L,I+=n*U,T+=n*j,k+=n*F,$+=n*q,S+=n*K,A+=n*H,E+=n*G,C+=n*z,R+=n*V,O+=n*W,N+=n*Q,P+=n*Y,M+=n*X,n=t[15],w+=n*D,_+=n*x,I+=n*L,T+=n*U,k+=n*j,$+=n*F,S+=n*q,A+=n*K,E+=n*H,C+=n*G,R+=n*z,O+=n*V,N+=n*W,P+=n*Q,M+=n*Y,B+=n*X,i+=38*_,a+=38*I,s+=38*T,c+=38*k,u+=38*$,l+=38*S,d+=38*A,f+=38*E,h+=38*C,p+=38*R,y+=38*O,m+=38*N,g+=38*P,b+=38*M,v+=38*B,o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=p+o+65535,o=Math.floor(n/65536),p=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=m+o+65535,o=Math.floor(n/65536),m=n-65536*o,n=g+o+65535,o=Math.floor(n/65536),g=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,i+=o-1+37*(o-1),o=1,n=i+o+65535,o=Math.floor(n/65536),i=n-65536*o,n=a+o+65535,o=Math.floor(n/65536),a=n-65536*o,n=s+o+65535,o=Math.floor(n/65536),s=n-65536*o,n=c+o+65535,o=Math.floor(n/65536),c=n-65536*o,n=u+o+65535,o=Math.floor(n/65536),u=n-65536*o,n=l+o+65535,o=Math.floor(n/65536),l=n-65536*o,n=d+o+65535,o=Math.floor(n/65536),d=n-65536*o,n=f+o+65535,o=Math.floor(n/65536),f=n-65536*o,n=h+o+65535,o=Math.floor(n/65536),h=n-65536*o,n=p+o+65535,o=Math.floor(n/65536),p=n-65536*o,n=y+o+65535,o=Math.floor(n/65536),y=n-65536*o,n=m+o+65535,o=Math.floor(n/65536),m=n-65536*o,n=g+o+65535,o=Math.floor(n/65536),g=n-65536*o,n=b+o+65535,o=Math.floor(n/65536),b=n-65536*o,n=v+o+65535,o=Math.floor(n/65536),v=n-65536*o,n=w+o+65535,o=Math.floor(n/65536),w=n-65536*o,i+=o-1+37*(o-1),e[0]=i,e[1]=a,e[2]=s,e[3]=c,e[4]=u,e[5]=l,e[6]=d,e[7]=f,e[8]=h,e[9]=p,e[10]=y,e[11]=m,e[12]=g,e[13]=b,e[14]=v,e[15]=w}function d(e,t){l(e,t,t)}function f(e,t){const r=new Uint8Array(32),o=new Float64Array(80),f=n(),h=n(),p=n(),y=n(),m=n(),g=n();for(let n=0;n<31;n++)r[n]=e[n];r[31]=127&e[31]|64,r[0]&=248,function(e,t){for(let r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(o,t);for(let n=0;n<16;n++)h[n]=o[n];f[0]=y[0]=1;for(let n=254;n>=0;--n){const e=r[n>>>3]>>>(7&n)&1;s(f,h,e),s(p,y,e),c(m,f,p),u(f,f,p),c(p,h,y),u(h,h,y),d(y,m),d(g,f),l(f,p,f),l(p,h,m),c(m,f,p),u(f,f,p),d(h,f),u(p,y,g),l(f,p,i),c(f,f,y),l(p,p,f),l(f,y,g),l(y,h,o),d(h,m),s(f,h,e),s(p,y,e)}for(let n=0;n<16;n++)o[n+16]=f[n],o[n+32]=p[n],o[n+48]=h[n],o[n+64]=y[n];const b=o.subarray(32),v=o.subarray(16);!function(e,t){const r=n();for(let n=0;n<16;n++)r[n]=t[n];for(let n=253;n>=0;n--)d(r,r),2!==n&&4!==n&&l(r,r,t);for(let n=0;n<16;n++)e[n]=r[n]}(b,b),l(v,v,b);const w=new Uint8Array(32);return function(e,t){const r=n(),o=n();for(let n=0;n<16;n++)o[n]=t[n];a(o),a(o),a(o);for(let n=0;n<2;n++){r[0]=o[0]-65517;for(let t=1;t<15;t++)r[t]=o[t]-65535-(r[t-1]>>16&1),r[t-1]&=65535;r[15]=o[15]-32767-(r[14]>>16&1);const e=r[15]>>16&1;r[14]&=65535,s(o,r,1-e)}for(let n=0;n<16;n++)e[2*n]=255&o[n],e[2*n+1]=o[n]>>8}(w,v),w}function h(e){return f(e,o)}function p(t){if(t.length!==e.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${e.SECRET_KEY_LENGTH} bytes`);const r=new Uint8Array(t);return{publicKey:h(r),secretKey:r}}e.scalarMult=f,e.scalarMultBase=h,e.generateKeyPairFromSeed=p,e.generateKeyPair=function(e){const n=(0,t.randomBytes)(32,e),o=p(n);return(0,r.wipe)(n),o},e.sharedKey=function(t,r,n=!1){if(t.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(r.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const o=f(t,r);if(n){let e=0;for(let t=0;t<o.length;t++)e|=o[t];if(0===e)throw new Error("X25519: invalid shared key")}return o}}(x25519);var elliptic$1={};const name$1="elliptic",version$3="6.6.1",description$1="EC cryptography",main$1="lib/elliptic.js",files$1=["lib"],scripts$1={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository$1={type:"git",url:"git@github.com:indutny/elliptic"},keywords$1=["EC","Elliptic","curve","Cryptography"],author$1="Fedor Indutny <fedor@indutny.com>",license$1="MIT",bugs$1={url:"https://github.com/indutny/elliptic/issues"},homepage$1="https://github.com/indutny/elliptic",devDependencies$1={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies$1={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0$3={name:name$1,version:version$3,description:description$1,main:main$1,files:files$1,scripts:scripts$1,repository:repository$1,keywords:keywords$1,author:author$1,license:license$1,bugs:bugs$1,homepage:homepage$1,devDependencies:devDependencies$1,dependencies:dependencies$1};var utils$p={},bn$3={exports:{}};bn$3.exports,function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var i;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$2$1.Buffer}catch(e2){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function c(e,t,r,n){for(var o=0,i=Math.min(e.length,r),a=t;a<i;a++){var s=e.charCodeAt(a)-48;o*=n,o+=s>=49?s-49+10:s>=17?s-17+10:s}return o}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var o=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(o++,this.negative=1),o<e.length&&(16===t?this._parseHex(e,o,n):(this._parseBase(e,t,o),"le"===n&&this._initArray(this.toArray(),t,n)))},o.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var i,a,s=0;if("be"===n)for(o=e.length-1,i=0;o>=0;o-=3)a=e[o]|e[o-1]<<8|e[o-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===n)for(o=0,i=0;o<e.length;o+=3)a=e[o]|e[o+1]<<8|e[o+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this.strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,i=0,a=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)o=s(e,t,n)<<i,this.words[a]|=67108863&o,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)o=s(e,t,n)<<i,this.words[a]|=67108863&o,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,o=1;o<=67108863;o*=t)n++;n--,o=o/t|0;for(var i=e.length-r,a=i%n,s=Math.min(i,i-a)+r,u=0,l=r;l<s;l+=n)u=c(e,l,l+n,t),this.imuln(o),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var o=0|e.words[0],i=0|t.words[0],a=o*i,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u<n;u++){for(var l=c>>>26,d=67108863&c,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;l+=(a=(o=0|e.words[p])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var o=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<o|i)).toString(16);i=s>>>24-o&16777215,(o+=2)>=26&&(o-=26,a--),n=0!==i||a!==this.length-1?u[6-c.length]+c+n:c+n}for(0!==i&&(n=i.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var f=l[e],h=d[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modn(h).toString(e);n=(p=p.idivn(h)).isZero()?y+n:u[f-y.length]+y+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return r(void 0!==i),this.toArrayLike(i,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,n){var o=this.byteLength(),i=n||Math.max(1,o);r(o<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(i),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s<i;s++)u[s]=0}else{for(s=0;s<i-o;s++)u[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[i-s-1]=a}return u},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var o=0;o<t;o++)this.words[o]=67108863&~this.words[o];return n>0&&(this.words[o]=~this.words[o]&67108863>>26-n),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,o=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<o:this.words[n]&~(1<<o),this.strip()},o.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var o=0,i=0;i<n.length;i++)t=(0|r.words[i])+(0|n.words[i])+o,this.words[i]=67108863&t,o=t>>>26;for(;0!==o&&i<r.length;i++)t=(0|r.words[i])+o,this.words[i]=67108863&t,o=t>>>26;if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,o=this.cmp(e);if(0===o)return this.negative=0,this.length=1,this.words[0]=0,this;o>0?(r=this,n=e):(r=e,n=this);for(var i=0,a=0;a<n.length;a++)i=(t=(0|r.words[a])-(0|n.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<r.length;a++)i=(t=(0|r.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var n,o,i,a=e.words,s=t.words,c=r.words,u=0,l=0|a[0],d=8191&l,f=l>>>13,h=0|a[1],p=8191&h,y=h>>>13,m=0|a[2],g=8191&m,b=m>>>13,v=0|a[3],w=8191&v,_=v>>>13,I=0|a[4],T=8191&I,k=I>>>13,$=0|a[5],S=8191&$,A=$>>>13,E=0|a[6],C=8191&E,R=E>>>13,O=0|a[7],N=8191&O,P=O>>>13,M=0|a[8],B=8191&M,D=M>>>13,x=0|a[9],L=8191&x,U=x>>>13,j=0|s[0],F=8191&j,q=j>>>13,K=0|s[1],H=8191&K,G=K>>>13,z=0|s[2],V=8191&z,W=z>>>13,Q=0|s[3],Y=8191&Q,X=Q>>>13,J=0|s[4],Z=8191&J,ee=J>>>13,te=0|s[5],re=8191&te,ne=te>>>13,oe=0|s[6],ie=8191&oe,ae=oe>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,fe=le>>>13,he=0|s[9],pe=8191&he,ye=he>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(u+(n=Math.imul(d,F))|0)+((8191&(o=(o=Math.imul(d,q))+Math.imul(f,F)|0))<<13)|0;u=((i=Math.imul(f,q))+(o>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(p,F),o=(o=Math.imul(p,q))+Math.imul(y,F)|0,i=Math.imul(y,q);var ge=(u+(n=n+Math.imul(d,H)|0)|0)+((8191&(o=(o=o+Math.imul(d,G)|0)+Math.imul(f,H)|0))<<13)|0;u=((i=i+Math.imul(f,G)|0)+(o>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(g,F),o=(o=Math.imul(g,q))+Math.imul(b,F)|0,i=Math.imul(b,q),n=n+Math.imul(p,H)|0,o=(o=o+Math.imul(p,G)|0)+Math.imul(y,H)|0,i=i+Math.imul(y,G)|0;var be=(u+(n=n+Math.imul(d,V)|0)|0)+((8191&(o=(o=o+Math.imul(d,W)|0)+Math.imul(f,V)|0))<<13)|0;u=((i=i+Math.imul(f,W)|0)+(o>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(w,F),o=(o=Math.imul(w,q))+Math.imul(_,F)|0,i=Math.imul(_,q),n=n+Math.imul(g,H)|0,o=(o=o+Math.imul(g,G)|0)+Math.imul(b,H)|0,i=i+Math.imul(b,G)|0,n=n+Math.imul(p,V)|0,o=(o=o+Math.imul(p,W)|0)+Math.imul(y,V)|0,i=i+Math.imul(y,W)|0;var ve=(u+(n=n+Math.imul(d,Y)|0)|0)+((8191&(o=(o=o+Math.imul(d,X)|0)+Math.imul(f,Y)|0))<<13)|0;u=((i=i+Math.imul(f,X)|0)+(o>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(T,F),o=(o=Math.imul(T,q))+Math.imul(k,F)|0,i=Math.imul(k,q),n=n+Math.imul(w,H)|0,o=(o=o+Math.imul(w,G)|0)+Math.imul(_,H)|0,i=i+Math.imul(_,G)|0,n=n+Math.imul(g,V)|0,o=(o=o+Math.imul(g,W)|0)+Math.imul(b,V)|0,i=i+Math.imul(b,W)|0,n=n+Math.imul(p,Y)|0,o=(o=o+Math.imul(p,X)|0)+Math.imul(y,Y)|0,i=i+Math.imul(y,X)|0;var we=(u+(n=n+Math.imul(d,Z)|0)|0)+((8191&(o=(o=o+Math.imul(d,ee)|0)+Math.imul(f,Z)|0))<<13)|0;u=((i=i+Math.imul(f,ee)|0)+(o>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(S,F),o=(o=Math.imul(S,q))+Math.imul(A,F)|0,i=Math.imul(A,q),n=n+Math.imul(T,H)|0,o=(o=o+Math.imul(T,G)|0)+Math.imul(k,H)|0,i=i+Math.imul(k,G)|0,n=n+Math.imul(w,V)|0,o=(o=o+Math.imul(w,W)|0)+Math.imul(_,V)|0,i=i+Math.imul(_,W)|0,n=n+Math.imul(g,Y)|0,o=(o=o+Math.imul(g,X)|0)+Math.imul(b,Y)|0,i=i+Math.imul(b,X)|0,n=n+Math.imul(p,Z)|0,o=(o=o+Math.imul(p,ee)|0)+Math.imul(y,Z)|0,i=i+Math.imul(y,ee)|0;var _e=(u+(n=n+Math.imul(d,re)|0)|0)+((8191&(o=(o=o+Math.imul(d,ne)|0)+Math.imul(f,re)|0))<<13)|0;u=((i=i+Math.imul(f,ne)|0)+(o>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(C,F),o=(o=Math.imul(C,q))+Math.imul(R,F)|0,i=Math.imul(R,q),n=n+Math.imul(S,H)|0,o=(o=o+Math.imul(S,G)|0)+Math.imul(A,H)|0,i=i+Math.imul(A,G)|0,n=n+Math.imul(T,V)|0,o=(o=o+Math.imul(T,W)|0)+Math.imul(k,V)|0,i=i+Math.imul(k,W)|0,n=n+Math.imul(w,Y)|0,o=(o=o+Math.imul(w,X)|0)+Math.imul(_,Y)|0,i=i+Math.imul(_,X)|0,n=n+Math.imul(g,Z)|0,o=(o=o+Math.imul(g,ee)|0)+Math.imul(b,Z)|0,i=i+Math.imul(b,ee)|0,n=n+Math.imul(p,re)|0,o=(o=o+Math.imul(p,ne)|0)+Math.imul(y,re)|0,i=i+Math.imul(y,ne)|0;var Ie=(u+(n=n+Math.imul(d,ie)|0)|0)+((8191&(o=(o=o+Math.imul(d,ae)|0)+Math.imul(f,ie)|0))<<13)|0;u=((i=i+Math.imul(f,ae)|0)+(o>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(N,F),o=(o=Math.imul(N,q))+Math.imul(P,F)|0,i=Math.imul(P,q),n=n+Math.imul(C,H)|0,o=(o=o+Math.imul(C,G)|0)+Math.imul(R,H)|0,i=i+Math.imul(R,G)|0,n=n+Math.imul(S,V)|0,o=(o=o+Math.imul(S,W)|0)+Math.imul(A,V)|0,i=i+Math.imul(A,W)|0,n=n+Math.imul(T,Y)|0,o=(o=o+Math.imul(T,X)|0)+Math.imul(k,Y)|0,i=i+Math.imul(k,X)|0,n=n+Math.imul(w,Z)|0,o=(o=o+Math.imul(w,ee)|0)+Math.imul(_,Z)|0,i=i+Math.imul(_,ee)|0,n=n+Math.imul(g,re)|0,o=(o=o+Math.imul(g,ne)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,ne)|0,n=n+Math.imul(p,ie)|0,o=(o=o+Math.imul(p,ae)|0)+Math.imul(y,ie)|0,i=i+Math.imul(y,ae)|0;var Te=(u+(n=n+Math.imul(d,ce)|0)|0)+((8191&(o=(o=o+Math.imul(d,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((i=i+Math.imul(f,ue)|0)+(o>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(B,F),o=(o=Math.imul(B,q))+Math.imul(D,F)|0,i=Math.imul(D,q),n=n+Math.imul(N,H)|0,o=(o=o+Math.imul(N,G)|0)+Math.imul(P,H)|0,i=i+Math.imul(P,G)|0,n=n+Math.imul(C,V)|0,o=(o=o+Math.imul(C,W)|0)+Math.imul(R,V)|0,i=i+Math.imul(R,W)|0,n=n+Math.imul(S,Y)|0,o=(o=o+Math.imul(S,X)|0)+Math.imul(A,Y)|0,i=i+Math.imul(A,X)|0,n=n+Math.imul(T,Z)|0,o=(o=o+Math.imul(T,ee)|0)+Math.imul(k,Z)|0,i=i+Math.imul(k,ee)|0,n=n+Math.imul(w,re)|0,o=(o=o+Math.imul(w,ne)|0)+Math.imul(_,re)|0,i=i+Math.imul(_,ne)|0,n=n+Math.imul(g,ie)|0,o=(o=o+Math.imul(g,ae)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,ae)|0,n=n+Math.imul(p,ce)|0,o=(o=o+Math.imul(p,ue)|0)+Math.imul(y,ce)|0,i=i+Math.imul(y,ue)|0;var ke=(u+(n=n+Math.imul(d,de)|0)|0)+((8191&(o=(o=o+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;u=((i=i+Math.imul(f,fe)|0)+(o>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(L,F),o=(o=Math.imul(L,q))+Math.imul(U,F)|0,i=Math.imul(U,q),n=n+Math.imul(B,H)|0,o=(o=o+Math.imul(B,G)|0)+Math.imul(D,H)|0,i=i+Math.imul(D,G)|0,n=n+Math.imul(N,V)|0,o=(o=o+Math.imul(N,W)|0)+Math.imul(P,V)|0,i=i+Math.imul(P,W)|0,n=n+Math.imul(C,Y)|0,o=(o=o+Math.imul(C,X)|0)+Math.imul(R,Y)|0,i=i+Math.imul(R,X)|0,n=n+Math.imul(S,Z)|0,o=(o=o+Math.imul(S,ee)|0)+Math.imul(A,Z)|0,i=i+Math.imul(A,ee)|0,n=n+Math.imul(T,re)|0,o=(o=o+Math.imul(T,ne)|0)+Math.imul(k,re)|0,i=i+Math.imul(k,ne)|0,n=n+Math.imul(w,ie)|0,o=(o=o+Math.imul(w,ae)|0)+Math.imul(_,ie)|0,i=i+Math.imul(_,ae)|0,n=n+Math.imul(g,ce)|0,o=(o=o+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,n=n+Math.imul(p,de)|0,o=(o=o+Math.imul(p,fe)|0)+Math.imul(y,de)|0,i=i+Math.imul(y,fe)|0;var $e=(u+(n=n+Math.imul(d,pe)|0)|0)+((8191&(o=(o=o+Math.imul(d,ye)|0)+Math.imul(f,pe)|0))<<13)|0;u=((i=i+Math.imul(f,ye)|0)+(o>>>13)|0)+($e>>>26)|0,$e&=67108863,n=Math.imul(L,H),o=(o=Math.imul(L,G))+Math.imul(U,H)|0,i=Math.imul(U,G),n=n+Math.imul(B,V)|0,o=(o=o+Math.imul(B,W)|0)+Math.imul(D,V)|0,i=i+Math.imul(D,W)|0,n=n+Math.imul(N,Y)|0,o=(o=o+Math.imul(N,X)|0)+Math.imul(P,Y)|0,i=i+Math.imul(P,X)|0,n=n+Math.imul(C,Z)|0,o=(o=o+Math.imul(C,ee)|0)+Math.imul(R,Z)|0,i=i+Math.imul(R,ee)|0,n=n+Math.imul(S,re)|0,o=(o=o+Math.imul(S,ne)|0)+Math.imul(A,re)|0,i=i+Math.imul(A,ne)|0,n=n+Math.imul(T,ie)|0,o=(o=o+Math.imul(T,ae)|0)+Math.imul(k,ie)|0,i=i+Math.imul(k,ae)|0,n=n+Math.imul(w,ce)|0,o=(o=o+Math.imul(w,ue)|0)+Math.imul(_,ce)|0,i=i+Math.imul(_,ue)|0,n=n+Math.imul(g,de)|0,o=(o=o+Math.imul(g,fe)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,fe)|0;var Se=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(o=(o=o+Math.imul(p,ye)|0)+Math.imul(y,pe)|0))<<13)|0;u=((i=i+Math.imul(y,ye)|0)+(o>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(L,V),o=(o=Math.imul(L,W))+Math.imul(U,V)|0,i=Math.imul(U,W),n=n+Math.imul(B,Y)|0,o=(o=o+Math.imul(B,X)|0)+Math.imul(D,Y)|0,i=i+Math.imul(D,X)|0,n=n+Math.imul(N,Z)|0,o=(o=o+Math.imul(N,ee)|0)+Math.imul(P,Z)|0,i=i+Math.imul(P,ee)|0,n=n+Math.imul(C,re)|0,o=(o=o+Math.imul(C,ne)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,ne)|0,n=n+Math.imul(S,ie)|0,o=(o=o+Math.imul(S,ae)|0)+Math.imul(A,ie)|0,i=i+Math.imul(A,ae)|0,n=n+Math.imul(T,ce)|0,o=(o=o+Math.imul(T,ue)|0)+Math.imul(k,ce)|0,i=i+Math.imul(k,ue)|0,n=n+Math.imul(w,de)|0,o=(o=o+Math.imul(w,fe)|0)+Math.imul(_,de)|0,i=i+Math.imul(_,fe)|0;var Ae=(u+(n=n+Math.imul(g,pe)|0)|0)+((8191&(o=(o=o+Math.imul(g,ye)|0)+Math.imul(b,pe)|0))<<13)|0;u=((i=i+Math.imul(b,ye)|0)+(o>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(L,Y),o=(o=Math.imul(L,X))+Math.imul(U,Y)|0,i=Math.imul(U,X),n=n+Math.imul(B,Z)|0,o=(o=o+Math.imul(B,ee)|0)+Math.imul(D,Z)|0,i=i+Math.imul(D,ee)|0,n=n+Math.imul(N,re)|0,o=(o=o+Math.imul(N,ne)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,ne)|0,n=n+Math.imul(C,ie)|0,o=(o=o+Math.imul(C,ae)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,ae)|0,n=n+Math.imul(S,ce)|0,o=(o=o+Math.imul(S,ue)|0)+Math.imul(A,ce)|0,i=i+Math.imul(A,ue)|0,n=n+Math.imul(T,de)|0,o=(o=o+Math.imul(T,fe)|0)+Math.imul(k,de)|0,i=i+Math.imul(k,fe)|0;var Ee=(u+(n=n+Math.imul(w,pe)|0)|0)+((8191&(o=(o=o+Math.imul(w,ye)|0)+Math.imul(_,pe)|0))<<13)|0;u=((i=i+Math.imul(_,ye)|0)+(o>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(L,Z),o=(o=Math.imul(L,ee))+Math.imul(U,Z)|0,i=Math.imul(U,ee),n=n+Math.imul(B,re)|0,o=(o=o+Math.imul(B,ne)|0)+Math.imul(D,re)|0,i=i+Math.imul(D,ne)|0,n=n+Math.imul(N,ie)|0,o=(o=o+Math.imul(N,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,n=n+Math.imul(C,ce)|0,o=(o=o+Math.imul(C,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,n=n+Math.imul(S,de)|0,o=(o=o+Math.imul(S,fe)|0)+Math.imul(A,de)|0,i=i+Math.imul(A,fe)|0;var Ce=(u+(n=n+Math.imul(T,pe)|0)|0)+((8191&(o=(o=o+Math.imul(T,ye)|0)+Math.imul(k,pe)|0))<<13)|0;u=((i=i+Math.imul(k,ye)|0)+(o>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(L,re),o=(o=Math.imul(L,ne))+Math.imul(U,re)|0,i=Math.imul(U,ne),n=n+Math.imul(B,ie)|0,o=(o=o+Math.imul(B,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,n=n+Math.imul(N,ce)|0,o=(o=o+Math.imul(N,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,n=n+Math.imul(C,de)|0,o=(o=o+Math.imul(C,fe)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,fe)|0;var Re=(u+(n=n+Math.imul(S,pe)|0)|0)+((8191&(o=(o=o+Math.imul(S,ye)|0)+Math.imul(A,pe)|0))<<13)|0;u=((i=i+Math.imul(A,ye)|0)+(o>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(L,ie),o=(o=Math.imul(L,ae))+Math.imul(U,ie)|0,i=Math.imul(U,ae),n=n+Math.imul(B,ce)|0,o=(o=o+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,n=n+Math.imul(N,de)|0,o=(o=o+Math.imul(N,fe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,fe)|0;var Oe=(u+(n=n+Math.imul(C,pe)|0)|0)+((8191&(o=(o=o+Math.imul(C,ye)|0)+Math.imul(R,pe)|0))<<13)|0;u=((i=i+Math.imul(R,ye)|0)+(o>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(L,ce),o=(o=Math.imul(L,ue))+Math.imul(U,ce)|0,i=Math.imul(U,ue),n=n+Math.imul(B,de)|0,o=(o=o+Math.imul(B,fe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,fe)|0;var Ne=(u+(n=n+Math.imul(N,pe)|0)|0)+((8191&(o=(o=o+Math.imul(N,ye)|0)+Math.imul(P,pe)|0))<<13)|0;u=((i=i+Math.imul(P,ye)|0)+(o>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(L,de),o=(o=Math.imul(L,fe))+Math.imul(U,de)|0,i=Math.imul(U,fe);var Pe=(u+(n=n+Math.imul(B,pe)|0)|0)+((8191&(o=(o=o+Math.imul(B,ye)|0)+Math.imul(D,pe)|0))<<13)|0;u=((i=i+Math.imul(D,ye)|0)+(o>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Me=(u+(n=Math.imul(L,pe))|0)+((8191&(o=(o=Math.imul(L,ye))+Math.imul(U,pe)|0))<<13)|0;return u=((i=Math.imul(U,ye))+(o>>>13)|0)+(Me>>>26)|0,Me&=67108863,c[0]=me,c[1]=ge,c[2]=be,c[3]=ve,c[4]=we,c[5]=_e,c[6]=Ie,c[7]=Te,c[8]=ke,c[9]=$e,c[10]=Se,c[11]=Ae,c[12]=Ee,c[13]=Ce,c[14]=Re,c[15]=Oe,c[16]=Ne,c[17]=Pe,c[18]=Me,0!==u&&(c[19]=u,r.length++),r};function p(e,t,r){return(new y).mulp(e,t,r)}function y(e,t){this.x=e,this.y=t}Math.imul||(h=f),o.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):n<63?f(this,e,t):n<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,o=0,i=0;i<r.length-1;i++){var a=o;o=0;for(var s=67108863&n,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),f=67108863&d;s=67108863&(f=f+s|0),o+=(a=(a=a+(d/67108864|0)|0)+(f>>>26)|0)>>>26,a&=67108863}r.words[i]=s,n=a,a=o}return 0!==n?r.words[i]=n:r.length--,r.strip()}(this,e,t):p(this,e,t),r},y.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},y.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,o=0;o<t;o++)n|=(1&e)<<t-o-1,e>>=1;return n},y.prototype.permute=function(e,t,r,n,o,i){for(var a=0;a<i;a++)n[a]=t[e[a]],o[a]=r[e[a]]},y.prototype.transform=function(e,t,r,n,o,i){this.permute(i,e,t,r,n,o);for(var a=1;a<o;a<<=1)for(var s=a<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),l=0;l<o;l+=s)for(var d=c,f=u,h=0;h<a;h++){var p=r[l+h],y=n[l+h],m=r[l+h+a],g=n[l+h+a],b=d*m-f*g;g=d*g+f*m,m=b,r[l+h]=p+m,n[l+h]=y+g,r[l+h+a]=p-m,n[l+h+a]=y-g,h!==s&&(b=c*d-u*f,f=c*f+u*d,d=b)}},y.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),n=1&r,o=0;for(r=r/2|0;r;r>>>=1)o++;return 1<<o+1+n},y.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var o=e[n];e[n]=e[r-n-1],e[r-n-1]=o,o=t[n],t[n]=-t[r-n-1],t[r-n-1]=-o}},y.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var o=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=67108863&o,r=o<67108864?0:o/67108864|0}return e},y.prototype.convert13b=function(e,t,n,o){for(var i=0,a=0;a<t;a++)i+=0|e[a],n[2*a]=8191&i,i>>>=13,n[2*a+1]=8191&i,i>>>=13;for(a=2*t;a<o;++a)n[a]=0;r(0===i),r(!(-8192&i))},y.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},y.prototype.mulp=function(e,t,r){var n=2*this.guessLen13b(e.length,t.length),o=this.makeRBT(n),i=this.stub(n),a=new Array(n),s=new Array(n),c=new Array(n),u=new Array(n),l=new Array(n),d=new Array(n),f=r.words;f.length=n,this.convert13b(e.words,e.length,a,n),this.convert13b(t.words,t.length,u,n),this.transform(a,i,s,c,n,o),this.transform(u,i,l,d,n,o);for(var h=0;h<n;h++){var p=s[h]*l[h]-c[h]*d[h];c[h]=s[h]*d[h]+c[h]*l[h],s[h]=p}return this.conjugate(s,c,n),this.transform(s,c,f,i,n,o),this.conjugate(f,i,n),this.normalize13b(f,n),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),p(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,n=0;n<this.length;n++){var o=(0|this.words[n])*e,i=(67108863&o)+(67108863&t);t>>=26,t+=o/67108864|0,t+=i>>>26,this.words[n]=67108863&i}return 0!==t&&(this.words[n]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,o=r%26;t[r]=(e.words[n]&1<<o)>>>o}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var i=r.sqr();n<t.length;n++,i=i.sqr())0!==t[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,o=(e-n)/26,i=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<n;this.words[t]=c|a,a=s>>>26-n}a&&(this.words[t]=a,this.length++)}if(0!==o){for(t=this.length-1;t>=0;t--)this.words[t+o]=this.words[t];for(t=0;t<o;t++)this.words[t]=0;this.length+=o}return this.strip()},o.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,n){var o;r("number"==typeof e&&e>=0),o=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=n;if(o-=a,o=Math.max(0,o),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=o);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,o=1<<t;return!(this.length<=n)&&!!(this.words[n]&o)},o.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var o=67108863^67108863>>>t<<t;this.words[this.length-1]&=o}return this.strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,n){var o,i,a=e.length+n;this._expand(a);var s=0;for(o=0;o<e.length;o++){i=(0|this.words[o+n])+s;var c=(0|e.words[o])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[o+n]=67108863&i}for(;o<this.length-n;o++)s=(i=(0|this.words[o+n])+s)>>26,this.words[o+n]=67108863&i;if(0===s)return this.strip();for(r(-1===s),s=0,o=0;o<this.length;o++)s=(i=-(0|this.words[o])+s)>>26,this.words[o]=67108863&i;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,c=n.length-i.length;if("mod"!==t){(s=new o(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=n.clone()._ishlnsubmul(i,1,c);0===l.negative&&(n=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var f=67108864*(0|n.words[i.length+d])+(0|n.words[i.length+d-1]);for(f=Math.min(f/a|0,67108863),n._ishlnsubmul(i,f,d);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,d),n.isZero()||(n.negative^=1);s&&(s.words[d]=f)}return s&&s.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),o=e.andln(1),i=r.cmp(n);return i<0||1===o&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,o=this.length-1;o>=0;o--)n=(t*n+(0|this.words[o]))%e;return n},o.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*t;this.words[n]=o/e|0,t=o%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),a=new o(0),s=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;!(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var p=0,y=1;!(n.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(s),a.isub(c)):(n.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new o(1),s=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,f=1;!(n.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(n.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s)):(n.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var o=t.cmp(r);if(o<0){var i=t;t=r,r=i}else if(0===o||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,o=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=o,this;for(var i=o,a=n;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var o=0|this.words[0];t=o===e?0:o<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],o=0|e.words[r];if(n!==o){n<o?t=-1:n>o&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new I(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function T(e){I.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},n(b,g),b.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),o=0;o<n;o++)t.words[o]=e.words[o];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,o=10;o<e.length;o++){var a=0|e.words[o];e.words[o-10]=(a&r)<<4|i>>>22,i=a}i>>>=22,e.words[o-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(v,g),n(w,g),n(_,g),_.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,o=67108863&n;n>>>=26,e.words[r]=o,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(m[e])return m[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return m[e]=t,t},I.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},I.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},I.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},I.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},I.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},I.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},I.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},I.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},I.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},I.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},I.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},I.prototype.isqr=function(e){return this.imul(e,e.clone())},I.prototype.sqr=function(e){return this.mul(e,e)},I.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),f=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=a;0!==h.cmp(s);){for(var y=h,m=0;0!==y.cmp(s);m++)y=y.redSqr();r(m<p);var g=this.pow(d,new o(1).iushln(p-m-1));f=f.redMul(g),d=g.redSqr(),h=h.redMul(d),p=m}return f},I.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},I.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var i=r[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),n=t.length-1;n>=0;n--){for(var u=t.words[n],l=c-1;l>=0;l--){var d=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4===++s||0===n&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}c=26}return i},I.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},I.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new T(e)},n(T,I),T.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},T.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},T.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),i=o;return o.cmp(this.m)>=0?i=o.isub(this.m):o.cmpn(0)<0&&(i=o.iadd(this.m)),i._forceRed(this)},T.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},T.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,commonjsGlobal)}(bn$3);var bnExports$1=bn$3.exports;!function(e){var t=e,r=bnExports$1,n=minimalisticAssert$1,o=utils$O;t.assert=n,t.toArray=o.toArray,t.zero2=o.zero2,t.toHex=o.toHex,t.encode=o.encode,t.getNAF=function(e,t,r){var n,o=new Array(Math.max(e.bitLength(),r)+1);for(n=0;n<o.length;n+=1)o[n]=0;var i=1<<t+1,a=e.clone();for(n=0;n<o.length;n++){var s,c=a.andln(i-1);a.isOdd()?(s=c>(i>>1)-1?(i>>1)-c:c,a.isubn(s)):s=0,o[n]=s,a.iushrn(1)}return o},t.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,o=0,i=0;e.cmpn(-o)>0||t.cmpn(-i)>0;){var a,s,c=e.andln(3)+o&3,u=t.andln(3)+i&3;3===c&&(c=-1),3===u&&(u=-1),a=1&c?3!==(n=e.andln(7)+o&7)&&5!==n||2!==u?c:-c:0,r[0].push(a),s=1&u?3!==(n=t.andln(7)+i&7)&&5!==n||2!==c?u:-u:0,r[1].push(s),2*o===a+1&&(o=1-o),2*i===s+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r},t.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},t.parseBytes=function(e){return"string"==typeof e?t.toArray(e,"hex"):e},t.intFromLE=function(e){return new r(e,"hex","le")}}(utils$p);var curve$1={},BN$f=bnExports$1,utils$o=utils$p,getNAF$1=utils$o.getNAF,getJSF$1=utils$o.getJSF,assert$h=utils$o.assert;function BaseCurve$1(e,t){this.type=e,this.p=new BN$f(t.p,16),this.red=t.prime?BN$f.red(t.prime):BN$f.mont(this.p),this.zero=new BN$f(0).toRed(this.red),this.one=new BN$f(1).toRed(this.red),this.two=new BN$f(2).toRed(this.red),this.n=t.n&&new BN$f(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base$1=BaseCurve$1;function BasePoint$1(e,t){this.curve=e,this.type=t,this.precomputed=null}BaseCurve$1.prototype.point=function(){throw new Error("Not implemented")},BaseCurve$1.prototype.validate=function(){throw new Error("Not implemented")},BaseCurve$1.prototype._fixedNafMul=function(e,t){assert$h(e.precomputed);var r=e._getDoubles(),n=getNAF$1(t,1,this._bitLength),o=(1<<r.step+1)-(r.step%2==0?2:1);o/=3;var i,a,s=[];for(i=0;i<n.length;i+=r.step){a=0;for(var c=i+r.step-1;c>=i;c--)a=(a<<1)+n[c];s.push(a)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=o;d>0;d--){for(i=0;i<s.length;i++)(a=s[i])===d?l=l.mixedAdd(r.points[i]):a===-d&&(l=l.mixedAdd(r.points[i].neg()));u=u.add(l)}return u.toP()},BaseCurve$1.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var o=n.points,i=getNAF$1(t,r,this._bitLength),a=this.jpoint(null,null,null),s=i.length-1;s>=0;s--){for(var c=0;s>=0&&0===i[s];s--)c++;if(s>=0&&c++,a=a.dblp(c),s<0)break;var u=i[s];assert$h(0!==u),a="affine"===e.type?u>0?a.mixedAdd(o[u-1>>1]):a.mixedAdd(o[-u-1>>1].neg()):u>0?a.add(o[u-1>>1]):a.add(o[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},BaseCurve$1.prototype._wnafMulAdd=function(e,t,r,n,o){var i,a,s,c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,d=0;for(i=0;i<n;i++){var f=(s=t[i])._getNAFPoints(e);c[i]=f.wnd,u[i]=f.points}for(i=n-1;i>=1;i-=2){var h=i-1,p=i;if(1===c[h]&&1===c[p]){var y=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(y[1]=t[h].add(t[p]),y[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(y[1]=t[h].toJ().mixedAdd(t[p]),y[2]=t[h].add(t[p].neg())):(y[1]=t[h].toJ().mixedAdd(t[p]),y[2]=t[h].toJ().mixedAdd(t[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=getJSF$1(r[h],r[p]);for(d=Math.max(g[0].length,d),l[h]=new Array(d),l[p]=new Array(d),a=0;a<d;a++){var b=0|g[0][a],v=0|g[1][a];l[h][a]=m[3*(b+1)+(v+1)],l[p][a]=0,u[h]=y}}else l[h]=getNAF$1(r[h],c[h],this._bitLength),l[p]=getNAF$1(r[p],c[p],this._bitLength),d=Math.max(l[h].length,d),d=Math.max(l[p].length,d)}var w=this.jpoint(null,null,null),_=this._wnafT4;for(i=d;i>=0;i--){for(var I=0;i>=0;){var T=!0;for(a=0;a<n;a++)_[a]=0|l[a][i],0!==_[a]&&(T=!1);if(!T)break;I++,i--}if(i>=0&&I++,w=w.dblp(I),i<0)break;for(a=0;a<n;a++){var k=_[a];0!==k&&(k>0?s=u[a][k-1>>1]:k<0&&(s=u[a][-k-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(i=0;i<n;i++)u[i]=null;return o?w:w.toP()},BaseCurve$1.BasePoint=BasePoint$1,BasePoint$1.prototype.eq=function(){throw new Error("Not implemented")},BasePoint$1.prototype.validate=function(){return this.curve.validate(this)},BaseCurve$1.prototype.decodePoint=function(e,t){e=utils$o.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?assert$h(e[e.length-1]%2==0):7===e[0]&&assert$h(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},BasePoint$1.prototype.encodeCompressed=function(e){return this.encode(e,!0)},BasePoint$1.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},BasePoint$1.prototype.encode=function(e,t){return utils$o.encode(this._encode(t),e)},BasePoint$1.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},BasePoint$1.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},BasePoint$1.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,o=0;o<t;o+=e){for(var i=0;i<e;i++)n=n.dbl();r.push(n)}return{step:e,points:r}},BasePoint$1.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),o=1;o<r;o++)t[o]=t[o-1].add(n);return{wnd:e,points:t}},BasePoint$1.prototype._getBeta=function(){return null},BasePoint$1.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var utils$n=utils$p,BN$e=bnExports$1,inherits$5=inherits_browserExports,Base$5=base$1,assert$g=utils$n.assert;function ShortCurve$1(e){Base$5.call(this,"short",e),this.a=new BN$e(e.a,16).toRed(this.red),this.b=new BN$e(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}inherits$5(ShortCurve$1,Base$5);var short$1=ShortCurve$1;function Point$5(e,t,r,n){Base$5.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new BN$e(t,16),this.y=new BN$e(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function JPoint$1(e,t,r,n){Base$5.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$e(0)):(this.x=new BN$e(t,16),this.y=new BN$e(r,16),this.z=new BN$e(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}ShortCurve$1.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new BN$e(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new BN$e(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],assert$g(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new BN$e(e.a,16),b:new BN$e(e.b,16)}})):this._getEndoBasis(r)}}},ShortCurve$1.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:BN$e.mont(e),r=new BN$e(2).toRed(t).redInvm(),n=r.redNeg(),o=new BN$e(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},ShortCurve$1.prototype._getEndoBasis=function(e){for(var t,r,n,o,i,a,s,c,u,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,f=this.n.clone(),h=new BN$e(1),p=new BN$e(0),y=new BN$e(0),m=new BN$e(1),g=0;0!==d.cmpn(0);){var b=f.div(d);c=f.sub(b.mul(d)),u=y.sub(b.mul(h));var v=m.sub(b.mul(p));if(!n&&c.cmp(l)<0)t=s.neg(),r=h,n=c.neg(),o=u;else if(n&&2==++g)break;s=c,f=d,d=c,y=h,h=u,m=p,p=v}i=c.neg(),a=u;var w=n.sqr().add(o.sqr());return i.sqr().add(a.sqr()).cmp(w)>=0&&(i=t,a=r),n.negative&&(n=n.neg(),o=o.neg()),i.negative&&(i=i.neg(),a=a.neg()),[{a:n,b:o},{a:i,b:a}]},ShortCurve$1.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],o=n.b.mul(e).divRound(this.n),i=r.b.neg().mul(e).divRound(this.n),a=o.mul(r.a),s=i.mul(n.a),c=o.mul(r.b),u=i.mul(n.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},ShortCurve$1.prototype.pointFromX=function(e,t){(e=new BN$e(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(t&&!o||!t&&o)&&(n=n.redNeg()),this.point(e,n)},ShortCurve$1.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(o).cmpn(0)},ShortCurve$1.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,o=this._endoWnafT2,i=0;i<e.length;i++){var a=this._endoSplit(t[i]),s=e[i],c=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),c=c.neg(!0)),n[2*i]=s,n[2*i+1]=c,o[2*i]=a.k1,o[2*i+1]=a.k2}for(var u=this._wnafMulAdd(1,n,o,2*i,r),l=0;l<2*i;l++)n[l]=null,o[l]=null;return u},inherits$5(Point$5,Base$5.BasePoint),ShortCurve$1.prototype.point=function(e,t,r){return new Point$5(this,e,t,r)},ShortCurve$1.prototype.pointFromJSON=function(e,t){return Point$5.fromJSON(this,e,t)},Point$5.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Point$5.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Point$5.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function o(t){return e.point(t[0],t[1],r)}var i=t[2];return n.precomputed={beta:null,doubles:i.doubles&&{step:i.doubles.step,points:[n].concat(i.doubles.points.map(o))},naf:i.naf&&{wnd:i.naf.wnd,points:[n].concat(i.naf.points.map(o))}},n},Point$5.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Point$5.prototype.isInfinity=function(){return this.inf},Point$5.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Point$5.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),o=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),i=o.redSqr().redISub(this.x.redAdd(this.x)),a=o.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,a)},Point$5.prototype.getX=function(){return this.x.fromRed()},Point$5.prototype.getY=function(){return this.y.fromRed()},Point$5.prototype.mul=function(e){return e=new BN$e(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Point$5.prototype.mulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o):this.curve._wnafMulAdd(1,n,o,2)},Point$5.prototype.jmulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o,!0):this.curve._wnafMulAdd(1,n,o,2,!0)},Point$5.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},Point$5.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},Point$5.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},inherits$5(JPoint$1,Base$5.BasePoint),ShortCurve$1.prototype.jpoint=function(e,t,r){return new JPoint$1(this,e,t,r)},JPoint$1.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},JPoint$1.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint$1.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),o=e.x.redMul(r),i=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(o),c=i.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),d=n.redMul(u),f=c.redSqr().redIAdd(l).redISub(d).redISub(d),h=c.redMul(d.redISub(f)).redISub(i.redMul(l)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(f,h,p)},JPoint$1.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),o=this.y,i=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=o.redSub(i);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),l=r.redMul(c),d=s.redSqr().redIAdd(u).redISub(l).redISub(l),f=s.redMul(l.redISub(d)).redISub(o.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(d,f,h)},JPoint$1.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var n=this.curve.a,o=this.curve.tinv,i=this.x,a=this.y,s=this.z,c=s.redSqr().redSqr(),u=a.redAdd(a);for(t=0;t<e;t++){var l=i.redSqr(),d=u.redSqr(),f=d.redSqr(),h=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(c)),p=i.redMul(d),y=h.redSqr().redISub(p.redAdd(p)),m=p.redISub(y),g=h.redMul(m);g=g.redIAdd(g).redISub(f);var b=u.redMul(s);t+1<e&&(c=c.redMul(f)),i=y,s=b,u=g}return this.curve.jpoint(i,u.redMul(o),s)},JPoint$1.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},JPoint$1.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),i=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(n).redISub(i);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n),c=s.redSqr().redISub(a).redISub(a),u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),e=c,t=s.redMul(a.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),d=this.y.redSqr(),f=d.redSqr(),h=this.x.redAdd(d).redSqr().redISub(l).redISub(f);h=h.redIAdd(h);var p=l.redAdd(l).redIAdd(l),y=p.redSqr(),m=f.redIAdd(f);m=(m=m.redIAdd(m)).redIAdd(m),e=y.redISub(h).redISub(h),t=p.redMul(h.redISub(e)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},JPoint$1.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),i=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(n).redISub(i);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),c=s.redSqr().redISub(a).redISub(a);e=c;var u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),t=s.redMul(a.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),d=this.y.redSqr(),f=this.x.redMul(d),h=this.x.redSub(l).redMul(this.x.redAdd(l));h=h.redAdd(h).redIAdd(h);var p=f.redIAdd(f),y=(p=p.redIAdd(p)).redAdd(p);e=h.redSqr().redISub(y),r=this.y.redAdd(this.z).redSqr().redISub(d).redISub(l);var m=d.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),t=h.redMul(p.redISub(e)).redISub(m)}return this.curve.jpoint(e,t,r)},JPoint$1.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,o=n.redSqr().redSqr(),i=t.redSqr(),a=r.redSqr(),s=i.redAdd(i).redIAdd(i).redIAdd(e.redMul(o)),c=t.redAdd(t),u=(c=c.redIAdd(c)).redMul(a),l=s.redSqr().redISub(u.redAdd(u)),d=u.redISub(l),f=a.redSqr();f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var h=s.redMul(d).redISub(f),p=r.redAdd(r).redMul(n);return this.curve.jpoint(l,h,p)},JPoint$1.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),o=e.redAdd(e).redIAdd(e),i=o.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).redISub(n),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(i)).redSqr(),c=n.redIAdd(n);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var u=o.redIAdd(a).redSqr().redISub(i).redISub(s).redISub(c),l=t.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var d=this.x.redMul(s).redISub(l);d=(d=d.redIAdd(d)).redIAdd(d);var f=this.y.redMul(u.redMul(c.redISub(u)).redISub(a.redMul(s)));f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var h=this.z.redAdd(a).redSqr().redISub(r).redISub(s);return this.curve.jpoint(d,f,h)},JPoint$1.prototype.mul=function(e,t){return e=new BN$e(e,t),this.curve._wnafMul(this,e)},JPoint$1.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),o=r.redMul(e.z);return 0===this.y.redMul(o).redISub(e.y.redMul(n)).cmpn(0)},JPoint$1.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),o=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(o),0===this.x.cmp(r))return!0}},JPoint$1.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},JPoint$1.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var BN$d=bnExports$1,inherits$4=inherits_browserExports,Base$4=base$1,utils$m=utils$p;function MontCurve$1(e){Base$4.call(this,"mont",e),this.a=new BN$d(e.a,16).toRed(this.red),this.b=new BN$d(e.b,16).toRed(this.red),this.i4=new BN$d(4).toRed(this.red).redInvm(),this.two=new BN$d(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits$4(MontCurve$1,Base$4);var mont$1=MontCurve$1;function Point$4(e,t,r){Base$4.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN$d(t,16),this.z=new BN$d(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}MontCurve$1.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},inherits$4(Point$4,Base$4.BasePoint),MontCurve$1.prototype.decodePoint=function(e,t){return this.point(utils$m.toArray(e,t),1)},MontCurve$1.prototype.point=function(e,t){return new Point$4(this,e,t)},MontCurve$1.prototype.pointFromJSON=function(e){return Point$4.fromJSON(this,e)},Point$4.prototype.precompute=function(){},Point$4.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Point$4.fromJSON=function(e,t){return new Point$4(e,t[0],t[1]||e.one)},Point$4.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Point$4.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Point$4.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),o=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,o)},Point$4.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Point$4.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),o=e.x.redAdd(e.z),i=e.x.redSub(e.z).redMul(r),a=o.redMul(n),s=t.z.redMul(i.redAdd(a).redSqr()),c=t.x.redMul(i.redISub(a).redSqr());return this.curve.point(s,c)},Point$4.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),o=[];0!==t.cmpn(0);t.iushrn(1))o.push(t.andln(1));for(var i=o.length-1;i>=0;i--)0===o[i]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},Point$4.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Point$4.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Point$4.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},Point$4.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Point$4.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var utils$l=utils$p,BN$c=bnExports$1,inherits$3=inherits_browserExports,Base$3=base$1,assert$f=utils$l.assert;function EdwardsCurve$1(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,Base$3.call(this,"edwards",e),this.a=new BN$c(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN$c(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN$c(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert$f(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}inherits$3(EdwardsCurve$1,Base$3);var edwards$1=EdwardsCurve$1;function Point$3(e,t,r,n,o){Base$3.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new BN$c(t,16),this.y=new BN$c(r,16),this.z=n?new BN$c(n,16):this.curve.one,this.t=o&&new BN$c(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}EdwardsCurve$1.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},EdwardsCurve$1.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},EdwardsCurve$1.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},EdwardsCurve$1.prototype.pointFromX=function(e,t){(e=new BN$c(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),i=n.redMul(o.redInvm()),a=i.redSqrt();if(0!==a.redSqr().redSub(i).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(t&&!s||!t&&s)&&(a=a.redNeg()),this.point(e,a)},EdwardsCurve$1.prototype.pointFromY=function(e,t){(e=new BN$c(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),i=n.redMul(o.redInvm());if(0===i.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=i.redSqrt();if(0!==a.redSqr().redSub(i).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},EdwardsCurve$1.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),o=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(o)},inherits$3(Point$3,Base$3.BasePoint),EdwardsCurve$1.prototype.pointFromJSON=function(e){return Point$3.fromJSON(this,e)},EdwardsCurve$1.prototype.point=function(e,t,r,n){return new Point$3(this,e,t,r,n)},Point$3.fromJSON=function(e,t){return new Point$3(e,t[0],t[1],t[2])},Point$3.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Point$3.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},Point$3.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),o=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),i=n.redAdd(t),a=i.redSub(r),s=n.redSub(t),c=o.redMul(a),u=i.redMul(s),l=o.redMul(s),d=a.redMul(i);return this.curve.point(c,u,d,l)},Point$3.prototype._projDbl=function(){var e,t,r,n,o,i,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(s)).redAdd(c);this.zOne?(e=a.redSub(s).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(n.redSub(c)),r=u.redSqr().redSub(u).redSub(u)):(o=this.z.redSqr(),i=u.redSub(o).redISub(o),e=a.redSub(s).redISub(c).redMul(i),t=u.redMul(n.redSub(c)),r=u.redMul(i))}else n=s.redAdd(c),o=this.curve._mulC(this.z).redSqr(),i=n.redSub(o).redSub(o),e=this.curve._mulC(a.redISub(n)).redMul(i),t=this.curve._mulC(n).redMul(s.redISub(c)),r=n.redMul(i);return this.curve.point(e,t,r)},Point$3.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Point$3.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),o=this.z.redMul(e.z.redAdd(e.z)),i=r.redSub(t),a=o.redSub(n),s=o.redAdd(n),c=r.redAdd(t),u=i.redMul(a),l=s.redMul(c),d=i.redMul(c),f=a.redMul(s);return this.curve.point(u,l,f,d)},Point$3.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),o=n.redSqr(),i=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(i).redMul(a),c=o.redSub(s),u=o.redAdd(s),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(a),d=n.redMul(c).redMul(l);return this.curve.twisted?(t=n.redMul(u).redMul(a.redSub(this.curve._mulA(i))),r=c.redMul(u)):(t=n.redMul(u).redMul(a.redSub(i)),r=this.curve._mulC(c).redMul(u)),this.curve.point(d,t,r)},Point$3.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Point$3.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Point$3.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},Point$3.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},Point$3.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Point$3.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Point$3.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Point$3.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Point$3.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},Point$3.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},Point$3.prototype.toP=Point$3.prototype.normalize,Point$3.prototype.mixedAdd=Point$3.prototype.add,function(e){var t=e;t.base=base$1,t.short=short$1,t.mont=mont$1,t.edwards=edwards$1}(curve$1);var curves$5={},secp256k1$1,hasRequiredSecp256k1$1;function requireSecp256k1$1(){return hasRequiredSecp256k1$1?secp256k1$1:(hasRequiredSecp256k1$1=1,secp256k1$1={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}})}!function(e){var t,r=e,n=hash$8,o=curve$1,i=utils$p.assert;function a(e){"short"===e.type?this.curve=new o.short(e):"edwards"===e.type?this.curve=new o.edwards(e):this.curve=new o.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var n=new a(t);return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=a,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:n.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:n.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:n.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:n.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:n.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:n.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:n.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{t=requireSecp256k1$1()}catch(e2){t=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:n.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",t]})}(curves$5);var BN$b=bnExports$1,utils$k=utils$p,assert$e=utils$k.assert;function KeyPair$7(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var key$3=KeyPair$7;KeyPair$7.fromPublic=function(e,t,r){return t instanceof KeyPair$7?t:new KeyPair$7(e,{pub:t,pubEnc:r})},KeyPair$7.fromPrivate=function(e,t,r){return t instanceof KeyPair$7?t:new KeyPair$7(e,{priv:t,privEnc:r})},KeyPair$7.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},KeyPair$7.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},KeyPair$7.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},KeyPair$7.prototype._importPrivate=function(e,t){this.priv=new BN$b(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},KeyPair$7.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?assert$e(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||assert$e(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},KeyPair$7.prototype.derive=function(e){return e.validate()||assert$e(e.validate(),"public point not validated"),e.mul(this.priv).getX()},KeyPair$7.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},KeyPair$7.prototype.verify=function(e,t,r){return this.ec.verify(e,t,this,void 0,r)},KeyPair$7.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var BN$a=bnExports$1,utils$j=utils$p,assert$d=utils$j.assert;function Signature$7(e,t){if(e instanceof Signature$7)return e;this._importDER(e,t)||(assert$d(e.r&&e.s,"Signature without r or s"),this.r=new BN$a(e.r,16),this.s=new BN$a(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var signature$3=Signature$7;function Position$1(){this.place=0}function getLength$1(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;if(0===e[t.place])return!1;for(var o=0,i=0,a=t.place;i<n;i++,a++)o<<=8,o|=e[a],o>>>=0;return!(o<=127)&&(t.place=a,o)}function rmPadding$1(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function constructLength$1(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}Signature$7.prototype._importDER=function(e,t){e=utils$j.toArray(e,t);var r=new Position$1;if(48!==e[r.place++])return!1;var n=getLength$1(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var o=getLength$1(e,r);if(!1===o)return!1;if(128&e[r.place])return!1;var i=e.slice(r.place,o+r.place);if(r.place+=o,2!==e[r.place++])return!1;var a=getLength$1(e,r);if(!1===a)return!1;if(e.length!==a+r.place)return!1;if(128&e[r.place])return!1;var s=e.slice(r.place,a+r.place);if(0===i[0]){if(!(128&i[1]))return!1;i=i.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new BN$a(i),this.s=new BN$a(s),this.recoveryParam=null,!0},Signature$7.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=rmPadding$1(t),r=rmPadding$1(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];constructLength$1(n,t.length),(n=n.concat(t)).push(2),constructLength$1(n,r.length);var o=n.concat(r),i=[48];return constructLength$1(i,o.length),i=i.concat(o),utils$j.encode(i,e)};var BN$9=bnExports$1,HmacDRBG$1=hmacDrbg$1,utils$i=utils$p,curves$4=curves$5,rand$1=requireBrorand(),assert$c=utils$i.assert,KeyPair$6=key$3,Signature$6=signature$3;function EC$1(e){if(!(this instanceof EC$1))return new EC$1(e);"string"==typeof e&&(assert$c(Object.prototype.hasOwnProperty.call(curves$4,e),"Unknown curve "+e),e=curves$4[e]),e instanceof curves$4.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var ec$1=EC$1;EC$1.prototype.keyPair=function(e){return new KeyPair$6(this,e)},EC$1.prototype.keyFromPrivate=function(e,t){return KeyPair$6.fromPrivate(this,e,t)},EC$1.prototype.keyFromPublic=function(e,t){return KeyPair$6.fromPublic(this,e,t)},EC$1.prototype.genKeyPair=function(e){e||(e={});for(var t=new HmacDRBG$1({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||rand$1(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new BN$9(2));;){var o=new BN$9(t.generate(r));if(!(o.cmp(n)>0))return o.iaddn(1),this.keyFromPrivate(o)}},EC$1.prototype._truncateToN=function(e,t,r){var n;if(BN$9.isBN(e)||"number"==typeof e)n=(e=new BN$9(e,16)).byteLength();else if("object"==typeof e)n=e.length,e=new BN$9(e,16);else{var o=e.toString();n=o.length+1>>>1,e=new BN$9(o,16)}"number"!=typeof r&&(r=8*n);var i=r-this.n.bitLength();return i>0&&(e=e.ushrn(i)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},EC$1.prototype.sign=function(e,t,r,n){if("object"==typeof r&&(n=r,r=null),n||(n={}),"string"!=typeof e&&"number"!=typeof e&&!BN$9.isBN(e)){assert$c("object"==typeof e&&e&&"number"==typeof e.length,"Expected message to be an array-like, a hex string, or a BN instance"),assert$c(e.length>>>0===e.length);for(var o=0;o<e.length;o++)assert$c((255&e[o])===e[o])}t=this.keyFromPrivate(t,r),e=this._truncateToN(e,!1,n.msgBitLength),assert$c(!e.isNeg(),"Can not sign a negative message");var i=this.n.byteLength(),a=t.getPrivate().toArray("be",i),s=e.toArray("be",i);assert$c(new BN$9(s).eq(e),"Can not sign message");for(var c=new HmacDRBG$1({hash:this.hash,entropy:a,nonce:s,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new BN$9(1)),l=0;;l++){var d=n.k?n.k(l):new BN$9(c.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(u)>=0)){var f=this.g.mul(d);if(!f.isInfinity()){var h=f.getX(),p=h.umod(this.n);if(0!==p.cmpn(0)){var y=d.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e));if(0!==(y=y.umod(this.n)).cmpn(0)){var m=(f.getY().isOdd()?1:0)|(0!==h.cmp(p)?2:0);return n.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),m^=1),new Signature$6({r:p,s:y,recoveryParam:m})}}}}}},EC$1.prototype.verify=function(e,t,r,n,o){o||(o={}),e=this._truncateToN(e,!1,o.msgBitLength),r=this.keyFromPublic(r,n);var i=(t=new Signature$6(t,"hex")).r,a=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var s,c=a.invm(this.n),u=c.mul(e).umod(this.n),l=c.mul(i).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(u,r.getPublic(),l)).isInfinity()&&s.eqXToP(i):!(s=this.g.mulAdd(u,r.getPublic(),l)).isInfinity()&&0===s.getX().umod(this.n).cmp(i)},EC$1.prototype.recoverPubKey=function(e,t,r,n){assert$c((3&r)===r,"The recovery param is more than two bits"),t=new Signature$6(t,n);var o=this.n,i=new BN$9(e),a=t.r,s=t.s,c=1&r,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var l=t.r.invm(o),d=o.sub(i).mul(l).umod(o),f=s.mul(l).umod(o);return this.g.mulAdd(d,a,f)},EC$1.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new Signature$6(t,n)).recoveryParam)return t.recoveryParam;for(var o=0;o<4;o++){var i;try{i=this.recoverPubKey(e,t,o)}catch(a){continue}if(i.eq(r))return o}throw new Error("Unable to find valid recovery factor")};var utils$h=utils$p,assert$b=utils$h.assert,parseBytes$5=utils$h.parseBytes,cachedProperty$3=utils$h.cachedProperty;function KeyPair$5(e,t){this.eddsa=e,this._secret=parseBytes$5(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=parseBytes$5(t.pub)}KeyPair$5.fromPublic=function(e,t){return t instanceof KeyPair$5?t:new KeyPair$5(e,{pub:t})},KeyPair$5.fromSecret=function(e,t){return t instanceof KeyPair$5?t:new KeyPair$5(e,{secret:t})},KeyPair$5.prototype.secret=function(){return this._secret},cachedProperty$3(KeyPair$5,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),cachedProperty$3(KeyPair$5,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),cachedProperty$3(KeyPair$5,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),cachedProperty$3(KeyPair$5,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),cachedProperty$3(KeyPair$5,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),cachedProperty$3(KeyPair$5,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),KeyPair$5.prototype.sign=function(e){return assert$b(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},KeyPair$5.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},KeyPair$5.prototype.getSecret=function(e){return assert$b(this._secret,"KeyPair is public only"),utils$h.encode(this.secret(),e)},KeyPair$5.prototype.getPublic=function(e){return utils$h.encode(this.pubBytes(),e)};var key$2=KeyPair$5,BN$8=bnExports$1,utils$g=utils$p,assert$a=utils$g.assert,cachedProperty$2=utils$g.cachedProperty,parseBytes$4=utils$g.parseBytes;function Signature$5(e,t){this.eddsa=e,"object"!=typeof t&&(t=parseBytes$4(t)),Array.isArray(t)&&(assert$a(t.length===2*e.encodingLength,"Signature has invalid size"),t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),assert$a(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof BN$8&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}cachedProperty$2(Signature$5,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),cachedProperty$2(Signature$5,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),cachedProperty$2(Signature$5,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),cachedProperty$2(Signature$5,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),Signature$5.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Signature$5.prototype.toHex=function(){return utils$g.encode(this.toBytes(),"hex").toUpperCase()};var signature$2=Signature$5,hash$1=hash$8,curves$3=curves$5,utils$f=utils$p,assert$9=utils$f.assert,parseBytes$3=utils$f.parseBytes,KeyPair$4=key$2,Signature$4=signature$2;function EDDSA$1(e){if(assert$9("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof EDDSA$1))return new EDDSA$1(e);e=curves$3[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=hash$1.sha512}var eddsa$1=EDDSA$1;EDDSA$1.prototype.sign=function(e,t){e=parseBytes$3(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),o=this.g.mul(n),i=this.encodePoint(o),a=this.hashInt(i,r.pubBytes(),e).mul(r.priv()),s=n.add(a).umod(this.curve.n);return this.makeSignature({R:o,S:s,Rencoded:i})},EDDSA$1.prototype.verify=function(e,t,r){if(e=parseBytes$3(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var n=this.keyFromPublic(r),o=this.hashInt(t.Rencoded(),n.pubBytes(),e),i=this.g.mul(t.S());return t.R().add(n.pub().mul(o)).eq(i)},EDDSA$1.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return utils$f.intFromLE(e.digest()).umod(this.curve.n)},EDDSA$1.prototype.keyFromPublic=function(e){return KeyPair$4.fromPublic(this,e)},EDDSA$1.prototype.keyFromSecret=function(e){return KeyPair$4.fromSecret(this,e)},EDDSA$1.prototype.makeSignature=function(e){return e instanceof Signature$4?e:new Signature$4(this,e)},EDDSA$1.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},EDDSA$1.prototype.decodePoint=function(e){var t=(e=utils$f.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),n=!!(128&e[t]),o=utils$f.intFromLE(r);return this.curve.pointFromY(o,n)},EDDSA$1.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},EDDSA$1.prototype.decodeInt=function(e){return utils$f.intFromLE(e)},EDDSA$1.prototype.isPoint=function(e){return e instanceof this.pointClass},function(e){var t=e;t.version=require$$0$3.version,t.utils=utils$p,t.rand=requireBrorand(),t.curve=curve$1,t.curves=curves$5,t.ec=ec$1,t.eddsa=eddsa$1}(elliptic$1);const C$6={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"}},Vn$1={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}};function _$6(e,t){const{message:r,code:n}=Vn$1[e];return{message:t?`${r} ${t}`:r,code:n}}const PARSE_ERROR="PARSE_ERROR",INVALID_REQUEST="INVALID_REQUEST",METHOD_NOT_FOUND="METHOD_NOT_FOUND",INVALID_PARAMS="INVALID_PARAMS",INTERNAL_ERROR="INTERNAL_ERROR",SERVER_ERROR="SERVER_ERROR",RESERVED_ERROR_CODES=[-32700,-32600,-32601,-32602,-32603],STANDARD_ERROR_MAP={[PARSE_ERROR]:{code:-32700,message:"Parse error"},[INVALID_REQUEST]:{code:-32600,message:"Invalid Request"},[METHOD_NOT_FOUND]:{code:-32601,message:"Method not found"},[INVALID_PARAMS]:{code:-32602,message:"Invalid params"},[INTERNAL_ERROR]:{code:-32603,message:"Internal error"},[SERVER_ERROR]:{code:-32e3,message:"Server error"}},DEFAULT_ERROR=SERVER_ERROR;function isReservedErrorCode(e){return RESERVED_ERROR_CODES.includes(e)}function getError(e){return Object.keys(STANDARD_ERROR_MAP).includes(e)?STANDARD_ERROR_MAP[e]:STANDARD_ERROR_MAP[DEFAULT_ERROR]}function getErrorByCode(e){const t=Object.values(STANDARD_ERROR_MAP).find((t=>t.code===e));return t||STANDARD_ERROR_MAP[DEFAULT_ERROR]}function parseConnectionError(e,t,r){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${t}`):e}var cjs$4={},crypto$1={},hasRequiredCrypto;function requireCrypto(){if(hasRequiredCrypto)return crypto$1;function e(){return(null==commonjsGlobal?void 0:commonjsGlobal.crypto)||(null==commonjsGlobal?void 0:commonjsGlobal.msCrypto)||{}}function t(){const t=e();return t.subtle||t.webkitSubtle}return hasRequiredCrypto=1,Object.defineProperty(crypto$1,"__esModule",{value:!0}),crypto$1.isBrowserCryptoAvailable=crypto$1.getSubtleCrypto=crypto$1.getBrowerCrypto=void 0,crypto$1.getBrowerCrypto=e,crypto$1.getSubtleCrypto=t,crypto$1.isBrowserCryptoAvailable=function(){return!!e()&&!!t()},crypto$1}var env={},hasRequiredEnv;function requireEnv(){if(hasRequiredEnv)return env;function e(){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product}function t(){return void 0!==process$1&&void 0!==process$1.versions&&void 0!==process$1.versions.node}return hasRequiredEnv=1,Object.defineProperty(env,"__esModule",{value:!0}),env.isBrowser=env.isNode=env.isReactNative=void 0,env.isReactNative=e,env.isNode=t,env.isBrowser=function(){return!e()&&!t()},env}function payloadId(e=3){return Date.now()*Math.pow(10,e)+Math.floor(Math.random()*Math.pow(10,e))}function getBigIntRpcId(e=6){return BigInt(payloadId(e))}function formatJsonRpcRequest(e,t,r){return{id:r||payloadId(),jsonrpc:"2.0",method:e,params:t}}function formatJsonRpcResult(e,t){return{id:e,jsonrpc:"2.0",result:t}}function formatJsonRpcError(e,t,r){return{id:e,jsonrpc:"2.0",error:formatErrorMessage(t)}}function formatErrorMessage(e,t){return void 0===e?getError(INTERNAL_ERROR):("string"==typeof e&&(e=Object.assign(Object.assign({},getError(SERVER_ERROR)),{message:e})),isReservedErrorCode(e.code)&&(e=getErrorByCode(e.code)),e)}!function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=require$$0$4;t.__exportStar(requireCrypto(),e),t.__exportStar(requireEnv(),e)}(cjs$4);let e$8=class{},n$8=class extends e$8{constructor(){super()}},r$5=class extends n$8{constructor(e){super()}};const WS_REGEX="^wss?:";function getUrlProtocol(e){const t=e.match(new RegExp(/^\w+:/,"gi"));if(t&&t.length)return t[0]}function matchRegexProtocol(e,t){const r=getUrlProtocol(e);return void 0!==r&&new RegExp(t).test(r)}function isWsUrl(e){return matchRegexProtocol(e,WS_REGEX)}function isLocalhostUrl(e){return new RegExp("wss?://localhost(:d{2,5})?").test(e)}function isJsonRpcPayload(e){return"object"==typeof e&&"id"in e&&"jsonrpc"in e&&"2.0"===e.jsonrpc}function isJsonRpcRequest(e){return isJsonRpcPayload(e)&&"method"in e}function isJsonRpcResponse(e){return isJsonRpcPayload(e)&&(isJsonRpcResult(e)||isJsonRpcError(e))}function isJsonRpcResult(e){return"result"in e}function isJsonRpcError(e){return"error"in e}let o$8=class extends r$5{constructor(e){super(e),this.events=new eventsExports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(formatJsonRpcRequest(e.method,e.params||[],e.id||getBigIntRpcId().toString()),t)}async requestStrict(e,t){return new Promise((async(r,n)=>{if(!this.connection.connected)try{await this.open()}catch(o){n(o)}this.events.on(`${e.id}`,(e=>{isJsonRpcError(e)?n(e.error):r(e.result)}));try{await this.connection.send(e,t)}catch(o){n(o)}}))}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),isJsonRpcResponse(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&3e3===e.code&&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(),"string"==typeof e&&(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)}};var lodash_isequal={exports:{}};lodash_isequal.exports,function(e,t){var r="__lodash_hash_undefined__",n=9007199254740991,o="[object Arguments]",i="[object Array]",a="[object Boolean]",s="[object Date]",c="[object Error]",u="[object Function]",l="[object Map]",d="[object Number]",f="[object Object]",h="[object Promise]",p="[object RegExp]",y="[object Set]",m="[object String]",g="[object Symbol]",b="[object WeakMap]",v="[object ArrayBuffer]",w="[object DataView]",_=/^\[object .+?Constructor\]$/,I=/^(?:0|[1-9]\d*)$/,T={};T["[object Float32Array]"]=T["[object Float64Array]"]=T["[object Int8Array]"]=T["[object Int16Array]"]=T["[object Int32Array]"]=T["[object Uint8Array]"]=T["[object Uint8ClampedArray]"]=T["[object Uint16Array]"]=T["[object Uint32Array]"]=!0,T[o]=T[i]=T[v]=T[a]=T[w]=T[s]=T[c]=T[u]=T[l]=T[d]=T[f]=T[p]=T[y]=T[m]=T[b]=!1;var k="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,$="object"==typeof self&&self&&self.Object===Object&&self,S=k||$||Function("return this")(),A=t&&!t.nodeType&&t,E=A&&e&&!e.nodeType&&e,C=E&&E.exports===A,R=C&&k.process,O=function(){try{return R&&R.binding&&R.binding("util")}catch(e2){}}(),N=O&&O.isTypedArray;function P(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function M(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function B(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var D,x,L,U=Array.prototype,j=Function.prototype,F=Object.prototype,q=S["__core-js_shared__"],K=j.toString,H=F.hasOwnProperty,G=(D=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||""))?"Symbol(src)_1."+D:"",z=F.toString,V=RegExp("^"+K.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),W=C?S.Buffer:void 0,Q=S.Symbol,Y=S.Uint8Array,X=F.propertyIsEnumerable,J=U.splice,Z=Q?Q.toStringTag:void 0,ee=Object.getOwnPropertySymbols,te=W?W.isBuffer:void 0,re=(x=Object.keys,L=Object,function(e){return x(L(e))}),ne=Oe(S,"DataView"),oe=Oe(S,"Map"),ie=Oe(S,"Promise"),ae=Oe(S,"Set"),se=Oe(S,"WeakMap"),ce=Oe(Object,"create"),ue=Be(ne),le=Be(oe),de=Be(ie),fe=Be(ae),he=Be(se),pe=Q?Q.prototype:void 0,ye=pe?pe.valueOf:void 0;function me(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ge(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function be(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ve(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new be;++t<r;)this.add(e[t])}function we(e){var t=this.__data__=new ge(e);this.size=t.size}function _e(e,t){var r=Le(e),n=!r&&xe(e),o=!r&&!n&&Ue(e),i=!r&&!n&&!o&&He(e),a=r||n||o||i,s=a?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var u in e)!H.call(e,u)||a&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Me(u,c))||s.push(u);return s}function Ie(e,t){for(var r=e.length;r--;)if(De(e[r][0],t))return r;return-1}function Te(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Z&&Z in Object(e)?function(e){var t=H.call(e,Z),r=e[Z];try{e[Z]=void 0;var n=!0}catch(e2){}var o=z.call(e);n&&(t?e[Z]=r:delete e[Z]);return o}(e):function(e){return z.call(e)}(e)}function ke(e){return Ke(e)&&Te(e)==o}function $e(e,t,r,n,u){return e===t||(null==e||null==t||!Ke(e)&&!Ke(t)?e!=e&&t!=t:function(e,t,r,n,u,h){var b=Le(e),_=Le(t),I=b?i:Pe(e),T=_?i:Pe(t),k=(I=I==o?f:I)==f,$=(T=T==o?f:T)==f,S=I==T;if(S&&Ue(e)){if(!Ue(t))return!1;b=!0,k=!1}if(S&&!k)return h||(h=new we),b||He(e)?Ee(e,t,r,n,u,h):function(e,t,r,n,o,i,u){switch(r){case w:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case v:return!(e.byteLength!=t.byteLength||!i(new Y(e),new Y(t)));case a:case s:case d:return De(+e,+t);case c:return e.name==t.name&&e.message==t.message;case p:case m:return e==t+"";case l:var f=M;case y:var h=1&n;if(f||(f=B),e.size!=t.size&&!h)return!1;var b=u.get(e);if(b)return b==t;n|=2,u.set(e,t);var _=Ee(f(e),f(t),n,o,i,u);return u.delete(e),_;case g:if(ye)return ye.call(e)==ye.call(t)}return!1}(e,t,I,r,n,u,h);if(!(1&r)){var A=k&&H.call(e,"__wrapped__"),E=$&&H.call(t,"__wrapped__");if(A||E){var C=A?e.value():e,R=E?t.value():t;return h||(h=new we),u(C,R,r,n,h)}}if(!S)return!1;return h||(h=new we),function(e,t,r,n,o,i){var a=1&r,s=Ce(e),c=s.length,u=Ce(t),l=u.length;if(c!=l&&!a)return!1;var d=c;for(;d--;){var f=s[d];if(!(a?f in t:H.call(t,f)))return!1}var h=i.get(e);if(h&&i.get(t))return h==t;var p=!0;i.set(e,t),i.set(t,e);var y=a;for(;++d<c;){var m=e[f=s[d]],g=t[f];if(n)var b=a?n(g,m,f,t,e,i):n(m,g,f,e,t,i);if(!(void 0===b?m===g||o(m,g,r,n,i):b)){p=!1;break}y||(y="constructor"==f)}if(p&&!y){var v=e.constructor,w=t.constructor;v==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof w&&w instanceof w||(p=!1)}return i.delete(e),i.delete(t),p}(e,t,r,n,u,h)}(e,t,r,n,$e,u))}function Se(e){return!(!qe(e)||function(e){return!!G&&G in e}(e))&&(je(e)?V:_).test(Be(e))}function Ae(e){if(r=(t=e)&&t.constructor,n="function"==typeof r&&r.prototype||F,t!==n)return re(e);var t,r,n,o=[];for(var i in Object(e))H.call(e,i)&&"constructor"!=i&&o.push(i);return o}function Ee(e,t,r,n,o,i){var a=1&r,s=e.length,c=t.length;if(s!=c&&!(a&&c>s))return!1;var u=i.get(e);if(u&&i.get(t))return u==t;var l=-1,d=!0,f=2&r?new ve:void 0;for(i.set(e,t),i.set(t,e);++l<s;){var h=e[l],p=t[l];if(n)var y=a?n(p,h,l,t,e,i):n(h,p,l,e,t,i);if(void 0!==y){if(y)continue;d=!1;break}if(f){if(!P(t,(function(e,t){if(a=t,!f.has(a)&&(h===e||o(h,e,r,n,i)))return f.push(t);var a}))){d=!1;break}}else if(h!==p&&!o(h,p,r,n,i)){d=!1;break}}return i.delete(e),i.delete(t),d}function Ce(e){return function(e,t,r){var n=t(e);return Le(e)?n:function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}(n,r(e))}(e,Ge,Ne)}function Re(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function Oe(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return Se(r)?r:void 0}me.prototype.clear=function(){this.__data__=ce?ce(null):{},this.size=0},me.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},me.prototype.get=function(e){var t=this.__data__;if(ce){var n=t[e];return n===r?void 0:n}return H.call(t,e)?t[e]:void 0},me.prototype.has=function(e){var t=this.__data__;return ce?void 0!==t[e]:H.call(t,e)},me.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=ce&&void 0===t?r:t,this},ge.prototype.clear=function(){this.__data__=[],this.size=0},ge.prototype.delete=function(e){var t=this.__data__,r=Ie(t,e);return!(r<0)&&(r==t.length-1?t.pop():J.call(t,r,1),--this.size,!0)},ge.prototype.get=function(e){var t=this.__data__,r=Ie(t,e);return r<0?void 0:t[r][1]},ge.prototype.has=function(e){return Ie(this.__data__,e)>-1},ge.prototype.set=function(e,t){var r=this.__data__,n=Ie(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},be.prototype.clear=function(){this.size=0,this.__data__={hash:new me,map:new(oe||ge),string:new me}},be.prototype.delete=function(e){var t=Re(this,e).delete(e);return this.size-=t?1:0,t},be.prototype.get=function(e){return Re(this,e).get(e)},be.prototype.has=function(e){return Re(this,e).has(e)},be.prototype.set=function(e,t){var r=Re(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},ve.prototype.add=ve.prototype.push=function(e){return this.__data__.set(e,r),this},ve.prototype.has=function(e){return this.__data__.has(e)},we.prototype.clear=function(){this.__data__=new ge,this.size=0},we.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},we.prototype.get=function(e){return this.__data__.get(e)},we.prototype.has=function(e){return this.__data__.has(e)},we.prototype.set=function(e,t){var r=this.__data__;if(r instanceof ge){var n=r.__data__;if(!oe||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new be(n)}return r.set(e,t),this.size=r.size,this};var Ne=ee?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,i=[];++r<n;){var a=e[r];t(a,r,e)&&(i[o++]=a)}return i}(ee(e),(function(t){return X.call(e,t)})))}:function(){return[]},Pe=Te;function Me(e,t){return!!(t=null==t?n:t)&&("number"==typeof e||I.test(e))&&e>-1&&e%1==0&&e<t}function Be(e){if(null!=e){try{return K.call(e)}catch(e2){}try{return e+""}catch(e2){}}return""}function De(e,t){return e===t||e!=e&&t!=t}(ne&&Pe(new ne(new ArrayBuffer(1)))!=w||oe&&Pe(new oe)!=l||ie&&Pe(ie.resolve())!=h||ae&&Pe(new ae)!=y||se&&Pe(new se)!=b)&&(Pe=function(e){var t=Te(e),r=t==f?e.constructor:void 0,n=r?Be(r):"";if(n)switch(n){case ue:return w;case le:return l;case de:return h;case fe:return y;case he:return b}return t});var xe=ke(function(){return arguments}())?ke:function(e){return Ke(e)&&H.call(e,"callee")&&!X.call(e,"callee")},Le=Array.isArray;var Ue=te||function(){return!1};function je(e){if(!qe(e))return!1;var t=Te(e);return t==u||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Fe(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}function qe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ke(e){return null!=e&&"object"==typeof e}var He=N?function(e){return function(t){return e(t)}}(N):function(e){return Ke(e)&&Fe(e.length)&&!!T[Te(e)]};function Ge(e){return null!=(t=e)&&Fe(t.length)&&!je(t)?_e(e):Ae(e);var t}e.exports=function(e,t){return $e(e,t)}}(lodash_isequal,lodash_isequal.exports);var lodash_isequalExports=lodash_isequal.exports;const ys$1=getDefaultExportFromCjs$1(lodash_isequalExports);function unfetch_module(e,t){return t=t||{},new Promise((function(r,n){var o=new XMLHttpRequest,i=[],a=[],s={},c=function(){return{ok:2==(o.status/100|0),statusText:o.statusText,status:o.status,url:o.responseURL,text:function(){return Promise.resolve(o.responseText)},json:function(){return Promise.resolve(o.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([o.response]))},clone:c,headers:{keys:function(){return i},entries:function(){return a},get:function(e){return s[e.toLowerCase()]},has:function(e){return e.toLowerCase()in s}}}};for(var u in o.open(t.method||"get",e,!0),o.onload=function(){o.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,r){i.push(t=t.toLowerCase()),a.push([t,r]),s[t]=s[t]?s[t]+","+r:r})),r(c())},o.onerror=n,o.withCredentials="include"==t.credentials,t.headers)o.setRequestHeader(u,t.headers[u]);o.send(t.body||null)}))}const unfetch_module$1=Object.freeze(Object.defineProperty({__proto__:null,default:unfetch_module},Symbol.toStringTag,{value:"Module"})),require$$0$2=getAugmentedNamespace(unfetch_module$1);function ut$2(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<e.length;o++){var i=e.charAt(o),a=i.charCodeAt(0);if(255!==r[a])throw new TypeError(i+" is ambiguous");r[a]=o}var s=e.length,c=e.charAt(0),u=Math.log(s)/Math.log(256),l=Math.log(256)/Math.log(s);function d(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,o=0;e[t]===c;)n++,t++;for(var i=(e.length-t)*u+1>>>0,a=new Uint8Array(i);e[t];){var l=r[e.charCodeAt(t)];if(255===l)return;for(var d=0,f=i-1;(0!==l||d<o)&&-1!==f;f--,d++)l+=s*a[f]>>>0,a[f]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=d,t++}if(" "!==e[t]){for(var h=i-o;h!==i&&0===a[h];)h++;for(var p=new Uint8Array(n+(i-h)),y=n;h!==i;)p[y++]=a[h++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,o=0,i=t.length;o!==i&&0===t[o];)o++,r++;for(var a=(i-o)*l+1>>>0,u=new Uint8Array(a);o!==i;){for(var d=t[o],f=0,h=a-1;(0!==d||f<n)&&-1!==h;h--,f++)d+=256*u[h]>>>0,u[h]=d%s>>>0,d=d/s>>>0;if(0!==d)throw new Error("Non-zero carry");n=f,o++}for(var p=a-n;p!==a&&0===u[p];)p++;for(var y=c.repeat(r);p<a;++p)y+=e.charAt(u[p]);return y},decodeUnsafe:d,decode:function(e){var r=d(e);if(r)return r;throw new Error(`Non-${t} character`)}}}self.fetch||(self.fetch=require$$0$2.default||require$$0$2);var at$2=ut$2,Dt$2=at$2;const re$2=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},ct$2=e=>(new TextEncoder).encode(e),ht$2=e=>(new TextDecoder).decode(e);let lt$2=class{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},dt$2=class{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){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))}throw Error("Can only multibase decode strings")}or(e){return ie$1(this,e)}},pt$3=class{constructor(e){this.decoders=e}or(e){return ie$1(this,e)}decode(e){const t=e[0],r=this.decoders[t];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 ie$1=(e,t)=>new pt$3({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});let ft$1=class{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new lt$2(e,t,r),this.decoder=new dt$2(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};const O$4=({name:e,prefix:t,encode:r,decode:n})=>new ft$1(e,t,r,n),T$4=({prefix:e,name:t,alphabet:r})=>{const{encode:n,decode:o}=Dt$2(r,t);return O$4({prefix:e,name:t,encode:n,decode:e=>re$2(o(e))})},gt$3=(e,t,r,n)=>{const o={};for(let l=0;l<t.length;++l)o[t[l]]=l;let i=e.length;for(;"="===e[i-1];)--i;const a=new Uint8Array(i*r/8|0);let s=0,c=0,u=0;for(let l=0;l<i;++l){const t=o[e[l]];if(void 0===t)throw new SyntaxError(`Non-${n} character`);c=c<<r|t,s+=r,s>=8&&(s-=8,a[u++]=255&c>>s)}if(s>=r||255&c<<8-s)throw new SyntaxError("Unexpected end of data");return a},Et$1=(e,t,r)=>{const n="="===t[t.length-1],o=(1<<r)-1;let i="",a=0,s=0;for(let c=0;c<e.length;++c)for(s=s<<8|e[c],a+=8;a>r;)a-=r,i+=t[o&s>>a];if(a&&(i+=t[o&s<<r-a]),n)for(;i.length*r&7;)i+="=";return i},d$5=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>O$4({prefix:t,name:e,encode:e=>Et$1(e,n,r),decode:t=>gt$3(t,n,r,e)}),bt$2=O$4({prefix:"\0",name:"identity",encode:e=>ht$2(e),decode:e=>ct$2(e)});var yt$2=Object.freeze({__proto__:null,identity:bt$2});const wt$1=d$5({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ct$1=Object.freeze({__proto__:null,base2:wt$1});const mt$1=d$5({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var vt$2=Object.freeze({__proto__:null,base8:mt$1});const At$1=T$4({prefix:"9",name:"base10",alphabet:"0123456789"});var _t$2=Object.freeze({__proto__:null,base10:At$1});const xt$2=d$5({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Rt$1=d$5({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ft$2=Object.freeze({__proto__:null,base16:xt$2,base16upper:Rt$1});const Tt$2=d$5({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),It$1=d$5({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),qt$2=d$5({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ut$1=d$5({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ot$2=d$5({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),St$1=d$5({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Pt$2=d$5({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Nt$2=d$5({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),$t$2=d$5({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Bt$2=Object.freeze({__proto__:null,base32:Tt$2,base32upper:It$1,base32pad:qt$2,base32padupper:Ut$1,base32hex:Ot$2,base32hexupper:St$1,base32hexpad:Pt$2,base32hexpadupper:Nt$2,base32z:$t$2});const zt$2=T$4({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),jt$1=T$4({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Mt$2=Object.freeze({__proto__:null,base36:zt$2,base36upper:jt$1});const Lt$2=T$4({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Kt$2=T$4({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Vt$2=Object.freeze({__proto__:null,base58btc:Lt$2,base58flickr:Kt$2});const kt$2=d$5({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Jt$2=d$5({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Xt$2=d$5({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Gt$2=d$5({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ht$2=Object.freeze({__proto__:null,base64:kt$2,base64pad:Jt$2,base64url:Xt$2,base64urlpad:Gt$2});const ne$1=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Yt$2=ne$1.reduce(((e,t,r)=>(e[r]=t,e)),[]),Qt$2=ne$1.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]);function Zt$2(e){return e.reduce(((e,t)=>e+=Yt$2[t]),"")}function Wt$2(e){const t=[];for(const r of e){const e=Qt$2[r.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}const er$2=O$4({prefix:"🚀",name:"base256emoji",encode:Zt$2,decode:Wt$2});var tr$1=Object.freeze({__proto__:null,base256emoji:er$2}),rr$1=oe$1,se$1=128,ir$2=127,nr$2=~ir$2,sr$1=Math.pow(2,31);function oe$1(e,t,r){t=t||[];for(var n=r=r||0;e>=sr$1;)t[r++]=255&e|se$1,e/=128;for(;e&nr$2;)t[r++]=255&e|se$1,e>>>=7;return t[r]=0|e,oe$1.bytes=r-n+1,t}var or$1=j$2,ur$2=128,ue=127;function j$2(e,t){var r,n=0,o=0,i=t=t||0,a=e.length;do{if(i>=a)throw j$2.bytes=0,new RangeError("Could not decode varint");r=e[i++],n+=o<28?(r&ue)<<o:(r&ue)*Math.pow(2,o),o+=7}while(r>=ur$2);return j$2.bytes=i-t,n}var ar$2=Math.pow(2,7),Dr$2=Math.pow(2,14),cr$2=Math.pow(2,21),hr$2=Math.pow(2,28),lr$2=Math.pow(2,35),dr$2=Math.pow(2,42),pr$2=Math.pow(2,49),fr$3=Math.pow(2,56),gr$2=Math.pow(2,63),Er$2=function(e){return e<ar$2?1:e<Dr$2?2:e<cr$2?3:e<hr$2?4:e<lr$2?5:e<dr$2?6:e<pr$2?7:e<fr$3?8:e<gr$2?9:10},br$2={encode:rr$1,decode:or$1,encodingLength:Er$2},ae$2=br$2;const De$1=(e,t,r=0)=>(ae$2.encode(e,t,r),t),ce$1=e=>ae$2.encodingLength(e),M$6=(e,t)=>{const r=t.byteLength,n=ce$1(e),o=n+ce$1(r),i=new Uint8Array(o+r);return De$1(e,i,0),De$1(r,i,n),i.set(t,o),new yr$2(e,r,t,i)};let yr$2=class{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};const he$1=({name:e,code:t,encode:r})=>new wr$2(e,t,r);let wr$2=class{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?M$6(this.code,t):t.then((e=>M$6(this.code,e)))}throw Error("Unknown type, must be binary type")}};const le$1=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Cr$2=he$1({name:"sha2-256",code:18,encode:le$1("SHA-256")}),mr$2=he$1({name:"sha2-512",code:19,encode:le$1("SHA-512")});var vr$2=Object.freeze({__proto__:null,sha256:Cr$2,sha512:mr$2});const de$2=0,Ar$2="identity",pe$1=re$2,_r$2=e=>M$6(de$2,pe$1(e)),xr$2={code:de$2,name:Ar$2,encode:pe$1,digest:_r$2};var Rr$2=Object.freeze({__proto__:null,identity:xr$2});new TextEncoder,new TextDecoder;let n$7=class extends IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},h$6=class extends IEvents{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}},a$5=class{constructor(e,t){this.logger=e,this.core=t}},g$5=class extends IEvents{constructor(e,t){super(),this.relayer=e,this.logger=t}},u$4=class extends IEvents{constructor(e){super()}},p$3=class{constructor(e,t,r,n){this.core=e,this.logger=t,this.name=r}},d$4=class extends IEvents{constructor(e,t){super(),this.relayer=e,this.logger=t}},x$5=class extends IEvents{constructor(e,t){super(),this.core=e,this.logger=t}},y$6=class{constructor(e,t,r){this.core=e,this.logger=t,this.store=r}},v$5=class{constructor(e,t){this.projectId=e,this.logger=t}},C$5=class{constructor(e,t,r){this.core=e,this.logger=t,this.telemetryEnabled=r}},S$7=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},M$5=class{constructor(e){this.client=e}};var __spreadArray=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},BrowserInfo$1=function(){return function(e,t,r){this.name=e,this.version=t,this.os=r,this.type="browser"}}(),NodeInfo$1=function(){return function(e){this.version=e,this.type="node",this.name="node",this.os=process$1.platform}}(),SearchBotDeviceInfo$1=function(){return function(e,t,r,n){this.name=e,this.version=t,this.os=r,this.bot=n,this.type="bot-device"}}(),BotInfo$1=function(){return function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}}(),ReactNativeInfo$1=function(){return function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}}(),SEARCHBOX_UA_REGEX$1=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,SEARCHBOT_OS_REGEX$1=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,REQUIRED_VERSION_PARTS$1=3,userAgentRules$1=[["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",SEARCHBOX_UA_REGEX$1]],operatingSystemRules$1=[["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 detect$1(e){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new ReactNativeInfo$1:"undefined"!=typeof navigator?parseUserAgent$1(navigator.userAgent):getNodeVersion$1()}function matchUserAgent$1(e){return""!==e&&userAgentRules$1.reduce((function(t,r){var n=r[0],o=r[1];if(t)return t;var i=o.exec(e);return!!i&&[n,i]}),!1)}function parseUserAgent$1(e){var t=matchUserAgent$1(e);if(!t)return null;var r=t[0],n=t[1];if("searchbot"===r)return new BotInfo$1;var o=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);o?o.length<REQUIRED_VERSION_PARTS$1&&(o=__spreadArray(__spreadArray([],o,!0),createVersionParts$1(REQUIRED_VERSION_PARTS$1-o.length),!0)):o=[];var i=o.join("."),a=detectOS$2(e),s=SEARCHBOT_OS_REGEX$1.exec(e);return s&&s[1]?new SearchBotDeviceInfo$1(r,i,a,s[1]):new BrowserInfo$1(r,i,a)}function detectOS$2(e){for(var t=0,r=operatingSystemRules$1.length;t<r;t++){var n=operatingSystemRules$1[t],o=n[0];if(n[1].exec(e))return o}return null}function getNodeVersion$1(){return void 0!==process$1&&process$1.version?new NodeInfo$1(process$1.version.slice(1)):null}function createVersionParts$1(e){for(var t=[],r=0;r<e;r++)t.push("0");return t}var cjs$3={};Object.defineProperty(cjs$3,"__esModule",{value:!0});var getWindowMetadata_1$1=cjs$3.getWindowMetadata=void 0;const window_getters_1$1=cjs$6;function getWindowMetadata$1(){let e,t;try{e=window_getters_1$1.getDocumentOrThrow(),t=window_getters_1$1.getLocationOrThrow()}catch(e2){return null}function r(...t){const r=e.getElementsByTagName("meta");for(let e=0;e<r.length;e++){const n=r[e],o=["itemprop","property","name"].map((e=>n.getAttribute(e))).filter((e=>!!e&&t.includes(e)));if(o.length&&o){const e=n.getAttribute("content");if(e)return e}}return""}const n=function(){let t=r("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}();return{description:r("description","og:description","twitter:description","keywords"),url:t.origin,icons:function(){const r=e.getElementsByTagName("link"),n=[];for(let e=0;e<r.length;e++){const o=r[e],i=o.getAttribute("rel");if(i&&i.toLowerCase().indexOf("icon")>-1){const e=o.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let r=t.protocol+"//"+t.host;if(0===e.indexOf("/"))r+=e;else{const n=t.pathname.split("/");n.pop();r+=n.join("/")+"/"+e}n.push(r)}else if(0===e.indexOf("//")){const r=t.protocol+e;n.push(r)}else n.push(e)}}return n}(),name:n}}getWindowMetadata_1$1=cjs$3.getWindowMetadata=getWindowMetadata$1;var elliptic={};const name="elliptic",version$2="6.5.7",description="EC cryptography",main="lib/elliptic.js",files=["lib"],scripts={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository={type:"git",url:"git@github.com:indutny/elliptic"},keywords=["EC","Elliptic","curve","Cryptography"],author="Fedor Indutny <fedor@indutny.com>",license="MIT",bugs={url:"https://github.com/indutny/elliptic/issues"},homepage="https://github.com/indutny/elliptic",devDependencies={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0$1={name:name,version:version$2,description:description,main:main,files:files,scripts:scripts,repository:repository,keywords:keywords,author:author,license:license,bugs:bugs,homepage:homepage,devDependencies:devDependencies,dependencies:dependencies};var utils$e={},bn$2={exports:{}};bn$2.exports,function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var i;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$2$1.Buffer}catch(e2){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function c(e,t,r,n){for(var o=0,i=Math.min(e.length,r),a=t;a<i;a++){var s=e.charCodeAt(a)-48;o*=n,o+=s>=49?s-49+10:s>=17?s-17+10:s}return o}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var o=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(o++,this.negative=1),o<e.length&&(16===t?this._parseHex(e,o,n):(this._parseBase(e,t,o),"le"===n&&this._initArray(this.toArray(),t,n)))},o.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var i,a,s=0;if("be"===n)for(o=e.length-1,i=0;o>=0;o-=3)a=e[o]|e[o-1]<<8|e[o-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===n)for(o=0,i=0;o<e.length;o+=3)a=e[o]|e[o+1]<<8|e[o+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this.strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,i=0,a=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)o=s(e,t,n)<<i,this.words[a]|=67108863&o,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)o=s(e,t,n)<<i,this.words[a]|=67108863&o,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,o=1;o<=67108863;o*=t)n++;n--,o=o/t|0;for(var i=e.length-r,a=i%n,s=Math.min(i,i-a)+r,u=0,l=r;l<s;l+=n)u=c(e,l,l+n,t),this.imuln(o),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var o=0|e.words[0],i=0|t.words[0],a=o*i,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u<n;u++){for(var l=c>>>26,d=67108863&c,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;l+=(a=(o=0|e.words[p])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var o=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<o|i)).toString(16);i=s>>>24-o&16777215,(o+=2)>=26&&(o-=26,a--),n=0!==i||a!==this.length-1?u[6-c.length]+c+n:c+n}for(0!==i&&(n=i.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var f=l[e],h=d[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modn(h).toString(e);n=(p=p.idivn(h)).isZero()?y+n:u[f-y.length]+y+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return r(void 0!==i),this.toArrayLike(i,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,n){var o=this.byteLength(),i=n||Math.max(1,o);r(o<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(i),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s<i;s++)u[s]=0}else{for(s=0;s<i-o;s++)u[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[i-s-1]=a}return u},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var o=0;o<t;o++)this.words[o]=67108863&~this.words[o];return n>0&&(this.words[o]=~this.words[o]&67108863>>26-n),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,o=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<o:this.words[n]&~(1<<o),this.strip()},o.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var o=0,i=0;i<n.length;i++)t=(0|r.words[i])+(0|n.words[i])+o,this.words[i]=67108863&t,o=t>>>26;for(;0!==o&&i<r.length;i++)t=(0|r.words[i])+o,this.words[i]=67108863&t,o=t>>>26;if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,o=this.cmp(e);if(0===o)return this.negative=0,this.length=1,this.words[0]=0,this;o>0?(r=this,n=e):(r=e,n=this);for(var i=0,a=0;a<n.length;a++)i=(t=(0|r.words[a])-(0|n.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<r.length;a++)i=(t=(0|r.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var n,o,i,a=e.words,s=t.words,c=r.words,u=0,l=0|a[0],d=8191&l,f=l>>>13,h=0|a[1],p=8191&h,y=h>>>13,m=0|a[2],g=8191&m,b=m>>>13,v=0|a[3],w=8191&v,_=v>>>13,I=0|a[4],T=8191&I,k=I>>>13,$=0|a[5],S=8191&$,A=$>>>13,E=0|a[6],C=8191&E,R=E>>>13,O=0|a[7],N=8191&O,P=O>>>13,M=0|a[8],B=8191&M,D=M>>>13,x=0|a[9],L=8191&x,U=x>>>13,j=0|s[0],F=8191&j,q=j>>>13,K=0|s[1],H=8191&K,G=K>>>13,z=0|s[2],V=8191&z,W=z>>>13,Q=0|s[3],Y=8191&Q,X=Q>>>13,J=0|s[4],Z=8191&J,ee=J>>>13,te=0|s[5],re=8191&te,ne=te>>>13,oe=0|s[6],ie=8191&oe,ae=oe>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,fe=le>>>13,he=0|s[9],pe=8191&he,ye=he>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(u+(n=Math.imul(d,F))|0)+((8191&(o=(o=Math.imul(d,q))+Math.imul(f,F)|0))<<13)|0;u=((i=Math.imul(f,q))+(o>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(p,F),o=(o=Math.imul(p,q))+Math.imul(y,F)|0,i=Math.imul(y,q);var ge=(u+(n=n+Math.imul(d,H)|0)|0)+((8191&(o=(o=o+Math.imul(d,G)|0)+Math.imul(f,H)|0))<<13)|0;u=((i=i+Math.imul(f,G)|0)+(o>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(g,F),o=(o=Math.imul(g,q))+Math.imul(b,F)|0,i=Math.imul(b,q),n=n+Math.imul(p,H)|0,o=(o=o+Math.imul(p,G)|0)+Math.imul(y,H)|0,i=i+Math.imul(y,G)|0;var be=(u+(n=n+Math.imul(d,V)|0)|0)+((8191&(o=(o=o+Math.imul(d,W)|0)+Math.imul(f,V)|0))<<13)|0;u=((i=i+Math.imul(f,W)|0)+(o>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(w,F),o=(o=Math.imul(w,q))+Math.imul(_,F)|0,i=Math.imul(_,q),n=n+Math.imul(g,H)|0,o=(o=o+Math.imul(g,G)|0)+Math.imul(b,H)|0,i=i+Math.imul(b,G)|0,n=n+Math.imul(p,V)|0,o=(o=o+Math.imul(p,W)|0)+Math.imul(y,V)|0,i=i+Math.imul(y,W)|0;var ve=(u+(n=n+Math.imul(d,Y)|0)|0)+((8191&(o=(o=o+Math.imul(d,X)|0)+Math.imul(f,Y)|0))<<13)|0;u=((i=i+Math.imul(f,X)|0)+(o>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(T,F),o=(o=Math.imul(T,q))+Math.imul(k,F)|0,i=Math.imul(k,q),n=n+Math.imul(w,H)|0,o=(o=o+Math.imul(w,G)|0)+Math.imul(_,H)|0,i=i+Math.imul(_,G)|0,n=n+Math.imul(g,V)|0,o=(o=o+Math.imul(g,W)|0)+Math.imul(b,V)|0,i=i+Math.imul(b,W)|0,n=n+Math.imul(p,Y)|0,o=(o=o+Math.imul(p,X)|0)+Math.imul(y,Y)|0,i=i+Math.imul(y,X)|0;var we=(u+(n=n+Math.imul(d,Z)|0)|0)+((8191&(o=(o=o+Math.imul(d,ee)|0)+Math.imul(f,Z)|0))<<13)|0;u=((i=i+Math.imul(f,ee)|0)+(o>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(S,F),o=(o=Math.imul(S,q))+Math.imul(A,F)|0,i=Math.imul(A,q),n=n+Math.imul(T,H)|0,o=(o=o+Math.imul(T,G)|0)+Math.imul(k,H)|0,i=i+Math.imul(k,G)|0,n=n+Math.imul(w,V)|0,o=(o=o+Math.imul(w,W)|0)+Math.imul(_,V)|0,i=i+Math.imul(_,W)|0,n=n+Math.imul(g,Y)|0,o=(o=o+Math.imul(g,X)|0)+Math.imul(b,Y)|0,i=i+Math.imul(b,X)|0,n=n+Math.imul(p,Z)|0,o=(o=o+Math.imul(p,ee)|0)+Math.imul(y,Z)|0,i=i+Math.imul(y,ee)|0;var _e=(u+(n=n+Math.imul(d,re)|0)|0)+((8191&(o=(o=o+Math.imul(d,ne)|0)+Math.imul(f,re)|0))<<13)|0;u=((i=i+Math.imul(f,ne)|0)+(o>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(C,F),o=(o=Math.imul(C,q))+Math.imul(R,F)|0,i=Math.imul(R,q),n=n+Math.imul(S,H)|0,o=(o=o+Math.imul(S,G)|0)+Math.imul(A,H)|0,i=i+Math.imul(A,G)|0,n=n+Math.imul(T,V)|0,o=(o=o+Math.imul(T,W)|0)+Math.imul(k,V)|0,i=i+Math.imul(k,W)|0,n=n+Math.imul(w,Y)|0,o=(o=o+Math.imul(w,X)|0)+Math.imul(_,Y)|0,i=i+Math.imul(_,X)|0,n=n+Math.imul(g,Z)|0,o=(o=o+Math.imul(g,ee)|0)+Math.imul(b,Z)|0,i=i+Math.imul(b,ee)|0,n=n+Math.imul(p,re)|0,o=(o=o+Math.imul(p,ne)|0)+Math.imul(y,re)|0,i=i+Math.imul(y,ne)|0;var Ie=(u+(n=n+Math.imul(d,ie)|0)|0)+((8191&(o=(o=o+Math.imul(d,ae)|0)+Math.imul(f,ie)|0))<<13)|0;u=((i=i+Math.imul(f,ae)|0)+(o>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(N,F),o=(o=Math.imul(N,q))+Math.imul(P,F)|0,i=Math.imul(P,q),n=n+Math.imul(C,H)|0,o=(o=o+Math.imul(C,G)|0)+Math.imul(R,H)|0,i=i+Math.imul(R,G)|0,n=n+Math.imul(S,V)|0,o=(o=o+Math.imul(S,W)|0)+Math.imul(A,V)|0,i=i+Math.imul(A,W)|0,n=n+Math.imul(T,Y)|0,o=(o=o+Math.imul(T,X)|0)+Math.imul(k,Y)|0,i=i+Math.imul(k,X)|0,n=n+Math.imul(w,Z)|0,o=(o=o+Math.imul(w,ee)|0)+Math.imul(_,Z)|0,i=i+Math.imul(_,ee)|0,n=n+Math.imul(g,re)|0,o=(o=o+Math.imul(g,ne)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,ne)|0,n=n+Math.imul(p,ie)|0,o=(o=o+Math.imul(p,ae)|0)+Math.imul(y,ie)|0,i=i+Math.imul(y,ae)|0;var Te=(u+(n=n+Math.imul(d,ce)|0)|0)+((8191&(o=(o=o+Math.imul(d,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((i=i+Math.imul(f,ue)|0)+(o>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(B,F),o=(o=Math.imul(B,q))+Math.imul(D,F)|0,i=Math.imul(D,q),n=n+Math.imul(N,H)|0,o=(o=o+Math.imul(N,G)|0)+Math.imul(P,H)|0,i=i+Math.imul(P,G)|0,n=n+Math.imul(C,V)|0,o=(o=o+Math.imul(C,W)|0)+Math.imul(R,V)|0,i=i+Math.imul(R,W)|0,n=n+Math.imul(S,Y)|0,o=(o=o+Math.imul(S,X)|0)+Math.imul(A,Y)|0,i=i+Math.imul(A,X)|0,n=n+Math.imul(T,Z)|0,o=(o=o+Math.imul(T,ee)|0)+Math.imul(k,Z)|0,i=i+Math.imul(k,ee)|0,n=n+Math.imul(w,re)|0,o=(o=o+Math.imul(w,ne)|0)+Math.imul(_,re)|0,i=i+Math.imul(_,ne)|0,n=n+Math.imul(g,ie)|0,o=(o=o+Math.imul(g,ae)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,ae)|0,n=n+Math.imul(p,ce)|0,o=(o=o+Math.imul(p,ue)|0)+Math.imul(y,ce)|0,i=i+Math.imul(y,ue)|0;var ke=(u+(n=n+Math.imul(d,de)|0)|0)+((8191&(o=(o=o+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;u=((i=i+Math.imul(f,fe)|0)+(o>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(L,F),o=(o=Math.imul(L,q))+Math.imul(U,F)|0,i=Math.imul(U,q),n=n+Math.imul(B,H)|0,o=(o=o+Math.imul(B,G)|0)+Math.imul(D,H)|0,i=i+Math.imul(D,G)|0,n=n+Math.imul(N,V)|0,o=(o=o+Math.imul(N,W)|0)+Math.imul(P,V)|0,i=i+Math.imul(P,W)|0,n=n+Math.imul(C,Y)|0,o=(o=o+Math.imul(C,X)|0)+Math.imul(R,Y)|0,i=i+Math.imul(R,X)|0,n=n+Math.imul(S,Z)|0,o=(o=o+Math.imul(S,ee)|0)+Math.imul(A,Z)|0,i=i+Math.imul(A,ee)|0,n=n+Math.imul(T,re)|0,o=(o=o+Math.imul(T,ne)|0)+Math.imul(k,re)|0,i=i+Math.imul(k,ne)|0,n=n+Math.imul(w,ie)|0,o=(o=o+Math.imul(w,ae)|0)+Math.imul(_,ie)|0,i=i+Math.imul(_,ae)|0,n=n+Math.imul(g,ce)|0,o=(o=o+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,n=n+Math.imul(p,de)|0,o=(o=o+Math.imul(p,fe)|0)+Math.imul(y,de)|0,i=i+Math.imul(y,fe)|0;var $e=(u+(n=n+Math.imul(d,pe)|0)|0)+((8191&(o=(o=o+Math.imul(d,ye)|0)+Math.imul(f,pe)|0))<<13)|0;u=((i=i+Math.imul(f,ye)|0)+(o>>>13)|0)+($e>>>26)|0,$e&=67108863,n=Math.imul(L,H),o=(o=Math.imul(L,G))+Math.imul(U,H)|0,i=Math.imul(U,G),n=n+Math.imul(B,V)|0,o=(o=o+Math.imul(B,W)|0)+Math.imul(D,V)|0,i=i+Math.imul(D,W)|0,n=n+Math.imul(N,Y)|0,o=(o=o+Math.imul(N,X)|0)+Math.imul(P,Y)|0,i=i+Math.imul(P,X)|0,n=n+Math.imul(C,Z)|0,o=(o=o+Math.imul(C,ee)|0)+Math.imul(R,Z)|0,i=i+Math.imul(R,ee)|0,n=n+Math.imul(S,re)|0,o=(o=o+Math.imul(S,ne)|0)+Math.imul(A,re)|0,i=i+Math.imul(A,ne)|0,n=n+Math.imul(T,ie)|0,o=(o=o+Math.imul(T,ae)|0)+Math.imul(k,ie)|0,i=i+Math.imul(k,ae)|0,n=n+Math.imul(w,ce)|0,o=(o=o+Math.imul(w,ue)|0)+Math.imul(_,ce)|0,i=i+Math.imul(_,ue)|0,n=n+Math.imul(g,de)|0,o=(o=o+Math.imul(g,fe)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,fe)|0;var Se=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(o=(o=o+Math.imul(p,ye)|0)+Math.imul(y,pe)|0))<<13)|0;u=((i=i+Math.imul(y,ye)|0)+(o>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(L,V),o=(o=Math.imul(L,W))+Math.imul(U,V)|0,i=Math.imul(U,W),n=n+Math.imul(B,Y)|0,o=(o=o+Math.imul(B,X)|0)+Math.imul(D,Y)|0,i=i+Math.imul(D,X)|0,n=n+Math.imul(N,Z)|0,o=(o=o+Math.imul(N,ee)|0)+Math.imul(P,Z)|0,i=i+Math.imul(P,ee)|0,n=n+Math.imul(C,re)|0,o=(o=o+Math.imul(C,ne)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,ne)|0,n=n+Math.imul(S,ie)|0,o=(o=o+Math.imul(S,ae)|0)+Math.imul(A,ie)|0,i=i+Math.imul(A,ae)|0,n=n+Math.imul(T,ce)|0,o=(o=o+Math.imul(T,ue)|0)+Math.imul(k,ce)|0,i=i+Math.imul(k,ue)|0,n=n+Math.imul(w,de)|0,o=(o=o+Math.imul(w,fe)|0)+Math.imul(_,de)|0,i=i+Math.imul(_,fe)|0;var Ae=(u+(n=n+Math.imul(g,pe)|0)|0)+((8191&(o=(o=o+Math.imul(g,ye)|0)+Math.imul(b,pe)|0))<<13)|0;u=((i=i+Math.imul(b,ye)|0)+(o>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(L,Y),o=(o=Math.imul(L,X))+Math.imul(U,Y)|0,i=Math.imul(U,X),n=n+Math.imul(B,Z)|0,o=(o=o+Math.imul(B,ee)|0)+Math.imul(D,Z)|0,i=i+Math.imul(D,ee)|0,n=n+Math.imul(N,re)|0,o=(o=o+Math.imul(N,ne)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,ne)|0,n=n+Math.imul(C,ie)|0,o=(o=o+Math.imul(C,ae)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,ae)|0,n=n+Math.imul(S,ce)|0,o=(o=o+Math.imul(S,ue)|0)+Math.imul(A,ce)|0,i=i+Math.imul(A,ue)|0,n=n+Math.imul(T,de)|0,o=(o=o+Math.imul(T,fe)|0)+Math.imul(k,de)|0,i=i+Math.imul(k,fe)|0;var Ee=(u+(n=n+Math.imul(w,pe)|0)|0)+((8191&(o=(o=o+Math.imul(w,ye)|0)+Math.imul(_,pe)|0))<<13)|0;u=((i=i+Math.imul(_,ye)|0)+(o>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(L,Z),o=(o=Math.imul(L,ee))+Math.imul(U,Z)|0,i=Math.imul(U,ee),n=n+Math.imul(B,re)|0,o=(o=o+Math.imul(B,ne)|0)+Math.imul(D,re)|0,i=i+Math.imul(D,ne)|0,n=n+Math.imul(N,ie)|0,o=(o=o+Math.imul(N,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,n=n+Math.imul(C,ce)|0,o=(o=o+Math.imul(C,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,n=n+Math.imul(S,de)|0,o=(o=o+Math.imul(S,fe)|0)+Math.imul(A,de)|0,i=i+Math.imul(A,fe)|0;var Ce=(u+(n=n+Math.imul(T,pe)|0)|0)+((8191&(o=(o=o+Math.imul(T,ye)|0)+Math.imul(k,pe)|0))<<13)|0;u=((i=i+Math.imul(k,ye)|0)+(o>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(L,re),o=(o=Math.imul(L,ne))+Math.imul(U,re)|0,i=Math.imul(U,ne),n=n+Math.imul(B,ie)|0,o=(o=o+Math.imul(B,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,n=n+Math.imul(N,ce)|0,o=(o=o+Math.imul(N,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,n=n+Math.imul(C,de)|0,o=(o=o+Math.imul(C,fe)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,fe)|0;var Re=(u+(n=n+Math.imul(S,pe)|0)|0)+((8191&(o=(o=o+Math.imul(S,ye)|0)+Math.imul(A,pe)|0))<<13)|0;u=((i=i+Math.imul(A,ye)|0)+(o>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(L,ie),o=(o=Math.imul(L,ae))+Math.imul(U,ie)|0,i=Math.imul(U,ae),n=n+Math.imul(B,ce)|0,o=(o=o+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,n=n+Math.imul(N,de)|0,o=(o=o+Math.imul(N,fe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,fe)|0;var Oe=(u+(n=n+Math.imul(C,pe)|0)|0)+((8191&(o=(o=o+Math.imul(C,ye)|0)+Math.imul(R,pe)|0))<<13)|0;u=((i=i+Math.imul(R,ye)|0)+(o>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(L,ce),o=(o=Math.imul(L,ue))+Math.imul(U,ce)|0,i=Math.imul(U,ue),n=n+Math.imul(B,de)|0,o=(o=o+Math.imul(B,fe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,fe)|0;var Ne=(u+(n=n+Math.imul(N,pe)|0)|0)+((8191&(o=(o=o+Math.imul(N,ye)|0)+Math.imul(P,pe)|0))<<13)|0;u=((i=i+Math.imul(P,ye)|0)+(o>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(L,de),o=(o=Math.imul(L,fe))+Math.imul(U,de)|0,i=Math.imul(U,fe);var Pe=(u+(n=n+Math.imul(B,pe)|0)|0)+((8191&(o=(o=o+Math.imul(B,ye)|0)+Math.imul(D,pe)|0))<<13)|0;u=((i=i+Math.imul(D,ye)|0)+(o>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Me=(u+(n=Math.imul(L,pe))|0)+((8191&(o=(o=Math.imul(L,ye))+Math.imul(U,pe)|0))<<13)|0;return u=((i=Math.imul(U,ye))+(o>>>13)|0)+(Me>>>26)|0,Me&=67108863,c[0]=me,c[1]=ge,c[2]=be,c[3]=ve,c[4]=we,c[5]=_e,c[6]=Ie,c[7]=Te,c[8]=ke,c[9]=$e,c[10]=Se,c[11]=Ae,c[12]=Ee,c[13]=Ce,c[14]=Re,c[15]=Oe,c[16]=Ne,c[17]=Pe,c[18]=Me,0!==u&&(c[19]=u,r.length++),r};function p(e,t,r){return(new y).mulp(e,t,r)}function y(e,t){this.x=e,this.y=t}Math.imul||(h=f),o.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):n<63?f(this,e,t):n<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,o=0,i=0;i<r.length-1;i++){var a=o;o=0;for(var s=67108863&n,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),f=67108863&d;s=67108863&(f=f+s|0),o+=(a=(a=a+(d/67108864|0)|0)+(f>>>26)|0)>>>26,a&=67108863}r.words[i]=s,n=a,a=o}return 0!==n?r.words[i]=n:r.length--,r.strip()}(this,e,t):p(this,e,t),r},y.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},y.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,o=0;o<t;o++)n|=(1&e)<<t-o-1,e>>=1;return n},y.prototype.permute=function(e,t,r,n,o,i){for(var a=0;a<i;a++)n[a]=t[e[a]],o[a]=r[e[a]]},y.prototype.transform=function(e,t,r,n,o,i){this.permute(i,e,t,r,n,o);for(var a=1;a<o;a<<=1)for(var s=a<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),l=0;l<o;l+=s)for(var d=c,f=u,h=0;h<a;h++){var p=r[l+h],y=n[l+h],m=r[l+h+a],g=n[l+h+a],b=d*m-f*g;g=d*g+f*m,m=b,r[l+h]=p+m,n[l+h]=y+g,r[l+h+a]=p-m,n[l+h+a]=y-g,h!==s&&(b=c*d-u*f,f=c*f+u*d,d=b)}},y.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),n=1&r,o=0;for(r=r/2|0;r;r>>>=1)o++;return 1<<o+1+n},y.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var o=e[n];e[n]=e[r-n-1],e[r-n-1]=o,o=t[n],t[n]=-t[r-n-1],t[r-n-1]=-o}},y.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var o=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=67108863&o,r=o<67108864?0:o/67108864|0}return e},y.prototype.convert13b=function(e,t,n,o){for(var i=0,a=0;a<t;a++)i+=0|e[a],n[2*a]=8191&i,i>>>=13,n[2*a+1]=8191&i,i>>>=13;for(a=2*t;a<o;++a)n[a]=0;r(0===i),r(!(-8192&i))},y.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},y.prototype.mulp=function(e,t,r){var n=2*this.guessLen13b(e.length,t.length),o=this.makeRBT(n),i=this.stub(n),a=new Array(n),s=new Array(n),c=new Array(n),u=new Array(n),l=new Array(n),d=new Array(n),f=r.words;f.length=n,this.convert13b(e.words,e.length,a,n),this.convert13b(t.words,t.length,u,n),this.transform(a,i,s,c,n,o),this.transform(u,i,l,d,n,o);for(var h=0;h<n;h++){var p=s[h]*l[h]-c[h]*d[h];c[h]=s[h]*d[h]+c[h]*l[h],s[h]=p}return this.conjugate(s,c,n),this.transform(s,c,f,i,n,o),this.conjugate(f,i,n),this.normalize13b(f,n),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),p(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,n=0;n<this.length;n++){var o=(0|this.words[n])*e,i=(67108863&o)+(67108863&t);t>>=26,t+=o/67108864|0,t+=i>>>26,this.words[n]=67108863&i}return 0!==t&&(this.words[n]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,o=r%26;t[r]=(e.words[n]&1<<o)>>>o}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var i=r.sqr();n<t.length;n++,i=i.sqr())0!==t[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,o=(e-n)/26,i=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<n;this.words[t]=c|a,a=s>>>26-n}a&&(this.words[t]=a,this.length++)}if(0!==o){for(t=this.length-1;t>=0;t--)this.words[t+o]=this.words[t];for(t=0;t<o;t++)this.words[t]=0;this.length+=o}return this.strip()},o.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,n){var o;r("number"==typeof e&&e>=0),o=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=n;if(o-=a,o=Math.max(0,o),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=o);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,o=1<<t;return!(this.length<=n)&&!!(this.words[n]&o)},o.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var o=67108863^67108863>>>t<<t;this.words[this.length-1]&=o}return this.strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,n){var o,i,a=e.length+n;this._expand(a);var s=0;for(o=0;o<e.length;o++){i=(0|this.words[o+n])+s;var c=(0|e.words[o])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[o+n]=67108863&i}for(;o<this.length-n;o++)s=(i=(0|this.words[o+n])+s)>>26,this.words[o+n]=67108863&i;if(0===s)return this.strip();for(r(-1===s),s=0,o=0;o<this.length;o++)s=(i=-(0|this.words[o])+s)>>26,this.words[o]=67108863&i;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,c=n.length-i.length;if("mod"!==t){(s=new o(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=n.clone()._ishlnsubmul(i,1,c);0===l.negative&&(n=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var f=67108864*(0|n.words[i.length+d])+(0|n.words[i.length+d-1]);for(f=Math.min(f/a|0,67108863),n._ishlnsubmul(i,f,d);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,d),n.isZero()||(n.negative^=1);s&&(s.words[d]=f)}return s&&s.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),o=e.andln(1),i=r.cmp(n);return i<0||1===o&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,o=this.length-1;o>=0;o--)n=(t*n+(0|this.words[o]))%e;return n},o.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*t;this.words[n]=o/e|0,t=o%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),a=new o(0),s=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;!(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var p=0,y=1;!(n.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(s),a.isub(c)):(n.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new o(1),s=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,f=1;!(n.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(n.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s)):(n.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var o=t.cmp(r);if(o<0){var i=t;t=r,r=i}else if(0===o||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,o=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=o,this;for(var i=o,a=n;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var o=0|this.words[0];t=o===e?0:o<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],o=0|e.words[r];if(n!==o){n<o?t=-1:n>o&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new I(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function T(e){I.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},n(b,g),b.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),o=0;o<n;o++)t.words[o]=e.words[o];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,o=10;o<e.length;o++){var a=0|e.words[o];e.words[o-10]=(a&r)<<4|i>>>22,i=a}i>>>=22,e.words[o-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(v,g),n(w,g),n(_,g),_.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,o=67108863&n;n>>>=26,e.words[r]=o,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(m[e])return m[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return m[e]=t,t},I.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},I.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},I.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},I.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},I.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},I.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},I.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},I.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},I.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},I.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},I.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},I.prototype.isqr=function(e){return this.imul(e,e.clone())},I.prototype.sqr=function(e){return this.mul(e,e)},I.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),f=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=a;0!==h.cmp(s);){for(var y=h,m=0;0!==y.cmp(s);m++)y=y.redSqr();r(m<p);var g=this.pow(d,new o(1).iushln(p-m-1));f=f.redMul(g),d=g.redSqr(),h=h.redMul(d),p=m}return f},I.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},I.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var i=r[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),n=t.length-1;n>=0;n--){for(var u=t.words[n],l=c-1;l>=0;l--){var d=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4===++s||0===n&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}c=26}return i},I.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},I.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new T(e)},n(T,I),T.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},T.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},T.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),i=o;return o.cmp(this.m)>=0?i=o.isub(this.m):o.cmpn(0)<0&&(i=o.iadd(this.m)),i._forceRed(this)},T.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},T.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,commonjsGlobal)}(bn$2);var bnExports=bn$2.exports;!function(e){var t=e,r=bnExports,n=minimalisticAssert$1,o=utils$O;t.assert=n,t.toArray=o.toArray,t.zero2=o.zero2,t.toHex=o.toHex,t.encode=o.encode,t.getNAF=function(e,t,r){var n,o=new Array(Math.max(e.bitLength(),r)+1);for(n=0;n<o.length;n+=1)o[n]=0;var i=1<<t+1,a=e.clone();for(n=0;n<o.length;n++){var s,c=a.andln(i-1);a.isOdd()?(s=c>(i>>1)-1?(i>>1)-c:c,a.isubn(s)):s=0,o[n]=s,a.iushrn(1)}return o},t.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,o=0,i=0;e.cmpn(-o)>0||t.cmpn(-i)>0;){var a,s,c=e.andln(3)+o&3,u=t.andln(3)+i&3;3===c&&(c=-1),3===u&&(u=-1),a=1&c?3!==(n=e.andln(7)+o&7)&&5!==n||2!==u?c:-c:0,r[0].push(a),s=1&u?3!==(n=t.andln(7)+i&7)&&5!==n||2!==c?u:-u:0,r[1].push(s),2*o===a+1&&(o=1-o),2*i===s+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r},t.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},t.parseBytes=function(e){return"string"==typeof e?t.toArray(e,"hex"):e},t.intFromLE=function(e){return new r(e,"hex","le")}}(utils$e);var curve={},BN$7=bnExports,utils$d=utils$e,getNAF=utils$d.getNAF,getJSF=utils$d.getJSF,assert$8=utils$d.assert;function BaseCurve(e,t){this.type=e,this.p=new BN$7(t.p,16),this.red=t.prime?BN$7.red(t.prime):BN$7.mont(this.p),this.zero=new BN$7(0).toRed(this.red),this.one=new BN$7(1).toRed(this.red),this.two=new BN$7(2).toRed(this.red),this.n=t.n&&new BN$7(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base=BaseCurve;function BasePoint(e,t){this.curve=e,this.type=t,this.precomputed=null}BaseCurve.prototype.point=function(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function(e,t){assert$8(e.precomputed);var r=e._getDoubles(),n=getNAF(t,1,this._bitLength),o=(1<<r.step+1)-(r.step%2==0?2:1);o/=3;var i,a,s=[];for(i=0;i<n.length;i+=r.step){a=0;for(var c=i+r.step-1;c>=i;c--)a=(a<<1)+n[c];s.push(a)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=o;d>0;d--){for(i=0;i<s.length;i++)(a=s[i])===d?l=l.mixedAdd(r.points[i]):a===-d&&(l=l.mixedAdd(r.points[i].neg()));u=u.add(l)}return u.toP()},BaseCurve.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var o=n.points,i=getNAF(t,r,this._bitLength),a=this.jpoint(null,null,null),s=i.length-1;s>=0;s--){for(var c=0;s>=0&&0===i[s];s--)c++;if(s>=0&&c++,a=a.dblp(c),s<0)break;var u=i[s];assert$8(0!==u),a="affine"===e.type?u>0?a.mixedAdd(o[u-1>>1]):a.mixedAdd(o[-u-1>>1].neg()):u>0?a.add(o[u-1>>1]):a.add(o[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},BaseCurve.prototype._wnafMulAdd=function(e,t,r,n,o){var i,a,s,c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,d=0;for(i=0;i<n;i++){var f=(s=t[i])._getNAFPoints(e);c[i]=f.wnd,u[i]=f.points}for(i=n-1;i>=1;i-=2){var h=i-1,p=i;if(1===c[h]&&1===c[p]){var y=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(y[1]=t[h].add(t[p]),y[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(y[1]=t[h].toJ().mixedAdd(t[p]),y[2]=t[h].add(t[p].neg())):(y[1]=t[h].toJ().mixedAdd(t[p]),y[2]=t[h].toJ().mixedAdd(t[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=getJSF(r[h],r[p]);for(d=Math.max(g[0].length,d),l[h]=new Array(d),l[p]=new Array(d),a=0;a<d;a++){var b=0|g[0][a],v=0|g[1][a];l[h][a]=m[3*(b+1)+(v+1)],l[p][a]=0,u[h]=y}}else l[h]=getNAF(r[h],c[h],this._bitLength),l[p]=getNAF(r[p],c[p],this._bitLength),d=Math.max(l[h].length,d),d=Math.max(l[p].length,d)}var w=this.jpoint(null,null,null),_=this._wnafT4;for(i=d;i>=0;i--){for(var I=0;i>=0;){var T=!0;for(a=0;a<n;a++)_[a]=0|l[a][i],0!==_[a]&&(T=!1);if(!T)break;I++,i--}if(i>=0&&I++,w=w.dblp(I),i<0)break;for(a=0;a<n;a++){var k=_[a];0!==k&&(k>0?s=u[a][k-1>>1]:k<0&&(s=u[a][-k-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(i=0;i<n;i++)u[i]=null;return o?w:w.toP()},BaseCurve.BasePoint=BasePoint,BasePoint.prototype.eq=function(){throw new Error("Not implemented")},BasePoint.prototype.validate=function(){return this.curve.validate(this)},BaseCurve.prototype.decodePoint=function(e,t){e=utils$d.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?assert$8(e[e.length-1]%2==0):7===e[0]&&assert$8(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},BasePoint.prototype.encodeCompressed=function(e){return this.encode(e,!0)},BasePoint.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},BasePoint.prototype.encode=function(e,t){return utils$d.encode(this._encode(t),e)},BasePoint.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},BasePoint.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},BasePoint.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,o=0;o<t;o+=e){for(var i=0;i<e;i++)n=n.dbl();r.push(n)}return{step:e,points:r}},BasePoint.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),o=1;o<r;o++)t[o]=t[o-1].add(n);return{wnd:e,points:t}},BasePoint.prototype._getBeta=function(){return null},BasePoint.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var utils$c=utils$e,BN$6=bnExports,inherits$2=inherits_browserExports,Base$2=base,assert$7=utils$c.assert;function ShortCurve(e){Base$2.call(this,"short",e),this.a=new BN$6(e.a,16).toRed(this.red),this.b=new BN$6(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}inherits$2(ShortCurve,Base$2);var short=ShortCurve;function Point$2(e,t,r,n){Base$2.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new BN$6(t,16),this.y=new BN$6(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function JPoint(e,t,r,n){Base$2.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$6(0)):(this.x=new BN$6(t,16),this.y=new BN$6(r,16),this.z=new BN$6(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}ShortCurve.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new BN$6(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new BN$6(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],assert$7(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new BN$6(e.a,16),b:new BN$6(e.b,16)}})):this._getEndoBasis(r)}}},ShortCurve.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:BN$6.mont(e),r=new BN$6(2).toRed(t).redInvm(),n=r.redNeg(),o=new BN$6(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},ShortCurve.prototype._getEndoBasis=function(e){for(var t,r,n,o,i,a,s,c,u,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,f=this.n.clone(),h=new BN$6(1),p=new BN$6(0),y=new BN$6(0),m=new BN$6(1),g=0;0!==d.cmpn(0);){var b=f.div(d);c=f.sub(b.mul(d)),u=y.sub(b.mul(h));var v=m.sub(b.mul(p));if(!n&&c.cmp(l)<0)t=s.neg(),r=h,n=c.neg(),o=u;else if(n&&2==++g)break;s=c,f=d,d=c,y=h,h=u,m=p,p=v}i=c.neg(),a=u;var w=n.sqr().add(o.sqr());return i.sqr().add(a.sqr()).cmp(w)>=0&&(i=t,a=r),n.negative&&(n=n.neg(),o=o.neg()),i.negative&&(i=i.neg(),a=a.neg()),[{a:n,b:o},{a:i,b:a}]},ShortCurve.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],o=n.b.mul(e).divRound(this.n),i=r.b.neg().mul(e).divRound(this.n),a=o.mul(r.a),s=i.mul(n.a),c=o.mul(r.b),u=i.mul(n.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},ShortCurve.prototype.pointFromX=function(e,t){(e=new BN$6(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(t&&!o||!t&&o)&&(n=n.redNeg()),this.point(e,n)},ShortCurve.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(o).cmpn(0)},ShortCurve.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,o=this._endoWnafT2,i=0;i<e.length;i++){var a=this._endoSplit(t[i]),s=e[i],c=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),c=c.neg(!0)),n[2*i]=s,n[2*i+1]=c,o[2*i]=a.k1,o[2*i+1]=a.k2}for(var u=this._wnafMulAdd(1,n,o,2*i,r),l=0;l<2*i;l++)n[l]=null,o[l]=null;return u},inherits$2(Point$2,Base$2.BasePoint),ShortCurve.prototype.point=function(e,t,r){return new Point$2(this,e,t,r)},ShortCurve.prototype.pointFromJSON=function(e,t){return Point$2.fromJSON(this,e,t)},Point$2.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Point$2.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Point$2.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function o(t){return e.point(t[0],t[1],r)}var i=t[2];return n.precomputed={beta:null,doubles:i.doubles&&{step:i.doubles.step,points:[n].concat(i.doubles.points.map(o))},naf:i.naf&&{wnd:i.naf.wnd,points:[n].concat(i.naf.points.map(o))}},n},Point$2.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Point$2.prototype.isInfinity=function(){return this.inf},Point$2.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Point$2.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),o=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),i=o.redSqr().redISub(this.x.redAdd(this.x)),a=o.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,a)},Point$2.prototype.getX=function(){return this.x.fromRed()},Point$2.prototype.getY=function(){return this.y.fromRed()},Point$2.prototype.mul=function(e){return e=new BN$6(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Point$2.prototype.mulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o):this.curve._wnafMulAdd(1,n,o,2)},Point$2.prototype.jmulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o,!0):this.curve._wnafMulAdd(1,n,o,2,!0)},Point$2.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},Point$2.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},Point$2.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},inherits$2(JPoint,Base$2.BasePoint),ShortCurve.prototype.jpoint=function(e,t,r){return new JPoint(this,e,t,r)},JPoint.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},JPoint.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),o=e.x.redMul(r),i=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(o),c=i.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),d=n.redMul(u),f=c.redSqr().redIAdd(l).redISub(d).redISub(d),h=c.redMul(d.redISub(f)).redISub(i.redMul(l)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(f,h,p)},JPoint.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),o=this.y,i=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=o.redSub(i);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),l=r.redMul(c),d=s.redSqr().redIAdd(u).redISub(l).redISub(l),f=s.redMul(l.redISub(d)).redISub(o.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(d,f,h)},JPoint.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var n=this.curve.a,o=this.curve.tinv,i=this.x,a=this.y,s=this.z,c=s.redSqr().redSqr(),u=a.redAdd(a);for(t=0;t<e;t++){var l=i.redSqr(),d=u.redSqr(),f=d.redSqr(),h=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(c)),p=i.redMul(d),y=h.redSqr().redISub(p.redAdd(p)),m=p.redISub(y),g=h.redMul(m);g=g.redIAdd(g).redISub(f);var b=u.redMul(s);t+1<e&&(c=c.redMul(f)),i=y,s=b,u=g}return this.curve.jpoint(i,u.redMul(o),s)},JPoint.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},JPoint.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),i=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(n).redISub(i);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n),c=s.redSqr().redISub(a).redISub(a),u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),e=c,t=s.redMul(a.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),d=this.y.redSqr(),f=d.redSqr(),h=this.x.redAdd(d).redSqr().redISub(l).redISub(f);h=h.redIAdd(h);var p=l.redAdd(l).redIAdd(l),y=p.redSqr(),m=f.redIAdd(f);m=(m=m.redIAdd(m)).redIAdd(m),e=y.redISub(h).redISub(h),t=p.redMul(h.redISub(e)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},JPoint.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),i=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(n).redISub(i);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),c=s.redSqr().redISub(a).redISub(a);e=c;var u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),t=s.redMul(a.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),d=this.y.redSqr(),f=this.x.redMul(d),h=this.x.redSub(l).redMul(this.x.redAdd(l));h=h.redAdd(h).redIAdd(h);var p=f.redIAdd(f),y=(p=p.redIAdd(p)).redAdd(p);e=h.redSqr().redISub(y),r=this.y.redAdd(this.z).redSqr().redISub(d).redISub(l);var m=d.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),t=h.redMul(p.redISub(e)).redISub(m)}return this.curve.jpoint(e,t,r)},JPoint.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,o=n.redSqr().redSqr(),i=t.redSqr(),a=r.redSqr(),s=i.redAdd(i).redIAdd(i).redIAdd(e.redMul(o)),c=t.redAdd(t),u=(c=c.redIAdd(c)).redMul(a),l=s.redSqr().redISub(u.redAdd(u)),d=u.redISub(l),f=a.redSqr();f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var h=s.redMul(d).redISub(f),p=r.redAdd(r).redMul(n);return this.curve.jpoint(l,h,p)},JPoint.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),o=e.redAdd(e).redIAdd(e),i=o.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).redISub(n),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(i)).redSqr(),c=n.redIAdd(n);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var u=o.redIAdd(a).redSqr().redISub(i).redISub(s).redISub(c),l=t.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var d=this.x.redMul(s).redISub(l);d=(d=d.redIAdd(d)).redIAdd(d);var f=this.y.redMul(u.redMul(c.redISub(u)).redISub(a.redMul(s)));f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var h=this.z.redAdd(a).redSqr().redISub(r).redISub(s);return this.curve.jpoint(d,f,h)},JPoint.prototype.mul=function(e,t){return e=new BN$6(e,t),this.curve._wnafMul(this,e)},JPoint.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),o=r.redMul(e.z);return 0===this.y.redMul(o).redISub(e.y.redMul(n)).cmpn(0)},JPoint.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),o=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(o),0===this.x.cmp(r))return!0}},JPoint.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},JPoint.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var BN$5=bnExports,inherits$1=inherits_browserExports,Base$1=base,utils$b=utils$e;function MontCurve(e){Base$1.call(this,"mont",e),this.a=new BN$5(e.a,16).toRed(this.red),this.b=new BN$5(e.b,16).toRed(this.red),this.i4=new BN$5(4).toRed(this.red).redInvm(),this.two=new BN$5(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits$1(MontCurve,Base$1);var mont=MontCurve;function Point$1(e,t,r){Base$1.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN$5(t,16),this.z=new BN$5(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}MontCurve.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},inherits$1(Point$1,Base$1.BasePoint),MontCurve.prototype.decodePoint=function(e,t){return this.point(utils$b.toArray(e,t),1)},MontCurve.prototype.point=function(e,t){return new Point$1(this,e,t)},MontCurve.prototype.pointFromJSON=function(e){return Point$1.fromJSON(this,e)},Point$1.prototype.precompute=function(){},Point$1.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Point$1.fromJSON=function(e,t){return new Point$1(e,t[0],t[1]||e.one)},Point$1.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Point$1.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Point$1.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),o=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,o)},Point$1.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Point$1.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),o=e.x.redAdd(e.z),i=e.x.redSub(e.z).redMul(r),a=o.redMul(n),s=t.z.redMul(i.redAdd(a).redSqr()),c=t.x.redMul(i.redISub(a).redSqr());return this.curve.point(s,c)},Point$1.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),o=[];0!==t.cmpn(0);t.iushrn(1))o.push(t.andln(1));for(var i=o.length-1;i>=0;i--)0===o[i]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},Point$1.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Point$1.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Point$1.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},Point$1.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Point$1.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var utils$a=utils$e,BN$4=bnExports,inherits=inherits_browserExports,Base=base,assert$6=utils$a.assert;function EdwardsCurve(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,Base.call(this,"edwards",e),this.a=new BN$4(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN$4(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN$4(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert$6(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}inherits(EdwardsCurve,Base);var edwards=EdwardsCurve;function Point(e,t,r,n,o){Base.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new BN$4(t,16),this.y=new BN$4(r,16),this.z=n?new BN$4(n,16):this.curve.one,this.t=o&&new BN$4(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}EdwardsCurve.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},EdwardsCurve.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},EdwardsCurve.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},EdwardsCurve.prototype.pointFromX=function(e,t){(e=new BN$4(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),i=n.redMul(o.redInvm()),a=i.redSqrt();if(0!==a.redSqr().redSub(i).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(t&&!s||!t&&s)&&(a=a.redNeg()),this.point(e,a)},EdwardsCurve.prototype.pointFromY=function(e,t){(e=new BN$4(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),i=n.redMul(o.redInvm());if(0===i.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=i.redSqrt();if(0!==a.redSqr().redSub(i).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},EdwardsCurve.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),o=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(o)},inherits(Point,Base.BasePoint),EdwardsCurve.prototype.pointFromJSON=function(e){return Point.fromJSON(this,e)},EdwardsCurve.prototype.point=function(e,t,r,n){return new Point(this,e,t,r,n)},Point.fromJSON=function(e,t){return new Point(e,t[0],t[1],t[2])},Point.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Point.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},Point.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),o=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),i=n.redAdd(t),a=i.redSub(r),s=n.redSub(t),c=o.redMul(a),u=i.redMul(s),l=o.redMul(s),d=a.redMul(i);return this.curve.point(c,u,d,l)},Point.prototype._projDbl=function(){var e,t,r,n,o,i,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(s)).redAdd(c);this.zOne?(e=a.redSub(s).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(n.redSub(c)),r=u.redSqr().redSub(u).redSub(u)):(o=this.z.redSqr(),i=u.redSub(o).redISub(o),e=a.redSub(s).redISub(c).redMul(i),t=u.redMul(n.redSub(c)),r=u.redMul(i))}else n=s.redAdd(c),o=this.curve._mulC(this.z).redSqr(),i=n.redSub(o).redSub(o),e=this.curve._mulC(a.redISub(n)).redMul(i),t=this.curve._mulC(n).redMul(s.redISub(c)),r=n.redMul(i);return this.curve.point(e,t,r)},Point.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Point.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),o=this.z.redMul(e.z.redAdd(e.z)),i=r.redSub(t),a=o.redSub(n),s=o.redAdd(n),c=r.redAdd(t),u=i.redMul(a),l=s.redMul(c),d=i.redMul(c),f=a.redMul(s);return this.curve.point(u,l,f,d)},Point.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),o=n.redSqr(),i=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(i).redMul(a),c=o.redSub(s),u=o.redAdd(s),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(a),d=n.redMul(c).redMul(l);return this.curve.twisted?(t=n.redMul(u).redMul(a.redSub(this.curve._mulA(i))),r=c.redMul(u)):(t=n.redMul(u).redMul(a.redSub(i)),r=this.curve._mulC(c).redMul(u)),this.curve.point(d,t,r)},Point.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Point.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Point.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},Point.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},Point.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Point.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Point.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Point.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},Point.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},Point.prototype.toP=Point.prototype.normalize,Point.prototype.mixedAdd=Point.prototype.add,function(e){var t=e;t.base=base,t.short=short,t.mont=mont,t.edwards=edwards}(curve);var curves$2={},secp256k1,hasRequiredSecp256k1;function requireSecp256k1(){return hasRequiredSecp256k1?secp256k1:(hasRequiredSecp256k1=1,secp256k1={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}})}!function(e){var t,r=e,n=hash$8,o=curve,i=utils$e.assert;function a(e){"short"===e.type?this.curve=new o.short(e):"edwards"===e.type?this.curve=new o.edwards(e):this.curve=new o.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var n=new a(t);return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=a,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:n.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:n.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:n.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:n.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:n.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:n.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:n.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{t=requireSecp256k1()}catch(e2){t=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:n.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",t]})}(curves$2);var BN$3=bnExports,utils$9=utils$e,assert$5=utils$9.assert;function KeyPair$3(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var key$1=KeyPair$3;KeyPair$3.fromPublic=function(e,t,r){return t instanceof KeyPair$3?t:new KeyPair$3(e,{pub:t,pubEnc:r})},KeyPair$3.fromPrivate=function(e,t,r){return t instanceof KeyPair$3?t:new KeyPair$3(e,{priv:t,privEnc:r})},KeyPair$3.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},KeyPair$3.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},KeyPair$3.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},KeyPair$3.prototype._importPrivate=function(e,t){this.priv=new BN$3(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},KeyPair$3.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?assert$5(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||assert$5(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},KeyPair$3.prototype.derive=function(e){return e.validate()||assert$5(e.validate(),"public point not validated"),e.mul(this.priv).getX()},KeyPair$3.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},KeyPair$3.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},KeyPair$3.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var BN$2=bnExports,utils$8=utils$e,assert$4=utils$8.assert;function Signature$3(e,t){if(e instanceof Signature$3)return e;this._importDER(e,t)||(assert$4(e.r&&e.s,"Signature without r or s"),this.r=new BN$2(e.r,16),this.s=new BN$2(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var signature$1=Signature$3;function Position(){this.place=0}function getLength(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;if(0===e[t.place])return!1;for(var o=0,i=0,a=t.place;i<n;i++,a++)o<<=8,o|=e[a],o>>>=0;return!(o<=127)&&(t.place=a,o)}function rmPadding(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function constructLength(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}Signature$3.prototype._importDER=function(e,t){e=utils$8.toArray(e,t);var r=new Position;if(48!==e[r.place++])return!1;var n=getLength(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var o=getLength(e,r);if(!1===o)return!1;if(128&e[r.place])return!1;var i=e.slice(r.place,o+r.place);if(r.place+=o,2!==e[r.place++])return!1;var a=getLength(e,r);if(!1===a)return!1;if(e.length!==a+r.place)return!1;if(128&e[r.place])return!1;var s=e.slice(r.place,a+r.place);if(0===i[0]){if(!(128&i[1]))return!1;i=i.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new BN$2(i),this.s=new BN$2(s),this.recoveryParam=null,!0},Signature$3.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=rmPadding(t),r=rmPadding(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];constructLength(n,t.length),(n=n.concat(t)).push(2),constructLength(n,r.length);var o=n.concat(r),i=[48];return constructLength(i,o.length),i=i.concat(o),utils$8.encode(i,e)};var BN$1=bnExports,HmacDRBG=hmacDrbg$1,utils$7=utils$e,curves$1=curves$2,rand=requireBrorand(),assert$3=utils$7.assert,KeyPair$2=key$1,Signature$2=signature$1;function EC(e){if(!(this instanceof EC))return new EC(e);"string"==typeof e&&(assert$3(Object.prototype.hasOwnProperty.call(curves$1,e),"Unknown curve "+e),e=curves$1[e]),e instanceof curves$1.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var ec=EC;EC.prototype.keyPair=function(e){return new KeyPair$2(this,e)},EC.prototype.keyFromPrivate=function(e,t){return KeyPair$2.fromPrivate(this,e,t)},EC.prototype.keyFromPublic=function(e,t){return KeyPair$2.fromPublic(this,e,t)},EC.prototype.genKeyPair=function(e){e||(e={});for(var t=new HmacDRBG({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||rand(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new BN$1(2));;){var o=new BN$1(t.generate(r));if(!(o.cmp(n)>0))return o.iaddn(1),this.keyFromPrivate(o)}},EC.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},EC.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new BN$1(e,16));for(var o=this.n.byteLength(),i=t.getPrivate().toArray("be",o),a=e.toArray("be",o),s=new HmacDRBG({hash:this.hash,entropy:i,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(new BN$1(1)),u=0;;u++){var l=n.k?n.k(u):new BN$1(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(c)>=0)){var d=this.g.mul(l);if(!d.isInfinity()){var f=d.getX(),h=f.umod(this.n);if(0!==h.cmpn(0)){var p=l.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var y=(d.getY().isOdd()?1:0)|(0!==f.cmp(h)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),y^=1),new Signature$2({r:h,s:p,recoveryParam:y})}}}}}},EC.prototype.verify=function(e,t,r,n){e=this._truncateToN(new BN$1(e,16)),r=this.keyFromPublic(r,n);var o=(t=new Signature$2(t,"hex")).r,i=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;var a,s=i.invm(this.n),c=s.mul(e).umod(this.n),u=s.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,r.getPublic(),u)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(c,r.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},EC.prototype.recoverPubKey=function(e,t,r,n){assert$3((3&r)===r,"The recovery param is more than two bits"),t=new Signature$2(t,n);var o=this.n,i=new BN$1(e),a=t.r,s=t.s,c=1&r,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var l=t.r.invm(o),d=o.sub(i).mul(l).umod(o),f=s.mul(l).umod(o);return this.g.mulAdd(d,a,f)},EC.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new Signature$2(t,n)).recoveryParam)return t.recoveryParam;for(var o=0;o<4;o++){var i;try{i=this.recoverPubKey(e,t,o)}catch(a){continue}if(i.eq(r))return o}throw new Error("Unable to find valid recovery factor")};var utils$6=utils$e,assert$2=utils$6.assert,parseBytes$2=utils$6.parseBytes,cachedProperty$1=utils$6.cachedProperty;function KeyPair$1(e,t){this.eddsa=e,this._secret=parseBytes$2(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=parseBytes$2(t.pub)}KeyPair$1.fromPublic=function(e,t){return t instanceof KeyPair$1?t:new KeyPair$1(e,{pub:t})},KeyPair$1.fromSecret=function(e,t){return t instanceof KeyPair$1?t:new KeyPair$1(e,{secret:t})},KeyPair$1.prototype.secret=function(){return this._secret},cachedProperty$1(KeyPair$1,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),cachedProperty$1(KeyPair$1,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),cachedProperty$1(KeyPair$1,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),cachedProperty$1(KeyPair$1,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),cachedProperty$1(KeyPair$1,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),cachedProperty$1(KeyPair$1,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),KeyPair$1.prototype.sign=function(e){return assert$2(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},KeyPair$1.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},KeyPair$1.prototype.getSecret=function(e){return assert$2(this._secret,"KeyPair is public only"),utils$6.encode(this.secret(),e)},KeyPair$1.prototype.getPublic=function(e){return utils$6.encode(this.pubBytes(),e)};var key=KeyPair$1,BN=bnExports,utils$5=utils$e,assert$1=utils$5.assert,cachedProperty=utils$5.cachedProperty,parseBytes$1=utils$5.parseBytes;function Signature$1(e,t){this.eddsa=e,"object"!=typeof t&&(t=parseBytes$1(t)),Array.isArray(t)&&(assert$1(t.length===2*e.encodingLength,"Signature has invalid size"),t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),assert$1(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof BN&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}cachedProperty(Signature$1,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),cachedProperty(Signature$1,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),cachedProperty(Signature$1,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),cachedProperty(Signature$1,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),Signature$1.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Signature$1.prototype.toHex=function(){return utils$5.encode(this.toBytes(),"hex").toUpperCase()};var signature=Signature$1,hash=hash$8,curves=curves$2,utils$4=utils$e,assert=utils$4.assert,parseBytes=utils$4.parseBytes,KeyPair=key,Signature=signature;function EDDSA(e){if(assert("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(e);e=curves[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=hash.sha512}var eddsa=EDDSA;EDDSA.prototype.sign=function(e,t){e=parseBytes(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),o=this.g.mul(n),i=this.encodePoint(o),a=this.hashInt(i,r.pubBytes(),e).mul(r.priv()),s=n.add(a).umod(this.curve.n);return this.makeSignature({R:o,S:s,Rencoded:i})},EDDSA.prototype.verify=function(e,t,r){if(e=parseBytes(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var n=this.keyFromPublic(r),o=this.hashInt(t.Rencoded(),n.pubBytes(),e),i=this.g.mul(t.S());return t.R().add(n.pub().mul(o)).eq(i)},EDDSA.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return utils$4.intFromLE(e.digest()).umod(this.curve.n)},EDDSA.prototype.keyFromPublic=function(e){return KeyPair.fromPublic(this,e)},EDDSA.prototype.keyFromSecret=function(e){return KeyPair.fromSecret(this,e)},EDDSA.prototype.makeSignature=function(e){return e instanceof Signature?e:new Signature(this,e)},EDDSA.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},EDDSA.prototype.decodePoint=function(e){var t=(e=utils$4.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),n=!!(128&e[t]),o=utils$4.intFromLE(r);return this.curve.pointFromY(o,n)},EDDSA.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},EDDSA.prototype.decodeInt=function(e){return utils$4.intFromLE(e)},EDDSA.prototype.isPoint=function(e){return e instanceof this.pointClass},function(e){var t=e;t.version=require$$0$1.version,t.utils=utils$e,t.rand=requireBrorand(),t.curve=curve,t.curves=curves$2,t.ec=ec,t.eddsa=eddsa}(elliptic);const H$3=":";function re$1(e){const[t,r]=e.split(H$3);return{namespace:t,reference:r}}function W$2(e,t){return e.includes(":")?[e]:t.chains||[]}var gt$2=Object.defineProperty,Ke=Object.getOwnPropertySymbols,vt$1=Object.prototype.hasOwnProperty,bt$1=Object.prototype.propertyIsEnumerable,Le$1=(e,t,r)=>t in e?gt$2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Fe=(e,t)=>{for(var r in t||(t={}))vt$1.call(t,r)&&Le$1(e,r,t[r]);if(Ke)for(var r of Ke(t))bt$1.call(t,r)&&Le$1(e,r,t[r]);return e};const qe="ReactNative",y$5={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},He="js";function ce(){return typeof process$1<"u"&&typeof process$1.versions<"u"&&typeof process$1.versions.node<"u"}function _$5(){return!getDocument_1$1()&&!!getNavigator_1$1()&&navigator.product===qe}function V$3(){return!ce()&&!!getNavigator_1$1()&&!!getDocument_1$1()}function P$4(){return _$5()?y$5.reactNative:ce()?y$5.node:V$3()?y$5.browser:y$5.unknown}function Ot$1(){var e;try{return _$5()&&typeof global$1<"u"&&typeof(null==global$1?void 0:global$1.Application)<"u"?null==(e=global$1.Application)?void 0:e.applicationId:void 0}catch{return}}function We$1(e,t){let r=queryString.parse(e);return r=Fe(Fe({},r),t),e=queryString.stringify(r)}function Nt$1(){return getWindowMetadata_1$1()||{name:"",description:"",url:"",icons:[""]}}function Je$1(){if(P$4()===y$5.reactNative&&typeof global$1<"u"&&typeof(null==global$1?void 0:global$1.Platform)<"u"){const{OS:e,Version:t}=global$1.Platform;return[e,t].join("-")}const e=detect$1();if(null===e)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return"browser"===e.type?[t,e.name,e.version].join("-"):[t,e.version].join("-")}function ze(){var e;const t=P$4();return t===y$5.browser?[t,(null==(e=getLocation_1$1())?void 0:e.host)||"unknown"].join(":"):t}function Ge(e,t,r){const n=Je$1(),o=ze();return[[e,t].join("-"),[He,r].join("-"),n,o].join("/")}function $t$1({protocol:e,version:t,relayUrl:r,sdkVersion:n,auth:o,projectId:i,useOnCloseEvent:a,bundleId:s}){const c=r.split("?"),u={auth:o,ua:Ge(e,t,n),projectId:i,useOnCloseEvent:a||void 0,origin:s||void 0},l=We$1(c[1]||"",u);return c[0]+"?"+l}function $$4(e,t){return e.filter((e=>t.includes(e))).length===e.length}function Tt$1(e){return Object.fromEntries(e.entries())}function Pt$1(e){return new Map(Object.entries(e))}function _t$1(e=cjs$7.FIVE_MINUTES,t){const r=cjs$7.toMiliseconds(e||cjs$7.FIVE_MINUTES);let n,o,i;return{resolve:e=>{i&&n&&(clearTimeout(i),n(e))},reject:e=>{i&&o&&(clearTimeout(i),o(e))},done:()=>new Promise(((e,a)=>{i=setTimeout((()=>{a(new Error(t))}),r),n=e,o=a}))}}function kt$1(e,t,r){return new Promise((async(n,o)=>{const i=setTimeout((()=>o(new Error(r))),t);try{n(await e)}catch(a){o(a)}clearTimeout(i)}))}function ae$1(e,t){if("string"==typeof t&&t.startsWith(`${e}:`))return t;if("topic"===e.toLowerCase()){if("string"!=typeof t)throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}if("id"===e.toLowerCase()){if("number"!=typeof t)throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${e}`)}function Dt$1(e){return ae$1("topic",e)}function xt$1(e){return ae$1("id",e)}function Vt$1(e){const[t,r]=e.split(":"),n={id:void 0,topic:void 0};if("topic"===t&&"string"==typeof r)n.topic=r;else{if("id"!==t||!Number.isInteger(Number(r)))throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${r}`);n.id=Number(r)}return n}function Mt$1(e,t){return cjs$7.fromMiliseconds(Date.now()+cjs$7.toMiliseconds(e))}function Kt$1(e){return Date.now()>=cjs$7.toMiliseconds(e)}function Lt$1(e,t){return`${e}${t?`:${t}`:""}`}function N$3(e=[],t=[]){return[...new Set([...e,...t])]}async function Ft$1({id:e,topic:t,wcDeepLink:r}){var n;try{if(!r)return;const o="string"==typeof r?JSON.parse(r):r,i=null==o?void 0:o.href;if("string"!=typeof i)return;const a=Xe$1(i,e,t),s=P$4();if(s===y$5.browser){if(null==(n=getDocument_1$1())||!n.hasFocus())return void console.warn("Document does not have focus, skipping deeplink.");a.startsWith("https://")||a.startsWith("http://")?window.open(a,"_blank","noreferrer noopener"):window.open(a,en$2()?"_blank":"_self","noreferrer noopener")}else s===y$5.reactNative&&typeof(null==global$1?void 0:global$1.Linking)<"u"&&await global$1.Linking.openURL(a)}catch(o){console.error(o)}}function Xe$1(e,t,r){const n=`requestId=${t}&sessionTopic=${r}`;e.endsWith("/")&&(e=e.slice(0,-1));let o=`${e}`;if(e.startsWith("https://t.me")){o=`${o}${e.includes("?")?"&startapp=":"?startapp="}${nn$1(n,!0)}`}else o=`${o}/wc?${n}`;return o}async function qt$1(e,t){let r="";try{if(V$3()&&(r=localStorage.getItem(t),r))return r;r=await e.getItem(t)}catch(n){console.error(n)}return r}function Bt$1(e,t){if(!e.includes(t))return null;const r=e.split(/([&,?,=])/),n=r.indexOf(t);return r[n+2]}function Ht$1(){return typeof crypto<"u"&&null!=crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function Wt$1(){return typeof process$1<"u"&&"true"===process$1.env.IS_VITEST}function en$2(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function nn$1(e,t=!1){const r=Buffer$2.from(e).toString("base64");return t?r.replace(/[=]/g,""):r}function le(e){return Buffer$2.from(e,"base64").toString("utf-8")}const Jt$1="https://rpc.walletconnect.org/v1";async function tn$1(e,t,r,n,o,i){switch(r.t){case"eip191":return rn$1(e,t,r.s);case"eip1271":return await on$1(e,t,r.s,n,o,i);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function rn$1(e,t,r){return recoverAddress(hashMessage(t),r).toLowerCase()===e.toLowerCase()}async function on$1(e,t,r,n,o,i){const a=re$1(n);if(!a.namespace||!a.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",s="0000000000000000000000000000000000000000000000000000000000000040",c="0000000000000000000000000000000000000000000000000000000000000041",u=r.substring(2),l=a+hashMessage(t).substring(2)+s+c+u,d=await fetch(`${i||Jt$1}/?chainId=${n}&projectId=${o}`,{method:"POST",body:JSON.stringify({id:zt$1(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:l},"latest"]})}),{result:f}=await d.json();return!!f&&f.slice(0,a.length).toLowerCase()===a.toLowerCase()}catch(s){return console.error("isValidEip1271Signature: ",s),!1}}function zt$1(){return Date.now()+Math.floor(1e3*Math.random())}var Gt$1=Object.defineProperty,Yt$1=Object.defineProperties,Qt$1=Object.getOwnPropertyDescriptors,sn$1=Object.getOwnPropertySymbols,Zt$1=Object.prototype.hasOwnProperty,Xt$1=Object.prototype.propertyIsEnumerable,cn$1=(e,t,r)=>t in e?Gt$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,de$1=(e,t)=>{for(var r in t||(t={}))Zt$1.call(t,r)&&cn$1(e,r,t[r]);if(sn$1)for(var r of sn$1(t))Xt$1.call(t,r)&&cn$1(e,r,t[r]);return e},an$1=(e,t)=>Yt$1(e,Qt$1(t));const er$1="did:pkh:",z$6=e=>null==e?void 0:e.split(":"),un$1=e=>{const t=e&&z$6(e);if(t)return e.includes(er$1)?t[3]:t[1]},ln$1=e=>{const t=e&&z$6(e);if(t)return t[2]+":"+t[3]},fe$1=e=>{const t=e&&z$6(e);if(t)return t.pop()};async function nr$1(e){const{cacao:t,projectId:r}=e,{s:n,p:o}=t,i=dn$1(o,o.iss),a=fe$1(o.iss);return await tn$1(a,i,n,ln$1(o.iss),r)}const dn$1=(e,t)=>{const r=`${e.domain} wants you to sign in with your Ethereum account:`,n=fe$1(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let o=e.statement||void 0;const i=`URI: ${e.aud||e.uri}`,a=`Version: ${e.version}`,s=`Chain ID: ${un$1(t)}`,c=`Nonce: ${e.nonce}`,u=`Issued At: ${e.iat}`,l=e.exp?`Expiration Time: ${e.exp}`:void 0,d=e.nbf?`Not Before: ${e.nbf}`:void 0,f=e.requestId?`Request ID: ${e.requestId}`:void 0,h=e.resources?`Resources:${e.resources.map((e=>`\n- ${e}`)).join("")}`:void 0,p=Y$1(e.resources);if(p){o=he(o,R$3(p))}return[r,n,"",o,"",i,a,s,c,u,l,d,f,h].filter((e=>null!=e)).join("\n")};function hn$1(e){return Buffer$2.from(JSON.stringify(e)).toString("base64")}function yn$1(e){return JSON.parse(Buffer$2.from(e,"base64").toString("utf-8"))}function O$3(e){if(!e)throw new Error("No recap provided, value is undefined");if(!e.att)throw new Error("No `att` property found");const t=Object.keys(e.att);if(null==t||!t.length)throw new Error("No resources found in `att` property");t.forEach((t=>{const r=e.att[t];if(Array.isArray(r))throw new Error(`Resource must be an object: ${t}`);if("object"!=typeof r)throw new Error(`Resource must be an object: ${t}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${t}`);Object.keys(r).forEach((e=>{const t=r[e];if(!Array.isArray(t))throw new Error(`Ability limits ${e} must be an array of objects, found: ${t}`);if(!t.length)throw new Error(`Value of ${e} is empty array, must be an array with objects`);t.forEach((t=>{if("object"!=typeof t)throw new Error(`Ability limits (${e}) must be an array of objects, found: ${t}`)}))}))}))}function gn$1(e,t,r,n={}){return null==r||r.sort(((e,t)=>e.localeCompare(t))),{att:{[e]:pe(t,r,n)}}}function pe(e,t,r={}){const n=(t=null==t?void 0:t.sort(((e,t)=>e.localeCompare(t)))).map((t=>({[`${e}/${t}`]:[r]})));return Object.assign({},...n)}function G$1(e){return O$3(e),`urn:recap:${hn$1(e).replace(/=/g,"")}`}function R$3(e){const t=yn$1(e.replace("urn:recap:",""));return O$3(t),t}function ir$1(e,t,r){return G$1(gn$1(e,t,r))}function me$2(e){return e&&e.includes("urn:recap:")}function cr$1(e,t){return G$1(bn$1(R$3(e),R$3(t)))}function bn$1(e,t){O$3(e),O$3(t);const r=Object.keys(e.att).concat(Object.keys(t.att)).sort(((e,t)=>e.localeCompare(t))),n={att:{}};return r.forEach((r=>{var o,i;Object.keys((null==(o=e.att)?void 0:o[r])||{}).concat(Object.keys((null==(i=t.att)?void 0:i[r])||{})).sort(((e,t)=>e.localeCompare(t))).forEach((o=>{var i,a;n.att[r]=an$1(de$1({},n.att[r]),{[o]:(null==(i=e.att[r])?void 0:i[o])||(null==(a=t.att[r])?void 0:a[o])})}))})),n}function he(e="",t){O$3(t);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(r))return e;const n=[];let o=0;Object.keys(t.att).forEach((e=>{const r=Object.keys(t.att[e]).map((e=>({ability:e.split("/")[0],action:e.split("/")[1]})));r.sort(((e,t)=>e.action.localeCompare(t.action)));const i={};r.forEach((e=>{i[e.ability]||(i[e.ability]=[]),i[e.ability].push(e.action)}));const a=Object.keys(i).map((t=>(o++,`(${o}) '${t}': '${i[t].join("', '")}' for '${e}'.`)));n.push(a.join(", ").replace(".,","."))}));return`${e?e+" ":""}${`${r}${n.join(" ")}`}`}function ar$1(e){var t;const r=R$3(e);O$3(r);const n=null==(t=r.att)?void 0:t.eip155;return n?Object.keys(n).map((e=>e.split("/")[1])):[]}function ur$1(e){const t=R$3(e);O$3(t);const r=[];return Object.values(t.att).forEach((e=>{Object.values(e).forEach((e=>{var t;null!=(t=null==e?void 0:e[0])&&t.chains&&r.push(e[0].chains)}))})),[...new Set(r.flat())]}function Y$1(e){if(!e)return;const t=null==e?void 0:e[e.length-1];return me$2(t)?t:void 0}const ye$2="base10",g$4="base16",ge="base64pad",lr$1="base64url",k$4="utf8",ve$1=0,D$5=1,M$4=2,dr$1=0,wn=1,K$2=12,be$2=32;function fr$2(){const e=x25519.generateKeyPair();return{privateKey:toString$1(e.secretKey,g$4),publicKey:toString$1(e.publicKey,g$4)}}function pr$1(){return toString$1(random.randomBytes(be$2),g$4)}function mr$1(e,t){const r=x25519.sharedKey(fromString$1(e,g$4),fromString$1(t,g$4),!0);return toString$1(new HKDF_1(sha256.SHA256,r).expand(be$2),g$4)}function hr$1(e){return toString$1(sha256.hash(fromString$1(e,g$4)),g$4)}function yr$1(e){return toString$1(sha256.hash(fromString$1(e,k$4)),g$4)}function Ee$1(e){return fromString$1(`${e}`,ye$2)}function A$4(e){return Number(toString$1(e,ye$2))}function gr$1(e){const t=Ee$1(typeof e.type<"u"?e.type:ve$1);if(A$4(t)===D$5&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof e.senderPublicKey<"u"?fromString$1(e.senderPublicKey,g$4):void 0,n=typeof e.iv<"u"?fromString$1(e.iv,g$4):random.randomBytes(K$2);return we$2({type:t,sealed:new chacha20poly1305.ChaCha20Poly1305(fromString$1(e.symKey,g$4)).seal(n,fromString$1(e.message,k$4)),iv:n,senderPublicKey:r,encoding:e.encoding})}function vr$1(e,t){const r=Ee$1(M$4),n=random.randomBytes(K$2);return we$2({type:r,sealed:fromString$1(e,k$4),iv:n,encoding:t})}function br$1(e){const t=new chacha20poly1305.ChaCha20Poly1305(fromString$1(e.symKey,g$4)),{sealed:r,iv:n}=Q$1({encoded:e.encoded,encoding:null==e?void 0:e.encoding}),o=t.open(n,r);if(null===o)throw new Error("Failed to decrypt");return toString$1(o,k$4)}function Er$1(e,t){const{sealed:r}=Q$1({encoded:e,encoding:t});return toString$1(r,k$4)}function we$2(e){const{encoding:t=ge}=e;if(A$4(e.type)===M$4)return toString$1(concat([e.type,e.sealed]),t);if(A$4(e.type)===D$5){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return toString$1(concat([e.type,e.senderPublicKey,e.iv,e.sealed]),t)}return toString$1(concat([e.type,e.iv,e.sealed]),t)}function Q$1(e){const{encoded:t,encoding:r=ge}=e,n=fromString$1(t,r),o=n.slice(dr$1,wn),i=wn;if(A$4(o)===D$5){const e=i+be$2,t=e+K$2,r=n.slice(i,e),a=n.slice(e,t);return{type:o,sealed:n.slice(t),iv:a,senderPublicKey:r}}if(A$4(o)===M$4){return{type:o,sealed:n.slice(i),iv:random.randomBytes(K$2)}}const a=i+K$2,s=n.slice(i,a);return{type:o,sealed:n.slice(a),iv:s}}function wr$1(e,t){const r=Q$1({encoded:e,encoding:null==t?void 0:t.encoding});return On({type:A$4(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?toString$1(r.senderPublicKey,g$4):void 0,receiverPublicKey:null==t?void 0:t.receiverPublicKey})}function On(e){const t=(null==e?void 0:e.type)||ve$1;if(t===D$5){if(typeof(null==e?void 0:e.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(null==e?void 0:e.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:null==e?void 0:e.senderPublicKey,receiverPublicKey:null==e?void 0:e.receiverPublicKey}}function Or$1(e){return e.type===D$5&&"string"==typeof e.senderPublicKey&&"string"==typeof e.receiverPublicKey}function Nr$1(e){return e.type===M$4}function Nn(e){return new elliptic.ec("p256").keyFromPublic({x:Buffer$2.from(e.x,"base64").toString("hex"),y:Buffer$2.from(e.y,"base64").toString("hex")},"hex")}function Sr$1(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");const r=t.length%4;return r>0&&(t+="=".repeat(4-r)),t}function $r$1(e){return Buffer$2.from(Sr$1(e),"base64")}function Rr$1(e,t){const[r,n,o]=e.split("."),i=$r$1(o);if(64!==i.length)throw new Error("Invalid signature length");const a=i.slice(0,32).toString("hex"),s=i.slice(32,64).toString("hex"),c=`${r}.${n}`,u=(new sha256.SHA256).update(Buffer$2.from(c)).digest(),l=Nn(t),d=Buffer$2.from(u).toString("hex");if(!l.verify(d,{r:a,s:s}))throw new Error("Invalid signature");return decodeJWT(e).payload}const Sn="irn";function Ir$1(e){return(null==e?void 0:e.relay)||{protocol:Sn}}function jr$1(e){const t=C$6[e];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${e}`);return t}var Tr$1=Object.defineProperty,Pr$1=Object.defineProperties,Ar$1=Object.getOwnPropertyDescriptors,$n=Object.getOwnPropertySymbols,Cr$1=Object.prototype.hasOwnProperty,Ur$1=Object.prototype.propertyIsEnumerable,Rn=(e,t,r)=>t in e?Tr$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,In=(e,t)=>{for(var r in t||(t={}))Cr$1.call(t,r)&&Rn(e,r,t[r]);if($n)for(var r of $n(t))Ur$1.call(t,r)&&Rn(e,r,t[r]);return e},_r$1=(e,t)=>Pr$1(e,Ar$1(t));function jn(e,t="-"){const r={},n="relay"+t;return Object.keys(e).forEach((t=>{if(t.startsWith(n)){const o=t.replace(n,""),i=e[t];r[o]=i}})),r}function kr$1(e){if(!e.includes("wc:")){const t=le(e);null!=t&&t.includes("wc:")&&(e=t)}const t=(e=(e=e.includes("wc://")?e.replace("wc://",""):e).includes("wc:")?e.replace("wc:",""):e).indexOf(":"),r=-1!==e.indexOf("?")?e.indexOf("?"):void 0,n=e.substring(0,t),o=e.substring(t+1,r).split("@"),i=typeof r<"u"?e.substring(r):"",a=queryString.parse(i),s="string"==typeof a.methods?a.methods.split(","):void 0;return{protocol:n,topic:Tn(o[0]),version:parseInt(o[1],10),symKey:a.symKey,relay:jn(a),methods:s,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function Tn(e){return e.startsWith("//")?e.substring(2):e}function Pn(e,t="-"){const r={};return Object.keys(e).forEach((n=>{const o="relay"+t+n;e[n]&&(r[o]=e[n])})),r}function Dr$1(e){return`${e.protocol}:${e.topic}@${e.version}?`+queryString.stringify(In(_r$1(In({symKey:e.symKey},Pn(e.relay)),{expiryTimestamp:e.expiryTimestamp}),e.methods?{methods:e.methods.join(",")}:{}))}function xr$1(e,t,r){return`${e}?wc_ev=${r}&topic=${t}`}function C$4(e){const t=[];return e.forEach((e=>{const[r,n]=e.split(":");t.push(`${r}:${n}`)})),t}function Un(e){const t=[];return Object.values(e).forEach((e=>{t.push(...C$4(e.accounts))})),t}function _n(e,t){const r=[];return Object.values(e).forEach((e=>{C$4(e.accounts).includes(t)&&r.push(...e.methods)})),r}function kn(e,t){const r=[];return Object.values(e).forEach((e=>{C$4(e.accounts).includes(t)&&r.push(...e.events)})),r}function xn(e){const t={};return null==e||e.forEach((e=>{const[r,n]=e.split(":");t[r]||(t[r]={accounts:[],chains:[],events:[]}),t[r].accounts.push(e),t[r].chains.push(`${r}:${n}`)})),t}function Jr$1(e,t){const r=xn(t=t.map((e=>e.replace("did:pkh:",""))));for(const[n,o]of Object.entries(r))o.methods?o.methods=N$3(o.methods,e):o.methods=e,o.events=["chainChanged","accountsChanged"];return r}const Vn={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}},Mn={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 S$6(e,t){const{message:r,code:n}=Mn[e];return{message:t?`${r} ${t}`:r,code:n}}function U$2(e,t){const{message:r,code:n}=Vn[e];return{message:t?`${r} ${t}`:r,code:n}}function L$4(e,t){return!!Array.isArray(e)}function Z$3(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function I$5(e){return typeof e>"u"}function b$4(e,t){return!(!t||!I$5(e))||"string"==typeof e&&!!e.trim().length}function X$2(e,t){return!(!t||!I$5(e))||"number"==typeof e&&!isNaN(e)}function zr$1(e,t){const{requiredNamespaces:r}=t,n=Object.keys(e.namespaces),o=Object.keys(r);let i=!0;return!!$$4(o,n)&&(n.forEach((t=>{const{accounts:n,methods:o,events:a}=e.namespaces[t],s=C$4(n),c=r[t];$$4(W$2(t,c),s)&&$$4(c.methods,o)&&$$4(c.events,a)||(i=!1)})),i)}function F$3(e){return!(!b$4(e,!1)||!e.includes(":"))&&2===e.split(":").length}function Kn(e){if(b$4(e,!1)&&e.includes(":")){const t=e.split(":");if(3===t.length){const e=t[0]+":"+t[1];return!!t[2]&&F$3(e)}}return!1}function Gr$1(e){function t(e){try{return typeof new URL(e)<"u"}catch{return!1}}try{if(b$4(e,!1)){if(t(e))return!0;return t(le(e))}}catch{}return!1}function Yr$1(e){var t;return null==(t=null==e?void 0:e.proposer)?void 0:t.publicKey}function Qr$1(e){return null==e?void 0:e.topic}function Zr$1(e,t){let r=null;return b$4(null==e?void 0:e.publicKey,!1)||(r=S$6("MISSING_OR_INVALID",`${t} controller public key should be a string`)),r}function Se(e){let t=!0;return L$4(e)?e.length&&(t=e.every((e=>b$4(e,!1)))):t=!1,t}function Ln(e,t,r){let n=null;return L$4(t)&&t.length?t.forEach((e=>{n||F$3(e)||(n=U$2("UNSUPPORTED_CHAINS",`${r}, chain ${e} should be a string and conform to "namespace:chainId" format`))})):F$3(e)||(n=U$2("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function Fn(e,t,r){let n=null;return Object.entries(e).forEach((([e,o])=>{if(n)return;const i=Ln(e,W$2(e,o),`${t} ${r}`);i&&(n=i)})),n}function qn(e,t){let r=null;return L$4(e)?e.forEach((e=>{r||Kn(e)||(r=U$2("UNSUPPORTED_ACCOUNTS",`${t}, account ${e} should be a string and conform to "namespace:chainId:address" format`))})):r=U$2("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function Bn(e,t){let r=null;return Object.values(e).forEach((e=>{if(r)return;const n=qn(null==e?void 0:e.accounts,`${t} namespace`);n&&(r=n)})),r}function Hn(e,t){let r=null;return Se(null==e?void 0:e.methods)?Se(null==e?void 0:e.events)||(r=U$2("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):r=U$2("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),r}function $e(e,t){let r=null;return Object.values(e).forEach((e=>{if(r)return;const n=Hn(e,`${t}, namespace`);n&&(r=n)})),r}function Xr$1(e,t,r){let n=null;if(e&&Z$3(e)){const o=$e(e,t);o&&(n=o);const i=Fn(e,t,r);i&&(n=i)}else n=S$6("MISSING_OR_INVALID",`${t}, ${r} should be an object with data`);return n}function Wn(e,t){let r=null;if(e&&Z$3(e)){const n=$e(e,t);n&&(r=n);const o=Bn(e,t);o&&(r=o)}else r=S$6("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return r}function Jn(e){return b$4(e.protocol,!0)}function eo(e,t){let r=!1;return e?e&&L$4(e)&&e.length&&e.forEach((e=>{r=Jn(e)})):r=!0,r}function no(e){return"number"==typeof e}function to(e){return typeof e<"u"&&null!==typeof e}function ro(e){return!!(e&&"object"==typeof e&&e.code&&X$2(e.code,!1)&&e.message&&b$4(e.message,!1))}function oo(e){return!(I$5(e)||!b$4(e.method,!1))}function so(e){return!(I$5(e)||I$5(e.result)&&I$5(e.error)||!X$2(e.id,!1)||!b$4(e.jsonrpc,!1))}function io(e){return!(I$5(e)||!b$4(e.name,!1))}function co(e,t){return!(!F$3(t)||!Un(e).includes(t))}function ao(e,t,r){return!!b$4(r,!1)&&_n(e,t).includes(r)}function uo(e,t,r){return!!b$4(r,!1)&&kn(e,t).includes(r)}function zn(e,t,r){let n=null;const o=lo(e),i=fo(t),a=Object.keys(o),s=Object.keys(i),c=Gn(Object.keys(e)),u=Gn(Object.keys(t)),l=c.filter((e=>!u.includes(e)));return l.length&&(n=S$6("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.\n Required: ${l.toString()}\n Received: ${Object.keys(t).toString()}`)),$$4(a,s)||(n=S$6("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces.\n Required: ${a.toString()}\n Approved: ${s.toString()}`)),Object.keys(t).forEach((e=>{if(!e.includes(":")||n)return;const o=C$4(t[e].accounts);o.includes(e)||(n=S$6("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${e}\n Required: ${e}\n Approved: ${o.toString()}`))})),a.forEach((e=>{n||($$4(o[e].methods,i[e].methods)?$$4(o[e].events,i[e].events)||(n=S$6("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${e}`)):n=S$6("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${e}`))})),n}function lo(e){const t={};return Object.keys(e).forEach((r=>{var n;r.includes(":")?t[r]=e[r]:null==(n=e[r].chains)||n.forEach((n=>{t[n]={methods:e[r].methods,events:e[r].events}}))})),t}function Gn(e){return[...new Set(e.map((e=>e.includes(":")?e.split(":")[0]:e)))]}function fo(e){const t={};return Object.keys(e).forEach((r=>{if(r.includes(":"))t[r]=e[r];else{const n=C$4(e[r].accounts);null==n||n.forEach((n=>{t[n]={accounts:e[r].accounts.filter((e=>e.includes(`${n}:`))),methods:e[r].methods,events:e[r].events}}))}})),t}function po(e,t){return X$2(e,!1)&&e<=t.max&&e>=t.min}function mo(){const e=P$4();return new Promise((t=>{switch(e){case y$5.browser:t(Yn());break;case y$5.reactNative:t(Qn());break;case y$5.node:t(Zn());break;default:t(!0)}}))}function Yn(){return V$3()&&(null==navigator?void 0:navigator.onLine)}async function Qn(){if(_$5()&&typeof global$1<"u"&&null!=global$1&&global$1.NetInfo){const e=await(null==global$1?void 0:global$1.NetInfo.fetch());return null==e?void 0:e.isConnected}return!0}function Zn(){return!0}function ho(e){switch(P$4()){case y$5.browser:Xn(e);break;case y$5.reactNative:et$1(e)}}function Xn(e){!_$5()&&V$3()&&(window.addEventListener("online",(()=>e(!0))),window.addEventListener("offline",(()=>e(!1))))}function et$1(e){_$5()&&typeof global$1<"u"&&null!=global$1&&global$1.NetInfo&&(null==global$1||global$1.NetInfo.addEventListener((t=>e(null==t?void 0:t.isConnected))))}const Re={};class yo{static get(e){return Re[e]}static set(e,t){Re[e]=t}static delete(e){delete Re[e]}}const w$5=()=>typeof WebSocket<"u"?WebSocket:typeof global$1<"u"&&typeof global$1.WebSocket<"u"?global$1.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),b$3=()=>typeof WebSocket<"u"||typeof global$1<"u"&&typeof global$1.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",a$4=e=>e.split("?")[0],h$5=10,S$5=w$5();let f$5=class{constructor(e){if(this.url=e,this.events=new eventsExports.EventEmitter,this.registering=!1,!isWsUrl(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise(((e,t)=>{typeof this.socket>"u"?t(new Error("Connection already closed")):(this.socket.onclose=t=>{this.onClose(t),e()},this.socket.close())}))}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(safeJsonStringify$2(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!isWsUrl(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise(((e,t)=>{this.events.once("register_error",(e=>{this.resetMaxListeners(),t(e)})),this.events.once("open",(()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return t(new Error("WebSocket connection is missing or invalid"));e(this.socket)}))}))}return this.url=e,this.registering=!0,new Promise(((t,r)=>{const n=new URLSearchParams(e).get("origin"),o=cjs$4.isReactNative()?{headers:{origin:n}}:{rejectUnauthorized:!isLocalhostUrl(e)},i=new S$5(e,[],o);b$3()?i.onerror=e=>{const t=e;r(this.emitError(t.error))}:i.on("error",(e=>{r(this.emitError(e))})),i.onopen=()=>{this.onOpen(i),t(i)}}))}onOpen(e){e.onmessage=e=>this.onPayload(e),e.onclose=e=>this.onClose(e),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const t="string"==typeof e.data?safeJsonParse$2(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const r=this.parseError(t),n=formatJsonRpcError(e,r.message||r.toString());this.events.emit("payload",n)}parseError(e,t=this.url){return parseConnectionError(e,a$4(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>h$5&&this.events.setMaxListeners(h$5)}emitError(e){const t=this.parseError(new Error((null==e?void 0:e.message)||`WebSocket connection failed for host: ${a$4(this.url)}`));return this.events.emit("register_error",t),t}};const ye$1="wc",De=2,ie="core",x$4=`${ye$1}@2:${ie}:`,Ye={name:ie,logger:"error"},Je={database:":memory:"},Xe="crypto",me$1="client_ed25519_seed",We=cjs$7.ONE_DAY,Ze="keychain",Qe="0.3",et="messages",tt="0.3",it$1=cjs$7.SIX_HOURS,st$1="publisher",rt$1="irn",nt$1="error",be$1="wss://relay.walletconnect.org",ot$1="relayer",v$4={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"},at$1="_subscription",I$4={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},ht$1=.1,se="2.17.1",M$3={link_mode:"link_mode",relay:"relay"},ct$1="0.3",lt$1="WALLETCONNECT_CLIENT_ID",fe="WALLETCONNECT_LINK_MODE_APPS",O$2={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},ut$1="subscription",dt$1="0.3",pt$2=1e3*cjs$7.FIVE_SECONDS,gt$1="pairing",yt$1="0.3",B$2={wc_pairingDelete:{req:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:cjs$7.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:cjs$7.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:0},res:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:0}}},V$2={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},P$3={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},Dt="history",mt="0.3",bt="expirer",S$4={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},ft="0.3",_t="verify-api",vs$1="https://verify.walletconnect.com",Et="https://verify.walletconnect.org",J$1=Et,vt=`${J$1}/v3`,wt=[vs$1,Et],It="echo",Tt="https://echo.walletconnect.com",z$5={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"},$$3={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"},Is$1={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"},Ts$1={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"},Cs={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},Ps={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},Ct=.1,Pt="event-client",St=86400,Rt="https://pulse.walletconnect.org/batch";function Ss$1(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<e.length;o++){var i=e.charAt(o),a=i.charCodeAt(0);if(255!==r[a])throw new TypeError(i+" is ambiguous");r[a]=o}var s=e.length,c=e.charAt(0),u=Math.log(s)/Math.log(256),l=Math.log(256)/Math.log(s);function d(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,o=0;e[t]===c;)n++,t++;for(var i=(e.length-t)*u+1>>>0,a=new Uint8Array(i);e[t];){var l=r[e.charCodeAt(t)];if(255===l)return;for(var d=0,f=i-1;(0!==l||d<o)&&-1!==f;f--,d++)l+=s*a[f]>>>0,a[f]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=d,t++}if(" "!==e[t]){for(var h=i-o;h!==i&&0===a[h];)h++;for(var p=new Uint8Array(n+(i-h)),y=n;h!==i;)p[y++]=a[h++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,o=0,i=t.length;o!==i&&0===t[o];)o++,r++;for(var a=(i-o)*l+1>>>0,u=new Uint8Array(a);o!==i;){for(var d=t[o],f=0,h=a-1;(0!==d||f<n)&&-1!==h;h--,f++)d+=256*u[h]>>>0,u[h]=d%s>>>0,d=d/s>>>0;if(0!==d)throw new Error("Non-zero carry");n=f,o++}for(var p=a-n;p!==a&&0===u[p];)p++;for(var y=c.repeat(r);p<a;++p)y+=e.charAt(u[p]);return y},decodeUnsafe:d,decode:function(e){var r=d(e);if(r)return r;throw new Error(`Non-${t} character`)}}}var Rs$1=Ss$1,xs=Rs$1;const xt=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},Os=e=>(new TextEncoder).encode(e),As=e=>(new TextDecoder).decode(e);class Ns{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class zs{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){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))}throw Error("Can only multibase decode strings")}or(e){return Ot(this,e)}}class Ls{constructor(e){this.decoders=e}or(e){return Ot(this,e)}decode(e){const t=e[0],r=this.decoders[t];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 Ot=(e,t)=>new Ls({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class $s{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new Ns(e,t,r),this.decoder=new zs(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const re=({name:e,prefix:t,encode:r,decode:n})=>new $s(e,t,r,n),X$1=({prefix:e,name:t,alphabet:r})=>{const{encode:n,decode:o}=xs(r,t);return re({prefix:e,name:t,encode:n,decode:e=>xt(o(e))})},ks=(e,t,r,n)=>{const o={};for(let l=0;l<t.length;++l)o[t[l]]=l;let i=e.length;for(;"="===e[i-1];)--i;const a=new Uint8Array(i*r/8|0);let s=0,c=0,u=0;for(let l=0;l<i;++l){const t=o[e[l]];if(void 0===t)throw new SyntaxError(`Non-${n} character`);c=c<<r|t,s+=r,s>=8&&(s-=8,a[u++]=255&c>>s)}if(s>=r||255&c<<8-s)throw new SyntaxError("Unexpected end of data");return a},Ms=(e,t,r)=>{const n="="===t[t.length-1],o=(1<<r)-1;let i="",a=0,s=0;for(let c=0;c<e.length;++c)for(s=s<<8|e[c],a+=8;a>r;)a-=r,i+=t[o&s>>a];if(a&&(i+=t[o&s<<r-a]),n)for(;i.length*r&7;)i+="=";return i},f$4=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>re({prefix:t,name:e,encode:e=>Ms(e,n,r),decode:t=>ks(t,n,r,e)}),Us=re({prefix:"\0",name:"identity",encode:e=>As(e),decode:e=>Os(e)});var Fs=Object.freeze({__proto__:null,identity:Us});const Ks=f$4({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Bs=Object.freeze({__proto__:null,base2:Ks});const Vs=f$4({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var js=Object.freeze({__proto__:null,base8:Vs});const qs$1=X$1({prefix:"9",name:"base10",alphabet:"0123456789"});var Gs=Object.freeze({__proto__:null,base10:qs$1});const Hs=f$4({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ys=f$4({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Js=Object.freeze({__proto__:null,base16:Hs,base16upper:Ys});const Xs=f$4({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ws=f$4({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Zs=f$4({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Qs=f$4({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),er=f$4({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),tr=f$4({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ir=f$4({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),sr=f$4({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),rr=f$4({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var nr=Object.freeze({__proto__:null,base32:Xs,base32upper:Ws,base32pad:Zs,base32padupper:Qs,base32hex:er,base32hexupper:tr,base32hexpad:ir,base32hexpadupper:sr,base32z:rr});const or=X$1({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ar=X$1({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var hr=Object.freeze({__proto__:null,base36:or,base36upper:ar});const cr=X$1({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),lr=X$1({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ur=Object.freeze({__proto__:null,base58btc:cr,base58flickr:lr});const dr=f$4({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),pr=f$4({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),gr=f$4({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),yr=f$4({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Dr=Object.freeze({__proto__:null,base64:dr,base64pad:pr,base64url:gr,base64urlpad:yr});const At=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),mr=At.reduce(((e,t,r)=>(e[r]=t,e)),[]),br=At.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]);function fr$1(e){return e.reduce(((e,t)=>e+=mr[t]),"")}function _r(e){const t=[];for(const r of e){const e=br[r.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}const Er=re({prefix:"🚀",name:"base256emoji",encode:fr$1,decode:_r});var vr=Object.freeze({__proto__:null,base256emoji:Er}),wr=zt,Nt=128,Ir=127,Tr=~Ir,Cr=Math.pow(2,31);function zt(e,t,r){t=t||[];for(var n=r=r||0;e>=Cr;)t[r++]=255&e|Nt,e/=128;for(;e&Tr;)t[r++]=255&e|Nt,e>>>=7;return t[r]=0|e,zt.bytes=r-n+1,t}var Pr=_e$1,Sr=128,Lt=127;function _e$1(e,t){var r,n=0,o=0,i=t=t||0,a=e.length;do{if(i>=a)throw _e$1.bytes=0,new RangeError("Could not decode varint");r=e[i++],n+=o<28?(r&Lt)<<o:(r&Lt)*Math.pow(2,o),o+=7}while(r>=Sr);return _e$1.bytes=i-t,n}var Rr=Math.pow(2,7),xr=Math.pow(2,14),Or=Math.pow(2,21),Ar=Math.pow(2,28),Nr=Math.pow(2,35),zr=Math.pow(2,42),Lr=Math.pow(2,49),$r=Math.pow(2,56),kr=Math.pow(2,63),Mr=function(e){return e<Rr?1:e<xr?2:e<Or?3:e<Ar?4:e<Nr?5:e<zr?6:e<Lr?7:e<$r?8:e<kr?9:10},Ur={encode:wr,decode:Pr,encodingLength:Mr},$t=Ur;const kt=(e,t,r=0)=>($t.encode(e,t,r),t),Mt=e=>$t.encodingLength(e),Ee=(e,t)=>{const r=t.byteLength,n=Mt(e),o=n+Mt(r),i=new Uint8Array(o+r);return kt(e,i,0),kt(r,i,n),i.set(t,o),new Fr(e,r,t,i)};class Fr{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}}const Ut=({name:e,code:t,encode:r})=>new Kr(e,t,r);class Kr{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Ee(this.code,t):t.then((e=>Ee(this.code,e)))}throw Error("Unknown type, must be binary type")}}const Ft=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Br=Ut({name:"sha2-256",code:18,encode:Ft("SHA-256")}),Vr=Ut({name:"sha2-512",code:19,encode:Ft("SHA-512")});var jr=Object.freeze({__proto__:null,sha256:Br,sha512:Vr});const Kt=0,qr="identity",Bt=xt,Gr=e=>Ee(Kt,Bt(e)),Hr={code:Kt,name:qr,encode:Bt,digest:Gr};var Yr=Object.freeze({__proto__:null,identity:Hr});new TextEncoder,new TextDecoder;const Vt={...Fs,...Bs,...js,...Gs,...Js,...nr,...hr,...ur,...Dr,...vr};function Jr(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}function jt(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const qt=jt("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),ve=jt("ascii","a",(e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}),(e=>{const t=Jr((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t})),Xr={utf8:qt,"utf-8":qt,hex:Vt.base16,latin1:ve,ascii:ve,binary:ve,...Vt};function Wr(e,t="utf8"){const r=Xr[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.decoder.decode(`${r.prefix}${e}`):globalThis.Buffer.from(e,"utf8")}class Gt{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name=Ze,this.version=Qe,this.initialized=!1,this.storagePrefix=x$4,this.init=async()=>{if(!this.initialized){const e=await this.getKeyChain();typeof e<"u"&&(this.keychain=e),this.initialized=!0}},this.has=e=>(this.isInitialized(),this.keychain.has(e)),this.set=async(e,t)=>{this.isInitialized(),this.keychain.set(e,t),await this.persist()},this.get=e=>{this.isInitialized();const t=this.keychain.get(e);if(typeof t>"u"){const{message:t}=S$6("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t},this.del=async e=>{this.isInitialized(),this.keychain.delete(e),await this.persist()},this.core=e,this.logger=E$5(t,this.name)}get context(){return y$7(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Tt$1(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Pt$1(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Ht{constructor(e,t,r){this.core=e,this.logger=t,this.name=Xe,this.randomSessionIdentifier=pr$1(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=e=>(this.isInitialized(),this.keychain.has(e)),this.getClientId=async()=>{this.isInitialized();return encodeIss(generateKeyPair(await this.getClientSeed()).publicKey)},this.generateKeyPair=()=>{this.isInitialized();const e=fr$2();return this.setPrivateKey(e.publicKey,e.privateKey)},this.signJWT=async e=>{this.isInitialized();const t=generateKeyPair(await this.getClientSeed()),r=this.randomSessionIdentifier,n=We;return await signJWT(r,e,n,t)},this.generateSharedKey=(e,t,r)=>{this.isInitialized();const n=mr$1(this.getPrivateKey(e),t);return this.setSymKey(n,r)},this.setSymKey=async(e,t)=>{this.isInitialized();const r=t||hr$1(e);return await this.keychain.set(r,e),r},this.deleteKeyPair=async e=>{this.isInitialized(),await this.keychain.del(e)},this.deleteSymKey=async e=>{this.isInitialized(),await this.keychain.del(e)},this.encode=async(e,t,r)=>{this.isInitialized();const n=On(r),o=safeJsonStringify$2(t);if(Nr$1(n))return vr$1(o,null==r?void 0:r.encoding);if(Or$1(n)){const t=n.senderPublicKey,r=n.receiverPublicKey;e=await this.generateSharedKey(t,r)}const i=this.getSymKey(e),{type:a,senderPublicKey:s}=n;return gr$1({type:a,symKey:i,message:o,senderPublicKey:s,encoding:null==r?void 0:r.encoding})},this.decode=async(e,t,r)=>{this.isInitialized();const n=wr$1(t,r);if(Nr$1(n)){return safeJsonParse$2(Er$1(t,null==r?void 0:r.encoding))}if(Or$1(n)){const t=n.receiverPublicKey,r=n.senderPublicKey;e=await this.generateSharedKey(t,r)}try{const n=this.getSymKey(e);return safeJsonParse$2(br$1({symKey:n,encoded:t,encoding:null==r?void 0:r.encoding}))}catch(o){this.logger.error(`Failed to decode message from topic: '${e}', clientId: '${await this.getClientId()}'`),this.logger.error(o)}},this.getPayloadType=(e,t=ge)=>A$4(Q$1({encoded:e,encoding:t}).type),this.getPayloadSenderPublicKey=(e,t=ge)=>{const r=Q$1({encoded:e,encoding:t});return r.senderPublicKey?toString$1(r.senderPublicKey,g$4):void 0},this.core=e,this.logger=E$5(t,this.name),this.keychain=r||new Gt(this.core,this.logger)}get context(){return y$7(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(me$1)}catch{e=pr$1(),await this.keychain.set(me$1,e)}return Wr(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Yt extends a$5{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=et,this.version=tt,this.initialized=!1,this.storagePrefix=x$4,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const e=await this.getRelayerMessages();typeof e<"u"&&(this.messages=e),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}finally{this.initialized=!0}}},this.set=async(e,t)=>{this.isInitialized();const r=yr$1(t);let n=this.messages.get(e);return typeof n>"u"&&(n={}),typeof n[r]<"u"||(n[r]=t,this.messages.set(e,n),await this.persist()),r},this.get=e=>{this.isInitialized();let t=this.messages.get(e);return typeof t>"u"&&(t={}),t},this.has=(e,t)=>{this.isInitialized();return typeof this.get(e)[yr$1(t)]<"u"},this.del=async e=>{this.isInitialized(),this.messages.delete(e),await this.persist()},this.logger=E$5(e,this.name),this.core=t}get context(){return y$7(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Tt$1(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Pt$1(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Zr extends g$5{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new eventsExports.EventEmitter,this.name=st$1,this.queue=new Map,this.publishTimeout=cjs$7.toMiliseconds(cjs$7.ONE_MINUTE),this.failedPublishTimeout=cjs$7.toMiliseconds(cjs$7.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(e,t,r)=>{var n;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:r}});const o=(null==r?void 0:r.ttl)||it$1,i=Ir$1(r),a=(null==r?void 0:r.prompt)||!1,s=(null==r?void 0:r.tag)||0,c=(null==r?void 0:r.id)||getBigIntRpcId().toString(),u={topic:e,message:t,opts:{ttl:o,relay:i,prompt:a,tag:s,id:c,attestation:null==r?void 0:r.attestation}},l=`Failed to publish payload, please try again. id:${c} tag:${s}`,d=Date.now();let f,h=1;try{for(;void 0===f;){if(Date.now()-d>this.publishTimeout)throw new Error(l);this.logger.trace({id:c,attempts:h},`publisher.publish - attempt ${h}`),f=await await kt$1(this.rpcPublish(e,t,o,i,a,s,c,null==r?void 0:r.attestation).catch((e=>this.logger.warn(e))),this.publishTimeout,l),h++,f||await new Promise((e=>setTimeout(e,this.failedPublishTimeout)))}this.relayer.events.emit(v$4.publish,u),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:c,topic:e,message:t,opts:r}})}catch(p){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(p),null!=(n=null==r?void 0:r.internal)&&n.throwOnFailedPublish)throw p;this.queue.set(c,u)}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.relayer=e,this.logger=E$5(t,this.name),this.registerEventListeners()}get context(){return y$7(this.logger)}rpcPublish(e,t,r,n,o,i,a,s){var c,u,l,d;const f={method:jr$1(n.protocol).publish,params:{topic:e,message:t,ttl:r,prompt:o,tag:i,attestation:s},id:a};return I$5(null==(c=f.params)?void 0:c.prompt)&&(null==(u=f.params)||delete u.prompt),I$5(null==(l=f.params)?void 0:l.tag)&&(null==(d=f.params)||delete d.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:f}),this.relayer.request(f)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach((async e=>{const{topic:t,message:r,opts:n}=e;await this.publish(t,r,n)}))}registerEventListeners(){this.relayer.core.heartbeat.on(r$6.pulse,(()=>{if(this.needsTransportRestart)return this.needsTransportRestart=!1,void this.relayer.events.emit(v$4.connection_stalled);this.checkQueue()})),this.relayer.on(v$4.message_ack,(e=>{this.removeRequestFromQueue(e.id.toString())}))}}class Qr{constructor(){this.map=new Map,this.set=(e,t)=>{const r=this.get(e);this.exists(e,t)||this.map.set(e,[...r,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u")return void this.map.delete(e);if(!this.map.has(e))return;const r=this.get(e);if(!this.exists(e,t))return;const n=r.filter((e=>e!==t));n.length?this.map.set(e,n):this.map.delete(e)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var en$1=Object.defineProperty,tn=Object.defineProperties,sn=Object.getOwnPropertyDescriptors,Jt=Object.getOwnPropertySymbols,rn=Object.prototype.hasOwnProperty,nn=Object.prototype.propertyIsEnumerable,Xt=(e,t,r)=>t in e?en$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,W$1=(e,t)=>{for(var r in t||(t={}))rn.call(t,r)&&Xt(e,r,t[r]);if(Jt)for(var r of Jt(t))nn.call(t,r)&&Xt(e,r,t[r]);return e},we$1=(e,t)=>tn(e,sn(t));class Wt extends d$4{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new Qr,this.events=new eventsExports.EventEmitter,this.name=ut$1,this.version=dt$1,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=x$4,this.subscribeTimeout=cjs$7.toMiliseconds(cjs$7.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(e,t)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}});try{const r=Ir$1(t),n={topic:e,relay:r,transportType:null==t?void 0:t.transportType};this.pending.set(e,n);const o=await this.rpcSubscribe(e,r,t);return"string"==typeof o&&(this.onSubscribe(o,n),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}})),o}catch(r){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(r),r}},this.unsubscribe=async(e,t)=>{await this.restartToComplete(),this.isInitialized(),typeof(null==t?void 0:t.id)<"u"?await this.unsubscribeById(e,t.id,t):await this.unsubscribeByTopic(e,t)},this.isSubscribed=async e=>{if(this.topics.includes(e))return!0;const t=`${this.pendingSubscriptionWatchLabel}_${e}`;return await new Promise(((r,n)=>{const o=new cjs$7.Watch;o.start(t);const i=setInterval((()=>{!this.pending.has(e)&&this.topics.includes(e)&&(clearInterval(i),o.stop(t),r(!0)),o.elapsed(t)>=pt$2&&(clearInterval(i),o.stop(t),n(new Error("Subscription resolution timeout")))}),this.pollingInterval)})).catch((()=>!1))},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=E$5(t,this.name),this.clientId=""}get context(){return y$7(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let r=!1;try{r=this.getSubscription(e).topic===t}catch{}return r}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const r=this.topicMap.get(e);await Promise.all(r.map((async r=>await this.unsubscribeById(e,r,t))))}async unsubscribeById(e,t,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}});try{const n=Ir$1(r);await this.rpcUnsubscribe(e,t,n);const o=U$2("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,o),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(e,t,r){var n;(null==r?void 0:r.transportType)===M$3.relay&&await this.restartToComplete();const o={method:jr$1(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:o});const i=null==(n=null==r?void 0:r.internal)?void 0:n.throwOnFailedPublish;try{const t=yr$1(e+this.clientId);if((null==r?void 0:r.transportType)===M$3.link_mode)return setTimeout((()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(o).catch((e=>this.logger.warn(e)))}),cjs$7.toMiliseconds(cjs$7.ONE_SECOND)),t;const n=await kt$1(this.relayer.request(o).catch((e=>this.logger.warn(e))),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!n&&i)throw new Error(`Subscribing to ${e} failed, please try again`);return n?t:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(v$4.connection_stalled),i)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t={method:jr$1(e[0].relay.protocol).batchSubscribe,params:{topics:e.map((e=>e.topic))}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:t});try{return await await kt$1(this.relayer.request(t).catch((e=>this.logger.warn(e))),this.subscribeTimeout)}catch{this.relayer.events.emit(v$4.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const t={method:jr$1(e[0].relay.protocol).batchFetchMessages,params:{topics:e.map((e=>e.topic))}};let r;this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:t});try{r=await await kt$1(this.relayer.request(t).catch((e=>this.logger.warn(e))),this.subscribeTimeout)}catch{this.relayer.events.emit(v$4.connection_stalled)}return r}rpcUnsubscribe(e,t,r){const n={method:jr$1(r.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.request(n)}onSubscribe(e,t){this.setSubscription(e,we$1(W$1({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach((e=>{this.setSubscription(e.id,W$1({},e)),this.pending.delete(e.topic)}))}async onUnsubscribe(e,t,r){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,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,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,W$1({},t)),this.topicMap.set(t.topic,e),this.events.emit(O$2.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:t}=S$6("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const r=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(r.topic,e),this.events.emit(O$2.deleted,we$1(W$1({},r),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(O$2.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t<e;t++){const e=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchFetchMessages(e),await this.batchSubscribe(e)}}this.events.emit(O$2.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:e}=S$6("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e2){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e2)}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);L$4(t)&&this.onBatchSubscribe(t.map(((t,r)=>we$1(W$1({},e[r]),{id:t}))))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const t=await this.rpcBatchFetchMessages(e);t&&t.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(t.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach((t=>{e.push(t)})),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(r$6.pulse,(async()=>{await this.checkPending()})),this.events.on(O$2.created,(async e=>{const t=O$2.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})),this.events.on(O$2.deleted,(async e=>{const t=O$2.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}))}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise((e=>{const t=setInterval((()=>{this.restartInProgress||(clearInterval(t),e())}),this.pollingInterval)}))}}var on=Object.defineProperty,Zt=Object.getOwnPropertySymbols,an=Object.prototype.hasOwnProperty,hn=Object.prototype.propertyIsEnumerable,Qt=(e,t,r)=>t in e?on(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ei=(e,t)=>{for(var r in t||(t={}))an.call(t,r)&&Qt(e,r,t[r]);if(Zt)for(var r of Zt(t))hn.call(t,r)&&Qt(e,r,t[r]);return e};class ti extends u$4{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new eventsExports.EventEmitter,this.name=ot$1,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=cjs$7.toMiliseconds(cjs$7.THIRTY_SECONDS+cjs$7.ONE_SECOND),this.request=async e=>{var t,r;this.logger.debug("Publishing Request Payload");const n=e.id||getBigIntRpcId().toString();await this.toEstablishConnection();try{const o=this.provider.request(e);this.requestsInFlight.set(n,{promise:o,request:e}),this.logger.trace({id:n,method:e.method,topic:null==(t=e.params)?void 0:t.topic},"relayer.request - attempt to publish...");const i=await new Promise((async(e,t)=>{const r=()=>{t(new Error(`relayer.request - publish interrupted, id: ${n}`))};this.provider.on(I$4.disconnect,r);const i=await o;this.provider.off(I$4.disconnect,r),e(i)}));return this.logger.trace({id:n,method:e.method,topic:null==(r=e.params)?void 0:r.topic},"relayer.request - published"),i}catch(o){throw this.logger.debug(`Failed to Publish Request: ${n}`),o}finally{this.requestsInFlight.delete(n)}},this.resetPingTimeout=()=>{if(ce())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout((()=>{var e,t,r;null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)||r.terminate()}),this.heartBeatTimeout)}catch(e){this.logger.warn(e)}},this.onPayloadHandler=e=>{this.onProviderPayload(e),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(v$4.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=e=>{this.logger.error(e),this.events.emit(v$4.error,e),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(I$4.payload,this.onPayloadHandler),this.provider.on(I$4.connect,this.onConnectHandler),this.provider.on(I$4.disconnect,this.onDisconnectHandler),this.provider.on(I$4.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&"string"!=typeof e.logger?E$5(e.logger,this.name):_i(k$5({level:e.logger||nt$1})),this.messages=new Yt(this.logger,e.core),this.subscriber=new Wt(this,this.logger),this.publisher=new Zr(this,this.logger),this.relayUrl=(null==e?void 0:e.relayUrl)||be$1,this.projectId=e.projectId,this.bundleId=Ot$1(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e2){this.logger.warn(e2)}}get context(){return y$7(this.logger)}get connected(){var e,t,r;return 1===(null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:r.readyState)}get connecting(){var e,t,r;return 0===(null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:r.readyState)}async publish(e,t,r){this.isInitialized(),await this.publisher.publish(e,t,r),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:M$3.relay})}async subscribe(e,t){var r,n,o;this.isInitialized(),"relay"===(null==t?void 0:t.transportType)&&await this.toEstablishConnection();const i=typeof(null==(r=null==t?void 0:t.internal)?void 0:r.throwOnFailedPublish)>"u"||(null==(n=null==t?void 0:t.internal)?void 0:n.throwOnFailedPublish);let a,s=(null==(o=this.subscriber.topicMap.get(e))?void 0:o[0])||"";const c=t=>{t.topic===e&&(this.subscriber.off(O$2.created,c),a())};return await Promise.all([new Promise((e=>{a=e,this.subscriber.on(O$2.created,c)})),new Promise((async(r,n)=>{s=await this.subscriber.subscribe(e,ei({internal:{throwOnFailedPublish:i}},t)).catch((e=>{i&&n(e)}))||s,r()}))]),s}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map((e=>e.promise)))}catch(e2){this.logger.warn(e2)}this.hasExperiencedNetworkDisruption||this.connected?await kt$1(this.provider.disconnect(),2e3,"provider.disconnect()").catch((()=>this.onProviderDisconnect())):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise((async(e,t)=>{const r=()=>{this.provider.off(I$4.disconnect,r),t(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(I$4.disconnect,r),await kt$1(this.provider.connect(),cjs$7.toMiliseconds(cjs$7.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch((e=>{t(e)})).finally((()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0})),this.subscriber.start().catch((e=>{this.logger.error(e),this.onDisconnectHandler()})),this.hasExperiencedNetworkDisruption=!1,e()}))}catch(t){this.logger.error(t);const e=t;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(e.message))throw t}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!(await mo()))throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(0===(null==e?void 0:e.length))return void this.logger.trace("Batch message events is empty. Ignoring...");const t=e.sort(((e,t)=>e.publishedAt-t.publishedAt));this.logger.trace(`Batch of ${t.length} message events sorted`);for(const n of t)try{await this.onMessageEvent(n)}catch(r){this.logger.warn(r)}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){const{topic:r}=e;if(!t.sessionExists){const e={topic:r,expiry:Mt$1(cjs$7.FIVE_MINUTES),relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(r,e)}this.events.emit(v$4.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,t,r,n,o;if(ce())try{null!=(t=null==(e=this.provider)?void 0:e.connection)&&t.socket&&(null==(o=null==(n=null==(r=this.provider)?void 0:r.connection)?void 0:n.socket)||o.once("ping",(()=>{this.resetPingTimeout()}))),this.resetPingTimeout()}catch(i){this.logger.warn(i)}}isConnectionStalled(e){return this.staleConnectionErrors.some((t=>e.includes(t)))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new o$8(new f$5($t$1({sdkVersion:se,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:r}=e;await this.messages.set(t,r)}async shouldIgnoreMessageEvent(e){const{topic:t,message:r}=e;if(!r||0===r.length)return this.logger.debug(`Ignoring invalid/empty message: ${r}`),!0;if(!(await this.subscriber.isSubscribed(t)))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const n=this.messages.has(t,r);return n&&this.logger.debug(`Ignoring duplicate message: ${r}`),n}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),isJsonRpcRequest(e)){if(!e.method.endsWith(at$1))return;const t=e.params,{topic:r,message:n,publishedAt:o,attestation:i}=t.data,a={topic:r,message:n,publishedAt:o,transportType:M$3.relay,attestation:i};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(ei({type:"event",event:t.id},a)),this.events.emit(t.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else isJsonRpcResponse(e)&&this.events.emit(v$4.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(v$4.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=formatJsonRpcResult(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(I$4.payload,this.onPayloadHandler),this.provider.off(I$4.connect,this.onConnectHandler),this.provider.off(I$4.disconnect,this.onDisconnectHandler),this.provider.off(I$4.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await mo();ho((async t=>{e!==t&&(e=t,t?await this.restartTransport().catch((e=>this.logger.error(e))):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}))}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(v$4.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout((async()=>{await this.transportOpen().catch((e=>this.logger.error(e)))}),cjs$7.toMiliseconds(ht$1))))}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise((e=>{const t=setInterval((()=>{this.connected&&(clearInterval(t),e())}),this.connectionStatusPollingInterval)})),await this.transportOpen())}}var cn=Object.defineProperty,ii=Object.getOwnPropertySymbols,ln=Object.prototype.hasOwnProperty,un=Object.prototype.propertyIsEnumerable,si=(e,t,r)=>t in e?cn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ri=(e,t)=>{for(var r in t||(t={}))ln.call(t,r)&&si(e,r,t[r]);if(ii)for(var r of ii(t))un.call(t,r)&&si(e,r,t[r]);return e};class ni extends p$3{constructor(e,t,r,n=x$4,o=void 0){super(e,t,r,n),this.core=e,this.logger=t,this.name=r,this.map=new Map,this.version=ct$1,this.cached=[],this.initialized=!1,this.storagePrefix=x$4,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>{this.getKey&&null!==e&&!I$5(e)?this.map.set(this.getKey(e),e):Yr$1(e)?this.map.set(e.id,e):Qr$1(e)&&this.map.set(e.topic,e)})),this.cached=[],this.initialized=!0)},this.set=async(e,t)=>{this.isInitialized(),this.map.has(e)?await this.update(e,t):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:e,value:t}),this.map.set(e,t),await this.persist())},this.get=e=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:e}),this.getData(e)),this.getAll=e=>(this.isInitialized(),e?this.values.filter((t=>Object.keys(e).every((r=>ys$1(t[r],e[r]))))):this.values),this.update=async(e,t)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:e,update:t});const r=ri(ri({},this.getData(e)),t);this.map.set(e,r),await this.persist()},this.delete=async(e,t)=>{this.isInitialized(),this.map.has(e)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:e,reason:t}),this.map.delete(e),this.addToRecentlyDeleted(e),await this.persist())},this.logger=E$5(t,this.name),this.storagePrefix=n,this.getKey=o}get context(){return y$7(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){const{message:t}=S$6("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(t),new Error(t)}const{message:t}=S$6("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),new Error(t)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:e}=S$6("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e2){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e2)}}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}}class oi{constructor(e,t){this.core=e,this.logger=t,this.name=gt$1,this.version=yt$1,this.events=new mi,this.initialized=!1,this.storagePrefix=x$4,this.ignoredPayloadTypes=[D$5],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:e})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...e])]},this.create=async e=>{this.isInitialized();const t=pr$1(),r=await this.core.crypto.setSymKey(t),n=Mt$1(cjs$7.FIVE_MINUTES),o={protocol:rt$1},i={topic:r,expiry:n,relay:o,active:!1,methods:null==e?void 0:e.methods},a=Dr$1({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:t,relay:o,expiryTimestamp:n,methods:null==e?void 0:e.methods});return this.events.emit(V$2.create,i),this.core.expirer.set(r,n),await this.pairings.set(r,i),await this.core.relayer.subscribe(r,{transportType:null==e?void 0:e.transportType}),{topic:r,uri:a}},this.pair=async e=>{this.isInitialized();const t=this.core.eventClient.createEvent({properties:{topic:null==e?void 0:e.uri,trace:[z$5.pairing_started]}});this.isValidPair(e,t);const{topic:r,symKey:n,relay:o,expiryTimestamp:i,methods:a}=kr$1(e.uri);let s;if(t.props.properties.topic=r,t.addTrace(z$5.pairing_uri_validation_success),t.addTrace(z$5.pairing_uri_not_expired),this.pairings.keys.includes(r)){if(s=this.pairings.get(r),t.addTrace(z$5.existing_pairing),s.active)throw t.setError($$3.active_pairing_already_exists),new Error(`Pairing already exists: ${r}. Please try again with a new connection URI.`);t.addTrace(z$5.pairing_not_expired)}const c=i||Mt$1(cjs$7.FIVE_MINUTES),u={topic:r,relay:o,expiry:c,active:!1,methods:a};this.core.expirer.set(r,c),await this.pairings.set(r,u),t.addTrace(z$5.store_new_pairing),e.activatePairing&&await this.activate({topic:r}),this.events.emit(V$2.create,u),t.addTrace(z$5.emit_inactive_pairing),this.core.crypto.keychain.has(r)||await this.core.crypto.setSymKey(n,r),t.addTrace(z$5.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{t.setError($$3.no_internet_connection)}try{await this.core.relayer.subscribe(r,{relay:o})}catch(l){throw t.setError($$3.subscribe_pairing_topic_failure),l}return t.addTrace(z$5.subscribe_pairing_topic_success),u},this.activate=async({topic:e})=>{this.isInitialized();const t=Mt$1(cjs$7.THIRTY_DAYS);this.core.expirer.set(e,t),await this.pairings.update(e,{active:!0,expiry:t})},this.ping=async e=>{this.isInitialized(),await this.isValidPing(e);const{topic:t}=e;if(this.pairings.keys.includes(t)){const e=await this.sendRequest(t,"wc_pairingPing",{}),{done:r,resolve:n,reject:o}=_t$1();this.events.once(Lt$1("pairing_ping",e),(({error:e})=>{e?o(e):n()})),await r()}},this.updateExpiry=async({topic:e,expiry:t})=>{this.isInitialized(),await this.pairings.update(e,{expiry:t})},this.updateMetadata=async({topic:e,metadata:t})=>{this.isInitialized(),await this.pairings.update(e,{peerMetadata:t})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async e=>{this.isInitialized(),await this.isValidDisconnect(e);const{topic:t}=e;this.pairings.keys.includes(t)&&(await this.sendRequest(t,"wc_pairingDelete",U$2("USER_DISCONNECTED")),await this.deletePairing(t))},this.formatUriFromPairing=e=>{this.isInitialized();const{topic:t,relay:r,expiry:n,methods:o}=e,i=this.core.crypto.keychain.get(t);return Dr$1({protocol:this.core.protocol,version:this.core.version,topic:t,symKey:i,relay:r,expiryTimestamp:n,methods:o})},this.sendRequest=async(e,t,r)=>{const n=formatJsonRpcRequest(t,r),o=await this.core.crypto.encode(e,n),i=B$2[t].req;return this.core.history.set(e,n),this.core.relayer.publish(e,o,i),n.id},this.sendResult=async(e,t,r)=>{const n=formatJsonRpcResult(e,r),o=await this.core.crypto.encode(t,n),i=await this.core.history.get(t,e),a=B$2[i.request.method].res;await this.core.relayer.publish(t,o,a),await this.core.history.resolve(n)},this.sendError=async(e,t,r)=>{const n=formatJsonRpcError(e,r),o=await this.core.crypto.encode(t,n),i=await this.core.history.get(t,e),a=B$2[i.request.method]?B$2[i.request.method].res:B$2.unregistered_method.res;await this.core.relayer.publish(t,o,a),await this.core.history.resolve(n)},this.deletePairing=async(e,t)=>{await this.core.relayer.unsubscribe(e),await Promise.all([this.pairings.delete(e,U$2("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(e),t?Promise.resolve():this.core.expirer.del(e)])},this.cleanup=async()=>{const e=this.pairings.getAll().filter((e=>Kt$1(e.expiry)));await Promise.all(e.map((e=>this.deletePairing(e.topic))))},this.onRelayEventRequest=e=>{const{topic:t,payload:r}=e;switch(r.method){case"wc_pairingPing":return this.onPairingPingRequest(t,r);case"wc_pairingDelete":return this.onPairingDeleteRequest(t,r);default:return this.onUnknownRpcMethodRequest(t,r)}},this.onRelayEventResponse=async e=>{const{topic:t,payload:r}=e,n=(await this.core.history.get(t,r.id)).request.method;return"wc_pairingPing"===n?this.onPairingPingResponse(t,r):this.onUnknownRpcMethodResponse(n)},this.onPairingPingRequest=async(e,t)=>{const{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult(r,e,!0),this.events.emit(V$2.ping,{id:r,topic:e})}catch(n){await this.sendError(r,e,n),this.logger.error(n)}},this.onPairingPingResponse=(e,t)=>{const{id:r}=t;setTimeout((()=>{isJsonRpcResult(t)?this.events.emit(Lt$1("pairing_ping",r),{}):isJsonRpcError(t)&&this.events.emit(Lt$1("pairing_ping",r),{error:t.error})}),500)},this.onPairingDeleteRequest=async(e,t)=>{const{id:r}=t;try{this.isValidDisconnect({topic:e}),await this.deletePairing(e),this.events.emit(V$2.delete,{id:r,topic:e})}catch(n){await this.sendError(r,e,n),this.logger.error(n)}},this.onUnknownRpcMethodRequest=async(e,t)=>{const{id:r,method:n}=t;try{if(this.registeredMethods.includes(n))return;const t=U$2("WC_METHOD_UNSUPPORTED",n);await this.sendError(r,e,t),this.logger.error(t)}catch(o){await this.sendError(r,e,o),this.logger.error(o)}},this.onUnknownRpcMethodResponse=e=>{this.registeredMethods.includes(e)||this.logger.error(U$2("WC_METHOD_UNSUPPORTED",e))},this.isValidPair=(e,t)=>{var r;if(!to(e)){const{message:r}=S$6("MISSING_OR_INVALID",`pair() params: ${e}`);throw t.setError($$3.malformed_pairing_uri),new Error(r)}if(!Gr$1(e.uri)){const{message:r}=S$6("MISSING_OR_INVALID",`pair() uri: ${e.uri}`);throw t.setError($$3.malformed_pairing_uri),new Error(r)}const n=kr$1(null==e?void 0:e.uri);if(null==(r=null==n?void 0:n.relay)||!r.protocol){const{message:e}=S$6("MISSING_OR_INVALID","pair() uri#relay-protocol");throw t.setError($$3.malformed_pairing_uri),new Error(e)}if(null==n||!n.symKey){const{message:e}=S$6("MISSING_OR_INVALID","pair() uri#symKey");throw t.setError($$3.malformed_pairing_uri),new Error(e)}if(null!=n&&n.expiryTimestamp&&cjs$7.toMiliseconds(null==n?void 0:n.expiryTimestamp)<Date.now()){t.setError($$3.pairing_expired);const{message:e}=S$6("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(e)}},this.isValidPing=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidDisconnect=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidPairingTopic=async e=>{if(!b$4(e,!1)){const{message:t}=S$6("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.pairings.keys.includes(e)){const{message:t}=S$6("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(Kt$1(this.pairings.get(e).expiry)){await this.deletePairing(e);const{message:t}=S$6("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}},this.core=e,this.logger=E$5(t,this.name),this.pairings=new ni(this.core,this.logger,this.name,this.storagePrefix)}get context(){return y$7(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(v$4.message,(async e=>{const{topic:t,message:r,transportType:n}=e;if(!this.pairings.keys.includes(t)||n===M$3.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))return;const o=await this.core.crypto.decode(t,r);try{isJsonRpcRequest(o)?(this.core.history.set(t,o),this.onRelayEventRequest({topic:t,payload:o})):isJsonRpcResponse(o)&&(await this.core.history.resolve(o),await this.onRelayEventResponse({topic:t,payload:o}),this.core.history.delete(t,o.id))}catch(i){this.logger.error(i)}}))}registerExpirerEvents(){this.core.expirer.on(S$4.expired,(async e=>{const{topic:t}=Vt$1(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(V$2.expire,{topic:t}))}))}}class ai extends h$6{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new eventsExports.EventEmitter,this.name=Dt,this.version=mt,this.cached=[],this.initialized=!1,this.storagePrefix=x$4,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>this.records.set(e.id,e))),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(e,t,r)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:e,request:t,chainId:r}),this.records.has(t.id))return;const n={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:r,expiry:Mt$1(cjs$7.THIRTY_DAYS)};this.records.set(n.id,n),this.persist(),this.events.emit(P$3.created,n)},this.resolve=async e=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:e}),!this.records.has(e.id))return;const t=await this.getRecord(e.id);typeof t.response>"u"&&(t.response=isJsonRpcError(e)?{error:e.error}:{result:e.result},this.records.set(t.id,t),this.persist(),this.events.emit(P$3.updated,t))},this.get=async(e,t)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:e,id:t}),await this.getRecord(t)),this.delete=(e,t)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:t}),this.values.forEach((r=>{if(r.topic===e){if(typeof t<"u"&&r.id!==t)return;this.records.delete(r.id),this.events.emit(P$3.deleted,r)}})),this.persist()},this.exists=async(e,t)=>(this.isInitialized(),!!this.records.has(t)&&(await this.getRecord(t)).topic===e),this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=E$5(t,this.name)}get context(){return y$7(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach((t=>{if(typeof t.response<"u")return;const r={topic:t.topic,request:formatJsonRpcRequest(t.request.method,t.request.params,t.id),chainId:t.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 t=this.records.get(e);if(!t){const{message:t}=S$6("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(P$3.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:e}=S$6("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e2){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e2)}}registerEventListeners(){this.events.on(P$3.created,(e=>{const t=P$3.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})})),this.events.on(P$3.updated,(e=>{const t=P$3.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})})),this.events.on(P$3.deleted,(e=>{const t=P$3.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})})),this.core.heartbeat.on(r$6.pulse,(()=>{this.cleanup()}))}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach((t=>{cjs$7.toMiliseconds(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(P$3.deleted,t,!1),e=!0)})),e&&this.persist()}catch(e2){this.logger.warn(e2)}}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}}class hi extends x$5{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new eventsExports.EventEmitter,this.name=bt,this.version=ft,this.cached=[],this.initialized=!1,this.storagePrefix=x$4,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>this.expirations.set(e.target,e))),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=e=>{try{const t=this.formatTarget(e);return typeof this.getExpiration(t)<"u"}catch{return!1}},this.set=(e,t)=>{this.isInitialized();const r=this.formatTarget(e),n={target:r,expiry:t};this.expirations.set(r,n),this.checkExpiry(r,n),this.events.emit(S$4.created,{target:r,expiration:n})},this.get=e=>{this.isInitialized();const t=this.formatTarget(e);return this.getExpiration(t)},this.del=e=>{if(this.isInitialized(),this.has(e)){const t=this.formatTarget(e),r=this.getExpiration(t);this.expirations.delete(t),this.events.emit(S$4.deleted,{target:t,expiration:r})}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=E$5(t,this.name)}get context(){return y$7(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("string"==typeof e)return Dt$1(e);if("number"==typeof e)return xt$1(e);const{message:t}=S$6("UNKNOWN_TYPE","Target type: "+typeof e);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(S$4.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:e}=S$6("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e2){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e2)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:t}=S$6("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(t),new Error(t)}return t}checkExpiry(e,t){const{expiry:r}=t;cjs$7.toMiliseconds(r)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(S$4.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach(((e,t)=>this.checkExpiry(t,e)))}registerEventListeners(){this.core.heartbeat.on(r$6.pulse,(()=>this.checkExpirations())),this.events.on(S$4.created,(e=>{const t=S$4.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})),this.events.on(S$4.expired,(e=>{const t=S$4.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})),this.events.on(S$4.deleted,(e=>{const t=S$4.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}))}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}}class ci extends y$6{constructor(e,t,r){super(e,t,r),this.core=e,this.logger=t,this.store=r,this.name=_t,this.verifyUrlV3=vt,this.storagePrefix=x$4,this.version=De,this.init=async()=>{var e;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&cjs$7.toMiliseconds(null==(e=this.publicKey)?void 0:e.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))},this.register=async e=>{if(!V$3()||this.isDevEnv)return;const t=window.location.origin,{id:r,decryptedId:n}=e,o=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${t}&id=${r}&decryptedId=${n}`;try{const e=getDocument_1$1(),t=this.startAbortTimer(5*cjs$7.ONE_SECOND),n=await new Promise(((n,i)=>{const a=()=>{window.removeEventListener("message",c),e.body.removeChild(s),i("attestation aborted")};this.abortController.signal.addEventListener("abort",a);const s=e.createElement("iframe");s.src=o,s.style.display="none",s.addEventListener("error",a,{signal:this.abortController.signal});const c=o=>{if(o.data&&"string"==typeof o.data)try{const i=JSON.parse(o.data);if("verify_attestation"===i.type){if(decodeJWT(i.attestation).payload.id!==r)return;clearInterval(t),e.body.removeChild(s),this.abortController.signal.removeEventListener("abort",a),window.removeEventListener("message",c),n(null===i.attestation?"":i.attestation)}}catch(i){this.logger.warn(i)}};e.body.appendChild(s),window.addEventListener("message",c,{signal:this.abortController.signal})}));return this.logger.debug("jwt attestation",n),n}catch(i){this.logger.warn(i)}return""},this.resolve=async e=>{if(this.isDevEnv)return"";const{attestationId:t,hash:r,encryptedId:n}=e;if(""===t)return void this.logger.debug("resolve: attestationId is empty, skipping");if(t){if(decodeJWT(t).payload.id!==n)return;const e=await this.isValidJwtAttestation(t);if(e)return e.isVerified?e:void this.logger.warn("resolve: jwt attestation: origin url not verified")}if(!r)return;const o=this.getVerifyUrl(null==e?void 0:e.verifyUrl);return this.fetchAttestation(r,o)},this.fetchAttestation=async(e,t)=>{this.logger.debug(`resolving attestation: ${e} from url: ${t}`);const r=this.startAbortTimer(5*cjs$7.ONE_SECOND),n=await fetch(`${t}/attestation/${e}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(r),200===n.status?await n.json():void 0},this.getVerifyUrl=e=>{let t=e||J$1;return wt.includes(t)||(this.logger.info(`verify url: ${t}, not included in trusted list, assigning default: ${J$1}`),t=J$1),t},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const e=this.startAbortTimer(cjs$7.FIVE_SECONDS),t=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(e),await t.json()}catch(e){this.logger.warn(e)}},this.persistPublicKey=async e=>{this.logger.debug("persisting public key to local storage",e),await this.store.setItem(this.storeKey,e),this.publicKey=e},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async e=>{const t=await this.getPublicKey();try{if(t)return this.validateAttestation(e,t)}catch(n){this.logger.error(n),this.logger.warn("error validating attestation")}const r=await this.fetchAndPersistPublicKey();try{if(r)return this.validateAttestation(e,r)}catch(n){this.logger.error(n),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise((async e=>{const t=await this.fetchPublicKey();t&&(await this.persistPublicKey(t),e(t))}));const e=await this.fetchPromise;return this.fetchPromise=void 0,e},this.validateAttestation=(e,t)=>{const r=Rr$1(e,t.publicKey),n={hasExpired:cjs$7.toMiliseconds(r.exp)<Date.now(),payload:r};if(n.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:n.payload.origin,isScam:n.payload.isScam,isVerified:n.payload.isVerified}},this.logger=E$5(t,this.name),this.abortController=new AbortController,this.isDevEnv=Wt$1(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return y$7(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout((()=>this.abortController.abort()),cjs$7.toMiliseconds(e))}}class li extends v$5{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context=It,this.registerDeviceToken=async e=>{const{clientId:t,token:r,notificationType:n,enableEncrypted:o=!1}=e,i=`${Tt}/${this.projectId}/clients`;await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:t,type:n,token:r,always_raw:o})})},this.logger=E$5(t,this.context)}}var dn=Object.defineProperty,ui=Object.getOwnPropertySymbols,pn=Object.prototype.hasOwnProperty,gn=Object.prototype.propertyIsEnumerable,di=(e,t,r)=>t in e?dn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Z$2=(e,t)=>{for(var r in t||(t={}))pn.call(t,r)&&di(e,r,t[r]);if(ui)for(var r of ui(t))gn.call(t,r)&&di(e,r,t[r]);return e};class pi extends C$5{constructor(e,t,r=!0){super(e,t,r),this.core=e,this.logger=t,this.context=Pt,this.storagePrefix=x$4,this.storageVersion=Ct,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!Wt$1())try{const e={eventId:Ht$1(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Ge(this.core.relayer.protocol,this.core.relayer.version,se)}}};await this.sendEvent([e])}catch(e){this.logger.warn(e)}},this.createEvent=e=>{const{event:t="ERROR",type:r="",properties:{topic:n,trace:o}}=e,i=Ht$1(),a=this.core.projectId||"",s=Date.now(),c=Z$2({eventId:i,timestamp:s,props:{event:t,type:r,properties:{topic:n,trace:o}},bundleId:a,domain:this.getAppDomain()},this.setMethods(i));return this.telemetryEnabled&&(this.events.set(i,c),this.shouldPersist=!0),c},this.getEvent=e=>{const{eventId:t,topic:r}=e;if(t)return this.events.get(t);const n=Array.from(this.events.values()).find((e=>e.props.properties.topic===r));return n?Z$2(Z$2({},n),this.setMethods(n.eventId)):void 0},this.deleteEvent=e=>{const{eventId:t}=e;this.events.delete(t),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(r$6.pulse,(async()=>{this.shouldPersist&&await this.persist(),this.events.forEach((e=>{cjs$7.fromMiliseconds(Date.now())-cjs$7.fromMiliseconds(e.timestamp)>St&&(this.events.delete(e.eventId),this.shouldPersist=!0)}))}))},this.setMethods=e=>({addTrace:t=>this.addTrace(e,t),setError:t=>this.setError(e,t)}),this.addTrace=(e,t)=>{const r=this.events.get(e);r&&(r.props.properties.trace.push(t),this.events.set(e,r),this.shouldPersist=!0)},this.setError=(e,t)=>{const r=this.events.get(e);r&&(r.props.type=t,r.timestamp=Date.now(),this.events.set(e,r),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const e=await this.core.storage.getItem(this.storageKey)||[];if(!e.length)return;e.forEach((e=>{this.events.set(e.eventId,Z$2(Z$2({},e),this.setMethods(e.eventId)))}))}catch(e){this.logger.warn(e)}},this.submit=async()=>{if(!this.telemetryEnabled||0===this.events.size)return;const e=[];for(const[r,n]of this.events)n.props.type&&e.push(n);if(0!==e.length)try{if((await this.sendEvent(e)).ok)for(const t of e)this.events.delete(t.eventId),this.shouldPersist=!0}catch(t){this.logger.warn(t)}},this.sendEvent=async e=>{const t=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${Rt}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${se}${t}`,{method:"POST",body:JSON.stringify(e)})},this.getAppDomain=()=>Nt$1().url,this.logger=E$5(t,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 yn=Object.defineProperty,gi=Object.getOwnPropertySymbols,Dn=Object.prototype.hasOwnProperty,mn=Object.prototype.propertyIsEnumerable,yi=(e,t,r)=>t in e?yn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Di=(e,t)=>{for(var r in t||(t={}))Dn.call(t,r)&&yi(e,r,t[r]);if(gi)for(var r of gi(t))mn.call(t,r)&&yi(e,r,t[r]);return e};class ne extends n$7{constructor(e){var t;super(e),this.protocol=ye$1,this.version=De,this.name=ie,this.events=new eventsExports.EventEmitter,this.initialized=!1,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.dispatchEnvelope=({topic:e,message:t,sessionExists:r})=>{if(!e||!t)return;const n={topic:e,message:t,publishedAt:Date.now(),transportType:M$3.link_mode};this.relayer.onLinkMessageEvent(n,{sessionExists:r})},this.projectId=null==e?void 0:e.projectId,this.relayUrl=(null==e?void 0:e.relayUrl)||be$1,this.customStoragePrefix=null!=e&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const r=k$5({level:"string"==typeof(null==e?void 0:e.logger)&&e.logger?e.logger:Ye.logger}),{logger:n,chunkLoggerController:o}=A$5({opts:r,maxSizeInBytes:null==e?void 0:e.maxLogBlobSizeInBytes,loggerOverride:null==e?void 0:e.logger});this.logChunkController=o,null!=(t=this.logChunkController)&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var e,t;null!=(e=this.logChunkController)&&e.downloadLogsBlobInBrowser&&(null==(t=this.logChunkController)||t.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=E$5(n,this.name),this.heartbeat=new i$7,this.crypto=new Ht(this,this.logger,null==e?void 0:e.keychain),this.history=new ai(this,this.logger),this.expirer=new hi(this,this.logger),this.storage=null!=e&&e.storage?e.storage:new h$7(Di(Di({},Je),null==e?void 0:e.storageOptions)),this.relayer=new ti({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new oi(this,this.logger),this.verify=new ci(this,this.logger,this.storage),this.echoClient=new li(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new pi(this,this.logger,null==e?void 0:e.telemetryEnabled)}static async init(e){const t=new ne(e);await t.initialize();const r=await t.crypto.getClientId();return await t.storage.setItem(lt$1,r),t}get context(){return y$7(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return null==(e=this.logChunkController)?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(fe,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(fe)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e2){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e2),this.logger.error(e2.message),e2}}}const bn=ne,be="wc",Ce=2,Le="client",ye=`${be}@${Ce}:${Le}:`,we={name:Le,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},xe="WALLETCONNECT_DEEPLINK_CHOICE",st="proposal",it="Proposal expired",rt="session",z$4=cjs$7.SEVEN_DAYS,nt="engine",v$3={wc_sessionPropose:{req:{ttl:cjs$7.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:cjs$7.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:cjs$7.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:cjs$7.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:cjs$7.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:cjs$7.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1104},res:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1106},res:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:cjs$7.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:cjs$7.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:cjs$7.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:cjs$7.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1112},res:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1114},res:{ttl:cjs$7.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:cjs$7.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:cjs$7.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:cjs$7.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:cjs$7.FIVE_MINUTES,prompt:!1,tag:1119}}},me={min:cjs$7.FIVE_MINUTES,max:cjs$7.SEVEN_DAYS},x$3={idle:"IDLE",active:"ACTIVE"},ot="request",at=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],ct="wc",lt="auth",pt$1="authKeys",ht="pairingTopics",dt="requests",oe=`${ct}@1.5:${lt}:`,ae=`${oe}:PUB_KEY`;var ys=Object.defineProperty,ws=Object.defineProperties,ms=Object.getOwnPropertyDescriptors,ut=Object.getOwnPropertySymbols,_s=Object.prototype.hasOwnProperty,Es=Object.prototype.propertyIsEnumerable,gt=(e,t,r)=>t in e?ys(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,I$3=(e,t)=>{for(var r in t||(t={}))_s.call(t,r)&>(e,r,t[r]);if(ut)for(var r of ut(t))Es.call(t,r)&>(e,r,t[r]);return e},D$4=(e,t)=>ws(e,ms(t));class Rs extends M$5{constructor(e){super(e),this.name=nt,this.events=new mi,this.initialized=!1,this.requestQueue={state:x$3.idle,queue:[]},this.sessionRequestQueue={state:x$3.idle,queue:[]},this.requestQueueDelay=cjs$7.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(v$3)}),this.initialized=!0,setTimeout((()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()}),cjs$7.toMiliseconds(this.requestQueueDelay)))},this.connect=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const t=D$4(I$3({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(t);const{pairingTopic:r,requiredNamespaces:n,optionalNamespaces:o,sessionProperties:i,relays:a}=t;let s,c=r,u=!1;try{c&&(u=this.client.core.pairing.pairings.get(c).active)}catch(b){throw this.client.logger.error(`connect() -> pairing.get(${c}) failed`),b}if(!c||!u){const{topic:e,uri:t}=await this.client.core.pairing.create();c=e,s=t}if(!c){const{message:e}=S$6("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw new Error(e)}const l=await this.client.core.crypto.generateKeyPair(),d=v$3.wc_sessionPropose.req.ttl||cjs$7.FIVE_MINUTES,f=Mt$1(d),h=I$3({requiredNamespaces:n,optionalNamespaces:o,relays:a??[{protocol:rt$1}],proposer:{publicKey:l,metadata:this.client.metadata},expiryTimestamp:f,pairingTopic:c},i&&{sessionProperties:i}),{reject:p,resolve:y,done:m}=_t$1(d,it);this.events.once(Lt$1("session_connect"),(async({error:e,session:t})=>{if(e)p(e);else if(t){t.self.publicKey=l;const e=D$4(I$3({},t),{pairingTopic:h.pairingTopic,requiredNamespaces:h.requiredNamespaces,optionalNamespaces:h.optionalNamespaces,transportType:M$3.relay});await this.client.session.set(t.topic,e),await this.setExpiry(t.topic,t.expiry),c&&await this.client.core.pairing.updateMetadata({topic:c,metadata:t.peer.metadata}),this.cleanupDuplicatePairings(e),y(e)}}));const g=await this.sendRequest({topic:c,method:"wc_sessionPropose",params:h,throwOnFailedPublish:!0});return await this.setProposal(g,I$3({id:g},h)),{uri:s,approval:m}},this.pair=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(t){throw this.client.logger.error("pair() failed"),t}},this.approve=async e=>{var t,r,n;const o=this.client.core.eventClient.createEvent({properties:{topic:null==(t=null==e?void 0:e.id)?void 0:t.toString(),trace:[Is$1.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(I){throw o.setError(Ts$1.no_internet_connection),I}try{await this.isValidProposalId(null==e?void 0:e.id)}catch(I){throw this.client.logger.error(`approve() -> proposal.get(${null==e?void 0:e.id}) failed`),o.setError(Ts$1.proposal_not_found),I}try{await this.isValidApprove(e)}catch(I){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(Ts$1.session_approve_namespace_validation_failure),I}const{id:i,relayProtocol:a,namespaces:s,sessionProperties:c,sessionConfig:u}=e,l=this.client.proposal.get(i);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:d,proposer:f,requiredNamespaces:h,optionalNamespaces:p}=l;let y=null==(r=this.client.core.eventClient)?void 0:r.getEvent({topic:d});y||(y=null==(n=this.client.core.eventClient)?void 0:n.createEvent({type:Is$1.session_approve_started,properties:{topic:d,trace:[Is$1.session_approve_started,Is$1.session_namespaces_validation_success]}}));const m=await this.client.core.crypto.generateKeyPair(),g=f.publicKey,b=await this.client.core.crypto.generateSharedKey(m,g),v=I$3(I$3({relay:{protocol:a??"irn"},namespaces:s,controller:{publicKey:m,metadata:this.client.metadata},expiry:Mt$1(z$4)},c&&{sessionProperties:c}),u&&{sessionConfig:u}),w=M$3.relay;y.addTrace(Is$1.subscribing_session_topic);try{await this.client.core.relayer.subscribe(b,{transportType:w})}catch(I){throw y.setError(Ts$1.subscribe_session_topic_failure),I}y.addTrace(Is$1.subscribe_session_topic_success);const _=D$4(I$3({},v),{topic:b,requiredNamespaces:h,optionalNamespaces:p,pairingTopic:d,acknowledged:!1,self:v.controller,peer:{publicKey:f.publicKey,metadata:f.metadata},controller:m,transportType:M$3.relay});await this.client.session.set(b,_),y.addTrace(Is$1.store_session);try{y.addTrace(Is$1.publishing_session_settle),await this.sendRequest({topic:b,method:"wc_sessionSettle",params:v,throwOnFailedPublish:!0}).catch((e=>{throw null==y||y.setError(Ts$1.session_settle_publish_failure),e})),y.addTrace(Is$1.session_settle_publish_success),y.addTrace(Is$1.publishing_session_approve),await this.sendResult({id:i,topic:d,result:{relay:{protocol:a??"irn"},responderPublicKey:m},throwOnFailedPublish:!0}).catch((e=>{throw null==y||y.setError(Ts$1.session_approve_publish_failure),e})),y.addTrace(Is$1.session_approve_publish_success)}catch(I){throw this.client.logger.error(I),this.client.session.delete(b,U$2("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(b),I}return this.client.core.eventClient.deleteEvent({eventId:y.eventId}),await this.client.core.pairing.updateMetadata({topic:d,metadata:f.metadata}),await this.client.proposal.delete(i,U$2("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:d}),await this.setExpiry(b,Mt$1(z$4)),{topic:b,acknowledged:()=>Promise.resolve(this.client.session.get(b))}},this.reject=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:t,reason:r}=e;let n;try{n=this.client.proposal.get(t).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${t}) failed`),o}n&&(await this.sendError({id:t,topic:n,error:r,rpcOpts:v$3.wc_sessionPropose.reject}),await this.client.proposal.delete(t,U$2("USER_DISCONNECTED")))},this.update=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(u){throw this.client.logger.error("update() -> isValidUpdate() failed"),u}const{topic:t,namespaces:r}=e,{done:n,resolve:o,reject:i}=_t$1(),a=payloadId(),s=getBigIntRpcId().toString(),c=this.client.session.get(t).namespaces;return this.events.once(Lt$1("session_update",a),(({error:e})=>{e?i(e):o()})),await this.client.session.update(t,{namespaces:r}),await this.sendRequest({topic:t,method:"wc_sessionUpdate",params:{namespaces:r},throwOnFailedPublish:!0,clientRpcId:a,relayRpcId:s}).catch((e=>{this.client.logger.error(e),this.client.session.update(t,{namespaces:c}),i(e)})),{acknowledged:n}},this.extend=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(a){throw this.client.logger.error("extend() -> isValidExtend() failed"),a}const{topic:t}=e,r=payloadId(),{done:n,resolve:o,reject:i}=_t$1();return this.events.once(Lt$1("session_extend",r),(({error:e})=>{e?i(e):o()})),await this.setExpiry(t,Mt$1(z$4)),this.sendRequest({topic:t,method:"wc_sessionExtend",params:{},clientRpcId:r,throwOnFailedPublish:!0}).catch((e=>{i(e)})),{acknowledged:n}},this.request=async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(f){throw this.client.logger.error("request() -> isValidRequest() failed"),f}const{chainId:t,request:r,topic:n,expiry:o=v$3.wc_sessionRequest.req.ttl}=e,i=this.client.session.get(n);(null==i?void 0:i.transportType)===M$3.relay&&await this.confirmOnlineStateOrThrow();const a=payloadId(),s=getBigIntRpcId().toString(),{done:c,resolve:u,reject:l}=_t$1(o,"Request expired. Please try again.");this.events.once(Lt$1("session_request",a),(({error:e,result:t})=>{e?l(e):u(t)}));const d=this.getAppLinkIfEnabled(i.peer.metadata,i.transportType);return d?(await this.sendRequest({clientRpcId:a,relayRpcId:s,topic:n,method:"wc_sessionRequest",params:{request:D$4(I$3({},r),{expiryTimestamp:Mt$1(o)}),chainId:t},expiry:o,throwOnFailedPublish:!0,appLink:d}).catch((e=>l(e))),this.client.events.emit("session_request_sent",{topic:n,request:r,chainId:t,id:a}),await c()):await Promise.all([new Promise((async e=>{await this.sendRequest({clientRpcId:a,relayRpcId:s,topic:n,method:"wc_sessionRequest",params:{request:D$4(I$3({},r),{expiryTimestamp:Mt$1(o)}),chainId:t},expiry:o,throwOnFailedPublish:!0}).catch((e=>l(e))),this.client.events.emit("session_request_sent",{topic:n,request:r,chainId:t,id:a}),e()})),new Promise((async e=>{var t;if(null==(t=i.sessionConfig)||!t.disableDeepLink){const e=await qt$1(this.client.core.storage,xe);await Ft$1({id:a,topic:n,wcDeepLink:e})}e()})),c()]).then((e=>e[2]))},this.respond=async e=>{this.isInitialized(),await this.isValidRespond(e);const{topic:t,response:r}=e,{id:n}=r,o=this.client.session.get(t);o.transportType===M$3.relay&&await this.confirmOnlineStateOrThrow();const i=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);isJsonRpcResult(r)?await this.sendResult({id:n,topic:t,result:r.result,throwOnFailedPublish:!0,appLink:i}):isJsonRpcError(r)&&await this.sendError({id:n,topic:t,error:r.error,appLink:i}),this.cleanupAfterResponse(e)},this.ping=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(r){throw this.client.logger.error("ping() -> isValidPing() failed"),r}const{topic:t}=e;if(this.client.session.keys.includes(t)){const e=payloadId(),r=getBigIntRpcId().toString(),{done:n,resolve:o,reject:i}=_t$1();this.events.once(Lt$1("session_ping",e),(({error:e})=>{e?i(e):o()})),await Promise.all([this.sendRequest({topic:t,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:e,relayRpcId:r}),n()])}else this.client.core.pairing.pairings.keys.includes(t)&&await this.client.core.pairing.ping({topic:t})},this.emit=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);const{topic:t,event:r,chainId:n}=e,o=getBigIntRpcId().toString();await this.sendRequest({topic:t,method:"wc_sessionEvent",params:{event:r,chainId:n},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);const{topic:t}=e;if(this.client.session.keys.includes(t))await this.sendRequest({topic:t,method:"wc_sessionDelete",params:U$2("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:t,emitEvent:!1});else{if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:e}=S$6("MISMATCHED_TOPIC",`Session or pairing topic not found: ${t}`);throw new Error(e)}await this.client.core.pairing.disconnect({topic:t})}},this.find=e=>(this.isInitialized(),this.client.session.getAll().filter((t=>zr$1(t,e)))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(e,t)=>{var r;this.isInitialized(),this.isValidAuthenticate(e);const n=t&&this.client.core.linkModeSupportedApps.includes(t)&&(null==(r=this.client.metadata.redirect)?void 0:r.linkMode),o=n?M$3.link_mode:M$3.relay;o===M$3.relay&&await this.confirmOnlineStateOrThrow();const{chains:i,statement:a="",uri:s,domain:c,nonce:u,type:l,exp:d,nbf:f,methods:h=[],expiry:p}=e,y=[...e.resources||[]],{topic:m,uri:g}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:m,uri:g}});const b=await this.client.core.crypto.generateKeyPair(),v=hr$1(b);if(await Promise.all([this.client.auth.authKeys.set(ae,{responseTopic:v,publicKey:b}),this.client.auth.pairingTopics.set(v,{topic:v,pairingTopic:m})]),await this.client.core.relayer.subscribe(v,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${m}`),h.length>0){const{namespace:e}=re$1(i[0]);let t=ir$1(e,"request",h);Y$1(y)&&(t=cr$1(t,y.pop())),y.push(t)}const w=p&&p>v$3.wc_sessionAuthenticate.req.ttl?p:v$3.wc_sessionAuthenticate.req.ttl,_={authPayload:{type:l??"caip122",chains:i,statement:a,aud:s,domain:c,version:"1",nonce:u,iat:(new Date).toISOString(),exp:d,nbf:f,resources:y},requester:{publicKey:b,metadata:this.client.metadata},expiryTimestamp:Mt$1(w)},I={requiredNamespaces:{},optionalNamespaces:{eip155:{chains:i,methods:[...new Set(["personal_sign",...h])],events:["chainChanged","accountsChanged"]}},relays:[{protocol:"irn"}],pairingTopic:m,proposer:{publicKey:b,metadata:this.client.metadata},expiryTimestamp:Mt$1(v$3.wc_sessionPropose.req.ttl)},{done:T,resolve:k,reject:$}=_t$1(w,"Request expired"),S=async({error:e,session:t})=>{if(this.events.off(Lt$1("session_request",E),A),e)$(e);else if(t){t.self.publicKey=b,await this.client.session.set(t.topic,t),await this.setExpiry(t.topic,t.expiry),m&&await this.client.core.pairing.updateMetadata({topic:m,metadata:t.peer.metadata});const e=this.client.session.get(t.topic);await this.deleteProposal(C),k({session:e})}},A=async e=>{var r,n,i;if(await this.deletePendingAuthRequest(E,{message:"fulfilled",code:0}),e.error){const t=U$2("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return e.error.code===t.code?void 0:(this.events.off(Lt$1("session_connect"),S),$(e.error.message))}await this.deleteProposal(C),this.events.off(Lt$1("session_connect"),S);const{cacaos:a,responder:s}=e.result,c=[],u=[];for(const t of a){await nr$1({cacao:t,projectId:this.client.core.projectId})||(this.client.logger.error(t,"Signature verification failed"),$(U$2("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:e}=t,r=Y$1(e.resources),n=[ln$1(e.iss)],o=fe$1(e.iss);if(r){const e=ar$1(r),t=ur$1(r);c.push(...e),n.push(...t)}for(const t of n)u.push(`${t}:${o}`)}const l=await this.client.core.crypto.generateSharedKey(b,s.publicKey);let d;c.length>0&&(d={topic:l,acknowledged:!0,self:{publicKey:b,metadata:this.client.metadata},peer:s,controller:s.publicKey,expiry:Mt$1(z$4),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:m,namespaces:Jr$1([...new Set(c)],[...new Set(u)]),transportType:o},await this.client.core.relayer.subscribe(l,{transportType:o}),await this.client.session.set(l,d),m&&await this.client.core.pairing.updateMetadata({topic:m,metadata:s.metadata}),d=this.client.session.get(l)),null!=(r=this.client.metadata.redirect)&&r.linkMode&&null!=(n=s.metadata.redirect)&&n.linkMode&&null!=(i=s.metadata.redirect)&&i.universal&&t&&(this.client.core.addLinkModeSupportedApp(s.metadata.redirect.universal),this.client.session.update(l,{transportType:M$3.link_mode})),k({auths:a,session:d})},E=payloadId(),C=payloadId();let R;this.events.once(Lt$1("session_connect"),S),this.events.once(Lt$1("session_request",E),A);try{if(n){const e=formatJsonRpcRequest("wc_sessionAuthenticate",_,E);this.client.core.history.set(m,e);const r=await this.client.core.crypto.encode("",e,{type:M$4,encoding:lr$1});R=xr$1(t,m,r)}else await Promise.all([this.sendRequest({topic:m,method:"wc_sessionAuthenticate",params:_,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:E}),this.sendRequest({topic:m,method:"wc_sessionPropose",params:I,expiry:v$3.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:C})])}catch(O){throw this.events.off(Lt$1("session_connect"),S),this.events.off(Lt$1("session_request",E),A),O}return await this.setProposal(C,I$3({id:C},I)),await this.setAuthRequest(E,{request:D$4(I$3({},_),{verifyContext:{}}),pairingTopic:m,transportType:o}),{uri:R??g,response:T}},this.approveSessionAuthenticate=async e=>{const{id:t,auths:r}=e,n=this.client.core.eventClient.createEvent({properties:{topic:t.toString(),trace:[Cs.authenticated_session_approve_started]}});try{this.isInitialized()}catch(p){throw n.setError(Ps.no_internet_connection),p}const o=this.getPendingAuthRequest(t);if(!o)throw n.setError(Ps.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${t}`);const i=o.transportType||M$3.relay;i===M$3.relay&&await this.confirmOnlineStateOrThrow();const a=o.requester.publicKey,s=await this.client.core.crypto.generateKeyPair(),c=hr$1(a),u={type:D$5,receiverPublicKey:a,senderPublicKey:s},l=[],d=[];for(const y of r){if(!(await nr$1({cacao:y,projectId:this.client.core.projectId}))){n.setError(Ps.invalid_cacao);const e=U$2("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:t,topic:c,error:e,encodeOpts:u}),new Error(e.message)}n.addTrace(Cs.cacaos_verified);const{p:e}=y,r=Y$1(e.resources),o=[ln$1(e.iss)],i=fe$1(e.iss);if(r){const e=ar$1(r),t=ur$1(r);l.push(...e),o.push(...t)}for(const t of o)d.push(`${t}:${i}`)}const f=await this.client.core.crypto.generateSharedKey(s,a);let h;if(n.addTrace(Cs.create_authenticated_session_topic),(null==l?void 0:l.length)>0){h={topic:f,acknowledged:!0,self:{publicKey:s,metadata:this.client.metadata},peer:{publicKey:a,metadata:o.requester.metadata},controller:a,expiry:Mt$1(z$4),authentication:r,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Jr$1([...new Set(l)],[...new Set(d)]),transportType:i},n.addTrace(Cs.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(f,{transportType:i})}catch(p){throw n.setError(Ps.subscribe_authenticated_session_topic_failure),p}n.addTrace(Cs.subscribe_authenticated_session_topic_success),await this.client.session.set(f,h),n.addTrace(Cs.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}n.addTrace(Cs.publishing_authenticated_session_approve);try{await this.sendResult({topic:c,id:t,result:{cacaos:r,responder:{publicKey:s,metadata:this.client.metadata}},encodeOpts:u,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,i)})}catch(p){throw n.setError(Ps.authenticated_session_approve_publish_failure),p}return await this.client.auth.requests.delete(t,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:n.eventId}),{session:h}},this.rejectSessionAuthenticate=async e=>{this.isInitialized();const{id:t,reason:r}=e,n=this.getPendingAuthRequest(t);if(!n)throw new Error(`Could not find pending auth request with id ${t}`);n.transportType===M$3.relay&&await this.confirmOnlineStateOrThrow();const o=n.requester.publicKey,i=await this.client.core.crypto.generateKeyPair(),a=hr$1(o),s={type:D$5,receiverPublicKey:o,senderPublicKey:i};await this.sendError({id:t,topic:a,error:r,encodeOpts:s,rpcOpts:v$3.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(n.requester.metadata,n.transportType)}),await this.client.auth.requests.delete(t,{message:"rejected",code:0}),await this.client.proposal.delete(t,U$2("USER_DISCONNECTED"))},this.formatAuthMessage=e=>{this.isInitialized();const{request:t,iss:r}=e;return dn$1(t,r)},this.processRelayMessageCache=()=>{setTimeout((async()=>{if(0!==this.relayMessageCache.length)for(;this.relayMessageCache.length>0;)try{const e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e2){this.client.logger.error(e2)}}),50)},this.cleanupDuplicatePairings=async e=>{if(e.pairingTopic)try{const t=this.client.core.pairing.pairings.get(e.pairingTopic),r=this.client.core.pairing.pairings.getAll().filter((r=>{var n,o;return(null==(n=r.peerMetadata)?void 0:n.url)&&(null==(o=r.peerMetadata)?void 0:o.url)===e.peer.metadata.url&&r.topic&&r.topic!==t.topic}));if(0===r.length)return;this.client.logger.info(`Cleaning up ${r.length} duplicate pairing(s)`),await Promise.all(r.map((e=>this.client.core.pairing.disconnect({topic:e.topic})))),this.client.logger.info("Duplicate pairings clean up finished")}catch(t){this.client.logger.error(t)}},this.deleteSession=async e=>{var t;const{topic:r,expirerHasDeleted:n=!1,emitEvent:o=!0,id:i=0}=e,{self:a}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await this.client.session.delete(r,U$2("USER_DISCONNECTED")),this.addToRecentlyDeleted(r,"session"),this.client.core.crypto.keychain.has(a.publicKey)&&await this.client.core.crypto.deleteKeyPair(a.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),n||this.client.core.expirer.del(r),this.client.core.storage.removeItem(xe).catch((e=>this.client.logger.warn(e))),this.getPendingSessionRequests().forEach((e=>{e.topic===r&&this.deletePendingSessionRequest(e.id,U$2("USER_DISCONNECTED"))})),r===(null==(t=this.sessionRequestQueue.queue[0])?void 0:t.topic)&&(this.sessionRequestQueue.state=x$3.idle),o&&this.client.events.emit("session_delete",{id:i,topic:r})},this.deleteProposal=async(e,t)=>{if(t)try{const t=this.client.proposal.get(e),r=this.client.core.eventClient.getEvent({topic:t.pairingTopic});null==r||r.setError(Ts$1.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,U$2("USER_DISCONNECTED")),t?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")},this.deletePendingSessionRequest=async(e,t,r=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter((t=>t.id!==e)),r&&(this.sessionRequestQueue.state=x$3.idle,this.client.events.emit("session_request_expire",{id:e}))},this.deletePendingAuthRequest=async(e,t,r=!1)=>{await Promise.all([this.client.auth.requests.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)])},this.setExpiry=async(e,t)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,t),await this.client.session.update(e,{expiry:t}))},this.setProposal=async(e,t)=>{this.client.core.expirer.set(e,Mt$1(v$3.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,t)},this.setAuthRequest=async(e,t)=>{const{request:r,pairingTopic:n,transportType:o=M$3.relay}=t;this.client.core.expirer.set(e,r.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:r.authPayload,requester:r.requester,expiryTimestamp:r.expiryTimestamp,id:e,pairingTopic:n,verifyContext:r.verifyContext,transportType:o})},this.setPendingSessionRequest=async e=>{const{id:t,topic:r,params:n,verifyContext:o}=e,i=n.request.expiryTimestamp||Mt$1(v$3.wc_sessionRequest.req.ttl);this.client.core.expirer.set(t,i),await this.client.pendingRequest.set(t,{id:t,topic:r,params:n,verifyContext:o})},this.sendRequest=async e=>{const{topic:t,method:r,params:n,expiry:o,relayRpcId:i,clientRpcId:a,throwOnFailedPublish:s,appLink:c}=e,u=formatJsonRpcRequest(r,n,a);let l;const d=!!c;try{const e=d?lr$1:ge;l=await this.client.core.crypto.encode(t,u,{encoding:e})}catch(p){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${t} failed`),p}let f;if(at.includes(r)){const e=yr$1(JSON.stringify(u)),t=yr$1(l);f=await this.client.core.verify.register({id:t,decryptedId:e})}const h=v$3[r].req;if(h.attestation=f,o&&(h.ttl=o),i&&(h.id=i),this.client.core.history.set(t,u),d){const e=xr$1(c,t,l);await global$1.Linking.openURL(e,this.client.name)}else{const e=v$3[r].req;o&&(e.ttl=o),i&&(e.id=i),s?(e.internal=D$4(I$3({},e.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(t,l,e)):this.client.core.relayer.publish(t,l,e).catch((e=>this.client.logger.error(e)))}return u.id},this.sendResult=async e=>{const{id:t,topic:r,result:n,throwOnFailedPublish:o,encodeOpts:i,appLink:a}=e,s=formatJsonRpcResult(t,n);let c;const u=a&&typeof(null==global$1?void 0:global$1.Linking)<"u";try{const e=u?lr$1:ge;c=await this.client.core.crypto.encode(r,s,D$4(I$3({},i||{}),{encoding:e}))}catch(d){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${r} failed`),d}let l;try{l=await this.client.core.history.get(r,t)}catch(d){throw this.client.logger.error(`sendResult() -> history.get(${r}, ${t}) failed`),d}if(u){const e=xr$1(a,r,c);await global$1.Linking.openURL(e,this.client.name)}else{const e=v$3[l.request.method].res;o?(e.internal=D$4(I$3({},e.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,c,e)):this.client.core.relayer.publish(r,c,e).catch((e=>this.client.logger.error(e)))}await this.client.core.history.resolve(s)},this.sendError=async e=>{const{id:t,topic:r,error:n,encodeOpts:o,rpcOpts:i,appLink:a}=e,s=formatJsonRpcError(t,n);let c;const u=a&&typeof(null==global$1?void 0:global$1.Linking)<"u";try{const e=u?lr$1:ge;c=await this.client.core.crypto.encode(r,s,D$4(I$3({},o||{}),{encoding:e}))}catch(d){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${r} failed`),d}let l;try{l=await this.client.core.history.get(r,t)}catch(d){throw this.client.logger.error(`sendError() -> history.get(${r}, ${t}) failed`),d}if(u){const e=xr$1(a,r,c);await global$1.Linking.openURL(e,this.client.name)}else{const e=i||v$3[l.request.method].res;this.client.core.relayer.publish(r,c,e)}await this.client.core.history.resolve(s)},this.cleanup=async()=>{const e=[],t=[];this.client.session.getAll().forEach((t=>{let r=!1;Kt$1(t.expiry)&&(r=!0),this.client.core.crypto.keychain.has(t.topic)||(r=!0),r&&e.push(t.topic)})),this.client.proposal.getAll().forEach((e=>{Kt$1(e.expiryTimestamp)&&t.push(e.id)})),await Promise.all([...e.map((e=>this.deleteSession({topic:e}))),...t.map((e=>this.deleteProposal(e)))])},this.onRelayEventRequest=async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state!==x$3.active){for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=x$3.active;const t=this.requestQueue.queue.shift();if(t)try{await this.processRequest(t)}catch(e){this.client.logger.warn(e)}}this.requestQueue.state=x$3.idle}else this.client.logger.info("Request queue already active, skipping...")},this.processRequest=async e=>{const{topic:t,payload:r,attestation:n,transportType:o,encryptedId:i}=e,a=r.method;if(!this.shouldIgnorePairingRequest({topic:t,requestMethod:a}))switch(a){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:t,payload:r,attestation:n,encryptedId:i});case"wc_sessionSettle":return await this.onSessionSettleRequest(t,r);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(t,r);case"wc_sessionExtend":return await this.onSessionExtendRequest(t,r);case"wc_sessionPing":return await this.onSessionPingRequest(t,r);case"wc_sessionDelete":return await this.onSessionDeleteRequest(t,r);case"wc_sessionRequest":return await this.onSessionRequest({topic:t,payload:r,attestation:n,encryptedId:i,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(t,r);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:t,payload:r,attestation:n,encryptedId:i,transportType:o});default:return this.client.logger.info(`Unsupported request method ${a}`)}},this.onRelayEventResponse=async e=>{const{topic:t,payload:r,transportType:n}=e,o=(await this.client.core.history.get(t,r.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(t,r,n);case"wc_sessionSettle":return this.onSessionSettleResponse(t,r);case"wc_sessionUpdate":return this.onSessionUpdateResponse(t,r);case"wc_sessionExtend":return this.onSessionExtendResponse(t,r);case"wc_sessionPing":return this.onSessionPingResponse(t,r);case"wc_sessionRequest":return this.onSessionRequestResponse(t,r);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(t,r);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=e=>{const{topic:t}=e,{message:r}=S$6("MISSING_OR_INVALID",`Decoded payload on topic ${t} is not identifiable as a JSON-RPC request or a response.`);throw new Error(r)},this.shouldIgnorePairingRequest=e=>{const{topic:t,requestMethod:r}=e,n=this.expectedPairingMethodMap.get(t);return!(!n||n.includes(r))&&!!(n.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async e=>{const{topic:t,payload:r,attestation:n,encryptedId:o}=e,{params:i,id:a}=r;try{const e=this.client.core.eventClient.getEvent({topic:t});this.isValidConnect(I$3({},r.params));const s=i.expiryTimestamp||Mt$1(v$3.wc_sessionPropose.req.ttl),c=I$3({id:a,pairingTopic:t,expiryTimestamp:s},i);await this.setProposal(a,c);const u=await this.getVerifyContext({attestationId:n,hash:yr$1(JSON.stringify(r)),encryptedId:o,metadata:c.proposer.metadata});0===this.client.events.listenerCount("session_proposal")&&(console.warn("No listener for session_proposal event"),null==e||e.setError($$3.proposal_listener_not_found)),null==e||e.addTrace(z$5.emit_session_proposal),this.client.events.emit("session_proposal",{id:a,params:c,verifyContext:u})}catch(s){await this.sendError({id:a,topic:t,error:s,rpcOpts:v$3.wc_sessionPropose.autoReject}),this.client.logger.error(s)}},this.onSessionProposeResponse=async(e,t,r)=>{const{id:n}=t;if(isJsonRpcResult(t)){const{result:o}=t;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const i=this.client.proposal.get(n);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:i});const a=i.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});const s=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:s});const c=await this.client.core.crypto.generateSharedKey(a,s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:c});const u=await this.client.core.relayer.subscribe(c,{transportType:r});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:u}),await this.client.core.pairing.activate({topic:e})}else if(isJsonRpcError(t)){await this.client.proposal.delete(n,U$2("USER_DISCONNECTED"));const e=Lt$1("session_connect");if(0===this.events.listenerCount(e))throw new Error(`emitting ${e} without any listeners, 954`);this.events.emit(Lt$1("session_connect"),{error:t.error})}},this.onSessionSettleRequest=async(e,t)=>{const{id:r,params:n}=t;try{this.isValidSessionSettleRequest(n);const{relay:r,controller:o,expiry:i,namespaces:a,sessionProperties:s,sessionConfig:c}=t.params,u=D$4(I$3(I$3({topic:e,relay:r,expiry:i,namespaces:a,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:o.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:o.publicKey,metadata:o.metadata}},s&&{sessionProperties:s}),c&&{sessionConfig:c}),{transportType:M$3.relay}),l=Lt$1("session_connect");if(0===this.events.listenerCount(l))throw new Error(`emitting ${l} without any listeners 997`);this.events.emit(Lt$1("session_connect"),{session:u}),await this.sendResult({id:t.id,topic:e,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:r,topic:e,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(e,t)=>{const{id:r}=t;isJsonRpcResult(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(Lt$1("session_approve",r),{})):isJsonRpcError(t)&&(await this.client.session.delete(e,U$2("USER_DISCONNECTED")),this.events.emit(Lt$1("session_approve",r),{error:t.error}))},this.onSessionUpdateRequest=async(e,t)=>{const{params:r,id:n}=t;try{const t=`${e}_session_update`,i=yo.get(t);if(i&&this.isRequestOutOfSync(i,n))return this.client.logger.info(`Discarding out of sync request - ${n}`),void this.sendError({id:n,topic:e,error:U$2("INVALID_UPDATE_REQUEST")});this.isValidUpdate(I$3({topic:e},r));try{yo.set(t,n),await this.client.session.update(e,{namespaces:r.namespaces}),await this.sendResult({id:n,topic:e,result:!0,throwOnFailedPublish:!0})}catch(o){throw yo.delete(t),o}this.client.events.emit("session_update",{id:n,topic:e,params:r})}catch(i){await this.sendError({id:n,topic:e,error:i}),this.client.logger.error(i)}},this.isRequestOutOfSync=(e,t)=>parseInt(t.toString().slice(0,-3))<=parseInt(e.toString().slice(0,-3)),this.onSessionUpdateResponse=(e,t)=>{const{id:r}=t,n=Lt$1("session_update",r);if(0===this.events.listenerCount(n))throw new Error(`emitting ${n} without any listeners`);isJsonRpcResult(t)?this.events.emit(Lt$1("session_update",r),{}):isJsonRpcError(t)&&this.events.emit(Lt$1("session_update",r),{error:t.error})},this.onSessionExtendRequest=async(e,t)=>{const{id:r}=t;try{this.isValidExtend({topic:e}),await this.setExpiry(e,Mt$1(z$4)),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:r,topic:e})}catch(n){await this.sendError({id:r,topic:e,error:n}),this.client.logger.error(n)}},this.onSessionExtendResponse=(e,t)=>{const{id:r}=t,n=Lt$1("session_extend",r);if(0===this.events.listenerCount(n))throw new Error(`emitting ${n} without any listeners`);isJsonRpcResult(t)?this.events.emit(Lt$1("session_extend",r),{}):isJsonRpcError(t)&&this.events.emit(Lt$1("session_extend",r),{error:t.error})},this.onSessionPingRequest=async(e,t)=>{const{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:r,topic:e})}catch(n){await this.sendError({id:r,topic:e,error:n}),this.client.logger.error(n)}},this.onSessionPingResponse=(e,t)=>{const{id:r}=t,n=Lt$1("session_ping",r);if(0===this.events.listenerCount(n))throw new Error(`emitting ${n} without any listeners`);setTimeout((()=>{isJsonRpcResult(t)?this.events.emit(Lt$1("session_ping",r),{}):isJsonRpcError(t)&&this.events.emit(Lt$1("session_ping",r),{error:t.error})}),500)},this.onSessionDeleteRequest=async(e,t)=>{const{id:r}=t;try{this.isValidDisconnect({topic:e,reason:t.params}),Promise.all([new Promise((t=>{this.client.core.relayer.once(v$4.publish,(async()=>{t(await this.deleteSession({topic:e,id:r}))}))})),this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:U$2("USER_DISCONNECTED")})]).catch((e=>this.client.logger.error(e)))}catch(n){this.client.logger.error(n)}},this.onSessionRequest=async e=>{var t,r,n;const{topic:o,payload:i,attestation:a,encryptedId:s,transportType:c}=e,{id:u,params:l}=i;try{await this.isValidRequest(I$3({topic:o},l));const e=this.client.session.get(o),i={id:u,topic:o,params:l,verifyContext:await this.getVerifyContext({attestationId:a,hash:yr$1(JSON.stringify(formatJsonRpcRequest("wc_sessionRequest",l,u))),encryptedId:s,metadata:e.peer.metadata,transportType:c})};await this.setPendingSessionRequest(i),c===M$3.link_mode&&null!=(t=e.peer.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(null==(r=e.peer.metadata.redirect)?void 0:r.universal),null!=(n=this.client.signConfig)&&n.disableRequestQueue?this.emitSessionRequest(i):(this.addSessionRequestToSessionRequestQueue(i),this.processSessionRequestQueue())}catch(d){await this.sendError({id:u,topic:o,error:d}),this.client.logger.error(d)}},this.onSessionRequestResponse=(e,t)=>{const{id:r}=t,n=Lt$1("session_request",r);if(0===this.events.listenerCount(n))throw new Error(`emitting ${n} without any listeners`);isJsonRpcResult(t)?this.events.emit(Lt$1("session_request",r),{result:t.result}):isJsonRpcError(t)&&this.events.emit(Lt$1("session_request",r),{error:t.error})},this.onSessionEventRequest=async(e,t)=>{const{id:r,params:n}=t;try{const t=`${e}_session_event_${n.event.name}`,o=yo.get(t);if(o&&this.isRequestOutOfSync(o,r))return void this.client.logger.info(`Discarding out of sync request - ${r}`);this.isValidEmit(I$3({topic:e},n)),this.client.events.emit("session_event",{id:r,topic:e,params:n}),yo.set(t,r)}catch(o){await this.sendError({id:r,topic:e,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(e,t)=>{const{id:r}=t;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:t}),isJsonRpcResult(t)?this.events.emit(Lt$1("session_request",r),{result:t.result}):isJsonRpcError(t)&&this.events.emit(Lt$1("session_request",r),{error:t.error})},this.onSessionAuthenticateRequest=async e=>{var t;const{topic:r,payload:n,attestation:o,encryptedId:i,transportType:a}=e;try{const{requester:e,authPayload:s,expiryTimestamp:c}=n.params,u=await this.getVerifyContext({attestationId:o,hash:yr$1(JSON.stringify(n)),encryptedId:i,metadata:e.metadata,transportType:a}),l={requester:e,pairingTopic:r,id:n.id,authPayload:s,verifyContext:u,expiryTimestamp:c};await this.setAuthRequest(n.id,{request:l,pairingTopic:r,transportType:a}),a===M$3.link_mode&&null!=(t=e.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(e.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:r,params:n.params,id:n.id,verifyContext:u})}catch(s){this.client.logger.error(s);const e=n.params.requester.publicKey,t=await this.client.core.crypto.generateKeyPair(),o=this.getAppLinkIfEnabled(n.params.requester.metadata,a),i={type:D$5,receiverPublicKey:e,senderPublicKey:t};await this.sendError({id:n.id,topic:r,error:s,encodeOpts:i,rpcOpts:v$3.wc_sessionAuthenticate.autoReject,appLink:o})}},this.addSessionRequestToSessionRequestQueue=e=>{this.sessionRequestQueue.queue.push(e)},this.cleanupAfterResponse=e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout((()=>{this.sessionRequestQueue.state=x$3.idle,this.processSessionRequestQueue()}),cjs$7.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:e,error:t})=>{const r=this.client.core.history.pending;r.length>0&&r.filter((t=>t.topic===e&&"wc_sessionRequest"===t.request.method)).forEach((e=>{const r=Lt$1("session_request",e.request.id);if(0===this.events.listenerCount(r))throw new Error(`emitting ${r} without any listeners`);this.events.emit(Lt$1("session_request",e.request.id),{error:t})}))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===x$3.active)return void this.client.logger.info("session request queue is already active.");const e=this.sessionRequestQueue.queue[0];if(e)try{this.sessionRequestQueue.state=x$3.active,this.emitSessionRequest(e)}catch(t){this.client.logger.error(t)}else this.client.logger.info("session request queue is empty.")},this.emitSessionRequest=e=>{this.client.events.emit("session_request",e)},this.onPairingCreated=e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const t=this.client.proposal.getAll().find((t=>t.pairingTopic===e.topic));t&&this.onSessionProposeRequest({topic:e.topic,payload:formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces,relays:t.relays,proposer:t.proposer,sessionProperties:t.sessionProperties},t.id)})},this.isValidConnect=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(t)}const{pairingTopic:t,requiredNamespaces:r,optionalNamespaces:n,sessionProperties:o,relays:i}=e;if(I$5(t)||await this.isValidPairingTopic(t),!eo(i)){const{message:e}=S$6("MISSING_OR_INVALID",`connect() relays: ${i}`);throw new Error(e)}!I$5(r)&&0!==Z$3(r)&&this.validateNamespaces(r,"requiredNamespaces"),!I$5(n)&&0!==Z$3(n)&&this.validateNamespaces(n,"optionalNamespaces"),I$5(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(e,t)=>{const r=Xr$1(e,"connect()",t);if(r)throw new Error(r.message)},this.isValidApprove=async e=>{if(!to(e))throw new Error(S$6("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:t,namespaces:r,relayProtocol:n,sessionProperties:o}=e;this.checkRecentlyDeleted(t),await this.isValidProposalId(t);const i=this.client.proposal.get(t),a=Wn(r,"approve()");if(a)throw new Error(a.message);const s=zn(i.requiredNamespaces,r,"approve()");if(s)throw new Error(s.message);if(!b$4(n,!0)){const{message:e}=S$6("MISSING_OR_INVALID",`approve() relayProtocol: ${n}`);throw new Error(e)}I$5(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(t)}const{id:t,reason:r}=e;if(this.checkRecentlyDeleted(t),await this.isValidProposalId(t),!ro(r)){const{message:e}=S$6("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(r)}`);throw new Error(e)}},this.isValidSessionSettleRequest=e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(t)}const{relay:t,controller:r,namespaces:n,expiry:o}=e;if(!Jn(t)){const{message:e}=S$6("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(e)}const i=Zr$1(r,"onSessionSettleRequest()");if(i)throw new Error(i.message);const a=Wn(n,"onSessionSettleRequest()");if(a)throw new Error(a.message);if(Kt$1(o)){const{message:e}=S$6("EXPIRED","onSessionSettleRequest()");throw new Error(e)}},this.isValidUpdate=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(t)}const{topic:t,namespaces:r}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);const n=this.client.session.get(t),o=Wn(r,"update()");if(o)throw new Error(o.message);const i=zn(n.requiredNamespaces,r,"update()");if(i)throw new Error(i.message)},this.isValidExtend=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(t)}const{topic:t}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t)},this.isValidRequest=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(t)}const{topic:t,request:r,chainId:n,expiry:o}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);const{namespaces:i}=this.client.session.get(t);if(!co(i,n)){const{message:e}=S$6("MISSING_OR_INVALID",`request() chainId: ${n}`);throw new Error(e)}if(!oo(r)){const{message:e}=S$6("MISSING_OR_INVALID",`request() ${JSON.stringify(r)}`);throw new Error(e)}if(!ao(i,n,r.method)){const{message:e}=S$6("MISSING_OR_INVALID",`request() method: ${r.method}`);throw new Error(e)}if(o&&!po(o,me)){const{message:e}=S$6("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${me.min} and ${me.max}`);throw new Error(e)}},this.isValidRespond=async e=>{var t;if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(t)}const{topic:r,response:n}=e;try{await this.isValidSessionTopic(r)}catch(o){throw null!=(t=null==e?void 0:e.response)&&t.id&&this.cleanupAfterResponse(e),o}if(!so(n)){const{message:e}=S$6("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(n)}`);throw new Error(e)}},this.isValidPing=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidEmit=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(t)}const{topic:t,event:r,chainId:n}=e;await this.isValidSessionTopic(t);const{namespaces:o}=this.client.session.get(t);if(!co(o,n)){const{message:e}=S$6("MISSING_OR_INVALID",`emit() chainId: ${n}`);throw new Error(e)}if(!io(r)){const{message:e}=S$6("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(e)}if(!uo(o,n,r.name)){const{message:e}=S$6("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(e)}},this.isValidDisconnect=async e=>{if(!to(e)){const{message:t}=S$6("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidAuthenticate=e=>{const{chains:t,uri:r,domain:n,nonce:o}=e;if(!Array.isArray(t)||0===t.length)throw new Error("chains is required and must be a non-empty array");if(!b$4(r,!1))throw new Error("uri is required parameter");if(!b$4(n,!1))throw new Error("domain is required parameter");if(!b$4(o,!1))throw new Error("nonce is required parameter");if([...new Set(t.map((e=>re$1(e).namespace)))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:i}=re$1(t[0]);if("eip155"!==i)throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async e=>{const{attestationId:t,hash:r,encryptedId:n,metadata:o,transportType:i}=e,a={verified:{verifyUrl:o.verifyUrl||J$1,validation:"UNKNOWN",origin:o.url||""}};try{if(i===M$3.link_mode){const e=this.getAppLinkIfEnabled(o,i);return a.verified.validation=e&&new URL(e).origin===new URL(o.url).origin?"VALID":"INVALID",a}const e=await this.client.core.verify.resolve({attestationId:t,hash:r,encryptedId:n,verifyUrl:o.verifyUrl});e&&(a.verified.origin=e.origin,a.verified.isScam=e.isScam,a.verified.validation=e.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(s){this.client.logger.warn(s)}return this.client.logger.debug(`Verify context: ${JSON.stringify(a)}`),a},this.validateSessionProps=(e,t)=>{Object.values(e).forEach((e=>{if(!b$4(e,!1)){const{message:r}=S$6("MISSING_OR_INVALID",`${t} must be in Record<string, string> format. Received: ${JSON.stringify(e)}`);throw new Error(r)}}))},this.getPendingAuthRequest=e=>{const t=this.client.auth.requests.get(e);return"object"==typeof t?t:void 0},this.addToRecentlyDeleted=(e,t)=>{if(this.recentlyDeletedMap.set(e,t),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let e=0;const t=this.recentlyDeletedLimit/2;for(const r of this.recentlyDeletedMap.keys()){if(e++>=t)break;this.recentlyDeletedMap.delete(r)}}},this.checkRecentlyDeleted=e=>{const t=this.recentlyDeletedMap.get(e);if(t){const{message:r}=S$6("MISSING_OR_INVALID",`Record was recently deleted - ${t}: ${e}`);throw new Error(r)}},this.isLinkModeEnabled=(e,t)=>{var r,n,o,i,a,s,c,u,l;return!(!e||t!==M$3.link_mode)&&(!0===(null==(n=null==(r=this.client.metadata)?void 0:r.redirect)?void 0:n.linkMode)&&void 0!==(null==(i=null==(o=this.client.metadata)?void 0:o.redirect)?void 0:i.universal)&&""!==(null==(s=null==(a=this.client.metadata)?void 0:a.redirect)?void 0:s.universal)&&void 0!==(null==(c=null==e?void 0:e.redirect)?void 0:c.universal)&&""!==(null==(u=null==e?void 0:e.redirect)?void 0:u.universal)&&!0===(null==(l=null==e?void 0:e.redirect)?void 0:l.linkMode)&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&typeof(null==global$1?void 0:global$1.Linking)<"u")},this.getAppLinkIfEnabled=(e,t)=>{var r;return this.isLinkModeEnabled(e,t)?null==(r=null==e?void 0:e.redirect)?void 0:r.universal:void 0},this.handleLinkModeMessage=({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;const t=Bt$1(e,"topic")||"",r=decodeURIComponent(Bt$1(e,"wc_ev")||""),n=this.client.session.keys.includes(t);n&&this.client.session.update(t,{transportType:M$3.link_mode}),this.client.core.dispatchEnvelope({topic:t,message:r,sessionExists:n})},this.registerLinkModeListeners=async()=>{var e;if(Wt$1()||_$5()&&null!=(e=this.client.metadata.redirect)&&e.linkMode){const e=null==global$1?void 0:global$1.Linking;if(typeof e<"u"){e.addEventListener("url",this.handleLinkModeMessage,this.client.name);const t=await e.getInitialURL();t&&setTimeout((()=>{this.handleLinkModeMessage({url:t})}),50)}}}}isInitialized(){if(!this.initialized){const{message:e}=S$6("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(v$4.message,(e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)}))}async onRelayMessage(e){const{topic:t,message:r,attestation:n,transportType:o}=e,{publicKey:i}=this.client.auth.authKeys.keys.includes(ae)?this.client.auth.authKeys.get(ae):{responseTopic:void 0,publicKey:void 0},a=await this.client.core.crypto.decode(t,r,{receiverPublicKey:i,encoding:o===M$3.link_mode?lr$1:ge});try{isJsonRpcRequest(a)?(this.client.core.history.set(t,a),this.onRelayEventRequest({topic:t,payload:a,attestation:n,transportType:o,encryptedId:yr$1(r)})):isJsonRpcResponse(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:t,payload:a,transportType:o}),this.client.core.history.delete(t,a.id)):this.onRelayEventUnknownPayload({topic:t,payload:a,transportType:o})}catch(s){this.client.logger.error(s)}}registerExpirerEvents(){this.client.core.expirer.on(S$4.expired,(async e=>{const{topic:t,id:r}=Vt$1(e.target);return r&&this.client.pendingRequest.keys.includes(r)?await this.deletePendingSessionRequest(r,S$6("EXPIRED"),!0):r&&this.client.auth.requests.keys.includes(r)?await this.deletePendingAuthRequest(r,S$6("EXPIRED"),!0):void(t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r})))}))}registerPairingEvents(){this.client.core.pairing.events.on(V$2.create,(e=>this.onPairingCreated(e))),this.client.core.pairing.events.on(V$2.delete,(e=>{this.addToRecentlyDeleted(e.topic,"pairing")}))}isValidPairingTopic(e){if(!b$4(e,!1)){const{message:t}=S$6("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=S$6("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(Kt$1(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=S$6("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!b$4(e,!1)){const{message:t}=S$6("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:t}=S$6("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(Kt$1(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=S$6("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=S$6("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else{if(!this.client.core.pairing.pairings.keys.includes(e)){if(b$4(e,!1)){const{message:t}=S$6("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}{const{message:t}=S$6("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}this.isValidPairingTopic(e)}}async isValidProposalId(e){if(!no(e)){const{message:t}=S$6("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=S$6("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(Kt$1(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=S$6("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class Ss extends ni{constructor(e,t){super(e,t,st,ye),this.core=e,this.logger=t}}class yt extends ni{constructor(e,t){super(e,t,rt,ye),this.core=e,this.logger=t}}class Is extends ni{constructor(e,t){super(e,t,ot,ye,(e=>e.id)),this.core=e,this.logger=t}}class fs extends ni{constructor(e,t){super(e,t,pt$1,oe,(()=>ae)),this.core=e,this.logger=t}}class vs extends ni{constructor(e,t){super(e,t,ht,oe),this.core=e,this.logger=t}}class qs extends ni{constructor(e,t){super(e,t,dt,oe,(e=>e.id)),this.core=e,this.logger=t}}class Ts{constructor(e,t){this.core=e,this.logger=t,this.authKeys=new fs(this.core,this.logger),this.pairingTopics=new vs(this.core,this.logger),this.requests=new qs(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class _e extends S$7{constructor(e){super(e),this.protocol=be,this.version=Ce,this.name=we.name,this.events=new eventsExports.EventEmitter,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.removeAllListeners=e=>this.events.removeAllListeners(e),this.connect=async e=>{try{return await this.engine.connect(e)}catch(t){throw this.logger.error(t.message),t}},this.pair=async e=>{try{return await this.engine.pair(e)}catch(t){throw this.logger.error(t.message),t}},this.approve=async e=>{try{return await this.engine.approve(e)}catch(t){throw this.logger.error(t.message),t}},this.reject=async e=>{try{return await this.engine.reject(e)}catch(t){throw this.logger.error(t.message),t}},this.update=async e=>{try{return await this.engine.update(e)}catch(t){throw this.logger.error(t.message),t}},this.extend=async e=>{try{return await this.engine.extend(e)}catch(t){throw this.logger.error(t.message),t}},this.request=async e=>{try{return await this.engine.request(e)}catch(t){throw this.logger.error(t.message),t}},this.respond=async e=>{try{return await this.engine.respond(e)}catch(t){throw this.logger.error(t.message),t}},this.ping=async e=>{try{return await this.engine.ping(e)}catch(t){throw this.logger.error(t.message),t}},this.emit=async e=>{try{return await this.engine.emit(e)}catch(t){throw this.logger.error(t.message),t}},this.disconnect=async e=>{try{return await this.engine.disconnect(e)}catch(t){throw this.logger.error(t.message),t}},this.find=e=>{try{return this.engine.find(e)}catch(t){throw this.logger.error(t.message),t}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}},this.authenticate=async(e,t)=>{try{return await this.engine.authenticate(e,t)}catch(r){throw this.logger.error(r.message),r}},this.formatAuthMessage=e=>{try{return this.engine.formatAuthMessage(e)}catch(t){throw this.logger.error(t.message),t}},this.approveSessionAuthenticate=async e=>{try{return await this.engine.approveSessionAuthenticate(e)}catch(t){throw this.logger.error(t.message),t}},this.rejectSessionAuthenticate=async e=>{try{return await this.engine.rejectSessionAuthenticate(e)}catch(t){throw this.logger.error(t.message),t}},this.name=(null==e?void 0:e.name)||we.name,this.metadata=(null==e?void 0:e.metadata)||Nt$1(),this.signConfig=null==e?void 0:e.signConfig;const t=typeof(null==e?void 0:e.logger)<"u"&&"string"!=typeof(null==e?void 0:e.logger)?e.logger:_i(k$5({level:(null==e?void 0:e.logger)||we.logger}));this.core=(null==e?void 0:e.core)||new bn(e),this.logger=E$5(t,this.name),this.session=new yt(this.core,this.logger),this.proposal=new Ss(this.core,this.logger),this.pendingRequest=new Is(this.core,this.logger),this.engine=new Rs(this),this.auth=new Ts(this.core,this.logger)}static async init(e){const t=new _e(e);return await t.initialize(),t}get context(){return y$7(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var l$6={exports:{}},c$5="object"==typeof Reflect?Reflect:null,y$4=c$5&&"function"==typeof c$5.apply?c$5.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},f$3;function k$3(e){console&&console.warn&&console.warn(e)}f$3=c$5&&"function"==typeof c$5.ownKeys?c$5.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var w$4=Number.isNaN||function(e){return e!=e};function o$7(){o$7.init.call(this)}l$6.exports=o$7,l$6.exports.once=K$1,o$7.EventEmitter=o$7,o$7.prototype._events=void 0,o$7.prototype._eventsCount=0,o$7.prototype._maxListeners=void 0;var L$3=10;function g$3(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function _$4(e){return void 0===e._maxListeners?o$7.defaultMaxListeners:e._maxListeners}function S$3(e,t,r,n){var o,i,a;if(g$3(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),a=i[t]),void 0===a)a=i[t]=r,++e._eventsCount;else if("function"==typeof a?a=i[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(o=_$4(e))>0&&a.length>o&&!a.warned){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=a.length,k$3(s)}return e}function D$3(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function C$3(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=D$3.bind(n);return o.listener=r,n.wrapFn=o,o}function b$2(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?z$3(o):O$1(o,o.length)}function E$4(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function O$1(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function F$2(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function z$3(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function K$1(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,i),n(r)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}R$2(e,t,i,{once:!0}),"error"!==t&&U$1(e,o,{once:!0})}))}function U$1(e,t,r){"function"==typeof e.on&&R$2(e,"error",t,r)}function R$2(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(i){n.once&&e.removeEventListener(t,o),r(i)}))}}Object.defineProperty(o$7,"defaultMaxListeners",{enumerable:!0,get:function(){return L$3},set:function(e){if("number"!=typeof e||e<0||w$4(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");L$3=e}}),o$7.init=function(){(void 0===this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o$7.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||w$4(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},o$7.prototype.getMaxListeners=function(){return _$4(this)},o$7.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,o=this._events;if(void 0!==o)n=n&&void 0===o.error;else if(!n)return!1;if(n){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var a=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw a.context=i,a}var s=o[e];if(void 0===s)return!1;if("function"==typeof s)y$4(s,this,t);else{var c=s.length,u=O$1(s,c);for(r=0;r<c;++r)y$4(u[r],this,t)}return!0},o$7.prototype.addListener=function(e,t){return S$3(this,e,t,!1)},o$7.prototype.on=o$7.prototype.addListener,o$7.prototype.prependListener=function(e,t){return S$3(this,e,t,!0)},o$7.prototype.once=function(e,t){return g$3(t),this.on(e,C$3(this,e,t)),this},o$7.prototype.prependOnceListener=function(e,t){return g$3(t),this.prependListener(e,C$3(this,e,t)),this},o$7.prototype.removeListener=function(e,t){var r,n,o,i,a;if(g$3(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){a=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():F$2(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},o$7.prototype.off=o$7.prototype.removeListener,o$7.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o$7.prototype.listeners=function(e){return b$2(this,e,!0)},o$7.prototype.rawListeners=function(e){return b$2(this,e,!1)},o$7.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):E$4.call(e,t)},o$7.prototype.listenerCount=E$4,o$7.prototype.eventNames=function(){return this._eventsCount>0?f$3(this._events):[]};var cjs$2={};Object.defineProperty(cjs$2,"__esModule",{value:!0});var getWindowMetadata_1=cjs$2.getWindowMetadata=void 0;const window_getters_1=cjs$6;function getWindowMetadata(){let e,t;try{e=window_getters_1.getDocumentOrThrow(),t=window_getters_1.getLocationOrThrow()}catch(e2){return null}function r(...t){const r=e.getElementsByTagName("meta");for(let e=0;e<r.length;e++){const n=r[e],o=["itemprop","property","name"].map((e=>n.getAttribute(e))).filter((e=>!!e&&t.includes(e)));if(o.length&&o){const e=n.getAttribute("content");if(e)return e}}return""}const n=function(){let t=r("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}();return{description:r("description","og:description","twitter:description","keywords"),url:t.origin,icons:function(){const r=e.getElementsByTagName("link"),n=[];for(let e=0;e<r.length;e++){const o=r[e],i=o.getAttribute("rel");if(i&&i.toLowerCase().indexOf("icon")>-1){const e=o.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let r=t.protocol+"//"+t.host;if(0===e.indexOf("/"))r+=e;else{const n=t.pathname.split("/");n.pop();r+=n.join("/")+"/"+e}n.push(r)}else if(0===e.indexOf("//")){const r=t.protocol+e;n.push(r)}else n.push(e)}}return n}(),name:n}}getWindowMetadata_1=cjs$2.getWindowMetadata=getWindowMetadata;var cjs$1={};Object.defineProperty(cjs$1,"__esModule",{value:!0});var getLocalStorage_1=cjs$1.getLocalStorage=getLocalStorageOrThrow_1=cjs$1.getLocalStorageOrThrow=getCrypto_1=cjs$1.getCrypto=getCryptoOrThrow_1=cjs$1.getCryptoOrThrow=getLocation_1=cjs$1.getLocation=getLocationOrThrow_1=cjs$1.getLocationOrThrow=getNavigator_1=cjs$1.getNavigator=getNavigatorOrThrow_1=cjs$1.getNavigatorOrThrow=getDocument_1=cjs$1.getDocument=getDocumentOrThrow_1=cjs$1.getDocumentOrThrow=getFromWindowOrThrow_1=cjs$1.getFromWindowOrThrow=getFromWindow_1=cjs$1.getFromWindow=void 0;function getFromWindow$1(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}var getFromWindow_1=cjs$1.getFromWindow=getFromWindow$1;function getFromWindowOrThrow$1(e){const t=getFromWindow$1(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}var getFromWindowOrThrow_1=cjs$1.getFromWindowOrThrow=getFromWindowOrThrow$1;function getDocumentOrThrow$1(){return getFromWindowOrThrow$1("document")}var getDocumentOrThrow_1=cjs$1.getDocumentOrThrow=getDocumentOrThrow$1;function getDocument$1(){return getFromWindow$1("document")}var getDocument_1=cjs$1.getDocument=getDocument$1;function getNavigatorOrThrow$1(){return getFromWindowOrThrow$1("navigator")}var getNavigatorOrThrow_1=cjs$1.getNavigatorOrThrow=getNavigatorOrThrow$1;function getNavigator$1(){return getFromWindow$1("navigator")}var getNavigator_1=cjs$1.getNavigator=getNavigator$1;function getLocationOrThrow$1(){return getFromWindowOrThrow$1("location")}var getLocationOrThrow_1=cjs$1.getLocationOrThrow=getLocationOrThrow$1;function getLocation$1(){return getFromWindow$1("location")}var getLocation_1=cjs$1.getLocation=getLocation$1;function getCryptoOrThrow$1(){return getFromWindowOrThrow$1("crypto")}var getCryptoOrThrow_1=cjs$1.getCryptoOrThrow=getCryptoOrThrow$1;function getCrypto$1(){return getFromWindow$1("crypto")}var getCrypto_1=cjs$1.getCrypto=getCrypto$1;function getLocalStorageOrThrow$1(){return getFromWindowOrThrow$1("localStorage")}var getLocalStorageOrThrow_1=cjs$1.getLocalStorageOrThrow=getLocalStorageOrThrow$1;function getLocalStorage$1(){return getFromWindow$1("localStorage")}getLocalStorage_1=cjs$1.getLocalStorage=getLocalStorage$1;var __spreadArrays=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n},BrowserInfo=function(){return function(e,t,r){this.name=e,this.version=t,this.os=r,this.type="browser"}}(),NodeInfo=function(){return function(e){this.version=e,this.type="node",this.name="node",this.os=process$1.platform}}(),SearchBotDeviceInfo=function(){return function(e,t,r,n){this.name=e,this.version=t,this.os=r,this.bot=n,this.type="bot-device"}}(),BotInfo=function(){return function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}}(),ReactNativeInfo=function(){return function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}}(),SEARCHBOX_UA_REGEX=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,SEARCHBOT_OS_REGEX=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,REQUIRED_VERSION_PARTS=3,userAgentRules=[["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|$)/],["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",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",SEARCHBOX_UA_REGEX]],operatingSystemRules=[["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/],["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 detect(e){return e?parseUserAgent(e):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new ReactNativeInfo:"undefined"!=typeof navigator?parseUserAgent(navigator.userAgent):getNodeVersion()}function matchUserAgent(e){return""!==e&&userAgentRules.reduce((function(t,r){var n=r[0],o=r[1];if(t)return t;var i=o.exec(e);return!!i&&[n,i]}),!1)}function parseUserAgent(e){var t=matchUserAgent(e);if(!t)return null;var r=t[0],n=t[1];if("searchbot"===r)return new BotInfo;var o=n[1]&&n[1].split(/[._]/).slice(0,3);o?o.length<REQUIRED_VERSION_PARTS&&(o=__spreadArrays(o,createVersionParts(REQUIRED_VERSION_PARTS-o.length))):o=[];var i=o.join("."),a=detectOS$1(e),s=SEARCHBOT_OS_REGEX.exec(e);return s&&s[1]?new SearchBotDeviceInfo(r,i,a,s[1]):new BrowserInfo(r,i,a)}function detectOS$1(e){for(var t=0,r=operatingSystemRules.length;t<r;t++){var n=operatingSystemRules[t],o=n[0];if(n[1].exec(e))return o}return null}function getNodeVersion(){return void 0!==process$1&&process$1.version?new NodeInfo(process$1.version.slice(1)):null}function createVersionParts(e){for(var t=[],r=0;r<e;r++)t.push("0");return t}function detectEnv(e){return detect(e)}function detectOS(){const e=detectEnv();return e&&e.os?e.os:void 0}function isAndroid(){const e=detectOS();return!!e&&e.toLowerCase().includes("android")}function isIOS(){const e=detectOS();return!!e&&(e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1)}function isMobile$1(){return!!detectOS()&&(isAndroid()||isIOS())}function isNode$1(){const e=detectEnv();return!(!e||!e.name)&&"node"===e.name.toLowerCase()}function isBrowser(){return!isNode$1()&&!!getNavigator()}const getFromWindow=getFromWindow_1,getFromWindowOrThrow=getFromWindowOrThrow_1,getDocumentOrThrow=getDocumentOrThrow_1,getDocument=getDocument_1,getNavigatorOrThrow=getNavigatorOrThrow_1,getNavigator=getNavigator_1,getLocationOrThrow=getLocationOrThrow_1,getLocation=getLocation_1,getCryptoOrThrow=getCryptoOrThrow_1,getCrypto=getCrypto_1,getLocalStorageOrThrow=getLocalStorageOrThrow_1,getLocalStorage=getLocalStorage_1;function getClientMeta(){return getWindowMetadata_1()}function safeJsonParse$1(e){if("string"!=typeof e)throw new Error("Cannot safe json parse value of type "+typeof e);try{return JSON.parse(e)}catch(t){return e}}function safeJsonStringify$1(e){return"string"==typeof e?e:JSON.stringify(e)}const safeJsonParse=safeJsonParse$1,safeJsonStringify=safeJsonStringify$1;function setLocal(e,t){const r=safeJsonStringify(t),n=getLocalStorage();n&&n.setItem(e,r)}function getLocal(e){let t=null,r=null;const n=getLocalStorage();return n&&(r=n.getItem(e)),t=r?safeJsonParse(r):r,t}function removeLocal(e){const t=getLocalStorage();t&&t.removeItem(e)}const mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function formatIOSMobile(e,t){const r=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${r}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${r}`:""}function saveMobileLinkInfo(e){const t=e.href.split("?")[0];setLocal(mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}function getMobileRegistryEntry(e,t){return e.filter((e=>e.name.toLowerCase().includes(t.toLowerCase())))[0]}function getMobileLinkRegistry(e,t){let r=e;return t&&(r=t.map((t=>getMobileRegistryEntry(e,t))).filter(Boolean)),r}const API_URL="https://registry.walletconnect.com";function getWalletRegistryUrl(){return API_URL+"/api/v2/wallets"}function getDappRegistryUrl(){return API_URL+"/api/v2/dapps"}function formatMobileRegistryEntry(e,t="mobile"){var r;return{name:e.name||"",shortName:e.metadata.shortName||"",color:e.metadata.colors.primary||"",logo:null!==(r=e.image_url.sm)&&void 0!==r?r:"",universalLink:e[t].universal||"",deepLink:e[t].native||""}}function formatMobileRegistry(e,t="mobile"){return Object.values(e).filter((e=>!!e[t].universal||!!e[t].native)).map((e=>formatMobileRegistryEntry(e,t)))}const esm=Object.freeze(Object.defineProperty({__proto__:null,detectEnv:detectEnv,detectOS:detectOS,formatIOSMobile:formatIOSMobile,formatMobileRegistry:formatMobileRegistry,formatMobileRegistryEntry:formatMobileRegistryEntry,getClientMeta:getClientMeta,getCrypto:getCrypto,getCryptoOrThrow:getCryptoOrThrow,getDappRegistryUrl:getDappRegistryUrl,getDocument:getDocument,getDocumentOrThrow:getDocumentOrThrow,getFromWindow:getFromWindow,getFromWindowOrThrow:getFromWindowOrThrow,getLocal:getLocal,getLocalStorage:getLocalStorage,getLocalStorageOrThrow:getLocalStorageOrThrow,getLocation:getLocation,getLocationOrThrow:getLocationOrThrow,getMobileLinkRegistry:getMobileLinkRegistry,getMobileRegistryEntry:getMobileRegistryEntry,getNavigator:getNavigator,getNavigatorOrThrow:getNavigatorOrThrow,getWalletRegistryUrl:getWalletRegistryUrl,isAndroid:isAndroid,isBrowser:isBrowser,isIOS:isIOS,isMobile:isMobile$1,isNode:isNode$1,mobileLinkChoiceKey:mobileLinkChoiceKey,removeLocal:removeLocal,safeJsonParse:safeJsonParse,safeJsonStringify:safeJsonStringify,saveMobileLinkInfo:saveMobileLinkInfo,setLocal:setLocal},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(esm);var browser$1={},canPromise$3=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},qrcode$1={},typedarrayBuffer={},toString={}.toString,isarray=Array.isArray||function(e){return"[object Array]"==toString.call(e)},isArray$1=isarray;function typedArraySupport(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e2){return!1}}Buffer$1.TYPED_ARRAY_SUPPORT=typedArraySupport();var K_MAX_LENGTH=Buffer$1.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function Buffer$1(e,t,r){return Buffer$1.TYPED_ARRAY_SUPPORT||this instanceof Buffer$1?"number"==typeof e?allocUnsafe(this,e):from(this,e,t,r):new Buffer$1(e,t,r)}function checked(e){if(e>=K_MAX_LENGTH)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K_MAX_LENGTH.toString(16)+" bytes");return 0|e}function isnan(e){return e!=e}function createBuffer(e,t){var r;return Buffer$1.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(t)).__proto__=Buffer$1.prototype:(null===(r=e)&&(r=new Buffer$1(t)),r.length=t),r}function allocUnsafe(e,t){var r=createBuffer(e,t<0?0:0|checked(t));if(!Buffer$1.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)r[n]=0;return r}function fromString(e,t){var r=0|byteLength(t),n=createBuffer(e,r),o=n.write(t);return o!==r&&(n=n.slice(0,o)),n}function fromArrayLike(e,t){for(var r=t.length<0?0:0|checked(t.length),n=createBuffer(e,r),o=0;o<r;o+=1)n[o]=255&t[o];return n}function fromArrayBuffer(e,t,r,n){if(r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");var o;return o=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),Buffer$1.TYPED_ARRAY_SUPPORT?o.__proto__=Buffer$1.prototype:o=fromArrayLike(e,o),o}function fromObject(e,t){if(Buffer$1.isBuffer(t)){var r=0|checked(t.length),n=createBuffer(e,r);return 0===n.length||t.copy(n,0,0,r),n}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||isnan(t.length)?createBuffer(e,0):fromArrayLike(e,t);if("Buffer"===t.type&&Array.isArray(t.data))return fromArrayLike(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function utf8ToBytes(e,t){var r;t=t||1/0;for(var n=e.length,o=null,i=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function byteLength(e){return Buffer$1.isBuffer(e)?e.length:"undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)?e.byteLength:("string"!=typeof e&&(e=""+e),0===e.length?0:utf8ToBytes(e).length)}function blitBuffer(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function utf8Write(e,t,r,n){return blitBuffer(utf8ToBytes(t,e.length-r),e,r,n)}function from(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?fromArrayBuffer(e,t,r,n):"string"==typeof t?fromString(e,t):fromObject(e,t)}Buffer$1.TYPED_ARRAY_SUPPORT&&(Buffer$1.prototype.__proto__=Uint8Array.prototype,Buffer$1.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Buffer$1[Symbol.species]===Buffer$1&&Object.defineProperty(Buffer$1,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1})),Buffer$1.prototype.write=function(e,t,r){void 0===t||void 0===r&&"string"==typeof t?(r=this.length,t=0):isFinite(t)&&(t|=0,isFinite(r)?r|=0:r=void 0);var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");return utf8Write(this,e,t,r)},Buffer$1.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),Buffer$1.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=Buffer$1.prototype;else{var o=t-e;r=new Buffer$1(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+e]}return r},Buffer$1.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o,i=n-r;if(this===e&&r<t&&t<n)for(o=i-1;o>=0;--o)e[o+t]=this[o+r];else if(i<1e3||!Buffer$1.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+i),t);return i},Buffer$1.prototype.fill=function(e,t,r){if("string"==typeof e){if("string"==typeof t?(t=0,r=this.length):"string"==typeof r&&(r=this.length),1===e.length){var n=e.charCodeAt(0);n<256&&(e=n)}}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var i=Buffer$1.isBuffer(e)?e:new Buffer$1(e),a=i.length;for(o=0;o<r-t;++o)this[o+t]=i[o%a]}return this},Buffer$1.concat=function(e,t){if(!isArray$1(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return createBuffer(null,0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=allocUnsafe(null,t),o=0;for(r=0;r<e.length;++r){var i=e[r];if(!Buffer$1.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},Buffer$1.byteLength=byteLength,Buffer$1.prototype._isBuffer=!0,Buffer$1.isBuffer=function(e){return!(null==e||!e._isBuffer)},typedarrayBuffer.alloc=function(e){var t=new Buffer$1(e);return t.fill(0),t},typedarrayBuffer.from=function(e){return new Buffer$1(e)};var utils$3={},toSJISFunction$1,CODEWORDS_COUNT$1=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];utils$3.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},utils$3.getSymbolTotalCodewords=function(e){return CODEWORDS_COUNT$1[e]},utils$3.getBCHDigit=function(e){for(var t=0;0!==e;)t++,e>>>=1;return t},utils$3.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');toSJISFunction$1=e},utils$3.isKanjiModeEnabled=function(){return void 0!==toSJISFunction$1},utils$3.toSJIS=function(e){return toSJISFunction$1(e)};var errorCorrectionLevel$1={};function BitBuffer$3(){this.buffer=[],this.length=0}!function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2},e.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},e.from=function(t,r){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+t)}}(t)}catch(e2){return r}}}(errorCorrectionLevel$1),BitBuffer$3.prototype={get:function(e){var t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(var r=0;r<t;r++)this.putBit(1==(e>>>t-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var bitBuffer$1=BitBuffer$3,BufferUtil$4=typedarrayBuffer;function BitMatrix$3(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=BufferUtil$4.alloc(e*e),this.reservedBit=BufferUtil$4.alloc(e*e)}BitMatrix$3.prototype.set=function(e,t,r,n){var o=e*this.size+t;this.data[o]=r,n&&(this.reservedBit[o]=!0)},BitMatrix$3.prototype.get=function(e,t){return this.data[e*this.size+t]},BitMatrix$3.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r},BitMatrix$3.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var bitMatrix$1=BitMatrix$3,alignmentPattern$1={};!function(e){var t=utils$3.getSymbolSize;e.getRowColCoords=function(e){if(1===e)return[];for(var r=Math.floor(e/7)+2,n=t(e),o=145===n?26:2*Math.ceil((n-13)/(2*r-2)),i=[n-7],a=1;a<r-1;a++)i[a]=i[a-1]-o;return i.push(6),i.reverse()},e.getPositions=function(t){for(var r=[],n=e.getRowColCoords(t),o=n.length,i=0;i<o;i++)for(var a=0;a<o;a++)0===i&&0===a||0===i&&a===o-1||i===o-1&&0===a||r.push([n[i],n[a]]);return r}}(alignmentPattern$1);var finderPattern$1={},getSymbolSize$1=utils$3.getSymbolSize,FINDER_PATTERN_SIZE$1=7;finderPattern$1.getPositions=function(e){var t=getSymbolSize$1(e);return[[0,0],[t-FINDER_PATTERN_SIZE$1,0],[0,t-FINDER_PATTERN_SIZE$1]]};var maskPattern$1={};!function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t=3,r=3,n=40,o=10;function i(t,r,n){switch(t){case e.Patterns.PATTERN000:return(r+n)%2==0;case e.Patterns.PATTERN001:return r%2==0;case e.Patterns.PATTERN010:return n%3==0;case e.Patterns.PATTERN011:return(r+n)%3==0;case e.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(n/3))%2==0;case e.Patterns.PATTERN101:return r*n%2+r*n%3==0;case e.Patterns.PATTERN110:return(r*n%2+r*n%3)%2==0;case e.Patterns.PATTERN111:return(r*n%3+(r+n)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}}e.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){for(var r=e.size,n=0,o=0,i=0,a=null,s=null,c=0;c<r;c++){o=i=0,a=s=null;for(var u=0;u<r;u++){var l=e.get(c,u);l===a?o++:(o>=5&&(n+=t+(o-5)),a=l,o=1),(l=e.get(u,c))===s?i++:(i>=5&&(n+=t+(i-5)),s=l,i=1)}o>=5&&(n+=t+(o-5)),i>=5&&(n+=t+(i-5))}return n},e.getPenaltyN2=function(e){for(var t=e.size,n=0,o=0;o<t-1;o++)for(var i=0;i<t-1;i++){var a=e.get(o,i)+e.get(o,i+1)+e.get(o+1,i)+e.get(o+1,i+1);4!==a&&0!==a||n++}return n*r},e.getPenaltyN3=function(e){for(var t=e.size,r=0,o=0,i=0,a=0;a<t;a++){o=i=0;for(var s=0;s<t;s++)o=o<<1&2047|e.get(a,s),s>=10&&(1488===o||93===o)&&r++,i=i<<1&2047|e.get(s,a),s>=10&&(1488===i||93===i)&&r++}return r*n},e.getPenaltyN4=function(e){for(var t=0,r=e.data.length,n=0;n<r;n++)t+=e.data[n];return Math.abs(Math.ceil(100*t/r/5)-10)*o},e.applyMask=function(e,t){for(var r=t.size,n=0;n<r;n++)for(var o=0;o<r;o++)t.isReserved(o,n)||t.xor(o,n,i(e,o,n))},e.getBestMask=function(t,r){for(var n=Object.keys(e.Patterns).length,o=0,i=1/0,a=0;a<n;a++){r(a),e.applyMask(a,t);var s=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(a,t),s<i&&(i=s,o=a)}return o}}(maskPattern$1);var errorCorrectionCode$1={},ECLevel$3=errorCorrectionLevel$1,EC_BLOCKS_TABLE$1=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],EC_CODEWORDS_TABLE$1=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];errorCorrectionCode$1.getBlocksCount=function(e,t){switch(t){case ECLevel$3.L:return EC_BLOCKS_TABLE$1[4*(e-1)+0];case ECLevel$3.M:return EC_BLOCKS_TABLE$1[4*(e-1)+1];case ECLevel$3.Q:return EC_BLOCKS_TABLE$1[4*(e-1)+2];case ECLevel$3.H:return EC_BLOCKS_TABLE$1[4*(e-1)+3];default:return}},errorCorrectionCode$1.getTotalCodewordsCount=function(e,t){switch(t){case ECLevel$3.L:return EC_CODEWORDS_TABLE$1[4*(e-1)+0];case ECLevel$3.M:return EC_CODEWORDS_TABLE$1[4*(e-1)+1];case ECLevel$3.Q:return EC_CODEWORDS_TABLE$1[4*(e-1)+2];case ECLevel$3.H:return EC_CODEWORDS_TABLE$1[4*(e-1)+3];default:return}};var polynomial$1={},galoisField$1={},BufferUtil$3=typedarrayBuffer,EXP_TABLE$1=BufferUtil$3.alloc(512),LOG_TABLE$1=BufferUtil$3.alloc(256);!function(){for(var e=1,t=0;t<255;t++)EXP_TABLE$1[t]=e,LOG_TABLE$1[e]=t,256&(e<<=1)&&(e^=285);for(t=255;t<512;t++)EXP_TABLE$1[t]=EXP_TABLE$1[t-255]}(),galoisField$1.log=function(e){if(e<1)throw new Error("log("+e+")");return LOG_TABLE$1[e]},galoisField$1.exp=function(e){return EXP_TABLE$1[e]},galoisField$1.mul=function(e,t){return 0===e||0===t?0:EXP_TABLE$1[LOG_TABLE$1[e]+LOG_TABLE$1[t]]},function(e){var t=typedarrayBuffer,r=galoisField$1;e.mul=function(e,n){for(var o=t.alloc(e.length+n.length-1),i=0;i<e.length;i++)for(var a=0;a<n.length;a++)o[i+a]^=r.mul(e[i],n[a]);return o},e.mod=function(e,n){for(var o=t.from(e);o.length-n.length>=0;){for(var i=o[0],a=0;a<n.length;a++)o[a]^=r.mul(n[a],i);for(var s=0;s<o.length&&0===o[s];)s++;o=o.slice(s)}return o},e.generateECPolynomial=function(n){for(var o=t.from([1]),i=0;i<n;i++)o=e.mul(o,[1,r.exp(i)]);return o}}(polynomial$1);var BufferUtil$2=typedarrayBuffer,Polynomial$1=polynomial$1,Buffer=require$$2$1.Buffer;function ReedSolomonEncoder$3(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}ReedSolomonEncoder$3.prototype.initialize=function(e){this.degree=e,this.genPoly=Polynomial$1.generateECPolynomial(this.degree)},ReedSolomonEncoder$3.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");var t=BufferUtil$2.alloc(this.degree),r=Buffer.concat([e,t],e.length+this.degree),n=Polynomial$1.mod(r,this.genPoly),o=this.degree-n.length;if(o>0){var i=BufferUtil$2.alloc(this.degree);return n.copy(i,o),i}return n};var reedSolomonEncoder$1=ReedSolomonEncoder$3,version$1={},mode$1={},versionCheck$1={isValid:function(e){return!isNaN(e)&&e>=1&&e<=40}},regex$1={},numeric$1="[0-9]+",alphanumeric$1="[A-Z $%*+\\-./:]+",kanji$1="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";kanji$1=kanji$1.replace(/u/g,"\\u");var byte$1="(?:(?![A-Z0-9 $%*+\\-./:]|"+kanji$1+")(?:.|[\r\n]))+";regex$1.KANJI=new RegExp(kanji$1,"g"),regex$1.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),regex$1.BYTE=new RegExp(byte$1,"g"),regex$1.NUMERIC=new RegExp(numeric$1,"g"),regex$1.ALPHANUMERIC=new RegExp(alphanumeric$1,"g");var TEST_KANJI$1=new RegExp("^"+kanji$1+"$"),TEST_NUMERIC$1=new RegExp("^"+numeric$1+"$"),TEST_ALPHANUMERIC$1=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");regex$1.testKanji=function(e){return TEST_KANJI$1.test(e)},regex$1.testNumeric=function(e){return TEST_NUMERIC$1.test(e)},regex$1.testAlphanumeric=function(e){return TEST_ALPHANUMERIC$1.test(e)},function(e){var t=versionCheck$1,r=regex$1;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!t.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return r.testNumeric(t)?e.NUMERIC:r.testAlphanumeric(t)?e.ALPHANUMERIC:r.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},e.isValid=function(e){return e&&e.bit&&e.ccBits},e.from=function(t,r){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(e2){return r}}}(mode$1),function(e){var t=utils$3,r=errorCorrectionCode$1,n=errorCorrectionLevel$1,o=mode$1,i=versionCheck$1,a=isarray,s=t.getBCHDigit(7973);function c(e,t){return o.getCharCountIndicator(e,t)+4}function u(e,t){var r=0;return e.forEach((function(e){var n=c(e.mode,t);r+=n+e.getBitsLength()})),r}e.from=function(e,t){return i.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,n,a){if(!i.isValid(e))throw new Error("Invalid QR Code version");void 0===a&&(a=o.BYTE);var s=8*(t.getSymbolTotalCodewords(e)-r.getTotalCodewordsCount(e,n));if(a===o.MIXED)return s;var u=s-c(a,e);switch(a){case o.NUMERIC:return Math.floor(u/10*3);case o.ALPHANUMERIC:return Math.floor(u/11*2);case o.KANJI:return Math.floor(u/13);case o.BYTE:default:return Math.floor(u/8)}},e.getBestVersionForData=function(t,r){var i,s=n.from(r,n.M);if(a(t)){if(t.length>1)return function(t,r){for(var n=1;n<=40;n++)if(u(t,n)<=e.getCapacity(n,r,o.MIXED))return n}(t,s);if(0===t.length)return 1;i=t[0]}else i=t;return function(t,r,n){for(var o=1;o<=40;o++)if(r<=e.getCapacity(o,n,t))return o}(i.mode,i.getLength(),s)},e.getEncodedBits=function(e){if(!i.isValid(e)||e<7)throw new Error("Invalid QR Code version");for(var r=e<<12;t.getBCHDigit(r)-s>=0;)r^=7973<<t.getBCHDigit(r)-s;return e<<12|r}}(version$1);var formatInfo$1={},Utils$7=utils$3,G15$1=1335,G15_MASK$1=21522,G15_BCH$1=Utils$7.getBCHDigit(G15$1);formatInfo$1.getEncodedBits=function(e,t){for(var r=e.bit<<3|t,n=r<<10;Utils$7.getBCHDigit(n)-G15_BCH$1>=0;)n^=G15$1<<Utils$7.getBCHDigit(n)-G15_BCH$1;return(r<<10|n)^G15_MASK$1};var segments$1={},Mode$9=mode$1;function NumericData$1(e){this.mode=Mode$9.NUMERIC,this.data=e.toString()}NumericData$1.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},NumericData$1.prototype.getLength=function(){return this.data.length},NumericData$1.prototype.getBitsLength=function(){return NumericData$1.getBitsLength(this.data.length)},NumericData$1.prototype.write=function(e){var t,r,n;for(t=0;t+3<=this.data.length;t+=3)r=this.data.substr(t,3),n=parseInt(r,10),e.put(n,10);var o=this.data.length-t;o>0&&(r=this.data.substr(t),n=parseInt(r,10),e.put(n,3*o+1))};var numericData$1=NumericData$1,Mode$8=mode$1,ALPHA_NUM_CHARS$1=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function AlphanumericData$1(e){this.mode=Mode$8.ALPHANUMERIC,this.data=e}AlphanumericData$1.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},AlphanumericData$1.prototype.getLength=function(){return this.data.length},AlphanumericData$1.prototype.getBitsLength=function(){return AlphanumericData$1.getBitsLength(this.data.length)},AlphanumericData$1.prototype.write=function(e){var t;for(t=0;t+2<=this.data.length;t+=2){var r=45*ALPHA_NUM_CHARS$1.indexOf(this.data[t]);r+=ALPHA_NUM_CHARS$1.indexOf(this.data[t+1]),e.put(r,11)}this.data.length%2&&e.put(ALPHA_NUM_CHARS$1.indexOf(this.data[t]),6)};var alphanumericData$1=AlphanumericData$1,BufferUtil$1=typedarrayBuffer,Mode$7=mode$1;function ByteData$1(e){this.mode=Mode$7.BYTE,this.data=BufferUtil$1.from(e)}ByteData$1.getBitsLength=function(e){return 8*e},ByteData$1.prototype.getLength=function(){return this.data.length},ByteData$1.prototype.getBitsLength=function(){return ByteData$1.getBitsLength(this.data.length)},ByteData$1.prototype.write=function(e){for(var t=0,r=this.data.length;t<r;t++)e.put(this.data[t],8)};var byteData$1=ByteData$1,Mode$6=mode$1,Utils$6=utils$3;function KanjiData$1(e){this.mode=Mode$6.KANJI,this.data=e}KanjiData$1.getBitsLength=function(e){return 13*e},KanjiData$1.prototype.getLength=function(){return this.data.length},KanjiData$1.prototype.getBitsLength=function(){return KanjiData$1.getBitsLength(this.data.length)},KanjiData$1.prototype.write=function(e){var t;for(t=0;t<this.data.length;t++){var r=Utils$6.toSJIS(this.data[t]);if(r>=33088&&r<=40956)r-=33088;else{if(!(r>=57408&&r<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");r-=49472}r=192*(r>>>8&255)+(255&r),e.put(r,13)}};var kanjiData$1=KanjiData$1,dijkstra={exports:{}};!function(e){var t={single_source_shortest_paths:function(e,r,n){var o={},i={};i[r]=0;var a,s,c,u,l,d,f,h=t.PriorityQueue.make();for(h.push(r,0);!h.empty();)for(c in s=(a=h.pop()).value,u=a.cost,l=e[s]||{})l.hasOwnProperty(c)&&(d=u+l[c],f=i[c],(void 0===i[c]||f>d)&&(i[c]=d,h.push(c,d),o[c]=s));if(void 0!==n&&void 0===i[n]){var p=["Could not find a path from ",r," to ",n,"."].join("");throw new Error(p)}return o},extract_shortest_path_from_predecessor_list:function(e,t){for(var r=[],n=t;n;)r.push(n),e[n],n=e[n];return r.reverse(),r},find_path:function(e,r,n){var o=t.single_source_shortest_paths(e,r,n);return t.extract_shortest_path_from_predecessor_list(o,n)},PriorityQueue:{make:function(e){var r,n=t.PriorityQueue,o={};for(r in e=e||{},n)n.hasOwnProperty(r)&&(o[r]=n[r]);return o.queue=[],o.sorter=e.sorter||n.default_sorter,o},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var r={value:e,cost:t};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t}(dijkstra);var dijkstraExports=dijkstra.exports;!function(e){var t=mode$1,r=numericData$1,n=alphanumericData$1,o=byteData$1,i=kanjiData$1,a=regex$1,s=utils$3,c=dijkstraExports;function u(e){return unescape(encodeURIComponent(e)).length}function l(e,t,r){for(var n,o=[];null!==(n=e.exec(r));)o.push({data:n[0],index:n.index,mode:t,length:n[0].length});return o}function d(e){var r,n,o=l(a.NUMERIC,t.NUMERIC,e),i=l(a.ALPHANUMERIC,t.ALPHANUMERIC,e);return s.isKanjiModeEnabled()?(r=l(a.BYTE,t.BYTE,e),n=l(a.KANJI,t.KANJI,e)):(r=l(a.BYTE_KANJI,t.BYTE,e),n=[]),o.concat(i,r,n).sort((function(e,t){return e.index-t.index})).map((function(e){return{data:e.data,mode:e.mode,length:e.length}}))}function f(e,a){switch(a){case t.NUMERIC:return r.getBitsLength(e);case t.ALPHANUMERIC:return n.getBitsLength(e);case t.KANJI:return i.getBitsLength(e);case t.BYTE:return o.getBitsLength(e)}}function h(e,a){var c,u=t.getBestModeForData(e);if((c=t.from(a,u))!==t.BYTE&&c.bit<u.bit)throw new Error('"'+e+'" cannot be encoded with mode '+t.toString(c)+".\n Suggested mode is: "+t.toString(u));switch(c!==t.KANJI||s.isKanjiModeEnabled()||(c=t.BYTE),c){case t.NUMERIC:return new r(e);case t.ALPHANUMERIC:return new n(e);case t.KANJI:return new i(e);case t.BYTE:return new o(e)}}e.fromArray=function(e){return e.reduce((function(e,t){return"string"==typeof t?e.push(h(t,null)):t.data&&e.push(h(t.data,t.mode)),e}),[])},e.fromString=function(r,n){for(var o=function(e){for(var r=[],n=0;n<e.length;n++){var o=e[n];switch(o.mode){case t.NUMERIC:r.push([o,{data:o.data,mode:t.ALPHANUMERIC,length:o.length},{data:o.data,mode:t.BYTE,length:o.length}]);break;case t.ALPHANUMERIC:r.push([o,{data:o.data,mode:t.BYTE,length:o.length}]);break;case t.KANJI:r.push([o,{data:o.data,mode:t.BYTE,length:u(o.data)}]);break;case t.BYTE:r.push([{data:o.data,mode:t.BYTE,length:u(o.data)}])}}return r}(d(r,s.isKanjiModeEnabled())),i=function(e,r){for(var n={},o={start:{}},i=["start"],a=0;a<e.length;a++){for(var s=e[a],c=[],u=0;u<s.length;u++){var l=s[u],d=""+a+u;c.push(d),n[d]={node:l,lastCount:0},o[d]={};for(var h=0;h<i.length;h++){var p=i[h];n[p]&&n[p].node.mode===l.mode?(o[p][d]=f(n[p].lastCount+l.length,l.mode)-f(n[p].lastCount,l.mode),n[p].lastCount+=l.length):(n[p]&&(n[p].lastCount=l.length),o[p][d]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,r))}}i=c}for(h=0;h<i.length;h++)o[i[h]].end=0;return{map:o,table:n}}(o,n),a=c.find_path(i.map,"start","end"),l=[],h=1;h<a.length-1;h++)l.push(i.table[a[h]].node);return e.fromArray(function(e){return e.reduce((function(e,t){var r=e.length-1>=0?e[e.length-1]:null;return r&&r.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[])}(l))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}}(segments$1);var BufferUtil=typedarrayBuffer,Utils$5=utils$3,ECLevel$2=errorCorrectionLevel$1,BitBuffer$2=bitBuffer$1,BitMatrix$2=bitMatrix$1,AlignmentPattern$1=alignmentPattern$1,FinderPattern$1=finderPattern$1,MaskPattern$1=maskPattern$1,ECCode$1=errorCorrectionCode$1,ReedSolomonEncoder$2=reedSolomonEncoder$1,Version$1=version$1,FormatInfo$1=formatInfo$1,Mode$5=mode$1,Segments$1=segments$1,isArray=isarray;function setupFinderPattern$1(e,t){for(var r=e.size,n=FinderPattern$1.getPositions(t),o=0;o<n.length;o++)for(var i=n[o][0],a=n[o][1],s=-1;s<=7;s++)if(!(i+s<=-1||r<=i+s))for(var c=-1;c<=7;c++)a+c<=-1||r<=a+c||(s>=0&&s<=6&&(0===c||6===c)||c>=0&&c<=6&&(0===s||6===s)||s>=2&&s<=4&&c>=2&&c<=4?e.set(i+s,a+c,!0,!0):e.set(i+s,a+c,!1,!0))}function setupTimingPattern$1(e){for(var t=e.size,r=8;r<t-8;r++){var n=r%2==0;e.set(r,6,n,!0),e.set(6,r,n,!0)}}function setupAlignmentPattern$1(e,t){for(var r=AlignmentPattern$1.getPositions(t),n=0;n<r.length;n++)for(var o=r[n][0],i=r[n][1],a=-2;a<=2;a++)for(var s=-2;s<=2;s++)-2===a||2===a||-2===s||2===s||0===a&&0===s?e.set(o+a,i+s,!0,!0):e.set(o+a,i+s,!1,!0)}function setupVersionInfo$1(e,t){for(var r,n,o,i=e.size,a=Version$1.getEncodedBits(t),s=0;s<18;s++)r=Math.floor(s/3),n=s%3+i-8-3,o=1==(a>>s&1),e.set(r,n,o,!0),e.set(n,r,o,!0)}function setupFormatInfo$1(e,t,r){var n,o,i=e.size,a=FormatInfo$1.getEncodedBits(t,r);for(n=0;n<15;n++)o=1==(a>>n&1),n<6?e.set(n,8,o,!0):n<8?e.set(n+1,8,o,!0):e.set(i-15+n,8,o,!0),n<8?e.set(8,i-n-1,o,!0):n<9?e.set(8,15-n-1+1,o,!0):e.set(8,15-n-1,o,!0);e.set(i-8,8,1,!0)}function setupData$1(e,t){for(var r=e.size,n=-1,o=r-1,i=7,a=0,s=r-1;s>0;s-=2)for(6===s&&s--;;){for(var c=0;c<2;c++)if(!e.isReserved(o,s-c)){var u=!1;a<t.length&&(u=1==(t[a]>>>i&1)),e.set(o,s-c,u),-1===--i&&(a++,i=7)}if((o+=n)<0||r<=o){o-=n,n=-n;break}}}function createData$1(e,t,r){var n=new BitBuffer$2;r.forEach((function(t){n.put(t.mode.bit,4),n.put(t.getLength(),Mode$5.getCharCountIndicator(t.mode,e)),t.write(n)}));var o=8*(Utils$5.getSymbolTotalCodewords(e)-ECCode$1.getTotalCodewordsCount(e,t));for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(0);for(var i=(o-n.getLengthInBits())/8,a=0;a<i;a++)n.put(a%2?17:236,8);return createCodewords$1(n,e,t)}function createCodewords$1(e,t,r){for(var n=Utils$5.getSymbolTotalCodewords(t),o=n-ECCode$1.getTotalCodewordsCount(t,r),i=ECCode$1.getBlocksCount(t,r),a=i-n%i,s=Math.floor(n/i),c=Math.floor(o/i),u=c+1,l=s-c,d=new ReedSolomonEncoder$2(l),f=0,h=new Array(i),p=new Array(i),y=0,m=BufferUtil.from(e.buffer),g=0;g<i;g++){var b=g<a?c:u;h[g]=m.slice(f,f+b),p[g]=d.encode(h[g]),f+=b,y=Math.max(y,b)}var v,w,_=BufferUtil.alloc(n),I=0;for(v=0;v<y;v++)for(w=0;w<i;w++)v<h[w].length&&(_[I++]=h[w][v]);for(v=0;v<l;v++)for(w=0;w<i;w++)_[I++]=p[w][v];return _}function createSymbol$1(e,t,r,n){var o;if(isArray(e))o=Segments$1.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");var i=t;if(!i){var a=Segments$1.rawSplit(e);i=Version$1.getBestVersionForData(a,r)}o=Segments$1.fromString(e,i||40)}var s=Version$1.getBestVersionForData(o,r);if(!s)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<s)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+s+".\n")}else t=s;var c=createData$1(t,r,o),u=Utils$5.getSymbolSize(t),l=new BitMatrix$2(u);return setupFinderPattern$1(l,t),setupTimingPattern$1(l),setupAlignmentPattern$1(l,t),setupFormatInfo$1(l,r,0),t>=7&&setupVersionInfo$1(l,t),setupData$1(l,c),isNaN(n)&&(n=MaskPattern$1.getBestMask(l,setupFormatInfo$1.bind(null,l,r))),MaskPattern$1.applyMask(n,l),setupFormatInfo$1(l,r,n),{modules:l,version:t,errorCorrectionLevel:r,maskPattern:n,segments:o}}qrcode$1.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");var r,n,o=ECLevel$2.M;return void 0!==t&&(o=ECLevel$2.from(t.errorCorrectionLevel,ECLevel$2.M),r=Version$1.from(t.version),n=MaskPattern$1.from(t.maskPattern),t.toSJISFunc&&Utils$5.setToSJISFunction(t.toSJISFunc)),createSymbol$1(e,r,o,n)};var canvas$1={},utils$2={};!function(e){function t(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");var t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");var r=parseInt(t.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+t.slice(0,6).join("")}}e.getOptions=function(e){e||(e={}),e.color||(e.color={});var r=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,o=e.scale||4;return{width:n,scale:n?4:o,margin:r,color:{dark:t(e.color.dark||"#000000ff"),light:t(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},e.getImageWidth=function(t,r){var n=e.getScale(t,r);return Math.floor((t+2*r.margin)*n)},e.qrToImageData=function(t,r,n){for(var o=r.modules.size,i=r.modules.data,a=e.getScale(o,n),s=Math.floor((o+2*n.margin)*a),c=n.margin*a,u=[n.color.light,n.color.dark],l=0;l<s;l++)for(var d=0;d<s;d++){var f=4*(l*s+d),h=n.color.light;if(l>=c&&d>=c&&l<s-c&&d<s-c)h=u[i[Math.floor((l-c)/a)*o+Math.floor((d-c)/a)]?1:0];t[f++]=h.r,t[f++]=h.g,t[f++]=h.b,t[f]=h.a}}}(utils$2),function(e){var t=utils$2;e.render=function(e,r,n){var o=n,i=r;void 0!==o||r&&r.getContext||(o=r,r=void 0),r||(i=function(){try{return document.createElement("canvas")}catch(e2){throw new Error("You need to specify a canvas element")}}()),o=t.getOptions(o);var a=t.getImageWidth(e.modules.size,o),s=i.getContext("2d"),c=s.createImageData(a,a);return t.qrToImageData(c.data,e,o),function(e,t,r){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=r,t.width=r,t.style.height=r+"px",t.style.width=r+"px"}(s,i,a),s.putImageData(c,0,0),i},e.renderToDataURL=function(t,r,n){var o=n;void 0!==o||r&&r.getContext||(o=r,r=void 0),o||(o={});var i=e.render(t,r,o),a=o.type||"image/png",s=o.rendererOpts||{};return i.toDataURL(a,s.quality)}}(canvas$1);var svgTag$1={},Utils$4=utils$2;function getColorAttrib$1(e,t){var r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function svgCmd$1(e,t,r){var n=e+t;return void 0!==r&&(n+=" "+r),n}function qrToPath$1(e,t,r){for(var n="",o=0,i=!1,a=0,s=0;s<e.length;s++){var c=Math.floor(s%t),u=Math.floor(s/t);c||i||(i=!0),e[s]?(a++,s>0&&c>0&&e[s-1]||(n+=i?svgCmd$1("M",c+r,.5+u+r):svgCmd$1("m",o,0),o=0,i=!1),c+1<t&&e[s+1]||(n+=svgCmd$1("h",a),a=0)):o++}return n}svgTag$1.render=function(e,t,r){var n=Utils$4.getOptions(t),o=e.modules.size,i=e.modules.data,a=o+2*n.margin,s=n.color.light.a?"<path "+getColorAttrib$1(n.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",c="<path "+getColorAttrib$1(n.color.dark,"stroke")+' d="'+qrToPath$1(i,o,n.margin)+'"/>',u='viewBox="0 0 '+a+" "+a+'"',l='<svg xmlns="http://www.w3.org/2000/svg" '+(n.width?'width="'+n.width+'" height="'+n.width+'" ':"")+u+' shape-rendering="crispEdges">'+s+c+"</svg>\n";return"function"==typeof r&&r(null,l),l};var canPromise$2=canPromise$3,QRCode$2=qrcode$1,CanvasRenderer$1=canvas$1,SvgRenderer$1=svgTag$1;function renderCanvas$1(e,t,r,n,o){var i=[].slice.call(arguments,1),a=i.length,s="function"==typeof i[a-1];if(!s&&!canPromise$2())throw new Error("Callback required as last argument");if(!s){if(a<1)throw new Error("Too few arguments provided");return 1===a?(r=t,t=n=void 0):2!==a||t.getContext||(n=r,r=t,t=void 0),new Promise((function(o,i){try{var a=QRCode$2.create(r,n);o(e(a,t,n))}catch(e2){i(e2)}}))}if(a<2)throw new Error("Too few arguments provided");2===a?(o=r,r=t,t=n=void 0):3===a&&(t.getContext&&void 0===o?(o=n,n=void 0):(o=n,n=r,r=t,t=void 0));try{var c=QRCode$2.create(r,n);o(null,e(c,t,n))}catch(e2){o(e2)}}browser$1.create=QRCode$2.create,browser$1.toCanvas=renderCanvas$1.bind(null,CanvasRenderer$1.render),browser$1.toDataURL=renderCanvas$1.bind(null,CanvasRenderer$1.renderToDataURL),browser$1.toString=renderCanvas$1.bind(null,(function(e,t,r){return SvgRenderer$1.render(e,r)}));var toggleSelection=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n<e.rangeCount;n++)r.push(e.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||r.forEach((function(t){e.addRange(t)})),t&&t.focus()}},deselectCurrent=toggleSelection,clipboardToIE11Formatting={"text/plain":"Text","text/html":"Url",default:"Text"},defaultMessage="Copy to clipboard: #{key}, Enter";function format(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function copy$1(e,t){var r,n,o,i,a,s,c=!1;t||(t={}),r=t.debug||!1;try{if(o=deselectCurrent(),i=document.createRange(),a=document.getSelection(),(s=document.createElement("span")).textContent=e,s.ariaHidden="true",s.style.all="unset",s.style.position="fixed",s.style.top=0,s.style.clip="rect(0, 0, 0, 0)",s.style.whiteSpace="pre",s.style.webkitUserSelect="text",s.style.MozUserSelect="text",s.style.msUserSelect="text",s.style.userSelect="text",s.addEventListener("copy",(function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=clipboardToIE11Formatting[t.format]||clipboardToIE11Formatting.default;window.clipboardData.setData(o,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))})),document.body.appendChild(s),i.selectNodeContents(s),a.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");c=!0}catch(u){r&&console.error("unable to copy using execCommand: ",u),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(l){r&&console.error("unable to copy using clipboardData: ",l),r&&console.error("falling back to prompt"),n=format("message"in t?t.message:defaultMessage),window.prompt(n,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(i):a.removeAllRanges()),s&&document.body.removeChild(s),o()}return c}var copyToClipboard=copy$1,n$6,u$3,i$5,t$6,r$4,o$6,f$2,e$7={},c$4=[],s$6=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function a$3(e,t){for(var r in t)e[r]=t[r];return e}function v$2(e){var t=e.parentNode;t&&t.removeChild(e)}function h$4(e,t,r){var n,o=arguments,i={};for(n in t)"key"!==n&&"ref"!==n&&(i[n]=t[n]);if(arguments.length>3)for(r=[r],n=3;n<arguments.length;n++)r.push(o[n]);if(null!=r&&(i.children=r),"function"==typeof e&&null!=e.defaultProps)for(n in e.defaultProps)void 0===i[n]&&(i[n]=e.defaultProps[n]);return p$2(e,i,t&&t.key,t&&t.ref,null)}function p$2(e,t,r,n,o){var i={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o};return null==o&&(i.__v=i),n$6.vnode&&n$6.vnode(i),i}function y$3(){return{}}function d$3(e){return e.children}function m$2(e,t){this.props=e,this.context=t}function w$3(e,t){if(null==t)return e.__?w$3(e.__,e.__.__k.indexOf(e)+1):null;for(var r;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e)return r.__e;return"function"==typeof e.type?w$3(e):null}function k$2(e){var t,r;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e){e.__e=e.__c.base=r.__e;break}return k$2(e)}}function g$2(e){(!e.__d&&(e.__d=!0)&&u$3.push(e)&&!i$5++||r$4!==n$6.debounceRendering)&&((r$4=n$6.debounceRendering)||t$6)(_$3)}function _$3(){for(var e;i$5=u$3.length;)e=u$3.sort((function(e,t){return e.__v.__b-t.__v.__b})),u$3=[],e.some((function(e){var t,r,n,o,i,a,s;e.__d&&(a=(i=(t=e).__v).__e,(s=t.__P)&&(r=[],(n=a$3({},i)).__v=n,o=A$3(s,i,n,t.__n,void 0!==s.ownerSVGElement,null,r,null==a?w$3(i):a),T$3(r,i),o!=a&&k$2(i)))}))}function b$1(e,t,r,n,o,i,a,s,c){var u,l,d,f,h,p,y,m=r&&r.__k||c$4,g=m.length;if(s==e$7&&(s=null!=i?i[0]:g?w$3(r,0):null),u=0,t.__k=x$2(t.__k,(function(r){if(null!=r){if(r.__=t,r.__b=t.__b+1,null===(d=m[u])||d&&r.key==d.key&&r.type===d.type)m[u]=void 0;else for(l=0;l<g;l++){if((d=m[l])&&r.key==d.key&&r.type===d.type){m[l]=void 0;break}d=null}if(f=A$3(e,r,d=d||e$7,n,o,i,a,s,c),(l=r.ref)&&d.ref!=l&&(y||(y=[]),d.ref&&y.push(d.ref,null,r),y.push(l,r.__c||f,r)),null!=f){var b;if(null==p&&(p=f),void 0!==r.__d)b=r.__d,r.__d=void 0;else if(i==d||f!=s||null==f.parentNode){e:if(null==s||s.parentNode!==e)e.appendChild(f),b=null;else{for(h=s,l=0;(h=h.nextSibling)&&l<g;l+=2)if(h==f)break e;e.insertBefore(f,s),b=s}"option"==t.type&&(e.value="")}s=void 0!==b?b:f.nextSibling,"function"==typeof t.type&&(t.__d=s)}else s&&d.__e==s&&s.parentNode!=e&&(s=w$3(d))}return u++,r})),t.__e=p,null!=i&&"function"!=typeof t.type)for(u=i.length;u--;)null!=i[u]&&v$2(i[u]);for(u=g;u--;)null!=m[u]&&D$2(m[u],m[u]);if(y)for(u=0;u<y.length;u++)j$1(y[u],y[++u],y[++u])}function x$2(e,t,r){if(null==r&&(r=[]),null==e||"boolean"==typeof e)t&&r.push(t(null));else if(Array.isArray(e))for(var n=0;n<e.length;n++)x$2(e[n],t,r);else r.push(t?t("string"==typeof e||"number"==typeof e?p$2(null,e,null,null,e):null!=e.__e||null!=e.__c?p$2(e.type,e.props,e.key,null,e.__v):e):e);return r}function P$2(e,t,r,n,o){var i;for(i in r)"children"===i||"key"===i||i in t||N$2(e,i,null,r[i],n);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||r[i]===t[i]||N$2(e,i,t[i],r[i],n)}function C$2(e,t,r){"-"===t[0]?e.setProperty(t,r):e[t]="number"==typeof r&&!1===s$6.test(t)?r+"px":null==r?"":r}function N$2(e,t,r,n,o){var i,a,s,c,u;if(o?"className"===t&&(t="class"):"class"===t&&(t="className"),"style"===t)if(i=e.style,"string"==typeof r)i.cssText=r;else{if("string"==typeof n&&(i.cssText="",n=null),n)for(c in n)r&&c in r||C$2(i,c,"");if(r)for(u in r)n&&r[u]===n[u]||C$2(i,u,r[u])}else"o"===t[0]&&"n"===t[1]?(a=t!==(t=t.replace(/Capture$/,"")),s=t.toLowerCase(),t=(s in e?s:t).slice(2),r?(n||e.addEventListener(t,z$2,a),(e.l||(e.l={}))[t]=r):e.removeEventListener(t,z$2,a)):"list"!==t&&"tagName"!==t&&"form"!==t&&"type"!==t&&"size"!==t&&!o&&t in e?e[t]=null==r?"":r:"function"!=typeof r&&"dangerouslySetInnerHTML"!==t&&(t!==(t=t.replace(/^xlink:?/,""))?null==r||!1===r?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),r):null==r||!1===r&&!/^ar/.test(t)?e.removeAttribute(t):e.setAttribute(t,r))}function z$2(e){this.l[e.type](n$6.event?n$6.event(e):e)}function A$3(e,t,r,n,o,i,a,s,c){var u,l,d,f,h,p,y,m,g,b,v=t.type;if(void 0!==t.constructor)return null;(u=n$6.__b)&&u(t);try{e:if("function"==typeof v){if(m=t.props,g=(u=v.contextType)&&n[u.__c],b=u?g?g.props.value:u.__:n,r.__c?y=(l=t.__c=r.__c).__=l.__E:("prototype"in v&&v.prototype.render?t.__c=l=new v(m,b):(t.__c=l=new m$2(m,b),l.constructor=v,l.render=E$3),g&&g.sub(l),l.props=m,l.state||(l.state={}),l.context=b,l.__n=n,d=l.__d=!0,l.__h=[]),null==l.__s&&(l.__s=l.state),null!=v.getDerivedStateFromProps&&(l.__s==l.state&&(l.__s=a$3({},l.__s)),a$3(l.__s,v.getDerivedStateFromProps(m,l.__s))),f=l.props,h=l.state,d)null==v.getDerivedStateFromProps&&null!=l.componentWillMount&&l.componentWillMount(),null!=l.componentDidMount&&l.__h.push(l.componentDidMount);else{if(null==v.getDerivedStateFromProps&&m!==f&&null!=l.componentWillReceiveProps&&l.componentWillReceiveProps(m,b),!l.__e&&null!=l.shouldComponentUpdate&&!1===l.shouldComponentUpdate(m,l.__s,b)||t.__v===r.__v&&!l.__){for(l.props=m,l.state=l.__s,t.__v!==r.__v&&(l.__d=!1),l.__v=t,t.__e=r.__e,t.__k=r.__k,l.__h.length&&a.push(l),u=0;u<t.__k.length;u++)t.__k[u]&&(t.__k[u].__=t);break e}null!=l.componentWillUpdate&&l.componentWillUpdate(m,l.__s,b),null!=l.componentDidUpdate&&l.__h.push((function(){l.componentDidUpdate(f,h,p)}))}l.context=b,l.props=m,l.state=l.__s,(u=n$6.__r)&&u(t),l.__d=!1,l.__v=t,l.__P=e,u=l.render(l.props,l.state,l.context),t.__k=null!=u&&u.type==d$3&&null==u.key?u.props.children:Array.isArray(u)?u:[u],null!=l.getChildContext&&(n=a$3(a$3({},n),l.getChildContext())),d||null==l.getSnapshotBeforeUpdate||(p=l.getSnapshotBeforeUpdate(f,h)),b$1(e,t,r,n,o,i,a,s,c),l.base=t.__e,l.__h.length&&a.push(l),y&&(l.__E=l.__=null),l.__e=!1}else null==i&&t.__v===r.__v?(t.__k=r.__k,t.__e=r.__e):t.__e=$$2(r.__e,t,r,n,o,i,a,c);(u=n$6.diffed)&&u(t)}catch(w){t.__v=null,n$6.__e(w,t,r)}return t.__e}function T$3(e,t){n$6.__c&&n$6.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(r){n$6.__e(r,t.__v)}}))}function $$2(e,t,r,n,o,i,a,s){var c,u,l,d,f,h=r.props,p=t.props;if(o="svg"===t.type||o,null!=i)for(c=0;c<i.length;c++)if(null!=(u=i[c])&&((null===t.type?3===u.nodeType:u.localName===t.type)||e==u)){e=u,i[c]=null;break}if(null==e){if(null===t.type)return document.createTextNode(p);e=o?document.createElementNS("http://www.w3.org/2000/svg",t.type):document.createElement(t.type,p.is&&{is:p.is}),i=null,s=!1}if(null===t.type)h!==p&&e.data!=p&&(e.data=p);else{if(null!=i&&(i=c$4.slice.call(e.childNodes)),l=(h=r.props||e$7).dangerouslySetInnerHTML,d=p.dangerouslySetInnerHTML,!s){if(h===e$7)for(h={},f=0;f<e.attributes.length;f++)h[e.attributes[f].name]=e.attributes[f].value;(d||l)&&(d&&l&&d.__html==l.__html||(e.innerHTML=d&&d.__html||""))}P$2(e,p,h,o,s),d?t.__k=[]:(t.__k=t.props.children,b$1(e,t,r,n,"foreignObject"!==t.type&&o,i,a,e$7,s)),s||("value"in p&&void 0!==(c=p.value)&&c!==e.value&&N$2(e,"value",c,h.value,!1),"checked"in p&&void 0!==(c=p.checked)&&c!==e.checked&&N$2(e,"checked",c,h.checked,!1))}return e}function j$1(e,t,r){try{"function"==typeof e?e(t):e.current=t}catch(n){n$6.__e(n,r)}}function D$2(e,t,r){var n,o,i;if(n$6.unmount&&n$6.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||j$1(n,null,t)),r||"function"==typeof e.type||(r=null!=(o=e.__e)),e.__e=e.__d=void 0,null!=(n=e.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(a){n$6.__e(a,t)}n.base=n.__P=null}if(n=e.__k)for(i=0;i<n.length;i++)n[i]&&D$2(n[i],t,r);null!=o&&v$2(o)}function E$3(e,t,r){return this.constructor(e,r)}function H$2(e,t,r){var n,o,i;n$6.__&&n$6.__(e,t),o=(n=r===o$6)?null:r&&r.__k||t.__k,e=h$4(d$3,null,[e]),i=[],A$3(t,(n?t:r||t).__k=e,o||e$7,e$7,void 0!==t.ownerSVGElement,r&&!n?[r]:o?null:c$4.slice.call(t.childNodes),i,r||e$7,n),T$3(i,e)}function I$2(e,t){H$2(e,t,o$6)}function L$2(e,t){var r,n;for(n in t=a$3(a$3({},e.props),t),arguments.length>2&&(t.children=c$4.slice.call(arguments,2)),r={},t)"key"!==n&&"ref"!==n&&(r[n]=t[n]);return p$2(e.type,r,t.key||e.key,t.ref||e.ref,null)}function M$2(e){var t={},r={__c:"__cC"+f$2++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,o=this;return this.getChildContext||(n=[],this.getChildContext=function(){return t[r.__c]=o,t},this.shouldComponentUpdate=function(e){o.props.value!==e.value&&n.some((function(t){t.context=e.value,g$2(t)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return r.Consumer.contextType=r,r.Provider.__=r,r}n$6={__e:function(e,t){for(var r,n;t=t.__;)if((r=t.__c)&&!r.__)try{if(r.constructor&&null!=r.constructor.getDerivedStateFromError&&(n=!0,r.setState(r.constructor.getDerivedStateFromError(e))),null!=r.componentDidCatch&&(n=!0,r.componentDidCatch(e)),n)return g$2(r.__E=r)}catch(o){e=o}throw e}},m$2.prototype.setState=function(e,t){var r;r=this.__s!==this.state?this.__s:this.__s=a$3({},this.state),"function"==typeof e&&(e=e(r,this.props)),e&&a$3(r,e),null!=e&&this.__v&&(t&&this.__h.push(t),g$2(this))},m$2.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),g$2(this))},m$2.prototype.render=d$3,u$3=[],i$5=0,t$6="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,o$6=e$7,f$2=0;var t$5,u$2,r$3,i$4=0,o$5=[],c$3=n$6.__r,f$1=n$6.diffed,e$6=n$6.__c,a$2=n$6.unmount;function v$1(e,t){n$6.__h&&n$6.__h(u$2,e,i$4||t),i$4=0;var r=u$2.__H||(u$2.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function m$1(e){return i$4=1,p$1(E$2,e)}function p$1(e,t,r){var n=v$1(t$5++,2);return n.__c||(n.__c=u$2,n.__=[r?r(t):E$2(void 0,t),function(t){var r=e(n.__[0],t);n.__[0]!==r&&(n.__[0]=r,n.__c.setState({}))}]),n.__}function l$5(e,t){var r=v$1(t$5++,3);!n$6.__s&&x$1(r.__H,t)&&(r.__=e,r.__H=t,u$2.__H.__h.push(r))}function y$2(e,t){var r=v$1(t$5++,4);!n$6.__s&&x$1(r.__H,t)&&(r.__=e,r.__H=t,u$2.__h.push(r))}function d$2(e){return i$4=5,h$3((function(){return{current:e}}),[])}function s$5(e,t,r){i$4=6,y$2((function(){"function"==typeof e?e(t()):e&&(e.current=t())}),null==r?r:r.concat(e))}function h$3(e,t){var r=v$1(t$5++,7);return x$1(r.__H,t)?(r.__H=t,r.__h=e,r.__=e()):r.__}function T$2(e,t){return i$4=8,h$3((function(){return e}),t)}function w$2(e){var t=u$2.context[e.__c],r=v$1(t$5++,9);return r.__c=e,t?(null==r.__&&(r.__=!0,t.sub(u$2)),t.props.value):e.__}function A$2(e,t){n$6.useDebugValue&&n$6.useDebugValue(t?t(e):e)}function F$1(e){var t=v$1(t$5++,10),r=m$1();return t.__=e,u$2.componentDidCatch||(u$2.componentDidCatch=function(e){t.__&&t.__(e),r[1](e)}),[r[0],function(){r[1](void 0)}]}function _$2(){o$5.some((function(e){if(e.__P)try{e.__H.__h.forEach(g$1),e.__H.__h.forEach(q$1),e.__H.__h=[]}catch(t){return e.__H.__h=[],n$6.__e(t,e.__v),!0}})),o$5=[]}function g$1(e){e.t&&e.t()}function q$1(e){var t=e.__();"function"==typeof t&&(e.t=t)}function x$1(e,t){return!e||t.some((function(t,r){return t!==e[r]}))}function E$2(e,t){return"function"==typeof t?t(e):t}function E$1(e,t){for(var r in t)e[r]=t[r];return e}function w$1(e,t){for(var r in e)if("__source"!==r&&!(r in t))return!0;for(var n in t)if("__source"!==n&&e[n]!==t[n])return!0;return!1}n$6.__r=function(e){c$3&&c$3(e),t$5=0,(u$2=e.__c).__H&&(u$2.__H.__h.forEach(g$1),u$2.__H.__h.forEach(q$1),u$2.__H.__h=[])},n$6.diffed=function(e){f$1&&f$1(e);var t=e.__c;if(t){var r=t.__H;r&&r.__h.length&&(1!==o$5.push(t)&&r$3===n$6.requestAnimationFrame||((r$3=n$6.requestAnimationFrame)||function(e){var t,r=function(){clearTimeout(n),cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);"undefined"!=typeof window&&(t=requestAnimationFrame(r))})(_$2))}},n$6.__c=function(e,t){t.some((function(e){try{e.__h.forEach(g$1),e.__h=e.__h.filter((function(e){return!e.__||q$1(e)}))}catch(r){t.some((function(e){e.__h&&(e.__h=[])})),t=[],n$6.__e(r,e.__v)}})),e$6&&e$6(e,t)},n$6.unmount=function(e){a$2&&a$2(e);var t=e.__c;if(t){var r=t.__H;if(r)try{r.__.forEach((function(e){return e.t&&e.t()}))}catch(n){n$6.__e(n,t.__v)}}};var C$1=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).isPureReactComponent=!0,r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.prototype.shouldComponentUpdate=function(e,t){return w$1(this.props,e)||w$1(this.state,t)},n}(m$2);function _$1(e,t){function r(e){var r=this.props.ref,n=r==e.ref;return!n&&r&&(r.call?r(null):r.current=null),t?!t(this.props,e)||!n:w$1(this.props,e)}function n(t){return this.shouldComponentUpdate=r,h$4(e,E$1({},t))}return n.prototype.isReactComponent=!0,n.displayName="Memo("+(e.displayName||e.name)+")",n.t=!0,n}var A$1=n$6.__b;function S$2(e){function t(t){var r=E$1({},t);return delete r.ref,e(r,t.ref)}return t.prototype.isReactComponent=t.t=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}n$6.__b=function(e){e.type&&e.type.t&&e.ref&&(e.props.ref=e.ref,e.ref=null),A$1&&A$1(e)};var k$1=function(e,t){return e?x$2(e).reduce((function(e,r,n){return e.concat(t(r,n))}),[]):null},R$1={map:k$1,forEach:k$1,count:function(e){return e?x$2(e).length:0},only:function(e){if(1!==(e=x$2(e)).length)throw new Error("Children.only() expects only one child.");return e[0]},toArray:x$2},F=n$6.__e;function N$1(e){return e&&((e=E$1({},e)).__c=null,e.__k=e.__k&&e.__k.map(N$1)),e}function U(){this.__u=0,this.o=null,this.__b=null}function M$1(e){var t=e.__.__c;return t&&t.u&&t.u(e)}function L$1(e){var t,r,n;function o(o){if(t||(t=e()).then((function(e){r=e.default||e}),(function(e){n=e})),n)throw n;if(!r)throw t;return h$4(r,o)}return o.displayName="Lazy",o.t=!0,o}function O(){this.i=null,this.l=null}n$6.__e=function(e,t,r){if(e.then)for(var n,o=t;o=o.__;)if((n=o.__c)&&n.__c)return n.__c(e,t.__c);F(e,t,r)},(U.prototype=new m$2).__c=function(e,t){var r=this;null==r.o&&(r.o=[]),r.o.push(t);var n=M$1(r.__v),o=!1,i=function(){o||(o=!0,n?n(a):a())};t.__c=t.componentWillUnmount,t.componentWillUnmount=function(){i(),t.__c&&t.__c()};var a=function(){var e;if(! --r.__u)for(r.__v.__k[0]=r.state.u,r.setState({u:r.__b=null});e=r.o.pop();)e.forceUpdate()};r.__u++||r.setState({u:r.__b=r.__v.__k[0]}),e.then(i,i)},U.prototype.render=function(e,t){return this.__b&&(this.__v.__k[0]=N$1(this.__b),this.__b=null),[h$4(m$2,null,t.u?null:e.children),t.u&&e.fallback]};var P$1=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};(O.prototype=new m$2).u=function(e){var t=this,r=M$1(t.__v),n=t.l.get(e);return n[0]++,function(o){var i=function(){t.props.revealOrder?(n.push(o),P$1(t,e,n)):o()};r?r(i):i()}},O.prototype.render=function(e){this.i=null,this.l=new Map;var t=x$2(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},O.prototype.componentDidUpdate=O.prototype.componentDidMount=function(){var e=this;e.l.forEach((function(t,r){P$1(e,r,t)}))};var W=function(){function e(){}var t=e.prototype;return t.getChildContext=function(){return this.props.context},t.render=function(e){return e.children},e}();function j(e){var t=this,r=e.container,n=h$4(W,{context:t.context},e.vnode);return t.s&&t.s!==r&&(t.v.parentNode&&t.s.removeChild(t.v),D$2(t.h),t.p=!1),e.vnode?t.p?(r.__k=t.__k,H$2(n,r),t.__k=r.__k):(t.v=document.createTextNode(""),I$2("",r),r.appendChild(t.v),t.p=!0,t.s=r,H$2(n,r,t.v),t.__k=t.v.__k):t.p&&(t.v.parentNode&&t.s.removeChild(t.v),D$2(t.h)),t.h=n,t.componentWillUnmount=function(){t.v.parentNode&&t.s.removeChild(t.v),D$2(t.h)},null}function z$1(e,t){return h$4(j,{vnode:e,container:t})}var D$1=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;m$2.prototype.isReactComponent={};var H$1="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;function T$1(e,t,r){if(null==t.__k)for(;t.firstChild;)t.removeChild(t.firstChild);return H$2(e,t),"function"==typeof r&&r(),e?e.__c:null}function V$1(e,t,r){return I$2(e,t),"function"==typeof r&&r(),e?e.__c:null}var Z$1=n$6.event;function I$1(e,t){e["UNSAFE_"+t]&&!e[t]&&Object.defineProperty(e,t,{configurable:!1,get:function(){return this["UNSAFE_"+t]},set:function(e){this["UNSAFE_"+t]=e}})}n$6.event=function(e){Z$1&&(e=Z$1(e)),e.persist=function(){};var t=!1,r=!1,n=e.stopPropagation;e.stopPropagation=function(){n.call(e),t=!0};var o=e.preventDefault;return e.preventDefault=function(){o.call(e),r=!0},e.isPropagationStopped=function(){return t},e.isDefaultPrevented=function(){return r},e.nativeEvent=e};var $$1={configurable:!0,get:function(){return this.class}},q=n$6.vnode;n$6.vnode=function(e){e.$$typeof=H$1;var t=e.type,r=e.props;if(t){if(r.class!=r.className&&($$1.enumerable="className"in r,null!=r.className&&(r.class=r.className),Object.defineProperty(r,"className",$$1)),"function"!=typeof t){var n,o,i;for(i in r.defaultValue&&void 0!==r.value&&(r.value||0===r.value||(r.value=r.defaultValue),delete r.defaultValue),Array.isArray(r.value)&&r.multiple&&"select"===t&&(x$2(r.children).forEach((function(e){-1!=r.value.indexOf(e.props.value)&&(e.props.selected=!0)})),delete r.value),r)if(n=D$1.test(i))break;if(n)for(i in o=e.props={},r)o[D$1.test(i)?i.replace(/[A-Z0-9]/,"-$&").toLowerCase():i]=r[i]}!function(){var t=e.type,r=e.props;if(r&&"string"==typeof t){var n={};for(var o in r)/^on(Ani|Tra|Tou)/.test(o)&&(r[o.toLowerCase()]=r[o],delete r[o]),n[o.toLowerCase()]=o;if(n.ondoubleclick&&(r.ondblclick=r[n.ondoubleclick],delete r[n.ondoubleclick]),n.onbeforeinput&&(r.onbeforeinput=r[n.onbeforeinput],delete r[n.onbeforeinput]),n.onchange&&("textarea"===t||"input"===t.toLowerCase()&&!/^fil|che|ra/i.test(r.type))){var i=n.oninput||"oninput";r[i]||(r[i]=r[n.onchange],delete r[n.onchange])}}}(),"function"==typeof t&&!t.m&&t.prototype&&(I$1(t.prototype,"componentWillMount"),I$1(t.prototype,"componentWillReceiveProps"),I$1(t.prototype,"componentWillUpdate"),t.m=!0)}q&&q(e)};var B$1="16.8.0";function G(e){return h$4.bind(null,e)}function J(e){return!!e&&e.$$typeof===H$1}function K(e){return J(e)?L$2.apply(null,arguments):e}function Q(e){return!!e.__k&&(H$2(null,e),!0)}function X(e){return e&&(e.base||1===e.nodeType&&e)||null}var Y=function(e,t){return e(t)};const compat_module={useState:m$1,useReducer:p$1,useEffect:l$5,useLayoutEffect:y$2,useRef:d$2,useImperativeHandle:s$5,useMemo:h$3,useCallback:T$2,useContext:w$2,useDebugValue:A$2,version:"16.8.0",Children:R$1,render:T$1,hydrate:T$1,unmountComponentAtNode:Q,createPortal:z$1,createElement:h$4,createContext:M$2,createFactory:G,cloneElement:K,createRef:y$3,Fragment:d$3,isValidElement:J,findDOMNode:X,Component:m$2,PureComponent:C$1,memo:_$1,forwardRef:S$2,unstable_batchedUpdates:Y,Suspense:U,SuspenseList:O,lazy:L$1},compat_module$1=Object.freeze(Object.defineProperty({__proto__:null,Children:R$1,Component:m$2,Fragment:d$3,PureComponent:C$1,Suspense:U,SuspenseList:O,cloneElement:K,createContext:M$2,createElement:h$4,createFactory:G,createPortal:z$1,createRef:y$3,default:compat_module,findDOMNode:X,forwardRef:S$2,hydrate:V$1,isValidElement:J,lazy:L$1,memo:_$1,render:T$1,unmountComponentAtNode:Q,unstable_batchedUpdates:Y,useCallback:T$2,useContext:w$2,useDebugValue:A$2,useEffect:l$5,useErrorBoundary:F$1,useImperativeHandle:s$5,useLayoutEffect:y$2,useMemo:h$3,useReducer:p$1,useRef:d$2,useState:m$1,version:B$1},Symbol.toStringTag,{value:"Module"})),require$$3=getAugmentedNamespace(compat_module$1);function _interopDefault$1(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var browserUtils=require$$0,QRCode$1=_interopDefault$1(browser$1),copy=_interopDefault$1(copyToClipboard),React=require$$3;function open(e){QRCode$1.toString(e,{type:"terminal"}).then(console.log)}var WALLETCONNECT_STYLE_SHEET=':root {\n --animation-duration: 300ms;\n}\n\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes fadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n.animated {\n animation-duration: var(--animation-duration);\n animation-fill-mode: both;\n}\n\n.fadeIn {\n animation-name: fadeIn;\n}\n\n.fadeOut {\n animation-name: fadeOut;\n}\n\n#walletconnect-wrapper {\n -webkit-user-select: none;\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n left: 0;\n pointer-events: none;\n position: fixed;\n top: 0;\n user-select: none;\n width: 100%;\n z-index: 99999999999999;\n}\n\n.walletconnect-modal__headerLogo {\n height: 21px;\n}\n\n.walletconnect-modal__header p {\n color: #ffffff;\n font-size: 20px;\n font-weight: 600;\n margin: 0;\n align-items: flex-start;\n display: flex;\n flex: 1;\n margin-left: 5px;\n}\n\n.walletconnect-modal__close__wrapper {\n position: absolute;\n top: 0px;\n right: 0px;\n z-index: 10000;\n background: white;\n border-radius: 26px;\n padding: 6px;\n box-sizing: border-box;\n width: 26px;\n height: 26px;\n cursor: pointer;\n}\n\n.walletconnect-modal__close__icon {\n position: relative;\n top: 7px;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n transform: rotate(45deg);\n}\n\n.walletconnect-modal__close__line1 {\n position: absolute;\n width: 100%;\n border: 1px solid rgb(48, 52, 59);\n}\n\n.walletconnect-modal__close__line2 {\n position: absolute;\n width: 100%;\n border: 1px solid rgb(48, 52, 59);\n transform: rotate(90deg);\n}\n\n.walletconnect-qrcode__base {\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n background: rgba(37, 41, 46, 0.95);\n height: 100%;\n left: 0;\n pointer-events: auto;\n position: fixed;\n top: 0;\n transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);\n width: 100%;\n will-change: opacity;\n padding: 40px;\n box-sizing: border-box;\n}\n\n.walletconnect-qrcode__text {\n color: rgba(60, 66, 82, 0.6);\n font-size: 16px;\n font-weight: 600;\n letter-spacing: 0;\n line-height: 1.1875em;\n margin: 10px 0 20px 0;\n text-align: center;\n width: 100%;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-qrcode__text {\n font-size: 4vw;\n }\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-qrcode__text {\n font-size: 14px;\n }\n}\n\n.walletconnect-qrcode__image {\n width: calc(100% - 30px);\n box-sizing: border-box;\n cursor: none;\n margin: 0 auto;\n}\n\n.walletconnect-qrcode__notification {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n font-size: 16px;\n padding: 16px 20px;\n border-radius: 16px;\n text-align: center;\n transition: all 0.1s ease-in-out;\n background: white;\n color: black;\n margin-bottom: -60px;\n opacity: 0;\n}\n\n.walletconnect-qrcode__notification.notification__show {\n opacity: 1;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-modal__header {\n height: 130px;\n }\n .walletconnect-modal__base {\n overflow: auto;\n }\n}\n\n@media only screen and (min-device-width: 415px) and (max-width: 768px) {\n #content {\n max-width: 768px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (min-width: 375px) and (max-width: 415px) {\n #content {\n max-width: 414px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (min-width: 320px) and (max-width: 375px) {\n #content {\n max-width: 375px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (max-width: 320px) {\n #content {\n max-width: 320px;\n box-sizing: border-box;\n }\n}\n\n.walletconnect-modal__base {\n -webkit-font-smoothing: antialiased;\n background: #ffffff;\n border-radius: 24px;\n box-shadow: 0 10px 50px 5px rgba(0, 0, 0, 0.4);\n font-family: ui-rounded, "SF Pro Rounded", "SF Pro Text", medium-content-sans-serif-font,\n -apple-system, BlinkMacSystemFont, ui-sans-serif, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell,\n "Open Sans", "Helvetica Neue", sans-serif;\n margin-top: 41px;\n padding: 24px 24px 22px;\n pointer-events: auto;\n position: relative;\n text-align: center;\n transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);\n will-change: transform;\n overflow: visible;\n transform: translateY(-50%);\n top: 50%;\n max-width: 500px;\n margin: auto;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-modal__base {\n padding: 24px 12px;\n }\n}\n\n.walletconnect-modal__base .hidden {\n transform: translateY(150%);\n transition: 0.125s cubic-bezier(0.4, 0, 1, 1);\n}\n\n.walletconnect-modal__header {\n align-items: center;\n display: flex;\n height: 26px;\n left: 0;\n justify-content: space-between;\n position: absolute;\n top: -42px;\n width: 100%;\n}\n\n.walletconnect-modal__base .wc-logo {\n align-items: center;\n display: flex;\n height: 26px;\n margin-top: 15px;\n padding-bottom: 15px;\n pointer-events: auto;\n}\n\n.walletconnect-modal__base .wc-logo div {\n background-color: #3399ff;\n height: 21px;\n margin-right: 5px;\n mask-image: url("images/wc-logo.svg") center no-repeat;\n width: 32px;\n}\n\n.walletconnect-modal__base .wc-logo p {\n color: #ffffff;\n font-size: 20px;\n font-weight: 600;\n margin: 0;\n}\n\n.walletconnect-modal__base h2 {\n color: rgba(60, 66, 82, 0.6);\n font-size: 16px;\n font-weight: 600;\n letter-spacing: 0;\n line-height: 1.1875em;\n margin: 0 0 19px 0;\n text-align: center;\n width: 100%;\n}\n\n.walletconnect-modal__base__row {\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n align-items: center;\n border-radius: 20px;\n cursor: pointer;\n display: flex;\n height: 56px;\n justify-content: space-between;\n padding: 0 15px;\n position: relative;\n margin: 0px 0px 8px;\n text-align: left;\n transition: 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n will-change: transform;\n text-decoration: none;\n}\n\n.walletconnect-modal__base__row:hover {\n background: rgba(60, 66, 82, 0.06);\n}\n\n.walletconnect-modal__base__row:active {\n background: rgba(60, 66, 82, 0.06);\n transform: scale(0.975);\n transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n}\n\n.walletconnect-modal__base__row__h3 {\n color: #25292e;\n font-size: 20px;\n font-weight: 700;\n margin: 0;\n padding-bottom: 3px;\n}\n\n.walletconnect-modal__base__row__right {\n align-items: center;\n display: flex;\n justify-content: center;\n}\n\n.walletconnect-modal__base__row__right__app-icon {\n border-radius: 8px;\n height: 34px;\n margin: 0 11px 2px 0;\n width: 34px;\n background-size: 100%;\n box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);\n}\n\n.walletconnect-modal__base__row__right__caret {\n height: 18px;\n opacity: 0.3;\n transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n width: 8px;\n will-change: opacity;\n}\n\n.walletconnect-modal__base__row:hover .caret,\n.walletconnect-modal__base__row:active .caret {\n opacity: 0.6;\n}\n\n.walletconnect-modal__mobile__toggle {\n width: 80%;\n display: flex;\n margin: 0 auto;\n position: relative;\n overflow: hidden;\n border-radius: 8px;\n margin-bottom: 18px;\n background: #d4d5d9;\n}\n\n.walletconnect-modal__single_wallet {\n display: flex;\n justify-content: center;\n margin-top: 7px;\n margin-bottom: 18px;\n}\n\n.walletconnect-modal__single_wallet a {\n cursor: pointer;\n color: rgb(64, 153, 255);\n font-size: 21px;\n font-weight: 800;\n text-decoration: none !important;\n margin: 0 auto;\n}\n\n.walletconnect-modal__mobile__toggle_selector {\n width: calc(50% - 8px);\n background: white;\n position: absolute;\n border-radius: 5px;\n height: calc(100% - 8px);\n top: 4px;\n transition: all 0.2s ease-in-out;\n transform: translate3d(4px, 0, 0);\n}\n\n.walletconnect-modal__mobile__toggle.right__selected .walletconnect-modal__mobile__toggle_selector {\n transform: translate3d(calc(100% + 12px), 0, 0);\n}\n\n.walletconnect-modal__mobile__toggle a {\n font-size: 12px;\n width: 50%;\n text-align: center;\n padding: 8px;\n margin: 0;\n font-weight: 600;\n z-index: 1;\n}\n\n.walletconnect-modal__footer {\n display: flex;\n justify-content: center;\n margin-top: 20px;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-modal__footer {\n margin-top: 5vw;\n }\n}\n\n.walletconnect-modal__footer a {\n cursor: pointer;\n color: #898d97;\n font-size: 15px;\n margin: 0 auto;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-modal__footer a {\n font-size: 14px;\n }\n}\n\n.walletconnect-connect__buttons__wrapper {\n max-height: 44vh;\n}\n\n.walletconnect-connect__buttons__wrapper__android {\n margin: 50% 0;\n}\n\n.walletconnect-connect__buttons__wrapper__wrap {\n display: grid;\n grid-template-columns: repeat(4, 1fr);\n margin: 10px 0;\n}\n\n@media only screen and (min-width: 768px) {\n .walletconnect-connect__buttons__wrapper__wrap {\n margin-top: 40px;\n }\n}\n\n.walletconnect-connect__button {\n background-color: rgb(64, 153, 255);\n padding: 12px;\n border-radius: 8px;\n text-decoration: none;\n color: rgb(255, 255, 255);\n font-weight: 500;\n}\n\n.walletconnect-connect__button__icon_anchor {\n cursor: pointer;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n margin: 8px;\n width: 42px;\n justify-self: center;\n flex-direction: column;\n text-decoration: none !important;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-connect__button__icon_anchor {\n margin: 4px;\n }\n}\n\n.walletconnect-connect__button__icon {\n border-radius: 10px;\n height: 42px;\n margin: 0;\n width: 42px;\n background-size: cover !important;\n box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);\n}\n\n.walletconnect-connect__button__text {\n color: #424952;\n font-size: 2.7vw;\n text-decoration: none !important;\n padding: 0;\n margin-top: 1.8vw;\n font-weight: 600;\n}\n\n@media only screen and (min-width: 768px) {\n .walletconnect-connect__button__text {\n font-size: 16px;\n margin-top: 12px;\n }\n}\n\n.walletconnect-search__input {\n border: none;\n background: #d4d5d9;\n border-style: none;\n padding: 8px 16px;\n outline: none;\n font-style: normal;\n font-stretch: normal;\n font-size: 16px;\n font-style: normal;\n font-stretch: normal;\n line-height: normal;\n letter-spacing: normal;\n text-align: left;\n border-radius: 8px;\n width: calc(100% - 16px);\n margin: 0;\n margin-bottom: 8px;\n}\n';function _catch(e,t){try{var r=e()}catch(e2){return t(e2)}return r&&r.then?r.then(void 0,t):r}"undefined"==typeof Symbol||(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"==typeof Symbol||(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var WALLETCONNECT_LOGO_SVG_URL="data:image/svg+xml,%3Csvg height='185' viewBox='0 0 300 185' width='300' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m61.4385429 36.2562612c48.9112241-47.8881663 128.2119871-47.8881663 177.1232091 0l5.886545 5.7634174c2.445561 2.3944081 2.445561 6.2765112 0 8.6709204l-20.136695 19.715503c-1.222781 1.1972051-3.2053 1.1972051-4.428081 0l-8.100584-7.9311479c-34.121692-33.4079817-89.443886-33.4079817-123.5655788 0l-8.6750562 8.4936051c-1.2227816 1.1972041-3.205301 1.1972041-4.4280806 0l-20.1366949-19.7155031c-2.4455612-2.3944092-2.4455612-6.2765122 0-8.6709204zm218.7677961 40.7737449 17.921697 17.546897c2.445549 2.3943969 2.445563 6.2764769.000031 8.6708899l-80.810171 79.121134c-2.445544 2.394426-6.410582 2.394453-8.85616.000062-.00001-.00001-.000022-.000022-.000032-.000032l-57.354143-56.154572c-.61139-.598602-1.60265-.598602-2.21404 0-.000004.000004-.000007.000008-.000011.000011l-57.3529212 56.154531c-2.4455368 2.394432-6.4105755 2.394472-8.8561612.000087-.0000143-.000014-.0000296-.000028-.0000449-.000044l-80.81241943-79.122185c-2.44556021-2.394408-2.44556021-6.2765115 0-8.6709197l17.92172963-17.5468673c2.4455602-2.3944082 6.4105989-2.3944082 8.8561602 0l57.3549775 56.155357c.6113908.598602 1.602649.598602 2.2140398 0 .0000092-.000009.0000174-.000017.0000265-.000024l57.3521031-56.155333c2.445505-2.3944633 6.410544-2.3945531 8.856161-.0002.000034.0000336.000068.0000673.000101.000101l57.354902 56.155432c.61139.598601 1.60265.598601 2.21404 0l57.353975-56.1543249c2.445561-2.3944092 6.410599-2.3944092 8.85616 0z' fill='%233b99fc'/%3E%3C/svg%3E",WALLETCONNECT_HEADER_TEXT="WalletConnect",ANIMATION_DURATION=300,DEFAULT_BUTTON_COLOR="rgb(64, 153, 255)",WALLETCONNECT_WRAPPER_ID="walletconnect-wrapper",WALLETCONNECT_STYLE_ID="walletconnect-style-sheet",WALLETCONNECT_MODAL_ID="walletconnect-qrcode-modal",WALLETCONNECT_CLOSE_BUTTON_ID="walletconnect-qrcode-close",WALLETCONNECT_CTA_TEXT_ID="walletconnect-qrcode-text",WALLETCONNECT_CONNECT_BUTTON_ID="walletconnect-connect-button";function Header(e){return React.createElement("div",{className:"walletconnect-modal__header"},React.createElement("img",{src:WALLETCONNECT_LOGO_SVG_URL,className:"walletconnect-modal__headerLogo"}),React.createElement("p",null,WALLETCONNECT_HEADER_TEXT),React.createElement("div",{className:"walletconnect-modal__close__wrapper",onClick:e.onClose},React.createElement("div",{id:WALLETCONNECT_CLOSE_BUTTON_ID,className:"walletconnect-modal__close__icon"},React.createElement("div",{className:"walletconnect-modal__close__line1"}),React.createElement("div",{className:"walletconnect-modal__close__line2"}))))}function ConnectButton(e){return React.createElement("a",{className:"walletconnect-connect__button",href:e.href,id:WALLETCONNECT_CONNECT_BUTTON_ID+"-"+e.name,onClick:e.onClick,rel:"noopener noreferrer",style:{backgroundColor:e.color},target:"_blank"},e.name)}var CARET_SVG_URL="data:image/svg+xml,%3Csvg fill='none' height='18' viewBox='0 0 8 18' width='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath clip-rule='evenodd' d='m.586301.213898c-.435947.33907-.5144813.967342-.175411 1.403292l4.87831 6.27212c.28087.36111.28087.86677 0 1.22788l-4.878311 6.27211c-.33907.436-.260536 1.0642.175412 1.4033.435949.3391 1.064219.2605 1.403289-.1754l4.87832-6.2721c.84259-1.08336.84259-2.60034 0-3.68367l-4.87832-6.27212c-.33907-.4359474-.96734-.514482-1.403289-.175412z' fill='%233c4252' fill-rule='evenodd'/%3E%3C/svg%3E";function WalletButton(e){var t=e.color,r=e.href,n=e.name,o=e.logo,i=e.onClick;return React.createElement("a",{className:"walletconnect-modal__base__row",href:r,onClick:i,rel:"noopener noreferrer",target:"_blank"},React.createElement("h3",{className:"walletconnect-modal__base__row__h3"},n),React.createElement("div",{className:"walletconnect-modal__base__row__right"},React.createElement("div",{className:"walletconnect-modal__base__row__right__app-icon",style:{background:"url('"+o+"') "+t,backgroundSize:"100%"}}),React.createElement("img",{src:CARET_SVG_URL,className:"walletconnect-modal__base__row__right__caret"})))}function WalletIcon(e){var t=e.color,r=e.href,n=e.name,o=e.logo,i=e.onClick,a=window.innerWidth<768?(n.length>8?2.5:2.7)+"vw":"inherit";return React.createElement("a",{className:"walletconnect-connect__button__icon_anchor",href:r,onClick:i,rel:"noopener noreferrer",target:"_blank"},React.createElement("div",{className:"walletconnect-connect__button__icon",style:{background:"url('"+o+"') "+t,backgroundSize:"100%"}}),React.createElement("div",{style:{fontSize:a},className:"walletconnect-connect__button__text"},n))}var GRID_MIN_COUNT=5,LINKS_PER_PAGE=12;function LinkDisplay(e){var t=browserUtils.isAndroid(),r=React.useState(""),n=r[0],o=r[1],i=React.useState(""),a=i[0],s=i[1],c=React.useState(1),u=c[0],l=c[1],d=a?e.links.filter((function(e){return e.name.toLowerCase().includes(a.toLowerCase())})):e.links,f=e.errorMessage,h=a||d.length>GRID_MIN_COUNT,p=Math.ceil(d.length/LINKS_PER_PAGE),y=[(u-1)*LINKS_PER_PAGE+1,u*LINKS_PER_PAGE],m=d.length?d.filter((function(e,t){return t+1>=y[0]&&t+1<=y[1]})):[],g=!(t||!(p>1)),b=void 0;return React.createElement("div",null,React.createElement("p",{id:WALLETCONNECT_CTA_TEXT_ID,className:"walletconnect-qrcode__text"},t?e.text.connect_mobile_wallet:e.text.choose_preferred_wallet),!t&&React.createElement("input",{className:"walletconnect-search__input",placeholder:"Search",value:n,onChange:function(e){o(e.target.value),clearTimeout(b),e.target.value?b=setTimeout((function(){s(e.target.value),l(1)}),1e3):(o(""),s(""),l(1))}}),React.createElement("div",{className:"walletconnect-connect__buttons__wrapper"+(t?"__android":h&&d.length?"__wrap":"")},t?React.createElement(ConnectButton,{name:e.text.connect,color:DEFAULT_BUTTON_COLOR,href:e.uri,onClick:React.useCallback((function(){browserUtils.saveMobileLinkInfo({name:"Unknown",href:e.uri})}),[])}):m.length?m.map((function(t){var r=t.color,n=t.name,o=t.shortName,i=t.logo,a=browserUtils.formatIOSMobile(e.uri,t),s=React.useCallback((function(){browserUtils.saveMobileLinkInfo({name:n,href:a})}),[m]);return h?React.createElement(WalletIcon,{color:r,href:a,name:o||n,logo:i,onClick:s}):React.createElement(WalletButton,{color:r,href:a,name:n,logo:i,onClick:s})})):React.createElement(React.Fragment,null,React.createElement("p",null,f.length?e.errorMessage:e.links.length&&!d.length?e.text.no_wallets_found:e.text.loading))),g&&React.createElement("div",{className:"walletconnect-modal__footer"},Array(p).fill(0).map((function(e,t){var r=t+1,n=u===r;return React.createElement("a",{style:{margin:"auto 10px",fontWeight:n?"bold":"normal"},onClick:function(){return l(r)}},r)}))))}function Notification(e){var t=!!e.message.trim();return React.createElement("div",{className:"walletconnect-qrcode__notification"+(t?" notification__show":"")},e.message)}var formatQRCodeImage=function(e){try{var t="";return Promise.resolve(QRCode$1.toString(e,{margin:0,type:"svg"})).then((function(e){return"string"==typeof e&&(t=e.replace("<svg",'<svg class="walletconnect-qrcode__image"')),t}))}catch(e2){return Promise.reject(e2)}};function QRCodeDisplay(e){var t=React.useState(""),r=t[0],n=t[1],o=React.useState(""),i=o[0],a=o[1];React.useEffect((function(){try{return Promise.resolve(formatQRCodeImage(e.uri)).then((function(e){a(e)}))}catch(e2){Promise.reject(e2)}}),[]);return React.createElement("div",null,React.createElement("p",{id:WALLETCONNECT_CTA_TEXT_ID,className:"walletconnect-qrcode__text"},e.text.scan_qrcode_with_wallet),React.createElement("div",{dangerouslySetInnerHTML:{__html:i}}),React.createElement("div",{className:"walletconnect-modal__footer"},React.createElement("a",{onClick:function(){copy(e.uri)?(n(e.text.copied_to_clipboard),setInterval((function(){return n("")}),1200)):(n("Error"),setInterval((function(){return n("")}),1200))}},e.text.copy_to_clipboard)),React.createElement(Notification,{message:r}))}function Modal(e){var t=browserUtils.isAndroid(),r=browserUtils.isMobile(),n=r?e.qrcodeModalOptions&&e.qrcodeModalOptions.mobileLinks?e.qrcodeModalOptions.mobileLinks:void 0:e.qrcodeModalOptions&&e.qrcodeModalOptions.desktopLinks?e.qrcodeModalOptions.desktopLinks:void 0,o=React.useState(!1),i=o[0],a=o[1],s=React.useState(!1),c=s[0],u=s[1],l=React.useState(!r),d=l[0],f=l[1],h={mobile:r,text:e.text,uri:e.uri,qrcodeModalOptions:e.qrcodeModalOptions},p=React.useState(""),y=p[0],m=p[1],g=React.useState(!1),b=g[0],v=g[1],w=React.useState([]),_=w[0],I=w[1],T=React.useState(""),k=T[0],$=T[1],S=function(){c||i||n&&!n.length||_.length>0||React.useEffect((function(){!function(){try{if(t)return Promise.resolve();a(!0);var o=_catch((function(){var t=e.qrcodeModalOptions&&e.qrcodeModalOptions.registryUrl?e.qrcodeModalOptions.registryUrl:browserUtils.getWalletRegistryUrl();return Promise.resolve(fetch(t)).then((function(t){return Promise.resolve(t.json()).then((function(t){var o=t.listings,i=r?"mobile":"desktop",s=browserUtils.getMobileLinkRegistry(browserUtils.formatMobileRegistry(o,i),n);a(!1),u(!0),$(s.length?"":e.text.no_supported_wallets),I(s);var c=1===s.length;c&&(m(browserUtils.formatIOSMobile(e.uri,s[0])),f(!0)),v(c)}))}))}),(function(t){a(!1),u(!0),$(e.text.something_went_wrong),console.error(t)}));return Promise.resolve(o&&o.then?o.then((function(){})):void 0)}catch(e2){return Promise.reject(e2)}}()}))};S();var A=r?d:!d;return React.createElement("div",{id:WALLETCONNECT_MODAL_ID,className:"walletconnect-qrcode__base animated fadeIn"},React.createElement("div",{className:"walletconnect-modal__base"},React.createElement(Header,{onClose:e.onClose}),b&&d?React.createElement("div",{className:"walletconnect-modal__single_wallet"},React.createElement("a",{onClick:function(){return browserUtils.saveMobileLinkInfo({name:_[0].name,href:y})},href:y,rel:"noopener noreferrer",target:"_blank"},e.text.connect_with+" "+(b?_[0].name:"")+" ›")):t||i||!i&&_.length?React.createElement("div",{className:"walletconnect-modal__mobile__toggle"+(A?" right__selected":"")},React.createElement("div",{className:"walletconnect-modal__mobile__toggle_selector"}),r?React.createElement(React.Fragment,null,React.createElement("a",{onClick:function(){return f(!1),S()}},e.text.mobile),React.createElement("a",{onClick:function(){return f(!0)}},e.text.qrcode)):React.createElement(React.Fragment,null,React.createElement("a",{onClick:function(){return f(!0)}},e.text.qrcode),React.createElement("a",{onClick:function(){return f(!1),S()}},e.text.desktop))):null,React.createElement("div",null,d||!t&&!i&&!_.length?React.createElement(QRCodeDisplay,Object.assign({},h)):React.createElement(LinkDisplay,Object.assign({},h,{links:_,errorMessage:k})))))}var de={choose_preferred_wallet:"Wähle bevorzugte Wallet",connect_mobile_wallet:"Verbinde mit Mobile Wallet",scan_qrcode_with_wallet:"Scanne den QR-code mit einer WalletConnect kompatiblen Wallet",connect:"Verbinden",qrcode:"QR-Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"In die Zwischenablage kopieren",copied_to_clipboard:"In die Zwischenablage kopiert!",connect_with:"Verbinden mit Hilfe von",loading:"Laden...",something_went_wrong:"Etwas ist schief gelaufen",no_supported_wallets:"Es gibt noch keine unterstützten Wallet",no_wallets_found:"keine Wallet gefunden"},en={choose_preferred_wallet:"Choose your preferred wallet",connect_mobile_wallet:"Connect to Mobile Wallet",scan_qrcode_with_wallet:"Scan QR code with a WalletConnect-compatible wallet",connect:"Connect",qrcode:"QR Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"Copy to clipboard",copied_to_clipboard:"Copied to clipboard!",connect_with:"Connect with",loading:"Loading...",something_went_wrong:"Something went wrong",no_supported_wallets:"There are no supported wallets yet",no_wallets_found:"No wallets found"},es={choose_preferred_wallet:"Elige tu billetera preferida",connect_mobile_wallet:"Conectar a billetera móvil",scan_qrcode_with_wallet:"Escanea el código QR con una billetera compatible con WalletConnect",connect:"Conectar",qrcode:"Código QR",mobile:"Móvil",desktop:"Desktop",copy_to_clipboard:"Copiar",copied_to_clipboard:"Copiado!",connect_with:"Conectar mediante",loading:"Cargando...",something_went_wrong:"Algo salió mal",no_supported_wallets:"Todavía no hay billeteras compatibles",no_wallets_found:"No se encontraron billeteras"},fr={choose_preferred_wallet:"Choisissez votre portefeuille préféré",connect_mobile_wallet:"Se connecter au portefeuille mobile",scan_qrcode_with_wallet:"Scannez le QR code avec un portefeuille compatible WalletConnect",connect:"Se connecter",qrcode:"QR Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"Copier",copied_to_clipboard:"Copié!",connect_with:"Connectez-vous à l'aide de",loading:"Chargement...",something_went_wrong:"Quelque chose a mal tourné",no_supported_wallets:"Il n'y a pas encore de portefeuilles pris en charge",no_wallets_found:"Aucun portefeuille trouvé"},ko={choose_preferred_wallet:"원하는 지갑을 선택하세요",connect_mobile_wallet:"모바일 지갑과 연결",scan_qrcode_with_wallet:"WalletConnect 지원 지갑에서 QR코드를 스캔하세요",connect:"연결",qrcode:"QR 코드",mobile:"모바일",desktop:"데스크탑",copy_to_clipboard:"클립보드에 복사",copied_to_clipboard:"클립보드에 복사되었습니다!",connect_with:"와 연결하다",loading:"로드 중...",something_went_wrong:"문제가 발생했습니다.",no_supported_wallets:"아직 지원되는 지갑이 없습니다",no_wallets_found:"지갑을 찾을 수 없습니다"},pt={choose_preferred_wallet:"Escolha sua carteira preferida",connect_mobile_wallet:"Conectar-se à carteira móvel",scan_qrcode_with_wallet:"Ler o código QR com uma carteira compatível com WalletConnect",connect:"Conectar",qrcode:"Código QR",mobile:"Móvel",desktop:"Desktop",copy_to_clipboard:"Copiar",copied_to_clipboard:"Copiado!",connect_with:"Ligar por meio de",loading:"Carregamento...",something_went_wrong:"Algo correu mal",no_supported_wallets:"Ainda não há carteiras suportadas",no_wallets_found:"Nenhuma carteira encontrada"},zh={choose_preferred_wallet:"选择你的钱包",connect_mobile_wallet:"连接至移动端钱包",scan_qrcode_with_wallet:"使用兼容 WalletConnect 的钱包扫描二维码",connect:"连接",qrcode:"二维码",mobile:"移动",desktop:"桌面",copy_to_clipboard:"复制到剪贴板",copied_to_clipboard:"复制到剪贴板成功!",connect_with:"通过以下方式连接",loading:"正在加载...",something_went_wrong:"出了问题",no_supported_wallets:"目前还没有支持的钱包",no_wallets_found:"没有找到钱包"},fa={choose_preferred_wallet:"کیف پول مورد نظر خود را انتخاب کنید",connect_mobile_wallet:"به کیف پول موبایل وصل شوید",scan_qrcode_with_wallet:"کد QR را با یک کیف پول سازگار با WalletConnect اسکن کنید",connect:"اتصال",qrcode:"کد QR",mobile:"سیار",desktop:"دسکتاپ",copy_to_clipboard:"کپی به کلیپ بورد",copied_to_clipboard:"در کلیپ بورد کپی شد!",connect_with:"ارتباط با",loading:"...بارگذاری",something_went_wrong:"مشکلی پیش آمد",no_supported_wallets:"هنوز هیچ کیف پول پشتیبانی شده ای وجود ندارد",no_wallets_found:"هیچ کیف پولی پیدا نشد"},languages={de:de,en:en,es:es,fr:fr,ko:ko,pt:pt,zh:zh,fa:fa};function injectStyleSheet(){var e=browserUtils.getDocumentOrThrow(),t=e.getElementById(WALLETCONNECT_STYLE_ID);t&&e.head.removeChild(t);var r=e.createElement("style");r.setAttribute("id",WALLETCONNECT_STYLE_ID),r.innerText=WALLETCONNECT_STYLE_SHEET,e.head.appendChild(r)}function renderWrapper(){var e=browserUtils.getDocumentOrThrow(),t=e.createElement("div");return t.setAttribute("id",WALLETCONNECT_WRAPPER_ID),e.body.appendChild(t),t}function triggerCloseAnimation(){var e=browserUtils.getDocumentOrThrow(),t=e.getElementById(WALLETCONNECT_MODAL_ID);t&&(t.className=t.className.replace("fadeIn","fadeOut"),setTimeout((function(){var t=e.getElementById(WALLETCONNECT_WRAPPER_ID);t&&e.body.removeChild(t)}),ANIMATION_DURATION))}function getWrappedCallback(e){return function(){triggerCloseAnimation(),e&&e()}}function getText(){var e=browserUtils.getNavigatorOrThrow().language.split("-")[0]||"en";return languages[e]||languages.en}function open$1(e,t,r){injectStyleSheet();var n=renderWrapper();React.render(React.createElement(Modal,{text:getText(),uri:e,onClose:getWrappedCallback(t),qrcodeModalOptions:r}),n)}function close$1(){triggerCloseAnimation()}var isNode=function(){return void 0!==process$1&&void 0!==process$1.versions&&void 0!==process$1.versions.node};function open$2(e,t,r){console.log(e),isNode()?open(e):open$1(e,t,r)}function close$2(){isNode()||close$1()}var index$1={open:open$2,close:close$2},cjs=index$1;const QRCodeModal=getDefaultExportFromCjs$1(cjs),t$4=Symbol(),s$4=Object.getPrototypeOf,c$2=new WeakMap,l$4=e=>e&&(c$2.has(e)?c$2.get(e):s$4(e)===Object.prototype||s$4(e)===Array.prototype),y$1=e=>l$4(e)&&e[t$4]||null,h$2=(e,t=!0)=>{c$2.set(e,t)},isObject=e=>"object"==typeof e&&null!==e,proxyStateMap=new WeakMap,refSet=new WeakSet,buildProxyFunction=(e=Object.is,t=(e,t)=>new Proxy(e,t),r=e=>isObject(e)&&!refSet.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer),n=e=>{switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e}},o=new WeakMap,i=(e,t,r=n)=>{const a=o.get(e);if((null==a?void 0:a[0])===t)return a[1];const s=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return h$2(s,!0),o.set(e,[t,s]),Reflect.ownKeys(e).forEach((t=>{if(Object.getOwnPropertyDescriptor(s,t))return;const n=Reflect.get(e,t),o={value:n,enumerable:!0,configurable:!0};if(refSet.has(n))h$2(n,!1);else if(n instanceof Promise)delete o.value,o.get=()=>r(n);else if(proxyStateMap.has(n)){const[e,t]=proxyStateMap.get(n);o.value=i(e,t(),r)}Object.defineProperty(s,t,o)})),Object.preventExtensions(s)},a=new WeakMap,s=[1,1],c=n=>{if(!isObject(n))throw new Error("object required");const o=a.get(n);if(o)return o;let u=s[0];const l=new Set,d=(e,t=++s[0])=>{u!==t&&(u=t,l.forEach((r=>r(e,t))))};let f=s[1];const h=e=>(t,r)=>{const n=[...t];n[1]=[e,...n[1]],d(n,r)},p=new Map,y=e=>{var t;const r=p.get(e);r&&(p.delete(e),null==(t=r[1])||t.call(r))},m=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),g=t(m,{deleteProperty(e,t){const r=Reflect.get(e,t);y(t);const n=Reflect.deleteProperty(e,t);return n&&d(["delete",[t],r]),n},set(t,n,o,i){const s=Reflect.has(t,n),u=Reflect.get(t,n,i);if(s&&(e(u,o)||a.has(o)&&e(u,a.get(o))))return!0;y(n),isObject(o)&&(o=y$1(o)||o);let f=o;if(o instanceof Promise)o.then((e=>{o.status="fulfilled",o.value=e,d(["resolve",[n],e])})).catch((e=>{o.status="rejected",o.reason=e,d(["reject",[n],e])}));else{!proxyStateMap.has(o)&&r(o)&&(f=c(o));const e=!refSet.has(f)&&proxyStateMap.get(f);e&&((e,t)=>{if(l.size){const r=t[3](h(e));p.set(e,[t,r])}else p.set(e,[t])})(n,e)}return Reflect.set(t,n,f,i),d(["set",[n],o,u]),!0}});a.set(n,g);const b=[m,(e=++s[1])=>(f===e||l.size||(f=e,p.forEach((([t])=>{const r=t[1](e);r>u&&(u=r)}))),u),i,e=>{l.add(e),1===l.size&&p.forEach((([e,t],r)=>{const n=e[3](h(r));p.set(r,[e,n])}));return()=>{l.delete(e),0===l.size&&p.forEach((([e,t],r)=>{t&&(t(),p.set(r,[e]))}))}}];return proxyStateMap.set(g,b),Reflect.ownKeys(n).forEach((e=>{const t=Object.getOwnPropertyDescriptor(n,e);"value"in t&&(g[e]=n[e],delete t.value,delete t.writable),Object.defineProperty(m,e,t)})),g})=>[c,proxyStateMap,refSet,e,t,r,n,o,i,a,s],[defaultProxyFunction]=buildProxyFunction();function proxy(e={}){return defaultProxyFunction(e)}function subscribe(e,t,r){const n=proxyStateMap.get(e);let o;const i=[],a=n[3];let s=!1;const c=a((e=>{i.push(e),o||(o=Promise.resolve().then((()=>{o=void 0,s&&t(i.splice(0))})))}));return s=!0,()=>{s=!1,c()}}function snapshot(e,t){const r=proxyStateMap.get(e),[n,o,i]=r;return i(n,o(),t)}const state$7=proxy({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),RouterCtrl={state:state$7,subscribe:e=>subscribe(state$7,(()=>e(state$7))),push(e,t){e!==state$7.view&&(state$7.view=e,t&&(state$7.data=t),state$7.history.push(e))},reset(e){state$7.view=e,state$7.history=[e]},replace(e){state$7.history.length>1&&(state$7.history[state$7.history.length-1]=e,state$7.view=e)},goBack(){if(state$7.history.length>1){state$7.history.pop();const[e]=state$7.history.slice(-1);state$7.view=e}},setData(e){state$7.data=e}},CoreUtil={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile:()=>"undefined"!=typeof window&&Boolean(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)),isAndroid:()=>CoreUtil.isMobile()&&navigator.userAgent.toLowerCase().includes("android"),isIos(){const e=navigator.userAgent.toLowerCase();return CoreUtil.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl:e=>e.startsWith("http://")||e.startsWith("https://"),isArray:e=>Array.isArray(e)&&e.length>0,isTelegram:()=>"undefined"!=typeof window&&(Boolean(window.TelegramWebviewProxy)||Boolean(window.Telegram)||Boolean(window.TelegramWebviewProxyProto)),formatNativeUrl(e,t,r){if(CoreUtil.isHttpUrl(e))return this.formatUniversalUrl(e,t,r);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,r);return`${n}wc?uri=${encodeURIComponent(t)}`},formatUniversalUrl(e,t,r){if(!CoreUtil.isHttpUrl(e))return this.formatNativeUrl(e,t,r);let n=e;if(n.startsWith("https://t.me")){const e=Buffer$2.from(t).toString("base64").replace(/[=]/g,"");n.endsWith("/")&&(n=n.slice(0,-1)),this.setWalletConnectDeepLink(n,r);const o=new URL(n);o.searchParams.set("startapp",e);return o.toString()}n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,r);return`${n}wc?uri=${encodeURIComponent(t)}`},wait:async e=>new Promise((t=>{setTimeout(t,e)})),openHref(e,t){const r=this.isTelegram()?"_blank":t;window.open(e,r,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(CoreUtil.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch(e2){console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(CoreUtil.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch(e2){console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(CoreUtil.WALLETCONNECT_DEEPLINK_CHOICE)}catch(e2){console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{"undefined"!=typeof localStorage&&localStorage.setItem(CoreUtil.WCM_VERSION,"2.7.0")}catch(e2){console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=null==(e=RouterCtrl.state.data)?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},isEnabled="undefined"!=typeof location&&(location.hostname.includes("localhost")||location.protocol.includes("https")),state$6=proxy({enabled:isEnabled,userSessionId:"",events:[],connectedWalletId:void 0}),EventsCtrl={state:state$6,subscribe:e=>subscribe(state$6.events,(()=>e(snapshot(state$6.events[state$6.events.length-1])))),initialize(){state$6.enabled&&void 0!==(null==crypto?void 0:crypto.randomUUID)&&(state$6.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){state$6.connectedWalletId=e},click(e){if(state$6.enabled){const t={type:"CLICK",name:e.name,userSessionId:state$6.userSessionId,timestamp:Date.now(),data:e};state$6.events.push(t)}},track(e){if(state$6.enabled){const t={type:"TRACK",name:e.name,userSessionId:state$6.userSessionId,timestamp:Date.now(),data:e};state$6.events.push(t)}},view(e){if(state$6.enabled){const t={type:"VIEW",name:e.name,userSessionId:state$6.userSessionId,timestamp:Date.now(),data:e};state$6.events.push(t)}}},state$5=proxy({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),OptionsCtrl={state:state$5,subscribe:e=>subscribe(state$5,(()=>e(state$5))),setChains(e){state$5.chains=e},setWalletConnectUri(e){state$5.walletConnectUri=e},setIsCustomDesktop(e){state$5.isCustomDesktop=e},setIsCustomMobile(e){state$5.isCustomMobile=e},setIsDataLoaded(e){state$5.isDataLoaded=e},setIsUiLoaded(e){state$5.isUiLoaded=e},setIsAuth(e){state$5.isAuth=e}},state$4=proxy({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),ConfigCtrl={state:state$4,subscribe:e=>subscribe(state$4,(()=>e(state$4))),setConfig(e){var t,r;EventsCtrl.initialize(),OptionsCtrl.setChains(e.chains),OptionsCtrl.setIsAuth(Boolean(e.enableAuthMode)),OptionsCtrl.setIsCustomMobile(Boolean(null==(t=e.mobileWallets)?void 0:t.length)),OptionsCtrl.setIsCustomDesktop(Boolean(null==(r=e.desktopWallets)?void 0:r.length)),CoreUtil.setModalVersionInStorage(),Object.assign(state$4,e)}};var __defProp$2$1=Object.defineProperty,__getOwnPropSymbols$2=Object.getOwnPropertySymbols,__hasOwnProp$2=Object.prototype.hasOwnProperty,__propIsEnum$2=Object.prototype.propertyIsEnumerable,__defNormalProp$2=(e,t,r)=>t in e?__defProp$2$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues$2=(e,t)=>{for(var r in t||(t={}))__hasOwnProp$2.call(t,r)&&__defNormalProp$2(e,r,t[r]);if(__getOwnPropSymbols$2)for(var r of __getOwnPropSymbols$2(t))__propIsEnum$2.call(t,r)&&__defNormalProp$2(e,r,t[r]);return e};const W3M_API="https://explorer-api.walletconnect.com",SDK_TYPE="wcm",SDK_VERSION="js-2.7.0";async function fetchListings(e,t){const r=__spreadValues$2({sdkType:SDK_TYPE,sdkVersion:SDK_VERSION},t),n=new URL(e,W3M_API);n.searchParams.append("projectId",ConfigCtrl.state.projectId),Object.entries(r).forEach((([e,t])=>{t&&n.searchParams.append(e,String(t))}));return(await fetch(n)).json()}const ExplorerUtil={getDesktopListings:async e=>fetchListings("/w3m/v1/getDesktopListings",e),getMobileListings:async e=>fetchListings("/w3m/v1/getMobileListings",e),getInjectedListings:async e=>fetchListings("/w3m/v1/getInjectedListings",e),getAllListings:async e=>fetchListings("/w3m/v1/getAllListings",e),getWalletImageUrl:e=>`${W3M_API}/w3m/v1/getWalletImage/${e}?projectId=${ConfigCtrl.state.projectId}&sdkType=${SDK_TYPE}&sdkVersion=${SDK_VERSION}`,getAssetImageUrl:e=>`${W3M_API}/w3m/v1/getAssetImage/${e}?projectId=${ConfigCtrl.state.projectId}&sdkType=${SDK_TYPE}&sdkVersion=${SDK_VERSION}`};var __defProp$1$1=Object.defineProperty,__getOwnPropSymbols$1=Object.getOwnPropertySymbols,__hasOwnProp$1=Object.prototype.hasOwnProperty,__propIsEnum$1=Object.prototype.propertyIsEnumerable,__defNormalProp$1=(e,t,r)=>t in e?__defProp$1$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues$1=(e,t)=>{for(var r in t||(t={}))__hasOwnProp$1.call(t,r)&&__defNormalProp$1(e,r,t[r]);if(__getOwnPropSymbols$1)for(var r of __getOwnPropSymbols$1(t))__propIsEnum$1.call(t,r)&&__defNormalProp$1(e,r,t[r]);return e};const isMobile=CoreUtil.isMobile(),state$3=proxy({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),ExplorerCtrl={state:state$3,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=ConfigCtrl.state;if("NONE"===e||"ALL"===t&&!e)return state$3.recomendedWallets;if(CoreUtil.isArray(e)){const t={recommendedIds:e.join(",")},{listings:r}=await ExplorerUtil.getAllListings(t),n=Object.values(r);n.sort(((t,r)=>e.indexOf(t.id)-e.indexOf(r.id))),state$3.recomendedWallets=n}else{const{chains:e,isAuth:r}=OptionsCtrl.state,n=null==e?void 0:e.join(","),o=CoreUtil.isArray(t),i={page:1,sdks:r?"auth_v1":void 0,entries:CoreUtil.RECOMMENDED_WALLET_AMOUNT,chains:n,version:2,excludedIds:o?t.join(","):void 0},{listings:a}=isMobile?await ExplorerUtil.getMobileListings(i):await ExplorerUtil.getDesktopListings(i);state$3.recomendedWallets=Object.values(a)}return state$3.recomendedWallets},async getWallets(e){const t=__spreadValues$1({},e),{explorerRecommendedWalletIds:r,explorerExcludedWalletIds:n}=ConfigCtrl.state,{recomendedWallets:o}=state$3;if("ALL"===n)return state$3.wallets;o.length?t.excludedIds=o.map((e=>e.id)).join(","):CoreUtil.isArray(r)&&(t.excludedIds=r.join(",")),CoreUtil.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),OptionsCtrl.state.isAuth&&(t.sdks="auth_v1");const{page:i,search:a}=e,{listings:s,total:c}=isMobile?await ExplorerUtil.getMobileListings(t):await ExplorerUtil.getDesktopListings(t),u=Object.values(s),l=a?"search":"wallets";return state$3[l]={listings:[...state$3[l].listings,...u],total:c,page:null!=i?i:1},{listings:u,total:c}},getWalletImageUrl:e=>ExplorerUtil.getWalletImageUrl(e),getAssetImageUrl:e=>ExplorerUtil.getAssetImageUrl(e),resetSearch(){state$3.search={listings:[],total:0,page:1}}},state$2=proxy({open:!1}),ModalCtrl={state:state$2,subscribe:e=>subscribe(state$2,(()=>e(state$2))),open:async e=>new Promise((t=>{const{isUiLoaded:r,isDataLoaded:n}=OptionsCtrl.state;if(CoreUtil.removeWalletConnectDeepLink(),OptionsCtrl.setWalletConnectUri(null==e?void 0:e.uri),OptionsCtrl.setChains(null==e?void 0:e.chains),RouterCtrl.reset("ConnectWallet"),r&&n)state$2.open=!0,t();else{const e=setInterval((()=>{const r=OptionsCtrl.state;r.isUiLoaded&&r.isDataLoaded&&(clearInterval(e),state$2.open=!0,t())}),200)}})),close(){state$2.open=!1}};var __defProp$z=Object.defineProperty,__getOwnPropSymbols$3=Object.getOwnPropertySymbols,__hasOwnProp$3=Object.prototype.hasOwnProperty,__propIsEnum$3=Object.prototype.propertyIsEnumerable,__defNormalProp$3=(e,t,r)=>t in e?__defProp$z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues$3=(e,t)=>{for(var r in t||(t={}))__hasOwnProp$3.call(t,r)&&__defNormalProp$3(e,r,t[r]);if(__getOwnPropSymbols$3)for(var r of __getOwnPropSymbols$3(t))__propIsEnum$3.call(t,r)&&__defNormalProp$3(e,r,t[r]);return e};function isDarkMode(){return"undefined"!=typeof matchMedia&&matchMedia("(prefers-color-scheme: dark)").matches}const state$1=proxy({themeMode:isDarkMode()?"dark":"light"}),ThemeCtrl={state:state$1,subscribe:e=>subscribe(state$1,(()=>e(state$1))),setThemeConfig(e){const{themeMode:t,themeVariables:r}=e;t&&(state$1.themeMode=t),r&&(state$1.themeVariables=__spreadValues$3({},r))}},state=proxy({open:!1,message:"",variant:"success"}),ToastCtrl={state:state,subscribe:e=>subscribe(state,(()=>e(state))),openToast(e,t){state.open=!0,state.message=e,state.variant=t},closeToast(){state.open=!1}};class WalletConnectModal{constructor(e){this.openModal=ModalCtrl.open,this.closeModal=ModalCtrl.close,this.subscribeModal=ModalCtrl.subscribe,this.setTheme=ThemeCtrl.setThemeConfig,ThemeCtrl.setThemeConfig(e),ConfigCtrl.setConfig(e),this.initUi()}async initUi(){if("undefined"!=typeof window){await Promise.resolve().then((()=>index));const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),OptionsCtrl.setIsUiLoaded(!0)}}}let DefaultLogger$1=class{constructor(e="info"){this.logLevel="info",this.logLevel=e}setLogLevel(e){this.logLevel=e}getLogLevel(){return this.logLevel}error(e,...t){["error","warn","info","debug"].includes(this.logLevel)&&console.error(`[ERROR] ${e}`,...t)}warn(e,...t){["warn","info","debug"].includes(this.logLevel)&&console.warn(`[WARN] ${e}`,...t)}info(e,...t){["info","debug"].includes(this.logLevel)&&console.info(`[INFO] ${e}`,...t)}debug(e,...t){"debug"===this.logLevel&&console.debug(`[DEBUG] ${e}`,...t)}};class SessionNotFoundError extends Error{constructor(e){super(e),this.name="SessionNotFoundError"}}const clients={};class DAppSigner{constructor(e,t,r,n=LedgerId.MAINNET,o,i="debug"){this.accountId=e,this.signClient=t,this.topic=r,this.ledgerId=n,this.extensionId=o,this.logger=new DefaultLogger$1(i)}setLogLevel(e){this.logger instanceof DefaultLogger$1&&this.logger.setLogLevel(e)}_getHederaClient(){const e=this.ledgerId.toString();return clients[e]||(clients[e]=WebClient.forName(e)),clients[e]}get _signerAccountId(){return`${ledgerIdToCAIPChainId(this.ledgerId)}:${this.accountId.toString()}`}_getRandomNodes(e){const t=Object.values(this._getHederaClient().network).map((e=>"string"==typeof e?AccountId.fromString(e):e));for(let r=t.length-1;r>0;r--){const e=Math.floor(Math.random()*(r+1));[t[r],t[e]]=[t[e],t[r]]}return t.slice(0,e)}request(e){var t,r;if(!(null===(r=null===(t=null==this?void 0:this.signClient)||void 0===t?void 0:t.session)||void 0===r?void 0:r.get(this.topic)))throw this.logger.error("Session no longer exists, signer will be removed. Please reconnect to the wallet."),this.signClient.emit({topic:this.topic,event:{name:"session_delete",data:{topic:this.topic}},chainId:ledgerIdToCAIPChainId(this.ledgerId)}),new SessionNotFoundError("Session no longer exists. Please reconnect to the wallet.");return this.extensionId&&extensionOpen(this.extensionId),this.signClient.request({topic:this.topic,request:e,chainId:ledgerIdToCAIPChainId(this.ledgerId)})}getAccountId(){return this.accountId}getAccountKey(){throw new Error("Method not implemented.")}getLedgerId(){return this.ledgerId}getNetwork(){return this._getHederaClient().network}getMirrorNetwork(){return this._getHederaClient().mirrorNetwork}getAccountBalance(){return this.call((new AccountBalanceQuery).setAccountId(this.accountId))}getAccountInfo(){return this.call((new AccountInfoQuery).setAccountId(this.accountId))}getAccountRecords(){return this.call((new AccountRecordsQuery).setAccountId(this.accountId))}getMetadata(){return this.signClient.metadata}async sign(e,t={encoding:"utf-8"}){try{const r="base64"===t.encoding?Uint8ArrayToBase64String(e[0]):Uint8ArrayToString(e[0]),{signatureMap:n}=await this.request({method:HederaJsonRpcMethod.SignMessage,params:{signerAccountId:this._signerAccountId,message:r}}),o=base64StringToSignatureMap(n),i=new SignerSignature({accountId:this.getAccountId(),publicKey:PublicKey.fromBytes(o.sigPair[0].pubKeyPrefix),signature:o.sigPair[0].ed25519||o.sigPair[0].ECDSASecp256k1});return this.logger.debug("Data signed successfully"),[i]}catch(r){throw this.logger.error("Error signing data:",r),r}}async checkTransaction(e){throw new Error("Method not implemented.")}async populateTransaction(e){return e.setNodeAccountIds(this._getRandomNodes(10)).setTransactionId(TransactionId.generate(this.getAccountId()))}async signTransaction(e){let t;t=e.nodeAccountIds&&0!==e.nodeAccountIds.length?e.nodeAccountIds[0]:this._getRandomNodes(1)[0];const r=transactionToTransactionBody(e,t);if(!r)throw new Error("Failed to serialize transaction body");const n=transactionBodyToBase64String(r),{signatureMap:o}=await this.request({method:HederaJsonRpcMethod.SignTransaction,params:{signerAccountId:this._signerAccountId,transactionBody:n}}),i=base64StringToSignatureMap(o),a=base64StringToUint8Array(n),s=lib.proto.Transaction.encode({bodyBytes:a,sigMap:i}).finish();return Transaction.fromBytes(s)}async _tryExecuteTransactionRequest(e){try{const t=e.toBytes();this.logger.debug("Creating transaction from bytes",t,e);const r=Transaction.fromBytes(t);this.logger.debug("Executing transaction request",r);const n=await this.request({method:HederaJsonRpcMethod.SignAndExecuteTransaction,params:{signerAccountId:this._signerAccountId,transactionList:transactionToBase64String(r)}});return this.logger.debug("Transaction request completed successfully"),{result:TransactionResponse.fromJSON(n)}}catch(t){return this.logger.error("Error executing transaction request:",t),{error:t}}}async _parseQueryResponse(e,t){if(e instanceof AccountRecordsQuery){return t.split(",").map((e=>base64StringToUint8Array(e))).map((e=>TransactionRecord.fromBytes(e)))}const r=base64StringToUint8Array(t);if(e instanceof AccountBalanceQuery)return AccountBalance.fromBytes(r);if(e instanceof AccountInfoQuery)return AccountInfo.fromBytes(r);if(e instanceof TransactionReceiptQuery)return TransactionReceipt.fromBytes(r);if(e instanceof TransactionRecordQuery)return TransactionRecord.fromBytes(r);throw new Error("Unsupported query type")}async executeReceiptQueryFromRequest(e){try{const t=this.ledgerId===LedgerId.MAINNET?WebClient.forMainnet():WebClient.forTestnet(),r=TransactionReceiptQuery.fromBytes(e.toBytes());return{result:await r.execute(t)}}catch(t){return{error:t}}}async _tryExecuteQueryRequest(e){try{const t=e instanceof TransactionReceiptQuery;if(t){this.logger.debug("Attempting to execute free receipt query",e);const t=await this.executeReceiptQueryFromRequest(e);if(!(null==t?void 0:t.error))return{result:t.result};this.logger.error("Error executing free receipt query. Sending to wallet.",t.error)}const r=t?TransactionReceiptQuery.fromBytes(e.toBytes()):Query.fromBytes(e.toBytes());this.logger.debug("Executing query request",r,queryToBase64String(r),t);const n=await this.request({method:HederaJsonRpcMethod.SignAndExecuteQuery,params:{signerAccountId:this._signerAccountId,query:queryToBase64String(r)}});return this.logger.debug("Query request completed successfully",n),{result:this._parseQueryResponse(r,n.response)}}catch(t){return this.logger.error("Error executing query request:",t),{error:t}}}async call(e){var t,r,n,o,i,a,s,c,u;const l=e instanceof TransactionReceiptQuery;let d;if(!l&&(d=await this._tryExecuteTransactionRequest(e),d.result))return d.result;const f=await this._tryExecuteQueryRequest(e);if(f.result)return f.result;if(l)throw new Error("Error executing receipt query: \n"+JSON.stringify({queryError:{name:null===(t=f.error)||void 0===t?void 0:t.name,message:null===(r=f.error)||void 0===r?void 0:r.message,stack:null===(n=f.error)||void 0===n?void 0:n.stack}}));throw new Error("Error executing transaction or query: \n"+JSON.stringify({txError:{name:null===(o=null==d?void 0:d.error)||void 0===o?void 0:o.name,message:null===(i=null==d?void 0:d.error)||void 0===i?void 0:i.message,stack:null===(a=null==d?void 0:d.error)||void 0===a?void 0:a.stack},queryError:{name:null===(s=f.error)||void 0===s?void 0:s.name,message:null===(c=f.error)||void 0===c?void 0:c.message,stack:null===(u=f.error)||void 0===u?void 0:u.stack}},null,2))}}class DAppConnector{constructor(e,t,r,n,o,i,a="debug"){this.network=LedgerId.TESTNET,this.supportedMethods=[],this.supportedEvents=[],this.supportedChains=[],this.extensions=[],this.onSessionIframeCreated=null,this.signers=[],this.isInitializing=!1,this.abortableConnect=async e=>new Promise((async(t,r)=>{const n=48e4,o=setTimeout((()=>{QRCodeModal.close(),r(new Error("Connect timed out after 480000(ms)"))}),n);try{return t(await e())}catch(i){r(i)}finally{clearTimeout(o)}})),this.logger=new DefaultLogger$1(a),this.dAppMetadata=e,this.network=t,this.projectId=r,this.supportedMethods=null!=n?n:Object.values(HederaJsonRpcMethod),this.supportedEvents=null!=o?o:[],this.supportedChains=null!=i?i:[],this.extensions=[],this.walletConnectModal=new WalletConnectModal({projectId:r,chains:i}),findExtensions(((e,t)=>{this.extensions.push(Object.assign(Object.assign({},e),{available:!0,availableInIframe:t}))}))}setLogLevel(e){this.logger instanceof DefaultLogger$1&&this.logger.setLogLevel(e)}async init({logger:e}={}){try{if(this.isInitializing=!0,!this.projectId)throw new Error("Project ID is not defined");this.walletConnectClient=await _e.init({logger:e,relayUrl:"wss://relay.walletconnect.com",projectId:this.projectId,metadata:this.dAppMetadata});const t=this.walletConnectClient.session.getAll();t.length>0?this.signers=t.flatMap((e=>this.createSigners(e))):this.checkIframeConnect(),this.walletConnectClient.on("session_event",this.handleSessionEvent.bind(this)),this.walletConnectClient.on("session_update",this.handleSessionUpdate.bind(this)),this.walletConnectClient.on("session_delete",this.handleSessionDelete.bind(this)),this.walletConnectClient.core.events.on("session_delete",this.handleSessionDelete.bind(this)),this.walletConnectClient.core.pairing.events.on("pairing_delete",this.handlePairingDelete.bind(this))}catch(e2){this.logger.error("Error initializing DAppConnector:",e2)}finally{this.isInitializing=!1}}getSigner(e){if(this.isInitializing)throw new Error("DAppConnector is not initialized yet. Try again later.");const t=this.signers.find((t=>t.getAccountId().equals(e)));if(!t)throw new Error("Signer is not found for this accountId");return t}async connectQR(e){return this.abortableConnect((async()=>{try{const{uri:t,approval:r}=await this.connectURI(e);if(!t)throw new Error("URI is not defined");QRCodeModal.open(t,(()=>{throw new Error("User rejected pairing")})),await this.onSessionConnected(await r())}finally{QRCodeModal.close()}}))}async openModal(e){try{const{uri:t,approval:r}=await this.connectURI(e);this.walletConnectModal.openModal({uri:t});const n=await r();return await this.onSessionConnected(n),n}finally{this.walletConnectModal.closeModal()}}async connect(e,t,r){return this.abortableConnect((async()=>{var n;const{uri:o,approval:i}=await this.connectURI(t);if(!o)throw new Error("URI is not defined");e(o);const a=await i();if(r){const e=Object.assign(Object.assign({},a.sessionProperties),{extensionId:r});a.sessionProperties=e,await(null===(n=this.walletConnectClient)||void 0===n?void 0:n.session.update(a.topic,{sessionProperties:e}))}return await this.onSessionConnected(a),a}))}async connectExtension(e,t){const r=this.extensions.find((t=>t.id===e));if(!r||!r.available)throw new Error("Extension is not available");return this.connect((e=>{extensionConnect(r.id,r.availableInIframe,e)}),t,r.availableInIframe?void 0:e)}validateSession(e){try{if(!this.walletConnectClient)return!1;const t=this.walletConnectClient.session.get(e),r=this.signers.some((t=>t.topic===e));return t?!!r||(this.logger.warn(`Session exists but no signer found for topic: ${e}`),!1):(r&&(this.logger.warn(`Signer exists but no session found for topic: ${e}`),this.handleSessionDelete({topic:e})),!1)}catch(e2){return this.logger.error("Error validating session:",e2),!1}}validateAndRefreshSigners(){this.signers=this.signers.filter((e=>this.validateSession(e.topic)))}async checkIframeConnect(){const e=this.extensions.find((e=>e.availableInIframe));if(e){const t=await this.connectExtension(e.id);this.onSessionIframeCreated&&this.onSessionIframeCreated(t)}}async disconnect(e){try{if(!this.walletConnectClient)throw new Error("WalletConnect is not initialized");return await this.walletConnectClient.disconnect({topic:e,reason:_$6("USER_DISCONNECTED")}),!0}catch(e2){return this.logger.error("Either the session was already disconnected or the topic is invalid",e2),!1}}async disconnectAll(){if(!this.walletConnectClient)throw new Error("WalletConnect is not initialized");const e=this.walletConnectClient.session.getAll(),t=this.walletConnectClient.core.pairing.getPairings();if(!(null==e?void 0:e.length)&&!(null==t?void 0:t.length))throw new Error("There is no active session/pairing. Connect to the wallet at first.");const r=[];for(const n of this.walletConnectClient.session.getAll()){this.logger.info(`Disconnecting from session: ${n}`);const e=this.disconnect(n.topic);r.push(e)}for(const n of t){const e=this.disconnect(n.topic);r.push(e)}await Promise.all(r),this.signers=[]}createSigners(e){return accountAndLedgerFromSession(e).map((({account:t,network:r})=>{var n;return new DAppSigner(t,this.walletConnectClient,e.topic,r,null===(n=e.sessionProperties)||void 0===n?void 0:n.extensionId,this.logger instanceof DefaultLogger$1?this.logger.getLogLevel():"debug")}))}async onSessionConnected(e){const t=this.createSigners(e);for(const r of t){const e=this.signers.filter((e=>{var t,n;const o=(null===(t=null==e?void 0:e.getAccountId())||void 0===t?void 0:t.toString())===(null===(n=null==r?void 0:r.getAccountId())||void 0===n?void 0:n.toString()),i=r.extensionId===e.extensionId,a=r.getMetadata(),s=e.getMetadata(),c=(null==a?void 0:a.name)===(null==s?void 0:s.name);return e.topic===r.topic&&this.logger.error("The topic was already connected. This is a weird error. Please report it.",r.getAccountId().toString()),o&&i&&c}));for(const t of e)this.logger.debug(`Disconnecting duplicate signer for account ${t.getAccountId().toString()}`),await this.disconnect(t.topic),this.signers=this.signers.filter((e=>e.topic!==t.topic))}this.signers.push(...t),this.logger.debug(`Current signers after connection: ${this.signers.map((e=>`${e.getAccountId().toString()}:${e.topic}`)).join(", ")}`)}async connectURI(e){if(!this.walletConnectClient)throw new Error("WalletConnect is not initialized");return this.walletConnectClient.connect({pairingTopic:e,requiredNamespaces:networkNamespaces(this.network,this.supportedMethods,this.supportedEvents)})}async request({method:e,params:t}){var r,n,o;let i;if(this.logger.debug(`Requesting method: ${e} with params: ${JSON.stringify(t)}`),null==t?void 0:t.signerAccountId){const e=null===(n=null===(r=null==t?void 0:t.signerAccountId)||void 0===r?void 0:r.split(":"))||void 0===n?void 0:n.pop();if(i=this.signers.find((t=>{var r;return(null===(r=null==t?void 0:t.getAccountId())||void 0===r?void 0:r.toString())===e})),this.logger.debug(`Found signer: ${null===(o=null==i?void 0:i.getAccountId())||void 0===o?void 0:o.toString()}`),!i)throw new Error(`Signer not found for account ID: ${null==t?void 0:t.signerAccountId}. Did you use the correct format? e.g hedera:<network>:<address> `)}else i=this.signers[this.signers.length-1];if(!i)throw new Error("There is no active session. Connect to the wallet at first.");return this.logger.debug(`Using signer: ${i.getAccountId().toString()}: ${i.topic} - about to request.`),await i.request({method:e,params:t})}async getNodeAddresses(){return await this.request({method:HederaJsonRpcMethod.GetNodeAddresses,params:void 0})}async executeTransaction(e){return await this.request({method:HederaJsonRpcMethod.ExecuteTransaction,params:e})}async signMessage(e){return await this.request({method:HederaJsonRpcMethod.SignMessage,params:e})}async signAndExecuteQuery(e){return await this.request({method:HederaJsonRpcMethod.SignAndExecuteQuery,params:e})}async signAndExecuteTransaction(e){return await this.request({method:HederaJsonRpcMethod.SignAndExecuteTransaction,params:e})}async signTransaction(e){var t,r;if("string"==typeof(null==e?void 0:e.transactionBody))return this.logger.warn("Transaction body is a string. This is not recommended, please migrate to passing a transaction object directly."),await this.request({method:HederaJsonRpcMethod.SignTransaction,params:e});if((null==e?void 0:e.transactionBody)instanceof Transaction){const n=null===(r=null===(t=null==e?void 0:e.signerAccountId)||void 0===t?void 0:t.split(":"))||void 0===r?void 0:r.pop(),o=this.signers.find((e=>{var t;return(null===(t=null==e?void 0:e.getAccountId())||void 0===t?void 0:t.toString())===n}));if(!o)throw new Error(`No signer found for account ${n}`);if(!(null==e?void 0:e.transactionBody))throw new Error("No transaction provided");return await o.signTransaction(e.transactionBody)}throw new Error("Transaction sent in incorrect format. Ensure transaction body is either a base64 transaction body or Transaction object.")}handleSessionEvent(e){this.logger.debug("Session event received:",e),this.validateAndRefreshSigners()}handleSessionUpdate({topic:e,params:t}){const{namespaces:r}=t,n=this.walletConnectClient.session.get(e),o=Object.assign(Object.assign({},n),{namespaces:r});this.logger.info("Session updated:",o),this.signers=this.signers.filter((t=>t.topic!==e)),this.signers.push(...this.createSigners(o))}handleSessionDelete(e){this.logger.info("Session deleted:",e);let t=!1;if(this.signers=this.signers.filter((r=>r.topic!==e.topic||(t=!0,!1))),t){try{this.disconnect(e.topic)}catch(e2){this.logger.error("Error disconnecting session:",e2)}this.logger.info("Session deleted and signer removed")}}handlePairingDelete(e){this.logger.info("Pairing deleted:",e),this.signers=this.signers.filter((t=>t.topic!==e.topic));try{this.disconnect(e.topic)}catch(e2){this.logger.error("Error disconnecting pairing:",e2)}this.logger.info("Pairing deleted by wallet")}}class DefaultLogger{constructor(){this.logLevel="info"}setLogLevel(e){this.logLevel=e}error(e,...t){["error","warn","info","debug"].includes(this.logLevel)&&console.error(`[ERROR] ${e}`,...t)}warn(e,...t){["warn","info","debug"].includes(this.logLevel)&&console.warn(`[WARN] ${e}`,...t)}info(e,...t){["info","debug"].includes(this.logLevel)&&console.info(`[INFO] ${e}`,...t)}debug(e,...t){"debug"===this.logLevel&&console.debug(`[DEBUG] ${e}`,...t)}}var fetchRetry_umd={exports:{}};!function(e,t){e.exports=function(){function e(e){return Number.isInteger(e)&&e>=0}function t(e){this.name="ArgumentError",this.message=e}return function(r,n){if(n=n||{},"function"!=typeof r)throw new t("fetch must be a function");if("object"!=typeof n)throw new t("defaults must be an object");if(void 0!==n.retries&&!e(n.retries))throw new t("retries must be a positive integer");if(void 0!==n.retryDelay&&!e(n.retryDelay)&&"function"!=typeof n.retryDelay)throw new t("retryDelay must be a positive integer or a function returning a positive integer");if(void 0!==n.retryOn&&!Array.isArray(n.retryOn)&&"function"!=typeof n.retryOn)throw new t("retryOn property expects an array or function");var o={retries:3,retryDelay:1e3,retryOn:[]};return n=Object.assign(o,n),function(o,i){var a=n.retries,s=n.retryDelay,c=n.retryOn;if(i&&void 0!==i.retries){if(!e(i.retries))throw new t("retries must be a positive integer");a=i.retries}if(i&&void 0!==i.retryDelay){if(!e(i.retryDelay)&&"function"!=typeof i.retryDelay)throw new t("retryDelay must be a positive integer or a function returning a positive integer");s=i.retryDelay}if(i&&i.retryOn){if(!Array.isArray(i.retryOn)&&"function"!=typeof i.retryOn)throw new t("retryOn property expects an array or function");c=i.retryOn}return new Promise((function(e,t){var n=function(n){var s="undefined"!=typeof Request&&o instanceof Request?o.clone():o;r(s,i).then((function(r){if(Array.isArray(c)&&-1===c.indexOf(r.status))e(r);else if("function"==typeof c)try{return Promise.resolve(c(n,null,r)).then((function(t){t?u(n,null,r):e(r)})).catch(t)}catch(o){t(o)}else n<a?u(n,null,r):e(r)})).catch((function(e){if("function"==typeof c)try{Promise.resolve(c(n,e,null)).then((function(r){r?u(n,e,null):t(e)})).catch((function(e){t(e)}))}catch(r){t(r)}else n<a?u(n,e,null):t(e)}))};function u(e,t,r){var o="function"==typeof s?s(e,t,r):s;setTimeout((function(){n(++e)}),o)}n(0)}))}}}()}(fetchRetry_umd);var fetchRetry_umdExports=fetchRetry_umd.exports;const retryFetch=getDefaultExportFromCjs$1(fetchRetry_umdExports),fetchWithRetry=()=>retryFetch(fetch,{retries:3});var Name=(e=>(e.Contractcall="CONTRACTCALL",e.Cryptotransfer="CRYPTOTRANSFER",e))(Name||{}),Result=(e=>(e.Success="SUCCESS",e))(Result||{});class HashinalsWalletConnectSDK{constructor(e,t){this.extensionCheckInterval=null,this.hasCalledExtensionCallback=!1,this.logger=e||new DefaultLogger,this.network=t||LedgerId.MAINNET}get dAppConnector(){return HashinalsWalletConnectSDK.dAppConnectorInstance}static getInstance(e,t){let r=null==HashinalsWalletConnectSDK?void 0:HashinalsWalletConnectSDK.instance;return r||(HashinalsWalletConnectSDK.instance=new HashinalsWalletConnectSDK(e,t),r=HashinalsWalletConnectSDK.instance),t&&r.setNetwork(t),r}setLogger(e){this.logger=e}setNetwork(e){this.network=e}getNetwork(){return this.network}setLogLevel(e){this.logger instanceof DefaultLogger?this.logger.setLogLevel(e):this.logger.warn("setLogLevel is only available for the default logger")}async init(e,t,r,n){const o=r||this.network,i="mainnet"===o.toString();return HashinalsWalletConnectSDK.dAppConnectorInstance||(HashinalsWalletConnectSDK.dAppConnectorInstance=new DAppConnector(t,o,e,Object.values(HederaJsonRpcMethod),[HederaSessionEvent.ChainChanged,HederaSessionEvent.AccountsChanged],[i?HederaChainId.Mainnet:HederaChainId.Testnet],"debug"),await HashinalsWalletConnectSDK.dAppConnectorInstance.init({logger:"error"}),HashinalsWalletConnectSDK.dAppConnectorInstance.onSessionIframeCreated=e=>{this.logger.info("new session from from iframe",e),this.handleNewSession(e),n&&n(e)},this.logger.info(`Hedera Wallet Connect SDK initialized on ${o}`)),HashinalsWalletConnectSDK.dAppConnectorInstance}async connect(){this.ensureInitialized();const e=await this.dAppConnector.openModal();return this.handleNewSession(e),e}async disconnect(){var e,t;try{this.ensureInitialized();const r=this.getAccountInfo(),n=null==r?void 0:r.accountId,o=null==r?void 0:r.network,i=null==(e=null==this?void 0:this.dAppConnector)?void 0:e.signers.find((e=>e.getAccountId().toString()===n));return await(null==(t=this.dAppConnector)?void 0:t.disconnect(null==i?void 0:i.topic)),this.logger.info(`Disconnected from ${n} on ${o}`),!0}catch(e2){return this.logger.error("Failed to disconnect",e2),!1}}async disconnectAll(){var e;try{return this.ensureInitialized(),await(null==(e=this.dAppConnector)?void 0:e.disconnectAll()),this.logger.info("Disconnected from all wallets"),!0}catch(e2){return this.logger.error("Failed to disconnect",e2),!1}}async executeTransaction(e,t=!1){this.ensureInitialized();const r=this.getAccountInfo(),n=null==r?void 0:r.accountId,o=this.dAppConnector.signers.find((e=>e.getAccountId().toString()===n));if(t){const t=await e.executeWithSigner(o);return await t.getReceiptWithSigner(o)}{const t=await e.freezeWithSigner(o),r=await t.executeWithSigner(o);return await r.getReceiptWithSigner(o)}}async executeTransactionWithErrorHandling(e,t){var r;try{return{result:await this.executeTransaction(e,t),error:void 0}}catch(e2){const t=null==(r=e2.message)?void 0:r.toLowerCase();if(this.logger.error("Failed to execute transaction",e2),this.logger.error("Failure reason for transaction is",t),t.includes("insufficient payer balance"))return{result:void 0,error:"Insufficient balance to complete the transaction."};if(t.includes("reject"))return{result:void 0,error:"You rejected the transaction"};if(t.includes("invalid signature"))return{result:void 0,error:"Invalid signature. Please check your account and try again."};if(t.includes("transaction expired"))return{result:void 0,error:"Transaction expired. Please try again."};if(t.includes("account not found"))return{result:void 0,error:"Account not found. Please check the account ID and try again."};if(t.includes("unauthorized"))return{result:void 0,error:"Unauthorized. You may not have the necessary permissions for this action."};if(t.includes("busy"))return{result:void 0,error:"The network is busy. Please try again later."};if(t.includes("invalid transaction"))return{result:void 0,error:"Invalid transaction. Please check your inputs and try again."}}}async submitMessageToTopic(e,t,r){this.ensureInitialized();let n=(new TopicMessageSubmitTransaction).setTopicId(TopicId.fromString(e)).setMessage(t);return r&&(n=await n.sign(r)),this.executeTransaction(n)}async transferHbar(e,t,r){this.ensureInitialized();const n=(new TransferTransaction).setTransactionId(TransactionId.generate(e)).addHbarTransfer(AccountId.fromString(e),new Hbar(-r)).addHbarTransfer(AccountId.fromString(t),new Hbar(r));return this.executeTransaction(n)}async executeSmartContract(e,t,r,n=1e5){this.ensureInitialized();const o=(new ContractExecuteTransaction).setContractId(ContractId.fromString(e)).setGas(n).setFunction(t,r);return this.executeTransaction(o)}handleNewSession(e){var t,r,n;const o=null==(n=null==(r=null==(t=e.namespaces)?void 0:t.hedera)?void 0:r.accounts)?void 0:n[0],i=null==o?void 0:o.split(":"),a=i.pop(),s=i.pop();this.logger.info("sessionAccount is",a,s),a?this.saveConnectionInfo(a,s):this.logger.error("No account id found in the session")}getNetworkPrefix(){const e=this.getAccountInfo(),t=null==e?void 0:e.network;if(!t){this.logger.warn("Network is not set on SDK, defaulting.");const e=localStorage.getItem("connectedNetwork");return e||"mainnet-public"}return t!==this.network&&(this.logger.warn("Detected network mismatch, reverting to signer network",t),this.network=t),t.isMainnet()?"mainnet-public":"testnet"}async requestAccount(e){try{const t=`https://${this.getNetworkPrefix()}.mirrornode.hedera.com/api/v1/accounts/${e}`,r=await fetchWithRetry()(t);if(!r.ok)throw new Error(`Failed to make request to mirror node for account: ${r.status}`);return await r.json()}catch(e2){throw this.logger.error("Failed to fetch account",e2),e2}}async getAccountBalance(){this.ensureInitialized();const e=this.getAccountInfo(),t=null==e?void 0:e.accountId;if(!t)return null;const r=await this.requestAccount(t);if(!r)throw new Error("Failed to fetch account. Try again or check if the Account ID is valid.");const n=r.balance.balance/10**8;return Number(n).toLocaleString("en-US")}getAccountInfo(){var e,t;const{accountId:r}=this.loadConnectionInfo();if(!r)return null;const n=null==(e=null==this?void 0:this.dAppConnector)?void 0:e.signers;if(!(null==n?void 0:n.length))return null;const o=this.dAppConnector.signers.find((e=>e.getAccountId().toString()===r));if(!o)return null;const i=null==(t=null==o?void 0:o.getAccountId())?void 0:t.toString();if(!i)return null;return{accountId:i,network:o.getLedgerId()}}async createTopic(e,t,r){this.ensureInitialized();let n=(new TopicCreateTransaction).setTopicMemo(e||"");if(t){const e=PrivateKey.fromString(t);n.setAdminKey(e.publicKey),n=await n.sign(e)}r&&n.setSubmitKey(PrivateKey.fromString(r).publicKey);return(await this.executeTransaction(n)).topicId.toString()}async createToken(e,t,r,n,o,i,a){this.ensureInitialized();let s=(new TokenCreateTransaction).setTokenName(e).setTokenSymbol(t).setDecimals(n).setInitialSupply(r).setTreasuryAccountId(AccountId.fromString(o)).setTokenType(TokenType.NonFungibleUnique).setSupplyType(TokenSupplyType.Finite);a&&(s=s.setSupplyKey(PrivateKey.fromString(a))),i&&(s=s.setAdminKey(PrivateKey.fromString(i)),s=await s.sign(PrivateKey.fromString(i)));return(await this.executeTransaction(s)).tokenId.toString()}async mintNFT(e,t,r){this.ensureInitialized();let n=await(new TokenMintTransaction).setTokenId(e).setMetadata([Buffer$1$1.from(t,"utf-8")]).sign(r);return this.executeTransaction(n)}async getMessages(e,t,r=!1,n){var o,i;const a=`${`https://${n||this.getNetworkPrefix()}.mirrornode.hedera.com`}/api/v1/topics/${e}/messages?limit=200${Number(t)>0&&!r?`×tamp=gt:${t}`:""}`;try{const t=await fetchWithRetry()(a);if(!t.ok)throw new Error(`Failed to make request to mirror node: ${t.status}`);const n=await t.json(),s=(null==n?void 0:n.messages)||[],c=null==(o=null==n?void 0:n.links)?void 0:o.next,u=s.map((e=>({...JSON.parse(atob(e.message)),payer:e.payer_account_id,created:new Date(1e3*Number(e.consensus_timestamp)),consensus_timestamp:e.consensus_timestamp,sequence_number:e.sequence_number})));if(c){const t=await this.getMessages(e,Number(null==(i=u[u.length-1])?void 0:i.consensus_timestamp),r);u.push(...t.messages)}return{messages:u.sort(((e,t)=>e.sequence_number-t.sequence_number)),error:""}}catch(s){return this.logger.error("Error fetching topic data:",s),{messages:[],error:s.toString()}}}async signMessage(e){const t=this.dAppConnector;if(!t)throw new Error("No active connection or signer");const r=this.getAccountInfo(),n=null==r?void 0:r.accountId,o={signerAccountId:`hedera:${this.network}:${n}`,message:e};return{userSignature:(await t.signMessage(o)).signatureMap}}saveConnectionInfo(e,t){if(e){const r=null==t?void 0:t.replace(/['"]+/g,"");localStorage.setItem("connectedNetwork",r),localStorage.setItem("connectedAccountId",e)}else localStorage.removeItem("connectedAccountId"),localStorage.removeItem("connectedNetwork")}loadConnectionInfo(){return{accountId:localStorage.getItem("connectedAccountId"),network:localStorage.getItem("connectedNetwork")}}async connectWallet(e,t,r){try{await this.init(e,t,r);const n=await this.connect(),o=this.getAccountInfo(),i=null==o?void 0:o.accountId,a=await this.getAccountBalance(),s=this.getNetworkPrefix();return this.saveConnectionInfo(i,s),{accountId:i,balance:a,session:n}}catch(n){throw this.logger.error("Failed to connect wallet:",n),n}}async disconnectWallet(e=!0){try{const t=await this.disconnect();return t&&e&&localStorage.clear(),this.saveConnectionInfo(void 0),t}catch(t){return this.logger.error("Failed to disconnect wallet:",t),!1}}async initAccount(e,t,r,n=()=>{}){const{accountId:o,network:i}=this.loadConnectionInfo();if(o&&i)try{const a="mainnet"===i?LedgerId.MAINNET:LedgerId.TESTNET,s=r||a;await this.init(e,t,s,n);return{accountId:o,balance:await this.getAccountBalance()}}catch(a){return this.logger.error("Failed to reconnect:",a),this.saveConnectionInfo(void 0,void 0),null}else if(r)try{this.logger.info("initializing normally through override.",r),await this.init(e,t,r,n),this.logger.info("initialized",r),await this.connectViaDappBrowser(),this.logger.info("connected via dapp browser")}catch(a){return this.logger.error("Failed to fallback connect:",a),this.saveConnectionInfo(void 0,void 0),null}return null}subscribeToExtensions(e){return this.extensionCheckInterval&&clearInterval(this.extensionCheckInterval),this.hasCalledExtensionCallback=!1,this.extensionCheckInterval=setInterval((()=>{var t;const r=((null==(t=this.dAppConnector)?void 0:t.extensions)||[]).find((e=>e.availableInIframe));r&&!this.hasCalledExtensionCallback&&(this.hasCalledExtensionCallback=!0,e(r),this.extensionCheckInterval&&(clearInterval(this.extensionCheckInterval),this.extensionCheckInterval=null))}),1e3),()=>{this.extensionCheckInterval&&(clearInterval(this.extensionCheckInterval),this.extensionCheckInterval=null),this.hasCalledExtensionCallback=!1}}async connectViaDappBrowser(){const e=this.dAppConnector.extensions||[],t=e.find((e=>(this.logger.info("Checking extension",e),e.availableInIframe)));this.logger.info("extensions are",e,t),t?await this.connectToExtension(t):this.subscribeToExtensions((async e=>{await this.connectToExtension(e)}))}async connectToExtension(e){this.logger.info("found extension, connecting to iframe.",e);const t=await this.dAppConnector.connectExtension(e.id),r=this.dAppConnector.onSessionIframeCreated;r&&r(t)}ensureInitialized(){if(!this.dAppConnector)throw new Error("SDK not initialized. Call init() first.")}static run(){try{"undefined"!=typeof window&&(window.HashinalsWalletConnectSDK=HashinalsWalletConnectSDK.getInstance(),window.HashgraphSDK=HashgraphSDK)}catch(e2){console.error("[ERROR]: failed setting sdk on window")}}async transferToken(e,t,r,n){this.ensureInitialized();const o=(new TransferTransaction).setTransactionId(TransactionId.generate(t)).addTokenTransfer(TokenId.fromString(e),AccountId.fromString(t),-n).addTokenTransfer(TokenId.fromString(e),AccountId.fromString(r),n);return this.executeTransaction(o)}async createAccount(e){this.ensureInitialized();const t=(new AccountCreateTransaction).setInitialBalance(new Hbar(e));return this.executeTransaction(t)}async associateTokenToAccount(e,t){this.ensureInitialized();const r=(new TokenAssociateTransaction).setAccountId(AccountId.fromString(e)).setTokenIds([TokenId.fromString(t)]);return this.executeTransaction(r)}async dissociateTokenFromAccount(e,t){this.ensureInitialized();const r=(new TokenDissociateTransaction).setAccountId(AccountId.fromString(e)).setTokenIds([TokenId.fromString(t)]);return this.executeTransaction(r)}async updateAccount(e,t){this.ensureInitialized();const r=(new AccountUpdateTransaction).setAccountId(AccountId.fromString(e)).setMaxAutomaticTokenAssociations(t);return this.executeTransaction(r)}async approveAllowance(e,t,r,n){this.ensureInitialized();const o=(new AccountAllowanceApproveTransaction).approveTokenAllowance(TokenId.fromString(t),AccountId.fromString(n),AccountId.fromString(e),r);return this.executeTransaction(o)}async getAccountTokens(e){var t,r;this.ensureInitialized();const n=`https://${this.getNetworkPrefix()}.mirrornode.hedera.com`,o=`${n}/api/v1/accounts/${e}/tokens?limit=200`;try{const e=await fetchWithRetry()(o);if(!e.ok)throw new Error(`Failed to make request to mirror node for account tokens: ${e.status}`);const i=await e.json(),a=[];for(const t of i.tokens)t.token_id&&a.push({tokenId:t.token_id,balance:t.balance,decimals:t.decimals,formatted_balance:(t.balance/10**t.decimals).toLocaleString("en-US"),created_timestamp:new Date(1e3*Number(t.created_timestamp))});let s=null==(t=i.links)?void 0:t.next;for(;s;){const e=`${n}${s}`,t=await fetchWithRetry()(e);if(!t.ok)throw new Error(`Failed to make request to mirror node for account tokens: ${t.status}, page: ${e}`);const o=await t.json();for(const r of o.tokens)r.token_id&&a.push({tokenId:r.token_id,balance:r.balance,decimals:r.decimals,formatted_balance:(r.balance/10**r.decimals).toLocaleString("en-US"),created_timestamp:new Date(1e3*Number(r.created_timestamp))});s=null==(r=o.links)?void 0:r.next}return{tokens:a}}catch(i){throw this.logger.error("Error fetching account tokens:",i),i}}async getTransaction(e){try{const t=`https://${this.getNetworkPrefix()}.mirrornode.hedera.com/api/v1/transactions/${e}`;this.logger.debug("Fetching transaction",t);const r=await fetchWithRetry()(t);if(!r.ok)throw new Error(`Failed to fetch transaction: ${r.status}`);return await r.json()}catch(e2){return this.logger.error("Failed to get transaction",e2),null}}async getTransactionByTimestamp(e){var t;try{const r=`https://${this.getNetworkPrefix()}.mirrornode.hedera.com/api/v1/transactions?timestamp=${e}`;this.logger.debug("Fetching transaction by timestamp",r);const n=await fetchWithRetry()(r);if(!n.ok)throw new Error(`Failed to fetch transaction by timestamp: ${n.status}`);const o=await n.json(),i=null==(t=null==o?void 0:o.transactions)?void 0:t[0];return i?await this.getTransaction(i.transaction_id):null}catch(e2){return this.logger.error("Failed to get transaction by timestamp",e2),null}}async getAccountNFTs(e,t){var r,n,o;try{const i=this.getNetworkPrefix(),a=`https://${i}.mirrornode.hedera.com/api/v1/accounts/${e}/nfts?limit=200${t?`&token.id=${t}`:""}`,s=await fetchWithRetry()(a);if(!s.ok)throw new Error(`Failed to fetch NFTs for account: ${s.status}`);const c=await s.json();let u=(null==(r=null==c?void 0:c.links)?void 0:r.next)||null,l=c.nfts;for(;u;)try{const e=await fetchWithRetry()(`https://${i}.mirrornode.hedera.com${u}`);if(!e.ok)throw new Error(`Failed to fetch next page of NFTs: ${e.status}`);const t=await e.json();l=[...l,...(null==t?void 0:t.nfts)||[]],u=(null==(n=null==t?void 0:t.links)?void 0:n.next)&&u!==(null==(o=null==t?void 0:t.links)?void 0:o.next)?t.links.next:null}catch(e2){this.logger.error("Failed to fetch next page of NFTs",e2);break}return l.map((e=>{try{e.token_uri=Buffer$1$1.from(e.metadata,"base64").toString("ascii")}catch(e2){this.logger.error("Failed to decode NFT metadata",e2)}return e}))}catch(e2){return this.logger.error("Failed to get account NFTs",e2),[]}}async validateNFTOwnership(e,t,r){return(await this.getAccountNFTs(t,r)).find((t=>t.token_id===r&&t.serial_number.toString()===e))||null}async readSmartContract(e,t,r,n=!0,o=0){try{const i=this.getNetworkPrefix(),a={block:"latest",data:e,estimate:n,from:t.toSolidityAddress(),to:r.toSolidityAddress(),value:o};n||(a.gas=3e5,a.gasPrice=1e8);const s=`https://${i}.mirrornode.hedera.com/api/v1/contracts/call`,c=await fetchWithRetry()(s,{method:"POST",body:JSON.stringify(a),headers:{"Content-Type":"application/json"}});if(!c.ok)throw new Error(`Failed to make contract call: ${c.status}`);return await c.json()}catch(e2){return this.logger.error("Failed to make contract call",e2),null}}}HashinalsWalletConnectSDK.run();
|
|
107
107
|
/**
|
|
108
108
|
* @license
|
|
109
109
|
* Copyright 2019 Google LLC
|