ncc-client-poc 0.1.2 → 0.2.0

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.
@@ -1,251 +0,0 @@
1
- var pR=Object.defineProperty;var vR=(e,t,r)=>t in e?pR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ie=(e,t,r)=>vR(e,typeof t!="symbol"?t+"":t,r);function gR(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const u of i.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();var Ve=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function yR(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,s.get?s:{enumerable:!0,get:function(){return e[n]}})}),r}var l8={exports:{}},N0={},u8={exports:{}},it={};/**
2
- * @license React
3
- * react.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var Zu=Symbol.for("react.element"),mR=Symbol.for("react.portal"),wR=Symbol.for("react.fragment"),bR=Symbol.for("react.strict_mode"),xR=Symbol.for("react.profiler"),MR=Symbol.for("react.provider"),_R=Symbol.for("react.context"),ER=Symbol.for("react.forward_ref"),SR=Symbol.for("react.suspense"),AR=Symbol.for("react.memo"),kR=Symbol.for("react.lazy"),Ab=Symbol.iterator;function BR(e){return e===null||typeof e!="object"?null:(e=Ab&&e[Ab]||e["@@iterator"],typeof e=="function"?e:null)}var h8={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},c8=Object.assign,d8={};function ul(e,t,r){this.props=e,this.context=t,this.refs=d8,this.updater=r||h8}ul.prototype.isReactComponent={};ul.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ul.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function p8(){}p8.prototype=ul.prototype;function Qy(e,t,r){this.props=e,this.context=t,this.refs=d8,this.updater=r||h8}var em=Qy.prototype=new p8;em.constructor=Qy;c8(em,ul.prototype);em.isPureReactComponent=!0;var kb=Array.isArray,v8=Object.prototype.hasOwnProperty,tm={current:null},g8={key:!0,ref:!0,__self:!0,__source:!0};function y8(e,t,r){var n,s={},i=null,u=null;if(t!=null)for(n in t.ref!==void 0&&(u=t.ref),t.key!==void 0&&(i=""+t.key),t)v8.call(t,n)&&!g8.hasOwnProperty(n)&&(s[n]=t[n]);var d=arguments.length-2;if(d===1)s.children=r;else if(1<d){for(var c=Array(d),b=0;b<d;b++)c[b]=arguments[b+2];s.children=c}if(e&&e.defaultProps)for(n in d=e.defaultProps,d)s[n]===void 0&&(s[n]=d[n]);return{$$typeof:Zu,type:e,key:i,ref:u,props:s,_owner:tm.current}}function RR(e,t){return{$$typeof:Zu,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function rm(e){return typeof e=="object"&&e!==null&&e.$$typeof===Zu}function $R(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var Bb=/\/+/g;function vp(e,t){return typeof e=="object"&&e!==null&&e.key!=null?$R(""+e.key):t.toString(36)}function rc(e,t,r,n,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var u=!1;if(e===null)u=!0;else switch(i){case"string":case"number":u=!0;break;case"object":switch(e.$$typeof){case Zu:case mR:u=!0}}if(u)return u=e,s=s(u),e=n===""?"."+vp(u,0):n,kb(s)?(r="",e!=null&&(r=e.replace(Bb,"$&/")+"/"),rc(s,t,r,"",function(b){return b})):s!=null&&(rm(s)&&(s=RR(s,r+(!s.key||u&&u.key===s.key?"":(""+s.key).replace(Bb,"$&/")+"/")+e)),t.push(s)),1;if(u=0,n=n===""?".":n+":",kb(e))for(var d=0;d<e.length;d++){i=e[d];var c=n+vp(i,d);u+=rc(i,t,r,c,s)}else if(c=BR(e),typeof c=="function")for(e=c.call(e),d=0;!(i=e.next()).done;)i=i.value,c=n+vp(i,d++),u+=rc(i,t,r,c,s);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return u}function bh(e,t,r){if(e==null)return e;var n=[],s=0;return rc(e,n,"","",function(i){return t.call(r,i,s++)}),n}function NR(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Wr={current:null},nc={transition:null},TR={ReactCurrentDispatcher:Wr,ReactCurrentBatchConfig:nc,ReactCurrentOwner:tm};function m8(){throw Error("act(...) is not supported in production builds of React.")}it.Children={map:bh,forEach:function(e,t,r){bh(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return bh(e,function(){t++}),t},toArray:function(e){return bh(e,function(t){return t})||[]},only:function(e){if(!rm(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};it.Component=ul;it.Fragment=wR;it.Profiler=xR;it.PureComponent=Qy;it.StrictMode=bR;it.Suspense=SR;it.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=TR;it.act=m8;it.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=c8({},e.props),s=e.key,i=e.ref,u=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,u=tm.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var d=e.type.defaultProps;for(c in t)v8.call(t,c)&&!g8.hasOwnProperty(c)&&(n[c]=t[c]===void 0&&d!==void 0?d[c]:t[c])}var c=arguments.length-2;if(c===1)n.children=r;else if(1<c){d=Array(c);for(var b=0;b<c;b++)d[b]=arguments[b+2];n.children=d}return{$$typeof:Zu,type:e.type,key:s,ref:i,props:n,_owner:u}};it.createContext=function(e){return e={$$typeof:_R,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:MR,_context:e},e.Consumer=e};it.createElement=y8;it.createFactory=function(e){var t=y8.bind(null,e);return t.type=e,t};it.createRef=function(){return{current:null}};it.forwardRef=function(e){return{$$typeof:ER,render:e}};it.isValidElement=rm;it.lazy=function(e){return{$$typeof:kR,_payload:{_status:-1,_result:e},_init:NR}};it.memo=function(e,t){return{$$typeof:AR,type:e,compare:t===void 0?null:t}};it.startTransition=function(e){var t=nc.transition;nc.transition={};try{e()}finally{nc.transition=t}};it.unstable_act=m8;it.useCallback=function(e,t){return Wr.current.useCallback(e,t)};it.useContext=function(e){return Wr.current.useContext(e)};it.useDebugValue=function(){};it.useDeferredValue=function(e){return Wr.current.useDeferredValue(e)};it.useEffect=function(e,t){return Wr.current.useEffect(e,t)};it.useId=function(){return Wr.current.useId()};it.useImperativeHandle=function(e,t,r){return Wr.current.useImperativeHandle(e,t,r)};it.useInsertionEffect=function(e,t){return Wr.current.useInsertionEffect(e,t)};it.useLayoutEffect=function(e,t){return Wr.current.useLayoutEffect(e,t)};it.useMemo=function(e,t){return Wr.current.useMemo(e,t)};it.useReducer=function(e,t,r){return Wr.current.useReducer(e,t,r)};it.useRef=function(e){return Wr.current.useRef(e)};it.useState=function(e){return Wr.current.useState(e)};it.useSyncExternalStore=function(e,t,r){return Wr.current.useSyncExternalStore(e,t,r)};it.useTransition=function(){return Wr.current.useTransition()};it.version="18.3.1";u8.exports=it;var Pe=u8.exports;const tr=Xy(Pe);/**
10
- * @license React
11
- * react-jsx-runtime.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var IR=Pe,CR=Symbol.for("react.element"),PR=Symbol.for("react.fragment"),LR=Object.prototype.hasOwnProperty,OR=IR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,UR={key:!0,ref:!0,__self:!0,__source:!0};function w8(e,t,r){var n,s={},i=null,u=null;r!==void 0&&(i=""+r),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(u=t.ref);for(n in t)LR.call(t,n)&&!UR.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)s[n]===void 0&&(s[n]=t[n]);return{$$typeof:CR,type:e,key:i,ref:u,props:s,_owner:OR.current}}N0.Fragment=PR;N0.jsx=w8;N0.jsxs=w8;l8.exports=N0;var V=l8.exports,Hv={},b8={exports:{}},pn={},x8={exports:{}},M8={};/**
18
- * @license React
19
- * scheduler.production.min.js
20
- *
21
- * Copyright (c) Facebook, Inc. and its affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */(function(e){function t(m,p){var a=m.length;m.push(p);e:for(;0<a;){var g=a-1>>>1,S=m[g];if(0<s(S,p))m[g]=p,m[a]=S,a=g;else break e}}function r(m){return m.length===0?null:m[0]}function n(m){if(m.length===0)return null;var p=m[0],a=m.pop();if(a!==p){m[0]=a;e:for(var g=0,S=m.length,N=S>>>1;g<N;){var U=2*(g+1)-1,Z=m[U],H=U+1,$=m[H];if(0>s(Z,a))H<S&&0>s($,Z)?(m[g]=$,m[H]=a,g=H):(m[g]=Z,m[U]=a,g=U);else if(H<S&&0>s($,a))m[g]=$,m[H]=a,g=H;else break e}}return p}function s(m,p){var a=m.sortIndex-p.sortIndex;return a!==0?a:m.id-p.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var c=[],b=[],w=1,M=null,_=3,A=!1,R=!1,B=!1,I=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(m){for(var p=r(b);p!==null;){if(p.callback===null)n(b);else if(p.startTime<=m)n(b),p.sortIndex=p.expirationTime,t(c,p);else break;p=r(b)}}function L(m){if(B=!1,T(m),!R)if(r(c)!==null)R=!0,v(q);else{var p=r(b);p!==null&&y(L,p.startTime-m)}}function q(m,p){R=!1,B&&(B=!1,E(F),F=-1),A=!0;var a=_;try{for(T(p),M=r(c);M!==null&&(!(M.expirationTime>p)||m&&!x());){var g=M.callback;if(typeof g=="function"){M.callback=null,_=M.priorityLevel;var S=g(M.expirationTime<=p);p=e.unstable_now(),typeof S=="function"?M.callback=S:M===r(c)&&n(c),T(p)}else n(c);M=r(c)}if(M!==null)var N=!0;else{var U=r(b);U!==null&&y(L,U.startTime-p),N=!1}return N}finally{M=null,_=a,A=!1}}var z=!1,J=null,F=-1,X=5,ee=-1;function x(){return!(e.unstable_now()-ee<X)}function o(){if(J!==null){var m=e.unstable_now();ee=m;var p=!0;try{p=J(!0,m)}finally{p?f():(z=!1,J=null)}}else z=!1}var f;if(typeof k=="function")f=function(){k(o)};else if(typeof MessageChannel<"u"){var l=new MessageChannel,h=l.port2;l.port1.onmessage=o,f=function(){h.postMessage(null)}}else f=function(){I(o,0)};function v(m){J=m,z||(z=!0,f())}function y(m,p){F=I(function(){m(e.unstable_now())},p)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(m){m.callback=null},e.unstable_continueExecution=function(){R||A||(R=!0,v(q))},e.unstable_forceFrameRate=function(m){0>m||125<m?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<m?Math.floor(1e3/m):5},e.unstable_getCurrentPriorityLevel=function(){return _},e.unstable_getFirstCallbackNode=function(){return r(c)},e.unstable_next=function(m){switch(_){case 1:case 2:case 3:var p=3;break;default:p=_}var a=_;_=p;try{return m()}finally{_=a}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(m,p){switch(m){case 1:case 2:case 3:case 4:case 5:break;default:m=3}var a=_;_=m;try{return p()}finally{_=a}},e.unstable_scheduleCallback=function(m,p,a){var g=e.unstable_now();switch(typeof a=="object"&&a!==null?(a=a.delay,a=typeof a=="number"&&0<a?g+a:g):a=g,m){case 1:var S=-1;break;case 2:S=250;break;case 5:S=1073741823;break;case 4:S=1e4;break;default:S=5e3}return S=a+S,m={id:w++,callback:p,priorityLevel:m,startTime:a,expirationTime:S,sortIndex:-1},a>g?(m.sortIndex=a,t(b,m),r(c)===null&&m===r(b)&&(B?(E(F),F=-1):B=!0,y(L,a-g))):(m.sortIndex=S,t(c,m),R||A||(R=!0,v(q))),m},e.unstable_shouldYield=x,e.unstable_wrapCallback=function(m){var p=_;return function(){var a=_;_=p;try{return m.apply(this,arguments)}finally{_=a}}}})(M8);x8.exports=M8;var jR=x8.exports;/**
26
- * @license React
27
- * react-dom.production.min.js
28
- *
29
- * Copyright (c) Facebook, Inc. and its affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var DR=Pe,cn=jR;function Ce(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var _8=new Set,wu={};function Ua(e,t){Pf(e,t),Pf(e+"Capture",t)}function Pf(e,t){for(wu[e]=t,e=0;e<t.length;e++)_8.add(t[e])}var co=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),zv=Object.prototype.hasOwnProperty,qR=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Rb={},$b={};function FR(e){return zv.call($b,e)?!0:zv.call(Rb,e)?!1:qR.test(e)?$b[e]=!0:(Rb[e]=!0,!1)}function HR(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function zR(e,t,r,n){if(t===null||typeof t>"u"||HR(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Vr(e,t,r,n,s,i,u){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=s,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=u}var Er={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Er[e]=new Vr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Er[t]=new Vr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Er[e]=new Vr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Er[e]=new Vr(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Er[e]=new Vr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Er[e]=new Vr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Er[e]=new Vr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Er[e]=new Vr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Er[e]=new Vr(e,5,!1,e.toLowerCase(),null,!1,!1)});var nm=/[\-:]([a-z])/g;function im(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(nm,im);Er[t]=new Vr(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(nm,im);Er[t]=new Vr(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(nm,im);Er[t]=new Vr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Er[e]=new Vr(e,1,!1,e.toLowerCase(),null,!1,!1)});Er.xlinkHref=new Vr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Er[e]=new Vr(e,1,!1,e.toLowerCase(),null,!0,!0)});function om(e,t,r,n){var s=Er.hasOwnProperty(t)?Er[t]:null;(s!==null?s.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(zR(t,r,s,n)&&(r=null),n||s===null?FR(t)&&(r===null?e.removeAttribute(t):e.setAttribute(t,""+r)):s.mustUseProperty?e[s.propertyName]=r===null?s.type===3?!1:"":r:(t=s.attributeName,n=s.attributeNamespace,r===null?e.removeAttribute(t):(s=s.type,r=s===3||s===4&&r===!0?"":""+r,n?e.setAttributeNS(n,t,r):e.setAttribute(t,r))))}var So=DR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,xh=Symbol.for("react.element"),rf=Symbol.for("react.portal"),nf=Symbol.for("react.fragment"),sm=Symbol.for("react.strict_mode"),Wv=Symbol.for("react.profiler"),E8=Symbol.for("react.provider"),S8=Symbol.for("react.context"),am=Symbol.for("react.forward_ref"),Vv=Symbol.for("react.suspense"),Kv=Symbol.for("react.suspense_list"),fm=Symbol.for("react.memo"),Xo=Symbol.for("react.lazy"),A8=Symbol.for("react.offscreen"),Nb=Symbol.iterator;function Tl(e){return e===null||typeof e!="object"?null:(e=Nb&&e[Nb]||e["@@iterator"],typeof e=="function"?e:null)}var Ht=Object.assign,gp;function tu(e){if(gp===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);gp=t&&t[1]||""}return`
34
- `+gp+e}var yp=!1;function mp(e,t){if(!e||yp)return"";yp=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(b){var n=b}Reflect.construct(e,[],t)}else{try{t.call()}catch(b){n=b}e.call(t.prototype)}else{try{throw Error()}catch(b){n=b}e()}}catch(b){if(b&&n&&typeof b.stack=="string"){for(var s=b.stack.split(`
35
- `),i=n.stack.split(`
36
- `),u=s.length-1,d=i.length-1;1<=u&&0<=d&&s[u]!==i[d];)d--;for(;1<=u&&0<=d;u--,d--)if(s[u]!==i[d]){if(u!==1||d!==1)do if(u--,d--,0>d||s[u]!==i[d]){var c=`
37
- `+s[u].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=u&&0<=d);break}}}finally{yp=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?tu(e):""}function WR(e){switch(e.tag){case 5:return tu(e.type);case 16:return tu("Lazy");case 13:return tu("Suspense");case 19:return tu("SuspenseList");case 0:case 2:case 15:return e=mp(e.type,!1),e;case 11:return e=mp(e.type.render,!1),e;case 1:return e=mp(e.type,!0),e;default:return""}}function Zv(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case nf:return"Fragment";case rf:return"Portal";case Wv:return"Profiler";case sm:return"StrictMode";case Vv:return"Suspense";case Kv:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case S8:return(e.displayName||"Context")+".Consumer";case E8:return(e._context.displayName||"Context")+".Provider";case am:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case fm:return t=e.displayName||null,t!==null?t:Zv(e.type)||"Memo";case Xo:t=e._payload,e=e._init;try{return Zv(e(t))}catch{}}return null}function VR(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Zv(t);case 8:return t===sm?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function xs(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function k8(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function KR(e){var t=k8(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(u){n=""+u,i.call(this,u)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(u){n=""+u},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Mh(e){e._valueTracker||(e._valueTracker=KR(e))}function B8(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=k8(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Nc(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Gv(e,t){var r=t.checked;return Ht({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function Tb(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=xs(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function R8(e,t){t=t.checked,t!=null&&om(e,"checked",t,!1)}function Jv(e,t){R8(e,t);var r=xs(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Yv(e,t.type,r):t.hasOwnProperty("defaultValue")&&Yv(e,t.type,xs(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ib(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function Yv(e,t,r){(t!=="number"||Nc(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var ru=Array.isArray;function xf(e,t,r,n){if(e=e.options,t){t={};for(var s=0;s<r.length;s++)t["$"+r[s]]=!0;for(r=0;r<e.length;r++)s=t.hasOwnProperty("$"+e[r].value),e[r].selected!==s&&(e[r].selected=s),s&&n&&(e[r].defaultSelected=!0)}else{for(r=""+xs(r),t=null,s=0;s<e.length;s++){if(e[s].value===r){e[s].selected=!0,n&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Xv(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Ce(91));return Ht({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Cb(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(Ce(92));if(ru(r)){if(1<r.length)throw Error(Ce(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:xs(r)}}function $8(e,t){var r=xs(t.value),n=xs(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),n!=null&&(e.defaultValue=""+n)}function Pb(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function N8(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Qv(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?N8(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var _h,T8=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,n,s){MSApp.execUnsafeLocalFunction(function(){return e(t,r,n,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(_h=_h||document.createElement("div"),_h.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=_h.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function bu(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var fu={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ZR=["Webkit","ms","Moz","O"];Object.keys(fu).forEach(function(e){ZR.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fu[t]=fu[e]})});function I8(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||fu.hasOwnProperty(e)&&fu[e]?(""+t).trim():t+"px"}function C8(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,s=I8(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,s):e[r]=s}}var GR=Ht({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function eg(e,t){if(t){if(GR[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Ce(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Ce(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Ce(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Ce(62))}}function tg(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var rg=null;function lm(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ng=null,Mf=null,_f=null;function Lb(e){if(e=Yu(e)){if(typeof ng!="function")throw Error(Ce(280));var t=e.stateNode;t&&(t=L0(t),ng(e.stateNode,e.type,t))}}function P8(e){Mf?_f?_f.push(e):_f=[e]:Mf=e}function L8(){if(Mf){var e=Mf,t=_f;if(_f=Mf=null,Lb(e),t)for(e=0;e<t.length;e++)Lb(t[e])}}function O8(e,t){return e(t)}function U8(){}var wp=!1;function j8(e,t,r){if(wp)return e(t,r);wp=!0;try{return O8(e,t,r)}finally{wp=!1,(Mf!==null||_f!==null)&&(U8(),L8())}}function xu(e,t){var r=e.stateNode;if(r===null)return null;var n=L0(r);if(n===null)return null;r=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(Ce(231,t,typeof r));return r}var ig=!1;if(co)try{var Il={};Object.defineProperty(Il,"passive",{get:function(){ig=!0}}),window.addEventListener("test",Il,Il),window.removeEventListener("test",Il,Il)}catch{ig=!1}function JR(e,t,r,n,s,i,u,d,c){var b=Array.prototype.slice.call(arguments,3);try{t.apply(r,b)}catch(w){this.onError(w)}}var lu=!1,Tc=null,Ic=!1,og=null,YR={onError:function(e){lu=!0,Tc=e}};function XR(e,t,r,n,s,i,u,d,c){lu=!1,Tc=null,JR.apply(YR,arguments)}function QR(e,t,r,n,s,i,u,d,c){if(XR.apply(this,arguments),lu){if(lu){var b=Tc;lu=!1,Tc=null}else throw Error(Ce(198));Ic||(Ic=!0,og=b)}}function ja(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function D8(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Ob(e){if(ja(e)!==e)throw Error(Ce(188))}function e$(e){var t=e.alternate;if(!t){if(t=ja(e),t===null)throw Error(Ce(188));return t!==e?null:e}for(var r=e,n=t;;){var s=r.return;if(s===null)break;var i=s.alternate;if(i===null){if(n=s.return,n!==null){r=n;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===r)return Ob(s),e;if(i===n)return Ob(s),t;i=i.sibling}throw Error(Ce(188))}if(r.return!==n.return)r=s,n=i;else{for(var u=!1,d=s.child;d;){if(d===r){u=!0,r=s,n=i;break}if(d===n){u=!0,n=s,r=i;break}d=d.sibling}if(!u){for(d=i.child;d;){if(d===r){u=!0,r=i,n=s;break}if(d===n){u=!0,n=i,r=s;break}d=d.sibling}if(!u)throw Error(Ce(189))}}if(r.alternate!==n)throw Error(Ce(190))}if(r.tag!==3)throw Error(Ce(188));return r.stateNode.current===r?e:t}function q8(e){return e=e$(e),e!==null?F8(e):null}function F8(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=F8(e);if(t!==null)return t;e=e.sibling}return null}var H8=cn.unstable_scheduleCallback,Ub=cn.unstable_cancelCallback,t$=cn.unstable_shouldYield,r$=cn.unstable_requestPaint,Zt=cn.unstable_now,n$=cn.unstable_getCurrentPriorityLevel,um=cn.unstable_ImmediatePriority,z8=cn.unstable_UserBlockingPriority,Cc=cn.unstable_NormalPriority,i$=cn.unstable_LowPriority,W8=cn.unstable_IdlePriority,T0=null,ki=null;function o$(e){if(ki&&typeof ki.onCommitFiberRoot=="function")try{ki.onCommitFiberRoot(T0,e,void 0,(e.current.flags&128)===128)}catch{}}var Kn=Math.clz32?Math.clz32:f$,s$=Math.log,a$=Math.LN2;function f$(e){return e>>>=0,e===0?32:31-(s$(e)/a$|0)|0}var Eh=64,Sh=4194304;function nu(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Pc(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,s=e.suspendedLanes,i=e.pingedLanes,u=r&268435455;if(u!==0){var d=u&~s;d!==0?n=nu(d):(i&=u,i!==0&&(n=nu(i)))}else u=r&~s,u!==0?n=nu(u):i!==0&&(n=nu(i));if(n===0)return 0;if(t!==0&&t!==n&&!(t&s)&&(s=n&-n,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0<t;)r=31-Kn(t),s=1<<r,n|=e[r],t&=~s;return n}function l$(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function u$(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var u=31-Kn(i),d=1<<u,c=s[u];c===-1?(!(d&r)||d&n)&&(s[u]=l$(d,t)):c<=t&&(e.expiredLanes|=d),i&=~d}}function sg(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function V8(){var e=Eh;return Eh<<=1,!(Eh&4194240)&&(Eh=64),e}function bp(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function Gu(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Kn(t),e[t]=r}function h$(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0<r;){var s=31-Kn(r),i=1<<s;t[s]=0,n[s]=-1,e[s]=-1,r&=~i}}function hm(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-Kn(r),s=1<<n;s&t|e[n]&t&&(e[n]|=t),r&=~s}}var ct=0;function K8(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Z8,cm,G8,J8,Y8,ag=!1,Ah=[],ls=null,us=null,hs=null,Mu=new Map,_u=new Map,ts=[],c$="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function jb(e,t){switch(e){case"focusin":case"focusout":ls=null;break;case"dragenter":case"dragleave":us=null;break;case"mouseover":case"mouseout":hs=null;break;case"pointerover":case"pointerout":Mu.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":_u.delete(t.pointerId)}}function Cl(e,t,r,n,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:i,targetContainers:[s]},t!==null&&(t=Yu(t),t!==null&&cm(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function d$(e,t,r,n,s){switch(t){case"focusin":return ls=Cl(ls,e,t,r,n,s),!0;case"dragenter":return us=Cl(us,e,t,r,n,s),!0;case"mouseover":return hs=Cl(hs,e,t,r,n,s),!0;case"pointerover":var i=s.pointerId;return Mu.set(i,Cl(Mu.get(i)||null,e,t,r,n,s)),!0;case"gotpointercapture":return i=s.pointerId,_u.set(i,Cl(_u.get(i)||null,e,t,r,n,s)),!0}return!1}function X8(e){var t=aa(e.target);if(t!==null){var r=ja(t);if(r!==null){if(t=r.tag,t===13){if(t=D8(r),t!==null){e.blockedOn=t,Y8(e.priority,function(){G8(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ic(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=fg(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);rg=n,r.target.dispatchEvent(n),rg=null}else return t=Yu(r),t!==null&&cm(t),e.blockedOn=r,!1;t.shift()}return!0}function Db(e,t,r){ic(e)&&r.delete(t)}function p$(){ag=!1,ls!==null&&ic(ls)&&(ls=null),us!==null&&ic(us)&&(us=null),hs!==null&&ic(hs)&&(hs=null),Mu.forEach(Db),_u.forEach(Db)}function Pl(e,t){e.blockedOn===t&&(e.blockedOn=null,ag||(ag=!0,cn.unstable_scheduleCallback(cn.unstable_NormalPriority,p$)))}function Eu(e){function t(s){return Pl(s,e)}if(0<Ah.length){Pl(Ah[0],e);for(var r=1;r<Ah.length;r++){var n=Ah[r];n.blockedOn===e&&(n.blockedOn=null)}}for(ls!==null&&Pl(ls,e),us!==null&&Pl(us,e),hs!==null&&Pl(hs,e),Mu.forEach(t),_u.forEach(t),r=0;r<ts.length;r++)n=ts[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<ts.length&&(r=ts[0],r.blockedOn===null);)X8(r),r.blockedOn===null&&ts.shift()}var Ef=So.ReactCurrentBatchConfig,Lc=!0;function v$(e,t,r,n){var s=ct,i=Ef.transition;Ef.transition=null;try{ct=1,dm(e,t,r,n)}finally{ct=s,Ef.transition=i}}function g$(e,t,r,n){var s=ct,i=Ef.transition;Ef.transition=null;try{ct=4,dm(e,t,r,n)}finally{ct=s,Ef.transition=i}}function dm(e,t,r,n){if(Lc){var s=fg(e,t,r,n);if(s===null)$p(e,t,n,Oc,r),jb(e,n);else if(d$(s,e,t,r,n))n.stopPropagation();else if(jb(e,n),t&4&&-1<c$.indexOf(e)){for(;s!==null;){var i=Yu(s);if(i!==null&&Z8(i),i=fg(e,t,r,n),i===null&&$p(e,t,n,Oc,r),i===s)break;s=i}s!==null&&n.stopPropagation()}else $p(e,t,n,null,r)}}var Oc=null;function fg(e,t,r,n){if(Oc=null,e=lm(n),e=aa(e),e!==null)if(t=ja(e),t===null)e=null;else if(r=t.tag,r===13){if(e=D8(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Oc=e,null}function Q8(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(n$()){case um:return 1;case z8:return 4;case Cc:case i$:return 16;case W8:return 536870912;default:return 16}default:return 16}}var ns=null,pm=null,oc=null;function e5(){if(oc)return oc;var e,t=pm,r=t.length,n,s="value"in ns?ns.value:ns.textContent,i=s.length;for(e=0;e<r&&t[e]===s[e];e++);var u=r-e;for(n=1;n<=u&&t[r-n]===s[i-n];n++);return oc=s.slice(e,1<n?1-n:void 0)}function sc(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function kh(){return!0}function qb(){return!1}function vn(e){function t(r,n,s,i,u){this._reactName=r,this._targetInst=s,this.type=n,this.nativeEvent=i,this.target=u,this.currentTarget=null;for(var d in e)e.hasOwnProperty(d)&&(r=e[d],this[d]=r?r(i):i[d]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?kh:qb,this.isPropagationStopped=qb,this}return Ht(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=kh)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=kh)},persist:function(){},isPersistent:kh}),t}var hl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vm=vn(hl),Ju=Ht({},hl,{view:0,detail:0}),y$=vn(Ju),xp,Mp,Ll,I0=Ht({},Ju,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gm,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ll&&(Ll&&e.type==="mousemove"?(xp=e.screenX-Ll.screenX,Mp=e.screenY-Ll.screenY):Mp=xp=0,Ll=e),xp)},movementY:function(e){return"movementY"in e?e.movementY:Mp}}),Fb=vn(I0),m$=Ht({},I0,{dataTransfer:0}),w$=vn(m$),b$=Ht({},Ju,{relatedTarget:0}),_p=vn(b$),x$=Ht({},hl,{animationName:0,elapsedTime:0,pseudoElement:0}),M$=vn(x$),_$=Ht({},hl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),E$=vn(_$),S$=Ht({},hl,{data:0}),Hb=vn(S$),A$={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},k$={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},B$={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function R$(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=B$[e])?!!t[e]:!1}function gm(){return R$}var $$=Ht({},Ju,{key:function(e){if(e.key){var t=A$[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=sc(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?k$[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gm,charCode:function(e){return e.type==="keypress"?sc(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?sc(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),N$=vn($$),T$=Ht({},I0,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zb=vn(T$),I$=Ht({},Ju,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gm}),C$=vn(I$),P$=Ht({},hl,{propertyName:0,elapsedTime:0,pseudoElement:0}),L$=vn(P$),O$=Ht({},I0,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),U$=vn(O$),j$=[9,13,27,32],ym=co&&"CompositionEvent"in window,uu=null;co&&"documentMode"in document&&(uu=document.documentMode);var D$=co&&"TextEvent"in window&&!uu,t5=co&&(!ym||uu&&8<uu&&11>=uu),Wb=" ",Vb=!1;function r5(e,t){switch(e){case"keyup":return j$.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function n5(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var of=!1;function q$(e,t){switch(e){case"compositionend":return n5(t);case"keypress":return t.which!==32?null:(Vb=!0,Wb);case"textInput":return e=t.data,e===Wb&&Vb?null:e;default:return null}}function F$(e,t){if(of)return e==="compositionend"||!ym&&r5(e,t)?(e=e5(),oc=pm=ns=null,of=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return t5&&t.locale!=="ko"?null:t.data;default:return null}}var H$={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Kb(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!H$[e.type]:t==="textarea"}function i5(e,t,r,n){P8(n),t=Uc(t,"onChange"),0<t.length&&(r=new vm("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var hu=null,Su=null;function z$(e){v5(e,0)}function C0(e){var t=ff(e);if(B8(t))return e}function W$(e,t){if(e==="change")return t}var o5=!1;if(co){var Ep;if(co){var Sp="oninput"in document;if(!Sp){var Zb=document.createElement("div");Zb.setAttribute("oninput","return;"),Sp=typeof Zb.oninput=="function"}Ep=Sp}else Ep=!1;o5=Ep&&(!document.documentMode||9<document.documentMode)}function Gb(){hu&&(hu.detachEvent("onpropertychange",s5),Su=hu=null)}function s5(e){if(e.propertyName==="value"&&C0(Su)){var t=[];i5(t,Su,e,lm(e)),j8(z$,t)}}function V$(e,t,r){e==="focusin"?(Gb(),hu=t,Su=r,hu.attachEvent("onpropertychange",s5)):e==="focusout"&&Gb()}function K$(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return C0(Su)}function Z$(e,t){if(e==="click")return C0(t)}function G$(e,t){if(e==="input"||e==="change")return C0(t)}function J$(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gn=typeof Object.is=="function"?Object.is:J$;function Au(e,t){if(Gn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var s=r[n];if(!zv.call(t,s)||!Gn(e[s],t[s]))return!1}return!0}function Jb(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Yb(e,t){var r=Jb(e);e=0;for(var n;r;){if(r.nodeType===3){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Jb(r)}}function a5(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?a5(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function f5(){for(var e=window,t=Nc();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Nc(e.document)}return t}function mm(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Y$(e){var t=f5(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&a5(r.ownerDocument.documentElement,r)){if(n!==null&&mm(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=r.textContent.length,i=Math.min(n.start,s);n=n.end===void 0?i:Math.min(n.end,s),!e.extend&&i>n&&(s=n,n=i,i=s),s=Yb(r,i);var u=Yb(r,n);s&&u&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==u.node||e.focusOffset!==u.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>n?(e.addRange(t),e.extend(u.node,u.offset)):(t.setEnd(u.node,u.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var X$=co&&"documentMode"in document&&11>=document.documentMode,sf=null,lg=null,cu=null,ug=!1;function Xb(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;ug||sf==null||sf!==Nc(n)||(n=sf,"selectionStart"in n&&mm(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),cu&&Au(cu,n)||(cu=n,n=Uc(lg,"onSelect"),0<n.length&&(t=new vm("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=sf)))}function Bh(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var af={animationend:Bh("Animation","AnimationEnd"),animationiteration:Bh("Animation","AnimationIteration"),animationstart:Bh("Animation","AnimationStart"),transitionend:Bh("Transition","TransitionEnd")},Ap={},l5={};co&&(l5=document.createElement("div").style,"AnimationEvent"in window||(delete af.animationend.animation,delete af.animationiteration.animation,delete af.animationstart.animation),"TransitionEvent"in window||delete af.transitionend.transition);function P0(e){if(Ap[e])return Ap[e];if(!af[e])return e;var t=af[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in l5)return Ap[e]=t[r];return e}var u5=P0("animationend"),h5=P0("animationiteration"),c5=P0("animationstart"),d5=P0("transitionend"),p5=new Map,Qb="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Bs(e,t){p5.set(e,t),Ua(t,[e])}for(var kp=0;kp<Qb.length;kp++){var Bp=Qb[kp],Q$=Bp.toLowerCase(),eN=Bp[0].toUpperCase()+Bp.slice(1);Bs(Q$,"on"+eN)}Bs(u5,"onAnimationEnd");Bs(h5,"onAnimationIteration");Bs(c5,"onAnimationStart");Bs("dblclick","onDoubleClick");Bs("focusin","onFocus");Bs("focusout","onBlur");Bs(d5,"onTransitionEnd");Pf("onMouseEnter",["mouseout","mouseover"]);Pf("onMouseLeave",["mouseout","mouseover"]);Pf("onPointerEnter",["pointerout","pointerover"]);Pf("onPointerLeave",["pointerout","pointerover"]);Ua("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ua("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ua("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ua("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ua("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ua("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var iu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),tN=new Set("cancel close invalid load scroll toggle".split(" ").concat(iu));function e3(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,QR(n,t,void 0,e),e.currentTarget=null}function v5(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var n=e[r],s=n.event;n=n.listeners;e:{var i=void 0;if(t)for(var u=n.length-1;0<=u;u--){var d=n[u],c=d.instance,b=d.currentTarget;if(d=d.listener,c!==i&&s.isPropagationStopped())break e;e3(s,d,b),i=c}else for(u=0;u<n.length;u++){if(d=n[u],c=d.instance,b=d.currentTarget,d=d.listener,c!==i&&s.isPropagationStopped())break e;e3(s,d,b),i=c}}}if(Ic)throw e=og,Ic=!1,og=null,e}function It(e,t){var r=t[vg];r===void 0&&(r=t[vg]=new Set);var n=e+"__bubble";r.has(n)||(g5(t,e,2,!1),r.add(n))}function Rp(e,t,r){var n=0;t&&(n|=4),g5(r,e,n,t)}var Rh="_reactListening"+Math.random().toString(36).slice(2);function ku(e){if(!e[Rh]){e[Rh]=!0,_8.forEach(function(r){r!=="selectionchange"&&(tN.has(r)||Rp(r,!1,e),Rp(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Rh]||(t[Rh]=!0,Rp("selectionchange",!1,t))}}function g5(e,t,r,n){switch(Q8(t)){case 1:var s=v$;break;case 4:s=g$;break;default:s=dm}r=s.bind(null,t,r,e),s=void 0,!ig||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),n?s!==void 0?e.addEventListener(t,r,{capture:!0,passive:s}):e.addEventListener(t,r,!0):s!==void 0?e.addEventListener(t,r,{passive:s}):e.addEventListener(t,r,!1)}function $p(e,t,r,n,s){var i=n;if(!(t&1)&&!(t&2)&&n!==null)e:for(;;){if(n===null)return;var u=n.tag;if(u===3||u===4){var d=n.stateNode.containerInfo;if(d===s||d.nodeType===8&&d.parentNode===s)break;if(u===4)for(u=n.return;u!==null;){var c=u.tag;if((c===3||c===4)&&(c=u.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;u=u.return}for(;d!==null;){if(u=aa(d),u===null)return;if(c=u.tag,c===5||c===6){n=i=u;continue e}d=d.parentNode}}n=n.return}j8(function(){var b=i,w=lm(r),M=[];e:{var _=p5.get(e);if(_!==void 0){var A=vm,R=e;switch(e){case"keypress":if(sc(r)===0)break e;case"keydown":case"keyup":A=N$;break;case"focusin":R="focus",A=_p;break;case"focusout":R="blur",A=_p;break;case"beforeblur":case"afterblur":A=_p;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":A=Fb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":A=w$;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":A=C$;break;case u5:case h5:case c5:A=M$;break;case d5:A=L$;break;case"scroll":A=y$;break;case"wheel":A=U$;break;case"copy":case"cut":case"paste":A=E$;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":A=zb}var B=(t&4)!==0,I=!B&&e==="scroll",E=B?_!==null?_+"Capture":null:_;B=[];for(var k=b,T;k!==null;){T=k;var L=T.stateNode;if(T.tag===5&&L!==null&&(T=L,E!==null&&(L=xu(k,E),L!=null&&B.push(Bu(k,L,T)))),I)break;k=k.return}0<B.length&&(_=new A(_,R,null,r,w),M.push({event:_,listeners:B}))}}if(!(t&7)){e:{if(_=e==="mouseover"||e==="pointerover",A=e==="mouseout"||e==="pointerout",_&&r!==rg&&(R=r.relatedTarget||r.fromElement)&&(aa(R)||R[po]))break e;if((A||_)&&(_=w.window===w?w:(_=w.ownerDocument)?_.defaultView||_.parentWindow:window,A?(R=r.relatedTarget||r.toElement,A=b,R=R?aa(R):null,R!==null&&(I=ja(R),R!==I||R.tag!==5&&R.tag!==6)&&(R=null)):(A=null,R=b),A!==R)){if(B=Fb,L="onMouseLeave",E="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(B=zb,L="onPointerLeave",E="onPointerEnter",k="pointer"),I=A==null?_:ff(A),T=R==null?_:ff(R),_=new B(L,k+"leave",A,r,w),_.target=I,_.relatedTarget=T,L=null,aa(w)===b&&(B=new B(E,k+"enter",R,r,w),B.target=T,B.relatedTarget=I,L=B),I=L,A&&R)t:{for(B=A,E=R,k=0,T=B;T;T=Va(T))k++;for(T=0,L=E;L;L=Va(L))T++;for(;0<k-T;)B=Va(B),k--;for(;0<T-k;)E=Va(E),T--;for(;k--;){if(B===E||E!==null&&B===E.alternate)break t;B=Va(B),E=Va(E)}B=null}else B=null;A!==null&&t3(M,_,A,B,!1),R!==null&&I!==null&&t3(M,I,R,B,!0)}}e:{if(_=b?ff(b):window,A=_.nodeName&&_.nodeName.toLowerCase(),A==="select"||A==="input"&&_.type==="file")var q=W$;else if(Kb(_))if(o5)q=G$;else{q=K$;var z=V$}else(A=_.nodeName)&&A.toLowerCase()==="input"&&(_.type==="checkbox"||_.type==="radio")&&(q=Z$);if(q&&(q=q(e,b))){i5(M,q,r,w);break e}z&&z(e,_,b),e==="focusout"&&(z=_._wrapperState)&&z.controlled&&_.type==="number"&&Yv(_,"number",_.value)}switch(z=b?ff(b):window,e){case"focusin":(Kb(z)||z.contentEditable==="true")&&(sf=z,lg=b,cu=null);break;case"focusout":cu=lg=sf=null;break;case"mousedown":ug=!0;break;case"contextmenu":case"mouseup":case"dragend":ug=!1,Xb(M,r,w);break;case"selectionchange":if(X$)break;case"keydown":case"keyup":Xb(M,r,w)}var J;if(ym)e:{switch(e){case"compositionstart":var F="onCompositionStart";break e;case"compositionend":F="onCompositionEnd";break e;case"compositionupdate":F="onCompositionUpdate";break e}F=void 0}else of?r5(e,r)&&(F="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(F="onCompositionStart");F&&(t5&&r.locale!=="ko"&&(of||F!=="onCompositionStart"?F==="onCompositionEnd"&&of&&(J=e5()):(ns=w,pm="value"in ns?ns.value:ns.textContent,of=!0)),z=Uc(b,F),0<z.length&&(F=new Hb(F,e,null,r,w),M.push({event:F,listeners:z}),J?F.data=J:(J=n5(r),J!==null&&(F.data=J)))),(J=D$?q$(e,r):F$(e,r))&&(b=Uc(b,"onBeforeInput"),0<b.length&&(w=new Hb("onBeforeInput","beforeinput",null,r,w),M.push({event:w,listeners:b}),w.data=J))}v5(M,t)})}function Bu(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Uc(e,t){for(var r=t+"Capture",n=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=xu(e,r),i!=null&&n.unshift(Bu(e,i,s)),i=xu(e,t),i!=null&&n.push(Bu(e,i,s))),e=e.return}return n}function Va(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function t3(e,t,r,n,s){for(var i=t._reactName,u=[];r!==null&&r!==n;){var d=r,c=d.alternate,b=d.stateNode;if(c!==null&&c===n)break;d.tag===5&&b!==null&&(d=b,s?(c=xu(r,i),c!=null&&u.unshift(Bu(r,c,d))):s||(c=xu(r,i),c!=null&&u.push(Bu(r,c,d)))),r=r.return}u.length!==0&&e.push({event:t,listeners:u})}var rN=/\r\n?/g,nN=/\u0000|\uFFFD/g;function r3(e){return(typeof e=="string"?e:""+e).replace(rN,`
38
- `).replace(nN,"")}function $h(e,t,r){if(t=r3(t),r3(e)!==t&&r)throw Error(Ce(425))}function jc(){}var hg=null,cg=null;function dg(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var pg=typeof setTimeout=="function"?setTimeout:void 0,iN=typeof clearTimeout=="function"?clearTimeout:void 0,n3=typeof Promise=="function"?Promise:void 0,oN=typeof queueMicrotask=="function"?queueMicrotask:typeof n3<"u"?function(e){return n3.resolve(null).then(e).catch(sN)}:pg;function sN(e){setTimeout(function(){throw e})}function Np(e,t){var r=t,n=0;do{var s=r.nextSibling;if(e.removeChild(r),s&&s.nodeType===8)if(r=s.data,r==="/$"){if(n===0){e.removeChild(s),Eu(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=s}while(r);Eu(t)}function cs(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function i3(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var cl=Math.random().toString(36).slice(2),gi="__reactFiber$"+cl,Ru="__reactProps$"+cl,po="__reactContainer$"+cl,vg="__reactEvents$"+cl,aN="__reactListeners$"+cl,fN="__reactHandles$"+cl;function aa(e){var t=e[gi];if(t)return t;for(var r=e.parentNode;r;){if(t=r[po]||r[gi]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=i3(e);e!==null;){if(r=e[gi])return r;e=i3(e)}return t}e=r,r=e.parentNode}return null}function Yu(e){return e=e[gi]||e[po],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ff(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Ce(33))}function L0(e){return e[Ru]||null}var gg=[],lf=-1;function Rs(e){return{current:e}}function Ct(e){0>lf||(e.current=gg[lf],gg[lf]=null,lf--)}function Nt(e,t){lf++,gg[lf]=e.current,e.current=t}var Ms={},qr=Rs(Ms),Yr=Rs(!1),Ma=Ms;function Lf(e,t){var r=e.type.contextTypes;if(!r)return Ms;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in r)s[i]=t[i];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Xr(e){return e=e.childContextTypes,e!=null}function Dc(){Ct(Yr),Ct(qr)}function o3(e,t,r){if(qr.current!==Ms)throw Error(Ce(168));Nt(qr,t),Nt(Yr,r)}function y5(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var s in n)if(!(s in t))throw Error(Ce(108,VR(e)||"Unknown",s));return Ht({},r,n)}function qc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ms,Ma=qr.current,Nt(qr,e),Nt(Yr,Yr.current),!0}function s3(e,t,r){var n=e.stateNode;if(!n)throw Error(Ce(169));r?(e=y5(e,t,Ma),n.__reactInternalMemoizedMergedChildContext=e,Ct(Yr),Ct(qr),Nt(qr,e)):Ct(Yr),Nt(Yr,r)}var Zi=null,O0=!1,Tp=!1;function m5(e){Zi===null?Zi=[e]:Zi.push(e)}function lN(e){O0=!0,m5(e)}function $s(){if(!Tp&&Zi!==null){Tp=!0;var e=0,t=ct;try{var r=Zi;for(ct=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}Zi=null,O0=!1}catch(s){throw Zi!==null&&(Zi=Zi.slice(e+1)),H8(um,$s),s}finally{ct=t,Tp=!1}}return null}var uf=[],hf=0,Fc=null,Hc=0,Sn=[],An=0,_a=null,ro=1,no="";function Gs(e,t){uf[hf++]=Hc,uf[hf++]=Fc,Fc=e,Hc=t}function w5(e,t,r){Sn[An++]=ro,Sn[An++]=no,Sn[An++]=_a,_a=e;var n=ro;e=no;var s=32-Kn(n)-1;n&=~(1<<s),r+=1;var i=32-Kn(t)+s;if(30<i){var u=s-s%5;i=(n&(1<<u)-1).toString(32),n>>=u,s-=u,ro=1<<32-Kn(t)+s|r<<s|n,no=i+e}else ro=1<<i|r<<s|n,no=e}function wm(e){e.return!==null&&(Gs(e,1),w5(e,1,0))}function bm(e){for(;e===Fc;)Fc=uf[--hf],uf[hf]=null,Hc=uf[--hf],uf[hf]=null;for(;e===_a;)_a=Sn[--An],Sn[An]=null,no=Sn[--An],Sn[An]=null,ro=Sn[--An],Sn[An]=null}var un=null,fn=null,jt=!1,Wn=null;function b5(e,t){var r=kn(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function a3(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,un=e,fn=cs(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,un=e,fn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=_a!==null?{id:ro,overflow:no}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=kn(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,un=e,fn=null,!0):!1;default:return!1}}function yg(e){return(e.mode&1)!==0&&(e.flags&128)===0}function mg(e){if(jt){var t=fn;if(t){var r=t;if(!a3(e,t)){if(yg(e))throw Error(Ce(418));t=cs(r.nextSibling);var n=un;t&&a3(e,t)?b5(n,r):(e.flags=e.flags&-4097|2,jt=!1,un=e)}}else{if(yg(e))throw Error(Ce(418));e.flags=e.flags&-4097|2,jt=!1,un=e}}}function f3(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;un=e}function Nh(e){if(e!==un)return!1;if(!jt)return f3(e),jt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!dg(e.type,e.memoizedProps)),t&&(t=fn)){if(yg(e))throw x5(),Error(Ce(418));for(;t;)b5(e,t),t=cs(t.nextSibling)}if(f3(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Ce(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){fn=cs(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}fn=null}}else fn=un?cs(e.stateNode.nextSibling):null;return!0}function x5(){for(var e=fn;e;)e=cs(e.nextSibling)}function Of(){fn=un=null,jt=!1}function xm(e){Wn===null?Wn=[e]:Wn.push(e)}var uN=So.ReactCurrentBatchConfig;function Ol(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(Ce(309));var n=r.stateNode}if(!n)throw Error(Ce(147,e));var s=n,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(u){var d=s.refs;u===null?delete d[i]:d[i]=u},t._stringRef=i,t)}if(typeof e!="string")throw Error(Ce(284));if(!r._owner)throw Error(Ce(290,e))}return e}function Th(e,t){throw e=Object.prototype.toString.call(t),Error(Ce(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function l3(e){var t=e._init;return t(e._payload)}function M5(e){function t(E,k){if(e){var T=E.deletions;T===null?(E.deletions=[k],E.flags|=16):T.push(k)}}function r(E,k){if(!e)return null;for(;k!==null;)t(E,k),k=k.sibling;return null}function n(E,k){for(E=new Map;k!==null;)k.key!==null?E.set(k.key,k):E.set(k.index,k),k=k.sibling;return E}function s(E,k){return E=gs(E,k),E.index=0,E.sibling=null,E}function i(E,k,T){return E.index=T,e?(T=E.alternate,T!==null?(T=T.index,T<k?(E.flags|=2,k):T):(E.flags|=2,k)):(E.flags|=1048576,k)}function u(E){return e&&E.alternate===null&&(E.flags|=2),E}function d(E,k,T,L){return k===null||k.tag!==6?(k=jp(T,E.mode,L),k.return=E,k):(k=s(k,T),k.return=E,k)}function c(E,k,T,L){var q=T.type;return q===nf?w(E,k,T.props.children,L,T.key):k!==null&&(k.elementType===q||typeof q=="object"&&q!==null&&q.$$typeof===Xo&&l3(q)===k.type)?(L=s(k,T.props),L.ref=Ol(E,k,T),L.return=E,L):(L=dc(T.type,T.key,T.props,null,E.mode,L),L.ref=Ol(E,k,T),L.return=E,L)}function b(E,k,T,L){return k===null||k.tag!==4||k.stateNode.containerInfo!==T.containerInfo||k.stateNode.implementation!==T.implementation?(k=Dp(T,E.mode,L),k.return=E,k):(k=s(k,T.children||[]),k.return=E,k)}function w(E,k,T,L,q){return k===null||k.tag!==7?(k=ya(T,E.mode,L,q),k.return=E,k):(k=s(k,T),k.return=E,k)}function M(E,k,T){if(typeof k=="string"&&k!==""||typeof k=="number")return k=jp(""+k,E.mode,T),k.return=E,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case xh:return T=dc(k.type,k.key,k.props,null,E.mode,T),T.ref=Ol(E,null,k),T.return=E,T;case rf:return k=Dp(k,E.mode,T),k.return=E,k;case Xo:var L=k._init;return M(E,L(k._payload),T)}if(ru(k)||Tl(k))return k=ya(k,E.mode,T,null),k.return=E,k;Th(E,k)}return null}function _(E,k,T,L){var q=k!==null?k.key:null;if(typeof T=="string"&&T!==""||typeof T=="number")return q!==null?null:d(E,k,""+T,L);if(typeof T=="object"&&T!==null){switch(T.$$typeof){case xh:return T.key===q?c(E,k,T,L):null;case rf:return T.key===q?b(E,k,T,L):null;case Xo:return q=T._init,_(E,k,q(T._payload),L)}if(ru(T)||Tl(T))return q!==null?null:w(E,k,T,L,null);Th(E,T)}return null}function A(E,k,T,L,q){if(typeof L=="string"&&L!==""||typeof L=="number")return E=E.get(T)||null,d(k,E,""+L,q);if(typeof L=="object"&&L!==null){switch(L.$$typeof){case xh:return E=E.get(L.key===null?T:L.key)||null,c(k,E,L,q);case rf:return E=E.get(L.key===null?T:L.key)||null,b(k,E,L,q);case Xo:var z=L._init;return A(E,k,T,z(L._payload),q)}if(ru(L)||Tl(L))return E=E.get(T)||null,w(k,E,L,q,null);Th(k,L)}return null}function R(E,k,T,L){for(var q=null,z=null,J=k,F=k=0,X=null;J!==null&&F<T.length;F++){J.index>F?(X=J,J=null):X=J.sibling;var ee=_(E,J,T[F],L);if(ee===null){J===null&&(J=X);break}e&&J&&ee.alternate===null&&t(E,J),k=i(ee,k,F),z===null?q=ee:z.sibling=ee,z=ee,J=X}if(F===T.length)return r(E,J),jt&&Gs(E,F),q;if(J===null){for(;F<T.length;F++)J=M(E,T[F],L),J!==null&&(k=i(J,k,F),z===null?q=J:z.sibling=J,z=J);return jt&&Gs(E,F),q}for(J=n(E,J);F<T.length;F++)X=A(J,E,F,T[F],L),X!==null&&(e&&X.alternate!==null&&J.delete(X.key===null?F:X.key),k=i(X,k,F),z===null?q=X:z.sibling=X,z=X);return e&&J.forEach(function(x){return t(E,x)}),jt&&Gs(E,F),q}function B(E,k,T,L){var q=Tl(T);if(typeof q!="function")throw Error(Ce(150));if(T=q.call(T),T==null)throw Error(Ce(151));for(var z=q=null,J=k,F=k=0,X=null,ee=T.next();J!==null&&!ee.done;F++,ee=T.next()){J.index>F?(X=J,J=null):X=J.sibling;var x=_(E,J,ee.value,L);if(x===null){J===null&&(J=X);break}e&&J&&x.alternate===null&&t(E,J),k=i(x,k,F),z===null?q=x:z.sibling=x,z=x,J=X}if(ee.done)return r(E,J),jt&&Gs(E,F),q;if(J===null){for(;!ee.done;F++,ee=T.next())ee=M(E,ee.value,L),ee!==null&&(k=i(ee,k,F),z===null?q=ee:z.sibling=ee,z=ee);return jt&&Gs(E,F),q}for(J=n(E,J);!ee.done;F++,ee=T.next())ee=A(J,E,F,ee.value,L),ee!==null&&(e&&ee.alternate!==null&&J.delete(ee.key===null?F:ee.key),k=i(ee,k,F),z===null?q=ee:z.sibling=ee,z=ee);return e&&J.forEach(function(o){return t(E,o)}),jt&&Gs(E,F),q}function I(E,k,T,L){if(typeof T=="object"&&T!==null&&T.type===nf&&T.key===null&&(T=T.props.children),typeof T=="object"&&T!==null){switch(T.$$typeof){case xh:e:{for(var q=T.key,z=k;z!==null;){if(z.key===q){if(q=T.type,q===nf){if(z.tag===7){r(E,z.sibling),k=s(z,T.props.children),k.return=E,E=k;break e}}else if(z.elementType===q||typeof q=="object"&&q!==null&&q.$$typeof===Xo&&l3(q)===z.type){r(E,z.sibling),k=s(z,T.props),k.ref=Ol(E,z,T),k.return=E,E=k;break e}r(E,z);break}else t(E,z);z=z.sibling}T.type===nf?(k=ya(T.props.children,E.mode,L,T.key),k.return=E,E=k):(L=dc(T.type,T.key,T.props,null,E.mode,L),L.ref=Ol(E,k,T),L.return=E,E=L)}return u(E);case rf:e:{for(z=T.key;k!==null;){if(k.key===z)if(k.tag===4&&k.stateNode.containerInfo===T.containerInfo&&k.stateNode.implementation===T.implementation){r(E,k.sibling),k=s(k,T.children||[]),k.return=E,E=k;break e}else{r(E,k);break}else t(E,k);k=k.sibling}k=Dp(T,E.mode,L),k.return=E,E=k}return u(E);case Xo:return z=T._init,I(E,k,z(T._payload),L)}if(ru(T))return R(E,k,T,L);if(Tl(T))return B(E,k,T,L);Th(E,T)}return typeof T=="string"&&T!==""||typeof T=="number"?(T=""+T,k!==null&&k.tag===6?(r(E,k.sibling),k=s(k,T),k.return=E,E=k):(r(E,k),k=jp(T,E.mode,L),k.return=E,E=k),u(E)):r(E,k)}return I}var Uf=M5(!0),_5=M5(!1),zc=Rs(null),Wc=null,cf=null,Mm=null;function _m(){Mm=cf=Wc=null}function Em(e){var t=zc.current;Ct(zc),e._currentValue=t}function wg(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function Sf(e,t){Wc=e,Mm=cf=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Jr=!0),e.firstContext=null)}function $n(e){var t=e._currentValue;if(Mm!==e)if(e={context:e,memoizedValue:t,next:null},cf===null){if(Wc===null)throw Error(Ce(308));cf=e,Wc.dependencies={lanes:0,firstContext:e}}else cf=cf.next=e;return t}var fa=null;function Sm(e){fa===null?fa=[e]:fa.push(e)}function E5(e,t,r,n){var s=t.interleaved;return s===null?(r.next=r,Sm(t)):(r.next=s.next,s.next=r),t.interleaved=r,vo(e,n)}function vo(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var Qo=!1;function Am(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function S5(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function lo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ds(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,st&2){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,vo(e,r)}return s=n.interleaved,s===null?(t.next=t,Sm(n)):(t.next=s.next,s.next=t),n.interleaved=t,vo(e,r)}function ac(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,hm(e,r)}}function u3(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var s=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var u={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?s=i=u:i=i.next=u,r=r.next}while(r!==null);i===null?s=i=t:i=i.next=t}else s=i=t;r={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function Vc(e,t,r,n){var s=e.updateQueue;Qo=!1;var i=s.firstBaseUpdate,u=s.lastBaseUpdate,d=s.shared.pending;if(d!==null){s.shared.pending=null;var c=d,b=c.next;c.next=null,u===null?i=b:u.next=b,u=c;var w=e.alternate;w!==null&&(w=w.updateQueue,d=w.lastBaseUpdate,d!==u&&(d===null?w.firstBaseUpdate=b:d.next=b,w.lastBaseUpdate=c))}if(i!==null){var M=s.baseState;u=0,w=b=c=null,d=i;do{var _=d.lane,A=d.eventTime;if((n&_)===_){w!==null&&(w=w.next={eventTime:A,lane:0,tag:d.tag,payload:d.payload,callback:d.callback,next:null});e:{var R=e,B=d;switch(_=t,A=r,B.tag){case 1:if(R=B.payload,typeof R=="function"){M=R.call(A,M,_);break e}M=R;break e;case 3:R.flags=R.flags&-65537|128;case 0:if(R=B.payload,_=typeof R=="function"?R.call(A,M,_):R,_==null)break e;M=Ht({},M,_);break e;case 2:Qo=!0}}d.callback!==null&&d.lane!==0&&(e.flags|=64,_=s.effects,_===null?s.effects=[d]:_.push(d))}else A={eventTime:A,lane:_,tag:d.tag,payload:d.payload,callback:d.callback,next:null},w===null?(b=w=A,c=M):w=w.next=A,u|=_;if(d=d.next,d===null){if(d=s.shared.pending,d===null)break;_=d,d=_.next,_.next=null,s.lastBaseUpdate=_,s.shared.pending=null}}while(!0);if(w===null&&(c=M),s.baseState=c,s.firstBaseUpdate=b,s.lastBaseUpdate=w,t=s.shared.interleaved,t!==null){s=t;do u|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Sa|=u,e.lanes=u,e.memoizedState=M}}function h3(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],s=n.callback;if(s!==null){if(n.callback=null,n=r,typeof s!="function")throw Error(Ce(191,s));s.call(n)}}}var Xu={},Bi=Rs(Xu),$u=Rs(Xu),Nu=Rs(Xu);function la(e){if(e===Xu)throw Error(Ce(174));return e}function km(e,t){switch(Nt(Nu,t),Nt($u,e),Nt(Bi,Xu),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Qv(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Qv(t,e)}Ct(Bi),Nt(Bi,t)}function jf(){Ct(Bi),Ct($u),Ct(Nu)}function A5(e){la(Nu.current);var t=la(Bi.current),r=Qv(t,e.type);t!==r&&(Nt($u,e),Nt(Bi,r))}function Bm(e){$u.current===e&&(Ct(Bi),Ct($u))}var qt=Rs(0);function Kc(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ip=[];function Rm(){for(var e=0;e<Ip.length;e++)Ip[e]._workInProgressVersionPrimary=null;Ip.length=0}var fc=So.ReactCurrentDispatcher,Cp=So.ReactCurrentBatchConfig,Ea=0,Ft=null,ir=null,lr=null,Zc=!1,du=!1,Tu=0,hN=0;function Ar(){throw Error(Ce(321))}function $m(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Gn(e[r],t[r]))return!1;return!0}function Nm(e,t,r,n,s,i){if(Ea=i,Ft=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,fc.current=e===null||e.memoizedState===null?vN:gN,e=r(n,s),du){i=0;do{if(du=!1,Tu=0,25<=i)throw Error(Ce(301));i+=1,lr=ir=null,t.updateQueue=null,fc.current=yN,e=r(n,s)}while(du)}if(fc.current=Gc,t=ir!==null&&ir.next!==null,Ea=0,lr=ir=Ft=null,Zc=!1,t)throw Error(Ce(300));return e}function Tm(){var e=Tu!==0;return Tu=0,e}function ci(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return lr===null?Ft.memoizedState=lr=e:lr=lr.next=e,lr}function Nn(){if(ir===null){var e=Ft.alternate;e=e!==null?e.memoizedState:null}else e=ir.next;var t=lr===null?Ft.memoizedState:lr.next;if(t!==null)lr=t,ir=e;else{if(e===null)throw Error(Ce(310));ir=e,e={memoizedState:ir.memoizedState,baseState:ir.baseState,baseQueue:ir.baseQueue,queue:ir.queue,next:null},lr===null?Ft.memoizedState=lr=e:lr=lr.next=e}return lr}function Iu(e,t){return typeof t=="function"?t(e):t}function Pp(e){var t=Nn(),r=t.queue;if(r===null)throw Error(Ce(311));r.lastRenderedReducer=e;var n=ir,s=n.baseQueue,i=r.pending;if(i!==null){if(s!==null){var u=s.next;s.next=i.next,i.next=u}n.baseQueue=s=i,r.pending=null}if(s!==null){i=s.next,n=n.baseState;var d=u=null,c=null,b=i;do{var w=b.lane;if((Ea&w)===w)c!==null&&(c=c.next={lane:0,action:b.action,hasEagerState:b.hasEagerState,eagerState:b.eagerState,next:null}),n=b.hasEagerState?b.eagerState:e(n,b.action);else{var M={lane:w,action:b.action,hasEagerState:b.hasEagerState,eagerState:b.eagerState,next:null};c===null?(d=c=M,u=n):c=c.next=M,Ft.lanes|=w,Sa|=w}b=b.next}while(b!==null&&b!==i);c===null?u=n:c.next=d,Gn(n,t.memoizedState)||(Jr=!0),t.memoizedState=n,t.baseState=u,t.baseQueue=c,r.lastRenderedState=n}if(e=r.interleaved,e!==null){s=e;do i=s.lane,Ft.lanes|=i,Sa|=i,s=s.next;while(s!==e)}else s===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function Lp(e){var t=Nn(),r=t.queue;if(r===null)throw Error(Ce(311));r.lastRenderedReducer=e;var n=r.dispatch,s=r.pending,i=t.memoizedState;if(s!==null){r.pending=null;var u=s=s.next;do i=e(i,u.action),u=u.next;while(u!==s);Gn(i,t.memoizedState)||(Jr=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),r.lastRenderedState=i}return[i,n]}function k5(){}function B5(e,t){var r=Ft,n=Nn(),s=t(),i=!Gn(n.memoizedState,s);if(i&&(n.memoizedState=s,Jr=!0),n=n.queue,Im(N5.bind(null,r,n,e),[e]),n.getSnapshot!==t||i||lr!==null&&lr.memoizedState.tag&1){if(r.flags|=2048,Cu(9,$5.bind(null,r,n,s,t),void 0,null),pr===null)throw Error(Ce(349));Ea&30||R5(r,t,s)}return s}function R5(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=Ft.updateQueue,t===null?(t={lastEffect:null,stores:null},Ft.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function $5(e,t,r,n){t.value=r,t.getSnapshot=n,T5(t)&&I5(e)}function N5(e,t,r){return r(function(){T5(t)&&I5(e)})}function T5(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Gn(e,r)}catch{return!0}}function I5(e){var t=vo(e,1);t!==null&&Zn(t,e,1,-1)}function c3(e){var t=ci();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Iu,lastRenderedState:e},t.queue=e,e=e.dispatch=pN.bind(null,Ft,e),[t.memoizedState,e]}function Cu(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=Ft.updateQueue,t===null?(t={lastEffect:null,stores:null},Ft.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e)),e}function C5(){return Nn().memoizedState}function lc(e,t,r,n){var s=ci();Ft.flags|=e,s.memoizedState=Cu(1|t,r,void 0,n===void 0?null:n)}function U0(e,t,r,n){var s=Nn();n=n===void 0?null:n;var i=void 0;if(ir!==null){var u=ir.memoizedState;if(i=u.destroy,n!==null&&$m(n,u.deps)){s.memoizedState=Cu(t,r,i,n);return}}Ft.flags|=e,s.memoizedState=Cu(1|t,r,i,n)}function d3(e,t){return lc(8390656,8,e,t)}function Im(e,t){return U0(2048,8,e,t)}function P5(e,t){return U0(4,2,e,t)}function L5(e,t){return U0(4,4,e,t)}function O5(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function U5(e,t,r){return r=r!=null?r.concat([e]):null,U0(4,4,O5.bind(null,t,e),r)}function Cm(){}function j5(e,t){var r=Nn();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&$m(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function D5(e,t){var r=Nn();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&$m(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function q5(e,t,r){return Ea&21?(Gn(r,t)||(r=V8(),Ft.lanes|=r,Sa|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Jr=!0),e.memoizedState=r)}function cN(e,t){var r=ct;ct=r!==0&&4>r?r:4,e(!0);var n=Cp.transition;Cp.transition={};try{e(!1),t()}finally{ct=r,Cp.transition=n}}function F5(){return Nn().memoizedState}function dN(e,t,r){var n=vs(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},H5(e))z5(t,r);else if(r=E5(e,t,r,n),r!==null){var s=zr();Zn(r,e,n,s),W5(r,t,n)}}function pN(e,t,r){var n=vs(e),s={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(H5(e))z5(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var u=t.lastRenderedState,d=i(u,r);if(s.hasEagerState=!0,s.eagerState=d,Gn(d,u)){var c=t.interleaved;c===null?(s.next=s,Sm(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}r=E5(e,t,s,n),r!==null&&(s=zr(),Zn(r,e,n,s),W5(r,t,n))}}function H5(e){var t=e.alternate;return e===Ft||t!==null&&t===Ft}function z5(e,t){du=Zc=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function W5(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,hm(e,r)}}var Gc={readContext:$n,useCallback:Ar,useContext:Ar,useEffect:Ar,useImperativeHandle:Ar,useInsertionEffect:Ar,useLayoutEffect:Ar,useMemo:Ar,useReducer:Ar,useRef:Ar,useState:Ar,useDebugValue:Ar,useDeferredValue:Ar,useTransition:Ar,useMutableSource:Ar,useSyncExternalStore:Ar,useId:Ar,unstable_isNewReconciler:!1},vN={readContext:$n,useCallback:function(e,t){return ci().memoizedState=[e,t===void 0?null:t],e},useContext:$n,useEffect:d3,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,lc(4194308,4,O5.bind(null,t,e),r)},useLayoutEffect:function(e,t){return lc(4194308,4,e,t)},useInsertionEffect:function(e,t){return lc(4,2,e,t)},useMemo:function(e,t){var r=ci();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=ci();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=dN.bind(null,Ft,e),[n.memoizedState,e]},useRef:function(e){var t=ci();return e={current:e},t.memoizedState=e},useState:c3,useDebugValue:Cm,useDeferredValue:function(e){return ci().memoizedState=e},useTransition:function(){var e=c3(!1),t=e[0];return e=cN.bind(null,e[1]),ci().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=Ft,s=ci();if(jt){if(r===void 0)throw Error(Ce(407));r=r()}else{if(r=t(),pr===null)throw Error(Ce(349));Ea&30||R5(n,t,r)}s.memoizedState=r;var i={value:r,getSnapshot:t};return s.queue=i,d3(N5.bind(null,n,i,e),[e]),n.flags|=2048,Cu(9,$5.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=ci(),t=pr.identifierPrefix;if(jt){var r=no,n=ro;r=(n&~(1<<32-Kn(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=Tu++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=hN++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},gN={readContext:$n,useCallback:j5,useContext:$n,useEffect:Im,useImperativeHandle:U5,useInsertionEffect:P5,useLayoutEffect:L5,useMemo:D5,useReducer:Pp,useRef:C5,useState:function(){return Pp(Iu)},useDebugValue:Cm,useDeferredValue:function(e){var t=Nn();return q5(t,ir.memoizedState,e)},useTransition:function(){var e=Pp(Iu)[0],t=Nn().memoizedState;return[e,t]},useMutableSource:k5,useSyncExternalStore:B5,useId:F5,unstable_isNewReconciler:!1},yN={readContext:$n,useCallback:j5,useContext:$n,useEffect:Im,useImperativeHandle:U5,useInsertionEffect:P5,useLayoutEffect:L5,useMemo:D5,useReducer:Lp,useRef:C5,useState:function(){return Lp(Iu)},useDebugValue:Cm,useDeferredValue:function(e){var t=Nn();return ir===null?t.memoizedState=e:q5(t,ir.memoizedState,e)},useTransition:function(){var e=Lp(Iu)[0],t=Nn().memoizedState;return[e,t]},useMutableSource:k5,useSyncExternalStore:B5,useId:F5,unstable_isNewReconciler:!1};function Hn(e,t){if(e&&e.defaultProps){t=Ht({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function bg(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:Ht({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var j0={isMounted:function(e){return(e=e._reactInternals)?ja(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=zr(),s=vs(e),i=lo(n,s);i.payload=t,r!=null&&(i.callback=r),t=ds(e,i,s),t!==null&&(Zn(t,e,s,n),ac(t,e,s))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=zr(),s=vs(e),i=lo(n,s);i.tag=1,i.payload=t,r!=null&&(i.callback=r),t=ds(e,i,s),t!==null&&(Zn(t,e,s,n),ac(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=zr(),n=vs(e),s=lo(r,n);s.tag=2,t!=null&&(s.callback=t),t=ds(e,s,n),t!==null&&(Zn(t,e,n,r),ac(t,e,n))}};function p3(e,t,r,n,s,i,u){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,i,u):t.prototype&&t.prototype.isPureReactComponent?!Au(r,n)||!Au(s,i):!0}function V5(e,t,r){var n=!1,s=Ms,i=t.contextType;return typeof i=="object"&&i!==null?i=$n(i):(s=Xr(t)?Ma:qr.current,n=t.contextTypes,i=(n=n!=null)?Lf(e,s):Ms),t=new t(r,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=j0,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function v3(e,t,r,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&j0.enqueueReplaceState(t,t.state,null)}function xg(e,t,r,n){var s=e.stateNode;s.props=r,s.state=e.memoizedState,s.refs={},Am(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=$n(i):(i=Xr(t)?Ma:qr.current,s.context=Lf(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(bg(e,t,i,r),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&j0.enqueueReplaceState(s,s.state,null),Vc(e,r,s,n),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Df(e,t){try{var r="",n=t;do r+=WR(n),n=n.return;while(n);var s=r}catch(i){s=`
39
- Error generating stack: `+i.message+`
40
- `+i.stack}return{value:e,source:t,stack:s,digest:null}}function Op(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function Mg(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var mN=typeof WeakMap=="function"?WeakMap:Map;function K5(e,t,r){r=lo(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){Yc||(Yc=!0,Tg=n),Mg(e,t)},r}function Z5(e,t,r){r=lo(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var s=t.value;r.payload=function(){return n(s)},r.callback=function(){Mg(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){Mg(e,t),typeof n!="function"&&(ps===null?ps=new Set([this]):ps.add(this));var u=t.stack;this.componentDidCatch(t.value,{componentStack:u!==null?u:""})}),r}function g3(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new mN;var s=new Set;n.set(t,s)}else s=n.get(t),s===void 0&&(s=new Set,n.set(t,s));s.has(r)||(s.add(r),e=TN.bind(null,e,t,r),t.then(e,e))}function y3(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function m3(e,t,r,n,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=lo(-1,1),t.tag=2,ds(r,t,1))),r.lanes|=1),e)}var wN=So.ReactCurrentOwner,Jr=!1;function Fr(e,t,r,n){t.child=e===null?_5(t,null,r,n):Uf(t,e.child,r,n)}function w3(e,t,r,n,s){r=r.render;var i=t.ref;return Sf(t,s),n=Nm(e,t,r,n,i,s),r=Tm(),e!==null&&!Jr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,go(e,t,s)):(jt&&r&&wm(t),t.flags|=1,Fr(e,t,n,s),t.child)}function b3(e,t,r,n,s){if(e===null){var i=r.type;return typeof i=="function"&&!Fm(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=i,G5(e,t,i,n,s)):(e=dc(r.type,null,n,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var u=i.memoizedProps;if(r=r.compare,r=r!==null?r:Au,r(u,n)&&e.ref===t.ref)return go(e,t,s)}return t.flags|=1,e=gs(i,n),e.ref=t.ref,e.return=t,t.child=e}function G5(e,t,r,n,s){if(e!==null){var i=e.memoizedProps;if(Au(i,n)&&e.ref===t.ref)if(Jr=!1,t.pendingProps=n=i,(e.lanes&s)!==0)e.flags&131072&&(Jr=!0);else return t.lanes=e.lanes,go(e,t,s)}return _g(e,t,r,n,s)}function J5(e,t,r){var n=t.pendingProps,s=n.children,i=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Nt(pf,sn),sn|=r;else{if(!(r&1073741824))return e=i!==null?i.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Nt(pf,sn),sn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,Nt(pf,sn),sn|=n}else i!==null?(n=i.baseLanes|r,t.memoizedState=null):n=r,Nt(pf,sn),sn|=n;return Fr(e,t,s,r),t.child}function Y5(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function _g(e,t,r,n,s){var i=Xr(r)?Ma:qr.current;return i=Lf(t,i),Sf(t,s),r=Nm(e,t,r,n,i,s),n=Tm(),e!==null&&!Jr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,go(e,t,s)):(jt&&n&&wm(t),t.flags|=1,Fr(e,t,r,s),t.child)}function x3(e,t,r,n,s){if(Xr(r)){var i=!0;qc(t)}else i=!1;if(Sf(t,s),t.stateNode===null)uc(e,t),V5(t,r,n),xg(t,r,n,s),n=!0;else if(e===null){var u=t.stateNode,d=t.memoizedProps;u.props=d;var c=u.context,b=r.contextType;typeof b=="object"&&b!==null?b=$n(b):(b=Xr(r)?Ma:qr.current,b=Lf(t,b));var w=r.getDerivedStateFromProps,M=typeof w=="function"||typeof u.getSnapshotBeforeUpdate=="function";M||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(d!==n||c!==b)&&v3(t,u,n,b),Qo=!1;var _=t.memoizedState;u.state=_,Vc(t,n,u,s),c=t.memoizedState,d!==n||_!==c||Yr.current||Qo?(typeof w=="function"&&(bg(t,r,w,n),c=t.memoizedState),(d=Qo||p3(t,r,d,n,_,c,b))?(M||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=c),u.props=n,u.state=c,u.context=b,n=d):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{u=t.stateNode,S5(e,t),d=t.memoizedProps,b=t.type===t.elementType?d:Hn(t.type,d),u.props=b,M=t.pendingProps,_=u.context,c=r.contextType,typeof c=="object"&&c!==null?c=$n(c):(c=Xr(r)?Ma:qr.current,c=Lf(t,c));var A=r.getDerivedStateFromProps;(w=typeof A=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(d!==M||_!==c)&&v3(t,u,n,c),Qo=!1,_=t.memoizedState,u.state=_,Vc(t,n,u,s);var R=t.memoizedState;d!==M||_!==R||Yr.current||Qo?(typeof A=="function"&&(bg(t,r,A,n),R=t.memoizedState),(b=Qo||p3(t,r,b,n,_,R,c)||!1)?(w||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(n,R,c),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(n,R,c)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||d===e.memoizedProps&&_===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&_===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=R),u.props=n,u.state=R,u.context=c,n=b):(typeof u.componentDidUpdate!="function"||d===e.memoizedProps&&_===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&_===e.memoizedState||(t.flags|=1024),n=!1)}return Eg(e,t,r,n,i,s)}function Eg(e,t,r,n,s,i){Y5(e,t);var u=(t.flags&128)!==0;if(!n&&!u)return s&&s3(t,r,!1),go(e,t,i);n=t.stateNode,wN.current=t;var d=u&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&u?(t.child=Uf(t,e.child,null,i),t.child=Uf(t,null,d,i)):Fr(e,t,d,i),t.memoizedState=n.state,s&&s3(t,r,!0),t.child}function X5(e){var t=e.stateNode;t.pendingContext?o3(e,t.pendingContext,t.pendingContext!==t.context):t.context&&o3(e,t.context,!1),km(e,t.containerInfo)}function M3(e,t,r,n,s){return Of(),xm(s),t.flags|=256,Fr(e,t,r,n),t.child}var Sg={dehydrated:null,treeContext:null,retryLane:0};function Ag(e){return{baseLanes:e,cachePool:null,transitions:null}}function Q5(e,t,r){var n=t.pendingProps,s=qt.current,i=!1,u=(t.flags&128)!==0,d;if((d=u)||(d=e!==null&&e.memoizedState===null?!1:(s&2)!==0),d?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),Nt(qt,s&1),e===null)return mg(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(u=n.children,e=n.fallback,i?(n=t.mode,i=t.child,u={mode:"hidden",children:u},!(n&1)&&i!==null?(i.childLanes=0,i.pendingProps=u):i=F0(u,n,0,null),e=ya(e,n,r,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Ag(r),t.memoizedState=Sg,e):Pm(t,u));if(s=e.memoizedState,s!==null&&(d=s.dehydrated,d!==null))return bN(e,t,u,n,d,s,r);if(i){i=n.fallback,u=t.mode,s=e.child,d=s.sibling;var c={mode:"hidden",children:n.children};return!(u&1)&&t.child!==s?(n=t.child,n.childLanes=0,n.pendingProps=c,t.deletions=null):(n=gs(s,c),n.subtreeFlags=s.subtreeFlags&14680064),d!==null?i=gs(d,i):(i=ya(i,u,r,null),i.flags|=2),i.return=t,n.return=t,n.sibling=i,t.child=n,n=i,i=t.child,u=e.child.memoizedState,u=u===null?Ag(r):{baseLanes:u.baseLanes|r,cachePool:null,transitions:u.transitions},i.memoizedState=u,i.childLanes=e.childLanes&~r,t.memoizedState=Sg,n}return i=e.child,e=i.sibling,n=gs(i,{mode:"visible",children:n.children}),!(t.mode&1)&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function Pm(e,t){return t=F0({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Ih(e,t,r,n){return n!==null&&xm(n),Uf(t,e.child,null,r),e=Pm(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function bN(e,t,r,n,s,i,u){if(r)return t.flags&256?(t.flags&=-257,n=Op(Error(Ce(422))),Ih(e,t,u,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=n.fallback,s=t.mode,n=F0({mode:"visible",children:n.children},s,0,null),i=ya(i,s,u,null),i.flags|=2,n.return=t,i.return=t,n.sibling=i,t.child=n,t.mode&1&&Uf(t,e.child,null,u),t.child.memoizedState=Ag(u),t.memoizedState=Sg,i);if(!(t.mode&1))return Ih(e,t,u,null);if(s.data==="$!"){if(n=s.nextSibling&&s.nextSibling.dataset,n)var d=n.dgst;return n=d,i=Error(Ce(419)),n=Op(i,n,void 0),Ih(e,t,u,n)}if(d=(u&e.childLanes)!==0,Jr||d){if(n=pr,n!==null){switch(u&-u){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(n.suspendedLanes|u)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,vo(e,s),Zn(n,e,s,-1))}return qm(),n=Op(Error(Ce(421))),Ih(e,t,u,n)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=IN.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,fn=cs(s.nextSibling),un=t,jt=!0,Wn=null,e!==null&&(Sn[An++]=ro,Sn[An++]=no,Sn[An++]=_a,ro=e.id,no=e.overflow,_a=t),t=Pm(t,n.children),t.flags|=4096,t)}function _3(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),wg(e.return,t,r)}function Up(e,t,r,n,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=n,i.tail=r,i.tailMode=s)}function eM(e,t,r){var n=t.pendingProps,s=n.revealOrder,i=n.tail;if(Fr(e,t,n.children,r),n=qt.current,n&2)n=n&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&_3(e,r,t);else if(e.tag===19)_3(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(Nt(qt,n),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(r=t.child,s=null;r!==null;)e=r.alternate,e!==null&&Kc(e)===null&&(s=r),r=r.sibling;r=s,r===null?(s=t.child,t.child=null):(s=r.sibling,r.sibling=null),Up(t,!1,s,r,i);break;case"backwards":for(r=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&Kc(e)===null){t.child=s;break}e=s.sibling,s.sibling=r,r=s,s=e}Up(t,!0,r,null,i);break;case"together":Up(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function uc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function go(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),Sa|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Ce(153));if(t.child!==null){for(e=t.child,r=gs(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=gs(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function xN(e,t,r){switch(t.tag){case 3:X5(t),Of();break;case 5:A5(t);break;case 1:Xr(t.type)&&qc(t);break;case 4:km(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,s=t.memoizedProps.value;Nt(zc,n._currentValue),n._currentValue=s;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(Nt(qt,qt.current&1),t.flags|=128,null):r&t.child.childLanes?Q5(e,t,r):(Nt(qt,qt.current&1),e=go(e,t,r),e!==null?e.sibling:null);Nt(qt,qt.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return eM(e,t,r);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Nt(qt,qt.current),n)break;return null;case 22:case 23:return t.lanes=0,J5(e,t,r)}return go(e,t,r)}var tM,kg,rM,nM;tM=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};kg=function(){};rM=function(e,t,r,n){var s=e.memoizedProps;if(s!==n){e=t.stateNode,la(Bi.current);var i=null;switch(r){case"input":s=Gv(e,s),n=Gv(e,n),i=[];break;case"select":s=Ht({},s,{value:void 0}),n=Ht({},n,{value:void 0}),i=[];break;case"textarea":s=Xv(e,s),n=Xv(e,n),i=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=jc)}eg(r,n);var u;r=null;for(b in s)if(!n.hasOwnProperty(b)&&s.hasOwnProperty(b)&&s[b]!=null)if(b==="style"){var d=s[b];for(u in d)d.hasOwnProperty(u)&&(r||(r={}),r[u]="")}else b!=="dangerouslySetInnerHTML"&&b!=="children"&&b!=="suppressContentEditableWarning"&&b!=="suppressHydrationWarning"&&b!=="autoFocus"&&(wu.hasOwnProperty(b)?i||(i=[]):(i=i||[]).push(b,null));for(b in n){var c=n[b];if(d=s!=null?s[b]:void 0,n.hasOwnProperty(b)&&c!==d&&(c!=null||d!=null))if(b==="style")if(d){for(u in d)!d.hasOwnProperty(u)||c&&c.hasOwnProperty(u)||(r||(r={}),r[u]="");for(u in c)c.hasOwnProperty(u)&&d[u]!==c[u]&&(r||(r={}),r[u]=c[u])}else r||(i||(i=[]),i.push(b,r)),r=c;else b==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,d=d?d.__html:void 0,c!=null&&d!==c&&(i=i||[]).push(b,c)):b==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(b,""+c):b!=="suppressContentEditableWarning"&&b!=="suppressHydrationWarning"&&(wu.hasOwnProperty(b)?(c!=null&&b==="onScroll"&&It("scroll",e),i||d===c||(i=[])):(i=i||[]).push(b,c))}r&&(i=i||[]).push("style",r);var b=i;(t.updateQueue=b)&&(t.flags|=4)}};nM=function(e,t,r,n){r!==n&&(t.flags|=4)};function Ul(e,t){if(!jt)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function kr(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var s=e.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags&14680064,n|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function MN(e,t,r){var n=t.pendingProps;switch(bm(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kr(t),null;case 1:return Xr(t.type)&&Dc(),kr(t),null;case 3:return n=t.stateNode,jf(),Ct(Yr),Ct(qr),Rm(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Nh(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Wn!==null&&(Pg(Wn),Wn=null))),kg(e,t),kr(t),null;case 5:Bm(t);var s=la(Nu.current);if(r=t.type,e!==null&&t.stateNode!=null)rM(e,t,r,n,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(Ce(166));return kr(t),null}if(e=la(Bi.current),Nh(t)){n=t.stateNode,r=t.type;var i=t.memoizedProps;switch(n[gi]=t,n[Ru]=i,e=(t.mode&1)!==0,r){case"dialog":It("cancel",n),It("close",n);break;case"iframe":case"object":case"embed":It("load",n);break;case"video":case"audio":for(s=0;s<iu.length;s++)It(iu[s],n);break;case"source":It("error",n);break;case"img":case"image":case"link":It("error",n),It("load",n);break;case"details":It("toggle",n);break;case"input":Tb(n,i),It("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},It("invalid",n);break;case"textarea":Cb(n,i),It("invalid",n)}eg(r,i),s=null;for(var u in i)if(i.hasOwnProperty(u)){var d=i[u];u==="children"?typeof d=="string"?n.textContent!==d&&(i.suppressHydrationWarning!==!0&&$h(n.textContent,d,e),s=["children",d]):typeof d=="number"&&n.textContent!==""+d&&(i.suppressHydrationWarning!==!0&&$h(n.textContent,d,e),s=["children",""+d]):wu.hasOwnProperty(u)&&d!=null&&u==="onScroll"&&It("scroll",n)}switch(r){case"input":Mh(n),Ib(n,i,!0);break;case"textarea":Mh(n),Pb(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=jc)}n=s,t.updateQueue=n,n!==null&&(t.flags|=4)}else{u=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=N8(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=u.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=u.createElement(r,{is:n.is}):(e=u.createElement(r),r==="select"&&(u=e,n.multiple?u.multiple=!0:n.size&&(u.size=n.size))):e=u.createElementNS(e,r),e[gi]=t,e[Ru]=n,tM(e,t,!1,!1),t.stateNode=e;e:{switch(u=tg(r,n),r){case"dialog":It("cancel",e),It("close",e),s=n;break;case"iframe":case"object":case"embed":It("load",e),s=n;break;case"video":case"audio":for(s=0;s<iu.length;s++)It(iu[s],e);s=n;break;case"source":It("error",e),s=n;break;case"img":case"image":case"link":It("error",e),It("load",e),s=n;break;case"details":It("toggle",e),s=n;break;case"input":Tb(e,n),s=Gv(e,n),It("invalid",e);break;case"option":s=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},s=Ht({},n,{value:void 0}),It("invalid",e);break;case"textarea":Cb(e,n),s=Xv(e,n),It("invalid",e);break;default:s=n}eg(r,s),d=s;for(i in d)if(d.hasOwnProperty(i)){var c=d[i];i==="style"?C8(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&T8(e,c)):i==="children"?typeof c=="string"?(r!=="textarea"||c!=="")&&bu(e,c):typeof c=="number"&&bu(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(wu.hasOwnProperty(i)?c!=null&&i==="onScroll"&&It("scroll",e):c!=null&&om(e,i,c,u))}switch(r){case"input":Mh(e),Ib(e,n,!1);break;case"textarea":Mh(e),Pb(e);break;case"option":n.value!=null&&e.setAttribute("value",""+xs(n.value));break;case"select":e.multiple=!!n.multiple,i=n.value,i!=null?xf(e,!!n.multiple,i,!1):n.defaultValue!=null&&xf(e,!!n.multiple,n.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=jc)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return kr(t),null;case 6:if(e&&t.stateNode!=null)nM(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(Ce(166));if(r=la(Nu.current),la(Bi.current),Nh(t)){if(n=t.stateNode,r=t.memoizedProps,n[gi]=t,(i=n.nodeValue!==r)&&(e=un,e!==null))switch(e.tag){case 3:$h(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&$h(n.nodeValue,r,(e.mode&1)!==0)}i&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[gi]=t,t.stateNode=n}return kr(t),null;case 13:if(Ct(qt),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(jt&&fn!==null&&t.mode&1&&!(t.flags&128))x5(),Of(),t.flags|=98560,i=!1;else if(i=Nh(t),n!==null&&n.dehydrated!==null){if(e===null){if(!i)throw Error(Ce(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Ce(317));i[gi]=t}else Of(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;kr(t),i=!1}else Wn!==null&&(Pg(Wn),Wn=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=r,t):(n=n!==null,n!==(e!==null&&e.memoizedState!==null)&&n&&(t.child.flags|=8192,t.mode&1&&(e===null||qt.current&1?sr===0&&(sr=3):qm())),t.updateQueue!==null&&(t.flags|=4),kr(t),null);case 4:return jf(),kg(e,t),e===null&&ku(t.stateNode.containerInfo),kr(t),null;case 10:return Em(t.type._context),kr(t),null;case 17:return Xr(t.type)&&Dc(),kr(t),null;case 19:if(Ct(qt),i=t.memoizedState,i===null)return kr(t),null;if(n=(t.flags&128)!==0,u=i.rendering,u===null)if(n)Ul(i,!1);else{if(sr!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(u=Kc(e),u!==null){for(t.flags|=128,Ul(i,!1),n=u.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;r!==null;)i=r,e=n,i.flags&=14680066,u=i.alternate,u===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=u.childLanes,i.lanes=u.lanes,i.child=u.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=u.memoizedProps,i.memoizedState=u.memoizedState,i.updateQueue=u.updateQueue,i.type=u.type,e=u.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return Nt(qt,qt.current&1|2),t.child}e=e.sibling}i.tail!==null&&Zt()>qf&&(t.flags|=128,n=!0,Ul(i,!1),t.lanes=4194304)}else{if(!n)if(e=Kc(u),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Ul(i,!0),i.tail===null&&i.tailMode==="hidden"&&!u.alternate&&!jt)return kr(t),null}else 2*Zt()-i.renderingStartTime>qf&&r!==1073741824&&(t.flags|=128,n=!0,Ul(i,!1),t.lanes=4194304);i.isBackwards?(u.sibling=t.child,t.child=u):(r=i.last,r!==null?r.sibling=u:t.child=u,i.last=u)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Zt(),t.sibling=null,r=qt.current,Nt(qt,n?r&1|2:r&1),t):(kr(t),null);case 22:case 23:return Dm(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?sn&1073741824&&(kr(t),t.subtreeFlags&6&&(t.flags|=8192)):kr(t),null;case 24:return null;case 25:return null}throw Error(Ce(156,t.tag))}function _N(e,t){switch(bm(t),t.tag){case 1:return Xr(t.type)&&Dc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return jf(),Ct(Yr),Ct(qr),Rm(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Bm(t),null;case 13:if(Ct(qt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ce(340));Of()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ct(qt),null;case 4:return jf(),null;case 10:return Em(t.type._context),null;case 22:case 23:return Dm(),null;case 24:return null;default:return null}}var Ch=!1,Or=!1,EN=typeof WeakSet=="function"?WeakSet:Set,Ue=null;function df(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Wt(e,t,n)}else r.current=null}function Bg(e,t,r){try{r()}catch(n){Wt(e,t,n)}}var E3=!1;function SN(e,t){if(hg=Lc,e=f5(),mm(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var s=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var u=0,d=-1,c=-1,b=0,w=0,M=e,_=null;t:for(;;){for(var A;M!==r||s!==0&&M.nodeType!==3||(d=u+s),M!==i||n!==0&&M.nodeType!==3||(c=u+n),M.nodeType===3&&(u+=M.nodeValue.length),(A=M.firstChild)!==null;)_=M,M=A;for(;;){if(M===e)break t;if(_===r&&++b===s&&(d=u),_===i&&++w===n&&(c=u),(A=M.nextSibling)!==null)break;M=_,_=M.parentNode}M=A}r=d===-1||c===-1?null:{start:d,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(cg={focusedElem:e,selectionRange:r},Lc=!1,Ue=t;Ue!==null;)if(t=Ue,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ue=e;else for(;Ue!==null;){t=Ue;try{var R=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(R!==null){var B=R.memoizedProps,I=R.memoizedState,E=t.stateNode,k=E.getSnapshotBeforeUpdate(t.elementType===t.type?B:Hn(t.type,B),I);E.__reactInternalSnapshotBeforeUpdate=k}break;case 3:var T=t.stateNode.containerInfo;T.nodeType===1?T.textContent="":T.nodeType===9&&T.documentElement&&T.removeChild(T.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ce(163))}}catch(L){Wt(t,t.return,L)}if(e=t.sibling,e!==null){e.return=t.return,Ue=e;break}Ue=t.return}return R=E3,E3=!1,R}function pu(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&Bg(t,r,i)}s=s.next}while(s!==n)}}function D0(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function Rg(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function iM(e){var t=e.alternate;t!==null&&(e.alternate=null,iM(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[gi],delete t[Ru],delete t[vg],delete t[aN],delete t[fN])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function oM(e){return e.tag===5||e.tag===3||e.tag===4}function S3(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||oM(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function $g(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=jc));else if(n!==4&&(e=e.child,e!==null))for($g(e,t,r),e=e.sibling;e!==null;)$g(e,t,r),e=e.sibling}function Ng(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(Ng(e,t,r),e=e.sibling;e!==null;)Ng(e,t,r),e=e.sibling}var wr=null,zn=!1;function Oo(e,t,r){for(r=r.child;r!==null;)sM(e,t,r),r=r.sibling}function sM(e,t,r){if(ki&&typeof ki.onCommitFiberUnmount=="function")try{ki.onCommitFiberUnmount(T0,r)}catch{}switch(r.tag){case 5:Or||df(r,t);case 6:var n=wr,s=zn;wr=null,Oo(e,t,r),wr=n,zn=s,wr!==null&&(zn?(e=wr,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):wr.removeChild(r.stateNode));break;case 18:wr!==null&&(zn?(e=wr,r=r.stateNode,e.nodeType===8?Np(e.parentNode,r):e.nodeType===1&&Np(e,r),Eu(e)):Np(wr,r.stateNode));break;case 4:n=wr,s=zn,wr=r.stateNode.containerInfo,zn=!0,Oo(e,t,r),wr=n,zn=s;break;case 0:case 11:case 14:case 15:if(!Or&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){s=n=n.next;do{var i=s,u=i.destroy;i=i.tag,u!==void 0&&(i&2||i&4)&&Bg(r,t,u),s=s.next}while(s!==n)}Oo(e,t,r);break;case 1:if(!Or&&(df(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(d){Wt(r,t,d)}Oo(e,t,r);break;case 21:Oo(e,t,r);break;case 22:r.mode&1?(Or=(n=Or)||r.memoizedState!==null,Oo(e,t,r),Or=n):Oo(e,t,r);break;default:Oo(e,t,r)}}function A3(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new EN),t.forEach(function(n){var s=CN.bind(null,e,n);r.has(n)||(r.add(n),n.then(s,s))})}}function Dn(e,t){var r=t.deletions;if(r!==null)for(var n=0;n<r.length;n++){var s=r[n];try{var i=e,u=t,d=u;e:for(;d!==null;){switch(d.tag){case 5:wr=d.stateNode,zn=!1;break e;case 3:wr=d.stateNode.containerInfo,zn=!0;break e;case 4:wr=d.stateNode.containerInfo,zn=!0;break e}d=d.return}if(wr===null)throw Error(Ce(160));sM(i,u,s),wr=null,zn=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(b){Wt(s,t,b)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)aM(t,e),t=t.sibling}function aM(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Dn(t,e),oi(e),n&4){try{pu(3,e,e.return),D0(3,e)}catch(B){Wt(e,e.return,B)}try{pu(5,e,e.return)}catch(B){Wt(e,e.return,B)}}break;case 1:Dn(t,e),oi(e),n&512&&r!==null&&df(r,r.return);break;case 5:if(Dn(t,e),oi(e),n&512&&r!==null&&df(r,r.return),e.flags&32){var s=e.stateNode;try{bu(s,"")}catch(B){Wt(e,e.return,B)}}if(n&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,u=r!==null?r.memoizedProps:i,d=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{d==="input"&&i.type==="radio"&&i.name!=null&&R8(s,i),tg(d,u);var b=tg(d,i);for(u=0;u<c.length;u+=2){var w=c[u],M=c[u+1];w==="style"?C8(s,M):w==="dangerouslySetInnerHTML"?T8(s,M):w==="children"?bu(s,M):om(s,w,M,b)}switch(d){case"input":Jv(s,i);break;case"textarea":$8(s,i);break;case"select":var _=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var A=i.value;A!=null?xf(s,!!i.multiple,A,!1):_!==!!i.multiple&&(i.defaultValue!=null?xf(s,!!i.multiple,i.defaultValue,!0):xf(s,!!i.multiple,i.multiple?[]:"",!1))}s[Ru]=i}catch(B){Wt(e,e.return,B)}}break;case 6:if(Dn(t,e),oi(e),n&4){if(e.stateNode===null)throw Error(Ce(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(B){Wt(e,e.return,B)}}break;case 3:if(Dn(t,e),oi(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{Eu(t.containerInfo)}catch(B){Wt(e,e.return,B)}break;case 4:Dn(t,e),oi(e);break;case 13:Dn(t,e),oi(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(Um=Zt())),n&4&&A3(e);break;case 22:if(w=r!==null&&r.memoizedState!==null,e.mode&1?(Or=(b=Or)||w,Dn(t,e),Or=b):Dn(t,e),oi(e),n&8192){if(b=e.memoizedState!==null,(e.stateNode.isHidden=b)&&!w&&e.mode&1)for(Ue=e,w=e.child;w!==null;){for(M=Ue=w;Ue!==null;){switch(_=Ue,A=_.child,_.tag){case 0:case 11:case 14:case 15:pu(4,_,_.return);break;case 1:df(_,_.return);var R=_.stateNode;if(typeof R.componentWillUnmount=="function"){n=_,r=_.return;try{t=n,R.props=t.memoizedProps,R.state=t.memoizedState,R.componentWillUnmount()}catch(B){Wt(n,r,B)}}break;case 5:df(_,_.return);break;case 22:if(_.memoizedState!==null){B3(M);continue}}A!==null?(A.return=_,Ue=A):B3(M)}w=w.sibling}e:for(w=null,M=e;;){if(M.tag===5){if(w===null){w=M;try{s=M.stateNode,b?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(d=M.stateNode,c=M.memoizedProps.style,u=c!=null&&c.hasOwnProperty("display")?c.display:null,d.style.display=I8("display",u))}catch(B){Wt(e,e.return,B)}}}else if(M.tag===6){if(w===null)try{M.stateNode.nodeValue=b?"":M.memoizedProps}catch(B){Wt(e,e.return,B)}}else if((M.tag!==22&&M.tag!==23||M.memoizedState===null||M===e)&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===e)break e;for(;M.sibling===null;){if(M.return===null||M.return===e)break e;w===M&&(w=null),M=M.return}w===M&&(w=null),M.sibling.return=M.return,M=M.sibling}}break;case 19:Dn(t,e),oi(e),n&4&&A3(e);break;case 21:break;default:Dn(t,e),oi(e)}}function oi(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(oM(r)){var n=r;break e}r=r.return}throw Error(Ce(160))}switch(n.tag){case 5:var s=n.stateNode;n.flags&32&&(bu(s,""),n.flags&=-33);var i=S3(e);Ng(e,i,s);break;case 3:case 4:var u=n.stateNode.containerInfo,d=S3(e);$g(e,d,u);break;default:throw Error(Ce(161))}}catch(c){Wt(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function AN(e,t,r){Ue=e,fM(e)}function fM(e,t,r){for(var n=(e.mode&1)!==0;Ue!==null;){var s=Ue,i=s.child;if(s.tag===22&&n){var u=s.memoizedState!==null||Ch;if(!u){var d=s.alternate,c=d!==null&&d.memoizedState!==null||Or;d=Ch;var b=Or;if(Ch=u,(Or=c)&&!b)for(Ue=s;Ue!==null;)u=Ue,c=u.child,u.tag===22&&u.memoizedState!==null?R3(s):c!==null?(c.return=u,Ue=c):R3(s);for(;i!==null;)Ue=i,fM(i),i=i.sibling;Ue=s,Ch=d,Or=b}k3(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,Ue=i):k3(e)}}function k3(e){for(;Ue!==null;){var t=Ue;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Or||D0(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!Or)if(r===null)n.componentDidMount();else{var s=t.elementType===t.type?r.memoizedProps:Hn(t.type,r.memoizedProps);n.componentDidUpdate(s,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&h3(t,i,n);break;case 3:var u=t.updateQueue;if(u!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}h3(t,u,r)}break;case 5:var d=t.stateNode;if(r===null&&t.flags&4){r=d;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&r.focus();break;case"img":c.src&&(r.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var b=t.alternate;if(b!==null){var w=b.memoizedState;if(w!==null){var M=w.dehydrated;M!==null&&Eu(M)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Ce(163))}Or||t.flags&512&&Rg(t)}catch(_){Wt(t,t.return,_)}}if(t===e){Ue=null;break}if(r=t.sibling,r!==null){r.return=t.return,Ue=r;break}Ue=t.return}}function B3(e){for(;Ue!==null;){var t=Ue;if(t===e){Ue=null;break}var r=t.sibling;if(r!==null){r.return=t.return,Ue=r;break}Ue=t.return}}function R3(e){for(;Ue!==null;){var t=Ue;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{D0(4,t)}catch(c){Wt(t,r,c)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var s=t.return;try{n.componentDidMount()}catch(c){Wt(t,s,c)}}var i=t.return;try{Rg(t)}catch(c){Wt(t,i,c)}break;case 5:var u=t.return;try{Rg(t)}catch(c){Wt(t,u,c)}}}catch(c){Wt(t,t.return,c)}if(t===e){Ue=null;break}var d=t.sibling;if(d!==null){d.return=t.return,Ue=d;break}Ue=t.return}}var kN=Math.ceil,Jc=So.ReactCurrentDispatcher,Lm=So.ReactCurrentOwner,Rn=So.ReactCurrentBatchConfig,st=0,pr=null,nr=null,_r=0,sn=0,pf=Rs(0),sr=0,Pu=null,Sa=0,q0=0,Om=0,vu=null,Gr=null,Um=0,qf=1/0,Ki=null,Yc=!1,Tg=null,ps=null,Ph=!1,is=null,Xc=0,gu=0,Ig=null,hc=-1,cc=0;function zr(){return st&6?Zt():hc!==-1?hc:hc=Zt()}function vs(e){return e.mode&1?st&2&&_r!==0?_r&-_r:uN.transition!==null?(cc===0&&(cc=V8()),cc):(e=ct,e!==0||(e=window.event,e=e===void 0?16:Q8(e.type)),e):1}function Zn(e,t,r,n){if(50<gu)throw gu=0,Ig=null,Error(Ce(185));Gu(e,r,n),(!(st&2)||e!==pr)&&(e===pr&&(!(st&2)&&(q0|=r),sr===4&&rs(e,_r)),Qr(e,n),r===1&&st===0&&!(t.mode&1)&&(qf=Zt()+500,O0&&$s()))}function Qr(e,t){var r=e.callbackNode;u$(e,t);var n=Pc(e,e===pr?_r:0);if(n===0)r!==null&&Ub(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&Ub(r),t===1)e.tag===0?lN($3.bind(null,e)):m5($3.bind(null,e)),oN(function(){!(st&6)&&$s()}),r=null;else{switch(K8(n)){case 1:r=um;break;case 4:r=z8;break;case 16:r=Cc;break;case 536870912:r=W8;break;default:r=Cc}r=gM(r,lM.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function lM(e,t){if(hc=-1,cc=0,st&6)throw Error(Ce(327));var r=e.callbackNode;if(Af()&&e.callbackNode!==r)return null;var n=Pc(e,e===pr?_r:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=Qc(e,n);else{t=n;var s=st;st|=2;var i=hM();(pr!==e||_r!==t)&&(Ki=null,qf=Zt()+500,ga(e,t));do try{$N();break}catch(d){uM(e,d)}while(!0);_m(),Jc.current=i,st=s,nr!==null?t=0:(pr=null,_r=0,t=sr)}if(t!==0){if(t===2&&(s=sg(e),s!==0&&(n=s,t=Cg(e,s))),t===1)throw r=Pu,ga(e,0),rs(e,n),Qr(e,Zt()),r;if(t===6)rs(e,n);else{if(s=e.current.alternate,!(n&30)&&!BN(s)&&(t=Qc(e,n),t===2&&(i=sg(e),i!==0&&(n=i,t=Cg(e,i))),t===1))throw r=Pu,ga(e,0),rs(e,n),Qr(e,Zt()),r;switch(e.finishedWork=s,e.finishedLanes=n,t){case 0:case 1:throw Error(Ce(345));case 2:Js(e,Gr,Ki);break;case 3:if(rs(e,n),(n&130023424)===n&&(t=Um+500-Zt(),10<t)){if(Pc(e,0)!==0)break;if(s=e.suspendedLanes,(s&n)!==n){zr(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=pg(Js.bind(null,e,Gr,Ki),t);break}Js(e,Gr,Ki);break;case 4:if(rs(e,n),(n&4194240)===n)break;for(t=e.eventTimes,s=-1;0<n;){var u=31-Kn(n);i=1<<u,u=t[u],u>s&&(s=u),n&=~i}if(n=s,n=Zt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*kN(n/1960))-n,10<n){e.timeoutHandle=pg(Js.bind(null,e,Gr,Ki),n);break}Js(e,Gr,Ki);break;case 5:Js(e,Gr,Ki);break;default:throw Error(Ce(329))}}}return Qr(e,Zt()),e.callbackNode===r?lM.bind(null,e):null}function Cg(e,t){var r=vu;return e.current.memoizedState.isDehydrated&&(ga(e,t).flags|=256),e=Qc(e,t),e!==2&&(t=Gr,Gr=r,t!==null&&Pg(t)),e}function Pg(e){Gr===null?Gr=e:Gr.push.apply(Gr,e)}function BN(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var s=r[n],i=s.getSnapshot;s=s.value;try{if(!Gn(i(),s))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function rs(e,t){for(t&=~Om,t&=~q0,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-Kn(t),n=1<<r;e[r]=-1,t&=~n}}function $3(e){if(st&6)throw Error(Ce(327));Af();var t=Pc(e,0);if(!(t&1))return Qr(e,Zt()),null;var r=Qc(e,t);if(e.tag!==0&&r===2){var n=sg(e);n!==0&&(t=n,r=Cg(e,n))}if(r===1)throw r=Pu,ga(e,0),rs(e,t),Qr(e,Zt()),r;if(r===6)throw Error(Ce(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Js(e,Gr,Ki),Qr(e,Zt()),null}function jm(e,t){var r=st;st|=1;try{return e(t)}finally{st=r,st===0&&(qf=Zt()+500,O0&&$s())}}function Aa(e){is!==null&&is.tag===0&&!(st&6)&&Af();var t=st;st|=1;var r=Rn.transition,n=ct;try{if(Rn.transition=null,ct=1,e)return e()}finally{ct=n,Rn.transition=r,st=t,!(st&6)&&$s()}}function Dm(){sn=pf.current,Ct(pf)}function ga(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,iN(r)),nr!==null)for(r=nr.return;r!==null;){var n=r;switch(bm(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&Dc();break;case 3:jf(),Ct(Yr),Ct(qr),Rm();break;case 5:Bm(n);break;case 4:jf();break;case 13:Ct(qt);break;case 19:Ct(qt);break;case 10:Em(n.type._context);break;case 22:case 23:Dm()}r=r.return}if(pr=e,nr=e=gs(e.current,null),_r=sn=t,sr=0,Pu=null,Om=q0=Sa=0,Gr=vu=null,fa!==null){for(t=0;t<fa.length;t++)if(r=fa[t],n=r.interleaved,n!==null){r.interleaved=null;var s=n.next,i=r.pending;if(i!==null){var u=i.next;i.next=s,n.next=u}r.pending=n}fa=null}return e}function uM(e,t){do{var r=nr;try{if(_m(),fc.current=Gc,Zc){for(var n=Ft.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}Zc=!1}if(Ea=0,lr=ir=Ft=null,du=!1,Tu=0,Lm.current=null,r===null||r.return===null){sr=1,Pu=t,nr=null;break}e:{var i=e,u=r.return,d=r,c=t;if(t=_r,d.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var b=c,w=d,M=w.tag;if(!(w.mode&1)&&(M===0||M===11||M===15)){var _=w.alternate;_?(w.updateQueue=_.updateQueue,w.memoizedState=_.memoizedState,w.lanes=_.lanes):(w.updateQueue=null,w.memoizedState=null)}var A=y3(u);if(A!==null){A.flags&=-257,m3(A,u,d,i,t),A.mode&1&&g3(i,b,t),t=A,c=b;var R=t.updateQueue;if(R===null){var B=new Set;B.add(c),t.updateQueue=B}else R.add(c);break e}else{if(!(t&1)){g3(i,b,t),qm();break e}c=Error(Ce(426))}}else if(jt&&d.mode&1){var I=y3(u);if(I!==null){!(I.flags&65536)&&(I.flags|=256),m3(I,u,d,i,t),xm(Df(c,d));break e}}i=c=Df(c,d),sr!==4&&(sr=2),vu===null?vu=[i]:vu.push(i),i=u;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var E=K5(i,c,t);u3(i,E);break e;case 1:d=c;var k=i.type,T=i.stateNode;if(!(i.flags&128)&&(typeof k.getDerivedStateFromError=="function"||T!==null&&typeof T.componentDidCatch=="function"&&(ps===null||!ps.has(T)))){i.flags|=65536,t&=-t,i.lanes|=t;var L=Z5(i,d,t);u3(i,L);break e}}i=i.return}while(i!==null)}dM(r)}catch(q){t=q,nr===r&&r!==null&&(nr=r=r.return);continue}break}while(!0)}function hM(){var e=Jc.current;return Jc.current=Gc,e===null?Gc:e}function qm(){(sr===0||sr===3||sr===2)&&(sr=4),pr===null||!(Sa&268435455)&&!(q0&268435455)||rs(pr,_r)}function Qc(e,t){var r=st;st|=2;var n=hM();(pr!==e||_r!==t)&&(Ki=null,ga(e,t));do try{RN();break}catch(s){uM(e,s)}while(!0);if(_m(),st=r,Jc.current=n,nr!==null)throw Error(Ce(261));return pr=null,_r=0,sr}function RN(){for(;nr!==null;)cM(nr)}function $N(){for(;nr!==null&&!t$();)cM(nr)}function cM(e){var t=vM(e.alternate,e,sn);e.memoizedProps=e.pendingProps,t===null?dM(e):nr=t,Lm.current=null}function dM(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=_N(r,t),r!==null){r.flags&=32767,nr=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{sr=6,nr=null;return}}else if(r=MN(r,t,sn),r!==null){nr=r;return}if(t=t.sibling,t!==null){nr=t;return}nr=t=e}while(t!==null);sr===0&&(sr=5)}function Js(e,t,r){var n=ct,s=Rn.transition;try{Rn.transition=null,ct=1,NN(e,t,r,n)}finally{Rn.transition=s,ct=n}return null}function NN(e,t,r,n){do Af();while(is!==null);if(st&6)throw Error(Ce(327));r=e.finishedWork;var s=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(Ce(177));e.callbackNode=null,e.callbackPriority=0;var i=r.lanes|r.childLanes;if(h$(e,i),e===pr&&(nr=pr=null,_r=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||Ph||(Ph=!0,gM(Cc,function(){return Af(),null})),i=(r.flags&15990)!==0,r.subtreeFlags&15990||i){i=Rn.transition,Rn.transition=null;var u=ct;ct=1;var d=st;st|=4,Lm.current=null,SN(e,r),aM(r,e),Y$(cg),Lc=!!hg,cg=hg=null,e.current=r,AN(r),r$(),st=d,ct=u,Rn.transition=i}else e.current=r;if(Ph&&(Ph=!1,is=e,Xc=s),i=e.pendingLanes,i===0&&(ps=null),o$(r.stateNode),Qr(e,Zt()),t!==null)for(n=e.onRecoverableError,r=0;r<t.length;r++)s=t[r],n(s.value,{componentStack:s.stack,digest:s.digest});if(Yc)throw Yc=!1,e=Tg,Tg=null,e;return Xc&1&&e.tag!==0&&Af(),i=e.pendingLanes,i&1?e===Ig?gu++:(gu=0,Ig=e):gu=0,$s(),null}function Af(){if(is!==null){var e=K8(Xc),t=Rn.transition,r=ct;try{if(Rn.transition=null,ct=16>e?16:e,is===null)var n=!1;else{if(e=is,is=null,Xc=0,st&6)throw Error(Ce(331));var s=st;for(st|=4,Ue=e.current;Ue!==null;){var i=Ue,u=i.child;if(Ue.flags&16){var d=i.deletions;if(d!==null){for(var c=0;c<d.length;c++){var b=d[c];for(Ue=b;Ue!==null;){var w=Ue;switch(w.tag){case 0:case 11:case 15:pu(8,w,i)}var M=w.child;if(M!==null)M.return=w,Ue=M;else for(;Ue!==null;){w=Ue;var _=w.sibling,A=w.return;if(iM(w),w===b){Ue=null;break}if(_!==null){_.return=A,Ue=_;break}Ue=A}}}var R=i.alternate;if(R!==null){var B=R.child;if(B!==null){R.child=null;do{var I=B.sibling;B.sibling=null,B=I}while(B!==null)}}Ue=i}}if(i.subtreeFlags&2064&&u!==null)u.return=i,Ue=u;else e:for(;Ue!==null;){if(i=Ue,i.flags&2048)switch(i.tag){case 0:case 11:case 15:pu(9,i,i.return)}var E=i.sibling;if(E!==null){E.return=i.return,Ue=E;break e}Ue=i.return}}var k=e.current;for(Ue=k;Ue!==null;){u=Ue;var T=u.child;if(u.subtreeFlags&2064&&T!==null)T.return=u,Ue=T;else e:for(u=k;Ue!==null;){if(d=Ue,d.flags&2048)try{switch(d.tag){case 0:case 11:case 15:D0(9,d)}}catch(q){Wt(d,d.return,q)}if(d===u){Ue=null;break e}var L=d.sibling;if(L!==null){L.return=d.return,Ue=L;break e}Ue=d.return}}if(st=s,$s(),ki&&typeof ki.onPostCommitFiberRoot=="function")try{ki.onPostCommitFiberRoot(T0,e)}catch{}n=!0}return n}finally{ct=r,Rn.transition=t}}return!1}function N3(e,t,r){t=Df(r,t),t=K5(e,t,1),e=ds(e,t,1),t=zr(),e!==null&&(Gu(e,1,t),Qr(e,t))}function Wt(e,t,r){if(e.tag===3)N3(e,e,r);else for(;t!==null;){if(t.tag===3){N3(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(ps===null||!ps.has(n))){e=Df(r,e),e=Z5(t,e,1),t=ds(t,e,1),e=zr(),t!==null&&(Gu(t,1,e),Qr(t,e));break}}t=t.return}}function TN(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=zr(),e.pingedLanes|=e.suspendedLanes&r,pr===e&&(_r&r)===r&&(sr===4||sr===3&&(_r&130023424)===_r&&500>Zt()-Um?ga(e,0):Om|=r),Qr(e,t)}function pM(e,t){t===0&&(e.mode&1?(t=Sh,Sh<<=1,!(Sh&130023424)&&(Sh=4194304)):t=1);var r=zr();e=vo(e,t),e!==null&&(Gu(e,t,r),Qr(e,r))}function IN(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),pM(e,r)}function CN(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,s=e.memoizedState;s!==null&&(r=s.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(Ce(314))}n!==null&&n.delete(t),pM(e,r)}var vM;vM=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||Yr.current)Jr=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return Jr=!1,xN(e,t,r);Jr=!!(e.flags&131072)}else Jr=!1,jt&&t.flags&1048576&&w5(t,Hc,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;uc(e,t),e=t.pendingProps;var s=Lf(t,qr.current);Sf(t,r),s=Nm(null,t,n,e,s,r);var i=Tm();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Xr(n)?(i=!0,qc(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Am(t),s.updater=j0,t.stateNode=s,s._reactInternals=t,xg(t,n,e,r),t=Eg(null,t,n,!0,i,r)):(t.tag=0,jt&&i&&wm(t),Fr(null,t,s,r),t=t.child),t;case 16:n=t.elementType;e:{switch(uc(e,t),e=t.pendingProps,s=n._init,n=s(n._payload),t.type=n,s=t.tag=LN(n),e=Hn(n,e),s){case 0:t=_g(null,t,n,e,r);break e;case 1:t=x3(null,t,n,e,r);break e;case 11:t=w3(null,t,n,e,r);break e;case 14:t=b3(null,t,n,Hn(n.type,e),r);break e}throw Error(Ce(306,n,""))}return t;case 0:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Hn(n,s),_g(e,t,n,s,r);case 1:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Hn(n,s),x3(e,t,n,s,r);case 3:e:{if(X5(t),e===null)throw Error(Ce(387));n=t.pendingProps,i=t.memoizedState,s=i.element,S5(e,t),Vc(t,n,null,r);var u=t.memoizedState;if(n=u.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:u.cache,pendingSuspenseBoundaries:u.pendingSuspenseBoundaries,transitions:u.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Df(Error(Ce(423)),t),t=M3(e,t,n,r,s);break e}else if(n!==s){s=Df(Error(Ce(424)),t),t=M3(e,t,n,r,s);break e}else for(fn=cs(t.stateNode.containerInfo.firstChild),un=t,jt=!0,Wn=null,r=_5(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Of(),n===s){t=go(e,t,r);break e}Fr(e,t,n,r)}t=t.child}return t;case 5:return A5(t),e===null&&mg(t),n=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,u=s.children,dg(n,s)?u=null:i!==null&&dg(n,i)&&(t.flags|=32),Y5(e,t),Fr(e,t,u,r),t.child;case 6:return e===null&&mg(t),null;case 13:return Q5(e,t,r);case 4:return km(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Uf(t,null,n,r):Fr(e,t,n,r),t.child;case 11:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Hn(n,s),w3(e,t,n,s,r);case 7:return Fr(e,t,t.pendingProps,r),t.child;case 8:return Fr(e,t,t.pendingProps.children,r),t.child;case 12:return Fr(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,s=t.pendingProps,i=t.memoizedProps,u=s.value,Nt(zc,n._currentValue),n._currentValue=u,i!==null)if(Gn(i.value,u)){if(i.children===s.children&&!Yr.current){t=go(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var d=i.dependencies;if(d!==null){u=i.child;for(var c=d.firstContext;c!==null;){if(c.context===n){if(i.tag===1){c=lo(-1,r&-r),c.tag=2;var b=i.updateQueue;if(b!==null){b=b.shared;var w=b.pending;w===null?c.next=c:(c.next=w.next,w.next=c),b.pending=c}}i.lanes|=r,c=i.alternate,c!==null&&(c.lanes|=r),wg(i.return,r,t),d.lanes|=r;break}c=c.next}}else if(i.tag===10)u=i.type===t.type?null:i.child;else if(i.tag===18){if(u=i.return,u===null)throw Error(Ce(341));u.lanes|=r,d=u.alternate,d!==null&&(d.lanes|=r),wg(u,r,t),u=i.sibling}else u=i.child;if(u!==null)u.return=i;else for(u=i;u!==null;){if(u===t){u=null;break}if(i=u.sibling,i!==null){i.return=u.return,u=i;break}u=u.return}i=u}Fr(e,t,s.children,r),t=t.child}return t;case 9:return s=t.type,n=t.pendingProps.children,Sf(t,r),s=$n(s),n=n(s),t.flags|=1,Fr(e,t,n,r),t.child;case 14:return n=t.type,s=Hn(n,t.pendingProps),s=Hn(n.type,s),b3(e,t,n,s,r);case 15:return G5(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Hn(n,s),uc(e,t),t.tag=1,Xr(n)?(e=!0,qc(t)):e=!1,Sf(t,r),V5(t,n,s),xg(t,n,s,r),Eg(null,t,n,!0,e,r);case 19:return eM(e,t,r);case 22:return J5(e,t,r)}throw Error(Ce(156,t.tag))};function gM(e,t){return H8(e,t)}function PN(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function kn(e,t,r,n){return new PN(e,t,r,n)}function Fm(e){return e=e.prototype,!(!e||!e.isReactComponent)}function LN(e){if(typeof e=="function")return Fm(e)?1:0;if(e!=null){if(e=e.$$typeof,e===am)return 11;if(e===fm)return 14}return 2}function gs(e,t){var r=e.alternate;return r===null?(r=kn(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function dc(e,t,r,n,s,i){var u=2;if(n=e,typeof e=="function")Fm(e)&&(u=1);else if(typeof e=="string")u=5;else e:switch(e){case nf:return ya(r.children,s,i,t);case sm:u=8,s|=8;break;case Wv:return e=kn(12,r,t,s|2),e.elementType=Wv,e.lanes=i,e;case Vv:return e=kn(13,r,t,s),e.elementType=Vv,e.lanes=i,e;case Kv:return e=kn(19,r,t,s),e.elementType=Kv,e.lanes=i,e;case A8:return F0(r,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case E8:u=10;break e;case S8:u=9;break e;case am:u=11;break e;case fm:u=14;break e;case Xo:u=16,n=null;break e}throw Error(Ce(130,e==null?e:typeof e,""))}return t=kn(u,r,t,s),t.elementType=e,t.type=n,t.lanes=i,t}function ya(e,t,r,n){return e=kn(7,e,n,t),e.lanes=r,e}function F0(e,t,r,n){return e=kn(22,e,n,t),e.elementType=A8,e.lanes=r,e.stateNode={isHidden:!1},e}function jp(e,t,r){return e=kn(6,e,null,t),e.lanes=r,e}function Dp(e,t,r){return t=kn(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ON(e,t,r,n,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=bp(0),this.expirationTimes=bp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bp(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Hm(e,t,r,n,s,i,u,d,c){return e=new ON(e,t,r,d,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=kn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Am(i),e}function UN(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:rf,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function yM(e){if(!e)return Ms;e=e._reactInternals;e:{if(ja(e)!==e||e.tag!==1)throw Error(Ce(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Xr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Ce(171))}if(e.tag===1){var r=e.type;if(Xr(r))return y5(e,r,t)}return t}function mM(e,t,r,n,s,i,u,d,c){return e=Hm(r,n,!0,e,s,i,u,d,c),e.context=yM(null),r=e.current,n=zr(),s=vs(r),i=lo(n,s),i.callback=t??null,ds(r,i,s),e.current.lanes=s,Gu(e,s,n),Qr(e,n),e}function H0(e,t,r,n){var s=t.current,i=zr(),u=vs(s);return r=yM(r),t.context===null?t.context=r:t.pendingContext=r,t=lo(i,u),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=ds(s,t,u),e!==null&&(Zn(e,s,u,i),ac(e,s,u)),u}function e0(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function T3(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function zm(e,t){T3(e,t),(e=e.alternate)&&T3(e,t)}function jN(){return null}var wM=typeof reportError=="function"?reportError:function(e){console.error(e)};function Wm(e){this._internalRoot=e}z0.prototype.render=Wm.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Ce(409));H0(e,t,null,null)};z0.prototype.unmount=Wm.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Aa(function(){H0(null,e,null,null)}),t[po]=null}};function z0(e){this._internalRoot=e}z0.prototype.unstable_scheduleHydration=function(e){if(e){var t=J8();e={blockedOn:null,target:e,priority:t};for(var r=0;r<ts.length&&t!==0&&t<ts[r].priority;r++);ts.splice(r,0,e),r===0&&X8(e)}};function Vm(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function W0(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function I3(){}function DN(e,t,r,n,s){if(s){if(typeof n=="function"){var i=n;n=function(){var b=e0(u);i.call(b)}}var u=mM(t,n,e,0,null,!1,!1,"",I3);return e._reactRootContainer=u,e[po]=u.current,ku(e.nodeType===8?e.parentNode:e),Aa(),u}for(;s=e.lastChild;)e.removeChild(s);if(typeof n=="function"){var d=n;n=function(){var b=e0(c);d.call(b)}}var c=Hm(e,0,!1,null,null,!1,!1,"",I3);return e._reactRootContainer=c,e[po]=c.current,ku(e.nodeType===8?e.parentNode:e),Aa(function(){H0(t,c,r,n)}),c}function V0(e,t,r,n,s){var i=r._reactRootContainer;if(i){var u=i;if(typeof s=="function"){var d=s;s=function(){var c=e0(u);d.call(c)}}H0(t,u,e,s)}else u=DN(r,t,e,s,n);return e0(u)}Z8=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=nu(t.pendingLanes);r!==0&&(hm(t,r|1),Qr(t,Zt()),!(st&6)&&(qf=Zt()+500,$s()))}break;case 13:Aa(function(){var n=vo(e,1);if(n!==null){var s=zr();Zn(n,e,1,s)}}),zm(e,1)}};cm=function(e){if(e.tag===13){var t=vo(e,134217728);if(t!==null){var r=zr();Zn(t,e,134217728,r)}zm(e,134217728)}};G8=function(e){if(e.tag===13){var t=vs(e),r=vo(e,t);if(r!==null){var n=zr();Zn(r,e,t,n)}zm(e,t)}};J8=function(){return ct};Y8=function(e,t){var r=ct;try{return ct=e,t()}finally{ct=r}};ng=function(e,t,r){switch(t){case"input":if(Jv(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var s=L0(n);if(!s)throw Error(Ce(90));B8(n),Jv(n,s)}}}break;case"textarea":$8(e,r);break;case"select":t=r.value,t!=null&&xf(e,!!r.multiple,t,!1)}};O8=jm;U8=Aa;var qN={usingClientEntryPoint:!1,Events:[Yu,ff,L0,P8,L8,jm]},jl={findFiberByHostInstance:aa,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},FN={bundleType:jl.bundleType,version:jl.version,rendererPackageName:jl.rendererPackageName,rendererConfig:jl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:So.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=q8(e),e===null?null:e.stateNode},findFiberByHostInstance:jl.findFiberByHostInstance||jN,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Lh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Lh.isDisabled&&Lh.supportsFiber)try{T0=Lh.inject(FN),ki=Lh}catch{}}pn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qN;pn.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Vm(t))throw Error(Ce(200));return UN(e,t,null,r)};pn.createRoot=function(e,t){if(!Vm(e))throw Error(Ce(299));var r=!1,n="",s=wM;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=Hm(e,1,!1,null,null,r,!1,n,s),e[po]=t.current,ku(e.nodeType===8?e.parentNode:e),new Wm(t)};pn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Ce(188)):(e=Object.keys(e).join(","),Error(Ce(268,e)));return e=q8(t),e=e===null?null:e.stateNode,e};pn.flushSync=function(e){return Aa(e)};pn.hydrate=function(e,t,r){if(!W0(t))throw Error(Ce(200));return V0(null,e,t,!0,r)};pn.hydrateRoot=function(e,t,r){if(!Vm(e))throw Error(Ce(405));var n=r!=null&&r.hydratedSources||null,s=!1,i="",u=wM;if(r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(u=r.onRecoverableError)),t=mM(t,null,e,1,r??null,s,!1,i,u),e[po]=t.current,ku(e),n)for(e=0;e<n.length;e++)r=n[e],s=r._getVersion,s=s(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,s]:t.mutableSourceEagerHydrationData.push(r,s);return new z0(t)};pn.render=function(e,t,r){if(!W0(t))throw Error(Ce(200));return V0(null,e,t,!1,r)};pn.unmountComponentAtNode=function(e){if(!W0(e))throw Error(Ce(40));return e._reactRootContainer?(Aa(function(){V0(null,null,e,!1,function(){e._reactRootContainer=null,e[po]=null})}),!0):!1};pn.unstable_batchedUpdates=jm;pn.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!W0(r))throw Error(Ce(200));if(e==null||e._reactInternals===void 0)throw Error(Ce(38));return V0(e,t,r,!1,n)};pn.version="18.3.1-next-f1338f8080-20240426";function bM(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(bM)}catch(e){console.error(e)}}bM(),b8.exports=pn;var HN=b8.exports,C3=HN;Hv.createRoot=C3.createRoot,Hv.hydrateRoot=C3.hydrateRoot;function P3(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function xM(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function zN(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");P3(e.outputLen),P3(e.blockLen)}function t0(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function WN(e,t){xM(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}const qp=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const MM=e=>e instanceof Uint8Array,Fp=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),si=(e,t)=>e<<32-t|e>>>t,VN=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!VN)throw new Error("Non little-endian hardware is not supported");function KN(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Km(e){if(typeof e=="string"&&(e=KN(e)),!MM(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}function ZN(...e){const t=new Uint8Array(e.reduce((n,s)=>n+s.length,0));let r=0;return e.forEach(n=>{if(!MM(n))throw new Error("Uint8Array expected");t.set(n,r),r+=n.length}),t}let _M=class{clone(){return this._cloneInto()}};function GN(e){const t=n=>e().update(Km(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function EM(e=32){if(qp&&typeof qp.getRandomValues=="function")return qp.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function JN(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);const s=BigInt(32),i=BigInt(4294967295),u=Number(r>>s&i),d=Number(r&i),c=n?4:0,b=n?0:4;e.setUint32(t+c,u,n),e.setUint32(t+b,d,n)}let YN=class extends _M{constructor(t,r,n,s){super(),this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Fp(this.buffer)}update(t){t0(this);const{view:r,buffer:n,blockLen:s}=this;t=Km(t);const i=t.length;for(let u=0;u<i;){const d=Math.min(s-this.pos,i-u);if(d===s){const c=Fp(t);for(;s<=i-u;u+=s)this.process(c,u);continue}n.set(t.subarray(u,u+d),this.pos),this.pos+=d,u+=d,this.pos===s&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){t0(this),WN(t,this),this.finished=!0;const{buffer:r,view:n,blockLen:s,isLE:i}=this;let{pos:u}=this;r[u++]=128,this.buffer.subarray(u).fill(0),this.padOffset>s-u&&(this.process(n,0),u=0);for(let M=u;M<s;M++)r[M]=0;JN(n,s-8,BigInt(this.length*8),i),this.process(n,0);const d=Fp(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const b=c/4,w=this.get();if(b>w.length)throw new Error("_sha2: outputLen bigger than state");for(let M=0;M<b;M++)d.setUint32(4*M,w[M],i)}digest(){const{buffer:t,outputLen:r}=this;this.digestInto(t);const n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:r,buffer:n,length:s,finished:i,destroyed:u,pos:d}=this;return t.length=s,t.pos=d,t.finished=i,t.destroyed=u,s%r&&t.buffer.set(n),t}};const XN=(e,t,r)=>e&t^~e&r,QN=(e,t,r)=>e&t^e&r^t&r,eT=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Uo=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),jo=new Uint32Array(64);let tT=class extends YN{constructor(){super(64,32,8,!1),this.A=Uo[0]|0,this.B=Uo[1]|0,this.C=Uo[2]|0,this.D=Uo[3]|0,this.E=Uo[4]|0,this.F=Uo[5]|0,this.G=Uo[6]|0,this.H=Uo[7]|0}get(){const{A:t,B:r,C:n,D:s,E:i,F:u,G:d,H:c}=this;return[t,r,n,s,i,u,d,c]}set(t,r,n,s,i,u,d,c){this.A=t|0,this.B=r|0,this.C=n|0,this.D=s|0,this.E=i|0,this.F=u|0,this.G=d|0,this.H=c|0}process(t,r){for(let M=0;M<16;M++,r+=4)jo[M]=t.getUint32(r,!1);for(let M=16;M<64;M++){const _=jo[M-15],A=jo[M-2],R=si(_,7)^si(_,18)^_>>>3,B=si(A,17)^si(A,19)^A>>>10;jo[M]=B+jo[M-7]+R+jo[M-16]|0}let{A:n,B:s,C:i,D:u,E:d,F:c,G:b,H:w}=this;for(let M=0;M<64;M++){const _=si(d,6)^si(d,11)^si(d,25),A=w+_+XN(d,c,b)+eT[M]+jo[M]|0,B=(si(n,2)^si(n,13)^si(n,22))+QN(n,s,i)|0;w=b,b=c,c=d,d=u+A|0,u=i,i=s,s=n,n=A+B|0}n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,u=u+this.D|0,d=d+this.E|0,c=c+this.F|0,b=b+this.G|0,w=w+this.H|0,this.set(n,s,i,u,d,c,b,w)}roundClean(){jo.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Lg=GN(()=>new tT);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const SM=BigInt(0),K0=BigInt(1),rT=BigInt(2),Z0=e=>e instanceof Uint8Array,nT=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Ff(e){if(!Z0(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=nT[e[r]];return t}function AM(e){const t=e.toString(16);return t.length&1?`0${t}`:t}function Zm(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return BigInt(e===""?"0":`0x${e}`)}function Hf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(t/2);for(let n=0;n<r.length;n++){const s=n*2,i=e.slice(s,s+2),u=Number.parseInt(i,16);if(Number.isNaN(u)||u<0)throw new Error("Invalid byte sequence");r[n]=u}return r}function en(e){return Zm(Ff(e))}function Gm(e){if(!Z0(e))throw new Error("Uint8Array expected");return Zm(Ff(Uint8Array.from(e).reverse()))}function _s(e,t){return Hf(e.toString(16).padStart(t*2,"0"))}function Jm(e,t){return _s(e,t).reverse()}function iT(e){return Hf(AM(e))}function Tr(e,t,r){let n;if(typeof t=="string")try{n=Hf(t)}catch(i){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${i}`)}else if(Z0(t))n=Uint8Array.from(t);else throw new Error(`${e} must be hex string or Uint8Array`);const s=n.length;if(typeof r=="number"&&s!==r)throw new Error(`${e} expected ${r} bytes, got ${s}`);return n}function ka(...e){const t=new Uint8Array(e.reduce((n,s)=>n+s.length,0));let r=0;return e.forEach(n=>{if(!Z0(n))throw new Error("Uint8Array expected");t.set(n,r),r+=n.length}),t}function oT(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function sT(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function aT(e){let t;for(t=0;e>SM;e>>=K0,t+=1);return t}function fT(e,t){return e>>BigInt(t)&K0}const lT=(e,t,r)=>e|(r?K0:SM)<<BigInt(t),Ym=e=>(rT<<BigInt(e-1))-K0,Hp=e=>new Uint8Array(e),L3=e=>Uint8Array.from(e);function kM(e,t,r){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=Hp(e),s=Hp(e),i=0;const u=()=>{n.fill(1),s.fill(0),i=0},d=(...M)=>r(s,n,...M),c=(M=Hp())=>{s=d(L3([0]),M),n=d(),M.length!==0&&(s=d(L3([1]),M),n=d())},b=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let M=0;const _=[];for(;M<t;){n=d();const A=n.slice();_.push(A),M+=n.length}return ka(..._)};return(M,_)=>{u(),c(M);let A;for(;!(A=_(b()));)c();return u(),A}}const uT={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function Qu(e,t,r={}){const n=(s,i,u)=>{const d=uT[i];if(typeof d!="function")throw new Error(`Invalid validator "${i}", expected function`);const c=e[s];if(!(u&&c===void 0)&&!d(c,e))throw new Error(`Invalid param ${String(s)}=${c} (${typeof c}), expected ${i}`)};for(const[s,i]of Object.entries(t))n(s,i,!1);for(const[s,i]of Object.entries(r))n(s,i,!0);return e}const hT=Object.freeze(Object.defineProperty({__proto__:null,bitGet:fT,bitLen:aT,bitMask:Ym,bitSet:lT,bytesToHex:Ff,bytesToNumberBE:en,bytesToNumberLE:Gm,concatBytes:ka,createHmacDrbg:kM,ensureBytes:Tr,equalBytes:oT,hexToBytes:Hf,hexToNumber:Zm,numberToBytesBE:_s,numberToBytesLE:Jm,numberToHexUnpadded:AM,numberToVarBytesBE:iT,utf8ToBytes:sT,validateObject:Qu},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const hr=BigInt(0),Gt=BigInt(1),ea=BigInt(2),cT=BigInt(3),Og=BigInt(4),O3=BigInt(5),U3=BigInt(8);BigInt(9);BigInt(16);function br(e,t){const r=e%t;return r>=hr?r:t+r}function dT(e,t,r){if(r<=hr||t<hr)throw new Error("Expected power/modulo > 0");if(r===Gt)return hr;let n=Gt;for(;t>hr;)t&Gt&&(n=n*e%r),e=e*e%r,t>>=Gt;return n}function mn(e,t,r){let n=e;for(;t-- >hr;)n*=n,n%=r;return n}function Ug(e,t){if(e===hr||t<=hr)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=br(e,t),n=t,s=hr,i=Gt;for(;r!==hr;){const d=n/r,c=n%r,b=s-i*d;n=r,r=c,s=i,i=b}if(n!==Gt)throw new Error("invert: does not exist");return br(s,t)}function pT(e){const t=(e-Gt)/ea;let r,n,s;for(r=e-Gt,n=0;r%ea===hr;r/=ea,n++);for(s=ea;s<e&&dT(s,t,e)!==e-Gt;s++);if(n===1){const u=(e+Gt)/Og;return function(c,b){const w=c.pow(b,u);if(!c.eql(c.sqr(w),b))throw new Error("Cannot find square root");return w}}const i=(r+Gt)/ea;return function(d,c){if(d.pow(c,t)===d.neg(d.ONE))throw new Error("Cannot find square root");let b=n,w=d.pow(d.mul(d.ONE,s),r),M=d.pow(c,i),_=d.pow(c,r);for(;!d.eql(_,d.ONE);){if(d.eql(_,d.ZERO))return d.ZERO;let A=1;for(let B=d.sqr(_);A<b&&!d.eql(B,d.ONE);A++)B=d.sqr(B);const R=d.pow(w,Gt<<BigInt(b-A-1));w=d.sqr(R),M=d.mul(M,R),_=d.mul(_,w),b=A}return M}}function vT(e){if(e%Og===cT){const t=(e+Gt)/Og;return function(n,s){const i=n.pow(s,t);if(!n.eql(n.sqr(i),s))throw new Error("Cannot find square root");return i}}if(e%U3===O3){const t=(e-O3)/U3;return function(n,s){const i=n.mul(s,ea),u=n.pow(i,t),d=n.mul(s,u),c=n.mul(n.mul(d,ea),u),b=n.mul(d,n.sub(c,n.ONE));if(!n.eql(n.sqr(b),s))throw new Error("Cannot find square root");return b}}return pT(e)}const gT=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function yT(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=gT.reduce((n,s)=>(n[s]="function",n),t);return Qu(e,r)}function mT(e,t,r){if(r<hr)throw new Error("Expected power > 0");if(r===hr)return e.ONE;if(r===Gt)return t;let n=e.ONE,s=t;for(;r>hr;)r&Gt&&(n=e.mul(n,s)),s=e.sqr(s),r>>=Gt;return n}function wT(e,t){const r=new Array(t.length),n=t.reduce((i,u,d)=>e.is0(u)?i:(r[d]=i,e.mul(i,u)),e.ONE),s=e.inv(n);return t.reduceRight((i,u,d)=>e.is0(u)?i:(r[d]=e.mul(i,r[d]),e.mul(i,u)),s),r}function BM(e,t){const r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function bT(e,t,r=!1,n={}){if(e<=hr)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:s,nByteLength:i}=BM(e,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const u=vT(e),d=Object.freeze({ORDER:e,BITS:s,BYTES:i,MASK:Ym(s),ZERO:hr,ONE:Gt,create:c=>br(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return hr<=c&&c<e},is0:c=>c===hr,isOdd:c=>(c&Gt)===Gt,neg:c=>br(-c,e),eql:(c,b)=>c===b,sqr:c=>br(c*c,e),add:(c,b)=>br(c+b,e),sub:(c,b)=>br(c-b,e),mul:(c,b)=>br(c*b,e),pow:(c,b)=>mT(d,c,b),div:(c,b)=>br(c*Ug(b,e),e),sqrN:c=>c*c,addN:(c,b)=>c+b,subN:(c,b)=>c-b,mulN:(c,b)=>c*b,inv:c=>Ug(c,e),sqrt:n.sqrt||(c=>u(d,c)),invertBatch:c=>wT(d,c),cmov:(c,b,w)=>w?b:c,toBytes:c=>r?Jm(c,i):_s(c,i),fromBytes:c=>{if(c.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${c.length}`);return r?Gm(c):en(c)}});return Object.freeze(d)}function RM(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function $M(e){const t=RM(e);return t+Math.ceil(t/2)}function xT(e,t,r=!1){const n=e.length,s=RM(t),i=$M(t);if(n<16||n<i||n>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);const u=r?en(e):Gm(e),d=br(u,t-Gt)+Gt;return r?Jm(d,s):_s(d,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const MT=BigInt(0),zp=BigInt(1);function _T(e,t){const r=(s,i)=>{const u=i.negate();return s?u:i},n=s=>{const i=Math.ceil(t/s)+1,u=2**(s-1);return{windows:i,windowSize:u}};return{constTimeNegate:r,unsafeLadder(s,i){let u=e.ZERO,d=s;for(;i>MT;)i&zp&&(u=u.add(d)),d=d.double(),i>>=zp;return u},precomputeWindow(s,i){const{windows:u,windowSize:d}=n(i),c=[];let b=s,w=b;for(let M=0;M<u;M++){w=b,c.push(w);for(let _=1;_<d;_++)w=w.add(b),c.push(w);b=w.double()}return c},wNAF(s,i,u){const{windows:d,windowSize:c}=n(s);let b=e.ZERO,w=e.BASE;const M=BigInt(2**s-1),_=2**s,A=BigInt(s);for(let R=0;R<d;R++){const B=R*c;let I=Number(u&M);u>>=A,I>c&&(I-=_,u+=zp);const E=B,k=B+Math.abs(I)-1,T=R%2!==0,L=I<0;I===0?w=w.add(r(T,i[E])):b=b.add(r(L,i[k]))}return{p:b,f:w}},wNAFCached(s,i,u,d){const c=s._WINDOW_SIZE||1;let b=i.get(s);return b||(b=this.precomputeWindow(s,c),c!==1&&i.set(s,d(b))),this.wNAF(c,b,u)}}}function NM(e){return yT(e.Fp),Qu(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...BM(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ET(e){const t=NM(e);Qu(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:s}=t;if(r){if(!n.eql(s,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:ST,hexToBytes:AT}=hT,ua={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(e){const{Err:t}=ua;if(e.length<2||e[0]!==2)throw new t("Invalid signature integer tag");const r=e[1],n=e.subarray(2,r+2);if(!r||n.length!==r)throw new t("Invalid signature integer: wrong length");if(n[0]&128)throw new t("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:ST(n),l:e.subarray(r+2)}},toSig(e){const{Err:t}=ua,r=typeof e=="string"?AT(e):e;if(!(r instanceof Uint8Array))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new t("Invalid signature tag");if(r[1]!==n-2)throw new t("Invalid signature: incorrect length");const{d:s,l:i}=ua._parseInt(r.subarray(2)),{d:u,l:d}=ua._parseInt(i);if(d.length)throw new t("Invalid signature: left bytes after parsing");return{r:s,s:u}},hexFromSig(e){const t=b=>Number.parseInt(b[0],16)&8?"00"+b:b,r=b=>{const w=b.toString(16);return w.length&1?`0${w}`:w},n=t(r(e.s)),s=t(r(e.r)),i=n.length/2,u=s.length/2,d=r(i),c=r(u);return`30${r(u+i+4)}02${c}${s}02${d}${n}`}},Ji=BigInt(0),xn=BigInt(1);BigInt(2);const j3=BigInt(3);BigInt(4);function kT(e){const t=ET(e),{Fp:r}=t,n=t.toBytes||((R,B,I)=>{const E=B.toAffine();return ka(Uint8Array.from([4]),r.toBytes(E.x),r.toBytes(E.y))}),s=t.fromBytes||(R=>{const B=R.subarray(1),I=r.fromBytes(B.subarray(0,r.BYTES)),E=r.fromBytes(B.subarray(r.BYTES,2*r.BYTES));return{x:I,y:E}});function i(R){const{a:B,b:I}=t,E=r.sqr(R),k=r.mul(E,R);return r.add(r.add(k,r.mul(R,B)),I)}if(!r.eql(r.sqr(t.Gy),i(t.Gx)))throw new Error("bad generator point: equation left != right");function u(R){return typeof R=="bigint"&&Ji<R&&R<t.n}function d(R){if(!u(R))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function c(R){const{allowedPrivateKeyLengths:B,nByteLength:I,wrapPrivateKey:E,n:k}=t;if(B&&typeof R!="bigint"){if(R instanceof Uint8Array&&(R=Ff(R)),typeof R!="string"||!B.includes(R.length))throw new Error("Invalid key");R=R.padStart(I*2,"0")}let T;try{T=typeof R=="bigint"?R:en(Tr("private key",R,I))}catch{throw new Error(`private key must be ${I} bytes, hex or bigint, not ${typeof R}`)}return E&&(T=br(T,k)),d(T),T}const b=new Map;function w(R){if(!(R instanceof M))throw new Error("ProjectivePoint expected")}class M{constructor(B,I,E){if(this.px=B,this.py=I,this.pz=E,B==null||!r.isValid(B))throw new Error("x required");if(I==null||!r.isValid(I))throw new Error("y required");if(E==null||!r.isValid(E))throw new Error("z required")}static fromAffine(B){const{x:I,y:E}=B||{};if(!B||!r.isValid(I)||!r.isValid(E))throw new Error("invalid affine point");if(B instanceof M)throw new Error("projective point not allowed");const k=T=>r.eql(T,r.ZERO);return k(I)&&k(E)?M.ZERO:new M(I,E,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(B){const I=r.invertBatch(B.map(E=>E.pz));return B.map((E,k)=>E.toAffine(I[k])).map(M.fromAffine)}static fromHex(B){const I=M.fromAffine(s(Tr("pointHex",B)));return I.assertValidity(),I}static fromPrivateKey(B){return M.BASE.multiply(c(B))}_setWindowSize(B){this._WINDOW_SIZE=B,b.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:B,y:I}=this.toAffine();if(!r.isValid(B)||!r.isValid(I))throw new Error("bad point: x or y not FE");const E=r.sqr(I),k=i(B);if(!r.eql(E,k))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:B}=this.toAffine();if(r.isOdd)return!r.isOdd(B);throw new Error("Field doesn't support isOdd")}equals(B){w(B);const{px:I,py:E,pz:k}=this,{px:T,py:L,pz:q}=B,z=r.eql(r.mul(I,q),r.mul(T,k)),J=r.eql(r.mul(E,q),r.mul(L,k));return z&&J}negate(){return new M(this.px,r.neg(this.py),this.pz)}double(){const{a:B,b:I}=t,E=r.mul(I,j3),{px:k,py:T,pz:L}=this;let q=r.ZERO,z=r.ZERO,J=r.ZERO,F=r.mul(k,k),X=r.mul(T,T),ee=r.mul(L,L),x=r.mul(k,T);return x=r.add(x,x),J=r.mul(k,L),J=r.add(J,J),q=r.mul(B,J),z=r.mul(E,ee),z=r.add(q,z),q=r.sub(X,z),z=r.add(X,z),z=r.mul(q,z),q=r.mul(x,q),J=r.mul(E,J),ee=r.mul(B,ee),x=r.sub(F,ee),x=r.mul(B,x),x=r.add(x,J),J=r.add(F,F),F=r.add(J,F),F=r.add(F,ee),F=r.mul(F,x),z=r.add(z,F),ee=r.mul(T,L),ee=r.add(ee,ee),F=r.mul(ee,x),q=r.sub(q,F),J=r.mul(ee,X),J=r.add(J,J),J=r.add(J,J),new M(q,z,J)}add(B){w(B);const{px:I,py:E,pz:k}=this,{px:T,py:L,pz:q}=B;let z=r.ZERO,J=r.ZERO,F=r.ZERO;const X=t.a,ee=r.mul(t.b,j3);let x=r.mul(I,T),o=r.mul(E,L),f=r.mul(k,q),l=r.add(I,E),h=r.add(T,L);l=r.mul(l,h),h=r.add(x,o),l=r.sub(l,h),h=r.add(I,k);let v=r.add(T,q);return h=r.mul(h,v),v=r.add(x,f),h=r.sub(h,v),v=r.add(E,k),z=r.add(L,q),v=r.mul(v,z),z=r.add(o,f),v=r.sub(v,z),F=r.mul(X,h),z=r.mul(ee,f),F=r.add(z,F),z=r.sub(o,F),F=r.add(o,F),J=r.mul(z,F),o=r.add(x,x),o=r.add(o,x),f=r.mul(X,f),h=r.mul(ee,h),o=r.add(o,f),f=r.sub(x,f),f=r.mul(X,f),h=r.add(h,f),x=r.mul(o,h),J=r.add(J,x),x=r.mul(v,h),z=r.mul(l,z),z=r.sub(z,x),x=r.mul(l,o),F=r.mul(v,F),F=r.add(F,x),new M(z,J,F)}subtract(B){return this.add(B.negate())}is0(){return this.equals(M.ZERO)}wNAF(B){return A.wNAFCached(this,b,B,I=>{const E=r.invertBatch(I.map(k=>k.pz));return I.map((k,T)=>k.toAffine(E[T])).map(M.fromAffine)})}multiplyUnsafe(B){const I=M.ZERO;if(B===Ji)return I;if(d(B),B===xn)return this;const{endo:E}=t;if(!E)return A.unsafeLadder(this,B);let{k1neg:k,k1:T,k2neg:L,k2:q}=E.splitScalar(B),z=I,J=I,F=this;for(;T>Ji||q>Ji;)T&xn&&(z=z.add(F)),q&xn&&(J=J.add(F)),F=F.double(),T>>=xn,q>>=xn;return k&&(z=z.negate()),L&&(J=J.negate()),J=new M(r.mul(J.px,E.beta),J.py,J.pz),z.add(J)}multiply(B){d(B);let I=B,E,k;const{endo:T}=t;if(T){const{k1neg:L,k1:q,k2neg:z,k2:J}=T.splitScalar(I);let{p:F,f:X}=this.wNAF(q),{p:ee,f:x}=this.wNAF(J);F=A.constTimeNegate(L,F),ee=A.constTimeNegate(z,ee),ee=new M(r.mul(ee.px,T.beta),ee.py,ee.pz),E=F.add(ee),k=X.add(x)}else{const{p:L,f:q}=this.wNAF(I);E=L,k=q}return M.normalizeZ([E,k])[0]}multiplyAndAddUnsafe(B,I,E){const k=M.BASE,T=(q,z)=>z===Ji||z===xn||!q.equals(k)?q.multiplyUnsafe(z):q.multiply(z),L=T(this,I).add(T(B,E));return L.is0()?void 0:L}toAffine(B){const{px:I,py:E,pz:k}=this,T=this.is0();B==null&&(B=T?r.ONE:r.inv(k));const L=r.mul(I,B),q=r.mul(E,B),z=r.mul(k,B);if(T)return{x:r.ZERO,y:r.ZERO};if(!r.eql(z,r.ONE))throw new Error("invZ was invalid");return{x:L,y:q}}isTorsionFree(){const{h:B,isTorsionFree:I}=t;if(B===xn)return!0;if(I)return I(M,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:B,clearCofactor:I}=t;return B===xn?this:I?I(M,this):this.multiplyUnsafe(t.h)}toRawBytes(B=!0){return this.assertValidity(),n(M,this,B)}toHex(B=!0){return Ff(this.toRawBytes(B))}}M.BASE=new M(t.Gx,t.Gy,r.ONE),M.ZERO=new M(r.ZERO,r.ONE,r.ZERO);const _=t.nBitLength,A=_T(M,t.endo?Math.ceil(_/2):_);return{CURVE:t,ProjectivePoint:M,normPrivateKeyToScalar:c,weierstrassEquation:i,isWithinCurveOrder:u}}function BT(e){const t=NM(e);return Qu(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function RT(e){const t=BT(e),{Fp:r,n}=t,s=r.BYTES+1,i=2*r.BYTES+1;function u(h){return Ji<h&&h<r.ORDER}function d(h){return br(h,n)}function c(h){return Ug(h,n)}const{ProjectivePoint:b,normPrivateKeyToScalar:w,weierstrassEquation:M,isWithinCurveOrder:_}=kT({...t,toBytes(h,v,y){const m=v.toAffine(),p=r.toBytes(m.x),a=ka;return y?a(Uint8Array.from([v.hasEvenY()?2:3]),p):a(Uint8Array.from([4]),p,r.toBytes(m.y))},fromBytes(h){const v=h.length,y=h[0],m=h.subarray(1);if(v===s&&(y===2||y===3)){const p=en(m);if(!u(p))throw new Error("Point is not on curve");const a=M(p);let g=r.sqrt(a);const S=(g&xn)===xn;return(y&1)===1!==S&&(g=r.neg(g)),{x:p,y:g}}else if(v===i&&y===4){const p=r.fromBytes(m.subarray(0,r.BYTES)),a=r.fromBytes(m.subarray(r.BYTES,2*r.BYTES));return{x:p,y:a}}else throw new Error(`Point of length ${v} was invalid. Expected ${s} compressed bytes or ${i} uncompressed bytes`)}}),A=h=>Ff(_s(h,t.nByteLength));function R(h){const v=n>>xn;return h>v}function B(h){return R(h)?d(-h):h}const I=(h,v,y)=>en(h.slice(v,y));class E{constructor(v,y,m){this.r=v,this.s=y,this.recovery=m,this.assertValidity()}static fromCompact(v){const y=t.nByteLength;return v=Tr("compactSignature",v,y*2),new E(I(v,0,y),I(v,y,2*y))}static fromDER(v){const{r:y,s:m}=ua.toSig(Tr("DER",v));return new E(y,m)}assertValidity(){if(!_(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!_(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(v){return new E(this.r,this.s,v)}recoverPublicKey(v){const{r:y,s:m,recovery:p}=this,a=J(Tr("msgHash",v));if(p==null||![0,1,2,3].includes(p))throw new Error("recovery id invalid");const g=p===2||p===3?y+t.n:y;if(g>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const S=p&1?"03":"02",N=b.fromHex(S+A(g)),U=c(g),Z=d(-a*U),H=d(m*U),$=b.BASE.multiplyAndAddUnsafe(N,Z,H);if(!$)throw new Error("point at infinify");return $.assertValidity(),$}hasHighS(){return R(this.s)}normalizeS(){return this.hasHighS()?new E(this.r,d(-this.s),this.recovery):this}toDERRawBytes(){return Hf(this.toDERHex())}toDERHex(){return ua.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Hf(this.toCompactHex())}toCompactHex(){return A(this.r)+A(this.s)}}const k={isValidPrivateKey(h){try{return w(h),!0}catch{return!1}},normPrivateKeyToScalar:w,randomPrivateKey:()=>{const h=$M(t.n);return xT(t.randomBytes(h),t.n)},precompute(h=8,v=b.BASE){return v._setWindowSize(h),v.multiply(BigInt(3)),v}};function T(h,v=!0){return b.fromPrivateKey(h).toRawBytes(v)}function L(h){const v=h instanceof Uint8Array,y=typeof h=="string",m=(v||y)&&h.length;return v?m===s||m===i:y?m===2*s||m===2*i:h instanceof b}function q(h,v,y=!0){if(L(h))throw new Error("first arg must be private key");if(!L(v))throw new Error("second arg must be public key");return b.fromHex(v).multiply(w(h)).toRawBytes(y)}const z=t.bits2int||function(h){const v=en(h),y=h.length*8-t.nBitLength;return y>0?v>>BigInt(y):v},J=t.bits2int_modN||function(h){return d(z(h))},F=Ym(t.nBitLength);function X(h){if(typeof h!="bigint")throw new Error("bigint expected");if(!(Ji<=h&&h<F))throw new Error(`bigint expected < 2^${t.nBitLength}`);return _s(h,t.nByteLength)}function ee(h,v,y=x){if(["recovered","canonical"].some(W=>W in y))throw new Error("sign() legacy options not supported");const{hash:m,randomBytes:p}=t;let{lowS:a,prehash:g,extraEntropy:S}=y;a==null&&(a=!0),h=Tr("msgHash",h),g&&(h=Tr("prehashed msgHash",m(h)));const N=J(h),U=w(v),Z=[X(U),X(N)];if(S!=null){const W=S===!0?p(r.BYTES):S;Z.push(Tr("extraEntropy",W))}const H=ka(...Z),$=N;function P(W){const G=z(W);if(!_(G))return;const K=c(G),O=b.BASE.multiply(G).toAffine(),Q=d(O.x);if(Q===Ji)return;const de=d(K*d($+Q*U));if(de===Ji)return;let oe=(O.x===Q?0:2)|Number(O.y&xn),se=de;return a&&R(de)&&(se=B(de),oe^=1),new E(Q,se,oe)}return{seed:H,k2sig:P}}const x={lowS:t.lowS,prehash:!1},o={lowS:t.lowS,prehash:!1};function f(h,v,y=x){const{seed:m,k2sig:p}=ee(h,v,y),a=t;return kM(a.hash.outputLen,a.nByteLength,a.hmac)(m,p)}b.BASE._setWindowSize(8);function l(h,v,y,m=o){var O;const p=h;if(v=Tr("msgHash",v),y=Tr("publicKey",y),"strict"in m)throw new Error("options.strict was renamed to lowS");const{lowS:a,prehash:g}=m;let S,N;try{if(typeof p=="string"||p instanceof Uint8Array)try{S=E.fromDER(p)}catch(Q){if(!(Q instanceof ua.Err))throw Q;S=E.fromCompact(p)}else if(typeof p=="object"&&typeof p.r=="bigint"&&typeof p.s=="bigint"){const{r:Q,s:de}=p;S=new E(Q,de)}else throw new Error("PARSE");N=b.fromHex(y)}catch(Q){if(Q.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(a&&S.hasHighS())return!1;g&&(v=t.hash(v));const{r:U,s:Z}=S,H=J(v),$=c(Z),P=d(H*$),W=d(U*$),G=(O=b.BASE.multiplyAndAddUnsafe(N,P,W))==null?void 0:O.toAffine();return G?d(G.x)===U:!1}return{CURVE:t,getPublicKey:T,getSharedSecret:q,sign:f,verify:l,ProjectivePoint:b,Signature:E,utils:k}}let TM=class extends _M{constructor(t,r){super(),this.finished=!1,this.destroyed=!1,zN(t);const n=Km(r);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(n.length>s?t.create().update(n).digest():n);for(let u=0;u<i.length;u++)i[u]^=54;this.iHash.update(i),this.oHash=t.create();for(let u=0;u<i.length;u++)i[u]^=106;this.oHash.update(i),i.fill(0)}update(t){return t0(this),this.iHash.update(t),this}digestInto(t){t0(this),xM(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:r,iHash:n,finished:s,destroyed:i,blockLen:u,outputLen:d}=this;return t=t,t.finished=s,t.destroyed=i,t.blockLen=u,t.outputLen=d,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const IM=(e,t,r)=>new TM(e,t).update(r).digest();IM.create=(e,t)=>new TM(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function $T(e){return{hash:e,hmac:(t,...r)=>IM(e,t,ZN(...r)),randomBytes:EM}}function NT(e,t){const r=n=>RT({...e,...$T(n)});return Object.freeze({...r(t),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const G0=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),r0=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),CM=BigInt(1),n0=BigInt(2),D3=(e,t)=>(e+t/n0)/t;function PM(e){const t=G0,r=BigInt(3),n=BigInt(6),s=BigInt(11),i=BigInt(22),u=BigInt(23),d=BigInt(44),c=BigInt(88),b=e*e*e%t,w=b*b*e%t,M=mn(w,r,t)*w%t,_=mn(M,r,t)*w%t,A=mn(_,n0,t)*b%t,R=mn(A,s,t)*A%t,B=mn(R,i,t)*R%t,I=mn(B,d,t)*B%t,E=mn(I,c,t)*I%t,k=mn(E,d,t)*B%t,T=mn(k,r,t)*w%t,L=mn(T,u,t)*R%t,q=mn(L,n,t)*b%t,z=mn(q,n0,t);if(!jg.eql(jg.sqr(z),e))throw new Error("Cannot find square root");return z}const jg=bT(G0,void 0,void 0,{sqrt:PM}),dl=NT({a:BigInt(0),b:BigInt(7),Fp:jg,n:r0,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=r0,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-CM*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=r,u=BigInt("0x100000000000000000000000000000000"),d=D3(i*e,t),c=D3(-n*e,t);let b=br(e-d*r-c*s,t),w=br(-d*n-c*i,t);const M=b>u,_=w>u;if(M&&(b=t-b),_&&(w=t-w),b>u||w>u)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:M,k1:b,k2neg:_,k2:w}}}},Lg),J0=BigInt(0),LM=e=>typeof e=="bigint"&&J0<e&&e<G0,TT=e=>typeof e=="bigint"&&J0<e&&e<r0,q3={};function i0(e,...t){let r=q3[e];if(r===void 0){const n=Lg(Uint8Array.from(e,s=>s.charCodeAt(0)));r=ka(n,n),q3[e]=r}return Lg(ka(r,...t))}const Xm=e=>e.toRawBytes(!0).slice(1),Dg=e=>_s(e,32),Wp=e=>br(e,G0),Lu=e=>br(e,r0),Qm=dl.ProjectivePoint,IT=(e,t,r)=>Qm.BASE.multiplyAndAddUnsafe(e,t,r);function qg(e){let t=dl.utils.normPrivateKeyToScalar(e),r=Qm.fromPrivateKey(t);return{scalar:r.hasEvenY()?t:Lu(-t),bytes:Xm(r)}}function OM(e){if(!LM(e))throw new Error("bad x: need 0 < x < p");const t=Wp(e*e),r=Wp(t*e+BigInt(7));let n=PM(r);n%n0!==J0&&(n=Wp(-n));const s=new Qm(e,n,CM);return s.assertValidity(),s}function UM(...e){return Lu(en(i0("BIP0340/challenge",...e)))}function CT(e){return qg(e).bytes}function PT(e,t,r=EM(32)){const n=Tr("message",e),{bytes:s,scalar:i}=qg(t),u=Tr("auxRand",r,32),d=Dg(i^en(i0("BIP0340/aux",u))),c=i0("BIP0340/nonce",d,s,n),b=Lu(en(c));if(b===J0)throw new Error("sign failed: k is zero");const{bytes:w,scalar:M}=qg(b),_=UM(w,s,n),A=new Uint8Array(64);if(A.set(w,0),A.set(Dg(Lu(M+_*i)),32),!jM(A,n,s))throw new Error("sign: Invalid signature produced");return A}function jM(e,t,r){const n=Tr("signature",e,64),s=Tr("message",t),i=Tr("publicKey",r,32);try{const u=OM(en(i)),d=en(n.subarray(0,32));if(!LM(d))return!1;const c=en(n.subarray(32,64));if(!TT(c))return!1;const b=UM(Dg(d),Xm(u),s),w=IT(u,c,Lu(-b));return!(!w||!w.hasEvenY()||w.toAffine().x!==d)}catch{return!1}}const Dl={getPublicKey:CT,sign:PT,verify:jM,utils:{randomPrivateKey:dl.utils.randomPrivateKey,lift_x:OM,pointToBytes:Xm,numberToBytesBE:_s,bytesToNumberBE:en,taggedHash:i0,mod:br}},Vp=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e2=e=>e instanceof Uint8Array,Kp=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),ai=(e,t)=>e<<32-t|e>>>t,LT=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!LT)throw new Error("Non little-endian hardware is not supported");const OT=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Pr(e){if(!e2(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=OT[e[r]];return t}function Ba(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(t/2);for(let n=0;n<r.length;n++){const s=n*2,i=e.slice(s,s+2),u=Number.parseInt(i,16);if(Number.isNaN(u)||u<0)throw new Error("Invalid byte sequence");r[n]=u}return r}function UT(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Ou(e){if(typeof e=="string"&&(e=UT(e)),!e2(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}function Y0(...e){const t=new Uint8Array(e.reduce((n,s)=>n+s.length,0));let r=0;return e.forEach(n=>{if(!e2(n))throw new Error("Uint8Array expected");t.set(n,r),r+=n.length}),t}let DM=class{clone(){return this._cloneInto()}};function qM(e){const t=n=>e().update(Ou(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function FM(e=32){if(Vp&&typeof Vp.getRandomValues=="function")return Vp.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function Fg(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function jT(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}function HM(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function DT(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Fg(e.outputLen),Fg(e.blockLen)}function qT(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function FT(e,t){HM(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}const wi={number:Fg,bool:jT,bytes:HM,hash:DT,exists:qT,output:FT};function HT(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);const s=BigInt(32),i=BigInt(4294967295),u=Number(r>>s&i),d=Number(r&i),c=n?4:0,b=n?0:4;e.setUint32(t+c,u,n),e.setUint32(t+b,d,n)}let zT=class extends DM{constructor(t,r,n,s){super(),this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Kp(this.buffer)}update(t){wi.exists(this);const{view:r,buffer:n,blockLen:s}=this;t=Ou(t);const i=t.length;for(let u=0;u<i;){const d=Math.min(s-this.pos,i-u);if(d===s){const c=Kp(t);for(;s<=i-u;u+=s)this.process(c,u);continue}n.set(t.subarray(u,u+d),this.pos),this.pos+=d,u+=d,this.pos===s&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){wi.exists(this),wi.output(t,this),this.finished=!0;const{buffer:r,view:n,blockLen:s,isLE:i}=this;let{pos:u}=this;r[u++]=128,this.buffer.subarray(u).fill(0),this.padOffset>s-u&&(this.process(n,0),u=0);for(let M=u;M<s;M++)r[M]=0;HT(n,s-8,BigInt(this.length*8),i),this.process(n,0);const d=Kp(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const b=c/4,w=this.get();if(b>w.length)throw new Error("_sha2: outputLen bigger than state");for(let M=0;M<b;M++)d.setUint32(4*M,w[M],i)}digest(){const{buffer:t,outputLen:r}=this;this.digestInto(t);const n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:r,buffer:n,length:s,finished:i,destroyed:u,pos:d}=this;return t.length=s,t.pos=d,t.finished=i,t.destroyed=u,s%r&&t.buffer.set(n),t}};const WT=(e,t,r)=>e&t^~e&r,VT=(e,t,r)=>e&t^e&r^t&r,KT=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Do=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),qo=new Uint32Array(64);let zM=class extends zT{constructor(){super(64,32,8,!1),this.A=Do[0]|0,this.B=Do[1]|0,this.C=Do[2]|0,this.D=Do[3]|0,this.E=Do[4]|0,this.F=Do[5]|0,this.G=Do[6]|0,this.H=Do[7]|0}get(){const{A:t,B:r,C:n,D:s,E:i,F:u,G:d,H:c}=this;return[t,r,n,s,i,u,d,c]}set(t,r,n,s,i,u,d,c){this.A=t|0,this.B=r|0,this.C=n|0,this.D=s|0,this.E=i|0,this.F=u|0,this.G=d|0,this.H=c|0}process(t,r){for(let M=0;M<16;M++,r+=4)qo[M]=t.getUint32(r,!1);for(let M=16;M<64;M++){const _=qo[M-15],A=qo[M-2],R=ai(_,7)^ai(_,18)^_>>>3,B=ai(A,17)^ai(A,19)^A>>>10;qo[M]=B+qo[M-7]+R+qo[M-16]|0}let{A:n,B:s,C:i,D:u,E:d,F:c,G:b,H:w}=this;for(let M=0;M<64;M++){const _=ai(d,6)^ai(d,11)^ai(d,25),A=w+_+WT(d,c,b)+KT[M]+qo[M]|0,B=(ai(n,2)^ai(n,13)^ai(n,22))+VT(n,s,i)|0;w=b,b=c,c=d,d=u+A|0,u=i,i=s,s=n,n=A+B|0}n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,u=u+this.D|0,d=d+this.E|0,c=c+this.F|0,b=b+this.G|0,w=w+this.H|0,this.set(n,s,i,u,d,c,b,w)}roundClean(){qo.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},ZT=class extends zM{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}};const Da=qM(()=>new zM);qM(()=>new ZT);/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function pl(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function Ao(...e){const t=(s,i)=>u=>s(i(u)),r=Array.from(e).reverse().reduce((s,i)=>s?t(s,i.encode):i.encode,void 0),n=e.reduce((s,i)=>s?t(s,i.decode):i.decode,void 0);return{encode:r,decode:n}}function ko(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(r=>{if(pl(r),r<0||r>=e.length)throw new Error(`Digit index outside alphabet: ${r} (alphabet: ${e.length})`);return e[r]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(r=>{if(typeof r!="string")throw new Error(`alphabet.decode: not string element=${r}`);const n=e.indexOf(r);if(n===-1)throw new Error(`Unknown letter: "${r}". Allowed: ${e}`);return n})}}}function Bo(e=""){if(typeof e!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let r of t)if(typeof r!="string")throw new Error(`join.encode: non-string input=${r}`);return t.join(e)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(e)}}}function X0(e,t="="){if(pl(e),typeof t!="string")throw new Error("padding chr should be string");return{encode(r){if(!Array.isArray(r)||r.length&&typeof r[0]!="string")throw new Error("padding.encode input should be array of strings");for(let n of r)if(typeof n!="string")throw new Error(`padding.encode: non-string input=${n}`);for(;r.length*e%8;)r.push(t);return r},decode(r){if(!Array.isArray(r)||r.length&&typeof r[0]!="string")throw new Error("padding.encode input should be array of strings");for(let s of r)if(typeof s!="string")throw new Error(`padding.decode: non-string input=${s}`);let n=r.length;if(n*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&r[n-1]===t;n--)if(!((n-1)*e%8))throw new Error("Invalid padding: string has too much padding");return r.slice(0,n)}}}function WM(e){if(typeof e!="function")throw new Error("normalize fn should be function");return{encode:t=>t,decode:t=>e(t)}}function F3(e,t,r){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(r<2)throw new Error(`convertRadix: wrong to=${r}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let n=0;const s=[],i=Array.from(e);for(i.forEach(u=>{if(pl(u),u<0||u>=t)throw new Error(`Wrong integer: ${u}`)});;){let u=0,d=!0;for(let c=n;c<i.length;c++){const b=i[c],w=t*u+b;if(!Number.isSafeInteger(w)||t*u/t!==u||w-b!==t*u)throw new Error("convertRadix: carry overflow");if(u=w%r,i[c]=Math.floor(w/r),!Number.isSafeInteger(i[c])||i[c]*r+u!==w)throw new Error("convertRadix: carry overflow");if(d)i[c]?d=!1:n=c;else continue}if(s.push(u),d)break}for(let u=0;u<e.length-1&&e[u]===0;u++)s.push(0);return s.reverse()}const VM=(e,t)=>t?VM(t,e%t):e,o0=(e,t)=>e+(t-VM(e,t));function Hg(e,t,r,n){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(o0(t,r)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${o0(t,r)}`);let s=0,i=0;const u=2**r-1,d=[];for(const c of e){if(pl(c),c>=2**t)throw new Error(`convertRadix2: invalid data word=${c} from=${t}`);if(s=s<<t|c,i+t>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=r;i-=r)d.push((s>>i-r&u)>>>0);s&=2**i-1}if(s=s<<r-i&u,!n&&i>=t)throw new Error("Excess padding");if(!n&&s)throw new Error(`Non-zero padding: ${s}`);return n&&i>0&&d.push(s>>>0),d}function GT(e){return pl(e),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return F3(Array.from(t),2**8,e)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(F3(t,e,2**8))}}}function Ns(e,t=!1){if(pl(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(o0(8,e)>32||o0(e,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!(r instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return Hg(Array.from(r),8,e,!t)},decode:r=>{if(!Array.isArray(r)||r.length&&typeof r[0]!="number")throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(Hg(r,e,8,t))}}}function H3(e){if(typeof e!="function")throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch{}}}const JT=Ao(Ns(4),ko("0123456789ABCDEF"),Bo("")),YT=Ao(Ns(5),ko("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),X0(5),Bo(""));Ao(Ns(5),ko("0123456789ABCDEFGHIJKLMNOPQRSTUV"),X0(5),Bo(""));Ao(Ns(5),ko("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),Bo(""),WM(e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));const yo=Ao(Ns(6),ko("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),X0(6),Bo("")),XT=Ao(Ns(6),ko("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),X0(6),Bo("")),t2=e=>Ao(GT(58),ko(e),Bo("")),zg=t2("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");t2("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ");t2("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const z3=[0,2,3,5,6,7,9,10,11],QT={encode(e){let t="";for(let r=0;r<e.length;r+=8){const n=e.subarray(r,r+8);t+=zg.encode(n).padStart(z3[n.length],"1")}return t},decode(e){let t=[];for(let r=0;r<e.length;r+=11){const n=e.slice(r,r+11),s=z3.indexOf(n.length),i=zg.decode(n);for(let u=0;u<i.length-s;u++)if(i[u]!==0)throw new Error("base58xmr: wrong padding");t=t.concat(Array.from(i.slice(i.length-s)))}return Uint8Array.from(t)}},Wg=Ao(ko("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),Bo("")),W3=[996825010,642813549,513874426,1027748829,705979059];function ql(e){const t=e>>25;let r=(e&33554431)<<5;for(let n=0;n<W3.length;n++)(t>>n&1)===1&&(r^=W3[n]);return r}function V3(e,t,r=1){const n=e.length;let s=1;for(let i=0;i<n;i++){const u=e.charCodeAt(i);if(u<33||u>126)throw new Error(`Invalid prefix (${e})`);s=ql(s)^u>>5}s=ql(s);for(let i=0;i<n;i++)s=ql(s)^e.charCodeAt(i)&31;for(let i of t)s=ql(s)^i;for(let i=0;i<6;i++)s=ql(s);return s^=r,Wg.encode(Hg([s%2**30],30,5,!1))}function KM(e){const t=e==="bech32"?1:734539939,r=Ns(5),n=r.decode,s=r.encode,i=H3(n);function u(w,M,_=90){if(typeof w!="string")throw new Error(`bech32.encode prefix should be string, not ${typeof w}`);if(!Array.isArray(M)||M.length&&typeof M[0]!="number")throw new Error(`bech32.encode words should be array of numbers, not ${typeof M}`);const A=w.length+7+M.length;if(_!==!1&&A>_)throw new TypeError(`Length ${A} exceeds limit ${_}`);return w=w.toLowerCase(),`${w}1${Wg.encode(M)}${V3(w,M,t)}`}function d(w,M=90){if(typeof w!="string")throw new Error(`bech32.decode input should be string, not ${typeof w}`);if(w.length<8||M!==!1&&w.length>M)throw new TypeError(`Wrong string length: ${w.length} (${w}). Expected (8..${M})`);const _=w.toLowerCase();if(w!==_&&w!==w.toUpperCase())throw new Error("String must be lowercase or uppercase");w=_;const A=w.lastIndexOf("1");if(A===0||A===-1)throw new Error('Letter "1" must be present between prefix and data only');const R=w.slice(0,A),B=w.slice(A+1);if(B.length<6)throw new Error("Data must be at least 6 characters long");const I=Wg.decode(B).slice(0,-6),E=V3(R,I,t);if(!B.endsWith(E))throw new Error(`Invalid checksum in ${w}: expected "${E}"`);return{prefix:R,words:I}}const c=H3(d);function b(w){const{prefix:M,words:_}=d(w,!1);return{prefix:M,words:_,bytes:n(_)}}return{encode:u,decode:d,decodeToBytes:b,decodeUnsafe:c,fromWords:n,fromWordsUnsafe:i,toWords:s}}const zf=KM("bech32");KM("bech32m");const eI={encode:e=>new TextDecoder().decode(e),decode:e=>new TextEncoder().encode(e)},tI=Ao(Ns(4),ko("0123456789abcdef"),Bo(""),WM(e=>{if(typeof e!="string"||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})),rI={utf8:eI,hex:tI,base16:JT,base32:YT,base64:yo,base64url:XT,base58:zg,base58xmr:QT};`${Object.keys(rI).join(", ")}`;function Zp(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function K3(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}function nI(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function bi(e,...t){if(!nI(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */const Ur=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),iI=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!iI)throw new Error("Non little-endian hardware is not supported");const oI=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Ka(e){bi(e);let t="";for(let r=0;r<e.length;r++)t+=oI[e[r]];return t}const ji={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Z3(e){if(e>=ji._0&&e<=ji._9)return e-ji._0;if(e>=ji._A&&e<=ji._F)return e-(ji._A-10);if(e>=ji._a&&e<=ji._f)return e-(ji._a-10)}function ZM(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let s=0,i=0;s<r;s++,i+=2){const u=Z3(e.charCodeAt(i)),d=Z3(e.charCodeAt(i+1));if(u===void 0||d===void 0){const c=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}n[s]=u*16+d}return n}function sI(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function aI(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}const fI=(e,t)=>(Object.assign(t,e),t),ys=16,lI=283;function r2(e){return e<<1^lI&-(e>>7)}function vf(e,t){let r=0;for(;t>0;t>>=1)r^=e&-(t&1),e=r2(e);return r}const Vg=(()=>{let e=new Uint8Array(256);for(let r=0,n=1;r<256;r++,n^=r2(n))e[r]=n;const t=new Uint8Array(256);t[0]=99;for(let r=0;r<255;r++){let n=e[255-r];n|=n<<8,t[e[r]]=(n^n>>4^n>>5^n>>6^n>>7^99)&255}return t})(),uI=Vg.map((e,t)=>Vg.indexOf(t)),hI=e=>e<<24|e>>>8,Gp=e=>e<<8|e>>>24;function GM(e,t){if(e.length!==256)throw new Error("Wrong sbox length");const r=new Uint32Array(256).map((b,w)=>t(e[w])),n=r.map(Gp),s=n.map(Gp),i=s.map(Gp),u=new Uint32Array(256*256),d=new Uint32Array(256*256),c=new Uint16Array(256*256);for(let b=0;b<256;b++)for(let w=0;w<256;w++){const M=b*256+w;u[M]=r[b]^n[w],d[M]=s[b]^i[w],c[M]=e[b]<<8|e[w]}return{sbox:e,sbox2:c,T0:r,T1:n,T2:s,T3:i,T01:u,T23:d}}const n2=GM(Vg,e=>vf(e,3)<<24|e<<16|e<<8|vf(e,2)),JM=GM(uI,e=>vf(e,11)<<24|vf(e,13)<<16|vf(e,9)<<8|vf(e,14)),cI=(()=>{const e=new Uint8Array(16);for(let t=0,r=1;t<16;t++,r=r2(r))e[t]=r;return e})();function YM(e){bi(e);const t=e.length;if(![16,24,32].includes(t))throw new Error(`aes: wrong key size: should be 16, 24 or 32, got: ${t}`);const{sbox2:r}=n2,n=Ur(e),s=n.length,i=d=>xi(r,d,d,d,d),u=new Uint32Array(t+28);u.set(n);for(let d=s;d<u.length;d++){let c=u[d-1];d%s===0?c=i(hI(c))^cI[d/s-1]:s>6&&d%s===4&&(c=i(c)),u[d]=u[d-s]^c}return u}function dI(e){const t=YM(e),r=t.slice(),n=t.length,{sbox2:s}=n2,{T0:i,T1:u,T2:d,T3:c}=JM;for(let b=0;b<n;b+=4)for(let w=0;w<4;w++)r[b+w]=t[n-b-4+w];t.fill(0);for(let b=4;b<n-4;b++){const w=r[b],M=xi(s,w,w,w,w);r[b]=i[M&255]^u[M>>>8&255]^d[M>>>16&255]^c[M>>>24]}return r}function os(e,t,r,n,s,i){return e[r<<8&65280|n>>>8&255]^t[s>>>8&65280|i>>>24&255]}function xi(e,t,r,n,s){return e[t&255|r&65280]|e[n>>>16&255|s>>>16&65280]<<16}function G3(e,t,r,n,s){const{sbox2:i,T01:u,T23:d}=n2;let c=0;t^=e[c++],r^=e[c++],n^=e[c++],s^=e[c++];const b=e.length/4-2;for(let R=0;R<b;R++){const B=e[c++]^os(u,d,t,r,n,s),I=e[c++]^os(u,d,r,n,s,t),E=e[c++]^os(u,d,n,s,t,r),k=e[c++]^os(u,d,s,t,r,n);t=B,r=I,n=E,s=k}const w=e[c++]^xi(i,t,r,n,s),M=e[c++]^xi(i,r,n,s,t),_=e[c++]^xi(i,n,s,t,r),A=e[c++]^xi(i,s,t,r,n);return{s0:w,s1:M,s2:_,s3:A}}function pI(e,t,r,n,s){const{sbox2:i,T01:u,T23:d}=JM;let c=0;t^=e[c++],r^=e[c++],n^=e[c++],s^=e[c++];const b=e.length/4-2;for(let R=0;R<b;R++){const B=e[c++]^os(u,d,t,s,n,r),I=e[c++]^os(u,d,r,t,s,n),E=e[c++]^os(u,d,n,r,t,s),k=e[c++]^os(u,d,s,n,r,t);t=B,r=I,n=E,s=k}const w=e[c++]^xi(i,t,s,n,r),M=e[c++]^xi(i,r,t,s,n),_=e[c++]^xi(i,n,r,t,s),A=e[c++]^xi(i,s,n,r,t);return{s0:w,s1:M,s2:_,s3:A}}function XM(e,t){if(!t)return new Uint8Array(e);if(bi(t),t.length<e)throw new Error(`aes: wrong destination length, expected at least ${e}, got: ${t.length}`);return t}function vI(e){if(bi(e),e.length%ys!==0)throw new Error(`aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size ${ys}`)}function gI(e,t,r){let n=e.length;const s=n%ys;if(!t&&s!==0)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");const i=Ur(e);if(t){let c=ys-s;c||(c=ys),n=n+c}const u=XM(n,r),d=Ur(u);return{b:i,o:d,out:u}}function yI(e,t){if(!t)return e;const r=e.length;if(!r)throw new Error("aes/pcks5: empty ciphertext not allowed");const n=e[r-1];if(n<=0||n>16)throw new Error(`aes/pcks5: wrong padding byte: ${n}`);const s=e.subarray(0,-n);for(let i=0;i<n;i++)if(e[r-i-1]!==n)throw new Error("aes/pcks5: wrong padding");return s}function mI(e){const t=new Uint8Array(16),r=Ur(t);t.set(e);const n=ys-e.length;for(let s=ys-n;s<ys;s++)t[s]=n;return r}const QM=fI({blockSize:16,nonceLength:16},function(t,r,n={}){bi(t),bi(r,16);const s=!n.disablePadding;return{encrypt:(i,u)=>{const d=YM(t),{b:c,o:b,out:w}=gI(i,s,u),M=Ur(r);let _=M[0],A=M[1],R=M[2],B=M[3],I=0;for(;I+4<=c.length;)_^=c[I+0],A^=c[I+1],R^=c[I+2],B^=c[I+3],{s0:_,s1:A,s2:R,s3:B}=G3(d,_,A,R,B),b[I++]=_,b[I++]=A,b[I++]=R,b[I++]=B;if(s){const E=mI(i.subarray(I*4));_^=E[0],A^=E[1],R^=E[2],B^=E[3],{s0:_,s1:A,s2:R,s3:B}=G3(d,_,A,R,B),b[I++]=_,b[I++]=A,b[I++]=R,b[I++]=B}return d.fill(0),w},decrypt:(i,u)=>{vI(i);const d=dI(t),c=Ur(r),b=XM(i.length,u),w=Ur(i),M=Ur(b);let _=c[0],A=c[1],R=c[2],B=c[3];for(let I=0;I+4<=w.length;){const E=_,k=A,T=R,L=B;_=w[I+0],A=w[I+1],R=w[I+2],B=w[I+3];const{s0:q,s1:z,s2:J,s3:F}=pI(d,_,A,R,B);M[I++]=q^E,M[I++]=z^k,M[I++]=J^T,M[I++]=F^L}return d.fill(0),yI(b,s)}}}),e_=e=>Uint8Array.from(e.split("").map(t=>t.charCodeAt(0))),wI=e_("expand 16-byte k"),bI=e_("expand 32-byte k"),xI=Ur(wI),t_=Ur(bI);t_.slice();function at(e,t){return e<<t|e>>>32-t}function Kg(e){return e.byteOffset%4===0}const Oh=64,MI=16,r_=2**32-1,J3=new Uint32Array;function _I(e,t,r,n,s,i,u,d){const c=s.length,b=new Uint8Array(Oh),w=Ur(b),M=Kg(s)&&Kg(i),_=M?Ur(s):J3,A=M?Ur(i):J3;for(let R=0;R<c;u++){if(e(t,r,n,w,u,d),u>=r_)throw new Error("arx: counter overflow");const B=Math.min(Oh,c-R);if(M&&B===Oh){const I=R/4;if(R%4!==0)throw new Error("arx: invalid block position");for(let E=0,k;E<MI;E++)k=I+E,A[k]=_[k]^w[E];R+=Oh;continue}for(let I=0,E;I<B;I++)E=R+I,i[E]=s[E]^b[I];R+=B}}function EI(e,t){const{allowShortKeys:r,extendNonceFn:n,counterLength:s,counterRight:i,rounds:u}=sI({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return Zp(s),Zp(u),K3(i),K3(r),(d,c,b,w,M=0)=>{bi(d),bi(c),bi(b);const _=b.length;if(w||(w=new Uint8Array(_)),bi(w),Zp(M),M<0||M>=r_)throw new Error("arx: counter overflow");if(w.length<_)throw new Error(`arx: output (${w.length}) is shorter than data (${_})`);const A=[];let R=d.length,B,I;if(R===32)B=d.slice(),A.push(B),I=t_;else if(R===16&&r)B=new Uint8Array(32),B.set(d),B.set(d,16),I=xI,A.push(B);else throw new Error(`arx: invalid 32-byte key, got length=${R}`);Kg(c)||(c=c.slice(),A.push(c));const E=Ur(B);if(n){if(c.length!==24)throw new Error("arx: extended nonce must be 24 bytes");n(I,E,Ur(c.subarray(0,16)),E),c=c.subarray(16)}const k=16-s;if(k!==c.length)throw new Error(`arx: nonce must be ${k} or 16 bytes`);if(k!==12){const L=new Uint8Array(12);L.set(c,i?0:12-c.length),c=L,A.push(c)}const T=Ur(c);for(_I(e,I,E,T,b,w,M,u);A.length>0;)A.pop().fill(0);return w}}function SI(e,t,r,n,s,i=20){let u=e[0],d=e[1],c=e[2],b=e[3],w=t[0],M=t[1],_=t[2],A=t[3],R=t[4],B=t[5],I=t[6],E=t[7],k=s,T=r[0],L=r[1],q=r[2],z=u,J=d,F=c,X=b,ee=w,x=M,o=_,f=A,l=R,h=B,v=I,y=E,m=k,p=T,a=L,g=q;for(let N=0;N<i;N+=2)z=z+ee|0,m=at(m^z,16),l=l+m|0,ee=at(ee^l,12),z=z+ee|0,m=at(m^z,8),l=l+m|0,ee=at(ee^l,7),J=J+x|0,p=at(p^J,16),h=h+p|0,x=at(x^h,12),J=J+x|0,p=at(p^J,8),h=h+p|0,x=at(x^h,7),F=F+o|0,a=at(a^F,16),v=v+a|0,o=at(o^v,12),F=F+o|0,a=at(a^F,8),v=v+a|0,o=at(o^v,7),X=X+f|0,g=at(g^X,16),y=y+g|0,f=at(f^y,12),X=X+f|0,g=at(g^X,8),y=y+g|0,f=at(f^y,7),z=z+x|0,g=at(g^z,16),v=v+g|0,x=at(x^v,12),z=z+x|0,g=at(g^z,8),v=v+g|0,x=at(x^v,7),J=J+o|0,m=at(m^J,16),y=y+m|0,o=at(o^y,12),J=J+o|0,m=at(m^J,8),y=y+m|0,o=at(o^y,7),F=F+f|0,p=at(p^F,16),l=l+p|0,f=at(f^l,12),F=F+f|0,p=at(p^F,8),l=l+p|0,f=at(f^l,7),X=X+ee|0,a=at(a^X,16),h=h+a|0,ee=at(ee^h,12),X=X+ee|0,a=at(a^X,8),h=h+a|0,ee=at(ee^h,7);let S=0;n[S++]=u+z|0,n[S++]=d+J|0,n[S++]=c+F|0,n[S++]=b+X|0,n[S++]=w+ee|0,n[S++]=M+x|0,n[S++]=_+o|0,n[S++]=A+f|0,n[S++]=R+l|0,n[S++]=B+h|0,n[S++]=I+v|0,n[S++]=E+y|0,n[S++]=k+m|0,n[S++]=T+p|0,n[S++]=L+a|0,n[S++]=q+g|0}const n_=EI(SI,{counterRight:!1,counterLength:4,allowShortKeys:!1});let i_=class extends DM{constructor(t,r){super(),this.finished=!1,this.destroyed=!1,wi.hash(t);const n=Ou(r);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(n.length>s?t.create().update(n).digest():n);for(let u=0;u<i.length;u++)i[u]^=54;this.iHash.update(i),this.oHash=t.create();for(let u=0;u<i.length;u++)i[u]^=106;this.oHash.update(i),i.fill(0)}update(t){return wi.exists(this),this.iHash.update(t),this}digestInto(t){wi.exists(this),wi.bytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:r,iHash:n,finished:s,destroyed:i,blockLen:u,outputLen:d}=this;return t=t,t.finished=s,t.destroyed=i,t.blockLen=u,t.outputLen=d,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const Q0=(e,t,r)=>new i_(e,t).update(r).digest();Q0.create=(e,t)=>new i_(e,t);function AI(e,t,r){return wi.hash(e),Q0(e,Ou(r),Ou(t))}const Jp=new Uint8Array([0]),Y3=new Uint8Array;function kI(e,t,r,n=32){if(wi.hash(e),wi.number(n),n>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const s=Math.ceil(n/e.outputLen);r===void 0&&(r=Y3);const i=new Uint8Array(s*e.outputLen),u=Q0.create(e,t),d=u._cloneInto(),c=new Uint8Array(u.outputLen);for(let b=0;b<s;b++)Jp[0]=b+1,d.update(b===0?Y3:c).update(r).update(Jp).digestInto(c),i.set(c,e.outputLen*b),u._cloneInto(d);return u.destroy(),d.destroy(),c.fill(0),Jp.fill(0),i.slice(0,n)}var BI=Object.defineProperty,Pt=(e,t)=>{for(var r in t)BI(e,r,{get:t[r],enumerable:!0})},Ys=Symbol("verified"),RI=e=>e instanceof Object;function i2(e){if(!RI(e)||typeof e.kind!="number"||typeof e.content!="string"||typeof e.created_at!="number"||typeof e.pubkey!="string"||!e.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(e.tags))return!1;for(let t=0;t<e.tags.length;t++){let r=e.tags[t];if(!Array.isArray(r))return!1;for(let n=0;n<r.length;n++)if(typeof r[n]!="string")return!1}return!0}var $I={};Pt($I,{Queue:()=>s_,QueueNode:()=>o_,binarySearch:()=>o2,bytesToHex:()=>Pr,hexToBytes:()=>Ba,insertEventIntoAscendingList:()=>TI,insertEventIntoDescendingList:()=>NI,normalizeURL:()=>ta,utf8Decoder:()=>io,utf8Encoder:()=>Jn});var io=new TextDecoder("utf-8"),Jn=new TextEncoder;function ta(e){try{e.indexOf("://")===-1&&(e="wss://"+e);let t=new URL(e);return t.protocol==="http:"?t.protocol="ws:":t.protocol==="https:"&&(t.protocol="wss:"),t.pathname=t.pathname.replace(/\/+/g,"/"),t.pathname.endsWith("/")&&(t.pathname=t.pathname.slice(0,-1)),(t.port==="80"&&t.protocol==="ws:"||t.port==="443"&&t.protocol==="wss:")&&(t.port=""),t.searchParams.sort(),t.hash="",t.toString()}catch{throw new Error(`Invalid URL: ${e}`)}}function NI(e,t){const[r,n]=o2(e,s=>t.id===s.id?0:t.created_at===s.created_at?-1:s.created_at-t.created_at);return n||e.splice(r,0,t),e}function TI(e,t){const[r,n]=o2(e,s=>t.id===s.id?0:t.created_at===s.created_at?-1:t.created_at-s.created_at);return n||e.splice(r,0,t),e}function o2(e,t){let r=0,n=e.length-1;for(;r<=n;){const s=Math.floor((r+n)/2),i=t(e[s]);if(i===0)return[s,!0];i<0?n=s-1:r=s+1}return[r,!1]}var o_=class{constructor(t){ie(this,"value");ie(this,"next",null);ie(this,"prev",null);this.value=t}},s_=class{constructor(){ie(this,"first");ie(this,"last");this.first=null,this.last=null}enqueue(t){const r=new o_(t);return this.last?this.last===this.first?(this.last=r,this.last.prev=this.first,this.first.next=r):(r.prev=this.last,this.last.next=r,this.last=r):(this.first=r,this.last=r),!0}dequeue(){if(!this.first)return null;if(this.first===this.last){const r=this.first;return this.first=null,this.last=null,r.value}const t=this.first;return this.first=t.next,this.first&&(this.first.prev=null),t.value}},II=class{generateSecretKey(){return Dl.utils.randomPrivateKey()}getPublicKey(t){return Pr(Dl.getPublicKey(t))}finalizeEvent(t,r){const n=t;return n.pubkey=Pr(Dl.getPublicKey(r)),n.id=pc(n),n.sig=Pr(Dl.sign(pc(n),r)),n[Ys]=!0,n}verifyEvent(t){if(typeof t[Ys]=="boolean")return t[Ys];const r=pc(t);if(r!==t.id)return t[Ys]=!1,!1;try{const n=Dl.verify(t.sig,r,t.pubkey);return t[Ys]=n,n}catch{return t[Ys]=!1,!1}}};function CI(e){if(!i2(e))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content])}function pc(e){let t=Da(Jn.encode(CI(e)));return Pr(t)}var ed=new II,a_=ed.generateSecretKey,uo=ed.getPublicKey,hn=ed.finalizeEvent,td=ed.verifyEvent,PI={};Pt(PI,{Application:()=>KC,BadgeAward:()=>HI,BadgeDefinition:()=>DC,BlockedRelaysList:()=>MC,BlossomServerList:()=>RC,BookmarkList:()=>wC,Bookmarksets:()=>OC,Calendar:()=>eP,CalendarEventRSVP:()=>tP,ChannelCreation:()=>d_,ChannelHideMessage:()=>g_,ChannelMessage:()=>v_,ChannelMetadata:()=>p_,ChannelMuteUser:()=>y_,ChatMessage:()=>zI,ClassifiedListing:()=>JC,ClientAuth:()=>w_,Comment:()=>QI,CommunitiesList:()=>bC,CommunityDefinition:()=>oP,CommunityPostApproval:()=>aC,Contacts:()=>DI,CreateOrUpdateProduct:()=>HC,CreateOrUpdateStall:()=>FC,Curationsets:()=>UC,Date:()=>XC,DirectMessageRelaysList:()=>kC,DraftClassifiedListing:()=>YC,DraftLong:()=>WC,Emojisets:()=>VC,EncryptedDirectMessage:()=>qI,EventDeletion:()=>FI,FavoriteRelays:()=>EC,FileMessage:()=>VI,FileMetadata:()=>XI,FileServerPreference:()=>BC,Followsets:()=>CC,ForumThread:()=>WI,GenericRepost:()=>u2,Genericlists:()=>PC,GiftWrap:()=>m_,GroupMetadata:()=>sP,HTTPAuth:()=>h2,Handlerinformation:()=>iP,Handlerrecommendation:()=>nP,Highlights:()=>pC,InterestsList:()=>SC,Interestsets:()=>qC,JobFeedback:()=>uC,JobRequest:()=>fC,JobResult:()=>lC,Label:()=>sC,LightningPubRPC:()=>NC,LiveChatMessage:()=>eC,LiveEvent:()=>ZC,LongFormArticle:()=>zC,Metadata:()=>UI,Mutelist:()=>gC,NWCWalletInfo:()=>$C,NWCWalletRequest:()=>b_,NWCWalletResponse:()=>TC,NormalVideo:()=>ZI,NostrConnect:()=>IC,OpenTimestamps:()=>JI,Photo:()=>KI,Pinlist:()=>yC,Poll:()=>YI,PollResponse:()=>vC,PrivateDirectMessage:()=>c_,ProblemTracker:()=>nC,ProfileBadges:()=>jC,PublicChatsList:()=>xC,Reaction:()=>l2,RecommendRelay:()=>jI,RelayList:()=>mC,RelayReview:()=>rP,Relaysets:()=>LC,Report:()=>iC,Reporting:()=>oC,Repost:()=>f2,Seal:()=>h_,SearchRelaysList:()=>_C,ShortTextNote:()=>u_,ShortVideo:()=>GI,Time:()=>QC,UserEmojiList:()=>AC,UserStatuses:()=>GC,Voice:()=>tC,VoiceComment:()=>rC,Zap:()=>dC,ZapGoal:()=>hC,ZapRequest:()=>cC,classifyKind:()=>LI,isAddressableKind:()=>a2,isEphemeralKind:()=>l_,isKind:()=>OI,isRegularKind:()=>f_,isReplaceableKind:()=>s2});function f_(e){return e<1e4&&e!==0&&e!==3}function s2(e){return e===0||e===3||1e4<=e&&e<2e4}function l_(e){return 2e4<=e&&e<3e4}function a2(e){return 3e4<=e&&e<4e4}function LI(e){return f_(e)?"regular":s2(e)?"replaceable":l_(e)?"ephemeral":a2(e)?"parameterized":"unknown"}function OI(e,t){const r=t instanceof Array?t:[t];return i2(e)&&r.includes(e.kind)||!1}var UI=0,u_=1,jI=2,DI=3,qI=4,FI=5,f2=6,l2=7,HI=8,zI=9,WI=11,h_=13,c_=14,VI=15,u2=16,KI=20,ZI=21,GI=22,d_=40,p_=41,v_=42,g_=43,y_=44,JI=1040,m_=1059,YI=1068,XI=1063,QI=1111,eC=1311,tC=1222,rC=1244,nC=1971,iC=1984,oC=1984,sC=1985,aC=4550,fC=5999,lC=6999,uC=7e3,hC=9041,cC=9734,dC=9735,pC=9802,vC=1018,gC=1e4,yC=10001,mC=10002,wC=10003,bC=10004,xC=10005,MC=10006,_C=10007,EC=10012,SC=10015,AC=10030,kC=10050,BC=10096,RC=10063,$C=13194,NC=21e3,w_=22242,b_=23194,TC=23195,IC=24133,h2=27235,CC=3e4,PC=30001,LC=30002,OC=30003,UC=30004,jC=30008,DC=30009,qC=30015,FC=30017,HC=30018,zC=30023,WC=30024,VC=30030,KC=30078,ZC=30311,GC=30315,JC=30402,YC=30403,XC=31922,QC=31923,eP=31924,tP=31925,rP=31987,nP=31989,iP=31990,oP=34550,sP=39e3;function aP(e,t){if(e.ids&&e.ids.indexOf(t.id)===-1||e.kinds&&e.kinds.indexOf(t.kind)===-1||e.authors&&e.authors.indexOf(t.pubkey)===-1)return!1;for(let r in e)if(r[0]==="#"){let n=r.slice(1),s=e[`#${n}`];if(s&&!t.tags.find(([i,u])=>i===r.slice(1)&&s.indexOf(u)!==-1))return!1}return!(e.since&&t.created_at<e.since||e.until&&t.created_at>e.until)}function fP(e,t){for(let r=0;r<e.length;r++)if(aP(e[r],t))return!0;return!1}var lP={};Pt(lP,{getHex64:()=>rd,getInt:()=>x_,getSubscriptionId:()=>M_,matchEventId:()=>uP,matchEventKind:()=>cP,matchEventPubkey:()=>hP});function rd(e,t){let r=t.length+3,n=e.indexOf(`"${t}":`)+r,s=e.slice(n).indexOf('"')+n+1;return e.slice(s,s+64)}function x_(e,t){let r=t.length,n=e.indexOf(`"${t}":`)+r+3,s=e.slice(n),i=Math.min(s.indexOf(","),s.indexOf("}"));return parseInt(s.slice(0,i),10)}function M_(e){let t=e.slice(0,22).indexOf('"EVENT"');if(t===-1)return null;let r=e.slice(t+7+1).indexOf('"');if(r===-1)return null;let n=t+7+1+r,s=e.slice(n+1,80).indexOf('"');if(s===-1)return null;let i=n+1+s;return e.slice(n+1,i)}function uP(e,t){return t===rd(e,"id")}function hP(e,t){return t===rd(e,"pubkey")}function cP(e,t){return t===x_(e,"kind")}var dP={};Pt(dP,{makeAuthEvent:()=>__});function __(e,t){return{kind:w_,created_at:Math.floor(Date.now()/1e3),tags:[["relay",e],["challenge",t]],content:""}}async function pP(){return new Promise((e,t)=>{try{if(typeof MessageChannel<"u"){const r=new MessageChannel,n=()=>{r.port1.removeEventListener("message",n),e()};r.port1.addEventListener("message",n),r.port2.postMessage(0),r.port1.start()}else typeof setImmediate<"u"?setImmediate(e):typeof setTimeout<"u"?setTimeout(e,0):e()}catch(r){console.error("during yield: ",r),t(r)}})}var vP=e=>(e[Ys]=!0,!0),E_=class extends Error{constructor(t,r){super(`Tried to send message '${t} on a closed connection to ${r}.`),this.name="SendingOnClosedConnection"}},S_=class{constructor(t,r){ie(this,"url");ie(this,"_connected",!1);ie(this,"onclose",null);ie(this,"onnotice",t=>console.debug(`NOTICE from ${this.url}: ${t}`));ie(this,"onauth");ie(this,"baseEoseTimeout",4400);ie(this,"connectionTimeout",4400);ie(this,"publishTimeout",4400);ie(this,"pingFrequency",29e3);ie(this,"pingTimeout",2e4);ie(this,"resubscribeBackoff",[1e4,1e4,1e4,2e4,2e4,3e4,6e4]);ie(this,"openSubs",new Map);ie(this,"enablePing");ie(this,"enableReconnect");ie(this,"connectionTimeoutHandle");ie(this,"reconnectTimeoutHandle");ie(this,"pingIntervalHandle");ie(this,"reconnectAttempts",0);ie(this,"closedIntentionally",!1);ie(this,"connectionPromise");ie(this,"openCountRequests",new Map);ie(this,"openEventPublishes",new Map);ie(this,"ws");ie(this,"incomingMessageQueue",new s_);ie(this,"queueRunning",!1);ie(this,"challenge");ie(this,"authPromise");ie(this,"serial",0);ie(this,"verifyEvent");ie(this,"_WebSocket");this.url=ta(t),this.verifyEvent=r.verifyEvent,this._WebSocket=r.websocketImplementation||WebSocket,this.enablePing=r.enablePing,this.enableReconnect=r.enableReconnect||!1}static async connect(t,r){const n=new S_(t,r);return await n.connect(),n}closeAllSubscriptions(t){for(let[r,n]of this.openSubs)n.close(t);this.openSubs.clear();for(let[r,n]of this.openEventPublishes)n.reject(new Error(t));this.openEventPublishes.clear();for(let[r,n]of this.openCountRequests)n.reject(new Error(t));this.openCountRequests.clear()}get connected(){return this._connected}async reconnect(){const t=this.resubscribeBackoff[Math.min(this.reconnectAttempts,this.resubscribeBackoff.length-1)];this.reconnectAttempts++,this.reconnectTimeoutHandle=setTimeout(async()=>{try{await this.connect()}catch{}},t)}handleHardClose(t){var n;this.pingIntervalHandle&&(clearInterval(this.pingIntervalHandle),this.pingIntervalHandle=void 0),this._connected=!1,this.connectionPromise=void 0;const r=this.closedIntentionally;this.closedIntentionally=!1,(n=this.onclose)==null||n.call(this),this.enableReconnect&&!r?this.reconnect():this.closeAllSubscriptions(t)}async connect(){return this.connectionPromise?this.connectionPromise:(this.challenge=void 0,this.authPromise=void 0,this.connectionPromise=new Promise((t,r)=>{this.connectionTimeoutHandle=setTimeout(()=>{var n;r("connection timed out"),this.connectionPromise=void 0,(n=this.onclose)==null||n.call(this),this.closeAllSubscriptions("relay connection timed out")},this.connectionTimeout);try{this.ws=new this._WebSocket(this.url)}catch(n){clearTimeout(this.connectionTimeoutHandle),r(n);return}this.ws.onopen=()=>{this.reconnectTimeoutHandle&&(clearTimeout(this.reconnectTimeoutHandle),this.reconnectTimeoutHandle=void 0),clearTimeout(this.connectionTimeoutHandle),this._connected=!0;const n=this.reconnectAttempts>0;this.reconnectAttempts=0;for(const s of this.openSubs.values()){if(s.eosed=!1,n)for(let i=0;i<s.filters.length;i++)s.lastEmitted&&(s.filters[i].since=s.lastEmitted+1);s.fire()}this.enablePing&&(this.pingIntervalHandle=setInterval(()=>this.pingpong(),this.pingFrequency)),t()},this.ws.onerror=n=>{clearTimeout(this.connectionTimeoutHandle),r(n.message||"websocket error"),this.handleHardClose("relay connection errored")},this.ws.onclose=n=>{clearTimeout(this.connectionTimeoutHandle),r(n.message||"websocket closed"),this.handleHardClose("relay connection closed")},this.ws.onmessage=this._onmessage.bind(this)}),this.connectionPromise)}waitForPingPong(){return new Promise(t=>{this.ws.once("pong",()=>t(!0)),this.ws.ping()})}waitForDummyReq(){return new Promise((t,r)=>{if(!this.connectionPromise)return r(new Error(`no connection to ${this.url}, can't ping`));try{const n=this.subscribe([{ids:["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"],limit:0}],{label:"forced-ping",oneose:()=>{t(!0),n.close()},onclose(){t(!0)},eoseTimeout:this.pingTimeout+1e3})}catch(n){r(n)}})}async pingpong(){var t,r,n;((t=this.ws)==null?void 0:t.readyState)===1&&(await Promise.any([this.ws&&this.ws.ping&&this.ws.once?this.waitForPingPong():this.waitForDummyReq(),new Promise(i=>setTimeout(()=>i(!1),this.pingTimeout))])||((r=this.ws)==null?void 0:r.readyState)===this._WebSocket.OPEN&&((n=this.ws)==null||n.close()))}async runQueue(){for(this.queueRunning=!0;this.handleNext()!==!1;)await pP();this.queueRunning=!1}handleNext(){var n,s,i;const t=this.incomingMessageQueue.dequeue();if(!t)return!1;const r=M_(t);if(r){const u=this.openSubs.get(r);if(!u)return;const d=rd(t,"id"),c=(n=u.alreadyHaveEvent)==null?void 0:n.call(u,d);if((s=u.receivedEvent)==null||s.call(u,this,d),c)return}try{let u=JSON.parse(t);switch(u[0]){case"EVENT":{const d=this.openSubs.get(u[1]),c=u[2];this.verifyEvent(c)&&fP(d.filters,c)&&d.onevent(c),(!d.lastEmitted||d.lastEmitted<c.created_at)&&(d.lastEmitted=c.created_at);return}case"COUNT":{const d=u[1],c=u[2],b=this.openCountRequests.get(d);b&&(b.resolve(c.count),this.openCountRequests.delete(d));return}case"EOSE":{const d=this.openSubs.get(u[1]);if(!d)return;d.receivedEose();return}case"OK":{const d=u[1],c=u[2],b=u[3],w=this.openEventPublishes.get(d);w&&(clearTimeout(w.timeout),c?w.resolve(b):w.reject(new Error(b)),this.openEventPublishes.delete(d));return}case"CLOSED":{const d=u[1],c=this.openSubs.get(d);if(!c)return;c.closed=!0,c.close(u[2]);return}case"NOTICE":{this.onnotice(u[1]);return}case"AUTH":{this.challenge=u[1],this.onauth&&this.auth(this.onauth);return}default:{const d=this.openSubs.get(u[1]);(i=d==null?void 0:d.oncustom)==null||i.call(d,u);return}}}catch{return}}async send(t){if(!this.connectionPromise)throw new E_(t,this.url);this.connectionPromise.then(()=>{var r;(r=this.ws)==null||r.send(t)})}async auth(t){const r=this.challenge;if(!r)throw new Error("can't perform auth, no challenge was received");return this.authPromise?this.authPromise:(this.authPromise=new Promise(async(n,s)=>{try{let i=await t(__(this.url,r)),u=setTimeout(()=>{let d=this.openEventPublishes.get(i.id);d&&(d.reject(new Error("auth timed out")),this.openEventPublishes.delete(i.id))},this.publishTimeout);this.openEventPublishes.set(i.id,{resolve:n,reject:s,timeout:u}),this.send('["AUTH",'+JSON.stringify(i)+"]")}catch(i){console.warn("subscribe auth function failed:",i)}}),this.authPromise)}async publish(t){const r=new Promise((n,s)=>{const i=setTimeout(()=>{const u=this.openEventPublishes.get(t.id);u&&(u.reject(new Error("publish timed out")),this.openEventPublishes.delete(t.id))},this.publishTimeout);this.openEventPublishes.set(t.id,{resolve:n,reject:s,timeout:i})});return this.send('["EVENT",'+JSON.stringify(t)+"]"),r}async count(t,r){this.serial++;const n=(r==null?void 0:r.id)||"count:"+this.serial,s=new Promise((i,u)=>{this.openCountRequests.set(n,{resolve:i,reject:u})});return this.send('["COUNT","'+n+'",'+JSON.stringify(t).substring(1)),s}subscribe(t,r){const n=this.prepareSubscription(t,r);return n.fire(),n}prepareSubscription(t,r){this.serial++;const n=r.id||(r.label?r.label+":":"sub:")+this.serial,s=new gP(this,n,t,r);return this.openSubs.set(n,s),s}close(){var t,r,n;this.closedIntentionally=!0,this.reconnectTimeoutHandle&&(clearTimeout(this.reconnectTimeoutHandle),this.reconnectTimeoutHandle=void 0),this.pingIntervalHandle&&(clearInterval(this.pingIntervalHandle),this.pingIntervalHandle=void 0),this.closeAllSubscriptions("relay connection closed by us"),this._connected=!1,(t=this.onclose)==null||t.call(this),((r=this.ws)==null?void 0:r.readyState)===this._WebSocket.OPEN&&((n=this.ws)==null||n.close())}_onmessage(t){this.incomingMessageQueue.enqueue(t.data),this.queueRunning||this.runQueue()}},gP=class{constructor(t,r,n,s){ie(this,"relay");ie(this,"id");ie(this,"lastEmitted");ie(this,"closed",!1);ie(this,"eosed",!1);ie(this,"filters");ie(this,"alreadyHaveEvent");ie(this,"receivedEvent");ie(this,"onevent");ie(this,"oneose");ie(this,"onclose");ie(this,"oncustom");ie(this,"eoseTimeout");ie(this,"eoseTimeoutHandle");if(n.length===0)throw new Error("subscription can't be created with zero filters");this.relay=t,this.filters=n,this.id=r,this.alreadyHaveEvent=s.alreadyHaveEvent,this.receivedEvent=s.receivedEvent,this.eoseTimeout=s.eoseTimeout||t.baseEoseTimeout,this.oneose=s.oneose,this.onclose=s.onclose,this.onevent=s.onevent||(i=>{console.warn(`onevent() callback not defined for subscription '${this.id}' in relay ${this.relay.url}. event received:`,i)})}fire(){this.relay.send('["REQ","'+this.id+'",'+JSON.stringify(this.filters).substring(1)),this.eoseTimeoutHandle=setTimeout(this.receivedEose.bind(this),this.eoseTimeout)}receivedEose(){var t;this.eosed||(clearTimeout(this.eoseTimeoutHandle),this.eosed=!0,(t=this.oneose)==null||t.call(this))}close(t="closed by caller"){var r;if(!this.closed&&this.relay.connected){try{this.relay.send('["CLOSE",'+JSON.stringify(this.id)+"]")}catch(n){if(!(n instanceof E_))throw n}this.closed=!0}this.relay.openSubs.delete(this.id),(r=this.onclose)==null||r.call(this,t)}},yP;try{yP=WebSocket}catch{}var mP=class{constructor(t){ie(this,"relays",new Map);ie(this,"seenOn",new Map);ie(this,"trackRelays",!1);ie(this,"verifyEvent");ie(this,"enablePing");ie(this,"enableReconnect");ie(this,"automaticallyAuth");ie(this,"trustedRelayURLs",new Set);ie(this,"_WebSocket");this.verifyEvent=t.verifyEvent,this._WebSocket=t.websocketImplementation,this.enablePing=t.enablePing,this.enableReconnect=t.enableReconnect||!1,this.automaticallyAuth=t.automaticallyAuth}async ensureRelay(t,r){t=ta(t);let n=this.relays.get(t);if(n||(n=new S_(t,{verifyEvent:this.trustedRelayURLs.has(t)?vP:this.verifyEvent,websocketImplementation:this._WebSocket,enablePing:this.enablePing,enableReconnect:this.enableReconnect}),n.onclose=()=>{n&&!n.enableReconnect&&this.relays.delete(t)},r!=null&&r.connectionTimeout&&(n.connectionTimeout=r.connectionTimeout),this.relays.set(t,n)),this.automaticallyAuth){const s=this.automaticallyAuth(t);s&&(n.onauth=s)}return await n.connect(),n}close(t){t.map(ta).forEach(r=>{var n;(n=this.relays.get(r))==null||n.close(),this.relays.delete(r)})}subscribe(t,r,n){const s=[];for(let i=0;i<t.length;i++){const u=ta(t[i]);s.find(d=>d.url===u)||s.push({url:u,filter:r})}return this.subscribeMap(s,n)}subscribeMany(t,r,n){const s=[],i=[];for(let u=0;u<t.length;u++){const d=ta(t[u]);i.indexOf(d)===-1&&(i.push(d),s.push({url:d,filter:r}))}return this.subscribeMap(s,n)}subscribeMap(t,r){const n=new Map;for(const A of t){const{url:R,filter:B}=A;n.has(R)||n.set(R,[]),n.get(R).push(B)}const s=Array.from(n.entries()).map(([A,R])=>({url:A,filters:R}));this.trackRelays&&(r.receivedEvent=(A,R)=>{let B=this.seenOn.get(R);B||(B=new Set,this.seenOn.set(R,B)),B.add(A)});const i=new Set,u=[],d=[];let c=A=>{var R;d[A]||(d[A]=!0,d.filter(B=>B).length===s.length&&((R=r.oneose)==null||R.call(r),c=()=>{}))};const b=[];let w=(A,R)=>{var B;b[A]||(c(A),b[A]=R,b.filter(I=>I).length===s.length&&((B=r.onclose)==null||B.call(r,b),w=()=>{}))};const M=A=>{var B;if((B=r.alreadyHaveEvent)!=null&&B.call(r,A))return!0;const R=i.has(A);return i.add(A),R},_=Promise.all(s.map(async({url:A,filters:R},B)=>{let I;try{I=await this.ensureRelay(A,{connectionTimeout:r.maxWait?Math.max(r.maxWait*.8,r.maxWait-1e3):void 0})}catch(k){w(B,(k==null?void 0:k.message)||String(k));return}let E=I.subscribe(R,{...r,oneose:()=>c(B),onclose:k=>{k.startsWith("auth-required: ")&&r.onauth?I.auth(r.onauth).then(()=>{I.subscribe(R,{...r,oneose:()=>c(B),onclose:T=>{w(B,T)},alreadyHaveEvent:M,eoseTimeout:r.maxWait})}).catch(T=>{w(B,`auth was required and attempted, but failed with: ${T}`)}):w(B,k)},alreadyHaveEvent:M,eoseTimeout:r.maxWait});u.push(E)}));return{async close(A){await _,u.forEach(R=>{R.close(A)})}}}subscribeEose(t,r,n){const s=this.subscribe(t,r,{...n,oneose(){s.close("closed automatically on eose")}});return s}subscribeManyEose(t,r,n){const s=this.subscribeMany(t,r,{...n,oneose(){s.close("closed automatically on eose")}});return s}async querySync(t,r,n){return new Promise(async s=>{const i=[];this.subscribeEose(t,r,{...n,onevent(u){i.push(u)},onclose(u){s(i)}})})}async get(t,r,n){r.limit=1;const s=await this.querySync(t,r,n);return s.sort((i,u)=>u.created_at-i.created_at),s[0]||null}publish(t,r,n){return t.map(ta).map(async(s,i,u)=>{if(u.indexOf(s)!==i)return Promise.reject("duplicate url");let d=await this.ensureRelay(s);return d.publish(r).catch(async c=>{if(c instanceof Error&&c.message.startsWith("auth-required: ")&&(n!=null&&n.onauth))return await d.auth(n.onauth),d.publish(r);throw c}).then(c=>{if(this.trackRelays){let b=this.seenOn.get(r.id);b||(b=new Set,this.seenOn.set(r.id,b)),b.add(d)}return c})})}listConnectionStatus(){const t=new Map;return this.relays.forEach((r,n)=>t.set(n,r.connected)),t}destroy(){this.relays.forEach(t=>t.close()),this.relays=new Map}},A_;try{A_=WebSocket}catch{}var k_=class extends mP{constructor(t){super({verifyEvent:td,websocketImplementation:A_,...t})}},Bn={};Pt(Bn,{BECH32_REGEX:()=>B_,Bech32MaxSize:()=>c2,NostrTypeGuard:()=>wP,decode:()=>nd,decodeNostrURI:()=>xP,encodeBytes:()=>od,naddrEncode:()=>kP,neventEncode:()=>AP,noteEncode:()=>EP,nprofileEncode:()=>SP,npubEncode:()=>_P,nsecEncode:()=>MP});var wP={isNProfile:e=>/^nprofile1[a-z\d]+$/.test(e||""),isNEvent:e=>/^nevent1[a-z\d]+$/.test(e||""),isNAddr:e=>/^naddr1[a-z\d]+$/.test(e||""),isNSec:e=>/^nsec1[a-z\d]{58}$/.test(e||""),isNPub:e=>/^npub1[a-z\d]{58}$/.test(e||""),isNote:e=>/^note1[a-z\d]+$/.test(e||""),isNcryptsec:e=>/^ncryptsec1[a-z\d]+$/.test(e||"")},c2=5e3,B_=/[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;function bP(e){const t=new Uint8Array(4);return t[0]=e>>24&255,t[1]=e>>16&255,t[2]=e>>8&255,t[3]=e&255,t}function xP(e){try{return e.startsWith("nostr:")&&(e=e.substring(6)),nd(e)}catch{return{type:"invalid",data:null}}}function nd(e){var s,i,u,d,c,b,w;let{prefix:t,words:r}=zf.decode(e,c2),n=new Uint8Array(zf.fromWords(r));switch(t){case"nprofile":{let M=Yp(n);if(!((s=M[0])!=null&&s[0]))throw new Error("missing TLV 0 for nprofile");if(M[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:Pr(M[0][0]),relays:M[1]?M[1].map(_=>io.decode(_)):[]}}}case"nevent":{let M=Yp(n);if(!((i=M[0])!=null&&i[0]))throw new Error("missing TLV 0 for nevent");if(M[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");if(M[2]&&M[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(M[3]&&M[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:Pr(M[0][0]),relays:M[1]?M[1].map(_=>io.decode(_)):[],author:(u=M[2])!=null&&u[0]?Pr(M[2][0]):void 0,kind:(d=M[3])!=null&&d[0]?parseInt(Pr(M[3][0]),16):void 0}}}case"naddr":{let M=Yp(n);if(!((c=M[0])!=null&&c[0]))throw new Error("missing TLV 0 for naddr");if(!((b=M[2])!=null&&b[0]))throw new Error("missing TLV 2 for naddr");if(M[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(!((w=M[3])!=null&&w[0]))throw new Error("missing TLV 3 for naddr");if(M[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:io.decode(M[0][0]),pubkey:Pr(M[2][0]),kind:parseInt(Pr(M[3][0]),16),relays:M[1]?M[1].map(_=>io.decode(_)):[]}}}case"nsec":return{type:t,data:n};case"npub":case"note":return{type:t,data:Pr(n)};default:throw new Error(`unknown prefix ${t}`)}}function Yp(e){let t={},r=e;for(;r.length>0;){let n=r[0],s=r[1],i=r.slice(2,2+s);if(r=r.slice(2+s),i.length<s)throw new Error(`not enough data to read on TLV ${n}`);t[n]=t[n]||[],t[n].push(i)}return t}function MP(e){return od("nsec",e)}function _P(e){return od("npub",Ba(e))}function EP(e){return od("note",Ba(e))}function id(e,t){let r=zf.toWords(t);return zf.encode(e,r,c2)}function od(e,t){return id(e,t)}function SP(e){let t=d2({0:[Ba(e.pubkey)],1:(e.relays||[]).map(r=>Jn.encode(r))});return id("nprofile",t)}function AP(e){let t;e.kind!==void 0&&(t=bP(e.kind));let r=d2({0:[Ba(e.id)],1:(e.relays||[]).map(n=>Jn.encode(n)),2:e.author?[Ba(e.author)]:[],3:t?[new Uint8Array(t)]:[]});return id("nevent",r)}function kP(e){let t=new ArrayBuffer(4);new DataView(t).setUint32(0,e.kind,!1);let r=d2({0:[Jn.encode(e.identifier)],1:(e.relays||[]).map(n=>Jn.encode(n)),2:[Ba(e.pubkey)],3:[new Uint8Array(t)]});return id("naddr",r)}function d2(e){let t=[];return Object.entries(e).reverse().forEach(([r,n])=>{n.forEach(s=>{let i=new Uint8Array(s.length+2);i.set([parseInt(r)],0),i.set([s.length],1),i.set(s,2),t.push(i)})}),Y0(...t)}var BP={};Pt(BP,{decrypt:()=>RP,encrypt:()=>R_});function R_(e,t,r){const n=e instanceof Uint8Array?Pr(e):e,s=dl.getSharedSecret(n,"02"+t),i=$_(s);let u=Uint8Array.from(FM(16)),d=Jn.encode(r),c=QM(i,u).encrypt(d),b=yo.encode(new Uint8Array(c)),w=yo.encode(new Uint8Array(u.buffer));return`${b}?iv=${w}`}function RP(e,t,r){const n=e instanceof Uint8Array?Pr(e):e;let[s,i]=r.split("?iv="),u=dl.getSharedSecret(n,"02"+t),d=$_(u),c=yo.decode(i),b=yo.decode(s),w=QM(d,c).decrypt(b);return io.decode(w)}function $_(e){return e.slice(1,33)}var $P={};Pt($P,{NIP05_REGEX:()=>p2,isNip05:()=>NP,isValid:()=>CP,queryProfile:()=>N_,searchDomain:()=>IP,useFetchImplementation:()=>TP});var p2=/^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,NP=e=>p2.test(e||""),sd;try{sd=fetch}catch{}function TP(e){sd=e}async function IP(e,t=""){try{const r=`https://${e}/.well-known/nostr.json?name=${t}`,n=await sd(r,{redirect:"manual"});if(n.status!==200)throw Error("Wrong response code");return(await n.json()).names}catch{return{}}}async function N_(e){var s;const t=e.match(p2);if(!t)return null;const[,r="_",n]=t;try{const i=`https://${n}/.well-known/nostr.json?name=${r}`,u=await sd(i,{redirect:"manual"});if(u.status!==200)throw Error("Wrong response code");const d=await u.json(),c=d.names[r];return c?{pubkey:c,relays:(s=d.relays)==null?void 0:s[c]}:null}catch{return null}}async function CP(e,t){const r=await N_(t);return r?r.pubkey===e:!1}var PP={};Pt(PP,{parse:()=>LP});function LP(e){const t={reply:void 0,root:void 0,mentions:[],profiles:[],quotes:[]};let r,n;for(let s=e.tags.length-1;s>=0;s--){const i=e.tags[s];if(i[0]==="e"&&i[1]){const[u,d,c,b,w]=i,M={id:d,relays:c?[c]:[],author:w};if(b==="root"){t.root=M;continue}if(b==="reply"){t.reply=M;continue}if(b==="mention"){t.mentions.push(M);continue}r?n=M:r=M,t.mentions.push(M);continue}if(i[0]==="q"&&i[1]){const[u,d,c]=i;t.quotes.push({id:d,relays:c?[c]:[]})}if(i[0]==="p"&&i[1]){t.profiles.push({pubkey:i[1],relays:i[2]?[i[2]]:[]});continue}}return t.root||(t.root=n||r||t.reply),t.reply||(t.reply=r||t.root),[t.reply,t.root].forEach(s=>{if(!s)return;let i=t.mentions.indexOf(s);if(i!==-1&&t.mentions.splice(i,1),s.author){let u=t.profiles.find(d=>d.pubkey===s.author);u&&u.relays&&(s.relays||(s.relays=[]),u.relays.forEach(d=>{var c;((c=s.relays)==null?void 0:c.indexOf(d))===-1&&s.relays.push(d)}),u.relays=s.relays)}}),t.mentions.forEach(s=>{if(s.author){let i=t.profiles.find(u=>u.pubkey===s.author);i&&i.relays&&(s.relays||(s.relays=[]),i.relays.forEach(u=>{s.relays.indexOf(u)===-1&&s.relays.push(u)}),i.relays=s.relays)}}),t}var OP={};Pt(OP,{fetchRelayInformation:()=>jP,useFetchImplementation:()=>UP});var T_;try{T_=fetch}catch{}function UP(e){T_=e}async function jP(e){return await(await fetch(e.replace("ws://","http://").replace("wss://","https://"),{headers:{Accept:"application/nostr+json"}})).json()}var DP={};Pt(DP,{fastEventHash:()=>C_,getPow:()=>I_,minePow:()=>qP});function I_(e){let t=0;for(let r=0;r<64;r+=8){const n=parseInt(e.substring(r,r+8),16);if(n===0)t+=32;else{t+=Math.clz32(n);break}}return t}function qP(e,t){let r=0;const n=e,s=["nonce",r.toString(),t.toString()];for(n.tags.push(s);;){const i=Math.floor(new Date().getTime()/1e3);if(i!==n.created_at&&(r=0,n.created_at=i),s[1]=(++r).toString(),n.id=C_(n),I_(n.id)>=t)break}return n}function C_(e){return Pr(Da(Jn.encode(JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content]))))}var FP={};Pt(FP,{unwrapEvent:()=>QP,unwrapManyEvents:()=>eL,wrapEvent:()=>K_,wrapManyEvents:()=>XP});var HP={};Pt(HP,{createRumor:()=>H_,createSeal:()=>z_,createWrap:()=>W_,unwrapEvent:()=>w2,unwrapManyEvents:()=>V_,wrapEvent:()=>s0,wrapManyEvents:()=>JP});var Hr={};Pt(Hr,{decrypt:()=>m2,encrypt:()=>y2,getConversationKey:()=>v2,v2:()=>ZP});var P_=1,L_=65535;function v2(e,t){const r=dl.getSharedSecret(e,"02"+t).subarray(1,33);return AI(Da,r,"nip44-v2")}function O_(e,t){const r=kI(Da,e,t,76);return{chacha_key:r.subarray(0,32),chacha_nonce:r.subarray(32,44),hmac_key:r.subarray(44,76)}}function g2(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("expected positive integer");if(e<=32)return 32;const t=1<<Math.floor(Math.log2(e-1))+1,r=t<=256?32:t/8;return r*(Math.floor((e-1)/r)+1)}function zP(e){if(!Number.isSafeInteger(e)||e<P_||e>L_)throw new Error("invalid plaintext size: must be between 1 and 65535 bytes");const t=new Uint8Array(2);return new DataView(t.buffer).setUint16(0,e,!1),t}function WP(e){const t=Jn.encode(e),r=t.length,n=zP(r),s=new Uint8Array(g2(r)-r);return Y0(n,t,s)}function VP(e){const t=new DataView(e.buffer).getUint16(0),r=e.subarray(2,2+t);if(t<P_||t>L_||r.length!==t||e.length!==2+g2(t))throw new Error("invalid padding");return io.decode(r)}function U_(e,t,r){if(r.length!==32)throw new Error("AAD associated data must be 32 bytes");const n=Y0(r,t);return Q0(Da,e,n)}function KP(e){if(typeof e!="string")throw new Error("payload must be a valid string");const t=e.length;if(t<132||t>87472)throw new Error("invalid payload length: "+t);if(e[0]==="#")throw new Error("unknown encryption version");let r;try{r=yo.decode(e)}catch(i){throw new Error("invalid base64: "+i.message)}const n=r.length;if(n<99||n>65603)throw new Error("invalid data length: "+n);const s=r[0];if(s!==2)throw new Error("unknown encryption version "+s);return{nonce:r.subarray(1,33),ciphertext:r.subarray(33,-32),mac:r.subarray(-32)}}function y2(e,t,r=FM(32)){const{chacha_key:n,chacha_nonce:s,hmac_key:i}=O_(t,r),u=WP(e),d=n_(n,s,u),c=U_(i,d,r);return yo.encode(Y0(new Uint8Array([2]),r,d,c))}function m2(e,t){const{nonce:r,ciphertext:n,mac:s}=KP(e),{chacha_key:i,chacha_nonce:u,hmac_key:d}=O_(t,r),c=U_(d,n,r);if(!aI(c,s))throw new Error("invalid MAC");const b=n_(i,u,n);return VP(b)}var ZP={utils:{getConversationKey:v2,calcPaddedLen:g2},encrypt:y2,decrypt:m2},GP=2*24*60*60,j_=()=>Math.round(Date.now()/1e3),D_=()=>Math.round(j_()-Math.random()*GP),q_=(e,t)=>v2(e,t),F_=(e,t,r)=>y2(JSON.stringify(e),q_(t,r)),X3=(e,t)=>JSON.parse(m2(e.content,q_(t,e.pubkey)));function H_(e,t){const r={created_at:j_(),content:"",tags:[],...e,pubkey:uo(t)};return r.id=pc(r),r}function z_(e,t,r){return hn({kind:h_,content:F_(e,t,r),created_at:D_(),tags:[]},t)}function W_(e,t){const r=a_();return hn({kind:m_,content:F_(e,r,t),created_at:D_(),tags:[["p",t]]},r)}function s0(e,t,r){const n=H_(e,t),s=z_(n,t,r);return W_(s,r)}function JP(e,t,r){if(!r||r.length===0)throw new Error("At least one recipient is required.");const n=uo(t),s=[s0(e,t,n)];return r.forEach(i=>{s.push(s0(e,t,i))}),s}function w2(e,t){const r=X3(e,t);return X3(r,t)}function V_(e,t){let r=[];return e.forEach(n=>{r.push(w2(n,t))}),r.sort((n,s)=>n.created_at-s.created_at),r}function YP(e,t,r,n){const s={created_at:Math.ceil(Date.now()/1e3),kind:c_,tags:[],content:t};return(Array.isArray(e)?e:[e]).forEach(({publicKey:u,relayUrl:d})=>{s.tags.push(d?["p",u,d]:["p",u])}),n&&s.tags.push(["e",n.eventId,n.relayUrl||"","reply"]),r&&s.tags.push(["subject",r]),s}function K_(e,t,r,n,s){const i=YP(t,r,n,s);return s0(i,e,t.publicKey)}function XP(e,t,r,n,s){if(!t||t.length===0)throw new Error("At least one recipient is required.");return[{publicKey:uo(e)},...t].map(u=>K_(e,u,r,n,s))}var QP=w2,eL=V_,tL={};Pt(tL,{finishRepostEvent:()=>rL,getRepostedEvent:()=>nL,getRepostedEventPointer:()=>Z_});function rL(e,t,r,n){var u;let s;const i=[...e.tags??[],["e",t.id,r],["p",t.pubkey]];return t.kind===u_?s=f2:(s=u2,i.push(["k",String(t.kind)])),hn({kind:s,tags:i,content:e.content===""||(u=t.tags)!=null&&u.find(d=>d[0]==="-")?"":JSON.stringify(t),created_at:e.created_at},n)}function Z_(e){if(![f2,u2].includes(e.kind))return;let t,r;for(let n=e.tags.length-1;n>=0&&(t===void 0||r===void 0);n--){const s=e.tags[n];s.length>=2&&(s[0]==="e"&&t===void 0?t=s:s[0]==="p"&&r===void 0&&(r=s))}if(t!==void 0)return{id:t[1],relays:[t[2],r==null?void 0:r[2]].filter(n=>typeof n=="string"),author:r==null?void 0:r[1]}}function nL(e,{skipVerification:t}={}){const r=Z_(e);if(r===void 0||e.content==="")return;let n;try{n=JSON.parse(e.content)}catch{return}if(n.id===r.id&&!(!t&&!td(n)))return n}var iL={};Pt(iL,{NOSTR_URI_REGEX:()=>b2,parse:()=>sL,test:()=>oL});var b2=new RegExp(`nostr:(${B_.source})`);function oL(e){return typeof e=="string"&&new RegExp(`^${b2.source}$`).test(e)}function sL(e){const t=e.match(new RegExp(`^${b2.source}$`));if(!t)throw new Error(`Invalid Nostr URI: ${e}`);return{uri:t[0],value:t[1],decoded:nd(t[1])}}var aL={};Pt(aL,{finishReactionEvent:()=>fL,getReactedEventPointer:()=>lL});function fL(e,t,r){const n=t.tags.filter(s=>s.length>=2&&(s[0]==="e"||s[0]==="p"));return hn({...e,kind:l2,tags:[...e.tags??[],...n,["e",t.id],["p",t.pubkey]],content:e.content??"+"},r)}function lL(e){if(e.kind!==l2)return;let t,r;for(let n=e.tags.length-1;n>=0&&(t===void 0||r===void 0);n--){const s=e.tags[n];s.length>=2&&(s[0]==="e"&&t===void 0?t=s:s[0]==="p"&&r===void 0&&(r=s))}if(!(t===void 0||r===void 0))return{id:t[1],relays:[t[2],r[2]].filter(n=>n!==void 0),author:r[1]}}var uL={};Pt(uL,{parse:()=>cL});var Q3=/\W/m,e6=/[^\w\/] |[^\w\/]$|$|,| /m,hL=42;function*cL(e){let t=[];if(typeof e!="string"){for(let i=0;i<e.tags.length;i++){const u=e.tags[i];u[0]==="emoji"&&u.length>=3&&t.push({type:"emoji",shortcode:u[1],url:u[2]})}e=e.content}const r=e.length;let n=0,s=0;e:for(;s<r;){const i=e.indexOf(":",s),u=e.indexOf("#",s);if(i===-1&&u===-1)break e;if(i===-1||u>=0&&u<i){if(u===0||e[u-1]===" "){const d=e.slice(u+1,u+hL).match(Q3),c=d?u+1+d.index:r;yield{type:"text",text:e.slice(n,u)},yield{type:"hashtag",value:e.slice(u+1,c)},s=c,n=s;continue e}s=u+1;continue e}if(e.slice(i-5,i)==="nostr"){const d=e.slice(i+60).match(Q3),c=d?i+60+d.index:r;try{let b,{data:w,type:M}=nd(e.slice(i+1,c));switch(M){case"npub":b={pubkey:w};break;case"note":b={id:w};break;case"nsec":s=c+1;continue;default:b=w}n!==i-5&&(yield{type:"text",text:e.slice(n,i-5)}),yield{type:"reference",pointer:b},s=c,n=s;continue e}catch{s=i+1;continue e}}else if(e.slice(i-5,i)==="https"||e.slice(i-4,i)==="http"){const d=e.slice(i+4).match(e6),c=d?i+4+d.index:r,b=e[i-1]==="s"?5:4;try{let w=new URL(e.slice(i-b,c));if(w.hostname.indexOf(".")===-1)throw new Error("invalid url");if(n!==i-b&&(yield{type:"text",text:e.slice(n,i-b)}),/\.(png|jpe?g|gif|webp|heic|svg)$/i.test(w.pathname)){yield{type:"image",url:w.toString()},s=c,n=s;continue e}if(/\.(mp4|avi|webm|mkv|mov)$/i.test(w.pathname)){yield{type:"video",url:w.toString()},s=c,n=s;continue e}if(/\.(mp3|aac|ogg|opus|wav|flac)$/i.test(w.pathname)){yield{type:"audio",url:w.toString()},s=c,n=s;continue e}yield{type:"url",url:w.toString()},s=c,n=s;continue e}catch{s=c+1;continue e}}else if(e.slice(i-3,i)==="wss"||e.slice(i-2,i)==="ws"){const d=e.slice(i+4).match(e6),c=d?i+4+d.index:r,b=e[i-1]==="s"?3:2;try{let w=new URL(e.slice(i-b,c));if(w.hostname.indexOf(".")===-1)throw new Error("invalid ws url");n!==i-b&&(yield{type:"text",text:e.slice(n,i-b)}),yield{type:"relay",url:w.toString()},s=c,n=s;continue e}catch{s=c+1;continue e}}else{for(let d=0;d<t.length;d++){const c=t[d];if(e[i+c.shortcode.length+1]===":"&&e.slice(i+1,i+c.shortcode.length+1)===c.shortcode){n!==i&&(yield{type:"text",text:e.slice(n,i)}),yield c,s=i+c.shortcode.length+2,n=s;continue e}}s=i+1;continue e}}n!==r&&(yield{type:"text",text:e.slice(n)})}var dL={};Pt(dL,{channelCreateEvent:()=>pL,channelHideMessageEvent:()=>yL,channelMessageEvent:()=>gL,channelMetadataEvent:()=>vL,channelMuteUserEvent:()=>mL});var pL=(e,t)=>{let r;if(typeof e.content=="object")r=JSON.stringify(e.content);else if(typeof e.content=="string")r=e.content;else return;return hn({kind:d_,tags:[...e.tags??[]],content:r,created_at:e.created_at},t)},vL=(e,t)=>{let r;if(typeof e.content=="object")r=JSON.stringify(e.content);else if(typeof e.content=="string")r=e.content;else return;return hn({kind:p_,tags:[["e",e.channel_create_event_id],...e.tags??[]],content:r,created_at:e.created_at},t)},gL=(e,t)=>{const r=[["e",e.channel_create_event_id,e.relay_url,"root"]];return e.reply_to_channel_message_event_id&&r.push(["e",e.reply_to_channel_message_event_id,e.relay_url,"reply"]),hn({kind:v_,tags:[...r,...e.tags??[]],content:e.content,created_at:e.created_at},t)},yL=(e,t)=>{let r;if(typeof e.content=="object")r=JSON.stringify(e.content);else if(typeof e.content=="string")r=e.content;else return;return hn({kind:g_,tags:[["e",e.channel_message_event_id],...e.tags??[]],content:r,created_at:e.created_at},t)},mL=(e,t)=>{let r;if(typeof e.content=="object")r=JSON.stringify(e.content);else if(typeof e.content=="string")r=e.content;else return;return hn({kind:y_,tags:[["p",e.pubkey_to_mute],...e.tags??[]],content:r,created_at:e.created_at},t)},wL={};Pt(wL,{EMOJI_SHORTCODE_REGEX:()=>G_,matchAll:()=>bL,regex:()=>x2,replaceAll:()=>xL});var G_=/:(\w+):/,x2=()=>new RegExp(`\\B${G_.source}\\B`,"g");function*bL(e){const t=e.matchAll(x2());for(const r of t)try{const[n,s]=r;yield{shortcode:n,name:s,start:r.index,end:r.index+n.length}}catch{}}function xL(e,t){return e.replaceAll(x2(),(r,n)=>t({shortcode:r,name:n}))}var ML={};Pt(ML,{useFetchImplementation:()=>_L,validateGithub:()=>EL});var M2;try{M2=fetch}catch{}function _L(e){M2=e}async function EL(e,t,r){try{return await(await M2(`https://gist.github.com/${t}/${r}/raw`)).text()===`Verifying that I control the following Nostr public key: ${e}`}catch{return!1}}var SL={};Pt(SL,{makeNwcRequestEvent:()=>kL,parseConnectionString:()=>AL});function AL(e){const{host:t,pathname:r,searchParams:n}=new URL(e),s=r||t,i=n.get("relay"),u=n.get("secret");if(!s||!i||!u)throw new Error("invalid connection string");return{pubkey:s,relay:i,secret:u}}async function kL(e,t,r){const s=R_(t,e,JSON.stringify({method:"pay_invoice",params:{invoice:r}})),i={kind:b_,created_at:Math.round(Date.now()/1e3),content:s,tags:[["p",e]]};return hn(i,t)}var BL={};Pt(BL,{normalizeIdentifier:()=>RL});function RL(e){return e=e.trim().toLowerCase(),e=e.normalize("NFKC"),Array.from(e).map(t=>new RegExp("\\p{Letter}","u").test(t)||new RegExp("\\p{Number}","u").test(t)?t:"-").join("")}var $L={};Pt($L,{getSatoshisAmountFromBolt11:()=>LL,getZapEndpoint:()=>TL,makeZapReceipt:()=>PL,makeZapRequest:()=>IL,useFetchImplementation:()=>NL,validateZapRequest:()=>CL});var _2;try{_2=fetch}catch{}function NL(e){_2=e}async function TL(e){try{let t="",{lud06:r,lud16:n}=JSON.parse(e.content);if(n){let[u,d]=n.split("@");t=new URL(`/.well-known/lnurlp/${u}`,`https://${d}`).toString()}else if(r){let{words:u}=zf.decode(r,1e3),d=zf.fromWords(u);t=io.decode(d)}else return null;let i=await(await _2(t)).json();if(i.allowsNostr&&i.nostrPubkey)return i.callback}catch{}return null}function IL(e){let t={kind:9734,created_at:Math.round(Date.now()/1e3),content:e.comment||"",tags:[["p","pubkey"in e?e.pubkey:e.event.pubkey],["amount",e.amount.toString()],["relays",...e.relays]]};if("event"in e){if(t.tags.push(["e",e.event.id]),s2(e.event.kind)){const r=["a",`${e.event.kind}:${e.event.pubkey}:`];t.tags.push(r)}else if(a2(e.event.kind)){let r=e.event.tags.find(([s,i])=>s==="d"&&i);if(!r)throw new Error("d tag not found or is empty");const n=["a",`${e.event.kind}:${e.event.pubkey}:${r[1]}`];t.tags.push(n)}t.tags.push(["k",e.event.kind.toString()])}return t}function CL(e){let t;try{t=JSON.parse(e)}catch{return"Invalid zap request JSON."}if(!i2(t))return"Zap request is not a valid Nostr event.";if(!td(t))return"Invalid signature on zap request.";let r=t.tags.find(([i,u])=>i==="p"&&u);if(!r)return"Zap request doesn't have a 'p' tag.";if(!r[1].match(/^[a-f0-9]{64}$/))return"Zap request 'p' tag is not valid hex.";let n=t.tags.find(([i,u])=>i==="e"&&u);return n&&!n[1].match(/^[a-f0-9]{64}$/)?"Zap request 'e' tag is not valid hex.":t.tags.find(([i,u])=>i==="relays"&&u)?null:"Zap request doesn't have a 'relays' tag."}function PL({zapRequest:e,preimage:t,bolt11:r,paidAt:n}){let s=JSON.parse(e),i=s.tags.filter(([d])=>d==="e"||d==="p"||d==="a"),u={kind:9735,created_at:Math.round(n.getTime()/1e3),content:"",tags:[...i,["P",s.pubkey],["bolt11",r],["description",e]]};return t&&u.tags.push(["preimage",t]),u}function LL(e){if(e.length<50)return 0;e=e.substring(0,50);const t=e.lastIndexOf("1");if(t===-1)return 0;const r=e.substring(0,t);if(!r.startsWith("lnbc"))return 0;const n=r.substring(4);if(n.length<1)return 0;const s=n[n.length-1],i=s.charCodeAt(0)-48,u=i>=0&&i<=9;let d=n.length-1;if(u&&d++,d<1)return 0;const c=parseInt(n.substring(0,d));switch(s){case"m":return c*1e5;case"u":return c*100;case"n":return c/10;case"p":return c/1e4;default:return c*1e8}}var OL={};Pt(OL,{Negentropy:()=>Y_,NegentropyStorageVector:()=>DL,NegentropySync:()=>qL});var Xp=97,kf=32,J_=16,Fs={Skip:0,Fingerprint:1,IdList:2},Yi=class{constructor(t){ie(this,"_raw");ie(this,"length");typeof t=="number"?(this._raw=new Uint8Array(t),this.length=0):t instanceof Uint8Array?(this._raw=new Uint8Array(t),this.length=t.length):(this._raw=new Uint8Array(512),this.length=0)}unwrap(){return this._raw.subarray(0,this.length)}get capacity(){return this._raw.byteLength}extend(t){if(t instanceof Yi&&(t=t.unwrap()),typeof t.length!="number")throw Error("bad length");const r=t.length+this.length;if(this.capacity<r){const n=this._raw,s=Math.max(this.capacity*2,r);this._raw=new Uint8Array(s),this._raw.set(n)}this._raw.set(t,this.length),this.length+=t.length}shift(){const t=this._raw[0];return this._raw=this._raw.subarray(1),this.length--,t}shiftN(t=1){const r=this._raw.subarray(0,t);return this._raw=this._raw.subarray(t),this.length-=t,r}};function Uh(e){let t=0;for(;;){if(e.length===0)throw Error("parse ends prematurely");let r=e.shift();if(t=t<<7|r&127,!(r&128))break}return t}function zi(e){if(e===0)return new Yi(new Uint8Array([0]));let t=[];for(;e!==0;)t.push(e&127),e>>>=7;t.reverse();for(let r=0;r<t.length-1;r++)t[r]|=128;return new Yi(new Uint8Array(t))}function UL(e){return vc(e,1)[0]}function vc(e,t){if(e.length<t)throw Error("parse ends prematurely");return e.shiftN(t)}var jL=class{constructor(){ie(this,"buf");this.setToZero()}setToZero(){this.buf=new Uint8Array(kf)}add(t){let r=0,n=0,s=new DataView(this.buf.buffer),i=new DataView(t.buffer);for(let u=0;u<8;u++){let d=u*4,c=s.getUint32(d,!0),b=i.getUint32(d,!0),w=c;w+=r,w+=b,w>4294967295&&(n=1),s.setUint32(d,w&4294967295,!0),r=n,n=0}}negate(){let t=new DataView(this.buf.buffer);for(let n=0;n<8;n++){let s=n*4;t.setUint32(s,~t.getUint32(s,!0))}let r=new Uint8Array(kf);r[0]=1,this.add(r)}getFingerprint(t){let r=new Yi;return r.extend(this.buf),r.extend(zi(t)),Da(r.unwrap()).subarray(0,J_)}},DL=class{constructor(){ie(this,"items");ie(this,"sealed");this.items=[],this.sealed=!1}insert(t,r){if(this.sealed)throw Error("already sealed");const n=ZM(r);if(n.byteLength!==kf)throw Error("bad id size for added item");this.items.push({timestamp:t,id:n})}seal(){if(this.sealed)throw Error("already sealed");this.sealed=!0,this.items.sort(Qp);for(let t=1;t<this.items.length;t++)if(Qp(this.items[t-1],this.items[t])===0)throw Error("duplicate item inserted")}unseal(){this.sealed=!1}size(){return this._checkSealed(),this.items.length}getItem(t){if(this._checkSealed(),t>=this.items.length)throw Error("out of range");return this.items[t]}iterate(t,r,n){this._checkSealed(),this._checkBounds(t,r);for(let s=t;s<r&&n(this.items[s],s);++s);}findLowerBound(t,r,n){return this._checkSealed(),this._checkBounds(t,r),this._binarySearch(this.items,t,r,s=>Qp(s,n)<0)}fingerprint(t,r){let n=new jL;return n.setToZero(),this.iterate(t,r,s=>(n.add(s.id),!0)),n.getFingerprint(r-t)}_checkSealed(){if(!this.sealed)throw Error("not sealed")}_checkBounds(t,r){if(t>r||r>this.items.length)throw Error("bad range")}_binarySearch(t,r,n,s){let i=n-r;for(;i>0;){let u=r,d=Math.floor(i/2);u+=d,s(t[u])?(r=++u,i-=d+1):i=d}return r}},Y_=class{constructor(t,r=6e4){ie(this,"storage");ie(this,"frameSizeLimit");ie(this,"lastTimestampIn");ie(this,"lastTimestampOut");if(r<4096)throw Error("frameSizeLimit too small");this.storage=t,this.frameSizeLimit=r,this.lastTimestampIn=0,this.lastTimestampOut=0}_bound(t,r){return{timestamp:t,id:r||new Uint8Array(0)}}initiate(){let t=new Yi;return t.extend(new Uint8Array([Xp])),this.splitRange(0,this.storage.size(),this._bound(Number.MAX_VALUE),t),Ka(t.unwrap())}reconcile(t,r,n){const s=new Yi(ZM(t));this.lastTimestampIn=this.lastTimestampOut=0;let i=new Yi;i.extend(new Uint8Array([Xp]));let u=UL(s);if(u<96||u>111)throw Error("invalid negentropy protocol version byte");if(u!==Xp)throw Error("unsupported negentropy protocol version requested: "+(u-96));let d=this.storage.size(),c=this._bound(0),b=0,w=!1;for(;s.length!==0;){let M=new Yi,_=()=>{w&&(w=!1,M.extend(this.encodeBound(c)),M.extend(zi(Fs.Skip)))},A=this.decodeBound(s),R=Uh(s),B=b,I=this.storage.findLowerBound(b,d,A);if(R===Fs.Skip)w=!0;else if(R===Fs.Fingerprint){let E=vc(s,J_),k=this.storage.fingerprint(B,I);X_(E,k)!==0?(_(),this.splitRange(B,I,A,M)):w=!0}else if(R===Fs.IdList){let E=Uh(s),k={};for(let T=0;T<E;T++){let L=vc(s,kf);k[Ka(L)]=L}if(w=!0,this.storage.iterate(B,I,T=>{let L=T.id;const q=Ka(L);return k[q]?delete k[Ka(L)]:r==null||r(q),!0}),n)for(let T of Object.values(k))n(Ka(T))}else throw Error("unexpected mode");if(this.exceededFrameSizeLimit(i.length+M.length)){let E=this.storage.fingerprint(I,d);i.extend(this.encodeBound(this._bound(Number.MAX_VALUE))),i.extend(zi(Fs.Fingerprint)),i.extend(E);break}else i.extend(M);b=I,c=A}return i.length===1?null:Ka(i.unwrap())}splitRange(t,r,n,s){let i=r-t,u=16;if(i<u*2)s.extend(this.encodeBound(n)),s.extend(zi(Fs.IdList)),s.extend(zi(i)),this.storage.iterate(t,r,d=>(s.extend(d.id),!0));else{let d=Math.floor(i/u),c=i%u,b=t;for(let w=0;w<u;w++){let M=d+(w<c?1:0),_=this.storage.fingerprint(b,b+M);b+=M;let A;if(b===r)A=n;else{let R,B;this.storage.iterate(b-1,b+1,(I,E)=>(E===b-1?R=I:B=I,!0)),A=this.getMinimalBound(R,B)}s.extend(this.encodeBound(A)),s.extend(zi(Fs.Fingerprint)),s.extend(_)}}}exceededFrameSizeLimit(t){return t>this.frameSizeLimit-200}decodeTimestampIn(t){let r=Uh(t);return r=r===0?Number.MAX_VALUE:r-1,this.lastTimestampIn===Number.MAX_VALUE||r===Number.MAX_VALUE?(this.lastTimestampIn=Number.MAX_VALUE,Number.MAX_VALUE):(r+=this.lastTimestampIn,this.lastTimestampIn=r,r)}decodeBound(t){let r=this.decodeTimestampIn(t),n=Uh(t);if(n>kf)throw Error("bound key too long");let s=vc(t,n);return{timestamp:r,id:s}}encodeTimestampOut(t){if(t===Number.MAX_VALUE)return this.lastTimestampOut=Number.MAX_VALUE,zi(0);let r=t;return t-=this.lastTimestampOut,this.lastTimestampOut=r,zi(t+1)}encodeBound(t){let r=new Yi;return r.extend(this.encodeTimestampOut(t.timestamp)),r.extend(zi(t.id.length)),r.extend(t.id),r}getMinimalBound(t,r){if(r.timestamp!==t.timestamp)return this._bound(r.timestamp);{let n=0,s=r.id,i=t.id;for(let u=0;u<kf&&s[u]===i[u];u++)n++;return this._bound(r.timestamp,r.id.subarray(0,n+1))}}};function X_(e,t){for(let r=0;r<e.byteLength;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return e.byteLength>t.byteLength?1:e.byteLength<t.byteLength?-1:0}function Qp(e,t){return e.timestamp===t.timestamp?X_(e.id,t.id):e.timestamp-t.timestamp}var qL=class{constructor(t,r,n,s={}){ie(this,"relay");ie(this,"storage");ie(this,"neg");ie(this,"filter");ie(this,"subscription");ie(this,"onhave");ie(this,"onneed");this.relay=t,this.storage=r,this.neg=new Y_(r),this.onhave=s.onhave,this.onneed=s.onneed,this.filter=n,this.subscription=this.relay.prepareSubscription([{}],{label:s.label||"negentropy"}),this.subscription.oncustom=i=>{var u,d,c,b;switch(i[0]){case"NEG-MSG":{i.length<3&&console.warn(`got invalid NEG-MSG from ${this.relay.url}: ${i}`);try{const w=this.neg.reconcile(i[2],this.onhave,this.onneed);w?this.relay.send(`["NEG-MSG", "${this.subscription.id}", "${w}"]`):(this.close(),(u=s.onclose)==null||u.call(s))}catch(w){console.error("negentropy reconcile error:",w),(d=s==null?void 0:s.onclose)==null||d.call(s,`reconcile error: ${w}`)}break}case"NEG-CLOSE":{const w=i[2];console.warn("negentropy error:",w),(c=s.onclose)==null||c.call(s,w);break}case"NEG-ERR":(b=s.onclose)==null||b.call(s)}}}async start(){const t=this.neg.initiate();this.relay.send(`["NEG-OPEN","${this.subscription.id}",${JSON.stringify(this.filter)},"${t}"]`)}close(){this.relay.send(`["NEG-CLOSE","${this.subscription.id}"]`),this.subscription.close()}},FL={};Pt(FL,{getToken:()=>HL,hashPayload:()=>E2,unpackEventFromToken:()=>eE,validateEvent:()=>sE,validateEventKind:()=>rE,validateEventMethodTag:()=>iE,validateEventPayloadTag:()=>oE,validateEventTimestamp:()=>tE,validateEventUrlTag:()=>nE,validateToken:()=>zL});var Q_="Nostr ";async function HL(e,t,r,n=!1,s){const i={kind:h2,tags:[["u",e],["method",t]],created_at:Math.round(new Date().getTime()/1e3),content:""};s&&i.tags.push(["payload",E2(s)]);const u=await r(i);return(n?Q_:"")+yo.encode(Jn.encode(JSON.stringify(u)))}async function zL(e,t,r){const n=await eE(e).catch(i=>{throw i});return await sE(n,t,r).catch(i=>{throw i})}async function eE(e){if(!e)throw new Error("Missing token");e=e.replace(Q_,"");const t=io.decode(yo.decode(e));if(!t||t.length===0||!t.startsWith("{"))throw new Error("Invalid token");return JSON.parse(t)}function tE(e){return e.created_at?Math.round(new Date().getTime()/1e3)-e.created_at<60:!1}function rE(e){return e.kind===h2}function nE(e,t){const r=e.tags.find(n=>n[0]==="u");return r?r.length>0&&r[1]===t:!1}function iE(e,t){const r=e.tags.find(n=>n[0]==="method");return r?r.length>0&&r[1].toLowerCase()===t.toLowerCase():!1}function E2(e){const t=Da(Jn.encode(JSON.stringify(e)));return Pr(t)}function oE(e,t){const r=e.tags.find(s=>s[0]==="payload");if(!r)return!1;const n=E2(t);return r.length>0&&r[1]===n}async function sE(e,t,r,n){if(!td(e))throw new Error("Invalid nostr event, signature invalid");if(!rE(e))throw new Error("Invalid nostr event, kind invalid");if(!tE(e))throw new Error("Invalid nostr event, created_at timestamp invalid");if(!nE(e,t))throw new Error("Invalid nostr event, url tag invalid");if(!iE(e,r))throw new Error("Invalid nostr event, method tag invalid");if(n&&typeof n=="object"&&Object.keys(n).length>0&&!oE(e,n))throw new Error("Invalid nostr event, payload tag does not match request body hash");return!0}const ss=new k_,aE=Pe.createContext(void 0);function WL({children:e}){const[t,r]=Pe.useState({pubkey:localStorage.getItem("ncc_pubkey"),privkey:sessionStorage.getItem("ncc_privkey"),method:localStorage.getItem("ncc_method")||null,isLoading:!1,bunkerPubkey:localStorage.getItem("ncc_bunker_pubkey"),bunkerRelay:localStorage.getItem("ncc_bunker_relay"),clientSecretKey:sessionStorage.getItem("ncc_client_secret")}),n=_=>{var A;return Uint8Array.from(((A=_.match(/.{1,2}/g))==null?void 0:A.map(R=>parseInt(R,16)))||[])},s=async()=>{r(_=>({..._,isLoading:!0}));try{let _=0;for(;typeof window.nostr>"u"&&_<10;)await new Promise(R=>setTimeout(R,100)),_++;if(typeof window.nostr>"u"){alert("Nostr extension not found!"),r(R=>({...R,isLoading:!1}));return}const A=await window.nostr.getPublicKey();r({pubkey:A,privkey:null,method:"nip07",isLoading:!1}),M("nip07",A,null)}catch(_){console.error("NIP-07 Login Error:",_),alert("Login failed: "+(_.message||"Unknown error")),r(A=>({...A,isLoading:!1}))}},i=_=>{try{let A=_,R;if(_.startsWith("nsec")){const{data:I}=Bn.decode(_);R=I,A=Array.from(R).map(E=>E.toString(16).padStart(2,"0")).join("")}else A=_,R=n(A);const B=uo(R);r({pubkey:B,privkey:A,method:"nsec",isLoading:!1}),M("nsec",B,A)}catch{alert("Invalid Private Key")}},u=_=>{try{let A=_;if(_.startsWith("npub")){const{data:R}=Bn.decode(_);A=R}r({pubkey:A,privkey:null,method:"readonly",isLoading:!1}),M("readonly",A,null)}catch{alert("Invalid Public Key")}},d=(_,A,R)=>{r(B=>({...B,pubkey:_,method:"nip46",bunkerPubkey:_,bunkerRelay:A,clientSecretKey:R,isLoading:!1})),M("nip46",_,null,{bunkerPubkey:_,bunkerRelay:A,clientSecret:R})},c=async _=>{if(t.method==="nsec"&&t.privkey)return hn(_,n(t.privkey));if(t.method==="nip07"&&window.nostr)return window.nostr.signEvent(_);if(t.method==="nip46"&&t.bunkerPubkey&&t.bunkerRelay&&t.clientSecretKey){const A=n(t.clientSecretKey),R=Math.random().toString(36).substring(7),B={id:R,method:"sign_event",params:[JSON.stringify(_)]},I=Hr.getConversationKey(A,t.bunkerPubkey),E=Hr.encrypt(JSON.stringify(B),I),k=hn({kind:24133,created_at:Math.floor(Date.now()/1e3),tags:[["p",t.bunkerPubkey]],content:E},A);return await ss.publish([t.bunkerRelay],k),new Promise((T,L)=>{const q=ss.subscribeMany([t.bunkerRelay],[{kinds:[24133],"#p":[uo(A)],authors:[t.bunkerPubkey]}],{onevent(z){try{const J=Hr.decrypt(z.content,I),F=JSON.parse(J);F.id===R&&(q.close(),F.result?T(JSON.parse(F.result)):L(new Error(F.error||"Remote signing failed")))}catch{}}});setTimeout(()=>{q.close(),L(new Error("Remote signing timed out"))},3e4)})}throw new Error("No signing method available")},b=async(_,A)=>{var R;if(t.method==="nsec"&&t.privkey){const B=Hr.getConversationKey(n(t.privkey),_);return Hr.decrypt(A,B)}if(t.method==="nip07"&&((R=window.nostr)!=null&&R.nip44))return window.nostr.nip44.decrypt(_,A);if(t.method==="nip46"&&t.bunkerPubkey&&t.bunkerRelay&&t.clientSecretKey){const B=n(t.clientSecretKey),I=Math.random().toString(36).substring(7),E={id:I,method:"nip44_decrypt",params:[_,A]},k=Hr.getConversationKey(B,t.bunkerPubkey),T=Hr.encrypt(JSON.stringify(E),k),L=hn({kind:24133,created_at:Math.floor(Date.now()/1e3),tags:[["p",t.bunkerPubkey]],content:T},B);return await ss.publish([t.bunkerRelay],L),new Promise((q,z)=>{const J=ss.subscribeMany([t.bunkerRelay],[{kinds:[24133],"#p":[uo(B)],authors:[t.bunkerPubkey]}],{onevent(F){try{const X=Hr.decrypt(F.content,k),ee=JSON.parse(X);ee.id===I&&(J.close(),ee.result?q(ee.result):z(new Error(ee.error||"Remote decryption failed")))}catch{}}});setTimeout(()=>{J.close(),z(new Error("Remote decryption timed out"))},3e4)})}throw new Error("No decryption method available")},w=()=>{r({pubkey:null,privkey:null,method:null,isLoading:!1,bunkerPubkey:null,bunkerRelay:null,clientSecretKey:null}),localStorage.removeItem("ncc_pubkey"),localStorage.removeItem("ncc_method"),localStorage.removeItem("ncc_privkey"),localStorage.removeItem("ncc_bunker_pubkey"),localStorage.removeItem("ncc_bunker_relay"),sessionStorage.removeItem("ncc_privkey"),sessionStorage.removeItem("ncc_client_secret")},M=(_,A,R,B)=>{localStorage.setItem("ncc_method",_),localStorage.setItem("ncc_pubkey",A),R?sessionStorage.setItem("ncc_privkey",R):sessionStorage.removeItem("ncc_privkey"),_==="nip46"&&B&&(localStorage.setItem("ncc_bunker_pubkey",B.bunkerPubkey),localStorage.setItem("ncc_bunker_relay",B.bunkerRelay),sessionStorage.setItem("ncc_client_secret",B.clientSecret))};return V.jsx(aE.Provider,{value:{...t,loginWithNip07:s,loginWithNsec:i,loginReadOnly:u,loginWithNip46:d,signEvent:c,decryptNip44:b,logout:w},children:e})}function Ts(){const e=Pe.useContext(aE);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}function t6(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function fE(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function VL(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");t6(e.outputLen),t6(e.blockLen)}function a0(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function KL(e,t){fE(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}const e1=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const lE=e=>e instanceof Uint8Array,t1=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),fi=(e,t)=>e<<32-t|e>>>t,ZL=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!ZL)throw new Error("Non little-endian hardware is not supported");function GL(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function S2(e){if(typeof e=="string"&&(e=GL(e)),!lE(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}function JL(...e){const t=new Uint8Array(e.reduce((n,s)=>n+s.length,0));let r=0;return e.forEach(n=>{if(!lE(n))throw new Error("Uint8Array expected");t.set(n,r),r+=n.length}),t}let uE=class{clone(){return this._cloneInto()}};function YL(e){const t=n=>e().update(S2(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function hE(e=32){if(e1&&typeof e1.getRandomValues=="function")return e1.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function XL(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);const s=BigInt(32),i=BigInt(4294967295),u=Number(r>>s&i),d=Number(r&i),c=n?4:0,b=n?0:4;e.setUint32(t+c,u,n),e.setUint32(t+b,d,n)}let QL=class extends uE{constructor(t,r,n,s){super(),this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=t1(this.buffer)}update(t){a0(this);const{view:r,buffer:n,blockLen:s}=this;t=S2(t);const i=t.length;for(let u=0;u<i;){const d=Math.min(s-this.pos,i-u);if(d===s){const c=t1(t);for(;s<=i-u;u+=s)this.process(c,u);continue}n.set(t.subarray(u,u+d),this.pos),this.pos+=d,u+=d,this.pos===s&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){a0(this),KL(t,this),this.finished=!0;const{buffer:r,view:n,blockLen:s,isLE:i}=this;let{pos:u}=this;r[u++]=128,this.buffer.subarray(u).fill(0),this.padOffset>s-u&&(this.process(n,0),u=0);for(let M=u;M<s;M++)r[M]=0;XL(n,s-8,BigInt(this.length*8),i),this.process(n,0);const d=t1(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const b=c/4,w=this.get();if(b>w.length)throw new Error("_sha2: outputLen bigger than state");for(let M=0;M<b;M++)d.setUint32(4*M,w[M],i)}digest(){const{buffer:t,outputLen:r}=this;this.digestInto(t);const n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:r,buffer:n,length:s,finished:i,destroyed:u,pos:d}=this;return t.length=s,t.pos=d,t.finished=i,t.destroyed=u,s%r&&t.buffer.set(n),t}};const eO=(e,t,r)=>e&t^~e&r,tO=(e,t,r)=>e&t^e&r^t&r,rO=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Fo=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ho=new Uint32Array(64);let nO=class extends QL{constructor(){super(64,32,8,!1),this.A=Fo[0]|0,this.B=Fo[1]|0,this.C=Fo[2]|0,this.D=Fo[3]|0,this.E=Fo[4]|0,this.F=Fo[5]|0,this.G=Fo[6]|0,this.H=Fo[7]|0}get(){const{A:t,B:r,C:n,D:s,E:i,F:u,G:d,H:c}=this;return[t,r,n,s,i,u,d,c]}set(t,r,n,s,i,u,d,c){this.A=t|0,this.B=r|0,this.C=n|0,this.D=s|0,this.E=i|0,this.F=u|0,this.G=d|0,this.H=c|0}process(t,r){for(let M=0;M<16;M++,r+=4)Ho[M]=t.getUint32(r,!1);for(let M=16;M<64;M++){const _=Ho[M-15],A=Ho[M-2],R=fi(_,7)^fi(_,18)^_>>>3,B=fi(A,17)^fi(A,19)^A>>>10;Ho[M]=B+Ho[M-7]+R+Ho[M-16]|0}let{A:n,B:s,C:i,D:u,E:d,F:c,G:b,H:w}=this;for(let M=0;M<64;M++){const _=fi(d,6)^fi(d,11)^fi(d,25),A=w+_+eO(d,c,b)+rO[M]+Ho[M]|0,B=(fi(n,2)^fi(n,13)^fi(n,22))+tO(n,s,i)|0;w=b,b=c,c=d,d=u+A|0,u=i,i=s,s=n,n=A+B|0}n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,u=u+this.D|0,d=d+this.E|0,c=c+this.F|0,b=b+this.G|0,w=w+this.H|0,this.set(n,s,i,u,d,c,b,w)}roundClean(){Ho.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Zg=YL(()=>new nO);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const cE=BigInt(0),ad=BigInt(1),iO=BigInt(2),fd=e=>e instanceof Uint8Array,oO=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Wf(e){if(!fd(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=oO[e[r]];return t}function dE(e){const t=e.toString(16);return t.length&1?`0${t}`:t}function A2(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return BigInt(e===""?"0":`0x${e}`)}function Vf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(t/2);for(let n=0;n<r.length;n++){const s=n*2,i=e.slice(s,s+2),u=Number.parseInt(i,16);if(Number.isNaN(u)||u<0)throw new Error("Invalid byte sequence");r[n]=u}return r}function tn(e){return A2(Wf(e))}function k2(e){if(!fd(e))throw new Error("Uint8Array expected");return A2(Wf(Uint8Array.from(e).reverse()))}function Es(e,t){return Vf(e.toString(16).padStart(t*2,"0"))}function B2(e,t){return Es(e,t).reverse()}function sO(e){return Vf(dE(e))}function Ir(e,t,r){let n;if(typeof t=="string")try{n=Vf(t)}catch(i){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${i}`)}else if(fd(t))n=Uint8Array.from(t);else throw new Error(`${e} must be hex string or Uint8Array`);const s=n.length;if(typeof r=="number"&&s!==r)throw new Error(`${e} expected ${r} bytes, got ${s}`);return n}function Ra(...e){const t=new Uint8Array(e.reduce((n,s)=>n+s.length,0));let r=0;return e.forEach(n=>{if(!fd(n))throw new Error("Uint8Array expected");t.set(n,r),r+=n.length}),t}function aO(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function fO(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function lO(e){let t;for(t=0;e>cE;e>>=ad,t+=1);return t}function uO(e,t){return e>>BigInt(t)&ad}const hO=(e,t,r)=>e|(r?ad:cE)<<BigInt(t),R2=e=>(iO<<BigInt(e-1))-ad,r1=e=>new Uint8Array(e),r6=e=>Uint8Array.from(e);function pE(e,t,r){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=r1(e),s=r1(e),i=0;const u=()=>{n.fill(1),s.fill(0),i=0},d=(...M)=>r(s,n,...M),c=(M=r1())=>{s=d(r6([0]),M),n=d(),M.length!==0&&(s=d(r6([1]),M),n=d())},b=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let M=0;const _=[];for(;M<t;){n=d();const A=n.slice();_.push(A),M+=n.length}return Ra(..._)};return(M,_)=>{u(),c(M);let A;for(;!(A=_(b()));)c();return u(),A}}const cO={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function eh(e,t,r={}){const n=(s,i,u)=>{const d=cO[i];if(typeof d!="function")throw new Error(`Invalid validator "${i}", expected function`);const c=e[s];if(!(u&&c===void 0)&&!d(c,e))throw new Error(`Invalid param ${String(s)}=${c} (${typeof c}), expected ${i}`)};for(const[s,i]of Object.entries(t))n(s,i,!1);for(const[s,i]of Object.entries(r))n(s,i,!0);return e}const dO=Object.freeze(Object.defineProperty({__proto__:null,bitGet:uO,bitLen:lO,bitMask:R2,bitSet:hO,bytesToHex:Wf,bytesToNumberBE:tn,bytesToNumberLE:k2,concatBytes:Ra,createHmacDrbg:pE,ensureBytes:Ir,equalBytes:aO,hexToBytes:Vf,hexToNumber:A2,numberToBytesBE:Es,numberToBytesLE:B2,numberToHexUnpadded:dE,numberToVarBytesBE:sO,utf8ToBytes:fO,validateObject:eh},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const cr=BigInt(0),Jt=BigInt(1),ra=BigInt(2),pO=BigInt(3),Gg=BigInt(4),n6=BigInt(5),i6=BigInt(8);BigInt(9);BigInt(16);function xr(e,t){const r=e%t;return r>=cr?r:t+r}function vO(e,t,r){if(r<=cr||t<cr)throw new Error("Expected power/modulo > 0");if(r===Jt)return cr;let n=Jt;for(;t>cr;)t&Jt&&(n=n*e%r),e=e*e%r,t>>=Jt;return n}function wn(e,t,r){let n=e;for(;t-- >cr;)n*=n,n%=r;return n}function Jg(e,t){if(e===cr||t<=cr)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=xr(e,t),n=t,s=cr,i=Jt;for(;r!==cr;){const d=n/r,c=n%r,b=s-i*d;n=r,r=c,s=i,i=b}if(n!==Jt)throw new Error("invert: does not exist");return xr(s,t)}function gO(e){const t=(e-Jt)/ra;let r,n,s;for(r=e-Jt,n=0;r%ra===cr;r/=ra,n++);for(s=ra;s<e&&vO(s,t,e)!==e-Jt;s++);if(n===1){const u=(e+Jt)/Gg;return function(c,b){const w=c.pow(b,u);if(!c.eql(c.sqr(w),b))throw new Error("Cannot find square root");return w}}const i=(r+Jt)/ra;return function(d,c){if(d.pow(c,t)===d.neg(d.ONE))throw new Error("Cannot find square root");let b=n,w=d.pow(d.mul(d.ONE,s),r),M=d.pow(c,i),_=d.pow(c,r);for(;!d.eql(_,d.ONE);){if(d.eql(_,d.ZERO))return d.ZERO;let A=1;for(let B=d.sqr(_);A<b&&!d.eql(B,d.ONE);A++)B=d.sqr(B);const R=d.pow(w,Jt<<BigInt(b-A-1));w=d.sqr(R),M=d.mul(M,R),_=d.mul(_,w),b=A}return M}}function yO(e){if(e%Gg===pO){const t=(e+Jt)/Gg;return function(n,s){const i=n.pow(s,t);if(!n.eql(n.sqr(i),s))throw new Error("Cannot find square root");return i}}if(e%i6===n6){const t=(e-n6)/i6;return function(n,s){const i=n.mul(s,ra),u=n.pow(i,t),d=n.mul(s,u),c=n.mul(n.mul(d,ra),u),b=n.mul(d,n.sub(c,n.ONE));if(!n.eql(n.sqr(b),s))throw new Error("Cannot find square root");return b}}return gO(e)}const mO=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function wO(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=mO.reduce((n,s)=>(n[s]="function",n),t);return eh(e,r)}function bO(e,t,r){if(r<cr)throw new Error("Expected power > 0");if(r===cr)return e.ONE;if(r===Jt)return t;let n=e.ONE,s=t;for(;r>cr;)r&Jt&&(n=e.mul(n,s)),s=e.sqr(s),r>>=Jt;return n}function xO(e,t){const r=new Array(t.length),n=t.reduce((i,u,d)=>e.is0(u)?i:(r[d]=i,e.mul(i,u)),e.ONE),s=e.inv(n);return t.reduceRight((i,u,d)=>e.is0(u)?i:(r[d]=e.mul(i,r[d]),e.mul(i,u)),s),r}function vE(e,t){const r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function MO(e,t,r=!1,n={}){if(e<=cr)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:s,nByteLength:i}=vE(e,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const u=yO(e),d=Object.freeze({ORDER:e,BITS:s,BYTES:i,MASK:R2(s),ZERO:cr,ONE:Jt,create:c=>xr(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return cr<=c&&c<e},is0:c=>c===cr,isOdd:c=>(c&Jt)===Jt,neg:c=>xr(-c,e),eql:(c,b)=>c===b,sqr:c=>xr(c*c,e),add:(c,b)=>xr(c+b,e),sub:(c,b)=>xr(c-b,e),mul:(c,b)=>xr(c*b,e),pow:(c,b)=>bO(d,c,b),div:(c,b)=>xr(c*Jg(b,e),e),sqrN:c=>c*c,addN:(c,b)=>c+b,subN:(c,b)=>c-b,mulN:(c,b)=>c*b,inv:c=>Jg(c,e),sqrt:n.sqrt||(c=>u(d,c)),invertBatch:c=>xO(d,c),cmov:(c,b,w)=>w?b:c,toBytes:c=>r?B2(c,i):Es(c,i),fromBytes:c=>{if(c.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${c.length}`);return r?k2(c):tn(c)}});return Object.freeze(d)}function gE(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function yE(e){const t=gE(e);return t+Math.ceil(t/2)}function _O(e,t,r=!1){const n=e.length,s=gE(t),i=yE(t);if(n<16||n<i||n>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);const u=r?tn(e):k2(e),d=xr(u,t-Jt)+Jt;return r?B2(d,s):Es(d,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const EO=BigInt(0),n1=BigInt(1);function SO(e,t){const r=(s,i)=>{const u=i.negate();return s?u:i},n=s=>{const i=Math.ceil(t/s)+1,u=2**(s-1);return{windows:i,windowSize:u}};return{constTimeNegate:r,unsafeLadder(s,i){let u=e.ZERO,d=s;for(;i>EO;)i&n1&&(u=u.add(d)),d=d.double(),i>>=n1;return u},precomputeWindow(s,i){const{windows:u,windowSize:d}=n(i),c=[];let b=s,w=b;for(let M=0;M<u;M++){w=b,c.push(w);for(let _=1;_<d;_++)w=w.add(b),c.push(w);b=w.double()}return c},wNAF(s,i,u){const{windows:d,windowSize:c}=n(s);let b=e.ZERO,w=e.BASE;const M=BigInt(2**s-1),_=2**s,A=BigInt(s);for(let R=0;R<d;R++){const B=R*c;let I=Number(u&M);u>>=A,I>c&&(I-=_,u+=n1);const E=B,k=B+Math.abs(I)-1,T=R%2!==0,L=I<0;I===0?w=w.add(r(T,i[E])):b=b.add(r(L,i[k]))}return{p:b,f:w}},wNAFCached(s,i,u,d){const c=s._WINDOW_SIZE||1;let b=i.get(s);return b||(b=this.precomputeWindow(s,c),c!==1&&i.set(s,d(b))),this.wNAF(c,b,u)}}}function mE(e){return wO(e.Fp),eh(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...vE(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function AO(e){const t=mE(e);eh(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:s}=t;if(r){if(!n.eql(s,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:kO,hexToBytes:BO}=dO,ha={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(e){const{Err:t}=ha;if(e.length<2||e[0]!==2)throw new t("Invalid signature integer tag");const r=e[1],n=e.subarray(2,r+2);if(!r||n.length!==r)throw new t("Invalid signature integer: wrong length");if(n[0]&128)throw new t("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:kO(n),l:e.subarray(r+2)}},toSig(e){const{Err:t}=ha,r=typeof e=="string"?BO(e):e;if(!(r instanceof Uint8Array))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new t("Invalid signature tag");if(r[1]!==n-2)throw new t("Invalid signature: incorrect length");const{d:s,l:i}=ha._parseInt(r.subarray(2)),{d:u,l:d}=ha._parseInt(i);if(d.length)throw new t("Invalid signature: left bytes after parsing");return{r:s,s:u}},hexFromSig(e){const t=b=>Number.parseInt(b[0],16)&8?"00"+b:b,r=b=>{const w=b.toString(16);return w.length&1?`0${w}`:w},n=t(r(e.s)),s=t(r(e.r)),i=n.length/2,u=s.length/2,d=r(i),c=r(u);return`30${r(u+i+4)}02${c}${s}02${d}${n}`}},Xi=BigInt(0),Mn=BigInt(1);BigInt(2);const o6=BigInt(3);BigInt(4);function RO(e){const t=AO(e),{Fp:r}=t,n=t.toBytes||((R,B,I)=>{const E=B.toAffine();return Ra(Uint8Array.from([4]),r.toBytes(E.x),r.toBytes(E.y))}),s=t.fromBytes||(R=>{const B=R.subarray(1),I=r.fromBytes(B.subarray(0,r.BYTES)),E=r.fromBytes(B.subarray(r.BYTES,2*r.BYTES));return{x:I,y:E}});function i(R){const{a:B,b:I}=t,E=r.sqr(R),k=r.mul(E,R);return r.add(r.add(k,r.mul(R,B)),I)}if(!r.eql(r.sqr(t.Gy),i(t.Gx)))throw new Error("bad generator point: equation left != right");function u(R){return typeof R=="bigint"&&Xi<R&&R<t.n}function d(R){if(!u(R))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function c(R){const{allowedPrivateKeyLengths:B,nByteLength:I,wrapPrivateKey:E,n:k}=t;if(B&&typeof R!="bigint"){if(R instanceof Uint8Array&&(R=Wf(R)),typeof R!="string"||!B.includes(R.length))throw new Error("Invalid key");R=R.padStart(I*2,"0")}let T;try{T=typeof R=="bigint"?R:tn(Ir("private key",R,I))}catch{throw new Error(`private key must be ${I} bytes, hex or bigint, not ${typeof R}`)}return E&&(T=xr(T,k)),d(T),T}const b=new Map;function w(R){if(!(R instanceof M))throw new Error("ProjectivePoint expected")}class M{constructor(B,I,E){if(this.px=B,this.py=I,this.pz=E,B==null||!r.isValid(B))throw new Error("x required");if(I==null||!r.isValid(I))throw new Error("y required");if(E==null||!r.isValid(E))throw new Error("z required")}static fromAffine(B){const{x:I,y:E}=B||{};if(!B||!r.isValid(I)||!r.isValid(E))throw new Error("invalid affine point");if(B instanceof M)throw new Error("projective point not allowed");const k=T=>r.eql(T,r.ZERO);return k(I)&&k(E)?M.ZERO:new M(I,E,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(B){const I=r.invertBatch(B.map(E=>E.pz));return B.map((E,k)=>E.toAffine(I[k])).map(M.fromAffine)}static fromHex(B){const I=M.fromAffine(s(Ir("pointHex",B)));return I.assertValidity(),I}static fromPrivateKey(B){return M.BASE.multiply(c(B))}_setWindowSize(B){this._WINDOW_SIZE=B,b.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:B,y:I}=this.toAffine();if(!r.isValid(B)||!r.isValid(I))throw new Error("bad point: x or y not FE");const E=r.sqr(I),k=i(B);if(!r.eql(E,k))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:B}=this.toAffine();if(r.isOdd)return!r.isOdd(B);throw new Error("Field doesn't support isOdd")}equals(B){w(B);const{px:I,py:E,pz:k}=this,{px:T,py:L,pz:q}=B,z=r.eql(r.mul(I,q),r.mul(T,k)),J=r.eql(r.mul(E,q),r.mul(L,k));return z&&J}negate(){return new M(this.px,r.neg(this.py),this.pz)}double(){const{a:B,b:I}=t,E=r.mul(I,o6),{px:k,py:T,pz:L}=this;let q=r.ZERO,z=r.ZERO,J=r.ZERO,F=r.mul(k,k),X=r.mul(T,T),ee=r.mul(L,L),x=r.mul(k,T);return x=r.add(x,x),J=r.mul(k,L),J=r.add(J,J),q=r.mul(B,J),z=r.mul(E,ee),z=r.add(q,z),q=r.sub(X,z),z=r.add(X,z),z=r.mul(q,z),q=r.mul(x,q),J=r.mul(E,J),ee=r.mul(B,ee),x=r.sub(F,ee),x=r.mul(B,x),x=r.add(x,J),J=r.add(F,F),F=r.add(J,F),F=r.add(F,ee),F=r.mul(F,x),z=r.add(z,F),ee=r.mul(T,L),ee=r.add(ee,ee),F=r.mul(ee,x),q=r.sub(q,F),J=r.mul(ee,X),J=r.add(J,J),J=r.add(J,J),new M(q,z,J)}add(B){w(B);const{px:I,py:E,pz:k}=this,{px:T,py:L,pz:q}=B;let z=r.ZERO,J=r.ZERO,F=r.ZERO;const X=t.a,ee=r.mul(t.b,o6);let x=r.mul(I,T),o=r.mul(E,L),f=r.mul(k,q),l=r.add(I,E),h=r.add(T,L);l=r.mul(l,h),h=r.add(x,o),l=r.sub(l,h),h=r.add(I,k);let v=r.add(T,q);return h=r.mul(h,v),v=r.add(x,f),h=r.sub(h,v),v=r.add(E,k),z=r.add(L,q),v=r.mul(v,z),z=r.add(o,f),v=r.sub(v,z),F=r.mul(X,h),z=r.mul(ee,f),F=r.add(z,F),z=r.sub(o,F),F=r.add(o,F),J=r.mul(z,F),o=r.add(x,x),o=r.add(o,x),f=r.mul(X,f),h=r.mul(ee,h),o=r.add(o,f),f=r.sub(x,f),f=r.mul(X,f),h=r.add(h,f),x=r.mul(o,h),J=r.add(J,x),x=r.mul(v,h),z=r.mul(l,z),z=r.sub(z,x),x=r.mul(l,o),F=r.mul(v,F),F=r.add(F,x),new M(z,J,F)}subtract(B){return this.add(B.negate())}is0(){return this.equals(M.ZERO)}wNAF(B){return A.wNAFCached(this,b,B,I=>{const E=r.invertBatch(I.map(k=>k.pz));return I.map((k,T)=>k.toAffine(E[T])).map(M.fromAffine)})}multiplyUnsafe(B){const I=M.ZERO;if(B===Xi)return I;if(d(B),B===Mn)return this;const{endo:E}=t;if(!E)return A.unsafeLadder(this,B);let{k1neg:k,k1:T,k2neg:L,k2:q}=E.splitScalar(B),z=I,J=I,F=this;for(;T>Xi||q>Xi;)T&Mn&&(z=z.add(F)),q&Mn&&(J=J.add(F)),F=F.double(),T>>=Mn,q>>=Mn;return k&&(z=z.negate()),L&&(J=J.negate()),J=new M(r.mul(J.px,E.beta),J.py,J.pz),z.add(J)}multiply(B){d(B);let I=B,E,k;const{endo:T}=t;if(T){const{k1neg:L,k1:q,k2neg:z,k2:J}=T.splitScalar(I);let{p:F,f:X}=this.wNAF(q),{p:ee,f:x}=this.wNAF(J);F=A.constTimeNegate(L,F),ee=A.constTimeNegate(z,ee),ee=new M(r.mul(ee.px,T.beta),ee.py,ee.pz),E=F.add(ee),k=X.add(x)}else{const{p:L,f:q}=this.wNAF(I);E=L,k=q}return M.normalizeZ([E,k])[0]}multiplyAndAddUnsafe(B,I,E){const k=M.BASE,T=(q,z)=>z===Xi||z===Mn||!q.equals(k)?q.multiplyUnsafe(z):q.multiply(z),L=T(this,I).add(T(B,E));return L.is0()?void 0:L}toAffine(B){const{px:I,py:E,pz:k}=this,T=this.is0();B==null&&(B=T?r.ONE:r.inv(k));const L=r.mul(I,B),q=r.mul(E,B),z=r.mul(k,B);if(T)return{x:r.ZERO,y:r.ZERO};if(!r.eql(z,r.ONE))throw new Error("invZ was invalid");return{x:L,y:q}}isTorsionFree(){const{h:B,isTorsionFree:I}=t;if(B===Mn)return!0;if(I)return I(M,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:B,clearCofactor:I}=t;return B===Mn?this:I?I(M,this):this.multiplyUnsafe(t.h)}toRawBytes(B=!0){return this.assertValidity(),n(M,this,B)}toHex(B=!0){return Wf(this.toRawBytes(B))}}M.BASE=new M(t.Gx,t.Gy,r.ONE),M.ZERO=new M(r.ZERO,r.ONE,r.ZERO);const _=t.nBitLength,A=SO(M,t.endo?Math.ceil(_/2):_);return{CURVE:t,ProjectivePoint:M,normPrivateKeyToScalar:c,weierstrassEquation:i,isWithinCurveOrder:u}}function $O(e){const t=mE(e);return eh(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function NO(e){const t=$O(e),{Fp:r,n}=t,s=r.BYTES+1,i=2*r.BYTES+1;function u(h){return Xi<h&&h<r.ORDER}function d(h){return xr(h,n)}function c(h){return Jg(h,n)}const{ProjectivePoint:b,normPrivateKeyToScalar:w,weierstrassEquation:M,isWithinCurveOrder:_}=RO({...t,toBytes(h,v,y){const m=v.toAffine(),p=r.toBytes(m.x),a=Ra;return y?a(Uint8Array.from([v.hasEvenY()?2:3]),p):a(Uint8Array.from([4]),p,r.toBytes(m.y))},fromBytes(h){const v=h.length,y=h[0],m=h.subarray(1);if(v===s&&(y===2||y===3)){const p=tn(m);if(!u(p))throw new Error("Point is not on curve");const a=M(p);let g=r.sqrt(a);const S=(g&Mn)===Mn;return(y&1)===1!==S&&(g=r.neg(g)),{x:p,y:g}}else if(v===i&&y===4){const p=r.fromBytes(m.subarray(0,r.BYTES)),a=r.fromBytes(m.subarray(r.BYTES,2*r.BYTES));return{x:p,y:a}}else throw new Error(`Point of length ${v} was invalid. Expected ${s} compressed bytes or ${i} uncompressed bytes`)}}),A=h=>Wf(Es(h,t.nByteLength));function R(h){const v=n>>Mn;return h>v}function B(h){return R(h)?d(-h):h}const I=(h,v,y)=>tn(h.slice(v,y));class E{constructor(v,y,m){this.r=v,this.s=y,this.recovery=m,this.assertValidity()}static fromCompact(v){const y=t.nByteLength;return v=Ir("compactSignature",v,y*2),new E(I(v,0,y),I(v,y,2*y))}static fromDER(v){const{r:y,s:m}=ha.toSig(Ir("DER",v));return new E(y,m)}assertValidity(){if(!_(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!_(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(v){return new E(this.r,this.s,v)}recoverPublicKey(v){const{r:y,s:m,recovery:p}=this,a=J(Ir("msgHash",v));if(p==null||![0,1,2,3].includes(p))throw new Error("recovery id invalid");const g=p===2||p===3?y+t.n:y;if(g>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const S=p&1?"03":"02",N=b.fromHex(S+A(g)),U=c(g),Z=d(-a*U),H=d(m*U),$=b.BASE.multiplyAndAddUnsafe(N,Z,H);if(!$)throw new Error("point at infinify");return $.assertValidity(),$}hasHighS(){return R(this.s)}normalizeS(){return this.hasHighS()?new E(this.r,d(-this.s),this.recovery):this}toDERRawBytes(){return Vf(this.toDERHex())}toDERHex(){return ha.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Vf(this.toCompactHex())}toCompactHex(){return A(this.r)+A(this.s)}}const k={isValidPrivateKey(h){try{return w(h),!0}catch{return!1}},normPrivateKeyToScalar:w,randomPrivateKey:()=>{const h=yE(t.n);return _O(t.randomBytes(h),t.n)},precompute(h=8,v=b.BASE){return v._setWindowSize(h),v.multiply(BigInt(3)),v}};function T(h,v=!0){return b.fromPrivateKey(h).toRawBytes(v)}function L(h){const v=h instanceof Uint8Array,y=typeof h=="string",m=(v||y)&&h.length;return v?m===s||m===i:y?m===2*s||m===2*i:h instanceof b}function q(h,v,y=!0){if(L(h))throw new Error("first arg must be private key");if(!L(v))throw new Error("second arg must be public key");return b.fromHex(v).multiply(w(h)).toRawBytes(y)}const z=t.bits2int||function(h){const v=tn(h),y=h.length*8-t.nBitLength;return y>0?v>>BigInt(y):v},J=t.bits2int_modN||function(h){return d(z(h))},F=R2(t.nBitLength);function X(h){if(typeof h!="bigint")throw new Error("bigint expected");if(!(Xi<=h&&h<F))throw new Error(`bigint expected < 2^${t.nBitLength}`);return Es(h,t.nByteLength)}function ee(h,v,y=x){if(["recovered","canonical"].some(W=>W in y))throw new Error("sign() legacy options not supported");const{hash:m,randomBytes:p}=t;let{lowS:a,prehash:g,extraEntropy:S}=y;a==null&&(a=!0),h=Ir("msgHash",h),g&&(h=Ir("prehashed msgHash",m(h)));const N=J(h),U=w(v),Z=[X(U),X(N)];if(S!=null){const W=S===!0?p(r.BYTES):S;Z.push(Ir("extraEntropy",W))}const H=Ra(...Z),$=N;function P(W){const G=z(W);if(!_(G))return;const K=c(G),O=b.BASE.multiply(G).toAffine(),Q=d(O.x);if(Q===Xi)return;const de=d(K*d($+Q*U));if(de===Xi)return;let oe=(O.x===Q?0:2)|Number(O.y&Mn),se=de;return a&&R(de)&&(se=B(de),oe^=1),new E(Q,se,oe)}return{seed:H,k2sig:P}}const x={lowS:t.lowS,prehash:!1},o={lowS:t.lowS,prehash:!1};function f(h,v,y=x){const{seed:m,k2sig:p}=ee(h,v,y),a=t;return pE(a.hash.outputLen,a.nByteLength,a.hmac)(m,p)}b.BASE._setWindowSize(8);function l(h,v,y,m=o){var O;const p=h;if(v=Ir("msgHash",v),y=Ir("publicKey",y),"strict"in m)throw new Error("options.strict was renamed to lowS");const{lowS:a,prehash:g}=m;let S,N;try{if(typeof p=="string"||p instanceof Uint8Array)try{S=E.fromDER(p)}catch(Q){if(!(Q instanceof ha.Err))throw Q;S=E.fromCompact(p)}else if(typeof p=="object"&&typeof p.r=="bigint"&&typeof p.s=="bigint"){const{r:Q,s:de}=p;S=new E(Q,de)}else throw new Error("PARSE");N=b.fromHex(y)}catch(Q){if(Q.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(a&&S.hasHighS())return!1;g&&(v=t.hash(v));const{r:U,s:Z}=S,H=J(v),$=c(Z),P=d(H*$),W=d(U*$),G=(O=b.BASE.multiplyAndAddUnsafe(N,P,W))==null?void 0:O.toAffine();return G?d(G.x)===U:!1}return{CURVE:t,getPublicKey:T,getSharedSecret:q,sign:f,verify:l,ProjectivePoint:b,Signature:E,utils:k}}let wE=class extends uE{constructor(t,r){super(),this.finished=!1,this.destroyed=!1,VL(t);const n=S2(r);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(n.length>s?t.create().update(n).digest():n);for(let u=0;u<i.length;u++)i[u]^=54;this.iHash.update(i),this.oHash=t.create();for(let u=0;u<i.length;u++)i[u]^=106;this.oHash.update(i),i.fill(0)}update(t){return a0(this),this.iHash.update(t),this}digestInto(t){a0(this),fE(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:r,iHash:n,finished:s,destroyed:i,blockLen:u,outputLen:d}=this;return t=t,t.finished=s,t.destroyed=i,t.blockLen=u,t.outputLen=d,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const bE=(e,t,r)=>new wE(e,t).update(r).digest();bE.create=(e,t)=>new wE(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function TO(e){return{hash:e,hmac:(t,...r)=>bE(e,t,JL(...r)),randomBytes:hE}}function IO(e,t){const r=n=>NO({...e,...TO(n)});return Object.freeze({...r(t),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ld=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),f0=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),xE=BigInt(1),l0=BigInt(2),s6=(e,t)=>(e+t/l0)/t;function ME(e){const t=ld,r=BigInt(3),n=BigInt(6),s=BigInt(11),i=BigInt(22),u=BigInt(23),d=BigInt(44),c=BigInt(88),b=e*e*e%t,w=b*b*e%t,M=wn(w,r,t)*w%t,_=wn(M,r,t)*w%t,A=wn(_,l0,t)*b%t,R=wn(A,s,t)*A%t,B=wn(R,i,t)*R%t,I=wn(B,d,t)*B%t,E=wn(I,c,t)*I%t,k=wn(E,d,t)*B%t,T=wn(k,r,t)*w%t,L=wn(T,u,t)*R%t,q=wn(L,n,t)*b%t,z=wn(q,l0,t);if(!Yg.eql(Yg.sqr(z),e))throw new Error("Cannot find square root");return z}const Yg=MO(ld,void 0,void 0,{sqrt:ME}),vl=IO({a:BigInt(0),b:BigInt(7),Fp:Yg,n:f0,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=f0,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-xE*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=r,u=BigInt("0x100000000000000000000000000000000"),d=s6(i*e,t),c=s6(-n*e,t);let b=xr(e-d*r-c*s,t),w=xr(-d*n-c*i,t);const M=b>u,_=w>u;if(M&&(b=t-b),_&&(w=t-w),b>u||w>u)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:M,k1:b,k2neg:_,k2:w}}}},Zg),ud=BigInt(0),_E=e=>typeof e=="bigint"&&ud<e&&e<ld,CO=e=>typeof e=="bigint"&&ud<e&&e<f0,a6={};function u0(e,...t){let r=a6[e];if(r===void 0){const n=Zg(Uint8Array.from(e,s=>s.charCodeAt(0)));r=Ra(n,n),a6[e]=r}return Zg(Ra(r,...t))}const $2=e=>e.toRawBytes(!0).slice(1),Xg=e=>Es(e,32),i1=e=>xr(e,ld),Uu=e=>xr(e,f0),N2=vl.ProjectivePoint,PO=(e,t,r)=>N2.BASE.multiplyAndAddUnsafe(e,t,r);function Qg(e){let t=vl.utils.normPrivateKeyToScalar(e),r=N2.fromPrivateKey(t);return{scalar:r.hasEvenY()?t:Uu(-t),bytes:$2(r)}}function EE(e){if(!_E(e))throw new Error("bad x: need 0 < x < p");const t=i1(e*e),r=i1(t*e+BigInt(7));let n=ME(r);n%l0!==ud&&(n=i1(-n));const s=new N2(e,n,xE);return s.assertValidity(),s}function SE(...e){return Uu(tn(u0("BIP0340/challenge",...e)))}function LO(e){return Qg(e).bytes}function OO(e,t,r=hE(32)){const n=Ir("message",e),{bytes:s,scalar:i}=Qg(t),u=Ir("auxRand",r,32),d=Xg(i^tn(u0("BIP0340/aux",u))),c=u0("BIP0340/nonce",d,s,n),b=Uu(tn(c));if(b===ud)throw new Error("sign failed: k is zero");const{bytes:w,scalar:M}=Qg(b),_=SE(w,s,n),A=new Uint8Array(64);if(A.set(w,0),A.set(Xg(Uu(M+_*i)),32),!AE(A,n,s))throw new Error("sign: Invalid signature produced");return A}function AE(e,t,r){const n=Ir("signature",e,64),s=Ir("message",t),i=Ir("publicKey",r,32);try{const u=EE(tn(i)),d=tn(n.subarray(0,32));if(!_E(d))return!1;const c=tn(n.subarray(32,64));if(!CO(c))return!1;const b=SE(Xg(d),$2(u),s),w=PO(u,c,Uu(-b));return!(!w||!w.hasEvenY()||w.toAffine().x!==d)}catch{return!1}}const Fl={getPublicKey:LO,sign:OO,verify:AE,utils:{randomPrivateKey:vl.utils.randomPrivateKey,lift_x:EE,pointToBytes:$2,numberToBytesBE:Es,bytesToNumberBE:tn,taggedHash:u0,mod:xr}},o1=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const T2=e=>e instanceof Uint8Array,s1=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),li=(e,t)=>e<<32-t|e>>>t,UO=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!UO)throw new Error("Non little-endian hardware is not supported");const jO=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Lr(e){if(!T2(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=jO[e[r]];return t}function $a(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(t/2);for(let n=0;n<r.length;n++){const s=n*2,i=e.slice(s,s+2),u=Number.parseInt(i,16);if(Number.isNaN(u)||u<0)throw new Error("Invalid byte sequence");r[n]=u}return r}function DO(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function ju(e){if(typeof e=="string"&&(e=DO(e)),!T2(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}function hd(...e){const t=new Uint8Array(e.reduce((n,s)=>n+s.length,0));let r=0;return e.forEach(n=>{if(!T2(n))throw new Error("Uint8Array expected");t.set(n,r),r+=n.length}),t}let kE=class{clone(){return this._cloneInto()}};function BE(e){const t=n=>e().update(ju(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function RE(e=32){if(o1&&typeof o1.getRandomValues=="function")return o1.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function ey(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function qO(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}function $E(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function FO(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ey(e.outputLen),ey(e.blockLen)}function HO(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function zO(e,t){$E(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}const Mi={number:ey,bool:qO,bytes:$E,hash:FO,exists:HO,output:zO};function WO(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);const s=BigInt(32),i=BigInt(4294967295),u=Number(r>>s&i),d=Number(r&i),c=n?4:0,b=n?0:4;e.setUint32(t+c,u,n),e.setUint32(t+b,d,n)}let VO=class extends kE{constructor(t,r,n,s){super(),this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=s1(this.buffer)}update(t){Mi.exists(this);const{view:r,buffer:n,blockLen:s}=this;t=ju(t);const i=t.length;for(let u=0;u<i;){const d=Math.min(s-this.pos,i-u);if(d===s){const c=s1(t);for(;s<=i-u;u+=s)this.process(c,u);continue}n.set(t.subarray(u,u+d),this.pos),this.pos+=d,u+=d,this.pos===s&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Mi.exists(this),Mi.output(t,this),this.finished=!0;const{buffer:r,view:n,blockLen:s,isLE:i}=this;let{pos:u}=this;r[u++]=128,this.buffer.subarray(u).fill(0),this.padOffset>s-u&&(this.process(n,0),u=0);for(let M=u;M<s;M++)r[M]=0;WO(n,s-8,BigInt(this.length*8),i),this.process(n,0);const d=s1(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const b=c/4,w=this.get();if(b>w.length)throw new Error("_sha2: outputLen bigger than state");for(let M=0;M<b;M++)d.setUint32(4*M,w[M],i)}digest(){const{buffer:t,outputLen:r}=this;this.digestInto(t);const n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:r,buffer:n,length:s,finished:i,destroyed:u,pos:d}=this;return t.length=s,t.pos=d,t.finished=i,t.destroyed=u,s%r&&t.buffer.set(n),t}};const KO=(e,t,r)=>e&t^~e&r,ZO=(e,t,r)=>e&t^e&r^t&r,GO=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),zo=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Wo=new Uint32Array(64);let NE=class extends VO{constructor(){super(64,32,8,!1),this.A=zo[0]|0,this.B=zo[1]|0,this.C=zo[2]|0,this.D=zo[3]|0,this.E=zo[4]|0,this.F=zo[5]|0,this.G=zo[6]|0,this.H=zo[7]|0}get(){const{A:t,B:r,C:n,D:s,E:i,F:u,G:d,H:c}=this;return[t,r,n,s,i,u,d,c]}set(t,r,n,s,i,u,d,c){this.A=t|0,this.B=r|0,this.C=n|0,this.D=s|0,this.E=i|0,this.F=u|0,this.G=d|0,this.H=c|0}process(t,r){for(let M=0;M<16;M++,r+=4)Wo[M]=t.getUint32(r,!1);for(let M=16;M<64;M++){const _=Wo[M-15],A=Wo[M-2],R=li(_,7)^li(_,18)^_>>>3,B=li(A,17)^li(A,19)^A>>>10;Wo[M]=B+Wo[M-7]+R+Wo[M-16]|0}let{A:n,B:s,C:i,D:u,E:d,F:c,G:b,H:w}=this;for(let M=0;M<64;M++){const _=li(d,6)^li(d,11)^li(d,25),A=w+_+KO(d,c,b)+GO[M]+Wo[M]|0,B=(li(n,2)^li(n,13)^li(n,22))+ZO(n,s,i)|0;w=b,b=c,c=d,d=u+A|0,u=i,i=s,s=n,n=A+B|0}n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,u=u+this.D|0,d=d+this.E|0,c=c+this.F|0,b=b+this.G|0,w=w+this.H|0,this.set(n,s,i,u,d,c,b,w)}roundClean(){Wo.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},JO=class extends NE{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}};const qa=BE(()=>new NE);BE(()=>new JO);/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function gl(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function Ro(...e){const t=(s,i)=>u=>s(i(u)),r=Array.from(e).reverse().reduce((s,i)=>s?t(s,i.encode):i.encode,void 0),n=e.reduce((s,i)=>s?t(s,i.decode):i.decode,void 0);return{encode:r,decode:n}}function $o(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(r=>{if(gl(r),r<0||r>=e.length)throw new Error(`Digit index outside alphabet: ${r} (alphabet: ${e.length})`);return e[r]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(r=>{if(typeof r!="string")throw new Error(`alphabet.decode: not string element=${r}`);const n=e.indexOf(r);if(n===-1)throw new Error(`Unknown letter: "${r}". Allowed: ${e}`);return n})}}}function No(e=""){if(typeof e!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let r of t)if(typeof r!="string")throw new Error(`join.encode: non-string input=${r}`);return t.join(e)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(e)}}}function cd(e,t="="){if(gl(e),typeof t!="string")throw new Error("padding chr should be string");return{encode(r){if(!Array.isArray(r)||r.length&&typeof r[0]!="string")throw new Error("padding.encode input should be array of strings");for(let n of r)if(typeof n!="string")throw new Error(`padding.encode: non-string input=${n}`);for(;r.length*e%8;)r.push(t);return r},decode(r){if(!Array.isArray(r)||r.length&&typeof r[0]!="string")throw new Error("padding.encode input should be array of strings");for(let s of r)if(typeof s!="string")throw new Error(`padding.decode: non-string input=${s}`);let n=r.length;if(n*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&r[n-1]===t;n--)if(!((n-1)*e%8))throw new Error("Invalid padding: string has too much padding");return r.slice(0,n)}}}function TE(e){if(typeof e!="function")throw new Error("normalize fn should be function");return{encode:t=>t,decode:t=>e(t)}}function f6(e,t,r){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(r<2)throw new Error(`convertRadix: wrong to=${r}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let n=0;const s=[],i=Array.from(e);for(i.forEach(u=>{if(gl(u),u<0||u>=t)throw new Error(`Wrong integer: ${u}`)});;){let u=0,d=!0;for(let c=n;c<i.length;c++){const b=i[c],w=t*u+b;if(!Number.isSafeInteger(w)||t*u/t!==u||w-b!==t*u)throw new Error("convertRadix: carry overflow");if(u=w%r,i[c]=Math.floor(w/r),!Number.isSafeInteger(i[c])||i[c]*r+u!==w)throw new Error("convertRadix: carry overflow");if(d)i[c]?d=!1:n=c;else continue}if(s.push(u),d)break}for(let u=0;u<e.length-1&&e[u]===0;u++)s.push(0);return s.reverse()}const IE=(e,t)=>t?IE(t,e%t):e,h0=(e,t)=>e+(t-IE(e,t));function ty(e,t,r,n){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(h0(t,r)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${h0(t,r)}`);let s=0,i=0;const u=2**r-1,d=[];for(const c of e){if(gl(c),c>=2**t)throw new Error(`convertRadix2: invalid data word=${c} from=${t}`);if(s=s<<t|c,i+t>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=r;i-=r)d.push((s>>i-r&u)>>>0);s&=2**i-1}if(s=s<<r-i&u,!n&&i>=t)throw new Error("Excess padding");if(!n&&s)throw new Error(`Non-zero padding: ${s}`);return n&&i>0&&d.push(s>>>0),d}function YO(e){return gl(e),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return f6(Array.from(t),2**8,e)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(f6(t,e,2**8))}}}function Is(e,t=!1){if(gl(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(h0(8,e)>32||h0(e,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!(r instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return ty(Array.from(r),8,e,!t)},decode:r=>{if(!Array.isArray(r)||r.length&&typeof r[0]!="number")throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(ty(r,e,8,t))}}}function l6(e){if(typeof e!="function")throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch{}}}const XO=Ro(Is(4),$o("0123456789ABCDEF"),No("")),QO=Ro(Is(5),$o("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),cd(5),No(""));Ro(Is(5),$o("0123456789ABCDEFGHIJKLMNOPQRSTUV"),cd(5),No(""));Ro(Is(5),$o("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),No(""),TE(e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));const mo=Ro(Is(6),$o("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),cd(6),No("")),eU=Ro(Is(6),$o("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),cd(6),No("")),I2=e=>Ro(YO(58),$o(e),No("")),ry=I2("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");I2("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ");I2("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const u6=[0,2,3,5,6,7,9,10,11],tU={encode(e){let t="";for(let r=0;r<e.length;r+=8){const n=e.subarray(r,r+8);t+=ry.encode(n).padStart(u6[n.length],"1")}return t},decode(e){let t=[];for(let r=0;r<e.length;r+=11){const n=e.slice(r,r+11),s=u6.indexOf(n.length),i=ry.decode(n);for(let u=0;u<i.length-s;u++)if(i[u]!==0)throw new Error("base58xmr: wrong padding");t=t.concat(Array.from(i.slice(i.length-s)))}return Uint8Array.from(t)}},ny=Ro($o("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),No("")),h6=[996825010,642813549,513874426,1027748829,705979059];function Hl(e){const t=e>>25;let r=(e&33554431)<<5;for(let n=0;n<h6.length;n++)(t>>n&1)===1&&(r^=h6[n]);return r}function c6(e,t,r=1){const n=e.length;let s=1;for(let i=0;i<n;i++){const u=e.charCodeAt(i);if(u<33||u>126)throw new Error(`Invalid prefix (${e})`);s=Hl(s)^u>>5}s=Hl(s);for(let i=0;i<n;i++)s=Hl(s)^e.charCodeAt(i)&31;for(let i of t)s=Hl(s)^i;for(let i=0;i<6;i++)s=Hl(s);return s^=r,ny.encode(ty([s%2**30],30,5,!1))}function CE(e){const t=e==="bech32"?1:734539939,r=Is(5),n=r.decode,s=r.encode,i=l6(n);function u(w,M,_=90){if(typeof w!="string")throw new Error(`bech32.encode prefix should be string, not ${typeof w}`);if(!Array.isArray(M)||M.length&&typeof M[0]!="number")throw new Error(`bech32.encode words should be array of numbers, not ${typeof M}`);const A=w.length+7+M.length;if(_!==!1&&A>_)throw new TypeError(`Length ${A} exceeds limit ${_}`);return w=w.toLowerCase(),`${w}1${ny.encode(M)}${c6(w,M,t)}`}function d(w,M=90){if(typeof w!="string")throw new Error(`bech32.decode input should be string, not ${typeof w}`);if(w.length<8||M!==!1&&w.length>M)throw new TypeError(`Wrong string length: ${w.length} (${w}). Expected (8..${M})`);const _=w.toLowerCase();if(w!==_&&w!==w.toUpperCase())throw new Error("String must be lowercase or uppercase");w=_;const A=w.lastIndexOf("1");if(A===0||A===-1)throw new Error('Letter "1" must be present between prefix and data only');const R=w.slice(0,A),B=w.slice(A+1);if(B.length<6)throw new Error("Data must be at least 6 characters long");const I=ny.decode(B).slice(0,-6),E=c6(R,I,t);if(!B.endsWith(E))throw new Error(`Invalid checksum in ${w}: expected "${E}"`);return{prefix:R,words:I}}const c=l6(d);function b(w){const{prefix:M,words:_}=d(w,!1);return{prefix:M,words:_,bytes:n(_)}}return{encode:u,decode:d,decodeToBytes:b,decodeUnsafe:c,fromWords:n,fromWordsUnsafe:i,toWords:s}}const Kf=CE("bech32");CE("bech32m");const rU={encode:e=>new TextDecoder().decode(e),decode:e=>new TextEncoder().encode(e)},nU=Ro(Is(4),$o("0123456789abcdef"),No(""),TE(e=>{if(typeof e!="string"||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})),iU={utf8:rU,hex:nU,base16:XO,base32:QO,base64:mo,base64url:eU,base58:ry,base58xmr:tU};`${Object.keys(iU).join(", ")}`;function a1(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function d6(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}function oU(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function _i(e,...t){if(!oU(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */const jr=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),sU=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!sU)throw new Error("Non little-endian hardware is not supported");const aU=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Za(e){_i(e);let t="";for(let r=0;r<e.length;r++)t+=aU[e[r]];return t}const Di={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function p6(e){if(e>=Di._0&&e<=Di._9)return e-Di._0;if(e>=Di._A&&e<=Di._F)return e-(Di._A-10);if(e>=Di._a&&e<=Di._f)return e-(Di._a-10)}function PE(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let s=0,i=0;s<r;s++,i+=2){const u=p6(e.charCodeAt(i)),d=p6(e.charCodeAt(i+1));if(u===void 0||d===void 0){const c=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}n[s]=u*16+d}return n}function fU(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function lU(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}const uU=(e,t)=>(Object.assign(t,e),t),ms=16,hU=283;function C2(e){return e<<1^hU&-(e>>7)}function gf(e,t){let r=0;for(;t>0;t>>=1)r^=e&-(t&1),e=C2(e);return r}const iy=(()=>{let e=new Uint8Array(256);for(let r=0,n=1;r<256;r++,n^=C2(n))e[r]=n;const t=new Uint8Array(256);t[0]=99;for(let r=0;r<255;r++){let n=e[255-r];n|=n<<8,t[e[r]]=(n^n>>4^n>>5^n>>6^n>>7^99)&255}return t})(),cU=iy.map((e,t)=>iy.indexOf(t)),dU=e=>e<<24|e>>>8,f1=e=>e<<8|e>>>24;function LE(e,t){if(e.length!==256)throw new Error("Wrong sbox length");const r=new Uint32Array(256).map((b,w)=>t(e[w])),n=r.map(f1),s=n.map(f1),i=s.map(f1),u=new Uint32Array(256*256),d=new Uint32Array(256*256),c=new Uint16Array(256*256);for(let b=0;b<256;b++)for(let w=0;w<256;w++){const M=b*256+w;u[M]=r[b]^n[w],d[M]=s[b]^i[w],c[M]=e[b]<<8|e[w]}return{sbox:e,sbox2:c,T0:r,T1:n,T2:s,T3:i,T01:u,T23:d}}const P2=LE(iy,e=>gf(e,3)<<24|e<<16|e<<8|gf(e,2)),OE=LE(cU,e=>gf(e,11)<<24|gf(e,13)<<16|gf(e,9)<<8|gf(e,14)),pU=(()=>{const e=new Uint8Array(16);for(let t=0,r=1;t<16;t++,r=C2(r))e[t]=r;return e})();function UE(e){_i(e);const t=e.length;if(![16,24,32].includes(t))throw new Error(`aes: wrong key size: should be 16, 24 or 32, got: ${t}`);const{sbox2:r}=P2,n=jr(e),s=n.length,i=d=>Ei(r,d,d,d,d),u=new Uint32Array(t+28);u.set(n);for(let d=s;d<u.length;d++){let c=u[d-1];d%s===0?c=i(dU(c))^pU[d/s-1]:s>6&&d%s===4&&(c=i(c)),u[d]=u[d-s]^c}return u}function vU(e){const t=UE(e),r=t.slice(),n=t.length,{sbox2:s}=P2,{T0:i,T1:u,T2:d,T3:c}=OE;for(let b=0;b<n;b+=4)for(let w=0;w<4;w++)r[b+w]=t[n-b-4+w];t.fill(0);for(let b=4;b<n-4;b++){const w=r[b],M=Ei(s,w,w,w,w);r[b]=i[M&255]^u[M>>>8&255]^d[M>>>16&255]^c[M>>>24]}return r}function as(e,t,r,n,s,i){return e[r<<8&65280|n>>>8&255]^t[s>>>8&65280|i>>>24&255]}function Ei(e,t,r,n,s){return e[t&255|r&65280]|e[n>>>16&255|s>>>16&65280]<<16}function v6(e,t,r,n,s){const{sbox2:i,T01:u,T23:d}=P2;let c=0;t^=e[c++],r^=e[c++],n^=e[c++],s^=e[c++];const b=e.length/4-2;for(let R=0;R<b;R++){const B=e[c++]^as(u,d,t,r,n,s),I=e[c++]^as(u,d,r,n,s,t),E=e[c++]^as(u,d,n,s,t,r),k=e[c++]^as(u,d,s,t,r,n);t=B,r=I,n=E,s=k}const w=e[c++]^Ei(i,t,r,n,s),M=e[c++]^Ei(i,r,n,s,t),_=e[c++]^Ei(i,n,s,t,r),A=e[c++]^Ei(i,s,t,r,n);return{s0:w,s1:M,s2:_,s3:A}}function gU(e,t,r,n,s){const{sbox2:i,T01:u,T23:d}=OE;let c=0;t^=e[c++],r^=e[c++],n^=e[c++],s^=e[c++];const b=e.length/4-2;for(let R=0;R<b;R++){const B=e[c++]^as(u,d,t,s,n,r),I=e[c++]^as(u,d,r,t,s,n),E=e[c++]^as(u,d,n,r,t,s),k=e[c++]^as(u,d,s,n,r,t);t=B,r=I,n=E,s=k}const w=e[c++]^Ei(i,t,s,n,r),M=e[c++]^Ei(i,r,t,s,n),_=e[c++]^Ei(i,n,r,t,s),A=e[c++]^Ei(i,s,n,r,t);return{s0:w,s1:M,s2:_,s3:A}}function jE(e,t){if(!t)return new Uint8Array(e);if(_i(t),t.length<e)throw new Error(`aes: wrong destination length, expected at least ${e}, got: ${t.length}`);return t}function yU(e){if(_i(e),e.length%ms!==0)throw new Error(`aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size ${ms}`)}function mU(e,t,r){let n=e.length;const s=n%ms;if(!t&&s!==0)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");const i=jr(e);if(t){let c=ms-s;c||(c=ms),n=n+c}const u=jE(n,r),d=jr(u);return{b:i,o:d,out:u}}function wU(e,t){if(!t)return e;const r=e.length;if(!r)throw new Error("aes/pcks5: empty ciphertext not allowed");const n=e[r-1];if(n<=0||n>16)throw new Error(`aes/pcks5: wrong padding byte: ${n}`);const s=e.subarray(0,-n);for(let i=0;i<n;i++)if(e[r-i-1]!==n)throw new Error("aes/pcks5: wrong padding");return s}function bU(e){const t=new Uint8Array(16),r=jr(t);t.set(e);const n=ms-e.length;for(let s=ms-n;s<ms;s++)t[s]=n;return r}const DE=uU({blockSize:16,nonceLength:16},function(t,r,n={}){_i(t),_i(r,16);const s=!n.disablePadding;return{encrypt:(i,u)=>{const d=UE(t),{b:c,o:b,out:w}=mU(i,s,u),M=jr(r);let _=M[0],A=M[1],R=M[2],B=M[3],I=0;for(;I+4<=c.length;)_^=c[I+0],A^=c[I+1],R^=c[I+2],B^=c[I+3],{s0:_,s1:A,s2:R,s3:B}=v6(d,_,A,R,B),b[I++]=_,b[I++]=A,b[I++]=R,b[I++]=B;if(s){const E=bU(i.subarray(I*4));_^=E[0],A^=E[1],R^=E[2],B^=E[3],{s0:_,s1:A,s2:R,s3:B}=v6(d,_,A,R,B),b[I++]=_,b[I++]=A,b[I++]=R,b[I++]=B}return d.fill(0),w},decrypt:(i,u)=>{yU(i);const d=vU(t),c=jr(r),b=jE(i.length,u),w=jr(i),M=jr(b);let _=c[0],A=c[1],R=c[2],B=c[3];for(let I=0;I+4<=w.length;){const E=_,k=A,T=R,L=B;_=w[I+0],A=w[I+1],R=w[I+2],B=w[I+3];const{s0:q,s1:z,s2:J,s3:F}=gU(d,_,A,R,B);M[I++]=q^E,M[I++]=z^k,M[I++]=J^T,M[I++]=F^L}return d.fill(0),wU(b,s)}}}),qE=e=>Uint8Array.from(e.split("").map(t=>t.charCodeAt(0))),xU=qE("expand 16-byte k"),MU=qE("expand 32-byte k"),_U=jr(xU),FE=jr(MU);FE.slice();function ft(e,t){return e<<t|e>>>32-t}function oy(e){return e.byteOffset%4===0}const jh=64,EU=16,HE=2**32-1,g6=new Uint32Array;function SU(e,t,r,n,s,i,u,d){const c=s.length,b=new Uint8Array(jh),w=jr(b),M=oy(s)&&oy(i),_=M?jr(s):g6,A=M?jr(i):g6;for(let R=0;R<c;u++){if(e(t,r,n,w,u,d),u>=HE)throw new Error("arx: counter overflow");const B=Math.min(jh,c-R);if(M&&B===jh){const I=R/4;if(R%4!==0)throw new Error("arx: invalid block position");for(let E=0,k;E<EU;E++)k=I+E,A[k]=_[k]^w[E];R+=jh;continue}for(let I=0,E;I<B;I++)E=R+I,i[E]=s[E]^b[I];R+=B}}function AU(e,t){const{allowShortKeys:r,extendNonceFn:n,counterLength:s,counterRight:i,rounds:u}=fU({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return a1(s),a1(u),d6(i),d6(r),(d,c,b,w,M=0)=>{_i(d),_i(c),_i(b);const _=b.length;if(w||(w=new Uint8Array(_)),_i(w),a1(M),M<0||M>=HE)throw new Error("arx: counter overflow");if(w.length<_)throw new Error(`arx: output (${w.length}) is shorter than data (${_})`);const A=[];let R=d.length,B,I;if(R===32)B=d.slice(),A.push(B),I=FE;else if(R===16&&r)B=new Uint8Array(32),B.set(d),B.set(d,16),I=_U,A.push(B);else throw new Error(`arx: invalid 32-byte key, got length=${R}`);oy(c)||(c=c.slice(),A.push(c));const E=jr(B);if(n){if(c.length!==24)throw new Error("arx: extended nonce must be 24 bytes");n(I,E,jr(c.subarray(0,16)),E),c=c.subarray(16)}const k=16-s;if(k!==c.length)throw new Error(`arx: nonce must be ${k} or 16 bytes`);if(k!==12){const L=new Uint8Array(12);L.set(c,i?0:12-c.length),c=L,A.push(c)}const T=jr(c);for(SU(e,I,E,T,b,w,M,u);A.length>0;)A.pop().fill(0);return w}}function kU(e,t,r,n,s,i=20){let u=e[0],d=e[1],c=e[2],b=e[3],w=t[0],M=t[1],_=t[2],A=t[3],R=t[4],B=t[5],I=t[6],E=t[7],k=s,T=r[0],L=r[1],q=r[2],z=u,J=d,F=c,X=b,ee=w,x=M,o=_,f=A,l=R,h=B,v=I,y=E,m=k,p=T,a=L,g=q;for(let N=0;N<i;N+=2)z=z+ee|0,m=ft(m^z,16),l=l+m|0,ee=ft(ee^l,12),z=z+ee|0,m=ft(m^z,8),l=l+m|0,ee=ft(ee^l,7),J=J+x|0,p=ft(p^J,16),h=h+p|0,x=ft(x^h,12),J=J+x|0,p=ft(p^J,8),h=h+p|0,x=ft(x^h,7),F=F+o|0,a=ft(a^F,16),v=v+a|0,o=ft(o^v,12),F=F+o|0,a=ft(a^F,8),v=v+a|0,o=ft(o^v,7),X=X+f|0,g=ft(g^X,16),y=y+g|0,f=ft(f^y,12),X=X+f|0,g=ft(g^X,8),y=y+g|0,f=ft(f^y,7),z=z+x|0,g=ft(g^z,16),v=v+g|0,x=ft(x^v,12),z=z+x|0,g=ft(g^z,8),v=v+g|0,x=ft(x^v,7),J=J+o|0,m=ft(m^J,16),y=y+m|0,o=ft(o^y,12),J=J+o|0,m=ft(m^J,8),y=y+m|0,o=ft(o^y,7),F=F+f|0,p=ft(p^F,16),l=l+p|0,f=ft(f^l,12),F=F+f|0,p=ft(p^F,8),l=l+p|0,f=ft(f^l,7),X=X+ee|0,a=ft(a^X,16),h=h+a|0,ee=ft(ee^h,12),X=X+ee|0,a=ft(a^X,8),h=h+a|0,ee=ft(ee^h,7);let S=0;n[S++]=u+z|0,n[S++]=d+J|0,n[S++]=c+F|0,n[S++]=b+X|0,n[S++]=w+ee|0,n[S++]=M+x|0,n[S++]=_+o|0,n[S++]=A+f|0,n[S++]=R+l|0,n[S++]=B+h|0,n[S++]=I+v|0,n[S++]=E+y|0,n[S++]=k+m|0,n[S++]=T+p|0,n[S++]=L+a|0,n[S++]=q+g|0}const zE=AU(kU,{counterRight:!1,counterLength:4,allowShortKeys:!1});let WE=class extends kE{constructor(t,r){super(),this.finished=!1,this.destroyed=!1,Mi.hash(t);const n=ju(r);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(n.length>s?t.create().update(n).digest():n);for(let u=0;u<i.length;u++)i[u]^=54;this.iHash.update(i),this.oHash=t.create();for(let u=0;u<i.length;u++)i[u]^=106;this.oHash.update(i),i.fill(0)}update(t){return Mi.exists(this),this.iHash.update(t),this}digestInto(t){Mi.exists(this),Mi.bytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:r,iHash:n,finished:s,destroyed:i,blockLen:u,outputLen:d}=this;return t=t,t.finished=s,t.destroyed=i,t.blockLen=u,t.outputLen=d,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const dd=(e,t,r)=>new WE(e,t).update(r).digest();dd.create=(e,t)=>new WE(e,t);function BU(e,t,r){return Mi.hash(e),dd(e,ju(r),ju(t))}const l1=new Uint8Array([0]),y6=new Uint8Array;function RU(e,t,r,n=32){if(Mi.hash(e),Mi.number(n),n>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const s=Math.ceil(n/e.outputLen);r===void 0&&(r=y6);const i=new Uint8Array(s*e.outputLen),u=dd.create(e,t),d=u._cloneInto(),c=new Uint8Array(u.outputLen);for(let b=0;b<s;b++)l1[0]=b+1,d.update(b===0?y6:c).update(r).update(l1).digestInto(c),i.set(c,e.outputLen*b),u._cloneInto(d);return u.destroy(),d.destroy(),c.fill(0),l1.fill(0),i.slice(0,n)}var $U=Object.defineProperty,Lt=(e,t)=>{for(var r in t)$U(e,r,{get:t[r],enumerable:!0})},Xs=Symbol("verified"),NU=e=>e instanceof Object;function L2(e){if(!NU(e)||typeof e.kind!="number"||typeof e.content!="string"||typeof e.created_at!="number"||typeof e.pubkey!="string"||!e.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(e.tags))return!1;for(let t=0;t<e.tags.length;t++){let r=e.tags[t];if(!Array.isArray(r))return!1;for(let n=0;n<r.length;n++)if(typeof r[n]!="string")return!1}return!0}var TU={};Lt(TU,{Queue:()=>KE,QueueNode:()=>VE,binarySearch:()=>O2,bytesToHex:()=>Lr,hexToBytes:()=>$a,insertEventIntoAscendingList:()=>CU,insertEventIntoDescendingList:()=>IU,normalizeURL:()=>na,utf8Decoder:()=>oo,utf8Encoder:()=>Yn});var oo=new TextDecoder("utf-8"),Yn=new TextEncoder;function na(e){try{e.indexOf("://")===-1&&(e="wss://"+e);let t=new URL(e);return t.protocol==="http:"?t.protocol="ws:":t.protocol==="https:"&&(t.protocol="wss:"),t.pathname=t.pathname.replace(/\/+/g,"/"),t.pathname.endsWith("/")&&(t.pathname=t.pathname.slice(0,-1)),(t.port==="80"&&t.protocol==="ws:"||t.port==="443"&&t.protocol==="wss:")&&(t.port=""),t.searchParams.sort(),t.hash="",t.toString()}catch{throw new Error(`Invalid URL: ${e}`)}}function IU(e,t){const[r,n]=O2(e,s=>t.id===s.id?0:t.created_at===s.created_at?-1:s.created_at-t.created_at);return n||e.splice(r,0,t),e}function CU(e,t){const[r,n]=O2(e,s=>t.id===s.id?0:t.created_at===s.created_at?-1:t.created_at-s.created_at);return n||e.splice(r,0,t),e}function O2(e,t){let r=0,n=e.length-1;for(;r<=n;){const s=Math.floor((r+n)/2),i=t(e[s]);if(i===0)return[s,!0];i<0?n=s-1:r=s+1}return[r,!1]}var VE=class{constructor(t){ie(this,"value");ie(this,"next",null);ie(this,"prev",null);this.value=t}},KE=class{constructor(){ie(this,"first");ie(this,"last");this.first=null,this.last=null}enqueue(t){const r=new VE(t);return this.last?this.last===this.first?(this.last=r,this.last.prev=this.first,this.first.next=r):(r.prev=this.last,this.last.next=r,this.last=r):(this.first=r,this.last=r),!0}dequeue(){if(!this.first)return null;if(this.first===this.last){const r=this.first;return this.first=null,this.last=null,r.value}const t=this.first;return this.first=t.next,this.first&&(this.first.prev=null),t.value}},PU=class{generateSecretKey(){return Fl.utils.randomPrivateKey()}getPublicKey(t){return Lr(Fl.getPublicKey(t))}finalizeEvent(t,r){const n=t;return n.pubkey=Lr(Fl.getPublicKey(r)),n.id=gc(n),n.sig=Lr(Fl.sign(gc(n),r)),n[Xs]=!0,n}verifyEvent(t){if(typeof t[Xs]=="boolean")return t[Xs];const r=gc(t);if(r!==t.id)return t[Xs]=!1,!1;try{const n=Fl.verify(t.sig,r,t.pubkey);return t[Xs]=n,n}catch{return t[Xs]=!1,!1}}};function LU(e){if(!L2(e))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content])}function gc(e){let t=qa(Yn.encode(LU(e)));return Lr(t)}var pd=new PU,ZE=pd.generateSecretKey,Na=pd.getPublicKey,Tn=pd.finalizeEvent,Zf=pd.verifyEvent,OU={};Lt(OU,{Application:()=>Gj,BadgeAward:()=>WU,BadgeDefinition:()=>Fj,BlockedRelaysList:()=>Ej,BlossomServerList:()=>Nj,BookmarkList:()=>xj,Bookmarksets:()=>jj,Calendar:()=>rD,CalendarEventRSVP:()=>nD,ChannelCreation:()=>e7,ChannelHideMessage:()=>n7,ChannelMessage:()=>r7,ChannelMetadata:()=>t7,ChannelMuteUser:()=>i7,ChatMessage:()=>VU,ClassifiedListing:()=>Xj,ClientAuth:()=>s7,Comment:()=>tj,CommunitiesList:()=>Mj,CommunityDefinition:()=>aD,CommunityPostApproval:()=>lj,Contacts:()=>FU,CreateOrUpdateProduct:()=>Wj,CreateOrUpdateStall:()=>zj,Curationsets:()=>Dj,Date:()=>eD,DirectMessageRelaysList:()=>Rj,DraftClassifiedListing:()=>Qj,DraftLong:()=>Kj,Emojisets:()=>Zj,EncryptedDirectMessage:()=>HU,EventDeletion:()=>zU,FavoriteRelays:()=>Aj,FileMessage:()=>ZU,FileMetadata:()=>ej,FileServerPreference:()=>$j,Followsets:()=>Lj,ForumThread:()=>KU,GenericRepost:()=>F2,Genericlists:()=>Oj,GiftWrap:()=>o7,GroupMetadata:()=>fD,HTTPAuth:()=>H2,Handlerinformation:()=>sD,Handlerrecommendation:()=>oD,Highlights:()=>gj,InterestsList:()=>kj,Interestsets:()=>Hj,JobFeedback:()=>cj,JobRequest:()=>uj,JobResult:()=>hj,Label:()=>fj,LightningPubRPC:()=>Ij,LiveChatMessage:()=>rj,LiveEvent:()=>Jj,LongFormArticle:()=>Vj,Metadata:()=>DU,Mutelist:()=>mj,NWCWalletInfo:()=>Tj,NWCWalletRequest:()=>a7,NWCWalletResponse:()=>Cj,NormalVideo:()=>JU,NostrConnect:()=>Pj,OpenTimestamps:()=>XU,Photo:()=>GU,Pinlist:()=>wj,Poll:()=>QU,PollResponse:()=>yj,PrivateDirectMessage:()=>QE,ProblemTracker:()=>oj,ProfileBadges:()=>qj,PublicChatsList:()=>_j,Reaction:()=>q2,RecommendRelay:()=>qU,RelayList:()=>bj,RelayReview:()=>iD,Relaysets:()=>Uj,Report:()=>sj,Reporting:()=>aj,Repost:()=>D2,Seal:()=>XE,SearchRelaysList:()=>Sj,ShortTextNote:()=>YE,ShortVideo:()=>YU,Time:()=>tD,UserEmojiList:()=>Bj,UserStatuses:()=>Yj,Voice:()=>nj,VoiceComment:()=>ij,Zap:()=>vj,ZapGoal:()=>dj,ZapRequest:()=>pj,classifyKind:()=>UU,isAddressableKind:()=>j2,isEphemeralKind:()=>JE,isKind:()=>jU,isRegularKind:()=>GE,isReplaceableKind:()=>U2});function GE(e){return e<1e4&&e!==0&&e!==3}function U2(e){return e===0||e===3||1e4<=e&&e<2e4}function JE(e){return 2e4<=e&&e<3e4}function j2(e){return 3e4<=e&&e<4e4}function UU(e){return GE(e)?"regular":U2(e)?"replaceable":JE(e)?"ephemeral":j2(e)?"parameterized":"unknown"}function jU(e,t){const r=t instanceof Array?t:[t];return L2(e)&&r.includes(e.kind)||!1}var DU=0,YE=1,qU=2,FU=3,HU=4,zU=5,D2=6,q2=7,WU=8,VU=9,KU=11,XE=13,QE=14,ZU=15,F2=16,GU=20,JU=21,YU=22,e7=40,t7=41,r7=42,n7=43,i7=44,XU=1040,o7=1059,QU=1068,ej=1063,tj=1111,rj=1311,nj=1222,ij=1244,oj=1971,sj=1984,aj=1984,fj=1985,lj=4550,uj=5999,hj=6999,cj=7e3,dj=9041,pj=9734,vj=9735,gj=9802,yj=1018,mj=1e4,wj=10001,bj=10002,xj=10003,Mj=10004,_j=10005,Ej=10006,Sj=10007,Aj=10012,kj=10015,Bj=10030,Rj=10050,$j=10096,Nj=10063,Tj=13194,Ij=21e3,s7=22242,a7=23194,Cj=23195,Pj=24133,H2=27235,Lj=3e4,Oj=30001,Uj=30002,jj=30003,Dj=30004,qj=30008,Fj=30009,Hj=30015,zj=30017,Wj=30018,Vj=30023,Kj=30024,Zj=30030,Gj=30078,Jj=30311,Yj=30315,Xj=30402,Qj=30403,eD=31922,tD=31923,rD=31924,nD=31925,iD=31987,oD=31989,sD=31990,aD=34550,fD=39e3;function lD(e,t){if(e.ids&&e.ids.indexOf(t.id)===-1||e.kinds&&e.kinds.indexOf(t.kind)===-1||e.authors&&e.authors.indexOf(t.pubkey)===-1)return!1;for(let r in e)if(r[0]==="#"){let n=r.slice(1),s=e[`#${n}`];if(s&&!t.tags.find(([i,u])=>i===r.slice(1)&&s.indexOf(u)!==-1))return!1}return!(e.since&&t.created_at<e.since||e.until&&t.created_at>e.until)}function uD(e,t){for(let r=0;r<e.length;r++)if(lD(e[r],t))return!0;return!1}var hD={};Lt(hD,{getHex64:()=>vd,getInt:()=>f7,getSubscriptionId:()=>l7,matchEventId:()=>cD,matchEventKind:()=>pD,matchEventPubkey:()=>dD});function vd(e,t){let r=t.length+3,n=e.indexOf(`"${t}":`)+r,s=e.slice(n).indexOf('"')+n+1;return e.slice(s,s+64)}function f7(e,t){let r=t.length,n=e.indexOf(`"${t}":`)+r+3,s=e.slice(n),i=Math.min(s.indexOf(","),s.indexOf("}"));return parseInt(s.slice(0,i),10)}function l7(e){let t=e.slice(0,22).indexOf('"EVENT"');if(t===-1)return null;let r=e.slice(t+7+1).indexOf('"');if(r===-1)return null;let n=t+7+1+r,s=e.slice(n+1,80).indexOf('"');if(s===-1)return null;let i=n+1+s;return e.slice(n+1,i)}function cD(e,t){return t===vd(e,"id")}function dD(e,t){return t===vd(e,"pubkey")}function pD(e,t){return t===f7(e,"kind")}var vD={};Lt(vD,{makeAuthEvent:()=>u7});function u7(e,t){return{kind:s7,created_at:Math.floor(Date.now()/1e3),tags:[["relay",e],["challenge",t]],content:""}}async function gD(){return new Promise((e,t)=>{try{if(typeof MessageChannel<"u"){const r=new MessageChannel,n=()=>{r.port1.removeEventListener("message",n),e()};r.port1.addEventListener("message",n),r.port2.postMessage(0),r.port1.start()}else typeof setImmediate<"u"?setImmediate(e):typeof setTimeout<"u"?setTimeout(e,0):e()}catch(r){console.error("during yield: ",r),t(r)}})}var yD=e=>(e[Xs]=!0,!0),h7=class extends Error{constructor(t,r){super(`Tried to send message '${t} on a closed connection to ${r}.`),this.name="SendingOnClosedConnection"}},c7=class{constructor(t,r){ie(this,"url");ie(this,"_connected",!1);ie(this,"onclose",null);ie(this,"onnotice",t=>console.debug(`NOTICE from ${this.url}: ${t}`));ie(this,"onauth");ie(this,"baseEoseTimeout",4400);ie(this,"connectionTimeout",4400);ie(this,"publishTimeout",4400);ie(this,"pingFrequency",29e3);ie(this,"pingTimeout",2e4);ie(this,"resubscribeBackoff",[1e4,1e4,1e4,2e4,2e4,3e4,6e4]);ie(this,"openSubs",new Map);ie(this,"enablePing");ie(this,"enableReconnect");ie(this,"connectionTimeoutHandle");ie(this,"reconnectTimeoutHandle");ie(this,"pingIntervalHandle");ie(this,"reconnectAttempts",0);ie(this,"closedIntentionally",!1);ie(this,"connectionPromise");ie(this,"openCountRequests",new Map);ie(this,"openEventPublishes",new Map);ie(this,"ws");ie(this,"incomingMessageQueue",new KE);ie(this,"queueRunning",!1);ie(this,"challenge");ie(this,"authPromise");ie(this,"serial",0);ie(this,"verifyEvent");ie(this,"_WebSocket");this.url=na(t),this.verifyEvent=r.verifyEvent,this._WebSocket=r.websocketImplementation||WebSocket,this.enablePing=r.enablePing,this.enableReconnect=r.enableReconnect||!1}static async connect(t,r){const n=new c7(t,r);return await n.connect(),n}closeAllSubscriptions(t){for(let[r,n]of this.openSubs)n.close(t);this.openSubs.clear();for(let[r,n]of this.openEventPublishes)n.reject(new Error(t));this.openEventPublishes.clear();for(let[r,n]of this.openCountRequests)n.reject(new Error(t));this.openCountRequests.clear()}get connected(){return this._connected}async reconnect(){const t=this.resubscribeBackoff[Math.min(this.reconnectAttempts,this.resubscribeBackoff.length-1)];this.reconnectAttempts++,this.reconnectTimeoutHandle=setTimeout(async()=>{try{await this.connect()}catch{}},t)}handleHardClose(t){var n;this.pingIntervalHandle&&(clearInterval(this.pingIntervalHandle),this.pingIntervalHandle=void 0),this._connected=!1,this.connectionPromise=void 0;const r=this.closedIntentionally;this.closedIntentionally=!1,(n=this.onclose)==null||n.call(this),this.enableReconnect&&!r?this.reconnect():this.closeAllSubscriptions(t)}async connect(){return this.connectionPromise?this.connectionPromise:(this.challenge=void 0,this.authPromise=void 0,this.connectionPromise=new Promise((t,r)=>{this.connectionTimeoutHandle=setTimeout(()=>{var n;r("connection timed out"),this.connectionPromise=void 0,(n=this.onclose)==null||n.call(this),this.closeAllSubscriptions("relay connection timed out")},this.connectionTimeout);try{this.ws=new this._WebSocket(this.url)}catch(n){clearTimeout(this.connectionTimeoutHandle),r(n);return}this.ws.onopen=()=>{this.reconnectTimeoutHandle&&(clearTimeout(this.reconnectTimeoutHandle),this.reconnectTimeoutHandle=void 0),clearTimeout(this.connectionTimeoutHandle),this._connected=!0;const n=this.reconnectAttempts>0;this.reconnectAttempts=0;for(const s of this.openSubs.values()){if(s.eosed=!1,n)for(let i=0;i<s.filters.length;i++)s.lastEmitted&&(s.filters[i].since=s.lastEmitted+1);s.fire()}this.enablePing&&(this.pingIntervalHandle=setInterval(()=>this.pingpong(),this.pingFrequency)),t()},this.ws.onerror=n=>{clearTimeout(this.connectionTimeoutHandle),r(n.message||"websocket error"),this.handleHardClose("relay connection errored")},this.ws.onclose=n=>{clearTimeout(this.connectionTimeoutHandle),r(n.message||"websocket closed"),this.handleHardClose("relay connection closed")},this.ws.onmessage=this._onmessage.bind(this)}),this.connectionPromise)}waitForPingPong(){return new Promise(t=>{this.ws.once("pong",()=>t(!0)),this.ws.ping()})}waitForDummyReq(){return new Promise((t,r)=>{if(!this.connectionPromise)return r(new Error(`no connection to ${this.url}, can't ping`));try{const n=this.subscribe([{ids:["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"],limit:0}],{label:"forced-ping",oneose:()=>{t(!0),n.close()},onclose(){t(!0)},eoseTimeout:this.pingTimeout+1e3})}catch(n){r(n)}})}async pingpong(){var t,r,n;((t=this.ws)==null?void 0:t.readyState)===1&&(await Promise.any([this.ws&&this.ws.ping&&this.ws.once?this.waitForPingPong():this.waitForDummyReq(),new Promise(i=>setTimeout(()=>i(!1),this.pingTimeout))])||((r=this.ws)==null?void 0:r.readyState)===this._WebSocket.OPEN&&((n=this.ws)==null||n.close()))}async runQueue(){for(this.queueRunning=!0;this.handleNext()!==!1;)await gD();this.queueRunning=!1}handleNext(){var n,s,i;const t=this.incomingMessageQueue.dequeue();if(!t)return!1;const r=l7(t);if(r){const u=this.openSubs.get(r);if(!u)return;const d=vd(t,"id"),c=(n=u.alreadyHaveEvent)==null?void 0:n.call(u,d);if((s=u.receivedEvent)==null||s.call(u,this,d),c)return}try{let u=JSON.parse(t);switch(u[0]){case"EVENT":{const d=this.openSubs.get(u[1]),c=u[2];this.verifyEvent(c)&&uD(d.filters,c)&&d.onevent(c),(!d.lastEmitted||d.lastEmitted<c.created_at)&&(d.lastEmitted=c.created_at);return}case"COUNT":{const d=u[1],c=u[2],b=this.openCountRequests.get(d);b&&(b.resolve(c.count),this.openCountRequests.delete(d));return}case"EOSE":{const d=this.openSubs.get(u[1]);if(!d)return;d.receivedEose();return}case"OK":{const d=u[1],c=u[2],b=u[3],w=this.openEventPublishes.get(d);w&&(clearTimeout(w.timeout),c?w.resolve(b):w.reject(new Error(b)),this.openEventPublishes.delete(d));return}case"CLOSED":{const d=u[1],c=this.openSubs.get(d);if(!c)return;c.closed=!0,c.close(u[2]);return}case"NOTICE":{this.onnotice(u[1]);return}case"AUTH":{this.challenge=u[1],this.onauth&&this.auth(this.onauth);return}default:{const d=this.openSubs.get(u[1]);(i=d==null?void 0:d.oncustom)==null||i.call(d,u);return}}}catch{return}}async send(t){if(!this.connectionPromise)throw new h7(t,this.url);this.connectionPromise.then(()=>{var r;(r=this.ws)==null||r.send(t)})}async auth(t){const r=this.challenge;if(!r)throw new Error("can't perform auth, no challenge was received");return this.authPromise?this.authPromise:(this.authPromise=new Promise(async(n,s)=>{try{let i=await t(u7(this.url,r)),u=setTimeout(()=>{let d=this.openEventPublishes.get(i.id);d&&(d.reject(new Error("auth timed out")),this.openEventPublishes.delete(i.id))},this.publishTimeout);this.openEventPublishes.set(i.id,{resolve:n,reject:s,timeout:u}),this.send('["AUTH",'+JSON.stringify(i)+"]")}catch(i){console.warn("subscribe auth function failed:",i)}}),this.authPromise)}async publish(t){const r=new Promise((n,s)=>{const i=setTimeout(()=>{const u=this.openEventPublishes.get(t.id);u&&(u.reject(new Error("publish timed out")),this.openEventPublishes.delete(t.id))},this.publishTimeout);this.openEventPublishes.set(t.id,{resolve:n,reject:s,timeout:i})});return this.send('["EVENT",'+JSON.stringify(t)+"]"),r}async count(t,r){this.serial++;const n=(r==null?void 0:r.id)||"count:"+this.serial,s=new Promise((i,u)=>{this.openCountRequests.set(n,{resolve:i,reject:u})});return this.send('["COUNT","'+n+'",'+JSON.stringify(t).substring(1)),s}subscribe(t,r){const n=this.prepareSubscription(t,r);return n.fire(),n}prepareSubscription(t,r){this.serial++;const n=r.id||(r.label?r.label+":":"sub:")+this.serial,s=new mD(this,n,t,r);return this.openSubs.set(n,s),s}close(){var t,r,n;this.closedIntentionally=!0,this.reconnectTimeoutHandle&&(clearTimeout(this.reconnectTimeoutHandle),this.reconnectTimeoutHandle=void 0),this.pingIntervalHandle&&(clearInterval(this.pingIntervalHandle),this.pingIntervalHandle=void 0),this.closeAllSubscriptions("relay connection closed by us"),this._connected=!1,(t=this.onclose)==null||t.call(this),((r=this.ws)==null?void 0:r.readyState)===this._WebSocket.OPEN&&((n=this.ws)==null||n.close())}_onmessage(t){this.incomingMessageQueue.enqueue(t.data),this.queueRunning||this.runQueue()}},mD=class{constructor(t,r,n,s){ie(this,"relay");ie(this,"id");ie(this,"lastEmitted");ie(this,"closed",!1);ie(this,"eosed",!1);ie(this,"filters");ie(this,"alreadyHaveEvent");ie(this,"receivedEvent");ie(this,"onevent");ie(this,"oneose");ie(this,"onclose");ie(this,"oncustom");ie(this,"eoseTimeout");ie(this,"eoseTimeoutHandle");if(n.length===0)throw new Error("subscription can't be created with zero filters");this.relay=t,this.filters=n,this.id=r,this.alreadyHaveEvent=s.alreadyHaveEvent,this.receivedEvent=s.receivedEvent,this.eoseTimeout=s.eoseTimeout||t.baseEoseTimeout,this.oneose=s.oneose,this.onclose=s.onclose,this.onevent=s.onevent||(i=>{console.warn(`onevent() callback not defined for subscription '${this.id}' in relay ${this.relay.url}. event received:`,i)})}fire(){this.relay.send('["REQ","'+this.id+'",'+JSON.stringify(this.filters).substring(1)),this.eoseTimeoutHandle=setTimeout(this.receivedEose.bind(this),this.eoseTimeout)}receivedEose(){var t;this.eosed||(clearTimeout(this.eoseTimeoutHandle),this.eosed=!0,(t=this.oneose)==null||t.call(this))}close(t="closed by caller"){var r;if(!this.closed&&this.relay.connected){try{this.relay.send('["CLOSE",'+JSON.stringify(this.id)+"]")}catch(n){if(!(n instanceof h7))throw n}this.closed=!0}this.relay.openSubs.delete(this.id),(r=this.onclose)==null||r.call(this,t)}},wD;try{wD=WebSocket}catch{}var bD=class{constructor(t){ie(this,"relays",new Map);ie(this,"seenOn",new Map);ie(this,"trackRelays",!1);ie(this,"verifyEvent");ie(this,"enablePing");ie(this,"enableReconnect");ie(this,"automaticallyAuth");ie(this,"trustedRelayURLs",new Set);ie(this,"_WebSocket");this.verifyEvent=t.verifyEvent,this._WebSocket=t.websocketImplementation,this.enablePing=t.enablePing,this.enableReconnect=t.enableReconnect||!1,this.automaticallyAuth=t.automaticallyAuth}async ensureRelay(t,r){t=na(t);let n=this.relays.get(t);if(n||(n=new c7(t,{verifyEvent:this.trustedRelayURLs.has(t)?yD:this.verifyEvent,websocketImplementation:this._WebSocket,enablePing:this.enablePing,enableReconnect:this.enableReconnect}),n.onclose=()=>{n&&!n.enableReconnect&&this.relays.delete(t)},r!=null&&r.connectionTimeout&&(n.connectionTimeout=r.connectionTimeout),this.relays.set(t,n)),this.automaticallyAuth){const s=this.automaticallyAuth(t);s&&(n.onauth=s)}return await n.connect(),n}close(t){t.map(na).forEach(r=>{var n;(n=this.relays.get(r))==null||n.close(),this.relays.delete(r)})}subscribe(t,r,n){const s=[];for(let i=0;i<t.length;i++){const u=na(t[i]);s.find(d=>d.url===u)||s.push({url:u,filter:r})}return this.subscribeMap(s,n)}subscribeMany(t,r,n){const s=[],i=[];for(let u=0;u<t.length;u++){const d=na(t[u]);i.indexOf(d)===-1&&(i.push(d),s.push({url:d,filter:r}))}return this.subscribeMap(s,n)}subscribeMap(t,r){const n=new Map;for(const A of t){const{url:R,filter:B}=A;n.has(R)||n.set(R,[]),n.get(R).push(B)}const s=Array.from(n.entries()).map(([A,R])=>({url:A,filters:R}));this.trackRelays&&(r.receivedEvent=(A,R)=>{let B=this.seenOn.get(R);B||(B=new Set,this.seenOn.set(R,B)),B.add(A)});const i=new Set,u=[],d=[];let c=A=>{var R;d[A]||(d[A]=!0,d.filter(B=>B).length===s.length&&((R=r.oneose)==null||R.call(r),c=()=>{}))};const b=[];let w=(A,R)=>{var B;b[A]||(c(A),b[A]=R,b.filter(I=>I).length===s.length&&((B=r.onclose)==null||B.call(r,b),w=()=>{}))};const M=A=>{var B;if((B=r.alreadyHaveEvent)!=null&&B.call(r,A))return!0;const R=i.has(A);return i.add(A),R},_=Promise.all(s.map(async({url:A,filters:R},B)=>{let I;try{I=await this.ensureRelay(A,{connectionTimeout:r.maxWait?Math.max(r.maxWait*.8,r.maxWait-1e3):void 0})}catch(k){w(B,(k==null?void 0:k.message)||String(k));return}let E=I.subscribe(R,{...r,oneose:()=>c(B),onclose:k=>{k.startsWith("auth-required: ")&&r.onauth?I.auth(r.onauth).then(()=>{I.subscribe(R,{...r,oneose:()=>c(B),onclose:T=>{w(B,T)},alreadyHaveEvent:M,eoseTimeout:r.maxWait})}).catch(T=>{w(B,`auth was required and attempted, but failed with: ${T}`)}):w(B,k)},alreadyHaveEvent:M,eoseTimeout:r.maxWait});u.push(E)}));return{async close(A){await _,u.forEach(R=>{R.close(A)})}}}subscribeEose(t,r,n){const s=this.subscribe(t,r,{...n,oneose(){s.close("closed automatically on eose")}});return s}subscribeManyEose(t,r,n){const s=this.subscribeMany(t,r,{...n,oneose(){s.close("closed automatically on eose")}});return s}async querySync(t,r,n){return new Promise(async s=>{const i=[];this.subscribeEose(t,r,{...n,onevent(u){i.push(u)},onclose(u){s(i)}})})}async get(t,r,n){r.limit=1;const s=await this.querySync(t,r,n);return s.sort((i,u)=>u.created_at-i.created_at),s[0]||null}publish(t,r,n){return t.map(na).map(async(s,i,u)=>{if(u.indexOf(s)!==i)return Promise.reject("duplicate url");let d=await this.ensureRelay(s);return d.publish(r).catch(async c=>{if(c instanceof Error&&c.message.startsWith("auth-required: ")&&(n!=null&&n.onauth))return await d.auth(n.onauth),d.publish(r);throw c}).then(c=>{if(this.trackRelays){let b=this.seenOn.get(r.id);b||(b=new Set,this.seenOn.set(r.id,b)),b.add(d)}return c})})}listConnectionStatus(){const t=new Map;return this.relays.forEach((r,n)=>t.set(n,r.connected)),t}destroy(){this.relays.forEach(t=>t.close()),this.relays=new Map}},d7;try{d7=WebSocket}catch{}var p7=class extends bD{constructor(t){super({verifyEvent:Zf,websocketImplementation:d7,...t})}},v7={};Lt(v7,{BECH32_REGEX:()=>g7,Bech32MaxSize:()=>z2,NostrTypeGuard:()=>xD,decode:()=>gd,decodeNostrURI:()=>_D,encodeBytes:()=>md,naddrEncode:()=>RD,neventEncode:()=>BD,noteEncode:()=>AD,nprofileEncode:()=>kD,npubEncode:()=>SD,nsecEncode:()=>ED});var xD={isNProfile:e=>/^nprofile1[a-z\d]+$/.test(e||""),isNEvent:e=>/^nevent1[a-z\d]+$/.test(e||""),isNAddr:e=>/^naddr1[a-z\d]+$/.test(e||""),isNSec:e=>/^nsec1[a-z\d]{58}$/.test(e||""),isNPub:e=>/^npub1[a-z\d]{58}$/.test(e||""),isNote:e=>/^note1[a-z\d]+$/.test(e||""),isNcryptsec:e=>/^ncryptsec1[a-z\d]+$/.test(e||"")},z2=5e3,g7=/[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;function MD(e){const t=new Uint8Array(4);return t[0]=e>>24&255,t[1]=e>>16&255,t[2]=e>>8&255,t[3]=e&255,t}function _D(e){try{return e.startsWith("nostr:")&&(e=e.substring(6)),gd(e)}catch{return{type:"invalid",data:null}}}function gd(e){var s,i,u,d,c,b,w;let{prefix:t,words:r}=Kf.decode(e,z2),n=new Uint8Array(Kf.fromWords(r));switch(t){case"nprofile":{let M=u1(n);if(!((s=M[0])!=null&&s[0]))throw new Error("missing TLV 0 for nprofile");if(M[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:Lr(M[0][0]),relays:M[1]?M[1].map(_=>oo.decode(_)):[]}}}case"nevent":{let M=u1(n);if(!((i=M[0])!=null&&i[0]))throw new Error("missing TLV 0 for nevent");if(M[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");if(M[2]&&M[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(M[3]&&M[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:Lr(M[0][0]),relays:M[1]?M[1].map(_=>oo.decode(_)):[],author:(u=M[2])!=null&&u[0]?Lr(M[2][0]):void 0,kind:(d=M[3])!=null&&d[0]?parseInt(Lr(M[3][0]),16):void 0}}}case"naddr":{let M=u1(n);if(!((c=M[0])!=null&&c[0]))throw new Error("missing TLV 0 for naddr");if(!((b=M[2])!=null&&b[0]))throw new Error("missing TLV 2 for naddr");if(M[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(!((w=M[3])!=null&&w[0]))throw new Error("missing TLV 3 for naddr");if(M[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:oo.decode(M[0][0]),pubkey:Lr(M[2][0]),kind:parseInt(Lr(M[3][0]),16),relays:M[1]?M[1].map(_=>oo.decode(_)):[]}}}case"nsec":return{type:t,data:n};case"npub":case"note":return{type:t,data:Lr(n)};default:throw new Error(`unknown prefix ${t}`)}}function u1(e){let t={},r=e;for(;r.length>0;){let n=r[0],s=r[1],i=r.slice(2,2+s);if(r=r.slice(2+s),i.length<s)throw new Error(`not enough data to read on TLV ${n}`);t[n]=t[n]||[],t[n].push(i)}return t}function ED(e){return md("nsec",e)}function SD(e){return md("npub",$a(e))}function AD(e){return md("note",$a(e))}function yd(e,t){let r=Kf.toWords(t);return Kf.encode(e,r,z2)}function md(e,t){return yd(e,t)}function kD(e){let t=W2({0:[$a(e.pubkey)],1:(e.relays||[]).map(r=>Yn.encode(r))});return yd("nprofile",t)}function BD(e){let t;e.kind!==void 0&&(t=MD(e.kind));let r=W2({0:[$a(e.id)],1:(e.relays||[]).map(n=>Yn.encode(n)),2:e.author?[$a(e.author)]:[],3:t?[new Uint8Array(t)]:[]});return yd("nevent",r)}function RD(e){let t=new ArrayBuffer(4);new DataView(t).setUint32(0,e.kind,!1);let r=W2({0:[Yn.encode(e.identifier)],1:(e.relays||[]).map(n=>Yn.encode(n)),2:[$a(e.pubkey)],3:[new Uint8Array(t)]});return yd("naddr",r)}function W2(e){let t=[];return Object.entries(e).reverse().forEach(([r,n])=>{n.forEach(s=>{let i=new Uint8Array(s.length+2);i.set([parseInt(r)],0),i.set([s.length],1),i.set(s,2),t.push(i)})}),hd(...t)}var $D={};Lt($D,{decrypt:()=>ND,encrypt:()=>y7});function y7(e,t,r){const n=e instanceof Uint8Array?Lr(e):e,s=vl.getSharedSecret(n,"02"+t),i=m7(s);let u=Uint8Array.from(RE(16)),d=Yn.encode(r),c=DE(i,u).encrypt(d),b=mo.encode(new Uint8Array(c)),w=mo.encode(new Uint8Array(u.buffer));return`${b}?iv=${w}`}function ND(e,t,r){const n=e instanceof Uint8Array?Lr(e):e;let[s,i]=r.split("?iv="),u=vl.getSharedSecret(n,"02"+t),d=m7(u),c=mo.decode(i),b=mo.decode(s),w=DE(d,c).decrypt(b);return oo.decode(w)}function m7(e){return e.slice(1,33)}var TD={};Lt(TD,{NIP05_REGEX:()=>V2,isNip05:()=>ID,isValid:()=>LD,queryProfile:()=>w7,searchDomain:()=>PD,useFetchImplementation:()=>CD});var V2=/^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,ID=e=>V2.test(e||""),wd;try{wd=fetch}catch{}function CD(e){wd=e}async function PD(e,t=""){try{const r=`https://${e}/.well-known/nostr.json?name=${t}`,n=await wd(r,{redirect:"manual"});if(n.status!==200)throw Error("Wrong response code");return(await n.json()).names}catch{return{}}}async function w7(e){var s;const t=e.match(V2);if(!t)return null;const[,r="_",n]=t;try{const i=`https://${n}/.well-known/nostr.json?name=${r}`,u=await wd(i,{redirect:"manual"});if(u.status!==200)throw Error("Wrong response code");const d=await u.json(),c=d.names[r];return c?{pubkey:c,relays:(s=d.relays)==null?void 0:s[c]}:null}catch{return null}}async function LD(e,t){const r=await w7(t);return r?r.pubkey===e:!1}var OD={};Lt(OD,{parse:()=>UD});function UD(e){const t={reply:void 0,root:void 0,mentions:[],profiles:[],quotes:[]};let r,n;for(let s=e.tags.length-1;s>=0;s--){const i=e.tags[s];if(i[0]==="e"&&i[1]){const[u,d,c,b,w]=i,M={id:d,relays:c?[c]:[],author:w};if(b==="root"){t.root=M;continue}if(b==="reply"){t.reply=M;continue}if(b==="mention"){t.mentions.push(M);continue}r?n=M:r=M,t.mentions.push(M);continue}if(i[0]==="q"&&i[1]){const[u,d,c]=i;t.quotes.push({id:d,relays:c?[c]:[]})}if(i[0]==="p"&&i[1]){t.profiles.push({pubkey:i[1],relays:i[2]?[i[2]]:[]});continue}}return t.root||(t.root=n||r||t.reply),t.reply||(t.reply=r||t.root),[t.reply,t.root].forEach(s=>{if(!s)return;let i=t.mentions.indexOf(s);if(i!==-1&&t.mentions.splice(i,1),s.author){let u=t.profiles.find(d=>d.pubkey===s.author);u&&u.relays&&(s.relays||(s.relays=[]),u.relays.forEach(d=>{var c;((c=s.relays)==null?void 0:c.indexOf(d))===-1&&s.relays.push(d)}),u.relays=s.relays)}}),t.mentions.forEach(s=>{if(s.author){let i=t.profiles.find(u=>u.pubkey===s.author);i&&i.relays&&(s.relays||(s.relays=[]),i.relays.forEach(u=>{s.relays.indexOf(u)===-1&&s.relays.push(u)}),i.relays=s.relays)}}),t}var jD={};Lt(jD,{fetchRelayInformation:()=>qD,useFetchImplementation:()=>DD});var b7;try{b7=fetch}catch{}function DD(e){b7=e}async function qD(e){return await(await fetch(e.replace("ws://","http://").replace("wss://","https://"),{headers:{Accept:"application/nostr+json"}})).json()}var FD={};Lt(FD,{fastEventHash:()=>M7,getPow:()=>x7,minePow:()=>HD});function x7(e){let t=0;for(let r=0;r<64;r+=8){const n=parseInt(e.substring(r,r+8),16);if(n===0)t+=32;else{t+=Math.clz32(n);break}}return t}function HD(e,t){let r=0;const n=e,s=["nonce",r.toString(),t.toString()];for(n.tags.push(s);;){const i=Math.floor(new Date().getTime()/1e3);if(i!==n.created_at&&(r=0,n.created_at=i),s[1]=(++r).toString(),n.id=M7(n),x7(n.id)>=t)break}return n}function M7(e){return Lr(qa(Yn.encode(JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content]))))}var zD={};Lt(zD,{unwrapEvent:()=>tq,unwrapManyEvents:()=>rq,wrapEvent:()=>P7,wrapManyEvents:()=>eq});var WD={};Lt(WD,{createRumor:()=>N7,createSeal:()=>T7,createWrap:()=>I7,unwrapEvent:()=>Y2,unwrapManyEvents:()=>C7,wrapEvent:()=>c0,wrapManyEvents:()=>XD});var an={};Lt(an,{decrypt:()=>J2,encrypt:()=>G2,getConversationKey:()=>K2,v2:()=>JD});var _7=1,E7=65535;function K2(e,t){const r=vl.getSharedSecret(e,"02"+t).subarray(1,33);return BU(qa,r,"nip44-v2")}function S7(e,t){const r=RU(qa,e,t,76);return{chacha_key:r.subarray(0,32),chacha_nonce:r.subarray(32,44),hmac_key:r.subarray(44,76)}}function Z2(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("expected positive integer");if(e<=32)return 32;const t=1<<Math.floor(Math.log2(e-1))+1,r=t<=256?32:t/8;return r*(Math.floor((e-1)/r)+1)}function VD(e){if(!Number.isSafeInteger(e)||e<_7||e>E7)throw new Error("invalid plaintext size: must be between 1 and 65535 bytes");const t=new Uint8Array(2);return new DataView(t.buffer).setUint16(0,e,!1),t}function KD(e){const t=Yn.encode(e),r=t.length,n=VD(r),s=new Uint8Array(Z2(r)-r);return hd(n,t,s)}function ZD(e){const t=new DataView(e.buffer).getUint16(0),r=e.subarray(2,2+t);if(t<_7||t>E7||r.length!==t||e.length!==2+Z2(t))throw new Error("invalid padding");return oo.decode(r)}function A7(e,t,r){if(r.length!==32)throw new Error("AAD associated data must be 32 bytes");const n=hd(r,t);return dd(qa,e,n)}function GD(e){if(typeof e!="string")throw new Error("payload must be a valid string");const t=e.length;if(t<132||t>87472)throw new Error("invalid payload length: "+t);if(e[0]==="#")throw new Error("unknown encryption version");let r;try{r=mo.decode(e)}catch(i){throw new Error("invalid base64: "+i.message)}const n=r.length;if(n<99||n>65603)throw new Error("invalid data length: "+n);const s=r[0];if(s!==2)throw new Error("unknown encryption version "+s);return{nonce:r.subarray(1,33),ciphertext:r.subarray(33,-32),mac:r.subarray(-32)}}function G2(e,t,r=RE(32)){const{chacha_key:n,chacha_nonce:s,hmac_key:i}=S7(t,r),u=KD(e),d=zE(n,s,u),c=A7(i,d,r);return mo.encode(hd(new Uint8Array([2]),r,d,c))}function J2(e,t){const{nonce:r,ciphertext:n,mac:s}=GD(e),{chacha_key:i,chacha_nonce:u,hmac_key:d}=S7(t,r),c=A7(d,n,r);if(!lU(c,s))throw new Error("invalid MAC");const b=zE(i,u,n);return ZD(b)}var JD={utils:{getConversationKey:K2,calcPaddedLen:Z2},encrypt:G2,decrypt:J2},YD=2*24*60*60,k7=()=>Math.round(Date.now()/1e3),B7=()=>Math.round(k7()-Math.random()*YD),R7=(e,t)=>K2(e,t),$7=(e,t,r)=>G2(JSON.stringify(e),R7(t,r)),m6=(e,t)=>JSON.parse(J2(e.content,R7(t,e.pubkey)));function N7(e,t){const r={created_at:k7(),content:"",tags:[],...e,pubkey:Na(t)};return r.id=gc(r),r}function T7(e,t,r){return Tn({kind:XE,content:$7(e,t,r),created_at:B7(),tags:[]},t)}function I7(e,t){const r=ZE();return Tn({kind:o7,content:$7(e,r,t),created_at:B7(),tags:[["p",t]]},r)}function c0(e,t,r){const n=N7(e,t),s=T7(n,t,r);return I7(s,r)}function XD(e,t,r){if(!r||r.length===0)throw new Error("At least one recipient is required.");const n=Na(t),s=[c0(e,t,n)];return r.forEach(i=>{s.push(c0(e,t,i))}),s}function Y2(e,t){const r=m6(e,t);return m6(r,t)}function C7(e,t){let r=[];return e.forEach(n=>{r.push(Y2(n,t))}),r.sort((n,s)=>n.created_at-s.created_at),r}function QD(e,t,r,n){const s={created_at:Math.ceil(Date.now()/1e3),kind:QE,tags:[],content:t};return(Array.isArray(e)?e:[e]).forEach(({publicKey:u,relayUrl:d})=>{s.tags.push(d?["p",u,d]:["p",u])}),n&&s.tags.push(["e",n.eventId,n.relayUrl||"","reply"]),r&&s.tags.push(["subject",r]),s}function P7(e,t,r,n,s){const i=QD(t,r,n,s);return c0(i,e,t.publicKey)}function eq(e,t,r,n,s){if(!t||t.length===0)throw new Error("At least one recipient is required.");return[{publicKey:Na(e)},...t].map(u=>P7(e,u,r,n,s))}var tq=Y2,rq=C7,nq={};Lt(nq,{finishRepostEvent:()=>iq,getRepostedEvent:()=>oq,getRepostedEventPointer:()=>L7});function iq(e,t,r,n){var u;let s;const i=[...e.tags??[],["e",t.id,r],["p",t.pubkey]];return t.kind===YE?s=D2:(s=F2,i.push(["k",String(t.kind)])),Tn({kind:s,tags:i,content:e.content===""||(u=t.tags)!=null&&u.find(d=>d[0]==="-")?"":JSON.stringify(t),created_at:e.created_at},n)}function L7(e){if(![D2,F2].includes(e.kind))return;let t,r;for(let n=e.tags.length-1;n>=0&&(t===void 0||r===void 0);n--){const s=e.tags[n];s.length>=2&&(s[0]==="e"&&t===void 0?t=s:s[0]==="p"&&r===void 0&&(r=s))}if(t!==void 0)return{id:t[1],relays:[t[2],r==null?void 0:r[2]].filter(n=>typeof n=="string"),author:r==null?void 0:r[1]}}function oq(e,{skipVerification:t}={}){const r=L7(e);if(r===void 0||e.content==="")return;let n;try{n=JSON.parse(e.content)}catch{return}if(n.id===r.id&&!(!t&&!Zf(n)))return n}var sq={};Lt(sq,{NOSTR_URI_REGEX:()=>X2,parse:()=>fq,test:()=>aq});var X2=new RegExp(`nostr:(${g7.source})`);function aq(e){return typeof e=="string"&&new RegExp(`^${X2.source}$`).test(e)}function fq(e){const t=e.match(new RegExp(`^${X2.source}$`));if(!t)throw new Error(`Invalid Nostr URI: ${e}`);return{uri:t[0],value:t[1],decoded:gd(t[1])}}var lq={};Lt(lq,{finishReactionEvent:()=>uq,getReactedEventPointer:()=>hq});function uq(e,t,r){const n=t.tags.filter(s=>s.length>=2&&(s[0]==="e"||s[0]==="p"));return Tn({...e,kind:q2,tags:[...e.tags??[],...n,["e",t.id],["p",t.pubkey]],content:e.content??"+"},r)}function hq(e){if(e.kind!==q2)return;let t,r;for(let n=e.tags.length-1;n>=0&&(t===void 0||r===void 0);n--){const s=e.tags[n];s.length>=2&&(s[0]==="e"&&t===void 0?t=s:s[0]==="p"&&r===void 0&&(r=s))}if(!(t===void 0||r===void 0))return{id:t[1],relays:[t[2],r[2]].filter(n=>n!==void 0),author:r[1]}}var cq={};Lt(cq,{parse:()=>pq});var w6=/\W/m,b6=/[^\w\/] |[^\w\/]$|$|,| /m,dq=42;function*pq(e){let t=[];if(typeof e!="string"){for(let i=0;i<e.tags.length;i++){const u=e.tags[i];u[0]==="emoji"&&u.length>=3&&t.push({type:"emoji",shortcode:u[1],url:u[2]})}e=e.content}const r=e.length;let n=0,s=0;e:for(;s<r;){const i=e.indexOf(":",s),u=e.indexOf("#",s);if(i===-1&&u===-1)break e;if(i===-1||u>=0&&u<i){if(u===0||e[u-1]===" "){const d=e.slice(u+1,u+dq).match(w6),c=d?u+1+d.index:r;yield{type:"text",text:e.slice(n,u)},yield{type:"hashtag",value:e.slice(u+1,c)},s=c,n=s;continue e}s=u+1;continue e}if(e.slice(i-5,i)==="nostr"){const d=e.slice(i+60).match(w6),c=d?i+60+d.index:r;try{let b,{data:w,type:M}=gd(e.slice(i+1,c));switch(M){case"npub":b={pubkey:w};break;case"note":b={id:w};break;case"nsec":s=c+1;continue;default:b=w}n!==i-5&&(yield{type:"text",text:e.slice(n,i-5)}),yield{type:"reference",pointer:b},s=c,n=s;continue e}catch{s=i+1;continue e}}else if(e.slice(i-5,i)==="https"||e.slice(i-4,i)==="http"){const d=e.slice(i+4).match(b6),c=d?i+4+d.index:r,b=e[i-1]==="s"?5:4;try{let w=new URL(e.slice(i-b,c));if(w.hostname.indexOf(".")===-1)throw new Error("invalid url");if(n!==i-b&&(yield{type:"text",text:e.slice(n,i-b)}),/\.(png|jpe?g|gif|webp|heic|svg)$/i.test(w.pathname)){yield{type:"image",url:w.toString()},s=c,n=s;continue e}if(/\.(mp4|avi|webm|mkv|mov)$/i.test(w.pathname)){yield{type:"video",url:w.toString()},s=c,n=s;continue e}if(/\.(mp3|aac|ogg|opus|wav|flac)$/i.test(w.pathname)){yield{type:"audio",url:w.toString()},s=c,n=s;continue e}yield{type:"url",url:w.toString()},s=c,n=s;continue e}catch{s=c+1;continue e}}else if(e.slice(i-3,i)==="wss"||e.slice(i-2,i)==="ws"){const d=e.slice(i+4).match(b6),c=d?i+4+d.index:r,b=e[i-1]==="s"?3:2;try{let w=new URL(e.slice(i-b,c));if(w.hostname.indexOf(".")===-1)throw new Error("invalid ws url");n!==i-b&&(yield{type:"text",text:e.slice(n,i-b)}),yield{type:"relay",url:w.toString()},s=c,n=s;continue e}catch{s=c+1;continue e}}else{for(let d=0;d<t.length;d++){const c=t[d];if(e[i+c.shortcode.length+1]===":"&&e.slice(i+1,i+c.shortcode.length+1)===c.shortcode){n!==i&&(yield{type:"text",text:e.slice(n,i)}),yield c,s=i+c.shortcode.length+2,n=s;continue e}}s=i+1;continue e}}n!==r&&(yield{type:"text",text:e.slice(n)})}var vq={};Lt(vq,{channelCreateEvent:()=>gq,channelHideMessageEvent:()=>wq,channelMessageEvent:()=>mq,channelMetadataEvent:()=>yq,channelMuteUserEvent:()=>bq});var gq=(e,t)=>{let r;if(typeof e.content=="object")r=JSON.stringify(e.content);else if(typeof e.content=="string")r=e.content;else return;return Tn({kind:e7,tags:[...e.tags??[]],content:r,created_at:e.created_at},t)},yq=(e,t)=>{let r;if(typeof e.content=="object")r=JSON.stringify(e.content);else if(typeof e.content=="string")r=e.content;else return;return Tn({kind:t7,tags:[["e",e.channel_create_event_id],...e.tags??[]],content:r,created_at:e.created_at},t)},mq=(e,t)=>{const r=[["e",e.channel_create_event_id,e.relay_url,"root"]];return e.reply_to_channel_message_event_id&&r.push(["e",e.reply_to_channel_message_event_id,e.relay_url,"reply"]),Tn({kind:r7,tags:[...r,...e.tags??[]],content:e.content,created_at:e.created_at},t)},wq=(e,t)=>{let r;if(typeof e.content=="object")r=JSON.stringify(e.content);else if(typeof e.content=="string")r=e.content;else return;return Tn({kind:n7,tags:[["e",e.channel_message_event_id],...e.tags??[]],content:r,created_at:e.created_at},t)},bq=(e,t)=>{let r;if(typeof e.content=="object")r=JSON.stringify(e.content);else if(typeof e.content=="string")r=e.content;else return;return Tn({kind:i7,tags:[["p",e.pubkey_to_mute],...e.tags??[]],content:r,created_at:e.created_at},t)},xq={};Lt(xq,{EMOJI_SHORTCODE_REGEX:()=>O7,matchAll:()=>Mq,regex:()=>Q2,replaceAll:()=>_q});var O7=/:(\w+):/,Q2=()=>new RegExp(`\\B${O7.source}\\B`,"g");function*Mq(e){const t=e.matchAll(Q2());for(const r of t)try{const[n,s]=r;yield{shortcode:n,name:s,start:r.index,end:r.index+n.length}}catch{}}function _q(e,t){return e.replaceAll(Q2(),(r,n)=>t({shortcode:r,name:n}))}var Eq={};Lt(Eq,{useFetchImplementation:()=>Sq,validateGithub:()=>Aq});var ew;try{ew=fetch}catch{}function Sq(e){ew=e}async function Aq(e,t,r){try{return await(await ew(`https://gist.github.com/${t}/${r}/raw`)).text()===`Verifying that I control the following Nostr public key: ${e}`}catch{return!1}}var kq={};Lt(kq,{makeNwcRequestEvent:()=>Rq,parseConnectionString:()=>Bq});function Bq(e){const{host:t,pathname:r,searchParams:n}=new URL(e),s=r||t,i=n.get("relay"),u=n.get("secret");if(!s||!i||!u)throw new Error("invalid connection string");return{pubkey:s,relay:i,secret:u}}async function Rq(e,t,r){const s=y7(t,e,JSON.stringify({method:"pay_invoice",params:{invoice:r}})),i={kind:a7,created_at:Math.round(Date.now()/1e3),content:s,tags:[["p",e]]};return Tn(i,t)}var $q={};Lt($q,{normalizeIdentifier:()=>Nq});function Nq(e){return e=e.trim().toLowerCase(),e=e.normalize("NFKC"),Array.from(e).map(t=>new RegExp("\\p{Letter}","u").test(t)||new RegExp("\\p{Number}","u").test(t)?t:"-").join("")}var Tq={};Lt(Tq,{getSatoshisAmountFromBolt11:()=>Uq,getZapEndpoint:()=>Cq,makeZapReceipt:()=>Oq,makeZapRequest:()=>Pq,useFetchImplementation:()=>Iq,validateZapRequest:()=>Lq});var tw;try{tw=fetch}catch{}function Iq(e){tw=e}async function Cq(e){try{let t="",{lud06:r,lud16:n}=JSON.parse(e.content);if(n){let[u,d]=n.split("@");t=new URL(`/.well-known/lnurlp/${u}`,`https://${d}`).toString()}else if(r){let{words:u}=Kf.decode(r,1e3),d=Kf.fromWords(u);t=oo.decode(d)}else return null;let i=await(await tw(t)).json();if(i.allowsNostr&&i.nostrPubkey)return i.callback}catch{}return null}function Pq(e){let t={kind:9734,created_at:Math.round(Date.now()/1e3),content:e.comment||"",tags:[["p","pubkey"in e?e.pubkey:e.event.pubkey],["amount",e.amount.toString()],["relays",...e.relays]]};if("event"in e){if(t.tags.push(["e",e.event.id]),U2(e.event.kind)){const r=["a",`${e.event.kind}:${e.event.pubkey}:`];t.tags.push(r)}else if(j2(e.event.kind)){let r=e.event.tags.find(([s,i])=>s==="d"&&i);if(!r)throw new Error("d tag not found or is empty");const n=["a",`${e.event.kind}:${e.event.pubkey}:${r[1]}`];t.tags.push(n)}t.tags.push(["k",e.event.kind.toString()])}return t}function Lq(e){let t;try{t=JSON.parse(e)}catch{return"Invalid zap request JSON."}if(!L2(t))return"Zap request is not a valid Nostr event.";if(!Zf(t))return"Invalid signature on zap request.";let r=t.tags.find(([i,u])=>i==="p"&&u);if(!r)return"Zap request doesn't have a 'p' tag.";if(!r[1].match(/^[a-f0-9]{64}$/))return"Zap request 'p' tag is not valid hex.";let n=t.tags.find(([i,u])=>i==="e"&&u);return n&&!n[1].match(/^[a-f0-9]{64}$/)?"Zap request 'e' tag is not valid hex.":t.tags.find(([i,u])=>i==="relays"&&u)?null:"Zap request doesn't have a 'relays' tag."}function Oq({zapRequest:e,preimage:t,bolt11:r,paidAt:n}){let s=JSON.parse(e),i=s.tags.filter(([d])=>d==="e"||d==="p"||d==="a"),u={kind:9735,created_at:Math.round(n.getTime()/1e3),content:"",tags:[...i,["P",s.pubkey],["bolt11",r],["description",e]]};return t&&u.tags.push(["preimage",t]),u}function Uq(e){if(e.length<50)return 0;e=e.substring(0,50);const t=e.lastIndexOf("1");if(t===-1)return 0;const r=e.substring(0,t);if(!r.startsWith("lnbc"))return 0;const n=r.substring(4);if(n.length<1)return 0;const s=n[n.length-1],i=s.charCodeAt(0)-48,u=i>=0&&i<=9;let d=n.length-1;if(u&&d++,d<1)return 0;const c=parseInt(n.substring(0,d));switch(s){case"m":return c*1e5;case"u":return c*100;case"n":return c/10;case"p":return c/1e4;default:return c*1e8}}var jq={};Lt(jq,{Negentropy:()=>j7,NegentropyStorageVector:()=>Fq,NegentropySync:()=>Hq});var h1=97,Bf=32,U7=16,Hs={Skip:0,Fingerprint:1,IdList:2},Qi=class{constructor(t){ie(this,"_raw");ie(this,"length");typeof t=="number"?(this._raw=new Uint8Array(t),this.length=0):t instanceof Uint8Array?(this._raw=new Uint8Array(t),this.length=t.length):(this._raw=new Uint8Array(512),this.length=0)}unwrap(){return this._raw.subarray(0,this.length)}get capacity(){return this._raw.byteLength}extend(t){if(t instanceof Qi&&(t=t.unwrap()),typeof t.length!="number")throw Error("bad length");const r=t.length+this.length;if(this.capacity<r){const n=this._raw,s=Math.max(this.capacity*2,r);this._raw=new Uint8Array(s),this._raw.set(n)}this._raw.set(t,this.length),this.length+=t.length}shift(){const t=this._raw[0];return this._raw=this._raw.subarray(1),this.length--,t}shiftN(t=1){const r=this._raw.subarray(0,t);return this._raw=this._raw.subarray(t),this.length-=t,r}};function Dh(e){let t=0;for(;;){if(e.length===0)throw Error("parse ends prematurely");let r=e.shift();if(t=t<<7|r&127,!(r&128))break}return t}function Wi(e){if(e===0)return new Qi(new Uint8Array([0]));let t=[];for(;e!==0;)t.push(e&127),e>>>=7;t.reverse();for(let r=0;r<t.length-1;r++)t[r]|=128;return new Qi(new Uint8Array(t))}function Dq(e){return yc(e,1)[0]}function yc(e,t){if(e.length<t)throw Error("parse ends prematurely");return e.shiftN(t)}var qq=class{constructor(){ie(this,"buf");this.setToZero()}setToZero(){this.buf=new Uint8Array(Bf)}add(t){let r=0,n=0,s=new DataView(this.buf.buffer),i=new DataView(t.buffer);for(let u=0;u<8;u++){let d=u*4,c=s.getUint32(d,!0),b=i.getUint32(d,!0),w=c;w+=r,w+=b,w>4294967295&&(n=1),s.setUint32(d,w&4294967295,!0),r=n,n=0}}negate(){let t=new DataView(this.buf.buffer);for(let n=0;n<8;n++){let s=n*4;t.setUint32(s,~t.getUint32(s,!0))}let r=new Uint8Array(Bf);r[0]=1,this.add(r)}getFingerprint(t){let r=new Qi;return r.extend(this.buf),r.extend(Wi(t)),qa(r.unwrap()).subarray(0,U7)}},Fq=class{constructor(){ie(this,"items");ie(this,"sealed");this.items=[],this.sealed=!1}insert(t,r){if(this.sealed)throw Error("already sealed");const n=PE(r);if(n.byteLength!==Bf)throw Error("bad id size for added item");this.items.push({timestamp:t,id:n})}seal(){if(this.sealed)throw Error("already sealed");this.sealed=!0,this.items.sort(c1);for(let t=1;t<this.items.length;t++)if(c1(this.items[t-1],this.items[t])===0)throw Error("duplicate item inserted")}unseal(){this.sealed=!1}size(){return this._checkSealed(),this.items.length}getItem(t){if(this._checkSealed(),t>=this.items.length)throw Error("out of range");return this.items[t]}iterate(t,r,n){this._checkSealed(),this._checkBounds(t,r);for(let s=t;s<r&&n(this.items[s],s);++s);}findLowerBound(t,r,n){return this._checkSealed(),this._checkBounds(t,r),this._binarySearch(this.items,t,r,s=>c1(s,n)<0)}fingerprint(t,r){let n=new qq;return n.setToZero(),this.iterate(t,r,s=>(n.add(s.id),!0)),n.getFingerprint(r-t)}_checkSealed(){if(!this.sealed)throw Error("not sealed")}_checkBounds(t,r){if(t>r||r>this.items.length)throw Error("bad range")}_binarySearch(t,r,n,s){let i=n-r;for(;i>0;){let u=r,d=Math.floor(i/2);u+=d,s(t[u])?(r=++u,i-=d+1):i=d}return r}},j7=class{constructor(t,r=6e4){ie(this,"storage");ie(this,"frameSizeLimit");ie(this,"lastTimestampIn");ie(this,"lastTimestampOut");if(r<4096)throw Error("frameSizeLimit too small");this.storage=t,this.frameSizeLimit=r,this.lastTimestampIn=0,this.lastTimestampOut=0}_bound(t,r){return{timestamp:t,id:r||new Uint8Array(0)}}initiate(){let t=new Qi;return t.extend(new Uint8Array([h1])),this.splitRange(0,this.storage.size(),this._bound(Number.MAX_VALUE),t),Za(t.unwrap())}reconcile(t,r,n){const s=new Qi(PE(t));this.lastTimestampIn=this.lastTimestampOut=0;let i=new Qi;i.extend(new Uint8Array([h1]));let u=Dq(s);if(u<96||u>111)throw Error("invalid negentropy protocol version byte");if(u!==h1)throw Error("unsupported negentropy protocol version requested: "+(u-96));let d=this.storage.size(),c=this._bound(0),b=0,w=!1;for(;s.length!==0;){let M=new Qi,_=()=>{w&&(w=!1,M.extend(this.encodeBound(c)),M.extend(Wi(Hs.Skip)))},A=this.decodeBound(s),R=Dh(s),B=b,I=this.storage.findLowerBound(b,d,A);if(R===Hs.Skip)w=!0;else if(R===Hs.Fingerprint){let E=yc(s,U7),k=this.storage.fingerprint(B,I);D7(E,k)!==0?(_(),this.splitRange(B,I,A,M)):w=!0}else if(R===Hs.IdList){let E=Dh(s),k={};for(let T=0;T<E;T++){let L=yc(s,Bf);k[Za(L)]=L}if(w=!0,this.storage.iterate(B,I,T=>{let L=T.id;const q=Za(L);return k[q]?delete k[Za(L)]:r==null||r(q),!0}),n)for(let T of Object.values(k))n(Za(T))}else throw Error("unexpected mode");if(this.exceededFrameSizeLimit(i.length+M.length)){let E=this.storage.fingerprint(I,d);i.extend(this.encodeBound(this._bound(Number.MAX_VALUE))),i.extend(Wi(Hs.Fingerprint)),i.extend(E);break}else i.extend(M);b=I,c=A}return i.length===1?null:Za(i.unwrap())}splitRange(t,r,n,s){let i=r-t,u=16;if(i<u*2)s.extend(this.encodeBound(n)),s.extend(Wi(Hs.IdList)),s.extend(Wi(i)),this.storage.iterate(t,r,d=>(s.extend(d.id),!0));else{let d=Math.floor(i/u),c=i%u,b=t;for(let w=0;w<u;w++){let M=d+(w<c?1:0),_=this.storage.fingerprint(b,b+M);b+=M;let A;if(b===r)A=n;else{let R,B;this.storage.iterate(b-1,b+1,(I,E)=>(E===b-1?R=I:B=I,!0)),A=this.getMinimalBound(R,B)}s.extend(this.encodeBound(A)),s.extend(Wi(Hs.Fingerprint)),s.extend(_)}}}exceededFrameSizeLimit(t){return t>this.frameSizeLimit-200}decodeTimestampIn(t){let r=Dh(t);return r=r===0?Number.MAX_VALUE:r-1,this.lastTimestampIn===Number.MAX_VALUE||r===Number.MAX_VALUE?(this.lastTimestampIn=Number.MAX_VALUE,Number.MAX_VALUE):(r+=this.lastTimestampIn,this.lastTimestampIn=r,r)}decodeBound(t){let r=this.decodeTimestampIn(t),n=Dh(t);if(n>Bf)throw Error("bound key too long");let s=yc(t,n);return{timestamp:r,id:s}}encodeTimestampOut(t){if(t===Number.MAX_VALUE)return this.lastTimestampOut=Number.MAX_VALUE,Wi(0);let r=t;return t-=this.lastTimestampOut,this.lastTimestampOut=r,Wi(t+1)}encodeBound(t){let r=new Qi;return r.extend(this.encodeTimestampOut(t.timestamp)),r.extend(Wi(t.id.length)),r.extend(t.id),r}getMinimalBound(t,r){if(r.timestamp!==t.timestamp)return this._bound(r.timestamp);{let n=0,s=r.id,i=t.id;for(let u=0;u<Bf&&s[u]===i[u];u++)n++;return this._bound(r.timestamp,r.id.subarray(0,n+1))}}};function D7(e,t){for(let r=0;r<e.byteLength;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return e.byteLength>t.byteLength?1:e.byteLength<t.byteLength?-1:0}function c1(e,t){return e.timestamp===t.timestamp?D7(e.id,t.id):e.timestamp-t.timestamp}var Hq=class{constructor(t,r,n,s={}){ie(this,"relay");ie(this,"storage");ie(this,"neg");ie(this,"filter");ie(this,"subscription");ie(this,"onhave");ie(this,"onneed");this.relay=t,this.storage=r,this.neg=new j7(r),this.onhave=s.onhave,this.onneed=s.onneed,this.filter=n,this.subscription=this.relay.prepareSubscription([{}],{label:s.label||"negentropy"}),this.subscription.oncustom=i=>{var u,d,c,b;switch(i[0]){case"NEG-MSG":{i.length<3&&console.warn(`got invalid NEG-MSG from ${this.relay.url}: ${i}`);try{const w=this.neg.reconcile(i[2],this.onhave,this.onneed);w?this.relay.send(`["NEG-MSG", "${this.subscription.id}", "${w}"]`):(this.close(),(u=s.onclose)==null||u.call(s))}catch(w){console.error("negentropy reconcile error:",w),(d=s==null?void 0:s.onclose)==null||d.call(s,`reconcile error: ${w}`)}break}case"NEG-CLOSE":{const w=i[2];console.warn("negentropy error:",w),(c=s.onclose)==null||c.call(s,w);break}case"NEG-ERR":(b=s.onclose)==null||b.call(s)}}}async start(){const t=this.neg.initiate();this.relay.send(`["NEG-OPEN","${this.subscription.id}",${JSON.stringify(this.filter)},"${t}"]`)}close(){this.relay.send(`["NEG-CLOSE","${this.subscription.id}"]`),this.subscription.close()}},zq={};Lt(zq,{getToken:()=>Wq,hashPayload:()=>rw,unpackEventFromToken:()=>F7,validateEvent:()=>Z7,validateEventKind:()=>z7,validateEventMethodTag:()=>V7,validateEventPayloadTag:()=>K7,validateEventTimestamp:()=>H7,validateEventUrlTag:()=>W7,validateToken:()=>Vq});var q7="Nostr ";async function Wq(e,t,r,n=!1,s){const i={kind:H2,tags:[["u",e],["method",t]],created_at:Math.round(new Date().getTime()/1e3),content:""};s&&i.tags.push(["payload",rw(s)]);const u=await r(i);return(n?q7:"")+mo.encode(Yn.encode(JSON.stringify(u)))}async function Vq(e,t,r){const n=await F7(e).catch(i=>{throw i});return await Z7(n,t,r).catch(i=>{throw i})}async function F7(e){if(!e)throw new Error("Missing token");e=e.replace(q7,"");const t=oo.decode(mo.decode(e));if(!t||t.length===0||!t.startsWith("{"))throw new Error("Invalid token");return JSON.parse(t)}function H7(e){return e.created_at?Math.round(new Date().getTime()/1e3)-e.created_at<60:!1}function z7(e){return e.kind===H2}function W7(e,t){const r=e.tags.find(n=>n[0]==="u");return r?r.length>0&&r[1]===t:!1}function V7(e,t){const r=e.tags.find(n=>n[0]==="method");return r?r.length>0&&r[1].toLowerCase()===t.toLowerCase():!1}function rw(e){const t=qa(Yn.encode(JSON.stringify(e)));return Lr(t)}function K7(e,t){const r=e.tags.find(s=>s[0]==="payload");if(!r)return!1;const n=rw(t);return r.length>0&&r[1]===n}async function Z7(e,t,r,n){if(!Zf(e))throw new Error("Invalid nostr event, signature invalid");if(!z7(e))throw new Error("Invalid nostr event, kind invalid");if(!H7(e))throw new Error("Invalid nostr event, created_at timestamp invalid");if(!W7(e,t))throw new Error("Invalid nostr event, url tag invalid");if(!V7(e,r))throw new Error("Invalid nostr event, method tag invalid");if(n&&typeof n=="object"&&Object.keys(n).length>0&&!K7(e,n))throw new Error("Invalid nostr event, payload tag does not match request body hash");return!0}const x6="private";class th extends Error{constructor(t){super(t),this.name="NCC05Error"}}class G7 extends th{constructor(t){super(t),this.name="NCC05RelayError"}}class J7 extends th{constructor(t){super(t),this.name="NCC05TimeoutError"}}class M6 extends th{constructor(t){super(t),this.name="NCC05DecryptionError"}}class _6 extends th{constructor(t){super(t),this.name="NCC05ArgumentError"}}function sy(e){if(e instanceof Uint8Array)return e;if(typeof e=="string"){if(e.match(/^[0-9a-fA-F]+$/))return new Uint8Array(e.match(/.{1,2}/g).map(t=>parseInt(t,16)));throw new _6("Invalid hex key provided")}throw new _6("Key must be a hex string or Uint8Array")}class Kq{constructor(t={}){ie(this,"pool");ie(this,"_ownPool");ie(this,"bootstrapRelays");ie(this,"timeout");ie(this,"cache",new Map);this._ownPool=!t.pool,this.pool=t.pool||new p7,this.bootstrapRelays=t.bootstrapRelays||["wss://relay.damus.io","wss://npub1..."],this.timeout=t.timeout||1e4}async resolve(t,r,n="addr",s={}){let i=t;t.startsWith("npub1")&&(i=v7.decode(t).data);const u=Math.floor(Date.now()/1e3),d=`${i}:${n}`,c=this.cache.get(d);if(c){if(c.expires>u)return c.payload;this.cache.delete(d)}let b=[...this.bootstrapRelays];if(s.gossip)try{const _=await this.pool.get(this.bootstrapRelays,{authors:[i],kinds:[10002]});if(_&&Zf(_)&&_.pubkey===i){const A=_.tags.filter(R=>R[0]==="r").map(R=>R[1]);A.length>0&&(b=[...new Set([...b,...A])])}}catch(_){console.warn(`[NCC-05] Gossip discovery failed: ${_.message}`)}const w={authors:[i],kinds:[30058],"#d":[n],limit:10},M=r?sy(r):void 0;try{const _=this.pool.querySync(b,w),A=new Promise((F,X)=>setTimeout(()=>X(new J7("Resolution timed out")),this.timeout)),R=await Promise.race([_,A]);if(!R||Array.isArray(R)&&R.length===0)return null;const B=R.filter(F=>F.pubkey===i&&Zf(F)).sort((F,X)=>X.created_at!==F.created_at?X.created_at-F.created_at:F.id.localeCompare(X.id));if(B.length===0)return null;const I=B[0];let E=I.content;if(E.includes('"wraps"')&&E.includes('"ciphertext"')&&E.startsWith("{")&&M)try{const F=JSON.parse(E),X=Na(M),ee=F.wraps[X];if(ee){const x=an.getConversationKey(M,i),o=an.decrypt(ee,x),f=new Uint8Array(o.match(/.{1,2}/g).map(h=>parseInt(h,16))),l=an.getConversationKey(f,Na(f));E=an.decrypt(F.ciphertext,l)}else return null}catch{throw new M6("Failed to decrypt wrapped content")}else if(M&&!E.startsWith("{"))try{const F=an.getConversationKey(M,i);E=an.decrypt(I.content,F)}catch{throw new M6("Failed to decrypt content")}let T;try{T=JSON.parse(E)}catch{return null}if(!T||!T.endpoints||!Array.isArray(T.endpoints))return null;const L=I.tags.find(F=>F[0]==="expiration"),q=L?parseInt(L[1],10):1/0,z=T.updated_at+T.ttl,J=Math.min(q,z);if(u>J){if(s.strict)return null;console.warn("NCC-05 record expired")}else this.cache.set(d,{payload:T,expires:J});return T}catch(_){throw _ instanceof th?_:new G7(`Relay query failed: ${_.message}`)}}close(){this._ownPool&&this.pool.close(this.bootstrapRelays)}}class Zq{constructor(t={}){ie(this,"pool");ie(this,"_ownPool");ie(this,"timeout");this._ownPool=!t.pool,this.pool=t.pool||new p7,this.timeout=t.timeout||5e3}async _publishToRelays(t,r){const s=this.pool.publish(t,r).map(d=>new Promise((c,b)=>{const w=setTimeout(()=>b(new J7("Publish timed out")),this.timeout);d.then(()=>{clearTimeout(w),c()}).catch(M=>{clearTimeout(w),b(M)})})),i=await Promise.allSettled(s);if(i.filter(d=>d.status==="fulfilled").length===0){const d=i.filter(c=>c.status==="rejected").map(c=>c.reason.message).join(", ");throw new G7(`Failed to publish to any relay. Errors: ${d}`)}}async publishWrapped(t,r,n,s,i="addr"){let u="addr",d=!1;typeof i=="string"?u=i:(u=i.identifier||"addr",d=!!i.privateLocator);const c=sy(r),b=ZE(),w=Array.from(b).map(k=>k.toString(16).padStart(2,"0")).join(""),M=an.getConversationKey(b,Na(b)),_=an.encrypt(JSON.stringify(s),M),A={};for(const k of n){const T=an.getConversationKey(c,k);A[k]=an.encrypt(w,T)}const R={ciphertext:_,wraps:A},B=[["d",u]];d&&B.push([x6,"true"]);const I={kind:30058,created_at:Math.floor(Date.now()/1e3),tags:B,content:JSON.stringify(R)},E=Tn(I,c);return await this._publishToRelays(t,E),E}async publish(t,r,n,s={}){const i=sy(r),u=Na(i),d=s.identifier||"addr";let c=JSON.stringify(n);if(!s.public){const _=s.recipientPubkey||u,A=an.getConversationKey(i,_);c=an.encrypt(c,A)}const b=[["d",d]];s.privateLocator&&b.push([x6,"true"]);const w={kind:30058,created_at:Math.floor(Date.now()/1e3),pubkey:u,tags:b,content:c},M=Tn(w,i);return await this._publishToRelays(t,M),M}close(t){this._ownPool&&this.pool.close(t)}}var et={};function Gq(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Y7={exports:{}},Qt=Y7.exports={},di,pi;function ay(){throw new Error("setTimeout has not been defined")}function fy(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?di=setTimeout:di=ay}catch{di=ay}try{typeof clearTimeout=="function"?pi=clearTimeout:pi=fy}catch{pi=fy}})();function X7(e){if(di===setTimeout)return setTimeout(e,0);if((di===ay||!di)&&setTimeout)return di=setTimeout,setTimeout(e,0);try{return di(e,0)}catch{try{return di.call(null,e,0)}catch{return di.call(this,e,0)}}}function Jq(e){if(pi===clearTimeout)return clearTimeout(e);if((pi===fy||!pi)&&clearTimeout)return pi=clearTimeout,clearTimeout(e);try{return pi(e)}catch{try{return pi.call(null,e)}catch{return pi.call(this,e)}}}var so=[],Rf=!1,ca,mc=-1;function Yq(){!Rf||!ca||(Rf=!1,ca.length?so=ca.concat(so):mc=-1,so.length&&Q7())}function Q7(){if(!Rf){var e=X7(Yq);Rf=!0;for(var t=so.length;t;){for(ca=so,so=[];++mc<t;)ca&&ca[mc].run();mc=-1,t=so.length}ca=null,Rf=!1,Jq(e)}}Qt.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];so.push(new e9(e,t)),so.length===1&&!Rf&&X7(Q7)};function e9(e,t){this.fun=e,this.array=t}e9.prototype.run=function(){this.fun.apply(null,this.array)};Qt.title="browser";Qt.browser=!0;Qt.env={};Qt.argv=[];Qt.version="";Qt.versions={};function To(){}Qt.on=To;Qt.addListener=To;Qt.once=To;Qt.off=To;Qt.removeListener=To;Qt.removeAllListeners=To;Qt.emit=To;Qt.prependListener=To;Qt.prependOnceListener=To;Qt.listeners=function(e){return[]};Qt.binding=function(e){throw new Error("process.binding is not supported")};Qt.cwd=function(){return"/"};Qt.chdir=function(e){throw new Error("process.chdir is not supported")};Qt.umask=function(){return 0};var Xq=Y7.exports;const qe=Gq(Xq);var ly={exports:{}},uy={exports:{}},Kt={};(function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var t={},r={};r.byteLength=w,r.toByteArray=_,r.fromByteArray=B;for(var n=[],s=[],i=typeof Uint8Array<"u"?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,c=u.length;d<c;++d)n[d]=u[d],s[u.charCodeAt(d)]=d;s[45]=62,s[95]=63;function b(k){var T=k.length;if(T%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var L=k.indexOf("=");L===-1&&(L=T);var q=L===T?0:4-L%4;return[L,q]}function w(k){var T=b(k),L=T[0],q=T[1];return(L+q)*3/4-q}function M(k,T,L){return(T+L)*3/4-L}function _(k){var T,L=b(k),q=L[0],z=L[1],J=new i(M(k,q,z)),F=0,X=z>0?q-4:q,ee;for(ee=0;ee<X;ee+=4)T=s[k.charCodeAt(ee)]<<18|s[k.charCodeAt(ee+1)]<<12|s[k.charCodeAt(ee+2)]<<6|s[k.charCodeAt(ee+3)],J[F++]=T>>16&255,J[F++]=T>>8&255,J[F++]=T&255;return z===2&&(T=s[k.charCodeAt(ee)]<<2|s[k.charCodeAt(ee+1)]>>4,J[F++]=T&255),z===1&&(T=s[k.charCodeAt(ee)]<<10|s[k.charCodeAt(ee+1)]<<4|s[k.charCodeAt(ee+2)]>>2,J[F++]=T>>8&255,J[F++]=T&255),J}function A(k){return n[k>>18&63]+n[k>>12&63]+n[k>>6&63]+n[k&63]}function R(k,T,L){for(var q,z=[],J=T;J<L;J+=3)q=(k[J]<<16&16711680)+(k[J+1]<<8&65280)+(k[J+2]&255),z.push(A(q));return z.join("")}function B(k){for(var T,L=k.length,q=L%3,z=[],J=16383,F=0,X=L-q;F<X;F+=J)z.push(R(k,F,F+J>X?X:F+J));return q===1?(T=k[L-1],z.push(n[T>>2]+n[T<<4&63]+"==")):q===2&&(T=(k[L-2]<<8)+k[L-1],z.push(n[T>>10]+n[T>>4&63]+n[T<<2&63]+"=")),z.join("")}var I={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */I.read=function(k,T,L,q,z){var J,F,X=z*8-q-1,ee=(1<<X)-1,x=ee>>1,o=-7,f=L?z-1:0,l=L?-1:1,h=k[T+f];for(f+=l,J=h&(1<<-o)-1,h>>=-o,o+=X;o>0;J=J*256+k[T+f],f+=l,o-=8);for(F=J&(1<<-o)-1,J>>=-o,o+=q;o>0;F=F*256+k[T+f],f+=l,o-=8);if(J===0)J=1-x;else{if(J===ee)return F?NaN:(h?-1:1)*(1/0);F=F+Math.pow(2,q),J=J-x}return(h?-1:1)*F*Math.pow(2,J-q)},I.write=function(k,T,L,q,z,J){var F,X,ee,x=J*8-z-1,o=(1<<x)-1,f=o>>1,l=z===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=q?0:J-1,v=q?1:-1,y=T<0||T===0&&1/T<0?1:0;for(T=Math.abs(T),isNaN(T)||T===1/0?(X=isNaN(T)?1:0,F=o):(F=Math.floor(Math.log(T)/Math.LN2),T*(ee=Math.pow(2,-F))<1&&(F--,ee*=2),F+f>=1?T+=l/ee:T+=l*Math.pow(2,1-f),T*ee>=2&&(F++,ee/=2),F+f>=o?(X=0,F=o):F+f>=1?(X=(T*ee-1)*Math.pow(2,z),F=F+f):(X=T*Math.pow(2,f-1)*Math.pow(2,z),F=0));z>=8;k[L+h]=X&255,h+=v,X/=256,z-=8);for(F=F<<z|X,x+=z;x>0;k[L+h]=F&255,h+=v,F/=256,x-=8);k[L+h-v]|=y*128};/*!
41
- * The buffer module from node.js, for the browser.
42
- *
43
- * @author Feross Aboukhadijeh <https://feross.org>
44
- * @license MIT
45
- */(function(k){const T=r,L=I,q=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;k.Buffer=o,k.SlowBuffer=N,k.INSPECT_MAX_BYTES=50;const z=2147483647;k.kMaxLength=z;const{Uint8Array:J,ArrayBuffer:F,SharedArrayBuffer:X}=globalThis;o.TYPED_ARRAY_SUPPORT=ee(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function ee(){try{const D=new J(1),C={foo:function(){return 42}};return Object.setPrototypeOf(C,J.prototype),Object.setPrototypeOf(D,C),D.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function x(D){if(D>z)throw new RangeError('The value "'+D+'" is invalid for option "size"');const C=new J(D);return Object.setPrototypeOf(C,o.prototype),C}function o(D,C,j){if(typeof D=="number"){if(typeof C=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return v(D)}return f(D,C,j)}o.poolSize=8192;function f(D,C,j){if(typeof D=="string")return y(D,C);if(F.isView(D))return p(D);if(D==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof D);if(Re(D,F)||D&&Re(D.buffer,F)||typeof X<"u"&&(Re(D,X)||D&&Re(D.buffer,X)))return a(D,C,j);if(typeof D=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const Y=D.valueOf&&D.valueOf();if(Y!=null&&Y!==D)return o.from(Y,C,j);const te=g(D);if(te)return te;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof D[Symbol.toPrimitive]=="function")return o.from(D[Symbol.toPrimitive]("string"),C,j);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof D)}o.from=function(D,C,j){return f(D,C,j)},Object.setPrototypeOf(o.prototype,J.prototype),Object.setPrototypeOf(o,J);function l(D){if(typeof D!="number")throw new TypeError('"size" argument must be of type number');if(D<0)throw new RangeError('The value "'+D+'" is invalid for option "size"')}function h(D,C,j){return l(D),D<=0?x(D):C!==void 0?typeof j=="string"?x(D).fill(C,j):x(D).fill(C):x(D)}o.alloc=function(D,C,j){return h(D,C,j)};function v(D){return l(D),x(D<0?0:S(D)|0)}o.allocUnsafe=function(D){return v(D)},o.allocUnsafeSlow=function(D){return v(D)};function y(D,C){if((typeof C!="string"||C==="")&&(C="utf8"),!o.isEncoding(C))throw new TypeError("Unknown encoding: "+C);const j=U(D,C)|0;let Y=x(j);const te=Y.write(D,C);return te!==j&&(Y=Y.slice(0,te)),Y}function m(D){const C=D.length<0?0:S(D.length)|0,j=x(C);for(let Y=0;Y<C;Y+=1)j[Y]=D[Y]&255;return j}function p(D){if(Re(D,J)){const C=new J(D);return a(C.buffer,C.byteOffset,C.byteLength)}return m(D)}function a(D,C,j){if(C<0||D.byteLength<C)throw new RangeError('"offset" is outside of buffer bounds');if(D.byteLength<C+(j||0))throw new RangeError('"length" is outside of buffer bounds');let Y;return C===void 0&&j===void 0?Y=new J(D):j===void 0?Y=new J(D,C):Y=new J(D,C,j),Object.setPrototypeOf(Y,o.prototype),Y}function g(D){if(o.isBuffer(D)){const C=S(D.length)|0,j=x(C);return j.length===0||D.copy(j,0,0,C),j}if(D.length!==void 0)return typeof D.length!="number"||Xe(D.length)?x(0):m(D);if(D.type==="Buffer"&&Array.isArray(D.data))return m(D.data)}function S(D){if(D>=z)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+z.toString(16)+" bytes");return D|0}function N(D){return+D!=D&&(D=0),o.alloc(+D)}o.isBuffer=function(C){return C!=null&&C._isBuffer===!0&&C!==o.prototype},o.compare=function(C,j){if(Re(C,J)&&(C=o.from(C,C.offset,C.byteLength)),Re(j,J)&&(j=o.from(j,j.offset,j.byteLength)),!o.isBuffer(C)||!o.isBuffer(j))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(C===j)return 0;let Y=C.length,te=j.length;for(let ue=0,re=Math.min(Y,te);ue<re;++ue)if(C[ue]!==j[ue]){Y=C[ue],te=j[ue];break}return Y<te?-1:te<Y?1:0},o.isEncoding=function(C){switch(String(C).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(C,j){if(!Array.isArray(C))throw new TypeError('"list" argument must be an Array of Buffers');if(C.length===0)return o.alloc(0);let Y;if(j===void 0)for(j=0,Y=0;Y<C.length;++Y)j+=C[Y].length;const te=o.allocUnsafe(j);let ue=0;for(Y=0;Y<C.length;++Y){let re=C[Y];if(Re(re,J))ue+re.length>te.length?(o.isBuffer(re)||(re=o.from(re)),re.copy(te,ue)):J.prototype.set.call(te,re,ue);else if(o.isBuffer(re))re.copy(te,ue);else throw new TypeError('"list" argument must be an Array of Buffers');ue+=re.length}return te};function U(D,C){if(o.isBuffer(D))return D.length;if(F.isView(D)||Re(D,F))return D.byteLength;if(typeof D!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof D);const j=D.length,Y=arguments.length>2&&arguments[2]===!0;if(!Y&&j===0)return 0;let te=!1;for(;;)switch(C){case"ascii":case"latin1":case"binary":return j;case"utf8":case"utf-8":return Ze(D).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j*2;case"hex":return j>>>1;case"base64":return Qe(D).length;default:if(te)return Y?-1:Ze(D).length;C=(""+C).toLowerCase(),te=!0}}o.byteLength=U;function Z(D,C,j){let Y=!1;if((C===void 0||C<0)&&(C=0),C>this.length||((j===void 0||j>this.length)&&(j=this.length),j<=0)||(j>>>=0,C>>>=0,j<=C))return"";for(D||(D="utf8");;)switch(D){case"hex":return je(this,C,j);case"utf8":case"utf-8":return oe(this,C,j);case"ascii":return fe(this,C,j);case"latin1":case"binary":return ne(this,C,j);case"base64":return de(this,C,j);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ae(this,C,j);default:if(Y)throw new TypeError("Unknown encoding: "+D);D=(D+"").toLowerCase(),Y=!0}}o.prototype._isBuffer=!0;function H(D,C,j){const Y=D[C];D[C]=D[j],D[j]=Y}o.prototype.swap16=function(){const C=this.length;if(C%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let j=0;j<C;j+=2)H(this,j,j+1);return this},o.prototype.swap32=function(){const C=this.length;if(C%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let j=0;j<C;j+=4)H(this,j,j+3),H(this,j+1,j+2);return this},o.prototype.swap64=function(){const C=this.length;if(C%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let j=0;j<C;j+=8)H(this,j,j+7),H(this,j+1,j+6),H(this,j+2,j+5),H(this,j+3,j+4);return this},o.prototype.toString=function(){const C=this.length;return C===0?"":arguments.length===0?oe(this,0,C):Z.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(C){if(!o.isBuffer(C))throw new TypeError("Argument must be a Buffer");return this===C?!0:o.compare(this,C)===0},o.prototype.inspect=function(){let C="";const j=k.INSPECT_MAX_BYTES;return C=this.toString("hex",0,j).replace(/(.{2})/g,"$1 ").trim(),this.length>j&&(C+=" ... "),"<Buffer "+C+">"},q&&(o.prototype[q]=o.prototype.inspect),o.prototype.compare=function(C,j,Y,te,ue){if(Re(C,J)&&(C=o.from(C,C.offset,C.byteLength)),!o.isBuffer(C))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof C);if(j===void 0&&(j=0),Y===void 0&&(Y=C?C.length:0),te===void 0&&(te=0),ue===void 0&&(ue=this.length),j<0||Y>C.length||te<0||ue>this.length)throw new RangeError("out of range index");if(te>=ue&&j>=Y)return 0;if(te>=ue)return-1;if(j>=Y)return 1;if(j>>>=0,Y>>>=0,te>>>=0,ue>>>=0,this===C)return 0;let re=ue-te,ve=Y-j;const De=Math.min(re,ve),ce=this.slice(te,ue),Me=C.slice(j,Y);for(let Oe=0;Oe<De;++Oe)if(ce[Oe]!==Me[Oe]){re=ce[Oe],ve=Me[Oe];break}return re<ve?-1:ve<re?1:0};function $(D,C,j,Y,te){if(D.length===0)return-1;if(typeof j=="string"?(Y=j,j=0):j>2147483647?j=2147483647:j<-2147483648&&(j=-2147483648),j=+j,Xe(j)&&(j=te?0:D.length-1),j<0&&(j=D.length+j),j>=D.length){if(te)return-1;j=D.length-1}else if(j<0)if(te)j=0;else return-1;if(typeof C=="string"&&(C=o.from(C,Y)),o.isBuffer(C))return C.length===0?-1:P(D,C,j,Y,te);if(typeof C=="number")return C=C&255,typeof J.prototype.indexOf=="function"?te?J.prototype.indexOf.call(D,C,j):J.prototype.lastIndexOf.call(D,C,j):P(D,[C],j,Y,te);throw new TypeError("val must be string, number or Buffer")}function P(D,C,j,Y,te){let ue=1,re=D.length,ve=C.length;if(Y!==void 0&&(Y=String(Y).toLowerCase(),Y==="ucs2"||Y==="ucs-2"||Y==="utf16le"||Y==="utf-16le")){if(D.length<2||C.length<2)return-1;ue=2,re/=2,ve/=2,j/=2}function De(Me,Oe){return ue===1?Me[Oe]:Me.readUInt16BE(Oe*ue)}let ce;if(te){let Me=-1;for(ce=j;ce<re;ce++)if(De(D,ce)===De(C,Me===-1?0:ce-Me)){if(Me===-1&&(Me=ce),ce-Me+1===ve)return Me*ue}else Me!==-1&&(ce-=ce-Me),Me=-1}else for(j+ve>re&&(j=re-ve),ce=j;ce>=0;ce--){let Me=!0;for(let Oe=0;Oe<ve;Oe++)if(De(D,ce+Oe)!==De(C,Oe)){Me=!1;break}if(Me)return ce}return-1}o.prototype.includes=function(C,j,Y){return this.indexOf(C,j,Y)!==-1},o.prototype.indexOf=function(C,j,Y){return $(this,C,j,Y,!0)},o.prototype.lastIndexOf=function(C,j,Y){return $(this,C,j,Y,!1)};function W(D,C,j,Y){j=Number(j)||0;const te=D.length-j;Y?(Y=Number(Y),Y>te&&(Y=te)):Y=te;const ue=C.length;Y>ue/2&&(Y=ue/2);let re;for(re=0;re<Y;++re){const ve=parseInt(C.substr(re*2,2),16);if(Xe(ve))return re;D[j+re]=ve}return re}function G(D,C,j,Y){return xe(Ze(C,D.length-j),D,j,Y)}function K(D,C,j,Y){return xe(pe(C),D,j,Y)}function O(D,C,j,Y){return xe(Qe(C),D,j,Y)}function Q(D,C,j,Y){return xe(Ne(C,D.length-j),D,j,Y)}o.prototype.write=function(C,j,Y,te){if(j===void 0)te="utf8",Y=this.length,j=0;else if(Y===void 0&&typeof j=="string")te=j,Y=this.length,j=0;else if(isFinite(j))j=j>>>0,isFinite(Y)?(Y=Y>>>0,te===void 0&&(te="utf8")):(te=Y,Y=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const ue=this.length-j;if((Y===void 0||Y>ue)&&(Y=ue),C.length>0&&(Y<0||j<0)||j>this.length)throw new RangeError("Attempt to write outside buffer bounds");te||(te="utf8");let re=!1;for(;;)switch(te){case"hex":return W(this,C,j,Y);case"utf8":case"utf-8":return G(this,C,j,Y);case"ascii":case"latin1":case"binary":return K(this,C,j,Y);case"base64":return O(this,C,j,Y);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q(this,C,j,Y);default:if(re)throw new TypeError("Unknown encoding: "+te);te=(""+te).toLowerCase(),re=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function de(D,C,j){return C===0&&j===D.length?T.fromByteArray(D):T.fromByteArray(D.slice(C,j))}function oe(D,C,j){j=Math.min(D.length,j);const Y=[];let te=C;for(;te<j;){const ue=D[te];let re=null,ve=ue>239?4:ue>223?3:ue>191?2:1;if(te+ve<=j){let De,ce,Me,Oe;switch(ve){case 1:ue<128&&(re=ue);break;case 2:De=D[te+1],(De&192)===128&&(Oe=(ue&31)<<6|De&63,Oe>127&&(re=Oe));break;case 3:De=D[te+1],ce=D[te+2],(De&192)===128&&(ce&192)===128&&(Oe=(ue&15)<<12|(De&63)<<6|ce&63,Oe>2047&&(Oe<55296||Oe>57343)&&(re=Oe));break;case 4:De=D[te+1],ce=D[te+2],Me=D[te+3],(De&192)===128&&(ce&192)===128&&(Me&192)===128&&(Oe=(ue&15)<<18|(De&63)<<12|(ce&63)<<6|Me&63,Oe>65535&&Oe<1114112&&(re=Oe))}}re===null?(re=65533,ve=1):re>65535&&(re-=65536,Y.push(re>>>10&1023|55296),re=56320|re&1023),Y.push(re),te+=ve}return Ie(Y)}const se=4096;function Ie(D){const C=D.length;if(C<=se)return String.fromCharCode.apply(String,D);let j="",Y=0;for(;Y<C;)j+=String.fromCharCode.apply(String,D.slice(Y,Y+=se));return j}function fe(D,C,j){let Y="";j=Math.min(D.length,j);for(let te=C;te<j;++te)Y+=String.fromCharCode(D[te]&127);return Y}function ne(D,C,j){let Y="";j=Math.min(D.length,j);for(let te=C;te<j;++te)Y+=String.fromCharCode(D[te]);return Y}function je(D,C,j){const Y=D.length;(!C||C<0)&&(C=0),(!j||j<0||j>Y)&&(j=Y);let te="";for(let ue=C;ue<j;++ue)te+=Ee[D[ue]];return te}function ae(D,C,j){const Y=D.slice(C,j);let te="";for(let ue=0;ue<Y.length-1;ue+=2)te+=String.fromCharCode(Y[ue]+Y[ue+1]*256);return te}o.prototype.slice=function(C,j){const Y=this.length;C=~~C,j=j===void 0?Y:~~j,C<0?(C+=Y,C<0&&(C=0)):C>Y&&(C=Y),j<0?(j+=Y,j<0&&(j=0)):j>Y&&(j=Y),j<C&&(j=C);const te=this.subarray(C,j);return Object.setPrototypeOf(te,o.prototype),te};function le(D,C,j){if(D%1!==0||D<0)throw new RangeError("offset is not uint");if(D+C>j)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(C,j,Y){C=C>>>0,j=j>>>0,Y||le(C,j,this.length);let te=this[C],ue=1,re=0;for(;++re<j&&(ue*=256);)te+=this[C+re]*ue;return te},o.prototype.readUintBE=o.prototype.readUIntBE=function(C,j,Y){C=C>>>0,j=j>>>0,Y||le(C,j,this.length);let te=this[C+--j],ue=1;for(;j>0&&(ue*=256);)te+=this[C+--j]*ue;return te},o.prototype.readUint8=o.prototype.readUInt8=function(C,j){return C=C>>>0,j||le(C,1,this.length),this[C]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(C,j){return C=C>>>0,j||le(C,2,this.length),this[C]|this[C+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(C,j){return C=C>>>0,j||le(C,2,this.length),this[C]<<8|this[C+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(C,j){return C=C>>>0,j||le(C,4,this.length),(this[C]|this[C+1]<<8|this[C+2]<<16)+this[C+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(C,j){return C=C>>>0,j||le(C,4,this.length),this[C]*16777216+(this[C+1]<<16|this[C+2]<<8|this[C+3])},o.prototype.readBigUInt64LE=$e(function(C){C=C>>>0,Be(C,"offset");const j=this[C],Y=this[C+7];(j===void 0||Y===void 0)&&We(C,this.length-8);const te=j+this[++C]*2**8+this[++C]*2**16+this[++C]*2**24,ue=this[++C]+this[++C]*2**8+this[++C]*2**16+Y*2**24;return BigInt(te)+(BigInt(ue)<<BigInt(32))}),o.prototype.readBigUInt64BE=$e(function(C){C=C>>>0,Be(C,"offset");const j=this[C],Y=this[C+7];(j===void 0||Y===void 0)&&We(C,this.length-8);const te=j*2**24+this[++C]*2**16+this[++C]*2**8+this[++C],ue=this[++C]*2**24+this[++C]*2**16+this[++C]*2**8+Y;return(BigInt(te)<<BigInt(32))+BigInt(ue)}),o.prototype.readIntLE=function(C,j,Y){C=C>>>0,j=j>>>0,Y||le(C,j,this.length);let te=this[C],ue=1,re=0;for(;++re<j&&(ue*=256);)te+=this[C+re]*ue;return ue*=128,te>=ue&&(te-=Math.pow(2,8*j)),te},o.prototype.readIntBE=function(C,j,Y){C=C>>>0,j=j>>>0,Y||le(C,j,this.length);let te=j,ue=1,re=this[C+--te];for(;te>0&&(ue*=256);)re+=this[C+--te]*ue;return ue*=128,re>=ue&&(re-=Math.pow(2,8*j)),re},o.prototype.readInt8=function(C,j){return C=C>>>0,j||le(C,1,this.length),this[C]&128?(255-this[C]+1)*-1:this[C]},o.prototype.readInt16LE=function(C,j){C=C>>>0,j||le(C,2,this.length);const Y=this[C]|this[C+1]<<8;return Y&32768?Y|4294901760:Y},o.prototype.readInt16BE=function(C,j){C=C>>>0,j||le(C,2,this.length);const Y=this[C+1]|this[C]<<8;return Y&32768?Y|4294901760:Y},o.prototype.readInt32LE=function(C,j){return C=C>>>0,j||le(C,4,this.length),this[C]|this[C+1]<<8|this[C+2]<<16|this[C+3]<<24},o.prototype.readInt32BE=function(C,j){return C=C>>>0,j||le(C,4,this.length),this[C]<<24|this[C+1]<<16|this[C+2]<<8|this[C+3]},o.prototype.readBigInt64LE=$e(function(C){C=C>>>0,Be(C,"offset");const j=this[C],Y=this[C+7];(j===void 0||Y===void 0)&&We(C,this.length-8);const te=this[C+4]+this[C+5]*2**8+this[C+6]*2**16+(Y<<24);return(BigInt(te)<<BigInt(32))+BigInt(j+this[++C]*2**8+this[++C]*2**16+this[++C]*2**24)}),o.prototype.readBigInt64BE=$e(function(C){C=C>>>0,Be(C,"offset");const j=this[C],Y=this[C+7];(j===void 0||Y===void 0)&&We(C,this.length-8);const te=(j<<24)+this[++C]*2**16+this[++C]*2**8+this[++C];return(BigInt(te)<<BigInt(32))+BigInt(this[++C]*2**24+this[++C]*2**16+this[++C]*2**8+Y)}),o.prototype.readFloatLE=function(C,j){return C=C>>>0,j||le(C,4,this.length),L.read(this,C,!0,23,4)},o.prototype.readFloatBE=function(C,j){return C=C>>>0,j||le(C,4,this.length),L.read(this,C,!1,23,4)},o.prototype.readDoubleLE=function(C,j){return C=C>>>0,j||le(C,8,this.length),L.read(this,C,!0,52,8)},o.prototype.readDoubleBE=function(C,j){return C=C>>>0,j||le(C,8,this.length),L.read(this,C,!1,52,8)};function Le(D,C,j,Y,te,ue){if(!o.isBuffer(D))throw new TypeError('"buffer" argument must be a Buffer instance');if(C>te||C<ue)throw new RangeError('"value" argument is out of bounds');if(j+Y>D.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(C,j,Y,te){if(C=+C,j=j>>>0,Y=Y>>>0,!te){const ve=Math.pow(2,8*Y)-1;Le(this,C,j,Y,ve,0)}let ue=1,re=0;for(this[j]=C&255;++re<Y&&(ue*=256);)this[j+re]=C/ue&255;return j+Y},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(C,j,Y,te){if(C=+C,j=j>>>0,Y=Y>>>0,!te){const ve=Math.pow(2,8*Y)-1;Le(this,C,j,Y,ve,0)}let ue=Y-1,re=1;for(this[j+ue]=C&255;--ue>=0&&(re*=256);)this[j+ue]=C/re&255;return j+Y},o.prototype.writeUint8=o.prototype.writeUInt8=function(C,j,Y){return C=+C,j=j>>>0,Y||Le(this,C,j,1,255,0),this[j]=C&255,j+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(C,j,Y){return C=+C,j=j>>>0,Y||Le(this,C,j,2,65535,0),this[j]=C&255,this[j+1]=C>>>8,j+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(C,j,Y){return C=+C,j=j>>>0,Y||Le(this,C,j,2,65535,0),this[j]=C>>>8,this[j+1]=C&255,j+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(C,j,Y){return C=+C,j=j>>>0,Y||Le(this,C,j,4,4294967295,0),this[j+3]=C>>>24,this[j+2]=C>>>16,this[j+1]=C>>>8,this[j]=C&255,j+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(C,j,Y){return C=+C,j=j>>>0,Y||Le(this,C,j,4,4294967295,0),this[j]=C>>>24,this[j+1]=C>>>16,this[j+2]=C>>>8,this[j+3]=C&255,j+4};function he(D,C,j,Y,te){we(C,Y,te,D,j,7);let ue=Number(C&BigInt(4294967295));D[j++]=ue,ue=ue>>8,D[j++]=ue,ue=ue>>8,D[j++]=ue,ue=ue>>8,D[j++]=ue;let re=Number(C>>BigInt(32)&BigInt(4294967295));return D[j++]=re,re=re>>8,D[j++]=re,re=re>>8,D[j++]=re,re=re>>8,D[j++]=re,j}function _e(D,C,j,Y,te){we(C,Y,te,D,j,7);let ue=Number(C&BigInt(4294967295));D[j+7]=ue,ue=ue>>8,D[j+6]=ue,ue=ue>>8,D[j+5]=ue,ue=ue>>8,D[j+4]=ue;let re=Number(C>>BigInt(32)&BigInt(4294967295));return D[j+3]=re,re=re>>8,D[j+2]=re,re=re>>8,D[j+1]=re,re=re>>8,D[j]=re,j+8}o.prototype.writeBigUInt64LE=$e(function(C,j=0){return he(this,C,j,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=$e(function(C,j=0){return _e(this,C,j,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(C,j,Y,te){if(C=+C,j=j>>>0,!te){const De=Math.pow(2,8*Y-1);Le(this,C,j,Y,De-1,-De)}let ue=0,re=1,ve=0;for(this[j]=C&255;++ue<Y&&(re*=256);)C<0&&ve===0&&this[j+ue-1]!==0&&(ve=1),this[j+ue]=(C/re>>0)-ve&255;return j+Y},o.prototype.writeIntBE=function(C,j,Y,te){if(C=+C,j=j>>>0,!te){const De=Math.pow(2,8*Y-1);Le(this,C,j,Y,De-1,-De)}let ue=Y-1,re=1,ve=0;for(this[j+ue]=C&255;--ue>=0&&(re*=256);)C<0&&ve===0&&this[j+ue+1]!==0&&(ve=1),this[j+ue]=(C/re>>0)-ve&255;return j+Y},o.prototype.writeInt8=function(C,j,Y){return C=+C,j=j>>>0,Y||Le(this,C,j,1,127,-128),C<0&&(C=255+C+1),this[j]=C&255,j+1},o.prototype.writeInt16LE=function(C,j,Y){return C=+C,j=j>>>0,Y||Le(this,C,j,2,32767,-32768),this[j]=C&255,this[j+1]=C>>>8,j+2},o.prototype.writeInt16BE=function(C,j,Y){return C=+C,j=j>>>0,Y||Le(this,C,j,2,32767,-32768),this[j]=C>>>8,this[j+1]=C&255,j+2},o.prototype.writeInt32LE=function(C,j,Y){return C=+C,j=j>>>0,Y||Le(this,C,j,4,2147483647,-2147483648),this[j]=C&255,this[j+1]=C>>>8,this[j+2]=C>>>16,this[j+3]=C>>>24,j+4},o.prototype.writeInt32BE=function(C,j,Y){return C=+C,j=j>>>0,Y||Le(this,C,j,4,2147483647,-2147483648),C<0&&(C=4294967295+C+1),this[j]=C>>>24,this[j+1]=C>>>16,this[j+2]=C>>>8,this[j+3]=C&255,j+4},o.prototype.writeBigInt64LE=$e(function(C,j=0){return he(this,C,j,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=$e(function(C,j=0){return _e(this,C,j,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function He(D,C,j,Y,te,ue){if(j+Y>D.length)throw new RangeError("Index out of range");if(j<0)throw new RangeError("Index out of range")}function ye(D,C,j,Y,te){return C=+C,j=j>>>0,te||He(D,C,j,4),L.write(D,C,j,Y,23,4),j+4}o.prototype.writeFloatLE=function(C,j,Y){return ye(this,C,j,!0,Y)},o.prototype.writeFloatBE=function(C,j,Y){return ye(this,C,j,!1,Y)};function Ae(D,C,j,Y,te){return C=+C,j=j>>>0,te||He(D,C,j,8),L.write(D,C,j,Y,52,8),j+8}o.prototype.writeDoubleLE=function(C,j,Y){return Ae(this,C,j,!0,Y)},o.prototype.writeDoubleBE=function(C,j,Y){return Ae(this,C,j,!1,Y)},o.prototype.copy=function(C,j,Y,te){if(!o.isBuffer(C))throw new TypeError("argument should be a Buffer");if(Y||(Y=0),!te&&te!==0&&(te=this.length),j>=C.length&&(j=C.length),j||(j=0),te>0&&te<Y&&(te=Y),te===Y||C.length===0||this.length===0)return 0;if(j<0)throw new RangeError("targetStart out of bounds");if(Y<0||Y>=this.length)throw new RangeError("Index out of range");if(te<0)throw new RangeError("sourceEnd out of bounds");te>this.length&&(te=this.length),C.length-j<te-Y&&(te=C.length-j+Y);const ue=te-Y;return this===C&&typeof J.prototype.copyWithin=="function"?this.copyWithin(j,Y,te):J.prototype.set.call(C,this.subarray(Y,te),j),ue},o.prototype.fill=function(C,j,Y,te){if(typeof C=="string"){if(typeof j=="string"?(te=j,j=0,Y=this.length):typeof Y=="string"&&(te=Y,Y=this.length),te!==void 0&&typeof te!="string")throw new TypeError("encoding must be a string");if(typeof te=="string"&&!o.isEncoding(te))throw new TypeError("Unknown encoding: "+te);if(C.length===1){const re=C.charCodeAt(0);(te==="utf8"&&re<128||te==="latin1")&&(C=re)}}else typeof C=="number"?C=C&255:typeof C=="boolean"&&(C=Number(C));if(j<0||this.length<j||this.length<Y)throw new RangeError("Out of range index");if(Y<=j)return this;j=j>>>0,Y=Y===void 0?this.length:Y>>>0,C||(C=0);let ue;if(typeof C=="number")for(ue=j;ue<Y;++ue)this[ue]=C;else{const re=o.isBuffer(C)?C:o.from(C,te),ve=re.length;if(ve===0)throw new TypeError('The value "'+C+'" is invalid for argument "value"');for(ue=0;ue<Y-j;++ue)this[ue+j]=re[ue%ve]}return this};const ze={};function me(D,C,j){ze[D]=class extends j{constructor(){super(),Object.defineProperty(this,"message",{value:C.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${D}]`,this.stack,delete this.name}get code(){return D}set code(te){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:te,writable:!0})}toString(){return`${this.name} [${D}]: ${this.message}`}}}me("ERR_BUFFER_OUT_OF_BOUNDS",function(D){return D?`${D} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),me("ERR_INVALID_ARG_TYPE",function(D,C){return`The "${D}" argument must be of type number. Received type ${typeof C}`},TypeError),me("ERR_OUT_OF_RANGE",function(D,C,j){let Y=`The value of "${D}" is out of range.`,te=j;return Number.isInteger(j)&&Math.abs(j)>2**32?te=ge(String(j)):typeof j=="bigint"&&(te=String(j),(j>BigInt(2)**BigInt(32)||j<-(BigInt(2)**BigInt(32)))&&(te=ge(te)),te+="n"),Y+=` It must be ${C}. Received ${te}`,Y},RangeError);function ge(D){let C="",j=D.length;const Y=D[0]==="-"?1:0;for(;j>=Y+4;j-=3)C=`_${D.slice(j-3,j)}${C}`;return`${D.slice(0,j)}${C}`}function Ke(D,C,j){Be(C,"offset"),(D[C]===void 0||D[C+j]===void 0)&&We(C,D.length-(j+1))}function we(D,C,j,Y,te,ue){if(D>j||D<C){const re=typeof C=="bigint"?"n":"";let ve;throw C===0||C===BigInt(0)?ve=`>= 0${re} and < 2${re} ** ${(ue+1)*8}${re}`:ve=`>= -(2${re} ** ${(ue+1)*8-1}${re}) and < 2 ** ${(ue+1)*8-1}${re}`,new ze.ERR_OUT_OF_RANGE("value",ve,D)}Ke(Y,te,ue)}function Be(D,C){if(typeof D!="number")throw new ze.ERR_INVALID_ARG_TYPE(C,"number",D)}function We(D,C,j){throw Math.floor(D)!==D?(Be(D,j),new ze.ERR_OUT_OF_RANGE("offset","an integer",D)):C<0?new ze.ERR_BUFFER_OUT_OF_BOUNDS:new ze.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${C}`,D)}const be=/[^+/0-9A-Za-z-_]/g;function ke(D){if(D=D.split("=")[0],D=D.trim().replace(be,""),D.length<2)return"";for(;D.length%4!==0;)D=D+"=";return D}function Ze(D,C){C=C||1/0;let j;const Y=D.length;let te=null;const ue=[];for(let re=0;re<Y;++re){if(j=D.charCodeAt(re),j>55295&&j<57344){if(!te){if(j>56319){(C-=3)>-1&&ue.push(239,191,189);continue}else if(re+1===Y){(C-=3)>-1&&ue.push(239,191,189);continue}te=j;continue}if(j<56320){(C-=3)>-1&&ue.push(239,191,189),te=j;continue}j=(te-55296<<10|j-56320)+65536}else te&&(C-=3)>-1&&ue.push(239,191,189);if(te=null,j<128){if((C-=1)<0)break;ue.push(j)}else if(j<2048){if((C-=2)<0)break;ue.push(j>>6|192,j&63|128)}else if(j<65536){if((C-=3)<0)break;ue.push(j>>12|224,j>>6&63|128,j&63|128)}else if(j<1114112){if((C-=4)<0)break;ue.push(j>>18|240,j>>12&63|128,j>>6&63|128,j&63|128)}else throw new Error("Invalid code point")}return ue}function pe(D){const C=[];for(let j=0;j<D.length;++j)C.push(D.charCodeAt(j)&255);return C}function Ne(D,C){let j,Y,te;const ue=[];for(let re=0;re<D.length&&!((C-=2)<0);++re)j=D.charCodeAt(re),Y=j>>8,te=j%256,ue.push(te),ue.push(Y);return ue}function Qe(D){return T.toByteArray(ke(D))}function xe(D,C,j,Y){let te;for(te=0;te<Y&&!(te+j>=C.length||te>=D.length);++te)C[te+j]=D[te];return te}function Re(D,C){return D instanceof C||D!=null&&D.constructor!=null&&D.constructor.name!=null&&D.constructor.name===C.name}function Xe(D){return D!==D}const Ee=function(){const D="0123456789abcdef",C=new Array(256);for(let j=0;j<16;++j){const Y=j*16;for(let te=0;te<16;++te)C[Y+te]=D[j]+D[te]}return C}();function $e(D){return typeof BigInt>"u"?tt:D}function tt(){throw new Error("BigInt not supported")}})(t);const E=t.Buffer;e.Blob=t.Blob,e.BlobOptions=t.BlobOptions,e.Buffer=t.Buffer,e.File=t.File,e.FileOptions=t.FileOptions,e.INSPECT_MAX_BYTES=t.INSPECT_MAX_BYTES,e.SlowBuffer=t.SlowBuffer,e.TranscodeEncoding=t.TranscodeEncoding,e.atob=t.atob,e.btoa=t.btoa,e.constants=t.constants,e.default=E,e.isAscii=t.isAscii,e.isUtf8=t.isUtf8,e.kMaxLength=t.kMaxLength,e.kStringMaxLength=t.kStringMaxLength,e.resolveObjectURL=t.resolveObjectURL,e.transcode=t.transcode})(Kt);const ht=Xy(Kt);/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(e,t){var r=Kt,n=r.Buffer;function s(u,d){for(var c in u)d[c]=u[c]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(s(r,t),t.Buffer=i);function i(u,d,c){return n(u,d,c)}i.prototype=Object.create(n.prototype),s(n,i),i.from=function(u,d,c){if(typeof u=="number")throw new TypeError("Argument must not be a number");return n(u,d,c)},i.alloc=function(u,d,c){if(typeof u!="number")throw new TypeError("Argument must be a number");var b=n(u);return d!==void 0?typeof c=="string"?b.fill(d,c):b.fill(d):b.fill(0),b},i.allocUnsafe=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return n(u)},i.allocUnsafeSlow=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(u)}})(uy,uy.exports);var Ye=uy.exports,d1=65536,Qq=4294967295;function eF(){throw new Error(`Secure random number generation is not supported by this browser.
46
- Use Chrome, Firefox or Internet Explorer 11`)}var tF=Ye.Buffer,d0=Ve.crypto||Ve.msCrypto;d0&&d0.getRandomValues?ly.exports=rF:ly.exports=eF;function rF(e,t){if(e>Qq)throw new RangeError("requested too many random bytes");var r=tF.allocUnsafe(e);if(e>0)if(e>d1)for(var n=0;n<e;n+=d1)d0.getRandomValues(r.slice(n,n+d1));else d0.getRandomValues(r);return typeof t=="function"?qe.nextTick(function(){t(null,r)}):r}var yl=ly.exports,hy={exports:{}};typeof Object.create=="function"?hy.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:hy.exports=function(t,r){if(r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}};var Fe=hy.exports,nw={exports:{}},$f=typeof Reflect=="object"?Reflect:null,E6=$f&&typeof $f.apply=="function"?$f.apply:function(t,r,n){return Function.prototype.apply.call(t,r,n)},wc;$f&&typeof $f.ownKeys=="function"?wc=$f.ownKeys:Object.getOwnPropertySymbols?wc=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:wc=function(t){return Object.getOwnPropertyNames(t)};function nF(e){console&&console.warn&&console.warn(e)}var t9=Number.isNaN||function(t){return t!==t};function dt(){dt.init.call(this)}nw.exports=dt;nw.exports.once=aF;dt.EventEmitter=dt;dt.prototype._events=void 0;dt.prototype._eventsCount=0;dt.prototype._maxListeners=void 0;var S6=10;function bd(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(dt,"defaultMaxListeners",{enumerable:!0,get:function(){return S6},set:function(e){if(typeof e!="number"||e<0||t9(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");S6=e}});dt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};dt.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||t9(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function r9(e){return e._maxListeners===void 0?dt.defaultMaxListeners:e._maxListeners}dt.prototype.getMaxListeners=function(){return r9(this)};dt.prototype.emit=function(t){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var s=t==="error",i=this._events;if(i!==void 0)s=s&&i.error===void 0;else if(!s)return!1;if(s){var u;if(r.length>0&&(u=r[0]),u instanceof Error)throw u;var d=new Error("Unhandled error."+(u?" ("+u.message+")":""));throw d.context=u,d}var c=i[t];if(c===void 0)return!1;if(typeof c=="function")E6(c,this,r);else for(var b=c.length,w=a9(c,b),n=0;n<b;++n)E6(w[n],this,r);return!0};function n9(e,t,r,n){var s,i,u;if(bd(r),i=e._events,i===void 0?(i=e._events=Object.create(null),e._eventsCount=0):(i.newListener!==void 0&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),u=i[t]),u===void 0)u=i[t]=r,++e._eventsCount;else if(typeof u=="function"?u=i[t]=n?[r,u]:[u,r]:n?u.unshift(r):u.push(r),s=r9(e),s>0&&u.length>s&&!u.warned){u.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=u.length,nF(d)}return e}dt.prototype.addListener=function(t,r){return n9(this,t,r,!1)};dt.prototype.on=dt.prototype.addListener;dt.prototype.prependListener=function(t,r){return n9(this,t,r,!0)};function iF(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function i9(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},s=iF.bind(n);return s.listener=r,n.wrapFn=s,s}dt.prototype.once=function(t,r){return bd(r),this.on(t,i9(this,t,r)),this};dt.prototype.prependOnceListener=function(t,r){return bd(r),this.prependListener(t,i9(this,t,r)),this};dt.prototype.removeListener=function(t,r){var n,s,i,u,d;if(bd(r),s=this._events,s===void 0)return this;if(n=s[t],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete s[t],s.removeListener&&this.emit("removeListener",t,n.listener||r));else if(typeof n!="function"){for(i=-1,u=n.length-1;u>=0;u--)if(n[u]===r||n[u].listener===r){d=n[u].listener,i=u;break}if(i<0)return this;i===0?n.shift():oF(n,i),n.length===1&&(s[t]=n[0]),s.removeListener!==void 0&&this.emit("removeListener",t,d||r)}return this};dt.prototype.off=dt.prototype.removeListener;dt.prototype.removeAllListeners=function(t){var r,n,s;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var i=Object.keys(n),u;for(s=0;s<i.length;++s)u=i[s],u!=="removeListener"&&this.removeAllListeners(u);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[t],typeof r=="function")this.removeListener(t,r);else if(r!==void 0)for(s=r.length-1;s>=0;s--)this.removeListener(t,r[s]);return this};function o9(e,t,r){var n=e._events;if(n===void 0)return[];var s=n[t];return s===void 0?[]:typeof s=="function"?r?[s.listener||s]:[s]:r?sF(s):a9(s,s.length)}dt.prototype.listeners=function(t){return o9(this,t,!0)};dt.prototype.rawListeners=function(t){return o9(this,t,!1)};dt.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):s9.call(e,t)};dt.prototype.listenerCount=s9;function s9(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}dt.prototype.eventNames=function(){return this._eventsCount>0?wc(this._events):[]};function a9(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function oF(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function sF(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function aF(e,t){return new Promise(function(r,n){function s(u){e.removeListener(t,i),n(u)}function i(){typeof e.removeListener=="function"&&e.removeListener("error",s),r([].slice.call(arguments))}f9(e,t,i,{once:!0}),t!=="error"&&fF(e,s,{once:!0})})}function fF(e,t,r){typeof e.on=="function"&&f9(e,"error",t,r)}function f9(e,t,r,n){if(typeof e.on=="function")n.once?e.once(t,r):e.on(t,r);else if(typeof e.addEventListener=="function")e.addEventListener(t,function s(i){n.once&&e.removeEventListener(t,s),r(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var Fa=nw.exports,p1,A6;function l9(){return A6||(A6=1,p1=Fa.EventEmitter),p1}var Ha={},u9={},h9=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var s=42;t[r]=s;for(var i in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var u=Object.getOwnPropertySymbols(t);if(u.length!==1||u[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var d=Object.getOwnPropertyDescriptor(t,r);if(d.value!==s||d.enumerable!==!0)return!1}return!0},lF=h9,xd=function(){return lF()&&!!Symbol.toStringTag},c9=Object,uF=Error,hF=EvalError,cF=RangeError,dF=ReferenceError,d9=SyntaxError,ml=TypeError,pF=URIError,vF=Math.abs,gF=Math.floor,yF=Math.max,mF=Math.min,wF=Math.pow,bF=Math.round,xF=Number.isNaN||function(t){return t!==t},MF=xF,_F=function(t){return MF(t)||t===0?t:t<0?-1:1},EF=Object.getOwnPropertyDescriptor,bc=EF;if(bc)try{bc([],"length")}catch{bc=null}var wl=bc,xc=Object.defineProperty||!1;if(xc)try{xc({},"a",{value:1})}catch{xc=!1}var Md=xc,v1,k6;function SF(){if(k6)return v1;k6=1;var e=typeof Symbol<"u"&&Symbol,t=h9;return v1=function(){return typeof e!="function"||typeof Symbol!="function"||typeof e("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},v1}var p9=typeof Reflect<"u"&&Reflect.getPrototypeOf||null,AF=c9,v9=AF.getPrototypeOf||null,kF="Function.prototype.bind called on incompatible ",BF=Object.prototype.toString,RF=Math.max,$F="[object Function]",B6=function(t,r){for(var n=[],s=0;s<t.length;s+=1)n[s]=t[s];for(var i=0;i<r.length;i+=1)n[i+t.length]=r[i];return n},NF=function(t,r){for(var n=[],s=r,i=0;s<t.length;s+=1,i+=1)n[i]=t[s];return n},TF=function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r},IF=function(t){var r=this;if(typeof r!="function"||BF.apply(r)!==$F)throw new TypeError(kF+r);for(var n=NF(arguments,1),s,i=function(){if(this instanceof s){var w=r.apply(this,B6(n,arguments));return Object(w)===w?w:this}return r.apply(t,B6(n,arguments))},u=RF(0,r.length-n.length),d=[],c=0;c<u;c++)d[c]="$"+c;if(s=Function("binder","return function ("+TF(d,",")+"){ return binder.apply(this,arguments); }")(i),r.prototype){var b=function(){};b.prototype=r.prototype,s.prototype=new b,b.prototype=null}return s},CF=IF,rh=Function.prototype.bind||CF,iw=Function.prototype.call,ow=Function.prototype.apply,PF=typeof Reflect<"u"&&Reflect&&Reflect.apply,LF=rh,OF=ow,UF=iw,jF=PF,g9=jF||LF.call(UF,OF),DF=rh,qF=ml,FF=iw,HF=g9,sw=function(t){if(t.length<1||typeof t[0]!="function")throw new qF("a function is required");return HF(DF,FF,t)},zF=sw,R6=wl,y9;try{y9=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var g1=!!y9&&R6&&R6(Object.prototype,"__proto__"),m9=Object,$6=m9.getPrototypeOf,WF=g1&&typeof g1.get=="function"?zF([g1.get]):typeof $6=="function"?function(t){return $6(t==null?t:m9(t))}:!1,N6=p9,T6=v9,I6=WF,aw=N6?function(t){return N6(t)}:T6?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return T6(t)}:I6?function(t){return I6(t)}:null,y1,C6;function w9(){if(C6)return y1;C6=1;var e=Function.prototype.call,t=Object.prototype.hasOwnProperty,r=rh;return y1=r.call(e,t),y1}var nt,VF=c9,KF=uF,ZF=hF,GF=cF,JF=dF,Gf=d9,Nf=ml,YF=pF,XF=vF,QF=gF,eH=yF,tH=mF,rH=wF,nH=bF,iH=_F,b9=Function,m1=function(e){try{return b9('"use strict"; return ('+e+").constructor;")()}catch{}},Du=wl,oH=Md,w1=function(){throw new Nf},sH=Du?function(){try{return arguments.callee,w1}catch{try{return Du(arguments,"callee").get}catch{return w1}}}():w1,Ga=SF()(),fr=aw,aH=v9,fH=p9,x9=ow,nh=iw,tf={},lH=typeof Uint8Array>"u"||!fr?nt:fr(Uint8Array),ma={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?nt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?nt:ArrayBuffer,"%ArrayIteratorPrototype%":Ga&&fr?fr([][Symbol.iterator]()):nt,"%AsyncFromSyncIteratorPrototype%":nt,"%AsyncFunction%":tf,"%AsyncGenerator%":tf,"%AsyncGeneratorFunction%":tf,"%AsyncIteratorPrototype%":tf,"%Atomics%":typeof Atomics>"u"?nt:Atomics,"%BigInt%":typeof BigInt>"u"?nt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?nt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?nt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?nt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":KF,"%eval%":eval,"%EvalError%":ZF,"%Float16Array%":typeof Float16Array>"u"?nt:Float16Array,"%Float32Array%":typeof Float32Array>"u"?nt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?nt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?nt:FinalizationRegistry,"%Function%":b9,"%GeneratorFunction%":tf,"%Int8Array%":typeof Int8Array>"u"?nt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?nt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?nt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ga&&fr?fr(fr([][Symbol.iterator]())):nt,"%JSON%":typeof JSON=="object"?JSON:nt,"%Map%":typeof Map>"u"?nt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ga||!fr?nt:fr(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":VF,"%Object.getOwnPropertyDescriptor%":Du,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?nt:Promise,"%Proxy%":typeof Proxy>"u"?nt:Proxy,"%RangeError%":GF,"%ReferenceError%":JF,"%Reflect%":typeof Reflect>"u"?nt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?nt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ga||!fr?nt:fr(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?nt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ga&&fr?fr(""[Symbol.iterator]()):nt,"%Symbol%":Ga?Symbol:nt,"%SyntaxError%":Gf,"%ThrowTypeError%":sH,"%TypedArray%":lH,"%TypeError%":Nf,"%Uint8Array%":typeof Uint8Array>"u"?nt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?nt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?nt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?nt:Uint32Array,"%URIError%":YF,"%WeakMap%":typeof WeakMap>"u"?nt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?nt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?nt:WeakSet,"%Function.prototype.call%":nh,"%Function.prototype.apply%":x9,"%Object.defineProperty%":oH,"%Object.getPrototypeOf%":aH,"%Math.abs%":XF,"%Math.floor%":QF,"%Math.max%":eH,"%Math.min%":tH,"%Math.pow%":rH,"%Math.round%":nH,"%Math.sign%":iH,"%Reflect.getPrototypeOf%":fH};if(fr)try{null.error}catch(e){var uH=fr(fr(e));ma["%Error.prototype%"]=uH}var hH=function e(t){var r;if(t==="%AsyncFunction%")r=m1("async function () {}");else if(t==="%GeneratorFunction%")r=m1("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=m1("async function* () {}");else if(t==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=e("%AsyncGenerator%");s&&fr&&(r=fr(s.prototype))}return ma[t]=r,r},P6={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ih=rh,p0=w9(),cH=ih.call(nh,Array.prototype.concat),dH=ih.call(x9,Array.prototype.splice),L6=ih.call(nh,String.prototype.replace),v0=ih.call(nh,String.prototype.slice),pH=ih.call(nh,RegExp.prototype.exec),vH=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,gH=/\\(\\)?/g,yH=function(t){var r=v0(t,0,1),n=v0(t,-1);if(r==="%"&&n!=="%")throw new Gf("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Gf("invalid intrinsic syntax, expected opening `%`");var s=[];return L6(t,vH,function(i,u,d,c){s[s.length]=d?L6(c,gH,"$1"):u||i}),s},mH=function(t,r){var n=t,s;if(p0(P6,n)&&(s=P6[n],n="%"+s[0]+"%"),p0(ma,n)){var i=ma[n];if(i===tf&&(i=hH(n)),typeof i>"u"&&!r)throw new Nf("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:n,value:i}}throw new Gf("intrinsic "+t+" does not exist!")},M9=function(t,r){if(typeof t!="string"||t.length===0)throw new Nf("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Nf('"allowMissing" argument must be a boolean');if(pH(/^%?[^%]*%?$/,t)===null)throw new Gf("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=yH(t),s=n.length>0?n[0]:"",i=mH("%"+s+"%",r),u=i.name,d=i.value,c=!1,b=i.alias;b&&(s=b[0],dH(n,cH([0,1],b)));for(var w=1,M=!0;w<n.length;w+=1){var _=n[w],A=v0(_,0,1),R=v0(_,-1);if((A==='"'||A==="'"||A==="`"||R==='"'||R==="'"||R==="`")&&A!==R)throw new Gf("property names with quotes must have matching quotes");if((_==="constructor"||!M)&&(c=!0),s+="."+_,u="%"+s+"%",p0(ma,u))d=ma[u];else if(d!=null){if(!(_ in d)){if(!r)throw new Nf("base intrinsic for "+t+" exists, but the property is not available.");return}if(Du&&w+1>=n.length){var B=Du(d,_);M=!!B,M&&"get"in B&&!("originalValue"in B.get)?d=B.get:d=d[_]}else M=p0(d,_),d=d[_];M&&!c&&(ma[u]=d)}}return d},_9=M9,E9=sw,wH=E9([_9("%String.prototype.indexOf%")]),bl=function(t,r){var n=_9(t,!!r);return typeof n=="function"&&wH(t,".prototype.")>-1?E9([n]):n},bH=xd(),xH=bl,cy=xH("Object.prototype.toString"),_d=function(t){return bH&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:cy(t)==="[object Arguments]"},S9=function(t){return _d(t)?!0:t!==null&&typeof t=="object"&&"length"in t&&typeof t.length=="number"&&t.length>=0&&cy(t)!=="[object Array]"&&"callee"in t&&cy(t.callee)==="[object Function]"},MH=function(){return _d(arguments)}();_d.isLegacyArguments=S9;var _H=MH?_d:S9,O6=bl,EH=xd(),SH=w9(),AH=wl,dy;if(EH){var kH=O6("RegExp.prototype.exec"),U6={},b1=function(){throw U6},j6={toString:b1,valueOf:b1};typeof Symbol.toPrimitive=="symbol"&&(j6[Symbol.toPrimitive]=b1),dy=function(t){if(!t||typeof t!="object")return!1;var r=AH(t,"lastIndex"),n=r&&SH(r,"value");if(!n)return!1;try{kH(t,j6)}catch(s){return s===U6}}}else{var BH=O6("Object.prototype.toString"),RH="[object RegExp]";dy=function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:BH(t)===RH}}var $H=dy,NH=bl,TH=$H,IH=NH("RegExp.prototype.exec"),CH=ml,PH=function(t){if(!TH(t))throw new CH("`regex` must be a RegExp");return function(n){return IH(t,n)!==null}},x1,D6;function LH(){if(D6)return x1;D6=1;const e=(function*(){}).constructor;return x1=()=>e,x1}var A9=bl,OH=PH,UH=OH(/^\s*(?:function)?\*/),jH=xd(),q6=aw,DH=A9("Object.prototype.toString"),qH=A9("Function.prototype.toString"),FH=LH(),HH=function(t){if(typeof t!="function")return!1;if(UH(qH(t)))return!0;if(!jH){var r=DH(t);return r==="[object GeneratorFunction]"}if(!q6)return!1;var n=FH();return n&&q6(t)===n.prototype},k9=Function.prototype.toString,yf=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,py,Mc;if(typeof yf=="function"&&typeof Object.defineProperty=="function")try{py=Object.defineProperty({},"length",{get:function(){throw Mc}}),Mc={},yf(function(){throw 42},null,py)}catch(e){e!==Mc&&(yf=null)}else yf=null;var zH=/^\s*class\b/,vy=function(t){try{var r=k9.call(t);return zH.test(r)}catch{return!1}},M1=function(t){try{return vy(t)?!1:(k9.call(t),!0)}catch{return!1}},_c=Object.prototype.toString,WH="[object Object]",VH="[object Function]",KH="[object GeneratorFunction]",ZH="[object HTMLAllCollection]",GH="[object HTML document.all class]",JH="[object HTMLCollection]",YH=typeof Symbol=="function"&&!!Symbol.toStringTag,XH=!(0 in[,]),gy=function(){return!1};if(typeof document=="object"){var QH=document.all;_c.call(QH)===_c.call(document.all)&&(gy=function(t){if((XH||!t)&&(typeof t>"u"||typeof t=="object"))try{var r=_c.call(t);return(r===ZH||r===GH||r===JH||r===WH)&&t("")==null}catch{}return!1})}var ez=yf?function(t){if(gy(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{yf(t,null,py)}catch(r){if(r!==Mc)return!1}return!vy(t)&&M1(t)}:function(t){if(gy(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(YH)return M1(t);if(vy(t))return!1;var r=_c.call(t);return r!==VH&&r!==KH&&!/^\[object HTML/.test(r)?!1:M1(t)},tz=ez,rz=Object.prototype.toString,B9=Object.prototype.hasOwnProperty,nz=function(t,r,n){for(var s=0,i=t.length;s<i;s++)B9.call(t,s)&&(n==null?r(t[s],s,t):r.call(n,t[s],s,t))},iz=function(t,r,n){for(var s=0,i=t.length;s<i;s++)n==null?r(t.charAt(s),s,t):r.call(n,t.charAt(s),s,t)},oz=function(t,r,n){for(var s in t)B9.call(t,s)&&(n==null?r(t[s],s,t):r.call(n,t[s],s,t))};function sz(e){return rz.call(e)==="[object Array]"}var az=function(t,r,n){if(!tz(r))throw new TypeError("iterator must be a function");var s;arguments.length>=3&&(s=n),sz(t)?nz(t,r,s):typeof t=="string"?iz(t,r,s):oz(t,r,s)},fz=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],_1=fz,lz=typeof globalThis>"u"?Ve:globalThis,uz=function(){for(var t=[],r=0;r<_1.length;r++)typeof lz[_1[r]]=="function"&&(t[t.length]=_1[r]);return t},R9={exports:{}},F6=Md,hz=d9,Ja=ml,H6=wl,cz=function(t,r,n){if(!t||typeof t!="object"&&typeof t!="function")throw new Ja("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Ja("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ja("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ja("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ja("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ja("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,i=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,d=arguments.length>6?arguments[6]:!1,c=!!H6&&H6(t,r);if(F6)F6(t,r,{configurable:u===null&&c?c.configurable:!u,enumerable:s===null&&c?c.enumerable:!s,value:n,writable:i===null&&c?c.writable:!i});else if(d||!s&&!i&&!u)t[r]=n;else throw new hz("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},yy=Md,$9=function(){return!!yy};$9.hasArrayLengthDefineBug=function(){if(!yy)return null;try{return yy([],"length",{value:1}).length!==1}catch{return!0}};var dz=$9,pz=M9,z6=cz,vz=dz(),W6=wl,V6=ml,gz=pz("%Math.floor%"),yz=function(t,r){if(typeof t!="function")throw new V6("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||gz(r)!==r)throw new V6("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],s=!0,i=!0;if("length"in t&&W6){var u=W6(t,"length");u&&!u.configurable&&(s=!1),u&&!u.writable&&(i=!1)}return(s||i||!n)&&(vz?z6(t,"length",r,!0,!0):z6(t,"length",r)),t},mz=rh,wz=ow,bz=g9,xz=function(){return bz(mz,wz,arguments)};(function(e){var t=yz,r=Md,n=sw,s=xz;e.exports=function(u){var d=n(arguments),c=u.length-(arguments.length-1);return t(d,1+(c>0?c:0),!0)},r?r(e.exports,"apply",{value:s}):e.exports.apply=s})(R9);var Mz=R9.exports,g0=az,_z=uz,K6=Mz,fw=bl,Ec=wl,qh=aw,Ez=fw("Object.prototype.toString"),N9=xd(),Z6=typeof globalThis>"u"?Ve:globalThis,my=_z(),lw=fw("String.prototype.slice"),Sz=fw("Array.prototype.indexOf",!0)||function(t,r){for(var n=0;n<t.length;n+=1)if(t[n]===r)return n;return-1},y0={__proto__:null};N9&&Ec&&qh?g0(my,function(e){var t=new Z6[e];if(Symbol.toStringTag in t&&qh){var r=qh(t),n=Ec(r,Symbol.toStringTag);if(!n&&r){var s=qh(r);n=Ec(s,Symbol.toStringTag)}y0["$"+e]=K6(n.get)}}):g0(my,function(e){var t=new Z6[e],r=t.slice||t.set;r&&(y0["$"+e]=K6(r))});var Az=function(t){var r=!1;return g0(y0,function(n,s){if(!r)try{"$"+n(t)===s&&(r=lw(s,1))}catch{}}),r},kz=function(t){var r=!1;return g0(y0,function(n,s){if(!r)try{n(t),r=lw(s,1)}catch{}}),r},T9=function(t){if(!t||typeof t!="object")return!1;if(!N9){var r=lw(Ez(t),8,-1);return Sz(my,r)>-1?r:r!=="Object"?!1:kz(t)}return Ec?Az(t):null},E1,G6;function I9(){if(G6)return E1;G6=1;var e=T9;return E1=function(r){return!!e(r)},E1}(function(e){var t=_H,r=HH,n=T9,s=I9();function i(ne){return ne.call.bind(ne)}var u=typeof BigInt<"u",d=typeof Symbol<"u",c=i(Object.prototype.toString),b=i(Number.prototype.valueOf),w=i(String.prototype.valueOf),M=i(Boolean.prototype.valueOf);if(u)var _=i(BigInt.prototype.valueOf);if(d)var A=i(Symbol.prototype.valueOf);function R(ne,je){if(typeof ne!="object")return!1;try{return je(ne),!0}catch{return!1}}e.isArgumentsObject=t,e.isGeneratorFunction=r,e.isTypedArray=s;function B(ne){return typeof Promise<"u"&&ne instanceof Promise||ne!==null&&typeof ne=="object"&&typeof ne.then=="function"&&typeof ne.catch=="function"}e.isPromise=B;function I(ne){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(ne):s(ne)||N(ne)}e.isArrayBufferView=I;function E(ne){return n(ne)==="Uint8Array"}e.isUint8Array=E;function k(ne){return n(ne)==="Uint8ClampedArray"}e.isUint8ClampedArray=k;function T(ne){return n(ne)==="Uint16Array"}e.isUint16Array=T;function L(ne){return n(ne)==="Uint32Array"}e.isUint32Array=L;function q(ne){return n(ne)==="Int8Array"}e.isInt8Array=q;function z(ne){return n(ne)==="Int16Array"}e.isInt16Array=z;function J(ne){return n(ne)==="Int32Array"}e.isInt32Array=J;function F(ne){return n(ne)==="Float32Array"}e.isFloat32Array=F;function X(ne){return n(ne)==="Float64Array"}e.isFloat64Array=X;function ee(ne){return n(ne)==="BigInt64Array"}e.isBigInt64Array=ee;function x(ne){return n(ne)==="BigUint64Array"}e.isBigUint64Array=x;function o(ne){return c(ne)==="[object Map]"}o.working=typeof Map<"u"&&o(new Map);function f(ne){return typeof Map>"u"?!1:o.working?o(ne):ne instanceof Map}e.isMap=f;function l(ne){return c(ne)==="[object Set]"}l.working=typeof Set<"u"&&l(new Set);function h(ne){return typeof Set>"u"?!1:l.working?l(ne):ne instanceof Set}e.isSet=h;function v(ne){return c(ne)==="[object WeakMap]"}v.working=typeof WeakMap<"u"&&v(new WeakMap);function y(ne){return typeof WeakMap>"u"?!1:v.working?v(ne):ne instanceof WeakMap}e.isWeakMap=y;function m(ne){return c(ne)==="[object WeakSet]"}m.working=typeof WeakSet<"u"&&m(new WeakSet);function p(ne){return m(ne)}e.isWeakSet=p;function a(ne){return c(ne)==="[object ArrayBuffer]"}a.working=typeof ArrayBuffer<"u"&&a(new ArrayBuffer);function g(ne){return typeof ArrayBuffer>"u"?!1:a.working?a(ne):ne instanceof ArrayBuffer}e.isArrayBuffer=g;function S(ne){return c(ne)==="[object DataView]"}S.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&S(new DataView(new ArrayBuffer(1),0,1));function N(ne){return typeof DataView>"u"?!1:S.working?S(ne):ne instanceof DataView}e.isDataView=N;var U=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function Z(ne){return c(ne)==="[object SharedArrayBuffer]"}function H(ne){return typeof U>"u"?!1:(typeof Z.working>"u"&&(Z.working=Z(new U)),Z.working?Z(ne):ne instanceof U)}e.isSharedArrayBuffer=H;function $(ne){return c(ne)==="[object AsyncFunction]"}e.isAsyncFunction=$;function P(ne){return c(ne)==="[object Map Iterator]"}e.isMapIterator=P;function W(ne){return c(ne)==="[object Set Iterator]"}e.isSetIterator=W;function G(ne){return c(ne)==="[object Generator]"}e.isGeneratorObject=G;function K(ne){return c(ne)==="[object WebAssembly.Module]"}e.isWebAssemblyCompiledModule=K;function O(ne){return R(ne,b)}e.isNumberObject=O;function Q(ne){return R(ne,w)}e.isStringObject=Q;function de(ne){return R(ne,M)}e.isBooleanObject=de;function oe(ne){return u&&R(ne,_)}e.isBigIntObject=oe;function se(ne){return d&&R(ne,A)}e.isSymbolObject=se;function Ie(ne){return O(ne)||Q(ne)||de(ne)||oe(ne)||se(ne)}e.isBoxedPrimitive=Ie;function fe(ne){return typeof Uint8Array<"u"&&(g(ne)||H(ne))}e.isAnyArrayBuffer=fe,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(ne){Object.defineProperty(e,ne,{enumerable:!1,value:function(){throw new Error(ne+" is not supported in userland")}})})})(u9);var Bz=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"};(function(e){var t={},r=Object.getOwnPropertyDescriptors||function(U){for(var Z=Object.keys(U),H={},$=0;$<Z.length;$++)H[Z[$]]=Object.getOwnPropertyDescriptor(U,Z[$]);return H},n=/%[sdj%]/g;e.format=function(N){if(!z(N)){for(var U=[],Z=0;Z<arguments.length;Z++)U.push(d(arguments[Z]));return U.join(" ")}for(var Z=1,H=arguments,$=H.length,P=String(N).replace(n,function(G){if(G==="%%")return"%";if(Z>=$)return G;switch(G){case"%s":return String(H[Z++]);case"%d":return Number(H[Z++]);case"%j":try{return JSON.stringify(H[Z++])}catch{return"[Circular]"}default:return G}}),W=H[Z];Z<$;W=H[++Z])T(W)||!ee(W)?P+=" "+W:P+=" "+d(W);return P},e.deprecate=function(N,U){if(typeof qe<"u"&&qe.noDeprecation===!0)return N;if(typeof qe>"u")return function(){return e.deprecate(N,U).apply(this,arguments)};var Z=!1;function H(){if(!Z){if(qe.throwDeprecation)throw new Error(U);qe.traceDeprecation?console.trace(U):console.error(U),Z=!0}return N.apply(this,arguments)}return H};var s={},i=/^$/;if(t.NODE_DEBUG){var u=t.NODE_DEBUG;u=u.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),i=new RegExp("^"+u+"$","i")}e.debuglog=function(N){if(N=N.toUpperCase(),!s[N])if(i.test(N)){var U=qe.pid;s[N]=function(){var Z=e.format.apply(e,arguments);console.error("%s %d: %s",N,U,Z)}}else s[N]=function(){};return s[N]};function d(N,U){var Z={seen:[],stylize:b};return arguments.length>=3&&(Z.depth=arguments[2]),arguments.length>=4&&(Z.colors=arguments[3]),k(U)?Z.showHidden=U:U&&e._extend(Z,U),F(Z.showHidden)&&(Z.showHidden=!1),F(Z.depth)&&(Z.depth=2),F(Z.colors)&&(Z.colors=!1),F(Z.customInspect)&&(Z.customInspect=!0),Z.colors&&(Z.stylize=c),M(Z,N,Z.depth)}e.inspect=d,d.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},d.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function c(N,U){var Z=d.styles[U];return Z?"\x1B["+d.colors[Z][0]+"m"+N+"\x1B["+d.colors[Z][1]+"m":N}function b(N,U){return N}function w(N){var U={};return N.forEach(function(Z,H){U[Z]=!0}),U}function M(N,U,Z){if(N.customInspect&&U&&f(U.inspect)&&U.inspect!==e.inspect&&!(U.constructor&&U.constructor.prototype===U)){var H=U.inspect(Z,N);return z(H)||(H=M(N,H,Z)),H}var $=_(N,U);if($)return $;var P=Object.keys(U),W=w(P);if(N.showHidden&&(P=Object.getOwnPropertyNames(U)),o(U)&&(P.indexOf("message")>=0||P.indexOf("description")>=0))return A(U);if(P.length===0){if(f(U)){var G=U.name?": "+U.name:"";return N.stylize("[Function"+G+"]","special")}if(X(U))return N.stylize(RegExp.prototype.toString.call(U),"regexp");if(x(U))return N.stylize(Date.prototype.toString.call(U),"date");if(o(U))return A(U)}var K="",O=!1,Q=["{","}"];if(E(U)&&(O=!0,Q=["[","]"]),f(U)){var de=U.name?": "+U.name:"";K=" [Function"+de+"]"}if(X(U)&&(K=" "+RegExp.prototype.toString.call(U)),x(U)&&(K=" "+Date.prototype.toUTCString.call(U)),o(U)&&(K=" "+A(U)),P.length===0&&(!O||U.length==0))return Q[0]+K+Q[1];if(Z<0)return X(U)?N.stylize(RegExp.prototype.toString.call(U),"regexp"):N.stylize("[Object]","special");N.seen.push(U);var oe;return O?oe=R(N,U,Z,W,P):oe=P.map(function(se){return B(N,U,Z,W,se,O)}),N.seen.pop(),I(oe,K,Q)}function _(N,U){if(F(U))return N.stylize("undefined","undefined");if(z(U)){var Z="'"+JSON.stringify(U).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return N.stylize(Z,"string")}if(q(U))return N.stylize(""+U,"number");if(k(U))return N.stylize(""+U,"boolean");if(T(U))return N.stylize("null","null")}function A(N){return"["+Error.prototype.toString.call(N)+"]"}function R(N,U,Z,H,$){for(var P=[],W=0,G=U.length;W<G;++W)p(U,String(W))?P.push(B(N,U,Z,H,String(W),!0)):P.push("");return $.forEach(function(K){K.match(/^\d+$/)||P.push(B(N,U,Z,H,K,!0))}),P}function B(N,U,Z,H,$,P){var W,G,K;if(K=Object.getOwnPropertyDescriptor(U,$)||{value:U[$]},K.get?K.set?G=N.stylize("[Getter/Setter]","special"):G=N.stylize("[Getter]","special"):K.set&&(G=N.stylize("[Setter]","special")),p(H,$)||(W="["+$+"]"),G||(N.seen.indexOf(K.value)<0?(T(Z)?G=M(N,K.value,null):G=M(N,K.value,Z-1),G.indexOf(`
47
- `)>-1&&(P?G=G.split(`
48
- `).map(function(O){return" "+O}).join(`
49
- `).slice(2):G=`
50
- `+G.split(`
51
- `).map(function(O){return" "+O}).join(`
52
- `))):G=N.stylize("[Circular]","special")),F(W)){if(P&&$.match(/^\d+$/))return G;W=JSON.stringify(""+$),W.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(W=W.slice(1,-1),W=N.stylize(W,"name")):(W=W.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),W=N.stylize(W,"string"))}return W+": "+G}function I(N,U,Z){var H=N.reduce(function($,P){return P.indexOf(`
53
- `)>=0,$+P.replace(/\u001b\[\d\d?m/g,"").length+1},0);return H>60?Z[0]+(U===""?"":U+`
54
- `)+" "+N.join(`,
55
- `)+" "+Z[1]:Z[0]+U+" "+N.join(", ")+" "+Z[1]}e.types=u9;function E(N){return Array.isArray(N)}e.isArray=E;function k(N){return typeof N=="boolean"}e.isBoolean=k;function T(N){return N===null}e.isNull=T;function L(N){return N==null}e.isNullOrUndefined=L;function q(N){return typeof N=="number"}e.isNumber=q;function z(N){return typeof N=="string"}e.isString=z;function J(N){return typeof N=="symbol"}e.isSymbol=J;function F(N){return N===void 0}e.isUndefined=F;function X(N){return ee(N)&&h(N)==="[object RegExp]"}e.isRegExp=X,e.types.isRegExp=X;function ee(N){return typeof N=="object"&&N!==null}e.isObject=ee;function x(N){return ee(N)&&h(N)==="[object Date]"}e.isDate=x,e.types.isDate=x;function o(N){return ee(N)&&(h(N)==="[object Error]"||N instanceof Error)}e.isError=o,e.types.isNativeError=o;function f(N){return typeof N=="function"}e.isFunction=f;function l(N){return N===null||typeof N=="boolean"||typeof N=="number"||typeof N=="string"||typeof N=="symbol"||typeof N>"u"}e.isPrimitive=l,e.isBuffer=Bz;function h(N){return Object.prototype.toString.call(N)}function v(N){return N<10?"0"+N.toString(10):N.toString(10)}var y=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function m(){var N=new Date,U=[v(N.getHours()),v(N.getMinutes()),v(N.getSeconds())].join(":");return[N.getDate(),y[N.getMonth()],U].join(" ")}e.log=function(){console.log("%s - %s",m(),e.format.apply(e,arguments))},e.inherits=Fe,e._extend=function(N,U){if(!U||!ee(U))return N;for(var Z=Object.keys(U),H=Z.length;H--;)N[Z[H]]=U[Z[H]];return N};function p(N,U){return Object.prototype.hasOwnProperty.call(N,U)}var a=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;e.promisify=function(U){if(typeof U!="function")throw new TypeError('The "original" argument must be of type Function');if(a&&U[a]){var Z=U[a];if(typeof Z!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(Z,a,{value:Z,enumerable:!1,writable:!1,configurable:!0}),Z}function Z(){for(var H,$,P=new Promise(function(K,O){H=K,$=O}),W=[],G=0;G<arguments.length;G++)W.push(arguments[G]);W.push(function(K,O){K?$(K):H(O)});try{U.apply(this,W)}catch(K){$(K)}return P}return Object.setPrototypeOf(Z,Object.getPrototypeOf(U)),a&&Object.defineProperty(Z,a,{value:Z,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(Z,r(U))},e.promisify.custom=a;function g(N,U){if(!N){var Z=new Error("Promise was rejected with a falsy value");Z.reason=N,N=Z}return U(N)}function S(N){if(typeof N!="function")throw new TypeError('The "original" argument must be of type Function');function U(){for(var Z=[],H=0;H<arguments.length;H++)Z.push(arguments[H]);var $=Z.pop();if(typeof $!="function")throw new TypeError("The last argument must be of type Function");var P=this,W=function(){return $.apply(P,arguments)};N.apply(this,Z).then(function(G){qe.nextTick(W.bind(null,null,G))},function(G){qe.nextTick(g.bind(null,G,W))})}return Object.setPrototypeOf(U,Object.getPrototypeOf(N)),Object.defineProperties(U,r(N)),U}e.callbackify=S})(Ha);var S1,J6;function Rz(){if(J6)return S1;J6=1;function e(R,B){var I=Object.keys(R);if(Object.getOwnPropertySymbols){var E=Object.getOwnPropertySymbols(R);B&&(E=E.filter(function(k){return Object.getOwnPropertyDescriptor(R,k).enumerable})),I.push.apply(I,E)}return I}function t(R){for(var B=1;B<arguments.length;B++){var I=arguments[B]!=null?arguments[B]:{};B%2?e(Object(I),!0).forEach(function(E){r(R,E,I[E])}):Object.getOwnPropertyDescriptors?Object.defineProperties(R,Object.getOwnPropertyDescriptors(I)):e(Object(I)).forEach(function(E){Object.defineProperty(R,E,Object.getOwnPropertyDescriptor(I,E))})}return R}function r(R,B,I){return B=u(B),B in R?Object.defineProperty(R,B,{value:I,enumerable:!0,configurable:!0,writable:!0}):R[B]=I,R}function n(R,B){if(!(R instanceof B))throw new TypeError("Cannot call a class as a function")}function s(R,B){for(var I=0;I<B.length;I++){var E=B[I];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(R,u(E.key),E)}}function i(R,B,I){return B&&s(R.prototype,B),Object.defineProperty(R,"prototype",{writable:!1}),R}function u(R){var B=d(R,"string");return typeof B=="symbol"?B:String(B)}function d(R,B){if(typeof R!="object"||R===null)return R;var I=R[Symbol.toPrimitive];if(I!==void 0){var E=I.call(R,B);if(typeof E!="object")return E;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(R)}var c=Kt,b=c.Buffer,w=Ha,M=w.inspect,_=M&&M.custom||"inspect";function A(R,B,I){b.prototype.copy.call(R,B,I)}return S1=function(){function R(){n(this,R),this.head=null,this.tail=null,this.length=0}return i(R,[{key:"push",value:function(I){var E={data:I,next:null};this.length>0?this.tail.next=E:this.head=E,this.tail=E,++this.length}},{key:"unshift",value:function(I){var E={data:I,next:this.head};this.length===0&&(this.tail=E),this.head=E,++this.length}},{key:"shift",value:function(){if(this.length!==0){var I=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,I}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(I){if(this.length===0)return"";for(var E=this.head,k=""+E.data;E=E.next;)k+=I+E.data;return k}},{key:"concat",value:function(I){if(this.length===0)return b.alloc(0);for(var E=b.allocUnsafe(I>>>0),k=this.head,T=0;k;)A(k.data,E,T),T+=k.data.length,k=k.next;return E}},{key:"consume",value:function(I,E){var k;return I<this.head.data.length?(k=this.head.data.slice(0,I),this.head.data=this.head.data.slice(I)):I===this.head.data.length?k=this.shift():k=E?this._getString(I):this._getBuffer(I),k}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(I){var E=this.head,k=1,T=E.data;for(I-=T.length;E=E.next;){var L=E.data,q=I>L.length?L.length:I;if(q===L.length?T+=L:T+=L.slice(0,I),I-=q,I===0){q===L.length?(++k,E.next?this.head=E.next:this.head=this.tail=null):(this.head=E,E.data=L.slice(q));break}++k}return this.length-=k,T}},{key:"_getBuffer",value:function(I){var E=b.allocUnsafe(I),k=this.head,T=1;for(k.data.copy(E),I-=k.data.length;k=k.next;){var L=k.data,q=I>L.length?L.length:I;if(L.copy(E,E.length-I,0,q),I-=q,I===0){q===L.length?(++T,k.next?this.head=k.next:this.head=this.tail=null):(this.head=k,k.data=L.slice(q));break}++T}return this.length-=T,E}},{key:_,value:function(I,E){return M(this,t(t({},E),{},{depth:0,customInspect:!1}))}}]),R}(),S1}var A1,Y6;function C9(){if(Y6)return A1;Y6=1;function e(u,d){var c=this,b=this._readableState&&this._readableState.destroyed,w=this._writableState&&this._writableState.destroyed;return b||w?(d?d(u):u&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,qe.nextTick(s,this,u)):qe.nextTick(s,this,u)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(u||null,function(M){!d&&M?c._writableState?c._writableState.errorEmitted?qe.nextTick(r,c):(c._writableState.errorEmitted=!0,qe.nextTick(t,c,M)):qe.nextTick(t,c,M):d?(qe.nextTick(r,c),d(M)):qe.nextTick(r,c)}),this)}function t(u,d){s(u,d),r(u)}function r(u){u._writableState&&!u._writableState.emitClose||u._readableState&&!u._readableState.emitClose||u.emit("close")}function n(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function s(u,d){u.emit("error",d)}function i(u,d){var c=u._readableState,b=u._writableState;c&&c.autoDestroy||b&&b.autoDestroy?u.destroy(d):u.emit("error",d)}return A1={destroy:e,undestroy:n,errorOrDestroy:i},A1}var k1={},X6;function xl(){if(X6)return k1;X6=1;function e(d,c){d.prototype=Object.create(c.prototype),d.prototype.constructor=d,d.__proto__=c}var t={};function r(d,c,b){b||(b=Error);function w(_,A,R){return typeof c=="string"?c:c(_,A,R)}var M=function(_){e(A,_);function A(R,B,I){return _.call(this,w(R,B,I))||this}return A}(b);M.prototype.name=b.name,M.prototype.code=d,t[d]=M}function n(d,c){if(Array.isArray(d)){var b=d.length;return d=d.map(function(w){return String(w)}),b>2?"one of ".concat(c," ").concat(d.slice(0,b-1).join(", "),", or ")+d[b-1]:b===2?"one of ".concat(c," ").concat(d[0]," or ").concat(d[1]):"of ".concat(c," ").concat(d[0])}else return"of ".concat(c," ").concat(String(d))}function s(d,c,b){return d.substr(0,c.length)===c}function i(d,c,b){return(b===void 0||b>d.length)&&(b=d.length),d.substring(b-c.length,b)===c}function u(d,c,b){return typeof b!="number"&&(b=0),b+c.length>d.length?!1:d.indexOf(c,b)!==-1}return r("ERR_INVALID_OPT_VALUE",function(d,c){return'The value "'+c+'" is invalid for option "'+d+'"'},TypeError),r("ERR_INVALID_ARG_TYPE",function(d,c,b){var w;typeof c=="string"&&s(c,"not ")?(w="must not be",c=c.replace(/^not /,"")):w="must be";var M;if(i(d," argument"))M="The ".concat(d," ").concat(w," ").concat(n(c,"type"));else{var _=u(d,".")?"property":"argument";M='The "'.concat(d,'" ').concat(_," ").concat(w," ").concat(n(c,"type"))}return M+=". Received type ".concat(typeof b),M},TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",function(d){return"The "+d+" method is not implemented"}),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",function(d){return"Cannot call "+d+" after a stream was destroyed"}),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",function(d){return"Unknown encoding: "+d},TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),k1.codes=t,k1}var B1,Q6;function P9(){if(Q6)return B1;Q6=1;var e=xl().codes.ERR_INVALID_OPT_VALUE;function t(n,s,i){return n.highWaterMark!=null?n.highWaterMark:s?n[i]:null}function r(n,s,i,u){var d=t(s,u,i);if(d!=null){if(!(isFinite(d)&&Math.floor(d)===d)||d<0){var c=u?i:"highWaterMark";throw new e(c,d)}return Math.floor(d)}return n.objectMode?16:16*1024}return B1={getHighWaterMark:r},B1}var uw=$z;function $z(e,t){if(R1("noDeprecation"))return e;var r=!1;function n(){if(!r){if(R1("throwDeprecation"))throw new Error(t);R1("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return n}function R1(e){try{if(!Ve.localStorage)return!1}catch{return!1}var t=Ve.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var $1,e4;function L9(){if(e4)return $1;e4=1,$1=F;function e(H){var $=this;this.next=null,this.entry=null,this.finish=function(){Z($,H)}}var t;F.WritableState=z;var r={deprecate:uw},n=l9(),s=Kt.Buffer,i=(typeof Ve<"u"?Ve:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function u(H){return s.from(H)}function d(H){return s.isBuffer(H)||H instanceof i}var c=C9(),b=P9(),w=b.getHighWaterMark,M=xl().codes,_=M.ERR_INVALID_ARG_TYPE,A=M.ERR_METHOD_NOT_IMPLEMENTED,R=M.ERR_MULTIPLE_CALLBACK,B=M.ERR_STREAM_CANNOT_PIPE,I=M.ERR_STREAM_DESTROYED,E=M.ERR_STREAM_NULL_VALUES,k=M.ERR_STREAM_WRITE_AFTER_END,T=M.ERR_UNKNOWN_ENCODING,L=c.errorOrDestroy;Fe(F,n);function q(){}function z(H,$,P){t=t||Jf(),H=H||{},typeof P!="boolean"&&(P=$ instanceof t),this.objectMode=!!H.objectMode,P&&(this.objectMode=this.objectMode||!!H.writableObjectMode),this.highWaterMark=w(this,H,"writableHighWaterMark",P),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var W=H.decodeStrings===!1;this.decodeStrings=!W,this.defaultEncoding=H.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(G){v($,G)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=H.emitClose!==!1,this.autoDestroy=!!H.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}z.prototype.getBuffer=function(){for(var $=this.bufferedRequest,P=[];$;)P.push($),$=$.next;return P},function(){try{Object.defineProperty(z.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var J;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(J=Function.prototype[Symbol.hasInstance],Object.defineProperty(F,Symbol.hasInstance,{value:function($){return J.call(this,$)?!0:this!==F?!1:$&&$._writableState instanceof z}})):J=function($){return $ instanceof this};function F(H){t=t||Jf();var $=this instanceof t;if(!$&&!J.call(F,this))return new F(H);this._writableState=new z(H,this,$),this.writable=!0,H&&(typeof H.write=="function"&&(this._write=H.write),typeof H.writev=="function"&&(this._writev=H.writev),typeof H.destroy=="function"&&(this._destroy=H.destroy),typeof H.final=="function"&&(this._final=H.final)),n.call(this)}F.prototype.pipe=function(){L(this,new B)};function X(H,$){var P=new k;L(H,P),qe.nextTick($,P)}function ee(H,$,P,W){var G;return P===null?G=new E:typeof P!="string"&&!$.objectMode&&(G=new _("chunk",["string","Buffer"],P)),G?(L(H,G),qe.nextTick(W,G),!1):!0}F.prototype.write=function(H,$,P){var W=this._writableState,G=!1,K=!W.objectMode&&d(H);return K&&!s.isBuffer(H)&&(H=u(H)),typeof $=="function"&&(P=$,$=null),K?$="buffer":$||($=W.defaultEncoding),typeof P!="function"&&(P=q),W.ending?X(this,P):(K||ee(this,W,H,P))&&(W.pendingcb++,G=o(this,W,K,H,$,P)),G},F.prototype.cork=function(){this._writableState.corked++},F.prototype.uncork=function(){var H=this._writableState;H.corked&&(H.corked--,!H.writing&&!H.corked&&!H.bufferProcessing&&H.bufferedRequest&&p(this,H))},F.prototype.setDefaultEncoding=function($){if(typeof $=="string"&&($=$.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf(($+"").toLowerCase())>-1))throw new T($);return this._writableState.defaultEncoding=$,this},Object.defineProperty(F.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function x(H,$,P){return!H.objectMode&&H.decodeStrings!==!1&&typeof $=="string"&&($=s.from($,P)),$}Object.defineProperty(F.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function o(H,$,P,W,G,K){if(!P){var O=x($,W,G);W!==O&&(P=!0,G="buffer",W=O)}var Q=$.objectMode?1:W.length;$.length+=Q;var de=$.length<$.highWaterMark;if(de||($.needDrain=!0),$.writing||$.corked){var oe=$.lastBufferedRequest;$.lastBufferedRequest={chunk:W,encoding:G,isBuf:P,callback:K,next:null},oe?oe.next=$.lastBufferedRequest:$.bufferedRequest=$.lastBufferedRequest,$.bufferedRequestCount+=1}else f(H,$,!1,Q,W,G,K);return de}function f(H,$,P,W,G,K,O){$.writelen=W,$.writecb=O,$.writing=!0,$.sync=!0,$.destroyed?$.onwrite(new I("write")):P?H._writev(G,$.onwrite):H._write(G,K,$.onwrite),$.sync=!1}function l(H,$,P,W,G){--$.pendingcb,P?(qe.nextTick(G,W),qe.nextTick(N,H,$),H._writableState.errorEmitted=!0,L(H,W)):(G(W),H._writableState.errorEmitted=!0,L(H,W),N(H,$))}function h(H){H.writing=!1,H.writecb=null,H.length-=H.writelen,H.writelen=0}function v(H,$){var P=H._writableState,W=P.sync,G=P.writecb;if(typeof G!="function")throw new R;if(h(P),$)l(H,P,W,$,G);else{var K=a(P)||H.destroyed;!K&&!P.corked&&!P.bufferProcessing&&P.bufferedRequest&&p(H,P),W?qe.nextTick(y,H,P,K,G):y(H,P,K,G)}}function y(H,$,P,W){P||m(H,$),$.pendingcb--,W(),N(H,$)}function m(H,$){$.length===0&&$.needDrain&&($.needDrain=!1,H.emit("drain"))}function p(H,$){$.bufferProcessing=!0;var P=$.bufferedRequest;if(H._writev&&P&&P.next){var W=$.bufferedRequestCount,G=new Array(W),K=$.corkedRequestsFree;K.entry=P;for(var O=0,Q=!0;P;)G[O]=P,P.isBuf||(Q=!1),P=P.next,O+=1;G.allBuffers=Q,f(H,$,!0,$.length,G,"",K.finish),$.pendingcb++,$.lastBufferedRequest=null,K.next?($.corkedRequestsFree=K.next,K.next=null):$.corkedRequestsFree=new e($),$.bufferedRequestCount=0}else{for(;P;){var de=P.chunk,oe=P.encoding,se=P.callback,Ie=$.objectMode?1:de.length;if(f(H,$,!1,Ie,de,oe,se),P=P.next,$.bufferedRequestCount--,$.writing)break}P===null&&($.lastBufferedRequest=null)}$.bufferedRequest=P,$.bufferProcessing=!1}F.prototype._write=function(H,$,P){P(new A("_write()"))},F.prototype._writev=null,F.prototype.end=function(H,$,P){var W=this._writableState;return typeof H=="function"?(P=H,H=null,$=null):typeof $=="function"&&(P=$,$=null),H!=null&&this.write(H,$),W.corked&&(W.corked=1,this.uncork()),W.ending||U(this,W,P),this},Object.defineProperty(F.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function a(H){return H.ending&&H.length===0&&H.bufferedRequest===null&&!H.finished&&!H.writing}function g(H,$){H._final(function(P){$.pendingcb--,P&&L(H,P),$.prefinished=!0,H.emit("prefinish"),N(H,$)})}function S(H,$){!$.prefinished&&!$.finalCalled&&(typeof H._final=="function"&&!$.destroyed?($.pendingcb++,$.finalCalled=!0,qe.nextTick(g,H,$)):($.prefinished=!0,H.emit("prefinish")))}function N(H,$){var P=a($);if(P&&(S(H,$),$.pendingcb===0&&($.finished=!0,H.emit("finish"),$.autoDestroy))){var W=H._readableState;(!W||W.autoDestroy&&W.endEmitted)&&H.destroy()}return P}function U(H,$,P){$.ending=!0,N(H,$),P&&($.finished?qe.nextTick(P):H.once("finish",P)),$.ended=!0,H.writable=!1}function Z(H,$,P){var W=H.entry;for(H.entry=null;W;){var G=W.callback;$.pendingcb--,G(P),W=W.next}$.corkedRequestsFree.next=H}return Object.defineProperty(F.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function($){this._writableState&&(this._writableState.destroyed=$)}}),F.prototype.destroy=c.destroy,F.prototype._undestroy=c.undestroy,F.prototype._destroy=function(H,$){$(H)},$1}var N1,t4;function Jf(){if(t4)return N1;t4=1;var e=Object.keys||function(b){var w=[];for(var M in b)w.push(M);return w};N1=u;var t=O9(),r=L9();Fe(u,t);for(var n=e(r.prototype),s=0;s<n.length;s++){var i=n[s];u.prototype[i]||(u.prototype[i]=r.prototype[i])}function u(b){if(!(this instanceof u))return new u(b);t.call(this,b),r.call(this,b),this.allowHalfOpen=!0,b&&(b.readable===!1&&(this.readable=!1),b.writable===!1&&(this.writable=!1),b.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",d)))}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(u.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function d(){this._writableState.ended||qe.nextTick(c,this)}function c(b){b.end()}return Object.defineProperty(u.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(w){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=w,this._writableState.destroyed=w)}}),N1}var m0={},hw=Ye.Buffer,r4=hw.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Nz(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function Tz(e){var t=Nz(e);if(typeof t!="string"&&(hw.isEncoding===r4||!r4(e)))throw new Error("Unknown encoding: "+e);return t||e}m0.StringDecoder=oh;function oh(e){this.encoding=Tz(e);var t;switch(this.encoding){case"utf16le":this.text=Uz,this.end=jz,t=4;break;case"utf8":this.fillLast=Pz,t=4;break;case"base64":this.text=Dz,this.end=qz,t=3;break;default:this.write=Fz,this.end=Hz;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=hw.allocUnsafe(t)}oh.prototype.write=function(e){if(e.length===0)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""};oh.prototype.end=Oz;oh.prototype.text=Lz;oh.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function T1(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function Iz(e,t,r){var n=t.length-1;if(n<r)return 0;var s=T1(t[n]);return s>=0?(s>0&&(e.lastNeed=s-1),s):--n<r||s===-2?0:(s=T1(t[n]),s>=0?(s>0&&(e.lastNeed=s-2),s):--n<r||s===-2?0:(s=T1(t[n]),s>=0?(s>0&&(s===2?s=0:e.lastNeed=s-3),s):0))}function Cz(e,t,r){if((t[0]&192)!==128)return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"�"}}function Pz(e){var t=this.lastTotal-this.lastNeed,r=Cz(this,e);if(r!==void 0)return r;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function Lz(e,t){var r=Iz(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}function Oz(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function Uz(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function jz(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function Dz(e,t){var r=(e.length-t)%3;return r===0?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function qz(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function Fz(e){return e.toString(this.encoding)}function Hz(e){return e&&e.length?this.write(e):""}var I1,n4;function cw(){if(n4)return I1;n4=1;var e=xl().codes.ERR_STREAM_PREMATURE_CLOSE;function t(i){var u=!1;return function(){if(!u){u=!0;for(var d=arguments.length,c=new Array(d),b=0;b<d;b++)c[b]=arguments[b];i.apply(this,c)}}}function r(){}function n(i){return i.setHeader&&typeof i.abort=="function"}function s(i,u,d){if(typeof u=="function")return s(i,null,u);u||(u={}),d=t(d||r);var c=u.readable||u.readable!==!1&&i.readable,b=u.writable||u.writable!==!1&&i.writable,w=function(){i.writable||_()},M=i._writableState&&i._writableState.finished,_=function(){b=!1,M=!0,c||d.call(i)},A=i._readableState&&i._readableState.endEmitted,R=function(){c=!1,A=!0,b||d.call(i)},B=function(T){d.call(i,T)},I=function(){var T;if(c&&!A)return(!i._readableState||!i._readableState.ended)&&(T=new e),d.call(i,T);if(b&&!M)return(!i._writableState||!i._writableState.ended)&&(T=new e),d.call(i,T)},E=function(){i.req.on("finish",_)};return n(i)?(i.on("complete",_),i.on("abort",I),i.req?E():i.on("request",E)):b&&!i._writableState&&(i.on("end",w),i.on("close",w)),i.on("end",R),i.on("finish",_),u.error!==!1&&i.on("error",B),i.on("close",I),function(){i.removeListener("complete",_),i.removeListener("abort",I),i.removeListener("request",E),i.req&&i.req.removeListener("finish",_),i.removeListener("end",w),i.removeListener("close",w),i.removeListener("finish",_),i.removeListener("end",R),i.removeListener("error",B),i.removeListener("close",I)}}return I1=s,I1}var C1,i4;function zz(){if(i4)return C1;i4=1;var e;function t(T,L,q){return L=r(L),L in T?Object.defineProperty(T,L,{value:q,enumerable:!0,configurable:!0,writable:!0}):T[L]=q,T}function r(T){var L=n(T,"string");return typeof L=="symbol"?L:String(L)}function n(T,L){if(typeof T!="object"||T===null)return T;var q=T[Symbol.toPrimitive];if(q!==void 0){var z=q.call(T,L);if(typeof z!="object")return z;throw new TypeError("@@toPrimitive must return a primitive value.")}return(L==="string"?String:Number)(T)}var s=cw(),i=Symbol("lastResolve"),u=Symbol("lastReject"),d=Symbol("error"),c=Symbol("ended"),b=Symbol("lastPromise"),w=Symbol("handlePromise"),M=Symbol("stream");function _(T,L){return{value:T,done:L}}function A(T){var L=T[i];if(L!==null){var q=T[M].read();q!==null&&(T[b]=null,T[i]=null,T[u]=null,L(_(q,!1)))}}function R(T){qe.nextTick(A,T)}function B(T,L){return function(q,z){T.then(function(){if(L[c]){q(_(void 0,!0));return}L[w](q,z)},z)}}var I=Object.getPrototypeOf(function(){}),E=Object.setPrototypeOf((e={get stream(){return this[M]},next:function(){var L=this,q=this[d];if(q!==null)return Promise.reject(q);if(this[c])return Promise.resolve(_(void 0,!0));if(this[M].destroyed)return new Promise(function(X,ee){qe.nextTick(function(){L[d]?ee(L[d]):X(_(void 0,!0))})});var z=this[b],J;if(z)J=new Promise(B(z,this));else{var F=this[M].read();if(F!==null)return Promise.resolve(_(F,!1));J=new Promise(this[w])}return this[b]=J,J}},t(e,Symbol.asyncIterator,function(){return this}),t(e,"return",function(){var L=this;return new Promise(function(q,z){L[M].destroy(null,function(J){if(J){z(J);return}q(_(void 0,!0))})})}),e),I),k=function(L){var q,z=Object.create(E,(q={},t(q,M,{value:L,writable:!0}),t(q,i,{value:null,writable:!0}),t(q,u,{value:null,writable:!0}),t(q,d,{value:null,writable:!0}),t(q,c,{value:L._readableState.endEmitted,writable:!0}),t(q,w,{value:function(F,X){var ee=z[M].read();ee?(z[b]=null,z[i]=null,z[u]=null,F(_(ee,!1))):(z[i]=F,z[u]=X)},writable:!0}),q));return z[b]=null,s(L,function(J){if(J&&J.code!=="ERR_STREAM_PREMATURE_CLOSE"){var F=z[u];F!==null&&(z[b]=null,z[i]=null,z[u]=null,F(J)),z[d]=J;return}var X=z[i];X!==null&&(z[b]=null,z[i]=null,z[u]=null,X(_(void 0,!0))),z[c]=!0}),L.on("readable",R.bind(null,z)),z};return C1=k,C1}var P1,o4;function Wz(){return o4||(o4=1,P1=function(){throw new Error("Readable.from is not available in the browser")}),P1}var L1,s4;function O9(){if(s4)return L1;s4=1,L1=X;var e;X.ReadableState=F,Fa.EventEmitter;var t=function(O,Q){return O.listeners(Q).length},r=l9(),n=Kt.Buffer,s=(typeof Ve<"u"?Ve:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function i(K){return n.from(K)}function u(K){return n.isBuffer(K)||K instanceof s}var d=Ha,c;d&&d.debuglog?c=d.debuglog("stream"):c=function(){};var b=Rz(),w=C9(),M=P9(),_=M.getHighWaterMark,A=xl().codes,R=A.ERR_INVALID_ARG_TYPE,B=A.ERR_STREAM_PUSH_AFTER_EOF,I=A.ERR_METHOD_NOT_IMPLEMENTED,E=A.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,k,T,L;Fe(X,r);var q=w.errorOrDestroy,z=["error","close","destroy","pause","resume"];function J(K,O,Q){if(typeof K.prependListener=="function")return K.prependListener(O,Q);!K._events||!K._events[O]?K.on(O,Q):Array.isArray(K._events[O])?K._events[O].unshift(Q):K._events[O]=[Q,K._events[O]]}function F(K,O,Q){e=e||Jf(),K=K||{},typeof Q!="boolean"&&(Q=O instanceof e),this.objectMode=!!K.objectMode,Q&&(this.objectMode=this.objectMode||!!K.readableObjectMode),this.highWaterMark=_(this,K,"readableHighWaterMark",Q),this.buffer=new b,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=K.emitClose!==!1,this.autoDestroy=!!K.autoDestroy,this.destroyed=!1,this.defaultEncoding=K.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,K.encoding&&(k||(k=m0.StringDecoder),this.decoder=new k(K.encoding),this.encoding=K.encoding)}function X(K){if(e=e||Jf(),!(this instanceof X))return new X(K);var O=this instanceof e;this._readableState=new F(K,this,O),this.readable=!0,K&&(typeof K.read=="function"&&(this._read=K.read),typeof K.destroy=="function"&&(this._destroy=K.destroy)),r.call(this)}Object.defineProperty(X.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(O){this._readableState&&(this._readableState.destroyed=O)}}),X.prototype.destroy=w.destroy,X.prototype._undestroy=w.undestroy,X.prototype._destroy=function(K,O){O(K)},X.prototype.push=function(K,O){var Q=this._readableState,de;return Q.objectMode?de=!0:typeof K=="string"&&(O=O||Q.defaultEncoding,O!==Q.encoding&&(K=n.from(K,O),O=""),de=!0),ee(this,K,O,!1,de)},X.prototype.unshift=function(K){return ee(this,K,null,!0,!1)};function ee(K,O,Q,de,oe){c("readableAddChunk",O);var se=K._readableState;if(O===null)se.reading=!1,v(K,se);else{var Ie;if(oe||(Ie=o(se,O)),Ie)q(K,Ie);else if(se.objectMode||O&&O.length>0)if(typeof O!="string"&&!se.objectMode&&Object.getPrototypeOf(O)!==n.prototype&&(O=i(O)),de)se.endEmitted?q(K,new E):x(K,se,O,!0);else if(se.ended)q(K,new B);else{if(se.destroyed)return!1;se.reading=!1,se.decoder&&!Q?(O=se.decoder.write(O),se.objectMode||O.length!==0?x(K,se,O,!1):p(K,se)):x(K,se,O,!1)}else de||(se.reading=!1,p(K,se))}return!se.ended&&(se.length<se.highWaterMark||se.length===0)}function x(K,O,Q,de){O.flowing&&O.length===0&&!O.sync?(O.awaitDrain=0,K.emit("data",Q)):(O.length+=O.objectMode?1:Q.length,de?O.buffer.unshift(Q):O.buffer.push(Q),O.needReadable&&y(K)),p(K,O)}function o(K,O){var Q;return!u(O)&&typeof O!="string"&&O!==void 0&&!K.objectMode&&(Q=new R("chunk",["string","Buffer","Uint8Array"],O)),Q}X.prototype.isPaused=function(){return this._readableState.flowing===!1},X.prototype.setEncoding=function(K){k||(k=m0.StringDecoder);var O=new k(K);this._readableState.decoder=O,this._readableState.encoding=this._readableState.decoder.encoding;for(var Q=this._readableState.buffer.head,de="";Q!==null;)de+=O.write(Q.data),Q=Q.next;return this._readableState.buffer.clear(),de!==""&&this._readableState.buffer.push(de),this._readableState.length=de.length,this};var f=1073741824;function l(K){return K>=f?K=f:(K--,K|=K>>>1,K|=K>>>2,K|=K>>>4,K|=K>>>8,K|=K>>>16,K++),K}function h(K,O){return K<=0||O.length===0&&O.ended?0:O.objectMode?1:K!==K?O.flowing&&O.length?O.buffer.head.data.length:O.length:(K>O.highWaterMark&&(O.highWaterMark=l(K)),K<=O.length?K:O.ended?O.length:(O.needReadable=!0,0))}X.prototype.read=function(K){c("read",K),K=parseInt(K,10);var O=this._readableState,Q=K;if(K!==0&&(O.emittedReadable=!1),K===0&&O.needReadable&&((O.highWaterMark!==0?O.length>=O.highWaterMark:O.length>0)||O.ended))return c("read: emitReadable",O.length,O.ended),O.length===0&&O.ended?P(this):y(this),null;if(K=h(K,O),K===0&&O.ended)return O.length===0&&P(this),null;var de=O.needReadable;c("need readable",de),(O.length===0||O.length-K<O.highWaterMark)&&(de=!0,c("length less than watermark",de)),O.ended||O.reading?(de=!1,c("reading or ended",de)):de&&(c("do read"),O.reading=!0,O.sync=!0,O.length===0&&(O.needReadable=!0),this._read(O.highWaterMark),O.sync=!1,O.reading||(K=h(Q,O)));var oe;return K>0?oe=$(K,O):oe=null,oe===null?(O.needReadable=O.length<=O.highWaterMark,K=0):(O.length-=K,O.awaitDrain=0),O.length===0&&(O.ended||(O.needReadable=!0),Q!==K&&O.ended&&P(this)),oe!==null&&this.emit("data",oe),oe};function v(K,O){if(c("onEofChunk"),!O.ended){if(O.decoder){var Q=O.decoder.end();Q&&Q.length&&(O.buffer.push(Q),O.length+=O.objectMode?1:Q.length)}O.ended=!0,O.sync?y(K):(O.needReadable=!1,O.emittedReadable||(O.emittedReadable=!0,m(K)))}}function y(K){var O=K._readableState;c("emitReadable",O.needReadable,O.emittedReadable),O.needReadable=!1,O.emittedReadable||(c("emitReadable",O.flowing),O.emittedReadable=!0,qe.nextTick(m,K))}function m(K){var O=K._readableState;c("emitReadable_",O.destroyed,O.length,O.ended),!O.destroyed&&(O.length||O.ended)&&(K.emit("readable"),O.emittedReadable=!1),O.needReadable=!O.flowing&&!O.ended&&O.length<=O.highWaterMark,H(K)}function p(K,O){O.readingMore||(O.readingMore=!0,qe.nextTick(a,K,O))}function a(K,O){for(;!O.reading&&!O.ended&&(O.length<O.highWaterMark||O.flowing&&O.length===0);){var Q=O.length;if(c("maybeReadMore read 0"),K.read(0),Q===O.length)break}O.readingMore=!1}X.prototype._read=function(K){q(this,new I("_read()"))},X.prototype.pipe=function(K,O){var Q=this,de=this._readableState;switch(de.pipesCount){case 0:de.pipes=K;break;case 1:de.pipes=[de.pipes,K];break;default:de.pipes.push(K);break}de.pipesCount+=1,c("pipe count=%d opts=%j",de.pipesCount,O);var oe=(!O||O.end!==!1)&&K!==qe.stdout&&K!==qe.stderr,se=oe?fe:He;de.endEmitted?qe.nextTick(se):Q.once("end",se),K.on("unpipe",Ie);function Ie(ye,Ae){c("onunpipe"),ye===Q&&Ae&&Ae.hasUnpiped===!1&&(Ae.hasUnpiped=!0,ae())}function fe(){c("onend"),K.end()}var ne=g(Q);K.on("drain",ne);var je=!1;function ae(){c("cleanup"),K.removeListener("close",he),K.removeListener("finish",_e),K.removeListener("drain",ne),K.removeListener("error",Le),K.removeListener("unpipe",Ie),Q.removeListener("end",fe),Q.removeListener("end",He),Q.removeListener("data",le),je=!0,de.awaitDrain&&(!K._writableState||K._writableState.needDrain)&&ne()}Q.on("data",le);function le(ye){c("ondata");var Ae=K.write(ye);c("dest.write",Ae),Ae===!1&&((de.pipesCount===1&&de.pipes===K||de.pipesCount>1&&G(de.pipes,K)!==-1)&&!je&&(c("false write response, pause",de.awaitDrain),de.awaitDrain++),Q.pause())}function Le(ye){c("onerror",ye),He(),K.removeListener("error",Le),t(K,"error")===0&&q(K,ye)}J(K,"error",Le);function he(){K.removeListener("finish",_e),He()}K.once("close",he);function _e(){c("onfinish"),K.removeListener("close",he),He()}K.once("finish",_e);function He(){c("unpipe"),Q.unpipe(K)}return K.emit("pipe",Q),de.flowing||(c("pipe resume"),Q.resume()),K};function g(K){return function(){var Q=K._readableState;c("pipeOnDrain",Q.awaitDrain),Q.awaitDrain&&Q.awaitDrain--,Q.awaitDrain===0&&t(K,"data")&&(Q.flowing=!0,H(K))}}X.prototype.unpipe=function(K){var O=this._readableState,Q={hasUnpiped:!1};if(O.pipesCount===0)return this;if(O.pipesCount===1)return K&&K!==O.pipes?this:(K||(K=O.pipes),O.pipes=null,O.pipesCount=0,O.flowing=!1,K&&K.emit("unpipe",this,Q),this);if(!K){var de=O.pipes,oe=O.pipesCount;O.pipes=null,O.pipesCount=0,O.flowing=!1;for(var se=0;se<oe;se++)de[se].emit("unpipe",this,{hasUnpiped:!1});return this}var Ie=G(O.pipes,K);return Ie===-1?this:(O.pipes.splice(Ie,1),O.pipesCount-=1,O.pipesCount===1&&(O.pipes=O.pipes[0]),K.emit("unpipe",this,Q),this)},X.prototype.on=function(K,O){var Q=r.prototype.on.call(this,K,O),de=this._readableState;return K==="data"?(de.readableListening=this.listenerCount("readable")>0,de.flowing!==!1&&this.resume()):K==="readable"&&!de.endEmitted&&!de.readableListening&&(de.readableListening=de.needReadable=!0,de.flowing=!1,de.emittedReadable=!1,c("on readable",de.length,de.reading),de.length?y(this):de.reading||qe.nextTick(N,this)),Q},X.prototype.addListener=X.prototype.on,X.prototype.removeListener=function(K,O){var Q=r.prototype.removeListener.call(this,K,O);return K==="readable"&&qe.nextTick(S,this),Q},X.prototype.removeAllListeners=function(K){var O=r.prototype.removeAllListeners.apply(this,arguments);return(K==="readable"||K===void 0)&&qe.nextTick(S,this),O};function S(K){var O=K._readableState;O.readableListening=K.listenerCount("readable")>0,O.resumeScheduled&&!O.paused?O.flowing=!0:K.listenerCount("data")>0&&K.resume()}function N(K){c("readable nexttick read 0"),K.read(0)}X.prototype.resume=function(){var K=this._readableState;return K.flowing||(c("resume"),K.flowing=!K.readableListening,U(this,K)),K.paused=!1,this};function U(K,O){O.resumeScheduled||(O.resumeScheduled=!0,qe.nextTick(Z,K,O))}function Z(K,O){c("resume",O.reading),O.reading||K.read(0),O.resumeScheduled=!1,K.emit("resume"),H(K),O.flowing&&!O.reading&&K.read(0)}X.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function H(K){var O=K._readableState;for(c("flow",O.flowing);O.flowing&&K.read()!==null;);}X.prototype.wrap=function(K){var O=this,Q=this._readableState,de=!1;K.on("end",function(){if(c("wrapped end"),Q.decoder&&!Q.ended){var Ie=Q.decoder.end();Ie&&Ie.length&&O.push(Ie)}O.push(null)}),K.on("data",function(Ie){if(c("wrapped data"),Q.decoder&&(Ie=Q.decoder.write(Ie)),!(Q.objectMode&&Ie==null)&&!(!Q.objectMode&&(!Ie||!Ie.length))){var fe=O.push(Ie);fe||(de=!0,K.pause())}});for(var oe in K)this[oe]===void 0&&typeof K[oe]=="function"&&(this[oe]=function(fe){return function(){return K[fe].apply(K,arguments)}}(oe));for(var se=0;se<z.length;se++)K.on(z[se],this.emit.bind(this,z[se]));return this._read=function(Ie){c("wrapped _read",Ie),de&&(de=!1,K.resume())},this},typeof Symbol=="function"&&(X.prototype[Symbol.asyncIterator]=function(){return T===void 0&&(T=zz()),T(this)}),Object.defineProperty(X.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(X.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(X.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(O){this._readableState&&(this._readableState.flowing=O)}}),X._fromList=$,Object.defineProperty(X.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function $(K,O){if(O.length===0)return null;var Q;return O.objectMode?Q=O.buffer.shift():!K||K>=O.length?(O.decoder?Q=O.buffer.join(""):O.buffer.length===1?Q=O.buffer.first():Q=O.buffer.concat(O.length),O.buffer.clear()):Q=O.buffer.consume(K,O.decoder),Q}function P(K){var O=K._readableState;c("endReadable",O.endEmitted),O.endEmitted||(O.ended=!0,qe.nextTick(W,O,K))}function W(K,O){if(c("endReadableNT",K.endEmitted,K.length),!K.endEmitted&&K.length===0&&(K.endEmitted=!0,O.readable=!1,O.emit("end"),K.autoDestroy)){var Q=O._writableState;(!Q||Q.autoDestroy&&Q.finished)&&O.destroy()}}typeof Symbol=="function"&&(X.from=function(K,O){return L===void 0&&(L=Wz()),L(X,K,O)});function G(K,O){for(var Q=0,de=K.length;Q<de;Q++)if(K[Q]===O)return Q;return-1}return L1}var O1,a4;function U9(){if(a4)return O1;a4=1,O1=d;var e=xl().codes,t=e.ERR_METHOD_NOT_IMPLEMENTED,r=e.ERR_MULTIPLE_CALLBACK,n=e.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=e.ERR_TRANSFORM_WITH_LENGTH_0,i=Jf();Fe(d,i);function u(w,M){var _=this._transformState;_.transforming=!1;var A=_.writecb;if(A===null)return this.emit("error",new r);_.writechunk=null,_.writecb=null,M!=null&&this.push(M),A(w);var R=this._readableState;R.reading=!1,(R.needReadable||R.length<R.highWaterMark)&&this._read(R.highWaterMark)}function d(w){if(!(this instanceof d))return new d(w);i.call(this,w),this._transformState={afterTransform:u.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,w&&(typeof w.transform=="function"&&(this._transform=w.transform),typeof w.flush=="function"&&(this._flush=w.flush)),this.on("prefinish",c)}function c(){var w=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(M,_){b(w,M,_)}):b(this,null,null)}d.prototype.push=function(w,M){return this._transformState.needTransform=!1,i.prototype.push.call(this,w,M)},d.prototype._transform=function(w,M,_){_(new t("_transform()"))},d.prototype._write=function(w,M,_){var A=this._transformState;if(A.writecb=_,A.writechunk=w,A.writeencoding=M,!A.transforming){var R=this._readableState;(A.needTransform||R.needReadable||R.length<R.highWaterMark)&&this._read(R.highWaterMark)}},d.prototype._read=function(w){var M=this._transformState;M.writechunk!==null&&!M.transforming?(M.transforming=!0,this._transform(M.writechunk,M.writeencoding,M.afterTransform)):M.needTransform=!0},d.prototype._destroy=function(w,M){i.prototype._destroy.call(this,w,function(_){M(_)})};function b(w,M,_){if(M)return w.emit("error",M);if(_!=null&&w.push(_),w._writableState.length)throw new s;if(w._transformState.transforming)throw new n;return w.push(null)}return O1}var U1,f4;function Vz(){if(f4)return U1;f4=1,U1=t;var e=U9();Fe(t,e);function t(r){if(!(this instanceof t))return new t(r);e.call(this,r)}return t.prototype._transform=function(r,n,s){s(null,r)},U1}var j1,l4;function Kz(){if(l4)return j1;l4=1;var e;function t(_){var A=!1;return function(){A||(A=!0,_.apply(void 0,arguments))}}var r=xl().codes,n=r.ERR_MISSING_ARGS,s=r.ERR_STREAM_DESTROYED;function i(_){if(_)throw _}function u(_){return _.setHeader&&typeof _.abort=="function"}function d(_,A,R,B){B=t(B);var I=!1;_.on("close",function(){I=!0}),e===void 0&&(e=cw()),e(_,{readable:A,writable:R},function(k){if(k)return B(k);I=!0,B()});var E=!1;return function(k){if(!I&&!E){if(E=!0,u(_))return _.abort();if(typeof _.destroy=="function")return _.destroy();B(k||new s("pipe"))}}}function c(_){_()}function b(_,A){return _.pipe(A)}function w(_){return!_.length||typeof _[_.length-1]!="function"?i:_.pop()}function M(){for(var _=arguments.length,A=new Array(_),R=0;R<_;R++)A[R]=arguments[R];var B=w(A);if(Array.isArray(A[0])&&(A=A[0]),A.length<2)throw new n("streams");var I,E=A.map(function(k,T){var L=T<A.length-1,q=T>0;return d(k,L,q,function(z){I||(I=z),z&&E.forEach(c),!L&&(E.forEach(c),B(I))})});return A.reduce(b)}return j1=M,j1}var j9=In,dw=Fa.EventEmitter,Zz=Fe;Zz(In,dw);In.Readable=O9();In.Writable=L9();In.Duplex=Jf();In.Transform=U9();In.PassThrough=Vz();In.finished=cw();In.pipeline=Kz();In.Stream=In;function In(){dw.call(this)}In.prototype.pipe=function(e,t){var r=this;function n(w){e.writable&&e.write(w)===!1&&r.pause&&r.pause()}r.on("data",n);function s(){r.readable&&r.resume&&r.resume()}e.on("drain",s),!e._isStdio&&(!t||t.end!==!1)&&(r.on("end",u),r.on("close",d));var i=!1;function u(){i||(i=!0,e.end())}function d(){i||(i=!0,typeof e.destroy=="function"&&e.destroy())}function c(w){if(b(),dw.listenerCount(this,"error")===0)throw w}r.on("error",c),e.on("error",c);function b(){r.removeListener("data",n),e.removeListener("drain",s),r.removeListener("end",u),r.removeListener("close",d),r.removeListener("error",c),e.removeListener("error",c),r.removeListener("end",b),r.removeListener("close",b),e.removeListener("close",b)}return r.on("end",b),r.on("close",b),e.on("close",b),e.emit("pipe",r),e};var vi=Ye.Buffer,D9=j9.Transform,Gz=Fe;function Cs(e){D9.call(this),this._block=vi.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}Gz(Cs,D9);Cs.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(s){n=s}r(n)};Cs.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(r){t=r}e(t)};var Jz=typeof Uint8Array<"u",Yz=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(vi.prototype instanceof Uint8Array||vi.TYPED_ARRAY_SUPPORT);function Xz(e,t){if(e instanceof vi)return e;if(typeof e=="string")return vi.from(e,t);if(Yz&&ArrayBuffer.isView(e)){if(e.byteLength===0)return vi.alloc(0);var r=vi.from(e.buffer,e.byteOffset,e.byteLength);if(r.byteLength===e.byteLength)return r}if(Jz&&e instanceof Uint8Array||vi.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return vi.from(e);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}Cs.prototype.update=function(e,t){if(this._finalized)throw new Error("Digest already called");e=Xz(e,t);for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var s=this._blockOffset;s<this._blockSize;)r[s++]=e[n++];this._update(),this._blockOffset=0}for(;n<e.length;)r[this._blockOffset++]=e[n++];for(var i=0,u=e.length*8;u>0;++i)this._length[i]+=u,u=this._length[i]/4294967296|0,u>0&&(this._length[i]-=4294967296*u);return this};Cs.prototype._update=function(){throw new Error("_update is not implemented")};Cs.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();e!==void 0&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t};Cs.prototype._digest=function(){throw new Error("_digest is not implemented")};var Qz=Cs,eW=Fe,q9=Qz,tW=Ye.Buffer,rW=new Array(16);function Ed(){q9.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}eW(Ed,q9);Ed.prototype._update=function(){for(var e=rW,t=0;t<16;++t)e[t]=this._block.readInt32LE(t*4);var r=this._a,n=this._b,s=this._c,i=this._d;r=Br(r,n,s,i,e[0],3614090360,7),i=Br(i,r,n,s,e[1],3905402710,12),s=Br(s,i,r,n,e[2],606105819,17),n=Br(n,s,i,r,e[3],3250441966,22),r=Br(r,n,s,i,e[4],4118548399,7),i=Br(i,r,n,s,e[5],1200080426,12),s=Br(s,i,r,n,e[6],2821735955,17),n=Br(n,s,i,r,e[7],4249261313,22),r=Br(r,n,s,i,e[8],1770035416,7),i=Br(i,r,n,s,e[9],2336552879,12),s=Br(s,i,r,n,e[10],4294925233,17),n=Br(n,s,i,r,e[11],2304563134,22),r=Br(r,n,s,i,e[12],1804603682,7),i=Br(i,r,n,s,e[13],4254626195,12),s=Br(s,i,r,n,e[14],2792965006,17),n=Br(n,s,i,r,e[15],1236535329,22),r=Rr(r,n,s,i,e[1],4129170786,5),i=Rr(i,r,n,s,e[6],3225465664,9),s=Rr(s,i,r,n,e[11],643717713,14),n=Rr(n,s,i,r,e[0],3921069994,20),r=Rr(r,n,s,i,e[5],3593408605,5),i=Rr(i,r,n,s,e[10],38016083,9),s=Rr(s,i,r,n,e[15],3634488961,14),n=Rr(n,s,i,r,e[4],3889429448,20),r=Rr(r,n,s,i,e[9],568446438,5),i=Rr(i,r,n,s,e[14],3275163606,9),s=Rr(s,i,r,n,e[3],4107603335,14),n=Rr(n,s,i,r,e[8],1163531501,20),r=Rr(r,n,s,i,e[13],2850285829,5),i=Rr(i,r,n,s,e[2],4243563512,9),s=Rr(s,i,r,n,e[7],1735328473,14),n=Rr(n,s,i,r,e[12],2368359562,20),r=$r(r,n,s,i,e[5],4294588738,4),i=$r(i,r,n,s,e[8],2272392833,11),s=$r(s,i,r,n,e[11],1839030562,16),n=$r(n,s,i,r,e[14],4259657740,23),r=$r(r,n,s,i,e[1],2763975236,4),i=$r(i,r,n,s,e[4],1272893353,11),s=$r(s,i,r,n,e[7],4139469664,16),n=$r(n,s,i,r,e[10],3200236656,23),r=$r(r,n,s,i,e[13],681279174,4),i=$r(i,r,n,s,e[0],3936430074,11),s=$r(s,i,r,n,e[3],3572445317,16),n=$r(n,s,i,r,e[6],76029189,23),r=$r(r,n,s,i,e[9],3654602809,4),i=$r(i,r,n,s,e[12],3873151461,11),s=$r(s,i,r,n,e[15],530742520,16),n=$r(n,s,i,r,e[2],3299628645,23),r=Nr(r,n,s,i,e[0],4096336452,6),i=Nr(i,r,n,s,e[7],1126891415,10),s=Nr(s,i,r,n,e[14],2878612391,15),n=Nr(n,s,i,r,e[5],4237533241,21),r=Nr(r,n,s,i,e[12],1700485571,6),i=Nr(i,r,n,s,e[3],2399980690,10),s=Nr(s,i,r,n,e[10],4293915773,15),n=Nr(n,s,i,r,e[1],2240044497,21),r=Nr(r,n,s,i,e[8],1873313359,6),i=Nr(i,r,n,s,e[15],4264355552,10),s=Nr(s,i,r,n,e[6],2734768916,15),n=Nr(n,s,i,r,e[13],1309151649,21),r=Nr(r,n,s,i,e[4],4149444226,6),i=Nr(i,r,n,s,e[11],3174756917,10),s=Nr(s,i,r,n,e[2],718787259,15),n=Nr(n,s,i,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+s|0,this._d=this._d+i|0};Ed.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=tW.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};function Sd(e,t){return e<<t|e>>>32-t}function Br(e,t,r,n,s,i,u){return Sd(e+(t&r|~t&n)+s+i|0,u)+t|0}function Rr(e,t,r,n,s,i,u){return Sd(e+(t&n|r&~n)+s+i|0,u)+t|0}function $r(e,t,r,n,s,i,u){return Sd(e+(t^r^n)+s+i|0,u)+t|0}function Nr(e,t,r,n,s,i,u){return Sd(e+(r^(t|~n))+s+i|0,u)+t|0}var pw=Ed,nW={}.toString,iW=Array.isArray||function(e){return nW.call(e)=="[object Array]"},oW=ml,sW=bl,aW=sW("TypedArray.prototype.buffer",!0),fW=I9(),lW=aW||function(t){if(!fW(t))throw new oW("Not a Typed Array");return t.buffer},Fn=Ye.Buffer,uW=iW,hW=lW,cW=ArrayBuffer.isView||function(t){try{return hW(t),!0}catch{return!1}},dW=typeof Uint8Array<"u",F9=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",pW=F9&&(Fn.prototype instanceof Uint8Array||Fn.TYPED_ARRAY_SUPPORT),Ad=function(t,r){if(Fn.isBuffer(t))return t.constructor&&!("isBuffer"in t)?Fn.from(t):t;if(typeof t=="string")return Fn.from(t,r);if(F9&&cW(t)){if(t.byteLength===0)return Fn.alloc(0);if(pW){var n=Fn.from(t.buffer,t.byteOffset,t.byteLength);if(n.byteLength===t.byteLength)return n}var s=t instanceof Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),i=Fn.from(s);if(i.length===t.byteLength)return i}if(dW&&t instanceof Uint8Array)return Fn.from(t);var u=uW(t);if(u)for(var d=0;d<t.length;d+=1){var c=t[d];if(typeof c!="number"||c<0||c>255||~~c!==c)throw new RangeError("Array items must be numbers in the range 0-255.")}if(u||Fn.isBuffer(t)&&t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t))return Fn.from(t);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')},vW=Ye.Buffer,gW=Ad,H9=typeof Uint8Array<"u",yW=H9&&typeof ArrayBuffer<"u",u4=yW&&ArrayBuffer.isView,mW=function(e,t){if(typeof e=="string"||vW.isBuffer(e)||H9&&e instanceof Uint8Array||u4&&u4(e))return gW(e,t);throw new TypeError('The "data" argument must be a string, a Buffer, a Uint8Array, or a DataView')},wy={exports:{}},by={exports:{}};typeof qe>"u"||!qe.version||qe.version.indexOf("v0.")===0||qe.version.indexOf("v1.")===0&&qe.version.indexOf("v1.8.")!==0?by.exports={nextTick:wW}:by.exports=qe;function wW(e,t,r,n){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var s=arguments.length,i,u;switch(s){case 0:case 1:return qe.nextTick(e);case 2:return qe.nextTick(function(){e.call(null,t)});case 3:return qe.nextTick(function(){e.call(null,t,r)});case 4:return qe.nextTick(function(){e.call(null,t,r,n)});default:for(i=new Array(s-1),u=0;u<i.length;)i[u++]=arguments[u];return qe.nextTick(function(){e.apply(null,i)})}}var Ps=by.exports,bW={}.toString,xW=Array.isArray||function(e){return bW.call(e)=="[object Array]"},z9=Fa.EventEmitter,xy={exports:{}};(function(e,t){var r=Kt,n=r.Buffer;function s(u,d){for(var c in u)d[c]=u[c]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(s(r,t),t.Buffer=i);function i(u,d,c){return n(u,d,c)}s(n,i),i.from=function(u,d,c){if(typeof u=="number")throw new TypeError("Argument must not be a number");return n(u,d,c)},i.alloc=function(u,d,c){if(typeof u!="number")throw new TypeError("Argument must be a number");var b=n(u);return d!==void 0?typeof c=="string"?b.fill(d,c):b.fill(d):b.fill(0),b},i.allocUnsafe=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return n(u)},i.allocUnsafeSlow=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(u)}})(xy,xy.exports);var vw=xy.exports,Ot={};function MW(e){return Array.isArray?Array.isArray(e):kd(e)==="[object Array]"}Ot.isArray=MW;function _W(e){return typeof e=="boolean"}Ot.isBoolean=_W;function EW(e){return e===null}Ot.isNull=EW;function SW(e){return e==null}Ot.isNullOrUndefined=SW;function AW(e){return typeof e=="number"}Ot.isNumber=AW;function kW(e){return typeof e=="string"}Ot.isString=kW;function BW(e){return typeof e=="symbol"}Ot.isSymbol=BW;function RW(e){return e===void 0}Ot.isUndefined=RW;function $W(e){return kd(e)==="[object RegExp]"}Ot.isRegExp=$W;function NW(e){return typeof e=="object"&&e!==null}Ot.isObject=NW;function TW(e){return kd(e)==="[object Date]"}Ot.isDate=TW;function IW(e){return kd(e)==="[object Error]"||e instanceof Error}Ot.isError=IW;function CW(e){return typeof e=="function"}Ot.isFunction=CW;function PW(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}Ot.isPrimitive=PW;Ot.isBuffer=Kt.Buffer.isBuffer;function kd(e){return Object.prototype.toString.call(e)}var D1={exports:{}},h4;function LW(){return h4||(h4=1,function(e){function t(i,u){if(!(i instanceof u))throw new TypeError("Cannot call a class as a function")}var r=vw.Buffer,n=Ha;function s(i,u,d){i.copy(u,d)}e.exports=function(){function i(){t(this,i),this.head=null,this.tail=null,this.length=0}return i.prototype.push=function(d){var c={data:d,next:null};this.length>0?this.tail.next=c:this.head=c,this.tail=c,++this.length},i.prototype.unshift=function(d){var c={data:d,next:this.head};this.length===0&&(this.tail=c),this.head=c,++this.length},i.prototype.shift=function(){if(this.length!==0){var d=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,d}},i.prototype.clear=function(){this.head=this.tail=null,this.length=0},i.prototype.join=function(d){if(this.length===0)return"";for(var c=this.head,b=""+c.data;c=c.next;)b+=d+c.data;return b},i.prototype.concat=function(d){if(this.length===0)return r.alloc(0);for(var c=r.allocUnsafe(d>>>0),b=this.head,w=0;b;)s(b.data,c,w),w+=b.data.length,b=b.next;return c},i}(),n&&n.inspect&&n.inspect.custom&&(e.exports.prototype[n.inspect.custom]=function(){var i=n.inspect({length:this.length});return this.constructor.name+" "+i})}(D1)),D1.exports}var Fh=Ps;function OW(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return n||s?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Fh.nextTick(Hh,this,e)):Fh.nextTick(Hh,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(i){!t&&i?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,Fh.nextTick(Hh,r,i)):Fh.nextTick(Hh,r,i):t&&t(i)}),this)}function UW(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Hh(e,t){e.emit("error",t)}var W9={destroy:OW,undestroy:UW},q1,c4;function V9(){if(c4)return q1;c4=1;var e=Ps;q1=B;function t(y){var m=this;this.next=null,this.entry=null,this.finish=function(){v(m,y)}}var r=!qe.browser&&["v0.10","v0.9."].indexOf(qe.version.slice(0,5))>-1?setImmediate:e.nextTick,n;B.WritableState=A;var s=Object.create(Ot);s.inherits=Fe;var i={deprecate:uw},u=z9,d=vw.Buffer,c=(typeof Ve<"u"?Ve:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function b(y){return d.from(y)}function w(y){return d.isBuffer(y)||y instanceof c}var M=W9;s.inherits(B,u);function _(){}function A(y,m){n=n||Yf(),y=y||{};var p=m instanceof n;this.objectMode=!!y.objectMode,p&&(this.objectMode=this.objectMode||!!y.writableObjectMode);var a=y.highWaterMark,g=y.writableHighWaterMark,S=this.objectMode?16:16*1024;a||a===0?this.highWaterMark=a:p&&(g||g===0)?this.highWaterMark=g:this.highWaterMark=S,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var N=y.decodeStrings===!1;this.decodeStrings=!N,this.defaultEncoding=y.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(U){J(m,U)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}A.prototype.getBuffer=function(){for(var m=this.bufferedRequest,p=[];m;)p.push(m),m=m.next;return p},function(){try{Object.defineProperty(A.prototype,"buffer",{get:i.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var R;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(R=Function.prototype[Symbol.hasInstance],Object.defineProperty(B,Symbol.hasInstance,{value:function(y){return R.call(this,y)?!0:this!==B?!1:y&&y._writableState instanceof A}})):R=function(y){return y instanceof this};function B(y){if(n=n||Yf(),!R.call(B,this)&&!(this instanceof n))return new B(y);this._writableState=new A(y,this),this.writable=!0,y&&(typeof y.write=="function"&&(this._write=y.write),typeof y.writev=="function"&&(this._writev=y.writev),typeof y.destroy=="function"&&(this._destroy=y.destroy),typeof y.final=="function"&&(this._final=y.final)),u.call(this)}B.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function I(y,m){var p=new Error("write after end");y.emit("error",p),e.nextTick(m,p)}function E(y,m,p,a){var g=!0,S=!1;return p===null?S=new TypeError("May not write null values to stream"):typeof p!="string"&&p!==void 0&&!m.objectMode&&(S=new TypeError("Invalid non-string/buffer chunk")),S&&(y.emit("error",S),e.nextTick(a,S),g=!1),g}B.prototype.write=function(y,m,p){var a=this._writableState,g=!1,S=!a.objectMode&&w(y);return S&&!d.isBuffer(y)&&(y=b(y)),typeof m=="function"&&(p=m,m=null),S?m="buffer":m||(m=a.defaultEncoding),typeof p!="function"&&(p=_),a.ended?I(this,p):(S||E(this,a,y,p))&&(a.pendingcb++,g=T(this,a,S,y,m,p)),g},B.prototype.cork=function(){var y=this._writableState;y.corked++},B.prototype.uncork=function(){var y=this._writableState;y.corked&&(y.corked--,!y.writing&&!y.corked&&!y.bufferProcessing&&y.bufferedRequest&&ee(this,y))},B.prototype.setDefaultEncoding=function(m){if(typeof m=="string"&&(m=m.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((m+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+m);return this._writableState.defaultEncoding=m,this};function k(y,m,p){return!y.objectMode&&y.decodeStrings!==!1&&typeof m=="string"&&(m=d.from(m,p)),m}Object.defineProperty(B.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function T(y,m,p,a,g,S){if(!p){var N=k(m,a,g);a!==N&&(p=!0,g="buffer",a=N)}var U=m.objectMode?1:a.length;m.length+=U;var Z=m.length<m.highWaterMark;if(Z||(m.needDrain=!0),m.writing||m.corked){var H=m.lastBufferedRequest;m.lastBufferedRequest={chunk:a,encoding:g,isBuf:p,callback:S,next:null},H?H.next=m.lastBufferedRequest:m.bufferedRequest=m.lastBufferedRequest,m.bufferedRequestCount+=1}else L(y,m,!1,U,a,g,S);return Z}function L(y,m,p,a,g,S,N){m.writelen=a,m.writecb=N,m.writing=!0,m.sync=!0,p?y._writev(g,m.onwrite):y._write(g,S,m.onwrite),m.sync=!1}function q(y,m,p,a,g){--m.pendingcb,p?(e.nextTick(g,a),e.nextTick(l,y,m),y._writableState.errorEmitted=!0,y.emit("error",a)):(g(a),y._writableState.errorEmitted=!0,y.emit("error",a),l(y,m))}function z(y){y.writing=!1,y.writecb=null,y.length-=y.writelen,y.writelen=0}function J(y,m){var p=y._writableState,a=p.sync,g=p.writecb;if(z(p),m)q(y,p,a,m,g);else{var S=x(p);!S&&!p.corked&&!p.bufferProcessing&&p.bufferedRequest&&ee(y,p),a?r(F,y,p,S,g):F(y,p,S,g)}}function F(y,m,p,a){p||X(y,m),m.pendingcb--,a(),l(y,m)}function X(y,m){m.length===0&&m.needDrain&&(m.needDrain=!1,y.emit("drain"))}function ee(y,m){m.bufferProcessing=!0;var p=m.bufferedRequest;if(y._writev&&p&&p.next){var a=m.bufferedRequestCount,g=new Array(a),S=m.corkedRequestsFree;S.entry=p;for(var N=0,U=!0;p;)g[N]=p,p.isBuf||(U=!1),p=p.next,N+=1;g.allBuffers=U,L(y,m,!0,m.length,g,"",S.finish),m.pendingcb++,m.lastBufferedRequest=null,S.next?(m.corkedRequestsFree=S.next,S.next=null):m.corkedRequestsFree=new t(m),m.bufferedRequestCount=0}else{for(;p;){var Z=p.chunk,H=p.encoding,$=p.callback,P=m.objectMode?1:Z.length;if(L(y,m,!1,P,Z,H,$),p=p.next,m.bufferedRequestCount--,m.writing)break}p===null&&(m.lastBufferedRequest=null)}m.bufferedRequest=p,m.bufferProcessing=!1}B.prototype._write=function(y,m,p){p(new Error("_write() is not implemented"))},B.prototype._writev=null,B.prototype.end=function(y,m,p){var a=this._writableState;typeof y=="function"?(p=y,y=null,m=null):typeof m=="function"&&(p=m,m=null),y!=null&&this.write(y,m),a.corked&&(a.corked=1,this.uncork()),a.ending||h(this,a,p)};function x(y){return y.ending&&y.length===0&&y.bufferedRequest===null&&!y.finished&&!y.writing}function o(y,m){y._final(function(p){m.pendingcb--,p&&y.emit("error",p),m.prefinished=!0,y.emit("prefinish"),l(y,m)})}function f(y,m){!m.prefinished&&!m.finalCalled&&(typeof y._final=="function"?(m.pendingcb++,m.finalCalled=!0,e.nextTick(o,y,m)):(m.prefinished=!0,y.emit("prefinish")))}function l(y,m){var p=x(m);return p&&(f(y,m),m.pendingcb===0&&(m.finished=!0,y.emit("finish"))),p}function h(y,m,p){m.ending=!0,l(y,m),p&&(m.finished?e.nextTick(p):y.once("finish",p)),m.ended=!0,y.writable=!1}function v(y,m,p){var a=y.entry;for(y.entry=null;a;){var g=a.callback;m.pendingcb--,g(p),a=a.next}m.corkedRequestsFree.next=y}return Object.defineProperty(B.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(y){this._writableState&&(this._writableState.destroyed=y)}}),B.prototype.destroy=M.destroy,B.prototype._undestroy=M.undestroy,B.prototype._destroy=function(y,m){this.end(),m(y)},q1}var F1,d4;function Yf(){if(d4)return F1;d4=1;var e=Ps,t=Object.keys||function(M){var _=[];for(var A in M)_.push(A);return _};F1=c;var r=Object.create(Ot);r.inherits=Fe;var n=K9(),s=V9();r.inherits(c,n);for(var i=t(s.prototype),u=0;u<i.length;u++){var d=i[u];c.prototype[d]||(c.prototype[d]=s.prototype[d])}function c(M){if(!(this instanceof c))return new c(M);n.call(this,M),s.call(this,M),M&&M.readable===!1&&(this.readable=!1),M&&M.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,M&&M.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",b)}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function b(){this.allowHalfOpen||this._writableState.ended||e.nextTick(w,this)}function w(M){M.end()}return Object.defineProperty(c.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(M){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=M,this._writableState.destroyed=M)}}),c.prototype._destroy=function(M,_){this.push(null),this.end(),e.nextTick(_,M)},F1}var H1={},zh={exports:{}},p4;function jW(){return p4||(p4=1,function(e,t){var r=Kt,n=r.Buffer;function s(u,d){for(var c in u)d[c]=u[c]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(s(r,t),t.Buffer=i);function i(u,d,c){return n(u,d,c)}s(n,i),i.from=function(u,d,c){if(typeof u=="number")throw new TypeError("Argument must not be a number");return n(u,d,c)},i.alloc=function(u,d,c){if(typeof u!="number")throw new TypeError("Argument must be a number");var b=n(u);return d!==void 0?typeof c=="string"?b.fill(d,c):b.fill(d):b.fill(0),b},i.allocUnsafe=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return n(u)},i.allocUnsafeSlow=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(u)}}(zh,zh.exports)),zh.exports}var v4;function g4(){if(v4)return H1;v4=1;var e=jW().Buffer,t=e.isEncoding||function(E){switch(E=""+E,E&&E.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(E){if(!E)return"utf8";for(var k;;)switch(E){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return E;default:if(k)return;E=(""+E).toLowerCase(),k=!0}}function n(E){var k=r(E);if(typeof k!="string"&&(e.isEncoding===t||!t(E)))throw new Error("Unknown encoding: "+E);return k||E}H1.StringDecoder=s;function s(E){this.encoding=n(E);var k;switch(this.encoding){case"utf16le":this.text=M,this.end=_,k=4;break;case"utf8":this.fillLast=c,k=4;break;case"base64":this.text=A,this.end=R,k=3;break;default:this.write=B,this.end=I;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(k)}s.prototype.write=function(E){if(E.length===0)return"";var k,T;if(this.lastNeed){if(k=this.fillLast(E),k===void 0)return"";T=this.lastNeed,this.lastNeed=0}else T=0;return T<E.length?k?k+this.text(E,T):this.text(E,T):k||""},s.prototype.end=w,s.prototype.text=b,s.prototype.fillLast=function(E){if(this.lastNeed<=E.length)return E.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);E.copy(this.lastChar,this.lastTotal-this.lastNeed,0,E.length),this.lastNeed-=E.length};function i(E){return E<=127?0:E>>5===6?2:E>>4===14?3:E>>3===30?4:E>>6===2?-1:-2}function u(E,k,T){var L=k.length-1;if(L<T)return 0;var q=i(k[L]);return q>=0?(q>0&&(E.lastNeed=q-1),q):--L<T||q===-2?0:(q=i(k[L]),q>=0?(q>0&&(E.lastNeed=q-2),q):--L<T||q===-2?0:(q=i(k[L]),q>=0?(q>0&&(q===2?q=0:E.lastNeed=q-3),q):0))}function d(E,k,T){if((k[0]&192)!==128)return E.lastNeed=0,"�";if(E.lastNeed>1&&k.length>1){if((k[1]&192)!==128)return E.lastNeed=1,"�";if(E.lastNeed>2&&k.length>2&&(k[2]&192)!==128)return E.lastNeed=2,"�"}}function c(E){var k=this.lastTotal-this.lastNeed,T=d(this,E);if(T!==void 0)return T;if(this.lastNeed<=E.length)return E.copy(this.lastChar,k,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);E.copy(this.lastChar,k,0,E.length),this.lastNeed-=E.length}function b(E,k){var T=u(this,E,k);if(!this.lastNeed)return E.toString("utf8",k);this.lastTotal=T;var L=E.length-(T-this.lastNeed);return E.copy(this.lastChar,0,L),E.toString("utf8",k,L)}function w(E){var k=E&&E.length?this.write(E):"";return this.lastNeed?k+"�":k}function M(E,k){if((E.length-k)%2===0){var T=E.toString("utf16le",k);if(T){var L=T.charCodeAt(T.length-1);if(L>=55296&&L<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=E[E.length-2],this.lastChar[1]=E[E.length-1],T.slice(0,-1)}return T}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=E[E.length-1],E.toString("utf16le",k,E.length-1)}function _(E){var k=E&&E.length?this.write(E):"";if(this.lastNeed){var T=this.lastTotal-this.lastNeed;return k+this.lastChar.toString("utf16le",0,T)}return k}function A(E,k){var T=(E.length-k)%3;return T===0?E.toString("base64",k):(this.lastNeed=3-T,this.lastTotal=3,T===1?this.lastChar[0]=E[E.length-1]:(this.lastChar[0]=E[E.length-2],this.lastChar[1]=E[E.length-1]),E.toString("base64",k,E.length-T))}function R(E){var k=E&&E.length?this.write(E):"";return this.lastNeed?k+this.lastChar.toString("base64",0,3-this.lastNeed):k}function B(E){return E.toString(this.encoding)}function I(E){return E&&E.length?this.write(E):""}return H1}var z1,y4;function K9(){if(y4)return z1;y4=1;var e=Ps;z1=k;var t=xW,r;k.ReadableState=E,Fa.EventEmitter;var n=function($,P){return $.listeners(P).length},s=z9,i=vw.Buffer,u=(typeof Ve<"u"?Ve:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function d($){return i.from($)}function c($){return i.isBuffer($)||$ instanceof u}var b=Object.create(Ot);b.inherits=Fe;var w=Ha,M=void 0;w&&w.debuglog?M=w.debuglog("stream"):M=function(){};var _=LW(),A=W9,R;b.inherits(k,s);var B=["error","close","destroy","pause","resume"];function I($,P,W){if(typeof $.prependListener=="function")return $.prependListener(P,W);!$._events||!$._events[P]?$.on(P,W):t($._events[P])?$._events[P].unshift(W):$._events[P]=[W,$._events[P]]}function E($,P){r=r||Yf(),$=$||{};var W=P instanceof r;this.objectMode=!!$.objectMode,W&&(this.objectMode=this.objectMode||!!$.readableObjectMode);var G=$.highWaterMark,K=$.readableHighWaterMark,O=this.objectMode?16:16*1024;G||G===0?this.highWaterMark=G:W&&(K||K===0)?this.highWaterMark=K:this.highWaterMark=O,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new _,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=$.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,$.encoding&&(R||(R=g4().StringDecoder),this.decoder=new R($.encoding),this.encoding=$.encoding)}function k($){if(r=r||Yf(),!(this instanceof k))return new k($);this._readableState=new E($,this),this.readable=!0,$&&(typeof $.read=="function"&&(this._read=$.read),typeof $.destroy=="function"&&(this._destroy=$.destroy)),s.call(this)}Object.defineProperty(k.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function($){this._readableState&&(this._readableState.destroyed=$)}}),k.prototype.destroy=A.destroy,k.prototype._undestroy=A.undestroy,k.prototype._destroy=function($,P){this.push(null),P($)},k.prototype.push=function($,P){var W=this._readableState,G;return W.objectMode?G=!0:typeof $=="string"&&(P=P||W.defaultEncoding,P!==W.encoding&&($=i.from($,P),P=""),G=!0),T(this,$,P,!1,G)},k.prototype.unshift=function($){return T(this,$,null,!0,!1)};function T($,P,W,G,K){var O=$._readableState;if(P===null)O.reading=!1,ee($,O);else{var Q;K||(Q=q(O,P)),Q?$.emit("error",Q):O.objectMode||P&&P.length>0?(typeof P!="string"&&!O.objectMode&&Object.getPrototypeOf(P)!==i.prototype&&(P=d(P)),G?O.endEmitted?$.emit("error",new Error("stream.unshift() after end event")):L($,O,P,!0):O.ended?$.emit("error",new Error("stream.push() after EOF")):(O.reading=!1,O.decoder&&!W?(P=O.decoder.write(P),O.objectMode||P.length!==0?L($,O,P,!1):f($,O)):L($,O,P,!1))):G||(O.reading=!1)}return z(O)}function L($,P,W,G){P.flowing&&P.length===0&&!P.sync?($.emit("data",W),$.read(0)):(P.length+=P.objectMode?1:W.length,G?P.buffer.unshift(W):P.buffer.push(W),P.needReadable&&x($)),f($,P)}function q($,P){var W;return!c(P)&&typeof P!="string"&&P!==void 0&&!$.objectMode&&(W=new TypeError("Invalid non-string/buffer chunk")),W}function z($){return!$.ended&&($.needReadable||$.length<$.highWaterMark||$.length===0)}k.prototype.isPaused=function(){return this._readableState.flowing===!1},k.prototype.setEncoding=function($){return R||(R=g4().StringDecoder),this._readableState.decoder=new R($),this._readableState.encoding=$,this};var J=8388608;function F($){return $>=J?$=J:($--,$|=$>>>1,$|=$>>>2,$|=$>>>4,$|=$>>>8,$|=$>>>16,$++),$}function X($,P){return $<=0||P.length===0&&P.ended?0:P.objectMode?1:$!==$?P.flowing&&P.length?P.buffer.head.data.length:P.length:($>P.highWaterMark&&(P.highWaterMark=F($)),$<=P.length?$:P.ended?P.length:(P.needReadable=!0,0))}k.prototype.read=function($){M("read",$),$=parseInt($,10);var P=this._readableState,W=$;if($!==0&&(P.emittedReadable=!1),$===0&&P.needReadable&&(P.length>=P.highWaterMark||P.ended))return M("read: emitReadable",P.length,P.ended),P.length===0&&P.ended?U(this):x(this),null;if($=X($,P),$===0&&P.ended)return P.length===0&&U(this),null;var G=P.needReadable;M("need readable",G),(P.length===0||P.length-$<P.highWaterMark)&&(G=!0,M("length less than watermark",G)),P.ended||P.reading?(G=!1,M("reading or ended",G)):G&&(M("do read"),P.reading=!0,P.sync=!0,P.length===0&&(P.needReadable=!0),this._read(P.highWaterMark),P.sync=!1,P.reading||($=X(W,P)));var K;return $>0?K=a($,P):K=null,K===null?(P.needReadable=!0,$=0):P.length-=$,P.length===0&&(P.ended||(P.needReadable=!0),W!==$&&P.ended&&U(this)),K!==null&&this.emit("data",K),K};function ee($,P){if(!P.ended){if(P.decoder){var W=P.decoder.end();W&&W.length&&(P.buffer.push(W),P.length+=P.objectMode?1:W.length)}P.ended=!0,x($)}}function x($){var P=$._readableState;P.needReadable=!1,P.emittedReadable||(M("emitReadable",P.flowing),P.emittedReadable=!0,P.sync?e.nextTick(o,$):o($))}function o($){M("emit readable"),$.emit("readable"),p($)}function f($,P){P.readingMore||(P.readingMore=!0,e.nextTick(l,$,P))}function l($,P){for(var W=P.length;!P.reading&&!P.flowing&&!P.ended&&P.length<P.highWaterMark&&(M("maybeReadMore read 0"),$.read(0),W!==P.length);)W=P.length;P.readingMore=!1}k.prototype._read=function($){this.emit("error",new Error("_read() is not implemented"))},k.prototype.pipe=function($,P){var W=this,G=this._readableState;switch(G.pipesCount){case 0:G.pipes=$;break;case 1:G.pipes=[G.pipes,$];break;default:G.pipes.push($);break}G.pipesCount+=1,M("pipe count=%d opts=%j",G.pipesCount,P);var K=(!P||P.end!==!1)&&$!==qe.stdout&&$!==qe.stderr,O=K?de:Le;G.endEmitted?e.nextTick(O):W.once("end",O),$.on("unpipe",Q);function Q(he,_e){M("onunpipe"),he===W&&_e&&_e.hasUnpiped===!1&&(_e.hasUnpiped=!0,Ie())}function de(){M("onend"),$.end()}var oe=h(W);$.on("drain",oe);var se=!1;function Ie(){M("cleanup"),$.removeListener("close",ae),$.removeListener("finish",le),$.removeListener("drain",oe),$.removeListener("error",je),$.removeListener("unpipe",Q),W.removeListener("end",de),W.removeListener("end",Le),W.removeListener("data",ne),se=!0,G.awaitDrain&&(!$._writableState||$._writableState.needDrain)&&oe()}var fe=!1;W.on("data",ne);function ne(he){M("ondata"),fe=!1;var _e=$.write(he);_e===!1&&!fe&&((G.pipesCount===1&&G.pipes===$||G.pipesCount>1&&H(G.pipes,$)!==-1)&&!se&&(M("false write response, pause",G.awaitDrain),G.awaitDrain++,fe=!0),W.pause())}function je(he){M("onerror",he),Le(),$.removeListener("error",je),n($,"error")===0&&$.emit("error",he)}I($,"error",je);function ae(){$.removeListener("finish",le),Le()}$.once("close",ae);function le(){M("onfinish"),$.removeListener("close",ae),Le()}$.once("finish",le);function Le(){M("unpipe"),W.unpipe($)}return $.emit("pipe",W),G.flowing||(M("pipe resume"),W.resume()),$};function h($){return function(){var P=$._readableState;M("pipeOnDrain",P.awaitDrain),P.awaitDrain&&P.awaitDrain--,P.awaitDrain===0&&n($,"data")&&(P.flowing=!0,p($))}}k.prototype.unpipe=function($){var P=this._readableState,W={hasUnpiped:!1};if(P.pipesCount===0)return this;if(P.pipesCount===1)return $&&$!==P.pipes?this:($||($=P.pipes),P.pipes=null,P.pipesCount=0,P.flowing=!1,$&&$.emit("unpipe",this,W),this);if(!$){var G=P.pipes,K=P.pipesCount;P.pipes=null,P.pipesCount=0,P.flowing=!1;for(var O=0;O<K;O++)G[O].emit("unpipe",this,{hasUnpiped:!1});return this}var Q=H(P.pipes,$);return Q===-1?this:(P.pipes.splice(Q,1),P.pipesCount-=1,P.pipesCount===1&&(P.pipes=P.pipes[0]),$.emit("unpipe",this,W),this)},k.prototype.on=function($,P){var W=s.prototype.on.call(this,$,P);if($==="data")this._readableState.flowing!==!1&&this.resume();else if($==="readable"){var G=this._readableState;!G.endEmitted&&!G.readableListening&&(G.readableListening=G.needReadable=!0,G.emittedReadable=!1,G.reading?G.length&&x(this):e.nextTick(v,this))}return W},k.prototype.addListener=k.prototype.on;function v($){M("readable nexttick read 0"),$.read(0)}k.prototype.resume=function(){var $=this._readableState;return $.flowing||(M("resume"),$.flowing=!0,y(this,$)),this};function y($,P){P.resumeScheduled||(P.resumeScheduled=!0,e.nextTick(m,$,P))}function m($,P){P.reading||(M("resume read 0"),$.read(0)),P.resumeScheduled=!1,P.awaitDrain=0,$.emit("resume"),p($),P.flowing&&!P.reading&&$.read(0)}k.prototype.pause=function(){return M("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(M("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function p($){var P=$._readableState;for(M("flow",P.flowing);P.flowing&&$.read()!==null;);}k.prototype.wrap=function($){var P=this,W=this._readableState,G=!1;$.on("end",function(){if(M("wrapped end"),W.decoder&&!W.ended){var Q=W.decoder.end();Q&&Q.length&&P.push(Q)}P.push(null)}),$.on("data",function(Q){if(M("wrapped data"),W.decoder&&(Q=W.decoder.write(Q)),!(W.objectMode&&Q==null)&&!(!W.objectMode&&(!Q||!Q.length))){var de=P.push(Q);de||(G=!0,$.pause())}});for(var K in $)this[K]===void 0&&typeof $[K]=="function"&&(this[K]=function(Q){return function(){return $[Q].apply($,arguments)}}(K));for(var O=0;O<B.length;O++)$.on(B[O],this.emit.bind(this,B[O]));return this._read=function(Q){M("wrapped _read",Q),G&&(G=!1,$.resume())},this},Object.defineProperty(k.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),k._fromList=a;function a($,P){if(P.length===0)return null;var W;return P.objectMode?W=P.buffer.shift():!$||$>=P.length?(P.decoder?W=P.buffer.join(""):P.buffer.length===1?W=P.buffer.head.data:W=P.buffer.concat(P.length),P.buffer.clear()):W=g($,P.buffer,P.decoder),W}function g($,P,W){var G;return $<P.head.data.length?(G=P.head.data.slice(0,$),P.head.data=P.head.data.slice($)):$===P.head.data.length?G=P.shift():G=W?S($,P):N($,P),G}function S($,P){var W=P.head,G=1,K=W.data;for($-=K.length;W=W.next;){var O=W.data,Q=$>O.length?O.length:$;if(Q===O.length?K+=O:K+=O.slice(0,$),$-=Q,$===0){Q===O.length?(++G,W.next?P.head=W.next:P.head=P.tail=null):(P.head=W,W.data=O.slice(Q));break}++G}return P.length-=G,K}function N($,P){var W=i.allocUnsafe($),G=P.head,K=1;for(G.data.copy(W),$-=G.data.length;G=G.next;){var O=G.data,Q=$>O.length?O.length:$;if(O.copy(W,W.length-$,0,Q),$-=Q,$===0){Q===O.length?(++K,G.next?P.head=G.next:P.head=P.tail=null):(P.head=G,G.data=O.slice(Q));break}++K}return P.length-=K,W}function U($){var P=$._readableState;if(P.length>0)throw new Error('"endReadable()" called on non-empty stream');P.endEmitted||(P.ended=!0,e.nextTick(Z,P,$))}function Z($,P){!$.endEmitted&&$.length===0&&($.endEmitted=!0,P.readable=!1,P.emit("end"))}function H($,P){for(var W=0,G=$.length;W<G;W++)if($[W]===P)return W;return-1}return z1}var Z9=wo,Bd=Yf(),G9=Object.create(Ot);G9.inherits=Fe;G9.inherits(wo,Bd);function DW(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,t!=null&&this.push(t),n(e);var s=this._readableState;s.reading=!1,(s.needReadable||s.length<s.highWaterMark)&&this._read(s.highWaterMark)}function wo(e){if(!(this instanceof wo))return new wo(e);Bd.call(this,e),this._transformState={afterTransform:DW.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",qW)}function qW(){var e=this;typeof this._flush=="function"?this._flush(function(t,r){m4(e,t,r)}):m4(this,null,null)}wo.prototype.push=function(e,t){return this._transformState.needTransform=!1,Bd.prototype.push.call(this,e,t)};wo.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")};wo.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var s=this._readableState;(n.needTransform||s.needReadable||s.length<s.highWaterMark)&&this._read(s.highWaterMark)}};wo.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};wo.prototype._destroy=function(e,t){var r=this;Bd.prototype._destroy.call(this,e,function(n){t(n),r.emit("close")})};function m4(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}var FW=qu,J9=Z9,Y9=Object.create(Ot);Y9.inherits=Fe;Y9.inherits(qu,J9);function qu(e){if(!(this instanceof qu))return new qu(e);J9.call(this,e)}qu.prototype._transform=function(e,t,r){r(null,e)};(function(e,t){t=e.exports=K9(),t.Stream=t,t.Readable=t,t.Writable=V9(),t.Duplex=Yf(),t.Transform=Z9,t.PassThrough=FW})(wy,wy.exports);var HW=wy.exports,zW=Ye.Buffer,WW=mW,X9=HW.Transform,VW=Fe;function Ls(e){X9.call(this),this._block=zW.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}VW(Ls,X9);Ls.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(s){n=s}r(n)};Ls.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(r){t=r}e(t)};Ls.prototype.update=function(e,t){if(this._finalized)throw new Error("Digest already called");for(var r=WW(e,t),n=this._block,s=0;this._blockOffset+r.length-s>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)n[i]=r[s],i+=1,s+=1;this._update(),this._blockOffset=0}for(;s<r.length;)n[this._blockOffset]=r[s],this._blockOffset+=1,s+=1;for(var u=0,d=r.length*8;d>0;++u)this._length[u]+=d,d=this._length[u]/4294967296|0,d>0&&(this._length[u]-=4294967296*d);return this};Ls.prototype._update=function(){throw new Error("_update is not implemented")};Ls.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();e!==void 0&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t};Ls.prototype._digest=function(){throw new Error("_digest is not implemented")};var KW=Ls,W1=Kt.Buffer,ZW=Fe,Q9=KW,GW=new Array(16),zl=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Wl=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Vl=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Kl=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Zl=[0,1518500249,1859775393,2400959708,2840853838],Gl=[1352829926,1548603684,1836072691,2053994217,0];function Ta(e,t){return e<<t|e>>>32-t}function w4(e,t,r,n,s,i,u,d){return Ta(e+(t^r^n)+i+u|0,d)+s|0}function b4(e,t,r,n,s,i,u,d){return Ta(e+(t&r|~t&n)+i+u|0,d)+s|0}function x4(e,t,r,n,s,i,u,d){return Ta(e+((t|~r)^n)+i+u|0,d)+s|0}function M4(e,t,r,n,s,i,u,d){return Ta(e+(t&n|r&~n)+i+u|0,d)+s|0}function _4(e,t,r,n,s,i,u,d){return Ta(e+(t^(r|~n))+i+u|0,d)+s|0}function Rd(){Q9.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}ZW(Rd,Q9);Rd.prototype._update=function(){for(var e=GW,t=0;t<16;++t)e[t]=this._block.readInt32LE(t*4);for(var r=this._a|0,n=this._b|0,s=this._c|0,i=this._d|0,u=this._e|0,d=this._a|0,c=this._b|0,b=this._c|0,w=this._d|0,M=this._e|0,_=0;_<80;_+=1){var A,R;_<16?(A=w4(r,n,s,i,u,e[zl[_]],Zl[0],Vl[_]),R=_4(d,c,b,w,M,e[Wl[_]],Gl[0],Kl[_])):_<32?(A=b4(r,n,s,i,u,e[zl[_]],Zl[1],Vl[_]),R=M4(d,c,b,w,M,e[Wl[_]],Gl[1],Kl[_])):_<48?(A=x4(r,n,s,i,u,e[zl[_]],Zl[2],Vl[_]),R=x4(d,c,b,w,M,e[Wl[_]],Gl[2],Kl[_])):_<64?(A=M4(r,n,s,i,u,e[zl[_]],Zl[3],Vl[_]),R=b4(d,c,b,w,M,e[Wl[_]],Gl[3],Kl[_])):(A=_4(r,n,s,i,u,e[zl[_]],Zl[4],Vl[_]),R=w4(d,c,b,w,M,e[Wl[_]],Gl[4],Kl[_])),r=u,u=i,i=Ta(s,10),s=n,n=A,d=M,M=w,w=Ta(b,10),b=c,c=R}var B=this._b+s+w|0;this._b=this._c+i+M|0,this._c=this._d+u+d|0,this._d=this._e+r+c|0,this._e=this._a+n+b|0,this._a=B};Rd.prototype._digest=function(){this._block[this._blockOffset]=128,this._blockOffset+=1,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=W1.alloc?W1.alloc(20):new W1(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};var gw=Rd,eS={exports:{}},JW=Ye.Buffer,YW=Ad;function $d(e,t){this._block=JW.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}$d.prototype.update=function(e,t){e=YW(e,t||"utf8");for(var r=this._block,n=this._blockSize,s=e.length,i=this._len,u=0;u<s;){for(var d=i%n,c=Math.min(s-u,n-d),b=0;b<c;b++)r[d+b]=e[u+b];i+=c,u+=c,i%n===0&&this._update(r)}return this._len+=s,this};$d.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,s=(r-n)/4294967296;this._block.writeUInt32BE(s,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var i=this._hash();return e?i.toString(e):i};$d.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Ml=$d,XW=Fe,tS=Ml,QW=Ye.Buffer,eV=[1518500249,1859775393,-1894007588,-899497514],tV=new Array(80);function sh(){this.init(),this._w=tV,tS.call(this,64,56)}XW(sh,tS);sh.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function rV(e){return e<<5|e>>>27}function nV(e){return e<<30|e>>>2}function iV(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}sh.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,s=this._c|0,i=this._d|0,u=this._e|0,d=0;d<16;++d)t[d]=e.readInt32BE(d*4);for(;d<80;++d)t[d]=t[d-3]^t[d-8]^t[d-14]^t[d-16];for(var c=0;c<80;++c){var b=~~(c/20),w=rV(r)+iV(b,n,s,i)+u+t[c]+eV[b]|0;u=i,i=s,s=nV(n),n=r,r=w}this._a=r+this._a|0,this._b=n+this._b|0,this._c=s+this._c|0,this._d=i+this._d|0,this._e=u+this._e|0};sh.prototype._hash=function(){var e=QW.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var oV=sh,sV=Fe,rS=Ml,aV=Ye.Buffer,fV=[1518500249,1859775393,-1894007588,-899497514],lV=new Array(80);function ah(){this.init(),this._w=lV,rS.call(this,64,56)}sV(ah,rS);ah.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function uV(e){return e<<1|e>>>31}function hV(e){return e<<5|e>>>27}function cV(e){return e<<30|e>>>2}function dV(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}ah.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,s=this._c|0,i=this._d|0,u=this._e|0,d=0;d<16;++d)t[d]=e.readInt32BE(d*4);for(;d<80;++d)t[d]=uV(t[d-3]^t[d-8]^t[d-14]^t[d-16]);for(var c=0;c<80;++c){var b=~~(c/20),w=hV(r)+dV(b,n,s,i)+u+t[c]+fV[b]|0;u=i,i=s,s=cV(n),n=r,r=w}this._a=r+this._a|0,this._b=n+this._b|0,this._c=s+this._c|0,this._d=i+this._d|0,this._e=u+this._e|0};ah.prototype._hash=function(){var e=aV.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var pV=ah,vV=Fe,nS=Ml,gV=Ye.Buffer,yV=[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],mV=new Array(64);function fh(){this.init(),this._w=mV,nS.call(this,64,56)}vV(fh,nS);fh.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function wV(e,t,r){return r^e&(t^r)}function bV(e,t,r){return e&t|r&(e|t)}function xV(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function MV(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function _V(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function EV(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}fh.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,s=this._c|0,i=this._d|0,u=this._e|0,d=this._f|0,c=this._g|0,b=this._h|0,w=0;w<16;++w)t[w]=e.readInt32BE(w*4);for(;w<64;++w)t[w]=EV(t[w-2])+t[w-7]+_V(t[w-15])+t[w-16]|0;for(var M=0;M<64;++M){var _=b+MV(u)+wV(u,d,c)+yV[M]+t[M]|0,A=xV(r)+bV(r,n,s)|0;b=c,c=d,d=u,u=i+_|0,i=s,s=n,n=r,r=_+A|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=s+this._c|0,this._d=i+this._d|0,this._e=u+this._e|0,this._f=d+this._f|0,this._g=c+this._g|0,this._h=b+this._h|0};fh.prototype._hash=function(){var e=gV.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var iS=fh,SV=Fe,AV=iS,kV=Ml,BV=Ye.Buffer,RV=new Array(64);function Nd(){this.init(),this._w=RV,kV.call(this,64,56)}SV(Nd,AV);Nd.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};Nd.prototype._hash=function(){var e=BV.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var $V=Nd,NV=Fe,oS=Ml,TV=Ye.Buffer,E4=[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],IV=new Array(160);function lh(){this.init(),this._w=IV,oS.call(this,128,112)}NV(lh,oS);lh.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function S4(e,t,r){return r^e&(t^r)}function A4(e,t,r){return e&t|r&(e|t)}function k4(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function B4(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function CV(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function PV(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function LV(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function OV(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function ar(e,t){return e>>>0<t>>>0?1:0}lh.prototype._update=function(e){for(var t=this._w,r=this._ah|0,n=this._bh|0,s=this._ch|0,i=this._dh|0,u=this._eh|0,d=this._fh|0,c=this._gh|0,b=this._hh|0,w=this._al|0,M=this._bl|0,_=this._cl|0,A=this._dl|0,R=this._el|0,B=this._fl|0,I=this._gl|0,E=this._hl|0,k=0;k<32;k+=2)t[k]=e.readInt32BE(k*4),t[k+1]=e.readInt32BE(k*4+4);for(;k<160;k+=2){var T=t[k-30],L=t[k-15*2+1],q=CV(T,L),z=PV(L,T);T=t[k-2*2],L=t[k-2*2+1];var J=LV(T,L),F=OV(L,T),X=t[k-7*2],ee=t[k-7*2+1],x=t[k-16*2],o=t[k-16*2+1],f=z+ee|0,l=q+X+ar(f,z)|0;f=f+F|0,l=l+J+ar(f,F)|0,f=f+o|0,l=l+x+ar(f,o)|0,t[k]=l,t[k+1]=f}for(var h=0;h<160;h+=2){l=t[h],f=t[h+1];var v=A4(r,n,s),y=A4(w,M,_),m=k4(r,w),p=k4(w,r),a=B4(u,R),g=B4(R,u),S=E4[h],N=E4[h+1],U=S4(u,d,c),Z=S4(R,B,I),H=E+g|0,$=b+a+ar(H,E)|0;H=H+Z|0,$=$+U+ar(H,Z)|0,H=H+N|0,$=$+S+ar(H,N)|0,H=H+f|0,$=$+l+ar(H,f)|0;var P=p+y|0,W=m+v+ar(P,p)|0;b=c,E=I,c=d,I=B,d=u,B=R,R=A+H|0,u=i+$+ar(R,A)|0,i=s,A=_,s=n,_=M,n=r,M=w,w=H+P|0,r=$+W+ar(w,H)|0}this._al=this._al+w|0,this._bl=this._bl+M|0,this._cl=this._cl+_|0,this._dl=this._dl+A|0,this._el=this._el+R|0,this._fl=this._fl+B|0,this._gl=this._gl+I|0,this._hl=this._hl+E|0,this._ah=this._ah+r+ar(this._al,w)|0,this._bh=this._bh+n+ar(this._bl,M)|0,this._ch=this._ch+s+ar(this._cl,_)|0,this._dh=this._dh+i+ar(this._dl,A)|0,this._eh=this._eh+u+ar(this._el,R)|0,this._fh=this._fh+d+ar(this._fl,B)|0,this._gh=this._gh+c+ar(this._gl,I)|0,this._hh=this._hh+b+ar(this._hl,E)|0};lh.prototype._hash=function(){var e=TV.allocUnsafe(64);function t(r,n,s){e.writeInt32BE(r,s),e.writeInt32BE(n,s+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var sS=lh,UV=Fe,jV=sS,DV=Ml,qV=Ye.Buffer,FV=new Array(160);function Td(){this.init(),this._w=FV,DV.call(this,128,112)}UV(Td,jV);Td.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};Td.prototype._hash=function(){var e=qV.allocUnsafe(48);function t(r,n,s){e.writeInt32BE(r,s),e.writeInt32BE(n,s+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var HV=Td;(function(e){e.exports=function(r){var n=r.toLowerCase(),s=e.exports[n];if(!s)throw new Error(n+" is not supported (we accept pull requests)");return new s},e.exports.sha=oV,e.exports.sha1=pV,e.exports.sha224=$V,e.exports.sha256=iS,e.exports.sha384=HV,e.exports.sha512=sS})(eS);var yw=eS.exports,zV=Ye.Buffer,aS=j9.Transform,WV=m0.StringDecoder,VV=Fe,KV=Ad;function ti(e){aS.call(this),this.hashMode=typeof e=="string",this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}VV(ti,aS);ti.prototype.update=function(e,t,r){var n=KV(e,t),s=this._update(n);return this.hashMode?this:(r&&(s=this._toString(s,r)),s)};ti.prototype.setAutoPadding=function(){};ti.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};ti.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};ti.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};ti.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(s){n=s}finally{r(n)}};ti.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(r){t=r}e(t)};ti.prototype._finalOrDigest=function(e){var t=this.__final()||zV.alloc(0);return e&&(t=this._toString(t,e,!0)),t};ti.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new WV(t),this._encoding=t),this._encoding!==t)throw new Error("can’t switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n};var Os=ti,ZV=Fe,GV=pw,JV=gw,YV=yw,fS=Os;function Id(e){fS.call(this,"digest"),this._hash=e}ZV(Id,fS);Id.prototype._update=function(e){this._hash.update(e)};Id.prototype._final=function(){return this._hash.digest()};var uh=function(t){return t=t.toLowerCase(),t==="md5"?new GV:t==="rmd160"||t==="ripemd160"?new JV:new Id(YV(t))},XV=Fe,da=Ye.Buffer,lS=Os,QV=da.alloc(128),Ya=64;function Cd(e,t){lS.call(this,"digest"),typeof t=="string"&&(t=da.from(t)),this._alg=e,this._key=t,t.length>Ya?t=e(t):t.length<Ya&&(t=da.concat([t,QV],Ya));for(var r=this._ipad=da.allocUnsafe(Ya),n=this._opad=da.allocUnsafe(Ya),s=0;s<Ya;s++)r[s]=t[s]^54,n[s]=t[s]^92;this._hash=[r]}XV(Cd,lS);Cd.prototype._update=function(e){this._hash.push(e)};Cd.prototype._final=function(){var e=this._alg(da.concat(this._hash));return this._alg(da.concat([this._opad,e]))};var eK=Cd,tK=pw,uS=function(e){return new tK().update(e).digest()},rK=Fe,nK=eK,hS=Os,ou=Ye.Buffer,iK=uS,My=gw,_y=yw,oK=ou.alloc(128);function Fu(e,t){hS.call(this,"digest"),typeof t=="string"&&(t=ou.from(t));var r=e==="sha512"||e==="sha384"?128:64;if(this._alg=e,this._key=t,t.length>r){var n=e==="rmd160"?new My:_y(e);t=n.update(t).digest()}else t.length<r&&(t=ou.concat([t,oK],r));for(var s=this._ipad=ou.allocUnsafe(r),i=this._opad=ou.allocUnsafe(r),u=0;u<r;u++)s[u]=t[u]^54,i[u]=t[u]^92;this._hash=e==="rmd160"?new My:_y(e),this._hash.update(s)}rK(Fu,hS);Fu.prototype._update=function(e){this._hash.update(e)};Fu.prototype._final=function(){var e=this._hash.digest(),t=this._alg==="rmd160"?new My:_y(this._alg);return t.update(this._opad).update(e).digest()};var cS=function(t,r){return t=t.toLowerCase(),t==="rmd160"||t==="ripemd160"?new Fu("rmd160",r):t==="md5"?new nK(iK,r):new Fu(t,r)};const sK={sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},aK={sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},fK={sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},lK={sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},uK={sign:"ecdsa",hash:"sha256",id:""},hK={sign:"ecdsa",hash:"sha224",id:""},cK={sign:"ecdsa",hash:"sha384",id:""},dK={sign:"ecdsa",hash:"sha512",id:""},pK={sign:"dsa",hash:"sha1",id:""},vK={sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},gK={sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},dS={sha224WithRSAEncryption:sK,"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:aK,"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:fK,"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:lK,"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:uK,sha224:hK,sha384:cK,sha512:dK,"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:pK,"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:vK,"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:gK,"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}};var yK=dS,Pd={},mK=isFinite,wK=Math.pow(2,30)-1,pS=function(e,t){if(typeof e!="number")throw new TypeError("Iterations not a number");if(e<0||!mK(e))throw new TypeError("Bad iterations");if(typeof t!="number")throw new TypeError("Key length not a number");if(t<0||t>wK||t!==t)throw new TypeError("Bad key length")},Sc;if(Ve.process&&Ve.process.browser)Sc="utf-8";else if(Ve.process&&Ve.process.version){var bK=parseInt(qe.version.split(".")[0].slice(1),10);Sc=bK>=6?"utf-8":"binary"}else Sc="utf-8";var vS=Sc,xK=Ye.Buffer,MK=Ad,gS=typeof Uint8Array<"u",_K=gS&&typeof ArrayBuffer<"u",R4=_K&&ArrayBuffer.isView,yS=function(e,t,r){if(typeof e=="string"||xK.isBuffer(e)||gS&&e instanceof Uint8Array||R4&&R4(e))return MK(e,t);throw new TypeError(r+" must be a string, a Buffer, a Uint8Array, or a DataView")},EK=uS,SK=gw,AK=yw,pa=Ye.Buffer,kK=pS,$4=vS,N4=yS,BK=pa.alloc(128),Ac={__proto__:null,md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,"sha512-256":32,ripemd160:20,rmd160:20},RK={__proto__:null,"sha-1":"sha1","sha-224":"sha224","sha-256":"sha256","sha-384":"sha384","sha-512":"sha512","ripemd-160":"ripemd160"};function $K(e){return new SK().update(e).digest()}function NK(e){function t(r){return AK(e).update(r).digest()}return e==="rmd160"||e==="ripemd160"?$K:e==="md5"?EK:t}function mS(e,t,r){var n=NK(e),s=e==="sha512"||e==="sha384"?128:64;t.length>s?t=n(t):t.length<s&&(t=pa.concat([t,BK],s));for(var i=pa.allocUnsafe(s+Ac[e]),u=pa.allocUnsafe(s+Ac[e]),d=0;d<s;d++)i[d]=t[d]^54,u[d]=t[d]^92;var c=pa.allocUnsafe(s+r+4);i.copy(c,0,0,s),this.ipad1=c,this.ipad2=i,this.opad=u,this.alg=e,this.blocksize=s,this.hash=n,this.size=Ac[e]}mS.prototype.run=function(e,t){e.copy(t,this.blocksize);var r=this.hash(t);return r.copy(this.opad,this.blocksize),this.hash(this.opad)};function TK(e,t,r,n,s){kK(r,n),e=N4(e,$4,"Password"),t=N4(t,$4,"Salt");var i=(s||"sha1").toLowerCase(),u=RK[i]||i,d=Ac[u];if(typeof d!="number"||!d)throw new TypeError("Digest algorithm not supported: "+s);var c=new mS(u,e,t.length),b=pa.allocUnsafe(n),w=pa.allocUnsafe(t.length+4);t.copy(w,0,0,t.length);for(var M=0,_=d,A=Math.ceil(n/_),R=1;R<=A;R++){w.writeUInt32BE(R,t.length);for(var B=c.run(w,c.ipad1),I=B,E=1;E<r;E++){I=c.run(I,c.ipad2);for(var k=0;k<_;k++)B[k]^=I[k]}B.copy(b,M),M+=_}return b}var wS=TK,bS=Ye.Buffer,IK=pS,T4=vS,I4=wS,C4=yS,Wh,yu=Ve.crypto&&Ve.crypto.subtle,CK={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},V1=[],zs;function Ey(){return zs||(Ve.process&&Ve.process.nextTick?zs=Ve.process.nextTick:Ve.queueMicrotask?zs=Ve.queueMicrotask:Ve.setImmediate?zs=Ve.setImmediate:zs=Ve.setTimeout,zs)}function xS(e,t,r,n,s){return yu.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then(function(i){return yu.deriveBits({name:"PBKDF2",salt:t,iterations:r,hash:{name:s}},i,n<<3)}).then(function(i){return bS.from(i)})}function PK(e){if(Ve.process&&!Ve.process.browser||!yu||!yu.importKey||!yu.deriveBits)return Promise.resolve(!1);if(V1[e]!==void 0)return V1[e];Wh=Wh||bS.alloc(8);var t=xS(Wh,Wh,10,128,e).then(function(){return!0},function(){return!1});return V1[e]=t,t}function LK(e,t){e.then(function(r){Ey()(function(){t(null,r)})},function(r){Ey()(function(){t(r)})})}var OK=function(e,t,r,n,s,i){if(typeof s=="function"&&(i=s,s=void 0),IK(r,n),e=C4(e,T4,"Password"),t=C4(t,T4,"Salt"),typeof i!="function")throw new Error("No callback provided to pbkdf2");s=s||"sha1";var u=CK[s.toLowerCase()];if(!u||typeof Ve.Promise!="function"){Ey()(function(){var d;try{d=I4(e,t,r,n,s)}catch(c){i(c);return}i(null,d)});return}LK(PK(u).then(function(d){return d?xS(e,t,r,n,u):I4(e,t,r,n,s)}),i)};Pd.pbkdf2=OK;Pd.pbkdf2Sync=wS;var Xn={},_l={},gn={};gn.readUInt32BE=function(t,r){var n=t[0+r]<<24|t[1+r]<<16|t[2+r]<<8|t[3+r];return n>>>0};gn.writeUInt32BE=function(t,r,n){t[0+n]=r>>>24,t[1+n]=r>>>16&255,t[2+n]=r>>>8&255,t[3+n]=r&255};gn.ip=function(t,r,n,s){for(var i=0,u=0,d=6;d>=0;d-=2){for(var c=0;c<=24;c+=8)i<<=1,i|=r>>>c+d&1;for(var c=0;c<=24;c+=8)i<<=1,i|=t>>>c+d&1}for(var d=6;d>=0;d-=2){for(var c=1;c<=25;c+=8)u<<=1,u|=r>>>c+d&1;for(var c=1;c<=25;c+=8)u<<=1,u|=t>>>c+d&1}n[s+0]=i>>>0,n[s+1]=u>>>0};gn.rip=function(t,r,n,s){for(var i=0,u=0,d=0;d<4;d++)for(var c=24;c>=0;c-=8)i<<=1,i|=r>>>c+d&1,i<<=1,i|=t>>>c+d&1;for(var d=4;d<8;d++)for(var c=24;c>=0;c-=8)u<<=1,u|=r>>>c+d&1,u<<=1,u|=t>>>c+d&1;n[s+0]=i>>>0,n[s+1]=u>>>0};gn.pc1=function(t,r,n,s){for(var i=0,u=0,d=7;d>=5;d--){for(var c=0;c<=24;c+=8)i<<=1,i|=r>>c+d&1;for(var c=0;c<=24;c+=8)i<<=1,i|=t>>c+d&1}for(var c=0;c<=24;c+=8)i<<=1,i|=r>>c+d&1;for(var d=1;d<=3;d++){for(var c=0;c<=24;c+=8)u<<=1,u|=r>>c+d&1;for(var c=0;c<=24;c+=8)u<<=1,u|=t>>c+d&1}for(var c=0;c<=24;c+=8)u<<=1,u|=t>>c+d&1;n[s+0]=i>>>0,n[s+1]=u>>>0};gn.r28shl=function(t,r){return t<<r&268435455|t>>>28-r};var Vh=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];gn.pc2=function(t,r,n,s){for(var i=0,u=0,d=Vh.length>>>1,c=0;c<d;c++)i<<=1,i|=t>>>Vh[c]&1;for(var c=d;c<Vh.length;c++)u<<=1,u|=r>>>Vh[c]&1;n[s+0]=i>>>0,n[s+1]=u>>>0};gn.expand=function(t,r,n){var s=0,i=0;s=(t&1)<<5|t>>>27;for(var u=23;u>=15;u-=4)s<<=6,s|=t>>>u&63;for(var u=11;u>=3;u-=4)i|=t>>>u&63,i<<=6;i|=(t&31)<<1|t>>>31,r[n+0]=s>>>0,r[n+1]=i>>>0};var P4=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];gn.substitute=function(t,r){for(var n=0,s=0;s<4;s++){var i=t>>>18-s*6&63,u=P4[s*64+i];n<<=4,n|=u}for(var s=0;s<4;s++){var i=r>>>18-s*6&63,u=P4[4*64+s*64+i];n<<=4,n|=u}return n>>>0};var L4=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];gn.permute=function(t){for(var r=0,n=0;n<L4.length;n++)r<<=1,r|=t>>>L4[n]&1;return r>>>0};gn.padSplit=function(t,r,n){for(var s=t.toString(2);s.length<r;)s="0"+s;for(var i=[],u=0;u<r;u+=n)i.push(s.slice(u,u+n));return i.join(" ")};var Pn=MS;function MS(e,t){if(!e)throw new Error(t||"Assertion failed")}MS.equal=function(t,r,n){if(t!=r)throw new Error(n||"Assertion failed: "+t+" != "+r)};var UK=Pn;function Ln(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=e.padding!==!1}var mw=Ln;Ln.prototype._init=function(){};Ln.prototype.update=function(t){return t.length===0?[]:this.type==="decrypt"?this._updateDecrypt(t):this._updateEncrypt(t)};Ln.prototype._buffer=function(t,r){for(var n=Math.min(this.buffer.length-this.bufferOff,t.length-r),s=0;s<n;s++)this.buffer[this.bufferOff+s]=t[r+s];return this.bufferOff+=n,n};Ln.prototype._flushBuffer=function(t,r){return this._update(this.buffer,0,t,r),this.bufferOff=0,this.blockSize};Ln.prototype._updateEncrypt=function(t){var r=0,n=0,s=(this.bufferOff+t.length)/this.blockSize|0,i=new Array(s*this.blockSize);this.bufferOff!==0&&(r+=this._buffer(t,r),this.bufferOff===this.buffer.length&&(n+=this._flushBuffer(i,n)));for(var u=t.length-(t.length-r)%this.blockSize;r<u;r+=this.blockSize)this._update(t,r,i,n),n+=this.blockSize;for(;r<t.length;r++,this.bufferOff++)this.buffer[this.bufferOff]=t[r];return i};Ln.prototype._updateDecrypt=function(t){for(var r=0,n=0,s=Math.ceil((this.bufferOff+t.length)/this.blockSize)-1,i=new Array(s*this.blockSize);s>0;s--)r+=this._buffer(t,r),n+=this._flushBuffer(i,n);return r+=this._buffer(t,r),i};Ln.prototype.final=function(t){var r;t&&(r=this.update(t));var n;return this.type==="encrypt"?n=this._finalEncrypt():n=this._finalDecrypt(),r?r.concat(n):n};Ln.prototype._pad=function(t,r){if(r===0)return!1;for(;r<t.length;)t[r++]=0;return!0};Ln.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var t=new Array(this.blockSize);return this._update(this.buffer,0,t,0),t};Ln.prototype._unpad=function(t){return t};Ln.prototype._finalDecrypt=function(){UK.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var t=new Array(this.blockSize);return this._flushBuffer(t,0),this._unpad(t)};var _S=Pn,jK=Fe,or=gn,ES=mw;function DK(){this.tmp=new Array(2),this.keys=null}function Ti(e){ES.call(this,e);var t=new DK;this._desState=t,this.deriveKeys(t,e.key)}jK(Ti,ES);var SS=Ti;Ti.create=function(t){return new Ti(t)};var qK=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];Ti.prototype.deriveKeys=function(t,r){t.keys=new Array(16*2),_S.equal(r.length,this.blockSize,"Invalid key length");var n=or.readUInt32BE(r,0),s=or.readUInt32BE(r,4);or.pc1(n,s,t.tmp,0),n=t.tmp[0],s=t.tmp[1];for(var i=0;i<t.keys.length;i+=2){var u=qK[i>>>1];n=or.r28shl(n,u),s=or.r28shl(s,u),or.pc2(n,s,t.keys,i)}};Ti.prototype._update=function(t,r,n,s){var i=this._desState,u=or.readUInt32BE(t,r),d=or.readUInt32BE(t,r+4);or.ip(u,d,i.tmp,0),u=i.tmp[0],d=i.tmp[1],this.type==="encrypt"?this._encrypt(i,u,d,i.tmp,0):this._decrypt(i,u,d,i.tmp,0),u=i.tmp[0],d=i.tmp[1],or.writeUInt32BE(n,u,s),or.writeUInt32BE(n,d,s+4)};Ti.prototype._pad=function(t,r){if(this.padding===!1)return!1;for(var n=t.length-r,s=r;s<t.length;s++)t[s]=n;return!0};Ti.prototype._unpad=function(t){if(this.padding===!1)return t;for(var r=t[t.length-1],n=t.length-r;n<t.length;n++)_S.equal(t[n],r);return t.slice(0,t.length-r)};Ti.prototype._encrypt=function(t,r,n,s,i){for(var u=r,d=n,c=0;c<t.keys.length;c+=2){var b=t.keys[c],w=t.keys[c+1];or.expand(d,t.tmp,0),b^=t.tmp[0],w^=t.tmp[1];var M=or.substitute(b,w),_=or.permute(M),A=d;d=(u^_)>>>0,u=A}or.rip(d,u,s,i)};Ti.prototype._decrypt=function(t,r,n,s,i){for(var u=n,d=r,c=t.keys.length-2;c>=0;c-=2){var b=t.keys[c],w=t.keys[c+1];or.expand(u,t.tmp,0),b^=t.tmp[0],w^=t.tmp[1];var M=or.substitute(b,w),_=or.permute(M),A=u;u=(d^_)>>>0,d=A}or.rip(u,d,s,i)};var AS={},FK=Pn,HK=Fe,w0={};function zK(e){FK.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var t=0;t<this.iv.length;t++)this.iv[t]=e[t]}function WK(e){function t(i){e.call(this,i),this._cbcInit()}HK(t,e);for(var r=Object.keys(w0),n=0;n<r.length;n++){var s=r[n];t.prototype[s]=w0[s]}return t.create=function(u){return new t(u)},t}AS.instantiate=WK;w0._cbcInit=function(){var t=new zK(this.options.iv);this._cbcState=t};w0._update=function(t,r,n,s){var i=this._cbcState,u=this.constructor.super_.prototype,d=i.iv;if(this.type==="encrypt"){for(var c=0;c<this.blockSize;c++)d[c]^=t[r+c];u._update.call(this,d,0,n,s);for(var c=0;c<this.blockSize;c++)d[c]=n[s+c]}else{u._update.call(this,t,r,n,s);for(var c=0;c<this.blockSize;c++)n[s+c]^=d[c];for(var c=0;c<this.blockSize;c++)d[c]=t[r+c]}};var VK=Pn,KK=Fe,kS=mw,es=SS;function ZK(e,t){VK.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),n=t.slice(8,16),s=t.slice(16,24);e==="encrypt"?this.ciphers=[es.create({type:"encrypt",key:r}),es.create({type:"decrypt",key:n}),es.create({type:"encrypt",key:s})]:this.ciphers=[es.create({type:"decrypt",key:s}),es.create({type:"encrypt",key:n}),es.create({type:"decrypt",key:r})]}function Ia(e){kS.call(this,e);var t=new ZK(this.type,this.options.key);this._edeState=t}KK(Ia,kS);var GK=Ia;Ia.create=function(t){return new Ia(t)};Ia.prototype._update=function(t,r,n,s){var i=this._edeState;i.ciphers[0]._update(t,r,n,s),i.ciphers[1]._update(n,s,n,s),i.ciphers[2]._update(n,s,n,s)};Ia.prototype._pad=es.prototype._pad;Ia.prototype._unpad=es.prototype._unpad;_l.utils=gn;_l.Cipher=mw;_l.DES=SS;_l.CBC=AS;_l.EDE=GK;var BS=Os,qi=_l,JK=Fe,ia=Ye.Buffer,Hu={"des-ede3-cbc":qi.CBC.instantiate(qi.EDE),"des-ede3":qi.EDE,"des-ede-cbc":qi.CBC.instantiate(qi.EDE),"des-ede":qi.EDE,"des-cbc":qi.CBC.instantiate(qi.DES),"des-ecb":qi.DES};Hu.des=Hu["des-cbc"];Hu.des3=Hu["des-ede3-cbc"];var YK=Ld;JK(Ld,BS);function Ld(e){BS.call(this);var t=e.mode.toLowerCase(),r=Hu[t],n;e.decrypt?n="decrypt":n="encrypt";var s=e.key;ia.isBuffer(s)||(s=ia.from(s)),(t==="des-ede"||t==="des-ede-cbc")&&(s=ia.concat([s,s.slice(0,8)]));var i=e.iv;ia.isBuffer(i)||(i=ia.from(i)),this._des=r.create({key:s,iv:i,type:n})}Ld.prototype._update=function(e){return ia.from(this._des.update(e))};Ld.prototype._final=function(){return ia.from(this._des.final())};var dn={},ww={},bw={};bw.encrypt=function(e,t){return e._cipher.encryptBlock(t)};bw.decrypt=function(e,t){return e._cipher.decryptBlock(t)};var xw={},hh=function(t,r){for(var n=Math.min(t.length,r.length),s=new ht(n),i=0;i<n;++i)s[i]=t[i]^r[i];return s},RS=hh;xw.encrypt=function(e,t){var r=RS(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev};xw.decrypt=function(e,t){var r=e._prev;e._prev=t;var n=e._cipher.decryptBlock(t);return RS(n,r)};var $S={},su=Ye.Buffer,XK=hh;function O4(e,t,r){var n=t.length,s=XK(t,e._cache);return e._cache=e._cache.slice(n),e._prev=su.concat([e._prev,r?t:s]),s}$S.encrypt=function(e,t,r){for(var n=su.allocUnsafe(0),s;t.length;)if(e._cache.length===0&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=su.allocUnsafe(0)),e._cache.length<=t.length)s=e._cache.length,n=su.concat([n,O4(e,t.slice(0,s),r)]),t=t.slice(s);else{n=su.concat([n,O4(e,t,r)]);break}return n};var NS={},Sy=Ye.Buffer;function QK(e,t,r){var n=e._cipher.encryptBlock(e._prev),s=n[0]^t;return e._prev=Sy.concat([e._prev.slice(1),Sy.from([r?t:s])]),s}NS.encrypt=function(e,t,r){for(var n=t.length,s=Sy.allocUnsafe(n),i=-1;++i<n;)s[i]=QK(e,t[i],r);return s};var TS={},kc=Ye.Buffer;function eZ(e,t,r){for(var n,s=-1,i=8,u=0,d,c;++s<i;)n=e._cipher.encryptBlock(e._prev),d=t&1<<7-s?128:0,c=n[0]^d,u+=(c&128)>>s%8,e._prev=tZ(e._prev,r?d:c);return u}function tZ(e,t){var r=e.length,n=-1,s=kc.allocUnsafe(e.length);for(e=kc.concat([e,kc.from([t])]);++n<r;)s[n]=e[n]<<1|e[n+1]>>7;return s}TS.encrypt=function(e,t,r){for(var n=t.length,s=kc.allocUnsafe(n),i=-1;++i<n;)s[i]=eZ(e,t[i],r);return s};var IS={},rZ=hh;function nZ(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}IS.encrypt=function(e,t){for(;e._cache.length<t.length;)e._cache=ht.concat([e._cache,nZ(e)]);var r=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),rZ(t,r)};var Ay={};function iZ(e){for(var t=e.length,r;t--;)if(r=e.readUInt8(t),r===255)e.writeUInt8(0,t);else{r++,e.writeUInt8(r,t);break}}var CS=iZ,oZ=hh,U4=Ye.Buffer,sZ=CS;function aZ(e){var t=e._cipher.encryptBlockRaw(e._prev);return sZ(e._prev),t}var K1=16;Ay.encrypt=function(e,t){var r=Math.ceil(t.length/K1),n=e._cache.length;e._cache=U4.concat([e._cache,U4.allocUnsafe(r*K1)]);for(var s=0;s<r;s++){var i=aZ(e),u=n+s*K1;e._cache.writeUInt32BE(i[0],u+0),e._cache.writeUInt32BE(i[1],u+4),e._cache.writeUInt32BE(i[2],u+8),e._cache.writeUInt32BE(i[3],u+12)}var d=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),oZ(t,d)};const fZ={cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},lZ={cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},uZ={cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},PS={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:fZ,aes192:lZ,aes256:uZ,"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}};var hZ={ECB:bw,CBC:xw,CFB:$S,CFB8:NS,CFB1:TS,OFB:IS,CTR:Ay,GCM:Ay},Bc=PS;for(var j4 in Bc)Bc[j4].module=hZ[Bc[j4].mode];var Mw=Bc,ch={},b0=Ye.Buffer;function _w(e){b0.isBuffer(e)||(e=b0.from(e));for(var t=e.length/4|0,r=new Array(t),n=0;n<t;n++)r[n]=e.readUInt32BE(n*4);return r}function Z1(e){for(var t=0;t<e.length;e++)e[t]=0}function LS(e,t,r,n,s){for(var i=r[0],u=r[1],d=r[2],c=r[3],b=e[0]^t[0],w=e[1]^t[1],M=e[2]^t[2],_=e[3]^t[3],A,R,B,I,E=4,k=1;k<s;k++)A=i[b>>>24]^u[w>>>16&255]^d[M>>>8&255]^c[_&255]^t[E++],R=i[w>>>24]^u[M>>>16&255]^d[_>>>8&255]^c[b&255]^t[E++],B=i[M>>>24]^u[_>>>16&255]^d[b>>>8&255]^c[w&255]^t[E++],I=i[_>>>24]^u[b>>>16&255]^d[w>>>8&255]^c[M&255]^t[E++],b=A,w=R,M=B,_=I;return A=(n[b>>>24]<<24|n[w>>>16&255]<<16|n[M>>>8&255]<<8|n[_&255])^t[E++],R=(n[w>>>24]<<24|n[M>>>16&255]<<16|n[_>>>8&255]<<8|n[b&255])^t[E++],B=(n[M>>>24]<<24|n[_>>>16&255]<<16|n[b>>>8&255]<<8|n[w&255])^t[E++],I=(n[_>>>24]<<24|n[b>>>16&255]<<16|n[w>>>8&255]<<8|n[M&255])^t[E++],A=A>>>0,R=R>>>0,B=B>>>0,I=I>>>0,[A,R,B,I]}var cZ=[0,1,2,4,8,16,32,64,128,27,54],er=function(){for(var e=new Array(256),t=0;t<256;t++)t<128?e[t]=t<<1:e[t]=t<<1^283;for(var r=[],n=[],s=[[],[],[],[]],i=[[],[],[],[]],u=0,d=0,c=0;c<256;++c){var b=d^d<<1^d<<2^d<<3^d<<4;b=b>>>8^b&255^99,r[u]=b,n[b]=u;var w=e[u],M=e[w],_=e[M],A=e[b]*257^b*16843008;s[0][u]=A<<24|A>>>8,s[1][u]=A<<16|A>>>16,s[2][u]=A<<8|A>>>24,s[3][u]=A,A=_*16843009^M*65537^w*257^u*16843008,i[0][b]=A<<24|A>>>8,i[1][b]=A<<16|A>>>16,i[2][b]=A<<8|A>>>24,i[3][b]=A,u===0?u=d=1:(u=w^e[e[e[_^w]]],d^=e[e[d]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:s,INV_SUB_MIX:i}}();function Cn(e){this._key=_w(e),this._reset()}Cn.blockSize=4*4;Cn.keySize=256/8;Cn.prototype.blockSize=Cn.blockSize;Cn.prototype.keySize=Cn.keySize;Cn.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,n=(r+1)*4,s=[],i=0;i<t;i++)s[i]=e[i];for(i=t;i<n;i++){var u=s[i-1];i%t===0?(u=u<<8|u>>>24,u=er.SBOX[u>>>24]<<24|er.SBOX[u>>>16&255]<<16|er.SBOX[u>>>8&255]<<8|er.SBOX[u&255],u^=cZ[i/t|0]<<24):t>6&&i%t===4&&(u=er.SBOX[u>>>24]<<24|er.SBOX[u>>>16&255]<<16|er.SBOX[u>>>8&255]<<8|er.SBOX[u&255]),s[i]=s[i-t]^u}for(var d=[],c=0;c<n;c++){var b=n-c,w=s[b-(c%4?0:4)];c<4||b<=4?d[c]=w:d[c]=er.INV_SUB_MIX[0][er.SBOX[w>>>24]]^er.INV_SUB_MIX[1][er.SBOX[w>>>16&255]]^er.INV_SUB_MIX[2][er.SBOX[w>>>8&255]]^er.INV_SUB_MIX[3][er.SBOX[w&255]]}this._nRounds=r,this._keySchedule=s,this._invKeySchedule=d};Cn.prototype.encryptBlockRaw=function(e){return e=_w(e),LS(e,this._keySchedule,er.SUB_MIX,er.SBOX,this._nRounds)};Cn.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=b0.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r};Cn.prototype.decryptBlock=function(e){e=_w(e);var t=e[1];e[1]=e[3],e[3]=t;var r=LS(e,this._invKeySchedule,er.INV_SUB_MIX,er.INV_SBOX,this._nRounds),n=b0.allocUnsafe(16);return n.writeUInt32BE(r[0],0),n.writeUInt32BE(r[3],4),n.writeUInt32BE(r[2],8),n.writeUInt32BE(r[1],12),n};Cn.prototype.scrub=function(){Z1(this._keySchedule),Z1(this._invKeySchedule),Z1(this._key)};ch.AES=Cn;var Xf=Ye.Buffer,dZ=Xf.alloc(16,0);function pZ(e){return[e.readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)]}function OS(e){var t=Xf.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function dh(e){this.h=e,this.state=Xf.alloc(16,0),this.cache=Xf.allocUnsafe(0)}dh.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()};dh.prototype._multiply=function(){for(var e=pZ(this.h),t=[0,0,0,0],r,n,s,i=-1;++i<128;){for(n=(this.state[~~(i/8)]&1<<7-i%8)!==0,n&&(t[0]^=e[0],t[1]^=e[1],t[2]^=e[2],t[3]^=e[3]),s=(e[3]&1)!==0,r=3;r>0;r--)e[r]=e[r]>>>1|(e[r-1]&1)<<31;e[0]=e[0]>>>1,s&&(e[0]=e[0]^225<<24)}this.state=OS(t)};dh.prototype.update=function(e){this.cache=Xf.concat([this.cache,e]);for(var t;this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)};dh.prototype.final=function(e,t){return this.cache.length&&this.ghash(Xf.concat([this.cache,dZ],16)),this.ghash(OS([0,e,0,t])),this.state};var vZ=dh,gZ=ch,Zr=Ye.Buffer,US=Os,yZ=Fe,jS=vZ,mZ=hh,wZ=CS;function bZ(e,t){var r=0;e.length!==t.length&&r++;for(var n=Math.min(e.length,t.length),s=0;s<n;++s)r+=e[s]^t[s];return r}function xZ(e,t,r){if(t.length===12)return e._finID=Zr.concat([t,Zr.from([0,0,0,1])]),Zr.concat([t,Zr.from([0,0,0,2])]);var n=new jS(r),s=t.length,i=s%16;n.update(t),i&&(i=16-i,n.update(Zr.alloc(i,0))),n.update(Zr.alloc(8,0));var u=s*8,d=Zr.alloc(8);d.writeUIntBE(u,0,8),n.update(d),e._finID=n.state;var c=Zr.from(e._finID);return wZ(c),c}function za(e,t,r,n){US.call(this);var s=Zr.alloc(4,0);this._cipher=new gZ.AES(t);var i=this._cipher.encryptBlock(s);this._ghash=new jS(i),r=xZ(this,r,i),this._prev=Zr.from(r),this._cache=Zr.allocUnsafe(0),this._secCache=Zr.allocUnsafe(0),this._decrypt=n,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}yZ(za,US);za.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=Zr.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r};za.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=mZ(this._ghash.final(this._alen*8,this._len*8),this._cipher.encryptBlock(this._finID));if(this._decrypt&&bZ(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()};za.prototype.getAuthTag=function(){if(this._decrypt||!Zr.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag};za.prototype.setAuthTag=function(t){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=t};za.prototype.setAAD=function(t){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(t),this._alen+=t.length};var DS=za,MZ=ch,G1=Ye.Buffer,qS=Os,_Z=Fe;function Od(e,t,r,n){qS.call(this),this._cipher=new MZ.AES(t),this._prev=G1.from(r),this._cache=G1.allocUnsafe(0),this._secCache=G1.allocUnsafe(0),this._decrypt=n,this._mode=e}_Z(Od,qS);Od.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)};Od.prototype._final=function(){this._cipher.scrub()};var FS=Od,Ws=Ye.Buffer,EZ=pw;function SZ(e,t,r,n){if(Ws.isBuffer(e)||(e=Ws.from(e,"binary")),t&&(Ws.isBuffer(t)||(t=Ws.from(t,"binary")),t.length!==8))throw new RangeError("salt should be Buffer with 8 byte length");for(var s=r/8,i=Ws.alloc(s),u=Ws.alloc(n||0),d=Ws.alloc(0);s>0||n>0;){var c=new EZ;c.update(d),c.update(e),t&&c.update(t),d=c.digest();var b=0;if(s>0){var w=i.length-s;b=Math.min(s,d.length),d.copy(i,w,0,b),s-=b}if(b<d.length&&n>0){var M=u.length-n,_=Math.min(n,d.length-b);d.copy(u,M,b,b+_),n-=_}}return d.fill(0),{key:i,iv:u}}var Ud=SZ,HS=Mw,AZ=DS,bo=Ye.Buffer,kZ=FS,zS=Os,BZ=ch,RZ=Ud,$Z=Fe;function ph(e,t,r){zS.call(this),this._cache=new jd,this._cipher=new BZ.AES(t),this._prev=bo.from(r),this._mode=e,this._autopadding=!0}$Z(ph,zS);ph.prototype._update=function(e){this._cache.add(e);for(var t,r,n=[];t=this._cache.get();)r=this._mode.encrypt(this,t),n.push(r);return bo.concat(n)};var NZ=bo.alloc(16,16);ph.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(NZ))throw this._cipher.scrub(),new Error("data not multiple of block length")};ph.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this};function jd(){this.cache=bo.allocUnsafe(0)}jd.prototype.add=function(e){this.cache=bo.concat([this.cache,e])};jd.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null};jd.prototype.flush=function(){for(var e=16-this.cache.length,t=bo.allocUnsafe(e),r=-1;++r<e;)t.writeUInt8(e,r);return bo.concat([this.cache,t])};function WS(e,t,r){var n=HS[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");if(typeof t=="string"&&(t=bo.from(t)),t.length!==n.key/8)throw new TypeError("invalid key length "+t.length);if(typeof r=="string"&&(r=bo.from(r)),n.mode!=="GCM"&&r.length!==n.iv)throw new TypeError("invalid iv length "+r.length);return n.type==="stream"?new kZ(n.module,t,r):n.type==="auth"?new AZ(n.module,t,r):new ph(n.module,t,r)}function TZ(e,t){var r=HS[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=RZ(t,!1,r.key,r.iv);return WS(e,n.key,n.iv)}ww.createCipheriv=WS;ww.createCipher=TZ;var Ew={},IZ=DS,Qf=Ye.Buffer,VS=Mw,CZ=FS,KS=Os,PZ=ch,LZ=Ud,OZ=Fe;function vh(e,t,r){KS.call(this),this._cache=new Dd,this._last=void 0,this._cipher=new PZ.AES(t),this._prev=Qf.from(r),this._mode=e,this._autopadding=!0}OZ(vh,KS);vh.prototype._update=function(e){this._cache.add(e);for(var t,r,n=[];t=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,t),n.push(r);return Qf.concat(n)};vh.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return UZ(this._mode.decrypt(this,e));if(e)throw new Error("data not multiple of block length")};vh.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this};function Dd(){this.cache=Qf.allocUnsafe(0)}Dd.prototype.add=function(e){this.cache=Qf.concat([this.cache,e])};Dd.prototype.get=function(e){var t;if(e){if(this.cache.length>16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null};Dd.prototype.flush=function(){if(this.cache.length)return this.cache};function UZ(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");for(var r=-1;++r<t;)if(e[r+(16-t)]!==t)throw new Error("unable to decrypt data");if(t!==16)return e.slice(0,16-t)}function ZS(e,t,r){var n=VS[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");if(typeof r=="string"&&(r=Qf.from(r)),n.mode!=="GCM"&&r.length!==n.iv)throw new TypeError("invalid iv length "+r.length);if(typeof t=="string"&&(t=Qf.from(t)),t.length!==n.key/8)throw new TypeError("invalid key length "+t.length);return n.type==="stream"?new CZ(n.module,t,r,!0):n.type==="auth"?new IZ(n.module,t,r,!0):new vh(n.module,t,r)}function jZ(e,t){var r=VS[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=LZ(t,!1,r.key,r.iv);return ZS(e,n.key,n.iv)}Ew.createDecipher=jZ;Ew.createDecipheriv=ZS;var GS=ww,JS=Ew,DZ=PS;function qZ(){return Object.keys(DZ)}dn.createCipher=dn.Cipher=GS.createCipher;dn.createCipheriv=dn.Cipheriv=GS.createCipheriv;dn.createDecipher=dn.Decipher=JS.createDecipher;dn.createDecipheriv=dn.Decipheriv=JS.createDecipheriv;dn.listCiphers=dn.getCiphers=qZ;var YS={};(function(e){e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}})(YS);var XS=YK,Sw=dn,ws=Mw,ho=YS,QS=Ud;function FZ(e,t){e=e.toLowerCase();var r,n;if(ws[e])r=ws[e].key,n=ws[e].iv;else if(ho[e])r=ho[e].key*8,n=ho[e].iv;else throw new TypeError("invalid suite type");var s=QS(t,!1,r,n);return eA(e,s.key,s.iv)}function HZ(e,t){e=e.toLowerCase();var r,n;if(ws[e])r=ws[e].key,n=ws[e].iv;else if(ho[e])r=ho[e].key*8,n=ho[e].iv;else throw new TypeError("invalid suite type");var s=QS(t,!1,r,n);return tA(e,s.key,s.iv)}function eA(e,t,r){if(e=e.toLowerCase(),ws[e])return Sw.createCipheriv(e,t,r);if(ho[e])return new XS({key:t,iv:r,mode:e});throw new TypeError("invalid suite type")}function tA(e,t,r){if(e=e.toLowerCase(),ws[e])return Sw.createDecipheriv(e,t,r);if(ho[e])return new XS({key:t,iv:r,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}function zZ(){return Object.keys(ho).concat(Sw.getCiphers())}Xn.createCipher=Xn.Cipher=FZ;Xn.createCipheriv=Xn.Cipheriv=eA;Xn.createDecipher=Xn.Decipher=HZ;Xn.createDecipheriv=Xn.Decipheriv=tA;Xn.listCiphers=Xn.getCiphers=zZ;var Vs={},Aw={exports:{}};Aw.exports;(function(e){(function(t,r){function n(x,o){if(!x)throw new Error(o||"Assertion failed")}function s(x,o){x.super_=o;var f=function(){};f.prototype=o.prototype,x.prototype=new f,x.prototype.constructor=x}function i(x,o,f){if(i.isBN(x))return x;this.negative=0,this.words=null,this.length=0,this.red=null,x!==null&&((o==="le"||o==="be")&&(f=o,o=10),this._init(x||0,o||10,f||"be"))}typeof t=="object"?t.exports=i:r.BN=i,i.BN=i,i.wordSize=26;var u;try{typeof window<"u"&&typeof window.Buffer<"u"?u=window.Buffer:u=Kt.Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,f){return o.cmp(f)>0?o:f},i.min=function(o,f){return o.cmp(f)<0?o:f},i.prototype._init=function(o,f,l){if(typeof o=="number")return this._initNumber(o,f,l);if(typeof o=="object")return this._initArray(o,f,l);f==="hex"&&(f=16),n(f===(f|0)&&f>=2&&f<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h<o.length&&(f===16?this._parseHex(o,h,l):(this._parseBase(o,f,h),l==="le"&&this._initArray(this.toArray(),f,l)))},i.prototype._initNumber=function(o,f,l){o<0&&(this.negative=1,o=-o),o<67108864?(this.words=[o&67108863],this.length=1):o<4503599627370496?(this.words=[o&67108863,o/67108864&67108863],this.length=2):(n(o<9007199254740992),this.words=[o&67108863,o/67108864&67108863,1],this.length=3),l==="le"&&this._initArray(this.toArray(),f,l)},i.prototype._initArray=function(o,f,l){if(n(typeof o.length=="number"),o.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(o.length/3),this.words=new Array(this.length);for(var h=0;h<this.length;h++)this.words[h]=0;var v,y,m=0;if(l==="be")for(h=o.length-1,v=0;h>=0;h-=3)y=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[v]|=y<<m&67108863,this.words[v+1]=y>>>26-m&67108863,m+=24,m>=26&&(m-=26,v++);else if(l==="le")for(h=0,v=0;h<o.length;h+=3)y=o[h]|o[h+1]<<8|o[h+2]<<16,this.words[v]|=y<<m&67108863,this.words[v+1]=y>>>26-m&67108863,m+=24,m>=26&&(m-=26,v++);return this.strip()};function d(x,o){var f=x.charCodeAt(o);return f>=65&&f<=70?f-55:f>=97&&f<=102?f-87:f-48&15}function c(x,o,f){var l=d(x,f);return f-1>=o&&(l|=d(x,f-1)<<4),l}i.prototype._parseHex=function(o,f,l){this.length=Math.ceil((o.length-f)/6),this.words=new Array(this.length);for(var h=0;h<this.length;h++)this.words[h]=0;var v=0,y=0,m;if(l==="be")for(h=o.length-1;h>=f;h-=2)m=c(o,f,h)<<v,this.words[y]|=m&67108863,v>=18?(v-=18,y+=1,this.words[y]|=m>>>26):v+=8;else{var p=o.length-f;for(h=p%2===0?f+1:f;h<o.length;h+=2)m=c(o,f,h)<<v,this.words[y]|=m&67108863,v>=18?(v-=18,y+=1,this.words[y]|=m>>>26):v+=8}this.strip()};function b(x,o,f,l){for(var h=0,v=Math.min(x.length,f),y=o;y<v;y++){var m=x.charCodeAt(y)-48;h*=l,m>=49?h+=m-49+10:m>=17?h+=m-17+10:h+=m}return h}i.prototype._parseBase=function(o,f,l){this.words=[0],this.length=1;for(var h=0,v=1;v<=67108863;v*=f)h++;h--,v=v/f|0;for(var y=o.length-l,m=y%h,p=Math.min(y,y-m)+l,a=0,g=l;g<p;g+=h)a=b(o,g,g+h,f),this.imuln(v),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(m!==0){var S=1;for(a=b(o,g,o.length,f),g=0;g<m;g++)S*=f;this.imuln(S),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}this.strip()},i.prototype.copy=function(o){o.words=new Array(this.length);for(var f=0;f<this.length;f++)o.words[f]=this.words[f];o.length=this.length,o.negative=this.negative,o.red=this.red},i.prototype.clone=function(){var o=new i(null);return this.copy(o),o},i.prototype._expand=function(o){for(;this.length<o;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var w=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],M=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[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];i.prototype.toString=function(o,f){o=o||10,f=f|0||1;var l;if(o===16||o==="hex"){l="";for(var h=0,v=0,y=0;y<this.length;y++){var m=this.words[y],p=((m<<h|v)&16777215).toString(16);v=m>>>24-h&16777215,h+=2,h>=26&&(h-=26,y--),v!==0||y!==this.length-1?l=w[6-p.length]+p+l:l=p+l}for(v!==0&&(l=v.toString(16)+l);l.length%f!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(o===(o|0)&&o>=2&&o<=36){var a=M[o],g=_[o];l="";var S=this.clone();for(S.negative=0;!S.isZero();){var N=S.modn(g).toString(o);S=S.idivn(g),S.isZero()?l=N+l:l=w[a-N.length]+N+l}for(this.isZero()&&(l="0"+l);l.length%f!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,f){return n(typeof u<"u"),this.toArrayLike(u,o,f)},i.prototype.toArray=function(o,f){return this.toArrayLike(Array,o,f)},i.prototype.toArrayLike=function(o,f,l){var h=this.byteLength(),v=l||Math.max(1,h);n(h<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var y=f==="le",m=new o(v),p,a,g=this.clone();if(y){for(a=0;!g.isZero();a++)p=g.andln(255),g.iushrn(8),m[a]=p;for(;a<v;a++)m[a]=0}else{for(a=0;a<v-h;a++)m[a]=0;for(a=0;!g.isZero();a++)p=g.andln(255),g.iushrn(8),m[v-a-1]=p}return m},Math.clz32?i.prototype._countBits=function(o){return 32-Math.clz32(o)}:i.prototype._countBits=function(o){var f=o,l=0;return f>=4096&&(l+=13,f>>>=13),f>=64&&(l+=7,f>>>=7),f>=8&&(l+=4,f>>>=4),f>=2&&(l+=2,f>>>=2),l+f},i.prototype._zeroBits=function(o){if(o===0)return 26;var f=o,l=0;return f&8191||(l+=13,f>>>=13),f&127||(l+=7,f>>>=7),f&15||(l+=4,f>>>=4),f&3||(l+=2,f>>>=2),f&1||l++,l},i.prototype.bitLength=function(){var o=this.words[this.length-1],f=this._countBits(o);return(this.length-1)*26+f};function A(x){for(var o=new Array(x.bitLength()),f=0;f<o.length;f++){var l=f/26|0,h=f%26;o[f]=(x.words[l]&1<<h)>>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,f=0;f<this.length;f++){var l=this._zeroBits(this.words[f]);if(o+=l,l!==26)break}return o},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(o){return this.negative!==0?this.abs().inotn(o).iaddn(1):this.clone()},i.prototype.fromTwos=function(o){return this.testn(o-1)?this.notn(o).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(o){for(;this.length<o.length;)this.words[this.length++]=0;for(var f=0;f<o.length;f++)this.words[f]=this.words[f]|o.words[f];return this.strip()},i.prototype.ior=function(o){return n((this.negative|o.negative)===0),this.iuor(o)},i.prototype.or=function(o){return this.length>o.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var f;this.length>o.length?f=o:f=this;for(var l=0;l<f.length;l++)this.words[l]=this.words[l]&o.words[l];return this.length=f.length,this.strip()},i.prototype.iand=function(o){return n((this.negative|o.negative)===0),this.iuand(o)},i.prototype.and=function(o){return this.length>o.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var f,l;this.length>o.length?(f=this,l=o):(f=o,l=this);for(var h=0;h<l.length;h++)this.words[h]=f.words[h]^l.words[h];if(this!==f)for(;h<f.length;h++)this.words[h]=f.words[h];return this.length=f.length,this.strip()},i.prototype.ixor=function(o){return n((this.negative|o.negative)===0),this.iuxor(o)},i.prototype.xor=function(o){return this.length>o.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var f=Math.ceil(o/26)|0,l=o%26;this._expand(f),l>0&&f--;for(var h=0;h<f;h++)this.words[h]=~this.words[h]&67108863;return l>0&&(this.words[h]=~this.words[h]&67108863>>26-l),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,f){n(typeof o=="number"&&o>=0);var l=o/26|0,h=o%26;return this._expand(l+1),f?this.words[l]=this.words[l]|1<<h:this.words[l]=this.words[l]&~(1<<h),this.strip()},i.prototype.iadd=function(o){var f;if(this.negative!==0&&o.negative===0)return this.negative=0,f=this.isub(o),this.negative^=1,this._normSign();if(this.negative===0&&o.negative!==0)return o.negative=0,f=this.isub(o),o.negative=1,f._normSign();var l,h;this.length>o.length?(l=this,h=o):(l=o,h=this);for(var v=0,y=0;y<h.length;y++)f=(l.words[y]|0)+(h.words[y]|0)+v,this.words[y]=f&67108863,v=f>>>26;for(;v!==0&&y<l.length;y++)f=(l.words[y]|0)+v,this.words[y]=f&67108863,v=f>>>26;if(this.length=l.length,v!==0)this.words[this.length]=v,this.length++;else if(l!==this)for(;y<l.length;y++)this.words[y]=l.words[y];return this},i.prototype.add=function(o){var f;return o.negative!==0&&this.negative===0?(o.negative=0,f=this.sub(o),o.negative^=1,f):o.negative===0&&this.negative!==0?(this.negative=0,f=o.sub(this),this.negative=1,f):this.length>o.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var f=this.iadd(o);return o.negative=1,f._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var l=this.cmp(o);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,v;l>0?(h=this,v=o):(h=o,v=this);for(var y=0,m=0;m<v.length;m++)f=(h.words[m]|0)-(v.words[m]|0)+y,y=f>>26,this.words[m]=f&67108863;for(;y!==0&&m<h.length;m++)f=(h.words[m]|0)+y,y=f>>26,this.words[m]=f&67108863;if(y===0&&m<h.length&&h!==this)for(;m<h.length;m++)this.words[m]=h.words[m];return this.length=Math.max(this.length,m),h!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(o){return this.clone().isub(o)};function R(x,o,f){f.negative=o.negative^x.negative;var l=x.length+o.length|0;f.length=l,l=l-1|0;var h=x.words[0]|0,v=o.words[0]|0,y=h*v,m=y&67108863,p=y/67108864|0;f.words[0]=m;for(var a=1;a<l;a++){for(var g=p>>>26,S=p&67108863,N=Math.min(a,o.length-1),U=Math.max(0,a-x.length+1);U<=N;U++){var Z=a-U|0;h=x.words[Z]|0,v=o.words[U]|0,y=h*v+S,g+=y/67108864|0,S=y&67108863}f.words[a]=S|0,p=g|0}return p!==0?f.words[a]=p|0:f.length--,f.strip()}var B=function(o,f,l){var h=o.words,v=f.words,y=l.words,m=0,p,a,g,S=h[0]|0,N=S&8191,U=S>>>13,Z=h[1]|0,H=Z&8191,$=Z>>>13,P=h[2]|0,W=P&8191,G=P>>>13,K=h[3]|0,O=K&8191,Q=K>>>13,de=h[4]|0,oe=de&8191,se=de>>>13,Ie=h[5]|0,fe=Ie&8191,ne=Ie>>>13,je=h[6]|0,ae=je&8191,le=je>>>13,Le=h[7]|0,he=Le&8191,_e=Le>>>13,He=h[8]|0,ye=He&8191,Ae=He>>>13,ze=h[9]|0,me=ze&8191,ge=ze>>>13,Ke=v[0]|0,we=Ke&8191,Be=Ke>>>13,We=v[1]|0,be=We&8191,ke=We>>>13,Ze=v[2]|0,pe=Ze&8191,Ne=Ze>>>13,Qe=v[3]|0,xe=Qe&8191,Re=Qe>>>13,Xe=v[4]|0,Ee=Xe&8191,$e=Xe>>>13,tt=v[5]|0,D=tt&8191,C=tt>>>13,j=v[6]|0,Y=j&8191,te=j>>>13,ue=v[7]|0,re=ue&8191,ve=ue>>>13,De=v[8]|0,ce=De&8191,Me=De>>>13,Oe=v[9]|0,Se=Oe&8191,Te=Oe>>>13;l.negative=o.negative^f.negative,l.length=19,p=Math.imul(N,we),a=Math.imul(N,Be),a=a+Math.imul(U,we)|0,g=Math.imul(U,Be);var Ge=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,p=Math.imul(H,we),a=Math.imul(H,Be),a=a+Math.imul($,we)|0,g=Math.imul($,Be),p=p+Math.imul(N,be)|0,a=a+Math.imul(N,ke)|0,a=a+Math.imul(U,be)|0,g=g+Math.imul(U,ke)|0;var Je=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Je>>>26)|0,Je&=67108863,p=Math.imul(W,we),a=Math.imul(W,Be),a=a+Math.imul(G,we)|0,g=Math.imul(G,Be),p=p+Math.imul(H,be)|0,a=a+Math.imul(H,ke)|0,a=a+Math.imul($,be)|0,g=g+Math.imul($,ke)|0,p=p+Math.imul(N,pe)|0,a=a+Math.imul(N,Ne)|0,a=a+Math.imul(U,pe)|0,g=g+Math.imul(U,Ne)|0;var pt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(pt>>>26)|0,pt&=67108863,p=Math.imul(O,we),a=Math.imul(O,Be),a=a+Math.imul(Q,we)|0,g=Math.imul(Q,Be),p=p+Math.imul(W,be)|0,a=a+Math.imul(W,ke)|0,a=a+Math.imul(G,be)|0,g=g+Math.imul(G,ke)|0,p=p+Math.imul(H,pe)|0,a=a+Math.imul(H,Ne)|0,a=a+Math.imul($,pe)|0,g=g+Math.imul($,Ne)|0,p=p+Math.imul(N,xe)|0,a=a+Math.imul(N,Re)|0,a=a+Math.imul(U,xe)|0,g=g+Math.imul(U,Re)|0;var vt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(vt>>>26)|0,vt&=67108863,p=Math.imul(oe,we),a=Math.imul(oe,Be),a=a+Math.imul(se,we)|0,g=Math.imul(se,Be),p=p+Math.imul(O,be)|0,a=a+Math.imul(O,ke)|0,a=a+Math.imul(Q,be)|0,g=g+Math.imul(Q,ke)|0,p=p+Math.imul(W,pe)|0,a=a+Math.imul(W,Ne)|0,a=a+Math.imul(G,pe)|0,g=g+Math.imul(G,Ne)|0,p=p+Math.imul(H,xe)|0,a=a+Math.imul(H,Re)|0,a=a+Math.imul($,xe)|0,g=g+Math.imul($,Re)|0,p=p+Math.imul(N,Ee)|0,a=a+Math.imul(N,$e)|0,a=a+Math.imul(U,Ee)|0,g=g+Math.imul(U,$e)|0;var gt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(gt>>>26)|0,gt&=67108863,p=Math.imul(fe,we),a=Math.imul(fe,Be),a=a+Math.imul(ne,we)|0,g=Math.imul(ne,Be),p=p+Math.imul(oe,be)|0,a=a+Math.imul(oe,ke)|0,a=a+Math.imul(se,be)|0,g=g+Math.imul(se,ke)|0,p=p+Math.imul(O,pe)|0,a=a+Math.imul(O,Ne)|0,a=a+Math.imul(Q,pe)|0,g=g+Math.imul(Q,Ne)|0,p=p+Math.imul(W,xe)|0,a=a+Math.imul(W,Re)|0,a=a+Math.imul(G,xe)|0,g=g+Math.imul(G,Re)|0,p=p+Math.imul(H,Ee)|0,a=a+Math.imul(H,$e)|0,a=a+Math.imul($,Ee)|0,g=g+Math.imul($,$e)|0,p=p+Math.imul(N,D)|0,a=a+Math.imul(N,C)|0,a=a+Math.imul(U,D)|0,g=g+Math.imul(U,C)|0;var yt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(yt>>>26)|0,yt&=67108863,p=Math.imul(ae,we),a=Math.imul(ae,Be),a=a+Math.imul(le,we)|0,g=Math.imul(le,Be),p=p+Math.imul(fe,be)|0,a=a+Math.imul(fe,ke)|0,a=a+Math.imul(ne,be)|0,g=g+Math.imul(ne,ke)|0,p=p+Math.imul(oe,pe)|0,a=a+Math.imul(oe,Ne)|0,a=a+Math.imul(se,pe)|0,g=g+Math.imul(se,Ne)|0,p=p+Math.imul(O,xe)|0,a=a+Math.imul(O,Re)|0,a=a+Math.imul(Q,xe)|0,g=g+Math.imul(Q,Re)|0,p=p+Math.imul(W,Ee)|0,a=a+Math.imul(W,$e)|0,a=a+Math.imul(G,Ee)|0,g=g+Math.imul(G,$e)|0,p=p+Math.imul(H,D)|0,a=a+Math.imul(H,C)|0,a=a+Math.imul($,D)|0,g=g+Math.imul($,C)|0,p=p+Math.imul(N,Y)|0,a=a+Math.imul(N,te)|0,a=a+Math.imul(U,Y)|0,g=g+Math.imul(U,te)|0;var mt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(mt>>>26)|0,mt&=67108863,p=Math.imul(he,we),a=Math.imul(he,Be),a=a+Math.imul(_e,we)|0,g=Math.imul(_e,Be),p=p+Math.imul(ae,be)|0,a=a+Math.imul(ae,ke)|0,a=a+Math.imul(le,be)|0,g=g+Math.imul(le,ke)|0,p=p+Math.imul(fe,pe)|0,a=a+Math.imul(fe,Ne)|0,a=a+Math.imul(ne,pe)|0,g=g+Math.imul(ne,Ne)|0,p=p+Math.imul(oe,xe)|0,a=a+Math.imul(oe,Re)|0,a=a+Math.imul(se,xe)|0,g=g+Math.imul(se,Re)|0,p=p+Math.imul(O,Ee)|0,a=a+Math.imul(O,$e)|0,a=a+Math.imul(Q,Ee)|0,g=g+Math.imul(Q,$e)|0,p=p+Math.imul(W,D)|0,a=a+Math.imul(W,C)|0,a=a+Math.imul(G,D)|0,g=g+Math.imul(G,C)|0,p=p+Math.imul(H,Y)|0,a=a+Math.imul(H,te)|0,a=a+Math.imul($,Y)|0,g=g+Math.imul($,te)|0,p=p+Math.imul(N,re)|0,a=a+Math.imul(N,ve)|0,a=a+Math.imul(U,re)|0,g=g+Math.imul(U,ve)|0;var wt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(wt>>>26)|0,wt&=67108863,p=Math.imul(ye,we),a=Math.imul(ye,Be),a=a+Math.imul(Ae,we)|0,g=Math.imul(Ae,Be),p=p+Math.imul(he,be)|0,a=a+Math.imul(he,ke)|0,a=a+Math.imul(_e,be)|0,g=g+Math.imul(_e,ke)|0,p=p+Math.imul(ae,pe)|0,a=a+Math.imul(ae,Ne)|0,a=a+Math.imul(le,pe)|0,g=g+Math.imul(le,Ne)|0,p=p+Math.imul(fe,xe)|0,a=a+Math.imul(fe,Re)|0,a=a+Math.imul(ne,xe)|0,g=g+Math.imul(ne,Re)|0,p=p+Math.imul(oe,Ee)|0,a=a+Math.imul(oe,$e)|0,a=a+Math.imul(se,Ee)|0,g=g+Math.imul(se,$e)|0,p=p+Math.imul(O,D)|0,a=a+Math.imul(O,C)|0,a=a+Math.imul(Q,D)|0,g=g+Math.imul(Q,C)|0,p=p+Math.imul(W,Y)|0,a=a+Math.imul(W,te)|0,a=a+Math.imul(G,Y)|0,g=g+Math.imul(G,te)|0,p=p+Math.imul(H,re)|0,a=a+Math.imul(H,ve)|0,a=a+Math.imul($,re)|0,g=g+Math.imul($,ve)|0,p=p+Math.imul(N,ce)|0,a=a+Math.imul(N,Me)|0,a=a+Math.imul(U,ce)|0,g=g+Math.imul(U,Me)|0;var bt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(bt>>>26)|0,bt&=67108863,p=Math.imul(me,we),a=Math.imul(me,Be),a=a+Math.imul(ge,we)|0,g=Math.imul(ge,Be),p=p+Math.imul(ye,be)|0,a=a+Math.imul(ye,ke)|0,a=a+Math.imul(Ae,be)|0,g=g+Math.imul(Ae,ke)|0,p=p+Math.imul(he,pe)|0,a=a+Math.imul(he,Ne)|0,a=a+Math.imul(_e,pe)|0,g=g+Math.imul(_e,Ne)|0,p=p+Math.imul(ae,xe)|0,a=a+Math.imul(ae,Re)|0,a=a+Math.imul(le,xe)|0,g=g+Math.imul(le,Re)|0,p=p+Math.imul(fe,Ee)|0,a=a+Math.imul(fe,$e)|0,a=a+Math.imul(ne,Ee)|0,g=g+Math.imul(ne,$e)|0,p=p+Math.imul(oe,D)|0,a=a+Math.imul(oe,C)|0,a=a+Math.imul(se,D)|0,g=g+Math.imul(se,C)|0,p=p+Math.imul(O,Y)|0,a=a+Math.imul(O,te)|0,a=a+Math.imul(Q,Y)|0,g=g+Math.imul(Q,te)|0,p=p+Math.imul(W,re)|0,a=a+Math.imul(W,ve)|0,a=a+Math.imul(G,re)|0,g=g+Math.imul(G,ve)|0,p=p+Math.imul(H,ce)|0,a=a+Math.imul(H,Me)|0,a=a+Math.imul($,ce)|0,g=g+Math.imul($,Me)|0,p=p+Math.imul(N,Se)|0,a=a+Math.imul(N,Te)|0,a=a+Math.imul(U,Se)|0,g=g+Math.imul(U,Te)|0;var xt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(xt>>>26)|0,xt&=67108863,p=Math.imul(me,be),a=Math.imul(me,ke),a=a+Math.imul(ge,be)|0,g=Math.imul(ge,ke),p=p+Math.imul(ye,pe)|0,a=a+Math.imul(ye,Ne)|0,a=a+Math.imul(Ae,pe)|0,g=g+Math.imul(Ae,Ne)|0,p=p+Math.imul(he,xe)|0,a=a+Math.imul(he,Re)|0,a=a+Math.imul(_e,xe)|0,g=g+Math.imul(_e,Re)|0,p=p+Math.imul(ae,Ee)|0,a=a+Math.imul(ae,$e)|0,a=a+Math.imul(le,Ee)|0,g=g+Math.imul(le,$e)|0,p=p+Math.imul(fe,D)|0,a=a+Math.imul(fe,C)|0,a=a+Math.imul(ne,D)|0,g=g+Math.imul(ne,C)|0,p=p+Math.imul(oe,Y)|0,a=a+Math.imul(oe,te)|0,a=a+Math.imul(se,Y)|0,g=g+Math.imul(se,te)|0,p=p+Math.imul(O,re)|0,a=a+Math.imul(O,ve)|0,a=a+Math.imul(Q,re)|0,g=g+Math.imul(Q,ve)|0,p=p+Math.imul(W,ce)|0,a=a+Math.imul(W,Me)|0,a=a+Math.imul(G,ce)|0,g=g+Math.imul(G,Me)|0,p=p+Math.imul(H,Se)|0,a=a+Math.imul(H,Te)|0,a=a+Math.imul($,Se)|0,g=g+Math.imul($,Te)|0;var Mt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,p=Math.imul(me,pe),a=Math.imul(me,Ne),a=a+Math.imul(ge,pe)|0,g=Math.imul(ge,Ne),p=p+Math.imul(ye,xe)|0,a=a+Math.imul(ye,Re)|0,a=a+Math.imul(Ae,xe)|0,g=g+Math.imul(Ae,Re)|0,p=p+Math.imul(he,Ee)|0,a=a+Math.imul(he,$e)|0,a=a+Math.imul(_e,Ee)|0,g=g+Math.imul(_e,$e)|0,p=p+Math.imul(ae,D)|0,a=a+Math.imul(ae,C)|0,a=a+Math.imul(le,D)|0,g=g+Math.imul(le,C)|0,p=p+Math.imul(fe,Y)|0,a=a+Math.imul(fe,te)|0,a=a+Math.imul(ne,Y)|0,g=g+Math.imul(ne,te)|0,p=p+Math.imul(oe,re)|0,a=a+Math.imul(oe,ve)|0,a=a+Math.imul(se,re)|0,g=g+Math.imul(se,ve)|0,p=p+Math.imul(O,ce)|0,a=a+Math.imul(O,Me)|0,a=a+Math.imul(Q,ce)|0,g=g+Math.imul(Q,Me)|0,p=p+Math.imul(W,Se)|0,a=a+Math.imul(W,Te)|0,a=a+Math.imul(G,Se)|0,g=g+Math.imul(G,Te)|0;var _t=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(_t>>>26)|0,_t&=67108863,p=Math.imul(me,xe),a=Math.imul(me,Re),a=a+Math.imul(ge,xe)|0,g=Math.imul(ge,Re),p=p+Math.imul(ye,Ee)|0,a=a+Math.imul(ye,$e)|0,a=a+Math.imul(Ae,Ee)|0,g=g+Math.imul(Ae,$e)|0,p=p+Math.imul(he,D)|0,a=a+Math.imul(he,C)|0,a=a+Math.imul(_e,D)|0,g=g+Math.imul(_e,C)|0,p=p+Math.imul(ae,Y)|0,a=a+Math.imul(ae,te)|0,a=a+Math.imul(le,Y)|0,g=g+Math.imul(le,te)|0,p=p+Math.imul(fe,re)|0,a=a+Math.imul(fe,ve)|0,a=a+Math.imul(ne,re)|0,g=g+Math.imul(ne,ve)|0,p=p+Math.imul(oe,ce)|0,a=a+Math.imul(oe,Me)|0,a=a+Math.imul(se,ce)|0,g=g+Math.imul(se,Me)|0,p=p+Math.imul(O,Se)|0,a=a+Math.imul(O,Te)|0,a=a+Math.imul(Q,Se)|0,g=g+Math.imul(Q,Te)|0;var Et=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Et>>>26)|0,Et&=67108863,p=Math.imul(me,Ee),a=Math.imul(me,$e),a=a+Math.imul(ge,Ee)|0,g=Math.imul(ge,$e),p=p+Math.imul(ye,D)|0,a=a+Math.imul(ye,C)|0,a=a+Math.imul(Ae,D)|0,g=g+Math.imul(Ae,C)|0,p=p+Math.imul(he,Y)|0,a=a+Math.imul(he,te)|0,a=a+Math.imul(_e,Y)|0,g=g+Math.imul(_e,te)|0,p=p+Math.imul(ae,re)|0,a=a+Math.imul(ae,ve)|0,a=a+Math.imul(le,re)|0,g=g+Math.imul(le,ve)|0,p=p+Math.imul(fe,ce)|0,a=a+Math.imul(fe,Me)|0,a=a+Math.imul(ne,ce)|0,g=g+Math.imul(ne,Me)|0,p=p+Math.imul(oe,Se)|0,a=a+Math.imul(oe,Te)|0,a=a+Math.imul(se,Se)|0,g=g+Math.imul(se,Te)|0;var St=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(St>>>26)|0,St&=67108863,p=Math.imul(me,D),a=Math.imul(me,C),a=a+Math.imul(ge,D)|0,g=Math.imul(ge,C),p=p+Math.imul(ye,Y)|0,a=a+Math.imul(ye,te)|0,a=a+Math.imul(Ae,Y)|0,g=g+Math.imul(Ae,te)|0,p=p+Math.imul(he,re)|0,a=a+Math.imul(he,ve)|0,a=a+Math.imul(_e,re)|0,g=g+Math.imul(_e,ve)|0,p=p+Math.imul(ae,ce)|0,a=a+Math.imul(ae,Me)|0,a=a+Math.imul(le,ce)|0,g=g+Math.imul(le,Me)|0,p=p+Math.imul(fe,Se)|0,a=a+Math.imul(fe,Te)|0,a=a+Math.imul(ne,Se)|0,g=g+Math.imul(ne,Te)|0;var At=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(At>>>26)|0,At&=67108863,p=Math.imul(me,Y),a=Math.imul(me,te),a=a+Math.imul(ge,Y)|0,g=Math.imul(ge,te),p=p+Math.imul(ye,re)|0,a=a+Math.imul(ye,ve)|0,a=a+Math.imul(Ae,re)|0,g=g+Math.imul(Ae,ve)|0,p=p+Math.imul(he,ce)|0,a=a+Math.imul(he,Me)|0,a=a+Math.imul(_e,ce)|0,g=g+Math.imul(_e,Me)|0,p=p+Math.imul(ae,Se)|0,a=a+Math.imul(ae,Te)|0,a=a+Math.imul(le,Se)|0,g=g+Math.imul(le,Te)|0;var kt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(kt>>>26)|0,kt&=67108863,p=Math.imul(me,re),a=Math.imul(me,ve),a=a+Math.imul(ge,re)|0,g=Math.imul(ge,ve),p=p+Math.imul(ye,ce)|0,a=a+Math.imul(ye,Me)|0,a=a+Math.imul(Ae,ce)|0,g=g+Math.imul(Ae,Me)|0,p=p+Math.imul(he,Se)|0,a=a+Math.imul(he,Te)|0,a=a+Math.imul(_e,Se)|0,g=g+Math.imul(_e,Te)|0;var Bt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,p=Math.imul(me,ce),a=Math.imul(me,Me),a=a+Math.imul(ge,ce)|0,g=Math.imul(ge,Me),p=p+Math.imul(ye,Se)|0,a=a+Math.imul(ye,Te)|0,a=a+Math.imul(Ae,Se)|0,g=g+Math.imul(Ae,Te)|0;var Rt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,p=Math.imul(me,Se),a=Math.imul(me,Te),a=a+Math.imul(ge,Se)|0,g=Math.imul(ge,Te);var $t=(m+p|0)+((a&8191)<<13)|0;return m=(g+(a>>>13)|0)+($t>>>26)|0,$t&=67108863,y[0]=Ge,y[1]=Je,y[2]=pt,y[3]=vt,y[4]=gt,y[5]=yt,y[6]=mt,y[7]=wt,y[8]=bt,y[9]=xt,y[10]=Mt,y[11]=_t,y[12]=Et,y[13]=St,y[14]=At,y[15]=kt,y[16]=Bt,y[17]=Rt,y[18]=$t,m!==0&&(y[19]=m,l.length++),l};Math.imul||(B=R);function I(x,o,f){f.negative=o.negative^x.negative,f.length=x.length+o.length;for(var l=0,h=0,v=0;v<f.length-1;v++){var y=h;h=0;for(var m=l&67108863,p=Math.min(v,o.length-1),a=Math.max(0,v-x.length+1);a<=p;a++){var g=v-a,S=x.words[g]|0,N=o.words[a]|0,U=S*N,Z=U&67108863;y=y+(U/67108864|0)|0,Z=Z+m|0,m=Z&67108863,y=y+(Z>>>26)|0,h+=y>>>26,y&=67108863}f.words[v]=m,l=y,y=h}return l!==0?f.words[v]=l:f.length--,f.strip()}function E(x,o,f){var l=new k;return l.mulp(x,o,f)}i.prototype.mulTo=function(o,f){var l,h=this.length+o.length;return this.length===10&&o.length===10?l=B(this,o,f):h<63?l=R(this,o,f):h<1024?l=I(this,o,f):l=E(this,o,f),l};function k(x,o){this.x=x,this.y=o}k.prototype.makeRBT=function(o){for(var f=new Array(o),l=i.prototype._countBits(o)-1,h=0;h<o;h++)f[h]=this.revBin(h,l,o);return f},k.prototype.revBin=function(o,f,l){if(o===0||o===l-1)return o;for(var h=0,v=0;v<f;v++)h|=(o&1)<<f-v-1,o>>=1;return h},k.prototype.permute=function(o,f,l,h,v,y){for(var m=0;m<y;m++)h[m]=f[o[m]],v[m]=l[o[m]]},k.prototype.transform=function(o,f,l,h,v,y){this.permute(y,o,f,l,h,v);for(var m=1;m<v;m<<=1)for(var p=m<<1,a=Math.cos(2*Math.PI/p),g=Math.sin(2*Math.PI/p),S=0;S<v;S+=p)for(var N=a,U=g,Z=0;Z<m;Z++){var H=l[S+Z],$=h[S+Z],P=l[S+Z+m],W=h[S+Z+m],G=N*P-U*W;W=N*W+U*P,P=G,l[S+Z]=H+P,h[S+Z]=$+W,l[S+Z+m]=H-P,h[S+Z+m]=$-W,Z!==p&&(G=a*N-g*U,U=a*U+g*N,N=G)}},k.prototype.guessLen13b=function(o,f){var l=Math.max(f,o)|1,h=l&1,v=0;for(l=l/2|0;l;l=l>>>1)v++;return 1<<v+1+h},k.prototype.conjugate=function(o,f,l){if(!(l<=1))for(var h=0;h<l/2;h++){var v=o[h];o[h]=o[l-h-1],o[l-h-1]=v,v=f[h],f[h]=-f[l-h-1],f[l-h-1]=-v}},k.prototype.normalize13b=function(o,f){for(var l=0,h=0;h<f/2;h++){var v=Math.round(o[2*h+1]/f)*8192+Math.round(o[2*h]/f)+l;o[h]=v&67108863,v<67108864?l=0:l=v/67108864|0}return o},k.prototype.convert13b=function(o,f,l,h){for(var v=0,y=0;y<f;y++)v=v+(o[y]|0),l[2*y]=v&8191,v=v>>>13,l[2*y+1]=v&8191,v=v>>>13;for(y=2*f;y<h;++y)l[y]=0;n(v===0),n((v&-8192)===0)},k.prototype.stub=function(o){for(var f=new Array(o),l=0;l<o;l++)f[l]=0;return f},k.prototype.mulp=function(o,f,l){var h=2*this.guessLen13b(o.length,f.length),v=this.makeRBT(h),y=this.stub(h),m=new Array(h),p=new Array(h),a=new Array(h),g=new Array(h),S=new Array(h),N=new Array(h),U=l.words;U.length=h,this.convert13b(o.words,o.length,m,h),this.convert13b(f.words,f.length,g,h),this.transform(m,y,p,a,h,v),this.transform(g,y,S,N,h,v);for(var Z=0;Z<h;Z++){var H=p[Z]*S[Z]-a[Z]*N[Z];a[Z]=p[Z]*N[Z]+a[Z]*S[Z],p[Z]=H}return this.conjugate(p,a,h),this.transform(p,a,U,y,h,v),this.conjugate(U,y,h),this.normalize13b(U,h),l.negative=o.negative^f.negative,l.length=o.length+f.length,l.strip()},i.prototype.mul=function(o){var f=new i(null);return f.words=new Array(this.length+o.length),this.mulTo(o,f)},i.prototype.mulf=function(o){var f=new i(null);return f.words=new Array(this.length+o.length),E(this,o,f)},i.prototype.imul=function(o){return this.clone().mulTo(o,this)},i.prototype.imuln=function(o){n(typeof o=="number"),n(o<67108864);for(var f=0,l=0;l<this.length;l++){var h=(this.words[l]|0)*o,v=(h&67108863)+(f&67108863);f>>=26,f+=h/67108864|0,f+=v>>>26,this.words[l]=v&67108863}return f!==0&&(this.words[l]=f,this.length++),this.length=o===0?1:this.length,this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var f=A(o);if(f.length===0)return new i(1);for(var l=this,h=0;h<f.length&&f[h]===0;h++,l=l.sqr());if(++h<f.length)for(var v=l.sqr();h<f.length;h++,v=v.sqr())f[h]!==0&&(l=l.mul(v));return l},i.prototype.iushln=function(o){n(typeof o=="number"&&o>=0);var f=o%26,l=(o-f)/26,h=67108863>>>26-f<<26-f,v;if(f!==0){var y=0;for(v=0;v<this.length;v++){var m=this.words[v]&h,p=(this.words[v]|0)-m<<f;this.words[v]=p|y,y=m>>>26-f}y&&(this.words[v]=y,this.length++)}if(l!==0){for(v=this.length-1;v>=0;v--)this.words[v+l]=this.words[v];for(v=0;v<l;v++)this.words[v]=0;this.length+=l}return this.strip()},i.prototype.ishln=function(o){return n(this.negative===0),this.iushln(o)},i.prototype.iushrn=function(o,f,l){n(typeof o=="number"&&o>=0);var h;f?h=(f-f%26)/26:h=0;var v=o%26,y=Math.min((o-v)/26,this.length),m=67108863^67108863>>>v<<v,p=l;if(h-=y,h=Math.max(0,h),p){for(var a=0;a<y;a++)p.words[a]=this.words[a];p.length=y}if(y!==0)if(this.length>y)for(this.length-=y,a=0;a<this.length;a++)this.words[a]=this.words[a+y];else this.words[0]=0,this.length=1;var g=0;for(a=this.length-1;a>=0&&(g!==0||a>=h);a--){var S=this.words[a]|0;this.words[a]=g<<26-v|S>>>v,g=S&m}return p&&g!==0&&(p.words[p.length++]=g),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,f,l){return n(this.negative===0),this.iushrn(o,f,l)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var f=o%26,l=(o-f)/26,h=1<<f;if(this.length<=l)return!1;var v=this.words[l];return!!(v&h)},i.prototype.imaskn=function(o){n(typeof o=="number"&&o>=0);var f=o%26,l=(o-f)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(f!==0&&l++,this.length=Math.min(l,this.length),f!==0){var h=67108863^67108863>>>f<<f;this.words[this.length-1]&=h}return this.strip()},i.prototype.maskn=function(o){return this.clone().imaskn(o)},i.prototype.iaddn=function(o){return n(typeof o=="number"),n(o<67108864),o<0?this.isubn(-o):this.negative!==0?this.length===1&&(this.words[0]|0)<o?(this.words[0]=o-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(o),this.negative=1,this):this._iaddn(o)},i.prototype._iaddn=function(o){this.words[0]+=o;for(var f=0;f<this.length&&this.words[f]>=67108864;f++)this.words[f]-=67108864,f===this.length-1?this.words[f+1]=1:this.words[f+1]++;return this.length=Math.max(this.length,f+1),this},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var f=0;f<this.length&&this.words[f]<0;f++)this.words[f]+=67108864,this.words[f+1]-=1;return this.strip()},i.prototype.addn=function(o){return this.clone().iaddn(o)},i.prototype.subn=function(o){return this.clone().isubn(o)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(o,f,l){var h=o.length+l,v;this._expand(h);var y,m=0;for(v=0;v<o.length;v++){y=(this.words[v+l]|0)+m;var p=(o.words[v]|0)*f;y-=p&67108863,m=(y>>26)-(p/67108864|0),this.words[v+l]=y&67108863}for(;v<this.length-l;v++)y=(this.words[v+l]|0)+m,m=y>>26,this.words[v+l]=y&67108863;if(m===0)return this.strip();for(n(m===-1),m=0,v=0;v<this.length;v++)y=-(this.words[v]|0)+m,m=y>>26,this.words[v]=y&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,f){var l=this.length-o.length,h=this.clone(),v=o,y=v.words[v.length-1]|0,m=this._countBits(y);l=26-m,l!==0&&(v=v.ushln(l),h.iushln(l),y=v.words[v.length-1]|0);var p=h.length-v.length,a;if(f!=="mod"){a=new i(null),a.length=p+1,a.words=new Array(a.length);for(var g=0;g<a.length;g++)a.words[g]=0}var S=h.clone()._ishlnsubmul(v,1,p);S.negative===0&&(h=S,a&&(a.words[p]=1));for(var N=p-1;N>=0;N--){var U=(h.words[v.length+N]|0)*67108864+(h.words[v.length+N-1]|0);for(U=Math.min(U/y|0,67108863),h._ishlnsubmul(v,U,N);h.negative!==0;)U--,h.negative=0,h._ishlnsubmul(v,1,N),h.isZero()||(h.negative^=1);a&&(a.words[N]=U)}return a&&a.strip(),h.strip(),f!=="div"&&l!==0&&h.iushrn(l),{div:a||null,mod:h}},i.prototype.divmod=function(o,f,l){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,v,y;return this.negative!==0&&o.negative===0?(y=this.neg().divmod(o,f),f!=="mod"&&(h=y.div.neg()),f!=="div"&&(v=y.mod.neg(),l&&v.negative!==0&&v.iadd(o)),{div:h,mod:v}):this.negative===0&&o.negative!==0?(y=this.divmod(o.neg(),f),f!=="mod"&&(h=y.div.neg()),{div:h,mod:y.mod}):this.negative&o.negative?(y=this.neg().divmod(o.neg(),f),f!=="div"&&(v=y.mod.neg(),l&&v.negative!==0&&v.isub(o)),{div:y.div,mod:v}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?f==="div"?{div:this.divn(o.words[0]),mod:null}:f==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,f)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var f=this.divmod(o);if(f.mod.isZero())return f.div;var l=f.div.negative!==0?f.mod.isub(o):f.mod,h=o.ushrn(1),v=o.andln(1),y=l.cmp(h);return y<0||v===1&&y===0?f.div:f.div.negative!==0?f.div.isubn(1):f.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var f=(1<<26)%o,l=0,h=this.length-1;h>=0;h--)l=(f*l+(this.words[h]|0))%o;return l},i.prototype.idivn=function(o){n(o<=67108863);for(var f=0,l=this.length-1;l>=0;l--){var h=(this.words[l]|0)+f*67108864;this.words[l]=h/o|0,f=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var f=this,l=o.clone();f.negative!==0?f=f.umod(o):f=f.clone();for(var h=new i(1),v=new i(0),y=new i(0),m=new i(1),p=0;f.isEven()&&l.isEven();)f.iushrn(1),l.iushrn(1),++p;for(var a=l.clone(),g=f.clone();!f.isZero();){for(var S=0,N=1;!(f.words[0]&N)&&S<26;++S,N<<=1);if(S>0)for(f.iushrn(S);S-- >0;)(h.isOdd()||v.isOdd())&&(h.iadd(a),v.isub(g)),h.iushrn(1),v.iushrn(1);for(var U=0,Z=1;!(l.words[0]&Z)&&U<26;++U,Z<<=1);if(U>0)for(l.iushrn(U);U-- >0;)(y.isOdd()||m.isOdd())&&(y.iadd(a),m.isub(g)),y.iushrn(1),m.iushrn(1);f.cmp(l)>=0?(f.isub(l),h.isub(y),v.isub(m)):(l.isub(f),y.isub(h),m.isub(v))}return{a:y,b:m,gcd:l.iushln(p)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var f=this,l=o.clone();f.negative!==0?f=f.umod(o):f=f.clone();for(var h=new i(1),v=new i(0),y=l.clone();f.cmpn(1)>0&&l.cmpn(1)>0;){for(var m=0,p=1;!(f.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(f.iushrn(m);m-- >0;)h.isOdd()&&h.iadd(y),h.iushrn(1);for(var a=0,g=1;!(l.words[0]&g)&&a<26;++a,g<<=1);if(a>0)for(l.iushrn(a);a-- >0;)v.isOdd()&&v.iadd(y),v.iushrn(1);f.cmp(l)>=0?(f.isub(l),h.isub(v)):(l.isub(f),v.isub(h))}var S;return f.cmpn(1)===0?S=h:S=v,S.cmpn(0)<0&&S.iadd(o),S},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var f=this.clone(),l=o.clone();f.negative=0,l.negative=0;for(var h=0;f.isEven()&&l.isEven();h++)f.iushrn(1),l.iushrn(1);do{for(;f.isEven();)f.iushrn(1);for(;l.isEven();)l.iushrn(1);var v=f.cmp(l);if(v<0){var y=f;f=l,l=y}else if(v===0||l.cmpn(1)===0)break;f.isub(l)}while(!0);return l.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var f=o%26,l=(o-f)/26,h=1<<f;if(this.length<=l)return this._expand(l+1),this.words[l]|=h,this;for(var v=h,y=l;v!==0&&y<this.length;y++){var m=this.words[y]|0;m+=v,v=m>>>26,m&=67108863,this.words[y]=m}return v!==0&&(this.words[y]=v,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var f=o<0;if(this.negative!==0&&!f)return-1;if(this.negative===0&&f)return 1;this.strip();var l;if(this.length>1)l=1;else{f&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;l=h===o?0:h<o?-1:1}return this.negative!==0?-l|0:l},i.prototype.cmp=function(o){if(this.negative!==0&&o.negative===0)return-1;if(this.negative===0&&o.negative!==0)return 1;var f=this.ucmp(o);return this.negative!==0?-f|0:f},i.prototype.ucmp=function(o){if(this.length>o.length)return 1;if(this.length<o.length)return-1;for(var f=0,l=this.length-1;l>=0;l--){var h=this.words[l]|0,v=o.words[l]|0;if(h!==v){h<v?f=-1:h>v&&(f=1);break}}return f},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new X(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var T={k256:null,p224:null,p192:null,p25519:null};function L(x,o){this.name=x,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}L.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},L.prototype.ireduce=function(o){var f=o,l;do this.split(f,this.tmp),f=this.imulK(f),f=f.iadd(this.tmp),l=f.bitLength();while(l>this.n);var h=l<this.n?-1:f.ucmp(this.p);return h===0?(f.words[0]=0,f.length=1):h>0?f.isub(this.p):f.strip!==void 0?f.strip():f._strip(),f},L.prototype.split=function(o,f){o.iushrn(this.n,0,f)},L.prototype.imulK=function(o){return o.imul(this.k)};function q(){L.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(q,L),q.prototype.split=function(o,f){for(var l=4194303,h=Math.min(o.length,9),v=0;v<h;v++)f.words[v]=o.words[v];if(f.length=h,o.length<=9){o.words[0]=0,o.length=1;return}var y=o.words[9];for(f.words[f.length++]=y&l,v=10;v<o.length;v++){var m=o.words[v]|0;o.words[v-10]=(m&l)<<4|y>>>22,y=m}y>>>=22,o.words[v-10]=y,y===0&&o.length>10?o.length-=10:o.length-=9},q.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var f=0,l=0;l<o.length;l++){var h=o.words[l]|0;f+=h*977,o.words[l]=f&67108863,f=h*64+(f/67108864|0)}return o.words[o.length-1]===0&&(o.length--,o.words[o.length-1]===0&&o.length--),o};function z(){L.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(z,L);function J(){L.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(J,L);function F(){L.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(F,L),F.prototype.imulK=function(o){for(var f=0,l=0;l<o.length;l++){var h=(o.words[l]|0)*19+f,v=h&67108863;h>>>=26,o.words[l]=v,f=h}return f!==0&&(o.words[o.length++]=f),o},i._prime=function(o){if(T[o])return T[o];var f;if(o==="k256")f=new q;else if(o==="p224")f=new z;else if(o==="p192")f=new J;else if(o==="p25519")f=new F;else throw new Error("Unknown prime "+o);return T[o]=f,f};function X(x){if(typeof x=="string"){var o=i._prime(x);this.m=o.p,this.prime=o}else n(x.gtn(1),"modulus must be greater than 1"),this.m=x,this.prime=null}X.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},X.prototype._verify2=function(o,f){n((o.negative|f.negative)===0,"red works only with positives"),n(o.red&&o.red===f.red,"red works only with red numbers")},X.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},X.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},X.prototype.add=function(o,f){this._verify2(o,f);var l=o.add(f);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},X.prototype.iadd=function(o,f){this._verify2(o,f);var l=o.iadd(f);return l.cmp(this.m)>=0&&l.isub(this.m),l},X.prototype.sub=function(o,f){this._verify2(o,f);var l=o.sub(f);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},X.prototype.isub=function(o,f){this._verify2(o,f);var l=o.isub(f);return l.cmpn(0)<0&&l.iadd(this.m),l},X.prototype.shl=function(o,f){return this._verify1(o),this.imod(o.ushln(f))},X.prototype.imul=function(o,f){return this._verify2(o,f),this.imod(o.imul(f))},X.prototype.mul=function(o,f){return this._verify2(o,f),this.imod(o.mul(f))},X.prototype.isqr=function(o){return this.imul(o,o.clone())},X.prototype.sqr=function(o){return this.mul(o,o)},X.prototype.sqrt=function(o){if(o.isZero())return o.clone();var f=this.m.andln(3);if(n(f%2===1),f===3){var l=this.m.add(new i(1)).iushrn(2);return this.pow(o,l)}for(var h=this.m.subn(1),v=0;!h.isZero()&&h.andln(1)===0;)v++,h.iushrn(1);n(!h.isZero());var y=new i(1).toRed(this),m=y.redNeg(),p=this.m.subn(1).iushrn(1),a=this.m.bitLength();for(a=new i(2*a*a).toRed(this);this.pow(a,p).cmp(m)!==0;)a.redIAdd(m);for(var g=this.pow(a,h),S=this.pow(o,h.addn(1).iushrn(1)),N=this.pow(o,h),U=v;N.cmp(y)!==0;){for(var Z=N,H=0;Z.cmp(y)!==0;H++)Z=Z.redSqr();n(H<U);var $=this.pow(g,new i(1).iushln(U-H-1));S=S.redMul($),g=$.redSqr(),N=N.redMul(g),U=H}return S},X.prototype.invm=function(o){var f=o._invmp(this.m);return f.negative!==0?(f.negative=0,this.imod(f).redNeg()):this.imod(f)},X.prototype.pow=function(o,f){if(f.isZero())return new i(1).toRed(this);if(f.cmpn(1)===0)return o.clone();var l=4,h=new Array(1<<l);h[0]=new i(1).toRed(this),h[1]=o;for(var v=2;v<h.length;v++)h[v]=this.mul(h[v-1],o);var y=h[0],m=0,p=0,a=f.bitLength()%26;for(a===0&&(a=26),v=f.length-1;v>=0;v--){for(var g=f.words[v],S=a-1;S>=0;S--){var N=g>>S&1;if(y!==h[0]&&(y=this.sqr(y)),N===0&&m===0){p=0;continue}m<<=1,m|=N,p++,!(p!==l&&(v!==0||S!==0))&&(y=this.mul(y,h[m]),p=0,m=0)}a=26}return y},X.prototype.convertTo=function(o){var f=o.umod(this.m);return f===o?f.clone():f},X.prototype.convertFrom=function(o){var f=o.clone();return f.red=null,f},i.mont=function(o){return new ee(o)};function ee(x){X.call(this,x),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(ee,X),ee.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},ee.prototype.convertFrom=function(o){var f=this.imod(o.mul(this.rinv));return f.red=null,f},ee.prototype.imul=function(o,f){if(o.isZero()||f.isZero())return o.words[0]=0,o.length=1,o;var l=o.imul(f),h=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=l.isub(h).iushrn(this.shift),y=v;return v.cmp(this.m)>=0?y=v.isub(this.m):v.cmpn(0)<0&&(y=v.iadd(this.m)),y._forceRed(this)},ee.prototype.mul=function(o,f){if(o.isZero()||f.isZero())return new i(0)._forceRed(this);var l=o.mul(f),h=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=l.isub(h).iushrn(this.shift),y=v;return v.cmp(this.m)>=0?y=v.isub(this.m):v.cmpn(0)<0&&(y=v.iadd(this.m)),y._forceRed(this)},ee.prototype.invm=function(o){var f=this.imod(o._invmp(this.m).mul(this.r2));return f._forceRed(this)}})(e,Ve)})(Aw);var rA=Aw.exports,kw={exports:{}};kw.exports;(function(e){(function(t,r){function n(x,o){if(!x)throw new Error(o||"Assertion failed")}function s(x,o){x.super_=o;var f=function(){};f.prototype=o.prototype,x.prototype=new f,x.prototype.constructor=x}function i(x,o,f){if(i.isBN(x))return x;this.negative=0,this.words=null,this.length=0,this.red=null,x!==null&&((o==="le"||o==="be")&&(f=o,o=10),this._init(x||0,o||10,f||"be"))}typeof t=="object"?t.exports=i:r.BN=i,i.BN=i,i.wordSize=26;var u;try{typeof window<"u"&&typeof window.Buffer<"u"?u=window.Buffer:u=Kt.Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,f){return o.cmp(f)>0?o:f},i.min=function(o,f){return o.cmp(f)<0?o:f},i.prototype._init=function(o,f,l){if(typeof o=="number")return this._initNumber(o,f,l);if(typeof o=="object")return this._initArray(o,f,l);f==="hex"&&(f=16),n(f===(f|0)&&f>=2&&f<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h<o.length&&(f===16?this._parseHex(o,h,l):(this._parseBase(o,f,h),l==="le"&&this._initArray(this.toArray(),f,l)))},i.prototype._initNumber=function(o,f,l){o<0&&(this.negative=1,o=-o),o<67108864?(this.words=[o&67108863],this.length=1):o<4503599627370496?(this.words=[o&67108863,o/67108864&67108863],this.length=2):(n(o<9007199254740992),this.words=[o&67108863,o/67108864&67108863,1],this.length=3),l==="le"&&this._initArray(this.toArray(),f,l)},i.prototype._initArray=function(o,f,l){if(n(typeof o.length=="number"),o.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(o.length/3),this.words=new Array(this.length);for(var h=0;h<this.length;h++)this.words[h]=0;var v,y,m=0;if(l==="be")for(h=o.length-1,v=0;h>=0;h-=3)y=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[v]|=y<<m&67108863,this.words[v+1]=y>>>26-m&67108863,m+=24,m>=26&&(m-=26,v++);else if(l==="le")for(h=0,v=0;h<o.length;h+=3)y=o[h]|o[h+1]<<8|o[h+2]<<16,this.words[v]|=y<<m&67108863,this.words[v+1]=y>>>26-m&67108863,m+=24,m>=26&&(m-=26,v++);return this.strip()};function d(x,o){var f=x.charCodeAt(o);return f>=65&&f<=70?f-55:f>=97&&f<=102?f-87:f-48&15}function c(x,o,f){var l=d(x,f);return f-1>=o&&(l|=d(x,f-1)<<4),l}i.prototype._parseHex=function(o,f,l){this.length=Math.ceil((o.length-f)/6),this.words=new Array(this.length);for(var h=0;h<this.length;h++)this.words[h]=0;var v=0,y=0,m;if(l==="be")for(h=o.length-1;h>=f;h-=2)m=c(o,f,h)<<v,this.words[y]|=m&67108863,v>=18?(v-=18,y+=1,this.words[y]|=m>>>26):v+=8;else{var p=o.length-f;for(h=p%2===0?f+1:f;h<o.length;h+=2)m=c(o,f,h)<<v,this.words[y]|=m&67108863,v>=18?(v-=18,y+=1,this.words[y]|=m>>>26):v+=8}this.strip()};function b(x,o,f,l){for(var h=0,v=Math.min(x.length,f),y=o;y<v;y++){var m=x.charCodeAt(y)-48;h*=l,m>=49?h+=m-49+10:m>=17?h+=m-17+10:h+=m}return h}i.prototype._parseBase=function(o,f,l){this.words=[0],this.length=1;for(var h=0,v=1;v<=67108863;v*=f)h++;h--,v=v/f|0;for(var y=o.length-l,m=y%h,p=Math.min(y,y-m)+l,a=0,g=l;g<p;g+=h)a=b(o,g,g+h,f),this.imuln(v),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(m!==0){var S=1;for(a=b(o,g,o.length,f),g=0;g<m;g++)S*=f;this.imuln(S),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}this.strip()},i.prototype.copy=function(o){o.words=new Array(this.length);for(var f=0;f<this.length;f++)o.words[f]=this.words[f];o.length=this.length,o.negative=this.negative,o.red=this.red},i.prototype.clone=function(){var o=new i(null);return this.copy(o),o},i.prototype._expand=function(o){for(;this.length<o;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var w=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],M=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[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];i.prototype.toString=function(o,f){o=o||10,f=f|0||1;var l;if(o===16||o==="hex"){l="";for(var h=0,v=0,y=0;y<this.length;y++){var m=this.words[y],p=((m<<h|v)&16777215).toString(16);v=m>>>24-h&16777215,h+=2,h>=26&&(h-=26,y--),v!==0||y!==this.length-1?l=w[6-p.length]+p+l:l=p+l}for(v!==0&&(l=v.toString(16)+l);l.length%f!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(o===(o|0)&&o>=2&&o<=36){var a=M[o],g=_[o];l="";var S=this.clone();for(S.negative=0;!S.isZero();){var N=S.modn(g).toString(o);S=S.idivn(g),S.isZero()?l=N+l:l=w[a-N.length]+N+l}for(this.isZero()&&(l="0"+l);l.length%f!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,f){return n(typeof u<"u"),this.toArrayLike(u,o,f)},i.prototype.toArray=function(o,f){return this.toArrayLike(Array,o,f)},i.prototype.toArrayLike=function(o,f,l){var h=this.byteLength(),v=l||Math.max(1,h);n(h<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var y=f==="le",m=new o(v),p,a,g=this.clone();if(y){for(a=0;!g.isZero();a++)p=g.andln(255),g.iushrn(8),m[a]=p;for(;a<v;a++)m[a]=0}else{for(a=0;a<v-h;a++)m[a]=0;for(a=0;!g.isZero();a++)p=g.andln(255),g.iushrn(8),m[v-a-1]=p}return m},Math.clz32?i.prototype._countBits=function(o){return 32-Math.clz32(o)}:i.prototype._countBits=function(o){var f=o,l=0;return f>=4096&&(l+=13,f>>>=13),f>=64&&(l+=7,f>>>=7),f>=8&&(l+=4,f>>>=4),f>=2&&(l+=2,f>>>=2),l+f},i.prototype._zeroBits=function(o){if(o===0)return 26;var f=o,l=0;return f&8191||(l+=13,f>>>=13),f&127||(l+=7,f>>>=7),f&15||(l+=4,f>>>=4),f&3||(l+=2,f>>>=2),f&1||l++,l},i.prototype.bitLength=function(){var o=this.words[this.length-1],f=this._countBits(o);return(this.length-1)*26+f};function A(x){for(var o=new Array(x.bitLength()),f=0;f<o.length;f++){var l=f/26|0,h=f%26;o[f]=(x.words[l]&1<<h)>>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,f=0;f<this.length;f++){var l=this._zeroBits(this.words[f]);if(o+=l,l!==26)break}return o},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(o){return this.negative!==0?this.abs().inotn(o).iaddn(1):this.clone()},i.prototype.fromTwos=function(o){return this.testn(o-1)?this.notn(o).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(o){for(;this.length<o.length;)this.words[this.length++]=0;for(var f=0;f<o.length;f++)this.words[f]=this.words[f]|o.words[f];return this.strip()},i.prototype.ior=function(o){return n((this.negative|o.negative)===0),this.iuor(o)},i.prototype.or=function(o){return this.length>o.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var f;this.length>o.length?f=o:f=this;for(var l=0;l<f.length;l++)this.words[l]=this.words[l]&o.words[l];return this.length=f.length,this.strip()},i.prototype.iand=function(o){return n((this.negative|o.negative)===0),this.iuand(o)},i.prototype.and=function(o){return this.length>o.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var f,l;this.length>o.length?(f=this,l=o):(f=o,l=this);for(var h=0;h<l.length;h++)this.words[h]=f.words[h]^l.words[h];if(this!==f)for(;h<f.length;h++)this.words[h]=f.words[h];return this.length=f.length,this.strip()},i.prototype.ixor=function(o){return n((this.negative|o.negative)===0),this.iuxor(o)},i.prototype.xor=function(o){return this.length>o.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var f=Math.ceil(o/26)|0,l=o%26;this._expand(f),l>0&&f--;for(var h=0;h<f;h++)this.words[h]=~this.words[h]&67108863;return l>0&&(this.words[h]=~this.words[h]&67108863>>26-l),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,f){n(typeof o=="number"&&o>=0);var l=o/26|0,h=o%26;return this._expand(l+1),f?this.words[l]=this.words[l]|1<<h:this.words[l]=this.words[l]&~(1<<h),this.strip()},i.prototype.iadd=function(o){var f;if(this.negative!==0&&o.negative===0)return this.negative=0,f=this.isub(o),this.negative^=1,this._normSign();if(this.negative===0&&o.negative!==0)return o.negative=0,f=this.isub(o),o.negative=1,f._normSign();var l,h;this.length>o.length?(l=this,h=o):(l=o,h=this);for(var v=0,y=0;y<h.length;y++)f=(l.words[y]|0)+(h.words[y]|0)+v,this.words[y]=f&67108863,v=f>>>26;for(;v!==0&&y<l.length;y++)f=(l.words[y]|0)+v,this.words[y]=f&67108863,v=f>>>26;if(this.length=l.length,v!==0)this.words[this.length]=v,this.length++;else if(l!==this)for(;y<l.length;y++)this.words[y]=l.words[y];return this},i.prototype.add=function(o){var f;return o.negative!==0&&this.negative===0?(o.negative=0,f=this.sub(o),o.negative^=1,f):o.negative===0&&this.negative!==0?(this.negative=0,f=o.sub(this),this.negative=1,f):this.length>o.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var f=this.iadd(o);return o.negative=1,f._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var l=this.cmp(o);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,v;l>0?(h=this,v=o):(h=o,v=this);for(var y=0,m=0;m<v.length;m++)f=(h.words[m]|0)-(v.words[m]|0)+y,y=f>>26,this.words[m]=f&67108863;for(;y!==0&&m<h.length;m++)f=(h.words[m]|0)+y,y=f>>26,this.words[m]=f&67108863;if(y===0&&m<h.length&&h!==this)for(;m<h.length;m++)this.words[m]=h.words[m];return this.length=Math.max(this.length,m),h!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(o){return this.clone().isub(o)};function R(x,o,f){f.negative=o.negative^x.negative;var l=x.length+o.length|0;f.length=l,l=l-1|0;var h=x.words[0]|0,v=o.words[0]|0,y=h*v,m=y&67108863,p=y/67108864|0;f.words[0]=m;for(var a=1;a<l;a++){for(var g=p>>>26,S=p&67108863,N=Math.min(a,o.length-1),U=Math.max(0,a-x.length+1);U<=N;U++){var Z=a-U|0;h=x.words[Z]|0,v=o.words[U]|0,y=h*v+S,g+=y/67108864|0,S=y&67108863}f.words[a]=S|0,p=g|0}return p!==0?f.words[a]=p|0:f.length--,f.strip()}var B=function(o,f,l){var h=o.words,v=f.words,y=l.words,m=0,p,a,g,S=h[0]|0,N=S&8191,U=S>>>13,Z=h[1]|0,H=Z&8191,$=Z>>>13,P=h[2]|0,W=P&8191,G=P>>>13,K=h[3]|0,O=K&8191,Q=K>>>13,de=h[4]|0,oe=de&8191,se=de>>>13,Ie=h[5]|0,fe=Ie&8191,ne=Ie>>>13,je=h[6]|0,ae=je&8191,le=je>>>13,Le=h[7]|0,he=Le&8191,_e=Le>>>13,He=h[8]|0,ye=He&8191,Ae=He>>>13,ze=h[9]|0,me=ze&8191,ge=ze>>>13,Ke=v[0]|0,we=Ke&8191,Be=Ke>>>13,We=v[1]|0,be=We&8191,ke=We>>>13,Ze=v[2]|0,pe=Ze&8191,Ne=Ze>>>13,Qe=v[3]|0,xe=Qe&8191,Re=Qe>>>13,Xe=v[4]|0,Ee=Xe&8191,$e=Xe>>>13,tt=v[5]|0,D=tt&8191,C=tt>>>13,j=v[6]|0,Y=j&8191,te=j>>>13,ue=v[7]|0,re=ue&8191,ve=ue>>>13,De=v[8]|0,ce=De&8191,Me=De>>>13,Oe=v[9]|0,Se=Oe&8191,Te=Oe>>>13;l.negative=o.negative^f.negative,l.length=19,p=Math.imul(N,we),a=Math.imul(N,Be),a=a+Math.imul(U,we)|0,g=Math.imul(U,Be);var Ge=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,p=Math.imul(H,we),a=Math.imul(H,Be),a=a+Math.imul($,we)|0,g=Math.imul($,Be),p=p+Math.imul(N,be)|0,a=a+Math.imul(N,ke)|0,a=a+Math.imul(U,be)|0,g=g+Math.imul(U,ke)|0;var Je=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Je>>>26)|0,Je&=67108863,p=Math.imul(W,we),a=Math.imul(W,Be),a=a+Math.imul(G,we)|0,g=Math.imul(G,Be),p=p+Math.imul(H,be)|0,a=a+Math.imul(H,ke)|0,a=a+Math.imul($,be)|0,g=g+Math.imul($,ke)|0,p=p+Math.imul(N,pe)|0,a=a+Math.imul(N,Ne)|0,a=a+Math.imul(U,pe)|0,g=g+Math.imul(U,Ne)|0;var pt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(pt>>>26)|0,pt&=67108863,p=Math.imul(O,we),a=Math.imul(O,Be),a=a+Math.imul(Q,we)|0,g=Math.imul(Q,Be),p=p+Math.imul(W,be)|0,a=a+Math.imul(W,ke)|0,a=a+Math.imul(G,be)|0,g=g+Math.imul(G,ke)|0,p=p+Math.imul(H,pe)|0,a=a+Math.imul(H,Ne)|0,a=a+Math.imul($,pe)|0,g=g+Math.imul($,Ne)|0,p=p+Math.imul(N,xe)|0,a=a+Math.imul(N,Re)|0,a=a+Math.imul(U,xe)|0,g=g+Math.imul(U,Re)|0;var vt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(vt>>>26)|0,vt&=67108863,p=Math.imul(oe,we),a=Math.imul(oe,Be),a=a+Math.imul(se,we)|0,g=Math.imul(se,Be),p=p+Math.imul(O,be)|0,a=a+Math.imul(O,ke)|0,a=a+Math.imul(Q,be)|0,g=g+Math.imul(Q,ke)|0,p=p+Math.imul(W,pe)|0,a=a+Math.imul(W,Ne)|0,a=a+Math.imul(G,pe)|0,g=g+Math.imul(G,Ne)|0,p=p+Math.imul(H,xe)|0,a=a+Math.imul(H,Re)|0,a=a+Math.imul($,xe)|0,g=g+Math.imul($,Re)|0,p=p+Math.imul(N,Ee)|0,a=a+Math.imul(N,$e)|0,a=a+Math.imul(U,Ee)|0,g=g+Math.imul(U,$e)|0;var gt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(gt>>>26)|0,gt&=67108863,p=Math.imul(fe,we),a=Math.imul(fe,Be),a=a+Math.imul(ne,we)|0,g=Math.imul(ne,Be),p=p+Math.imul(oe,be)|0,a=a+Math.imul(oe,ke)|0,a=a+Math.imul(se,be)|0,g=g+Math.imul(se,ke)|0,p=p+Math.imul(O,pe)|0,a=a+Math.imul(O,Ne)|0,a=a+Math.imul(Q,pe)|0,g=g+Math.imul(Q,Ne)|0,p=p+Math.imul(W,xe)|0,a=a+Math.imul(W,Re)|0,a=a+Math.imul(G,xe)|0,g=g+Math.imul(G,Re)|0,p=p+Math.imul(H,Ee)|0,a=a+Math.imul(H,$e)|0,a=a+Math.imul($,Ee)|0,g=g+Math.imul($,$e)|0,p=p+Math.imul(N,D)|0,a=a+Math.imul(N,C)|0,a=a+Math.imul(U,D)|0,g=g+Math.imul(U,C)|0;var yt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(yt>>>26)|0,yt&=67108863,p=Math.imul(ae,we),a=Math.imul(ae,Be),a=a+Math.imul(le,we)|0,g=Math.imul(le,Be),p=p+Math.imul(fe,be)|0,a=a+Math.imul(fe,ke)|0,a=a+Math.imul(ne,be)|0,g=g+Math.imul(ne,ke)|0,p=p+Math.imul(oe,pe)|0,a=a+Math.imul(oe,Ne)|0,a=a+Math.imul(se,pe)|0,g=g+Math.imul(se,Ne)|0,p=p+Math.imul(O,xe)|0,a=a+Math.imul(O,Re)|0,a=a+Math.imul(Q,xe)|0,g=g+Math.imul(Q,Re)|0,p=p+Math.imul(W,Ee)|0,a=a+Math.imul(W,$e)|0,a=a+Math.imul(G,Ee)|0,g=g+Math.imul(G,$e)|0,p=p+Math.imul(H,D)|0,a=a+Math.imul(H,C)|0,a=a+Math.imul($,D)|0,g=g+Math.imul($,C)|0,p=p+Math.imul(N,Y)|0,a=a+Math.imul(N,te)|0,a=a+Math.imul(U,Y)|0,g=g+Math.imul(U,te)|0;var mt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(mt>>>26)|0,mt&=67108863,p=Math.imul(he,we),a=Math.imul(he,Be),a=a+Math.imul(_e,we)|0,g=Math.imul(_e,Be),p=p+Math.imul(ae,be)|0,a=a+Math.imul(ae,ke)|0,a=a+Math.imul(le,be)|0,g=g+Math.imul(le,ke)|0,p=p+Math.imul(fe,pe)|0,a=a+Math.imul(fe,Ne)|0,a=a+Math.imul(ne,pe)|0,g=g+Math.imul(ne,Ne)|0,p=p+Math.imul(oe,xe)|0,a=a+Math.imul(oe,Re)|0,a=a+Math.imul(se,xe)|0,g=g+Math.imul(se,Re)|0,p=p+Math.imul(O,Ee)|0,a=a+Math.imul(O,$e)|0,a=a+Math.imul(Q,Ee)|0,g=g+Math.imul(Q,$e)|0,p=p+Math.imul(W,D)|0,a=a+Math.imul(W,C)|0,a=a+Math.imul(G,D)|0,g=g+Math.imul(G,C)|0,p=p+Math.imul(H,Y)|0,a=a+Math.imul(H,te)|0,a=a+Math.imul($,Y)|0,g=g+Math.imul($,te)|0,p=p+Math.imul(N,re)|0,a=a+Math.imul(N,ve)|0,a=a+Math.imul(U,re)|0,g=g+Math.imul(U,ve)|0;var wt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(wt>>>26)|0,wt&=67108863,p=Math.imul(ye,we),a=Math.imul(ye,Be),a=a+Math.imul(Ae,we)|0,g=Math.imul(Ae,Be),p=p+Math.imul(he,be)|0,a=a+Math.imul(he,ke)|0,a=a+Math.imul(_e,be)|0,g=g+Math.imul(_e,ke)|0,p=p+Math.imul(ae,pe)|0,a=a+Math.imul(ae,Ne)|0,a=a+Math.imul(le,pe)|0,g=g+Math.imul(le,Ne)|0,p=p+Math.imul(fe,xe)|0,a=a+Math.imul(fe,Re)|0,a=a+Math.imul(ne,xe)|0,g=g+Math.imul(ne,Re)|0,p=p+Math.imul(oe,Ee)|0,a=a+Math.imul(oe,$e)|0,a=a+Math.imul(se,Ee)|0,g=g+Math.imul(se,$e)|0,p=p+Math.imul(O,D)|0,a=a+Math.imul(O,C)|0,a=a+Math.imul(Q,D)|0,g=g+Math.imul(Q,C)|0,p=p+Math.imul(W,Y)|0,a=a+Math.imul(W,te)|0,a=a+Math.imul(G,Y)|0,g=g+Math.imul(G,te)|0,p=p+Math.imul(H,re)|0,a=a+Math.imul(H,ve)|0,a=a+Math.imul($,re)|0,g=g+Math.imul($,ve)|0,p=p+Math.imul(N,ce)|0,a=a+Math.imul(N,Me)|0,a=a+Math.imul(U,ce)|0,g=g+Math.imul(U,Me)|0;var bt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(bt>>>26)|0,bt&=67108863,p=Math.imul(me,we),a=Math.imul(me,Be),a=a+Math.imul(ge,we)|0,g=Math.imul(ge,Be),p=p+Math.imul(ye,be)|0,a=a+Math.imul(ye,ke)|0,a=a+Math.imul(Ae,be)|0,g=g+Math.imul(Ae,ke)|0,p=p+Math.imul(he,pe)|0,a=a+Math.imul(he,Ne)|0,a=a+Math.imul(_e,pe)|0,g=g+Math.imul(_e,Ne)|0,p=p+Math.imul(ae,xe)|0,a=a+Math.imul(ae,Re)|0,a=a+Math.imul(le,xe)|0,g=g+Math.imul(le,Re)|0,p=p+Math.imul(fe,Ee)|0,a=a+Math.imul(fe,$e)|0,a=a+Math.imul(ne,Ee)|0,g=g+Math.imul(ne,$e)|0,p=p+Math.imul(oe,D)|0,a=a+Math.imul(oe,C)|0,a=a+Math.imul(se,D)|0,g=g+Math.imul(se,C)|0,p=p+Math.imul(O,Y)|0,a=a+Math.imul(O,te)|0,a=a+Math.imul(Q,Y)|0,g=g+Math.imul(Q,te)|0,p=p+Math.imul(W,re)|0,a=a+Math.imul(W,ve)|0,a=a+Math.imul(G,re)|0,g=g+Math.imul(G,ve)|0,p=p+Math.imul(H,ce)|0,a=a+Math.imul(H,Me)|0,a=a+Math.imul($,ce)|0,g=g+Math.imul($,Me)|0,p=p+Math.imul(N,Se)|0,a=a+Math.imul(N,Te)|0,a=a+Math.imul(U,Se)|0,g=g+Math.imul(U,Te)|0;var xt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(xt>>>26)|0,xt&=67108863,p=Math.imul(me,be),a=Math.imul(me,ke),a=a+Math.imul(ge,be)|0,g=Math.imul(ge,ke),p=p+Math.imul(ye,pe)|0,a=a+Math.imul(ye,Ne)|0,a=a+Math.imul(Ae,pe)|0,g=g+Math.imul(Ae,Ne)|0,p=p+Math.imul(he,xe)|0,a=a+Math.imul(he,Re)|0,a=a+Math.imul(_e,xe)|0,g=g+Math.imul(_e,Re)|0,p=p+Math.imul(ae,Ee)|0,a=a+Math.imul(ae,$e)|0,a=a+Math.imul(le,Ee)|0,g=g+Math.imul(le,$e)|0,p=p+Math.imul(fe,D)|0,a=a+Math.imul(fe,C)|0,a=a+Math.imul(ne,D)|0,g=g+Math.imul(ne,C)|0,p=p+Math.imul(oe,Y)|0,a=a+Math.imul(oe,te)|0,a=a+Math.imul(se,Y)|0,g=g+Math.imul(se,te)|0,p=p+Math.imul(O,re)|0,a=a+Math.imul(O,ve)|0,a=a+Math.imul(Q,re)|0,g=g+Math.imul(Q,ve)|0,p=p+Math.imul(W,ce)|0,a=a+Math.imul(W,Me)|0,a=a+Math.imul(G,ce)|0,g=g+Math.imul(G,Me)|0,p=p+Math.imul(H,Se)|0,a=a+Math.imul(H,Te)|0,a=a+Math.imul($,Se)|0,g=g+Math.imul($,Te)|0;var Mt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,p=Math.imul(me,pe),a=Math.imul(me,Ne),a=a+Math.imul(ge,pe)|0,g=Math.imul(ge,Ne),p=p+Math.imul(ye,xe)|0,a=a+Math.imul(ye,Re)|0,a=a+Math.imul(Ae,xe)|0,g=g+Math.imul(Ae,Re)|0,p=p+Math.imul(he,Ee)|0,a=a+Math.imul(he,$e)|0,a=a+Math.imul(_e,Ee)|0,g=g+Math.imul(_e,$e)|0,p=p+Math.imul(ae,D)|0,a=a+Math.imul(ae,C)|0,a=a+Math.imul(le,D)|0,g=g+Math.imul(le,C)|0,p=p+Math.imul(fe,Y)|0,a=a+Math.imul(fe,te)|0,a=a+Math.imul(ne,Y)|0,g=g+Math.imul(ne,te)|0,p=p+Math.imul(oe,re)|0,a=a+Math.imul(oe,ve)|0,a=a+Math.imul(se,re)|0,g=g+Math.imul(se,ve)|0,p=p+Math.imul(O,ce)|0,a=a+Math.imul(O,Me)|0,a=a+Math.imul(Q,ce)|0,g=g+Math.imul(Q,Me)|0,p=p+Math.imul(W,Se)|0,a=a+Math.imul(W,Te)|0,a=a+Math.imul(G,Se)|0,g=g+Math.imul(G,Te)|0;var _t=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(_t>>>26)|0,_t&=67108863,p=Math.imul(me,xe),a=Math.imul(me,Re),a=a+Math.imul(ge,xe)|0,g=Math.imul(ge,Re),p=p+Math.imul(ye,Ee)|0,a=a+Math.imul(ye,$e)|0,a=a+Math.imul(Ae,Ee)|0,g=g+Math.imul(Ae,$e)|0,p=p+Math.imul(he,D)|0,a=a+Math.imul(he,C)|0,a=a+Math.imul(_e,D)|0,g=g+Math.imul(_e,C)|0,p=p+Math.imul(ae,Y)|0,a=a+Math.imul(ae,te)|0,a=a+Math.imul(le,Y)|0,g=g+Math.imul(le,te)|0,p=p+Math.imul(fe,re)|0,a=a+Math.imul(fe,ve)|0,a=a+Math.imul(ne,re)|0,g=g+Math.imul(ne,ve)|0,p=p+Math.imul(oe,ce)|0,a=a+Math.imul(oe,Me)|0,a=a+Math.imul(se,ce)|0,g=g+Math.imul(se,Me)|0,p=p+Math.imul(O,Se)|0,a=a+Math.imul(O,Te)|0,a=a+Math.imul(Q,Se)|0,g=g+Math.imul(Q,Te)|0;var Et=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Et>>>26)|0,Et&=67108863,p=Math.imul(me,Ee),a=Math.imul(me,$e),a=a+Math.imul(ge,Ee)|0,g=Math.imul(ge,$e),p=p+Math.imul(ye,D)|0,a=a+Math.imul(ye,C)|0,a=a+Math.imul(Ae,D)|0,g=g+Math.imul(Ae,C)|0,p=p+Math.imul(he,Y)|0,a=a+Math.imul(he,te)|0,a=a+Math.imul(_e,Y)|0,g=g+Math.imul(_e,te)|0,p=p+Math.imul(ae,re)|0,a=a+Math.imul(ae,ve)|0,a=a+Math.imul(le,re)|0,g=g+Math.imul(le,ve)|0,p=p+Math.imul(fe,ce)|0,a=a+Math.imul(fe,Me)|0,a=a+Math.imul(ne,ce)|0,g=g+Math.imul(ne,Me)|0,p=p+Math.imul(oe,Se)|0,a=a+Math.imul(oe,Te)|0,a=a+Math.imul(se,Se)|0,g=g+Math.imul(se,Te)|0;var St=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(St>>>26)|0,St&=67108863,p=Math.imul(me,D),a=Math.imul(me,C),a=a+Math.imul(ge,D)|0,g=Math.imul(ge,C),p=p+Math.imul(ye,Y)|0,a=a+Math.imul(ye,te)|0,a=a+Math.imul(Ae,Y)|0,g=g+Math.imul(Ae,te)|0,p=p+Math.imul(he,re)|0,a=a+Math.imul(he,ve)|0,a=a+Math.imul(_e,re)|0,g=g+Math.imul(_e,ve)|0,p=p+Math.imul(ae,ce)|0,a=a+Math.imul(ae,Me)|0,a=a+Math.imul(le,ce)|0,g=g+Math.imul(le,Me)|0,p=p+Math.imul(fe,Se)|0,a=a+Math.imul(fe,Te)|0,a=a+Math.imul(ne,Se)|0,g=g+Math.imul(ne,Te)|0;var At=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(At>>>26)|0,At&=67108863,p=Math.imul(me,Y),a=Math.imul(me,te),a=a+Math.imul(ge,Y)|0,g=Math.imul(ge,te),p=p+Math.imul(ye,re)|0,a=a+Math.imul(ye,ve)|0,a=a+Math.imul(Ae,re)|0,g=g+Math.imul(Ae,ve)|0,p=p+Math.imul(he,ce)|0,a=a+Math.imul(he,Me)|0,a=a+Math.imul(_e,ce)|0,g=g+Math.imul(_e,Me)|0,p=p+Math.imul(ae,Se)|0,a=a+Math.imul(ae,Te)|0,a=a+Math.imul(le,Se)|0,g=g+Math.imul(le,Te)|0;var kt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(kt>>>26)|0,kt&=67108863,p=Math.imul(me,re),a=Math.imul(me,ve),a=a+Math.imul(ge,re)|0,g=Math.imul(ge,ve),p=p+Math.imul(ye,ce)|0,a=a+Math.imul(ye,Me)|0,a=a+Math.imul(Ae,ce)|0,g=g+Math.imul(Ae,Me)|0,p=p+Math.imul(he,Se)|0,a=a+Math.imul(he,Te)|0,a=a+Math.imul(_e,Se)|0,g=g+Math.imul(_e,Te)|0;var Bt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,p=Math.imul(me,ce),a=Math.imul(me,Me),a=a+Math.imul(ge,ce)|0,g=Math.imul(ge,Me),p=p+Math.imul(ye,Se)|0,a=a+Math.imul(ye,Te)|0,a=a+Math.imul(Ae,Se)|0,g=g+Math.imul(Ae,Te)|0;var Rt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,p=Math.imul(me,Se),a=Math.imul(me,Te),a=a+Math.imul(ge,Se)|0,g=Math.imul(ge,Te);var $t=(m+p|0)+((a&8191)<<13)|0;return m=(g+(a>>>13)|0)+($t>>>26)|0,$t&=67108863,y[0]=Ge,y[1]=Je,y[2]=pt,y[3]=vt,y[4]=gt,y[5]=yt,y[6]=mt,y[7]=wt,y[8]=bt,y[9]=xt,y[10]=Mt,y[11]=_t,y[12]=Et,y[13]=St,y[14]=At,y[15]=kt,y[16]=Bt,y[17]=Rt,y[18]=$t,m!==0&&(y[19]=m,l.length++),l};Math.imul||(B=R);function I(x,o,f){f.negative=o.negative^x.negative,f.length=x.length+o.length;for(var l=0,h=0,v=0;v<f.length-1;v++){var y=h;h=0;for(var m=l&67108863,p=Math.min(v,o.length-1),a=Math.max(0,v-x.length+1);a<=p;a++){var g=v-a,S=x.words[g]|0,N=o.words[a]|0,U=S*N,Z=U&67108863;y=y+(U/67108864|0)|0,Z=Z+m|0,m=Z&67108863,y=y+(Z>>>26)|0,h+=y>>>26,y&=67108863}f.words[v]=m,l=y,y=h}return l!==0?f.words[v]=l:f.length--,f.strip()}function E(x,o,f){var l=new k;return l.mulp(x,o,f)}i.prototype.mulTo=function(o,f){var l,h=this.length+o.length;return this.length===10&&o.length===10?l=B(this,o,f):h<63?l=R(this,o,f):h<1024?l=I(this,o,f):l=E(this,o,f),l};function k(x,o){this.x=x,this.y=o}k.prototype.makeRBT=function(o){for(var f=new Array(o),l=i.prototype._countBits(o)-1,h=0;h<o;h++)f[h]=this.revBin(h,l,o);return f},k.prototype.revBin=function(o,f,l){if(o===0||o===l-1)return o;for(var h=0,v=0;v<f;v++)h|=(o&1)<<f-v-1,o>>=1;return h},k.prototype.permute=function(o,f,l,h,v,y){for(var m=0;m<y;m++)h[m]=f[o[m]],v[m]=l[o[m]]},k.prototype.transform=function(o,f,l,h,v,y){this.permute(y,o,f,l,h,v);for(var m=1;m<v;m<<=1)for(var p=m<<1,a=Math.cos(2*Math.PI/p),g=Math.sin(2*Math.PI/p),S=0;S<v;S+=p)for(var N=a,U=g,Z=0;Z<m;Z++){var H=l[S+Z],$=h[S+Z],P=l[S+Z+m],W=h[S+Z+m],G=N*P-U*W;W=N*W+U*P,P=G,l[S+Z]=H+P,h[S+Z]=$+W,l[S+Z+m]=H-P,h[S+Z+m]=$-W,Z!==p&&(G=a*N-g*U,U=a*U+g*N,N=G)}},k.prototype.guessLen13b=function(o,f){var l=Math.max(f,o)|1,h=l&1,v=0;for(l=l/2|0;l;l=l>>>1)v++;return 1<<v+1+h},k.prototype.conjugate=function(o,f,l){if(!(l<=1))for(var h=0;h<l/2;h++){var v=o[h];o[h]=o[l-h-1],o[l-h-1]=v,v=f[h],f[h]=-f[l-h-1],f[l-h-1]=-v}},k.prototype.normalize13b=function(o,f){for(var l=0,h=0;h<f/2;h++){var v=Math.round(o[2*h+1]/f)*8192+Math.round(o[2*h]/f)+l;o[h]=v&67108863,v<67108864?l=0:l=v/67108864|0}return o},k.prototype.convert13b=function(o,f,l,h){for(var v=0,y=0;y<f;y++)v=v+(o[y]|0),l[2*y]=v&8191,v=v>>>13,l[2*y+1]=v&8191,v=v>>>13;for(y=2*f;y<h;++y)l[y]=0;n(v===0),n((v&-8192)===0)},k.prototype.stub=function(o){for(var f=new Array(o),l=0;l<o;l++)f[l]=0;return f},k.prototype.mulp=function(o,f,l){var h=2*this.guessLen13b(o.length,f.length),v=this.makeRBT(h),y=this.stub(h),m=new Array(h),p=new Array(h),a=new Array(h),g=new Array(h),S=new Array(h),N=new Array(h),U=l.words;U.length=h,this.convert13b(o.words,o.length,m,h),this.convert13b(f.words,f.length,g,h),this.transform(m,y,p,a,h,v),this.transform(g,y,S,N,h,v);for(var Z=0;Z<h;Z++){var H=p[Z]*S[Z]-a[Z]*N[Z];a[Z]=p[Z]*N[Z]+a[Z]*S[Z],p[Z]=H}return this.conjugate(p,a,h),this.transform(p,a,U,y,h,v),this.conjugate(U,y,h),this.normalize13b(U,h),l.negative=o.negative^f.negative,l.length=o.length+f.length,l.strip()},i.prototype.mul=function(o){var f=new i(null);return f.words=new Array(this.length+o.length),this.mulTo(o,f)},i.prototype.mulf=function(o){var f=new i(null);return f.words=new Array(this.length+o.length),E(this,o,f)},i.prototype.imul=function(o){return this.clone().mulTo(o,this)},i.prototype.imuln=function(o){n(typeof o=="number"),n(o<67108864);for(var f=0,l=0;l<this.length;l++){var h=(this.words[l]|0)*o,v=(h&67108863)+(f&67108863);f>>=26,f+=h/67108864|0,f+=v>>>26,this.words[l]=v&67108863}return f!==0&&(this.words[l]=f,this.length++),this.length=o===0?1:this.length,this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var f=A(o);if(f.length===0)return new i(1);for(var l=this,h=0;h<f.length&&f[h]===0;h++,l=l.sqr());if(++h<f.length)for(var v=l.sqr();h<f.length;h++,v=v.sqr())f[h]!==0&&(l=l.mul(v));return l},i.prototype.iushln=function(o){n(typeof o=="number"&&o>=0);var f=o%26,l=(o-f)/26,h=67108863>>>26-f<<26-f,v;if(f!==0){var y=0;for(v=0;v<this.length;v++){var m=this.words[v]&h,p=(this.words[v]|0)-m<<f;this.words[v]=p|y,y=m>>>26-f}y&&(this.words[v]=y,this.length++)}if(l!==0){for(v=this.length-1;v>=0;v--)this.words[v+l]=this.words[v];for(v=0;v<l;v++)this.words[v]=0;this.length+=l}return this.strip()},i.prototype.ishln=function(o){return n(this.negative===0),this.iushln(o)},i.prototype.iushrn=function(o,f,l){n(typeof o=="number"&&o>=0);var h;f?h=(f-f%26)/26:h=0;var v=o%26,y=Math.min((o-v)/26,this.length),m=67108863^67108863>>>v<<v,p=l;if(h-=y,h=Math.max(0,h),p){for(var a=0;a<y;a++)p.words[a]=this.words[a];p.length=y}if(y!==0)if(this.length>y)for(this.length-=y,a=0;a<this.length;a++)this.words[a]=this.words[a+y];else this.words[0]=0,this.length=1;var g=0;for(a=this.length-1;a>=0&&(g!==0||a>=h);a--){var S=this.words[a]|0;this.words[a]=g<<26-v|S>>>v,g=S&m}return p&&g!==0&&(p.words[p.length++]=g),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,f,l){return n(this.negative===0),this.iushrn(o,f,l)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var f=o%26,l=(o-f)/26,h=1<<f;if(this.length<=l)return!1;var v=this.words[l];return!!(v&h)},i.prototype.imaskn=function(o){n(typeof o=="number"&&o>=0);var f=o%26,l=(o-f)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(f!==0&&l++,this.length=Math.min(l,this.length),f!==0){var h=67108863^67108863>>>f<<f;this.words[this.length-1]&=h}return this.strip()},i.prototype.maskn=function(o){return this.clone().imaskn(o)},i.prototype.iaddn=function(o){return n(typeof o=="number"),n(o<67108864),o<0?this.isubn(-o):this.negative!==0?this.length===1&&(this.words[0]|0)<o?(this.words[0]=o-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(o),this.negative=1,this):this._iaddn(o)},i.prototype._iaddn=function(o){this.words[0]+=o;for(var f=0;f<this.length&&this.words[f]>=67108864;f++)this.words[f]-=67108864,f===this.length-1?this.words[f+1]=1:this.words[f+1]++;return this.length=Math.max(this.length,f+1),this},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var f=0;f<this.length&&this.words[f]<0;f++)this.words[f]+=67108864,this.words[f+1]-=1;return this.strip()},i.prototype.addn=function(o){return this.clone().iaddn(o)},i.prototype.subn=function(o){return this.clone().isubn(o)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(o,f,l){var h=o.length+l,v;this._expand(h);var y,m=0;for(v=0;v<o.length;v++){y=(this.words[v+l]|0)+m;var p=(o.words[v]|0)*f;y-=p&67108863,m=(y>>26)-(p/67108864|0),this.words[v+l]=y&67108863}for(;v<this.length-l;v++)y=(this.words[v+l]|0)+m,m=y>>26,this.words[v+l]=y&67108863;if(m===0)return this.strip();for(n(m===-1),m=0,v=0;v<this.length;v++)y=-(this.words[v]|0)+m,m=y>>26,this.words[v]=y&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,f){var l=this.length-o.length,h=this.clone(),v=o,y=v.words[v.length-1]|0,m=this._countBits(y);l=26-m,l!==0&&(v=v.ushln(l),h.iushln(l),y=v.words[v.length-1]|0);var p=h.length-v.length,a;if(f!=="mod"){a=new i(null),a.length=p+1,a.words=new Array(a.length);for(var g=0;g<a.length;g++)a.words[g]=0}var S=h.clone()._ishlnsubmul(v,1,p);S.negative===0&&(h=S,a&&(a.words[p]=1));for(var N=p-1;N>=0;N--){var U=(h.words[v.length+N]|0)*67108864+(h.words[v.length+N-1]|0);for(U=Math.min(U/y|0,67108863),h._ishlnsubmul(v,U,N);h.negative!==0;)U--,h.negative=0,h._ishlnsubmul(v,1,N),h.isZero()||(h.negative^=1);a&&(a.words[N]=U)}return a&&a.strip(),h.strip(),f!=="div"&&l!==0&&h.iushrn(l),{div:a||null,mod:h}},i.prototype.divmod=function(o,f,l){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,v,y;return this.negative!==0&&o.negative===0?(y=this.neg().divmod(o,f),f!=="mod"&&(h=y.div.neg()),f!=="div"&&(v=y.mod.neg(),l&&v.negative!==0&&v.iadd(o)),{div:h,mod:v}):this.negative===0&&o.negative!==0?(y=this.divmod(o.neg(),f),f!=="mod"&&(h=y.div.neg()),{div:h,mod:y.mod}):this.negative&o.negative?(y=this.neg().divmod(o.neg(),f),f!=="div"&&(v=y.mod.neg(),l&&v.negative!==0&&v.isub(o)),{div:y.div,mod:v}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?f==="div"?{div:this.divn(o.words[0]),mod:null}:f==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,f)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var f=this.divmod(o);if(f.mod.isZero())return f.div;var l=f.div.negative!==0?f.mod.isub(o):f.mod,h=o.ushrn(1),v=o.andln(1),y=l.cmp(h);return y<0||v===1&&y===0?f.div:f.div.negative!==0?f.div.isubn(1):f.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var f=(1<<26)%o,l=0,h=this.length-1;h>=0;h--)l=(f*l+(this.words[h]|0))%o;return l},i.prototype.idivn=function(o){n(o<=67108863);for(var f=0,l=this.length-1;l>=0;l--){var h=(this.words[l]|0)+f*67108864;this.words[l]=h/o|0,f=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var f=this,l=o.clone();f.negative!==0?f=f.umod(o):f=f.clone();for(var h=new i(1),v=new i(0),y=new i(0),m=new i(1),p=0;f.isEven()&&l.isEven();)f.iushrn(1),l.iushrn(1),++p;for(var a=l.clone(),g=f.clone();!f.isZero();){for(var S=0,N=1;!(f.words[0]&N)&&S<26;++S,N<<=1);if(S>0)for(f.iushrn(S);S-- >0;)(h.isOdd()||v.isOdd())&&(h.iadd(a),v.isub(g)),h.iushrn(1),v.iushrn(1);for(var U=0,Z=1;!(l.words[0]&Z)&&U<26;++U,Z<<=1);if(U>0)for(l.iushrn(U);U-- >0;)(y.isOdd()||m.isOdd())&&(y.iadd(a),m.isub(g)),y.iushrn(1),m.iushrn(1);f.cmp(l)>=0?(f.isub(l),h.isub(y),v.isub(m)):(l.isub(f),y.isub(h),m.isub(v))}return{a:y,b:m,gcd:l.iushln(p)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var f=this,l=o.clone();f.negative!==0?f=f.umod(o):f=f.clone();for(var h=new i(1),v=new i(0),y=l.clone();f.cmpn(1)>0&&l.cmpn(1)>0;){for(var m=0,p=1;!(f.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(f.iushrn(m);m-- >0;)h.isOdd()&&h.iadd(y),h.iushrn(1);for(var a=0,g=1;!(l.words[0]&g)&&a<26;++a,g<<=1);if(a>0)for(l.iushrn(a);a-- >0;)v.isOdd()&&v.iadd(y),v.iushrn(1);f.cmp(l)>=0?(f.isub(l),h.isub(v)):(l.isub(f),v.isub(h))}var S;return f.cmpn(1)===0?S=h:S=v,S.cmpn(0)<0&&S.iadd(o),S},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var f=this.clone(),l=o.clone();f.negative=0,l.negative=0;for(var h=0;f.isEven()&&l.isEven();h++)f.iushrn(1),l.iushrn(1);do{for(;f.isEven();)f.iushrn(1);for(;l.isEven();)l.iushrn(1);var v=f.cmp(l);if(v<0){var y=f;f=l,l=y}else if(v===0||l.cmpn(1)===0)break;f.isub(l)}while(!0);return l.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var f=o%26,l=(o-f)/26,h=1<<f;if(this.length<=l)return this._expand(l+1),this.words[l]|=h,this;for(var v=h,y=l;v!==0&&y<this.length;y++){var m=this.words[y]|0;m+=v,v=m>>>26,m&=67108863,this.words[y]=m}return v!==0&&(this.words[y]=v,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var f=o<0;if(this.negative!==0&&!f)return-1;if(this.negative===0&&f)return 1;this.strip();var l;if(this.length>1)l=1;else{f&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;l=h===o?0:h<o?-1:1}return this.negative!==0?-l|0:l},i.prototype.cmp=function(o){if(this.negative!==0&&o.negative===0)return-1;if(this.negative===0&&o.negative!==0)return 1;var f=this.ucmp(o);return this.negative!==0?-f|0:f},i.prototype.ucmp=function(o){if(this.length>o.length)return 1;if(this.length<o.length)return-1;for(var f=0,l=this.length-1;l>=0;l--){var h=this.words[l]|0,v=o.words[l]|0;if(h!==v){h<v?f=-1:h>v&&(f=1);break}}return f},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new X(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var T={k256:null,p224:null,p192:null,p25519:null};function L(x,o){this.name=x,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}L.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},L.prototype.ireduce=function(o){var f=o,l;do this.split(f,this.tmp),f=this.imulK(f),f=f.iadd(this.tmp),l=f.bitLength();while(l>this.n);var h=l<this.n?-1:f.ucmp(this.p);return h===0?(f.words[0]=0,f.length=1):h>0?f.isub(this.p):f.strip!==void 0?f.strip():f._strip(),f},L.prototype.split=function(o,f){o.iushrn(this.n,0,f)},L.prototype.imulK=function(o){return o.imul(this.k)};function q(){L.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(q,L),q.prototype.split=function(o,f){for(var l=4194303,h=Math.min(o.length,9),v=0;v<h;v++)f.words[v]=o.words[v];if(f.length=h,o.length<=9){o.words[0]=0,o.length=1;return}var y=o.words[9];for(f.words[f.length++]=y&l,v=10;v<o.length;v++){var m=o.words[v]|0;o.words[v-10]=(m&l)<<4|y>>>22,y=m}y>>>=22,o.words[v-10]=y,y===0&&o.length>10?o.length-=10:o.length-=9},q.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var f=0,l=0;l<o.length;l++){var h=o.words[l]|0;f+=h*977,o.words[l]=f&67108863,f=h*64+(f/67108864|0)}return o.words[o.length-1]===0&&(o.length--,o.words[o.length-1]===0&&o.length--),o};function z(){L.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(z,L);function J(){L.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(J,L);function F(){L.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(F,L),F.prototype.imulK=function(o){for(var f=0,l=0;l<o.length;l++){var h=(o.words[l]|0)*19+f,v=h&67108863;h>>>=26,o.words[l]=v,f=h}return f!==0&&(o.words[o.length++]=f),o},i._prime=function(o){if(T[o])return T[o];var f;if(o==="k256")f=new q;else if(o==="p224")f=new z;else if(o==="p192")f=new J;else if(o==="p25519")f=new F;else throw new Error("Unknown prime "+o);return T[o]=f,f};function X(x){if(typeof x=="string"){var o=i._prime(x);this.m=o.p,this.prime=o}else n(x.gtn(1),"modulus must be greater than 1"),this.m=x,this.prime=null}X.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},X.prototype._verify2=function(o,f){n((o.negative|f.negative)===0,"red works only with positives"),n(o.red&&o.red===f.red,"red works only with red numbers")},X.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},X.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},X.prototype.add=function(o,f){this._verify2(o,f);var l=o.add(f);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},X.prototype.iadd=function(o,f){this._verify2(o,f);var l=o.iadd(f);return l.cmp(this.m)>=0&&l.isub(this.m),l},X.prototype.sub=function(o,f){this._verify2(o,f);var l=o.sub(f);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},X.prototype.isub=function(o,f){this._verify2(o,f);var l=o.isub(f);return l.cmpn(0)<0&&l.iadd(this.m),l},X.prototype.shl=function(o,f){return this._verify1(o),this.imod(o.ushln(f))},X.prototype.imul=function(o,f){return this._verify2(o,f),this.imod(o.imul(f))},X.prototype.mul=function(o,f){return this._verify2(o,f),this.imod(o.mul(f))},X.prototype.isqr=function(o){return this.imul(o,o.clone())},X.prototype.sqr=function(o){return this.mul(o,o)},X.prototype.sqrt=function(o){if(o.isZero())return o.clone();var f=this.m.andln(3);if(n(f%2===1),f===3){var l=this.m.add(new i(1)).iushrn(2);return this.pow(o,l)}for(var h=this.m.subn(1),v=0;!h.isZero()&&h.andln(1)===0;)v++,h.iushrn(1);n(!h.isZero());var y=new i(1).toRed(this),m=y.redNeg(),p=this.m.subn(1).iushrn(1),a=this.m.bitLength();for(a=new i(2*a*a).toRed(this);this.pow(a,p).cmp(m)!==0;)a.redIAdd(m);for(var g=this.pow(a,h),S=this.pow(o,h.addn(1).iushrn(1)),N=this.pow(o,h),U=v;N.cmp(y)!==0;){for(var Z=N,H=0;Z.cmp(y)!==0;H++)Z=Z.redSqr();n(H<U);var $=this.pow(g,new i(1).iushln(U-H-1));S=S.redMul($),g=$.redSqr(),N=N.redMul(g),U=H}return S},X.prototype.invm=function(o){var f=o._invmp(this.m);return f.negative!==0?(f.negative=0,this.imod(f).redNeg()):this.imod(f)},X.prototype.pow=function(o,f){if(f.isZero())return new i(1).toRed(this);if(f.cmpn(1)===0)return o.clone();var l=4,h=new Array(1<<l);h[0]=new i(1).toRed(this),h[1]=o;for(var v=2;v<h.length;v++)h[v]=this.mul(h[v-1],o);var y=h[0],m=0,p=0,a=f.bitLength()%26;for(a===0&&(a=26),v=f.length-1;v>=0;v--){for(var g=f.words[v],S=a-1;S>=0;S--){var N=g>>S&1;if(y!==h[0]&&(y=this.sqr(y)),N===0&&m===0){p=0;continue}m<<=1,m|=N,p++,!(p!==l&&(v!==0||S!==0))&&(y=this.mul(y,h[m]),p=0,m=0)}a=26}return y},X.prototype.convertTo=function(o){var f=o.umod(this.m);return f===o?f.clone():f},X.prototype.convertFrom=function(o){var f=o.clone();return f.red=null,f},i.mont=function(o){return new ee(o)};function ee(x){X.call(this,x),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(ee,X),ee.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},ee.prototype.convertFrom=function(o){var f=this.imod(o.mul(this.rinv));return f.red=null,f},ee.prototype.imul=function(o,f){if(o.isZero()||f.isZero())return o.words[0]=0,o.length=1,o;var l=o.imul(f),h=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=l.isub(h).iushrn(this.shift),y=v;return v.cmp(this.m)>=0?y=v.isub(this.m):v.cmpn(0)<0&&(y=v.iadd(this.m)),y._forceRed(this)},ee.prototype.mul=function(o,f){if(o.isZero()||f.isZero())return new i(0)._forceRed(this);var l=o.mul(f),h=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=l.isub(h).iushrn(this.shift),y=v;return v.cmp(this.m)>=0?y=v.isub(this.m):v.cmpn(0)<0&&(y=v.iadd(this.m)),y._forceRed(this)},ee.prototype.invm=function(o){var f=this.imod(o._invmp(this.m).mul(this.r2));return f._forceRed(this)}})(e,Ve)})(kw);var WZ=kw.exports,Kh={exports:{}},D4;function Bw(){if(D4)return Kh.exports;D4=1;var e;Kh.exports=function(s){return e||(e=new t(null)),e.generate(s)};function t(n){this.rand=n}if(Kh.exports.Rand=t,t.prototype.generate=function(s){return this._rand(s)},t.prototype._rand=function(s){if(this.rand.getBytes)return this.rand.getBytes(s);for(var i=new Uint8Array(s),u=0;u<i.length;u++)i[u]=this.rand.getByte();return i},typeof self=="object")self.crypto&&self.crypto.getRandomValues?t.prototype._rand=function(s){var i=new Uint8Array(s);return self.crypto.getRandomValues(i),i}:self.msCrypto&&self.msCrypto.getRandomValues?t.prototype._rand=function(s){var i=new Uint8Array(s);return self.msCrypto.getRandomValues(i),i}:typeof window=="object"&&(t.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var r=rk();if(typeof r.randomBytes!="function")throw new Error("Not supported");t.prototype._rand=function(s){return r.randomBytes(s)}}catch{}return Kh.exports}var J1,q4;function nA(){if(q4)return J1;q4=1;var e=WZ,t=Bw();function r(n){this.rand=n||new t.Rand}return J1=r,r.create=function(s){return new r(s)},r.prototype._randbelow=function(s){var i=s.bitLength(),u=Math.ceil(i/8);do var d=new e(this.rand.generate(u));while(d.cmp(s)>=0);return d},r.prototype._randrange=function(s,i){var u=i.sub(s);return s.add(this._randbelow(u))},r.prototype.test=function(s,i,u){var d=s.bitLength(),c=e.mont(s),b=new e(1).toRed(c);i||(i=Math.max(1,d/48|0));for(var w=s.subn(1),M=0;!w.testn(M);M++);for(var _=s.shrn(M),A=w.toRed(c),R=!0;i>0;i--){var B=this._randrange(new e(2),w);u&&u(B);var I=B.toRed(c).redPow(_);if(!(I.cmp(b)===0||I.cmp(A)===0)){for(var E=1;E<M;E++){if(I=I.redSqr(),I.cmp(b)===0)return!1;if(I.cmp(A)===0)break}if(E===M)return!1}}return R},r.prototype.getDivisor=function(s,i){var u=s.bitLength(),d=e.mont(s),c=new e(1).toRed(d);i||(i=Math.max(1,u/48|0));for(var b=s.subn(1),w=0;!b.testn(w);w++);for(var M=s.shrn(w),_=b.toRed(d);i>0;i--){var A=this._randrange(new e(2),b),R=s.gcd(A);if(R.cmpn(1)!==0)return R;var B=A.toRed(d).redPow(M);if(!(B.cmp(c)===0||B.cmp(_)===0)){for(var I=1;I<w;I++){if(B=B.redSqr(),B.cmp(c)===0)return B.fromRed().subn(1).gcd(s);if(B.cmp(_)===0)break}if(I===w)return B=B.redSqr(),B.fromRed().subn(1).gcd(s)}}return!1},J1}var Y1,F4;function iA(){if(F4)return Y1;F4=1;var e=yl;Y1=I,I.simpleSieve=R,I.fermatTest=B;var t=rA,r=new t(24),n=nA(),s=new n,i=new t(1),u=new t(2),d=new t(5);new t(16),new t(8);var c=new t(10),b=new t(3);new t(7);var w=new t(11),M=new t(4);new t(12);var _=null;function A(){if(_!==null)return _;var E=1048576,k=[];k[0]=2;for(var T=1,L=3;L<E;L+=2){for(var q=Math.ceil(Math.sqrt(L)),z=0;z<T&&k[z]<=q&&L%k[z]!==0;z++);T!==z&&k[z]<=q||(k[T++]=L)}return _=k,k}function R(E){for(var k=A(),T=0;T<k.length;T++)if(E.modn(k[T])===0)return E.cmpn(k[T])===0;return!0}function B(E){var k=t.mont(E);return u.toRed(k).redPow(E.subn(1)).fromRed().cmpn(1)===0}function I(E,k){if(E<16)return k===2||k===5?new t([140,123]):new t([140,39]);k=new t(k);for(var T,L;;){for(T=new t(e(Math.ceil(E/8)));T.bitLength()>E;)T.ishrn(1);if(T.isEven()&&T.iadd(i),T.testn(1)||T.iadd(u),k.cmp(u)){if(!k.cmp(d))for(;T.mod(c).cmp(b);)T.iadd(M)}else for(;T.mod(r).cmp(w);)T.iadd(M);if(L=T.shrn(1),R(L)&&R(T)&&B(L)&&B(T)&&s.test(L)&&s.test(T))return T}}return Y1}const VZ={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},KZ={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},ZZ={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},GZ={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},JZ={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},YZ={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},XZ={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},QZ={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},eG={modp1:VZ,modp2:KZ,modp5:ZZ,modp14:GZ,modp15:JZ,modp16:YZ,modp17:XZ,modp18:QZ};var X1,H4;function tG(){if(H4)return X1;H4=1;var e=rA,t=nA(),r=new t,n=new e(24),s=new e(11),i=new e(10),u=new e(3),d=new e(7),c=iA(),b=yl;X1=R;function w(I,E){return E=E||"utf8",ht.isBuffer(I)||(I=new ht(I,E)),this._pub=new e(I),this}function M(I,E){return E=E||"utf8",ht.isBuffer(I)||(I=new ht(I,E)),this._priv=new e(I),this}var _={};function A(I,E){var k=E.toString("hex"),T=[k,I.toString(16)].join("_");if(T in _)return _[T];var L=0;if(I.isEven()||!c.simpleSieve||!c.fermatTest(I)||!r.test(I))return L+=1,k==="02"||k==="05"?L+=8:L+=4,_[T]=L,L;r.test(I.shrn(1))||(L+=2);var q;switch(k){case"02":I.mod(n).cmp(s)&&(L+=8);break;case"05":q=I.mod(i),q.cmp(u)&&q.cmp(d)&&(L+=8);break;default:L+=4}return _[T]=L,L}function R(I,E,k){this.setGenerator(E),this.__prime=new e(I),this._prime=e.mont(this.__prime),this._primeLen=I.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,k?(this.setPublicKey=w,this.setPrivateKey=M):this._primeCode=8}Object.defineProperty(R.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=A(this.__prime,this.__gen)),this._primeCode}}),R.prototype.generateKeys=function(){return this._priv||(this._priv=new e(b(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},R.prototype.computeSecret=function(I){I=new e(I),I=I.toRed(this._prime);var E=I.redPow(this._priv).fromRed(),k=new ht(E.toArray()),T=this.getPrime();if(k.length<T.length){var L=new ht(T.length-k.length);L.fill(0),k=ht.concat([L,k])}return k},R.prototype.getPublicKey=function(E){return B(this._pub,E)},R.prototype.getPrivateKey=function(E){return B(this._priv,E)},R.prototype.getPrime=function(I){return B(this.__prime,I)},R.prototype.getGenerator=function(I){return B(this._gen,I)},R.prototype.setGenerator=function(I,E){return E=E||"utf8",ht.isBuffer(I)||(I=new ht(I,E)),this.__gen=I,this._gen=new e(I),this};function B(I,E){var k=new ht(I.toArray());return E?k.toString(E):k}return X1}var z4;function rG(){if(z4)return Vs;z4=1;var e=iA(),t=eG,r=tG();function n(u){var d=new ht(t[u].prime,"hex"),c=new ht(t[u].gen,"hex");return new r(d,c)}var s={binary:!0,hex:!0,base64:!0};function i(u,d,c,b){return ht.isBuffer(d)||s[d]===void 0?i(u,"binary",d,c):(d=d||"binary",b=b||"binary",c=c||new ht([2]),ht.isBuffer(c)||(c=new ht(c,b)),typeof u=="number"?new r(e(u,c),c,!0):(ht.isBuffer(u)||(u=new ht(u,d)),new r(u,c,!0)))}return Vs.DiffieHellmanGroup=Vs.createDiffieHellmanGroup=Vs.getDiffieHellman=n,Vs.createDiffieHellman=Vs.DiffieHellman=i,Vs}var ky={exports:{}},nG={}.toString,iG=Array.isArray||function(e){return nG.call(e)=="[object Array]"},oA=Fa.EventEmitter,By={exports:{}};(function(e,t){var r=Kt,n=r.Buffer;function s(u,d){for(var c in u)d[c]=u[c]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(s(r,t),t.Buffer=i);function i(u,d,c){return n(u,d,c)}s(n,i),i.from=function(u,d,c){if(typeof u=="number")throw new TypeError("Argument must not be a number");return n(u,d,c)},i.alloc=function(u,d,c){if(typeof u!="number")throw new TypeError("Argument must be a number");var b=n(u);return d!==void 0?typeof c=="string"?b.fill(d,c):b.fill(d):b.fill(0),b},i.allocUnsafe=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return n(u)},i.allocUnsafeSlow=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(u)}})(By,By.exports);var Rw=By.exports,Q1={exports:{}},W4;function oG(){return W4||(W4=1,function(e){function t(i,u){if(!(i instanceof u))throw new TypeError("Cannot call a class as a function")}var r=Rw.Buffer,n=Ha;function s(i,u,d){i.copy(u,d)}e.exports=function(){function i(){t(this,i),this.head=null,this.tail=null,this.length=0}return i.prototype.push=function(d){var c={data:d,next:null};this.length>0?this.tail.next=c:this.head=c,this.tail=c,++this.length},i.prototype.unshift=function(d){var c={data:d,next:this.head};this.length===0&&(this.tail=c),this.head=c,++this.length},i.prototype.shift=function(){if(this.length!==0){var d=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,d}},i.prototype.clear=function(){this.head=this.tail=null,this.length=0},i.prototype.join=function(d){if(this.length===0)return"";for(var c=this.head,b=""+c.data;c=c.next;)b+=d+c.data;return b},i.prototype.concat=function(d){if(this.length===0)return r.alloc(0);for(var c=r.allocUnsafe(d>>>0),b=this.head,w=0;b;)s(b.data,c,w),w+=b.data.length,b=b.next;return c},i}(),n&&n.inspect&&n.inspect.custom&&(e.exports.prototype[n.inspect.custom]=function(){var i=n.inspect({length:this.length});return this.constructor.name+" "+i})}(Q1)),Q1.exports}var Zh=Ps;function sG(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return n||s?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Zh.nextTick(Gh,this,e)):Zh.nextTick(Gh,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(i){!t&&i?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,Zh.nextTick(Gh,r,i)):Zh.nextTick(Gh,r,i):t&&t(i)}),this)}function aG(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Gh(e,t){e.emit("error",t)}var sA={destroy:sG,undestroy:aG},ev,V4;function aA(){if(V4)return ev;V4=1;var e=Ps;ev=B;function t(y){var m=this;this.next=null,this.entry=null,this.finish=function(){v(m,y)}}var r=!qe.browser&&["v0.10","v0.9."].indexOf(qe.version.slice(0,5))>-1?setImmediate:e.nextTick,n;B.WritableState=A;var s=Object.create(Ot);s.inherits=Fe;var i={deprecate:uw},u=oA,d=Rw.Buffer,c=(typeof Ve<"u"?Ve:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function b(y){return d.from(y)}function w(y){return d.isBuffer(y)||y instanceof c}var M=sA;s.inherits(B,u);function _(){}function A(y,m){n=n||el(),y=y||{};var p=m instanceof n;this.objectMode=!!y.objectMode,p&&(this.objectMode=this.objectMode||!!y.writableObjectMode);var a=y.highWaterMark,g=y.writableHighWaterMark,S=this.objectMode?16:16*1024;a||a===0?this.highWaterMark=a:p&&(g||g===0)?this.highWaterMark=g:this.highWaterMark=S,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var N=y.decodeStrings===!1;this.decodeStrings=!N,this.defaultEncoding=y.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(U){J(m,U)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}A.prototype.getBuffer=function(){for(var m=this.bufferedRequest,p=[];m;)p.push(m),m=m.next;return p},function(){try{Object.defineProperty(A.prototype,"buffer",{get:i.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var R;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(R=Function.prototype[Symbol.hasInstance],Object.defineProperty(B,Symbol.hasInstance,{value:function(y){return R.call(this,y)?!0:this!==B?!1:y&&y._writableState instanceof A}})):R=function(y){return y instanceof this};function B(y){if(n=n||el(),!R.call(B,this)&&!(this instanceof n))return new B(y);this._writableState=new A(y,this),this.writable=!0,y&&(typeof y.write=="function"&&(this._write=y.write),typeof y.writev=="function"&&(this._writev=y.writev),typeof y.destroy=="function"&&(this._destroy=y.destroy),typeof y.final=="function"&&(this._final=y.final)),u.call(this)}B.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function I(y,m){var p=new Error("write after end");y.emit("error",p),e.nextTick(m,p)}function E(y,m,p,a){var g=!0,S=!1;return p===null?S=new TypeError("May not write null values to stream"):typeof p!="string"&&p!==void 0&&!m.objectMode&&(S=new TypeError("Invalid non-string/buffer chunk")),S&&(y.emit("error",S),e.nextTick(a,S),g=!1),g}B.prototype.write=function(y,m,p){var a=this._writableState,g=!1,S=!a.objectMode&&w(y);return S&&!d.isBuffer(y)&&(y=b(y)),typeof m=="function"&&(p=m,m=null),S?m="buffer":m||(m=a.defaultEncoding),typeof p!="function"&&(p=_),a.ended?I(this,p):(S||E(this,a,y,p))&&(a.pendingcb++,g=T(this,a,S,y,m,p)),g},B.prototype.cork=function(){var y=this._writableState;y.corked++},B.prototype.uncork=function(){var y=this._writableState;y.corked&&(y.corked--,!y.writing&&!y.corked&&!y.bufferProcessing&&y.bufferedRequest&&ee(this,y))},B.prototype.setDefaultEncoding=function(m){if(typeof m=="string"&&(m=m.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((m+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+m);return this._writableState.defaultEncoding=m,this};function k(y,m,p){return!y.objectMode&&y.decodeStrings!==!1&&typeof m=="string"&&(m=d.from(m,p)),m}Object.defineProperty(B.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function T(y,m,p,a,g,S){if(!p){var N=k(m,a,g);a!==N&&(p=!0,g="buffer",a=N)}var U=m.objectMode?1:a.length;m.length+=U;var Z=m.length<m.highWaterMark;if(Z||(m.needDrain=!0),m.writing||m.corked){var H=m.lastBufferedRequest;m.lastBufferedRequest={chunk:a,encoding:g,isBuf:p,callback:S,next:null},H?H.next=m.lastBufferedRequest:m.bufferedRequest=m.lastBufferedRequest,m.bufferedRequestCount+=1}else L(y,m,!1,U,a,g,S);return Z}function L(y,m,p,a,g,S,N){m.writelen=a,m.writecb=N,m.writing=!0,m.sync=!0,p?y._writev(g,m.onwrite):y._write(g,S,m.onwrite),m.sync=!1}function q(y,m,p,a,g){--m.pendingcb,p?(e.nextTick(g,a),e.nextTick(l,y,m),y._writableState.errorEmitted=!0,y.emit("error",a)):(g(a),y._writableState.errorEmitted=!0,y.emit("error",a),l(y,m))}function z(y){y.writing=!1,y.writecb=null,y.length-=y.writelen,y.writelen=0}function J(y,m){var p=y._writableState,a=p.sync,g=p.writecb;if(z(p),m)q(y,p,a,m,g);else{var S=x(p);!S&&!p.corked&&!p.bufferProcessing&&p.bufferedRequest&&ee(y,p),a?r(F,y,p,S,g):F(y,p,S,g)}}function F(y,m,p,a){p||X(y,m),m.pendingcb--,a(),l(y,m)}function X(y,m){m.length===0&&m.needDrain&&(m.needDrain=!1,y.emit("drain"))}function ee(y,m){m.bufferProcessing=!0;var p=m.bufferedRequest;if(y._writev&&p&&p.next){var a=m.bufferedRequestCount,g=new Array(a),S=m.corkedRequestsFree;S.entry=p;for(var N=0,U=!0;p;)g[N]=p,p.isBuf||(U=!1),p=p.next,N+=1;g.allBuffers=U,L(y,m,!0,m.length,g,"",S.finish),m.pendingcb++,m.lastBufferedRequest=null,S.next?(m.corkedRequestsFree=S.next,S.next=null):m.corkedRequestsFree=new t(m),m.bufferedRequestCount=0}else{for(;p;){var Z=p.chunk,H=p.encoding,$=p.callback,P=m.objectMode?1:Z.length;if(L(y,m,!1,P,Z,H,$),p=p.next,m.bufferedRequestCount--,m.writing)break}p===null&&(m.lastBufferedRequest=null)}m.bufferedRequest=p,m.bufferProcessing=!1}B.prototype._write=function(y,m,p){p(new Error("_write() is not implemented"))},B.prototype._writev=null,B.prototype.end=function(y,m,p){var a=this._writableState;typeof y=="function"?(p=y,y=null,m=null):typeof m=="function"&&(p=m,m=null),y!=null&&this.write(y,m),a.corked&&(a.corked=1,this.uncork()),a.ending||h(this,a,p)};function x(y){return y.ending&&y.length===0&&y.bufferedRequest===null&&!y.finished&&!y.writing}function o(y,m){y._final(function(p){m.pendingcb--,p&&y.emit("error",p),m.prefinished=!0,y.emit("prefinish"),l(y,m)})}function f(y,m){!m.prefinished&&!m.finalCalled&&(typeof y._final=="function"?(m.pendingcb++,m.finalCalled=!0,e.nextTick(o,y,m)):(m.prefinished=!0,y.emit("prefinish")))}function l(y,m){var p=x(m);return p&&(f(y,m),m.pendingcb===0&&(m.finished=!0,y.emit("finish"))),p}function h(y,m,p){m.ending=!0,l(y,m),p&&(m.finished?e.nextTick(p):y.once("finish",p)),m.ended=!0,y.writable=!1}function v(y,m,p){var a=y.entry;for(y.entry=null;a;){var g=a.callback;m.pendingcb--,g(p),a=a.next}m.corkedRequestsFree.next=y}return Object.defineProperty(B.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(y){this._writableState&&(this._writableState.destroyed=y)}}),B.prototype.destroy=M.destroy,B.prototype._undestroy=M.undestroy,B.prototype._destroy=function(y,m){this.end(),m(y)},ev}var tv,K4;function el(){if(K4)return tv;K4=1;var e=Ps,t=Object.keys||function(M){var _=[];for(var A in M)_.push(A);return _};tv=c;var r=Object.create(Ot);r.inherits=Fe;var n=fA(),s=aA();r.inherits(c,n);for(var i=t(s.prototype),u=0;u<i.length;u++){var d=i[u];c.prototype[d]||(c.prototype[d]=s.prototype[d])}function c(M){if(!(this instanceof c))return new c(M);n.call(this,M),s.call(this,M),M&&M.readable===!1&&(this.readable=!1),M&&M.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,M&&M.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",b)}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function b(){this.allowHalfOpen||this._writableState.ended||e.nextTick(w,this)}function w(M){M.end()}return Object.defineProperty(c.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(M){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=M,this._writableState.destroyed=M)}}),c.prototype._destroy=function(M,_){this.push(null),this.end(),e.nextTick(_,M)},tv}var rv={},Jh={exports:{}},Z4;function fG(){return Z4||(Z4=1,function(e,t){var r=Kt,n=r.Buffer;function s(u,d){for(var c in u)d[c]=u[c]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(s(r,t),t.Buffer=i);function i(u,d,c){return n(u,d,c)}s(n,i),i.from=function(u,d,c){if(typeof u=="number")throw new TypeError("Argument must not be a number");return n(u,d,c)},i.alloc=function(u,d,c){if(typeof u!="number")throw new TypeError("Argument must be a number");var b=n(u);return d!==void 0?typeof c=="string"?b.fill(d,c):b.fill(d):b.fill(0),b},i.allocUnsafe=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return n(u)},i.allocUnsafeSlow=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(u)}}(Jh,Jh.exports)),Jh.exports}var G4;function J4(){if(G4)return rv;G4=1;var e=fG().Buffer,t=e.isEncoding||function(E){switch(E=""+E,E&&E.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(E){if(!E)return"utf8";for(var k;;)switch(E){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return E;default:if(k)return;E=(""+E).toLowerCase(),k=!0}}function n(E){var k=r(E);if(typeof k!="string"&&(e.isEncoding===t||!t(E)))throw new Error("Unknown encoding: "+E);return k||E}rv.StringDecoder=s;function s(E){this.encoding=n(E);var k;switch(this.encoding){case"utf16le":this.text=M,this.end=_,k=4;break;case"utf8":this.fillLast=c,k=4;break;case"base64":this.text=A,this.end=R,k=3;break;default:this.write=B,this.end=I;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(k)}s.prototype.write=function(E){if(E.length===0)return"";var k,T;if(this.lastNeed){if(k=this.fillLast(E),k===void 0)return"";T=this.lastNeed,this.lastNeed=0}else T=0;return T<E.length?k?k+this.text(E,T):this.text(E,T):k||""},s.prototype.end=w,s.prototype.text=b,s.prototype.fillLast=function(E){if(this.lastNeed<=E.length)return E.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);E.copy(this.lastChar,this.lastTotal-this.lastNeed,0,E.length),this.lastNeed-=E.length};function i(E){return E<=127?0:E>>5===6?2:E>>4===14?3:E>>3===30?4:E>>6===2?-1:-2}function u(E,k,T){var L=k.length-1;if(L<T)return 0;var q=i(k[L]);return q>=0?(q>0&&(E.lastNeed=q-1),q):--L<T||q===-2?0:(q=i(k[L]),q>=0?(q>0&&(E.lastNeed=q-2),q):--L<T||q===-2?0:(q=i(k[L]),q>=0?(q>0&&(q===2?q=0:E.lastNeed=q-3),q):0))}function d(E,k,T){if((k[0]&192)!==128)return E.lastNeed=0,"�";if(E.lastNeed>1&&k.length>1){if((k[1]&192)!==128)return E.lastNeed=1,"�";if(E.lastNeed>2&&k.length>2&&(k[2]&192)!==128)return E.lastNeed=2,"�"}}function c(E){var k=this.lastTotal-this.lastNeed,T=d(this,E);if(T!==void 0)return T;if(this.lastNeed<=E.length)return E.copy(this.lastChar,k,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);E.copy(this.lastChar,k,0,E.length),this.lastNeed-=E.length}function b(E,k){var T=u(this,E,k);if(!this.lastNeed)return E.toString("utf8",k);this.lastTotal=T;var L=E.length-(T-this.lastNeed);return E.copy(this.lastChar,0,L),E.toString("utf8",k,L)}function w(E){var k=E&&E.length?this.write(E):"";return this.lastNeed?k+"�":k}function M(E,k){if((E.length-k)%2===0){var T=E.toString("utf16le",k);if(T){var L=T.charCodeAt(T.length-1);if(L>=55296&&L<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=E[E.length-2],this.lastChar[1]=E[E.length-1],T.slice(0,-1)}return T}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=E[E.length-1],E.toString("utf16le",k,E.length-1)}function _(E){var k=E&&E.length?this.write(E):"";if(this.lastNeed){var T=this.lastTotal-this.lastNeed;return k+this.lastChar.toString("utf16le",0,T)}return k}function A(E,k){var T=(E.length-k)%3;return T===0?E.toString("base64",k):(this.lastNeed=3-T,this.lastTotal=3,T===1?this.lastChar[0]=E[E.length-1]:(this.lastChar[0]=E[E.length-2],this.lastChar[1]=E[E.length-1]),E.toString("base64",k,E.length-T))}function R(E){var k=E&&E.length?this.write(E):"";return this.lastNeed?k+this.lastChar.toString("base64",0,3-this.lastNeed):k}function B(E){return E.toString(this.encoding)}function I(E){return E&&E.length?this.write(E):""}return rv}var nv,Y4;function fA(){if(Y4)return nv;Y4=1;var e=Ps;nv=k;var t=iG,r;k.ReadableState=E,Fa.EventEmitter;var n=function($,P){return $.listeners(P).length},s=oA,i=Rw.Buffer,u=(typeof Ve<"u"?Ve:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function d($){return i.from($)}function c($){return i.isBuffer($)||$ instanceof u}var b=Object.create(Ot);b.inherits=Fe;var w=Ha,M=void 0;w&&w.debuglog?M=w.debuglog("stream"):M=function(){};var _=oG(),A=sA,R;b.inherits(k,s);var B=["error","close","destroy","pause","resume"];function I($,P,W){if(typeof $.prependListener=="function")return $.prependListener(P,W);!$._events||!$._events[P]?$.on(P,W):t($._events[P])?$._events[P].unshift(W):$._events[P]=[W,$._events[P]]}function E($,P){r=r||el(),$=$||{};var W=P instanceof r;this.objectMode=!!$.objectMode,W&&(this.objectMode=this.objectMode||!!$.readableObjectMode);var G=$.highWaterMark,K=$.readableHighWaterMark,O=this.objectMode?16:16*1024;G||G===0?this.highWaterMark=G:W&&(K||K===0)?this.highWaterMark=K:this.highWaterMark=O,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new _,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=$.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,$.encoding&&(R||(R=J4().StringDecoder),this.decoder=new R($.encoding),this.encoding=$.encoding)}function k($){if(r=r||el(),!(this instanceof k))return new k($);this._readableState=new E($,this),this.readable=!0,$&&(typeof $.read=="function"&&(this._read=$.read),typeof $.destroy=="function"&&(this._destroy=$.destroy)),s.call(this)}Object.defineProperty(k.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function($){this._readableState&&(this._readableState.destroyed=$)}}),k.prototype.destroy=A.destroy,k.prototype._undestroy=A.undestroy,k.prototype._destroy=function($,P){this.push(null),P($)},k.prototype.push=function($,P){var W=this._readableState,G;return W.objectMode?G=!0:typeof $=="string"&&(P=P||W.defaultEncoding,P!==W.encoding&&($=i.from($,P),P=""),G=!0),T(this,$,P,!1,G)},k.prototype.unshift=function($){return T(this,$,null,!0,!1)};function T($,P,W,G,K){var O=$._readableState;if(P===null)O.reading=!1,ee($,O);else{var Q;K||(Q=q(O,P)),Q?$.emit("error",Q):O.objectMode||P&&P.length>0?(typeof P!="string"&&!O.objectMode&&Object.getPrototypeOf(P)!==i.prototype&&(P=d(P)),G?O.endEmitted?$.emit("error",new Error("stream.unshift() after end event")):L($,O,P,!0):O.ended?$.emit("error",new Error("stream.push() after EOF")):(O.reading=!1,O.decoder&&!W?(P=O.decoder.write(P),O.objectMode||P.length!==0?L($,O,P,!1):f($,O)):L($,O,P,!1))):G||(O.reading=!1)}return z(O)}function L($,P,W,G){P.flowing&&P.length===0&&!P.sync?($.emit("data",W),$.read(0)):(P.length+=P.objectMode?1:W.length,G?P.buffer.unshift(W):P.buffer.push(W),P.needReadable&&x($)),f($,P)}function q($,P){var W;return!c(P)&&typeof P!="string"&&P!==void 0&&!$.objectMode&&(W=new TypeError("Invalid non-string/buffer chunk")),W}function z($){return!$.ended&&($.needReadable||$.length<$.highWaterMark||$.length===0)}k.prototype.isPaused=function(){return this._readableState.flowing===!1},k.prototype.setEncoding=function($){return R||(R=J4().StringDecoder),this._readableState.decoder=new R($),this._readableState.encoding=$,this};var J=8388608;function F($){return $>=J?$=J:($--,$|=$>>>1,$|=$>>>2,$|=$>>>4,$|=$>>>8,$|=$>>>16,$++),$}function X($,P){return $<=0||P.length===0&&P.ended?0:P.objectMode?1:$!==$?P.flowing&&P.length?P.buffer.head.data.length:P.length:($>P.highWaterMark&&(P.highWaterMark=F($)),$<=P.length?$:P.ended?P.length:(P.needReadable=!0,0))}k.prototype.read=function($){M("read",$),$=parseInt($,10);var P=this._readableState,W=$;if($!==0&&(P.emittedReadable=!1),$===0&&P.needReadable&&(P.length>=P.highWaterMark||P.ended))return M("read: emitReadable",P.length,P.ended),P.length===0&&P.ended?U(this):x(this),null;if($=X($,P),$===0&&P.ended)return P.length===0&&U(this),null;var G=P.needReadable;M("need readable",G),(P.length===0||P.length-$<P.highWaterMark)&&(G=!0,M("length less than watermark",G)),P.ended||P.reading?(G=!1,M("reading or ended",G)):G&&(M("do read"),P.reading=!0,P.sync=!0,P.length===0&&(P.needReadable=!0),this._read(P.highWaterMark),P.sync=!1,P.reading||($=X(W,P)));var K;return $>0?K=a($,P):K=null,K===null?(P.needReadable=!0,$=0):P.length-=$,P.length===0&&(P.ended||(P.needReadable=!0),W!==$&&P.ended&&U(this)),K!==null&&this.emit("data",K),K};function ee($,P){if(!P.ended){if(P.decoder){var W=P.decoder.end();W&&W.length&&(P.buffer.push(W),P.length+=P.objectMode?1:W.length)}P.ended=!0,x($)}}function x($){var P=$._readableState;P.needReadable=!1,P.emittedReadable||(M("emitReadable",P.flowing),P.emittedReadable=!0,P.sync?e.nextTick(o,$):o($))}function o($){M("emit readable"),$.emit("readable"),p($)}function f($,P){P.readingMore||(P.readingMore=!0,e.nextTick(l,$,P))}function l($,P){for(var W=P.length;!P.reading&&!P.flowing&&!P.ended&&P.length<P.highWaterMark&&(M("maybeReadMore read 0"),$.read(0),W!==P.length);)W=P.length;P.readingMore=!1}k.prototype._read=function($){this.emit("error",new Error("_read() is not implemented"))},k.prototype.pipe=function($,P){var W=this,G=this._readableState;switch(G.pipesCount){case 0:G.pipes=$;break;case 1:G.pipes=[G.pipes,$];break;default:G.pipes.push($);break}G.pipesCount+=1,M("pipe count=%d opts=%j",G.pipesCount,P);var K=(!P||P.end!==!1)&&$!==qe.stdout&&$!==qe.stderr,O=K?de:Le;G.endEmitted?e.nextTick(O):W.once("end",O),$.on("unpipe",Q);function Q(he,_e){M("onunpipe"),he===W&&_e&&_e.hasUnpiped===!1&&(_e.hasUnpiped=!0,Ie())}function de(){M("onend"),$.end()}var oe=h(W);$.on("drain",oe);var se=!1;function Ie(){M("cleanup"),$.removeListener("close",ae),$.removeListener("finish",le),$.removeListener("drain",oe),$.removeListener("error",je),$.removeListener("unpipe",Q),W.removeListener("end",de),W.removeListener("end",Le),W.removeListener("data",ne),se=!0,G.awaitDrain&&(!$._writableState||$._writableState.needDrain)&&oe()}var fe=!1;W.on("data",ne);function ne(he){M("ondata"),fe=!1;var _e=$.write(he);_e===!1&&!fe&&((G.pipesCount===1&&G.pipes===$||G.pipesCount>1&&H(G.pipes,$)!==-1)&&!se&&(M("false write response, pause",G.awaitDrain),G.awaitDrain++,fe=!0),W.pause())}function je(he){M("onerror",he),Le(),$.removeListener("error",je),n($,"error")===0&&$.emit("error",he)}I($,"error",je);function ae(){$.removeListener("finish",le),Le()}$.once("close",ae);function le(){M("onfinish"),$.removeListener("close",ae),Le()}$.once("finish",le);function Le(){M("unpipe"),W.unpipe($)}return $.emit("pipe",W),G.flowing||(M("pipe resume"),W.resume()),$};function h($){return function(){var P=$._readableState;M("pipeOnDrain",P.awaitDrain),P.awaitDrain&&P.awaitDrain--,P.awaitDrain===0&&n($,"data")&&(P.flowing=!0,p($))}}k.prototype.unpipe=function($){var P=this._readableState,W={hasUnpiped:!1};if(P.pipesCount===0)return this;if(P.pipesCount===1)return $&&$!==P.pipes?this:($||($=P.pipes),P.pipes=null,P.pipesCount=0,P.flowing=!1,$&&$.emit("unpipe",this,W),this);if(!$){var G=P.pipes,K=P.pipesCount;P.pipes=null,P.pipesCount=0,P.flowing=!1;for(var O=0;O<K;O++)G[O].emit("unpipe",this,{hasUnpiped:!1});return this}var Q=H(P.pipes,$);return Q===-1?this:(P.pipes.splice(Q,1),P.pipesCount-=1,P.pipesCount===1&&(P.pipes=P.pipes[0]),$.emit("unpipe",this,W),this)},k.prototype.on=function($,P){var W=s.prototype.on.call(this,$,P);if($==="data")this._readableState.flowing!==!1&&this.resume();else if($==="readable"){var G=this._readableState;!G.endEmitted&&!G.readableListening&&(G.readableListening=G.needReadable=!0,G.emittedReadable=!1,G.reading?G.length&&x(this):e.nextTick(v,this))}return W},k.prototype.addListener=k.prototype.on;function v($){M("readable nexttick read 0"),$.read(0)}k.prototype.resume=function(){var $=this._readableState;return $.flowing||(M("resume"),$.flowing=!0,y(this,$)),this};function y($,P){P.resumeScheduled||(P.resumeScheduled=!0,e.nextTick(m,$,P))}function m($,P){P.reading||(M("resume read 0"),$.read(0)),P.resumeScheduled=!1,P.awaitDrain=0,$.emit("resume"),p($),P.flowing&&!P.reading&&$.read(0)}k.prototype.pause=function(){return M("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(M("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function p($){var P=$._readableState;for(M("flow",P.flowing);P.flowing&&$.read()!==null;);}k.prototype.wrap=function($){var P=this,W=this._readableState,G=!1;$.on("end",function(){if(M("wrapped end"),W.decoder&&!W.ended){var Q=W.decoder.end();Q&&Q.length&&P.push(Q)}P.push(null)}),$.on("data",function(Q){if(M("wrapped data"),W.decoder&&(Q=W.decoder.write(Q)),!(W.objectMode&&Q==null)&&!(!W.objectMode&&(!Q||!Q.length))){var de=P.push(Q);de||(G=!0,$.pause())}});for(var K in $)this[K]===void 0&&typeof $[K]=="function"&&(this[K]=function(Q){return function(){return $[Q].apply($,arguments)}}(K));for(var O=0;O<B.length;O++)$.on(B[O],this.emit.bind(this,B[O]));return this._read=function(Q){M("wrapped _read",Q),G&&(G=!1,$.resume())},this},Object.defineProperty(k.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),k._fromList=a;function a($,P){if(P.length===0)return null;var W;return P.objectMode?W=P.buffer.shift():!$||$>=P.length?(P.decoder?W=P.buffer.join(""):P.buffer.length===1?W=P.buffer.head.data:W=P.buffer.concat(P.length),P.buffer.clear()):W=g($,P.buffer,P.decoder),W}function g($,P,W){var G;return $<P.head.data.length?(G=P.head.data.slice(0,$),P.head.data=P.head.data.slice($)):$===P.head.data.length?G=P.shift():G=W?S($,P):N($,P),G}function S($,P){var W=P.head,G=1,K=W.data;for($-=K.length;W=W.next;){var O=W.data,Q=$>O.length?O.length:$;if(Q===O.length?K+=O:K+=O.slice(0,$),$-=Q,$===0){Q===O.length?(++G,W.next?P.head=W.next:P.head=P.tail=null):(P.head=W,W.data=O.slice(Q));break}++G}return P.length-=G,K}function N($,P){var W=i.allocUnsafe($),G=P.head,K=1;for(G.data.copy(W),$-=G.data.length;G=G.next;){var O=G.data,Q=$>O.length?O.length:$;if(O.copy(W,W.length-$,0,Q),$-=Q,$===0){Q===O.length?(++K,G.next?P.head=G.next:P.head=P.tail=null):(P.head=G,G.data=O.slice(Q));break}++K}return P.length-=K,W}function U($){var P=$._readableState;if(P.length>0)throw new Error('"endReadable()" called on non-empty stream');P.endEmitted||(P.ended=!0,e.nextTick(Z,P,$))}function Z($,P){!$.endEmitted&&$.length===0&&($.endEmitted=!0,P.readable=!1,P.emit("end"))}function H($,P){for(var W=0,G=$.length;W<G;W++)if($[W]===P)return W;return-1}return nv}var lA=xo,qd=el(),uA=Object.create(Ot);uA.inherits=Fe;uA.inherits(xo,qd);function lG(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,t!=null&&this.push(t),n(e);var s=this._readableState;s.reading=!1,(s.needReadable||s.length<s.highWaterMark)&&this._read(s.highWaterMark)}function xo(e){if(!(this instanceof xo))return new xo(e);qd.call(this,e),this._transformState={afterTransform:lG.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",uG)}function uG(){var e=this;typeof this._flush=="function"?this._flush(function(t,r){X4(e,t,r)}):X4(this,null,null)}xo.prototype.push=function(e,t){return this._transformState.needTransform=!1,qd.prototype.push.call(this,e,t)};xo.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")};xo.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var s=this._readableState;(n.needTransform||s.needReadable||s.length<s.highWaterMark)&&this._read(s.highWaterMark)}};xo.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};xo.prototype._destroy=function(e,t){var r=this;qd.prototype._destroy.call(this,e,function(n){t(n),r.emit("close")})};function X4(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}var hG=zu,hA=lA,cA=Object.create(Ot);cA.inherits=Fe;cA.inherits(zu,hA);function zu(e){if(!(this instanceof zu))return new zu(e);hA.call(this,e)}zu.prototype._transform=function(e,t,r){r(null,e)};(function(e,t){t=e.exports=fA(),t.Stream=t,t.Readable=t,t.Writable=aA(),t.Duplex=el(),t.Transform=lA,t.PassThrough=hG})(ky,ky.exports);var cG=ky.exports,Jl={exports:{}},$w={exports:{}};$w.exports;(function(e){(function(t,r){function n(f,l){if(!f)throw new Error(l||"Assertion failed")}function s(f,l){f.super_=l;var h=function(){};h.prototype=l.prototype,f.prototype=new h,f.prototype.constructor=f}function i(f,l,h){if(i.isBN(f))return f;this.negative=0,this.words=null,this.length=0,this.red=null,f!==null&&((l==="le"||l==="be")&&(h=l,l=10),this._init(f||0,l||10,h||"be"))}typeof t=="object"?t.exports=i:r.BN=i,i.BN=i,i.wordSize=26;var u;try{typeof window<"u"&&typeof window.Buffer<"u"?u=window.Buffer:u=Kt.Buffer}catch{}i.isBN=function(l){return l instanceof i?!0:l!==null&&typeof l=="object"&&l.constructor.wordSize===i.wordSize&&Array.isArray(l.words)},i.max=function(l,h){return l.cmp(h)>0?l:h},i.min=function(l,h){return l.cmp(h)<0?l:h},i.prototype._init=function(l,h,v){if(typeof l=="number")return this._initNumber(l,h,v);if(typeof l=="object")return this._initArray(l,h,v);h==="hex"&&(h=16),n(h===(h|0)&&h>=2&&h<=36),l=l.toString().replace(/\s+/g,"");var y=0;l[0]==="-"&&(y++,this.negative=1),y<l.length&&(h===16?this._parseHex(l,y,v):(this._parseBase(l,h,y),v==="le"&&this._initArray(this.toArray(),h,v)))},i.prototype._initNumber=function(l,h,v){l<0&&(this.negative=1,l=-l),l<67108864?(this.words=[l&67108863],this.length=1):l<4503599627370496?(this.words=[l&67108863,l/67108864&67108863],this.length=2):(n(l<9007199254740992),this.words=[l&67108863,l/67108864&67108863,1],this.length=3),v==="le"&&this._initArray(this.toArray(),h,v)},i.prototype._initArray=function(l,h,v){if(n(typeof l.length=="number"),l.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(l.length/3),this.words=new Array(this.length);for(var y=0;y<this.length;y++)this.words[y]=0;var m,p,a=0;if(v==="be")for(y=l.length-1,m=0;y>=0;y-=3)p=l[y]|l[y-1]<<8|l[y-2]<<16,this.words[m]|=p<<a&67108863,this.words[m+1]=p>>>26-a&67108863,a+=24,a>=26&&(a-=26,m++);else if(v==="le")for(y=0,m=0;y<l.length;y+=3)p=l[y]|l[y+1]<<8|l[y+2]<<16,this.words[m]|=p<<a&67108863,this.words[m+1]=p>>>26-a&67108863,a+=24,a>=26&&(a-=26,m++);return this._strip()};function d(f,l){var h=f.charCodeAt(l);if(h>=48&&h<=57)return h-48;if(h>=65&&h<=70)return h-55;if(h>=97&&h<=102)return h-87;n(!1,"Invalid character in "+f)}function c(f,l,h){var v=d(f,h);return h-1>=l&&(v|=d(f,h-1)<<4),v}i.prototype._parseHex=function(l,h,v){this.length=Math.ceil((l.length-h)/6),this.words=new Array(this.length);for(var y=0;y<this.length;y++)this.words[y]=0;var m=0,p=0,a;if(v==="be")for(y=l.length-1;y>=h;y-=2)a=c(l,h,y)<<m,this.words[p]|=a&67108863,m>=18?(m-=18,p+=1,this.words[p]|=a>>>26):m+=8;else{var g=l.length-h;for(y=g%2===0?h+1:h;y<l.length;y+=2)a=c(l,h,y)<<m,this.words[p]|=a&67108863,m>=18?(m-=18,p+=1,this.words[p]|=a>>>26):m+=8}this._strip()};function b(f,l,h,v){for(var y=0,m=0,p=Math.min(f.length,h),a=l;a<p;a++){var g=f.charCodeAt(a)-48;y*=v,g>=49?m=g-49+10:g>=17?m=g-17+10:m=g,n(g>=0&&m<v,"Invalid character"),y+=m}return y}i.prototype._parseBase=function(l,h,v){this.words=[0],this.length=1;for(var y=0,m=1;m<=67108863;m*=h)y++;y--,m=m/h|0;for(var p=l.length-v,a=p%y,g=Math.min(p,p-a)+v,S=0,N=v;N<g;N+=y)S=b(l,N,N+y,h),this.imuln(m),this.words[0]+S<67108864?this.words[0]+=S:this._iaddn(S);if(a!==0){var U=1;for(S=b(l,N,l.length,h),N=0;N<a;N++)U*=h;this.imuln(U),this.words[0]+S<67108864?this.words[0]+=S:this._iaddn(S)}this._strip()},i.prototype.copy=function(l){l.words=new Array(this.length);for(var h=0;h<this.length;h++)l.words[h]=this.words[h];l.length=this.length,l.negative=this.negative,l.red=this.red};function w(f,l){f.words=l.words,f.length=l.length,f.negative=l.negative,f.red=l.red}if(i.prototype._move=function(l){w(l,this)},i.prototype.clone=function(){var l=new i(null);return this.copy(l),l},i.prototype._expand=function(l){for(;this.length<l;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=M}catch{i.prototype.inspect=M}else i.prototype.inspect=M;function M(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var _=["","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"],A=[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],R=[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];i.prototype.toString=function(l,h){l=l||10,h=h|0||1;var v;if(l===16||l==="hex"){v="";for(var y=0,m=0,p=0;p<this.length;p++){var a=this.words[p],g=((a<<y|m)&16777215).toString(16);m=a>>>24-y&16777215,y+=2,y>=26&&(y-=26,p--),m!==0||p!==this.length-1?v=_[6-g.length]+g+v:v=g+v}for(m!==0&&(v=m.toString(16)+v);v.length%h!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(l===(l|0)&&l>=2&&l<=36){var S=A[l],N=R[l];v="";var U=this.clone();for(U.negative=0;!U.isZero();){var Z=U.modrn(N).toString(l);U=U.idivn(N),U.isZero()?v=Z+v:v=_[S-Z.length]+Z+v}for(this.isZero()&&(v="0"+v);v.length%h!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var l=this.words[0];return this.length===2?l+=this.words[1]*67108864:this.length===3&&this.words[2]===1?l+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-l:l},i.prototype.toJSON=function(){return this.toString(16,2)},u&&(i.prototype.toBuffer=function(l,h){return this.toArrayLike(u,l,h)}),i.prototype.toArray=function(l,h){return this.toArrayLike(Array,l,h)};var B=function(l,h){return l.allocUnsafe?l.allocUnsafe(h):new l(h)};i.prototype.toArrayLike=function(l,h,v){this._strip();var y=this.byteLength(),m=v||Math.max(1,y);n(y<=m,"byte array longer than desired length"),n(m>0,"Requested array length <= 0");var p=B(l,m),a=h==="le"?"LE":"BE";return this["_toArrayLike"+a](p,y),p},i.prototype._toArrayLikeLE=function(l,h){for(var v=0,y=0,m=0,p=0;m<this.length;m++){var a=this.words[m]<<p|y;l[v++]=a&255,v<l.length&&(l[v++]=a>>8&255),v<l.length&&(l[v++]=a>>16&255),p===6?(v<l.length&&(l[v++]=a>>24&255),y=0,p=0):(y=a>>>24,p+=2)}if(v<l.length)for(l[v++]=y;v<l.length;)l[v++]=0},i.prototype._toArrayLikeBE=function(l,h){for(var v=l.length-1,y=0,m=0,p=0;m<this.length;m++){var a=this.words[m]<<p|y;l[v--]=a&255,v>=0&&(l[v--]=a>>8&255),v>=0&&(l[v--]=a>>16&255),p===6?(v>=0&&(l[v--]=a>>24&255),y=0,p=0):(y=a>>>24,p+=2)}if(v>=0)for(l[v--]=y;v>=0;)l[v--]=0},Math.clz32?i.prototype._countBits=function(l){return 32-Math.clz32(l)}:i.prototype._countBits=function(l){var h=l,v=0;return h>=4096&&(v+=13,h>>>=13),h>=64&&(v+=7,h>>>=7),h>=8&&(v+=4,h>>>=4),h>=2&&(v+=2,h>>>=2),v+h},i.prototype._zeroBits=function(l){if(l===0)return 26;var h=l,v=0;return h&8191||(v+=13,h>>>=13),h&127||(v+=7,h>>>=7),h&15||(v+=4,h>>>=4),h&3||(v+=2,h>>>=2),h&1||v++,v},i.prototype.bitLength=function(){var l=this.words[this.length-1],h=this._countBits(l);return(this.length-1)*26+h};function I(f){for(var l=new Array(f.bitLength()),h=0;h<l.length;h++){var v=h/26|0,y=h%26;l[h]=f.words[v]>>>y&1}return l}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var l=0,h=0;h<this.length;h++){var v=this._zeroBits(this.words[h]);if(l+=v,v!==26)break}return l},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(l){return this.negative!==0?this.abs().inotn(l).iaddn(1):this.clone()},i.prototype.fromTwos=function(l){return this.testn(l-1)?this.notn(l).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(l){for(;this.length<l.length;)this.words[this.length++]=0;for(var h=0;h<l.length;h++)this.words[h]=this.words[h]|l.words[h];return this._strip()},i.prototype.ior=function(l){return n((this.negative|l.negative)===0),this.iuor(l)},i.prototype.or=function(l){return this.length>l.length?this.clone().ior(l):l.clone().ior(this)},i.prototype.uor=function(l){return this.length>l.length?this.clone().iuor(l):l.clone().iuor(this)},i.prototype.iuand=function(l){var h;this.length>l.length?h=l:h=this;for(var v=0;v<h.length;v++)this.words[v]=this.words[v]&l.words[v];return this.length=h.length,this._strip()},i.prototype.iand=function(l){return n((this.negative|l.negative)===0),this.iuand(l)},i.prototype.and=function(l){return this.length>l.length?this.clone().iand(l):l.clone().iand(this)},i.prototype.uand=function(l){return this.length>l.length?this.clone().iuand(l):l.clone().iuand(this)},i.prototype.iuxor=function(l){var h,v;this.length>l.length?(h=this,v=l):(h=l,v=this);for(var y=0;y<v.length;y++)this.words[y]=h.words[y]^v.words[y];if(this!==h)for(;y<h.length;y++)this.words[y]=h.words[y];return this.length=h.length,this._strip()},i.prototype.ixor=function(l){return n((this.negative|l.negative)===0),this.iuxor(l)},i.prototype.xor=function(l){return this.length>l.length?this.clone().ixor(l):l.clone().ixor(this)},i.prototype.uxor=function(l){return this.length>l.length?this.clone().iuxor(l):l.clone().iuxor(this)},i.prototype.inotn=function(l){n(typeof l=="number"&&l>=0);var h=Math.ceil(l/26)|0,v=l%26;this._expand(h),v>0&&h--;for(var y=0;y<h;y++)this.words[y]=~this.words[y]&67108863;return v>0&&(this.words[y]=~this.words[y]&67108863>>26-v),this._strip()},i.prototype.notn=function(l){return this.clone().inotn(l)},i.prototype.setn=function(l,h){n(typeof l=="number"&&l>=0);var v=l/26|0,y=l%26;return this._expand(v+1),h?this.words[v]=this.words[v]|1<<y:this.words[v]=this.words[v]&~(1<<y),this._strip()},i.prototype.iadd=function(l){var h;if(this.negative!==0&&l.negative===0)return this.negative=0,h=this.isub(l),this.negative^=1,this._normSign();if(this.negative===0&&l.negative!==0)return l.negative=0,h=this.isub(l),l.negative=1,h._normSign();var v,y;this.length>l.length?(v=this,y=l):(v=l,y=this);for(var m=0,p=0;p<y.length;p++)h=(v.words[p]|0)+(y.words[p]|0)+m,this.words[p]=h&67108863,m=h>>>26;for(;m!==0&&p<v.length;p++)h=(v.words[p]|0)+m,this.words[p]=h&67108863,m=h>>>26;if(this.length=v.length,m!==0)this.words[this.length]=m,this.length++;else if(v!==this)for(;p<v.length;p++)this.words[p]=v.words[p];return this},i.prototype.add=function(l){var h;return l.negative!==0&&this.negative===0?(l.negative=0,h=this.sub(l),l.negative^=1,h):l.negative===0&&this.negative!==0?(this.negative=0,h=l.sub(this),this.negative=1,h):this.length>l.length?this.clone().iadd(l):l.clone().iadd(this)},i.prototype.isub=function(l){if(l.negative!==0){l.negative=0;var h=this.iadd(l);return l.negative=1,h._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(l),this.negative=1,this._normSign();var v=this.cmp(l);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var y,m;v>0?(y=this,m=l):(y=l,m=this);for(var p=0,a=0;a<m.length;a++)h=(y.words[a]|0)-(m.words[a]|0)+p,p=h>>26,this.words[a]=h&67108863;for(;p!==0&&a<y.length;a++)h=(y.words[a]|0)+p,p=h>>26,this.words[a]=h&67108863;if(p===0&&a<y.length&&y!==this)for(;a<y.length;a++)this.words[a]=y.words[a];return this.length=Math.max(this.length,a),y!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(l){return this.clone().isub(l)};function E(f,l,h){h.negative=l.negative^f.negative;var v=f.length+l.length|0;h.length=v,v=v-1|0;var y=f.words[0]|0,m=l.words[0]|0,p=y*m,a=p&67108863,g=p/67108864|0;h.words[0]=a;for(var S=1;S<v;S++){for(var N=g>>>26,U=g&67108863,Z=Math.min(S,l.length-1),H=Math.max(0,S-f.length+1);H<=Z;H++){var $=S-H|0;y=f.words[$]|0,m=l.words[H]|0,p=y*m+U,N+=p/67108864|0,U=p&67108863}h.words[S]=U|0,g=N|0}return g!==0?h.words[S]=g|0:h.length--,h._strip()}var k=function(l,h,v){var y=l.words,m=h.words,p=v.words,a=0,g,S,N,U=y[0]|0,Z=U&8191,H=U>>>13,$=y[1]|0,P=$&8191,W=$>>>13,G=y[2]|0,K=G&8191,O=G>>>13,Q=y[3]|0,de=Q&8191,oe=Q>>>13,se=y[4]|0,Ie=se&8191,fe=se>>>13,ne=y[5]|0,je=ne&8191,ae=ne>>>13,le=y[6]|0,Le=le&8191,he=le>>>13,_e=y[7]|0,He=_e&8191,ye=_e>>>13,Ae=y[8]|0,ze=Ae&8191,me=Ae>>>13,ge=y[9]|0,Ke=ge&8191,we=ge>>>13,Be=m[0]|0,We=Be&8191,be=Be>>>13,ke=m[1]|0,Ze=ke&8191,pe=ke>>>13,Ne=m[2]|0,Qe=Ne&8191,xe=Ne>>>13,Re=m[3]|0,Xe=Re&8191,Ee=Re>>>13,$e=m[4]|0,tt=$e&8191,D=$e>>>13,C=m[5]|0,j=C&8191,Y=C>>>13,te=m[6]|0,ue=te&8191,re=te>>>13,ve=m[7]|0,De=ve&8191,ce=ve>>>13,Me=m[8]|0,Oe=Me&8191,Se=Me>>>13,Te=m[9]|0,Ge=Te&8191,Je=Te>>>13;v.negative=l.negative^h.negative,v.length=19,g=Math.imul(Z,We),S=Math.imul(Z,be),S=S+Math.imul(H,We)|0,N=Math.imul(H,be);var pt=(a+g|0)+((S&8191)<<13)|0;a=(N+(S>>>13)|0)+(pt>>>26)|0,pt&=67108863,g=Math.imul(P,We),S=Math.imul(P,be),S=S+Math.imul(W,We)|0,N=Math.imul(W,be),g=g+Math.imul(Z,Ze)|0,S=S+Math.imul(Z,pe)|0,S=S+Math.imul(H,Ze)|0,N=N+Math.imul(H,pe)|0;var vt=(a+g|0)+((S&8191)<<13)|0;a=(N+(S>>>13)|0)+(vt>>>26)|0,vt&=67108863,g=Math.imul(K,We),S=Math.imul(K,be),S=S+Math.imul(O,We)|0,N=Math.imul(O,be),g=g+Math.imul(P,Ze)|0,S=S+Math.imul(P,pe)|0,S=S+Math.imul(W,Ze)|0,N=N+Math.imul(W,pe)|0,g=g+Math.imul(Z,Qe)|0,S=S+Math.imul(Z,xe)|0,S=S+Math.imul(H,Qe)|0,N=N+Math.imul(H,xe)|0;var gt=(a+g|0)+((S&8191)<<13)|0;a=(N+(S>>>13)|0)+(gt>>>26)|0,gt&=67108863,g=Math.imul(de,We),S=Math.imul(de,be),S=S+Math.imul(oe,We)|0,N=Math.imul(oe,be),g=g+Math.imul(K,Ze)|0,S=S+Math.imul(K,pe)|0,S=S+Math.imul(O,Ze)|0,N=N+Math.imul(O,pe)|0,g=g+Math.imul(P,Qe)|0,S=S+Math.imul(P,xe)|0,S=S+Math.imul(W,Qe)|0,N=N+Math.imul(W,xe)|0,g=g+Math.imul(Z,Xe)|0,S=S+Math.imul(Z,Ee)|0,S=S+Math.imul(H,Xe)|0,N=N+Math.imul(H,Ee)|0;var yt=(a+g|0)+((S&8191)<<13)|0;a=(N+(S>>>13)|0)+(yt>>>26)|0,yt&=67108863,g=Math.imul(Ie,We),S=Math.imul(Ie,be),S=S+Math.imul(fe,We)|0,N=Math.imul(fe,be),g=g+Math.imul(de,Ze)|0,S=S+Math.imul(de,pe)|0,S=S+Math.imul(oe,Ze)|0,N=N+Math.imul(oe,pe)|0,g=g+Math.imul(K,Qe)|0,S=S+Math.imul(K,xe)|0,S=S+Math.imul(O,Qe)|0,N=N+Math.imul(O,xe)|0,g=g+Math.imul(P,Xe)|0,S=S+Math.imul(P,Ee)|0,S=S+Math.imul(W,Xe)|0,N=N+Math.imul(W,Ee)|0,g=g+Math.imul(Z,tt)|0,S=S+Math.imul(Z,D)|0,S=S+Math.imul(H,tt)|0,N=N+Math.imul(H,D)|0;var mt=(a+g|0)+((S&8191)<<13)|0;a=(N+(S>>>13)|0)+(mt>>>26)|0,mt&=67108863,g=Math.imul(je,We),S=Math.imul(je,be),S=S+Math.imul(ae,We)|0,N=Math.imul(ae,be),g=g+Math.imul(Ie,Ze)|0,S=S+Math.imul(Ie,pe)|0,S=S+Math.imul(fe,Ze)|0,N=N+Math.imul(fe,pe)|0,g=g+Math.imul(de,Qe)|0,S=S+Math.imul(de,xe)|0,S=S+Math.imul(oe,Qe)|0,N=N+Math.imul(oe,xe)|0,g=g+Math.imul(K,Xe)|0,S=S+Math.imul(K,Ee)|0,S=S+Math.imul(O,Xe)|0,N=N+Math.imul(O,Ee)|0,g=g+Math.imul(P,tt)|0,S=S+Math.imul(P,D)|0,S=S+Math.imul(W,tt)|0,N=N+Math.imul(W,D)|0,g=g+Math.imul(Z,j)|0,S=S+Math.imul(Z,Y)|0,S=S+Math.imul(H,j)|0,N=N+Math.imul(H,Y)|0;var wt=(a+g|0)+((S&8191)<<13)|0;a=(N+(S>>>13)|0)+(wt>>>26)|0,wt&=67108863,g=Math.imul(Le,We),S=Math.imul(Le,be),S=S+Math.imul(he,We)|0,N=Math.imul(he,be),g=g+Math.imul(je,Ze)|0,S=S+Math.imul(je,pe)|0,S=S+Math.imul(ae,Ze)|0,N=N+Math.imul(ae,pe)|0,g=g+Math.imul(Ie,Qe)|0,S=S+Math.imul(Ie,xe)|0,S=S+Math.imul(fe,Qe)|0,N=N+Math.imul(fe,xe)|0,g=g+Math.imul(de,Xe)|0,S=S+Math.imul(de,Ee)|0,S=S+Math.imul(oe,Xe)|0,N=N+Math.imul(oe,Ee)|0,g=g+Math.imul(K,tt)|0,S=S+Math.imul(K,D)|0,S=S+Math.imul(O,tt)|0,N=N+Math.imul(O,D)|0,g=g+Math.imul(P,j)|0,S=S+Math.imul(P,Y)|0,S=S+Math.imul(W,j)|0,N=N+Math.imul(W,Y)|0,g=g+Math.imul(Z,ue)|0,S=S+Math.imul(Z,re)|0,S=S+Math.imul(H,ue)|0,N=N+Math.imul(H,re)|0;var bt=(a+g|0)+((S&8191)<<13)|0;a=(N+(S>>>13)|0)+(bt>>>26)|0,bt&=67108863,g=Math.imul(He,We),S=Math.imul(He,be),S=S+Math.imul(ye,We)|0,N=Math.imul(ye,be),g=g+Math.imul(Le,Ze)|0,S=S+Math.imul(Le,pe)|0,S=S+Math.imul(he,Ze)|0,N=N+Math.imul(he,pe)|0,g=g+Math.imul(je,Qe)|0,S=S+Math.imul(je,xe)|0,S=S+Math.imul(ae,Qe)|0,N=N+Math.imul(ae,xe)|0,g=g+Math.imul(Ie,Xe)|0,S=S+Math.imul(Ie,Ee)|0,S=S+Math.imul(fe,Xe)|0,N=N+Math.imul(fe,Ee)|0,g=g+Math.imul(de,tt)|0,S=S+Math.imul(de,D)|0,S=S+Math.imul(oe,tt)|0,N=N+Math.imul(oe,D)|0,g=g+Math.imul(K,j)|0,S=S+Math.imul(K,Y)|0,S=S+Math.imul(O,j)|0,N=N+Math.imul(O,Y)|0,g=g+Math.imul(P,ue)|0,S=S+Math.imul(P,re)|0,S=S+Math.imul(W,ue)|0,N=N+Math.imul(W,re)|0,g=g+Math.imul(Z,De)|0,S=S+Math.imul(Z,ce)|0,S=S+Math.imul(H,De)|0,N=N+Math.imul(H,ce)|0;var xt=(a+g|0)+((S&8191)<<13)|0;a=(N+(S>>>13)|0)+(xt>>>26)|0,xt&=67108863,g=Math.imul(ze,We),S=Math.imul(ze,be),S=S+Math.imul(me,We)|0,N=Math.imul(me,be),g=g+Math.imul(He,Ze)|0,S=S+Math.imul(He,pe)|0,S=S+Math.imul(ye,Ze)|0,N=N+Math.imul(ye,pe)|0,g=g+Math.imul(Le,Qe)|0,S=S+Math.imul(Le,xe)|0,S=S+Math.imul(he,Qe)|0,N=N+Math.imul(he,xe)|0,g=g+Math.imul(je,Xe)|0,S=S+Math.imul(je,Ee)|0,S=S+Math.imul(ae,Xe)|0,N=N+Math.imul(ae,Ee)|0,g=g+Math.imul(Ie,tt)|0,S=S+Math.imul(Ie,D)|0,S=S+Math.imul(fe,tt)|0,N=N+Math.imul(fe,D)|0,g=g+Math.imul(de,j)|0,S=S+Math.imul(de,Y)|0,S=S+Math.imul(oe,j)|0,N=N+Math.imul(oe,Y)|0,g=g+Math.imul(K,ue)|0,S=S+Math.imul(K,re)|0,S=S+Math.imul(O,ue)|0,N=N+Math.imul(O,re)|0,g=g+Math.imul(P,De)|0,S=S+Math.imul(P,ce)|0,S=S+Math.imul(W,De)|0,N=N+Math.imul(W,ce)|0,g=g+Math.imul(Z,Oe)|0,S=S+Math.imul(Z,Se)|0,S=S+Math.imul(H,Oe)|0,N=N+Math.imul(H,Se)|0;var Mt=(a+g|0)+((S&8191)<<13)|0;a=(N+(S>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,g=Math.imul(Ke,We),S=Math.imul(Ke,be),S=S+Math.imul(we,We)|0,N=Math.imul(we,be),g=g+Math.imul(ze,Ze)|0,S=S+Math.imul(ze,pe)|0,S=S+Math.imul(me,Ze)|0,N=N+Math.imul(me,pe)|0,g=g+Math.imul(He,Qe)|0,S=S+Math.imul(He,xe)|0,S=S+Math.imul(ye,Qe)|0,N=N+Math.imul(ye,xe)|0,g=g+Math.imul(Le,Xe)|0,S=S+Math.imul(Le,Ee)|0,S=S+Math.imul(he,Xe)|0,N=N+Math.imul(he,Ee)|0,g=g+Math.imul(je,tt)|0,S=S+Math.imul(je,D)|0,S=S+Math.imul(ae,tt)|0,N=N+Math.imul(ae,D)|0,g=g+Math.imul(Ie,j)|0,S=S+Math.imul(Ie,Y)|0,S=S+Math.imul(fe,j)|0,N=N+Math.imul(fe,Y)|0,g=g+Math.imul(de,ue)|0,S=S+Math.imul(de,re)|0,S=S+Math.imul(oe,ue)|0,N=N+Math.imul(oe,re)|0,g=g+Math.imul(K,De)|0,S=S+Math.imul(K,ce)|0,S=S+Math.imul(O,De)|0,N=N+Math.imul(O,ce)|0,g=g+Math.imul(P,Oe)|0,S=S+Math.imul(P,Se)|0,S=S+Math.imul(W,Oe)|0,N=N+Math.imul(W,Se)|0,g=g+Math.imul(Z,Ge)|0,S=S+Math.imul(Z,Je)|0,S=S+Math.imul(H,Ge)|0,N=N+Math.imul(H,Je)|0;var _t=(a+g|0)+((S&8191)<<13)|0;a=(N+(S>>>13)|0)+(_t>>>26)|0,_t&=67108863,g=Math.imul(Ke,Ze),S=Math.imul(Ke,pe),S=S+Math.imul(we,Ze)|0,N=Math.imul(we,pe),g=g+Math.imul(ze,Qe)|0,S=S+Math.imul(ze,xe)|0,S=S+Math.imul(me,Qe)|0,N=N+Math.imul(me,xe)|0,g=g+Math.imul(He,Xe)|0,S=S+Math.imul(He,Ee)|0,S=S+Math.imul(ye,Xe)|0,N=N+Math.imul(ye,Ee)|0,g=g+Math.imul(Le,tt)|0,S=S+Math.imul(Le,D)|0,S=S+Math.imul(he,tt)|0,N=N+Math.imul(he,D)|0,g=g+Math.imul(je,j)|0,S=S+Math.imul(je,Y)|0,S=S+Math.imul(ae,j)|0,N=N+Math.imul(ae,Y)|0,g=g+Math.imul(Ie,ue)|0,S=S+Math.imul(Ie,re)|0,S=S+Math.imul(fe,ue)|0,N=N+Math.imul(fe,re)|0,g=g+Math.imul(de,De)|0,S=S+Math.imul(de,ce)|0,S=S+Math.imul(oe,De)|0,N=N+Math.imul(oe,ce)|0,g=g+Math.imul(K,Oe)|0,S=S+Math.imul(K,Se)|0,S=S+Math.imul(O,Oe)|0,N=N+Math.imul(O,Se)|0,g=g+Math.imul(P,Ge)|0,S=S+Math.imul(P,Je)|0,S=S+Math.imul(W,Ge)|0,N=N+Math.imul(W,Je)|0;var Et=(a+g|0)+((S&8191)<<13)|0;a=(N+(S>>>13)|0)+(Et>>>26)|0,Et&=67108863,g=Math.imul(Ke,Qe),S=Math.imul(Ke,xe),S=S+Math.imul(we,Qe)|0,N=Math.imul(we,xe),g=g+Math.imul(ze,Xe)|0,S=S+Math.imul(ze,Ee)|0,S=S+Math.imul(me,Xe)|0,N=N+Math.imul(me,Ee)|0,g=g+Math.imul(He,tt)|0,S=S+Math.imul(He,D)|0,S=S+Math.imul(ye,tt)|0,N=N+Math.imul(ye,D)|0,g=g+Math.imul(Le,j)|0,S=S+Math.imul(Le,Y)|0,S=S+Math.imul(he,j)|0,N=N+Math.imul(he,Y)|0,g=g+Math.imul(je,ue)|0,S=S+Math.imul(je,re)|0,S=S+Math.imul(ae,ue)|0,N=N+Math.imul(ae,re)|0,g=g+Math.imul(Ie,De)|0,S=S+Math.imul(Ie,ce)|0,S=S+Math.imul(fe,De)|0,N=N+Math.imul(fe,ce)|0,g=g+Math.imul(de,Oe)|0,S=S+Math.imul(de,Se)|0,S=S+Math.imul(oe,Oe)|0,N=N+Math.imul(oe,Se)|0,g=g+Math.imul(K,Ge)|0,S=S+Math.imul(K,Je)|0,S=S+Math.imul(O,Ge)|0,N=N+Math.imul(O,Je)|0;var St=(a+g|0)+((S&8191)<<13)|0;a=(N+(S>>>13)|0)+(St>>>26)|0,St&=67108863,g=Math.imul(Ke,Xe),S=Math.imul(Ke,Ee),S=S+Math.imul(we,Xe)|0,N=Math.imul(we,Ee),g=g+Math.imul(ze,tt)|0,S=S+Math.imul(ze,D)|0,S=S+Math.imul(me,tt)|0,N=N+Math.imul(me,D)|0,g=g+Math.imul(He,j)|0,S=S+Math.imul(He,Y)|0,S=S+Math.imul(ye,j)|0,N=N+Math.imul(ye,Y)|0,g=g+Math.imul(Le,ue)|0,S=S+Math.imul(Le,re)|0,S=S+Math.imul(he,ue)|0,N=N+Math.imul(he,re)|0,g=g+Math.imul(je,De)|0,S=S+Math.imul(je,ce)|0,S=S+Math.imul(ae,De)|0,N=N+Math.imul(ae,ce)|0,g=g+Math.imul(Ie,Oe)|0,S=S+Math.imul(Ie,Se)|0,S=S+Math.imul(fe,Oe)|0,N=N+Math.imul(fe,Se)|0,g=g+Math.imul(de,Ge)|0,S=S+Math.imul(de,Je)|0,S=S+Math.imul(oe,Ge)|0,N=N+Math.imul(oe,Je)|0;var At=(a+g|0)+((S&8191)<<13)|0;a=(N+(S>>>13)|0)+(At>>>26)|0,At&=67108863,g=Math.imul(Ke,tt),S=Math.imul(Ke,D),S=S+Math.imul(we,tt)|0,N=Math.imul(we,D),g=g+Math.imul(ze,j)|0,S=S+Math.imul(ze,Y)|0,S=S+Math.imul(me,j)|0,N=N+Math.imul(me,Y)|0,g=g+Math.imul(He,ue)|0,S=S+Math.imul(He,re)|0,S=S+Math.imul(ye,ue)|0,N=N+Math.imul(ye,re)|0,g=g+Math.imul(Le,De)|0,S=S+Math.imul(Le,ce)|0,S=S+Math.imul(he,De)|0,N=N+Math.imul(he,ce)|0,g=g+Math.imul(je,Oe)|0,S=S+Math.imul(je,Se)|0,S=S+Math.imul(ae,Oe)|0,N=N+Math.imul(ae,Se)|0,g=g+Math.imul(Ie,Ge)|0,S=S+Math.imul(Ie,Je)|0,S=S+Math.imul(fe,Ge)|0,N=N+Math.imul(fe,Je)|0;var kt=(a+g|0)+((S&8191)<<13)|0;a=(N+(S>>>13)|0)+(kt>>>26)|0,kt&=67108863,g=Math.imul(Ke,j),S=Math.imul(Ke,Y),S=S+Math.imul(we,j)|0,N=Math.imul(we,Y),g=g+Math.imul(ze,ue)|0,S=S+Math.imul(ze,re)|0,S=S+Math.imul(me,ue)|0,N=N+Math.imul(me,re)|0,g=g+Math.imul(He,De)|0,S=S+Math.imul(He,ce)|0,S=S+Math.imul(ye,De)|0,N=N+Math.imul(ye,ce)|0,g=g+Math.imul(Le,Oe)|0,S=S+Math.imul(Le,Se)|0,S=S+Math.imul(he,Oe)|0,N=N+Math.imul(he,Se)|0,g=g+Math.imul(je,Ge)|0,S=S+Math.imul(je,Je)|0,S=S+Math.imul(ae,Ge)|0,N=N+Math.imul(ae,Je)|0;var Bt=(a+g|0)+((S&8191)<<13)|0;a=(N+(S>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,g=Math.imul(Ke,ue),S=Math.imul(Ke,re),S=S+Math.imul(we,ue)|0,N=Math.imul(we,re),g=g+Math.imul(ze,De)|0,S=S+Math.imul(ze,ce)|0,S=S+Math.imul(me,De)|0,N=N+Math.imul(me,ce)|0,g=g+Math.imul(He,Oe)|0,S=S+Math.imul(He,Se)|0,S=S+Math.imul(ye,Oe)|0,N=N+Math.imul(ye,Se)|0,g=g+Math.imul(Le,Ge)|0,S=S+Math.imul(Le,Je)|0,S=S+Math.imul(he,Ge)|0,N=N+Math.imul(he,Je)|0;var Rt=(a+g|0)+((S&8191)<<13)|0;a=(N+(S>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,g=Math.imul(Ke,De),S=Math.imul(Ke,ce),S=S+Math.imul(we,De)|0,N=Math.imul(we,ce),g=g+Math.imul(ze,Oe)|0,S=S+Math.imul(ze,Se)|0,S=S+Math.imul(me,Oe)|0,N=N+Math.imul(me,Se)|0,g=g+Math.imul(He,Ge)|0,S=S+Math.imul(He,Je)|0,S=S+Math.imul(ye,Ge)|0,N=N+Math.imul(ye,Je)|0;var $t=(a+g|0)+((S&8191)<<13)|0;a=(N+(S>>>13)|0)+($t>>>26)|0,$t&=67108863,g=Math.imul(Ke,Oe),S=Math.imul(Ke,Se),S=S+Math.imul(we,Oe)|0,N=Math.imul(we,Se),g=g+Math.imul(ze,Ge)|0,S=S+Math.imul(ze,Je)|0,S=S+Math.imul(me,Ge)|0,N=N+Math.imul(me,Je)|0;var dp=(a+g|0)+((S&8191)<<13)|0;a=(N+(S>>>13)|0)+(dp>>>26)|0,dp&=67108863,g=Math.imul(Ke,Ge),S=Math.imul(Ke,Je),S=S+Math.imul(we,Ge)|0,N=Math.imul(we,Je);var pp=(a+g|0)+((S&8191)<<13)|0;return a=(N+(S>>>13)|0)+(pp>>>26)|0,pp&=67108863,p[0]=pt,p[1]=vt,p[2]=gt,p[3]=yt,p[4]=mt,p[5]=wt,p[6]=bt,p[7]=xt,p[8]=Mt,p[9]=_t,p[10]=Et,p[11]=St,p[12]=At,p[13]=kt,p[14]=Bt,p[15]=Rt,p[16]=$t,p[17]=dp,p[18]=pp,a!==0&&(p[19]=a,v.length++),v};Math.imul||(k=E);function T(f,l,h){h.negative=l.negative^f.negative,h.length=f.length+l.length;for(var v=0,y=0,m=0;m<h.length-1;m++){var p=y;y=0;for(var a=v&67108863,g=Math.min(m,l.length-1),S=Math.max(0,m-f.length+1);S<=g;S++){var N=m-S,U=f.words[N]|0,Z=l.words[S]|0,H=U*Z,$=H&67108863;p=p+(H/67108864|0)|0,$=$+a|0,a=$&67108863,p=p+($>>>26)|0,y+=p>>>26,p&=67108863}h.words[m]=a,v=p,p=y}return v!==0?h.words[m]=v:h.length--,h._strip()}function L(f,l,h){return T(f,l,h)}i.prototype.mulTo=function(l,h){var v,y=this.length+l.length;return this.length===10&&l.length===10?v=k(this,l,h):y<63?v=E(this,l,h):y<1024?v=T(this,l,h):v=L(this,l,h),v},i.prototype.mul=function(l){var h=new i(null);return h.words=new Array(this.length+l.length),this.mulTo(l,h)},i.prototype.mulf=function(l){var h=new i(null);return h.words=new Array(this.length+l.length),L(this,l,h)},i.prototype.imul=function(l){return this.clone().mulTo(l,this)},i.prototype.imuln=function(l){var h=l<0;h&&(l=-l),n(typeof l=="number"),n(l<67108864);for(var v=0,y=0;y<this.length;y++){var m=(this.words[y]|0)*l,p=(m&67108863)+(v&67108863);v>>=26,v+=m/67108864|0,v+=p>>>26,this.words[y]=p&67108863}return v!==0&&(this.words[y]=v,this.length++),this.length=l===0?1:this.length,h?this.ineg():this},i.prototype.muln=function(l){return this.clone().imuln(l)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(l){var h=I(l);if(h.length===0)return new i(1);for(var v=this,y=0;y<h.length&&h[y]===0;y++,v=v.sqr());if(++y<h.length)for(var m=v.sqr();y<h.length;y++,m=m.sqr())h[y]!==0&&(v=v.mul(m));return v},i.prototype.iushln=function(l){n(typeof l=="number"&&l>=0);var h=l%26,v=(l-h)/26,y=67108863>>>26-h<<26-h,m;if(h!==0){var p=0;for(m=0;m<this.length;m++){var a=this.words[m]&y,g=(this.words[m]|0)-a<<h;this.words[m]=g|p,p=a>>>26-h}p&&(this.words[m]=p,this.length++)}if(v!==0){for(m=this.length-1;m>=0;m--)this.words[m+v]=this.words[m];for(m=0;m<v;m++)this.words[m]=0;this.length+=v}return this._strip()},i.prototype.ishln=function(l){return n(this.negative===0),this.iushln(l)},i.prototype.iushrn=function(l,h,v){n(typeof l=="number"&&l>=0);var y;h?y=(h-h%26)/26:y=0;var m=l%26,p=Math.min((l-m)/26,this.length),a=67108863^67108863>>>m<<m,g=v;if(y-=p,y=Math.max(0,y),g){for(var S=0;S<p;S++)g.words[S]=this.words[S];g.length=p}if(p!==0)if(this.length>p)for(this.length-=p,S=0;S<this.length;S++)this.words[S]=this.words[S+p];else this.words[0]=0,this.length=1;var N=0;for(S=this.length-1;S>=0&&(N!==0||S>=y);S--){var U=this.words[S]|0;this.words[S]=N<<26-m|U>>>m,N=U&a}return g&&N!==0&&(g.words[g.length++]=N),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(l,h,v){return n(this.negative===0),this.iushrn(l,h,v)},i.prototype.shln=function(l){return this.clone().ishln(l)},i.prototype.ushln=function(l){return this.clone().iushln(l)},i.prototype.shrn=function(l){return this.clone().ishrn(l)},i.prototype.ushrn=function(l){return this.clone().iushrn(l)},i.prototype.testn=function(l){n(typeof l=="number"&&l>=0);var h=l%26,v=(l-h)/26,y=1<<h;if(this.length<=v)return!1;var m=this.words[v];return!!(m&y)},i.prototype.imaskn=function(l){n(typeof l=="number"&&l>=0);var h=l%26,v=(l-h)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(h!==0&&v++,this.length=Math.min(v,this.length),h!==0){var y=67108863^67108863>>>h<<h;this.words[this.length-1]&=y}return this._strip()},i.prototype.maskn=function(l){return this.clone().imaskn(l)},i.prototype.iaddn=function(l){return n(typeof l=="number"),n(l<67108864),l<0?this.isubn(-l):this.negative!==0?this.length===1&&(this.words[0]|0)<=l?(this.words[0]=l-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(l),this.negative=1,this):this._iaddn(l)},i.prototype._iaddn=function(l){this.words[0]+=l;for(var h=0;h<this.length&&this.words[h]>=67108864;h++)this.words[h]-=67108864,h===this.length-1?this.words[h+1]=1:this.words[h+1]++;return this.length=Math.max(this.length,h+1),this},i.prototype.isubn=function(l){if(n(typeof l=="number"),n(l<67108864),l<0)return this.iaddn(-l);if(this.negative!==0)return this.negative=0,this.iaddn(l),this.negative=1,this;if(this.words[0]-=l,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var h=0;h<this.length&&this.words[h]<0;h++)this.words[h]+=67108864,this.words[h+1]-=1;return this._strip()},i.prototype.addn=function(l){return this.clone().iaddn(l)},i.prototype.subn=function(l){return this.clone().isubn(l)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(l,h,v){var y=l.length+v,m;this._expand(y);var p,a=0;for(m=0;m<l.length;m++){p=(this.words[m+v]|0)+a;var g=(l.words[m]|0)*h;p-=g&67108863,a=(p>>26)-(g/67108864|0),this.words[m+v]=p&67108863}for(;m<this.length-v;m++)p=(this.words[m+v]|0)+a,a=p>>26,this.words[m+v]=p&67108863;if(a===0)return this._strip();for(n(a===-1),a=0,m=0;m<this.length;m++)p=-(this.words[m]|0)+a,a=p>>26,this.words[m]=p&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(l,h){var v=this.length-l.length,y=this.clone(),m=l,p=m.words[m.length-1]|0,a=this._countBits(p);v=26-a,v!==0&&(m=m.ushln(v),y.iushln(v),p=m.words[m.length-1]|0);var g=y.length-m.length,S;if(h!=="mod"){S=new i(null),S.length=g+1,S.words=new Array(S.length);for(var N=0;N<S.length;N++)S.words[N]=0}var U=y.clone()._ishlnsubmul(m,1,g);U.negative===0&&(y=U,S&&(S.words[g]=1));for(var Z=g-1;Z>=0;Z--){var H=(y.words[m.length+Z]|0)*67108864+(y.words[m.length+Z-1]|0);for(H=Math.min(H/p|0,67108863),y._ishlnsubmul(m,H,Z);y.negative!==0;)H--,y.negative=0,y._ishlnsubmul(m,1,Z),y.isZero()||(y.negative^=1);S&&(S.words[Z]=H)}return S&&S._strip(),y._strip(),h!=="div"&&v!==0&&y.iushrn(v),{div:S||null,mod:y}},i.prototype.divmod=function(l,h,v){if(n(!l.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var y,m,p;return this.negative!==0&&l.negative===0?(p=this.neg().divmod(l,h),h!=="mod"&&(y=p.div.neg()),h!=="div"&&(m=p.mod.neg(),v&&m.negative!==0&&m.iadd(l)),{div:y,mod:m}):this.negative===0&&l.negative!==0?(p=this.divmod(l.neg(),h),h!=="mod"&&(y=p.div.neg()),{div:y,mod:p.mod}):this.negative&l.negative?(p=this.neg().divmod(l.neg(),h),h!=="div"&&(m=p.mod.neg(),v&&m.negative!==0&&m.isub(l)),{div:p.div,mod:m}):l.length>this.length||this.cmp(l)<0?{div:new i(0),mod:this}:l.length===1?h==="div"?{div:this.divn(l.words[0]),mod:null}:h==="mod"?{div:null,mod:new i(this.modrn(l.words[0]))}:{div:this.divn(l.words[0]),mod:new i(this.modrn(l.words[0]))}:this._wordDiv(l,h)},i.prototype.div=function(l){return this.divmod(l,"div",!1).div},i.prototype.mod=function(l){return this.divmod(l,"mod",!1).mod},i.prototype.umod=function(l){return this.divmod(l,"mod",!0).mod},i.prototype.divRound=function(l){var h=this.divmod(l);if(h.mod.isZero())return h.div;var v=h.div.negative!==0?h.mod.isub(l):h.mod,y=l.ushrn(1),m=l.andln(1),p=v.cmp(y);return p<0||m===1&&p===0?h.div:h.div.negative!==0?h.div.isubn(1):h.div.iaddn(1)},i.prototype.modrn=function(l){var h=l<0;h&&(l=-l),n(l<=67108863);for(var v=(1<<26)%l,y=0,m=this.length-1;m>=0;m--)y=(v*y+(this.words[m]|0))%l;return h?-y:y},i.prototype.modn=function(l){return this.modrn(l)},i.prototype.idivn=function(l){var h=l<0;h&&(l=-l),n(l<=67108863);for(var v=0,y=this.length-1;y>=0;y--){var m=(this.words[y]|0)+v*67108864;this.words[y]=m/l|0,v=m%l}return this._strip(),h?this.ineg():this},i.prototype.divn=function(l){return this.clone().idivn(l)},i.prototype.egcd=function(l){n(l.negative===0),n(!l.isZero());var h=this,v=l.clone();h.negative!==0?h=h.umod(l):h=h.clone();for(var y=new i(1),m=new i(0),p=new i(0),a=new i(1),g=0;h.isEven()&&v.isEven();)h.iushrn(1),v.iushrn(1),++g;for(var S=v.clone(),N=h.clone();!h.isZero();){for(var U=0,Z=1;!(h.words[0]&Z)&&U<26;++U,Z<<=1);if(U>0)for(h.iushrn(U);U-- >0;)(y.isOdd()||m.isOdd())&&(y.iadd(S),m.isub(N)),y.iushrn(1),m.iushrn(1);for(var H=0,$=1;!(v.words[0]&$)&&H<26;++H,$<<=1);if(H>0)for(v.iushrn(H);H-- >0;)(p.isOdd()||a.isOdd())&&(p.iadd(S),a.isub(N)),p.iushrn(1),a.iushrn(1);h.cmp(v)>=0?(h.isub(v),y.isub(p),m.isub(a)):(v.isub(h),p.isub(y),a.isub(m))}return{a:p,b:a,gcd:v.iushln(g)}},i.prototype._invmp=function(l){n(l.negative===0),n(!l.isZero());var h=this,v=l.clone();h.negative!==0?h=h.umod(l):h=h.clone();for(var y=new i(1),m=new i(0),p=v.clone();h.cmpn(1)>0&&v.cmpn(1)>0;){for(var a=0,g=1;!(h.words[0]&g)&&a<26;++a,g<<=1);if(a>0)for(h.iushrn(a);a-- >0;)y.isOdd()&&y.iadd(p),y.iushrn(1);for(var S=0,N=1;!(v.words[0]&N)&&S<26;++S,N<<=1);if(S>0)for(v.iushrn(S);S-- >0;)m.isOdd()&&m.iadd(p),m.iushrn(1);h.cmp(v)>=0?(h.isub(v),y.isub(m)):(v.isub(h),m.isub(y))}var U;return h.cmpn(1)===0?U=y:U=m,U.cmpn(0)<0&&U.iadd(l),U},i.prototype.gcd=function(l){if(this.isZero())return l.abs();if(l.isZero())return this.abs();var h=this.clone(),v=l.clone();h.negative=0,v.negative=0;for(var y=0;h.isEven()&&v.isEven();y++)h.iushrn(1),v.iushrn(1);do{for(;h.isEven();)h.iushrn(1);for(;v.isEven();)v.iushrn(1);var m=h.cmp(v);if(m<0){var p=h;h=v,v=p}else if(m===0||v.cmpn(1)===0)break;h.isub(v)}while(!0);return v.iushln(y)},i.prototype.invm=function(l){return this.egcd(l).a.umod(l)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(l){return this.words[0]&l},i.prototype.bincn=function(l){n(typeof l=="number");var h=l%26,v=(l-h)/26,y=1<<h;if(this.length<=v)return this._expand(v+1),this.words[v]|=y,this;for(var m=y,p=v;m!==0&&p<this.length;p++){var a=this.words[p]|0;a+=m,m=a>>>26,a&=67108863,this.words[p]=a}return m!==0&&(this.words[p]=m,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(l){var h=l<0;if(this.negative!==0&&!h)return-1;if(this.negative===0&&h)return 1;this._strip();var v;if(this.length>1)v=1;else{h&&(l=-l),n(l<=67108863,"Number is too big");var y=this.words[0]|0;v=y===l?0:y<l?-1:1}return this.negative!==0?-v|0:v},i.prototype.cmp=function(l){if(this.negative!==0&&l.negative===0)return-1;if(this.negative===0&&l.negative!==0)return 1;var h=this.ucmp(l);return this.negative!==0?-h|0:h},i.prototype.ucmp=function(l){if(this.length>l.length)return 1;if(this.length<l.length)return-1;for(var h=0,v=this.length-1;v>=0;v--){var y=this.words[v]|0,m=l.words[v]|0;if(y!==m){y<m?h=-1:y>m&&(h=1);break}}return h},i.prototype.gtn=function(l){return this.cmpn(l)===1},i.prototype.gt=function(l){return this.cmp(l)===1},i.prototype.gten=function(l){return this.cmpn(l)>=0},i.prototype.gte=function(l){return this.cmp(l)>=0},i.prototype.ltn=function(l){return this.cmpn(l)===-1},i.prototype.lt=function(l){return this.cmp(l)===-1},i.prototype.lten=function(l){return this.cmpn(l)<=0},i.prototype.lte=function(l){return this.cmp(l)<=0},i.prototype.eqn=function(l){return this.cmpn(l)===0},i.prototype.eq=function(l){return this.cmp(l)===0},i.red=function(l){return new x(l)},i.prototype.toRed=function(l){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),l.convertTo(this)._forceRed(l)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(l){return this.red=l,this},i.prototype.forceRed=function(l){return n(!this.red,"Already a number in reduction context"),this._forceRed(l)},i.prototype.redAdd=function(l){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,l)},i.prototype.redIAdd=function(l){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,l)},i.prototype.redSub=function(l){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,l)},i.prototype.redISub=function(l){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,l)},i.prototype.redShl=function(l){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,l)},i.prototype.redMul=function(l){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.mul(this,l)},i.prototype.redIMul=function(l){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.imul(this,l)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(l){return n(this.red&&!l.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,l)};var q={k256:null,p224:null,p192:null,p25519:null};function z(f,l){this.name=f,this.p=new i(l,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}z.prototype._tmp=function(){var l=new i(null);return l.words=new Array(Math.ceil(this.n/13)),l},z.prototype.ireduce=function(l){var h=l,v;do this.split(h,this.tmp),h=this.imulK(h),h=h.iadd(this.tmp),v=h.bitLength();while(v>this.n);var y=v<this.n?-1:h.ucmp(this.p);return y===0?(h.words[0]=0,h.length=1):y>0?h.isub(this.p):h.strip!==void 0?h.strip():h._strip(),h},z.prototype.split=function(l,h){l.iushrn(this.n,0,h)},z.prototype.imulK=function(l){return l.imul(this.k)};function J(){z.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(J,z),J.prototype.split=function(l,h){for(var v=4194303,y=Math.min(l.length,9),m=0;m<y;m++)h.words[m]=l.words[m];if(h.length=y,l.length<=9){l.words[0]=0,l.length=1;return}var p=l.words[9];for(h.words[h.length++]=p&v,m=10;m<l.length;m++){var a=l.words[m]|0;l.words[m-10]=(a&v)<<4|p>>>22,p=a}p>>>=22,l.words[m-10]=p,p===0&&l.length>10?l.length-=10:l.length-=9},J.prototype.imulK=function(l){l.words[l.length]=0,l.words[l.length+1]=0,l.length+=2;for(var h=0,v=0;v<l.length;v++){var y=l.words[v]|0;h+=y*977,l.words[v]=h&67108863,h=y*64+(h/67108864|0)}return l.words[l.length-1]===0&&(l.length--,l.words[l.length-1]===0&&l.length--),l};function F(){z.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(F,z);function X(){z.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(X,z);function ee(){z.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(ee,z),ee.prototype.imulK=function(l){for(var h=0,v=0;v<l.length;v++){var y=(l.words[v]|0)*19+h,m=y&67108863;y>>>=26,l.words[v]=m,h=y}return h!==0&&(l.words[l.length++]=h),l},i._prime=function(l){if(q[l])return q[l];var h;if(l==="k256")h=new J;else if(l==="p224")h=new F;else if(l==="p192")h=new X;else if(l==="p25519")h=new ee;else throw new Error("Unknown prime "+l);return q[l]=h,h};function x(f){if(typeof f=="string"){var l=i._prime(f);this.m=l.p,this.prime=l}else n(f.gtn(1),"modulus must be greater than 1"),this.m=f,this.prime=null}x.prototype._verify1=function(l){n(l.negative===0,"red works only with positives"),n(l.red,"red works only with red numbers")},x.prototype._verify2=function(l,h){n((l.negative|h.negative)===0,"red works only with positives"),n(l.red&&l.red===h.red,"red works only with red numbers")},x.prototype.imod=function(l){return this.prime?this.prime.ireduce(l)._forceRed(this):(w(l,l.umod(this.m)._forceRed(this)),l)},x.prototype.neg=function(l){return l.isZero()?l.clone():this.m.sub(l)._forceRed(this)},x.prototype.add=function(l,h){this._verify2(l,h);var v=l.add(h);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},x.prototype.iadd=function(l,h){this._verify2(l,h);var v=l.iadd(h);return v.cmp(this.m)>=0&&v.isub(this.m),v},x.prototype.sub=function(l,h){this._verify2(l,h);var v=l.sub(h);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},x.prototype.isub=function(l,h){this._verify2(l,h);var v=l.isub(h);return v.cmpn(0)<0&&v.iadd(this.m),v},x.prototype.shl=function(l,h){return this._verify1(l),this.imod(l.ushln(h))},x.prototype.imul=function(l,h){return this._verify2(l,h),this.imod(l.imul(h))},x.prototype.mul=function(l,h){return this._verify2(l,h),this.imod(l.mul(h))},x.prototype.isqr=function(l){return this.imul(l,l.clone())},x.prototype.sqr=function(l){return this.mul(l,l)},x.prototype.sqrt=function(l){if(l.isZero())return l.clone();var h=this.m.andln(3);if(n(h%2===1),h===3){var v=this.m.add(new i(1)).iushrn(2);return this.pow(l,v)}for(var y=this.m.subn(1),m=0;!y.isZero()&&y.andln(1)===0;)m++,y.iushrn(1);n(!y.isZero());var p=new i(1).toRed(this),a=p.redNeg(),g=this.m.subn(1).iushrn(1),S=this.m.bitLength();for(S=new i(2*S*S).toRed(this);this.pow(S,g).cmp(a)!==0;)S.redIAdd(a);for(var N=this.pow(S,y),U=this.pow(l,y.addn(1).iushrn(1)),Z=this.pow(l,y),H=m;Z.cmp(p)!==0;){for(var $=Z,P=0;$.cmp(p)!==0;P++)$=$.redSqr();n(P<H);var W=this.pow(N,new i(1).iushln(H-P-1));U=U.redMul(W),N=W.redSqr(),Z=Z.redMul(N),H=P}return U},x.prototype.invm=function(l){var h=l._invmp(this.m);return h.negative!==0?(h.negative=0,this.imod(h).redNeg()):this.imod(h)},x.prototype.pow=function(l,h){if(h.isZero())return new i(1).toRed(this);if(h.cmpn(1)===0)return l.clone();var v=4,y=new Array(1<<v);y[0]=new i(1).toRed(this),y[1]=l;for(var m=2;m<y.length;m++)y[m]=this.mul(y[m-1],l);var p=y[0],a=0,g=0,S=h.bitLength()%26;for(S===0&&(S=26),m=h.length-1;m>=0;m--){for(var N=h.words[m],U=S-1;U>=0;U--){var Z=N>>U&1;if(p!==y[0]&&(p=this.sqr(p)),Z===0&&a===0){g=0;continue}a<<=1,a|=Z,g++,!(g!==v&&(m!==0||U!==0))&&(p=this.mul(p,y[a]),g=0,a=0)}S=26}return p},x.prototype.convertTo=function(l){var h=l.umod(this.m);return h===l?h.clone():h},x.prototype.convertFrom=function(l){var h=l.clone();return h.red=null,h},i.mont=function(l){return new o(l)};function o(f){x.call(this,f),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(o,x),o.prototype.convertTo=function(l){return this.imod(l.ushln(this.shift))},o.prototype.convertFrom=function(l){var h=this.imod(l.mul(this.rinv));return h.red=null,h},o.prototype.imul=function(l,h){if(l.isZero()||h.isZero())return l.words[0]=0,l.length=1,l;var v=l.imul(h),y=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=v.isub(y).iushrn(this.shift),p=m;return m.cmp(this.m)>=0?p=m.isub(this.m):m.cmpn(0)<0&&(p=m.iadd(this.m)),p._forceRed(this)},o.prototype.mul=function(l,h){if(l.isZero()||h.isZero())return new i(0)._forceRed(this);var v=l.mul(h),y=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=v.isub(y).iushrn(this.shift),p=m;return m.cmp(this.m)>=0?p=m.isub(this.m):m.cmpn(0)<0&&(p=m.iadd(this.m)),p._forceRed(this)},o.prototype.invm=function(l){var h=this.imod(l._invmp(this.m).mul(this.r2));return h._forceRed(this)}})(e,Ve)})($w);var Nw=$w.exports,Tf=Nw,dG=yl,pG=Ye.Buffer;function dA(e){var t=e.modulus.byteLength(),r;do r=new Tf(dG(t));while(r.cmp(e.modulus)>=0||!r.umod(e.prime1)||!r.umod(e.prime2));return r}function vG(e){var t=dA(e),r=t.toRed(Tf.mont(e.modulus)).redPow(new Tf(e.publicExponent)).fromRed();return{blinder:r,unblinder:t.invm(e.modulus)}}function pA(e,t){var r=vG(t),n=t.modulus.byteLength(),s=new Tf(e).mul(r.blinder).umod(t.modulus),i=s.toRed(Tf.mont(t.prime1)),u=s.toRed(Tf.mont(t.prime2)),d=t.coefficient,c=t.prime1,b=t.prime2,w=i.redPow(t.exponent1).fromRed(),M=u.redPow(t.exponent2).fromRed(),_=w.isub(M).imul(d).umod(c).imul(b);return M.iadd(_).imul(r.unblinder).umod(t.modulus).toArrayLike(pG,"be",n)}pA.getr=dA;var Tw=pA,iv={};const gG="6.6.1",yG={version:gG};var yn={},Iw={exports:{}};Iw.exports;(function(e){(function(t,r){function n(x,o){if(!x)throw new Error(o||"Assertion failed")}function s(x,o){x.super_=o;var f=function(){};f.prototype=o.prototype,x.prototype=new f,x.prototype.constructor=x}function i(x,o,f){if(i.isBN(x))return x;this.negative=0,this.words=null,this.length=0,this.red=null,x!==null&&((o==="le"||o==="be")&&(f=o,o=10),this._init(x||0,o||10,f||"be"))}typeof t=="object"?t.exports=i:r.BN=i,i.BN=i,i.wordSize=26;var u;try{typeof window<"u"&&typeof window.Buffer<"u"?u=window.Buffer:u=Kt.Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,f){return o.cmp(f)>0?o:f},i.min=function(o,f){return o.cmp(f)<0?o:f},i.prototype._init=function(o,f,l){if(typeof o=="number")return this._initNumber(o,f,l);if(typeof o=="object")return this._initArray(o,f,l);f==="hex"&&(f=16),n(f===(f|0)&&f>=2&&f<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h<o.length&&(f===16?this._parseHex(o,h,l):(this._parseBase(o,f,h),l==="le"&&this._initArray(this.toArray(),f,l)))},i.prototype._initNumber=function(o,f,l){o<0&&(this.negative=1,o=-o),o<67108864?(this.words=[o&67108863],this.length=1):o<4503599627370496?(this.words=[o&67108863,o/67108864&67108863],this.length=2):(n(o<9007199254740992),this.words=[o&67108863,o/67108864&67108863,1],this.length=3),l==="le"&&this._initArray(this.toArray(),f,l)},i.prototype._initArray=function(o,f,l){if(n(typeof o.length=="number"),o.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(o.length/3),this.words=new Array(this.length);for(var h=0;h<this.length;h++)this.words[h]=0;var v,y,m=0;if(l==="be")for(h=o.length-1,v=0;h>=0;h-=3)y=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[v]|=y<<m&67108863,this.words[v+1]=y>>>26-m&67108863,m+=24,m>=26&&(m-=26,v++);else if(l==="le")for(h=0,v=0;h<o.length;h+=3)y=o[h]|o[h+1]<<8|o[h+2]<<16,this.words[v]|=y<<m&67108863,this.words[v+1]=y>>>26-m&67108863,m+=24,m>=26&&(m-=26,v++);return this.strip()};function d(x,o){var f=x.charCodeAt(o);return f>=65&&f<=70?f-55:f>=97&&f<=102?f-87:f-48&15}function c(x,o,f){var l=d(x,f);return f-1>=o&&(l|=d(x,f-1)<<4),l}i.prototype._parseHex=function(o,f,l){this.length=Math.ceil((o.length-f)/6),this.words=new Array(this.length);for(var h=0;h<this.length;h++)this.words[h]=0;var v=0,y=0,m;if(l==="be")for(h=o.length-1;h>=f;h-=2)m=c(o,f,h)<<v,this.words[y]|=m&67108863,v>=18?(v-=18,y+=1,this.words[y]|=m>>>26):v+=8;else{var p=o.length-f;for(h=p%2===0?f+1:f;h<o.length;h+=2)m=c(o,f,h)<<v,this.words[y]|=m&67108863,v>=18?(v-=18,y+=1,this.words[y]|=m>>>26):v+=8}this.strip()};function b(x,o,f,l){for(var h=0,v=Math.min(x.length,f),y=o;y<v;y++){var m=x.charCodeAt(y)-48;h*=l,m>=49?h+=m-49+10:m>=17?h+=m-17+10:h+=m}return h}i.prototype._parseBase=function(o,f,l){this.words=[0],this.length=1;for(var h=0,v=1;v<=67108863;v*=f)h++;h--,v=v/f|0;for(var y=o.length-l,m=y%h,p=Math.min(y,y-m)+l,a=0,g=l;g<p;g+=h)a=b(o,g,g+h,f),this.imuln(v),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(m!==0){var S=1;for(a=b(o,g,o.length,f),g=0;g<m;g++)S*=f;this.imuln(S),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}this.strip()},i.prototype.copy=function(o){o.words=new Array(this.length);for(var f=0;f<this.length;f++)o.words[f]=this.words[f];o.length=this.length,o.negative=this.negative,o.red=this.red},i.prototype.clone=function(){var o=new i(null);return this.copy(o),o},i.prototype._expand=function(o){for(;this.length<o;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var w=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],M=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[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];i.prototype.toString=function(o,f){o=o||10,f=f|0||1;var l;if(o===16||o==="hex"){l="";for(var h=0,v=0,y=0;y<this.length;y++){var m=this.words[y],p=((m<<h|v)&16777215).toString(16);v=m>>>24-h&16777215,h+=2,h>=26&&(h-=26,y--),v!==0||y!==this.length-1?l=w[6-p.length]+p+l:l=p+l}for(v!==0&&(l=v.toString(16)+l);l.length%f!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(o===(o|0)&&o>=2&&o<=36){var a=M[o],g=_[o];l="";var S=this.clone();for(S.negative=0;!S.isZero();){var N=S.modn(g).toString(o);S=S.idivn(g),S.isZero()?l=N+l:l=w[a-N.length]+N+l}for(this.isZero()&&(l="0"+l);l.length%f!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,f){return n(typeof u<"u"),this.toArrayLike(u,o,f)},i.prototype.toArray=function(o,f){return this.toArrayLike(Array,o,f)},i.prototype.toArrayLike=function(o,f,l){var h=this.byteLength(),v=l||Math.max(1,h);n(h<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var y=f==="le",m=new o(v),p,a,g=this.clone();if(y){for(a=0;!g.isZero();a++)p=g.andln(255),g.iushrn(8),m[a]=p;for(;a<v;a++)m[a]=0}else{for(a=0;a<v-h;a++)m[a]=0;for(a=0;!g.isZero();a++)p=g.andln(255),g.iushrn(8),m[v-a-1]=p}return m},Math.clz32?i.prototype._countBits=function(o){return 32-Math.clz32(o)}:i.prototype._countBits=function(o){var f=o,l=0;return f>=4096&&(l+=13,f>>>=13),f>=64&&(l+=7,f>>>=7),f>=8&&(l+=4,f>>>=4),f>=2&&(l+=2,f>>>=2),l+f},i.prototype._zeroBits=function(o){if(o===0)return 26;var f=o,l=0;return f&8191||(l+=13,f>>>=13),f&127||(l+=7,f>>>=7),f&15||(l+=4,f>>>=4),f&3||(l+=2,f>>>=2),f&1||l++,l},i.prototype.bitLength=function(){var o=this.words[this.length-1],f=this._countBits(o);return(this.length-1)*26+f};function A(x){for(var o=new Array(x.bitLength()),f=0;f<o.length;f++){var l=f/26|0,h=f%26;o[f]=(x.words[l]&1<<h)>>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,f=0;f<this.length;f++){var l=this._zeroBits(this.words[f]);if(o+=l,l!==26)break}return o},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(o){return this.negative!==0?this.abs().inotn(o).iaddn(1):this.clone()},i.prototype.fromTwos=function(o){return this.testn(o-1)?this.notn(o).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(o){for(;this.length<o.length;)this.words[this.length++]=0;for(var f=0;f<o.length;f++)this.words[f]=this.words[f]|o.words[f];return this.strip()},i.prototype.ior=function(o){return n((this.negative|o.negative)===0),this.iuor(o)},i.prototype.or=function(o){return this.length>o.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var f;this.length>o.length?f=o:f=this;for(var l=0;l<f.length;l++)this.words[l]=this.words[l]&o.words[l];return this.length=f.length,this.strip()},i.prototype.iand=function(o){return n((this.negative|o.negative)===0),this.iuand(o)},i.prototype.and=function(o){return this.length>o.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var f,l;this.length>o.length?(f=this,l=o):(f=o,l=this);for(var h=0;h<l.length;h++)this.words[h]=f.words[h]^l.words[h];if(this!==f)for(;h<f.length;h++)this.words[h]=f.words[h];return this.length=f.length,this.strip()},i.prototype.ixor=function(o){return n((this.negative|o.negative)===0),this.iuxor(o)},i.prototype.xor=function(o){return this.length>o.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var f=Math.ceil(o/26)|0,l=o%26;this._expand(f),l>0&&f--;for(var h=0;h<f;h++)this.words[h]=~this.words[h]&67108863;return l>0&&(this.words[h]=~this.words[h]&67108863>>26-l),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,f){n(typeof o=="number"&&o>=0);var l=o/26|0,h=o%26;return this._expand(l+1),f?this.words[l]=this.words[l]|1<<h:this.words[l]=this.words[l]&~(1<<h),this.strip()},i.prototype.iadd=function(o){var f;if(this.negative!==0&&o.negative===0)return this.negative=0,f=this.isub(o),this.negative^=1,this._normSign();if(this.negative===0&&o.negative!==0)return o.negative=0,f=this.isub(o),o.negative=1,f._normSign();var l,h;this.length>o.length?(l=this,h=o):(l=o,h=this);for(var v=0,y=0;y<h.length;y++)f=(l.words[y]|0)+(h.words[y]|0)+v,this.words[y]=f&67108863,v=f>>>26;for(;v!==0&&y<l.length;y++)f=(l.words[y]|0)+v,this.words[y]=f&67108863,v=f>>>26;if(this.length=l.length,v!==0)this.words[this.length]=v,this.length++;else if(l!==this)for(;y<l.length;y++)this.words[y]=l.words[y];return this},i.prototype.add=function(o){var f;return o.negative!==0&&this.negative===0?(o.negative=0,f=this.sub(o),o.negative^=1,f):o.negative===0&&this.negative!==0?(this.negative=0,f=o.sub(this),this.negative=1,f):this.length>o.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var f=this.iadd(o);return o.negative=1,f._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var l=this.cmp(o);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,v;l>0?(h=this,v=o):(h=o,v=this);for(var y=0,m=0;m<v.length;m++)f=(h.words[m]|0)-(v.words[m]|0)+y,y=f>>26,this.words[m]=f&67108863;for(;y!==0&&m<h.length;m++)f=(h.words[m]|0)+y,y=f>>26,this.words[m]=f&67108863;if(y===0&&m<h.length&&h!==this)for(;m<h.length;m++)this.words[m]=h.words[m];return this.length=Math.max(this.length,m),h!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(o){return this.clone().isub(o)};function R(x,o,f){f.negative=o.negative^x.negative;var l=x.length+o.length|0;f.length=l,l=l-1|0;var h=x.words[0]|0,v=o.words[0]|0,y=h*v,m=y&67108863,p=y/67108864|0;f.words[0]=m;for(var a=1;a<l;a++){for(var g=p>>>26,S=p&67108863,N=Math.min(a,o.length-1),U=Math.max(0,a-x.length+1);U<=N;U++){var Z=a-U|0;h=x.words[Z]|0,v=o.words[U]|0,y=h*v+S,g+=y/67108864|0,S=y&67108863}f.words[a]=S|0,p=g|0}return p!==0?f.words[a]=p|0:f.length--,f.strip()}var B=function(o,f,l){var h=o.words,v=f.words,y=l.words,m=0,p,a,g,S=h[0]|0,N=S&8191,U=S>>>13,Z=h[1]|0,H=Z&8191,$=Z>>>13,P=h[2]|0,W=P&8191,G=P>>>13,K=h[3]|0,O=K&8191,Q=K>>>13,de=h[4]|0,oe=de&8191,se=de>>>13,Ie=h[5]|0,fe=Ie&8191,ne=Ie>>>13,je=h[6]|0,ae=je&8191,le=je>>>13,Le=h[7]|0,he=Le&8191,_e=Le>>>13,He=h[8]|0,ye=He&8191,Ae=He>>>13,ze=h[9]|0,me=ze&8191,ge=ze>>>13,Ke=v[0]|0,we=Ke&8191,Be=Ke>>>13,We=v[1]|0,be=We&8191,ke=We>>>13,Ze=v[2]|0,pe=Ze&8191,Ne=Ze>>>13,Qe=v[3]|0,xe=Qe&8191,Re=Qe>>>13,Xe=v[4]|0,Ee=Xe&8191,$e=Xe>>>13,tt=v[5]|0,D=tt&8191,C=tt>>>13,j=v[6]|0,Y=j&8191,te=j>>>13,ue=v[7]|0,re=ue&8191,ve=ue>>>13,De=v[8]|0,ce=De&8191,Me=De>>>13,Oe=v[9]|0,Se=Oe&8191,Te=Oe>>>13;l.negative=o.negative^f.negative,l.length=19,p=Math.imul(N,we),a=Math.imul(N,Be),a=a+Math.imul(U,we)|0,g=Math.imul(U,Be);var Ge=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,p=Math.imul(H,we),a=Math.imul(H,Be),a=a+Math.imul($,we)|0,g=Math.imul($,Be),p=p+Math.imul(N,be)|0,a=a+Math.imul(N,ke)|0,a=a+Math.imul(U,be)|0,g=g+Math.imul(U,ke)|0;var Je=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Je>>>26)|0,Je&=67108863,p=Math.imul(W,we),a=Math.imul(W,Be),a=a+Math.imul(G,we)|0,g=Math.imul(G,Be),p=p+Math.imul(H,be)|0,a=a+Math.imul(H,ke)|0,a=a+Math.imul($,be)|0,g=g+Math.imul($,ke)|0,p=p+Math.imul(N,pe)|0,a=a+Math.imul(N,Ne)|0,a=a+Math.imul(U,pe)|0,g=g+Math.imul(U,Ne)|0;var pt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(pt>>>26)|0,pt&=67108863,p=Math.imul(O,we),a=Math.imul(O,Be),a=a+Math.imul(Q,we)|0,g=Math.imul(Q,Be),p=p+Math.imul(W,be)|0,a=a+Math.imul(W,ke)|0,a=a+Math.imul(G,be)|0,g=g+Math.imul(G,ke)|0,p=p+Math.imul(H,pe)|0,a=a+Math.imul(H,Ne)|0,a=a+Math.imul($,pe)|0,g=g+Math.imul($,Ne)|0,p=p+Math.imul(N,xe)|0,a=a+Math.imul(N,Re)|0,a=a+Math.imul(U,xe)|0,g=g+Math.imul(U,Re)|0;var vt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(vt>>>26)|0,vt&=67108863,p=Math.imul(oe,we),a=Math.imul(oe,Be),a=a+Math.imul(se,we)|0,g=Math.imul(se,Be),p=p+Math.imul(O,be)|0,a=a+Math.imul(O,ke)|0,a=a+Math.imul(Q,be)|0,g=g+Math.imul(Q,ke)|0,p=p+Math.imul(W,pe)|0,a=a+Math.imul(W,Ne)|0,a=a+Math.imul(G,pe)|0,g=g+Math.imul(G,Ne)|0,p=p+Math.imul(H,xe)|0,a=a+Math.imul(H,Re)|0,a=a+Math.imul($,xe)|0,g=g+Math.imul($,Re)|0,p=p+Math.imul(N,Ee)|0,a=a+Math.imul(N,$e)|0,a=a+Math.imul(U,Ee)|0,g=g+Math.imul(U,$e)|0;var gt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(gt>>>26)|0,gt&=67108863,p=Math.imul(fe,we),a=Math.imul(fe,Be),a=a+Math.imul(ne,we)|0,g=Math.imul(ne,Be),p=p+Math.imul(oe,be)|0,a=a+Math.imul(oe,ke)|0,a=a+Math.imul(se,be)|0,g=g+Math.imul(se,ke)|0,p=p+Math.imul(O,pe)|0,a=a+Math.imul(O,Ne)|0,a=a+Math.imul(Q,pe)|0,g=g+Math.imul(Q,Ne)|0,p=p+Math.imul(W,xe)|0,a=a+Math.imul(W,Re)|0,a=a+Math.imul(G,xe)|0,g=g+Math.imul(G,Re)|0,p=p+Math.imul(H,Ee)|0,a=a+Math.imul(H,$e)|0,a=a+Math.imul($,Ee)|0,g=g+Math.imul($,$e)|0,p=p+Math.imul(N,D)|0,a=a+Math.imul(N,C)|0,a=a+Math.imul(U,D)|0,g=g+Math.imul(U,C)|0;var yt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(yt>>>26)|0,yt&=67108863,p=Math.imul(ae,we),a=Math.imul(ae,Be),a=a+Math.imul(le,we)|0,g=Math.imul(le,Be),p=p+Math.imul(fe,be)|0,a=a+Math.imul(fe,ke)|0,a=a+Math.imul(ne,be)|0,g=g+Math.imul(ne,ke)|0,p=p+Math.imul(oe,pe)|0,a=a+Math.imul(oe,Ne)|0,a=a+Math.imul(se,pe)|0,g=g+Math.imul(se,Ne)|0,p=p+Math.imul(O,xe)|0,a=a+Math.imul(O,Re)|0,a=a+Math.imul(Q,xe)|0,g=g+Math.imul(Q,Re)|0,p=p+Math.imul(W,Ee)|0,a=a+Math.imul(W,$e)|0,a=a+Math.imul(G,Ee)|0,g=g+Math.imul(G,$e)|0,p=p+Math.imul(H,D)|0,a=a+Math.imul(H,C)|0,a=a+Math.imul($,D)|0,g=g+Math.imul($,C)|0,p=p+Math.imul(N,Y)|0,a=a+Math.imul(N,te)|0,a=a+Math.imul(U,Y)|0,g=g+Math.imul(U,te)|0;var mt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(mt>>>26)|0,mt&=67108863,p=Math.imul(he,we),a=Math.imul(he,Be),a=a+Math.imul(_e,we)|0,g=Math.imul(_e,Be),p=p+Math.imul(ae,be)|0,a=a+Math.imul(ae,ke)|0,a=a+Math.imul(le,be)|0,g=g+Math.imul(le,ke)|0,p=p+Math.imul(fe,pe)|0,a=a+Math.imul(fe,Ne)|0,a=a+Math.imul(ne,pe)|0,g=g+Math.imul(ne,Ne)|0,p=p+Math.imul(oe,xe)|0,a=a+Math.imul(oe,Re)|0,a=a+Math.imul(se,xe)|0,g=g+Math.imul(se,Re)|0,p=p+Math.imul(O,Ee)|0,a=a+Math.imul(O,$e)|0,a=a+Math.imul(Q,Ee)|0,g=g+Math.imul(Q,$e)|0,p=p+Math.imul(W,D)|0,a=a+Math.imul(W,C)|0,a=a+Math.imul(G,D)|0,g=g+Math.imul(G,C)|0,p=p+Math.imul(H,Y)|0,a=a+Math.imul(H,te)|0,a=a+Math.imul($,Y)|0,g=g+Math.imul($,te)|0,p=p+Math.imul(N,re)|0,a=a+Math.imul(N,ve)|0,a=a+Math.imul(U,re)|0,g=g+Math.imul(U,ve)|0;var wt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(wt>>>26)|0,wt&=67108863,p=Math.imul(ye,we),a=Math.imul(ye,Be),a=a+Math.imul(Ae,we)|0,g=Math.imul(Ae,Be),p=p+Math.imul(he,be)|0,a=a+Math.imul(he,ke)|0,a=a+Math.imul(_e,be)|0,g=g+Math.imul(_e,ke)|0,p=p+Math.imul(ae,pe)|0,a=a+Math.imul(ae,Ne)|0,a=a+Math.imul(le,pe)|0,g=g+Math.imul(le,Ne)|0,p=p+Math.imul(fe,xe)|0,a=a+Math.imul(fe,Re)|0,a=a+Math.imul(ne,xe)|0,g=g+Math.imul(ne,Re)|0,p=p+Math.imul(oe,Ee)|0,a=a+Math.imul(oe,$e)|0,a=a+Math.imul(se,Ee)|0,g=g+Math.imul(se,$e)|0,p=p+Math.imul(O,D)|0,a=a+Math.imul(O,C)|0,a=a+Math.imul(Q,D)|0,g=g+Math.imul(Q,C)|0,p=p+Math.imul(W,Y)|0,a=a+Math.imul(W,te)|0,a=a+Math.imul(G,Y)|0,g=g+Math.imul(G,te)|0,p=p+Math.imul(H,re)|0,a=a+Math.imul(H,ve)|0,a=a+Math.imul($,re)|0,g=g+Math.imul($,ve)|0,p=p+Math.imul(N,ce)|0,a=a+Math.imul(N,Me)|0,a=a+Math.imul(U,ce)|0,g=g+Math.imul(U,Me)|0;var bt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(bt>>>26)|0,bt&=67108863,p=Math.imul(me,we),a=Math.imul(me,Be),a=a+Math.imul(ge,we)|0,g=Math.imul(ge,Be),p=p+Math.imul(ye,be)|0,a=a+Math.imul(ye,ke)|0,a=a+Math.imul(Ae,be)|0,g=g+Math.imul(Ae,ke)|0,p=p+Math.imul(he,pe)|0,a=a+Math.imul(he,Ne)|0,a=a+Math.imul(_e,pe)|0,g=g+Math.imul(_e,Ne)|0,p=p+Math.imul(ae,xe)|0,a=a+Math.imul(ae,Re)|0,a=a+Math.imul(le,xe)|0,g=g+Math.imul(le,Re)|0,p=p+Math.imul(fe,Ee)|0,a=a+Math.imul(fe,$e)|0,a=a+Math.imul(ne,Ee)|0,g=g+Math.imul(ne,$e)|0,p=p+Math.imul(oe,D)|0,a=a+Math.imul(oe,C)|0,a=a+Math.imul(se,D)|0,g=g+Math.imul(se,C)|0,p=p+Math.imul(O,Y)|0,a=a+Math.imul(O,te)|0,a=a+Math.imul(Q,Y)|0,g=g+Math.imul(Q,te)|0,p=p+Math.imul(W,re)|0,a=a+Math.imul(W,ve)|0,a=a+Math.imul(G,re)|0,g=g+Math.imul(G,ve)|0,p=p+Math.imul(H,ce)|0,a=a+Math.imul(H,Me)|0,a=a+Math.imul($,ce)|0,g=g+Math.imul($,Me)|0,p=p+Math.imul(N,Se)|0,a=a+Math.imul(N,Te)|0,a=a+Math.imul(U,Se)|0,g=g+Math.imul(U,Te)|0;var xt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(xt>>>26)|0,xt&=67108863,p=Math.imul(me,be),a=Math.imul(me,ke),a=a+Math.imul(ge,be)|0,g=Math.imul(ge,ke),p=p+Math.imul(ye,pe)|0,a=a+Math.imul(ye,Ne)|0,a=a+Math.imul(Ae,pe)|0,g=g+Math.imul(Ae,Ne)|0,p=p+Math.imul(he,xe)|0,a=a+Math.imul(he,Re)|0,a=a+Math.imul(_e,xe)|0,g=g+Math.imul(_e,Re)|0,p=p+Math.imul(ae,Ee)|0,a=a+Math.imul(ae,$e)|0,a=a+Math.imul(le,Ee)|0,g=g+Math.imul(le,$e)|0,p=p+Math.imul(fe,D)|0,a=a+Math.imul(fe,C)|0,a=a+Math.imul(ne,D)|0,g=g+Math.imul(ne,C)|0,p=p+Math.imul(oe,Y)|0,a=a+Math.imul(oe,te)|0,a=a+Math.imul(se,Y)|0,g=g+Math.imul(se,te)|0,p=p+Math.imul(O,re)|0,a=a+Math.imul(O,ve)|0,a=a+Math.imul(Q,re)|0,g=g+Math.imul(Q,ve)|0,p=p+Math.imul(W,ce)|0,a=a+Math.imul(W,Me)|0,a=a+Math.imul(G,ce)|0,g=g+Math.imul(G,Me)|0,p=p+Math.imul(H,Se)|0,a=a+Math.imul(H,Te)|0,a=a+Math.imul($,Se)|0,g=g+Math.imul($,Te)|0;var Mt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,p=Math.imul(me,pe),a=Math.imul(me,Ne),a=a+Math.imul(ge,pe)|0,g=Math.imul(ge,Ne),p=p+Math.imul(ye,xe)|0,a=a+Math.imul(ye,Re)|0,a=a+Math.imul(Ae,xe)|0,g=g+Math.imul(Ae,Re)|0,p=p+Math.imul(he,Ee)|0,a=a+Math.imul(he,$e)|0,a=a+Math.imul(_e,Ee)|0,g=g+Math.imul(_e,$e)|0,p=p+Math.imul(ae,D)|0,a=a+Math.imul(ae,C)|0,a=a+Math.imul(le,D)|0,g=g+Math.imul(le,C)|0,p=p+Math.imul(fe,Y)|0,a=a+Math.imul(fe,te)|0,a=a+Math.imul(ne,Y)|0,g=g+Math.imul(ne,te)|0,p=p+Math.imul(oe,re)|0,a=a+Math.imul(oe,ve)|0,a=a+Math.imul(se,re)|0,g=g+Math.imul(se,ve)|0,p=p+Math.imul(O,ce)|0,a=a+Math.imul(O,Me)|0,a=a+Math.imul(Q,ce)|0,g=g+Math.imul(Q,Me)|0,p=p+Math.imul(W,Se)|0,a=a+Math.imul(W,Te)|0,a=a+Math.imul(G,Se)|0,g=g+Math.imul(G,Te)|0;var _t=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(_t>>>26)|0,_t&=67108863,p=Math.imul(me,xe),a=Math.imul(me,Re),a=a+Math.imul(ge,xe)|0,g=Math.imul(ge,Re),p=p+Math.imul(ye,Ee)|0,a=a+Math.imul(ye,$e)|0,a=a+Math.imul(Ae,Ee)|0,g=g+Math.imul(Ae,$e)|0,p=p+Math.imul(he,D)|0,a=a+Math.imul(he,C)|0,a=a+Math.imul(_e,D)|0,g=g+Math.imul(_e,C)|0,p=p+Math.imul(ae,Y)|0,a=a+Math.imul(ae,te)|0,a=a+Math.imul(le,Y)|0,g=g+Math.imul(le,te)|0,p=p+Math.imul(fe,re)|0,a=a+Math.imul(fe,ve)|0,a=a+Math.imul(ne,re)|0,g=g+Math.imul(ne,ve)|0,p=p+Math.imul(oe,ce)|0,a=a+Math.imul(oe,Me)|0,a=a+Math.imul(se,ce)|0,g=g+Math.imul(se,Me)|0,p=p+Math.imul(O,Se)|0,a=a+Math.imul(O,Te)|0,a=a+Math.imul(Q,Se)|0,g=g+Math.imul(Q,Te)|0;var Et=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Et>>>26)|0,Et&=67108863,p=Math.imul(me,Ee),a=Math.imul(me,$e),a=a+Math.imul(ge,Ee)|0,g=Math.imul(ge,$e),p=p+Math.imul(ye,D)|0,a=a+Math.imul(ye,C)|0,a=a+Math.imul(Ae,D)|0,g=g+Math.imul(Ae,C)|0,p=p+Math.imul(he,Y)|0,a=a+Math.imul(he,te)|0,a=a+Math.imul(_e,Y)|0,g=g+Math.imul(_e,te)|0,p=p+Math.imul(ae,re)|0,a=a+Math.imul(ae,ve)|0,a=a+Math.imul(le,re)|0,g=g+Math.imul(le,ve)|0,p=p+Math.imul(fe,ce)|0,a=a+Math.imul(fe,Me)|0,a=a+Math.imul(ne,ce)|0,g=g+Math.imul(ne,Me)|0,p=p+Math.imul(oe,Se)|0,a=a+Math.imul(oe,Te)|0,a=a+Math.imul(se,Se)|0,g=g+Math.imul(se,Te)|0;var St=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(St>>>26)|0,St&=67108863,p=Math.imul(me,D),a=Math.imul(me,C),a=a+Math.imul(ge,D)|0,g=Math.imul(ge,C),p=p+Math.imul(ye,Y)|0,a=a+Math.imul(ye,te)|0,a=a+Math.imul(Ae,Y)|0,g=g+Math.imul(Ae,te)|0,p=p+Math.imul(he,re)|0,a=a+Math.imul(he,ve)|0,a=a+Math.imul(_e,re)|0,g=g+Math.imul(_e,ve)|0,p=p+Math.imul(ae,ce)|0,a=a+Math.imul(ae,Me)|0,a=a+Math.imul(le,ce)|0,g=g+Math.imul(le,Me)|0,p=p+Math.imul(fe,Se)|0,a=a+Math.imul(fe,Te)|0,a=a+Math.imul(ne,Se)|0,g=g+Math.imul(ne,Te)|0;var At=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(At>>>26)|0,At&=67108863,p=Math.imul(me,Y),a=Math.imul(me,te),a=a+Math.imul(ge,Y)|0,g=Math.imul(ge,te),p=p+Math.imul(ye,re)|0,a=a+Math.imul(ye,ve)|0,a=a+Math.imul(Ae,re)|0,g=g+Math.imul(Ae,ve)|0,p=p+Math.imul(he,ce)|0,a=a+Math.imul(he,Me)|0,a=a+Math.imul(_e,ce)|0,g=g+Math.imul(_e,Me)|0,p=p+Math.imul(ae,Se)|0,a=a+Math.imul(ae,Te)|0,a=a+Math.imul(le,Se)|0,g=g+Math.imul(le,Te)|0;var kt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(kt>>>26)|0,kt&=67108863,p=Math.imul(me,re),a=Math.imul(me,ve),a=a+Math.imul(ge,re)|0,g=Math.imul(ge,ve),p=p+Math.imul(ye,ce)|0,a=a+Math.imul(ye,Me)|0,a=a+Math.imul(Ae,ce)|0,g=g+Math.imul(Ae,Me)|0,p=p+Math.imul(he,Se)|0,a=a+Math.imul(he,Te)|0,a=a+Math.imul(_e,Se)|0,g=g+Math.imul(_e,Te)|0;var Bt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,p=Math.imul(me,ce),a=Math.imul(me,Me),a=a+Math.imul(ge,ce)|0,g=Math.imul(ge,Me),p=p+Math.imul(ye,Se)|0,a=a+Math.imul(ye,Te)|0,a=a+Math.imul(Ae,Se)|0,g=g+Math.imul(Ae,Te)|0;var Rt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,p=Math.imul(me,Se),a=Math.imul(me,Te),a=a+Math.imul(ge,Se)|0,g=Math.imul(ge,Te);var $t=(m+p|0)+((a&8191)<<13)|0;return m=(g+(a>>>13)|0)+($t>>>26)|0,$t&=67108863,y[0]=Ge,y[1]=Je,y[2]=pt,y[3]=vt,y[4]=gt,y[5]=yt,y[6]=mt,y[7]=wt,y[8]=bt,y[9]=xt,y[10]=Mt,y[11]=_t,y[12]=Et,y[13]=St,y[14]=At,y[15]=kt,y[16]=Bt,y[17]=Rt,y[18]=$t,m!==0&&(y[19]=m,l.length++),l};Math.imul||(B=R);function I(x,o,f){f.negative=o.negative^x.negative,f.length=x.length+o.length;for(var l=0,h=0,v=0;v<f.length-1;v++){var y=h;h=0;for(var m=l&67108863,p=Math.min(v,o.length-1),a=Math.max(0,v-x.length+1);a<=p;a++){var g=v-a,S=x.words[g]|0,N=o.words[a]|0,U=S*N,Z=U&67108863;y=y+(U/67108864|0)|0,Z=Z+m|0,m=Z&67108863,y=y+(Z>>>26)|0,h+=y>>>26,y&=67108863}f.words[v]=m,l=y,y=h}return l!==0?f.words[v]=l:f.length--,f.strip()}function E(x,o,f){var l=new k;return l.mulp(x,o,f)}i.prototype.mulTo=function(o,f){var l,h=this.length+o.length;return this.length===10&&o.length===10?l=B(this,o,f):h<63?l=R(this,o,f):h<1024?l=I(this,o,f):l=E(this,o,f),l};function k(x,o){this.x=x,this.y=o}k.prototype.makeRBT=function(o){for(var f=new Array(o),l=i.prototype._countBits(o)-1,h=0;h<o;h++)f[h]=this.revBin(h,l,o);return f},k.prototype.revBin=function(o,f,l){if(o===0||o===l-1)return o;for(var h=0,v=0;v<f;v++)h|=(o&1)<<f-v-1,o>>=1;return h},k.prototype.permute=function(o,f,l,h,v,y){for(var m=0;m<y;m++)h[m]=f[o[m]],v[m]=l[o[m]]},k.prototype.transform=function(o,f,l,h,v,y){this.permute(y,o,f,l,h,v);for(var m=1;m<v;m<<=1)for(var p=m<<1,a=Math.cos(2*Math.PI/p),g=Math.sin(2*Math.PI/p),S=0;S<v;S+=p)for(var N=a,U=g,Z=0;Z<m;Z++){var H=l[S+Z],$=h[S+Z],P=l[S+Z+m],W=h[S+Z+m],G=N*P-U*W;W=N*W+U*P,P=G,l[S+Z]=H+P,h[S+Z]=$+W,l[S+Z+m]=H-P,h[S+Z+m]=$-W,Z!==p&&(G=a*N-g*U,U=a*U+g*N,N=G)}},k.prototype.guessLen13b=function(o,f){var l=Math.max(f,o)|1,h=l&1,v=0;for(l=l/2|0;l;l=l>>>1)v++;return 1<<v+1+h},k.prototype.conjugate=function(o,f,l){if(!(l<=1))for(var h=0;h<l/2;h++){var v=o[h];o[h]=o[l-h-1],o[l-h-1]=v,v=f[h],f[h]=-f[l-h-1],f[l-h-1]=-v}},k.prototype.normalize13b=function(o,f){for(var l=0,h=0;h<f/2;h++){var v=Math.round(o[2*h+1]/f)*8192+Math.round(o[2*h]/f)+l;o[h]=v&67108863,v<67108864?l=0:l=v/67108864|0}return o},k.prototype.convert13b=function(o,f,l,h){for(var v=0,y=0;y<f;y++)v=v+(o[y]|0),l[2*y]=v&8191,v=v>>>13,l[2*y+1]=v&8191,v=v>>>13;for(y=2*f;y<h;++y)l[y]=0;n(v===0),n((v&-8192)===0)},k.prototype.stub=function(o){for(var f=new Array(o),l=0;l<o;l++)f[l]=0;return f},k.prototype.mulp=function(o,f,l){var h=2*this.guessLen13b(o.length,f.length),v=this.makeRBT(h),y=this.stub(h),m=new Array(h),p=new Array(h),a=new Array(h),g=new Array(h),S=new Array(h),N=new Array(h),U=l.words;U.length=h,this.convert13b(o.words,o.length,m,h),this.convert13b(f.words,f.length,g,h),this.transform(m,y,p,a,h,v),this.transform(g,y,S,N,h,v);for(var Z=0;Z<h;Z++){var H=p[Z]*S[Z]-a[Z]*N[Z];a[Z]=p[Z]*N[Z]+a[Z]*S[Z],p[Z]=H}return this.conjugate(p,a,h),this.transform(p,a,U,y,h,v),this.conjugate(U,y,h),this.normalize13b(U,h),l.negative=o.negative^f.negative,l.length=o.length+f.length,l.strip()},i.prototype.mul=function(o){var f=new i(null);return f.words=new Array(this.length+o.length),this.mulTo(o,f)},i.prototype.mulf=function(o){var f=new i(null);return f.words=new Array(this.length+o.length),E(this,o,f)},i.prototype.imul=function(o){return this.clone().mulTo(o,this)},i.prototype.imuln=function(o){n(typeof o=="number"),n(o<67108864);for(var f=0,l=0;l<this.length;l++){var h=(this.words[l]|0)*o,v=(h&67108863)+(f&67108863);f>>=26,f+=h/67108864|0,f+=v>>>26,this.words[l]=v&67108863}return f!==0&&(this.words[l]=f,this.length++),this.length=o===0?1:this.length,this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var f=A(o);if(f.length===0)return new i(1);for(var l=this,h=0;h<f.length&&f[h]===0;h++,l=l.sqr());if(++h<f.length)for(var v=l.sqr();h<f.length;h++,v=v.sqr())f[h]!==0&&(l=l.mul(v));return l},i.prototype.iushln=function(o){n(typeof o=="number"&&o>=0);var f=o%26,l=(o-f)/26,h=67108863>>>26-f<<26-f,v;if(f!==0){var y=0;for(v=0;v<this.length;v++){var m=this.words[v]&h,p=(this.words[v]|0)-m<<f;this.words[v]=p|y,y=m>>>26-f}y&&(this.words[v]=y,this.length++)}if(l!==0){for(v=this.length-1;v>=0;v--)this.words[v+l]=this.words[v];for(v=0;v<l;v++)this.words[v]=0;this.length+=l}return this.strip()},i.prototype.ishln=function(o){return n(this.negative===0),this.iushln(o)},i.prototype.iushrn=function(o,f,l){n(typeof o=="number"&&o>=0);var h;f?h=(f-f%26)/26:h=0;var v=o%26,y=Math.min((o-v)/26,this.length),m=67108863^67108863>>>v<<v,p=l;if(h-=y,h=Math.max(0,h),p){for(var a=0;a<y;a++)p.words[a]=this.words[a];p.length=y}if(y!==0)if(this.length>y)for(this.length-=y,a=0;a<this.length;a++)this.words[a]=this.words[a+y];else this.words[0]=0,this.length=1;var g=0;for(a=this.length-1;a>=0&&(g!==0||a>=h);a--){var S=this.words[a]|0;this.words[a]=g<<26-v|S>>>v,g=S&m}return p&&g!==0&&(p.words[p.length++]=g),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,f,l){return n(this.negative===0),this.iushrn(o,f,l)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var f=o%26,l=(o-f)/26,h=1<<f;if(this.length<=l)return!1;var v=this.words[l];return!!(v&h)},i.prototype.imaskn=function(o){n(typeof o=="number"&&o>=0);var f=o%26,l=(o-f)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(f!==0&&l++,this.length=Math.min(l,this.length),f!==0){var h=67108863^67108863>>>f<<f;this.words[this.length-1]&=h}return this.strip()},i.prototype.maskn=function(o){return this.clone().imaskn(o)},i.prototype.iaddn=function(o){return n(typeof o=="number"),n(o<67108864),o<0?this.isubn(-o):this.negative!==0?this.length===1&&(this.words[0]|0)<o?(this.words[0]=o-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(o),this.negative=1,this):this._iaddn(o)},i.prototype._iaddn=function(o){this.words[0]+=o;for(var f=0;f<this.length&&this.words[f]>=67108864;f++)this.words[f]-=67108864,f===this.length-1?this.words[f+1]=1:this.words[f+1]++;return this.length=Math.max(this.length,f+1),this},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var f=0;f<this.length&&this.words[f]<0;f++)this.words[f]+=67108864,this.words[f+1]-=1;return this.strip()},i.prototype.addn=function(o){return this.clone().iaddn(o)},i.prototype.subn=function(o){return this.clone().isubn(o)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(o,f,l){var h=o.length+l,v;this._expand(h);var y,m=0;for(v=0;v<o.length;v++){y=(this.words[v+l]|0)+m;var p=(o.words[v]|0)*f;y-=p&67108863,m=(y>>26)-(p/67108864|0),this.words[v+l]=y&67108863}for(;v<this.length-l;v++)y=(this.words[v+l]|0)+m,m=y>>26,this.words[v+l]=y&67108863;if(m===0)return this.strip();for(n(m===-1),m=0,v=0;v<this.length;v++)y=-(this.words[v]|0)+m,m=y>>26,this.words[v]=y&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,f){var l=this.length-o.length,h=this.clone(),v=o,y=v.words[v.length-1]|0,m=this._countBits(y);l=26-m,l!==0&&(v=v.ushln(l),h.iushln(l),y=v.words[v.length-1]|0);var p=h.length-v.length,a;if(f!=="mod"){a=new i(null),a.length=p+1,a.words=new Array(a.length);for(var g=0;g<a.length;g++)a.words[g]=0}var S=h.clone()._ishlnsubmul(v,1,p);S.negative===0&&(h=S,a&&(a.words[p]=1));for(var N=p-1;N>=0;N--){var U=(h.words[v.length+N]|0)*67108864+(h.words[v.length+N-1]|0);for(U=Math.min(U/y|0,67108863),h._ishlnsubmul(v,U,N);h.negative!==0;)U--,h.negative=0,h._ishlnsubmul(v,1,N),h.isZero()||(h.negative^=1);a&&(a.words[N]=U)}return a&&a.strip(),h.strip(),f!=="div"&&l!==0&&h.iushrn(l),{div:a||null,mod:h}},i.prototype.divmod=function(o,f,l){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,v,y;return this.negative!==0&&o.negative===0?(y=this.neg().divmod(o,f),f!=="mod"&&(h=y.div.neg()),f!=="div"&&(v=y.mod.neg(),l&&v.negative!==0&&v.iadd(o)),{div:h,mod:v}):this.negative===0&&o.negative!==0?(y=this.divmod(o.neg(),f),f!=="mod"&&(h=y.div.neg()),{div:h,mod:y.mod}):this.negative&o.negative?(y=this.neg().divmod(o.neg(),f),f!=="div"&&(v=y.mod.neg(),l&&v.negative!==0&&v.isub(o)),{div:y.div,mod:v}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?f==="div"?{div:this.divn(o.words[0]),mod:null}:f==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,f)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var f=this.divmod(o);if(f.mod.isZero())return f.div;var l=f.div.negative!==0?f.mod.isub(o):f.mod,h=o.ushrn(1),v=o.andln(1),y=l.cmp(h);return y<0||v===1&&y===0?f.div:f.div.negative!==0?f.div.isubn(1):f.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var f=(1<<26)%o,l=0,h=this.length-1;h>=0;h--)l=(f*l+(this.words[h]|0))%o;return l},i.prototype.idivn=function(o){n(o<=67108863);for(var f=0,l=this.length-1;l>=0;l--){var h=(this.words[l]|0)+f*67108864;this.words[l]=h/o|0,f=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var f=this,l=o.clone();f.negative!==0?f=f.umod(o):f=f.clone();for(var h=new i(1),v=new i(0),y=new i(0),m=new i(1),p=0;f.isEven()&&l.isEven();)f.iushrn(1),l.iushrn(1),++p;for(var a=l.clone(),g=f.clone();!f.isZero();){for(var S=0,N=1;!(f.words[0]&N)&&S<26;++S,N<<=1);if(S>0)for(f.iushrn(S);S-- >0;)(h.isOdd()||v.isOdd())&&(h.iadd(a),v.isub(g)),h.iushrn(1),v.iushrn(1);for(var U=0,Z=1;!(l.words[0]&Z)&&U<26;++U,Z<<=1);if(U>0)for(l.iushrn(U);U-- >0;)(y.isOdd()||m.isOdd())&&(y.iadd(a),m.isub(g)),y.iushrn(1),m.iushrn(1);f.cmp(l)>=0?(f.isub(l),h.isub(y),v.isub(m)):(l.isub(f),y.isub(h),m.isub(v))}return{a:y,b:m,gcd:l.iushln(p)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var f=this,l=o.clone();f.negative!==0?f=f.umod(o):f=f.clone();for(var h=new i(1),v=new i(0),y=l.clone();f.cmpn(1)>0&&l.cmpn(1)>0;){for(var m=0,p=1;!(f.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(f.iushrn(m);m-- >0;)h.isOdd()&&h.iadd(y),h.iushrn(1);for(var a=0,g=1;!(l.words[0]&g)&&a<26;++a,g<<=1);if(a>0)for(l.iushrn(a);a-- >0;)v.isOdd()&&v.iadd(y),v.iushrn(1);f.cmp(l)>=0?(f.isub(l),h.isub(v)):(l.isub(f),v.isub(h))}var S;return f.cmpn(1)===0?S=h:S=v,S.cmpn(0)<0&&S.iadd(o),S},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var f=this.clone(),l=o.clone();f.negative=0,l.negative=0;for(var h=0;f.isEven()&&l.isEven();h++)f.iushrn(1),l.iushrn(1);do{for(;f.isEven();)f.iushrn(1);for(;l.isEven();)l.iushrn(1);var v=f.cmp(l);if(v<0){var y=f;f=l,l=y}else if(v===0||l.cmpn(1)===0)break;f.isub(l)}while(!0);return l.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var f=o%26,l=(o-f)/26,h=1<<f;if(this.length<=l)return this._expand(l+1),this.words[l]|=h,this;for(var v=h,y=l;v!==0&&y<this.length;y++){var m=this.words[y]|0;m+=v,v=m>>>26,m&=67108863,this.words[y]=m}return v!==0&&(this.words[y]=v,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var f=o<0;if(this.negative!==0&&!f)return-1;if(this.negative===0&&f)return 1;this.strip();var l;if(this.length>1)l=1;else{f&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;l=h===o?0:h<o?-1:1}return this.negative!==0?-l|0:l},i.prototype.cmp=function(o){if(this.negative!==0&&o.negative===0)return-1;if(this.negative===0&&o.negative!==0)return 1;var f=this.ucmp(o);return this.negative!==0?-f|0:f},i.prototype.ucmp=function(o){if(this.length>o.length)return 1;if(this.length<o.length)return-1;for(var f=0,l=this.length-1;l>=0;l--){var h=this.words[l]|0,v=o.words[l]|0;if(h!==v){h<v?f=-1:h>v&&(f=1);break}}return f},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new X(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var T={k256:null,p224:null,p192:null,p25519:null};function L(x,o){this.name=x,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}L.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},L.prototype.ireduce=function(o){var f=o,l;do this.split(f,this.tmp),f=this.imulK(f),f=f.iadd(this.tmp),l=f.bitLength();while(l>this.n);var h=l<this.n?-1:f.ucmp(this.p);return h===0?(f.words[0]=0,f.length=1):h>0?f.isub(this.p):f.strip!==void 0?f.strip():f._strip(),f},L.prototype.split=function(o,f){o.iushrn(this.n,0,f)},L.prototype.imulK=function(o){return o.imul(this.k)};function q(){L.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(q,L),q.prototype.split=function(o,f){for(var l=4194303,h=Math.min(o.length,9),v=0;v<h;v++)f.words[v]=o.words[v];if(f.length=h,o.length<=9){o.words[0]=0,o.length=1;return}var y=o.words[9];for(f.words[f.length++]=y&l,v=10;v<o.length;v++){var m=o.words[v]|0;o.words[v-10]=(m&l)<<4|y>>>22,y=m}y>>>=22,o.words[v-10]=y,y===0&&o.length>10?o.length-=10:o.length-=9},q.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var f=0,l=0;l<o.length;l++){var h=o.words[l]|0;f+=h*977,o.words[l]=f&67108863,f=h*64+(f/67108864|0)}return o.words[o.length-1]===0&&(o.length--,o.words[o.length-1]===0&&o.length--),o};function z(){L.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(z,L);function J(){L.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(J,L);function F(){L.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(F,L),F.prototype.imulK=function(o){for(var f=0,l=0;l<o.length;l++){var h=(o.words[l]|0)*19+f,v=h&67108863;h>>>=26,o.words[l]=v,f=h}return f!==0&&(o.words[o.length++]=f),o},i._prime=function(o){if(T[o])return T[o];var f;if(o==="k256")f=new q;else if(o==="p224")f=new z;else if(o==="p192")f=new J;else if(o==="p25519")f=new F;else throw new Error("Unknown prime "+o);return T[o]=f,f};function X(x){if(typeof x=="string"){var o=i._prime(x);this.m=o.p,this.prime=o}else n(x.gtn(1),"modulus must be greater than 1"),this.m=x,this.prime=null}X.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},X.prototype._verify2=function(o,f){n((o.negative|f.negative)===0,"red works only with positives"),n(o.red&&o.red===f.red,"red works only with red numbers")},X.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},X.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},X.prototype.add=function(o,f){this._verify2(o,f);var l=o.add(f);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},X.prototype.iadd=function(o,f){this._verify2(o,f);var l=o.iadd(f);return l.cmp(this.m)>=0&&l.isub(this.m),l},X.prototype.sub=function(o,f){this._verify2(o,f);var l=o.sub(f);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},X.prototype.isub=function(o,f){this._verify2(o,f);var l=o.isub(f);return l.cmpn(0)<0&&l.iadd(this.m),l},X.prototype.shl=function(o,f){return this._verify1(o),this.imod(o.ushln(f))},X.prototype.imul=function(o,f){return this._verify2(o,f),this.imod(o.imul(f))},X.prototype.mul=function(o,f){return this._verify2(o,f),this.imod(o.mul(f))},X.prototype.isqr=function(o){return this.imul(o,o.clone())},X.prototype.sqr=function(o){return this.mul(o,o)},X.prototype.sqrt=function(o){if(o.isZero())return o.clone();var f=this.m.andln(3);if(n(f%2===1),f===3){var l=this.m.add(new i(1)).iushrn(2);return this.pow(o,l)}for(var h=this.m.subn(1),v=0;!h.isZero()&&h.andln(1)===0;)v++,h.iushrn(1);n(!h.isZero());var y=new i(1).toRed(this),m=y.redNeg(),p=this.m.subn(1).iushrn(1),a=this.m.bitLength();for(a=new i(2*a*a).toRed(this);this.pow(a,p).cmp(m)!==0;)a.redIAdd(m);for(var g=this.pow(a,h),S=this.pow(o,h.addn(1).iushrn(1)),N=this.pow(o,h),U=v;N.cmp(y)!==0;){for(var Z=N,H=0;Z.cmp(y)!==0;H++)Z=Z.redSqr();n(H<U);var $=this.pow(g,new i(1).iushln(U-H-1));S=S.redMul($),g=$.redSqr(),N=N.redMul(g),U=H}return S},X.prototype.invm=function(o){var f=o._invmp(this.m);return f.negative!==0?(f.negative=0,this.imod(f).redNeg()):this.imod(f)},X.prototype.pow=function(o,f){if(f.isZero())return new i(1).toRed(this);if(f.cmpn(1)===0)return o.clone();var l=4,h=new Array(1<<l);h[0]=new i(1).toRed(this),h[1]=o;for(var v=2;v<h.length;v++)h[v]=this.mul(h[v-1],o);var y=h[0],m=0,p=0,a=f.bitLength()%26;for(a===0&&(a=26),v=f.length-1;v>=0;v--){for(var g=f.words[v],S=a-1;S>=0;S--){var N=g>>S&1;if(y!==h[0]&&(y=this.sqr(y)),N===0&&m===0){p=0;continue}m<<=1,m|=N,p++,!(p!==l&&(v!==0||S!==0))&&(y=this.mul(y,h[m]),p=0,m=0)}a=26}return y},X.prototype.convertTo=function(o){var f=o.umod(this.m);return f===o?f.clone():f},X.prototype.convertFrom=function(o){var f=o.clone();return f.red=null,f},i.mont=function(o){return new ee(o)};function ee(x){X.call(this,x),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(ee,X),ee.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},ee.prototype.convertFrom=function(o){var f=this.imod(o.mul(this.rinv));return f.red=null,f},ee.prototype.imul=function(o,f){if(o.isZero()||f.isZero())return o.words[0]=0,o.length=1,o;var l=o.imul(f),h=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=l.isub(h).iushrn(this.shift),y=v;return v.cmp(this.m)>=0?y=v.isub(this.m):v.cmpn(0)<0&&(y=v.iadd(this.m)),y._forceRed(this)},ee.prototype.mul=function(o,f){if(o.isZero()||f.isZero())return new i(0)._forceRed(this);var l=o.mul(f),h=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=l.isub(h).iushrn(this.shift),y=v;return v.cmp(this.m)>=0?y=v.isub(this.m):v.cmpn(0)<0&&(y=v.iadd(this.m)),y._forceRed(this)},ee.prototype.invm=function(o){var f=this.imod(o._invmp(this.m).mul(this.r2));return f._forceRed(this)}})(e,Ve)})(Iw);var Io=Iw.exports,Cw={};(function(e){var t=e;function r(i,u){if(Array.isArray(i))return i.slice();if(!i)return[];var d=[];if(typeof i!="string"){for(var c=0;c<i.length;c++)d[c]=i[c]|0;return d}if(u==="hex"){i=i.replace(/[^a-z0-9]+/ig,""),i.length%2!==0&&(i="0"+i);for(var c=0;c<i.length;c+=2)d.push(parseInt(i[c]+i[c+1],16))}else for(var c=0;c<i.length;c++){var b=i.charCodeAt(c),w=b>>8,M=b&255;w?d.push(w,M):d.push(M)}return d}t.toArray=r;function n(i){return i.length===1?"0"+i:i}t.zero2=n;function s(i){for(var u="",d=0;d<i.length;d++)u+=n(i[d].toString(16));return u}t.toHex=s,t.encode=function(u,d){return d==="hex"?s(u):u}})(Cw);(function(e){var t=e,r=Io,n=Pn,s=Cw;t.assert=n,t.toArray=s.toArray,t.zero2=s.zero2,t.toHex=s.toHex,t.encode=s.encode;function i(w,M,_){var A=new Array(Math.max(w.bitLength(),_)+1),R;for(R=0;R<A.length;R+=1)A[R]=0;var B=1<<M+1,I=w.clone();for(R=0;R<A.length;R++){var E,k=I.andln(B-1);I.isOdd()?(k>(B>>1)-1?E=(B>>1)-k:E=k,I.isubn(E)):E=0,A[R]=E,I.iushrn(1)}return A}t.getNAF=i;function u(w,M){var _=[[],[]];w=w.clone(),M=M.clone();for(var A=0,R=0,B;w.cmpn(-A)>0||M.cmpn(-R)>0;){var I=w.andln(3)+A&3,E=M.andln(3)+R&3;I===3&&(I=-1),E===3&&(E=-1);var k;I&1?(B=w.andln(7)+A&7,(B===3||B===5)&&E===2?k=-I:k=I):k=0,_[0].push(k);var T;E&1?(B=M.andln(7)+R&7,(B===3||B===5)&&I===2?T=-E:T=E):T=0,_[1].push(T),2*A===k+1&&(A=1-A),2*R===T+1&&(R=1-R),w.iushrn(1),M.iushrn(1)}return _}t.getJSF=u;function d(w,M,_){var A="_"+M;w.prototype[M]=function(){return this[A]!==void 0?this[A]:this[A]=_.call(this)}}t.cachedProperty=d;function c(w){return typeof w=="string"?t.toArray(w,"hex"):w}t.parseBytes=c;function b(w){return new r(w,"hex","le")}t.intFromLE=b})(yn);var Pw={},Ks=Io,gh=yn,x0=gh.getNAF,mG=gh.getJSF,M0=gh.assert;function Us(e,t){this.type=e,this.p=new Ks(t.p,16),this.red=t.prime?Ks.red(t.prime):Ks.mont(this.p),this.zero=new Ks(0).toRed(this.red),this.one=new Ks(1).toRed(this.red),this.two=new Ks(2).toRed(this.red),this.n=t.n&&new Ks(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 Fd=Us;Us.prototype.point=function(){throw new Error("Not implemented")};Us.prototype.validate=function(){throw new Error("Not implemented")};Us.prototype._fixedNafMul=function(t,r){M0(t.precomputed);var n=t._getDoubles(),s=x0(r,1,this._bitLength),i=(1<<n.step+1)-(n.step%2===0?2:1);i/=3;var u=[],d,c;for(d=0;d<s.length;d+=n.step){c=0;for(var b=d+n.step-1;b>=d;b--)c=(c<<1)+s[b];u.push(c)}for(var w=this.jpoint(null,null,null),M=this.jpoint(null,null,null),_=i;_>0;_--){for(d=0;d<u.length;d++)c=u[d],c===_?M=M.mixedAdd(n.points[d]):c===-_&&(M=M.mixedAdd(n.points[d].neg()));w=w.add(M)}return w.toP()};Us.prototype._wnafMul=function(t,r){var n=4,s=t._getNAFPoints(n);n=s.wnd;for(var i=s.points,u=x0(r,n,this._bitLength),d=this.jpoint(null,null,null),c=u.length-1;c>=0;c--){for(var b=0;c>=0&&u[c]===0;c--)b++;if(c>=0&&b++,d=d.dblp(b),c<0)break;var w=u[c];M0(w!==0),t.type==="affine"?w>0?d=d.mixedAdd(i[w-1>>1]):d=d.mixedAdd(i[-w-1>>1].neg()):w>0?d=d.add(i[w-1>>1]):d=d.add(i[-w-1>>1].neg())}return t.type==="affine"?d.toP():d};Us.prototype._wnafMulAdd=function(t,r,n,s,i){var u=this._wnafT1,d=this._wnafT2,c=this._wnafT3,b=0,w,M,_;for(w=0;w<s;w++){_=r[w];var A=_._getNAFPoints(t);u[w]=A.wnd,d[w]=A.points}for(w=s-1;w>=1;w-=2){var R=w-1,B=w;if(u[R]!==1||u[B]!==1){c[R]=x0(n[R],u[R],this._bitLength),c[B]=x0(n[B],u[B],this._bitLength),b=Math.max(c[R].length,b),b=Math.max(c[B].length,b);continue}var I=[r[R],null,null,r[B]];r[R].y.cmp(r[B].y)===0?(I[1]=r[R].add(r[B]),I[2]=r[R].toJ().mixedAdd(r[B].neg())):r[R].y.cmp(r[B].y.redNeg())===0?(I[1]=r[R].toJ().mixedAdd(r[B]),I[2]=r[R].add(r[B].neg())):(I[1]=r[R].toJ().mixedAdd(r[B]),I[2]=r[R].toJ().mixedAdd(r[B].neg()));var E=[-3,-1,-5,-7,0,7,5,1,3],k=mG(n[R],n[B]);for(b=Math.max(k[0].length,b),c[R]=new Array(b),c[B]=new Array(b),M=0;M<b;M++){var T=k[0][M]|0,L=k[1][M]|0;c[R][M]=E[(T+1)*3+(L+1)],c[B][M]=0,d[R]=I}}var q=this.jpoint(null,null,null),z=this._wnafT4;for(w=b;w>=0;w--){for(var J=0;w>=0;){var F=!0;for(M=0;M<s;M++)z[M]=c[M][w]|0,z[M]!==0&&(F=!1);if(!F)break;J++,w--}if(w>=0&&J++,q=q.dblp(J),w<0)break;for(M=0;M<s;M++){var X=z[M];X!==0&&(X>0?_=d[M][X-1>>1]:X<0&&(_=d[M][-X-1>>1].neg()),_.type==="affine"?q=q.mixedAdd(_):q=q.add(_))}}for(w=0;w<s;w++)d[w]=null;return i?q:q.toP()};function On(e,t){this.curve=e,this.type=t,this.precomputed=null}Us.BasePoint=On;On.prototype.eq=function(){throw new Error("Not implemented")};On.prototype.validate=function(){return this.curve.validate(this)};Us.prototype.decodePoint=function(t,r){t=gh.toArray(t,r);var n=this.p.byteLength();if((t[0]===4||t[0]===6||t[0]===7)&&t.length-1===2*n){t[0]===6?M0(t[t.length-1]%2===0):t[0]===7&&M0(t[t.length-1]%2===1);var s=this.point(t.slice(1,1+n),t.slice(1+n,1+2*n));return s}else if((t[0]===2||t[0]===3)&&t.length-1===n)return this.pointFromX(t.slice(1,1+n),t[0]===3);throw new Error("Unknown point format")};On.prototype.encodeCompressed=function(t){return this.encode(t,!0)};On.prototype._encode=function(t){var r=this.curve.p.byteLength(),n=this.getX().toArray("be",r);return t?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",r))};On.prototype.encode=function(t,r){return gh.encode(this._encode(r),t)};On.prototype.precompute=function(t){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,t),r.beta=this._getBeta(),this.precomputed=r,this};On.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return r?r.points.length>=Math.ceil((t.bitLength()+1)/r.step):!1};On.prototype._getDoubles=function(t,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],s=this,i=0;i<r;i+=t){for(var u=0;u<t;u++)s=s.dbl();n.push(s)}return{step:t,points:n}};On.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],n=(1<<t)-1,s=n===1?null:this.dbl(),i=1;i<n;i++)r[i]=r[i-1].add(s);return{wnd:t,points:r}};On.prototype._getBeta=function(){return null};On.prototype.dblp=function(t){for(var r=this,n=0;n<t;n++)r=r.dbl();return r};var wG=yn,Vt=Io,Lw=Fe,El=Fd,bG=wG.assert;function Un(e){El.call(this,"short",e),this.a=new Vt(e.a,16).toRed(this.red),this.b=new Vt(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Lw(Un,El);var xG=Un;Un.prototype._getEndomorphism=function(t){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,n;if(t.beta)r=new Vt(t.beta,16).toRed(this.red);else{var s=this._getEndoRoots(this.p);r=s[0].cmp(s[1])<0?s[0]:s[1],r=r.toRed(this.red)}if(t.lambda)n=new Vt(t.lambda,16);else{var i=this._getEndoRoots(this.n);this.g.mul(i[0]).x.cmp(this.g.x.redMul(r))===0?n=i[0]:(n=i[1],bG(this.g.mul(n).x.cmp(this.g.x.redMul(r))===0))}var u;return t.basis?u=t.basis.map(function(d){return{a:new Vt(d.a,16),b:new Vt(d.b,16)}}):u=this._getEndoBasis(n),{beta:r,lambda:n,basis:u}}};Un.prototype._getEndoRoots=function(t){var r=t===this.p?this.red:Vt.mont(t),n=new Vt(2).toRed(r).redInvm(),s=n.redNeg(),i=new Vt(3).toRed(r).redNeg().redSqrt().redMul(n),u=s.redAdd(i).fromRed(),d=s.redSub(i).fromRed();return[u,d]};Un.prototype._getEndoBasis=function(t){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=t,s=this.n.clone(),i=new Vt(1),u=new Vt(0),d=new Vt(0),c=new Vt(1),b,w,M,_,A,R,B,I=0,E,k;n.cmpn(0)!==0;){var T=s.div(n);E=s.sub(T.mul(n)),k=d.sub(T.mul(i));var L=c.sub(T.mul(u));if(!M&&E.cmp(r)<0)b=B.neg(),w=i,M=E.neg(),_=k;else if(M&&++I===2)break;B=E,s=n,n=E,d=i,i=k,c=u,u=L}A=E.neg(),R=k;var q=M.sqr().add(_.sqr()),z=A.sqr().add(R.sqr());return z.cmp(q)>=0&&(A=b,R=w),M.negative&&(M=M.neg(),_=_.neg()),A.negative&&(A=A.neg(),R=R.neg()),[{a:M,b:_},{a:A,b:R}]};Un.prototype._endoSplit=function(t){var r=this.endo.basis,n=r[0],s=r[1],i=s.b.mul(t).divRound(this.n),u=n.b.neg().mul(t).divRound(this.n),d=i.mul(n.a),c=u.mul(s.a),b=i.mul(n.b),w=u.mul(s.b),M=t.sub(d).sub(c),_=b.add(w).neg();return{k1:M,k2:_}};Un.prototype.pointFromX=function(t,r){t=new Vt(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),s=n.redSqrt();if(s.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var i=s.fromRed().isOdd();return(r&&!i||!r&&i)&&(s=s.redNeg()),this.point(t,s)};Un.prototype.validate=function(t){if(t.inf)return!0;var r=t.x,n=t.y,s=this.a.redMul(r),i=r.redSqr().redMul(r).redIAdd(s).redIAdd(this.b);return n.redSqr().redISub(i).cmpn(0)===0};Un.prototype._endoWnafMulAdd=function(t,r,n){for(var s=this._endoWnafT1,i=this._endoWnafT2,u=0;u<t.length;u++){var d=this._endoSplit(r[u]),c=t[u],b=c._getBeta();d.k1.negative&&(d.k1.ineg(),c=c.neg(!0)),d.k2.negative&&(d.k2.ineg(),b=b.neg(!0)),s[u*2]=c,s[u*2+1]=b,i[u*2]=d.k1,i[u*2+1]=d.k2}for(var w=this._wnafMulAdd(1,s,i,u*2,n),M=0;M<u*2;M++)s[M]=null,i[M]=null;return w};function yr(e,t,r,n){El.BasePoint.call(this,e,"affine"),t===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Vt(t,16),this.y=new Vt(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)}Lw(yr,El.BasePoint);Un.prototype.point=function(t,r,n){return new yr(this,t,r,n)};Un.prototype.pointFromJSON=function(t,r){return yr.fromJSON(this,t,r)};yr.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var r=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var n=this.curve,s=function(i){return n.point(i.x.redMul(n.endo.beta),i.y)};t.beta=r,r.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(s)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(s)}}}return r}};yr.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]};yr.fromJSON=function(t,r,n){typeof r=="string"&&(r=JSON.parse(r));var s=t.point(r[0],r[1],n);if(!r[2])return s;function i(d){return t.point(d[0],d[1],n)}var u=r[2];return s.precomputed={beta:null,doubles:u.doubles&&{step:u.doubles.step,points:[s].concat(u.doubles.points.map(i))},naf:u.naf&&{wnd:u.naf.wnd,points:[s].concat(u.naf.points.map(i))}},s};yr.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)+">"};yr.prototype.isInfinity=function(){return this.inf};yr.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var r=this.y.redSub(t.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(t.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(t.x),s=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,s)};yr.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),s=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(s),u=i.redSqr().redISub(this.x.redAdd(this.x)),d=i.redMul(this.x.redSub(u)).redISub(this.y);return this.curve.point(u,d)};yr.prototype.getX=function(){return this.x.fromRed()};yr.prototype.getY=function(){return this.y.fromRed()};yr.prototype.mul=function(t){return t=new Vt(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)};yr.prototype.mulAdd=function(t,r,n){var s=[this,r],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(s,i):this.curve._wnafMulAdd(1,s,i,2)};yr.prototype.jmulAdd=function(t,r,n){var s=[this,r],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(s,i,!0):this.curve._wnafMulAdd(1,s,i,2,!0)};yr.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)};yr.prototype.neg=function(t){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,s=function(i){return i.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(s)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(s)}}}return r};yr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t};function Sr(e,t,r,n){El.BasePoint.call(this,e,"jacobian"),t===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Vt(0)):(this.x=new Vt(t,16),this.y=new Vt(r,16),this.z=new Vt(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}Lw(Sr,El.BasePoint);Un.prototype.jpoint=function(t,r,n){return new Sr(this,t,r,n)};Sr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),r=t.redSqr(),n=this.x.redMul(r),s=this.y.redMul(r).redMul(t);return this.curve.point(n,s)};Sr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Sr.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var r=t.z.redSqr(),n=this.z.redSqr(),s=this.x.redMul(r),i=t.x.redMul(n),u=this.y.redMul(r.redMul(t.z)),d=t.y.redMul(n.redMul(this.z)),c=s.redSub(i),b=u.redSub(d);if(c.cmpn(0)===0)return b.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var w=c.redSqr(),M=w.redMul(c),_=s.redMul(w),A=b.redSqr().redIAdd(M).redISub(_).redISub(_),R=b.redMul(_.redISub(A)).redISub(u.redMul(M)),B=this.z.redMul(t.z).redMul(c);return this.curve.jpoint(A,R,B)};Sr.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var r=this.z.redSqr(),n=this.x,s=t.x.redMul(r),i=this.y,u=t.y.redMul(r).redMul(this.z),d=n.redSub(s),c=i.redSub(u);if(d.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var b=d.redSqr(),w=b.redMul(d),M=n.redMul(b),_=c.redSqr().redIAdd(w).redISub(M).redISub(M),A=c.redMul(M.redISub(_)).redISub(i.redMul(w)),R=this.z.redMul(d);return this.curve.jpoint(_,A,R)};Sr.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r<t;r++)n=n.dbl();return n}var s=this.curve.a,i=this.curve.tinv,u=this.x,d=this.y,c=this.z,b=c.redSqr().redSqr(),w=d.redAdd(d);for(r=0;r<t;r++){var M=u.redSqr(),_=w.redSqr(),A=_.redSqr(),R=M.redAdd(M).redIAdd(M).redIAdd(s.redMul(b)),B=u.redMul(_),I=R.redSqr().redISub(B.redAdd(B)),E=B.redISub(I),k=R.redMul(E);k=k.redIAdd(k).redISub(A);var T=w.redMul(c);r+1<t&&(b=b.redMul(A)),u=I,c=T,w=k}return this.curve.jpoint(u,w.redMul(i),c)};Sr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};Sr.prototype._zeroDbl=function(){var t,r,n;if(this.zOne){var s=this.x.redSqr(),i=this.y.redSqr(),u=i.redSqr(),d=this.x.redAdd(i).redSqr().redISub(s).redISub(u);d=d.redIAdd(d);var c=s.redAdd(s).redIAdd(s),b=c.redSqr().redISub(d).redISub(d),w=u.redIAdd(u);w=w.redIAdd(w),w=w.redIAdd(w),t=b,r=c.redMul(d.redISub(b)).redISub(w),n=this.y.redAdd(this.y)}else{var M=this.x.redSqr(),_=this.y.redSqr(),A=_.redSqr(),R=this.x.redAdd(_).redSqr().redISub(M).redISub(A);R=R.redIAdd(R);var B=M.redAdd(M).redIAdd(M),I=B.redSqr(),E=A.redIAdd(A);E=E.redIAdd(E),E=E.redIAdd(E),t=I.redISub(R).redISub(R),r=B.redMul(R.redISub(t)).redISub(E),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(t,r,n)};Sr.prototype._threeDbl=function(){var t,r,n;if(this.zOne){var s=this.x.redSqr(),i=this.y.redSqr(),u=i.redSqr(),d=this.x.redAdd(i).redSqr().redISub(s).redISub(u);d=d.redIAdd(d);var c=s.redAdd(s).redIAdd(s).redIAdd(this.curve.a),b=c.redSqr().redISub(d).redISub(d);t=b;var w=u.redIAdd(u);w=w.redIAdd(w),w=w.redIAdd(w),r=c.redMul(d.redISub(b)).redISub(w),n=this.y.redAdd(this.y)}else{var M=this.z.redSqr(),_=this.y.redSqr(),A=this.x.redMul(_),R=this.x.redSub(M).redMul(this.x.redAdd(M));R=R.redAdd(R).redIAdd(R);var B=A.redIAdd(A);B=B.redIAdd(B);var I=B.redAdd(B);t=R.redSqr().redISub(I),n=this.y.redAdd(this.z).redSqr().redISub(_).redISub(M);var E=_.redSqr();E=E.redIAdd(E),E=E.redIAdd(E),E=E.redIAdd(E),r=R.redMul(B.redISub(t)).redISub(E)}return this.curve.jpoint(t,r,n)};Sr.prototype._dbl=function(){var t=this.curve.a,r=this.x,n=this.y,s=this.z,i=s.redSqr().redSqr(),u=r.redSqr(),d=n.redSqr(),c=u.redAdd(u).redIAdd(u).redIAdd(t.redMul(i)),b=r.redAdd(r);b=b.redIAdd(b);var w=b.redMul(d),M=c.redSqr().redISub(w.redAdd(w)),_=w.redISub(M),A=d.redSqr();A=A.redIAdd(A),A=A.redIAdd(A),A=A.redIAdd(A);var R=c.redMul(_).redISub(A),B=n.redAdd(n).redMul(s);return this.curve.jpoint(M,R,B)};Sr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr(),s=r.redSqr(),i=t.redAdd(t).redIAdd(t),u=i.redSqr(),d=this.x.redAdd(r).redSqr().redISub(t).redISub(s);d=d.redIAdd(d),d=d.redAdd(d).redIAdd(d),d=d.redISub(u);var c=d.redSqr(),b=s.redIAdd(s);b=b.redIAdd(b),b=b.redIAdd(b),b=b.redIAdd(b);var w=i.redIAdd(d).redSqr().redISub(u).redISub(c).redISub(b),M=r.redMul(w);M=M.redIAdd(M),M=M.redIAdd(M);var _=this.x.redMul(c).redISub(M);_=_.redIAdd(_),_=_.redIAdd(_);var A=this.y.redMul(w.redMul(b.redISub(w)).redISub(d.redMul(c)));A=A.redIAdd(A),A=A.redIAdd(A),A=A.redIAdd(A);var R=this.z.redAdd(d).redSqr().redISub(n).redISub(c);return this.curve.jpoint(_,A,R)};Sr.prototype.mul=function(t,r){return t=new Vt(t,r),this.curve._wnafMul(this,t)};Sr.prototype.eq=function(t){if(t.type==="affine")return this.eq(t.toJ());if(this===t)return!0;var r=this.z.redSqr(),n=t.z.redSqr();if(this.x.redMul(n).redISub(t.x.redMul(r)).cmpn(0)!==0)return!1;var s=r.redMul(this.z),i=n.redMul(t.z);return this.y.redMul(i).redISub(t.y.redMul(s)).cmpn(0)===0};Sr.prototype.eqXToP=function(t){var r=this.z.redSqr(),n=t.toRed(this.curve.red).redMul(r);if(this.x.cmp(n)===0)return!0;for(var s=t.clone(),i=this.curve.redN.redMul(r);;){if(s.iadd(this.curve.n),s.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),this.x.cmp(n)===0)return!0}};Sr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"};Sr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var mf=Io,vA=Fe,Hd=Fd,MG=yn;function Sl(e){Hd.call(this,"mont",e),this.a=new mf(e.a,16).toRed(this.red),this.b=new mf(e.b,16).toRed(this.red),this.i4=new mf(4).toRed(this.red).redInvm(),this.two=new mf(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}vA(Sl,Hd);var _G=Sl;Sl.prototype.validate=function(t){var r=t.normalize().x,n=r.redSqr(),s=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),i=s.redSqrt();return i.redSqr().cmp(s)===0};function gr(e,t,r){Hd.BasePoint.call(this,e,"projective"),t===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new mf(t,16),this.z=new mf(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}vA(gr,Hd.BasePoint);Sl.prototype.decodePoint=function(t,r){return this.point(MG.toArray(t,r),1)};Sl.prototype.point=function(t,r){return new gr(this,t,r)};Sl.prototype.pointFromJSON=function(t){return gr.fromJSON(this,t)};gr.prototype.precompute=function(){};gr.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};gr.fromJSON=function(t,r){return new gr(t,r[0],r[1]||t.one)};gr.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)+">"};gr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};gr.prototype.dbl=function(){var t=this.x.redAdd(this.z),r=t.redSqr(),n=this.x.redSub(this.z),s=n.redSqr(),i=r.redSub(s),u=r.redMul(s),d=i.redMul(s.redAdd(this.curve.a24.redMul(i)));return this.curve.point(u,d)};gr.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};gr.prototype.diffAdd=function(t,r){var n=this.x.redAdd(this.z),s=this.x.redSub(this.z),i=t.x.redAdd(t.z),u=t.x.redSub(t.z),d=u.redMul(n),c=i.redMul(s),b=r.z.redMul(d.redAdd(c).redSqr()),w=r.x.redMul(d.redISub(c).redSqr());return this.curve.point(b,w)};gr.prototype.mul=function(t){for(var r=t.clone(),n=this,s=this.curve.point(null,null),i=this,u=[];r.cmpn(0)!==0;r.iushrn(1))u.push(r.andln(1));for(var d=u.length-1;d>=0;d--)u[d]===0?(n=n.diffAdd(s,i),s=s.dbl()):(s=n.diffAdd(s,i),n=n.dbl());return s};gr.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};gr.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};gr.prototype.eq=function(t){return this.getX().cmp(t.getX())===0};gr.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};gr.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var EG=yn,ao=Io,gA=Fe,zd=Fd,SG=EG.assert;function Li(e){this.twisted=(e.a|0)!==1,this.mOneA=this.twisted&&(e.a|0)===-1,this.extended=this.mOneA,zd.call(this,"edwards",e),this.a=new ao(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new ao(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new ao(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),SG(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(e.c|0)===1}gA(Li,zd);var AG=Li;Li.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)};Li.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)};Li.prototype.jpoint=function(t,r,n,s){return this.point(t,r,n,s)};Li.prototype.pointFromX=function(t,r){t=new ao(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr(),s=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),u=s.redMul(i.redInvm()),d=u.redSqrt();if(d.redSqr().redSub(u).cmp(this.zero)!==0)throw new Error("invalid point");var c=d.fromRed().isOdd();return(r&&!c||!r&&c)&&(d=d.redNeg()),this.point(t,d)};Li.prototype.pointFromY=function(t,r){t=new ao(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr(),s=n.redSub(this.c2),i=n.redMul(this.d).redMul(this.c2).redSub(this.a),u=s.redMul(i.redInvm());if(u.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,t)}var d=u.redSqrt();if(d.redSqr().redSub(u).cmp(this.zero)!==0)throw new Error("invalid point");return d.fromRed().isOdd()!==r&&(d=d.redNeg()),this.point(d,t)};Li.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var r=t.x.redSqr(),n=t.y.redSqr(),s=r.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return s.cmp(i)===0};function Tt(e,t,r,n,s){zd.BasePoint.call(this,e,"projective"),t===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new ao(t,16),this.y=new ao(r,16),this.z=n?new ao(n,16):this.curve.one,this.t=s&&new ao(s,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()))))}gA(Tt,zd.BasePoint);Li.prototype.pointFromJSON=function(t){return Tt.fromJSON(this,t)};Li.prototype.point=function(t,r,n,s){return new Tt(this,t,r,n,s)};Tt.fromJSON=function(t,r){return new Tt(t,r[0],r[1],r[2])};Tt.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)+">"};Tt.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Tt.prototype._extDbl=function(){var t=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var s=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(r),u=s.redAdd(r),d=u.redSub(n),c=s.redSub(r),b=i.redMul(d),w=u.redMul(c),M=i.redMul(c),_=d.redMul(u);return this.curve.point(b,w,_,M)};Tt.prototype._projDbl=function(){var t=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),s,i,u,d,c,b;if(this.curve.twisted){d=this.curve._mulA(r);var w=d.redAdd(n);this.zOne?(s=t.redSub(r).redSub(n).redMul(w.redSub(this.curve.two)),i=w.redMul(d.redSub(n)),u=w.redSqr().redSub(w).redSub(w)):(c=this.z.redSqr(),b=w.redSub(c).redISub(c),s=t.redSub(r).redISub(n).redMul(b),i=w.redMul(d.redSub(n)),u=w.redMul(b))}else d=r.redAdd(n),c=this.curve._mulC(this.z).redSqr(),b=d.redSub(c).redSub(c),s=this.curve._mulC(t.redISub(d)).redMul(b),i=this.curve._mulC(d).redMul(r.redISub(n)),u=d.redMul(b);return this.curve.point(s,i,u)};Tt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Tt.prototype._extAdd=function(t){var r=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),s=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),u=n.redSub(r),d=i.redSub(s),c=i.redAdd(s),b=n.redAdd(r),w=u.redMul(d),M=c.redMul(b),_=u.redMul(b),A=d.redMul(c);return this.curve.point(w,M,A,_)};Tt.prototype._projAdd=function(t){var r=this.z.redMul(t.z),n=r.redSqr(),s=this.x.redMul(t.x),i=this.y.redMul(t.y),u=this.curve.d.redMul(s).redMul(i),d=n.redSub(u),c=n.redAdd(u),b=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(s).redISub(i),w=r.redMul(d).redMul(b),M,_;return this.curve.twisted?(M=r.redMul(c).redMul(i.redSub(this.curve._mulA(s))),_=d.redMul(c)):(M=r.redMul(c).redMul(i.redSub(s)),_=this.curve._mulC(d).redMul(c)),this.curve.point(w,M,_)};Tt.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)};Tt.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)};Tt.prototype.mulAdd=function(t,r,n){return this.curve._wnafMulAdd(1,[this,r],[t,n],2,!1)};Tt.prototype.jmulAdd=function(t,r,n){return this.curve._wnafMulAdd(1,[this,r],[t,n],2,!0)};Tt.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this};Tt.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Tt.prototype.getX=function(){return this.normalize(),this.x.fromRed()};Tt.prototype.getY=function(){return this.normalize(),this.y.fromRed()};Tt.prototype.eq=function(t){return this===t||this.getX().cmp(t.getX())===0&&this.getY().cmp(t.getY())===0};Tt.prototype.eqXToP=function(t){var r=t.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=t.clone(),s=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(s),this.x.cmp(r)===0)return!0}};Tt.prototype.toP=Tt.prototype.normalize;Tt.prototype.mixedAdd=Tt.prototype.add;(function(e){var t=e;t.base=Fd,t.short=xG,t.mont=_G,t.edwards=AG})(Pw);var Wd={},Vd={},ot={},kG=Pn,BG=Fe;ot.inherits=BG;function RG(e,t){return(e.charCodeAt(t)&64512)!==55296||t<0||t+1>=e.length?!1:(e.charCodeAt(t+1)&64512)===56320}function $G(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if(typeof e=="string")if(t){if(t==="hex")for(e=e.replace(/[^a-z0-9]+/ig,""),e.length%2!==0&&(e="0"+e),s=0;s<e.length;s+=2)r.push(parseInt(e[s]+e[s+1],16))}else for(var n=0,s=0;s<e.length;s++){var i=e.charCodeAt(s);i<128?r[n++]=i:i<2048?(r[n++]=i>>6|192,r[n++]=i&63|128):RG(e,s)?(i=65536+((i&1023)<<10)+(e.charCodeAt(++s)&1023),r[n++]=i>>18|240,r[n++]=i>>12&63|128,r[n++]=i>>6&63|128,r[n++]=i&63|128):(r[n++]=i>>12|224,r[n++]=i>>6&63|128,r[n++]=i&63|128)}else for(s=0;s<e.length;s++)r[s]=e[s]|0;return r}ot.toArray=$G;function NG(e){for(var t="",r=0;r<e.length;r++)t+=mA(e[r].toString(16));return t}ot.toHex=NG;function yA(e){var t=e>>>24|e>>>8&65280|e<<8&16711680|(e&255)<<24;return t>>>0}ot.htonl=yA;function TG(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];t==="little"&&(s=yA(s)),r+=wA(s.toString(16))}return r}ot.toHex32=TG;function mA(e){return e.length===1?"0"+e:e}ot.zero2=mA;function wA(e){return e.length===7?"0"+e:e.length===6?"00"+e:e.length===5?"000"+e:e.length===4?"0000"+e:e.length===3?"00000"+e:e.length===2?"000000"+e:e.length===1?"0000000"+e:e}ot.zero8=wA;function IG(e,t,r,n){var s=r-t;kG(s%4===0);for(var i=new Array(s/4),u=0,d=t;u<i.length;u++,d+=4){var c;n==="big"?c=e[d]<<24|e[d+1]<<16|e[d+2]<<8|e[d+3]:c=e[d+3]<<24|e[d+2]<<16|e[d+1]<<8|e[d],i[u]=c>>>0}return i}ot.join32=IG;function CG(e,t){for(var r=new Array(e.length*4),n=0,s=0;n<e.length;n++,s+=4){var i=e[n];t==="big"?(r[s]=i>>>24,r[s+1]=i>>>16&255,r[s+2]=i>>>8&255,r[s+3]=i&255):(r[s+3]=i>>>24,r[s+2]=i>>>16&255,r[s+1]=i>>>8&255,r[s]=i&255)}return r}ot.split32=CG;function PG(e,t){return e>>>t|e<<32-t}ot.rotr32=PG;function LG(e,t){return e<<t|e>>>32-t}ot.rotl32=LG;function OG(e,t){return e+t>>>0}ot.sum32=OG;function UG(e,t,r){return e+t+r>>>0}ot.sum32_3=UG;function jG(e,t,r,n){return e+t+r+n>>>0}ot.sum32_4=jG;function DG(e,t,r,n,s){return e+t+r+n+s>>>0}ot.sum32_5=DG;function qG(e,t,r,n){var s=e[t],i=e[t+1],u=n+i>>>0,d=(u<n?1:0)+r+s;e[t]=d>>>0,e[t+1]=u}ot.sum64=qG;function FG(e,t,r,n){var s=t+n>>>0,i=(s<t?1:0)+e+r;return i>>>0}ot.sum64_hi=FG;function HG(e,t,r,n){var s=t+n;return s>>>0}ot.sum64_lo=HG;function zG(e,t,r,n,s,i,u,d){var c=0,b=t;b=b+n>>>0,c+=b<t?1:0,b=b+i>>>0,c+=b<i?1:0,b=b+d>>>0,c+=b<d?1:0;var w=e+r+s+u+c;return w>>>0}ot.sum64_4_hi=zG;function WG(e,t,r,n,s,i,u,d){var c=t+n+i+d;return c>>>0}ot.sum64_4_lo=WG;function VG(e,t,r,n,s,i,u,d,c,b){var w=0,M=t;M=M+n>>>0,w+=M<t?1:0,M=M+i>>>0,w+=M<i?1:0,M=M+d>>>0,w+=M<d?1:0,M=M+b>>>0,w+=M<b?1:0;var _=e+r+s+u+c+w;return _>>>0}ot.sum64_5_hi=VG;function KG(e,t,r,n,s,i,u,d,c,b){var w=t+n+i+d+b;return w>>>0}ot.sum64_5_lo=KG;function ZG(e,t,r){var n=t<<32-r|e>>>r;return n>>>0}ot.rotr64_hi=ZG;function GG(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}ot.rotr64_lo=GG;function JG(e,t,r){return e>>>r}ot.shr64_hi=JG;function YG(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}ot.shr64_lo=YG;var Al={},Q4=ot,XG=Pn;function Kd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Al.BlockHash=Kd;Kd.prototype.update=function(t,r){if(t=Q4.toArray(t,r),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var n=t.length%this._delta8;this.pending=t.slice(t.length-n,t.length),this.pending.length===0&&(this.pending=null),t=Q4.join32(t,0,t.length-n,this.endian);for(var s=0;s<t.length;s+=this._delta32)this._update(t,s,s+this._delta32)}return this};Kd.prototype.digest=function(t){return this.update(this._pad()),XG(this.pending===null),this._digest(t)};Kd.prototype._pad=function(){var t=this.pendingTotal,r=this._delta8,n=r-(t+this.padLength)%r,s=new Array(n+this.padLength);s[0]=128;for(var i=1;i<n;i++)s[i]=0;if(t<<=3,this.endian==="big"){for(var u=8;u<this.padLength;u++)s[i++]=0;s[i++]=0,s[i++]=0,s[i++]=0,s[i++]=0,s[i++]=t>>>24&255,s[i++]=t>>>16&255,s[i++]=t>>>8&255,s[i++]=t&255}else for(s[i++]=t&255,s[i++]=t>>>8&255,s[i++]=t>>>16&255,s[i++]=t>>>24&255,s[i++]=0,s[i++]=0,s[i++]=0,s[i++]=0,u=8;u<this.padLength;u++)s[i++]=0;return s};var kl={},Oi={},QG=ot,Ri=QG.rotr32;function eJ(e,t,r,n){if(e===0)return bA(t,r,n);if(e===1||e===3)return MA(t,r,n);if(e===2)return xA(t,r,n)}Oi.ft_1=eJ;function bA(e,t,r){return e&t^~e&r}Oi.ch32=bA;function xA(e,t,r){return e&t^e&r^t&r}Oi.maj32=xA;function MA(e,t,r){return e^t^r}Oi.p32=MA;function tJ(e){return Ri(e,2)^Ri(e,13)^Ri(e,22)}Oi.s0_256=tJ;function rJ(e){return Ri(e,6)^Ri(e,11)^Ri(e,25)}Oi.s1_256=rJ;function nJ(e){return Ri(e,7)^Ri(e,18)^e>>>3}Oi.g0_256=nJ;function iJ(e){return Ri(e,17)^Ri(e,19)^e>>>10}Oi.g1_256=iJ;var tl=ot,oJ=Al,sJ=Oi,ov=tl.rotl32,Yl=tl.sum32,aJ=tl.sum32_5,fJ=sJ.ft_1,_A=oJ.BlockHash,lJ=[1518500249,1859775393,2400959708,3395469782];function Ii(){if(!(this instanceof Ii))return new Ii;_A.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}tl.inherits(Ii,_A);var uJ=Ii;Ii.blockSize=512;Ii.outSize=160;Ii.hmacStrength=80;Ii.padLength=64;Ii.prototype._update=function(t,r){for(var n=this.W,s=0;s<16;s++)n[s]=t[r+s];for(;s<n.length;s++)n[s]=ov(n[s-3]^n[s-8]^n[s-14]^n[s-16],1);var i=this.h[0],u=this.h[1],d=this.h[2],c=this.h[3],b=this.h[4];for(s=0;s<n.length;s++){var w=~~(s/20),M=aJ(ov(i,5),fJ(w,u,d,c),b,n[s],lJ[w]);b=c,c=d,d=ov(u,30),u=i,i=M}this.h[0]=Yl(this.h[0],i),this.h[1]=Yl(this.h[1],u),this.h[2]=Yl(this.h[2],d),this.h[3]=Yl(this.h[3],c),this.h[4]=Yl(this.h[4],b)};Ii.prototype._digest=function(t){return t==="hex"?tl.toHex32(this.h,"big"):tl.split32(this.h,"big")};var rl=ot,hJ=Al,Bl=Oi,cJ=Pn,qn=rl.sum32,dJ=rl.sum32_4,pJ=rl.sum32_5,vJ=Bl.ch32,gJ=Bl.maj32,yJ=Bl.s0_256,mJ=Bl.s1_256,wJ=Bl.g0_256,bJ=Bl.g1_256,EA=hJ.BlockHash,xJ=[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 Ci(){if(!(this instanceof Ci))return new Ci;EA.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=xJ,this.W=new Array(64)}rl.inherits(Ci,EA);var SA=Ci;Ci.blockSize=512;Ci.outSize=256;Ci.hmacStrength=192;Ci.padLength=64;Ci.prototype._update=function(t,r){for(var n=this.W,s=0;s<16;s++)n[s]=t[r+s];for(;s<n.length;s++)n[s]=dJ(bJ(n[s-2]),n[s-7],wJ(n[s-15]),n[s-16]);var i=this.h[0],u=this.h[1],d=this.h[2],c=this.h[3],b=this.h[4],w=this.h[5],M=this.h[6],_=this.h[7];for(cJ(this.k.length===n.length),s=0;s<n.length;s++){var A=pJ(_,mJ(b),vJ(b,w,M),this.k[s],n[s]),R=qn(yJ(i),gJ(i,u,d));_=M,M=w,w=b,b=qn(c,A),c=d,d=u,u=i,i=qn(A,R)}this.h[0]=qn(this.h[0],i),this.h[1]=qn(this.h[1],u),this.h[2]=qn(this.h[2],d),this.h[3]=qn(this.h[3],c),this.h[4]=qn(this.h[4],b),this.h[5]=qn(this.h[5],w),this.h[6]=qn(this.h[6],M),this.h[7]=qn(this.h[7],_)};Ci.prototype._digest=function(t){return t==="hex"?rl.toHex32(this.h,"big"):rl.split32(this.h,"big")};var Ry=ot,AA=SA;function Mo(){if(!(this instanceof Mo))return new Mo;AA.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Ry.inherits(Mo,AA);var MJ=Mo;Mo.blockSize=512;Mo.outSize=224;Mo.hmacStrength=192;Mo.padLength=64;Mo.prototype._digest=function(t){return t==="hex"?Ry.toHex32(this.h.slice(0,7),"big"):Ry.split32(this.h.slice(0,7),"big")};var nn=ot,_J=Al,EJ=Pn,$i=nn.rotr64_hi,Ni=nn.rotr64_lo,kA=nn.shr64_hi,BA=nn.shr64_lo,Vo=nn.sum64,sv=nn.sum64_hi,av=nn.sum64_lo,SJ=nn.sum64_4_hi,AJ=nn.sum64_4_lo,kJ=nn.sum64_5_hi,BJ=nn.sum64_5_lo,RA=_J.BlockHash,RJ=[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 Qn(){if(!(this instanceof Qn))return new Qn;RA.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=RJ,this.W=new Array(160)}nn.inherits(Qn,RA);var $A=Qn;Qn.blockSize=1024;Qn.outSize=512;Qn.hmacStrength=192;Qn.padLength=128;Qn.prototype._prepareBlock=function(t,r){for(var n=this.W,s=0;s<32;s++)n[s]=t[r+s];for(;s<n.length;s+=2){var i=DJ(n[s-4],n[s-3]),u=qJ(n[s-4],n[s-3]),d=n[s-14],c=n[s-13],b=UJ(n[s-30],n[s-29]),w=jJ(n[s-30],n[s-29]),M=n[s-32],_=n[s-31];n[s]=SJ(i,u,d,c,b,w,M,_),n[s+1]=AJ(i,u,d,c,b,w,M,_)}};Qn.prototype._update=function(t,r){this._prepareBlock(t,r);var n=this.W,s=this.h[0],i=this.h[1],u=this.h[2],d=this.h[3],c=this.h[4],b=this.h[5],w=this.h[6],M=this.h[7],_=this.h[8],A=this.h[9],R=this.h[10],B=this.h[11],I=this.h[12],E=this.h[13],k=this.h[14],T=this.h[15];EJ(this.k.length===n.length);for(var L=0;L<n.length;L+=2){var q=k,z=T,J=LJ(_,A),F=OJ(_,A),X=$J(_,A,R,B,I),ee=NJ(_,A,R,B,I,E),x=this.k[L],o=this.k[L+1],f=n[L],l=n[L+1],h=kJ(q,z,J,F,X,ee,x,o,f,l),v=BJ(q,z,J,F,X,ee,x,o,f,l);q=CJ(s,i),z=PJ(s,i),J=TJ(s,i,u,d,c),F=IJ(s,i,u,d,c,b);var y=sv(q,z,J,F),m=av(q,z,J,F);k=I,T=E,I=R,E=B,R=_,B=A,_=sv(w,M,h,v),A=av(M,M,h,v),w=c,M=b,c=u,b=d,u=s,d=i,s=sv(h,v,y,m),i=av(h,v,y,m)}Vo(this.h,0,s,i),Vo(this.h,2,u,d),Vo(this.h,4,c,b),Vo(this.h,6,w,M),Vo(this.h,8,_,A),Vo(this.h,10,R,B),Vo(this.h,12,I,E),Vo(this.h,14,k,T)};Qn.prototype._digest=function(t){return t==="hex"?nn.toHex32(this.h,"big"):nn.split32(this.h,"big")};function $J(e,t,r,n,s){var i=e&r^~e&s;return i<0&&(i+=4294967296),i}function NJ(e,t,r,n,s,i){var u=t&n^~t&i;return u<0&&(u+=4294967296),u}function TJ(e,t,r,n,s){var i=e&r^e&s^r&s;return i<0&&(i+=4294967296),i}function IJ(e,t,r,n,s,i){var u=t&n^t&i^n&i;return u<0&&(u+=4294967296),u}function CJ(e,t){var r=$i(e,t,28),n=$i(t,e,2),s=$i(t,e,7),i=r^n^s;return i<0&&(i+=4294967296),i}function PJ(e,t){var r=Ni(e,t,28),n=Ni(t,e,2),s=Ni(t,e,7),i=r^n^s;return i<0&&(i+=4294967296),i}function LJ(e,t){var r=$i(e,t,14),n=$i(e,t,18),s=$i(t,e,9),i=r^n^s;return i<0&&(i+=4294967296),i}function OJ(e,t){var r=Ni(e,t,14),n=Ni(e,t,18),s=Ni(t,e,9),i=r^n^s;return i<0&&(i+=4294967296),i}function UJ(e,t){var r=$i(e,t,1),n=$i(e,t,8),s=kA(e,t,7),i=r^n^s;return i<0&&(i+=4294967296),i}function jJ(e,t){var r=Ni(e,t,1),n=Ni(e,t,8),s=BA(e,t,7),i=r^n^s;return i<0&&(i+=4294967296),i}function DJ(e,t){var r=$i(e,t,19),n=$i(t,e,29),s=kA(e,t,6),i=r^n^s;return i<0&&(i+=4294967296),i}function qJ(e,t){var r=Ni(e,t,19),n=Ni(t,e,29),s=BA(e,t,6),i=r^n^s;return i<0&&(i+=4294967296),i}var $y=ot,NA=$A;function _o(){if(!(this instanceof _o))return new _o;NA.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}$y.inherits(_o,NA);var FJ=_o;_o.blockSize=1024;_o.outSize=384;_o.hmacStrength=192;_o.padLength=128;_o.prototype._digest=function(t){return t==="hex"?$y.toHex32(this.h.slice(0,12),"big"):$y.split32(this.h.slice(0,12),"big")};kl.sha1=uJ;kl.sha224=MJ;kl.sha256=SA;kl.sha384=FJ;kl.sha512=$A;var TA={},Ca=ot,HJ=Al,Yh=Ca.rotl32,ex=Ca.sum32,Xl=Ca.sum32_3,tx=Ca.sum32_4,IA=HJ.BlockHash;function Pi(){if(!(this instanceof Pi))return new Pi;IA.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Ca.inherits(Pi,IA);TA.ripemd160=Pi;Pi.blockSize=512;Pi.outSize=160;Pi.hmacStrength=192;Pi.padLength=64;Pi.prototype._update=function(t,r){for(var n=this.h[0],s=this.h[1],i=this.h[2],u=this.h[3],d=this.h[4],c=n,b=s,w=i,M=u,_=d,A=0;A<80;A++){var R=ex(Yh(tx(n,rx(A,s,i,u),t[VJ[A]+r],zJ(A)),ZJ[A]),d);n=d,d=u,u=Yh(i,10),i=s,s=R,R=ex(Yh(tx(c,rx(79-A,b,w,M),t[KJ[A]+r],WJ(A)),GJ[A]),_),c=_,_=M,M=Yh(w,10),w=b,b=R}R=Xl(this.h[1],i,M),this.h[1]=Xl(this.h[2],u,_),this.h[2]=Xl(this.h[3],d,c),this.h[3]=Xl(this.h[4],n,b),this.h[4]=Xl(this.h[0],s,w),this.h[0]=R};Pi.prototype._digest=function(t){return t==="hex"?Ca.toHex32(this.h,"little"):Ca.split32(this.h,"little")};function rx(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function zJ(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function WJ(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}var VJ=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],KJ=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],ZJ=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],GJ=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],JJ=ot,YJ=Pn;function nl(e,t,r){if(!(this instanceof nl))return new nl(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(JJ.toArray(t,r))}var XJ=nl;nl.prototype._init=function(t){t.length>this.blockSize&&(t=new this.Hash().update(t).digest()),YJ(t.length<=this.blockSize);for(var r=t.length;r<this.blockSize;r++)t.push(0);for(r=0;r<t.length;r++)t[r]^=54;for(this.inner=new this.Hash().update(t),r=0;r<t.length;r++)t[r]^=106;this.outer=new this.Hash().update(t)};nl.prototype.update=function(t,r){return this.inner.update(t,r),this};nl.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)};(function(e){var t=e;t.utils=ot,t.common=Al,t.sha=kl,t.ripemd=TA,t.hmac=XJ,t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160})(Vd);var fv,nx;function QJ(){return nx||(nx=1,fv={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"]]}}),fv}(function(e){var t=e,r=Vd,n=Pw,s=yn,i=s.assert;function u(b){b.type==="short"?this.curve=new n.short(b):b.type==="edwards"?this.curve=new n.edwards(b):this.curve=new n.mont(b),this.g=this.curve.g,this.n=this.curve.n,this.hash=b.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}t.PresetCurve=u;function d(b,w){Object.defineProperty(t,b,{configurable:!0,enumerable:!0,get:function(){var M=new u(w);return Object.defineProperty(t,b,{configurable:!0,enumerable:!0,value:M}),M}})}d("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),d("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),d("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),d("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),d("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),d("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),d("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var c;try{c=QJ()}catch{c=void 0}d("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})})(Wd);var eY=Vd,wa=Cw,CA=Pn;function Ss(e){if(!(this instanceof Ss))return new Ss(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=wa.toArray(e.entropy,e.entropyEnc||"hex"),r=wa.toArray(e.nonce,e.nonceEnc||"hex"),n=wa.toArray(e.pers,e.persEnc||"hex");CA(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var tY=Ss;Ss.prototype._init=function(t,r,n){var s=t.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(s),this._reseed=1,this.reseedInterval=281474976710656};Ss.prototype._hmac=function(){return new eY.hmac(this.hash,this.K)};Ss.prototype._update=function(t){var r=this._hmac().update(this.V).update([0]);t&&(r=r.update(t)),this.K=r.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())};Ss.prototype.reseed=function(t,r,n,s){typeof r!="string"&&(s=n,n=r,r=null),t=wa.toArray(t,r),n=wa.toArray(n,s),CA(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1};Ss.prototype.generate=function(t,r,n,s){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(s=n,n=r,r=null),n&&(n=wa.toArray(n,s||"hex"),this._update(n));for(var i=[];i.length<t;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var u=i.slice(0,t);return this._update(n),this._reseed++,wa.encode(u,r)};var rY=Io,nY=yn,Ny=nY.assert;function Dr(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 iY=Dr;Dr.fromPublic=function(t,r,n){return r instanceof Dr?r:new Dr(t,{pub:r,pubEnc:n})};Dr.fromPrivate=function(t,r,n){return r instanceof Dr?r:new Dr(t,{priv:r,privEnc:n})};Dr.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.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"}};Dr.prototype.getPublic=function(t,r){return typeof t=="string"&&(r=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,t):this.pub};Dr.prototype.getPrivate=function(t){return t==="hex"?this.priv.toString(16,2):this.priv};Dr.prototype._importPrivate=function(t,r){this.priv=new rY(t,r||16),this.priv=this.priv.umod(this.ec.curve.n)};Dr.prototype._importPublic=function(t,r){if(t.x||t.y){this.ec.curve.type==="mont"?Ny(t.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Ny(t.x&&t.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(t.x,t.y);return}this.pub=this.ec.curve.decodePoint(t,r)};Dr.prototype.derive=function(t){return t.validate()||Ny(t.validate(),"public point not validated"),t.mul(this.priv).getX()};Dr.prototype.sign=function(t,r,n){return this.ec.sign(t,this,r,n)};Dr.prototype.verify=function(t,r,n){return this.ec.verify(t,r,this,void 0,n)};Dr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var _0=Io,Ow=yn,oY=Ow.assert;function Zd(e,t){if(e instanceof Zd)return e;this._importDER(e,t)||(oY(e.r&&e.s,"Signature without r or s"),this.r=new _0(e.r,16),this.s=new _0(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var sY=Zd;function aY(){this.place=0}function lv(e,t){var r=e[t.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||e[t.place]===0)return!1;for(var s=0,i=0,u=t.place;i<n;i++,u++)s<<=8,s|=e[u],s>>>=0;return s<=127?!1:(t.place=u,s)}function ix(e){for(var t=0,r=e.length-1;!e[t]&&!(e[t+1]&128)&&t<r;)t++;return t===0?e:e.slice(t)}Zd.prototype._importDER=function(t,r){t=Ow.toArray(t,r);var n=new aY;if(t[n.place++]!==48)return!1;var s=lv(t,n);if(s===!1||s+n.place!==t.length||t[n.place++]!==2)return!1;var i=lv(t,n);if(i===!1||t[n.place]&128)return!1;var u=t.slice(n.place,i+n.place);if(n.place+=i,t[n.place++]!==2)return!1;var d=lv(t,n);if(d===!1||t.length!==d+n.place||t[n.place]&128)return!1;var c=t.slice(n.place,d+n.place);if(u[0]===0)if(u[1]&128)u=u.slice(1);else return!1;if(c[0]===0)if(c[1]&128)c=c.slice(1);else return!1;return this.r=new _0(u),this.s=new _0(c),this.recoveryParam=null,!0};function uv(e,t){if(t<128){e.push(t);return}var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(r|128);--r;)e.push(t>>>(r<<3)&255);e.push(t)}Zd.prototype.toDER=function(t){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=ix(r),n=ix(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var s=[2];uv(s,r.length),s=s.concat(r),s.push(2),uv(s,n.length);var i=s.concat(n),u=[48];return uv(u,i.length),u=u.concat(i),Ow.encode(u,t)};var hv,ox;function fY(){if(ox)return hv;ox=1;var e=Io,t=tY,r=yn,n=Wd,s=Bw(),i=r.assert,u=iY,d=sY;function c(b){if(!(this instanceof c))return new c(b);typeof b=="string"&&(i(Object.prototype.hasOwnProperty.call(n,b),"Unknown curve "+b),b=n[b]),b instanceof n.PresetCurve&&(b={curve:b}),this.curve=b.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=b.curve.g,this.g.precompute(b.curve.n.bitLength()+1),this.hash=b.hash||b.curve.hash}return hv=c,c.prototype.keyPair=function(w){return new u(this,w)},c.prototype.keyFromPrivate=function(w,M){return u.fromPrivate(this,w,M)},c.prototype.keyFromPublic=function(w,M){return u.fromPublic(this,w,M)},c.prototype.genKeyPair=function(w){w||(w={});for(var M=new t({hash:this.hash,pers:w.pers,persEnc:w.persEnc||"utf8",entropy:w.entropy||s(this.hash.hmacStrength),entropyEnc:w.entropy&&w.entropyEnc||"utf8",nonce:this.n.toArray()}),_=this.n.byteLength(),A=this.n.sub(new e(2));;){var R=new e(M.generate(_));if(!(R.cmp(A)>0))return R.iaddn(1),this.keyFromPrivate(R)}},c.prototype._truncateToN=function(w,M,_){var A;if(e.isBN(w)||typeof w=="number")w=new e(w,16),A=w.byteLength();else if(typeof w=="object")A=w.length,w=new e(w,16);else{var R=w.toString();A=R.length+1>>>1,w=new e(R,16)}typeof _!="number"&&(_=A*8);var B=_-this.n.bitLength();return B>0&&(w=w.ushrn(B)),!M&&w.cmp(this.n)>=0?w.sub(this.n):w},c.prototype.sign=function(w,M,_,A){if(typeof _=="object"&&(A=_,_=null),A||(A={}),typeof w!="string"&&typeof w!="number"&&!e.isBN(w)){i(typeof w=="object"&&w&&typeof w.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),i(w.length>>>0===w.length);for(var R=0;R<w.length;R++)i((w[R]&255)===w[R])}M=this.keyFromPrivate(M,_),w=this._truncateToN(w,!1,A.msgBitLength),i(!w.isNeg(),"Can not sign a negative message");var B=this.n.byteLength(),I=M.getPrivate().toArray("be",B),E=w.toArray("be",B);i(new e(E).eq(w),"Can not sign message");for(var k=new t({hash:this.hash,entropy:I,nonce:E,pers:A.pers,persEnc:A.persEnc||"utf8"}),T=this.n.sub(new e(1)),L=0;;L++){var q=A.k?A.k(L):new e(k.generate(this.n.byteLength()));if(q=this._truncateToN(q,!0),!(q.cmpn(1)<=0||q.cmp(T)>=0)){var z=this.g.mul(q);if(!z.isInfinity()){var J=z.getX(),F=J.umod(this.n);if(F.cmpn(0)!==0){var X=q.invm(this.n).mul(F.mul(M.getPrivate()).iadd(w));if(X=X.umod(this.n),X.cmpn(0)!==0){var ee=(z.getY().isOdd()?1:0)|(J.cmp(F)!==0?2:0);return A.canonical&&X.cmp(this.nh)>0&&(X=this.n.sub(X),ee^=1),new d({r:F,s:X,recoveryParam:ee})}}}}}},c.prototype.verify=function(w,M,_,A,R){R||(R={}),w=this._truncateToN(w,!1,R.msgBitLength),_=this.keyFromPublic(_,A),M=new d(M,"hex");var B=M.r,I=M.s;if(B.cmpn(1)<0||B.cmp(this.n)>=0||I.cmpn(1)<0||I.cmp(this.n)>=0)return!1;var E=I.invm(this.n),k=E.mul(w).umod(this.n),T=E.mul(B).umod(this.n),L;return this.curve._maxwellTrick?(L=this.g.jmulAdd(k,_.getPublic(),T),L.isInfinity()?!1:L.eqXToP(B)):(L=this.g.mulAdd(k,_.getPublic(),T),L.isInfinity()?!1:L.getX().umod(this.n).cmp(B)===0)},c.prototype.recoverPubKey=function(b,w,M,_){i((3&M)===M,"The recovery param is more than two bits"),w=new d(w,_);var A=this.n,R=new e(b),B=w.r,I=w.s,E=M&1,k=M>>1;if(B.cmp(this.curve.p.umod(this.curve.n))>=0&&k)throw new Error("Unable to find sencond key candinate");k?B=this.curve.pointFromX(B.add(this.curve.n),E):B=this.curve.pointFromX(B,E);var T=w.r.invm(A),L=A.sub(R).mul(T).umod(A),q=I.mul(T).umod(A);return this.g.mulAdd(L,B,q)},c.prototype.getKeyRecoveryParam=function(b,w,M,_){if(w=new d(w,_),w.recoveryParam!==null)return w.recoveryParam;for(var A=0;A<4;A++){var R;try{R=this.recoverPubKey(b,w,A)}catch{continue}if(R.eq(M))return A}throw new Error("Unable to find valid recovery factor")},hv}var yh=yn,PA=yh.assert,sx=yh.parseBytes,Rl=yh.cachedProperty;function vr(e,t){this.eddsa=e,this._secret=sx(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=sx(t.pub)}vr.fromPublic=function(t,r){return r instanceof vr?r:new vr(t,{pub:r})};vr.fromSecret=function(t,r){return r instanceof vr?r:new vr(t,{secret:r})};vr.prototype.secret=function(){return this._secret};Rl(vr,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});Rl(vr,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});Rl(vr,"privBytes",function(){var t=this.eddsa,r=this.hash(),n=t.encodingLength-1,s=r.slice(0,t.encodingLength);return s[0]&=248,s[n]&=127,s[n]|=64,s});Rl(vr,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});Rl(vr,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});Rl(vr,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});vr.prototype.sign=function(t){return PA(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)};vr.prototype.verify=function(t,r){return this.eddsa.verify(t,r,this)};vr.prototype.getSecret=function(t){return PA(this._secret,"KeyPair is public only"),yh.encode(this.secret(),t)};vr.prototype.getPublic=function(t){return yh.encode(this.pubBytes(),t)};var lY=vr,uY=Io,Gd=yn,ax=Gd.assert,Jd=Gd.cachedProperty,hY=Gd.parseBytes;function Wa(e,t){this.eddsa=e,typeof t!="object"&&(t=hY(t)),Array.isArray(t)&&(ax(t.length===e.encodingLength*2,"Signature has invalid size"),t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),ax(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof uY&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}Jd(Wa,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});Jd(Wa,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});Jd(Wa,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});Jd(Wa,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});Wa.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};Wa.prototype.toHex=function(){return Gd.encode(this.toBytes(),"hex").toUpperCase()};var cY=Wa,dY=Vd,pY=Wd,il=yn,vY=il.assert,LA=il.parseBytes,OA=lY,fx=cY;function on(e){if(vY(e==="ed25519","only tested with ed25519 so far"),!(this instanceof on))return new on(e);e=pY[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=dY.sha512}var gY=on;on.prototype.sign=function(t,r){t=LA(t);var n=this.keyFromSecret(r),s=this.hashInt(n.messagePrefix(),t),i=this.g.mul(s),u=this.encodePoint(i),d=this.hashInt(u,n.pubBytes(),t).mul(n.priv()),c=s.add(d).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:u})};on.prototype.verify=function(t,r,n){if(t=LA(t),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var s=this.keyFromPublic(n),i=this.hashInt(r.Rencoded(),s.pubBytes(),t),u=this.g.mul(r.S()),d=r.R().add(s.pub().mul(i));return d.eq(u)};on.prototype.hashInt=function(){for(var t=this.hash(),r=0;r<arguments.length;r++)t.update(arguments[r]);return il.intFromLE(t.digest()).umod(this.curve.n)};on.prototype.keyFromPublic=function(t){return OA.fromPublic(this,t)};on.prototype.keyFromSecret=function(t){return OA.fromSecret(this,t)};on.prototype.makeSignature=function(t){return t instanceof fx?t:new fx(this,t)};on.prototype.encodePoint=function(t){var r=t.getY().toArray("le",this.encodingLength);return r[this.encodingLength-1]|=t.getX().isOdd()?128:0,r};on.prototype.decodePoint=function(t){t=il.parseBytes(t);var r=t.length-1,n=t.slice(0,r).concat(t[r]&-129),s=(t[r]&128)!==0,i=il.intFromLE(n);return this.curve.pointFromY(i,s)};on.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)};on.prototype.decodeInt=function(t){return il.intFromLE(t)};on.prototype.isPoint=function(t){return t instanceof this.pointClass};var lx;function Uw(){return lx||(lx=1,function(e){var t=e;t.version=yG.version,t.utils=yn,t.rand=Bw(),t.curve=Pw,t.curves=Wd,t.ec=fY(),t.eddsa=gY}(iv)),iv}var ri={},cv={},jw={exports:{}};jw.exports;(function(e){(function(t,r){function n(x,o){if(!x)throw new Error(o||"Assertion failed")}function s(x,o){x.super_=o;var f=function(){};f.prototype=o.prototype,x.prototype=new f,x.prototype.constructor=x}function i(x,o,f){if(i.isBN(x))return x;this.negative=0,this.words=null,this.length=0,this.red=null,x!==null&&((o==="le"||o==="be")&&(f=o,o=10),this._init(x||0,o||10,f||"be"))}typeof t=="object"?t.exports=i:r.BN=i,i.BN=i,i.wordSize=26;var u;try{typeof window<"u"&&typeof window.Buffer<"u"?u=window.Buffer:u=Kt.Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,f){return o.cmp(f)>0?o:f},i.min=function(o,f){return o.cmp(f)<0?o:f},i.prototype._init=function(o,f,l){if(typeof o=="number")return this._initNumber(o,f,l);if(typeof o=="object")return this._initArray(o,f,l);f==="hex"&&(f=16),n(f===(f|0)&&f>=2&&f<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h<o.length&&(f===16?this._parseHex(o,h,l):(this._parseBase(o,f,h),l==="le"&&this._initArray(this.toArray(),f,l)))},i.prototype._initNumber=function(o,f,l){o<0&&(this.negative=1,o=-o),o<67108864?(this.words=[o&67108863],this.length=1):o<4503599627370496?(this.words=[o&67108863,o/67108864&67108863],this.length=2):(n(o<9007199254740992),this.words=[o&67108863,o/67108864&67108863,1],this.length=3),l==="le"&&this._initArray(this.toArray(),f,l)},i.prototype._initArray=function(o,f,l){if(n(typeof o.length=="number"),o.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(o.length/3),this.words=new Array(this.length);for(var h=0;h<this.length;h++)this.words[h]=0;var v,y,m=0;if(l==="be")for(h=o.length-1,v=0;h>=0;h-=3)y=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[v]|=y<<m&67108863,this.words[v+1]=y>>>26-m&67108863,m+=24,m>=26&&(m-=26,v++);else if(l==="le")for(h=0,v=0;h<o.length;h+=3)y=o[h]|o[h+1]<<8|o[h+2]<<16,this.words[v]|=y<<m&67108863,this.words[v+1]=y>>>26-m&67108863,m+=24,m>=26&&(m-=26,v++);return this.strip()};function d(x,o){var f=x.charCodeAt(o);return f>=65&&f<=70?f-55:f>=97&&f<=102?f-87:f-48&15}function c(x,o,f){var l=d(x,f);return f-1>=o&&(l|=d(x,f-1)<<4),l}i.prototype._parseHex=function(o,f,l){this.length=Math.ceil((o.length-f)/6),this.words=new Array(this.length);for(var h=0;h<this.length;h++)this.words[h]=0;var v=0,y=0,m;if(l==="be")for(h=o.length-1;h>=f;h-=2)m=c(o,f,h)<<v,this.words[y]|=m&67108863,v>=18?(v-=18,y+=1,this.words[y]|=m>>>26):v+=8;else{var p=o.length-f;for(h=p%2===0?f+1:f;h<o.length;h+=2)m=c(o,f,h)<<v,this.words[y]|=m&67108863,v>=18?(v-=18,y+=1,this.words[y]|=m>>>26):v+=8}this.strip()};function b(x,o,f,l){for(var h=0,v=Math.min(x.length,f),y=o;y<v;y++){var m=x.charCodeAt(y)-48;h*=l,m>=49?h+=m-49+10:m>=17?h+=m-17+10:h+=m}return h}i.prototype._parseBase=function(o,f,l){this.words=[0],this.length=1;for(var h=0,v=1;v<=67108863;v*=f)h++;h--,v=v/f|0;for(var y=o.length-l,m=y%h,p=Math.min(y,y-m)+l,a=0,g=l;g<p;g+=h)a=b(o,g,g+h,f),this.imuln(v),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(m!==0){var S=1;for(a=b(o,g,o.length,f),g=0;g<m;g++)S*=f;this.imuln(S),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}this.strip()},i.prototype.copy=function(o){o.words=new Array(this.length);for(var f=0;f<this.length;f++)o.words[f]=this.words[f];o.length=this.length,o.negative=this.negative,o.red=this.red},i.prototype.clone=function(){var o=new i(null);return this.copy(o),o},i.prototype._expand=function(o){for(;this.length<o;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var w=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],M=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[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];i.prototype.toString=function(o,f){o=o||10,f=f|0||1;var l;if(o===16||o==="hex"){l="";for(var h=0,v=0,y=0;y<this.length;y++){var m=this.words[y],p=((m<<h|v)&16777215).toString(16);v=m>>>24-h&16777215,h+=2,h>=26&&(h-=26,y--),v!==0||y!==this.length-1?l=w[6-p.length]+p+l:l=p+l}for(v!==0&&(l=v.toString(16)+l);l.length%f!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(o===(o|0)&&o>=2&&o<=36){var a=M[o],g=_[o];l="";var S=this.clone();for(S.negative=0;!S.isZero();){var N=S.modn(g).toString(o);S=S.idivn(g),S.isZero()?l=N+l:l=w[a-N.length]+N+l}for(this.isZero()&&(l="0"+l);l.length%f!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,f){return n(typeof u<"u"),this.toArrayLike(u,o,f)},i.prototype.toArray=function(o,f){return this.toArrayLike(Array,o,f)},i.prototype.toArrayLike=function(o,f,l){var h=this.byteLength(),v=l||Math.max(1,h);n(h<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var y=f==="le",m=new o(v),p,a,g=this.clone();if(y){for(a=0;!g.isZero();a++)p=g.andln(255),g.iushrn(8),m[a]=p;for(;a<v;a++)m[a]=0}else{for(a=0;a<v-h;a++)m[a]=0;for(a=0;!g.isZero();a++)p=g.andln(255),g.iushrn(8),m[v-a-1]=p}return m},Math.clz32?i.prototype._countBits=function(o){return 32-Math.clz32(o)}:i.prototype._countBits=function(o){var f=o,l=0;return f>=4096&&(l+=13,f>>>=13),f>=64&&(l+=7,f>>>=7),f>=8&&(l+=4,f>>>=4),f>=2&&(l+=2,f>>>=2),l+f},i.prototype._zeroBits=function(o){if(o===0)return 26;var f=o,l=0;return f&8191||(l+=13,f>>>=13),f&127||(l+=7,f>>>=7),f&15||(l+=4,f>>>=4),f&3||(l+=2,f>>>=2),f&1||l++,l},i.prototype.bitLength=function(){var o=this.words[this.length-1],f=this._countBits(o);return(this.length-1)*26+f};function A(x){for(var o=new Array(x.bitLength()),f=0;f<o.length;f++){var l=f/26|0,h=f%26;o[f]=(x.words[l]&1<<h)>>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,f=0;f<this.length;f++){var l=this._zeroBits(this.words[f]);if(o+=l,l!==26)break}return o},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(o){return this.negative!==0?this.abs().inotn(o).iaddn(1):this.clone()},i.prototype.fromTwos=function(o){return this.testn(o-1)?this.notn(o).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(o){for(;this.length<o.length;)this.words[this.length++]=0;for(var f=0;f<o.length;f++)this.words[f]=this.words[f]|o.words[f];return this.strip()},i.prototype.ior=function(o){return n((this.negative|o.negative)===0),this.iuor(o)},i.prototype.or=function(o){return this.length>o.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var f;this.length>o.length?f=o:f=this;for(var l=0;l<f.length;l++)this.words[l]=this.words[l]&o.words[l];return this.length=f.length,this.strip()},i.prototype.iand=function(o){return n((this.negative|o.negative)===0),this.iuand(o)},i.prototype.and=function(o){return this.length>o.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var f,l;this.length>o.length?(f=this,l=o):(f=o,l=this);for(var h=0;h<l.length;h++)this.words[h]=f.words[h]^l.words[h];if(this!==f)for(;h<f.length;h++)this.words[h]=f.words[h];return this.length=f.length,this.strip()},i.prototype.ixor=function(o){return n((this.negative|o.negative)===0),this.iuxor(o)},i.prototype.xor=function(o){return this.length>o.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var f=Math.ceil(o/26)|0,l=o%26;this._expand(f),l>0&&f--;for(var h=0;h<f;h++)this.words[h]=~this.words[h]&67108863;return l>0&&(this.words[h]=~this.words[h]&67108863>>26-l),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,f){n(typeof o=="number"&&o>=0);var l=o/26|0,h=o%26;return this._expand(l+1),f?this.words[l]=this.words[l]|1<<h:this.words[l]=this.words[l]&~(1<<h),this.strip()},i.prototype.iadd=function(o){var f;if(this.negative!==0&&o.negative===0)return this.negative=0,f=this.isub(o),this.negative^=1,this._normSign();if(this.negative===0&&o.negative!==0)return o.negative=0,f=this.isub(o),o.negative=1,f._normSign();var l,h;this.length>o.length?(l=this,h=o):(l=o,h=this);for(var v=0,y=0;y<h.length;y++)f=(l.words[y]|0)+(h.words[y]|0)+v,this.words[y]=f&67108863,v=f>>>26;for(;v!==0&&y<l.length;y++)f=(l.words[y]|0)+v,this.words[y]=f&67108863,v=f>>>26;if(this.length=l.length,v!==0)this.words[this.length]=v,this.length++;else if(l!==this)for(;y<l.length;y++)this.words[y]=l.words[y];return this},i.prototype.add=function(o){var f;return o.negative!==0&&this.negative===0?(o.negative=0,f=this.sub(o),o.negative^=1,f):o.negative===0&&this.negative!==0?(this.negative=0,f=o.sub(this),this.negative=1,f):this.length>o.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var f=this.iadd(o);return o.negative=1,f._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var l=this.cmp(o);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,v;l>0?(h=this,v=o):(h=o,v=this);for(var y=0,m=0;m<v.length;m++)f=(h.words[m]|0)-(v.words[m]|0)+y,y=f>>26,this.words[m]=f&67108863;for(;y!==0&&m<h.length;m++)f=(h.words[m]|0)+y,y=f>>26,this.words[m]=f&67108863;if(y===0&&m<h.length&&h!==this)for(;m<h.length;m++)this.words[m]=h.words[m];return this.length=Math.max(this.length,m),h!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(o){return this.clone().isub(o)};function R(x,o,f){f.negative=o.negative^x.negative;var l=x.length+o.length|0;f.length=l,l=l-1|0;var h=x.words[0]|0,v=o.words[0]|0,y=h*v,m=y&67108863,p=y/67108864|0;f.words[0]=m;for(var a=1;a<l;a++){for(var g=p>>>26,S=p&67108863,N=Math.min(a,o.length-1),U=Math.max(0,a-x.length+1);U<=N;U++){var Z=a-U|0;h=x.words[Z]|0,v=o.words[U]|0,y=h*v+S,g+=y/67108864|0,S=y&67108863}f.words[a]=S|0,p=g|0}return p!==0?f.words[a]=p|0:f.length--,f.strip()}var B=function(o,f,l){var h=o.words,v=f.words,y=l.words,m=0,p,a,g,S=h[0]|0,N=S&8191,U=S>>>13,Z=h[1]|0,H=Z&8191,$=Z>>>13,P=h[2]|0,W=P&8191,G=P>>>13,K=h[3]|0,O=K&8191,Q=K>>>13,de=h[4]|0,oe=de&8191,se=de>>>13,Ie=h[5]|0,fe=Ie&8191,ne=Ie>>>13,je=h[6]|0,ae=je&8191,le=je>>>13,Le=h[7]|0,he=Le&8191,_e=Le>>>13,He=h[8]|0,ye=He&8191,Ae=He>>>13,ze=h[9]|0,me=ze&8191,ge=ze>>>13,Ke=v[0]|0,we=Ke&8191,Be=Ke>>>13,We=v[1]|0,be=We&8191,ke=We>>>13,Ze=v[2]|0,pe=Ze&8191,Ne=Ze>>>13,Qe=v[3]|0,xe=Qe&8191,Re=Qe>>>13,Xe=v[4]|0,Ee=Xe&8191,$e=Xe>>>13,tt=v[5]|0,D=tt&8191,C=tt>>>13,j=v[6]|0,Y=j&8191,te=j>>>13,ue=v[7]|0,re=ue&8191,ve=ue>>>13,De=v[8]|0,ce=De&8191,Me=De>>>13,Oe=v[9]|0,Se=Oe&8191,Te=Oe>>>13;l.negative=o.negative^f.negative,l.length=19,p=Math.imul(N,we),a=Math.imul(N,Be),a=a+Math.imul(U,we)|0,g=Math.imul(U,Be);var Ge=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,p=Math.imul(H,we),a=Math.imul(H,Be),a=a+Math.imul($,we)|0,g=Math.imul($,Be),p=p+Math.imul(N,be)|0,a=a+Math.imul(N,ke)|0,a=a+Math.imul(U,be)|0,g=g+Math.imul(U,ke)|0;var Je=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Je>>>26)|0,Je&=67108863,p=Math.imul(W,we),a=Math.imul(W,Be),a=a+Math.imul(G,we)|0,g=Math.imul(G,Be),p=p+Math.imul(H,be)|0,a=a+Math.imul(H,ke)|0,a=a+Math.imul($,be)|0,g=g+Math.imul($,ke)|0,p=p+Math.imul(N,pe)|0,a=a+Math.imul(N,Ne)|0,a=a+Math.imul(U,pe)|0,g=g+Math.imul(U,Ne)|0;var pt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(pt>>>26)|0,pt&=67108863,p=Math.imul(O,we),a=Math.imul(O,Be),a=a+Math.imul(Q,we)|0,g=Math.imul(Q,Be),p=p+Math.imul(W,be)|0,a=a+Math.imul(W,ke)|0,a=a+Math.imul(G,be)|0,g=g+Math.imul(G,ke)|0,p=p+Math.imul(H,pe)|0,a=a+Math.imul(H,Ne)|0,a=a+Math.imul($,pe)|0,g=g+Math.imul($,Ne)|0,p=p+Math.imul(N,xe)|0,a=a+Math.imul(N,Re)|0,a=a+Math.imul(U,xe)|0,g=g+Math.imul(U,Re)|0;var vt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(vt>>>26)|0,vt&=67108863,p=Math.imul(oe,we),a=Math.imul(oe,Be),a=a+Math.imul(se,we)|0,g=Math.imul(se,Be),p=p+Math.imul(O,be)|0,a=a+Math.imul(O,ke)|0,a=a+Math.imul(Q,be)|0,g=g+Math.imul(Q,ke)|0,p=p+Math.imul(W,pe)|0,a=a+Math.imul(W,Ne)|0,a=a+Math.imul(G,pe)|0,g=g+Math.imul(G,Ne)|0,p=p+Math.imul(H,xe)|0,a=a+Math.imul(H,Re)|0,a=a+Math.imul($,xe)|0,g=g+Math.imul($,Re)|0,p=p+Math.imul(N,Ee)|0,a=a+Math.imul(N,$e)|0,a=a+Math.imul(U,Ee)|0,g=g+Math.imul(U,$e)|0;var gt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(gt>>>26)|0,gt&=67108863,p=Math.imul(fe,we),a=Math.imul(fe,Be),a=a+Math.imul(ne,we)|0,g=Math.imul(ne,Be),p=p+Math.imul(oe,be)|0,a=a+Math.imul(oe,ke)|0,a=a+Math.imul(se,be)|0,g=g+Math.imul(se,ke)|0,p=p+Math.imul(O,pe)|0,a=a+Math.imul(O,Ne)|0,a=a+Math.imul(Q,pe)|0,g=g+Math.imul(Q,Ne)|0,p=p+Math.imul(W,xe)|0,a=a+Math.imul(W,Re)|0,a=a+Math.imul(G,xe)|0,g=g+Math.imul(G,Re)|0,p=p+Math.imul(H,Ee)|0,a=a+Math.imul(H,$e)|0,a=a+Math.imul($,Ee)|0,g=g+Math.imul($,$e)|0,p=p+Math.imul(N,D)|0,a=a+Math.imul(N,C)|0,a=a+Math.imul(U,D)|0,g=g+Math.imul(U,C)|0;var yt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(yt>>>26)|0,yt&=67108863,p=Math.imul(ae,we),a=Math.imul(ae,Be),a=a+Math.imul(le,we)|0,g=Math.imul(le,Be),p=p+Math.imul(fe,be)|0,a=a+Math.imul(fe,ke)|0,a=a+Math.imul(ne,be)|0,g=g+Math.imul(ne,ke)|0,p=p+Math.imul(oe,pe)|0,a=a+Math.imul(oe,Ne)|0,a=a+Math.imul(se,pe)|0,g=g+Math.imul(se,Ne)|0,p=p+Math.imul(O,xe)|0,a=a+Math.imul(O,Re)|0,a=a+Math.imul(Q,xe)|0,g=g+Math.imul(Q,Re)|0,p=p+Math.imul(W,Ee)|0,a=a+Math.imul(W,$e)|0,a=a+Math.imul(G,Ee)|0,g=g+Math.imul(G,$e)|0,p=p+Math.imul(H,D)|0,a=a+Math.imul(H,C)|0,a=a+Math.imul($,D)|0,g=g+Math.imul($,C)|0,p=p+Math.imul(N,Y)|0,a=a+Math.imul(N,te)|0,a=a+Math.imul(U,Y)|0,g=g+Math.imul(U,te)|0;var mt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(mt>>>26)|0,mt&=67108863,p=Math.imul(he,we),a=Math.imul(he,Be),a=a+Math.imul(_e,we)|0,g=Math.imul(_e,Be),p=p+Math.imul(ae,be)|0,a=a+Math.imul(ae,ke)|0,a=a+Math.imul(le,be)|0,g=g+Math.imul(le,ke)|0,p=p+Math.imul(fe,pe)|0,a=a+Math.imul(fe,Ne)|0,a=a+Math.imul(ne,pe)|0,g=g+Math.imul(ne,Ne)|0,p=p+Math.imul(oe,xe)|0,a=a+Math.imul(oe,Re)|0,a=a+Math.imul(se,xe)|0,g=g+Math.imul(se,Re)|0,p=p+Math.imul(O,Ee)|0,a=a+Math.imul(O,$e)|0,a=a+Math.imul(Q,Ee)|0,g=g+Math.imul(Q,$e)|0,p=p+Math.imul(W,D)|0,a=a+Math.imul(W,C)|0,a=a+Math.imul(G,D)|0,g=g+Math.imul(G,C)|0,p=p+Math.imul(H,Y)|0,a=a+Math.imul(H,te)|0,a=a+Math.imul($,Y)|0,g=g+Math.imul($,te)|0,p=p+Math.imul(N,re)|0,a=a+Math.imul(N,ve)|0,a=a+Math.imul(U,re)|0,g=g+Math.imul(U,ve)|0;var wt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(wt>>>26)|0,wt&=67108863,p=Math.imul(ye,we),a=Math.imul(ye,Be),a=a+Math.imul(Ae,we)|0,g=Math.imul(Ae,Be),p=p+Math.imul(he,be)|0,a=a+Math.imul(he,ke)|0,a=a+Math.imul(_e,be)|0,g=g+Math.imul(_e,ke)|0,p=p+Math.imul(ae,pe)|0,a=a+Math.imul(ae,Ne)|0,a=a+Math.imul(le,pe)|0,g=g+Math.imul(le,Ne)|0,p=p+Math.imul(fe,xe)|0,a=a+Math.imul(fe,Re)|0,a=a+Math.imul(ne,xe)|0,g=g+Math.imul(ne,Re)|0,p=p+Math.imul(oe,Ee)|0,a=a+Math.imul(oe,$e)|0,a=a+Math.imul(se,Ee)|0,g=g+Math.imul(se,$e)|0,p=p+Math.imul(O,D)|0,a=a+Math.imul(O,C)|0,a=a+Math.imul(Q,D)|0,g=g+Math.imul(Q,C)|0,p=p+Math.imul(W,Y)|0,a=a+Math.imul(W,te)|0,a=a+Math.imul(G,Y)|0,g=g+Math.imul(G,te)|0,p=p+Math.imul(H,re)|0,a=a+Math.imul(H,ve)|0,a=a+Math.imul($,re)|0,g=g+Math.imul($,ve)|0,p=p+Math.imul(N,ce)|0,a=a+Math.imul(N,Me)|0,a=a+Math.imul(U,ce)|0,g=g+Math.imul(U,Me)|0;var bt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(bt>>>26)|0,bt&=67108863,p=Math.imul(me,we),a=Math.imul(me,Be),a=a+Math.imul(ge,we)|0,g=Math.imul(ge,Be),p=p+Math.imul(ye,be)|0,a=a+Math.imul(ye,ke)|0,a=a+Math.imul(Ae,be)|0,g=g+Math.imul(Ae,ke)|0,p=p+Math.imul(he,pe)|0,a=a+Math.imul(he,Ne)|0,a=a+Math.imul(_e,pe)|0,g=g+Math.imul(_e,Ne)|0,p=p+Math.imul(ae,xe)|0,a=a+Math.imul(ae,Re)|0,a=a+Math.imul(le,xe)|0,g=g+Math.imul(le,Re)|0,p=p+Math.imul(fe,Ee)|0,a=a+Math.imul(fe,$e)|0,a=a+Math.imul(ne,Ee)|0,g=g+Math.imul(ne,$e)|0,p=p+Math.imul(oe,D)|0,a=a+Math.imul(oe,C)|0,a=a+Math.imul(se,D)|0,g=g+Math.imul(se,C)|0,p=p+Math.imul(O,Y)|0,a=a+Math.imul(O,te)|0,a=a+Math.imul(Q,Y)|0,g=g+Math.imul(Q,te)|0,p=p+Math.imul(W,re)|0,a=a+Math.imul(W,ve)|0,a=a+Math.imul(G,re)|0,g=g+Math.imul(G,ve)|0,p=p+Math.imul(H,ce)|0,a=a+Math.imul(H,Me)|0,a=a+Math.imul($,ce)|0,g=g+Math.imul($,Me)|0,p=p+Math.imul(N,Se)|0,a=a+Math.imul(N,Te)|0,a=a+Math.imul(U,Se)|0,g=g+Math.imul(U,Te)|0;var xt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(xt>>>26)|0,xt&=67108863,p=Math.imul(me,be),a=Math.imul(me,ke),a=a+Math.imul(ge,be)|0,g=Math.imul(ge,ke),p=p+Math.imul(ye,pe)|0,a=a+Math.imul(ye,Ne)|0,a=a+Math.imul(Ae,pe)|0,g=g+Math.imul(Ae,Ne)|0,p=p+Math.imul(he,xe)|0,a=a+Math.imul(he,Re)|0,a=a+Math.imul(_e,xe)|0,g=g+Math.imul(_e,Re)|0,p=p+Math.imul(ae,Ee)|0,a=a+Math.imul(ae,$e)|0,a=a+Math.imul(le,Ee)|0,g=g+Math.imul(le,$e)|0,p=p+Math.imul(fe,D)|0,a=a+Math.imul(fe,C)|0,a=a+Math.imul(ne,D)|0,g=g+Math.imul(ne,C)|0,p=p+Math.imul(oe,Y)|0,a=a+Math.imul(oe,te)|0,a=a+Math.imul(se,Y)|0,g=g+Math.imul(se,te)|0,p=p+Math.imul(O,re)|0,a=a+Math.imul(O,ve)|0,a=a+Math.imul(Q,re)|0,g=g+Math.imul(Q,ve)|0,p=p+Math.imul(W,ce)|0,a=a+Math.imul(W,Me)|0,a=a+Math.imul(G,ce)|0,g=g+Math.imul(G,Me)|0,p=p+Math.imul(H,Se)|0,a=a+Math.imul(H,Te)|0,a=a+Math.imul($,Se)|0,g=g+Math.imul($,Te)|0;var Mt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,p=Math.imul(me,pe),a=Math.imul(me,Ne),a=a+Math.imul(ge,pe)|0,g=Math.imul(ge,Ne),p=p+Math.imul(ye,xe)|0,a=a+Math.imul(ye,Re)|0,a=a+Math.imul(Ae,xe)|0,g=g+Math.imul(Ae,Re)|0,p=p+Math.imul(he,Ee)|0,a=a+Math.imul(he,$e)|0,a=a+Math.imul(_e,Ee)|0,g=g+Math.imul(_e,$e)|0,p=p+Math.imul(ae,D)|0,a=a+Math.imul(ae,C)|0,a=a+Math.imul(le,D)|0,g=g+Math.imul(le,C)|0,p=p+Math.imul(fe,Y)|0,a=a+Math.imul(fe,te)|0,a=a+Math.imul(ne,Y)|0,g=g+Math.imul(ne,te)|0,p=p+Math.imul(oe,re)|0,a=a+Math.imul(oe,ve)|0,a=a+Math.imul(se,re)|0,g=g+Math.imul(se,ve)|0,p=p+Math.imul(O,ce)|0,a=a+Math.imul(O,Me)|0,a=a+Math.imul(Q,ce)|0,g=g+Math.imul(Q,Me)|0,p=p+Math.imul(W,Se)|0,a=a+Math.imul(W,Te)|0,a=a+Math.imul(G,Se)|0,g=g+Math.imul(G,Te)|0;var _t=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(_t>>>26)|0,_t&=67108863,p=Math.imul(me,xe),a=Math.imul(me,Re),a=a+Math.imul(ge,xe)|0,g=Math.imul(ge,Re),p=p+Math.imul(ye,Ee)|0,a=a+Math.imul(ye,$e)|0,a=a+Math.imul(Ae,Ee)|0,g=g+Math.imul(Ae,$e)|0,p=p+Math.imul(he,D)|0,a=a+Math.imul(he,C)|0,a=a+Math.imul(_e,D)|0,g=g+Math.imul(_e,C)|0,p=p+Math.imul(ae,Y)|0,a=a+Math.imul(ae,te)|0,a=a+Math.imul(le,Y)|0,g=g+Math.imul(le,te)|0,p=p+Math.imul(fe,re)|0,a=a+Math.imul(fe,ve)|0,a=a+Math.imul(ne,re)|0,g=g+Math.imul(ne,ve)|0,p=p+Math.imul(oe,ce)|0,a=a+Math.imul(oe,Me)|0,a=a+Math.imul(se,ce)|0,g=g+Math.imul(se,Me)|0,p=p+Math.imul(O,Se)|0,a=a+Math.imul(O,Te)|0,a=a+Math.imul(Q,Se)|0,g=g+Math.imul(Q,Te)|0;var Et=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Et>>>26)|0,Et&=67108863,p=Math.imul(me,Ee),a=Math.imul(me,$e),a=a+Math.imul(ge,Ee)|0,g=Math.imul(ge,$e),p=p+Math.imul(ye,D)|0,a=a+Math.imul(ye,C)|0,a=a+Math.imul(Ae,D)|0,g=g+Math.imul(Ae,C)|0,p=p+Math.imul(he,Y)|0,a=a+Math.imul(he,te)|0,a=a+Math.imul(_e,Y)|0,g=g+Math.imul(_e,te)|0,p=p+Math.imul(ae,re)|0,a=a+Math.imul(ae,ve)|0,a=a+Math.imul(le,re)|0,g=g+Math.imul(le,ve)|0,p=p+Math.imul(fe,ce)|0,a=a+Math.imul(fe,Me)|0,a=a+Math.imul(ne,ce)|0,g=g+Math.imul(ne,Me)|0,p=p+Math.imul(oe,Se)|0,a=a+Math.imul(oe,Te)|0,a=a+Math.imul(se,Se)|0,g=g+Math.imul(se,Te)|0;var St=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(St>>>26)|0,St&=67108863,p=Math.imul(me,D),a=Math.imul(me,C),a=a+Math.imul(ge,D)|0,g=Math.imul(ge,C),p=p+Math.imul(ye,Y)|0,a=a+Math.imul(ye,te)|0,a=a+Math.imul(Ae,Y)|0,g=g+Math.imul(Ae,te)|0,p=p+Math.imul(he,re)|0,a=a+Math.imul(he,ve)|0,a=a+Math.imul(_e,re)|0,g=g+Math.imul(_e,ve)|0,p=p+Math.imul(ae,ce)|0,a=a+Math.imul(ae,Me)|0,a=a+Math.imul(le,ce)|0,g=g+Math.imul(le,Me)|0,p=p+Math.imul(fe,Se)|0,a=a+Math.imul(fe,Te)|0,a=a+Math.imul(ne,Se)|0,g=g+Math.imul(ne,Te)|0;var At=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(At>>>26)|0,At&=67108863,p=Math.imul(me,Y),a=Math.imul(me,te),a=a+Math.imul(ge,Y)|0,g=Math.imul(ge,te),p=p+Math.imul(ye,re)|0,a=a+Math.imul(ye,ve)|0,a=a+Math.imul(Ae,re)|0,g=g+Math.imul(Ae,ve)|0,p=p+Math.imul(he,ce)|0,a=a+Math.imul(he,Me)|0,a=a+Math.imul(_e,ce)|0,g=g+Math.imul(_e,Me)|0,p=p+Math.imul(ae,Se)|0,a=a+Math.imul(ae,Te)|0,a=a+Math.imul(le,Se)|0,g=g+Math.imul(le,Te)|0;var kt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(kt>>>26)|0,kt&=67108863,p=Math.imul(me,re),a=Math.imul(me,ve),a=a+Math.imul(ge,re)|0,g=Math.imul(ge,ve),p=p+Math.imul(ye,ce)|0,a=a+Math.imul(ye,Me)|0,a=a+Math.imul(Ae,ce)|0,g=g+Math.imul(Ae,Me)|0,p=p+Math.imul(he,Se)|0,a=a+Math.imul(he,Te)|0,a=a+Math.imul(_e,Se)|0,g=g+Math.imul(_e,Te)|0;var Bt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,p=Math.imul(me,ce),a=Math.imul(me,Me),a=a+Math.imul(ge,ce)|0,g=Math.imul(ge,Me),p=p+Math.imul(ye,Se)|0,a=a+Math.imul(ye,Te)|0,a=a+Math.imul(Ae,Se)|0,g=g+Math.imul(Ae,Te)|0;var Rt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,p=Math.imul(me,Se),a=Math.imul(me,Te),a=a+Math.imul(ge,Se)|0,g=Math.imul(ge,Te);var $t=(m+p|0)+((a&8191)<<13)|0;return m=(g+(a>>>13)|0)+($t>>>26)|0,$t&=67108863,y[0]=Ge,y[1]=Je,y[2]=pt,y[3]=vt,y[4]=gt,y[5]=yt,y[6]=mt,y[7]=wt,y[8]=bt,y[9]=xt,y[10]=Mt,y[11]=_t,y[12]=Et,y[13]=St,y[14]=At,y[15]=kt,y[16]=Bt,y[17]=Rt,y[18]=$t,m!==0&&(y[19]=m,l.length++),l};Math.imul||(B=R);function I(x,o,f){f.negative=o.negative^x.negative,f.length=x.length+o.length;for(var l=0,h=0,v=0;v<f.length-1;v++){var y=h;h=0;for(var m=l&67108863,p=Math.min(v,o.length-1),a=Math.max(0,v-x.length+1);a<=p;a++){var g=v-a,S=x.words[g]|0,N=o.words[a]|0,U=S*N,Z=U&67108863;y=y+(U/67108864|0)|0,Z=Z+m|0,m=Z&67108863,y=y+(Z>>>26)|0,h+=y>>>26,y&=67108863}f.words[v]=m,l=y,y=h}return l!==0?f.words[v]=l:f.length--,f.strip()}function E(x,o,f){var l=new k;return l.mulp(x,o,f)}i.prototype.mulTo=function(o,f){var l,h=this.length+o.length;return this.length===10&&o.length===10?l=B(this,o,f):h<63?l=R(this,o,f):h<1024?l=I(this,o,f):l=E(this,o,f),l};function k(x,o){this.x=x,this.y=o}k.prototype.makeRBT=function(o){for(var f=new Array(o),l=i.prototype._countBits(o)-1,h=0;h<o;h++)f[h]=this.revBin(h,l,o);return f},k.prototype.revBin=function(o,f,l){if(o===0||o===l-1)return o;for(var h=0,v=0;v<f;v++)h|=(o&1)<<f-v-1,o>>=1;return h},k.prototype.permute=function(o,f,l,h,v,y){for(var m=0;m<y;m++)h[m]=f[o[m]],v[m]=l[o[m]]},k.prototype.transform=function(o,f,l,h,v,y){this.permute(y,o,f,l,h,v);for(var m=1;m<v;m<<=1)for(var p=m<<1,a=Math.cos(2*Math.PI/p),g=Math.sin(2*Math.PI/p),S=0;S<v;S+=p)for(var N=a,U=g,Z=0;Z<m;Z++){var H=l[S+Z],$=h[S+Z],P=l[S+Z+m],W=h[S+Z+m],G=N*P-U*W;W=N*W+U*P,P=G,l[S+Z]=H+P,h[S+Z]=$+W,l[S+Z+m]=H-P,h[S+Z+m]=$-W,Z!==p&&(G=a*N-g*U,U=a*U+g*N,N=G)}},k.prototype.guessLen13b=function(o,f){var l=Math.max(f,o)|1,h=l&1,v=0;for(l=l/2|0;l;l=l>>>1)v++;return 1<<v+1+h},k.prototype.conjugate=function(o,f,l){if(!(l<=1))for(var h=0;h<l/2;h++){var v=o[h];o[h]=o[l-h-1],o[l-h-1]=v,v=f[h],f[h]=-f[l-h-1],f[l-h-1]=-v}},k.prototype.normalize13b=function(o,f){for(var l=0,h=0;h<f/2;h++){var v=Math.round(o[2*h+1]/f)*8192+Math.round(o[2*h]/f)+l;o[h]=v&67108863,v<67108864?l=0:l=v/67108864|0}return o},k.prototype.convert13b=function(o,f,l,h){for(var v=0,y=0;y<f;y++)v=v+(o[y]|0),l[2*y]=v&8191,v=v>>>13,l[2*y+1]=v&8191,v=v>>>13;for(y=2*f;y<h;++y)l[y]=0;n(v===0),n((v&-8192)===0)},k.prototype.stub=function(o){for(var f=new Array(o),l=0;l<o;l++)f[l]=0;return f},k.prototype.mulp=function(o,f,l){var h=2*this.guessLen13b(o.length,f.length),v=this.makeRBT(h),y=this.stub(h),m=new Array(h),p=new Array(h),a=new Array(h),g=new Array(h),S=new Array(h),N=new Array(h),U=l.words;U.length=h,this.convert13b(o.words,o.length,m,h),this.convert13b(f.words,f.length,g,h),this.transform(m,y,p,a,h,v),this.transform(g,y,S,N,h,v);for(var Z=0;Z<h;Z++){var H=p[Z]*S[Z]-a[Z]*N[Z];a[Z]=p[Z]*N[Z]+a[Z]*S[Z],p[Z]=H}return this.conjugate(p,a,h),this.transform(p,a,U,y,h,v),this.conjugate(U,y,h),this.normalize13b(U,h),l.negative=o.negative^f.negative,l.length=o.length+f.length,l.strip()},i.prototype.mul=function(o){var f=new i(null);return f.words=new Array(this.length+o.length),this.mulTo(o,f)},i.prototype.mulf=function(o){var f=new i(null);return f.words=new Array(this.length+o.length),E(this,o,f)},i.prototype.imul=function(o){return this.clone().mulTo(o,this)},i.prototype.imuln=function(o){n(typeof o=="number"),n(o<67108864);for(var f=0,l=0;l<this.length;l++){var h=(this.words[l]|0)*o,v=(h&67108863)+(f&67108863);f>>=26,f+=h/67108864|0,f+=v>>>26,this.words[l]=v&67108863}return f!==0&&(this.words[l]=f,this.length++),this.length=o===0?1:this.length,this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var f=A(o);if(f.length===0)return new i(1);for(var l=this,h=0;h<f.length&&f[h]===0;h++,l=l.sqr());if(++h<f.length)for(var v=l.sqr();h<f.length;h++,v=v.sqr())f[h]!==0&&(l=l.mul(v));return l},i.prototype.iushln=function(o){n(typeof o=="number"&&o>=0);var f=o%26,l=(o-f)/26,h=67108863>>>26-f<<26-f,v;if(f!==0){var y=0;for(v=0;v<this.length;v++){var m=this.words[v]&h,p=(this.words[v]|0)-m<<f;this.words[v]=p|y,y=m>>>26-f}y&&(this.words[v]=y,this.length++)}if(l!==0){for(v=this.length-1;v>=0;v--)this.words[v+l]=this.words[v];for(v=0;v<l;v++)this.words[v]=0;this.length+=l}return this.strip()},i.prototype.ishln=function(o){return n(this.negative===0),this.iushln(o)},i.prototype.iushrn=function(o,f,l){n(typeof o=="number"&&o>=0);var h;f?h=(f-f%26)/26:h=0;var v=o%26,y=Math.min((o-v)/26,this.length),m=67108863^67108863>>>v<<v,p=l;if(h-=y,h=Math.max(0,h),p){for(var a=0;a<y;a++)p.words[a]=this.words[a];p.length=y}if(y!==0)if(this.length>y)for(this.length-=y,a=0;a<this.length;a++)this.words[a]=this.words[a+y];else this.words[0]=0,this.length=1;var g=0;for(a=this.length-1;a>=0&&(g!==0||a>=h);a--){var S=this.words[a]|0;this.words[a]=g<<26-v|S>>>v,g=S&m}return p&&g!==0&&(p.words[p.length++]=g),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,f,l){return n(this.negative===0),this.iushrn(o,f,l)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var f=o%26,l=(o-f)/26,h=1<<f;if(this.length<=l)return!1;var v=this.words[l];return!!(v&h)},i.prototype.imaskn=function(o){n(typeof o=="number"&&o>=0);var f=o%26,l=(o-f)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(f!==0&&l++,this.length=Math.min(l,this.length),f!==0){var h=67108863^67108863>>>f<<f;this.words[this.length-1]&=h}return this.strip()},i.prototype.maskn=function(o){return this.clone().imaskn(o)},i.prototype.iaddn=function(o){return n(typeof o=="number"),n(o<67108864),o<0?this.isubn(-o):this.negative!==0?this.length===1&&(this.words[0]|0)<o?(this.words[0]=o-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(o),this.negative=1,this):this._iaddn(o)},i.prototype._iaddn=function(o){this.words[0]+=o;for(var f=0;f<this.length&&this.words[f]>=67108864;f++)this.words[f]-=67108864,f===this.length-1?this.words[f+1]=1:this.words[f+1]++;return this.length=Math.max(this.length,f+1),this},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var f=0;f<this.length&&this.words[f]<0;f++)this.words[f]+=67108864,this.words[f+1]-=1;return this.strip()},i.prototype.addn=function(o){return this.clone().iaddn(o)},i.prototype.subn=function(o){return this.clone().isubn(o)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(o,f,l){var h=o.length+l,v;this._expand(h);var y,m=0;for(v=0;v<o.length;v++){y=(this.words[v+l]|0)+m;var p=(o.words[v]|0)*f;y-=p&67108863,m=(y>>26)-(p/67108864|0),this.words[v+l]=y&67108863}for(;v<this.length-l;v++)y=(this.words[v+l]|0)+m,m=y>>26,this.words[v+l]=y&67108863;if(m===0)return this.strip();for(n(m===-1),m=0,v=0;v<this.length;v++)y=-(this.words[v]|0)+m,m=y>>26,this.words[v]=y&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,f){var l=this.length-o.length,h=this.clone(),v=o,y=v.words[v.length-1]|0,m=this._countBits(y);l=26-m,l!==0&&(v=v.ushln(l),h.iushln(l),y=v.words[v.length-1]|0);var p=h.length-v.length,a;if(f!=="mod"){a=new i(null),a.length=p+1,a.words=new Array(a.length);for(var g=0;g<a.length;g++)a.words[g]=0}var S=h.clone()._ishlnsubmul(v,1,p);S.negative===0&&(h=S,a&&(a.words[p]=1));for(var N=p-1;N>=0;N--){var U=(h.words[v.length+N]|0)*67108864+(h.words[v.length+N-1]|0);for(U=Math.min(U/y|0,67108863),h._ishlnsubmul(v,U,N);h.negative!==0;)U--,h.negative=0,h._ishlnsubmul(v,1,N),h.isZero()||(h.negative^=1);a&&(a.words[N]=U)}return a&&a.strip(),h.strip(),f!=="div"&&l!==0&&h.iushrn(l),{div:a||null,mod:h}},i.prototype.divmod=function(o,f,l){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,v,y;return this.negative!==0&&o.negative===0?(y=this.neg().divmod(o,f),f!=="mod"&&(h=y.div.neg()),f!=="div"&&(v=y.mod.neg(),l&&v.negative!==0&&v.iadd(o)),{div:h,mod:v}):this.negative===0&&o.negative!==0?(y=this.divmod(o.neg(),f),f!=="mod"&&(h=y.div.neg()),{div:h,mod:y.mod}):this.negative&o.negative?(y=this.neg().divmod(o.neg(),f),f!=="div"&&(v=y.mod.neg(),l&&v.negative!==0&&v.isub(o)),{div:y.div,mod:v}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?f==="div"?{div:this.divn(o.words[0]),mod:null}:f==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,f)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var f=this.divmod(o);if(f.mod.isZero())return f.div;var l=f.div.negative!==0?f.mod.isub(o):f.mod,h=o.ushrn(1),v=o.andln(1),y=l.cmp(h);return y<0||v===1&&y===0?f.div:f.div.negative!==0?f.div.isubn(1):f.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var f=(1<<26)%o,l=0,h=this.length-1;h>=0;h--)l=(f*l+(this.words[h]|0))%o;return l},i.prototype.idivn=function(o){n(o<=67108863);for(var f=0,l=this.length-1;l>=0;l--){var h=(this.words[l]|0)+f*67108864;this.words[l]=h/o|0,f=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var f=this,l=o.clone();f.negative!==0?f=f.umod(o):f=f.clone();for(var h=new i(1),v=new i(0),y=new i(0),m=new i(1),p=0;f.isEven()&&l.isEven();)f.iushrn(1),l.iushrn(1),++p;for(var a=l.clone(),g=f.clone();!f.isZero();){for(var S=0,N=1;!(f.words[0]&N)&&S<26;++S,N<<=1);if(S>0)for(f.iushrn(S);S-- >0;)(h.isOdd()||v.isOdd())&&(h.iadd(a),v.isub(g)),h.iushrn(1),v.iushrn(1);for(var U=0,Z=1;!(l.words[0]&Z)&&U<26;++U,Z<<=1);if(U>0)for(l.iushrn(U);U-- >0;)(y.isOdd()||m.isOdd())&&(y.iadd(a),m.isub(g)),y.iushrn(1),m.iushrn(1);f.cmp(l)>=0?(f.isub(l),h.isub(y),v.isub(m)):(l.isub(f),y.isub(h),m.isub(v))}return{a:y,b:m,gcd:l.iushln(p)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var f=this,l=o.clone();f.negative!==0?f=f.umod(o):f=f.clone();for(var h=new i(1),v=new i(0),y=l.clone();f.cmpn(1)>0&&l.cmpn(1)>0;){for(var m=0,p=1;!(f.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(f.iushrn(m);m-- >0;)h.isOdd()&&h.iadd(y),h.iushrn(1);for(var a=0,g=1;!(l.words[0]&g)&&a<26;++a,g<<=1);if(a>0)for(l.iushrn(a);a-- >0;)v.isOdd()&&v.iadd(y),v.iushrn(1);f.cmp(l)>=0?(f.isub(l),h.isub(v)):(l.isub(f),v.isub(h))}var S;return f.cmpn(1)===0?S=h:S=v,S.cmpn(0)<0&&S.iadd(o),S},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var f=this.clone(),l=o.clone();f.negative=0,l.negative=0;for(var h=0;f.isEven()&&l.isEven();h++)f.iushrn(1),l.iushrn(1);do{for(;f.isEven();)f.iushrn(1);for(;l.isEven();)l.iushrn(1);var v=f.cmp(l);if(v<0){var y=f;f=l,l=y}else if(v===0||l.cmpn(1)===0)break;f.isub(l)}while(!0);return l.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var f=o%26,l=(o-f)/26,h=1<<f;if(this.length<=l)return this._expand(l+1),this.words[l]|=h,this;for(var v=h,y=l;v!==0&&y<this.length;y++){var m=this.words[y]|0;m+=v,v=m>>>26,m&=67108863,this.words[y]=m}return v!==0&&(this.words[y]=v,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var f=o<0;if(this.negative!==0&&!f)return-1;if(this.negative===0&&f)return 1;this.strip();var l;if(this.length>1)l=1;else{f&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;l=h===o?0:h<o?-1:1}return this.negative!==0?-l|0:l},i.prototype.cmp=function(o){if(this.negative!==0&&o.negative===0)return-1;if(this.negative===0&&o.negative!==0)return 1;var f=this.ucmp(o);return this.negative!==0?-f|0:f},i.prototype.ucmp=function(o){if(this.length>o.length)return 1;if(this.length<o.length)return-1;for(var f=0,l=this.length-1;l>=0;l--){var h=this.words[l]|0,v=o.words[l]|0;if(h!==v){h<v?f=-1:h>v&&(f=1);break}}return f},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new X(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var T={k256:null,p224:null,p192:null,p25519:null};function L(x,o){this.name=x,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}L.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},L.prototype.ireduce=function(o){var f=o,l;do this.split(f,this.tmp),f=this.imulK(f),f=f.iadd(this.tmp),l=f.bitLength();while(l>this.n);var h=l<this.n?-1:f.ucmp(this.p);return h===0?(f.words[0]=0,f.length=1):h>0?f.isub(this.p):f.strip!==void 0?f.strip():f._strip(),f},L.prototype.split=function(o,f){o.iushrn(this.n,0,f)},L.prototype.imulK=function(o){return o.imul(this.k)};function q(){L.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(q,L),q.prototype.split=function(o,f){for(var l=4194303,h=Math.min(o.length,9),v=0;v<h;v++)f.words[v]=o.words[v];if(f.length=h,o.length<=9){o.words[0]=0,o.length=1;return}var y=o.words[9];for(f.words[f.length++]=y&l,v=10;v<o.length;v++){var m=o.words[v]|0;o.words[v-10]=(m&l)<<4|y>>>22,y=m}y>>>=22,o.words[v-10]=y,y===0&&o.length>10?o.length-=10:o.length-=9},q.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var f=0,l=0;l<o.length;l++){var h=o.words[l]|0;f+=h*977,o.words[l]=f&67108863,f=h*64+(f/67108864|0)}return o.words[o.length-1]===0&&(o.length--,o.words[o.length-1]===0&&o.length--),o};function z(){L.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(z,L);function J(){L.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(J,L);function F(){L.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(F,L),F.prototype.imulK=function(o){for(var f=0,l=0;l<o.length;l++){var h=(o.words[l]|0)*19+f,v=h&67108863;h>>>=26,o.words[l]=v,f=h}return f!==0&&(o.words[o.length++]=f),o},i._prime=function(o){if(T[o])return T[o];var f;if(o==="k256")f=new q;else if(o==="p224")f=new z;else if(o==="p192")f=new J;else if(o==="p25519")f=new F;else throw new Error("Unknown prime "+o);return T[o]=f,f};function X(x){if(typeof x=="string"){var o=i._prime(x);this.m=o.p,this.prime=o}else n(x.gtn(1),"modulus must be greater than 1"),this.m=x,this.prime=null}X.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},X.prototype._verify2=function(o,f){n((o.negative|f.negative)===0,"red works only with positives"),n(o.red&&o.red===f.red,"red works only with red numbers")},X.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},X.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},X.prototype.add=function(o,f){this._verify2(o,f);var l=o.add(f);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},X.prototype.iadd=function(o,f){this._verify2(o,f);var l=o.iadd(f);return l.cmp(this.m)>=0&&l.isub(this.m),l},X.prototype.sub=function(o,f){this._verify2(o,f);var l=o.sub(f);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},X.prototype.isub=function(o,f){this._verify2(o,f);var l=o.isub(f);return l.cmpn(0)<0&&l.iadd(this.m),l},X.prototype.shl=function(o,f){return this._verify1(o),this.imod(o.ushln(f))},X.prototype.imul=function(o,f){return this._verify2(o,f),this.imod(o.imul(f))},X.prototype.mul=function(o,f){return this._verify2(o,f),this.imod(o.mul(f))},X.prototype.isqr=function(o){return this.imul(o,o.clone())},X.prototype.sqr=function(o){return this.mul(o,o)},X.prototype.sqrt=function(o){if(o.isZero())return o.clone();var f=this.m.andln(3);if(n(f%2===1),f===3){var l=this.m.add(new i(1)).iushrn(2);return this.pow(o,l)}for(var h=this.m.subn(1),v=0;!h.isZero()&&h.andln(1)===0;)v++,h.iushrn(1);n(!h.isZero());var y=new i(1).toRed(this),m=y.redNeg(),p=this.m.subn(1).iushrn(1),a=this.m.bitLength();for(a=new i(2*a*a).toRed(this);this.pow(a,p).cmp(m)!==0;)a.redIAdd(m);for(var g=this.pow(a,h),S=this.pow(o,h.addn(1).iushrn(1)),N=this.pow(o,h),U=v;N.cmp(y)!==0;){for(var Z=N,H=0;Z.cmp(y)!==0;H++)Z=Z.redSqr();n(H<U);var $=this.pow(g,new i(1).iushln(U-H-1));S=S.redMul($),g=$.redSqr(),N=N.redMul(g),U=H}return S},X.prototype.invm=function(o){var f=o._invmp(this.m);return f.negative!==0?(f.negative=0,this.imod(f).redNeg()):this.imod(f)},X.prototype.pow=function(o,f){if(f.isZero())return new i(1).toRed(this);if(f.cmpn(1)===0)return o.clone();var l=4,h=new Array(1<<l);h[0]=new i(1).toRed(this),h[1]=o;for(var v=2;v<h.length;v++)h[v]=this.mul(h[v-1],o);var y=h[0],m=0,p=0,a=f.bitLength()%26;for(a===0&&(a=26),v=f.length-1;v>=0;v--){for(var g=f.words[v],S=a-1;S>=0;S--){var N=g>>S&1;if(y!==h[0]&&(y=this.sqr(y)),N===0&&m===0){p=0;continue}m<<=1,m|=N,p++,!(p!==l&&(v!==0||S!==0))&&(y=this.mul(y,h[m]),p=0,m=0)}a=26}return y},X.prototype.convertTo=function(o){var f=o.umod(this.m);return f===o?f.clone():f},X.prototype.convertFrom=function(o){var f=o.clone();return f.red=null,f},i.mont=function(o){return new ee(o)};function ee(x){X.call(this,x),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(ee,X),ee.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},ee.prototype.convertFrom=function(o){var f=this.imod(o.mul(this.rinv));return f.red=null,f},ee.prototype.imul=function(o,f){if(o.isZero()||f.isZero())return o.words[0]=0,o.length=1,o;var l=o.imul(f),h=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=l.isub(h).iushrn(this.shift),y=v;return v.cmp(this.m)>=0?y=v.isub(this.m):v.cmpn(0)<0&&(y=v.iadd(this.m)),y._forceRed(this)},ee.prototype.mul=function(o,f){if(o.isZero()||f.isZero())return new i(0)._forceRed(this);var l=o.mul(f),h=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=l.isub(h).iushrn(this.shift),y=v;return v.cmp(this.m)>=0?y=v.isub(this.m):v.cmpn(0)<0&&(y=v.iadd(this.m)),y._forceRed(this)},ee.prototype.invm=function(o){var f=this.imod(o._invmp(this.m).mul(this.r2));return f._forceRed(this)}})(e,Ve)})(jw);var yY=jw.exports,dv={};const mY={},wY=Object.freeze(Object.defineProperty({__proto__:null,default:mY},Symbol.toStringTag,{value:"Module"})),bY=yR(wY);var ux;function xY(){return ux||(ux=1,function(e){var t=mh(),r=Fe,n=e;n.define=function(u,d){return new s(u,d)};function s(i,u){this.name=i,this.body=u,this.decoders={},this.encoders={}}s.prototype._createNamed=function(u){var d;try{d=bY.runInThisContext("(function "+this.name+`(entity) {
56
- this._initNamed(entity);
57
- })`)}catch{d=function(b){this._initNamed(b)}}return r(d,u),d.prototype._initNamed=function(b){u.call(this,b)},new d(this)},s.prototype._getDecoder=function(u){return u=u||"der",this.decoders.hasOwnProperty(u)||(this.decoders[u]=this._createNamed(t.decoders[u])),this.decoders[u]},s.prototype.decode=function(u,d,c){return this._getDecoder(d).decode(u,c)},s.prototype._getEncoder=function(u){return u=u||"der",this.encoders.hasOwnProperty(u)||(this.encoders[u]=this._createNamed(t.encoders[u])),this.encoders[u]},s.prototype.encode=function(u,d,c){return this._getEncoder(d).encode(u,c)}}(dv)),dv}var pv={},UA={},MY=Fe;function jn(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}UA.Reporter=jn;jn.prototype.isError=function(t){return t instanceof ol};jn.prototype.save=function(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}};jn.prototype.restore=function(t){var r=this._reporterState;r.obj=t.obj,r.path=r.path.slice(0,t.pathLen)};jn.prototype.enterKey=function(t){return this._reporterState.path.push(t)};jn.prototype.exitKey=function(t){var r=this._reporterState;r.path=r.path.slice(0,t-1)};jn.prototype.leaveKey=function(t,r,n){var s=this._reporterState;this.exitKey(t),s.obj!==null&&(s.obj[r]=n)};jn.prototype.path=function(){return this._reporterState.path.join("/")};jn.prototype.enterObject=function(){var t=this._reporterState,r=t.obj;return t.obj={},r};jn.prototype.leaveObject=function(t){var r=this._reporterState,n=r.obj;return r.obj=t,n};jn.prototype.error=function(t){var r,n=this._reporterState,s=t instanceof ol;if(s?r=t:r=new ol(n.path.map(function(i){return"["+JSON.stringify(i)+"]"}).join(""),t.message||t,t.stack),!n.options.partial)throw r;return s||n.errors.push(r),r};jn.prototype.wrapResult=function(t){var r=this._reporterState;return r.options.partial?{result:this.isError(t)?null:t,errors:r.errors}:t};function ol(e,t){this.path=e,this.rethrow(t)}MY(ol,Error);ol.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,ol),!this.stack)try{throw new Error(this.message)}catch(r){this.stack=r.stack}return this};var Xh={},hx;function cx(){if(hx)return Xh;hx=1;var e=Fe,t=mu().Reporter,r=Kt.Buffer;function n(i,u){if(t.call(this,u),!r.isBuffer(i)){this.error("Input not Buffer");return}this.base=i,this.offset=0,this.length=i.length}e(n,t),Xh.DecoderBuffer=n,n.prototype.save=function(){return{offset:this.offset,reporter:t.prototype.save.call(this)}},n.prototype.restore=function(u){var d=new n(this.base);return d.offset=u.offset,d.length=this.offset,this.offset=u.offset,t.prototype.restore.call(this,u.reporter),d},n.prototype.isEmpty=function(){return this.offset===this.length},n.prototype.readUInt8=function(u){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(u||"DecoderBuffer overrun")},n.prototype.skip=function(u,d){if(!(this.offset+u<=this.length))return this.error(d||"DecoderBuffer overrun");var c=new n(this.base);return c._reporterState=this._reporterState,c.offset=this.offset,c.length=this.offset+u,this.offset+=u,c},n.prototype.raw=function(u){return this.base.slice(u?u.offset:this.offset,this.length)};function s(i,u){if(Array.isArray(i))this.length=0,this.value=i.map(function(d){return d instanceof s||(d=new s(d,u)),this.length+=d.length,d},this);else if(typeof i=="number"){if(!(0<=i&&i<=255))return u.error("non-byte EncoderBuffer value");this.value=i,this.length=1}else if(typeof i=="string")this.value=i,this.length=r.byteLength(i);else if(r.isBuffer(i))this.value=i,this.length=i.length;else return u.error("Unsupported type: "+typeof i)}return Xh.EncoderBuffer=s,s.prototype.join=function(u,d){return u||(u=new r(this.length)),d||(d=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(c){c.join(u,d),d+=c.length}):(typeof this.value=="number"?u[d]=this.value:typeof this.value=="string"?u.write(this.value,d):r.isBuffer(this.value)&&this.value.copy(u,d),d+=this.length)),u},Xh}var vv,dx;function _Y(){if(dx)return vv;dx=1;var e=mu().Reporter,t=mu().EncoderBuffer,r=mu().DecoderBuffer,n=Pn,s=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],i=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s),u=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function d(b,w){var M={};this._baseState=M,M.enc=b,M.parent=w||null,M.children=null,M.tag=null,M.args=null,M.reverseArgs=null,M.choice=null,M.optional=!1,M.any=!1,M.obj=!1,M.use=null,M.useDecoder=null,M.key=null,M.default=null,M.explicit=null,M.implicit=null,M.contains=null,M.parent||(M.children=[],this._wrap())}vv=d;var c=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];return d.prototype.clone=function(){var w=this._baseState,M={};c.forEach(function(A){M[A]=w[A]});var _=new this.constructor(M.parent);return _._baseState=M,_},d.prototype._wrap=function(){var w=this._baseState;i.forEach(function(M){this[M]=function(){var A=new this.constructor(this);return w.children.push(A),A[M].apply(A,arguments)}},this)},d.prototype._init=function(w){var M=this._baseState;n(M.parent===null),w.call(this),M.children=M.children.filter(function(_){return _._baseState.parent===this},this),n.equal(M.children.length,1,"Root node can have only one child")},d.prototype._useArgs=function(w){var M=this._baseState,_=w.filter(function(A){return A instanceof this.constructor},this);w=w.filter(function(A){return!(A instanceof this.constructor)},this),_.length!==0&&(n(M.children===null),M.children=_,_.forEach(function(A){A._baseState.parent=this},this)),w.length!==0&&(n(M.args===null),M.args=w,M.reverseArgs=w.map(function(A){if(typeof A!="object"||A.constructor!==Object)return A;var R={};return Object.keys(A).forEach(function(B){B==(B|0)&&(B|=0);var I=A[B];R[I]=B}),R}))},u.forEach(function(b){d.prototype[b]=function(){var M=this._baseState;throw new Error(b+" not implemented for encoding: "+M.enc)}}),s.forEach(function(b){d.prototype[b]=function(){var M=this._baseState,_=Array.prototype.slice.call(arguments);return n(M.tag===null),M.tag=b,this._useArgs(_),this}}),d.prototype.use=function(w){n(w);var M=this._baseState;return n(M.use===null),M.use=w,this},d.prototype.optional=function(){var w=this._baseState;return w.optional=!0,this},d.prototype.def=function(w){var M=this._baseState;return n(M.default===null),M.default=w,M.optional=!0,this},d.prototype.explicit=function(w){var M=this._baseState;return n(M.explicit===null&&M.implicit===null),M.explicit=w,this},d.prototype.implicit=function(w){var M=this._baseState;return n(M.explicit===null&&M.implicit===null),M.implicit=w,this},d.prototype.obj=function(){var w=this._baseState,M=Array.prototype.slice.call(arguments);return w.obj=!0,M.length!==0&&this._useArgs(M),this},d.prototype.key=function(w){var M=this._baseState;return n(M.key===null),M.key=w,this},d.prototype.any=function(){var w=this._baseState;return w.any=!0,this},d.prototype.choice=function(w){var M=this._baseState;return n(M.choice===null),M.choice=w,this._useArgs(Object.keys(w).map(function(_){return w[_]})),this},d.prototype.contains=function(w){var M=this._baseState;return n(M.use===null),M.contains=w,this},d.prototype._decode=function(w,M){var _=this._baseState;if(_.parent===null)return w.wrapResult(_.children[0]._decode(w,M));var A=_.default,R=!0,B=null;if(_.key!==null&&(B=w.enterKey(_.key)),_.optional){var I=null;if(_.explicit!==null?I=_.explicit:_.implicit!==null?I=_.implicit:_.tag!==null&&(I=_.tag),I===null&&!_.any){var E=w.save();try{_.choice===null?this._decodeGeneric(_.tag,w,M):this._decodeChoice(w,M),R=!0}catch{R=!1}w.restore(E)}else if(R=this._peekTag(w,I,_.any),w.isError(R))return R}var k;if(_.obj&&R&&(k=w.enterObject()),R){if(_.explicit!==null){var T=this._decodeTag(w,_.explicit);if(w.isError(T))return T;w=T}var L=w.offset;if(_.use===null&&_.choice===null){if(_.any)var E=w.save();var q=this._decodeTag(w,_.implicit!==null?_.implicit:_.tag,_.any);if(w.isError(q))return q;_.any?A=w.raw(E):w=q}if(M&&M.track&&_.tag!==null&&M.track(w.path(),L,w.length,"tagged"),M&&M.track&&_.tag!==null&&M.track(w.path(),w.offset,w.length,"content"),_.any?A=A:_.choice===null?A=this._decodeGeneric(_.tag,w,M):A=this._decodeChoice(w,M),w.isError(A))return A;if(!_.any&&_.choice===null&&_.children!==null&&_.children.forEach(function(F){F._decode(w,M)}),_.contains&&(_.tag==="octstr"||_.tag==="bitstr")){var z=new r(A);A=this._getUse(_.contains,w._reporterState.obj)._decode(z,M)}}return _.obj&&R&&(A=w.leaveObject(k)),_.key!==null&&(A!==null||R===!0)?w.leaveKey(B,_.key,A):B!==null&&w.exitKey(B),A},d.prototype._decodeGeneric=function(w,M,_){var A=this._baseState;return w==="seq"||w==="set"?null:w==="seqof"||w==="setof"?this._decodeList(M,w,A.args[0],_):/str$/.test(w)?this._decodeStr(M,w,_):w==="objid"&&A.args?this._decodeObjid(M,A.args[0],A.args[1],_):w==="objid"?this._decodeObjid(M,null,null,_):w==="gentime"||w==="utctime"?this._decodeTime(M,w,_):w==="null_"?this._decodeNull(M,_):w==="bool"?this._decodeBool(M,_):w==="objDesc"?this._decodeStr(M,w,_):w==="int"||w==="enum"?this._decodeInt(M,A.args&&A.args[0],_):A.use!==null?this._getUse(A.use,M._reporterState.obj)._decode(M,_):M.error("unknown tag: "+w)},d.prototype._getUse=function(w,M){var _=this._baseState;return _.useDecoder=this._use(w,M),n(_.useDecoder._baseState.parent===null),_.useDecoder=_.useDecoder._baseState.children[0],_.implicit!==_.useDecoder._baseState.implicit&&(_.useDecoder=_.useDecoder.clone(),_.useDecoder._baseState.implicit=_.implicit),_.useDecoder},d.prototype._decodeChoice=function(w,M){var _=this._baseState,A=null,R=!1;return Object.keys(_.choice).some(function(B){var I=w.save(),E=_.choice[B];try{var k=E._decode(w,M);if(w.isError(k))return!1;A={type:B,value:k},R=!0}catch{return w.restore(I),!1}return!0},this),R?A:w.error("Choice not matched")},d.prototype._createEncoderBuffer=function(w){return new t(w,this.reporter)},d.prototype._encode=function(w,M,_){var A=this._baseState;if(!(A.default!==null&&A.default===w)){var R=this._encodeValue(w,M,_);if(R!==void 0&&!this._skipDefault(R,M,_))return R}},d.prototype._encodeValue=function(w,M,_){var A=this._baseState;if(A.parent===null)return A.children[0]._encode(w,M||new e);var E=null;if(this.reporter=M,A.optional&&w===void 0)if(A.default!==null)w=A.default;else return;var R=null,B=!1;if(A.any)E=this._createEncoderBuffer(w);else if(A.choice)E=this._encodeChoice(w,M);else if(A.contains)R=this._getUse(A.contains,_)._encode(w,M),B=!0;else if(A.children)R=A.children.map(function(L){if(L._baseState.tag==="null_")return L._encode(null,M,w);if(L._baseState.key===null)return M.error("Child should have a key");var q=M.enterKey(L._baseState.key);if(typeof w!="object")return M.error("Child expected, but input is not object");var z=L._encode(w[L._baseState.key],M,w);return M.leaveKey(q),z},this).filter(function(L){return L}),R=this._createEncoderBuffer(R);else if(A.tag==="seqof"||A.tag==="setof"){if(!(A.args&&A.args.length===1))return M.error("Too many args for : "+A.tag);if(!Array.isArray(w))return M.error("seqof/setof, but data is not Array");var I=this.clone();I._baseState.implicit=null,R=this._createEncoderBuffer(w.map(function(L){var q=this._baseState;return this._getUse(q.args[0],w)._encode(L,M)},I))}else A.use!==null?E=this._getUse(A.use,_)._encode(w,M):(R=this._encodePrimitive(A.tag,w),B=!0);var E;if(!A.any&&A.choice===null){var k=A.implicit!==null?A.implicit:A.tag,T=A.implicit===null?"universal":"context";k===null?A.use===null&&M.error("Tag could be omitted only for .use()"):A.use===null&&(E=this._encodeComposite(k,B,T,R))}return A.explicit!==null&&(E=this._encodeComposite(A.explicit,!1,"context",E)),E},d.prototype._encodeChoice=function(w,M){var _=this._baseState,A=_.choice[w.type];return A||n(!1,w.type+" not found in "+JSON.stringify(Object.keys(_.choice))),A._encode(w.value,M)},d.prototype._encodePrimitive=function(w,M){var _=this._baseState;if(/str$/.test(w))return this._encodeStr(M,w);if(w==="objid"&&_.args)return this._encodeObjid(M,_.reverseArgs[0],_.args[1]);if(w==="objid")return this._encodeObjid(M,null,null);if(w==="gentime"||w==="utctime")return this._encodeTime(M,w);if(w==="null_")return this._encodeNull();if(w==="int"||w==="enum")return this._encodeInt(M,_.args&&_.reverseArgs[0]);if(w==="bool")return this._encodeBool(M);if(w==="objDesc")return this._encodeStr(M,w);throw new Error("Unsupported tag: "+w)},d.prototype._isNumstr=function(w){return/^[0-9 ]*$/.test(w)},d.prototype._isPrintstr=function(w){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(w)},vv}var px;function mu(){return px||(px=1,function(e){var t=e;t.Reporter=UA.Reporter,t.DecoderBuffer=cx().DecoderBuffer,t.EncoderBuffer=cx().EncoderBuffer,t.Node=_Y()}(pv)),pv}var gv={},yv={},vx;function EY(){return vx||(vx=1,function(e){var t=jA();e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=t._reverse(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=t._reverse(e.tag)}(yv)),yv}var gx;function jA(){return gx||(gx=1,function(e){var t=e;t._reverse=function(n){var s={};return Object.keys(n).forEach(function(i){(i|0)==i&&(i=i|0);var u=n[i];s[u]=i}),s},t.der=EY()}(gv)),gv}var mv={},wv,yx;function DA(){if(yx)return wv;yx=1;var e=Fe,t=mh(),r=t.base,n=t.bignum,s=t.constants.der;function i(b){this.enc="der",this.name=b.name,this.entity=b,this.tree=new u,this.tree._init(b.body)}wv=i,i.prototype.decode=function(w,M){return w instanceof r.DecoderBuffer||(w=new r.DecoderBuffer(w,M)),this.tree._decode(w,M)};function u(b){r.Node.call(this,"der",b)}e(u,r.Node),u.prototype._peekTag=function(w,M,_){if(w.isEmpty())return!1;var A=w.save(),R=d(w,'Failed to peek tag: "'+M+'"');return w.isError(R)?R:(w.restore(A),R.tag===M||R.tagStr===M||R.tagStr+"of"===M||_)},u.prototype._decodeTag=function(w,M,_){var A=d(w,'Failed to decode tag of "'+M+'"');if(w.isError(A))return A;var R=c(w,A.primitive,'Failed to get length of "'+M+'"');if(w.isError(R))return R;if(!_&&A.tag!==M&&A.tagStr!==M&&A.tagStr+"of"!==M)return w.error('Failed to match tag: "'+M+'"');if(A.primitive||R!==null)return w.skip(R,'Failed to match body of: "'+M+'"');var B=w.save(),I=this._skipUntilEnd(w,'Failed to skip indefinite length body: "'+this.tag+'"');return w.isError(I)?I:(R=w.offset-B.offset,w.restore(B),w.skip(R,'Failed to match body of: "'+M+'"'))},u.prototype._skipUntilEnd=function(w,M){for(;;){var _=d(w,M);if(w.isError(_))return _;var A=c(w,_.primitive,M);if(w.isError(A))return A;var R;if(_.primitive||A!==null?R=w.skip(A):R=this._skipUntilEnd(w,M),w.isError(R))return R;if(_.tagStr==="end")break}},u.prototype._decodeList=function(w,M,_,A){for(var R=[];!w.isEmpty();){var B=this._peekTag(w,"end");if(w.isError(B))return B;var I=_.decode(w,"der",A);if(w.isError(I)&&B)break;R.push(I)}return R},u.prototype._decodeStr=function(w,M){if(M==="bitstr"){var _=w.readUInt8();return w.isError(_)?_:{unused:_,data:w.raw()}}else if(M==="bmpstr"){var A=w.raw();if(A.length%2===1)return w.error("Decoding of string type: bmpstr length mismatch");for(var R="",B=0;B<A.length/2;B++)R+=String.fromCharCode(A.readUInt16BE(B*2));return R}else if(M==="numstr"){var I=w.raw().toString("ascii");return this._isNumstr(I)?I:w.error("Decoding of string type: numstr unsupported characters")}else{if(M==="octstr")return w.raw();if(M==="objDesc")return w.raw();if(M==="printstr"){var E=w.raw().toString("ascii");return this._isPrintstr(E)?E:w.error("Decoding of string type: printstr unsupported characters")}else return/str$/.test(M)?w.raw().toString():w.error("Decoding of string type: "+M+" unsupported")}},u.prototype._decodeObjid=function(w,M,_){for(var A,R=[],B=0;!w.isEmpty();){var I=w.readUInt8();B<<=7,B|=I&127,I&128||(R.push(B),B=0)}I&128&&R.push(B);var E=R[0]/40|0,k=R[0]%40;if(_?A=R:A=[E,k].concat(R.slice(1)),M){var T=M[A.join(" ")];T===void 0&&(T=M[A.join(".")]),T!==void 0&&(A=T)}return A},u.prototype._decodeTime=function(w,M){var _=w.raw().toString();if(M==="gentime")var A=_.slice(0,4)|0,R=_.slice(4,6)|0,B=_.slice(6,8)|0,I=_.slice(8,10)|0,E=_.slice(10,12)|0,k=_.slice(12,14)|0;else if(M==="utctime"){var A=_.slice(0,2)|0,R=_.slice(2,4)|0,B=_.slice(4,6)|0,I=_.slice(6,8)|0,E=_.slice(8,10)|0,k=_.slice(10,12)|0;A<70?A=2e3+A:A=1900+A}else return w.error("Decoding "+M+" time is not supported yet");return Date.UTC(A,R-1,B,I,E,k,0)},u.prototype._decodeNull=function(w){return null},u.prototype._decodeBool=function(w){var M=w.readUInt8();return w.isError(M)?M:M!==0},u.prototype._decodeInt=function(w,M){var _=w.raw(),A=new n(_);return M&&(A=M[A.toString(10)]||A),A},u.prototype._use=function(w,M){return typeof w=="function"&&(w=w(M)),w._getDecoder("der").tree};function d(b,w){var M=b.readUInt8(w);if(b.isError(M))return M;var _=s.tagClass[M>>6],A=(M&32)===0;if((M&31)===31){var R=M;for(M=0;(R&128)===128;){if(R=b.readUInt8(w),b.isError(R))return R;M<<=7,M|=R&127}}else M&=31;var B=s.tag[M];return{cls:_,primitive:A,tag:M,tagStr:B}}function c(b,w,M){var _=b.readUInt8(M);if(b.isError(_))return _;if(!w&&_===128)return null;if(!(_&128))return _;var A=_&127;if(A>4)return b.error("length octect is too long");_=0;for(var R=0;R<A;R++){_<<=8;var B=b.readUInt8(M);if(b.isError(B))return B;_|=B}return _}return wv}var bv,mx;function SY(){if(mx)return bv;mx=1;var e=Fe,t=Kt.Buffer,r=DA();function n(s){r.call(this,s),this.enc="pem"}return e(n,r),bv=n,n.prototype.decode=function(i,u){for(var d=i.toString().split(/[\r\n]+/g),c=u.label.toUpperCase(),b=/^-----(BEGIN|END) ([^-]+)-----$/,w=-1,M=-1,_=0;_<d.length;_++){var A=d[_].match(b);if(A!==null&&A[2]===c)if(w===-1){if(A[1]!=="BEGIN")break;w=_}else{if(A[1]!=="END")break;M=_;break}}if(w===-1||M===-1)throw new Error("PEM section not found for: "+c);var R=d.slice(w+1,M).join("");R.replace(/[^a-z0-9\+\/=]+/gi,"");var B=new t(R,"base64");return r.prototype.decode.call(this,B,u)},bv}var wx;function AY(){return wx||(wx=1,function(e){var t=e;t.der=DA(),t.pem=SY()}(mv)),mv}var xv={},Mv,bx;function qA(){if(bx)return Mv;bx=1;var e=Fe,t=Kt.Buffer,r=mh(),n=r.base,s=r.constants.der;function i(b){this.enc="der",this.name=b.name,this.entity=b,this.tree=new u,this.tree._init(b.body)}Mv=i,i.prototype.encode=function(w,M){return this.tree._encode(w,M).join()};function u(b){n.Node.call(this,"der",b)}e(u,n.Node),u.prototype._encodeComposite=function(w,M,_,A){var R=c(w,M,_,this.reporter);if(A.length<128){var E=new t(2);return E[0]=R,E[1]=A.length,this._createEncoderBuffer([E,A])}for(var B=1,I=A.length;I>=256;I>>=8)B++;var E=new t(2+B);E[0]=R,E[1]=128|B;for(var I=1+B,k=A.length;k>0;I--,k>>=8)E[I]=k&255;return this._createEncoderBuffer([E,A])},u.prototype._encodeStr=function(w,M){if(M==="bitstr")return this._createEncoderBuffer([w.unused|0,w.data]);if(M==="bmpstr"){for(var _=new t(w.length*2),A=0;A<w.length;A++)_.writeUInt16BE(w.charCodeAt(A),A*2);return this._createEncoderBuffer(_)}else return M==="numstr"?this._isNumstr(w)?this._createEncoderBuffer(w):this.reporter.error("Encoding of string type: numstr supports only digits and space"):M==="printstr"?this._isPrintstr(w)?this._createEncoderBuffer(w):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(M)?this._createEncoderBuffer(w):M==="objDesc"?this._createEncoderBuffer(w):this.reporter.error("Encoding of string type: "+M+" unsupported")},u.prototype._encodeObjid=function(w,M,_){if(typeof w=="string"){if(!M)return this.reporter.error("string objid given, but no values map found");if(!M.hasOwnProperty(w))return this.reporter.error("objid not found in values map");w=M[w].split(/[\s\.]+/g);for(var A=0;A<w.length;A++)w[A]|=0}else if(Array.isArray(w)){w=w.slice();for(var A=0;A<w.length;A++)w[A]|=0}if(!Array.isArray(w))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(w));if(!_){if(w[1]>=40)return this.reporter.error("Second objid identifier OOB");w.splice(0,2,w[0]*40+w[1])}for(var R=0,A=0;A<w.length;A++){var B=w[A];for(R++;B>=128;B>>=7)R++}for(var I=new t(R),E=I.length-1,A=w.length-1;A>=0;A--){var B=w[A];for(I[E--]=B&127;(B>>=7)>0;)I[E--]=128|B&127}return this._createEncoderBuffer(I)};function d(b){return b<10?"0"+b:b}u.prototype._encodeTime=function(w,M){var _,A=new Date(w);return M==="gentime"?_=[d(A.getFullYear()),d(A.getUTCMonth()+1),d(A.getUTCDate()),d(A.getUTCHours()),d(A.getUTCMinutes()),d(A.getUTCSeconds()),"Z"].join(""):M==="utctime"?_=[d(A.getFullYear()%100),d(A.getUTCMonth()+1),d(A.getUTCDate()),d(A.getUTCHours()),d(A.getUTCMinutes()),d(A.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+M+" time is not supported yet"),this._encodeStr(_,"octstr")},u.prototype._encodeNull=function(){return this._createEncoderBuffer("")},u.prototype._encodeInt=function(w,M){if(typeof w=="string"){if(!M)return this.reporter.error("String int or enum given, but no values map");if(!M.hasOwnProperty(w))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(w));w=M[w]}if(typeof w!="number"&&!t.isBuffer(w)){var _=w.toArray();!w.sign&&_[0]&128&&_.unshift(0),w=new t(_)}if(t.isBuffer(w)){var A=w.length;w.length===0&&A++;var B=new t(A);return w.copy(B),w.length===0&&(B[0]=0),this._createEncoderBuffer(B)}if(w<128)return this._createEncoderBuffer(w);if(w<256)return this._createEncoderBuffer([0,w]);for(var A=1,R=w;R>=256;R>>=8)A++;for(var B=new Array(A),R=B.length-1;R>=0;R--)B[R]=w&255,w>>=8;return B[0]&128&&B.unshift(0),this._createEncoderBuffer(new t(B))},u.prototype._encodeBool=function(w){return this._createEncoderBuffer(w?255:0)},u.prototype._use=function(w,M){return typeof w=="function"&&(w=w(M)),w._getEncoder("der").tree},u.prototype._skipDefault=function(w,M,_){var A=this._baseState,R;if(A.default===null)return!1;var B=w.join();if(A.defaultBuffer===void 0&&(A.defaultBuffer=this._encodeValue(A.default,M,_).join()),B.length!==A.defaultBuffer.length)return!1;for(R=0;R<B.length;R++)if(B[R]!==A.defaultBuffer[R])return!1;return!0};function c(b,w,M,_){var A;if(b==="seqof"?b="seq":b==="setof"&&(b="set"),s.tagByName.hasOwnProperty(b))A=s.tagByName[b];else if(typeof b=="number"&&(b|0)===b)A=b;else return _.error("Unknown tag: "+b);return A>=31?_.error("Multi-octet tag encoding unsupported"):(w||(A|=32),A|=s.tagClassByName[M||"universal"]<<6,A)}return Mv}var _v,xx;function kY(){if(xx)return _v;xx=1;var e=Fe,t=qA();function r(n){t.call(this,n),this.enc="pem"}return e(r,t),_v=r,r.prototype.encode=function(s,i){for(var u=t.prototype.encode.call(this,s),d=u.toString("base64"),c=["-----BEGIN "+i.label+"-----"],b=0;b<d.length;b+=64)c.push(d.slice(b,b+64));return c.push("-----END "+i.label+"-----"),c.join(`
58
- `)},_v}var Mx;function BY(){return Mx||(Mx=1,function(e){var t=e;t.der=qA(),t.pem=kY()}(xv)),xv}var _x;function mh(){return _x||(_x=1,function(e){var t=e;t.bignum=yY,t.define=xY().define,t.base=mu(),t.constants=jA(),t.decoders=AY(),t.encoders=BY()}(cv)),cv}var ni=mh(),Ex=ni.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),RY=ni.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),Dw=ni.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),$Y=ni.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(Dw),this.key("subjectPublicKey").bitstr())}),NY=ni.define("RelativeDistinguishedName",function(){this.setof(RY)}),TY=ni.define("RDNSequence",function(){this.seqof(NY)}),Sx=ni.define("Name",function(){this.choice({rdnSequence:this.use(TY)})}),IY=ni.define("Validity",function(){this.seq().obj(this.key("notBefore").use(Ex),this.key("notAfter").use(Ex))}),CY=ni.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),PY=ni.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(Dw),this.key("issuer").use(Sx),this.key("validity").use(IY),this.key("subject").use(Sx),this.key("subjectPublicKeyInfo").use($Y),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(CY).optional())}),LY=ni.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(PY),this.key("signatureAlgorithm").use(Dw),this.key("signatureValue").bitstr())}),OY=LY,ii=mh();ri.certificate=OY;var UY=ii.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});ri.RSAPrivateKey=UY;var jY=ii.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});ri.RSAPublicKey=jY;var FA=ii.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),DY=ii.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(FA),this.key("subjectPublicKey").bitstr())});ri.PublicKey=DY;var qY=ii.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(FA),this.key("subjectPrivateKey").octstr())});ri.PrivateKey=qY;var FY=ii.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});ri.EncryptedPrivateKey=FY;var HY=ii.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});ri.DSAPrivateKey=HY;ri.DSAparam=ii.define("DSAparam",function(){this.int()});var zY=ii.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),WY=ii.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(zY),this.key("publicKey").optional().explicit(1).bitstr())});ri.ECPrivateKey=WY;ri.signature=ii.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())});const VY={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"};var KY=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,ZY=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,GY=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,JY=Ud,YY=dn,Qh=Ye.Buffer,XY=function(e,t){var r=e.toString(),n=r.match(KY),s;if(n){var u="aes"+n[1],d=Qh.from(n[2],"hex"),c=Qh.from(n[3].replace(/[\r\n]/g,""),"base64"),b=JY(t,d.slice(0,8),parseInt(n[1],10)).key,w=[],M=YY.createDecipheriv(u,b,d);w.push(M.update(c)),w.push(M.final()),s=Qh.concat(w)}else{var i=r.match(GY);s=Qh.from(i[2].replace(/[\r\n]/g,""),"base64")}var _=r.match(ZY)[1];return{tag:_,data:s}},Kr=ri,QY=VY,eX=XY,tX=dn,rX=Pd.pbkdf2Sync,Ty=Ye.Buffer;function nX(e,t){var r=e.algorithm.decrypt.kde.kdeparams.salt,n=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),s=QY[e.algorithm.decrypt.cipher.algo.join(".")],i=e.algorithm.decrypt.cipher.iv,u=e.subjectPrivateKey,d=parseInt(s.split("-")[1],10)/8,c=rX(t,r,n,d,"sha1"),b=tX.createDecipheriv(s,c,i),w=[];return w.push(b.update(u)),w.push(b.final()),Ty.concat(w)}function HA(e){var t;typeof e=="object"&&!Ty.isBuffer(e)&&(t=e.passphrase,e=e.key),typeof e=="string"&&(e=Ty.from(e));var r=eX(e,t),n=r.tag,s=r.data,i,u;switch(n){case"CERTIFICATE":u=Kr.certificate.decode(s,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(u||(u=Kr.PublicKey.decode(s,"der")),i=u.algorithm.algorithm.join("."),i){case"1.2.840.113549.1.1.1":return Kr.RSAPublicKey.decode(u.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return u.subjectPrivateKey=u.subjectPublicKey,{type:"ec",data:u};case"1.2.840.10040.4.1":return u.algorithm.params.pub_key=Kr.DSAparam.decode(u.subjectPublicKey.data,"der"),{type:"dsa",data:u.algorithm.params};default:throw new Error("unknown key id "+i)}case"ENCRYPTED PRIVATE KEY":s=Kr.EncryptedPrivateKey.decode(s,"der"),s=nX(s,t);case"PRIVATE KEY":switch(u=Kr.PrivateKey.decode(s,"der"),i=u.algorithm.algorithm.join("."),i){case"1.2.840.113549.1.1.1":return Kr.RSAPrivateKey.decode(u.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:u.algorithm.curve,privateKey:Kr.ECPrivateKey.decode(u.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return u.algorithm.params.priv_key=Kr.DSAparam.decode(u.subjectPrivateKey,"der"),{type:"dsa",params:u.algorithm.params};default:throw new Error("unknown key id "+i)}case"RSA PUBLIC KEY":return Kr.RSAPublicKey.decode(s,"der");case"RSA PRIVATE KEY":return Kr.RSAPrivateKey.decode(s,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:Kr.DSAPrivateKey.decode(s,"der")};case"EC PRIVATE KEY":return s=Kr.ECPrivateKey.decode(s,"der"),{curve:s.parameters.value,privateKey:s.privateKey};default:throw new Error("unknown key type "+n)}}HA.signature=Kr.signature;var Yd=HA;const zA={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"};var Ax;function iX(){if(Ax)return Jl.exports;Ax=1;var e=Ye.Buffer,t=cS,r=Tw,n=Uw().ec,s=Nw,i=Yd,u=zA,d=1;function c(E,k,T,L,q){var z=i(k);if(z.curve){if(L!=="ecdsa"&&L!=="ecdsa/rsa")throw new Error("wrong private key type");return b(E,z)}else if(z.type==="dsa"){if(L!=="dsa")throw new Error("wrong private key type");return w(E,z,T)}if(L!=="rsa"&&L!=="ecdsa/rsa")throw new Error("wrong private key type");if(k.padding!==void 0&&k.padding!==d)throw new Error("illegal or unsupported padding mode");E=e.concat([q,E]);for(var J=z.modulus.byteLength(),F=[0,1];E.length+F.length+1<J;)F.push(255);F.push(0);for(var X=-1;++X<E.length;)F.push(E[X]);var ee=r(F,z);return ee}function b(E,k){var T=u[k.curve.join(".")];if(!T)throw new Error("unknown curve "+k.curve.join("."));var L=new n(T),q=L.keyFromPrivate(k.privateKey),z=q.sign(E);return e.from(z.toDER())}function w(E,k,T){for(var L=k.params.priv_key,q=k.params.p,z=k.params.q,J=k.params.g,F=new s(0),X,ee=A(E,z).mod(z),x=!1,o=_(L,z,E,T);x===!1;)X=B(z,o,T),F=I(J,X,q,z),x=X.invm(z).imul(ee.add(L.mul(F))).mod(z),x.cmpn(0)===0&&(x=!1,F=new s(0));return M(F,x)}function M(E,k){E=E.toArray(),k=k.toArray(),E[0]&128&&(E=[0].concat(E)),k[0]&128&&(k=[0].concat(k));var T=E.length+k.length+4,L=[48,T,2,E.length];return L=L.concat(E,[2,k.length],k),e.from(L)}function _(E,k,T,L){if(E=e.from(E.toArray()),E.length<k.byteLength()){var q=e.alloc(k.byteLength()-E.length);E=e.concat([q,E])}var z=T.length,J=R(T,k),F=e.alloc(z);F.fill(1);var X=e.alloc(z);return X=t(L,X).update(F).update(e.from([0])).update(E).update(J).digest(),F=t(L,X).update(F).digest(),X=t(L,X).update(F).update(e.from([1])).update(E).update(J).digest(),F=t(L,X).update(F).digest(),{k:X,v:F}}function A(E,k){var T=new s(E),L=(E.length<<3)-k.bitLength();return L>0&&T.ishrn(L),T}function R(E,k){E=A(E,k),E=E.mod(k);var T=e.from(E.toArray());if(T.length<k.byteLength()){var L=e.alloc(k.byteLength()-T.length);T=e.concat([L,T])}return T}function B(E,k,T){var L,q;do{for(L=e.alloc(0);L.length*8<E.bitLength();)k.v=t(T,k.k).update(k.v).digest(),L=e.concat([L,k.v]);q=A(L,E),k.k=t(T,k.k).update(k.v).update(e.from([0])).digest(),k.v=t(T,k.k).update(k.v).digest()}while(q.cmp(E)!==-1);return q}function I(E,k,T,L){return E.toRed(s.mont(T)).redPow(k).fromRed().mod(L)}return Jl.exports=c,Jl.exports.getKey=_,Jl.exports.makeKey=B,Jl.exports}var Ev,kx;function oX(){if(kx)return Ev;kx=1;var e=Ye.Buffer,t=Nw,r=Uw().ec,n=Yd,s=zA;function i(b,w,M,_,A){var R=n(M);if(R.type==="ec"){if(_!=="ecdsa"&&_!=="ecdsa/rsa")throw new Error("wrong public key type");return u(b,w,R)}else if(R.type==="dsa"){if(_!=="dsa")throw new Error("wrong public key type");return d(b,w,R)}if(_!=="rsa"&&_!=="ecdsa/rsa")throw new Error("wrong public key type");w=e.concat([A,w]);for(var B=R.modulus.byteLength(),I=[1],E=0;w.length+I.length+2<B;)I.push(255),E+=1;I.push(0);for(var k=-1;++k<w.length;)I.push(w[k]);I=e.from(I);var T=t.mont(R.modulus);b=new t(b).toRed(T),b=b.redPow(new t(R.publicExponent)),b=e.from(b.fromRed().toArray());var L=E<8?1:0;for(B=Math.min(b.length,I.length),b.length!==I.length&&(L=1),k=-1;++k<B;)L|=b[k]^I[k];return L===0}function u(b,w,M){var _=s[M.data.algorithm.curve.join(".")];if(!_)throw new Error("unknown curve "+M.data.algorithm.curve.join("."));var A=new r(_),R=M.data.subjectPrivateKey.data;return A.verify(w,b,R)}function d(b,w,M){var _=M.data.p,A=M.data.q,R=M.data.g,B=M.data.pub_key,I=n.signature.decode(b,"der"),E=I.s,k=I.r;c(E,A),c(k,A);var T=t.mont(_),L=E.invm(A),q=R.toRed(T).redPow(new t(w).mul(L).mod(A)).fromRed().mul(B.toRed(T).redPow(k.mul(L).mod(A)).fromRed()).mod(_).mod(A);return q.cmp(k)===0}function c(b,w){if(b.cmpn(0)<=0)throw new Error("invalid sig");if(b.cmp(w)>=0)throw new Error("invalid sig")}return Ev=i,Ev}var Sv,Bx;function sX(){if(Bx)return Sv;Bx=1;var e=Ye.Buffer,t=uh,r=cG,n=Fe,s=iX(),i=oX(),u=dS;Object.keys(u).forEach(function(M){u[M].id=e.from(u[M].id,"hex"),u[M.toLowerCase()]=u[M]});function d(M){r.Writable.call(this);var _=u[M];if(!_)throw new Error("Unknown message digest");this._hashType=_.hash,this._hash=t(_.hash),this._tag=_.id,this._signType=_.sign}n(d,r.Writable),d.prototype._write=function(_,A,R){this._hash.update(_),R()},d.prototype.update=function(_,A){return this._hash.update(typeof _=="string"?e.from(_,A):_),this},d.prototype.sign=function(_,A){this.end();var R=this._hash.digest(),B=s(R,_,this._hashType,this._signType,this._tag);return A?B.toString(A):B};function c(M){r.Writable.call(this);var _=u[M];if(!_)throw new Error("Unknown message digest");this._hash=t(_.hash),this._tag=_.id,this._signType=_.sign}n(c,r.Writable),c.prototype._write=function(_,A,R){this._hash.update(_),R()},c.prototype.update=function(_,A){return this._hash.update(typeof _=="string"?e.from(_,A):_),this},c.prototype.verify=function(_,A,R){var B=typeof A=="string"?e.from(A,R):A;this.end();var I=this._hash.digest();return i(B,I,_,this._signType,this._tag)};function b(M){return new d(M)}function w(M){return new c(M)}return Sv={Sign:b,Verify:w,createSign:b,createVerify:w},Sv}var qw={exports:{}};qw.exports;(function(e){(function(t,r){function n(x,o){if(!x)throw new Error(o||"Assertion failed")}function s(x,o){x.super_=o;var f=function(){};f.prototype=o.prototype,x.prototype=new f,x.prototype.constructor=x}function i(x,o,f){if(i.isBN(x))return x;this.negative=0,this.words=null,this.length=0,this.red=null,x!==null&&((o==="le"||o==="be")&&(f=o,o=10),this._init(x||0,o||10,f||"be"))}typeof t=="object"?t.exports=i:r.BN=i,i.BN=i,i.wordSize=26;var u;try{typeof window<"u"&&typeof window.Buffer<"u"?u=window.Buffer:u=Kt.Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,f){return o.cmp(f)>0?o:f},i.min=function(o,f){return o.cmp(f)<0?o:f},i.prototype._init=function(o,f,l){if(typeof o=="number")return this._initNumber(o,f,l);if(typeof o=="object")return this._initArray(o,f,l);f==="hex"&&(f=16),n(f===(f|0)&&f>=2&&f<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h<o.length&&(f===16?this._parseHex(o,h,l):(this._parseBase(o,f,h),l==="le"&&this._initArray(this.toArray(),f,l)))},i.prototype._initNumber=function(o,f,l){o<0&&(this.negative=1,o=-o),o<67108864?(this.words=[o&67108863],this.length=1):o<4503599627370496?(this.words=[o&67108863,o/67108864&67108863],this.length=2):(n(o<9007199254740992),this.words=[o&67108863,o/67108864&67108863,1],this.length=3),l==="le"&&this._initArray(this.toArray(),f,l)},i.prototype._initArray=function(o,f,l){if(n(typeof o.length=="number"),o.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(o.length/3),this.words=new Array(this.length);for(var h=0;h<this.length;h++)this.words[h]=0;var v,y,m=0;if(l==="be")for(h=o.length-1,v=0;h>=0;h-=3)y=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[v]|=y<<m&67108863,this.words[v+1]=y>>>26-m&67108863,m+=24,m>=26&&(m-=26,v++);else if(l==="le")for(h=0,v=0;h<o.length;h+=3)y=o[h]|o[h+1]<<8|o[h+2]<<16,this.words[v]|=y<<m&67108863,this.words[v+1]=y>>>26-m&67108863,m+=24,m>=26&&(m-=26,v++);return this.strip()};function d(x,o){var f=x.charCodeAt(o);return f>=65&&f<=70?f-55:f>=97&&f<=102?f-87:f-48&15}function c(x,o,f){var l=d(x,f);return f-1>=o&&(l|=d(x,f-1)<<4),l}i.prototype._parseHex=function(o,f,l){this.length=Math.ceil((o.length-f)/6),this.words=new Array(this.length);for(var h=0;h<this.length;h++)this.words[h]=0;var v=0,y=0,m;if(l==="be")for(h=o.length-1;h>=f;h-=2)m=c(o,f,h)<<v,this.words[y]|=m&67108863,v>=18?(v-=18,y+=1,this.words[y]|=m>>>26):v+=8;else{var p=o.length-f;for(h=p%2===0?f+1:f;h<o.length;h+=2)m=c(o,f,h)<<v,this.words[y]|=m&67108863,v>=18?(v-=18,y+=1,this.words[y]|=m>>>26):v+=8}this.strip()};function b(x,o,f,l){for(var h=0,v=Math.min(x.length,f),y=o;y<v;y++){var m=x.charCodeAt(y)-48;h*=l,m>=49?h+=m-49+10:m>=17?h+=m-17+10:h+=m}return h}i.prototype._parseBase=function(o,f,l){this.words=[0],this.length=1;for(var h=0,v=1;v<=67108863;v*=f)h++;h--,v=v/f|0;for(var y=o.length-l,m=y%h,p=Math.min(y,y-m)+l,a=0,g=l;g<p;g+=h)a=b(o,g,g+h,f),this.imuln(v),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(m!==0){var S=1;for(a=b(o,g,o.length,f),g=0;g<m;g++)S*=f;this.imuln(S),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}this.strip()},i.prototype.copy=function(o){o.words=new Array(this.length);for(var f=0;f<this.length;f++)o.words[f]=this.words[f];o.length=this.length,o.negative=this.negative,o.red=this.red},i.prototype.clone=function(){var o=new i(null);return this.copy(o),o},i.prototype._expand=function(o){for(;this.length<o;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var w=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],M=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[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];i.prototype.toString=function(o,f){o=o||10,f=f|0||1;var l;if(o===16||o==="hex"){l="";for(var h=0,v=0,y=0;y<this.length;y++){var m=this.words[y],p=((m<<h|v)&16777215).toString(16);v=m>>>24-h&16777215,h+=2,h>=26&&(h-=26,y--),v!==0||y!==this.length-1?l=w[6-p.length]+p+l:l=p+l}for(v!==0&&(l=v.toString(16)+l);l.length%f!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(o===(o|0)&&o>=2&&o<=36){var a=M[o],g=_[o];l="";var S=this.clone();for(S.negative=0;!S.isZero();){var N=S.modn(g).toString(o);S=S.idivn(g),S.isZero()?l=N+l:l=w[a-N.length]+N+l}for(this.isZero()&&(l="0"+l);l.length%f!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,f){return n(typeof u<"u"),this.toArrayLike(u,o,f)},i.prototype.toArray=function(o,f){return this.toArrayLike(Array,o,f)},i.prototype.toArrayLike=function(o,f,l){var h=this.byteLength(),v=l||Math.max(1,h);n(h<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var y=f==="le",m=new o(v),p,a,g=this.clone();if(y){for(a=0;!g.isZero();a++)p=g.andln(255),g.iushrn(8),m[a]=p;for(;a<v;a++)m[a]=0}else{for(a=0;a<v-h;a++)m[a]=0;for(a=0;!g.isZero();a++)p=g.andln(255),g.iushrn(8),m[v-a-1]=p}return m},Math.clz32?i.prototype._countBits=function(o){return 32-Math.clz32(o)}:i.prototype._countBits=function(o){var f=o,l=0;return f>=4096&&(l+=13,f>>>=13),f>=64&&(l+=7,f>>>=7),f>=8&&(l+=4,f>>>=4),f>=2&&(l+=2,f>>>=2),l+f},i.prototype._zeroBits=function(o){if(o===0)return 26;var f=o,l=0;return f&8191||(l+=13,f>>>=13),f&127||(l+=7,f>>>=7),f&15||(l+=4,f>>>=4),f&3||(l+=2,f>>>=2),f&1||l++,l},i.prototype.bitLength=function(){var o=this.words[this.length-1],f=this._countBits(o);return(this.length-1)*26+f};function A(x){for(var o=new Array(x.bitLength()),f=0;f<o.length;f++){var l=f/26|0,h=f%26;o[f]=(x.words[l]&1<<h)>>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,f=0;f<this.length;f++){var l=this._zeroBits(this.words[f]);if(o+=l,l!==26)break}return o},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(o){return this.negative!==0?this.abs().inotn(o).iaddn(1):this.clone()},i.prototype.fromTwos=function(o){return this.testn(o-1)?this.notn(o).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(o){for(;this.length<o.length;)this.words[this.length++]=0;for(var f=0;f<o.length;f++)this.words[f]=this.words[f]|o.words[f];return this.strip()},i.prototype.ior=function(o){return n((this.negative|o.negative)===0),this.iuor(o)},i.prototype.or=function(o){return this.length>o.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var f;this.length>o.length?f=o:f=this;for(var l=0;l<f.length;l++)this.words[l]=this.words[l]&o.words[l];return this.length=f.length,this.strip()},i.prototype.iand=function(o){return n((this.negative|o.negative)===0),this.iuand(o)},i.prototype.and=function(o){return this.length>o.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var f,l;this.length>o.length?(f=this,l=o):(f=o,l=this);for(var h=0;h<l.length;h++)this.words[h]=f.words[h]^l.words[h];if(this!==f)for(;h<f.length;h++)this.words[h]=f.words[h];return this.length=f.length,this.strip()},i.prototype.ixor=function(o){return n((this.negative|o.negative)===0),this.iuxor(o)},i.prototype.xor=function(o){return this.length>o.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var f=Math.ceil(o/26)|0,l=o%26;this._expand(f),l>0&&f--;for(var h=0;h<f;h++)this.words[h]=~this.words[h]&67108863;return l>0&&(this.words[h]=~this.words[h]&67108863>>26-l),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,f){n(typeof o=="number"&&o>=0);var l=o/26|0,h=o%26;return this._expand(l+1),f?this.words[l]=this.words[l]|1<<h:this.words[l]=this.words[l]&~(1<<h),this.strip()},i.prototype.iadd=function(o){var f;if(this.negative!==0&&o.negative===0)return this.negative=0,f=this.isub(o),this.negative^=1,this._normSign();if(this.negative===0&&o.negative!==0)return o.negative=0,f=this.isub(o),o.negative=1,f._normSign();var l,h;this.length>o.length?(l=this,h=o):(l=o,h=this);for(var v=0,y=0;y<h.length;y++)f=(l.words[y]|0)+(h.words[y]|0)+v,this.words[y]=f&67108863,v=f>>>26;for(;v!==0&&y<l.length;y++)f=(l.words[y]|0)+v,this.words[y]=f&67108863,v=f>>>26;if(this.length=l.length,v!==0)this.words[this.length]=v,this.length++;else if(l!==this)for(;y<l.length;y++)this.words[y]=l.words[y];return this},i.prototype.add=function(o){var f;return o.negative!==0&&this.negative===0?(o.negative=0,f=this.sub(o),o.negative^=1,f):o.negative===0&&this.negative!==0?(this.negative=0,f=o.sub(this),this.negative=1,f):this.length>o.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var f=this.iadd(o);return o.negative=1,f._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var l=this.cmp(o);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,v;l>0?(h=this,v=o):(h=o,v=this);for(var y=0,m=0;m<v.length;m++)f=(h.words[m]|0)-(v.words[m]|0)+y,y=f>>26,this.words[m]=f&67108863;for(;y!==0&&m<h.length;m++)f=(h.words[m]|0)+y,y=f>>26,this.words[m]=f&67108863;if(y===0&&m<h.length&&h!==this)for(;m<h.length;m++)this.words[m]=h.words[m];return this.length=Math.max(this.length,m),h!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(o){return this.clone().isub(o)};function R(x,o,f){f.negative=o.negative^x.negative;var l=x.length+o.length|0;f.length=l,l=l-1|0;var h=x.words[0]|0,v=o.words[0]|0,y=h*v,m=y&67108863,p=y/67108864|0;f.words[0]=m;for(var a=1;a<l;a++){for(var g=p>>>26,S=p&67108863,N=Math.min(a,o.length-1),U=Math.max(0,a-x.length+1);U<=N;U++){var Z=a-U|0;h=x.words[Z]|0,v=o.words[U]|0,y=h*v+S,g+=y/67108864|0,S=y&67108863}f.words[a]=S|0,p=g|0}return p!==0?f.words[a]=p|0:f.length--,f.strip()}var B=function(o,f,l){var h=o.words,v=f.words,y=l.words,m=0,p,a,g,S=h[0]|0,N=S&8191,U=S>>>13,Z=h[1]|0,H=Z&8191,$=Z>>>13,P=h[2]|0,W=P&8191,G=P>>>13,K=h[3]|0,O=K&8191,Q=K>>>13,de=h[4]|0,oe=de&8191,se=de>>>13,Ie=h[5]|0,fe=Ie&8191,ne=Ie>>>13,je=h[6]|0,ae=je&8191,le=je>>>13,Le=h[7]|0,he=Le&8191,_e=Le>>>13,He=h[8]|0,ye=He&8191,Ae=He>>>13,ze=h[9]|0,me=ze&8191,ge=ze>>>13,Ke=v[0]|0,we=Ke&8191,Be=Ke>>>13,We=v[1]|0,be=We&8191,ke=We>>>13,Ze=v[2]|0,pe=Ze&8191,Ne=Ze>>>13,Qe=v[3]|0,xe=Qe&8191,Re=Qe>>>13,Xe=v[4]|0,Ee=Xe&8191,$e=Xe>>>13,tt=v[5]|0,D=tt&8191,C=tt>>>13,j=v[6]|0,Y=j&8191,te=j>>>13,ue=v[7]|0,re=ue&8191,ve=ue>>>13,De=v[8]|0,ce=De&8191,Me=De>>>13,Oe=v[9]|0,Se=Oe&8191,Te=Oe>>>13;l.negative=o.negative^f.negative,l.length=19,p=Math.imul(N,we),a=Math.imul(N,Be),a=a+Math.imul(U,we)|0,g=Math.imul(U,Be);var Ge=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,p=Math.imul(H,we),a=Math.imul(H,Be),a=a+Math.imul($,we)|0,g=Math.imul($,Be),p=p+Math.imul(N,be)|0,a=a+Math.imul(N,ke)|0,a=a+Math.imul(U,be)|0,g=g+Math.imul(U,ke)|0;var Je=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Je>>>26)|0,Je&=67108863,p=Math.imul(W,we),a=Math.imul(W,Be),a=a+Math.imul(G,we)|0,g=Math.imul(G,Be),p=p+Math.imul(H,be)|0,a=a+Math.imul(H,ke)|0,a=a+Math.imul($,be)|0,g=g+Math.imul($,ke)|0,p=p+Math.imul(N,pe)|0,a=a+Math.imul(N,Ne)|0,a=a+Math.imul(U,pe)|0,g=g+Math.imul(U,Ne)|0;var pt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(pt>>>26)|0,pt&=67108863,p=Math.imul(O,we),a=Math.imul(O,Be),a=a+Math.imul(Q,we)|0,g=Math.imul(Q,Be),p=p+Math.imul(W,be)|0,a=a+Math.imul(W,ke)|0,a=a+Math.imul(G,be)|0,g=g+Math.imul(G,ke)|0,p=p+Math.imul(H,pe)|0,a=a+Math.imul(H,Ne)|0,a=a+Math.imul($,pe)|0,g=g+Math.imul($,Ne)|0,p=p+Math.imul(N,xe)|0,a=a+Math.imul(N,Re)|0,a=a+Math.imul(U,xe)|0,g=g+Math.imul(U,Re)|0;var vt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(vt>>>26)|0,vt&=67108863,p=Math.imul(oe,we),a=Math.imul(oe,Be),a=a+Math.imul(se,we)|0,g=Math.imul(se,Be),p=p+Math.imul(O,be)|0,a=a+Math.imul(O,ke)|0,a=a+Math.imul(Q,be)|0,g=g+Math.imul(Q,ke)|0,p=p+Math.imul(W,pe)|0,a=a+Math.imul(W,Ne)|0,a=a+Math.imul(G,pe)|0,g=g+Math.imul(G,Ne)|0,p=p+Math.imul(H,xe)|0,a=a+Math.imul(H,Re)|0,a=a+Math.imul($,xe)|0,g=g+Math.imul($,Re)|0,p=p+Math.imul(N,Ee)|0,a=a+Math.imul(N,$e)|0,a=a+Math.imul(U,Ee)|0,g=g+Math.imul(U,$e)|0;var gt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(gt>>>26)|0,gt&=67108863,p=Math.imul(fe,we),a=Math.imul(fe,Be),a=a+Math.imul(ne,we)|0,g=Math.imul(ne,Be),p=p+Math.imul(oe,be)|0,a=a+Math.imul(oe,ke)|0,a=a+Math.imul(se,be)|0,g=g+Math.imul(se,ke)|0,p=p+Math.imul(O,pe)|0,a=a+Math.imul(O,Ne)|0,a=a+Math.imul(Q,pe)|0,g=g+Math.imul(Q,Ne)|0,p=p+Math.imul(W,xe)|0,a=a+Math.imul(W,Re)|0,a=a+Math.imul(G,xe)|0,g=g+Math.imul(G,Re)|0,p=p+Math.imul(H,Ee)|0,a=a+Math.imul(H,$e)|0,a=a+Math.imul($,Ee)|0,g=g+Math.imul($,$e)|0,p=p+Math.imul(N,D)|0,a=a+Math.imul(N,C)|0,a=a+Math.imul(U,D)|0,g=g+Math.imul(U,C)|0;var yt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(yt>>>26)|0,yt&=67108863,p=Math.imul(ae,we),a=Math.imul(ae,Be),a=a+Math.imul(le,we)|0,g=Math.imul(le,Be),p=p+Math.imul(fe,be)|0,a=a+Math.imul(fe,ke)|0,a=a+Math.imul(ne,be)|0,g=g+Math.imul(ne,ke)|0,p=p+Math.imul(oe,pe)|0,a=a+Math.imul(oe,Ne)|0,a=a+Math.imul(se,pe)|0,g=g+Math.imul(se,Ne)|0,p=p+Math.imul(O,xe)|0,a=a+Math.imul(O,Re)|0,a=a+Math.imul(Q,xe)|0,g=g+Math.imul(Q,Re)|0,p=p+Math.imul(W,Ee)|0,a=a+Math.imul(W,$e)|0,a=a+Math.imul(G,Ee)|0,g=g+Math.imul(G,$e)|0,p=p+Math.imul(H,D)|0,a=a+Math.imul(H,C)|0,a=a+Math.imul($,D)|0,g=g+Math.imul($,C)|0,p=p+Math.imul(N,Y)|0,a=a+Math.imul(N,te)|0,a=a+Math.imul(U,Y)|0,g=g+Math.imul(U,te)|0;var mt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(mt>>>26)|0,mt&=67108863,p=Math.imul(he,we),a=Math.imul(he,Be),a=a+Math.imul(_e,we)|0,g=Math.imul(_e,Be),p=p+Math.imul(ae,be)|0,a=a+Math.imul(ae,ke)|0,a=a+Math.imul(le,be)|0,g=g+Math.imul(le,ke)|0,p=p+Math.imul(fe,pe)|0,a=a+Math.imul(fe,Ne)|0,a=a+Math.imul(ne,pe)|0,g=g+Math.imul(ne,Ne)|0,p=p+Math.imul(oe,xe)|0,a=a+Math.imul(oe,Re)|0,a=a+Math.imul(se,xe)|0,g=g+Math.imul(se,Re)|0,p=p+Math.imul(O,Ee)|0,a=a+Math.imul(O,$e)|0,a=a+Math.imul(Q,Ee)|0,g=g+Math.imul(Q,$e)|0,p=p+Math.imul(W,D)|0,a=a+Math.imul(W,C)|0,a=a+Math.imul(G,D)|0,g=g+Math.imul(G,C)|0,p=p+Math.imul(H,Y)|0,a=a+Math.imul(H,te)|0,a=a+Math.imul($,Y)|0,g=g+Math.imul($,te)|0,p=p+Math.imul(N,re)|0,a=a+Math.imul(N,ve)|0,a=a+Math.imul(U,re)|0,g=g+Math.imul(U,ve)|0;var wt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(wt>>>26)|0,wt&=67108863,p=Math.imul(ye,we),a=Math.imul(ye,Be),a=a+Math.imul(Ae,we)|0,g=Math.imul(Ae,Be),p=p+Math.imul(he,be)|0,a=a+Math.imul(he,ke)|0,a=a+Math.imul(_e,be)|0,g=g+Math.imul(_e,ke)|0,p=p+Math.imul(ae,pe)|0,a=a+Math.imul(ae,Ne)|0,a=a+Math.imul(le,pe)|0,g=g+Math.imul(le,Ne)|0,p=p+Math.imul(fe,xe)|0,a=a+Math.imul(fe,Re)|0,a=a+Math.imul(ne,xe)|0,g=g+Math.imul(ne,Re)|0,p=p+Math.imul(oe,Ee)|0,a=a+Math.imul(oe,$e)|0,a=a+Math.imul(se,Ee)|0,g=g+Math.imul(se,$e)|0,p=p+Math.imul(O,D)|0,a=a+Math.imul(O,C)|0,a=a+Math.imul(Q,D)|0,g=g+Math.imul(Q,C)|0,p=p+Math.imul(W,Y)|0,a=a+Math.imul(W,te)|0,a=a+Math.imul(G,Y)|0,g=g+Math.imul(G,te)|0,p=p+Math.imul(H,re)|0,a=a+Math.imul(H,ve)|0,a=a+Math.imul($,re)|0,g=g+Math.imul($,ve)|0,p=p+Math.imul(N,ce)|0,a=a+Math.imul(N,Me)|0,a=a+Math.imul(U,ce)|0,g=g+Math.imul(U,Me)|0;var bt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(bt>>>26)|0,bt&=67108863,p=Math.imul(me,we),a=Math.imul(me,Be),a=a+Math.imul(ge,we)|0,g=Math.imul(ge,Be),p=p+Math.imul(ye,be)|0,a=a+Math.imul(ye,ke)|0,a=a+Math.imul(Ae,be)|0,g=g+Math.imul(Ae,ke)|0,p=p+Math.imul(he,pe)|0,a=a+Math.imul(he,Ne)|0,a=a+Math.imul(_e,pe)|0,g=g+Math.imul(_e,Ne)|0,p=p+Math.imul(ae,xe)|0,a=a+Math.imul(ae,Re)|0,a=a+Math.imul(le,xe)|0,g=g+Math.imul(le,Re)|0,p=p+Math.imul(fe,Ee)|0,a=a+Math.imul(fe,$e)|0,a=a+Math.imul(ne,Ee)|0,g=g+Math.imul(ne,$e)|0,p=p+Math.imul(oe,D)|0,a=a+Math.imul(oe,C)|0,a=a+Math.imul(se,D)|0,g=g+Math.imul(se,C)|0,p=p+Math.imul(O,Y)|0,a=a+Math.imul(O,te)|0,a=a+Math.imul(Q,Y)|0,g=g+Math.imul(Q,te)|0,p=p+Math.imul(W,re)|0,a=a+Math.imul(W,ve)|0,a=a+Math.imul(G,re)|0,g=g+Math.imul(G,ve)|0,p=p+Math.imul(H,ce)|0,a=a+Math.imul(H,Me)|0,a=a+Math.imul($,ce)|0,g=g+Math.imul($,Me)|0,p=p+Math.imul(N,Se)|0,a=a+Math.imul(N,Te)|0,a=a+Math.imul(U,Se)|0,g=g+Math.imul(U,Te)|0;var xt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(xt>>>26)|0,xt&=67108863,p=Math.imul(me,be),a=Math.imul(me,ke),a=a+Math.imul(ge,be)|0,g=Math.imul(ge,ke),p=p+Math.imul(ye,pe)|0,a=a+Math.imul(ye,Ne)|0,a=a+Math.imul(Ae,pe)|0,g=g+Math.imul(Ae,Ne)|0,p=p+Math.imul(he,xe)|0,a=a+Math.imul(he,Re)|0,a=a+Math.imul(_e,xe)|0,g=g+Math.imul(_e,Re)|0,p=p+Math.imul(ae,Ee)|0,a=a+Math.imul(ae,$e)|0,a=a+Math.imul(le,Ee)|0,g=g+Math.imul(le,$e)|0,p=p+Math.imul(fe,D)|0,a=a+Math.imul(fe,C)|0,a=a+Math.imul(ne,D)|0,g=g+Math.imul(ne,C)|0,p=p+Math.imul(oe,Y)|0,a=a+Math.imul(oe,te)|0,a=a+Math.imul(se,Y)|0,g=g+Math.imul(se,te)|0,p=p+Math.imul(O,re)|0,a=a+Math.imul(O,ve)|0,a=a+Math.imul(Q,re)|0,g=g+Math.imul(Q,ve)|0,p=p+Math.imul(W,ce)|0,a=a+Math.imul(W,Me)|0,a=a+Math.imul(G,ce)|0,g=g+Math.imul(G,Me)|0,p=p+Math.imul(H,Se)|0,a=a+Math.imul(H,Te)|0,a=a+Math.imul($,Se)|0,g=g+Math.imul($,Te)|0;var Mt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,p=Math.imul(me,pe),a=Math.imul(me,Ne),a=a+Math.imul(ge,pe)|0,g=Math.imul(ge,Ne),p=p+Math.imul(ye,xe)|0,a=a+Math.imul(ye,Re)|0,a=a+Math.imul(Ae,xe)|0,g=g+Math.imul(Ae,Re)|0,p=p+Math.imul(he,Ee)|0,a=a+Math.imul(he,$e)|0,a=a+Math.imul(_e,Ee)|0,g=g+Math.imul(_e,$e)|0,p=p+Math.imul(ae,D)|0,a=a+Math.imul(ae,C)|0,a=a+Math.imul(le,D)|0,g=g+Math.imul(le,C)|0,p=p+Math.imul(fe,Y)|0,a=a+Math.imul(fe,te)|0,a=a+Math.imul(ne,Y)|0,g=g+Math.imul(ne,te)|0,p=p+Math.imul(oe,re)|0,a=a+Math.imul(oe,ve)|0,a=a+Math.imul(se,re)|0,g=g+Math.imul(se,ve)|0,p=p+Math.imul(O,ce)|0,a=a+Math.imul(O,Me)|0,a=a+Math.imul(Q,ce)|0,g=g+Math.imul(Q,Me)|0,p=p+Math.imul(W,Se)|0,a=a+Math.imul(W,Te)|0,a=a+Math.imul(G,Se)|0,g=g+Math.imul(G,Te)|0;var _t=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(_t>>>26)|0,_t&=67108863,p=Math.imul(me,xe),a=Math.imul(me,Re),a=a+Math.imul(ge,xe)|0,g=Math.imul(ge,Re),p=p+Math.imul(ye,Ee)|0,a=a+Math.imul(ye,$e)|0,a=a+Math.imul(Ae,Ee)|0,g=g+Math.imul(Ae,$e)|0,p=p+Math.imul(he,D)|0,a=a+Math.imul(he,C)|0,a=a+Math.imul(_e,D)|0,g=g+Math.imul(_e,C)|0,p=p+Math.imul(ae,Y)|0,a=a+Math.imul(ae,te)|0,a=a+Math.imul(le,Y)|0,g=g+Math.imul(le,te)|0,p=p+Math.imul(fe,re)|0,a=a+Math.imul(fe,ve)|0,a=a+Math.imul(ne,re)|0,g=g+Math.imul(ne,ve)|0,p=p+Math.imul(oe,ce)|0,a=a+Math.imul(oe,Me)|0,a=a+Math.imul(se,ce)|0,g=g+Math.imul(se,Me)|0,p=p+Math.imul(O,Se)|0,a=a+Math.imul(O,Te)|0,a=a+Math.imul(Q,Se)|0,g=g+Math.imul(Q,Te)|0;var Et=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Et>>>26)|0,Et&=67108863,p=Math.imul(me,Ee),a=Math.imul(me,$e),a=a+Math.imul(ge,Ee)|0,g=Math.imul(ge,$e),p=p+Math.imul(ye,D)|0,a=a+Math.imul(ye,C)|0,a=a+Math.imul(Ae,D)|0,g=g+Math.imul(Ae,C)|0,p=p+Math.imul(he,Y)|0,a=a+Math.imul(he,te)|0,a=a+Math.imul(_e,Y)|0,g=g+Math.imul(_e,te)|0,p=p+Math.imul(ae,re)|0,a=a+Math.imul(ae,ve)|0,a=a+Math.imul(le,re)|0,g=g+Math.imul(le,ve)|0,p=p+Math.imul(fe,ce)|0,a=a+Math.imul(fe,Me)|0,a=a+Math.imul(ne,ce)|0,g=g+Math.imul(ne,Me)|0,p=p+Math.imul(oe,Se)|0,a=a+Math.imul(oe,Te)|0,a=a+Math.imul(se,Se)|0,g=g+Math.imul(se,Te)|0;var St=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(St>>>26)|0,St&=67108863,p=Math.imul(me,D),a=Math.imul(me,C),a=a+Math.imul(ge,D)|0,g=Math.imul(ge,C),p=p+Math.imul(ye,Y)|0,a=a+Math.imul(ye,te)|0,a=a+Math.imul(Ae,Y)|0,g=g+Math.imul(Ae,te)|0,p=p+Math.imul(he,re)|0,a=a+Math.imul(he,ve)|0,a=a+Math.imul(_e,re)|0,g=g+Math.imul(_e,ve)|0,p=p+Math.imul(ae,ce)|0,a=a+Math.imul(ae,Me)|0,a=a+Math.imul(le,ce)|0,g=g+Math.imul(le,Me)|0,p=p+Math.imul(fe,Se)|0,a=a+Math.imul(fe,Te)|0,a=a+Math.imul(ne,Se)|0,g=g+Math.imul(ne,Te)|0;var At=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(At>>>26)|0,At&=67108863,p=Math.imul(me,Y),a=Math.imul(me,te),a=a+Math.imul(ge,Y)|0,g=Math.imul(ge,te),p=p+Math.imul(ye,re)|0,a=a+Math.imul(ye,ve)|0,a=a+Math.imul(Ae,re)|0,g=g+Math.imul(Ae,ve)|0,p=p+Math.imul(he,ce)|0,a=a+Math.imul(he,Me)|0,a=a+Math.imul(_e,ce)|0,g=g+Math.imul(_e,Me)|0,p=p+Math.imul(ae,Se)|0,a=a+Math.imul(ae,Te)|0,a=a+Math.imul(le,Se)|0,g=g+Math.imul(le,Te)|0;var kt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(kt>>>26)|0,kt&=67108863,p=Math.imul(me,re),a=Math.imul(me,ve),a=a+Math.imul(ge,re)|0,g=Math.imul(ge,ve),p=p+Math.imul(ye,ce)|0,a=a+Math.imul(ye,Me)|0,a=a+Math.imul(Ae,ce)|0,g=g+Math.imul(Ae,Me)|0,p=p+Math.imul(he,Se)|0,a=a+Math.imul(he,Te)|0,a=a+Math.imul(_e,Se)|0,g=g+Math.imul(_e,Te)|0;var Bt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,p=Math.imul(me,ce),a=Math.imul(me,Me),a=a+Math.imul(ge,ce)|0,g=Math.imul(ge,Me),p=p+Math.imul(ye,Se)|0,a=a+Math.imul(ye,Te)|0,a=a+Math.imul(Ae,Se)|0,g=g+Math.imul(Ae,Te)|0;var Rt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,p=Math.imul(me,Se),a=Math.imul(me,Te),a=a+Math.imul(ge,Se)|0,g=Math.imul(ge,Te);var $t=(m+p|0)+((a&8191)<<13)|0;return m=(g+(a>>>13)|0)+($t>>>26)|0,$t&=67108863,y[0]=Ge,y[1]=Je,y[2]=pt,y[3]=vt,y[4]=gt,y[5]=yt,y[6]=mt,y[7]=wt,y[8]=bt,y[9]=xt,y[10]=Mt,y[11]=_t,y[12]=Et,y[13]=St,y[14]=At,y[15]=kt,y[16]=Bt,y[17]=Rt,y[18]=$t,m!==0&&(y[19]=m,l.length++),l};Math.imul||(B=R);function I(x,o,f){f.negative=o.negative^x.negative,f.length=x.length+o.length;for(var l=0,h=0,v=0;v<f.length-1;v++){var y=h;h=0;for(var m=l&67108863,p=Math.min(v,o.length-1),a=Math.max(0,v-x.length+1);a<=p;a++){var g=v-a,S=x.words[g]|0,N=o.words[a]|0,U=S*N,Z=U&67108863;y=y+(U/67108864|0)|0,Z=Z+m|0,m=Z&67108863,y=y+(Z>>>26)|0,h+=y>>>26,y&=67108863}f.words[v]=m,l=y,y=h}return l!==0?f.words[v]=l:f.length--,f.strip()}function E(x,o,f){var l=new k;return l.mulp(x,o,f)}i.prototype.mulTo=function(o,f){var l,h=this.length+o.length;return this.length===10&&o.length===10?l=B(this,o,f):h<63?l=R(this,o,f):h<1024?l=I(this,o,f):l=E(this,o,f),l};function k(x,o){this.x=x,this.y=o}k.prototype.makeRBT=function(o){for(var f=new Array(o),l=i.prototype._countBits(o)-1,h=0;h<o;h++)f[h]=this.revBin(h,l,o);return f},k.prototype.revBin=function(o,f,l){if(o===0||o===l-1)return o;for(var h=0,v=0;v<f;v++)h|=(o&1)<<f-v-1,o>>=1;return h},k.prototype.permute=function(o,f,l,h,v,y){for(var m=0;m<y;m++)h[m]=f[o[m]],v[m]=l[o[m]]},k.prototype.transform=function(o,f,l,h,v,y){this.permute(y,o,f,l,h,v);for(var m=1;m<v;m<<=1)for(var p=m<<1,a=Math.cos(2*Math.PI/p),g=Math.sin(2*Math.PI/p),S=0;S<v;S+=p)for(var N=a,U=g,Z=0;Z<m;Z++){var H=l[S+Z],$=h[S+Z],P=l[S+Z+m],W=h[S+Z+m],G=N*P-U*W;W=N*W+U*P,P=G,l[S+Z]=H+P,h[S+Z]=$+W,l[S+Z+m]=H-P,h[S+Z+m]=$-W,Z!==p&&(G=a*N-g*U,U=a*U+g*N,N=G)}},k.prototype.guessLen13b=function(o,f){var l=Math.max(f,o)|1,h=l&1,v=0;for(l=l/2|0;l;l=l>>>1)v++;return 1<<v+1+h},k.prototype.conjugate=function(o,f,l){if(!(l<=1))for(var h=0;h<l/2;h++){var v=o[h];o[h]=o[l-h-1],o[l-h-1]=v,v=f[h],f[h]=-f[l-h-1],f[l-h-1]=-v}},k.prototype.normalize13b=function(o,f){for(var l=0,h=0;h<f/2;h++){var v=Math.round(o[2*h+1]/f)*8192+Math.round(o[2*h]/f)+l;o[h]=v&67108863,v<67108864?l=0:l=v/67108864|0}return o},k.prototype.convert13b=function(o,f,l,h){for(var v=0,y=0;y<f;y++)v=v+(o[y]|0),l[2*y]=v&8191,v=v>>>13,l[2*y+1]=v&8191,v=v>>>13;for(y=2*f;y<h;++y)l[y]=0;n(v===0),n((v&-8192)===0)},k.prototype.stub=function(o){for(var f=new Array(o),l=0;l<o;l++)f[l]=0;return f},k.prototype.mulp=function(o,f,l){var h=2*this.guessLen13b(o.length,f.length),v=this.makeRBT(h),y=this.stub(h),m=new Array(h),p=new Array(h),a=new Array(h),g=new Array(h),S=new Array(h),N=new Array(h),U=l.words;U.length=h,this.convert13b(o.words,o.length,m,h),this.convert13b(f.words,f.length,g,h),this.transform(m,y,p,a,h,v),this.transform(g,y,S,N,h,v);for(var Z=0;Z<h;Z++){var H=p[Z]*S[Z]-a[Z]*N[Z];a[Z]=p[Z]*N[Z]+a[Z]*S[Z],p[Z]=H}return this.conjugate(p,a,h),this.transform(p,a,U,y,h,v),this.conjugate(U,y,h),this.normalize13b(U,h),l.negative=o.negative^f.negative,l.length=o.length+f.length,l.strip()},i.prototype.mul=function(o){var f=new i(null);return f.words=new Array(this.length+o.length),this.mulTo(o,f)},i.prototype.mulf=function(o){var f=new i(null);return f.words=new Array(this.length+o.length),E(this,o,f)},i.prototype.imul=function(o){return this.clone().mulTo(o,this)},i.prototype.imuln=function(o){n(typeof o=="number"),n(o<67108864);for(var f=0,l=0;l<this.length;l++){var h=(this.words[l]|0)*o,v=(h&67108863)+(f&67108863);f>>=26,f+=h/67108864|0,f+=v>>>26,this.words[l]=v&67108863}return f!==0&&(this.words[l]=f,this.length++),this.length=o===0?1:this.length,this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var f=A(o);if(f.length===0)return new i(1);for(var l=this,h=0;h<f.length&&f[h]===0;h++,l=l.sqr());if(++h<f.length)for(var v=l.sqr();h<f.length;h++,v=v.sqr())f[h]!==0&&(l=l.mul(v));return l},i.prototype.iushln=function(o){n(typeof o=="number"&&o>=0);var f=o%26,l=(o-f)/26,h=67108863>>>26-f<<26-f,v;if(f!==0){var y=0;for(v=0;v<this.length;v++){var m=this.words[v]&h,p=(this.words[v]|0)-m<<f;this.words[v]=p|y,y=m>>>26-f}y&&(this.words[v]=y,this.length++)}if(l!==0){for(v=this.length-1;v>=0;v--)this.words[v+l]=this.words[v];for(v=0;v<l;v++)this.words[v]=0;this.length+=l}return this.strip()},i.prototype.ishln=function(o){return n(this.negative===0),this.iushln(o)},i.prototype.iushrn=function(o,f,l){n(typeof o=="number"&&o>=0);var h;f?h=(f-f%26)/26:h=0;var v=o%26,y=Math.min((o-v)/26,this.length),m=67108863^67108863>>>v<<v,p=l;if(h-=y,h=Math.max(0,h),p){for(var a=0;a<y;a++)p.words[a]=this.words[a];p.length=y}if(y!==0)if(this.length>y)for(this.length-=y,a=0;a<this.length;a++)this.words[a]=this.words[a+y];else this.words[0]=0,this.length=1;var g=0;for(a=this.length-1;a>=0&&(g!==0||a>=h);a--){var S=this.words[a]|0;this.words[a]=g<<26-v|S>>>v,g=S&m}return p&&g!==0&&(p.words[p.length++]=g),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,f,l){return n(this.negative===0),this.iushrn(o,f,l)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var f=o%26,l=(o-f)/26,h=1<<f;if(this.length<=l)return!1;var v=this.words[l];return!!(v&h)},i.prototype.imaskn=function(o){n(typeof o=="number"&&o>=0);var f=o%26,l=(o-f)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(f!==0&&l++,this.length=Math.min(l,this.length),f!==0){var h=67108863^67108863>>>f<<f;this.words[this.length-1]&=h}return this.strip()},i.prototype.maskn=function(o){return this.clone().imaskn(o)},i.prototype.iaddn=function(o){return n(typeof o=="number"),n(o<67108864),o<0?this.isubn(-o):this.negative!==0?this.length===1&&(this.words[0]|0)<o?(this.words[0]=o-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(o),this.negative=1,this):this._iaddn(o)},i.prototype._iaddn=function(o){this.words[0]+=o;for(var f=0;f<this.length&&this.words[f]>=67108864;f++)this.words[f]-=67108864,f===this.length-1?this.words[f+1]=1:this.words[f+1]++;return this.length=Math.max(this.length,f+1),this},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var f=0;f<this.length&&this.words[f]<0;f++)this.words[f]+=67108864,this.words[f+1]-=1;return this.strip()},i.prototype.addn=function(o){return this.clone().iaddn(o)},i.prototype.subn=function(o){return this.clone().isubn(o)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(o,f,l){var h=o.length+l,v;this._expand(h);var y,m=0;for(v=0;v<o.length;v++){y=(this.words[v+l]|0)+m;var p=(o.words[v]|0)*f;y-=p&67108863,m=(y>>26)-(p/67108864|0),this.words[v+l]=y&67108863}for(;v<this.length-l;v++)y=(this.words[v+l]|0)+m,m=y>>26,this.words[v+l]=y&67108863;if(m===0)return this.strip();for(n(m===-1),m=0,v=0;v<this.length;v++)y=-(this.words[v]|0)+m,m=y>>26,this.words[v]=y&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,f){var l=this.length-o.length,h=this.clone(),v=o,y=v.words[v.length-1]|0,m=this._countBits(y);l=26-m,l!==0&&(v=v.ushln(l),h.iushln(l),y=v.words[v.length-1]|0);var p=h.length-v.length,a;if(f!=="mod"){a=new i(null),a.length=p+1,a.words=new Array(a.length);for(var g=0;g<a.length;g++)a.words[g]=0}var S=h.clone()._ishlnsubmul(v,1,p);S.negative===0&&(h=S,a&&(a.words[p]=1));for(var N=p-1;N>=0;N--){var U=(h.words[v.length+N]|0)*67108864+(h.words[v.length+N-1]|0);for(U=Math.min(U/y|0,67108863),h._ishlnsubmul(v,U,N);h.negative!==0;)U--,h.negative=0,h._ishlnsubmul(v,1,N),h.isZero()||(h.negative^=1);a&&(a.words[N]=U)}return a&&a.strip(),h.strip(),f!=="div"&&l!==0&&h.iushrn(l),{div:a||null,mod:h}},i.prototype.divmod=function(o,f,l){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,v,y;return this.negative!==0&&o.negative===0?(y=this.neg().divmod(o,f),f!=="mod"&&(h=y.div.neg()),f!=="div"&&(v=y.mod.neg(),l&&v.negative!==0&&v.iadd(o)),{div:h,mod:v}):this.negative===0&&o.negative!==0?(y=this.divmod(o.neg(),f),f!=="mod"&&(h=y.div.neg()),{div:h,mod:y.mod}):this.negative&o.negative?(y=this.neg().divmod(o.neg(),f),f!=="div"&&(v=y.mod.neg(),l&&v.negative!==0&&v.isub(o)),{div:y.div,mod:v}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?f==="div"?{div:this.divn(o.words[0]),mod:null}:f==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,f)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var f=this.divmod(o);if(f.mod.isZero())return f.div;var l=f.div.negative!==0?f.mod.isub(o):f.mod,h=o.ushrn(1),v=o.andln(1),y=l.cmp(h);return y<0||v===1&&y===0?f.div:f.div.negative!==0?f.div.isubn(1):f.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var f=(1<<26)%o,l=0,h=this.length-1;h>=0;h--)l=(f*l+(this.words[h]|0))%o;return l},i.prototype.idivn=function(o){n(o<=67108863);for(var f=0,l=this.length-1;l>=0;l--){var h=(this.words[l]|0)+f*67108864;this.words[l]=h/o|0,f=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var f=this,l=o.clone();f.negative!==0?f=f.umod(o):f=f.clone();for(var h=new i(1),v=new i(0),y=new i(0),m=new i(1),p=0;f.isEven()&&l.isEven();)f.iushrn(1),l.iushrn(1),++p;for(var a=l.clone(),g=f.clone();!f.isZero();){for(var S=0,N=1;!(f.words[0]&N)&&S<26;++S,N<<=1);if(S>0)for(f.iushrn(S);S-- >0;)(h.isOdd()||v.isOdd())&&(h.iadd(a),v.isub(g)),h.iushrn(1),v.iushrn(1);for(var U=0,Z=1;!(l.words[0]&Z)&&U<26;++U,Z<<=1);if(U>0)for(l.iushrn(U);U-- >0;)(y.isOdd()||m.isOdd())&&(y.iadd(a),m.isub(g)),y.iushrn(1),m.iushrn(1);f.cmp(l)>=0?(f.isub(l),h.isub(y),v.isub(m)):(l.isub(f),y.isub(h),m.isub(v))}return{a:y,b:m,gcd:l.iushln(p)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var f=this,l=o.clone();f.negative!==0?f=f.umod(o):f=f.clone();for(var h=new i(1),v=new i(0),y=l.clone();f.cmpn(1)>0&&l.cmpn(1)>0;){for(var m=0,p=1;!(f.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(f.iushrn(m);m-- >0;)h.isOdd()&&h.iadd(y),h.iushrn(1);for(var a=0,g=1;!(l.words[0]&g)&&a<26;++a,g<<=1);if(a>0)for(l.iushrn(a);a-- >0;)v.isOdd()&&v.iadd(y),v.iushrn(1);f.cmp(l)>=0?(f.isub(l),h.isub(v)):(l.isub(f),v.isub(h))}var S;return f.cmpn(1)===0?S=h:S=v,S.cmpn(0)<0&&S.iadd(o),S},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var f=this.clone(),l=o.clone();f.negative=0,l.negative=0;for(var h=0;f.isEven()&&l.isEven();h++)f.iushrn(1),l.iushrn(1);do{for(;f.isEven();)f.iushrn(1);for(;l.isEven();)l.iushrn(1);var v=f.cmp(l);if(v<0){var y=f;f=l,l=y}else if(v===0||l.cmpn(1)===0)break;f.isub(l)}while(!0);return l.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var f=o%26,l=(o-f)/26,h=1<<f;if(this.length<=l)return this._expand(l+1),this.words[l]|=h,this;for(var v=h,y=l;v!==0&&y<this.length;y++){var m=this.words[y]|0;m+=v,v=m>>>26,m&=67108863,this.words[y]=m}return v!==0&&(this.words[y]=v,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var f=o<0;if(this.negative!==0&&!f)return-1;if(this.negative===0&&f)return 1;this.strip();var l;if(this.length>1)l=1;else{f&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;l=h===o?0:h<o?-1:1}return this.negative!==0?-l|0:l},i.prototype.cmp=function(o){if(this.negative!==0&&o.negative===0)return-1;if(this.negative===0&&o.negative!==0)return 1;var f=this.ucmp(o);return this.negative!==0?-f|0:f},i.prototype.ucmp=function(o){if(this.length>o.length)return 1;if(this.length<o.length)return-1;for(var f=0,l=this.length-1;l>=0;l--){var h=this.words[l]|0,v=o.words[l]|0;if(h!==v){h<v?f=-1:h>v&&(f=1);break}}return f},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new X(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var T={k256:null,p224:null,p192:null,p25519:null};function L(x,o){this.name=x,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}L.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},L.prototype.ireduce=function(o){var f=o,l;do this.split(f,this.tmp),f=this.imulK(f),f=f.iadd(this.tmp),l=f.bitLength();while(l>this.n);var h=l<this.n?-1:f.ucmp(this.p);return h===0?(f.words[0]=0,f.length=1):h>0?f.isub(this.p):f.strip!==void 0?f.strip():f._strip(),f},L.prototype.split=function(o,f){o.iushrn(this.n,0,f)},L.prototype.imulK=function(o){return o.imul(this.k)};function q(){L.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(q,L),q.prototype.split=function(o,f){for(var l=4194303,h=Math.min(o.length,9),v=0;v<h;v++)f.words[v]=o.words[v];if(f.length=h,o.length<=9){o.words[0]=0,o.length=1;return}var y=o.words[9];for(f.words[f.length++]=y&l,v=10;v<o.length;v++){var m=o.words[v]|0;o.words[v-10]=(m&l)<<4|y>>>22,y=m}y>>>=22,o.words[v-10]=y,y===0&&o.length>10?o.length-=10:o.length-=9},q.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var f=0,l=0;l<o.length;l++){var h=o.words[l]|0;f+=h*977,o.words[l]=f&67108863,f=h*64+(f/67108864|0)}return o.words[o.length-1]===0&&(o.length--,o.words[o.length-1]===0&&o.length--),o};function z(){L.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(z,L);function J(){L.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(J,L);function F(){L.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(F,L),F.prototype.imulK=function(o){for(var f=0,l=0;l<o.length;l++){var h=(o.words[l]|0)*19+f,v=h&67108863;h>>>=26,o.words[l]=v,f=h}return f!==0&&(o.words[o.length++]=f),o},i._prime=function(o){if(T[o])return T[o];var f;if(o==="k256")f=new q;else if(o==="p224")f=new z;else if(o==="p192")f=new J;else if(o==="p25519")f=new F;else throw new Error("Unknown prime "+o);return T[o]=f,f};function X(x){if(typeof x=="string"){var o=i._prime(x);this.m=o.p,this.prime=o}else n(x.gtn(1),"modulus must be greater than 1"),this.m=x,this.prime=null}X.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},X.prototype._verify2=function(o,f){n((o.negative|f.negative)===0,"red works only with positives"),n(o.red&&o.red===f.red,"red works only with red numbers")},X.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},X.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},X.prototype.add=function(o,f){this._verify2(o,f);var l=o.add(f);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},X.prototype.iadd=function(o,f){this._verify2(o,f);var l=o.iadd(f);return l.cmp(this.m)>=0&&l.isub(this.m),l},X.prototype.sub=function(o,f){this._verify2(o,f);var l=o.sub(f);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},X.prototype.isub=function(o,f){this._verify2(o,f);var l=o.isub(f);return l.cmpn(0)<0&&l.iadd(this.m),l},X.prototype.shl=function(o,f){return this._verify1(o),this.imod(o.ushln(f))},X.prototype.imul=function(o,f){return this._verify2(o,f),this.imod(o.imul(f))},X.prototype.mul=function(o,f){return this._verify2(o,f),this.imod(o.mul(f))},X.prototype.isqr=function(o){return this.imul(o,o.clone())},X.prototype.sqr=function(o){return this.mul(o,o)},X.prototype.sqrt=function(o){if(o.isZero())return o.clone();var f=this.m.andln(3);if(n(f%2===1),f===3){var l=this.m.add(new i(1)).iushrn(2);return this.pow(o,l)}for(var h=this.m.subn(1),v=0;!h.isZero()&&h.andln(1)===0;)v++,h.iushrn(1);n(!h.isZero());var y=new i(1).toRed(this),m=y.redNeg(),p=this.m.subn(1).iushrn(1),a=this.m.bitLength();for(a=new i(2*a*a).toRed(this);this.pow(a,p).cmp(m)!==0;)a.redIAdd(m);for(var g=this.pow(a,h),S=this.pow(o,h.addn(1).iushrn(1)),N=this.pow(o,h),U=v;N.cmp(y)!==0;){for(var Z=N,H=0;Z.cmp(y)!==0;H++)Z=Z.redSqr();n(H<U);var $=this.pow(g,new i(1).iushln(U-H-1));S=S.redMul($),g=$.redSqr(),N=N.redMul(g),U=H}return S},X.prototype.invm=function(o){var f=o._invmp(this.m);return f.negative!==0?(f.negative=0,this.imod(f).redNeg()):this.imod(f)},X.prototype.pow=function(o,f){if(f.isZero())return new i(1).toRed(this);if(f.cmpn(1)===0)return o.clone();var l=4,h=new Array(1<<l);h[0]=new i(1).toRed(this),h[1]=o;for(var v=2;v<h.length;v++)h[v]=this.mul(h[v-1],o);var y=h[0],m=0,p=0,a=f.bitLength()%26;for(a===0&&(a=26),v=f.length-1;v>=0;v--){for(var g=f.words[v],S=a-1;S>=0;S--){var N=g>>S&1;if(y!==h[0]&&(y=this.sqr(y)),N===0&&m===0){p=0;continue}m<<=1,m|=N,p++,!(p!==l&&(v!==0||S!==0))&&(y=this.mul(y,h[m]),p=0,m=0)}a=26}return y},X.prototype.convertTo=function(o){var f=o.umod(this.m);return f===o?f.clone():f},X.prototype.convertFrom=function(o){var f=o.clone();return f.red=null,f},i.mont=function(o){return new ee(o)};function ee(x){X.call(this,x),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(ee,X),ee.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},ee.prototype.convertFrom=function(o){var f=this.imod(o.mul(this.rinv));return f.red=null,f},ee.prototype.imul=function(o,f){if(o.isZero()||f.isZero())return o.words[0]=0,o.length=1,o;var l=o.imul(f),h=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=l.isub(h).iushrn(this.shift),y=v;return v.cmp(this.m)>=0?y=v.isub(this.m):v.cmpn(0)<0&&(y=v.iadd(this.m)),y._forceRed(this)},ee.prototype.mul=function(o,f){if(o.isZero()||f.isZero())return new i(0)._forceRed(this);var l=o.mul(f),h=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=l.isub(h).iushrn(this.shift),y=v;return v.cmp(this.m)>=0?y=v.isub(this.m):v.cmpn(0)<0&&(y=v.iadd(this.m)),y._forceRed(this)},ee.prototype.invm=function(o){var f=this.imod(o._invmp(this.m).mul(this.r2));return f._forceRed(this)}})(e,Ve)})(qw);var aX=qw.exports,Av,Rx;function fX(){if(Rx)return Av;Rx=1;var e=Uw(),t=aX;Av=function(u){return new n(u)};var r={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};r.p224=r.secp224r1,r.p256=r.secp256r1=r.prime256v1,r.p192=r.secp192r1=r.prime192v1,r.p384=r.secp384r1,r.p521=r.secp521r1;function n(i){this.curveType=r[i],this.curveType||(this.curveType={name:i}),this.curve=new e.ec(this.curveType.name),this.keys=void 0}n.prototype.generateKeys=function(i,u){return this.keys=this.curve.genKeyPair(),this.getPublicKey(i,u)},n.prototype.computeSecret=function(i,u,d){u=u||"utf8",ht.isBuffer(i)||(i=new ht(i,u));var c=this.curve.keyFromPublic(i).getPublic(),b=c.mul(this.keys.getPrivate()).getX();return s(b,d,this.curveType.byteLength)},n.prototype.getPublicKey=function(i,u){var d=this.keys.getPublic(u==="compressed",!0);return u==="hybrid"&&(d[d.length-1]%2?d[0]=7:d[0]=6),s(d,i)},n.prototype.getPrivateKey=function(i){return s(this.keys.getPrivate(),i)},n.prototype.setPublicKey=function(i,u){return u=u||"utf8",ht.isBuffer(i)||(i=new ht(i,u)),this.keys._importPublic(i),this},n.prototype.setPrivateKey=function(i,u){u=u||"utf8",ht.isBuffer(i)||(i=new ht(i,u));var d=new t(i);return d=d.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(d),this};function s(i,u,d){Array.isArray(i)||(i=i.toArray());var c=new ht(i);if(d&&c.length<d){var b=new ht(d-c.length);b.fill(0),c=ht.concat([b,c])}return u?c.toString(u):c}return Av}var WA={},lX=uh,Iy=Ye.Buffer,VA=function(e,t){for(var r=Iy.alloc(0),n=0,s;r.length<t;)s=uX(n++),r=Iy.concat([r,lX("sha1").update(e).update(s).digest()]);return r.slice(0,t)};function uX(e){var t=Iy.allocUnsafe(4);return t.writeUInt32BE(e,0),t}var KA=function(t,r){for(var n=t.length,s=-1;++s<n;)t[s]^=r[s];return t},Fw={exports:{}};Fw.exports;(function(e){(function(t,r){function n(x,o){if(!x)throw new Error(o||"Assertion failed")}function s(x,o){x.super_=o;var f=function(){};f.prototype=o.prototype,x.prototype=new f,x.prototype.constructor=x}function i(x,o,f){if(i.isBN(x))return x;this.negative=0,this.words=null,this.length=0,this.red=null,x!==null&&((o==="le"||o==="be")&&(f=o,o=10),this._init(x||0,o||10,f||"be"))}typeof t=="object"?t.exports=i:r.BN=i,i.BN=i,i.wordSize=26;var u;try{typeof window<"u"&&typeof window.Buffer<"u"?u=window.Buffer:u=Kt.Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,f){return o.cmp(f)>0?o:f},i.min=function(o,f){return o.cmp(f)<0?o:f},i.prototype._init=function(o,f,l){if(typeof o=="number")return this._initNumber(o,f,l);if(typeof o=="object")return this._initArray(o,f,l);f==="hex"&&(f=16),n(f===(f|0)&&f>=2&&f<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h<o.length&&(f===16?this._parseHex(o,h,l):(this._parseBase(o,f,h),l==="le"&&this._initArray(this.toArray(),f,l)))},i.prototype._initNumber=function(o,f,l){o<0&&(this.negative=1,o=-o),o<67108864?(this.words=[o&67108863],this.length=1):o<4503599627370496?(this.words=[o&67108863,o/67108864&67108863],this.length=2):(n(o<9007199254740992),this.words=[o&67108863,o/67108864&67108863,1],this.length=3),l==="le"&&this._initArray(this.toArray(),f,l)},i.prototype._initArray=function(o,f,l){if(n(typeof o.length=="number"),o.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(o.length/3),this.words=new Array(this.length);for(var h=0;h<this.length;h++)this.words[h]=0;var v,y,m=0;if(l==="be")for(h=o.length-1,v=0;h>=0;h-=3)y=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[v]|=y<<m&67108863,this.words[v+1]=y>>>26-m&67108863,m+=24,m>=26&&(m-=26,v++);else if(l==="le")for(h=0,v=0;h<o.length;h+=3)y=o[h]|o[h+1]<<8|o[h+2]<<16,this.words[v]|=y<<m&67108863,this.words[v+1]=y>>>26-m&67108863,m+=24,m>=26&&(m-=26,v++);return this.strip()};function d(x,o){var f=x.charCodeAt(o);return f>=65&&f<=70?f-55:f>=97&&f<=102?f-87:f-48&15}function c(x,o,f){var l=d(x,f);return f-1>=o&&(l|=d(x,f-1)<<4),l}i.prototype._parseHex=function(o,f,l){this.length=Math.ceil((o.length-f)/6),this.words=new Array(this.length);for(var h=0;h<this.length;h++)this.words[h]=0;var v=0,y=0,m;if(l==="be")for(h=o.length-1;h>=f;h-=2)m=c(o,f,h)<<v,this.words[y]|=m&67108863,v>=18?(v-=18,y+=1,this.words[y]|=m>>>26):v+=8;else{var p=o.length-f;for(h=p%2===0?f+1:f;h<o.length;h+=2)m=c(o,f,h)<<v,this.words[y]|=m&67108863,v>=18?(v-=18,y+=1,this.words[y]|=m>>>26):v+=8}this.strip()};function b(x,o,f,l){for(var h=0,v=Math.min(x.length,f),y=o;y<v;y++){var m=x.charCodeAt(y)-48;h*=l,m>=49?h+=m-49+10:m>=17?h+=m-17+10:h+=m}return h}i.prototype._parseBase=function(o,f,l){this.words=[0],this.length=1;for(var h=0,v=1;v<=67108863;v*=f)h++;h--,v=v/f|0;for(var y=o.length-l,m=y%h,p=Math.min(y,y-m)+l,a=0,g=l;g<p;g+=h)a=b(o,g,g+h,f),this.imuln(v),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(m!==0){var S=1;for(a=b(o,g,o.length,f),g=0;g<m;g++)S*=f;this.imuln(S),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}this.strip()},i.prototype.copy=function(o){o.words=new Array(this.length);for(var f=0;f<this.length;f++)o.words[f]=this.words[f];o.length=this.length,o.negative=this.negative,o.red=this.red},i.prototype.clone=function(){var o=new i(null);return this.copy(o),o},i.prototype._expand=function(o){for(;this.length<o;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var w=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],M=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[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];i.prototype.toString=function(o,f){o=o||10,f=f|0||1;var l;if(o===16||o==="hex"){l="";for(var h=0,v=0,y=0;y<this.length;y++){var m=this.words[y],p=((m<<h|v)&16777215).toString(16);v=m>>>24-h&16777215,h+=2,h>=26&&(h-=26,y--),v!==0||y!==this.length-1?l=w[6-p.length]+p+l:l=p+l}for(v!==0&&(l=v.toString(16)+l);l.length%f!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(o===(o|0)&&o>=2&&o<=36){var a=M[o],g=_[o];l="";var S=this.clone();for(S.negative=0;!S.isZero();){var N=S.modn(g).toString(o);S=S.idivn(g),S.isZero()?l=N+l:l=w[a-N.length]+N+l}for(this.isZero()&&(l="0"+l);l.length%f!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,f){return n(typeof u<"u"),this.toArrayLike(u,o,f)},i.prototype.toArray=function(o,f){return this.toArrayLike(Array,o,f)},i.prototype.toArrayLike=function(o,f,l){var h=this.byteLength(),v=l||Math.max(1,h);n(h<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var y=f==="le",m=new o(v),p,a,g=this.clone();if(y){for(a=0;!g.isZero();a++)p=g.andln(255),g.iushrn(8),m[a]=p;for(;a<v;a++)m[a]=0}else{for(a=0;a<v-h;a++)m[a]=0;for(a=0;!g.isZero();a++)p=g.andln(255),g.iushrn(8),m[v-a-1]=p}return m},Math.clz32?i.prototype._countBits=function(o){return 32-Math.clz32(o)}:i.prototype._countBits=function(o){var f=o,l=0;return f>=4096&&(l+=13,f>>>=13),f>=64&&(l+=7,f>>>=7),f>=8&&(l+=4,f>>>=4),f>=2&&(l+=2,f>>>=2),l+f},i.prototype._zeroBits=function(o){if(o===0)return 26;var f=o,l=0;return f&8191||(l+=13,f>>>=13),f&127||(l+=7,f>>>=7),f&15||(l+=4,f>>>=4),f&3||(l+=2,f>>>=2),f&1||l++,l},i.prototype.bitLength=function(){var o=this.words[this.length-1],f=this._countBits(o);return(this.length-1)*26+f};function A(x){for(var o=new Array(x.bitLength()),f=0;f<o.length;f++){var l=f/26|0,h=f%26;o[f]=(x.words[l]&1<<h)>>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,f=0;f<this.length;f++){var l=this._zeroBits(this.words[f]);if(o+=l,l!==26)break}return o},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(o){return this.negative!==0?this.abs().inotn(o).iaddn(1):this.clone()},i.prototype.fromTwos=function(o){return this.testn(o-1)?this.notn(o).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(o){for(;this.length<o.length;)this.words[this.length++]=0;for(var f=0;f<o.length;f++)this.words[f]=this.words[f]|o.words[f];return this.strip()},i.prototype.ior=function(o){return n((this.negative|o.negative)===0),this.iuor(o)},i.prototype.or=function(o){return this.length>o.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var f;this.length>o.length?f=o:f=this;for(var l=0;l<f.length;l++)this.words[l]=this.words[l]&o.words[l];return this.length=f.length,this.strip()},i.prototype.iand=function(o){return n((this.negative|o.negative)===0),this.iuand(o)},i.prototype.and=function(o){return this.length>o.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var f,l;this.length>o.length?(f=this,l=o):(f=o,l=this);for(var h=0;h<l.length;h++)this.words[h]=f.words[h]^l.words[h];if(this!==f)for(;h<f.length;h++)this.words[h]=f.words[h];return this.length=f.length,this.strip()},i.prototype.ixor=function(o){return n((this.negative|o.negative)===0),this.iuxor(o)},i.prototype.xor=function(o){return this.length>o.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var f=Math.ceil(o/26)|0,l=o%26;this._expand(f),l>0&&f--;for(var h=0;h<f;h++)this.words[h]=~this.words[h]&67108863;return l>0&&(this.words[h]=~this.words[h]&67108863>>26-l),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,f){n(typeof o=="number"&&o>=0);var l=o/26|0,h=o%26;return this._expand(l+1),f?this.words[l]=this.words[l]|1<<h:this.words[l]=this.words[l]&~(1<<h),this.strip()},i.prototype.iadd=function(o){var f;if(this.negative!==0&&o.negative===0)return this.negative=0,f=this.isub(o),this.negative^=1,this._normSign();if(this.negative===0&&o.negative!==0)return o.negative=0,f=this.isub(o),o.negative=1,f._normSign();var l,h;this.length>o.length?(l=this,h=o):(l=o,h=this);for(var v=0,y=0;y<h.length;y++)f=(l.words[y]|0)+(h.words[y]|0)+v,this.words[y]=f&67108863,v=f>>>26;for(;v!==0&&y<l.length;y++)f=(l.words[y]|0)+v,this.words[y]=f&67108863,v=f>>>26;if(this.length=l.length,v!==0)this.words[this.length]=v,this.length++;else if(l!==this)for(;y<l.length;y++)this.words[y]=l.words[y];return this},i.prototype.add=function(o){var f;return o.negative!==0&&this.negative===0?(o.negative=0,f=this.sub(o),o.negative^=1,f):o.negative===0&&this.negative!==0?(this.negative=0,f=o.sub(this),this.negative=1,f):this.length>o.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var f=this.iadd(o);return o.negative=1,f._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var l=this.cmp(o);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,v;l>0?(h=this,v=o):(h=o,v=this);for(var y=0,m=0;m<v.length;m++)f=(h.words[m]|0)-(v.words[m]|0)+y,y=f>>26,this.words[m]=f&67108863;for(;y!==0&&m<h.length;m++)f=(h.words[m]|0)+y,y=f>>26,this.words[m]=f&67108863;if(y===0&&m<h.length&&h!==this)for(;m<h.length;m++)this.words[m]=h.words[m];return this.length=Math.max(this.length,m),h!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(o){return this.clone().isub(o)};function R(x,o,f){f.negative=o.negative^x.negative;var l=x.length+o.length|0;f.length=l,l=l-1|0;var h=x.words[0]|0,v=o.words[0]|0,y=h*v,m=y&67108863,p=y/67108864|0;f.words[0]=m;for(var a=1;a<l;a++){for(var g=p>>>26,S=p&67108863,N=Math.min(a,o.length-1),U=Math.max(0,a-x.length+1);U<=N;U++){var Z=a-U|0;h=x.words[Z]|0,v=o.words[U]|0,y=h*v+S,g+=y/67108864|0,S=y&67108863}f.words[a]=S|0,p=g|0}return p!==0?f.words[a]=p|0:f.length--,f.strip()}var B=function(o,f,l){var h=o.words,v=f.words,y=l.words,m=0,p,a,g,S=h[0]|0,N=S&8191,U=S>>>13,Z=h[1]|0,H=Z&8191,$=Z>>>13,P=h[2]|0,W=P&8191,G=P>>>13,K=h[3]|0,O=K&8191,Q=K>>>13,de=h[4]|0,oe=de&8191,se=de>>>13,Ie=h[5]|0,fe=Ie&8191,ne=Ie>>>13,je=h[6]|0,ae=je&8191,le=je>>>13,Le=h[7]|0,he=Le&8191,_e=Le>>>13,He=h[8]|0,ye=He&8191,Ae=He>>>13,ze=h[9]|0,me=ze&8191,ge=ze>>>13,Ke=v[0]|0,we=Ke&8191,Be=Ke>>>13,We=v[1]|0,be=We&8191,ke=We>>>13,Ze=v[2]|0,pe=Ze&8191,Ne=Ze>>>13,Qe=v[3]|0,xe=Qe&8191,Re=Qe>>>13,Xe=v[4]|0,Ee=Xe&8191,$e=Xe>>>13,tt=v[5]|0,D=tt&8191,C=tt>>>13,j=v[6]|0,Y=j&8191,te=j>>>13,ue=v[7]|0,re=ue&8191,ve=ue>>>13,De=v[8]|0,ce=De&8191,Me=De>>>13,Oe=v[9]|0,Se=Oe&8191,Te=Oe>>>13;l.negative=o.negative^f.negative,l.length=19,p=Math.imul(N,we),a=Math.imul(N,Be),a=a+Math.imul(U,we)|0,g=Math.imul(U,Be);var Ge=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,p=Math.imul(H,we),a=Math.imul(H,Be),a=a+Math.imul($,we)|0,g=Math.imul($,Be),p=p+Math.imul(N,be)|0,a=a+Math.imul(N,ke)|0,a=a+Math.imul(U,be)|0,g=g+Math.imul(U,ke)|0;var Je=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Je>>>26)|0,Je&=67108863,p=Math.imul(W,we),a=Math.imul(W,Be),a=a+Math.imul(G,we)|0,g=Math.imul(G,Be),p=p+Math.imul(H,be)|0,a=a+Math.imul(H,ke)|0,a=a+Math.imul($,be)|0,g=g+Math.imul($,ke)|0,p=p+Math.imul(N,pe)|0,a=a+Math.imul(N,Ne)|0,a=a+Math.imul(U,pe)|0,g=g+Math.imul(U,Ne)|0;var pt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(pt>>>26)|0,pt&=67108863,p=Math.imul(O,we),a=Math.imul(O,Be),a=a+Math.imul(Q,we)|0,g=Math.imul(Q,Be),p=p+Math.imul(W,be)|0,a=a+Math.imul(W,ke)|0,a=a+Math.imul(G,be)|0,g=g+Math.imul(G,ke)|0,p=p+Math.imul(H,pe)|0,a=a+Math.imul(H,Ne)|0,a=a+Math.imul($,pe)|0,g=g+Math.imul($,Ne)|0,p=p+Math.imul(N,xe)|0,a=a+Math.imul(N,Re)|0,a=a+Math.imul(U,xe)|0,g=g+Math.imul(U,Re)|0;var vt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(vt>>>26)|0,vt&=67108863,p=Math.imul(oe,we),a=Math.imul(oe,Be),a=a+Math.imul(se,we)|0,g=Math.imul(se,Be),p=p+Math.imul(O,be)|0,a=a+Math.imul(O,ke)|0,a=a+Math.imul(Q,be)|0,g=g+Math.imul(Q,ke)|0,p=p+Math.imul(W,pe)|0,a=a+Math.imul(W,Ne)|0,a=a+Math.imul(G,pe)|0,g=g+Math.imul(G,Ne)|0,p=p+Math.imul(H,xe)|0,a=a+Math.imul(H,Re)|0,a=a+Math.imul($,xe)|0,g=g+Math.imul($,Re)|0,p=p+Math.imul(N,Ee)|0,a=a+Math.imul(N,$e)|0,a=a+Math.imul(U,Ee)|0,g=g+Math.imul(U,$e)|0;var gt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(gt>>>26)|0,gt&=67108863,p=Math.imul(fe,we),a=Math.imul(fe,Be),a=a+Math.imul(ne,we)|0,g=Math.imul(ne,Be),p=p+Math.imul(oe,be)|0,a=a+Math.imul(oe,ke)|0,a=a+Math.imul(se,be)|0,g=g+Math.imul(se,ke)|0,p=p+Math.imul(O,pe)|0,a=a+Math.imul(O,Ne)|0,a=a+Math.imul(Q,pe)|0,g=g+Math.imul(Q,Ne)|0,p=p+Math.imul(W,xe)|0,a=a+Math.imul(W,Re)|0,a=a+Math.imul(G,xe)|0,g=g+Math.imul(G,Re)|0,p=p+Math.imul(H,Ee)|0,a=a+Math.imul(H,$e)|0,a=a+Math.imul($,Ee)|0,g=g+Math.imul($,$e)|0,p=p+Math.imul(N,D)|0,a=a+Math.imul(N,C)|0,a=a+Math.imul(U,D)|0,g=g+Math.imul(U,C)|0;var yt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(yt>>>26)|0,yt&=67108863,p=Math.imul(ae,we),a=Math.imul(ae,Be),a=a+Math.imul(le,we)|0,g=Math.imul(le,Be),p=p+Math.imul(fe,be)|0,a=a+Math.imul(fe,ke)|0,a=a+Math.imul(ne,be)|0,g=g+Math.imul(ne,ke)|0,p=p+Math.imul(oe,pe)|0,a=a+Math.imul(oe,Ne)|0,a=a+Math.imul(se,pe)|0,g=g+Math.imul(se,Ne)|0,p=p+Math.imul(O,xe)|0,a=a+Math.imul(O,Re)|0,a=a+Math.imul(Q,xe)|0,g=g+Math.imul(Q,Re)|0,p=p+Math.imul(W,Ee)|0,a=a+Math.imul(W,$e)|0,a=a+Math.imul(G,Ee)|0,g=g+Math.imul(G,$e)|0,p=p+Math.imul(H,D)|0,a=a+Math.imul(H,C)|0,a=a+Math.imul($,D)|0,g=g+Math.imul($,C)|0,p=p+Math.imul(N,Y)|0,a=a+Math.imul(N,te)|0,a=a+Math.imul(U,Y)|0,g=g+Math.imul(U,te)|0;var mt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(mt>>>26)|0,mt&=67108863,p=Math.imul(he,we),a=Math.imul(he,Be),a=a+Math.imul(_e,we)|0,g=Math.imul(_e,Be),p=p+Math.imul(ae,be)|0,a=a+Math.imul(ae,ke)|0,a=a+Math.imul(le,be)|0,g=g+Math.imul(le,ke)|0,p=p+Math.imul(fe,pe)|0,a=a+Math.imul(fe,Ne)|0,a=a+Math.imul(ne,pe)|0,g=g+Math.imul(ne,Ne)|0,p=p+Math.imul(oe,xe)|0,a=a+Math.imul(oe,Re)|0,a=a+Math.imul(se,xe)|0,g=g+Math.imul(se,Re)|0,p=p+Math.imul(O,Ee)|0,a=a+Math.imul(O,$e)|0,a=a+Math.imul(Q,Ee)|0,g=g+Math.imul(Q,$e)|0,p=p+Math.imul(W,D)|0,a=a+Math.imul(W,C)|0,a=a+Math.imul(G,D)|0,g=g+Math.imul(G,C)|0,p=p+Math.imul(H,Y)|0,a=a+Math.imul(H,te)|0,a=a+Math.imul($,Y)|0,g=g+Math.imul($,te)|0,p=p+Math.imul(N,re)|0,a=a+Math.imul(N,ve)|0,a=a+Math.imul(U,re)|0,g=g+Math.imul(U,ve)|0;var wt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(wt>>>26)|0,wt&=67108863,p=Math.imul(ye,we),a=Math.imul(ye,Be),a=a+Math.imul(Ae,we)|0,g=Math.imul(Ae,Be),p=p+Math.imul(he,be)|0,a=a+Math.imul(he,ke)|0,a=a+Math.imul(_e,be)|0,g=g+Math.imul(_e,ke)|0,p=p+Math.imul(ae,pe)|0,a=a+Math.imul(ae,Ne)|0,a=a+Math.imul(le,pe)|0,g=g+Math.imul(le,Ne)|0,p=p+Math.imul(fe,xe)|0,a=a+Math.imul(fe,Re)|0,a=a+Math.imul(ne,xe)|0,g=g+Math.imul(ne,Re)|0,p=p+Math.imul(oe,Ee)|0,a=a+Math.imul(oe,$e)|0,a=a+Math.imul(se,Ee)|0,g=g+Math.imul(se,$e)|0,p=p+Math.imul(O,D)|0,a=a+Math.imul(O,C)|0,a=a+Math.imul(Q,D)|0,g=g+Math.imul(Q,C)|0,p=p+Math.imul(W,Y)|0,a=a+Math.imul(W,te)|0,a=a+Math.imul(G,Y)|0,g=g+Math.imul(G,te)|0,p=p+Math.imul(H,re)|0,a=a+Math.imul(H,ve)|0,a=a+Math.imul($,re)|0,g=g+Math.imul($,ve)|0,p=p+Math.imul(N,ce)|0,a=a+Math.imul(N,Me)|0,a=a+Math.imul(U,ce)|0,g=g+Math.imul(U,Me)|0;var bt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(bt>>>26)|0,bt&=67108863,p=Math.imul(me,we),a=Math.imul(me,Be),a=a+Math.imul(ge,we)|0,g=Math.imul(ge,Be),p=p+Math.imul(ye,be)|0,a=a+Math.imul(ye,ke)|0,a=a+Math.imul(Ae,be)|0,g=g+Math.imul(Ae,ke)|0,p=p+Math.imul(he,pe)|0,a=a+Math.imul(he,Ne)|0,a=a+Math.imul(_e,pe)|0,g=g+Math.imul(_e,Ne)|0,p=p+Math.imul(ae,xe)|0,a=a+Math.imul(ae,Re)|0,a=a+Math.imul(le,xe)|0,g=g+Math.imul(le,Re)|0,p=p+Math.imul(fe,Ee)|0,a=a+Math.imul(fe,$e)|0,a=a+Math.imul(ne,Ee)|0,g=g+Math.imul(ne,$e)|0,p=p+Math.imul(oe,D)|0,a=a+Math.imul(oe,C)|0,a=a+Math.imul(se,D)|0,g=g+Math.imul(se,C)|0,p=p+Math.imul(O,Y)|0,a=a+Math.imul(O,te)|0,a=a+Math.imul(Q,Y)|0,g=g+Math.imul(Q,te)|0,p=p+Math.imul(W,re)|0,a=a+Math.imul(W,ve)|0,a=a+Math.imul(G,re)|0,g=g+Math.imul(G,ve)|0,p=p+Math.imul(H,ce)|0,a=a+Math.imul(H,Me)|0,a=a+Math.imul($,ce)|0,g=g+Math.imul($,Me)|0,p=p+Math.imul(N,Se)|0,a=a+Math.imul(N,Te)|0,a=a+Math.imul(U,Se)|0,g=g+Math.imul(U,Te)|0;var xt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(xt>>>26)|0,xt&=67108863,p=Math.imul(me,be),a=Math.imul(me,ke),a=a+Math.imul(ge,be)|0,g=Math.imul(ge,ke),p=p+Math.imul(ye,pe)|0,a=a+Math.imul(ye,Ne)|0,a=a+Math.imul(Ae,pe)|0,g=g+Math.imul(Ae,Ne)|0,p=p+Math.imul(he,xe)|0,a=a+Math.imul(he,Re)|0,a=a+Math.imul(_e,xe)|0,g=g+Math.imul(_e,Re)|0,p=p+Math.imul(ae,Ee)|0,a=a+Math.imul(ae,$e)|0,a=a+Math.imul(le,Ee)|0,g=g+Math.imul(le,$e)|0,p=p+Math.imul(fe,D)|0,a=a+Math.imul(fe,C)|0,a=a+Math.imul(ne,D)|0,g=g+Math.imul(ne,C)|0,p=p+Math.imul(oe,Y)|0,a=a+Math.imul(oe,te)|0,a=a+Math.imul(se,Y)|0,g=g+Math.imul(se,te)|0,p=p+Math.imul(O,re)|0,a=a+Math.imul(O,ve)|0,a=a+Math.imul(Q,re)|0,g=g+Math.imul(Q,ve)|0,p=p+Math.imul(W,ce)|0,a=a+Math.imul(W,Me)|0,a=a+Math.imul(G,ce)|0,g=g+Math.imul(G,Me)|0,p=p+Math.imul(H,Se)|0,a=a+Math.imul(H,Te)|0,a=a+Math.imul($,Se)|0,g=g+Math.imul($,Te)|0;var Mt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,p=Math.imul(me,pe),a=Math.imul(me,Ne),a=a+Math.imul(ge,pe)|0,g=Math.imul(ge,Ne),p=p+Math.imul(ye,xe)|0,a=a+Math.imul(ye,Re)|0,a=a+Math.imul(Ae,xe)|0,g=g+Math.imul(Ae,Re)|0,p=p+Math.imul(he,Ee)|0,a=a+Math.imul(he,$e)|0,a=a+Math.imul(_e,Ee)|0,g=g+Math.imul(_e,$e)|0,p=p+Math.imul(ae,D)|0,a=a+Math.imul(ae,C)|0,a=a+Math.imul(le,D)|0,g=g+Math.imul(le,C)|0,p=p+Math.imul(fe,Y)|0,a=a+Math.imul(fe,te)|0,a=a+Math.imul(ne,Y)|0,g=g+Math.imul(ne,te)|0,p=p+Math.imul(oe,re)|0,a=a+Math.imul(oe,ve)|0,a=a+Math.imul(se,re)|0,g=g+Math.imul(se,ve)|0,p=p+Math.imul(O,ce)|0,a=a+Math.imul(O,Me)|0,a=a+Math.imul(Q,ce)|0,g=g+Math.imul(Q,Me)|0,p=p+Math.imul(W,Se)|0,a=a+Math.imul(W,Te)|0,a=a+Math.imul(G,Se)|0,g=g+Math.imul(G,Te)|0;var _t=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(_t>>>26)|0,_t&=67108863,p=Math.imul(me,xe),a=Math.imul(me,Re),a=a+Math.imul(ge,xe)|0,g=Math.imul(ge,Re),p=p+Math.imul(ye,Ee)|0,a=a+Math.imul(ye,$e)|0,a=a+Math.imul(Ae,Ee)|0,g=g+Math.imul(Ae,$e)|0,p=p+Math.imul(he,D)|0,a=a+Math.imul(he,C)|0,a=a+Math.imul(_e,D)|0,g=g+Math.imul(_e,C)|0,p=p+Math.imul(ae,Y)|0,a=a+Math.imul(ae,te)|0,a=a+Math.imul(le,Y)|0,g=g+Math.imul(le,te)|0,p=p+Math.imul(fe,re)|0,a=a+Math.imul(fe,ve)|0,a=a+Math.imul(ne,re)|0,g=g+Math.imul(ne,ve)|0,p=p+Math.imul(oe,ce)|0,a=a+Math.imul(oe,Me)|0,a=a+Math.imul(se,ce)|0,g=g+Math.imul(se,Me)|0,p=p+Math.imul(O,Se)|0,a=a+Math.imul(O,Te)|0,a=a+Math.imul(Q,Se)|0,g=g+Math.imul(Q,Te)|0;var Et=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Et>>>26)|0,Et&=67108863,p=Math.imul(me,Ee),a=Math.imul(me,$e),a=a+Math.imul(ge,Ee)|0,g=Math.imul(ge,$e),p=p+Math.imul(ye,D)|0,a=a+Math.imul(ye,C)|0,a=a+Math.imul(Ae,D)|0,g=g+Math.imul(Ae,C)|0,p=p+Math.imul(he,Y)|0,a=a+Math.imul(he,te)|0,a=a+Math.imul(_e,Y)|0,g=g+Math.imul(_e,te)|0,p=p+Math.imul(ae,re)|0,a=a+Math.imul(ae,ve)|0,a=a+Math.imul(le,re)|0,g=g+Math.imul(le,ve)|0,p=p+Math.imul(fe,ce)|0,a=a+Math.imul(fe,Me)|0,a=a+Math.imul(ne,ce)|0,g=g+Math.imul(ne,Me)|0,p=p+Math.imul(oe,Se)|0,a=a+Math.imul(oe,Te)|0,a=a+Math.imul(se,Se)|0,g=g+Math.imul(se,Te)|0;var St=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(St>>>26)|0,St&=67108863,p=Math.imul(me,D),a=Math.imul(me,C),a=a+Math.imul(ge,D)|0,g=Math.imul(ge,C),p=p+Math.imul(ye,Y)|0,a=a+Math.imul(ye,te)|0,a=a+Math.imul(Ae,Y)|0,g=g+Math.imul(Ae,te)|0,p=p+Math.imul(he,re)|0,a=a+Math.imul(he,ve)|0,a=a+Math.imul(_e,re)|0,g=g+Math.imul(_e,ve)|0,p=p+Math.imul(ae,ce)|0,a=a+Math.imul(ae,Me)|0,a=a+Math.imul(le,ce)|0,g=g+Math.imul(le,Me)|0,p=p+Math.imul(fe,Se)|0,a=a+Math.imul(fe,Te)|0,a=a+Math.imul(ne,Se)|0,g=g+Math.imul(ne,Te)|0;var At=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(At>>>26)|0,At&=67108863,p=Math.imul(me,Y),a=Math.imul(me,te),a=a+Math.imul(ge,Y)|0,g=Math.imul(ge,te),p=p+Math.imul(ye,re)|0,a=a+Math.imul(ye,ve)|0,a=a+Math.imul(Ae,re)|0,g=g+Math.imul(Ae,ve)|0,p=p+Math.imul(he,ce)|0,a=a+Math.imul(he,Me)|0,a=a+Math.imul(_e,ce)|0,g=g+Math.imul(_e,Me)|0,p=p+Math.imul(ae,Se)|0,a=a+Math.imul(ae,Te)|0,a=a+Math.imul(le,Se)|0,g=g+Math.imul(le,Te)|0;var kt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(kt>>>26)|0,kt&=67108863,p=Math.imul(me,re),a=Math.imul(me,ve),a=a+Math.imul(ge,re)|0,g=Math.imul(ge,ve),p=p+Math.imul(ye,ce)|0,a=a+Math.imul(ye,Me)|0,a=a+Math.imul(Ae,ce)|0,g=g+Math.imul(Ae,Me)|0,p=p+Math.imul(he,Se)|0,a=a+Math.imul(he,Te)|0,a=a+Math.imul(_e,Se)|0,g=g+Math.imul(_e,Te)|0;var Bt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,p=Math.imul(me,ce),a=Math.imul(me,Me),a=a+Math.imul(ge,ce)|0,g=Math.imul(ge,Me),p=p+Math.imul(ye,Se)|0,a=a+Math.imul(ye,Te)|0,a=a+Math.imul(Ae,Se)|0,g=g+Math.imul(Ae,Te)|0;var Rt=(m+p|0)+((a&8191)<<13)|0;m=(g+(a>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,p=Math.imul(me,Se),a=Math.imul(me,Te),a=a+Math.imul(ge,Se)|0,g=Math.imul(ge,Te);var $t=(m+p|0)+((a&8191)<<13)|0;return m=(g+(a>>>13)|0)+($t>>>26)|0,$t&=67108863,y[0]=Ge,y[1]=Je,y[2]=pt,y[3]=vt,y[4]=gt,y[5]=yt,y[6]=mt,y[7]=wt,y[8]=bt,y[9]=xt,y[10]=Mt,y[11]=_t,y[12]=Et,y[13]=St,y[14]=At,y[15]=kt,y[16]=Bt,y[17]=Rt,y[18]=$t,m!==0&&(y[19]=m,l.length++),l};Math.imul||(B=R);function I(x,o,f){f.negative=o.negative^x.negative,f.length=x.length+o.length;for(var l=0,h=0,v=0;v<f.length-1;v++){var y=h;h=0;for(var m=l&67108863,p=Math.min(v,o.length-1),a=Math.max(0,v-x.length+1);a<=p;a++){var g=v-a,S=x.words[g]|0,N=o.words[a]|0,U=S*N,Z=U&67108863;y=y+(U/67108864|0)|0,Z=Z+m|0,m=Z&67108863,y=y+(Z>>>26)|0,h+=y>>>26,y&=67108863}f.words[v]=m,l=y,y=h}return l!==0?f.words[v]=l:f.length--,f.strip()}function E(x,o,f){var l=new k;return l.mulp(x,o,f)}i.prototype.mulTo=function(o,f){var l,h=this.length+o.length;return this.length===10&&o.length===10?l=B(this,o,f):h<63?l=R(this,o,f):h<1024?l=I(this,o,f):l=E(this,o,f),l};function k(x,o){this.x=x,this.y=o}k.prototype.makeRBT=function(o){for(var f=new Array(o),l=i.prototype._countBits(o)-1,h=0;h<o;h++)f[h]=this.revBin(h,l,o);return f},k.prototype.revBin=function(o,f,l){if(o===0||o===l-1)return o;for(var h=0,v=0;v<f;v++)h|=(o&1)<<f-v-1,o>>=1;return h},k.prototype.permute=function(o,f,l,h,v,y){for(var m=0;m<y;m++)h[m]=f[o[m]],v[m]=l[o[m]]},k.prototype.transform=function(o,f,l,h,v,y){this.permute(y,o,f,l,h,v);for(var m=1;m<v;m<<=1)for(var p=m<<1,a=Math.cos(2*Math.PI/p),g=Math.sin(2*Math.PI/p),S=0;S<v;S+=p)for(var N=a,U=g,Z=0;Z<m;Z++){var H=l[S+Z],$=h[S+Z],P=l[S+Z+m],W=h[S+Z+m],G=N*P-U*W;W=N*W+U*P,P=G,l[S+Z]=H+P,h[S+Z]=$+W,l[S+Z+m]=H-P,h[S+Z+m]=$-W,Z!==p&&(G=a*N-g*U,U=a*U+g*N,N=G)}},k.prototype.guessLen13b=function(o,f){var l=Math.max(f,o)|1,h=l&1,v=0;for(l=l/2|0;l;l=l>>>1)v++;return 1<<v+1+h},k.prototype.conjugate=function(o,f,l){if(!(l<=1))for(var h=0;h<l/2;h++){var v=o[h];o[h]=o[l-h-1],o[l-h-1]=v,v=f[h],f[h]=-f[l-h-1],f[l-h-1]=-v}},k.prototype.normalize13b=function(o,f){for(var l=0,h=0;h<f/2;h++){var v=Math.round(o[2*h+1]/f)*8192+Math.round(o[2*h]/f)+l;o[h]=v&67108863,v<67108864?l=0:l=v/67108864|0}return o},k.prototype.convert13b=function(o,f,l,h){for(var v=0,y=0;y<f;y++)v=v+(o[y]|0),l[2*y]=v&8191,v=v>>>13,l[2*y+1]=v&8191,v=v>>>13;for(y=2*f;y<h;++y)l[y]=0;n(v===0),n((v&-8192)===0)},k.prototype.stub=function(o){for(var f=new Array(o),l=0;l<o;l++)f[l]=0;return f},k.prototype.mulp=function(o,f,l){var h=2*this.guessLen13b(o.length,f.length),v=this.makeRBT(h),y=this.stub(h),m=new Array(h),p=new Array(h),a=new Array(h),g=new Array(h),S=new Array(h),N=new Array(h),U=l.words;U.length=h,this.convert13b(o.words,o.length,m,h),this.convert13b(f.words,f.length,g,h),this.transform(m,y,p,a,h,v),this.transform(g,y,S,N,h,v);for(var Z=0;Z<h;Z++){var H=p[Z]*S[Z]-a[Z]*N[Z];a[Z]=p[Z]*N[Z]+a[Z]*S[Z],p[Z]=H}return this.conjugate(p,a,h),this.transform(p,a,U,y,h,v),this.conjugate(U,y,h),this.normalize13b(U,h),l.negative=o.negative^f.negative,l.length=o.length+f.length,l.strip()},i.prototype.mul=function(o){var f=new i(null);return f.words=new Array(this.length+o.length),this.mulTo(o,f)},i.prototype.mulf=function(o){var f=new i(null);return f.words=new Array(this.length+o.length),E(this,o,f)},i.prototype.imul=function(o){return this.clone().mulTo(o,this)},i.prototype.imuln=function(o){n(typeof o=="number"),n(o<67108864);for(var f=0,l=0;l<this.length;l++){var h=(this.words[l]|0)*o,v=(h&67108863)+(f&67108863);f>>=26,f+=h/67108864|0,f+=v>>>26,this.words[l]=v&67108863}return f!==0&&(this.words[l]=f,this.length++),this.length=o===0?1:this.length,this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var f=A(o);if(f.length===0)return new i(1);for(var l=this,h=0;h<f.length&&f[h]===0;h++,l=l.sqr());if(++h<f.length)for(var v=l.sqr();h<f.length;h++,v=v.sqr())f[h]!==0&&(l=l.mul(v));return l},i.prototype.iushln=function(o){n(typeof o=="number"&&o>=0);var f=o%26,l=(o-f)/26,h=67108863>>>26-f<<26-f,v;if(f!==0){var y=0;for(v=0;v<this.length;v++){var m=this.words[v]&h,p=(this.words[v]|0)-m<<f;this.words[v]=p|y,y=m>>>26-f}y&&(this.words[v]=y,this.length++)}if(l!==0){for(v=this.length-1;v>=0;v--)this.words[v+l]=this.words[v];for(v=0;v<l;v++)this.words[v]=0;this.length+=l}return this.strip()},i.prototype.ishln=function(o){return n(this.negative===0),this.iushln(o)},i.prototype.iushrn=function(o,f,l){n(typeof o=="number"&&o>=0);var h;f?h=(f-f%26)/26:h=0;var v=o%26,y=Math.min((o-v)/26,this.length),m=67108863^67108863>>>v<<v,p=l;if(h-=y,h=Math.max(0,h),p){for(var a=0;a<y;a++)p.words[a]=this.words[a];p.length=y}if(y!==0)if(this.length>y)for(this.length-=y,a=0;a<this.length;a++)this.words[a]=this.words[a+y];else this.words[0]=0,this.length=1;var g=0;for(a=this.length-1;a>=0&&(g!==0||a>=h);a--){var S=this.words[a]|0;this.words[a]=g<<26-v|S>>>v,g=S&m}return p&&g!==0&&(p.words[p.length++]=g),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,f,l){return n(this.negative===0),this.iushrn(o,f,l)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var f=o%26,l=(o-f)/26,h=1<<f;if(this.length<=l)return!1;var v=this.words[l];return!!(v&h)},i.prototype.imaskn=function(o){n(typeof o=="number"&&o>=0);var f=o%26,l=(o-f)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(f!==0&&l++,this.length=Math.min(l,this.length),f!==0){var h=67108863^67108863>>>f<<f;this.words[this.length-1]&=h}return this.strip()},i.prototype.maskn=function(o){return this.clone().imaskn(o)},i.prototype.iaddn=function(o){return n(typeof o=="number"),n(o<67108864),o<0?this.isubn(-o):this.negative!==0?this.length===1&&(this.words[0]|0)<o?(this.words[0]=o-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(o),this.negative=1,this):this._iaddn(o)},i.prototype._iaddn=function(o){this.words[0]+=o;for(var f=0;f<this.length&&this.words[f]>=67108864;f++)this.words[f]-=67108864,f===this.length-1?this.words[f+1]=1:this.words[f+1]++;return this.length=Math.max(this.length,f+1),this},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var f=0;f<this.length&&this.words[f]<0;f++)this.words[f]+=67108864,this.words[f+1]-=1;return this.strip()},i.prototype.addn=function(o){return this.clone().iaddn(o)},i.prototype.subn=function(o){return this.clone().isubn(o)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(o,f,l){var h=o.length+l,v;this._expand(h);var y,m=0;for(v=0;v<o.length;v++){y=(this.words[v+l]|0)+m;var p=(o.words[v]|0)*f;y-=p&67108863,m=(y>>26)-(p/67108864|0),this.words[v+l]=y&67108863}for(;v<this.length-l;v++)y=(this.words[v+l]|0)+m,m=y>>26,this.words[v+l]=y&67108863;if(m===0)return this.strip();for(n(m===-1),m=0,v=0;v<this.length;v++)y=-(this.words[v]|0)+m,m=y>>26,this.words[v]=y&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,f){var l=this.length-o.length,h=this.clone(),v=o,y=v.words[v.length-1]|0,m=this._countBits(y);l=26-m,l!==0&&(v=v.ushln(l),h.iushln(l),y=v.words[v.length-1]|0);var p=h.length-v.length,a;if(f!=="mod"){a=new i(null),a.length=p+1,a.words=new Array(a.length);for(var g=0;g<a.length;g++)a.words[g]=0}var S=h.clone()._ishlnsubmul(v,1,p);S.negative===0&&(h=S,a&&(a.words[p]=1));for(var N=p-1;N>=0;N--){var U=(h.words[v.length+N]|0)*67108864+(h.words[v.length+N-1]|0);for(U=Math.min(U/y|0,67108863),h._ishlnsubmul(v,U,N);h.negative!==0;)U--,h.negative=0,h._ishlnsubmul(v,1,N),h.isZero()||(h.negative^=1);a&&(a.words[N]=U)}return a&&a.strip(),h.strip(),f!=="div"&&l!==0&&h.iushrn(l),{div:a||null,mod:h}},i.prototype.divmod=function(o,f,l){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,v,y;return this.negative!==0&&o.negative===0?(y=this.neg().divmod(o,f),f!=="mod"&&(h=y.div.neg()),f!=="div"&&(v=y.mod.neg(),l&&v.negative!==0&&v.iadd(o)),{div:h,mod:v}):this.negative===0&&o.negative!==0?(y=this.divmod(o.neg(),f),f!=="mod"&&(h=y.div.neg()),{div:h,mod:y.mod}):this.negative&o.negative?(y=this.neg().divmod(o.neg(),f),f!=="div"&&(v=y.mod.neg(),l&&v.negative!==0&&v.isub(o)),{div:y.div,mod:v}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?f==="div"?{div:this.divn(o.words[0]),mod:null}:f==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,f)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var f=this.divmod(o);if(f.mod.isZero())return f.div;var l=f.div.negative!==0?f.mod.isub(o):f.mod,h=o.ushrn(1),v=o.andln(1),y=l.cmp(h);return y<0||v===1&&y===0?f.div:f.div.negative!==0?f.div.isubn(1):f.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var f=(1<<26)%o,l=0,h=this.length-1;h>=0;h--)l=(f*l+(this.words[h]|0))%o;return l},i.prototype.idivn=function(o){n(o<=67108863);for(var f=0,l=this.length-1;l>=0;l--){var h=(this.words[l]|0)+f*67108864;this.words[l]=h/o|0,f=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var f=this,l=o.clone();f.negative!==0?f=f.umod(o):f=f.clone();for(var h=new i(1),v=new i(0),y=new i(0),m=new i(1),p=0;f.isEven()&&l.isEven();)f.iushrn(1),l.iushrn(1),++p;for(var a=l.clone(),g=f.clone();!f.isZero();){for(var S=0,N=1;!(f.words[0]&N)&&S<26;++S,N<<=1);if(S>0)for(f.iushrn(S);S-- >0;)(h.isOdd()||v.isOdd())&&(h.iadd(a),v.isub(g)),h.iushrn(1),v.iushrn(1);for(var U=0,Z=1;!(l.words[0]&Z)&&U<26;++U,Z<<=1);if(U>0)for(l.iushrn(U);U-- >0;)(y.isOdd()||m.isOdd())&&(y.iadd(a),m.isub(g)),y.iushrn(1),m.iushrn(1);f.cmp(l)>=0?(f.isub(l),h.isub(y),v.isub(m)):(l.isub(f),y.isub(h),m.isub(v))}return{a:y,b:m,gcd:l.iushln(p)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var f=this,l=o.clone();f.negative!==0?f=f.umod(o):f=f.clone();for(var h=new i(1),v=new i(0),y=l.clone();f.cmpn(1)>0&&l.cmpn(1)>0;){for(var m=0,p=1;!(f.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(f.iushrn(m);m-- >0;)h.isOdd()&&h.iadd(y),h.iushrn(1);for(var a=0,g=1;!(l.words[0]&g)&&a<26;++a,g<<=1);if(a>0)for(l.iushrn(a);a-- >0;)v.isOdd()&&v.iadd(y),v.iushrn(1);f.cmp(l)>=0?(f.isub(l),h.isub(v)):(l.isub(f),v.isub(h))}var S;return f.cmpn(1)===0?S=h:S=v,S.cmpn(0)<0&&S.iadd(o),S},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var f=this.clone(),l=o.clone();f.negative=0,l.negative=0;for(var h=0;f.isEven()&&l.isEven();h++)f.iushrn(1),l.iushrn(1);do{for(;f.isEven();)f.iushrn(1);for(;l.isEven();)l.iushrn(1);var v=f.cmp(l);if(v<0){var y=f;f=l,l=y}else if(v===0||l.cmpn(1)===0)break;f.isub(l)}while(!0);return l.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var f=o%26,l=(o-f)/26,h=1<<f;if(this.length<=l)return this._expand(l+1),this.words[l]|=h,this;for(var v=h,y=l;v!==0&&y<this.length;y++){var m=this.words[y]|0;m+=v,v=m>>>26,m&=67108863,this.words[y]=m}return v!==0&&(this.words[y]=v,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var f=o<0;if(this.negative!==0&&!f)return-1;if(this.negative===0&&f)return 1;this.strip();var l;if(this.length>1)l=1;else{f&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;l=h===o?0:h<o?-1:1}return this.negative!==0?-l|0:l},i.prototype.cmp=function(o){if(this.negative!==0&&o.negative===0)return-1;if(this.negative===0&&o.negative!==0)return 1;var f=this.ucmp(o);return this.negative!==0?-f|0:f},i.prototype.ucmp=function(o){if(this.length>o.length)return 1;if(this.length<o.length)return-1;for(var f=0,l=this.length-1;l>=0;l--){var h=this.words[l]|0,v=o.words[l]|0;if(h!==v){h<v?f=-1:h>v&&(f=1);break}}return f},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new X(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var T={k256:null,p224:null,p192:null,p25519:null};function L(x,o){this.name=x,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}L.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},L.prototype.ireduce=function(o){var f=o,l;do this.split(f,this.tmp),f=this.imulK(f),f=f.iadd(this.tmp),l=f.bitLength();while(l>this.n);var h=l<this.n?-1:f.ucmp(this.p);return h===0?(f.words[0]=0,f.length=1):h>0?f.isub(this.p):f.strip!==void 0?f.strip():f._strip(),f},L.prototype.split=function(o,f){o.iushrn(this.n,0,f)},L.prototype.imulK=function(o){return o.imul(this.k)};function q(){L.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(q,L),q.prototype.split=function(o,f){for(var l=4194303,h=Math.min(o.length,9),v=0;v<h;v++)f.words[v]=o.words[v];if(f.length=h,o.length<=9){o.words[0]=0,o.length=1;return}var y=o.words[9];for(f.words[f.length++]=y&l,v=10;v<o.length;v++){var m=o.words[v]|0;o.words[v-10]=(m&l)<<4|y>>>22,y=m}y>>>=22,o.words[v-10]=y,y===0&&o.length>10?o.length-=10:o.length-=9},q.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var f=0,l=0;l<o.length;l++){var h=o.words[l]|0;f+=h*977,o.words[l]=f&67108863,f=h*64+(f/67108864|0)}return o.words[o.length-1]===0&&(o.length--,o.words[o.length-1]===0&&o.length--),o};function z(){L.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(z,L);function J(){L.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(J,L);function F(){L.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(F,L),F.prototype.imulK=function(o){for(var f=0,l=0;l<o.length;l++){var h=(o.words[l]|0)*19+f,v=h&67108863;h>>>=26,o.words[l]=v,f=h}return f!==0&&(o.words[o.length++]=f),o},i._prime=function(o){if(T[o])return T[o];var f;if(o==="k256")f=new q;else if(o==="p224")f=new z;else if(o==="p192")f=new J;else if(o==="p25519")f=new F;else throw new Error("Unknown prime "+o);return T[o]=f,f};function X(x){if(typeof x=="string"){var o=i._prime(x);this.m=o.p,this.prime=o}else n(x.gtn(1),"modulus must be greater than 1"),this.m=x,this.prime=null}X.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},X.prototype._verify2=function(o,f){n((o.negative|f.negative)===0,"red works only with positives"),n(o.red&&o.red===f.red,"red works only with red numbers")},X.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},X.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},X.prototype.add=function(o,f){this._verify2(o,f);var l=o.add(f);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},X.prototype.iadd=function(o,f){this._verify2(o,f);var l=o.iadd(f);return l.cmp(this.m)>=0&&l.isub(this.m),l},X.prototype.sub=function(o,f){this._verify2(o,f);var l=o.sub(f);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},X.prototype.isub=function(o,f){this._verify2(o,f);var l=o.isub(f);return l.cmpn(0)<0&&l.iadd(this.m),l},X.prototype.shl=function(o,f){return this._verify1(o),this.imod(o.ushln(f))},X.prototype.imul=function(o,f){return this._verify2(o,f),this.imod(o.imul(f))},X.prototype.mul=function(o,f){return this._verify2(o,f),this.imod(o.mul(f))},X.prototype.isqr=function(o){return this.imul(o,o.clone())},X.prototype.sqr=function(o){return this.mul(o,o)},X.prototype.sqrt=function(o){if(o.isZero())return o.clone();var f=this.m.andln(3);if(n(f%2===1),f===3){var l=this.m.add(new i(1)).iushrn(2);return this.pow(o,l)}for(var h=this.m.subn(1),v=0;!h.isZero()&&h.andln(1)===0;)v++,h.iushrn(1);n(!h.isZero());var y=new i(1).toRed(this),m=y.redNeg(),p=this.m.subn(1).iushrn(1),a=this.m.bitLength();for(a=new i(2*a*a).toRed(this);this.pow(a,p).cmp(m)!==0;)a.redIAdd(m);for(var g=this.pow(a,h),S=this.pow(o,h.addn(1).iushrn(1)),N=this.pow(o,h),U=v;N.cmp(y)!==0;){for(var Z=N,H=0;Z.cmp(y)!==0;H++)Z=Z.redSqr();n(H<U);var $=this.pow(g,new i(1).iushln(U-H-1));S=S.redMul($),g=$.redSqr(),N=N.redMul(g),U=H}return S},X.prototype.invm=function(o){var f=o._invmp(this.m);return f.negative!==0?(f.negative=0,this.imod(f).redNeg()):this.imod(f)},X.prototype.pow=function(o,f){if(f.isZero())return new i(1).toRed(this);if(f.cmpn(1)===0)return o.clone();var l=4,h=new Array(1<<l);h[0]=new i(1).toRed(this),h[1]=o;for(var v=2;v<h.length;v++)h[v]=this.mul(h[v-1],o);var y=h[0],m=0,p=0,a=f.bitLength()%26;for(a===0&&(a=26),v=f.length-1;v>=0;v--){for(var g=f.words[v],S=a-1;S>=0;S--){var N=g>>S&1;if(y!==h[0]&&(y=this.sqr(y)),N===0&&m===0){p=0;continue}m<<=1,m|=N,p++,!(p!==l&&(v!==0||S!==0))&&(y=this.mul(y,h[m]),p=0,m=0)}a=26}return y},X.prototype.convertTo=function(o){var f=o.umod(this.m);return f===o?f.clone():f},X.prototype.convertFrom=function(o){var f=o.clone();return f.red=null,f},i.mont=function(o){return new ee(o)};function ee(x){X.call(this,x),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(ee,X),ee.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},ee.prototype.convertFrom=function(o){var f=this.imod(o.mul(this.rinv));return f.red=null,f},ee.prototype.imul=function(o,f){if(o.isZero()||f.isZero())return o.words[0]=0,o.length=1,o;var l=o.imul(f),h=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=l.isub(h).iushrn(this.shift),y=v;return v.cmp(this.m)>=0?y=v.isub(this.m):v.cmpn(0)<0&&(y=v.iadd(this.m)),y._forceRed(this)},ee.prototype.mul=function(o,f){if(o.isZero()||f.isZero())return new i(0)._forceRed(this);var l=o.mul(f),h=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=l.isub(h).iushrn(this.shift),y=v;return v.cmp(this.m)>=0?y=v.isub(this.m):v.cmpn(0)<0&&(y=v.iadd(this.m)),y._forceRed(this)},ee.prototype.invm=function(o){var f=this.imod(o._invmp(this.m).mul(this.r2));return f._forceRed(this)}})(e,Ve)})(Fw);var Hw=Fw.exports,$x=Hw,hX=Ye.Buffer;function cX(e,t){return hX.from(e.toRed($x.mont(t.modulus)).redPow(new $x(t.publicExponent)).fromRed().toArray())}var ZA=cX,dX=Yd,Cy=yl,pX=uh,Nx=VA,Tx=KA,zw=Hw,vX=ZA,gX=Tw,Vn=Ye.Buffer,yX=function(t,r,n){var s;t.padding?s=t.padding:n?s=1:s=4;var i=dX(t),u;if(s===4)u=mX(i,r);else if(s===1)u=wX(i,r,n);else if(s===3){if(u=new zw(r),u.cmp(i.modulus)>=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return n?gX(u,i):vX(u,i)};function mX(e,t){var r=e.modulus.byteLength(),n=t.length,s=pX("sha1").update(Vn.alloc(0)).digest(),i=s.length,u=2*i;if(n>r-u-2)throw new Error("message too long");var d=Vn.alloc(r-n-u-2),c=r-i-1,b=Cy(i),w=Tx(Vn.concat([s,d,Vn.alloc(1,1),t],c),Nx(b,c)),M=Tx(b,Nx(w,i));return new zw(Vn.concat([Vn.alloc(1),M,w],r))}function wX(e,t,r){var n=t.length,s=e.modulus.byteLength();if(n>s-11)throw new Error("message too long");var i;return r?i=Vn.alloc(s-n-3,255):i=bX(s-n-3),new zw(Vn.concat([Vn.from([0,r?1:2]),i,Vn.alloc(1),t],s))}function bX(e){for(var t=Vn.allocUnsafe(e),r=0,n=Cy(e*2),s=0,i;r<e;)s===n.length&&(n=Cy(e*2),s=0),i=n[s++],i&&(t[r++]=i);return t}var xX=Yd,Ix=VA,Cx=KA,Px=Hw,MX=Tw,_X=uh,EX=ZA,Wu=Ye.Buffer,SX=function(t,r,n){var s;t.padding?s=t.padding:n?s=1:s=4;var i=xX(t),u=i.modulus.byteLength();if(r.length>u||new Px(r).cmp(i.modulus)>=0)throw new Error("decryption error");var d;n?d=EX(new Px(r),i):d=MX(r,i);var c=Wu.alloc(u-d.length);if(d=Wu.concat([c,d],u),s===4)return AX(i,d);if(s===1)return kX(i,d,n);if(s===3)return d;throw new Error("unknown padding")};function AX(e,t){var r=e.modulus.byteLength(),n=_X("sha1").update(Wu.alloc(0)).digest(),s=n.length;if(t[0]!==0)throw new Error("decryption error");var i=t.slice(1,s+1),u=t.slice(s+1),d=Cx(i,Ix(u,s)),c=Cx(u,Ix(d,r-s-1));if(BX(n,c.slice(0,s)))throw new Error("decryption error");for(var b=s;c[b]===0;)b++;if(c[b++]!==1)throw new Error("decryption error");return c.slice(b)}function kX(e,t,r){for(var n=t.slice(0,2),s=2,i=0;t[s++]!==0;)if(s>=t.length){i++;break}var u=t.slice(2,s-1);if((n.toString("hex")!=="0002"&&!r||n.toString("hex")!=="0001"&&r)&&i++,u.length<8&&i++,i)throw new Error("decryption error");return t.slice(s)}function BX(e,t){e=Wu.from(e),t=Wu.from(t);var r=0,n=e.length;e.length!==t.length&&(r++,n=Math.min(e.length,t.length));for(var s=-1;++s<n;)r+=e[s]^t[s];return r}(function(e){e.publicEncrypt=yX,e.privateDecrypt=SX,e.privateEncrypt=function(r,n){return e.publicEncrypt(r,n,!0)},e.publicDecrypt=function(r,n){return e.privateDecrypt(r,n,!0)}})(WA);var au={};function Lx(){throw new Error(`secure random number generation not supported by this browser
59
- use chrome, FireFox or Internet Explorer 11`)}var GA=Ye,Ox=yl,JA=GA.Buffer,YA=GA.kMaxLength,Py=Ve.crypto||Ve.msCrypto,XA=Math.pow(2,32)-1;function QA(e,t){if(typeof e!="number"||e!==e)throw new TypeError("offset must be a number");if(e>XA||e<0)throw new TypeError("offset must be a uint32");if(e>YA||e>t)throw new RangeError("offset out of range")}function ek(e,t,r){if(typeof e!="number"||e!==e)throw new TypeError("size must be a number");if(e>XA||e<0)throw new TypeError("size must be a uint32");if(e+t>r||e>YA)throw new RangeError("buffer too small")}Py&&Py.getRandomValues||!qe.browser?(au.randomFill=RX,au.randomFillSync=$X):(au.randomFill=Lx,au.randomFillSync=Lx);function RX(e,t,r,n){if(!JA.isBuffer(e)&&!(e instanceof Ve.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof t=="function")n=t,t=0,r=e.length;else if(typeof r=="function")n=r,r=e.length-t;else if(typeof n!="function")throw new TypeError('"cb" argument must be a function');return QA(t,e.length),ek(r,t,e.length),tk(e,t,r,n)}function tk(e,t,r,n){if(qe.browser){var s=e.buffer,i=new Uint8Array(s,t,r);if(Py.getRandomValues(i),n){qe.nextTick(function(){n(null,e)});return}return e}if(n){Ox(r,function(d,c){if(d)return n(d);c.copy(e,t),n(null,e)});return}var u=Ox(r);return u.copy(e,t),e}function $X(e,t,r){if(typeof t>"u"&&(t=0),!JA.isBuffer(e)&&!(e instanceof Ve.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return QA(t,e.length),r===void 0&&(r=e.length-t),ek(r,t,e.length),tk(e,t,r)}var Ux;function rk(){if(Ux)return et;Ux=1,et.randomBytes=et.rng=et.pseudoRandomBytes=et.prng=yl,et.createHash=et.Hash=uh,et.createHmac=et.Hmac=cS;var e=yK,t=Object.keys(e),r=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(t);et.getHashes=function(){return r};var n=Pd;et.pbkdf2=n.pbkdf2,et.pbkdf2Sync=n.pbkdf2Sync;var s=Xn;et.Cipher=s.Cipher,et.createCipher=s.createCipher,et.Cipheriv=s.Cipheriv,et.createCipheriv=s.createCipheriv,et.Decipher=s.Decipher,et.createDecipher=s.createDecipher,et.Decipheriv=s.Decipheriv,et.createDecipheriv=s.createDecipheriv,et.getCiphers=s.getCiphers,et.listCiphers=s.listCiphers;var i=rG();et.DiffieHellmanGroup=i.DiffieHellmanGroup,et.createDiffieHellmanGroup=i.createDiffieHellmanGroup,et.getDiffieHellman=i.getDiffieHellman,et.createDiffieHellman=i.createDiffieHellman,et.DiffieHellman=i.DiffieHellman;var u=sX();et.createSign=u.createSign,et.Sign=u.Sign,et.createVerify=u.createVerify,et.Verify=u.Verify,et.createECDH=fX();var d=WA;et.publicEncrypt=d.publicEncrypt,et.privateEncrypt=d.privateEncrypt,et.publicDecrypt=d.publicDecrypt,et.privateDecrypt=d.privateDecrypt;var c=au;return et.randomFill=c.randomFill,et.randomFillSync=c.randomFillSync,et.createCredentials=function(){throw new Error(`sorry, createCredentials is not implemented yet
60
- we accept pull requests
61
- https://github.com/browserify/crypto-browserify`)},et.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},et}var Xd=rk();const NX=Xy(Xd),If=gR({__proto__:null,default:NX},[Xd]);var TX=Object.defineProperty,IX=(e,t)=>{for(var r in t)TX(e,r,{get:t[r],enumerable:!0})};function jx(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function nk(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function CX(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");jx(e.outputLen),jx(e.blockLen)}function E0(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function PX(e,t){nk(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var kv=If&&typeof If=="object"&&"webcrypto"in If?Xd.webcrypto:void 0,ik=e=>e instanceof Uint8Array,Bv=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),ui=(e,t)=>e<<32-t|e>>>t,LX=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!LX)throw new Error("Non little-endian hardware is not supported");function OX(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Ww(e){if(typeof e=="string"&&(e=OX(e)),!ik(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}function UX(...e){const t=new Uint8Array(e.reduce((n,s)=>n+s.length,0));let r=0;return e.forEach(n=>{if(!ik(n))throw new Error("Uint8Array expected");t.set(n,r),r+=n.length}),t}var ok=class{clone(){return this._cloneInto()}};function jX(e){const t=n=>e().update(Ww(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function sk(e=32){if(kv&&typeof kv.getRandomValues=="function")return kv.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function DX(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);const s=BigInt(32),i=BigInt(4294967295),u=Number(r>>s&i),d=Number(r&i),c=n?4:0,b=n?0:4;e.setUint32(t+c,u,n),e.setUint32(t+b,d,n)}var qX=class extends ok{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Bv(this.buffer)}update(e){E0(this);const{view:t,buffer:r,blockLen:n}=this;e=Ww(e);const s=e.length;for(let i=0;i<s;){const u=Math.min(n-this.pos,s-i);if(u===n){const d=Bv(e);for(;n<=s-i;i+=n)this.process(d,i);continue}r.set(e.subarray(i,i+u),this.pos),this.pos+=u,i+=u,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){E0(this),PX(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:s}=this;let{pos:i}=this;t[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>n-i&&(this.process(r,0),i=0);for(let w=i;w<n;w++)t[w]=0;DX(r,n-8,BigInt(this.length*8),s),this.process(r,0);const u=Bv(e),d=this.outputLen;if(d%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=d/4,b=this.get();if(c>b.length)throw new Error("_sha2: outputLen bigger than state");for(let w=0;w<c;w++)u.setUint32(4*w,b[w],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:s,destroyed:i,pos:u}=this;return e.length=n,e.pos=u,e.finished=s,e.destroyed=i,n%t&&e.buffer.set(r),e}},FX=(e,t,r)=>e&t^~e&r,HX=(e,t,r)=>e&t^e&r^t&r,zX=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ko=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Zo=new Uint32Array(64),WX=class extends qX{constructor(){super(64,32,8,!1),this.A=Ko[0]|0,this.B=Ko[1]|0,this.C=Ko[2]|0,this.D=Ko[3]|0,this.E=Ko[4]|0,this.F=Ko[5]|0,this.G=Ko[6]|0,this.H=Ko[7]|0}get(){const{A:e,B:t,C:r,D:n,E:s,F:i,G:u,H:d}=this;return[e,t,r,n,s,i,u,d]}set(e,t,r,n,s,i,u,d){this.A=e|0,this.B=t|0,this.C=r|0,this.D=n|0,this.E=s|0,this.F=i|0,this.G=u|0,this.H=d|0}process(e,t){for(let w=0;w<16;w++,t+=4)Zo[w]=e.getUint32(t,!1);for(let w=16;w<64;w++){const M=Zo[w-15],_=Zo[w-2],A=ui(M,7)^ui(M,18)^M>>>3,R=ui(_,17)^ui(_,19)^_>>>10;Zo[w]=R+Zo[w-7]+A+Zo[w-16]|0}let{A:r,B:n,C:s,D:i,E:u,F:d,G:c,H:b}=this;for(let w=0;w<64;w++){const M=ui(u,6)^ui(u,11)^ui(u,25),_=b+M+FX(u,d,c)+zX[w]+Zo[w]|0,R=(ui(r,2)^ui(r,13)^ui(r,22))+HX(r,n,s)|0;b=c,c=d,d=u,u=i+_|0,i=s,s=n,n=r,r=_+R|0}r=r+this.A|0,n=n+this.B|0,s=s+this.C|0,i=i+this.D|0,u=u+this.E|0,d=d+this.F|0,c=c+this.G|0,b=b+this.H|0,this.set(r,n,s,i,u,d,c,b)}roundClean(){Zo.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Ly=jX(()=>new WX),ak={};IX(ak,{bitGet:()=>XX,bitLen:()=>YX,bitMask:()=>Gw,bitSet:()=>QX,bytesToHex:()=>sl,bytesToNumberBE:()=>rn,bytesToNumberLE:()=>Kw,concatBytes:()=>Pa,createHmacDrbg:()=>uk,ensureBytes:()=>Cr,equalBytes:()=>GX,hexToBytes:()=>al,hexToNumber:()=>Vw,numberToBytesBE:()=>As,numberToBytesLE:()=>Zw,numberToHexUnpadded:()=>lk,numberToVarBytesBE:()=>ZX,utf8ToBytes:()=>JX,validateObject:()=>wh});var fk=BigInt(0),Qd=BigInt(1),VX=BigInt(2),ep=e=>e instanceof Uint8Array,KX=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function sl(e){if(!ep(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=KX[e[r]];return t}function lk(e){const t=e.toString(16);return t.length&1?`0${t}`:t}function Vw(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return BigInt(e===""?"0":`0x${e}`)}function al(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(t/2);for(let n=0;n<r.length;n++){const s=n*2,i=e.slice(s,s+2),u=Number.parseInt(i,16);if(Number.isNaN(u)||u<0)throw new Error("Invalid byte sequence");r[n]=u}return r}function rn(e){return Vw(sl(e))}function Kw(e){if(!ep(e))throw new Error("Uint8Array expected");return Vw(sl(Uint8Array.from(e).reverse()))}function As(e,t){return al(e.toString(16).padStart(t*2,"0"))}function Zw(e,t){return As(e,t).reverse()}function ZX(e){return al(lk(e))}function Cr(e,t,r){let n;if(typeof t=="string")try{n=al(t)}catch(i){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${i}`)}else if(ep(t))n=Uint8Array.from(t);else throw new Error(`${e} must be hex string or Uint8Array`);const s=n.length;if(typeof r=="number"&&s!==r)throw new Error(`${e} expected ${r} bytes, got ${s}`);return n}function Pa(...e){const t=new Uint8Array(e.reduce((n,s)=>n+s.length,0));let r=0;return e.forEach(n=>{if(!ep(n))throw new Error("Uint8Array expected");t.set(n,r),r+=n.length}),t}function GX(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function JX(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function YX(e){let t;for(t=0;e>fk;e>>=Qd,t+=1);return t}function XX(e,t){return e>>BigInt(t)&Qd}var QX=(e,t,r)=>e|(r?Qd:fk)<<BigInt(t),Gw=e=>(VX<<BigInt(e-1))-Qd,Rv=e=>new Uint8Array(e),Dx=e=>Uint8Array.from(e);function uk(e,t,r){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=Rv(e),s=Rv(e),i=0;const u=()=>{n.fill(1),s.fill(0),i=0},d=(...M)=>r(s,n,...M),c=(M=Rv())=>{s=d(Dx([0]),M),n=d(),M.length!==0&&(s=d(Dx([1]),M),n=d())},b=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let M=0;const _=[];for(;M<t;){n=d();const A=n.slice();_.push(A),M+=n.length}return Pa(..._)};return(M,_)=>{u(),c(M);let A;for(;!(A=_(b()));)c();return u(),A}}var eQ={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function wh(e,t,r={}){const n=(s,i,u)=>{const d=eQ[i];if(typeof d!="function")throw new Error(`Invalid validator "${i}", expected function`);const c=e[s];if(!(u&&c===void 0)&&!d(c,e))throw new Error(`Invalid param ${String(s)}=${c} (${typeof c}), expected ${i}`)};for(const[s,i]of Object.entries(t))n(s,i,!1);for(const[s,i]of Object.entries(r))n(s,i,!0);return e}var dr=BigInt(0),Yt=BigInt(1),oa=BigInt(2),tQ=BigInt(3),Oy=BigInt(4),qx=BigInt(5),Fx=BigInt(8);BigInt(9);BigInt(16);function Mr(e,t){const r=e%t;return r>=dr?r:t+r}function rQ(e,t,r){if(r<=dr||t<dr)throw new Error("Expected power/modulo > 0");if(r===Yt)return dr;let n=Yt;for(;t>dr;)t&Yt&&(n=n*e%r),e=e*e%r,t>>=Yt;return n}function bn(e,t,r){let n=e;for(;t-- >dr;)n*=n,n%=r;return n}function Uy(e,t){if(e===dr||t<=dr)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=Mr(e,t),n=t,s=dr,i=Yt;for(;r!==dr;){const d=n/r,c=n%r,b=s-i*d;n=r,r=c,s=i,i=b}if(n!==Yt)throw new Error("invert: does not exist");return Mr(s,t)}function nQ(e){const t=(e-Yt)/oa;let r,n,s;for(r=e-Yt,n=0;r%oa===dr;r/=oa,n++);for(s=oa;s<e&&rQ(s,t,e)!==e-Yt;s++);if(n===1){const u=(e+Yt)/Oy;return function(c,b){const w=c.pow(b,u);if(!c.eql(c.sqr(w),b))throw new Error("Cannot find square root");return w}}const i=(r+Yt)/oa;return function(d,c){if(d.pow(c,t)===d.neg(d.ONE))throw new Error("Cannot find square root");let b=n,w=d.pow(d.mul(d.ONE,s),r),M=d.pow(c,i),_=d.pow(c,r);for(;!d.eql(_,d.ONE);){if(d.eql(_,d.ZERO))return d.ZERO;let A=1;for(let B=d.sqr(_);A<b&&!d.eql(B,d.ONE);A++)B=d.sqr(B);const R=d.pow(w,Yt<<BigInt(b-A-1));w=d.sqr(R),M=d.mul(M,R),_=d.mul(_,w),b=A}return M}}function iQ(e){if(e%Oy===tQ){const t=(e+Yt)/Oy;return function(n,s){const i=n.pow(s,t);if(!n.eql(n.sqr(i),s))throw new Error("Cannot find square root");return i}}if(e%Fx===qx){const t=(e-qx)/Fx;return function(n,s){const i=n.mul(s,oa),u=n.pow(i,t),d=n.mul(s,u),c=n.mul(n.mul(d,oa),u),b=n.mul(d,n.sub(c,n.ONE));if(!n.eql(n.sqr(b),s))throw new Error("Cannot find square root");return b}}return nQ(e)}var oQ=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function sQ(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=oQ.reduce((n,s)=>(n[s]="function",n),t);return wh(e,r)}function aQ(e,t,r){if(r<dr)throw new Error("Expected power > 0");if(r===dr)return e.ONE;if(r===Yt)return t;let n=e.ONE,s=t;for(;r>dr;)r&Yt&&(n=e.mul(n,s)),s=e.sqr(s),r>>=Yt;return n}function fQ(e,t){const r=new Array(t.length),n=t.reduce((i,u,d)=>e.is0(u)?i:(r[d]=i,e.mul(i,u)),e.ONE),s=e.inv(n);return t.reduceRight((i,u,d)=>e.is0(u)?i:(r[d]=e.mul(i,r[d]),e.mul(i,u)),s),r}function hk(e,t){const r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function lQ(e,t,r=!1,n={}){if(e<=dr)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:s,nByteLength:i}=hk(e,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const u=iQ(e),d=Object.freeze({ORDER:e,BITS:s,BYTES:i,MASK:Gw(s),ZERO:dr,ONE:Yt,create:c=>Mr(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return dr<=c&&c<e},is0:c=>c===dr,isOdd:c=>(c&Yt)===Yt,neg:c=>Mr(-c,e),eql:(c,b)=>c===b,sqr:c=>Mr(c*c,e),add:(c,b)=>Mr(c+b,e),sub:(c,b)=>Mr(c-b,e),mul:(c,b)=>Mr(c*b,e),pow:(c,b)=>aQ(d,c,b),div:(c,b)=>Mr(c*Uy(b,e),e),sqrN:c=>c*c,addN:(c,b)=>c+b,subN:(c,b)=>c-b,mulN:(c,b)=>c*b,inv:c=>Uy(c,e),sqrt:n.sqrt||(c=>u(d,c)),invertBatch:c=>fQ(d,c),cmov:(c,b,w)=>w?b:c,toBytes:c=>r?Zw(c,i):As(c,i),fromBytes:c=>{if(c.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${c.length}`);return r?Kw(c):rn(c)}});return Object.freeze(d)}function ck(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function dk(e){const t=ck(e);return t+Math.ceil(t/2)}function uQ(e,t,r=!1){const n=e.length,s=ck(t),i=dk(t);if(n<16||n<i||n>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);const u=r?rn(e):Kw(e),d=Mr(u,t-Yt)+Yt;return r?Zw(d,s):As(d,s)}var hQ=BigInt(0),$v=BigInt(1);function cQ(e,t){const r=(s,i)=>{const u=i.negate();return s?u:i},n=s=>{const i=Math.ceil(t/s)+1,u=2**(s-1);return{windows:i,windowSize:u}};return{constTimeNegate:r,unsafeLadder(s,i){let u=e.ZERO,d=s;for(;i>hQ;)i&$v&&(u=u.add(d)),d=d.double(),i>>=$v;return u},precomputeWindow(s,i){const{windows:u,windowSize:d}=n(i),c=[];let b=s,w=b;for(let M=0;M<u;M++){w=b,c.push(w);for(let _=1;_<d;_++)w=w.add(b),c.push(w);b=w.double()}return c},wNAF(s,i,u){const{windows:d,windowSize:c}=n(s);let b=e.ZERO,w=e.BASE;const M=BigInt(2**s-1),_=2**s,A=BigInt(s);for(let R=0;R<d;R++){const B=R*c;let I=Number(u&M);u>>=A,I>c&&(I-=_,u+=$v);const E=B,k=B+Math.abs(I)-1,T=R%2!==0,L=I<0;I===0?w=w.add(r(T,i[E])):b=b.add(r(L,i[k]))}return{p:b,f:w}},wNAFCached(s,i,u,d){const c=s._WINDOW_SIZE||1;let b=i.get(s);return b||(b=this.precomputeWindow(s,c),c!==1&&i.set(s,d(b))),this.wNAF(c,b,u)}}}function pk(e){return sQ(e.Fp),wh(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...hk(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function dQ(e){const t=pk(e);wh(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:s}=t;if(r){if(!n.eql(s,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:pQ,hexToBytes:vQ}=ak,va={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(e){const{Err:t}=va;if(e.length<2||e[0]!==2)throw new t("Invalid signature integer tag");const r=e[1],n=e.subarray(2,r+2);if(!r||n.length!==r)throw new t("Invalid signature integer: wrong length");if(n[0]&128)throw new t("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:pQ(n),l:e.subarray(r+2)}},toSig(e){const{Err:t}=va,r=typeof e=="string"?vQ(e):e;if(!(r instanceof Uint8Array))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new t("Invalid signature tag");if(r[1]!==n-2)throw new t("Invalid signature: incorrect length");const{d:s,l:i}=va._parseInt(r.subarray(2)),{d:u,l:d}=va._parseInt(i);if(d.length)throw new t("Invalid signature: left bytes after parsing");return{r:s,s:u}},hexFromSig(e){const t=b=>Number.parseInt(b[0],16)&8?"00"+b:b,r=b=>{const w=b.toString(16);return w.length&1?`0${w}`:w},n=t(r(e.s)),s=t(r(e.r)),i=n.length/2,u=s.length/2,d=r(i),c=r(u);return`30${r(u+i+4)}02${c}${s}02${d}${n}`}},eo=BigInt(0),_n=BigInt(1);BigInt(2);var Hx=BigInt(3);BigInt(4);function gQ(e){const t=dQ(e),{Fp:r}=t,n=t.toBytes||((R,B,I)=>{const E=B.toAffine();return Pa(Uint8Array.from([4]),r.toBytes(E.x),r.toBytes(E.y))}),s=t.fromBytes||(R=>{const B=R.subarray(1),I=r.fromBytes(B.subarray(0,r.BYTES)),E=r.fromBytes(B.subarray(r.BYTES,2*r.BYTES));return{x:I,y:E}});function i(R){const{a:B,b:I}=t,E=r.sqr(R),k=r.mul(E,R);return r.add(r.add(k,r.mul(R,B)),I)}if(!r.eql(r.sqr(t.Gy),i(t.Gx)))throw new Error("bad generator point: equation left != right");function u(R){return typeof R=="bigint"&&eo<R&&R<t.n}function d(R){if(!u(R))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function c(R){const{allowedPrivateKeyLengths:B,nByteLength:I,wrapPrivateKey:E,n:k}=t;if(B&&typeof R!="bigint"){if(R instanceof Uint8Array&&(R=sl(R)),typeof R!="string"||!B.includes(R.length))throw new Error("Invalid key");R=R.padStart(I*2,"0")}let T;try{T=typeof R=="bigint"?R:rn(Cr("private key",R,I))}catch{throw new Error(`private key must be ${I} bytes, hex or bigint, not ${typeof R}`)}return E&&(T=Mr(T,k)),d(T),T}const b=new Map;function w(R){if(!(R instanceof M))throw new Error("ProjectivePoint expected")}class M{constructor(B,I,E){if(this.px=B,this.py=I,this.pz=E,B==null||!r.isValid(B))throw new Error("x required");if(I==null||!r.isValid(I))throw new Error("y required");if(E==null||!r.isValid(E))throw new Error("z required")}static fromAffine(B){const{x:I,y:E}=B||{};if(!B||!r.isValid(I)||!r.isValid(E))throw new Error("invalid affine point");if(B instanceof M)throw new Error("projective point not allowed");const k=T=>r.eql(T,r.ZERO);return k(I)&&k(E)?M.ZERO:new M(I,E,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(B){const I=r.invertBatch(B.map(E=>E.pz));return B.map((E,k)=>E.toAffine(I[k])).map(M.fromAffine)}static fromHex(B){const I=M.fromAffine(s(Cr("pointHex",B)));return I.assertValidity(),I}static fromPrivateKey(B){return M.BASE.multiply(c(B))}_setWindowSize(B){this._WINDOW_SIZE=B,b.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:B,y:I}=this.toAffine();if(!r.isValid(B)||!r.isValid(I))throw new Error("bad point: x or y not FE");const E=r.sqr(I),k=i(B);if(!r.eql(E,k))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:B}=this.toAffine();if(r.isOdd)return!r.isOdd(B);throw new Error("Field doesn't support isOdd")}equals(B){w(B);const{px:I,py:E,pz:k}=this,{px:T,py:L,pz:q}=B,z=r.eql(r.mul(I,q),r.mul(T,k)),J=r.eql(r.mul(E,q),r.mul(L,k));return z&&J}negate(){return new M(this.px,r.neg(this.py),this.pz)}double(){const{a:B,b:I}=t,E=r.mul(I,Hx),{px:k,py:T,pz:L}=this;let q=r.ZERO,z=r.ZERO,J=r.ZERO,F=r.mul(k,k),X=r.mul(T,T),ee=r.mul(L,L),x=r.mul(k,T);return x=r.add(x,x),J=r.mul(k,L),J=r.add(J,J),q=r.mul(B,J),z=r.mul(E,ee),z=r.add(q,z),q=r.sub(X,z),z=r.add(X,z),z=r.mul(q,z),q=r.mul(x,q),J=r.mul(E,J),ee=r.mul(B,ee),x=r.sub(F,ee),x=r.mul(B,x),x=r.add(x,J),J=r.add(F,F),F=r.add(J,F),F=r.add(F,ee),F=r.mul(F,x),z=r.add(z,F),ee=r.mul(T,L),ee=r.add(ee,ee),F=r.mul(ee,x),q=r.sub(q,F),J=r.mul(ee,X),J=r.add(J,J),J=r.add(J,J),new M(q,z,J)}add(B){w(B);const{px:I,py:E,pz:k}=this,{px:T,py:L,pz:q}=B;let z=r.ZERO,J=r.ZERO,F=r.ZERO;const X=t.a,ee=r.mul(t.b,Hx);let x=r.mul(I,T),o=r.mul(E,L),f=r.mul(k,q),l=r.add(I,E),h=r.add(T,L);l=r.mul(l,h),h=r.add(x,o),l=r.sub(l,h),h=r.add(I,k);let v=r.add(T,q);return h=r.mul(h,v),v=r.add(x,f),h=r.sub(h,v),v=r.add(E,k),z=r.add(L,q),v=r.mul(v,z),z=r.add(o,f),v=r.sub(v,z),F=r.mul(X,h),z=r.mul(ee,f),F=r.add(z,F),z=r.sub(o,F),F=r.add(o,F),J=r.mul(z,F),o=r.add(x,x),o=r.add(o,x),f=r.mul(X,f),h=r.mul(ee,h),o=r.add(o,f),f=r.sub(x,f),f=r.mul(X,f),h=r.add(h,f),x=r.mul(o,h),J=r.add(J,x),x=r.mul(v,h),z=r.mul(l,z),z=r.sub(z,x),x=r.mul(l,o),F=r.mul(v,F),F=r.add(F,x),new M(z,J,F)}subtract(B){return this.add(B.negate())}is0(){return this.equals(M.ZERO)}wNAF(B){return A.wNAFCached(this,b,B,I=>{const E=r.invertBatch(I.map(k=>k.pz));return I.map((k,T)=>k.toAffine(E[T])).map(M.fromAffine)})}multiplyUnsafe(B){const I=M.ZERO;if(B===eo)return I;if(d(B),B===_n)return this;const{endo:E}=t;if(!E)return A.unsafeLadder(this,B);let{k1neg:k,k1:T,k2neg:L,k2:q}=E.splitScalar(B),z=I,J=I,F=this;for(;T>eo||q>eo;)T&_n&&(z=z.add(F)),q&_n&&(J=J.add(F)),F=F.double(),T>>=_n,q>>=_n;return k&&(z=z.negate()),L&&(J=J.negate()),J=new M(r.mul(J.px,E.beta),J.py,J.pz),z.add(J)}multiply(B){d(B);let I=B,E,k;const{endo:T}=t;if(T){const{k1neg:L,k1:q,k2neg:z,k2:J}=T.splitScalar(I);let{p:F,f:X}=this.wNAF(q),{p:ee,f:x}=this.wNAF(J);F=A.constTimeNegate(L,F),ee=A.constTimeNegate(z,ee),ee=new M(r.mul(ee.px,T.beta),ee.py,ee.pz),E=F.add(ee),k=X.add(x)}else{const{p:L,f:q}=this.wNAF(I);E=L,k=q}return M.normalizeZ([E,k])[0]}multiplyAndAddUnsafe(B,I,E){const k=M.BASE,T=(q,z)=>z===eo||z===_n||!q.equals(k)?q.multiplyUnsafe(z):q.multiply(z),L=T(this,I).add(T(B,E));return L.is0()?void 0:L}toAffine(B){const{px:I,py:E,pz:k}=this,T=this.is0();B==null&&(B=T?r.ONE:r.inv(k));const L=r.mul(I,B),q=r.mul(E,B),z=r.mul(k,B);if(T)return{x:r.ZERO,y:r.ZERO};if(!r.eql(z,r.ONE))throw new Error("invZ was invalid");return{x:L,y:q}}isTorsionFree(){const{h:B,isTorsionFree:I}=t;if(B===_n)return!0;if(I)return I(M,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:B,clearCofactor:I}=t;return B===_n?this:I?I(M,this):this.multiplyUnsafe(t.h)}toRawBytes(B=!0){return this.assertValidity(),n(M,this,B)}toHex(B=!0){return sl(this.toRawBytes(B))}}M.BASE=new M(t.Gx,t.Gy,r.ONE),M.ZERO=new M(r.ZERO,r.ONE,r.ZERO);const _=t.nBitLength,A=cQ(M,t.endo?Math.ceil(_/2):_);return{CURVE:t,ProjectivePoint:M,normPrivateKeyToScalar:c,weierstrassEquation:i,isWithinCurveOrder:u}}function yQ(e){const t=pk(e);return wh(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function mQ(e){const t=yQ(e),{Fp:r,n}=t,s=r.BYTES+1,i=2*r.BYTES+1;function u(h){return eo<h&&h<r.ORDER}function d(h){return Mr(h,n)}function c(h){return Uy(h,n)}const{ProjectivePoint:b,normPrivateKeyToScalar:w,weierstrassEquation:M,isWithinCurveOrder:_}=gQ({...t,toBytes(h,v,y){const m=v.toAffine(),p=r.toBytes(m.x),a=Pa;return y?a(Uint8Array.from([v.hasEvenY()?2:3]),p):a(Uint8Array.from([4]),p,r.toBytes(m.y))},fromBytes(h){const v=h.length,y=h[0],m=h.subarray(1);if(v===s&&(y===2||y===3)){const p=rn(m);if(!u(p))throw new Error("Point is not on curve");const a=M(p);let g=r.sqrt(a);const S=(g&_n)===_n;return(y&1)===1!==S&&(g=r.neg(g)),{x:p,y:g}}else if(v===i&&y===4){const p=r.fromBytes(m.subarray(0,r.BYTES)),a=r.fromBytes(m.subarray(r.BYTES,2*r.BYTES));return{x:p,y:a}}else throw new Error(`Point of length ${v} was invalid. Expected ${s} compressed bytes or ${i} uncompressed bytes`)}}),A=h=>sl(As(h,t.nByteLength));function R(h){const v=n>>_n;return h>v}function B(h){return R(h)?d(-h):h}const I=(h,v,y)=>rn(h.slice(v,y));class E{constructor(v,y,m){this.r=v,this.s=y,this.recovery=m,this.assertValidity()}static fromCompact(v){const y=t.nByteLength;return v=Cr("compactSignature",v,y*2),new E(I(v,0,y),I(v,y,2*y))}static fromDER(v){const{r:y,s:m}=va.toSig(Cr("DER",v));return new E(y,m)}assertValidity(){if(!_(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!_(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(v){return new E(this.r,this.s,v)}recoverPublicKey(v){const{r:y,s:m,recovery:p}=this,a=J(Cr("msgHash",v));if(p==null||![0,1,2,3].includes(p))throw new Error("recovery id invalid");const g=p===2||p===3?y+t.n:y;if(g>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const S=p&1?"03":"02",N=b.fromHex(S+A(g)),U=c(g),Z=d(-a*U),H=d(m*U),$=b.BASE.multiplyAndAddUnsafe(N,Z,H);if(!$)throw new Error("point at infinify");return $.assertValidity(),$}hasHighS(){return R(this.s)}normalizeS(){return this.hasHighS()?new E(this.r,d(-this.s),this.recovery):this}toDERRawBytes(){return al(this.toDERHex())}toDERHex(){return va.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return al(this.toCompactHex())}toCompactHex(){return A(this.r)+A(this.s)}}const k={isValidPrivateKey(h){try{return w(h),!0}catch{return!1}},normPrivateKeyToScalar:w,randomPrivateKey:()=>{const h=dk(t.n);return uQ(t.randomBytes(h),t.n)},precompute(h=8,v=b.BASE){return v._setWindowSize(h),v.multiply(BigInt(3)),v}};function T(h,v=!0){return b.fromPrivateKey(h).toRawBytes(v)}function L(h){const v=h instanceof Uint8Array,y=typeof h=="string",m=(v||y)&&h.length;return v?m===s||m===i:y?m===2*s||m===2*i:h instanceof b}function q(h,v,y=!0){if(L(h))throw new Error("first arg must be private key");if(!L(v))throw new Error("second arg must be public key");return b.fromHex(v).multiply(w(h)).toRawBytes(y)}const z=t.bits2int||function(h){const v=rn(h),y=h.length*8-t.nBitLength;return y>0?v>>BigInt(y):v},J=t.bits2int_modN||function(h){return d(z(h))},F=Gw(t.nBitLength);function X(h){if(typeof h!="bigint")throw new Error("bigint expected");if(!(eo<=h&&h<F))throw new Error(`bigint expected < 2^${t.nBitLength}`);return As(h,t.nByteLength)}function ee(h,v,y=x){if(["recovered","canonical"].some(W=>W in y))throw new Error("sign() legacy options not supported");const{hash:m,randomBytes:p}=t;let{lowS:a,prehash:g,extraEntropy:S}=y;a==null&&(a=!0),h=Cr("msgHash",h),g&&(h=Cr("prehashed msgHash",m(h)));const N=J(h),U=w(v),Z=[X(U),X(N)];if(S!=null){const W=S===!0?p(r.BYTES):S;Z.push(Cr("extraEntropy",W))}const H=Pa(...Z),$=N;function P(W){const G=z(W);if(!_(G))return;const K=c(G),O=b.BASE.multiply(G).toAffine(),Q=d(O.x);if(Q===eo)return;const de=d(K*d($+Q*U));if(de===eo)return;let oe=(O.x===Q?0:2)|Number(O.y&_n),se=de;return a&&R(de)&&(se=B(de),oe^=1),new E(Q,se,oe)}return{seed:H,k2sig:P}}const x={lowS:t.lowS,prehash:!1},o={lowS:t.lowS,prehash:!1};function f(h,v,y=x){const{seed:m,k2sig:p}=ee(h,v,y),a=t;return uk(a.hash.outputLen,a.nByteLength,a.hmac)(m,p)}b.BASE._setWindowSize(8);function l(h,v,y,m=o){var O;const p=h;if(v=Cr("msgHash",v),y=Cr("publicKey",y),"strict"in m)throw new Error("options.strict was renamed to lowS");const{lowS:a,prehash:g}=m;let S,N;try{if(typeof p=="string"||p instanceof Uint8Array)try{S=E.fromDER(p)}catch(Q){if(!(Q instanceof va.Err))throw Q;S=E.fromCompact(p)}else if(typeof p=="object"&&typeof p.r=="bigint"&&typeof p.s=="bigint"){const{r:Q,s:de}=p;S=new E(Q,de)}else throw new Error("PARSE");N=b.fromHex(y)}catch(Q){if(Q.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(a&&S.hasHighS())return!1;g&&(v=t.hash(v));const{r:U,s:Z}=S,H=J(v),$=c(Z),P=d(H*$),W=d(U*$),G=(O=b.BASE.multiplyAndAddUnsafe(N,P,W))==null?void 0:O.toAffine();return G?d(G.x)===U:!1}return{CURVE:t,getPublicKey:T,getSharedSecret:q,sign:f,verify:l,ProjectivePoint:b,Signature:E,utils:k}}var vk=class extends ok{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,CX(e);const r=Ww(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const n=this.blockLen,s=new Uint8Array(n);s.set(r.length>n?e.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=e.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),s.fill(0)}update(e){return E0(this),this.iHash.update(e),this}digestInto(e){E0(this),nk(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:n,destroyed:s,blockLen:i,outputLen:u}=this;return e=e,e.finished=n,e.destroyed=s,e.blockLen=i,e.outputLen=u,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},gk=(e,t,r)=>new vk(e,t).update(r).digest();gk.create=(e,t)=>new vk(e,t);function wQ(e){return{hash:e,hmac:(t,...r)=>gk(e,t,UX(...r)),randomBytes:sk}}function bQ(e,t){const r=n=>mQ({...e,...wQ(n)});return Object.freeze({...r(t),create:r})}var tp=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),S0=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),yk=BigInt(1),A0=BigInt(2),zx=(e,t)=>(e+t/A0)/t;function mk(e){const t=tp,r=BigInt(3),n=BigInt(6),s=BigInt(11),i=BigInt(22),u=BigInt(23),d=BigInt(44),c=BigInt(88),b=e*e*e%t,w=b*b*e%t,M=bn(w,r,t)*w%t,_=bn(M,r,t)*w%t,A=bn(_,A0,t)*b%t,R=bn(A,s,t)*A%t,B=bn(R,i,t)*R%t,I=bn(B,d,t)*B%t,E=bn(I,c,t)*I%t,k=bn(E,d,t)*B%t,T=bn(k,r,t)*w%t,L=bn(T,u,t)*R%t,q=bn(L,n,t)*b%t,z=bn(q,A0,t);if(!jy.eql(jy.sqr(z),e))throw new Error("Cannot find square root");return z}var jy=lQ(tp,void 0,void 0,{sqrt:mk}),$l=bQ({a:BigInt(0),b:BigInt(7),Fp:jy,n:S0,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=S0,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-yk*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=r,u=BigInt("0x100000000000000000000000000000000"),d=zx(i*e,t),c=zx(-n*e,t);let b=Mr(e-d*r-c*s,t),w=Mr(-d*n-c*i,t);const M=b>u,_=w>u;if(M&&(b=t-b),_&&(w=t-w),b>u||w>u)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:M,k1:b,k2neg:_,k2:w}}}},Ly),rp=BigInt(0),wk=e=>typeof e=="bigint"&&rp<e&&e<tp,xQ=e=>typeof e=="bigint"&&rp<e&&e<S0,Wx={};function k0(e,...t){let r=Wx[e];if(r===void 0){const n=Ly(Uint8Array.from(e,s=>s.charCodeAt(0)));r=Pa(n,n),Wx[e]=r}return Ly(Pa(r,...t))}var Jw=e=>e.toRawBytes(!0).slice(1),Dy=e=>As(e,32),Nv=e=>Mr(e,tp),Vu=e=>Mr(e,S0),Yw=$l.ProjectivePoint,MQ=(e,t,r)=>Yw.BASE.multiplyAndAddUnsafe(e,t,r);function qy(e){let t=$l.utils.normPrivateKeyToScalar(e),r=Yw.fromPrivateKey(t);return{scalar:r.hasEvenY()?t:Vu(-t),bytes:Jw(r)}}function bk(e){if(!wk(e))throw new Error("bad x: need 0 < x < p");const t=Nv(e*e),r=Nv(t*e+BigInt(7));let n=mk(r);n%A0!==rp&&(n=Nv(-n));const s=new Yw(e,n,yk);return s.assertValidity(),s}function xk(...e){return Vu(rn(k0("BIP0340/challenge",...e)))}function _Q(e){return qy(e).bytes}function EQ(e,t,r=sk(32)){const n=Cr("message",e),{bytes:s,scalar:i}=qy(t),u=Cr("auxRand",r,32),d=Dy(i^rn(k0("BIP0340/aux",u))),c=k0("BIP0340/nonce",d,s,n),b=Vu(rn(c));if(b===rp)throw new Error("sign failed: k is zero");const{bytes:w,scalar:M}=qy(b),_=xk(w,s,n),A=new Uint8Array(64);if(A.set(w,0),A.set(Dy(Vu(M+_*i)),32),!Mk(A,n,s))throw new Error("sign: Invalid signature produced");return A}function Mk(e,t,r){const n=Cr("signature",e,64),s=Cr("message",t),i=Cr("publicKey",r,32);try{const u=bk(rn(i)),d=rn(n.subarray(0,32));if(!wk(d))return!1;const c=rn(n.subarray(32,64));if(!xQ(c))return!1;const b=xk(Dy(d),Jw(u),s),w=MQ(u,c,Vu(-b));return!(!w||!w.hasEvenY()||w.toAffine().x!==d)}catch{return!1}}var yi={getPublicKey:_Q,sign:EQ,verify:Mk,utils:{randomPrivateKey:$l.utils.randomPrivateKey,lift_x:bk,pointToBytes:Jw,numberToBytesBE:As,bytesToNumberBE:rn,taggedHash:k0,mod:Mr}},Tv=If&&typeof If=="object"&&"webcrypto"in If?Xd.webcrypto:void 0,Xw=e=>e instanceof Uint8Array,Iv=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),hi=(e,t)=>e<<32-t|e>>>t,SQ=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!SQ)throw new Error("Non little-endian hardware is not supported");var AQ=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function rr(e){if(!Xw(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=AQ[e[r]];return t}function La(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(t/2);for(let n=0;n<r.length;n++){const s=n*2,i=e.slice(s,s+2),u=Number.parseInt(i,16);if(Number.isNaN(u)||u<0)throw new Error("Invalid byte sequence");r[n]=u}return r}function kQ(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Ku(e){if(typeof e=="string"&&(e=kQ(e)),!Xw(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}function np(...e){const t=new Uint8Array(e.reduce((n,s)=>n+s.length,0));let r=0;return e.forEach(n=>{if(!Xw(n))throw new Error("Uint8Array expected");t.set(n,r),r+=n.length}),t}var _k=class{clone(){return this._cloneInto()}};function Ek(e){const t=n=>e().update(Ku(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Sk(e=32){if(Tv&&typeof Tv.getRandomValues=="function")return Tv.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function Fy(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function BQ(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}function Ak(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function RQ(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Fy(e.outputLen),Fy(e.blockLen)}function $Q(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function NQ(e,t){Ak(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var TQ={number:Fy,bool:BQ,bytes:Ak,hash:RQ,exists:$Q,output:NQ},Si=TQ;function IQ(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);const s=BigInt(32),i=BigInt(4294967295),u=Number(r>>s&i),d=Number(r&i),c=n?4:0,b=n?0:4;e.setUint32(t+c,u,n),e.setUint32(t+b,d,n)}var CQ=class extends _k{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Iv(this.buffer)}update(e){Si.exists(this);const{view:t,buffer:r,blockLen:n}=this;e=Ku(e);const s=e.length;for(let i=0;i<s;){const u=Math.min(n-this.pos,s-i);if(u===n){const d=Iv(e);for(;n<=s-i;i+=n)this.process(d,i);continue}r.set(e.subarray(i,i+u),this.pos),this.pos+=u,i+=u,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Si.exists(this),Si.output(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:s}=this;let{pos:i}=this;t[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>n-i&&(this.process(r,0),i=0);for(let w=i;w<n;w++)t[w]=0;IQ(r,n-8,BigInt(this.length*8),s),this.process(r,0);const u=Iv(e),d=this.outputLen;if(d%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=d/4,b=this.get();if(c>b.length)throw new Error("_sha2: outputLen bigger than state");for(let w=0;w<c;w++)u.setUint32(4*w,b[w],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:s,destroyed:i,pos:u}=this;return e.length=n,e.pos=u,e.finished=s,e.destroyed=i,n%t&&e.buffer.set(r),e}},PQ=(e,t,r)=>e&t^~e&r,LQ=(e,t,r)=>e&t^e&r^t&r,OQ=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Go=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Jo=new Uint32Array(64),kk=class extends CQ{constructor(){super(64,32,8,!1),this.A=Go[0]|0,this.B=Go[1]|0,this.C=Go[2]|0,this.D=Go[3]|0,this.E=Go[4]|0,this.F=Go[5]|0,this.G=Go[6]|0,this.H=Go[7]|0}get(){const{A:e,B:t,C:r,D:n,E:s,F:i,G:u,H:d}=this;return[e,t,r,n,s,i,u,d]}set(e,t,r,n,s,i,u,d){this.A=e|0,this.B=t|0,this.C=r|0,this.D=n|0,this.E=s|0,this.F=i|0,this.G=u|0,this.H=d|0}process(e,t){for(let w=0;w<16;w++,t+=4)Jo[w]=e.getUint32(t,!1);for(let w=16;w<64;w++){const M=Jo[w-15],_=Jo[w-2],A=hi(M,7)^hi(M,18)^M>>>3,R=hi(_,17)^hi(_,19)^_>>>10;Jo[w]=R+Jo[w-7]+A+Jo[w-16]|0}let{A:r,B:n,C:s,D:i,E:u,F:d,G:c,H:b}=this;for(let w=0;w<64;w++){const M=hi(u,6)^hi(u,11)^hi(u,25),_=b+M+PQ(u,d,c)+OQ[w]+Jo[w]|0,R=(hi(r,2)^hi(r,13)^hi(r,22))+LQ(r,n,s)|0;b=c,c=d,d=u,u=i+_|0,i=s,s=n,n=r,r=_+R|0}r=r+this.A|0,n=n+this.B|0,s=s+this.C|0,i=i+this.D|0,u=u+this.E|0,d=d+this.F|0,c=c+this.G|0,b=b+this.H|0,this.set(r,n,s,i,u,d,c,b)}roundClean(){Jo.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},UQ=class extends kk{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}},js=Ek(()=>new kk);Ek(()=>new UQ);var Xa=Symbol("verified"),jQ=e=>e instanceof Object;function DQ(e){if(!jQ(e)||typeof e.kind!="number"||typeof e.content!="string"||typeof e.created_at!="number"||typeof e.pubkey!="string"||!e.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(e.tags))return!1;for(let t=0;t<e.tags.length;t++){let r=e.tags[t];if(!Array.isArray(r))return!1;for(let n=0;n<r.length;n++)if(typeof r[n]!="string")return!1}return!0}new TextDecoder("utf-8");var qQ=new TextEncoder,FQ=class{generateSecretKey(){return yi.utils.randomPrivateKey()}getPublicKey(e){return rr(yi.getPublicKey(e))}finalizeEvent(e,t){const r=e;return r.pubkey=rr(yi.getPublicKey(t)),r.id=Cv(r),r.sig=rr(yi.sign(Cv(r),t)),r[Xa]=!0,r}verifyEvent(e){if(typeof e[Xa]=="boolean")return e[Xa];const t=Cv(e);if(t!==e.id)return e[Xa]=!1,!1;try{const r=yi.verify(e.sig,t,e.pubkey);return e[Xa]=r,r}catch{return e[Xa]=!1,!1}}};function HQ(e){if(!DQ(e))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content])}function Cv(e){let t=js(qQ.encode(HQ(e)));return rr(t)}var ip=new FQ;ip.generateSecretKey;ip.getPublicKey;ip.finalizeEvent;ip.verifyEvent;new TextDecoder("utf-8");new TextEncoder;var Pv={SERVICE_RECORD:30059,ATTESTATION:30060,REVOCATION:30061};function Nl(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function Co(...e){const t=(s,i)=>u=>s(i(u)),r=Array.from(e).reverse().reduce((s,i)=>s?t(s,i.encode):i.encode,void 0),n=e.reduce((s,i)=>s?t(s,i.decode):i.decode,void 0);return{encode:r,decode:n}}function Po(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(r=>{if(Nl(r),r<0||r>=e.length)throw new Error(`Digit index outside alphabet: ${r} (alphabet: ${e.length})`);return e[r]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(r=>{if(typeof r!="string")throw new Error(`alphabet.decode: not string element=${r}`);const n=e.indexOf(r);if(n===-1)throw new Error(`Unknown letter: "${r}". Allowed: ${e}`);return n})}}}function Lo(e=""){if(typeof e!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let r of t)if(typeof r!="string")throw new Error(`join.encode: non-string input=${r}`);return t.join(e)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(e)}}}function op(e,t="="){if(Nl(e),typeof t!="string")throw new Error("padding chr should be string");return{encode(r){if(!Array.isArray(r)||r.length&&typeof r[0]!="string")throw new Error("padding.encode input should be array of strings");for(let n of r)if(typeof n!="string")throw new Error(`padding.encode: non-string input=${n}`);for(;r.length*e%8;)r.push(t);return r},decode(r){if(!Array.isArray(r)||r.length&&typeof r[0]!="string")throw new Error("padding.encode input should be array of strings");for(let s of r)if(typeof s!="string")throw new Error(`padding.decode: non-string input=${s}`);let n=r.length;if(n*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&r[n-1]===t;n--)if(!((n-1)*e%8))throw new Error("Invalid padding: string has too much padding");return r.slice(0,n)}}}function Bk(e){if(typeof e!="function")throw new Error("normalize fn should be function");return{encode:t=>t,decode:t=>e(t)}}function Vx(e,t,r){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(r<2)throw new Error(`convertRadix: wrong to=${r}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let n=0;const s=[],i=Array.from(e);for(i.forEach(u=>{if(Nl(u),u<0||u>=t)throw new Error(`Wrong integer: ${u}`)});;){let u=0,d=!0;for(let c=n;c<i.length;c++){const b=i[c],w=t*u+b;if(!Number.isSafeInteger(w)||t*u/t!==u||w-b!==t*u)throw new Error("convertRadix: carry overflow");if(u=w%r,i[c]=Math.floor(w/r),!Number.isSafeInteger(i[c])||i[c]*r+u!==w)throw new Error("convertRadix: carry overflow");if(d)i[c]?d=!1:n=c;else continue}if(s.push(u),d)break}for(let u=0;u<e.length-1&&e[u]===0;u++)s.push(0);return s.reverse()}var Rk=(e,t)=>t?Rk(t,e%t):e,B0=(e,t)=>e+(t-Rk(e,t));function Hy(e,t,r,n){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(B0(t,r)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${B0(t,r)}`);let s=0,i=0;const u=2**r-1,d=[];for(const c of e){if(Nl(c),c>=2**t)throw new Error(`convertRadix2: invalid data word=${c} from=${t}`);if(s=s<<t|c,i+t>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=r;i-=r)d.push((s>>i-r&u)>>>0);s&=2**i-1}if(s=s<<r-i&u,!n&&i>=t)throw new Error("Excess padding");if(!n&&s)throw new Error(`Non-zero padding: ${s}`);return n&&i>0&&d.push(s>>>0),d}function zQ(e){return Nl(e),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return Vx(Array.from(t),2**8,e)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(Vx(t,e,2**8))}}}function Ds(e,t=!1){if(Nl(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(B0(8,e)>32||B0(e,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!(r instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return Hy(Array.from(r),8,e,!t)},decode:r=>{if(!Array.isArray(r)||r.length&&typeof r[0]!="number")throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(Hy(r,e,8,t))}}}function Kx(e){if(typeof e!="function")throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch{}}}var WQ=Co(Ds(4),Po("0123456789ABCDEF"),Lo("")),VQ=Co(Ds(5),Po("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),op(5),Lo(""));Co(Ds(5),Po("0123456789ABCDEFGHIJKLMNOPQRSTUV"),op(5),Lo(""));Co(Ds(5),Po("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),Lo(""),Bk(e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));var Eo=Co(Ds(6),Po("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),op(6),Lo("")),KQ=Co(Ds(6),Po("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),op(6),Lo("")),Qw=e=>Co(zQ(58),Po(e),Lo("")),zy=Qw("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");Qw("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ");Qw("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");var Zx=[0,2,3,5,6,7,9,10,11],ZQ={encode(e){let t="";for(let r=0;r<e.length;r+=8){const n=e.subarray(r,r+8);t+=zy.encode(n).padStart(Zx[n.length],"1")}return t},decode(e){let t=[];for(let r=0;r<e.length;r+=11){const n=e.slice(r,r+11),s=Zx.indexOf(n.length),i=zy.decode(n);for(let u=0;u<i.length-s;u++)if(i[u]!==0)throw new Error("base58xmr: wrong padding");t=t.concat(Array.from(i.slice(i.length-s)))}return Uint8Array.from(t)}},Wy=Co(Po("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),Lo("")),Gx=[996825010,642813549,513874426,1027748829,705979059];function Ql(e){const t=e>>25;let r=(e&33554431)<<5;for(let n=0;n<Gx.length;n++)(t>>n&1)===1&&(r^=Gx[n]);return r}function Jx(e,t,r=1){const n=e.length;let s=1;for(let i=0;i<n;i++){const u=e.charCodeAt(i);if(u<33||u>126)throw new Error(`Invalid prefix (${e})`);s=Ql(s)^u>>5}s=Ql(s);for(let i=0;i<n;i++)s=Ql(s)^e.charCodeAt(i)&31;for(let i of t)s=Ql(s)^i;for(let i=0;i<6;i++)s=Ql(s);return s^=r,Wy.encode(Hy([s%2**30],30,5,!1))}function $k(e){const t=e==="bech32"?1:734539939,r=Ds(5),n=r.decode,s=r.encode,i=Kx(n);function u(w,M,_=90){if(typeof w!="string")throw new Error(`bech32.encode prefix should be string, not ${typeof w}`);if(!Array.isArray(M)||M.length&&typeof M[0]!="number")throw new Error(`bech32.encode words should be array of numbers, not ${typeof M}`);const A=w.length+7+M.length;if(_!==!1&&A>_)throw new TypeError(`Length ${A} exceeds limit ${_}`);return w=w.toLowerCase(),`${w}1${Wy.encode(M)}${Jx(w,M,t)}`}function d(w,M=90){if(typeof w!="string")throw new Error(`bech32.decode input should be string, not ${typeof w}`);if(w.length<8||M!==!1&&w.length>M)throw new TypeError(`Wrong string length: ${w.length} (${w}). Expected (8..${M})`);const _=w.toLowerCase();if(w!==_&&w!==w.toUpperCase())throw new Error("String must be lowercase or uppercase");w=_;const A=w.lastIndexOf("1");if(A===0||A===-1)throw new Error('Letter "1" must be present between prefix and data only');const R=w.slice(0,A),B=w.slice(A+1);if(B.length<6)throw new Error("Data must be at least 6 characters long");const I=Wy.decode(B).slice(0,-6),E=Jx(R,I,t);if(!B.endsWith(E))throw new Error(`Invalid checksum in ${w}: expected "${E}"`);return{prefix:R,words:I}}const c=Kx(d);function b(w){const{prefix:M,words:_}=d(w,!1);return{prefix:M,words:_,bytes:n(_)}}return{encode:u,decode:d,decodeToBytes:b,decodeUnsafe:c,fromWords:n,fromWordsUnsafe:i,toWords:s}}var fl=$k("bech32");$k("bech32m");var GQ={encode:e=>new TextDecoder().decode(e),decode:e=>new TextEncoder().encode(e)},JQ=Co(Ds(4),Po("0123456789abcdef"),Lo(""),Bk(e=>{if(typeof e!="string"||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})),YQ={utf8:GQ,hex:JQ,base16:WQ,base32:VQ,base64:Eo,base64url:KQ,base58:zy,base58xmr:ZQ};`${Object.keys(YQ).join(", ")}`;function Lv(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function Yx(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}function Nk(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function ln(e,...t){if(!Nk(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function ll(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function eb(e,t){ln(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var Xt=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),XQ=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),QQ=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!QQ)throw new Error("Non little-endian hardware is not supported");var eee=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Qa(e){ln(e);let t="";for(let r=0;r<e.length;r++)t+=eee[e[r]];return t}var Fi={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Xx(e){if(e>=Fi._0&&e<=Fi._9)return e-Fi._0;if(e>=Fi._A&&e<=Fi._F)return e-(Fi._A-10);if(e>=Fi._a&&e<=Fi._f)return e-(Fi._a-10)}function Tk(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let s=0,i=0;s<r;s++,i+=2){const u=Xx(e.charCodeAt(i)),d=Xx(e.charCodeAt(i+1));if(u===void 0||d===void 0){const c=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}n[s]=u*16+d}return n}function tee(e){if(typeof e!="string")throw new Error(`string expected, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function ks(e){if(typeof e=="string")e=tee(e);else if(Nk(e))e=e.slice();else throw new Error(`Uint8Array expected, got ${typeof e}`);return e}function ree(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function nee(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}var iee=(e,t)=>(Object.assign(t,e),t),Gi=16,tb=new Uint8Array(16),mi=Xt(tb),oee=225,see=(e,t,r,n)=>{const s=n&1;return{s3:r<<31|n>>>1,s2:t<<31|r>>>1,s1:e<<31|t>>>1,s0:e>>>1^oee<<24&-(s&1)}},En=e=>(e>>>0&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255|0;function aee(e){e.reverse();const t=e[15]&1;let r=0;for(let n=0;n<e.length;n++){const s=e[n];e[n]=s>>>1|r,r=(s&1)<<7}return e[0]^=-t&225,e}var fee=e=>e>64*1024?8:e>1024?4:2,Ik=class{constructor(e,t){this.blockLen=Gi,this.outputLen=Gi,this.s0=0,this.s1=0,this.s2=0,this.s3=0,this.finished=!1,e=ks(e),ln(e,16);const r=XQ(e);let n=r.getUint32(0,!1),s=r.getUint32(4,!1),i=r.getUint32(8,!1),u=r.getUint32(12,!1);const d=[];for(let A=0;A<128;A++)d.push({s0:En(n),s1:En(s),s2:En(i),s3:En(u)}),{s0:n,s1:s,s2:i,s3:u}=see(n,s,i,u);const c=fee(t||1024);if(![1,2,4,8].includes(c))throw new Error(`ghash: wrong window size=${c}, should be 2, 4 or 8`);this.W=c;const w=128/c,M=this.windowSize=2**c,_=[];for(let A=0;A<w;A++)for(let R=0;R<M;R++){let B=0,I=0,E=0,k=0;for(let T=0;T<c;T++){if(!(R>>>c-T-1&1))continue;const{s0:q,s1:z,s2:J,s3:F}=d[c*A+T];B^=q,I^=z,E^=J,k^=F}_.push({s0:B,s1:I,s2:E,s3:k})}this.t=_}_updateBlock(e,t,r,n){e^=this.s0,t^=this.s1,r^=this.s2,n^=this.s3;const{W:s,t:i,windowSize:u}=this;let d=0,c=0,b=0,w=0;const M=(1<<s)-1;let _=0;for(const A of[e,t,r,n])for(let R=0;R<4;R++){const B=A>>>8*R&255;for(let I=8/s-1;I>=0;I--){const E=B>>>s*I&M,{s0:k,s1:T,s2:L,s3:q}=i[_*u+E];d^=k,c^=T,b^=L,w^=q,_+=1}}this.s0=d,this.s1=c,this.s2=b,this.s3=w}update(e){e=ks(e),ll(this);const t=Xt(e),r=Math.floor(e.length/Gi),n=e.length%Gi;for(let s=0;s<r;s++)this._updateBlock(t[s*4+0],t[s*4+1],t[s*4+2],t[s*4+3]);return n&&(tb.set(e.subarray(r*Gi)),this._updateBlock(mi[0],mi[1],mi[2],mi[3]),mi.fill(0)),this}destroy(){const{t:e}=this;for(const t of e)t.s0=0,t.s1=0,t.s2=0,t.s3=0}digestInto(e){ll(this),eb(e,this),this.finished=!0;const{s0:t,s1:r,s2:n,s3:s}=this,i=Xt(e);return i[0]=t,i[1]=r,i[2]=n,i[3]=s,e}digest(){const e=new Uint8Array(Gi);return this.digestInto(e),this.destroy(),e}},lee=class extends Ik{constructor(e,t){e=ks(e);const r=aee(e.slice());super(r,t),r.fill(0)}update(e){e=ks(e),ll(this);const t=Xt(e),r=e.length%Gi,n=Math.floor(e.length/Gi);for(let s=0;s<n;s++)this._updateBlock(En(t[s*4+3]),En(t[s*4+2]),En(t[s*4+1]),En(t[s*4+0]));return r&&(tb.set(e.subarray(n*Gi)),this._updateBlock(En(mi[3]),En(mi[2]),En(mi[1]),En(mi[0])),mi.fill(0)),this}digestInto(e){ll(this),eb(e,this),this.finished=!0;const{s0:t,s1:r,s2:n,s3:s}=this,i=Xt(e);return i[0]=t,i[1]=r,i[2]=n,i[3]=s,e.reverse()}};function Ck(e){const t=(n,s)=>e(s,n.length).update(ks(n)).digest(),r=e(new Uint8Array(16),0);return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=(n,s)=>e(n,s),t}Ck((e,t)=>new Ik(e,t));Ck((e,t)=>new lee(e,t));var bs=16,uee=283;function rb(e){return e<<1^uee&-(e>>7)}function wf(e,t){let r=0;for(;t>0;t>>=1)r^=e&-(t&1),e=rb(e);return r}var Vy=(()=>{let e=new Uint8Array(256);for(let r=0,n=1;r<256;r++,n^=rb(n))e[r]=n;const t=new Uint8Array(256);t[0]=99;for(let r=0;r<255;r++){let n=e[255-r];n|=n<<8,t[e[r]]=(n^n>>4^n>>5^n>>6^n>>7^99)&255}return t})(),hee=Vy.map((e,t)=>Vy.indexOf(t)),cee=e=>e<<24|e>>>8,Ov=e=>e<<8|e>>>24;function Pk(e,t){if(e.length!==256)throw new Error("Wrong sbox length");const r=new Uint32Array(256).map((b,w)=>t(e[w])),n=r.map(Ov),s=n.map(Ov),i=s.map(Ov),u=new Uint32Array(256*256),d=new Uint32Array(256*256),c=new Uint16Array(256*256);for(let b=0;b<256;b++)for(let w=0;w<256;w++){const M=b*256+w;u[M]=r[b]^n[w],d[M]=s[b]^i[w],c[M]=e[b]<<8|e[w]}return{sbox:e,sbox2:c,T0:r,T1:n,T2:s,T3:i,T01:u,T23:d}}var nb=Pk(Vy,e=>wf(e,3)<<24|e<<16|e<<8|wf(e,2)),Lk=Pk(hee,e=>wf(e,11)<<24|wf(e,13)<<16|wf(e,9)<<8|wf(e,14)),dee=(()=>{const e=new Uint8Array(16);for(let t=0,r=1;t<16;t++,r=rb(r))e[t]=r;return e})();function Ok(e){ln(e);const t=e.length;if(![16,24,32].includes(t))throw new Error(`aes: wrong key size: should be 16, 24 or 32, got: ${t}`);const{sbox2:r}=nb,n=Xt(e),s=n.length,i=d=>Ai(r,d,d,d,d),u=new Uint32Array(t+28);u.set(n);for(let d=s;d<u.length;d++){let c=u[d-1];d%s===0?c=i(cee(c))^dee[d/s-1]:s>6&&d%s===4&&(c=i(c)),u[d]=u[d-s]^c}return u}function pee(e){const t=Ok(e),r=t.slice(),n=t.length,{sbox2:s}=nb,{T0:i,T1:u,T2:d,T3:c}=Lk;for(let b=0;b<n;b+=4)for(let w=0;w<4;w++)r[b+w]=t[n-b-4+w];t.fill(0);for(let b=4;b<n-4;b++){const w=r[b],M=Ai(s,w,w,w,w);r[b]=i[M&255]^u[M>>>8&255]^d[M>>>16&255]^c[M>>>24]}return r}function fs(e,t,r,n,s,i){return e[r<<8&65280|n>>>8&255]^t[s>>>8&65280|i>>>24&255]}function Ai(e,t,r,n,s){return e[t&255|r&65280]|e[n>>>16&255|s>>>16&65280]<<16}function Qx(e,t,r,n,s){const{sbox2:i,T01:u,T23:d}=nb;let c=0;t^=e[c++],r^=e[c++],n^=e[c++],s^=e[c++];const b=e.length/4-2;for(let R=0;R<b;R++){const B=e[c++]^fs(u,d,t,r,n,s),I=e[c++]^fs(u,d,r,n,s,t),E=e[c++]^fs(u,d,n,s,t,r),k=e[c++]^fs(u,d,s,t,r,n);t=B,r=I,n=E,s=k}const w=e[c++]^Ai(i,t,r,n,s),M=e[c++]^Ai(i,r,n,s,t),_=e[c++]^Ai(i,n,s,t,r),A=e[c++]^Ai(i,s,t,r,n);return{s0:w,s1:M,s2:_,s3:A}}function vee(e,t,r,n,s){const{sbox2:i,T01:u,T23:d}=Lk;let c=0;t^=e[c++],r^=e[c++],n^=e[c++],s^=e[c++];const b=e.length/4-2;for(let R=0;R<b;R++){const B=e[c++]^fs(u,d,t,s,n,r),I=e[c++]^fs(u,d,r,t,s,n),E=e[c++]^fs(u,d,n,r,t,s),k=e[c++]^fs(u,d,s,n,r,t);t=B,r=I,n=E,s=k}const w=e[c++]^Ai(i,t,s,n,r),M=e[c++]^Ai(i,r,t,s,n),_=e[c++]^Ai(i,n,r,t,s),A=e[c++]^Ai(i,s,n,r,t);return{s0:w,s1:M,s2:_,s3:A}}function Uk(e,t){if(!t)return new Uint8Array(e);if(ln(t),t.length<e)throw new Error(`aes: wrong destination length, expected at least ${e}, got: ${t.length}`);return t}function gee(e){if(ln(e),e.length%bs!==0)throw new Error(`aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size ${bs}`)}function yee(e,t,r){let n=e.length;const s=n%bs;if(!t&&s!==0)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");const i=Xt(e);if(t){let c=bs-s;c||(c=bs),n=n+c}const u=Uk(n,r),d=Xt(u);return{b:i,o:d,out:u}}function mee(e,t){if(!t)return e;const r=e.length;if(!r)throw new Error("aes/pcks5: empty ciphertext not allowed");const n=e[r-1];if(n<=0||n>16)throw new Error(`aes/pcks5: wrong padding byte: ${n}`);const s=e.subarray(0,-n);for(let i=0;i<n;i++)if(e[r-i-1]!==n)throw new Error("aes/pcks5: wrong padding");return s}function wee(e){const t=new Uint8Array(16),r=Xt(t);t.set(e);const n=bs-e.length;for(let s=bs-n;s<bs;s++)t[s]=n;return r}var jk=iee({blockSize:16,nonceLength:16},function(t,r,n={}){ln(t),ln(r,16);const s=!n.disablePadding;return{encrypt:(i,u)=>{const d=Ok(t),{b:c,o:b,out:w}=yee(i,s,u),M=Xt(r);let _=M[0],A=M[1],R=M[2],B=M[3],I=0;for(;I+4<=c.length;)_^=c[I+0],A^=c[I+1],R^=c[I+2],B^=c[I+3],{s0:_,s1:A,s2:R,s3:B}=Qx(d,_,A,R,B),b[I++]=_,b[I++]=A,b[I++]=R,b[I++]=B;if(s){const E=wee(i.subarray(I*4));_^=E[0],A^=E[1],R^=E[2],B^=E[3],{s0:_,s1:A,s2:R,s3:B}=Qx(d,_,A,R,B),b[I++]=_,b[I++]=A,b[I++]=R,b[I++]=B}return d.fill(0),w},decrypt:(i,u)=>{gee(i);const d=pee(t),c=Xt(r),b=Uk(i.length,u),w=Xt(i),M=Xt(b);let _=c[0],A=c[1],R=c[2],B=c[3];for(let I=0;I+4<=w.length;){const E=_,k=A,T=R,L=B;_=w[I+0],A=w[I+1],R=w[I+2],B=w[I+3];const{s0:q,s1:z,s2:J,s3:F}=vee(d,_,A,R,B);M[I++]=q^E,M[I++]=z^k,M[I++]=J^T,M[I++]=F^L}return d.fill(0),mee(b,s)}}}),mr=(e,t)=>e[t++]&255|(e[t++]&255)<<8,bee=class{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=ks(e),ln(e,32);const t=mr(e,0),r=mr(e,2),n=mr(e,4),s=mr(e,6),i=mr(e,8),u=mr(e,10),d=mr(e,12),c=mr(e,14);this.r[0]=t&8191,this.r[1]=(t>>>13|r<<3)&8191,this.r[2]=(r>>>10|n<<6)&7939,this.r[3]=(n>>>7|s<<9)&8191,this.r[4]=(s>>>4|i<<12)&255,this.r[5]=i>>>1&8190,this.r[6]=(i>>>14|u<<2)&8191,this.r[7]=(u>>>11|d<<5)&8065,this.r[8]=(d>>>8|c<<8)&8191,this.r[9]=c>>>5&127;for(let b=0;b<8;b++)this.pad[b]=mr(e,16+2*b)}process(e,t,r=!1){const n=r?0:2048,{h:s,r:i}=this,u=i[0],d=i[1],c=i[2],b=i[3],w=i[4],M=i[5],_=i[6],A=i[7],R=i[8],B=i[9],I=mr(e,t+0),E=mr(e,t+2),k=mr(e,t+4),T=mr(e,t+6),L=mr(e,t+8),q=mr(e,t+10),z=mr(e,t+12),J=mr(e,t+14);let F=s[0]+(I&8191),X=s[1]+((I>>>13|E<<3)&8191),ee=s[2]+((E>>>10|k<<6)&8191),x=s[3]+((k>>>7|T<<9)&8191),o=s[4]+((T>>>4|L<<12)&8191),f=s[5]+(L>>>1&8191),l=s[6]+((L>>>14|q<<2)&8191),h=s[7]+((q>>>11|z<<5)&8191),v=s[8]+((z>>>8|J<<8)&8191),y=s[9]+(J>>>5|n),m=0,p=m+F*u+X*(5*B)+ee*(5*R)+x*(5*A)+o*(5*_);m=p>>>13,p&=8191,p+=f*(5*M)+l*(5*w)+h*(5*b)+v*(5*c)+y*(5*d),m+=p>>>13,p&=8191;let a=m+F*d+X*u+ee*(5*B)+x*(5*R)+o*(5*A);m=a>>>13,a&=8191,a+=f*(5*_)+l*(5*M)+h*(5*w)+v*(5*b)+y*(5*c),m+=a>>>13,a&=8191;let g=m+F*c+X*d+ee*u+x*(5*B)+o*(5*R);m=g>>>13,g&=8191,g+=f*(5*A)+l*(5*_)+h*(5*M)+v*(5*w)+y*(5*b),m+=g>>>13,g&=8191;let S=m+F*b+X*c+ee*d+x*u+o*(5*B);m=S>>>13,S&=8191,S+=f*(5*R)+l*(5*A)+h*(5*_)+v*(5*M)+y*(5*w),m+=S>>>13,S&=8191;let N=m+F*w+X*b+ee*c+x*d+o*u;m=N>>>13,N&=8191,N+=f*(5*B)+l*(5*R)+h*(5*A)+v*(5*_)+y*(5*M),m+=N>>>13,N&=8191;let U=m+F*M+X*w+ee*b+x*c+o*d;m=U>>>13,U&=8191,U+=f*u+l*(5*B)+h*(5*R)+v*(5*A)+y*(5*_),m+=U>>>13,U&=8191;let Z=m+F*_+X*M+ee*w+x*b+o*c;m=Z>>>13,Z&=8191,Z+=f*d+l*u+h*(5*B)+v*(5*R)+y*(5*A),m+=Z>>>13,Z&=8191;let H=m+F*A+X*_+ee*M+x*w+o*b;m=H>>>13,H&=8191,H+=f*c+l*d+h*u+v*(5*B)+y*(5*R),m+=H>>>13,H&=8191;let $=m+F*R+X*A+ee*_+x*M+o*w;m=$>>>13,$&=8191,$+=f*b+l*c+h*d+v*u+y*(5*B),m+=$>>>13,$&=8191;let P=m+F*B+X*R+ee*A+x*_+o*M;m=P>>>13,P&=8191,P+=f*w+l*b+h*c+v*d+y*u,m+=P>>>13,P&=8191,m=(m<<2)+m|0,m=m+p|0,p=m&8191,m=m>>>13,a+=m,s[0]=p,s[1]=a,s[2]=g,s[3]=S,s[4]=N,s[5]=U,s[6]=Z,s[7]=H,s[8]=$,s[9]=P}finalize(){const{h:e,pad:t}=this,r=new Uint16Array(10);let n=e[1]>>>13;e[1]&=8191;for(let u=2;u<10;u++)e[u]+=n,n=e[u]>>>13,e[u]&=8191;e[0]+=n*5,n=e[0]>>>13,e[0]&=8191,e[1]+=n,n=e[1]>>>13,e[1]&=8191,e[2]+=n,r[0]=e[0]+5,n=r[0]>>>13,r[0]&=8191;for(let u=1;u<10;u++)r[u]=e[u]+n,n=r[u]>>>13,r[u]&=8191;r[9]-=8192;let s=(n^1)-1;for(let u=0;u<10;u++)r[u]&=s;s=~s;for(let u=0;u<10;u++)e[u]=e[u]&s|r[u];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let i=e[0]+t[0];e[0]=i&65535;for(let u=1;u<8;u++)i=(e[u]+t[u]|0)+(i>>>16)|0,e[u]=i&65535}update(e){ll(this);const{buffer:t,blockLen:r}=this;e=ks(e);const n=e.length;for(let s=0;s<n;){const i=Math.min(r-this.pos,n-s);if(i===r){for(;r<=n-s;s+=r)this.process(e,s);continue}t.set(e.subarray(s,s+i),this.pos),this.pos+=i,s+=i,this.pos===r&&(this.process(t,0,!1),this.pos=0)}return this}destroy(){this.h.fill(0),this.r.fill(0),this.buffer.fill(0),this.pad.fill(0)}digestInto(e){ll(this),eb(e,this),this.finished=!0;const{buffer:t,h:r}=this;let{pos:n}=this;if(n){for(t[n++]=1;n<16;n++)t[n]=0;this.process(t,0,!0)}this.finalize();let s=0;for(let i=0;i<8;i++)e[s++]=r[i]>>>0,e[s++]=r[i]>>>8;return e}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}};function xee(e){const t=(n,s)=>e(s).update(ks(n)).digest(),r=e(new Uint8Array(32));return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}xee(e=>new bee(e));var Dk=e=>Uint8Array.from(e.split("").map(t=>t.charCodeAt(0))),Mee=Dk("expand 16-byte k"),_ee=Dk("expand 32-byte k"),Eee=Xt(Mee),qk=Xt(_ee);qk.slice();function lt(e,t){return e<<t|e>>>32-t}function Ky(e){return e.byteOffset%4===0}var ec=64,See=16,Fk=2**32-1,e8=new Uint32Array;function Aee(e,t,r,n,s,i,u,d){const c=s.length,b=new Uint8Array(ec),w=Xt(b),M=Ky(s)&&Ky(i),_=M?Xt(s):e8,A=M?Xt(i):e8;for(let R=0;R<c;u++){if(e(t,r,n,w,u,d),u>=Fk)throw new Error("arx: counter overflow");const B=Math.min(ec,c-R);if(M&&B===ec){const I=R/4;if(R%4!==0)throw new Error("arx: invalid block position");for(let E=0,k;E<See;E++)k=I+E,A[k]=_[k]^w[E];R+=ec;continue}for(let I=0,E;I<B;I++)E=R+I,i[E]=s[E]^b[I];R+=B}}function kee(e,t){const{allowShortKeys:r,extendNonceFn:n,counterLength:s,counterRight:i,rounds:u}=ree({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return Lv(s),Lv(u),Yx(i),Yx(r),(d,c,b,w,M=0)=>{ln(d),ln(c),ln(b);const _=b.length;if(w||(w=new Uint8Array(_)),ln(w),Lv(M),M<0||M>=Fk)throw new Error("arx: counter overflow");if(w.length<_)throw new Error(`arx: output (${w.length}) is shorter than data (${_})`);const A=[];let R=d.length,B,I;if(R===32)B=d.slice(),A.push(B),I=qk;else if(R===16&&r)B=new Uint8Array(32),B.set(d),B.set(d,16),I=Eee,A.push(B);else throw new Error(`arx: invalid 32-byte key, got length=${R}`);Ky(c)||(c=c.slice(),A.push(c));const E=Xt(B);if(n){if(c.length!==24)throw new Error("arx: extended nonce must be 24 bytes");n(I,E,Xt(c.subarray(0,16)),E),c=c.subarray(16)}const k=16-s;if(k!==c.length)throw new Error(`arx: nonce must be ${k} or 16 bytes`);if(k!==12){const L=new Uint8Array(12);L.set(c,i?0:12-c.length),c=L,A.push(c)}const T=Xt(c);for(Aee(e,I,E,T,b,w,M,u);A.length>0;)A.pop().fill(0);return w}}function Bee(e,t,r,n,s,i=20){let u=e[0],d=e[1],c=e[2],b=e[3],w=t[0],M=t[1],_=t[2],A=t[3],R=t[4],B=t[5],I=t[6],E=t[7],k=s,T=r[0],L=r[1],q=r[2],z=u,J=d,F=c,X=b,ee=w,x=M,o=_,f=A,l=R,h=B,v=I,y=E,m=k,p=T,a=L,g=q;for(let N=0;N<i;N+=2)z=z+ee|0,m=lt(m^z,16),l=l+m|0,ee=lt(ee^l,12),z=z+ee|0,m=lt(m^z,8),l=l+m|0,ee=lt(ee^l,7),J=J+x|0,p=lt(p^J,16),h=h+p|0,x=lt(x^h,12),J=J+x|0,p=lt(p^J,8),h=h+p|0,x=lt(x^h,7),F=F+o|0,a=lt(a^F,16),v=v+a|0,o=lt(o^v,12),F=F+o|0,a=lt(a^F,8),v=v+a|0,o=lt(o^v,7),X=X+f|0,g=lt(g^X,16),y=y+g|0,f=lt(f^y,12),X=X+f|0,g=lt(g^X,8),y=y+g|0,f=lt(f^y,7),z=z+x|0,g=lt(g^z,16),v=v+g|0,x=lt(x^v,12),z=z+x|0,g=lt(g^z,8),v=v+g|0,x=lt(x^v,7),J=J+o|0,m=lt(m^J,16),y=y+m|0,o=lt(o^y,12),J=J+o|0,m=lt(m^J,8),y=y+m|0,o=lt(o^y,7),F=F+f|0,p=lt(p^F,16),l=l+p|0,f=lt(f^l,12),F=F+f|0,p=lt(p^F,8),l=l+p|0,f=lt(f^l,7),X=X+ee|0,a=lt(a^X,16),h=h+a|0,ee=lt(ee^h,12),X=X+ee|0,a=lt(a^X,8),h=h+a|0,ee=lt(ee^h,7);let S=0;n[S++]=u+z|0,n[S++]=d+J|0,n[S++]=c+F|0,n[S++]=b+X|0,n[S++]=w+ee|0,n[S++]=M+x|0,n[S++]=_+o|0,n[S++]=A+f|0,n[S++]=R+l|0,n[S++]=B+h|0,n[S++]=I+v|0,n[S++]=E+y|0,n[S++]=k+m|0,n[S++]=T+p|0,n[S++]=L+a|0,n[S++]=q+g|0}var Hk=kee(Bee,{counterRight:!1,counterLength:4,allowShortKeys:!1}),zk=class extends _k{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,Si.hash(e);const r=Ku(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const n=this.blockLen,s=new Uint8Array(n);s.set(r.length>n?e.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=e.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),s.fill(0)}update(e){return Si.exists(this),this.iHash.update(e),this}digestInto(e){Si.exists(this),Si.bytes(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:n,destroyed:s,blockLen:i,outputLen:u}=this;return e=e,e.finished=n,e.destroyed=s,e.blockLen=i,e.outputLen=u,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},sp=(e,t,r)=>new zk(e,t).update(r).digest();sp.create=(e,t)=>new zk(e,t);function Ree(e,t,r){return Si.hash(e),sp(e,Ku(r),Ku(t))}var Uv=new Uint8Array([0]),t8=new Uint8Array;function $ee(e,t,r,n=32){if(Si.hash(e),Si.number(n),n>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const s=Math.ceil(n/e.outputLen);r===void 0&&(r=t8);const i=new Uint8Array(s*e.outputLen),u=sp.create(e,t),d=u._cloneInto(),c=new Uint8Array(u.outputLen);for(let b=0;b<s;b++)Uv[0]=b+1,d.update(b===0?t8:c).update(r).update(Uv).digestInto(c),i.set(c,e.outputLen*b),u._cloneInto(d);return u.destroy(),d.destroy(),c.fill(0),Uv.fill(0),i.slice(0,n)}var Nee=Object.defineProperty,Ut=(e,t)=>{for(var r in t)Nee(e,r,{get:t[r],enumerable:!0})},Qs=Symbol("verified"),Tee=e=>e instanceof Object;function ib(e){if(!Tee(e)||typeof e.kind!="number"||typeof e.content!="string"||typeof e.created_at!="number"||typeof e.pubkey!="string"||!e.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(e.tags))return!1;for(let t=0;t<e.tags.length;t++){let r=e.tags[t];if(!Array.isArray(r))return!1;for(let n=0;n<r.length;n++)if(typeof r[n]!="string")return!1}return!0}var Iee={};Ut(Iee,{Queue:()=>Vk,QueueNode:()=>Wk,binarySearch:()=>ob,bytesToHex:()=>rr,hexToBytes:()=>La,insertEventIntoAscendingList:()=>Pee,insertEventIntoDescendingList:()=>Cee,normalizeURL:()=>sa,utf8Decoder:()=>fo,utf8Encoder:()=>ei});var fo=new TextDecoder("utf-8"),ei=new TextEncoder;function sa(e){try{e.indexOf("://")===-1&&(e="wss://"+e);let t=new URL(e);return t.protocol==="http:"?t.protocol="ws:":t.protocol==="https:"&&(t.protocol="wss:"),t.pathname=t.pathname.replace(/\/+/g,"/"),t.pathname.endsWith("/")&&(t.pathname=t.pathname.slice(0,-1)),(t.port==="80"&&t.protocol==="ws:"||t.port==="443"&&t.protocol==="wss:")&&(t.port=""),t.searchParams.sort(),t.hash="",t.toString()}catch{throw new Error(`Invalid URL: ${e}`)}}function Cee(e,t){const[r,n]=ob(e,s=>t.id===s.id?0:t.created_at===s.created_at?-1:s.created_at-t.created_at);return n||e.splice(r,0,t),e}function Pee(e,t){const[r,n]=ob(e,s=>t.id===s.id?0:t.created_at===s.created_at?-1:t.created_at-s.created_at);return n||e.splice(r,0,t),e}function ob(e,t){let r=0,n=e.length-1;for(;r<=n;){const s=Math.floor((r+n)/2),i=t(e[s]);if(i===0)return[s,!0];i<0?n=s-1:r=s+1}return[r,!1]}var Wk=class{constructor(e){ie(this,"value");ie(this,"next",null);ie(this,"prev",null);this.value=e}},Vk=class{constructor(){ie(this,"first");ie(this,"last");this.first=null,this.last=null}enqueue(e){const t=new Wk(e);return this.last?this.last===this.first?(this.last=t,this.last.prev=this.first,this.first.next=t):(t.prev=this.last,this.last.next=t,this.last=t):(this.first=t,this.last=t),!0}dequeue(){if(!this.first)return null;if(this.first===this.last){const t=this.first;return this.first=null,this.last=null,t.value}const e=this.first;return this.first=e.next,this.first&&(this.first.prev=null),e.value}},Lee=class{generateSecretKey(){return yi.utils.randomPrivateKey()}getPublicKey(e){return rr(yi.getPublicKey(e))}finalizeEvent(e,t){const r=e;return r.pubkey=rr(yi.getPublicKey(t)),r.id=Rc(r),r.sig=rr(yi.sign(Rc(r),t)),r[Qs]=!0,r}verifyEvent(e){if(typeof e[Qs]=="boolean")return e[Qs];const t=Rc(e);if(t!==e.id)return e[Qs]=!1,!1;try{const r=yi.verify(e.sig,t,e.pubkey);return e[Qs]=r,r}catch{return e[Qs]=!1,!1}}};function Oee(e){if(!ib(e))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content])}function Rc(e){let t=js(ei.encode(Oee(e)));return rr(t)}var ap=new Lee,Uee=ap.generateSecretKey,sb=ap.getPublicKey,Ui=ap.finalizeEvent,ba=ap.verifyEvent,jee={};Ut(jee,{Application:()=>Yte,BadgeAward:()=>Kee,BadgeDefinition:()=>zte,BlockedRelaysList:()=>Ate,BlossomServerList:()=>Ite,BookmarkList:()=>_te,Bookmarksets:()=>qte,Calendar:()=>ire,CalendarEventRSVP:()=>ore,ChannelCreation:()=>Xk,ChannelHideMessage:()=>tB,ChannelMessage:()=>eB,ChannelMetadata:()=>Qk,ChannelMuteUser:()=>rB,ChatMessage:()=>Zee,ClassifiedListing:()=>ere,ClientAuth:()=>iB,Comment:()=>nte,CommunitiesList:()=>Ete,CommunityDefinition:()=>lre,CommunityPostApproval:()=>hte,Contacts:()=>zee,CreateOrUpdateProduct:()=>Kte,CreateOrUpdateStall:()=>Vte,Curationsets:()=>Fte,Date:()=>rre,DirectMessageRelaysList:()=>Nte,DraftClassifiedListing:()=>tre,DraftLong:()=>Gte,Emojisets:()=>Jte,EncryptedDirectMessage:()=>Wee,EventDeletion:()=>Vee,FavoriteRelays:()=>Bte,FileMessage:()=>Jee,FileMetadata:()=>rte,FileServerPreference:()=>Tte,Followsets:()=>Ute,ForumThread:()=>Gee,GenericRepost:()=>hb,Genericlists:()=>jte,GiftWrap:()=>nB,GroupMetadata:()=>ure,HTTPAuth:()=>cb,Handlerinformation:()=>fre,Handlerrecommendation:()=>are,Highlights:()=>mte,InterestsList:()=>Rte,Interestsets:()=>Wte,JobFeedback:()=>pte,JobRequest:()=>cte,JobResult:()=>dte,Label:()=>ute,LightningPubRPC:()=>Pte,LiveChatMessage:()=>ite,LiveEvent:()=>Xte,LongFormArticle:()=>Zte,Metadata:()=>Fee,Mutelist:()=>bte,NWCWalletInfo:()=>Cte,NWCWalletRequest:()=>oB,NWCWalletResponse:()=>Lte,NormalVideo:()=>Xee,NostrConnect:()=>Ote,OpenTimestamps:()=>ete,Photo:()=>Yee,Pinlist:()=>xte,Poll:()=>tte,PollResponse:()=>wte,PrivateDirectMessage:()=>Yk,ProblemTracker:()=>ate,ProfileBadges:()=>Hte,PublicChatsList:()=>Ste,Reaction:()=>ub,RecommendRelay:()=>Hee,RelayList:()=>Mte,RelayReview:()=>sre,Relaysets:()=>Dte,Report:()=>fte,Reporting:()=>lte,Repost:()=>lb,Seal:()=>Jk,SearchRelaysList:()=>kte,ShortTextNote:()=>Gk,ShortVideo:()=>Qee,Time:()=>nre,UserEmojiList:()=>$te,UserStatuses:()=>Qte,Voice:()=>ote,VoiceComment:()=>ste,Zap:()=>yte,ZapGoal:()=>vte,ZapRequest:()=>gte,classifyKind:()=>Dee,isAddressableKind:()=>fb,isEphemeralKind:()=>Zk,isKind:()=>qee,isRegularKind:()=>Kk,isReplaceableKind:()=>ab});function Kk(e){return e<1e4&&e!==0&&e!==3}function ab(e){return e===0||e===3||1e4<=e&&e<2e4}function Zk(e){return 2e4<=e&&e<3e4}function fb(e){return 3e4<=e&&e<4e4}function Dee(e){return Kk(e)?"regular":ab(e)?"replaceable":Zk(e)?"ephemeral":fb(e)?"parameterized":"unknown"}function qee(e,t){const r=t instanceof Array?t:[t];return ib(e)&&r.includes(e.kind)||!1}var Fee=0,Gk=1,Hee=2,zee=3,Wee=4,Vee=5,lb=6,ub=7,Kee=8,Zee=9,Gee=11,Jk=13,Yk=14,Jee=15,hb=16,Yee=20,Xee=21,Qee=22,Xk=40,Qk=41,eB=42,tB=43,rB=44,ete=1040,nB=1059,tte=1068,rte=1063,nte=1111,ite=1311,ote=1222,ste=1244,ate=1971,fte=1984,lte=1984,ute=1985,hte=4550,cte=5999,dte=6999,pte=7e3,vte=9041,gte=9734,yte=9735,mte=9802,wte=1018,bte=1e4,xte=10001,Mte=10002,_te=10003,Ete=10004,Ste=10005,Ate=10006,kte=10007,Bte=10012,Rte=10015,$te=10030,Nte=10050,Tte=10096,Ite=10063,Cte=13194,Pte=21e3,iB=22242,oB=23194,Lte=23195,Ote=24133,cb=27235,Ute=3e4,jte=30001,Dte=30002,qte=30003,Fte=30004,Hte=30008,zte=30009,Wte=30015,Vte=30017,Kte=30018,Zte=30023,Gte=30024,Jte=30030,Yte=30078,Xte=30311,Qte=30315,ere=30402,tre=30403,rre=31922,nre=31923,ire=31924,ore=31925,sre=31987,are=31989,fre=31990,lre=34550,ure=39e3;function hre(e,t){if(e.ids&&e.ids.indexOf(t.id)===-1||e.kinds&&e.kinds.indexOf(t.kind)===-1||e.authors&&e.authors.indexOf(t.pubkey)===-1)return!1;for(let r in e)if(r[0]==="#"){let n=r.slice(1),s=e[`#${n}`];if(s&&!t.tags.find(([i,u])=>i===r.slice(1)&&s.indexOf(u)!==-1))return!1}return!(e.since&&t.created_at<e.since||e.until&&t.created_at>e.until)}function cre(e,t){for(let r=0;r<e.length;r++)if(hre(e[r],t))return!0;return!1}var dre={};Ut(dre,{getHex64:()=>fp,getInt:()=>sB,getSubscriptionId:()=>aB,matchEventId:()=>pre,matchEventKind:()=>gre,matchEventPubkey:()=>vre});function fp(e,t){let r=t.length+3,n=e.indexOf(`"${t}":`)+r,s=e.slice(n).indexOf('"')+n+1;return e.slice(s,s+64)}function sB(e,t){let r=t.length,n=e.indexOf(`"${t}":`)+r+3,s=e.slice(n),i=Math.min(s.indexOf(","),s.indexOf("}"));return parseInt(s.slice(0,i),10)}function aB(e){let t=e.slice(0,22).indexOf('"EVENT"');if(t===-1)return null;let r=e.slice(t+7+1).indexOf('"');if(r===-1)return null;let n=t+7+1+r,s=e.slice(n+1,80).indexOf('"');if(s===-1)return null;let i=n+1+s;return e.slice(n+1,i)}function pre(e,t){return t===fp(e,"id")}function vre(e,t){return t===fp(e,"pubkey")}function gre(e,t){return t===sB(e,"kind")}var yre={};Ut(yre,{makeAuthEvent:()=>fB});function fB(e,t){return{kind:iB,created_at:Math.floor(Date.now()/1e3),tags:[["relay",e],["challenge",t]],content:""}}async function mre(){return new Promise((e,t)=>{try{if(typeof MessageChannel<"u"){const r=new MessageChannel,n=()=>{r.port1.removeEventListener("message",n),e()};r.port1.addEventListener("message",n),r.port2.postMessage(0),r.port1.start()}else typeof setImmediate<"u"?setImmediate(e):typeof setTimeout<"u"?setTimeout(e,0):e()}catch(r){console.error("during yield: ",r),t(r)}})}var wre=e=>(e[Qs]=!0,!0),lB=class extends Error{constructor(e,t){super(`Tried to send message '${e} on a closed connection to ${t}.`),this.name="SendingOnClosedConnection"}},uB=class{constructor(e,t){ie(this,"url");ie(this,"_connected",!1);ie(this,"onclose",null);ie(this,"onnotice",e=>console.debug(`NOTICE from ${this.url}: ${e}`));ie(this,"onauth");ie(this,"baseEoseTimeout",4400);ie(this,"connectionTimeout",4400);ie(this,"publishTimeout",4400);ie(this,"pingFrequency",29e3);ie(this,"pingTimeout",2e4);ie(this,"resubscribeBackoff",[1e4,1e4,1e4,2e4,2e4,3e4,6e4]);ie(this,"openSubs",new Map);ie(this,"enablePing");ie(this,"enableReconnect");ie(this,"connectionTimeoutHandle");ie(this,"reconnectTimeoutHandle");ie(this,"pingIntervalHandle");ie(this,"reconnectAttempts",0);ie(this,"closedIntentionally",!1);ie(this,"connectionPromise");ie(this,"openCountRequests",new Map);ie(this,"openEventPublishes",new Map);ie(this,"ws");ie(this,"incomingMessageQueue",new Vk);ie(this,"queueRunning",!1);ie(this,"challenge");ie(this,"authPromise");ie(this,"serial",0);ie(this,"verifyEvent");ie(this,"_WebSocket");this.url=sa(e),this.verifyEvent=t.verifyEvent,this._WebSocket=t.websocketImplementation||WebSocket,this.enablePing=t.enablePing,this.enableReconnect=t.enableReconnect||!1}static async connect(e,t){const r=new uB(e,t);return await r.connect(),r}closeAllSubscriptions(e){for(let[t,r]of this.openSubs)r.close(e);this.openSubs.clear();for(let[t,r]of this.openEventPublishes)r.reject(new Error(e));this.openEventPublishes.clear();for(let[t,r]of this.openCountRequests)r.reject(new Error(e));this.openCountRequests.clear()}get connected(){return this._connected}async reconnect(){const e=this.resubscribeBackoff[Math.min(this.reconnectAttempts,this.resubscribeBackoff.length-1)];this.reconnectAttempts++,this.reconnectTimeoutHandle=setTimeout(async()=>{try{await this.connect()}catch{}},e)}handleHardClose(e){var r;this.pingIntervalHandle&&(clearInterval(this.pingIntervalHandle),this.pingIntervalHandle=void 0),this._connected=!1,this.connectionPromise=void 0;const t=this.closedIntentionally;this.closedIntentionally=!1,(r=this.onclose)==null||r.call(this),this.enableReconnect&&!t?this.reconnect():this.closeAllSubscriptions(e)}async connect(){return this.connectionPromise?this.connectionPromise:(this.challenge=void 0,this.authPromise=void 0,this.connectionPromise=new Promise((e,t)=>{this.connectionTimeoutHandle=setTimeout(()=>{var r;t("connection timed out"),this.connectionPromise=void 0,(r=this.onclose)==null||r.call(this),this.closeAllSubscriptions("relay connection timed out")},this.connectionTimeout);try{this.ws=new this._WebSocket(this.url)}catch(r){clearTimeout(this.connectionTimeoutHandle),t(r);return}this.ws.onopen=()=>{this.reconnectTimeoutHandle&&(clearTimeout(this.reconnectTimeoutHandle),this.reconnectTimeoutHandle=void 0),clearTimeout(this.connectionTimeoutHandle),this._connected=!0;const r=this.reconnectAttempts>0;this.reconnectAttempts=0;for(const n of this.openSubs.values()){if(n.eosed=!1,r)for(let s=0;s<n.filters.length;s++)n.lastEmitted&&(n.filters[s].since=n.lastEmitted+1);n.fire()}this.enablePing&&(this.pingIntervalHandle=setInterval(()=>this.pingpong(),this.pingFrequency)),e()},this.ws.onerror=r=>{clearTimeout(this.connectionTimeoutHandle),t(r.message||"websocket error"),this.handleHardClose("relay connection errored")},this.ws.onclose=r=>{clearTimeout(this.connectionTimeoutHandle),t(r.message||"websocket closed"),this.handleHardClose("relay connection closed")},this.ws.onmessage=this._onmessage.bind(this)}),this.connectionPromise)}waitForPingPong(){return new Promise(e=>{this.ws.once("pong",()=>e(!0)),this.ws.ping()})}waitForDummyReq(){return new Promise((e,t)=>{if(!this.connectionPromise)return t(new Error(`no connection to ${this.url}, can't ping`));try{const r=this.subscribe([{ids:["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"],limit:0}],{label:"forced-ping",oneose:()=>{e(!0),r.close()},onclose(){e(!0)},eoseTimeout:this.pingTimeout+1e3})}catch(r){t(r)}})}async pingpong(){var e,t,r;((e=this.ws)==null?void 0:e.readyState)===1&&(await Promise.any([this.ws&&this.ws.ping&&this.ws.once?this.waitForPingPong():this.waitForDummyReq(),new Promise(s=>setTimeout(()=>s(!1),this.pingTimeout))])||((t=this.ws)==null?void 0:t.readyState)===this._WebSocket.OPEN&&((r=this.ws)==null||r.close()))}async runQueue(){for(this.queueRunning=!0;this.handleNext()!==!1;)await mre();this.queueRunning=!1}handleNext(){var r,n,s;const e=this.incomingMessageQueue.dequeue();if(!e)return!1;const t=aB(e);if(t){const i=this.openSubs.get(t);if(!i)return;const u=fp(e,"id"),d=(r=i.alreadyHaveEvent)==null?void 0:r.call(i,u);if((n=i.receivedEvent)==null||n.call(i,this,u),d)return}try{let i=JSON.parse(e);switch(i[0]){case"EVENT":{const u=this.openSubs.get(i[1]),d=i[2];this.verifyEvent(d)&&cre(u.filters,d)&&u.onevent(d),(!u.lastEmitted||u.lastEmitted<d.created_at)&&(u.lastEmitted=d.created_at);return}case"COUNT":{const u=i[1],d=i[2],c=this.openCountRequests.get(u);c&&(c.resolve(d.count),this.openCountRequests.delete(u));return}case"EOSE":{const u=this.openSubs.get(i[1]);if(!u)return;u.receivedEose();return}case"OK":{const u=i[1],d=i[2],c=i[3],b=this.openEventPublishes.get(u);b&&(clearTimeout(b.timeout),d?b.resolve(c):b.reject(new Error(c)),this.openEventPublishes.delete(u));return}case"CLOSED":{const u=i[1],d=this.openSubs.get(u);if(!d)return;d.closed=!0,d.close(i[2]);return}case"NOTICE":{this.onnotice(i[1]);return}case"AUTH":{this.challenge=i[1],this.onauth&&this.auth(this.onauth);return}default:{const u=this.openSubs.get(i[1]);(s=u==null?void 0:u.oncustom)==null||s.call(u,i);return}}}catch{return}}async send(e){if(!this.connectionPromise)throw new lB(e,this.url);this.connectionPromise.then(()=>{var t;(t=this.ws)==null||t.send(e)})}async auth(e){const t=this.challenge;if(!t)throw new Error("can't perform auth, no challenge was received");return this.authPromise?this.authPromise:(this.authPromise=new Promise(async(r,n)=>{try{let s=await e(fB(this.url,t)),i=setTimeout(()=>{let u=this.openEventPublishes.get(s.id);u&&(u.reject(new Error("auth timed out")),this.openEventPublishes.delete(s.id))},this.publishTimeout);this.openEventPublishes.set(s.id,{resolve:r,reject:n,timeout:i}),this.send('["AUTH",'+JSON.stringify(s)+"]")}catch(s){console.warn("subscribe auth function failed:",s)}}),this.authPromise)}async publish(e){const t=new Promise((r,n)=>{const s=setTimeout(()=>{const i=this.openEventPublishes.get(e.id);i&&(i.reject(new Error("publish timed out")),this.openEventPublishes.delete(e.id))},this.publishTimeout);this.openEventPublishes.set(e.id,{resolve:r,reject:n,timeout:s})});return this.send('["EVENT",'+JSON.stringify(e)+"]"),t}async count(e,t){this.serial++;const r=(t==null?void 0:t.id)||"count:"+this.serial,n=new Promise((s,i)=>{this.openCountRequests.set(r,{resolve:s,reject:i})});return this.send('["COUNT","'+r+'",'+JSON.stringify(e).substring(1)),n}subscribe(e,t){const r=this.prepareSubscription(e,t);return r.fire(),r}prepareSubscription(e,t){this.serial++;const r=t.id||(t.label?t.label+":":"sub:")+this.serial,n=new bre(this,r,e,t);return this.openSubs.set(r,n),n}close(){var e,t,r;this.closedIntentionally=!0,this.reconnectTimeoutHandle&&(clearTimeout(this.reconnectTimeoutHandle),this.reconnectTimeoutHandle=void 0),this.pingIntervalHandle&&(clearInterval(this.pingIntervalHandle),this.pingIntervalHandle=void 0),this.closeAllSubscriptions("relay connection closed by us"),this._connected=!1,(e=this.onclose)==null||e.call(this),((t=this.ws)==null?void 0:t.readyState)===this._WebSocket.OPEN&&((r=this.ws)==null||r.close())}_onmessage(e){this.incomingMessageQueue.enqueue(e.data),this.queueRunning||this.runQueue()}},bre=class{constructor(e,t,r,n){ie(this,"relay");ie(this,"id");ie(this,"lastEmitted");ie(this,"closed",!1);ie(this,"eosed",!1);ie(this,"filters");ie(this,"alreadyHaveEvent");ie(this,"receivedEvent");ie(this,"onevent");ie(this,"oneose");ie(this,"onclose");ie(this,"oncustom");ie(this,"eoseTimeout");ie(this,"eoseTimeoutHandle");if(r.length===0)throw new Error("subscription can't be created with zero filters");this.relay=e,this.filters=r,this.id=t,this.alreadyHaveEvent=n.alreadyHaveEvent,this.receivedEvent=n.receivedEvent,this.eoseTimeout=n.eoseTimeout||e.baseEoseTimeout,this.oneose=n.oneose,this.onclose=n.onclose,this.onevent=n.onevent||(s=>{console.warn(`onevent() callback not defined for subscription '${this.id}' in relay ${this.relay.url}. event received:`,s)})}fire(){this.relay.send('["REQ","'+this.id+'",'+JSON.stringify(this.filters).substring(1)),this.eoseTimeoutHandle=setTimeout(this.receivedEose.bind(this),this.eoseTimeout)}receivedEose(){var e;this.eosed||(clearTimeout(this.eoseTimeoutHandle),this.eosed=!0,(e=this.oneose)==null||e.call(this))}close(e="closed by caller"){var t;if(!this.closed&&this.relay.connected){try{this.relay.send('["CLOSE",'+JSON.stringify(this.id)+"]")}catch(r){if(!(r instanceof lB))throw r}this.closed=!0}this.relay.openSubs.delete(this.id),(t=this.onclose)==null||t.call(this,e)}},xre;try{xre=WebSocket}catch{}var Mre=class{constructor(e){ie(this,"relays",new Map);ie(this,"seenOn",new Map);ie(this,"trackRelays",!1);ie(this,"verifyEvent");ie(this,"enablePing");ie(this,"enableReconnect");ie(this,"automaticallyAuth");ie(this,"trustedRelayURLs",new Set);ie(this,"_WebSocket");this.verifyEvent=e.verifyEvent,this._WebSocket=e.websocketImplementation,this.enablePing=e.enablePing,this.enableReconnect=e.enableReconnect||!1,this.automaticallyAuth=e.automaticallyAuth}async ensureRelay(e,t){e=sa(e);let r=this.relays.get(e);if(r||(r=new uB(e,{verifyEvent:this.trustedRelayURLs.has(e)?wre:this.verifyEvent,websocketImplementation:this._WebSocket,enablePing:this.enablePing,enableReconnect:this.enableReconnect}),r.onclose=()=>{r&&!r.enableReconnect&&this.relays.delete(e)},t!=null&&t.connectionTimeout&&(r.connectionTimeout=t.connectionTimeout),this.relays.set(e,r)),this.automaticallyAuth){const n=this.automaticallyAuth(e);n&&(r.onauth=n)}return await r.connect(),r}close(e){e.map(sa).forEach(t=>{var r;(r=this.relays.get(t))==null||r.close(),this.relays.delete(t)})}subscribe(e,t,r){const n=[];for(let s=0;s<e.length;s++){const i=sa(e[s]);n.find(u=>u.url===i)||n.push({url:i,filter:t})}return this.subscribeMap(n,r)}subscribeMany(e,t,r){const n=[],s=[];for(let i=0;i<e.length;i++){const u=sa(e[i]);s.indexOf(u)===-1&&(s.push(u),n.push({url:u,filter:t}))}return this.subscribeMap(n,r)}subscribeMap(e,t){const r=new Map;for(const _ of e){const{url:A,filter:R}=_;r.has(A)||r.set(A,[]),r.get(A).push(R)}const n=Array.from(r.entries()).map(([_,A])=>({url:_,filters:A}));this.trackRelays&&(t.receivedEvent=(_,A)=>{let R=this.seenOn.get(A);R||(R=new Set,this.seenOn.set(A,R)),R.add(_)});const s=new Set,i=[],u=[];let d=_=>{var A;u[_]||(u[_]=!0,u.filter(R=>R).length===n.length&&((A=t.oneose)==null||A.call(t),d=()=>{}))};const c=[];let b=(_,A)=>{var R;c[_]||(d(_),c[_]=A,c.filter(B=>B).length===n.length&&((R=t.onclose)==null||R.call(t,c),b=()=>{}))};const w=_=>{var R;if((R=t.alreadyHaveEvent)!=null&&R.call(t,_))return!0;const A=s.has(_);return s.add(_),A},M=Promise.all(n.map(async({url:_,filters:A},R)=>{let B;try{B=await this.ensureRelay(_,{connectionTimeout:t.maxWait?Math.max(t.maxWait*.8,t.maxWait-1e3):void 0})}catch(E){b(R,(E==null?void 0:E.message)||String(E));return}let I=B.subscribe(A,{...t,oneose:()=>d(R),onclose:E=>{E.startsWith("auth-required: ")&&t.onauth?B.auth(t.onauth).then(()=>{B.subscribe(A,{...t,oneose:()=>d(R),onclose:k=>{b(R,k)},alreadyHaveEvent:w,eoseTimeout:t.maxWait})}).catch(k=>{b(R,`auth was required and attempted, but failed with: ${k}`)}):b(R,E)},alreadyHaveEvent:w,eoseTimeout:t.maxWait});i.push(I)}));return{async close(_){await M,i.forEach(A=>{A.close(_)})}}}subscribeEose(e,t,r){const n=this.subscribe(e,t,{...r,oneose(){n.close("closed automatically on eose")}});return n}subscribeManyEose(e,t,r){const n=this.subscribeMany(e,t,{...r,oneose(){n.close("closed automatically on eose")}});return n}async querySync(e,t,r){return new Promise(async n=>{const s=[];this.subscribeEose(e,t,{...r,onevent(i){s.push(i)},onclose(i){n(s)}})})}async get(e,t,r){t.limit=1;const n=await this.querySync(e,t,r);return n.sort((s,i)=>i.created_at-s.created_at),n[0]||null}publish(e,t,r){return e.map(sa).map(async(n,s,i)=>{if(i.indexOf(n)!==s)return Promise.reject("duplicate url");let u=await this.ensureRelay(n);return u.publish(t).catch(async d=>{if(d instanceof Error&&d.message.startsWith("auth-required: ")&&(r!=null&&r.onauth))return await u.auth(r.onauth),u.publish(t);throw d}).then(d=>{if(this.trackRelays){let c=this.seenOn.get(t.id);c||(c=new Set,this.seenOn.set(t.id,c)),c.add(u)}return d})})}listConnectionStatus(){const e=new Map;return this.relays.forEach((t,r)=>e.set(r,t.connected)),e}destroy(){this.relays.forEach(e=>e.close()),this.relays=new Map}},hB;try{hB=WebSocket}catch{}var _re=class extends Mre{constructor(e){super({verifyEvent:ba,websocketImplementation:hB,...e})}},Ere={};Ut(Ere,{BECH32_REGEX:()=>cB,Bech32MaxSize:()=>db,NostrTypeGuard:()=>Sre,decode:()=>lp,decodeNostrURI:()=>kre,encodeBytes:()=>hp,naddrEncode:()=>Ire,neventEncode:()=>Tre,noteEncode:()=>$re,nprofileEncode:()=>Nre,npubEncode:()=>Rre,nsecEncode:()=>Bre});var Sre={isNProfile:e=>/^nprofile1[a-z\d]+$/.test(e||""),isNEvent:e=>/^nevent1[a-z\d]+$/.test(e||""),isNAddr:e=>/^naddr1[a-z\d]+$/.test(e||""),isNSec:e=>/^nsec1[a-z\d]{58}$/.test(e||""),isNPub:e=>/^npub1[a-z\d]{58}$/.test(e||""),isNote:e=>/^note1[a-z\d]+$/.test(e||""),isNcryptsec:e=>/^ncryptsec1[a-z\d]+$/.test(e||"")},db=5e3,cB=/[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;function Are(e){const t=new Uint8Array(4);return t[0]=e>>24&255,t[1]=e>>16&255,t[2]=e>>8&255,t[3]=e&255,t}function kre(e){try{return e.startsWith("nostr:")&&(e=e.substring(6)),lp(e)}catch{return{type:"invalid",data:null}}}function lp(e){var s,i,u,d,c,b,w;let{prefix:t,words:r}=fl.decode(e,db),n=new Uint8Array(fl.fromWords(r));switch(t){case"nprofile":{let M=jv(n);if(!((s=M[0])!=null&&s[0]))throw new Error("missing TLV 0 for nprofile");if(M[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:rr(M[0][0]),relays:M[1]?M[1].map(_=>fo.decode(_)):[]}}}case"nevent":{let M=jv(n);if(!((i=M[0])!=null&&i[0]))throw new Error("missing TLV 0 for nevent");if(M[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");if(M[2]&&M[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(M[3]&&M[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:rr(M[0][0]),relays:M[1]?M[1].map(_=>fo.decode(_)):[],author:(u=M[2])!=null&&u[0]?rr(M[2][0]):void 0,kind:(d=M[3])!=null&&d[0]?parseInt(rr(M[3][0]),16):void 0}}}case"naddr":{let M=jv(n);if(!((c=M[0])!=null&&c[0]))throw new Error("missing TLV 0 for naddr");if(!((b=M[2])!=null&&b[0]))throw new Error("missing TLV 2 for naddr");if(M[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(!((w=M[3])!=null&&w[0]))throw new Error("missing TLV 3 for naddr");if(M[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:fo.decode(M[0][0]),pubkey:rr(M[2][0]),kind:parseInt(rr(M[3][0]),16),relays:M[1]?M[1].map(_=>fo.decode(_)):[]}}}case"nsec":return{type:t,data:n};case"npub":case"note":return{type:t,data:rr(n)};default:throw new Error(`unknown prefix ${t}`)}}function jv(e){let t={},r=e;for(;r.length>0;){let n=r[0],s=r[1],i=r.slice(2,2+s);if(r=r.slice(2+s),i.length<s)throw new Error(`not enough data to read on TLV ${n}`);t[n]=t[n]||[],t[n].push(i)}return t}function Bre(e){return hp("nsec",e)}function Rre(e){return hp("npub",La(e))}function $re(e){return hp("note",La(e))}function up(e,t){let r=fl.toWords(t);return fl.encode(e,r,db)}function hp(e,t){return up(e,t)}function Nre(e){let t=pb({0:[La(e.pubkey)],1:(e.relays||[]).map(r=>ei.encode(r))});return up("nprofile",t)}function Tre(e){let t;e.kind!==void 0&&(t=Are(e.kind));let r=pb({0:[La(e.id)],1:(e.relays||[]).map(n=>ei.encode(n)),2:e.author?[La(e.author)]:[],3:t?[new Uint8Array(t)]:[]});return up("nevent",r)}function Ire(e){let t=new ArrayBuffer(4);new DataView(t).setUint32(0,e.kind,!1);let r=pb({0:[ei.encode(e.identifier)],1:(e.relays||[]).map(n=>ei.encode(n)),2:[La(e.pubkey)],3:[new Uint8Array(t)]});return up("naddr",r)}function pb(e){let t=[];return Object.entries(e).reverse().forEach(([r,n])=>{n.forEach(s=>{let i=new Uint8Array(s.length+2);i.set([parseInt(r)],0),i.set([s.length],1),i.set(s,2),t.push(i)})}),np(...t)}var Cre={};Ut(Cre,{decrypt:()=>Pre,encrypt:()=>dB});function dB(e,t,r){const n=e instanceof Uint8Array?rr(e):e,s=$l.getSharedSecret(n,"02"+t),i=pB(s);let u=Uint8Array.from(Sk(16)),d=ei.encode(r),c=jk(i,u).encrypt(d),b=Eo.encode(new Uint8Array(c)),w=Eo.encode(new Uint8Array(u.buffer));return`${b}?iv=${w}`}function Pre(e,t,r){const n=e instanceof Uint8Array?rr(e):e;let[s,i]=r.split("?iv="),u=$l.getSharedSecret(n,"02"+t),d=pB(u),c=Eo.decode(i),b=Eo.decode(s),w=jk(d,c).decrypt(b);return fo.decode(w)}function pB(e){return e.slice(1,33)}var Lre={};Ut(Lre,{NIP05_REGEX:()=>vb,isNip05:()=>Ore,isValid:()=>Dre,queryProfile:()=>vB,searchDomain:()=>jre,useFetchImplementation:()=>Ure});var vb=/^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,Ore=e=>vb.test(e||""),cp;try{cp=fetch}catch{}function Ure(e){cp=e}async function jre(e,t=""){try{const r=`https://${e}/.well-known/nostr.json?name=${t}`,n=await cp(r,{redirect:"manual"});if(n.status!==200)throw Error("Wrong response code");return(await n.json()).names}catch{return{}}}async function vB(e){var s;const t=e.match(vb);if(!t)return null;const[,r="_",n]=t;try{const i=`https://${n}/.well-known/nostr.json?name=${r}`,u=await cp(i,{redirect:"manual"});if(u.status!==200)throw Error("Wrong response code");const d=await u.json(),c=d.names[r];return c?{pubkey:c,relays:(s=d.relays)==null?void 0:s[c]}:null}catch{return null}}async function Dre(e,t){const r=await vB(t);return r?r.pubkey===e:!1}var qre={};Ut(qre,{parse:()=>Fre});function Fre(e){const t={reply:void 0,root:void 0,mentions:[],profiles:[],quotes:[]};let r,n;for(let s=e.tags.length-1;s>=0;s--){const i=e.tags[s];if(i[0]==="e"&&i[1]){const[u,d,c,b,w]=i,M={id:d,relays:c?[c]:[],author:w};if(b==="root"){t.root=M;continue}if(b==="reply"){t.reply=M;continue}if(b==="mention"){t.mentions.push(M);continue}r?n=M:r=M,t.mentions.push(M);continue}if(i[0]==="q"&&i[1]){const[u,d,c]=i;t.quotes.push({id:d,relays:c?[c]:[]})}if(i[0]==="p"&&i[1]){t.profiles.push({pubkey:i[1],relays:i[2]?[i[2]]:[]});continue}}return t.root||(t.root=n||r||t.reply),t.reply||(t.reply=r||t.root),[t.reply,t.root].forEach(s=>{if(!s)return;let i=t.mentions.indexOf(s);if(i!==-1&&t.mentions.splice(i,1),s.author){let u=t.profiles.find(d=>d.pubkey===s.author);u&&u.relays&&(s.relays||(s.relays=[]),u.relays.forEach(d=>{var c;((c=s.relays)==null?void 0:c.indexOf(d))===-1&&s.relays.push(d)}),u.relays=s.relays)}}),t.mentions.forEach(s=>{if(s.author){let i=t.profiles.find(u=>u.pubkey===s.author);i&&i.relays&&(s.relays||(s.relays=[]),i.relays.forEach(u=>{s.relays.indexOf(u)===-1&&s.relays.push(u)}),i.relays=s.relays)}}),t}var Hre={};Ut(Hre,{fetchRelayInformation:()=>Wre,useFetchImplementation:()=>zre});var gB;try{gB=fetch}catch{}function zre(e){gB=e}async function Wre(e){return await(await fetch(e.replace("ws://","http://").replace("wss://","https://"),{headers:{Accept:"application/nostr+json"}})).json()}var Vre={};Ut(Vre,{fastEventHash:()=>mB,getPow:()=>yB,minePow:()=>Kre});function yB(e){let t=0;for(let r=0;r<64;r+=8){const n=parseInt(e.substring(r,r+8),16);if(n===0)t+=32;else{t+=Math.clz32(n);break}}return t}function Kre(e,t){let r=0;const n=e,s=["nonce",r.toString(),t.toString()];for(n.tags.push(s);;){const i=Math.floor(new Date().getTime()/1e3);if(i!==n.created_at&&(r=0,n.created_at=i),s[1]=(++r).toString(),n.id=mB(n),yB(n.id)>=t)break}return n}function mB(e){return rr(js(ei.encode(JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content]))))}var Zre={};Ut(Zre,{unwrapEvent:()=>sne,unwrapManyEvents:()=>ane,wrapEvent:()=>NB,wrapManyEvents:()=>one});var Gre={};Ut(Gre,{createRumor:()=>kB,createSeal:()=>BB,createWrap:()=>RB,unwrapEvent:()=>bb,unwrapManyEvents:()=>$B,wrapEvent:()=>R0,wrapManyEvents:()=>nne});var Jre={};Ut(Jre,{decrypt:()=>wb,encrypt:()=>mb,getConversationKey:()=>gb,v2:()=>tne});var wB=1,bB=65535;function gb(e,t){const r=$l.getSharedSecret(e,"02"+t).subarray(1,33);return Ree(js,r,"nip44-v2")}function xB(e,t){const r=$ee(js,e,t,76);return{chacha_key:r.subarray(0,32),chacha_nonce:r.subarray(32,44),hmac_key:r.subarray(44,76)}}function yb(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("expected positive integer");if(e<=32)return 32;const t=1<<Math.floor(Math.log2(e-1))+1,r=t<=256?32:t/8;return r*(Math.floor((e-1)/r)+1)}function Yre(e){if(!Number.isSafeInteger(e)||e<wB||e>bB)throw new Error("invalid plaintext size: must be between 1 and 65535 bytes");const t=new Uint8Array(2);return new DataView(t.buffer).setUint16(0,e,!1),t}function Xre(e){const t=ei.encode(e),r=t.length,n=Yre(r),s=new Uint8Array(yb(r)-r);return np(n,t,s)}function Qre(e){const t=new DataView(e.buffer).getUint16(0),r=e.subarray(2,2+t);if(t<wB||t>bB||r.length!==t||e.length!==2+yb(t))throw new Error("invalid padding");return fo.decode(r)}function MB(e,t,r){if(r.length!==32)throw new Error("AAD associated data must be 32 bytes");const n=np(r,t);return sp(js,e,n)}function ene(e){if(typeof e!="string")throw new Error("payload must be a valid string");const t=e.length;if(t<132||t>87472)throw new Error("invalid payload length: "+t);if(e[0]==="#")throw new Error("unknown encryption version");let r;try{r=Eo.decode(e)}catch(i){throw new Error("invalid base64: "+i.message)}const n=r.length;if(n<99||n>65603)throw new Error("invalid data length: "+n);const s=r[0];if(s!==2)throw new Error("unknown encryption version "+s);return{nonce:r.subarray(1,33),ciphertext:r.subarray(33,-32),mac:r.subarray(-32)}}function mb(e,t,r=Sk(32)){const{chacha_key:n,chacha_nonce:s,hmac_key:i}=xB(t,r),u=Xre(e),d=Hk(n,s,u),c=MB(i,d,r);return Eo.encode(np(new Uint8Array([2]),r,d,c))}function wb(e,t){const{nonce:r,ciphertext:n,mac:s}=ene(e),{chacha_key:i,chacha_nonce:u,hmac_key:d}=xB(t,r),c=MB(d,n,r);if(!nee(c,s))throw new Error("invalid MAC");const b=Hk(i,u,n);return Qre(b)}var tne={utils:{getConversationKey:gb,calcPaddedLen:yb},encrypt:mb,decrypt:wb},rne=2*24*60*60,_B=()=>Math.round(Date.now()/1e3),EB=()=>Math.round(_B()-Math.random()*rne),SB=(e,t)=>gb(e,t),AB=(e,t,r)=>mb(JSON.stringify(e),SB(t,r)),r8=(e,t)=>JSON.parse(wb(e.content,SB(t,e.pubkey)));function kB(e,t){const r={created_at:_B(),content:"",tags:[],...e,pubkey:sb(t)};return r.id=Rc(r),r}function BB(e,t,r){return Ui({kind:Jk,content:AB(e,t,r),created_at:EB(),tags:[]},t)}function RB(e,t){const r=Uee();return Ui({kind:nB,content:AB(e,r,t),created_at:EB(),tags:[["p",t]]},r)}function R0(e,t,r){const n=kB(e,t),s=BB(n,t,r);return RB(s,r)}function nne(e,t,r){if(!r||r.length===0)throw new Error("At least one recipient is required.");const n=sb(t),s=[R0(e,t,n)];return r.forEach(i=>{s.push(R0(e,t,i))}),s}function bb(e,t){const r=r8(e,t);return r8(r,t)}function $B(e,t){let r=[];return e.forEach(n=>{r.push(bb(n,t))}),r.sort((n,s)=>n.created_at-s.created_at),r}function ine(e,t,r,n){const s={created_at:Math.ceil(Date.now()/1e3),kind:Yk,tags:[],content:t};return(Array.isArray(e)?e:[e]).forEach(({publicKey:u,relayUrl:d})=>{s.tags.push(d?["p",u,d]:["p",u])}),n&&s.tags.push(["e",n.eventId,n.relayUrl||"","reply"]),r&&s.tags.push(["subject",r]),s}function NB(e,t,r,n,s){const i=ine(t,r,n,s);return R0(i,e,t.publicKey)}function one(e,t,r,n,s){if(!t||t.length===0)throw new Error("At least one recipient is required.");return[{publicKey:sb(e)},...t].map(u=>NB(e,u,r,n,s))}var sne=bb,ane=$B,fne={};Ut(fne,{finishRepostEvent:()=>lne,getRepostedEvent:()=>une,getRepostedEventPointer:()=>TB});function lne(e,t,r,n){var u;let s;const i=[...e.tags??[],["e",t.id,r],["p",t.pubkey]];return t.kind===Gk?s=lb:(s=hb,i.push(["k",String(t.kind)])),Ui({kind:s,tags:i,content:e.content===""||(u=t.tags)!=null&&u.find(d=>d[0]==="-")?"":JSON.stringify(t),created_at:e.created_at},n)}function TB(e){if(![lb,hb].includes(e.kind))return;let t,r;for(let n=e.tags.length-1;n>=0&&(t===void 0||r===void 0);n--){const s=e.tags[n];s.length>=2&&(s[0]==="e"&&t===void 0?t=s:s[0]==="p"&&r===void 0&&(r=s))}if(t!==void 0)return{id:t[1],relays:[t[2],r==null?void 0:r[2]].filter(n=>typeof n=="string"),author:r==null?void 0:r[1]}}function une(e,{skipVerification:t}={}){const r=TB(e);if(r===void 0||e.content==="")return;let n;try{n=JSON.parse(e.content)}catch{return}if(n.id===r.id&&!(!t&&!ba(n)))return n}var hne={};Ut(hne,{NOSTR_URI_REGEX:()=>xb,parse:()=>dne,test:()=>cne});var xb=new RegExp(`nostr:(${cB.source})`);function cne(e){return typeof e=="string"&&new RegExp(`^${xb.source}$`).test(e)}function dne(e){const t=e.match(new RegExp(`^${xb.source}$`));if(!t)throw new Error(`Invalid Nostr URI: ${e}`);return{uri:t[0],value:t[1],decoded:lp(t[1])}}var pne={};Ut(pne,{finishReactionEvent:()=>vne,getReactedEventPointer:()=>gne});function vne(e,t,r){const n=t.tags.filter(s=>s.length>=2&&(s[0]==="e"||s[0]==="p"));return Ui({...e,kind:ub,tags:[...e.tags??[],...n,["e",t.id],["p",t.pubkey]],content:e.content??"+"},r)}function gne(e){if(e.kind!==ub)return;let t,r;for(let n=e.tags.length-1;n>=0&&(t===void 0||r===void 0);n--){const s=e.tags[n];s.length>=2&&(s[0]==="e"&&t===void 0?t=s:s[0]==="p"&&r===void 0&&(r=s))}if(!(t===void 0||r===void 0))return{id:t[1],relays:[t[2],r[2]].filter(n=>n!==void 0),author:r[1]}}var yne={};Ut(yne,{parse:()=>wne});var n8=/\W/m,i8=/[^\w\/] |[^\w\/]$|$|,| /m,mne=42;function*wne(e){let t=[];if(typeof e!="string"){for(let i=0;i<e.tags.length;i++){const u=e.tags[i];u[0]==="emoji"&&u.length>=3&&t.push({type:"emoji",shortcode:u[1],url:u[2]})}e=e.content}const r=e.length;let n=0,s=0;e:for(;s<r;){const i=e.indexOf(":",s),u=e.indexOf("#",s);if(i===-1&&u===-1)break e;if(i===-1||u>=0&&u<i){if(u===0||e[u-1]===" "){const d=e.slice(u+1,u+mne).match(n8),c=d?u+1+d.index:r;yield{type:"text",text:e.slice(n,u)},yield{type:"hashtag",value:e.slice(u+1,c)},s=c,n=s;continue e}s=u+1;continue e}if(e.slice(i-5,i)==="nostr"){const d=e.slice(i+60).match(n8),c=d?i+60+d.index:r;try{let b,{data:w,type:M}=lp(e.slice(i+1,c));switch(M){case"npub":b={pubkey:w};break;case"note":b={id:w};break;case"nsec":s=c+1;continue;default:b=w}n!==i-5&&(yield{type:"text",text:e.slice(n,i-5)}),yield{type:"reference",pointer:b},s=c,n=s;continue e}catch{s=i+1;continue e}}else if(e.slice(i-5,i)==="https"||e.slice(i-4,i)==="http"){const d=e.slice(i+4).match(i8),c=d?i+4+d.index:r,b=e[i-1]==="s"?5:4;try{let w=new URL(e.slice(i-b,c));if(w.hostname.indexOf(".")===-1)throw new Error("invalid url");if(n!==i-b&&(yield{type:"text",text:e.slice(n,i-b)}),/\.(png|jpe?g|gif|webp|heic|svg)$/i.test(w.pathname)){yield{type:"image",url:w.toString()},s=c,n=s;continue e}if(/\.(mp4|avi|webm|mkv|mov)$/i.test(w.pathname)){yield{type:"video",url:w.toString()},s=c,n=s;continue e}if(/\.(mp3|aac|ogg|opus|wav|flac)$/i.test(w.pathname)){yield{type:"audio",url:w.toString()},s=c,n=s;continue e}yield{type:"url",url:w.toString()},s=c,n=s;continue e}catch{s=c+1;continue e}}else if(e.slice(i-3,i)==="wss"||e.slice(i-2,i)==="ws"){const d=e.slice(i+4).match(i8),c=d?i+4+d.index:r,b=e[i-1]==="s"?3:2;try{let w=new URL(e.slice(i-b,c));if(w.hostname.indexOf(".")===-1)throw new Error("invalid ws url");n!==i-b&&(yield{type:"text",text:e.slice(n,i-b)}),yield{type:"relay",url:w.toString()},s=c,n=s;continue e}catch{s=c+1;continue e}}else{for(let d=0;d<t.length;d++){const c=t[d];if(e[i+c.shortcode.length+1]===":"&&e.slice(i+1,i+c.shortcode.length+1)===c.shortcode){n!==i&&(yield{type:"text",text:e.slice(n,i)}),yield c,s=i+c.shortcode.length+2,n=s;continue e}}s=i+1;continue e}}n!==r&&(yield{type:"text",text:e.slice(n)})}var bne={};Ut(bne,{channelCreateEvent:()=>xne,channelHideMessageEvent:()=>Ene,channelMessageEvent:()=>_ne,channelMetadataEvent:()=>Mne,channelMuteUserEvent:()=>Sne});var xne=(e,t)=>{let r;if(typeof e.content=="object")r=JSON.stringify(e.content);else if(typeof e.content=="string")r=e.content;else return;return Ui({kind:Xk,tags:[...e.tags??[]],content:r,created_at:e.created_at},t)},Mne=(e,t)=>{let r;if(typeof e.content=="object")r=JSON.stringify(e.content);else if(typeof e.content=="string")r=e.content;else return;return Ui({kind:Qk,tags:[["e",e.channel_create_event_id],...e.tags??[]],content:r,created_at:e.created_at},t)},_ne=(e,t)=>{const r=[["e",e.channel_create_event_id,e.relay_url,"root"]];return e.reply_to_channel_message_event_id&&r.push(["e",e.reply_to_channel_message_event_id,e.relay_url,"reply"]),Ui({kind:eB,tags:[...r,...e.tags??[]],content:e.content,created_at:e.created_at},t)},Ene=(e,t)=>{let r;if(typeof e.content=="object")r=JSON.stringify(e.content);else if(typeof e.content=="string")r=e.content;else return;return Ui({kind:tB,tags:[["e",e.channel_message_event_id],...e.tags??[]],content:r,created_at:e.created_at},t)},Sne=(e,t)=>{let r;if(typeof e.content=="object")r=JSON.stringify(e.content);else if(typeof e.content=="string")r=e.content;else return;return Ui({kind:rB,tags:[["p",e.pubkey_to_mute],...e.tags??[]],content:r,created_at:e.created_at},t)},Ane={};Ut(Ane,{EMOJI_SHORTCODE_REGEX:()=>IB,matchAll:()=>kne,regex:()=>Mb,replaceAll:()=>Bne});var IB=/:(\w+):/,Mb=()=>new RegExp(`\\B${IB.source}\\B`,"g");function*kne(e){const t=e.matchAll(Mb());for(const r of t)try{const[n,s]=r;yield{shortcode:n,name:s,start:r.index,end:r.index+n.length}}catch{}}function Bne(e,t){return e.replaceAll(Mb(),(r,n)=>t({shortcode:r,name:n}))}var Rne={};Ut(Rne,{useFetchImplementation:()=>$ne,validateGithub:()=>Nne});var _b;try{_b=fetch}catch{}function $ne(e){_b=e}async function Nne(e,t,r){try{return await(await _b(`https://gist.github.com/${t}/${r}/raw`)).text()===`Verifying that I control the following Nostr public key: ${e}`}catch{return!1}}var Tne={};Ut(Tne,{makeNwcRequestEvent:()=>Cne,parseConnectionString:()=>Ine});function Ine(e){const{host:t,pathname:r,searchParams:n}=new URL(e),s=r||t,i=n.get("relay"),u=n.get("secret");if(!s||!i||!u)throw new Error("invalid connection string");return{pubkey:s,relay:i,secret:u}}async function Cne(e,t,r){const s=dB(t,e,JSON.stringify({method:"pay_invoice",params:{invoice:r}})),i={kind:oB,created_at:Math.round(Date.now()/1e3),content:s,tags:[["p",e]]};return Ui(i,t)}var Pne={};Ut(Pne,{normalizeIdentifier:()=>Lne});function Lne(e){return e=e.trim().toLowerCase(),e=e.normalize("NFKC"),Array.from(e).map(t=>new RegExp("\\p{Letter}","u").test(t)||new RegExp("\\p{Number}","u").test(t)?t:"-").join("")}var One={};Ut(One,{getSatoshisAmountFromBolt11:()=>Hne,getZapEndpoint:()=>jne,makeZapReceipt:()=>Fne,makeZapRequest:()=>Dne,useFetchImplementation:()=>Une,validateZapRequest:()=>qne});var Eb;try{Eb=fetch}catch{}function Une(e){Eb=e}async function jne(e){try{let t="",{lud06:r,lud16:n}=JSON.parse(e.content);if(n){let[u,d]=n.split("@");t=new URL(`/.well-known/lnurlp/${u}`,`https://${d}`).toString()}else if(r){let{words:u}=fl.decode(r,1e3),d=fl.fromWords(u);t=fo.decode(d)}else return null;let i=await(await Eb(t)).json();if(i.allowsNostr&&i.nostrPubkey)return i.callback}catch{}return null}function Dne(e){let t={kind:9734,created_at:Math.round(Date.now()/1e3),content:e.comment||"",tags:[["p","pubkey"in e?e.pubkey:e.event.pubkey],["amount",e.amount.toString()],["relays",...e.relays]]};if("event"in e){if(t.tags.push(["e",e.event.id]),ab(e.event.kind)){const r=["a",`${e.event.kind}:${e.event.pubkey}:`];t.tags.push(r)}else if(fb(e.event.kind)){let r=e.event.tags.find(([s,i])=>s==="d"&&i);if(!r)throw new Error("d tag not found or is empty");const n=["a",`${e.event.kind}:${e.event.pubkey}:${r[1]}`];t.tags.push(n)}t.tags.push(["k",e.event.kind.toString()])}return t}function qne(e){let t;try{t=JSON.parse(e)}catch{return"Invalid zap request JSON."}if(!ib(t))return"Zap request is not a valid Nostr event.";if(!ba(t))return"Invalid signature on zap request.";let r=t.tags.find(([i,u])=>i==="p"&&u);if(!r)return"Zap request doesn't have a 'p' tag.";if(!r[1].match(/^[a-f0-9]{64}$/))return"Zap request 'p' tag is not valid hex.";let n=t.tags.find(([i,u])=>i==="e"&&u);return n&&!n[1].match(/^[a-f0-9]{64}$/)?"Zap request 'e' tag is not valid hex.":t.tags.find(([i,u])=>i==="relays"&&u)?null:"Zap request doesn't have a 'relays' tag."}function Fne({zapRequest:e,preimage:t,bolt11:r,paidAt:n}){let s=JSON.parse(e),i=s.tags.filter(([d])=>d==="e"||d==="p"||d==="a"),u={kind:9735,created_at:Math.round(n.getTime()/1e3),content:"",tags:[...i,["P",s.pubkey],["bolt11",r],["description",e]]};return t&&u.tags.push(["preimage",t]),u}function Hne(e){if(e.length<50)return 0;e=e.substring(0,50);const t=e.lastIndexOf("1");if(t===-1)return 0;const r=e.substring(0,t);if(!r.startsWith("lnbc"))return 0;const n=r.substring(4);if(n.length<1)return 0;const s=n[n.length-1],i=s.charCodeAt(0)-48,u=i>=0&&i<=9;let d=n.length-1;if(u&&d++,d<1)return 0;const c=parseInt(n.substring(0,d));switch(s){case"m":return c*1e5;case"u":return c*100;case"n":return c/10;case"p":return c/1e4;default:return c*1e8}}var zne={};Ut(zne,{Negentropy:()=>PB,NegentropyStorageVector:()=>Kne,NegentropySync:()=>Zne});var Dv=97,Cf=32,CB=16,Zs={Skip:0,Fingerprint:1,IdList:2},to=class{constructor(e){ie(this,"_raw");ie(this,"length");typeof e=="number"?(this._raw=new Uint8Array(e),this.length=0):e instanceof Uint8Array?(this._raw=new Uint8Array(e),this.length=e.length):(this._raw=new Uint8Array(512),this.length=0)}unwrap(){return this._raw.subarray(0,this.length)}get capacity(){return this._raw.byteLength}extend(e){if(e instanceof to&&(e=e.unwrap()),typeof e.length!="number")throw Error("bad length");const t=e.length+this.length;if(this.capacity<t){const r=this._raw,n=Math.max(this.capacity*2,t);this._raw=new Uint8Array(n),this._raw.set(r)}this._raw.set(e,this.length),this.length+=e.length}shift(){const e=this._raw[0];return this._raw=this._raw.subarray(1),this.length--,e}shiftN(e=1){const t=this._raw.subarray(0,e);return this._raw=this._raw.subarray(e),this.length-=e,t}};function tc(e){let t=0;for(;;){if(e.length===0)throw Error("parse ends prematurely");let r=e.shift();if(t=t<<7|r&127,!(r&128))break}return t}function Vi(e){if(e===0)return new to(new Uint8Array([0]));let t=[];for(;e!==0;)t.push(e&127),e>>>=7;t.reverse();for(let r=0;r<t.length-1;r++)t[r]|=128;return new to(new Uint8Array(t))}function Wne(e){return $c(e,1)[0]}function $c(e,t){if(e.length<t)throw Error("parse ends prematurely");return e.shiftN(t)}var Vne=class{constructor(){ie(this,"buf");this.setToZero()}setToZero(){this.buf=new Uint8Array(Cf)}add(e){let t=0,r=0,n=new DataView(this.buf.buffer),s=new DataView(e.buffer);for(let i=0;i<8;i++){let u=i*4,d=n.getUint32(u,!0),c=s.getUint32(u,!0),b=d;b+=t,b+=c,b>4294967295&&(r=1),n.setUint32(u,b&4294967295,!0),t=r,r=0}}negate(){let e=new DataView(this.buf.buffer);for(let r=0;r<8;r++){let n=r*4;e.setUint32(n,~e.getUint32(n,!0))}let t=new Uint8Array(Cf);t[0]=1,this.add(t)}getFingerprint(e){let t=new to;return t.extend(this.buf),t.extend(Vi(e)),js(t.unwrap()).subarray(0,CB)}},Kne=class{constructor(){ie(this,"items");ie(this,"sealed");this.items=[],this.sealed=!1}insert(e,t){if(this.sealed)throw Error("already sealed");const r=Tk(t);if(r.byteLength!==Cf)throw Error("bad id size for added item");this.items.push({timestamp:e,id:r})}seal(){if(this.sealed)throw Error("already sealed");this.sealed=!0,this.items.sort(qv);for(let e=1;e<this.items.length;e++)if(qv(this.items[e-1],this.items[e])===0)throw Error("duplicate item inserted")}unseal(){this.sealed=!1}size(){return this._checkSealed(),this.items.length}getItem(e){if(this._checkSealed(),e>=this.items.length)throw Error("out of range");return this.items[e]}iterate(e,t,r){this._checkSealed(),this._checkBounds(e,t);for(let n=e;n<t&&r(this.items[n],n);++n);}findLowerBound(e,t,r){return this._checkSealed(),this._checkBounds(e,t),this._binarySearch(this.items,e,t,n=>qv(n,r)<0)}fingerprint(e,t){let r=new Vne;return r.setToZero(),this.iterate(e,t,n=>(r.add(n.id),!0)),r.getFingerprint(t-e)}_checkSealed(){if(!this.sealed)throw Error("not sealed")}_checkBounds(e,t){if(e>t||t>this.items.length)throw Error("bad range")}_binarySearch(e,t,r,n){let s=r-t;for(;s>0;){let i=t,u=Math.floor(s/2);i+=u,n(e[i])?(t=++i,s-=u+1):s=u}return t}},PB=class{constructor(e,t=6e4){ie(this,"storage");ie(this,"frameSizeLimit");ie(this,"lastTimestampIn");ie(this,"lastTimestampOut");if(t<4096)throw Error("frameSizeLimit too small");this.storage=e,this.frameSizeLimit=t,this.lastTimestampIn=0,this.lastTimestampOut=0}_bound(e,t){return{timestamp:e,id:t||new Uint8Array(0)}}initiate(){let e=new to;return e.extend(new Uint8Array([Dv])),this.splitRange(0,this.storage.size(),this._bound(Number.MAX_VALUE),e),Qa(e.unwrap())}reconcile(e,t,r){const n=new to(Tk(e));this.lastTimestampIn=this.lastTimestampOut=0;let s=new to;s.extend(new Uint8Array([Dv]));let i=Wne(n);if(i<96||i>111)throw Error("invalid negentropy protocol version byte");if(i!==Dv)throw Error("unsupported negentropy protocol version requested: "+(i-96));let u=this.storage.size(),d=this._bound(0),c=0,b=!1;for(;n.length!==0;){let w=new to,M=()=>{b&&(b=!1,w.extend(this.encodeBound(d)),w.extend(Vi(Zs.Skip)))},_=this.decodeBound(n),A=tc(n),R=c,B=this.storage.findLowerBound(c,u,_);if(A===Zs.Skip)b=!0;else if(A===Zs.Fingerprint){let I=$c(n,CB),E=this.storage.fingerprint(R,B);LB(I,E)!==0?(M(),this.splitRange(R,B,_,w)):b=!0}else if(A===Zs.IdList){let I=tc(n),E={};for(let k=0;k<I;k++){let T=$c(n,Cf);E[Qa(T)]=T}if(b=!0,this.storage.iterate(R,B,k=>{let T=k.id;const L=Qa(T);return E[L]?delete E[Qa(T)]:t==null||t(L),!0}),r)for(let k of Object.values(E))r(Qa(k))}else throw Error("unexpected mode");if(this.exceededFrameSizeLimit(s.length+w.length)){let I=this.storage.fingerprint(B,u);s.extend(this.encodeBound(this._bound(Number.MAX_VALUE))),s.extend(Vi(Zs.Fingerprint)),s.extend(I);break}else s.extend(w);c=B,d=_}return s.length===1?null:Qa(s.unwrap())}splitRange(e,t,r,n){let s=t-e,i=16;if(s<i*2)n.extend(this.encodeBound(r)),n.extend(Vi(Zs.IdList)),n.extend(Vi(s)),this.storage.iterate(e,t,u=>(n.extend(u.id),!0));else{let u=Math.floor(s/i),d=s%i,c=e;for(let b=0;b<i;b++){let w=u+(b<d?1:0),M=this.storage.fingerprint(c,c+w);c+=w;let _;if(c===t)_=r;else{let A,R;this.storage.iterate(c-1,c+1,(B,I)=>(I===c-1?A=B:R=B,!0)),_=this.getMinimalBound(A,R)}n.extend(this.encodeBound(_)),n.extend(Vi(Zs.Fingerprint)),n.extend(M)}}}exceededFrameSizeLimit(e){return e>this.frameSizeLimit-200}decodeTimestampIn(e){let t=tc(e);return t=t===0?Number.MAX_VALUE:t-1,this.lastTimestampIn===Number.MAX_VALUE||t===Number.MAX_VALUE?(this.lastTimestampIn=Number.MAX_VALUE,Number.MAX_VALUE):(t+=this.lastTimestampIn,this.lastTimestampIn=t,t)}decodeBound(e){let t=this.decodeTimestampIn(e),r=tc(e);if(r>Cf)throw Error("bound key too long");let n=$c(e,r);return{timestamp:t,id:n}}encodeTimestampOut(e){if(e===Number.MAX_VALUE)return this.lastTimestampOut=Number.MAX_VALUE,Vi(0);let t=e;return e-=this.lastTimestampOut,this.lastTimestampOut=t,Vi(e+1)}encodeBound(e){let t=new to;return t.extend(this.encodeTimestampOut(e.timestamp)),t.extend(Vi(e.id.length)),t.extend(e.id),t}getMinimalBound(e,t){if(t.timestamp!==e.timestamp)return this._bound(t.timestamp);{let r=0,n=t.id,s=e.id;for(let i=0;i<Cf&&n[i]===s[i];i++)r++;return this._bound(t.timestamp,t.id.subarray(0,r+1))}}};function LB(e,t){for(let r=0;r<e.byteLength;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return e.byteLength>t.byteLength?1:e.byteLength<t.byteLength?-1:0}function qv(e,t){return e.timestamp===t.timestamp?LB(e.id,t.id):e.timestamp-t.timestamp}var Zne=class{constructor(e,t,r,n={}){ie(this,"relay");ie(this,"storage");ie(this,"neg");ie(this,"filter");ie(this,"subscription");ie(this,"onhave");ie(this,"onneed");this.relay=e,this.storage=t,this.neg=new PB(t),this.onhave=n.onhave,this.onneed=n.onneed,this.filter=r,this.subscription=this.relay.prepareSubscription([{}],{label:n.label||"negentropy"}),this.subscription.oncustom=s=>{var i,u,d,c;switch(s[0]){case"NEG-MSG":{s.length<3&&console.warn(`got invalid NEG-MSG from ${this.relay.url}: ${s}`);try{const b=this.neg.reconcile(s[2],this.onhave,this.onneed);b?this.relay.send(`["NEG-MSG", "${this.subscription.id}", "${b}"]`):(this.close(),(i=n.onclose)==null||i.call(n))}catch(b){console.error("negentropy reconcile error:",b),(u=n==null?void 0:n.onclose)==null||u.call(n,`reconcile error: ${b}`)}break}case"NEG-CLOSE":{const b=s[2];console.warn("negentropy error:",b),(d=n.onclose)==null||d.call(n,b);break}case"NEG-ERR":(c=n.onclose)==null||c.call(n)}}}async start(){const e=this.neg.initiate();this.relay.send(`["NEG-OPEN","${this.subscription.id}",${JSON.stringify(this.filter)},"${e}"]`)}close(){this.relay.send(`["NEG-CLOSE","${this.subscription.id}"]`),this.subscription.close()}},Gne={};Ut(Gne,{getToken:()=>Jne,hashPayload:()=>Sb,unpackEventFromToken:()=>UB,validateEvent:()=>zB,validateEventKind:()=>DB,validateEventMethodTag:()=>FB,validateEventPayloadTag:()=>HB,validateEventTimestamp:()=>jB,validateEventUrlTag:()=>qB,validateToken:()=>Yne});var OB="Nostr ";async function Jne(e,t,r,n=!1,s){const i={kind:cb,tags:[["u",e],["method",t]],created_at:Math.round(new Date().getTime()/1e3),content:""};s&&i.tags.push(["payload",Sb(s)]);const u=await r(i);return(n?OB:"")+Eo.encode(ei.encode(JSON.stringify(u)))}async function Yne(e,t,r){const n=await UB(e).catch(i=>{throw i});return await zB(n,t,r).catch(i=>{throw i})}async function UB(e){if(!e)throw new Error("Missing token");e=e.replace(OB,"");const t=fo.decode(Eo.decode(e));if(!t||t.length===0||!t.startsWith("{"))throw new Error("Invalid token");return JSON.parse(t)}function jB(e){return e.created_at?Math.round(new Date().getTime()/1e3)-e.created_at<60:!1}function DB(e){return e.kind===cb}function qB(e,t){const r=e.tags.find(n=>n[0]==="u");return r?r.length>0&&r[1]===t:!1}function FB(e,t){const r=e.tags.find(n=>n[0]==="method");return r?r.length>0&&r[1].toLowerCase()===t.toLowerCase():!1}function Sb(e){const t=js(ei.encode(JSON.stringify(e)));return rr(t)}function HB(e,t){const r=e.tags.find(s=>s[0]==="payload");if(!r)return!1;const n=Sb(t);return r.length>0&&r[1]===n}async function zB(e,t,r,n){if(!ba(e))throw new Error("Invalid nostr event, signature invalid");if(!DB(e))throw new Error("Invalid nostr event, kind invalid");if(!jB(e))throw new Error("Invalid nostr event, created_at timestamp invalid");if(!qB(e,t))throw new Error("Invalid nostr event, url tag invalid");if(!FB(e,r))throw new Error("Invalid nostr event, method tag invalid");if(n&&typeof n=="object"&&Object.keys(n).length>0&&!HB(e,n))throw new Error("Invalid nostr event, payload tag does not match request body hash");return!0}var Hi=class extends Error{constructor(e,t,r){super(t),this.code=e,r&&(this.cause=r)}},Xne=class{constructor(e,t={}){if(!Array.isArray(e))throw new Error("NCC02Resolver expects an array of relay URLs.");this.relays=e,this.pool=t.pool||new _re,this.ownsPool=!t.pool,this.trustedCAPubkeys=new Set(t.trustedCAPubkeys||[])}close(){this.ownsPool&&this.pool&&this.pool.close(this.relays)}async _query(e){return new Promise(t=>{const r=[],n=this.pool.subscribeMany(this.relays,[e],{onevent(s){r.push(s)},oneose(){n.close(),t(r)}})})}async resolve(e,t,r={}){const{requireAttestation:n=!1,minLevel:s=null,standard:i="nostr-service-trust-v0.1"}=r;let u;try{u=await this._query({kinds:[Pv.SERVICE_RECORD],authors:[e],"#d":[t]})}catch(_){throw new Hi("RELAY_ERROR",`Failed to query relay for ${t}`,_)}if(!u||!u.length)throw new Hi("NOT_FOUND",`No service record found for ${t}`);const d=u.sort((_,A)=>A.created_at!==_.created_at?A.created_at-_.created_at:_.id.localeCompare(A.id))[0];if(!ba(d))throw new Hi("INVALID_SIGNATURE","Service record signature verification failed");const c=Object.fromEntries(d.tags),b=Math.floor(Date.now()/1e3);if(!c.exp)throw new Hi("MALFORMED_RECORD","Service record is missing required tag (exp)");if(c.u&&(c.u.startsWith("wss://")||c.u.startsWith("https://"))&&!c.k)throw new Hi("MALFORMED_RECORD","Service record with 'https' or 'wss' endpoint must have a 'k' tag");const w=parseInt(c.exp);if(isNaN(w))throw new Hi("MALFORMED_RECORD","Service record expiry tag is not a valid number");if(w<b)throw new Hi("EXPIRED","Service record has expired");const M=[];if(n||s==="verified"||s==="hardened"){let _,A;try{[_,A]=await Promise.all([this._query({kinds:[Pv.ATTESTATION],"#e":[d.id]}),this._query({kinds:[Pv.REVOCATION]})])}catch(R){throw new Hi("RELAY_ERROR","Failed to query relay for attestations/revocations",R)}for(const R of _)if(this.trustedCAPubkeys.has(R.pubkey)){const B=Object.fromEntries(R.tags);if(B.subj!==e||B.srv!==t||i&&B.std!==i||s&&!this._isLevelSufficient(B.lvl,s))continue;this._isAttestationValid(R,B,A)&&M.push({pubkey:R.pubkey,level:B.lvl,eventId:R.id})}if(n&&M.length===0)throw new Hi("POLICY_FAILURE",`No trusted attestations meet the required policy for ${t}`)}return{endpoint:c.u,fingerprint:c.k,expiry:w,attestations:M,eventId:d.id,pubkey:d.pubkey}}_isLevelSufficient(e,t){const r={self:0,verified:1,hardened:2},n=e?r[e]??-1:-1,s=r[t]??0;return n>=s}_isAttestationValid(e,t,r){if(!ba(e))return!1;const n=Math.floor(Date.now()/1e3);if(t.nbf){const s=parseInt(t.nbf);if(isNaN(s)||s>n)return!1}if(t.exp){const s=parseInt(t.exp);if(isNaN(s)||s<n)return!1}for(const s of r)if(Object.fromEntries(s.tags).e===e.id&&s.pubkey===e.pubkey&&ba(s))return!1;return!0}verifyEndpoint(e,t){return e.fingerprint===t}};/*! Bundled license information:
62
-
63
- @noble/hashes/esm/utils.js:
64
- @noble/hashes/esm/utils.js:
65
- (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
66
-
67
- @noble/curves/esm/abstract/utils.js:
68
- @noble/curves/esm/abstract/modular.js:
69
- @noble/curves/esm/abstract/curve.js:
70
- @noble/curves/esm/abstract/weierstrass.js:
71
- @noble/curves/esm/_shortw_utils.js:
72
- @noble/curves/esm/secp256k1.js:
73
- (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
74
-
75
- @scure/base/lib/esm/index.js:
76
- (*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
77
-
78
- @noble/ciphers/esm/utils.js:
79
- (*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *)
80
- */const eu=["wss://relay.damus.io","wss://nos.lol","wss://relay.primal.net"],Dt={load(){const e=localStorage.getItem("ncc_bootstrap_relays");if(e===null)return eu;try{const t=JSON.parse(e);return Array.isArray(t)?t:eu}catch{return eu}},save(e){localStorage.setItem("ncc_bootstrap_relays",JSON.stringify(e))},add(e){const t=this.load();t.includes(e)||this.save([...t,e])},remove(e){const r=this.load().filter(n=>n!==e);this.save(r.length>0?r:eu)},restoreDefaults(){this.save(eu)}},WB=Pe.createContext(void 0);function Qne({children:e}){const t=Pe.useMemo(()=>{const r=Dt.load(),n=new Kq({pool:ss,bootstrapRelays:r}),s=new Zq({pool:ss,timeout:5e3}),i=new Xne(r,{pool:ss});return{ncc05Resolver:n,ncc05Publisher:s,ncc02Resolver:i,pool:ss}},[]);return V.jsx(WB.Provider,{value:t,children:e})}function qs(){const e=Pe.useContext(WB);if(!e)throw new Error("useNCC must be used within NCCProvider");return e}/**
81
- * @license lucide-react v0.344.0 - ISC
82
- *
83
- * This source code is licensed under the ISC license.
84
- * See the LICENSE file in the root directory of this source tree.
85
- */var eie={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
86
- * @license lucide-react v0.344.0 - ISC
87
- *
88
- * This source code is licensed under the ISC license.
89
- * See the LICENSE file in the root directory of this source tree.
90
- */const tie=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),ut=(e,t)=>{const r=Pe.forwardRef(({color:n="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:u,className:d="",children:c,...b},w)=>Pe.createElement("svg",{ref:w,...eie,width:s,height:s,stroke:n,strokeWidth:u?Number(i)*24/Number(s):i,className:["lucide",`lucide-${tie(e)}`,d].join(" "),...b},[...t.map(([M,_])=>Pe.createElement(M,_)),...Array.isArray(c)?c:[c]]));return r.displayName=`${e}`,r};/**
91
- * @license lucide-react v0.344.0 - ISC
92
- *
93
- * This source code is licensed under the ISC license.
94
- * See the LICENSE file in the root directory of this source tree.
95
- */const rie=ut("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
96
- * @license lucide-react v0.344.0 - ISC
97
- *
98
- * This source code is licensed under the ISC license.
99
- * See the LICENSE file in the root directory of this source tree.
100
- */const VB=ut("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
101
- * @license lucide-react v0.344.0 - ISC
102
- *
103
- * This source code is licensed under the ISC license.
104
- * See the LICENSE file in the root directory of this source tree.
105
- */const nie=ut("ArrowDownWideNarrow",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]]);/**
106
- * @license lucide-react v0.344.0 - ISC
107
- *
108
- * This source code is licensed under the ISC license.
109
- * See the LICENSE file in the root directory of this source tree.
110
- */const iie=ut("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
111
- * @license lucide-react v0.344.0 - ISC
112
- *
113
- * This source code is licensed under the ISC license.
114
- * See the LICENSE file in the root directory of this source tree.
115
- */const oie=ut("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
116
- * @license lucide-react v0.344.0 - ISC
117
- *
118
- * This source code is licensed under the ISC license.
119
- * See the LICENSE file in the root directory of this source tree.
120
- */const sie=ut("BadgeCheck",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
121
- * @license lucide-react v0.344.0 - ISC
122
- *
123
- * This source code is licensed under the ISC license.
124
- * See the LICENSE file in the root directory of this source tree.
125
- */const aie=ut("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
126
- * @license lucide-react v0.344.0 - ISC
127
- *
128
- * This source code is licensed under the ISC license.
129
- * See the LICENSE file in the root directory of this source tree.
130
- */const fie=ut("CheckCircle",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
131
- * @license lucide-react v0.344.0 - ISC
132
- *
133
- * This source code is licensed under the ISC license.
134
- * See the LICENSE file in the root directory of this source tree.
135
- */const o8=ut("Cpu",[["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"9",y:"9",width:"6",height:"6",key:"o3kz5p"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
136
- * @license lucide-react v0.344.0 - ISC
137
- *
138
- * This source code is licensed under the ISC license.
139
- * See the LICENSE file in the root directory of this source tree.
140
- */const lie=ut("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
141
- * @license lucide-react v0.344.0 - ISC
142
- *
143
- * This source code is licensed under the ISC license.
144
- * See the LICENSE file in the root directory of this source tree.
145
- */const uie=ut("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
146
- * @license lucide-react v0.344.0 - ISC
147
- *
148
- * This source code is licensed under the ISC license.
149
- * See the LICENSE file in the root directory of this source tree.
150
- */const hie=ut("KeyRound",[["path",{d:"M2 18v3c0 .6.4 1 1 1h4v-3h3v-3h2l1.4-1.4a6.5 6.5 0 1 0-4-4Z",key:"167ctg"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
151
- * @license lucide-react v0.344.0 - ISC
152
- *
153
- * This source code is licensed under the ISC license.
154
- * See the LICENSE file in the root directory of this source tree.
155
- */const cie=ut("Key",[["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["path",{d:"m15.5 7.5 3 3L22 7l-3-3",key:"1rn1fs"}]]);/**
156
- * @license lucide-react v0.344.0 - ISC
157
- *
158
- * This source code is licensed under the ISC license.
159
- * See the LICENSE file in the root directory of this source tree.
160
- */const die=ut("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
161
- * @license lucide-react v0.344.0 - ISC
162
- *
163
- * This source code is licensed under the ISC license.
164
- * See the LICENSE file in the root directory of this source tree.
165
- */const pie=ut("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
166
- * @license lucide-react v0.344.0 - ISC
167
- *
168
- * This source code is licensed under the ISC license.
169
- * See the LICENSE file in the root directory of this source tree.
170
- */const vie=ut("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/**
171
- * @license lucide-react v0.344.0 - ISC
172
- *
173
- * This source code is licensed under the ISC license.
174
- * See the LICENSE file in the root directory of this source tree.
175
- */const Zy=ut("Package",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
176
- * @license lucide-react v0.344.0 - ISC
177
- *
178
- * This source code is licensed under the ISC license.
179
- * See the LICENSE file in the root directory of this source tree.
180
- */const KB=ut("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
181
- * @license lucide-react v0.344.0 - ISC
182
- *
183
- * This source code is licensed under the ISC license.
184
- * See the LICENSE file in the root directory of this source tree.
185
- */const ZB=ut("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/**
186
- * @license lucide-react v0.344.0 - ISC
187
- *
188
- * This source code is licensed under the ISC license.
189
- * See the LICENSE file in the root directory of this source tree.
190
- */const xa=ut("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
191
- * @license lucide-react v0.344.0 - ISC
192
- *
193
- * This source code is licensed under the ISC license.
194
- * See the LICENSE file in the root directory of this source tree.
195
- */const gie=ut("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);/**
196
- * @license lucide-react v0.344.0 - ISC
197
- *
198
- * This source code is licensed under the ISC license.
199
- * See the LICENSE file in the root directory of this source tree.
200
- */const yie=ut("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
201
- * @license lucide-react v0.344.0 - ISC
202
- *
203
- * This source code is licensed under the ISC license.
204
- * See the LICENSE file in the root directory of this source tree.
205
- */const mie=ut("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
206
- * @license lucide-react v0.344.0 - ISC
207
- *
208
- * This source code is licensed under the ISC license.
209
- * See the LICENSE file in the root directory of this source tree.
210
- */const Gy=ut("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
211
- * @license lucide-react v0.344.0 - ISC
212
- *
213
- * This source code is licensed under the ISC license.
214
- * See the LICENSE file in the root directory of this source tree.
215
- */const GB=ut("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
216
- * @license lucide-react v0.344.0 - ISC
217
- *
218
- * This source code is licensed under the ISC license.
219
- * See the LICENSE file in the root directory of this source tree.
220
- */const JB=ut("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
221
- * @license lucide-react v0.344.0 - ISC
222
- *
223
- * This source code is licensed under the ISC license.
224
- * See the LICENSE file in the root directory of this source tree.
225
- */const wie=ut("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
226
- * @license lucide-react v0.344.0 - ISC
227
- *
228
- * This source code is licensed under the ISC license.
229
- * See the LICENSE file in the root directory of this source tree.
230
- */const bie=ut("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
231
- * @license lucide-react v0.344.0 - ISC
232
- *
233
- * This source code is licensed under the ISC license.
234
- * See the LICENSE file in the root directory of this source tree.
235
- */const xie=ut("Wallet",[["path",{d:"M21 12V7H5a2 2 0 0 1 0-4h14v4",key:"195gfw"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h16v-5",key:"195n9w"}],["path",{d:"M18 12a2 2 0 0 0 0 4h4v-4Z",key:"vllfpd"}]]);/**
236
- * @license lucide-react v0.344.0 - ISC
237
- *
238
- * This source code is licensed under the ISC license.
239
- * See the LICENSE file in the root directory of this source tree.
240
- */const Mie=ut("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var _ie=Object.defineProperty,$0=Object.getOwnPropertySymbols,YB=Object.prototype.hasOwnProperty,XB=Object.prototype.propertyIsEnumerable,s8=(e,t,r)=>t in e?_ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Jy=(e,t)=>{for(var r in t||(t={}))YB.call(t,r)&&s8(e,r,t[r]);if($0)for(var r of $0(t))XB.call(t,r)&&s8(e,r,t[r]);return e},Yy=(e,t)=>{var r={};for(var n in e)YB.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&$0)for(var n of $0(e))t.indexOf(n)<0&&XB.call(e,n)&&(r[n]=e[n]);return r};/**
241
- * @license QR Code generator library (TypeScript)
242
- * Copyright (c) Project Nayuki.
243
- * SPDX-License-Identifier: MIT
244
- */var Oa;(e=>{const t=class rt{constructor(c,b,w,M){if(this.version=c,this.errorCorrectionLevel=b,this.modules=[],this.isFunction=[],c<rt.MIN_VERSION||c>rt.MAX_VERSION)throw new RangeError("Version value out of range");if(M<-1||M>7)throw new RangeError("Mask value out of range");this.size=c*4+17;let _=[];for(let R=0;R<this.size;R++)_.push(!1);for(let R=0;R<this.size;R++)this.modules.push(_.slice()),this.isFunction.push(_.slice());this.drawFunctionPatterns();const A=this.addEccAndInterleave(w);if(this.drawCodewords(A),M==-1){let R=1e9;for(let B=0;B<8;B++){this.applyMask(B),this.drawFormatBits(B);const I=this.getPenaltyScore();I<R&&(M=B,R=I),this.applyMask(B)}}s(0<=M&&M<=7),this.mask=M,this.applyMask(M),this.drawFormatBits(M),this.isFunction=[]}static encodeText(c,b){const w=e.QrSegment.makeSegments(c);return rt.encodeSegments(w,b)}static encodeBinary(c,b){const w=e.QrSegment.makeBytes(c);return rt.encodeSegments([w],b)}static encodeSegments(c,b,w=1,M=40,_=-1,A=!0){if(!(rt.MIN_VERSION<=w&&w<=M&&M<=rt.MAX_VERSION)||_<-1||_>7)throw new RangeError("Invalid value");let R,B;for(R=w;;R++){const T=rt.getNumDataCodewords(R,b)*8,L=u.getTotalBits(c,R);if(L<=T){B=L;break}if(R>=M)throw new RangeError("Data too long")}for(const T of[rt.Ecc.MEDIUM,rt.Ecc.QUARTILE,rt.Ecc.HIGH])A&&B<=rt.getNumDataCodewords(R,T)*8&&(b=T);let I=[];for(const T of c){r(T.mode.modeBits,4,I),r(T.numChars,T.mode.numCharCountBits(R),I);for(const L of T.getData())I.push(L)}s(I.length==B);const E=rt.getNumDataCodewords(R,b)*8;s(I.length<=E),r(0,Math.min(4,E-I.length),I),r(0,(8-I.length%8)%8,I),s(I.length%8==0);for(let T=236;I.length<E;T^=253)r(T,8,I);let k=[];for(;k.length*8<I.length;)k.push(0);return I.forEach((T,L)=>k[L>>>3]|=T<<7-(L&7)),new rt(R,b,k,_)}getModule(c,b){return 0<=c&&c<this.size&&0<=b&&b<this.size&&this.modules[b][c]}getModules(){return this.modules}drawFunctionPatterns(){for(let w=0;w<this.size;w++)this.setFunctionModule(6,w,w%2==0),this.setFunctionModule(w,6,w%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const c=this.getAlignmentPatternPositions(),b=c.length;for(let w=0;w<b;w++)for(let M=0;M<b;M++)w==0&&M==0||w==0&&M==b-1||w==b-1&&M==0||this.drawAlignmentPattern(c[w],c[M]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(c){const b=this.errorCorrectionLevel.formatBits<<3|c;let w=b;for(let _=0;_<10;_++)w=w<<1^(w>>>9)*1335;const M=(b<<10|w)^21522;s(M>>>15==0);for(let _=0;_<=5;_++)this.setFunctionModule(8,_,n(M,_));this.setFunctionModule(8,7,n(M,6)),this.setFunctionModule(8,8,n(M,7)),this.setFunctionModule(7,8,n(M,8));for(let _=9;_<15;_++)this.setFunctionModule(14-_,8,n(M,_));for(let _=0;_<8;_++)this.setFunctionModule(this.size-1-_,8,n(M,_));for(let _=8;_<15;_++)this.setFunctionModule(8,this.size-15+_,n(M,_));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let c=this.version;for(let w=0;w<12;w++)c=c<<1^(c>>>11)*7973;const b=this.version<<12|c;s(b>>>18==0);for(let w=0;w<18;w++){const M=n(b,w),_=this.size-11+w%3,A=Math.floor(w/3);this.setFunctionModule(_,A,M),this.setFunctionModule(A,_,M)}}drawFinderPattern(c,b){for(let w=-4;w<=4;w++)for(let M=-4;M<=4;M++){const _=Math.max(Math.abs(M),Math.abs(w)),A=c+M,R=b+w;0<=A&&A<this.size&&0<=R&&R<this.size&&this.setFunctionModule(A,R,_!=2&&_!=4)}}drawAlignmentPattern(c,b){for(let w=-2;w<=2;w++)for(let M=-2;M<=2;M++)this.setFunctionModule(c+M,b+w,Math.max(Math.abs(M),Math.abs(w))!=1)}setFunctionModule(c,b,w){this.modules[b][c]=w,this.isFunction[b][c]=!0}addEccAndInterleave(c){const b=this.version,w=this.errorCorrectionLevel;if(c.length!=rt.getNumDataCodewords(b,w))throw new RangeError("Invalid argument");const M=rt.NUM_ERROR_CORRECTION_BLOCKS[w.ordinal][b],_=rt.ECC_CODEWORDS_PER_BLOCK[w.ordinal][b],A=Math.floor(rt.getNumRawDataModules(b)/8),R=M-A%M,B=Math.floor(A/M);let I=[];const E=rt.reedSolomonComputeDivisor(_);for(let T=0,L=0;T<M;T++){let q=c.slice(L,L+B-_+(T<R?0:1));L+=q.length;const z=rt.reedSolomonComputeRemainder(q,E);T<R&&q.push(0),I.push(q.concat(z))}let k=[];for(let T=0;T<I[0].length;T++)I.forEach((L,q)=>{(T!=B-_||q>=R)&&k.push(L[T])});return s(k.length==A),k}drawCodewords(c){if(c.length!=Math.floor(rt.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let b=0;for(let w=this.size-1;w>=1;w-=2){w==6&&(w=5);for(let M=0;M<this.size;M++)for(let _=0;_<2;_++){const A=w-_,B=(w+1&2)==0?this.size-1-M:M;!this.isFunction[B][A]&&b<c.length*8&&(this.modules[B][A]=n(c[b>>>3],7-(b&7)),b++)}}s(b==c.length*8)}applyMask(c){if(c<0||c>7)throw new RangeError("Mask value out of range");for(let b=0;b<this.size;b++)for(let w=0;w<this.size;w++){let M;switch(c){case 0:M=(w+b)%2==0;break;case 1:M=b%2==0;break;case 2:M=w%3==0;break;case 3:M=(w+b)%3==0;break;case 4:M=(Math.floor(w/3)+Math.floor(b/2))%2==0;break;case 5:M=w*b%2+w*b%3==0;break;case 6:M=(w*b%2+w*b%3)%2==0;break;case 7:M=((w+b)%2+w*b%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[b][w]&&M&&(this.modules[b][w]=!this.modules[b][w])}}getPenaltyScore(){let c=0;for(let _=0;_<this.size;_++){let A=!1,R=0,B=[0,0,0,0,0,0,0];for(let I=0;I<this.size;I++)this.modules[_][I]==A?(R++,R==5?c+=rt.PENALTY_N1:R>5&&c++):(this.finderPenaltyAddHistory(R,B),A||(c+=this.finderPenaltyCountPatterns(B)*rt.PENALTY_N3),A=this.modules[_][I],R=1);c+=this.finderPenaltyTerminateAndCount(A,R,B)*rt.PENALTY_N3}for(let _=0;_<this.size;_++){let A=!1,R=0,B=[0,0,0,0,0,0,0];for(let I=0;I<this.size;I++)this.modules[I][_]==A?(R++,R==5?c+=rt.PENALTY_N1:R>5&&c++):(this.finderPenaltyAddHistory(R,B),A||(c+=this.finderPenaltyCountPatterns(B)*rt.PENALTY_N3),A=this.modules[I][_],R=1);c+=this.finderPenaltyTerminateAndCount(A,R,B)*rt.PENALTY_N3}for(let _=0;_<this.size-1;_++)for(let A=0;A<this.size-1;A++){const R=this.modules[_][A];R==this.modules[_][A+1]&&R==this.modules[_+1][A]&&R==this.modules[_+1][A+1]&&(c+=rt.PENALTY_N2)}let b=0;for(const _ of this.modules)b=_.reduce((A,R)=>A+(R?1:0),b);const w=this.size*this.size,M=Math.ceil(Math.abs(b*20-w*10)/w)-1;return s(0<=M&&M<=9),c+=M*rt.PENALTY_N4,s(0<=c&&c<=2568888),c}getAlignmentPatternPositions(){if(this.version==1)return[];{const c=Math.floor(this.version/7)+2,b=this.version==32?26:Math.ceil((this.version*4+4)/(c*2-2))*2;let w=[6];for(let M=this.size-7;w.length<c;M-=b)w.splice(1,0,M);return w}}static getNumRawDataModules(c){if(c<rt.MIN_VERSION||c>rt.MAX_VERSION)throw new RangeError("Version number out of range");let b=(16*c+128)*c+64;if(c>=2){const w=Math.floor(c/7)+2;b-=(25*w-10)*w-55,c>=7&&(b-=36)}return s(208<=b&&b<=29648),b}static getNumDataCodewords(c,b){return Math.floor(rt.getNumRawDataModules(c)/8)-rt.ECC_CODEWORDS_PER_BLOCK[b.ordinal][c]*rt.NUM_ERROR_CORRECTION_BLOCKS[b.ordinal][c]}static reedSolomonComputeDivisor(c){if(c<1||c>255)throw new RangeError("Degree out of range");let b=[];for(let M=0;M<c-1;M++)b.push(0);b.push(1);let w=1;for(let M=0;M<c;M++){for(let _=0;_<b.length;_++)b[_]=rt.reedSolomonMultiply(b[_],w),_+1<b.length&&(b[_]^=b[_+1]);w=rt.reedSolomonMultiply(w,2)}return b}static reedSolomonComputeRemainder(c,b){let w=b.map(M=>0);for(const M of c){const _=M^w.shift();w.push(0),b.forEach((A,R)=>w[R]^=rt.reedSolomonMultiply(A,_))}return w}static reedSolomonMultiply(c,b){if(c>>>8||b>>>8)throw new RangeError("Byte out of range");let w=0;for(let M=7;M>=0;M--)w=w<<1^(w>>>7)*285,w^=(b>>>M&1)*c;return s(w>>>8==0),w}finderPenaltyCountPatterns(c){const b=c[1];s(b<=this.size*3);const w=b>0&&c[2]==b&&c[3]==b*3&&c[4]==b&&c[5]==b;return(w&&c[0]>=b*4&&c[6]>=b?1:0)+(w&&c[6]>=b*4&&c[0]>=b?1:0)}finderPenaltyTerminateAndCount(c,b,w){return c&&(this.finderPenaltyAddHistory(b,w),b=0),b+=this.size,this.finderPenaltyAddHistory(b,w),this.finderPenaltyCountPatterns(w)}finderPenaltyAddHistory(c,b){b[0]==0&&(c+=this.size),b.pop(),b.unshift(c)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function r(d,c,b){if(c<0||c>31||d>>>c)throw new RangeError("Value out of range");for(let w=c-1;w>=0;w--)b.push(d>>>w&1)}function n(d,c){return(d>>>c&1)!=0}function s(d){if(!d)throw new Error("Assertion error")}const i=class zt{constructor(c,b,w){if(this.mode=c,this.numChars=b,this.bitData=w,b<0)throw new RangeError("Invalid argument");this.bitData=w.slice()}static makeBytes(c){let b=[];for(const w of c)r(w,8,b);return new zt(zt.Mode.BYTE,c.length,b)}static makeNumeric(c){if(!zt.isNumeric(c))throw new RangeError("String contains non-numeric characters");let b=[];for(let w=0;w<c.length;){const M=Math.min(c.length-w,3);r(parseInt(c.substring(w,w+M),10),M*3+1,b),w+=M}return new zt(zt.Mode.NUMERIC,c.length,b)}static makeAlphanumeric(c){if(!zt.isAlphanumeric(c))throw new RangeError("String contains unencodable characters in alphanumeric mode");let b=[],w;for(w=0;w+2<=c.length;w+=2){let M=zt.ALPHANUMERIC_CHARSET.indexOf(c.charAt(w))*45;M+=zt.ALPHANUMERIC_CHARSET.indexOf(c.charAt(w+1)),r(M,11,b)}return w<c.length&&r(zt.ALPHANUMERIC_CHARSET.indexOf(c.charAt(w)),6,b),new zt(zt.Mode.ALPHANUMERIC,c.length,b)}static makeSegments(c){return c==""?[]:zt.isNumeric(c)?[zt.makeNumeric(c)]:zt.isAlphanumeric(c)?[zt.makeAlphanumeric(c)]:[zt.makeBytes(zt.toUtf8ByteArray(c))]}static makeEci(c){let b=[];if(c<0)throw new RangeError("ECI assignment value out of range");if(c<128)r(c,8,b);else if(c<16384)r(2,2,b),r(c,14,b);else if(c<1e6)r(6,3,b),r(c,21,b);else throw new RangeError("ECI assignment value out of range");return new zt(zt.Mode.ECI,0,b)}static isNumeric(c){return zt.NUMERIC_REGEX.test(c)}static isAlphanumeric(c){return zt.ALPHANUMERIC_REGEX.test(c)}getData(){return this.bitData.slice()}static getTotalBits(c,b){let w=0;for(const M of c){const _=M.mode.numCharCountBits(b);if(M.numChars>=1<<_)return 1/0;w+=4+_+M.bitData.length}return w}static toUtf8ByteArray(c){c=encodeURI(c);let b=[];for(let w=0;w<c.length;w++)c.charAt(w)!="%"?b.push(c.charCodeAt(w)):(b.push(parseInt(c.substring(w+1,w+3),16)),w+=2);return b}};i.NUMERIC_REGEX=/^[0-9]*$/,i.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,i.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let u=i;e.QrSegment=i})(Oa||(Oa={}));(e=>{(t=>{const r=class{constructor(s,i){this.ordinal=s,this.formatBits=i}};r.LOW=new r(0,1),r.MEDIUM=new r(1,0),r.QUARTILE=new r(2,3),r.HIGH=new r(3,2),t.Ecc=r})(e.QrCode||(e.QrCode={}))})(Oa||(Oa={}));(e=>{(t=>{const r=class{constructor(s,i){this.modeBits=s,this.numBitsCharCount=i}numCharCountBits(s){return this.numBitsCharCount[Math.floor((s+7)/17)]}};r.NUMERIC=new r(1,[10,12,14]),r.ALPHANUMERIC=new r(2,[9,11,13]),r.BYTE=new r(4,[8,16,16]),r.KANJI=new r(8,[8,10,12]),r.ECI=new r(7,[0,0,0]),t.Mode=r})(e.QrSegment||(e.QrSegment={}))})(Oa||(Oa={}));var bf=Oa;/**
245
- * @license qrcode.react
246
- * Copyright (c) Paul O'Shannessy
247
- * SPDX-License-Identifier: ISC
248
- */var Eie={L:bf.QrCode.Ecc.LOW,M:bf.QrCode.Ecc.MEDIUM,Q:bf.QrCode.Ecc.QUARTILE,H:bf.QrCode.Ecc.HIGH},QB=128,eR="L",tR="#FFFFFF",rR="#000000",nR=!1,iR=1,Sie=4,Aie=0,kie=.1;function oR(e,t=0){const r=[];return e.forEach(function(n,s){let i=null;n.forEach(function(u,d){if(!u&&i!==null){r.push(`M${i+t} ${s+t}h${d-i}v1H${i+t}z`),i=null;return}if(d===n.length-1){if(!u)return;i===null?r.push(`M${d+t},${s+t} h1v1H${d+t}z`):r.push(`M${i+t},${s+t} h${d+1-i}v1H${i+t}z`);return}u&&i===null&&(i=d)})}),r.join("")}function sR(e,t){return e.slice().map((r,n)=>n<t.y||n>=t.y+t.h?r:r.map((s,i)=>i<t.x||i>=t.x+t.w?s:!1))}function Bie(e,t,r,n){if(n==null)return null;const s=e.length+r*2,i=Math.floor(t*kie),u=s/t,d=(n.width||i)*u,c=(n.height||i)*u,b=n.x==null?e.length/2-d/2:n.x*u,w=n.y==null?e.length/2-c/2:n.y*u,M=n.opacity==null?1:n.opacity;let _=null;if(n.excavate){let R=Math.floor(b),B=Math.floor(w),I=Math.ceil(d+b-R),E=Math.ceil(c+w-B);_={x:R,y:B,w:I,h:E}}const A=n.crossOrigin;return{x:b,y:w,h:c,w:d,excavation:_,opacity:M,crossOrigin:A}}function Rie(e,t){return t!=null?Math.max(Math.floor(t),0):e?Sie:Aie}function aR({value:e,level:t,minVersion:r,includeMargin:n,marginSize:s,imageSettings:i,size:u,boostLevel:d}){let c=tr.useMemo(()=>{const R=(Array.isArray(e)?e:[e]).reduce((B,I)=>(B.push(...bf.QrSegment.makeSegments(I)),B),[]);return bf.QrCode.encodeSegments(R,Eie[t],r,void 0,void 0,d)},[e,t,r,d]);const{cells:b,margin:w,numCells:M,calculatedImageSettings:_}=tr.useMemo(()=>{let A=c.getModules();const R=Rie(n,s),B=A.length+R*2,I=Bie(A,u,R,i);return{cells:A,margin:R,numCells:B,calculatedImageSettings:I}},[c,u,i,n,s]);return{qrcode:c,margin:w,cells:b,numCells:M,calculatedImageSettings:_}}var $ie=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),fR=tr.forwardRef(function(t,r){const n=t,{value:s,size:i=QB,level:u=eR,bgColor:d=tR,fgColor:c=rR,includeMargin:b=nR,minVersion:w=iR,boostLevel:M,marginSize:_,imageSettings:A}=n,B=Yy(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:I}=B,E=Yy(B,["style"]),k=A==null?void 0:A.src,T=tr.useRef(null),L=tr.useRef(null),q=tr.useCallback(l=>{T.current=l,typeof r=="function"?r(l):r&&(r.current=l)},[r]),[z,J]=tr.useState(!1),{margin:F,cells:X,numCells:ee,calculatedImageSettings:x}=aR({value:s,level:u,minVersion:w,boostLevel:M,includeMargin:b,marginSize:_,imageSettings:A,size:i});tr.useEffect(()=>{if(T.current!=null){const l=T.current,h=l.getContext("2d");if(!h)return;let v=X;const y=L.current,m=x!=null&&y!==null&&y.complete&&y.naturalHeight!==0&&y.naturalWidth!==0;m&&x.excavation!=null&&(v=sR(X,x.excavation));const p=window.devicePixelRatio||1;l.height=l.width=i*p;const a=i/ee*p;h.scale(a,a),h.fillStyle=d,h.fillRect(0,0,ee,ee),h.fillStyle=c,$ie?h.fill(new Path2D(oR(v,F))):X.forEach(function(g,S){g.forEach(function(N,U){N&&h.fillRect(U+F,S+F,1,1)})}),x&&(h.globalAlpha=x.opacity),m&&h.drawImage(y,x.x+F,x.y+F,x.w,x.h)}}),tr.useEffect(()=>{J(!1)},[k]);const o=Jy({height:i,width:i},I);let f=null;return k!=null&&(f=tr.createElement("img",{src:k,key:k,style:{display:"none"},onLoad:()=>{J(!0)},ref:L,crossOrigin:x==null?void 0:x.crossOrigin})),tr.createElement(tr.Fragment,null,tr.createElement("canvas",Jy({style:o,height:i,width:i,ref:q,role:"img"},E)),f)});fR.displayName="QRCodeCanvas";var Nie=tr.forwardRef(function(t,r){const n=t,{value:s,size:i=QB,level:u=eR,bgColor:d=tR,fgColor:c=rR,includeMargin:b=nR,minVersion:w=iR,boostLevel:M,title:_,marginSize:A,imageSettings:R}=n,B=Yy(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:I,cells:E,numCells:k,calculatedImageSettings:T}=aR({value:s,level:u,minVersion:w,boostLevel:M,includeMargin:b,marginSize:A,imageSettings:R,size:i});let L=E,q=null;R!=null&&T!=null&&(T.excavation!=null&&(L=sR(E,T.excavation)),q=tr.createElement("image",{href:R.src,height:T.h,width:T.w,x:T.x+I,y:T.y+I,preserveAspectRatio:"none",opacity:T.opacity,crossOrigin:T.crossOrigin}));const z=oR(L,I);return tr.createElement("svg",Jy({height:i,width:i,viewBox:`0 0 ${k} ${k}`,ref:r,role:"img"},B),!!_&&tr.createElement("title",null,_),tr.createElement("path",{fill:d,d:`M0,0 h${k}v${k}H0z`,shapeRendering:"crispEdges"}),tr.createElement("path",{fill:c,d:z,shapeRendering:"crispEdges"}),q)});Nie.displayName="QRCodeSVG";function Tie(){const{loginWithNip07:e,loginWithNsec:t,loginReadOnly:r,loginWithNip46:n,isLoading:s}=Ts(),{pool:i}=qs(),[u,d]=Pe.useState(""),[c,b]=Pe.useState("options"),[w,M]=Pe.useState(""),[_,A]=Pe.useState("generate"),R=Pe.useRef(null),B=k=>Array.from(k).map(T=>T.toString(16).padStart(2,"0")).join(""),I=()=>{const k=a_(),T=uo(k),L=Dt.load()[0]||"wss://relay.damus.io",q=encodeURIComponent(JSON.stringify({name:"NCC Client PoC"})),z=`nostrconnect://${T}?relay=${encodeURIComponent(L)}&metadata=${q}`;M(z),A("wait"),E(T,L,k)},E=(k,T,L)=>{R.current&&R.current.close(),console.log("[NIP-46] Listening for responses on",T),R.current=i.subscribeMany([T],[{kinds:[24133],"#p":[k]}],{onevent(q){try{const z=Hr.getConversationKey(L,q.pubkey),J=Hr.decrypt(q.content,z),F=JSON.parse(J);(F.result==="ack"||F.method==="connect")&&(console.log("[NIP-46] Connection Established with",q.pubkey),n(q.pubkey,T,B(L)))}catch(z){console.error("[NIP-46] Decryption failed (might be NIP-04, not supported yet in this PoC)",z)}}})};return Pe.useEffect(()=>()=>{R.current&&R.current.close()},[]),s?V.jsx("div",{className:"loading loading-spinner loading-lg"}):V.jsx("div",{className:"card w-96 bg-base-100 shadow-xl border border-base-300",children:V.jsxs("div",{className:"card-body p-6",children:[V.jsx("h2",{className:"card-title justify-center mb-6 font-bold text-xl",children:"NCC Login"}),c==="options"&&V.jsxs("div",{className:"flex flex-col gap-3",children:[V.jsxs("button",{className:"btn btn-primary w-full shadow-md",onClick:()=>e(),children:[V.jsx(xie,{className:"w-4 h-4 mr-2"}),"Extension (NIP-07)"]}),V.jsxs("button",{className:"btn btn-secondary w-full shadow-md",onClick:()=>b("nip46"),children:[V.jsx(o8,{className:"w-4 h-4 mr-2"}),"Nostr Connect (NIP-46)"]}),V.jsx("div",{className:"divider text-[10px] opacity-30 uppercase tracking-widest",children:"Legacy / Read Only"}),V.jsxs("button",{className:"btn btn-neutral btn-sm w-full",onClick:()=>b("nsec"),children:[V.jsx(hie,{className:"w-4 h-4 mr-2"}),"Private Key (nsec)"]}),V.jsxs("button",{className:"btn btn-ghost btn-sm w-full opacity-60",onClick:()=>b("readonly"),children:[V.jsx(lie,{className:"w-4 h-4 mr-2"}),"Read Only (Watch)"]})]}),c==="nip46"&&V.jsxs("div",{className:"flex flex-col items-center gap-4 fade-in text-center",children:[_==="generate"?V.jsxs(V.Fragment,{children:[V.jsx(o8,{className:"w-12 h-12 text-secondary mb-2"}),V.jsx("h3",{className:"font-bold",children:"Connect Remotely"}),V.jsx("p",{className:"text-xs opacity-60 px-4",children:"Sign events using a mobile app (Amber, etc.) or a dedicated Bunker."}),V.jsx("button",{className:"btn btn-secondary w-full mt-4",onClick:I,children:"Generate Connection QR"})]}):V.jsxs("div",{className:"space-y-4",children:[V.jsx("div",{className:"bg-white p-4 rounded-xl shadow-inner border-4 border-base-200 inline-block",children:V.jsx(fR,{value:w,size:200})}),V.jsxs("div",{className:"flex flex-col gap-1 items-center",children:[V.jsxs("div",{className:"flex items-center gap-2 text-primary font-bold animate-pulse",children:[V.jsx(xa,{className:"w-3 h-3 animate-spin"}),V.jsx("span",{className:"text-xs",children:"Waiting for signer..."})]}),V.jsx("p",{className:"text-[10px] opacity-50 px-6",children:"Scan this QR with your Nostr signing app. Once scanned, the connection will be established automatically."})]}),V.jsx("button",{className:"btn btn-ghost btn-xs opacity-50",onClick:()=>{var k;A("generate"),(k=R.current)==null||k.close()},children:"Reset Connection"})]}),V.jsx("button",{className:"btn btn-ghost btn-sm w-full mt-2",onClick:()=>b("options"),children:"Back to Login Options"})]}),(c==="nsec"||c==="readonly")&&V.jsxs("div",{className:"flex flex-col gap-3 fade-in",children:[V.jsxs("div",{className:"form-control",children:[V.jsx("label",{className:"label text-xs uppercase opacity-50 font-bold",children:V.jsx("span",{className:"label-text",children:c==="nsec"?"Enter nsec / hex private key":"Enter npub / hex public key"})}),V.jsx("input",{type:"password",placeholder:c==="nsec"?"nsec1...":"npub1...",className:"input input-bordered w-full font-mono text-xs",value:u,onChange:k=>d(k.target.value)})]}),V.jsxs("div",{className:"flex gap-2 mt-4",children:[V.jsx("button",{className:"btn btn-ghost flex-1 btn-sm",onClick:()=>b("options"),children:"Back"}),V.jsx("button",{className:"btn btn-success flex-1 btn-sm",onClick:()=>c==="nsec"?t(u):r(u),children:"Login"})]})]})]})})}const lR=Pe.createContext(void 0);function Iie({children:e}){const{pool:t}=qs(),{privkey:r}=Ts(),[n,s]=Pe.useState(()=>{const w=localStorage.getItem("ncc_tracked_services");return w?JSON.parse(w):[]});Pe.useEffect(()=>{localStorage.setItem("ncc_tracked_services",JSON.stringify(n))},[n]),Pe.useEffect(()=>{if(n.length===0)return;const w=[...new Set(n.map(_=>_.pubkey))],M=t.subscribeMany(Dt.load(),[{kinds:[30053,30058,30059],authors:w}],{onevent(_){i(_)}});return()=>{M.close()}},[n.length]);const i=async w=>{var A;const M=(A=w.tags.find(R=>R[0]==="d"))==null?void 0:A[1];if(!M)return;const _=M.replace(/-locator$/,"").replace(/-loc$/,"");s(R=>{const B=R.findIndex(L=>L.pubkey===w.pubkey&&L.serviceId===_);if(B===-1)return R;const I=R[B];let E=!1;const k={...I};if(w.kind===30059)(!I.serviceDef||w.created_at>I.serviceDef.created_at)&&(k.serviceDef=w,E=!0);else if(w.kind===30058&&(!I.latestEvent||w.created_at>I.latestEvent.created_at)&&(k.latestEvent=w,k.lastChecked=Math.floor(Date.now()/1e3),k.decryptedPayload=null,E=!0,r&&!w.content.trim().startsWith("{")))try{const L=J=>{var F;return Uint8Array.from(((F=J.match(/.{1,2}/g))==null?void 0:F.map(X=>parseInt(X,16)))||[])},q=Hr.getConversationKey(L(r),w.pubkey),z=Hr.decrypt(w.content,q);k.decryptedPayload=JSON.parse(z)}catch(L){console.error("Auto-decrypt failed",L)}if(!E)return R;const T=[...R];return T[B]=k,T})},u=(w,M)=>{s(_=>_.some(A=>A.pubkey===w&&A.serviceId===M)?_:[..._,{pubkey:w,serviceId:M,latestEvent:null,serviceDef:null,decryptedPayload:null,lastChecked:Math.floor(Date.now()/1e3)}])},d=(w,M)=>{s(_=>_.filter(A=>!(A.pubkey===w&&A.serviceId===M)))},c=(w,M)=>n.some(_=>_.pubkey===w&&_.serviceId===M),b=(w,M)=>n.find(_=>_.pubkey===w&&_.serviceId===M);return V.jsx(lR.Provider,{value:{tracked:n,trackService:u,untrackService:d,isTracked:c,findTracked:b},children:e})}function uR(){const e=Pe.useContext(lR);if(!e)throw new Error("useTracking must be used within TrackingProvider");return e}const hR=Pe.createContext(void 0);function Cie({children:e}){const[t,r]=Pe.useState(""),[n,s]=Pe.useState(""),[i,u]=Pe.useState("idle"),[d,c]=Pe.useState([]),[b,w]=Pe.useState(null),[M,_]=Pe.useState(null),[A,R]=Pe.useState([]),[B,I]=Pe.useState({}),[E,k]=Pe.useState({}),[T,L]=Pe.useState(!1),[q,z]=Pe.useState([]),X={pubkeyInput:t,setPubkeyInput:r,serviceId:n,setServiceId:s,step:i,setStep:u,logs:d,addLog:ee=>c(x=>[...x,ee]),clearLogs:()=>c([]),error:b,setError:w,resolvedEndpoint:M,setResolvedEndpoint:_,rawEvents:A,setRawEvents:R,profiles:B,setProfiles:I,decryptedPayloads:E,setDecryptedPayloads:k,showExpired:T,setShowExpired:L,attestedIds:q,setAttestedIds:z};return V.jsx(hR.Provider,{value:X,children:e})}function Pie(){const e=Pe.useContext(hR);if(!e)throw new Error("useDiscovery must be used within DiscoveryProvider");return e}function cR(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=cR(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ur(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=cR(e))&&(n&&(n+=" "),n+=t);return n}const dR=Pe.createContext(void 0);function Lie({children:e}){const{pubkey:t}=Ts(),{pool:r}=qs(),[n,s]=Pe.useState(()=>{const b=localStorage.getItem("ncc_wot_follows");return b?JSON.parse(b):[]}),[i,u]=Pe.useState(!1),d=async()=>{if(t){u(!0);try{const b=await r.get(Dt.load(),{kinds:[3],authors:[t]});if(b){const w=[t,...b.tags.filter(M=>M[0]==="p").map(M=>M[1])];s(w),localStorage.setItem("ncc_wot_follows",JSON.stringify(w))}else s([t]),localStorage.setItem("ncc_wot_follows",JSON.stringify([t]))}catch(b){console.error("Failed to fetch WoT",b)}finally{u(!1)}}};Pe.useEffect(()=>{t?(s(b=>b.includes(t)?b:[t,...b]),d()):(s([]),localStorage.removeItem("ncc_wot_follows"))},[t]);const c=b=>n.includes(b);return V.jsx(dR.Provider,{value:{follows:n,isFollowing:c,refreshFollows:d,loading:i},children:e})}function Oie(){const e=Pe.useContext(dR);if(!e)throw new Error("useWoT must be used within WoTProvider");return e}const Yo=e=>e.replace(/[&<"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"})[t]);function Uie({onConnect:e}){const{ncc02Resolver:t,pool:r}=qs(),{pubkey:n,signEvent:s,decryptNip44:i}=Ts(),{trackService:u,isTracked:d,untrackService:c}=uR(),{isFollowing:b}=Oie(),{pubkeyInput:w,setPubkeyInput:M,serviceId:_,setServiceId:A,step:R,setStep:B,logs:I,addLog:E,clearLogs:k,error:T,setError:L,resolvedEndpoint:q,setResolvedEndpoint:z,rawEvents:J,setRawEvents:F,profiles:X,setProfiles:ee,decryptedPayloads:x,setDecryptedPayloads:o,showExpired:f,setShowExpired:l,attestedIds:h,setAttestedIds:v}=Pie(),[y,m]=Pe.useState({}),[p,a]=Pe.useState(!1);Pe.useEffect(()=>{if(J.length>0&&n){const G=J.filter(K=>K.kind===30060&&K.pubkey===n).map(K=>{var O;return(O=K.tags.find(Q=>Q[0]==="e"))==null?void 0:O[1]}).filter(K=>K);G.length>0&&v(K=>{const O=[...new Set([...K,...G])];return O.length===K.length?K:O})}},[J,n]);const g=async G=>{m(Q=>({...Q,[G]:"loading"}));const K=Date.now();let O=G;G.includes(".onion")&&(O=`ws://${window.location.host}/bridge?target=${encodeURIComponent(G)}`);try{const Q=new WebSocket(O),de=setTimeout(()=>Q.close(),1e4);await new Promise((se,Ie)=>{Q.onopen=()=>{clearTimeout(de),Q.close(),se(!0)},Q.onerror=fe=>{clearTimeout(de),Ie(fe)}});const oe=Date.now()-K;m(se=>({...se,[G]:oe}))}catch{m(de=>({...de,[G]:"error"}))}},S=G=>{const K=Math.floor(Date.now()/1e3);if(G.kind===30059){const O=G.tags.find(Q=>Q[0]==="exp");if(O&&parseInt(O[1])<K)return!0}if(G.kind===30058)try{if(G.content.trim().startsWith("{")){const O=JSON.parse(G.content);if(O.updated_at&&O.ttl&&O.updated_at+O.ttl<K)return!0}else{const O=x[G.id];if(O&&O.updated_at&&O.ttl&&O.updated_at+O.ttl<K)return!0}}catch{}return!1},N=async G=>{const K=[...new Set(G.map(O=>O.pubkey))];if(K.length!==0)try{const O=await r.querySync(Dt.load(),{kinds:[0],authors:K}),Q={};O.forEach(de=>{try{const oe=JSON.parse(de.content);Q[de.pubkey]={...oe,_tags:de.tags}}catch{}}),ee(de=>({...de,...Q}))}catch(O){console.error("Failed to fetch profiles",O)}},U=G=>{const K=X[G];if(K&&(K.display_name||K.name))return K.display_name||K.name;try{const O=Bn.npubEncode(G);return`${O.slice(0,10)}...${O.slice(-4)}`}catch{return G.slice(0,8)}},Z=G=>{var Q,de,oe;if(!n)return!1;const K=x[G.id];if(K&&((Q=K.privaterecipients)!=null&&Q.includes(n)))return!0;const O=X[G.pubkey];if(O&&O._tags&&(((de=O._tags.find(Ie=>Ie[0]==="privaterecipients"))==null?void 0:de.slice(1))||[]).includes(n))return!0;if(G.content.startsWith("{"))try{if((oe=JSON.parse(G.content).privaterecipients)!=null&&oe.includes(n))return!0}catch{}return G.tags.some(se=>se[0]==="p"&&se[1]===n)},H=async G=>{try{const K=await i(G.pubkey,G.content);o(O=>({...O,[G.id]:JSON.parse(K)}))}catch(K){alert("Decryption failed: "+K.message)}},$=async()=>{var K;B("verifying"),k(),L(null),z(null),F([]),ee({}),o({});const G=(O,Q,de)=>Promise.race([O,new Promise((oe,se)=>setTimeout(()=>se(new Error(de)),Q))]);try{let O=w;if(w.startsWith("npub")&&(O=Bn.decode(w).data),!O){E("🌐 Global Search: Querying bootstrap relays...");const Ie={kinds:[30053,30058,30059,30060,30061],limit:50};_&&(Ie["#d"]=[_]);const fe=await G(r.querySync(Dt.load(),Ie),1e4,"Global search timed out after 10s");F(fe),N(fe),E(`✅ Found ${fe.length} records globally.`),B("complete");return}E("🔍 NCC Discovery: Querying service events...");let Q=[];const de=await G(r.querySync(Dt.load(),{kinds:[0,30053,30058,30059,30060,30061],authors:[O]}),1e4,"Authored records query timed out");E("🧐 Fetching trust signals about this identity...");const oe=await G(r.querySync(Dt.load(),{kinds:[30060],"#subj":[O]}),5e3,"Trust query timed out");if(Q=[...de,...oe],E(`✅ Found ${Q.length} total records.`),_){E(`🧐 Verifying '${_}'...`);try{await G(t.resolve(O,_,{requireAttestation:!1,minLevel:"self"}),5e3,"Resolution logic timed out")}catch{}}B("resolving");const se=Q.filter(Ie=>Ie.kind===30058);if(_){const Ie=se.find(fe=>{var ne,je;return((ne=fe.tags.find(ae=>ae[0]==="d"))==null?void 0:ne[1])===_||((je=fe.tags.find(ae=>ae[0]==="d"))==null?void 0:je[1])===`${_}-locator`});if(Ie&&Ie.content.startsWith("{"))try{const fe=JSON.parse(Ie.content);((K=fe.endpoints)==null?void 0:K.length)>0&&z(fe.endpoints.sort((ne,je)=>(ne.priority||0)-(je.priority||0))[0])}catch{}}F(Q),N(Q),B("complete")}catch(O){L(O.message||"Discovery failed"),E(`❌ Error: ${O.message}`),B("idle")}},P=(G,K)=>{let O=K;if(!O&&q&&w)try{let de=w;w.startsWith("npub")&&(de=Bn.decode(w).data),O={pubkey:de,id:_||"addr"}}catch{}O&&(d(O.pubkey,O.id)||u(O.pubkey,O.id));let Q=G||(q?q.url||q.uri:null);if(Q){if(Q.includes("://")||(Q=Q.includes(".onion")?`ws://${Q}`:`wss://${Q}`),Q.startsWith("http")&&(Q=Q.replace("http","ws")),Q.includes(".onion"))if(window.confirm(`🧅 Tor Onion Address Detected
249
-
250
- 1. OK: Use Bridge (requires npm run bridge)
251
- 2. Cancel: Direct (Tor Browser/Orbot)`)){const oe=`ws://${window.location.host}/bridge?target=${encodeURIComponent(Q)}`;e(oe,O);return}else{if(window.confirm("Attempt direct connection?")){e(Q,O);return}navigator.clipboard.writeText(Q);return}e(Q,O)}},W=async G=>{var oe;if(!n)return alert("Please login first.");const K=(oe=G.tags.find(se=>se[0]==="d"))==null?void 0:oe[1];if(!K)return;const O=Math.floor(Date.now()/1e3),Q=O+30*24*60*60,de={kind:30060,created_at:O,tags:[["subj",G.pubkey],["srv",K],["e",G.id],["std","nostr-service-trust-v0.1"],["lvl","verified"],["nbf",O.toString()],["exp",Q.toString()]],content:"NCC-02 Attestation",pubkey:n};try{const se=await s(de);se&&(E(`✍️ Publishing Attestation for ${K}...`),await r.publish(Dt.load(),se),v(Ie=>[...Ie,G.id]),alert("Attestation Published Successfully!"))}catch(se){console.error(se),alert("Attestation failed: "+se.message)}};return V.jsx("div",{className:"card bg-base-100 shadow-lg border border-base-200",children:V.jsxs("div",{className:"card-body p-4 sm:p-8",children:[V.jsxs("h3",{className:"card-title text-xl mb-4 flex items-center",children:[V.jsx(vie,{className:"w-6 h-6 mr-2 text-primary"}),"Discovery"]}),V.jsxs("div",{className:"flex flex-col gap-4",children:[V.jsxs("div",{className:"form-control",children:[V.jsx("label",{className:"label text-sm",children:"Target Pubkey"}),V.jsx("input",{className:"input input-bordered w-full",placeholder:"npub1...",value:w,onChange:G=>M(G.target.value)})]}),V.jsxs("div",{className:"form-control",children:[V.jsx("label",{className:"label text-xs",children:"Service ID (Optional)"}),V.jsx("input",{className:"input input-bordered w-full",placeholder:"e.g. relay",value:_,onChange:G=>A(G.target.value)})]}),V.jsx("div",{className:"form-control",children:V.jsxs("label",{className:"cursor-pointer label justify-start gap-4",children:[V.jsx("span",{className:"label-text text-sm",children:"Show Expired"}),V.jsx("input",{type:"checkbox",className:"toggle toggle-sm toggle-warning",checked:f,onChange:G=>l(G.target.checked)})]})}),V.jsx("div",{className:"form-control",children:V.jsxs("label",{className:"cursor-pointer label justify-start gap-4",children:[V.jsx("span",{className:"label-text text-sm font-bold text-secondary",children:"Network Only (WoT)"}),V.jsx("input",{type:"checkbox",className:"toggle toggle-sm toggle-secondary",checked:p,onChange:G=>a(G.target.checked)})]})}),V.jsxs("button",{className:"btn btn-primary w-full",onClick:()=>$(),disabled:R==="verifying"||R==="resolving",children:[R!=="idle"&&R!=="complete"&&V.jsx("span",{className:"loading loading-spinner"}),"Run Discovery"]})]}),T&&V.jsxs("div",{className:"alert alert-error mt-4 text-xs",children:[V.jsx(VB,{className:"w-4 h-4 flex-shrink-0"}),V.jsx("span",{children:T})]}),V.jsxs("div",{className:"mt-4 bg-base-300 p-3 rounded-box font-mono text-[10px] max-h-32 overflow-y-auto",children:[I.length===0&&V.jsx("span",{className:"opacity-50",children:"Idle..."}),I.map((G,K)=>V.jsx("div",{className:"mb-1",dangerouslySetInnerHTML:{__html:Yo(G)}},K))]}),J.length>0&&V.jsx("div",{className:"mt-6 space-y-6",children:(()=>{const G={};return J.forEach(K=>{(G[K.pubkey]=G[K.pubkey]||[]).push(K)}),Object.entries(G).map(([K,O])=>{const Q=U(K),de=Bn.npubEncode(K),oe=Math.max(...O.map(ae=>ae.created_at)),se=new Date(oe*1e3).toLocaleString(),Ie={};let fe=null,ne=null;if(O.forEach(ae=>{ae.kind===30059?(!fe||ae.created_at>fe.created_at)&&(fe=ae):ae.kind===30058&&(!ne||ae.created_at>ne.created_at)&&(ne=ae)}),fe||ne){const ae="infrastructure";Ie[ae]={locators:[],attestations:[],revocations:[]},fe&&(Ie[ae].service=fe),ne&&Ie[ae].locators.push(ne),O.forEach(le=>{le.kind===30060?Ie[ae].attestations.push(le):le.kind===30061&&Ie[ae].revocations.push(le)})}const je=Object.keys(Ie).filter(ae=>{const le=Ie[ae];return f||le.service&&!S(le.service)||le.locators.some(he=>!S(he))?p?!!(b(K)||le.attestations.some(he=>b(he.pubkey))):!0:!1});return je.length===0?null:V.jsx("div",{className:"card bg-base-100 border border-base-300 w-full overflow-hidden shadow-sm",children:V.jsxs("div",{className:"card-body p-3",children:[V.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-3 pb-2 border-b border-base-200",children:[V.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[V.jsx("div",{className:"avatar placeholder",children:V.jsx("div",{className:"bg-neutral text-neutral-content rounded-full w-8",children:V.jsx("span",{dangerouslySetInnerHTML:{__html:Yo(Q.slice(0,2).toUpperCase())}})})}),V.jsxs("div",{className:"min-w-0",children:[V.jsxs("div",{className:"flex items-center gap-2",children:[V.jsx("div",{className:"font-bold text-sm truncate",dangerouslySetInnerHTML:{__html:Yo(Q)}}),(b(K)||O.some(ae=>ae.kind===30060&&b(ae.pubkey)))&&V.jsxs("div",{className:"badge badge-secondary badge-xs gap-1",children:[V.jsx(Gy,{className:"w-2 h-2"})," Network Trusted"]})]}),V.jsx("div",{className:"text-[9px] opacity-50 truncate",dangerouslySetInnerHTML:{__html:Yo(de)}})]})]}),V.jsxs("div",{className:"text-[9px] opacity-40 font-mono text-right sm:text-left",children:["Last Update: ",se]})]}),V.jsx("div",{className:"space-y-4",children:je.map(ae=>{var ze,me;const le=Ie[ae],Le=le.service&&!le.service.tags.find(ge=>ge[0]==="u"),he=le.service&&S(le.service),_e=le.revocations.length>0,He=d(K,ae),ye=le.attestations.filter(ge=>b(ge.pubkey)),Ae=h.includes((ze=le.service)==null?void 0:ze.id)||le.attestations.some(ge=>ge.pubkey===n);return V.jsxs("div",{className:"space-y-2",children:[V.jsxs("div",{className:"flex items-center justify-between px-1",children:[V.jsxs("div",{className:"flex flex-col min-w-0",children:[V.jsxs("div",{className:"flex items-center gap-1",children:[V.jsx("span",{className:ur("font-black text-[10px] uppercase truncate",_e?"text-error line-through":"opacity-70"),children:"Infrastructure Record"}),_e&&V.jsx("div",{className:"badge badge-error badge-xs scale-75 font-bold",children:"REVOKED"}),he&&V.jsx("div",{className:"badge badge-error badge-xs scale-75",children:"EXPIRED"}),le.service&&(()=>{try{const ge=JSON.parse(le.service.content);if(ge.v>1)return V.jsxs("div",{className:"badge badge-warning badge-xs scale-75",title:"Newer protocol version detected",children:["v",ge.v," !"]})}catch{}return null})()]}),ye.length>0&&V.jsxs("span",{className:"text-[8px] text-secondary font-bold",children:["✓ Trusted by ",ye.length," in your network"]})]}),V.jsxs("div",{className:"flex items-center gap-3",children:[le.service&&V.jsxs("button",{className:ur("btn btn-xs gap-1 p-0 h-auto min-h-0",Ae?"text-success":"btn-ghost text-secondary"),title:Ae?"You have attested to this":"Attest to this service",onClick:()=>!Ae&&W(le.service),disabled:Ae,children:[V.jsx(sie,{className:"w-3 h-3"}),V.jsx("span",{className:"text-[9px]",children:Ae?"Attested":"Attest"})]}),V.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[V.jsx("span",{className:"text-[9px] opacity-50",children:"Track"}),V.jsx("input",{type:"checkbox",className:"checkbox checkbox-xs",checked:He,onChange:ge=>ge.target.checked?u(K,ae):c(K,ae)})]})]})]}),V.jsxs("div",{className:`border ${he?"border-error bg-error/5":"border-base-200"} rounded-box overflow-hidden`,children:[V.jsx("div",{className:"p-2 bg-base-200/30",children:le.service?V.jsxs("div",{className:"collapse collapse-arrow bg-base-100 border border-base-200 rounded-box shadow-xs",children:[V.jsx("input",{type:"checkbox"}),V.jsxs("div",{className:"collapse-title text-[10px] font-bold py-1 min-h-0 flex items-center gap-2",children:["NCC-02 Record ",Le&&V.jsx(die,{className:"w-3 h-3 text-warning"})]}),V.jsx("div",{className:"collapse-content",children:V.jsx("pre",{className:"text-[9px] bg-black text-green-500 p-2 rounded mt-1 overflow-x-auto",children:JSON.stringify(le.service,null,2)})})]}):V.jsx("div",{className:"text-[9px] opacity-50 px-2 italic",children:"No NCC-02"})}),V.jsxs("div",{className:"p-2 space-y-2",children:[(me=le.service)==null?void 0:me.tags.filter(ge=>ge[0]==="u").map((ge,Ke)=>V.jsxs("div",{className:"flex items-center justify-between gap-2 p-2 bg-base-200/50 rounded-lg",children:[V.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[V.jsx("span",{className:"text-[9px] font-mono truncate",dangerouslySetInnerHTML:{__html:Yo(ge[1])}}),y[ge[1]]&&V.jsx("span",{className:ur("text-[8px] font-bold",y[ge[1]]==="error"?"text-error":y[ge[1]]==="loading"?"animate-pulse":"text-success"),children:y[ge[1]]==="loading"?"Probing...":y[ge[1]]==="error"?"Offline":`${y[ge[1]]}ms`})]}),V.jsxs("div",{className:"flex items-center gap-1",children:[V.jsx("button",{className:"btn btn-xs btn-ghost",onClick:()=>g(ge[1]),children:"Probe"}),V.jsx("button",{className:"btn btn-xs btn-secondary flex-shrink-0",onClick:()=>P(ge[1],{pubkey:K,id:ae}),children:"Connect"})]})]},Ke)),le.locators.map(ge=>{const Ke=Z(ge),we=!ge.content.trim().startsWith("{"),Be=x[ge.id],We=S(ge);if(!f&&We)return null;let be=[];try{const ke=Be||(we?null:JSON.parse(ge.content));ke!=null&&ke.endpoints&&(be=ke.endpoints)}catch{}return V.jsx("div",{className:`border-l-2 ${Ke?"border-success":We?"border-error":"border-primary"} pl-2 ml-1`,children:V.jsxs("div",{className:"collapse collapse-arrow bg-base-100 border border-base-200 rounded-box",children:[V.jsx("input",{type:"checkbox"}),V.jsxs("div",{className:"collapse-title text-[10px] py-1 min-h-0 flex flex-wrap items-center gap-1",children:[V.jsx("span",{children:"📍 NCC-05"}),Ke&&V.jsx("div",{className:"badge badge-success badge-xs scale-75",children:"FOR YOU"}),We&&V.jsx("div",{className:"badge badge-error badge-xs scale-75",children:"EXPIRED"}),we&&!Be&&V.jsx("div",{className:"badge badge-warning badge-xs scale-75",children:"LOCKED"})]}),V.jsx("div",{className:"collapse-content",children:we&&!Be?V.jsx("button",{className:"btn btn-xs btn-neutral w-full mt-1",onClick:ke=>{ke.stopPropagation(),H(ge)},children:"Decrypt"}):V.jsxs("div",{className:"space-y-2 mt-1",children:[be.map((ke,Ze)=>{let pe=ke.url||ke.uri;pe&&!pe.includes("://")&&(pe=pe.includes(".onion")?`ws://${pe}`:`wss://${pe}`);const Ne=pe&&(pe.startsWith("ws")||pe.startsWith("wss"));return V.jsxs("div",{className:"flex flex-col gap-1",children:[V.jsxs("button",{className:"btn btn-xs btn-primary w-full flex flex-col items-start h-auto py-2 gap-1",onClick:()=>Ne?P(pe,{pubkey:K,id:ae}):window.open(pe,"_blank"),children:[V.jsxs("div",{className:"flex items-center gap-1 font-bold",children:[" ",ke.family==="onion"&&"🧅"," Connect ",V.jsx("span",{dangerouslySetInnerHTML:{__html:Yo(ke.type||(Ne?"Relay":"Web"))}})]}),V.jsx("div",{className:"text-[8px] opacity-70 truncate w-full",dangerouslySetInnerHTML:{__html:Yo(pe)}})]}),V.jsxs("div",{className:"flex items-center justify-between px-1",children:[V.jsx("button",{className:"text-[8px] link opacity-50",onClick:()=>g(pe),children:"Probe Health"}),y[pe]&&V.jsx("span",{className:ur("text-[8px] font-bold",y[pe]==="error"?"text-error":y[pe]==="loading"?"animate-pulse":"text-success"),children:y[pe]==="loading"?"Probing...":y[pe]==="error"?"Offline":`${y[pe]}ms`})]})]},Ze)}),V.jsx("pre",{className:"text-[8px] bg-black text-green-500 p-2 rounded overflow-x-auto",children:JSON.stringify(Be||ge,null,2)})]})})]})},ge.id)})]})]})]},ae)})})]})},K)})})()}),q&&R==="complete"&&V.jsxs("div",{className:"mt-6 p-4 bg-base-200 rounded-box border border-success flex flex-col gap-3",children:[V.jsxs("div",{className:"flex items-center gap-2",children:[V.jsx(Gy,{className:"text-success w-6 h-6 flex-shrink-0"}),V.jsxs("div",{className:"min-w-0",children:[V.jsx("h4",{className:"font-bold text-xs",children:"Target Resolved"}),V.jsx("p",{className:"text-[10px] opacity-70 truncate font-mono",dangerouslySetInnerHTML:{__html:Yo(q.url||q.uri)}})]})]}),V.jsx("button",{className:"btn btn-success btn-sm w-full",onClick:()=>P(),children:"Connect to Relay"})]})]})})}const ef=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"})[t]);function jie({relayUrl:e}){const[t,r]=Pe.useState([]),[n,s]=Pe.useState({}),[i,u]=Pe.useState("disconnected"),[d,c]=Pe.useState(null),[b,w]=Pe.useState("desc"),M=Pe.useRef(new k_),_=Pe.useRef([]),A=Pe.useRef(null),[R,B]=Pe.useState(0),I=T=>{_.current.push(T),!A.current&&(A.current=setTimeout(()=>{const L=[..._.current];_.current=[],A.current=null,r(q=>{let z=[...q],J=!1;return L.forEach(F=>{var X;if(F.kind>=3e4&&F.kind<4e4){const ee=((X=F.tags.find(o=>o[0]==="d"))==null?void 0:X[1])||"",x=z.findIndex(o=>{var f;return o.pubkey===F.pubkey&&o.kind===F.kind&&(((f=o.tags.find(l=>l[0]==="d"))==null?void 0:f[1])||"")===ee});x!==-1?F.created_at>z[x].created_at&&(z[x]=F,J=!0):(z.push(F),J=!0)}else z.find(ee=>ee.id===F.id)||(z.push(F),J=!0)}),J?E([...z],b):q})},100))},E=(T,L)=>[...T].sort((q,z)=>L==="asc"?q.created_at-z.created_at:z.created_at-q.created_at),k=()=>{const T=b==="asc"?"desc":"asc";w(T),r(L=>E(L,T))};return Pe.useEffect(()=>{r([]),s({}),u("disconnected"),c(null),_.current=[],A.current&&(clearTimeout(A.current),A.current=null)},[e]),Pe.useEffect(()=>{if(!e)return;let T,L,q=!1;return(async()=>{u("connecting"),c(null),e.includes(".onion")&&console.warn("[Feed] Tor connection requested. Handshake may take up to 45 seconds."),console.log(`[Feed] Subscribing to ${e}...`),T=M.current.subscribeMany([e],[{kinds:[1,30051,30053,30058,30059,30060,30061],limit:50}],{onevent(J){q=!0,I(J),u("connected")},oneose(){q=!0,console.log(`[Feed] EOSE received from ${e}.`),u("connected")},onclose(J){console.error("[Feed] Subscription closed:",J),q||(u("error"),c("Connection closed by relay or bridge."))}}),L=setTimeout(()=>{q||(console.error("[Feed] Connection watchdog triggered after 30s"),u("error"),c("Relay did not respond. Tor might be slow or the relay is empty."),T&&T.close())},3e4)})(),()=>{L&&clearTimeout(L),T&&T.close()}},[e,R]),Pe.useEffect(()=>{if(!e||t.length===0)return;const T=[...new Set(t.map(q=>q.pubkey))].filter(q=>!n[q]);if(T.length===0)return;const L=M.current.subscribeMany([e],[{kinds:[0],authors:T}],{onevent(q){try{const z=JSON.parse(q.content);s(J=>({...J,[q.pubkey]:z}))}catch{}},oneose(){}});return()=>{L.close()}},[t.length,e]),e?V.jsxs("div",{className:"space-y-4",children:[V.jsxs("div",{className:"flex flex-col bg-base-100 p-4 rounded-box shadow-sm border border-base-200 gap-3",children:[V.jsxs("div",{className:"flex items-center justify-between",children:[V.jsxs("div",{className:"flex items-center gap-3",children:[V.jsx("div",{className:`badge ${i==="connected"?"badge-success":i==="connecting"?"badge-warning":"badge-error"} badge-xs animate-pulse`}),V.jsxs("div",{className:"flex flex-col min-w-0",children:[V.jsx("span",{className:"font-mono text-sm font-bold truncate max-w-[200px] sm:max-w-md",children:e}),V.jsxs("span",{className:"text-xs opacity-50 capitalize",children:[i," ",i==="connected"&&`(${t.length} events)`]})]})]}),V.jsxs("div",{className:"flex items-center gap-2",children:[V.jsxs("button",{className:"btn btn-sm btn-ghost gap-2",onClick:k,title:b==="desc"?"Showing Newest First":"Showing Oldest First",children:[V.jsx(nie,{className:ur("w-4 h-4",b==="asc"&&"rotate-180 transition-transform")}),b==="desc"?V.jsx(iie,{className:"w-3 h-3"}):V.jsx(oie,{className:"w-3 h-3"})]}),i==="error"?V.jsxs("button",{className:"btn btn-sm btn-error",onClick:()=>B(T=>T+1),children:[V.jsx(xa,{className:"w-4 h-4 mr-2"}),"Retry"]}):V.jsxs("button",{className:`btn btn-sm btn-ghost ${i==="connecting"?"loading":""}`,onClick:()=>B(T=>T+1),disabled:i==="connecting",children:[V.jsx(xa,{className:"w-4 h-4"}),V.jsx("span",{className:"hidden sm:inline ml-2",children:"Refresh"})]})]})]}),i==="connected"&&t.length>0&&V.jsxs("div",{className:"flex flex-wrap gap-2 pt-2 border-t border-base-200",children:[V.jsx("div",{className:"text-[10px] uppercase font-bold opacity-30 w-full mb-1",children:"Content Summary"}),[1,30051,30053,30058,30059,30060,30061].map(T=>{const L=t.filter(q=>q.kind===T).length;return L===0?null:V.jsxs("div",{className:"badge badge-ghost badge-sm text-[10px] gap-1",children:["Kind ",T,": ",V.jsx("span",{className:"font-bold",children:L})]},T)})]})]}),i==="error"&&V.jsxs("div",{className:"alert alert-error text-sm",children:[V.jsx(rie,{className:"w-4 h-4 flex-shrink-0"}),V.jsxs("span",{children:["Failed to connect: ",d]})]}),V.jsxs("div",{className:"space-y-4",children:[t.length===0&&i==="connected"&&V.jsxs("div",{className:"text-center p-12 opacity-50 border-2 border-dashed border-base-200 rounded-box",children:[V.jsx("div",{className:"loading loading-dots loading-md mb-2"}),V.jsx("p",{children:"Connected. Waiting for events..."}),V.jsx("p",{className:"text-xs mt-2 italic",children:"Note: Some relays may be empty or only store specific NCC kinds."})]}),t.map(T=>{var h;const L=n[T.pubkey],q=(L==null?void 0:L.display_name)||(L==null?void 0:L.name)||T.pubkey.slice(0,8),z=T.tags.some(v=>v[0]==="ttl"),J=T.tags.some(v=>v[0]==="private"&&v[1]==="true"),F=T.tags.some(v=>v[0]==="exp"),X=T.kind===30058&&(z||J),ee=T.kind===30059&&F,x=T.kind===30060,o=T.kind===30061,f=T.kind===30053,l=T.kind===30051;return V.jsx("div",{className:"card bg-base-100 shadow-sm border border-base-200 overflow-hidden",children:V.jsx("div",{className:"card-body p-3 sm:p-4",children:V.jsxs("div",{className:"flex items-start gap-3",children:[V.jsx("div",{className:"avatar flex-shrink-0",children:V.jsx("div",{className:"w-10 h-10 rounded-full bg-base-300",children:L!=null&&L.picture?V.jsx("img",{src:L.picture,alt:q,onError:v=>v.currentTarget.src=`https://api.dicebear.com/7.x/identicon/svg?seed=${T.pubkey}`}):V.jsx("div",{className:"flex items-center justify-center w-full h-full text-base-content/30 bg-base-200",children:V.jsx(bie,{className:"w-5 h-5"})})})}),V.jsxs("div",{className:"flex-1 min-w-0",children:[V.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between mb-1 gap-1",children:[V.jsx("div",{className:"font-bold text-sm truncate text-primary pr-2",dangerouslySetInnerHTML:{__html:ef(q)}}),V.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[X&&V.jsx("div",{className:"badge badge-primary badge-xs scale-90 sm:scale-100",children:"NCC-05 LOCATOR"}),ee&&V.jsx("div",{className:"badge badge-secondary badge-xs scale-90 sm:scale-100",children:"NCC-02 SERVICE"}),x&&V.jsx("div",{className:"badge badge-accent badge-xs scale-90 sm:scale-100",children:"NCC-02 ATTEST"}),o&&V.jsx("div",{className:"badge badge-error badge-xs scale-90 sm:scale-100",children:"NCC-02 REVOKE"}),f&&V.jsx("div",{className:"badge badge-info badge-xs scale-90 sm:scale-100",children:"NCC-01 DETAIL"}),l&&V.jsx("div",{className:"badge badge-neutral badge-xs scale-90 sm:scale-100",children:"NCC-00 REPT"}),T.kind===1&&V.jsx("div",{className:"badge badge-ghost badge-xs opacity-50 text-[8px]",children:"NOTE"}),!X&&!ee&&!x&&!o&&!f&&!l&&T.kind>1&&V.jsxs("div",{className:"badge badge-ghost badge-xs opacity-50 text-[8px]",children:["KIND ",T.kind]}),V.jsx("div",{className:"text-[9px] opacity-40 whitespace-nowrap font-mono ml-auto sm:ml-0",children:new Date(T.created_at*1e3).toLocaleTimeString()})]})]}),V.jsx("div",{className:"text-sm leading-relaxed mt-1",children:T.kind===1?V.jsx("p",{className:"whitespace-pre-wrap break-words",dangerouslySetInnerHTML:{__html:ef(T.content)}}):V.jsxs("div",{className:"bg-base-200/50 p-2 rounded border border-base-300 text-xs font-mono overflow-x-auto",children:[V.jsx("div",{className:"font-bold mb-1 opacity-50 italic text-[10px]",children:X?"Service Locator (NCC-05)":ee?"Service Record (NCC-02)":x?"Service Attestation (NCC-02)":o?"Service Revocation (NCC-02)":f?"Service Detail (NCC-01)":l?"Succession Report (NCC-00)":`Event Kind ${T.kind}`}),V.jsxs("div",{className:"flex gap-2 mb-1",children:[V.jsx("span",{className:"opacity-50",children:"d-tag:"}),V.jsx("span",{className:"font-bold",dangerouslySetInnerHTML:{__html:ef(((h=T.tags.find(v=>v[0]==="d"))==null?void 0:h[1])||"none")}})]}),X&&T.content.startsWith("{")&&V.jsx("div",{className:"mt-1 space-y-1",children:(()=>{var v;try{return(v=JSON.parse(T.content).endpoints)==null?void 0:v.map((m,p)=>V.jsxs("div",{className:"text-[10px] bg-base-300/50 p-1 rounded border border-base-400/30 flex items-center justify-between",children:[V.jsx("span",{className:"truncate flex-1",dangerouslySetInnerHTML:{__html:ef(m.url||m.uri)}}),V.jsx("span",{className:"badge badge-outline badge-xs opacity-50 ml-1",dangerouslySetInnerHTML:{__html:ef(m.type)}})]},p))}catch{return null}})()}),V.jsxs("div",{className:"opacity-70 mt-1 truncate max-w-full",children:[V.jsx("span",{className:"opacity-50 mr-1",children:"Content:"}),V.jsx("span",{dangerouslySetInnerHTML:{__html:ef(T.content.slice(0,80))}}),T.content.length>80&&"..."]})]})})]})]})})},T.id)})]})]}):V.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-base-content/50 border-2 border-dashed border-base-300 rounded-box",children:[V.jsx(ZB,{className:"w-12 h-12 mb-4"}),V.jsx("h3",{className:"font-bold text-lg",children:"No Relay Connected"}),V.jsx("p",{children:"Use the Service Discovery tab to find and connect to a relay."})]})}function Die(){const{signEvent:e,method:t}=Ts(),{ncc05Publisher:r}=qs(),[n,s]=Pe.useState(!1),[i,u]=Pe.useState(""),[d,c]=Pe.useState(!1),[b,w]=Pe.useState(""),[M,_]=Pe.useState({loading:!1,services:[]}),[A,R]=Pe.useState({type:"ws",url:"",priority:1,family:"onion"}),B=async()=>{_(k=>({...k,loading:!0}));try{const T=await(await fetch("http://localhost:3005/inventory")).json();T&&T.services&&_({loading:!1,services:T.services})}catch{console.warn("Sidecar not detected at localhost:3005"),_({loading:!1,services:[]}),alert("NCC Sidecar not detected on localhost:3005. Ensure it is running.")}},I=k=>{R({type:k.type||"ws",url:k.onion_address||"",priority:1,family:"onion"})};if(t==="readonly")return V.jsx("div",{className:"alert alert-warning",children:"Read-only users cannot publish. Please login with an extension or nsec."});const E=async()=>{c(!0),w("");try{const k=i.split(",").map(L=>L.trim()).filter(L=>L).map(L=>L.startsWith("npub")?Bn.decode(L).data:L),T={v:1,ttl:3600,updated_at:Math.floor(Date.now()/1e3),endpoints:[A],...n&&{privaterecipients:k}};await r.publish(Dt.load(),e,T,{public:!n,identifier:"addr",recipientPubkey:k[0]}),w(`Service Published ${n?"Privately":"Publicly"}!`)}catch(k){console.error(k),alert("Publish failed: "+k.message)}finally{c(!1)}};return V.jsxs("div",{className:"space-y-6",children:[V.jsx("div",{className:"card bg-base-300 border border-base-content/10 shadow-sm",children:V.jsxs("div",{className:"card-body p-4",children:[V.jsxs("div",{className:"flex items-center justify-between",children:[V.jsxs("div",{className:"flex items-center gap-2",children:[V.jsx(Zy,{className:"text-secondary w-5 h-5"}),V.jsx("h3",{className:"font-bold text-sm",children:"NCC Sidecar Integration"})]}),V.jsx("button",{className:ur("btn btn-xs btn-outline btn-secondary",M.loading&&"loading"),onClick:B,children:M.loading?"Detecting...":"Detect Local Services"})]}),M.services.length>0&&V.jsxs("div",{className:"mt-3 space-y-2 fade-in",children:[V.jsx("p",{className:"text-[10px] opacity-60 uppercase font-bold tracking-widest px-1",children:"Local Services Found"}),M.services.map((k,T)=>V.jsxs("div",{className:"flex items-center justify-between p-2 bg-base-100 rounded border border-base-200",children:[V.jsxs("div",{className:"flex flex-col min-w-0",children:[V.jsx("span",{className:"text-xs font-bold truncate",children:k.name||k.id}),V.jsx("span",{className:"text-[9px] font-mono opacity-50 truncate",children:k.onion_address})]}),V.jsx("button",{className:"btn btn-xs btn-ghost text-secondary",onClick:()=>I(k),children:"Import"})]},T))]})]})}),V.jsx("div",{className:"card bg-base-100 shadow-lg border border-base-200",children:V.jsxs("div",{className:"card-body",children:[V.jsxs("h3",{className:"card-title text-xl mb-4 flex items-center",children:[V.jsx(wie,{className:"w-6 h-6 mr-2 text-secondary"}),"Publish Service (NCC-05)"]}),V.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[V.jsxs("div",{className:"form-control",children:[V.jsx("label",{className:"label",children:"Type"}),V.jsxs("select",{className:"select select-bordered",value:A.type,onChange:k=>R({...A,type:k.target.value}),children:[V.jsx("option",{value:"https",children:"HTTPS"}),V.jsx("option",{value:"http",children:"HTTP"}),V.jsx("option",{value:"tcp",children:"TCP"}),V.jsx("option",{value:"ipfs",children:"IPFS"}),V.jsx("option",{value:"ws",children:"WebSocket (Relay)"})]})]}),V.jsxs("div",{className:"form-control",children:[V.jsx("label",{className:"label",children:"Family"}),V.jsxs("select",{className:"select select-bordered",value:A.family,onChange:k=>R({...A,family:k.target.value}),children:[V.jsx("option",{value:"ipv4",children:"IPv4"}),V.jsx("option",{value:"ipv6",children:"IPv6"}),V.jsx("option",{value:"onion",children:"Onion (Tor)"})]})]}),V.jsxs("div",{className:"form-control md:col-span-2",children:[V.jsx("label",{className:"label",children:"URI / URL"}),V.jsx("input",{className:"input input-bordered",placeholder:A.family==="onion"?"xyz...onion":"192.168.1.1",value:A.url,onChange:k=>R({...A,url:k.target.value})})]}),V.jsxs("div",{className:"form-control md:col-span-2 border-t pt-4 mt-2",children:[V.jsxs("label",{className:"label cursor-pointer justify-start gap-4",children:[V.jsx("input",{type:"checkbox",className:"toggle toggle-secondary",checked:n,onChange:k=>s(k.target.checked)}),V.jsx("span",{className:"label-text font-bold",children:"Private Discovery (Encrypted)"})]}),V.jsx("p",{className:"text-[10px] opacity-60 mb-2",children:"Private records are only visible to specific pubkeys using NIP-44 encryption."}),n&&V.jsxs("div",{className:"fade-in",children:[V.jsx("label",{className:"label text-xs",children:"Recipients (Comma separated npubs)"}),V.jsx("textarea",{className:"textarea textarea-bordered w-full h-20 text-xs font-mono",placeholder:"npub1..., npub1...",value:i,onChange:k=>u(k.target.value)})]})]})]}),V.jsx("div",{className:"card-actions justify-end mt-4",children:V.jsxs("button",{className:"btn btn-secondary",onClick:E,disabled:d||!A.url||n&&!i,children:[d?V.jsx("span",{className:"loading loading-spinner"}):V.jsx(gie,{className:"w-4 h-4 mr-2"}),n?"Publish Private":"Publish to Network"]})}),b&&V.jsx("div",{className:"alert alert-success mt-2",children:b})]})})]})}function qie(){const{ncc02Resolver:e}=qs(),[t,r]=Pe.useState(""),[n,s]=Pe.useState("media"),[i,u]=Pe.useState(null),[d,c]=Pe.useState(!1),[b,w]=Pe.useState(null),M=async()=>{c(!0),w(null),u(null);try{let _=t;if(t.startsWith("npub")){const{data:R}=Bn.decode(t);_=R}const A=await e.resolve(_,n,{requireAttestation:!1,minLevel:"self"});u(A)}catch(_){console.error(_),w(_.message||"Verification failed")}finally{c(!1)}};return V.jsx("div",{className:"card bg-base-100 shadow-lg border border-base-200",children:V.jsxs("div",{className:"card-body",children:[V.jsxs("h3",{className:"card-title text-xl mb-4 flex items-center",children:[V.jsx(GB,{className:"w-6 h-6 mr-2 text-accent"}),"Trust Explorer (NCC-02)"]}),V.jsxs("div",{className:"flex flex-col gap-4",children:[V.jsxs("div",{className:"form-control",children:[V.jsx("label",{className:"label",children:"Target Pubkey"}),V.jsx("input",{className:"input input-bordered",placeholder:"npub1...",value:t,onChange:_=>r(_.target.value)})]}),V.jsxs("div",{className:"form-control",children:[V.jsx("label",{className:"label",children:"Service ID"}),V.jsx("input",{className:"input input-bordered",placeholder:"media",value:n,onChange:_=>s(_.target.value)})]}),V.jsx("button",{className:"btn btn-accent",onClick:M,disabled:d,children:d?V.jsx("span",{className:"loading loading-spinner"}):"Verify Service"})]}),b&&V.jsxs("div",{className:"alert alert-error mt-4",children:[V.jsx(Mie,{className:"w-6 h-6"}),V.jsx("span",{children:b})]}),i&&V.jsxs("div",{className:"mt-6 p-4 bg-base-200 rounded-box",children:[V.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[V.jsx(fie,{className:"text-success w-5 h-5"}),V.jsx("span",{className:"font-bold",children:"Service Verified"})]}),V.jsx("pre",{className:"text-xs overflow-auto bg-base-300 p-2 rounded",children:JSON.stringify(i,null,2)})]})]})})}const Fie="modulepreload",Hie=function(e){return"/"+e},a8={},f8=function(t,r,n){let s=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),d=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));s=Promise.allSettled(r.map(c=>{if(c=Hie(c),c in a8)return;a8[c]=!0;const b=c.endsWith(".css"),w=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${w}`))return;const M=document.createElement("link");if(M.rel=b?"stylesheet":Fie,b||(M.as="script"),M.crossOrigin="",M.href=c,d&&M.setAttribute("nonce",d),document.head.appendChild(M),b)return new Promise((_,A)=>{M.addEventListener("load",_),M.addEventListener("error",()=>A(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(u){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return s.then(u=>{for(const d of u||[])d.status==="rejected"&&i(d.reason);return t().catch(i)})},Fv=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"})[t]);function zie(){const{pubkey:e,method:t,signEvent:r}=Ts(),{pool:n}=qs(),[s,i]=Pe.useState(()=>{const ee=localStorage.getItem("ncc_managed_identities");return ee?JSON.parse(ee):[]}),[u,d]=Pe.useState({label:"",key:""}),[c,b]=Pe.useState(!1),[w,M]=Pe.useState(!1),[_,A]=Pe.useState([]),[R,B]=Pe.useState(null),[I,E]=Pe.useState(""),k=ee=>{var x;return Uint8Array.from(((x=ee.match(/.{1,2}/g))==null?void 0:x.map(o=>parseInt(o,16)))||[])},T=ee=>Array.from(ee).map(x=>x.toString(16).padStart(2,"0")).join(""),L=[...e?[e]:[],...s.map(ee=>ee.pubkey)],q=async()=>{if(L.length!==0){M(!0);try{const ee=await n.querySync(Dt.load(),{kinds:[30053,30058,30059,30060,30061],authors:L}),x=new Map;ee.forEach(o=>{var h;const f=((h=o.tags.find(v=>v[0]==="d"))==null?void 0:h[1])||"",l=`${o.kind}:${o.pubkey}:${f}`;(!x.has(l)||o.created_at>x.get(l).created_at)&&x.set(l,o)}),A(Array.from(x.values()))}catch(ee){console.error("Scan failed",ee)}finally{M(!1)}}};Pe.useEffect(()=>{localStorage.setItem("ncc_managed_identities",JSON.stringify(s))},[s]),Pe.useEffect(()=>{q()},[s.length,e]);const z=()=>{try{let ee=u.key,x;if(u.key.startsWith("nsec")){const o=Bn.decode(u.key);ee=T(o.data),x=ee,ee=uo(o.data)}else if(u.key.startsWith("npub"))ee=Bn.decode(u.key).data;else if(u.key.length===64)try{const o=k(u.key),f=uo(o);x=ee,ee=f}catch{}if(L.includes(ee)){alert("Identity already managed");return}i([...s,{pubkey:ee,privkey:x,label:u.label||`Service ${ee.slice(0,4)}`}]),d({label:"",key:""}),b(!1)}catch{alert("Invalid Key Format")}},J=ee=>{i(s.filter(x=>x.pubkey!==ee))},F=async ee=>{const x=s.find(f=>f.pubkey===ee.pubkey),o=x==null?void 0:x.privkey;M(!0);try{const f=Math.floor(Date.now()/1e3),l={kind:ee.kind,created_at:f,tags:[...ee.tags],content:ee.content,pubkey:ee.pubkey},h=l.tags.findIndex(y=>y[0]==="exp");if(h!==-1){const y=f+2592e3;l.tags[h]=["exp",y.toString()]}let v;if(o){const{finalizeEvent:y}=await f8(async()=>{const{finalizeEvent:m}=await import("./pure-3kflLNsq.js");return{finalizeEvent:m}},[]);v=y(l,k(o))}else v=await r(l);await n.publish(Dt.load(),v),alert("Record Renewed!"),q()}catch(f){alert("Renew failed: "+f.message)}finally{M(!1)}},X=async()=>{if(!R)return;const ee=s.find(o=>o.pubkey===R.pubkey),x=ee==null?void 0:ee.privkey;M(!0);try{const o={kind:R.kind,content:I,created_at:Math.floor(Date.now()/1e3),tags:[...R.tags],pubkey:R.pubkey};let f;if(x){const{finalizeEvent:l}=await f8(async()=>{const{finalizeEvent:h}=await import("./pure-3kflLNsq.js");return{finalizeEvent:h}},[]);f=l(o,k(x))}else f=await r(o);await n.publish(Dt.load(),f),alert("Record Updated!"),B(null),q()}catch(o){alert("Update failed: "+o.message)}finally{M(!1)}};return V.jsxs("div",{className:"space-y-6",children:[V.jsxs("div",{className:"flex items-center justify-between",children:[V.jsxs("div",{className:"flex items-center gap-2",children:[V.jsx(Zy,{className:"text-primary w-6 h-6"}),V.jsx("h2",{className:"text-xl font-bold",children:"Infrastructure Inventory"})]}),V.jsxs("div",{className:"flex gap-2",children:[V.jsxs("button",{className:ur("btn btn-sm",w&&"loading"),onClick:q,children:[V.jsx(xa,{className:"w-4 h-4"})," Scan Network"]}),V.jsxs("button",{className:"btn btn-sm btn-primary",onClick:()=>b(!c),children:[V.jsx(KB,{className:"w-4 h-4"})," Add Identity"]})]})]}),c&&V.jsx("div",{className:"card bg-base-100 shadow-lg border border-primary/20",children:V.jsxs("div",{className:"card-body p-4",children:[V.jsx("h3",{className:"font-bold text-sm mb-3",children:"Add Identity to Manage"}),V.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[V.jsx("input",{className:"input input-bordered input-sm",placeholder:"Label (e.g. My Media Node)",value:u.label,onChange:ee=>d({...u,label:ee.target.value})}),V.jsx("input",{className:"input input-bordered input-sm font-mono",placeholder:"nsec / npub / hex",value:u.key,onChange:ee=>d({...u,key:ee.target.value})})]}),V.jsxs("div",{className:"card-actions justify-end mt-2",children:[V.jsx("button",{className:"btn btn-sm btn-ghost",onClick:()=>b(!1),children:"Cancel"}),V.jsx("button",{className:"btn btn-sm btn-primary",onClick:z,disabled:!u.key,children:"Add"})]})]})}),V.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[V.jsx("div",{className:"card bg-base-300 border border-base-content/10",children:V.jsxs("div",{className:"card-body p-4",children:[V.jsxs("div",{className:"flex items-center justify-between",children:[V.jsxs("div",{className:"flex items-center gap-2",children:[V.jsx(Gy,{className:"text-success w-4 h-4"}),V.jsx("span",{className:"font-bold text-sm",children:"Primary Account (Active Session)"})]}),V.jsx("div",{className:"badge badge-outline badge-xs",children:t})]}),V.jsx("div",{className:"text-[10px] font-mono opacity-50 truncate",children:e})]})}),s.map(ee=>V.jsx("div",{className:"card bg-base-100 border border-base-200",children:V.jsxs("div",{className:"card-body p-4",children:[V.jsxs("div",{className:"flex items-center justify-between",children:[V.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[V.jsx(cie,{className:ur("w-4 h-4",ee.privkey?"text-warning":"opacity-30")}),V.jsx("span",{className:"font-bold text-sm truncate",dangerouslySetInnerHTML:{__html:Fv(ee.label)}})]}),V.jsx("button",{className:"btn btn-ghost btn-xs text-error",onClick:()=>J(ee.pubkey),children:V.jsx(JB,{className:"w-3 h-3"})})]}),V.jsx("div",{className:"text-[10px] font-mono opacity-50 truncate",children:ee.pubkey})]})},ee.pubkey))]}),V.jsxs("div",{className:"space-y-4",children:[V.jsx("h3",{className:"text-sm font-bold opacity-50 uppercase tracking-widest px-1",children:"Found Services"}),_.length===0&&!w&&V.jsxs("div",{className:"text-center p-12 bg-base-200 rounded-box border-2 border-dashed border-base-300",children:[V.jsx(Zy,{className:"w-12 h-12 mx-auto mb-2 opacity-20"}),V.jsx("p",{className:"opacity-50",children:"No NCC records found for these identities."})]}),V.jsx("div",{className:"grid grid-cols-1 gap-3",children:_.map(ee=>{var h;const x=s.find(v=>v.pubkey===ee.pubkey),o=x?x.label:"Primary",f=((h=ee.tags.find(v=>v[0]==="d"))==null?void 0:h[1])||"none",l=ee.kind===30059&&ee.tags.find(v=>v[0]==="exp"&&parseInt(v[1])<Date.now()/1e3);return V.jsx("div",{className:ur("card bg-base-100 border shadow-sm",l?"border-error/30":"border-base-200"),children:V.jsxs("div",{className:"card-body p-4",children:[V.jsxs("div",{className:"flex items-start justify-between",children:[V.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[V.jsxs("div",{className:"flex items-center gap-2",children:[V.jsx("span",{className:"badge badge-neutral badge-xs font-bold",dangerouslySetInnerHTML:{__html:Fv(o)}}),V.jsxs("span",{className:"text-sm font-black uppercase",children:["Service: ",V.jsx("span",{dangerouslySetInnerHTML:{__html:Fv(f)}})]}),l&&V.jsx("div",{className:"badge badge-error badge-xs",children:"EXPIRED"})]}),V.jsxs("div",{className:"flex items-center gap-2",children:[V.jsxs("span",{className:"text-[10px] opacity-50",children:["Kind ",ee.kind]}),V.jsx("span",{className:"text-[10px] opacity-30 font-mono",children:new Date(ee.created_at*1e3).toLocaleString()})]})]}),V.jsx("div",{className:"flex gap-2",children:((x==null?void 0:x.privkey)||ee.pubkey===e&&t!=="readonly")&&V.jsxs(V.Fragment,{children:[V.jsx("button",{className:"btn btn-xs btn-outline btn-primary",onClick:()=>F(ee),disabled:w,children:"Renew"}),V.jsx("button",{className:"btn btn-xs btn-outline",onClick:()=>{B(ee),E(ee.content)},disabled:w,children:"Edit"})]})})]}),V.jsx("pre",{className:"text-[9px] bg-black text-green-500 p-2 rounded mt-2 overflow-x-auto max-h-24",children:JSON.stringify(ee,null,2)})]})},ee.id)})})]}),R&&V.jsx("div",{className:"modal modal-open",children:V.jsxs("div",{className:"modal-box max-w-2xl",children:[V.jsx("h3",{className:"font-bold text-lg mb-2",children:"Edit Record Content"}),V.jsxs("p",{className:"text-xs opacity-50 mb-4",children:["Editing Kind ",R.kind," for ",R.pubkey.slice(0,12),"..."]}),V.jsx("textarea",{className:"textarea textarea-bordered w-full h-64 font-mono text-xs",value:I,onChange:ee=>E(ee.target.value)}),V.jsxs("div",{className:"modal-action",children:[V.jsx("button",{className:"btn btn-ghost",onClick:()=>B(null),children:"Cancel"}),V.jsx("button",{className:ur("btn btn-primary",w&&"loading"),onClick:X,children:"Save Changes"})]})]})})]})}function Wie(){const{pool:e}=qs(),{privkey:t}=Ts(),[r,n]=Pe.useState(()=>Dt.load()),[s,i]=Pe.useState({}),[u,d]=Pe.useState(""),[c,b]=Pe.useState(!1),[w,M]=Pe.useState(!1),[_,A]=Pe.useState(null),[R,B]=Pe.useState(null),I=J=>{var F;return Uint8Array.from(((F=J.match(/.{1,2}/g))==null?void 0:F.map(X=>parseInt(X,16)))||[])},E=async()=>{b(!0);const J={};for(const F of r)try{const X=await e.querySync([F],{kinds:[30058,30059],limit:1});J[F]={url:F,lastSeen:Date.now(),status:"online",supportsNCC:X.length>0}}catch{J[F]={url:F,lastSeen:Date.now(),status:"offline",supportsNCC:!1}}i(J),b(!1)};Pe.useEffect(()=>{E()},[]);const k=async()=>{var X,ee;if(console.log("[Settings] handleAdd called with:",u),!u)return;let J=u.trim();if(J.startsWith("npub")){console.log("[Settings] Detected npub input, starting resolution..."),M(!0),A("Fetching records...");try{const{data:x}=Bn.decode(J),o=x;console.log("[Settings] Decoded npub hex:",o);const f=Dt.load();console.log("[Settings] Querying bootstrap relays for identity:",o);const l=await e.querySync(f,{kinds:[0,30058,30059],authors:[o]});if(console.log("[Settings] Found events:",l.length),l.length===0)throw new Error("No NCC records found for this npub on the current bootstrap relays.");const h=[...l].sort((m,p)=>p.created_at-m.created_at);A("Analyzing latest records...");let v=[];const y=Math.floor(Date.now()/1e3);for(const m of h){if(console.log(`[Settings] Probing record ${m.id.slice(0,8)} (Kind ${m.kind})...`),m.kind===30059){const p=m.tags.find(g=>g[0]==="exp");if(p&&parseInt(p[1])<y){console.log("[Settings] Record is expired (NCC-02), skipping.");continue}const a=m.tags.filter(g=>g[0]==="u");if(a.length>0){v=a.map(g=>g[1]),console.log("[Settings] Found freshest endpoints in public NCC-02");break}}if(m.kind===30058)try{const p=!m.content.trim().startsWith("{");let a=null;if(p){if(t){const g=Hr.getConversationKey(I(t),m.pubkey),S=Hr.decrypt(m.content,g);a=JSON.parse(S)}else if((X=window.nostr)!=null&&X.nip44){A("Extension popup: Decrypting...");const g=await window.nostr.nip44.decrypt(m.pubkey,m.content);a=JSON.parse(g)}}else a=JSON.parse(m.content);if(a){if(a.updated_at&&a.ttl&&a.updated_at+a.ttl<y){console.log("[Settings] Record is expired (NCC-05), skipping.");continue}if(((ee=a.endpoints)==null?void 0:ee.length)>0&&(v=a.endpoints.map(g=>g.url||g.uri).filter(g=>g),v.length>0)){console.log("[Settings] Found freshest endpoints in NCC-05 Locator");break}}}catch(p){console.warn("[Settings] Decryption/parsing failed for this record, continuing search...",p)}}v.length>0?(A(null),B(v)):(console.error("[Settings] No endpoints found in any authored records."),alert("No relay endpoints found for this npub. Ensure the identity has published NCC-02 or NCC-05 records."))}catch(x){console.error("[Settings] Resolution Error:",x),alert("Resolution failed: "+x.message)}finally{M(!1),A(null),E()}return}let F=J;F.startsWith("ws")||(F=`wss://${F}`),Dt.add(F),n(Dt.load()),d(""),E()},T=J=>{Dt.remove(J),n(Dt.load())},L=()=>{Dt.restoreDefaults(),n(Dt.load()),E()},q=J=>{let F=J;if(F.includes("://")||(F=F.includes(".onion")?`ws://${F}`:`wss://${F}`),F.includes(".onion")&&!F.includes("/bridge?target=")){const X=F;F=`ws://${window.location.host}/bridge?target=${encodeURIComponent(X)}`,console.log(`[Settings] 🧅 Bridging: ${X} -> ${F}`)}Dt.add(F),n(Dt.load()),B(null),d(""),E()},z=()=>{B(null),d("")};return V.jsxs("div",{className:"space-y-6",children:[V.jsxs("div",{className:"flex items-center justify-between",children:[V.jsxs("div",{className:"flex items-center gap-2",children:[V.jsx(mie,{className:"text-primary w-6 h-6"}),V.jsx("h2",{className:"text-xl font-bold",children:"Network Settings"})]}),V.jsxs("button",{className:ur("btn btn-sm btn-ghost",c&&"loading"),onClick:E,disabled:c,children:[V.jsx(xa,{className:"w-4 h-4 mr-2"})," Refresh Health"]})]}),V.jsx("div",{className:"card bg-base-100 shadow-sm border border-base-200",children:V.jsxs("div",{className:"card-body",children:[V.jsxs("h3",{className:"card-title text-sm opacity-70 uppercase mb-4 flex items-center gap-2",children:[V.jsx(yie,{className:"w-4 h-4"})," Bootstrap Relays"]}),V.jsx("div",{className:"space-y-3",children:r.map(J=>{const F=s[J];return V.jsxs("div",{className:"flex items-center justify-between p-3 bg-base-200/50 rounded-lg border border-base-300",children:[V.jsxs("div",{className:"flex flex-col min-w-0",children:[V.jsx("span",{className:"font-mono text-xs font-bold truncate",children:J}),V.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[(F==null?void 0:F.status)==="online"?V.jsxs("span",{className:"badge badge-success badge-xs gap-1",children:[V.jsx(aie,{className:"w-2 h-2"})," Online"]}):(F==null?void 0:F.status)==="offline"?V.jsxs("span",{className:"badge badge-error badge-xs gap-1",children:[V.jsx(VB,{className:"w-2 h-2"})," Offline"]}):V.jsx("span",{className:"badge badge-ghost badge-xs",children:"Checking..."}),(F==null?void 0:F.supportsNCC)&&V.jsx("span",{className:"badge badge-primary badge-xs",children:"NCC-Ready"})]})]}),V.jsx("button",{className:"btn btn-ghost btn-xs text-error",onClick:()=>T(J),title:"Remove Relay",children:V.jsx(JB,{className:"w-4 h-4"})})]},J)})}),R?V.jsxs("div",{className:"mt-4 p-4 bg-base-200 rounded-box border border-primary/20 fade-in",children:[V.jsxs("div",{className:"flex items-center justify-between mb-3",children:[V.jsx("h4",{className:"text-xs font-bold uppercase opacity-70",children:"Discovered Endpoints"}),V.jsx("button",{className:"btn btn-xs btn-ghost",onClick:z,children:"Cancel"})]}),V.jsx("div",{className:"space-y-2",children:R.map((J,F)=>V.jsxs("div",{className:"flex items-center justify-between p-2 bg-base-100 rounded border border-base-300",children:[V.jsx("span",{className:"text-[10px] font-mono truncate flex-1 pr-2",children:J}),V.jsx("button",{className:"btn btn-xs btn-primary",onClick:()=>q(J),children:"Add This"})]},F))}),V.jsx("p",{className:"text-[9px] opacity-50 mt-3 italic",children:"Select an endpoint above to add it to your bootstrap list. Onion addresses will be automatically bridged."})]}):V.jsxs(V.Fragment,{children:[V.jsxs("div",{className:"flex gap-2 mt-4",children:[V.jsx("input",{className:"input input-bordered input-sm flex-1 font-mono text-xs",placeholder:"wss://... or npub1...",value:u,onChange:J=>d(J.target.value),onKeyDown:J=>J.key==="Enter"&&k(),disabled:w}),V.jsx("button",{className:ur("btn btn-sm btn-primary",w&&"loading"),onClick:k,disabled:w||!u,children:w?"Resolving...":V.jsxs(V.Fragment,{children:[V.jsx(KB,{className:"w-4 h-4 mr-1"})," Add"]})})]}),_&&V.jsxs("div",{className:"flex items-center gap-2 mt-2 px-1 text-[10px] text-primary animate-pulse font-bold",children:[V.jsx(xa,{className:"w-3 h-3 animate-spin"}),_]})]}),V.jsx("div",{className:"card-actions justify-start mt-2",children:V.jsx("button",{className:"btn btn-link btn-xs opacity-50",onClick:L,children:"Restore Default Relays"})})]})}),V.jsx("div",{className:"card bg-base-100 shadow-sm border border-base-200",children:V.jsxs("div",{className:"card-body",children:[V.jsxs("h3",{className:"card-title text-sm opacity-70 uppercase mb-4 flex items-center gap-2",children:[V.jsx(GB,{className:"w-4 h-4"})," Security & Protocol"]}),V.jsxs("div",{className:"space-y-4",children:[V.jsxs("div",{className:"flex items-center justify-between",children:[V.jsxs("div",{children:[V.jsx("p",{className:"text-sm font-bold",children:"NCC Protocol Version"}),V.jsx("p",{className:"text-xs opacity-50",children:"Current supported schema version"})]}),V.jsx("div",{className:"badge badge-neutral",children:"v1.0"})]}),V.jsxs("div",{className:"alert alert-info py-2 text-[10px] leading-tight",children:[V.jsx(xa,{className:"w-3 h-3 flex-shrink-0"}),V.jsxs("span",{children:["Discovery currently prioritizes relays with the ",V.jsx("b",{children:"NCC-Ready"})," badge. These relays have recently returned valid NCC events."]})]})]})]})})]})}function Vie(){const{pubkey:e,logout:t,method:r}=Ts(),{tracked:n,findTracked:s}=uR(),[i,u]=Pe.useState("discovery"),[d,c]=Pe.useState(()=>localStorage.getItem("ncc_active_relay")),[b,w]=Pe.useState(()=>{const B=localStorage.getItem("ncc_active_service");return B?JSON.parse(B):null}),[M,_]=Pe.useState(null);Pe.useEffect(()=>{const B=async()=>{try{const E=new WebSocket(`ws://${window.location.host}/bridge?target=internal-ping`),k=setTimeout(()=>E.close(),2e3);E.onopen=()=>{clearTimeout(k),_(!0),E.close()},E.onerror=()=>{clearTimeout(k),_(!1)}}catch{_(!1)}};B();const I=setInterval(B,3e4);return()=>clearInterval(I)},[]);const A=(B,I)=>{if(c(B),localStorage.setItem("ncc_active_relay",B),I){const E={pubkey:I.pubkey,serviceId:I.id};w(E),localStorage.setItem("ncc_active_service",JSON.stringify(E))}u("feed")},R=()=>{t(),c(null),w(null),localStorage.removeItem("ncc_active_relay"),localStorage.removeItem("ncc_active_service")};return Pe.useEffect(()=>{var E,k;if(!b||!d)return;const B=s(b.pubkey,b.serviceId);if(!B)return;let I=(E=B.decryptedPayload)==null?void 0:E.endpoints;if(!I&&((k=B.latestEvent)!=null&&k.content.startsWith("{")))try{I=JSON.parse(B.latestEvent.content).endpoints}catch(T){console.error("Failed to parse NCC-05 content",T)}if(I&&I.length>0){const T=[...I].sort((q,z)=>q.priority-z.priority)[0];let L=T.url||T.uri;if(L.includes("://")||(L=L.includes(".onion")?`ws://${L}`:`wss://${L}`),L.startsWith("http")&&(L=L.replace("http","ws")),d.includes("/bridge?target=")){const q=decodeURIComponent(new URL(d).searchParams.get("target")||"");if(L!==q){const z=`ws://${window.location.host}/bridge?target=${encodeURIComponent(L)}`;console.log(`🚀 NCC Auto-Update: Relay endpoint changed from ${q} to ${L} (via Bridge)`),c(z),localStorage.setItem("ncc_active_relay",z)}}else L!==d&&(console.log(`🚀 NCC Auto-Update: Relay endpoint changed from ${d} to ${L}`),c(L),localStorage.setItem("ncc_active_relay",L))}},[n,b,d]),e?V.jsxs("div",{className:"min-h-screen bg-base-200",children:[V.jsxs("div",{className:"navbar bg-base-100 shadow-sm px-4",children:[V.jsx("div",{className:"flex-1",children:V.jsxs("a",{className:"btn btn-ghost text-xl gap-2",children:[V.jsx(uie,{className:"text-primary"}),"NCC Client ",V.jsx("span",{className:"text-xs opacity-50 font-normal",children:"PoC"})]})}),V.jsxs("div",{className:"flex-none gap-4",children:[V.jsxs("div",{className:`badge badge-sm gap-1 hidden sm:flex ${M===!0?"badge-success":M===!1?"badge-error":"badge-ghost"}`,children:[V.jsx("div",{className:`w-1.5 h-1.5 rounded-full ${M===!0?"bg-success-content animate-pulse":"bg-base-content opacity-30"}`}),M===!0?"Bridge":"Bridge Offline"]}),d&&V.jsxs("div",{className:"badge badge-success gap-2 hidden sm:flex",children:[V.jsx(ZB,{className:"w-3 h-3"}),d.includes("target=")?"Bridged Onion":d]}),V.jsxs("div",{className:"flex flex-col items-end text-xs hidden sm:flex",children:[V.jsx("span",{className:"opacity-70",children:r==="readonly"?"Read Only":"Authenticated"}),V.jsxs("span",{className:"font-mono",children:[e.slice(0,8),"...",e.slice(-4)]})]}),V.jsx("button",{className:"btn btn-ghost btn-circle",onClick:R,title:"Logout",children:V.jsx(pie,{className:"w-5 h-5"})})]})]}),V.jsxs("div",{className:"container mx-auto p-4 max-w-4xl",children:[V.jsxs("div",{role:"tablist",className:"tabs tabs-boxed mb-6 bg-base-100 p-2 overflow-x-auto flex-nowrap",children:[V.jsx("a",{role:"tab",className:ur("tab",i==="discovery"&&"tab-active"),onClick:()=>u("discovery"),children:"Discovery (02+05)"}),V.jsxs("a",{role:"tab",className:ur("tab",i==="feed"&&"tab-active"),onClick:()=>u("feed"),children:["Feed ",d&&"🟢"]}),V.jsx("a",{role:"tab",className:ur("tab",i==="publish"&&"tab-active"),onClick:()=>u("publish"),children:"Publish"}),V.jsx("a",{role:"tab",className:ur("tab",i==="trust"&&"tab-active"),onClick:()=>u("trust"),children:"Trust Explorer"}),V.jsx("a",{role:"tab",className:ur("tab",i==="inventory"&&"tab-active"),onClick:()=>u("inventory"),children:"My Inventory"}),V.jsx("a",{role:"tab",className:ur("tab",i==="settings"&&"tab-active"),onClick:()=>u("settings"),children:"Settings"})]}),V.jsxs("div",{className:"fade-in",children:[i==="discovery"&&V.jsx(Uie,{onConnect:A}),i==="feed"&&V.jsx(jie,{relayUrl:d}),i==="publish"&&(r==="readonly"?V.jsx("div",{className:"alert",children:"Read-only users cannot publish. Please login with NIP-07 or Private Key."}):V.jsx(Die,{})),i==="trust"&&V.jsx(qie,{}),i==="inventory"&&V.jsx(zie,{}),i==="settings"&&V.jsx(Wie,{})]})]})]}):V.jsx("div",{className:"min-h-screen bg-base-200 flex items-center justify-center p-4",children:V.jsx(Tie,{})})}function Kie(){return V.jsx(WL,{children:V.jsx(Qne,{children:V.jsx(Lie,{children:V.jsx(Iie,{children:V.jsx(Cie,{children:V.jsx(Vie,{})})})})})})}Hv.createRoot(document.getElementById("root")).render(V.jsx(tr.StrictMode,{children:V.jsx(Kie,{})}));export{Da as a,Pr as b,Dl as s};