diff --git a/assets/index-DZL_R3mm.js b/assets/index-DZL_R3mm.js new file mode 100644 index 0000000..db16a02 --- /dev/null +++ b/assets/index-DZL_R3mm.js @@ -0,0 +1,2680 @@ +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = [] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} +var BD=Object.defineProperty;var ID=(t,e,r)=>e in t?BD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var se=(t,e,r)=>(ID(t,typeof e!="symbol"?e+"":e,r),r),Y2=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var U=(t,e,r)=>(Y2(t,e,"read from private field"),r?r.call(t):e.get(t)),ue=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},Q=(t,e,r,n)=>(Y2(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);var Yo=(t,e,r,n)=>({set _(i){Q(t,e,i,r)},get _(){return U(t,e,n)}}),Ee=(t,e,r)=>(Y2(t,e,"access private method"),r);function ZC(t,e){for(var r=0;rn[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var it=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Hl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function FD(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var JC={exports:{}},yy={},XC={exports:{}},Et={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Dg=Symbol.for("react.element"),PD=Symbol.for("react.portal"),TD=Symbol.for("react.fragment"),ND=Symbol.for("react.strict_mode"),RD=Symbol.for("react.profiler"),DD=Symbol.for("react.provider"),OD=Symbol.for("react.context"),MD=Symbol.for("react.forward_ref"),LD=Symbol.for("react.suspense"),jD=Symbol.for("react.memo"),UD=Symbol.for("react.lazy"),e6=Symbol.iterator;function $D(t){return t===null||typeof t!="object"?null:(t=e6&&t[e6]||t["@@iterator"],typeof t=="function"?t:null)}var QC={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},YC=Object.assign,e_={};function Lh(t,e,r){this.props=t,this.context=e,this.refs=e_,this.updater=r||QC}Lh.prototype.isReactComponent={};Lh.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};Lh.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function t_(){}t_.prototype=Lh.prototype;function t8(t,e,r){this.props=t,this.context=e,this.refs=e_,this.updater=r||QC}var r8=t8.prototype=new t_;r8.constructor=t8;YC(r8,Lh.prototype);r8.isPureReactComponent=!0;var t6=Array.isArray,r_=Object.prototype.hasOwnProperty,n8={current:null},n_={key:!0,ref:!0,__self:!0,__source:!0};function i_(t,e,r){var n,i={},s=null,a=null;if(e!=null)for(n in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(s=""+e.key),e)r_.call(e,n)&&!n_.hasOwnProperty(n)&&(i[n]=e[n]);var o=arguments.length-2;if(o===1)i.children=r;else if(1>>1,q=W[L];if(0>>1;Li(ae,O))vei(de,ae)?(W[L]=de,W[ve]=O,L=ve):(W[L]=ae,W[X]=O,L=X);else if(vei(de,O))W[L]=de,W[ve]=O,L=ve;else break e}}return H}function i(W,H){var O=W.sortIndex-H.sortIndex;return O!==0?O:W.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var c=[],u=[],l=1,f=null,d=3,p=!1,h=!1,g=!1,v=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(W){for(var H=r(u);H!==null;){if(H.callback===null)n(u);else if(H.startTime<=W)n(u),H.sortIndex=H.expirationTime,e(c,H);else break;H=r(u)}}function _(W){if(g=!1,S(W),!h)if(r(c)!==null)h=!0,j(P);else{var H=r(u);H!==null&&$(_,H.startTime-W)}}function P(W,H){h=!1,g&&(g=!1,x(N),N=-1),p=!0;var O=d;try{for(S(H),f=r(c);f!==null&&(!(f.expirationTime>H)||W&&!R());){var L=f.callback;if(typeof L=="function"){f.callback=null,d=f.priorityLevel;var q=L(f.expirationTime<=H);H=t.unstable_now(),typeof q=="function"?f.callback=q:f===r(c)&&n(c),S(H)}else n(c);f=r(c)}if(f!==null)var ee=!0;else{var X=r(u);X!==null&&$(_,X.startTime-H),ee=!1}return ee}finally{f=null,d=O,p=!1}}var C=!1,B=null,N=-1,T=5,D=-1;function R(){return!(t.unstable_now()-DW||125L?(W.sortIndex=O,e(u,W),r(c)===null&&W===r(u)&&(g?(x(N),N=-1):g=!0,$(_,O-L))):(W.sortIndex=q,e(c,W),h||p||(h=!0,j(P))),W},t.unstable_shouldYield=R,t.unstable_wrapCallback=function(W){var H=d;return function(){var O=d;d=H;try{return W.apply(this,arguments)}finally{d=O}}}})(c_);o_.exports=c_;var QD=o_.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var u_=K,Fi=QD;function je(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),yw=Object.prototype.hasOwnProperty,YD=/^[: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]*$/,n6={},i6={};function eO(t){return yw.call(i6,t)?!0:yw.call(n6,t)?!1:YD.test(t)?i6[t]=!0:(n6[t]=!0,!1)}function tO(t,e,r,n){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function rO(t,e,r,n){if(e===null||typeof e>"u"||tO(t,e,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Kn(t,e,r,n,i,s,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=a}var hn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){hn[t]=new Kn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];hn[e]=new Kn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){hn[t]=new Kn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){hn[t]=new Kn(t,2,!1,t,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(t){hn[t]=new Kn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){hn[t]=new Kn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){hn[t]=new Kn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){hn[t]=new Kn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){hn[t]=new Kn(t,5,!1,t.toLowerCase(),null,!1,!1)});var s8=/[\-:]([a-z])/g;function a8(t){return t[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(t){var e=t.replace(s8,a8);hn[e]=new Kn(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(s8,a8);hn[e]=new Kn(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(s8,a8);hn[e]=new Kn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){hn[t]=new Kn(t,1,!1,t.toLowerCase(),null,!1,!1)});hn.xlinkHref=new Kn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){hn[t]=new Kn(t,1,!1,t.toLowerCase(),null,!0,!0)});function o8(t,e,r,n){var i=hn.hasOwnProperty(e)?hn[e]:null;(i!==null?i.type!==0:n||!(2o||i[a]!==s[o]){var c=` +`+i[a].replace(" at new "," at ");return t.displayName&&c.includes("")&&(c=c.replace("",t.displayName)),c}while(1<=a&&0<=o);break}}}finally{rx=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?F0(t):""}function nO(t){switch(t.tag){case 5:return F0(t.type);case 16:return F0("Lazy");case 13:return F0("Suspense");case 19:return F0("SuspenseList");case 0:case 2:case 15:return t=nx(t.type,!1),t;case 11:return t=nx(t.type.render,!1),t;case 1:return t=nx(t.type,!0),t;default:return""}}function Ew(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case _f:return"Fragment";case Cf:return"Portal";case xw:return"Profiler";case c8:return"StrictMode";case bw:return"Suspense";case ww:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case d_:return(t.displayName||"Context")+".Consumer";case f_:return(t._context.displayName||"Context")+".Provider";case u8:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case l8:return e=t.displayName||null,e!==null?e:Ew(t.type)||"Memo";case gc:e=t._payload,t=t._init;try{return Ew(t(e))}catch{}}return null}function iO(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ew(e);case 8:return e===c8?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Yc(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function p_(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function sO(t){var e=p_(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(a){n=""+a,s.call(this,a)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function c1(t){t._valueTracker||(t._valueTracker=sO(t))}function g_(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=p_(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Um(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Sw(t,e){var r=e.checked;return vr({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function a6(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=Yc(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function m_(t,e){e=e.checked,e!=null&&o8(t,"checked",e,!1)}function Aw(t,e){m_(t,e);var r=Yc(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Cw(t,e.type,r):e.hasOwnProperty("defaultValue")&&Cw(t,e.type,Yc(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function o6(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function Cw(t,e,r){(e!=="number"||Um(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var P0=Array.isArray;function Wf(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=u1.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function pp(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var W0={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},aO=["Webkit","ms","Moz","O"];Object.keys(W0).forEach(function(t){aO.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),W0[e]=W0[t]})});function b_(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||W0.hasOwnProperty(t)&&W0[t]?(""+e).trim():e+"px"}function w_(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=b_(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,i):t[r]=i}}var oO=vr({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 Bw(t,e){if(e){if(oO[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(je(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(je(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(je(61))}if(e.style!=null&&typeof e.style!="object")throw Error(je(62))}}function Iw(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 Fw=null;function f8(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Pw=null,Gf=null,Zf=null;function l6(t){if(t=Lg(t)){if(typeof Pw!="function")throw Error(je(280));var e=t.stateNode;e&&(e=Sy(e),Pw(t.stateNode,t.type,e))}}function E_(t){Gf?Zf?Zf.push(t):Zf=[t]:Gf=t}function S_(){if(Gf){var t=Gf,e=Zf;if(Zf=Gf=null,l6(t),e)for(t=0;t>>=0,t===0?32:31-(yO(t)/xO|0)|0}var l1=64,f1=4194304;function T0(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Vm(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,i=t.suspendedLanes,s=t.pingedLanes,a=r&268435455;if(a!==0){var o=a&~i;o!==0?n=T0(o):(s&=a,s!==0&&(n=T0(s)))}else a=r&~i,a!==0?n=T0(a):s!==0&&(n=T0(s));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0r;r++)e.push(t);return e}function Og(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Hs(e),t[e]=r}function SO(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=Z0),x6=" ",b6=!1;function H_(t,e){switch(t){case"keyup":return XO.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function V_(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var kf=!1;function YO(t,e){switch(t){case"compositionend":return V_(e);case"keypress":return e.which!==32?null:(b6=!0,x6);case"textInput":return t=e.data,t===x6&&b6?null:t;default:return null}}function eM(t,e){if(kf)return t==="compositionend"||!x8&&H_(t,e)?(t=$_(),Q1=m8=Lc=null,kf=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=A6(r)}}function G_(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?G_(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Z_(){for(var t=window,e=Um();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Um(t.document)}return e}function b8(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function uM(t){var e=Z_(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&G_(r.ownerDocument.documentElement,r)){if(n!==null&&b8(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!t.extend&&s>n&&(i=n,n=s,s=i),i=C6(r,s);var a=C6(r,n);i&&a&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>n?(t.addRange(e),t.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,Bf=null,Mw=null,X0=null,Lw=!1;function _6(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Lw||Bf==null||Bf!==Um(n)||(n=Bf,"selectionStart"in n&&b8(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}),X0&&bp(X0,n)||(X0=n,n=Wm(Mw,"onSelect"),0Pf||(t.current=Vw[Pf],Vw[Pf]=null,Pf--)}function Yt(t,e){Pf++,Vw[Pf]=t.current,t.current=e}var eu={},Bn=du(eu),ti=du(!1),Cl=eu;function eh(t,e){var r=t.type.contextTypes;if(!r)return eu;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=e[s];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function ri(t){return t=t.childContextTypes,t!=null}function Zm(){ur(ti),ur(Bn)}function N6(t,e,r){if(Bn.current!==eu)throw Error(je(168));Yt(Bn,e),Yt(ti,r)}function ik(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in e))throw Error(je(108,iO(t)||"Unknown",i));return vr({},r,n)}function Jm(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||eu,Cl=Bn.current,Yt(Bn,t),Yt(ti,ti.current),!0}function R6(t,e,r){var n=t.stateNode;if(!n)throw Error(je(169));r?(t=ik(t,e,Cl),n.__reactInternalMemoizedMergedChildContext=t,ur(ti),ur(Bn),Yt(Bn,t)):ur(ti),Yt(ti,r)}var Ya=null,Ay=!1,vx=!1;function sk(t){Ya===null?Ya=[t]:Ya.push(t)}function wM(t){Ay=!0,sk(t)}function hu(){if(!vx&&Ya!==null){vx=!0;var t=0,e=Ht;try{var r=Ya;for(Ht=1;t>=a,i-=a,yo=1<<32-Hs(e)+i|r<N?(T=B,B=null):T=B.sibling;var D=d(x,B,S[N],_);if(D===null){B===null&&(B=T);break}t&&B&&D.alternate===null&&e(x,B),b=s(D,b,N),C===null?P=D:C.sibling=D,C=D,B=T}if(N===S.length)return r(x,B),dr&&ku(x,N),P;if(B===null){for(;NN?(T=B,B=null):T=B.sibling;var R=d(x,B,D.value,_);if(R===null){B===null&&(B=T);break}t&&B&&R.alternate===null&&e(x,B),b=s(R,b,N),C===null?P=R:C.sibling=R,C=R,B=T}if(D.done)return r(x,B),dr&&ku(x,N),P;if(B===null){for(;!D.done;N++,D=S.next())D=f(x,D.value,_),D!==null&&(b=s(D,b,N),C===null?P=D:C.sibling=D,C=D);return dr&&ku(x,N),P}for(B=n(x,B);!D.done;N++,D=S.next())D=p(B,x,N,D.value,_),D!==null&&(t&&D.alternate!==null&&B.delete(D.key===null?N:D.key),b=s(D,b,N),C===null?P=D:C.sibling=D,C=D);return t&&B.forEach(function(E){return e(x,E)}),dr&&ku(x,N),P}function v(x,b,S,_){if(typeof S=="object"&&S!==null&&S.type===_f&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case o1:e:{for(var P=S.key,C=b;C!==null;){if(C.key===P){if(P=S.type,P===_f){if(C.tag===7){r(x,C.sibling),b=i(C,S.props.children),b.return=x,x=b;break e}}else if(C.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===gc&&$6(P)===C.type){r(x,C.sibling),b=i(C,S.props),b.ref=f0(x,C,S),b.return=x,x=b;break e}r(x,C);break}else e(x,C);C=C.sibling}S.type===_f?(b=yl(S.props.children,x.mode,_,S.key),b.return=x,x=b):(_=am(S.type,S.key,S.props,null,x.mode,_),_.ref=f0(x,b,S),_.return=x,x=_)}return a(x);case Cf:e:{for(C=S.key;b!==null;){if(b.key===C)if(b.tag===4&&b.stateNode.containerInfo===S.containerInfo&&b.stateNode.implementation===S.implementation){r(x,b.sibling),b=i(b,S.children||[]),b.return=x,x=b;break e}else{r(x,b);break}else e(x,b);b=b.sibling}b=Cx(S,x.mode,_),b.return=x,x=b}return a(x);case gc:return C=S._init,v(x,b,C(S._payload),_)}if(P0(S))return h(x,b,S,_);if(a0(S))return g(x,b,S,_);y1(x,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,b!==null&&b.tag===6?(r(x,b.sibling),b=i(b,S),b.return=x,x=b):(r(x,b),b=Ax(S,x.mode,_),b.return=x,x=b),a(x)):r(x,b)}return v}var rh=hk(!0),pk=hk(!1),jg={},Ia=du(jg),Ap=du(jg),Cp=du(jg);function Mu(t){if(t===jg)throw Error(je(174));return t}function I8(t,e){switch(Yt(Cp,e),Yt(Ap,t),Yt(Ia,jg),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:kw(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=kw(e,t)}ur(Ia),Yt(Ia,e)}function nh(){ur(Ia),ur(Ap),ur(Cp)}function gk(t){Mu(Cp.current);var e=Mu(Ia.current),r=kw(e,t.type);e!==r&&(Yt(Ap,t),Yt(Ia,r))}function F8(t){Ap.current===t&&(ur(Ia),ur(Ap))}var pr=du(0);function rv(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var yx=[];function P8(){for(var t=0;tr?r:4,t(!0);var n=xx.transition;xx.transition={};try{t(!1),e()}finally{Ht=r,xx.transition=n}}function Pk(){return os().memoizedState}function CM(t,e,r){var n=Gc(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},Tk(t))Nk(e,r);else if(r=uk(t,e,r,n),r!==null){var i=zn();Vs(r,t,n,i),Rk(r,e,n)}}function _M(t,e,r){var n=Gc(t),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(Tk(t))Nk(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var a=e.lastRenderedState,o=s(a,r);if(i.hasEagerState=!0,i.eagerState=o,qs(o,a)){var c=e.interleaved;c===null?(i.next=i,k8(e)):(i.next=c.next,c.next=i),e.interleaved=i;return}}catch{}finally{}r=uk(t,e,i,n),r!==null&&(i=zn(),Vs(r,t,n,i),Rk(r,e,n))}}function Tk(t){var e=t.alternate;return t===mr||e!==null&&e===mr}function Nk(t,e){Q0=nv=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function Rk(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,h8(t,r)}}var iv={readContext:as,useCallback:mn,useContext:mn,useEffect:mn,useImperativeHandle:mn,useInsertionEffect:mn,useLayoutEffect:mn,useMemo:mn,useReducer:mn,useRef:mn,useState:mn,useDebugValue:mn,useDeferredValue:mn,useTransition:mn,useMutableSource:mn,useSyncExternalStore:mn,useId:mn,unstable_isNewReconciler:!1},kM={readContext:as,useCallback:function(t,e){return ca().memoizedState=[t,e===void 0?null:e],t},useContext:as,useEffect:H6,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,rm(4194308,4,_k.bind(null,e,t),r)},useLayoutEffect:function(t,e){return rm(4194308,4,t,e)},useInsertionEffect:function(t,e){return rm(4,2,t,e)},useMemo:function(t,e){var r=ca();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=ca();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=CM.bind(null,mr,t),[n.memoizedState,t]},useRef:function(t){var e=ca();return t={current:t},e.memoizedState=t},useState:z6,useDebugValue:O8,useDeferredValue:function(t){return ca().memoizedState=t},useTransition:function(){var t=z6(!1),e=t[0];return t=AM.bind(null,t[1]),ca().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=mr,i=ca();if(dr){if(r===void 0)throw Error(je(407));r=r()}else{if(r=e(),en===null)throw Error(je(349));kl&30||yk(n,e,r)}i.memoizedState=r;var s={value:r,getSnapshot:e};return i.queue=s,H6(bk.bind(null,n,s,t),[t]),n.flags|=2048,Bp(9,xk.bind(null,n,s,r,e),void 0,null),r},useId:function(){var t=ca(),e=en.identifierPrefix;if(dr){var r=xo,n=yo;r=(n&~(1<<32-Hs(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=_p++,0<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=a.createElement(r,{is:n.is}):(t=a.createElement(r),r==="select"&&(a=t,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):t=a.createElementNS(t,r),t[ba]=e,t[Sp]=n,Hk(t,e,!1,!1),e.stateNode=t;e:{switch(a=Iw(r,n),r){case"dialog":nr("cancel",t),nr("close",t),i=n;break;case"iframe":case"object":case"embed":nr("load",t),i=n;break;case"video":case"audio":for(i=0;ish&&(e.flags|=128,n=!0,d0(s,!1),e.lanes=4194304)}else{if(!n)if(t=rv(a),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),d0(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!dr)return vn(e),null}else 2*Ar()-s.renderingStartTime>sh&&r!==1073741824&&(e.flags|=128,n=!0,d0(s,!1),e.lanes=4194304);s.isBackwards?(a.sibling=e.child,e.child=a):(r=s.last,r!==null?r.sibling=a:e.child=a,s.last=a)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Ar(),e.sibling=null,r=pr.current,Yt(pr,n?r&1|2:r&1),e):(vn(e),null);case 22:case 23:return z8(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?bi&1073741824&&(vn(e),e.subtreeFlags&6&&(e.flags|=8192)):vn(e),null;case 24:return null;case 25:return null}throw Error(je(156,e.tag))}function DM(t,e){switch(E8(e),e.tag){case 1:return ri(e.type)&&Zm(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return nh(),ur(ti),ur(Bn),P8(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return F8(e),null;case 13:if(ur(pr),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(je(340));th()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return ur(pr),null;case 4:return nh(),null;case 10:return _8(e.type._context),null;case 22:case 23:return z8(),null;case 24:return null;default:return null}}var b1=!1,Sn=!1,OM=typeof WeakSet=="function"?WeakSet:Set,Xe=null;function Df(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){br(t,e,n)}else r.current=null}function r4(t,e,r){try{r()}catch(n){br(t,e,n)}}var Q6=!1;function MM(t,e){if(jw=qm,t=Z_(),b8(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var a=0,o=-1,c=-1,u=0,l=0,f=t,d=null;t:for(;;){for(var p;f!==r||i!==0&&f.nodeType!==3||(o=a+i),f!==s||n!==0&&f.nodeType!==3||(c=a+n),f.nodeType===3&&(a+=f.nodeValue.length),(p=f.firstChild)!==null;)d=f,f=p;for(;;){if(f===t)break t;if(d===r&&++u===i&&(o=a),d===s&&++l===n&&(c=a),(p=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=p}r=o===-1||c===-1?null:{start:o,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(Uw={focusedElem:t,selectionRange:r},qm=!1,Xe=e;Xe!==null;)if(e=Xe,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Xe=t;else for(;Xe!==null;){e=Xe;try{var h=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,v=h.memoizedState,x=e.stateNode,b=x.getSnapshotBeforeUpdate(e.elementType===e.type?g:Ss(e.type,g),v);x.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var S=e.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(je(163))}}catch(_){br(e,e.return,_)}if(t=e.sibling,t!==null){t.return=e.return,Xe=t;break}Xe=e.return}return h=Q6,Q6=!1,h}function Y0(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&r4(e,r,s)}i=i.next}while(i!==n)}}function ky(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function n4(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function Kk(t){var e=t.alternate;e!==null&&(t.alternate=null,Kk(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[ba],delete e[Sp],delete e[Hw],delete e[xM],delete e[bM])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Wk(t){return t.tag===5||t.tag===3||t.tag===4}function Y6(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Wk(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function i4(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=Gm));else if(n!==4&&(t=t.child,t!==null))for(i4(t,e,r),t=t.sibling;t!==null;)i4(t,e,r),t=t.sibling}function s4(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(s4(t,e,r),t=t.sibling;t!==null;)s4(t,e,r),t=t.sibling}var ln=null,Os=!1;function ec(t,e,r){for(r=r.child;r!==null;)Gk(t,e,r),r=r.sibling}function Gk(t,e,r){if(Ba&&typeof Ba.onCommitFiberUnmount=="function")try{Ba.onCommitFiberUnmount(xy,r)}catch{}switch(r.tag){case 5:Sn||Df(r,e);case 6:var n=ln,i=Os;ln=null,ec(t,e,r),ln=n,Os=i,ln!==null&&(Os?(t=ln,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):ln.removeChild(r.stateNode));break;case 18:ln!==null&&(Os?(t=ln,r=r.stateNode,t.nodeType===8?mx(t.parentNode,r):t.nodeType===1&&mx(t,r),yp(t)):mx(ln,r.stateNode));break;case 4:n=ln,i=Os,ln=r.stateNode.containerInfo,Os=!0,ec(t,e,r),ln=n,Os=i;break;case 0:case 11:case 14:case 15:if(!Sn&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&r4(r,e,a),i=i.next}while(i!==n)}ec(t,e,r);break;case 1:if(!Sn&&(Df(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(o){br(r,e,o)}ec(t,e,r);break;case 21:ec(t,e,r);break;case 22:r.mode&1?(Sn=(n=Sn)||r.memoizedState!==null,ec(t,e,r),Sn=n):ec(t,e,r);break;default:ec(t,e,r)}}function eS(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new OM),e.forEach(function(n){var i=KM.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function vs(t,e){var r=e.deletions;if(r!==null)for(var n=0;ni&&(i=a),n&=~s}if(n=i,n=Ar()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*jM(n/1960))-n,10t?16:t,jc===null)var n=!1;else{if(t=jc,jc=null,ov=0,Ft&6)throw Error(je(331));var i=Ft;for(Ft|=4,Xe=t.current;Xe!==null;){var s=Xe,a=s.child;if(Xe.flags&16){var o=s.deletions;if(o!==null){for(var c=0;cAr()-U8?vl(t,0):j8|=r),ni(t,e)}function rB(t,e){e===0&&(t.mode&1?(e=f1,f1<<=1,!(f1&130023424)&&(f1=4194304)):e=1);var r=zn();t=To(t,e),t!==null&&(Og(t,e,r),ni(t,r))}function qM(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),rB(t,r)}function KM(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,i=t.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(je(314))}n!==null&&n.delete(e),rB(t,r)}var nB;nB=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||ti.current)Yn=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return Yn=!1,NM(t,e,r);Yn=!!(t.flags&131072)}else Yn=!1,dr&&e.flags&1048576&&ak(e,Qm,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;nm(t,e),t=e.pendingProps;var i=eh(e,Bn.current);Xf(e,r),i=N8(null,e,n,t,i,r);var s=R8();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,ri(n)?(s=!0,Jm(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,B8(e),i.updater=Cy,e.stateNode=i,i._reactInternals=e,Zw(e,n,t,r),e=Qw(null,e,n,!0,s,r)):(e.tag=0,dr&&s&&w8(e),Tn(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(nm(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=GM(n),t=Ss(n,t),i){case 0:e=Xw(null,e,n,t,r);break e;case 1:e=Z6(null,e,n,t,r);break e;case 11:e=W6(null,e,n,t,r);break e;case 14:e=G6(null,e,n,Ss(n.type,t),r);break e}throw Error(je(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Ss(n,i),Xw(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Ss(n,i),Z6(t,e,n,i,r);case 3:e:{if(Uk(e),t===null)throw Error(je(387));n=e.pendingProps,s=e.memoizedState,i=s.element,lk(t,e),tv(e,n,null,r);var a=e.memoizedState;if(n=a.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=ih(Error(je(423)),e),e=J6(t,e,n,r,i);break e}else if(n!==i){i=ih(Error(je(424)),e),e=J6(t,e,n,r,i);break e}else for(_i=qc(e.stateNode.containerInfo.firstChild),Bi=e,dr=!0,js=null,r=pk(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(th(),n===i){e=No(t,e,r);break e}Tn(t,e,n,r)}e=e.child}return e;case 5:return gk(e),t===null&&Kw(e),n=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,a=i.children,$w(n,i)?a=null:s!==null&&$w(n,s)&&(e.flags|=32),jk(t,e),Tn(t,e,a,r),e.child;case 6:return t===null&&Kw(e),null;case 13:return $k(t,e,r);case 4:return I8(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=rh(e,null,n,r):Tn(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Ss(n,i),W6(t,e,n,i,r);case 7:return Tn(t,e,e.pendingProps,r),e.child;case 8:return Tn(t,e,e.pendingProps.children,r),e.child;case 12:return Tn(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,s=e.memoizedProps,a=i.value,Yt(Ym,n._currentValue),n._currentValue=a,s!==null)if(qs(s.value,a)){if(s.children===i.children&&!ti.current){e=No(t,e,r);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var o=s.dependencies;if(o!==null){a=s.child;for(var c=o.firstContext;c!==null;){if(c.context===n){if(s.tag===1){c=Co(-1,r&-r),c.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var l=u.pending;l===null?c.next=c:(c.next=l.next,l.next=c),u.pending=c}}s.lanes|=r,c=s.alternate,c!==null&&(c.lanes|=r),Ww(s.return,r,e),o.lanes|=r;break}c=c.next}}else if(s.tag===10)a=s.type===e.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(je(341));a.lanes|=r,o=a.alternate,o!==null&&(o.lanes|=r),Ww(a,r,e),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===e){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}Tn(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,Xf(e,r),i=as(i),n=n(i),e.flags|=1,Tn(t,e,n,r),e.child;case 14:return n=e.type,i=Ss(n,e.pendingProps),i=Ss(n.type,i),G6(t,e,n,i,r);case 15:return Mk(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Ss(n,i),nm(t,e),e.tag=1,ri(n)?(t=!0,Jm(e)):t=!1,Xf(e,r),dk(e,n,i),Zw(e,n,i,r),Qw(null,e,n,!0,t,r);case 19:return zk(t,e,r);case 22:return Lk(t,e,r)}throw Error(je(156,e.tag))};function iB(t,e){return F_(t,e)}function WM(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,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 es(t,e,r,n){return new WM(t,e,r,n)}function V8(t){return t=t.prototype,!(!t||!t.isReactComponent)}function GM(t){if(typeof t=="function")return V8(t)?1:0;if(t!=null){if(t=t.$$typeof,t===u8)return 11;if(t===l8)return 14}return 2}function Zc(t,e){var r=t.alternate;return r===null?(r=es(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function am(t,e,r,n,i,s){var a=2;if(n=t,typeof t=="function")V8(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case _f:return yl(r.children,i,s,e);case c8:a=8,i|=8;break;case xw:return t=es(12,r,e,i|2),t.elementType=xw,t.lanes=s,t;case bw:return t=es(13,r,e,i),t.elementType=bw,t.lanes=s,t;case ww:return t=es(19,r,e,i),t.elementType=ww,t.lanes=s,t;case h_:return Iy(r,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case f_:a=10;break e;case d_:a=9;break e;case u8:a=11;break e;case l8:a=14;break e;case gc:a=16,n=null;break e}throw Error(je(130,t==null?t:typeof t,""))}return e=es(a,r,e,i),e.elementType=t,e.type=n,e.lanes=s,e}function yl(t,e,r,n){return t=es(7,t,n,e),t.lanes=r,t}function Iy(t,e,r,n){return t=es(22,t,n,e),t.elementType=h_,t.lanes=r,t.stateNode={isHidden:!1},t}function Ax(t,e,r){return t=es(6,t,null,e),t.lanes=r,t}function Cx(t,e,r){return e=es(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function ZM(t,e,r,n,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sx(0),this.expirationTimes=sx(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sx(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function q8(t,e,r,n,i,s,a,o,c){return t=new ZM(t,e,r,o,c),e===1?(e=1,s===!0&&(e|=8)):e=0,s=es(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},B8(s),t}function JM(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(cB)}catch(t){console.error(t)}}cB(),a_.exports=Ni;var $h=a_.exports;const tL=Hl($h);var cS=$h;vw.createRoot=cS.createRoot,vw.hydrateRoot=cS.hydrateRoot;/** + * @remix-run/router v1.15.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function wr(){return wr=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function ah(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function rL(){return Math.random().toString(36).substr(2,8)}function lS(t,e){return{usr:t.state,key:t.key,idx:e}}function Fp(t,e,r,n){return r===void 0&&(r=null),wr({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?pu(e):e,{state:r,key:e&&e.key||n||rL()})}function Ug(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function pu(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function nL(t,e,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:s=!1}=n,a=i.history,o=Pr.Pop,c=null,u=l();u==null&&(u=0,a.replaceState(wr({},a.state,{idx:u}),""));function l(){return(a.state||{idx:null}).idx}function f(){o=Pr.Pop;let v=l(),x=v==null?null:v-u;u=v,c&&c({action:o,location:g.location,delta:x})}function d(v,x){o=Pr.Push;let b=Fp(g.location,v,x);r&&r(b,v),u=l()+1;let S=lS(b,u),_=g.createHref(b);try{a.pushState(S,"",_)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;i.location.assign(_)}s&&c&&c({action:o,location:g.location,delta:1})}function p(v,x){o=Pr.Replace;let b=Fp(g.location,v,x);r&&r(b,v),u=l();let S=lS(b,u),_=g.createHref(b);a.replaceState(S,"",_),s&&c&&c({action:o,location:g.location,delta:0})}function h(v){let x=i.location.origin!=="null"?i.location.origin:i.location.href,b=typeof v=="string"?v:Ug(v);return b=b.replace(/ $/,"%20"),Rt(x,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,x)}let g={get action(){return o},get location(){return t(i,a)},listen(v){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(uS,f),c=v,()=>{i.removeEventListener(uS,f),c=null}},createHref(v){return e(i,v)},createURL:h,encodeLocation(v){let x=h(v);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:d,replace:p,go(v){return a.go(v)}};return g}var yr;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(yr||(yr={}));const iL=new Set(["lazy","caseSensitive","path","id","index","children"]);function sL(t){return t.index===!0}function l4(t,e,r,n){return r===void 0&&(r=[]),n===void 0&&(n={}),t.map((i,s)=>{let a=[...r,s],o=typeof i.id=="string"?i.id:a.join("-");if(Rt(i.index!==!0||!i.children,"Cannot specify children on an index route"),Rt(!n[o],'Found a route id collision on id "'+o+`". Route id's must be globally unique within Data Router usages`),sL(i)){let c=wr({},i,e(i),{id:o});return n[o]=c,c}else{let c=wr({},i,e(i),{id:o,children:void 0});return n[o]=c,i.children&&(c.children=l4(i.children,e,a,n)),c}})}function R0(t,e,r){r===void 0&&(r="/");let n=typeof e=="string"?pu(e):e,i=$g(n.pathname||"/",r);if(i==null)return null;let s=lB(t);oL(s);let a=null;for(let o=0;a==null&&o{let c={relativePath:o===void 0?s.path||"":o,caseSensitive:s.caseSensitive===!0,childrenIndex:a,route:s};c.relativePath.startsWith("/")&&(Rt(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let u=Yf([n,c.relativePath]),l=r.concat(c);s.children&&s.children.length>0&&(Rt(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),lB(s.children,e,l,u)),!(s.path==null&&!s.index)&&e.push({path:u,score:pL(u,s.index),routesMeta:l})};return t.forEach((s,a)=>{var o;if(s.path===""||!((o=s.path)!=null&&o.includes("?")))i(s,a);else for(let c of fB(s.path))i(s,a,c)}),e}function fB(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return i?[s,""]:[s];let a=fB(n.join("/")),o=[];return o.push(...a.map(c=>c===""?s:[s,c].join("/"))),i&&o.push(...a),o.map(c=>t.startsWith("/")&&c===""?"/":c)}function oL(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:gL(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const cL=/^:[\w-]+$/,uL=3,lL=2,fL=1,dL=10,hL=-2,fS=t=>t==="*";function pL(t,e){let r=t.split("/"),n=r.length;return r.some(fS)&&(n+=hL),e&&(n+=lL),r.filter(i=>!fS(i)).reduce((i,s)=>i+(cL.test(s)?uL:s===""?fL:dL),n)}function gL(t,e){return t.length===e.length&&t.slice(0,-1).every((n,i)=>n===e[i])?t[t.length-1]-e[e.length-1]:0}function mL(t,e){let{routesMeta:r}=t,n={},i="/",s=[];for(let a=0;a{let{paramName:d,isOptional:p}=l;if(d==="*"){let g=o[f]||"";a=s.slice(0,s.length-g.length).replace(/(.)\/+$/,"$1")}const h=o[f];return p&&!h?u[d]=void 0:u[d]=(h||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:a,pattern:t}}function yL(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),ah(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,o,c)=>(n.push({paramName:o,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),n]}function xL(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return ah(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function $g(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function bL(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?pu(t):t;return{pathname:r?r.startsWith("/")?r:wL(r,e):e,search:SL(n),hash:AL(i)}}function wL(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function _x(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function dB(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function hB(t,e){let r=dB(t);return e?r.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function pB(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=pu(t):(i=wr({},t),Rt(!i.pathname||!i.pathname.includes("?"),_x("?","pathname","search",i)),Rt(!i.pathname||!i.pathname.includes("#"),_x("#","pathname","hash",i)),Rt(!i.search||!i.search.includes("#"),_x("#","search","hash",i)));let s=t===""||i.pathname==="",a=s?"/":i.pathname,o;if(a==null)o=r;else{let f=e.length-1;if(!n&&a.startsWith("..")){let d=a.split("/");for(;d[0]==="..";)d.shift(),f-=1;i.pathname=d.join("/")}o=f>=0?e[f]:"/"}let c=bL(i,o),u=a&&a!=="/"&&a.endsWith("/"),l=(s||a===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(u||l)&&(c.pathname+="/"),c}const Yf=t=>t.join("/").replace(/\/\/+/g,"/"),EL=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),SL=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,AL=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;class Z8{constructor(e,r,n,i){i===void 0&&(i=!1),this.status=e,this.statusText=r||"",this.internal=i,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function CL(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const gB=["post","put","patch","delete"],_L=new Set(gB),kL=["get",...gB],BL=new Set(kL),IL=new Set([301,302,303,307,308]),FL=new Set([307,308]),kx={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},PL={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},p0={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},mB=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,TL=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),vB="remix-router-transitions";function NL(t){const e=t.window?t.window:typeof window<"u"?window:void 0,r=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u",n=!r;Rt(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let i;if(t.mapRouteProperties)i=t.mapRouteProperties;else if(t.detectErrorBoundary){let ie=t.detectErrorBoundary;i=me=>({hasErrorBoundary:ie(me)})}else i=TL;let s={},a=l4(t.routes,i,void 0,s),o,c=t.basename||"/",u=wr({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1},t.future),l=null,f=new Set,d=null,p=null,h=null,g=t.hydrationData!=null,v=R0(a,t.history.location,c),x=null;if(v==null){let ie=Wi(404,{pathname:t.history.location.pathname}),{matches:me,route:ye}=xS(a);v=me,x={[ye.id]:ie}}let b,S=v.some(ie=>ie.route.lazy),_=v.some(ie=>ie.route.loader);if(S)b=!1;else if(!_)b=!0;else if(u.v7_partialHydration){let ie=t.hydrationData?t.hydrationData.loaderData:null,me=t.hydrationData?t.hydrationData.errors:null,ye=Ne=>Ne.route.loader?Ne.route.loader.hydrate===!0?!1:ie&&ie[Ne.route.id]!==void 0||me&&me[Ne.route.id]!==void 0:!0;if(me){let Ne=v.findIndex(Ze=>me[Ze.route.id]!==void 0);b=v.slice(0,Ne+1).every(ye)}else b=v.every(ye)}else b=t.hydrationData!=null;let P,C={historyAction:t.history.action,location:t.history.location,matches:v,initialized:b,navigation:kx,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||x,fetchers:new Map,blockers:new Map},B=Pr.Pop,N=!1,T,D=!1,R=new Map,E=null,F=!1,A=!1,I=[],j=[],$=new Map,W=0,H=-1,O=new Map,L=new Set,q=new Map,ee=new Map,X=new Set,ae=new Map,ve=new Map,de=!1;function pe(){if(l=t.history.listen(ie=>{let{action:me,location:ye,delta:Ne}=ie;if(de){de=!1;return}ah(ve.size===0||Ne!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let Ze=Pe({currentLocation:C.location,nextLocation:ye,historyAction:me});if(Ze&&Ne!=null){de=!0,t.history.go(Ne*-1),Ve(Ze,{state:"blocked",location:ye,proceed(){Ve(Ze,{state:"proceeding",proceed:void 0,reset:void 0,location:ye}),t.history.go(Ne)},reset(){let et=new Map(C.blockers);et.set(Ze,p0),Me({blockers:et})}});return}return le(me,ye)}),r){VL(e,R);let ie=()=>qL(e,R);e.addEventListener("pagehide",ie),E=()=>e.removeEventListener("pagehide",ie)}return C.initialized||le(Pr.Pop,C.location,{initialHydration:!0}),P}function we(){l&&l(),E&&E(),f.clear(),T&&T.abort(),C.fetchers.forEach((ie,me)=>m(me)),C.blockers.forEach((ie,me)=>Se(me))}function _e(ie){return f.add(ie),()=>f.delete(ie)}function Me(ie,me){me===void 0&&(me={}),C=wr({},C,ie);let ye=[],Ne=[];u.v7_fetcherPersist&&C.fetchers.forEach((Ze,et)=>{Ze.state==="idle"&&(X.has(et)?Ne.push(et):ye.push(et))}),[...f].forEach(Ze=>Ze(C,{deletedFetchers:Ne,unstable_viewTransitionOpts:me.viewTransitionOpts,unstable_flushSync:me.flushSync===!0})),u.v7_fetcherPersist&&(ye.forEach(Ze=>C.fetchers.delete(Ze)),Ne.forEach(Ze=>m(Ze)))}function Fe(ie,me,ye){var Ne,Ze;let{flushSync:et}=ye===void 0?{}:ye,qe=C.actionData!=null&&C.navigation.formMethod!=null&&Ms(C.navigation.formMethod)&&C.navigation.state==="loading"&&((Ne=ie.state)==null?void 0:Ne._isRedirect)!==!0,nt;me.actionData?Object.keys(me.actionData).length>0?nt=me.actionData:nt=null:qe?nt=C.actionData:nt=null;let He=me.loaderData?yS(C.loaderData,me.loaderData,me.matches||[],me.errors):C.loaderData,Ke=C.blockers;Ke.size>0&&(Ke=new Map(Ke),Ke.forEach((ct,Br)=>Ke.set(Br,p0)));let $t=N===!0||C.navigation.formMethod!=null&&Ms(C.navigation.formMethod)&&((Ze=ie.state)==null?void 0:Ze._isRedirect)!==!0;o&&(a=o,o=void 0),F||B===Pr.Pop||(B===Pr.Push?t.history.push(ie,ie.state):B===Pr.Replace&&t.history.replace(ie,ie.state));let Qe;if(B===Pr.Pop){let ct=R.get(C.location.pathname);ct&&ct.has(ie.pathname)?Qe={currentLocation:C.location,nextLocation:ie}:R.has(ie.pathname)&&(Qe={currentLocation:ie,nextLocation:C.location})}else if(D){let ct=R.get(C.location.pathname);ct?ct.add(ie.pathname):(ct=new Set([ie.pathname]),R.set(C.location.pathname,ct)),Qe={currentLocation:C.location,nextLocation:ie}}Me(wr({},me,{actionData:nt,loaderData:He,historyAction:B,location:ie,initialized:!0,navigation:kx,revalidation:"idle",restoreScrollPosition:ra(ie,me.matches||C.matches),preventScrollReset:$t,blockers:Ke}),{viewTransitionOpts:Qe,flushSync:et===!0}),B=Pr.Pop,N=!1,D=!1,F=!1,A=!1,I=[],j=[]}async function De(ie,me){if(typeof ie=="number"){t.history.go(ie);return}let ye=f4(C.location,C.matches,c,u.v7_prependBasename,ie,u.v7_relativeSplatPath,me==null?void 0:me.fromRouteId,me==null?void 0:me.relative),{path:Ne,submission:Ze,error:et}=dS(u.v7_normalizeFormMethod,!1,ye,me),qe=C.location,nt=Fp(C.location,Ne,me&&me.state);nt=wr({},nt,t.history.encodeLocation(nt));let He=me&&me.replace!=null?me.replace:void 0,Ke=Pr.Push;He===!0?Ke=Pr.Replace:He===!1||Ze!=null&&Ms(Ze.formMethod)&&Ze.formAction===C.location.pathname+C.location.search&&(Ke=Pr.Replace);let $t=me&&"preventScrollReset"in me?me.preventScrollReset===!0:void 0,Qe=(me&&me.unstable_flushSync)===!0,ct=Pe({currentLocation:qe,nextLocation:nt,historyAction:Ke});if(ct){Ve(ct,{state:"blocked",location:nt,proceed(){Ve(ct,{state:"proceeding",proceed:void 0,reset:void 0,location:nt}),De(ie,me)},reset(){let Br=new Map(C.blockers);Br.set(ct,p0),Me({blockers:Br})}});return}return await le(Ke,nt,{submission:Ze,pendingError:et,preventScrollReset:$t,replace:me&&me.replace,enableViewTransition:me&&me.unstable_viewTransition,flushSync:Qe})}function V(){if(ke(),Me({revalidation:"loading"}),C.navigation.state!=="submitting"){if(C.navigation.state==="idle"){le(C.historyAction,C.location,{startUninterruptedRevalidation:!0});return}le(B||C.historyAction,C.navigation.location,{overrideNavigation:C.navigation})}}async function le(ie,me,ye){T&&T.abort(),T=null,B=ie,F=(ye&&ye.startUninterruptedRevalidation)===!0,Gt(C.location,C.matches),N=(ye&&ye.preventScrollReset)===!0,D=(ye&&ye.enableViewTransition)===!0;let Ne=o||a,Ze=ye&&ye.overrideNavigation,et=R0(Ne,me,c),qe=(ye&&ye.flushSync)===!0;if(!et){let Br=Wi(404,{pathname:me.pathname}),{matches:kt,route:vt}=xS(Ne);Te(),Fe(me,{matches:kt,loaderData:{},errors:{[vt.id]:Br}},{flushSync:qe});return}if(C.initialized&&!A&&LL(C.location,me)&&!(ye&&ye.submission&&Ms(ye.submission.formMethod))){Fe(me,{matches:et},{flushSync:qe});return}T=new AbortController;let nt=m0(t.history,me,T.signal,ye&&ye.submission),He,Ke;if(ye&&ye.pendingError)Ke={[rp(et).route.id]:ye.pendingError};else if(ye&&ye.submission&&Ms(ye.submission.formMethod)){let Br=await ce(nt,me,ye.submission,et,{replace:ye.replace,flushSync:qe});if(Br.shortCircuited)return;He=Br.pendingActionData,Ke=Br.pendingActionError,Ze=Bx(me,ye.submission),qe=!1,nt=new Request(nt.url,{signal:nt.signal})}let{shortCircuited:$t,loaderData:Qe,errors:ct}=await Y(nt,me,et,Ze,ye&&ye.submission,ye&&ye.fetcherSubmission,ye&&ye.replace,ye&&ye.initialHydration===!0,qe,He,Ke);$t||(T=null,Fe(me,wr({matches:et},He?{actionData:He}:{},{loaderData:Qe,errors:ct})))}async function ce(ie,me,ye,Ne,Ze){Ze===void 0&&(Ze={}),ke();let et=zL(me,ye);Me({navigation:et},{flushSync:Ze.flushSync===!0});let qe,nt=h4(Ne,me);if(!nt.route.action&&!nt.route.lazy)qe={type:yr.error,error:Wi(405,{method:ie.method,pathname:me.pathname,routeId:nt.route.id})};else if(qe=await g0("action",ie,nt,Ne,s,i,c,u.v7_relativeSplatPath),ie.signal.aborted)return{shortCircuited:!0};if(ju(qe)){let He;return Ze&&Ze.replace!=null?He=Ze.replace:He=qe.location===C.location.pathname+C.location.search,await he(C,qe,{submission:ye,replace:He}),{shortCircuited:!0}}if(Mf(qe)){let He=rp(Ne,nt.route.id);return(Ze&&Ze.replace)!==!0&&(B=Pr.Push),{pendingActionData:{},pendingActionError:{[He.route.id]:qe.error}}}if(Lu(qe))throw Wi(400,{type:"defer-action"});return{pendingActionData:{[nt.route.id]:qe.data}}}async function Y(ie,me,ye,Ne,Ze,et,qe,nt,He,Ke,$t){let Qe=Ne||Bx(me,Ze),ct=Ze||et||ES(Qe),Br=o||a,[kt,vt]=hS(t.history,C,ye,ct,me,u.v7_partialHydration&&nt===!0,A,I,j,X,q,L,Br,c,Ke,$t);if(Te(At=>!(ye&&ye.some(Tt=>Tt.route.id===At))||kt&&kt.some(Tt=>Tt.route.id===At)),H=++W,kt.length===0&&vt.length===0){let At=z();return Fe(me,wr({matches:ye,loaderData:{},errors:$t||null},Ke?{actionData:Ke}:{},At?{fetchers:new Map(C.fetchers)}:{}),{flushSync:He}),{shortCircuited:!0}}if(!F&&(!u.v7_partialHydration||!nt)){vt.forEach(Tt=>{let Vr=C.fetchers.get(Tt.key),Qo=v0(void 0,Vr?Vr.data:void 0);C.fetchers.set(Tt.key,Qo)});let At=Ke||C.actionData;Me(wr({navigation:Qe},At?Object.keys(At).length===0?{actionData:null}:{actionData:At}:{},vt.length>0?{fetchers:new Map(C.fetchers)}:{}),{flushSync:He})}vt.forEach(At=>{$.has(At.key)&&w(At.key),At.controller&&$.set(At.key,At.controller)});let Ha=()=>vt.forEach(At=>w(At.key));T&&T.signal.addEventListener("abort",Ha);let{results:lr,loaderResults:Zt,fetcherResults:Mi}=await re(C.matches,ye,kt,vt,ie);if(ie.signal.aborted)return{shortCircuited:!0};T&&T.signal.removeEventListener("abort",Ha),vt.forEach(At=>$.delete(At.key));let ms=bS(lr);if(ms){if(ms.idx>=kt.length){let At=vt[ms.idx-kt.length].key;L.add(At)}return await he(C,ms.result,{replace:qe}),{shortCircuited:!0}}let{loaderData:Au,errors:Va}=vS(C,ye,kt,Zt,$t,vt,Mi,ae);ae.forEach((At,Tt)=>{At.subscribe(Vr=>{(Vr||At.done)&&ae.delete(Tt)})}),u.v7_partialHydration&&nt&&C.errors&&Object.entries(C.errors).filter(At=>{let[Tt]=At;return!kt.some(Vr=>Vr.route.id===Tt)}).forEach(At=>{let[Tt,Vr]=At;Va=Object.assign(Va||{},{[Tt]:Vr})});let Cu=z(),na=G(H),Xo=Cu||na||vt.length>0;return wr({loaderData:Au,errors:Va},Xo?{fetchers:new Map(C.fetchers)}:{})}function J(ie,me,ye,Ne){if(n)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");$.has(ie)&&w(ie);let Ze=(Ne&&Ne.unstable_flushSync)===!0,et=o||a,qe=f4(C.location,C.matches,c,u.v7_prependBasename,ye,u.v7_relativeSplatPath,me,Ne==null?void 0:Ne.relative),nt=R0(et,qe,c);if(!nt){ge(ie,me,Wi(404,{pathname:qe}),{flushSync:Ze});return}let{path:He,submission:Ke,error:$t}=dS(u.v7_normalizeFormMethod,!0,qe,Ne);if($t){ge(ie,me,$t,{flushSync:Ze});return}let Qe=h4(nt,He);if(N=(Ne&&Ne.preventScrollReset)===!0,Ke&&Ms(Ke.formMethod)){ne(ie,me,He,Qe,nt,Ze,Ke);return}q.set(ie,{routeId:me,path:He}),xe(ie,me,He,Qe,nt,Ze,Ke)}async function ne(ie,me,ye,Ne,Ze,et,qe){if(ke(),q.delete(ie),!Ne.route.action&&!Ne.route.lazy){let Tt=Wi(405,{method:qe.formMethod,pathname:ye,routeId:me});ge(ie,me,Tt,{flushSync:et});return}let nt=C.fetchers.get(ie);be(ie,HL(qe,nt),{flushSync:et});let He=new AbortController,Ke=m0(t.history,ye,He.signal,qe);$.set(ie,He);let $t=W,Qe=await g0("action",Ke,Ne,Ze,s,i,c,u.v7_relativeSplatPath);if(Ke.signal.aborted){$.get(ie)===He&&$.delete(ie);return}if(u.v7_fetcherPersist&&X.has(ie)){if(ju(Qe)||Mf(Qe)){be(ie,uc(void 0));return}}else{if(ju(Qe))if($.delete(ie),H>$t){be(ie,uc(void 0));return}else return L.add(ie),be(ie,v0(qe)),he(C,Qe,{fetcherSubmission:qe});if(Mf(Qe)){ge(ie,me,Qe.error);return}}if(Lu(Qe))throw Wi(400,{type:"defer-action"});let ct=C.navigation.location||C.location,Br=m0(t.history,ct,He.signal),kt=o||a,vt=C.navigation.state!=="idle"?R0(kt,C.navigation.location,c):C.matches;Rt(vt,"Didn't find any matches after fetcher action");let Ha=++W;O.set(ie,Ha);let lr=v0(qe,Qe.data);C.fetchers.set(ie,lr);let[Zt,Mi]=hS(t.history,C,vt,qe,ct,!1,A,I,j,X,q,L,kt,c,{[Ne.route.id]:Qe.data},void 0);Mi.filter(Tt=>Tt.key!==ie).forEach(Tt=>{let Vr=Tt.key,Qo=C.fetchers.get(Vr),s0=v0(void 0,Qo?Qo.data:void 0);C.fetchers.set(Vr,s0),$.has(Vr)&&w(Vr),Tt.controller&&$.set(Vr,Tt.controller)}),Me({fetchers:new Map(C.fetchers)});let ms=()=>Mi.forEach(Tt=>w(Tt.key));He.signal.addEventListener("abort",ms);let{results:Au,loaderResults:Va,fetcherResults:Cu}=await re(C.matches,vt,Zt,Mi,Br);if(He.signal.aborted)return;He.signal.removeEventListener("abort",ms),O.delete(ie),$.delete(ie),Mi.forEach(Tt=>$.delete(Tt.key));let na=bS(Au);if(na){if(na.idx>=Zt.length){let Tt=Mi[na.idx-Zt.length].key;L.add(Tt)}return he(C,na.result)}let{loaderData:Xo,errors:At}=vS(C,C.matches,Zt,Va,void 0,Mi,Cu,ae);if(C.fetchers.has(ie)){let Tt=uc(Qe.data);C.fetchers.set(ie,Tt)}G(Ha),C.navigation.state==="loading"&&Ha>H?(Rt(B,"Expected pending action"),T&&T.abort(),Fe(C.navigation.location,{matches:vt,loaderData:Xo,errors:At,fetchers:new Map(C.fetchers)})):(Me({errors:At,loaderData:yS(C.loaderData,Xo,vt,At),fetchers:new Map(C.fetchers)}),A=!1)}async function xe(ie,me,ye,Ne,Ze,et,qe){let nt=C.fetchers.get(ie);be(ie,v0(qe,nt?nt.data:void 0),{flushSync:et});let He=new AbortController,Ke=m0(t.history,ye,He.signal);$.set(ie,He);let $t=W,Qe=await g0("loader",Ke,Ne,Ze,s,i,c,u.v7_relativeSplatPath);if(Lu(Qe)&&(Qe=await bB(Qe,Ke.signal,!0)||Qe),$.get(ie)===He&&$.delete(ie),!Ke.signal.aborted){if(X.has(ie)){be(ie,uc(void 0));return}if(ju(Qe))if(H>$t){be(ie,uc(void 0));return}else{L.add(ie),await he(C,Qe);return}if(Mf(Qe)){ge(ie,me,Qe.error);return}Rt(!Lu(Qe),"Unhandled fetcher deferred data"),be(ie,uc(Qe.data))}}async function he(ie,me,ye){let{submission:Ne,fetcherSubmission:Ze,replace:et}=ye===void 0?{}:ye;me.revalidate&&(A=!0);let qe=Fp(ie.location,me.location,{_isRedirect:!0});if(Rt(qe,"Expected a location on the redirect navigation"),r){let ct=!1;if(me.reloadDocument)ct=!0;else if(mB.test(me.location)){const Br=t.history.createURL(me.location);ct=Br.origin!==e.location.origin||$g(Br.pathname,c)==null}if(ct){et?e.location.replace(me.location):e.location.assign(me.location);return}}T=null;let nt=et===!0?Pr.Replace:Pr.Push,{formMethod:He,formAction:Ke,formEncType:$t}=ie.navigation;!Ne&&!Ze&&He&&Ke&&$t&&(Ne=ES(ie.navigation));let Qe=Ne||Ze;if(FL.has(me.status)&&Qe&&Ms(Qe.formMethod))await le(nt,qe,{submission:wr({},Qe,{formAction:me.location}),preventScrollReset:N});else{let ct=Bx(qe,Ne);await le(nt,qe,{overrideNavigation:ct,fetcherSubmission:Ze,preventScrollReset:N})}}async function re(ie,me,ye,Ne,Ze){let et=await Promise.all([...ye.map(He=>g0("loader",Ze,He,me,s,i,c,u.v7_relativeSplatPath)),...Ne.map(He=>He.matches&&He.match&&He.controller?g0("loader",m0(t.history,He.path,He.controller.signal),He.match,He.matches,s,i,c,u.v7_relativeSplatPath):{type:yr.error,error:Wi(404,{pathname:He.path})})]),qe=et.slice(0,ye.length),nt=et.slice(ye.length);return await Promise.all([wS(ie,ye,qe,qe.map(()=>Ze.signal),!1,C.loaderData),wS(ie,Ne.map(He=>He.match),nt,Ne.map(He=>He.controller?He.controller.signal:null),!0)]),{results:et,loaderResults:qe,fetcherResults:nt}}function ke(){A=!0,I.push(...Te()),q.forEach((ie,me)=>{$.has(me)&&(j.push(me),w(me))})}function be(ie,me,ye){ye===void 0&&(ye={}),C.fetchers.set(ie,me),Me({fetchers:new Map(C.fetchers)},{flushSync:(ye&&ye.flushSync)===!0})}function ge(ie,me,ye,Ne){Ne===void 0&&(Ne={});let Ze=rp(C.matches,me);m(ie),Me({errors:{[Ze.route.id]:ye},fetchers:new Map(C.fetchers)},{flushSync:(Ne&&Ne.flushSync)===!0})}function Re(ie){return u.v7_fetcherPersist&&(ee.set(ie,(ee.get(ie)||0)+1),X.has(ie)&&X.delete(ie)),C.fetchers.get(ie)||PL}function m(ie){let me=C.fetchers.get(ie);$.has(ie)&&!(me&&me.state==="loading"&&O.has(ie))&&w(ie),q.delete(ie),O.delete(ie),L.delete(ie),X.delete(ie),C.fetchers.delete(ie)}function y(ie){if(u.v7_fetcherPersist){let me=(ee.get(ie)||0)-1;me<=0?(ee.delete(ie),X.add(ie)):ee.set(ie,me)}else m(ie);Me({fetchers:new Map(C.fetchers)})}function w(ie){let me=$.get(ie);Rt(me,"Expected fetch controller: "+ie),me.abort(),$.delete(ie)}function M(ie){for(let me of ie){let ye=Re(me),Ne=uc(ye.data);C.fetchers.set(me,Ne)}}function z(){let ie=[],me=!1;for(let ye of L){let Ne=C.fetchers.get(ye);Rt(Ne,"Expected fetcher: "+ye),Ne.state==="loading"&&(L.delete(ye),ie.push(ye),me=!0)}return M(ie),me}function G(ie){let me=[];for(let[ye,Ne]of O)if(Ne0}function Z(ie,me){let ye=C.blockers.get(ie)||p0;return ve.get(ie)!==me&&ve.set(ie,me),ye}function Se(ie){C.blockers.delete(ie),ve.delete(ie)}function Ve(ie,me){let ye=C.blockers.get(ie)||p0;Rt(ye.state==="unblocked"&&me.state==="blocked"||ye.state==="blocked"&&me.state==="blocked"||ye.state==="blocked"&&me.state==="proceeding"||ye.state==="blocked"&&me.state==="unblocked"||ye.state==="proceeding"&&me.state==="unblocked","Invalid blocker state transition: "+ye.state+" -> "+me.state);let Ne=new Map(C.blockers);Ne.set(ie,me),Me({blockers:Ne})}function Pe(ie){let{currentLocation:me,nextLocation:ye,historyAction:Ne}=ie;if(ve.size===0)return;ve.size>1&&ah(!1,"A router only supports one blocker at a time");let Ze=Array.from(ve.entries()),[et,qe]=Ze[Ze.length-1],nt=C.blockers.get(et);if(!(nt&&nt.state==="proceeding")&&qe({currentLocation:me,nextLocation:ye,historyAction:Ne}))return et}function Te(ie){let me=[];return ae.forEach((ye,Ne)=>{(!ie||ie(Ne))&&(ye.cancel(),me.push(Ne),ae.delete(Ne))}),me}function ze(ie,me,ye){if(d=ie,h=me,p=ye||null,!g&&C.navigation===kx){g=!0;let Ne=ra(C.location,C.matches);Ne!=null&&Me({restoreScrollPosition:Ne})}return()=>{d=null,h=null,p=null}}function Wt(ie,me){return p&&p(ie,me.map(Ne=>aL(Ne,C.loaderData)))||ie.key}function Gt(ie,me){if(d&&h){let ye=Wt(ie,me);d[ye]=h()}}function ra(ie,me){if(d){let ye=Wt(ie,me),Ne=d[ye];if(typeof Ne=="number")return Ne}return null}function Mt(ie){s={},o=l4(ie,i,void 0,s)}return P={get basename(){return c},get future(){return u},get state(){return C},get routes(){return a},get window(){return e},initialize:pe,subscribe:_e,enableScrollRestoration:ze,navigate:De,fetch:J,revalidate:V,createHref:ie=>t.history.createHref(ie),encodeLocation:ie=>t.history.encodeLocation(ie),getFetcher:Re,deleteFetcher:y,dispose:we,getBlocker:Z,deleteBlocker:Se,_internalFetchControllers:$,_internalActiveDeferreds:ae,_internalSetRoutes:Mt},P}function RL(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function f4(t,e,r,n,i,s,a,o){let c,u;if(a){c=[];for(let f of e)if(c.push(f),f.route.id===a){u=f;break}}else c=e,u=e[e.length-1];let l=pB(i||".",hB(c,s),$g(t.pathname,r)||t.pathname,o==="path");return i==null&&(l.search=t.search,l.hash=t.hash),(i==null||i===""||i===".")&&u&&u.route.index&&!J8(l.search)&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),n&&r!=="/"&&(l.pathname=l.pathname==="/"?r:Yf([r,l.pathname])),Ug(l)}function dS(t,e,r,n){if(!n||!RL(n))return{path:r};if(n.formMethod&&!$L(n.formMethod))return{path:r,error:Wi(405,{method:n.formMethod})};let i=()=>({path:r,error:Wi(400,{type:"invalid-body"})}),s=n.formMethod||"get",a=t?s.toUpperCase():s.toLowerCase(),o=xB(r);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Ms(a))return i();let d=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((p,h)=>{let[g,v]=h;return""+p+g+"="+v+` +`},""):String(n.body);return{path:r,submission:{formMethod:a,formAction:o,formEncType:n.formEncType,formData:void 0,json:void 0,text:d}}}else if(n.formEncType==="application/json"){if(!Ms(a))return i();try{let d=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:r,submission:{formMethod:a,formAction:o,formEncType:n.formEncType,formData:void 0,json:d,text:void 0}}}catch{return i()}}}Rt(typeof FormData=="function","FormData is not available in this environment");let c,u;if(n.formData)c=d4(n.formData),u=n.formData;else if(n.body instanceof FormData)c=d4(n.body),u=n.body;else if(n.body instanceof URLSearchParams)c=n.body,u=mS(c);else if(n.body==null)c=new URLSearchParams,u=new FormData;else try{c=new URLSearchParams(n.body),u=mS(c)}catch{return i()}let l={formMethod:a,formAction:o,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:u,json:void 0,text:void 0};if(Ms(l.formMethod))return{path:r,submission:l};let f=pu(r);return e&&f.search&&J8(f.search)&&c.append("index",""),f.search="?"+c,{path:Ug(f),submission:l}}function DL(t,e){let r=t;if(e){let n=t.findIndex(i=>i.route.id===e);n>=0&&(r=t.slice(0,n))}return r}function hS(t,e,r,n,i,s,a,o,c,u,l,f,d,p,h,g){let v=g?Object.values(g)[0]:h?Object.values(h)[0]:void 0,x=t.createURL(e.location),b=t.createURL(i),S=g?Object.keys(g)[0]:void 0,P=DL(r,S).filter((B,N)=>{let{route:T}=B;if(T.lazy)return!0;if(T.loader==null)return!1;if(s)return T.loader.hydrate?!0:e.loaderData[T.id]===void 0&&(!e.errors||e.errors[T.id]===void 0);if(OL(e.loaderData,e.matches[N],B)||o.some(E=>E===B.route.id))return!0;let D=e.matches[N],R=B;return pS(B,wr({currentUrl:x,currentParams:D.params,nextUrl:b,nextParams:R.params},n,{actionResult:v,defaultShouldRevalidate:a||x.pathname+x.search===b.pathname+b.search||x.search!==b.search||yB(D,R)}))}),C=[];return l.forEach((B,N)=>{if(s||!r.some(F=>F.route.id===B.routeId)||u.has(N))return;let T=R0(d,B.path,p);if(!T){C.push({key:N,routeId:B.routeId,path:B.path,matches:null,match:null,controller:null});return}let D=e.fetchers.get(N),R=h4(T,B.path),E=!1;f.has(N)?E=!1:c.includes(N)?E=!0:D&&D.state!=="idle"&&D.data===void 0?E=a:E=pS(R,wr({currentUrl:x,currentParams:e.matches[e.matches.length-1].params,nextUrl:b,nextParams:r[r.length-1].params},n,{actionResult:v,defaultShouldRevalidate:a})),E&&C.push({key:N,routeId:B.routeId,path:B.path,matches:T,match:R,controller:new AbortController})}),[P,C]}function OL(t,e,r){let n=!e||r.route.id!==e.route.id,i=t[r.route.id]===void 0;return n||i}function yB(t,e){let r=t.route.path;return t.pathname!==e.pathname||r!=null&&r.endsWith("*")&&t.params["*"]!==e.params["*"]}function pS(t,e){if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate(e);if(typeof r=="boolean")return r}return e.defaultShouldRevalidate}async function gS(t,e,r){if(!t.lazy)return;let n=await t.lazy();if(!t.lazy)return;let i=r[t.id];Rt(i,"No route found in manifest");let s={};for(let a in n){let c=i[a]!==void 0&&a!=="hasErrorBoundary";ah(!c,'Route "'+i.id+'" has a static property "'+a+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+a+'" will be ignored.')),!c&&!iL.has(a)&&(s[a]=n[a])}Object.assign(i,s),Object.assign(i,wr({},e(i),{lazy:void 0}))}async function g0(t,e,r,n,i,s,a,o,c){c===void 0&&(c={});let u,l,f,d=g=>{let v,x=new Promise((b,S)=>v=S);return f=()=>v(),e.signal.addEventListener("abort",f),Promise.race([g({request:e,params:r.params,context:c.requestContext}),x])};try{let g=r.route[t];if(r.route.lazy)if(g){let v,x=await Promise.all([d(g).catch(b=>{v=b}),gS(r.route,s,i)]);if(v)throw v;l=x[0]}else if(await gS(r.route,s,i),g=r.route[t],g)l=await d(g);else if(t==="action"){let v=new URL(e.url),x=v.pathname+v.search;throw Wi(405,{method:e.method,pathname:x,routeId:r.route.id})}else return{type:yr.data,data:void 0};else if(g)l=await d(g);else{let v=new URL(e.url),x=v.pathname+v.search;throw Wi(404,{pathname:x})}Rt(l!==void 0,"You defined "+(t==="action"?"an action":"a loader")+" for route "+('"'+r.route.id+"\" but didn't return anything from your `"+t+"` ")+"function. Please return a value or `null`.")}catch(g){u=yr.error,l=g}finally{f&&e.signal.removeEventListener("abort",f)}if(UL(l)){let g=l.status;if(IL.has(g)){let x=l.headers.get("Location");if(Rt(x,"Redirects returned/thrown from loaders/actions must have a Location header"),!mB.test(x))x=f4(new URL(e.url),n.slice(0,n.indexOf(r)+1),a,!0,x,o);else if(!c.isStaticRequest){let b=new URL(e.url),S=x.startsWith("//")?new URL(b.protocol+x):new URL(x),_=$g(S.pathname,a)!=null;S.origin===b.origin&&_&&(x=S.pathname+S.search+S.hash)}if(c.isStaticRequest)throw l.headers.set("Location",x),l;return{type:yr.redirect,status:g,location:x,revalidate:l.headers.get("X-Remix-Revalidate")!==null,reloadDocument:l.headers.get("X-Remix-Reload-Document")!==null}}if(c.isRouteRequest)throw{type:u===yr.error?yr.error:yr.data,response:l};let v;try{let x=l.headers.get("Content-Type");x&&/\bapplication\/json\b/.test(x)?l.body==null?v=null:v=await l.json():v=await l.text()}catch(x){return{type:yr.error,error:x}}return u===yr.error?{type:u,error:new Z8(g,l.statusText,v),headers:l.headers}:{type:yr.data,data:v,statusCode:l.status,headers:l.headers}}if(u===yr.error)return{type:u,error:l};if(jL(l)){var p,h;return{type:yr.deferred,deferredData:l,statusCode:(p=l.init)==null?void 0:p.status,headers:((h=l.init)==null?void 0:h.headers)&&new Headers(l.init.headers)}}return{type:yr.data,data:l}}function m0(t,e,r,n){let i=t.createURL(xB(e)).toString(),s={signal:r};if(n&&Ms(n.formMethod)){let{formMethod:a,formEncType:o}=n;s.method=a.toUpperCase(),o==="application/json"?(s.headers=new Headers({"Content-Type":o}),s.body=JSON.stringify(n.json)):o==="text/plain"?s.body=n.text:o==="application/x-www-form-urlencoded"&&n.formData?s.body=d4(n.formData):s.body=n.formData}return new Request(i,s)}function d4(t){let e=new URLSearchParams;for(let[r,n]of t.entries())e.append(r,typeof n=="string"?n:n.name);return e}function mS(t){let e=new FormData;for(let[r,n]of t.entries())e.append(r,n);return e}function ML(t,e,r,n,i){let s={},a=null,o,c=!1,u={};return r.forEach((l,f)=>{let d=e[f].route.id;if(Rt(!ju(l),"Cannot handle redirect results in processLoaderData"),Mf(l)){let p=rp(t,d),h=l.error;n&&(h=Object.values(n)[0],n=void 0),a=a||{},a[p.route.id]==null&&(a[p.route.id]=h),s[d]=void 0,c||(c=!0,o=CL(l.error)?l.error.status:500),l.headers&&(u[d]=l.headers)}else Lu(l)?(i.set(d,l.deferredData),s[d]=l.deferredData.data):s[d]=l.data,l.statusCode!=null&&l.statusCode!==200&&!c&&(o=l.statusCode),l.headers&&(u[d]=l.headers)}),n&&(a=n,s[Object.keys(n)[0]]=void 0),{loaderData:s,errors:a,statusCode:o||200,loaderHeaders:u}}function vS(t,e,r,n,i,s,a,o){let{loaderData:c,errors:u}=ML(e,r,n,i,o);for(let l=0;ln.route.id===e)+1):[...t]).reverse().find(n=>n.route.hasErrorBoundary===!0)||t[0]}function xS(t){let e=t.length===1?t[0]:t.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function Wi(t,e){let{pathname:r,routeId:n,method:i,type:s}=e===void 0?{}:e,a="Unknown Server Error",o="Unknown @remix-run/router error";return t===400?(a="Bad Request",i&&r&&n?o="You made a "+i+' request to "'+r+'" but '+('did not provide a `loader` for route "'+n+'", ')+"so there is no way to handle the request.":s==="defer-action"?o="defer() is not supported in actions":s==="invalid-body"&&(o="Unable to encode submission body")):t===403?(a="Forbidden",o='Route "'+n+'" does not match URL "'+r+'"'):t===404?(a="Not Found",o='No route matches URL "'+r+'"'):t===405&&(a="Method Not Allowed",i&&r&&n?o="You made a "+i.toUpperCase()+' request to "'+r+'" but '+('did not provide an `action` for route "'+n+'", ')+"so there is no way to handle the request.":i&&(o='Invalid request method "'+i.toUpperCase()+'"')),new Z8(t||500,a,new Error(o),!0)}function bS(t){for(let e=t.length-1;e>=0;e--){let r=t[e];if(ju(r))return{result:r,idx:e}}}function xB(t){let e=typeof t=="string"?pu(t):t;return Ug(wr({},e,{hash:""}))}function LL(t,e){return t.pathname!==e.pathname||t.search!==e.search?!1:t.hash===""?e.hash!=="":t.hash===e.hash?!0:e.hash!==""}function Lu(t){return t.type===yr.deferred}function Mf(t){return t.type===yr.error}function ju(t){return(t&&t.type)===yr.redirect}function jL(t){let e=t;return e&&typeof e=="object"&&typeof e.data=="object"&&typeof e.subscribe=="function"&&typeof e.cancel=="function"&&typeof e.resolveData=="function"}function UL(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function $L(t){return BL.has(t.toLowerCase())}function Ms(t){return _L.has(t.toLowerCase())}async function wS(t,e,r,n,i,s){for(let a=0;af.route.id===c.route.id),l=u!=null&&!yB(u,c)&&(s&&s[c.route.id])!==void 0;if(Lu(o)&&(i||l)){let f=n[a];Rt(f,"Expected an AbortSignal for revalidating fetcher deferred result"),await bB(o,f,i).then(d=>{d&&(r[a]=d||r[a])})}}}async function bB(t,e,r){if(r===void 0&&(r=!1),!await t.deferredData.resolveData(e)){if(r)try{return{type:yr.data,data:t.deferredData.unwrappedData}}catch(i){return{type:yr.error,error:i}}return{type:yr.data,data:t.deferredData.data}}}function J8(t){return new URLSearchParams(t).getAll("index").some(e=>e==="")}function h4(t,e){let r=typeof e=="string"?pu(e).search:e.search;if(t[t.length-1].route.index&&J8(r||""))return t[t.length-1];let n=dB(t);return n[n.length-1]}function ES(t){let{formMethod:e,formAction:r,formEncType:n,text:i,formData:s,json:a}=t;if(!(!e||!r||!n)){if(i!=null)return{formMethod:e,formAction:r,formEncType:n,formData:void 0,json:void 0,text:i};if(s!=null)return{formMethod:e,formAction:r,formEncType:n,formData:s,json:void 0,text:void 0};if(a!==void 0)return{formMethod:e,formAction:r,formEncType:n,formData:void 0,json:a,text:void 0}}}function Bx(t,e){return e?{state:"loading",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}:{state:"loading",location:t,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function zL(t,e){return{state:"submitting",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}}function v0(t,e){return t?{state:"loading",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function HL(t,e){return{state:"submitting",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e?e.data:void 0}}function uc(t){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function VL(t,e){try{let r=t.sessionStorage.getItem(vB);if(r){let n=JSON.parse(r);for(let[i,s]of Object.entries(n||{}))s&&Array.isArray(s)&&e.set(i,new Set(s||[]))}}catch{}}function qL(t,e){if(e.size>0){let r={};for(let[n,i]of e)r[n]=[...i];try{t.sessionStorage.setItem(vB,JSON.stringify(r))}catch(n){ah(!1,"Failed to save applied view transitions in sessionStorage ("+n+").")}}}/** + * React Router v6.22.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function lv(){return lv=Object.assign?Object.assign.bind():function(t){for(var e=1;e{o.current=!0}),K.useCallback(function(u,l){if(l===void 0&&(l={}),!o.current)return;if(typeof u=="number"){n.go(u);return}let f=pB(u,JSON.parse(a),s,l.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:Yf([e,f.pathname])),(l.replace?n.replace:n.push)(f,l.state,l)},[e,n,a,s,t])}var AB=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(AB||{}),CB=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(CB||{});function GL(t){let e=K.useContext(wB);return e||Rt(!1),e}function ZL(t){let e=K.useContext(Y8);return e||Rt(!1),e}function JL(t){let e=ZL(),r=e.matches[e.matches.length-1];return r.route.id||Rt(!1),r.route.id}function XL(){let{router:t}=GL(AB.UseNavigateStable),e=JL(CB.UseNavigateStable),r=K.useRef(!1);return SB(()=>{r.current=!0}),K.useCallback(function(i,s){s===void 0&&(s={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,lv({fromRouteId:e},s)))},[t,e])}function QL(t){let{basename:e="/",children:r=null,location:n,navigationType:i=Pr.Pop,navigator:s,static:a=!1,future:o}=t;e5()&&Rt(!1);let c=e.replace(/^\/*/,"/"),u=K.useMemo(()=>({basename:c,navigator:s,static:a,future:lv({v7_relativeSplatPath:!1},o)}),[c,o,s,a]);typeof n=="string"&&(n=pu(n));let{pathname:l="/",search:f="",hash:d="",state:p=null,key:h="default"}=n,g=K.useMemo(()=>{let v=$g(l,c);return v==null?null:{location:{pathname:v,search:f,hash:d,state:p,key:h},navigationType:i}},[c,l,f,d,p,h,i]);return g==null?null:K.createElement(X8.Provider,{value:u},K.createElement(Q8.Provider,{children:r,value:g}))}new Promise(()=>{});function YL(t){let e={hasErrorBoundary:t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&Object.assign(e,{element:K.createElement(t.Component),Component:void 0}),t.HydrateFallback&&Object.assign(e,{hydrateFallbackElement:K.createElement(t.HydrateFallback),HydrateFallback:void 0}),t.ErrorBoundary&&Object.assign(e,{errorElement:K.createElement(t.ErrorBoundary),ErrorBoundary:void 0}),e}/** + * React Router DOM v6.22.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function fv(){return fv=Object.assign?Object.assign.bind():function(t){for(var e=1;e{let n=t[r];return e.concat(Array.isArray(n)?n.map(i=>[r,i]):[[r,n]])},[]))}function ej(t,e){let r=p4(t);return e&&e.forEach((n,i)=>{r.has(i)||e.getAll(i).forEach(s=>{r.append(i,s)})}),r}const tj="6";try{window.__reactRouterVersion=tj}catch{}function rj(t,e){return NL({basename:e==null?void 0:e.basename,future:fv({},e==null?void 0:e.future,{v7_prependBasename:!0}),history:uB({window:e==null?void 0:e.window}),hydrationData:(e==null?void 0:e.hydrationData)||nj(),routes:t,mapRouteProperties:YL,window:e==null?void 0:e.window}).initialize()}function nj(){var t;let e=(t=window)==null?void 0:t.__staticRouterHydrationData;return e&&e.errors&&(e=fv({},e,{errors:ij(e.errors)})),e}function ij(t){if(!t)return null;let e=Object.entries(t),r={};for(let[n,i]of e)if(i&&i.__type==="RouteErrorResponse")r[n]=new Z8(i.status,i.statusText,i.data,i.internal===!0);else if(i&&i.__type==="Error"){if(i.__subType){let s=window[i.__subType];if(typeof s=="function")try{let a=new s(i.message);a.stack="",r[n]=a}catch{}}if(r[n]==null){let s=new Error(i.message);s.stack="",r[n]=s}}else r[n]=i;return r}const sj="startTransition",SS=jm[sj];function aj(t){let{basename:e,children:r,future:n,window:i}=t,s=K.useRef();s.current==null&&(s.current=uB({window:i,v5Compat:!0}));let a=s.current,[o,c]=K.useState({action:a.action,location:a.location}),{v7_startTransition:u}=n||{},l=K.useCallback(f=>{u&&SS?SS(()=>c(f)):c(f)},[c,u]);return K.useLayoutEffect(()=>a.listen(l),[a,l]),K.createElement(QL,{basename:e,children:r,location:o.location,navigationType:o.action,navigator:a,future:n})}var AS;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(AS||(AS={}));var CS;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(CS||(CS={}));function Ry(t){let e=K.useRef(p4(t)),r=K.useRef(!1),n=EB(),i=K.useMemo(()=>ej(n.search,r.current?null:e.current),[n.search]),s=KL(),a=K.useCallback((o,c)=>{const u=p4(typeof o=="function"?o(i):o);r.current=!0,s("?"+u,c)},[s,i]);return[i,a]}function D0(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var _B={exports:{}};/*! + +JSZip v3.10.1 - A JavaScript class for generating and reading zip files + + +(c) 2009-2016 Stuart Knightley +Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. + +JSZip uses the library pako released under the MIT license : +https://github.com/nodeca/pako/blob/main/LICENSE +*/(function(t,e){(function(r){t.exports=r()})(function(){return function r(n,i,s){function a(u,l){if(!i[u]){if(!n[u]){var f=typeof D0=="function"&&D0;if(!l&&f)return f(u,!0);if(o)return o(u,!0);var d=new Error("Cannot find module '"+u+"'");throw d.code="MODULE_NOT_FOUND",d}var p=i[u]={exports:{}};n[u][0].call(p.exports,function(h){var g=n[u][1][h];return a(g||h)},p,p.exports,r,n,i,s)}return i[u].exports}for(var o=typeof D0=="function"&&D0,c=0;c>2,p=(3&u)<<4|l>>4,h=1>6:64,g=2>4,l=(15&d)<<4|(p=o.indexOf(c.charAt(g++)))>>2,f=(3&p)<<6|(h=o.indexOf(c.charAt(g++))),b[v++]=u,p!==64&&(b[v++]=l),h!==64&&(b[v++]=f);return b}},{"./support":30,"./utils":32}],2:[function(r,n,i){var s=r("./external"),a=r("./stream/DataWorker"),o=r("./stream/Crc32Probe"),c=r("./stream/DataLengthProbe");function u(l,f,d,p,h){this.compressedSize=l,this.uncompressedSize=f,this.crc32=d,this.compression=p,this.compressedContent=h}u.prototype={getContentWorker:function(){var l=new a(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),f=this;return l.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),l},getCompressedWorker:function(){return new a(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(l,f,d){return l.pipe(new o).pipe(new c("uncompressedSize")).pipe(f.compressWorker(d)).pipe(new c("compressedSize")).withStreamInfo("compression",f)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,n,i){var s=r("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,n,i){var s=r("./utils"),a=function(){for(var o,c=[],u=0;u<256;u++){o=u;for(var l=0;l<8;l++)o=1&o?3988292384^o>>>1:o>>>1;c[u]=o}return c}();n.exports=function(o,c){return o!==void 0&&o.length?s.getTypeOf(o)!=="string"?function(u,l,f,d){var p=a,h=d+f;u^=-1;for(var g=d;g>>8^p[255&(u^l[g])];return-1^u}(0|c,o,o.length,0):function(u,l,f,d){var p=a,h=d+f;u^=-1;for(var g=d;g>>8^p[255&(u^l.charCodeAt(g))];return-1^u}(0|c,o,o.length,0):0}},{"./utils":32}],5:[function(r,n,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(r,n,i){var s=null;s=typeof Promise<"u"?Promise:r("lie"),n.exports={Promise:s}},{lie:37}],7:[function(r,n,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=r("pako"),o=r("./utils"),c=r("./stream/GenericWorker"),u=s?"uint8array":"array";function l(f,d){c.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=d,this.meta={}}i.magic="\b\0",o.inherits(l,c),l.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(u,f.data),!1)},l.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(d){f.push({data:d,meta:f.meta})}},i.compressWorker=function(f){return new l("Deflate",f)},i.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,n,i){function s(p,h){var g,v="";for(g=0;g>>=8;return v}function a(p,h,g,v,x,b){var S,_,P=p.file,C=p.compression,B=b!==u.utf8encode,N=o.transformTo("string",b(P.name)),T=o.transformTo("string",u.utf8encode(P.name)),D=P.comment,R=o.transformTo("string",b(D)),E=o.transformTo("string",u.utf8encode(D)),F=T.length!==P.name.length,A=E.length!==D.length,I="",j="",$="",W=P.dir,H=P.date,O={crc32:0,compressedSize:0,uncompressedSize:0};h&&!g||(O.crc32=p.crc32,O.compressedSize=p.compressedSize,O.uncompressedSize=p.uncompressedSize);var L=0;h&&(L|=8),B||!F&&!A||(L|=2048);var q=0,ee=0;W&&(q|=16),x==="UNIX"?(ee=798,q|=function(ae,ve){var de=ae;return ae||(de=ve?16893:33204),(65535&de)<<16}(P.unixPermissions,W)):(ee=20,q|=function(ae){return 63&(ae||0)}(P.dosPermissions)),S=H.getUTCHours(),S<<=6,S|=H.getUTCMinutes(),S<<=5,S|=H.getUTCSeconds()/2,_=H.getUTCFullYear()-1980,_<<=4,_|=H.getUTCMonth()+1,_<<=5,_|=H.getUTCDate(),F&&(j=s(1,1)+s(l(N),4)+T,I+="up"+s(j.length,2)+j),A&&($=s(1,1)+s(l(R),4)+E,I+="uc"+s($.length,2)+$);var X="";return X+=` +\0`,X+=s(L,2),X+=C.magic,X+=s(S,2),X+=s(_,2),X+=s(O.crc32,4),X+=s(O.compressedSize,4),X+=s(O.uncompressedSize,4),X+=s(N.length,2),X+=s(I.length,2),{fileRecord:f.LOCAL_FILE_HEADER+X+N+I,dirRecord:f.CENTRAL_FILE_HEADER+s(ee,2)+X+s(R.length,2)+"\0\0\0\0"+s(q,4)+s(v,4)+N+I+R}}var o=r("../utils"),c=r("../stream/GenericWorker"),u=r("../utf8"),l=r("../crc32"),f=r("../signature");function d(p,h,g,v){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=h,this.zipPlatform=g,this.encodeFileName=v,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(d,c),d.prototype.push=function(p){var h=p.meta.percent||0,g=this.entriesCount,v=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,c.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:g?(h+100*(g-v-1))/g:100}}))},d.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var h=this.streamFiles&&!p.file.dir;if(h){var g=a(p,h,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},d.prototype.closedSource=function(p){this.accumulate=!1;var h=this.streamFiles&&!p.file.dir,g=a(p,h,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),h)this.push({data:function(v){return f.DATA_DESCRIPTOR+s(v.crc32,4)+s(v.compressedSize,4)+s(v.uncompressedSize,4)}(p),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},d.prototype.flush=function(){for(var p=this.bytesWritten,h=0;h=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=o,u},readString:function(o){return s.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},n.exports=a},{"../utils":32}],19:[function(r,n,i){var s=r("./Uint8ArrayReader");function a(o){s.call(this,o)}r("../utils").inherits(a,s),a.prototype.readData=function(o){this.checkOffset(o);var c=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,c},n.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,i){var s=r("./DataReader");function a(o){s.call(this,o)}r("../utils").inherits(a,s),a.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},a.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},a.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},a.prototype.readData=function(o){this.checkOffset(o);var c=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,c},n.exports=a},{"../utils":32,"./DataReader":18}],21:[function(r,n,i){var s=r("./ArrayReader");function a(o){s.call(this,o)}r("../utils").inherits(a,s),a.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,c},n.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,i){var s=r("../utils"),a=r("../support"),o=r("./ArrayReader"),c=r("./StringReader"),u=r("./NodeBufferReader"),l=r("./Uint8ArrayReader");n.exports=function(f){var d=s.getTypeOf(f);return s.checkSupport(d),d!=="string"||a.uint8array?d==="nodebuffer"?new u(f):a.uint8array?new l(s.transformTo("uint8array",f)):new o(s.transformTo("array",f)):new c(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,n,i){var s=r("./GenericWorker"),a=r("../utils");function o(c){s.call(this,"ConvertWorker to "+c),this.destType=c}a.inherits(o,s),o.prototype.processChunk=function(c){this.push({data:a.transformTo(this.destType,c.data),meta:c.meta})},n.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,i){var s=r("./GenericWorker"),a=r("../crc32");function o(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(o,s),o.prototype.processChunk=function(c){this.streamInfo.crc32=a(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,i){var s=r("../utils"),a=r("./GenericWorker");function o(c){a.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}s.inherits(o,a),o.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}a.prototype.processChunk.call(this,c)},n.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,i){var s=r("../utils"),a=r("./GenericWorker");function o(c){a.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(l){u.dataIsReady=!0,u.data=l,u.max=l&&l.length||0,u.type=s.getTypeOf(l),u.isPaused||u._tickAndRepeat()},function(l){u.error(l)})}s.inherits(o,a),o.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,i){function s(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,o){return this._listeners[a].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,o){if(this._listeners[a])for(var c=0;c "+a:a}},n.exports=s},{}],29:[function(r,n,i){var s=r("../utils"),a=r("./ConvertWorker"),o=r("./GenericWorker"),c=r("../base64"),u=r("../support"),l=r("../external"),f=null;if(u.nodestream)try{f=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function d(h,g){return new l.Promise(function(v,x){var b=[],S=h._internalType,_=h._outputType,P=h._mimeType;h.on("data",function(C,B){b.push(C),g&&g(B)}).on("error",function(C){b=[],x(C)}).on("end",function(){try{var C=function(B,N,T){switch(B){case"blob":return s.newBlob(s.transformTo("arraybuffer",N),T);case"base64":return c.encode(N);default:return s.transformTo(B,N)}}(_,function(B,N){var T,D=0,R=null,E=0;for(T=0;T"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(s),i.blob=a.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!r("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,i){for(var s=r("./utils"),a=r("./support"),o=r("./nodejsUtils"),c=r("./stream/GenericWorker"),u=new Array(256),l=0;l<256;l++)u[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;u[254]=u[254]=1;function f(){c.call(this,"utf-8 decode"),this.leftOver=null}function d(){c.call(this,"utf-8 encode")}i.utf8encode=function(p){return a.nodebuffer?o.newBufferFrom(p,"utf-8"):function(h){var g,v,x,b,S,_=h.length,P=0;for(b=0;b<_;b++)(64512&(v=h.charCodeAt(b)))==55296&&b+1<_&&(64512&(x=h.charCodeAt(b+1)))==56320&&(v=65536+(v-55296<<10)+(x-56320),b++),P+=v<128?1:v<2048?2:v<65536?3:4;for(g=a.uint8array?new Uint8Array(P):new Array(P),b=S=0;S>>6:(v<65536?g[S++]=224|v>>>12:(g[S++]=240|v>>>18,g[S++]=128|v>>>12&63),g[S++]=128|v>>>6&63),g[S++]=128|63&v);return g}(p)},i.utf8decode=function(p){return a.nodebuffer?s.transformTo("nodebuffer",p).toString("utf-8"):function(h){var g,v,x,b,S=h.length,_=new Array(2*S);for(g=v=0;g>10&1023,_[v++]=56320|1023&x)}return _.length!==v&&(_.subarray?_=_.subarray(0,v):_.length=v),s.applyFromCharCode(_)}(p=s.transformTo(a.uint8array?"uint8array":"array",p))},s.inherits(f,c),f.prototype.processChunk=function(p){var h=s.transformTo(a.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var g=h;(h=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),h.set(g,this.leftOver.length)}else h=this.leftOver.concat(h);this.leftOver=null}var v=function(b,S){var _;for((S=S||b.length)>b.length&&(S=b.length),_=S-1;0<=_&&(192&b[_])==128;)_--;return _<0||_===0?S:_+u[b[_]]>S?_:S}(h),x=h;v!==h.length&&(a.uint8array?(x=h.subarray(0,v),this.leftOver=h.subarray(v,h.length)):(x=h.slice(0,v),this.leftOver=h.slice(v,h.length))),this.push({data:i.utf8decode(x),meta:p.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=f,s.inherits(d,c),d.prototype.processChunk=function(p){this.push({data:i.utf8encode(p.data),meta:p.meta})},i.Utf8EncodeWorker=d},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,i){var s=r("./support"),a=r("./base64"),o=r("./nodejsUtils"),c=r("./external");function u(g){return g}function l(g,v){for(var x=0;x>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=s(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var h,g,v,x=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4>>6:(p<65536?d[v++]=224|p>>>12:(d[v++]=240|p>>>18,d[v++]=128|p>>>12&63),d[v++]=128|p>>>6&63),d[v++]=128|63&p);return d},i.buf2binstring=function(f){return l(f,f.length)},i.binstring2buf=function(f){for(var d=new s.Buf8(f.length),p=0,h=d.length;p>10&1023,b[h++]=56320|1023&g)}return l(b,h)},i.utf8border=function(f,d){var p;for((d=d||f.length)>f.length&&(d=f.length),p=d-1;0<=p&&(192&f[p])==128;)p--;return p<0||p===0?d:p+c[f[p]]>d?p:d}},{"./common":41}],43:[function(r,n,i){n.exports=function(s,a,o,c){for(var u=65535&s|0,l=s>>>16&65535|0,f=0;o!==0;){for(o-=f=2e3>>1:a>>>1;o[c]=a}return o}();n.exports=function(a,o,c,u){var l=s,f=u+c;a^=-1;for(var d=u;d>>8^l[255&(a^o[d])];return-1^a}},{}],46:[function(r,n,i){var s,a=r("../utils/common"),o=r("./trees"),c=r("./adler32"),u=r("./crc32"),l=r("./messages"),f=0,d=4,p=0,h=-2,g=-1,v=4,x=2,b=8,S=9,_=286,P=30,C=19,B=2*_+1,N=15,T=3,D=258,R=D+T+1,E=42,F=113,A=1,I=2,j=3,$=4;function W(V,le){return V.msg=l[le],le}function H(V){return(V<<1)-(4V.avail_out&&(ce=V.avail_out),ce!==0&&(a.arraySet(V.output,le.pending_buf,le.pending_out,ce,V.next_out),V.next_out+=ce,le.pending_out+=ce,V.total_out+=ce,V.avail_out-=ce,le.pending-=ce,le.pending===0&&(le.pending_out=0))}function q(V,le){o._tr_flush_block(V,0<=V.block_start?V.block_start:-1,V.strstart-V.block_start,le),V.block_start=V.strstart,L(V.strm)}function ee(V,le){V.pending_buf[V.pending++]=le}function X(V,le){V.pending_buf[V.pending++]=le>>>8&255,V.pending_buf[V.pending++]=255&le}function ae(V,le){var ce,Y,J=V.max_chain_length,ne=V.strstart,xe=V.prev_length,he=V.nice_match,re=V.strstart>V.w_size-R?V.strstart-(V.w_size-R):0,ke=V.window,be=V.w_mask,ge=V.prev,Re=V.strstart+D,m=ke[ne+xe-1],y=ke[ne+xe];V.prev_length>=V.good_match&&(J>>=2),he>V.lookahead&&(he=V.lookahead);do if(ke[(ce=le)+xe]===y&&ke[ce+xe-1]===m&&ke[ce]===ke[ne]&&ke[++ce]===ke[ne+1]){ne+=2,ce++;do;while(ke[++ne]===ke[++ce]&&ke[++ne]===ke[++ce]&&ke[++ne]===ke[++ce]&&ke[++ne]===ke[++ce]&&ke[++ne]===ke[++ce]&&ke[++ne]===ke[++ce]&&ke[++ne]===ke[++ce]&&ke[++ne]===ke[++ce]&&nere&&--J!=0);return xe<=V.lookahead?xe:V.lookahead}function ve(V){var le,ce,Y,J,ne,xe,he,re,ke,be,ge=V.w_size;do{if(J=V.window_size-V.lookahead-V.strstart,V.strstart>=ge+(ge-R)){for(a.arraySet(V.window,V.window,ge,ge,0),V.match_start-=ge,V.strstart-=ge,V.block_start-=ge,le=ce=V.hash_size;Y=V.head[--le],V.head[le]=ge<=Y?Y-ge:0,--ce;);for(le=ce=ge;Y=V.prev[--le],V.prev[le]=ge<=Y?Y-ge:0,--ce;);J+=ge}if(V.strm.avail_in===0)break;if(xe=V.strm,he=V.window,re=V.strstart+V.lookahead,ke=J,be=void 0,be=xe.avail_in,ke=T)for(ne=V.strstart-V.insert,V.ins_h=V.window[ne],V.ins_h=(V.ins_h<=T&&(V.ins_h=(V.ins_h<=T)if(Y=o._tr_tally(V,V.strstart-V.match_start,V.match_length-T),V.lookahead-=V.match_length,V.match_length<=V.max_lazy_match&&V.lookahead>=T){for(V.match_length--;V.strstart++,V.ins_h=(V.ins_h<=T&&(V.ins_h=(V.ins_h<=T&&V.match_length<=V.prev_length){for(J=V.strstart+V.lookahead-T,Y=o._tr_tally(V,V.strstart-1-V.prev_match,V.prev_length-T),V.lookahead-=V.prev_length-1,V.prev_length-=2;++V.strstart<=J&&(V.ins_h=(V.ins_h<V.pending_buf_size-5&&(ce=V.pending_buf_size-5);;){if(V.lookahead<=1){if(ve(V),V.lookahead===0&&le===f)return A;if(V.lookahead===0)break}V.strstart+=V.lookahead,V.lookahead=0;var Y=V.block_start+ce;if((V.strstart===0||V.strstart>=Y)&&(V.lookahead=V.strstart-Y,V.strstart=Y,q(V,!1),V.strm.avail_out===0)||V.strstart-V.block_start>=V.w_size-R&&(q(V,!1),V.strm.avail_out===0))return A}return V.insert=0,le===d?(q(V,!0),V.strm.avail_out===0?j:$):(V.strstart>V.block_start&&(q(V,!1),V.strm.avail_out),A)}),new we(4,4,8,4,de),new we(4,5,16,8,de),new we(4,6,32,32,de),new we(4,4,16,16,pe),new we(8,16,32,32,pe),new we(8,16,128,128,pe),new we(8,32,128,256,pe),new we(32,128,258,1024,pe),new we(32,258,258,4096,pe)],i.deflateInit=function(V,le){return De(V,le,b,15,8,0)},i.deflateInit2=De,i.deflateReset=Fe,i.deflateResetKeep=Me,i.deflateSetHeader=function(V,le){return V&&V.state?V.state.wrap!==2?h:(V.state.gzhead=le,p):h},i.deflate=function(V,le){var ce,Y,J,ne;if(!V||!V.state||5>8&255),ee(Y,Y.gzhead.time>>16&255),ee(Y,Y.gzhead.time>>24&255),ee(Y,Y.level===9?2:2<=Y.strategy||Y.level<2?4:0),ee(Y,255&Y.gzhead.os),Y.gzhead.extra&&Y.gzhead.extra.length&&(ee(Y,255&Y.gzhead.extra.length),ee(Y,Y.gzhead.extra.length>>8&255)),Y.gzhead.hcrc&&(V.adler=u(V.adler,Y.pending_buf,Y.pending,0)),Y.gzindex=0,Y.status=69):(ee(Y,0),ee(Y,0),ee(Y,0),ee(Y,0),ee(Y,0),ee(Y,Y.level===9?2:2<=Y.strategy||Y.level<2?4:0),ee(Y,3),Y.status=F);else{var xe=b+(Y.w_bits-8<<4)<<8;xe|=(2<=Y.strategy||Y.level<2?0:Y.level<6?1:Y.level===6?2:3)<<6,Y.strstart!==0&&(xe|=32),xe+=31-xe%31,Y.status=F,X(Y,xe),Y.strstart!==0&&(X(Y,V.adler>>>16),X(Y,65535&V.adler)),V.adler=1}if(Y.status===69)if(Y.gzhead.extra){for(J=Y.pending;Y.gzindex<(65535&Y.gzhead.extra.length)&&(Y.pending!==Y.pending_buf_size||(Y.gzhead.hcrc&&Y.pending>J&&(V.adler=u(V.adler,Y.pending_buf,Y.pending-J,J)),L(V),J=Y.pending,Y.pending!==Y.pending_buf_size));)ee(Y,255&Y.gzhead.extra[Y.gzindex]),Y.gzindex++;Y.gzhead.hcrc&&Y.pending>J&&(V.adler=u(V.adler,Y.pending_buf,Y.pending-J,J)),Y.gzindex===Y.gzhead.extra.length&&(Y.gzindex=0,Y.status=73)}else Y.status=73;if(Y.status===73)if(Y.gzhead.name){J=Y.pending;do{if(Y.pending===Y.pending_buf_size&&(Y.gzhead.hcrc&&Y.pending>J&&(V.adler=u(V.adler,Y.pending_buf,Y.pending-J,J)),L(V),J=Y.pending,Y.pending===Y.pending_buf_size)){ne=1;break}ne=Y.gzindexJ&&(V.adler=u(V.adler,Y.pending_buf,Y.pending-J,J)),ne===0&&(Y.gzindex=0,Y.status=91)}else Y.status=91;if(Y.status===91)if(Y.gzhead.comment){J=Y.pending;do{if(Y.pending===Y.pending_buf_size&&(Y.gzhead.hcrc&&Y.pending>J&&(V.adler=u(V.adler,Y.pending_buf,Y.pending-J,J)),L(V),J=Y.pending,Y.pending===Y.pending_buf_size)){ne=1;break}ne=Y.gzindexJ&&(V.adler=u(V.adler,Y.pending_buf,Y.pending-J,J)),ne===0&&(Y.status=103)}else Y.status=103;if(Y.status===103&&(Y.gzhead.hcrc?(Y.pending+2>Y.pending_buf_size&&L(V),Y.pending+2<=Y.pending_buf_size&&(ee(Y,255&V.adler),ee(Y,V.adler>>8&255),V.adler=0,Y.status=F)):Y.status=F),Y.pending!==0){if(L(V),V.avail_out===0)return Y.last_flush=-1,p}else if(V.avail_in===0&&H(le)<=H(ce)&&le!==d)return W(V,-5);if(Y.status===666&&V.avail_in!==0)return W(V,-5);if(V.avail_in!==0||Y.lookahead!==0||le!==f&&Y.status!==666){var he=Y.strategy===2?function(re,ke){for(var be;;){if(re.lookahead===0&&(ve(re),re.lookahead===0)){if(ke===f)return A;break}if(re.match_length=0,be=o._tr_tally(re,0,re.window[re.strstart]),re.lookahead--,re.strstart++,be&&(q(re,!1),re.strm.avail_out===0))return A}return re.insert=0,ke===d?(q(re,!0),re.strm.avail_out===0?j:$):re.last_lit&&(q(re,!1),re.strm.avail_out===0)?A:I}(Y,le):Y.strategy===3?function(re,ke){for(var be,ge,Re,m,y=re.window;;){if(re.lookahead<=D){if(ve(re),re.lookahead<=D&&ke===f)return A;if(re.lookahead===0)break}if(re.match_length=0,re.lookahead>=T&&0re.lookahead&&(re.match_length=re.lookahead)}if(re.match_length>=T?(be=o._tr_tally(re,1,re.match_length-T),re.lookahead-=re.match_length,re.strstart+=re.match_length,re.match_length=0):(be=o._tr_tally(re,0,re.window[re.strstart]),re.lookahead--,re.strstart++),be&&(q(re,!1),re.strm.avail_out===0))return A}return re.insert=0,ke===d?(q(re,!0),re.strm.avail_out===0?j:$):re.last_lit&&(q(re,!1),re.strm.avail_out===0)?A:I}(Y,le):s[Y.level].func(Y,le);if(he!==j&&he!==$||(Y.status=666),he===A||he===j)return V.avail_out===0&&(Y.last_flush=-1),p;if(he===I&&(le===1?o._tr_align(Y):le!==5&&(o._tr_stored_block(Y,0,0,!1),le===3&&(O(Y.head),Y.lookahead===0&&(Y.strstart=0,Y.block_start=0,Y.insert=0))),L(V),V.avail_out===0))return Y.last_flush=-1,p}return le!==d?p:Y.wrap<=0?1:(Y.wrap===2?(ee(Y,255&V.adler),ee(Y,V.adler>>8&255),ee(Y,V.adler>>16&255),ee(Y,V.adler>>24&255),ee(Y,255&V.total_in),ee(Y,V.total_in>>8&255),ee(Y,V.total_in>>16&255),ee(Y,V.total_in>>24&255)):(X(Y,V.adler>>>16),X(Y,65535&V.adler)),L(V),0=ce.w_size&&(ne===0&&(O(ce.head),ce.strstart=0,ce.block_start=0,ce.insert=0),ke=new a.Buf8(ce.w_size),a.arraySet(ke,le,be-ce.w_size,ce.w_size,0),le=ke,be=ce.w_size),xe=V.avail_in,he=V.next_in,re=V.input,V.avail_in=be,V.next_in=0,V.input=le,ve(ce);ce.lookahead>=T;){for(Y=ce.strstart,J=ce.lookahead-(T-1);ce.ins_h=(ce.ins_h<>>=T=N>>>24,S-=T,(T=N>>>16&255)===0)I[l++]=65535&N;else{if(!(16&T)){if(!(64&T)){N=_[(65535&N)+(b&(1<>>=T,S-=T),S<15&&(b+=A[c++]<>>=T=N>>>24,S-=T,!(16&(T=N>>>16&255))){if(!(64&T)){N=P[(65535&N)+(b&(1<>>=T,S-=T,(T=l-f)>3,b&=(1<<(S-=D<<3))-1,s.next_in=c,s.next_out=l,s.avail_in=c>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<24)}function b(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function S(E){var F;return E&&E.state?(F=E.state,E.total_in=E.total_out=F.total=0,E.msg="",F.wrap&&(E.adler=1&F.wrap),F.mode=h,F.last=0,F.havedict=0,F.dmax=32768,F.head=null,F.hold=0,F.bits=0,F.lencode=F.lendyn=new s.Buf32(g),F.distcode=F.distdyn=new s.Buf32(v),F.sane=1,F.back=-1,d):p}function _(E){var F;return E&&E.state?((F=E.state).wsize=0,F.whave=0,F.wnext=0,S(E)):p}function P(E,F){var A,I;return E&&E.state?(I=E.state,F<0?(A=0,F=-F):(A=1+(F>>4),F<48&&(F&=15)),F&&(F<8||15=$.wsize?(s.arraySet($.window,F,A-$.wsize,$.wsize,0),$.wnext=0,$.whave=$.wsize):(I<(j=$.wsize-$.wnext)&&(j=I),s.arraySet($.window,F,A-I,j,$.wnext),(I-=j)?(s.arraySet($.window,F,A-I,I,0),$.wnext=I,$.whave=$.wsize):($.wnext+=j,$.wnext===$.wsize&&($.wnext=0),$.whave<$.wsize&&($.whave+=j))),0}i.inflateReset=_,i.inflateReset2=P,i.inflateResetKeep=S,i.inflateInit=function(E){return C(E,15)},i.inflateInit2=C,i.inflate=function(E,F){var A,I,j,$,W,H,O,L,q,ee,X,ae,ve,de,pe,we,_e,Me,Fe,De,V,le,ce,Y,J=0,ne=new s.Buf8(4),xe=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!E||!E.state||!E.output||!E.input&&E.avail_in!==0)return p;(A=E.state).mode===12&&(A.mode=13),W=E.next_out,j=E.output,O=E.avail_out,$=E.next_in,I=E.input,H=E.avail_in,L=A.hold,q=A.bits,ee=H,X=O,le=d;e:for(;;)switch(A.mode){case h:if(A.wrap===0){A.mode=13;break}for(;q<16;){if(H===0)break e;H--,L+=I[$++]<>>8&255,A.check=o(A.check,ne,2,0),q=L=0,A.mode=2;break}if(A.flags=0,A.head&&(A.head.done=!1),!(1&A.wrap)||(((255&L)<<8)+(L>>8))%31){E.msg="incorrect header check",A.mode=30;break}if((15&L)!=8){E.msg="unknown compression method",A.mode=30;break}if(q-=4,V=8+(15&(L>>>=4)),A.wbits===0)A.wbits=V;else if(V>A.wbits){E.msg="invalid window size",A.mode=30;break}A.dmax=1<>8&1),512&A.flags&&(ne[0]=255&L,ne[1]=L>>>8&255,A.check=o(A.check,ne,2,0)),q=L=0,A.mode=3;case 3:for(;q<32;){if(H===0)break e;H--,L+=I[$++]<>>8&255,ne[2]=L>>>16&255,ne[3]=L>>>24&255,A.check=o(A.check,ne,4,0)),q=L=0,A.mode=4;case 4:for(;q<16;){if(H===0)break e;H--,L+=I[$++]<>8),512&A.flags&&(ne[0]=255&L,ne[1]=L>>>8&255,A.check=o(A.check,ne,2,0)),q=L=0,A.mode=5;case 5:if(1024&A.flags){for(;q<16;){if(H===0)break e;H--,L+=I[$++]<>>8&255,A.check=o(A.check,ne,2,0)),q=L=0}else A.head&&(A.head.extra=null);A.mode=6;case 6:if(1024&A.flags&&(H<(ae=A.length)&&(ae=H),ae&&(A.head&&(V=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Array(A.head.extra_len)),s.arraySet(A.head.extra,I,$,ae,V)),512&A.flags&&(A.check=o(A.check,I,ae,$)),H-=ae,$+=ae,A.length-=ae),A.length))break e;A.length=0,A.mode=7;case 7:if(2048&A.flags){if(H===0)break e;for(ae=0;V=I[$+ae++],A.head&&V&&A.length<65536&&(A.head.name+=String.fromCharCode(V)),V&&ae>9&1,A.head.done=!0),E.adler=A.check=0,A.mode=12;break;case 10:for(;q<32;){if(H===0)break e;H--,L+=I[$++]<>>=7&q,q-=7&q,A.mode=27;break}for(;q<3;){if(H===0)break e;H--,L+=I[$++]<>>=1)){case 0:A.mode=14;break;case 1:if(D(A),A.mode=20,F!==6)break;L>>>=2,q-=2;break e;case 2:A.mode=17;break;case 3:E.msg="invalid block type",A.mode=30}L>>>=2,q-=2;break;case 14:for(L>>>=7&q,q-=7&q;q<32;){if(H===0)break e;H--,L+=I[$++]<>>16^65535)){E.msg="invalid stored block lengths",A.mode=30;break}if(A.length=65535&L,q=L=0,A.mode=15,F===6)break e;case 15:A.mode=16;case 16:if(ae=A.length){if(H>>=5,q-=5,A.ndist=1+(31&L),L>>>=5,q-=5,A.ncode=4+(15&L),L>>>=4,q-=4,286>>=3,q-=3}for(;A.have<19;)A.lens[xe[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,ce={bits:A.lenbits},le=u(0,A.lens,0,19,A.lencode,0,A.work,ce),A.lenbits=ce.bits,le){E.msg="invalid code lengths set",A.mode=30;break}A.have=0,A.mode=19;case 19:for(;A.have>>16&255,_e=65535&J,!((pe=J>>>24)<=q);){if(H===0)break e;H--,L+=I[$++]<>>=pe,q-=pe,A.lens[A.have++]=_e;else{if(_e===16){for(Y=pe+2;q>>=pe,q-=pe,A.have===0){E.msg="invalid bit length repeat",A.mode=30;break}V=A.lens[A.have-1],ae=3+(3&L),L>>>=2,q-=2}else if(_e===17){for(Y=pe+3;q>>=pe)),L>>>=3,q-=3}else{for(Y=pe+7;q>>=pe)),L>>>=7,q-=7}if(A.have+ae>A.nlen+A.ndist){E.msg="invalid bit length repeat",A.mode=30;break}for(;ae--;)A.lens[A.have++]=V}}if(A.mode===30)break;if(A.lens[256]===0){E.msg="invalid code -- missing end-of-block",A.mode=30;break}if(A.lenbits=9,ce={bits:A.lenbits},le=u(l,A.lens,0,A.nlen,A.lencode,0,A.work,ce),A.lenbits=ce.bits,le){E.msg="invalid literal/lengths set",A.mode=30;break}if(A.distbits=6,A.distcode=A.distdyn,ce={bits:A.distbits},le=u(f,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,ce),A.distbits=ce.bits,le){E.msg="invalid distances set",A.mode=30;break}if(A.mode=20,F===6)break e;case 20:A.mode=21;case 21:if(6<=H&&258<=O){E.next_out=W,E.avail_out=O,E.next_in=$,E.avail_in=H,A.hold=L,A.bits=q,c(E,X),W=E.next_out,j=E.output,O=E.avail_out,$=E.next_in,I=E.input,H=E.avail_in,L=A.hold,q=A.bits,A.mode===12&&(A.back=-1);break}for(A.back=0;we=(J=A.lencode[L&(1<>>16&255,_e=65535&J,!((pe=J>>>24)<=q);){if(H===0)break e;H--,L+=I[$++]<>Me)])>>>16&255,_e=65535&J,!(Me+(pe=J>>>24)<=q);){if(H===0)break e;H--,L+=I[$++]<>>=Me,q-=Me,A.back+=Me}if(L>>>=pe,q-=pe,A.back+=pe,A.length=_e,we===0){A.mode=26;break}if(32&we){A.back=-1,A.mode=12;break}if(64&we){E.msg="invalid literal/length code",A.mode=30;break}A.extra=15&we,A.mode=22;case 22:if(A.extra){for(Y=A.extra;q>>=A.extra,q-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=23;case 23:for(;we=(J=A.distcode[L&(1<>>16&255,_e=65535&J,!((pe=J>>>24)<=q);){if(H===0)break e;H--,L+=I[$++]<>Me)])>>>16&255,_e=65535&J,!(Me+(pe=J>>>24)<=q);){if(H===0)break e;H--,L+=I[$++]<>>=Me,q-=Me,A.back+=Me}if(L>>>=pe,q-=pe,A.back+=pe,64&we){E.msg="invalid distance code",A.mode=30;break}A.offset=_e,A.extra=15&we,A.mode=24;case 24:if(A.extra){for(Y=A.extra;q>>=A.extra,q-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){E.msg="invalid distance too far back",A.mode=30;break}A.mode=25;case 25:if(O===0)break e;if(ae=X-O,A.offset>ae){if((ae=A.offset-ae)>A.whave&&A.sane){E.msg="invalid distance too far back",A.mode=30;break}ve=ae>A.wnext?(ae-=A.wnext,A.wsize-ae):A.wnext-ae,ae>A.length&&(ae=A.length),de=A.window}else de=j,ve=W-A.offset,ae=A.length;for(OB?(T=ve[de+v[F]],q[ee+v[F]]):(T=96,0),b=1<>W)+(S-=b)]=N<<24|T<<16|D|0,S!==0;);for(b=1<>=1;if(b!==0?(L&=b-1,L+=b):L=0,F++,--X[E]==0){if(E===I)break;E=f[d+v[F]]}if(j>>7)]}function ee(J,ne){J.pending_buf[J.pending++]=255&ne,J.pending_buf[J.pending++]=ne>>>8&255}function X(J,ne,xe){J.bi_valid>x-xe?(J.bi_buf|=ne<>x-J.bi_valid,J.bi_valid+=xe-x):(J.bi_buf|=ne<>>=1,xe<<=1,0<--ne;);return xe>>>1}function de(J,ne,xe){var he,re,ke=new Array(v+1),be=0;for(he=1;he<=v;he++)ke[he]=be=be+xe[he-1]<<1;for(re=0;re<=ne;re++){var ge=J[2*re+1];ge!==0&&(J[2*re]=ve(ke[ge]++,ge))}}function pe(J){var ne;for(ne=0;ne>1;1<=xe;xe--)Me(J,ke,xe);for(re=Re;xe=J.heap[1],J.heap[1]=J.heap[J.heap_len--],Me(J,ke,1),he=J.heap[1],J.heap[--J.heap_max]=xe,J.heap[--J.heap_max]=he,ke[2*re]=ke[2*xe]+ke[2*he],J.depth[re]=(J.depth[xe]>=J.depth[he]?J.depth[xe]:J.depth[he])+1,ke[2*xe+1]=ke[2*he+1]=re,J.heap[1]=re++,Me(J,ke,1),2<=J.heap_len;);J.heap[--J.heap_max]=J.heap[1],function(y,w){var M,z,G,Z,Se,Ve,Pe=w.dyn_tree,Te=w.max_code,ze=w.stat_desc.static_tree,Wt=w.stat_desc.has_stree,Gt=w.stat_desc.extra_bits,ra=w.stat_desc.extra_base,Mt=w.stat_desc.max_length,ie=0;for(Z=0;Z<=v;Z++)y.bl_count[Z]=0;for(Pe[2*y.heap[y.heap_max]+1]=0,M=y.heap_max+1;M>=7;re>>=1)if(1&m&&ge.dyn_ltree[2*Re]!==0)return a;if(ge.dyn_ltree[18]!==0||ge.dyn_ltree[20]!==0||ge.dyn_ltree[26]!==0)return o;for(Re=32;Re>>3,(ke=J.static_len+3+7>>>3)<=re&&(re=ke)):re=ke=xe+5,xe+4<=re&&ne!==-1?Y(J,ne,xe,he):J.strategy===4||ke===re?(X(J,2+(he?1:0),3),Fe(J,R,E)):(X(J,4+(he?1:0),3),function(ge,Re,m,y){var w;for(X(ge,Re-257,5),X(ge,m-1,5),X(ge,y-4,4),w=0;w>>8&255,J.pending_buf[J.d_buf+2*J.last_lit+1]=255&ne,J.pending_buf[J.l_buf+J.last_lit]=255&xe,J.last_lit++,ne===0?J.dyn_ltree[2*xe]++:(J.matches++,ne--,J.dyn_ltree[2*(A[xe]+f+1)]++,J.dyn_dtree[2*q(ne)]++),J.last_lit===J.lit_bufsize-1},i._tr_align=function(J){X(J,2,3),ae(J,S,R),function(ne){ne.bi_valid===16?(ee(ne,ne.bi_buf),ne.bi_buf=0,ne.bi_valid=0):8<=ne.bi_valid&&(ne.pending_buf[ne.pending++]=255&ne.bi_buf,ne.bi_buf>>=8,ne.bi_valid-=8)}(J)}},{"../utils/common":41}],53:[function(r,n,i){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(r,n,i){(function(s){(function(a,o){if(!a.setImmediate){var c,u,l,f,d=1,p={},h=!1,g=a.document,v=Object.getPrototypeOf&&Object.getPrototypeOf(a);v=v&&v.setTimeout?v:a,c={}.toString.call(a.process)==="[object process]"?function(_){process.nextTick(function(){b(_)})}:function(){if(a.postMessage&&!a.importScripts){var _=!0,P=a.onmessage;return a.onmessage=function(){_=!1},a.postMessage("","*"),a.onmessage=P,_}}()?(f="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",S,!1):a.attachEvent("onmessage",S),function(_){a.postMessage(f+_,"*")}):a.MessageChannel?((l=new MessageChannel).port1.onmessage=function(_){b(_.data)},function(_){l.port2.postMessage(_)}):g&&"onreadystatechange"in g.createElement("script")?(u=g.documentElement,function(_){var P=g.createElement("script");P.onreadystatechange=function(){b(_),P.onreadystatechange=null,u.removeChild(P),P=null},u.appendChild(P)}):function(_){setTimeout(b,0,_)},v.setImmediate=function(_){typeof _!="function"&&(_=new Function(""+_));for(var P=new Array(arguments.length-1),C=0;C"u"?s===void 0?this:s:self)}).call(this,typeof it<"u"?it:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(_B);var oj=_B.exports;const cj=Hl(oj);var kB={exports:{}};(function(t,e){(function(r,n){n()})(it,function(){function r(u,l){return typeof l>"u"?l={autoBom:!1}:typeof l!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),l={autoBom:!l}),l.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(u.type)?new Blob(["\uFEFF",u],{type:u.type}):u}function n(u,l,f){var d=new XMLHttpRequest;d.open("GET",u),d.responseType="blob",d.onload=function(){c(d.response,l,f)},d.onerror=function(){console.error("could not download file")},d.send()}function i(u){var l=new XMLHttpRequest;l.open("HEAD",u,!1);try{l.send()}catch{}return 200<=l.status&&299>=l.status}function s(u){try{u.dispatchEvent(new MouseEvent("click"))}catch{var l=document.createEvent("MouseEvents");l.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),u.dispatchEvent(l)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof it=="object"&&it.global===it?it:void 0,o=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),c=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!o?function(u,l,f){var d=a.URL||a.webkitURL,p=document.createElement("a");l=l||u.name||"download",p.download=l,p.rel="noopener",typeof u=="string"?(p.href=u,p.origin===location.origin?s(p):i(p.href)?n(u,l,f):s(p,p.target="_blank")):(p.href=d.createObjectURL(u),setTimeout(function(){d.revokeObjectURL(p.href)},4e4),setTimeout(function(){s(p)},0))}:"msSaveOrOpenBlob"in navigator?function(u,l,f){if(l=l||u.name||"download",typeof u!="string")navigator.msSaveOrOpenBlob(r(u,f),l);else if(i(u))n(u,l,f);else{var d=document.createElement("a");d.href=u,d.target="_blank",setTimeout(function(){s(d)})}}:function(u,l,f,d){if(d=d||open("","_blank"),d&&(d.document.title=d.document.body.innerText="downloading..."),typeof u=="string")return n(u,l,f);var p=u.type==="application/octet-stream",h=/constructor/i.test(a.HTMLElement)||a.safari,g=/CriOS\/[\d]+/.test(navigator.userAgent);if((g||p&&h||o)&&typeof FileReader<"u"){var v=new FileReader;v.onloadend=function(){var S=v.result;S=g?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),d?d.location.href=S:location=S,d=null},v.readAsDataURL(u)}else{var x=a.URL||a.webkitURL,b=x.createObjectURL(u);d?d.location=b:location.href=b,d=null,setTimeout(function(){x.revokeObjectURL(b)},4e4)}});a.saveAs=c.saveAs=c,t.exports=c})})(kB);var uj=kB.exports;const lj=Hl(uj);function Pt(){return Pt=Object.assign?Object.assign.bind():function(t){for(var e=1;et.forEach(r=>fj(r,e))}function pn(...t){return K.useCallback(BB(...t),t)}function Dy(t,e=[]){let r=[];function n(s,a){const o=K.createContext(a),c=r.length;r=[...r,a];function u(f){const{scope:d,children:p,...h}=f,g=(d==null?void 0:d[t][c])||o,v=K.useMemo(()=>h,Object.values(h));return K.createElement(g.Provider,{value:v},p)}function l(f,d){const p=(d==null?void 0:d[t][c])||o,h=K.useContext(p);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,l]}const i=()=>{const s=r.map(a=>K.createContext(a));return function(o){const c=(o==null?void 0:o[t])||s;return K.useMemo(()=>({[`__scope${t}`]:{...o,[t]:c}}),[o,c])}};return i.scopeName=t,[n,dj(i,...e)]}function dj(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const a=n.reduce((o,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...o,...f}},{});return K.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}function Ro(t){const e=K.useRef(t);return K.useEffect(()=>{e.current=t}),K.useMemo(()=>(...r)=>{var n;return(n=e.current)===null||n===void 0?void 0:n.call(e,...r)},[])}function g4({prop:t,defaultProp:e,onChange:r=()=>{}}){const[n,i]=hj({defaultProp:e,onChange:r}),s=t!==void 0,a=s?t:n,o=Ro(r),c=K.useCallback(u=>{if(s){const f=typeof u=="function"?u(t):u;f!==t&&o(f)}else i(u)},[s,t,i,o]);return[a,c]}function hj({defaultProp:t,onChange:e}){const r=K.useState(t),[n]=r,i=K.useRef(n),s=Ro(e);return K.useEffect(()=>{i.current!==n&&(s(n),i.current=n)},[n,i,s]),r}function IB(t){const e=K.useRef({value:t,previous:t});return K.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}const cs=globalThis!=null&&globalThis.document?K.useLayoutEffect:()=>{};function FB(t){const[e,r]=K.useState(void 0);return cs(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const n=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let a,o;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,o=u.blockSize}else a=t.offsetWidth,o=t.offsetHeight;r({width:a,height:o})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}const oh=K.forwardRef((t,e)=>{const{children:r,...n}=t,i=K.Children.toArray(r),s=i.find(gj);if(s){const a=s.props.children,o=i.map(c=>c===s?K.Children.count(a)>1?K.Children.only(null):K.isValidElement(a)?a.props.children:null:c);return K.createElement(m4,Pt({},n,{ref:e}),K.isValidElement(a)?K.cloneElement(a,void 0,o):null)}return K.createElement(m4,Pt({},n,{ref:e}),r)});oh.displayName="Slot";const m4=K.forwardRef((t,e)=>{const{children:r,...n}=t;return K.isValidElement(r)?K.cloneElement(r,{...mj(n,r.props),ref:e?BB(e,r.ref):r.ref}):K.Children.count(r)>1?K.Children.only(null):null});m4.displayName="SlotClone";const pj=({children:t})=>K.createElement(K.Fragment,null,t);function gj(t){return K.isValidElement(t)&&t.type===pj}function mj(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...o)=>{s(...o),i(...o)}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}const vj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Hr=vj.reduce((t,e)=>{const r=K.forwardRef((n,i)=>{const{asChild:s,...a}=n,o=s?oh:e;return K.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),K.createElement(o,Pt({},a,{ref:i}))});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function yj(t,e){t&&$h.flushSync(()=>t.dispatchEvent(e))}const PB="Switch",[xj,o0e]=Dy(PB),[bj,wj]=xj(PB),Ej=K.forwardRef((t,e)=>{const{__scopeSwitch:r,name:n,checked:i,defaultChecked:s,required:a,disabled:o,value:c="on",onCheckedChange:u,...l}=t,[f,d]=K.useState(null),p=pn(e,b=>d(b)),h=K.useRef(!1),g=f?!!f.closest("form"):!0,[v=!1,x]=g4({prop:i,defaultProp:s,onChange:u});return K.createElement(bj,{scope:r,checked:v,disabled:o},K.createElement(Hr.button,Pt({type:"button",role:"switch","aria-checked":v,"aria-required":a,"data-state":TB(v),"data-disabled":o?"":void 0,disabled:o,value:c},l,{ref:p,onClick:$r(t.onClick,b=>{x(S=>!S),g&&(h.current=b.isPropagationStopped(),h.current||b.stopPropagation())})})),g&&K.createElement(Cj,{control:f,bubbles:!h.current,name:n,value:c,checked:v,required:a,disabled:o,style:{transform:"translateX(-100%)"}}))}),Sj="SwitchThumb",Aj=K.forwardRef((t,e)=>{const{__scopeSwitch:r,...n}=t,i=wj(Sj,r);return K.createElement(Hr.span,Pt({"data-state":TB(i.checked),"data-disabled":i.disabled?"":void 0},n,{ref:e}))}),Cj=t=>{const{control:e,checked:r,bubbles:n=!0,...i}=t,s=K.useRef(null),a=IB(r),o=FB(e);return K.useEffect(()=>{const c=s.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(a!==r&&f){const d=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(d)}},[a,r,n]),K.createElement("input",Pt({type:"checkbox","aria-hidden":!0,defaultChecked:r},i,{tabIndex:-1,ref:s,style:{...t.style,...o,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function TB(t){return t?"checked":"unchecked"}const NB=Ej,_j=Aj;function RB(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;eo(s)))==null?void 0:a.classGroupId}const _S=/^\[(.+)\]$/;function Ij(t){if(_S.test(t)){const e=_S.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}}function Fj(t){const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return Tj(Object.entries(t.classGroups),r).forEach(([s,a])=>{v4(a,n,s,e)}),n}function v4(t,e,r,n){t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:kS(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(Pj(i)){v4(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,a])=>{v4(a,kS(e,s),r,n)})})}function kS(t,e){let r=t;return e.split(t5).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r}function Pj(t){return t.isThemeGetter}function Tj(t,e){return e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([a,o])=>[e+a,o])):s);return[r,i]}):t}function Nj(t){if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;function i(s,a){r.set(s,a),e++,e>t&&(e=0,n=r,r=new Map)}return{get(s){let a=r.get(s);if(a!==void 0)return a;if((a=n.get(s))!==void 0)return i(s,a),a},set(s,a){r.has(s)?r.set(s,a):i(s,a)}}}const OB="!";function Rj(t){const e=t.separator,r=e.length===1,n=e[0],i=e.length;return function(a){const o=[];let c=0,u=0,l;for(let g=0;gu?l-u:void 0;return{modifiers:o,hasImportantModifier:d,baseClassName:p,maybePostfixModifierPosition:h}}}function Dj(t){if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e}function Oj(t){return{cache:Nj(t.cacheSize),splitModifiers:Rj(t),...Bj(t)}}const Mj=/\s+/;function Lj(t,e){const{splitModifiers:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=new Set;return t.trim().split(Mj).map(a=>{const{modifiers:o,hasImportantModifier:c,baseClassName:u,maybePostfixModifierPosition:l}=r(a);let f=n(l?u.substring(0,l):u),d=!!l;if(!f){if(!l)return{isTailwindClass:!1,originalClassName:a};if(f=n(u),!f)return{isTailwindClass:!1,originalClassName:a};d=!1}const p=Dj(o).join(":");return{isTailwindClass:!0,modifierId:c?p+OB:p,classGroupId:f,originalClassName:a,hasPostfixModifier:d}}).reverse().filter(a=>{if(!a.isTailwindClass)return!0;const{modifierId:o,classGroupId:c,hasPostfixModifier:u}=a,l=o+c;return s.has(l)?!1:(s.add(l),i(c,u).forEach(f=>s.add(o+f)),!0)}).reverse().map(a=>a.originalClassName).join(" ")}function jj(){let t=0,e,r,n="";for(;tf(l),t());return r=Oj(u),n=r.cache.get,i=r.cache.set,s=o,o(c)}function o(c){const u=n(c);if(u)return u;const l=Lj(c,r);return i(c,l),l}return function(){return s(jj.apply(null,arguments))}}function rr(t){const e=r=>r[t]||[];return e.isThemeGetter=!0,e}const LB=/^\[(?:([a-z-]+):)?(.+)\]$/i,$j=/^\d+\/\d+$/,zj=new Set(["px","full","screen"]),Hj=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Vj=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,qj=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Kj=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Wj=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function qa(t){return Uu(t)||zj.has(t)||$j.test(t)}function tc(t){return zh(t,"length",tU)}function Uu(t){return!!t&&!Number.isNaN(Number(t))}function S1(t){return zh(t,"number",Uu)}function y0(t){return!!t&&Number.isInteger(Number(t))}function Gj(t){return t.endsWith("%")&&Uu(t.slice(0,-1))}function gt(t){return LB.test(t)}function rc(t){return Hj.test(t)}const Zj=new Set(["length","size","percentage"]);function Jj(t){return zh(t,Zj,jB)}function Xj(t){return zh(t,"position",jB)}const Qj=new Set(["image","url"]);function Yj(t){return zh(t,Qj,nU)}function eU(t){return zh(t,"",rU)}function x0(){return!0}function zh(t,e,r){const n=LB.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1}function tU(t){return Vj.test(t)&&!qj.test(t)}function jB(){return!1}function rU(t){return Kj.test(t)}function nU(t){return Wj.test(t)}function iU(){const t=rr("colors"),e=rr("spacing"),r=rr("blur"),n=rr("brightness"),i=rr("borderColor"),s=rr("borderRadius"),a=rr("borderSpacing"),o=rr("borderWidth"),c=rr("contrast"),u=rr("grayscale"),l=rr("hueRotate"),f=rr("invert"),d=rr("gap"),p=rr("gradientColorStops"),h=rr("gradientColorStopPositions"),g=rr("inset"),v=rr("margin"),x=rr("opacity"),b=rr("padding"),S=rr("saturate"),_=rr("scale"),P=rr("sepia"),C=rr("skew"),B=rr("space"),N=rr("translate"),T=()=>["auto","contain","none"],D=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto",gt,e],E=()=>[gt,e],F=()=>["",qa,tc],A=()=>["auto",Uu,gt],I=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],j=()=>["solid","dashed","dotted","double","none"],$=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"],W=()=>["start","end","center","between","around","evenly","stretch"],H=()=>["","0",gt],O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>[Uu,S1],q=()=>[Uu,gt];return{cacheSize:500,separator:":",theme:{colors:[x0],spacing:[qa,tc],blur:["none","",rc,gt],brightness:L(),borderColor:[t],borderRadius:["none","","full",rc,gt],borderSpacing:E(),borderWidth:F(),contrast:L(),grayscale:H(),hueRotate:q(),invert:H(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[Gj,tc],inset:R(),margin:R(),opacity:L(),padding:E(),saturate:L(),scale:L(),sepia:H(),skew:q(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",gt]}],container:["container"],columns:[{columns:[rc]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...I(),gt]}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",y0,gt]}],basis:[{basis:R()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",gt]}],grow:[{grow:H()}],shrink:[{shrink:H()}],order:[{order:["first","last","none",y0,gt]}],"grid-cols":[{"grid-cols":[x0]}],"col-start-end":[{col:["auto",{span:["full",y0,gt]},gt]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[x0]}],"row-start-end":[{row:["auto",{span:[y0,gt]},gt]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",gt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",gt]}],gap:[{gap:[d]}],"gap-x":[{"gap-x":[d]}],"gap-y":[{"gap-y":[d]}],"justify-content":[{justify:["normal",...W()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...W(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...W(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[B]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[B]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",gt,e]}],"min-w":[{"min-w":[gt,e,"min","max","fit"]}],"max-w":[{"max-w":[gt,e,"none","full","min","max","fit","prose",{screen:[rc]},rc]}],h:[{h:[gt,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[gt,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[gt,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[gt,e,"auto","min","max","fit"]}],"font-size":[{text:["base",rc,tc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",S1]}],"font-family":[{font:[x0]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",gt]}],"line-clamp":[{"line-clamp":["none",Uu,S1]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",qa,gt]}],"list-image":[{"list-image":["none",gt]}],"list-style-type":[{list:["none","disc","decimal",gt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[x]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...j(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",qa,tc]}],"underline-offset":[{"underline-offset":["auto",qa,gt]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",gt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",gt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[x]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...I(),Xj]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Jj]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Yj]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[h]}],"gradient-via-pos":[{via:[h]}],"gradient-to-pos":[{to:[h]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[o]}],"border-w-x":[{"border-x":[o]}],"border-w-y":[{"border-y":[o]}],"border-w-s":[{"border-s":[o]}],"border-w-e":[{"border-e":[o]}],"border-w-t":[{"border-t":[o]}],"border-w-r":[{"border-r":[o]}],"border-w-b":[{"border-b":[o]}],"border-w-l":[{"border-l":[o]}],"border-opacity":[{"border-opacity":[x]}],"border-style":[{border:[...j(),"hidden"]}],"divide-x":[{"divide-x":[o]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[o]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[x]}],"divide-style":[{divide:j()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...j()]}],"outline-offset":[{"outline-offset":[qa,gt]}],"outline-w":[{outline:[qa,tc]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[qa,tc]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",rc,eU]}],"shadow-color":[{shadow:[x0]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":$()}],"bg-blend":[{"bg-blend":$()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",rc,gt]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[l]}],invert:[{invert:[f]}],saturate:[{saturate:[S]}],sepia:[{sepia:[P]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[l]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[x]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[P]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",gt]}],duration:[{duration:q()}],ease:[{ease:["linear","in","out","in-out",gt]}],delay:[{delay:q()}],animate:[{animate:["none","spin","ping","pulse","bounce",gt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[_]}],"scale-x":[{"scale-x":[_]}],"scale-y":[{"scale-y":[_]}],rotate:[{rotate:[y0,gt]}],"translate-x":[{"translate-x":[N]}],"translate-y":[{"translate-y":[N]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",gt]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",gt]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",gt]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[qa,tc,S1]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}const sU=Uj(iU);function si(...t){return sU(kj(t))}const UB=K.forwardRef(({className:t,...e},r)=>te.jsx(NB,{className:si("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:r,children:te.jsx(_j,{className:si("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));UB.displayName=NB.displayName;var $B={exports:{}},zB={};/** + * @license React + * use-sync-external-store-with-selector.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var zg=K;function aU(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var oU=typeof Object.is=="function"?Object.is:aU,cU=zg.useSyncExternalStore,uU=zg.useRef,lU=zg.useEffect,fU=zg.useMemo,dU=zg.useDebugValue;zB.useSyncExternalStoreWithSelector=function(t,e,r,n,i){var s=uU(null);if(s.current===null){var a={hasValue:!1,value:null};s.current=a}else a=s.current;s=fU(function(){function c(p){if(!u){if(u=!0,l=p,p=n(p),i!==void 0&&a.hasValue){var h=a.value;if(i(h,p))return f=h}return f=p}if(h=f,oU(l,p))return h;var g=n(p);return i!==void 0&&i(h,g)?h:(l=p,f=g)}var u=!1,l,f,d=r===void 0?null:r;return[function(){return c(e())},d===null?void 0:function(){return c(d())}]},[e,r,n,i]);var o=cU(t,s[0],s[1]);return lU(function(){a.hasValue=!0,a.value=o},[o]),dU(o),o};$B.exports=zB;var hU=$B.exports,ki="default"in jm?jr:jm,BS=Symbol.for("react-redux-context"),IS=typeof globalThis<"u"?globalThis:{};function pU(){if(!ki.createContext)return{};const t=IS[BS]??(IS[BS]=new Map);let e=t.get(ki.createContext);return e||(e=ki.createContext(null),t.set(ki.createContext,e)),e}var tu=pU(),gU=()=>{throw new Error("uSES not initialized!")};function r5(t=tu){return function(){return ki.useContext(t)}}var HB=r5(),VB=gU,mU=t=>{VB=t},vU=(t,e)=>t===e;function yU(t=tu){const e=t===tu?HB:r5(t),r=(n,i={})=>{const{equalityFn:s=vU,devModeChecks:a={}}=typeof i=="function"?{equalityFn:i}:i,{store:o,subscription:c,getServerState:u,stabilityCheck:l,identityFunctionCheck:f}=e();ki.useRef(!0);const d=ki.useCallback({[n.name](h){return n(h)}}[n.name],[n,l,a.stabilityCheck]),p=VB(c.addNestedSub,o.getState,u||o.getState,d,s);return ki.useDebugValue(p),p};return Object.assign(r,{withTypes:()=>r}),r}var xU=yU();function bU(t){t()}function wU(){let t=null,e=null;return{clear(){t=null,e=null},notify(){bU(()=>{let r=t;for(;r;)r.callback(),r=r.next})},get(){const r=[];let n=t;for(;n;)r.push(n),n=n.next;return r},subscribe(r){let n=!0;const i=e={callback:r,next:null,prev:e};return i.prev?i.prev.next=i:t=i,function(){!n||t===null||(n=!1,i.next?i.next.prev=i.prev:e=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}var FS={notify(){},get:()=>[]};function EU(t,e){let r,n=FS,i=0,s=!1;function a(g){l();const v=n.subscribe(g);let x=!1;return()=>{x||(x=!0,v(),f())}}function o(){n.notify()}function c(){h.onStateChange&&h.onStateChange()}function u(){return s}function l(){i++,r||(r=e?e.addNestedSub(c):t.subscribe(c),n=wU())}function f(){i--,r&&i===0&&(r(),r=void 0,n.clear(),n=FS)}function d(){s||(s=!0,l())}function p(){s&&(s=!1,f())}const h={addNestedSub:a,notifyNestedSubs:o,handleChangeWrapper:c,isSubscribed:u,trySubscribe:d,tryUnsubscribe:p,getListeners:()=>n};return h}var SU=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",AU=SU?ki.useLayoutEffect:ki.useEffect;function CU({store:t,context:e,children:r,serverState:n,stabilityCheck:i="once",identityFunctionCheck:s="once"}){const a=ki.useMemo(()=>{const u=EU(t);return{store:t,subscription:u,getServerState:n?()=>n:void 0,stabilityCheck:i,identityFunctionCheck:s}},[t,n,i,s]),o=ki.useMemo(()=>t.getState(),[t]);AU(()=>{const{subscription:u}=a;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),o!==t.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[a,o]);const c=e||tu;return ki.createElement(c.Provider,{value:a},r)}var _U=CU;function qB(t=tu){const e=t===tu?HB:r5(t),r=()=>{const{store:n}=e();return n};return Object.assign(r,{withTypes:()=>r}),r}var kU=qB();function BU(t=tu){const e=t===tu?kU:qB(t),r=()=>e().dispatch;return Object.assign(r,{withTypes:()=>r}),r}var IU=BU();mU(hU.useSyncExternalStoreWithSelector);const Wo=IU,Kl=xU;function un(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var FU=typeof Symbol=="function"&&Symbol.observable||"@@observable",PS=FU,Ix=()=>Math.random().toString(36).substring(7).split("").join("."),PU={INIT:`@@redux/INIT${Ix()}`,REPLACE:`@@redux/REPLACE${Ix()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ix()}`},dv=PU;function n5(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function KB(t,e,r){if(typeof t!="function")throw new Error(un(2));if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(un(0));if(typeof e=="function"&&typeof r>"u"&&(r=e,e=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(un(1));return r(KB)(t,e)}let n=t,i=e,s=new Map,a=s,o=0,c=!1;function u(){a===s&&(a=new Map,s.forEach((v,x)=>{a.set(x,v)}))}function l(){if(c)throw new Error(un(3));return i}function f(v){if(typeof v!="function")throw new Error(un(4));if(c)throw new Error(un(5));let x=!0;u();const b=o++;return a.set(b,v),function(){if(x){if(c)throw new Error(un(6));x=!1,u(),a.delete(b),s=null}}}function d(v){if(!n5(v))throw new Error(un(7));if(typeof v.type>"u")throw new Error(un(8));if(typeof v.type!="string")throw new Error(un(17));if(c)throw new Error(un(9));try{c=!0,i=n(i,v)}finally{c=!1}return(s=a).forEach(b=>{b()}),v}function p(v){if(typeof v!="function")throw new Error(un(10));n=v,d({type:dv.REPLACE})}function h(){const v=f;return{subscribe(x){if(typeof x!="object"||x===null)throw new Error(un(11));function b(){const _=x;_.next&&_.next(l())}return b(),{unsubscribe:v(b)}},[PS](){return this}}}return d({type:dv.INIT}),{dispatch:d,subscribe:f,getState:l,replaceReducer:p,[PS]:h}}function TU(t){Object.keys(t).forEach(e=>{const r=t[e];if(typeof r(void 0,{type:dv.INIT})>"u")throw new Error(un(12));if(typeof r(void 0,{type:dv.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(un(13))})}function NU(t){const e=Object.keys(t),r={};for(let s=0;s"u")throw o&&o.type,new Error(un(14));u[f]=h,c=c||h!==p}return c=c||n.length!==Object.keys(a).length,c?u:a}}function hv(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,r)=>(...n)=>e(r(...n)))}function RU(...t){return e=>(r,n)=>{const i=e(r,n);let s=()=>{throw new Error(un(15))};const a={getState:i.getState,dispatch:(c,...u)=>s(c,...u)},o=t.map(c=>c(a));return s=hv(...o)(i.dispatch),{...i,dispatch:s}}}function DU(t){return n5(t)&&"type"in t&&typeof t.type=="string"}var WB=Symbol.for("immer-nothing"),TS=Symbol.for("immer-draftable"),Pi=Symbol.for("immer-state");function Us(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var ch=Object.getPrototypeOf;function ru(t){return!!t&&!!t[Pi]}function Do(t){var e;return t?GB(t)||Array.isArray(t)||!!t[TS]||!!((e=t.constructor)!=null&&e[TS])||My(t)||Ly(t):!1}var OU=Object.prototype.constructor.toString();function GB(t){if(!t||typeof t!="object")return!1;const e=ch(t);if(e===null)return!0;const r=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return r===Object?!0:typeof r=="function"&&Function.toString.call(r)===OU}function pv(t,e){Oy(t)===0?Reflect.ownKeys(t).forEach(r=>{e(r,t[r],t)}):t.forEach((r,n)=>e(n,r,t))}function Oy(t){const e=t[Pi];return e?e.type_:Array.isArray(t)?1:My(t)?2:Ly(t)?3:0}function y4(t,e){return Oy(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function ZB(t,e,r){const n=Oy(t);n===2?t.set(e,r):n===3?t.add(r):t[e]=r}function MU(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function My(t){return t instanceof Map}function Ly(t){return t instanceof Set}function Iu(t){return t.copy_||t.base_}function x4(t,e){if(My(t))return new Map(t);if(Ly(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);if(!e&&GB(t))return ch(t)?{...t}:Object.assign(Object.create(null),t);const r=Object.getOwnPropertyDescriptors(t);delete r[Pi];let n=Reflect.ownKeys(r);for(let i=0;i1&&(t.set=t.add=t.clear=t.delete=LU),Object.freeze(t),e&&Object.entries(t).forEach(([r,n])=>i5(n,!0))),t}function LU(){Us(2)}function jy(t){return Object.isFrozen(t)}var jU={};function Fl(t){const e=jU[t];return e||Us(0,t),e}var Pp;function JB(){return Pp}function UU(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function NS(t,e){e&&(Fl("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function b4(t){w4(t),t.drafts_.forEach($U),t.drafts_=null}function w4(t){t===Pp&&(Pp=t.parent_)}function RS(t){return Pp=UU(Pp,t)}function $U(t){const e=t[Pi];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function DS(t,e){e.unfinalizedDrafts_=e.drafts_.length;const r=e.drafts_[0];return t!==void 0&&t!==r?(r[Pi].modified_&&(b4(e),Us(4)),Do(t)&&(t=gv(e,t),e.parent_||mv(e,t)),e.patches_&&Fl("Patches").generateReplacementPatches_(r[Pi].base_,t,e.patches_,e.inversePatches_)):t=gv(e,r,[]),b4(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==WB?t:void 0}function gv(t,e,r){if(jy(e))return e;const n=e[Pi];if(!n)return pv(e,(i,s)=>OS(t,n,e,i,s,r)),e;if(n.scope_!==t)return e;if(!n.modified_)return mv(t,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const i=n.copy_;let s=i,a=!1;n.type_===3&&(s=new Set(i),i.clear(),a=!0),pv(s,(o,c)=>OS(t,n,i,o,c,r,a)),mv(t,i,!1),r&&t.patches_&&Fl("Patches").generatePatches_(n,r,t.patches_,t.inversePatches_)}return n.copy_}function OS(t,e,r,n,i,s,a){if(ru(i)){const o=s&&e&&e.type_!==3&&!y4(e.assigned_,n)?s.concat(n):void 0,c=gv(t,i,o);if(ZB(r,n,c),ru(c))t.canAutoFreeze_=!1;else return}else a&&r.add(i);if(Do(i)&&!jy(i)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;gv(t,i),(!e||!e.scope_.parent_)&&typeof n!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,n)&&mv(t,i)}}function mv(t,e,r=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&i5(e,r)}function zU(t,e){const r=Array.isArray(t),n={type_:r?1:0,scope_:e?e.scope_:JB(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=n,s=s5;r&&(i=[n],s=Tp);const{revoke:a,proxy:o}=Proxy.revocable(i,s);return n.draft_=o,n.revoke_=a,o}var s5={get(t,e){if(e===Pi)return t;const r=Iu(t);if(!y4(r,e))return HU(t,r,e);const n=r[e];return t.finalized_||!Do(n)?n:n===Fx(t.base_,e)?(Px(t),t.copy_[e]=S4(n,t)):n},has(t,e){return e in Iu(t)},ownKeys(t){return Reflect.ownKeys(Iu(t))},set(t,e,r){const n=XB(Iu(t),e);if(n!=null&&n.set)return n.set.call(t.draft_,r),!0;if(!t.modified_){const i=Fx(Iu(t),e),s=i==null?void 0:i[Pi];if(s&&s.base_===r)return t.copy_[e]=r,t.assigned_[e]=!1,!0;if(MU(r,i)&&(r!==void 0||y4(t.base_,e)))return!0;Px(t),E4(t)}return t.copy_[e]===r&&(r!==void 0||e in t.copy_)||Number.isNaN(r)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=r,t.assigned_[e]=!0),!0},deleteProperty(t,e){return Fx(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,Px(t),E4(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const r=Iu(t),n=Reflect.getOwnPropertyDescriptor(r,e);return n&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:n.enumerable,value:r[e]}},defineProperty(){Us(11)},getPrototypeOf(t){return ch(t.base_)},setPrototypeOf(){Us(12)}},Tp={};pv(s5,(t,e)=>{Tp[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});Tp.deleteProperty=function(t,e){return Tp.set.call(this,t,e,void 0)};Tp.set=function(t,e,r){return s5.set.call(this,t[0],e,r,t[0])};function Fx(t,e){const r=t[Pi];return(r?Iu(r):t)[e]}function HU(t,e,r){var i;const n=XB(e,r);return n?"value"in n?n.value:(i=n.get)==null?void 0:i.call(t.draft_):void 0}function XB(t,e){if(!(e in t))return;let r=ch(t);for(;r;){const n=Object.getOwnPropertyDescriptor(r,e);if(n)return n;r=ch(r)}}function E4(t){t.modified_||(t.modified_=!0,t.parent_&&E4(t.parent_))}function Px(t){t.copy_||(t.copy_=x4(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var VU=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,r,n)=>{if(typeof e=="function"&&typeof r!="function"){const s=r;r=e;const a=this;return function(c=s,...u){return a.produce(c,l=>r.call(this,l,...u))}}typeof r!="function"&&Us(6),n!==void 0&&typeof n!="function"&&Us(7);let i;if(Do(e)){const s=RS(this),a=S4(e,void 0);let o=!0;try{i=r(a),o=!1}finally{o?b4(s):w4(s)}return NS(s,n),DS(i,s)}else if(!e||typeof e!="object"){if(i=r(e),i===void 0&&(i=e),i===WB&&(i=void 0),this.autoFreeze_&&i5(i,!0),n){const s=[],a=[];Fl("Patches").generateReplacementPatches_(e,i,s,a),n(s,a)}return i}else Us(1,e)},this.produceWithPatches=(e,r)=>{if(typeof e=="function")return(a,...o)=>this.produceWithPatches(a,c=>e(c,...o));let n,i;return[this.produce(e,r,(a,o)=>{n=a,i=o}),n,i]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){Do(t)||Us(8),ru(t)&&(t=QB(t));const e=RS(this),r=S4(t,void 0);return r[Pi].isManual_=!0,w4(e),r}finishDraft(t,e){const r=t&&t[Pi];(!r||!r.isManual_)&&Us(9);const{scope_:n}=r;return NS(n,e),DS(void 0,n)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let r;for(r=e.length-1;r>=0;r--){const i=e[r];if(i.path.length===0&&i.op==="replace"){t=i.value;break}}r>-1&&(e=e.slice(r+1));const n=Fl("Patches").applyPatches_;return ru(t)?n(t,e):this.produce(t,i=>n(i,e))}};function S4(t,e){const r=My(t)?Fl("MapSet").proxyMap_(t,e):Ly(t)?Fl("MapSet").proxySet_(t,e):zU(t,e);return(e?e.scope_:JB()).drafts_.push(r),r}function QB(t){return ru(t)||Us(10,t),YB(t)}function YB(t){if(!Do(t)||jy(t))return t;const e=t[Pi];let r;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,r=x4(t,e.scope_.immer_.useStrictShallowCopy_)}else r=x4(t,!0);return pv(r,(n,i)=>{ZB(r,n,YB(i))}),e&&(e.finalized_=!1),r}var Ti=new VU,eI=Ti.produce;Ti.produceWithPatches.bind(Ti);Ti.setAutoFreeze.bind(Ti);Ti.setUseStrictShallowCopy.bind(Ti);Ti.applyPatches.bind(Ti);Ti.createDraft.bind(Ti);Ti.finishDraft.bind(Ti);function qU(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function KU(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function WU(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(r=>typeof r=="function")){const r=t.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${e}[${r}]`)}}var MS=t=>Array.isArray(t)?t:[t];function GU(t){const e=Array.isArray(t[0])?t[0]:t;return WU(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function ZU(t,e){const r=[],{length:n}=t;for(let i=0;i{r=A1(),a.resetResultsCount()},a.resultsCount=()=>s,a.resetResultsCount=()=>{s=0},a}function tI(t,...e){const r=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,n=(...i)=>{let s=0,a=0,o,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),qU(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const l={...r,...c},{memoize:f,memoizeOptions:d=[],argsMemoize:p=a5,argsMemoizeOptions:h=[],devModeChecks:g={}}=l,v=MS(d),x=MS(h),b=GU(i),S=f(function(){return s++,u.apply(null,arguments)},...v),_=p(function(){a++;const C=ZU(b,arguments);return o=S.apply(null,C),o},...x);return Object.assign(_,{resultFunc:u,memoizedResultFunc:S,dependencies:b,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>o,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:p})};return Object.assign(n,{withTypes:()=>n}),n}var YU=tI(a5),e$=Object.assign((t,e=YU)=>{KU(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);const r=Object.keys(t),n=r.map(s=>t[s]);return e(n,(...s)=>s.reduce((a,o,c)=>(a[r[c]]=o,a),{}))},{withTypes:()=>e$});function rI(t){return({dispatch:r,getState:n})=>i=>s=>typeof s=="function"?s(r,n,t):i(s)}var t$=rI(),r$=rI,n$=(...t)=>{const e=tI(...t),r=Object.assign((...n)=>{const i=e(...n),s=(a,...o)=>i(ru(a)?QB(a):a,...o);return Object.assign(s,i),s},{withTypes:()=>r});return r};n$(a5);var i$=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?hv:hv.apply(null,arguments)};function uh(t,e){function r(...n){if(e){let i=e(...n);if(!i)throw new Error(ii(0));return{type:t,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:t,payload:n[0]}}return r.toString=()=>`${t}`,r.type=t,r.match=n=>DU(n)&&n.type===t,r}var nI=class O0 extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,O0.prototype)}static get[Symbol.species](){return O0}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new O0(...e[0].concat(this)):new O0(...e.concat(this))}};function jS(t){return Do(t)?eI(t,()=>{}):t}function US(t,e,r){if(t.has(e)){let i=t.get(e);return r.update&&(i=r.update(i,e,t),t.set(e,i)),i}if(!r.insert)throw new Error(ii(10));const n=r.insert(e,t);return t.set(e,n),n}function s$(t){return typeof t=="boolean"}var a$=()=>function(e){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=e??{};let a=new nI;return r&&(s$(r)?a.push(t$):a.push(r$(r.extraArgument))),a},o$="RTK_autoBatch",iI=t=>e=>{setTimeout(e,t)},c$=typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:iI(10),u$=(t={type:"raf"})=>e=>(...r)=>{const n=e(...r);let i=!0,s=!1,a=!1;const o=new Set,c=t.type==="tick"?queueMicrotask:t.type==="raf"?c$:t.type==="callback"?t.queueNotification:iI(t.timeout),u=()=>{a=!1,s&&(s=!1,o.forEach(l=>l()))};return Object.assign({},n,{subscribe(l){const f=()=>i&&l(),d=n.subscribe(f);return o.add(l),()=>{d(),o.delete(l)}},dispatch(l){var f;try{return i=!((f=l==null?void 0:l.meta)!=null&&f[o$]),s=!i,s&&(a||(a=!0,c(u))),n.dispatch(l)}finally{i=!0}}})},l$=t=>function(r){const{autoBatch:n=!0}=r??{};let i=new nI(t);return n&&i.push(u$(typeof n=="object"?n:void 0)),i},f$=!0;function d$(t){const e=a$(),{reducer:r=void 0,middleware:n,devTools:i=!0,preloadedState:s=void 0,enhancers:a=void 0}=t||{};let o;if(typeof r=="function")o=r;else if(n5(r))o=NU(r);else throw new Error(ii(1));let c;typeof n=="function"?c=n(e):c=e();let u=hv;i&&(u=i$({trace:!f$,...typeof i=="object"&&i}));const l=RU(...c),f=l$(l);let d=typeof a=="function"?a(f):f();const p=u(...d);return KB(o,s,p)}function sI(t){const e={},r=[];let n;const i={addCase(s,a){const o=typeof s=="string"?s:s.type;if(!o)throw new Error(ii(28));if(o in e)throw new Error(ii(29));return e[o]=a,i},addMatcher(s,a){return r.push({matcher:s,reducer:a}),i},addDefaultCase(s){return n=s,i}};return t(i),[e,r,n]}function h$(t){return typeof t=="function"}function p$(t,e){let[r,n,i]=sI(e),s;if(h$(t))s=()=>jS(t());else{const o=jS(t);s=()=>o}function a(o=s(),c){let u=[r[c.type],...n.filter(({matcher:l})=>l(c)).map(({reducer:l})=>l)];return u.filter(l=>!!l).length===0&&(u=[i]),u.reduce((l,f)=>{if(f)if(ru(l)){const p=f(l,c);return p===void 0?l:p}else{if(Do(l))return eI(l,d=>f(d,c));{const d=f(l,c);if(d===void 0){if(l===null)return l;throw new Error(ii(9))}return d}}return l},o)}return a.getInitialState=s,a}var g$="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",m$=(t=21)=>{let e="",r=t;for(;r--;)e+=g$[Math.random()*64|0];return e},v$=Symbol.for("rtk-slice-createasyncthunk");function y$(t,e){return`${t}/${e}`}function x$({creators:t}={}){var r;const e=(r=t==null?void 0:t.asyncThunk)==null?void 0:r[v$];return function(i){const{name:s,reducerPath:a=s}=i;if(!s)throw new Error(ii(11));typeof process<"u";const o=(typeof i.reducers=="function"?i.reducers(E$()):i.reducers)||{},c=Object.keys(o),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},l={addCase(S,_){const P=typeof S=="string"?S:S.type;if(!P)throw new Error(ii(12));if(P in u.sliceCaseReducersByType)throw new Error(ii(13));return u.sliceCaseReducersByType[P]=_,l},addMatcher(S,_){return u.sliceMatchers.push({matcher:S,reducer:_}),l},exposeAction(S,_){return u.actionCreators[S]=_,l},exposeCaseReducer(S,_){return u.sliceCaseReducersByName[S]=_,l}};c.forEach(S=>{const _=o[S],P={reducerName:S,type:y$(s,S),createNotation:typeof i.reducers=="function"};A$(_)?_$(P,_,l,e):S$(P,_,l)});function f(){const[S={},_=[],P=void 0]=typeof i.extraReducers=="function"?sI(i.extraReducers):[i.extraReducers],C={...S,...u.sliceCaseReducersByType};return p$(i.initialState,B=>{for(let N in C)B.addCase(N,C[N]);for(let N of u.sliceMatchers)B.addMatcher(N.matcher,N.reducer);for(let N of _)B.addMatcher(N.matcher,N.reducer);P&&B.addDefaultCase(P)})}const d=S=>S,p=new Map;let h;function g(S,_){return h||(h=f()),h(S,_)}function v(){return h||(h=f()),h.getInitialState()}function x(S,_=!1){function P(B){let N=B[S];return typeof N>"u"&&_&&(N=v()),N}function C(B=d){const N=US(p,_,{insert:()=>new WeakMap});return US(N,B,{insert:()=>{const T={};for(const[D,R]of Object.entries(i.selectors??{}))T[D]=b$(R,B,v,_);return T}})}return{reducerPath:S,getSelectors:C,get selectors(){return C(P)},selectSlice:P}}const b={name:s,reducer:g,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:v,...x(a),injectInto(S,{reducerPath:_,...P}={}){const C=_??a;return S.inject({reducerPath:C,reducer:g},P),{...b,...x(C,!0)}}};return b}}function b$(t,e,r,n){function i(s,...a){let o=e(s);return typeof o>"u"&&n&&(o=r()),t(o,...a)}return i.unwrapped=t,i}var w$=x$();function E$(){function t(e,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...r}}return t.withTypes=()=>t,{reducer(e){return Object.assign({[e.name](...r){return e(...r)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:r}},asyncThunk:t}}function S$({type:t,reducerName:e,createNotation:r},n,i){let s,a;if("reducer"in n){if(r&&!C$(n))throw new Error(ii(17));s=n.reducer,a=n.prepare}else s=n;i.addCase(t,s).exposeCaseReducer(e,s).exposeAction(e,a?uh(t,a):uh(t))}function A$(t){return t._reducerDefinitionType==="asyncThunk"}function C$(t){return t._reducerDefinitionType==="reducerWithPrepare"}function _$({type:t,reducerName:e},r,n,i){if(!i)throw new Error(ii(18));const{payloadCreator:s,fulfilled:a,pending:o,rejected:c,settled:u,options:l}=r,f=i(t,s,l);n.exposeAction(e,f),a&&n.addCase(f.fulfilled,a),o&&n.addCase(f.pending,o),c&&n.addCase(f.rejected,c),u&&n.addMatcher(f.settled,u),n.exposeCaseReducer(e,{fulfilled:a||C1,pending:o||C1,rejected:c||C1,settled:u||C1})}function C1(){}var k$=(t,e)=>{if(typeof t!="function")throw new Error(ii(32))},o5="listenerMiddleware",B$=t=>{let{type:e,actionCreator:r,matcher:n,predicate:i,effect:s}=t;if(e)i=uh(e).match;else if(r)e=r.type,i=r.match;else if(n)i=n;else if(!i)throw new Error(ii(21));return k$(s),{predicate:i,type:e,effect:s}},I$=Object.assign(t=>{const{type:e,predicate:r,effect:n}=B$(t);return{id:m$(),effect:n,type:e,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(ii(22))}}},{withTypes:()=>I$}),F$=Object.assign(uh(`${o5}/add`),{withTypes:()=>F$});uh(`${o5}/removeAll`);var P$=Object.assign(uh(`${o5}/remove`),{withTypes:()=>P$});function ii(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}const T$={appMode:"aos",activeSideNavItem:"",activeFile:"",activeContract:"",isWalletConnected:!1},aI=w$({name:"app",initialState:T$,reducers:{setAppMode:(t,e)=>{t.appMode=e.payload,t.activeSideNavItem="Home",t.activeContract="",t.activeFile=""},setActiveSideNavItem:(t,e)=>{t.activeSideNavItem=e.payload},setActiveFile:(t,e)=>{t.activeFile=e.payload},setActiveContract:(t,e)=>{t.activeContract=e.payload},setIsWalletConnected:(t,e)=>{t.isWalletConnected=e.payload}}}),{setAppMode:N$,setActiveSideNavItem:Oo,setActiveFile:Uy,setActiveContract:oI,setIsWalletConnected:R$}=aI.actions,D$=aI.reducer;function cI({children:t}){const{appMode:e}=Kl(n=>n.app),r=Wo();return te.jsxs("div",{className:"flex h-20 min-h-[5rem] px-6 bg-[#111111]",children:[te.jsxs("div",{className:"flex justify-center items-center gap-2",children:[te.jsx("img",{src:"/logo-small.svg",className:"h-6 w-6"}),te.jsx("h1",{className:"bg-gradient-to-r from-[#006F86] to-white bg-clip-text text-2xl font-bold tracking-tight text-transparent",children:"BetterIDEa"})]}),t,te.jsxs("div",{className:"ml-auto flex justify-center items-center px-3 gap-2",children:[e==="aos"?"AO Mode":"Warp Mode",te.jsx(UB,{checked:e==="aos",onCheckedChange:n=>{r(N$(n?"aos":"wrap"))}})]})]})}function Tx({filename:t}){const e=Wo(),{activeFile:r}=Kl(n=>n.app);return te.jsx("div",{className:si("h-fit w-fit p-1 px-2 cursor-pointer items-center justify-center flex border rounded-lg border-white/10",r==t&&"bg-white/10"),onClick:()=>{e(Uy(t)),e(Oo("Contracts"))},children:t})}/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var O$={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"};/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const M$=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ot=(t,e)=>{const r=K.forwardRef(({color:n="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:a,className:o="",children:c,...u},l)=>K.createElement("svg",{ref:l,...O$,width:i,height:i,stroke:n,strokeWidth:a?Number(s)*24/Number(i):s,className:["lucide",`lucide-${M$(t)}`,o].join(" "),...u},[...e.map(([f,d])=>K.createElement(f,d)),...Array.isArray(c)?c:[c]]));return r.displayName=`${t}`,r};/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const L$=Ot("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const j$=Ot("Banknote",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const U$=Ot("Box",[["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"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $$=Ot("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const z$=Ot("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uI=Ot("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const c5=Ot("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const H$=Ot("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const V$=Ot("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const q$=Ot("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const K$=Ot("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const W$=Ot("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const G$=Ot("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Z$=Ot("FolderClosed",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const J$=Ot("HelpCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const X$=Ot("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Q$=Ot("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Y$=Ot("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ez=Ot("Loader",[["line",{x1:"12",x2:"12",y1:"2",y2:"6",key:"gza1u7"}],["line",{x1:"12",x2:"12",y1:"18",y2:"22",key:"1qhbu9"}],["line",{x1:"4.93",x2:"7.76",y1:"4.93",y2:"7.76",key:"xae44r"}],["line",{x1:"16.24",x2:"19.07",y1:"16.24",y2:"19.07",key:"bxnmvf"}],["line",{x1:"2",x2:"6",y1:"12",y2:"12",key:"89khin"}],["line",{x1:"18",x2:"22",y1:"12",y2:"12",key:"pb8tfm"}],["line",{x1:"4.93",x2:"7.76",y1:"19.07",y2:"16.24",key:"1uxjnu"}],["line",{x1:"16.24",x2:"19.07",y1:"7.76",y2:"4.93",key:"6duxfx"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tz=Ot("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rz=Ot("MessageSquareMore",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M16 10h.01",key:"1m94wz"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nz=Ot("PlayCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iz=Ot("PlusCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sz=Ot("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const az=Ot("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oz=Ot("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"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cz=Ot("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2v0a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12v0a2 2 0 0 1-2-2V7",key:"jon5kx"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uz=Ot("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"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const lz=Ot("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fz=Ot("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"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dz=Ot("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"}]]);/** + * @license lucide-react v0.350.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hz=Ot("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),Nr={home:X$,tasks:K$,boxes:Y$,money:j$,users:lz,plugins:hz,wallet:fz,arrowDown:c5,arrowLeft:H$,arrowRight:V$,search:az,helpCircle:J$,download:G$,sort:L$,chat:rz,info:Q$,menu:tz,projects:Z$,deploy:U$,test:$$,browser:cz,settings:oz,executeCode:nz,delete:uz,add:sz,addCircle:iz,codeSuccess:z$,codeError:dz,codeRunning:ez,copy:W$,tick:uI};function lI({items:t}){const e=Wo(),r=Kl(n=>n.app.activeSideNavItem);return te.jsxs("div",{className:"flex flex-col gap-4 px-2.5 w-48 py-4 bg-[#171717] border-r border-white/30",children:[t.map((n,i)=>te.jsx($S,{text:n.text,Icon:n.icon,onClick:n.onClick,active:r==n.text},i)),te.jsx("div",{className:"flex-grow"}),te.jsx($S,{text:"Settings",Icon:Nr.settings,onClick:()=>e(Oo("Settings")),active:r=="Settings"})]})}function $S({text:t,Icon:e,active:r,onClick:n}){return te.jsxs("div",{onClick:n,className:si("flex gap-1 items-center rounded-md px-3 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground cursor-pointer",r?"bg-[#006F86]":"transparent"),children:[te.jsx(e,{className:"mr-2 h-4 w-4"}),te.jsx("span",{children:t})]})}const fI=` + +// Welcome to BetterIDE Studio +// Feel free to edit the following smartweave contract code and add your own functions + + +// This is a contract function +function setName(state, action) { + // Modify state with the input + state.myName = action.input.name + return { state } +} + +function getName(state) { + // simply return the value for myName key in state + return { result: state.myName } +} + +// This is the handler for all contract functions +export function handle(state, action) { + const input = action.input + switch (input.function) { + case "setName": + return setName(state, action); + // no need for break statement because we are using return + case "getName": + return getName(state); + default: + throw new ContractError(\`Function not recognised: "\${input.function}"\`) + } +} + +`,dI=` +{ + "myName": "" +} +`,pz={hello:{"contract.js":fI,"state.json":dI,"README.md":"# Hello"}};function u5(){const[t,e]=K.useState(JSON.parse(localStorage.getItem("contracts"))||pz);K.useEffect(()=>{t&&localStorage.setItem("contracts",JSON.stringify(t))},[t]);function r(i,s){const a=prompt("Enter contract name");if(!a)return;if(a in t)return alert("Contract with same name already exists");const o={...t,[a]:{"contract.js":i||fI,"state.json":s||dI,"README.md":"# "+a}};return e(o),a}function n(i){const s={...t};delete s[i],e(s)}return{contracts:t,setContracts:e,newContract:r,deleteContract:n}}function gz(){return te.jsx("div",{className:"h-full flex items-center justify-center",children:te.jsx("div",{children:"Cloud is a work in progress in this version of the IDE"})})}function mz(){return te.jsx("div",{className:"h-full flex items-center justify-center",children:te.jsx("div",{children:"Showcase is a work in progress in this version of the IDE"})})}function hI(){return te.jsxs("div",{className:"h-full flex flex-col gap-5 items-center justify-center",children:[te.jsx("img",{src:"/images/arweave/ecosystem.svg",className:"w-[269px]",draggable:!1}),te.jsx("a",{href:"https://github.com/ankushKun/betterIDE",target:"_blank",children:te.jsxs("div",{className:"flex items-center gap-3 font-semibold text-2xl tracking-widest ring-1 rounded-lg ring-white/20 p-2 hover:bg-white/5",children:[te.jsx("img",{src:"https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png",className:"w-[60px] rounded-full",draggable:!1}),te.jsxs("div",{children:["View source",te.jsx("br",{})," on Github"]})]})})]})}const vz=` + + +// Welcome to BetterIDE Studio +// Feel free to edit the following smartweave contract code and add your own functions + +function createVoteContract(state,action) +{ + state={...state,votes:{A:0,B:0}} + state.campaignName=action.input.campaign; + state.votes.A=0; + state.votes.B=0; + return {state} +} + +function vote(state, action){ + if(!action.for) throw new ContractError("Need to input 'for'"); + +} + +function voteA(state) +{ + state.votes.A+=1; + return { state } +} + +function voteB(state) +{ + state.votes.B+=1; + return { state } +} + +function result(state) +{ + if(state.votes.A>state.votes.B) + { + state.result="A won" + } + else if(state.votes.B>state.votes.A) + { + state.result="B won" + } + else + { + state.result="Draw"; + } + return {state}; +} + +export function handle(state, action) { + const input = action.input + switch (input.function) { + case "createVoteContract": + return createVoteContract(state, action); + // no need for break statement because we are using return + case "voteA": + return voteA(state,action); + case "voteB": + return voteB(state,action); + case "result": + return result(state); + default: + throw new ContractError(\`Function not recognised: "\${input.function}"\`) + } +} + +`,yz=` +{ + "campaignName": "", + "votes":{ + "A":0, + "B":0 + }, + "result":"" +} + +`,xz=` +// src/read/balance.js +async function balance(state, action) { + const addr = action?.input?.target || action.caller; + return { + result: { + target: addr, + ticker: state.ticker, + balance: state.balances[addr] || 0 + } + }; +} +// src/hyper-either.js +var Right = (x) => ({ + isLeft: false, + chain: (f) => f(x), + ap: (other) => other.map(x), + alt: (other) => Right(x), + extend: (f) => f(Right(x)), + concat: (other) => other.fold( + (x2) => other, + (y) => Right(x.concat(y)) + ), + traverse: (of2, f) => f(x).map(Right), + map: (f) => Right(f(x)), + fold: (_, g) => g(x), + toString: () => \`Right(\${ x })\`, + extract: () => x +}); +var Left = (x) => ({ + isLeft: true, + chain: (_) => Left(x), + ap: (_) => Left(x), + extend: (_) => Left(x), + alt: (other) => other, + concat: (_) => Left(x), + traverse: (of2, _) => of2(Left(x)), + map: (_) => Left(x), + fold: (f, _) => f(x), + toString: () => \`Left(\${ x })\`, + extract: () => x +}); +var of = Right; +var fromNullable = (x) => x != null ? Right(x) : Left(x); +// node_modules/bignumber.js/bignumber.mjs +var isNumeric = /^-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?$/i; +var mathceil = Math.ceil; +var mathfloor = Math.floor; +var bignumberError = "[BigNumber Error] "; +var tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: "; +var BASE = 1e14; +var LOG_BASE = 14; +var MAX_SAFE_INTEGER = 9007199254740991; +var POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13]; +var SQRT_BASE = 1e7; +var MAX = 1e9; +function clone(configObject) { + var div, convertBase, parseNumeric, P = BigNumber2.prototype = { constructor: BigNumber2, toString: null, valueOf: null }, ONE = new BigNumber2(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP = -1e7, MAX_EXP = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = { + prefix: "", + groupSize: 3, + secondaryGroupSize: 0, + groupSeparator: ",", + decimalSeparator: ".", + fractionGroupSize: 0, + fractionGroupSeparator: " ", + // non-breaking space + suffix: "" + }, ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz", alphabetHasNormalDecimalDigits = true; + function BigNumber2(v, b) { + var alphabet, c, caseChanged, e, i, isNum, len, str, x = this; + if (!(x instanceof BigNumber2)) + return new BigNumber2(v, b); + if (b == null) { + if (v && v._isBigNumber === true) { + x.s = v.s; + if (!v.c || v.e > MAX_EXP) { + x.c = x.e = null; + } else if (v.e < MIN_EXP) { + x.c = [x.e = 0]; + } else { + x.e = v.e; + x.c = v.c.slice(); + } + return; + } + if ((isNum = typeof v == "number") && v * 0 == 0) { + x.s = 1 / v < 0 ? (v = -v, -1) : 1; + if (v === ~~v) { + for (e = 0, i = v; i >= 10; i /= 10, e++) + ; + if (e > MAX_EXP) { + x.c = x.e = null; + } else { + x.e = e; + x.c = [v]; + } + return; + } + str = String(v); + } else { + if (!isNumeric.test(str = String(v))) + return parseNumeric(x, str, isNum); + x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1; + } + if ((e = str.indexOf(".")) > -1) + str = str.replace(".", ""); + if ((i = str.search(/e/i)) > 0) { + if (e < 0) + e = i; + e += +str.slice(i + 1); + str = str.substring(0, i); + } else if (e < 0) { + e = str.length; + } + } else { + intCheck(b, 2, ALPHABET.length, "Base"); + if (b == 10 && alphabetHasNormalDecimalDigits) { + x = new BigNumber2(v); + return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE); + } + str = String(v); + if (isNum = typeof v == "number") { + if (v * 0 != 0) + return parseNumeric(x, str, isNum, b); + x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1; + if (BigNumber2.DEBUG && str.replace(/^0\\.0*|\\./, "").length > 15) { + throw Error(tooManyDigits + v); + } + } else { + x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1; + } + alphabet = ALPHABET.slice(0, b); + e = i = 0; + for (len = str.length; i < len; i++) { + if (alphabet.indexOf(c = str.charAt(i)) < 0) { + if (c == ".") { + if (i > e) { + e = len; + continue; + } + } else if (!caseChanged) { + if (str == str.toUpperCase() && (str = str.toLowerCase()) || str == str.toLowerCase() && (str = str.toUpperCase())) { + caseChanged = true; + i = -1; + e = 0; + continue; + } + } + return parseNumeric(x, String(v), isNum, b); + } + } + isNum = false; + str = convertBase(str, b, 10, x.s); + if ((e = str.indexOf(".")) > -1) + str = str.replace(".", ""); + else + e = str.length; + } + for (i = 0; str.charCodeAt(i) === 48; i++) + ; + for (len = str.length; str.charCodeAt(--len) === 48; ) + ; + if (str = str.slice(i, ++len)) { + len -= i; + if (isNum && BigNumber2.DEBUG && len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) { + throw Error(tooManyDigits + x.s * v); + } + if ((e = e - i - 1) > MAX_EXP) { + x.c = x.e = null; + } else if (e < MIN_EXP) { + x.c = [x.e = 0]; + } else { + x.e = e; + x.c = []; + i = (e + 1) % LOG_BASE; + if (e < 0) + i += LOG_BASE; + if (i < len) { + if (i) + x.c.push(+str.slice(0, i)); + for (len -= LOG_BASE; i < len; ) { + x.c.push(+str.slice(i, i += LOG_BASE)); + } + i = LOG_BASE - (str = str.slice(i)).length; + } else { + i -= len; + } + for (; i--; str += "0") + ; + x.c.push(+str); + } + } else { + x.c = [x.e = 0]; + } + } + BigNumber2.clone = clone; + BigNumber2.ROUND_UP = 0; + BigNumber2.ROUND_DOWN = 1; + BigNumber2.ROUND_CEIL = 2; + BigNumber2.ROUND_FLOOR = 3; + BigNumber2.ROUND_HALF_UP = 4; + BigNumber2.ROUND_HALF_DOWN = 5; + BigNumber2.ROUND_HALF_EVEN = 6; + BigNumber2.ROUND_HALF_CEIL = 7; + BigNumber2.ROUND_HALF_FLOOR = 8; + BigNumber2.EUCLID = 9; + BigNumber2.config = BigNumber2.set = function(obj) { + var p, v; + if (obj != null) { + if (typeof obj == "object") { + if (obj.hasOwnProperty(p = "DECIMAL_PLACES")) { + v = obj[p]; + intCheck(v, 0, MAX, p); + DECIMAL_PLACES = v; + } + if (obj.hasOwnProperty(p = "ROUNDING_MODE")) { + v = obj[p]; + intCheck(v, 0, 8, p); + ROUNDING_MODE = v; + } + if (obj.hasOwnProperty(p = "EXPONENTIAL_AT")) { + v = obj[p]; + if (v && v.pop) { + intCheck(v[0], -MAX, 0, p); + intCheck(v[1], 0, MAX, p); + TO_EXP_NEG = v[0]; + TO_EXP_POS = v[1]; + } else { + intCheck(v, -MAX, MAX, p); + TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v); + } + } + if (obj.hasOwnProperty(p = "RANGE")) { + v = obj[p]; + if (v && v.pop) { + intCheck(v[0], -MAX, -1, p); + intCheck(v[1], 1, MAX, p); + MIN_EXP = v[0]; + MAX_EXP = v[1]; + } else { + intCheck(v, -MAX, MAX, p); + if (v) { + MIN_EXP = -(MAX_EXP = v < 0 ? -v : v); + } else { + throw Error(bignumberError + p + " cannot be zero: " + v); + } + } + } + if (obj.hasOwnProperty(p = "CRYPTO")) { + v = obj[p]; + if (v === !!v) { + if (v) { + if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) { + CRYPTO = v; + } else { + CRYPTO = !v; + throw Error(bignumberError + "crypto unavailable"); + } + } else { + CRYPTO = v; + } + } else { + throw Error(bignumberError + p + " not true or false: " + v); + } + } + if (obj.hasOwnProperty(p = "MODULO_MODE")) { + v = obj[p]; + intCheck(v, 0, 9, p); + MODULO_MODE = v; + } + if (obj.hasOwnProperty(p = "POW_PRECISION")) { + v = obj[p]; + intCheck(v, 0, MAX, p); + POW_PRECISION = v; + } + if (obj.hasOwnProperty(p = "FORMAT")) { + v = obj[p]; + if (typeof v == "object") + FORMAT = v; + else + throw Error(bignumberError + p + " not an object: " + v); + } + if (obj.hasOwnProperty(p = "ALPHABET")) { + v = obj[p]; + if (typeof v == "string" && !/^.?$|[+\\-.\\s]|(.).*\\1/.test(v)) { + alphabetHasNormalDecimalDigits = v.slice(0, 10) == "0123456789"; + ALPHABET = v; + } else { + throw Error(bignumberError + p + " invalid: " + v); + } + } + } else { + throw Error(bignumberError + "Object expected: " + obj); + } + } + return { + DECIMAL_PLACES, + ROUNDING_MODE, + EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS], + RANGE: [MIN_EXP, MAX_EXP], + CRYPTO, + MODULO_MODE, + POW_PRECISION, + FORMAT, + ALPHABET + }; + }; + BigNumber2.isBigNumber = function(v) { + if (!v || v._isBigNumber !== true) + return false; + if (!BigNumber2.DEBUG) + return true; + var i, n, c = v.c, e = v.e, s = v.s; + out: + if ({}.toString.call(c) == "[object Array]") { + if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) { + if (c[0] === 0) { + if (e === 0 && c.length === 1) + return true; + break out; + } + i = (e + 1) % LOG_BASE; + if (i < 1) + i += LOG_BASE; + if (String(c[0]).length == i) { + for (i = 0; i < c.length; i++) { + n = c[i]; + if (n < 0 || n >= BASE || n !== mathfloor(n)) + break out; + } + if (n !== 0) + return true; + } + } + } else if (c === null && e === null && (s === null || s === 1 || s === -1)) { + return true; + } + throw Error(bignumberError + "Invalid BigNumber: " + v); + }; + BigNumber2.maximum = BigNumber2.max = function() { + return maxOrMin(arguments, P.lt); + }; + BigNumber2.minimum = BigNumber2.min = function() { + return maxOrMin(arguments, P.gt); + }; + BigNumber2.random = function() { + var pow2_53 = 9007199254740992; + var random53bitInt = Math.random() * pow2_53 & 2097151 ? function() { + return mathfloor(Math.random() * pow2_53); + } : function() { + return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0); + }; + return function(dp) { + var a, b, e, k, v, i = 0, c = [], rand = new BigNumber2(ONE); + if (dp == null) + dp = DECIMAL_PLACES; + else + intCheck(dp, 0, MAX); + k = mathceil(dp / LOG_BASE); + if (CRYPTO) { + if (crypto.getRandomValues) { + a = crypto.getRandomValues(new Uint32Array(k *= 2)); + for (; i < k; ) { + v = a[i] * 131072 + (a[i + 1] >>> 11); + if (v >= 9e15) { + b = crypto.getRandomValues(new Uint32Array(2)); + a[i] = b[0]; + a[i + 1] = b[1]; + } else { + c.push(v % 1e14); + i += 2; + } + } + i = k / 2; + } else if (crypto.randomBytes) { + a = crypto.randomBytes(k *= 7); + for (; i < k; ) { + v = (a[i] & 31) * 281474976710656 + a[i + 1] * 1099511627776 + a[i + 2] * 4294967296 + a[i + 3] * 16777216 + (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6]; + if (v >= 9e15) { + crypto.randomBytes(7).copy(a, i); + } else { + c.push(v % 1e14); + i += 7; + } + } + i = k / 7; + } else { + CRYPTO = false; + throw Error(bignumberError + "crypto unavailable"); + } + } + if (!CRYPTO) { + for (; i < k; ) { + v = random53bitInt(); + if (v < 9e15) + c[i++] = v % 1e14; + } + } + k = c[--i]; + dp %= LOG_BASE; + if (k && dp) { + v = POWS_TEN[LOG_BASE - dp]; + c[i] = mathfloor(k / v) * v; + } + for (; c[i] === 0; c.pop(), i--) + ; + if (i < 0) { + c = [e = 0]; + } else { + for (e = -1; c[0] === 0; c.splice(0, 1), e -= LOG_BASE) + ; + for (i = 1, v = c[0]; v >= 10; v /= 10, i++) + ; + if (i < LOG_BASE) + e -= LOG_BASE - i; + } + rand.e = e; + rand.c = c; + return rand; + }; + }(); + BigNumber2.sum = function() { + var i = 1, args = arguments, sum = new BigNumber2(args[0]); + for (; i < args.length; ) + sum = sum.plus(args[i++]); + return sum; + }; + convertBase = function() { + var decimal = "0123456789"; + function toBaseOut(str, baseIn, baseOut, alphabet) { + var j, arr = [0], arrL, i = 0, len = str.length; + for (; i < len; ) { + for (arrL = arr.length; arrL--; arr[arrL] *= baseIn) + ; + arr[0] += alphabet.indexOf(str.charAt(i++)); + for (j = 0; j < arr.length; j++) { + if (arr[j] > baseOut - 1) { + if (arr[j + 1] == null) + arr[j + 1] = 0; + arr[j + 1] += arr[j] / baseOut | 0; + arr[j] %= baseOut; + } + } + } + return arr.reverse(); + } + return function(str, baseIn, baseOut, sign, callerIsToString) { + var alphabet, d, e, k, r, x, xc, y, i = str.indexOf("."), dp = DECIMAL_PLACES, rm = ROUNDING_MODE; + if (i >= 0) { + k = POW_PRECISION; + POW_PRECISION = 0; + str = str.replace(".", ""); + y = new BigNumber2(baseIn); + x = y.pow(str.length - i); + POW_PRECISION = k; + y.c = toBaseOut( + toFixedPoint(coeffToString(x.c), x.e, "0"), + 10, + baseOut, + decimal + ); + y.e = y.c.length; + } + xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet = ALPHABET, decimal) : (alphabet = decimal, ALPHABET)); + e = k = xc.length; + for (; xc[--k] == 0; xc.pop()) + ; + if (!xc[0]) + return alphabet.charAt(0); + if (i < 0) { + --e; + } else { + x.c = xc; + x.e = e; + x.s = sign; + x = div(x, y, dp, rm, baseOut); + xc = x.c; + r = x.r; + e = x.e; + } + d = e + dp + 1; + i = xc[d]; + k = baseOut / 2; + r = r || d < 0 || xc[d + 1] != null; + r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7)); + if (d < 1 || !xc[0]) { + str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0); + } else { + xc.length = d; + if (r) { + for (--baseOut; ++xc[--d] > baseOut; ) { + xc[d] = 0; + if (!d) { + ++e; + xc = [1].concat(xc); + } + } + } + for (k = xc.length; !xc[--k]; ) + ; + for (i = 0, str = ""; i <= k; str += alphabet.charAt(xc[i++])) + ; + str = toFixedPoint(str, e, alphabet.charAt(0)); + } + return str; + }; + }(); + div = function() { + function multiply(x, k, base) { + var m, temp, xlo, xhi, carry = 0, i = x.length, klo = k % SQRT_BASE, khi = k / SQRT_BASE | 0; + for (x = x.slice(); i--; ) { + xlo = x[i] % SQRT_BASE; + xhi = x[i] / SQRT_BASE | 0; + m = khi * xlo + xhi * klo; + temp = klo * xlo + m % SQRT_BASE * SQRT_BASE + carry; + carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi; + x[i] = temp % base; + } + if (carry) + x = [carry].concat(x); + return x; + } + function compare2(a, b, aL, bL) { + var i, cmp; + if (aL != bL) { + cmp = aL > bL ? 1 : -1; + } else { + for (i = cmp = 0; i < aL; i++) { + if (a[i] != b[i]) { + cmp = a[i] > b[i] ? 1 : -1; + break; + } + } + } + return cmp; + } + function subtract(a, b, aL, base) { + var i = 0; + for (; aL--; ) { + a[aL] -= i; + i = a[aL] < b[aL] ? 1 : 0; + a[aL] = i * base + a[aL] - b[aL]; + } + for (; !a[0] && a.length > 1; a.splice(0, 1)) + ; + } + return function(x, y, dp, rm, base) { + var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0, yL, yz, s = x.s == y.s ? 1 : -1, xc = x.c, yc = y.c; + if (!xc || !xc[0] || !yc || !yc[0]) { + return new BigNumber2( + // Return NaN if either NaN, or both Infinity or 0. + !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : ( + // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0. + xc && xc[0] == 0 || !yc ? s * 0 : s / 0 + ) + ); + } + q = new BigNumber2(s); + qc = q.c = []; + e = x.e - y.e; + s = dp + e + 1; + if (!base) { + base = BASE; + e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE); + s = s / LOG_BASE | 0; + } + for (i = 0; yc[i] == (xc[i] || 0); i++) + ; + if (yc[i] > (xc[i] || 0)) + e--; + if (s < 0) { + qc.push(1); + more = true; + } else { + xL = xc.length; + yL = yc.length; + i = 0; + s += 2; + n = mathfloor(base / (yc[0] + 1)); + if (n > 1) { + yc = multiply(yc, n, base); + xc = multiply(xc, n, base); + yL = yc.length; + xL = xc.length; + } + xi = yL; + rem = xc.slice(0, yL); + remL = rem.length; + for (; remL < yL; rem[remL++] = 0) + ; + yz = yc.slice(); + yz = [0].concat(yz); + yc0 = yc[0]; + if (yc[1] >= base / 2) + yc0++; + do { + n = 0; + cmp = compare2(yc, rem, yL, remL); + if (cmp < 0) { + rem0 = rem[0]; + if (yL != remL) + rem0 = rem0 * base + (rem[1] || 0); + n = mathfloor(rem0 / yc0); + if (n > 1) { + if (n >= base) + n = base - 1; + prod = multiply(yc, n, base); + prodL = prod.length; + remL = rem.length; + while (compare2(prod, rem, prodL, remL) == 1) { + n--; + subtract(prod, yL < prodL ? yz : yc, prodL, base); + prodL = prod.length; + cmp = 1; + } + } else { + if (n == 0) { + cmp = n = 1; + } + prod = yc.slice(); + prodL = prod.length; + } + if (prodL < remL) + prod = [0].concat(prod); + subtract(rem, prod, remL, base); + remL = rem.length; + if (cmp == -1) { + while (compare2(yc, rem, yL, remL) < 1) { + n++; + subtract(rem, yL < remL ? yz : yc, remL, base); + remL = rem.length; + } + } + } else if (cmp === 0) { + n++; + rem = [0]; + } + qc[i++] = n; + if (rem[0]) { + rem[remL++] = xc[xi] || 0; + } else { + rem = [xc[xi]]; + remL = 1; + } + } while ((xi++ < xL || rem[0] != null) && s--); + more = rem[0] != null; + if (!qc[0]) + qc.splice(0, 1); + } + if (base == BASE) { + for (i = 1, s = qc[0]; s >= 10; s /= 10, i++) + ; + round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more); + } else { + q.e = e; + q.r = +more; + } + return q; + }; + }(); + function format(n, i, rm, id) { + var c0, e, ne, len, str; + if (rm == null) + rm = ROUNDING_MODE; + else + intCheck(rm, 0, 8); + if (!n.c) + return n.toString(); + c0 = n.c[0]; + ne = n.e; + if (i == null) { + str = coeffToString(n.c); + str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) ? toExponential(str, ne) : toFixedPoint(str, ne, "0"); + } else { + n = round(new BigNumber2(n), i, rm); + e = n.e; + str = coeffToString(n.c); + len = str.length; + if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) { + for (; len < i; str += "0", len++) + ; + str = toExponential(str, e); + } else { + i -= ne; + str = toFixedPoint(str, e, "0"); + if (e + 1 > len) { + if (--i > 0) + for (str += "."; i--; str += "0") + ; + } else { + i += e - len; + if (i > 0) { + if (e + 1 == len) + str += "."; + for (; i--; str += "0") + ; + } + } + } + } + return n.s < 0 && c0 ? "-" + str : str; + } + function maxOrMin(args, method) { + var n, i = 1, m = new BigNumber2(args[0]); + for (; i < args.length; i++) { + n = new BigNumber2(args[i]); + if (!n.s) { + m = n; + break; + } else if (method.call(m, n)) { + m = n; + } + } + return m; + } + function normalise(n, c, e) { + var i = 1, j = c.length; + for (; !c[--j]; c.pop()) + ; + for (j = c[0]; j >= 10; j /= 10, i++) + ; + if ((e = i + e * LOG_BASE - 1) > MAX_EXP) { + n.c = n.e = null; + } else if (e < MIN_EXP) { + n.c = [n.e = 0]; + } else { + n.e = e; + n.c = c; + } + return n; + } + parseNumeric = function() { + var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i, dotAfter = /^([^.]+)\\.$/, dotBefore = /^\\.([^.]+)$/, isInfinityOrNaN = /^-?(Infinity|NaN)$/, whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g; + return function(x, str, isNum, b) { + var base, s = isNum ? str : str.replace(whitespaceOrPlus, ""); + if (isInfinityOrNaN.test(s)) { + x.s = isNaN(s) ? null : s < 0 ? -1 : 1; + } else { + if (!isNum) { + s = s.replace(basePrefix, function(m, p1, p2) { + base = (p2 = p2.toLowerCase()) == "x" ? 16 : p2 == "b" ? 2 : 8; + return !b || b == base ? p1 : m; + }); + if (b) { + base = b; + s = s.replace(dotAfter, "$1").replace(dotBefore, "0.$1"); + } + if (str != s) + return new BigNumber2(s, base); + } + if (BigNumber2.DEBUG) { + throw Error(bignumberError + "Not a" + (b ? " base " + b : "") + " number: " + str); + } + x.s = null; + } + x.c = x.e = null; + }; + }(); + function round(x, sd, rm, r) { + var d, i, j, k, n, ni, rd, xc = x.c, pows10 = POWS_TEN; + if (xc) { + out: { + for (d = 1, k = xc[0]; k >= 10; k /= 10, d++) + ; + i = sd - d; + if (i < 0) { + i += LOG_BASE; + j = sd; + n = xc[ni = 0]; + rd = n / pows10[d - j - 1] % 10 | 0; + } else { + ni = mathceil((i + 1) / LOG_BASE); + if (ni >= xc.length) { + if (r) { + for (; xc.length <= ni; xc.push(0)) + ; + n = rd = 0; + d = 1; + i %= LOG_BASE; + j = i - LOG_BASE + 1; + } else { + break out; + } + } else { + n = k = xc[ni]; + for (d = 1; k >= 10; k /= 10, d++) + ; + i %= LOG_BASE; + j = i - LOG_BASE + d; + rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0; + } + } + r = r || sd < 0 || // Are there any non-zero digits after the rounding digit? + // The expression n % pows10[d - j - 1] returns all digits of n to the right + // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714. + xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]); + r = rm < 4 ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 && // Check whether the digit to the left of the rounding digit is odd. + (i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7)); + if (sd < 1 || !xc[0]) { + xc.length = 0; + if (r) { + sd -= x.e + 1; + xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE]; + x.e = -sd || 0; + } else { + xc[0] = x.e = 0; + } + return x; + } + if (i == 0) { + xc.length = ni; + k = 1; + ni--; + } else { + xc.length = ni + 1; + k = pows10[LOG_BASE - i]; + xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0; + } + if (r) { + for (; ; ) { + if (ni == 0) { + for (i = 1, j = xc[0]; j >= 10; j /= 10, i++) + ; + j = xc[0] += k; + for (k = 1; j >= 10; j /= 10, k++) + ; + if (i != k) { + x.e++; + if (xc[0] == BASE) + xc[0] = 1; + } + break; + } else { + xc[ni] += k; + if (xc[ni] != BASE) + break; + xc[ni--] = 0; + k = 1; + } + } + } + for (i = xc.length; xc[--i] === 0; xc.pop()) + ; + } + if (x.e > MAX_EXP) { + x.c = x.e = null; + } else if (x.e < MIN_EXP) { + x.c = [x.e = 0]; + } + } + return x; + } + function valueOf(n) { + var str, e = n.e; + if (e === null) + return n.toString(); + str = coeffToString(n.c); + str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(str, e) : toFixedPoint(str, e, "0"); + return n.s < 0 ? "-" + str : str; + } + P.absoluteValue = P.abs = function() { + var x = new BigNumber2(this); + if (x.s < 0) + x.s = 1; + return x; + }; + P.comparedTo = function(y, b) { + return compare(this, new BigNumber2(y, b)); + }; + P.decimalPlaces = P.dp = function(dp, rm) { + var c, n, v, x = this; + if (dp != null) { + intCheck(dp, 0, MAX); + if (rm == null) + rm = ROUNDING_MODE; + else + intCheck(rm, 0, 8); + return round(new BigNumber2(x), dp + x.e + 1, rm); + } + if (!(c = x.c)) + return null; + n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE; + if (v = c[v]) + for (; v % 10 == 0; v /= 10, n--) + ; + if (n < 0) + n = 0; + return n; + }; + P.dividedBy = P.div = function(y, b) { + return div(this, new BigNumber2(y, b), DECIMAL_PLACES, ROUNDING_MODE); + }; + P.dividedToIntegerBy = P.idiv = function(y, b) { + return div(this, new BigNumber2(y, b), 0, 1); + }; + P.exponentiatedBy = P.pow = function(n, m) { + var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y, x = this; + n = new BigNumber2(n); + if (n.c && !n.isInteger()) { + throw Error(bignumberError + "Exponent not an integer: " + valueOf(n)); + } + if (m != null) + m = new BigNumber2(m); + nIsBig = n.e > 14; + if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) { + y = new BigNumber2(Math.pow(+valueOf(x), nIsBig ? n.s * (2 - isOdd(n)) : +valueOf(n))); + return m ? y.mod(m) : y; + } + nIsNeg = n.s < 0; + if (m) { + if (m.c ? !m.c[0] : !m.s) + return new BigNumber2(NaN); + isModExp = !nIsNeg && x.isInteger() && m.isInteger(); + if (isModExp) + x = x.mod(m); + } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0 ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7 : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) { + k = x.s < 0 && isOdd(n) ? -0 : 0; + if (x.e > -1) + k = 1 / k; + return new BigNumber2(nIsNeg ? 1 / k : k); + } else if (POW_PRECISION) { + k = mathceil(POW_PRECISION / LOG_BASE + 2); + } + if (nIsBig) { + half = new BigNumber2(0.5); + if (nIsNeg) + n.s = 1; + nIsOdd = isOdd(n); + } else { + i = Math.abs(+valueOf(n)); + nIsOdd = i % 2; + } + y = new BigNumber2(ONE); + for (; ; ) { + if (nIsOdd) { + y = y.times(x); + if (!y.c) + break; + if (k) { + if (y.c.length > k) + y.c.length = k; + } else if (isModExp) { + y = y.mod(m); + } + } + if (i) { + i = mathfloor(i / 2); + if (i === 0) + break; + nIsOdd = i % 2; + } else { + n = n.times(half); + round(n, n.e + 1, 1); + if (n.e > 14) { + nIsOdd = isOdd(n); + } else { + i = +valueOf(n); + if (i === 0) + break; + nIsOdd = i % 2; + } + } + x = x.times(x); + if (k) { + if (x.c && x.c.length > k) + x.c.length = k; + } else if (isModExp) { + x = x.mod(m); + } + } + if (isModExp) + return y; + if (nIsNeg) + y = ONE.div(y); + return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y; + }; + P.integerValue = function(rm) { + var n = new BigNumber2(this); + if (rm == null) + rm = ROUNDING_MODE; + else + intCheck(rm, 0, 8); + return round(n, n.e + 1, rm); + }; + P.isEqualTo = P.eq = function(y, b) { + return compare(this, new BigNumber2(y, b)) === 0; + }; + P.isFinite = function() { + return !!this.c; + }; + P.isGreaterThan = P.gt = function(y, b) { + return compare(this, new BigNumber2(y, b)) > 0; + }; + P.isGreaterThanOrEqualTo = P.gte = function(y, b) { + return (b = compare(this, new BigNumber2(y, b))) === 1 || b === 0; + }; + P.isInteger = function() { + return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2; + }; + P.isLessThan = P.lt = function(y, b) { + return compare(this, new BigNumber2(y, b)) < 0; + }; + P.isLessThanOrEqualTo = P.lte = function(y, b) { + return (b = compare(this, new BigNumber2(y, b))) === -1 || b === 0; + }; + P.isNaN = function() { + return !this.s; + }; + P.isNegative = function() { + return this.s < 0; + }; + P.isPositive = function() { + return this.s > 0; + }; + P.isZero = function() { + return !!this.c && this.c[0] == 0; + }; + P.minus = function(y, b) { + var i, j, t, xLTy, x = this, a = x.s; + y = new BigNumber2(y, b); + b = y.s; + if (!a || !b) + return new BigNumber2(NaN); + if (a != b) { + y.s = -b; + return x.plus(y); + } + var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c; + if (!xe || !ye) { + if (!xc || !yc) + return xc ? (y.s = -b, y) : new BigNumber2(yc ? x : NaN); + if (!xc[0] || !yc[0]) { + return yc[0] ? (y.s = -b, y) : new BigNumber2(xc[0] ? x : ( + // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity + ROUNDING_MODE == 3 ? -0 : 0 + )); + } + } + xe = bitFloor(xe); + ye = bitFloor(ye); + xc = xc.slice(); + if (a = xe - ye) { + if (xLTy = a < 0) { + a = -a; + t = xc; + } else { + ye = xe; + t = yc; + } + t.reverse(); + for (b = a; b--; t.push(0)) + ; + t.reverse(); + } else { + j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b; + for (a = b = 0; b < j; b++) { + if (xc[b] != yc[b]) { + xLTy = xc[b] < yc[b]; + break; + } + } + } + if (xLTy) + t = xc, xc = yc, yc = t, y.s = -y.s; + b = (j = yc.length) - (i = xc.length); + if (b > 0) + for (; b--; xc[i++] = 0) + ; + b = BASE - 1; + for (; j > a; ) { + if (xc[--j] < yc[j]) { + for (i = j; i && !xc[--i]; xc[i] = b) + ; + --xc[i]; + xc[j] += BASE; + } + xc[j] -= yc[j]; + } + for (; xc[0] == 0; xc.splice(0, 1), --ye) + ; + if (!xc[0]) { + y.s = ROUNDING_MODE == 3 ? -1 : 1; + y.c = [y.e = 0]; + return y; + } + return normalise(y, xc, ye); + }; + P.modulo = P.mod = function(y, b) { + var q, s, x = this; + y = new BigNumber2(y, b); + if (!x.c || !y.s || y.c && !y.c[0]) { + return new BigNumber2(NaN); + } else if (!y.c || x.c && !x.c[0]) { + return new BigNumber2(x); + } + if (MODULO_MODE == 9) { + s = y.s; + y.s = 1; + q = div(x, y, 0, 3); + y.s = s; + q.s *= s; + } else { + q = div(x, y, 0, MODULO_MODE); + } + y = x.minus(q.times(y)); + if (!y.c[0] && MODULO_MODE == 1) + y.s = x.s; + return y; + }; + P.multipliedBy = P.times = function(y, b) { + var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc, base, sqrtBase, x = this, xc = x.c, yc = (y = new BigNumber2(y, b)).c; + if (!xc || !yc || !xc[0] || !yc[0]) { + if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) { + y.c = y.e = y.s = null; + } else { + y.s *= x.s; + if (!xc || !yc) { + y.c = y.e = null; + } else { + y.c = [0]; + y.e = 0; + } + } + return y; + } + e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE); + y.s *= x.s; + xcL = xc.length; + ycL = yc.length; + if (xcL < ycL) + zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i; + for (i = xcL + ycL, zc = []; i--; zc.push(0)) + ; + base = BASE; + sqrtBase = SQRT_BASE; + for (i = ycL; --i >= 0; ) { + c = 0; + ylo = yc[i] % sqrtBase; + yhi = yc[i] / sqrtBase | 0; + for (k = xcL, j = i + k; j > i; ) { + xlo = xc[--k] % sqrtBase; + xhi = xc[k] / sqrtBase | 0; + m = yhi * xlo + xhi * ylo; + xlo = ylo * xlo + m % sqrtBase * sqrtBase + zc[j] + c; + c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi; + zc[j--] = xlo % base; + } + zc[j] = c; + } + if (c) { + ++e; + } else { + zc.splice(0, 1); + } + return normalise(y, zc, e); + }; + P.negated = function() { + var x = new BigNumber2(this); + x.s = -x.s || null; + return x; + }; + P.plus = function(y, b) { + var t, x = this, a = x.s; + y = new BigNumber2(y, b); + b = y.s; + if (!a || !b) + return new BigNumber2(NaN); + if (a != b) { + y.s = -b; + return x.minus(y); + } + var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c; + if (!xe || !ye) { + if (!xc || !yc) + return new BigNumber2(a / 0); + if (!xc[0] || !yc[0]) + return yc[0] ? y : new BigNumber2(xc[0] ? x : a * 0); + } + xe = bitFloor(xe); + ye = bitFloor(ye); + xc = xc.slice(); + if (a = xe - ye) { + if (a > 0) { + ye = xe; + t = yc; + } else { + a = -a; + t = xc; + } + t.reverse(); + for (; a--; t.push(0)) + ; + t.reverse(); + } + a = xc.length; + b = yc.length; + if (a - b < 0) + t = yc, yc = xc, xc = t, b = a; + for (a = 0; b; ) { + a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0; + xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE; + } + if (a) { + xc = [a].concat(xc); + ++ye; + } + return normalise(y, xc, ye); + }; + P.precision = P.sd = function(sd, rm) { + var c, n, v, x = this; + if (sd != null && sd !== !!sd) { + intCheck(sd, 1, MAX); + if (rm == null) + rm = ROUNDING_MODE; + else + intCheck(rm, 0, 8); + return round(new BigNumber2(x), sd, rm); + } + if (!(c = x.c)) + return null; + v = c.length - 1; + n = v * LOG_BASE + 1; + if (v = c[v]) { + for (; v % 10 == 0; v /= 10, n--) + ; + for (v = c[0]; v >= 10; v /= 10, n++) + ; + } + if (sd && x.e + 1 > n) + n = x.e + 1; + return n; + }; + P.shiftedBy = function(k) { + intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER); + return this.times("1e" + k); + }; + P.squareRoot = P.sqrt = function() { + var m, n, r, rep, t, x = this, c = x.c, s = x.s, e = x.e, dp = DECIMAL_PLACES + 4, half = new BigNumber2("0.5"); + if (s !== 1 || !c || !c[0]) { + return new BigNumber2(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0); + } + s = Math.sqrt(+valueOf(x)); + if (s == 0 || s == 1 / 0) { + n = coeffToString(c); + if ((n.length + e) % 2 == 0) + n += "0"; + s = Math.sqrt(+n); + e = bitFloor((e + 1) / 2) - (e < 0 || e % 2); + if (s == 1 / 0) { + n = "5e" + e; + } else { + n = s.toExponential(); + n = n.slice(0, n.indexOf("e") + 1) + e; + } + r = new BigNumber2(n); + } else { + r = new BigNumber2(s + ""); + } + if (r.c[0]) { + e = r.e; + s = e + dp; + if (s < 3) + s = 0; + for (; ; ) { + t = r; + r = half.times(t.plus(div(x, t, dp, 1))); + if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) { + if (r.e < e) + --s; + n = n.slice(s - 3, s + 1); + if (n == "9999" || !rep && n == "4999") { + if (!rep) { + round(t, t.e + DECIMAL_PLACES + 2, 0); + if (t.times(t).eq(x)) { + r = t; + break; + } + } + dp += 4; + s += 4; + rep = 1; + } else { + if (!+n || !+n.slice(1) && n.charAt(0) == "5") { + round(r, r.e + DECIMAL_PLACES + 2, 1); + m = !r.times(r).eq(x); + } + break; + } + } + } + } + return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m); + }; + P.toExponential = function(dp, rm) { + if (dp != null) { + intCheck(dp, 0, MAX); + dp++; + } + return format(this, dp, rm, 1); + }; + P.toFixed = function(dp, rm) { + if (dp != null) { + intCheck(dp, 0, MAX); + dp = dp + this.e + 1; + } + return format(this, dp, rm); + }; + P.toFormat = function(dp, rm, format2) { + var str, x = this; + if (format2 == null) { + if (dp != null && rm && typeof rm == "object") { + format2 = rm; + rm = null; + } else if (dp && typeof dp == "object") { + format2 = dp; + dp = rm = null; + } else { + format2 = FORMAT; + } + } else if (typeof format2 != "object") { + throw Error(bignumberError + "Argument not an object: " + format2); + } + str = x.toFixed(dp, rm); + if (x.c) { + var i, arr = str.split("."), g1 = +format2.groupSize, g2 = +format2.secondaryGroupSize, groupSeparator = format2.groupSeparator || "", intPart = arr[0], fractionPart = arr[1], isNeg = x.s < 0, intDigits = isNeg ? intPart.slice(1) : intPart, len = intDigits.length; + if (g2) + i = g1, g1 = g2, g2 = i, len -= i; + if (g1 > 0 && len > 0) { + i = len % g1 || g1; + intPart = intDigits.substr(0, i); + for (; i < len; i += g1) + intPart += groupSeparator + intDigits.substr(i, g1); + if (g2 > 0) + intPart += groupSeparator + intDigits.slice(i); + if (isNeg) + intPart = "-" + intPart; + } + str = fractionPart ? intPart + (format2.decimalSeparator || "") + ((g2 = +format2.fractionGroupSize) ? fractionPart.replace( + new RegExp("\\d{" + g2 + "}\\B", "g"), + "$&" + (format2.fractionGroupSeparator || "") + ) : fractionPart) : intPart; + } + return (format2.prefix || "") + str + (format2.suffix || ""); + }; + P.toFraction = function(md) { + var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s, x = this, xc = x.c; + if (md != null) { + n = new BigNumber2(md); + if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) { + throw Error(bignumberError + "Argument " + (n.isInteger() ? "out of range: " : "not an integer: ") + valueOf(n)); + } + } + if (!xc) + return new BigNumber2(x); + d = new BigNumber2(ONE); + n1 = d0 = new BigNumber2(ONE); + d1 = n0 = new BigNumber2(ONE); + s = coeffToString(xc); + e = d.e = s.length - x.e - 1; + d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp]; + md = !md || n.comparedTo(d) > 0 ? e > 0 ? d : n1 : n; + exp = MAX_EXP; + MAX_EXP = 1 / 0; + n = new BigNumber2(s); + n0.c[0] = 0; + for (; ; ) { + q = div(n, d, 0, 1); + d2 = d0.plus(q.times(d1)); + if (d2.comparedTo(md) == 1) + break; + d0 = d1; + d1 = d2; + n1 = n0.plus(q.times(d2 = n1)); + n0 = d2; + d = n.minus(q.times(d2 = d)); + n = d2; + } + d2 = div(md.minus(d0), d1, 0, 1); + n0 = n0.plus(d2.times(n1)); + d0 = d0.plus(d2.times(d1)); + n0.s = n1.s = x.s; + e = e * 2; + r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo( + div(n0, d0, e, ROUNDING_MODE).minus(x).abs() + ) < 1 ? [n1, d1] : [n0, d0]; + MAX_EXP = exp; + return r; + }; + P.toNumber = function() { + return +valueOf(this); + }; + P.toPrecision = function(sd, rm) { + if (sd != null) + intCheck(sd, 1, MAX); + return format(this, sd, rm, 2); + }; + P.toString = function(b) { + var str, n = this, s = n.s, e = n.e; + if (e === null) { + if (s) { + str = "Infinity"; + if (s < 0) + str = "-" + str; + } else { + str = "NaN"; + } + } else { + if (b == null) { + str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(coeffToString(n.c), e) : toFixedPoint(coeffToString(n.c), e, "0"); + } else if (b === 10 && alphabetHasNormalDecimalDigits) { + n = round(new BigNumber2(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE); + str = toFixedPoint(coeffToString(n.c), n.e, "0"); + } else { + intCheck(b, 2, ALPHABET.length, "Base"); + str = convertBase(toFixedPoint(coeffToString(n.c), e, "0"), 10, b, s, true); + } + if (s < 0 && n.c[0]) + str = "-" + str; + } + return str; + }; + P.valueOf = P.toJSON = function() { + return valueOf(this); + }; + P._isBigNumber = true; + P[Symbol.toStringTag] = "BigNumber"; + P[Symbol.for("nodejs.util.inspect.custom")] = P.valueOf; + if (configObject != null) + BigNumber2.set(configObject); + return BigNumber2; +} +function bitFloor(n) { + var i = n | 0; + return n > 0 || n === i ? i : i - 1; +} +function coeffToString(a) { + var s, z, i = 1, j = a.length, r = a[0] + ""; + for (; i < j; ) { + s = a[i++] + ""; + z = LOG_BASE - s.length; + for (; z--; s = "0" + s) + ; + r += s; + } + for (j = r.length; r.charCodeAt(--j) === 48; ) + ; + return r.slice(0, j + 1 || 1); +} +function compare(x, y) { + var a, b, xc = x.c, yc = y.c, i = x.s, j = y.s, k = x.e, l = y.e; + if (!i || !j) + return null; + a = xc && !xc[0]; + b = yc && !yc[0]; + if (a || b) + return a ? b ? 0 : -j : i; + if (i != j) + return i; + a = i < 0; + b = k == l; + if (!xc || !yc) + return b ? 0 : !xc ^ a ? 1 : -1; + if (!b) + return k > l ^ a ? 1 : -1; + j = (k = xc.length) < (l = yc.length) ? k : l; + for (i = 0; i < j; i++) + if (xc[i] != yc[i]) + return xc[i] > yc[i] ^ a ? 1 : -1; + return k == l ? 0 : k > l ^ a ? 1 : -1; +} +function intCheck(n, min, max, name) { + if (n < min || n > max || n !== mathfloor(n)) { + throw Error(bignumberError + (name || "Argument") + (typeof n == "number" ? n < min || n > max ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n)); + } +} +function isOdd(n) { + var k = n.c.length - 1; + return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0; +} +function toExponential(str, e) { + return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e < 0 ? "e" : "e+") + e; +} +function toFixedPoint(str, e, z) { + var len, zs; + if (e < 0) { + for (zs = z + "."; ++e; zs += z) + ; + str = zs + str; + } else { + len = str.length; + if (++e > len) { + for (zs = z, e -= len; --e; zs += z) + ; + str += zs; + } else if (e < len) { + str = str.slice(0, e) + "." + str.slice(e); + } + } + return str; +} +var BigNumberClone = clone(); +var bignumber_default = BigNumberClone; +// src/util.js +var ce = (flag, message) => (p) => flag ? Left(message) : Right(p); +function isInteger(v) { + return new bignumber_default(v).isInteger(); +} +function roundDown(v) { + return new bignumber_default(v).integerValue(bignumber_default.ROUND_DOWN).toNumber(); +} +var addClaimBalanceTo = ({ state, action }) => { + const indexToRemove = state.claimable.findIndex( + (claim3) => claim3.txID === action.input.txID + ); + const claim2 = state.claimable[indexToRemove]; + const balance2 = state.balances[claim2.to] || 0; + state.balances[claim2.to] = balance2 + claim2.qty; + return indexToRemove; +}; +var addClaimBalanceFrom = ({ state, action }) => { + const indexToRemove = state.claimable.findIndex( + (claim3) => claim3.txID === action.input.tx + ); + const claim2 = state.claimable[indexToRemove]; + const balance2 = state.balances[claim2.from] || 0; + state.balances[claim2.from] = balance2 + claim2.qty; + return indexToRemove; +}; +function isArweaveAddress(address) { + if (!address) + return void 0; + const addr = address.toString().trim(); + return /[a-z0-9_-]{43}/i.test(addr); +} +// src/write/transfer.js +function transfer(state, action) { + return of({ state, action }).chain(fromNullable).chain(ce(!action.input?.target, "Please specify a target.")).chain( + ce(action.input?.target === action.caller, "Target cannot be caller.") + ).chain(ce(!isArweaveAddress(action.input?.target), "Invalid target.")).chain(ce(!isInteger(action.input?.qty), "qty must be an integer.")).chain( + ce( + roundDown(action.input?.qty) < 1, + "Invalid token transfer. qty must be an integer greater than 0." + ) + ).chain( + ce( + (state.balances[action.caller] || 0) < roundDown(action.input?.qty), + "Not enough tokens for transfer." + ) + ).map(updateBalances).fold( + (error) => { + throw new ContractError(error || "An error occurred."); + }, + () => ({ state }) + ); +} +var updateBalances = ({ state, action }) => { + const safeQty = roundDown(action.input.qty); + state.balances[action.caller] -= safeQty; + const targetBalance = state.balances[action.input.target] || 0; + state.balances[action.input.target] = targetBalance + safeQty; +}; +// src/write/claim.js +function claim(state, action) { + return of({ state, action }).chain(fromNullable).chain( + ce(!action.input?.txID, "txID must be passed to the claim function.") + ).chain(ce(!action.input?.qty, "A qty must be specified.")).chain( + ce( + state.claimable.filter((c) => c.txID === action.input.txID).length !== 1, + "There must be 1 claimable with this tx id." + ) + ).chain( + ce( + state.claimable.filter((c) => c.txID === action.input?.txID)[0]?.to !== action.caller, + "Claim not addressed to caller." + ) + ).chain( + ce( + state.claimable.filter((c) => c.txID === action.input.txID)[0]?.qty !== action.input?.qty, + "Incorrect qty." + ) + ).map(addClaimBalanceTo).map((indexToRemove) => { + state.claimable.splice(indexToRemove, 1); + return state; + }).fold( + (msg) => { + throw new ContractError(msg || "An error occurred."); + }, + () => { + return { state }; + } + ); +} +// src/write/allow.js +function allow(state, action) { + return of(action.caller).chain(fromNullable).chain(ce(!action.input?.target, "Please specify a target.")).chain( + ce(action.input?.target === action.caller, "Target cannot be caller.") + ).chain(ce(!isArweaveAddress(action.input?.target), "Invalid target.")).chain(ce(!isInteger(action.input?.qty), "qty must be an integer.")).chain( + ce( + roundDown(action.input?.qty) < 1, + "Invalid token transfer. qty must be an integer greater than 0." + ) + ).chain( + ce( + (state.balances[action.caller] || 0) < roundDown(action.input?.qty), + "Not enough tokens for transfer." + ) + ).map((caller) => { + const safeQty = roundDown(action.input.qty); + state.balances[caller] -= safeQty; + state.claimable.push({ + from: caller, + to: action.input.target, + qty: safeQty, + txID: SmartWeave.transaction.id + }); + }).fold( + (msg) => { + throw new ContractError(msg || "An error occurred."); + }, + () => ({ state }) + ); +} +// src/write/test-mint.js +function mint(state, action) { + if (!state.block) + state.block = SmartWeave?.block?.height + 720; + if (SmartWeave?.block?.height > state.block) { + state.block = SmartWeave?.block?.height + 720; + state.minted = []; + } + if (state.minted.includes(action.caller)) + return { state }; + const balance2 = state.balances[action.caller] || 0; + state.balances[action.caller] = balance2 + 1e6; + state.minted.push(action.caller); + return { state }; +} +// src/write/reject.js +function rejectClaimable(state, action) { + return of({ state, action }).chain(fromNullable).chain(ce(!action.input?.tx, "txID must be passed to the reject function.")).chain( + ce( + state.claimable.filter((c) => c.txID === action.input.tx).length !== 1, + "There must be 1 claimable with this tx id." + ) + ).chain( + ce( + state.claimable.filter((c) => c.txID === action.input.tx)[0]?.to !== action.caller, + "Claim not addressed to caller." + ) + ).map(addClaimBalanceFrom).map((indexToRemove) => { + state.claimable.splice(indexToRemove, 1); + return state; + }).fold( + (msg) => { + throw new ContractError(msg || "An error occurred."); + }, + (state2) => ({ state: state2 }) + ); +} +// src/test-contract.js +export async function handle(state, action) { + if (SmartWeave.transaction.origin === "L1") { + return { state }; + } + switch (action?.input?.function) { + case "balance": + return balance(state, action); + case "reject": + return rejectClaimable(state, action); + case "transfer": + return transfer(state, action); + case "allow": + return allow(state, action); + case "claim": + return claim(state, action); + case "mint": + return mint(state, action); + default: + throw new ContractError( + \`No function supplied or function not recognized\` + ); + } +} + +`,bz=` +{ + "name": "test-U", + "note": "Dad <3's U B & R!", + "block": null, + "owner": "9x24zjvs9DA5zAz2DmqBWAg6XcxrrE-8w3EkpwRm4e4", + "minted": [], + "ticker": "test-U", + "balances": { + "9x24zjvs9DA5zAz2DmqBWAg6XcxrrE-8w3EkpwRm4e4": 100000000 + }, + "settings": [ + [ + "isTradeable", + true + ], + [ + "communityLogo", + "J3WXX4OGa6wP5E9oLhNyqlN4deYI7ARjrd5se740ftE" + ] + ], + "claimable": [], + "divisibility": 1000000 +} +`,wz=` + +// Welcome to BetterIDE Studio +// Feel free to edit the following smartweave contract code and add your own functions + +// This is a contract function +function _set(state, action) { + ContractAssert(action.input.key, "Key not supplied") + ContractAssert(action.input.value, "Value not supplied") + // Modify state with the input + state.db[action.input.key] = action.input.value + return { state } +} + +function _get(state) { + ContractAssert(action.input.key, "Key not supplied") + // simply return the value for myName key in state + return { result: state.db[action.input.key] } +} + +function _delete(state) { + ContractAssert(action.input.key, "Key not supplied") + delete state.db[action.input.key] + return { state } +} + +// This is the handler for all contract functions +export function handle(state, action) { + const input = action.input + switch (input.function) { + case "set": + return _set(state, action); + // no need for break statement because we are using return + case "get": + return _get(state, action); + case "delete": + return _delete(state, action) + default: + throw new ContractError(\`Function not recognised: "\${input.function}"\`) + } +} + + +`,Ez=` +{ + "db":{} +} + +`;function Sz({contracts:t}){const e=Wo(),[r]=K.useState(JSON.parse(localStorage.getItem("recents"))||[]);function n(o){e(Uy(o))}function i(o){e(Oo(o))}function s(o){oI(o)}function a({name:o,src:c,state:u}){return te.jsxs("div",{className:"flex min-w-[150px] flex-col gap-2 rounded p-2 px-3 ring-1 ring-white/50 hover:bg-white/5",children:[te.jsx("div",{className:"text-lg",children:o}),te.jsxs("button",{className:"relative w-14 rounded bg-[#2c3b50] px-2 text-left transition-all duration-300 hover:w-24 hover:bg-[#395d8b]",onClick:()=>{const l=[...r];if(c&&u){const f=t.newContract(c,u);f&&(setTimeout(()=>{s(f),n("README.md"),i("Contracts")},400),l.includes(f)&&l.splice(l.indexOf(f),1),l.unshift(f),localStorage.setItem("recents",JSON.stringify(l)))}else s(o),n("README.md"),i("Contracts"),l.includes(o)&&l.splice(l.indexOf(o),1),l.unshift(o),localStorage.setItem("recents",JSON.stringify(l))},children:[c&&u?"edit":"open",te.jsx("div",{className:"absolute right-2 top-0 w-full text-right text-transparent hover:text-white",children:"->"})]})]})}return te.jsxs("div",{className:" flex h-full flex-col items-center justify-center gap-1",children:[te.jsx("div",{className:"text-2xl",children:"Welcome to BetterIDEa! 🚀"}),te.jsx("div",{className:"text-lg",children:"Your one stop solution for developing smart contracts on Arweave"}),te.jsxs("div",{className:"flex w-full flex-col items-start justify-start gap-5 px-10",children:[te.jsxs("div",{children:[te.jsx("div",{className:"my-1 text-xl",children:r.length==0?"No recently opened contracts":"Recently opened contracts"}),te.jsx("div",{className:"flex gap-3",children:r.map(o=>te.jsx(a,{name:o}))})]}),te.jsxs("div",{children:[te.jsx("div",{className:"my-1 text-xl",children:"Explore contract templates"}),te.jsxs("div",{className:"flex gap-3",children:[te.jsx(a,{name:"Vote",src:vz,state:yz}),te.jsx(a,{name:"Database",src:wz,state:Ez}),te.jsx(a,{name:"U-Token",src:xz,state:bz})]})]})]})]})}const Az="modulepreload",Cz=function(t){return"/"+t},zS={},A4=function(e,r,n){let i=Promise.resolve();if(r&&r.length>0){const s=document.getElementsByTagName("link");i=Promise.all(r.map(a=>{if(a=Cz(a),a in zS)return;zS[a]=!0;const o=a.endsWith(".css"),c=o?'[rel="stylesheet"]':"";if(!!n)for(let f=s.length-1;f>=0;f--){const d=s[f];if(d.href===a&&(!o||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${c}`))return;const l=document.createElement("link");if(l.rel=o?"stylesheet":Az,o||(l.as="script",l.crossOrigin=""),l.href=a,document.head.appendChild(l),o)return new Promise((f,d)=>{l.addEventListener("load",f),l.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${a}`)))})}))}return i.then(()=>e()).catch(s=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s})};function pI(t,e){return function(){return t.apply(e,arguments)}}const{toString:_z}=Object.prototype,{getPrototypeOf:l5}=Object,$y=(t=>e=>{const r=_z.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Ua=t=>(t=t.toLowerCase(),e=>$y(e)===t),zy=t=>e=>typeof e===t,{isArray:Hh}=Array,Np=zy("undefined");function kz(t){return t!==null&&!Np(t)&&t.constructor!==null&&!Np(t.constructor)&&ns(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const gI=Ua("ArrayBuffer");function Bz(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&gI(t.buffer),e}const Iz=zy("string"),ns=zy("function"),mI=zy("number"),Hy=t=>t!==null&&typeof t=="object",Fz=t=>t===!0||t===!1,om=t=>{if($y(t)!=="object")return!1;const e=l5(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Pz=Ua("Date"),Tz=Ua("File"),Nz=Ua("Blob"),Rz=Ua("FileList"),Dz=t=>Hy(t)&&ns(t.pipe),Oz=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||ns(t.append)&&((e=$y(t))==="formdata"||e==="object"&&ns(t.toString)&&t.toString()==="[object FormData]"))},Mz=Ua("URLSearchParams"),Lz=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Hg(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Hh(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const yI=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,xI=t=>!Np(t)&&t!==yI;function C4(){const{caseless:t}=xI(this)&&this||{},e={},r=(n,i)=>{const s=t&&vI(e,i)||i;om(e[s])&&om(n)?e[s]=C4(e[s],n):om(n)?e[s]=C4({},n):Hh(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(Hg(e,(i,s)=>{r&&ns(i)?t[s]=pI(i,r):t[s]=i},{allOwnKeys:n}),t),Uz=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),$z=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},zz=(t,e,r,n)=>{let i,s,a;const o={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)a=i[s],(!n||n(a,t,e))&&!o[a]&&(e[a]=t[a],o[a]=!0);t=r!==!1&&l5(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},Hz=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},Vz=t=>{if(!t)return null;if(Hh(t))return t;let e=t.length;if(!mI(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},qz=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&l5(Uint8Array)),Kz=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},Wz=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},Gz=Ua("HTMLFormElement"),Zz=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),HS=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Jz=Ua("RegExp"),bI=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};Hg(r,(i,s)=>{let a;(a=e(i,s,t))!==!1&&(n[s]=a||i)}),Object.defineProperties(t,n)},Xz=t=>{bI(t,(e,r)=>{if(ns(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(ns(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Qz=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Hh(t)?n(t):n(String(t).split(e)),r},Yz=()=>{},eH=(t,e)=>(t=+t,Number.isFinite(t)?t:e),Nx="abcdefghijklmnopqrstuvwxyz",VS="0123456789",wI={DIGIT:VS,ALPHA:Nx,ALPHA_DIGIT:Nx+Nx.toUpperCase()+VS},tH=(t=16,e=wI.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function rH(t){return!!(t&&ns(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const nH=t=>{const e=new Array(10),r=(n,i)=>{if(Hy(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Hh(n)?[]:{};return Hg(n,(a,o)=>{const c=r(a,i+1);!Np(c)&&(s[o]=c)}),e[i]=void 0,s}}return n};return r(t,0)},iH=Ua("AsyncFunction"),sH=t=>t&&(Hy(t)||ns(t))&&ns(t.then)&&ns(t.catch),Be={isArray:Hh,isArrayBuffer:gI,isBuffer:kz,isFormData:Oz,isArrayBufferView:Bz,isString:Iz,isNumber:mI,isBoolean:Fz,isObject:Hy,isPlainObject:om,isUndefined:Np,isDate:Pz,isFile:Tz,isBlob:Nz,isRegExp:Jz,isFunction:ns,isStream:Dz,isURLSearchParams:Mz,isTypedArray:qz,isFileList:Rz,forEach:Hg,merge:C4,extend:jz,trim:Lz,stripBOM:Uz,inherits:$z,toFlatObject:zz,kindOf:$y,kindOfTest:Ua,endsWith:Hz,toArray:Vz,forEachEntry:Kz,matchAll:Wz,isHTMLForm:Gz,hasOwnProperty:HS,hasOwnProp:HS,reduceDescriptors:bI,freezeMethods:Xz,toObjectSet:Qz,toCamelCase:Zz,noop:Yz,toFiniteNumber:eH,findKey:vI,global:yI,isContextDefined:xI,ALPHABET:wI,generateString:tH,isSpecCompliantForm:rH,toJSONObject:nH,isAsyncFn:iH,isThenable:sH};function Bt(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}Be.inherits(Bt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Be.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const EI=Bt.prototype,SI={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{SI[t]={value:t}});Object.defineProperties(Bt,SI);Object.defineProperty(EI,"isAxiosError",{value:!0});Bt.from=(t,e,r,n,i,s)=>{const a=Object.create(EI);return Be.toFlatObject(t,a,function(c){return c!==Error.prototype},o=>o!=="isAxiosError"),Bt.call(a,t.message,e,r,n,i),a.cause=t,a.name=t.name,s&&Object.assign(a,s),a};const aH=null;function _4(t){return Be.isPlainObject(t)||Be.isArray(t)}function AI(t){return Be.endsWith(t,"[]")?t.slice(0,-2):t}function qS(t,e,r){return t?t.concat(e).map(function(i,s){return i=AI(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function oH(t){return Be.isArray(t)&&!t.some(_4)}const cH=Be.toFlatObject(Be,{},null,function(e){return/^is[A-Z]/.test(e)});function Vy(t,e,r){if(!Be.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Be.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,v){return!Be.isUndefined(v[g])});const n=r.metaTokens,i=r.visitor||l,s=r.dots,a=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&Be.isSpecCompliantForm(e);if(!Be.isFunction(i))throw new TypeError("visitor must be a function");function u(h){if(h===null)return"";if(Be.isDate(h))return h.toISOString();if(!c&&Be.isBlob(h))throw new Bt("Blob is not supported. Use a Buffer instead.");return Be.isArrayBuffer(h)||Be.isTypedArray(h)?c&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function l(h,g,v){let x=h;if(h&&!v&&typeof h=="object"){if(Be.endsWith(g,"{}"))g=n?g:g.slice(0,-2),h=JSON.stringify(h);else if(Be.isArray(h)&&oH(h)||(Be.isFileList(h)||Be.endsWith(g,"[]"))&&(x=Be.toArray(h)))return g=AI(g),x.forEach(function(S,_){!(Be.isUndefined(S)||S===null)&&e.append(a===!0?qS([g],_,s):a===null?g:g+"[]",u(S))}),!1}return _4(h)?!0:(e.append(qS(v,g,s),u(h)),!1)}const f=[],d=Object.assign(cH,{defaultVisitor:l,convertValue:u,isVisitable:_4});function p(h,g){if(!Be.isUndefined(h)){if(f.indexOf(h)!==-1)throw Error("Circular reference detected in "+g.join("."));f.push(h),Be.forEach(h,function(x,b){(!(Be.isUndefined(x)||x===null)&&i.call(e,x,Be.isString(b)?b.trim():b,g,d))===!0&&p(x,g?g.concat(b):[b])}),f.pop()}}if(!Be.isObject(t))throw new TypeError("data must be an object");return p(t),e}function KS(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function f5(t,e){this._pairs=[],t&&Vy(t,this,e)}const CI=f5.prototype;CI.append=function(e,r){this._pairs.push([e,r])};CI.toString=function(e){const r=e?function(n){return e.call(this,n,KS)}:KS;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function uH(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function _I(t,e,r){if(!e)return t;const n=r&&r.encode||uH,i=r&&r.serialize;let s;if(i?s=i(e,r):s=Be.isURLSearchParams(e)?e.toString():new f5(e,r).toString(n),s){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class WS{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Be.forEach(this.handlers,function(n){n!==null&&e(n)})}}const kI={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},lH=typeof URLSearchParams<"u"?URLSearchParams:f5,fH=typeof FormData<"u"?FormData:null,dH=typeof Blob<"u"?Blob:null,hH={isBrowser:!0,classes:{URLSearchParams:lH,FormData:fH,Blob:dH},protocols:["http","https","file","blob","url","data"]},BI=typeof window<"u"&&typeof document<"u",pH=(t=>BI&&["ReactNative","NativeScript","NS"].indexOf(t)<0)(typeof navigator<"u"&&navigator.product),gH=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",mH=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:BI,hasStandardBrowserEnv:pH,hasStandardBrowserWebWorkerEnv:gH},Symbol.toStringTag,{value:"Module"})),Ca={...mH,...hH};function vH(t,e){return Vy(t,new Ca.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Ca.isNode&&Be.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function yH(t){return Be.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function xH(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return a=!a&&Be.isArray(i)?i.length:a,c?(Be.hasOwnProp(i,a)?i[a]=[i[a],n]:i[a]=n,!o):((!i[a]||!Be.isObject(i[a]))&&(i[a]=[]),e(r,n,i[a],s)&&Be.isArray(i[a])&&(i[a]=xH(i[a])),!o)}if(Be.isFormData(t)&&Be.isFunction(t.entries)){const r={};return Be.forEachEntry(t,(n,i)=>{e(yH(n),i,r,0)}),r}return null}function bH(t,e,r){if(Be.isString(t))try{return(e||JSON.parse)(t),Be.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const d5={transitional:kI,adapter:["xhr","http"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Be.isObject(e);if(s&&Be.isHTMLForm(e)&&(e=new FormData(e)),Be.isFormData(e))return i?JSON.stringify(II(e)):e;if(Be.isArrayBuffer(e)||Be.isBuffer(e)||Be.isStream(e)||Be.isFile(e)||Be.isBlob(e))return e;if(Be.isArrayBufferView(e))return e.buffer;if(Be.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return vH(e,this.formSerializer).toString();if((o=Be.isFileList(e))||n.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Vy(o?{"files[]":e}:e,c&&new c,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),bH(e)):e}],transformResponse:[function(e){const r=this.transitional||d5.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(e&&Be.isString(e)&&(n&&!this.responseType||i)){const a=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(o){if(a)throw o.name==="SyntaxError"?Bt.from(o,Bt.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ca.classes.FormData,Blob:Ca.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Be.forEach(["delete","get","head","post","put","patch"],t=>{d5.headers[t]={}});const h5=d5,wH=Be.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),EH=t=>{const e={};let r,n,i;return t&&t.split(` +`).forEach(function(a){i=a.indexOf(":"),r=a.substring(0,i).trim().toLowerCase(),n=a.substring(i+1).trim(),!(!r||e[r]&&wH[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},GS=Symbol("internals");function b0(t){return t&&String(t).trim().toLowerCase()}function cm(t){return t===!1||t==null?t:Be.isArray(t)?t.map(cm):String(t)}function SH(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const AH=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Rx(t,e,r,n,i){if(Be.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Be.isString(e)){if(Be.isString(n))return e.indexOf(n)!==-1;if(Be.isRegExp(n))return n.test(e)}}function CH(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function _H(t,e){const r=Be.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,a){return this[n].call(this,e,i,s,a)},configurable:!0})})}class qy{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(o,c,u){const l=b0(c);if(!l)throw new Error("header name must be a non-empty string");const f=Be.findKey(i,l);(!f||i[f]===void 0||u===!0||u===void 0&&i[f]!==!1)&&(i[f||c]=cm(o))}const a=(o,c)=>Be.forEach(o,(u,l)=>s(u,l,c));return Be.isPlainObject(e)||e instanceof this.constructor?a(e,r):Be.isString(e)&&(e=e.trim())&&!AH(e)?a(EH(e),r):e!=null&&s(r,e,n),this}get(e,r){if(e=b0(e),e){const n=Be.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return SH(i);if(Be.isFunction(r))return r.call(this,i,n);if(Be.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=b0(e),e){const n=Be.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||Rx(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(a){if(a=b0(a),a){const o=Be.findKey(n,a);o&&(!r||Rx(n,n[o],o,r))&&(delete n[o],i=!0)}}return Be.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||Rx(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Be.forEach(this,(i,s)=>{const a=Be.findKey(n,s);if(a){r[a]=cm(i),delete r[s];return}const o=e?CH(s):String(s).trim();o!==s&&delete r[s],r[o]=cm(i),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Be.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Be.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[GS]=this[GS]={accessors:{}}).accessors,i=this.prototype;function s(a){const o=b0(a);n[o]||(_H(i,a),n[o]=!0)}return Be.isArray(e)?e.forEach(s):s(e),this}}qy.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Be.reduceDescriptors(qy.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});Be.freezeMethods(qy);const _o=qy;function Dx(t,e){const r=this||h5,n=e||r,i=_o.from(n.headers);let s=n.data;return Be.forEach(t,function(o){s=o.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function FI(t){return!!(t&&t.__CANCEL__)}function Vg(t,e,r){Bt.call(this,t??"canceled",Bt.ERR_CANCELED,e,r),this.name="CanceledError"}Be.inherits(Vg,Bt,{__CANCEL__:!0});function kH(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new Bt("Request failed with status code "+r.status,[Bt.ERR_BAD_REQUEST,Bt.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}const BH=Ca.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const a=[t+"="+encodeURIComponent(e)];Be.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),Be.isString(n)&&a.push("path="+n),Be.isString(i)&&a.push("domain="+i),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function IH(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function FH(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function PI(t,e){return t&&!IH(e)?FH(t,e):e}const PH=Ca.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");let n;function i(s){let a=s;return e&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(a){const o=Be.isString(a)?i(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}();function TH(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function NH(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,a;return e=e!==void 0?e:1e3,function(c){const u=Date.now(),l=n[s];a||(a=u),r[i]=c,n[i]=u;let f=s,d=0;for(;f!==i;)d+=r[f++],f=f%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),u-a{const s=i.loaded,a=i.lengthComputable?i.total:void 0,o=s-r,c=n(o),u=s<=a;r=s;const l={loaded:s,total:a,progress:a?s/a:void 0,bytes:o,rate:c||void 0,estimated:c&&a&&u?(a-s)/c:void 0,event:i};l[e?"download":"upload"]=!0,t(l)}}const RH=typeof XMLHttpRequest<"u",DH=RH&&function(t){return new Promise(function(r,n){let i=t.data;const s=_o.from(t.headers).normalize();let{responseType:a,withXSRFToken:o}=t,c;function u(){t.cancelToken&&t.cancelToken.unsubscribe(c),t.signal&&t.signal.removeEventListener("abort",c)}let l;if(Be.isFormData(i)){if(Ca.hasStandardBrowserEnv||Ca.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((l=s.getContentType())!==!1){const[g,...v]=l?l.split(";").map(x=>x.trim()).filter(Boolean):[];s.setContentType([g||"multipart/form-data",...v].join("; "))}}let f=new XMLHttpRequest;if(t.auth){const g=t.auth.username||"",v=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(g+":"+v))}const d=PI(t.baseURL,t.url);f.open(t.method.toUpperCase(),_I(d,t.params,t.paramsSerializer),!0),f.timeout=t.timeout;function p(){if(!f)return;const g=_o.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders()),x={data:!a||a==="text"||a==="json"?f.responseText:f.response,status:f.status,statusText:f.statusText,headers:g,config:t,request:f};kH(function(S){r(S),u()},function(S){n(S),u()},x),f=null}if("onloadend"in f?f.onloadend=p:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(p)},f.onabort=function(){f&&(n(new Bt("Request aborted",Bt.ECONNABORTED,t,f)),f=null)},f.onerror=function(){n(new Bt("Network Error",Bt.ERR_NETWORK,t,f)),f=null},f.ontimeout=function(){let v=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const x=t.transitional||kI;t.timeoutErrorMessage&&(v=t.timeoutErrorMessage),n(new Bt(v,x.clarifyTimeoutError?Bt.ETIMEDOUT:Bt.ECONNABORTED,t,f)),f=null},Ca.hasStandardBrowserEnv&&(o&&Be.isFunction(o)&&(o=o(t)),o||o!==!1&&PH(d))){const g=t.xsrfHeaderName&&t.xsrfCookieName&&BH.read(t.xsrfCookieName);g&&s.set(t.xsrfHeaderName,g)}i===void 0&&s.setContentType(null),"setRequestHeader"in f&&Be.forEach(s.toJSON(),function(v,x){f.setRequestHeader(x,v)}),Be.isUndefined(t.withCredentials)||(f.withCredentials=!!t.withCredentials),a&&a!=="json"&&(f.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&f.addEventListener("progress",ZS(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",ZS(t.onUploadProgress)),(t.cancelToken||t.signal)&&(c=g=>{f&&(n(!g||g.type?new Vg(null,t,f):g),f.abort(),f=null)},t.cancelToken&&t.cancelToken.subscribe(c),t.signal&&(t.signal.aborted?c():t.signal.addEventListener("abort",c)));const h=TH(d);if(h&&Ca.protocols.indexOf(h)===-1){n(new Bt("Unsupported protocol "+h+":",Bt.ERR_BAD_REQUEST,t));return}f.send(i||null)})},k4={http:aH,xhr:DH};Be.forEach(k4,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const JS=t=>`- ${t}`,OH=t=>Be.isFunction(t)||t===null||t===!1,TI={getAdapter:t=>{t=Be.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${o} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=e?s.length>1?`since : +`+s.map(JS).join(` +`):" "+JS(s[0]):"as no adapter specified";throw new Bt("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return n},adapters:k4};function Ox(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Vg(null,t)}function XS(t){return Ox(t),t.headers=_o.from(t.headers),t.data=Dx.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),TI.getAdapter(t.adapter||h5.adapter)(t).then(function(n){return Ox(t),n.data=Dx.call(t,t.transformResponse,n),n.headers=_o.from(n.headers),n},function(n){return FI(n)||(Ox(t),n&&n.response&&(n.response.data=Dx.call(t,t.transformResponse,n.response),n.response.headers=_o.from(n.response.headers))),Promise.reject(n)})}const QS=t=>t instanceof _o?t.toJSON():t;function lh(t,e){e=e||{};const r={};function n(u,l,f){return Be.isPlainObject(u)&&Be.isPlainObject(l)?Be.merge.call({caseless:f},u,l):Be.isPlainObject(l)?Be.merge({},l):Be.isArray(l)?l.slice():l}function i(u,l,f){if(Be.isUndefined(l)){if(!Be.isUndefined(u))return n(void 0,u,f)}else return n(u,l,f)}function s(u,l){if(!Be.isUndefined(l))return n(void 0,l)}function a(u,l){if(Be.isUndefined(l)){if(!Be.isUndefined(u))return n(void 0,u)}else return n(void 0,l)}function o(u,l,f){if(f in e)return n(u,l);if(f in t)return n(void 0,u)}const c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(u,l)=>i(QS(u),QS(l),!0)};return Be.forEach(Object.keys(Object.assign({},t,e)),function(l){const f=c[l]||i,d=f(t[l],e[l],l);Be.isUndefined(d)&&f!==o||(r[l]=d)}),r}const NI="1.6.7",p5={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{p5[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const YS={};p5.transitional=function(e,r,n){function i(s,a){return"[Axios v"+NI+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return(s,a,o)=>{if(e===!1)throw new Bt(i(a," has been removed"+(r?" in "+r:"")),Bt.ERR_DEPRECATED);return r&&!YS[a]&&(YS[a]=!0,console.warn(i(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,a,o):!0}};function MH(t,e,r){if(typeof t!="object")throw new Bt("options must be an object",Bt.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],a=e[s];if(a){const o=t[s],c=o===void 0||a(o,s,t);if(c!==!0)throw new Bt("option "+s+" must be "+c,Bt.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Bt("Unknown option "+s,Bt.ERR_BAD_OPTION)}}const B4={assertOptions:MH,validators:p5},nc=B4.validators;class vv{constructor(e){this.defaults=e,this.interceptors={request:new WS,response:new WS}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` +`+s):n.stack=s}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=lh(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&B4.assertOptions(n,{silentJSONParsing:nc.transitional(nc.boolean),forcedJSONParsing:nc.transitional(nc.boolean),clarifyTimeoutError:nc.transitional(nc.boolean)},!1),i!=null&&(Be.isFunction(i)?r.paramsSerializer={serialize:i}:B4.assertOptions(i,{encode:nc.function,serialize:nc.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=s&&Be.merge(s.common,s[r.method]);s&&Be.forEach(["delete","get","head","post","put","patch","common"],h=>{delete s[h]}),r.headers=_o.concat(a,s);const o=[];let c=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(r)===!1||(c=c&&g.synchronous,o.unshift(g.fulfilled,g.rejected))});const u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let l,f=0,d;if(!c){const h=[XS.bind(this),void 0];for(h.unshift.apply(h,o),h.push.apply(h,u),d=h.length,l=Promise.resolve(r);f{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const a=new Promise(o=>{n.subscribe(o),s=o}).then(i);return a.cancel=function(){n.unsubscribe(s)},a},e(function(s,a,o){n.reason||(n.reason=new Vg(s,a,o),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}static source(){let e;return{token:new g5(function(i){e=i}),cancel:e}}}const LH=g5;function jH(t){return function(r){return t.apply(null,r)}}function UH(t){return Be.isObject(t)&&t.isAxiosError===!0}const I4={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(I4).forEach(([t,e])=>{I4[e]=t});const $H=I4;function RI(t){const e=new um(t),r=pI(um.prototype.request,e);return Be.extend(r,um.prototype,e,{allOwnKeys:!0}),Be.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return RI(lh(t,i))},r}const Lt=RI(h5);Lt.Axios=um;Lt.CanceledError=Vg;Lt.CancelToken=LH;Lt.isCancel=FI;Lt.VERSION=NI;Lt.toFormData=Vy;Lt.AxiosError=Bt;Lt.Cancel=Lt.CanceledError;Lt.all=function(e){return Promise.all(e)};Lt.spread=jH;Lt.isAxiosError=UH;Lt.mergeConfig=lh;Lt.AxiosHeaders=_o;Lt.formToJSON=t=>II(Be.isHTMLForm(t)?new FormData(t):t);Lt.getAdapter=TI.getAdapter;Lt.HttpStatusCode=$H;Lt.default=Lt;function xa(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(n=Object.getOwnPropertySymbols(t);i0&&h[h.length-1])||_[0]!==6&&_[0]!==2)){v=0;continue}if(_[0]===3&&(!h||_[1]>h[0]&&_[1]0?setTimeout(p,S):p(null)}}window.addEventListener("storage",x),l.addToWaiting(x);var b=setTimeout(x,Math.max(0,f-Date.now()))})];case 1:return d.sent(),[2]}})})},l.addToWaiting=function(f){this.removeFromWaiting(f),l.waiters!==void 0&&l.waiters.push(f)},l.removeFromWaiting=function(f){l.waiters!==void 0&&(l.waiters=l.waiters.filter(function(d){return d!==f}))},l.notifyWaiters=function(){l.waiters!==void 0&&l.waiters.slice().forEach(function(f){return f()})},l.prototype.releaseLock=function(f){return r(this,void 0,void 0,function(){return n(this,function(d){switch(d.label){case 0:return[4,this.releaseLock__private__(f)];case 1:return[2,d.sent()]}})})},l.prototype.releaseLock__private__=function(f){return r(this,void 0,void 0,function(){var d,p,h,g;return n(this,function(v){switch(v.label){case 0:return d=this.storageHandler===void 0?a:this.storageHandler,p=s+"-"+f,(h=d.getItemSync(p))===null?[2]:(g=JSON.parse(h)).id!==this.id?[3,2]:[4,Fu.default().lock(g.iat)];case 1:v.sent(),this.acquiredIatSet.delete(g.iat),d.removeItemSync(p),Fu.default().unlock(g.iat),l.notifyWaiters(),v.label=2;case 2:return[2]}})})},l.lockCorrector=function(f){for(var d=Date.now()-5e3,p=f,h=[],g=0;;){var v=p.keySync(g);if(v===null)break;h.push(v),g++}for(var x=!1,b=0;bDate.now();let wi=class F4 extends Error{constructor(e,r){super(r),this.error=e,this.error_description=r,Object.setPrototypeOf(this,F4.prototype)}static fromPayload({error:e,error_description:r}){return new F4(e,r)}},VH=class MI extends wi{constructor(e,r,n,i=null){super(e,r),this.state=n,this.appState=i,Object.setPrototypeOf(this,MI.prototype)}},P4=class LI extends wi{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,LI.prototype)}},qH=class jI extends P4{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,jI.prototype)}},KH=class UI extends wi{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,UI.prototype)}},WH=class $I extends wi{constructor(e,r,n){super(e,r),this.mfa_token=n,Object.setPrototypeOf(this,$I.prototype)}},zI=class HI extends wi{constructor(e,r){super("missing_refresh_token",`Missing Refresh Token (audience: '${eA(e,["default"])}', scope: '${eA(r)}')`),this.audience=e,this.scope=r,Object.setPrototypeOf(this,HI.prototype)}};function eA(t,e=[]){return t&&!e.includes(t)?t:""}const lm=()=>window.crypto,Mx=()=>{const t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let e="";return Array.from(lm().getRandomValues(new Uint8Array(43))).forEach(r=>e+=t[r%t.length]),e},tA=t=>btoa(t),T4=t=>{var{clientId:e}=t,r=xa(t,["clientId"]);return new URLSearchParams((n=>Object.keys(n).filter(i=>n[i]!==void 0).reduce((i,s)=>Object.assign(Object.assign({},i),{[s]:n[s]}),{}))(Object.assign({client_id:e},r))).toString()},rA=t=>(e=>decodeURIComponent(atob(e).split("").map(r=>"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)).join("")))(t.replace(/_/g,"/").replace(/-/g,"+")),GH=async(t,e)=>{const r=await fetch(t,e);return{ok:r.ok,json:await r.json()}},ZH=async(t,e,r)=>{const n=new AbortController;let i;return e.signal=n.signal,Promise.race([GH(t,e),new Promise((s,a)=>{i=setTimeout(()=>{n.abort(),a(new Error("Timeout when executing 'fetch'"))},r)})]).finally(()=>{clearTimeout(i)})},JH=async(t,e,r,n,i,s,a)=>{return o={auth:{audience:e,scope:r},timeout:i,fetchUrl:t,fetchOptions:n,useFormData:a},c=s,new Promise(function(u,l){const f=new MessageChannel;f.port1.onmessage=function(d){d.data.error?l(new Error(d.data.error)):u(d.data),f.port1.close()},c.postMessage(o,[f.port2])});var o,c},XH=async(t,e,r,n,i,s,a=1e4)=>i?JH(t,e,r,n,a,i,s):ZH(t,n,a);async function QH(t,e){var{baseUrl:r,timeout:n,audience:i,scope:s,auth0Client:a,useFormData:o}=t,c=xa(t,["baseUrl","timeout","audience","scope","auth0Client","useFormData"]);const u=o?T4(c):JSON.stringify(c);return await async function(l,f,d,p,h,g,v){let x,b=null;for(let N=0;N<3;N++)try{x=await XH(l,d,p,h,g,v,f),b=null;break}catch(T){b=T}if(b)throw b;const S=x.json,{error:_,error_description:P}=S,C=xa(S,["error","error_description"]),{ok:B}=x;if(!B){const N=P||`HTTP error. Unable to fetch ${l}`;throw _==="mfa_required"?new WH(_,N,C.mfa_token):_==="missing_refresh_token"?new zI(d,p):new wi(_||"request_error",N)}return C}(`${r}/oauth/token`,n,i||"default",s,{method:"POST",body:u,headers:{"Content-Type":o?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(a||DI))}},e,o)}const _1=(...t)=>{return(e=t.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(e))).join(" ");var e};class _a{constructor(e,r="@@auth0spajs@@",n){this.prefix=r,this.suffix=n,this.clientId=e.clientId,this.scope=e.scope,this.audience=e.audience}toKey(){return[this.prefix,this.clientId,this.audience,this.scope,this.suffix].filter(Boolean).join("::")}static fromKey(e){const[r,n,i,s]=e.split("::");return new _a({clientId:n,scope:s,audience:i},r)}static fromCacheEntry(e){const{scope:r,audience:n,client_id:i}=e;return new _a({scope:r,audience:n,clientId:i})}}let YH=class{set(e,r){localStorage.setItem(e,JSON.stringify(r))}get(e){const r=window.localStorage.getItem(e);if(r)try{return JSON.parse(r)}catch{return}}remove(e){localStorage.removeItem(e)}allKeys(){return Object.keys(window.localStorage).filter(e=>e.startsWith("@@auth0spajs@@"))}},VI=class{constructor(){this.enclosedCache=function(){let e={};return{set(r,n){e[r]=n},get(r){const n=e[r];if(n)return n},remove(r){delete e[r]},allKeys:()=>Object.keys(e)}}()}};class eV{constructor(e,r,n){this.cache=e,this.keyManifest=r,this.nowProvider=n||OI}async setIdToken(e,r,n){var i;const s=this.getIdTokenCacheKey(e);await this.cache.set(s,{id_token:r,decodedToken:n}),await((i=this.keyManifest)===null||i===void 0?void 0:i.add(s))}async getIdToken(e){const r=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!r&&e.scope&&e.audience){const n=await this.get(e);return!n||!n.id_token||!n.decodedToken?void 0:{id_token:n.id_token,decodedToken:n.decodedToken}}if(r)return{id_token:r.id_token,decodedToken:r.decodedToken}}async get(e,r=0){var n;let i=await this.cache.get(e.toKey());if(!i){const o=await this.getCacheKeys();if(!o)return;const c=this.matchExistingCacheKey(e,o);c&&(i=await this.cache.get(c))}if(!i)return;const s=await this.nowProvider(),a=Math.floor(s/1e3);return i.expiresAt-r!e||i.includes(e)).reduce(async(i,s)=>{await i,await this.cache.remove(s)},Promise.resolve()),await((r=this.keyManifest)===null||r===void 0?void 0:r.clear()))}async wrapCacheEntry(e){const r=await this.nowProvider();return{body:e,expiresAt:Math.floor(r/1e3)+e.expires_in}}async getCacheKeys(){var e;return this.keyManifest?(e=await this.keyManifest.get())===null||e===void 0?void 0:e.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new _a({clientId:e},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(e,r){return r.filter(n=>{var i;const s=_a.fromKey(n),a=new Set(s.scope&&s.scope.split(" ")),o=((i=e.scope)===null||i===void 0?void 0:i.split(" "))||[],c=s.scope&&o.reduce((u,l)=>u&&a.has(l),!0);return s.prefix==="@@auth0spajs@@"&&s.clientId===e.clientId&&s.audience===e.audience&&c})[0]}}let tV=class{constructor(e,r,n){this.storage=e,this.clientId=r,this.cookieDomain=n,this.storageKey=`a0.spajs.txs.${this.clientId}`}create(e){this.storage.save(this.storageKey,e,{daysUntilExpire:1,cookieDomain:this.cookieDomain})}get(){return this.storage.get(this.storageKey)}remove(){this.storage.remove(this.storageKey,{cookieDomain:this.cookieDomain})}};const w0=t=>typeof t=="number",rV=["iss","aud","exp","nbf","iat","jti","azp","nonce","auth_time","at_hash","c_hash","acr","amr","sub_jwk","cnf","sip_from_tag","sip_date","sip_callid","sip_cseq_num","sip_via_branch","orig","dest","mky","events","toe","txn","rph","sid","vot","vtm"],nV=t=>{if(!t.id_token)throw new Error("ID token is required but missing");const e=(s=>{const a=s.split("."),[o,c,u]=a;if(a.length!==3||!o||!c||!u)throw new Error("ID token could not be decoded");const l=JSON.parse(rA(c)),f={__raw:s},d={};return Object.keys(l).forEach(p=>{f[p]=l[p],rV.includes(p)||(d[p]=l[p])}),{encoded:{header:o,payload:c,signature:u},header:JSON.parse(rA(o)),claims:f,user:d}})(t.id_token);if(!e.claims.iss)throw new Error("Issuer (iss) claim must be a string present in the ID token");if(e.claims.iss!==t.iss)throw new Error(`Issuer (iss) claim mismatch in the ID token; expected "${t.iss}", found "${e.claims.iss}"`);if(!e.user.sub)throw new Error("Subject (sub) claim must be a string present in the ID token");if(e.header.alg!=="RS256")throw new Error(`Signature algorithm of "${e.header.alg}" is not supported. Expected the ID token to be signed with "RS256".`);if(!e.claims.aud||typeof e.claims.aud!="string"&&!Array.isArray(e.claims.aud))throw new Error("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(e.claims.aud)){if(!e.claims.aud.includes(t.aud))throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${t.aud}" but was not one of "${e.claims.aud.join(", ")}"`);if(e.claims.aud.length>1){if(!e.claims.azp)throw new Error("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");if(e.claims.azp!==t.aud)throw new Error(`Authorized Party (azp) claim mismatch in the ID token; expected "${t.aud}", found "${e.claims.azp}"`)}}else if(e.claims.aud!==t.aud)throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${t.aud}" but found "${e.claims.aud}"`);if(t.nonce){if(!e.claims.nonce)throw new Error("Nonce (nonce) claim must be a string present in the ID token");if(e.claims.nonce!==t.nonce)throw new Error(`Nonce (nonce) claim mismatch in the ID token; expected "${t.nonce}", found "${e.claims.nonce}"`)}if(t.max_age&&!w0(e.claims.auth_time))throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");if(e.claims.exp==null||!w0(e.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!w0(e.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const r=t.leeway||60,n=new Date(t.now||Date.now()),i=new Date(0);if(i.setUTCSeconds(e.claims.exp+r),n>i)throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${n}) is after expiration time (${i})`);if(e.claims.nbf!=null&&w0(e.claims.nbf)){const s=new Date(0);if(s.setUTCSeconds(e.claims.nbf-r),ns)throw new Error(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (${n}) is after last auth at ${s}`)}if(t.organization){const s=t.organization.trim();if(s.startsWith("org_")){const a=s;if(!e.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(a!==e.claims.org_id)throw new Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${a}", found "${e.claims.org_id}"`)}else{const a=s.toLowerCase();if(!e.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(a!==e.claims.org_name)throw new Error(`Organization Name (org_name) claim mismatch in the ID token; expected "${a}", found "${e.claims.org_name}"`)}}return e};var $u=v5(function(t,e){var r=Tu&&Tu.__assign||function(){return r=Object.assign||function(c){for(var u,l=1,f=arguments.length;l"u")return;const e=sessionStorage.getItem(t);return e!=null?JSON.parse(e):void 0},save(t,e){sessionStorage.setItem(t,JSON.stringify(e))},remove(t){sessionStorage.removeItem(t)}};function oV(t,e,r){var n=e===void 0?null:e,i=function(c,u){var l=atob(c);if(u){for(var f=new Uint8Array(l.length),d=0,p=l.length;d0?await this.cache.set(this.manifestKey,{keys:[...n]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(e){return`@@auth0spajs@@::${e}`}};const lV={memory:()=>new VI().enclosedCache,localstorage:()=>new YH},aA=t=>lV[t],oA=t=>{const{openUrl:e,onRedirect:r}=t,n=xa(t,["openUrl","onRedirect"]);return Object.assign(Object.assign({},n),{openUrl:e===!1||e?e:r})},Ux=new zH;let fV=class{constructor(e){let r,n;if(this.userCache=new VI().enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{await Ux.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),e),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),e.authorizationParams)}),typeof window<"u"&&(()=>{if(!lm())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(lm().subtle===void 0)throw new Error(` + auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/main/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information. + `)})(),e.cache&&e.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),e.cache)n=e.cache;else{if(r=e.cacheLocation||"memory",!aA(r))throw new Error(`Invalid cache location "${r}"`);n=aA(r)()}this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=e.legacySameSiteCookie===!1?xf:sV,this.orgHintCookieName=`auth0.${this.options.clientId}.organization_hint`,this.isAuthenticatedCookieName=(a=>`auth0.${a}.is.authenticated`)(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;const i=e.useCookiesForTransactions?this.cookieStorage:aV;var s;this.scope=_1("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new tV(i,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||OI,this.cacheManager=new eV(n,n.allKeys?void 0:new uV(n,this.options.clientId),this.nowProvider),this.domainUrl=(s=this.options.domain,/^https?:\/\//.test(s)?s:`https://${s}`),this.tokenIssuer=((a,o)=>a?a.startsWith("https://")?a:`https://${a}/`:`${o}/`)(this.options.issuer,this.domainUrl),typeof window<"u"&&window.Worker&&this.options.useRefreshTokens&&r==="memory"&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new cV)}_url(e){const r=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||DI)));return`${this.domainUrl}${e}&auth0Client=${r}`}_authorizeUrl(e){return this._url(`/authorize?${T4(e)}`)}async _verifyIdToken(e,r,n){const i=await this.nowProvider();return nV({iss:this.tokenIssuer,aud:this.options.clientId,id_token:e,nonce:r,organization:n,leeway:this.options.leeway,max_age:(s=this.options.authorizationParams.max_age,typeof s!="string"?s:parseInt(s,10)||void 0),now:i});var s}_processOrgHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}async _prepareAuthorizeUrl(e,r,n){const i=tA(Mx()),s=tA(Mx()),a=Mx(),o=(l=>{const f=new Uint8Array(l);return(d=>{const p={"+":"-","/":"_","=":""};return d.replace(/[+/=]/g,h=>p[h])})(window.btoa(String.fromCharCode(...Array.from(f))))})(await(async l=>await lm().subtle.digest({name:"SHA-256"},new TextEncoder().encode(l)))(a)),c=((l,f,d,p,h,g,v,x)=>Object.assign(Object.assign(Object.assign({client_id:l.clientId},l.authorizationParams),d),{scope:_1(f,d.scope),response_type:"code",response_mode:x||"query",state:p,nonce:h,redirect_uri:v||l.authorizationParams.redirect_uri,code_challenge:g,code_challenge_method:"S256"}))(this.options,this.scope,e,i,s,o,e.redirect_uri||this.options.authorizationParams.redirect_uri||n,r==null?void 0:r.response_mode),u=this._authorizeUrl(c);return{nonce:s,code_verifier:a,scope:c.scope,audience:c.audience||"default",redirect_uri:c.redirect_uri,state:i,url:u}}async loginWithPopup(e,r){var n;if(e=e||{},!(r=r||{}).popup&&(r.popup=(o=>{const c=window.screenX+(window.innerWidth-400)/2,u=window.screenY+(window.innerHeight-600)/2;return window.open(o,"auth0:authorize:popup",`left=${c},top=${u},width=400,height=600,resizable,scrollbars=yes,status=1`)})(""),!r.popup))throw new Error("Unable to open a popup for loginWithPopup - window.open returned `null`");const i=await this._prepareAuthorizeUrl(e.authorizationParams||{},{response_mode:"web_message"},window.location.origin);r.popup.location.href=i.url;const s=await(o=>new Promise((c,u)=>{let l;const f=setInterval(()=>{o.popup&&o.popup.closed&&(clearInterval(f),clearTimeout(d),window.removeEventListener("message",l,!1),u(new KH(o.popup)))},1e3),d=setTimeout(()=>{clearInterval(f),u(new qH(o.popup)),window.removeEventListener("message",l,!1)},1e3*(o.timeoutInSeconds||60));l=function(p){if(p.data&&p.data.type==="authorization_response"){if(clearTimeout(d),clearInterval(f),window.removeEventListener("message",l,!1),o.popup.close(),p.data.response.error)return u(wi.fromPayload(p.data.response));c(p.data.response)}},window.addEventListener("message",l)}))(Object.assign(Object.assign({},r),{timeoutInSeconds:r.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(i.state!==s.state)throw new wi("state_mismatch","Invalid state");const a=((n=e.authorizationParams)===null||n===void 0?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:i.audience,scope:i.scope,code_verifier:i.code_verifier,grant_type:"authorization_code",code:s.code,redirect_uri:i.redirect_uri},{nonceIn:i.nonce,organization:a})}async getUser(){var e;const r=await this._getIdTokenFromCache();return(e=r==null?void 0:r.decodedToken)===null||e===void 0?void 0:e.user}async getIdTokenClaims(){var e;const r=await this._getIdTokenFromCache();return(e=r==null?void 0:r.decodedToken)===null||e===void 0?void 0:e.claims}async loginWithRedirect(e={}){var r;const n=oA(e),{openUrl:i,fragment:s,appState:a}=n,o=xa(n,["openUrl","fragment","appState"]),c=((r=o.authorizationParams)===null||r===void 0?void 0:r.organization)||this.options.authorizationParams.organization,u=await this._prepareAuthorizeUrl(o.authorizationParams||{}),{url:l}=u,f=xa(u,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},f),{appState:a}),c&&{organization:c}));const d=s?`${l}#${s}`:l;i?await i(d):window.location.assign(d)}async handleRedirectCallback(e=window.location.href){const r=e.split("?").slice(1);if(r.length===0)throw new Error("There are no query params available for parsing.");const{state:n,code:i,error:s,error_description:a}=(f=>{f.indexOf("#")>-1&&(f=f.substring(0,f.indexOf("#")));const d=new URLSearchParams(f);return{state:d.get("state"),code:d.get("code")||void 0,error:d.get("error")||void 0,error_description:d.get("error_description")||void 0}})(r.join("")),o=this.transactionManager.get();if(!o)throw new wi("missing_transaction","Invalid state");if(this.transactionManager.remove(),s)throw new VH(s,a||s,n,o.appState);if(!o.code_verifier||o.state&&o.state!==n)throw new wi("state_mismatch","Invalid state");const c=o.organization,u=o.nonce,l=o.redirect_uri;return await this._requestToken(Object.assign({audience:o.audience,scope:o.scope,code_verifier:o.code_verifier,grant_type:"authorization_code",code:i},l?{redirect_uri:l}:{}),{nonceIn:u,organization:c}),{appState:o.appState}}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(e)}catch{}}async getTokenSilently(e={}){var r;const n=Object.assign(Object.assign({cacheMode:"on"},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:_1(this.scope,(r=e.authorizationParams)===null||r===void 0?void 0:r.scope)})}),i=await((s,a)=>{let o=jx[a];return o||(o=s().finally(()=>{delete jx[a],o=null}),jx[a]=o),o})(()=>this._getTokenSilently(n),`${this.options.clientId}::${n.authorizationParams.audience}::${n.authorizationParams.scope}`);return e.detailedResponse?i:i==null?void 0:i.access_token}async _getTokenSilently(e){const{cacheMode:r}=e,n=xa(e,["cacheMode"]);if(r!=="off"){const i=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(i)return i}if(r!=="cache-only"){if(!await(async(i,s=3)=>{for(let a=0;aUx.acquireLock("auth0.lock.getTokenSilently",5e3),10))throw new P4;try{if(window.addEventListener("pagehide",this._releaseLockOnPageHide),r!=="off"){const u=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(u)return u}const i=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),{id_token:s,access_token:a,oauthTokenScope:o,expires_in:c}=i;return Object.assign(Object.assign({id_token:s,access_token:a},o?{scope:o}:null),{expires_in:c})}finally{await Ux.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}}async getTokenWithPopup(e={},r={}){var n;const i=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:_1(this.scope,(n=e.authorizationParams)===null||n===void 0?void 0:n.scope)})});return r=Object.assign(Object.assign({},HH),r),await this.loginWithPopup(i,r),(await this.cacheManager.get(new _a({scope:i.authorizationParams.scope,audience:i.authorizationParams.audience||"default",clientId:this.options.clientId}))).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(e){e.clientId!==null?e.clientId=e.clientId||this.options.clientId:delete e.clientId;const r=e.logoutParams||{},{federated:n}=r,i=xa(r,["federated"]),s=n?"&federated":"";return this._url(`/v2/logout?${T4(Object.assign({clientId:e.clientId},i))}`)+s}async logout(e={}){const r=oA(e),{openUrl:n}=r,i=xa(r,["openUrl"]);e.clientId===null?await this.cacheManager.clear():await this.cacheManager.clear(e.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove("@@user@@");const s=this._buildLogoutUrl(i);n?await n(s):n!==!1&&window.location.assign(s)}async _getTokenFromIFrame(e){const r=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!r.organization&&(r.organization=n);const{url:i,state:s,nonce:a,code_verifier:o,redirect_uri:c,scope:u,audience:l}=await this._prepareAuthorizeUrl(r,{response_mode:"web_message"},window.location.origin);try{if(window.crossOriginIsolated)throw new wi("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const f=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds,d=await((h,g,v=60)=>new Promise((x,b)=>{const S=window.document.createElement("iframe");S.setAttribute("width","0"),S.setAttribute("height","0"),S.style.display="none";const _=()=>{window.document.body.contains(S)&&(window.document.body.removeChild(S),window.removeEventListener("message",P,!1))};let P;const C=setTimeout(()=>{b(new P4),_()},1e3*v);P=function(B){if(B.origin!=g||!B.data||B.data.type!=="authorization_response")return;const N=B.source;N&&N.close(),B.data.response.error?b(wi.fromPayload(B.data.response)):x(B.data.response),clearTimeout(C),window.removeEventListener("message",P,!1),setTimeout(_,2e3)},window.addEventListener("message",P,!1),window.document.body.appendChild(S),S.setAttribute("src",h)}))(i,this.domainUrl,f);if(s!==d.state)throw new wi("state_mismatch","Invalid state");const p=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:o,code:d.code,grant_type:"authorization_code",redirect_uri:c,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:a,organization:r.organization});return Object.assign(Object.assign({},p),{scope:u,oauthTokenScope:p.scope,audience:l})}catch(f){throw f.error==="login_required"&&this.logout({openUrl:!1}),f}}async _getTokenUsingRefreshToken(e){const r=await this.cacheManager.get(new _a({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||"default",clientId:this.options.clientId}));if(!(r&&r.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new zI(e.authorizationParams.audience||"default",e.authorizationParams.scope)}const n=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,i=typeof e.timeoutInSeconds=="number"?1e3*e.timeoutInSeconds:null;try{const s=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:r&&r.refresh_token,redirect_uri:n}),i&&{timeout:i}));return Object.assign(Object.assign({},s),{scope:e.authorizationParams.scope,oauthTokenScope:s.scope,audience:e.authorizationParams.audience||"default"})}catch(s){if((s.message.indexOf("Missing Refresh Token")>-1||s.message&&s.message.indexOf("invalid refresh token")>-1)&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw s}}async _saveEntryInCache(e){const{id_token:r,decodedToken:n}=e,i=xa(e,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:r,decodedToken:n}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(i)}async _getIdTokenFromCache(){const e=this.options.authorizationParams.audience||"default",r=await this.cacheManager.getIdToken(new _a({clientId:this.options.clientId,audience:e,scope:this.scope})),n=this.userCache.get("@@user@@");return r&&r.id_token===(n==null?void 0:n.id_token)?n:(this.userCache.set("@@user@@",r),r)}async _getEntryFromCache({scope:e,audience:r,clientId:n}){const i=await this.cacheManager.get(new _a({scope:e,audience:r,clientId:n}),60);if(i&&i.access_token){const{access_token:s,oauthTokenScope:a,expires_in:o}=i,c=await this._getIdTokenFromCache();return c&&Object.assign(Object.assign({id_token:c.id_token,access_token:s},a?{scope:a}:null),{expires_in:o})}}async _requestToken(e,r){const{nonceIn:n,organization:i}=r||{},s=await QH(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs},e),this.worker),a=await this._verifyIdToken(s.id_token,n,i);return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},s),{decodedToken:a,scope:e.scope,audience:e.audience||"default"}),s.scope?{oauthTokenScope:s.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(i||a.claims.org_id),Object.assign(Object.assign({},s),{decodedToken:a})}};async function dV(t){const e=new fV(t);return await e.checkSession(),e}function N4(t){this.message=t}N4.prototype=new Error,N4.prototype.name="InvalidCharacterError";var cA=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new N4("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,s=0,a="";n=e.charAt(s++);~n&&(r=i%4?64*r+n:n,i++%4)?a+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return a};function hV(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(r){return decodeURIComponent(cA(r).replace(/(.)/g,function(n,i){var s=i.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}(e)}catch{return cA(e)}}function yv(t){this.message=t}function ic(t,e){if(typeof t!="string")throw new yv("Invalid token specified");var r=(e=e||{}).header===!0?0:1;try{return JSON.parse(hV(t.split(".")[r]))}catch(n){throw new yv("Invalid token specified: "+n.message)}}yv.prototype=new Error,yv.prototype.name="InvalidTokenError";var gu={},y5={exports:{}};const pV={},gV=Object.freeze(Object.defineProperty({__proto__:null,default:pV},Symbol.toStringTag,{value:"Module"})),x5=FD(gV);y5.exports;(function(t){(function(e,r){function n(R,E){if(!R)throw new Error(E||"Assertion failed")}function i(R,E){R.super_=E;var F=function(){};F.prototype=E.prototype,R.prototype=new F,R.prototype.constructor=R}function s(R,E,F){if(s.isBN(R))return R;this.negative=0,this.words=null,this.length=0,this.red=null,R!==null&&((E==="le"||E==="be")&&(F=E,E=10),this._init(R||0,E||10,F||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=x5.Buffer}catch{}s.isBN=function(E){return E instanceof s?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===s.wordSize&&Array.isArray(E.words)},s.max=function(E,F){return E.cmp(F)>0?E:F},s.min=function(E,F){return E.cmp(F)<0?E:F},s.prototype._init=function(E,F,A){if(typeof E=="number")return this._initNumber(E,F,A);if(typeof E=="object")return this._initArray(E,F,A);F==="hex"&&(F=16),n(F===(F|0)&&F>=2&&F<=36),E=E.toString().replace(/\s+/g,"");var I=0;E[0]==="-"&&(I++,this.negative=1),I=0;I-=3)$=E[I]|E[I-1]<<8|E[I-2]<<16,this.words[j]|=$<>>26-W&67108863,W+=24,W>=26&&(W-=26,j++);else if(A==="le")for(I=0,j=0;I>>26-W&67108863,W+=24,W>=26&&(W-=26,j++);return this.strip()};function o(R,E){var F=R.charCodeAt(E);return F>=65&&F<=70?F-55:F>=97&&F<=102?F-87:F-48&15}function c(R,E,F){var A=o(R,F);return F-1>=E&&(A|=o(R,F-1)<<4),A}s.prototype._parseHex=function(E,F,A){this.length=Math.ceil((E.length-F)/6),this.words=new Array(this.length);for(var I=0;I=F;I-=2)W=c(E,F,I)<=18?(j-=18,$+=1,this.words[$]|=W>>>26):j+=8;else{var H=E.length-F;for(I=H%2===0?F+1:F;I=18?(j-=18,$+=1,this.words[$]|=W>>>26):j+=8}this.strip()};function u(R,E,F,A){for(var I=0,j=Math.min(R.length,F),$=E;$=49?I+=W-49+10:W>=17?I+=W-17+10:I+=W}return I}s.prototype._parseBase=function(E,F,A){this.words=[0],this.length=1;for(var I=0,j=1;j<=67108863;j*=F)I++;I--,j=j/F|0;for(var $=E.length-A,W=$%I,H=Math.min($,$-W)+A,O=0,L=A;L1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var l=["","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"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(E,F){E=E||10,F=F|0||1;var A;if(E===16||E==="hex"){A="";for(var I=0,j=0,$=0;$>>24-I&16777215,j!==0||$!==this.length-1?A=l[6-H.length]+H+A:A=H+A,I+=2,I>=26&&(I-=26,$--)}for(j!==0&&(A=j.toString(16)+A);A.length%F!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}if(E===(E|0)&&E>=2&&E<=36){var O=f[E],L=d[E];A="";var q=this.clone();for(q.negative=0;!q.isZero();){var ee=q.modn(L).toString(E);q=q.idivn(L),q.isZero()?A=ee+A:A=l[O-ee.length]+ee+A}for(this.isZero()&&(A="0"+A);A.length%F!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(E,F){return n(typeof a<"u"),this.toArrayLike(a,E,F)},s.prototype.toArray=function(E,F){return this.toArrayLike(Array,E,F)},s.prototype.toArrayLike=function(E,F,A){var I=this.byteLength(),j=A||Math.max(1,I);n(I<=j,"byte array longer than desired length"),n(j>0,"Requested array length <= 0"),this.strip();var $=F==="le",W=new E(j),H,O,L=this.clone();if($){for(O=0;!L.isZero();O++)H=L.andln(255),L.iushrn(8),W[O]=H;for(;O=4096&&(A+=13,F>>>=13),F>=64&&(A+=7,F>>>=7),F>=8&&(A+=4,F>>>=4),F>=2&&(A+=2,F>>>=2),A+F},s.prototype._zeroBits=function(E){if(E===0)return 26;var F=E,A=0;return F&8191||(A+=13,F>>>=13),F&127||(A+=7,F>>>=7),F&15||(A+=4,F>>>=4),F&3||(A+=2,F>>>=2),F&1||A++,A},s.prototype.bitLength=function(){var E=this.words[this.length-1],F=this._countBits(E);return(this.length-1)*26+F};function p(R){for(var E=new Array(R.bitLength()),F=0;F>>I}return E}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,F=0;FE.length?this.clone().ior(E):E.clone().ior(this)},s.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},s.prototype.iuand=function(E){var F;this.length>E.length?F=E:F=this;for(var A=0;AE.length?this.clone().iand(E):E.clone().iand(this)},s.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},s.prototype.iuxor=function(E){var F,A;this.length>E.length?(F=this,A=E):(F=E,A=this);for(var I=0;IE.length?this.clone().ixor(E):E.clone().ixor(this)},s.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},s.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var F=Math.ceil(E/26)|0,A=E%26;this._expand(F),A>0&&F--;for(var I=0;I0&&(this.words[I]=~this.words[I]&67108863>>26-A),this.strip()},s.prototype.notn=function(E){return this.clone().inotn(E)},s.prototype.setn=function(E,F){n(typeof E=="number"&&E>=0);var A=E/26|0,I=E%26;return this._expand(A+1),F?this.words[A]=this.words[A]|1<E.length?(A=this,I=E):(A=E,I=this);for(var j=0,$=0;$>>26;for(;j!==0&&$>>26;if(this.length=A.length,j!==0)this.words[this.length]=j,this.length++;else if(A!==this)for(;$E.length?this.clone().iadd(E):E.clone().iadd(this)},s.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var F=this.iadd(E);return E.negative=1,F._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var A=this.cmp(E);if(A===0)return this.negative=0,this.length=1,this.words[0]=0,this;var I,j;A>0?(I=this,j=E):(I=E,j=this);for(var $=0,W=0;W>26,this.words[W]=F&67108863;for(;$!==0&&W>26,this.words[W]=F&67108863;if($===0&&W>>26,q=H&67108863,ee=Math.min(O,E.length-1),X=Math.max(0,O-R.length+1);X<=ee;X++){var ae=O-X|0;I=R.words[ae]|0,j=E.words[X]|0,$=I*j+q,L+=$/67108864|0,q=$&67108863}F.words[O]=q|0,H=L|0}return H!==0?F.words[O]=H|0:F.length--,F.strip()}var g=function(E,F,A){var I=E.words,j=F.words,$=A.words,W=0,H,O,L,q=I[0]|0,ee=q&8191,X=q>>>13,ae=I[1]|0,ve=ae&8191,de=ae>>>13,pe=I[2]|0,we=pe&8191,_e=pe>>>13,Me=I[3]|0,Fe=Me&8191,De=Me>>>13,V=I[4]|0,le=V&8191,ce=V>>>13,Y=I[5]|0,J=Y&8191,ne=Y>>>13,xe=I[6]|0,he=xe&8191,re=xe>>>13,ke=I[7]|0,be=ke&8191,ge=ke>>>13,Re=I[8]|0,m=Re&8191,y=Re>>>13,w=I[9]|0,M=w&8191,z=w>>>13,G=j[0]|0,Z=G&8191,Se=G>>>13,Ve=j[1]|0,Pe=Ve&8191,Te=Ve>>>13,ze=j[2]|0,Wt=ze&8191,Gt=ze>>>13,ra=j[3]|0,Mt=ra&8191,ie=ra>>>13,me=j[4]|0,ye=me&8191,Ne=me>>>13,Ze=j[5]|0,et=Ze&8191,qe=Ze>>>13,nt=j[6]|0,He=nt&8191,Ke=nt>>>13,$t=j[7]|0,Qe=$t&8191,ct=$t>>>13,Br=j[8]|0,kt=Br&8191,vt=Br>>>13,Ha=j[9]|0,lr=Ha&8191,Zt=Ha>>>13;A.negative=E.negative^F.negative,A.length=19,H=Math.imul(ee,Z),O=Math.imul(ee,Se),O=O+Math.imul(X,Z)|0,L=Math.imul(X,Se);var Mi=(W+H|0)+((O&8191)<<13)|0;W=(L+(O>>>13)|0)+(Mi>>>26)|0,Mi&=67108863,H=Math.imul(ve,Z),O=Math.imul(ve,Se),O=O+Math.imul(de,Z)|0,L=Math.imul(de,Se),H=H+Math.imul(ee,Pe)|0,O=O+Math.imul(ee,Te)|0,O=O+Math.imul(X,Pe)|0,L=L+Math.imul(X,Te)|0;var ms=(W+H|0)+((O&8191)<<13)|0;W=(L+(O>>>13)|0)+(ms>>>26)|0,ms&=67108863,H=Math.imul(we,Z),O=Math.imul(we,Se),O=O+Math.imul(_e,Z)|0,L=Math.imul(_e,Se),H=H+Math.imul(ve,Pe)|0,O=O+Math.imul(ve,Te)|0,O=O+Math.imul(de,Pe)|0,L=L+Math.imul(de,Te)|0,H=H+Math.imul(ee,Wt)|0,O=O+Math.imul(ee,Gt)|0,O=O+Math.imul(X,Wt)|0,L=L+Math.imul(X,Gt)|0;var Au=(W+H|0)+((O&8191)<<13)|0;W=(L+(O>>>13)|0)+(Au>>>26)|0,Au&=67108863,H=Math.imul(Fe,Z),O=Math.imul(Fe,Se),O=O+Math.imul(De,Z)|0,L=Math.imul(De,Se),H=H+Math.imul(we,Pe)|0,O=O+Math.imul(we,Te)|0,O=O+Math.imul(_e,Pe)|0,L=L+Math.imul(_e,Te)|0,H=H+Math.imul(ve,Wt)|0,O=O+Math.imul(ve,Gt)|0,O=O+Math.imul(de,Wt)|0,L=L+Math.imul(de,Gt)|0,H=H+Math.imul(ee,Mt)|0,O=O+Math.imul(ee,ie)|0,O=O+Math.imul(X,Mt)|0,L=L+Math.imul(X,ie)|0;var Va=(W+H|0)+((O&8191)<<13)|0;W=(L+(O>>>13)|0)+(Va>>>26)|0,Va&=67108863,H=Math.imul(le,Z),O=Math.imul(le,Se),O=O+Math.imul(ce,Z)|0,L=Math.imul(ce,Se),H=H+Math.imul(Fe,Pe)|0,O=O+Math.imul(Fe,Te)|0,O=O+Math.imul(De,Pe)|0,L=L+Math.imul(De,Te)|0,H=H+Math.imul(we,Wt)|0,O=O+Math.imul(we,Gt)|0,O=O+Math.imul(_e,Wt)|0,L=L+Math.imul(_e,Gt)|0,H=H+Math.imul(ve,Mt)|0,O=O+Math.imul(ve,ie)|0,O=O+Math.imul(de,Mt)|0,L=L+Math.imul(de,ie)|0,H=H+Math.imul(ee,ye)|0,O=O+Math.imul(ee,Ne)|0,O=O+Math.imul(X,ye)|0,L=L+Math.imul(X,Ne)|0;var Cu=(W+H|0)+((O&8191)<<13)|0;W=(L+(O>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,H=Math.imul(J,Z),O=Math.imul(J,Se),O=O+Math.imul(ne,Z)|0,L=Math.imul(ne,Se),H=H+Math.imul(le,Pe)|0,O=O+Math.imul(le,Te)|0,O=O+Math.imul(ce,Pe)|0,L=L+Math.imul(ce,Te)|0,H=H+Math.imul(Fe,Wt)|0,O=O+Math.imul(Fe,Gt)|0,O=O+Math.imul(De,Wt)|0,L=L+Math.imul(De,Gt)|0,H=H+Math.imul(we,Mt)|0,O=O+Math.imul(we,ie)|0,O=O+Math.imul(_e,Mt)|0,L=L+Math.imul(_e,ie)|0,H=H+Math.imul(ve,ye)|0,O=O+Math.imul(ve,Ne)|0,O=O+Math.imul(de,ye)|0,L=L+Math.imul(de,Ne)|0,H=H+Math.imul(ee,et)|0,O=O+Math.imul(ee,qe)|0,O=O+Math.imul(X,et)|0,L=L+Math.imul(X,qe)|0;var na=(W+H|0)+((O&8191)<<13)|0;W=(L+(O>>>13)|0)+(na>>>26)|0,na&=67108863,H=Math.imul(he,Z),O=Math.imul(he,Se),O=O+Math.imul(re,Z)|0,L=Math.imul(re,Se),H=H+Math.imul(J,Pe)|0,O=O+Math.imul(J,Te)|0,O=O+Math.imul(ne,Pe)|0,L=L+Math.imul(ne,Te)|0,H=H+Math.imul(le,Wt)|0,O=O+Math.imul(le,Gt)|0,O=O+Math.imul(ce,Wt)|0,L=L+Math.imul(ce,Gt)|0,H=H+Math.imul(Fe,Mt)|0,O=O+Math.imul(Fe,ie)|0,O=O+Math.imul(De,Mt)|0,L=L+Math.imul(De,ie)|0,H=H+Math.imul(we,ye)|0,O=O+Math.imul(we,Ne)|0,O=O+Math.imul(_e,ye)|0,L=L+Math.imul(_e,Ne)|0,H=H+Math.imul(ve,et)|0,O=O+Math.imul(ve,qe)|0,O=O+Math.imul(de,et)|0,L=L+Math.imul(de,qe)|0,H=H+Math.imul(ee,He)|0,O=O+Math.imul(ee,Ke)|0,O=O+Math.imul(X,He)|0,L=L+Math.imul(X,Ke)|0;var Xo=(W+H|0)+((O&8191)<<13)|0;W=(L+(O>>>13)|0)+(Xo>>>26)|0,Xo&=67108863,H=Math.imul(be,Z),O=Math.imul(be,Se),O=O+Math.imul(ge,Z)|0,L=Math.imul(ge,Se),H=H+Math.imul(he,Pe)|0,O=O+Math.imul(he,Te)|0,O=O+Math.imul(re,Pe)|0,L=L+Math.imul(re,Te)|0,H=H+Math.imul(J,Wt)|0,O=O+Math.imul(J,Gt)|0,O=O+Math.imul(ne,Wt)|0,L=L+Math.imul(ne,Gt)|0,H=H+Math.imul(le,Mt)|0,O=O+Math.imul(le,ie)|0,O=O+Math.imul(ce,Mt)|0,L=L+Math.imul(ce,ie)|0,H=H+Math.imul(Fe,ye)|0,O=O+Math.imul(Fe,Ne)|0,O=O+Math.imul(De,ye)|0,L=L+Math.imul(De,Ne)|0,H=H+Math.imul(we,et)|0,O=O+Math.imul(we,qe)|0,O=O+Math.imul(_e,et)|0,L=L+Math.imul(_e,qe)|0,H=H+Math.imul(ve,He)|0,O=O+Math.imul(ve,Ke)|0,O=O+Math.imul(de,He)|0,L=L+Math.imul(de,Ke)|0,H=H+Math.imul(ee,Qe)|0,O=O+Math.imul(ee,ct)|0,O=O+Math.imul(X,Qe)|0,L=L+Math.imul(X,ct)|0;var At=(W+H|0)+((O&8191)<<13)|0;W=(L+(O>>>13)|0)+(At>>>26)|0,At&=67108863,H=Math.imul(m,Z),O=Math.imul(m,Se),O=O+Math.imul(y,Z)|0,L=Math.imul(y,Se),H=H+Math.imul(be,Pe)|0,O=O+Math.imul(be,Te)|0,O=O+Math.imul(ge,Pe)|0,L=L+Math.imul(ge,Te)|0,H=H+Math.imul(he,Wt)|0,O=O+Math.imul(he,Gt)|0,O=O+Math.imul(re,Wt)|0,L=L+Math.imul(re,Gt)|0,H=H+Math.imul(J,Mt)|0,O=O+Math.imul(J,ie)|0,O=O+Math.imul(ne,Mt)|0,L=L+Math.imul(ne,ie)|0,H=H+Math.imul(le,ye)|0,O=O+Math.imul(le,Ne)|0,O=O+Math.imul(ce,ye)|0,L=L+Math.imul(ce,Ne)|0,H=H+Math.imul(Fe,et)|0,O=O+Math.imul(Fe,qe)|0,O=O+Math.imul(De,et)|0,L=L+Math.imul(De,qe)|0,H=H+Math.imul(we,He)|0,O=O+Math.imul(we,Ke)|0,O=O+Math.imul(_e,He)|0,L=L+Math.imul(_e,Ke)|0,H=H+Math.imul(ve,Qe)|0,O=O+Math.imul(ve,ct)|0,O=O+Math.imul(de,Qe)|0,L=L+Math.imul(de,ct)|0,H=H+Math.imul(ee,kt)|0,O=O+Math.imul(ee,vt)|0,O=O+Math.imul(X,kt)|0,L=L+Math.imul(X,vt)|0;var Tt=(W+H|0)+((O&8191)<<13)|0;W=(L+(O>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,H=Math.imul(M,Z),O=Math.imul(M,Se),O=O+Math.imul(z,Z)|0,L=Math.imul(z,Se),H=H+Math.imul(m,Pe)|0,O=O+Math.imul(m,Te)|0,O=O+Math.imul(y,Pe)|0,L=L+Math.imul(y,Te)|0,H=H+Math.imul(be,Wt)|0,O=O+Math.imul(be,Gt)|0,O=O+Math.imul(ge,Wt)|0,L=L+Math.imul(ge,Gt)|0,H=H+Math.imul(he,Mt)|0,O=O+Math.imul(he,ie)|0,O=O+Math.imul(re,Mt)|0,L=L+Math.imul(re,ie)|0,H=H+Math.imul(J,ye)|0,O=O+Math.imul(J,Ne)|0,O=O+Math.imul(ne,ye)|0,L=L+Math.imul(ne,Ne)|0,H=H+Math.imul(le,et)|0,O=O+Math.imul(le,qe)|0,O=O+Math.imul(ce,et)|0,L=L+Math.imul(ce,qe)|0,H=H+Math.imul(Fe,He)|0,O=O+Math.imul(Fe,Ke)|0,O=O+Math.imul(De,He)|0,L=L+Math.imul(De,Ke)|0,H=H+Math.imul(we,Qe)|0,O=O+Math.imul(we,ct)|0,O=O+Math.imul(_e,Qe)|0,L=L+Math.imul(_e,ct)|0,H=H+Math.imul(ve,kt)|0,O=O+Math.imul(ve,vt)|0,O=O+Math.imul(de,kt)|0,L=L+Math.imul(de,vt)|0,H=H+Math.imul(ee,lr)|0,O=O+Math.imul(ee,Zt)|0,O=O+Math.imul(X,lr)|0,L=L+Math.imul(X,Zt)|0;var Vr=(W+H|0)+((O&8191)<<13)|0;W=(L+(O>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,H=Math.imul(M,Pe),O=Math.imul(M,Te),O=O+Math.imul(z,Pe)|0,L=Math.imul(z,Te),H=H+Math.imul(m,Wt)|0,O=O+Math.imul(m,Gt)|0,O=O+Math.imul(y,Wt)|0,L=L+Math.imul(y,Gt)|0,H=H+Math.imul(be,Mt)|0,O=O+Math.imul(be,ie)|0,O=O+Math.imul(ge,Mt)|0,L=L+Math.imul(ge,ie)|0,H=H+Math.imul(he,ye)|0,O=O+Math.imul(he,Ne)|0,O=O+Math.imul(re,ye)|0,L=L+Math.imul(re,Ne)|0,H=H+Math.imul(J,et)|0,O=O+Math.imul(J,qe)|0,O=O+Math.imul(ne,et)|0,L=L+Math.imul(ne,qe)|0,H=H+Math.imul(le,He)|0,O=O+Math.imul(le,Ke)|0,O=O+Math.imul(ce,He)|0,L=L+Math.imul(ce,Ke)|0,H=H+Math.imul(Fe,Qe)|0,O=O+Math.imul(Fe,ct)|0,O=O+Math.imul(De,Qe)|0,L=L+Math.imul(De,ct)|0,H=H+Math.imul(we,kt)|0,O=O+Math.imul(we,vt)|0,O=O+Math.imul(_e,kt)|0,L=L+Math.imul(_e,vt)|0,H=H+Math.imul(ve,lr)|0,O=O+Math.imul(ve,Zt)|0,O=O+Math.imul(de,lr)|0,L=L+Math.imul(de,Zt)|0;var Qo=(W+H|0)+((O&8191)<<13)|0;W=(L+(O>>>13)|0)+(Qo>>>26)|0,Qo&=67108863,H=Math.imul(M,Wt),O=Math.imul(M,Gt),O=O+Math.imul(z,Wt)|0,L=Math.imul(z,Gt),H=H+Math.imul(m,Mt)|0,O=O+Math.imul(m,ie)|0,O=O+Math.imul(y,Mt)|0,L=L+Math.imul(y,ie)|0,H=H+Math.imul(be,ye)|0,O=O+Math.imul(be,Ne)|0,O=O+Math.imul(ge,ye)|0,L=L+Math.imul(ge,Ne)|0,H=H+Math.imul(he,et)|0,O=O+Math.imul(he,qe)|0,O=O+Math.imul(re,et)|0,L=L+Math.imul(re,qe)|0,H=H+Math.imul(J,He)|0,O=O+Math.imul(J,Ke)|0,O=O+Math.imul(ne,He)|0,L=L+Math.imul(ne,Ke)|0,H=H+Math.imul(le,Qe)|0,O=O+Math.imul(le,ct)|0,O=O+Math.imul(ce,Qe)|0,L=L+Math.imul(ce,ct)|0,H=H+Math.imul(Fe,kt)|0,O=O+Math.imul(Fe,vt)|0,O=O+Math.imul(De,kt)|0,L=L+Math.imul(De,vt)|0,H=H+Math.imul(we,lr)|0,O=O+Math.imul(we,Zt)|0,O=O+Math.imul(_e,lr)|0,L=L+Math.imul(_e,Zt)|0;var s0=(W+H|0)+((O&8191)<<13)|0;W=(L+(O>>>13)|0)+(s0>>>26)|0,s0&=67108863,H=Math.imul(M,Mt),O=Math.imul(M,ie),O=O+Math.imul(z,Mt)|0,L=Math.imul(z,ie),H=H+Math.imul(m,ye)|0,O=O+Math.imul(m,Ne)|0,O=O+Math.imul(y,ye)|0,L=L+Math.imul(y,Ne)|0,H=H+Math.imul(be,et)|0,O=O+Math.imul(be,qe)|0,O=O+Math.imul(ge,et)|0,L=L+Math.imul(ge,qe)|0,H=H+Math.imul(he,He)|0,O=O+Math.imul(he,Ke)|0,O=O+Math.imul(re,He)|0,L=L+Math.imul(re,Ke)|0,H=H+Math.imul(J,Qe)|0,O=O+Math.imul(J,ct)|0,O=O+Math.imul(ne,Qe)|0,L=L+Math.imul(ne,ct)|0,H=H+Math.imul(le,kt)|0,O=O+Math.imul(le,vt)|0,O=O+Math.imul(ce,kt)|0,L=L+Math.imul(ce,vt)|0,H=H+Math.imul(Fe,lr)|0,O=O+Math.imul(Fe,Zt)|0,O=O+Math.imul(De,lr)|0,L=L+Math.imul(De,Zt)|0;var K2=(W+H|0)+((O&8191)<<13)|0;W=(L+(O>>>13)|0)+(K2>>>26)|0,K2&=67108863,H=Math.imul(M,ye),O=Math.imul(M,Ne),O=O+Math.imul(z,ye)|0,L=Math.imul(z,Ne),H=H+Math.imul(m,et)|0,O=O+Math.imul(m,qe)|0,O=O+Math.imul(y,et)|0,L=L+Math.imul(y,qe)|0,H=H+Math.imul(be,He)|0,O=O+Math.imul(be,Ke)|0,O=O+Math.imul(ge,He)|0,L=L+Math.imul(ge,Ke)|0,H=H+Math.imul(he,Qe)|0,O=O+Math.imul(he,ct)|0,O=O+Math.imul(re,Qe)|0,L=L+Math.imul(re,ct)|0,H=H+Math.imul(J,kt)|0,O=O+Math.imul(J,vt)|0,O=O+Math.imul(ne,kt)|0,L=L+Math.imul(ne,vt)|0,H=H+Math.imul(le,lr)|0,O=O+Math.imul(le,Zt)|0,O=O+Math.imul(ce,lr)|0,L=L+Math.imul(ce,Zt)|0;var W2=(W+H|0)+((O&8191)<<13)|0;W=(L+(O>>>13)|0)+(W2>>>26)|0,W2&=67108863,H=Math.imul(M,et),O=Math.imul(M,qe),O=O+Math.imul(z,et)|0,L=Math.imul(z,qe),H=H+Math.imul(m,He)|0,O=O+Math.imul(m,Ke)|0,O=O+Math.imul(y,He)|0,L=L+Math.imul(y,Ke)|0,H=H+Math.imul(be,Qe)|0,O=O+Math.imul(be,ct)|0,O=O+Math.imul(ge,Qe)|0,L=L+Math.imul(ge,ct)|0,H=H+Math.imul(he,kt)|0,O=O+Math.imul(he,vt)|0,O=O+Math.imul(re,kt)|0,L=L+Math.imul(re,vt)|0,H=H+Math.imul(J,lr)|0,O=O+Math.imul(J,Zt)|0,O=O+Math.imul(ne,lr)|0,L=L+Math.imul(ne,Zt)|0;var G2=(W+H|0)+((O&8191)<<13)|0;W=(L+(O>>>13)|0)+(G2>>>26)|0,G2&=67108863,H=Math.imul(M,He),O=Math.imul(M,Ke),O=O+Math.imul(z,He)|0,L=Math.imul(z,Ke),H=H+Math.imul(m,Qe)|0,O=O+Math.imul(m,ct)|0,O=O+Math.imul(y,Qe)|0,L=L+Math.imul(y,ct)|0,H=H+Math.imul(be,kt)|0,O=O+Math.imul(be,vt)|0,O=O+Math.imul(ge,kt)|0,L=L+Math.imul(ge,vt)|0,H=H+Math.imul(he,lr)|0,O=O+Math.imul(he,Zt)|0,O=O+Math.imul(re,lr)|0,L=L+Math.imul(re,Zt)|0;var Z2=(W+H|0)+((O&8191)<<13)|0;W=(L+(O>>>13)|0)+(Z2>>>26)|0,Z2&=67108863,H=Math.imul(M,Qe),O=Math.imul(M,ct),O=O+Math.imul(z,Qe)|0,L=Math.imul(z,ct),H=H+Math.imul(m,kt)|0,O=O+Math.imul(m,vt)|0,O=O+Math.imul(y,kt)|0,L=L+Math.imul(y,vt)|0,H=H+Math.imul(be,lr)|0,O=O+Math.imul(be,Zt)|0,O=O+Math.imul(ge,lr)|0,L=L+Math.imul(ge,Zt)|0;var J2=(W+H|0)+((O&8191)<<13)|0;W=(L+(O>>>13)|0)+(J2>>>26)|0,J2&=67108863,H=Math.imul(M,kt),O=Math.imul(M,vt),O=O+Math.imul(z,kt)|0,L=Math.imul(z,vt),H=H+Math.imul(m,lr)|0,O=O+Math.imul(m,Zt)|0,O=O+Math.imul(y,lr)|0,L=L+Math.imul(y,Zt)|0;var X2=(W+H|0)+((O&8191)<<13)|0;W=(L+(O>>>13)|0)+(X2>>>26)|0,X2&=67108863,H=Math.imul(M,lr),O=Math.imul(M,Zt),O=O+Math.imul(z,lr)|0,L=Math.imul(z,Zt);var Q2=(W+H|0)+((O&8191)<<13)|0;return W=(L+(O>>>13)|0)+(Q2>>>26)|0,Q2&=67108863,$[0]=Mi,$[1]=ms,$[2]=Au,$[3]=Va,$[4]=Cu,$[5]=na,$[6]=Xo,$[7]=At,$[8]=Tt,$[9]=Vr,$[10]=Qo,$[11]=s0,$[12]=K2,$[13]=W2,$[14]=G2,$[15]=Z2,$[16]=J2,$[17]=X2,$[18]=Q2,W!==0&&($[19]=W,A.length++),A};Math.imul||(g=h);function v(R,E,F){F.negative=E.negative^R.negative,F.length=R.length+E.length;for(var A=0,I=0,j=0;j>>26)|0,I+=$>>>26,$&=67108863}F.words[j]=W,A=$,$=I}return A!==0?F.words[j]=A:F.length--,F.strip()}function x(R,E,F){var A=new b;return A.mulp(R,E,F)}s.prototype.mulTo=function(E,F){var A,I=this.length+E.length;return this.length===10&&E.length===10?A=g(this,E,F):I<63?A=h(this,E,F):I<1024?A=v(this,E,F):A=x(this,E,F),A};function b(R,E){this.x=R,this.y=E}b.prototype.makeRBT=function(E){for(var F=new Array(E),A=s.prototype._countBits(E)-1,I=0;I>=1;return I},b.prototype.permute=function(E,F,A,I,j,$){for(var W=0;W<$;W++)I[W]=F[E[W]],j[W]=A[E[W]]},b.prototype.transform=function(E,F,A,I,j,$){this.permute($,E,F,A,I,j);for(var W=1;W>>1)j++;return 1<>>13,A[2*$+1]=j&8191,j=j>>>13;for($=2*F;$>=26,F+=I/67108864|0,F+=j>>>26,this.words[A]=j&67108863}return F!==0&&(this.words[A]=F,this.length++),this},s.prototype.muln=function(E){return this.clone().imuln(E)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(E){var F=p(E);if(F.length===0)return new s(1);for(var A=this,I=0;I=0);var F=E%26,A=(E-F)/26,I=67108863>>>26-F<<26-F,j;if(F!==0){var $=0;for(j=0;j>>26-F}$&&(this.words[j]=$,this.length++)}if(A!==0){for(j=this.length-1;j>=0;j--)this.words[j+A]=this.words[j];for(j=0;j=0);var I;F?I=(F-F%26)/26:I=0;var j=E%26,$=Math.min((E-j)/26,this.length),W=67108863^67108863>>>j<$)for(this.length-=$,O=0;O=0&&(L!==0||O>=I);O--){var q=this.words[O]|0;this.words[O]=L<<26-j|q>>>j,L=q&W}return H&&L!==0&&(H.words[H.length++]=L),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(E,F,A){return n(this.negative===0),this.iushrn(E,F,A)},s.prototype.shln=function(E){return this.clone().ishln(E)},s.prototype.ushln=function(E){return this.clone().iushln(E)},s.prototype.shrn=function(E){return this.clone().ishrn(E)},s.prototype.ushrn=function(E){return this.clone().iushrn(E)},s.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var F=E%26,A=(E-F)/26,I=1<=0);var F=E%26,A=(E-F)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=A)return this;if(F!==0&&A++,this.length=Math.min(A,this.length),F!==0){var I=67108863^67108863>>>F<=67108864;F++)this.words[F]-=67108864,F===this.length-1?this.words[F+1]=1:this.words[F+1]++;return this.length=Math.max(this.length,F+1),this},s.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var F=0;F>26)-(H/67108864|0),this.words[j+A]=$&67108863}for(;j>26,this.words[j+A]=$&67108863;if(W===0)return this.strip();for(n(W===-1),W=0,j=0;j>26,this.words[j]=$&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(E,F){var A=this.length-E.length,I=this.clone(),j=E,$=j.words[j.length-1]|0,W=this._countBits($);A=26-W,A!==0&&(j=j.ushln(A),I.iushln(A),$=j.words[j.length-1]|0);var H=I.length-j.length,O;if(F!=="mod"){O=new s(null),O.length=H+1,O.words=new Array(O.length);for(var L=0;L=0;ee--){var X=(I.words[j.length+ee]|0)*67108864+(I.words[j.length+ee-1]|0);for(X=Math.min(X/$|0,67108863),I._ishlnsubmul(j,X,ee);I.negative!==0;)X--,I.negative=0,I._ishlnsubmul(j,1,ee),I.isZero()||(I.negative^=1);O&&(O.words[ee]=X)}return O&&O.strip(),I.strip(),F!=="div"&&A!==0&&I.iushrn(A),{div:O||null,mod:I}},s.prototype.divmod=function(E,F,A){if(n(!E.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var I,j,$;return this.negative!==0&&E.negative===0?($=this.neg().divmod(E,F),F!=="mod"&&(I=$.div.neg()),F!=="div"&&(j=$.mod.neg(),A&&j.negative!==0&&j.iadd(E)),{div:I,mod:j}):this.negative===0&&E.negative!==0?($=this.divmod(E.neg(),F),F!=="mod"&&(I=$.div.neg()),{div:I,mod:$.mod}):this.negative&E.negative?($=this.neg().divmod(E.neg(),F),F!=="div"&&(j=$.mod.neg(),A&&j.negative!==0&&j.isub(E)),{div:$.div,mod:j}):E.length>this.length||this.cmp(E)<0?{div:new s(0),mod:this}:E.length===1?F==="div"?{div:this.divn(E.words[0]),mod:null}:F==="mod"?{div:null,mod:new s(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new s(this.modn(E.words[0]))}:this._wordDiv(E,F)},s.prototype.div=function(E){return this.divmod(E,"div",!1).div},s.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},s.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},s.prototype.divRound=function(E){var F=this.divmod(E);if(F.mod.isZero())return F.div;var A=F.div.negative!==0?F.mod.isub(E):F.mod,I=E.ushrn(1),j=E.andln(1),$=A.cmp(I);return $<0||j===1&&$===0?F.div:F.div.negative!==0?F.div.isubn(1):F.div.iaddn(1)},s.prototype.modn=function(E){n(E<=67108863);for(var F=(1<<26)%E,A=0,I=this.length-1;I>=0;I--)A=(F*A+(this.words[I]|0))%E;return A},s.prototype.idivn=function(E){n(E<=67108863);for(var F=0,A=this.length-1;A>=0;A--){var I=(this.words[A]|0)+F*67108864;this.words[A]=I/E|0,F=I%E}return this.strip()},s.prototype.divn=function(E){return this.clone().idivn(E)},s.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var F=this,A=E.clone();F.negative!==0?F=F.umod(E):F=F.clone();for(var I=new s(1),j=new s(0),$=new s(0),W=new s(1),H=0;F.isEven()&&A.isEven();)F.iushrn(1),A.iushrn(1),++H;for(var O=A.clone(),L=F.clone();!F.isZero();){for(var q=0,ee=1;!(F.words[0]&ee)&&q<26;++q,ee<<=1);if(q>0)for(F.iushrn(q);q-- >0;)(I.isOdd()||j.isOdd())&&(I.iadd(O),j.isub(L)),I.iushrn(1),j.iushrn(1);for(var X=0,ae=1;!(A.words[0]&ae)&&X<26;++X,ae<<=1);if(X>0)for(A.iushrn(X);X-- >0;)($.isOdd()||W.isOdd())&&($.iadd(O),W.isub(L)),$.iushrn(1),W.iushrn(1);F.cmp(A)>=0?(F.isub(A),I.isub($),j.isub(W)):(A.isub(F),$.isub(I),W.isub(j))}return{a:$,b:W,gcd:A.iushln(H)}},s.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var F=this,A=E.clone();F.negative!==0?F=F.umod(E):F=F.clone();for(var I=new s(1),j=new s(0),$=A.clone();F.cmpn(1)>0&&A.cmpn(1)>0;){for(var W=0,H=1;!(F.words[0]&H)&&W<26;++W,H<<=1);if(W>0)for(F.iushrn(W);W-- >0;)I.isOdd()&&I.iadd($),I.iushrn(1);for(var O=0,L=1;!(A.words[0]&L)&&O<26;++O,L<<=1);if(O>0)for(A.iushrn(O);O-- >0;)j.isOdd()&&j.iadd($),j.iushrn(1);F.cmp(A)>=0?(F.isub(A),I.isub(j)):(A.isub(F),j.isub(I))}var q;return F.cmpn(1)===0?q=I:q=j,q.cmpn(0)<0&&q.iadd(E),q},s.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var F=this.clone(),A=E.clone();F.negative=0,A.negative=0;for(var I=0;F.isEven()&&A.isEven();I++)F.iushrn(1),A.iushrn(1);do{for(;F.isEven();)F.iushrn(1);for(;A.isEven();)A.iushrn(1);var j=F.cmp(A);if(j<0){var $=F;F=A,A=$}else if(j===0||A.cmpn(1)===0)break;F.isub(A)}while(!0);return A.iushln(I)},s.prototype.invm=function(E){return this.egcd(E).a.umod(E)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(E){return this.words[0]&E},s.prototype.bincn=function(E){n(typeof E=="number");var F=E%26,A=(E-F)/26,I=1<>>26,W&=67108863,this.words[$]=W}return j!==0&&(this.words[$]=j,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(E){var F=E<0;if(this.negative!==0&&!F)return-1;if(this.negative===0&&F)return 1;this.strip();var A;if(this.length>1)A=1;else{F&&(E=-E),n(E<=67108863,"Number is too big");var I=this.words[0]|0;A=I===E?0:IE.length)return 1;if(this.length=0;A--){var I=this.words[A]|0,j=E.words[A]|0;if(I!==j){Ij&&(F=1);break}}return F},s.prototype.gtn=function(E){return this.cmpn(E)===1},s.prototype.gt=function(E){return this.cmp(E)===1},s.prototype.gten=function(E){return this.cmpn(E)>=0},s.prototype.gte=function(E){return this.cmp(E)>=0},s.prototype.ltn=function(E){return this.cmpn(E)===-1},s.prototype.lt=function(E){return this.cmp(E)===-1},s.prototype.lten=function(E){return this.cmpn(E)<=0},s.prototype.lte=function(E){return this.cmp(E)<=0},s.prototype.eqn=function(E){return this.cmpn(E)===0},s.prototype.eq=function(E){return this.cmp(E)===0},s.red=function(E){return new T(E)},s.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(E){return this.red=E,this},s.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},s.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},s.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},s.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},s.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},s.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},s.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},s.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var S={k256:null,p224:null,p192:null,p25519:null};function _(R,E){this.name=R,this.p=new s(E,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}_.prototype._tmp=function(){var E=new s(null);return E.words=new Array(Math.ceil(this.n/13)),E},_.prototype.ireduce=function(E){var F=E,A;do this.split(F,this.tmp),F=this.imulK(F),F=F.iadd(this.tmp),A=F.bitLength();while(A>this.n);var I=A0?F.isub(this.p):F.strip!==void 0?F.strip():F._strip(),F},_.prototype.split=function(E,F){E.iushrn(this.n,0,F)},_.prototype.imulK=function(E){return E.imul(this.k)};function P(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(P,_),P.prototype.split=function(E,F){for(var A=4194303,I=Math.min(E.length,9),j=0;j>>22,$=W}$>>>=22,E.words[j-10]=$,$===0&&E.length>10?E.length-=10:E.length-=9},P.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var F=0,A=0;A>>=26,E.words[A]=j,F=I}return F!==0&&(E.words[E.length++]=F),E},s._prime=function(E){if(S[E])return S[E];var F;if(E==="k256")F=new P;else if(E==="p224")F=new C;else if(E==="p192")F=new B;else if(E==="p25519")F=new N;else throw new Error("Unknown prime "+E);return S[E]=F,F};function T(R){if(typeof R=="string"){var E=s._prime(R);this.m=E.p,this.prime=E}else n(R.gtn(1),"modulus must be greater than 1"),this.m=R,this.prime=null}T.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},T.prototype._verify2=function(E,F){n((E.negative|F.negative)===0,"red works only with positives"),n(E.red&&E.red===F.red,"red works only with red numbers")},T.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},T.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},T.prototype.add=function(E,F){this._verify2(E,F);var A=E.add(F);return A.cmp(this.m)>=0&&A.isub(this.m),A._forceRed(this)},T.prototype.iadd=function(E,F){this._verify2(E,F);var A=E.iadd(F);return A.cmp(this.m)>=0&&A.isub(this.m),A},T.prototype.sub=function(E,F){this._verify2(E,F);var A=E.sub(F);return A.cmpn(0)<0&&A.iadd(this.m),A._forceRed(this)},T.prototype.isub=function(E,F){this._verify2(E,F);var A=E.isub(F);return A.cmpn(0)<0&&A.iadd(this.m),A},T.prototype.shl=function(E,F){return this._verify1(E),this.imod(E.ushln(F))},T.prototype.imul=function(E,F){return this._verify2(E,F),this.imod(E.imul(F))},T.prototype.mul=function(E,F){return this._verify2(E,F),this.imod(E.mul(F))},T.prototype.isqr=function(E){return this.imul(E,E.clone())},T.prototype.sqr=function(E){return this.mul(E,E)},T.prototype.sqrt=function(E){if(E.isZero())return E.clone();var F=this.m.andln(3);if(n(F%2===1),F===3){var A=this.m.add(new s(1)).iushrn(2);return this.pow(E,A)}for(var I=this.m.subn(1),j=0;!I.isZero()&&I.andln(1)===0;)j++,I.iushrn(1);n(!I.isZero());var $=new s(1).toRed(this),W=$.redNeg(),H=this.m.subn(1).iushrn(1),O=this.m.bitLength();for(O=new s(2*O*O).toRed(this);this.pow(O,H).cmp(W)!==0;)O.redIAdd(W);for(var L=this.pow(O,I),q=this.pow(E,I.addn(1).iushrn(1)),ee=this.pow(E,I),X=j;ee.cmp($)!==0;){for(var ae=ee,ve=0;ae.cmp($)!==0;ve++)ae=ae.redSqr();n(ve=0;j--){for(var L=F.words[j],q=O-1;q>=0;q--){var ee=L>>q&1;if($!==I[0]&&($=this.sqr($)),ee===0&&W===0){H=0;continue}W<<=1,W|=ee,H++,!(H!==A&&(j!==0||q!==0))&&($=this.mul($,I[W]),H=0,W=0)}O=26}return $},T.prototype.convertTo=function(E){var F=E.umod(this.m);return F===E?F.clone():F},T.prototype.convertFrom=function(E){var F=E.clone();return F.red=null,F},s.mont=function(E){return new D(E)};function D(R){T.call(this,R),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(D,T),D.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},D.prototype.convertFrom=function(E){var F=this.imod(E.mul(this.rinv));return F.red=null,F},D.prototype.imul=function(E,F){if(E.isZero()||F.isZero())return E.words[0]=0,E.length=1,E;var A=E.imul(F),I=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),j=A.isub(I).iushrn(this.shift),$=j;return j.cmp(this.m)>=0?$=j.isub(this.m):j.cmpn(0)<0&&($=j.iadd(this.m)),$._forceRed(this)},D.prototype.mul=function(E,F){if(E.isZero()||F.isZero())return new s(0)._forceRed(this);var A=E.mul(F),I=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),j=A.isub(I).iushrn(this.shift),$=j;return j.cmp(this.m)>=0?$=j.isub(this.m):j.cmpn(0)<0&&($=j.iadd(this.m)),$._forceRed(this)},D.prototype.invm=function(E){var F=this.imod(E._invmp(this.m).mul(this.r2));return F._forceRed(this)}})(t,it)})(y5);var Qs=y5.exports,WI={},b5={},R4={exports:{}};typeof Object.create=="function"?R4.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:R4.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var Ys=R4.exports,w5={},Ky={};Ky.byteLength=yV;Ky.toByteArray=bV;Ky.fromByteArray=SV;var wa=[],zi=[],mV=typeof Uint8Array<"u"?Uint8Array:Array,$x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var of=0,vV=$x.length;of0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function yV(t){var e=GI(t),r=e[0],n=e[1];return(r+n)*3/4-n}function xV(t,e,r){return(e+r)*3/4-r}function bV(t){var e,r=GI(t),n=r[0],i=r[1],s=new mV(xV(t,n,i)),a=0,o=i>0?n-4:n,c;for(c=0;c>16&255,s[a++]=e>>8&255,s[a++]=e&255;return i===2&&(e=zi[t.charCodeAt(c)]<<2|zi[t.charCodeAt(c+1)]>>4,s[a++]=e&255),i===1&&(e=zi[t.charCodeAt(c)]<<10|zi[t.charCodeAt(c+1)]<<4|zi[t.charCodeAt(c+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}function wV(t){return wa[t>>18&63]+wa[t>>12&63]+wa[t>>6&63]+wa[t&63]}function EV(t,e,r){for(var n,i=[],s=e;so?o:a+s));return n===1?(e=t[r-1],i.push(wa[e>>2]+wa[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(wa[e>>10]+wa[e>>4&63]+wa[e<<2&63]+"=")),i.join("")}var E5={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */E5.read=function(t,e,r,n,i){var s,a,o=i*8-n-1,c=(1<>1,l=-7,f=r?i-1:0,d=r?-1:1,p=t[e+f];for(f+=d,s=p&(1<<-l)-1,p>>=-l,l+=o;l>0;s=s*256+t[e+f],f+=d,l-=8);for(a=s&(1<<-l)-1,s>>=-l,l+=n;l>0;a=a*256+t[e+f],f+=d,l-=8);if(s===0)s=1-u;else{if(s===c)return a?NaN:(p?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-u}return(p?-1:1)*a*Math.pow(2,s-n)};E5.write=function(t,e,r,n,i,s){var a,o,c,u=s*8-i-1,l=(1<>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:s-1,h=n?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+f>=1?e+=d/c:e+=d*Math.pow(2,1-f),e*c>=2&&(a++,c/=2),a+f>=l?(o=0,a=l):a+f>=1?(o=(e*c-1)*Math.pow(2,i),a=a+f):(o=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;t[r+p]=o&255,p+=h,o/=256,i-=8);for(a=a<0;t[r+p]=a&255,p+=h,a/=256,u-=8);t[r+p-h]|=g*128};/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */(function(t){const e=Ky,r=E5,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=o,t.SlowBuffer=b,t.INSPECT_MAX_BYTES=50;const i=2147483647;t.kMaxLength=i,o.TYPED_ARRAY_SUPPORT=s(),!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 s(){try{const m=new Uint8Array(1),y={foo:function(){return 42}};return Object.setPrototypeOf(y,Uint8Array.prototype),Object.setPrototypeOf(m,y),m.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 a(m){if(m>i)throw new RangeError('The value "'+m+'" is invalid for option "size"');const y=new Uint8Array(m);return Object.setPrototypeOf(y,o.prototype),y}function o(m,y,w){if(typeof m=="number"){if(typeof y=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f(m)}return c(m,y,w)}o.poolSize=8192;function c(m,y,w){if(typeof m=="string")return d(m,y);if(ArrayBuffer.isView(m))return h(m);if(m==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m);if(re(m,ArrayBuffer)||m&&re(m.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(re(m,SharedArrayBuffer)||m&&re(m.buffer,SharedArrayBuffer)))return g(m,y,w);if(typeof m=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const M=m.valueOf&&m.valueOf();if(M!=null&&M!==m)return o.from(M,y,w);const z=v(m);if(z)return z;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof m[Symbol.toPrimitive]=="function")return o.from(m[Symbol.toPrimitive]("string"),y,w);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m)}o.from=function(m,y,w){return c(m,y,w)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function u(m){if(typeof m!="number")throw new TypeError('"size" argument must be of type number');if(m<0)throw new RangeError('The value "'+m+'" is invalid for option "size"')}function l(m,y,w){return u(m),m<=0?a(m):y!==void 0?typeof w=="string"?a(m).fill(y,w):a(m).fill(y):a(m)}o.alloc=function(m,y,w){return l(m,y,w)};function f(m){return u(m),a(m<0?0:x(m)|0)}o.allocUnsafe=function(m){return f(m)},o.allocUnsafeSlow=function(m){return f(m)};function d(m,y){if((typeof y!="string"||y==="")&&(y="utf8"),!o.isEncoding(y))throw new TypeError("Unknown encoding: "+y);const w=S(m,y)|0;let M=a(w);const z=M.write(m,y);return z!==w&&(M=M.slice(0,z)),M}function p(m){const y=m.length<0?0:x(m.length)|0,w=a(y);for(let M=0;M=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return m|0}function b(m){return+m!=m&&(m=0),o.alloc(+m)}o.isBuffer=function(y){return y!=null&&y._isBuffer===!0&&y!==o.prototype},o.compare=function(y,w){if(re(y,Uint8Array)&&(y=o.from(y,y.offset,y.byteLength)),re(w,Uint8Array)&&(w=o.from(w,w.offset,w.byteLength)),!o.isBuffer(y)||!o.isBuffer(w))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(y===w)return 0;let M=y.length,z=w.length;for(let G=0,Z=Math.min(M,z);Gz.length?(o.isBuffer(Z)||(Z=o.from(Z)),Z.copy(z,G)):Uint8Array.prototype.set.call(z,Z,G);else if(o.isBuffer(Z))Z.copy(z,G);else throw new TypeError('"list" argument must be an Array of Buffers');G+=Z.length}return z};function S(m,y){if(o.isBuffer(m))return m.length;if(ArrayBuffer.isView(m)||re(m,ArrayBuffer))return m.byteLength;if(typeof m!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof m);const w=m.length,M=arguments.length>2&&arguments[2]===!0;if(!M&&w===0)return 0;let z=!1;for(;;)switch(y){case"ascii":case"latin1":case"binary":return w;case"utf8":case"utf-8":return Y(m).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w*2;case"hex":return w>>>1;case"base64":return xe(m).length;default:if(z)return M?-1:Y(m).length;y=(""+y).toLowerCase(),z=!0}}o.byteLength=S;function _(m,y,w){let M=!1;if((y===void 0||y<0)&&(y=0),y>this.length||((w===void 0||w>this.length)&&(w=this.length),w<=0)||(w>>>=0,y>>>=0,w<=y))return"";for(m||(m="utf8");;)switch(m){case"hex":return H(this,y,w);case"utf8":case"utf-8":return A(this,y,w);case"ascii":return $(this,y,w);case"latin1":case"binary":return W(this,y,w);case"base64":return F(this,y,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,y,w);default:if(M)throw new TypeError("Unknown encoding: "+m);m=(m+"").toLowerCase(),M=!0}}o.prototype._isBuffer=!0;function P(m,y,w){const M=m[y];m[y]=m[w],m[w]=M}o.prototype.swap16=function(){const y=this.length;if(y%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let w=0;ww&&(y+=" ... "),""},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(y,w,M,z,G){if(re(y,Uint8Array)&&(y=o.from(y,y.offset,y.byteLength)),!o.isBuffer(y))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof y);if(w===void 0&&(w=0),M===void 0&&(M=y?y.length:0),z===void 0&&(z=0),G===void 0&&(G=this.length),w<0||M>y.length||z<0||G>this.length)throw new RangeError("out of range index");if(z>=G&&w>=M)return 0;if(z>=G)return-1;if(w>=M)return 1;if(w>>>=0,M>>>=0,z>>>=0,G>>>=0,this===y)return 0;let Z=G-z,Se=M-w;const Ve=Math.min(Z,Se),Pe=this.slice(z,G),Te=y.slice(w,M);for(let ze=0;ze2147483647?w=2147483647:w<-2147483648&&(w=-2147483648),w=+w,ke(w)&&(w=z?0:m.length-1),w<0&&(w=m.length+w),w>=m.length){if(z)return-1;w=m.length-1}else if(w<0)if(z)w=0;else return-1;if(typeof y=="string"&&(y=o.from(y,M)),o.isBuffer(y))return y.length===0?-1:B(m,y,w,M,z);if(typeof y=="number")return y=y&255,typeof Uint8Array.prototype.indexOf=="function"?z?Uint8Array.prototype.indexOf.call(m,y,w):Uint8Array.prototype.lastIndexOf.call(m,y,w):B(m,[y],w,M,z);throw new TypeError("val must be string, number or Buffer")}function B(m,y,w,M,z){let G=1,Z=m.length,Se=y.length;if(M!==void 0&&(M=String(M).toLowerCase(),M==="ucs2"||M==="ucs-2"||M==="utf16le"||M==="utf-16le")){if(m.length<2||y.length<2)return-1;G=2,Z/=2,Se/=2,w/=2}function Ve(Te,ze){return G===1?Te[ze]:Te.readUInt16BE(ze*G)}let Pe;if(z){let Te=-1;for(Pe=w;PeZ&&(w=Z-Se),Pe=w;Pe>=0;Pe--){let Te=!0;for(let ze=0;zez&&(M=z)):M=z;const G=y.length;M>G/2&&(M=G/2);let Z;for(Z=0;Z>>0,isFinite(M)?(M=M>>>0,z===void 0&&(z="utf8")):(z=M,M=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const G=this.length-w;if((M===void 0||M>G)&&(M=G),y.length>0&&(M<0||w<0)||w>this.length)throw new RangeError("Attempt to write outside buffer bounds");z||(z="utf8");let Z=!1;for(;;)switch(z){case"hex":return N(this,y,w,M);case"utf8":case"utf-8":return T(this,y,w,M);case"ascii":case"latin1":case"binary":return D(this,y,w,M);case"base64":return R(this,y,w,M);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,y,w,M);default:if(Z)throw new TypeError("Unknown encoding: "+z);z=(""+z).toLowerCase(),Z=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function F(m,y,w){return y===0&&w===m.length?e.fromByteArray(m):e.fromByteArray(m.slice(y,w))}function A(m,y,w){w=Math.min(m.length,w);const M=[];let z=y;for(;z239?4:G>223?3:G>191?2:1;if(z+Se<=w){let Ve,Pe,Te,ze;switch(Se){case 1:G<128&&(Z=G);break;case 2:Ve=m[z+1],(Ve&192)===128&&(ze=(G&31)<<6|Ve&63,ze>127&&(Z=ze));break;case 3:Ve=m[z+1],Pe=m[z+2],(Ve&192)===128&&(Pe&192)===128&&(ze=(G&15)<<12|(Ve&63)<<6|Pe&63,ze>2047&&(ze<55296||ze>57343)&&(Z=ze));break;case 4:Ve=m[z+1],Pe=m[z+2],Te=m[z+3],(Ve&192)===128&&(Pe&192)===128&&(Te&192)===128&&(ze=(G&15)<<18|(Ve&63)<<12|(Pe&63)<<6|Te&63,ze>65535&&ze<1114112&&(Z=ze))}}Z===null?(Z=65533,Se=1):Z>65535&&(Z-=65536,M.push(Z>>>10&1023|55296),Z=56320|Z&1023),M.push(Z),z+=Se}return j(M)}const I=4096;function j(m){const y=m.length;if(y<=I)return String.fromCharCode.apply(String,m);let w="",M=0;for(;MM)&&(w=M);let z="";for(let G=y;GM&&(y=M),w<0?(w+=M,w<0&&(w=0)):w>M&&(w=M),ww)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(y,w,M){y=y>>>0,w=w>>>0,M||L(y,w,this.length);let z=this[y],G=1,Z=0;for(;++Z>>0,w=w>>>0,M||L(y,w,this.length);let z=this[y+--w],G=1;for(;w>0&&(G*=256);)z+=this[y+--w]*G;return z},o.prototype.readUint8=o.prototype.readUInt8=function(y,w){return y=y>>>0,w||L(y,1,this.length),this[y]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(y,w){return y=y>>>0,w||L(y,2,this.length),this[y]|this[y+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(y,w){return y=y>>>0,w||L(y,2,this.length),this[y]<<8|this[y+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(y,w){return y=y>>>0,w||L(y,4,this.length),(this[y]|this[y+1]<<8|this[y+2]<<16)+this[y+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(y,w){return y=y>>>0,w||L(y,4,this.length),this[y]*16777216+(this[y+1]<<16|this[y+2]<<8|this[y+3])},o.prototype.readBigUInt64LE=ge(function(y){y=y>>>0,De(y,"offset");const w=this[y],M=this[y+7];(w===void 0||M===void 0)&&V(y,this.length-8);const z=w+this[++y]*2**8+this[++y]*2**16+this[++y]*2**24,G=this[++y]+this[++y]*2**8+this[++y]*2**16+M*2**24;return BigInt(z)+(BigInt(G)<>>0,De(y,"offset");const w=this[y],M=this[y+7];(w===void 0||M===void 0)&&V(y,this.length-8);const z=w*2**24+this[++y]*2**16+this[++y]*2**8+this[++y],G=this[++y]*2**24+this[++y]*2**16+this[++y]*2**8+M;return(BigInt(z)<>>0,w=w>>>0,M||L(y,w,this.length);let z=this[y],G=1,Z=0;for(;++Z=G&&(z-=Math.pow(2,8*w)),z},o.prototype.readIntBE=function(y,w,M){y=y>>>0,w=w>>>0,M||L(y,w,this.length);let z=w,G=1,Z=this[y+--z];for(;z>0&&(G*=256);)Z+=this[y+--z]*G;return G*=128,Z>=G&&(Z-=Math.pow(2,8*w)),Z},o.prototype.readInt8=function(y,w){return y=y>>>0,w||L(y,1,this.length),this[y]&128?(255-this[y]+1)*-1:this[y]},o.prototype.readInt16LE=function(y,w){y=y>>>0,w||L(y,2,this.length);const M=this[y]|this[y+1]<<8;return M&32768?M|4294901760:M},o.prototype.readInt16BE=function(y,w){y=y>>>0,w||L(y,2,this.length);const M=this[y+1]|this[y]<<8;return M&32768?M|4294901760:M},o.prototype.readInt32LE=function(y,w){return y=y>>>0,w||L(y,4,this.length),this[y]|this[y+1]<<8|this[y+2]<<16|this[y+3]<<24},o.prototype.readInt32BE=function(y,w){return y=y>>>0,w||L(y,4,this.length),this[y]<<24|this[y+1]<<16|this[y+2]<<8|this[y+3]},o.prototype.readBigInt64LE=ge(function(y){y=y>>>0,De(y,"offset");const w=this[y],M=this[y+7];(w===void 0||M===void 0)&&V(y,this.length-8);const z=this[y+4]+this[y+5]*2**8+this[y+6]*2**16+(M<<24);return(BigInt(z)<>>0,De(y,"offset");const w=this[y],M=this[y+7];(w===void 0||M===void 0)&&V(y,this.length-8);const z=(w<<24)+this[++y]*2**16+this[++y]*2**8+this[++y];return(BigInt(z)<>>0,w||L(y,4,this.length),r.read(this,y,!0,23,4)},o.prototype.readFloatBE=function(y,w){return y=y>>>0,w||L(y,4,this.length),r.read(this,y,!1,23,4)},o.prototype.readDoubleLE=function(y,w){return y=y>>>0,w||L(y,8,this.length),r.read(this,y,!0,52,8)},o.prototype.readDoubleBE=function(y,w){return y=y>>>0,w||L(y,8,this.length),r.read(this,y,!1,52,8)};function q(m,y,w,M,z,G){if(!o.isBuffer(m))throw new TypeError('"buffer" argument must be a Buffer instance');if(y>z||ym.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(y,w,M,z){if(y=+y,w=w>>>0,M=M>>>0,!z){const Se=Math.pow(2,8*M)-1;q(this,y,w,M,Se,0)}let G=1,Z=0;for(this[w]=y&255;++Z>>0,M=M>>>0,!z){const Se=Math.pow(2,8*M)-1;q(this,y,w,M,Se,0)}let G=M-1,Z=1;for(this[w+G]=y&255;--G>=0&&(Z*=256);)this[w+G]=y/Z&255;return w+M},o.prototype.writeUint8=o.prototype.writeUInt8=function(y,w,M){return y=+y,w=w>>>0,M||q(this,y,w,1,255,0),this[w]=y&255,w+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(y,w,M){return y=+y,w=w>>>0,M||q(this,y,w,2,65535,0),this[w]=y&255,this[w+1]=y>>>8,w+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(y,w,M){return y=+y,w=w>>>0,M||q(this,y,w,2,65535,0),this[w]=y>>>8,this[w+1]=y&255,w+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(y,w,M){return y=+y,w=w>>>0,M||q(this,y,w,4,4294967295,0),this[w+3]=y>>>24,this[w+2]=y>>>16,this[w+1]=y>>>8,this[w]=y&255,w+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(y,w,M){return y=+y,w=w>>>0,M||q(this,y,w,4,4294967295,0),this[w]=y>>>24,this[w+1]=y>>>16,this[w+2]=y>>>8,this[w+3]=y&255,w+4};function ee(m,y,w,M,z){Fe(y,M,z,m,w,7);let G=Number(y&BigInt(4294967295));m[w++]=G,G=G>>8,m[w++]=G,G=G>>8,m[w++]=G,G=G>>8,m[w++]=G;let Z=Number(y>>BigInt(32)&BigInt(4294967295));return m[w++]=Z,Z=Z>>8,m[w++]=Z,Z=Z>>8,m[w++]=Z,Z=Z>>8,m[w++]=Z,w}function X(m,y,w,M,z){Fe(y,M,z,m,w,7);let G=Number(y&BigInt(4294967295));m[w+7]=G,G=G>>8,m[w+6]=G,G=G>>8,m[w+5]=G,G=G>>8,m[w+4]=G;let Z=Number(y>>BigInt(32)&BigInt(4294967295));return m[w+3]=Z,Z=Z>>8,m[w+2]=Z,Z=Z>>8,m[w+1]=Z,Z=Z>>8,m[w]=Z,w+8}o.prototype.writeBigUInt64LE=ge(function(y,w=0){return ee(this,y,w,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=ge(function(y,w=0){return X(this,y,w,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(y,w,M,z){if(y=+y,w=w>>>0,!z){const Ve=Math.pow(2,8*M-1);q(this,y,w,M,Ve-1,-Ve)}let G=0,Z=1,Se=0;for(this[w]=y&255;++G>0)-Se&255;return w+M},o.prototype.writeIntBE=function(y,w,M,z){if(y=+y,w=w>>>0,!z){const Ve=Math.pow(2,8*M-1);q(this,y,w,M,Ve-1,-Ve)}let G=M-1,Z=1,Se=0;for(this[w+G]=y&255;--G>=0&&(Z*=256);)y<0&&Se===0&&this[w+G+1]!==0&&(Se=1),this[w+G]=(y/Z>>0)-Se&255;return w+M},o.prototype.writeInt8=function(y,w,M){return y=+y,w=w>>>0,M||q(this,y,w,1,127,-128),y<0&&(y=255+y+1),this[w]=y&255,w+1},o.prototype.writeInt16LE=function(y,w,M){return y=+y,w=w>>>0,M||q(this,y,w,2,32767,-32768),this[w]=y&255,this[w+1]=y>>>8,w+2},o.prototype.writeInt16BE=function(y,w,M){return y=+y,w=w>>>0,M||q(this,y,w,2,32767,-32768),this[w]=y>>>8,this[w+1]=y&255,w+2},o.prototype.writeInt32LE=function(y,w,M){return y=+y,w=w>>>0,M||q(this,y,w,4,2147483647,-2147483648),this[w]=y&255,this[w+1]=y>>>8,this[w+2]=y>>>16,this[w+3]=y>>>24,w+4},o.prototype.writeInt32BE=function(y,w,M){return y=+y,w=w>>>0,M||q(this,y,w,4,2147483647,-2147483648),y<0&&(y=4294967295+y+1),this[w]=y>>>24,this[w+1]=y>>>16,this[w+2]=y>>>8,this[w+3]=y&255,w+4},o.prototype.writeBigInt64LE=ge(function(y,w=0){return ee(this,y,w,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=ge(function(y,w=0){return X(this,y,w,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ae(m,y,w,M,z,G){if(w+M>m.length)throw new RangeError("Index out of range");if(w<0)throw new RangeError("Index out of range")}function ve(m,y,w,M,z){return y=+y,w=w>>>0,z||ae(m,y,w,4),r.write(m,y,w,M,23,4),w+4}o.prototype.writeFloatLE=function(y,w,M){return ve(this,y,w,!0,M)},o.prototype.writeFloatBE=function(y,w,M){return ve(this,y,w,!1,M)};function de(m,y,w,M,z){return y=+y,w=w>>>0,z||ae(m,y,w,8),r.write(m,y,w,M,52,8),w+8}o.prototype.writeDoubleLE=function(y,w,M){return de(this,y,w,!0,M)},o.prototype.writeDoubleBE=function(y,w,M){return de(this,y,w,!1,M)},o.prototype.copy=function(y,w,M,z){if(!o.isBuffer(y))throw new TypeError("argument should be a Buffer");if(M||(M=0),!z&&z!==0&&(z=this.length),w>=y.length&&(w=y.length),w||(w=0),z>0&&z=this.length)throw new RangeError("Index out of range");if(z<0)throw new RangeError("sourceEnd out of bounds");z>this.length&&(z=this.length),y.length-w>>0,M=M===void 0?this.length:M>>>0,y||(y=0);let G;if(typeof y=="number")for(G=w;G2**32?z=_e(String(w)):typeof w=="bigint"&&(z=String(w),(w>BigInt(2)**BigInt(32)||w<-(BigInt(2)**BigInt(32)))&&(z=_e(z)),z+="n"),M+=` It must be ${y}. Received ${z}`,M},RangeError);function _e(m){let y="",w=m.length;const M=m[0]==="-"?1:0;for(;w>=M+4;w-=3)y=`_${m.slice(w-3,w)}${y}`;return`${m.slice(0,w)}${y}`}function Me(m,y,w){De(y,"offset"),(m[y]===void 0||m[y+w]===void 0)&&V(y,m.length-(w+1))}function Fe(m,y,w,M,z,G){if(m>w||m3?y===0||y===BigInt(0)?Se=`>= 0${Z} and < 2${Z} ** ${(G+1)*8}${Z}`:Se=`>= -(2${Z} ** ${(G+1)*8-1}${Z}) and < 2 ** ${(G+1)*8-1}${Z}`:Se=`>= ${y}${Z} and <= ${w}${Z}`,new pe.ERR_OUT_OF_RANGE("value",Se,m)}Me(M,z,G)}function De(m,y){if(typeof m!="number")throw new pe.ERR_INVALID_ARG_TYPE(y,"number",m)}function V(m,y,w){throw Math.floor(m)!==m?(De(m,w),new pe.ERR_OUT_OF_RANGE(w||"offset","an integer",m)):y<0?new pe.ERR_BUFFER_OUT_OF_BOUNDS:new pe.ERR_OUT_OF_RANGE(w||"offset",`>= ${w?1:0} and <= ${y}`,m)}const le=/[^+/0-9A-Za-z-_]/g;function ce(m){if(m=m.split("=")[0],m=m.trim().replace(le,""),m.length<2)return"";for(;m.length%4!==0;)m=m+"=";return m}function Y(m,y){y=y||1/0;let w;const M=m.length;let z=null;const G=[];for(let Z=0;Z55295&&w<57344){if(!z){if(w>56319){(y-=3)>-1&&G.push(239,191,189);continue}else if(Z+1===M){(y-=3)>-1&&G.push(239,191,189);continue}z=w;continue}if(w<56320){(y-=3)>-1&&G.push(239,191,189),z=w;continue}w=(z-55296<<10|w-56320)+65536}else z&&(y-=3)>-1&&G.push(239,191,189);if(z=null,w<128){if((y-=1)<0)break;G.push(w)}else if(w<2048){if((y-=2)<0)break;G.push(w>>6|192,w&63|128)}else if(w<65536){if((y-=3)<0)break;G.push(w>>12|224,w>>6&63|128,w&63|128)}else if(w<1114112){if((y-=4)<0)break;G.push(w>>18|240,w>>12&63|128,w>>6&63|128,w&63|128)}else throw new Error("Invalid code point")}return G}function J(m){const y=[];for(let w=0;w>8,z=w%256,G.push(z),G.push(M);return G}function xe(m){return e.toByteArray(ce(m))}function he(m,y,w,M){let z;for(z=0;z=y.length||z>=m.length);++z)y[z+w]=m[z];return z}function re(m,y){return m instanceof y||m!=null&&m.constructor!=null&&m.constructor.name!=null&&m.constructor.name===y.name}function ke(m){return m!==m}const be=function(){const m="0123456789abcdef",y=new Array(256);for(let w=0;w<16;++w){const M=w*16;for(let z=0;z<16;++z)y[M+z]=m[w]+m[z]}return y}();function ge(m){return typeof BigInt>"u"?Re:m}function Re(){throw new Error("BigInt not supported")}})(w5);var fm=w5,ed=fm.Buffer,Xi={},Qi;for(Qi in fm)fm.hasOwnProperty(Qi)&&(Qi==="SlowBuffer"||Qi==="Buffer"||(Xi[Qi]=fm[Qi]));var td=Xi.Buffer={};for(Qi in ed)ed.hasOwnProperty(Qi)&&(Qi==="allocUnsafe"||Qi==="allocUnsafeSlow"||(td[Qi]=ed[Qi]));Xi.Buffer.prototype=ed.prototype;(!td.from||td.from===Uint8Array.from)&&(td.from=function(t,e,r){if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type '+typeof t);if(t&&typeof t.length>"u")throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);return ed(t,e,r)});td.alloc||(td.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError('The "size" argument must be of type number. Received type '+typeof t);if(t<0||t>=2*(1<<30))throw new RangeError('The value "'+t+'" is invalid for option "size"');var n=ed(t);return!e||e.length===0?n.fill(0):typeof r=="string"?n.fill(e,r):n.fill(e),n});if(!Xi.kStringMaxLength)try{Xi.kStringMaxLength=process.binding("buffer").kStringMaxLength}catch{}Xi.constants||(Xi.constants={MAX_LENGTH:Xi.kMaxLength},Xi.kStringMaxLength&&(Xi.constants.MAX_STRING_LENGTH=Xi.kStringMaxLength));var S5=Xi,Wy={};const AV=Ys;function hs(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}Wy.Reporter=hs;hs.prototype.isError=function(e){return e instanceof fh};hs.prototype.save=function(){const e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}};hs.prototype.restore=function(e){const r=this._reporterState;r.obj=e.obj,r.path=r.path.slice(0,e.pathLen)};hs.prototype.enterKey=function(e){return this._reporterState.path.push(e)};hs.prototype.exitKey=function(e){const r=this._reporterState;r.path=r.path.slice(0,e-1)};hs.prototype.leaveKey=function(e,r,n){const i=this._reporterState;this.exitKey(e),i.obj!==null&&(i.obj[r]=n)};hs.prototype.path=function(){return this._reporterState.path.join("/")};hs.prototype.enterObject=function(){const e=this._reporterState,r=e.obj;return e.obj={},r};hs.prototype.leaveObject=function(e){const r=this._reporterState,n=r.obj;return r.obj=e,n};hs.prototype.error=function(e){let r;const n=this._reporterState,i=e instanceof fh;if(i?r=e:r=new fh(n.path.map(function(s){return"["+JSON.stringify(s)+"]"}).join(""),e.message||e,e.stack),!n.options.partial)throw r;return i||n.errors.push(r),r};hs.prototype.wrapResult=function(e){const r=this._reporterState;return r.options.partial?{result:this.isError(e)?null:e,errors:r.errors}:e};function fh(t,e){this.path=t,this.rethrow(e)}AV(fh,Error);fh.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,fh),!this.stack)try{throw new Error(this.message)}catch(r){this.stack=r.stack}return this};var Pl={};const CV=Ys,Gy=Wy.Reporter,dh=S5.Buffer;function us(t,e){if(Gy.call(this,e),!dh.isBuffer(t)){this.error("Input not Buffer");return}this.base=t,this.offset=0,this.length=t.length}CV(us,Gy);Pl.DecoderBuffer=us;us.isDecoderBuffer=function(e){return e instanceof us?!0:typeof e=="object"&&dh.isBuffer(e.base)&&e.constructor.name==="DecoderBuffer"&&typeof e.offset=="number"&&typeof e.length=="number"&&typeof e.save=="function"&&typeof e.restore=="function"&&typeof e.isEmpty=="function"&&typeof e.readUInt8=="function"&&typeof e.skip=="function"&&typeof e.raw=="function"};us.prototype.save=function(){return{offset:this.offset,reporter:Gy.prototype.save.call(this)}};us.prototype.restore=function(e){const r=new us(this.base);return r.offset=e.offset,r.length=this.offset,this.offset=e.offset,Gy.prototype.restore.call(this,e.reporter),r};us.prototype.isEmpty=function(){return this.offset===this.length};us.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")};us.prototype.skip=function(e,r){if(!(this.offset+e<=this.length))return this.error(r||"DecoderBuffer overrun");const n=new us(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+e,this.offset+=e,n};us.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)};function hh(t,e){if(Array.isArray(t))this.length=0,this.value=t.map(function(r){return hh.isEncoderBuffer(r)||(r=new hh(r,e)),this.length+=r.length,r},this);else if(typeof t=="number"){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if(typeof t=="string")this.value=t,this.length=dh.byteLength(t);else if(dh.isBuffer(t))this.value=t,this.length=t.length;else return e.error("Unsupported type: "+typeof t)}Pl.EncoderBuffer=hh;hh.isEncoderBuffer=function(e){return e instanceof hh?!0:typeof e=="object"&&e.constructor.name==="EncoderBuffer"&&typeof e.length=="number"&&typeof e.join=="function"};hh.prototype.join=function(e,r){return e||(e=dh.alloc(this.length)),r||(r=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(n){n.join(e,r),r+=n.length}):(typeof this.value=="number"?e[r]=this.value:typeof this.value=="string"?e.write(this.value,r):dh.isBuffer(this.value)&&this.value.copy(e,r),r+=this.length)),e};var mu=ZI;function ZI(t,e){if(!t)throw new Error(e||"Assertion failed")}ZI.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};const _V=Wy.Reporter,kV=Pl.EncoderBuffer,BV=Pl.DecoderBuffer,Hn=mu,JI=["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"],IV=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(JI),FV=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function Kt(t,e,r){const n={};this._baseState=n,n.name=r,n.enc=t,n.parent=e||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}var A5=Kt;const PV=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];Kt.prototype.clone=function(){const e=this._baseState,r={};PV.forEach(function(i){r[i]=e[i]});const n=new this.constructor(r.parent);return n._baseState=r,n};Kt.prototype._wrap=function(){const e=this._baseState;IV.forEach(function(r){this[r]=function(){const i=new this.constructor(this);return e.children.push(i),i[r].apply(i,arguments)}},this)};Kt.prototype._init=function(e){const r=this._baseState;Hn(r.parent===null),e.call(this),r.children=r.children.filter(function(n){return n._baseState.parent===this},this),Hn.equal(r.children.length,1,"Root node can have only one child")};Kt.prototype._useArgs=function(e){const r=this._baseState,n=e.filter(function(i){return i instanceof this.constructor},this);e=e.filter(function(i){return!(i instanceof this.constructor)},this),n.length!==0&&(Hn(r.children===null),r.children=n,n.forEach(function(i){i._baseState.parent=this},this)),e.length!==0&&(Hn(r.args===null),r.args=e,r.reverseArgs=e.map(function(i){if(typeof i!="object"||i.constructor!==Object)return i;const s={};return Object.keys(i).forEach(function(a){a==(a|0)&&(a|=0);const o=i[a];s[o]=a}),s}))};FV.forEach(function(t){Kt.prototype[t]=function(){const r=this._baseState;throw new Error(t+" not implemented for encoding: "+r.enc)}});JI.forEach(function(t){Kt.prototype[t]=function(){const r=this._baseState,n=Array.prototype.slice.call(arguments);return Hn(r.tag===null),r.tag=t,this._useArgs(n),this}});Kt.prototype.use=function(e){Hn(e);const r=this._baseState;return Hn(r.use===null),r.use=e,this};Kt.prototype.optional=function(){const e=this._baseState;return e.optional=!0,this};Kt.prototype.def=function(e){const r=this._baseState;return Hn(r.default===null),r.default=e,r.optional=!0,this};Kt.prototype.explicit=function(e){const r=this._baseState;return Hn(r.explicit===null&&r.implicit===null),r.explicit=e,this};Kt.prototype.implicit=function(e){const r=this._baseState;return Hn(r.explicit===null&&r.implicit===null),r.implicit=e,this};Kt.prototype.obj=function(){const e=this._baseState,r=Array.prototype.slice.call(arguments);return e.obj=!0,r.length!==0&&this._useArgs(r),this};Kt.prototype.key=function(e){const r=this._baseState;return Hn(r.key===null),r.key=e,this};Kt.prototype.any=function(){const e=this._baseState;return e.any=!0,this};Kt.prototype.choice=function(e){const r=this._baseState;return Hn(r.choice===null),r.choice=e,this._useArgs(Object.keys(e).map(function(n){return e[n]})),this};Kt.prototype.contains=function(e){const r=this._baseState;return Hn(r.use===null),r.contains=e,this};Kt.prototype._decode=function(e,r){const n=this._baseState;if(n.parent===null)return e.wrapResult(n.children[0]._decode(e,r));let i=n.default,s=!0,a=null;if(n.key!==null&&(a=e.enterKey(n.key)),n.optional){let c=null;if(n.explicit!==null?c=n.explicit:n.implicit!==null?c=n.implicit:n.tag!==null&&(c=n.tag),c===null&&!n.any){const u=e.save();try{n.choice===null?this._decodeGeneric(n.tag,e,r):this._decodeChoice(e,r),s=!0}catch{s=!1}e.restore(u)}else if(s=this._peekTag(e,c,n.any),e.isError(s))return s}let o;if(n.obj&&s&&(o=e.enterObject()),s){if(n.explicit!==null){const u=this._decodeTag(e,n.explicit);if(e.isError(u))return u;e=u}const c=e.offset;if(n.use===null&&n.choice===null){let u;n.any&&(u=e.save());const l=this._decodeTag(e,n.implicit!==null?n.implicit:n.tag,n.any);if(e.isError(l))return l;n.any?i=e.raw(u):e=l}if(r&&r.track&&n.tag!==null&&r.track(e.path(),c,e.length,"tagged"),r&&r.track&&n.tag!==null&&r.track(e.path(),e.offset,e.length,"content"),n.any||(n.choice===null?i=this._decodeGeneric(n.tag,e,r):i=this._decodeChoice(e,r)),e.isError(i))return i;if(!n.any&&n.choice===null&&n.children!==null&&n.children.forEach(function(l){l._decode(e,r)}),n.contains&&(n.tag==="octstr"||n.tag==="bitstr")){const u=new BV(i);i=this._getUse(n.contains,e._reporterState.obj)._decode(u,r)}}return n.obj&&s&&(i=e.leaveObject(o)),n.key!==null&&(i!==null||s===!0)?e.leaveKey(a,n.key,i):a!==null&&e.exitKey(a),i};Kt.prototype._decodeGeneric=function(e,r,n){const i=this._baseState;return e==="seq"||e==="set"?null:e==="seqof"||e==="setof"?this._decodeList(r,e,i.args[0],n):/str$/.test(e)?this._decodeStr(r,e,n):e==="objid"&&i.args?this._decodeObjid(r,i.args[0],i.args[1],n):e==="objid"?this._decodeObjid(r,null,null,n):e==="gentime"||e==="utctime"?this._decodeTime(r,e,n):e==="null_"?this._decodeNull(r,n):e==="bool"?this._decodeBool(r,n):e==="objDesc"?this._decodeStr(r,e,n):e==="int"||e==="enum"?this._decodeInt(r,i.args&&i.args[0],n):i.use!==null?this._getUse(i.use,r._reporterState.obj)._decode(r,n):r.error("unknown tag: "+e)};Kt.prototype._getUse=function(e,r){const n=this._baseState;return n.useDecoder=this._use(e,r),Hn(n.useDecoder._baseState.parent===null),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder};Kt.prototype._decodeChoice=function(e,r){const n=this._baseState;let i=null,s=!1;return Object.keys(n.choice).some(function(a){const o=e.save(),c=n.choice[a];try{const u=c._decode(e,r);if(e.isError(u))return!1;i={type:a,value:u},s=!0}catch{return e.restore(o),!1}return!0},this),s?i:e.error("Choice not matched")};Kt.prototype._createEncoderBuffer=function(e){return new kV(e,this.reporter)};Kt.prototype._encode=function(e,r,n){const i=this._baseState;if(i.default!==null&&i.default===e)return;const s=this._encodeValue(e,r,n);if(s!==void 0&&!this._skipDefault(s,r,n))return s};Kt.prototype._encodeValue=function(e,r,n){const i=this._baseState;if(i.parent===null)return i.children[0]._encode(e,r||new _V);let s=null;if(this.reporter=r,i.optional&&e===void 0)if(i.default!==null)e=i.default;else return;let a=null,o=!1;if(i.any)s=this._createEncoderBuffer(e);else if(i.choice)s=this._encodeChoice(e,r);else if(i.contains)a=this._getUse(i.contains,n)._encode(e,r),o=!0;else if(i.children)a=i.children.map(function(c){if(c._baseState.tag==="null_")return c._encode(null,r,e);if(c._baseState.key===null)return r.error("Child should have a key");const u=r.enterKey(c._baseState.key);if(typeof e!="object")return r.error("Child expected, but input is not object");const l=c._encode(e[c._baseState.key],r,e);return r.leaveKey(u),l},this).filter(function(c){return c}),a=this._createEncoderBuffer(a);else if(i.tag==="seqof"||i.tag==="setof"){if(!(i.args&&i.args.length===1))return r.error("Too many args for : "+i.tag);if(!Array.isArray(e))return r.error("seqof/setof, but data is not Array");const c=this.clone();c._baseState.implicit=null,a=this._createEncoderBuffer(e.map(function(u){const l=this._baseState;return this._getUse(l.args[0],e)._encode(u,r)},c))}else i.use!==null?s=this._getUse(i.use,n)._encode(e,r):(a=this._encodePrimitive(i.tag,e),o=!0);if(!i.any&&i.choice===null){const c=i.implicit!==null?i.implicit:i.tag,u=i.implicit===null?"universal":"context";c===null?i.use===null&&r.error("Tag could be omitted only for .use()"):i.use===null&&(s=this._encodeComposite(c,o,u,a))}return i.explicit!==null&&(s=this._encodeComposite(i.explicit,!1,"context",s)),s};Kt.prototype._encodeChoice=function(e,r){const n=this._baseState,i=n.choice[e.type];return i||Hn(!1,e.type+" not found in "+JSON.stringify(Object.keys(n.choice))),i._encode(e.value,r)};Kt.prototype._encodePrimitive=function(e,r){const n=this._baseState;if(/str$/.test(e))return this._encodeStr(r,e);if(e==="objid"&&n.args)return this._encodeObjid(r,n.reverseArgs[0],n.args[1]);if(e==="objid")return this._encodeObjid(r,null,null);if(e==="gentime"||e==="utctime")return this._encodeTime(r,e);if(e==="null_")return this._encodeNull();if(e==="int"||e==="enum")return this._encodeInt(r,n.args&&n.reverseArgs[0]);if(e==="bool")return this._encodeBool(r);if(e==="objDesc")return this._encodeStr(r,e);throw new Error("Unsupported tag: "+e)};Kt.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)};Kt.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)};var Zy={};(function(t){function e(r){const n={};return Object.keys(r).forEach(function(i){(i|0)==i&&(i=i|0);const s=r[i];n[s]=i}),n}t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=e(t.tagClass),t.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"},t.tagByName=e(t.tag)})(Zy);const TV=Ys,go=S5.Buffer,XI=A5,zx=Zy;function QI(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new ea,this.tree._init(t.body)}var YI=QI;QI.prototype.encode=function(e,r){return this.tree._encode(e,r).join()};function ea(t){XI.call(this,"der",t)}TV(ea,XI);ea.prototype._encodeComposite=function(e,r,n,i){const s=NV(e,r,n,this.reporter);if(i.length<128){const c=go.alloc(2);return c[0]=s,c[1]=i.length,this._createEncoderBuffer([c,i])}let a=1;for(let c=i.length;c>=256;c>>=8)a++;const o=go.alloc(2+a);o[0]=s,o[1]=128|a;for(let c=1+a,u=i.length;u>0;c--,u>>=8)o[c]=u&255;return this._createEncoderBuffer([o,i])};ea.prototype._encodeStr=function(e,r){if(r==="bitstr")return this._createEncoderBuffer([e.unused|0,e.data]);if(r==="bmpstr"){const n=go.alloc(e.length*2);for(let i=0;i=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,e[0]*40+e[1])}let i=0;for(let o=0;o=128;c>>=7)i++}const s=go.alloc(i);let a=s.length-1;for(let o=e.length-1;o>=0;o--){let c=e[o];for(s[a--]=c&127;(c>>=7)>0;)s[a--]=128|c&127}return this._createEncoderBuffer(s)};function Li(t){return t<10?"0"+t:t}ea.prototype._encodeTime=function(e,r){let n;const i=new Date(e);return r==="gentime"?n=[Li(i.getUTCFullYear()),Li(i.getUTCMonth()+1),Li(i.getUTCDate()),Li(i.getUTCHours()),Li(i.getUTCMinutes()),Li(i.getUTCSeconds()),"Z"].join(""):r==="utctime"?n=[Li(i.getUTCFullYear()%100),Li(i.getUTCMonth()+1),Li(i.getUTCDate()),Li(i.getUTCHours()),Li(i.getUTCMinutes()),Li(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+r+" time is not supported yet"),this._encodeStr(n,"octstr")};ea.prototype._encodeNull=function(){return this._createEncoderBuffer("")};ea.prototype._encodeInt=function(e,r){if(typeof e=="string"){if(!r)return this.reporter.error("String int or enum given, but no values map");if(!r.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=r[e]}if(typeof e!="number"&&!go.isBuffer(e)){const s=e.toArray();!e.sign&&s[0]&128&&s.unshift(0),e=go.from(s)}if(go.isBuffer(e)){let s=e.length;e.length===0&&s++;const a=go.alloc(s);return e.copy(a),e.length===0&&(a[0]=0),this._createEncoderBuffer(a)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let n=1;for(let s=e;s>=256;s>>=8)n++;const i=new Array(n);for(let s=i.length-1;s>=0;s--)i[s]=e&255,e>>=8;return i[0]&128&&i.unshift(0),this._createEncoderBuffer(go.from(i))};ea.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)};ea.prototype._use=function(e,r){return typeof e=="function"&&(e=e(r)),e._getEncoder("der").tree};ea.prototype._skipDefault=function(e,r,n){const i=this._baseState;let s;if(i.default===null)return!1;const a=e.join();if(i.defaultBuffer===void 0&&(i.defaultBuffer=this._encodeValue(i.default,r,n).join()),a.length!==i.defaultBuffer.length)return!1;for(s=0;s=31?n.error("Multi-octet tag encoding unsupported"):(e||(i|=32),i|=zx.tagClassByName[r||"universal"]<<6,i)}const RV=Ys,C5=YI;function _5(t){C5.call(this,t),this.enc="pem"}RV(_5,C5);var DV=_5;_5.prototype.encode=function(e,r){const i=C5.prototype.encode.call(this,e).toString("base64"),s=["-----BEGIN "+r.label+"-----"];for(let a=0;a>6],i=(r&32)===0;if((r&31)===31){let a=r;for(r=0;(a&128)===128;){if(a=t.readUInt8(e),t.isError(a))return a;r<<=7,r|=a&127}}else r&=31;const s=lA.tag[r];return{cls:n,primitive:i,tag:r,tagStr:s}}function nF(t,e,r){let n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&n===128)return null;if(!(n&128))return n;const i=n&127;if(i>4)return t.error("length octect is too long");n=0;for(let s=0;s",JV="MIT",XV={url:"https://github.com/indutny/elliptic/issues"},QV="https://github.com/indutny/elliptic",YV={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},eq={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},tq={name:$V,version:zV,description:HV,main:VV,files:qV,scripts:KV,repository:WV,keywords:GV,author:ZV,license:JV,bugs:XV,homepage:QV,devDependencies:YV,dependencies:eq};var Oi={},P5={};(function(t){var e=t;function r(s,a){if(Array.isArray(s))return s.slice();if(!s)return[];var o=[];if(typeof s!="string"){for(var c=0;c>8,f=u&255;l?o.push(l,f):o.push(f)}return o}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var a="",o=0;o(g>>1)-1?x=(g>>1)-b:x=b,v.isubn(x)):x=0,p[h]=x,v.iushrn(1)}return p}e.getNAF=s;function a(l,f){var d=[[],[]];l=l.clone(),f=f.clone();for(var p=0,h=0,g;l.cmpn(-p)>0||f.cmpn(-h)>0;){var v=l.andln(3)+p&3,x=f.andln(3)+h&3;v===3&&(v=-1),x===3&&(x=-1);var b;v&1?(g=l.andln(7)+p&7,(g===3||g===5)&&x===2?b=-v:b=v):b=0,d[0].push(b);var S;x&1?(g=f.andln(7)+h&7,(g===3||g===5)&&v===2?S=-x:S=x):S=0,d[1].push(S),2*p===b+1&&(p=1-p),2*h===S+1&&(h=1-h),l.iushrn(1),f.iushrn(1)}return d}e.getJSF=a;function o(l,f,d){var p="_"+f;l.prototype[f]=function(){return this[p]!==void 0?this[p]:this[p]=d.call(this)}}e.cachedProperty=o;function c(l){return typeof l=="string"?e.toArray(l,"hex"):l}e.parseBytes=c;function u(l){return new r(l,"hex","le")}e.intFromLE=u})(Oi);var T5={exports:{}},Hx;T5.exports=function(e){return Hx||(Hx=new Uc(null)),Hx.generate(e)};function Uc(t){this.rand=t}T5.exports.Rand=Uc;Uc.prototype.generate=function(e){return this._rand(e)};Uc.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Jy=vu;vu.prototype.point=function(){throw new Error("Not implemented")};vu.prototype.validate=function(){throw new Error("Not implemented")};vu.prototype._fixedNafMul=function(e,r){bv(e.precomputed);var n=e._getDoubles(),i=xv(r,1,this._bitLength),s=(1<=o;u--)c=(c<<1)+i[u];a.push(c)}for(var l=this.jpoint(null,null,null),f=this.jpoint(null,null,null),d=s;d>0;d--){for(o=0;o=0;c--){for(var u=0;c>=0&&a[c]===0;c--)u++;if(c>=0&&u++,o=o.dblp(u),c<0)break;var l=a[c];bv(l!==0),e.type==="affine"?l>0?o=o.mixedAdd(s[l-1>>1]):o=o.mixedAdd(s[-l-1>>1].neg()):l>0?o=o.add(s[l-1>>1]):o=o.add(s[-l-1>>1].neg())}return e.type==="affine"?o.toP():o};vu.prototype._wnafMulAdd=function(e,r,n,i,s){var a=this._wnafT1,o=this._wnafT2,c=this._wnafT3,u=0,l,f,d;for(l=0;l=1;l-=2){var h=l-1,g=l;if(a[h]!==1||a[g]!==1){c[h]=xv(n[h],a[h],this._bitLength),c[g]=xv(n[g],a[g],this._bitLength),u=Math.max(c[h].length,u),u=Math.max(c[g].length,u);continue}var v=[r[h],null,null,r[g]];r[h].y.cmp(r[g].y)===0?(v[1]=r[h].add(r[g]),v[2]=r[h].toJ().mixedAdd(r[g].neg())):r[h].y.cmp(r[g].y.redNeg())===0?(v[1]=r[h].toJ().mixedAdd(r[g]),v[2]=r[h].add(r[g].neg())):(v[1]=r[h].toJ().mixedAdd(r[g]),v[2]=r[h].toJ().mixedAdd(r[g].neg()));var x=[-3,-1,-5,-7,0,7,5,1,3],b=rq(n[h],n[g]);for(u=Math.max(b[0].length,u),c[h]=new Array(u),c[g]=new Array(u),f=0;f=0;l--){for(var B=0;l>=0;){var N=!0;for(f=0;f=0&&B++,P=P.dblp(B),l<0)break;for(f=0;f0?d=o[f][T-1>>1]:T<0&&(d=o[f][-T-1>>1].neg()),d.type==="affine"?P=P.mixedAdd(d):P=P.add(d))}}for(l=0;l=Math.ceil((e.bitLength()+1)/r.step):!1};ps.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(p=u,h=l),f.negative&&(f=f.neg(),d=d.neg()),p.negative&&(p=p.neg(),h=h.neg()),[{a:f,b:d},{a:p,b:h}]};gs.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),a=n.b.neg().mul(e).divRound(this.n),o=s.mul(n.a),c=a.mul(i.a),u=s.mul(n.b),l=a.mul(i.b),f=e.sub(o).sub(c),d=u.add(l).neg();return{k1:f,k2:d}};gs.prototype.pointFromX=function(e,r){e=new Er(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)};gs.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0};gs.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,a=0;a":""};sn.prototype.isInfinity=function(){return this.inf};sn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};sn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),a=s.redSqr().redISub(this.x.redAdd(this.x)),o=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,o)};sn.prototype.getX=function(){return this.x.fromRed()};sn.prototype.getY=function(){return this.y.fromRed()};sn.prototype.mul=function(e){return e=new Er(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};sn.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};sn.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};sn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};sn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};sn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function gn(t,e,r,n){Vh.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Er(0)):(this.x=new Er(e,16),this.y=new Er(r,16),this.z=new Er(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}R5(gn,Vh.BasePoint);gs.prototype.jpoint=function(e,r,n){return new gn(this,e,r,n)};gn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};gn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};gn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),a=this.y.redMul(r.redMul(e.z)),o=e.y.redMul(n.redMul(this.z)),c=i.redSub(s),u=a.redSub(o);if(c.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=c.redSqr(),f=l.redMul(c),d=i.redMul(l),p=u.redSqr().redIAdd(f).redISub(d).redISub(d),h=u.redMul(d.redISub(p)).redISub(a.redMul(f)),g=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(p,h,g)};gn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,a=e.y.redMul(r).redMul(this.z),o=n.redSub(i),c=s.redSub(a);if(o.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=o.redSqr(),l=u.redMul(o),f=n.redMul(u),d=c.redSqr().redIAdd(l).redISub(f).redISub(f),p=c.redMul(f.redISub(d)).redISub(s.redMul(l)),h=this.z.redMul(o);return this.curve.jpoint(d,p,h)};gn.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}};gn.prototype.inspect=function(){return this.isInfinity()?"":""};gn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Lf=Qs,uF=Ys,Xy=Jy,aq=Oi;function qh(t){Xy.call(this,"mont",t),this.a=new Lf(t.a,16).toRed(this.red),this.b=new Lf(t.b,16).toRed(this.red),this.i4=new Lf(4).toRed(this.red).redInvm(),this.two=new Lf(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}uF(qh,Xy);var oq=qh;qh.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function rn(t,e,r){Xy.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Lf(e,16),this.z=new Lf(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}uF(rn,Xy.BasePoint);qh.prototype.decodePoint=function(e,r){return this.point(aq.toArray(e,r),1)};qh.prototype.point=function(e,r){return new rn(this,e,r)};qh.prototype.pointFromJSON=function(e){return rn.fromJSON(this,e)};rn.prototype.precompute=function(){};rn.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};rn.fromJSON=function(e,r){return new rn(e,r[0],r[1]||e.one)};rn.prototype.inspect=function(){return this.isInfinity()?"":""};rn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};rn.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),a=r.redMul(i),o=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(a,o)};rn.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};rn.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),a=e.x.redSub(e.z),o=a.redMul(n),c=s.redMul(i),u=r.z.redMul(o.redAdd(c).redSqr()),l=r.x.redMul(o.redISub(c).redSqr());return this.curve.point(u,l)};rn.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,a=[];r.cmpn(0)!==0;r.iushrn(1))a.push(r.andln(1));for(var o=a.length-1;o>=0;o--)a[o]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i};rn.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};rn.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};rn.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};rn.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};rn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var cq=Oi,bo=Qs,lF=Ys,Qy=Jy,uq=cq.assert;function $a(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Qy.call(this,"edwards",t),this.a=new bo(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new bo(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new bo(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),uq(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}lF($a,Qy);var lq=$a;$a.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};$a.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};$a.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)};$a.prototype.pointFromX=function(e,r){e=new bo(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),a=i.redMul(s.redInvm()),o=a.redSqrt();if(o.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");var c=o.fromRed().isOdd();return(r&&!c||!r&&c)&&(o=o.redNeg()),this.point(e,o)};$a.prototype.pointFromY=function(e,r){e=new bo(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),a=i.redMul(s.redInvm());if(a.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var o=a.redSqrt();if(o.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");return o.fromRed().isOdd()!==r&&(o=o.redNeg()),this.point(o,e)};$a.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function tr(t,e,r,n,i){Qy.BasePoint.call(this,t,"projective"),e===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 bo(e,16),this.y=new bo(r,16),this.z=n?new bo(n,16):this.curve.one,this.t=i&&new bo(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.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()))))}lF(tr,Qy.BasePoint);$a.prototype.pointFromJSON=function(e){return tr.fromJSON(this,e)};$a.prototype.point=function(e,r,n,i){return new tr(this,e,r,n,i)};tr.fromJSON=function(e,r){return new tr(e,r[0],r[1],r[2])};tr.prototype.inspect=function(){return this.isInfinity()?"":""};tr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};tr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),a=i.redAdd(r),o=a.redSub(n),c=i.redSub(r),u=s.redMul(o),l=a.redMul(c),f=s.redMul(c),d=o.redMul(a);return this.curve.point(u,l,d,f)};tr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,a,o,c,u;if(this.curve.twisted){o=this.curve._mulA(r);var l=o.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(l.redSub(this.curve.two)),s=l.redMul(o.redSub(n)),a=l.redSqr().redSub(l).redSub(l)):(c=this.z.redSqr(),u=l.redSub(c).redISub(c),i=e.redSub(r).redISub(n).redMul(u),s=l.redMul(o.redSub(n)),a=l.redMul(u))}else o=r.redAdd(n),c=this.curve._mulC(this.z).redSqr(),u=o.redSub(c).redSub(c),i=this.curve._mulC(e.redISub(o)).redMul(u),s=this.curve._mulC(o).redMul(r.redISub(n)),a=o.redMul(u);return this.curve.point(i,s,a)};tr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};tr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),a=n.redSub(r),o=s.redSub(i),c=s.redAdd(i),u=n.redAdd(r),l=a.redMul(o),f=c.redMul(u),d=a.redMul(u),p=o.redMul(c);return this.curve.point(l,f,p,d)};tr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(i).redMul(s),o=n.redSub(a),c=n.redAdd(a),u=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),l=r.redMul(o).redMul(u),f,d;return this.curve.twisted?(f=r.redMul(c).redMul(s.redSub(this.curve._mulA(i))),d=o.redMul(c)):(f=r.redMul(c).redMul(s.redSub(i)),d=this.curve._mulC(o).redMul(c)),this.curve.point(l,f,d)};tr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};tr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};tr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)};tr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)};tr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this};tr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};tr.prototype.getX=function(){return this.normalize(),this.x.fromRed()};tr.prototype.getY=function(){return this.normalize(),this.y.fromRed()};tr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};tr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}};tr.prototype.toP=tr.prototype.normalize;tr.prototype.mixedAdd=tr.prototype.add;(function(t){var e=t;e.base=Jy,e.short=sq,e.mont=oq,e.edwards=lq})(N5);var Yy={},e2={},St={},fq=mu,dq=Ys;St.inherits=dq;function hq(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function pq(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):hq(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}St.htonl=fF;function mq(t,e){for(var r="",n=0;n>>0}return s}St.join32=vq;function yq(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}St.split32=yq;function xq(t,e){return t>>>e|t<<32-e}St.rotr32=xq;function bq(t,e){return t<>>32-e}St.rotl32=bq;function wq(t,e){return t+e>>>0}St.sum32=wq;function Eq(t,e,r){return t+e+r>>>0}St.sum32_3=Eq;function Sq(t,e,r,n){return t+e+r+n>>>0}St.sum32_4=Sq;function Aq(t,e,r,n,i){return t+e+r+n+i>>>0}St.sum32_5=Aq;function Cq(t,e,r,n){var i=t[e],s=t[e+1],a=n+s>>>0,o=(a>>0,t[e+1]=a}St.sum64=Cq;function _q(t,e,r,n){var i=e+n>>>0,s=(i>>0}St.sum64_hi=_q;function kq(t,e,r,n){var i=e+n;return i>>>0}St.sum64_lo=kq;function Bq(t,e,r,n,i,s,a,o){var c=0,u=e;u=u+n>>>0,c+=u>>0,c+=u>>0,c+=u>>0}St.sum64_4_hi=Bq;function Iq(t,e,r,n,i,s,a,o){var c=e+n+s+o;return c>>>0}St.sum64_4_lo=Iq;function Fq(t,e,r,n,i,s,a,o,c,u){var l=0,f=e;f=f+n>>>0,l+=f>>0,l+=f>>0,l+=f>>0,l+=f>>0}St.sum64_5_hi=Fq;function Pq(t,e,r,n,i,s,a,o,c,u){var l=e+n+s+o+u;return l>>>0}St.sum64_5_lo=Pq;function Tq(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}St.rotr64_hi=Tq;function Nq(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}St.rotr64_lo=Nq;function Rq(t,e,r){return t>>>r}St.shr64_hi=Rq;function Dq(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}St.shr64_lo=Dq;var Kh={},dA=St,Oq=mu;function t2(){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}Kh.BlockHash=t2;t2.prototype.update=function(e,r){if(e=dA.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=dA.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,a=8;a>>3}za.g0_256=$q;function zq(t){return Fa(t,17)^Fa(t,19)^t>>>10}za.g1_256=zq;var ph=St,Hq=Kh,Vq=za,Vx=ph.rotl32,E0=ph.sum32,qq=ph.sum32_5,Kq=Vq.ft_1,vF=Hq.BlockHash,Wq=[1518500249,1859775393,2400959708,3395469782];function Ra(){if(!(this instanceof Ra))return new Ra;vF.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}ph.inherits(Ra,vF);var Gq=Ra;Ra.blockSize=512;Ra.outSize=160;Ra.hmacStrength=80;Ra.padLength=64;Ra.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),DK(e.length<=this.blockSize);for(var r=e.length;r=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var jK=nu;nu.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};nu.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=xl.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var wv=Qs,D5=Oi,HK=D5.assert;function r2(t,e){if(t instanceof r2)return t;this._importDER(t,e)||(HK(t.r&&t.s,"Signature without r or s"),this.r=new wv(t.r,16),this.s=new wv(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var VK=r2;function qK(){this.place=0}function Gx(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,a=e.place;s>>=0;return i<=127?!1:(e.place=a,i)}function vA(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}r2.prototype.toDER=function(e){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=vA(r),n=vA(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Zx(i,r.length),i=i.concat(r),i.push(2),Zx(i,n.length);var s=i.concat(n),a=[48];return Zx(a,s.length),a=a.concat(s),D5.encode(a,e)};var bl=Qs,IF=jK,KK=Oi,Jx=Yy,WK=cF,FF=KK.assert,O5=zK,n2=VK;function ls(t){if(!(this instanceof ls))return new ls(t);typeof t=="string"&&(FF(Object.prototype.hasOwnProperty.call(Jx,t),"Unknown curve "+t),t=Jx[t]),t instanceof Jx.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var GK=ls;ls.prototype.keyPair=function(e){return new O5(this,e)};ls.prototype.keyFromPrivate=function(e,r){return O5.fromPrivate(this,e,r)};ls.prototype.keyFromPublic=function(e,r){return O5.fromPublic(this,e,r)};ls.prototype.genKeyPair=function(e){e||(e={});for(var r=new IF({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||WK(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new bl(2));;){var s=new bl(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};ls.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};ls.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new bl(e,16));for(var s=this.n.byteLength(),a=r.getPrivate().toArray("be",s),o=e.toArray("be",s),c=new IF({hash:this.hash,entropy:a,nonce:o,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new bl(1)),l=0;;l++){var f=i.k?i.k(l):new bl(c.generate(this.n.byteLength()));if(f=this._truncateToN(f,!0),!(f.cmpn(1)<=0||f.cmp(u)>=0)){var d=this.g.mul(f);if(!d.isInfinity()){var p=d.getX(),h=p.umod(this.n);if(h.cmpn(0)!==0){var g=f.invm(this.n).mul(h.mul(r.getPrivate()).iadd(e));if(g=g.umod(this.n),g.cmpn(0)!==0){var v=(d.getY().isOdd()?1:0)|(p.cmp(h)!==0?2:0);return i.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),v^=1),new n2({r:h,s:g,recoveryParam:v})}}}}}};ls.prototype.verify=function(e,r,n,i){e=this._truncateToN(new bl(e,16)),n=this.keyFromPublic(n,i),r=new n2(r,"hex");var s=r.r,a=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var o=a.invm(this.n),c=o.mul(e).umod(this.n),u=o.mul(s).umod(this.n),l;return this.curve._maxwellTrick?(l=this.g.jmulAdd(c,n.getPublic(),u),l.isInfinity()?!1:l.eqXToP(s)):(l=this.g.mulAdd(c,n.getPublic(),u),l.isInfinity()?!1:l.getX().umod(this.n).cmp(s)===0)};ls.prototype.recoverPubKey=function(t,e,r,n){FF((3&r)===r,"The recovery param is more than two bits"),e=new n2(e,n);var i=this.n,s=new bl(t),a=e.r,o=e.s,c=r&1,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?a=this.curve.pointFromX(a.add(this.curve.n),c):a=this.curve.pointFromX(a,c);var l=e.r.invm(i),f=i.sub(s).mul(l).umod(i),d=o.mul(l).umod(i);return this.g.mulAdd(f,a,d)};ls.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new n2(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var Kg=Oi,PF=Kg.assert,yA=Kg.parseBytes,Zh=Kg.cachedProperty;function tn(t,e){this.eddsa=t,this._secret=yA(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=yA(e.pub)}tn.fromPublic=function(e,r){return r instanceof tn?r:new tn(e,{pub:r})};tn.fromSecret=function(e,r){return r instanceof tn?r:new tn(e,{secret:r})};tn.prototype.secret=function(){return this._secret};Zh(tn,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});Zh(tn,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});Zh(tn,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i});Zh(tn,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});Zh(tn,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});Zh(tn,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});tn.prototype.sign=function(e){return PF(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};tn.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)};tn.prototype.getSecret=function(e){return PF(this._secret,"KeyPair is public only"),Kg.encode(this.secret(),e)};tn.prototype.getPublic=function(e){return Kg.encode(this.pubBytes(),e)};var ZK=tn,JK=Qs,i2=Oi,XK=i2.assert,s2=i2.cachedProperty,QK=i2.parseBytes;function Wl(t,e){this.eddsa=t,typeof e!="object"&&(e=QK(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),XK(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof JK&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}s2(Wl,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});s2(Wl,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});s2(Wl,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});s2(Wl,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});Wl.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};Wl.prototype.toHex=function(){return i2.encode(this.toBytes(),"hex").toUpperCase()};var YK=Wl,eW=e2,tW=Yy,vh=Oi,rW=vh.assert,TF=vh.parseBytes,NF=ZK,xA=YK;function oi(t){if(rW(t==="ed25519","only tested with ed25519 so far"),!(this instanceof oi))return new oi(t);t=tW[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=eW.sha512}var nW=oi;oi.prototype.sign=function(e,r){e=TF(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),a=this.encodePoint(s),o=this.hashInt(a,n.pubBytes(),e).mul(n.priv()),c=i.add(o).umod(this.curve.n);return this.makeSignature({R:s,S:c,Rencoded:a})};oi.prototype.verify=function(e,r,n){e=TF(e),r=this.makeSignature(r);var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),a=this.g.mul(r.S()),o=r.R().add(i.pub().mul(s));return o.eq(a)};oi.prototype.hashInt=function(){for(var e=this.hash(),r=0;r>>2]>>>24-x%4*8&255;p[g+x>>>2]|=b<<24-(g+x)%4*8}else for(var x=0;x>>2]=h[x>>>2];return this.sigBytes+=v,this},clamp:function(){var d=this.words,p=this.sigBytes;d[p>>>2]&=4294967295<<32-p%4*8,d.length=t.ceil(p/4)},clone:function(){var d=i.clone.call(this);return d.words=this.words.slice(0),d},random:function(d){for(var p=[],h=0;h>>2]>>>24-v%4*8&255;g.push((x>>>4).toString(16)),g.push((x&15).toString(16))}return g.join("")},parse:function(d){for(var p=d.length,h=[],g=0;g>>3]|=parseInt(d.substr(g,2),16)<<24-g%8*4;return new s.init(h,p/2)}},c=a.Latin1={stringify:function(d){for(var p=d.words,h=d.sigBytes,g=[],v=0;v>>2]>>>24-v%4*8&255;g.push(String.fromCharCode(x))}return g.join("")},parse:function(d){for(var p=d.length,h=[],g=0;g>>2]|=(d.charCodeAt(g)&255)<<24-g%4*8;return new s.init(h,p)}},u=a.Utf8={stringify:function(d){try{return decodeURIComponent(escape(c.stringify(d)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(d){return c.parse(unescape(encodeURIComponent(d)))}},l=n.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(d){typeof d=="string"&&(d=u.parse(d)),this._data.concat(d),this._nDataBytes+=d.sigBytes},_process:function(d){var p=this._data,h=p.words,g=p.sigBytes,v=this.blockSize,x=v*4,b=g/x;d?b=t.ceil(b):b=t.max((b|0)-this._minBufferSize,0);var S=b*v,_=t.min(S*4,g);if(S){for(var P=0;P>>2]&255}},e.BlockCipher=o.extend({cfg:o.cfg.extend({mode:f,padding:u}),reset:function(){o.reset.call(this);var v=this.cfg,g=v.iv,v=v.mode;if(this._xformMode==this._ENC_XFORM_MODE)var x=v.createEncryptor;else x=v.createDecryptor,this._minBufferSize=1;this._mode=x.call(v,this,g&&g.words)},_doProcessBlock:function(g,v){this._mode.processBlock(g,v)},_doFinalize:function(){var g=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){g.pad(this._data,this.blockSize);var v=this._process(!0)}else v=this._process(!0),g.unpad(v);return v},blockSize:4});var l=e.CipherParams=r.extend({init:function(g){this.mixIn(g)},toString:function(g){return(g||this.formatter).stringify(this)}}),f=(p.format={}).OpenSSL={stringify:function(g){var v=g.ciphertext;return g=g.salt,(g?n.create([1398893684,1701076831]).concat(g).concat(v):v).toString(s)},parse:function(g){g=s.parse(g);var v=g.words;if(v[0]==1398893684&&v[1]==1701076831){var x=n.create(v.slice(2,4));v.splice(0,4),g.sigBytes-=16}return l.create({ciphertext:g,salt:x})}},d=e.SerializableCipher=r.extend({cfg:r.extend({format:f}),encrypt:function(g,v,x,b){b=this.cfg.extend(b);var S=g.createEncryptor(x,b);return v=S.finalize(v),S=S.cfg,l.create({ciphertext:v,key:x,iv:S.iv,algorithm:g,mode:S.mode,padding:S.padding,blockSize:g.blockSize,formatter:b.format})},decrypt:function(g,v,x,b){return b=this.cfg.extend(b),v=this._parse(v,b.format),g.createDecryptor(x,b).finalize(v.ciphertext)},_parse:function(g,v){return typeof g=="string"?v.parse(g,this):g}}),p=(p.kdf={}).OpenSSL={execute:function(g,v,x,b){return b||(b=n.random(8)),g=a.create({keySize:v+x}).compute(g,b),x=n.create(g.words.slice(v),4*x),g.sigBytes=4*v,l.create({key:g,iv:x,salt:b})}},h=e.PasswordBasedCipher=d.extend({cfg:d.cfg.extend({kdf:p}),encrypt:function(g,v,x,b){return b=this.cfg.extend(b),x=b.kdf.execute(x,g.keySize,g.ivSize),b.iv=x.iv,g=d.encrypt.call(this,g,v,x.key,b),g.mixIn(x),g},decrypt:function(g,v,x,b){return b=this.cfg.extend(b),v=this._parse(v,b.format),x=b.kdf.execute(x,g.keySize,g.ivSize,v.salt),b.iv=x.iv,d.decrypt.call(this,g,v,x.key,b)}})}();(function(){for(var t=$e,e=t.lib.BlockCipher,C=t.algo,r=[],n=[],i=[],s=[],a=[],o=[],c=[],u=[],l=[],f=[],d=[],p=0;256>p;p++)d[p]=128>p?p<<1:p<<1^283;for(var h=0,g=0,p=0;256>p;p++){var v=g^g<<1^g<<2^g<<3^g<<4,v=v>>>8^v&255^99;r[h]=v,n[v]=h;var x=d[h],b=d[x],S=d[b],_=257*d[v]^16843008*v;i[h]=_<<24|_>>>8,s[h]=_<<16|_>>>16,a[h]=_<<8|_>>>24,o[h]=_,_=16843009*S^65537*b^257*x^16843008*h,c[v]=_<<24|_>>>8,u[v]=_<<16|_>>>16,l[v]=_<<8|_>>>24,f[v]=_,h?(h=x^d[d[d[S^x]]],g^=d[d[g]]):h=g=1}var P=[0,1,2,4,8,16,32,64,128,27,54],C=C.AES=e.extend({_doReset:function(){for(var T=this._key,B=T.words,N=T.sigBytes/4,T=4*((this._nRounds=N+6)+1),D=this._keySchedule=[],R=0;R>>24]<<24|r[E>>>16&255]<<16|r[E>>>8&255]<<8|r[E&255]):(E=E<<8|E>>>24,E=r[E>>>24]<<24|r[E>>>16&255]<<16|r[E>>>8&255]<<8|r[E&255],E^=P[R/N|0]<<24),D[R]=D[R-N]^E}for(B=this._invKeySchedule=[],N=0;NN||4>=R?E:c[r[E>>>24]]^u[r[E>>>16&255]]^l[r[E>>>8&255]]^f[r[E&255]]},encryptBlock:function(B,N){this._doCryptBlock(B,N,this._keySchedule,i,s,a,o,r)},decryptBlock:function(B,N){var T=B[N+1];B[N+1]=B[N+3],B[N+3]=T,this._doCryptBlock(B,N,this._invKeySchedule,c,u,l,f,n),T=B[N+1],B[N+1]=B[N+3],B[N+3]=T},_doCryptBlock:function(B,N,T,D,R,E,F,A){for(var I=this._nRounds,q=B[N]^T[0],ee=B[N+1]^T[1],X=B[N+2]^T[2],L=B[N+3]^T[3],j=4,$=1;$>>24]^R[ee>>>16&255]^E[X>>>8&255]^F[L&255]^T[j++],H=D[ee>>>24]^R[X>>>16&255]^E[L>>>8&255]^F[q&255]^T[j++],O=D[X>>>24]^R[L>>>16&255]^E[q>>>8&255]^F[ee&255]^T[j++],L=D[L>>>24]^R[q>>>16&255]^E[ee>>>8&255]^F[X&255]^T[j++],q=W,ee=H,X=O;W=(A[q>>>24]<<24|A[ee>>>16&255]<<16|A[X>>>8&255]<<8|A[L&255])^T[j++],H=(A[ee>>>24]<<24|A[X>>>16&255]<<16|A[L>>>8&255]<<8|A[q&255])^T[j++],O=(A[X>>>24]<<24|A[L>>>16&255]<<16|A[q>>>8&255]<<8|A[ee&255])^T[j++],L=(A[L>>>24]<<24|A[q>>>16&255]<<16|A[ee>>>8&255]<<8|A[X&255])^T[j++],B[N]=W,B[N+1]=H,B[N+2]=O,B[N+3]=L},keySize:8});t.AES=e._createHelper(C)})();(function(){function t(d,p){var h=(this._lBlock>>>d^this._rBlock)&p;this._rBlock^=h,this._lBlock^=h<>>d^this._lBlock)&p;this._lBlock^=h,this._rBlock^=h<h;h++){var g=a[h]-1;p[h]=d[g>>>5]>>>31-g%32&1}for(d=this._subKeys=[],g=0;16>g;g++){for(var v=d[g]=[],x=c[g],h=0;24>h;h++)v[h/6|0]|=p[(o[h]-1+x)%28]<<31-h%6,v[4+(h/6|0)]|=p[28+(o[h+24]-1+x)%28]<<31-h%6;for(v[0]=v[0]<<1|v[0]>>>31,h=1;7>h;h++)v[h]>>>=4*(h-1)+3;v[7]=v[7]<<5|v[7]>>>27}for(p=this._invSubKeys=[],h=0;16>h;h++)p[h]=d[15-h]},encryptBlock:function(d,p){this._doCryptBlock(d,p,this._subKeys)},decryptBlock:function(d,p){this._doCryptBlock(d,p,this._invSubKeys)},_doCryptBlock:function(d,p,h){this._lBlock=d[p],this._rBlock=d[p+1],t.call(this,4,252645135),t.call(this,16,65535),e.call(this,2,858993459),e.call(this,8,16711935),t.call(this,1,1431655765);for(var g=0;16>g;g++){for(var v=h[g],x=this._lBlock,b=this._rBlock,S=0,_=0;8>_;_++)S|=u[_][((b^v[_])&l[_])>>>0];this._lBlock=b,this._rBlock=x^S}h=this._lBlock,this._lBlock=this._rBlock,this._rBlock=h,t.call(this,1,1431655765),e.call(this,8,16711935),e.call(this,2,858993459),t.call(this,16,65535),t.call(this,4,252645135),d[p]=this._lBlock,d[p+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});r.DES=i._createHelper(f),s=s.TripleDES=i.extend({_doReset:function(){var d=this._key.words;this._des1=f.createEncryptor(n.create(d.slice(0,2))),this._des2=f.createEncryptor(n.create(d.slice(2,4))),this._des3=f.createEncryptor(n.create(d.slice(4,6)))},encryptBlock:function(d,p){this._des1.encryptBlock(d,p),this._des2.decryptBlock(d,p),this._des3.encryptBlock(d,p)},decryptBlock:function(d,p){this._des3.decryptBlock(d,p),this._des2.encryptBlock(d,p),this._des1.decryptBlock(d,p)},keySize:6,ivSize:2,blockSize:2}),r.TripleDES=i._createHelper(s)})();(function(){var t=$e,e=t.lib.WordArray;t.enc.Base64={stringify:function(r){var n=r.words,i=r.sigBytes,s=this._map;r.clamp(),r=[];for(var a=0;a>>2]>>>24-8*(a%4)&255)<<16|(n[a+1>>>2]>>>24-8*((a+1)%4)&255)<<8|n[a+2>>>2]>>>24-8*((a+2)%4)&255,c=0;4>c&&a+.75*c>>6*(3-c)&63));if(n=s.charAt(64))for(;r.length%4;)r.push(n);return r.join("")},parse:function(r){var n=r.length,i=this._map,s=i.charAt(64);s&&(s=r.indexOf(s),s!=-1&&(n=s));for(var s=[],a=0,o=0;o>>6-2*(o%4);s[a>>>2]|=(c|u)<<24-8*(a%4),a++}return e.create(s,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();(function(t){function e(f,d,p,h,g,v,x){return f=f+(d&p|~d&h)+g+x,(f<>>32-v)+d}function r(f,d,p,h,g,v,x){return f=f+(d&h|p&~h)+g+x,(f<>>32-v)+d}function n(f,d,p,h,g,v,x){return f=f+(d^p^h)+g+x,(f<>>32-v)+d}function i(f,d,p,h,g,v,x){return f=f+(p^(d|~h))+g+x,(f<>>32-v)+d}for(var s=$e,c=s.lib,a=c.WordArray,o=c.Hasher,c=s.algo,u=[],l=0;64>l;l++)u[l]=4294967296*t.abs(t.sin(l+1))|0;c=c.MD5=o.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(f,d){for(var p=0;16>p;p++){var h=d+p,g=f[h];f[h]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}var p=this._hash.words,h=f[d+0],g=f[d+1],v=f[d+2],x=f[d+3],b=f[d+4],S=f[d+5],_=f[d+6],P=f[d+7],C=f[d+8],B=f[d+9],N=f[d+10],T=f[d+11],D=f[d+12],R=f[d+13],E=f[d+14],F=f[d+15],A=p[0],$=p[1],j=p[2],I=p[3],A=e(A,$,j,I,h,7,u[0]),I=e(I,A,$,j,g,12,u[1]),j=e(j,I,A,$,v,17,u[2]),$=e($,j,I,A,x,22,u[3]),A=e(A,$,j,I,b,7,u[4]),I=e(I,A,$,j,S,12,u[5]),j=e(j,I,A,$,_,17,u[6]),$=e($,j,I,A,P,22,u[7]),A=e(A,$,j,I,C,7,u[8]),I=e(I,A,$,j,B,12,u[9]),j=e(j,I,A,$,N,17,u[10]),$=e($,j,I,A,T,22,u[11]),A=e(A,$,j,I,D,7,u[12]),I=e(I,A,$,j,R,12,u[13]),j=e(j,I,A,$,E,17,u[14]),$=e($,j,I,A,F,22,u[15]),A=r(A,$,j,I,g,5,u[16]),I=r(I,A,$,j,_,9,u[17]),j=r(j,I,A,$,T,14,u[18]),$=r($,j,I,A,h,20,u[19]),A=r(A,$,j,I,S,5,u[20]),I=r(I,A,$,j,N,9,u[21]),j=r(j,I,A,$,F,14,u[22]),$=r($,j,I,A,b,20,u[23]),A=r(A,$,j,I,B,5,u[24]),I=r(I,A,$,j,E,9,u[25]),j=r(j,I,A,$,x,14,u[26]),$=r($,j,I,A,C,20,u[27]),A=r(A,$,j,I,R,5,u[28]),I=r(I,A,$,j,v,9,u[29]),j=r(j,I,A,$,P,14,u[30]),$=r($,j,I,A,D,20,u[31]),A=n(A,$,j,I,S,4,u[32]),I=n(I,A,$,j,C,11,u[33]),j=n(j,I,A,$,T,16,u[34]),$=n($,j,I,A,E,23,u[35]),A=n(A,$,j,I,g,4,u[36]),I=n(I,A,$,j,b,11,u[37]),j=n(j,I,A,$,P,16,u[38]),$=n($,j,I,A,N,23,u[39]),A=n(A,$,j,I,R,4,u[40]),I=n(I,A,$,j,h,11,u[41]),j=n(j,I,A,$,x,16,u[42]),$=n($,j,I,A,_,23,u[43]),A=n(A,$,j,I,B,4,u[44]),I=n(I,A,$,j,D,11,u[45]),j=n(j,I,A,$,F,16,u[46]),$=n($,j,I,A,v,23,u[47]),A=i(A,$,j,I,h,6,u[48]),I=i(I,A,$,j,P,10,u[49]),j=i(j,I,A,$,E,15,u[50]),$=i($,j,I,A,S,21,u[51]),A=i(A,$,j,I,D,6,u[52]),I=i(I,A,$,j,x,10,u[53]),j=i(j,I,A,$,N,15,u[54]),$=i($,j,I,A,g,21,u[55]),A=i(A,$,j,I,C,6,u[56]),I=i(I,A,$,j,F,10,u[57]),j=i(j,I,A,$,_,15,u[58]),$=i($,j,I,A,R,21,u[59]),A=i(A,$,j,I,b,6,u[60]),I=i(I,A,$,j,T,10,u[61]),j=i(j,I,A,$,v,15,u[62]),$=i($,j,I,A,B,21,u[63]);p[0]=p[0]+A|0,p[1]=p[1]+$|0,p[2]=p[2]+j|0,p[3]=p[3]+I|0},_doFinalize:function(){var f=this._data,d=f.words,p=8*this._nDataBytes,h=8*f.sigBytes;d[h>>>5]|=128<<24-h%32;var g=t.floor(p/4294967296);for(d[(h+64>>>9<<4)+15]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,d[(h+64>>>9<<4)+14]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,f.sigBytes=4*(d.length+1),this._process(),f=this._hash,d=f.words,p=0;4>p;p++)h=d[p],d[p]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360;return f},clone:function(){var f=o.clone.call(this);return f._hash=this._hash.clone(),f}}),s.MD5=o._createHelper(c),s.HmacMD5=o._createHmacHelper(c)})(Math);(function(){var t=$e,i=t.lib,e=i.WordArray,r=i.Hasher,n=[],i=t.algo.SHA1=r.extend({_doReset:function(){this._hash=new e.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(s,a){for(var o=this._hash.words,c=o[0],u=o[1],l=o[2],f=o[3],d=o[4],p=0;80>p;p++){if(16>p)n[p]=s[a+p]|0;else{var h=n[p-3]^n[p-8]^n[p-14]^n[p-16];n[p]=h<<1|h>>>31}h=(c<<5|c>>>27)+d+n[p],h=20>p?h+((u&l|~u&f)+1518500249):40>p?h+((u^l^f)+1859775393):60>p?h+((u&l|u&f|l&f)-1894007588):h+((u^l^f)-899497514),d=f,f=l,l=u<<30|u>>>2,u=c,c=h}o[0]=o[0]+c|0,o[1]=o[1]+u|0,o[2]=o[2]+l|0,o[3]=o[3]+f|0,o[4]=o[4]+d|0},_doFinalize:function(){var s=this._data,a=s.words,o=8*this._nDataBytes,c=8*s.sigBytes;return a[c>>>5]|=128<<24-c%32,a[(c+64>>>9<<4)+14]=Math.floor(o/4294967296),a[(c+64>>>9<<4)+15]=o,s.sigBytes=4*a.length,this._process(),this._hash},clone:function(){var s=r.clone.call(this);return s._hash=this._hash.clone(),s}});t.SHA1=r._createHelper(i),t.HmacSHA1=r._createHmacHelper(i)})();(function(t){for(var e=$e,p=e.lib,r=p.WordArray,n=p.Hasher,p=e.algo,i=[],s=[],a=function(g){return 4294967296*(g-(g|0))|0},o=2,c=0;64>c;){var u;e:{u=o;for(var l=t.sqrt(u),f=2;f<=l;f++)if(!(u%f)){u=!1;break e}u=!0}u&&(8>c&&(i[c]=a(t.pow(o,.5))),s[c]=a(t.pow(o,1/3)),c++),o++}var d=[],p=p.SHA256=n.extend({_doReset:function(){this._hash=new r.init(i.slice(0))},_doProcessBlock:function(h,g){for(var v=this._hash.words,x=v[0],b=v[1],S=v[2],_=v[3],P=v[4],C=v[5],B=v[6],N=v[7],T=0;64>T;T++){if(16>T)d[T]=h[g+T]|0;else{var D=d[T-15],R=d[T-2];d[T]=((D<<25|D>>>7)^(D<<14|D>>>18)^D>>>3)+d[T-7]+((R<<15|R>>>17)^(R<<13|R>>>19)^R>>>10)+d[T-16]}D=N+((P<<26|P>>>6)^(P<<21|P>>>11)^(P<<7|P>>>25))+(P&C^~P&B)+s[T]+d[T],R=((x<<30|x>>>2)^(x<<19|x>>>13)^(x<<10|x>>>22))+(x&b^x&S^b&S),N=B,B=C,C=P,P=_+D|0,_=S,S=b,b=x,x=D+R|0}v[0]=v[0]+x|0,v[1]=v[1]+b|0,v[2]=v[2]+S|0,v[3]=v[3]+_|0,v[4]=v[4]+P|0,v[5]=v[5]+C|0,v[6]=v[6]+B|0,v[7]=v[7]+N|0},_doFinalize:function(){var h=this._data,g=h.words,v=8*this._nDataBytes,x=8*h.sigBytes;return g[x>>>5]|=128<<24-x%32,g[(x+64>>>9<<4)+14]=t.floor(v/4294967296),g[(x+64>>>9<<4)+15]=v,h.sigBytes=4*g.length,this._process(),this._hash},clone:function(){var h=n.clone.call(this);return h._hash=this._hash.clone(),h}});e.SHA256=n._createHelper(p),e.HmacSHA256=n._createHmacHelper(p)})(Math);(function(){var t=$e,e=t.lib.WordArray,n=t.algo,r=n.SHA256,n=n.SHA224=r.extend({_doReset:function(){this._hash=new e.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var i=r._doFinalize.call(this);return i.sigBytes-=4,i}});t.SHA224=r._createHelper(n),t.HmacSHA224=r._createHmacHelper(n)})();(function(){function t(){return n.create.apply(n,arguments)}for(var e=$e,r=e.lib.Hasher,s=e.x64,n=s.Word,i=s.WordArray,s=e.algo,a=[t(1116352408,3609767458),t(1899447441,602891725),t(3049323471,3964484399),t(3921009573,2173295548),t(961987163,4081628472),t(1508970993,3053834265),t(2453635748,2937671579),t(2870763221,3664609560),t(3624381080,2734883394),t(310598401,1164996542),t(607225278,1323610764),t(1426881987,3590304994),t(1925078388,4068182383),t(2162078206,991336113),t(2614888103,633803317),t(3248222580,3479774868),t(3835390401,2666613458),t(4022224774,944711139),t(264347078,2341262773),t(604807628,2007800933),t(770255983,1495990901),t(1249150122,1856431235),t(1555081692,3175218132),t(1996064986,2198950837),t(2554220882,3999719339),t(2821834349,766784016),t(2952996808,2566594879),t(3210313671,3203337956),t(3336571891,1034457026),t(3584528711,2466948901),t(113926993,3758326383),t(338241895,168717936),t(666307205,1188179964),t(773529912,1546045734),t(1294757372,1522805485),t(1396182291,2643833823),t(1695183700,2343527390),t(1986661051,1014477480),t(2177026350,1206759142),t(2456956037,344077627),t(2730485921,1290863460),t(2820302411,3158454273),t(3259730800,3505952657),t(3345764771,106217008),t(3516065817,3606008344),t(3600352804,1432725776),t(4094571909,1467031594),t(275423344,851169720),t(430227734,3100823752),t(506948616,1363258195),t(659060556,3750685593),t(883997877,3785050280),t(958139571,3318307427),t(1322822218,3812723403),t(1537002063,2003034995),t(1747873779,3602036899),t(1955562222,1575990012),t(2024104815,1125592928),t(2227730452,2716904306),t(2361852424,442776044),t(2428436474,593698344),t(2756734187,3733110249),t(3204031479,2999351573),t(3329325298,3815920427),t(3391569614,3928383900),t(3515267271,566280711),t(3940187606,3454069534),t(4118630271,4000239992),t(116418474,1914138554),t(174292421,2731055270),t(289380356,3203993006),t(460393269,320620315),t(685471733,587496836),t(852142971,1086792851),t(1017036298,365543100),t(1126000580,2618297676),t(1288033470,3409855158),t(1501505948,4234509866),t(1607167915,987167468),t(1816402316,1246189591)],o=[],c=0;80>c;c++)o[c]=t();s=s.SHA512=r.extend({_doReset:function(){this._hash=new i.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(u,l){for(var b=this._hash.words,f=b[0],d=b[1],p=b[2],h=b[3],g=b[4],v=b[5],x=b[6],b=b[7],S=f.high,_=f.low,P=d.high,C=d.low,B=p.high,N=p.low,T=h.high,D=h.low,R=g.high,E=g.low,F=v.high,A=v.low,I=x.high,j=x.low,$=b.high,W=b.low,H=S,O=_,L=P,q=C,ee=B,X=N,ae=T,ve=D,de=R,pe=E,we=F,_e=A,Me=I,Fe=j,De=$,V=W,le=0;80>le;le++){var m=o[le];if(16>le)var ce=m.high=u[l+2*le]|0,Re=m.low=u[l+2*le+1]|0;else{var ce=o[le-15],Re=ce.high,xe=ce.low,ce=(Re>>>1|xe<<31)^(Re>>>8|xe<<24)^Re>>>7,xe=(xe>>>1|Re<<31)^(xe>>>8|Re<<24)^(xe>>>7|Re<<25),he=o[le-2],Re=he.high,be=he.low,he=(Re>>>19|be<<13)^(Re<<3|be>>>29)^Re>>>6,be=(be>>>19|Re<<13)^(be<<3|Re>>>29)^(be>>>6|Re<<26),Re=o[le-7],Y=Re.high,J=o[le-16],ge=J.high,J=J.low,Re=xe+Re.low,ce=ce+Y+(Re>>>0>>0?1:0),Re=Re+be,ce=ce+he+(Re>>>0>>0?1:0),Re=Re+J,ce=ce+ge+(Re>>>0>>0?1:0);m.high=ce,m.low=Re}var Y=de&we^~de&Me,J=pe&_e^~pe&Fe,m=H&L^H&ee^L&ee,ne=O&q^O&X^q&X,xe=(H>>>28|O<<4)^(H<<30|O>>>2)^(H<<25|O>>>7),he=(O>>>28|H<<4)^(O<<30|H>>>2)^(O<<25|H>>>7),be=a[le],re=be.high,ke=be.low,be=V+((pe>>>14|de<<18)^(pe>>>18|de<<14)^(pe<<23|de>>>9)),ge=De+((de>>>14|pe<<18)^(de>>>18|pe<<14)^(de<<23|pe>>>9))+(be>>>0>>0?1:0),be=be+J,ge=ge+Y+(be>>>0>>0?1:0),be=be+ke,ge=ge+re+(be>>>0>>0?1:0),be=be+Re,ge=ge+ce+(be>>>0>>0?1:0),Re=he+ne,m=xe+m+(Re>>>0>>0?1:0),De=Me,V=Fe,Me=we,Fe=_e,we=de,_e=pe,pe=ve+be|0,de=ae+ge+(pe>>>0>>0?1:0)|0,ae=ee,ve=X,ee=L,X=q,L=H,q=O,O=be+Re|0,H=ge+m+(O>>>0>>0?1:0)|0}_=f.low=_+O,f.high=S+H+(_>>>0>>0?1:0),C=d.low=C+q,d.high=P+L+(C>>>0>>0?1:0),N=p.low=N+X,p.high=B+ee+(N>>>0>>0?1:0),D=h.low=D+ve,h.high=T+ae+(D>>>0>>0?1:0),E=g.low=E+pe,g.high=R+de+(E>>>0>>0?1:0),A=v.low=A+_e,v.high=F+we+(A>>>0<_e>>>0?1:0),j=x.low=j+Fe,x.high=I+Me+(j>>>0>>0?1:0),W=b.low=W+V,b.high=$+De+(W>>>0>>0?1:0)},_doFinalize:function(){var u=this._data,l=u.words,f=8*this._nDataBytes,d=8*u.sigBytes;return l[d>>>5]|=128<<24-d%32,l[(d+128>>>10<<5)+30]=Math.floor(f/4294967296),l[(d+128>>>10<<5)+31]=f,u.sigBytes=4*l.length,this._process(),this._hash.toX32()},clone:function(){var u=r.clone.call(this);return u._hash=this._hash.clone(),u},blockSize:32}),e.SHA512=r._createHelper(s),e.HmacSHA512=r._createHmacHelper(s)})();(function(){var t=$e,i=t.x64,e=i.Word,r=i.WordArray,i=t.algo,n=i.SHA512,i=i.SHA384=n.extend({_doReset:function(){this._hash=new r.init([new e.init(3418070365,3238371032),new e.init(1654270250,914150663),new e.init(2438529370,812702999),new e.init(355462360,4144912697),new e.init(1731405415,4290775857),new e.init(2394180231,1750603025),new e.init(3675008525,1694076839),new e.init(1203062813,3204075428)])},_doFinalize:function(){var s=n._doFinalize.call(this);return s.sigBytes-=16,s}});t.SHA384=n._createHelper(i),t.HmacSHA384=n._createHmacHelper(i)})();(function(){var t=$e,u=t.lib,e=u.WordArray,r=u.Hasher,u=t.algo,n=e.create([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]),i=e.create([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]),s=e.create([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]),a=e.create([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]),o=e.create([0,1518500249,1859775393,2400959708,2840853838]),c=e.create([1352829926,1548603684,1836072691,2053994217,0]),u=u.RIPEMD160=r.extend({_doReset:function(){this._hash=e.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(l,f){for(var d=0;16>d;d++){var p=f+d,h=l[p];l[p]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360}var p=this._hash.words,h=o.words,g=c.words,v=n.words,x=i.words,b=s.words,S=a.words,_,P,C,B,N,T,D,R,E,F;T=_=p[0],D=P=p[1],R=C=p[2],E=B=p[3],F=N=p[4];for(var A,d=0;80>d;d+=1)A=_+l[f+v[d]]|0,A=16>d?A+((P^C^B)+h[0]):32>d?A+((P&C|~P&B)+h[1]):48>d?A+(((P|~C)^B)+h[2]):64>d?A+((P&B|C&~B)+h[3]):A+((P^(C|~B))+h[4]),A|=0,A=A<>>32-b[d],A=A+N|0,_=N,N=B,B=C<<10|C>>>22,C=P,P=A,A=T+l[f+x[d]]|0,A=16>d?A+((D^(R|~E))+g[0]):32>d?A+((D&E|R&~E)+g[1]):48>d?A+(((D|~R)^E)+g[2]):64>d?A+((D&R|~D&E)+g[3]):A+((D^R^E)+g[4]),A|=0,A=A<>>32-S[d],A=A+F|0,T=F,F=E,E=R<<10|R>>>22,R=D,D=A;A=p[1]+C+E|0,p[1]=p[2]+B+F|0,p[2]=p[3]+N+T|0,p[3]=p[4]+_+D|0,p[4]=p[0]+P+R|0,p[0]=A},_doFinalize:function(){var l=this._data,f=l.words,d=8*this._nDataBytes,p=8*l.sigBytes;for(f[p>>>5]|=128<<24-p%32,f[(p+64>>>9<<4)+14]=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360,l.sigBytes=4*(f.length+1),this._process(),l=this._hash,f=l.words,d=0;5>d;d++)p=f[d],f[d]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360;return l},clone:function(){var l=r.clone.call(this);return l._hash=this._hash.clone(),l}});t.RIPEMD160=r._createHelper(u),t.HmacRIPEMD160=r._createHmacHelper(u)})();(function(){var t=$e,e=t.enc.Utf8;t.algo.HMAC=t.lib.Base.extend({init:function(r,n){r=this._hasher=new r.init,typeof n=="string"&&(n=e.parse(n));var i=r.blockSize,s=4*i;n.sigBytes>s&&(n=r.finalize(n)),n.clamp();for(var a=this._oKey=n.clone(),o=this._iKey=n.clone(),c=a.words,u=o.words,l=0;l>6)+bf.charAt(r&63);for(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),n+=bf.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),n+=bf.charAt(r>>2)+bf.charAt((r&3)<<4));(n.length&3)>0;)n+=UF;return n}function L5(t){var e="",r,n=0,i,s;for(r=0;r>2),i=s&3,n=1):n==1?(e+=Ga(i<<2|s>>4),i=s&15,n=2):n==2?(e+=Ga(i),e+=Ga(s>>2),i=s&3,n=3):(e+=Ga(i<<2|s>>4),e+=Ga(s&15),n=0));return n==1&&(e+=Ga(i<<2)),e}/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ +*/var Jc;function oe(t,e,r){t!=null&&(typeof t=="number"?this.fromNumber(t,e,r):e==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,e))}function Ct(){return new oe(null)}function PW(t,e,r,n,i,s){for(;--s>=0;){var a=e*this[t++]+r[n]+i;i=Math.floor(a/67108864),r[n++]=a&67108863}return i}function TW(t,e,r,n,i,s){for(var a=e&32767,o=e>>15;--s>=0;){var c=this[t]&32767,u=this[t++]>>15,l=o*c+u*a;c=a*c+((l&32767)<<15)+r[n]+(i&1073741823),i=(c>>>30)+(l>>>15)+o*u+(i>>>30),r[n++]=c&1073741823}return i}function NW(t,e,r,n,i,s){for(var a=e&16383,o=e>>14;--s>=0;){var c=this[t]&16383,u=this[t++]>>14,l=o*c+u*a;c=a*c+((l&16383)<<14)+r[n]+i,i=(c>>28)+(l>>14)+o*u,r[n++]=c&268435455}return i}Rp.appName=="Microsoft Internet Explorer"?(oe.prototype.am=TW,Jc=30):Rp.appName!="Netscape"?(oe.prototype.am=PW,Jc=26):(oe.prototype.am=NW,Jc=28);oe.prototype.DB=Jc;oe.prototype.DM=(1<=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function OW(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0}function $c(t){var e=Ct();return e.fromInt(t),e}function MW(t,e){var r;if(e==16)r=4;else if(e==8)r=3;else if(e==256)r=8;else if(e==2)r=1;else if(e==32)r=5;else if(e==4)r=2;else{this.fromRadix(t,e);return}this.t=0,this.s=0;for(var n=t.length,i=!1,s=0;--n>=0;){var a=r==8?t[n]&255:$F(t,n);if(a<0){t.charAt(n)=="-"&&(i=!0);continue}i=!1,s==0?this[this.t++]=a:s+r>this.DB?(this[this.t-1]|=(a&(1<>this.DB-s):this[this.t-1]|=a<=this.DB&&(s-=this.DB)}r==8&&t[0]&128&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t}function jW(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(t==16)e=4;else if(t==8)e=3;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else return this.toRadix(t);var r=(1<0)for(o>o)>0&&(i=!0,s=Ga(n));a>=0;)o>(o+=this.DB-e)):(n=this[a]>>(o-=e)&r,o<=0&&(o+=this.DB,--a)),n>0&&(i=!0),i&&(s+=Ga(n));return i?s:"0"}function UW(){var t=Ct();return oe.ZERO.subTo(this,t),t}function $W(){return this.s<0?this.negate():this}function zW(t){var e=this.s-t.s;if(e!=0)return e;var r=this.t;if(e=r-t.t,e!=0)return this.s<0?-e:e;for(;--r>=0;)if((e=this[r]-t[r])!=0)return e;return 0}function o2(t){var e=1,r;return(r=t>>>16)!=0&&(t=r,e+=16),(r=t>>8)!=0&&(t=r,e+=8),(r=t>>4)!=0&&(t=r,e+=4),(r=t>>2)!=0&&(t=r,e+=2),(r=t>>1)!=0&&(t=r,e+=1),e}function HW(){return this.t<=0?0:this.DB*(this.t-1)+o2(this[this.t-1]^this.s&this.DM)}function VW(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s}function qW(t,e){for(var r=t;r=0;--o)e[o+s+1]=this[o]>>n|a,a=(this[o]&i)<=0;--o)e[o]=0;e[s]=a,e.t=this.t+s+1,e.s=this.s,e.clamp()}function WW(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t){e.t=0;return}var n=t%this.DB,i=this.DB-n,s=(1<>n;for(var a=r+1;a>n;n>0&&(e[this.t-r-1]|=(this.s&s)<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[r++]=this.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()}function ZW(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e[i]=0;for(i=0;i=0;)t[r]=0;for(r=0;r=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()}function XW(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(c,s),i.lShiftTo(c,r)):(n.copyTo(s),i.copyTo(r));var u=s.t,l=s[u-1];if(l!=0){var f=l*(1<1?s[u-2]>>this.F2:0),d=this.FV/f,p=(1<=0&&(r[r.t++]=1,r.subTo(x,r)),oe.ONE.dlShiftTo(u,x),x.subTo(s,s);s.t=0;){var b=r[--g]==l?this.DM:Math.floor(r[g]*d+(r[g-1]+h)*p);if((r[g]+=s.am(0,b,r,v,0,u))0&&r.rShiftTo(c,r),a<0&&oe.ZERO.subTo(r,r)}}}function QW(t){var e=Ct();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(oe.ZERO)>0&&t.subTo(e,e),e}function Gl(t){this.m=t}function YW(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function eG(t){return t}function tG(t){t.divRemTo(this.m,null,t)}function rG(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function nG(t,e){t.squareTo(e),this.reduce(e)}Gl.prototype.convert=YW;Gl.prototype.revert=eG;Gl.prototype.reduce=tG;Gl.prototype.mulTo=rG;Gl.prototype.sqrTo=nG;function iG(){if(this.t<1)return 0;var t=this[0];if(!(t&1))return 0;var e=t&3;return e=e*(2-(t&15)*e)&15,e=e*(2-(t&255)*e)&255,e=e*(2-((t&65535)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}function Zl(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e}function aG(t){var e=Ct();return t.copyTo(e),this.reduce(e),e}function oG(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t[r]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function cG(t,e){t.squareTo(e),this.reduce(e)}function uG(t,e,r){t.multiplyTo(e,r),this.reduce(r)}Zl.prototype.convert=sG;Zl.prototype.revert=aG;Zl.prototype.reduce=oG;Zl.prototype.mulTo=uG;Zl.prototype.sqrTo=cG;function lG(){return(this.t>0?this[0]&1:this.s)==0}function fG(t,e){if(t>4294967295||t<1)return oe.ONE;var r=Ct(),n=Ct(),i=e.convert(this),s=o2(t)-1;for(i.copyTo(r);--s>=0;)if(e.sqrTo(r,n),(t&1<0)e.mulTo(n,i,r);else{var a=r;r=n,n=a}return e.revert(r)}function dG(t,e){var r;return t<256||e.isEven()?r=new Gl(e):r=new Zl(e),this.exp(t,r)}oe.prototype.copyTo=DW;oe.prototype.fromInt=OW;oe.prototype.fromString=MW;oe.prototype.clamp=LW;oe.prototype.dlShiftTo=VW;oe.prototype.drShiftTo=qW;oe.prototype.lShiftTo=KW;oe.prototype.rShiftTo=WW;oe.prototype.subTo=GW;oe.prototype.multiplyTo=ZW;oe.prototype.squareTo=JW;oe.prototype.divRemTo=XW;oe.prototype.invDigit=iG;oe.prototype.isEven=lG;oe.prototype.exp=fG;oe.prototype.toString=jW;oe.prototype.negate=UW;oe.prototype.abs=$W;oe.prototype.compareTo=zW;oe.prototype.bitLength=HW;oe.prototype.mod=QW;oe.prototype.modPowInt=dG;oe.ZERO=$c(0);oe.ONE=$c(1);/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ + */function hG(){var t=Ct();return this.copyTo(t),t}function pG(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function mG(){return this.t==0?this.s:this[0]<<16>>16}function vG(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function yG(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function xG(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=$c(r),i=Ct(),s=Ct(),a="";for(this.divRemTo(n,i,s);i.signum()>0;)a=(r+s.intValue()).toString(t).substr(1)+a,i.divRemTo(n,i,s);return s.intValue().toString(t)+a}function bG(t,e){this.fromInt(0),e==null&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,s=0,a=0,o=0;o=r&&(this.dMultiply(n),this.dAddOffset(a,0),s=0,a=0)}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(a,0)),i&&oe.ZERO.subTo(this,this)}function wG(t,e,r){if(typeof e=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(oe.ONE.shiftLeft(t-1),U5,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(oe.ONE.shiftLeft(t-1),this);else{var n=new Array,i=t&7;n.length=(t>>3)+1,e.nextBytes(n),i>0?n[0]&=(1<0)for(r>r)!=(this.s&this.DM)>>r&&(e[i++]=n|this.s<=0;)r<8?(n=(this[t]&(1<>(r+=this.DB-8)):(n=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),n&128&&(n|=-256),i==0&&(this.s&128)!=(n&128)&&++i,(i>0||n!=this.s)&&(e[i++]=n);return e}function SG(t){return this.compareTo(t)==0}function AG(t){return this.compareTo(t)<0?this:t}function CG(t){return this.compareTo(t)>0?this:t}function _G(t,e,r){var n,i,s=Math.min(t.t,this.t);for(n=0;n>=16,e+=16),t&255||(t>>=8,e+=8),t&15||(t>>=4,e+=4),t&3||(t>>=2,e+=2),t&1||++e,e}function OG(){for(var t=0;t=this.t?this.s!=0:(this[e]&1<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[r++]=n:n<-1&&(e[r++]=this.DV+n),e.t=r,e.clamp()}function qG(t){var e=Ct();return this.addTo(t,e),e}function KG(t){var e=Ct();return this.subTo(t,e),e}function WG(t){var e=Ct();return this.multiplyTo(t,e),e}function GG(){var t=Ct();return this.squareTo(t),t}function ZG(t){var e=Ct();return this.divRemTo(t,e,null),e}function JG(t){var e=Ct();return this.divRemTo(t,null,e),e}function XG(t){var e=Ct(),r=Ct();return this.divRemTo(t,e,r),new Array(e,r)}function QG(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function YG(t,e){if(t!=0){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}function Wg(){}function VF(t){return t}function eZ(t,e,r){t.multiplyTo(e,r)}function tZ(t,e){t.squareTo(e)}Wg.prototype.convert=VF;Wg.prototype.revert=VF;Wg.prototype.mulTo=eZ;Wg.prototype.sqrTo=tZ;function rZ(t){return this.exp(t,new Wg)}function nZ(t,e,r){var n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r[--n]=0;var i;for(i=r.t-this.t;n=0;)r[n]=0;for(n=Math.max(e-this.t,0);n2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=Ct();return t.copyTo(e),this.reduce(e),e}function aZ(t){return t}function oZ(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function cZ(t,e){t.squareTo(e),this.reduce(e)}function uZ(t,e,r){t.multiplyTo(e,r),this.reduce(r)}Xh.prototype.convert=sZ;Xh.prototype.revert=aZ;Xh.prototype.reduce=oZ;Xh.prototype.mulTo=uZ;Xh.prototype.sqrTo=cZ;function lZ(t,e){var r=t.bitLength(),n,i=$c(1),s;if(r<=0)return i;r<18?n=1:r<48?n=3:r<144?n=4:r<768?n=5:n=6,r<8?s=new Gl(e):e.isEven()?s=new Xh(e):s=new Zl(e);var a=new Array,o=3,c=n-1,u=(1<1){var l=Ct();for(s.sqrTo(a[1],l);o<=u;)a[o]=Ct(),s.mulTo(l,a[o-2],a[o]),o+=2}var f=t.t-1,d,p=!0,h=Ct(),g;for(r=o2(t[f])-1;f>=0;){for(r>=c?d=t[f]>>r-c&u:(d=(t[f]&(1<0&&(d|=t[f-1]>>this.DB+r-c)),o=n;!(d&1);)d>>=1,--o;if((r-=o)<0&&(r+=this.DB,--f),p)a[d].copyTo(i),p=!1;else{for(;o>1;)s.sqrTo(i,h),s.sqrTo(h,i),o-=2;o>0?s.sqrTo(i,h):(g=i,i=h,h=g),s.mulTo(h,a[d],i)}for(;f>=0&&!(t[f]&1<0&&(e.rShiftTo(s,e),r.rShiftTo(s,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r}function dZ(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(e==0)r=this[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this[n])%t;return r}function hZ(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return oe.ZERO;for(var r=t.clone(),n=this.clone(),i=$c(1),s=$c(0),a=$c(0),o=$c(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),e?((!i.isEven()||!s.isEven())&&(i.addTo(this,i),s.subTo(t,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),e?((!a.isEven()||!o.isEven())&&(a.addTo(this,a),o.subTo(t,o)),a.rShiftTo(1,a)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(a,i),s.subTo(o,s)):(n.subTo(r,n),e&&a.subTo(i,a),o.subTo(s,o))}if(n.compareTo(oe.ONE)!=0)return oe.ZERO;if(o.compareTo(t)>=0)return o.subtract(t);if(o.signum()<0)o.addTo(t,o);else return o;return o.signum()<0?o.add(t):o}var Nn=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],pZ=(1<<26)/Nn[Nn.length-1];function gZ(t){var e,r=this.abs();if(r.t==1&&r[0]<=Nn[Nn.length-1]){for(e=0;e>1,t>Nn.length&&(t=Nn.length);for(var i=Ct(),s=0;s>8&255,Ai[Jr++]^=t>>16&255,Ai[Jr++]^=t>>24&255,Jr>=z4&&(Jr-=z4)}function qF(){bZ(new Date().getTime())}if(Ai==null){Ai=new Array,Jr=0;var xs;if(cf!==void 0&&(cf.crypto!==void 0||cf.msCrypto!==void 0)){var SA=cf.crypto||cf.msCrypto;if(SA.getRandomValues){var AA=new Uint8Array(32);for(SA.getRandomValues(AA),xs=0;xs<32;++xs)Ai[Jr++]=AA[xs]}else if(Rp.appName=="Netscape"&&Rp.appVersion<"5"){var CA=cf.crypto.random(32);for(xs=0;xs>>8,Ai[Jr++]=xs&255;Jr=0,qF()}function wZ(){if(B1==null){for(qF(),B1=xZ(),B1.init(Ai),Jr=0;Jr=0&&e>0;){var i=t.charCodeAt(n--);i<128?r[--e]=i:i>127&&i<2048?(r[--e]=i&63|128,r[--e]=i>>6|192):(r[--e]=i&63|128,r[--e]=i>>6&63|128,r[--e]=i>>12|224)}r[--e]=0;for(var s=new Jl,a=new Array;e>2;){for(a[0]=0;a[0]==0;)s.nextBytes(a);r[--e]=a[0]}return r[--e]=2,r[--e]=0,new oe(r)}function _A(t,e,r){for(var n="",i=0;n.length>24,(i&16711680)>>16,(i&65280)>>8,i&255]))),i+=1;return n}function AZ(t,e,r,n){var i=k.crypto.MessageDigest,s=k.crypto.Util,a=null;if(r||(r="sha1"),typeof r=="string"&&(a=i.getCanonicalAlgName(r),n=i.getHashLength(a),r=function(g){return is(s.hashHex(Ws(g),a))}),t.length+2*n+2>e)throw"Message too long for RSA";var o="",c;for(c=0;c0&&e.length>0)this.n=En(t,16),this.e=parseInt(e,16);else throw"Invalid RSA public key"}function _Z(t){return t.modPowInt(this.e,this.n)}function kZ(t){var e=SZ(t,this.n.bitLength()+7>>3);if(e==null)return null;var r=this.doPublic(e);if(r==null)return null;var n=r.toString(16);return n.length&1?"0"+n:n}function BZ(t,e,r){var n=this.n.bitLength()+7>>3,i=AZ(t,n,e,r);if(i==null)return null;var s=this.doPublic(i);if(s==null)return null;for(var a=s.toString(16);a.length=r.length)return null;for(var i="";++n191&&s<224?(i+=String.fromCharCode((s&31)<<6|r[n+1]&63),++n):(i+=String.fromCharCode((s&15)<<12|(r[n+1]&63)<<6|r[n+2]&63),n+=2)}return i}function kA(t,e,r){for(var n="",i=0;n.length>24,(i&16711680)>>16,(i&65280)>>8,i&255])),i+=1;return n}function FZ(t,e,r,n){var i=k.crypto.MessageDigest,s=k.crypto.Util,a=null;r||(r="sha1"),typeof r=="string"&&(a=i.getCanonicalAlgName(r),n=i.getHashLength(a),r=function(v){return is(s.hashHex(Ws(v),a))}),t=t.toByteArray();var f;for(f=0;f0&&e.length>0)this.n=En(t,16),this.e=parseInt(e,16),this.d=En(r,16);else throw"Invalid RSA private key"}function TZ(t,e,r,n,i,s,a,o){if(this.isPrivate=!0,this.isPublic=!1,t==null)throw"RSASetPrivateEx N == null";if(e==null)throw"RSASetPrivateEx E == null";if(t.length==0)throw"RSASetPrivateEx N.length == 0";if(e.length==0)throw"RSASetPrivateEx E.length == 0";if(t!=null&&e!=null&&t.length>0&&e.length>0)this.n=En(t,16),this.e=parseInt(e,16),this.d=En(r,16),this.p=En(n,16),this.q=En(i,16),this.dmp1=En(s,16),this.dmq1=En(a,16),this.coeff=En(o,16);else throw"Invalid RSA private key in RSASetPrivateEx"}function NZ(t,e){var r=new Jl,n=t>>1;this.e=parseInt(e,16);for(var i=new oe(e,16),s=t/2-100,a=oe.ONE.shiftLeft(s);;){for(;this.p=new oe(t-n,1,r),!(this.p.subtract(oe.ONE).gcd(i).compareTo(oe.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new oe(n,1,r),!(this.q.subtract(oe.ONE).gcd(i).compareTo(oe.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var c=this.q.subtract(this.p).abs();if(!(c.bitLength()>3)}function OZ(t,e,r){if(t.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var n=En(t,16),i=this.doPrivate(n);return i==null?null:FZ(i,this.n.bitLength()+7>>3,e,r)}at.prototype.doPrivate=RZ;at.prototype.setPrivate=PZ;at.prototype.setPrivateEx=TZ;at.prototype.generate=NZ;at.prototype.decrypt=DZ;at.prototype.decryptOAEP=OZ;/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ + */function nn(t,e){this.x=e,this.q=t}function MZ(t){return t==this?!0:this.q.equals(t.q)&&this.x.equals(t.x)}function LZ(){return this.x}function jZ(){return new nn(this.q,this.x.negate().mod(this.q))}function UZ(t){return new nn(this.q,this.x.add(t.toBigInteger()).mod(this.q))}function $Z(t){return new nn(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))}function zZ(t){return new nn(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))}function HZ(){return new nn(this.q,this.x.square().mod(this.q))}function VZ(t){return new nn(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))}nn.prototype.equals=MZ;nn.prototype.toBigInteger=LZ;nn.prototype.negate=jZ;nn.prototype.add=UZ;nn.prototype.subtract=$Z;nn.prototype.multiply=zZ;nn.prototype.square=HZ;nn.prototype.divide=VZ;nn.prototype.sqrt=function(){return new nn(this.q,this.x.sqrt().mod(this.q))};function Ut(t,e,r,n){this.curve=t,this.x=e,this.y=r,n==null?this.z=oe.ONE:this.z=n,this.zinv=null}function qZ(){return this.zinv==null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function KZ(){return this.zinv==null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function WZ(t){if(t==this)return!0;if(this.isInfinity())return t.isInfinity();if(t.isInfinity())return this.isInfinity();var e,r;return e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),e.equals(oe.ZERO)?(r=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q),r.equals(oe.ZERO)):!1}function GZ(){return this.x==null&&this.y==null?!0:this.z.equals(oe.ZERO)&&!this.y.toBigInteger().equals(oe.ZERO)}function ZZ(){return new Ut(this.curve,this.x,this.y.negate(),this.z)}function JZ(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),r=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q);if(oe.ZERO.equals(r))return oe.ZERO.equals(e)?this.twice():this.curve.getInfinity();var n=new oe("3"),i=this.x.toBigInteger(),s=this.y.toBigInteger();t.x.toBigInteger(),t.y.toBigInteger();var a=r.square(),o=a.multiply(r),c=i.multiply(a),u=e.square().multiply(this.z),l=u.subtract(c.shiftLeft(1)).multiply(t.z).subtract(o).multiply(r).mod(this.curve.q),f=c.multiply(n).multiply(e).subtract(s.multiply(o)).subtract(u.multiply(e)).multiply(t.z).add(e.multiply(o)).mod(this.curve.q),d=o.multiply(this.z).multiply(t.z).mod(this.curve.q);return new Ut(this.curve,this.curve.fromBigInteger(l),this.curve.fromBigInteger(f),d)}function XZ(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var t=new oe("3"),e=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),i=n.multiply(r).mod(this.curve.q),s=this.curve.a.toBigInteger(),a=e.square().multiply(t);oe.ZERO.equals(s)||(a=a.add(this.z.square().multiply(s))),a=a.mod(this.curve.q);var o=a.square().subtract(e.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(n).mod(this.curve.q),c=a.multiply(t).multiply(e).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(a.square().multiply(a)).mod(this.curve.q),u=n.square().multiply(n).shiftLeft(3).mod(this.curve.q);return new Ut(this.curve,this.curve.fromBigInteger(o),this.curve.fromBigInteger(c),u)}function QZ(t){if(this.isInfinity())return this;if(t.signum()==0)return this.curve.getInfinity();var e=t,r=e.multiply(new oe("3")),n=this.negate(),i=this,s=this.curve.q.subtract(t),a=s.multiply(new oe("3")),o=new Ut(this.curve,this.x,this.y),c=o.negate(),u;for(u=r.bitLength()-2;u>0;--u){i=i.twice();var l=r.testBit(u),f=e.testBit(u);l!=f&&(i=i.add(l?this:n))}for(u=a.bitLength()-2;u>0;--u){o=o.twice();var d=a.testBit(u),p=s.testBit(u);d!=p&&(o=o.add(d?o:c))}return i}function YZ(t,e,r){var n;t.bitLength()>r.bitLength()?n=t.bitLength()-1:n=r.bitLength()-1;for(var i=this.curve.getInfinity(),s=this.add(e);n>=0;)i=i.twice(),t.testBit(n)?r.testBit(n)?i=i.add(s):i=i.add(this):r.testBit(n)&&(i=i.add(e)),--n;return i}Ut.prototype.getX=qZ;Ut.prototype.getY=KZ;Ut.prototype.equals=WZ;Ut.prototype.isInfinity=GZ;Ut.prototype.negate=ZZ;Ut.prototype.add=JZ;Ut.prototype.twice=XZ;Ut.prototype.multiply=QZ;Ut.prototype.multiplyTwo=YZ;function yu(t,e,r){this.q=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(r),this.infinity=new Ut(this,null,null)}function eJ(){return this.q}function tJ(){return this.a}function rJ(){return this.b}function nJ(t){return t==this?!0:this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)}function iJ(){return this.infinity}function sJ(t){return new nn(this.q,t)}function aJ(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:var e=t.substr(0,2);t.substr(2);var r=this.fromBigInteger(new oe(c,16)),n=this.getA(),i=this.getB(),s=r.square().add(n).multiply(r).add(i),a=s.sqrt();return e=="03"&&(a=a.negate()),new Ut(this,r,a);case 4:case 6:case 7:var o=(t.length-2)/2,c=t.substr(2,o),u=t.substr(o+2,o);return new Ut(this,this.fromBigInteger(new oe(c,16)),this.fromBigInteger(new oe(u,16)));default:return null}}yu.prototype.getQ=eJ;yu.prototype.getA=tJ;yu.prototype.getB=rJ;yu.prototype.equals=nJ;yu.prototype.getInfinity=iJ;yu.prototype.fromBigInteger=sJ;yu.prototype.decodePointHex=aJ;/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib + */nn.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};Ut.prototype.getEncoded=function(t){var e=function(s,a){var o=s.toByteArrayUnsigned();if(ao.length;)o.unshift(0);return o},r=this.getX().toBigInteger(),n=this.getY().toBigInteger(),i=e(r,32);return t?n.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(e(n,32))),i};Ut.decodeFrom=function(t,e){e[0];var r=e.length-1,n=e.slice(1,1+r/2),i=e.slice(1+r/2,1+r);n.unshift(0),i.unshift(0);var s=new oe(n),a=new oe(i);return new Ut(t,t.fromBigInteger(s),t.fromBigInteger(a))};Ut.decodeFromHex=function(t,e){e.substr(0,2);var r=e.length-2,n=e.substr(2,r/2),i=e.substr(2+r/2,r/2),s=new oe(n,16),a=new oe(i,16);return new Ut(t,t.fromBigInteger(s),t.fromBigInteger(a))};Ut.prototype.add2D=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;if(this.x.equals(t.x))return this.y.equals(t.y)?this.twice():this.curve.getInfinity();var e=t.x.subtract(this.x),r=t.y.subtract(this.y),n=r.divide(e),i=n.square().subtract(this.x).subtract(t.x),s=n.multiply(this.x.subtract(i)).subtract(this.y);return new Ut(this.curve,i,s)};Ut.prototype.twice2D=function(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var t=this.curve.fromBigInteger(oe.valueOf(2)),e=this.curve.fromBigInteger(oe.valueOf(3)),r=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(t)),n=r.square().subtract(this.x.multiply(t)),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new Ut(this.curve,n,i)};Ut.prototype.multiply2D=function(t){if(this.isInfinity())return this;if(t.signum()==0)return this.curve.getInfinity();var e=t,r=e.multiply(new oe("3")),n=this.negate(),i=this,s;for(s=r.bitLength()-2;s>0;--s){i=i.twice();var a=r.testBit(s),o=e.testBit(s);a!=o&&(i=i.add2D(a?this:n))}return i};Ut.prototype.isOnCurve=function(){var t=this.getX().toBigInteger(),e=this.getY().toBigInteger(),r=this.curve.getA().toBigInteger(),n=this.curve.getB().toBigInteger(),i=this.curve.getQ(),s=e.multiply(e).mod(i),a=t.multiply(t).multiply(t).add(r.multiply(t)).add(n).mod(i);return s.equals(a)};Ut.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};Ut.prototype.validate=function(){var t=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var e=this.getX().toBigInteger(),r=this.getY().toBigInteger();if(e.compareTo(oe.ONE)<0||e.compareTo(t.subtract(oe.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(oe.ONE)<0||r.compareTo(t.subtract(oe.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(t).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval + */var KF=function(){var t="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)",e='(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))',r='(?:"'+e+'*")',n=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+t+"|"+r+")","g"),i=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),s={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:` +`,r:"\r",t:" "};function a(l,f,d){return f?s[f]:String.fromCharCode(parseInt(d,16))}var o=new String(""),c="\\",u=Object.hasOwnProperty;return function(l,f){var d=l.match(n),p,h=d[0],g=!1;h==="{"?p={}:h==="["?p=[]:(p=[],g=!0);for(var v,x=[p],b=1-g,S=d.length;b=0;)delete N[T[E]]}return f.call(C,B,N)};p=P({"":p},"")}return p}}();(typeof k>"u"||!k)&&(k={});(typeof k.asn1>"u"||!k.asn1)&&(k.asn1={});k.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){return c2(t)},this.getPEMStringFromHex=function(t,e){return Dn(t,e)},this.newObject=function(t){var e=k,r=e.asn1,n=r.ASN1Object,i=r.DERBoolean,s=r.DERInteger,a=r.DERBitString,o=r.DEROctetString,c=r.DERNull,u=r.DERObjectIdentifier,l=r.DEREnumerated,f=r.DERUTF8String,d=r.DERNumericString,p=r.DERPrintableString,h=r.DERTeletexString,g=r.DERIA5String,v=r.DERUTCTime,x=r.DERGeneralizedTime,b=r.DERVisibleString,S=r.DERBMPString,_=r.DERSequence,P=r.DERSet,C=r.DERTaggedObject,B=r.ASN1Util.newObject;if(t instanceof r.ASN1Object)return t;var N=Object.keys(t);if(N.length!=1)throw new Error("key of param shall be only one.");var T=N[0];if(":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+T+":")==-1)throw new Error("undefined key: "+T);if(T=="bool")return new i(t[T]);if(T=="int")return new s(t[T]);if(T=="bitstr")return new a(t[T]);if(T=="octstr")return new o(t[T]);if(T=="null")return new c(t[T]);if(T=="oid")return new u(t[T]);if(T=="enum")return new l(t[T]);if(T=="utf8str")return new f(t[T]);if(T=="numstr")return new d(t[T]);if(T=="prnstr")return new p(t[T]);if(T=="telstr")return new h(t[T]);if(T=="ia5str")return new g(t[T]);if(T=="utctime")return new v(t[T]);if(T=="gentime")return new x(t[T]);if(T=="visstr")return new b(t[T]);if(T=="bmpstr")return new S(t[T]);if(T=="asn1")return new n(t[T]);if(T=="seq"){for(var D=t[T],R=[],E=0;E"u"||this.hV==null)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n="+e.length+",v="+this.hV);var r=this.hV.length/2,n=r.toString(16);if(n.length%2==1&&(n="0"+n),r<128)return n;var i=n.length/2;if(i>15)throw new Error("ASN.1 length too long to represent by 8x: n = "+r.toString(16));var s=128+i;return s.toString(16)+n},this.tohex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.getValueHex=function(){return this.tohex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(r){this.params=r},t!=null&&t.tlv!=null&&(this.hTLV=t.tlv,this.isModified=!1)};k.asn1.DERAbstractString=function(t){k.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=V5(this.s).toLowerCase()},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},typeof t<"u"&&(typeof t=="string"?this.setString(t):typeof t.str<"u"?this.setString(t.str):typeof t.hex<"u"&&this.setStringHex(t.hex))};Ce(k.asn1.DERAbstractString,k.asn1.ASN1Object);k.asn1.DERAbstractTime=function(t){k.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(e){var r=e.getTime()+e.getTimezoneOffset()*6e4,n=new Date(r);return n},this.formatDate=function(e,r,n){var i=this.zeroPadding,s=this.localDateToUTC(e),a=String(s.getFullYear());r=="utc"&&(a=a.substr(2,2));var o=i(String(s.getMonth()+1),2),c=i(String(s.getDate()),2),u=i(String(s.getHours()),2),l=i(String(s.getMinutes()),2),f=i(String(s.getSeconds()),2),d=a+o+c+u+l+f;if(n===!0){var p=s.getMilliseconds();if(p!=0){var h=i(String(p),3);h=h.replace(/[0]+$/,""),d=d+"."+h}}return d+"Z"},this.zeroPadding=function(e,r){return e.length>=r?e:new Array(r-e.length+1).join("0")+e},this.setByParam=function(e){this.hV=null,this.hTLV=null,this.params=e},this.getString=function(){},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.params==null&&(this.params={}),this.params.str=e},this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.params==null&&(this.params={}),this.params.date=e},this.setByDateValue=function(e,r,n,i,s,a){var o=new Date(Date.UTC(e,r-1,n,i,s,a,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}};Ce(k.asn1.DERAbstractTime,k.asn1.ASN1Object);k.asn1.DERAbstractStructured=function(t){k.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,typeof t<"u"&&typeof t.array<"u"&&(this.asn1Array=t.array)};Ce(k.asn1.DERAbstractStructured,k.asn1.ASN1Object);k.asn1.DERBoolean=function(t){k.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",t==!1?this.hTLV="010100":this.hTLV="0101ff"};Ce(k.asn1.DERBoolean,k.asn1.ASN1Object);k.asn1.DERInteger=function(t){k.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.params=null;var e=c2;this.setByBigInteger=function(r){this.isModified=!0,this.params={bigint:r}},this.setByInteger=function(r){this.isModified=!0,this.params=r},this.setValueHex=function(r){this.isModified=!0,this.params={hex:r}},this.getFreshValueHex=function(){var r=this.params,n=null;if(r==null)throw new Error("value not set");if(typeof r=="object"&&r.hex!=null)return this.hV=r.hex,this.hV;if(typeof r=="number")n=new oe(String(r),10);else if(r.int!=null)n=new oe(String(r.int),10);else if(r.bigint!=null)n=r.bigint;else throw new Error("wrong parameter");return this.hV=e(n),this.hV},t!=null&&(this.params=t)};Ce(k.asn1.DERInteger,k.asn1.ASN1Object);k.asn1.DERBitString=function(t){if(t!==void 0&&typeof t.obj<"u"){var e=k.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.tohex()}k.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(r){this.hTLV=null,this.isModified=!0,this.hV=r},this.setUnusedBitsAndHexValue=function(r,n){if(r<0||7=s)break}return n};Le.getNthChildIdx=function(t,e,r){var n=Le.getChildIdx(t,e);return n[r]};Le.getIdxbyList=function(t,e,r,n){var i=Le,s,a;return r.length==0?n!==void 0&&t.substr(e,2)!==n?-1:e:(s=r.shift(),a=i.getChildIdx(t,e),s>=a.length?-1:i.getIdxbyList(t,a[s],r,n))};Le.getIdxbyListEx=function(t,e,r,n){var i=Le,s,a;if(r.length==0)return n!==void 0&&t.substr(e,2)!==n?-1:e;s=r.shift(),a=i.getChildIdx(t,e);for(var o=0,c=0;c=t.length?null:i.getTLV(t,s)};Le.getTLVbyListEx=function(t,e,r,n){var i=Le,s=i.getIdxbyListEx(t,e,r,n);return s==-1?null:i.getTLV(t,s)};Le.getVbyList=function(t,e,r,n,i){var s=Le,a,o;return a=s.getIdxbyList(t,e,r,n),a==-1||a>=t.length?null:(o=s.getV(t,a),i===!0&&(o=o.substr(2)),o)};Le.getVbyListEx=function(t,e,r,n,i){var s=Le,a,o;return a=s.getIdxbyListEx(t,e,r,n),a==-1?null:(o=s.getV(t,a),t.substr(a,2)=="03"&&i!==!1&&(o=o.substr(2)),o)};Le.getInt=function(t,e,r){r==null&&(r=-1);try{var n=t.substr(e,2);if(n!="02"&&n!="03")return r;var i=Le.getV(t,e);return n=="02"?parseInt(i,16):yJ(i)}catch{return r}};Le.getOID=function(t,e,r){r==null&&(r=null);try{if(t.substr(e,2)!="06")return r;var n=Le.getV(t,e);return q5(n)}catch{return r}};Le.getOIDName=function(t,e,r){r==null&&(r=null);try{var n=Le.getOID(t,e,r);if(n==r)return r;var i=k.asn1.x509.OID.oid2name(n);return i==""?n:i}catch{return r}};Le.getString=function(t,e,r){r==null&&(r=null);try{var n=Le.getV(t,e);return is(n)}catch{return r}};Le.hextooidstr=function(t){var e=function(f,d){return f.length>=d?f:new Array(d-f.length+1).join("0")+f},r=[],n=t.substr(0,2),i=parseInt(n,16);r[0]=new String(Math.floor(i/40)),r[1]=new String(i%40);for(var s=t.substr(2),a=[],o=0;o0&&(l=l+"."+c.join(".")),l};Le.dump=function(t,e,r,n){var i=Le,s=i.getV,a=i.dump,o=i.getChildIdx,c=t;t instanceof k.asn1.ASN1Object&&(c=t.tohex());var u=function(B,N){if(B.length<=N*2)return B;var T=B.substr(0,N)+"..(total "+B.length/2+"bytes).."+B.substr(B.length-N,N);return T};e===void 0&&(e={ommit_long_octet:32}),r===void 0&&(r=0),n===void 0&&(n="");var l=e.ommit_long_octet,P=c.substr(r,2);if(P=="01"){var f=s(c,r);return f=="00"?n+`BOOLEAN FALSE +`:n+`BOOLEAN TRUE +`}if(P=="02"){var f=s(c,r);return n+"INTEGER "+u(f,l)+` +`}if(P=="03"){var f=s(c,r);if(i.isASN1HEX(f.substr(2))){var d=n+`BITSTRING, encapsulates +`;return d=d+a(f.substr(2),e,0,n+" "),d}else return n+"BITSTRING "+u(f,l)+` +`}if(P=="04"){var f=s(c,r);if(i.isASN1HEX(f)){var d=n+`OCTETSTRING, encapsulates +`;return d=d+a(f,e,0,n+" "),d}else return n+"OCTETSTRING "+u(f,l)+` +`}if(P=="05")return n+`NULL +`;if(P=="06"){var p=s(c,r),h=k.asn1.ASN1Util.oidHexToInt(p),g=k.asn1.x509.OID.oid2name(h),v=h.replace(/\./g," ");return g!=""?n+"ObjectIdentifier "+g+" ("+v+`) +`:n+"ObjectIdentifier ("+v+`) +`}if(P=="0a")return n+"ENUMERATED "+parseInt(s(c,r))+` +`;if(P=="0c")return n+"UTF8String '"+zt(s(c,r))+`' +`;if(P=="13")return n+"PrintableString '"+zt(s(c,r))+`' +`;if(P=="14")return n+"TeletexString '"+zt(s(c,r))+`' +`;if(P=="16")return n+"IA5String '"+zt(s(c,r))+`' +`;if(P=="17")return n+"UTCTime "+zt(s(c,r))+` +`;if(P=="18")return n+"GeneralizedTime "+zt(s(c,r))+` +`;if(P=="1a")return n+"VisualString '"+zt(s(c,r))+`' +`;if(P=="1e")return n+"BMPString '"+JF(s(c,r))+`' +`;if(P=="30"){if(c.substr(r,4)=="3000")return n+`SEQUENCE {} +`;var d=n+`SEQUENCE +`,x=o(c,r),b=e;if((x.length==2||x.length==3)&&c.substr(x[0],2)=="06"&&c.substr(x[x.length-1],2)=="04"){var g=i.oidname(s(c,x[0])),S=JSON.parse(JSON.stringify(e));S.x509ExtName=g,b=S}for(var _=0;_4?{enum:{hex:x}}:{enum:parseInt(x,16)};if(g=="30"||g=="31")return v[p[g]]=h(t),v;if(g=="14"){var C=d(x);return v[p[g]]={str:C},v}else if(g=="1e"){var C=f(x);return v[p[g]]={str:C},v}else if(":0c:12:13:16:17:18:1a:".indexOf(g)!=-1){var C=l(x);return v[p[g]]={str:C},v}else if(g.match(/^8[0-9]$/)){var C=l(x);return C==null|C==""?{tag:{tag:g,explicit:!1,hex:x}}:C.match(/[\x00-\x1F\x7F-\x9F]/)!=null||C.match(/[\u0000-\u001F\u0080–\u009F]/)!=null?{tag:{tag:g,explicit:!1,hex:x}}:{tag:{tag:g,explicit:!1,str:C}}}else if(g.match(/^a[0-9]$/))try{if(!n(x))throw new Error("not encap");return{tag:{tag:g,explicit:!0,obj:r(x)}}}catch{return{tag:{tag:g,explicit:!0,hex:x}}}else{var B=new k.asn1.ASN1Object;B.hV=x;var N=B.getLengthHexFromValue();return{asn1:{tlv:g+N+x}}}}}};Le.isContextTag=function(t,e){t=t.toLowerCase();var r,n;try{r=parseInt(t,16)}catch{return-1}if(e===void 0)return(r&192)==128;try{var i=e.match(/^\[[0-9]+\]$/);return i==null||(n=parseInt(e.substr(1,e.length-1),10),n>31)?!1:(r&192)==128&&(r&31)==n}catch{return!1}};Le.isASN1HEX=function(t){var e=Le;if(t.length%2==1)return!1;var r=e.getVblen(t,0),n=t.substr(0,2),i=e.getL(t,0),s=t.length-n.length-i.length;return s==r*2};Le.checkStrictDER=function(t,e,r,n,i){var s=Le;if(r===void 0){if(typeof t!="string")throw new Error("not hex string");if(t=t.toLowerCase(),!k.lang.String.isHex(t))throw new Error("not hex string");r=t.length,n=t.length/2,n<128?i=1:i=Math.ceil(n.toString(16))+1}var a=s.getL(t,e);if(a.length>i*2)throw new Error("L of TLV too long: idx="+e);var o=s.getVblen(t,e);if(o>n)throw new Error("value of L too long than hex: idx="+e);var c=s.getTLV(t,e),u=c.length-2-s.getL(t,e).length;if(u!==o*2)throw new Error("V string length and L's value not the same:"+u+"/"+o*2);if(e===0&&t.length!=c.length)throw new Error("total length and TLV length unmatch:"+t.length+"!="+c.length);var l=t.substr(e,2);if(l==="02"){var f=s.getVidx(t,e);if(t.substr(f,2)=="00"&&t.charCodeAt(f+2)<56)throw new Error("not least zeros for DER INTEGER")}if(parseInt(l,16)&32){for(var d=s.getVblen(t,e),p=0,h=s.getChildIdx(t,e),g=0;g"u"||!k)&&(k={});(typeof k.asn1>"u"||!k.asn1)&&(k.asn1={});(typeof k.asn1.x509>"u"||!k.asn1.x509)&&(k.asn1.x509={});k.asn1.x509.Certificate=function(t){k.asn1.x509.Certificate.superclass.constructor.call(this);var e=k,r=e.asn1,n=r.DERBitString,i=r.DERSequence,s=r.x509,a=s.TBSCertificate,o=s.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(c){this.params=c},this.sign=function(){var c=this.params,u=c.sigalg;c.sigalg.name!=null&&(u=c.sigalg.name);var l=c.tbsobj.tohex(),f=new k.crypto.Signature({alg:u});f.init(c.cakey),f.updateHex(l),c.sighex=f.sign()},this.getPEM=function(){return Dn(this.tohex(),"CERTIFICATE")},this.tohex=function(){var c=this.params;if((c.tbsobj==null||c.tbsobj==null)&&(c.tbsobj=new a(c)),c.sighex==null&&c.cakey!=null&&this.sign(),c.sighex==null)throw new Error("sighex or cakey parameter not defined");var u=[];u.push(c.tbsobj),u.push(new o({name:c.sigalg})),u.push(new n({hex:"00"+c.sighex}));var l=new i({array:u});return l.tohex()},this.getEncodedHex=function(){return this.tohex()},t!=null&&(this.params=t)};Ce(k.asn1.x509.Certificate,k.asn1.ASN1Object);k.asn1.x509.TBSCertificate=function(t){k.asn1.x509.TBSCertificate.superclass.constructor.call(this);var e=k,r=e.asn1,n=r.x509,i=r.DERTaggedObject,s=r.DERInteger,a=r.DERSequence,o=n.AlgorithmIdentifier,c=n.Time,u=n.X500Name,l=n.Extensions,f=n.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(d){this.params=d},this.tohex=function(){var d=[],p=this.params;if(p.version!=null||p.version!=1){var h=2;p.version!=null&&(h=p.version-1);var g=new i({obj:new s({int:h})});d.push(g)}d.push(new s(p.serial)),d.push(new o({name:p.sigalg})),d.push(new u(p.issuer)),d.push(new a({array:[new c(p.notbefore),new c(p.notafter)]})),d.push(new u(p.subject)),d.push(new f(wt.getKey(p.sbjpubkey))),p.ext!==void 0&&p.ext.length>0&&d.push(new i({tag:"a3",obj:new l(p.ext)}));var v=new k.asn1.DERSequence({array:d});return v.tohex()},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&this.setByParam(t)};Ce(k.asn1.x509.TBSCertificate,k.asn1.ASN1Object);k.asn1.x509.Extensions=function(t){k.asn1.x509.Extensions.superclass.constructor.call(this);var e=k,r=e.asn1,n=r.DERSequence,i=r.x509;this.aParam=[],this.setByParam=function(s){this.aParam=s},this.tohex=function(){for(var s=[],a=0;a-1&&s.push(new n({int:this.pathLen}));var a=new i({array:s});return this.asn1ExtnValue=a,this.asn1ExtnValue.tohex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,t!==void 0&&(t.cA!==void 0&&(this.cA=t.cA),t.pathLen!==void 0&&(this.pathLen=t.pathLen))};Ce(k.asn1.x509.BasicConstraints,k.asn1.x509.Extension);k.asn1.x509.CRLDistributionPoints=function(t){k.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,t);var e=k,r=e.asn1,n=r.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.setByDPArray=function(i){for(var s=[],a=0;a0&&s.push(new r({array:a}))}var c=new r({array:s});return c.tohex()},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&(this.params=t)};Ce(k.asn1.x509.PolicyInformation,k.asn1.ASN1Object);k.asn1.x509.PolicyQualifierInfo=function(t){k.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,t);var e=k.asn1,r=e.DERSequence,n=e.DERIA5String,i=e.DERObjectIdentifier,s=e.x509.UserNotice;this.params=null,this.tohex=function(){if(this.params.cps!==void 0){var a=new r({array:[new i({oid:"1.3.6.1.5.5.7.2.1"}),new n({str:this.params.cps})]});return a.tohex()}if(this.params.unotice!=null){var a=new r({array:[new i({oid:"1.3.6.1.5.5.7.2.2"}),new s(this.params.unotice)]});return a.tohex()}},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&(this.params=t)};Ce(k.asn1.x509.PolicyQualifierInfo,k.asn1.ASN1Object);k.asn1.x509.UserNotice=function(t){k.asn1.x509.UserNotice.superclass.constructor.call(this,t);var e=k.asn1.DERSequence;k.asn1.DERInteger;var r=k.asn1.x509.DisplayText,n=k.asn1.x509.NoticeReference;this.params=null,this.tohex=function(){var i=[];this.params.noticeref!==void 0&&i.push(new n(this.params.noticeref)),this.params.exptext!==void 0&&i.push(new r(this.params.exptext));var s=new e({array:i});return s.tohex()},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&(this.params=t)};Ce(k.asn1.x509.UserNotice,k.asn1.ASN1Object);k.asn1.x509.NoticeReference=function(t){k.asn1.x509.NoticeReference.superclass.constructor.call(this,t);var e=k.asn1.DERSequence,r=k.asn1.DERInteger,n=k.asn1.x509.DisplayText;this.params=null,this.tohex=function(){var i=[];if(this.params.org!==void 0&&i.push(new n(this.params.org)),this.params.noticenum!==void 0){for(var s=[],a=this.params.noticenum,o=0;o0)for(var s=0;s0;i++){var s=e.shift();if(r===!0){var a=n.pop(),o=(a+","+s).replace(/\\,/g,",");n.push(o),r=!1}else n.push(s);s.substr(-1,1)==="\\"&&(r=!0)}return n=n.map(function(c){return c.replace("/","\\/")}),n.reverse(),"/"+n.join("/")};k.asn1.x509.X500Name.ldapToOneline=function(t){return k.asn1.x509.X500Name.ldapToCompat(t)};k.asn1.x509.RDN=function(t){k.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var e=k.asn1.x509.AttributeTypeAndValue;this.setByParam=function(r){r.rule!==void 0&&(this.sRule=r.rule),r.str!==void 0&&this.addByMultiValuedString(r.str),r.array!==void 0&&(this.paramArray=r.array)},this.addByString=function(r){this.asn1Array.push(new k.asn1.x509.AttributeTypeAndValue({str:r,rule:this.sRule}))},this.addByMultiValuedString=function(r){for(var n=k.asn1.x509.RDN.parseString(r),i=0;i0)for(var r=0;r0;i++){var s=e.shift();if(r===!0){var a=n.pop(),o=(a+"+"+s).replace(/\\\+/g,"+");n.push(o),r=!1}else n.push(s);s.substr(-1,1)==="\\"&&(r=!0)}for(var c=!1,u=[],i=0;n.length>0;i++){var s=n.shift();if(c===!0){var l=u.pop();if(s.match(/"$/)){var o=(l+"+"+s).replace(/^([^=]+)="(.*)"$/,"$1=$2");u.push(o),c=!1}else u.push(l+"+"+s)}else u.push(s);s.match(/^[^=]+="/)&&(c=!0)}return u};k.asn1.x509.AttributeTypeAndValue=function(t){k.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var e=k,r=e.asn1,n=r.DERSequence,i=r.DERUTF8String,s=r.DERPrintableString,a=r.DERTeletexString,o=r.DERIA5String,c=r.DERVisibleString,u=r.DERBMPString,l=e.lang.String.isMail,f=e.lang.String.isPrintable;this.setByParam=function(d){if(d.rule!==void 0&&(this.sRule=d.rule),d.ds!==void 0&&(this.dsType=d.ds),d.value===void 0&&d.str!==void 0){var p=d.str,h=p.match(/^([^=]+)=(.+)$/);if(h)this.sType=h[1],this.sValue=h[2];else throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr)}else this.sType=d.type,this.sValue=d.value},this.setByString=function(d,p){p!==void 0&&(this.sRule=p);var h=d.match(/^([^=]+)=(.+)$/);if(h)this.setByAttrTypeAndValueStr(h[1],h[2]);else throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr)},this._getDsType=function(){var d=this.sType,p=this.sValue,h=this.sRule;return h==="prn"?d=="CN"&&l(p)?"ia5":f(p)?"prn":"utf8":h==="utf8"?d=="CN"&&l(p)?"ia5":d=="C"?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(d,p,h){h!==void 0&&(this.sRule=h),this.sType=d,this.sValue=p},this.getValueObj=function(d,p){if(d=="utf8")return new i({str:p});if(d=="prn")return new s({str:p});if(d=="tel")return new a({str:p});if(d=="ia5")return new o({str:p});if(d=="vis")return new c({str:p});if(d=="bmp")return new u({str:p});throw new Error("unsupported directory string type: type="+d+" value="+p)},this.tohex=function(){this.dsType==null&&(this.dsType=this._getDsType());var d=k.asn1.x509.OID.atype2obj(this.sType),p=this.getValueObj(this.dsType,this.sValue),h=new n({array:[d,p]});return this.TLV=h.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&this.setByParam(t)};Ce(k.asn1.x509.AttributeTypeAndValue,k.asn1.ASN1Object);k.asn1.x509.SubjectPublicKeyInfo=function(t){k.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var e=k,r=e.asn1,n=r.DERInteger,i=r.DERBitString,s=r.DERObjectIdentifier,a=r.DERSequence,o=r.ASN1Util.newObject,c=r.x509,u=c.AlgorithmIdentifier,l=e.crypto;l.ECDSA,l.DSA,this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null)throw"algId and/or subjPubKey not set";var f=new a({array:[this.asn1AlgId,this.asn1SubjPKey]});return f},this.tohex=function(){var f=this.getASN1Object();return this.hTLV=f.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.setPubKey=function(f){try{if(f instanceof at){var d=o({seq:[{int:{bigint:f.n}},{int:{int:f.e}}]}),p=d.tohex();this.asn1AlgId=new u({name:"rsaEncryption"}),this.asn1SubjPKey=new i({hex:"00"+p})}}catch{}try{if(f instanceof k.crypto.ECDSA){var h=new s({name:f.curveName});this.asn1AlgId=new u({name:"ecPublicKey",asn1params:h}),this.asn1SubjPKey=new i({hex:"00"+f.pubKeyHex})}}catch{}try{if(f instanceof k.crypto.DSA){var h=new o({seq:[{int:{bigint:f.p}},{int:{bigint:f.q}},{int:{bigint:f.g}}]});this.asn1AlgId=new u({name:"dsa",asn1params:h});var g=new n({bigint:f.y});this.asn1SubjPKey=new i({hex:"00"+g.tohex()})}}catch{}},t!==void 0&&this.setPubKey(t)};Ce(k.asn1.x509.SubjectPublicKeyInfo,k.asn1.ASN1Object);k.asn1.x509.Time=function(t){k.asn1.x509.Time.superclass.constructor.call(this);var e=k,r=e.asn1,n=r.DERUTCTime,i=r.DERGeneralizedTime;this.params=null,this.type=null,this.setTimeParams=function(s){this.timeParams=s},this.setByParam=function(s){this.params=s},this.getType=function(s){return s.match(/^[0-9]{12}Z$/)?"utc":s.match(/^[0-9]{14}Z$/)?"gen":s.match(/^[0-9]{12}\.[0-9]+Z$/)?"utc":s.match(/^[0-9]{14}\.[0-9]+Z$/)?"gen":null},this.tohex=function(){var s=this.params,a=null;if(typeof s=="string"&&(s={str:s}),s!=null&&s.str&&(s.type==null||s.type==null)&&(s.type=this.getType(s.str)),s!=null&&s.str?(s.type=="utc"&&(a=new n(s.str)),s.type=="gen"&&(a=new i(s.str))):this.type=="gen"?a=new i:a=new n,a==null)throw new Error("wrong setting for Time");return this.TLV=a.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},t!=null&&this.setByParam(t)};k.asn1.x509.Time_bak=function(t){k.asn1.x509.Time_bak.superclass.constructor.call(this);var e=k,r=e.asn1,n=r.DERUTCTime,i=r.DERGeneralizedTime;this.setTimeParams=function(s){this.timeParams=s},this.tohex=function(){var s=null;return this.timeParams!=null?this.type=="utc"?s=new n(this.timeParams):s=new i(this.timeParams):this.type=="utc"?s=new n:s=new i,this.TLV=s.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},this.type="utc",t!==void 0&&(t.type!==void 0?this.type=t.type:t.str!==void 0&&(t.str.match(/^[0-9]{12}Z$/)&&(this.type="utc"),t.str.match(/^[0-9]{14}Z$/)&&(this.type="gen")),this.timeParams=t)};Ce(k.asn1.x509.Time,k.asn1.ASN1Object);k.asn1.x509.AlgorithmIdentifier=function(t){k.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var e=k,r=e.asn1,n=r.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;if(this.tohex=function(){if(this.nameAlg===null&&this.asn1Alg===null)throw new Error("algorithm not specified");if(this.nameAlg!==null){var s=null;for(var a in n)a===this.nameAlg&&(s=n[a]);if(s!==null)return this.hTLV=s,this.hTLV}this.nameAlg!==null&&this.asn1Alg===null&&(this.asn1Alg=r.x509.OID.name2obj(this.nameAlg));var o=[this.asn1Alg];this.asn1Params!==null&&o.push(this.asn1Params);var c=new r.DERSequence({array:o});return this.hTLV=c.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&(t.name!==void 0&&(this.nameAlg=t.name),t.asn1params!==void 0&&(this.asn1Params=t.asn1params),t.paramempty!==void 0&&(this.paramEmpty=t.paramempty)),this.asn1Params===null&&this.paramEmpty===!1&&this.nameAlg!==null){this.nameAlg.name!==void 0&&(this.nameAlg=this.nameAlg.name);var i=this.nameAlg.toLowerCase();i.substr(-7,7)!=="withdsa"&&i.substr(-9,9)!=="withecdsa"&&(this.asn1Params=new r.DERNull)}};Ce(k.asn1.x509.AlgorithmIdentifier,k.asn1.ASN1Object);k.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"};k.asn1.x509.GeneralName=function(t){k.asn1.x509.GeneralName.superclass.constructor.call(this);var e=k,r=e.asn1,n=r.x509,i=n.X500Name,s=n.OtherName,a=r.DERIA5String;r.DERPrintableString;var o=r.DEROctetString,c=r.DERTaggedObject,u=r.ASN1Object,l=Error;this.params=null,this.setByParam=function(f){this.params=f},this.tohex=function(){var f=this.params,d,h,p,h=!1;if(f.other!==void 0)d="a0",p=new s(f.other);else if(f.rfc822!==void 0)d="81",p=new a({str:f.rfc822});else if(f.dns!==void 0)d="82",p=new a({str:f.dns});else if(f.dn!==void 0)d="a4",h=!0,typeof f.dn=="string"?p=new i({str:f.dn}):f.dn instanceof k.asn1.x509.X500Name?p=f.dn:p=new i(f.dn);else if(f.ldapdn!==void 0)d="a4",h=!0,p=new i({ldapstr:f.ldapdn});else if(f.certissuer!==void 0||f.certsubj!==void 0){d="a4",h=!0;var g,v,x=null;if(f.certsubj!==void 0?(g=!1,v=f.certsubj):(g=!0,v=f.certissuer),v.match(/^[0-9A-Fa-f]+$/),v.indexOf("-----BEGIN ")!=-1&&(x=Or(v)),x==null)throw new Error("certsubj/certissuer not cert");var b=new ft;b.hex=x;var S;g?S=b.getIssuerHex():S=b.getSubjectHex(),p=new u,p.hTLV=S}else if(f.uri!==void 0)d="86",p=new a({str:f.uri});else if(f.ip!==void 0){d="87";var _,P=f.ip;try{if(P.match(/^[0-9a-f]+$/)){var C=P.length;if(C==8||C==16||C==32||C==64)_=P;else throw"err"}else _=ZF(P)}catch(N){throw new l("malformed IP address: "+f.ip+":"+N.message)}p=new o({hex:_})}else throw new l("improper params");var B=new c({tag:d,explicit:h,obj:p});return B.tohex()},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&this.setByParam(t)};Ce(k.asn1.x509.GeneralName,k.asn1.ASN1Object);k.asn1.x509.GeneralNames=function(t){k.asn1.x509.GeneralNames.superclass.constructor.call(this);var e=k,r=e.asn1;this.setByParamArray=function(n){for(var i=0;i"u")throw"Name of ObjectIdentifier not defined: "+e;var r=this.name2oidList[e],n=new t({oid:r});return this.objCache[e]=n,n},this.atype2obj=function(e){if(this.objCache[e]!==void 0)return this.objCache[e];var r;if(e.match(/^\d+\.\d+\.[0-9.]+$/))r=e;else if(this.atype2oidList[e]!==void 0)r=this.atype2oidList[e];else if(this.name2oidList[e]!==void 0)r=this.name2oidList[e];else throw new Error("AttributeType name undefined: "+e);var n=new t({oid:r});return this.objCache[e]=n,n},this.registerOIDs=function(e){if(this.checkOIDs(e))for(var r in e)this.name2oidList[r]=e[r]},this.checkOIDs=function(e){try{var r=Object.keys(e);return r.length==0?!1:(r.map(function(n,i,s){var a=this[n];if(!a.match(/^[0-2]\.[0-9.]+$/))throw new Error("value is not OID")},e),!0)}catch{return!1}}};k.asn1.x509.OID.oid2name=function(t){var e=k.asn1.x509.OID.name2oidList;for(var r in e)if(e[r]==t)return r;return""};k.asn1.x509.OID.oid2atype=function(t){var e=k.asn1.x509.OID.atype2oidList;for(var r in e)if(e[r]==t)return r;return t};k.asn1.x509.OID.name2oid=function(t){if(t.match(/^[0-9.]+$/))return t;var e=k.asn1.x509.OID.name2oidList;return e[t]===void 0?"":e[t]};k.asn1.x509.X509Util={};k.asn1.x509.X509Util.newCertPEM=function(t){var e=k.asn1.x509;e.TBSCertificate;var r=e.Certificate,n=new r(t);return n.getPEM()};(typeof k>"u"||!k)&&(k={});(typeof k.asn1>"u"||!k.asn1)&&(k.asn1={});(typeof k.asn1.cms>"u"||!k.asn1.cms)&&(k.asn1.cms={});k.asn1.cms.Attribute=function(t){var e=Error,r=k,n=r.asn1,i=n.DERSequence,s=n.DERSet,a=n.DERObjectIdentifier;this.params=null,this.typeOid=null,this.setByParam=function(o){this.params=o},this.getValueArray=function(){throw new e("not yet implemented abstract")},this.tohex=function(){var o=new a({oid:this.typeOid}),c=new s({array:this.getValueArray()}),u=new i({array:[o,c]});return u.tohex()},this.getEncodedHex=function(){return this.tohex()}};Ce(k.asn1.cms.Attribute,k.asn1.ASN1Object);k.asn1.cms.ContentType=function(t){var e=k,r=e.asn1;r.cms.ContentType.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.3",this.getValueArray=function(){var n=new r.DERObjectIdentifier(this.params.type);return[n]},t!=null&&this.setByParam(t)};Ce(k.asn1.cms.ContentType,k.asn1.cms.Attribute);k.asn1.cms.MessageDigest=function(t){var e=k,r=e.asn1,n=r.DEROctetString,i=r.cms;i.MessageDigest.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.4",this.getValueArray=function(){var s=new n(this.params);return[s]},t!=null&&this.setByParam(t)};Ce(k.asn1.cms.MessageDigest,k.asn1.cms.Attribute);k.asn1.cms.SigningTime=function(t){var e=k,r=e.asn1;r.cms.SigningTime.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.5",this.getValueArray=function(){var n=new r.x509.Time(this.params);return[n]},t!=null&&this.setByParam(t)};Ce(k.asn1.cms.SigningTime,k.asn1.cms.Attribute);k.asn1.cms.SigningCertificate=function(t){var e=Error,r=k,n=r.asn1,i=n.DERSequence,s=n.cms,a=s.ESSCertID;r.crypto,s.SigningCertificate.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.12",this.getValueArray=function(){if(this.params==null||this.params==null||this.params.array==null)throw new e("parameter 'array' not specified");for(var o=this.params.array,c=[],u=0;u0){for(var p=s(f.valhex,d[0]),h=l(p,0),g=[],v=0;v1){var S=s(f.valhex,d[1]);f.polhex=S}delete f.valhex},this.setSignaturePolicyIdentifier=function(f){var d=l(f.valhex,0);if(d.length>0){var p=n.getOID(f.valhex,d[0]);f.oid=p}if(d.length>1){var h=new e,g=l(f.valhex,d[1]),v=s(f.valhex,g[0]),x=h.getAlgorithmIdentifierName(v);f.alg=x;var b=i(f.valhex,g[1]);f.hash=b}delete f.valhex},this.setSigningCertificateV2=function(f){var d=l(f.valhex,0);if(d.length>0){for(var p=s(f.valhex,d[0]),h=l(p,0),g=[],v=0;v1){var S=s(f.valhex,d[1]);f.polhex=S}delete f.valhex},this.getESSCertID=function(f){var d={},p=l(f,0);if(p.length>0){var h=i(f,p[0]);d.hash=h}if(p.length>1){var g=s(f,p[1]),v=this.getIssuerSerial(g);v.serial!=null&&(d.serial=v.serial),v.issuer!=null&&(d.issuer=v.issuer)}return d},this.getESSCertIDv2=function(f){var d={},p=l(f,0);if(p.length<1||3h+1){var x=s(f,p[h+1]),b=this.getIssuerSerial(x);d.issuer=b.issuer,d.serial=b.serial}return d},this.getIssuerSerial=function(f){var d={},p=l(f,0),h=s(f,p[0]),g=r.getGeneralNames(h),v=g[0].dn;d.issuer=v;var x=i(f,p[1]);return d.serial={hex:x},d},this.getCertificateSet=function(f){for(var d=l(f,0),p=[],h=0;h"u"||!k)&&(k={});(typeof k.asn1>"u"||!k.asn1)&&(k.asn1={});(typeof k.asn1.tsp>"u"||!k.asn1.tsp)&&(k.asn1.tsp={});k.asn1.tsp.TimeStampToken=function(t){var e=k,r=e.asn1,n=r.tsp;n.TimeStampToken.superclass.constructor.call(this),this.params=null,this.getEncodedHexPrepare=function(){var i=new n.TSTInfo(this.params.econtent.content);this.params.econtent.content.hex=i.tohex()},t!=null&&this.setByParam(t)};Ce(k.asn1.tsp.TimeStampToken,k.asn1.cms.SignedData);k.asn1.tsp.TSTInfo=function(t){var e=k,r=e.asn1,n=r.DERSequence,i=r.DERInteger,s=r.DERBoolean,a=r.DERGeneralizedTime,o=r.DERObjectIdentifier,c=r.DERTaggedObject,u=r.tsp,l=u.MessageImprint,f=u.Accuracy;r.x509.X500Name;var d=r.x509.GeneralName;if(u.TSTInfo.superclass.constructor.call(this),this.dVersion=new i({int:1}),this.dPolicy=null,this.dMessageImprint=null,this.dSerial=null,this.dGenTime=null,this.dAccuracy=null,this.dOrdering=null,this.dNonce=null,this.dTsa=null,this.tohex=function(){var p=[this.dVersion];if(this.dPolicy==null)throw new Error("policy shall be specified.");if(p.push(this.dPolicy),this.dMessageImprint==null)throw new Error("messageImprint shall be specified.");if(p.push(this.dMessageImprint),this.dSerial==null)throw new Error("serialNumber shall be specified.");if(p.push(this.dSerial),this.dGenTime==null)throw new Error("genTime shall be specified.");p.push(this.dGenTime),this.dAccuracy!=null&&p.push(this.dAccuracy),this.dOrdering!=null&&p.push(this.dOrdering),this.dNonce!=null&&p.push(this.dNonce),this.dTsa!=null&&p.push(this.dTsa);var h=new n({array:p});return this.hTLV=h.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},t!==void 0){if(typeof t.policy=="string"){if(!t.policy.match(/^[0-9.]+$/))throw"policy shall be oid like 0.1.4.134";this.dPolicy=new o({oid:t.policy})}t.messageImprint!==void 0&&(this.dMessageImprint=new l(t.messageImprint)),t.serial!==void 0&&(this.dSerial=new i(t.serial)),t.genTime!==void 0&&(this.dGenTime=new a(t.genTime)),t.accuracy!==void 0&&(this.dAccuracy=new f(t.accuracy)),t.ordering!==void 0&&t.ordering==!0&&(this.dOrdering=new s),t.nonce!==void 0&&(this.dNonce=new i(t.nonce)),t.tsa!==void 0&&(this.dTsa=new c({tag:"a0",explicit:!0,obj:new d({dn:t.tsa})}))}};Ce(k.asn1.tsp.TSTInfo,k.asn1.ASN1Object);k.asn1.tsp.Accuracy=function(t){var e=k,r=e.asn1,n=r.ASN1Util.newObject;r.tsp.Accuracy.superclass.constructor.call(this),this.params=null,this.tohex=function(){var i=this.params,s=[];return i.seconds!=null&&typeof i.seconds=="number"&&s.push({int:i.seconds}),i.millis!=null&&typeof i.millis=="number"&&s.push({tag:{tagi:"80",obj:{int:i.millis}}}),i.micros!=null&&typeof i.micros=="number"&&s.push({tag:{tagi:"81",obj:{int:i.micros}}}),n({seq:s}).tohex()},this.getEncodedHex=function(){return this.tohex()},t!=null&&this.setByParam(t)};Ce(k.asn1.tsp.Accuracy,k.asn1.ASN1Object);k.asn1.tsp.MessageImprint=function(t){var e=k,r=e.asn1,n=r.DERSequence,i=r.DEROctetString,s=r.x509,a=s.AlgorithmIdentifier;r.tsp.MessageImprint.superclass.constructor.call(this),this.params=null,this.tohex=function(){var o=this.params,c=new a({name:o.alg}),u=new i({hex:o.hash}),l=new n({array:[c,u]});return l.tohex()},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&this.setByParam(t)};Ce(k.asn1.tsp.MessageImprint,k.asn1.ASN1Object);k.asn1.tsp.TimeStampReq=function(t){var e=k,r=e.asn1,n=r.DERSequence,i=r.DERInteger,s=r.DERBoolean;r.ASN1Object;var a=r.DERObjectIdentifier,o=r.tsp,c=o.MessageImprint;o.TimeStampReq.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params,l=[];l.push(new i({int:1})),u.messageImprint instanceof k.asn1.ASN1Object?l.push(u.messageImprint):l.push(new c(u.messageImprint)),u.policy!=null&&l.push(new a(u.policy)),u.nonce!=null&&l.push(new i(u.nonce)),u.certreq==!0&&l.push(new s);var f=new n({array:l});return f.tohex()},this.getEncodedHex=function(){return this.tohex()},t!=null&&this.setByParam(t)};Ce(k.asn1.tsp.TimeStampReq,k.asn1.ASN1Object);k.asn1.tsp.TimeStampResp=function(t){var e=k,r=e.asn1,n=r.DERSequence;r.ASN1Object;var i=r.tsp,s=i.PKIStatusInfo;i.TimeStampResp.superclass.constructor.call(this),this.params=null,this.tohex=function(){var a=this.params,o=[];if(a.econtent!=null||a.tst!=null)if(a.statusinfo!=null?o.push(new s(a.statusinfo)):o.push(new s("granted")),a.econtent!=null)o.push(new i.TimeStampToken(a).getContentInfo());else if(a.tst instanceof r.ASN1Object)o.push(a.tst);else throw new Error("improper member tst value");else if(a.statusinfo!=null)o.push(new s(a.statusinfo));else throw new Error("parameter for token nor statusinfo not specified");var c=new n({array:o});return c.tohex()},this.getEncodedHex=function(){return this.tohex()},t!=null&&this.setByParam(t)};Ce(k.asn1.tsp.TimeStampResp,k.asn1.ASN1Object);k.asn1.tsp.PKIStatusInfo=function(t){var e=Error,r=k,n=r.asn1,i=n.DERSequence,s=n.tsp,a=s.PKIStatus,o=s.PKIFreeText,c=s.PKIFailureInfo;s.PKIStatusInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params,l=[];if(typeof u=="string")l.push(new a(u));else{if(u.status==null)throw new e("property 'status' unspecified");l.push(new a(u.status)),u.statusstr!=null&&l.push(new o(u.statusstr)),u.failinfo!=null&&l.push(new c(u.failinfo))}var f=new i({array:l});return f.tohex()},this.getEncodedHex=function(){return this.tohex()},t!=null&&this.setByParam(t)};Ce(k.asn1.tsp.PKIStatusInfo,k.asn1.ASN1Object);k.asn1.tsp.PKIStatus=function(t){var e=Error,r=k,n=r.asn1,i=n.DERInteger,s=n.tsp;s.PKIStatus.superclass.constructor.call(this);var a={granted:0,grantedWithMods:1,rejection:2,waiting:3,revocationWarning:4,revocationNotification:5};this.params=null,this.tohex=function(){var o=this.params,c;if(typeof o=="string")try{c=a[o]}catch{throw new e("undefined name: "+o)}else if(typeof o=="number")c=o;else throw new e("unsupported params");return new i({int:c}).tohex()},this.getEncodedHex=function(){return this.tohex()},t!=null&&this.setByParam(t)};Ce(k.asn1.tsp.PKIStatus,k.asn1.ASN1Object);k.asn1.tsp.PKIFreeText=function(t){var e=Error,r=k,n=r.asn1,i=n.DERSequence,s=n.DERUTF8String,a=n.tsp;a.PKIFreeText.superclass.constructor.call(this),this.params=null,this.tohex=function(){var o=this.params;if(!o instanceof Array)throw new e("wrong params: not array");for(var c=[],u=0;u=0;d--)f+=l[d];return f}else{if(typeof c=="string"&&o[c]!=null)return V4([c],o);if(typeof c=="object"&&c.length!=null)return V4(c,o);throw new e("wrong params")}},this.tohex=function(){this.params;var c=this.getBinValue();return new i({bin:c}).tohex()},this.getEncodedHex=function(){return this.tohex()},t!=null&&this.setByParam(t)};Ce(k.asn1.tsp.PKIFailureInfo,k.asn1.ASN1Object);k.asn1.tsp.AbstractTSAAdapter=function(t){this.getTSTHex=function(e,r){throw"not implemented yet"}};k.asn1.tsp.SimpleTSAAdapter=function(t){var e=k,r=e.asn1,n=r.tsp,i=e.crypto.Util.hashHex;n.SimpleTSAAdapter.superclass.constructor.call(this),this.params=null,this.serial=0,this.getTSTHex=function(s,a){var o=i(s,a);this.params.econtent.content.messageImprint={alg:a,hash:o},this.params.econtent.content.serial={int:this.serial++};var c=Math.floor(Math.random()*1e9);this.params.econtent.content.nonce={int:c};var u=new n.TimeStampToken(this.params);return u.getContentInfoEncodedHex()},t!==void 0&&(this.params=t)};Ce(k.asn1.tsp.SimpleTSAAdapter,k.asn1.tsp.AbstractTSAAdapter);k.asn1.tsp.FixedTSAAdapter=function(t){var e=k,r=e.asn1,n=r.tsp,i=e.crypto.Util.hashHex;n.FixedTSAAdapter.superclass.constructor.call(this),this.params=null,this.getTSTHex=function(s,a){var o=i(s,a);this.params.econtent.content.messageImprint={alg:a,hash:o};var c=new n.TimeStampToken(this.params);return c.getContentInfoEncodedHex()},t!==void 0&&(this.params=t)};Ce(k.asn1.tsp.FixedTSAAdapter,k.asn1.tsp.AbstractTSAAdapter);k.asn1.tsp.TSPUtil=new function(){};k.asn1.tsp.TSPUtil.newTimeStampToken=function(t){return new k.asn1.tsp.TimeStampToken(t)};k.asn1.tsp.TSPUtil.parseTimeStampReq=function(t){var e=new k.asn1.tsp.TSPParser;return e.getTimeStampReq(t)};k.asn1.tsp.TSPUtil.parseMessageImprint=function(t){var e=new k.asn1.tsp.TSPParser;return e.getMessageImprint(t)};k.asn1.tsp.TSPParser=function(){var t=ft,e=new t,r=Le,n=r.getV,i=r.getTLV,s=r.getIdxbyList;r.getTLVbyListEx;var a=r.getChildIdx,o=["granted","grantedWithMods","rejection","waiting","revocationWarning","revocationNotification"],c={0:"badAlg",2:"badRequest",5:"badDataFormat",14:"timeNotAvailable",15:"unacceptedPolicy",16:"unacceptedExtension",17:"addInfoNotAvailable",25:"systemFailure"};this.getResponse=function(u){var l=a(u,0);if(l.length==1)return this.getPKIStatusInfo(i(u,l[0]));if(l.length>1){var f=this.getPKIStatusInfo(i(u,l[0])),d=i(u,l[1]),p=this.getToken(d);return p.statusinfo=f,p}},this.getToken=function(u){var l=new k.asn1.cms.CMSParser,f=l.getCMSSignedData(u);return this.setTSTInfo(f),f},this.setTSTInfo=function(u){var l=u.econtent;if(l.type=="tstinfo"){var f=l.content.hex,d=this.getTSTInfo(f);l.content=d}},this.getTSTInfo=function(u){var l={},f=a(u,0),d=n(u,f[1]);l.policy=q5(d);var p=i(u,f[2]);l.messageImprint=this.getMessageImprint(p);var h=n(u,f[3]);l.serial={hex:h};var g=n(u,f[4]);l.genTime={str:zt(g)};var v=0;if(f.length>5&&u.substr(f[5],2)=="30"){var x=i(u,f[5]);l.accuracy=this.getAccuracy(x),v++}if(f.length>5+v&&u.substr(f[5+v],2)=="01"){var b=n(u,f[5+v]);b=="ff"&&(l.ordering=!0),v++}if(f.length>5+v&&u.substr(f[5+v],2)=="02"){var S=n(u,f[5+v]);l.nonce={hex:S},v++}if(f.length>5+v&&u.substr(f[5+v],2)=="a0"){var _=i(u,f[5+v]);_="30"+_.substr(2),pGeneralNames=e.getGeneralNames(_);var P=pGeneralNames[0].dn;l.tsa=P,v++}if(f.length>5+v&&u.substr(f[5+v],2)=="a1"){var C=i(u,f[5+v]);C="30"+C.substr(2);var B=e.getExtParamArray(C);l.ext=B,v++}return l},this.getAccuracy=function(u){for(var l={},f=a(u,0),d=0;d1&&u.substr(f[1],2)=="30"){var g=i(u,f[1]);l.statusstr=this.getPKIFreeText(g),d++}if(f.length>d&&u.substr(f[1+d],2)=="03"){var v=i(u,f[1+d]);l.failinfo=this.getPKIFailureInfo(v)}return l},this.getPKIFreeText=function(u){for(var l=[],f=a(u,0),d=0;d"u"||!k)&&(k={});(typeof k.asn1>"u"||!k.asn1)&&(k.asn1={});(typeof k.asn1.cades>"u"||!k.asn1.cades)&&(k.asn1.cades={});k.asn1.cades.SignaturePolicyIdentifier=function(t){var e=k,r=e.asn1,n=r.cades,i=n.SignaturePolicyId;n.SignaturePolicyIdentifier.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.15",this.params=null,this.getValueArray=function(){return[new i(this.params)]},this.setByParam=function(s){this.params=s},t!=null&&this.setByParam(t)};Ce(k.asn1.cades.SignaturePolicyIdentifier,k.asn1.cms.Attribute);k.asn1.cades.SignaturePolicyId=function(t){var e=k,r=e.asn1,n=r.DERSequence,i=r.DERObjectIdentifier,s=r.x509;s.AlgorithmIdentifier;var a=r.cades,o=a.SignaturePolicyId,c=a.OtherHashAlgAndValue;o.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params,l=[];l.push(new i(u.oid)),l.push(new c(u));var f=new n({array:l});return f.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(u){this.params=u},t!=null&&this.setByParam(t)};Ce(k.asn1.cades.SignaturePolicyId,k.asn1.ASN1Object);k.asn1.cades.OtherHashAlgAndValue=function(t){var e=Error,r=k,n=r.asn1,i=n.DERSequence,s=n.DEROctetString,a=n.x509,o=a.AlgorithmIdentifier,c=n.cades,u=c.OtherHashAlgAndValue;u.superclass.constructor.call(this),this.params=null,this.tohex=function(){var l=this.params;if(l.alg==null)throw new e("property 'alg' not specified");if(l.hash==null&&l.cert==null)throw new e("property 'hash' nor 'cert' not specified");var f=null;if(l.hash!=null)f=l.hash;else if(l.cert!=null){if(typeof l.cert!="string")throw new e("cert not string");var d=l.cert;l.cert.indexOf("-----BEGIN")!=-1&&(d=Or(l.cert)),f=k.crypto.Util.hashHex(d,l.alg)}var p=[];p.push(new o({name:l.alg})),p.push(new s({hex:f}));var h=new i({array:p});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},t!=null&&this.setByParam(t)};Ce(k.asn1.cades.OtherHashAlgAndValue,k.asn1.ASN1Object);k.asn1.cades.OtherHashValue=function(t){k.asn1.cades.OtherHashValue.superclass.constructor.call(this);var e=Error,r=k;r.lang.String.isHex;var n=r.asn1,i=n.DEROctetString;r.crypto.Util.hashHex,this.params=null,this.tohex=function(){var s=this.params;if(s.hash==null&&s.cert==null)throw new e("hash or cert not specified");var a=null;if(s.hash!=null)a=s.hash;else if(s.cert!=null){if(typeof s.cert!="string")throw new e("cert not string");var o=s.cert;s.cert.indexOf("-----BEGIN")!=-1&&(o=Or(s.cert)),a=k.crypto.Util.hashHex(o,"sha1")}return new i({hex:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},t!=null&&this.setByParam(t)};Ce(k.asn1.cades.OtherHashValue,k.asn1.ASN1Object);k.asn1.cades.SignatureTimeStamp=function(t){var e=Error,r=k,n=r.lang.String.isHex,i=r.asn1,s=i.ASN1Object;i.x509;var a=i.cades;a.SignatureTimeStamp.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.14",this.params=null,this.getValueArray=function(){var o=this.params;if(o.tst!=null)if(n(o.tst)){var c=new s;return c.hTLV=o.tst,[c]}else{if(o.tst instanceof s)return[o.tst];throw new e("params.tst has wrong value")}else if(o.res!=null){var u=o.res;if(u instanceof s&&(u=u.tohex()),typeof u!="string"||!n(u))throw new e("params.res has wrong value");Le.getTLVbyList(u,0,[1]);var c=new s;return c.hTLV=o.tst,[c]}},t!=null&&this.setByParam(t)};Ce(k.asn1.cades.SignatureTimeStamp,k.asn1.cms.Attribute);k.asn1.cades.CompleteCertificateRefs=function(t){var e=Error,r=k,n=r.asn1,i=n.DERSequence,s=n.cades,a=s.OtherCertID,o=r.lang.String.isHex;s.CompleteCertificateRefs.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.21",this.params=null,this.getValueArray=function(){for(var c=this.params,u=[],l=0;l"u"||!k.asn1.csr)&&(k.asn1.csr={});k.asn1.csr.CertificationRequest=function(t){var e=k,r=e.asn1,n=r.DERBitString,i=r.DERSequence,s=r.csr;r.x509;var a=s.CertificationRequestInfo;s.CertificationRequest.superclass.constructor.call(this),this.setByParam=function(o){this.params=o},this.sign=function(){var o=new a(this.params).tohex(),c=new k.crypto.Signature({alg:this.params.sigalg});c.init(this.params.sbjprvkey),c.updateHex(o);var u=c.sign();this.params.sighex=u},this.getPEM=function(){return Dn(this.tohex(),"CERTIFICATE REQUEST")},this.tohex=function(){var o=this.params,c=new k.asn1.csr.CertificationRequestInfo(this.params),u=new k.asn1.x509.AlgorithmIdentifier({name:o.sigalg});if(o.sighex==null&&o.sbjprvkey!=null&&this.sign(),o.sighex==null)throw new Error("sighex or sbjprvkey parameter not defined");var l=new n({hex:"00"+o.sighex}),f=new i({array:[c,u,l]});return f.tohex()},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&this.setByParam(t)};Ce(k.asn1.csr.CertificationRequest,k.asn1.ASN1Object);k.asn1.csr.CertificationRequestInfo=function(t){var e=k,r=e.asn1;r.DERBitString;var n=r.DERSequence,i=r.DERInteger,s=r.DERUTF8String,a=r.DERTaggedObject,o=r.ASN1Util.newObject,c=r.csr,u=r.x509,l=u.X500Name,f=u.Extensions,d=u.SubjectPublicKeyInfo;c.AttributeList,c.CertificationRequestInfo.superclass.constructor.call(this),this.params=null,this.setByParam=function(h){h!=null&&(this.params=h)},this.tohex=function(){var h=this.params,g=[];if(g.push(new i({int:0})),g.push(new l(h.subject)),g.push(new d(wt.getKey(h.sbjpubkey))),h.attrs!=null){var v=p(h.attrs),x=o({tag:{tage:"a0",obj:v}});g.push(x)}else if(h.extreq!=null){var b=new f(h.extreq),x=o({tag:{tage:"a0",obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[b]}]}}});g.push(x)}else g.push(new a({tag:"a0",explicit:!1,obj:new s({str:""})}));var S=new n({array:g});return S.tohex()},this.getEncodedHex=function(){return this.tohex()};function p(h){for(var g=Error,v=k.asn1.x509.Extensions,x=[],b=0;b"u"||!k)&&(k={});(typeof k.asn1>"u"||!k.asn1)&&(k.asn1={});(typeof k.asn1.ocsp>"u"||!k.asn1.ocsp)&&(k.asn1.ocsp={});k.asn1.ocsp.DEFAULT_HASH="sha1";k.asn1.ocsp.OCSPResponse=function(t){k.asn1.ocsp.OCSPResponse.superclass.constructor.call(this),k.asn1.DEREnumerated;var e=k.asn1.ASN1Util.newObject,r=k.asn1.ocsp.ResponseBytes,n=["successful","malformedRequest","internalError","tryLater","_not_used_","sigRequired","unauthorized"];this.params=null,this._getStatusCode=function(){var i=this.params.resstatus;return typeof i=="number"?i:typeof i!="string"?-1:n.indexOf(i)},this.setByParam=function(i){this.params=i},this.tohex=function(){var i=this.params,s=this._getStatusCode();if(s==-1)throw new Error("responseStatus not supported: "+i.resstatus);if(s!=0)return e({seq:[{enum:{int:s}}]}).tohex();var a=new r(i);return e({seq:[{enum:{int:0}},{tag:{tag:"a0",explicit:!0,obj:a}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&this.setByParam(t)};Ce(k.asn1.ocsp.OCSPResponse,k.asn1.ASN1Object);k.asn1.ocsp.ResponseBytes=function(t){k.asn1.ocsp.ResponseBytes.superclass.constructor.call(this);var e=k.asn1,r=e.DERSequence,n=e.DERObjectIdentifier,i=e.DEROctetString,s=e.ocsp.BasicOCSPResponse;this.params=null,this.setByParam=function(a){this.params=a},this.tohex=function(){var a=this.params;if(a.restype!="ocspBasic")throw new Error("not supported responseType: "+a.restype);var o=new s(a),c=[];c.push(new n({name:"ocspBasic"})),c.push(new i({hex:o.tohex()}));var u=new r({array:c});return u.tohex()},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&this.setByParam(t)};Ce(k.asn1.ocsp.ResponseBytes,k.asn1.ASN1Object);k.asn1.ocsp.BasicOCSPResponse=function(t){k.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var e=Error,r=k.asn1,n=r.ASN1Object,i=r.DERSequence;r.DERGeneralizedTime;var s=r.DERTaggedObject,a=r.DERBitString;r.x509.Extensions;var o=r.x509.AlgorithmIdentifier,c=r.ocsp;c.ResponderID,_SingleResponseList=c.SingleResponseList,_ResponseData=c.ResponseData,this.params=null,this.setByParam=function(u){this.params=u},this.sign=function(){var u=this.params,l=u.tbsresp.tohex(),f=new k.crypto.Signature({alg:u.sigalg});f.init(u.reskey),f.updateHex(l),u.sighex=f.sign()},this.tohex=function(){var u=this.params;u.tbsresp==null&&(u.tbsresp=new _ResponseData(u)),u.sighex==null&&u.reskey!=null&&this.sign();var l=[];if(l.push(u.tbsresp),l.push(new o({name:u.sigalg})),l.push(new a({hex:"00"+u.sighex})),u.certs!=null&&u.certs.length!=null){for(var f=[],d=0;d"u"||!k)&&(k={});(typeof k.lang>"u"||!k.lang)&&(k.lang={});k.lang.String=function(){};function oJ(t){for(var e=new Array,r=0;r>6,c=128|a&63;return zt(o.toString(16)+c.toString(16))}var o=224|(s&240)>>4,c=128|(s&15)<<2|(a&192)>>6,u=128|a&63;return zt(o.toString(16)+c.toString(16)+u.toString(16))}var r=t.match(/.{4}/g),n=r.map(e);return n.join("")}function XF(t){for(var e=encodeURIComponent(t),r="",n=0;n"7"?"00"+t:t}function mJ(t){var e=function(o){var c=o.toString(16);return c.length==1&&(c="0"+c),c},r=function(o){var c="",u=parseInt(o,10),l=u.toString(2),f=7-l.length%7;f==7&&(f=0);for(var d="",p=0;p0&&(u=u+"."+o.join(".")),u}catch{return null}}function vJ(t){var e=new oe(String(t),10);return c2(e)}function c2(t){var e=t.toString(16);if(e.substr(0,1)!="-")return e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e),e;var r=e.substr(1),n=r.length;n%2==1?n+=1:e.match(/^[0-7]/)||(n+=2);for(var i="",s=0;s=e?t:new Array(e-t.length+1).join(r)+t};function yJ(t){if(t.length%2!=0||(t=t.toLowerCase(),t.match(/^[0-9a-f]+$/)==null))return-1;try{var e=t.substr(0,2);if(e=="00")return parseInt(t.substr(2),16);var r=parseInt(e,16);if(r>7)return-1;var n=t.substr(2),i=parseInt(n,16).toString(2);i=="0"&&(i="00000000"),i=i.slice(0,0-r);var s=parseInt(i,2);return s==NaN?-1:s}catch{return-1}}function xJ(t){if(typeof t!="string"||t.length%2!=0||!t.match(/^[0-9a-f]+$/))return null;try{var e=parseInt(t.substr(0,2),16);if(e<0||7=0;n--)s+=i[n];return s}function Xt(t,n,r){if(typeof t=="object"){for(var n=String(n).split("."),i=0;i"u"||!k)&&(k={});(typeof k.crypto>"u"||!k.crypto)&&(k.crypto={});k.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:$e.algo.MD5,sha1:$e.algo.SHA1,sha224:$e.algo.SHA224,sha256:$e.algo.SHA256,sha384:$e.algo.SHA384,sha512:$e.algo.SHA512,ripemd160:$e.algo.RIPEMD160},this.getDigestInfoHex=function(t,e){if(typeof this.DIGESTINFOHEAD[e]>"u")throw"alg not supported in Util.DIGESTINFOHEAD: "+e;return this.DIGESTINFOHEAD[e]+t},this.getPaddedDigestInfoHex=function(t,e,r){var n=this.getDigestInfoHex(t,e),i=r/4;if(n.length+22>i)throw"key is too short for SigAlg: keylen="+r+","+e;for(var s="0001",a="00"+n,o="",c=i-s.length-a.length,u=0;u"u"||!k)&&(k={});(typeof k.crypto>"u"||!k.crypto)&&(k.crypto={});k.crypto.ECDSA=function(t){var e="secp256r1",r=Error,n=oe,i=Ut,s=k.crypto.ECDSA,a=k.crypto.ECParameterDB,o=s.getName,c=Le,u=c.getVbyListEx,l=c.isASN1HEX,f=new Jl;this.type="EC",this.isPrivate=!1,this.isPublic=!1,this.getBigRandom=function(d){return new n(d.bitLength(),f).mod(d.subtract(n.ONE)).add(n.ONE)},this.setNamedCurve=function(d){this.ecparams=a.getByName(d),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=d},this.setPrivateKeyHex=function(d){this.isPrivate=!0,this.prvKeyHex=d},this.setPublicKeyHex=function(d){this.isPublic=!0,this.pubKeyHex=d},this.getPublicKeyXYHex=function(){var d=this.pubKeyHex;if(d.substr(0,2)!=="04")throw"this method supports uncompressed format(04) only";var p=this.ecparams.keycharlen;if(d.length!==2+p*2)throw"malformed public key hex length";var h={};return h.x=d.substr(2,p),h.y=d.substr(2+p),h},this.getShortNISTPCurveName=function(){var d=this.curveName;return d==="secp256r1"||d==="NIST P-256"||d==="P-256"||d==="prime256v1"?"P-256":d==="secp384r1"||d==="NIST P-384"||d==="P-384"?"P-384":d==="secp521r1"||d==="NIST P-521"||d==="P-521"?"P-521":null},this.generateKeyPairHex=function(){var d=this.ecparams.n,p=this.getBigRandom(d),h=this.ecparams.keycharlen,g=("0000000000"+p.toString(16)).slice(-h);this.setPrivateKeyHex(g);var v=this.generatePublicKeyHex();return{ecprvhex:g,ecpubhex:v}},this.generatePublicKeyHex=function(){var d=new n(this.prvKeyHex,16),p=this.ecparams.G.multiply(d),h=p.getX().toBigInteger(),g=p.getY().toBigInteger(),v=this.ecparams.keycharlen,x=("0000000000"+h.toString(16)).slice(-v),b=("0000000000"+g.toString(16)).slice(-v),S="04"+x+b;return this.setPublicKeyHex(S),S},this.signWithMessageHash=function(d){return this.signHex(d,this.prvKeyHex)},this.signHex=function(d,p){var h=new n(p,16),g=this.ecparams.n,v=new n(d.substring(0,this.ecparams.keycharlen),16);do var x=this.getBigRandom(g),b=this.ecparams.G,S=b.multiply(x),_=S.getX().toBigInteger().mod(g);while(_.compareTo(n.ZERO)<=0);var P=x.modInverse(g).multiply(v.add(h.multiply(_))).mod(g);return s.biRSSigToASN1Sig(_,P)},this.sign=function(d,p){var h=p,g=this.ecparams.n,v=n.fromByteArrayUnsigned(d);do var x=this.getBigRandom(g),b=this.ecparams.G,S=b.multiply(x),_=S.getX().toBigInteger().mod(g);while(_.compareTo(oe.ZERO)<=0);var P=x.modInverse(g).multiply(v.add(h.multiply(_))).mod(g);return this.serializeSig(_,P)},this.verifyWithMessageHash=function(d,p){return this.verifyHex(d,p,this.pubKeyHex)},this.verifyHex=function(d,p,h){try{var g,v,x=s.parseSigHex(p);g=x.r,v=x.s;var b=i.decodeFromHex(this.ecparams.curve,h),S=new n(d.substring(0,this.ecparams.keycharlen),16);return this.verifyRaw(S,g,v,b)}catch{return!1}},this.verify=function(d,p,h){var g,v;if(Bitcoin.Util.isArray(p)){var x=this.parseSig(p);g=x.r,v=x.s}else if(typeof p=="object"&&p.r&&p.s)g=p.r,v=p.s;else throw"Invalid value for signature";var b;if(h instanceof Ut)b=h;else if(Bitcoin.Util.isArray(h))b=i.decodeFrom(this.ecparams.curve,h);else throw"Invalid format for pubkey value, must be byte array or ECPointFp";var S=n.fromByteArrayUnsigned(d);return this.verifyRaw(S,g,v,b)},this.verifyRaw=function(d,p,h,g){var v=this.ecparams.n,x=this.ecparams.G;if(p.compareTo(n.ONE)<0||p.compareTo(v)>=0||h.compareTo(n.ONE)<0||h.compareTo(v)>=0)return!1;var b=h.modInverse(v),S=d.multiply(b).mod(v),_=p.multiply(b).mod(v),P=x.multiply(S).add(g.multiply(_)),C=P.getX().toBigInteger().mod(v);return C.equals(p)},this.serializeSig=function(d,p){var h=d.toByteArraySigned(),g=p.toByteArraySigned(),v=[];return v.push(2),v.push(h.length),v=v.concat(h),v.push(2),v.push(g.length),v=v.concat(g),v.unshift(v.length),v.unshift(48),v},this.parseSig=function(d){var p;if(d[0]!=48)throw new Error("Signature not a valid DERSequence");if(p=2,d[p]!=2)throw new Error("First element in signature must be a DERInteger");var h=d.slice(p+2,p+2+d[p+1]);if(p+=2+d[p+1],d[p]!=2)throw new Error("Second element in signature must be a DERInteger");var g=d.slice(p+2,p+2+d[p+1]);p+=2+d[p+1];var v=n.fromByteArrayUnsigned(h),x=n.fromByteArrayUnsigned(g);return{r:v,s:x}},this.parseSigCompact=function(d){if(d.length!==65)throw"Signature has the wrong length";var p=d[0]-27;if(p<0||p>7)throw"Invalid signature type";var h=this.ecparams.n,g=n.fromByteArrayUnsigned(d.slice(1,33)).mod(h),v=n.fromByteArrayUnsigned(d.slice(33,65)).mod(h);return{r:g,s:v,i:p}},this.readPKCS5PrvKeyHex=function(d){if(l(d)===!1)throw new Error("not ASN.1 hex string");var p,h,g;try{p=u(d,0,["[0]",0],"06"),h=u(d,0,[1],"04");try{g=u(d,0,["[1]",0],"03")}catch{}}catch{throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=o(p),this.curveName===void 0)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(g),this.setPrivateKeyHex(h),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(d){if(l(d)===!1)throw new r("not ASN.1 hex string");var p,h,g,v;try{p=u(d,0,[1,0],"06"),h=u(d,0,[1,1],"06"),g=u(d,0,[2,0,1],"04");try{v=u(d,0,[2,0,"[1]",0],"03")}catch{}}catch{throw new r("malformed PKCS#8 plain ECC private key")}if(this.curveName=o(h),this.curveName===void 0)throw new r("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(v),this.setPrivateKeyHex(g),this.isPublic=!1},this.readPKCS8PubKeyHex=function(d){if(l(d)===!1)throw new r("not ASN.1 hex string");var p,h,g;try{p=u(d,0,[0,0],"06"),h=u(d,0,[0,1],"06"),g=u(d,0,[1],"03")}catch{throw new r("malformed PKCS#8 ECC public key")}if(this.curveName=o(h),this.curveName===null)throw new r("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(g)},this.readCertPubKeyHex=function(d,p){if(l(d)===!1)throw new r("not ASN.1 hex string");var h,g;try{h=u(d,0,[0,5,0,1],"06"),g=u(d,0,[0,5,1],"03")}catch{throw new r("malformed X.509 certificate ECC public key")}if(this.curveName=o(h),this.curveName===null)throw new r("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(g)},t!==void 0&&t.curve!==void 0&&(this.curveName=t.curve),this.curveName===void 0&&(this.curveName=e),this.setNamedCurve(this.curveName),t!==void 0&&(t.prv!==void 0&&this.setPrivateKeyHex(t.prv),t.pub!==void 0&&this.setPublicKeyHex(t.pub))};k.crypto.ECDSA.parseSigHex=function(t){var e=k.crypto.ECDSA.parseSigHexInHexRS(t),r=new oe(e.r,16),n=new oe(e.s,16);return{r,s:n}};k.crypto.ECDSA.parseSigHexInHexRS=function(t){var e=Le,r=e.getChildIdx,n=e.getV;if(e.checkStrictDER(t,0),t.substr(0,2)!="30")throw new Error("signature is not a ASN.1 sequence");var i=r(t,0);if(i.length!=2)throw new Error("signature shall have two elements");var s=i[0],a=i[1];if(t.substr(s,2)!="02")throw new Error("1st item not ASN.1 integer");if(t.substr(a,2)!="02")throw new Error("2nd item not ASN.1 integer");var o=n(t,s),c=n(t,a);return{r:o,s:c}};k.crypto.ECDSA.asn1SigToConcatSig=function(t){var e=k.crypto.ECDSA.parseSigHexInHexRS(t),r=e.r,n=e.s;if(r.length>=130&&r.length<=134){if(r.length%2!=0)throw Error("unknown ECDSA sig r length error");if(n.length%2!=0)throw Error("unknown ECDSA sig s length error");r.substr(0,2)=="00"&&(r=r.substr(2)),n.substr(0,2)=="00"&&(n=n.substr(2));var i=Math.max(r.length,n.length);return r=("000000"+r).slice(-i),n=("000000"+n).slice(-i),r+n}if(r.substr(0,2)=="00"&&r.length%32==2&&(r=r.substr(2)),n.substr(0,2)=="00"&&n.length%32==2&&(n=n.substr(2)),r.length%32==30&&(r="00"+r),n.length%32==30&&(n="00"+n),r.length%32!=0)throw Error("unknown ECDSA sig r length error");if(n.length%32!=0)throw Error("unknown ECDSA sig s length error");return r+n};k.crypto.ECDSA.concatSigToASN1Sig=function(t){if(t.length%4!=0)throw Error("unknown ECDSA concatinated r-s sig length error");var e=t.substr(0,t.length/2),r=t.substr(t.length/2);return k.crypto.ECDSA.hexRSSigToASN1Sig(e,r)};k.crypto.ECDSA.hexRSSigToASN1Sig=function(t,e){var r=new oe(t,16),n=new oe(e,16);return k.crypto.ECDSA.biRSSigToASN1Sig(r,n)};k.crypto.ECDSA.biRSSigToASN1Sig=function(t,e){var r=k.asn1,n=new r.DERInteger({bigint:t}),i=new r.DERInteger({bigint:e}),s=new r.DERSequence({array:[n,i]});return s.tohex()};k.crypto.ECDSA.getName=function(t){return t==="2b8104001f"?"secp192k1":t==="2a8648ce3d030107"?"secp256r1":t==="2b8104000a"?"secp256k1":t==="2b81040021"?"secp224r1":t==="2b81040022"?"secp384r1":t==="2b81040023"?"secp521r1":"|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(t)!==-1?"secp256r1":"|secp256k1|".indexOf(t)!==-1?"secp256k1":"|secp224r1|NIST P-224|P-224|".indexOf(t)!==-1?"secp224r1":"|secp384r1|NIST P-384|P-384|".indexOf(t)!==-1?"secp384r1":"|secp521r1|NIST P-521|P-521|".indexOf(t)!==-1?"secp521r1":null};(typeof k>"u"||!k)&&(k={});(typeof k.crypto>"u"||!k.crypto)&&(k.crypto={});k.crypto.ECParameterDB=new function(){var t={},e={};function r(n){return new oe(n,16)}this.getByName=function(n){var i=n;if(typeof e[i]<"u"&&(i=e[n]),typeof t[i]<"u")return t[i];throw"unregistered EC curve name: "+i},this.regist=function(n,i,s,a,o,c,u,l,f,d,p,h){t[n]={};var g=r(s),v=r(a),x=r(o),b=r(c),S=r(u),_=new yu(g,v,x),P=_.decodePointHex("04"+l+f);t[n].name=n,t[n].keylen=i,t[n].keycharlen=Math.ceil(i/8)*2,t[n].curve=_,t[n].G=P,t[n].n=b,t[n].h=S,t[n].oid=p,t[n].info=h;for(var C=0;C"u"||!k)&&(k={});(typeof k.crypto>"u"||!k.crypto)&&(k.crypto={});k.crypto.DSA=function(){var t=Le;t.getVbyList;var e=t.getVbyListEx,r=t.isASN1HEX,n=oe;this.p=null,this.q=null,this.g=null,this.y=null,this.x=null,this.type="DSA",this.isPrivate=!1,this.isPublic=!1,this.setPrivate=function(i,s,a,o,c){this.isPrivate=!0,this.p=i,this.q=s,this.g=a,this.y=o,this.x=c},this.setPrivateHex=function(i,s,a,o,c){var u,l,f,d,p;u=new oe(i,16),l=new oe(s,16),f=new oe(a,16),typeof o=="string"&&o.length>1?d=new oe(o,16):d=null,p=new oe(c,16),this.setPrivate(u,l,f,d,p)},this.setPublic=function(i,s,a,o){this.isPublic=!0,this.p=i,this.q=s,this.g=a,this.y=o,this.x=null},this.setPublicHex=function(i,s,a,o){var c,u,l,f;c=new oe(i,16),u=new oe(s,16),l=new oe(a,16),f=new oe(o,16),this.setPublic(c,u,l,f)},this.signWithMessageHash=function(i){var s=this.p,a=this.q,o=this.g;this.y;var c=this.x,u=k.crypto.Util.getRandomBigIntegerMinToMax(oe.ONE.add(oe.ONE),a.subtract(oe.ONE)),l=i.substr(0,a.bitLength()/4),f=new oe(l,16),d=o.modPow(u,s).mod(a),p=u.modInverse(a).multiply(f.add(c.multiply(d))).mod(a),h=k.asn1.ASN1Util.jsonToASN1HEX({seq:[{int:{bigint:d}},{int:{bigint:p}}]});return h},this.verifyWithMessageHash=function(i,s){var a=this.p,o=this.q,c=this.g,u=this.y,l=this.parseASN1Signature(s),f=l[0],d=l[1],p=i.substr(0,o.bitLength()/4),h=new oe(p,16);if(oe.ZERO.compareTo(f)>0||f.compareTo(o)>0||oe.ZERO.compareTo(d)>=0||d.compareTo(o)>0)throw"invalid DSA signature";var g=d.modInverse(o),v=h.multiply(g).mod(o),x=f.multiply(g).mod(o),b=c.modPow(v,a).multiply(u.modPow(x,a)).mod(a).mod(o);return b.compareTo(f)==0},this.parseASN1Signature=function(i){try{var s=new n(e(i,0,[0],"02"),16),a=new n(e(i,0,[1],"02"),16);return[s,a]}catch{throw new Error("malformed ASN.1 DSA signature")}},this.readPKCS5PrvKeyHex=function(i){var s,a,o,c,u;if(r(i)===!1)throw new Error("not ASN.1 hex string");try{s=e(i,0,[1],"02"),a=e(i,0,[2],"02"),o=e(i,0,[3],"02"),c=e(i,0,[4],"02"),u=e(i,0,[5],"02")}catch{throw new Error("malformed PKCS#1/5 plain DSA private key")}this.setPrivateHex(s,a,o,c,u)},this.readPKCS8PrvKeyHex=function(i){var s,a,o,c;if(r(i)===!1)throw new Error("not ASN.1 hex string");try{s=e(i,0,[1,1,0],"02"),a=e(i,0,[1,1,1],"02"),o=e(i,0,[1,1,2],"02"),c=e(i,0,[2,0],"02")}catch{throw new Error("malformed PKCS#8 plain DSA private key")}this.setPrivateHex(s,a,o,null,c)},this.readPKCS8PubKeyHex=function(i){var s,a,o,c;if(r(i)===!1)throw new Error("not ASN.1 hex string");try{s=e(i,0,[0,1,0],"02"),a=e(i,0,[0,1,1],"02"),o=e(i,0,[0,1,2],"02"),c=e(i,0,[1,0],"02")}catch{throw new Error("malformed PKCS#8 DSA public key")}this.setPublicHex(s,a,o,c)},this.readCertPubKeyHex=function(i,s){var a,o,c,u;if(r(i)===!1)throw new Error("not ASN.1 hex string");try{a=e(i,0,[0,5,0,1,0],"02"),o=e(i,0,[0,5,0,1,1],"02"),c=e(i,0,[0,5,0,1,2],"02"),u=e(i,0,[0,5,1,0],"02")}catch{throw new Error("malformed X.509 certificate DSA public key")}this.setPublicHex(a,o,c,u)}};var wt=function(){var t=function(h,g,v){return n($e.AES,h,g,v)},e=function(h,g,v){return n($e.TripleDES,h,g,v)},r=function(h,g,v){return n($e.DES,h,g,v)},n=function(h,g,v,x){var b=$e.enc.Hex.parse(g),S=$e.enc.Hex.parse(v),_=$e.enc.Hex.parse(x),P={};P.key=S,P.iv=_,P.ciphertext=b;var C=h.decrypt(P,S,{iv:_});return $e.enc.Hex.stringify(C)},i=function(h,g,v){return o($e.AES,h,g,v)},s=function(h,g,v){return o($e.TripleDES,h,g,v)},a=function(h,g,v){return o($e.DES,h,g,v)},o=function(h,g,v,x){var b=$e.enc.Hex.parse(g),S=$e.enc.Hex.parse(v),_=$e.enc.Hex.parse(x),P=h.encrypt(b,S,{iv:_}),C=$e.enc.Hex.parse(P.toString()),B=$e.enc.Base64.stringify(C);return B},c={"AES-256-CBC":{proc:t,eproc:i,keylen:32,ivlen:16},"AES-192-CBC":{proc:t,eproc:i,keylen:24,ivlen:16},"AES-128-CBC":{proc:t,eproc:i,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:e,eproc:s,keylen:24,ivlen:8},"DES-CBC":{proc:r,eproc:a,keylen:8,ivlen:8}},u=function(h){var g=$e.lib.WordArray.random(h),v=$e.enc.Hex.stringify(g);return v},l=function(h){var g={},v=h.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));v&&(g.cipher=v[1],g.ivsalt=v[2]);var x=h.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));x&&(g.type=x[1]);var b=-1,S=0;h.indexOf(`\r +\r +`)!=-1&&(b=h.indexOf(`\r +\r +`),S=2),h.indexOf(` + +`)!=-1&&(b=h.indexOf(` + +`),S=1);var _=h.indexOf("-----END");if(b!=-1&&_!=-1){var P=h.substring(b+S*2,_-S);P=P.replace(/\s+/g,""),g.data=P}return g},f=function(h,g,v){for(var x=v.substring(0,16),b=$e.enc.Hex.parse(x),S=$e.enc.Utf8.parse(g),_=c[h].keylen+c[h].ivlen,P="",C=null;;){var B=$e.algo.MD5.create();if(C!=null&&B.update(C),B.update(S),B.update(b),C=B.finalize(),P=P+$e.enc.Hex.stringify(C),P.length>=_*2)break}var N={};return N.keyhex=P.substr(0,c[h].keylen*2),N.ivhex=P.substr(c[h].keylen*2,c[h].ivlen*2),N},d=function(h,g,v,x){var b=$e.enc.Base64.parse(h),S=$e.enc.Hex.stringify(b),_=c[g].proc,P=_(S,v,x);return P},p=function(h,g,v,x){var b=c[g].eproc,S=b(h,v,x);return S};return{version:"1.0.0",parsePKCS5PEM:function(h){return l(h)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(h,g,v){return f(h,g,v)},decryptKeyB64:function(h,g,v,x){return d(h,g,v,x)},getDecryptedKeyHex:function(h,g){var v=l(h),x=v.cipher,b=v.ivsalt,S=v.data,_=f(x,g,b),P=_.keyhex,C=d(S,x,P,b);return C},getEncryptedPKCS5PEMFromPrvKeyHex:function(h,g,v,x,b){var T="";if((typeof x>"u"||x==null)&&(x="AES-256-CBC"),typeof c[x]>"u")throw new Error("KEYUTIL unsupported algorithm: "+x);if(typeof b>"u"||b==null){var S=c[x].ivlen,_=u(S);b=_.toUpperCase()}var P=f(x,v,b),C=P.keyhex,B=p(g,x,C,b),N=B.replace(/(.{64})/g,`$1\r +`),T="-----BEGIN "+h+` PRIVATE KEY-----\r +`;return T+=`Proc-Type: 4,ENCRYPTED\r +`,T+="DEK-Info: "+x+","+b+`\r +`,T+=`\r +`,T+=N,T+=`\r +-----END `+h+` PRIVATE KEY-----\r +`,T},getEncryptedPKCS8PEM:function(h,g,v){var x=this.getEncryptedPKCS8Hex(h,g,v);return Dn(x,"ENCRYPTED PRIVATE KEY")},getEncryptedPKCS8Hex:function(h,g,v){var x;v==null||v==null?x={}:x=JSON.parse(JSON.stringify(v)),x.plain=h,this.initPBES2Param(x),this.encryptPBES2Param(x,g);var b=this.generatePBES2ASN1Param(x);return k.asn1.ASN1Util.newObject(b).tohex()},initPBES2Param:function(h){if(Xt(h,"encalg")==null&&(h.encalg="aes256-CBC"),Xt(h,"iter")==null&&(h.iter=2048),Xt(h,"prf")==null&&(h.prf="hmacWithSHA256"),Xt(h,"salt")==null&&(h.salt=$e.enc.Hex.stringify($e.lib.WordArray.random(8))),Xt(h,"enciv")==null){var g;h.encalg=="des-EDE3-CBC"&&(g=8),h.encalg=="aes128-CBC"&&(g=16),h.encalg=="aes256-CBC"&&(g=16),h.enciv=$e.enc.Hex.stringify($e.lib.WordArray.random(g))}},encryptPBES2Param:function(h,g){var v=wt.getDKFromPBES2Param(h,g);try{var x=k.crypto.Cipher.encrypt(h.plain,v,h.encalg,{iv:h.enciv})}catch{throw new Error("encrypt error: "+h.plain+" "+v+" "+h.encalg+" "+h.enciv)}h.enc=x},generatePBES2ASN1Param:function(h){var g={seq:[{seq:[{oid:"pkcs5PBES2"},{seq:[{seq:[{oid:"pkcs5PBKDF2"},{seq:[{octstr:{hex:h.salt}},{int:{hex:vJ(h.iter)}}]}]},{seq:[{oid:h.encalg},{octstr:{hex:h.enciv}}]}]}]},{octstr:{hex:h.enc}}]};return h.prf!="hmacWithSHA1"&&g.seq[0].seq[1].seq[0].seq[1].seq.push({seq:[{oid:h.prf},{null:""}]}),g},parseHexOfEncryptedPKCS8:function(h){var g=Le,v=g.getChildIdx,x=g.getV,b={},S=v(h,0);if(S.length!=2)throw new Error("malformed format: SEQUENCE(0).items != 2: "+S.length);b.ciphertext=x(h,S[1]);var _=v(h,S[0]);if(_.length!=2)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+_.length);if(x(h,_[0])!="2a864886f70d01050d")throw new Error("this only supports pkcs5PBES2");var P=v(h,_[1]);if(_.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+P.length);var C=v(h,P[1]);if(C.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+C.length);if(x(h,C[0])!="2a864886f70d0307")throw"this only supports TripleDES";b.encryptionSchemeAlg="TripleDES",b.encryptionSchemeIV=x(h,C[1]);var B=v(h,P[0]);if(B.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+B.length);if(x(h,B[0])!="2a864886f70d01050c")throw new Error("this only supports pkcs5PBKDF2");var N=v(h,B[1]);if(N.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+N.length);b.pbkdf2Salt=x(h,N[0]);var T=x(h,N[1]);try{b.pbkdf2Iter=parseInt(T,16)}catch{throw new Error("malformed format pbkdf2Iter: "+T)}return b},getPBKDF2KeyHexFromParam:function(h,g){var v=$e.enc.Hex.parse(h.pbkdf2Salt),x=h.pbkdf2Iter,b=$e.PBKDF2(g,v,{keySize:192/32,iterations:x}),S=$e.enc.Hex.stringify(b);return S},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(h,g){var v=Or(h,"ENCRYPTED PRIVATE KEY"),x=this.parseHexOfEncryptedPKCS8(v),b=wt.getPBKDF2KeyHexFromParam(x,g),S={};S.ciphertext=$e.enc.Hex.parse(x.ciphertext);var _=$e.enc.Hex.parse(b),P=$e.enc.Hex.parse(x.encryptionSchemeIV),C=$e.TripleDES.decrypt(S,_,{iv:P}),B=$e.enc.Hex.stringify(C);return B},parsePBES2:function(h){var g=Le.parse(h);if(Xt(g,"seq.0.seq.0.oid")!="pkcs5PBES2"||Xt(g,"seq.0.seq.1.seq.0.seq.0.oid")!="pkcs5PBKDF2")throw new Error("not pkcs5PBES2 and pkcs5PBKDF2 used");var v=Xt(g,"seq.0.seq.1.seq.0.seq.1.seq");if(v==null)throw new Error("PBKDF2 parameter not found");var x=Xt(v,"0.octstr.hex"),b=Xt(v,"1.int.hex"),S=Xt(v,"2.seq.0.oid","hmacWithSHA1"),_=-1;try{_=parseInt(b,16)}catch{throw new Error("iter not proper value")}var P=Xt(g,"seq.0.seq.1.seq.1.seq.0.oid"),C=Xt(g,"seq.0.seq.1.seq.1.seq.1.octstr.hex"),B=Xt(g,"seq.1.octstr.hex");if(P==null||C==null||B==null)throw new Error("encalg, enciv or enc is undefined");var N={salt:x,iter:_,prf:S,encalg:P,enciv:C,enc:B};return N},getDKFromPBES2Param:function(h,g){var v={hmacWithSHA1:$e.algo.SHA1,hmacWithSHA224:$e.algo.SHA224,hmacWithSHA256:$e.algo.SHA256,hmacWithSHA384:$e.algo.SHA384,hmacWithSHA512:$e.algo.SHA512},x={"des-EDE3-CBC":192/32,"aes128-CBC":128/32,"aes256-CBC":256/32},b=v[h.prf];if(b==null)throw new Error("unsupported prf");var S=x[h.encalg];if(S==null)throw new Error("unsupported encalg");var _=$e.enc.Hex.parse(h.salt),P=h.iter;try{var C=$e.PBKDF2(g,_,{keySize:S,iterations:P,hasher:b});return $e.enc.Hex.stringify(C)}catch(B){throw new Error("PBKDF2 error: "+B+" "+JSON.stringify(h)+" "+g)}},getPlainHexFromEncryptedPKCS8PEM:function(h,g){if(h.indexOf("BEGIN ENCRYPTED PRIVATE KEY")==-1)throw new Error("not Encrypted PKCS#8 PEM string");var v=Or(h),x;try{x=wt.parsePBES2(v)}catch(S){throw new Error("malformed PBES2 format: "+S.message)}var b=wt.getDKFromPBES2Param(x,g);return k.crypto.Cipher.decrypt(x.enc,b,x.encalg,{iv:x.enciv})},getKeyFromEncryptedPKCS8PEM:function(h,g){var v=this.getPlainHexFromEncryptedPKCS8PEM(h,g),x=this.getKeyFromPlainPrivatePKCS8Hex(v);return x},parsePlainPrivatePKCS8Hex:function(h){var g=Le,v=g.getChildIdx,x=g.getV,b={};if(b.algparam=null,h.substr(0,2)!="30")throw new Error("malformed plain PKCS8 private key(code:001)");var S=v(h,0);if(S.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if(h.substr(S[1],2)!="30")throw new Error("malformed PKCS8 private key(code:003)");var _=v(h,S[1]);if(_.length!=2)throw new Error("malformed PKCS8 private key(code:004)");if(h.substr(_[0],2)!="06")throw new Error("malformed PKCS8 private key(code:005)");if(b.algoid=x(h,_[0]),h.substr(_[1],2)=="06"&&(b.algparam=x(h,_[1])),h.substr(S[2],2)!="04")throw new Error("malformed PKCS8 private key(code:006)");return b.keyidx=g.getVidx(h,S[2]),b},getKeyFromPlainPrivatePKCS8PEM:function(h){var g=Or(h,"PRIVATE KEY"),v=this.getKeyFromPlainPrivatePKCS8Hex(g);return v},getKeyFromPlainPrivatePKCS8Hex:function(h){var g=this.parsePlainPrivatePKCS8Hex(h),v;if(g.algoid=="2a864886f70d010101")v=new at;else if(g.algoid=="2a8648ce380401")v=new k.crypto.DSA;else if(g.algoid=="2a8648ce3d0201")v=new k.crypto.ECDSA;else throw new Error("unsupported private key algorithm");return v.readPKCS8PrvKeyHex(h),v},_getKeyFromPublicPKCS8Hex:function(h){var g,v=Le.getVbyList(h,0,[0,0],"06");if(v==="2a864886f70d010101")g=new at;else if(v==="2a8648ce380401")g=new k.crypto.DSA;else if(v==="2a8648ce3d0201")g=new k.crypto.ECDSA;else throw new Error("unsupported PKCS#8 public key hex");return g.readPKCS8PubKeyHex(h),g},parsePublicRawRSAKeyHex:function(h){var g=Le,v=g.getChildIdx,x=g.getV,b={};if(h.substr(0,2)!="30")throw new Error("malformed RSA key(code:001)");var S=v(h,0);if(S.length!=2)throw new Error("malformed RSA key(code:002)");if(h.substr(S[0],2)!="02")throw new Error("malformed RSA key(code:003)");if(b.n=x(h,S[0]),h.substr(S[1],2)!="02")throw new Error("malformed RSA key(code:004)");return b.e=x(h,S[1]),b},parsePublicPKCS8Hex:function(h){var g=Le,v=g.getChildIdx,x=g.getV,b={};b.algparam=null;var S=v(h,0);if(S.length!=2)throw new Error("outer DERSequence shall have 2 elements: "+S.length);var _=S[0];if(h.substr(_,2)!="30")throw new Error("malformed PKCS8 public key(code:001)");var P=v(h,_);if(P.length!=2)throw new Error("malformed PKCS8 public key(code:002)");if(h.substr(P[0],2)!="06")throw new Error("malformed PKCS8 public key(code:003)");if(b.algoid=x(h,P[0]),h.substr(P[1],2)=="06"?b.algparam=x(h,P[1]):h.substr(P[1],2)=="30"&&(b.algparam={},b.algparam.p=g.getVbyList(h,P[1],[0],"02"),b.algparam.q=g.getVbyList(h,P[1],[1],"02"),b.algparam.g=g.getVbyList(h,P[1],[2],"02")),h.substr(S[1],2)!="03")throw new Error("malformed PKCS8 public key(code:004)");return b.key=x(h,S[1]).substr(2),b}}}();wt.getKey=function(t,e,r){var n=Le,i=n.getChildIdx;n.getV;var s=n.getVbyList,a=k.crypto,o=a.ECDSA,c=a.DSA,u=at,l=Or,f=wt;if(typeof u<"u"&&t instanceof u||typeof o<"u"&&t instanceof o||typeof c<"u"&&t instanceof c)return t;if(t.curve!==void 0&&t.xy!==void 0&&t.d===void 0)return new o({pub:t.xy,curve:t.curve});if(t.curve!==void 0&&t.d!==void 0)return new o({prv:t.d,curve:t.curve});if(t.kty===void 0&&t.n!==void 0&&t.e!==void 0&&t.d===void 0){var d=new u;return d.setPublic(t.n,t.e),d}if(t.kty===void 0&&t.n!==void 0&&t.e!==void 0&&t.d!==void 0&&t.p!==void 0&&t.q!==void 0&&t.dp!==void 0&&t.dq!==void 0&&t.co!==void 0&&t.qi===void 0){var d=new u;return d.setPrivateEx(t.n,t.e,t.d,t.p,t.q,t.dp,t.dq,t.co),d}if(t.kty===void 0&&t.n!==void 0&&t.e!==void 0&&t.d!==void 0&&t.p===void 0){var d=new u;return d.setPrivate(t.n,t.e,t.d),d}if(t.p!==void 0&&t.q!==void 0&&t.g!==void 0&&t.y!==void 0&&t.x===void 0){var d=new c;return d.setPublic(t.p,t.q,t.g,t.y),d}if(t.p!==void 0&&t.q!==void 0&&t.g!==void 0&&t.y!==void 0&&t.x!==void 0){var d=new c;return d.setPrivate(t.p,t.q,t.g,t.y,t.x),d}if(t.kty==="RSA"&&t.n!==void 0&&t.e!==void 0&&t.d===void 0){var d=new u;return d.setPublic(fr(t.n),fr(t.e)),d}if(t.kty==="RSA"&&t.n!==void 0&&t.e!==void 0&&t.d!==void 0&&t.p!==void 0&&t.q!==void 0&&t.dp!==void 0&&t.dq!==void 0&&t.qi!==void 0){var d=new u;return d.setPrivateEx(fr(t.n),fr(t.e),fr(t.d),fr(t.p),fr(t.q),fr(t.dp),fr(t.dq),fr(t.qi)),d}if(t.kty==="RSA"&&t.n!==void 0&&t.e!==void 0&&t.d!==void 0){var d=new u;return d.setPrivate(fr(t.n),fr(t.e),fr(t.d)),d}if(t.kty==="EC"&&t.crv!==void 0&&t.x!==void 0&&t.y!==void 0&&t.d===void 0){var p=new o({curve:t.crv}),h=p.ecparams.keycharlen,g=("0000000000"+fr(t.x)).slice(-h),v=("0000000000"+fr(t.y)).slice(-h),x="04"+g+v;return p.setPublicKeyHex(x),p}if(t.kty==="EC"&&t.crv!==void 0&&t.x!==void 0&&t.y!==void 0&&t.d!==void 0){var p=new o({curve:t.crv}),h=p.ecparams.keycharlen,g=("0000000000"+fr(t.x)).slice(-h),v=("0000000000"+fr(t.y)).slice(-h),x="04"+g+v,b=("0000000000"+fr(t.d)).slice(-h);return p.setPublicKeyHex(x),p.setPrivateKeyHex(b),p}if(r==="pkcs5prv"){var S=t,n=Le,_,d;if(_=i(S,0),_.length===9)d=new u,d.readPKCS5PrvKeyHex(S);else if(_.length===6)d=new c,d.readPKCS5PrvKeyHex(S);else if(_.length>2&&S.substr(_[1],2)==="04")d=new o,d.readPKCS5PrvKeyHex(S);else throw new Error("unsupported PKCS#1/5 hexadecimal key");return d}if(r==="pkcs8prv"){var d=f.getKeyFromPlainPrivatePKCS8Hex(t);return d}if(r==="pkcs8pub")return f._getKeyFromPublicPKCS8Hex(t);if(r==="x509pub")return ft.getPublicKeyFromCertHex(t);if(t.indexOf("-END CERTIFICATE-",0)!=-1||t.indexOf("-END X509 CERTIFICATE-",0)!=-1||t.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1)return ft.getPublicKeyFromCertPEM(t);if(t.indexOf("-END PUBLIC KEY-")!=-1){var P=Or(t,"PUBLIC KEY");return f._getKeyFromPublicPKCS8Hex(P)}if(t.indexOf("-END RSA PRIVATE KEY-")!=-1&&t.indexOf("4,ENCRYPTED")==-1){var C=l(t,"RSA PRIVATE KEY");return f.getKey(C,null,"pkcs5prv")}if(t.indexOf("-END DSA PRIVATE KEY-")!=-1&&t.indexOf("4,ENCRYPTED")==-1){var B=l(t,"DSA PRIVATE KEY"),N=s(B,0,[1],"02"),T=s(B,0,[2],"02"),D=s(B,0,[3],"02"),R=s(B,0,[4],"02"),E=s(B,0,[5],"02"),d=new c;return d.setPrivate(new oe(N,16),new oe(T,16),new oe(D,16),new oe(R,16),new oe(E,16)),d}if(t.indexOf("-END EC PRIVATE KEY-")!=-1&&t.indexOf("4,ENCRYPTED")==-1){var C=l(t,"EC PRIVATE KEY");return f.getKey(C,null,"pkcs5prv")}if(t.indexOf("-END PRIVATE KEY-")!=-1)return f.getKeyFromPlainPrivatePKCS8PEM(t);if(t.indexOf("-END RSA PRIVATE KEY-")!=-1&&t.indexOf("4,ENCRYPTED")!=-1){var F=f.getDecryptedKeyHex(t,e),A=new at;return A.readPKCS5PrvKeyHex(F),A}if(t.indexOf("-END EC PRIVATE KEY-")!=-1&&t.indexOf("4,ENCRYPTED")!=-1){var B=f.getDecryptedKeyHex(t,e),d=s(B,0,[1],"04"),I=s(B,0,[2,0],"06"),j=s(B,0,[3,0],"03").substr(2),$="";if(k.crypto.OID.oidhex2name[I]!==void 0)$=k.crypto.OID.oidhex2name[I];else throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+I);var p=new o({curve:$});return p.setPublicKeyHex(j),p.setPrivateKeyHex(d),p.isPublic=!1,p}if(t.indexOf("-END DSA PRIVATE KEY-")!=-1&&t.indexOf("4,ENCRYPTED")!=-1){var B=f.getDecryptedKeyHex(t,e),N=s(B,0,[1],"02"),T=s(B,0,[2],"02"),D=s(B,0,[3],"02"),R=s(B,0,[4],"02"),E=s(B,0,[5],"02"),d=new c;return d.setPrivate(new oe(N,16),new oe(T,16),new oe(D,16),new oe(R,16),new oe(E,16)),d}if(t.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1)return f.getKeyFromEncryptedPKCS8PEM(t,e);throw new Error("not supported argument")};wt.generateKeypair=function(t,e){if(t=="RSA"){var r=e,n=new at;n.generate(r,"10001"),n.isPrivate=!0,n.isPublic=!0;var i=new at,s=n.n.toString(16),a=n.e.toString(16);i.setPublic(s,a),i.isPrivate=!1,i.isPublic=!0;var o={};return o.prvKeyObj=n,o.pubKeyObj=i,o}else if(t=="EC"){var c=e,u=new k.crypto.ECDSA({curve:c}),l=u.generateKeyPairHex(),n=new k.crypto.ECDSA({curve:c});n.setPublicKeyHex(l.ecpubhex),n.setPrivateKeyHex(l.ecprvhex),n.isPrivate=!0,n.isPublic=!1;var i=new k.crypto.ECDSA({curve:c});i.setPublicKeyHex(l.ecpubhex),i.isPrivate=!1,i.isPublic=!0;var o={};return o.prvKeyObj=n,o.pubKeyObj=i,o}else throw new Error("unknown algorithm: "+t)};wt.getPEM=function(t,e,r,n,i,s){var a=k,o=a.asn1,c=o.DERObjectIdentifier,u=o.DERInteger,l=o.ASN1Util.newObject,f=o.x509,d=f.SubjectPublicKeyInfo,p=a.crypto,h=p.DSA,g=p.ECDSA,v=at;function x(I){var j=l({seq:[{int:0},{int:{bigint:I.n}},{int:I.e},{int:{bigint:I.d}},{int:{bigint:I.p}},{int:{bigint:I.q}},{int:{bigint:I.dmp1}},{int:{bigint:I.dmq1}},{int:{bigint:I.coeff}}]});return j}function b(I){var j=l({seq:[{int:1},{octstr:{hex:I.prvKeyHex}},{tag:["a0",!0,{oid:{name:I.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+I.pubKeyHex}}]}]});return j}function S(I){var j=l({seq:[{int:0},{int:{bigint:I.p}},{int:{bigint:I.q}},{int:{bigint:I.g}},{int:{bigint:I.y}},{int:{bigint:I.x}}]});return j}if((v!==void 0&&t instanceof v||h!==void 0&&t instanceof h||g!==void 0&&t instanceof g)&&t.isPublic==!0&&(e===void 0||e=="PKCS8PUB")){var _=new d(t),P=_.tohex();return Dn(P,"PUBLIC KEY")}if(e=="PKCS1PRV"&&v!==void 0&&t instanceof v&&(r===void 0||r==null)&&t.isPrivate==!0){var _=x(t),P=_.tohex();return Dn(P,"RSA PRIVATE KEY")}if(e=="PKCS1PRV"&&g!==void 0&&t instanceof g&&(r===void 0||r==null)&&t.isPrivate==!0){var C=new c({name:t.curveName}),B=C.tohex(),N=b(t),T=N.tohex(),D="";return D+=Dn(B,"EC PARAMETERS"),D+=Dn(T,"EC PRIVATE KEY"),D}if(e=="PKCS1PRV"&&h!==void 0&&t instanceof h&&(r===void 0||r==null)&&t.isPrivate==!0){var _=S(t),P=_.tohex();return Dn(P,"DSA PRIVATE KEY")}if(e=="PKCS5PRV"&&v!==void 0&&t instanceof v&&r!==void 0&&r!=null&&t.isPrivate==!0){var _=x(t),P=_.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",P,r,n,s)}if(e=="PKCS5PRV"&&g!==void 0&&t instanceof g&&r!==void 0&&r!=null&&t.isPrivate==!0){var _=b(t),P=_.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",P,r,n,s)}if(e=="PKCS5PRV"&&h!==void 0&&t instanceof h&&r!==void 0&&r!=null&&t.isPrivate==!0){var _=S(t),P=_.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",P,r,n,s)}var R=function(I,j){if(typeof j=="string")return wt.getEncryptedPKCS8PEM(I,j);if(typeof j=="object"&&Xt(j,"passcode")!=null){var $=JSON.parse(JSON.stringify(j)),W=$.passcode;return delete $.passcode,wt.getEncryptedPKCS8PEM(I,W,$)}};if(e=="PKCS8PRV"&&v!=null&&t instanceof v&&t.isPrivate==!0){var E=x(t),F=E.tohex(),_=l({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:F}}]}),P=_.tohex();return r===void 0||r==null?Dn(P,"PRIVATE KEY"):R(P,r)}if(e=="PKCS8PRV"&&g!==void 0&&t instanceof g&&t.isPrivate==!0){var A={seq:[{int:1},{octstr:{hex:t.prvKeyHex}}]};typeof t.pubKeyHex=="string"&&A.seq.push({tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]});var E=new l(A),F=E.tohex(),_=l({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:t.curveName}}]},{octstr:{hex:F}}]}),P=_.tohex();return r===void 0||r==null?Dn(P,"PRIVATE KEY"):R(P,r)}if(e=="PKCS8PRV"&&h!==void 0&&t instanceof h&&t.isPrivate==!0){var E=new u({bigint:t.x}),F=E.tohex(),_=l({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]}]},{octstr:{hex:F}}]}),P=_.tohex();return r===void 0||r==null?Dn(P,"PRIVATE KEY"):R(P,r)}throw new Error("unsupported object nor format")};wt.getKeyFromCSRPEM=function(t){var e=Or(t,"CERTIFICATE REQUEST"),r=wt.getKeyFromCSRHex(e);return r};wt.getKeyFromCSRHex=function(t){var e=wt.parseCSRHex(t),r=wt.getKey(e.p8pubkeyhex,null,"pkcs8pub");return r};wt.parseCSRHex=function(t){var e=Le,r=e.getChildIdx,n=e.getTLV,i={},s=t;if(s.substr(0,2)!="30")throw new Error("malformed CSR(code:001)");var a=r(s,0);if(a.length<1)throw new Error("malformed CSR(code:002)");if(s.substr(a[0],2)!="30")throw new Error("malformed CSR(code:003)");var o=r(s,a[0]);if(o.length<3)throw new Error("malformed CSR(code:004)");return i.p8pubkeyhex=n(s,o[2]),i};wt.getKeyID=function(t){var e=wt,r=Le;typeof t=="string"&&t.indexOf("BEGIN ")!=-1&&(t=e.getKey(t));var n=Or(e.getPEM(t)),i=r.getIdxbyList(n,0,[1]),s=r.getV(n,i).substring(2);return k.crypto.Util.hashHex(s,"sha1")};wt.getJWK=function(t,e,r,n,i){var s,a={},o,c=k.crypto.Util.hashHex;if(typeof t=="string")s=wt.getKey(t),t.indexOf("CERTIFICATE")!=-1&&(o=Or(t));else if(typeof t=="object")t instanceof ft?(s=t.getPublicKey(),o=t.hex):s=t;else throw new Error("unsupported keyinfo type");if(s instanceof at&&s.isPrivate)a.kty="RSA",a.n=qr(s.n.toString(16)),a.e=qr(s.e.toString(16)),a.d=qr(s.d.toString(16)),a.p=qr(s.p.toString(16)),a.q=qr(s.q.toString(16)),a.dp=qr(s.dmp1.toString(16)),a.dq=qr(s.dmq1.toString(16)),a.qi=qr(s.coeff.toString(16));else if(s instanceof at&&s.isPublic)a.kty="RSA",a.n=qr(s.n.toString(16)),a.e=qr(s.e.toString(16));else if(s instanceof k.crypto.ECDSA&&s.isPrivate){var u=s.getShortNISTPCurveName();if(u!=="P-256"&&u!=="P-384"&&u!=="P-521")throw new Error("unsupported curve name for JWT: "+u);var l=s.getPublicKeyXYHex();a.kty="EC",a.crv=u,a.x=qr(l.x),a.y=qr(l.y),a.d=qr(s.prvKeyHex)}else if(s instanceof k.crypto.ECDSA&&s.isPublic){var u=s.getShortNISTPCurveName();if(u!=="P-256"&&u!=="P-384"&&u!=="P-521")throw new Error("unsupported curve name for JWT: "+u);var l=s.getPublicKeyXYHex();a.kty="EC",a.crv=u,a.x=qr(l.x),a.y=qr(l.y)}if(a.kty==null)throw new Error("unsupported keyinfo");return!s.isPrivate&&e!=!0&&(a.kid=k.jws.JWS.getJWKthumbprint(a)),o!=null&&r!=!0&&(a.x5c=[np(o)]),o!=null&&n!=!0&&(a.x5t=Ev(np(c(o,"sha1")))),o!=null&&i!=!0&&(a["x5t#S256"]=Ev(np(c(o,"sha256")))),a};wt.getJWKFromKey=function(t){return wt.getJWK(t,!0,!0,!0,!0)};at.getPosArrayOfChildrenFromHex=function(t){return Le.getChildIdx(t,0)};at.getHexValueArrayOfChildrenFromHex=function(t){var e=Le,r=e.getV,d=at.getPosArrayOfChildrenFromHex(t),n=r(t,d[0]),i=r(t,d[1]),s=r(t,d[2]),a=r(t,d[3]),o=r(t,d[4]),c=r(t,d[5]),u=r(t,d[6]),l=r(t,d[7]),f=r(t,d[8]),d=new Array;return d.push(n,i,s,a,o,c,u,l,f),d};at.prototype.readPrivateKeyFromPEMString=function(t){var e=Or(t),r=at.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])};at.prototype.readPKCS5PrvKeyHex=function(t){var e=at.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])};at.prototype.readPKCS8PrvKeyHex=function(t){var e,r,n,i,s,a,o,c,u=Le,l=u.getVbyListEx;if(u.isASN1HEX(t)===!1)throw new Error("not ASN.1 hex string");try{e=l(t,0,[2,0,1],"02"),r=l(t,0,[2,0,2],"02"),n=l(t,0,[2,0,3],"02"),i=l(t,0,[2,0,4],"02"),s=l(t,0,[2,0,5],"02"),a=l(t,0,[2,0,6],"02"),o=l(t,0,[2,0,7],"02"),c=l(t,0,[2,0,8],"02")}catch{throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(e,r,n,i,s,a,o,c)};at.prototype.readPKCS5PubKeyHex=function(t){var e=Le,r=e.getV;if(e.isASN1HEX(t)===!1)throw new Error("keyHex is not ASN.1 hex string");var n=e.getChildIdx(t,0);if(n.length!==2||t.substr(n[0],2)!=="02"||t.substr(n[1],2)!=="02")throw new Error("wrong hex for PKCS#5 public key");var i=r(t,n[0]),s=r(t,n[1]);this.setPublic(i,s)};at.prototype.readPKCS8PubKeyHex=function(t){var e=Le;if(e.isASN1HEX(t)===!1)throw new Error("not ASN.1 hex string");if(e.getTLVbyListEx(t,0,[0,0])!=="06092a864886f70d010101")throw new Error("not PKCS8 RSA public key");var r=e.getTLVbyListEx(t,0,[1,0]);this.readPKCS5PubKeyHex(r)};at.prototype.readCertPubKeyHex=function(t,e){var r,n;r=new ft,r.readCertHex(t),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)};function eP(t,e){for(var r="",n=e/4-t.length,i=0;i>24,(i&16711680)>>16,(i&65280)>>8,i&255])))),i+=1;return n}at.prototype.signPSS=function(t,e,r){var n=function(s){return k.crypto.Util.hashHex(s,e)},i=n(Ws(t));return r===void 0&&(r=-1),this.signWithMessageHashPSS(i,e,r)};at.prototype.signWithMessageHashPSS=function(t,e,r){var n=is(t),i=n.length,s=this.n.bitLength()-1,a=Math.ceil(s/8),o,c=function(v){return k.crypto.Util.hashHex(v,e)};if(r===-1||r===void 0)r=i;else if(r===-2)r=a-i-2;else if(r<-2)throw new Error("invalid salt length");if(a0&&(u=new Array(r),new Jl().nextBytes(u),u=String.fromCharCode.apply(String,u));var l=is(c(Ws("\0\0\0\0\0\0\0\0"+n+u))),f=[];for(o=0;o>8*a-s&255;for(h[0]&=~g,o=0;on)return!1;var i=this.doPublic(r),s=i.toString(16);if(s.length+3!=n/4)return!1;var a=s.replace(/^1f+00/,""),o=rP(a);if(o.length==0)return!1;var c=o[0],u=o[1],l=function(d){return k.crypto.Util.hashString(d,c)},f=l(t);return u==f};at.prototype.verifyWithMessageHash=function(t,e){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=En(e,16);if(r.bitLength()>this.n.bitLength())return 0;var n=this.doPublic(r),i=n.toString(16).replace(/^1f+00/,""),s=rP(i);if(s.length==0)return!1;s[0];var a=s[1];return a==t};at.prototype.verifyPSS=function(t,e,r,n){var i=function(a){return k.crypto.Util.hashHex(a,r)},s=i(Ws(t));return n===void 0&&(n=-1),this.verifyWithMessageHashPSS(s,e,r,n)};at.prototype.verifyWithMessageHashPSS=function(t,e,r,n){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var i=new oe(e,16),s=function(b){return k.crypto.Util.hashHex(b,r)},a=is(t),o=a.length,c=this.n.bitLength()-1,u=Math.ceil(c/8),l;if(n===-1||n===void 0)n=o;else if(n===-2)n=u-o-2;else if(n<-2)throw new Error("invalid salt length");if(u>8*u-c&255;if(d.charCodeAt(0)&h)throw new Error("bits beyond keysize not zero");var g=tP(p,d.length,s),v=[];for(l=0;l0?B:void 0}catch{return}},this._asn1ToNoticeRef=function(C){try{for(var B={},N=Xt(C,"seq"),T=0;T0?B:void 0}catch{return}},this._asn1ToNoticeNum=function(C){try{for(var B=Xt(C,"seq"),N=[],T=0;T1){var R=s(C,D[1]),E=this.getGeneralName(R);E.uri!=null&&(T.uri=E.uri)}if(D.length>2){var F=s(C,D[2]);F=="0101ff"&&(T.reqauth=!0),F=="010100"&&(T.reqauth=!1)}return T},this.getExtSubjectDirectoryAttributes=function(C,B){if(C===void 0&&B===void 0){var N=this.getExtInfo("subjectDirectoryAttributes");if(N===void 0)return;C=s(this.hex,N.vidx),B=N.critical}var T={extname:"subjectDirectoryAttributes"};B&&(T.critical=!0);try{for(var D=i(C),R=[],E=0;E0&&(B.ext=this.getExtParamArray()),B.sighex=this.getSignatureValueHex(),C.tbshex==!0&&(B.tbshex=c(this.hex,0,[0])),C.nodnarray==!0&&(delete B.issuer.array,delete B.subject.array),B},this.getExtParamArray=function(C){if(C==null){var B=f(this.hex,0,[0,"[3]"]);B!=-1&&(C=u(this.hex,0,[0,"[3]",0],"30"))}for(var N=[],T=r(C,0),D=0;D"u"||!k)&&(k={});(typeof k.jws>"u"||!k.jws)&&(k.jws={});k.jws.JWS=function(){var t=k,e=t.jws.JWS,r=e.isSafeJSONString;this.parseJWS=function(n,i){if(!(this.parsedJWS!==void 0&&(i||this.parsedJWS.sigvalH!==void 0))){var s=n.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(s==null)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var a=s[1],o=s[2],c=s[3],u=a+"."+o;if(this.parsedJWS={},this.parsedJWS.headB64U=a,this.parsedJWS.payloadB64U=o,this.parsedJWS.sigvalB64U=c,this.parsedJWS.si=u,!i){var l=fr(c),f=En(l,16);this.parsedJWS.sigvalH=l,this.parsedJWS.sigvalBI=f}var d=Na(a),p=Na(o);if(this.parsedJWS.headS=d,this.parsedJWS.payloadS=p,!r(d,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+d}}};k.jws.JWS.sign=function(t,e,r,n,i){var s=k,a=s.jws,o=a.JWS,c=o.readSafeJSONString,u=o.isSafeJSONString,l=s.crypto;l.ECDSA;var f=l.Mac,d=l.Signature,p=JSON,h,g,v;if(typeof e!="string"&&typeof e!="object")throw"spHeader must be JSON string or object: "+e;if(typeof e=="object"&&(g=e,h=p.stringify(g)),typeof e=="string"){if(h=e,!u(h))throw"JWS Head is not safe JSON string: "+h;g=c(h)}if(v=r,typeof r=="object"&&(v=p.stringify(r)),(t==""||t==null)&&g.alg!==void 0&&(t=g.alg),t!=""&&t!=null&&g.alg===void 0&&(g.alg=t,h=p.stringify(g)),t!==g.alg)throw"alg and sHeader.alg doesn't match: "+t+"!="+g.alg;var x=null;if(o.jwsalg2sigalg[t]===void 0)throw"unsupported alg name: "+t;x=o.jwsalg2sigalg[t];var b=Sv(h),S=Sv(v),_=b+"."+S,P="";if(x.substr(0,4)=="Hmac"){if(n===void 0)throw"mac key shall be specified for HS* alg";var C=new f({alg:x,prov:"cryptojs",pass:n});C.updateString(_),P=C.doFinal()}else if(x.indexOf("withECDSA")!=-1){var B=new d({alg:x});B.init(n,i),B.updateString(_);var N=B.sign();P=k.crypto.ECDSA.asn1SigToConcatSig(N)}else if(x!="none"){var B=new d({alg:x});B.init(n,i),B.updateString(_),P=B.sign()}var T=qr(P);return _+"."+T};k.jws.JWS.verify=function(t,e,r){var n=k,i=n.jws,s=i.JWS,a=s.readSafeJSONString,o=n.crypto,c=o.ECDSA,u=o.Mac,l=o.Signature,f;if(typeof at!==void 0&&(f=at),!YF(t))return!1;var d=t.split(".");if(d.length!==3)return!1;var p=d[0],h=d[1],g=p+"."+h,v=fr(d[2]),x=a(Na(d[0])),b=null,S=null;if(x.alg===void 0)throw"algorithm not specified in header";if(b=x.alg,S=b.substr(0,2),r!=null&&Object.prototype.toString.call(r)==="[object Array]"&&r.length>0){var _=":"+r.join(":")+":";if(_.indexOf(":"+b+":")==-1)throw"algorithm '"+b+"' not accepted in the list"}if(b!="none"&&e===null)throw"key shall be specified to verify.";if(typeof e=="string"&&e.indexOf("-----BEGIN ")!=-1&&(e=wt.getKey(e)),(S=="RS"||S=="PS")&&!(e instanceof f))throw"key shall be a RSAKey obj for RS* and PS* algs";if(S=="ES"&&!(e instanceof c))throw"key shall be a ECDSA obj for ES* algs";var P=null;if(s.jwsalg2sigalg[x.alg]===void 0)throw"unsupported alg name: "+b;if(P=s.jwsalg2sigalg[b],P=="none")throw"not supported";if(P.substr(0,4)=="Hmac"){var C=null;if(e===void 0)throw"hexadecimal key shall be specified for HMAC";var B=new u({alg:P,pass:e});return B.updateString(g),C=B.doFinal(),v==C}else if(P.indexOf("withECDSA")!=-1){var N=null;try{N=c.concatSigToASN1Sig(v)}catch{return!1}var T=new l({alg:P});return T.init(e),T.updateString(g),T.verify(N)}else{var T=new l({alg:P});return T.init(e),T.updateString(g),T.verify(v)}};k.jws.JWS.parse=function(t){var e=t.split("."),r={},n,i,s;if(e.length!=2&&e.length!=3)throw"malformed sJWS: wrong number of '.' splitted elements";return n=e[0],i=e[1],e.length==3&&(s=e[2]),r.headerObj=k.jws.JWS.readSafeJSONString(Na(n)),r.payloadObj=k.jws.JWS.readSafeJSONString(Na(i)),r.headerPP=JSON.stringify(r.headerObj,null," "),r.payloadObj==null?r.payloadPP=Na(i):r.payloadPP=JSON.stringify(r.payloadObj,null," "),s!==void 0&&(r.sigHex=fr(s)),r};k.jws.JWS.verifyJWT=function(t,e,r){var n=k,i=n.jws,s=i.JWS,a=s.readSafeJSONString,o=s.inArray,c=s.includedArray;if(!YF(t))return!1;var u=t.split(".");if(u.length!=3)return!1;var l=u[0],f=u[1];fr(u[2]);var d=a(Na(l)),p=a(Na(f));if(d.alg===void 0)return!1;if(r.alg===void 0)throw"acceptField.alg shall be specified";if(!o(d.alg,r.alg)||p.iss!==void 0&&typeof r.iss=="object"&&!o(p.iss,r.iss)||p.sub!==void 0&&typeof r.sub=="object"&&!o(p.sub,r.sub))return!1;if(p.aud!==void 0&&typeof r.aud=="object"){if(typeof p.aud=="string"){if(!o(p.aud,r.aud))return!1}else if(typeof p.aud=="object"&&!c(p.aud,r.aud))return!1}var h=i.IntDate.getNow();return r.verifyAt!==void 0&&typeof r.verifyAt=="number"&&(h=r.verifyAt),(r.gracePeriod===void 0||typeof r.gracePeriod!="number")&&(r.gracePeriod=0),!(p.exp!==void 0&&typeof p.exp=="number"&&p.exp+r.gracePeriod"u"||!k)&&(k={});(typeof k.jws>"u"||!k.jws)&&(k.jws={});k.jws.JWSJS=function(){var t=k,e=t.jws,r=e.JWS,n=r.readSafeJSONString;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload=void 0,this.aSignature=[]},this.initWithJWS=function(i){this.init();var s=i.split(".");if(s.length!=3)throw"malformed input JWS";this.aHeader.push(s[0]),this.sPayload=s[1],this.aSignature.push(s[2])},this.addSignature=function(i,s,a,o){if(this.sPayload===void 0||this.sPayload===null)throw"there's no JSON-JS signature to add.";var c=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length)throw"aHeader.length != aSignature.length";try{var u=k.jws.JWS.sign(i,s,this.sPayload,a,o),l=u.split("."),f=l[0],d=l[2];this.aHeader.push(l[0]),this.aSignature.push(l[2])}catch(p){throw this.aHeader.length>c&&this.aHeader.pop(),this.aSignature.length>c&&this.aSignature.pop(),"addSignature failed: "+p}},this.verifyAll=function(i){if(this.aHeader.length!==i.length||this.aSignature.length!==i.length)return!1;for(var s=0;s0)this.aHeader=i.headers;else throw"malformed header";if(typeof i.payload=="string")this.sPayload=i.payload;else throw"malformed signatures";if(i.signatures.length>0)this.aSignature=i.signatures;else throw"malformed signatures"}catch(a){throw"malformed JWS-JS JSON object: "+a}},this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}},this.isEmpty=function(){return this.aHeader.length==0?1:0}};k.crypto.ECDSA;k.crypto.DSA;k.crypto.Signature;k.crypto.MessageDigest;k.crypto.Mac;k.crypto.Cipher;var bJ=k;k.crypto;k.asn1;k.jws;k.lang;var nP={exports:{}},Qx={exports:{}},RA;function _t(){return RA||(RA=1,function(t,e){(function(r,n){t.exports=n()})(it,function(){var r=r||function(n,i){var s;if(typeof window<"u"&&window.crypto&&(s=window.crypto),typeof self<"u"&&self.crypto&&(s=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(s=globalThis.crypto),!s&&typeof window<"u"&&window.msCrypto&&(s=window.msCrypto),!s&&typeof it<"u"&&it.crypto&&(s=it.crypto),!s&&typeof D0=="function")try{s=x5}catch{}var a=function(){if(s){if(typeof s.getRandomValues=="function")try{return s.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof s.randomBytes=="function")try{return s.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function b(){}return function(S){var _;return b.prototype=S,_=new b,b.prototype=null,_}}(),c={},u=c.lib={},l=u.Base=function(){return{extend:function(b){var S=o(this);return b&&S.mixIn(b),(!S.hasOwnProperty("init")||this.init===S.init)&&(S.init=function(){S.$super.init.apply(this,arguments)}),S.init.prototype=S,S.$super=this,S},create:function(){var b=this.extend();return b.init.apply(b,arguments),b},init:function(){},mixIn:function(b){for(var S in b)b.hasOwnProperty(S)&&(this[S]=b[S]);b.hasOwnProperty("toString")&&(this.toString=b.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),f=u.WordArray=l.extend({init:function(b,S){b=this.words=b||[],S!=i?this.sigBytes=S:this.sigBytes=b.length*4},toString:function(b){return(b||p).stringify(this)},concat:function(b){var S=this.words,_=b.words,P=this.sigBytes,C=b.sigBytes;if(this.clamp(),P%4)for(var B=0;B>>2]>>>24-B%4*8&255;S[P+B>>>2]|=N<<24-(P+B)%4*8}else for(var T=0;T>>2]=_[T>>>2];return this.sigBytes+=C,this},clamp:function(){var b=this.words,S=this.sigBytes;b[S>>>2]&=4294967295<<32-S%4*8,b.length=n.ceil(S/4)},clone:function(){var b=l.clone.call(this);return b.words=this.words.slice(0),b},random:function(b){for(var S=[],_=0;_>>2]>>>24-C%4*8&255;P.push((B>>>4).toString(16)),P.push((B&15).toString(16))}return P.join("")},parse:function(b){for(var S=b.length,_=[],P=0;P>>3]|=parseInt(b.substr(P,2),16)<<24-P%8*4;return new f.init(_,S/2)}},h=d.Latin1={stringify:function(b){for(var S=b.words,_=b.sigBytes,P=[],C=0;C<_;C++){var B=S[C>>>2]>>>24-C%4*8&255;P.push(String.fromCharCode(B))}return P.join("")},parse:function(b){for(var S=b.length,_=[],P=0;P>>2]|=(b.charCodeAt(P)&255)<<24-P%4*8;return new f.init(_,S)}},g=d.Utf8={stringify:function(b){try{return decodeURIComponent(escape(h.stringify(b)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(b){return h.parse(unescape(encodeURIComponent(b)))}},v=u.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(b){typeof b=="string"&&(b=g.parse(b)),this._data.concat(b),this._nDataBytes+=b.sigBytes},_process:function(b){var S,_=this._data,P=_.words,C=_.sigBytes,B=this.blockSize,N=B*4,T=C/N;b?T=n.ceil(T):T=n.max((T|0)-this._minBufferSize,0);var D=T*B,R=n.min(D*4,C);if(D){for(var E=0;E>>2]|=c[f]<<24-f%4*8;a.call(this,l,u)}else a.apply(this,arguments)};o.prototype=s}}(),r.lib.WordArray})}(eb)),eb.exports}var tb={exports:{}},MA;function EJ(){return MA||(MA=1,function(t,e){(function(r,n){t.exports=n(_t())})(it,function(r){return function(){var n=r,i=n.lib,s=i.WordArray,a=n.enc;a.Utf16=a.Utf16BE={stringify:function(c){for(var u=c.words,l=c.sigBytes,f=[],d=0;d>>2]>>>16-d%4*8&65535;f.push(String.fromCharCode(p))}return f.join("")},parse:function(c){for(var u=c.length,l=[],f=0;f>>1]|=c.charCodeAt(f)<<16-f%2*16;return s.create(l,u*2)}},a.Utf16LE={stringify:function(c){for(var u=c.words,l=c.sigBytes,f=[],d=0;d>>2]>>>16-d%4*8&65535);f.push(String.fromCharCode(p))}return f.join("")},parse:function(c){for(var u=c.length,l=[],f=0;f>>1]|=o(c.charCodeAt(f)<<16-f%2*16);return s.create(l,u*2)}};function o(c){return c<<8&4278255360|c>>>8&16711935}}(),r.enc.Utf16})}(tb)),tb.exports}var rb={exports:{}},LA;function Xl(){return LA||(LA=1,function(t,e){(function(r,n){t.exports=n(_t())})(it,function(r){return function(){var n=r,i=n.lib,s=i.WordArray,a=n.enc;a.Base64={stringify:function(c){var u=c.words,l=c.sigBytes,f=this._map;c.clamp();for(var d=[],p=0;p>>2]>>>24-p%4*8&255,g=u[p+1>>>2]>>>24-(p+1)%4*8&255,v=u[p+2>>>2]>>>24-(p+2)%4*8&255,x=h<<16|g<<8|v,b=0;b<4&&p+b*.75>>6*(3-b)&63));var S=f.charAt(64);if(S)for(;d.length%4;)d.push(S);return d.join("")},parse:function(c){var u=c.length,l=this._map,f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var d=0;d>>6-p%4*2,v=h|g;f[d>>>2]|=v<<24-d%4*8,d++}return s.create(f,d)}}(),r.enc.Base64})}(rb)),rb.exports}var nb={exports:{}},jA;function SJ(){return jA||(jA=1,function(t,e){(function(r,n){t.exports=n(_t())})(it,function(r){return function(){var n=r,i=n.lib,s=i.WordArray,a=n.enc;a.Base64url={stringify:function(c,u){u===void 0&&(u=!0);var l=c.words,f=c.sigBytes,d=u?this._safe_map:this._map;c.clamp();for(var p=[],h=0;h>>2]>>>24-h%4*8&255,v=l[h+1>>>2]>>>24-(h+1)%4*8&255,x=l[h+2>>>2]>>>24-(h+2)%4*8&255,b=g<<16|v<<8|x,S=0;S<4&&h+S*.75>>6*(3-S)&63));var _=d.charAt(64);if(_)for(;p.length%4;)p.push(_);return p.join("")},parse:function(c,u){u===void 0&&(u=!0);var l=c.length,f=u?this._safe_map:this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var p=0;p>>6-p%4*2,v=h|g;f[d>>>2]|=v<<24-d%4*8,d++}return s.create(f,d)}}(),r.enc.Base64url})}(nb)),nb.exports}var ib={exports:{}},UA;function Ql(){return UA||(UA=1,function(t,e){(function(r,n){t.exports=n(_t())})(it,function(r){return function(n){var i=r,s=i.lib,a=s.WordArray,o=s.Hasher,c=i.algo,u=[];(function(){for(var g=0;g<64;g++)u[g]=n.abs(n.sin(g+1))*4294967296|0})();var l=c.MD5=o.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(g,v){for(var x=0;x<16;x++){var b=v+x,S=g[b];g[b]=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360}var _=this._hash.words,P=g[v+0],C=g[v+1],B=g[v+2],N=g[v+3],T=g[v+4],D=g[v+5],R=g[v+6],E=g[v+7],F=g[v+8],A=g[v+9],I=g[v+10],j=g[v+11],$=g[v+12],W=g[v+13],H=g[v+14],O=g[v+15],L=_[0],q=_[1],ee=_[2],X=_[3];L=f(L,q,ee,X,P,7,u[0]),X=f(X,L,q,ee,C,12,u[1]),ee=f(ee,X,L,q,B,17,u[2]),q=f(q,ee,X,L,N,22,u[3]),L=f(L,q,ee,X,T,7,u[4]),X=f(X,L,q,ee,D,12,u[5]),ee=f(ee,X,L,q,R,17,u[6]),q=f(q,ee,X,L,E,22,u[7]),L=f(L,q,ee,X,F,7,u[8]),X=f(X,L,q,ee,A,12,u[9]),ee=f(ee,X,L,q,I,17,u[10]),q=f(q,ee,X,L,j,22,u[11]),L=f(L,q,ee,X,$,7,u[12]),X=f(X,L,q,ee,W,12,u[13]),ee=f(ee,X,L,q,H,17,u[14]),q=f(q,ee,X,L,O,22,u[15]),L=d(L,q,ee,X,C,5,u[16]),X=d(X,L,q,ee,R,9,u[17]),ee=d(ee,X,L,q,j,14,u[18]),q=d(q,ee,X,L,P,20,u[19]),L=d(L,q,ee,X,D,5,u[20]),X=d(X,L,q,ee,I,9,u[21]),ee=d(ee,X,L,q,O,14,u[22]),q=d(q,ee,X,L,T,20,u[23]),L=d(L,q,ee,X,A,5,u[24]),X=d(X,L,q,ee,H,9,u[25]),ee=d(ee,X,L,q,N,14,u[26]),q=d(q,ee,X,L,F,20,u[27]),L=d(L,q,ee,X,W,5,u[28]),X=d(X,L,q,ee,B,9,u[29]),ee=d(ee,X,L,q,E,14,u[30]),q=d(q,ee,X,L,$,20,u[31]),L=p(L,q,ee,X,D,4,u[32]),X=p(X,L,q,ee,F,11,u[33]),ee=p(ee,X,L,q,j,16,u[34]),q=p(q,ee,X,L,H,23,u[35]),L=p(L,q,ee,X,C,4,u[36]),X=p(X,L,q,ee,T,11,u[37]),ee=p(ee,X,L,q,E,16,u[38]),q=p(q,ee,X,L,I,23,u[39]),L=p(L,q,ee,X,W,4,u[40]),X=p(X,L,q,ee,P,11,u[41]),ee=p(ee,X,L,q,N,16,u[42]),q=p(q,ee,X,L,R,23,u[43]),L=p(L,q,ee,X,A,4,u[44]),X=p(X,L,q,ee,$,11,u[45]),ee=p(ee,X,L,q,O,16,u[46]),q=p(q,ee,X,L,B,23,u[47]),L=h(L,q,ee,X,P,6,u[48]),X=h(X,L,q,ee,E,10,u[49]),ee=h(ee,X,L,q,H,15,u[50]),q=h(q,ee,X,L,D,21,u[51]),L=h(L,q,ee,X,$,6,u[52]),X=h(X,L,q,ee,N,10,u[53]),ee=h(ee,X,L,q,I,15,u[54]),q=h(q,ee,X,L,C,21,u[55]),L=h(L,q,ee,X,F,6,u[56]),X=h(X,L,q,ee,O,10,u[57]),ee=h(ee,X,L,q,R,15,u[58]),q=h(q,ee,X,L,W,21,u[59]),L=h(L,q,ee,X,T,6,u[60]),X=h(X,L,q,ee,j,10,u[61]),ee=h(ee,X,L,q,B,15,u[62]),q=h(q,ee,X,L,A,21,u[63]),_[0]=_[0]+L|0,_[1]=_[1]+q|0,_[2]=_[2]+ee|0,_[3]=_[3]+X|0},_doFinalize:function(){var g=this._data,v=g.words,x=this._nDataBytes*8,b=g.sigBytes*8;v[b>>>5]|=128<<24-b%32;var S=n.floor(x/4294967296),_=x;v[(b+64>>>9<<4)+15]=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360,v[(b+64>>>9<<4)+14]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,g.sigBytes=(v.length+1)*4,this._process();for(var P=this._hash,C=P.words,B=0;B<4;B++){var N=C[B];C[B]=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360}return P},clone:function(){var g=o.clone.call(this);return g._hash=this._hash.clone(),g}});function f(g,v,x,b,S,_,P){var C=g+(v&x|~v&b)+S+P;return(C<<_|C>>>32-_)+v}function d(g,v,x,b,S,_,P){var C=g+(v&b|x&~b)+S+P;return(C<<_|C>>>32-_)+v}function p(g,v,x,b,S,_,P){var C=g+(v^x^b)+S+P;return(C<<_|C>>>32-_)+v}function h(g,v,x,b,S,_,P){var C=g+(x^(v|~b))+S+P;return(C<<_|C>>>32-_)+v}i.MD5=o._createHelper(l),i.HmacMD5=o._createHmacHelper(l)}(Math),r.MD5})}(ib)),ib.exports}var sb={exports:{}},$A;function iP(){return $A||($A=1,function(t,e){(function(r,n){t.exports=n(_t())})(it,function(r){return function(){var n=r,i=n.lib,s=i.WordArray,a=i.Hasher,o=n.algo,c=[],u=o.SHA1=a.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(l,f){for(var d=this._hash.words,p=d[0],h=d[1],g=d[2],v=d[3],x=d[4],b=0;b<80;b++){if(b<16)c[b]=l[f+b]|0;else{var S=c[b-3]^c[b-8]^c[b-14]^c[b-16];c[b]=S<<1|S>>>31}var _=(p<<5|p>>>27)+x+c[b];b<20?_+=(h&g|~h&v)+1518500249:b<40?_+=(h^g^v)+1859775393:b<60?_+=(h&g|h&v|g&v)-1894007588:_+=(h^g^v)-899497514,x=v,v=g,g=h<<30|h>>>2,h=p,p=_}d[0]=d[0]+p|0,d[1]=d[1]+h|0,d[2]=d[2]+g|0,d[3]=d[3]+v|0,d[4]=d[4]+x|0},_doFinalize:function(){var l=this._data,f=l.words,d=this._nDataBytes*8,p=l.sigBytes*8;return f[p>>>5]|=128<<24-p%32,f[(p+64>>>9<<4)+14]=Math.floor(d/4294967296),f[(p+64>>>9<<4)+15]=d,l.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var l=a.clone.call(this);return l._hash=this._hash.clone(),l}});n.SHA1=a._createHelper(u),n.HmacSHA1=a._createHmacHelper(u)}(),r.SHA1})}(sb)),sb.exports}var ab={exports:{}},zA;function K5(){return zA||(zA=1,function(t,e){(function(r,n){t.exports=n(_t())})(it,function(r){return function(n){var i=r,s=i.lib,a=s.WordArray,o=s.Hasher,c=i.algo,u=[],l=[];(function(){function p(x){for(var b=n.sqrt(x),S=2;S<=b;S++)if(!(x%S))return!1;return!0}function h(x){return(x-(x|0))*4294967296|0}for(var g=2,v=0;v<64;)p(g)&&(v<8&&(u[v]=h(n.pow(g,1/2))),l[v]=h(n.pow(g,1/3)),v++),g++})();var f=[],d=c.SHA256=o.extend({_doReset:function(){this._hash=new a.init(u.slice(0))},_doProcessBlock:function(p,h){for(var g=this._hash.words,v=g[0],x=g[1],b=g[2],S=g[3],_=g[4],P=g[5],C=g[6],B=g[7],N=0;N<64;N++){if(N<16)f[N]=p[h+N]|0;else{var T=f[N-15],D=(T<<25|T>>>7)^(T<<14|T>>>18)^T>>>3,R=f[N-2],E=(R<<15|R>>>17)^(R<<13|R>>>19)^R>>>10;f[N]=D+f[N-7]+E+f[N-16]}var F=_&P^~_&C,A=v&x^v&b^x&b,I=(v<<30|v>>>2)^(v<<19|v>>>13)^(v<<10|v>>>22),j=(_<<26|_>>>6)^(_<<21|_>>>11)^(_<<7|_>>>25),$=B+j+F+l[N]+f[N],W=I+A;B=C,C=P,P=_,_=S+$|0,S=b,b=x,x=v,v=$+W|0}g[0]=g[0]+v|0,g[1]=g[1]+x|0,g[2]=g[2]+b|0,g[3]=g[3]+S|0,g[4]=g[4]+_|0,g[5]=g[5]+P|0,g[6]=g[6]+C|0,g[7]=g[7]+B|0},_doFinalize:function(){var p=this._data,h=p.words,g=this._nDataBytes*8,v=p.sigBytes*8;return h[v>>>5]|=128<<24-v%32,h[(v+64>>>9<<4)+14]=n.floor(g/4294967296),h[(v+64>>>9<<4)+15]=g,p.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var p=o.clone.call(this);return p._hash=this._hash.clone(),p}});i.SHA256=o._createHelper(d),i.HmacSHA256=o._createHmacHelper(d)}(Math),r.SHA256})}(ab)),ab.exports}var ob={exports:{}},HA;function AJ(){return HA||(HA=1,function(t,e){(function(r,n,i){t.exports=n(_t(),K5())})(it,function(r){return function(){var n=r,i=n.lib,s=i.WordArray,a=n.algo,o=a.SHA256,c=a.SHA224=o.extend({_doReset:function(){this._hash=new s.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var u=o._doFinalize.call(this);return u.sigBytes-=4,u}});n.SHA224=o._createHelper(c),n.HmacSHA224=o._createHmacHelper(c)}(),r.SHA224})}(ob)),ob.exports}var cb={exports:{}},VA;function sP(){return VA||(VA=1,function(t,e){(function(r,n,i){t.exports=n(_t(),u2())})(it,function(r){return function(){var n=r,i=n.lib,s=i.Hasher,a=n.x64,o=a.Word,c=a.WordArray,u=n.algo;function l(){return o.create.apply(o,arguments)}var f=[l(1116352408,3609767458),l(1899447441,602891725),l(3049323471,3964484399),l(3921009573,2173295548),l(961987163,4081628472),l(1508970993,3053834265),l(2453635748,2937671579),l(2870763221,3664609560),l(3624381080,2734883394),l(310598401,1164996542),l(607225278,1323610764),l(1426881987,3590304994),l(1925078388,4068182383),l(2162078206,991336113),l(2614888103,633803317),l(3248222580,3479774868),l(3835390401,2666613458),l(4022224774,944711139),l(264347078,2341262773),l(604807628,2007800933),l(770255983,1495990901),l(1249150122,1856431235),l(1555081692,3175218132),l(1996064986,2198950837),l(2554220882,3999719339),l(2821834349,766784016),l(2952996808,2566594879),l(3210313671,3203337956),l(3336571891,1034457026),l(3584528711,2466948901),l(113926993,3758326383),l(338241895,168717936),l(666307205,1188179964),l(773529912,1546045734),l(1294757372,1522805485),l(1396182291,2643833823),l(1695183700,2343527390),l(1986661051,1014477480),l(2177026350,1206759142),l(2456956037,344077627),l(2730485921,1290863460),l(2820302411,3158454273),l(3259730800,3505952657),l(3345764771,106217008),l(3516065817,3606008344),l(3600352804,1432725776),l(4094571909,1467031594),l(275423344,851169720),l(430227734,3100823752),l(506948616,1363258195),l(659060556,3750685593),l(883997877,3785050280),l(958139571,3318307427),l(1322822218,3812723403),l(1537002063,2003034995),l(1747873779,3602036899),l(1955562222,1575990012),l(2024104815,1125592928),l(2227730452,2716904306),l(2361852424,442776044),l(2428436474,593698344),l(2756734187,3733110249),l(3204031479,2999351573),l(3329325298,3815920427),l(3391569614,3928383900),l(3515267271,566280711),l(3940187606,3454069534),l(4118630271,4000239992),l(116418474,1914138554),l(174292421,2731055270),l(289380356,3203993006),l(460393269,320620315),l(685471733,587496836),l(852142971,1086792851),l(1017036298,365543100),l(1126000580,2618297676),l(1288033470,3409855158),l(1501505948,4234509866),l(1607167915,987167468),l(1816402316,1246189591)],d=[];(function(){for(var h=0;h<80;h++)d[h]=l()})();var p=u.SHA512=s.extend({_doReset:function(){this._hash=new c.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(h,g){for(var v=this._hash.words,x=v[0],b=v[1],S=v[2],_=v[3],P=v[4],C=v[5],B=v[6],N=v[7],T=x.high,D=x.low,R=b.high,E=b.low,F=S.high,A=S.low,I=_.high,j=_.low,$=P.high,W=P.low,H=C.high,O=C.low,L=B.high,q=B.low,ee=N.high,X=N.low,ae=T,ve=D,de=R,pe=E,we=F,_e=A,Me=I,Fe=j,De=$,V=W,le=H,ce=O,Y=L,J=q,ne=ee,xe=X,he=0;he<80;he++){var re,ke,be=d[he];if(he<16)ke=be.high=h[g+he*2]|0,re=be.low=h[g+he*2+1]|0;else{var ge=d[he-15],Re=ge.high,m=ge.low,y=(Re>>>1|m<<31)^(Re>>>8|m<<24)^Re>>>7,w=(m>>>1|Re<<31)^(m>>>8|Re<<24)^(m>>>7|Re<<25),M=d[he-2],z=M.high,G=M.low,Z=(z>>>19|G<<13)^(z<<3|G>>>29)^z>>>6,Se=(G>>>19|z<<13)^(G<<3|z>>>29)^(G>>>6|z<<26),Ve=d[he-7],Pe=Ve.high,Te=Ve.low,ze=d[he-16],Wt=ze.high,Gt=ze.low;re=w+Te,ke=y+Pe+(re>>>0>>0?1:0),re=re+Se,ke=ke+Z+(re>>>0>>0?1:0),re=re+Gt,ke=ke+Wt+(re>>>0>>0?1:0),be.high=ke,be.low=re}var ra=De&le^~De&Y,Mt=V&ce^~V&J,ie=ae&de^ae&we^de&we,me=ve&pe^ve&_e^pe&_e,ye=(ae>>>28|ve<<4)^(ae<<30|ve>>>2)^(ae<<25|ve>>>7),Ne=(ve>>>28|ae<<4)^(ve<<30|ae>>>2)^(ve<<25|ae>>>7),Ze=(De>>>14|V<<18)^(De>>>18|V<<14)^(De<<23|V>>>9),et=(V>>>14|De<<18)^(V>>>18|De<<14)^(V<<23|De>>>9),qe=f[he],nt=qe.high,He=qe.low,Ke=xe+et,$t=ne+Ze+(Ke>>>0>>0?1:0),Ke=Ke+Mt,$t=$t+ra+(Ke>>>0>>0?1:0),Ke=Ke+He,$t=$t+nt+(Ke>>>0>>0?1:0),Ke=Ke+re,$t=$t+ke+(Ke>>>0>>0?1:0),Qe=Ne+me,ct=ye+ie+(Qe>>>0>>0?1:0);ne=Y,xe=J,Y=le,J=ce,le=De,ce=V,V=Fe+Ke|0,De=Me+$t+(V>>>0>>0?1:0)|0,Me=we,Fe=_e,we=de,_e=pe,de=ae,pe=ve,ve=Ke+Qe|0,ae=$t+ct+(ve>>>0>>0?1:0)|0}D=x.low=D+ve,x.high=T+ae+(D>>>0>>0?1:0),E=b.low=E+pe,b.high=R+de+(E>>>0>>0?1:0),A=S.low=A+_e,S.high=F+we+(A>>>0<_e>>>0?1:0),j=_.low=j+Fe,_.high=I+Me+(j>>>0>>0?1:0),W=P.low=W+V,P.high=$+De+(W>>>0>>0?1:0),O=C.low=O+ce,C.high=H+le+(O>>>0>>0?1:0),q=B.low=q+J,B.high=L+Y+(q>>>0>>0?1:0),X=N.low=X+xe,N.high=ee+ne+(X>>>0>>0?1:0)},_doFinalize:function(){var h=this._data,g=h.words,v=this._nDataBytes*8,x=h.sigBytes*8;g[x>>>5]|=128<<24-x%32,g[(x+128>>>10<<5)+30]=Math.floor(v/4294967296),g[(x+128>>>10<<5)+31]=v,h.sigBytes=g.length*4,this._process();var b=this._hash.toX32();return b},clone:function(){var h=s.clone.call(this);return h._hash=this._hash.clone(),h},blockSize:1024/32});n.SHA512=s._createHelper(p),n.HmacSHA512=s._createHmacHelper(p)}(),r.SHA512})}(cb)),cb.exports}var ub={exports:{}},qA;function CJ(){return qA||(qA=1,function(t,e){(function(r,n,i){t.exports=n(_t(),u2(),sP())})(it,function(r){return function(){var n=r,i=n.x64,s=i.Word,a=i.WordArray,o=n.algo,c=o.SHA512,u=o.SHA384=c.extend({_doReset:function(){this._hash=new a.init([new s.init(3418070365,3238371032),new s.init(1654270250,914150663),new s.init(2438529370,812702999),new s.init(355462360,4144912697),new s.init(1731405415,4290775857),new s.init(2394180231,1750603025),new s.init(3675008525,1694076839),new s.init(1203062813,3204075428)])},_doFinalize:function(){var l=c._doFinalize.call(this);return l.sigBytes-=16,l}});n.SHA384=c._createHelper(u),n.HmacSHA384=c._createHmacHelper(u)}(),r.SHA384})}(ub)),ub.exports}var lb={exports:{}},KA;function _J(){return KA||(KA=1,function(t,e){(function(r,n,i){t.exports=n(_t(),u2())})(it,function(r){return function(n){var i=r,s=i.lib,a=s.WordArray,o=s.Hasher,c=i.x64,u=c.Word,l=i.algo,f=[],d=[],p=[];(function(){for(var v=1,x=0,b=0;b<24;b++){f[v+5*x]=(b+1)*(b+2)/2%64;var S=x%5,_=(2*v+3*x)%5;v=S,x=_}for(var v=0;v<5;v++)for(var x=0;x<5;x++)d[v+5*x]=x+(2*v+3*x)%5*5;for(var P=1,C=0;C<24;C++){for(var B=0,N=0,T=0;T<7;T++){if(P&1){var D=(1<>>24)&16711935|(P<<24|P>>>8)&4278255360,C=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360;var B=b[_];B.high^=C,B.low^=P}for(var N=0;N<24;N++){for(var T=0;T<5;T++){for(var D=0,R=0,E=0;E<5;E++){var B=b[T+5*E];D^=B.high,R^=B.low}var F=h[T];F.high=D,F.low=R}for(var T=0;T<5;T++)for(var A=h[(T+4)%5],I=h[(T+1)%5],j=I.high,$=I.low,D=A.high^(j<<1|$>>>31),R=A.low^($<<1|j>>>31),E=0;E<5;E++){var B=b[T+5*E];B.high^=D,B.low^=R}for(var W=1;W<25;W++){var D,R,B=b[W],H=B.high,O=B.low,L=f[W];L<32?(D=H<>>32-L,R=O<>>32-L):(D=O<>>64-L,R=H<>>64-L);var q=h[d[W]];q.high=D,q.low=R}var ee=h[0],X=b[0];ee.high=X.high,ee.low=X.low;for(var T=0;T<5;T++)for(var E=0;E<5;E++){var W=T+5*E,B=b[W],ae=h[W],ve=h[(T+1)%5+5*E],de=h[(T+2)%5+5*E];B.high=ae.high^~ve.high&de.high,B.low=ae.low^~ve.low&de.low}var B=b[0],pe=p[N];B.high^=pe.high,B.low^=pe.low}},_doFinalize:function(){var v=this._data,x=v.words;this._nDataBytes*8;var b=v.sigBytes*8,S=this.blockSize*32;x[b>>>5]|=1<<24-b%32,x[(n.ceil((b+1)/S)*S>>>5)-1]|=128,v.sigBytes=x.length*4,this._process();for(var _=this._state,P=this.cfg.outputLength/8,C=P/8,B=[],N=0;N>>24)&16711935|(D<<24|D>>>8)&4278255360,R=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,B.push(R),B.push(D)}return new a.init(B,P)},clone:function(){for(var v=o.clone.call(this),x=v._state=this._state.slice(0),b=0;b<25;b++)x[b]=x[b].clone();return v}});i.SHA3=o._createHelper(g),i.HmacSHA3=o._createHmacHelper(g)}(Math),r.SHA3})}(lb)),lb.exports}var fb={exports:{}},WA;function kJ(){return WA||(WA=1,function(t,e){(function(r,n){t.exports=n(_t())})(it,function(r){/** @preserve + (c) 2012 by Cédric Mesnil. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */return function(n){var i=r,s=i.lib,a=s.WordArray,o=s.Hasher,c=i.algo,u=a.create([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]),l=a.create([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]),f=a.create([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]),d=a.create([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]),p=a.create([0,1518500249,1859775393,2400959708,2840853838]),h=a.create([1352829926,1548603684,1836072691,2053994217,0]),g=c.RIPEMD160=o.extend({_doReset:function(){this._hash=a.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(C,B){for(var N=0;N<16;N++){var T=B+N,D=C[T];C[T]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360}var R=this._hash.words,E=p.words,F=h.words,A=u.words,I=l.words,j=f.words,$=d.words,W,H,O,L,q,ee,X,ae,ve,de;ee=W=R[0],X=H=R[1],ae=O=R[2],ve=L=R[3],de=q=R[4];for(var pe,N=0;N<80;N+=1)pe=W+C[B+A[N]]|0,N<16?pe+=v(H,O,L)+E[0]:N<32?pe+=x(H,O,L)+E[1]:N<48?pe+=b(H,O,L)+E[2]:N<64?pe+=S(H,O,L)+E[3]:pe+=_(H,O,L)+E[4],pe=pe|0,pe=P(pe,j[N]),pe=pe+q|0,W=q,q=L,L=P(O,10),O=H,H=pe,pe=ee+C[B+I[N]]|0,N<16?pe+=_(X,ae,ve)+F[0]:N<32?pe+=S(X,ae,ve)+F[1]:N<48?pe+=b(X,ae,ve)+F[2]:N<64?pe+=x(X,ae,ve)+F[3]:pe+=v(X,ae,ve)+F[4],pe=pe|0,pe=P(pe,$[N]),pe=pe+de|0,ee=de,de=ve,ve=P(ae,10),ae=X,X=pe;pe=R[1]+O+ve|0,R[1]=R[2]+L+de|0,R[2]=R[3]+q+ee|0,R[3]=R[4]+W+X|0,R[4]=R[0]+H+ae|0,R[0]=pe},_doFinalize:function(){var C=this._data,B=C.words,N=this._nDataBytes*8,T=C.sigBytes*8;B[T>>>5]|=128<<24-T%32,B[(T+64>>>9<<4)+14]=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360,C.sigBytes=(B.length+1)*4,this._process();for(var D=this._hash,R=D.words,E=0;E<5;E++){var F=R[E];R[E]=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360}return D},clone:function(){var C=o.clone.call(this);return C._hash=this._hash.clone(),C}});function v(C,B,N){return C^B^N}function x(C,B,N){return C&B|~C&N}function b(C,B,N){return(C|~B)^N}function S(C,B,N){return C&N|B&~N}function _(C,B,N){return C^(B|~N)}function P(C,B){return C<>>32-B}i.RIPEMD160=o._createHelper(g),i.HmacRIPEMD160=o._createHmacHelper(g)}(),r.RIPEMD160})}(fb)),fb.exports}var db={exports:{}},GA;function W5(){return GA||(GA=1,function(t,e){(function(r,n){t.exports=n(_t())})(it,function(r){(function(){var n=r,i=n.lib,s=i.Base,a=n.enc,o=a.Utf8,c=n.algo;c.HMAC=s.extend({init:function(u,l){u=this._hasher=new u.init,typeof l=="string"&&(l=o.parse(l));var f=u.blockSize,d=f*4;l.sigBytes>d&&(l=u.finalize(l)),l.clamp();for(var p=this._oKey=l.clone(),h=this._iKey=l.clone(),g=p.words,v=h.words,x=0;x>>2]&255;D.sigBytes-=R}};s.BlockCipher=p.extend({cfg:p.cfg.extend({mode:v,padding:b}),reset:function(){var D;p.reset.call(this);var R=this.cfg,E=R.iv,F=R.mode;this._xformMode==this._ENC_XFORM_MODE?D=F.createEncryptor:(D=F.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==D?this._mode.init(this,E&&E.words):(this._mode=D.call(F,this,E&&E.words),this._mode.__creator=D)},_doProcessBlock:function(D,R){this._mode.processBlock(D,R)},_doFinalize:function(){var D,R=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(R.pad(this._data,this.blockSize),D=this._process(!0)):(D=this._process(!0),R.unpad(D)),D},blockSize:128/32});var S=s.CipherParams=a.extend({init:function(D){this.mixIn(D)},toString:function(D){return(D||this.formatter).stringify(this)}}),_=i.format={},P=_.OpenSSL={stringify:function(D){var R,E=D.ciphertext,F=D.salt;return F?R=o.create([1398893684,1701076831]).concat(F).concat(E):R=E,R.toString(l)},parse:function(D){var R,E=l.parse(D),F=E.words;return F[0]==1398893684&&F[1]==1701076831&&(R=o.create(F.slice(2,4)),F.splice(0,4),E.sigBytes-=16),S.create({ciphertext:E,salt:R})}},C=s.SerializableCipher=a.extend({cfg:a.extend({format:P}),encrypt:function(D,R,E,F){F=this.cfg.extend(F);var A=D.createEncryptor(E,F),I=A.finalize(R),j=A.cfg;return S.create({ciphertext:I,key:E,iv:j.iv,algorithm:D,mode:j.mode,padding:j.padding,blockSize:D.blockSize,formatter:F.format})},decrypt:function(D,R,E,F){F=this.cfg.extend(F),R=this._parse(R,F.format);var A=D.createDecryptor(E,F).finalize(R.ciphertext);return A},_parse:function(D,R){return typeof D=="string"?R.parse(D,this):D}}),B=i.kdf={},N=B.OpenSSL={execute:function(D,R,E,F,A){if(F||(F=o.random(64/8)),A)var I=d.create({keySize:R+E,hasher:A}).compute(D,F);else var I=d.create({keySize:R+E}).compute(D,F);var j=o.create(I.words.slice(R),E*4);return I.sigBytes=R*4,S.create({key:I,iv:j,salt:F})}},T=s.PasswordBasedCipher=C.extend({cfg:C.cfg.extend({kdf:N}),encrypt:function(D,R,E,F){F=this.cfg.extend(F);var A=F.kdf.execute(E,D.keySize,D.ivSize,F.salt,F.hasher);F.iv=A.iv;var I=C.encrypt.call(this,D,R,A.key,F);return I.mixIn(A),I},decrypt:function(D,R,E,F){F=this.cfg.extend(F),R=this._parse(R,F.format);var A=F.kdf.execute(E,D.keySize,D.ivSize,R.salt,F.hasher);F.iv=A.iv;var I=C.decrypt.call(this,D,R,A.key,F);return I}})}()})}(gb)),gb.exports}var mb={exports:{}},QA;function IJ(){return QA||(QA=1,function(t,e){(function(r,n,i){t.exports=n(_t(),an())})(it,function(r){return r.mode.CFB=function(){var n=r.lib.BlockCipherMode.extend();n.Encryptor=n.extend({processBlock:function(s,a){var o=this._cipher,c=o.blockSize;i.call(this,s,a,c,o),this._prevBlock=s.slice(a,a+c)}}),n.Decryptor=n.extend({processBlock:function(s,a){var o=this._cipher,c=o.blockSize,u=s.slice(a,a+c);i.call(this,s,a,c,o),this._prevBlock=u}});function i(s,a,o,c){var u,l=this._iv;l?(u=l.slice(0),this._iv=void 0):u=this._prevBlock,c.encryptBlock(u,0);for(var f=0;f>24&255)===255){var c=o>>16&255,u=o>>8&255,l=o&255;c===255?(c=0,u===255?(u=0,l===255?l=0:++l):++u):++c,o=0,o+=c<<16,o+=u<<8,o+=l}else o+=1<<24;return o}function s(o){return(o[0]=i(o[0]))===0&&(o[1]=i(o[1])),o}var a=n.Encryptor=n.extend({processBlock:function(o,c){var u=this._cipher,l=u.blockSize,f=this._iv,d=this._counter;f&&(d=this._counter=f.slice(0),this._iv=void 0),s(d);var p=d.slice(0);u.encryptBlock(p,0);for(var h=0;h>>2]|=o<<24-c%4*8,n.sigBytes+=o},unpad:function(n){var i=n.words[n.sigBytes-1>>>2]&255;n.sigBytes-=i}},r.pad.Ansix923})}(wb)),wb.exports}var Eb={exports:{}},i9;function DJ(){return i9||(i9=1,function(t,e){(function(r,n,i){t.exports=n(_t(),an())})(it,function(r){return r.pad.Iso10126={pad:function(n,i){var s=i*4,a=s-n.sigBytes%s;n.concat(r.lib.WordArray.random(a-1)).concat(r.lib.WordArray.create([a<<24],1))},unpad:function(n){var i=n.words[n.sigBytes-1>>>2]&255;n.sigBytes-=i}},r.pad.Iso10126})}(Eb)),Eb.exports}var Sb={exports:{}},s9;function OJ(){return s9||(s9=1,function(t,e){(function(r,n,i){t.exports=n(_t(),an())})(it,function(r){return r.pad.Iso97971={pad:function(n,i){n.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(n,i)},unpad:function(n){r.pad.ZeroPadding.unpad(n),n.sigBytes--}},r.pad.Iso97971})}(Sb)),Sb.exports}var Ab={exports:{}},a9;function MJ(){return a9||(a9=1,function(t,e){(function(r,n,i){t.exports=n(_t(),an())})(it,function(r){return r.pad.ZeroPadding={pad:function(n,i){var s=i*4;n.clamp(),n.sigBytes+=s-(n.sigBytes%s||s)},unpad:function(n){for(var i=n.words,s=n.sigBytes-1,s=n.sigBytes-1;s>=0;s--)if(i[s>>>2]>>>24-s%4*8&255){n.sigBytes=s+1;break}}},r.pad.ZeroPadding})}(Ab)),Ab.exports}var Cb={exports:{}},o9;function LJ(){return o9||(o9=1,function(t,e){(function(r,n,i){t.exports=n(_t(),an())})(it,function(r){return r.pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding})}(Cb)),Cb.exports}var _b={exports:{}},c9;function jJ(){return c9||(c9=1,function(t,e){(function(r,n,i){t.exports=n(_t(),an())})(it,function(r){return function(n){var i=r,s=i.lib,a=s.CipherParams,o=i.enc,c=o.Hex,u=i.format;u.Hex={stringify:function(l){return l.ciphertext.toString(c)},parse:function(l){var f=c.parse(l);return a.create({ciphertext:f})}}}(),r.format.Hex})}(_b)),_b.exports}var kb={exports:{}},u9;function UJ(){return u9||(u9=1,function(t,e){(function(r,n,i){t.exports=n(_t(),Xl(),Ql(),xu(),an())})(it,function(r){return function(){var n=r,i=n.lib,s=i.BlockCipher,a=n.algo,o=[],c=[],u=[],l=[],f=[],d=[],p=[],h=[],g=[],v=[];(function(){for(var S=[],_=0;_<256;_++)_<128?S[_]=_<<1:S[_]=_<<1^283;for(var P=0,C=0,_=0;_<256;_++){var B=C^C<<1^C<<2^C<<3^C<<4;B=B>>>8^B&255^99,o[P]=B,c[B]=P;var N=S[P],T=S[N],D=S[T],R=S[B]*257^B*16843008;u[P]=R<<24|R>>>8,l[P]=R<<16|R>>>16,f[P]=R<<8|R>>>24,d[P]=R;var R=D*16843009^T*65537^N*257^P*16843008;p[B]=R<<24|R>>>8,h[B]=R<<16|R>>>16,g[B]=R<<8|R>>>24,v[B]=R,P?(P=N^S[S[S[D^N]]],C^=S[S[C]]):P=C=1}})();var x=[0,1,2,4,8,16,32,64,128,27,54],b=a.AES=s.extend({_doReset:function(){var S;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var _=this._keyPriorReset=this._key,P=_.words,C=_.sigBytes/4,B=this._nRounds=C+6,N=(B+1)*4,T=this._keySchedule=[],D=0;D6&&D%C==4&&(S=o[S>>>24]<<24|o[S>>>16&255]<<16|o[S>>>8&255]<<8|o[S&255]):(S=S<<8|S>>>24,S=o[S>>>24]<<24|o[S>>>16&255]<<16|o[S>>>8&255]<<8|o[S&255],S^=x[D/C|0]<<24),T[D]=T[D-C]^S);for(var R=this._invKeySchedule=[],E=0;E>>24]]^h[o[S>>>16&255]]^g[o[S>>>8&255]]^v[o[S&255]]}}},encryptBlock:function(S,_){this._doCryptBlock(S,_,this._keySchedule,u,l,f,d,o)},decryptBlock:function(S,_){var P=S[_+1];S[_+1]=S[_+3],S[_+3]=P,this._doCryptBlock(S,_,this._invKeySchedule,p,h,g,v,c);var P=S[_+1];S[_+1]=S[_+3],S[_+3]=P},_doCryptBlock:function(S,_,P,C,B,N,T,D){for(var R=this._nRounds,E=S[_]^P[0],F=S[_+1]^P[1],A=S[_+2]^P[2],I=S[_+3]^P[3],j=4,$=1;$>>24]^B[F>>>16&255]^N[A>>>8&255]^T[I&255]^P[j++],H=C[F>>>24]^B[A>>>16&255]^N[I>>>8&255]^T[E&255]^P[j++],O=C[A>>>24]^B[I>>>16&255]^N[E>>>8&255]^T[F&255]^P[j++],L=C[I>>>24]^B[E>>>16&255]^N[F>>>8&255]^T[A&255]^P[j++];E=W,F=H,A=O,I=L}var W=(D[E>>>24]<<24|D[F>>>16&255]<<16|D[A>>>8&255]<<8|D[I&255])^P[j++],H=(D[F>>>24]<<24|D[A>>>16&255]<<16|D[I>>>8&255]<<8|D[E&255])^P[j++],O=(D[A>>>24]<<24|D[I>>>16&255]<<16|D[E>>>8&255]<<8|D[F&255])^P[j++],L=(D[I>>>24]<<24|D[E>>>16&255]<<16|D[F>>>8&255]<<8|D[A&255])^P[j++];S[_]=W,S[_+1]=H,S[_+2]=O,S[_+3]=L},keySize:256/32});n.AES=s._createHelper(b)}(),r.AES})}(kb)),kb.exports}var Bb={exports:{}},l9;function $J(){return l9||(l9=1,function(t,e){(function(r,n,i){t.exports=n(_t(),Xl(),Ql(),xu(),an())})(it,function(r){return function(){var n=r,i=n.lib,s=i.WordArray,a=i.BlockCipher,o=n.algo,c=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],u=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],f=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],d=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],p=o.DES=a.extend({_doReset:function(){for(var x=this._key,b=x.words,S=[],_=0;_<56;_++){var P=c[_]-1;S[_]=b[P>>>5]>>>31-P%32&1}for(var C=this._subKeys=[],B=0;B<16;B++){for(var N=C[B]=[],T=l[B],_=0;_<24;_++)N[_/6|0]|=S[(u[_]-1+T)%28]<<31-_%6,N[4+(_/6|0)]|=S[28+(u[_+24]-1+T)%28]<<31-_%6;N[0]=N[0]<<1|N[0]>>>31;for(var _=1;_<7;_++)N[_]=N[_]>>>(_-1)*4+3;N[7]=N[7]<<5|N[7]>>>27}for(var D=this._invSubKeys=[],_=0;_<16;_++)D[_]=C[15-_]},encryptBlock:function(x,b){this._doCryptBlock(x,b,this._subKeys)},decryptBlock:function(x,b){this._doCryptBlock(x,b,this._invSubKeys)},_doCryptBlock:function(x,b,S){this._lBlock=x[b],this._rBlock=x[b+1],h.call(this,4,252645135),h.call(this,16,65535),g.call(this,2,858993459),g.call(this,8,16711935),h.call(this,1,1431655765);for(var _=0;_<16;_++){for(var P=S[_],C=this._lBlock,B=this._rBlock,N=0,T=0;T<8;T++)N|=f[T][((B^P[T])&d[T])>>>0];this._lBlock=B,this._rBlock=C^N}var D=this._lBlock;this._lBlock=this._rBlock,this._rBlock=D,h.call(this,1,1431655765),g.call(this,8,16711935),g.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),x[b]=this._lBlock,x[b+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function h(x,b){var S=(this._lBlock>>>x^this._rBlock)&b;this._rBlock^=S,this._lBlock^=S<>>x^this._lBlock)&b;this._lBlock^=S,this._rBlock^=S<192.");var S=b.slice(0,2),_=b.length<4?b.slice(0,2):b.slice(2,4),P=b.length<6?b.slice(0,2):b.slice(4,6);this._des1=p.createEncryptor(s.create(S)),this._des2=p.createEncryptor(s.create(_)),this._des3=p.createEncryptor(s.create(P))},encryptBlock:function(x,b){this._des1.encryptBlock(x,b),this._des2.decryptBlock(x,b),this._des3.encryptBlock(x,b)},decryptBlock:function(x,b){this._des3.decryptBlock(x,b),this._des2.encryptBlock(x,b),this._des1.decryptBlock(x,b)},keySize:192/32,ivSize:64/32,blockSize:64/32});n.TripleDES=a._createHelper(v)}(),r.TripleDES})}(Bb)),Bb.exports}var Ib={exports:{}},f9;function zJ(){return f9||(f9=1,function(t,e){(function(r,n,i){t.exports=n(_t(),Xl(),Ql(),xu(),an())})(it,function(r){return function(){var n=r,i=n.lib,s=i.StreamCipher,a=n.algo,o=a.RC4=s.extend({_doReset:function(){for(var l=this._key,f=l.words,d=l.sigBytes,p=this._S=[],h=0;h<256;h++)p[h]=h;for(var h=0,g=0;h<256;h++){var v=h%d,x=f[v>>>2]>>>24-v%4*8&255;g=(g+p[h]+x)%256;var b=p[h];p[h]=p[g],p[g]=b}this._i=this._j=0},_doProcessBlock:function(l,f){l[f]^=c.call(this)},keySize:256/32,ivSize:0});function c(){for(var l=this._S,f=this._i,d=this._j,p=0,h=0;h<4;h++){f=(f+1)%256,d=(d+l[f])%256;var g=l[f];l[f]=l[d],l[d]=g,p|=l[(l[f]+l[d])%256]<<24-h*8}return this._i=f,this._j=d,p}n.RC4=s._createHelper(o);var u=a.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var l=this.cfg.drop;l>0;l--)c.call(this)}});n.RC4Drop=s._createHelper(u)}(),r.RC4})}(Ib)),Ib.exports}var Fb={exports:{}},d9;function HJ(){return d9||(d9=1,function(t,e){(function(r,n,i){t.exports=n(_t(),Xl(),Ql(),xu(),an())})(it,function(r){return function(){var n=r,i=n.lib,s=i.StreamCipher,a=n.algo,o=[],c=[],u=[],l=a.Rabbit=s.extend({_doReset:function(){for(var d=this._key.words,p=this.cfg.iv,h=0;h<4;h++)d[h]=(d[h]<<8|d[h]>>>24)&16711935|(d[h]<<24|d[h]>>>8)&4278255360;var g=this._X=[d[0],d[3]<<16|d[2]>>>16,d[1],d[0]<<16|d[3]>>>16,d[2],d[1]<<16|d[0]>>>16,d[3],d[2]<<16|d[1]>>>16],v=this._C=[d[2]<<16|d[2]>>>16,d[0]&4294901760|d[1]&65535,d[3]<<16|d[3]>>>16,d[1]&4294901760|d[2]&65535,d[0]<<16|d[0]>>>16,d[2]&4294901760|d[3]&65535,d[1]<<16|d[1]>>>16,d[3]&4294901760|d[0]&65535];this._b=0;for(var h=0;h<4;h++)f.call(this);for(var h=0;h<8;h++)v[h]^=g[h+4&7];if(p){var x=p.words,b=x[0],S=x[1],_=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,P=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360,C=_>>>16|P&4294901760,B=P<<16|_&65535;v[0]^=_,v[1]^=C,v[2]^=P,v[3]^=B,v[4]^=_,v[5]^=C,v[6]^=P,v[7]^=B;for(var h=0;h<4;h++)f.call(this)}},_doProcessBlock:function(d,p){var h=this._X;f.call(this),o[0]=h[0]^h[5]>>>16^h[3]<<16,o[1]=h[2]^h[7]>>>16^h[5]<<16,o[2]=h[4]^h[1]>>>16^h[7]<<16,o[3]=h[6]^h[3]>>>16^h[1]<<16;for(var g=0;g<4;g++)o[g]=(o[g]<<8|o[g]>>>24)&16711935|(o[g]<<24|o[g]>>>8)&4278255360,d[p+g]^=o[g]},blockSize:128/32,ivSize:64/32});function f(){for(var d=this._X,p=this._C,h=0;h<8;h++)c[h]=p[h];p[0]=p[0]+1295307597+this._b|0,p[1]=p[1]+3545052371+(p[0]>>>0>>0?1:0)|0,p[2]=p[2]+886263092+(p[1]>>>0>>0?1:0)|0,p[3]=p[3]+1295307597+(p[2]>>>0>>0?1:0)|0,p[4]=p[4]+3545052371+(p[3]>>>0>>0?1:0)|0,p[5]=p[5]+886263092+(p[4]>>>0>>0?1:0)|0,p[6]=p[6]+1295307597+(p[5]>>>0>>0?1:0)|0,p[7]=p[7]+3545052371+(p[6]>>>0>>0?1:0)|0,this._b=p[7]>>>0>>0?1:0;for(var h=0;h<8;h++){var g=d[h]+p[h],v=g&65535,x=g>>>16,b=((v*v>>>17)+v*x>>>15)+x*x,S=((g&4294901760)*g|0)+((g&65535)*g|0);u[h]=b^S}d[0]=u[0]+(u[7]<<16|u[7]>>>16)+(u[6]<<16|u[6]>>>16)|0,d[1]=u[1]+(u[0]<<8|u[0]>>>24)+u[7]|0,d[2]=u[2]+(u[1]<<16|u[1]>>>16)+(u[0]<<16|u[0]>>>16)|0,d[3]=u[3]+(u[2]<<8|u[2]>>>24)+u[1]|0,d[4]=u[4]+(u[3]<<16|u[3]>>>16)+(u[2]<<16|u[2]>>>16)|0,d[5]=u[5]+(u[4]<<8|u[4]>>>24)+u[3]|0,d[6]=u[6]+(u[5]<<16|u[5]>>>16)+(u[4]<<16|u[4]>>>16)|0,d[7]=u[7]+(u[6]<<8|u[6]>>>24)+u[5]|0}n.Rabbit=s._createHelper(l)}(),r.Rabbit})}(Fb)),Fb.exports}var Pb={exports:{}},h9;function VJ(){return h9||(h9=1,function(t,e){(function(r,n,i){t.exports=n(_t(),Xl(),Ql(),xu(),an())})(it,function(r){return function(){var n=r,i=n.lib,s=i.StreamCipher,a=n.algo,o=[],c=[],u=[],l=a.RabbitLegacy=s.extend({_doReset:function(){var d=this._key.words,p=this.cfg.iv,h=this._X=[d[0],d[3]<<16|d[2]>>>16,d[1],d[0]<<16|d[3]>>>16,d[2],d[1]<<16|d[0]>>>16,d[3],d[2]<<16|d[1]>>>16],g=this._C=[d[2]<<16|d[2]>>>16,d[0]&4294901760|d[1]&65535,d[3]<<16|d[3]>>>16,d[1]&4294901760|d[2]&65535,d[0]<<16|d[0]>>>16,d[2]&4294901760|d[3]&65535,d[1]<<16|d[1]>>>16,d[3]&4294901760|d[0]&65535];this._b=0;for(var v=0;v<4;v++)f.call(this);for(var v=0;v<8;v++)g[v]^=h[v+4&7];if(p){var x=p.words,b=x[0],S=x[1],_=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,P=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360,C=_>>>16|P&4294901760,B=P<<16|_&65535;g[0]^=_,g[1]^=C,g[2]^=P,g[3]^=B,g[4]^=_,g[5]^=C,g[6]^=P,g[7]^=B;for(var v=0;v<4;v++)f.call(this)}},_doProcessBlock:function(d,p){var h=this._X;f.call(this),o[0]=h[0]^h[5]>>>16^h[3]<<16,o[1]=h[2]^h[7]>>>16^h[5]<<16,o[2]=h[4]^h[1]>>>16^h[7]<<16,o[3]=h[6]^h[3]>>>16^h[1]<<16;for(var g=0;g<4;g++)o[g]=(o[g]<<8|o[g]>>>24)&16711935|(o[g]<<24|o[g]>>>8)&4278255360,d[p+g]^=o[g]},blockSize:128/32,ivSize:64/32});function f(){for(var d=this._X,p=this._C,h=0;h<8;h++)c[h]=p[h];p[0]=p[0]+1295307597+this._b|0,p[1]=p[1]+3545052371+(p[0]>>>0>>0?1:0)|0,p[2]=p[2]+886263092+(p[1]>>>0>>0?1:0)|0,p[3]=p[3]+1295307597+(p[2]>>>0>>0?1:0)|0,p[4]=p[4]+3545052371+(p[3]>>>0>>0?1:0)|0,p[5]=p[5]+886263092+(p[4]>>>0>>0?1:0)|0,p[6]=p[6]+1295307597+(p[5]>>>0>>0?1:0)|0,p[7]=p[7]+3545052371+(p[6]>>>0>>0?1:0)|0,this._b=p[7]>>>0>>0?1:0;for(var h=0;h<8;h++){var g=d[h]+p[h],v=g&65535,x=g>>>16,b=((v*v>>>17)+v*x>>>15)+x*x,S=((g&4294901760)*g|0)+((g&65535)*g|0);u[h]=b^S}d[0]=u[0]+(u[7]<<16|u[7]>>>16)+(u[6]<<16|u[6]>>>16)|0,d[1]=u[1]+(u[0]<<8|u[0]>>>24)+u[7]|0,d[2]=u[2]+(u[1]<<16|u[1]>>>16)+(u[0]<<16|u[0]>>>16)|0,d[3]=u[3]+(u[2]<<8|u[2]>>>24)+u[1]|0,d[4]=u[4]+(u[3]<<16|u[3]>>>16)+(u[2]<<16|u[2]>>>16)|0,d[5]=u[5]+(u[4]<<8|u[4]>>>24)+u[3]|0,d[6]=u[6]+(u[5]<<16|u[5]>>>16)+(u[4]<<16|u[4]>>>16)|0,d[7]=u[7]+(u[6]<<8|u[6]>>>24)+u[5]|0}n.RabbitLegacy=s._createHelper(l)}(),r.RabbitLegacy})}(Pb)),Pb.exports}var Tb={exports:{}},p9;function qJ(){return p9||(p9=1,function(t,e){(function(r,n,i){t.exports=n(_t(),Xl(),Ql(),xu(),an())})(it,function(r){return function(){var n=r,i=n.lib,s=i.BlockCipher,a=n.algo;const o=16,c=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],u=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var l={pbox:[],sbox:[]};function f(v,x){let b=x>>24&255,S=x>>16&255,_=x>>8&255,P=x&255,C=v.sbox[0][b]+v.sbox[1][S];return C=C^v.sbox[2][_],C=C+v.sbox[3][P],C}function d(v,x,b){let S=x,_=b,P;for(let C=0;C1;--C)S=S^v.pbox[C],_=f(v,S)^_,P=S,S=_,_=P;return P=S,S=_,_=P,_=_^v.pbox[1],S=S^v.pbox[0],{left:S,right:_}}function h(v,x,b){for(let B=0;B<4;B++){v.sbox[B]=[];for(let N=0;N<256;N++)v.sbox[B][N]=u[B][N]}let S=0;for(let B=0;B=b&&(S=0);let _=0,P=0,C=0;for(let B=0;Br.toString(16).padStart(2,"0")).join("")}async function aP(t){const e=t.API_ID,r=window.location.href;return Lt({method:"POST",url:"https://server.othent.io/use-othent",data:{API_ID:e,callbackURL:r}}).then(n=>{if(n.data.success===!1)throw new Error("Please specify an API ID (you can get one from Othent.io)");const i=()=>dV({domain:"auth.othent.io",clientId:"dyegx4dZj5yOv0v0RkoUsc48CIqaNS6C",authorizationParams:{redirect_uri:window.location.origin}});function s(c,u){return c.getTokenSilently({detailedResponse:!0,authorizationParams:u,cacheMode:"off"})}async function a(c){let u;if(c instanceof File)u=await async function(l){return new Promise((f,d)=>{const p=new FileReader;p.onload=()=>{const h=p.result,g=Buffer.from(h);f(g)},p.onerror=d,p.readAsArrayBuffer(l)})}(c);else if(typeof c=="string")u=Buffer.from(c,"utf8");else if(Buffer.isBuffer(c))u=c;else if(c instanceof ArrayBuffer||c instanceof SharedArrayBuffer)u=Buffer.from(c);else{if(!(c instanceof Uint8Array))throw new Error("Invalid data, we accept: string | Buffer | ArrayBuffer | SharedArrayBuffer | Uint8Array | File");u=Buffer.from(c.buffer)}return u}async function o(){const c=await i(),u={transaction_input:JSON.stringify({othentFunction:"idToken"})},l=(await s(c,u)).id_token,f=ic(l);if(f.contract_id)return delete f.nonce,delete f.sid,delete f.aud,delete f.iss,delete f.iat,delete f.exp,delete f.updated_at,f;throw new Error('{ success: false, message: "Please create a Othent account" }')}return{getAPIID:async function(){const c=await i(),u={transaction_input:JSON.stringify({othentFunction:"API_ID"})},l=(await s(c,u)).id_token,f=ic(l);if(f.contract_id)return{API_ID:f.API_ID};throw new Error('{ success: false, message: "Please create a Othent account" }')},queryWalletAddressTxns:async function(c){return await Lt({method:"POST",url:"https://server.othent.io/query-wallet-address-txns",data:{walletAddress:c.walletAddress}}).then(u=>u.data).catch(u=>{throw u})},ping:async function(){return await Lt({method:"GET",url:"https://server.othent.io/"}).then(c=>c.data).catch(c=>{throw c})},logIn:async function(){const c=await i();if(await c.isAuthenticated())return await o();{const u={authorizationParams:{transaction_input:JSON.stringify({othentFunction:"idToken"}),redirect_uri:window.location.origin}};let l=null,f="";try{await c.loginWithPopup(u);const d={transaction_input:JSON.stringify({othentFunction:"idToken"})};f=(await s(c,d)).id_token,l=ic(f)}catch(d){throw d instanceof Error&&d.message,new Error("Your browser is blocking us! Please turn off your shields or allow cross site cookies! :)")}return l&&l.contract_id?(delete l.nonce,delete l.sid,delete l.aud,delete l.iss,delete l.iat,delete l.exp,delete l.updated_at,l):await Lt({method:"POST",url:"https://server.othent.io/create-user",data:{JWT:f,API_ID:e}}).then(d=>{const p=d.data;return{contract_id:p.contract_id,given_name:p.given_name,family_name:p.family_name,nickname:p.nickname,name:p.name,picture:p.picture,locale:p.locale,email:p.email,email_verified:p.email_verified,sub:p.sub,success:p.success,message:p.message}}).catch(d=>{throw console.log(d.response.data),d})}},logOut:async function(){return await(await i()).logout({logoutParams:{returnTo:window.location.origin}}),{response:"User logged out"}},userDetails:o,readContract:async function(){const c=await i(),u={transaction_input:JSON.stringify({othentFunction:"idToken"})},l=(await s(c,u)).id_token;return await Lt({method:"POST",url:"https://server.othent.io/read-contract",data:{JWT:l}}).then(f=>f.data).catch(f=>{throw console.log(f.response.data),f})},signTransactionWarp:async function(c){var u;(u=c.tags)!==null&&u!==void 0||(c.tags=[]);const l={function:c.othentFunction,data:{toContractId:c.data.toContractId,toContractFunction:c.data.toContractFunction,txnData:c.data.txnData}},f=await i(),d={transaction_input:JSON.stringify({othentFunction:c.othentFunction,warpData:l})},p=await s(f,d),h=p.id_token;if(!ic(h).contract_id)throw new Error('{success: false, message:"Please create a Othent account"}');return{JWT:p.id_token,tags:c.tags}},sendTransactionWarp:async function(c){const u=c.JWT,l=c.tags;return await Lt({method:"POST",url:"https://server.othent.io/send-transaction",data:{JWT:u,tags:l,API_ID:e}}).then(f=>f.data).catch(f=>{throw console.log(f.response.data),f})},signTransactionArweave:async function(c){var u;(u=c.tags)!==null&&u!==void 0||(c.tags=[]);const l=await a(c.data);if(!l)throw new Error("Invalid data, we accept: string | Buffer | ArrayBuffer | SharedArrayBuffer | Uint8Array | File");const f=await A0(l),d=await i(),p={transaction_input:JSON.stringify({othentFunction:c.othentFunction,file_hash:f})},h=await s(d,p),g=h.id_token;if(!ic(g).contract_id)throw new Error('{ success: false, message: "Please create a Othent account" }');return{data:l,JWT:h.id_token,tags:c.tags}},sendTransactionArweave:async function(c){const u=c.data,l=new Blob([u]),f=new FormData;return f.append("file",l),f.append("dataHashJWT",c.JWT),f.append("API_ID",e),f.append("tags",JSON.stringify(c.tags)),await fetch("https://server.othent.io/upload-data-arweave",{method:"POST",body:f}).then(d=>d.json()).then(d=>d).catch(d=>{throw console.log(d),d})},signTransactionBundlr:async function(c){var u;(u=c.tags)!==null&&u!==void 0||(c.tags=[]);const l=await a(c.data);if(!l)throw new Error("Invalid data, we accept: string | Buffer | ArrayBuffer | SharedArrayBuffer | Uint8Array | File");const f=await A0(l),d=await i(),p={transaction_input:JSON.stringify({othentFunction:c.othentFunction,file_hash:f})},h=await s(d,p),g=h.id_token;if(!ic(g).contract_id)throw new Error('{ success: false, message: "Please create a Othent account" }');return{data:l,JWT:h.id_token,tags:c.tags}},sendTransactionBundlr:async function(c){const u=c.data,l=new Blob([u]),f=new FormData;return f.append("file",l),f.append("dataHashJWT",c.JWT),f.append("API_ID",e),f.append("tags",JSON.stringify(c.tags)),await fetch("https://server.othent.io/upload-data-bundlr",{method:"POST",body:f}).then(d=>d.json()).then(d=>d).catch(d=>{throw console.log(d),d})},initializeJWK:async function(c){const u=c.privateKey,l=JSON.stringify(u),f=JSON.parse(l),d=EA(f),p=await i(),h={transaction_input:JSON.stringify({othentFunction:"initializeJWK",warpData:{function:"initializeJWK",data:{JWK_public_key_PEM:d,JWK_public_key:null}}})},g=(await s(p,h)).id_token;return Lt({method:"POST",url:"https://server.othent.io/initialize-JWK",data:{PEM_key_JWT:g,API_ID:e}}).then(v=>v.data).catch(v=>{throw console.log(v.response.data),v})},JWKBackupTxn:async function(c){const u={iat:Math.floor(Date.now()/1e3),sub:c.sub,contract_id:c.contract_id,tags:c.tags,contract_input:{data:c.data,othentFunction:c.othentFunction}},l=c.privateKey,f=EA(l,{private:!0}),d={alg:"RS256",typ:"JWT",exp:Math.floor(Date.now()/1e3)+3600},p=bJ.jws.JWS.sign("RS256",JSON.stringify(d),JSON.stringify(u),f);return await Lt({method:"POST",url:"https://server.othent.io/JWK-backup-transaction",data:{JWK_signed_JWT:p,API_ID:e}}).then(h=>h.data).catch(h=>{throw console.log(h.response.data),h})},readCustomContract:async function(c){return await Lt({method:"POST",url:"https://server.othent.io/read-custom-contract",data:{contract_id:c.contract_id}}).then(u=>u.data).catch(u=>{throw console.log(u.response.data),u})},verifyArweaveData:async function(c){let u;(await(await fetch(`https://arweave.net/tx/${c.transactionId}`,{headers:{responseType:"arraybuffer"}})).json()).tags.map(h=>{atob(h.name)==="File-Hash-JWT"&&(u=ic(atob(h.value)))});const f=u.file_hash;let d=(await Lt.get(`https://arweave.net/${c.transactionId}`,{responseType:"arraybuffer"})).data;const p=await A0(d);return f===p?{validData:!0,contract_id:u.contract_id,onChainHash:p,tagHash:f,iat:u.iat,userId:u.sub}:{validData:!1,onChainHash:p,tagHash:f}},verifyBundlrData:async function(c){let u;(await(await fetch(`https://gateway.bundlr.network/tx/${c.transactionId}`,{headers:{responseType:"arraybuffer"}})).json()).tags.map(h=>{h.name==="File-Hash-JWT"&&(u=ic(h.value))});const f=u.file_hash;let d=(await Lt.get(`https://arweave.net/${c.transactionId}`,{responseType:"arraybuffer"})).data;const p=await A0(d);return f===p?{validData:!0,contract_id:u.contract_id,onChainHash:p,tagHash:f,iat:u.iat,userId:u.sub}:{validData:!1,onChainHash:p,tagHash:f}},encryptData:async function(c){const u=c.data,l=c.key;return{encryptedData:Nb.AES.encrypt(u,l).toString()}},decryptData:async function(c){const u=c.data,l=c.key,f=Nb.AES.decrypt(u,l);return{decryptedData:Nb.enc.Utf8.stringify(f)}},deployWarpContract:async function(c){var u;(u=c.tags)!==null&&u!==void 0||(c.tags=[]);const l=await A0(c.contractSrc),f=await i(),d={transaction_input:JSON.stringify({othentFunction:"uploadData",file_hash:l})},p=(await s(f,d)).id_token;return await Lt({method:"POST",url:"https://server.othent.io/deploy-warp-contract",data:{contractSrc:c.contractSrc,contractState:c.state,JWT:p,tags:c.tags}}).then(h=>h.data).catch(h=>{throw console.log(h.response.data),h})}}}).catch(n=>{throw console.error("An error occurred:",n),n})}const G5={name:"ArweaveKit",value:"1.5.1"},oP=t=>{const e=t||{};return{use:n=>{if(!n.name)throw new Error("Please provide a valid plugin name.");if(e.hasOwnProperty(n.name))throw new Error("Plugin name already exists, please change plugin name.");return e[n.name]=n.plugin,oP(e)},...e}},WJ="6.11.1";function GJ(t,e,r){const n=e.split("|").map(s=>s.trim());for(let s=0;sPromise.resolve(t[n])))).reduce((n,i,s)=>(n[e[s]]=i,n),{})}function ot(t,e,r){for(let n in e){let i=e[n];const s=r?r[n]:null;s&&GJ(i,s,n),Object.defineProperty(t,n,{enumerable:!0,value:i,writable:!1})}}function jf(t){if(t==null)return"null";if(Array.isArray(t))return"[ "+t.map(jf).join(", ")+" ]";if(t instanceof Uint8Array){const e="0123456789abcdef";let r="0x";for(let n=0;n>4],r+=e[t[n]&15];return r}if(typeof t=="object"&&typeof t.toJSON=="function")return jf(t.toJSON());switch(typeof t){case"boolean":case"symbol":return t.toString();case"bigint":return BigInt(t).toString();case"number":return t.toString();case"string":return JSON.stringify(t);case"object":{const e=Object.keys(t);return e.sort(),"{ "+e.map(r=>`${jf(r)}: ${jf(t[r])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function Cn(t,e){return t&&t.code===e}function Z5(t){return Cn(t,"CALL_EXCEPTION")}function Tr(t,e,r){let n=t;{const s=[];if(r){if("message"in r||"code"in r||"name"in r)throw new Error(`value will overwrite populated values: ${jf(r)}`);for(const a in r){if(a==="shortMessage")continue;const o=r[a];s.push(a+"="+jf(o))}}s.push(`code=${e}`),s.push(`version=${WJ}`),s.length&&(t+=" ("+s.join(", ")+")")}let i;switch(e){case"INVALID_ARGUMENT":i=new TypeError(t);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":i=new RangeError(t);break;default:i=new Error(t)}return ot(i,{code:e}),r&&Object.assign(i,r),i.shortMessage==null&&ot(i,{shortMessage:n}),i}function Oe(t,e,r,n){if(!t)throw Tr(e,r,n)}function fe(t,e,r,n){Oe(t,e,"INVALID_ARGUMENT",{argument:r,value:n})}function cP(t,e,r){r==null&&(r=""),r&&(r=": "+r),Oe(t>=e,"missing arguemnt"+r,"MISSING_ARGUMENT",{count:t,expectedCount:e}),Oe(t<=e,"too many arguments"+r,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}const ZJ=["NFD","NFC","NFKD","NFKC"].reduce((t,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");t.push(e)}catch{}return t},[]);function JJ(t){Oe(ZJ.indexOf(t)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:t}})}function l2(t,e,r){if(r==null&&(r=""),t!==e){let n=r,i="new";r&&(n+=".",i+=" "+r),Oe(!1,`private constructor; use ${n}from* methods`,"UNSUPPORTED_OPERATION",{operation:i})}}function uP(t,e,r){if(t instanceof Uint8Array)return r?new Uint8Array(t):t;if(typeof t=="string"&&t.match(/^0x([0-9a-f][0-9a-f])*$/i)){const n=new Uint8Array((t.length-2)/2);let i=2;for(let s=0;s>4]+g9[i&15]}return r}function Mr(t){return"0x"+t.map(e=>rt(e).substring(2)).join("")}function rd(t){return er(t,!0)?(t.length-2)/2:jt(t).length}function xr(t,e,r){const n=jt(t);return r!=null&&r>n.length&&Oe(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r}),rt(n.slice(e??0,r??n.length))}function lP(t,e,r){const n=jt(t);Oe(e>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:e,offset:e+1});const i=new Uint8Array(e);return i.fill(0),r?i.set(n,e-n.length):i.set(n,0),rt(i)}function Nl(t,e){return lP(t,e,!0)}function QJ(t,e){return lP(t,e,!1)}const f2=BigInt(0),zs=BigInt(1),Uf=9007199254740991;function YJ(t,e){const r=d2(t,"value"),n=BigInt(yt(e,"width"));if(Oe(r>>n===f2,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),r>>n-zs){const i=(zs<=-Uf&&t<=Uf,"overflow",e||"value",t),BigInt(t);case"string":try{if(t==="")throw new Error("empty string");return t[0]==="-"&&t[1]!=="-"?-BigInt(t.substring(1)):BigInt(t)}catch(r){fe(!1,`invalid BigNumberish string: ${r.message}`,e||"value",t)}}fe(!1,"invalid BigNumberish value",e||"value",t)}function d2(t,e){const r=tt(t,e);return Oe(r>=f2,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),r}const m9="0123456789abcdef";function J5(t){if(t instanceof Uint8Array){let e="0x0";for(const r of t)e+=m9[r>>4],e+=m9[r&15];return BigInt(e)}return tt(t)}function yt(t,e){switch(typeof t){case"bigint":return fe(t>=-Uf&&t<=Uf,"overflow",e||"value",t),Number(t);case"number":return fe(Number.isInteger(t),"underflow",e||"value",t),fe(t>=-Uf&&t<=Uf,"overflow",e||"value",t),t;case"string":try{if(t==="")throw new Error("empty string");return yt(BigInt(t),e)}catch(r){fe(!1,`invalid numeric string: ${r.message}`,e||"value",t)}}fe(!1,"invalid numeric value",e||"value",t)}function eX(t){return yt(J5(t))}function iu(t,e){let n=d2(t,"value").toString(16);if(e==null)n.length%2&&(n="0"+n);else{const i=yt(e,"width");for(Oe(i*2>=n.length,`value exceeds width (${i} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:t});n.length>6===2;a++)s++;return s}return t==="OVERRUN"?r.length-e-1:0}function sX(t,e,r,n,i){return t==="OVERLONG"?(fe(typeof i=="number","invalid bad code point for replacement","badCodepoint",i),n.push(i),0):(n.push(65533),hP(t,e,r))}const aX=Object.freeze({error:iX,ignore:hP,replace:sX});function oX(t,e){e==null&&(e=aX.error);const r=jt(t,"bytes"),n=[];let i=0;for(;i>7)){n.push(s);continue}let a=null,o=null;if((s&224)===192)a=1,o=127;else if((s&240)===224)a=2,o=2047;else if((s&248)===240)a=3,o=65535;else{(s&192)===128?i+=e("UNEXPECTED_CONTINUE",i-1,r,n):i+=e("BAD_PREFIX",i-1,r,n);continue}if(i-1+a>=r.length){i+=e("OVERRUN",i-1,r,n);continue}let c=s&(1<<8-a-1)-1;for(let u=0;u1114111){i+=e("OUT_OF_RANGE",i-1-a,r,n,c);continue}if(c>=55296&&c<=57343){i+=e("UTF16_SURROGATE",i-1-a,r,n,c);continue}if(c<=o){i+=e("OVERLONG",i-1-a,r,n,c);continue}n.push(c)}}return n}function ko(t,e){fe(typeof t=="string","invalid string value","str",t),e!=null&&(JJ(e),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);fe(n>18|240),r.push(a>>12&63|128),r.push(a>>6&63|128),r.push(a&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return new Uint8Array(r)}function cX(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function Av(t,e){return cX(oX(t,e))}function pP(t){async function e(r,n){const i=r.url.split(":")[0].toLowerCase();Oe(i==="http"||i==="https",`unsupported protocol ${i}`,"UNSUPPORTED_OPERATION",{info:{protocol:i},operation:"request"}),Oe(i==="https"||!r.credentials||r.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let s;if(n){const f=new AbortController;s=f.signal,n.addListener(()=>{f.abort()})}const a={method:r.method,headers:new Headers(Array.from(r)),body:r.body||void 0,signal:s},o=await fetch(r.url,a),c={};o.headers.forEach((f,d)=>{c[d.toLowerCase()]=f});const u=await o.arrayBuffer(),l=u==null?null:new Uint8Array(u);return{statusCode:o.status,statusMessage:o.statusText,headers:c,body:l}}return e}const uX=12,lX=250;let x9=pP();const fX=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),dX=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let Rb=!1;async function gP(t,e){try{const r=t.match(fX);if(!r)throw new Error("invalid data");return new Xc(200,"OK",{"content-type":r[1]||"text/plain"},r[2]?rX(r[3]):pX(r[3]))}catch{return new Xc(599,"BAD REQUEST (invalid data: URI)",{},null,new su(t))}}function mP(t){async function e(r,n){try{const i=r.match(dX);if(!i)throw new Error("invalid link");return new su(`${t}${i[2]}`)}catch{return new Xc(599,"BAD REQUEST (invalid IPFS URI)",{},null,new su(r))}}return e}const I1={data:gP,ipfs:mP("https://gateway.ipfs.io/ipfs/")},vP=new WeakMap;var qu,wc;class hX{constructor(e){ue(this,qu,void 0);ue(this,wc,void 0);Q(this,qu,[]),Q(this,wc,!1),vP.set(e,()=>{if(!U(this,wc)){Q(this,wc,!0);for(const r of U(this,qu))setTimeout(()=>{r()},0);Q(this,qu,[])}})}addListener(e){Oe(!U(this,wc),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),U(this,qu).push(e)}get cancelled(){return U(this,wc)}checkSignal(){Oe(!this.cancelled,"cancelled","CANCELLED",{})}}qu=new WeakMap,wc=new WeakMap;function F1(t){if(t==null)throw new Error("missing signal; should not happen");return t.checkSignal(),t}var ud,ld,Cs,to,fd,dd,Kr,di,ro,Ku,Wu,Gu,ua,no,Ec,Zu,L0;const uy=class uy{constructor(e){ue(this,Zu);ue(this,ud,void 0);ue(this,ld,void 0);ue(this,Cs,void 0);ue(this,to,void 0);ue(this,fd,void 0);ue(this,dd,void 0);ue(this,Kr,void 0);ue(this,di,void 0);ue(this,ro,void 0);ue(this,Ku,void 0);ue(this,Wu,void 0);ue(this,Gu,void 0);ue(this,ua,void 0);ue(this,no,void 0);ue(this,Ec,void 0);Q(this,dd,String(e)),Q(this,ud,!1),Q(this,ld,!0),Q(this,Cs,{}),Q(this,to,""),Q(this,fd,3e5),Q(this,no,{slotInterval:lX,maxAttempts:uX}),Q(this,Ec,null)}get url(){return U(this,dd)}set url(e){Q(this,dd,String(e))}get body(){return U(this,Kr)==null?null:new Uint8Array(U(this,Kr))}set body(e){if(e==null)Q(this,Kr,void 0),Q(this,di,void 0);else if(typeof e=="string")Q(this,Kr,ko(e)),Q(this,di,"text/plain");else if(e instanceof Uint8Array)Q(this,Kr,e),Q(this,di,"application/octet-stream");else if(typeof e=="object")Q(this,Kr,ko(JSON.stringify(e))),Q(this,di,"application/json");else throw new Error("invalid body")}hasBody(){return U(this,Kr)!=null}get method(){return U(this,to)?U(this,to):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),Q(this,to,String(e).toUpperCase())}get headers(){const e=Object.assign({},U(this,Cs));return U(this,ro)&&(e.authorization=`Basic ${nX(ko(U(this,ro)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&U(this,di)&&(e["content-type"]=U(this,di)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,r){U(this,Cs)[String(e).toLowerCase()]=String(r)}clearHeaders(){Q(this,Cs,{})}[Symbol.iterator](){const e=this.headers,r=Object.keys(e);let n=0;return{next:()=>{if(n=0,"timeout must be non-zero","timeout",e),Q(this,fd,e)}get preflightFunc(){return U(this,Ku)||null}set preflightFunc(e){Q(this,Ku,e)}get processFunc(){return U(this,Wu)||null}set processFunc(e){Q(this,Wu,e)}get retryFunc(){return U(this,Gu)||null}set retryFunc(e){Q(this,Gu,e)}get getUrlFunc(){return U(this,Ec)||x9}set getUrlFunc(e){Q(this,Ec,e)}toString(){return``}setThrottleParams(e){e.slotInterval!=null&&(U(this,no).slotInterval=e.slotInterval),e.maxAttempts!=null&&(U(this,no).maxAttempts=e.maxAttempts)}send(){return Oe(U(this,ua)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),Q(this,ua,new hX(this)),Ee(this,Zu,L0).call(this,0,b9()+this.timeout,0,this,new Xc(0,"",{},null,this))}cancel(){Oe(U(this,ua)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=vP.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const r=this.url.split(":")[0].toLowerCase(),n=e.split(":")[0].toLowerCase();Oe(this.method==="GET"&&(r!=="https"||n!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const i=new uy(e);return i.method="GET",i.allowGzip=this.allowGzip,i.timeout=this.timeout,Q(i,Cs,Object.assign({},U(this,Cs))),U(this,Kr)&&Q(i,Kr,new Uint8Array(U(this,Kr))),Q(i,di,U(this,di)),i}clone(){const e=new uy(this.url);return Q(e,to,U(this,to)),U(this,Kr)&&Q(e,Kr,U(this,Kr)),Q(e,di,U(this,di)),Q(e,Cs,Object.assign({},U(this,Cs))),Q(e,ro,U(this,ro)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),Q(e,Ku,U(this,Ku)),Q(e,Wu,U(this,Wu)),Q(e,Gu,U(this,Gu)),Q(e,Ec,U(this,Ec)),e}static lockConfig(){Rb=!0}static getGateway(e){return I1[e.toLowerCase()]||null}static registerGateway(e,r){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(Rb)throw new Error("gateways locked");I1[e]=r}static registerGetUrl(e){if(Rb)throw new Error("gateways locked");x9=e}static createGetUrlFunc(e){return pP()}static createDataGateway(){return gP}static createIpfsGatewayFunc(e){return mP(e)}};ud=new WeakMap,ld=new WeakMap,Cs=new WeakMap,to=new WeakMap,fd=new WeakMap,dd=new WeakMap,Kr=new WeakMap,di=new WeakMap,ro=new WeakMap,Ku=new WeakMap,Wu=new WeakMap,Gu=new WeakMap,ua=new WeakMap,no=new WeakMap,Ec=new WeakMap,Zu=new WeakSet,L0=async function(e,r,n,i,s){var l,f,d;if(e>=U(this,no).maxAttempts)return s.makeServerError("exceeded maximum retry limit");Oe(b9()<=r,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:i}),n>0&&await gX(n);let a=this.clone();const o=(a.url.split(":")[0]||"").toLowerCase();if(o in I1){const p=await I1[o](a.url,F1(U(i,ua)));if(p instanceof Xc){let h=p;if(this.processFunc){F1(U(i,ua));try{h=await this.processFunc(a,h)}catch(g){(g.throttle==null||typeof g.stall!="number")&&h.makeServerError("error in post-processing function",g).assertOk()}}return h}a=p}this.preflightFunc&&(a=await this.preflightFunc(a));const c=await this.getUrlFunc(a,F1(U(i,ua)));let u=new Xc(c.statusCode,c.statusMessage,c.headers,c.body,i);if(u.statusCode===301||u.statusCode===302){try{const p=u.headers.location||"";return Ee(l=a.redirect(p),Zu,L0).call(l,e+1,r,0,i,u)}catch{}return u}else if(u.statusCode===429&&(this.retryFunc==null||await this.retryFunc(a,u,e))){const p=u.headers["retry-after"];let h=U(this,no).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof p=="string"&&p.match(/^[1-9][0-9]*$/)&&(h=parseInt(p)),Ee(f=a.clone(),Zu,L0).call(f,e+1,r,h,i,u)}if(this.processFunc){F1(U(i,ua));try{u=await this.processFunc(a,u)}catch(p){(p.throttle==null||typeof p.stall!="number")&&u.makeServerError("error in post-processing function",p).assertOk();let h=U(this,no).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return p.stall>=0&&(h=p.stall),Ee(d=a.clone(),Zu,L0).call(d,e+1,r,h,i,u)}}return u};let su=uy;var fg,dg,hg,hi,hd,Ju;const XE=class XE{constructor(e,r,n,i,s){ue(this,fg,void 0);ue(this,dg,void 0);ue(this,hg,void 0);ue(this,hi,void 0);ue(this,hd,void 0);ue(this,Ju,void 0);Q(this,fg,e),Q(this,dg,r),Q(this,hg,Object.keys(n).reduce((a,o)=>(a[o.toLowerCase()]=String(n[o]),a),{})),Q(this,hi,i==null?null:new Uint8Array(i)),Q(this,hd,s||null),Q(this,Ju,{message:""})}toString(){return``}get statusCode(){return U(this,fg)}get statusMessage(){return U(this,dg)}get headers(){return Object.assign({},U(this,hg))}get body(){return U(this,hi)==null?null:new Uint8Array(U(this,hi))}get bodyText(){try{return U(this,hi)==null?"":Av(U(this,hi))}catch{Oe(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{Oe(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,r=Object.keys(e);let n=0;return{next:()=>{if(n=0,"invalid stall timeout","stall",r);const n=new Error(e||"throttling requests");throw ot(n,{stall:r,throttle:!0}),n}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return U(this,hi)!=null}get request(){return U(this,hd)}ok(){return U(this,Ju).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:r}=U(this,Ju);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let n=null;this.request&&(n=this.request.url);let i=null;try{U(this,hi)&&(i=Av(U(this,hi)))}catch{}Oe(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:r,info:{requestUrl:n,responseBody:i,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}};fg=new WeakMap,dg=new WeakMap,hg=new WeakMap,hi=new WeakMap,hd=new WeakMap,Ju=new WeakMap;let Xc=XE;function b9(){return new Date().getTime()}function pX(t){return ko(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function gX(t){return new Promise(e=>setTimeout(e,t))}function mX(t){let e=t.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function w9(t,e,r){let n=0;for(let i=0;i{Oe(n<=t.length,"data short segment too short","BUFFER_OVERRUN",{buffer:t,length:t.length,offset:n})};if(t[e]>=248){const n=t[e]-247;r(e+1+n);const i=w9(t,e+1,n);return r(e+1+n+i),E9(t,e,e+1+n,n+i)}else if(t[e]>=192){const n=t[e]-192;return r(e+1+n),E9(t,e,e+1,n)}else if(t[e]>=184){const n=t[e]-183;r(e+1+n);const i=w9(t,e+1,n);r(e+1+n+i);const s=rt(t.slice(e+1+n,e+1+n+i));return{consumed:1+n+i,result:s}}else if(t[e]>=128){const n=t[e]-128;r(e+1+n);const i=rt(t.slice(e+1,e+1+n));return{consumed:1+n,result:i}}return{consumed:1,result:mX(t[e])}}function h2(t){const e=jt(t,"data"),r=yP(e,0);return fe(r.consumed===e.length,"unexpected junk after rlp payload","data",t),r.result}function S9(t){const e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function xP(t){if(Array.isArray(t)){let n=[];if(t.forEach(function(s){n=n.concat(xP(s))}),n.length<=55)return n.unshift(192+n.length),n;const i=S9(n.length);return i.unshift(247+i.length),i.concat(n)}const e=Array.prototype.slice.call(jt(t,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const r=S9(e.length);return r.unshift(183+r.length),r.concat(e)}const A9="0123456789abcdef";function yh(t){let e="0x";for(const r of xP(t))e+=A9[r>>4],e+=A9[r&15];return e}const Ln=32,q4=new Uint8Array(Ln),vX=["then"],P1={};function C0(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);throw r.error=e,r}var Sc;const fp=class fp extends Array{constructor(...r){const n=r[0];let i=r[1],s=(r[2]||[]).slice(),a=!0;n!==P1&&(i=r,s=[],a=!1);super(i.length);ue(this,Sc,void 0);i.forEach((c,u)=>{this[u]=c});const o=s.reduce((c,u)=>(typeof u=="string"&&c.set(u,(c.get(u)||0)+1),c),new Map);if(Q(this,Sc,Object.freeze(i.map((c,u)=>{const l=s[u];return l!=null&&o.get(l)===1?l:null}))),!!a)return Object.freeze(this),new Proxy(this,{get:(c,u,l)=>{if(typeof u=="string"){if(u.match(/^[0-9]+$/)){const d=yt(u,"%index");if(d<0||d>=this.length)throw new RangeError("out of result range");const p=c[d];return p instanceof Error&&C0(`index ${d}`,p),p}if(vX.indexOf(u)>=0)return Reflect.get(c,u,l);const f=c[u];if(f instanceof Function)return function(...d){return f.apply(this===l?c:this,d)};if(!(u in c))return c.getValue.apply(this===l?c:this,[u])}return Reflect.get(c,u,l)}})}toArray(){const r=[];return this.forEach((n,i)=>{n instanceof Error&&C0(`index ${i}`,n),r.push(n)}),r}toObject(){return U(this,Sc).reduce((r,n,i)=>(Oe(n!=null,"value at index ${ index } unnamed","UNSUPPORTED_OPERATION",{operation:"toObject()"}),n in r||(r[n]=this.getValue(n)),r),{})}slice(r,n){r==null&&(r=0),r<0&&(r+=this.length,r<0&&(r=0)),n==null&&(n=this.length),n<0&&(n+=this.length,n<0&&(n=0)),n>this.length&&(n=this.length);const i=[],s=[];for(let a=r;a{U(this,io)[e]=C9(r)}}}io=new WeakMap,Xu=new WeakMap,pd=new WeakSet,dm=function(e){return U(this,io).push(e),Q(this,Xu,U(this,Xu)+e.length),e.length};var Wn,pi,Qu,Yu,Ac,pg,G4,ly,bP;const QE=class QE{constructor(e,r,n){ue(this,pg);ue(this,ly);se(this,"allowLoose");ue(this,Wn,void 0);ue(this,pi,void 0);ue(this,Qu,void 0);ue(this,Yu,void 0);ue(this,Ac,void 0);ot(this,{allowLoose:!!r}),Q(this,Wn,On(e)),Q(this,Qu,0),Q(this,Yu,null),Q(this,Ac,n??1024),Q(this,pi,0)}get data(){return rt(U(this,Wn))}get dataLength(){return U(this,Wn).length}get consumed(){return U(this,pi)}get bytes(){return new Uint8Array(U(this,Wn))}subReader(e){const r=new QE(U(this,Wn).slice(U(this,pi)+e),this.allowLoose,U(this,Ac));return Q(r,Yu,this),r}readBytes(e,r){let n=Ee(this,ly,bP).call(this,0,e,!!r);return Ee(this,pg,G4).call(this,e),Q(this,pi,U(this,pi)+n.length),n.slice(0,e)}readValue(){return J5(this.readBytes(Ln))}readIndex(){return eX(this.readBytes(Ln))}};Wn=new WeakMap,pi=new WeakMap,Qu=new WeakMap,Yu=new WeakMap,Ac=new WeakMap,pg=new WeakSet,G4=function(e){var r;if(U(this,Yu))return Ee(r=U(this,Yu),pg,G4).call(r,e);Q(this,Qu,U(this,Qu)+e),Oe(U(this,Ac)<1||U(this,Qu)<=U(this,Ac)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${U(this,Ac)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:On(U(this,Wn)),offset:U(this,pi),length:e,info:{bytesRead:U(this,Qu),dataLength:this.dataLength}})},ly=new WeakSet,bP=function(e,r,n){let i=Math.ceil(r/Ln)*Ln;return U(this,pi)+i>U(this,Wn).length&&(this.allowLoose&&n&&U(this,pi)+r<=U(this,Wn).length?i=r:Oe(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:On(U(this,Wn)),length:U(this,Wn).length,offset:U(this,pi)+i})),U(this,Wn).slice(U(this,pi),U(this,pi)+i)};let W4=QE;function _v(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function X5(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function yX(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");_v(t.outputLen),_v(t.blockLen)}function xh(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function wP(t,e){X5(t);const r=e.outputLen;if(t.lengtht instanceof Uint8Array,xX=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),Ob=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),aa=(t,e)=>t<<32-e|t>>>e,bX=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!bX)throw new Error("Non little-endian hardware is not supported");function wX(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function p2(t){if(typeof t=="string"&&(t=wX(t)),!EP(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function EX(...t){const e=new Uint8Array(t.reduce((n,i)=>n+i.length,0));let r=0;return t.forEach(n=>{if(!EP(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}class Q5{clone(){return this._cloneInto()}}function SP(t){const e=n=>t().update(p2(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function SX(t=32){if(Db&&typeof Db.getRandomValues=="function")return Db.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class AP extends Q5{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,yX(e);const n=p2(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let a=0;anew AP(t,e).update(r).digest();CP.create=(t,e)=>new AP(t,e);function AX(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),a=Number(r>>i&s),o=Number(r&s),c=n?4:0,u=n?0:4;t.setUint32(e+c,a,n),t.setUint32(e+u,o,n)}class CX extends Q5{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Ob(this.buffer)}update(e){xh(this);const{view:r,buffer:n,blockLen:i}=this;e=p2(e);const s=e.length;for(let a=0;ai-a&&(this.process(n,0),a=0);for(let f=a;fl.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;ft&e^~t&r,kX=(t,e,r)=>t&e^t&r^e&r,BX=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]),ac=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),oc=new Uint32Array(64);class IX extends CX{constructor(){super(64,32,8,!1),this.A=ac[0]|0,this.B=ac[1]|0,this.C=ac[2]|0,this.D=ac[3]|0,this.E=ac[4]|0,this.F=ac[5]|0,this.G=ac[6]|0,this.H=ac[7]|0}get(){const{A:e,B:r,C:n,D:i,E:s,F:a,G:o,H:c}=this;return[e,r,n,i,s,a,o,c]}set(e,r,n,i,s,a,o,c){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=a|0,this.G=o|0,this.H=c|0}process(e,r){for(let f=0;f<16;f++,r+=4)oc[f]=e.getUint32(r,!1);for(let f=16;f<64;f++){const d=oc[f-15],p=oc[f-2],h=aa(d,7)^aa(d,18)^d>>>3,g=aa(p,17)^aa(p,19)^p>>>10;oc[f]=g+oc[f-7]+h+oc[f-16]|0}let{A:n,B:i,C:s,D:a,E:o,F:c,G:u,H:l}=this;for(let f=0;f<64;f++){const d=aa(o,6)^aa(o,11)^aa(o,25),p=l+d+_X(o,c,u)+BX[f]+oc[f]|0,g=(aa(n,2)^aa(n,13)^aa(n,22))+kX(n,i,s)|0;l=u,u=c,c=o,o=a+p|0,a=s,s=i,i=n,n=p+g|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,a=a+this.D|0,o=o+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(n,i,s,a,o,c,u,l)}roundClean(){oc.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const FX=SP(()=>new IX),T1=BigInt(2**32-1),_9=BigInt(32);function PX(t,e=!1){return e?{h:Number(t&T1),l:Number(t>>_9&T1)}:{h:Number(t>>_9&T1)|0,l:Number(t&T1)|0}}function TX(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;it<>>32-r,RX=(t,e,r)=>e<>>32-r,DX=(t,e,r)=>e<>>64-r,OX=(t,e,r)=>t<>>64-r,[_P,kP,BP]=[[],[],[]],MX=BigInt(0),_0=BigInt(1),LX=BigInt(2),jX=BigInt(7),UX=BigInt(256),$X=BigInt(113);for(let t=0,e=_0,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],_P.push(2*(5*n+r)),kP.push((t+1)*(t+2)/2%64);let i=MX;for(let s=0;s<7;s++)e=(e<<_0^(e>>jX)*$X)%UX,e&LX&&(i^=_0<<(_0<r>32?DX(t,e,r):NX(t,e,r),B9=(t,e,r)=>r>32?OX(t,e,r):RX(t,e,r);function VX(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let a=0;a<10;a++)r[a]=t[a]^t[a+10]^t[a+20]^t[a+30]^t[a+40];for(let a=0;a<10;a+=2){const o=(a+8)%10,c=(a+2)%10,u=r[c],l=r[c+1],f=k9(u,l,1)^r[o],d=B9(u,l,1)^r[o+1];for(let p=0;p<50;p+=10)t[a+p]^=f,t[a+p+1]^=d}let i=t[2],s=t[3];for(let a=0;a<24;a++){const o=kP[a],c=k9(i,s,o),u=B9(i,s,o),l=_P[a];i=t[l],s=t[l+1],t[l]=c,t[l+1]=u}for(let a=0;a<50;a+=10){for(let o=0;o<10;o++)r[o]=t[a+o];for(let o=0;o<10;o++)t[a+o]^=~r[(o+2)%10]&r[(o+4)%10]}t[0]^=zX[n],t[1]^=HX[n]}r.fill(0)}class Y5 extends Q5{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,_v(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=xX(this.state)}keccak(){VX(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){xh(this);const{blockLen:r,state:n}=this;e=p2(e);const i=e.length;for(let s=0;s=n&&this.keccak();const a=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+a),i),this.posOut+=a,i+=a}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return _v(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(wP(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:a}=this;return e||(e=new Y5(r,n,i,a,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=a,e.destroyed=this.destroyed,e}}const qX=(t,e,r)=>SP(()=>new Y5(e,t,r)),KX=qX(1,136,256/8);let IP=!1;const FP=function(t){return KX(t)};let PP=FP;function hr(t){const e=jt(t,"data");return rt(PP(e))}hr._=FP;hr.lock=function(){IP=!0};hr.register=function(t){if(IP)throw new TypeError("keccak256 is locked");PP=t};Object.freeze(hr);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const TP=BigInt(0),g2=BigInt(1),WX=BigInt(2),m2=t=>t instanceof Uint8Array,GX=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function bh(t){if(!m2(t))throw new Error("Uint8Array expected");let e="";for(let r=0;rn+i.length,0));let r=0;return t.forEach(n=>{if(!m2(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}function JX(t,e){if(t.length!==e.length)return!1;for(let r=0;rTP;t>>=g2,e+=1);return e}function YX(t,e){return t>>BigInt(e)&g2}const eQ=(t,e,r)=>t|(r?g2:TP)<(WX<new Uint8Array(t),I9=t=>Uint8Array.from(t);function RP(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=Mb(t),i=Mb(t),s=0;const a=()=>{n.fill(1),i.fill(0),s=0},o=(...f)=>r(i,n,...f),c=(f=Mb())=>{i=o(I9([0]),f),n=o(),f.length!==0&&(i=o(I9([1]),f),n=o())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const d=[];for(;f{a(),c(f);let p;for(;!(p=d(u()));)c();return a(),p}}const tQ={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Gg(t,e,r={}){const n=(i,s,a)=>{const o=tQ[s];if(typeof o!="function")throw new Error(`Invalid validator "${s}", expected function`);const c=t[i];if(!(a&&c===void 0)&&!o(c,t))throw new Error(`Invalid param ${String(i)}=${c} (${typeof c}), expected ${s}`)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const rQ=Object.freeze(Object.defineProperty({__proto__:null,bitGet:YX,bitLen:QX,bitMask:nE,bitSet:eQ,bytesToHex:bh,bytesToNumberBE:wl,bytesToNumberLE:tE,concatBytes:Dp,createHmacDrbg:RP,ensureBytes:As,equalBytes:JX,hexToBytes:wh,hexToNumber:eE,numberToBytesBE:Eh,numberToBytesLE:rE,numberToHexUnpadded:NP,numberToVarBytesBE:ZX,utf8ToBytes:XX,validateObject:Gg},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Yr=BigInt(0),Cr=BigInt(1),Nu=BigInt(2),nQ=BigInt(3),Z4=BigInt(4),F9=BigInt(5),P9=BigInt(8);BigInt(9);BigInt(16);function Jn(t,e){const r=t%e;return r>=Yr?r:e+r}function iQ(t,e,r){if(r<=Yr||e 0");if(r===Cr)return Yr;let n=Cr;for(;e>Yr;)e&Cr&&(n=n*t%r),t=t*t%r,e>>=Cr;return n}function ji(t,e,r){let n=t;for(;e-- >Yr;)n*=n,n%=r;return n}function J4(t,e){if(t===Yr||e<=Yr)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=Jn(t,e),n=e,i=Yr,s=Cr;for(;r!==Yr;){const o=n/r,c=n%r,u=i-s*o;n=r,r=c,i=s,s=u}if(n!==Cr)throw new Error("invert: does not exist");return Jn(i,e)}function sQ(t){const e=(t-Cr)/Nu;let r,n,i;for(r=t-Cr,n=0;r%Nu===Yr;r/=Nu,n++);for(i=Nu;i(n[i]="function",n),e);return Gg(t,r)}function uQ(t,e,r){if(r 0");if(r===Yr)return t.ONE;if(r===Cr)return e;let n=t.ONE,i=e;for(;r>Yr;)r&Cr&&(n=t.mul(n,i)),i=t.sqr(i),r>>=Cr;return n}function lQ(t,e){const r=new Array(e.length),n=e.reduce((s,a,o)=>t.is0(a)?s:(r[o]=s,t.mul(s,a)),t.ONE),i=t.inv(n);return e.reduceRight((s,a,o)=>t.is0(a)?s:(r[o]=t.mul(s,r[o]),t.mul(s,a)),i),r}function DP(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function fQ(t,e,r=!1,n={}){if(t<=Yr)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=DP(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=aQ(t),o=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:nE(i),ZERO:Yr,ONE:Cr,create:c=>Jn(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return Yr<=c&&cc===Yr,isOdd:c=>(c&Cr)===Cr,neg:c=>Jn(-c,t),eql:(c,u)=>c===u,sqr:c=>Jn(c*c,t),add:(c,u)=>Jn(c+u,t),sub:(c,u)=>Jn(c-u,t),mul:(c,u)=>Jn(c*u,t),pow:(c,u)=>uQ(o,c,u),div:(c,u)=>Jn(c*J4(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>J4(c,t),sqrt:n.sqrt||(c=>a(o,c)),invertBatch:c=>lQ(o,c),cmov:(c,u,l)=>l?u:c,toBytes:c=>r?rE(c,s):Eh(c,s),fromBytes:c=>{if(c.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${c.length}`);return r?tE(c):wl(c)}});return Object.freeze(o)}function OP(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function MP(t){const e=OP(t);return e+Math.ceil(e/2)}function dQ(t,e,r=!1){const n=t.length,i=OP(e),s=MP(e);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const a=r?wl(t):tE(t),o=Jn(a,e-Cr)+Cr;return r?rE(o,i):Eh(o,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const hQ=BigInt(0),Lb=BigInt(1);function pQ(t,e){const r=(i,s)=>{const a=s.negate();return i?a:s},n=i=>{const s=Math.ceil(e/i)+1,a=2**(i-1);return{windows:s,windowSize:a}};return{constTimeNegate:r,unsafeLadder(i,s){let a=t.ZERO,o=i;for(;s>hQ;)s&Lb&&(a=a.add(o)),o=o.double(),s>>=Lb;return a},precomputeWindow(i,s){const{windows:a,windowSize:o}=n(s),c=[];let u=i,l=u;for(let f=0;f>=p,v>c&&(v-=d,a+=Lb);const x=g,b=g+Math.abs(v)-1,S=h%2!==0,_=v<0;v===0?l=l.add(r(S,s[x])):u=u.add(r(_,s[b]))}return{p:u,f:l}},wNAFCached(i,s,a,o){const c=i._WINDOW_SIZE||1;let u=s.get(i);return u||(u=this.precomputeWindow(i,c),c!==1&&s.set(i,o(u))),this.wNAF(c,u,a)}}}function LP(t){return cQ(t.Fp),Gg(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...DP(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function gQ(t){const e=LP(t);Gg(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:mQ,hexToBytes:vQ}=rQ,zu={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=zu;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");const r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:mQ(n),l:t.subarray(r+2)}},toSig(t){const{Err:e}=zu,r=typeof t=="string"?vQ(t):t;if(!(r instanceof Uint8Array))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");const{d:i,l:s}=zu._parseInt(r.subarray(2)),{d:a,l:o}=zu._parseInt(s);if(o.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s:a}},hexFromSig(t){const e=u=>Number.parseInt(u[0],16)&8?"00"+u:u,r=u=>{const l=u.toString(16);return l.length&1?`0${l}`:l},n=e(r(t.s)),i=e(r(t.r)),s=n.length/2,a=i.length/2,o=r(s),c=r(a);return`30${r(a+s+4)}02${c}${i}02${o}${n}`}},mo=BigInt(0),Gi=BigInt(1);BigInt(2);const T9=BigInt(3);BigInt(4);function yQ(t){const e=gQ(t),{Fp:r}=e,n=e.toBytes||((h,g,v)=>{const x=g.toAffine();return Dp(Uint8Array.from([4]),r.toBytes(x.x),r.toBytes(x.y))}),i=e.fromBytes||(h=>{const g=h.subarray(1),v=r.fromBytes(g.subarray(0,r.BYTES)),x=r.fromBytes(g.subarray(r.BYTES,2*r.BYTES));return{x:v,y:x}});function s(h){const{a:g,b:v}=e,x=r.sqr(h),b=r.mul(x,h);return r.add(r.add(b,r.mul(h,g)),v)}if(!r.eql(r.sqr(e.Gy),s(e.Gx)))throw new Error("bad generator point: equation left != right");function a(h){return typeof h=="bigint"&&mor.eql(S,r.ZERO);return b(v)&&b(x)?f.ZERO:new f(v,x,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(g){const v=r.invertBatch(g.map(x=>x.pz));return g.map((x,b)=>x.toAffine(v[b])).map(f.fromAffine)}static fromHex(g){const v=f.fromAffine(i(As("pointHex",g)));return v.assertValidity(),v}static fromPrivateKey(g){return f.BASE.multiply(c(g))}_setWindowSize(g){this._WINDOW_SIZE=g,u.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:g,y:v}=this.toAffine();if(!r.isValid(g)||!r.isValid(v))throw new Error("bad point: x or y not FE");const x=r.sqr(v),b=s(g);if(!r.eql(x,b))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:g}=this.toAffine();if(r.isOdd)return!r.isOdd(g);throw new Error("Field doesn't support isOdd")}equals(g){l(g);const{px:v,py:x,pz:b}=this,{px:S,py:_,pz:P}=g,C=r.eql(r.mul(v,P),r.mul(S,b)),B=r.eql(r.mul(x,P),r.mul(_,b));return C&&B}negate(){return new f(this.px,r.neg(this.py),this.pz)}double(){const{a:g,b:v}=e,x=r.mul(v,T9),{px:b,py:S,pz:_}=this;let P=r.ZERO,C=r.ZERO,B=r.ZERO,N=r.mul(b,b),T=r.mul(S,S),D=r.mul(_,_),R=r.mul(b,S);return R=r.add(R,R),B=r.mul(b,_),B=r.add(B,B),P=r.mul(g,B),C=r.mul(x,D),C=r.add(P,C),P=r.sub(T,C),C=r.add(T,C),C=r.mul(P,C),P=r.mul(R,P),B=r.mul(x,B),D=r.mul(g,D),R=r.sub(N,D),R=r.mul(g,R),R=r.add(R,B),B=r.add(N,N),N=r.add(B,N),N=r.add(N,D),N=r.mul(N,R),C=r.add(C,N),D=r.mul(S,_),D=r.add(D,D),N=r.mul(D,R),P=r.sub(P,N),B=r.mul(D,T),B=r.add(B,B),B=r.add(B,B),new f(P,C,B)}add(g){l(g);const{px:v,py:x,pz:b}=this,{px:S,py:_,pz:P}=g;let C=r.ZERO,B=r.ZERO,N=r.ZERO;const T=e.a,D=r.mul(e.b,T9);let R=r.mul(v,S),E=r.mul(x,_),F=r.mul(b,P),A=r.add(v,x),I=r.add(S,_);A=r.mul(A,I),I=r.add(R,E),A=r.sub(A,I),I=r.add(v,b);let j=r.add(S,P);return I=r.mul(I,j),j=r.add(R,F),I=r.sub(I,j),j=r.add(x,b),C=r.add(_,P),j=r.mul(j,C),C=r.add(E,F),j=r.sub(j,C),N=r.mul(T,I),C=r.mul(D,F),N=r.add(C,N),C=r.sub(E,N),N=r.add(E,N),B=r.mul(C,N),E=r.add(R,R),E=r.add(E,R),F=r.mul(T,F),I=r.mul(D,I),E=r.add(E,F),F=r.sub(R,F),F=r.mul(T,F),I=r.add(I,F),R=r.mul(E,I),B=r.add(B,R),R=r.mul(j,I),C=r.mul(A,C),C=r.sub(C,R),R=r.mul(A,E),N=r.mul(j,N),N=r.add(N,R),new f(C,B,N)}subtract(g){return this.add(g.negate())}is0(){return this.equals(f.ZERO)}wNAF(g){return p.wNAFCached(this,u,g,v=>{const x=r.invertBatch(v.map(b=>b.pz));return v.map((b,S)=>b.toAffine(x[S])).map(f.fromAffine)})}multiplyUnsafe(g){const v=f.ZERO;if(g===mo)return v;if(o(g),g===Gi)return this;const{endo:x}=e;if(!x)return p.unsafeLadder(this,g);let{k1neg:b,k1:S,k2neg:_,k2:P}=x.splitScalar(g),C=v,B=v,N=this;for(;S>mo||P>mo;)S&Gi&&(C=C.add(N)),P&Gi&&(B=B.add(N)),N=N.double(),S>>=Gi,P>>=Gi;return b&&(C=C.negate()),_&&(B=B.negate()),B=new f(r.mul(B.px,x.beta),B.py,B.pz),C.add(B)}multiply(g){o(g);let v=g,x,b;const{endo:S}=e;if(S){const{k1neg:_,k1:P,k2neg:C,k2:B}=S.splitScalar(v);let{p:N,f:T}=this.wNAF(P),{p:D,f:R}=this.wNAF(B);N=p.constTimeNegate(_,N),D=p.constTimeNegate(C,D),D=new f(r.mul(D.px,S.beta),D.py,D.pz),x=N.add(D),b=T.add(R)}else{const{p:_,f:P}=this.wNAF(v);x=_,b=P}return f.normalizeZ([x,b])[0]}multiplyAndAddUnsafe(g,v,x){const b=f.BASE,S=(P,C)=>C===mo||C===Gi||!P.equals(b)?P.multiplyUnsafe(C):P.multiply(C),_=S(this,v).add(S(g,x));return _.is0()?void 0:_}toAffine(g){const{px:v,py:x,pz:b}=this,S=this.is0();g==null&&(g=S?r.ONE:r.inv(b));const _=r.mul(v,g),P=r.mul(x,g),C=r.mul(b,g);if(S)return{x:r.ZERO,y:r.ZERO};if(!r.eql(C,r.ONE))throw new Error("invZ was invalid");return{x:_,y:P}}isTorsionFree(){const{h:g,isTorsionFree:v}=e;if(g===Gi)return!0;if(v)return v(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:g,clearCofactor:v}=e;return g===Gi?this:v?v(f,this):this.multiplyUnsafe(e.h)}toRawBytes(g=!0){return this.assertValidity(),n(f,this,g)}toHex(g=!0){return bh(this.toRawBytes(g))}}f.BASE=new f(e.Gx,e.Gy,r.ONE),f.ZERO=new f(r.ZERO,r.ONE,r.ZERO);const d=e.nBitLength,p=pQ(f,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:s,isWithinCurveOrder:a}}function xQ(t){const e=LP(t);return Gg(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function bQ(t){const e=xQ(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function a(I){return mobh(Eh(I,e.nByteLength));function h(I){const j=n>>Gi;return I>j}function g(I){return h(I)?o(-I):I}const v=(I,j,$)=>wl(I.slice(j,$));class x{constructor(j,$,W){this.r=j,this.s=$,this.recovery=W,this.assertValidity()}static fromCompact(j){const $=e.nByteLength;return j=As("compactSignature",j,$*2),new x(v(j,0,$),v(j,$,2*$))}static fromDER(j){const{r:$,s:W}=zu.toSig(As("DER",j));return new x($,W)}assertValidity(){if(!d(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!d(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(j){return new x(this.r,this.s,j)}recoverPublicKey(j){const{r:$,s:W,recovery:H}=this,O=B(As("msgHash",j));if(H==null||![0,1,2,3].includes(H))throw new Error("recovery id invalid");const L=H===2||H===3?$+e.n:$;if(L>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const q=H&1?"03":"02",ee=u.fromHex(q+p(L)),X=c(L),ae=o(-O*X),ve=o(W*X),de=u.BASE.multiplyAndAddUnsafe(ee,ae,ve);if(!de)throw new Error("point at infinify");return de.assertValidity(),de}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new x(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return wh(this.toDERHex())}toDERHex(){return zu.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return wh(this.toCompactHex())}toCompactHex(){return p(this.r)+p(this.s)}}const b={isValidPrivateKey(I){try{return l(I),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const I=MP(e.n);return dQ(e.randomBytes(I),e.n)},precompute(I=8,j=u.BASE){return j._setWindowSize(I),j.multiply(BigInt(3)),j}};function S(I,j=!0){return u.fromPrivateKey(I).toRawBytes(j)}function _(I){const j=I instanceof Uint8Array,$=typeof I=="string",W=(j||$)&&I.length;return j?W===i||W===s:$?W===2*i||W===2*s:I instanceof u}function P(I,j,$=!0){if(_(I))throw new Error("first arg must be private key");if(!_(j))throw new Error("second arg must be public key");return u.fromHex(j).multiply(l(I)).toRawBytes($)}const C=e.bits2int||function(I){const j=wl(I),$=I.length*8-e.nBitLength;return $>0?j>>BigInt($):j},B=e.bits2int_modN||function(I){return o(C(I))},N=nE(e.nBitLength);function T(I){if(typeof I!="bigint")throw new Error("bigint expected");if(!(mo<=I&&Iwe in $))throw new Error("sign() legacy options not supported");const{hash:W,randomBytes:H}=e;let{lowS:O,prehash:L,extraEntropy:q}=$;O==null&&(O=!0),I=As("msgHash",I),L&&(I=As("prehashed msgHash",W(I)));const ee=B(I),X=l(j),ae=[T(X),T(ee)];if(q!=null){const we=q===!0?H(r.BYTES):q;ae.push(As("extraEntropy",we))}const ve=Dp(...ae),de=ee;function pe(we){const _e=C(we);if(!d(_e))return;const Me=c(_e),Fe=u.BASE.multiply(_e).toAffine(),De=o(Fe.x);if(De===mo)return;const V=o(Me*o(de+De*X));if(V===mo)return;let le=(Fe.x===De?0:2)|Number(Fe.y&Gi),ce=V;return O&&h(V)&&(ce=g(V),le^=1),new x(De,ce,le)}return{seed:ve,k2sig:pe}}const R={lowS:e.lowS,prehash:!1},E={lowS:e.lowS,prehash:!1};function F(I,j,$=R){const{seed:W,k2sig:H}=D(I,j,$),O=e;return RP(O.hash.outputLen,O.nByteLength,O.hmac)(W,H)}u.BASE._setWindowSize(8);function A(I,j,$,W=E){var Fe;const H=I;if(j=As("msgHash",j),$=As("publicKey",$),"strict"in W)throw new Error("options.strict was renamed to lowS");const{lowS:O,prehash:L}=W;let q,ee;try{if(typeof H=="string"||H instanceof Uint8Array)try{q=x.fromDER(H)}catch(De){if(!(De instanceof zu.Err))throw De;q=x.fromCompact(H)}else if(typeof H=="object"&&typeof H.r=="bigint"&&typeof H.s=="bigint"){const{r:De,s:V}=H;q=new x(De,V)}else throw new Error("PARSE");ee=u.fromHex($)}catch(De){if(De.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(O&&q.hasHighS())return!1;L&&(j=e.hash(j));const{r:X,s:ae}=q,ve=B(j),de=c(ae),pe=o(ve*de),we=o(X*de),_e=(Fe=u.BASE.multiplyAndAddUnsafe(ee,pe,we))==null?void 0:Fe.toAffine();return _e?o(_e.x)===X:!1}return{CURVE:e,getPublicKey:S,getSharedSecret:P,sign:F,verify:A,ProjectivePoint:u,Signature:x,utils:b}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function wQ(t){return{hash:t,hmac:(e,...r)=>CP(t,e,EX(...r)),randomBytes:SX}}function EQ(t,e){const r=n=>bQ({...t,...wQ(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const jP=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),N9=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),SQ=BigInt(1),X4=BigInt(2),R9=(t,e)=>(t+e/X4)/e;function AQ(t){const e=jP,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),a=BigInt(23),o=BigInt(44),c=BigInt(88),u=t*t*t%e,l=u*u*t%e,f=ji(l,r,e)*l%e,d=ji(f,r,e)*l%e,p=ji(d,X4,e)*u%e,h=ji(p,i,e)*p%e,g=ji(h,s,e)*h%e,v=ji(g,o,e)*g%e,x=ji(v,c,e)*v%e,b=ji(x,o,e)*g%e,S=ji(b,r,e)*l%e,_=ji(S,a,e)*h%e,P=ji(_,n,e)*u%e,C=ji(P,X4,e);if(!Q4.eql(Q4.sqr(C),t))throw new Error("Cannot find square root");return C}const Q4=fQ(jP,void 0,void 0,{sqrt:AQ}),lc=EQ({a:BigInt(0),b:BigInt(7),Fp:Q4,n:N9,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=N9,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-SQ*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,a=BigInt("0x100000000000000000000000000000000"),o=R9(s*t,e),c=R9(-n*t,e);let u=Jn(t-o*r-c*i,e),l=Jn(-o*n-c*s,e);const f=u>a,d=l>a;if(f&&(u=e-u),d&&(l=e-l),u>a||l>a)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:f,k1:u,k2neg:d,k2:l}}}},FX);BigInt(0);lc.ProjectivePoint;const Op="0x0000000000000000000000000000000000000000",D9="0x0000000000000000000000000000000000000000000000000000000000000000",O9=BigInt(0),M9=BigInt(1),L9=BigInt(2),j9=BigInt(27),U9=BigInt(28),N1=BigInt(35),uf={};function $9(t){return Nl(Mn(t),32)}var gd,md,vd,el;const Es=class Es{constructor(e,r,n,i){ue(this,gd,void 0);ue(this,md,void 0);ue(this,vd,void 0);ue(this,el,void 0);l2(e,uf,"Signature"),Q(this,gd,r),Q(this,md,n),Q(this,vd,i),Q(this,el,null)}get r(){return U(this,gd)}set r(e){fe(rd(e)===32,"invalid r","value",e),Q(this,gd,rt(e))}get s(){return U(this,md)}set s(e){fe(rd(e)===32,"invalid s","value",e);const r=rt(e);fe(parseInt(r.substring(0,3))<8,"non-canonical s","value",r),Q(this,md,r)}get v(){return U(this,vd)}set v(e){const r=yt(e,"value");fe(r===27||r===28,"invalid v","v",e),Q(this,vd,r)}get networkV(){return U(this,el)}get legacyChainId(){const e=this.networkV;return e==null?null:Es.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=jt(this.s);return this.yParity&&(e[0]|=128),rt(e)}get compactSerialized(){return Mr([this.r,this.yParityAndS])}get serialized(){return Mr([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new Es(uf,this.r,this.s,this.v);return this.networkV&&Q(e,el,this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(e){const r=tt(e,"v");return r==j9||r==U9?O9:(fe(r>=N1,"invalid EIP-155 v","v",e),(r-N1)/L9)}static getChainIdV(e,r){return tt(e)*L9+BigInt(35+r-27)}static getNormalizedV(e){const r=tt(e);return r===O9||r===j9?27:r===M9||r===U9?28:(fe(r>=N1,"invalid v","v",e),r&M9?27:28)}static from(e){function r(u,l){fe(u,l,"signature",e)}if(e==null)return new Es(uf,D9,D9,27);if(typeof e=="string"){const u=jt(e,"signature");if(u.length===64){const l=rt(u.slice(0,32)),f=u.slice(32,64),d=f[0]&128?28:27;return f[0]&=127,new Es(uf,l,rt(f),d)}if(u.length===65){const l=rt(u.slice(0,32)),f=u.slice(32,64);r((f[0]&128)===0,"non-canonical s");const d=Es.getNormalizedV(u[64]);return new Es(uf,l,rt(f),d)}r(!1,"invalid raw signature length")}if(e instanceof Es)return e.clone();const n=e.r;r(n!=null,"missing r");const i=$9(n),s=function(u,l){if(u!=null)return $9(u);if(l!=null){r(er(l,32),"invalid yParityAndS");const f=jt(l);return f[0]&=127,rt(f)}r(!1,"missing s")}(e.s,e.yParityAndS);r((jt(s)[0]&128)==0,"non-canonical s");const{networkV:a,v:o}=function(u,l,f){if(u!=null){const d=tt(u);return{networkV:d>=N1?d:void 0,v:Es.getNormalizedV(d)}}if(l!=null)return r(er(l,32),"invalid yParityAndS"),{v:jt(l)[0]&128?28:27};if(f!=null){switch(yt(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}r(!1,"invalid yParity")}r(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),c=new Es(uf,i,s,o);return a&&Q(c,el,a),r(e.yParity==null||yt(e.yParity,"sig.yParity")===c.yParity,"yParity mismatch"),r(e.yParityAndS==null||e.yParityAndS===c.yParityAndS,"yParityAndS mismatch"),c}};gd=new WeakMap,md=new WeakMap,vd=new WeakMap,el=new WeakMap;let Gs=Es;var so;const Ru=class Ru{constructor(e){ue(this,so,void 0);fe(rd(e)===32,"invalid private key","privateKey","[REDACTED]"),Q(this,so,rt(e))}get privateKey(){return U(this,so)}get publicKey(){return Ru.computePublicKey(U(this,so))}get compressedPublicKey(){return Ru.computePublicKey(U(this,so),!0)}sign(e){fe(rd(e)===32,"invalid digest length","digest",e);const r=lc.sign(On(e),On(U(this,so)),{lowS:!0});return Gs.from({r:iu(r.r,32),s:iu(r.s,32),v:r.recovery?28:27})}computeSharedSecret(e){const r=Ru.computePublicKey(e);return rt(lc.getSharedSecret(On(U(this,so)),jt(r),!1))}static computePublicKey(e,r){let n=jt(e,"key");if(n.length===32){const s=lc.getPublicKey(n,!!r);return rt(s)}if(n.length===64){const s=new Uint8Array(65);s[0]=4,s.set(n,1),n=s}const i=lc.ProjectivePoint.fromHex(n);return rt(i.toRawBytes(r))}static recoverPublicKey(e,r){fe(rd(e)===32,"invalid digest length","digest",e);const n=Gs.from(r);let i=lc.Signature.fromCompact(On(Mr([n.r,n.s])));i=i.addRecoveryBit(n.yParity);const s=i.recoverPublicKey(On(e));return fe(s!=null,"invalid signautre for digest","signature",r),"0x"+s.toHex(!1)}static addPoints(e,r,n){const i=lc.ProjectivePoint.fromHex(Ru.computePublicKey(e).substring(2)),s=lc.ProjectivePoint.fromHex(Ru.computePublicKey(r).substring(2));return"0x"+i.add(s).toHex(!!n)}};so=new WeakMap;let Mp=Ru;const CQ=BigInt(0),_Q=BigInt(36);function z9(t){t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=jt(hr(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const iE={};for(let t=0;t<10;t++)iE[String(t)]=String(t);for(let t=0;t<26;t++)iE[String.fromCharCode(65+t)]=String(10+t);const H9=15;function kQ(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>iE[n]).join("");for(;e.length>=H9;){let n=e.substring(0,H9);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}const BQ=function(){const t={};for(let e=0;e<36;e++){const r="0123456789abcdefghijklmnopqrstuvwxyz"[e];t[r]=BigInt(e)}return t}();function IQ(t){t=t.toLowerCase();let e=CQ;for(let r=0;re.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return U(this,tl)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return U(this,tl)===!0?-1:U(this,tl)===!1?this.value.length:null}static from(e,r){return new Xa(Za,e,r)}static uint8(e){return Je(e,8)}static uint16(e){return Je(e,16)}static uint24(e){return Je(e,24)}static uint32(e){return Je(e,32)}static uint40(e){return Je(e,40)}static uint48(e){return Je(e,48)}static uint56(e){return Je(e,56)}static uint64(e){return Je(e,64)}static uint72(e){return Je(e,72)}static uint80(e){return Je(e,80)}static uint88(e){return Je(e,88)}static uint96(e){return Je(e,96)}static uint104(e){return Je(e,104)}static uint112(e){return Je(e,112)}static uint120(e){return Je(e,120)}static uint128(e){return Je(e,128)}static uint136(e){return Je(e,136)}static uint144(e){return Je(e,144)}static uint152(e){return Je(e,152)}static uint160(e){return Je(e,160)}static uint168(e){return Je(e,168)}static uint176(e){return Je(e,176)}static uint184(e){return Je(e,184)}static uint192(e){return Je(e,192)}static uint200(e){return Je(e,200)}static uint208(e){return Je(e,208)}static uint216(e){return Je(e,216)}static uint224(e){return Je(e,224)}static uint232(e){return Je(e,232)}static uint240(e){return Je(e,240)}static uint248(e){return Je(e,248)}static uint256(e){return Je(e,256)}static uint(e){return Je(e,256)}static int8(e){return Je(e,-8)}static int16(e){return Je(e,-16)}static int24(e){return Je(e,-24)}static int32(e){return Je(e,-32)}static int40(e){return Je(e,-40)}static int48(e){return Je(e,-48)}static int56(e){return Je(e,-56)}static int64(e){return Je(e,-64)}static int72(e){return Je(e,-72)}static int80(e){return Je(e,-80)}static int88(e){return Je(e,-88)}static int96(e){return Je(e,-96)}static int104(e){return Je(e,-104)}static int112(e){return Je(e,-112)}static int120(e){return Je(e,-120)}static int128(e){return Je(e,-128)}static int136(e){return Je(e,-136)}static int144(e){return Je(e,-144)}static int152(e){return Je(e,-152)}static int160(e){return Je(e,-160)}static int168(e){return Je(e,-168)}static int176(e){return Je(e,-176)}static int184(e){return Je(e,-184)}static int192(e){return Je(e,-192)}static int200(e){return Je(e,-200)}static int208(e){return Je(e,-208)}static int216(e){return Je(e,-216)}static int224(e){return Je(e,-224)}static int232(e){return Je(e,-232)}static int240(e){return Je(e,-240)}static int248(e){return Je(e,-248)}static int256(e){return Je(e,-256)}static int(e){return Je(e,-256)}static bytes1(e){return Nt(e,1)}static bytes2(e){return Nt(e,2)}static bytes3(e){return Nt(e,3)}static bytes4(e){return Nt(e,4)}static bytes5(e){return Nt(e,5)}static bytes6(e){return Nt(e,6)}static bytes7(e){return Nt(e,7)}static bytes8(e){return Nt(e,8)}static bytes9(e){return Nt(e,9)}static bytes10(e){return Nt(e,10)}static bytes11(e){return Nt(e,11)}static bytes12(e){return Nt(e,12)}static bytes13(e){return Nt(e,13)}static bytes14(e){return Nt(e,14)}static bytes15(e){return Nt(e,15)}static bytes16(e){return Nt(e,16)}static bytes17(e){return Nt(e,17)}static bytes18(e){return Nt(e,18)}static bytes19(e){return Nt(e,19)}static bytes20(e){return Nt(e,20)}static bytes21(e){return Nt(e,21)}static bytes22(e){return Nt(e,22)}static bytes23(e){return Nt(e,23)}static bytes24(e){return Nt(e,24)}static bytes25(e){return Nt(e,25)}static bytes26(e){return Nt(e,26)}static bytes27(e){return Nt(e,27)}static bytes28(e){return Nt(e,28)}static bytes29(e){return Nt(e,29)}static bytes30(e){return Nt(e,30)}static bytes31(e){return Nt(e,31)}static bytes32(e){return Nt(e,32)}static address(e){return new Xa(Za,"address",e)}static bool(e){return new Xa(Za,"bool",!!e)}static bytes(e){return new Xa(Za,"bytes",e)}static string(e){return new Xa(Za,"string",e)}static array(e,r){throw new Error("not implemented yet")}static tuple(e,r){throw new Error("not implemented yet")}static overrides(e){return new Xa(Za,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===V9}static dereference(e,r){if(Xa.isTyped(e)){if(e.type!==r)throw new Error(`invalid type: expecetd ${r}, got ${e.type}`);return e.value}return e}};tl=new WeakMap;let kn=Xa;class PQ extends Go{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){let n=kn.dereference(r,"string");try{n=qt(n)}catch(i){return this._throwError(i.message,r)}return e.writeValue(n)}decode(e){return qt(iu(e.readValue(),20))}}class TQ extends Go{constructor(r){super(r.name,r.type,"_",r.dynamic);se(this,"coder");this.coder=r}defaultValue(){return this.coder.defaultValue()}encode(r,n){return this.coder.encode(r,n)}decode(r){return this.coder.decode(r)}}function $P(t,e,r){let n=[];if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let c={};n=e.map(u=>{const l=u.localName;return Oe(l,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:r}),Oe(!c[l],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:r}),c[l]=!0,r[l]})}else fe(!1,"invalid tuple value","tuple",r);fe(e.length===n.length,"types/value length mismatch","tuple",r);let i=new K4,s=new K4,a=[];e.forEach((c,u)=>{let l=n[u];if(c.dynamic){let f=s.length;c.encode(s,l);let d=i.writeUpdatableValue();a.push(p=>{d(p+f)})}else c.encode(i,l)}),a.forEach(c=>{c(i.length)});let o=t.appendWriter(i);return o+=t.appendWriter(s),o}function zP(t,e){let r=[],n=[],i=t.subReader(0);return e.forEach(s=>{let a=null;if(s.dynamic){let o=t.readIndex(),c=i.subReader(o);try{a=s.decode(c)}catch(u){if(Cn(u,"BUFFER_OVERRUN"))throw u;a=u,a.baseType=s.name,a.name=s.localName,a.type=s.type}}else try{a=s.decode(t)}catch(o){if(Cn(o,"BUFFER_OVERRUN"))throw o;a=o,a.baseType=s.name,a.name=s.localName,a.type=s.type}if(a==null)throw new Error("investigate");r.push(a),n.push(s.localName||null)}),Cv.fromItems(r,n)}class NQ extends Go{constructor(r,n,i){const s=r.type+"["+(n>=0?n:"")+"]",a=n===-1||r.dynamic;super("array",s,i,a);se(this,"coder");se(this,"length");ot(this,{coder:r,length:n})}defaultValue(){const r=this.coder.defaultValue(),n=[];for(let i=0;ia||i<-(a+UQ))&&this._throwError("value out-of-bounds",n),i=fP(i,8*Ln)}else(iM0(s,this.size*8))&&this._throwError("value out-of-bounds",n);return r.writeValue(i)}decode(r){let n=M0(r.readValue(),this.size*8);return this.signed&&(n=YJ(n,this.size*8)),n}}class HQ extends HP{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,ko(kn.dereference(r,"string")))}decode(e){return Av(super.decode(e))}}class R1 extends Go{constructor(r,n){let i=!1;const s=[];r.forEach(o=>{o.dynamic&&(i=!0),s.push(o.type)});const a="tuple("+s.join(",")+")";super("tuple",a,n,i);se(this,"coders");ot(this,{coders:Object.freeze(r.slice())})}defaultValue(){const r=[];this.coders.forEach(i=>{r.push(i.defaultValue())});const n=this.coders.reduce((i,s)=>{const a=s.localName;return a&&(i[a]||(i[a]=0),i[a]++),i},{});return this.coders.forEach((i,s)=>{let a=i.localName;!a||n[a]!==1||(a==="length"&&(a="_length"),r[a]==null&&(r[a]=r[s]))}),Object.freeze(r)}encode(r,n){const i=kn.dereference(n,"tuple");return $P(r,this.coders,i)}decode(r){return zP(r,this.coders)}}function Rl(t){return hr(ko(t))}var VQ="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3EfAbfNAz81KUsFWwF3YQZtAm0A+VEfAzEJDQBRSQCzAQBlAHsAM70GD/v3IZWHBwARKQAxALsjTwHZAeMPEzmXgIHwABIAGQA8AEUAQDt3gdvIEGcQZAkGTRFMdEIVEwK0D64L7REdDNkq09PgADSxB/MDWwfzA1sDWwfzB/MDWwfzA1sDWwNbA1scEvAi28gQZw9QBHUFlgWTBN4IiyZREYkHMAjaVBV0JhxPA00BBCMtSSQ7mzMTJUpMFE0LCAQ2SmyvfUADTzGzVP2QqgPTMlc5dAkGHnkSqAAyD3skNb1OhnpPcagKU0+2tYdJak5vAsY6sEAACikJm2/Dd1YGRRAfJ6kQ+ww3AbkBPw3xS9wE9QY/BM0fgRkdD9GVoAipLeEM8SbnLqWAXiP5KocF8Uv4POELUVFsD10LaQnnOmeBUgMlAREijwrhDT0IcRD3Cs1vDekRSQc9A9lJngCpBwULFR05FbkmFGKwCw05ewb/GvoLkyazEy17AAXXGiUGUQEtGwMA0y7rhbRaNVwgT2MGBwspI8sUrFAkDSlAu3hMGh8HGSWtApVDdEqLUToelyH6PEENai4XUYAH+TwJGVMLhTyiRq9FEhHWPpE9TCJNTDAEOYMsMyePCdMPiQy9fHYBXQklCbUMdRM1ERs3yQg9Bx0xlygnGQglRplgngT7owP3E9UDDwVDCUUHFwO5HDETMhUtBRGBKNsC9zbZLrcCk1aEARsFzw8pH+MQVEfkDu0InwJpA4cl7wAxFSUAGyKfCEdnAGOP3FMJLs8Iy2pwI3gDaxTrZRF3B5UOWwerHDcVwxzlcMxeD4YMKKezCV8BeQmdAWME5wgNNV+MpCBFZ1eLXBifIGVBQ14AAjUMaRWjRMGHfAKPD28SHwE5AXcHPQ0FAnsR8RFvEJkI74YINbkz/DopBFMhhyAVCisDU2zSCysm/Qz8bQGnEmYDEDRBd/Jnr2C6KBgBBx0yyUFkIfULlk/RDKAaxRhGVDIZ6AfDA/ca9yfuQVsGAwOnBxc6UTPyBMELbQiPCUMATQ6nGwfbGG4KdYzUATWPAbudA1uVhwJzkwY7Bw8Aaw+LBX3pACECqwinAAkA0wNbAD0CsQehAB0AiUUBQQMrMwEl6QKTA5cINc8BmTMB9y0EH8cMGQD7O25OAsO1AoBuZqYF4VwCkgJNOQFRKQQJUktVA7N15QDfAE8GF+NLARmvTs8e50cB43MvAMsA/wAJOQcJRQHRAfdxALsBYws1Caa3uQFR7S0AhwAZbwHbAo0A4QA5AIP1AVcAUQVd/QXXAlNNARU1HC9bZQG/AyMBNwERAH0Gz5GpzQsjBHEH1wIQHxXlAu8yB7kFAyLjE9FCyQK94lkAMhoKPAqrCqpgX2Q3CjV2PVQAEh+sPss/UgVVO1c7XDtXO1w7VztcO1c7XDtXO1wDm8Pmw+YKcF9JYe8Mqg3YRMw6TRPfYFVgNhPMLbsUxRXSJVoZQRrAJwkl6FUNDwgt12Y0CDA0eRfAAEMpbINFY4oeNApPHOtTlVT8LR8AtUumM7MNsBsZREQFS3XxYi4WEgomAmSFAmJGX1GzAV83JAKh+wJonAJmDQKfiDgfDwJmPwJmKgRyBIMDfxcDfpY5Cjl7GzmGOicnAmwhAjI6OA4CbcsCbbLzjgM3a0kvAWsA4gDlAE4JB5wMkQECD8YAEbkCdzMCdqZDAnlPRwJ4viFg30WyRvcCfEMCeswCfQ0CfPRIBEiBZygALxlJXEpfGRtK0ALRBQLQ0EsrA4hTA4fqRMmRNgLypV0HAwOyS9JMMSkH001QTbMCi0MCitzFHwshR2sJuwKOOwKOYESbhQKO3QKOYHxRuFM5AQ5S2FSJApP/ApMQAO0AIFUiVbNV1AosHymZijLleGpFPz0Cl6MC77ZYJawAXSkClpMCloCgAK1ZsFoNhVEAPwKWuQKWUlxIXNUCmc8CmWhczl0LHQKcnznGOqECnBoCn58CnryOACETNS4TAp31Ap6WALlBYThh8wKe1wKgcgGtAp6jIwKeUqljzGQrKS8CJ7MCJoICoP8CoFDbAqYzAqXSAqgDAIECp/ZogGi1AAdNaiBq1QKs5wKssgKtawKtBgJXIQJV4AKx5dsDH1JsmwKywRECsuwbbORtZ21MYwMl0QK2YD9DbpQDKUkCuGICuUsZArkue3A6cOUCvR0DLbYDMhUCvoxyBgMzdQK+HnMmc1MCw88CwwhzhnRPOUl05AM8qwEDPJ4DPcMCxYACxksCxhSNAshtVQLISALJUwLJMgJkoQLd1nh9ZXiyeSlL1AMYp2cGAmH4GfeVKHsPXpZevxUCz28Cz3AzT1fW9xejAMqxAs93AS3uA04Wfk8JAtwrAtuOAtJTA1JgA1NjAQUDVZCAjUMEzxrxZEl5A4LSg5EC2ssC2eKEFIRNp0ADhqkAMwNkEoZ1Xf0AWQLfaQLevHd7AuIz7RgB8zQrAfSfAfLWiwLr9wLpdH0DAur9AuroAP1LAb0C7o0C66CWrpcHAu5DA4XkmH1w5HGlAvMHAG0DjhqZlwL3FwORcgOSiwL3nAL53QL4apogmq+/O5siA52HAv7+AR8APZ8gAZ+3AwWRA6ZuA6bdANXJAwZuoYyiCQ0DDE0BEwEjB3EGZb1rCQC/BG/DFY8etxEAG3k9ACcDNxJRA42DAWcrJQCM8wAlAOanC6OVCLsGI6fJBgCvBRnDBvElRUYFFoAFcD9GSDNCKUK8X3kZX8QAls0FOgCQVCGbwTsuYDoZutcONxjOGJHJ/gVfBWAFXwVgBWsFYAVfBWAFXwVgBV8FYAVfBWBOHQjfjW8KCgoKbF7xMwTRA7kGN8PDAMMEr8MA70gxFroFTj5xPnhCR0K+X30/X/AAWBkzswCNBsxzzASm70aCRS4rDDMeLz49fnXfcsH5GcoscQFz13Y4HwVnBXLJycnACNdRYwgICAqEXoWTxgA7P4kACxbZBu21Kw0AjMsTAwkVAOVtJUUsJ1JCuULESUArXy9gPi9AKwnJRQYKTD9LPoA+iT54PnkCkULEUUpDX9NWV3JVEjQAc1w3A3IBE3YnX+g7QiMJb6MKaiszRCUuQrNCxDPMCcwEX9EWJzYREBEEBwIHKn6l33JCNVIfybPJtAltydPUCmhBZw/tEKsZAJOVJU1CLRuxbUHOQAo7P0s+eEJHHA8SJVRPdGM0NVrpvBoKhfUlM0JHHGUQUhEWO1xLSj8MO0ucNAqJIzVCRxv9EFsqKyA4OQgNj2nwZgp5ZNFgE2A1K3YHS2AhQQojJmC7DgpzGG1WYFUZCQYHZO9gHWCdYIVgu2BTYJlwFh8GvRbcXbG8YgtDHrMBwzPVyQonHQgkCyYBgQJ0Ajc4nVqIAwGSCsBPIgDsK3SWEtIVBa5N8gGjAo+kVwVIZwD/AEUSCDweX4ITrRQsJ8K3TwBXFDwEAB0TvzVcAtoTS20RIwDgVgZ9BBImYgA5AL4Coi8LFnezOkCnIQFjAY4KBAPh9RcGsgZSBsEAJctdsWIRu2kTkQstRw7DAcMBKgpPBGIGMDAwKCYnKTQaLg4AKRSVAFwCdl+YUZ0JdicFD3lPAdt1F9ZZKCGxuE3yBxkFVGcA/wBFEgiCBwAOLHQSjxOtQDg1z7deFRMAZ8QTAGtKb1ApIiPHADkAvgKiLy1DFtYCmBiDAlDDWNB0eo7fpaMO/aEVRRv0ATEQZBIODyMEAc8JQhCbDRgzFD4TAEMAu9YBCgCsAOkAm5I3ABwAYxvONnR+MhXJAxgKQyxL2+kkJhMbhQKDBMkSsvF0AD9BNQ6uQC7WqSQHwxEAEEIu1hkhAH2z4iQPwyJPHNWpdyYBRSpnJALzoBAEVPPsH20MxA0CCEQKRgAFyAtFAlMNwwjEDUQJRArELtapMg7DDZgJIw+TGukEIwvDFkMAqAtDEMMMBhioe+QAO3MMRAACrgnEBSPY9Q0FDnbSBoMAB8MSYxkSxAEJAPIJAAB8FWMOFtMc/HcXwxhDAC7DAvOowwAewwJdKDKHAAHDAALrFUQVwwAbwyvzpWMWv8wA/ABpAy++bcYDUKPD0KhDCwKmJ1MAAmMA5+UZwxAagwipBRL/eADfw6fDGOMCGsOjk3l6BwOpo4sAEsMOGxMAA5sAbcMOAAvDp0MJGkMDwgipnNIPAwfIqUMGAOGDAAPzABXDAAcDAAnDAGmTABrDAA7DChjDjnEWAwABYwAOcwAuUyYABsMAF8MIKQANUgC6wy4AA8MADqMq8wCyYgAcIwAB8wqpAAXOCx0V4wAHowBCwwEKAGnDAAuDAB3DAAjDCakABdIAbqcZ3QCZCCkABdIAAAFDAAfjAB2jCCkABqIACYMAGzMAbSMA5sOIAAhjAAhDABTDBAkpAAbSAOOTAAlDC6kOzPtnAAdDAG6kQFAATwAKwwwAA0MACbUDPwAHIwAZgwACE6cDAAojAApDAAoDp/MGwwAJIwADEwAQQwgAFEMAEXMAD5MADfMADcMAGRMOFiMAFUMAbqMWuwHDAMIAE0MLAGkzEgDhUwACQwAEWgAXgwUjAAbYABjDBSYBgzBaAEFNALcQBxUMegAwMngBrA0IZgJ0KxQHBREPd1N0ZzKRJwaIHAZqNT4DqQq8BwngAB4DAwt2AX56T1ocKQNXAh1GATQGC3tOxYNagkgAMQA5CQADAQEAWxLjAIOYNAEzAH7tFRk6TglSAF8NAAlYAQ+S1ACAQwQorQBiAN4dAJ1wPyeTANVzuQDX3AIeEMp9eyMgXiUAEdkBkJizKltbVVAaRMqRAAEAhyQ/SDEz6BmfVwB6ATEsOClKIRcDOF0E/832AFNt5AByAnkCRxGCOs94NjXdAwINGBonDBwPALW2AwICAgAAAAAAAAYDBQMDARrUAwAtAAAAAgEGBgYGBgYFBQUFBQUEBQYHCAkEBQUFBQQAAAICAAAAIgCNAJAAlT0A6gC7ANwApEQAwgCyAK0AqADuAKYA2gCjAOcBCAEDAMcAgQBiANIA1AEDAN4A8gCQAKkBMQDqAN8A3AsBCQ8yO9ra2tq8xuLT1tRJOB0BUgFcNU0BWgFpAWgBWwFMUUlLbhMBUxsNEAs6PhMOACcUKy0vMj5AQENDQ0RFFEYGJFdXV1dZWVhZL1pbXVxcI2NnZ2ZoZypsbnZ1eHh4eHh4enp6enp6enp6enp8fH18e2IARPIASQCaAHgAMgBm+ACOAFcAVwA3AnbvAIsABfj4AGQAk/IAnwBPAGIAZP//sACFAIUAaQBWALEAJAC2AIMCQAJDAPwA5wD+AP4A6AD/AOkA6QDoAOYALwJ7AVEBQAE+AVQBPgE+AT4BOQE4ATgBOAEcAVgXADEQCAEAUx8SHgsdHhYAjgCWAKYAUQBqIAIxAHYAbwCXAxUDJzIDIUlGTzEAkQJPAMcCVwKkAMAClgKWApYClgKWApYCiwKWApYClgKWApYClgKVApUCmAKgApcClgKWApQClAKUApQCkgKVAnUB1AKXAp8ClgKWApUeAIETBQD+DQOfAmECOh8BVBg9AuIZEjMbAU4/G1WZAXusRAFpYQEFA0FPAQYAmTEeIJdyADFoAHEANgCRA5zMk/C2jGINwjMWygIZCaXdfDILBCs5dAE7YnQBugDlhoiHhoiGiYqKhouOjIaNkI6Ij4qQipGGkoaThpSSlYaWhpeKmIaZhpqGm4aci52QnoqfhuIC4XTpAt90AIp0LHSoAIsAdHQEQwRABEIERQRDBEkERgRBBEcESQRIBEQERgRJAJ5udACrA490ALxuAQ10ANFZdHQA13QCFHQA/mJ0AP4BIQD+APwA/AD9APwDhGZ03ASMK23HAP4A/AD8AP0A/CR0dACRYnQA/gCRASEA/gCRAvQA/gCRA4RmdNwEjCttxyR0AP9idAEhAP4A/gD8APwA/QD8AP8A/AD8AP0A/AOEZnTcBIwrbcckdHQAkWJ0ASEA/gCRAP4AkQL0AP4AkQOEZnTcBIwrbcckdAJLAT50AlIBQXQCU8l0dAJfdHQDpgL0A6YDpgOnA6cDpwOnA4RmdNwEjCttxyR0dACRYnQBIQOmAJEDpgCRAvQDpgCRA4RmdNwEjCttxyR0BDh0AJEEOQCRDpU5dSgCADR03gV2CwArdAEFAM5iCnR0AF1iAAYcOgp0dACRCnQAXAEIwWZ0CnRmdHQAkWZ0CnRmdEXgAFF03gp0dEY0tlT2u3SOAQTwscwhjZZKrhYcBSfFp9XNbKiVDOD2b+cpe4/Z17mQnbtzzhaeQtE2GGj0IDNTjRUSyTxxw/RPHW/+vS7d1NfRt9z9QPZg4X7QFfhCnkvgNPIItOsC2eV6hPannZNHlZ9xrwZXIMOlu3jSoQSq78WEjwLjw1ELSlF1aBvfzwk5ZX7AUvQzjPQKbDuQ+sm4wNOp4A6AdVuRS0t1y/DZpg4R6m7FNjM9HgvW7Bi88zaMjOo6lM8wtBBdj8LP4ylv3zCXPhebMKJc066o9sF71oFW/8JXu86HJbwDID5lzw5GWLR/LhT0Qqnp2JQxNZNfcbLIzPy+YypqRm/lBmGmex+82+PisxUumSeJkALIT6rJezxMH+CTJmQtt5uwTVbL3ptmjDUQzlSIvWi8Tl7ng1NpuRn1Ng4n14Qc+3Iil7OwkvNWogLSPkn3pihIFytyIGmMhOe3n1tWsuMy9BdKyqF4Z3v2SgggTL9KVvMXPnCbRe+oOuFFP3HejBG/w9gvmfNYvg6JuWia2lcSSN1uIjBktzoIazOHPJZ7kKHPz8mRWVdW3lA8WGF9dQF6Bm673boov3BUWDU2JNcahR23GtfHKLOz/viZ+rYnZFaIznXO67CYEJ1fXuTRpZhYZkKe54xeoagkNGLs+NTZHE0rX45/XvQ2RGADX6vcAvdxIUBV27wxGm2zjZo4X3ILgAlrOFheuZ6wtsvaIj4yLY7qqawlliaIcrz2G+c3vscAnCkCuMzMmZvMfu9lLwTvfX+3cVSyPdN9ZwgDZhfjRgNJcLiJ67b9xx8JHswprbiE3v9UphotAPIgnXVIN5KmMc0piXhc6cChPnN+MRhG9adtdttQTTwSIpl8I4/j//d3sz1326qTBTpPRM/Hgh3kzqEXs8ZAk4ErQhNO8hzrQ0DLkWMA/N+91tn2MdOJnWC2FCZehkQrwzwbKOjhvZsbM95QoeL9skYyMf4srVPVJSgg7pOLUtr/n9eT99oe9nLtFRpjA9okV2Kj8h9k5HaC0oivRD8VyXkJ81tcd4fHNXPCfloIQasxsuO18/46dR2jgul/UIet2G0kRvnyONMKhHs6J26FEoqSqd+rfYjeEGwHWVDpX1fh1jBBcKGMqRepju9Y00mDVHC+Xdij/j44rKfvfjGinNs1jO/0F3jB83XCDINN/HB84axlP+3E/klktRo+vl3U/aiyMJbIodE1XSsDn6UAzIoMtUObY2+k/4gY/l+AkZJ5Sj2vQrkyLm3FoxjhDX+31UXBFf9XrAH31fFqoBmDEZvhvvpnZ87N+oZEu7U9O/nnk+QWj3x8uyoRbEnf+O5UMr9i0nHP38IF5AvzrBW8YWBUR0mIAzIvndQq9N3v/Jto3aPjPXUPl8ASdPPyAp7jENf8bk7VMM9ol9XGmlBmeDMuGqt+WzuL6CXAxXjIhCPM5vACchgMJ/8XBGLO/D1isVvGhwwHHr1DLaI5mn2Jr/b1pUD90uciDaS8cXNDzCWvNmT/PhQe5e8nTnnnkt8Ds/SIjibcum/fqDhKopxAY8AkSrPn+IGDEKOO+U3XOP6djFs2H5N9+orhOahiQk5KnEUWa+CzkVzhp8bMHRbg81qhjjXuIKbHjSLSIBKWqockGtKinY+z4/RdBUF6pcc3JmnlxVcNgrI4SEzKUZSwcD2QCyxzKve+gAmg6ZuSRkpPFa6mfThu7LJNu3H5K42uCpNvPAsoedolKV/LHe/eJ+BbaG5MG0NaSGVPRUmNFMFFSSpXEcXwbVh7UETOZZtoVNRGOIbbkig3McEtR68cG0RZAoJevWYo7Dg/lZ1CQzblWeUvVHmr8fY4Nqd9JJiH/zEX24mJviH60fAyFr0A3c4bC1j3yZU60VgJxXn8JgJXLUIsiBnmKmMYz+7yBQFBvqb2eYnuW59joZBf56/wXvWIR4R8wTmV80i1mZy+S4+BUES+hzjk0uXpC///z/IlqHZ1monzlXp8aCfhGKMti73FI1KbL1q6IKO4fuBuZ59gagjn5xU79muMpHXg6S+e+gDM/U9BKLHbl9l6o8czQKl4RUkJJiqftQG2i3BMg/TQlUYFkJDYBOOvAugYuzYSDnZbDDd/aSd9x0Oe6F+bJcHfl9+gp6L5/TgA+BdFFovbfCrQ40s5vMPw8866pNX8zyFGeFWdxIpPVp9Rg1UPOVFbFZrvaFq/YAzHQgqMWpahMYfqHpmwXfHL1/kpYmGuHFwT55mQu0dylfNuq2Oq0hTMCPwqfxnuBIPLXfci4Y1ANy+1CUipQxld/izVh16WyG2Q0CQQ9NqtAnx1HCHwDj7sYxOSB0wopZSnOzxQOcExmxrVTF2BkOthVpGfuhaGECfCJpJKpjnihY+xOT2QJxN61+9K6QSqtv2Shr82I3jgJrqBg0wELFZPjvHpvzTtaJnLK6Vb97Yn933koO/saN7fsjwNKzp4l2lJVx2orjCGzC/4ZL4zCver6aQYtC5sdoychuFE6ufOiog+VWi5UDkbmvmtah/3aArEBIi39s5ILUnlFLgilcGuz9CQshEY7fw2ouoILAYPVT/gyAIq3TFAIwVsl+ktkRz/qGfnCDGrm5gsl/l9QdvCWGsjPz3dU7XuqKfdUrr/6XIgjp4rey6AJBmCmUJMjITHVdFb5m1p+dLMCL8t55zD42cmftmLEJC0Da04YiRCVUBLLa8D071/N5UBNBXDh0LFsmhV/5B5ExOB4j3WVG/S3lfK5o+V6ELHvy6RR9n4ac+VsK4VE4yphPvV+kG9FegTBH4ZRXL2HytUHCduJazB/KykjfetYxOXTLws267aGOd+I+JhKP//+VnXmS90OD/jvLcVu0asyqcuYN1mSb6XTlCkqv1vigZPIYwNF/zpWcT1GR/6aEIRjkh0yhg4LXJfaGobYJTY4JI58KiAKgmmgAKWdl5nYCeLqavRJGQNuYuZtZFGx+IkI4w4NS2xwbetNMunOjBu/hmKCI/w7tfiiyUd//4rbTeWt4izBY8YvGIN6vyKYmP/8X8wHKCeN+WRcKM70+tXKNGyevU9H2Dg5BsljnTf8YbsJ1TmMs74Ce2XlHisleguhyeg44rQOHZuw/6HTkhnnurK2d62q6yS7210SsAIaR+jXMQA+svkrLpsUY+F30Uw89uOdGAR6vo4FIME0EfVVeHTu6eKicfhSqOeXJhbftcd08sWEnNUL1C9fnprTgd83IMut8onVUF0hvqzZfHduPjbjwEXIcoYmy+P6tcJZHmeOv6VrvEdkHDJecjHuHeWANe79VG662qTjA/HCvumVv3qL+LrOcpqGps2ZGwQdFJ7PU4iuyRlBrwfO+xnPyr47s2cXVbWzAyznDiBGjCM3ksxjjqM62GE9C8f5U38kB3VjtabKp/nRdvMESPGDG90bWRLAt1Qk5DyLuazRR1YzdC1c+hZXvAWV8xA72S4A8B67vjVhbba3MMop293FeEXpe7zItMWrJG/LOH9ByOXmYnNJfjmfuX9KbrpgLOba4nZ+fl8Gbdv/ihv+6wFGKHCYrVwmhFC0J3V2bn2tIB1wCc1CST3d3X2OyxhguXcs4sm679UngzofuSeBewMFJboIQHbUh/m2JhW2hG9DIvG2t7yZIzKBTz9wBtnNC+2pCRYhSIuQ1j8xsz5VvqnyUIthvuoyyu7fNIrg/KQUVmGQaqkqZk/Vx5b33/gsEs8yX7SC1J+NV4icz6bvIE7C5G6McBaI8rVg56q5QBJWxn/87Q1sPK4+sQa8fLU5gXo4paaq4cOcQ4wR0VBHPGjKh+UlPCbA1nLXyEUX45qZ8J7/Ln4FPJE2TdzD0Z8MLSNQiykMMmSyOCiFfy84Rq60emYB2vD09KjYwsoIpeDcBDTElBbXxND72yhd9pC/1CMid/5HUMvAL27OtcIJDzNKpRPNqPOpyt2aPGz9QWIs9hQ9LiX5s8m9hjTUu/f7MyIatjjd+tSfQ3ufZxPpmJhTaBtZtKLUcfOCUqADuO+QoH8B9v6U+P0HV1GLQmtoNFTb3s74ivZgjES0qfK+8RdGgBbcCMSy8eBvh98+et1KIFqSe1KQPyXULBMTsIYnysIwiZBJYdI20vseV+wuJkcqGemehKjaAb9L57xZm3g2zX0bZ2xk/fU+bCo7TlnbW7JuF1YdURo/2Gw7VclDG1W7LOtas2LX4upifZ/23rzpsnY/ALfRgrcWP5hYmV9VxVOQA1fZvp9F2UNU+7d7xRyVm5wiLp3/0dlV7vdw1PMiZrbDAYzIVqEjRY2YU03sJhPnlwIPcZUG5ltL6S8XCxU1eYS5cjr34veBmXAvy7yN4ZjArIG0dfD/5UpBNlX1ZPoxJOwyqRi3wQWtOzd4oNKh0LkoTm8cwqgIfKhqqGOhwo71I+zXnMemTv2B2AUzABWyFztGgGULjDDzWYwJUVBTjKCn5K2QGMK1CQT7SzziOjo+BhAmqBjzuc3xYym2eedGeOIRJVyTwDw37iCMe4g5Vbnsb5ZBdxOAnMT7HU4DHpxWGuQ7GeiY30Cpbvzss55+5Km1YsbD5ea3NI9QNYIXol5apgSu9dZ8f8xS5dtHpido5BclDuLWY4lhik0tbJa07yJhH0BOyEut/GRbYTS6RfiTYWGMCkNpfSHi7HvdiTglEVHKZXaVhezH4kkXiIvKopYAlPusftpE4a5IZwvw1x/eLvoDIh/zpo9FiQInsTb2SAkKHV42XYBjpJDg4374XiVb3ws4qM0s9eSQ5HzsMU4OZJKuopFjBM+dAZEl8RUMx5uU2N486Kr141tVsGQfGjORYMCJAMsxELeNT4RmWjRcpdTGBwcx6XN9drWqPmJzcrGrH4+DRc7+n1w3kPZwu0BkNr6hQrqgo7JTB9A5kdJ/H7P4cWBMwsmuixAzJB3yrQpnGIq90lxAXLzDCdn1LPibsRt7rHNjgQBklRgPZ8vTbjXdgXrTWQsK5MdrXXQVPp0Rinq3frzZKJ0qD6Qhc40VzAraUXlob1gvkhK3vpmHgI6FRlQZNx6eRqkp0zy4AQlX813fAPtL3jMRaitGFFjo0zmErloC+h+YYdVQ6k4F/epxAoF0BmqEoKNTt6j4vQZNQ2BoqF9Vj53TOIoNmDiu9Xp15RkIgQIGcoLpfoIbenzpGUAtqFJp5W+LLnx38jHeECTJ/navKY1NWfN0sY1T8/pB8kIH3DU3DX+u6W3YwpypBMYOhbSxGjq84RZ84fWJow8pyHqn4S/9J15EcCMsXqrfwyd9mhiu3+rEo9pPpoJkdZqHjra4NvzFwuThNKy6hao/SlLw3ZADUcUp3w3SRVfW2rhl80zOgTYnKE0Hs2qp1J6H3xqPqIkvUDRMFDYyRbsFI3M9MEyovPk8rlw7/0a81cDVLmBsR2ze2pBuKb23fbeZC0uXoIvDppfTwIDxk1Oq2dGesGc+oJXWJLGkOha3CX+DUnzgAp9HGH9RsPZN63Hn4RMA5eSVhPHO+9RcRb/IOgtW31V1Q5IPGtoxPjC+MEJbVlIMYADd9aHYWUIQKopuPOHmoqSkubnAKnzgKHqgIOfW5RdAgotN6BN+O2ZYHkuemLnvQ8U9THVrS1RtLmKbcC7PeeDsYznvqzeg6VCNwmr0Yyx1wnLjyT84BZz3EJyCptD3yeueAyDWIs0L2qs/VQ3HUyqfrja0V1LdDzqAikeWuV4sc7RLIB69jEIBjCkyZedoUHqCrOvShVzyd73OdrJW0hPOuQv2qOoHDc9xVb6Yu6uq3Xqp2ZaH46A7lzevbxQEmfrzvAYSJuZ4WDk1Hz3QX1LVdiUK0EvlAGAYlG3Md30r7dcPN63yqBCIj25prpvZP0nI4+EgWoFG95V596CurXpKRBGRjQlHCvy5Ib/iW8nZJWwrET3mgd6mEhfP4KCuaLjopWs7h+MdXFdIv8dHQJgg1xi1eYqB0uDYjxwVmri0Sv5XKut/onqapC+FQiC2C1lvYJ9MVco6yDYsS3AANUfMtvtbYI2hfwZatiSsnoUeMZd34GVjkMMKA+XnjJpXgRW2SHTZplVowPmJsvXy6w3cfO1AK2dvtZEKTkC/TY9LFiKHCG0DnrMQdGm2lzlBHM9iEYynH2UcVMhUEjsc0oDBTgo2ZSQ1gzkAHeWeBXYFjYLuuf8yzTCy7/RFR81WDjXMbq2BOH5dURnxo6oivmxL3cKzKInlZkD31nvpHB9Kk7GfcfE1t+1V64b9LtgeJGlpRFxQCAqWJ5DoY77ski8gsOEOr2uywZaoO/NGa0X0y1pNQHBi3b2SUGNpcZxDT7rLbBf1FSnQ8guxGW3W+36BW0gBje4DOz6Ba6SVk0xiKgt+q2JOFyr4SYfnu+Ic1QZYIuwHBrgzr6UvOcSCzPTOo7D6IC4ISeS7zkl4h+2VoeHpnG/uWR3+ysNgPcOIXQbv0n4mr3BwQcdKJxgPSeyuP/z1Jjg4e9nUvoXegqQVIE30EHx5GHv+FAVUNTowYDJgyFhf5IvlYmEqRif6+WN1MkEJmDcQITx9FX23a4mxy1AQRsOHO/+eImX9l8EMJI3oPWzVXxSOeHU1dUWYr2uAA7AMb+vAEZSbU3qob9ibCyXeypEMpZ6863o6QPqlqGHZkuWABSTVNd4cOh9hv3qEpSx2Zy/DJMP6cItEmiBJ5PFqQnDEIt3NrA3COlOSgz43D7gpNFNJ5MBh4oFzhDPiglC2ypsNU4ISywY2erkyb1NC3Qh/IfWj0eDgZI4/ln8WPfBsT3meTjq1Uqt1E7Zl/qftqkx6aM9KueMCekSnMrcHj1CqTWWzEzPsZGcDe3Ue4Ws+XFYVxNbOFF8ezkvQGR6ZOtOLU2lQEnMBStx47vE6Pb7AYMBRj2OOfZXfisjJnpTfSNjo6sZ6qSvNxZNmDeS7Gk3yYyCk1HtKN2UnhMIjOXUzAqDv90lx9O/q/AT1ZMnit5XQe9wmQxnE/WSH0CqZ9/2Hy+Sfmpeg8RwsHI5Z8kC8H293m/LHVVM/BA7HaTJYg5Enk7M/xWpq0192ACfBai2LA/qrCjCr6Dh1BIMzMXINBmX96MJ5Hn2nxln/RXPFhwHxUmSV0EV2V0jm86/dxxuYSU1W7sVkEbN9EzkG0QFwPhyHKyb3t+Fj5WoUUTErcazE/N6EW6Lvp0d//SDPj7EV9UdJN+Amnf3Wwk3A0SlJ9Z00yvXZ7n3z70G47Hfsow8Wq1JXcfwnA+Yxa5mFsgV464KKP4T31wqIgzFPd3eCe3j5ory5fBF2hgCFyVFrLzI9eetNXvM7oQqyFgDo4CTp/hDV9NMX9JDHQ/nyHTLvZLNLF6ftn2OxjGm8+PqOwhxnPHWipkE/8wbtyri80Sr7pMNkQGMfo4ZYK9OcCC4ESVFFbLMIvlxSoRqWie0wxqnLfcLSXMSpMMQEJYDVObYsXIQNv4TGNwjq1kvT1UOkicTrG3IaBZ3XdScS3u8sgeZPVpOLkbiF940FjbCeNRINNvDbd01EPBrTCPpm12m43ze1bBB59Ia6Ovhnur/Nvx3IxwSWol+3H2qfCJR8df6aQf4v6WiONxkK+IqT4pKQrZK/LplgDI/PJZbOep8dtbV7oCr6CgfpWa8NczOkPx81iSHbsNhVSJBOtrLIMrL31LK9TqHqAbAHe0RLmmV806kRLDLNEhUEJfm9u0sxpkL93Zgd6rw+tqBfTMi59xqXHLXSHwSbSBl0EK0+loECOPtrl+/nsaFe197di4yUgoe4jKoAJDXc6DGDjrQOoFDWZJ9HXwt8xDrQP+7aRwWKWI1GF8s8O4KzxWBBcwnl3vnl1Oez3oh6Ea1vjR7/z7DDTrFtqU2W/KAEzAuXDNZ7MY73MF216dzdSbWmUp4lcm7keJfWaMHgut9x5C9mj66Z0lJ+yhsjVvyiWrfk1lzPOTdhG15Y7gQlXtacvI7qv/XNSscDwqkgwHT/gUsD5yB7LdRRvJxQGYINn9hTpodKFVSTPrtGvyQw+HlRFXIkodErAGu9Iy1YpfSPc3jkFh5CX3lPxv7aqjE/JAfTIpEjGb/H7MO0e2vsViSW1qa/Lmi4/n4DEI3g7lYrcanspDfEpKkdV1OjSLOy0BCUqVoECaB55vs06rXl4jqmLsPsFM/7vYJ0vrBhDCm/00A/H81l1uekJ/6Lml3Hb9+NKiLqATJmDpyzfYZFHumEjC662L0Bwkxi7E9U4cQA0XMVDuMYAIeLMPgQaMVOd8fmt5SflFIfuBoszeAw7ow5gXPE2Y/yBc/7jExARUf/BxIHQBF5Sn3i61w4z5xJdCyO1F1X3+3ax+JSvMeZ7S6QSKp1Fp/sjYz6Z+VgCZzibGeEoujryfMulH7Rai5kAft9ebcW50DyJr2uo2z97mTWIu45YsSnNSMrrNUuG1XsYBtD9TDYzQffKB87vWbkM4EbPAFgoBV4GQS+vtFDUqOFAoi1nTtmIOvg38N4hT2Sn8r8clmBCXspBlMBYTnrqFJGBT3wZOzAyJDre9dHH7+x7qaaKDOB4UQALD5ecS0DE4obubQEiuJZ0EpBVpLuYcce8Aa4PYd/V4DLDAJBYKQPCWTcrEaZ5HYbJi11Gd6hjGom1ii18VHYnG28NKpkz2UKVPxlhYSp8uZr367iOmoy7zsxehW9wzcy2zG0a80PBMCRQMb32hnaHeOR8fnNDzZhaNYhkOdDsBUZ3loDMa1YP0uS0cjUP3b/6DBlqmZOeNABDsLl5BI5QJups8uxAuWJdkUB/pO6Zax6tsg7fN5mjjDgMGngO+DPcKqiHIDbFIGudxtPTIyDi9SFMKBDcfdGQRv41q1AqmxgkVfJMnP8w/Bc7N9/TR6C7mGObFqFkIEom8sKi2xYqJLTCHK7cxzaZvqODo22c3wisBCP4HeAgcRbNPAsBkNRhSmD48dHupdBRw4mIvtS5oeF6zeT1KMCyhMnmhpkFAGWnGscoNkwvQ8ZM5lE/vgTHFYL99OuNxdFBxTEDd5v2qLR8y9WkXsWgG6kZNndFG+pO/UAkOCipqIhL3hq7cRSdrCq7YhUsTocEcnaFa6nVkhnSeRYUA1YO0z5itF9Sly3VlxYDw239TJJH6f3EUfYO5lb7bcFcz8Bp7Oo8QmnsUHOz/fagVUBtKEw1iT88j+aKkv8cscKNkMxjYr8344D1kFoZ7/td1W6LCNYN594301tUGRmFjAzeRg5vyoM1F6+bJZ/Q54jN/k8SFd3DxPTYaAUsivsBfgTn7Mx8H2SpPt4GOdYRnEJOH6jHM2p6SgB0gzIRq6fHxGMmSmqaPCmlfwxiuloaVIitLGN8wie2CDWhkzLoCJcODh7KIOAqbHEvXdUxaS4TTTs07Clzj/6GmVs9kiZDerMxEnhUB6QQPlcfqkG9882RqHoLiHGBoHfQuXIsAG8GTAtao2KVwRnvvam8jo1e312GQAKWEa4sUVEAMG4G6ckcONDwRcg1e2D3+ohXgY4UAWF8wHKQMrSnzCgfFpsxh+aHXMGtPQroQasRY4U6UdG0rz1Vjbka0MekOGRZQEvqQFlxseFor8zWFgHek3v29+WqN6gaK5gZOTOMZzpQIC1201LkMCXild3vWXSc5UX9xcFYfbRPzGFa1FDcPfPB/jUEq/FeGt419CI3YmBlVoHsa4KdcwQP5ZSwHHhFJ7/Ph/Rap/4vmG91eDwPP0lDfCDRCLszTqfzM71xpmiKi2HwS4WlqvGNwtvwF5Dqpn6KTq8ax00UMPkxDcZrEEEsIvHiUXXEphdb4GB4FymlPwBz4Gperqq5pW7TQ6/yNRhW8VT5NhuP0udlxo4gILq5ZxAZk8ZGh3g4CqxJlPKY7AQxupfUcVpWT5VItp1+30UqoyP4wWsRo3olRRgkWZZ2ZN6VC3OZFeXB8NbnUrSdikNptD1QiGuKkr8EmSR/AK9Rw+FF3s5uwuPbvHGiPeFOViltMK7AUaOsq9+x9cndk3iJEE5LKZRlWJbKOZweROzmPNVPkjE3K/TyA57Rs68TkZ3MR8akKpm7cFjnjPd/DdkWjgYoKHSr5Wu5ssoBYU4acRs5g2DHxUmdq8VXOXRbunD8QN0LhgkssgahcdoYsNvuXGUK/KXD/7oFb+VGdhqIn02veuM5bLudJOc2Ky0GMaG4W/xWBxIJcL7yliJOXOpx0AkBqUgzlDczmLT4iILXDxxtRR1oZa2JWFgiAb43obrJnG/TZC2KSK2wqOzRZTXavZZFMb1f3bXvVaNaK828w9TO610gk8JNf3gMfETzXXsbcvRGCG9JWQZ6+cDPqc4466Yo2RcKH+PILeKOqtnlbInR3MmBeGG3FH10yzkybuqEC2HSQwpA0An7d9+73BkDUTm30bZmoP/RGbgFN+GrCOfADgqr0WbI1a1okpFms8iHYw9hm0zUvlEMivBRxModrbJJ+9/p3jUdQQ9BCtQdxnOGrT5dzRUmw0593/mbRSdBg0nRvRZM5/E16m7ZHmDEtWhwvfdZCZ8J8M12W0yRMszXamWfQTwIZ4ayYktrnscQuWr8idp3PjT2eF/jmtdhIfcpMnb+IfZY2FebW6UY/AK3jP4u3Tu4zE4qlnQgLFbM19EBIsNf7KhjdbqQ/D6yiDb+NlEi2SKD+ivXVUK8ib0oBo366gXkR8ZxGjpJIDcEgZPa9TcYe0TIbiPl/rPUQDu3XBJ9X/GNq3FAUsKsll57DzaGMrjcT+gctp+9MLYXCq+sqP81eVQ0r9lt+gcQfZbACRbEjvlMskztZG8gbC8Qn9tt26Q7y7nDrbZq/LEz7kR6Jc6pg3N9rVX8Y5MJrGlML9p9lU4jbTkKqCveeZUJjHB03m2KRKR2TytoFkTXOLg7keU1s1lrPMQJpoOKLuAAC+y1HlJucU6ysB5hsXhvSPPLq5J7JtnqHKZ4vYjC4Vy8153QY+6780xDuGARsGbOs1WqzH0QS765rnSKEbbKlkO8oI/VDwUd0is13tKpqILu1mDJFNy/iJAWcvDgjxvusIT+PGz3ST/J9r9Mtfd0jpaGeiLYIqXc7DiHSS8TcjFVksi66PEkxW1z6ujbLLUGNNYnzOWpH8BZGK4bCK7iR+MbIv8ncDAz1u4StN3vTTzewr9IQjk9wxFxn+6N1ddKs0vffJiS08N3a4G1SVrlZ97Q/M+8G9fe5AP6d9/Qq4WRnORVhofPIKEdCr3llspUfE0oKIIYoByBRPh+bX1HLS3JWGJRhIvE1aW4NTd8ePi4Z+kXb+Z8snYfSNcqijhAgVsx4RCM54cXUiYkjeBmmC4ajOHrChoELscJJC7+9jjMjw5BagZKlgRMiSNYz7h7vvZIoQqbtQmspc0cUk1G/73iXtSpROl5wtLgQi0mW2Ex8i3WULhcggx6E1LMVHUsdc9GHI1PH3U2Ko0PyGdn9KdVOLm7FPBui0i9a0HpA60MsewVE4z8CAt5d401Gv6zXlIT5Ybit1VIA0FCs7wtvYreru1fUyW3oLAZ/+aTnZrOcYRNVA8spoRtlRoWflsRClFcgzkqiHOrf0/SVw+EpVaFlJ0g4Kxq1MMOmiQdpMNpte8lMMQqm6cIFXlnGbfJllysKDi+0JJMotkqgIxOSQgU9dn/lWkeVf8nUm3iwX2Nl3WDw9i6AUK3vBAbZZrcJpDQ/N64AVwjT07Jef30GSSmtNu2WlW7YoyW2FlWfZFQUwk867EdLYKk9VG6JgEnBiBxkY7LMo4YLQJJlAo9l/oTvJkSARDF/XtyAzM8O2t3eT/iXa6wDN3WewNmQHdPfsxChU/KtLG2Mn8i4ZqKdSlIaBZadxJmRzVS/o4yA65RTSViq60oa395Lqw0pzY4SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const q9=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),K9=4;function qQ(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),i=1,s=[0,1];for(let P=1;P>--c&1}const f=31,d=2**f,p=d>>>1,h=p>>1,g=d-1;let v=0;for(let P=0;P1;){let D=C+B>>>1;P>>1|l(),N=N<<1^p,T=(T^p)<<1|p|1;b=N,S=1+T-N}let _=n-4;return x.map(P=>{switch(P-_){case 3:return _+65792+(t[o++]<<16|t[o++]<<8|t[o++]);case 2:return _+256+(t[o++]<<8|t[o++]);case 1:return _+t[o++];default:return P-1}})}function KQ(t){let e=0;return()=>t[e++]}function VP(t){return KQ(qQ(WQ(t)))}function WQ(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((i,s)=>e[i.charCodeAt(0)]=s);let r=t.length,n=new Uint8Array(6*r>>3);for(let i=0,s=0,a=0,o=0;i=8&&(n[s++]=o>>(a-=8));return n}function GQ(t){return t&1?~t>>1:t>>1}function ZQ(t,e){let r=Array(t);for(let n=0,i=0;n{let e=Lp(t);if(e.length)return e})}function KP(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(JQ(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(XQ(r,t))}return e.flat()}function jp(t){let e=[];for(;;){let r=t(e.length);if(!r)break;e.push(r)}return e}function WP(t,e,r){let n=Array(t).fill().map(()=>[]);for(let i=0;in[a].push(s));return n}function JQ(t,e){let r=1+e(),n=e(),i=jp(e);return WP(i.length,1+t,e).flatMap((a,o)=>{let[c,...u]=a;return Array(i[o]).fill().map((l,f)=>{let d=f*n;return[c+f*r,u.map(p=>p+d)]})})}function XQ(t,e){let r=1+e();return WP(r,1+t,e).map(i=>[i[0],i.slice(1)])}function QQ(t){let e=[],r=Lp(t);return i(n([]),[]),e;function n(s){let a=t(),o=jp(()=>{let c=Lp(t).map(u=>r[u]);if(c.length)return n(c)});return{S:a,B:o,Q:s}}function i({S:s,B:a},o,c){if(!(s&4&&c===o[o.length-1])){s&2&&(c=o[o.length-1]),s&1&&e.push(o);for(let u of a)for(let l of u.Q)i(u,[...o,l],c)}}}function YQ(t){return t.toString(16).toUpperCase().padStart(2,"0")}function GP(t){return`{${YQ(t)}}`}function eY(t){let e=[];for(let r=0,n=t.length;r>24&255}function XP(t){return t&16777215}let Y4,W9,e3,hm;function cY(){let t=VP(rY);Y4=new Map(qP(t).flatMap((e,r)=>e.map(n=>[n,r+1<<24]))),W9=new Set(Lp(t)),e3=new Map,hm=new Map;for(let[e,r]of KP(t)){if(!W9.has(e)&&r.length==2){let[n,i]=r,s=hm.get(n);s||(s=new Map,hm.set(n,s)),s.set(i,e)}e3.set(e,r.reverse())}}function QP(t){return t>=Up&&t=kv&&t=Bv&&eIv&&e0&&i(Iv+u)}else{let a=e3.get(s);a?r.push(...a):i(s)}if(!r.length)break;s=r.pop()}if(n&&e.length>1){let s=j0(e[0]);for(let a=1;a0&&i>=a)a==0?(e.push(n,...r),r.length=0,n=o):r.push(o),i=a;else{let c=uY(n,o);c>=0?n=c:i==0&&a==0?(e.push(n),n=o):(r.push(o),i=a)}}return n>=0&&e.push(n,...r),e}function eT(t){return YP(t).map(XP)}function fY(t){return lY(YP(t))}const G9=45,tT=".",rT=65039,nT=1,Pv=t=>Array.from(t);function $p(t,e){return t.P.has(e)||t.Q.has(e)}class dY extends Array{get is_emoji(){return!0}}let t3,iT,Hu,r3,sT,nd,Ub,wf,Pu,Z9,n3;function sE(){if(t3)return;let t=VP(VQ);const e=()=>Lp(t),r=()=>new Set(e()),n=(l,f)=>f.forEach(d=>l.add(d));t3=new Map(KP(t)),iT=r(),Hu=e(),r3=new Set(e().map(l=>Hu[l])),Hu=new Set(Hu),sT=r(),r();let i=qP(t),s=t();const a=()=>{let l=new Set;return e().forEach(f=>n(l,i[f])),n(l,e()),l};nd=jp(l=>{let f=jp(t).map(d=>d+96);if(f.length){let d=l>=s;f[0]-=32,f=Sh(f),d&&(f=`Restricted[${f}]`);let p=a(),h=a(),g=!t();return{N:f,P:p,Q:h,M:g,R:d}}}),Ub=r(),wf=new Map;let o=e().concat(Pv(Ub)).sort((l,f)=>l-f);o.forEach((l,f)=>{let d=t(),p=o[f]=d?o[f-d]:{V:[],M:new Map};p.V.push(l),Ub.has(l)||wf.set(l,p)});for(let{V:l,M:f}of new Set(wf.values())){let d=[];for(let h of l){let g=nd.filter(x=>$p(x,h)),v=d.find(({G:x})=>g.some(b=>x.has(b)));v||(v={G:new Set,V:[]},d.push(v)),v.V.push(h),n(v.G,g)}let p=d.flatMap(h=>Pv(h.G));for(let{G:h,V:g}of d){let v=new Set(p.filter(x=>!h.has(x)));for(let x of g)f.set(x,v)}}Pu=new Set;let c=new Set;const u=l=>Pu.has(l)?c.add(l):Pu.add(l);for(let l of nd){for(let f of l.P)u(f);for(let f of l.Q)u(f)}for(let l of Pu)!wf.has(l)&&!c.has(l)&&wf.set(l,nT);n(Pu,eT(Pu)),Z9=QQ(t).map(l=>dY.from(l)).sort(tY),n3=new Map;for(let l of Z9){let f=[n3];for(let d of l){let p=f.map(h=>{let g=h.get(d);return g||(g=new Map,h.set(d,g)),g});d===rT?f.push(...p):f=p}for(let d of f)d.V=l}}function aE(t){return(aT(t)?"":`${oE(v2([t]))} `)+GP(t)}function oE(t){return`"${t}"‎`}function hY(t){if(t.length>=4&&t[2]==G9&&t[3]==G9)throw new Error(`invalid label extension: "${Sh(t.slice(0,4))}"`)}function pY(t){for(let r=t.lastIndexOf(95);r>0;)if(t[--r]!==95)throw new Error("underscore allowed only at start")}function gY(t){let e=t[0],r=q9.get(e);if(r)throw ip(`leading ${r}`);let n=t.length,i=-1;for(let s=1;se&&(e>>=1,t=[...t.slice(0,e),8230,...t.slice(-e)]);let i=0,s=t.length;for(let a=0;a{let s=eY(i),a={input:s,offset:n};n+=s.length+1;try{let o=a.tokens=SY(s,e,r),c=o.length,u;if(!c)throw new Error("empty label");let l=a.output=o.flat();if(pY(l),!(a.emoji=c>1||o[0].is_emoji)&&l.every(d=>d<128))hY(l),u="ASCII";else{let d=o.flatMap(p=>p.is_emoji?[]:p);if(!d.length)u="Emoji";else{if(Hu.has(l[0]))throw ip("leading combining mark");for(let g=1;ga.has(o)):Pv(a),!r.length)return}else n.push(i)}if(r){for(let i of r)if(n.every(s=>$p(i,s)))throw new Error(`whole-script confusable: ${t.N}/${i.N}`)}}function bY(t){let e=nd;for(let r of t){let n=e.filter(i=>$p(i,r));if(!n.length)throw nd.some(i=>$p(i,r))?cT(e[0],r):oT(r);if(e=n,n.length==1)break}return e}function wY(t){return t.map(({input:e,error:r,output:n})=>{if(r){let i=r.message;throw new Error(t.length==1?i:`Invalid label ${oE(v2(e,63))}: ${i}`)}return Sh(n)}).join(tT)}function oT(t){return new Error(`disallowed character: ${aE(t)}`)}function cT(t,e){let r=aE(e),n=nd.find(i=>i.P.has(e));return n&&(r=`${n.N} ${r}`),new Error(`illegal mixture: ${t.N} + ${r}`)}function ip(t){return new Error(`illegal placement: ${t}`)}function EY(t,e){for(let r of e)if(!$p(t,r))throw cT(t,r);if(t.M){let r=eT(e);for(let n=1,i=r.length;nK9)throw new Error(`excessive non-spacing marks: ${oE(v2(r.slice(n-1,s)))} (${s-n}/${K9})`);n=s}}}function SY(t,e,r){let n=[],i=[];for(t=t.slice().reverse();t.length;){let s=CY(t);if(s)i.length&&(n.push(e(i)),i=[]),n.push(r(s));else{let a=t.pop();if(Pu.has(a))i.push(a);else{let o=t3.get(a);if(o)i.push(...o);else if(!iT.has(a))throw oT(a)}}}return i.length&&n.push(e(i)),n}function AY(t){return t.filter(e=>e!=rT)}function CY(t,e){let r=n3,n,i=t.length;for(;i&&(r=r.get(t[--i]),!!r);){let{V:s}=r;s&&(n=s,e&&e.push(...t.slice(i).reverse()),t.length=i)}return n}const uT=new Uint8Array(32);uT.fill(0);function J9(t){return fe(t.length!==0,"invalid ENS name; empty component","comp",t),t}function lT(t){const e=ko(_Y(t)),r=[];if(t.length===0)return r;let n=0;for(let i=0;i{fe(n.length<=r,`label ${JSON.stringify(t)} exceeds ${r} bytes`,"name",t);const i=new Uint8Array(n.length+1);return i.set(n,1),i[0]=i.length-1,i})))+"00"}function $b(t,e){return{address:qt(t),storageKeys:e.map((r,n)=>(fe(er(r,32),"invalid slot",`storageKeys[${n}]`,r),r.toLowerCase()))}}function Yl(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(fe(r.length===2,"invalid slot set",`value[${n}]`,r),$b(r[0],r[1])):(fe(r!=null&&typeof r=="object","invalid address-slot set","value",t),$b(r.address,r.storageKeys)));fe(t!=null&&typeof t=="object","invalid access list","value",t);const e=Object.keys(t).map(r=>{const n=t[r].reduce((i,s)=>(i[s]=!0,i),{});return $b(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function BY(t){let e;return typeof t=="string"?e=Mp.computePublicKey(t,!1):e=t.publicKey,qt(hr("0x"+e.substring(4)).substring(26))}function IY(t,e){return BY(Mp.recoverPublicKey(t,e))}const Xr=BigInt(0),FY=BigInt(2),PY=BigInt(27),TY=BigInt(28),NY=BigInt(35),RY=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function y2(t){return t==="0x"?null:qt(t)}function cE(t,e){try{return Yl(t)}catch(r){fe(!1,r.message,e,t)}}function Zg(t,e){return t==="0x"?0:yt(t,e)}function _r(t,e){if(t==="0x")return Xr;const r=tt(t,e);return fe(r<=RY,"value exceeds uint size",e,r),r}function cr(t,e){const r=tt(t,"value"),n=Mn(r);return fe(n.length<=32,"value too large",`tx.${e}`,r),n}function uE(t){return Yl(t).map(e=>[e.address,e.storageKeys])}function DY(t,e){fe(Array.isArray(t),`invalid ${e}`,"value",t);for(let r=0;r=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,r=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,n=this.accessList!=null,i=U(this,rl)!=null||U(this,nl);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&Oe(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),Oe(!r||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),Oe(this.type!==0||!n,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const s=[];return this.type!=null?s.push(this.type):r?s.push(2):e?(s.push(1),n||s.push(0)):n?(s.push(1),s.push(2)):(i&&this.to||(s.push(0),s.push(1),s.push(2)),s.push(3)),s.sort(),s}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return Qa.from(this)}toJSON(){const e=r=>r==null?null:r.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(e){if(e==null)return new Qa;if(typeof e=="string"){const n=jt(e);if(n[0]>=127)return Qa.from(OY(n));switch(n[0]){case 1:return Qa.from(LY(n));case 2:return Qa.from(MY(n));case 3:return Qa.from(jY(n))}Oe(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const r=new Qa;return e.type!=null&&(r.type=e.type),e.to!=null&&(r.to=e.to),e.nonce!=null&&(r.nonce=e.nonce),e.gasLimit!=null&&(r.gasLimit=e.gasLimit),e.gasPrice!=null&&(r.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(r.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(r.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(r.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(r.data=e.data),e.value!=null&&(r.value=e.value),e.chainId!=null&&(r.chainId=e.chainId),e.signature!=null&&(r.signature=Gs.from(e.signature)),e.accessList!=null&&(r.accessList=e.accessList),e.blobVersionedHashes!=null&&(r.blobVersionedHashes=e.blobVersionedHashes),e.hash!=null&&(fe(r.isSigned(),"unsigned transaction cannot define hash","tx",e),fe(r.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&(fe(r.isSigned(),"unsigned transaction cannot define from","tx",e),fe(r.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),r}};la=new WeakMap,yd=new WeakMap,xd=new WeakMap,bd=new WeakMap,wd=new WeakMap,Ed=new WeakMap,Sd=new WeakMap,Ad=new WeakMap,Cd=new WeakMap,_d=new WeakMap,kd=new WeakMap,Bd=new WeakMap,rl=new WeakMap,nl=new WeakMap;let Tv=Qa;const fT=new Uint8Array(32);fT.fill(0);const UY=BigInt(-1),dT=BigInt(0),hT=BigInt(1),$Y=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function zY(t){const e=jt(t),r=e.length%32;return r?Mr([e,fT.slice(r)]):rt(e)}const HY=iu(hT,32),VY=iu(dT,32),t7={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},zb=["name","version","chainId","verifyingContract","salt"];function r7(t){return function(e){return fe(typeof e=="string",`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const qY={name:r7("name"),version:r7("version"),chainId:function(t){const e=tt(t,"domain.chainId");return fe(e>=0,"invalid chain ID","domain.chainId",t),Number.isSafeInteger(e)?Number(e):$f(e)},verifyingContract:function(t){try{return qt(t).toLowerCase()}catch{}fe(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){const e=jt(t,"domain.salt");return fe(e.length===32,'invalid domain value "salt"',"domain.salt",t),rt(e)}};function Hb(t){{const e=t.match(/^(u?)int(\d+)$/);if(e){const r=e[1]==="",n=parseInt(e[2]);fe(n%8===0&&n!==0&&n<=256&&e[2]===String(n),"invalid numeric width","type",t);const i=M0($Y,r?n-1:n),s=r?(i+hT)*UY:dT;return function(a){const o=tt(a,"value");return fe(o>=s&&o<=i,`value out-of-bounds for ${t}`,"value",o),iu(r?fP(o,256):o,32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return fe(r!==0&&r<=32&&e[1]===String(r),"invalid bytes width","type",t),function(n){const i=jt(n);return fe(i.length===r,`invalid length for ${t}`,"value",n),zY(n)}}}switch(t){case"address":return function(e){return Nl(qt(e),32)};case"bool":return function(e){return e?HY:VY};case"bytes":return function(e){return hr(e)};case"string":return function(e){return Rl(e)}}return null}function n7(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}function D1(t){const e=t.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:t}}var gg,ao,Id,fy,pT;const Ui=class Ui{constructor(e){ue(this,fy);se(this,"primaryType");ue(this,gg,void 0);ue(this,ao,void 0);ue(this,Id,void 0);Q(this,ao,new Map),Q(this,Id,new Map);const r=new Map,n=new Map,i=new Map,s={};Object.keys(e).forEach(c=>{s[c]=e[c].map(({name:u,type:l})=>{let{base:f,index:d}=D1(l);return f==="int"&&!e.int&&(f="int256"),f==="uint"&&!e.uint&&(f="uint256"),{name:u,type:f+(d||"")}}),r.set(c,new Set),n.set(c,[]),i.set(c,new Set)}),Q(this,gg,JSON.stringify(s));for(const c in s){const u=new Set;for(const l of s[c]){fe(!u.has(l.name),`duplicate variable name ${JSON.stringify(l.name)} in ${JSON.stringify(c)}`,"types",e),u.add(l.name);const f=D1(l.type).base;fe(f!==c,`circular type reference to ${JSON.stringify(f)}`,"types",e),!Hb(f)&&(fe(n.has(f),`unknown type ${JSON.stringify(f)}`,"types",e),n.get(f).push(c),r.get(c).add(f))}}const a=Array.from(n.keys()).filter(c=>n.get(c).length===0);fe(a.length!==0,"missing primary type","types",e),fe(a.length===1,`ambiguous primary types or unused types: ${a.map(c=>JSON.stringify(c)).join(", ")}`,"types",e),ot(this,{primaryType:a[0]});function o(c,u){fe(!u.has(c),`circular type reference to ${JSON.stringify(c)}`,"types",e),u.add(c);for(const l of r.get(c))if(n.has(l)){o(l,u);for(const f of u)i.get(f).add(l)}u.delete(c)}o(this.primaryType,new Set);for(const[c,u]of i){const l=Array.from(u);l.sort(),U(this,ao).set(c,n7(c,s[c])+l.map(f=>n7(f,s[f])).join(""))}}get types(){return JSON.parse(U(this,gg))}getEncoder(e){let r=U(this,Id).get(e);return r||(r=Ee(this,fy,pT).call(this,e),U(this,Id).set(e,r)),r}encodeType(e){const r=U(this,ao).get(e);return fe(r,`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return hr(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,n){if(Hb(e))return n(e,r);const i=D1(e).array;if(i)return fe(i.count===-1||i.count===r.length,`array length mismatch; expected length ${i.count}`,"value",r),r.map(a=>this._visit(i.prefix,a,n));const s=this.types[e];if(s)return s.reduce((a,{name:o,type:c})=>(a[o]=this._visit(c,r[o],n),a),{});fe(!1,`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new Ui(e)}static getPrimaryType(e){return Ui.from(e).primaryType}static hashStruct(e,r,n){return Ui.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){if(e[n]==null)continue;const i=t7[n];fe(i,`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:i})}return r.sort((n,i)=>zb.indexOf(n.name)-zb.indexOf(i.name)),Ui.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return Mr(["0x1901",Ui.hashDomain(e),Ui.from(r).hash(n)])}static hash(e,r,n){return hr(Ui.encode(e,r,n))}static async resolveNames(e,r,n,i){e=Object.assign({},e);for(const o in e)e[o]==null&&delete e[o];const s={};e.verifyingContract&&!er(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const a=Ui.from(r);a.visit(n,(o,c)=>(o==="address"&&!er(c,20)&&(s[c]="0x"),c));for(const o in s)s[o]=await i(o);return e.verifyingContract&&s[e.verifyingContract]&&(e.verifyingContract=s[e.verifyingContract]),n=a.visit(n,(o,c)=>o==="address"&&s[c]?s[c]:c),{domain:e,value:n}}static getPayload(e,r,n){Ui.hashDomain(e);const i={},s=[];zb.forEach(c=>{const u=e[c];u!=null&&(i[c]=qY[c](u),s.push({name:c,type:t7[c]}))});const a=Ui.from(r);r=a.types;const o=Object.assign({},r);return fe(o.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",r),o.EIP712Domain=s,a.encode(n),{types:o,domain:i,primaryType:a.primaryType,message:a.visit(n,(c,u)=>{if(c.match(/^bytes(\d*)/))return rt(jt(u));if(c.match(/^u?int/))return tt(u).toString();switch(c){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return fe(typeof u=="string","invalid string","value",u),u}fe(!1,"unsupported type","type",c)})}}};gg=new WeakMap,ao=new WeakMap,Id=new WeakMap,fy=new WeakSet,pT=function(e){{const i=Hb(e);if(i)return i}const r=D1(e).array;if(r){const i=r.prefix,s=this.getEncoder(i);return a=>{fe(r.count===-1||r.count===a.length,`array length mismatch; expected length ${r.count}`,"value",a);let o=a.map(s);return U(this,ao).has(i)&&(o=o.map(hr)),hr(Mr(o))}}const n=this.types[e];if(n){const i=Rl(U(this,ao).get(e));return s=>{const a=n.map(({name:o,type:c})=>{const u=this.getEncoder(c)(s[o]);return U(this,ao).has(c)?hr(u):u});return a.unshift(i),Mr(a)}}fe(!1,`unknown type: ${e}`,"type",e)};let Nv=Ui;function Un(t){const e=new Set;return t.forEach(r=>e.add(r)),Object.freeze(e)}const KY="external public payable override",WY=Un(KY.split(" ")),gT="constant external internal payable private public pure view override",GY=Un(gT.split(" ")),mT="constructor error event fallback function receive struct",vT=Un(mT.split(" ")),yT="calldata memory storage payable indexed",ZY=Un(yT.split(" ")),JY="tuple returns",XY=[mT,yT,JY,gT].join(" "),QY=Un(XY.split(" ")),YY={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},eee=new RegExp("^(\\s*)"),tee=new RegExp("^([0-9]+)"),ree=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),xT=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),bT=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");var cn,_s,mg,s3;const dy=class dy{constructor(e){ue(this,mg);ue(this,cn,void 0);ue(this,_s,void 0);Q(this,cn,0),Q(this,_s,e.slice())}get offset(){return U(this,cn)}get length(){return U(this,_s).length-U(this,cn)}clone(){return new dy(U(this,_s))}reset(){Q(this,cn,0)}popKeyword(e){const r=this.peek();if(r.type!=="KEYWORD"||!e.has(r.text))throw new Error(`expected keyword ${r.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const r=this.peek();throw new Error(`expected ${e}; got ${r.type} ${JSON.stringify(r.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const r=Ee(this,mg,s3).call(this,U(this,cn)+1,e.match+1);return Q(this,cn,e.match+1),r}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const r=[];for(;U(this,cn)=U(this,_s).length)throw new Error("out-of-bounds");return U(this,_s)[U(this,cn)]}peekKeyword(e){const r=this.peekType("KEYWORD");return r!=null&&e.has(r)?r:null}peekType(e){if(this.length===0)return null;const r=this.peek();return r.type===e?r.text:null}pop(){const e=this.peek();return Yo(this,cn)._++,e}toString(){const e=[];for(let r=U(this,cn);r`}};cn=new WeakMap,_s=new WeakMap,mg=new WeakSet,s3=function(e=0,r=0){return new dy(U(this,_s).slice(e,r).map(n=>Object.freeze(Object.assign({},n,{match:n.match-e,linkBack:n.linkBack-e,linkNext:n.linkNext-e}))))};let Zs=dy;function bu(t){const e=[],r=a=>{const o=s0&&e[e.length-1].type==="NUMBER"){const f=e.pop().text;l=f+l,e[e.length-1].value=yt(f)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=l}continue}if(o=a.match(ree),o){if(c.text=o[1],s+=c.text.length,QY.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(bT)){c.type="TYPE";continue}c.type="ID";continue}if(o=a.match(tee),o){c.text=o[1],c.type="NUMBER",s+=c.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(a[0])} at position ${s}`)}return new Zs(e.map(a=>Object.freeze(a)))}function i7(t,e){let r=[];for(const n in e.keys())t.has(n)&&r.push(n);if(r.length>1)throw new Error(`conflicting types: ${r.join(", ")}`)}function x2(t,e){if(e.peekKeyword(vT)){const r=e.pop().text;if(r!==t)throw new Error(`expected ${t}, got ${r}`)}return e.popType("ID")}function jo(t,e){const r=new Set;for(;;){const n=t.peekType("KEYWORD");if(n==null||e&&!e.has(n))break;if(t.pop(),r.has(n))throw new Error(`duplicate keywords: ${JSON.stringify(n)}`);r.add(n)}return Object.freeze(r)}function wT(t){let e=jo(t,GY);return i7(e,Un("constant payable nonpayable".split(" "))),i7(e,Un("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function Bo(t,e){return t.popParams().map(r=>dn.from(r,e))}function ET(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return tt(t.pop().text);throw new Error("invalid gas")}return null}function Dl(t){if(t.length)throw new Error(`unexpected tokens at offset ${t.offset}: ${t.toString()}`)}const nee=new RegExp(/^(.*)\[([0-9]*)\]$/);function s7(t){const e=t.match(bT);if(fe(e,"invalid type","type",t),t==="uint")return"uint256";if(t==="int")return"int256";if(e[2]){const r=parseInt(e[2]);fe(r!==0&&r<=32,"invalid bytes length","type",t)}else if(e[3]){const r=parseInt(e[3]);fe(r!==0&&r<=256&&r%8===0,"invalid numeric width","type",t)}return t}const gr={},ci=Symbol.for("_ethers_internal"),a7="_ParamTypeInternal",o7="_ErrorInternal",c7="_EventInternal",u7="_ConstructorInternal",l7="_FallbackInternal",f7="_FunctionInternal",d7="_StructInternal";var Fd,pm;const $i=class $i{constructor(e,r,n,i,s,a,o,c){ue(this,Fd);se(this,"name");se(this,"type");se(this,"baseType");se(this,"indexed");se(this,"components");se(this,"arrayLength");se(this,"arrayChildren");if(l2(e,gr,"ParamType"),Object.defineProperty(this,ci,{value:a7}),a&&(a=Object.freeze(a.slice())),i==="array"){if(o==null||c==null)throw new Error("")}else if(o!=null||c!=null)throw new Error("");if(i==="tuple"){if(a==null)throw new Error("")}else if(a!=null)throw new Error("");ot(this,{name:r,type:n,baseType:i,indexed:s,components:a,arrayLength:o,arrayChildren:c})}format(e){if(e==null&&(e="sighash"),e==="json"){const n=this.name||"";if(this.isArray()){const s=JSON.parse(this.arrayChildren.format("json"));return s.name=n,s.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(s)}const i={type:this.baseType==="tuple"?"tuple":this.type,name:n};return typeof this.indexed=="boolean"&&(i.indexed=this.indexed),this.isTuple()&&(i.components=this.components.map(s=>JSON.parse(s.format(e)))),JSON.stringify(i)}let r="";return this.isArray()?(r+=this.arrayChildren.format(e),r+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?r+="("+this.components.map(n=>n.format(e)).join(e==="full"?", ":",")+")":r+=this.type,e!=="sighash"&&(this.indexed===!0&&(r+=" indexed"),e==="full"&&this.name&&(r+=" "+this.name)),r}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,r){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const n=this;return e.map(i=>n.arrayChildren.walk(i,r))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const n=this;return e.map((i,s)=>n.components[s].walk(i,r))}return r(this.type,e)}async walkAsync(e,r){const n=[],i=[e];return Ee(this,Fd,pm).call(this,n,e,r,s=>{i[0]=s}),n.length&&await Promise.all(n),i[0]}static from(e,r){if($i.isParamType(e))return e;if(typeof e=="string")try{return $i.from(bu(e),r)}catch{fe(!1,"invalid param type","obj",e)}else if(e instanceof Zs){let o="",c="",u=null;jo(e,Un(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(c="tuple",u=e.popParams().map(g=>$i.from(g)),o=`tuple(${u.map(g=>g.format()).join(",")})`):(o=s7(e.popType("TYPE")),c=o);let l=null,f=null;for(;e.length&&e.peekType("BRACKET");){const g=e.pop();l=new $i(gr,"",o,c,null,u,f,l),f=g.value,o+=g.text,c="array",u=null}let d=null;if(jo(e,ZY).has("indexed")){if(!r)throw new Error("");d=!0}const h=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new $i(gr,h,o,c,d,u,f,l)}const n=e.name;fe(!n||typeof n=="string"&&n.match(xT),"invalid name","obj.name",n);let i=e.indexed;i!=null&&(fe(r,"parameter cannot be indexed","obj.indexed",e.indexed),i=!!i);let s=e.type,a=s.match(nee);if(a){const o=parseInt(a[2]||"-1"),c=$i.from({type:a[1],components:e.components});return new $i(gr,n||"",s,"array",i,null,o,c)}if(s==="tuple"||s.startsWith("tuple(")||s.startsWith("(")){const o=e.components!=null?e.components.map(u=>$i.from(u)):null;return new $i(gr,n||"",s,"tuple",i,o,null,null)}return s=s7(e.type),new $i(gr,n||"",s,s,i,null,null,null)}static isParamType(e){return e&&e[ci]===a7}};Fd=new WeakSet,pm=function(e,r,n,i){if(this.isArray()){if(!Array.isArray(r))throw new Error("invalid array value");if(this.arrayLength!==-1&&r.length!==this.arrayLength)throw new Error("array is wrong length");const a=this.arrayChildren,o=r.slice();o.forEach((c,u)=>{var l;Ee(l=a,Fd,pm).call(l,e,c,n,f=>{o[u]=f})}),i(o);return}if(this.isTuple()){const a=this.components;let o;if(Array.isArray(r))o=r.slice();else{if(r==null||typeof r!="object")throw new Error("invalid tuple value");o=a.map(c=>{if(!c.name)throw new Error("cannot use object value with unnamed components");if(!(c.name in r))throw new Error(`missing value for component ${c.name}`);return r[c.name]})}if(o.length!==this.components.length)throw new Error("array is wrong length");o.forEach((c,u)=>{var l;Ee(l=a[u],Fd,pm).call(l,e,c,n,f=>{o[u]=f})}),i(o);return}const s=n(this.type,r);s.then?e.push(async function(){i(await s)}()):i(s)};let dn=$i;class Ol{constructor(e,r,n){se(this,"type");se(this,"inputs");l2(e,gr,"Fragment"),n=Object.freeze(n.slice()),ot(this,{type:r,inputs:n})}static from(e){if(typeof e=="string"){try{Ol.from(JSON.parse(e))}catch{}return Ol.from(bu(e))}if(e instanceof Zs)switch(e.peekKeyword(vT)){case"constructor":return wo.from(e);case"error":return Qn.from(e);case"event":return Ea.from(e);case"fallback":case"receive":return eo.from(e);case"function":return Sa.from(e);case"struct":return El.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return wo.from(e);case"error":return Qn.from(e);case"event":return Ea.from(e);case"fallback":case"receive":return eo.from(e);case"function":return Sa.from(e);case"struct":return El.from(e)}Oe(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}fe(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return wo.isFragment(e)}static isError(e){return Qn.isFragment(e)}static isEvent(e){return Ea.isFragment(e)}static isFunction(e){return Sa.isFragment(e)}static isStruct(e){return El.isFragment(e)}}class b2 extends Ol{constructor(r,n,i,s){super(r,n,s);se(this,"name");fe(typeof i=="string"&&i.match(xT),"invalid identifier","name",i),s=Object.freeze(s.slice()),ot(this,{name:i})}}function zp(t,e){return"("+e.map(r=>r.format(t)).join(t==="full"?", ":",")+")"}class Qn extends b2{constructor(e,r,n){super(e,"error",r,n),Object.defineProperty(this,ci,{value:o7})}get selector(){return Rl(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});const r=[];return e!=="sighash"&&r.push("error"),r.push(this.name+zp(e,this.inputs)),r.join(" ")}static from(e){if(Qn.isFragment(e))return e;if(typeof e=="string")return Qn.from(bu(e));if(e instanceof Zs){const r=x2("error",e),n=Bo(e);return Dl(e),new Qn(gr,r,n)}return new Qn(gr,e.name,e.inputs?e.inputs.map(dn.from):[])}static isFragment(e){return e&&e[ci]===o7}}class Ea extends b2{constructor(r,n,i,s){super(r,"event",n,i);se(this,"anonymous");Object.defineProperty(this,ci,{value:c7}),ot(this,{anonymous:s})}get topicHash(){return Rl(this.format("sighash"))}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(r)))});const n=[];return r!=="sighash"&&n.push("event"),n.push(this.name+zp(r,this.inputs)),r!=="sighash"&&this.anonymous&&n.push("anonymous"),n.join(" ")}static getTopicHash(r,n){return n=(n||[]).map(s=>dn.from(s)),new Ea(gr,r,n,!1).topicHash}static from(r){if(Ea.isFragment(r))return r;if(typeof r=="string")try{return Ea.from(bu(r))}catch{fe(!1,"invalid event fragment","obj",r)}else if(r instanceof Zs){const n=x2("event",r),i=Bo(r,!0),s=!!jo(r,Un(["anonymous"])).has("anonymous");return Dl(r),new Ea(gr,n,i,s)}return new Ea(gr,r.name,r.inputs?r.inputs.map(n=>dn.from(n,!0)):[],!!r.anonymous)}static isFragment(r){return r&&r[ci]===c7}}class wo extends Ol{constructor(r,n,i,s,a){super(r,n,i);se(this,"payable");se(this,"gas");Object.defineProperty(this,ci,{value:u7}),ot(this,{payable:s,gas:a})}format(r){if(Oe(r!=null&&r!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),r==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(r)))});const n=[`constructor${zp(r,this.inputs)}`];return this.payable&&n.push("payable"),this.gas!=null&&n.push(`@${this.gas.toString()}`),n.join(" ")}static from(r){if(wo.isFragment(r))return r;if(typeof r=="string")try{return wo.from(bu(r))}catch{fe(!1,"invalid constuctor fragment","obj",r)}else if(r instanceof Zs){jo(r,Un(["constructor"]));const n=Bo(r),i=!!jo(r,WY).has("payable"),s=ET(r);return Dl(r),new wo(gr,"constructor",n,i,s)}return new wo(gr,"constructor",r.inputs?r.inputs.map(dn.from):[],!!r.payable,r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[ci]===u7}}class eo extends Ol{constructor(r,n,i){super(r,"fallback",n);se(this,"payable");Object.defineProperty(this,ci,{value:l7}),ot(this,{payable:i})}format(r){const n=this.inputs.length===0?"receive":"fallback";if(r==="json"){const i=this.payable?"payable":"nonpayable";return JSON.stringify({type:n,stateMutability:i})}return`${n}()${this.payable?" payable":""}`}static from(r){if(eo.isFragment(r))return r;if(typeof r=="string")try{return eo.from(bu(r))}catch{fe(!1,"invalid fallback fragment","obj",r)}else if(r instanceof Zs){const n=r.toString(),i=r.peekKeyword(Un(["fallback","receive"]));if(fe(i,"type must be fallback or receive","obj",n),r.popKeyword(Un(["fallback","receive"]))==="receive"){const c=Bo(r);return fe(c.length===0,"receive cannot have arguments","obj.inputs",c),jo(r,Un(["payable"])),Dl(r),new eo(gr,[],!0)}let a=Bo(r);a.length?fe(a.length===1&&a[0].type==="bytes","invalid fallback inputs","obj.inputs",a.map(c=>c.format("minimal")).join(", ")):a=[dn.from("bytes")];const o=wT(r);if(fe(o==="nonpayable"||o==="payable","fallback cannot be constants","obj.stateMutability",o),jo(r,Un(["returns"])).has("returns")){const c=Bo(r);fe(c.length===1&&c[0].type==="bytes","invalid fallback outputs","obj.outputs",c.map(u=>u.format("minimal")).join(", "))}return Dl(r),new eo(gr,a,o==="payable")}if(r.type==="receive")return new eo(gr,[],!0);if(r.type==="fallback"){const n=[dn.from("bytes")],i=r.stateMutability==="payable";return new eo(gr,n,i)}fe(!1,"invalid fallback description","obj",r)}static isFragment(r){return r&&r[ci]===l7}}class Sa extends b2{constructor(r,n,i,s,a,o){super(r,"function",n,s);se(this,"constant");se(this,"outputs");se(this,"stateMutability");se(this,"payable");se(this,"gas");Object.defineProperty(this,ci,{value:f7}),a=Object.freeze(a.slice()),ot(this,{constant:i==="view"||i==="pure",gas:o,outputs:a,payable:i==="payable",stateMutability:i})}get selector(){return Rl(this.format("sighash")).substring(0,10)}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(r))),outputs:this.outputs.map(i=>JSON.parse(i.format(r)))});const n=[];return r!=="sighash"&&n.push("function"),n.push(this.name+zp(r,this.inputs)),r!=="sighash"&&(this.stateMutability!=="nonpayable"&&n.push(this.stateMutability),this.outputs&&this.outputs.length&&(n.push("returns"),n.push(zp(r,this.outputs))),this.gas!=null&&n.push(`@${this.gas.toString()}`)),n.join(" ")}static getSelector(r,n){return n=(n||[]).map(s=>dn.from(s)),new Sa(gr,r,"view",n,[],null).selector}static from(r){if(Sa.isFragment(r))return r;if(typeof r=="string")try{return Sa.from(bu(r))}catch{fe(!1,"invalid function fragment","obj",r)}else if(r instanceof Zs){const i=x2("function",r),s=Bo(r),a=wT(r);let o=[];jo(r,Un(["returns"])).has("returns")&&(o=Bo(r));const c=ET(r);return Dl(r),new Sa(gr,i,a,s,o,c)}let n=r.stateMutability;return n==null&&(n="payable",typeof r.constant=="boolean"?(n="view",r.constant||(n="payable",typeof r.payable=="boolean"&&!r.payable&&(n="nonpayable"))):typeof r.payable=="boolean"&&!r.payable&&(n="nonpayable")),new Sa(gr,r.name,n,r.inputs?r.inputs.map(dn.from):[],r.outputs?r.outputs.map(dn.from):[],r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[ci]===f7}}class El extends b2{constructor(e,r,n){super(e,"struct",r,n),Object.defineProperty(this,ci,{value:d7})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return El.from(bu(e))}catch{fe(!1,"invalid struct fragment","obj",e)}else if(e instanceof Zs){const r=x2("struct",e),n=Bo(e);return Dl(e),new El(gr,r,n)}return new El(gr,e.name,e.inputs?e.inputs.map(dn.from):[])}static isFragment(e){return e&&e[ci]===d7}}const ta=new Map;ta.set(0,"GENERIC_PANIC");ta.set(1,"ASSERT_FALSE");ta.set(17,"OVERFLOW");ta.set(18,"DIVIDE_BY_ZERO");ta.set(33,"ENUM_RANGE_ERROR");ta.set(34,"BAD_STORAGE_DATA");ta.set(49,"STACK_UNDERFLOW");ta.set(50,"ARRAY_RANGE_ERROR");ta.set(65,"OUT_OF_MEMORY");ta.set(81,"UNINITIALIZED_FUNCTION_CALL");const iee=new RegExp(/^bytes([0-9]*)$/),see=new RegExp(/^(u?int)([0-9]*)$/);let Vb=null,h7=1024;function aee(t,e,r,n){let i="missing revert data",s=null;const a=null;let o=null;if(r){i="execution reverted";const u=jt(r);if(r=rt(r),u.length===0)i+=" (no data present; likely require(false) occurred",s="require(false)";else if(u.length%32!==4)i+=" (could not decode reason; invalid data length)";else if(rt(u.slice(0,4))==="0x08c379a0")try{s=n.decode(["string"],u.slice(4))[0],o={signature:"Error(string)",name:"Error",args:[s]},i+=`: ${JSON.stringify(s)}`}catch{i+=" (could not decode reason; invalid string data)"}else if(rt(u.slice(0,4))==="0x4e487b71")try{const l=Number(n.decode(["uint256"],u.slice(4))[0]);o={signature:"Panic(uint256)",name:"Panic",args:[l]},s=`Panic due to ${ta.get(l)||"UNKNOWN"}(${l})`,i+=`: ${s}`}catch{i+=" (could not decode panic code)"}else i+=" (unknown custom error)"}const c={to:e.to?qt(e.to):null,data:e.data||"0x"};return e.from&&(c.from=qt(e.from)),Tr(i,"CALL_EXCEPTION",{action:t,data:r,reason:s,transaction:c,invocation:a,revert:o})}var Cc,Ef;const hy=class hy{constructor(){ue(this,Cc)}getDefaultValue(e){const r=e.map(i=>Ee(this,Cc,Ef).call(this,dn.from(i)));return new R1(r,"_").defaultValue()}encode(e,r){cP(r.length,e.length,"types/values length mismatch");const n=e.map(a=>Ee(this,Cc,Ef).call(this,dn.from(a))),i=new R1(n,"_"),s=new K4;return i.encode(s,r),s.data}decode(e,r,n){const i=e.map(a=>Ee(this,Cc,Ef).call(this,dn.from(a)));return new R1(i,"_").decode(new W4(r,n,h7))}static _setDefaultMaxInflation(e){fe(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),h7=e}static defaultAbiCoder(){return Vb==null&&(Vb=new hy),Vb}static getBuiltinCallException(e,r,n){return aee(e,r,n,hy.defaultAbiCoder())}};Cc=new WeakSet,Ef=function(e){if(e.isArray())return new NQ(Ee(this,Cc,Ef).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new R1(e.components.map(n=>Ee(this,Cc,Ef).call(this,n)),e.name);switch(e.baseType){case"address":return new PQ(e.name);case"bool":return new RQ(e.name);case"string":return new HQ(e.name);case"bytes":return new DQ(e.name);case"":return new LQ(e.name)}let r=e.type.match(see);if(r){let n=parseInt(r[2]||"256");return fe(n!==0&&n<=256&&n%8===0,"invalid "+r[1]+" bit length","param",e),new zQ(n/8,r[1]==="int",e.name)}if(r=e.type.match(iee),r){let n=parseInt(r[1]);return fe(n!==0&&n<=32,"invalid bytes length","param",e),new OQ(n,e.name)}fe(!1,"invalid type","type",e.type)};let Hp=hy;class oee{constructor(e,r,n){se(this,"fragment");se(this,"name");se(this,"signature");se(this,"topic");se(this,"args");const i=e.name,s=e.format();ot(this,{fragment:e,name:i,signature:s,topic:r,args:n})}}class cee{constructor(e,r,n,i){se(this,"fragment");se(this,"name");se(this,"args");se(this,"signature");se(this,"selector");se(this,"value");const s=e.name,a=e.format();ot(this,{fragment:e,name:s,args:n,signature:a,selector:r,value:i})}}class uee{constructor(e,r,n){se(this,"fragment");se(this,"name");se(this,"args");se(this,"signature");se(this,"selector");const i=e.name,s=e.format();ot(this,{fragment:e,name:i,args:n,signature:s,selector:r})}}class p7{constructor(e){se(this,"hash");se(this,"_isIndexed");ot(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const g7={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},m7={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:t=>`reverted with reason string ${JSON.stringify(t)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:t=>{let e="unknown panic code";return t>=0&&t<=255&&g7[t.toString()]&&(e=g7[t.toString()]),`reverted with panic code 0x${t.toString(16)} (${e})`}}};var fa,da,ha,yn,Pd,gm,Td,mm;const Vf=class Vf{constructor(e){ue(this,Pd);ue(this,Td);se(this,"fragments");se(this,"deploy");se(this,"fallback");se(this,"receive");ue(this,fa,void 0);ue(this,da,void 0);ue(this,ha,void 0);ue(this,yn,void 0);let r=[];typeof e=="string"?r=JSON.parse(e):r=e,Q(this,ha,new Map),Q(this,fa,new Map),Q(this,da,new Map);const n=[];for(const a of r)try{n.push(Ol.from(a))}catch(o){console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`,o.message)}ot(this,{fragments:Object.freeze(n)});let i=null,s=!1;Q(this,yn,this.getAbiCoder()),this.fragments.forEach((a,o)=>{let c;switch(a.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}ot(this,{deploy:a});return;case"fallback":a.inputs.length===0?s=!0:(fe(!i||a.payable!==i.payable,"conflicting fallback fragments",`fragments[${o}]`,a),i=a,s=i.payable);return;case"function":c=U(this,ha);break;case"event":c=U(this,da);break;case"error":c=U(this,fa);break;default:return}const u=a.format();c.has(u)||c.set(u,a)}),this.deploy||ot(this,{deploy:wo.from("constructor()")}),ot(this,{fallback:i,receive:s})}format(e){const r=e?"minimal":"full";return this.fragments.map(i=>i.format(r))}formatJson(){const e=this.fragments.map(r=>r.format("json"));return JSON.stringify(e.map(r=>JSON.parse(r)))}getAbiCoder(){return Hp.defaultAbiCoder()}getFunctionName(e){const r=Ee(this,Pd,gm).call(this,e,null,!1);return fe(r,"no matching function","key",e),r.name}hasFunction(e){return!!Ee(this,Pd,gm).call(this,e,null,!1)}getFunction(e,r){return Ee(this,Pd,gm).call(this,e,r||null,!0)}forEachFunction(e){const r=Array.from(U(this,ha).keys());r.sort((n,i)=>n.localeCompare(i));for(let n=0;nn.localeCompare(i));for(let n=0;n1){const s=i.map(a=>JSON.stringify(a.format())).join(", ");fe(!1,`ambiguous error description (i.e. ${s})`,"name",e)}return i[0]}if(e=Qn.from(e).format(),e==="Error(string)")return Qn.from("error Error(string)");if(e==="Panic(uint256)")return Qn.from("error Panic(uint256)");const n=U(this,fa).get(e);return n||null}forEachError(e){const r=Array.from(U(this,fa).keys());r.sort((n,i)=>n.localeCompare(i));for(let n=0;ns.type==="string"?Rl(a):s.type==="bytes"?hr(rt(a)):(s.type==="bool"&&typeof a=="boolean"?a=a?"0x01":"0x00":s.type.match(/^u?int/)?a=iu(a):s.type.match(/^bytes/)?a=QJ(a,32):s.type==="address"&&U(this,yn).encode(["address"],[a]),Nl(rt(a),32));for(r.forEach((s,a)=>{const o=e.inputs[a];if(!o.indexed){fe(s==null,"cannot filter non-indexed parameters; must be null","contract."+o.name,s);return}s==null?n.push(null):o.baseType==="array"||o.baseType==="tuple"?fe(!1,"filtering with tuples or arrays not supported","contract."+o.name,s):Array.isArray(s)?n.push(s.map(c=>i(o,c))):n.push(i(o,s))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){if(typeof e=="string"){const a=this.getEvent(e);fe(a,"unknown event","eventFragment",e),e=a}const n=[],i=[],s=[];return e.anonymous||n.push(e.topicHash),fe(r.length===e.inputs.length,"event arguments/values mismatch","values",r),e.inputs.forEach((a,o)=>{const c=r[o];if(a.indexed)if(a.type==="string")n.push(Rl(c));else if(a.type==="bytes")n.push(hr(c));else{if(a.baseType==="tuple"||a.baseType==="array")throw new Error("not implemented");n.push(U(this,yn).encode([a.type],[c]))}else i.push(a),s.push(c)}),{data:U(this,yn).encode(i,s),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"){const p=this.getEvent(e);fe(p,"unknown event","eventFragment",e),e=p}if(n!=null&&!e.anonymous){const p=e.topicHash;fe(er(n[0],32)&&n[0].toLowerCase()===p,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}const i=[],s=[],a=[];e.inputs.forEach((p,h)=>{p.indexed?p.type==="string"||p.type==="bytes"||p.baseType==="tuple"||p.baseType==="array"?(i.push(dn.from({type:"bytes32",name:p.name})),a.push(!0)):(i.push(p),a.push(!1)):(s.push(p),a.push(!1))});const o=n!=null?U(this,yn).decode(i,Mr(n)):null,c=U(this,yn).decode(s,r,!0),u=[],l=[];let f=0,d=0;return e.inputs.forEach((p,h)=>{let g=null;if(p.indexed)if(o==null)g=new p7(null);else if(a[h])g=new p7(o[d++]);else try{g=o[d++]}catch(v){g=v}else try{g=c[f++]}catch(v){g=v}u.push(g),l.push(p.name||null)}),Cv.fromItems(u,l)}parseTransaction(e){const r=jt(e.data,"tx.data"),n=tt(e.value!=null?e.value:0,"tx.value"),i=this.getFunction(rt(r.slice(0,4)));if(!i)return null;const s=U(this,yn).decode(i.inputs,r.slice(4));return new cee(i,i.selector,s,n)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new oee(r,r.topicHash,this.decodeEventLog(r,e.data,e.topics))}parseError(e){const r=rt(e),n=this.getError(xr(r,0,4));if(!n)return null;const i=U(this,yn).decode(n.inputs,xr(r,4));return new uee(n,n.selector,i)}static from(e){return e instanceof Vf?e:typeof e=="string"?new Vf(JSON.parse(e)):typeof e.format=="function"?new Vf(e.format("json")):new Vf(e)}};fa=new WeakMap,da=new WeakMap,ha=new WeakMap,yn=new WeakMap,Pd=new WeakSet,gm=function(e,r,n){if(er(e)){const s=e.toLowerCase();for(const a of U(this,ha).values())if(s===a.selector)return a;return null}if(e.indexOf("(")===-1){const s=[];for(const[a,o]of U(this,ha))a.split("(")[0]===e&&s.push(o);if(r){const a=r.length>0?r[r.length-1]:null;let o=r.length,c=!0;kn.isTyped(a)&&a.type==="overrides"&&(c=!1,o--);for(let u=s.length-1;u>=0;u--){const l=s[u].inputs.length;l!==o&&(!c||l!==o-1)&&s.splice(u,1)}for(let u=s.length-1;u>=0;u--){const l=s[u].inputs;for(let f=0;f=l.length){if(r[f].type==="overrides")continue;s.splice(u,1);break}if(r[f].type!==l[f].baseType){s.splice(u,1);break}}}}if(s.length===1&&r&&r.length!==s[0].inputs.length){const a=r[r.length-1];(a==null||Array.isArray(a)||typeof a!="object")&&s.splice(0,1)}if(s.length===0)return null;if(s.length>1&&n){const a=s.map(o=>JSON.stringify(o.format())).join(", ");fe(!1,`ambiguous function description (i.e. matches ${a})`,"key",e)}return s[0]}const i=U(this,ha).get(Sa.from(e).format());return i||null},Td=new WeakSet,mm=function(e,r,n){if(er(e)){const s=e.toLowerCase();for(const a of U(this,da).values())if(s===a.topicHash)return a;return null}if(e.indexOf("(")===-1){const s=[];for(const[a,o]of U(this,da))a.split("(")[0]===e&&s.push(o);if(r){for(let a=s.length-1;a>=0;a--)s[a].inputs.length=0;a--){const o=s[a].inputs;for(let c=0;c1&&n){const a=s.map(o=>JSON.stringify(o.format())).join(", ");fe(!1,`ambiguous event description (i.e. matches ${a})`,"key",e)}return s[0]}const i=U(this,da).get(Ea.from(e).format());return i||null};let a3=Vf;const ST=BigInt(0);function sp(t){return t??null}function Sr(t){return t==null?null:t.toString()}class v7{constructor(e,r,n){se(this,"gasPrice");se(this,"maxFeePerGas");se(this,"maxPriorityFeePerGas");ot(this,{gasPrice:sp(e),maxFeePerGas:sp(r),maxPriorityFeePerGas:sp(n)})}toJSON(){const{gasPrice:e,maxFeePerGas:r,maxPriorityFeePerGas:n}=this;return{_type:"FeeData",gasPrice:Sr(e),maxFeePerGas:Sr(r),maxPriorityFeePerGas:Sr(n)}}}function Rv(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=rt(t.data));const r="chainId,gasLimit,gasPrice,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const i of r)!(i in t)||t[i]==null||(e[i]=tt(t[i],`request.${i}`));const n="type,nonce".split(/,/);for(const i of n)!(i in t)||t[i]==null||(e[i]=yt(t[i],`request.${i}`));return t.accessList&&(e.accessList=Yl(t.accessList)),"blockTag"in t&&(e.blockTag=t.blockTag),"enableCcipRead"in t&&(e.enableCcipRead=!!t.enableCcipRead),"customData"in t&&(e.customData=t.customData),e}var oo;class lee{constructor(e,r){se(this,"provider");se(this,"number");se(this,"hash");se(this,"timestamp");se(this,"parentHash");se(this,"parentBeaconBlockRoot");se(this,"nonce");se(this,"difficulty");se(this,"gasLimit");se(this,"gasUsed");se(this,"stateRoot");se(this,"receiptsRoot");se(this,"blobGasUsed");se(this,"excessBlobGas");se(this,"miner");se(this,"extraData");se(this,"baseFeePerGas");ue(this,oo,void 0);Q(this,oo,e.transactions.map(n=>typeof n!="string"?new Vp(n,r):n)),ot(this,{provider:r,hash:sp(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,parentBeaconBlockRoot:e.parentBeaconBlockRoot,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,blobGasUsed:e.blobGasUsed,excessBlobGas:e.excessBlobGas,miner:e.miner,extraData:e.extraData,baseFeePerGas:sp(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return U(this,oo).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=U(this,oo).slice();return e.length===0?[]:(Oe(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:r,extraData:n,gasLimit:i,gasUsed:s,hash:a,miner:o,nonce:c,number:u,parentHash:l,parentBeaconBlockRoot:f,stateRoot:d,receiptsRoot:p,timestamp:h,transactions:g}=this;return{_type:"Block",baseFeePerGas:Sr(e),difficulty:Sr(r),extraData:n,gasLimit:Sr(i),gasUsed:Sr(s),blobGasUsed:Sr(this.blobGasUsed),excessBlobGas:Sr(this.excessBlobGas),hash:a,miner:o,nonce:c,number:u,parentHash:l,timestamp:h,parentBeaconBlockRoot:f,stateRoot:d,receiptsRoot:p,transactions:g}}[Symbol.iterator](){let e=0;const r=this.transactions;return{next:()=>enew Jg(i,r))));let n=ST;e.effectiveGasPrice!=null?n=e.effectiveGasPrice:e.gasPrice!=null&&(n=e.gasPrice),ot(this,{provider:r,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:n,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return U(this,vg)}toJSON(){const{to:e,from:r,contractAddress:n,hash:i,index:s,blockHash:a,blockNumber:o,logsBloom:c,logs:u,status:l,root:f}=this;return{_type:"TransactionReceipt",blockHash:a,blockNumber:o,contractAddress:n,cumulativeGasUsed:Sr(this.cumulativeGasUsed),from:r,gasPrice:Sr(this.gasPrice),blobGasUsed:Sr(this.blobGasUsed),blobGasPrice:Sr(this.blobGasPrice),gasUsed:Sr(this.gasUsed),hash:i,index:s,logs:u,logsBloom:c,root:f,status:l,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e{if(o)return null;const{blockNumber:d,nonce:p}=await Rn({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(p{if(d==null||d.status!==0)return d;Oe(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:d.to,from:d.from,data:""},receipt:d})},l=await this.provider.getTransactionReceipt(this.hash);if(n===0)return u(l);if(l){if(await l.confirmations()>=n)return u(l)}else if(await c(),n===0)return null;return await new Promise((d,p)=>{const h=[],g=()=>{h.forEach(x=>x())};if(h.push(()=>{o=!0}),i>0){const x=setTimeout(()=>{g(),p(Tr("wait for transaction timeout","TIMEOUT"))},i);h.push(()=>{clearTimeout(x)})}const v=async x=>{if(await x.confirmations()>=n){g();try{d(u(x))}catch(b){p(b)}}};if(h.push(()=>{this.provider.off(this.hash,v)}),this.provider.on(this.hash,v),s>=0){const x=async()=>{try{await c()}catch(b){if(Cn(b,"TRANSACTION_REPLACED")){g(),p(b);return}}o||this.provider.once("block",x)};h.push(()=>{this.provider.off("block",x)}),this.provider.once("block",x)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return Oe(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),_T(this)}reorderedEvent(e){return Oe(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),Oe(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),CT(this,e)}replaceableTransaction(e){fe(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const r=new YE(this,this.provider);return Q(r,_c,e),r}};_c=new WeakMap;let Vp=YE;function fee(t){return{orphan:"drop-block",hash:t.hash,number:t.number}}function CT(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function _T(t){return{orphan:"drop-transaction",tx:t}}function dee(t){return{orphan:"drop-log",log:{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,address:t.address,data:t.data,topics:Object.freeze(t.topics.slice()),index:t.index}}}class fE extends Jg{constructor(r,n,i){super(r,r.provider);se(this,"interface");se(this,"fragment");se(this,"args");const s=n.decodeEventLog(i,r.data,r.topics);ot(this,{args:s,fragment:i,interface:n})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class kT extends Jg{constructor(r,n){super(r,r.provider);se(this,"error");ot(this,{error:n})}}var Nd;class hee extends AT{constructor(r,n,i){super(i,n);ue(this,Nd,void 0);Q(this,Nd,r)}get logs(){return super.logs.map(r=>{const n=r.topics.length?U(this,Nd).getEvent(r.topics[0]):null;if(n)try{return new fE(r,U(this,Nd),n)}catch(i){return new kT(r,i)}return r})}}Nd=new WeakMap;var yg;class dE extends Vp{constructor(r,n,i){super(i,n);ue(this,yg,void 0);Q(this,yg,r)}async wait(r,n){const i=await super.wait(r,n);return i==null?null:new hee(U(this,yg),this.provider,i)}}yg=new WeakMap;class BT extends dP{constructor(r,n,i,s){super(r,n,i);se(this,"log");ot(this,{log:s})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class pee extends BT{constructor(e,r,n,i,s){super(e,r,n,new fE(s,e.interface,i));const a=e.interface.decodeEventLog(i,this.log.data,this.log.topics);ot(this,{args:a,fragment:i})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const y7=BigInt(0);function IT(t){return t&&typeof t.call=="function"}function FT(t){return t&&typeof t.estimateGas=="function"}function w2(t){return t&&typeof t.resolveName=="function"}function PT(t){return t&&typeof t.sendTransaction=="function"}function TT(t){if(t!=null){if(w2(t))return t;if(t.provider)return t.provider}}var xg;class gee{constructor(e,r,n){ue(this,xg,void 0);se(this,"fragment");if(ot(this,{fragment:r}),r.inputs.lengthn[c]==null?null:o.walkAsync(n[c],(l,f)=>l==="address"?Array.isArray(f)?Promise.all(f.map(d=>jn(d,s))):jn(f,s):f)));return e.interface.encodeFilterTopics(r,a)}())}getTopicFilter(){return U(this,xg)}}xg=new WeakMap;function Ml(t,e){return t==null?null:typeof t[e]=="function"?t:t.provider&&typeof t.provider[e]=="function"?t.provider:null}function Vu(t){return t==null?null:t.provider||null}async function NT(t,e){const r=kn.dereference(t,"overrides");fe(typeof r=="object","invalid overrides parameter","overrides",t);const n=Rv(r);return fe(n.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",n.to),fe(n.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",n.data),n.from&&(n.from=n.from),n}async function mee(t,e,r){const n=Ml(t,"resolveName"),i=w2(n)?n:null;return await Promise.all(e.map((s,a)=>s.walkAsync(r[a],(o,c)=>(c=kn.dereference(c,o),o==="address"?jn(c,i):c))))}function vee(t){const e=async function(a){const o=await NT(a,["data"]);o.to=await t.getAddress(),o.from&&(o.from=await jn(o.from,TT(t.runner)));const c=t.interface,u=tt(o.value||y7,"overrides.value")===y7,l=(o.data||"0x")==="0x";c.fallback&&!c.fallback.payable&&c.receive&&!l&&!u&&fe(!1,"cannot send data to receive or send value to non-payable fallback","overrides",a),fe(c.fallback||l,"cannot send data to receive-only contract","overrides.data",o.data);const f=c.receive||c.fallback&&c.fallback.payable;return fe(f||u,"cannot send value to non-payable fallback","overrides.value",o.value),fe(c.fallback||l,"cannot send data to receive-only contract","overrides.data",o.data),o},r=async function(a){const o=Ml(t.runner,"call");Oe(IT(o),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const c=await e(a);try{return await o.call(c)}catch(u){throw Z5(u)&&u.data?t.interface.makeError(u.data,c):u}},n=async function(a){const o=t.runner;Oe(PT(o),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const c=await o.sendTransaction(await e(a)),u=Vu(t.runner);return new dE(t.interface,u,c)},i=async function(a){const o=Ml(t.runner,"estimateGas");return Oe(FT(o),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await o.estimateGas(await e(a))},s=async a=>await n(a);return ot(s,{_contract:t,estimateGas:i,populateTransaction:e,send:n,staticCall:r}),s}function yee(t,e){const r=function(...u){const l=t.interface.getFunction(e,u);return Oe(l,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:u}}),l},n=async function(...u){const l=r(...u);let f={};if(l.inputs.length+1===u.length&&(f=await NT(u.pop()),f.from&&(f.from=await jn(f.from,TT(t.runner)))),l.inputs.length!==u.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await mee(t.runner,l.inputs,u);return Object.assign({},f,await Rn({to:t.getAddress(),data:t.interface.encodeFunctionData(l,d)}))},i=async function(...u){const l=await o(...u);return l.length===1?l[0]:l},s=async function(...u){const l=t.runner;Oe(PT(l),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const f=await l.sendTransaction(await n(...u)),d=Vu(t.runner);return new dE(t.interface,d,f)},a=async function(...u){const l=Ml(t.runner,"estimateGas");return Oe(FT(l),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await l.estimateGas(await n(...u))},o=async function(...u){const l=Ml(t.runner,"call");Oe(IT(l),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const f=await n(...u);let d="0x";try{d=await l.call(f)}catch(h){throw Z5(h)&&h.data?t.interface.makeError(h.data,f):h}const p=r(...u);return t.interface.decodeFunctionResult(p,d)},c=async(...u)=>r(...u).constant?await i(...u):await s(...u);return ot(c,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:r,estimateGas:a,populateTransaction:n,send:s,staticCall:i,staticCallResult:o}),Object.defineProperty(c,"fragment",{configurable:!1,enumerable:!0,get:()=>{const u=t.interface.getFunction(e);return Oe(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),u}}),c}function xee(t,e){const r=function(...i){const s=t.interface.getEvent(e,i);return Oe(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:i}}),s},n=function(...i){return new gee(t,r(...i),i)};return ot(n,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:r}),Object.defineProperty(n,"fragment",{configurable:!1,enumerable:!0,get:()=>{const i=t.interface.getEvent(e);return Oe(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),i}}),n}const Dv=Symbol.for("_ethersInternal_contract"),RT=new WeakMap;function bee(t,e){RT.set(t[Dv],e)}function fi(t){return RT.get(t[Dv])}function wee(t){return t&&typeof t=="object"&&"getTopicFilter"in t&&typeof t.getTopicFilter=="function"&&t.fragment}async function hE(t,e){let r,n=null;if(Array.isArray(e)){const s=function(a){if(er(a,32))return a;const o=t.interface.getEvent(a);return fe(o,"unknown fragment","name",a),o.topicHash};r=e.map(a=>a==null?null:Array.isArray(a)?a.map(s):s(a))}else e==="*"?r=[null]:typeof e=="string"?er(e,32)?r=[e]:(n=t.interface.getEvent(e),fe(n,"unknown fragment","event",e),r=[n.topicHash]):wee(e)?r=await e.getTopicFilter():"fragment"in e?(n=e.fragment,r=[n.topicHash]):fe(!1,"unknown event name","event",e);r=r.map(s=>{if(s==null)return null;if(Array.isArray(s)){const a=Array.from(new Set(s.map(o=>o.toLowerCase())).values());return a.length===1?a[0]:(a.sort(),a)}return s.toLowerCase()});const i=r.map(s=>s==null?"null":Array.isArray(s)?s.join("|"):s).join("&");return{fragment:n,tag:i,topics:r}}async function U0(t,e){const{subs:r}=fi(t);return r.get((await hE(t,e)).tag)||null}async function x7(t,e,r){const n=Vu(t.runner);Oe(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:i,tag:s,topics:a}=await hE(t,r),{addr:o,subs:c}=fi(t);let u=c.get(s);if(!u){const f={address:o||t,topics:a},d=v=>{let x=i;if(x==null)try{x=t.interface.getEvent(v.topics[0])}catch{}if(x){const b=x,S=i?t.interface.decodeEventLog(i,v.data,v.topics):[];c3(t,r,S,_=>new pee(t,_,r,b,v))}else c3(t,r,[],b=>new BT(t,b,r,v))};let p=[];u={tag:s,listeners:[],start:()=>{p.length||p.push(n.on(f,d))},stop:async()=>{if(p.length==0)return;let v=p;p=[],await Promise.all(v),n.off(f,d)}},c.set(s,u)}return u}let o3=Promise.resolve();async function Eee(t,e,r,n){await o3;const i=await U0(t,e);if(!i)return!1;const s=i.listeners.length;return i.listeners=i.listeners.filter(({listener:a,once:o})=>{const c=Array.from(r);n&&c.push(n(o?null:a));try{a.call(t,...c)}catch{}return!o}),i.listeners.length===0&&(i.stop(),fi(t).subs.delete(i.tag)),s>0}async function c3(t,e,r,n){try{await o3}catch{}const i=Eee(t,e,r,n);return o3=i,await i}const O1=["then"];var s0e;const dp=class dp{constructor(e,r,n,i){se(this,"target");se(this,"interface");se(this,"runner");se(this,"filters");se(this,s0e);se(this,"fallback");fe(typeof e=="string"||UP(e),"invalid value for Contract target","target",e),n==null&&(n=null);const s=a3.from(r);ot(this,{target:e,runner:n,interface:s}),Object.defineProperty(this,Dv,{value:{}});let a,o=null,c=null;if(i){const f=Vu(n);c=new dE(this.interface,f,i)}let u=new Map;if(typeof e=="string")if(er(e))o=e,a=Promise.resolve(e);else{const f=Ml(n,"resolveName");if(!w2(f))throw Tr("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});a=f.resolveName(e).then(d=>{if(d==null)throw Tr("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return fi(this).addr=d,d})}else a=e.getAddress().then(f=>{if(f==null)throw new Error("TODO");return fi(this).addr=f,f});bee(this,{addrPromise:a,addr:o,deployTx:c,subs:u});const l=new Proxy({},{get:(f,d,p)=>{if(typeof d=="symbol"||O1.indexOf(d)>=0)return Reflect.get(f,d,p);try{return this.getEvent(d)}catch(h){if(!Cn(h,"INVALID_ARGUMENT")||h.argument!=="key")throw h}},has:(f,d)=>O1.indexOf(d)>=0?Reflect.has(f,d):Reflect.has(f,d)||this.interface.hasEvent(String(d))});return ot(this,{filters:l}),ot(this,{fallback:s.receive||s.fallback?vee(this):null}),new Proxy(this,{get:(f,d,p)=>{if(typeof d=="symbol"||d in f||O1.indexOf(d)>=0)return Reflect.get(f,d,p);try{return f.getFunction(d)}catch(h){if(!Cn(h,"INVALID_ARGUMENT")||h.argument!=="key")throw h}},has:(f,d)=>typeof d=="symbol"||d in f||O1.indexOf(d)>=0?Reflect.has(f,d):f.interface.hasFunction(d)})}connect(e){return new dp(this.target,this.interface,e)}attach(e){return new dp(e,this.interface,this.runner)}async getAddress(){return await fi(this).addrPromise}async getDeployedCode(){const e=Vu(this.runner);Oe(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const r=await e.getCode(await this.getAddress());return r==="0x"?null:r}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const n=Vu(this.runner);return Oe(n!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((i,s)=>{const a=async()=>{try{if(await this.getDeployedCode()!=null)return i(this);n.once("block",a)}catch(o){s(o)}};a()})}deploymentTransaction(){return fi(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),yee(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),xee(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,r,n){r==null&&(r=0),n==null&&(n="latest");const{addr:i,addrPromise:s}=fi(this),a=i||await s,{fragment:o,topics:c}=await hE(this,e),u={address:a,topics:c,fromBlock:r,toBlock:n},l=Vu(this.runner);return Oe(l,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await l.getLogs(u)).map(f=>{let d=o;if(d==null)try{d=this.interface.getEvent(f.topics[0])}catch{}if(d)try{return new fE(f,this.interface,d)}catch(p){return new kT(f,p)}return new Jg(f,l)})}async on(e,r){const n=await x7(this,"on",e);return n.listeners.push({listener:r,once:!1}),n.start(),this}async once(e,r){const n=await x7(this,"once",e);return n.listeners.push({listener:r,once:!0}),n.start(),this}async emit(e,...r){return await c3(this,e,r,null)}async listenerCount(e){if(e){const i=await U0(this,e);return i?i.listeners.length:0}const{subs:r}=fi(this);let n=0;for(const{listeners:i}of r.values())n+=i.length;return n}async listeners(e){if(e){const i=await U0(this,e);return i?i.listeners.map(({listener:s})=>s):[]}const{subs:r}=fi(this);let n=[];for(const{listeners:i}of r.values())n=n.concat(i.map(({listener:s})=>s));return n}async off(e,r){const n=await U0(this,e);if(!n)return this;if(r){const i=n.listeners.map(({listener:s})=>s).indexOf(r);i>=0&&n.listeners.splice(i,1)}return(r==null||n.listeners.length===0)&&(n.stop(),fi(this).subs.delete(n.tag)),this}async removeAllListeners(e){if(e){const r=await U0(this,e);if(!r)return this;r.stop(),fi(this).subs.delete(r.tag)}else{const{subs:r}=fi(this);for(const{tag:n,stop:i}of r.values())i(),r.delete(n)}return this}async addListener(e,r){return await this.on(e,r)}async removeListener(e,r){return await this.off(e,r)}static buildClass(e){class r extends dp{constructor(i,s=null){super(i,e,s)}}return r}static from(e,r,n){return n==null&&(n=null),new this(e,r,n)}};s0e=Dv;let u3=dp;function See(){return u3}class ap extends See(){}function qb(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):fe(!1,"unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}class Aee{constructor(e){se(this,"name");ot(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,r){throw new Error("unsupported coin")}async decodeAddress(e,r){throw new Error("unsupported coin")}}const DT=new RegExp("^(ipfs)://(.*)$","i"),b7=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),DT,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];var kc,il,Bc,Sf,py,OT;const qf=class qf{constructor(e,r,n){ue(this,Bc);se(this,"provider");se(this,"address");se(this,"name");ue(this,kc,void 0);ue(this,il,void 0);ot(this,{provider:e,address:r,name:n}),Q(this,kc,null),Q(this,il,new ap(r,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e))}async supportsWildcard(){return U(this,kc)==null&&Q(this,kc,(async()=>{try{return await U(this,il).supportsInterface("0x9061b923")}catch(e){if(Cn(e,"CALL_EXCEPTION"))return!1;throw Q(this,kc,null),e}})()),await U(this,kc)}async getAddress(e){if(e==null&&(e=60),e===60)try{const s=await Ee(this,Bc,Sf).call(this,"addr(bytes32)");return s==null||s===Op?null:s}catch(s){if(Cn(s,"CALL_EXCEPTION"))return null;throw s}if(e>=0&&e<2147483648){let s=e+2147483648;const a=await Ee(this,Bc,Sf).call(this,"addr(bytes32,uint)",[s]);if(er(a,20))return qt(a)}let r=null;for(const s of this.provider.plugins)if(s instanceof Aee&&s.supportsCoinType(e)){r=s;break}if(r==null)return null;const n=await Ee(this,Bc,Sf).call(this,"addr(bytes32,uint)",[e]);if(n==null||n==="0x")return null;const i=await r.decodeAddress(e,n);if(i!=null)return i;Oe(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:n}})}async getText(e){const r=await Ee(this,Bc,Sf).call(this,"text(bytes32,string)",[e]);return r==null||r==="0x"?null:r}async getContentHash(){const e=await Ee(this,Bc,Sf).call(this,"contenthash(bytes32)");if(e==null||e==="0x")return null;const r=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){const i=r[1]==="e3010170"?"ipfs":"ipns",s=parseInt(r[4],16);if(r[5].length===s*2)return`${i}://${tX("0x"+r[2])}`}const n=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&n[1].length===64)return`bzz://${n[1]}`;Oe(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const r=await this.getText("avatar");if(r==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:r});for(let n=0;n{if(e&&r==null)return null;if(!Array.isArray(r))throw new Error("not an array");return r.map(n=>t(n))}}function Xg(t,e){return r=>{const n={};for(const i in t){let s=i;if(e&&i in e&&!(s in r)){for(const a of e[i])if(a in r){s=a;break}}try{const a=t[i](r[s]);a!==void 0&&(n[i]=a)}catch(a){const o=a instanceof Error?a.message:"not-an-error";Oe(!1,`invalid value for value.${i} (${o})`,"BAD_DATA",{value:r})}}return n}}function Cee(t){switch(t){case!0:case"true":return!0;case!1:case"false":return!1}fe(!1,`invalid boolean; ${JSON.stringify(t)}`,"value",t)}function Ch(t){return fe(er(t,!0),"invalid data","value",t),t}function An(t){return fe(er(t,32),"invalid hash","value",t),t}const _ee=Xg({address:qt,blockHash:An,blockNumber:yt,data:Ch,index:yt,removed:It(Cee,!1),topics:E2(An),transactionHash:An,transactionIndex:yt},{index:["logIndex"]});function kee(t){return _ee(t)}const Bee=Xg({hash:It(An),parentHash:An,parentBeaconBlockRoot:It(An,null),number:yt,timestamp:yt,nonce:It(Ch),difficulty:tt,gasLimit:tt,gasUsed:tt,stateRoot:It(An,null),receiptsRoot:It(An,null),blobGasUsed:It(tt,null),excessBlobGas:It(tt,null),miner:It(qt),extraData:Ch,baseFeePerGas:It(tt)});function Iee(t){const e=Bee(t);return e.transactions=t.transactions.map(r=>typeof r=="string"?r:MT(r)),e}const Fee=Xg({transactionIndex:yt,blockNumber:yt,transactionHash:An,address:qt,topics:E2(An),data:Ch,index:yt,blockHash:An},{index:["logIndex"]});function Pee(t){return Fee(t)}const Tee=Xg({to:It(qt,null),from:It(qt,null),contractAddress:It(qt,null),index:yt,root:It(rt),gasUsed:tt,blobGasUsed:It(tt,null),logsBloom:It(Ch),blockHash:An,hash:An,logs:E2(Pee),blockNumber:yt,cumulativeGasUsed:tt,effectiveGasPrice:It(tt),blobGasPrice:It(tt,null),status:It(yt),type:It(yt,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function Nee(t){return Tee(t)}function MT(t){t.to&&tt(t.to)===w7&&(t.to="0x0000000000000000000000000000000000000000");const e=Xg({hash:An,index:It(yt,void 0),type:r=>r==="0x"||r==null?0:yt(r),accessList:It(Yl,null),blobVersionedHashes:It(E2(An,!0),null),blockHash:It(An,null),blockNumber:It(yt,null),transactionIndex:It(yt,null),from:qt,gasPrice:It(tt),maxPriorityFeePerGas:It(tt),maxFeePerGas:It(tt),maxFeePerBlobGas:It(tt,null),gasLimit:tt,to:It(qt,null),value:tt,nonce:yt,data:Ch,creates:It(qt,null),chainId:It(tt,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(t);if(e.to==null&&e.creates==null&&(e.creates=FQ(e)),(t.type===1||t.type===2)&&t.accessList==null&&(e.accessList=[]),t.signature?e.signature=Gs.from(t.signature):e.signature=Gs.from(t),e.chainId==null){const r=e.signature.legacyChainId;r!=null&&(e.chainId=r)}return e.blockHash&&tt(e.blockHash)===w7&&(e.blockHash=null),e}const Ree="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class Qg{constructor(e){se(this,"name");ot(this,{name:e})}clone(){return new Qg(this.name)}}class S2 extends Qg{constructor(r,n){r==null&&(r=0);super(`org.ethers.network.plugins.GasCost#${r||0}`);se(this,"effectiveBlock");se(this,"txBase");se(this,"txCreate");se(this,"txDataZero");se(this,"txDataNonzero");se(this,"txAccessListStorageKey");se(this,"txAccessListAddress");const i={effectiveBlock:r};function s(a,o){let c=(n||{})[a];c==null&&(c=o),fe(typeof c=="number",`invalud value for ${a}`,"costs",n),i[a]=c}s("txBase",21e3),s("txCreate",32e3),s("txDataZero",4),s("txDataNonzero",16),s("txAccessListStorageKey",1900),s("txAccessListAddress",2400),ot(this,i)}clone(){return new S2(this.effectiveBlock,this)}}class A2 extends Qg{constructor(r,n){super("org.ethers.plugins.network.Ens");se(this,"address");se(this,"targetNetwork");ot(this,{address:r||Ree,targetNetwork:n??1})}clone(){return new A2(this.address,this.targetNetwork)}}var bg,wg;class Dee extends Qg{constructor(r,n){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");ue(this,bg,void 0);ue(this,wg,void 0);Q(this,bg,r),Q(this,wg,n)}get url(){return U(this,bg)}get processFunc(){return U(this,wg)}clone(){return this}}bg=new WeakMap,wg=new WeakMap;const Kb=new Map;var Rd,Dd,Ic;const Kf=class Kf{constructor(e,r){ue(this,Rd,void 0);ue(this,Dd,void 0);ue(this,Ic,void 0);Q(this,Rd,e),Q(this,Dd,tt(r)),Q(this,Ic,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return U(this,Rd)}set name(e){Q(this,Rd,e)}get chainId(){return U(this,Dd)}set chainId(e){Q(this,Dd,tt(e,"chainId"))}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===tt(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===tt(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===tt(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(U(this,Ic).values())}attachPlugin(e){if(U(this,Ic).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return U(this,Ic).set(e.name,e.clone()),this}getPlugin(e){return U(this,Ic).get(e)||null}getPlugins(e){return this.plugins.filter(r=>r.name.split("#")[0]===e)}clone(){const e=new Kf(this.name,this.chainId);return this.plugins.forEach(r=>{e.attachPlugin(r.clone())}),e}computeIntrinsicGas(e){const r=this.getPlugin("org.ethers.plugins.network.GasCost")||new S2;let n=r.txBase;if(e.to==null&&(n+=r.txCreate),e.data)for(let i=2;i9){let i=BigInt(n[1].substring(0,9));n[1].substring(9).match(/^0+$/)||i++,n[1]=i.toString()}return BigInt(n[0]+n[1])}function S7(t){return new Dee(t,async(e,r,n)=>{n.setHeader("User-Agent","ethers");let i;try{const[s,a]=await Promise.all([n.send(),e()]);i=s;const o=i.bodyJson.standard;return{gasPrice:a.gasPrice,maxFeePerGas:E7(o.maxFee,9),maxPriorityFeePerGas:E7(o.maxPriorityFee,9)}}catch(s){Oe(!1,`error encountered with polygon gas station (${JSON.stringify(n.url)})`,"SERVER_ERROR",{request:n,response:i,error:s})}})}let A7=!1;function Oee(){if(A7)return;A7=!0;function t(e,r,n){const i=function(){const s=new ka(e,r);return n.ensNetwork!=null&&s.attachPlugin(new A2(null,n.ensNetwork)),s.attachPlugin(new S2),(n.plugins||[]).forEach(a=>{s.attachPlugin(a)}),s};ka.register(e,i),ka.register(r,i),n.altNames&&n.altNames.forEach(s=>{ka.register(s,i)})}t("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),t("ropsten",3,{ensNetwork:3}),t("rinkeby",4,{ensNetwork:4}),t("goerli",5,{ensNetwork:5}),t("kovan",42,{ensNetwork:42}),t("sepolia",11155111,{ensNetwork:11155111}),t("holesky",17e3,{ensNetwork:17e3}),t("classic",61,{}),t("classicKotti",6,{}),t("arbitrum",42161,{ensNetwork:1}),t("arbitrum-goerli",421613,{}),t("arbitrum-sepolia",421614,{}),t("base",8453,{ensNetwork:1}),t("base-goerli",84531,{}),t("base-sepolia",84532,{}),t("bnb",56,{ensNetwork:1}),t("bnbt",97,{}),t("linea",59144,{ensNetwork:1}),t("linea-goerli",59140,{}),t("matic",137,{ensNetwork:1,plugins:[S7("https://gasstation.polygon.technology/v2")]}),t("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[S7("https://gasstation-testnet.polygon.technology/v2")]}),t("optimism",10,{ensNetwork:1,plugins:[]}),t("optimism-goerli",420,{}),t("optimism-sepolia",11155420,{}),t("xdai",100,{ensNetwork:1})}function l3(t){return JSON.parse(JSON.stringify(t))}var co,Hi,Fc,pa,Od,vm;class Mee{constructor(e){ue(this,Od);ue(this,co,void 0);ue(this,Hi,void 0);ue(this,Fc,void 0);ue(this,pa,void 0);Q(this,co,e),Q(this,Hi,null),Q(this,Fc,4e3),Q(this,pa,-2)}get pollingInterval(){return U(this,Fc)}set pollingInterval(e){Q(this,Fc,e)}start(){U(this,Hi)||(Q(this,Hi,U(this,co)._setTimeout(Ee(this,Od,vm).bind(this),U(this,Fc))),Ee(this,Od,vm).call(this))}stop(){U(this,Hi)&&(U(this,co)._clearTimeout(U(this,Hi)),Q(this,Hi,null))}pause(e){this.stop(),e&&Q(this,pa,-2)}resume(){this.start()}}co=new WeakMap,Hi=new WeakMap,Fc=new WeakMap,pa=new WeakMap,Od=new WeakSet,vm=async function(){try{const e=await U(this,co).getBlockNumber();if(U(this,pa)===-2){Q(this,pa,e);return}if(e!==U(this,pa)){for(let r=U(this,pa)+1;r<=e;r++){if(U(this,Hi)==null)return;await U(this,co).emit("block",r)}Q(this,pa,e)}}catch{}U(this,Hi)!=null&&Q(this,Hi,U(this,co)._setTimeout(Ee(this,Od,vm).bind(this),U(this,Fc)))};var sl,al,Pc;class pE{constructor(e){ue(this,sl,void 0);ue(this,al,void 0);ue(this,Pc,void 0);Q(this,sl,e),Q(this,Pc,!1),Q(this,al,r=>{this._poll(r,U(this,sl))})}async _poll(e,r){throw new Error("sub-classes must override this")}start(){U(this,Pc)||(Q(this,Pc,!0),U(this,al).call(this,-2),U(this,sl).on("block",U(this,al)))}stop(){U(this,Pc)&&(Q(this,Pc,!1),U(this,sl).off("block",U(this,al)))}pause(e){this.stop()}resume(){this.start()}}sl=new WeakMap,al=new WeakMap,Pc=new WeakMap;var Md,uo;class Lee extends pE{constructor(r,n){super(r);ue(this,Md,void 0);ue(this,uo,void 0);Q(this,Md,n),Q(this,uo,-2)}pause(r){r&&Q(this,uo,-2),super.pause(r)}async _poll(r,n){const i=await n.getBlock(U(this,Md));i!=null&&(U(this,uo)===-2?Q(this,uo,i.number):i.number>U(this,uo)&&(n.emit(U(this,Md),i.number),Q(this,uo,i.number)))}}Md=new WeakMap,uo=new WeakMap;var gy;class jee extends pE{constructor(r,n){super(r);ue(this,gy,void 0);Q(this,gy,l3(n))}async _poll(r,n){throw new Error("@TODO")}}gy=new WeakMap;var Ld;class Uee extends pE{constructor(r,n){super(r);ue(this,Ld,void 0);Q(this,Ld,n)}async _poll(r,n){const i=await n.getTransactionReceipt(U(this,Ld));i&&n.emit(U(this,Ld),i)}}Ld=new WeakMap;var lo,jd,Ud,Tc,Vi,my,LT;class gE{constructor(e,r){ue(this,my);ue(this,lo,void 0);ue(this,jd,void 0);ue(this,Ud,void 0);ue(this,Tc,void 0);ue(this,Vi,void 0);Q(this,lo,e),Q(this,jd,l3(r)),Q(this,Ud,Ee(this,my,LT).bind(this)),Q(this,Tc,!1),Q(this,Vi,-2)}start(){U(this,Tc)||(Q(this,Tc,!0),U(this,Vi)===-2&&U(this,lo).getBlockNumber().then(e=>{Q(this,Vi,e)}),U(this,lo).on("block",U(this,Ud)))}stop(){U(this,Tc)&&(Q(this,Tc,!1),U(this,lo).off("block",U(this,Ud)))}pause(e){this.stop(),e&&Q(this,Vi,-2)}resume(){this.start()}}lo=new WeakMap,jd=new WeakMap,Ud=new WeakMap,Tc=new WeakMap,Vi=new WeakMap,my=new WeakSet,LT=async function(e){if(U(this,Vi)===-2)return;const r=l3(U(this,jd));r.fromBlock=U(this,Vi)+1,r.toBlock=e;const n=await U(this,lo).getLogs(r);if(n.length===0){U(this,Vi){if(n==null)return"null";if(typeof n=="bigint")return`bigint:${n.toString()}`;if(typeof n=="string")return n.toLowerCase();if(typeof n=="object"&&!Array.isArray(n)){const i=Object.keys(n);return i.sort(),i.reduce((s,a)=>(s[a]=n[a],s),{})}return n})}class jT{constructor(e){se(this,"name");ot(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function Hee(t){return JSON.parse(JSON.stringify(t))}function f3(t){return t=Array.from(new Set(t).values()),t.sort(),t}async function Wb(t,e){if(t==null)throw new Error("invalid event");if(Array.isArray(t)&&(t={topics:t}),typeof t=="string")switch(t){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:t,tag:t}}if(er(t,32)){const r=t.toLowerCase();return{type:"transaction",tag:ym("tx",{hash:r}),hash:r}}if(t.orphan){const r=t;return{type:"orphan",tag:ym("orphan",r),filter:Hee(r)}}if(t.address||t.topics){const r=t,n={topics:(r.topics||[]).map(i=>i==null?null:Array.isArray(i)?f3(i.map(s=>s.toLowerCase())):i.toLowerCase())};if(r.address){const i=[],s=[],a=o=>{er(o)?i.push(o):s.push((async()=>{i.push(await jn(o,e))})())};Array.isArray(r.address)?r.address.forEach(a):a(r.address),s.length&&await Promise.all(s),n.address=f3(i.map(o=>o.toLowerCase()))}return{filter:n,tag:ym("event",n),type:"event"}}fe(!1,"unknown ProviderEvent","event",t)}function Gb(){return new Date().getTime()}const Vee={cacheTimeout:250,pollingInterval:4e3};var xn,Nc,bn,$d,gi,ol,Rc,fo,Eg,qi,zd,Hd,In,li,Sg,d3,Ag,h3,cl,$0,Cg,p3,ul,z0,Vd,xm;class qee{constructor(e,r){ue(this,In);ue(this,Sg);ue(this,Ag);ue(this,cl);ue(this,Cg);ue(this,ul);ue(this,Vd);ue(this,xn,void 0);ue(this,Nc,void 0);ue(this,bn,void 0);ue(this,$d,void 0);ue(this,gi,void 0);ue(this,ol,void 0);ue(this,Rc,void 0);ue(this,fo,void 0);ue(this,Eg,void 0);ue(this,qi,void 0);ue(this,zd,void 0);ue(this,Hd,void 0);if(Q(this,Hd,Object.assign({},Vee,r||{})),e==="any")Q(this,ol,!0),Q(this,gi,null);else if(e){const n=ka.from(e);Q(this,ol,!1),Q(this,gi,Promise.resolve(n)),setTimeout(()=>{this.emit("network",n,null)},0)}else Q(this,ol,!1),Q(this,gi,null);Q(this,fo,-1),Q(this,Rc,new Map),Q(this,xn,new Map),Q(this,Nc,new Map),Q(this,bn,null),Q(this,$d,!1),Q(this,Eg,1),Q(this,qi,new Map),Q(this,zd,!1)}get pollingInterval(){return U(this,Hd).pollingInterval}get provider(){return this}get plugins(){return Array.from(U(this,Nc).values())}attachPlugin(e){if(U(this,Nc).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return U(this,Nc).set(e.name,e.connect(this)),this}getPlugin(e){return U(this,Nc).get(e)||null}get disableCcipRead(){return U(this,zd)}set disableCcipRead(e){Q(this,zd,!!e)}async ccipReadFetch(e,r,n){if(this.disableCcipRead||n.length===0||e.to==null)return null;const i=e.to.toLowerCase(),s=r.toLowerCase(),a=[];for(let o=0;o=500,`response not found during CCIP fetch: ${f}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:c,errorMessage:f}}),a.push(f)}Oe(!1,`error encountered during CCIP fetch: ${a.map(o=>JSON.stringify(o)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:n,errorMessages:a}})}_wrapBlock(e,r){return new lee(Iee(e),this)}_wrapLog(e,r){return new Jg(kee(e),this)}_wrapTransactionReceipt(e,r){return new AT(Nee(e),this)}_wrapTransactionResponse(e,r){return new Vp(MT(e),this)}_detectNetwork(){Oe(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){Oe(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=yt(await Ee(this,In,li).call(this,{method:"getBlockNumber"}),"%response");return U(this,fo)>=0&&Q(this,fo,e),e}_getAddress(e){return jn(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(er(e))return er(e,32)?e:$f(e);if(typeof e=="bigint"&&(e=yt(e,"blockTag")),typeof e=="number")return e>=0?$f(e):U(this,fo)>=0?$f(U(this,fo)+e):this.getBlockNumber().then(r=>$f(r+e));fe(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const r=(e.topics||[]).map(c=>c==null?null:Array.isArray(c)?f3(c.map(u=>u.toLowerCase())):c.toLowerCase()),n="blockHash"in e?e.blockHash:void 0,i=(c,u,l)=>{let f;switch(c.length){case 0:break;case 1:f=c[0];break;default:c.sort(),f=c}if(n&&(u!=null||l!=null))throw new Error("invalid filter");const d={};return f&&(d.address=f),r.length&&(d.topics=r),u&&(d.fromBlock=u),l&&(d.toBlock=l),n&&(d.blockHash=n),d};let s=[];if(e.address)if(Array.isArray(e.address))for(const c of e.address)s.push(this._getAddress(c));else s.push(this._getAddress(e.address));let a;"fromBlock"in e&&(a=this._getBlockTag(e.fromBlock));let o;return"toBlock"in e&&(o=this._getBlockTag(e.toBlock)),s.filter(c=>typeof c!="string").length||a!=null&&typeof a!="string"||o!=null&&typeof o!="string"?Promise.all([Promise.all(s),a,o]).then(c=>i(c[0],c[1],c[2])):i(s,a,o)}_getTransactionRequest(e){const r=Rv(e),n=[];if(["to","from"].forEach(i=>{if(r[i]==null)return;const s=jn(r[i],this);M1(s)?n.push(async function(){r[i]=await s}()):r[i]=s}),r.blockTag!=null){const i=this._getBlockTag(r.blockTag);M1(i)?n.push(async function(){r.blockTag=await i}()):r.blockTag=i}return n.length?async function(){return await Promise.all(n),r}():r}async getNetwork(){if(U(this,gi)==null){const i=(async()=>{try{const s=await this._detectNetwork();return this.emit("network",s,null),s}catch(s){throw U(this,gi)===i&&Q(this,gi,null),s}})();return Q(this,gi,i),(await i).clone()}const e=U(this,gi),[r,n]=await Promise.all([e,this._detectNetwork()]);return r.chainId!==n.chainId&&(U(this,ol)?(this.emit("network",n,r),U(this,gi)===e&&Q(this,gi,Promise.resolve(n))):Oe(!1,`network changed: ${r.chainId} => ${n.chainId} `,"NETWORK_ERROR",{event:"changed"})),r.clone()}async getFeeData(){const e=await this.getNetwork(),r=async()=>{const{_block:i,gasPrice:s,priorityFee:a}=await Rn({_block:Ee(this,Cg,p3).call(this,"latest",!1),gasPrice:(async()=>{try{const l=await Ee(this,In,li).call(this,{method:"getGasPrice"});return tt(l,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const l=await Ee(this,In,li).call(this,{method:"getPriorityFee"});return tt(l,"%response")}catch{}return null})()});let o=null,c=null;const u=this._wrapBlock(i,e);return u&&u.baseFeePerGas&&(c=a??BigInt("1000000000"),o=u.baseFeePerGas*$ee+c),new v7(s,o,c)},n=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(n){const i=new su(n.url),s=await n.processFunc(r,this,i);return new v7(s.gasPrice,s.maxFeePerGas,s.maxPriorityFeePerGas)}return await r()}async estimateGas(e){let r=this._getTransactionRequest(e);return M1(r)&&(r=await r),tt(await Ee(this,In,li).call(this,{method:"estimateGas",transaction:r}),"%response")}async call(e){const{tx:r,blockTag:n}=await Rn({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await Ee(this,Ag,h3).call(this,Ee(this,Sg,d3).call(this,r,n,e.enableCcipRead?0:-1))}async getBalance(e,r){return tt(await Ee(this,cl,$0).call(this,{method:"getBalance"},e,r),"%response")}async getTransactionCount(e,r){return yt(await Ee(this,cl,$0).call(this,{method:"getTransactionCount"},e,r),"%response")}async getCode(e,r){return rt(await Ee(this,cl,$0).call(this,{method:"getCode"},e,r))}async getStorage(e,r,n){const i=tt(r,"position");return rt(await Ee(this,cl,$0).call(this,{method:"getStorage",position:i},e,n))}async broadcastTransaction(e){const{blockNumber:r,hash:n,network:i}=await Rn({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),s=Tv.from(e);if(s.hash!==n)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(s,i).replaceableTransaction(r)}async getBlock(e,r){const{network:n,params:i}=await Rn({network:this.getNetwork(),params:Ee(this,Cg,p3).call(this,e,!!r)});return i==null?null:this._wrapBlock(i,n)}async getTransaction(e){const{network:r,params:n}=await Rn({network:this.getNetwork(),params:Ee(this,In,li).call(this,{method:"getTransaction",hash:e})});return n==null?null:this._wrapTransactionResponse(n,r)}async getTransactionReceipt(e){const{network:r,params:n}=await Rn({network:this.getNetwork(),params:Ee(this,In,li).call(this,{method:"getTransactionReceipt",hash:e})});if(n==null)return null;if(n.gasPrice==null&&n.effectiveGasPrice==null){const i=await Ee(this,In,li).call(this,{method:"getTransaction",hash:e});if(i==null)throw new Error("report this; could not find tx or effectiveGasPrice");n.effectiveGasPrice=i.gasPrice}return this._wrapTransactionReceipt(n,r)}async getTransactionResult(e){const{result:r}=await Rn({network:this.getNetwork(),result:Ee(this,In,li).call(this,{method:"getTransactionResult",hash:e})});return r==null?null:rt(r)}async getLogs(e){let r=this._getFilter(e);M1(r)&&(r=await r);const{network:n,params:i}=await Rn({network:this.getNetwork(),params:Ee(this,In,li).call(this,{method:"getLogs",filter:r})});return i.map(s=>this._wrapLog(s,n))}_getProvider(e){Oe(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await Ov.fromName(this,e)}async getAvatar(e){const r=await this.getResolver(e);return r?await r.getAvatar():null}async resolveName(e){const r=await this.getResolver(e);return r?await r.getAddress():null}async lookupAddress(e){e=qt(e);const r=i3(e.substring(2).toLowerCase()+".addr.reverse");try{const n=await Ov.getEnsAddress(this),s=await new ap(n,["function resolver(bytes32) view returns (address)"],this).resolver(r);if(s==null||s===Op)return null;const o=await new ap(s,["function name(bytes32) view returns (string)"],this).name(r);return await this.resolveName(o)!==e?null:o}catch(n){if(Cn(n,"BAD_DATA")&&n.value==="0x"||Cn(n,"CALL_EXCEPTION"))return null;throw n}return null}async waitForTransaction(e,r,n){const i=r??1;return i===0?this.getTransactionReceipt(e):new Promise(async(s,a)=>{let o=null;const c=async u=>{try{const l=await this.getTransactionReceipt(e);if(l!=null&&u-l.blockNumber+1>=i){s(l),o&&(clearTimeout(o),o=null);return}}catch(l){console.log("EEE",l)}this.once("block",c)};n!=null&&(o=setTimeout(()=>{o!=null&&(o=null,this.off("block",c),a(Tr("timeout","TIMEOUT",{reason:"timeout"})))},n)),c(await this.getBlockNumber())})}async waitForBlock(e){Oe(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const r=U(this,qi).get(e);r&&(r.timer&&clearTimeout(r.timer),U(this,qi).delete(e))}_setTimeout(e,r){r==null&&(r=0);const n=Yo(this,Eg)._++,i=()=>{U(this,qi).delete(n),e()};if(this.paused)U(this,qi).set(n,{timer:null,func:i,time:r});else{const s=setTimeout(i,r);U(this,qi).set(n,{timer:s,func:i,time:Gb()})}return n}_forEachSubscriber(e){for(const r of U(this,xn).values())e(r.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new jT(e.type);case"block":{const r=new Mee(this);return r.pollingInterval=this.pollingInterval,r}case"safe":case"finalized":return new Lee(this,e.type);case"event":return new gE(this,e.filter);case"transaction":return new Uee(this,e.hash);case"orphan":return new jee(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,r){for(const n of U(this,xn).values())if(n.subscriber===e){n.started&&n.subscriber.stop(),n.subscriber=r,n.started&&r.start(),U(this,bn)!=null&&r.pause(U(this,bn));break}}async on(e,r){const n=await Ee(this,Vd,xm).call(this,e);return n.listeners.push({listener:r,once:!1}),n.started||(n.subscriber.start(),n.started=!0,U(this,bn)!=null&&n.subscriber.pause(U(this,bn))),this}async once(e,r){const n=await Ee(this,Vd,xm).call(this,e);return n.listeners.push({listener:r,once:!0}),n.started||(n.subscriber.start(),n.started=!0,U(this,bn)!=null&&n.subscriber.pause(U(this,bn))),this}async emit(e,...r){const n=await Ee(this,ul,z0).call(this,e,r);if(!n||n.listeners.length===0)return!1;const i=n.listeners.length;return n.listeners=n.listeners.filter(({listener:s,once:a})=>{const o=new dP(this,a?null:s,e);try{s.call(this,...r,o)}catch{}return!a}),n.listeners.length===0&&(n.started&&n.subscriber.stop(),U(this,xn).delete(n.tag)),i>0}async listenerCount(e){if(e){const n=await Ee(this,ul,z0).call(this,e);return n?n.listeners.length:0}let r=0;for(const{listeners:n}of U(this,xn).values())r+=n.length;return r}async listeners(e){if(e){const n=await Ee(this,ul,z0).call(this,e);return n?n.listeners.map(({listener:i})=>i):[]}let r=[];for(const{listeners:n}of U(this,xn).values())r=r.concat(n.map(({listener:i})=>i));return r}async off(e,r){const n=await Ee(this,ul,z0).call(this,e);if(!n)return this;if(r){const i=n.listeners.map(({listener:s})=>s).indexOf(r);i>=0&&n.listeners.splice(i,1)}return(!r||n.listeners.length===0)&&(n.started&&n.subscriber.stop(),U(this,xn).delete(n.tag)),this}async removeAllListeners(e){if(e){const{tag:r,started:n,subscriber:i}=await Ee(this,Vd,xm).call(this,e);n&&i.stop(),U(this,xn).delete(r)}else for(const[r,{started:n,subscriber:i}]of U(this,xn))n&&i.stop(),U(this,xn).delete(r);return this}async addListener(e,r){return await this.on(e,r)}async removeListener(e,r){return this.off(e,r)}get destroyed(){return U(this,$d)}destroy(){this.removeAllListeners();for(const e of U(this,qi).keys())this._clearTimeout(e);Q(this,$d,!0)}get paused(){return U(this,bn)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(Q(this,fo,-1),U(this,bn)!=null){if(U(this,bn)==!!e)return;Oe(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(r=>r.pause(e)),Q(this,bn,!!e);for(const r of U(this,qi).values())r.timer&&clearTimeout(r.timer),r.time=Gb()-r.time}resume(){if(U(this,bn)!=null){this._forEachSubscriber(e=>e.resume()),Q(this,bn,null);for(const e of U(this,qi).values()){let r=e.time;r<0&&(r=0),e.time=Gb(),setTimeout(e.func,r)}}}}xn=new WeakMap,Nc=new WeakMap,bn=new WeakMap,$d=new WeakMap,gi=new WeakMap,ol=new WeakMap,Rc=new WeakMap,fo=new WeakMap,Eg=new WeakMap,qi=new WeakMap,zd=new WeakMap,Hd=new WeakMap,In=new WeakSet,li=async function(e){const r=U(this,Hd).cacheTimeout;if(r<0)return await this._perform(e);const n=ym(e.method,e);let i=U(this,Rc).get(n);return i||(i=this._perform(e),U(this,Rc).set(n,i),setTimeout(()=>{U(this,Rc).get(n)===i&&U(this,Rc).delete(n)},r)),await i},Sg=new WeakSet,d3=async function(e,r,n){Oe(n=0&&r==="latest"&&i.to!=null&&xr(s.data,0,4)==="0x556f1830"){const a=s.data,o=await jn(i.to,this);let c;try{c=Jee(xr(s.data,4))}catch(f){Oe(!1,f.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:i,info:{data:a}})}Oe(c.sender.toLowerCase()===o.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:a,reason:"OffchainLookup",transaction:i,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:c.errorArgs}});const u=await this.ccipReadFetch(i,c.calldata,c.urls);Oe(u!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:i,info:{data:s.data,errorArgs:c.errorArgs}});const l={to:o,data:Mr([c.selector,Zee([u,c.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:l});try{const f=await Ee(this,Sg,d3).call(this,l,r,n+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},l),result:f}),f}catch(f){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},l),error:f}),f}}throw s}},Ag=new WeakSet,h3=async function(e){const{value:r}=await Rn({network:this.getNetwork(),value:e});return r},cl=new WeakSet,$0=async function(e,r,n){let i=this._getAddress(r),s=this._getBlockTag(n);return(typeof i!="string"||typeof s!="string")&&([i,s]=await Promise.all([i,s])),await Ee(this,Ag,h3).call(this,Ee(this,In,li).call(this,Object.assign(e,{address:i,blockTag:s})))},Cg=new WeakSet,p3=async function(e,r){if(er(e,32))return await Ee(this,In,li).call(this,{method:"getBlock",blockHash:e,includeTransactions:r});let n=this._getBlockTag(e);return typeof n!="string"&&(n=await n),await Ee(this,In,li).call(this,{method:"getBlock",blockTag:n,includeTransactions:r})},ul=new WeakSet,z0=async function(e,r){let n=await Wb(e,this);return n.type==="event"&&r&&r.length>0&&r[0].removed===!0&&(n=await Wb({orphan:"drop-log",log:r[0]},this)),U(this,xn).get(n.tag)||null},Vd=new WeakSet,xm=async function(e){const r=await Wb(e,this),n=r.tag;let i=U(this,xn).get(n);return i||(i={subscriber:this._getSubscriber(r),tag:n,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},U(this,xn).set(n,i)),i};function Kee(t,e){try{const r=g3(t,e);if(r)return Av(r)}catch{}return null}function g3(t,e){if(t==="0x")return null;try{const r=yt(xr(t,e,e+32)),n=yt(xr(t,r,r+32));return xr(t,r+32,r+32+n)}catch{}return null}function C7(t){const e=Mn(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function Wee(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}const Gee=new Uint8Array([]);function Zee(t){const e=[];let r=0;for(let n=0;n=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const r=xr(t,0,32);Oe(xr(r,0,12)===xr(_7,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=xr(r,12);try{const n=[],i=yt(xr(t,32,64)),s=yt(xr(t,i,i+32)),a=xr(t,i+32);for(let o=0;oe[n]),e}function lf(t,e){if(t.provider)return t.provider;Oe(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function k7(t,e){let r=Rv(e);if(r.to!=null&&(r.to=jn(r.to,t)),r.from!=null){const n=r.from;r.from=Promise.all([t.getAddress(),jn(n,t)]).then(([i,s])=>(fe(i.toLowerCase()===s.toLowerCase(),"transaction from mismatch","tx.from",s),i))}else r.from=t.getAddress();return await Rn(r)}class Xee{constructor(e){se(this,"provider");ot(this,{provider:e||null})}async getNonce(e){return lf(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await k7(this,e)}async populateTransaction(e){const r=lf(this,"populateTransaction"),n=await k7(this,e);n.nonce==null&&(n.nonce=await this.getNonce("pending")),n.gasLimit==null&&(n.gasLimit=await this.estimateGas(n));const i=await this.provider.getNetwork();if(n.chainId!=null){const a=tt(n.chainId);fe(a===i.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else n.chainId=i.chainId;const s=n.maxFeePerGas!=null||n.maxPriorityFeePerGas!=null;if(n.gasPrice!=null&&(n.type===2||s)?fe(!1,"eip-1559 transaction do not support gasPrice","tx",e):(n.type===0||n.type===1)&&s&&fe(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(n.type===2||n.type==null)&&n.maxFeePerGas!=null&&n.maxPriorityFeePerGas!=null)n.type=2;else if(n.type===0||n.type===1){const a=await r.getFeeData();Oe(a.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),n.gasPrice==null&&(n.gasPrice=a.gasPrice)}else{const a=await r.getFeeData();if(n.type==null)if(a.maxFeePerGas!=null&&a.maxPriorityFeePerGas!=null)if(n.type=2,n.gasPrice!=null){const o=n.gasPrice;delete n.gasPrice,n.maxFeePerGas=o,n.maxPriorityFeePerGas=o}else n.maxFeePerGas==null&&(n.maxFeePerGas=a.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=a.maxPriorityFeePerGas);else a.gasPrice!=null?(Oe(!s,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),n.gasPrice==null&&(n.gasPrice=a.gasPrice),n.type=0):Oe(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else n.type===2&&(n.maxFeePerGas==null&&(n.maxFeePerGas=a.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=a.maxPriorityFeePerGas))}return await Rn(n)}async estimateGas(e){return lf(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return lf(this,"call").call(await this.populateCall(e))}async resolveName(e){return await lf(this,"resolveName").resolveName(e)}async sendTransaction(e){const r=lf(this,"sendTransaction"),n=await this.populateTransaction(e);delete n.from;const i=Tv.from(n);return await r.broadcastTransaction(await this.signTransaction(i))}}function Qee(t){return JSON.parse(JSON.stringify(t))}var Gn,ga,ll,Dc,fl,qd,_g,m3,kg,v3;class UT{constructor(e){ue(this,_g);ue(this,kg);ue(this,Gn,void 0);ue(this,ga,void 0);ue(this,ll,void 0);ue(this,Dc,void 0);ue(this,fl,void 0);ue(this,qd,void 0);Q(this,Gn,e),Q(this,ga,null),Q(this,ll,Ee(this,_g,m3).bind(this)),Q(this,Dc,!1),Q(this,fl,null),Q(this,qd,!1)}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,r){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}start(){U(this,Dc)||(Q(this,Dc,!0),Ee(this,_g,m3).call(this,-2))}stop(){U(this,Dc)&&(Q(this,Dc,!1),Q(this,qd,!0),Ee(this,kg,v3).call(this),U(this,Gn).off("block",U(this,ll)))}pause(e){e&&Ee(this,kg,v3).call(this),U(this,Gn).off("block",U(this,ll))}resume(){this.start()}}Gn=new WeakMap,ga=new WeakMap,ll=new WeakMap,Dc=new WeakMap,fl=new WeakMap,qd=new WeakMap,_g=new WeakSet,m3=async function(e){try{U(this,ga)==null&&Q(this,ga,this._subscribe(U(this,Gn)));let r=null;try{r=await U(this,ga)}catch(s){if(!Cn(s,"UNSUPPORTED_OPERATION")||s.operation!=="eth_newFilter")throw s}if(r==null){Q(this,ga,null),U(this,Gn)._recoverSubscriber(this,this._recover(U(this,Gn)));return}const n=await U(this,Gn).getNetwork();if(U(this,fl)||Q(this,fl,n),U(this,fl).chainId!==n.chainId)throw new Error("chaid changed");if(U(this,qd))return;const i=await U(this,Gn).send("eth_getFilterChanges",[r]);await this._emitResults(U(this,Gn),i)}catch(r){console.log("@TODO",r)}U(this,Gn).once("block",U(this,ll))},kg=new WeakSet,v3=function(){const e=U(this,ga);e&&(Q(this,ga,null),e.then(r=>{U(this,Gn).send("eth_uninstallFilter",[r])}))};var dl;class Yee extends UT{constructor(r,n){super(r);ue(this,dl,void 0);Q(this,dl,Qee(n))}_recover(r){return new gE(r,U(this,dl))}async _subscribe(r){return await r.send("eth_newFilter",[U(this,dl)])}async _emitResults(r,n){for(const i of n)r.emit(U(this,dl),r._wrapLog(i,r._network))}}dl=new WeakMap;class ete extends UT{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,r){for(const n of r)e.emit("pending",n)}}const tte="bigint,boolean,function,number,string,symbol".split(/,/g);function bm(t){if(t==null||tte.indexOf(typeof t)>=0||typeof t.getAddress=="function")return t;if(Array.isArray(t))return t.map(bm);if(typeof t=="object")return Object.keys(t).reduce((e,r)=>(e[r]=t[r],e),{});throw new Error(`should not happen: ${t} (${typeof t})`)}function rte(t){return new Promise(e=>{setTimeout(e,t)})}function ff(t){return t&&t.toLowerCase()}function B7(t){return t&&typeof t.pollingInterval=="number"}const nte={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class Zb extends Xee{constructor(r,n){super(r);se(this,"address");n=qt(n),ot(this,{address:n})}connect(r){Oe(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(r){return await this.populateCall(r)}async sendUncheckedTransaction(r){const n=bm(r),i=[];if(n.from){const a=n.from;i.push((async()=>{const o=await jn(a,this.provider);fe(o!=null&&o.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",r),n.from=o})())}else n.from=this.address;if(n.gasLimit==null&&i.push((async()=>{n.gasLimit=await this.provider.estimateGas({...n,from:this.address})})()),n.to!=null){const a=n.to;i.push((async()=>{n.to=await jn(a,this.provider)})())}i.length&&await Promise.all(i);const s=this.provider.getRpcTransaction(n);return this.provider.send("eth_sendTransaction",[s])}async sendTransaction(r){const n=await this.provider.getBlockNumber(),i=await this.sendUncheckedTransaction(r);return await new Promise((s,a)=>{const o=[1e3,100];let c=0;const u=async()=>{try{const l=await this.provider.getTransaction(i);if(l!=null){s(l.replaceableTransaction(n));return}}catch(l){if(Cn(l,"CANCELLED")||Cn(l,"BAD_DATA")||Cn(l,"NETWORK_ERROR")){l.info==null&&(l.info={}),l.info.sendTransactionHash=i,a(l);return}if(Cn(l,"INVALID_ARGUMENT")&&(c++,l.info==null&&(l.info={}),l.info.sendTransactionHash=i,c>10)){a(l);return}this.provider.emit("error",Tr("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:l}))}this.provider._setTimeout(()=>{u()},o.pop()||4e3)};u()})}async signTransaction(r){const n=bm(r);if(n.from){const s=await jn(n.from,this.provider);fe(s!=null&&s.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",r),n.from=s}else n.from=this.address;const i=this.provider.getRpcTransaction(n);return await this.provider.send("eth_signTransaction",[i])}async signMessage(r){const n=typeof r=="string"?ko(r):r;return await this.provider.send("personal_sign",[rt(n),this.address.toLowerCase()])}async signTypedData(r,n,i){const s=bm(i),a=await Nv.resolveNames(r,n,s,async o=>{const c=await jn(o);return fe(c!=null,"TypedData does not support null address","value",o),c});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(Nv.getPayload(a.domain,n,a.value))])}async unlock(r){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),r,null])}async _legacySignMessage(r){const n=typeof r=="string"?ko(r):r;return await this.provider.send("eth_sign",[this.address.toLowerCase(),rt(n)])}}var hl,Kd,ho,ma,ks,Ki,Zn,Bg,y3;class ite extends qee{constructor(r,n){super(r,n);ue(this,Bg);ue(this,hl,void 0);ue(this,Kd,void 0);ue(this,ho,void 0);ue(this,ma,void 0);ue(this,ks,void 0);ue(this,Ki,void 0);ue(this,Zn,void 0);Q(this,Kd,1),Q(this,hl,Object.assign({},nte,n||{})),Q(this,ho,[]),Q(this,ma,null),Q(this,Ki,null),Q(this,Zn,null);{let s=null;const a=new Promise(o=>{s=o});Q(this,ks,{promise:a,resolve:s})}const i=this._getOption("staticNetwork");typeof i=="boolean"?(fe(!i||r!=="any","staticNetwork cannot be used on special network 'any'","options",n),i&&r!=null&&Q(this,Ki,ka.from(r))):i&&(fe(r==null||i.matches(r),"staticNetwork MUST match network object","options",n),Q(this,Ki,i))}_getOption(r){return U(this,hl)[r]}get _network(){return Oe(U(this,Ki),"network is not available yet","NETWORK_ERROR"),U(this,Ki)}async _perform(r){if(r.method==="call"||r.method==="estimateGas"){let i=r.transaction;if(i&&i.type!=null&&tt(i.type)&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const s=await this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(r=Object.assign({},r,{transaction:Object.assign({},i,{type:void 0})}))}}const n=this.getRpcRequest(r);return n!=null?await this.send(n.method,n.args):super._perform(r)}async _detectNetwork(){const r=this._getOption("staticNetwork");if(r)if(r===!0){if(U(this,Ki))return U(this,Ki)}else return r;return U(this,Zn)?await U(this,Zn):this.ready?(Q(this,Zn,(async()=>{try{const n=ka.from(tt(await this.send("eth_chainId",[])));return Q(this,Zn,null),n}catch(n){throw Q(this,Zn,null),n}})()),await U(this,Zn)):(Q(this,Zn,(async()=>{const n={id:Yo(this,Kd)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:n});let i;try{i=(await this._send(n))[0],Q(this,Zn,null)}catch(s){throw Q(this,Zn,null),this.emit("debug",{action:"receiveRpcError",error:s}),s}if(this.emit("debug",{action:"receiveRpcResult",result:i}),"result"in i)return ka.from(tt(i.result));throw this.getRpcError(n,i)})()),await U(this,Zn))}_start(){U(this,ks)==null||U(this,ks).resolve==null||(U(this,ks).resolve(),Q(this,ks,null),(async()=>{for(;U(this,Ki)==null&&!this.destroyed;)try{Q(this,Ki,await this._detectNetwork())}catch(r){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",Tr("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:r}})),await rte(1e3)}Ee(this,Bg,y3).call(this)})())}async _waitUntilReady(){if(U(this,ks)!=null)return await U(this,ks).promise}_getSubscriber(r){return r.type==="pending"?new ete(this):r.type==="event"?this._getOption("polling")?new gE(this,r.filter):new Yee(this,r.filter):r.type==="orphan"&&r.filter.orphan==="drop-log"?new jT("orphan"):super._getSubscriber(r)}get ready(){return U(this,ks)==null}getRpcTransaction(r){const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(i=>{if(r[i]==null)return;let s=i;i==="gasLimit"&&(s="gas"),n[s]=$f(tt(r[i],`tx.${i}`))}),["from","to","data"].forEach(i=>{r[i]!=null&&(n[i]=rt(r[i]))}),r.accessList&&(n.accessList=Yl(r.accessList)),n}getRpcRequest(r){switch(r.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[ff(r.address),r.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[ff(r.address),r.blockTag]};case"getCode":return{method:"eth_getCode",args:[ff(r.address),r.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[ff(r.address),"0x"+r.position.toString(16),r.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[r.signedTransaction]};case"getBlock":if("blockTag"in r)return{method:"eth_getBlockByNumber",args:[r.blockTag,!!r.includeTransactions]};if("blockHash"in r)return{method:"eth_getBlockByHash",args:[r.blockHash,!!r.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[r.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[r.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(r.transaction),r.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(r.transaction)]};case"getLogs":return r.filter&&r.filter.address!=null&&(Array.isArray(r.filter.address)?r.filter.address=r.filter.address.map(ff):r.filter.address=ff(r.filter.address)),{method:"eth_getLogs",args:[r.filter]}}return null}getRpcError(r,n){const{method:i}=r,{error:s}=n;if(i==="eth_estimateGas"&&s.message){const c=s.message;if(!c.match(/revert/i)&&c.match(/insufficient funds/i))return Tr("insufficient funds","INSUFFICIENT_FUNDS",{transaction:r.params[0],info:{payload:r,error:s}})}if(i==="eth_call"||i==="eth_estimateGas"){const c=x3(s),u=Hp.getBuiltinCallException(i==="eth_call"?"call":"estimateGas",r.params[0],c?c.data:null);return u.info={error:s,payload:r},u}const a=JSON.stringify(ate(s));if(typeof s.message=="string"&&s.message.match(/user denied|ethers-user-denied/i))return Tr("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[i]||"unknown",reason:"rejected",info:{payload:r,error:s}});if(i==="eth_sendRawTransaction"||i==="eth_sendTransaction"){const c=r.params[0];if(a.match(/insufficient funds|base fee exceeds gas limit/i))return Tr("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:c,info:{error:s}});if(a.match(/nonce/i)&&a.match(/too low/i))return Tr("nonce has already been used","NONCE_EXPIRED",{transaction:c,info:{error:s}});if(a.match(/replacement transaction/i)&&a.match(/underpriced/i))return Tr("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:c,info:{error:s}});if(a.match(/only replay-protected/i))return Tr("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:i,info:{transaction:c,info:{error:s}}})}let o=!!a.match(/the method .* does not exist/i);return o||s&&s.details&&s.details.startsWith("Unauthorized method:")&&(o=!0),o?Tr("unsupported operation","UNSUPPORTED_OPERATION",{operation:r.method,info:{error:s,payload:r}}):Tr("could not coalesce error","UNKNOWN_ERROR",{error:s,payload:r})}send(r,n){if(this.destroyed)return Promise.reject(Tr("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:r}));const i=Yo(this,Kd)._++,s=new Promise((a,o)=>{U(this,ho).push({resolve:a,reject:o,payload:{method:r,params:n,id:i,jsonrpc:"2.0"}})});return Ee(this,Bg,y3).call(this),s}async getSigner(r){r==null&&(r=0);const n=this.send("eth_accounts",[]);if(typeof r=="number"){const s=await n;if(r>=s.length)throw new Error("no such account");return new Zb(this,s[r])}const{accounts:i}=await Rn({network:this.getNetwork(),accounts:n});r=qt(r);for(const s of i)if(qt(s)===r)return new Zb(this,r);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(n=>new Zb(this,n))}destroy(){U(this,ma)&&(clearTimeout(U(this,ma)),Q(this,ma,null));for(const{payload:r,reject:n}of U(this,ho))n(Tr("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:r.method}));Q(this,ho,[]),super.destroy()}}hl=new WeakMap,Kd=new WeakMap,ho=new WeakMap,ma=new WeakMap,ks=new WeakMap,Ki=new WeakMap,Zn=new WeakMap,Bg=new WeakSet,y3=function(){if(U(this,ma))return;const r=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");Q(this,ma,setTimeout(()=>{Q(this,ma,null);const n=U(this,ho);for(Q(this,ho,[]);n.length;){const i=[n.shift()];for(;n.length&&i.length!==U(this,hl).batchMaxCount;)if(i.push(n.shift()),JSON.stringify(i.map(a=>a.payload)).length>U(this,hl).batchMaxSize){n.unshift(i.pop());break}(async()=>{const s=i.length===1?i[0].payload:i.map(a=>a.payload);this.emit("debug",{action:"sendRpcPayload",payload:s});try{const a=await this._send(s);this.emit("debug",{action:"receiveRpcResult",result:a});for(const{resolve:o,reject:c,payload:u}of i){if(this.destroyed){c(Tr("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:u.method}));continue}const l=a.filter(f=>f.id===u.id)[0];if(l==null){const f=Tr("missing response for request","BAD_DATA",{value:a,info:{payload:u}});this.emit("error",f),c(f);continue}if("error"in l){c(this.getRpcError(u,l));continue}o(l.result)}}catch(a){this.emit("debug",{action:"receiveRpcError",error:a});for(const{reject:o}of i)o(a)}})()}},r))};var Oc;class ste extends ite{constructor(r,n){super(r,n);ue(this,Oc,void 0);Q(this,Oc,4e3)}_getSubscriber(r){const n=super._getSubscriber(r);return B7(n)&&(n.pollingInterval=U(this,Oc)),n}get pollingInterval(){return U(this,Oc)}set pollingInterval(r){if(!Number.isInteger(r)||r<0)throw new Error("invalid interval");Q(this,Oc,r),this._forEachSubscriber(n=>{B7(n)&&(n.pollingInterval=U(this,Oc))})}}Oc=new WeakMap;function x3(t){if(t==null)return null;if(typeof t.message=="string"&&t.message.match(/revert/i)&&er(t.data))return{message:t.message,data:t.data};if(typeof t=="object"){for(const e in t){const r=x3(t[e]);if(r)return r}return null}if(typeof t=="string")try{return x3(JSON.parse(t))}catch{}return null}function b3(t,e){if(t!=null){if(typeof t.message=="string"&&e.push(t.message),typeof t=="object")for(const r in t)b3(t[r],e);if(typeof t=="string")try{return b3(JSON.parse(t),e)}catch{}}}function ate(t){const e=[];return b3(t,e),e}var Wd;class ote extends ste{constructor(r,n){fe(r&&r.request,"invalid EIP-1193 provider","ethereum",r);super(n,{batchMaxCount:1});ue(this,Wd,void 0);Q(this,Wd,async(i,s)=>{const a={method:i,params:s};this.emit("debug",{action:"sendEip1193Request",payload:a});try{const o=await r.request(a);return this.emit("debug",{action:"receiveEip1193Result",result:o}),o}catch(o){const c=new Error(o.message);throw c.code=o.code,c.data=o.data,c.payload=a,this.emit("debug",{action:"receiveEip1193Error",error:c}),c}})}async send(r,n){return await this._start(),await super.send(r,n)}async _send(r){fe(!Array.isArray(r),"EIP-1193 does not support batch request","payload",r);try{const n=await U(this,Wd).call(this,r.method,r.params||[]);return[{id:r.id,result:n}]}catch(n){return[{id:r.id,error:{code:n.code,data:n.data,message:n.message}}]}}getRpcError(r,n){switch(n=JSON.parse(JSON.stringify(n)),n.error.code||-1){case 4001:n.error.message=`ethers-user-denied: ${n.error.message}`;break;case 4200:n.error.message=`ethers-unsupported: ${n.error.message}`;break}return super.getRpcError(r,n)}async hasSigner(r){r==null&&(r=0);const n=await this.send("eth_accounts",[]);return typeof r=="number"?n.length>r:(r=r.toLowerCase(),n.filter(i=>i.toLowerCase()===r).length!==0)}async getSigner(r){if(r==null&&(r=0),!await this.hasSigner(r))try{await U(this,Wd).call(this,"eth_requestAccounts",[])}catch(n){const i=n.payload;throw this.getRpcError(i,{id:i.id,error:n})}return await super.getSigner(r)}}Wd=new WeakMap;const C2=async(t,e=!1,r)=>{const{WarpFactory:n,defaultCacheOptions:i}=await A4(()=>import("./web.bundle.min-CJ9rsceU.js"),__vite__mapDeps([])),s=t==="local"?n.forLocal():t==="testnet"?n.forTestnet({...i,...r}):n.forMainnet({...i,...r});if(e){const{DeployPlugin:a}=await zT();s.use(new a)}return s},mE=t=>typeof t!="object"?!1:["n","e","d","p","q","dp","dq","qi"].every(r=>r in t),$T=t=>{if(typeof t!="string")return!1;const e=/^[0-9a-fA-F]{64}$/;return t=t.startsWith("0x")?t.substring(2):t,t.length===64&&e.test(t)};function cte(t){return!(typeof t!="string"||t.length!==43||!/^[A-Za-z0-9_-]+$/.test(t))}const zT=async()=>{if(typeof window<"u"){const{DeployPlugin:t,ArweaveSigner:e,InjectedArweaveSigner:r,InjectedEthereumSigner:n,EthereumSigner:i}=await A4(()=>import("./web.bundle.min-h8pB1Z2N.js"),__vite__mapDeps([]));return{DeployPlugin:t,ArweaveSigner:e,InjectedArweaveSigner:r,InjectedEthereumSigner:n,EthereumSigner:i}}else{const t=await A4(()=>import("./web.bundle.min-h8pB1Z2N.js"),__vite__mapDeps([])),{DeployPlugin:e,ArweaveSigner:r,InjectedArweaveSigner:n,InjectedEthereumSigner:i,EthereumSigner:s}=(t==null?void 0:t.default)||t;return{DeployPlugin:e,ArweaveSigner:r,InjectedArweaveSigner:n,InjectedEthereumSigner:i,EthereumSigner:s}}};async function vE(t,e){var d,p;let r,n;const{ArweaveSigner:i,EthereumSigner:s,InjectedArweaveSigner:a,InjectedEthereumSigner:o}=await zT(),c=mE(t.wallet),u=$T(t.wallet);u&&(t.wallet=t.wallet.startsWith("0x")?t.wallet.substring(2):t.wallet);const l=async()=>{var x,b,S;const h=await window.arweaveWallet.getPermissions(),v=["ACCESS_PUBLIC_KEY","SIGNATURE","SIGN_TRANSACTION"].filter(_=>h.indexOf(_)===-1);(h.length===0||v.length>0)&&await window.arweaveWallet.connect([...h,...v]),(S=(b=(x=t.wallet)==null?void 0:x.namespaces)==null?void 0:b.arweaveWallet)!=null&&S.walletName?r=new a(t.wallet):r=new a(window.arweaveWallet),await r.setPublicKey(),r.getAddress=()=>r.signer.getActiveAddress},f=async()=>{var v;await((v=window.ethereum)==null?void 0:v.request({method:"eth_requestAccounts"}));const h=new ote(window.ethereum),g=await h.getSigner();h.getSigner=()=>g,r=new o(h),await r.setPublicKey(),r.getAddress=()=>g==null?void 0:g.address};if(t.wallet==="use_wallet"){if(typeof window<"u"&&window.arweaveWallet)return n=await e(t.wallet),{wallet:t.wallet,callbackResponse:n};throw new Error("[ArweaveKit] Failed to initialize signer.")}else if(typeof window<"u"&&!c&&!u)if(t.strategy==="arweave"&&window.arweaveWallet)await l();else if(t.strategy==="ethereum"&&window.ethereum&&((d=window.ethereum)!=null&&d.request))await f();else try{if(window.ethereum&&((p=window.ethereum)!=null&&p.request))await f(),n=await e(r);else throw new Error("[ArweaveKit] Ethereum Wallet not found. Trying with Arweave Wallet.")}catch(h){if(console.log(`[ArweaveKit] ${h}`),window.arweaveWallet)await l(),n=await e(r);else throw new Error("[ArweaveKit] Failed to initialize signer.")}else if(t.strategy==="arweave"&&c)r=t.environment==="local"||t!=null&&t.contractTxId?t.wallet:new i(t.wallet);else if(t.strategy==="ethereum"&&u)r=new s(t.wallet);else try{if(u)r=new s(t.wallet),n=await e(r);else throw new Error("[ArweaveKit] Trying with Arweave Signer.")}catch(h){if(console.log(`[ArweaveKit] ${h}`),c)r=t.environment==="local"||t!=null&&t.contractTxId?t.wallet:new i(t.wallet),n=await e(r);else throw new Error("[ArweaveKit] Failed to initialize signer.")}return n||(n=await e(r)),{wallet:r,callbackResponse:n}}function yE(t){typeof window>"u"?t.strategy=mE(t.wallet)?"arweave":$T(t.wallet)?"ethereum":"both":t.strategy=t.strategy||"both"}async function HT(t){let e=400,r="UNSUCCESSFUL";const n=await C2(t.environment,!0);yE(t),t.environment==="local"&&mE(t.wallet)&&await n.testing.addFunds(t.wallet).catch(u=>console.log("ERROR",u.message));const i=async u=>{const l=u==="use_wallet"||t.environment==="local",f={wallet:u,initState:t.initialState,evaluationManifest:t.evaluationManifest,tags:[...t.tags||[],G5],data:t.data};return typeof t.contractSource=="string"&&cte(t.contractSource)?n.deployFromSourceTx({...f,srcTxId:t.contractSource},l):n.deploy({...f,src:t.contractSource},l)},{wallet:s,callbackResponse:a}=await vE(t,i);let o=a==null?void 0:a.contractTxId;const c=n.contract(o).connect(s);return o&&(e=200,r="SUCCESSFUL"),{contract:c,contractTxId:o,result:{status:e,statusText:r}}}async function VT(t){const e=await C2(t.environment,!1,t.cacheOptions);yE(t);let r=400,n="UNSUCCESSFUL";const i=e.contract(t.contractTxId).setEvaluationOptions({...t.evaluationOptions}),s=async c=>(i.connect(c),i.writeInteraction(t.options,{tags:[...t.tags||[],G5],vrf:t.vrf,disableBundling:c==="use_wallet"||t.environment==="local"}));let{callbackResponse:a}=await vE(t,s);const o=await i.readState();return a!=null&&a.originalTxId&&(r=200,n="SUCCESSFUL"),{writeContract:a,state:o.cachedValue.state,result:{status:r,statusText:n}}}async function ute(t){const e=await C2(t.environment,!1,t.cacheOptions);let r=400,n="UNSUCCESSFUL";const s=await e.contract(t.contractTxId).setEvaluationOptions({...t.evaluationOptions}).readState();return s.sortKey&&s.cachedValue&&(r=200,n="SUCCESSFUL"),{readContract:s,result:{status:r,statusText:n}}}async function qT(t){const e=await C2(t.environment,!1,t.cacheOptions);t.connectWallet=t.connectWallet??!0,yE(t);let r=400,n="UNSUCCESSFUL";const i=e.contract(t.contractTxId).setEvaluationOptions({...t.evaluationOptions}),s=async o=>(i.connect(o),await i.viewState({...t.options}));let a;try{if(!t.connectWallet)throw new Error("View state without connecting wallet");({callbackResponse:a}=await vE(t,s))}catch{a=await i.viewState({...t.options})}return a.type==="ok"&&(r=200,n="SUCCESSFUL"),{viewContract:a,result:{status:r,statusText:n}}}async function lte(t){return{contract:await(await fetch(`https://gateway.warp.cc/gateway/contract?txId=${t}`,{method:"GET"})).json()}}async function fte(t){const e=await aP({API_ID:t.apiId}),r=await e.signTransactionWarp({othentFunction:t.othentFunction,data:t.data,tags:[...t.tags||[],G5]}),n=await e.sendTransactionWarp(r);if(n.success)return n;throw new Error("Transaction creation unsuccessful.")}async function dte(t){return await(await aP({API_ID:t.apiId})).readCustomContract({contract_id:t.contractTxId})}oP({createContract:HT,writeContract:VT,readContractState:ute,viewContractState:qT,getContract:lte,writeContractWOthent:fte,readContractWOthent:dte});function KT(){const[t,e]=K.useState(JSON.parse(localStorage.getItem("deployments"))||{});K.useEffect(()=>{t&&localStorage.setItem("deployments",JSON.stringify(t))},[t]);function r(i,s,a,o){console.log("newDeployment",i,s,a);const c={...t,[i]:{txid:s,env:a,functionNames:o}};e(c)}function n(i){const s={...t};delete s[i],e(s)}return{deployments:t,newDeployment:r,removeDeployment:n}}const I7=["not allowed","Allowed-With-Credit","Allowed-With-Indication","Allowed-With-License-Passthrough"],F7=["not allowed","Allowed","Allowed-With-Credit"];function hte(t){const e=/case\s+"([^"]+)"/g,r=t.matchAll(e),n=[];for(const i of r)i[1]!="handle"&&n.push(i[1]);return n}const pte={contractName:"",deployEnv:"local",result:"",usingWebWallet:!1,deploySuccess:!1,walletJWK:void 0,fileName:"",contractTxID:"",derivation:"",commercialUse:"",isError:!1};function gte({contracts:t,target:e,test:r}){const{newDeployment:n}=KT();function i(u){return{...u,contractName:e}}const[s,a]=K.useReducer(o,pte,i);function o(u,l){switch(l.type){case"set_contract_name":return{...u,contractName:l.payload};case"set_env":return{...u,deployEnv:l.payload};case"set_result":return{...u,result:l.payload};case"set_web_wallet":return{...u,usingWebWallet:l.payload};case"set_deploy_success":return{...u,deploySuccess:l.payload};case"set_file":{const f=l.payload,d=new FileReader;return d.onload=()=>{const p=JSON.parse(d.result);a({type:"set_wallet_jwk",payload:p})},d.readAsText(f),{...u,fileName:f.name}}case"set_wallet_jwk":return{...u,walletJWK:l.payload,usingWebWallet:!1};case"set_contract_id":return{...u,contractTxID:l.payload};case"set_derivation":return{...u,derivation:l.payload};case"set_commercial_use":return{...u,commercialUse:l.payload};case"is_error":return{...u,isError:l.payload};case"deploy_another":return{...u,deploySuccess:!1,contractName:"",contractTxID:"",derivation:"",commercialUse:""}}return u}async function c(){if(!s.contractName)return alert("Please select a contract");if(!s.deployEnv)return alert("Please select a deployment environment");if(!s.usingWebWallet&&!s.walletJWK)return alert("Please upload a wallet file");const u=t[s.contractName]["contract.js"],l=t[s.contractName]["state.json"],f=[{name:"App-Name",value:"Better-IDE"},{name:"App-Version",value:"1.0.0"}];s.derivation&&f.push({name:"Derivation",value:s.derivation}),s.commercialUse&&f.push({name:"Commercial-Use",value:s.commercialUse});try{const d=await HT({wallet:s.usingWebWallet?"web_wallet":s.walletJWK,contractSource:u,initialState:l,environment:s.deployEnv,strategy:"arweave",tags:f});console.log(d),a({type:"set_deploy_success",payload:!0}),a({type:"set_contract_id",payload:d.contractTxId}),a({type:"set_result",payload:`Deployed successfully! +ID: `+d.contractTxId}),n(s.contractName,d.contractTxId,s.deployEnv,hte(t[s.contractName]["contract.js"])),a({type:"is_error",payload:!1})}catch(d){console.log(d),a({type:"is_error",payload:!0}),a({type:"set_result",payload:d.toString()}),a({type:"set_deploy_success",payload:!1}),a({type:"set_contract_id",payload:""})}}return s?te.jsx("div",{className:"flex h-full w-full flex-col items-center justify-evenly",children:s.deploySuccess?te.jsxs("div",{className:"flex min-h-[80vh] flex-col items-center justify-center gap-4 text-center",children:[te.jsxs("div",{className:"flex gap-1 text-3xl font-bold",children:[te.jsx(Nr.tick,{height:18,width:18}),"Your contract has been successfully deployed!"]}),te.jsxs("div",{className:"mx-auto flex gap-1",children:["Txn ID: ",s.contractTxID," ",te.jsx(Nr.copy,{height:18,width:18,className:"cursor-pointer",onClick:()=>{navigator.clipboard.writeText(s.contractTxID),alert("Copied to clipboard")}})]}),te.jsx("button",{className:"mx-auto w-fit rounded bg-[#093E49] p-2 px-4",onClick:()=>a({type:"deploy_another"}),children:"Deploy Another"}),te.jsx("button",{className:"mx-auto w-fit rounded bg-[#093E49] p-2 px-4",onClick:()=>r(s.contractName),children:"Test this contract"})]}):te.jsxs("div",{className:"flex w-full grow flex-col justify-center gap-5 overflow-scroll",children:[te.jsx("div",{className:"grow"}),te.jsxs("div",{className:"flex items-center justify-center gap-10",children:[te.jsxs("div",{children:[te.jsx("div",{children:"Select Contract"}),te.jsxs("select",{className:"rounded p-1 ",value:s.contractName,defaultValue:s.contractName,onChange:u=>a({type:"set_contract_name",payload:u.target.value}),children:[te.jsx("option",{value:"",disabled:!0,children:"Select a contract"}),Object.keys(t).map(u=>{if(u!="input")return te.jsx("option",{value:u,children:u})})]})]}),te.jsxs("div",{children:[te.jsx("div",{children:"Select Environment"}),te.jsxs("select",{className:"rounded p-1",value:s.deployEnv,defaultValue:s.deployEnv,onChange:u=>a({type:"set_env",payload:u.target.value}),children:[te.jsx("option",{value:"",disabled:!0,children:"Select an environment"}),te.jsx("option",{value:"local",children:"Local (npx arlocal)"}),te.jsx("option",{value:"testnet",children:"testnet"}),te.jsx("option",{value:"mainnet",children:"Mainnet"})]})]})]}),te.jsxs("div",{className:"flex justify-center gap-4",children:[te.jsxs("div",{className:"p-2 px-4 transition-all duration-200 hover:scale-105 active:scale-95",children:[te.jsx("label",{htmlFor:"wallet",className:"w-fit cursor-pointer rounded bg-[#093E49] p-2 px-4 text-center",children:s.walletJWK?`Imported: ${s.fileName} ✅`:"Import a wallet.json file"}),te.jsx("input",{type:"file",accept:"application/JSON",id:"wallet",className:"hidden",onChange:u=>a({type:"set_file",payload:u.target.files[0]})})]}),te.jsxs("button",{className:"w-fit cursor-pointer rounded bg-[#093E49] p-2 px-4 text-center hover:scale-105 active:scale-95",onClick:()=>{window.arweaveWallet.connect(["ACCESS_ADDRESS","SIGN_TRANSACTION","ACCESS_PUBLIC_KEY","SIGNATURE"]).then(()=>{a({type:"set_web_wallet",payload:!0})}).catch(()=>{a({type:"set_web_wallet",payload:!1}),alert("Error connecting to web wallet")})},children:["Use Web Wallet ",s.usingWebWallet&&"✅"]})]}),te.jsxs("div",{className:"flex flex-col items-center justify-center gap-3",children:[te.jsxs("div",{className:"text-center",children:[te.jsx("span",{className:"text-xl font-bold",children:"Universal Data Licensing"}),te.jsx("br",{}),te.jsx("span",{className:"font-base",children:"Protect the ownership of your content"})]}),te.jsxs("div",{className:"flex gap-10",children:[te.jsxs("div",{children:[te.jsx("div",{children:"License your code"}),te.jsx("select",{className:"rounded p-1",defaultValue:I7[0],onChange:u=>a({type:"set_derivation",payload:u.target.value}),children:I7.map(u=>te.jsx("option",{value:u,children:u}))})]}),te.jsxs("div",{children:[te.jsx("div",{children:"Add a commercial license"}),te.jsx("select",{className:"rounded p-1",defaultValue:F7[0],onChange:u=>a({type:"set_commercial_use",payload:u.target.value}),children:F7.map(u=>te.jsx("option",{value:u,children:u}))})]})]})]}),te.jsx("button",{className:"mx-auto w-fit rounded bg-[#093E49] p-2 px-4",onClick:()=>c(),children:"Deploy! 🚀"}),te.jsx("div",{className:"grow"}),s.result&&te.jsxs("pre",{className:`border-t border-white/20 bg-black/20 p-2 ${s.isError?"text-red-300":"text-green-300"}`,children:["[ Result ]",te.jsx("br",{}),te.jsx("br",{}),s.result]})]})}):te.jsx(te.Fragment,{})}function mte({contracts:t,target:e}){const[r,n]=K.useState(),[i,s]=K.useState("read"),[a,o]=K.useState(""),{deployments:c,removeDeployment:u}=KT(),[l,f]=K.useState(!1),[d,p]=K.useState(""),[h,g]=K.useState("");K.useEffect(()=>{t.setContracts({...t.contracts,input:{"README.md":"This is not a contract. The state.json is used to send arguments to the contract for testing.","state.json":JSON.stringify({name:"ankushKun"}),"contract.js":""}}),e&&n(e)},[]),K.useEffect(()=>{o(""),s("read")},[r]),K.useEffect(()=>{r&&(a.toLowerCase().startsWith("get")?s("read"):a.toLowerCase().startsWith("set")&&s("write"))},[a,r]);async function v(){if(console.log("RRRR"),!r)return alert("Select a deployment");if(!a)return alert("Select a function");if(!i)return alert("Select a call type");if(!t)return alert("No contracts found");const x=t.contracts[r];if(console.log(r,x,t),!x)return alert("No contract found");const b=JSON.parse(t.contracts.input["state.json"]);if(b){if(i=="read")try{const S=await qT({contractTxId:c[r].txid,environment:c[r].env,strategy:"arweave",options:{function:a,...b}});console.log(S),S.result.status==200?(f(!0),g(JSON.stringify({result:S.viewContract.result},null,2)),p(JSON.stringify(S.viewContract.state,null,2))):g(`error: ${S.result.status} +${S.result.statusText} + +${S.viewContract.errorMessage}`)}catch(S){console.log(S),g(`error: ${S}`)}else if(i=="write")try{const S=await VT({contractTxId:c[r].txid,environment:c[r].env,wallet:"use_wallet",strategy:"arweave",options:{function:a,...b},cacheOptions:{inMemory:!0}});console.log(S),S.result.status==200?(f(!0),g(`TXID: ${S.writeContract.originalTxId}`),p(JSON.stringify(S.state,null,2))):g(`error: ${S.result.status} +${S.result.statusText} + +${S.writeContract.errorMessage}`)}catch(S){console.log(S),g(`error: ${S}`)}}}return te.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-5",children:[te.jsxs("div",{className:"w-fit",children:[te.jsx("label",{className:"block text-white",children:"Select a deployment"}),te.jsxs("select",{className:"",defaultValue:e||"none",onChange:x=>n(x.target.value),children:[te.jsx("option",{value:"none",disabled:!0,children:"Select a deployment"}),Object.keys(c).map(x=>te.jsxs("option",{value:x,children:[x," (",c[x].env,"-",c[x].txid,")"]},x))]})]}),te.jsxs("div",{className:"grid w-full grid-cols-2 gap-5 p-5",children:[te.jsxs("div",{className:"flex flex-col gap-1",children:[te.jsx("div",{className:"text-2xl",children:"Call a Function"}),te.jsxs("div",{className:"flex items-center gap-5",children:[te.jsx("div",{children:"Type:"}),te.jsxs("div",{className:"flex items-center gap-1",children:[te.jsx("input",{type:"radio",name:"calltype",id:"read",value:"read",checked:i=="read",onClick:()=>s("read")}),te.jsx("label",{htmlFor:"read",children:"Read"})]}),te.jsxs("div",{className:"flex items-center gap-1",children:[te.jsx("input",{type:"radio",name:"calltype",id:"write",value:"write",checked:i=="write",onClick:()=>s("write")}),te.jsx("label",{htmlFor:"write",children:"Write"})]})]}),te.jsx("div",{className:"mt-5 text-lg",children:"Function Name"}),te.jsxs("select",{className:"",defaultValue:"none",onChange:x=>o(x.target.value),children:[te.jsx("option",{value:"none",disabled:!0,children:"Select a function"}),r&&c[r].functionNames.map(x=>te.jsx("option",{value:x,children:x},x))]}),te.jsx("div",{className:"h-full w-full overflow-clip rounded p-0.5 ring-1 ring-white/20",children:te.jsx("iframe",{className:"h-full w-full rounded",src:"/betterIDE?editor&language=json&file=input/state.json"})}),te.jsx("button",{className:"my-5 w-fit rounded-md bg-green-500 p-1 px-4 text-black hover:scale-105 active:scale-95",onClick:v,children:"RUN"})]}),te.jsxs("div",{className:"flex flex-col gap-1",children:[te.jsx("div",{className:"text-2xl",children:"Output"}),te.jsx("div",{children:"Result"}),te.jsx("pre",{className:`overflow-scroll rounded bg-white/10 p-1 ${l?"text-green-400":"text-red-400"}`,children:h||"..."}),te.jsx("div",{children:"Latest State"}),te.jsx("pre",{className:"overflow-scroll rounded bg-white/10 p-1",children:d||"..."})]})]})]})}function WT(){const t=u5(),e=Wo(),{appMode:r,activeSideNavItem:n,activeFile:i,activeContract:s}=Kl(h=>h.app),[a,o]=K.useState(!0),[c,u]=K.useState("");function l(h){e(Oo(h))}function f(h){e(Uy(h))}const d=[{text:"Home",icon:Nr.home,onClick:()=>{l("Home"),f("")}},{text:"Contracts",icon:Nr.projects,onClick:()=>{o(!a)}},{text:"Deploy",icon:Nr.deploy,onClick:()=>{l("Deploy"),f("")}},{text:"Test",icon:Nr.test,onClick:()=>{l("Test"),f("")}},{text:"Cloud",icon:Nr.executeCode,onClick:()=>{l("Cloud"),f("")}},{text:"Showcase",icon:Nr.plugins,onClick:()=>{l("Showcase"),f("")}}];K.useEffect(()=>{o(!1)},[r]);function p(){switch(n){case"Contracts":return te.jsx("iframe",{className:"w-full h-full",src:`/?editor&language=${i.endsWith(".js")?"javascript":i.endsWith(".json")?"json":i.endsWith(".md")?"markdown":"text"}&file=${s}/${i}`});case"Deploy":return te.jsx(gte,{contracts:t.contracts,target:s,test:h=>{l("Test"),u(h)}});case"Test":return te.jsx(mte,{contracts:t,target:c});case"Cloud":return te.jsx(gz,{});case"Showcase":return te.jsx(mz,{});case"Settings":return te.jsx(hI,{});default:return te.jsx(Sz,{contracts:t})}}return te.jsxs("div",{className:"flex flex-col min-h-screen h-screen max-h-screen",children:[te.jsx(cI,{children:s&&te.jsxs("div",{className:"flex items-center rounded-lg gap-2 mx-4",children:[te.jsx(Tx,{filename:"README.md"}),te.jsx(Tx,{filename:"contract.js"}),te.jsx(Tx,{filename:"state.json"})]})}),te.jsxs("div",{className:"grow flex",children:[te.jsx(lI,{items:d}),a&&te.jsxs("div",{className:"min-w-[150px] border-r border-white/30 bg-[#171717]",children:[t.contracts&&Object.keys(t.contracts).map((h,g)=>{if(h!="input")return te.jsx(vte,{contractName:h},g)}),te.jsx("div",{className:"p-2 cursor-pointer hover:bg-[#2f2f2f]",onClick:()=>t.newContract(),children:"+ new"})]}),te.jsx("div",{className:"grow bg-[#1d1d1d]",children:p()})]})]})}function vte({contractName:t}){const e=u5(),r=Wo(),{activeFile:n,activeContract:i}=Kl(l=>l.app);function s(l){r(Oo(l))}function a(l){r(Uy(l))}function o(l){r(oI(l===i?"":l))}const c=i==t;function u({name:l}){return te.jsx("div",{className:`p-1 pl-5 cursor-pointer hover:bg-white/10 ${n==l&&"font-bold bg-white/10"}`,onClick:()=>{a(l),s("Contracts")},children:l})}return te.jsxs("div",{className:si("w-full max-w-[150px] overflow-scroll cursor-pointer hover:bg-[#2f2f2f]",i==t&&"bg-white/10"),children:[te.jsx("div",{className:"w-full p-2 font-bold",onClick:()=>{o(t),a("README.md"),s("Contracts");const l=localStorage.getItem("recents");if(l){const f=JSON.parse(l);f.includes(t)?f.splice(f.indexOf(t),1):f.length>4&&f.pop(),f.unshift(t),localStorage.setItem("recents",JSON.stringify(f))}else localStorage.setItem("recents",JSON.stringify([t]))},children:t}),c&&te.jsxs("div",{className:"w-full flex flex-col",children:[te.jsx(u,{name:"README.md"}),te.jsx(u,{name:"contract.js"}),te.jsx(u,{name:"state.json"}),te.jsxs("div",{className:"flex flex-col justify-evenly",children:[te.jsxs("button",{className:"flex items-center justify-start gap-2 py-1 pl-2 hover:bg-zinc-300/50",onClick:()=>{o(t),s("Deploy")},children:[te.jsx(Nr.deploy,{height:16,width:16}),"deploy"]}),te.jsxs("button",{className:"flex items-center justify-start gap-2 py-1 pl-2 hover:bg-zinc-300/50",onClick:()=>{const l=new cj,f=l.folder(t),d=e.contracts[t];Object.keys(d).forEach(p=>{f==null||f.file(p,d[p])}),l.generateAsync({type:"blob"}).then(function(p){lj(p,t+".zip")})},children:[te.jsx(Nr.download,{height:16,width:16}),"download zip"]}),te.jsxs("button",{className:"flex items-center justify-start gap-2 py-1 pl-2 hover:bg-zinc-300/50",onClick:()=>{e.deleteContract(t);const l=JSON.parse(localStorage.getItem("recents"))||[];l.includes(t)&&(l.splice(l.indexOf(t),1),localStorage.setItem("recents",JSON.stringify(l)))},children:[te.jsx(Nr.delete,{height:16,width:16}),"delete"]})]})]})]})}function yte(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function P7(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function T7(t){for(var e=1;e=0)&&(r[i]=t[i]);return r}function bte(t,e){if(t==null)return{};var r=xte(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function wte(t,e){return Ete(t)||Ste(t,e)||Ate(t,e)||Cte()}function Ete(t){if(Array.isArray(t))return t}function Ste(t,e){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(t)))){var r=[],n=!0,i=!1,s=void 0;try{for(var a=t[Symbol.iterator](),o;!(n=(o=a.next()).done)&&(r.push(o.value),!(e&&r.length===e));n=!0);}catch(c){i=!0,s=c}finally{try{!n&&a.return!=null&&a.return()}finally{if(i)throw s}}return r}}function Ate(t,e){if(t){if(typeof t=="string")return N7(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return N7(t,e)}}function N7(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=t.length?t.apply(this,i):function(){for(var a=arguments.length,o=new Array(a),c=0;c1&&arguments[1]!==void 0?arguments[1]:{};L1.initial(t),L1.handler(e);var r={current:t},n=H0(jte)(r,e),i=H0(Lte)(r),s=H0(L1.changes)(t),a=H0(Mte)(r);function o(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(l){return l};return L1.selector(u),u(r.current)}function c(u){kte(n,i,s,a)(u)}return[o,c]}function Mte(t,e){return qp(e)?e(t.current):e}function Lte(t,e){return t.current=D7(D7({},t.current),e),e}function jte(t,e,r){return qp(e)?e(t.current):Object.keys(r).forEach(function(n){var i;return(i=e[n])===null||i===void 0?void 0:i.call(e,t.current[n])}),r}var Ute={create:Ote},$te={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function zte(t){return function e(){for(var r=this,n=arguments.length,i=new Array(n),s=0;s=t.length?t.apply(this,i):function(){for(var a=arguments.length,o=new Array(a),c=0;c{n.current=!1}:t,e)}var Ei=hre;function op(){}function zf(t,e,r,n){return pre(t,n)||gre(t,e,r,n)}function pre(t,e){return t.editor.getModel(YT(t,e))}function gre(t,e,r,n){return t.editor.createModel(e,r,n?YT(t,n):void 0)}function YT(t,e){return t.Uri.parse(e)}function mre({original:t,modified:e,language:r,originalLanguage:n,modifiedLanguage:i,originalModelPath:s,modifiedModelPath:a,keepCurrentOriginalModel:o=!1,keepCurrentModifiedModel:c=!1,theme:u="light",loading:l="Loading...",options:f={},height:d="100%",width:p="100%",className:h,wrapperProps:g={},beforeMount:v=op,onMount:x=op}){let[b,S]=K.useState(!1),[_,P]=K.useState(!0),C=K.useRef(null),B=K.useRef(null),N=K.useRef(null),T=K.useRef(x),D=K.useRef(v),R=K.useRef(!1);xE(()=>{let I=Lv.init();return I.then(j=>(B.current=j)&&P(!1)).catch(j=>(j==null?void 0:j.type)!=="cancelation"&&console.error("Monaco initialization: error:",j)),()=>C.current?A():I.cancel()}),Ei(()=>{if(C.current&&B.current){let I=C.current.getOriginalEditor(),j=zf(B.current,t||"",n||r||"text",s||"");j!==I.getModel()&&I.setModel(j)}},[s],b),Ei(()=>{if(C.current&&B.current){let I=C.current.getModifiedEditor(),j=zf(B.current,e||"",i||r||"text",a||"");j!==I.getModel()&&I.setModel(j)}},[a],b),Ei(()=>{let I=C.current.getModifiedEditor();I.getOption(B.current.editor.EditorOption.readOnly)?I.setValue(e||""):e!==I.getValue()&&(I.executeEdits("",[{range:I.getModel().getFullModelRange(),text:e||"",forceMoveMarkers:!0}]),I.pushUndoStop())},[e],b),Ei(()=>{var I,j;(j=(I=C.current)==null?void 0:I.getModel())==null||j.original.setValue(t||"")},[t],b),Ei(()=>{let{original:I,modified:j}=C.current.getModel();B.current.editor.setModelLanguage(I,n||r||"text"),B.current.editor.setModelLanguage(j,i||r||"text")},[r,n,i],b),Ei(()=>{var I;(I=B.current)==null||I.editor.setTheme(u)},[u],b),Ei(()=>{var I;(I=C.current)==null||I.updateOptions(f)},[f],b);let E=K.useCallback(()=>{var $;if(!B.current)return;D.current(B.current);let I=zf(B.current,t||"",n||r||"text",s||""),j=zf(B.current,e||"",i||r||"text",a||"");($=C.current)==null||$.setModel({original:I,modified:j})},[r,e,i,t,n,s,a]),F=K.useCallback(()=>{var I;!R.current&&N.current&&(C.current=B.current.editor.createDiffEditor(N.current,{automaticLayout:!0,...f}),E(),(I=B.current)==null||I.editor.setTheme(u),S(!0),R.current=!0)},[f,u,E]);K.useEffect(()=>{b&&T.current(C.current,B.current)},[b]),K.useEffect(()=>{!_&&!b&&F()},[_,b,F]);function A(){var j,$,W,H;let I=(j=C.current)==null?void 0:j.getModel();o||(($=I==null?void 0:I.original)==null||$.dispose()),c||((W=I==null?void 0:I.modified)==null||W.dispose()),(H=C.current)==null||H.dispose()}return jr.createElement(QT,{width:p,height:d,isEditorReady:b,loading:l,_ref:N,className:h,wrapperProps:g})}var vre=mre;K.memo(vre);function yre(){let[t,e]=K.useState(Lv.__getMonacoInstance());return xE(()=>{let r;return t||(r=Lv.init(),r.then(n=>{e(n)})),()=>r==null?void 0:r.cancel()}),t}var eN=yre;function xre(t){let e=K.useRef();return K.useEffect(()=>{e.current=t},[t]),e.current}var bre=xre,j1=new Map;function wre({defaultValue:t,defaultLanguage:e,defaultPath:r,value:n,language:i,path:s,theme:a="light",line:o,loading:c="Loading...",options:u={},overrideServices:l={},saveViewState:f=!0,keepCurrentModel:d=!1,width:p="100%",height:h="100%",className:g,wrapperProps:v={},beforeMount:x=op,onMount:b=op,onChange:S,onValidate:_=op}){let[P,C]=K.useState(!1),[B,N]=K.useState(!0),T=K.useRef(null),D=K.useRef(null),R=K.useRef(null),E=K.useRef(b),F=K.useRef(x),A=K.useRef(),I=K.useRef(n),j=bre(s),$=K.useRef(!1),W=K.useRef(!1);xE(()=>{let L=Lv.init();return L.then(q=>(T.current=q)&&N(!1)).catch(q=>(q==null?void 0:q.type)!=="cancelation"&&console.error("Monaco initialization: error:",q)),()=>D.current?O():L.cancel()}),Ei(()=>{var q,ee,X,ae;let L=zf(T.current,t||n||"",e||i||"",s||r||"");L!==((q=D.current)==null?void 0:q.getModel())&&(f&&j1.set(j,(ee=D.current)==null?void 0:ee.saveViewState()),(X=D.current)==null||X.setModel(L),f&&((ae=D.current)==null||ae.restoreViewState(j1.get(s))))},[s],P),Ei(()=>{var L;(L=D.current)==null||L.updateOptions(u)},[u],P),Ei(()=>{!D.current||n===void 0||(D.current.getOption(T.current.editor.EditorOption.readOnly)?D.current.setValue(n):n!==D.current.getValue()&&(W.current=!0,D.current.executeEdits("",[{range:D.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),D.current.pushUndoStop(),W.current=!1))},[n],P),Ei(()=>{var q,ee;let L=(q=D.current)==null?void 0:q.getModel();L&&i&&((ee=T.current)==null||ee.editor.setModelLanguage(L,i))},[i],P),Ei(()=>{var L;o!==void 0&&((L=D.current)==null||L.revealLine(o))},[o],P),Ei(()=>{var L;(L=T.current)==null||L.editor.setTheme(a)},[a],P);let H=K.useCallback(()=>{var L;if(!(!R.current||!T.current)&&!$.current){F.current(T.current);let q=s||r,ee=zf(T.current,n||t||"",e||i||"",q||"");D.current=(L=T.current)==null?void 0:L.editor.create(R.current,{model:ee,automaticLayout:!0,...u},l),f&&D.current.restoreViewState(j1.get(q)),T.current.editor.setTheme(a),o!==void 0&&D.current.revealLine(o),C(!0),$.current=!0}},[t,e,r,n,i,s,u,l,f,a,o]);K.useEffect(()=>{P&&E.current(D.current,T.current)},[P]),K.useEffect(()=>{!B&&!P&&H()},[B,P,H]),I.current=n,K.useEffect(()=>{var L,q;P&&S&&((L=A.current)==null||L.dispose(),A.current=(q=D.current)==null?void 0:q.onDidChangeModelContent(ee=>{W.current||S(D.current.getValue(),ee)}))},[P,S]),K.useEffect(()=>{if(P){let L=T.current.editor.onDidChangeMarkers(q=>{var X;let ee=(X=D.current.getModel())==null?void 0:X.uri;if(ee&&q.find(ae=>ae.path===ee.path)){let ae=T.current.editor.getModelMarkers({resource:ee});_==null||_(ae)}});return()=>{L==null||L.dispose()}}return()=>{}},[P,_]);function O(){var L,q;(L=A.current)==null||L.dispose(),d?f&&j1.set(s,D.current.saveViewState()):(q=D.current.getModel())==null||q.dispose(),D.current.dispose()}return jr.createElement(QT,{width:p,height:h,isEditorReady:P,loading:c,_ref:R,className:g,wrapperProps:v})}var Ere=wre,tN=K.memo(Ere);const Sre="vs-dark",Are=!0,Cre=[{background:"1a1a1a",token:""},{foreground:"696969",fontStyle:"italic",token:"comment"},{foreground:"fc6f09",token:"keyword"},{foreground:"fc6f09",token:"storage"},{foreground:"fc83ff",token:"entity.other.inherited-class"},{foreground:"58c554",token:"constant.numeric"},{foreground:"1edafb",token:"constant"},{foreground:"8dff0a",token:"constant.library"},{foreground:"fc6f09",token:"support.function"},{foreground:"fdc251",token:"constant.language"},{foreground:"8dff0a",token:"string"},{foreground:"1edafb",token:"support.type"},{foreground:"8dff0a",token:"support.constant"},{foreground:"fc6f09",token:"meta.tag"},{foreground:"fc6f09",token:"declaration.tag"},{foreground:"fc6f09",token:"entity.name.tag"},{foreground:"ffff89",token:"entity.other.attribute-name"},{foreground:"ffffff",background:"990000",token:"invalid"},{foreground:"519f50",token:"constant.character.escaped"},{foreground:"519f50",token:"constant.character.escape"},{foreground:"519f50",token:"string source"},{foreground:"519f50",token:"string source.ruby"},{foreground:"e6e1dc",background:"144212",token:"markup.inserted"},{foreground:"e6e1dc",background:"660000",token:"markup.deleted"},{background:"2f33ab",token:"meta.diff.header"},{background:"2f33ab",token:"meta.separator.diff"},{background:"2f33ab",token:"meta.diff.index"},{background:"2f33ab",token:"meta.diff.range"}],_re={"editor.foreground":"#a4b1cd","editor.background":"#1a1a1a","editor.selectionBackground":"#454545","editor.lineHighlightBackground":"#333435","editorCursor.foreground":"#FFFFFF","editorWhitespace.foreground":"#404040"},kre={base:Sre,inherit:Are,rules:Cre,colors:_re};function rN(){const[t]=Ry(),{contracts:e,setContracts:r}=u5(),[n,i]=K.useState(""),s=eN();s==null||s.editor.defineTheme("code",kre);const a=t.get("file").split("/"),o=a[0],c=a[1];return K.useEffect(()=>{if(!e)return;const u=JSON.parse(localStorage.getItem("contracts")||"{}"),l=u[o][c];r(u),i(l)},[]),K.useEffect(()=>{if(!n)return;const u={...e};u[o][c]=n,r(u)},[n]),te.jsx(tN,{height:"100vh",language:t.get("language"),theme:"code",defaultValue:n,onChange:u=>{i(u)}})}function nN(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;etypeof t=="boolean"?"".concat(t):t===0?"0":t,L7=Bre,Ire=(t,e)=>r=>{var n;if((e==null?void 0:e.variants)==null)return L7(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:i,defaultVariants:s}=e,a=Object.keys(i).map(u=>{const l=r==null?void 0:r[u],f=s==null?void 0:s[u];if(l===null)return null;const d=M7(l)||M7(f);return i[u][d]}),o=r&&Object.entries(r).reduce((u,l)=>{let[f,d]=l;return d===void 0||(u[f]=d),u},{}),c=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((u,l)=>{let{class:f,className:d,...p}=l;return Object.entries(p).every(h=>{let[g,v]=h;return Array.isArray(v)?v.includes({...s,...o}[g]):{...s,...o}[g]===v})?[...u,f,d]:u},[]);return L7(t,a,c,r==null?void 0:r.class,r==null?void 0:r.className)},Fre=Ire("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Eo=K.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...i},s)=>{const a=n?oh:"button";return te.jsx(a,{className:si(Fre({variant:e,size:r,className:t})),ref:s,...i})});Eo.displayName="Button";const bE=JSON,Pre=t=>t.toUpperCase(),Tre=t=>{const e={};return t.forEach((r,n)=>{e[n]=r}),e},Nre=(t,e,r)=>t.document?t:{document:t,variables:e,requestHeaders:r,signal:void 0},Rre=(t,e,r)=>t.query?t:{query:t,variables:e,requestHeaders:r,signal:void 0},Dre=(t,e)=>t.documents?t:{documents:t,requestHeaders:e,signal:void 0};function wm(t,e){if(!!!t)throw new Error(e)}function Ore(t){return typeof t=="object"&&t!==null}function Mre(t,e){if(!!!t)throw new Error(e??"Unexpected invariant triggered.")}const Lre=/\r\n|[\n\r]/g;function w3(t,e){let r=0,n=1;for(const i of t.body.matchAll(Lre)){if(typeof i.index=="number"||Mre(!1),i.index>=e)break;r=i.index+i[0].length,n+=1}return{line:n,column:e+1-r}}function jre(t){return iN(t.source,w3(t.source,t.start))}function iN(t,e){const r=t.locationOffset.column-1,n="".padStart(r)+t.body,i=e.line-1,s=t.locationOffset.line-1,a=e.line+s,o=e.line===1?r:0,c=e.column+o,u=`${t.name}:${a}:${c} +`,l=n.split(/\r\n|[\n\r]/g),f=l[i];if(f.length>120){const d=Math.floor(c/80),p=c%80,h=[];for(let g=0;g["|",g]),["|","^".padStart(p)],["|",h[d+1]]])}return u+j7([[`${a-1} |`,l[i-1]],[`${a} |`,f],["|","^".padStart(c)],[`${a+1} |`,l[i+1]]])}function j7(t){const e=t.filter(([n,i])=>i!==void 0),r=Math.max(...e.map(([n])=>n.length));return e.map(([n,i])=>n.padStart(r)+(i?" "+i:"")).join(` +`)}function Ure(t){const e=t[0];return e==null||"kind"in e||"length"in e?{nodes:e,source:t[1],positions:t[2],path:t[3],originalError:t[4],extensions:t[5]}:e}class wE extends Error{constructor(e,...r){var n,i,s;const{nodes:a,source:o,positions:c,path:u,originalError:l,extensions:f}=Ure(r);super(e),this.name="GraphQLError",this.path=u??void 0,this.originalError=l??void 0,this.nodes=U7(Array.isArray(a)?a:a?[a]:void 0);const d=U7((n=this.nodes)===null||n===void 0?void 0:n.map(h=>h.loc).filter(h=>h!=null));this.source=o??(d==null||(i=d[0])===null||i===void 0?void 0:i.source),this.positions=c??(d==null?void 0:d.map(h=>h.start)),this.locations=c&&o?c.map(h=>w3(o,h)):d==null?void 0:d.map(h=>w3(h.source,h.start));const p=Ore(l==null?void 0:l.extensions)?l==null?void 0:l.extensions:void 0;this.extensions=(s=f??p)!==null&&s!==void 0?s:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),l!=null&&l.stack?Object.defineProperty(this,"stack",{value:l.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,wE):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const r of this.nodes)r.loc&&(e+=` + +`+jre(r.loc));else if(this.source&&this.locations)for(const r of this.locations)e+=` + +`+iN(this.source,r);return e}toJSON(){const e={message:this.message};return this.locations!=null&&(e.locations=this.locations),this.path!=null&&(e.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function U7(t){return t===void 0||t.length===0?void 0:t}function Qr(t,e,r){return new wE(`Syntax Error: ${r}`,{source:t,positions:[e]})}class $re{constructor(e,r,n){this.start=e.start,this.end=r.end,this.startToken=e,this.endToken=r,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class sN{constructor(e,r,n,i,s,a){this.kind=e,this.start=r,this.end=n,this.line=i,this.column=s,this.value=a,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const aN={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},zre=new Set(Object.keys(aN));function $7(t){const e=t==null?void 0:t.kind;return typeof e=="string"&&zre.has(e)}var Hf;(function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"})(Hf||(Hf={}));var E3;(function(t){t.QUERY="QUERY",t.MUTATION="MUTATION",t.SUBSCRIPTION="SUBSCRIPTION",t.FIELD="FIELD",t.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",t.FRAGMENT_SPREAD="FRAGMENT_SPREAD",t.INLINE_FRAGMENT="INLINE_FRAGMENT",t.VARIABLE_DEFINITION="VARIABLE_DEFINITION",t.SCHEMA="SCHEMA",t.SCALAR="SCALAR",t.OBJECT="OBJECT",t.FIELD_DEFINITION="FIELD_DEFINITION",t.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",t.INTERFACE="INTERFACE",t.UNION="UNION",t.ENUM="ENUM",t.ENUM_VALUE="ENUM_VALUE",t.INPUT_OBJECT="INPUT_OBJECT",t.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"})(E3||(E3={}));var ut;(function(t){t.NAME="Name",t.DOCUMENT="Document",t.OPERATION_DEFINITION="OperationDefinition",t.VARIABLE_DEFINITION="VariableDefinition",t.SELECTION_SET="SelectionSet",t.FIELD="Field",t.ARGUMENT="Argument",t.FRAGMENT_SPREAD="FragmentSpread",t.INLINE_FRAGMENT="InlineFragment",t.FRAGMENT_DEFINITION="FragmentDefinition",t.VARIABLE="Variable",t.INT="IntValue",t.FLOAT="FloatValue",t.STRING="StringValue",t.BOOLEAN="BooleanValue",t.NULL="NullValue",t.ENUM="EnumValue",t.LIST="ListValue",t.OBJECT="ObjectValue",t.OBJECT_FIELD="ObjectField",t.DIRECTIVE="Directive",t.NAMED_TYPE="NamedType",t.LIST_TYPE="ListType",t.NON_NULL_TYPE="NonNullType",t.SCHEMA_DEFINITION="SchemaDefinition",t.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",t.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",t.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",t.FIELD_DEFINITION="FieldDefinition",t.INPUT_VALUE_DEFINITION="InputValueDefinition",t.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",t.UNION_TYPE_DEFINITION="UnionTypeDefinition",t.ENUM_TYPE_DEFINITION="EnumTypeDefinition",t.ENUM_VALUE_DEFINITION="EnumValueDefinition",t.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",t.DIRECTIVE_DEFINITION="DirectiveDefinition",t.SCHEMA_EXTENSION="SchemaExtension",t.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",t.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",t.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",t.UNION_TYPE_EXTENSION="UnionTypeExtension",t.ENUM_TYPE_EXTENSION="EnumTypeExtension",t.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"})(ut||(ut={}));function S3(t){return t===9||t===32}function Kp(t){return t>=48&&t<=57}function oN(t){return t>=97&&t<=122||t>=65&&t<=90}function cN(t){return oN(t)||t===95}function Hre(t){return oN(t)||Kp(t)||t===95}function Vre(t){var e;let r=Number.MAX_SAFE_INTEGER,n=null,i=-1;for(let a=0;ao===0?a:a.slice(r)).slice((e=n)!==null&&e!==void 0?e:0,i+1)}function qre(t){let e=0;for(;e1&&n.slice(1).every(p=>p.length===0||S3(p.charCodeAt(0))),a=r.endsWith('\\"""'),o=t.endsWith('"')&&!a,c=t.endsWith("\\"),u=o||c,l=!(e!=null&&e.minimize)&&(!i||t.length>70||u||s||a);let f="";const d=i&&S3(t.charCodeAt(0));return(l&&!d||s)&&(f+=` +`),f+=r,(l||u)&&(f+=` +`),'"""'+f+'"""'}var Ie;(function(t){t.SOF="",t.EOF="",t.BANG="!",t.DOLLAR="$",t.AMP="&",t.PAREN_L="(",t.PAREN_R=")",t.SPREAD="...",t.COLON=":",t.EQUALS="=",t.AT="@",t.BRACKET_L="[",t.BRACKET_R="]",t.BRACE_L="{",t.PIPE="|",t.BRACE_R="}",t.NAME="Name",t.INT="Int",t.FLOAT="Float",t.STRING="String",t.BLOCK_STRING="BlockString",t.COMMENT="Comment"})(Ie||(Ie={}));class Wre{constructor(e){const r=new sN(Ie.SOF,0,0,0,0);this.source=e,this.lastToken=r,this.token=r,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==Ie.EOF)do if(e.next)e=e.next;else{const r=Zre(this,e.end);e.next=r,r.prev=e,e=r}while(e.kind===Ie.COMMENT);return e}}function Gre(t){return t===Ie.BANG||t===Ie.DOLLAR||t===Ie.AMP||t===Ie.PAREN_L||t===Ie.PAREN_R||t===Ie.SPREAD||t===Ie.COLON||t===Ie.EQUALS||t===Ie.AT||t===Ie.BRACKET_L||t===Ie.BRACKET_R||t===Ie.BRACE_L||t===Ie.PIPE||t===Ie.BRACE_R}function Qh(t){return t>=0&&t<=55295||t>=57344&&t<=1114111}function k2(t,e){return uN(t.charCodeAt(e))&&lN(t.charCodeAt(e+1))}function uN(t){return t>=55296&&t<=56319}function lN(t){return t>=56320&&t<=57343}function Ll(t,e){const r=t.source.body.codePointAt(e);if(r===void 0)return Ie.EOF;if(r>=32&&r<=126){const n=String.fromCodePoint(r);return n==='"'?`'"'`:`"${n}"`}return"U+"+r.toString(16).toUpperCase().padStart(4,"0")}function Fr(t,e,r,n,i){const s=t.line,a=1+r-t.lineStart;return new sN(e,r,n,s,a,i)}function Zre(t,e){const r=t.source.body,n=r.length;let i=e;for(;i=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function tne(t,e){const r=t.source.body;switch(r.charCodeAt(e+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:` +`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw Qr(t.source,e,`Invalid character escape sequence: "${r.slice(e,e+2)}".`)}function rne(t,e){const r=t.source.body,n=r.length;let i=t.lineStart,s=e+3,a=s,o="";const c=[];for(;sfN?"["+une(t)+"]":"{ "+r.map(([i,s])=>i+": "+B2(s,e)).join(", ")+" }"}function cne(t,e){if(t.length===0)return"[]";if(e.length>fN)return"[Array]";const r=Math.min(ine,t.length),n=t.length-r,i=[];for(let s=0;s1&&i.push(`... ${n} more items`),"["+i.join(", ")+"]"}function une(t){const e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){const r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}const lne=globalThis.process?function(e,r){return e instanceof r}:function(e,r){if(e instanceof r)return!0;if(typeof e=="object"&&e!==null){var n;const i=r.prototype[Symbol.toStringTag],s=Symbol.toStringTag in e?e[Symbol.toStringTag]:(n=e.constructor)===null||n===void 0?void 0:n.name;if(i===s){const a=EE(e);throw new Error(`Cannot use ${i} "${a}" from another module or realm. + +Ensure that there is only one instance of "graphql" in the node_modules +directory. If different versions of "graphql" are the dependencies of other +relied on modules, use "resolutions" to ensure only one version is installed. + +https://yarnpkg.com/en/docs/selective-version-resolutions + +Duplicate "graphql" modules cannot be used at the same time since different +versions may have different capabilities and behavior. The data from one +version used in the function from another could produce confusing and +spurious results.`)}}return!1};class dN{constructor(e,r="GraphQL request",n={line:1,column:1}){typeof e=="string"||wm(!1,`Body must be a string. Received: ${EE(e)}.`),this.body=e,this.name=r,this.locationOffset=n,this.locationOffset.line>0||wm(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||wm(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function fne(t){return lne(t,dN)}function dne(t,e){return new hne(t,e).parseDocument()}class hne{constructor(e,r={}){const n=fne(e)?e:new dN(e);this._lexer=new Wre(n),this._options=r,this._tokenCounter=0}parseName(){const e=this.expectToken(Ie.NAME);return this.node(e,{kind:ut.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:ut.DOCUMENT,definitions:this.many(Ie.SOF,this.parseDefinition,Ie.EOF)})}parseDefinition(){if(this.peek(Ie.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),r=e?this._lexer.lookahead():this._lexer.token;if(r.kind===Ie.NAME){switch(r.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(e)throw Qr(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(r.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(r)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(Ie.BRACE_L))return this.node(e,{kind:ut.OPERATION_DEFINITION,operation:Hf.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const r=this.parseOperationType();let n;return this.peek(Ie.NAME)&&(n=this.parseName()),this.node(e,{kind:ut.OPERATION_DEFINITION,operation:r,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(Ie.NAME);switch(e.value){case"query":return Hf.QUERY;case"mutation":return Hf.MUTATION;case"subscription":return Hf.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(Ie.PAREN_L,this.parseVariableDefinition,Ie.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:ut.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(Ie.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(Ie.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(Ie.DOLLAR),this.node(e,{kind:ut.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:ut.SELECTION_SET,selections:this.many(Ie.BRACE_L,this.parseSelection,Ie.BRACE_R)})}parseSelection(){return this.peek(Ie.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,r=this.parseName();let n,i;return this.expectOptionalToken(Ie.COLON)?(n=r,i=this.parseName()):i=r,this.node(e,{kind:ut.FIELD,alias:n,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(Ie.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const r=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(Ie.PAREN_L,r,Ie.PAREN_R)}parseArgument(e=!1){const r=this._lexer.token,n=this.parseName();return this.expectToken(Ie.COLON),this.node(r,{kind:ut.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(Ie.SPREAD);const r=this.expectOptionalKeyword("on");return!r&&this.peek(Ie.NAME)?this.node(e,{kind:ut.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:ut.INLINE_FRAGMENT,typeCondition:r?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(e,{kind:ut.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:ut.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(e){const r=this._lexer.token;switch(r.kind){case Ie.BRACKET_L:return this.parseList(e);case Ie.BRACE_L:return this.parseObject(e);case Ie.INT:return this.advanceLexer(),this.node(r,{kind:ut.INT,value:r.value});case Ie.FLOAT:return this.advanceLexer(),this.node(r,{kind:ut.FLOAT,value:r.value});case Ie.STRING:case Ie.BLOCK_STRING:return this.parseStringLiteral();case Ie.NAME:switch(this.advanceLexer(),r.value){case"true":return this.node(r,{kind:ut.BOOLEAN,value:!0});case"false":return this.node(r,{kind:ut.BOOLEAN,value:!1});case"null":return this.node(r,{kind:ut.NULL});default:return this.node(r,{kind:ut.ENUM,value:r.value})}case Ie.DOLLAR:if(e)if(this.expectToken(Ie.DOLLAR),this._lexer.token.kind===Ie.NAME){const n=this._lexer.token.value;throw Qr(this._lexer.source,r.start,`Unexpected variable "$${n}" in constant value.`)}else throw this.unexpected(r);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:ut.STRING,value:e.value,block:e.kind===Ie.BLOCK_STRING})}parseList(e){const r=()=>this.parseValueLiteral(e);return this.node(this._lexer.token,{kind:ut.LIST,values:this.any(Ie.BRACKET_L,r,Ie.BRACKET_R)})}parseObject(e){const r=()=>this.parseObjectField(e);return this.node(this._lexer.token,{kind:ut.OBJECT,fields:this.any(Ie.BRACE_L,r,Ie.BRACE_R)})}parseObjectField(e){const r=this._lexer.token,n=this.parseName();return this.expectToken(Ie.COLON),this.node(r,{kind:ut.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const r=[];for(;this.peek(Ie.AT);)r.push(this.parseDirective(e));return r}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const r=this._lexer.token;return this.expectToken(Ie.AT),this.node(r,{kind:ut.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let r;if(this.expectOptionalToken(Ie.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(Ie.BRACKET_R),r=this.node(e,{kind:ut.LIST_TYPE,type:n})}else r=this.parseNamedType();return this.expectOptionalToken(Ie.BANG)?this.node(e,{kind:ut.NON_NULL_TYPE,type:r}):r}parseNamedType(){return this.node(this._lexer.token,{kind:ut.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(Ie.STRING)||this.peek(Ie.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),i=this.many(Ie.BRACE_L,this.parseOperationTypeDefinition,Ie.BRACE_R);return this.node(e,{kind:ut.SCHEMA_DEFINITION,description:r,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const e=this._lexer.token,r=this.parseOperationType();this.expectToken(Ie.COLON);const n=this.parseNamedType();return this.node(e,{kind:ut.OPERATION_TYPE_DEFINITION,operation:r,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),i=this.parseConstDirectives();return this.node(e,{kind:ut.SCALAR_TYPE_DEFINITION,description:r,name:n,directives:i})}parseObjectTypeDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(e,{kind:ut.OBJECT_TYPE_DEFINITION,description:r,name:n,interfaces:i,directives:s,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(Ie.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(Ie.BRACE_L,this.parseFieldDefinition,Ie.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,r=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(Ie.COLON);const s=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(e,{kind:ut.FIELD_DEFINITION,description:r,name:n,arguments:i,type:s,directives:a})}parseArgumentDefs(){return this.optionalMany(Ie.PAREN_L,this.parseInputValueDef,Ie.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,r=this.parseDescription(),n=this.parseName();this.expectToken(Ie.COLON);const i=this.parseTypeReference();let s;this.expectOptionalToken(Ie.EQUALS)&&(s=this.parseConstValueLiteral());const a=this.parseConstDirectives();return this.node(e,{kind:ut.INPUT_VALUE_DEFINITION,description:r,name:n,type:i,defaultValue:s,directives:a})}parseInterfaceTypeDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(e,{kind:ut.INTERFACE_TYPE_DEFINITION,description:r,name:n,interfaces:i,directives:s,fields:a})}parseUnionTypeDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),i=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(e,{kind:ut.UNION_TYPE_DEFINITION,description:r,name:n,directives:i,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(Ie.EQUALS)?this.delimitedMany(Ie.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),i=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(e,{kind:ut.ENUM_TYPE_DEFINITION,description:r,name:n,directives:i,values:s})}parseEnumValuesDefinition(){return this.optionalMany(Ie.BRACE_L,this.parseEnumValueDefinition,Ie.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,r=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(e,{kind:ut.ENUM_VALUE_DEFINITION,description:r,name:n,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw Qr(this._lexer.source,this._lexer.token.start,`${U1(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),i=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(e,{kind:ut.INPUT_OBJECT_TYPE_DEFINITION,description:r,name:n,directives:i,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(Ie.BRACE_L,this.parseInputValueDef,Ie.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===Ie.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const r=this.parseConstDirectives(),n=this.optionalMany(Ie.BRACE_L,this.parseOperationTypeDefinition,Ie.BRACE_R);if(r.length===0&&n.length===0)throw this.unexpected();return this.node(e,{kind:ut.SCHEMA_EXTENSION,directives:r,operationTypes:n})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const r=this.parseName(),n=this.parseConstDirectives();if(n.length===0)throw this.unexpected();return this.node(e,{kind:ut.SCALAR_TYPE_EXTENSION,name:r,directives:n})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const r=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(n.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(e,{kind:ut.OBJECT_TYPE_EXTENSION,name:r,interfaces:n,directives:i,fields:s})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const r=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(n.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(e,{kind:ut.INTERFACE_TYPE_EXTENSION,name:r,interfaces:n,directives:i,fields:s})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const r=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:ut.UNION_TYPE_EXTENSION,name:r,directives:n,types:i})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const r=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:ut.ENUM_TYPE_EXTENSION,name:r,directives:n,values:i})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const r=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:ut.INPUT_OBJECT_TYPE_EXTENSION,name:r,directives:n,fields:i})}parseDirectiveDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("directive"),this.expectToken(Ie.AT);const n=this.parseName(),i=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const a=this.parseDirectiveLocations();return this.node(e,{kind:ut.DIRECTIVE_DEFINITION,description:r,name:n,arguments:i,repeatable:s,locations:a})}parseDirectiveLocations(){return this.delimitedMany(Ie.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,r=this.parseName();if(Object.prototype.hasOwnProperty.call(E3,r.value))return r;throw this.unexpected(e)}node(e,r){return this._options.noLocation!==!0&&(r.loc=new $re(e,this._lexer.lastToken,this._lexer.source)),r}peek(e){return this._lexer.token.kind===e}expectToken(e){const r=this._lexer.token;if(r.kind===e)return this.advanceLexer(),r;throw Qr(this._lexer.source,r.start,`Expected ${hN(e)}, found ${U1(r)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e?(this.advanceLexer(),!0):!1}expectKeyword(e){const r=this._lexer.token;if(r.kind===Ie.NAME&&r.value===e)this.advanceLexer();else throw Qr(this._lexer.source,r.start,`Expected "${e}", found ${U1(r)}.`)}expectOptionalKeyword(e){const r=this._lexer.token;return r.kind===Ie.NAME&&r.value===e?(this.advanceLexer(),!0):!1}unexpected(e){const r=e??this._lexer.token;return Qr(this._lexer.source,r.start,`Unexpected ${U1(r)}.`)}any(e,r,n){this.expectToken(e);const i=[];for(;!this.expectOptionalToken(n);)i.push(r.call(this));return i}optionalMany(e,r,n){if(this.expectOptionalToken(e)){const i=[];do i.push(r.call(this));while(!this.expectOptionalToken(n));return i}return[]}many(e,r,n){this.expectToken(e);const i=[];do i.push(r.call(this));while(!this.expectOptionalToken(n));return i}delimitedMany(e,r){this.expectOptionalToken(e);const n=[];do n.push(r.call(this));while(this.expectOptionalToken(e));return n}advanceLexer(){const{maxTokens:e}=this._options,r=this._lexer.advance();if(e!==void 0&&r.kind!==Ie.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw Qr(this._lexer.source,r.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function U1(t){const e=t.value;return hN(t.kind)+(e!=null?` "${e}"`:"")}function hN(t){return Gre(t)?`"${t}"`:t}function pne(t){return`"${t.replace(gne,mne)}"`}const gne=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function mne(t){return vne[t.charCodeAt(0)]}const vne=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],yne=Object.freeze({});function xne(t,e,r=aN){const n=new Map;for(const x of Object.values(ut))n.set(x,bne(e,x));let i,s=Array.isArray(t),a=[t],o=-1,c=[],u=t,l,f;const d=[],p=[];do{o++;const x=o===a.length,b=x&&c.length!==0;if(x){if(l=p.length===0?void 0:d[d.length-1],u=f,f=p.pop(),b)if(s){u=u.slice();let _=0;for(const[P,C]of c){const B=P-_;C===null?(u.splice(B,1),_++):u[B]=C}}else{u=Object.defineProperties({},Object.getOwnPropertyDescriptors(u));for(const[_,P]of c)u[_]=P}o=i.index,a=i.keys,c=i.edits,s=i.inArray,i=i.prev}else if(f){if(l=s?o:a[o],u=f[l],u==null)continue;d.push(l)}let S;if(!Array.isArray(u)){var h,g;$7(u)||wm(!1,`Invalid AST Node: ${EE(u)}.`);const _=x?(h=n.get(u.kind))===null||h===void 0?void 0:h.leave:(g=n.get(u.kind))===null||g===void 0?void 0:g.enter;if(S=_==null?void 0:_.call(e,u,l,f,d,p),S===yne)break;if(S===!1){if(!x){d.pop();continue}}else if(S!==void 0&&(c.push([l,S]),!x))if($7(S))u=S;else{d.pop();continue}}if(S===void 0&&b&&c.push([l,u]),x)d.pop();else{var v;i={inArray:s,index:o,keys:a,edits:c,prev:i},s=Array.isArray(u),a=s?u:(v=r[u.kind])!==null&&v!==void 0?v:[],o=-1,c=[],f&&p.push(f),f=u}}while(i!==void 0);return c.length!==0?c[c.length-1][1]:t}function bne(t,e){const r=t[e];return typeof r=="object"?r:typeof r=="function"?{enter:r,leave:void 0}:{enter:t.enter,leave:t.leave}}function wne(t){return xne(t,Sne)}const Ene=80,Sne={Name:{leave:t=>t.value},Variable:{leave:t=>"$"+t.name},Document:{leave:t=>Ye(t.definitions,` + +`)},OperationDefinition:{leave(t){const e=bt("(",Ye(t.variableDefinitions,", "),")"),r=Ye([t.operation,Ye([t.name,e]),Ye(t.directives," ")]," ");return(r==="query"?"":r+" ")+t.selectionSet}},VariableDefinition:{leave:({variable:t,type:e,defaultValue:r,directives:n})=>t+": "+e+bt(" = ",r)+bt(" ",Ye(n," "))},SelectionSet:{leave:({selections:t})=>bs(t)},Field:{leave({alias:t,name:e,arguments:r,directives:n,selectionSet:i}){const s=bt("",t,": ")+e;let a=s+bt("(",Ye(r,", "),")");return a.length>Ene&&(a=s+bt(`( +`,Em(Ye(r,` +`)),` +)`)),Ye([a,Ye(n," "),i]," ")}},Argument:{leave:({name:t,value:e})=>t+": "+e},FragmentSpread:{leave:({name:t,directives:e})=>"..."+t+bt(" ",Ye(e," "))},InlineFragment:{leave:({typeCondition:t,directives:e,selectionSet:r})=>Ye(["...",bt("on ",t),Ye(e," "),r]," ")},FragmentDefinition:{leave:({name:t,typeCondition:e,variableDefinitions:r,directives:n,selectionSet:i})=>`fragment ${t}${bt("(",Ye(r,", "),")")} on ${e} ${bt("",Ye(n," ")," ")}`+i},IntValue:{leave:({value:t})=>t},FloatValue:{leave:({value:t})=>t},StringValue:{leave:({value:t,block:e})=>e?Kre(t):pne(t)},BooleanValue:{leave:({value:t})=>t?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:t})=>t},ListValue:{leave:({values:t})=>"["+Ye(t,", ")+"]"},ObjectValue:{leave:({fields:t})=>"{"+Ye(t,", ")+"}"},ObjectField:{leave:({name:t,value:e})=>t+": "+e},Directive:{leave:({name:t,arguments:e})=>"@"+t+bt("(",Ye(e,", "),")")},NamedType:{leave:({name:t})=>t},ListType:{leave:({type:t})=>"["+t+"]"},NonNullType:{leave:({type:t})=>t+"!"},SchemaDefinition:{leave:({description:t,directives:e,operationTypes:r})=>bt("",t,` +`)+Ye(["schema",Ye(e," "),bs(r)]," ")},OperationTypeDefinition:{leave:({operation:t,type:e})=>t+": "+e},ScalarTypeDefinition:{leave:({description:t,name:e,directives:r})=>bt("",t,` +`)+Ye(["scalar",e,Ye(r," ")]," ")},ObjectTypeDefinition:{leave:({description:t,name:e,interfaces:r,directives:n,fields:i})=>bt("",t,` +`)+Ye(["type",e,bt("implements ",Ye(r," & ")),Ye(n," "),bs(i)]," ")},FieldDefinition:{leave:({description:t,name:e,arguments:r,type:n,directives:i})=>bt("",t,` +`)+e+(H7(r)?bt(`( +`,Em(Ye(r,` +`)),` +)`):bt("(",Ye(r,", "),")"))+": "+n+bt(" ",Ye(i," "))},InputValueDefinition:{leave:({description:t,name:e,type:r,defaultValue:n,directives:i})=>bt("",t,` +`)+Ye([e+": "+r,bt("= ",n),Ye(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:t,name:e,interfaces:r,directives:n,fields:i})=>bt("",t,` +`)+Ye(["interface",e,bt("implements ",Ye(r," & ")),Ye(n," "),bs(i)]," ")},UnionTypeDefinition:{leave:({description:t,name:e,directives:r,types:n})=>bt("",t,` +`)+Ye(["union",e,Ye(r," "),bt("= ",Ye(n," | "))]," ")},EnumTypeDefinition:{leave:({description:t,name:e,directives:r,values:n})=>bt("",t,` +`)+Ye(["enum",e,Ye(r," "),bs(n)]," ")},EnumValueDefinition:{leave:({description:t,name:e,directives:r})=>bt("",t,` +`)+Ye([e,Ye(r," ")]," ")},InputObjectTypeDefinition:{leave:({description:t,name:e,directives:r,fields:n})=>bt("",t,` +`)+Ye(["input",e,Ye(r," "),bs(n)]," ")},DirectiveDefinition:{leave:({description:t,name:e,arguments:r,repeatable:n,locations:i})=>bt("",t,` +`)+"directive @"+e+(H7(r)?bt(`( +`,Em(Ye(r,` +`)),` +)`):bt("(",Ye(r,", "),")"))+(n?" repeatable":"")+" on "+Ye(i," | ")},SchemaExtension:{leave:({directives:t,operationTypes:e})=>Ye(["extend schema",Ye(t," "),bs(e)]," ")},ScalarTypeExtension:{leave:({name:t,directives:e})=>Ye(["extend scalar",t,Ye(e," ")]," ")},ObjectTypeExtension:{leave:({name:t,interfaces:e,directives:r,fields:n})=>Ye(["extend type",t,bt("implements ",Ye(e," & ")),Ye(r," "),bs(n)]," ")},InterfaceTypeExtension:{leave:({name:t,interfaces:e,directives:r,fields:n})=>Ye(["extend interface",t,bt("implements ",Ye(e," & ")),Ye(r," "),bs(n)]," ")},UnionTypeExtension:{leave:({name:t,directives:e,types:r})=>Ye(["extend union",t,Ye(e," "),bt("= ",Ye(r," | "))]," ")},EnumTypeExtension:{leave:({name:t,directives:e,values:r})=>Ye(["extend enum",t,Ye(e," "),bs(r)]," ")},InputObjectTypeExtension:{leave:({name:t,directives:e,fields:r})=>Ye(["extend input",t,Ye(e," "),bs(r)]," ")}};function Ye(t,e=""){var r;return(r=t==null?void 0:t.filter(n=>n).join(e))!==null&&r!==void 0?r:""}function bs(t){return bt(`{ +`,Em(Ye(t,` +`)),` +}`)}function bt(t,e,r=""){return e!=null&&e!==""?t+e+r:""}function Em(t){return bt(" ",t.replace(/\n/g,` + `))}function H7(t){var e;return(e=t==null?void 0:t.some(r=>r.includes(` +`)))!==null&&e!==void 0?e:!1}const V7=t=>{var n,i;let e;const r=t.definitions.filter(s=>s.kind==="OperationDefinition");return r.length===1&&(e=(i=(n=r[0])==null?void 0:n.name)==null?void 0:i.value),e},ew=t=>{if(typeof t=="string"){let r;try{const n=dne(t);r=V7(n)}catch{}return{query:t,operationName:r}}const e=V7(t);return{query:wne(t),operationName:e}};class cp extends Error{constructor(e,r){const n=`${cp.extractMessage(e)}: ${JSON.stringify({response:e,request:r})}`;super(n),Object.setPrototypeOf(this,cp.prototype),this.response=e,this.request=r,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,cp)}static extractMessage(e){var r,n;return((n=(r=e.errors)==null?void 0:r[0])==null?void 0:n.message)??`GraphQL Error (Code: ${e.status})`}}var A3={exports:{}};(function(t,e){var r=typeof self<"u"?self:it,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(a){var o={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function c(A){return A&&DataView.prototype.isPrototypeOf(A)}if(o.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(A){return A&&u.indexOf(Object.prototype.toString.call(A))>-1};function f(A){if(typeof A!="string"&&(A=String(A)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(A))throw new TypeError("Invalid character in header field name");return A.toLowerCase()}function d(A){return typeof A!="string"&&(A=String(A)),A}function p(A){var I={next:function(){var j=A.shift();return{done:j===void 0,value:j}}};return o.iterable&&(I[Symbol.iterator]=function(){return I}),I}function h(A){this.map={},A instanceof h?A.forEach(function(I,j){this.append(j,I)},this):Array.isArray(A)?A.forEach(function(I){this.append(I[0],I[1])},this):A&&Object.getOwnPropertyNames(A).forEach(function(I){this.append(I,A[I])},this)}h.prototype.append=function(A,I){A=f(A),I=d(I);var j=this.map[A];this.map[A]=j?j+", "+I:I},h.prototype.delete=function(A){delete this.map[f(A)]},h.prototype.get=function(A){return A=f(A),this.has(A)?this.map[A]:null},h.prototype.has=function(A){return this.map.hasOwnProperty(f(A))},h.prototype.set=function(A,I){this.map[f(A)]=d(I)},h.prototype.forEach=function(A,I){for(var j in this.map)this.map.hasOwnProperty(j)&&A.call(I,this.map[j],j,this)},h.prototype.keys=function(){var A=[];return this.forEach(function(I,j){A.push(j)}),p(A)},h.prototype.values=function(){var A=[];return this.forEach(function(I){A.push(I)}),p(A)},h.prototype.entries=function(){var A=[];return this.forEach(function(I,j){A.push([j,I])}),p(A)},o.iterable&&(h.prototype[Symbol.iterator]=h.prototype.entries);function g(A){if(A.bodyUsed)return Promise.reject(new TypeError("Already read"));A.bodyUsed=!0}function v(A){return new Promise(function(I,j){A.onload=function(){I(A.result)},A.onerror=function(){j(A.error)}})}function x(A){var I=new FileReader,j=v(I);return I.readAsArrayBuffer(A),j}function b(A){var I=new FileReader,j=v(I);return I.readAsText(A),j}function S(A){for(var I=new Uint8Array(A),j=new Array(I.length),$=0;$-1?I:A}function N(A,I){I=I||{};var j=I.body;if(A instanceof N){if(A.bodyUsed)throw new TypeError("Already read");this.url=A.url,this.credentials=A.credentials,I.headers||(this.headers=new h(A.headers)),this.method=A.method,this.mode=A.mode,this.signal=A.signal,!j&&A._bodyInit!=null&&(j=A._bodyInit,A.bodyUsed=!0)}else this.url=String(A);if(this.credentials=I.credentials||this.credentials||"same-origin",(I.headers||!this.headers)&&(this.headers=new h(I.headers)),this.method=B(I.method||this.method||"GET"),this.mode=I.mode||this.mode||null,this.signal=I.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&j)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(j)}N.prototype.clone=function(){return new N(this,{body:this._bodyInit})};function T(A){var I=new FormData;return A.trim().split("&").forEach(function(j){if(j){var $=j.split("="),W=$.shift().replace(/\+/g," "),H=$.join("=").replace(/\+/g," ");I.append(decodeURIComponent(W),decodeURIComponent(H))}}),I}function D(A){var I=new h,j=A.replace(/\r?\n[\t ]+/g," ");return j.split(/\r?\n/).forEach(function($){var W=$.split(":"),H=W.shift().trim();if(H){var O=W.join(":").trim();I.append(H,O)}}),I}P.call(N.prototype);function R(A,I){I||(I={}),this.type="default",this.status=I.status===void 0?200:I.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in I?I.statusText:"OK",this.headers=new h(I.headers),this.url=I.url||"",this._initBody(A)}P.call(R.prototype),R.prototype.clone=function(){return new R(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},R.error=function(){var A=new R(null,{status:0,statusText:""});return A.type="error",A};var E=[301,302,303,307,308];R.redirect=function(A,I){if(E.indexOf(I)===-1)throw new RangeError("Invalid status code");return new R(null,{status:I,headers:{location:A}})},a.DOMException=s.DOMException;try{new a.DOMException}catch{a.DOMException=function(I,j){this.message=I,this.name=j;var $=Error(I);this.stack=$.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function F(A,I){return new Promise(function(j,$){var W=new N(A,I);if(W.signal&&W.signal.aborted)return $(new a.DOMException("Aborted","AbortError"));var H=new XMLHttpRequest;function O(){H.abort()}H.onload=function(){var L={status:H.status,statusText:H.statusText,headers:D(H.getAllResponseHeaders()||"")};L.url="responseURL"in H?H.responseURL:L.headers.get("X-Request-URL");var q="response"in H?H.response:H.responseText;j(new R(q,L))},H.onerror=function(){$(new TypeError("Network request failed"))},H.ontimeout=function(){$(new TypeError("Network request failed"))},H.onabort=function(){$(new a.DOMException("Aborted","AbortError"))},H.open(W.method,W.url,!0),W.credentials==="include"?H.withCredentials=!0:W.credentials==="omit"&&(H.withCredentials=!1),"responseType"in H&&o.blob&&(H.responseType="blob"),W.headers.forEach(function(L,q){H.setRequestHeader(q,L)}),W.signal&&(W.signal.addEventListener("abort",O),H.onreadystatechange=function(){H.readyState===4&&W.signal.removeEventListener("abort",O)}),H.send(typeof W._bodyInit>"u"?null:W._bodyInit)})}return F.polyfill=!0,s.fetch||(s.fetch=F,s.Headers=h,s.Request=N,s.Response=R),a.Headers=h,a.Request=N,a.Response=R,a.fetch=F,Object.defineProperty(a,"__esModule",{value:!0}),a})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(A3,A3.exports);var jv=A3.exports;const Sm=Hl(jv),Ane=ZC({__proto__:null,default:Sm},[jv]),df=t=>{let e={};return t&&(typeof Headers<"u"&&t instanceof Headers||Ane&&jv.Headers&&t instanceof jv.Headers?e=Tre(t):Array.isArray(t)?t.forEach(([r,n])=>{r&&n!==void 0&&(e[r]=n)}):e=t),e},q7=t=>t.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),Cne=t=>{if(!Array.isArray(t.query)){const n=t,i=[`query=${encodeURIComponent(q7(n.query))}`];return t.variables&&i.push(`variables=${encodeURIComponent(n.jsonSerializer.stringify(n.variables))}`),n.operationName&&i.push(`operationName=${encodeURIComponent(n.operationName)}`),i.join("&")}if(typeof t.variables<"u"&&!Array.isArray(t.variables))throw new Error("Cannot create query with given variable type, array expected");const e=t,r=t.query.reduce((n,i,s)=>(n.push({query:q7(i),variables:e.variables?e.jsonSerializer.stringify(e.variables[s]):void 0}),n),[]);return`query=${encodeURIComponent(e.jsonSerializer.stringify(r))}`},_ne=t=>async e=>{const{url:r,query:n,variables:i,operationName:s,fetch:a,fetchOptions:o,middleware:c}=e,u={...e.headers};let l="",f;t==="POST"?(f=Bne(n,i,s,o.jsonSerializer),typeof f=="string"&&(u["Content-Type"]="application/json")):l=Cne({query:n,variables:i,operationName:s,jsonSerializer:o.jsonSerializer??bE});const d={method:t,headers:u,body:f,...o};let p=r,h=d;if(c){const g=await Promise.resolve(c({...d,url:r,operationName:s,variables:i})),{url:v,...x}=g;p=v,h=x}return l&&(p=`${p}?${l}`),await a(p,h)};class kne{constructor(e,r={}){this.url=e,this.requestConfig=r,this.rawRequest=async(...n)=>{const[i,s,a]=n,o=Rre(i,s,a),{headers:c,fetch:u=Sm,method:l="POST",requestMiddleware:f,responseMiddleware:d,...p}=this.requestConfig,{url:h}=this;o.signal!==void 0&&(p.signal=o.signal);const{operationName:g}=ew(o.query);return tw({url:h,query:o.query,variables:o.variables,headers:{...df(rw(c)),...df(o.requestHeaders)},operationName:g,fetch:u,method:l,fetchOptions:p,middleware:f}).then(v=>(d&&d(v),v)).catch(v=>{throw d&&d(v),v})}}async request(e,...r){const[n,i]=r,s=Nre(e,n,i),{headers:a,fetch:o=Sm,method:c="POST",requestMiddleware:u,responseMiddleware:l,...f}=this.requestConfig,{url:d}=this;s.signal!==void 0&&(f.signal=s.signal);const{query:p,operationName:h}=ew(s.document);return tw({url:d,query:p,variables:s.variables,headers:{...df(rw(a)),...df(s.requestHeaders)},operationName:h,fetch:o,method:c,fetchOptions:f,middleware:u}).then(g=>(l&&l(g),g.data)).catch(g=>{throw l&&l(g),g})}batchRequests(e,r){const n=Dre(e,r),{headers:i,...s}=this.requestConfig;n.signal!==void 0&&(s.signal=n.signal);const a=n.documents.map(({document:c})=>ew(c).query),o=n.documents.map(({variables:c})=>c);return tw({url:this.url,query:a,variables:o,headers:{...df(rw(i)),...df(n.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??Sm,method:this.requestConfig.method||"POST",fetchOptions:s,middleware:this.requestConfig.requestMiddleware}).then(c=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(c),c.data)).catch(c=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(c),c})}setHeaders(e){return this.requestConfig.headers=e,this}setHeader(e,r){const{headers:n}=this.requestConfig;return n?n[e]=r:this.requestConfig.headers={[e]:r},this}setEndpoint(e){return this.url=e,this}}const tw=async t=>{const{query:e,variables:r,fetchOptions:n}=t,i=_ne(Pre(t.method??"post")),s=Array.isArray(t.query),a=await i(t),o=await Ine(a,n.jsonSerializer??bE),c=Array.isArray(o)?!o.some(({data:l})=>!l):!!o.data,u=Array.isArray(o)||!o.errors||Array.isArray(o.errors)&&!o.errors.length||n.errorPolicy==="all"||n.errorPolicy==="ignore";if(a.ok&&u&&c){const{errors:l,...f}=(Array.isArray(o),o),d=n.errorPolicy==="ignore"?f:o;return{...s?{data:d}:d,headers:a.headers,status:a.status}}else{const l=typeof o=="string"?{error:o}:o;throw new cp({...l,status:a.status,headers:a.headers},{query:e,variables:r})}},Bne=(t,e,r,n)=>{const i=n??bE;if(!Array.isArray(t))return i.stringify({query:t,variables:e,operationName:r});if(typeof e<"u"&&!Array.isArray(e))throw new Error("Cannot create request body with given variable type, array expected");const s=t.reduce((a,o,c)=>(a.push({query:o,variables:e?e[c]:void 0}),a),[]);return i.stringify(s)},Ine=async(t,e)=>{let r;return t.headers.forEach((n,i)=>{i.toLowerCase()==="content-type"&&(r=n)}),r&&(r.toLowerCase().startsWith("application/json")||r.toLowerCase().startsWith("application/graphql+json")||r.toLowerCase().startsWith("application/graphql-response+json"))?e.parse(await t.text()):t.text()},rw=t=>typeof t=="function"?t():t,Fne=(t,...e)=>t.reduce((r,n,i)=>`${r}${n}${i in e?String(e[i]):""}`,"");var Pne={},Tne=Object.create,SE=Object.defineProperty,Nne=Object.getOwnPropertyDescriptor,Rne=Object.getOwnPropertyNames,Dne=Object.getPrototypeOf,One=Object.prototype.hasOwnProperty,Yh=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Mne=(t,e)=>{for(var r in e)SE(t,r,{get:e[r],enumerable:!0})},Lne=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Rne(e))!One.call(t,i)&&i!==r&&SE(t,i,{get:()=>e[i],enumerable:!(n=Nne(e,i))||n.enumerable});return t},pN=(t,e,r)=>(r=t!=null?Tne(Dne(t)):{},Lne(e||!t||!t.__esModule?SE(r,"default",{value:t,enumerable:!0}):r,t)),jne=Yh((t,e)=>{var r=1e3,n=r*60,i=n*60,s=i*24,a=s*7,o=s*365.25;e.exports=function(d,p){p=p||{};var h=typeof d;if(h==="string"&&d.length>0)return c(d);if(h==="number"&&isFinite(d))return p.long?l(d):u(d);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(d))};function c(d){if(d=String(d),!(d.length>100)){var p=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(d);if(p){var h=parseFloat(p[1]),g=(p[2]||"ms").toLowerCase();switch(g){case"years":case"year":case"yrs":case"yr":case"y":return h*o;case"weeks":case"week":case"w":return h*a;case"days":case"day":case"d":return h*s;case"hours":case"hour":case"hrs":case"hr":case"h":return h*i;case"minutes":case"minute":case"mins":case"min":case"m":return h*n;case"seconds":case"second":case"secs":case"sec":case"s":return h*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}}}function u(d){var p=Math.abs(d);return p>=s?Math.round(d/s)+"d":p>=i?Math.round(d/i)+"h":p>=n?Math.round(d/n)+"m":p>=r?Math.round(d/r)+"s":d+"ms"}function l(d){var p=Math.abs(d);return p>=s?f(d,p,s,"day"):p>=i?f(d,p,i,"hour"):p>=n?f(d,p,n,"minute"):p>=r?f(d,p,r,"second"):d+" ms"}function f(d,p,h,g){var v=p>=h*1.5;return Math.round(d/h)+" "+g+(v?"s":"")}}),Une=Yh((t,e)=>{function r(n){s.debug=s,s.default=s,s.coerce=f,s.disable=c,s.enable=o,s.enabled=u,s.humanize=jne(),s.destroy=d,Object.keys(n).forEach(p=>{s[p]=n[p]}),s.names=[],s.skips=[],s.formatters={};function i(p){let h=0;for(let g=0;g{if(N==="%%")return"%";B++;let D=s.formatters[T];if(typeof D=="function"){let R=S[B];N=D.call(_,R),S.splice(B,1),B--}return N}),s.formatArgs.call(_,S),(_.log||s.log).apply(_,S)}return b.namespace=p,b.useColors=s.useColors(),b.color=s.selectColor(p),b.extend=a,b.destroy=s.destroy,Object.defineProperty(b,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(v!==s.namespaces&&(v=s.namespaces,x=s.enabled(p)),x),set:S=>{g=S}}),typeof s.init=="function"&&s.init(b),b}function a(p,h){let g=s(this.namespace+(typeof h>"u"?":":h)+p);return g.log=this.log,g}function o(p){s.save(p),s.namespaces=p,s.names=[],s.skips=[];let h,g=(typeof p=="string"?p:"").split(/[\s,]+/),v=g.length;for(h=0;h"-"+h)].join(",");return s.enable(""),p}function u(p){if(p[p.length-1]==="*")return!0;let h,g;for(h=0,g=s.skips.length;h{t.formatArgs=n,t.save=i,t.load=s,t.useColors=r,t.storage=a(),t.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;let u="color: "+this.color;c.splice(1,0,u,"color: inherit");let l=0,f=0;c[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(l++,d==="%c"&&(f=l))}),c.splice(f,0,u)}t.log=console.debug||console.log||(()=>{});function i(c){try{c?t.storage.setItem("debug",c):t.storage.removeItem("debug")}catch{}}function s(){let c;try{c=t.storage.getItem("debug")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=Pne.DEBUG),c}function a(){try{return localStorage}catch{}}e.exports=Une()(t);var{formatters:o}=e.exports;o.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}),zne=Yh(t=>{t.byteLength=c,t.toByteArray=l,t.fromByteArray=p;var e=[],r=[],n=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(s=0,a=i.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var v=h.indexOf("=");v===-1&&(v=g);var x=v===g?0:4-v%4;return[v,x]}function c(h){var g=o(h),v=g[0],x=g[1];return(v+x)*3/4-x}function u(h,g,v){return(g+v)*3/4-v}function l(h){var g,v=o(h),x=v[0],b=v[1],S=new n(u(h,x,b)),_=0,P=b>0?x-4:x,C;for(C=0;C>16&255,S[_++]=g>>8&255,S[_++]=g&255;return b===2&&(g=r[h.charCodeAt(C)]<<2|r[h.charCodeAt(C+1)]>>4,S[_++]=g&255),b===1&&(g=r[h.charCodeAt(C)]<<10|r[h.charCodeAt(C+1)]<<4|r[h.charCodeAt(C+2)]>>2,S[_++]=g>>8&255,S[_++]=g&255),S}function f(h){return e[h>>18&63]+e[h>>12&63]+e[h>>6&63]+e[h&63]}function d(h,g,v){for(var x,b=[],S=g;SP?P:_+S));return x===1?(g=h[v-1],b.push(e[g>>2]+e[g<<4&63]+"==")):x===2&&(g=(h[v-2]<<8)+h[v-1],b.push(e[g>>10]+e[g>>4&63]+e[g<<2&63]+"=")),b.join("")}}),Hne=Yh(t=>{t.read=function(e,r,n,i,s){var a,o,c=s*8-i-1,u=(1<>1,f=-7,d=n?s-1:0,p=n?-1:1,h=e[r+d];for(d+=p,a=h&(1<<-f)-1,h>>=-f,f+=c;f>0;a=a*256+e[r+d],d+=p,f-=8);for(o=a&(1<<-f)-1,a>>=-f,f+=i;f>0;o=o*256+e[r+d],d+=p,f-=8);if(a===0)a=1-l;else{if(a===u)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,i),a=a-l}return(h?-1:1)*o*Math.pow(2,a-i)},t.write=function(e,r,n,i,s,a){var o,c,u,l=a*8-s-1,f=(1<>1,p=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:a-1,g=i?1:-1,v=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,o=f):(o=Math.floor(Math.log(r)/Math.LN2),r*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?r+=p/u:r+=p*Math.pow(2,1-d),r*u>=2&&(o++,u/=2),o+d>=f?(c=0,o=f):o+d>=1?(c=(r*u-1)*Math.pow(2,s),o=o+d):(c=r*Math.pow(2,d-1)*Math.pow(2,s),o=0));s>=8;e[n+h]=c&255,h+=g,c/=256,s-=8);for(o=o<0;e[n+h]=o&255,h+=g,o/=256,l-=8);e[n+h-g]|=v*128}}),Vne=Yh(t=>{var e=zne(),r=Hne(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=o,t.SlowBuffer=b,t.INSPECT_MAX_BYTES=50;var i=2147483647;t.kMaxLength=i,o.TYPED_ARRAY_SUPPORT=s(),!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 s(){try{let m=new Uint8Array(1),y={foo:function(){return 42}};return Object.setPrototypeOf(y,Uint8Array.prototype),Object.setPrototypeOf(m,y),m.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 a(m){if(m>i)throw new RangeError('The value "'+m+'" is invalid for option "size"');let y=new Uint8Array(m);return Object.setPrototypeOf(y,o.prototype),y}function o(m,y,w){if(typeof m=="number"){if(typeof y=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f(m)}return c(m,y,w)}o.poolSize=8192;function c(m,y,w){if(typeof m=="string")return d(m,y);if(ArrayBuffer.isView(m))return h(m);if(m==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m);if(re(m,ArrayBuffer)||m&&re(m.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(re(m,SharedArrayBuffer)||m&&re(m.buffer,SharedArrayBuffer)))return g(m,y,w);if(typeof m=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let M=m.valueOf&&m.valueOf();if(M!=null&&M!==m)return o.from(M,y,w);let z=v(m);if(z)return z;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof m[Symbol.toPrimitive]=="function")return o.from(m[Symbol.toPrimitive]("string"),y,w);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m)}o.from=function(m,y,w){return c(m,y,w)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function u(m){if(typeof m!="number")throw new TypeError('"size" argument must be of type number');if(m<0)throw new RangeError('The value "'+m+'" is invalid for option "size"')}function l(m,y,w){return u(m),m<=0?a(m):y!==void 0?typeof w=="string"?a(m).fill(y,w):a(m).fill(y):a(m)}o.alloc=function(m,y,w){return l(m,y,w)};function f(m){return u(m),a(m<0?0:x(m)|0)}o.allocUnsafe=function(m){return f(m)},o.allocUnsafeSlow=function(m){return f(m)};function d(m,y){if((typeof y!="string"||y==="")&&(y="utf8"),!o.isEncoding(y))throw new TypeError("Unknown encoding: "+y);let w=S(m,y)|0,M=a(w),z=M.write(m,y);return z!==w&&(M=M.slice(0,z)),M}function p(m){let y=m.length<0?0:x(m.length)|0,w=a(y);for(let M=0;M=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return m|0}function b(m){return+m!=m&&(m=0),o.alloc(+m)}o.isBuffer=function(m){return m!=null&&m._isBuffer===!0&&m!==o.prototype},o.compare=function(m,y){if(re(m,Uint8Array)&&(m=o.from(m,m.offset,m.byteLength)),re(y,Uint8Array)&&(y=o.from(y,y.offset,y.byteLength)),!o.isBuffer(m)||!o.isBuffer(y))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(m===y)return 0;let w=m.length,M=y.length;for(let z=0,G=Math.min(w,M);zM.length?(o.isBuffer(G)||(G=o.from(G)),G.copy(M,z)):Uint8Array.prototype.set.call(M,G,z);else if(o.isBuffer(G))G.copy(M,z);else throw new TypeError('"list" argument must be an Array of Buffers');z+=G.length}return M};function S(m,y){if(o.isBuffer(m))return m.length;if(ArrayBuffer.isView(m)||re(m,ArrayBuffer))return m.byteLength;if(typeof m!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof m);let w=m.length,M=arguments.length>2&&arguments[2]===!0;if(!M&&w===0)return 0;let z=!1;for(;;)switch(y){case"ascii":case"latin1":case"binary":return w;case"utf8":case"utf-8":return Y(m).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w*2;case"hex":return w>>>1;case"base64":return xe(m).length;default:if(z)return M?-1:Y(m).length;y=(""+y).toLowerCase(),z=!0}}o.byteLength=S;function _(m,y,w){let M=!1;if((y===void 0||y<0)&&(y=0),y>this.length||((w===void 0||w>this.length)&&(w=this.length),w<=0)||(w>>>=0,y>>>=0,w<=y))return"";for(m||(m="utf8");;)switch(m){case"hex":return H(this,y,w);case"utf8":case"utf-8":return A(this,y,w);case"ascii":return $(this,y,w);case"latin1":case"binary":return W(this,y,w);case"base64":return F(this,y,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,y,w);default:if(M)throw new TypeError("Unknown encoding: "+m);m=(m+"").toLowerCase(),M=!0}}o.prototype._isBuffer=!0;function P(m,y,w){let M=m[y];m[y]=m[w],m[w]=M}o.prototype.swap16=function(){let m=this.length;if(m%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let y=0;yy&&(m+=" ... "),""},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(m,y,w,M,z){if(re(m,Uint8Array)&&(m=o.from(m,m.offset,m.byteLength)),!o.isBuffer(m))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof m);if(y===void 0&&(y=0),w===void 0&&(w=m?m.length:0),M===void 0&&(M=0),z===void 0&&(z=this.length),y<0||w>m.length||M<0||z>this.length)throw new RangeError("out of range index");if(M>=z&&y>=w)return 0;if(M>=z)return-1;if(y>=w)return 1;if(y>>>=0,w>>>=0,M>>>=0,z>>>=0,this===m)return 0;let G=z-M,Z=w-y,Se=Math.min(G,Z),Ve=this.slice(M,z),Pe=m.slice(y,w);for(let Te=0;Te2147483647?w=2147483647:w<-2147483648&&(w=-2147483648),w=+w,ke(w)&&(w=z?0:m.length-1),w<0&&(w=m.length+w),w>=m.length){if(z)return-1;w=m.length-1}else if(w<0)if(z)w=0;else return-1;if(typeof y=="string"&&(y=o.from(y,M)),o.isBuffer(y))return y.length===0?-1:B(m,y,w,M,z);if(typeof y=="number")return y=y&255,typeof Uint8Array.prototype.indexOf=="function"?z?Uint8Array.prototype.indexOf.call(m,y,w):Uint8Array.prototype.lastIndexOf.call(m,y,w):B(m,[y],w,M,z);throw new TypeError("val must be string, number or Buffer")}function B(m,y,w,M,z){let G=1,Z=m.length,Se=y.length;if(M!==void 0&&(M=String(M).toLowerCase(),M==="ucs2"||M==="ucs-2"||M==="utf16le"||M==="utf-16le")){if(m.length<2||y.length<2)return-1;G=2,Z/=2,Se/=2,w/=2}function Ve(Te,ze){return G===1?Te[ze]:Te.readUInt16BE(ze*G)}let Pe;if(z){let Te=-1;for(Pe=w;PeZ&&(w=Z-Se),Pe=w;Pe>=0;Pe--){let Te=!0;for(let ze=0;zez&&(M=z)):M=z;let G=y.length;M>G/2&&(M=G/2);let Z;for(Z=0;Z>>0,isFinite(w)?(w=w>>>0,M===void 0&&(M="utf8")):(M=w,w=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let z=this.length-y;if((w===void 0||w>z)&&(w=z),m.length>0&&(w<0||y<0)||y>this.length)throw new RangeError("Attempt to write outside buffer bounds");M||(M="utf8");let G=!1;for(;;)switch(M){case"hex":return N(this,m,y,w);case"utf8":case"utf-8":return T(this,m,y,w);case"ascii":case"latin1":case"binary":return D(this,m,y,w);case"base64":return R(this,m,y,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,m,y,w);default:if(G)throw new TypeError("Unknown encoding: "+M);M=(""+M).toLowerCase(),G=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function F(m,y,w){return y===0&&w===m.length?e.fromByteArray(m):e.fromByteArray(m.slice(y,w))}function A(m,y,w){w=Math.min(m.length,w);let M=[],z=y;for(;z239?4:G>223?3:G>191?2:1;if(z+Se<=w){let Ve,Pe,Te,ze;switch(Se){case 1:G<128&&(Z=G);break;case 2:Ve=m[z+1],(Ve&192)===128&&(ze=(G&31)<<6|Ve&63,ze>127&&(Z=ze));break;case 3:Ve=m[z+1],Pe=m[z+2],(Ve&192)===128&&(Pe&192)===128&&(ze=(G&15)<<12|(Ve&63)<<6|Pe&63,ze>2047&&(ze<55296||ze>57343)&&(Z=ze));break;case 4:Ve=m[z+1],Pe=m[z+2],Te=m[z+3],(Ve&192)===128&&(Pe&192)===128&&(Te&192)===128&&(ze=(G&15)<<18|(Ve&63)<<12|(Pe&63)<<6|Te&63,ze>65535&&ze<1114112&&(Z=ze))}}Z===null?(Z=65533,Se=1):Z>65535&&(Z-=65536,M.push(Z>>>10&1023|55296),Z=56320|Z&1023),M.push(Z),z+=Se}return j(M)}var I=4096;function j(m){let y=m.length;if(y<=I)return String.fromCharCode.apply(String,m);let w="",M=0;for(;MM)&&(w=M);let z="";for(let G=y;Gw&&(m=w),y<0?(y+=w,y<0&&(y=0)):y>w&&(y=w),yw)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(m,y,w){m=m>>>0,y=y>>>0,w||L(m,y,this.length);let M=this[m],z=1,G=0;for(;++G>>0,y=y>>>0,w||L(m,y,this.length);let M=this[m+--y],z=1;for(;y>0&&(z*=256);)M+=this[m+--y]*z;return M},o.prototype.readUint8=o.prototype.readUInt8=function(m,y){return m=m>>>0,y||L(m,1,this.length),this[m]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(m,y){return m=m>>>0,y||L(m,2,this.length),this[m]|this[m+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(m,y){return m=m>>>0,y||L(m,2,this.length),this[m]<<8|this[m+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(m,y){return m=m>>>0,y||L(m,4,this.length),(this[m]|this[m+1]<<8|this[m+2]<<16)+this[m+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(m,y){return m=m>>>0,y||L(m,4,this.length),this[m]*16777216+(this[m+1]<<16|this[m+2]<<8|this[m+3])},o.prototype.readBigUInt64LE=ge(function(m){m=m>>>0,De(m,"offset");let y=this[m],w=this[m+7];(y===void 0||w===void 0)&&V(m,this.length-8);let M=y+this[++m]*2**8+this[++m]*2**16+this[++m]*2**24,z=this[++m]+this[++m]*2**8+this[++m]*2**16+w*2**24;return BigInt(M)+(BigInt(z)<>>0,De(m,"offset");let y=this[m],w=this[m+7];(y===void 0||w===void 0)&&V(m,this.length-8);let M=y*2**24+this[++m]*2**16+this[++m]*2**8+this[++m],z=this[++m]*2**24+this[++m]*2**16+this[++m]*2**8+w;return(BigInt(M)<>>0,y=y>>>0,w||L(m,y,this.length);let M=this[m],z=1,G=0;for(;++G=z&&(M-=Math.pow(2,8*y)),M},o.prototype.readIntBE=function(m,y,w){m=m>>>0,y=y>>>0,w||L(m,y,this.length);let M=y,z=1,G=this[m+--M];for(;M>0&&(z*=256);)G+=this[m+--M]*z;return z*=128,G>=z&&(G-=Math.pow(2,8*y)),G},o.prototype.readInt8=function(m,y){return m=m>>>0,y||L(m,1,this.length),this[m]&128?(255-this[m]+1)*-1:this[m]},o.prototype.readInt16LE=function(m,y){m=m>>>0,y||L(m,2,this.length);let w=this[m]|this[m+1]<<8;return w&32768?w|4294901760:w},o.prototype.readInt16BE=function(m,y){m=m>>>0,y||L(m,2,this.length);let w=this[m+1]|this[m]<<8;return w&32768?w|4294901760:w},o.prototype.readInt32LE=function(m,y){return m=m>>>0,y||L(m,4,this.length),this[m]|this[m+1]<<8|this[m+2]<<16|this[m+3]<<24},o.prototype.readInt32BE=function(m,y){return m=m>>>0,y||L(m,4,this.length),this[m]<<24|this[m+1]<<16|this[m+2]<<8|this[m+3]},o.prototype.readBigInt64LE=ge(function(m){m=m>>>0,De(m,"offset");let y=this[m],w=this[m+7];(y===void 0||w===void 0)&&V(m,this.length-8);let M=this[m+4]+this[m+5]*2**8+this[m+6]*2**16+(w<<24);return(BigInt(M)<>>0,De(m,"offset");let y=this[m],w=this[m+7];(y===void 0||w===void 0)&&V(m,this.length-8);let M=(y<<24)+this[++m]*2**16+this[++m]*2**8+this[++m];return(BigInt(M)<>>0,y||L(m,4,this.length),r.read(this,m,!0,23,4)},o.prototype.readFloatBE=function(m,y){return m=m>>>0,y||L(m,4,this.length),r.read(this,m,!1,23,4)},o.prototype.readDoubleLE=function(m,y){return m=m>>>0,y||L(m,8,this.length),r.read(this,m,!0,52,8)},o.prototype.readDoubleBE=function(m,y){return m=m>>>0,y||L(m,8,this.length),r.read(this,m,!1,52,8)};function q(m,y,w,M,z,G){if(!o.isBuffer(m))throw new TypeError('"buffer" argument must be a Buffer instance');if(y>z||ym.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(m,y,w,M){if(m=+m,y=y>>>0,w=w>>>0,!M){let Z=Math.pow(2,8*w)-1;q(this,m,y,w,Z,0)}let z=1,G=0;for(this[y]=m&255;++G>>0,w=w>>>0,!M){let Z=Math.pow(2,8*w)-1;q(this,m,y,w,Z,0)}let z=w-1,G=1;for(this[y+z]=m&255;--z>=0&&(G*=256);)this[y+z]=m/G&255;return y+w},o.prototype.writeUint8=o.prototype.writeUInt8=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,1,255,0),this[y]=m&255,y+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,2,65535,0),this[y]=m&255,this[y+1]=m>>>8,y+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,2,65535,0),this[y]=m>>>8,this[y+1]=m&255,y+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,4,4294967295,0),this[y+3]=m>>>24,this[y+2]=m>>>16,this[y+1]=m>>>8,this[y]=m&255,y+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,4,4294967295,0),this[y]=m>>>24,this[y+1]=m>>>16,this[y+2]=m>>>8,this[y+3]=m&255,y+4};function ee(m,y,w,M,z){Fe(y,M,z,m,w,7);let G=Number(y&BigInt(4294967295));m[w++]=G,G=G>>8,m[w++]=G,G=G>>8,m[w++]=G,G=G>>8,m[w++]=G;let Z=Number(y>>BigInt(32)&BigInt(4294967295));return m[w++]=Z,Z=Z>>8,m[w++]=Z,Z=Z>>8,m[w++]=Z,Z=Z>>8,m[w++]=Z,w}function X(m,y,w,M,z){Fe(y,M,z,m,w,7);let G=Number(y&BigInt(4294967295));m[w+7]=G,G=G>>8,m[w+6]=G,G=G>>8,m[w+5]=G,G=G>>8,m[w+4]=G;let Z=Number(y>>BigInt(32)&BigInt(4294967295));return m[w+3]=Z,Z=Z>>8,m[w+2]=Z,Z=Z>>8,m[w+1]=Z,Z=Z>>8,m[w]=Z,w+8}o.prototype.writeBigUInt64LE=ge(function(m,y=0){return ee(this,m,y,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=ge(function(m,y=0){return X(this,m,y,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(m,y,w,M){if(m=+m,y=y>>>0,!M){let Se=Math.pow(2,8*w-1);q(this,m,y,w,Se-1,-Se)}let z=0,G=1,Z=0;for(this[y]=m&255;++z>0)-Z&255;return y+w},o.prototype.writeIntBE=function(m,y,w,M){if(m=+m,y=y>>>0,!M){let Se=Math.pow(2,8*w-1);q(this,m,y,w,Se-1,-Se)}let z=w-1,G=1,Z=0;for(this[y+z]=m&255;--z>=0&&(G*=256);)m<0&&Z===0&&this[y+z+1]!==0&&(Z=1),this[y+z]=(m/G>>0)-Z&255;return y+w},o.prototype.writeInt8=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,1,127,-128),m<0&&(m=255+m+1),this[y]=m&255,y+1},o.prototype.writeInt16LE=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,2,32767,-32768),this[y]=m&255,this[y+1]=m>>>8,y+2},o.prototype.writeInt16BE=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,2,32767,-32768),this[y]=m>>>8,this[y+1]=m&255,y+2},o.prototype.writeInt32LE=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,4,2147483647,-2147483648),this[y]=m&255,this[y+1]=m>>>8,this[y+2]=m>>>16,this[y+3]=m>>>24,y+4},o.prototype.writeInt32BE=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,4,2147483647,-2147483648),m<0&&(m=4294967295+m+1),this[y]=m>>>24,this[y+1]=m>>>16,this[y+2]=m>>>8,this[y+3]=m&255,y+4},o.prototype.writeBigInt64LE=ge(function(m,y=0){return ee(this,m,y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=ge(function(m,y=0){return X(this,m,y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ae(m,y,w,M,z,G){if(w+M>m.length)throw new RangeError("Index out of range");if(w<0)throw new RangeError("Index out of range")}function ve(m,y,w,M,z){return y=+y,w=w>>>0,z||ae(m,y,w,4),r.write(m,y,w,M,23,4),w+4}o.prototype.writeFloatLE=function(m,y,w){return ve(this,m,y,!0,w)},o.prototype.writeFloatBE=function(m,y,w){return ve(this,m,y,!1,w)};function de(m,y,w,M,z){return y=+y,w=w>>>0,z||ae(m,y,w,8),r.write(m,y,w,M,52,8),w+8}o.prototype.writeDoubleLE=function(m,y,w){return de(this,m,y,!0,w)},o.prototype.writeDoubleBE=function(m,y,w){return de(this,m,y,!1,w)},o.prototype.copy=function(m,y,w,M){if(!o.isBuffer(m))throw new TypeError("argument should be a Buffer");if(w||(w=0),!M&&M!==0&&(M=this.length),y>=m.length&&(y=m.length),y||(y=0),M>0&&M=this.length)throw new RangeError("Index out of range");if(M<0)throw new RangeError("sourceEnd out of bounds");M>this.length&&(M=this.length),m.length-y>>0,w=w===void 0?this.length:w>>>0,m||(m=0);let z;if(typeof m=="number")for(z=y;z2**32?z=_e(String(w)):typeof w=="bigint"&&(z=String(w),(w>BigInt(2)**BigInt(32)||w<-(BigInt(2)**BigInt(32)))&&(z=_e(z)),z+="n"),M+=` It must be ${y}. Received ${z}`,M},RangeError);function _e(m){let y="",w=m.length,M=m[0]==="-"?1:0;for(;w>=M+4;w-=3)y=`_${m.slice(w-3,w)}${y}`;return`${m.slice(0,w)}${y}`}function Me(m,y,w){De(y,"offset"),(m[y]===void 0||m[y+w]===void 0)&&V(y,m.length-(w+1))}function Fe(m,y,w,M,z,G){if(m>w||m3?y===0||y===BigInt(0)?Se=`>= 0${Z} and < 2${Z} ** ${(G+1)*8}${Z}`:Se=`>= -(2${Z} ** ${(G+1)*8-1}${Z}) and < 2 ** ${(G+1)*8-1}${Z}`:Se=`>= ${y}${Z} and <= ${w}${Z}`,new pe.ERR_OUT_OF_RANGE("value",Se,m)}Me(M,z,G)}function De(m,y){if(typeof m!="number")throw new pe.ERR_INVALID_ARG_TYPE(y,"number",m)}function V(m,y,w){throw Math.floor(m)!==m?(De(m,w),new pe.ERR_OUT_OF_RANGE(w||"offset","an integer",m)):y<0?new pe.ERR_BUFFER_OUT_OF_BOUNDS:new pe.ERR_OUT_OF_RANGE(w||"offset",`>= ${w?1:0} and <= ${y}`,m)}var le=/[^+/0-9A-Za-z-_]/g;function ce(m){if(m=m.split("=")[0],m=m.trim().replace(le,""),m.length<2)return"";for(;m.length%4!==0;)m=m+"=";return m}function Y(m,y){y=y||1/0;let w,M=m.length,z=null,G=[];for(let Z=0;Z55295&&w<57344){if(!z){if(w>56319){(y-=3)>-1&&G.push(239,191,189);continue}else if(Z+1===M){(y-=3)>-1&&G.push(239,191,189);continue}z=w;continue}if(w<56320){(y-=3)>-1&&G.push(239,191,189),z=w;continue}w=(z-55296<<10|w-56320)+65536}else z&&(y-=3)>-1&&G.push(239,191,189);if(z=null,w<128){if((y-=1)<0)break;G.push(w)}else if(w<2048){if((y-=2)<0)break;G.push(w>>6|192,w&63|128)}else if(w<65536){if((y-=3)<0)break;G.push(w>>12|224,w>>6&63|128,w&63|128)}else if(w<1114112){if((y-=4)<0)break;G.push(w>>18|240,w>>12&63|128,w>>6&63|128,w&63|128)}else throw new Error("Invalid code point")}return G}function J(m){let y=[];for(let w=0;w>8,z=w%256,G.push(z),G.push(M);return G}function xe(m){return e.toByteArray(ce(m))}function he(m,y,w,M){let z;for(z=0;z=y.length||z>=m.length);++z)y[z+w]=m[z];return z}function re(m,y){return m instanceof y||m!=null&&m.constructor!=null&&m.constructor.name!=null&&m.constructor.name===y.name}function ke(m){return m!==m}var be=function(){let m="0123456789abcdef",y=new Array(256);for(let w=0;w<16;++w){let M=w*16;for(let z=0;z<16;++z)y[M+z]=m[w]+m[z]}return y}();function ge(m){return typeof BigInt>"u"?Re:m}function Re(){throw new Error("BigInt not supported")}});function ar(t){return t!=null&&typeof t=="object"&&t["@@functional/placeholder"]===!0}function ei(t){return function e(r){return arguments.length===0||ar(r)?e:t.apply(this,arguments)}}function kr(t){return function e(r,n){switch(arguments.length){case 0:return e;case 1:return ar(r)?e:ei(function(i){return t(r,i)});default:return ar(r)&&ar(n)?e:ar(r)?ei(function(i){return t(i,n)}):ar(n)?ei(function(i){return t(r,i)}):t(r,n)}}}function I2(t,e){switch(t){case 0:return function(){return e.apply(this,arguments)};case 1:return function(r){return e.apply(this,arguments)};case 2:return function(r,n){return e.apply(this,arguments)};case 3:return function(r,n,i){return e.apply(this,arguments)};case 4:return function(r,n,i,s){return e.apply(this,arguments)};case 5:return function(r,n,i,s,a){return e.apply(this,arguments)};case 6:return function(r,n,i,s,a,o){return e.apply(this,arguments)};case 7:return function(r,n,i,s,a,o,c){return e.apply(this,arguments)};case 8:return function(r,n,i,s,a,o,c,u){return e.apply(this,arguments)};case 9:return function(r,n,i,s,a,o,c,u,l){return e.apply(this,arguments)};case 10:return function(r,n,i,s,a,o,c,u,l,f){return e.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function gN(t,e,r){return function(){for(var n=[],i=0,s=t,a=0,o=!1;a=arguments.length)?c=e[a]:(c=arguments[i],i+=1),n[a]=c,ar(c)?o=!0:s-=1,a+=1}return!o&&s<=0?r.apply(this,n):I2(Math.max(0,s),gN(t,n,r))}}var qne=kr(function(t,e){return t===1?ei(e):I2(t,gN(t,[],e))}),mN=qne;function AE(t){return function e(r,n,i){switch(arguments.length){case 0:return e;case 1:return ar(r)?e:kr(function(s,a){return t(r,s,a)});case 2:return ar(r)&&ar(n)?e:ar(r)?kr(function(s,a){return t(s,n,a)}):ar(n)?kr(function(s,a){return t(r,s,a)}):ei(function(s){return t(r,n,s)});default:return ar(r)&&ar(n)&&ar(i)?e:ar(r)&&ar(n)?kr(function(s,a){return t(s,a,i)}):ar(r)&&ar(i)?kr(function(s,a){return t(s,n,a)}):ar(n)&&ar(i)?kr(function(s,a){return t(r,s,a)}):ar(r)?ei(function(s){return t(s,n,i)}):ar(n)?ei(function(s){return t(r,s,i)}):ar(i)?ei(function(s){return t(r,n,s)}):t(r,n,i)}}}var CE=Array.isArray||function(t){return t!=null&&t.length>=0&&Object.prototype.toString.call(t)==="[object Array]"};function Kne(t){return t!=null&&typeof t["@@transducer/step"]=="function"}function _E(t,e,r){return function(){if(arguments.length===0)return r();var n=arguments[arguments.length-1];if(!CE(n)){for(var i=0;i=0;)e=Z7[r],Uv(e,t)&&!Yne(n,e)&&(n[n.length]=e),r-=1;return n}),_h=eie,tie=ei(function(t){return t===null?"Null":t===void 0?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}),X7=tie;function Q7(t,e,r,n){var i=K7(t),s=K7(e);function a(o,c){return kE(o,c,r.slice(),n.slice())}return!W7(function(o,c){return!W7(a,c,o)},s,i)}function kE(t,e,r,n){if(nw(t,e))return!0;var i=X7(t);if(i!==X7(e))return!1;if(typeof t["fantasy-land/equals"]=="function"||typeof e["fantasy-land/equals"]=="function")return typeof t["fantasy-land/equals"]=="function"&&t["fantasy-land/equals"](e)&&typeof e["fantasy-land/equals"]=="function"&&e["fantasy-land/equals"](t);if(typeof t.equals=="function"||typeof e.equals=="function")return typeof t.equals=="function"&&t.equals(e)&&typeof e.equals=="function"&&e.equals(t);switch(i){case"Arguments":case"Array":case"Object":if(typeof t.constructor=="function"&&Gne(t.constructor)==="Promise")return t===e;break;case"Boolean":case"Number":case"String":if(!(typeof t==typeof e&&nw(t.valueOf(),e.valueOf())))return!1;break;case"Date":if(!nw(t.valueOf(),e.valueOf()))return!1;break;case"Error":return t.name===e.name&&t.message===e.message;case"RegExp":if(!(t.source===e.source&&t.global===e.global&&t.ignoreCase===e.ignoreCase&&t.multiline===e.multiline&&t.sticky===e.sticky&&t.unicode===e.unicode))return!1;break}for(var s=r.length-1;s>=0;){if(r[s]===t)return n[s]===e;s-=1}switch(i){case"Map":return t.size!==e.size?!1:Q7(t.entries(),e.entries(),r.concat([t]),n.concat([e]));case"Set":return t.size!==e.size?!1:Q7(t.values(),e.values(),r.concat([t]),n.concat([e]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var a=_h(t);if(a.length!==_h(e).length)return!1;var o=r.concat([t]),c=n.concat([e]);for(s=a.length-1;s>=0;){var u=a[s];if(!(Uv(u,e)&&kE(e[u],t[u],o,c)))return!1;s-=1}return!0}var rie=kr(function(t,e){return kE(t,e,[],[])}),vN=rie;function nie(t,e,r){var n,i;if(typeof t.indexOf=="function")switch(typeof e){case"number":if(e===0){for(n=1/e;r=0}function up(t,e){for(var r=0,n=e.length,i=Array(n);r":xN(s,a)},n=function(s,a){return up(function(o){return iw(o)+": "+r(s[o])},a.slice().sort())};switch(Object.prototype.toString.call(t)){case"[object Arguments]":return"(function() { return arguments; }("+up(r,t).join(", ")+"))";case"[object Array]":return"["+up(r,t).concat(n(t,gie(function(s){return/^\d+$/.test(s)},_h(t)))).join(", ")+"]";case"[object Boolean]":return typeof t=="object"?"new Boolean("+r(t.valueOf())+")":t.toString();case"[object Date]":return"new Date("+(isNaN(t.valueOf())?r(NaN):iw(aie(t)))+")";case"[object Map]":return"new Map("+r(Array.from(t))+")";case"[object Null]":return"null";case"[object Number]":return typeof t=="object"?"new Number("+r(t.valueOf())+")":1/t===-1/0?"-0":t.toString(10);case"[object Set]":return"new Set("+r(Array.from(t).sort())+")";case"[object String]":return typeof t=="object"?"new String("+r(t.valueOf())+")":iw(t);case"[object Undefined]":return"undefined";default:if(typeof t.toString=="function"){var i=t.toString();if(i!=="[object Object]")return i}return"{"+n(t,_h(t)).join(", ")+"}"}}var mie=ei(function(t){return xN(t,[])}),Y7=mie,vie=kr(function(t,e){if(t===e)return e;function r(o,c){if(o>c!=c>o)return c>o?c:o}var n=r(t,e);if(n!==void 0)return n;var i=r(typeof t,typeof e);if(i!==void 0)return i===typeof t?t:e;var s=Y7(t),a=r(s,Y7(e));return a!==void 0&&a===s?t:e}),yie=vie,xie=function(){function t(e,r){this.xf=r,this.f=e}return t.prototype["@@transducer/init"]=Wp.init,t.prototype["@@transducer/result"]=Wp.result,t.prototype["@@transducer/step"]=function(e,r){return this.xf["@@transducer/step"](e,this.f(r))},t}(),bie=function(t){return function(e){return new xie(t,e)}},wie=bie,Eie=kr(_E(["fantasy-land/map","map"],wie,function(t,e){switch(Object.prototype.toString.call(e)){case"[object Function]":return mN(e.length,function(){return t.call(this,e.apply(this,arguments))});case"[object Object]":return yN(function(r,n){return r[n]=t(e[n]),r},{},_h(e));default:return up(t,e)}})),Sie=Eie,bN=Number.isInteger||function(t){return t<<0===t};function wN(t){return Object.prototype.toString.call(t)==="[object String]"}var Aie=kr(function(t,e){var r=t<0?e.length+t:t;return wN(e)?e.charAt(r):e[r]}),EN=Aie,Cie=kr(function(t,e){if(e!=null)return bN(t)?EN(t,e):e[t]}),F2=Cie,_ie=kr(function(t,e){return Sie(F2(t),e)}),kie=_ie,Bie=ei(function(t){return CE(t)?!0:!t||typeof t!="object"||wN(t)?!1:t.length===0?!0:t.length>0?t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1):!1}),Iie=Bie,eC=typeof Symbol<"u"?Symbol.iterator:"@@iterator";function Fie(t,e,r){return function(n,i,s){if(Iie(s))return t(n,i,s);if(s==null)return i;if(typeof s["fantasy-land/reduce"]=="function")return e(n,i,s,"fantasy-land/reduce");if(s[eC]!=null)return r(n,i,s[eC]());if(typeof s.next=="function")return r(n,i,s);if(typeof s.reduce=="function")return e(n,i,s,"reduce");throw new TypeError("reduce: list must be array or iterable")}}function Pie(t,e,r){for(var n=0,i=r.length;nCN(C3([]),Qie(sse(t,"name")),C3({}),F2("value")),kN=t=>CN(e=>{if(!e)throw new ose(t);return e},F2("tags"),C3([]));function BN({fetch:t,GATEWAY_URL:e}){return async({query:r,variables:n})=>t(`${e}/graphql`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:r,variables:n})}).then(i=>i.json())}function fse({fetch:t,GATEWAY_URL:e}){let r=BN({fetch:t,GATEWAY_URL:e}),n=k3({fetch:t,GATEWAY_URL:e}),i=` + query GetTransactions ($transactionIds: [ID!]!) { + transactions(ids: $transactionIds) { + edges { + node { + tags { + name + value + } + } + } + } + } + `;return async s=>r({query:i,variables:{transactionIds:[s]}}).then(_N(["data","transactions","edges","0","node"])).then(kN(`Process ${s} was not found on gateway ${e}`)).then(_3(lse)).then(a=>{if(!a)throw new ase('No "Scheduler" tag found on process');return n(a)})}function k3({fetch:t,GATEWAY_URL:e}){let r=BN({fetch:t,GATEWAY_URL:e}),n=` + query GetSchedulerLocation ($owner: String!) { + transactions ( + owners: [$owner] + tags: [ + { name: "Data-Protocol", values: ["ao"] }, + { name: "Type", values: ["Scheduler-Location"] } + ] + # Only need the most recent Scheduler-Location + sort: HEIGHT_DESC + first: 1 + ) { + edges { + node { + tags { + name + value + } + } + } + } + } + `;return async i=>r({query:n,variables:{owner:i}}).then(_N(["data","transactions","edges","0","node"])).then(kN(`Could not find 'Scheduler-Location' owner by wallet ${i}`)).then(ese([_3(cse),_3(use)])).then(([s,a])=>{if(!s)throw new $v('No "Url" tag found on Scheduler-Location');if(!a)throw new $v('No "Time-To-Live" tag found on Scheduler-Location');return{url:s,ttl:a,owner:i}})}var hf=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,IN=new Set,B3=typeof process=="object"&&process?process:{},FN=(t,e,r,n)=>{typeof B3.emitWarning=="function"?B3.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`)},zv=globalThis.AbortController,tC=globalThis.AbortSignal,GC;if(typeof zv>"u"){tC=class{constructor(){se(this,"onabort");se(this,"_onabort",[]);se(this,"reason");se(this,"aborted",!1)}addEventListener(r,n){this._onabort.push(n)}},zv=class{constructor(){se(this,"signal",new tC);e()}abort(r){var n,i;if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=!0;for(let s of this.signal._onabort)s(r);(i=(n=this.signal).onabort)==null||i.call(n,r)}}};let t=((GC=B3.env)==null?void 0:GC.LRU_CACHE_IGNORE_AC_WARNING)!=="1",e=()=>{t&&(t=!1,FN("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var dse=t=>!IN.has(t),fc=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),PN=t=>fc(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?Am:null:null,Am=class extends Array{constructor(t){super(t),this.fill(0)}},Ao,Gd,hse=(Ao=class{constructor(e,r){se(this,"heap");se(this,"length");if(!U(Ao,Gd))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}static create(e){let r=PN(e);if(!r)return[];Q(Ao,Gd,!0);let n=new Ao(e,r);return Q(Ao,Gd,!1),n}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Gd=new WeakMap,ue(Ao,Gd,!1),Ao),Bs,mi,Is,Fs,Zd,Lr,Ps,Ir,sr,dt,Fn,vi,wn,Wr,Ts,Gr,Ns,Rs,yi,Ds,Mc,Pn,Ig,I3,pl,po,Fg,xi,vy,TN,gl,Jd,Pg,va,dc,ya,hc,Tg,F3,Xd,Cm,Qd,_m,Jt,ir,Ng,P3,ml,q0,Rg,pse=(Rg=class{constructor(e){ue(this,Ig);ue(this,vy);ue(this,va);ue(this,ya);ue(this,Tg);ue(this,Xd);ue(this,Qd);ue(this,Jt);ue(this,Ng);ue(this,ml);ue(this,Bs,void 0);ue(this,mi,void 0);ue(this,Is,void 0);ue(this,Fs,void 0);ue(this,Zd,void 0);se(this,"ttl");se(this,"ttlResolution");se(this,"ttlAutopurge");se(this,"updateAgeOnGet");se(this,"updateAgeOnHas");se(this,"allowStale");se(this,"noDisposeOnSet");se(this,"noUpdateTTL");se(this,"maxEntrySize");se(this,"sizeCalculation");se(this,"noDeleteOnFetchRejection");se(this,"noDeleteOnStaleGet");se(this,"allowStaleOnFetchAbort");se(this,"allowStaleOnFetchRejection");se(this,"ignoreFetchAbort");ue(this,Lr,void 0);ue(this,Ps,void 0);ue(this,Ir,void 0);ue(this,sr,void 0);ue(this,dt,void 0);ue(this,Fn,void 0);ue(this,vi,void 0);ue(this,wn,void 0);ue(this,Wr,void 0);ue(this,Ts,void 0);ue(this,Gr,void 0);ue(this,Ns,void 0);ue(this,Rs,void 0);ue(this,yi,void 0);ue(this,Ds,void 0);ue(this,Mc,void 0);ue(this,Pn,void 0);ue(this,pl,()=>{});ue(this,po,()=>{});ue(this,Fg,()=>{});ue(this,xi,()=>!1);ue(this,gl,e=>{});ue(this,Jd,(e,r,n)=>{});ue(this,Pg,(e,r,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:a,updateAgeOnHas:o,allowStale:c,dispose:u,disposeAfter:l,noDisposeOnSet:f,noUpdateTTL:d,maxSize:p=0,maxEntrySize:h=0,sizeCalculation:g,fetchMethod:v,noDeleteOnFetchRejection:x,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:_,ignoreFetchAbort:P}=e;if(r!==0&&!fc(r))throw new TypeError("max option must be a nonnegative integer");let C=r?PN(r):Array;if(!C)throw new Error("invalid max value: "+r);if(Q(this,Bs,r),Q(this,mi,p),this.maxEntrySize=h||U(this,mi),this.sizeCalculation=g,this.sizeCalculation){if(!U(this,mi)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(v!==void 0&&typeof v!="function")throw new TypeError("fetchMethod must be a function if specified");if(Q(this,Zd,v),Q(this,Mc,!!v),Q(this,Ir,new Map),Q(this,sr,new Array(r).fill(void 0)),Q(this,dt,new Array(r).fill(void 0)),Q(this,Fn,new C(r)),Q(this,vi,new C(r)),Q(this,wn,0),Q(this,Wr,0),Q(this,Ts,hse.create(r)),Q(this,Lr,0),Q(this,Ps,0),typeof u=="function"&&Q(this,Is,u),typeof l=="function"?(Q(this,Fs,l),Q(this,Gr,[])):(Q(this,Fs,void 0),Q(this,Gr,void 0)),Q(this,Ds,!!U(this,Is)),Q(this,Pn,!!U(this,Fs)),this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!x,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!_,this.ignoreFetchAbort=!!P,this.maxEntrySize!==0){if(U(this,mi)!==0&&!fc(U(this,mi)))throw new TypeError("maxSize must be a positive integer if specified");if(!fc(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");Ee(this,vy,TN).call(this)}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!o,this.ttlResolution=fc(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!fc(this.ttl))throw new TypeError("ttl must be a positive integer if specified");Ee(this,Ig,I3).call(this)}if(U(this,Bs)===0&&this.ttl===0&&U(this,mi)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!U(this,Bs)&&!U(this,mi)){let B="LRU_CACHE_UNBOUNDED";dse(B)&&(IN.add(B),FN("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",B,Rg))}}static unsafeExposeInternals(e){return{starts:U(e,Rs),ttls:U(e,yi),sizes:U(e,Ns),keyMap:U(e,Ir),keyList:U(e,sr),valList:U(e,dt),next:U(e,Fn),prev:U(e,vi),get head(){return U(e,wn)},get tail(){return U(e,Wr)},free:U(e,Ts),isBackgroundFetch:r=>{var n;return Ee(n=e,Jt,ir).call(n,r)},backgroundFetch:(r,n,i,s)=>{var a;return Ee(a=e,Qd,_m).call(a,r,n,i,s)},moveToTail:r=>{var n;return Ee(n=e,ml,q0).call(n,r)},indexes:r=>{var n;return Ee(n=e,va,dc).call(n,r)},rindexes:r=>{var n;return Ee(n=e,ya,hc).call(n,r)},isStale:r=>{var n;return U(n=e,xi).call(n,r)}}}get max(){return U(this,Bs)}get maxSize(){return U(this,mi)}get calculatedSize(){return U(this,Ps)}get size(){return U(this,Lr)}get fetchMethod(){return U(this,Zd)}get dispose(){return U(this,Is)}get disposeAfter(){return U(this,Fs)}getRemainingTTL(e){return U(this,Ir).has(e)?1/0:0}*entries(){for(let e of Ee(this,va,dc).call(this))U(this,dt)[e]!==void 0&&U(this,sr)[e]!==void 0&&!Ee(this,Jt,ir).call(this,U(this,dt)[e])&&(yield[U(this,sr)[e],U(this,dt)[e]])}*rentries(){for(let e of Ee(this,ya,hc).call(this))U(this,dt)[e]!==void 0&&U(this,sr)[e]!==void 0&&!Ee(this,Jt,ir).call(this,U(this,dt)[e])&&(yield[U(this,sr)[e],U(this,dt)[e]])}*keys(){for(let e of Ee(this,va,dc).call(this)){let r=U(this,sr)[e];r!==void 0&&!Ee(this,Jt,ir).call(this,U(this,dt)[e])&&(yield r)}}*rkeys(){for(let e of Ee(this,ya,hc).call(this)){let r=U(this,sr)[e];r!==void 0&&!Ee(this,Jt,ir).call(this,U(this,dt)[e])&&(yield r)}}*values(){for(let e of Ee(this,va,dc).call(this))U(this,dt)[e]!==void 0&&!Ee(this,Jt,ir).call(this,U(this,dt)[e])&&(yield U(this,dt)[e])}*rvalues(){for(let e of Ee(this,ya,hc).call(this))U(this,dt)[e]!==void 0&&!Ee(this,Jt,ir).call(this,U(this,dt)[e])&&(yield U(this,dt)[e])}[Symbol.iterator](){return this.entries()}find(e,r={}){for(let n of Ee(this,va,dc).call(this)){let i=U(this,dt)[n],s=Ee(this,Jt,ir).call(this,i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,U(this,sr)[n],this))return this.get(U(this,sr)[n],r)}}forEach(e,r=this){for(let n of Ee(this,va,dc).call(this)){let i=U(this,dt)[n],s=Ee(this,Jt,ir).call(this,i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,U(this,sr)[n],this)}}rforEach(e,r=this){for(let n of Ee(this,ya,hc).call(this)){let i=U(this,dt)[n],s=Ee(this,Jt,ir).call(this,i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,U(this,sr)[n],this)}}purgeStale(){let e=!1;for(let r of Ee(this,ya,hc).call(this,{allowStale:!0}))U(this,xi).call(this,r)&&(this.delete(U(this,sr)[r]),e=!0);return e}info(e){let r=U(this,Ir).get(e);if(r===void 0)return;let n=U(this,dt)[r],i=Ee(this,Jt,ir).call(this,n)?n.__staleWhileFetching:n;if(i===void 0)return;let s={value:i};if(U(this,yi)&&U(this,Rs)){let a=U(this,yi)[r],o=U(this,Rs)[r];if(a&&o){let c=a-(hf.now()-o);s.ttl=c,s.start=Date.now()}}return U(this,Ns)&&(s.size=U(this,Ns)[r]),s}dump(){let e=[];for(let r of Ee(this,va,dc).call(this,{allowStale:!0})){let n=U(this,sr)[r],i=U(this,dt)[r],s=Ee(this,Jt,ir).call(this,i)?i.__staleWhileFetching:i;if(s===void 0||n===void 0)continue;let a={value:s};if(U(this,yi)&&U(this,Rs)){a.ttl=U(this,yi)[r];let o=hf.now()-U(this,Rs)[r];a.start=Math.floor(Date.now()-o)}U(this,Ns)&&(a.size=U(this,Ns)[r]),e.unshift([n,a])}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let i=Date.now()-n.start;n.start=hf.now()-i}this.set(r,n.value,n)}}set(e,r,n={}){var d,p,h,g,v;if(r===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:c}=n,{noUpdateTTL:u=this.noUpdateTTL}=n,l=U(this,Pg).call(this,e,r,n.size||0,o);if(this.maxEntrySize&&l>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this.delete(e),this;let f=U(this,Lr)===0?void 0:U(this,Ir).get(e);if(f===void 0)f=U(this,Lr)===0?U(this,Wr):U(this,Ts).length!==0?U(this,Ts).pop():U(this,Lr)===U(this,Bs)?Ee(this,Xd,Cm).call(this,!1):U(this,Lr),U(this,sr)[f]=e,U(this,dt)[f]=r,U(this,Ir).set(e,f),U(this,Fn)[U(this,Wr)]=f,U(this,vi)[f]=U(this,Wr),Q(this,Wr,f),Yo(this,Lr)._++,U(this,Jd).call(this,f,l,c),c&&(c.set="add"),u=!1;else{Ee(this,ml,q0).call(this,f);let x=U(this,dt)[f];if(r!==x){if(U(this,Mc)&&Ee(this,Jt,ir).call(this,x)){x.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:b}=x;b!==void 0&&!a&&(U(this,Ds)&&((d=U(this,Is))==null||d.call(this,b,e,"set")),U(this,Pn)&&((p=U(this,Gr))==null||p.push([b,e,"set"])))}else a||(U(this,Ds)&&((h=U(this,Is))==null||h.call(this,x,e,"set")),U(this,Pn)&&((g=U(this,Gr))==null||g.push([x,e,"set"])));if(U(this,gl).call(this,f),U(this,Jd).call(this,f,l,c),U(this,dt)[f]=r,c){c.set="replace";let b=x&&Ee(this,Jt,ir).call(this,x)?x.__staleWhileFetching:x;b!==void 0&&(c.oldValue=b)}}else c&&(c.set="update")}if(i!==0&&!U(this,yi)&&Ee(this,Ig,I3).call(this),U(this,yi)&&(u||U(this,Fg).call(this,f,i,s),c&&U(this,po).call(this,c,f)),!a&&U(this,Pn)&&U(this,Gr)){let x=U(this,Gr),b;for(;b=x==null?void 0:x.shift();)(v=U(this,Fs))==null||v.call(this,...b)}return this}pop(){var e;try{for(;U(this,Lr);){let r=U(this,dt)[U(this,wn)];if(Ee(this,Xd,Cm).call(this,!0),Ee(this,Jt,ir).call(this,r)){if(r.__staleWhileFetching)return r.__staleWhileFetching}else if(r!==void 0)return r}}finally{if(U(this,Pn)&&U(this,Gr)){let r=U(this,Gr),n;for(;n=r==null?void 0:r.shift();)(e=U(this,Fs))==null||e.call(this,...n)}}}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=r,s=U(this,Ir).get(e);if(s!==void 0){let a=U(this,dt)[s];if(Ee(this,Jt,ir).call(this,a)&&a.__staleWhileFetching===void 0)return!1;if(U(this,xi).call(this,s))i&&(i.has="stale",U(this,po).call(this,i,s));else return n&&U(this,pl).call(this,s),i&&(i.has="hit",U(this,po).call(this,i,s)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{allowStale:n=this.allowStale}=r,i=U(this,Ir).get(e);if(i===void 0||!n&&U(this,xi).call(this,i))return;let s=U(this,dt)[i];return Ee(this,Jt,ir).call(this,s)?s.__staleWhileFetching:s}async fetch(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:c=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:h=this.allowStaleOnFetchAbort,context:g,forceRefresh:v=!1,status:x,signal:b}=r;if(!U(this,Mc))return x&&(x.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:x});let S={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:o,size:c,sizeCalculation:u,noUpdateTTL:l,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:h,ignoreFetchAbort:p,status:x,signal:b},_=U(this,Ir).get(e);if(_===void 0){x&&(x.fetch="miss");let P=Ee(this,Qd,_m).call(this,e,_,S,g);return P.__returned=P}else{let P=U(this,dt)[_];if(Ee(this,Jt,ir).call(this,P)){let T=n&&P.__staleWhileFetching!==void 0;return x&&(x.fetch="inflight",T&&(x.returnedStale=!0)),T?P.__staleWhileFetching:P.__returned=P}let C=U(this,xi).call(this,_);if(!v&&!C)return x&&(x.fetch="hit"),Ee(this,ml,q0).call(this,_),i&&U(this,pl).call(this,_),x&&U(this,po).call(this,x,_),P;let B=Ee(this,Qd,_m).call(this,e,_,S,g),N=B.__staleWhileFetching!==void 0&&n;return x&&(x.fetch=C?"stale":"refresh",N&&C&&(x.returnedStale=!0)),N?B.__staleWhileFetching:B.__returned=B}}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:a}=r,o=U(this,Ir).get(e);if(o!==void 0){let c=U(this,dt)[o],u=Ee(this,Jt,ir).call(this,c);return a&&U(this,po).call(this,a,o),U(this,xi).call(this,o)?(a&&(a.get="stale"),u?(a&&n&&c.__staleWhileFetching!==void 0&&(a.returnedStale=!0),n?c.__staleWhileFetching:void 0):(s||this.delete(e),a&&n&&(a.returnedStale=!0),n?c:void 0)):(a&&(a.get="hit"),u?c.__staleWhileFetching:(Ee(this,ml,q0).call(this,o),i&&U(this,pl).call(this,o),c))}else a&&(a.get="miss")}delete(e){var n,i,s,a;let r=!1;if(U(this,Lr)!==0){let o=U(this,Ir).get(e);if(o!==void 0)if(r=!0,U(this,Lr)===1)this.clear();else{U(this,gl).call(this,o);let c=U(this,dt)[o];if(Ee(this,Jt,ir).call(this,c)?c.__abortController.abort(new Error("deleted")):(U(this,Ds)||U(this,Pn))&&(U(this,Ds)&&((n=U(this,Is))==null||n.call(this,c,e,"delete")),U(this,Pn)&&((i=U(this,Gr))==null||i.push([c,e,"delete"]))),U(this,Ir).delete(e),U(this,sr)[o]=void 0,U(this,dt)[o]=void 0,o===U(this,Wr))Q(this,Wr,U(this,vi)[o]);else if(o===U(this,wn))Q(this,wn,U(this,Fn)[o]);else{let u=U(this,vi)[o];U(this,Fn)[u]=U(this,Fn)[o];let l=U(this,Fn)[o];U(this,vi)[l]=U(this,vi)[o]}Yo(this,Lr)._--,U(this,Ts).push(o)}}if(U(this,Pn)&&((s=U(this,Gr))!=null&&s.length)){let o=U(this,Gr),c;for(;c=o==null?void 0:o.shift();)(a=U(this,Fs))==null||a.call(this,...c)}return r}clear(){var e,r,n;for(let i of Ee(this,ya,hc).call(this,{allowStale:!0})){let s=U(this,dt)[i];if(Ee(this,Jt,ir).call(this,s))s.__abortController.abort(new Error("deleted"));else{let a=U(this,sr)[i];U(this,Ds)&&((e=U(this,Is))==null||e.call(this,s,a,"delete")),U(this,Pn)&&((r=U(this,Gr))==null||r.push([s,a,"delete"]))}}if(U(this,Ir).clear(),U(this,dt).fill(void 0),U(this,sr).fill(void 0),U(this,yi)&&U(this,Rs)&&(U(this,yi).fill(0),U(this,Rs).fill(0)),U(this,Ns)&&U(this,Ns).fill(0),Q(this,wn,0),Q(this,Wr,0),U(this,Ts).length=0,Q(this,Ps,0),Q(this,Lr,0),U(this,Pn)&&U(this,Gr)){let i=U(this,Gr),s;for(;s=i==null?void 0:i.shift();)(n=U(this,Fs))==null||n.call(this,...s)}}},Bs=new WeakMap,mi=new WeakMap,Is=new WeakMap,Fs=new WeakMap,Zd=new WeakMap,Lr=new WeakMap,Ps=new WeakMap,Ir=new WeakMap,sr=new WeakMap,dt=new WeakMap,Fn=new WeakMap,vi=new WeakMap,wn=new WeakMap,Wr=new WeakMap,Ts=new WeakMap,Gr=new WeakMap,Ns=new WeakMap,Rs=new WeakMap,yi=new WeakMap,Ds=new WeakMap,Mc=new WeakMap,Pn=new WeakMap,Ig=new WeakSet,I3=function(){let e=new Am(U(this,Bs)),r=new Am(U(this,Bs));Q(this,yi,e),Q(this,Rs,r),Q(this,Fg,(s,a,o=hf.now())=>{if(r[s]=a!==0?o:0,e[s]=a,a!==0&&this.ttlAutopurge){let c=setTimeout(()=>{U(this,xi).call(this,s)&&this.delete(U(this,sr)[s])},a+1);c.unref&&c.unref()}}),Q(this,pl,s=>{r[s]=e[s]!==0?hf.now():0}),Q(this,po,(s,a)=>{if(e[a]){let o=e[a],c=r[a];if(!o||!c)return;s.ttl=o,s.start=c,s.now=n||i();let u=s.now-c;s.remainingTTL=o-u}});let n=0,i=()=>{let s=hf.now();if(this.ttlResolution>0){n=s;let a=setTimeout(()=>n=0,this.ttlResolution);a.unref&&a.unref()}return s};this.getRemainingTTL=s=>{let a=U(this,Ir).get(s);if(a===void 0)return 0;let o=e[a],c=r[a];if(!o||!c)return 1/0;let u=(n||i())-c;return o-u},Q(this,xi,s=>{let a=r[s],o=e[s];return!!o&&!!a&&(n||i())-a>o})},pl=new WeakMap,po=new WeakMap,Fg=new WeakMap,xi=new WeakMap,vy=new WeakSet,TN=function(){let e=new Am(U(this,Bs));Q(this,Ps,0),Q(this,Ns,e),Q(this,gl,r=>{Q(this,Ps,U(this,Ps)-e[r]),e[r]=0}),Q(this,Pg,(r,n,i,s)=>{if(Ee(this,Jt,ir).call(this,n))return 0;if(!fc(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(n,r),!fc(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i}),Q(this,Jd,(r,n,i)=>{if(e[r]=n,U(this,mi)){let s=U(this,mi)-e[r];for(;U(this,Ps)>s;)Ee(this,Xd,Cm).call(this,!0)}Q(this,Ps,U(this,Ps)+e[r]),i&&(i.entrySize=n,i.totalCalculatedSize=U(this,Ps))})},gl=new WeakMap,Jd=new WeakMap,Pg=new WeakMap,va=new WeakSet,dc=function*({allowStale:e=this.allowStale}={}){if(U(this,Lr))for(let r=U(this,Wr);!(!Ee(this,Tg,F3).call(this,r)||((e||!U(this,xi).call(this,r))&&(yield r),r===U(this,wn)));)r=U(this,vi)[r]},ya=new WeakSet,hc=function*({allowStale:e=this.allowStale}={}){if(U(this,Lr))for(let r=U(this,wn);!(!Ee(this,Tg,F3).call(this,r)||((e||!U(this,xi).call(this,r))&&(yield r),r===U(this,Wr)));)r=U(this,Fn)[r]},Tg=new WeakSet,F3=function(e){return e!==void 0&&U(this,Ir).get(U(this,sr)[e])===e},Xd=new WeakSet,Cm=function(e){var s,a;let r=U(this,wn),n=U(this,sr)[r],i=U(this,dt)[r];return U(this,Mc)&&Ee(this,Jt,ir).call(this,i)?i.__abortController.abort(new Error("evicted")):(U(this,Ds)||U(this,Pn))&&(U(this,Ds)&&((s=U(this,Is))==null||s.call(this,i,n,"evict")),U(this,Pn)&&((a=U(this,Gr))==null||a.push([i,n,"evict"]))),U(this,gl).call(this,r),e&&(U(this,sr)[r]=void 0,U(this,dt)[r]=void 0,U(this,Ts).push(r)),U(this,Lr)===1?(Q(this,wn,Q(this,Wr,0)),U(this,Ts).length=0):Q(this,wn,U(this,Fn)[r]),U(this,Ir).delete(n),Yo(this,Lr)._--,r},Qd=new WeakSet,_m=function(e,r,n,i){let s=r===void 0?void 0:U(this,dt)[r];if(Ee(this,Jt,ir).call(this,s))return s;let a=new zv,{signal:o}=n;o==null||o.addEventListener("abort",()=>a.abort(o.reason),{signal:a.signal});let c={signal:a.signal,options:n,context:i},u=(g,v=!1)=>{let{aborted:x}=a.signal,b=n.ignoreFetchAbort&&g!==void 0;if(n.status&&(x&&!v?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,b&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),x&&!b&&!v)return f(a.signal.reason);let S=p;return U(this,dt)[r]===p&&(g===void 0?S.__staleWhileFetching?U(this,dt)[r]=S.__staleWhileFetching:this.delete(e):(n.status&&(n.status.fetchUpdated=!0),this.set(e,g,c.options))),g},l=g=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=g),f(g)),f=g=>{let{aborted:v}=a.signal,x=v&&n.allowStaleOnFetchAbort,b=x||n.allowStaleOnFetchRejection,S=b||n.noDeleteOnFetchRejection,_=p;if(U(this,dt)[r]===p&&(!S||_.__staleWhileFetching===void 0?this.delete(e):x||(U(this,dt)[r]=_.__staleWhileFetching)),b)return n.status&&_.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),_.__staleWhileFetching;if(_.__returned===_)throw g},d=(g,v)=>{var b;let x=(b=U(this,Zd))==null?void 0:b.call(this,e,s,c);x&&x instanceof Promise&&x.then(S=>g(S===void 0?void 0:S),v),a.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(g(void 0),n.allowStaleOnFetchAbort&&(g=S=>u(S,!0)))})};n.status&&(n.status.fetchDispatched=!0);let p=new Promise(d).then(u,l),h=Object.assign(p,{__abortController:a,__staleWhileFetching:s,__returned:void 0});return r===void 0?(this.set(e,h,{...c.options,status:void 0}),r=U(this,Ir).get(e)):U(this,dt)[r]=h,h},Jt=new WeakSet,ir=function(e){if(!U(this,Mc))return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof zv},Ng=new WeakSet,P3=function(e,r){U(this,vi)[r]=e,U(this,Fn)[e]=r},ml=new WeakSet,q0=function(e){e!==U(this,Wr)&&(e===U(this,wn)?Q(this,wn,U(this,Fn)[e]):Ee(this,Ng,P3).call(this,U(this,vi)[e],U(this,Fn)[e]),Ee(this,Ng,P3).call(this,U(this,Wr),e),Q(this,Wr,e))},Rg),Sl,e1;function gse({size:t}){return Sl||(e1=t,Sl=new pse({max:t,maxSize:1e6*5,sizeCalculation:e=>JSON.stringify(e).length,allowStale:!0}),Sl)}function mse({cache:t=Sl}){return async e=>{if(e1)return t.get(e)}}function vse({cache:t=Sl}){return async(e,{url:r,address:n},i)=>{if(e1)return t.set(e,{url:r,address:n},{ttl:i})}}function yse({cache:t=Sl}){return async e=>{if(e1)return t.get(e)}}function xse({cache:t=Sl}){return async(e,r,n)=>{if(e1)return t.set(e,{url:r,address:e},{ttl:n})}}function bse({loadProcessScheduler:t,cache:e}){return r=>e.getByProcess(r).then(n=>n||t(r).then(i=>{let s={url:i.url,address:i.owner};return Promise.all([e.setByProcess(r,s,i.ttl),e.setByOwner(i.owner,i.url,i.ttl)]).then(()=>s)}))}function wse({loadScheduler:t,cache:e}){return r=>e.getByOwner(r).then(n=>n?{url:n.url}:t(r).then(i=>e.setByOwner(r,i.url,i.ttl).then(()=>({url:i.url}))).catch(i=>{if(!(i instanceof $v))throw i}))}function Ese({loadScheduler:t,cache:e}){return r=>e.getByOwner(r).then(n=>n?!0:t(r).then(i=>e.setByOwner(r,i.url,i.ttl)).then(()=>!0).catch(i=>{if(i instanceof $v)return!1;throw i}))}var Sse=globalThis.GATEWAY_URL||"https://arweave.net";function NN({cacheSize:t=100,GATEWAY_URL:e=Sse}={}){let r=gse({size:t}),n=yse({cache:r}),i=mse({cache:r}),s=xse({cache:r}),a=vse({cache:r}),o=bse({loadProcessScheduler:fse({fetch,GATEWAY_URL:e}),cache:{getByProcess:i,getByOwner:n,setByProcess:a,setByOwner:s}}),c=Ese({loadScheduler:k3({fetch,GATEWAY_URL:e}),cache:{getByProcess:i,getByOwner:n,setByProcess:a,setByOwner:s}}),u=wse({loadScheduler:k3({fetch,GATEWAY_URL:e}),cache:{getByProcess:i,getByOwner:n,setByProcess:a,setByOwner:s}});return{locate:o,validate:c,raw:u}}NN();var vo=t=>({fork:t,toPromise:()=>new Promise((e,r)=>t(r,e)),map:e=>vo((r,n)=>t(r,i=>n(e(i)))),bimap:(e,r)=>vo((n,i)=>t(s=>n(e(s)),s=>i(r(s)))),chain:e=>vo((r,n)=>t(r,i=>e(i).fork(r,n))),bichain:(e,r)=>vo((n,i)=>t(s=>e(s).fork(n,i),s=>r(s).fork(n,i))),fold:(e,r)=>vo((n,i)=>t(s=>e(s).fork(n,i),s=>r(s).fork(n,i)))}),xt=t=>vo((e,r)=>r(t)),au=t=>vo((e,r)=>r(t)),wu=t=>vo((e,r)=>e(t)),Qt=t=>(...e)=>vo((r,n)=>t(...e).then(n).catch(r));function Ase({fetch:t,MU_URL:e,logger:r}){let n=r.child("deployMessage");return i=>xt(i).chain(Qt(({processId:s,data:a,tags:o,anchor:c,signer:u})=>u({data:a,tags:o,target:s,anchor:c}))).chain(s=>xt(s).chain(Qt(async a=>t(e,{method:"POST",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},body:a.raw}))).bichain(a=>wu(new Error(`Error while communicating with MU: ${JSON.stringify(a)}`)),Qt(async a=>{if(a.ok)return a.json();throw new Error(`${a.status}: ${await a.text()}`)})).bimap(n.tap("Error encountered when writing message via MU"),n.tap("Successfully wrote message via MU")).map(a=>({res:a,messageId:s.id}))).toPromise()}function Cse({fetch:t,MU_URL:e,logger:r}){let n=r.child("deployProcess");return i=>xt(i).chain(Qt(({data:s,tags:a,signer:o})=>o({data:s,tags:a}))).chain(s=>xt(s).chain(Qt(async a=>t(e,{method:"POST",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},body:a.raw}))).bichain(a=>wu(new Error(`Error while communicating with MU: ${JSON.stringify(a)}`)),Qt(async a=>{if(a.ok)return a.json();throw new Error(`${a.status}: ${await a.text()}`)})).bimap(n.tap("Error encountered when deploying process via MU"),n.tap("Successfully deployed process via MU")).map(a=>({res:a,processId:s.id}))).toPromise()}function _se({fetch:t,MU_URL:e,logger:r}){let n=r.child("deployMonitor");return i=>xt(i).chain(Qt(({processId:s,data:a,tags:o,anchor:c,signer:u})=>u({data:a,tags:o,target:s,anchor:c}))).chain(s=>xt(s).chain(Qt(async a=>t(e+"/monitor/"+i.processId,{method:"POST",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},body:a.raw}))).bichain(a=>wu(new Error(`Error while communicating with MU: ${JSON.stringify(a)}`)),Qt(async a=>{if(a.ok)return{ok:!0};throw new Error(`${a.status}: ${await a.text()}`)})).bimap(n.tap("Error encountered when subscribing to process via MU"),n.tap("Successfully subscribed to process via MU")).map(a=>({res:a,messageId:s.id}))).toPromise()}function kse({fetch:t,MU_URL:e,logger:r}){let n=r.child("deployUnmonitor");return i=>xt(i).chain(Qt(({processId:s,data:a,tags:o,anchor:c,signer:u})=>u({data:a,tags:o,target:s,anchor:c}))).chain(s=>xt(s).chain(Qt(async a=>t(e+"/monitor/"+i.processId,{method:"DELETE",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},body:a.raw}))).bichain(a=>wu(new Error(`Error while communicating with MU: ${JSON.stringify(a)}`)),Qt(async a=>{if(a.ok)return{ok:!0};throw new Error(`${a.status}: ${await a.text()}`)})).bimap(n.tap("Error encountered when unsubscribing to process via MU"),n.tap("Successfully unsubscribed to process via MU")).map(a=>({res:a,messageId:s.id}))).toPromise()}function Bse({fetch:t,CU_URL:e,logger:r}){return n=>xt(n).map(r.tap("posting dryrun request to CU")).chain(Qt(i=>t(`${e}/dry-run?process-id=${i.Target}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}).then(s=>s.json()))).toPromise()}function Ise({fetch:t,CU_URL:e,logger:r}){return({id:n,processId:i})=>xt(`${e}/result/${n}?process-id=${i}`).map(r.tap("fetching message result from CU")).chain(Qt(async s=>t(s,{method:"GET",headers:{Accept:"application/json"}}).then(a=>a.json()))).toPromise()}function Fse({fetch:t,CU_URL:e,logger:r}){return({process:n,from:i,to:s,sort:a,limit:o})=>{let c=new URL(`${e}/results/${n}`),u=new URLSearchParams(c.search);return i&&u.append("from",i),s&&u.append("to",s),a&&u.append("sort",a),o&&u.append("limit",o),c.search=u,xt(c.toString()).map(r.tap("fetching message result from CU")).chain(Qt(async l=>t(l,{method:"GET",headers:{Accept:"application/json"}}).then(f=>f.json()))).toPromise()}}var sw=({fetch:t})=>async({suUrl:e,processId:r})=>t(`${e}/processes/${r}`,{method:"GET"}).then(n=>n.json()),Pse=function(){return!1},Tse=Pse,Nse=function(){return!0},BE=Nse,Uo={"@@functional/placeholder":!0};function or(t){return t!=null&&typeof t=="object"&&t["@@functional/placeholder"]===!0}function Dr(t){return function e(r){return arguments.length===0||or(r)?e:t.apply(this,arguments)}}function Vt(t){return function e(r,n){switch(arguments.length){case 0:return e;case 1:return or(r)?e:Dr(function(i){return t(r,i)});default:return or(r)&&or(n)?e:or(r)?Dr(function(i){return t(i,n)}):or(n)?Dr(function(i){return t(r,i)}):t(r,n)}}}function Rse(t,e){t=t||[],e=e||[];var r,n=t.length,i=e.length,s=[];for(r=0;r=arguments.length)?c=e[a]:(c=arguments[i],i+=1),n[a]=c,or(c)?o=!0:s-=1,a+=1}return!o&&s<=0?r.apply(this,n):t1(Math.max(0,s),RN(t,n,r))}}var Dse=Vt(function(t,e){return t===1?Dr(e):t1(t,RN(t,[],e))}),P2=Dse;function ef(t){return function e(r,n,i){switch(arguments.length){case 0:return e;case 1:return or(r)?e:Vt(function(s,a){return t(r,s,a)});case 2:return or(r)&&or(n)?e:or(r)?Vt(function(s,a){return t(s,n,a)}):or(n)?Vt(function(s,a){return t(r,s,a)}):Dr(function(s){return t(r,n,s)});default:return or(r)&&or(n)&&or(i)?e:or(r)&&or(n)?Vt(function(s,a){return t(s,a,i)}):or(r)&&or(i)?Vt(function(s,a){return t(s,n,a)}):or(n)&&or(i)?Vt(function(s,a){return t(r,s,a)}):or(r)?Dr(function(s){return t(s,n,i)}):or(n)?Dr(function(s){return t(r,s,i)}):or(i)?Dr(function(s){return t(r,n,s)}):t(r,n,i)}}}var kh=Array.isArray||function(t){return t!=null&&t.length>=0&&Object.prototype.toString.call(t)==="[object Array]"};function Ose(t){return t!=null&&typeof t["@@transducer/step"]=="function"}function T2(t,e,r){return function(){if(arguments.length===0)return r();var n=arguments[arguments.length-1];if(!kh(n)){for(var i=0;i=0;)e=sC[r],Bh(e,t)&&!zse(n,e)&&(n[n.length]=e),r-=1;return n}),Ih=Hse,Vse=Dr(function(t){return t===null?"Null":t===void 0?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}),oC=Vse;function cC(t,e,r,n){var i=rC(t),s=rC(e);function a(o,c){return IE(o,c,r.slice(),n.slice())}return!nC(function(o,c){return!nC(a,c,o)},s,i)}function IE(t,e,r,n){if(aw(t,e))return!0;var i=oC(t);if(i!==oC(e))return!1;if(typeof t["fantasy-land/equals"]=="function"||typeof e["fantasy-land/equals"]=="function")return typeof t["fantasy-land/equals"]=="function"&&t["fantasy-land/equals"](e)&&typeof e["fantasy-land/equals"]=="function"&&e["fantasy-land/equals"](t);if(typeof t.equals=="function"||typeof e.equals=="function")return typeof t.equals=="function"&&t.equals(e)&&typeof e.equals=="function"&&e.equals(t);switch(i){case"Arguments":case"Array":case"Object":if(typeof t.constructor=="function"&&Mse(t.constructor)==="Promise")return t===e;break;case"Boolean":case"Number":case"String":if(!(typeof t==typeof e&&aw(t.valueOf(),e.valueOf())))return!1;break;case"Date":if(!aw(t.valueOf(),e.valueOf()))return!1;break;case"Error":return t.name===e.name&&t.message===e.message;case"RegExp":if(!(t.source===e.source&&t.global===e.global&&t.ignoreCase===e.ignoreCase&&t.multiline===e.multiline&&t.sticky===e.sticky&&t.unicode===e.unicode))return!1;break}for(var s=r.length-1;s>=0;){if(r[s]===t)return n[s]===e;s-=1}switch(i){case"Map":return t.size!==e.size?!1:cC(t.entries(),e.entries(),r.concat([t]),n.concat([e]));case"Set":return t.size!==e.size?!1:cC(t.values(),e.values(),r.concat([t]),n.concat([e]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var a=Ih(t);if(a.length!==Ih(e).length)return!1;var o=r.concat([t]),c=n.concat([e]);for(s=a.length-1;s>=0;){var u=a[s];if(!(Bh(u,e)&&IE(e[u],t[u],o,c)))return!1;s-=1}return!0}var qse=Vt(function(t,e){return IE(t,e,[],[])}),id=qse;function Kse(t,e,r){var n,i;if(typeof t.indexOf=="function")switch(typeof e){case"number":if(e===0){for(n=1/e;r=0}function km(t,e){for(var r=0,n=e.length,i=Array(n);r":LN(s,a)},n=function(s,a){return km(function(o){return ow(o)+": "+r(s[o])},a.slice().sort())};switch(Object.prototype.toString.call(t)){case"[object Arguments]":return"(function() { return arguments; }("+km(r,t).join(", ")+"))";case"[object Array]":return"["+km(r,t).concat(n(t,MN(function(s){return/^\d+$/.test(s)},Ih(t)))).join(", ")+"]";case"[object Boolean]":return typeof t=="object"?"new Boolean("+r(t.valueOf())+")":t.toString();case"[object Date]":return"new Date("+(isNaN(t.valueOf())?r(NaN):ow(Gse(t)))+")";case"[object Map]":return"new Map("+r(Array.from(t))+")";case"[object Null]":return"null";case"[object Number]":return typeof t=="object"?"new Number("+r(t.valueOf())+")":1/t===-1/0?"-0":t.toString(10);case"[object Set]":return"new Set("+r(Array.from(t).sort())+")";case"[object String]":return typeof t=="object"?"new String("+r(t.valueOf())+")":ow(t);case"[object Undefined]":return"undefined";default:if(typeof t.toString=="function"){var i=t.toString();if(i!=="[object Object]")return i}return"{"+n(t,Ih(t)).join(", ")+"}"}}var nae=Dr(function(t){return LN(t,[])}),sd=nae,iae=Vt(function(t,e){if(t===e)return e;function r(o,c){if(o>c!=c>o)return c>o?c:o}var n=r(t,e);if(n!==void 0)return n;var i=r(typeof t,typeof e);if(i!==void 0)return i===typeof t?t:e;var s=sd(t),a=r(s,sd(e));return a!==void 0&&a===s?t:e}),jN=iae,sae=function(){function t(e,r){this.xf=r,this.f=e}return t.prototype["@@transducer/init"]=Ma.init,t.prototype["@@transducer/result"]=Ma.result,t.prototype["@@transducer/step"]=function(e,r){return this.xf["@@transducer/step"](e,this.f(r))},t}(),aae=function(t){return function(e){return new sae(t,e)}},UN=aae,oae=Vt(T2(["fantasy-land/map","map"],UN,function(t,e){switch(Object.prototype.toString.call(e)){case"[object Function]":return P2(e.length,function(){return t.call(this,e.apply(this,arguments))});case"[object Object]":return ON(function(r,n){return r[n]=t(e[n]),r},{},Ih(e));default:return km(t,e)}})),N2=oae,R2=Number.isInteger||function(t){return t<<0===t};function Hv(t){return Object.prototype.toString.call(t)==="[object String]"}var cae=Vt(function(t,e){var r=t<0?e.length+t:t;return Hv(e)?e.charAt(r):e[r]}),$N=cae,uae=Vt(function(t,e){if(e!=null)return R2(t)?$N(t,e):e[t]}),Eu=uae,lae=Vt(function(t,e){return N2(Eu(t),e)}),fae=lae,dae=Dr(function(t){return kh(t)?!0:!t||typeof t!="object"||Hv(t)?!1:t.length===0?!0:t.length>0?t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1):!1}),FE=dae,uC=typeof Symbol<"u"?Symbol.iterator:"@@iterator";function hae(t,e,r){return function(n,i,s){if(FE(s))return t(n,i,s);if(s==null)return i;if(typeof s["fantasy-land/reduce"]=="function")return e(n,i,s,"fantasy-land/reduce");if(s[uC]!=null)return r(n,i,s[uC]());if(typeof s.next=="function")return r(n,i,s);if(typeof s.reduce=="function")return e(n,i,s,"reduce");throw new TypeError("reduce: list must be array or iterable")}}function zN(t,e,r){for(var n=0,i=r.length;n1){var s=!Vv(n)&&Bh(i,n)&&typeof n[i]=="object"?n[i]:R2(e[1])?[]:{};r=t(Array.prototype.slice.call(e,1),r,s)}return _ae(i,r,n)}),Iae=Bae,Fae=ef(function(t,e,r){return Iae([t],e,r)}),Js=Fae;function T3(t){var e=Object.prototype.toString.call(t);return e==="[object Function]"||e==="[object AsyncFunction]"||e==="[object GeneratorFunction]"||e==="[object AsyncGeneratorFunction]"}function Pae(t){return function e(r){for(var n,i,s,a=[],o=0,c=r.length;oi;function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let s={};for(let a of i)s[a]=a;return s},t.getValidEnumValues=i=>{let s=t.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),a={};for(let o of s)a[o]=i[o];return t.objectValues(a)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&s.push(a);return s},t.find=(i,s)=>{for(let a of i)if(s(a))return a},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Dt||(Dt={}));var R3;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(R3||(R3={}));var We=Dt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xc=t=>{switch(typeof t){case"undefined":return We.undefined;case"string":return We.string;case"number":return isNaN(t)?We.nan:We.number;case"boolean":return We.boolean;case"function":return We.function;case"bigint":return We.bigint;case"symbol":return We.symbol;case"object":return Array.isArray(t)?We.array:t===null?We.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?We.promise:typeof Map<"u"&&t instanceof Map?We.map:typeof Set<"u"&&t instanceof Set?We.set:typeof Date<"u"&&t instanceof Date?We.date:We.object;default:return We.unknown}},Ue=Dt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),boe=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),ss=class extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let e=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,e):this.__proto__=e,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){let e=t||function(i){return i.message},r={_errors:[]},n=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)r._errors.push(e(s));else{let a=r,o=0;for(;oe.message){let e={},r=[];for(let n of this.issues)n.path.length>0?(e[n.path[0]]=e[n.path[0]]||[],e[n.path[0]].push(t(n))):r.push(t(n));return{formErrors:r,fieldErrors:e}}get formErrors(){return this.flatten()}};ss.create=t=>new ss(t);var Gp=(t,e)=>{let r;switch(t.code){case Ue.invalid_type:t.received===We.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Ue.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Dt.jsonStringifyReplacer)}`;break;case Ue.unrecognized_keys:r=`Unrecognized key(s) in object: ${Dt.joinValues(t.keys,", ")}`;break;case Ue.invalid_union:r="Invalid input";break;case Ue.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Dt.joinValues(t.options)}`;break;case Ue.invalid_enum_value:r=`Invalid enum value. Expected ${Dt.joinValues(t.options)}, received '${t.received}'`;break;case Ue.invalid_arguments:r="Invalid function arguments";break;case Ue.invalid_return_type:r="Invalid function return type";break;case Ue.invalid_date:r="Invalid date";break;case Ue.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Dt.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Ue.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Ue.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Ue.custom:r="Invalid input";break;case Ue.invalid_intersection_types:r="Intersection results could not be merged";break;case Ue.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Ue.not_finite:r="Number must be finite";break;default:r=e.defaultError,Dt.assertNever(t)}return{message:r}},GN=Gp;function woe(t){GN=t}function qv(){return GN}var Kv=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,s=[...r,...i.path||[]],a={...i,path:s},o="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)o=u(a,{data:e,defaultError:o}).message;return{...i,path:s,message:i.message||o}},Eoe=[];function Ge(t,e){let r=Kv({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,qv(),Gp].filter(n=>!!n)});t.common.issues.push(r)}var ui=class ZN{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return ht;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r)n.push({key:await i.key,value:await i.value});return ZN.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:s,value:a}=i;if(s.status==="aborted"||a.status==="aborted")return ht;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(n[s.value]=a.value)}return{status:e.value,value:n}}},ht=Object.freeze({status:"aborted"}),JN=t=>({status:"dirty",value:t}),Vn=t=>({status:"valid",value:t}),D3=t=>t.status==="aborted",O3=t=>t.status==="dirty",Zp=t=>t.status==="valid",Wv=t=>typeof Promise<"u"&&t instanceof Promise,st;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(st||(st={}));var La=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},fC=(t,e)=>{if(Zp(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ss(t.common.issues);return this._error=r,this._error}}};function pt(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>s.code!=="invalid_type"?{message:a.defaultError}:typeof a.data>"u"?{message:n??a.defaultError}:{message:r??a.defaultError},description:i}}var mt=class{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return xc(t.data)}_getOrReturnCtx(t,e){return e||{common:t.parent.common,data:t.data,parsedType:xc(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ui,ctx:{common:t.parent.common,data:t.data,parsedType:xc(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let e=this._parse(t);if(Wv(e))throw new Error("Synchronous parse encountered promise.");return e}_parseAsync(t){let e=this._parse(t);return Promise.resolve(e)}parse(t,e){let r=this.safeParse(t,e);if(r.success)return r.data;throw r.error}safeParse(t,e){var r;let n={common:{issues:[],async:(r=e==null?void 0:e.async)!==null&&r!==void 0?r:!1,contextualErrorMap:e==null?void 0:e.errorMap},path:(e==null?void 0:e.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:xc(t)},i=this._parseSync({data:t,path:n.path,parent:n});return fC(n,i)}async parseAsync(t,e){let r=await this.safeParseAsync(t,e);if(r.success)return r.data;throw r.error}async safeParseAsync(t,e){let r={common:{issues:[],contextualErrorMap:e==null?void 0:e.errorMap,async:!0},path:(e==null?void 0:e.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:xc(t)},n=this._parse({data:t,path:r.path,parent:r}),i=await(Wv(n)?n:Promise.resolve(n));return fC(r,i)}refine(t,e){let r=n=>typeof e=="string"||typeof e>"u"?{message:e}:typeof e=="function"?e(n):e;return this._refinement((n,i)=>{let s=t(n),a=()=>i.addIssue({code:Ue.custom,...r(n)});return typeof Promise<"u"&&s instanceof Promise?s.then(o=>o?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,e){return this._refinement((r,n)=>t(r)?!0:(n.addIssue(typeof e=="function"?e(r,n):e),!1))}_refinement(t){return new Xs({schema:this,typeName:lt.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Io.create(this,this._def)}nullable(){return Ul.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return jl.create(this,this._def)}promise(){return Rh.create(this,this._def)}or(t){return rg.create([this,t],this._def)}and(t){return ng.create(this,t,this._def)}transform(t){return new Xs({...pt(this._def),schema:this,typeName:lt.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let e=typeof t=="function"?t:()=>t;return new og({...pt(this._def),innerType:this,defaultValue:e,typeName:lt.ZodDefault})}brand(){return new iR({typeName:lt.ZodBranded,type:this,...pt(this._def)})}catch(t){let e=typeof t=="function"?t:()=>t;return new Qv({...pt(this._def),innerType:this,catchValue:e,typeName:lt.ZodCatch})}describe(t){let e=this.constructor;return new e({...this._def,description:t})}pipe(t){return DE.create(this,t)}readonly(){return ey.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Soe=/^c[^\s-]{8,}$/i,Aoe=/^[a-z][a-z0-9]*$/,Coe=/^[0-9A-HJKMNP-TV-Z]{26}$/,_oe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,koe=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Boe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",cw,Ioe=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Foe=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Poe=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function Toe(t,e){return!!((e==="v4"||!e)&&Ioe.test(t)||(e==="v6"||!e)&&Foe.test(t))}var Th=class K0 extends mt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==We.string){let i=this._getOrReturnCtx(e);return Ge(i,{code:Ue.invalid_type,expected:We.string,received:i.parsedType}),ht}let r=new ui,n;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(n=this._getOrReturnCtx(e,n),Ge(n,{code:Ue.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.lengthe.test(i),{validation:r,code:Ue.invalid_string,...st.errToObj(n)})}_addCheck(e){return new K0({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...st.errToObj(e)})}url(e){return this._addCheck({kind:"url",...st.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...st.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...st.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...st.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...st.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...st.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...st.errToObj(e)})}datetime(e){var r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!==null&&r!==void 0?r:!1,...st.errToObj(e==null?void 0:e.message)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...st.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...st.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...st.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...st.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...st.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...st.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...st.errToObj(r)})}nonempty(e){return this.min(1,st.errToObj(e))}trim(){return new K0({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new K0({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new K0({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value{var e;return new Th({checks:[],typeName:lt.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...pt(t)})};function Noe(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,s=parseInt(t.toFixed(i).replace(".","")),a=parseInt(e.toFixed(i).replace(".",""));return s%a/Math.pow(10,i)}var Jp=class M3 extends mt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==We.number){let i=this._getOrReturnCtx(e);return Ge(i,{code:Ue.invalid_type,expected:We.number,received:i.parsedType}),ht}let r,n=new ui;for(let i of this._def.checks)i.kind==="int"?Dt.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Ge(r,{code:Ue.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),Ge(r,{code:Ue.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?Noe(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),Ge(r,{code:Ue.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Ge(r,{code:Ue.not_finite,message:i.message}),n.dirty()):Dt.assertNever(i);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,st.toString(r))}gt(e,r){return this.setLimit("min",e,!1,st.toString(r))}lte(e,r){return this.setLimit("max",e,!0,st.toString(r))}lt(e,r){return this.setLimit("max",e,!1,st.toString(r))}setLimit(e,r,n,i){return new M3({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:st.toString(i)}]})}_addCheck(e){return new M3({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:st.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:st.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:st.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:st.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:st.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:st.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:st.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:st.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:st.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&Dt.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.valuenew Jp({checks:[],typeName:lt.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...pt(t)});var Xp=class L3 extends mt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==We.bigint){let i=this._getOrReturnCtx(e);return Ge(i,{code:Ue.invalid_type,expected:We.bigint,received:i.parsedType}),ht}let r,n=new ui;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),Ge(r,{code:Ue.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Ge(r,{code:Ue.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):Dt.assertNever(i);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,st.toString(r))}gt(e,r){return this.setLimit("min",e,!1,st.toString(r))}lte(e,r){return this.setLimit("max",e,!0,st.toString(r))}lt(e,r){return this.setLimit("max",e,!1,st.toString(r))}setLimit(e,r,n,i){return new L3({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:st.toString(i)}]})}_addCheck(e){return new L3({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:st.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:st.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:st.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:st.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:st.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value{var e;return new Xp({checks:[],typeName:lt.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...pt(t)})};var Qp=class extends mt{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==We.boolean){let e=this._getOrReturnCtx(t);return Ge(e,{code:Ue.invalid_type,expected:We.boolean,received:e.parsedType}),ht}return Vn(t.data)}};Qp.create=t=>new Qp({typeName:lt.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...pt(t)});var Yp=class XN extends mt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==We.date){let i=this._getOrReturnCtx(e);return Ge(i,{code:Ue.invalid_type,expected:We.date,received:i.parsedType}),ht}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return Ge(i,{code:Ue.invalid_date}),ht}let r=new ui,n;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(n=this._getOrReturnCtx(e,n),Ge(n,{code:Ue.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Dt.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new XN({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:st.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:st.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Yp({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:lt.ZodDate,...pt(t)});var Gv=class extends mt{_parse(t){if(this._getType(t)!==We.symbol){let e=this._getOrReturnCtx(t);return Ge(e,{code:Ue.invalid_type,expected:We.symbol,received:e.parsedType}),ht}return Vn(t.data)}};Gv.create=t=>new Gv({typeName:lt.ZodSymbol,...pt(t)});var eg=class extends mt{_parse(t){if(this._getType(t)!==We.undefined){let e=this._getOrReturnCtx(t);return Ge(e,{code:Ue.invalid_type,expected:We.undefined,received:e.parsedType}),ht}return Vn(t.data)}};eg.create=t=>new eg({typeName:lt.ZodUndefined,...pt(t)});var tg=class extends mt{_parse(t){if(this._getType(t)!==We.null){let e=this._getOrReturnCtx(t);return Ge(e,{code:Ue.invalid_type,expected:We.null,received:e.parsedType}),ht}return Vn(t.data)}};tg.create=t=>new tg({typeName:lt.ZodNull,...pt(t)});var Nh=class extends mt{constructor(){super(...arguments),this._any=!0}_parse(t){return Vn(t.data)}};Nh.create=t=>new Nh({typeName:lt.ZodAny,...pt(t)});var Al=class extends mt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Vn(t.data)}};Al.create=t=>new Al({typeName:lt.ZodUnknown,...pt(t)});var $o=class extends mt{_parse(t){let e=this._getOrReturnCtx(t);return Ge(e,{code:Ue.invalid_type,expected:We.never,received:e.parsedType}),ht}};$o.create=t=>new $o({typeName:lt.ZodNever,...pt(t)});var Zv=class extends mt{_parse(t){if(this._getType(t)!==We.undefined){let e=this._getOrReturnCtx(t);return Ge(e,{code:Ue.invalid_type,expected:We.void,received:e.parsedType}),ht}return Vn(t.data)}};Zv.create=t=>new Zv({typeName:lt.ZodVoid,...pt(t)});var jl=class Im extends mt{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==We.array)return Ge(r,{code:Ue.invalid_type,expected:We.array,received:r.parsedType}),ht;if(i.exactLength!==null){let a=r.data.length>i.exactLength.value,o=r.data.lengthi.maxLength.value&&(Ge(r,{code:Ue.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,o)=>i.type._parseAsync(new La(r,a,r.path,o)))).then(a=>ui.mergeArray(n,a));let s=[...r.data].map((a,o)=>i.type._parseSync(new La(r,a,r.path,o)));return ui.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new Im({...this._def,minLength:{value:e,message:st.toString(r)}})}max(e,r){return new Im({...this._def,maxLength:{value:e,message:st.toString(r)}})}length(e,r){return new Im({...this._def,exactLength:{value:e,message:st.toString(r)}})}nonempty(e){return this.min(1,e)}};jl.create=(t,e)=>new jl({type:t,minLength:null,maxLength:null,exactLength:null,typeName:lt.ZodArray,...pt(e)});function Af(t){if(t instanceof fs){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Io.create(Af(n))}return new fs({...t._def,shape:()=>e})}else return t instanceof jl?new jl({...t._def,type:Af(t.element)}):t instanceof Io?Io.create(Af(t.unwrap())):t instanceof Ul?Ul.create(Af(t.unwrap())):t instanceof ou?ou.create(t.items.map(e=>Af(e))):t}var fs=class ws extends mt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Dt.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==We.object){let c=this._getOrReturnCtx(e);return Ge(c,{code:Ue.invalid_type,expected:We.object,received:c.parsedType}),ht}let{status:r,ctx:n}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof $o&&this._def.unknownKeys==="strip"))for(let c in n.data)s.includes(c)||a.push(c);let o=[];for(let c of s){let u=i[c],l=n.data[c];o.push({key:{status:"valid",value:c},value:u._parse(new La(n,l,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof $o){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)o.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(c==="strict")a.length>0&&(Ge(n,{code:Ue.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let l=n.data[u];o.push({key:{status:"valid",value:u},value:c._parse(new La(n,l,n.path,u)),alwaysSet:u in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of o){let l=await u.key;c.push({key:l,value:await u.value,alwaysSet:u.alwaysSet})}return c}).then(c=>ui.mergeObjectSync(r,c)):ui.mergeObjectSync(r,o)}get shape(){return this._def.shape()}strict(e){return st.errToObj,new ws({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,s,a,o;let c=(a=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(o=st.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new ws({...this._def,unknownKeys:"strip"})}passthrough(){return new ws({...this._def,unknownKeys:"passthrough"})}extend(e){return new ws({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ws({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:lt.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new ws({...this._def,catchall:e})}pick(e){let r={};return Dt.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new ws({...this._def,shape:()=>r})}omit(e){let r={};return Dt.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new ws({...this._def,shape:()=>r})}deepPartial(){return Af(this)}partial(e){let r={};return Dt.objectKeys(this.shape).forEach(n=>{let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}),new ws({...this._def,shape:()=>r})}required(e){let r={};return Dt.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Io;)i=i._def.innerType;r[n]=i}}),new ws({...this._def,shape:()=>r})}keyof(){return nR(Dt.objectKeys(this.shape))}};fs.create=(t,e)=>new fs({shape:()=>t,unknownKeys:"strip",catchall:$o.create(),typeName:lt.ZodObject,...pt(e)});fs.strictCreate=(t,e)=>new fs({shape:()=>t,unknownKeys:"strict",catchall:$o.create(),typeName:lt.ZodObject,...pt(e)});fs.lazycreate=(t,e)=>new fs({shape:t,unknownKeys:"strip",catchall:$o.create(),typeName:lt.ZodObject,...pt(e)});var rg=class extends mt{_parse(t){let{ctx:e}=this._processInputParams(t),r=this._def.options;function n(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return e.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new ss(a.ctx.common.issues));return Ge(e,{code:Ue.invalid_union,unionErrors:s}),ht}if(e.common.async)return Promise.all(r.map(async i=>{let s={...e,common:{...e.common,issues:[]},parent:null};return{result:await i._parseAsync({data:e.data,path:e.path,parent:s}),ctx:s}})).then(n);{let i,s=[];for(let o of r){let c={...e,common:{...e.common,issues:[]},parent:null},u=o._parseSync({data:e.data,path:e.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return e.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(o=>new ss(o));return Ge(e,{code:Ue.invalid_union,unionErrors:a}),ht}}get options(){return this._def.options}};rg.create=(t,e)=>new rg({options:t,typeName:lt.ZodUnion,...pt(e)});var Fm=t=>t instanceof ig?Fm(t.schema):t instanceof Xs?Fm(t.innerType()):t instanceof sg?[t.value]:t instanceof r1?t.options:t instanceof ag?Object.keys(t.enum):t instanceof og?Fm(t._def.innerType):t instanceof eg?[void 0]:t instanceof tg?[null]:null,QN=class YN extends mt{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==We.object)return Ge(r,{code:Ue.invalid_type,expected:We.object,received:r.parsedType}),ht;let n=this.discriminator,i=r.data[n],s=this.optionsMap.get(i);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(Ge(r,{code:Ue.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ht)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let s of r){let a=Fm(s.shape[e]);if(!a)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of a){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,s)}}return new YN({typeName:lt.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...pt(n)})}};function j3(t,e){let r=xc(t),n=xc(e);if(t===e)return{valid:!0,data:t};if(r===We.object&&n===We.object){let i=Dt.objectKeys(e),s=Dt.objectKeys(t).filter(o=>i.indexOf(o)!==-1),a={...t,...e};for(let o of s){let c=j3(t[o],e[o]);if(!c.valid)return{valid:!1};a[o]=c.data}return{valid:!0,data:a}}else if(r===We.array&&n===We.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let s=0;s{if(D3(i)||D3(s))return ht;let a=j3(i.value,s.value);return a.valid?((O3(i)||O3(s))&&e.dirty(),{status:e.value,value:a.data}):(Ge(r,{code:Ue.invalid_intersection_types}),ht)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>n(i,s)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};ng.create=(t,e,r)=>new ng({left:t,right:e,typeName:lt.ZodIntersection,...pt(r)});var ou=class eR extends mt{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==We.array)return Ge(n,{code:Ue.invalid_type,expected:We.array,received:n.parsedType}),ht;if(n.data.lengththis._def.items.length&&(Ge(n,{code:Ue.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let o=this._def.items[a]||this._def.rest;return o?o._parse(new La(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>ui.mergeArray(r,s)):ui.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new eR({...this._def,rest:e})}};ou.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ou({items:t,typeName:lt.ZodTuple,rest:null,...pt(e)})};var tR=class U3 extends mt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==We.object)return Ge(n,{code:Ue.invalid_type,expected:We.object,received:n.parsedType}),ht;let i=[],s=this._def.keyType,a=this._def.valueType;for(let o in n.data)i.push({key:s._parse(new La(n,o,n.path,o)),value:a._parse(new La(n,n.data[o],n.path,o))});return n.common.async?ui.mergeObjectAsync(r,i):ui.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof mt?new U3({keyType:e,valueType:r,typeName:lt.ZodRecord,...pt(n)}):new U3({keyType:Th.create(),valueType:e,typeName:lt.ZodRecord,...pt(r)})}},Jv=class extends mt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==We.map)return Ge(r,{code:Ue.invalid_type,expected:We.map,received:r.parsedType}),ht;let n=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([a,o],c)=>({key:n._parse(new La(r,a,r.path,[c,"key"])),value:i._parse(new La(r,o,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let o of s){let c=await o.key,u=await o.value;if(c.status==="aborted"||u.status==="aborted")return ht;(c.status==="dirty"||u.status==="dirty")&&e.dirty(),a.set(c.value,u.value)}return{status:e.value,value:a}})}else{let a=new Map;for(let o of s){let c=o.key,u=o.value;if(c.status==="aborted"||u.status==="aborted")return ht;(c.status==="dirty"||u.status==="dirty")&&e.dirty(),a.set(c.value,u.value)}return{status:e.value,value:a}}}};Jv.create=(t,e,r)=>new Jv({valueType:e,keyType:t,typeName:lt.ZodMap,...pt(r)});var Xv=class $3 extends mt{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==We.set)return Ge(n,{code:Ue.invalid_type,expected:We.set,received:n.parsedType}),ht;let i=this._def;i.minSize!==null&&n.data.sizei.maxSize.value&&(Ge(n,{code:Ue.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let s=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return ht;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let o=[...n.data.values()].map((c,u)=>s._parse(new La(n,c,n.path,u)));return n.common.async?Promise.all(o).then(c=>a(c)):a(o)}min(e,r){return new $3({...this._def,minSize:{value:e,message:st.toString(r)}})}max(e,r){return new $3({...this._def,maxSize:{value:e,message:st.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Xv.create=(t,e)=>new Xv({valueType:t,minSize:null,maxSize:null,typeName:lt.ZodSet,...pt(e)});var rR=class Pm extends mt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==We.function)return Ge(r,{code:Ue.invalid_type,expected:We.function,received:r.parsedType}),ht;function n(o,c){return Kv({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,qv(),Gp].filter(u=>!!u),issueData:{code:Ue.invalid_arguments,argumentsError:c}})}function i(o,c){return Kv({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,qv(),Gp].filter(u=>!!u),issueData:{code:Ue.invalid_return_type,returnTypeError:c}})}let s={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Rh){let o=this;return Vn(async function(...c){let u=new ss([]),l=await o._def.args.parseAsync(c,s).catch(d=>{throw u.addIssue(n(c,d)),u}),f=await Reflect.apply(a,this,l);return await o._def.returns._def.type.parseAsync(f,s).catch(d=>{throw u.addIssue(i(f,d)),u})})}else{let o=this;return Vn(function(...c){let u=o._def.args.safeParse(c,s);if(!u.success)throw new ss([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),f=o._def.returns.safeParse(l,s);if(!f.success)throw new ss([i(l,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Pm({...this._def,args:ou.create(e).rest(Al.create())})}returns(e){return new Pm({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new Pm({args:e||ou.create([]).rest(Al.create()),returns:r||Al.create(),typeName:lt.ZodFunction,...pt(n)})}},ig=class extends mt{get schema(){return this._def.getter()}_parse(t){let{ctx:e}=this._processInputParams(t);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}};ig.create=(t,e)=>new ig({getter:t,typeName:lt.ZodLazy,...pt(e)});var sg=class extends mt{_parse(t){if(t.data!==this._def.value){let e=this._getOrReturnCtx(t);return Ge(e,{received:e.data,code:Ue.invalid_literal,expected:this._def.value}),ht}return{status:"valid",value:t.data}}get value(){return this._def.value}};sg.create=(t,e)=>new sg({value:t,typeName:lt.ZodLiteral,...pt(e)});function nR(t,e){return new r1({values:t,typeName:lt.ZodEnum,...pt(e)})}var r1=class z3 extends mt{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return Ge(r,{expected:Dt.joinValues(n),received:r.parsedType,code:Ue.invalid_type}),ht}if(this._def.values.indexOf(e.data)===-1){let r=this._getOrReturnCtx(e),n=this._def.values;return Ge(r,{received:r.data,code:Ue.invalid_enum_value,options:n}),ht}return Vn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e){return z3.create(e)}exclude(e){return z3.create(this.options.filter(r=>!e.includes(r)))}};r1.create=nR;var ag=class extends mt{_parse(t){let e=Dt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==We.string&&r.parsedType!==We.number){let n=Dt.objectValues(e);return Ge(r,{expected:Dt.joinValues(n),received:r.parsedType,code:Ue.invalid_type}),ht}if(e.indexOf(t.data)===-1){let n=Dt.objectValues(e);return Ge(r,{received:r.data,code:Ue.invalid_enum_value,options:n}),ht}return Vn(t.data)}get enum(){return this._def.values}};ag.create=(t,e)=>new ag({values:t,typeName:lt.ZodNativeEnum,...pt(e)});var Rh=class extends mt{unwrap(){return this._def.type}_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==We.promise&&e.common.async===!1)return Ge(e,{code:Ue.invalid_type,expected:We.promise,received:e.parsedType}),ht;let r=e.parsedType===We.promise?e.data:Promise.resolve(e.data);return Vn(r.then(n=>this._def.type.parseAsync(n,{path:e.path,errorMap:e.common.contextualErrorMap})))}};Rh.create=(t,e)=>new Rh({type:t,typeName:lt.ZodPromise,...pt(e)});var Xs=class extends mt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===lt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:a=>{Ge(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let a=i.transform(n.data,s);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(a).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:a,path:n.path,parent:n})}if(i.type==="refinement"){let a=o=>{let c=i.refinement(o,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ht:(o.status==="dirty"&&r.dirty(),a(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?ht:(o.status==="dirty"&&r.dirty(),a(o.value).then(()=>({status:r.value,value:o.value}))))}if(i.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Zp(a))return a;let o=i.transform(a.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Zp(a)?Promise.resolve(i.transform(a.value,s)).then(o=>({status:r.value,value:o})):a);Dt.assertNever(i)}};Xs.create=(t,e,r)=>new Xs({schema:t,typeName:lt.ZodEffects,effect:e,...pt(r)});Xs.createWithPreprocess=(t,e,r)=>new Xs({schema:e,effect:{type:"preprocess",transform:t},typeName:lt.ZodEffects,...pt(r)});var Io=class extends mt{_parse(t){return this._getType(t)===We.undefined?Vn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Io.create=(t,e)=>new Io({innerType:t,typeName:lt.ZodOptional,...pt(e)});var Ul=class extends mt{_parse(t){return this._getType(t)===We.null?Vn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ul.create=(t,e)=>new Ul({innerType:t,typeName:lt.ZodNullable,...pt(e)});var og=class extends mt{_parse(t){let{ctx:e}=this._processInputParams(t),r=e.data;return e.parsedType===We.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:e.path,parent:e})}removeDefault(){return this._def.innerType}};og.create=(t,e)=>new og({innerType:t,typeName:lt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...pt(e)});var Qv=class extends mt{_parse(t){let{ctx:e}=this._processInputParams(t),r={...e,common:{...e.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Wv(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ss(r.common.issues)},input:r.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ss(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Qv.create=(t,e)=>new Qv({innerType:t,typeName:lt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...pt(e)});var Yv=class extends mt{_parse(t){if(this._getType(t)!==We.nan){let e=this._getOrReturnCtx(t);return Ge(e,{code:Ue.invalid_type,expected:We.nan,received:e.parsedType}),ht}return{status:"valid",value:t.data}}};Yv.create=t=>new Yv({typeName:lt.ZodNaN,...pt(t)});var Roe=Symbol("zod_brand"),iR=class extends mt{_parse(t){let{ctx:e}=this._processInputParams(t),r=e.data;return this._def.type._parse({data:r,path:e.path,parent:e})}unwrap(){return this._def.type}},DE=class sR extends mt{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ht:i.status==="dirty"?(r.dirty(),JN(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ht:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new sR({in:e,out:r,typeName:lt.ZodPipeline})}},ey=class extends mt{_parse(t){let e=this._def.innerType._parse(t);return Zp(e)&&(e.value=Object.freeze(e.value)),e}};ey.create=(t,e)=>new ey({innerType:t,typeName:lt.ZodReadonly,...pt(e)});var aR=(t,e={},r)=>t?Nh.create().superRefine((n,i)=>{var s,a;if(!t(n)){let o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(a=(s=o.fatal)!==null&&s!==void 0?s:r)!==null&&a!==void 0?a:!0,u=typeof o=="string"?{message:o}:o;i.addIssue({code:"custom",...u,fatal:c})}}):Nh.create(),Doe={object:fs.lazycreate},lt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(lt||(lt={}));var Ooe=(t,e={message:`Input not instance of ${t.name}`})=>aR(r=>r instanceof t,e),oR=Th.create,cR=Jp.create,Moe=Yv.create,Loe=Xp.create,uR=Qp.create,joe=Yp.create,Uoe=Gv.create,$oe=eg.create,zoe=tg.create,Hoe=Nh.create,Voe=Al.create,qoe=$o.create,Koe=Zv.create,Woe=jl.create,Goe=fs.create,Zoe=fs.strictCreate,Joe=rg.create,Xoe=QN.create,Qoe=ng.create,Yoe=ou.create,ece=tR.create,tce=Jv.create,rce=Xv.create,nce=rR.create,ice=ig.create,sce=sg.create,ace=r1.create,oce=ag.create,cce=Rh.create,dC=Xs.create,uce=Io.create,lce=Ul.create,fce=Xs.createWithPreprocess,dce=DE.create,hce=()=>oR().optional(),pce=()=>cR().optional(),gce=()=>uR().optional(),mce={string:t=>Th.create({...t,coerce:!0}),number:t=>Jp.create({...t,coerce:!0}),boolean:t=>Qp.create({...t,coerce:!0}),bigint:t=>Xp.create({...t,coerce:!0}),date:t=>Yp.create({...t,coerce:!0})},vce=ht,Ae=Object.freeze({__proto__:null,defaultErrorMap:Gp,setErrorMap:woe,getErrorMap:qv,makeIssue:Kv,EMPTY_PATH:Eoe,addIssueToContext:Ge,ParseStatus:ui,INVALID:ht,DIRTY:JN,OK:Vn,isAborted:D3,isDirty:O3,isValid:Zp,isAsync:Wv,get util(){return Dt},get objectUtil(){return R3},ZodParsedType:We,getParsedType:xc,ZodType:mt,ZodString:Th,ZodNumber:Jp,ZodBigInt:Xp,ZodBoolean:Qp,ZodDate:Yp,ZodSymbol:Gv,ZodUndefined:eg,ZodNull:tg,ZodAny:Nh,ZodUnknown:Al,ZodNever:$o,ZodVoid:Zv,ZodArray:jl,ZodObject:fs,ZodUnion:rg,ZodDiscriminatedUnion:QN,ZodIntersection:ng,ZodTuple:ou,ZodRecord:tR,ZodMap:Jv,ZodSet:Xv,ZodFunction:rR,ZodLazy:ig,ZodLiteral:sg,ZodEnum:r1,ZodNativeEnum:ag,ZodPromise:Rh,ZodEffects:Xs,ZodTransformer:Xs,ZodOptional:Io,ZodNullable:Ul,ZodDefault:og,ZodCatch:Qv,ZodNaN:Yv,BRAND:Roe,ZodBranded:iR,ZodPipeline:DE,ZodReadonly:ey,custom:aR,Schema:mt,ZodSchema:mt,late:Doe,get ZodFirstPartyTypeKind(){return lt},coerce:mce,any:Hoe,array:Woe,bigint:Loe,boolean:uR,date:joe,discriminatedUnion:Xoe,effect:dC,enum:ace,function:nce,instanceof:Ooe,intersection:Qoe,lazy:ice,literal:sce,map:tce,nan:Moe,nativeEnum:oce,never:qoe,null:zoe,nullable:lce,number:cR,object:Goe,oboolean:gce,onumber:pce,optional:uce,ostring:hce,pipeline:dce,preprocess:fce,promise:cce,record:ece,set:rce,strictObject:Zoe,string:oR,symbol:Uoe,transformer:dC,tuple:Yoe,undefined:$oe,union:Joe,unknown:Voe,void:Koe,NEVER:vce,ZodIssueCode:Ue,quotelessJson:boe,ZodError:ss});function yce({fetch:t,GATEWAY_URL:e}){let r=` + query GetTransactions ($transactionIds: [ID!]!) { + transactions(ids: $transactionIds) { + edges { + node { + owner { + address + } + tags { + name + value + } + block { + id + height + timestamp + } + } + } + } + }`,n=Ae.object({data:Ae.object({transactions:Ae.object({edges:Ae.array(Ae.object({node:Ae.record(Ae.any())}))})})});return i=>xt(i).chain(Qt(s=>t(`${e}/graphql`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:r,variables:{transactionIds:[s]}})}).then(a=>a.json()).then(n.parse).then(doe(["data","transactions","edges","0","node"])))).toPromise()}var xce=pN($ne(),1),lR=(t="@permaweb/aoconnect")=>{let e=(0,xce.default)(t);return e.child=r=>lR(`${e.namespace}:${r}`),e.tap=(r,...n)=>xoe((...i)=>e(r,...n,...i)),e};function fR(t){return Ph(D2([]),Fh((e,r)=>Ph(goe([],r.name),TE(r.value),Js(r.name,Uo,e))(e),{}),N2(e=>e.length>1?e:e[0]))(t)}function Yi(t,e){return r=>MN(Sae([lC(t,"name"),RE(PE(e),lC(e,"value"),BE)]),r)}function ty(t){return WN([[lp(String),id(t)],[lp(Array),roe(t)],[BE,Tse]])}function dR(t=""){return t.endsWith("/")?dR(t.slice(0,-1)):t}function t0(t){let e;return lp(ss,t)?(e=new Error(bce(t)),e.stack+=t.stack):lp(Error,t)?e=t:Yae("message",t)?e=new Error(t.message):lp(String,t)?e=new Error(t):e=new Error("An error occurred"),e}function bce(t){return Ph(e=>function r(n,i,s){return Fh((a,o)=>Ph(WN([[id(Ue.invalid_arguments),()=>r(o.argumentsError,422,"Invalid Arguments")],[id(Ue.invalid_return_type),()=>r(o.returnTypeError,500,"Invalid Return")],[id(Ue.invalid_union),()=>jae(c=>r(c,400,"Invalid Union"),o.unionErrors)],[BE,()=>[{...o,status:i,contextCode:s}]]]),NE(a))(o.code),[],n.issues)}(e,400,""),e=>Fh((r,n)=>{let{message:i,path:s,contextCode:a}=n,o=s[1]||s[0],c=a?`${a} `:"";return r.push(`${c}'${o}': ${i}.`),r},[],e),coe(" | "))(t)}var wce=Ae.object({id:Ae.string().min(1,{message:"message is required to be a message id"}),processId:Ae.string().min(1,{message:"process is required to be a process id"})});function Ece(){return t=>xt(t).map(wce.parse).map(()=>t)}var n1=Ae.object({name:Ae.string(),value:Ae.string()}),Sce=Ae.function().args(Ae.object({Id:Ae.string(),Target:Ae.string(),Owner:Ae.string(),Anchor:Ae.string().optional(),Data:Ae.any().default("1234"),Tags:Ae.array(Ae.object({name:Ae.string(),value:Ae.string()}))})).returns(Ae.promise(Ae.any())),Ace=Ae.function().args(Ae.object({id:Ae.string().min(1,{message:"message id is required"}),processId:Ae.string().min(1,{message:"process id is required"})})).returns(Ae.promise(Ae.any())),Cce=Ae.function().args(Ae.object({process:Ae.string().min(1,{message:"process id is required"}),from:Ae.string().optional(),to:Ae.string().optional(),sort:Ae.enum(["ASC","DESC"]).default("ASC"),limit:Ae.string().optional()})).returns(Ae.promise(Ae.object({edges:Ae.array(Ae.object({cursor:Ae.string(),node:Ae.object({Output:Ae.any().optional(),Messages:Ae.array(Ae.any()).optional(),Spawns:Ae.array(Ae.any()).optional(),Error:Ae.any().optional()})}))}))),hR=Ae.function().args(Ae.object({processId:Ae.string(),data:Ae.any(),tags:Ae.array(n1),anchor:Ae.string().optional(),signer:Ae.any()})).returns(Ae.promise(Ae.object({messageId:Ae.string()}).passthrough())),_ce=Ae.function().args(Ae.object({data:Ae.any(),tags:Ae.array(n1),signer:Ae.any()})).returns(Ae.promise(Ae.object({processId:Ae.string()}).passthrough())),pR=hR,kce=Ae.function().args(Ae.object({suUrl:Ae.string().url(),processId:Ae.string()})).returns(Ae.promise(Ae.object({tags:Ae.array(n1)}).passthrough())),Bce=Ae.function().args(Ae.string()).returns(Ae.promise(Ae.object({url:Ae.string()}))),Ice=Ae.function().args(Ae.string()).returns(Ae.promise(Ae.boolean())),Fce=Ae.function().args(Ae.string()).returns(Ae.promise(Ae.object({tags:Ae.array(n1)}).passthrough())),O2=Ae.function().args(Ae.object({data:Ae.any(),tags:Ae.array(n1),target:Ae.string().optional(),anchor:Ae.string().optional()})).returns(Ae.promise(Ae.object({id:Ae.string(),raw:Ae.any()})));function Pce({loadResult:t}){return t=Qt(Ace.implement(t)),e=>xt({id:e.id,processId:e.processId}).chain(t)}function Tce(t){let e=Ece(),r=Pce(t);return({message:n,process:i})=>xt({id:n,processId:i}).chain(e).chain(r).map(t.logger.tap('readResult result for message "%s": %O',n)).map(s=>s).bimap(t0,e0).toPromise()}function Nce({loadProcessMeta:t,locateScheduler:e,logger:r}){let n=(i,s,a)=>o=>s(o[i])?au(o):wu(`Tag '${i}': ${a}`);return t=Qt(kce.implement(t)),e=Qt(Bce.implement(e)),i=>xt(i).map(r.tap("Verifying Process")).map(r.tap("Locating Scheduler for Process to retrieve Process meta")).chain(e).chain(({url:s})=>t({suUrl:dR(s),processId:i})).map(Eu("tags")).map(fR).chain(n("Data-Protocol",ty("ao"),"value 'ao' was not found on process")).chain(n("Type",ty("Process"),"value 'Process' was not found on process")).chain(n("Module",Bm,"was not found on process"))}function OE(t){let e=Nce(t);return r=>xt(r.id).chain(e).map(()=>r)}var Rce=Ae.array(Ae.object({name:Ae.string(),value:Ae.string()}));function Dce(){return t=>xt(t.tags).map(D2([])).map(Yi("Data-Protocol","ao")).map(Yi("Variant")).map(Yi("Type")).map(Yi("SDK")).map(NE(Uo,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Message"},{name:"SDK",value:"aoconnect"}])).map(Rce.parse).map(Js("tags",Uo,t))}function Oce({logger:t}){return e=>xt(e).chain(RE(PE(e.data),()=>au(e),()=>au(Math.random().toString().slice(-4)).map(Js("data",Uo,e)).map(r=>Ph(Eu("tags"),Yi("Content-Type"),TE({name:"Content-Type",value:"text/plain"}),Js("tags",Uo,r))(r)).map(t.tap('added pseudo-random string as message "data"'))))}function Mce(t){let e=Dce(),r=Oce(t),n=hR.implement(t.deployMessage);return i=>xt(i).chain(e).chain(r).chain(Qt(({id:s,data:a,tags:o,anchor:c,signer:u})=>n({processId:s,data:a,tags:o,anchor:c,signer:O2.implement(u)}))).map(s=>Js("messageId",s.messageId,i))}function Lce(t){let e=OE(t),r=Mce(t);return({process:n,data:i,tags:s,anchor:a,signer:o})=>xt({id:n,data:i,tags:s,anchor:a,signer:o}).chain(e).chain(r).map(c=>c.messageId).bimap(t0,e0).toPromise()}var I0=(t,e,r)=>n=>e(n[t])?au(n):wu(`Tag '${t}': ${r}`);function jce({loadTransactionMeta:t,logger:e}){return t=Qt(Fce.implement(t)),r=>xt(r).chain(t).map(Eu("tags")).map(fR).chain(I0("Data-Protocol",ty("ao"),"value 'ao' was not found on module")).chain(I0("Type",ty("Module"),"value 'Module' was not found on module")).chain(I0("Module-Format",Bm,"was not found on module")).chain(I0("Input-Encoding",Bm,"was not found on module")).chain(I0("Output-Encoding",Bm,"was not found on module")).bimap(e.tap("Verifying module source failed: %s"),e.tap("Verified module source"))}function Uce({logger:t,validateScheduler:e}){return e=Qt(Ice.implement(e)),r=>xt(r).chain(n=>e(n).chain(i=>i?au(n):wu(`Valid Scheduler-Location owned by ${n} not found`))).bimap(t.tap("Verifying scheduler failed: %s"),t.tap("Verified scheduler"))}function $ce({logger:t}){return e=>xt(e).map(t.tap("Checking for signer")).chain(r=>r?au(r):wu("signer not found"))}function zce(t){let e=t.logger.child("verifyInput");t={...t,logger:e};let r=jce(t),n=Uce(t),i=$ce(t);return s=>xt(s).chain(a=>r(a.module).map(()=>a)).chain(a=>n(a.scheduler)).map(()=>s).chain(a=>i(a.signer).map(()=>a)).bimap(e.tap("Error when verify input: %s"),e.tap("Successfully verified inputs"))}var Hce=Ae.array(Ae.object({name:Ae.string(),value:Ae.string()}));function Vce(){return t=>xt(t).map(Eu("tags")).map(D2([])).map(Yi("Data-Protocol","ao")).map(Yi("Variant")).map(Yi("Type")).map(Yi("Module")).map(Yi("Scheduler")).map(Yi("SDK")).map(NE(Uo,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Process"},{name:"Module",value:t.module},{name:"Scheduler",value:t.scheduler},{name:"SDK",value:"aoconnect"}])).map(Hce.parse).map(Js("tags",Uo,t))}function qce({logger:t}){return e=>xt(e).chain(RE(PE(e.data),()=>au(e),()=>au(Math.random().toString().slice(-4)).map(Js("data",Uo,e)).map(r=>Ph(Eu("tags"),Yi("Content-Type"),TE({name:"Content-Type",value:"text/plain"}),Js("tags",Uo,r))(r)).map(t.tap('added pseudo-random string as process "data"'))))}function Kce(t){let e=t.logger.child("uploadProcess");t={...t,logger:e};let r=Vce(),n=qce(t),i=_ce.implement(t.deployProcess);return s=>xt(s).chain(r).chain(n).chain(Qt(({data:a,tags:o,signer:c})=>i({data:a,tags:o,signer:O2.implement(c)}))).map(a=>Js("processId",a.processId,s))}function Wce(t){let e=zce(t),r=Kce(t);return({module:n,scheduler:i,signer:s,tags:a,data:o})=>xt({module:n,scheduler:i,signer:s,tags:a,data:o}).chain(e).chain(r).map(c=>c.processId).bimap(t0,e0).toPromise()}function Gce(t){let e=pR.implement(t.deployMonitor);return r=>xt(r).chain(Qt(({id:n,signer:i})=>e({processId:n,signer:O2.implement(i),data:Math.random().toString().slice(-4),tags:[]}))).map(n=>Js("monitorId",n.messageId,r))}function Zce(t){let e=OE(t),r=Gce(t);return({process:n,signer:i})=>xt({id:n,signer:i}).chain(e).chain(r).map(s=>s.monitorId).bimap(t0,e0).toPromise()}function Jce(t){let e=pR.implement(t.deployUnmonitor);return r=>xt(r).chain(Qt(({id:n,signer:i})=>e({processId:n,signer:O2.implement(i),data:Math.random().toString().slice(-4),tags:[]}))).map(n=>Js("monitorId",n.messageId,r))}function Xce(t){let e=OE(t),r=Jce(t);return({process:n,signer:i})=>xt({id:n,signer:i}).chain(e).chain(r).map(s=>s.monitorId).bimap(t0,e0).toPromise()}var Qce=Ae.object({process:Ae.string().min(1,{message:"process identifier is required"}),from:Ae.string().optional(),to:Ae.string().optional(),sort:Ae.enum(["ASC","DESC"]).default("ASC"),limit:Ae.string().optional()});function Yce(){return t=>xt(t).map(Qce.parse).map(()=>t)}function eue({queryResults:t}){return t=Qt(Cce.implement(t)),e=>xt({process:e.process,from:e.from,to:e.to,sort:e.sort}).chain(t)}function tue(t){let e=Yce(),r=eue(t);return({process:n,from:i,to:s,sort:a})=>xt({process:n,from:i,to:s,sort:a}).chain(e).chain(r).map(t.logger.tap('readResults result for message "%s": %O',n)).map(o=>o).bimap(t0,e0).toPromise()}var rue=Ae.object({Id:Ae.string(),Target:Ae.string(),Owner:Ae.string(),Anchor:Ae.string().optional(),Data:Ae.any().default("1234"),Tags:Ae.array(Ae.object({name:Ae.string(),value:Ae.string()}))});function nue(){return t=>xt(t).map(rue.parse).map(e=>(e.Tags=e.Tags.concat([{name:"Data-Protocol",value:"ao"},{name:"Type",value:"Message"},{name:"Variant",value:"ao.TN.1"}]),e))}function iue({dryrunFetch:t}){return Qt(Sce.implement(t))}function sue(t){let e=nue(),r=iue(t);return n=>xt(n).map(aue).chain(e).chain(r).toPromise()}function aue({process:t,data:e,tags:r,anchor:n,...i}){return{Id:"1234",Owner:"1234",...i,Target:t,Data:e||"1234",Tags:r||[],Anchor:n||"0"}}var oue="https://arweave.net",cue="https://mu.ao-testnet.xyz",uue="https://cu.ao-testnet.xyz";function $l({GATEWAY_URL:t=oue,MU_URL:e=cue,CU_URL:r=uue}={}){let n=lR("@permaweb/ao-sdk"),{locate:i,validate:s}=NN({cacheSize:100,GATEWAY_URL:t}),a=n.child("result"),o=Tce({loadResult:Ise({fetch,CU_URL:r,logger:a}),logger:a}),c=n.child("message"),u=Lce({loadProcessMeta:sw({fetch}),locateScheduler:i,deployMessage:Ase({fetch,MU_URL:e,logger:c}),logger:c}),l=n.child("spawn"),f=Wce({loadTransactionMeta:yce({fetch,GATEWAY_URL:t}),validateScheduler:s,deployProcess:Cse({fetch,MU_URL:e,logger:l}),logger:l}),d=n.child("monitor"),p=Zce({loadProcessMeta:sw({fetch}),locateScheduler:i,deployMonitor:_se({fetch,MU_URL:e,logger:d}),logger:d}),h=n.child("unmonitor"),g=Xce({loadProcessMeta:sw({fetch}),locateScheduler:i,deployUnmonitor:kse({fetch,MU_URL:e,logger:h}),logger:d}),v=n.child("results"),x=tue({queryResults:Fse({fetch,CU_URL:r,logger:v}),logger:v}),b=n.child("dryrun"),S=sue({dryrunFetch:Bse({fetch,CU_URL:r,logger:b}),logger:b});return{result:o,results:x,message:u,spawn:f,monitor:p,unmonitor:g,dryrun:S}}var gR={};Mne(gR,{createDataItemSigner:()=>Oue});var mR=pN(Vne(),1),lue=Object.create,ME=Object.defineProperty,fue=Object.getOwnPropertyDescriptor,due=Object.getOwnPropertyNames,hue=Object.getPrototypeOf,pue=Object.prototype.hasOwnProperty,Zo=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),gue=(t,e)=>{for(var r in e)ME(t,r,{get:e[r],enumerable:!0})},mue=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of due(e))!pue.call(t,i)&&i!==r&&ME(t,i,{get:()=>e[i],enumerable:!(n=fue(e,i))||n.enumerable});return t},tf=(t,e,r)=>(r=t!=null?lue(hue(t)):{},mue(e||!t||!t.__esModule?ME(r,"default",{value:t,enumerable:!0}):r,t)),vue=Zo(t=>{Object.defineProperty(t,"__esModule",{value:!0});function e(r){var n=4,i=r.length,s=i%n;if(!s)return r;var a=i,o=n-s,c=i+o,u=Buffer.alloc(c);for(u.write(r);o--;)u.write("=",a++);return u.toString()}t.default=e}),yue=Zo(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=vue();function r(c,u){return u===void 0&&(u="utf8"),Buffer.isBuffer(c)?s(c.toString("base64")):s(Buffer.from(c,u).toString("base64"))}function n(c,u){return u===void 0&&(u="utf8"),Buffer.from(i(c),"base64").toString(u)}function i(c){return c=c.toString(),e.default(c).replace(/\-/g,"+").replace(/_/g,"/")}function s(c){return c.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function a(c){return Buffer.from(i(c),"base64")}var o=r;o.encode=r,o.decode=n,o.toBase64=i,o.fromBase64=s,o.toBuffer=a,t.default=o}),LE=Zo((t,e)=>{e.exports=yue().default,e.exports.default=e.exports}),vR=Zo(t=>{t.byteLength=c,t.toByteArray=l,t.fromByteArray=p;var e=[],r=[],n=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(s=0,a=i.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var v=h.indexOf("=");v===-1&&(v=g);var x=v===g?0:4-v%4;return[v,x]}function c(h){var g=o(h),v=g[0],x=g[1];return(v+x)*3/4-x}function u(h,g,v){return(g+v)*3/4-v}function l(h){var g,v=o(h),x=v[0],b=v[1],S=new n(u(h,x,b)),_=0,P=b>0?x-4:x,C;for(C=0;C>16&255,S[_++]=g>>8&255,S[_++]=g&255;return b===2&&(g=r[h.charCodeAt(C)]<<2|r[h.charCodeAt(C+1)]>>4,S[_++]=g&255),b===1&&(g=r[h.charCodeAt(C)]<<10|r[h.charCodeAt(C+1)]<<4|r[h.charCodeAt(C+2)]>>2,S[_++]=g>>8&255,S[_++]=g&255),S}function f(h){return e[h>>18&63]+e[h>>12&63]+e[h>>6&63]+e[h&63]}function d(h,g,v){for(var x,b=[],S=g;SP?P:_+S));return x===1?(g=h[v-1],b.push(e[g>>2]+e[g<<4&63]+"==")):x===2&&(g=(h[v-2]<<8)+h[v-1],b.push(e[g>>10]+e[g>>4&63]+e[g<<2&63]+"=")),b.join("")}}),yR=Zo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var e=vR();function r(d){let p=0;for(let v=0;v{Object.defineProperty(t,"__esModule",{value:!0});var e=yR(),r=class{constructor(){se(this,"keyLength",4096);se(this,"publicExponent",65537);se(this,"hashAlgorithm","sha256");se(this,"driver");if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let n=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),i=await this.driver.exportKey("jwk",n.privateKey);return{kty:i.kty,e:i.e,n:i.n,d:i.d,p:i.p,q:i.q,dp:i.dp,dq:i.dq,qi:i.qi}}async sign(n,i,{saltLength:s}={}){let a=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(n),i);return new Uint8Array(a)}async hash(n,i="SHA-256"){let s=await this.driver.digest(i,n);return new Uint8Array(s)}async verify(n,i,s){let a={kty:"RSA",e:"AQAB",n},o=await this.jwkToPublicCryptoKey(a),c=await this.driver.digest("SHA-256",i),u=await this.driver.verify({name:"RSA-PSS",saltLength:0},o,s,i),l=await this.driver.verify({name:"RSA-PSS",saltLength:32},o,s,i),f=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((o.algorithm.modulusLength-1)/8)-c.byteLength-2},o,s,i);return u||l||f}async jwkToCryptoKey(n){return this.driver.importKey("jwk",n,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(n){return this.driver.importKey("jwk",n,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let n=crypto==null?void 0:crypto.subtle;return n===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(i=>typeof n[i]=="function")}async encrypt(n,i,s){let a=await this.driver.importKey("raw",typeof i=="string"?e.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:s?e.stringToBuffer(s):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},a,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),c=new Uint8Array(16);crypto.getRandomValues(c);let u=await this.driver.encrypt({name:"AES-CBC",iv:c},o,n);return e.concatBuffers([c,u])}async decrypt(n,i,s){let a=await this.driver.importKey("raw",typeof i=="string"?e.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:s?e.stringToBuffer(s):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},a,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),c=n.slice(0,16),u=await this.driver.decrypt({name:"AES-CBC",iv:c},o,n.slice(16));return e.concatBuffers([u])}};t.default=r}),bue=Zo(t=>{t.read=function(e,r,n,i,s){var a,o,c=s*8-i-1,u=(1<>1,f=-7,d=n?s-1:0,p=n?-1:1,h=e[r+d];for(d+=p,a=h&(1<<-f)-1,h>>=-f,f+=c;f>0;a=a*256+e[r+d],d+=p,f-=8);for(o=a&(1<<-f)-1,a>>=-f,f+=i;f>0;o=o*256+e[r+d],d+=p,f-=8);if(a===0)a=1-l;else{if(a===u)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,i),a=a-l}return(h?-1:1)*o*Math.pow(2,a-i)},t.write=function(e,r,n,i,s,a){var o,c,u,l=a*8-s-1,f=(1<>1,p=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:a-1,g=i?1:-1,v=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,o=f):(o=Math.floor(Math.log(r)/Math.LN2),r*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?r+=p/u:r+=p*Math.pow(2,1-d),r*u>=2&&(o++,u/=2),o+d>=f?(c=0,o=f):o+d>=1?(c=(r*u-1)*Math.pow(2,s),o=o+d):(c=r*Math.pow(2,d-1)*Math.pow(2,s),o=0));s>=8;e[n+h]=c&255,h+=g,c/=256,s-=8);for(o=o<0;e[n+h]=o&255,h+=g,o/=256,l-=8);e[n+h-g]|=v*128}}),H3=Zo(t=>{var e=vR(),r=bue(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=o,t.SlowBuffer=b,t.INSPECT_MAX_BYTES=50;var i=2147483647;t.kMaxLength=i,o.TYPED_ARRAY_SUPPORT=s(),!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 s(){try{let m=new Uint8Array(1),y={foo:function(){return 42}};return Object.setPrototypeOf(y,Uint8Array.prototype),Object.setPrototypeOf(m,y),m.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 a(m){if(m>i)throw new RangeError('The value "'+m+'" is invalid for option "size"');let y=new Uint8Array(m);return Object.setPrototypeOf(y,o.prototype),y}function o(m,y,w){if(typeof m=="number"){if(typeof y=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f(m)}return c(m,y,w)}o.poolSize=8192;function c(m,y,w){if(typeof m=="string")return d(m,y);if(ArrayBuffer.isView(m))return h(m);if(m==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m);if(re(m,ArrayBuffer)||m&&re(m.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(re(m,SharedArrayBuffer)||m&&re(m.buffer,SharedArrayBuffer)))return g(m,y,w);if(typeof m=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let M=m.valueOf&&m.valueOf();if(M!=null&&M!==m)return o.from(M,y,w);let z=v(m);if(z)return z;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof m[Symbol.toPrimitive]=="function")return o.from(m[Symbol.toPrimitive]("string"),y,w);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m)}o.from=function(m,y,w){return c(m,y,w)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function u(m){if(typeof m!="number")throw new TypeError('"size" argument must be of type number');if(m<0)throw new RangeError('The value "'+m+'" is invalid for option "size"')}function l(m,y,w){return u(m),m<=0?a(m):y!==void 0?typeof w=="string"?a(m).fill(y,w):a(m).fill(y):a(m)}o.alloc=function(m,y,w){return l(m,y,w)};function f(m){return u(m),a(m<0?0:x(m)|0)}o.allocUnsafe=function(m){return f(m)},o.allocUnsafeSlow=function(m){return f(m)};function d(m,y){if((typeof y!="string"||y==="")&&(y="utf8"),!o.isEncoding(y))throw new TypeError("Unknown encoding: "+y);let w=S(m,y)|0,M=a(w),z=M.write(m,y);return z!==w&&(M=M.slice(0,z)),M}function p(m){let y=m.length<0?0:x(m.length)|0,w=a(y);for(let M=0;M=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return m|0}function b(m){return+m!=m&&(m=0),o.alloc(+m)}o.isBuffer=function(m){return m!=null&&m._isBuffer===!0&&m!==o.prototype},o.compare=function(m,y){if(re(m,Uint8Array)&&(m=o.from(m,m.offset,m.byteLength)),re(y,Uint8Array)&&(y=o.from(y,y.offset,y.byteLength)),!o.isBuffer(m)||!o.isBuffer(y))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(m===y)return 0;let w=m.length,M=y.length;for(let z=0,G=Math.min(w,M);zM.length?(o.isBuffer(G)||(G=o.from(G)),G.copy(M,z)):Uint8Array.prototype.set.call(M,G,z);else if(o.isBuffer(G))G.copy(M,z);else throw new TypeError('"list" argument must be an Array of Buffers');z+=G.length}return M};function S(m,y){if(o.isBuffer(m))return m.length;if(ArrayBuffer.isView(m)||re(m,ArrayBuffer))return m.byteLength;if(typeof m!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof m);let w=m.length,M=arguments.length>2&&arguments[2]===!0;if(!M&&w===0)return 0;let z=!1;for(;;)switch(y){case"ascii":case"latin1":case"binary":return w;case"utf8":case"utf-8":return Y(m).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w*2;case"hex":return w>>>1;case"base64":return xe(m).length;default:if(z)return M?-1:Y(m).length;y=(""+y).toLowerCase(),z=!0}}o.byteLength=S;function _(m,y,w){let M=!1;if((y===void 0||y<0)&&(y=0),y>this.length||((w===void 0||w>this.length)&&(w=this.length),w<=0)||(w>>>=0,y>>>=0,w<=y))return"";for(m||(m="utf8");;)switch(m){case"hex":return H(this,y,w);case"utf8":case"utf-8":return A(this,y,w);case"ascii":return $(this,y,w);case"latin1":case"binary":return W(this,y,w);case"base64":return F(this,y,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,y,w);default:if(M)throw new TypeError("Unknown encoding: "+m);m=(m+"").toLowerCase(),M=!0}}o.prototype._isBuffer=!0;function P(m,y,w){let M=m[y];m[y]=m[w],m[w]=M}o.prototype.swap16=function(){let m=this.length;if(m%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let y=0;yy&&(m+=" ... "),""},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(m,y,w,M,z){if(re(m,Uint8Array)&&(m=o.from(m,m.offset,m.byteLength)),!o.isBuffer(m))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof m);if(y===void 0&&(y=0),w===void 0&&(w=m?m.length:0),M===void 0&&(M=0),z===void 0&&(z=this.length),y<0||w>m.length||M<0||z>this.length)throw new RangeError("out of range index");if(M>=z&&y>=w)return 0;if(M>=z)return-1;if(y>=w)return 1;if(y>>>=0,w>>>=0,M>>>=0,z>>>=0,this===m)return 0;let G=z-M,Z=w-y,Se=Math.min(G,Z),Ve=this.slice(M,z),Pe=m.slice(y,w);for(let Te=0;Te2147483647?w=2147483647:w<-2147483648&&(w=-2147483648),w=+w,ke(w)&&(w=z?0:m.length-1),w<0&&(w=m.length+w),w>=m.length){if(z)return-1;w=m.length-1}else if(w<0)if(z)w=0;else return-1;if(typeof y=="string"&&(y=o.from(y,M)),o.isBuffer(y))return y.length===0?-1:B(m,y,w,M,z);if(typeof y=="number")return y=y&255,typeof Uint8Array.prototype.indexOf=="function"?z?Uint8Array.prototype.indexOf.call(m,y,w):Uint8Array.prototype.lastIndexOf.call(m,y,w):B(m,[y],w,M,z);throw new TypeError("val must be string, number or Buffer")}function B(m,y,w,M,z){let G=1,Z=m.length,Se=y.length;if(M!==void 0&&(M=String(M).toLowerCase(),M==="ucs2"||M==="ucs-2"||M==="utf16le"||M==="utf-16le")){if(m.length<2||y.length<2)return-1;G=2,Z/=2,Se/=2,w/=2}function Ve(Te,ze){return G===1?Te[ze]:Te.readUInt16BE(ze*G)}let Pe;if(z){let Te=-1;for(Pe=w;PeZ&&(w=Z-Se),Pe=w;Pe>=0;Pe--){let Te=!0;for(let ze=0;zez&&(M=z)):M=z;let G=y.length;M>G/2&&(M=G/2);let Z;for(Z=0;Z>>0,isFinite(w)?(w=w>>>0,M===void 0&&(M="utf8")):(M=w,w=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let z=this.length-y;if((w===void 0||w>z)&&(w=z),m.length>0&&(w<0||y<0)||y>this.length)throw new RangeError("Attempt to write outside buffer bounds");M||(M="utf8");let G=!1;for(;;)switch(M){case"hex":return N(this,m,y,w);case"utf8":case"utf-8":return T(this,m,y,w);case"ascii":case"latin1":case"binary":return D(this,m,y,w);case"base64":return R(this,m,y,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,m,y,w);default:if(G)throw new TypeError("Unknown encoding: "+M);M=(""+M).toLowerCase(),G=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function F(m,y,w){return y===0&&w===m.length?e.fromByteArray(m):e.fromByteArray(m.slice(y,w))}function A(m,y,w){w=Math.min(m.length,w);let M=[],z=y;for(;z239?4:G>223?3:G>191?2:1;if(z+Se<=w){let Ve,Pe,Te,ze;switch(Se){case 1:G<128&&(Z=G);break;case 2:Ve=m[z+1],(Ve&192)===128&&(ze=(G&31)<<6|Ve&63,ze>127&&(Z=ze));break;case 3:Ve=m[z+1],Pe=m[z+2],(Ve&192)===128&&(Pe&192)===128&&(ze=(G&15)<<12|(Ve&63)<<6|Pe&63,ze>2047&&(ze<55296||ze>57343)&&(Z=ze));break;case 4:Ve=m[z+1],Pe=m[z+2],Te=m[z+3],(Ve&192)===128&&(Pe&192)===128&&(Te&192)===128&&(ze=(G&15)<<18|(Ve&63)<<12|(Pe&63)<<6|Te&63,ze>65535&&ze<1114112&&(Z=ze))}}Z===null?(Z=65533,Se=1):Z>65535&&(Z-=65536,M.push(Z>>>10&1023|55296),Z=56320|Z&1023),M.push(Z),z+=Se}return j(M)}var I=4096;function j(m){let y=m.length;if(y<=I)return String.fromCharCode.apply(String,m);let w="",M=0;for(;MM)&&(w=M);let z="";for(let G=y;Gw&&(m=w),y<0?(y+=w,y<0&&(y=0)):y>w&&(y=w),yw)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(m,y,w){m=m>>>0,y=y>>>0,w||L(m,y,this.length);let M=this[m],z=1,G=0;for(;++G>>0,y=y>>>0,w||L(m,y,this.length);let M=this[m+--y],z=1;for(;y>0&&(z*=256);)M+=this[m+--y]*z;return M},o.prototype.readUint8=o.prototype.readUInt8=function(m,y){return m=m>>>0,y||L(m,1,this.length),this[m]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(m,y){return m=m>>>0,y||L(m,2,this.length),this[m]|this[m+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(m,y){return m=m>>>0,y||L(m,2,this.length),this[m]<<8|this[m+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(m,y){return m=m>>>0,y||L(m,4,this.length),(this[m]|this[m+1]<<8|this[m+2]<<16)+this[m+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(m,y){return m=m>>>0,y||L(m,4,this.length),this[m]*16777216+(this[m+1]<<16|this[m+2]<<8|this[m+3])},o.prototype.readBigUInt64LE=ge(function(m){m=m>>>0,De(m,"offset");let y=this[m],w=this[m+7];(y===void 0||w===void 0)&&V(m,this.length-8);let M=y+this[++m]*2**8+this[++m]*2**16+this[++m]*2**24,z=this[++m]+this[++m]*2**8+this[++m]*2**16+w*2**24;return BigInt(M)+(BigInt(z)<>>0,De(m,"offset");let y=this[m],w=this[m+7];(y===void 0||w===void 0)&&V(m,this.length-8);let M=y*2**24+this[++m]*2**16+this[++m]*2**8+this[++m],z=this[++m]*2**24+this[++m]*2**16+this[++m]*2**8+w;return(BigInt(M)<>>0,y=y>>>0,w||L(m,y,this.length);let M=this[m],z=1,G=0;for(;++G=z&&(M-=Math.pow(2,8*y)),M},o.prototype.readIntBE=function(m,y,w){m=m>>>0,y=y>>>0,w||L(m,y,this.length);let M=y,z=1,G=this[m+--M];for(;M>0&&(z*=256);)G+=this[m+--M]*z;return z*=128,G>=z&&(G-=Math.pow(2,8*y)),G},o.prototype.readInt8=function(m,y){return m=m>>>0,y||L(m,1,this.length),this[m]&128?(255-this[m]+1)*-1:this[m]},o.prototype.readInt16LE=function(m,y){m=m>>>0,y||L(m,2,this.length);let w=this[m]|this[m+1]<<8;return w&32768?w|4294901760:w},o.prototype.readInt16BE=function(m,y){m=m>>>0,y||L(m,2,this.length);let w=this[m+1]|this[m]<<8;return w&32768?w|4294901760:w},o.prototype.readInt32LE=function(m,y){return m=m>>>0,y||L(m,4,this.length),this[m]|this[m+1]<<8|this[m+2]<<16|this[m+3]<<24},o.prototype.readInt32BE=function(m,y){return m=m>>>0,y||L(m,4,this.length),this[m]<<24|this[m+1]<<16|this[m+2]<<8|this[m+3]},o.prototype.readBigInt64LE=ge(function(m){m=m>>>0,De(m,"offset");let y=this[m],w=this[m+7];(y===void 0||w===void 0)&&V(m,this.length-8);let M=this[m+4]+this[m+5]*2**8+this[m+6]*2**16+(w<<24);return(BigInt(M)<>>0,De(m,"offset");let y=this[m],w=this[m+7];(y===void 0||w===void 0)&&V(m,this.length-8);let M=(y<<24)+this[++m]*2**16+this[++m]*2**8+this[++m];return(BigInt(M)<>>0,y||L(m,4,this.length),r.read(this,m,!0,23,4)},o.prototype.readFloatBE=function(m,y){return m=m>>>0,y||L(m,4,this.length),r.read(this,m,!1,23,4)},o.prototype.readDoubleLE=function(m,y){return m=m>>>0,y||L(m,8,this.length),r.read(this,m,!0,52,8)},o.prototype.readDoubleBE=function(m,y){return m=m>>>0,y||L(m,8,this.length),r.read(this,m,!1,52,8)};function q(m,y,w,M,z,G){if(!o.isBuffer(m))throw new TypeError('"buffer" argument must be a Buffer instance');if(y>z||ym.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(m,y,w,M){if(m=+m,y=y>>>0,w=w>>>0,!M){let Z=Math.pow(2,8*w)-1;q(this,m,y,w,Z,0)}let z=1,G=0;for(this[y]=m&255;++G>>0,w=w>>>0,!M){let Z=Math.pow(2,8*w)-1;q(this,m,y,w,Z,0)}let z=w-1,G=1;for(this[y+z]=m&255;--z>=0&&(G*=256);)this[y+z]=m/G&255;return y+w},o.prototype.writeUint8=o.prototype.writeUInt8=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,1,255,0),this[y]=m&255,y+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,2,65535,0),this[y]=m&255,this[y+1]=m>>>8,y+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,2,65535,0),this[y]=m>>>8,this[y+1]=m&255,y+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,4,4294967295,0),this[y+3]=m>>>24,this[y+2]=m>>>16,this[y+1]=m>>>8,this[y]=m&255,y+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,4,4294967295,0),this[y]=m>>>24,this[y+1]=m>>>16,this[y+2]=m>>>8,this[y+3]=m&255,y+4};function ee(m,y,w,M,z){Fe(y,M,z,m,w,7);let G=Number(y&BigInt(4294967295));m[w++]=G,G=G>>8,m[w++]=G,G=G>>8,m[w++]=G,G=G>>8,m[w++]=G;let Z=Number(y>>BigInt(32)&BigInt(4294967295));return m[w++]=Z,Z=Z>>8,m[w++]=Z,Z=Z>>8,m[w++]=Z,Z=Z>>8,m[w++]=Z,w}function X(m,y,w,M,z){Fe(y,M,z,m,w,7);let G=Number(y&BigInt(4294967295));m[w+7]=G,G=G>>8,m[w+6]=G,G=G>>8,m[w+5]=G,G=G>>8,m[w+4]=G;let Z=Number(y>>BigInt(32)&BigInt(4294967295));return m[w+3]=Z,Z=Z>>8,m[w+2]=Z,Z=Z>>8,m[w+1]=Z,Z=Z>>8,m[w]=Z,w+8}o.prototype.writeBigUInt64LE=ge(function(m,y=0){return ee(this,m,y,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=ge(function(m,y=0){return X(this,m,y,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(m,y,w,M){if(m=+m,y=y>>>0,!M){let Se=Math.pow(2,8*w-1);q(this,m,y,w,Se-1,-Se)}let z=0,G=1,Z=0;for(this[y]=m&255;++z>0)-Z&255;return y+w},o.prototype.writeIntBE=function(m,y,w,M){if(m=+m,y=y>>>0,!M){let Se=Math.pow(2,8*w-1);q(this,m,y,w,Se-1,-Se)}let z=w-1,G=1,Z=0;for(this[y+z]=m&255;--z>=0&&(G*=256);)m<0&&Z===0&&this[y+z+1]!==0&&(Z=1),this[y+z]=(m/G>>0)-Z&255;return y+w},o.prototype.writeInt8=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,1,127,-128),m<0&&(m=255+m+1),this[y]=m&255,y+1},o.prototype.writeInt16LE=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,2,32767,-32768),this[y]=m&255,this[y+1]=m>>>8,y+2},o.prototype.writeInt16BE=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,2,32767,-32768),this[y]=m>>>8,this[y+1]=m&255,y+2},o.prototype.writeInt32LE=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,4,2147483647,-2147483648),this[y]=m&255,this[y+1]=m>>>8,this[y+2]=m>>>16,this[y+3]=m>>>24,y+4},o.prototype.writeInt32BE=function(m,y,w){return m=+m,y=y>>>0,w||q(this,m,y,4,2147483647,-2147483648),m<0&&(m=4294967295+m+1),this[y]=m>>>24,this[y+1]=m>>>16,this[y+2]=m>>>8,this[y+3]=m&255,y+4},o.prototype.writeBigInt64LE=ge(function(m,y=0){return ee(this,m,y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=ge(function(m,y=0){return X(this,m,y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ae(m,y,w,M,z,G){if(w+M>m.length)throw new RangeError("Index out of range");if(w<0)throw new RangeError("Index out of range")}function ve(m,y,w,M,z){return y=+y,w=w>>>0,z||ae(m,y,w,4),r.write(m,y,w,M,23,4),w+4}o.prototype.writeFloatLE=function(m,y,w){return ve(this,m,y,!0,w)},o.prototype.writeFloatBE=function(m,y,w){return ve(this,m,y,!1,w)};function de(m,y,w,M,z){return y=+y,w=w>>>0,z||ae(m,y,w,8),r.write(m,y,w,M,52,8),w+8}o.prototype.writeDoubleLE=function(m,y,w){return de(this,m,y,!0,w)},o.prototype.writeDoubleBE=function(m,y,w){return de(this,m,y,!1,w)},o.prototype.copy=function(m,y,w,M){if(!o.isBuffer(m))throw new TypeError("argument should be a Buffer");if(w||(w=0),!M&&M!==0&&(M=this.length),y>=m.length&&(y=m.length),y||(y=0),M>0&&M=this.length)throw new RangeError("Index out of range");if(M<0)throw new RangeError("sourceEnd out of bounds");M>this.length&&(M=this.length),m.length-y>>0,w=w===void 0?this.length:w>>>0,m||(m=0);let z;if(typeof m=="number")for(z=y;z2**32?z=_e(String(w)):typeof w=="bigint"&&(z=String(w),(w>BigInt(2)**BigInt(32)||w<-(BigInt(2)**BigInt(32)))&&(z=_e(z)),z+="n"),M+=` It must be ${y}. Received ${z}`,M},RangeError);function _e(m){let y="",w=m.length,M=m[0]==="-"?1:0;for(;w>=M+4;w-=3)y=`_${m.slice(w-3,w)}${y}`;return`${m.slice(0,w)}${y}`}function Me(m,y,w){De(y,"offset"),(m[y]===void 0||m[y+w]===void 0)&&V(y,m.length-(w+1))}function Fe(m,y,w,M,z,G){if(m>w||m3?y===0||y===BigInt(0)?Se=`>= 0${Z} and < 2${Z} ** ${(G+1)*8}${Z}`:Se=`>= -(2${Z} ** ${(G+1)*8-1}${Z}) and < 2 ** ${(G+1)*8-1}${Z}`:Se=`>= ${y}${Z} and <= ${w}${Z}`,new pe.ERR_OUT_OF_RANGE("value",Se,m)}Me(M,z,G)}function De(m,y){if(typeof m!="number")throw new pe.ERR_INVALID_ARG_TYPE(y,"number",m)}function V(m,y,w){throw Math.floor(m)!==m?(De(m,w),new pe.ERR_OUT_OF_RANGE(w||"offset","an integer",m)):y<0?new pe.ERR_BUFFER_OUT_OF_BOUNDS:new pe.ERR_OUT_OF_RANGE(w||"offset",`>= ${w?1:0} and <= ${y}`,m)}var le=/[^+/0-9A-Za-z-_]/g;function ce(m){if(m=m.split("=")[0],m=m.trim().replace(le,""),m.length<2)return"";for(;m.length%4!==0;)m=m+"=";return m}function Y(m,y){y=y||1/0;let w,M=m.length,z=null,G=[];for(let Z=0;Z55295&&w<57344){if(!z){if(w>56319){(y-=3)>-1&&G.push(239,191,189);continue}else if(Z+1===M){(y-=3)>-1&&G.push(239,191,189);continue}z=w;continue}if(w<56320){(y-=3)>-1&&G.push(239,191,189),z=w;continue}w=(z-55296<<10|w-56320)+65536}else z&&(y-=3)>-1&&G.push(239,191,189);if(z=null,w<128){if((y-=1)<0)break;G.push(w)}else if(w<2048){if((y-=2)<0)break;G.push(w>>6|192,w&63|128)}else if(w<65536){if((y-=3)<0)break;G.push(w>>12|224,w>>6&63|128,w&63|128)}else if(w<1114112){if((y-=4)<0)break;G.push(w>>18|240,w>>12&63|128,w>>6&63|128,w&63|128)}else throw new Error("Invalid code point")}return G}function J(m){let y=[];for(let w=0;w>8,z=w%256,G.push(z),G.push(M);return G}function xe(m){return e.toByteArray(ce(m))}function he(m,y,w,M){let z;for(z=0;z=y.length||z>=m.length);++z)y[z+w]=m[z];return z}function re(m,y){return m instanceof y||m!=null&&m.constructor!=null&&m.constructor.name!=null&&m.constructor.name===y.name}function ke(m){return m!==m}var be=function(){let m="0123456789abcdef",y=new Array(256);for(let w=0;w<16;++w){let M=w*16;for(let z=0;z<16;++z)y[M+z]=m[w]+m[z]}return y}();function ge(m){return typeof BigInt>"u"?Re:m}function Re(){throw new Error("BigInt not supported")}}),wue=Zo((t,e)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,e.exports={Buffer:H3().Buffer,Crypto:window.crypto}):e.exports={Buffer:H3().Buffer,Crypto:crypto}}),xR={};gue(xR,{AVSCTap:()=>M2,ArweaveSigner:()=>ER,DataItem:()=>ry,MAX_TAG_BYTES:()=>jE,MIN_BINARY_SIZE:()=>CR,SIG_CONFIG:()=>cg,SignatureConfig:()=>Si,Signer:()=>Eue,createData:()=>Nue,deserializeTags:()=>q3,indexToType:()=>SR,serializeTags:()=>AR,tagsExceedLimit:()=>Iue});var Eue=class{constructor(){se(this,"signer");se(this,"publicKey");se(this,"signatureType");se(this,"signatureLength");se(this,"ownerLength");se(this,"pem")}static verify(t,e,r,n){throw new Error("You must implement verify method on child")}},Sue=tf(LE(),1),Ls=tf(yR(),1);async function bR(t){if(Array.isArray(t)){let i=(0,Ls.concatBuffers)([(0,Ls.stringToBuffer)("list"),(0,Ls.stringToBuffer)(t.length.toString())]);return await wR(t,await So().hash(i,"SHA-384"))}let e=t,r=(0,Ls.concatBuffers)([(0,Ls.stringToBuffer)("blob"),(0,Ls.stringToBuffer)(e.byteLength.toString())]),n=(0,Ls.concatBuffers)([await So().hash(r,"SHA-384"),await So().hash(e,"SHA-384")]);return await So().hash(n,"SHA-384")}async function wR(t,e){if(t.length<1)return e;let r=(0,Ls.concatBuffers)([e,await bR(t[0])]),n=await So().hash(r,"SHA-384");return await wR(t.slice(1),n)}var uw=tf(xue(),1),Aue=uw.default.default?uw.default.default:uw.default,Cue=class extends Aue{getPublicKey(t){throw new Error("Unimplemented")}},_ue;function So(){return _ue??(_ue=new Cue)}var Si;(function(t){t[t.ARWEAVE=1]="ARWEAVE",t[t.ED25519=2]="ED25519",t[t.ETHEREUM=3]="ETHEREUM",t[t.SOLANA=4]="SOLANA",t[t.INJECTEDAPTOS=5]="INJECTEDAPTOS",t[t.MULTIAPTOS=6]="MULTIAPTOS",t[t.TYPEDETHEREUM=7]="TYPEDETHEREUM"})(Si||(Si={}));var cg={[Si.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[Si.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[Si.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[Si.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[Si.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[Si.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[Si.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},ER=class{constructor(t){se(this,"signatureType",1);se(this,"ownerLength",cg[1].pubLength);se(this,"signatureLength",cg[1].sigLength);se(this,"jwk");se(this,"pk");this.pk=t.n,this.jwk=t}get publicKey(){return Sue.default.toBuffer(this.pk)}sign(t){return So().sign(this.jwk,t)}static async verify(t,e,r){return await So().verify(t,e,r)}},SR={1:ER},oa=tf(LE(),1);async function V3(t){return bR([(0,Ls.stringToBuffer)("dataitem"),(0,Ls.stringToBuffer)("1"),(0,Ls.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}async function kue(t,e){let r=await V3(t),n=await e.sign(r),i=await So().hash(n);return{signature:Buffer.from(n),id:Buffer.from(i)}}async function Bue(t,e){let{signature:r,id:n}=await kue(t,e);return t.getRaw().set(r,2),n}var M2=class{constructor(t=Buffer.alloc(jE),e=0){se(this,"buf");se(this,"pos");this.buf=t,this.pos=e}writeTags(t){if(!Array.isArray(t))throw new Error("input must be array");let e=t.length,r;if(e)for(this.writeLong(e),r=0;rthis.buf.length)throw new Error(`Too many tag bytes (${this.pos} > ${this.buf.length})`);return this.buf.copy(t,0,0,this.pos),t}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(t){let e=this.buf,r,n;if(t>=-1073741824&&t<1073741824){n=t>=0?t<<1:~t<<1|1;do e[this.pos]=n&127,n>>=7;while(n&&(e[this.pos++]|=128))}else{r=t>=0?t*2:-t*2-1;do e[this.pos]=r&127,r/=128;while(r>=1&&(e[this.pos++]|=128))}this.pos++,this.buf=e}writeString(t){let e=Buffer.byteLength(t),r=this.buf;this.writeLong(e);let n=this.pos;if(this.pos+=e,!(this.pos>r.length)){if(e>64)this.buf.write(t,this.pos-e,e,"utf8");else{let i,s,a,o;for(i=0,s=e;i>6|192,r[n++]=a&63|128):(a&64512)===55296&&((o=t.charCodeAt(i+1))&64512)===56320?(a=65536+((a&1023)<<10)+(o&1023),i++,r[n++]=a>>18|240,r[n++]=a>>12&63|128,r[n++]=a>>6&63|128,r[n++]=a&63|128):(r[n++]=a>>12|224,r[n++]=a>>6&63|128,r[n++]=a&63|128)}this.buf=r}}readLong(){let t=0,e=0,r=this.buf,n,i,s,a;do n=r[this.pos++],i=n&128,t|=(n&127)<>1^-(t&1)}skipLong(){let t=this.buf;for(;t[this.pos++]&128;);}readTags(){let t=[],e;for(;e=this.readLong();)for(e<0&&(e=-e,this.skipLong());e--;){let r=this.readString(),n=this.readString();t.push({name:r,value:n})}return t}readString(){let t=this.readLong(),e=this.pos,r=this.buf;if(this.pos+=t,!(this.pos>r.length))return this.buf.slice(e,e+t).toString()}};function AR(t){let e=new M2;return e.writeTags(t),e.toBuffer()}function Iue(t){let e=new M2;return e.writeTags(t),e.tagsExceedLimit()}function q3(t){return new M2(t).readTags()}function cc(t){let e=0;for(let r=t.length-1;r>=0;r--)e=e*256+t[r];return e}function Fue(t){if(t>29)throw new Error("Short too long");let e=[0,0];for(let r=0;roa.default.encode(await this.rawId))()}set id(t){this._id=oa.default.toBuffer(t)}get rawId(){return(async()=>pf.Buffer.from(await Pue.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(t){this._id=t}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return oa.default.encode(this.rawSignature)}set rawOwner(t){if(t.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${t.byteLength} bytes.`);this.binary.set(t,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return cg[this.signatureType].sigLength}get owner(){return oa.default.encode(this.rawOwner)}get ownerLength(){return cg[this.signatureType].pubLength}get rawTarget(){let t=this.getTargetStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):pf.Buffer.alloc(0)}get target(){return oa.default.encode(this.rawTarget)}get rawAnchor(){let t=this.getAnchorStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):pf.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let t=this.getTagsStart(),e=cc(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){let t=this.getTagsStart();if(cc(this.binary.subarray(t,t+8))==0)return[];let e=cc(this.binary.subarray(t+8,t+16));return q3(pf.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map(t=>({name:oa.default.encode(t.name),value:oa.default.encode(t.value)}))}getStartOfData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=cc(e);return t+16+r}get rawData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=cc(e),n=t+16+r;return this.binary.subarray(n,this.binary.length)}get data(){return oa.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await Bue(this,t),this.rawId}async setSignature(t){this.binary.set(t,2),this._id=pf.Buffer.from(await So().hash(t))}isSigned(){var t;return(((t=this._id)==null?void 0:t.length)??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(t=>({name:oa.default.encode(t.name),value:oa.default.encode(t.value)})),data:this.data}}static async verify(t){if(t.byteLengthjE)return!1;if(i>0)try{if(q3(pf.Buffer.from(t.subarray(n+16,n+16+a))).length!==i)return!1}catch{return!1}let o=SR[r],c=await V3(e);return await o.verify(e.rawOwner,c,e.rawSignature)}async getSignatureData(){return V3(this)}getTagsStart(){let t=this.getTargetStart(),e=this.binary[t]==1,r=t+(e?33:1),n=this.binary[r]==1;return r+=n?33:1,r}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let t=this.getTargetStart()+1,e=this.binary[this.getTargetStart()]==1;return t+=e?32:0,t}},Tue=tf(LE(),1);function Nue(t,e,r){var S,_;let n=e.publicKey,i=r!=null&&r.target?Tue.default.toBuffer(r.target):null,s=1+((i==null?void 0:i.byteLength)??0),a=r!=null&&r.anchor?Buffer.from(r.anchor):null,o=1+((a==null?void 0:a.byteLength)??0),c=(((S=r==null?void 0:r.tags)==null?void 0:S.length)??0)>0?AR(r.tags):null,u=16+(c?c.byteLength:0),l=Buffer.from(t),f=l.byteLength,d=2+e.signatureLength+e.ownerLength+s+o+u+f,p=Buffer.alloc(d);if(p.set(Fue(e.signatureType),0),p.set(new Uint8Array(e.signatureLength).fill(0),2),n.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${n.byteLength}`);p.set(n,2+e.signatureLength);let h=2+e.signatureLength+e.ownerLength;if(p[h]=i?1:0,i){if(i.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);p.set(i,h+1)}let g=h+s,v=g+1;if(p[g]=a?1:0,a){if(v+=a.byteLength,a.byteLength!==32)throw new Error("Anchor must be 32 bytes");p.set(a,g+1)}p.set(hC(((_=r==null?void 0:r.tags)==null?void 0:_.length)??0),v);let x=hC((c==null?void 0:c.byteLength)??0);p.set(x,v+8),c&&p.set(c,v+16);let b=v+u;return p.set(l,b),new ry(p)}var _R={...xR};globalThis.arbundles??(globalThis.arbundles=_R);var Rue=_R,{DataItem:Due}=Rue;globalThis.Buffer||(globalThis.Buffer=mR.Buffer);function Oue(t){return async({data:e,tags:r,target:n,anchor:i,createDataItem:s=a=>new Due(a)})=>{let a=await t.signDataItem({data:e,tags:r,target:n,anchor:i}),o=s(mR.Buffer.from(a));return{id:await o.id,raw:await o.getRaw()}}}var Mue=globalThis.GATEWAY_URL||void 0,Lue=globalThis.MU_URL||void 0,jue=globalThis.CU_URL||void 0,{result:ad,results:kR,message:v0e,spawn:y0e,monitor:x0e,unmonitor:b0e,dryrun:w0e}=$l({GATEWAY_URL:Mue,MU_URL:Lue,CU_URL:jue}),Dh=gR.createDataItemSigner;/*! Bundled license information: + +ieee754/index.js: + (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *) + +buffer/index.js: + (*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + *) + +warp-arbundles/build/web/esm/bundle.js: + (*! Bundled license information: + + ieee754/index.js: + (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *) + + buffer/index.js: + (*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + *) + *) +*/const UE="9afQ1PLf2mrshqCTZEzzJTR2gWaC9zNPnYgYEqg1Pt4",$E="TZ7o7SIZ06ZEJ14lXwVtng1EtSx60QkPy-kh-kdAXog",pC="Efcq95Er0FKbehfmDGRQfH1vBPwd3snX4iVgtVhAhVU";function gC(t,[e,r]){return Math.min(r,Math.max(e,t))}function Uue(t){const e=t+"CollectionProvider",[r,n]=Dy(e),[i,s]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{const{scope:h,children:g}=p,v=jr.useRef(null),x=jr.useRef(new Map).current;return jr.createElement(i,{scope:h,itemMap:x,collectionRef:v},g)},o=t+"CollectionSlot",c=jr.forwardRef((p,h)=>{const{scope:g,children:v}=p,x=s(o,g),b=pn(h,x.collectionRef);return jr.createElement(oh,{ref:b},v)}),u=t+"CollectionItemSlot",l="data-radix-collection-item",f=jr.forwardRef((p,h)=>{const{scope:g,children:v,...x}=p,b=jr.useRef(null),S=pn(h,b),_=s(u,g);return jr.useEffect(()=>(_.itemMap.set(b,{ref:b,...x}),()=>void _.itemMap.delete(b))),jr.createElement(oh,{[l]:"",ref:S},v)});function d(p){const h=s(t+"CollectionConsumer",p);return jr.useCallback(()=>{const v=h.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${l}]`));return Array.from(h.itemMap.values()).sort((_,P)=>x.indexOf(_.ref.current)-x.indexOf(P.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:a,Slot:c,ItemSlot:f},d,n]}const $ue=K.createContext(void 0);function zue(t){const e=K.useContext($ue);return t||e||"ltr"}function Hue(t,e=globalThis==null?void 0:globalThis.document){const r=Ro(t);K.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return e.addEventListener("keydown",n),()=>e.removeEventListener("keydown",n)},[r,e])}const K3="dismissableLayer.update",Vue="dismissableLayer.pointerDownOutside",que="dismissableLayer.focusOutside";let mC;const Kue=K.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Wue=K.forwardRef((t,e)=>{var r;const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,onDismiss:c,...u}=t,l=K.useContext(Kue),[f,d]=K.useState(null),p=(r=f==null?void 0:f.ownerDocument)!==null&&r!==void 0?r:globalThis==null?void 0:globalThis.document,[,h]=K.useState({}),g=pn(e,N=>d(N)),v=Array.from(l.layers),[x]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(x),S=f?v.indexOf(f):-1,_=l.layersWithOutsidePointerEventsDisabled.size>0,P=S>=b,C=Gue(N=>{const T=N.target,D=[...l.branches].some(R=>R.contains(T));!P||D||(s==null||s(N),o==null||o(N),N.defaultPrevented||c==null||c())},p),B=Zue(N=>{const T=N.target;[...l.branches].some(R=>R.contains(T))||(a==null||a(N),o==null||o(N),N.defaultPrevented||c==null||c())},p);return Hue(N=>{S===l.layers.size-1&&(i==null||i(N),!N.defaultPrevented&&c&&(N.preventDefault(),c()))},p),K.useEffect(()=>{if(f)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(mC=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(f)),l.layers.add(f),vC(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=mC)}},[f,p,n,l]),K.useEffect(()=>()=>{f&&(l.layers.delete(f),l.layersWithOutsidePointerEventsDisabled.delete(f),vC())},[f,l]),K.useEffect(()=>{const N=()=>h({});return document.addEventListener(K3,N),()=>document.removeEventListener(K3,N)},[]),K.createElement(Hr.div,Pt({},u,{ref:g,style:{pointerEvents:_?P?"auto":"none":void 0,...t.style},onFocusCapture:$r(t.onFocusCapture,B.onFocusCapture),onBlurCapture:$r(t.onBlurCapture,B.onBlurCapture),onPointerDownCapture:$r(t.onPointerDownCapture,C.onPointerDownCapture)}))});function Gue(t,e=globalThis==null?void 0:globalThis.document){const r=Ro(t),n=K.useRef(!1),i=K.useRef(()=>{});return K.useEffect(()=>{const s=o=>{if(o.target&&!n.current){let l=function(){BR(Vue,r,u,{discrete:!0})};var c=l;const u={originalEvent:o};o.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function Zue(t,e=globalThis==null?void 0:globalThis.document){const r=Ro(t),n=K.useRef(!1);return K.useEffect(()=>{const i=s=>{s.target&&!n.current&&BR(que,r,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function vC(){const t=new CustomEvent(K3);document.dispatchEvent(t)}function BR(t,e,r,{discrete:n}){const i=r.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&i.addEventListener(t,e,{once:!0}),n?yj(i,s):i.dispatchEvent(s)}let lw=0;function Jue(){K.useEffect(()=>{var t,e;const r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(t=r[0])!==null&&t!==void 0?t:yC()),document.body.insertAdjacentElement("beforeend",(e=r[1])!==null&&e!==void 0?e:yC()),lw++,()=>{lw===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),lw--}},[])}function yC(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",t}const fw="focusScope.autoFocusOnMount",dw="focusScope.autoFocusOnUnmount",xC={bubbles:!1,cancelable:!0},Xue=K.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...a}=t,[o,c]=K.useState(null),u=Ro(i),l=Ro(s),f=K.useRef(null),d=pn(e,g=>c(g)),p=K.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;K.useEffect(()=>{if(n){let b=function(C){if(p.paused||!o)return;const B=C.target;o.contains(B)?f.current=B:pc(f.current,{select:!0})},S=function(C){if(p.paused||!o)return;const B=C.relatedTarget;B!==null&&(o.contains(B)||pc(f.current,{select:!0}))},_=function(C){if(document.activeElement===document.body)for(const N of C)N.removedNodes.length>0&&pc(o)};var g=b,v=S,x=_;document.addEventListener("focusin",b),document.addEventListener("focusout",S);const P=new MutationObserver(_);return o&&P.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",S),P.disconnect()}}},[n,o,p.paused]),K.useEffect(()=>{if(o){wC.add(p);const g=document.activeElement;if(!o.contains(g)){const x=new CustomEvent(fw,xC);o.addEventListener(fw,u),o.dispatchEvent(x),x.defaultPrevented||(Que(nle(IR(o)),{select:!0}),document.activeElement===g&&pc(o))}return()=>{o.removeEventListener(fw,u),setTimeout(()=>{const x=new CustomEvent(dw,xC);o.addEventListener(dw,l),o.dispatchEvent(x),x.defaultPrevented||pc(g??document.body,{select:!0}),o.removeEventListener(dw,l),wC.remove(p)},0)}}},[o,u,l,p]);const h=K.useCallback(g=>{if(!r&&!n||p.paused)return;const v=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,x=document.activeElement;if(v&&x){const b=g.currentTarget,[S,_]=Yue(b);S&&_?!g.shiftKey&&x===_?(g.preventDefault(),r&&pc(S,{select:!0})):g.shiftKey&&x===S&&(g.preventDefault(),r&&pc(_,{select:!0})):x===b&&g.preventDefault()}},[r,n,p.paused]);return K.createElement(Hr.div,Pt({tabIndex:-1},a,{ref:d,onKeyDown:h}))});function Que(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(pc(n,{select:e}),document.activeElement!==r)return}function Yue(t){const e=IR(t),r=bC(e,t),n=bC(e.reverse(),t);return[r,n]}function IR(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function bC(t,e){for(const r of t)if(!ele(r,{upTo:e}))return r}function ele(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function tle(t){return t instanceof HTMLInputElement&&"select"in t}function pc(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&tle(t)&&e&&t.select()}}const wC=rle();function rle(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=EC(t,e),t.unshift(e)},remove(e){var r;t=EC(t,e),(r=t[0])===null||r===void 0||r.resume()}}}function EC(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function nle(t){return t.filter(e=>e.tagName!=="A")}const ile=jm.useId||(()=>{});let sle=0;function FR(t){const[e,r]=K.useState(ile());return cs(()=>{t||r(n=>n??String(sle++))},[t]),t||(e?`radix-${e}`:"")}const ale=["top","right","bottom","left"],cu=Math.min,Ci=Math.max,ny=Math.round,$1=Math.floor,uu=t=>({x:t,y:t}),ole={left:"right",right:"left",bottom:"top",top:"bottom"},cle={start:"end",end:"start"};function W3(t,e,r){return Ci(t,cu(e,r))}function zo(t,e){return typeof t=="function"?t(e):t}function Ho(t){return t.split("-")[0]}function r0(t){return t.split("-")[1]}function zE(t){return t==="x"?"y":"x"}function HE(t){return t==="y"?"height":"width"}function n0(t){return["top","bottom"].includes(Ho(t))?"y":"x"}function VE(t){return zE(n0(t))}function ule(t,e,r){r===void 0&&(r=!1);const n=r0(t),i=VE(t),s=HE(i);let a=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(a=iy(a)),[a,iy(a)]}function lle(t){const e=iy(t);return[G3(t),e,G3(e)]}function G3(t){return t.replace(/start|end/g,e=>cle[e])}function fle(t,e,r){const n=["left","right"],i=["right","left"],s=["top","bottom"],a=["bottom","top"];switch(t){case"top":case"bottom":return r?e?i:n:e?n:i;case"left":case"right":return e?s:a;default:return[]}}function dle(t,e,r,n){const i=r0(t);let s=fle(Ho(t),r==="start",n);return i&&(s=s.map(a=>a+"-"+i),e&&(s=s.concat(s.map(G3)))),s}function iy(t){return t.replace(/left|right|bottom|top/g,e=>ole[e])}function hle(t){return{top:0,right:0,bottom:0,left:0,...t}}function PR(t){return typeof t!="number"?hle(t):{top:t,right:t,bottom:t,left:t}}function sy(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}function SC(t,e,r){let{reference:n,floating:i}=t;const s=n0(e),a=VE(e),o=HE(a),c=Ho(e),u=s==="y",l=n.x+n.width/2-i.width/2,f=n.y+n.height/2-i.height/2,d=n[o]/2-i[o]/2;let p;switch(c){case"top":p={x:l,y:n.y-i.height};break;case"bottom":p={x:l,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:f};break;case"left":p={x:n.x-i.width,y:f};break;default:p={x:n.x,y:n.y}}switch(r0(e)){case"start":p[a]-=d*(r&&u?-1:1);break;case"end":p[a]+=d*(r&&u?-1:1);break}return p}const ple=async(t,e,r)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:a}=r,o=s.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(e));let u=await a.getElementRects({reference:t,floating:e,strategy:i}),{x:l,y:f}=SC(u,n,c),d=n,p={},h=0;for(let g=0;g({name:"arrow",options:t,async fn(e){const{x:r,y:n,placement:i,rects:s,platform:a,elements:o,middlewareData:c}=e,{element:u,padding:l=0}=zo(t,e)||{};if(u==null)return{};const f=PR(l),d={x:r,y:n},p=VE(i),h=HE(p),g=await a.getDimensions(u),v=p==="y",x=v?"top":"left",b=v?"bottom":"right",S=v?"clientHeight":"clientWidth",_=s.reference[h]+s.reference[p]-d[p]-s.floating[h],P=d[p]-s.reference[p],C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let B=C?C[S]:0;(!B||!await(a.isElement==null?void 0:a.isElement(C)))&&(B=o.floating[S]||s.floating[h]);const N=_/2-P/2,T=B/2-g[h]/2-1,D=cu(f[x],T),R=cu(f[b],T),E=D,F=B-g[h]-R,A=B/2-g[h]/2+N,I=W3(E,A,F),j=!c.arrow&&r0(i)!=null&&A!==I&&s.reference[h]/2-(AE<=0)){var T,D;const E=(((T=s.flip)==null?void 0:T.index)||0)+1,F=P[E];if(F)return{data:{index:E,overflows:N},reset:{placement:F}};let A=(D=N.filter(I=>I.overflows[0]<=0).sort((I,j)=>I.overflows[1]-j.overflows[1])[0])==null?void 0:D.placement;if(!A)switch(p){case"bestFit":{var R;const I=(R=N.map(j=>[j.placement,j.overflows.filter($=>$>0).reduce(($,W)=>$+W,0)]).sort((j,$)=>j[1]-$[1])[0])==null?void 0:R[0];I&&(A=I);break}case"initialPlacement":A=o;break}if(i!==A)return{reset:{placement:A}}}return{}}}};function AC(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function CC(t){return ale.some(e=>t[e]>=0)}const vle=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:n="referenceHidden",...i}=zo(t,e);switch(n){case"referenceHidden":{const s=await ug(e,{...i,elementContext:"reference"}),a=AC(s,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:CC(a)}}}case"escaped":{const s=await ug(e,{...i,altBoundary:!0}),a=AC(s,r.floating);return{data:{escapedOffsets:a,escaped:CC(a)}}}default:return{}}}}};async function yle(t,e){const{placement:r,platform:n,elements:i}=t,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),a=Ho(r),o=r0(r),c=n0(r)==="y",u=["left","top"].includes(a)?-1:1,l=s&&c?-1:1,f=zo(e,t);let{mainAxis:d,crossAxis:p,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return o&&typeof h=="number"&&(p=o==="end"?h*-1:h),c?{x:p*l,y:d*u}:{x:d*u,y:p*l}}const xle=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,n;const{x:i,y:s,placement:a,middlewareData:o}=e,c=await yle(e,t);return a===((r=o.offset)==null?void 0:r.placement)&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:a}}}}},ble=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:n,placement:i}=e,{mainAxis:s=!0,crossAxis:a=!1,limiter:o={fn:v=>{let{x,y:b}=v;return{x,y:b}}},...c}=zo(t,e),u={x:r,y:n},l=await ug(e,c),f=n0(Ho(i)),d=zE(f);let p=u[d],h=u[f];if(s){const v=d==="y"?"top":"left",x=d==="y"?"bottom":"right",b=p+l[v],S=p-l[x];p=W3(b,p,S)}if(a){const v=f==="y"?"top":"left",x=f==="y"?"bottom":"right",b=h+l[v],S=h-l[x];h=W3(b,h,S)}const g=o.fn({...e,[d]:p,[f]:h});return{...g,data:{x:g.x-r,y:g.y-n}}}}},wle=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:n,placement:i,rects:s,middlewareData:a}=e,{offset:o=0,mainAxis:c=!0,crossAxis:u=!0}=zo(t,e),l={x:r,y:n},f=n0(i),d=zE(f);let p=l[d],h=l[f];const g=zo(o,e),v=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const S=d==="y"?"height":"width",_=s.reference[d]-s.floating[S]+v.mainAxis,P=s.reference[d]+s.reference[S]-v.mainAxis;p<_?p=_:p>P&&(p=P)}if(u){var x,b;const S=d==="y"?"width":"height",_=["top","left"].includes(Ho(i)),P=s.reference[f]-s.floating[S]+(_&&((x=a.offset)==null?void 0:x[f])||0)+(_?0:v.crossAxis),C=s.reference[f]+s.reference[S]+(_?0:((b=a.offset)==null?void 0:b[f])||0)-(_?v.crossAxis:0);hC&&(h=C)}return{[d]:p,[f]:h}}}},Ele=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:r,rects:n,platform:i,elements:s}=e,{apply:a=()=>{},...o}=zo(t,e),c=await ug(e,o),u=Ho(r),l=r0(r),f=n0(r)==="y",{width:d,height:p}=n.floating;let h,g;u==="top"||u==="bottom"?(h=u,g=l===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(g=u,h=l==="end"?"top":"bottom");const v=p-c[h],x=d-c[g],b=!e.middlewareData.shift;let S=v,_=x;if(f){const C=d-c.left-c.right;_=l||b?cu(x,C):C}else{const C=p-c.top-c.bottom;S=l||b?cu(v,C):C}if(b&&!l){const C=Ci(c.left,0),B=Ci(c.right,0),N=Ci(c.top,0),T=Ci(c.bottom,0);f?_=d-2*(C!==0||B!==0?C+B:Ci(c.left,c.right)):S=p-2*(N!==0||T!==0?N+T:Ci(c.top,c.bottom))}await a({...e,availableWidth:_,availableHeight:S});const P=await i.getDimensions(s.floating);return d!==P.width||p!==P.height?{reset:{rects:!0}}:{}}}};function lu(t){return TR(t)?(t.nodeName||"").toLowerCase():"#document"}function Ii(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Jo(t){var e;return(e=(TR(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function TR(t){return t instanceof Node||t instanceof Ii(t).Node}function Vo(t){return t instanceof Element||t instanceof Ii(t).Element}function ja(t){return t instanceof HTMLElement||t instanceof Ii(t).HTMLElement}function _C(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ii(t).ShadowRoot}function i1(t){const{overflow:e,overflowX:r,overflowY:n,display:i}=ds(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(i)}function Sle(t){return["table","td","th"].includes(lu(t))}function qE(t){const e=KE(),r=ds(t);return r.transform!=="none"||r.perspective!=="none"||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function Ale(t){let e=Oh(t);for(;ja(e)&&!L2(e);){if(qE(e))return e;e=Oh(e)}return null}function KE(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function L2(t){return["html","body","#document"].includes(lu(t))}function ds(t){return Ii(t).getComputedStyle(t)}function j2(t){return Vo(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Oh(t){if(lu(t)==="html")return t;const e=t.assignedSlot||t.parentNode||_C(t)&&t.host||Jo(t);return _C(e)?e.host:e}function NR(t){const e=Oh(t);return L2(e)?t.ownerDocument?t.ownerDocument.body:t.body:ja(e)&&i1(e)?e:NR(e)}function lg(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);const i=NR(t),s=i===((n=t.ownerDocument)==null?void 0:n.body),a=Ii(i);return s?e.concat(a,a.visualViewport||[],i1(i)?i:[],a.frameElement&&r?lg(a.frameElement):[]):e.concat(i,lg(i,[],r))}function RR(t){const e=ds(t);let r=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=ja(t),s=i?t.offsetWidth:r,a=i?t.offsetHeight:n,o=ny(r)!==s||ny(n)!==a;return o&&(r=s,n=a),{width:r,height:n,$:o}}function WE(t){return Vo(t)?t:t.contextElement}function od(t){const e=WE(t);if(!ja(e))return uu(1);const r=e.getBoundingClientRect(),{width:n,height:i,$:s}=RR(e);let a=(s?ny(r.width):r.width)/n,o=(s?ny(r.height):r.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const Cle=uu(0);function DR(t){const e=Ii(t);return!KE()||!e.visualViewport?Cle:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function _le(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==Ii(t)?!1:e}function zl(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);const i=t.getBoundingClientRect(),s=WE(t);let a=uu(1);e&&(n?Vo(n)&&(a=od(n)):a=od(t));const o=_le(s,r,n)?DR(s):uu(0);let c=(i.left+o.x)/a.x,u=(i.top+o.y)/a.y,l=i.width/a.x,f=i.height/a.y;if(s){const d=Ii(s),p=n&&Vo(n)?Ii(n):n;let h=d,g=h.frameElement;for(;g&&n&&p!==h;){const v=od(g),x=g.getBoundingClientRect(),b=ds(g),S=x.left+(g.clientLeft+parseFloat(b.paddingLeft))*v.x,_=x.top+(g.clientTop+parseFloat(b.paddingTop))*v.y;c*=v.x,u*=v.y,l*=v.x,f*=v.y,c+=S,u+=_,h=Ii(g),g=h.frameElement}}return sy({width:l,height:f,x:c,y:u})}const kle=[":popover-open",":modal"];function OR(t){return kle.some(e=>{try{return t.matches(e)}catch{return!1}})}function Ble(t){let{elements:e,rect:r,offsetParent:n,strategy:i}=t;const s=i==="fixed",a=Jo(n),o=e?OR(e.floating):!1;if(n===a||o&&s)return r;let c={scrollLeft:0,scrollTop:0},u=uu(1);const l=uu(0),f=ja(n);if((f||!f&&!s)&&((lu(n)!=="body"||i1(a))&&(c=j2(n)),ja(n))){const d=zl(n);u=od(n),l.x=d.x+n.clientLeft,l.y=d.y+n.clientTop}return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+l.x,y:r.y*u.y-c.scrollTop*u.y+l.y}}function Ile(t){return Array.from(t.getClientRects())}function MR(t){return zl(Jo(t)).left+j2(t).scrollLeft}function Fle(t){const e=Jo(t),r=j2(t),n=t.ownerDocument.body,i=Ci(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=Ci(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let a=-r.scrollLeft+MR(t);const o=-r.scrollTop;return ds(n).direction==="rtl"&&(a+=Ci(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:a,y:o}}function Ple(t,e){const r=Ii(t),n=Jo(t),i=r.visualViewport;let s=n.clientWidth,a=n.clientHeight,o=0,c=0;if(i){s=i.width,a=i.height;const u=KE();(!u||u&&e==="fixed")&&(o=i.offsetLeft,c=i.offsetTop)}return{width:s,height:a,x:o,y:c}}function Tle(t,e){const r=zl(t,!0,e==="fixed"),n=r.top+t.clientTop,i=r.left+t.clientLeft,s=ja(t)?od(t):uu(1),a=t.clientWidth*s.x,o=t.clientHeight*s.y,c=i*s.x,u=n*s.y;return{width:a,height:o,x:c,y:u}}function kC(t,e,r){let n;if(e==="viewport")n=Ple(t,r);else if(e==="document")n=Fle(Jo(t));else if(Vo(e))n=Tle(e,r);else{const i=DR(t);n={...e,x:e.x-i.x,y:e.y-i.y}}return sy(n)}function LR(t,e){const r=Oh(t);return r===e||!Vo(r)||L2(r)?!1:ds(r).position==="fixed"||LR(r,e)}function Nle(t,e){const r=e.get(t);if(r)return r;let n=lg(t,[],!1).filter(o=>Vo(o)&&lu(o)!=="body"),i=null;const s=ds(t).position==="fixed";let a=s?Oh(t):t;for(;Vo(a)&&!L2(a);){const o=ds(a),c=qE(a);!c&&o.position==="fixed"&&(i=null),(s?!c&&!i:!c&&o.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||i1(a)&&!c&&LR(t,a))?n=n.filter(l=>l!==a):i=o,a=Oh(a)}return e.set(t,n),n}function Rle(t){let{element:e,boundary:r,rootBoundary:n,strategy:i}=t;const a=[...r==="clippingAncestors"?Nle(e,this._c):[].concat(r),n],o=a[0],c=a.reduce((u,l)=>{const f=kC(e,l,i);return u.top=Ci(f.top,u.top),u.right=cu(f.right,u.right),u.bottom=cu(f.bottom,u.bottom),u.left=Ci(f.left,u.left),u},kC(e,o,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Dle(t){const{width:e,height:r}=RR(t);return{width:e,height:r}}function Ole(t,e,r){const n=ja(e),i=Jo(e),s=r==="fixed",a=zl(t,!0,s,e);let o={scrollLeft:0,scrollTop:0};const c=uu(0);if(n||!n&&!s)if((lu(e)!=="body"||i1(i))&&(o=j2(e)),n){const f=zl(e,!0,s,e);c.x=f.x+e.clientLeft,c.y=f.y+e.clientTop}else i&&(c.x=MR(i));const u=a.left+o.scrollLeft-c.x,l=a.top+o.scrollTop-c.y;return{x:u,y:l,width:a.width,height:a.height}}function BC(t,e){return!ja(t)||ds(t).position==="fixed"?null:e?e(t):t.offsetParent}function jR(t,e){const r=Ii(t);if(!ja(t)||OR(t))return r;let n=BC(t,e);for(;n&&Sle(n)&&ds(n).position==="static";)n=BC(n,e);return n&&(lu(n)==="html"||lu(n)==="body"&&ds(n).position==="static"&&!qE(n))?r:n||Ale(t)||r}const Mle=async function(t){const e=this.getOffsetParent||jR,r=this.getDimensions;return{reference:Ole(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,...await r(t.floating)}}};function Lle(t){return ds(t).direction==="rtl"}const jle={convertOffsetParentRelativeRectToViewportRelativeRect:Ble,getDocumentElement:Jo,getClippingRect:Rle,getOffsetParent:jR,getElementRects:Mle,getClientRects:Ile,getDimensions:Dle,getScale:od,isElement:Vo,isRTL:Lle};function Ule(t,e){let r=null,n;const i=Jo(t);function s(){var o;clearTimeout(n),(o=r)==null||o.disconnect(),r=null}function a(o,c){o===void 0&&(o=!1),c===void 0&&(c=1),s();const{left:u,top:l,width:f,height:d}=t.getBoundingClientRect();if(o||e(),!f||!d)return;const p=$1(l),h=$1(i.clientWidth-(u+f)),g=$1(i.clientHeight-(l+d)),v=$1(u),b={rootMargin:-p+"px "+-h+"px "+-g+"px "+-v+"px",threshold:Ci(0,cu(1,c))||1};let S=!0;function _(P){const C=P[0].intersectionRatio;if(C!==c){if(!S)return a();C?a(!1,C):n=setTimeout(()=>{a(!1,1e-7)},100)}S=!1}try{r=new IntersectionObserver(_,{...b,root:i.ownerDocument})}catch{r=new IntersectionObserver(_,b)}r.observe(t)}return a(!0),s}function $le(t,e,r,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=WE(t),l=i||s?[...u?lg(u):[],...lg(e)]:[];l.forEach(x=>{i&&x.addEventListener("scroll",r,{passive:!0}),s&&x.addEventListener("resize",r)});const f=u&&o?Ule(u,r):null;let d=-1,p=null;a&&(p=new ResizeObserver(x=>{let[b]=x;b&&b.target===u&&p&&(p.unobserve(e),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var S;(S=p)==null||S.observe(e)})),r()}),u&&!c&&p.observe(u),p.observe(e));let h,g=c?zl(t):null;c&&v();function v(){const x=zl(t);g&&(x.x!==g.x||x.y!==g.y||x.width!==g.width||x.height!==g.height)&&r(),g=x,h=requestAnimationFrame(v)}return r(),()=>{var x;l.forEach(b=>{i&&b.removeEventListener("scroll",r),s&&b.removeEventListener("resize",r)}),f==null||f(),(x=p)==null||x.disconnect(),p=null,c&&cancelAnimationFrame(h)}}const zle=ble,Hle=mle,Vle=Ele,qle=vle,IC=gle,Kle=wle,Wle=(t,e,r)=>{const n=new Map,i={platform:jle,...r},s={...i.platform,_c:n};return ple(t,e,{...i,platform:s})},Gle=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:n,padding:i}=typeof t=="function"?t(r):t;return n&&e(n)?n.current!=null?IC({element:n.current,padding:i}).fn(r):{}:n?IC({element:n,padding:i}).fn(r):{}}}};var Tm=typeof document<"u"?K.useLayoutEffect:K.useEffect;function ay(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,n,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(n=r;n--!==0;)if(!ay(t[n],e[n]))return!1;return!0}if(i=Object.keys(t),r=i.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,i[n]))return!1;for(n=r;n--!==0;){const s=i[n];if(!(s==="_owner"&&t.$$typeof)&&!ay(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function UR(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function FC(t,e){const r=UR(t);return Math.round(e*r)/r}function PC(t){const e=K.useRef(t);return Tm(()=>{e.current=t}),e}function Zle(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:n=[],platform:i,elements:{reference:s,floating:a}={},transform:o=!0,whileElementsMounted:c,open:u}=t,[l,f]=K.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[d,p]=K.useState(n);ay(d,n)||p(n);const[h,g]=K.useState(null),[v,x]=K.useState(null),b=K.useCallback($=>{$!==C.current&&(C.current=$,g($))},[]),S=K.useCallback($=>{$!==B.current&&(B.current=$,x($))},[]),_=s||h,P=a||v,C=K.useRef(null),B=K.useRef(null),N=K.useRef(l),T=c!=null,D=PC(c),R=PC(i),E=K.useCallback(()=>{if(!C.current||!B.current)return;const $={placement:e,strategy:r,middleware:d};R.current&&($.platform=R.current),Wle(C.current,B.current,$).then(W=>{const H={...W,isPositioned:!0};F.current&&!ay(N.current,H)&&(N.current=H,$h.flushSync(()=>{f(H)}))})},[d,e,r,R]);Tm(()=>{u===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,f($=>({...$,isPositioned:!1})))},[u]);const F=K.useRef(!1);Tm(()=>(F.current=!0,()=>{F.current=!1}),[]),Tm(()=>{if(_&&(C.current=_),P&&(B.current=P),_&&P){if(D.current)return D.current(_,P,E);E()}},[_,P,E,D,T]);const A=K.useMemo(()=>({reference:C,floating:B,setReference:b,setFloating:S}),[b,S]),I=K.useMemo(()=>({reference:_,floating:P}),[_,P]),j=K.useMemo(()=>{const $={position:r,left:0,top:0};if(!I.floating)return $;const W=FC(I.floating,l.x),H=FC(I.floating,l.y);return o?{...$,transform:"translate("+W+"px, "+H+"px)",...UR(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:W,top:H}},[r,o,I.floating,l.x,l.y]);return K.useMemo(()=>({...l,update:E,refs:A,elements:I,floatingStyles:j}),[l,E,A,I,j])}const $R="Popper",[zR,HR]=Dy($R),[Jle,VR]=zR($R),Xle=t=>{const{__scopePopper:e,children:r}=t,[n,i]=K.useState(null);return K.createElement(Jle,{scope:e,anchor:n,onAnchorChange:i},r)},Qle="PopperAnchor",Yle=K.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:n,...i}=t,s=VR(Qle,r),a=K.useRef(null),o=pn(e,a);return K.useEffect(()=>{s.onAnchorChange((n==null?void 0:n.current)||a.current)}),n?null:K.createElement(Hr.div,Pt({},i,{ref:o}))}),qR="PopperContent",[efe,E0e]=zR(qR),tfe=K.forwardRef((t,e)=>{var r,n,i,s,a,o,c,u;const{__scopePopper:l,side:f="bottom",sideOffset:d=0,align:p="center",alignOffset:h=0,arrowPadding:g=0,avoidCollisions:v=!0,collisionBoundary:x=[],collisionPadding:b=0,sticky:S="partial",hideWhenDetached:_=!1,updatePositionStrategy:P="optimized",onPlaced:C,...B}=t,N=VR(qR,l),[T,D]=K.useState(null),R=pn(e,le=>D(le)),[E,F]=K.useState(null),A=FB(E),I=(r=A==null?void 0:A.width)!==null&&r!==void 0?r:0,j=(n=A==null?void 0:A.height)!==null&&n!==void 0?n:0,$=f+(p!=="center"?"-"+p:""),W=typeof b=="number"?b:{top:0,right:0,bottom:0,left:0,...b},H=Array.isArray(x)?x:[x],O=H.length>0,L={padding:W,boundary:H.filter(rfe),altBoundary:O},{refs:q,floatingStyles:ee,placement:X,isPositioned:ae,middlewareData:ve}=Zle({strategy:"fixed",placement:$,whileElementsMounted:(...le)=>$le(...le,{animationFrame:P==="always"}),elements:{reference:N.anchor},middleware:[xle({mainAxis:d+j,alignmentAxis:h}),v&&zle({mainAxis:!0,crossAxis:!1,limiter:S==="partial"?Kle():void 0,...L}),v&&Hle({...L}),Vle({...L,apply:({elements:le,rects:ce,availableWidth:Y,availableHeight:J})=>{const{width:ne,height:xe}=ce.reference,he=le.floating.style;he.setProperty("--radix-popper-available-width",`${Y}px`),he.setProperty("--radix-popper-available-height",`${J}px`),he.setProperty("--radix-popper-anchor-width",`${ne}px`),he.setProperty("--radix-popper-anchor-height",`${xe}px`)}}),E&&Gle({element:E,padding:g}),nfe({arrowWidth:I,arrowHeight:j}),_&&qle({strategy:"referenceHidden",...L})]}),[de,pe]=KR(X),we=Ro(C);cs(()=>{ae&&(we==null||we())},[ae,we]);const _e=(i=ve.arrow)===null||i===void 0?void 0:i.x,Me=(s=ve.arrow)===null||s===void 0?void 0:s.y,Fe=((a=ve.arrow)===null||a===void 0?void 0:a.centerOffset)!==0,[De,V]=K.useState();return cs(()=>{T&&V(window.getComputedStyle(T).zIndex)},[T]),K.createElement("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...ee,transform:ae?ee.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:De,"--radix-popper-transform-origin":[(o=ve.transformOrigin)===null||o===void 0?void 0:o.x,(c=ve.transformOrigin)===null||c===void 0?void 0:c.y].join(" ")},dir:t.dir},K.createElement(efe,{scope:l,placedSide:de,onArrowChange:F,arrowX:_e,arrowY:Me,shouldHideArrow:Fe},K.createElement(Hr.div,Pt({"data-side":de,"data-align":pe},B,{ref:R,style:{...B.style,animation:ae?void 0:"none",opacity:(u=ve.hide)!==null&&u!==void 0&&u.referenceHidden?0:void 0}}))))});function rfe(t){return t!==null}const nfe=t=>({name:"transformOrigin",options:t,fn(e){var r,n,i,s,a;const{placement:o,rects:c,middlewareData:u}=e,f=((r=u.arrow)===null||r===void 0?void 0:r.centerOffset)!==0,d=f?0:t.arrowWidth,p=f?0:t.arrowHeight,[h,g]=KR(o),v={start:"0%",center:"50%",end:"100%"}[g],x=((n=(i=u.arrow)===null||i===void 0?void 0:i.x)!==null&&n!==void 0?n:0)+d/2,b=((s=(a=u.arrow)===null||a===void 0?void 0:a.y)!==null&&s!==void 0?s:0)+p/2;let S="",_="";return h==="bottom"?(S=f?v:`${x}px`,_=`${-p}px`):h==="top"?(S=f?v:`${x}px`,_=`${c.floating.height+p}px`):h==="right"?(S=`${-p}px`,_=f?v:`${b}px`):h==="left"&&(S=`${c.floating.width+p}px`,_=f?v:`${b}px`),{data:{x:S,y:_}}}});function KR(t){const[e,r="center"]=t.split("-");return[e,r]}const ife=Xle,sfe=Yle,afe=tfe,ofe=K.forwardRef((t,e)=>{var r;const{container:n=globalThis==null||(r=globalThis.document)===null||r===void 0?void 0:r.body,...i}=t;return n?tL.createPortal(K.createElement(Hr.div,Pt({},i,{ref:e})),n):null}),cfe=K.forwardRef((t,e)=>K.createElement(Hr.span,Pt({},t,{ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}})));var ufe=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},gf=new WeakMap,z1=new WeakMap,H1={},hw=0,WR=function(t){return t&&(t.host||WR(t.parentNode))},lfe=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=WR(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},ffe=function(t,e,r,n){var i=lfe(e,Array.isArray(t)?t:[t]);H1[r]||(H1[r]=new WeakMap);var s=H1[r],a=[],o=new Set,c=new Set(i),u=function(f){!f||o.has(f)||(o.add(f),u(f.parentNode))};i.forEach(u);var l=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(d){if(o.has(d))l(d);else{var p=d.getAttribute(n),h=p!==null&&p!=="false",g=(gf.get(d)||0)+1,v=(s.get(d)||0)+1;gf.set(d,g),s.set(d,v),a.push(d),g===1&&h&&z1.set(d,!0),v===1&&d.setAttribute(r,"true"),h||d.setAttribute(n,"true")}})};return l(e),o.clear(),hw++,function(){a.forEach(function(f){var d=gf.get(f)-1,p=s.get(f)-1;gf.set(f,d),s.set(f,p),d||(z1.has(f)||f.removeAttribute(n),z1.delete(f)),p||f.removeAttribute(r)}),hw--,hw||(gf=new WeakMap,gf=new WeakMap,z1=new WeakMap,H1={})}},dfe=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),i=e||ufe(t);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),ffe(n,i,r,"aria-hidden")):function(){return null}},Aa=function(){return Aa=Object.assign||function(e){for(var r,n=1,i=arguments.length;n"u")return Bfe;var e=Ife(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},Pfe=XR(),oy="data-scroll-locked",Tfe=function(t,e,r,n){var i=t.left,s=t.top,a=t.right,o=t.gap;return r===void 0&&(r="margin"),` + .`.concat(pfe,` { + overflow: hidden `).concat(n,`; + padding-right: `).concat(o,"px ").concat(n,`; + } + body[`).concat(oy,`] { + overflow: hidden `).concat(n,`; + overscroll-behavior: contain; + `).concat([e&&"position: relative ".concat(n,";"),r==="margin"&&` + padding-left: `.concat(i,`px; + padding-top: `).concat(s,`px; + padding-right: `).concat(a,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(o,"px ").concat(n,`; + `),r==="padding"&&"padding-right: ".concat(o,"px ").concat(n,";")].filter(Boolean).join(""),` + } + + .`).concat(Nm,` { + right: `).concat(o,"px ").concat(n,`; + } + + .`).concat(Rm,` { + margin-right: `).concat(o,"px ").concat(n,`; + } + + .`).concat(Nm," .").concat(Nm,` { + right: 0 `).concat(n,`; + } + + .`).concat(Rm," .").concat(Rm,` { + margin-right: 0 `).concat(n,`; + } + + body[`).concat(oy,`] { + `).concat(gfe,": ").concat(o,`px; + } +`)},Nfe=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,i=n===void 0?"margin":n,s=K.useMemo(function(){return Ffe(i)},[i]);return K.useEffect(function(){return document.body.setAttribute(oy,""),function(){document.body.removeAttribute(oy)}},[]),K.createElement(Pfe,{styles:Tfe(s,!e,i,r?"":"!important")})},Z3=!1;if(typeof window<"u")try{var V1=Object.defineProperty({},"passive",{get:function(){return Z3=!0,!0}});window.addEventListener("test",V1,V1),window.removeEventListener("test",V1,V1)}catch{Z3=!1}var mf=Z3?{passive:!1}:!1,Rfe=function(t){return t.tagName==="TEXTAREA"},QR=function(t,e){var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!Rfe(t)&&r[e]==="visible")},Dfe=function(t){return QR(t,"overflowY")},Ofe=function(t){return QR(t,"overflowX")},NC=function(t,e){var r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var n=YR(t,r);if(n){var i=eD(t,r),s=i[1],a=i[2];if(s>a)return!0}r=r.parentNode}while(r&&r!==document.body);return!1},Mfe=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},Lfe=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},YR=function(t,e){return t==="v"?Dfe(e):Ofe(e)},eD=function(t,e){return t==="v"?Mfe(e):Lfe(e)},jfe=function(t,e){return t==="h"&&e==="rtl"?-1:1},Ufe=function(t,e,r,n,i){var s=jfe(t,window.getComputedStyle(e).direction),a=s*n,o=r.target,c=e.contains(o),u=!1,l=a>0,f=0,d=0;do{var p=eD(t,o),h=p[0],g=p[1],v=p[2],x=g-v-s*h;(h||x)&&YR(t,o)&&(f+=x,d+=h),o=o.parentNode}while(!c&&o!==document.body||c&&(e.contains(o)||e===o));return(l&&(i&&f===0||!i&&a>f)||!l&&(i&&d===0||!i&&-a>d))&&(u=!0),u},q1=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},RC=function(t){return[t.deltaX,t.deltaY]},DC=function(t){return t&&"current"in t?t.current:t},$fe=function(t,e){return t[0]===e[0]&&t[1]===e[1]},zfe=function(t){return` + .block-interactivity-`.concat(t,` {pointer-events: none;} + .allow-interactivity-`).concat(t,` {pointer-events: all;} +`)},Hfe=0,vf=[];function Vfe(t){var e=K.useRef([]),r=K.useRef([0,0]),n=K.useRef(),i=K.useState(Hfe++)[0],s=K.useState(function(){return XR()})[0],a=K.useRef(t);K.useEffect(function(){a.current=t},[t]),K.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var g=hfe([t.lockRef.current],(t.shards||[]).map(DC),!0).filter(Boolean);return g.forEach(function(v){return v.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),g.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var o=K.useCallback(function(g,v){if("touches"in g&&g.touches.length===2)return!a.current.allowPinchZoom;var x=q1(g),b=r.current,S="deltaX"in g?g.deltaX:b[0]-x[0],_="deltaY"in g?g.deltaY:b[1]-x[1],P,C=g.target,B=Math.abs(S)>Math.abs(_)?"h":"v";if("touches"in g&&B==="h"&&C.type==="range")return!1;var N=NC(B,C);if(!N)return!0;if(N?P=B:(P=B==="v"?"h":"v",N=NC(B,C)),!N)return!1;if(!n.current&&"changedTouches"in g&&(S||_)&&(n.current=P),!P)return!0;var T=n.current||P;return Ufe(T,v,g,T==="h"?S:_,!0)},[]),c=K.useCallback(function(g){var v=g;if(!(!vf.length||vf[vf.length-1]!==s)){var x="deltaY"in v?RC(v):q1(v),b=e.current.filter(function(P){return P.name===v.type&&P.target===v.target&&$fe(P.delta,x)})[0];if(b&&b.should){v.cancelable&&v.preventDefault();return}if(!b){var S=(a.current.shards||[]).map(DC).filter(Boolean).filter(function(P){return P.contains(v.target)}),_=S.length>0?o(v,S[0]):!a.current.noIsolation;_&&v.cancelable&&v.preventDefault()}}},[]),u=K.useCallback(function(g,v,x,b){var S={name:g,delta:v,target:x,should:b};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(_){return _!==S})},1)},[]),l=K.useCallback(function(g){r.current=q1(g),n.current=void 0},[]),f=K.useCallback(function(g){u(g.type,RC(g),g.target,o(g,t.lockRef.current))},[]),d=K.useCallback(function(g){u(g.type,q1(g),g.target,o(g,t.lockRef.current))},[]);K.useEffect(function(){return vf.push(s),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:d}),document.addEventListener("wheel",c,mf),document.addEventListener("touchmove",c,mf),document.addEventListener("touchstart",l,mf),function(){vf=vf.filter(function(g){return g!==s}),document.removeEventListener("wheel",c,mf),document.removeEventListener("touchmove",c,mf),document.removeEventListener("touchstart",l,mf)}},[]);var p=t.removeScrollBar,h=t.inert;return K.createElement(K.Fragment,null,h?K.createElement(s,{styles:zfe(i)}):null,p?K.createElement(Nfe,{gapMode:"margin"}):null)}const qfe=wfe(JR,Vfe);var tD=K.forwardRef(function(t,e){return K.createElement(U2,Aa({},t,{ref:e,sideCar:qfe}))});tD.classNames=U2.classNames;const Kfe=tD,Wfe=[" ","Enter","ArrowUp","ArrowDown"],Gfe=[" ","Enter"],$2="Select",[z2,H2,Zfe]=Uue($2),[i0,S0e]=Dy($2,[Zfe,HR]),GE=HR(),[Jfe,rf]=i0($2),[Xfe,Qfe]=i0($2),Yfe=t=>{const{__scopeSelect:e,children:r,open:n,defaultOpen:i,onOpenChange:s,value:a,defaultValue:o,onValueChange:c,dir:u,name:l,autoComplete:f,disabled:d,required:p}=t,h=GE(e),[g,v]=K.useState(null),[x,b]=K.useState(null),[S,_]=K.useState(!1),P=zue(u),[C=!1,B]=g4({prop:n,defaultProp:i,onChange:s}),[N,T]=g4({prop:a,defaultProp:o,onChange:c}),D=K.useRef(null),R=g?!!g.closest("form"):!0,[E,F]=K.useState(new Set),A=Array.from(E).map(I=>I.props.value).join(";");return K.createElement(ife,h,K.createElement(Jfe,{required:p,scope:e,trigger:g,onTriggerChange:v,valueNode:x,onValueNodeChange:b,valueNodeHasChildren:S,onValueNodeHasChildrenChange:_,contentId:FR(),value:N,onValueChange:T,open:C,onOpenChange:B,dir:P,triggerPointerDownPosRef:D,disabled:d},K.createElement(z2.Provider,{scope:e},K.createElement(Xfe,{scope:t.__scopeSelect,onNativeOptionAdd:K.useCallback(I=>{F(j=>new Set(j).add(I))},[]),onNativeOptionRemove:K.useCallback(I=>{F(j=>{const $=new Set(j);return $.delete(I),$})},[])},r)),R?K.createElement(aD,{key:A,"aria-hidden":!0,required:p,tabIndex:-1,name:l,autoComplete:f,value:N,onChange:I=>T(I.target.value),disabled:d},N===void 0?K.createElement("option",{value:""}):null,Array.from(E)):null))},ede="SelectTrigger",tde=K.forwardRef((t,e)=>{const{__scopeSelect:r,disabled:n=!1,...i}=t,s=GE(r),a=rf(ede,r),o=a.disabled||n,c=pn(e,a.onTriggerChange),u=H2(r),[l,f,d]=oD(h=>{const g=u().filter(b=>!b.disabled),v=g.find(b=>b.value===a.value),x=cD(g,h,v);x!==void 0&&a.onValueChange(x.value)}),p=()=>{o||(a.onOpenChange(!0),d())};return K.createElement(sfe,Pt({asChild:!0},s),K.createElement(Hr.button,Pt({type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:o,"data-disabled":o?"":void 0,"data-placeholder":sD(a.value)?"":void 0},i,{ref:c,onClick:$r(i.onClick,h=>{h.currentTarget.focus()}),onPointerDown:$r(i.onPointerDown,h=>{const g=h.target;g.hasPointerCapture(h.pointerId)&&g.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&(p(),a.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)},h.preventDefault())}),onKeyDown:$r(i.onKeyDown,h=>{const g=l.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&f(h.key),!(g&&h.key===" ")&&Wfe.includes(h.key)&&(p(),h.preventDefault())})})))}),rde="SelectValue",nde=K.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:i,children:s,placeholder:a="",...o}=t,c=rf(rde,r),{onValueNodeHasChildrenChange:u}=c,l=s!==void 0,f=pn(e,c.onValueNodeChange);return cs(()=>{u(l)},[u,l]),K.createElement(Hr.span,Pt({},o,{ref:f,style:{pointerEvents:"none"}}),sD(c.value)?K.createElement(K.Fragment,null,a):s)}),ide=K.forwardRef((t,e)=>{const{__scopeSelect:r,children:n,...i}=t;return K.createElement(Hr.span,Pt({"aria-hidden":!0},i,{ref:e}),n||"▼")}),sde=t=>K.createElement(ofe,Pt({asChild:!0},t)),Mh="SelectContent",ade=K.forwardRef((t,e)=>{const r=rf(Mh,t.__scopeSelect),[n,i]=K.useState();if(cs(()=>{i(new DocumentFragment)},[]),!r.open){const s=n;return s?$h.createPortal(K.createElement(rD,{scope:t.__scopeSelect},K.createElement(z2.Slot,{scope:t.__scopeSelect},K.createElement("div",null,t.children))),s):null}return K.createElement(ode,Pt({},t,{ref:e}))}),Ja=10,[rD,nf]=i0(Mh),ode=K.forwardRef((t,e)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:a,side:o,sideOffset:c,align:u,alignOffset:l,arrowPadding:f,collisionBoundary:d,collisionPadding:p,sticky:h,hideWhenDetached:g,avoidCollisions:v,...x}=t,b=rf(Mh,r),[S,_]=K.useState(null),[P,C]=K.useState(null),B=pn(e,de=>_(de)),[N,T]=K.useState(null),[D,R]=K.useState(null),E=H2(r),[F,A]=K.useState(!1),I=K.useRef(!1);K.useEffect(()=>{if(S)return dfe(S)},[S]),Jue();const j=K.useCallback(de=>{const[pe,...we]=E().map(Fe=>Fe.ref.current),[_e]=we.slice(-1),Me=document.activeElement;for(const Fe of de)if(Fe===Me||(Fe==null||Fe.scrollIntoView({block:"nearest"}),Fe===pe&&P&&(P.scrollTop=0),Fe===_e&&P&&(P.scrollTop=P.scrollHeight),Fe==null||Fe.focus(),document.activeElement!==Me))return},[E,P]),$=K.useCallback(()=>j([N,S]),[j,N,S]);K.useEffect(()=>{F&&$()},[F,$]);const{onOpenChange:W,triggerPointerDownPosRef:H}=b;K.useEffect(()=>{if(S){let de={x:0,y:0};const pe=_e=>{var Me,Fe,De,V;de={x:Math.abs(Math.round(_e.pageX)-((Me=(Fe=H.current)===null||Fe===void 0?void 0:Fe.x)!==null&&Me!==void 0?Me:0)),y:Math.abs(Math.round(_e.pageY)-((De=(V=H.current)===null||V===void 0?void 0:V.y)!==null&&De!==void 0?De:0))}},we=_e=>{de.x<=10&&de.y<=10?_e.preventDefault():S.contains(_e.target)||W(!1),document.removeEventListener("pointermove",pe),H.current=null};return H.current!==null&&(document.addEventListener("pointermove",pe),document.addEventListener("pointerup",we,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",pe),document.removeEventListener("pointerup",we,{capture:!0})}}},[S,W,H]),K.useEffect(()=>{const de=()=>W(!1);return window.addEventListener("blur",de),window.addEventListener("resize",de),()=>{window.removeEventListener("blur",de),window.removeEventListener("resize",de)}},[W]);const[O,L]=oD(de=>{const pe=E().filter(Me=>!Me.disabled),we=pe.find(Me=>Me.ref.current===document.activeElement),_e=cD(pe,de,we);_e&&setTimeout(()=>_e.ref.current.focus())}),q=K.useCallback((de,pe,we)=>{const _e=!I.current&&!we;(b.value!==void 0&&b.value===pe||_e)&&(T(de),_e&&(I.current=!0))},[b.value]),ee=K.useCallback(()=>S==null?void 0:S.focus(),[S]),X=K.useCallback((de,pe,we)=>{const _e=!I.current&&!we;(b.value!==void 0&&b.value===pe||_e)&&R(de)},[b.value]),ae=n==="popper"?OC:cde,ve=ae===OC?{side:o,sideOffset:c,align:u,alignOffset:l,arrowPadding:f,collisionBoundary:d,collisionPadding:p,sticky:h,hideWhenDetached:g,avoidCollisions:v}:{};return K.createElement(rD,{scope:r,content:S,viewport:P,onViewportChange:C,itemRefCallback:q,selectedItem:N,onItemLeave:ee,itemTextRefCallback:X,focusSelectedItem:$,selectedItemText:D,position:n,isPositioned:F,searchRef:O},K.createElement(Kfe,{as:oh,allowPinchZoom:!0},K.createElement(Xue,{asChild:!0,trapped:b.open,onMountAutoFocus:de=>{de.preventDefault()},onUnmountAutoFocus:$r(i,de=>{var pe;(pe=b.trigger)===null||pe===void 0||pe.focus({preventScroll:!0}),de.preventDefault()})},K.createElement(Wue,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:de=>de.preventDefault(),onDismiss:()=>b.onOpenChange(!1)},K.createElement(ae,Pt({role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:de=>de.preventDefault()},x,ve,{onPlaced:()=>A(!0),ref:B,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:$r(x.onKeyDown,de=>{const pe=de.ctrlKey||de.altKey||de.metaKey;if(de.key==="Tab"&&de.preventDefault(),!pe&&de.key.length===1&&L(de.key),["ArrowUp","ArrowDown","Home","End"].includes(de.key)){let _e=E().filter(Me=>!Me.disabled).map(Me=>Me.ref.current);if(["ArrowUp","End"].includes(de.key)&&(_e=_e.slice().reverse()),["ArrowUp","ArrowDown"].includes(de.key)){const Me=de.target,Fe=_e.indexOf(Me);_e=_e.slice(Fe+1)}setTimeout(()=>j(_e)),de.preventDefault()}})}))))))}),cde=K.forwardRef((t,e)=>{const{__scopeSelect:r,onPlaced:n,...i}=t,s=rf(Mh,r),a=nf(Mh,r),[o,c]=K.useState(null),[u,l]=K.useState(null),f=pn(e,B=>l(B)),d=H2(r),p=K.useRef(!1),h=K.useRef(!0),{viewport:g,selectedItem:v,selectedItemText:x,focusSelectedItem:b}=a,S=K.useCallback(()=>{if(s.trigger&&s.valueNode&&o&&u&&g&&v&&x){const B=s.trigger.getBoundingClientRect(),N=u.getBoundingClientRect(),T=s.valueNode.getBoundingClientRect(),D=x.getBoundingClientRect();if(s.dir!=="rtl"){const Me=D.left-N.left,Fe=T.left-Me,De=B.left-Fe,V=B.width+De,le=Math.max(V,N.width),ce=window.innerWidth-Ja,Y=gC(Fe,[Ja,ce-le]);o.style.minWidth=V+"px",o.style.left=Y+"px"}else{const Me=N.right-D.right,Fe=window.innerWidth-T.right-Me,De=window.innerWidth-B.right-Fe,V=B.width+De,le=Math.max(V,N.width),ce=window.innerWidth-Ja,Y=gC(Fe,[Ja,ce-le]);o.style.minWidth=V+"px",o.style.right=Y+"px"}const R=d(),E=window.innerHeight-Ja*2,F=g.scrollHeight,A=window.getComputedStyle(u),I=parseInt(A.borderTopWidth,10),j=parseInt(A.paddingTop,10),$=parseInt(A.borderBottomWidth,10),W=parseInt(A.paddingBottom,10),H=I+j+F+W+$,O=Math.min(v.offsetHeight*5,H),L=window.getComputedStyle(g),q=parseInt(L.paddingTop,10),ee=parseInt(L.paddingBottom,10),X=B.top+B.height/2-Ja,ae=E-X,ve=v.offsetHeight/2,de=v.offsetTop+ve,pe=I+j+de,we=H-pe;if(pe<=X){const Me=v===R[R.length-1].ref.current;o.style.bottom="0px";const Fe=u.clientHeight-g.offsetTop-g.offsetHeight,De=Math.max(ae,ve+(Me?ee:0)+Fe+$),V=pe+De;o.style.height=V+"px"}else{const Me=v===R[0].ref.current;o.style.top="0px";const De=Math.max(X,I+g.offsetTop+(Me?q:0)+ve)+we;o.style.height=De+"px",g.scrollTop=pe-X+g.offsetTop}o.style.margin=`${Ja}px 0`,o.style.minHeight=O+"px",o.style.maxHeight=E+"px",n==null||n(),requestAnimationFrame(()=>p.current=!0)}},[d,s.trigger,s.valueNode,o,u,g,v,x,s.dir,n]);cs(()=>S(),[S]);const[_,P]=K.useState();cs(()=>{u&&P(window.getComputedStyle(u).zIndex)},[u]);const C=K.useCallback(B=>{B&&h.current===!0&&(S(),b==null||b(),h.current=!1)},[S,b]);return K.createElement(ude,{scope:r,contentWrapper:o,shouldExpandOnScrollRef:p,onScrollButtonChange:C},K.createElement("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_}},K.createElement(Hr.div,Pt({},i,{ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}}))))}),OC=K.forwardRef((t,e)=>{const{__scopeSelect:r,align:n="start",collisionPadding:i=Ja,...s}=t,a=GE(r);return K.createElement(afe,Pt({},a,s,{ref:e,align:n,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}}))}),[ude,ZE]=i0(Mh,{}),MC="SelectViewport",lde=K.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,i=nf(MC,r),s=ZE(MC,r),a=pn(e,i.onViewportChange),o=K.useRef(0);return K.createElement(K.Fragment,null,K.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"}}),K.createElement(z2.Slot,{scope:r},K.createElement(Hr.div,Pt({"data-radix-select-viewport":"",role:"presentation"},n,{ref:a,style:{position:"relative",flex:1,overflow:"auto",...n.style},onScroll:$r(n.onScroll,c=>{const u=c.currentTarget,{contentWrapper:l,shouldExpandOnScrollRef:f}=s;if(f!=null&&f.current&&l){const d=Math.abs(o.current-u.scrollTop);if(d>0){const p=window.innerHeight-Ja*2,h=parseFloat(l.style.minHeight),g=parseFloat(l.style.height),v=Math.max(h,g);if(v0?S:0,l.style.justifyContent="flex-end")}}}o.current=u.scrollTop})}))))}),fde="SelectGroup",[A0e,dde]=i0(fde),hde="SelectLabel",pde=K.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,i=dde(hde,r);return K.createElement(Hr.div,Pt({id:i.id},n,{ref:e}))}),J3="SelectItem",[gde,nD]=i0(J3),mde=K.forwardRef((t,e)=>{const{__scopeSelect:r,value:n,disabled:i=!1,textValue:s,...a}=t,o=rf(J3,r),c=nf(J3,r),u=o.value===n,[l,f]=K.useState(s??""),[d,p]=K.useState(!1),h=pn(e,x=>{var b;return(b=c.itemRefCallback)===null||b===void 0?void 0:b.call(c,x,n,i)}),g=FR(),v=()=>{i||(o.onValueChange(n),o.onOpenChange(!1))};if(n==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return K.createElement(gde,{scope:r,value:n,disabled:i,textId:g,isSelected:u,onItemTextChange:K.useCallback(x=>{f(b=>{var S;return b||((S=x==null?void 0:x.textContent)!==null&&S!==void 0?S:"").trim()})},[])},K.createElement(z2.ItemSlot,{scope:r,value:n,disabled:i,textValue:l},K.createElement(Hr.div,Pt({role:"option","aria-labelledby":g,"data-highlighted":d?"":void 0,"aria-selected":u&&d,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1},a,{ref:h,onFocus:$r(a.onFocus,()=>p(!0)),onBlur:$r(a.onBlur,()=>p(!1)),onPointerUp:$r(a.onPointerUp,v),onPointerMove:$r(a.onPointerMove,x=>{if(i){var b;(b=c.onItemLeave)===null||b===void 0||b.call(c)}else x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:$r(a.onPointerLeave,x=>{if(x.currentTarget===document.activeElement){var b;(b=c.onItemLeave)===null||b===void 0||b.call(c)}}),onKeyDown:$r(a.onKeyDown,x=>{var b;((b=c.searchRef)===null||b===void 0?void 0:b.current)!==""&&x.key===" "||(Gfe.includes(x.key)&&v(),x.key===" "&&x.preventDefault())})}))))}),K1="SelectItemText",vde=K.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:i,...s}=t,a=rf(K1,r),o=nf(K1,r),c=nD(K1,r),u=Qfe(K1,r),[l,f]=K.useState(null),d=pn(e,x=>f(x),c.onItemTextChange,x=>{var b;return(b=o.itemTextRefCallback)===null||b===void 0?void 0:b.call(o,x,c.value,c.disabled)}),p=l==null?void 0:l.textContent,h=K.useMemo(()=>K.createElement("option",{key:c.value,value:c.value,disabled:c.disabled},p),[c.disabled,c.value,p]),{onNativeOptionAdd:g,onNativeOptionRemove:v}=u;return cs(()=>(g(h),()=>v(h)),[g,v,h]),K.createElement(K.Fragment,null,K.createElement(Hr.span,Pt({id:c.textId},s,{ref:d})),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?$h.createPortal(s.children,a.valueNode):null)}),yde="SelectItemIndicator",xde=K.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return nD(yde,r).isSelected?K.createElement(Hr.span,Pt({"aria-hidden":!0},n,{ref:e})):null}),LC="SelectScrollUpButton",bde=K.forwardRef((t,e)=>{const r=nf(LC,t.__scopeSelect),n=ZE(LC,t.__scopeSelect),[i,s]=K.useState(!1),a=pn(e,n.onScrollButtonChange);return cs(()=>{if(r.viewport&&r.isPositioned){let u=function(){const l=c.scrollTop>0;s(l)};var o=u;const c=r.viewport;return u(),c.addEventListener("scroll",u),()=>c.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),i?K.createElement(iD,Pt({},t,{ref:a,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=r;o&&c&&(o.scrollTop=o.scrollTop-c.offsetHeight)}})):null}),jC="SelectScrollDownButton",wde=K.forwardRef((t,e)=>{const r=nf(jC,t.__scopeSelect),n=ZE(jC,t.__scopeSelect),[i,s]=K.useState(!1),a=pn(e,n.onScrollButtonChange);return cs(()=>{if(r.viewport&&r.isPositioned){let u=function(){const l=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)c.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),i?K.createElement(iD,Pt({},t,{ref:a,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=r;o&&c&&(o.scrollTop=o.scrollTop+c.offsetHeight)}})):null}),iD=K.forwardRef((t,e)=>{const{__scopeSelect:r,onAutoScroll:n,...i}=t,s=nf("SelectScrollButton",r),a=K.useRef(null),o=H2(r),c=K.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return K.useEffect(()=>()=>c(),[c]),cs(()=>{var u;const l=o().find(f=>f.ref.current===document.activeElement);l==null||(u=l.ref.current)===null||u===void 0||u.scrollIntoView({block:"nearest"})},[o]),K.createElement(Hr.div,Pt({"aria-hidden":!0},i,{ref:e,style:{flexShrink:0,...i.style},onPointerDown:$r(i.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:$r(i.onPointerMove,()=>{var u;(u=s.onItemLeave)===null||u===void 0||u.call(s),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:$r(i.onPointerLeave,()=>{c()})}))}),Ede=K.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return K.createElement(Hr.div,Pt({"aria-hidden":!0},n,{ref:e}))});function sD(t){return t===""||t===void 0}const aD=K.forwardRef((t,e)=>{const{value:r,...n}=t,i=K.useRef(null),s=pn(e,i),a=IB(r);return K.useEffect(()=>{const o=i.current,c=window.HTMLSelectElement.prototype,l=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==r&&l){const f=new Event("change",{bubbles:!0});l.call(o,r),o.dispatchEvent(f)}},[a,r]),K.createElement(cfe,{asChild:!0},K.createElement("select",Pt({},n,{ref:s,defaultValue:r})))});aD.displayName="BubbleSelect";function oD(t){const e=Ro(t),r=K.useRef(""),n=K.useRef(0),i=K.useCallback(a=>{const o=r.current+a;e(o),function c(u){r.current=u,window.clearTimeout(n.current),u!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(o)},[e]),s=K.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return K.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,i,s]}function cD(t,e,r){const i=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,s=r?t.indexOf(r):-1;let a=Sde(t,Math.max(s,0));i.length===1&&(a=a.filter(u=>u!==r));const c=a.find(u=>u.textValue.toLowerCase().startsWith(i.toLowerCase()));return c!==r?c:void 0}function Sde(t,e){return t.map((r,n)=>t[(e+n)%t.length])}const Ade=Yfe,uD=tde,Cde=nde,_de=ide,kde=sde,lD=ade,Bde=lde,fD=pde,dD=mde,Ide=vde,Fde=xde,hD=bde,pD=wde,gD=Ede,Pde=Ade,Tde=Cde,mD=K.forwardRef(({className:t,children:e,...r},n)=>te.jsxs(uD,{ref:n,className:si("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...r,children:[e,te.jsx(_de,{asChild:!0,children:te.jsx(c5,{className:"h-4 w-4 opacity-50"})})]}));mD.displayName=uD.displayName;const vD=K.forwardRef(({className:t,...e},r)=>te.jsx(hD,{ref:r,className:si("flex cursor-default items-center justify-center py-1",t),...e,children:te.jsx(q$,{className:"h-4 w-4"})}));vD.displayName=hD.displayName;const yD=K.forwardRef(({className:t,...e},r)=>te.jsx(pD,{ref:r,className:si("flex cursor-default items-center justify-center py-1",t),...e,children:te.jsx(c5,{className:"h-4 w-4"})}));yD.displayName=pD.displayName;const xD=K.forwardRef(({className:t,children:e,position:r="popper",...n},i)=>te.jsx(kde,{children:te.jsxs(lD,{ref:i,className:si("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,...n,children:[te.jsx(vD,{}),te.jsx(Bde,{className:si("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),te.jsx(yD,{})]})}));xD.displayName=lD.displayName;const Nde=K.forwardRef(({className:t,...e},r)=>te.jsx(fD,{ref:r,className:si("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));Nde.displayName=fD.displayName;const bD=K.forwardRef(({className:t,children:e,...r},n)=>te.jsxs(dD,{ref:n,className:si("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[te.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:te.jsx(Fde,{children:te.jsx(uI,{className:"h-4 w-4"})})}),te.jsx(Ide,{children:e})]}));bD.displayName=dD.displayName;const Rde=K.forwardRef(({className:t,...e},r)=>te.jsx(gD,{ref:r,className:si("-mx-1 my-1 h-px bg-muted",t),...e}));Rde.displayName=gD.displayName;const UC={chat:"/?getcode=tXTL4xmTgBWPhdcnG58zgxGdbLK1tCms_k5rrAHe1SE",token:"/?getcode=Vx0OaXCQV8dd87CiZSxm2dbH8Sn66_bsCzj_1y1BAjo",voting:"/?getcode=n8kHWl8s3n_6aQSUuURvUBUU16gEjYBU8_x4pANSbjs"};function Dde(){const t=Wo(),[e,r]=K.useState([]),[n,i]=K.useState(!1);K.useEffect(()=>{const a=new kne("https://arweave.net/graphql"),o=Fne` + query ($address: [String!]!) { + transactions( + owners: $address + tags: [ + { name: "Data-Protocol", values: ["ao"] } + { name: "Type", values: ["Process"] } + ] + ) { + edges { + node { + id + } + } + } + } + `;async function c(){const u=await window.arweaveWallet.getActiveAddress();console.log(u);const l=await a.request(o,{address:u});console.log(l),r(l.transactions.edges.map(f=>f.node.id))}c()},[]);async function s(){i(!0);const a=Dh(window.arweaveWallet);console.log(a);const o=await $l().spawn({module:UE,scheduler:$E,signer:a,tags:[]});console.log(o),r(c=>[o,...c]),localStorage.setItem("activeProcess",o),t(Oo("Notebook")),i(!1)}return te.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-24",children:[te.jsxs("h1",{className:"text-3xl tracking-tight",children:[te.jsxs("span",{className:"mr-1 font-light italic",children:["Unlock Infinite Creativity with"," "]}),te.jsx("span",{className:"bg-gradient-to-r from-[#006F86] to-white bg-clip-text font-bold not-italic text-transparent",children:"AO notebook's threaded computer"})]}),te.jsxs("div",{className:"flex w-full max-w-xl flex-col gap-3",children:[te.jsx("h3",{className:"text-xl font-bold",children:"Your Processes"}),te.jsxs("div",{className:"flex flex-row items-center gap-3",children:[te.jsxs(Pde,{disabled:e.length===0||n,onValueChange:a=>{localStorage.setItem("activeProcess",a),t(Oo("Notebook"))},children:[te.jsx(mD,{className:"max-w-full flex-grow",children:te.jsx(Tde,{placeholder:n?"Spawning...":"Process ID"})}),te.jsx(xD,{children:e.map(a=>te.jsx(bD,{value:a,children:a},a))})]}),te.jsx("div",{children:"OR"}),te.jsx(Eo,{disabled:n,onClick:s,children:n?"spawning new process...":"Create New Process"})]})]}),te.jsxs("div",{className:"flex w-full max-w-xl flex-col gap-3",children:[te.jsx("h3",{className:"text-xl font-bold",children:"Explore templates"}),te.jsx("div",{className:"grid grid-cols-3 gap-2",children:Object.keys(UC).map((a,o)=>te.jsx(Eo,{onClick:()=>{window.open(UC[a])},children:a},o))})]})]})}function Ode(t){const e=new Date(t);return`${e.toDateString()} ${e.toTimeString()}`}function $C({data:t,processId:e}){const r=Dh(window.arweaveWallet);return $l().message({process:e,signer:r,tags:[{name:"Action",value:"Eval"}],data:t})}function Mde(){const[t,e]=K.useState(""),[r,n]=K.useState(!1),[i,s]=K.useState(!1),[a,o]=K.useState(""),[c,u]=K.useState(""),[l,f]=K.useState([{from:"AO",content:"To start chatting, send /register",timestamp:Date.now()}]);async function d(){if(await window.arweaveWallet.connect(["ACCESS_ADDRESS","SIGN_TRANSACTION"]),t)return alert("already spawned");n(!0);const h=Dh(window.arweaveWallet);console.log(h);const g=await $l().spawn({module:UE,scheduler:$E,signer:h,tags:[]});console.log(g),e(g),localStorage.setItem("mypid",g),n(!1)}K.useEffect(()=>{const h=localStorage.getItem("mypid");h?e(h):d()},[]),K.useEffect(()=>{clearInterval(parseInt(sessionStorage.getItem("interval")||"0"));async function h(){if(!t)return;const g=await kR({process:t,limit:1e3,from:c});console.log(g);let v="";g.edges.forEach(x=>{v=x.cursor}),v&&u(v),sessionStorage.setItem("interval",setTimeout(()=>h(),1e3).toString())}return sessionStorage.setItem("interval",setTimeout(()=>h(),1e3).toString()),()=>clearTimeout(sessionStorage.getItem("interval")||0)},[t]);async function p(h){if(t&&h.key==="Enter"){if(!a)return;if(s(!0),a.startsWith("/register")){console.log("registering");const g=`ao.send({Target=${pC}, Action="Register"})`,v=await $C({data:g,processId:t}),x=await ad({process:t,message:v});console.log(x.Output.data.output)}else if(a!="Inbox"){const g=`ao.send({Target="${pC}" , Data="${a.toString()}", Action="SendMessage"})`;console.log(g);const v=await $C({data:g,processId:t}),x=await ad({process:t,message:v});console.log(x.Output.data.output)}s(!1),o("")}}return te.jsxs("div",{className:"p-2 h-full max-h-[calc(100vh-5rem)] flex flex-col",children:[te.jsxs("div",{className:"flex flex-row gap-2 justify-between",children:[te.jsx("div",{children:"Welcome to AO chatroom!"}),te.jsxs("div",{children:["Your ID: ",te.jsx("pre",{className:"inline",children:t})]})]}),te.jsx("div",{className:"w-full h-full max-h-full flex-grow overflow-scroll bg-black/30 p-2 flex flex-col-reverse gap-5",children:l.map((h,g)=>te.jsxs("div",{className:"flex flex-col font-mono",children:[te.jsx("div",{className:"text-md opacity-70",children:h.from}),te.jsx("div",{className:"text-xs opacity-50",children:Ode(h.timestamp)}),te.jsxs("div",{className:"text-lg",children:["- ",h.content]})]},g))}),te.jsx("input",{type:"text",className:"w-full bg-white/80 outline-none p-1 text-black",disabled:i,value:a,placeholder:"Type message here",onKeyDown:h=>p(h),onChange:h=>o(h.target.value)})]})}const Lde="vs-dark",jde=!0,Ude=[{background:"0A1917",token:""},{foreground:"202020",fontStyle:"italic",token:"comment"},{foreground:"fc6f09",token:"keyword"},{foreground:"fc6f09",token:"storage"},{foreground:"fc83ff",token:"entity.other.inherited-class"},{foreground:"58c554",token:"constant.numeric"},{foreground:"1edafb",token:"constant"},{foreground:"8dff0a",token:"constant.library"},{foreground:"fc6f09",token:"support.function"},{foreground:"fdc251",token:"constant.language"},{foreground:"8dff0a",token:"string"},{foreground:"1edafb",token:"support.type"},{foreground:"8dff0a",token:"support.constant"},{foreground:"fc6f09",token:"meta.tag"},{foreground:"fc6f09",token:"declaration.tag"},{foreground:"fc6f09",token:"entity.name.tag"},{foreground:"ffff89",token:"entity.other.attribute-name"},{foreground:"ffffff",background:"990000",token:"invalid"},{foreground:"519f50",token:"constant.character.escaped"},{foreground:"519f50",token:"constant.character.escape"},{foreground:"519f50",token:"string source"},{foreground:"519f50",token:"string source.ruby"},{foreground:"e6e1dc",background:"144212",token:"markup.inserted"},{foreground:"e6e1dc",background:"660000",token:"markup.deleted"},{background:"2f33ab",token:"meta.diff.header"},{background:"2f33ab",token:"meta.separator.diff"},{background:"2f33ab",token:"meta.diff.index"},{background:"2f33ab",token:"meta.diff.range"}],$de={"editor.foreground":"#a4b1cd","editor.background":"#ffffff20","editor.selectionBackground":"#454545","editor.lineHighlightBackground":"#333435","editorCursor.foreground":"#FFFFFF","editorWhitespace.foreground":"#404040"},zde={base:Lde,inherit:jde,rules:Ude,colors:$de};let W1;const Hde=new Uint8Array(16);function Vde(){if(!W1&&(W1=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!W1))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return W1(Hde)}const on=[];for(let t=0;t<256;++t)on.push((t+256).toString(16).slice(1));function qde(t,e=0){return on[t[e+0]]+on[t[e+1]]+on[t[e+2]]+on[t[e+3]]+"-"+on[t[e+4]]+on[t[e+5]]+"-"+on[t[e+6]]+on[t[e+7]]+"-"+on[t[e+8]]+on[t[e+9]]+"-"+on[t[e+10]]+on[t[e+11]]+on[t[e+12]]+on[t[e+13]]+on[t[e+14]]+on[t[e+15]]}const Kde=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),zC={randomUUID:Kde};function HC(t,e,r){if(zC.randomUUID&&!e&&!t)return zC.randomUUID();t=t||{};const n=t.random||(t.rng||Vde)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(let i=0;i<16;++i)e[r+i]=n[i];return e}return qde(n)}var wD={},VC=function(){function t(e,r){for(var n=0;n]/gm,function(n){return n=="&"?"&":n=="<"?"<":n==">"?">":""})}},{key:"linkify",value:function(r){return r.replace(/(https?:\/\/[^\s]+)/gm,function(n){return''+n+""})}},{key:"ansiToHtml",value:function(r,n){return this.process(r,n,!0)}},{key:"ansiToJson",value:function(r,n){return n=n||{},n.json=!0,n.clearLine=!1,this.process(r,n,!0)}},{key:"ansiToText",value:function(r){return this.process(r,{},!1)}},{key:"process",value:function(r,n,i){var s=this,a=this,o=r.split(/\033\[/),c=o.shift();n==null&&(n={}),n.clearLine=/\r/.test(r);var u=o.map(function(f){return s.processChunk(f,n,i)});if(n&&n.json){var l=a.processChunkJson("");return l.content=c,l.clearLine=n.clearLine,u.unshift(l),n.remove_empty&&(u=u.filter(function(f){return!f.isEmpty()})),u}else u.unshift(c);return u.join("")}},{key:"processChunkJson",value:function(r,n,i){n=typeof n>"u"?{}:n;var s=n.use_classes=typeof n.use_classes<"u"&&n.use_classes,a=n.key=s?"class":"color",o={content:r,fg:null,bg:null,fg_truecolor:null,bg_truecolor:null,clearLine:n.clearLine,decoration:null,was_processed:!1,isEmpty:function(){return!o.content}},c=r.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);if(!c)return o;o.content=c[4];var u=c[2].split(";");if(c[1]!==""||c[3]!=="m"||!i)return o;var l=this;for(l.decoration=null;u.length>0;){var f=u.shift(),d=parseInt(f);if(isNaN(d)||d===0)l.fg=l.bg=l.decoration=null;else if(d===1)l.decoration="bold";else if(d===2)l.decoration="dim";else if(d==3)l.decoration="italic";else if(d==4)l.decoration="underline";else if(d==5)l.decoration="blink";else if(d===7)l.decoration="reverse";else if(d===8)l.decoration="hidden";else if(d===9)l.decoration="strikethrough";else if(d==39)l.fg=null;else if(d==49)l.bg=null;else if(d>=30&&d<38)l.fg=yf[0][d%10][a];else if(d>=90&&d<98)l.fg=yf[1][d%10][a];else if(d>=40&&d<48)l.bg=yf[0][d%10][a];else if(d>=100&&d<108)l.bg=yf[1][d%10][a];else if(d===38||d===48){var p=d===38;if(u.length>=1){var h=u.shift();if(h==="5"&&u.length>=1){var g=parseInt(u.shift());if(g>=0&&g<=255)if(!s)this.PALETTE_COLORS||l.setupPalette(),p?l.fg=this.PALETTE_COLORS[g]:l.bg=this.PALETTE_COLORS[g];else{var v=g>=16?"ansi-palette-"+g:yf[g>7?1:0][g%8].class;p?l.fg=v:l.bg=v}}else if(h==="2"&&u.length>=3){var x=parseInt(u.shift()),b=parseInt(u.shift()),S=parseInt(u.shift());if(x>=0&&x<=255&&b>=0&&b<=255&&S>=0&&S<=255){var _=x+", "+b+", "+S;s?p?(l.fg="ansi-truecolor",l.fg_truecolor=_):(l.bg="ansi-truecolor",l.bg_truecolor=_):p?l.fg=_:l.bg=_}}}}}return l.fg===null&&l.bg===null&&l.decoration===null||(o.fg=l.fg,o.bg=l.bg,o.fg_truecolor=l.fg_truecolor,o.bg_truecolor=l.bg_truecolor,o.decoration=l.decoration,o.was_processed=!0),o}},{key:"processChunk",value:function(r,n,i){var s=this;n=n||{};var a=this.processChunkJson(r,n,i);if(n.json)return a;if(a.isEmpty())return"";if(!a.was_processed)return a.content;var o=n.use_classes,c=[],u=[],l={},f=function(p){var h=[],g=void 0;for(g in p)p.hasOwnProperty(g)&&h.push("data-"+g+'="'+s.escapeForHtml(p[g])+'"');return h.length>0?" "+h.join(" "):""};return a.fg&&(o?(u.push(a.fg+"-fg"),a.fg_truecolor!==null&&(l["ansi-truecolor-fg"]=a.fg_truecolor,a.fg_truecolor=null)):c.push("color:rgb("+a.fg+")")),a.bg&&(o?(u.push(a.bg+"-bg"),a.bg_truecolor!==null&&(l["ansi-truecolor-bg"]=a.bg_truecolor,a.bg_truecolor=null)):c.push("background-color:rgb("+a.bg+")")),a.decoration&&(o?u.push("ansi-"+a.decoration):a.decoration==="bold"?c.push("font-weight:bold"):a.decoration==="dim"?c.push("opacity:0.5"):a.decoration==="italic"?c.push("font-style:italic"):a.decoration==="reverse"?c.push("filter:invert(100%)"):a.decoration==="hidden"?c.push("visibility:hidden"):a.decoration==="strikethrough"?c.push("text-decoration:line-through"):c.push("text-decoration:"+a.decoration)),o?'"+a.content+"":'"+a.content+""}}]),t}(),Zde=Gde,V2={exports:{}};function JE(t){if(!t)return"";if(!/\r/.test(t))return t;for(t=t.replace(/\r+\n/gm,` +`);/\r./.test(t);)t=t.replace(/^([^\r\n]*)\r+([^\r\n]+)/gm,function(e,r,n){return n+r.slice(n.length)});return t}function Jde(t){for(var e=0,r=0;r0;){var n=Jde(e);r.push(e[n]),e=e.slice(n+1)}return r.join("\r")}function Xde(t){if(!t)return"";if(!/\r/.test(t))return t;if(!/\n/.test(t))return qC(t);t=t.replace(/\r+\n/gm,` +`);var e=t.lastIndexOf(` +`);return JE(t.slice(0,e))+` +`+qC(t.slice(e+1))}V2.exports=JE;V2.exports.escapeCarriageReturn=JE;V2.exports.escapeCarriageReturnSafe=Xde;var Qde=V2.exports,Yde=it&&it.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},ehe=it&&it.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(wD,"__esModule",{value:!0});const the=Yde(Zde),rhe=Qde,Dm=ehe(K);function nhe(t,e=!1){return t=rhe.escapeCarriageReturn(che(t)),the.default.ansiToJson(t,{json:!0,remove_empty:!0,use_classes:e})}function ihe(t){let e="";return t.bg&&(e+=`${t.bg}-bg `),t.fg&&(e+=`${t.fg}-fg `),t.decoration&&(e+=`ansi-${t.decoration} `),e===""?null:(e=e.substring(0,e.length-1),e)}function she(t){const e={};return t.bg&&(e.backgroundColor=`rgb(${t.bg})`),t.fg&&(e.color=`rgb(${t.fg})`),e}function ahe(t,e,r,n){const i=e?null:she(r),s=e?ihe(r):null;if(!t)return Dm.createElement("span",{style:i,key:n,className:s},r.content);const a=[],o=/(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g;let c=0,u;for(;(u=o.exec(r.content))!==null;){const[,l,f]=u,d=u.index+l.length;d>c&&a.push(r.content.substring(c,d));const p=f.startsWith("www.")?`http://${f}`:f;a.push(Dm.createElement("a",{key:c,href:p,target:"_blank"},`${f}`)),c=o.lastIndex}return ctypeof window=="object"?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||uhe,fhe=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,dhe=/\/\*[^]*?\*\/| +/g,KC=/\n+/g,bc=(t,e)=>{let r="",n="",i="";for(let s in t){let a=t[s];s[0]=="@"?s[1]=="i"?r=s+" "+a+";":n+=s[1]=="f"?bc(a,s):s+"{"+bc(a,s[1]=="k"?"":e)+"}":typeof a=="object"?n+=bc(a,e?e.replace(/([^,])+/g,o=>s.replace(/(^:.*)|([^,])+/g,c=>/&/.test(c)?c.replace(/&/g,o):o?o+" "+c:c)):s):a!=null&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=bc.p?bc.p(s,a):s+":"+a+";")}return r+(e&&i?e+"{"+i+"}":i)+n},Ka={},SD=t=>{if(typeof t=="object"){let e="";for(let r in t)e+=r+SD(t[r]);return e}return t},hhe=(t,e,r,n,i)=>{let s=SD(t),a=Ka[s]||(Ka[s]=(c=>{let u=0,l=11;for(;u>>0;return"go"+l})(s));if(!Ka[a]){let c=s!==t?t:(u=>{let l,f,d=[{}];for(;l=fhe.exec(u.replace(dhe,""));)l[4]?d.shift():l[3]?(f=l[3].replace(KC," ").trim(),d.unshift(d[0][f]=d[0][f]||{})):d[0][l[1]]=l[2].replace(KC," ").trim();return d[0]})(t);Ka[a]=bc(i?{["@keyframes "+a]:c}:c,r?"":"."+a)}let o=r&&Ka.g?Ka.g:null;return r&&(Ka.g=Ka[a]),((c,u,l,f)=>{f?u.data=u.data.replace(f,c):u.data.indexOf(c)===-1&&(u.data=l?c+u.data:u.data+c)})(Ka[a],e,n,o),a},phe=(t,e,r)=>t.reduce((n,i,s)=>{let a=e[s];if(a&&a.call){let o=a(r),c=o&&o.props&&o.props.className||/^go/.test(o)&&o;a=c?"."+c:o&&typeof o=="object"?o.props?"":bc(o,""):o===!1?"":o}return n+i+(a??"")},"");function q2(t){let e=this||{},r=t.call?t(e.p):t;return hhe(r.unshift?r.raw?phe(r,[].slice.call(arguments,1),e.p):r.reduce((n,i)=>Object.assign(n,i&&i.call?i(e.p):i),{}):r,lhe(e.target),e.g,e.o,e.k)}let AD,X3,Q3;q2.bind({g:1});let qo=q2.bind({k:1});function ghe(t,e,r,n){bc.p=e,AD=t,X3=r,Q3=n}function Su(t,e){let r=this||{};return function(){let n=arguments;function i(s,a){let o=Object.assign({},s),c=o.className||i.className;r.p=Object.assign({theme:X3&&X3()},o),r.o=/ *go\d+/.test(c),o.className=q2.apply(r,n)+(c?" "+c:""),e&&(o.ref=a);let u=t;return t[0]&&(u=o.as||t,delete o.as),Q3&&u[0]&&Q3(o),AD(u,o)}return e?e(i):i}}var mhe=t=>typeof t=="function",cy=(t,e)=>mhe(t)?t(e):t,vhe=(()=>{let t=0;return()=>(++t).toString()})(),CD=(()=>{let t;return()=>{if(t===void 0&&typeof window<"u"){let e=matchMedia("(prefers-reduced-motion: reduce)");t=!e||e.matches}return t}})(),yhe=20,Om=new Map,xhe=1e3,WC=t=>{if(Om.has(t))return;let e=setTimeout(()=>{Om.delete(t),sf({type:4,toastId:t})},xhe);Om.set(t,e)},bhe=t=>{let e=Om.get(t);e&&clearTimeout(e)},Y3=(t,e)=>{switch(e.type){case 0:return{...t,toasts:[e.toast,...t.toasts].slice(0,yhe)};case 1:return e.toast.id&&bhe(e.toast.id),{...t,toasts:t.toasts.map(s=>s.id===e.toast.id?{...s,...e.toast}:s)};case 2:let{toast:r}=e;return t.toasts.find(s=>s.id===r.id)?Y3(t,{type:1,toast:r}):Y3(t,{type:0,toast:r});case 3:let{toastId:n}=e;return n?WC(n):t.toasts.forEach(s=>{WC(s.id)}),{...t,toasts:t.toasts.map(s=>s.id===n||n===void 0?{...s,visible:!1}:s)};case 4:return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(s=>s.id!==e.toastId)};case 5:return{...t,pausedAt:e.time};case 6:let i=e.time-(t.pausedAt||0);return{...t,pausedAt:void 0,toasts:t.toasts.map(s=>({...s,pauseDuration:s.pauseDuration+i}))}}},Mm=[],Lm={toasts:[],pausedAt:void 0},sf=t=>{Lm=Y3(Lm,t),Mm.forEach(e=>{e(Lm)})},whe={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Ehe=(t={})=>{let[e,r]=K.useState(Lm);K.useEffect(()=>(Mm.push(r),()=>{let i=Mm.indexOf(r);i>-1&&Mm.splice(i,1)}),[e]);let n=e.toasts.map(i=>{var s,a;return{...t,...t[i.type],...i,duration:i.duration||((s=t[i.type])==null?void 0:s.duration)||(t==null?void 0:t.duration)||whe[i.type],style:{...t.style,...(a=t[i.type])==null?void 0:a.style,...i.style}}});return{...e,toasts:n}},She=(t,e="blank",r)=>({createdAt:Date.now(),visible:!0,type:e,ariaProps:{role:"status","aria-live":"polite"},message:t,pauseDuration:0,...r,id:(r==null?void 0:r.id)||vhe()}),s1=t=>(e,r)=>{let n=She(e,t,r);return sf({type:2,toast:n}),n.id},$n=(t,e)=>s1("blank")(t,e);$n.error=s1("error");$n.success=s1("success");$n.loading=s1("loading");$n.custom=s1("custom");$n.dismiss=t=>{sf({type:3,toastId:t})};$n.remove=t=>sf({type:4,toastId:t});$n.promise=(t,e,r)=>{let n=$n.loading(e.loading,{...r,...r==null?void 0:r.loading});return t.then(i=>($n.success(cy(e.success,i),{id:n,...r,...r==null?void 0:r.success}),i)).catch(i=>{$n.error(cy(e.error,i),{id:n,...r,...r==null?void 0:r.error})}),t};var Ahe=(t,e)=>{sf({type:1,toast:{id:t,height:e}})},Che=()=>{sf({type:5,time:Date.now()})},_he=t=>{let{toasts:e,pausedAt:r}=Ehe(t);K.useEffect(()=>{if(r)return;let s=Date.now(),a=e.map(o=>{if(o.duration===1/0)return;let c=(o.duration||0)+o.pauseDuration-(s-o.createdAt);if(c<0){o.visible&&$n.dismiss(o.id);return}return setTimeout(()=>$n.dismiss(o.id),c)});return()=>{a.forEach(o=>o&&clearTimeout(o))}},[e,r]);let n=K.useCallback(()=>{r&&sf({type:6,time:Date.now()})},[r]),i=K.useCallback((s,a)=>{let{reverseOrder:o=!1,gutter:c=8,defaultPosition:u}=a||{},l=e.filter(p=>(p.position||u)===(s.position||u)&&p.height),f=l.findIndex(p=>p.id===s.id),d=l.filter((p,h)=>hp.visible).slice(...o?[d+1]:[0,d]).reduce((p,h)=>p+(h.height||0)+c,0)},[e]);return{toasts:e,handlers:{updateHeight:Ahe,startPause:Che,endPause:n,calculateOffset:i}}},khe=qo` +from { + transform: scale(0) rotate(45deg); + opacity: 0; +} +to { + transform: scale(1) rotate(45deg); + opacity: 1; +}`,Bhe=qo` +from { + transform: scale(0); + opacity: 0; +} +to { + transform: scale(1); + opacity: 1; +}`,Ihe=qo` +from { + transform: scale(0) rotate(90deg); + opacity: 0; +} +to { + transform: scale(1) rotate(90deg); + opacity: 1; +}`,Fhe=Su("div")` + width: 20px; + opacity: 0; + height: 20px; + border-radius: 10px; + background: ${t=>t.primary||"#ff4b4b"}; + position: relative; + transform: rotate(45deg); + + animation: ${khe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) + forwards; + animation-delay: 100ms; + + &:after, + &:before { + content: ''; + animation: ${Bhe} 0.15s ease-out forwards; + animation-delay: 150ms; + position: absolute; + border-radius: 3px; + opacity: 0; + background: ${t=>t.secondary||"#fff"}; + bottom: 9px; + left: 4px; + height: 2px; + width: 12px; + } + + &:before { + animation: ${Ihe} 0.15s ease-out forwards; + animation-delay: 180ms; + transform: rotate(90deg); + } +`,Phe=qo` + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +`,The=Su("div")` + width: 12px; + height: 12px; + box-sizing: border-box; + border: 2px solid; + border-radius: 100%; + border-color: ${t=>t.secondary||"#e0e0e0"}; + border-right-color: ${t=>t.primary||"#616161"}; + animation: ${Phe} 1s linear infinite; +`,Nhe=qo` +from { + transform: scale(0) rotate(45deg); + opacity: 0; +} +to { + transform: scale(1) rotate(45deg); + opacity: 1; +}`,Rhe=qo` +0% { + height: 0; + width: 0; + opacity: 0; +} +40% { + height: 0; + width: 6px; + opacity: 1; +} +100% { + opacity: 1; + height: 10px; +}`,Dhe=Su("div")` + width: 20px; + opacity: 0; + height: 20px; + border-radius: 10px; + background: ${t=>t.primary||"#61d345"}; + position: relative; + transform: rotate(45deg); + + animation: ${Nhe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) + forwards; + animation-delay: 100ms; + &:after { + content: ''; + box-sizing: border-box; + animation: ${Rhe} 0.2s ease-out forwards; + opacity: 0; + animation-delay: 200ms; + position: absolute; + border-right: 2px solid; + border-bottom: 2px solid; + border-color: ${t=>t.secondary||"#fff"}; + bottom: 6px; + left: 6px; + height: 10px; + width: 6px; + } +`,Ohe=Su("div")` + position: absolute; +`,Mhe=Su("div")` + position: relative; + display: flex; + justify-content: center; + align-items: center; + min-width: 20px; + min-height: 20px; +`,Lhe=qo` +from { + transform: scale(0.6); + opacity: 0.4; +} +to { + transform: scale(1); + opacity: 1; +}`,jhe=Su("div")` + position: relative; + transform: scale(0.6); + opacity: 0.4; + min-width: 20px; + animation: ${Lhe} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275) + forwards; +`,Uhe=({toast:t})=>{let{icon:e,type:r,iconTheme:n}=t;return e!==void 0?typeof e=="string"?K.createElement(jhe,null,e):e:r==="blank"?null:K.createElement(Mhe,null,K.createElement(The,{...n}),r!=="loading"&&K.createElement(Ohe,null,r==="error"?K.createElement(Fhe,{...n}):K.createElement(Dhe,{...n})))},$he=t=>` +0% {transform: translate3d(0,${t*-200}%,0) scale(.6); opacity:.5;} +100% {transform: translate3d(0,0,0) scale(1); opacity:1;} +`,zhe=t=>` +0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;} +100% {transform: translate3d(0,${t*-150}%,-1px) scale(.6); opacity:0;} +`,Hhe="0%{opacity:0;} 100%{opacity:1;}",Vhe="0%{opacity:1;} 100%{opacity:0;}",qhe=Su("div")` + display: flex; + align-items: center; + background: #fff; + color: #363636; + line-height: 1.3; + will-change: transform; + box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05); + max-width: 350px; + pointer-events: auto; + padding: 8px 10px; + border-radius: 8px; +`,Khe=Su("div")` + display: flex; + justify-content: center; + margin: 4px 10px; + color: inherit; + flex: 1 1 auto; + white-space: pre-line; +`,Whe=(t,e)=>{let r=t.includes("top")?1:-1,[n,i]=CD()?[Hhe,Vhe]:[$he(r),zhe(r)];return{animation:e?`${qo(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${qo(i)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},Ghe=K.memo(({toast:t,position:e,style:r,children:n})=>{let i=t.height?Whe(t.position||e||"top-center",t.visible):{opacity:0},s=K.createElement(Uhe,{toast:t}),a=K.createElement(Khe,{...t.ariaProps},cy(t.message,t));return K.createElement(qhe,{className:t.className,style:{...i,...r,...t.style}},typeof n=="function"?n({icon:s,message:a}):K.createElement(K.Fragment,null,s,a))});ghe(K.createElement);var Zhe=({id:t,className:e,style:r,onHeightUpdate:n,children:i})=>{let s=K.useCallback(a=>{if(a){let o=()=>{let c=a.getBoundingClientRect().height;n(t,c)};o(),new MutationObserver(o).observe(a,{subtree:!0,childList:!0,characterData:!0})}},[t,n]);return K.createElement("div",{ref:s,className:e,style:r},i)},Jhe=(t,e)=>{let r=t.includes("top"),n=r?{top:0}:{bottom:0},i=t.includes("center")?{justifyContent:"center"}:t.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:CD()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${e*(r?1:-1)}px)`,...n,...i}},Xhe=q2` + z-index: 9999; + > * { + pointer-events: auto; + } +`,G1=16,_D=({reverseOrder:t,position:e="top-center",toastOptions:r,gutter:n,children:i,containerStyle:s,containerClassName:a})=>{let{toasts:o,handlers:c}=_he(r);return K.createElement("div",{style:{position:"fixed",zIndex:9999,top:G1,left:G1,right:G1,bottom:G1,pointerEvents:"none",...s},className:a,onMouseEnter:c.startPause,onMouseLeave:c.endPause},o.map(u=>{let l=u.position||e,f=c.calculateOffset(u,{reverseOrder:t,gutter:n,defaultPosition:e}),d=Jhe(l,f);return K.createElement(Zhe,{id:u.id,key:u.id,onHeightUpdate:c.updateHeight,className:u.visible?Xhe:"",style:d},u.type==="custom"?cy(u.message,u):i?i(u):K.createElement(Ghe,{toast:u,position:l}))}))};function e8({data:t,processId:e}){const r=Dh(window.arweaveWallet);return $l().message({process:e,signer:r,tags:[{name:"Action",value:"Eval"}],data:t})}function Qhe({cellId:t,aosProcess:e,cellCodeItems:r,cellOutputItems:n,setCellCodeItems:i,setCellOutputItems:s,deleteCell:a,setActiveCell:o}){const[c,u]=K.useState("default");async function l(){u("running");const f=r[t];console.log("sending message",f);try{const d=await e8({data:f,processId:e}),p=await ad({message:d,process:e}),h=`${JSON.stringify(p.Output.data.output,null,2)||p.Output.data.output}`;s(g=>({...g,[t]:h})),u("success")}catch(d){console.log(d),s(p=>({...p,[t]:d.message??"Error executing this snippet"})),u("error")}}return te.jsxs("div",{className:"flex w-full max-w-[calc(90vw-12rem)] flex-col justify-center overflow-x-clip",children:[te.jsxs("div",{className:"flex flex-row gap-4 bg-[#093E49] px-4 py-6 rounded-t-lg",children:[te.jsx(Eo,{variant:"ghost",size:"icon",onClick:l,children:te.jsx(Nr.executeCode,{className:"h-6 w-6"})}),te.jsx("div",{className:"min-h-[52px] flex-grow overflow-clip rounded-sm",children:te.jsx(tN,{className:"max-h-[380px] min-h-[52px]",language:"lua",theme:"merbivore",height:(r[t].split(` +`).length>20?20:r[t].split(` +`).length)*19,defaultValue:r[t],onChange:f=>{i(d=>({...d,[t]:f})),o(t)},options:{minimap:{enabled:!1},lineNumbersMinChars:2,scrollBeyondLastLine:!1,renderLineHighlight:"none"}})}),te.jsx(Eo,{variant:"ghost",size:"icon",onClick:()=>a(t),children:te.jsx(Nr.delete,{className:"h-6 w-6"})})]}),te.jsxs("div",{className:"flex min-h-[32px] flex-row gap-4 bg-[#093E49]/40 px-4 py-3 rounded-b-lg",children:[te.jsxs("div",{className:"flex min-h-[32px] min-w-[30px] items-center justify-center",children:[c=="running"&&te.jsx(Nr.codeRunning,{className:"h-4 w-4"}),c=="success"&&te.jsx(Nr.codeSuccess,{className:"h-4 w-4"}),c=="error"&&te.jsx(Nr.codeError,{className:"h-4 w-4"})]}),te.jsx("pre",{className:"mx-2 max-h-[300px] min-h-[32px] flex-grow overflow-scroll p-2 ring-white/5",children:(()=>{try{return te.jsx(ED,{children:`${JSON.parse(n[t])}`})}catch{return`${n[t]}`}})()}),te.jsx("div",{className:"min-w-[30px]"})]})]})}function Yhe(){const[t,e]=K.useState(!1),[r,n]=K.useState(null),[i,s]=K.useState(null),[a,o]=K.useState(["0"]),[c,u]=K.useState({0:"1 + 41"}),[l,f]=K.useState({0:"click the run button"}),[d,p]=Ry(),[h,g]=K.useState(""),[v,x]=K.useState(!0);K.useEffect(()=>{const T=localStorage.getItem("activeProcess");if(T&&n(T),clearInterval(parseInt(sessionStorage.getItem("interval")||"0")),d.has("getcode")){const R=d.get("getcode");if(R.length!==43)return alert("Invalid process ID");g(R),N(R)}},[]),K.useEffect(()=>{async function T(){if(!r)return;x(!1);const D=await kR({process:r,limit:1e3,from:sessionStorage.getItem("cursor")||""});D.edges.length>0&&D.edges.forEach(R=>{sessionStorage.setItem("cursor",R.cursor);const E=R.node;E.Output.print&&(console.log(E.Output.data),$n.custom(F=>te.jsx("div",{className:`${F.visible?"animate-enter":"animate-leave"} + pointer-events-auto relative bottom-10 right-[280px] flex w-full max-w-md rounded-lg bg-[#121212] p-2 text-white opacity-80 shadow-lg ring-1 ring-white/30 transition-all duration-200 hover:right-0 hover:opacity-100 `,onClick:()=>$n.dismiss(F.id),children:te.jsx(ED,{children:E.Output.data})}),{duration:1e4}))})}return sessionStorage.setItem("interval",setInterval(T,1e3).toString()),()=>{clearInterval(parseInt(sessionStorage.getItem("interval")||"0"))}},[r]),K.useEffect(()=>{localStorage.getItem("notebookData")===null&&localStorage.setItem("notebookData","{}");const T=JSON.parse(localStorage.getItem("notebookData"));r&&T&&(T[r]&&v?(o(T[r].cellIds),u(T[r].cellCodeItems),f(T[r].cellOutputItems),x(!1)):T[r]={cellIds:a,cellCodeItems:c,cellOutputItems:l},localStorage.setItem("notebookData",JSON.stringify(T)))},[r,a,c,l]);function b(T){f(D=>({...D,[T]:"running..."}))}const S=eN();S==null||S.editor.defineTheme("merbivore",zde),S==null||S.editor.addEditorAction({id:"run",label:"Run",keybindings:[S.KeyMod.CtrlCmd|S.KeyCode.Enter],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:async()=>{console.log("running",i);try{b(i);const T=await e8({data:c[i],processId:r}),D=await ad({message:T,process:r});console.log(D);const R=`${JSON.stringify(D.Output.data.output,null,2)||D.Output.data.output}`;console.log(R),f(E=>({...E,[i]:R}))}catch(T){console.log(T.message)}}});async function _(){if(r)return alert("already spawned");e(!0);const T=Dh(window.arweaveWallet);console.log(T);const D=await $l().spawn({module:UE,scheduler:$E,signer:T,tags:[]});console.log(D),n(D),e(!1),P()}function P(){const T=HC();o(D=>[...D,T]),u(D=>({...D,[T]:"1 + 41"})),f(D=>({...D,[T]:""}))}function C(T){o(D=>D.filter(R=>R!==T)),u(D=>(delete D[T],D)),f(D=>(delete D[T],D))}async function B(){const T=a.map(R=>c[R]);console.log("backing up",T);const D=`local json = require("json") + +if not Betteridea then + Betteridea = { + Code = {${JSON.stringify(T,null,2).slice(1,-1)}}, + AccessedBy = {}, + LastUpdated = os.time(os.date("!*t")) + } +else + Betteridea.Code = {${JSON.stringify(T,null,2).slice(1,-1)}} + Betteridea.LastUpdated = os.time(os.date("!*t")) +end + +Handlers.add( + "GetCode", + Handlers.utils.hasMatchingTag("Action","GetCode"), + function(msg) + accessed_by = Betteridea.AccessedBy[msg.From] + if not accessed_by then + Betteridea.AccessedBy[msg.From] = { + Count=1, + Latest=os.time(os.date("!*t")) + } + else + Betteridea.AccessedBy[msg.From] = { + Count = accessed_by.Count+1, + Latest=os.time(os.date("!*t")) + } + end + Handlers.utils.reply(json.encode(Betteridea.Code))(msg) + end +) +`;console.log(D);try{const R=await e8({data:D,processId:r}),E=await ad({message:R,process:r});console.log(E.Output),await navigator.clipboard.writeText(`${window.location.origin}/?getcode=${r}`),alert("shared and url copied to clipboard")}catch(R){console.log(R.message)}}async function N(T){const D=T||h||prompt("Enter the process ID or URL to import");if(!D)return;const R=D.includes("?getcode=")?D.split("?getcode=")[1]:D;if(R.length!==43)return alert("invalid process ID");console.log("importing",R);const E=Dh(window.arweaveWallet),F=await $l().message({process:R,signer:E,tags:[{name:"Action",value:"GetCode"}]});console.log(F);const A=await ad({message:F,process:R});console.log(A);const I=JSON.parse(A.Messages[0].Data);console.log(I);const j=I.length,$=[],W={},H={};for(let O=0;ON(),children:"import"}),a.length>0&&te.jsx(Eo,{className:"h-7",onClick:B,children:"share"})]}),t&&te.jsx("div",{className:"text-center",children:"Spawning process..."}),!t&&te.jsx(te.Fragment,{children:r?te.jsxs("div",{className:"text-center",children:["Process ID: ",te.jsx("pre",{className:"inline",children:r})]}):te.jsx(Eo,{onClick:_,children:"spawn new process"})}),a.map(T=>te.jsx(Qhe,{cellId:T,aosProcess:r,cellCodeItems:c,cellOutputItems:l,setCellCodeItems:u,setCellOutputItems:f,deleteCell:C,setActiveCell:s},T)),r&&te.jsxs(Eo,{onClick:P,children:[te.jsx(Nr.add,{className:"text-black",color:"#000000aa"})," add new cell"]})]})}function kD(){const[t]=Ry(),e=Wo(),{appMode:r,activeSideNavItem:n}=Kl(o=>o.app);function i(o){e(Oo(o))}const s=[{text:"Home",icon:Nr.home,onClick:()=>{i("Home")}},{text:"Notebook",icon:Nr.projects,onClick:()=>{i("Notebook")}}];K.useEffect(()=>{async function o(){if(t.has("getcode")&&r==="aos"){const u=t.get("getcode");if((u==null?void 0:u.length)!==43)return alert("Invalid process ID");e(Oo("Notebook"))}}o()},[r,t,e]);function a(){switch(n){case"Notebook":return te.jsx(Yhe,{});case"AOChat":return te.jsx(Mde,{});case"Settings":return te.jsx(hI,{});default:return te.jsx(Dde,{})}}return te.jsxs("div",{className:"flex flex-col min-h-screen h-screen max-h-screen",children:[te.jsx(cI,{}),te.jsxs("div",{className:"grow flex",children:[te.jsx(lI,{items:s}),te.jsx("div",{className:"grow bg-[#1d1d1d]",children:a()})]})]})}rj([{path:"/notebook",element:te.jsx(kD,{})},{path:"/",element:te.jsx(WT,{})},{path:"/editor",element:te.jsx(rN,{})}]);function e0e(){const t=Wo(),{appMode:e}=Kl(i=>i.app),[r]=Ry(),n=K.useCallback(i=>{t(R$(i))},[t]);return K.useEffect(()=>{(async()=>{const i=window.arweaveWallet;if(!i)return $n.error("Unable to find ArConnect wallet extension. Please install it and refresh the page.",{duration:1e4});try{await i.getActiveAddress(),n(!0)}catch{await i.connect(["ACCESS_ADDRESS","SIGN_TRANSACTION"]),n(!0)}})()},[n]),te.jsxs(te.Fragment,{children:[te.jsx(_D,{}),r.has("editor")?te.jsx(rN,{}):e==="aos"?te.jsx(kD,{}):te.jsx(WT,{})]})}const t0e={theme:"system",setTheme:()=>null},r0e=K.createContext(t0e);function n0e({children:t,defaultTheme:e="system",storageKey:r="vite-ui-theme",...n}){const[i,s]=K.useState(()=>localStorage.getItem(r)||e);K.useEffect(()=>{const o=window.document.documentElement;if(o.classList.remove("light","dark"),i==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";o.classList.add(c);return}o.classList.add(i)},[i]);const a={theme:i,setTheme:o=>{localStorage.setItem(r,o),s(o)}};return te.jsx(r0e.Provider,{...n,value:a,children:t})}const i0e=d$({reducer:{app:D$}});vw.createRoot(document.getElementById("root")).render(te.jsx(jr.StrictMode,{children:te.jsx(_U,{store:i0e,children:te.jsx(n0e,{defaultTheme:"dark",storageKey:"better-ide-theme",children:te.jsx(aj,{children:te.jsx(e0e,{})})})})})); diff --git a/assets/index-ImOM2Gi2.css b/assets/index-ImOM2Gi2.css deleted file mode 100644 index c580b3b..0000000 --- a/assets/index-ImOM2Gi2.css +++ /dev/null @@ -1 +0,0 @@ -:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 222.2 47.4% 11.2%;--primary-foreground: 210 40% 98%;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 222.2 84% 4.9%;--radius: .5rem}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 210 40% 98%;--primary-foreground: 222.2 47.4% 11.2%;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 212.7 26.8% 83.9%;--main-bg: #1d1d1d;--nav-side: #171717;--nav-main: #111111}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Commissioner,sans-serif,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-10{bottom:2.5rem}.left-2{left:.5rem}.left-\[50\%\]{left:50%}.right-2{right:.5rem}.right-4{right:1rem}.right-\[280px\]{right:280px}.top-0{top:0}.top-2{top:.5rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-50{z-index:50}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-5{margin-top:1.25rem;margin-bottom:1.25rem}.ml-2{margin-left:.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mt-5{margin-top:1.25rem}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-2{height:.5rem}.h-20{height:5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-9{height:2.25rem}.h-\[1\.2rem\]{height:1.2rem}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-96{max-height:24rem}.max-h-\[300px\]{max-height:300px}.max-h-\[380px\]{max-height:380px}.max-h-\[calc\(100vh-5rem\)\]{max-height:calc(100vh - 5rem)}.max-h-full{max-height:100%}.max-h-screen{max-height:100vh}.min-h-\[32px\]{min-height:32px}.min-h-\[52px\]{min-height:52px}.min-h-\[5rem\]{min-height:5rem}.min-h-\[80vh\]{min-height:80vh}.min-h-screen{min-height:100vh}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-14{width:3.5rem}.w-2{width:.5rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-72{width:18rem}.w-\[1\.2rem\]{width:1.2rem}.w-\[200px\]{width:200px}.w-\[269px\]{width:269px}.w-\[60px\]{width:60px}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.min-w-\[150px\]{min-width:150px}.min-w-\[30px\]{min-width:30px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-\[150px\]{max-width:150px}.max-w-\[calc\(90vw-12rem\)\]{max-width:calc(90vw - 12rem)}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-xl{max-width:36rem}.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-0{--tw-rotate: 0deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-0{--tw-scale-x: 0;--tw-scale-y: 0;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-evenly{justify-content:space-evenly}.gap-1{gap:.25rem}.gap-10{gap:2.5rem}.gap-2{gap:.5rem}.gap-24{gap:6rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-clip{overflow:clip}.overflow-scroll{overflow:scroll}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-x-clip{overflow-x:clip}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-input{border-color:hsl(var(--input))}.border-transparent{border-color:transparent}.border-white\/10{border-color:#ffffff1a}.border-white\/20{border-color:#fff3}.border-white\/30{border-color:#ffffff4d}.bg-\[\#006F86\]{--tw-bg-opacity: 1;background-color:rgb(0 111 134 / var(--tw-bg-opacity))}.bg-\[\#093E49\]{--tw-bg-opacity: 1;background-color:rgb(9 62 73 / var(--tw-bg-opacity))}.bg-\[\#093E49\]\/40{background-color:#093e4966}.bg-\[\#111111\]{--tw-bg-opacity: 1;background-color:rgb(17 17 17 / var(--tw-bg-opacity))}.bg-\[\#121212\]{--tw-bg-opacity: 1;background-color:rgb(18 18 18 / var(--tw-bg-opacity))}.bg-\[\#171717\]{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity))}.bg-\[\#1d1d1d\]{--tw-bg-opacity: 1;background-color:rgb(29 29 29 / var(--tw-bg-opacity))}.bg-\[\#2c3b50\]{--tw-bg-opacity: 1;background-color:rgb(44 59 80 / var(--tw-bg-opacity))}.bg-background{background-color:hsl(var(--background))}.bg-black\/20{background-color:#0003}.bg-black\/30{background-color:#0000004d}.bg-black\/80{background-color:#000c}.bg-border{background-color:hsl(var(--border))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity))}.bg-muted{background-color:hsl(var(--muted))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:transparent}.bg-white\/10{background-color:#ffffff1a}.bg-white\/80{background-color:#fffc}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-\[\#006F86\]{--tw-gradient-from: #006F86 var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 111 134 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-white{--tw-gradient-to: #fff var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.fill-current{fill:currentColor}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.pl-2{padding-left:.5rem}.pl-5{padding-left:1.25rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-light{font-weight:300}.font-medium{font-weight:500}.font-semibold{font-weight:600}.italic{font-style:italic}.not-italic{font-style:normal}.leading-none{line-height:1}.tracking-tight{letter-spacing:-.025em}.tracking-widest{letter-spacing:.1em}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-green-300{--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-white\/20{--tw-ring-color: rgb(255 255 255 / .2)}.ring-white\/30{--tw-ring-color: rgb(255 255 255 / .3)}.ring-white\/5{--tw-ring-color: rgb(255 255 255 / .05)}.ring-white\/50{--tw-ring-color: rgb(255 255 255 / .5)}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.running{animation-play-state:running}*{padding:0;margin:0;scroll-behavior:smooth!important;-ms-overflow-style:none;scrollbar-width:none;color:#f5f5f5}*::-webkit-scrollbar{display:none}select{background-color:#1f2937;color:#f5f5f5;border:1px solid #1f2937;border-radius:5px;padding:5px;margin:5px}button{transform:scale(1);transition:all .2s ease-in-out}button:hover{transform:scale(1.05);transition:all .2s ease-in-out}button:active{transform:scale(.95);transition:all .2s ease-in-out}html,body{background-color:#1d1d1d}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:right-0:hover{right:0}.hover\:w-24:hover{width:6rem}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:bg-\[\#2f2f2f\]:hover{--tw-bg-opacity: 1;background-color:rgb(47 47 47 / var(--tw-bg-opacity))}.hover\:bg-\[\#395d8b\]:hover{--tw-bg-opacity: 1;background-color:rgb(57 93 139 / var(--tw-bg-opacity))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:bg-zinc-300\/50:hover{background-color:#d4d4d880}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.aria-selected\:bg-accent[aria-selected=true]{background-color:hsl(var(--accent))}.aria-selected\:text-accent-foreground[aria-selected=true]{color:hsl(var(--accent-foreground))}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[state\=closed\]\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}:is(.dark .dark\:-rotate-90){--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}:is(.dark .dark\:rotate-0){--tw-rotate: 0deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}:is(.dark .dark\:scale-0){--tw-scale-x: 0;--tw-scale-y: 0;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}:is(.dark .dark\:scale-100){--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@media (min-width: 640px){.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:text-left{text-align:left}}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem} diff --git a/assets/index-Rz2EaZnf.css b/assets/index-Rz2EaZnf.css new file mode 100644 index 0000000..e56a831 --- /dev/null +++ b/assets/index-Rz2EaZnf.css @@ -0,0 +1 @@ +*{padding:0;margin:0;scroll-behavior:smooth!important;-ms-overflow-style:none;scrollbar-width:none;color:#f5f5f5}*::-webkit-scrollbar{display:none}select{background-color:#1f2937;color:#f5f5f5;border:1px solid #1f2937;border-radius:5px;padding:5px;margin:5px}button{transform:scale(1);transition:all .2s ease-in-out}button:hover{transform:scale(1.05);transition:all .2s ease-in-out}button:active{transform:scale(.95);transition:all .2s ease-in-out}html,body{background-color:#1d1d1d}*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 222.2 47.4% 11.2%;--primary-foreground: 210 40% 98%;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 222.2 84% 4.9%;--radius: .5rem}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 210 40% 98%;--primary-foreground: 222.2 47.4% 11.2%;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 212.7 26.8% 83.9%;--main-bg: #1d1d1d;--nav-side: #171717;--nav-main: #111111}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-10{bottom:2.5rem}.left-2{left:.5rem}.left-\[50\%\]{left:50%}.right-2{right:.5rem}.right-4{right:1rem}.right-\[280px\]{right:280px}.top-0{top:0}.top-2{top:.5rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-50{z-index:50}.z-\[100\]{z-index:100}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-5{margin-top:1.25rem;margin-bottom:1.25rem}.mb-1{margin-bottom:.25rem}.ml-2{margin-left:.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mt-5{margin-top:1.25rem}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-2{height:.5rem}.h-20{height:5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1\.2rem\]{height:1.2rem}.h-\[1px\]{height:1px}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-96{max-height:24rem}.max-h-\[300px\]{max-height:300px}.max-h-\[380px\]{max-height:380px}.max-h-\[calc\(100vh-5rem\)\]{max-height:calc(100vh - 5rem)}.max-h-full{max-height:100%}.max-h-screen{max-height:100vh}.min-h-\[32px\]{min-height:32px}.min-h-\[52px\]{min-height:52px}.min-h-\[5rem\]{min-height:5rem}.min-h-\[80vh\]{min-height:80vh}.min-h-screen{min-height:100vh}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-14{width:3.5rem}.w-2{width:.5rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-72{width:18rem}.w-\[1\.2rem\]{width:1.2rem}.w-\[1px\]{width:1px}.w-\[200px\]{width:200px}.w-\[269px\]{width:269px}.w-\[60px\]{width:60px}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.min-w-\[150px\]{min-width:150px}.min-w-\[30px\]{min-width:30px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-\[150px\]{max-width:150px}.max-w-\[calc\(90vw-12rem\)\]{max-width:calc(90vw - 12rem)}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-xl{max-width:36rem}.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-0{--tw-rotate: 0deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-0{--tw-scale-x: 0;--tw-scale-y: 0;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-evenly{justify-content:space-evenly}.gap-1{gap:.25rem}.gap-10{gap:2.5rem}.gap-2{gap:.5rem}.gap-24{gap:6rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-clip{overflow:clip}.overflow-scroll{overflow:scroll}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-x-clip{overflow-x:clip}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-b-lg{border-bottom-right-radius:var(--radius);border-bottom-left-radius:var(--radius)}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-destructive{border-color:hsl(var(--destructive))}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-input{border-color:hsl(var(--input))}.border-transparent{border-color:transparent}.border-white\/10{border-color:#ffffff1a}.border-white\/20{border-color:#fff3}.border-white\/30{border-color:#ffffff4d}.bg-\[\#006F86\]{--tw-bg-opacity: 1;background-color:rgb(0 111 134 / var(--tw-bg-opacity))}.bg-\[\#093E49\]{--tw-bg-opacity: 1;background-color:rgb(9 62 73 / var(--tw-bg-opacity))}.bg-\[\#093E49\]\/40{background-color:#093e4966}.bg-\[\#111111\]{--tw-bg-opacity: 1;background-color:rgb(17 17 17 / var(--tw-bg-opacity))}.bg-\[\#121212\]{--tw-bg-opacity: 1;background-color:rgb(18 18 18 / var(--tw-bg-opacity))}.bg-\[\#171717\]{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity))}.bg-\[\#1d1d1d\]{--tw-bg-opacity: 1;background-color:rgb(29 29 29 / var(--tw-bg-opacity))}.bg-\[\#2c3b50\]{--tw-bg-opacity: 1;background-color:rgb(44 59 80 / var(--tw-bg-opacity))}.bg-background{background-color:hsl(var(--background))}.bg-black\/20{background-color:#0003}.bg-black\/30{background-color:#0000004d}.bg-black\/80{background-color:#000c}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity))}.bg-muted{background-color:hsl(var(--muted))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:transparent}.bg-white\/10{background-color:#ffffff1a}.bg-white\/80{background-color:#fffc}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-\[\#006F86\]{--tw-gradient-from: #006F86 var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 111 134 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-white{--tw-gradient-to: #fff var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.fill-current{fill:currentColor}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.pl-2{padding-left:.5rem}.pl-5{padding-left:1.25rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-light{font-weight:300}.font-medium{font-weight:500}.font-semibold{font-weight:600}.italic{font-style:italic}.not-italic{font-style:normal}.leading-none{line-height:1}.tracking-tight{letter-spacing:-.025em}.tracking-widest{letter-spacing:.1em}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-green-300{--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-white\/20{--tw-ring-color: rgb(255 255 255 / .2)}.ring-white\/30{--tw-ring-color: rgb(255 255 255 / .3)}.ring-white\/5{--tw-ring-color: rgb(255 255 255 / .05)}.ring-white\/50{--tw-ring-color: rgb(255 255 255 / .5)}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.running{animation-play-state:running}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:right-0:hover{right:0}.hover\:w-24:hover{width:6rem}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:bg-\[\#2f2f2f\]:hover{--tw-bg-opacity: 1;background-color:rgb(47 47 47 / var(--tw-bg-opacity))}.hover\:bg-\[\#395d8b\]:hover{--tw-bg-opacity: 1;background-color:rgb(57 93 139 / var(--tw-bg-opacity))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:bg-zinc-300\/50:hover{background-color:#d4d4d880}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-muted-foreground:hover{color:hsl(var(--muted-foreground))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity))}.group.destructive .group-\[\.destructive\]\:hover\:border-destructive\/30:hover{border-color:hsl(var(--destructive) / .3)}.group.destructive .group-\[\.destructive\]\:hover\:bg-destructive:hover{background-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:hover\:text-destructive-foreground:hover{color:hsl(var(--destructive-foreground))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity))}.group.destructive .group-\[\.destructive\]\:focus\:ring-destructive:focus{--tw-ring-color: hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-selected\:bg-accent[aria-selected=true]{background-color:hsl(var(--accent))}.aria-selected\:text-accent-foreground[aria-selected=true]{color:hsl(var(--accent-foreground))}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=on\]\:bg-accent[data-state=on],.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[state\=on\]\:text-accent-foreground[data-state=on]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[swipe\=end\]\:animate-out[data-swipe=end]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\[state\=closed\]\:fade-out-80[data-state=closed]{--tw-exit-opacity: .8}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-right-full[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-top-full[data-state=open]{--tw-enter-translate-y: -100%}:is(.dark .dark\:-rotate-90){--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}:is(.dark .dark\:rotate-0){--tw-rotate: 0deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}:is(.dark .dark\:scale-0){--tw-scale-x: 0;--tw-scale-y: 0;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}:is(.dark .dark\:scale-100){--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}:is(.dark .dark\:border-destructive){border-color:hsl(var(--destructive))}@media (min-width: 640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:top-auto{top:auto}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:justify-end{justify-content:flex-end}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:text-left{text-align:left}.data-\[state\=open\]\:sm\:slide-in-from-bottom-full[data-state=open]{--tw-enter-translate-y: 100%}}@media (min-width: 768px){.md\:max-w-\[420px\]{max-width:420px}}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:text-destructive>svg{color:hsl(var(--destructive))}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625} diff --git a/assets/index-fpRoGpQC.js b/assets/index-fpRoGpQC.js deleted file mode 100644 index a07253f..0000000 --- a/assets/index-fpRoGpQC.js +++ /dev/null @@ -1,2660 +0,0 @@ -var HP=Object.defineProperty;var zP=(t,e,r)=>e in t?HP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var ae=(t,e,r)=>(zP(t,typeof e!="symbol"?e+"":e,r),r),jy=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var U=(t,e,r)=>(jy(t,e,"read from private field"),r?r.call(t):e.get(t)),ce=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},Q=(t,e,r,n)=>(jy(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);var So=(t,e,r,n)=>({set _(i){Q(t,e,i,r)},get _(){return U(t,e,n)}}),ye=(t,e,r)=>(jy(t,e,"access private method"),r);function z9(t,e){for(var r=0;rn[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var We=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function el(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function VP(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var V9={exports:{}},Qm={},q9={exports:{}},ut={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Fp=Symbol.for("react.element"),qP=Symbol.for("react.portal"),KP=Symbol.for("react.fragment"),WP=Symbol.for("react.strict_mode"),GP=Symbol.for("react.profiler"),ZP=Symbol.for("react.provider"),JP=Symbol.for("react.context"),XP=Symbol.for("react.forward_ref"),QP=Symbol.for("react.suspense"),YP=Symbol.for("react.memo"),eN=Symbol.for("react.lazy"),b5=Symbol.iterator;function tN(t){return t===null||typeof t!="object"?null:(t=b5&&t[b5]||t["@@iterator"],typeof t=="function"?t:null)}var K9={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},W9=Object.assign,G9={};function Vh(t,e,r){this.props=t,this.context=e,this.refs=G9,this.updater=r||K9}Vh.prototype.isReactComponent={};Vh.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};Vh.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Z9(){}Z9.prototype=Vh.prototype;function k4(t,e,r){this.props=t,this.context=e,this.refs=G9,this.updater=r||K9}var B4=k4.prototype=new Z9;B4.constructor=k4;W9(B4,Vh.prototype);B4.isPureReactComponent=!0;var w5=Array.isArray,J9=Object.prototype.hasOwnProperty,I4={current:null},X9={key:!0,ref:!0,__self:!0,__source:!0};function Q9(t,e,r){var n,i={},s=null,a=null;if(e!=null)for(n in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(s=""+e.key),e)J9.call(e,n)&&!X9.hasOwnProperty(n)&&(i[n]=e[n]);var o=arguments.length-2;if(o===1)i.children=r;else if(1>>1,q=G[L];if(0>>1;Li(oe,R))mei(le,oe)?(G[L]=le,G[me]=R,L=me):(G[L]=oe,G[X]=R,L=X);else if(mei(le,R))G[L]=le,G[me]=R,L=me;else break e}}return z}function i(G,z){var R=G.sortIndex-z.sortIndex;return R!==0?R:G.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var c=[],u=[],l=1,h=null,f=3,p=!1,d=!1,g=!1,y=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(G){for(var z=r(u);z!==null;){if(z.callback===null)n(u);else if(z.startTime<=G)n(u),z.sortIndex=z.expirationTime,e(c,z);else break;z=r(u)}}function k(G){if(g=!1,S(G),!d)if(r(c)!==null)d=!0,j(T);else{var z=r(u);z!==null&&H(k,z.startTime-G)}}function T(G,z){d=!1,g&&(g=!1,x(N),N=-1),p=!0;var R=f;try{for(S(z),h=r(c);h!==null&&(!(h.expirationTime>z)||G&&!O());){var L=h.callback;if(typeof L=="function"){h.callback=null,f=h.priorityLevel;var q=L(h.expirationTime<=z);z=t.unstable_now(),typeof q=="function"?h.callback=q:h===r(c)&&n(c),S(z)}else n(c);h=r(c)}if(h!==null)var ee=!0;else{var X=r(u);X!==null&&H(k,X.startTime-z),ee=!1}return ee}finally{h=null,f=R,p=!1}}var _=!1,B=null,N=-1,P=5,D=-1;function O(){return!(t.unstable_now()-DG||125L?(G.sortIndex=R,e(u,G),r(c)===null&&G===r(u)&&(g?(x(N),N=-1):g=!0,H(k,R-L))):(G.sortIndex=q,e(c,G),d||p||(d=!0,j(T))),G},t.unstable_shouldYield=O,t.unstable_wrapCallback=function(G){var z=f;return function(){var R=f;f=z;try{return G.apply(this,arguments)}finally{f=R}}}})(n7);r7.exports=n7;var hN=r7.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var i7=K,li=hN;function Oe(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qx=Object.prototype.hasOwnProperty,dN=/^[: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]*$/,A5={},S5={};function pN(t){return Qx.call(S5,t)?!0:Qx.call(A5,t)?!1:dN.test(t)?S5[t]=!0:(A5[t]=!0,!1)}function gN(t,e,r,n){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function mN(t,e,r,n){if(e===null||typeof e>"u"||gN(t,e,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function kn(t,e,r,n,i,s,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=a}var Zr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Zr[t]=new kn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Zr[e]=new kn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Zr[t]=new kn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Zr[t]=new kn(t,2,!1,t,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(t){Zr[t]=new kn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Zr[t]=new kn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Zr[t]=new kn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Zr[t]=new kn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Zr[t]=new kn(t,5,!1,t.toLowerCase(),null,!1,!1)});var T4=/[\-:]([a-z])/g;function P4(t){return t[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(t){var e=t.replace(T4,P4);Zr[e]=new kn(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(T4,P4);Zr[e]=new kn(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(T4,P4);Zr[e]=new kn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Zr[t]=new kn(t,1,!1,t.toLowerCase(),null,!1,!1)});Zr.xlinkHref=new kn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Zr[t]=new kn(t,1,!1,t.toLowerCase(),null,!0,!0)});function N4(t,e,r,n){var i=Zr.hasOwnProperty(e)?Zr[e]:null;(i!==null?i.type!==0:n||!(2o||i[a]!==s[o]){var c=` -`+i[a].replace(" at new "," at ");return t.displayName&&c.includes("")&&(c=c.replace("",t.displayName)),c}while(1<=a&&0<=o);break}}}finally{Hy=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?T0(t):""}function vN(t){switch(t.tag){case 5:return T0(t.type);case 16:return T0("Lazy");case 13:return T0("Suspense");case 19:return T0("SuspenseList");case 0:case 2:case 15:return t=zy(t.type,!1),t;case 11:return t=zy(t.type.render,!1),t;case 1:return t=zy(t.type,!0),t;default:return""}}function rb(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Dl:return"Fragment";case Ol:return"Portal";case Yx:return"Profiler";case O4:return"StrictMode";case eb:return"Suspense";case tb:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case o7:return(t.displayName||"Context")+".Consumer";case a7:return(t._context.displayName||"Context")+".Provider";case D4:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case R4:return e=t.displayName||null,e!==null?e:rb(t.type)||"Memo";case jo:e=t._payload,t=t._init;try{return rb(t(e))}catch{}}return null}function yN(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return rb(e);case 8:return e===O4?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Ac(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function u7(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function xN(t){var e=u7(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(a){n=""+a,s.call(this,a)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function r1(t){t._valueTracker||(t._valueTracker=xN(t))}function l7(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=u7(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Fg(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function nb(t,e){var r=e.checked;return tr({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function _5(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=Ac(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function f7(t,e){e=e.checked,e!=null&&N4(t,"checked",e,!1)}function ib(t,e){f7(t,e);var r=Ac(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?sb(t,e.type,r):e.hasOwnProperty("defaultValue")&&sb(t,e.type,Ac(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function k5(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function sb(t,e,r){(e!=="number"||Fg(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var P0=Array.isArray;function nf(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=n1.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function hd(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var K0={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},bN=["Webkit","ms","Moz","O"];Object.keys(K0).forEach(function(t){bN.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),K0[e]=K0[t]})});function g7(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||K0.hasOwnProperty(t)&&K0[t]?(""+e).trim():e+"px"}function m7(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=g7(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,i):t[r]=i}}var wN=tr({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 cb(t,e){if(e){if(wN[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Oe(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Oe(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Oe(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Oe(62))}}function ub(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 lb=null;function M4(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var fb=null,sf=null,af=null;function F5(t){if(t=Np(t)){if(typeof fb!="function")throw Error(Oe(280));var e=t.stateNode;e&&(e=nv(e),fb(t.stateNode,t.type,e))}}function v7(t){sf?af?af.push(t):af=[t]:sf=t}function y7(){if(sf){var t=sf,e=af;if(af=sf=null,F5(t),e)for(t=0;t>>=0,t===0?32:31-(PN(t)/NN|0)|0}var i1=64,s1=4194304;function N0(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Og(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,i=t.suspendedLanes,s=t.pingedLanes,a=r&268435455;if(a!==0){var o=a&~i;o!==0?n=N0(o):(s&=a,s!==0&&(n=N0(s)))}else a=r&~i,a!==0?n=N0(a):s!==0&&(n=N0(s));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0r;r++)e.push(t);return e}function Tp(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-As(e),t[e]=r}function MN(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=G0),j5=" ",U5=!1;function L7(t,e){switch(t){case"keyup":return fO.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function j7(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Rl=!1;function dO(t,e){switch(t){case"compositionend":return j7(e);case"keypress":return e.which!==32?null:(U5=!0,j5);case"textInput":return t=e.data,t===j5&&U5?null:t;default:return null}}function pO(t,e){if(Rl)return t==="compositionend"||!q4&&L7(t,e)?(t=R7(),z1=H4=cc=null,Rl=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=V5(r)}}function z7(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?z7(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function V7(){for(var t=window,e=Fg();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Fg(t.document)}return e}function K4(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function AO(t){var e=V7(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&z7(r.ownerDocument.documentElement,r)){if(n!==null&&K4(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!t.extend&&s>n&&(i=n,n=s,s=i),i=q5(r,s);var a=q5(r,n);i&&a&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>n?(t.addRange(e),t.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,Ml=null,vb=null,J0=null,yb=!1;function K5(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;yb||Ml==null||Ml!==Fg(n)||(n=Ml,"selectionStart"in n&&K4(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}),J0&&yd(J0,n)||(J0=n,n=Mg(vb,"onSelect"),0Ul||(t.current=Sb[Ul],Sb[Ul]=null,Ul--)}function Pt(t,e){Ul++,Sb[Ul]=t.current,t.current=e}var Sc={},ln=Oc(Sc),Mn=Oc(!1),Mu=Sc;function lh(t,e){var r=t.type.contextTypes;if(!r)return Sc;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=e[s];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function Ln(t){return t=t.childContextTypes,t!=null}function jg(){$t(Mn),$t(ln)}function Y5(t,e,r){if(ln.current!==Sc)throw Error(Oe(168));Pt(ln,e),Pt(Mn,r)}function Y7(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in e))throw Error(Oe(108,yN(t)||"Unknown",i));return tr({},r,n)}function Ug(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Sc,Mu=ln.current,Pt(ln,t),Pt(Mn,Mn.current),!0}function eE(t,e,r){var n=t.stateNode;if(!n)throw Error(Oe(169));r?(t=Y7(t,e,Mu),n.__reactInternalMemoizedMergedChildContext=t,$t(Mn),$t(ln),Pt(ln,t)):$t(Mn),Pt(Mn,r)}var Ba=null,iv=!1,n2=!1;function eC(t){Ba===null?Ba=[t]:Ba.push(t)}function DO(t){iv=!0,eC(t)}function Dc(){if(!n2&&Ba!==null){n2=!0;var t=0,e=Ct;try{var r=Ba;for(Ct=1;t>=a,i-=a,Wa=1<<32-As(e)+i|r<N?(P=B,B=null):P=B.sibling;var D=f(x,B,S[N],k);if(D===null){B===null&&(B=P);break}t&&B&&D.alternate===null&&e(x,B),b=s(D,b,N),_===null?T=D:_.sibling=D,_=D,B=P}if(N===S.length)return r(x,B),Vt&&Wc(x,N),T;if(B===null){for(;NN?(P=B,B=null):P=B.sibling;var O=f(x,B,D.value,k);if(O===null){B===null&&(B=P);break}t&&B&&O.alternate===null&&e(x,B),b=s(O,b,N),_===null?T=O:_.sibling=O,_=O,B=P}if(D.done)return r(x,B),Vt&&Wc(x,N),T;if(B===null){for(;!D.done;N++,D=S.next())D=h(x,D.value,k),D!==null&&(b=s(D,b,N),_===null?T=D:_.sibling=D,_=D);return Vt&&Wc(x,N),T}for(B=n(x,B);!D.done;N++,D=S.next())D=p(B,x,N,D.value,k),D!==null&&(t&&D.alternate!==null&&B.delete(D.key===null?N:D.key),b=s(D,b,N),_===null?T=D:_.sibling=D,_=D);return t&&B.forEach(function(E){return e(x,E)}),Vt&&Wc(x,N),T}function y(x,b,S,k){if(typeof S=="object"&&S!==null&&S.type===Dl&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case t1:e:{for(var T=S.key,_=b;_!==null;){if(_.key===T){if(T=S.type,T===Dl){if(_.tag===7){r(x,_.sibling),b=i(_,S.props.children),b.return=x,x=b;break e}}else if(_.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===jo&&oE(T)===_.type){r(x,_.sibling),b=i(_,S.props),b.ref=m0(x,_,S),b.return=x,x=b;break e}r(x,_);break}else e(x,_);_=_.sibling}S.type===Dl?(b=Fu(S.props.children,x.mode,k,S.key),b.return=x,x=b):(k=X1(S.type,S.key,S.props,null,x.mode,k),k.ref=m0(x,b,S),k.return=x,x=k)}return a(x);case Ol:e:{for(_=S.key;b!==null;){if(b.key===_)if(b.tag===4&&b.stateNode.containerInfo===S.containerInfo&&b.stateNode.implementation===S.implementation){r(x,b.sibling),b=i(b,S.children||[]),b.return=x,x=b;break e}else{r(x,b);break}else e(x,b);b=b.sibling}b=f2(S,x.mode,k),b.return=x,x=b}return a(x);case jo:return _=S._init,y(x,b,_(S._payload),k)}if(P0(S))return d(x,b,S,k);if(f0(S))return g(x,b,S,k);h1(x,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,b!==null&&b.tag===6?(r(x,b.sibling),b=i(b,S),b.return=x,x=b):(r(x,b),b=l2(S,x.mode,k),b.return=x,x=b),a(x)):r(x,b)}return y}var hh=cC(!0),uC=cC(!1),Op={},aa=Oc(Op),Ed=Oc(Op),Ad=Oc(Op);function eu(t){if(t===Op)throw Error(Oe(174));return t}function t3(t,e){switch(Pt(Ad,e),Pt(Ed,t),Pt(aa,Op),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:ob(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=ob(e,t)}$t(aa),Pt(aa,e)}function dh(){$t(aa),$t(Ed),$t(Ad)}function lC(t){eu(Ad.current);var e=eu(aa.current),r=ob(e,t.type);e!==r&&(Pt(Ed,t),Pt(aa,r))}function r3(t){Ed.current===t&&($t(aa),$t(Ed))}var Jt=Oc(0);function Kg(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var i2=[];function n3(){for(var t=0;tr?r:4,t(!0);var n=s2.transition;s2.transition={};try{t(!1),e()}finally{Ct=r,s2.transition=n}}function _C(){return $i().memoizedState}function jO(t,e,r){var n=yc(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},kC(t))BC(e,r);else if(r=iC(t,e,r,n),r!==null){var i=An();Ss(r,t,n,i),IC(r,e,n)}}function UO(t,e,r){var n=yc(t),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(kC(t))BC(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var a=e.lastRenderedState,o=s(a,r);if(i.hasEagerState=!0,i.eagerState=o,Cs(o,a)){var c=e.interleaved;c===null?(i.next=i,Y4(e)):(i.next=c.next,c.next=i),e.interleaved=i;return}}catch{}finally{}r=iC(t,e,i,n),r!==null&&(i=An(),Ss(r,t,n,i),IC(r,e,n))}}function kC(t){var e=t.alternate;return t===er||e!==null&&e===er}function BC(t,e){X0=Wg=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function IC(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,j4(t,r)}}var Gg={readContext:Ui,useCallback:Qr,useContext:Qr,useEffect:Qr,useImperativeHandle:Qr,useInsertionEffect:Qr,useLayoutEffect:Qr,useMemo:Qr,useReducer:Qr,useRef:Qr,useState:Qr,useDebugValue:Qr,useDeferredValue:Qr,useTransition:Qr,useMutableSource:Qr,useSyncExternalStore:Qr,useId:Qr,unstable_isNewReconciler:!1},$O={readContext:Ui,useCallback:function(t,e){return Us().memoizedState=[t,e===void 0?null:e],t},useContext:Ui,useEffect:uE,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,W1(4194308,4,wC.bind(null,e,t),r)},useLayoutEffect:function(t,e){return W1(4194308,4,t,e)},useInsertionEffect:function(t,e){return W1(4,2,t,e)},useMemo:function(t,e){var r=Us();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=Us();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=jO.bind(null,er,t),[n.memoizedState,t]},useRef:function(t){var e=Us();return t={current:t},e.memoizedState=t},useState:cE,useDebugValue:c3,useDeferredValue:function(t){return Us().memoizedState=t},useTransition:function(){var t=cE(!1),e=t[0];return t=LO.bind(null,t[1]),Us().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=er,i=Us();if(Vt){if(r===void 0)throw Error(Oe(407));r=r()}else{if(r=e(),Mr===null)throw Error(Oe(349));ju&30||dC(n,e,r)}i.memoizedState=r;var s={value:r,getSnapshot:e};return i.queue=s,uE(gC.bind(null,n,s,t),[t]),n.flags|=2048,_d(9,pC.bind(null,n,s,r,e),void 0,null),r},useId:function(){var t=Us(),e=Mr.identifierPrefix;if(Vt){var r=Ga,n=Wa;r=(n&~(1<<32-As(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Sd++,0<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=a.createElement(r,{is:n.is}):(t=a.createElement(r),r==="select"&&(a=t,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):t=a.createElementNS(t,r),t[Xs]=e,t[wd]=n,LC(t,e,!1,!1),e.stateNode=t;e:{switch(a=ub(r,n),r){case"dialog":Rt("cancel",t),Rt("close",t),i=n;break;case"iframe":case"object":case"embed":Rt("load",t),i=n;break;case"video":case"audio":for(i=0;igh&&(e.flags|=128,n=!0,v0(s,!1),e.lanes=4194304)}else{if(!n)if(t=Kg(a),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),v0(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!Vt)return Yr(e),null}else 2*cr()-s.renderingStartTime>gh&&r!==1073741824&&(e.flags|=128,n=!0,v0(s,!1),e.lanes=4194304);s.isBackwards?(a.sibling=e.child,e.child=a):(r=s.last,r!==null?r.sibling=a:e.child=a,s.last=a)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=cr(),e.sibling=null,r=Jt.current,Pt(Jt,n?r&1|2:r&1),e):(Yr(e),null);case 22:case 23:return p3(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?ei&1073741824&&(Yr(e),e.subtreeFlags&6&&(e.flags|=8192)):Yr(e),null;case 24:return null;case 25:return null}throw Error(Oe(156,e.tag))}function ZO(t,e){switch(G4(e),e.tag){case 1:return Ln(e.type)&&jg(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return dh(),$t(Mn),$t(ln),n3(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return r3(e),null;case 13:if($t(Jt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Oe(340));fh()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return $t(Jt),null;case 4:return dh(),null;case 10:return Q4(e.type._context),null;case 22:case 23:return p3(),null;case 24:return null;default:return null}}var p1=!1,an=!1,JO=typeof WeakSet=="function"?WeakSet:Set,ze=null;function Vl(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){ar(t,e,n)}else r.current=null}function Rb(t,e,r){try{r()}catch(n){ar(t,e,n)}}var yE=!1;function XO(t,e){if(xb=Dg,t=V7(),K4(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var a=0,o=-1,c=-1,u=0,l=0,h=t,f=null;t:for(;;){for(var p;h!==r||i!==0&&h.nodeType!==3||(o=a+i),h!==s||n!==0&&h.nodeType!==3||(c=a+n),h.nodeType===3&&(a+=h.nodeValue.length),(p=h.firstChild)!==null;)f=h,h=p;for(;;){if(h===t)break t;if(f===r&&++u===i&&(o=a),f===s&&++l===n&&(c=a),(p=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=p}r=o===-1||c===-1?null:{start:o,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(bb={focusedElem:t,selectionRange:r},Dg=!1,ze=e;ze!==null;)if(e=ze,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ze=t;else for(;ze!==null;){e=ze;try{var d=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(d!==null){var g=d.memoizedProps,y=d.memoizedState,x=e.stateNode,b=x.getSnapshotBeforeUpdate(e.elementType===e.type?g:is(e.type,g),y);x.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var S=e.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Oe(163))}}catch(k){ar(e,e.return,k)}if(t=e.sibling,t!==null){t.return=e.return,ze=t;break}ze=e.return}return d=yE,yE=!1,d}function Q0(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&Rb(e,r,s)}i=i.next}while(i!==n)}}function ov(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function Mb(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function $C(t){var e=t.alternate;e!==null&&(t.alternate=null,$C(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Xs],delete e[wd],delete e[Ab],delete e[NO],delete e[OO])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function HC(t){return t.tag===5||t.tag===3||t.tag===4}function xE(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||HC(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Lb(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=Lg));else if(n!==4&&(t=t.child,t!==null))for(Lb(t,e,r),t=t.sibling;t!==null;)Lb(t,e,r),t=t.sibling}function jb(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(jb(t,e,r),t=t.sibling;t!==null;)jb(t,e,r),t=t.sibling}var qr=null,ys=!1;function Co(t,e,r){for(r=r.child;r!==null;)zC(t,e,r),r=r.sibling}function zC(t,e,r){if(sa&&typeof sa.onCommitFiberUnmount=="function")try{sa.onCommitFiberUnmount(Ym,r)}catch{}switch(r.tag){case 5:an||Vl(r,e);case 6:var n=qr,i=ys;qr=null,Co(t,e,r),qr=n,ys=i,qr!==null&&(ys?(t=qr,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):qr.removeChild(r.stateNode));break;case 18:qr!==null&&(ys?(t=qr,r=r.stateNode,t.nodeType===8?r2(t.parentNode,r):t.nodeType===1&&r2(t,r),md(t)):r2(qr,r.stateNode));break;case 4:n=qr,i=ys,qr=r.stateNode.containerInfo,ys=!0,Co(t,e,r),qr=n,ys=i;break;case 0:case 11:case 14:case 15:if(!an&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&Rb(r,e,a),i=i.next}while(i!==n)}Co(t,e,r);break;case 1:if(!an&&(Vl(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(o){ar(r,e,o)}Co(t,e,r);break;case 21:Co(t,e,r);break;case 22:r.mode&1?(an=(n=an)||r.memoizedState!==null,Co(t,e,r),an=n):Co(t,e,r);break;default:Co(t,e,r)}}function bE(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new JO),e.forEach(function(n){var i=aD.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Qi(t,e){var r=e.deletions;if(r!==null)for(var n=0;ni&&(i=a),n&=~s}if(n=i,n=cr()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*YO(n/1960))-n,10t?16:t,uc===null)var n=!1;else{if(t=uc,uc=null,Xg=0,gt&6)throw Error(Oe(331));var i=gt;for(gt|=4,ze=t.current;ze!==null;){var s=ze,a=s.child;if(ze.flags&16){var o=s.deletions;if(o!==null){for(var c=0;ccr()-h3?Iu(t,0):f3|=r),jn(t,e)}function XC(t,e){e===0&&(t.mode&1?(e=s1,s1<<=1,!(s1&130023424)&&(s1=4194304)):e=1);var r=An();t=oo(t,e),t!==null&&(Tp(t,e,r),jn(t,r))}function sD(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),XC(t,r)}function aD(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,i=t.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(Oe(314))}n!==null&&n.delete(e),XC(t,r)}var QC;QC=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||Mn.current)On=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return On=!1,WO(t,e,r);On=!!(t.flags&131072)}else On=!1,Vt&&e.flags&1048576&&tC(e,Hg,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;G1(t,e),t=e.pendingProps;var i=lh(e,ln.current);cf(e,r),i=s3(null,e,n,t,i,r);var s=a3();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Ln(n)?(s=!0,Ug(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,e3(e),i.updater=sv,e.stateNode=i,i._reactInternals=e,Ib(e,n,t,r),e=Pb(null,e,n,!0,s,r)):(e.tag=0,Vt&&s&&W4(e),pn(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(G1(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=cD(n),t=is(n,t),i){case 0:e=Tb(null,e,n,t,r);break e;case 1:e=gE(null,e,n,t,r);break e;case 11:e=dE(null,e,n,t,r);break e;case 14:e=pE(null,e,n,is(n.type,t),r);break e}throw Error(Oe(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:is(n,i),Tb(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:is(n,i),gE(t,e,n,i,r);case 3:e:{if(DC(e),t===null)throw Error(Oe(387));n=e.pendingProps,s=e.memoizedState,i=s.element,sC(t,e),qg(e,n,null,r);var a=e.memoizedState;if(n=a.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=ph(Error(Oe(423)),e),e=mE(t,e,n,r,i);break e}else if(n!==i){i=ph(Error(Oe(424)),e),e=mE(t,e,n,r,i);break e}else for(ai=gc(e.stateNode.containerInfo.firstChild),ci=e,Vt=!0,bs=null,r=uC(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(fh(),n===i){e=co(t,e,r);break e}pn(t,e,n,r)}e=e.child}return e;case 5:return lC(e),t===null&&_b(e),n=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,a=i.children,wb(n,i)?a=null:s!==null&&wb(n,s)&&(e.flags|=32),OC(t,e),pn(t,e,a,r),e.child;case 6:return t===null&&_b(e),null;case 13:return RC(t,e,r);case 4:return t3(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=hh(e,null,n,r):pn(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:is(n,i),dE(t,e,n,i,r);case 7:return pn(t,e,e.pendingProps,r),e.child;case 8:return pn(t,e,e.pendingProps.children,r),e.child;case 12:return pn(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,s=e.memoizedProps,a=i.value,Pt(zg,n._currentValue),n._currentValue=a,s!==null)if(Cs(s.value,a)){if(s.children===i.children&&!Mn.current){e=co(t,e,r);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var o=s.dependencies;if(o!==null){a=s.child;for(var c=o.firstContext;c!==null;){if(c.context===n){if(s.tag===1){c=eo(-1,r&-r),c.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var l=u.pending;l===null?c.next=c:(c.next=l.next,l.next=c),u.pending=c}}s.lanes|=r,c=s.alternate,c!==null&&(c.lanes|=r),kb(s.return,r,e),o.lanes|=r;break}c=c.next}}else if(s.tag===10)a=s.type===e.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(Oe(341));a.lanes|=r,o=a.alternate,o!==null&&(o.lanes|=r),kb(a,r,e),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===e){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}pn(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,cf(e,r),i=Ui(i),n=n(i),e.flags|=1,pn(t,e,n,r),e.child;case 14:return n=e.type,i=is(n,e.pendingProps),i=is(n.type,i),pE(t,e,n,i,r);case 15:return PC(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:is(n,i),G1(t,e),e.tag=1,Ln(n)?(t=!0,Ug(e)):t=!1,cf(e,r),oC(e,n,i),Ib(e,n,i,r),Pb(null,e,n,!0,t,r);case 19:return MC(t,e,r);case 22:return NC(t,e,r)}throw Error(Oe(156,e.tag))};function YC(t,e){return C7(t,e)}function oD(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,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 Pi(t,e,r,n){return new oD(t,e,r,n)}function m3(t){return t=t.prototype,!(!t||!t.isReactComponent)}function cD(t){if(typeof t=="function")return m3(t)?1:0;if(t!=null){if(t=t.$$typeof,t===D4)return 11;if(t===R4)return 14}return 2}function xc(t,e){var r=t.alternate;return r===null?(r=Pi(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function X1(t,e,r,n,i,s){var a=2;if(n=t,typeof t=="function")m3(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case Dl:return Fu(r.children,i,s,e);case O4:a=8,i|=8;break;case Yx:return t=Pi(12,r,e,i|2),t.elementType=Yx,t.lanes=s,t;case eb:return t=Pi(13,r,e,i),t.elementType=eb,t.lanes=s,t;case tb:return t=Pi(19,r,e,i),t.elementType=tb,t.lanes=s,t;case c7:return uv(r,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case a7:a=10;break e;case o7:a=9;break e;case D4:a=11;break e;case R4:a=14;break e;case jo:a=16,n=null;break e}throw Error(Oe(130,t==null?t:typeof t,""))}return e=Pi(a,r,e,i),e.elementType=t,e.type=n,e.lanes=s,e}function Fu(t,e,r,n){return t=Pi(7,t,n,e),t.lanes=r,t}function uv(t,e,r,n){return t=Pi(22,t,n,e),t.elementType=c7,t.lanes=r,t.stateNode={isHidden:!1},t}function l2(t,e,r){return t=Pi(6,t,null,e),t.lanes=r,t}function f2(t,e,r){return e=Pi(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function uD(t,e,r,n,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=qy(0),this.expirationTimes=qy(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qy(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function v3(t,e,r,n,i,s,a,o,c){return t=new uD(t,e,r,o,c),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Pi(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},e3(s),t}function lD(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n_)}catch(t){console.error(t)}}n_(),t7.exports=fi;var Wh=t7.exports;const gD=el(Wh);var BE=Wh;Xx.createRoot=BE.createRoot,Xx.hydrateRoot=BE.hydrateRoot;function D0(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var i_={exports:{}};/*! - -JSZip v3.10.1 - A JavaScript class for generating and reading zip files - - -(c) 2009-2016 Stuart Knightley -Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. - -JSZip uses the library pako released under the MIT license : -https://github.com/nodeca/pako/blob/main/LICENSE -*/(function(t,e){(function(r){t.exports=r()})(function(){return function r(n,i,s){function a(u,l){if(!i[u]){if(!n[u]){var h=typeof D0=="function"&&D0;if(!l&&h)return h(u,!0);if(o)return o(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var p=i[u]={exports:{}};n[u][0].call(p.exports,function(d){var g=n[u][1][d];return a(g||d)},p,p.exports,r,n,i,s)}return i[u].exports}for(var o=typeof D0=="function"&&D0,c=0;c>2,p=(3&u)<<4|l>>4,d=1>6:64,g=2>4,l=(15&f)<<4|(p=o.indexOf(c.charAt(g++)))>>2,h=(3&p)<<6|(d=o.indexOf(c.charAt(g++))),b[y++]=u,p!==64&&(b[y++]=l),d!==64&&(b[y++]=h);return b}},{"./support":30,"./utils":32}],2:[function(r,n,i){var s=r("./external"),a=r("./stream/DataWorker"),o=r("./stream/Crc32Probe"),c=r("./stream/DataLengthProbe");function u(l,h,f,p,d){this.compressedSize=l,this.uncompressedSize=h,this.crc32=f,this.compression=p,this.compressedContent=d}u.prototype={getContentWorker:function(){var l=new a(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),h=this;return l.on("end",function(){if(this.streamInfo.data_length!==h.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),l},getCompressedWorker:function(){return new a(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(l,h,f){return l.pipe(new o).pipe(new c("uncompressedSize")).pipe(h.compressWorker(f)).pipe(new c("compressedSize")).withStreamInfo("compression",h)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,n,i){var s=r("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,n,i){var s=r("./utils"),a=function(){for(var o,c=[],u=0;u<256;u++){o=u;for(var l=0;l<8;l++)o=1&o?3988292384^o>>>1:o>>>1;c[u]=o}return c}();n.exports=function(o,c){return o!==void 0&&o.length?s.getTypeOf(o)!=="string"?function(u,l,h,f){var p=a,d=f+h;u^=-1;for(var g=f;g>>8^p[255&(u^l[g])];return-1^u}(0|c,o,o.length,0):function(u,l,h,f){var p=a,d=f+h;u^=-1;for(var g=f;g>>8^p[255&(u^l.charCodeAt(g))];return-1^u}(0|c,o,o.length,0):0}},{"./utils":32}],5:[function(r,n,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(r,n,i){var s=null;s=typeof Promise<"u"?Promise:r("lie"),n.exports={Promise:s}},{lie:37}],7:[function(r,n,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=r("pako"),o=r("./utils"),c=r("./stream/GenericWorker"),u=s?"uint8array":"array";function l(h,f){c.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=f,this.meta={}}i.magic="\b\0",o.inherits(l,c),l.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(u,h.data),!1)},l.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var h=this;this._pako.onData=function(f){h.push({data:f,meta:h.meta})}},i.compressWorker=function(h){return new l("Deflate",h)},i.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,n,i){function s(p,d){var g,y="";for(g=0;g>>=8;return y}function a(p,d,g,y,x,b){var S,k,T=p.file,_=p.compression,B=b!==u.utf8encode,N=o.transformTo("string",b(T.name)),P=o.transformTo("string",u.utf8encode(T.name)),D=T.comment,O=o.transformTo("string",b(D)),E=o.transformTo("string",u.utf8encode(D)),F=P.length!==T.name.length,A=E.length!==D.length,I="",j="",H="",G=T.dir,z=T.date,R={crc32:0,compressedSize:0,uncompressedSize:0};d&&!g||(R.crc32=p.crc32,R.compressedSize=p.compressedSize,R.uncompressedSize=p.uncompressedSize);var L=0;d&&(L|=8),B||!F&&!A||(L|=2048);var q=0,ee=0;G&&(q|=16),x==="UNIX"?(ee=798,q|=function(oe,me){var le=oe;return oe||(le=me?16893:33204),(65535&le)<<16}(T.unixPermissions,G)):(ee=20,q|=function(oe){return 63&(oe||0)}(T.dosPermissions)),S=z.getUTCHours(),S<<=6,S|=z.getUTCMinutes(),S<<=5,S|=z.getUTCSeconds()/2,k=z.getUTCFullYear()-1980,k<<=4,k|=z.getUTCMonth()+1,k<<=5,k|=z.getUTCDate(),F&&(j=s(1,1)+s(l(N),4)+P,I+="up"+s(j.length,2)+j),A&&(H=s(1,1)+s(l(O),4)+E,I+="uc"+s(H.length,2)+H);var X="";return X+=` -\0`,X+=s(L,2),X+=_.magic,X+=s(S,2),X+=s(k,2),X+=s(R.crc32,4),X+=s(R.compressedSize,4),X+=s(R.uncompressedSize,4),X+=s(N.length,2),X+=s(I.length,2),{fileRecord:h.LOCAL_FILE_HEADER+X+N+I,dirRecord:h.CENTRAL_FILE_HEADER+s(ee,2)+X+s(O.length,2)+"\0\0\0\0"+s(q,4)+s(y,4)+N+I+O}}var o=r("../utils"),c=r("../stream/GenericWorker"),u=r("../utf8"),l=r("../crc32"),h=r("../signature");function f(p,d,g,y){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=d,this.zipPlatform=g,this.encodeFileName=y,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(f,c),f.prototype.push=function(p){var d=p.meta.percent||0,g=this.entriesCount,y=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,c.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:g?(d+100*(g-y-1))/g:100}}))},f.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var d=this.streamFiles&&!p.file.dir;if(d){var g=a(p,d,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(p){this.accumulate=!1;var d=this.streamFiles&&!p.file.dir,g=a(p,d,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),d)this.push({data:function(y){return h.DATA_DESCRIPTOR+s(y.crc32,4)+s(y.compressedSize,4)+s(y.uncompressedSize,4)}(p),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var p=this.bytesWritten,d=0;d=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=o,u},readString:function(o){return s.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},n.exports=a},{"../utils":32}],19:[function(r,n,i){var s=r("./Uint8ArrayReader");function a(o){s.call(this,o)}r("../utils").inherits(a,s),a.prototype.readData=function(o){this.checkOffset(o);var c=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,c},n.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,i){var s=r("./DataReader");function a(o){s.call(this,o)}r("../utils").inherits(a,s),a.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},a.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},a.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},a.prototype.readData=function(o){this.checkOffset(o);var c=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,c},n.exports=a},{"../utils":32,"./DataReader":18}],21:[function(r,n,i){var s=r("./ArrayReader");function a(o){s.call(this,o)}r("../utils").inherits(a,s),a.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,c},n.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,i){var s=r("../utils"),a=r("../support"),o=r("./ArrayReader"),c=r("./StringReader"),u=r("./NodeBufferReader"),l=r("./Uint8ArrayReader");n.exports=function(h){var f=s.getTypeOf(h);return s.checkSupport(f),f!=="string"||a.uint8array?f==="nodebuffer"?new u(h):a.uint8array?new l(s.transformTo("uint8array",h)):new o(s.transformTo("array",h)):new c(h)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,n,i){var s=r("./GenericWorker"),a=r("../utils");function o(c){s.call(this,"ConvertWorker to "+c),this.destType=c}a.inherits(o,s),o.prototype.processChunk=function(c){this.push({data:a.transformTo(this.destType,c.data),meta:c.meta})},n.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,i){var s=r("./GenericWorker"),a=r("../crc32");function o(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(o,s),o.prototype.processChunk=function(c){this.streamInfo.crc32=a(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,i){var s=r("../utils"),a=r("./GenericWorker");function o(c){a.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}s.inherits(o,a),o.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}a.prototype.processChunk.call(this,c)},n.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,i){var s=r("../utils"),a=r("./GenericWorker");function o(c){a.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(l){u.dataIsReady=!0,u.data=l,u.max=l&&l.length||0,u.type=s.getTypeOf(l),u.isPaused||u._tickAndRepeat()},function(l){u.error(l)})}s.inherits(o,a),o.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,i){function s(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,o){return this._listeners[a].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,o){if(this._listeners[a])for(var c=0;c "+a:a}},n.exports=s},{}],29:[function(r,n,i){var s=r("../utils"),a=r("./ConvertWorker"),o=r("./GenericWorker"),c=r("../base64"),u=r("../support"),l=r("../external"),h=null;if(u.nodestream)try{h=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(d,g){return new l.Promise(function(y,x){var b=[],S=d._internalType,k=d._outputType,T=d._mimeType;d.on("data",function(_,B){b.push(_),g&&g(B)}).on("error",function(_){b=[],x(_)}).on("end",function(){try{var _=function(B,N,P){switch(B){case"blob":return s.newBlob(s.transformTo("arraybuffer",N),P);case"base64":return c.encode(N);default:return s.transformTo(B,N)}}(k,function(B,N){var P,D=0,O=null,E=0;for(P=0;P"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(s),i.blob=a.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!r("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,i){for(var s=r("./utils"),a=r("./support"),o=r("./nodejsUtils"),c=r("./stream/GenericWorker"),u=new Array(256),l=0;l<256;l++)u[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;u[254]=u[254]=1;function h(){c.call(this,"utf-8 decode"),this.leftOver=null}function f(){c.call(this,"utf-8 encode")}i.utf8encode=function(p){return a.nodebuffer?o.newBufferFrom(p,"utf-8"):function(d){var g,y,x,b,S,k=d.length,T=0;for(b=0;b>>6:(y<65536?g[S++]=224|y>>>12:(g[S++]=240|y>>>18,g[S++]=128|y>>>12&63),g[S++]=128|y>>>6&63),g[S++]=128|63&y);return g}(p)},i.utf8decode=function(p){return a.nodebuffer?s.transformTo("nodebuffer",p).toString("utf-8"):function(d){var g,y,x,b,S=d.length,k=new Array(2*S);for(g=y=0;g>10&1023,k[y++]=56320|1023&x)}return k.length!==y&&(k.subarray?k=k.subarray(0,y):k.length=y),s.applyFromCharCode(k)}(p=s.transformTo(a.uint8array?"uint8array":"array",p))},s.inherits(h,c),h.prototype.processChunk=function(p){var d=s.transformTo(a.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var g=d;(d=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),d.set(g,this.leftOver.length)}else d=this.leftOver.concat(d);this.leftOver=null}var y=function(b,S){var k;for((S=S||b.length)>b.length&&(S=b.length),k=S-1;0<=k&&(192&b[k])==128;)k--;return k<0||k===0?S:k+u[b[k]]>S?k:S}(d),x=d;y!==d.length&&(a.uint8array?(x=d.subarray(0,y),this.leftOver=d.subarray(y,d.length)):(x=d.slice(0,y),this.leftOver=d.slice(y,d.length))),this.push({data:i.utf8decode(x),meta:p.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=h,s.inherits(f,c),f.prototype.processChunk=function(p){this.push({data:i.utf8encode(p.data),meta:p.meta})},i.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,i){var s=r("./support"),a=r("./base64"),o=r("./nodejsUtils"),c=r("./external");function u(g){return g}function l(g,y){for(var x=0;x>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=s(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var d,g,y,x=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4>>6:(p<65536?f[y++]=224|p>>>12:(f[y++]=240|p>>>18,f[y++]=128|p>>>12&63),f[y++]=128|p>>>6&63),f[y++]=128|63&p);return f},i.buf2binstring=function(h){return l(h,h.length)},i.binstring2buf=function(h){for(var f=new s.Buf8(h.length),p=0,d=f.length;p>10&1023,b[d++]=56320|1023&g)}return l(b,d)},i.utf8border=function(h,f){var p;for((f=f||h.length)>h.length&&(f=h.length),p=f-1;0<=p&&(192&h[p])==128;)p--;return p<0||p===0?f:p+c[h[p]]>f?p:f}},{"./common":41}],43:[function(r,n,i){n.exports=function(s,a,o,c){for(var u=65535&s|0,l=s>>>16&65535|0,h=0;o!==0;){for(o-=h=2e3>>1:a>>>1;o[c]=a}return o}();n.exports=function(a,o,c,u){var l=s,h=u+c;a^=-1;for(var f=u;f>>8^l[255&(a^o[f])];return-1^a}},{}],46:[function(r,n,i){var s,a=r("../utils/common"),o=r("./trees"),c=r("./adler32"),u=r("./crc32"),l=r("./messages"),h=0,f=4,p=0,d=-2,g=-1,y=4,x=2,b=8,S=9,k=286,T=30,_=19,B=2*k+1,N=15,P=3,D=258,O=D+P+1,E=42,F=113,A=1,I=2,j=3,H=4;function G(V,ue){return V.msg=l[ue],ue}function z(V){return(V<<1)-(4V.avail_out&&(se=V.avail_out),se!==0&&(a.arraySet(V.output,ue.pending_buf,ue.pending_out,se,V.next_out),V.next_out+=se,ue.pending_out+=se,V.total_out+=se,V.avail_out-=se,ue.pending-=se,ue.pending===0&&(ue.pending_out=0))}function q(V,ue){o._tr_flush_block(V,0<=V.block_start?V.block_start:-1,V.strstart-V.block_start,ue),V.block_start=V.strstart,L(V.strm)}function ee(V,ue){V.pending_buf[V.pending++]=ue}function X(V,ue){V.pending_buf[V.pending++]=ue>>>8&255,V.pending_buf[V.pending++]=255&ue}function oe(V,ue){var se,Y,J=V.max_chain_length,ne=V.strstart,ge=V.prev_length,de=V.nice_match,re=V.strstart>V.w_size-O?V.strstart-(V.w_size-O):0,Ce=V.window,xe=V.w_mask,pe=V.prev,Fe=V.strstart+D,m=Ce[ne+ge-1],v=Ce[ne+ge];V.prev_length>=V.good_match&&(J>>=2),de>V.lookahead&&(de=V.lookahead);do if(Ce[(se=ue)+ge]===v&&Ce[se+ge-1]===m&&Ce[se]===Ce[ne]&&Ce[++se]===Ce[ne+1]){ne+=2,se++;do;while(Ce[++ne]===Ce[++se]&&Ce[++ne]===Ce[++se]&&Ce[++ne]===Ce[++se]&&Ce[++ne]===Ce[++se]&&Ce[++ne]===Ce[++se]&&Ce[++ne]===Ce[++se]&&Ce[++ne]===Ce[++se]&&Ce[++ne]===Ce[++se]&&nere&&--J!=0);return ge<=V.lookahead?ge:V.lookahead}function me(V){var ue,se,Y,J,ne,ge,de,re,Ce,xe,pe=V.w_size;do{if(J=V.window_size-V.lookahead-V.strstart,V.strstart>=pe+(pe-O)){for(a.arraySet(V.window,V.window,pe,pe,0),V.match_start-=pe,V.strstart-=pe,V.block_start-=pe,ue=se=V.hash_size;Y=V.head[--ue],V.head[ue]=pe<=Y?Y-pe:0,--se;);for(ue=se=pe;Y=V.prev[--ue],V.prev[ue]=pe<=Y?Y-pe:0,--se;);J+=pe}if(V.strm.avail_in===0)break;if(ge=V.strm,de=V.window,re=V.strstart+V.lookahead,Ce=J,xe=void 0,xe=ge.avail_in,Ce=P)for(ne=V.strstart-V.insert,V.ins_h=V.window[ne],V.ins_h=(V.ins_h<=P&&(V.ins_h=(V.ins_h<=P)if(Y=o._tr_tally(V,V.strstart-V.match_start,V.match_length-P),V.lookahead-=V.match_length,V.match_length<=V.max_lazy_match&&V.lookahead>=P){for(V.match_length--;V.strstart++,V.ins_h=(V.ins_h<=P&&(V.ins_h=(V.ins_h<=P&&V.match_length<=V.prev_length){for(J=V.strstart+V.lookahead-P,Y=o._tr_tally(V,V.strstart-1-V.prev_match,V.prev_length-P),V.lookahead-=V.prev_length-1,V.prev_length-=2;++V.strstart<=J&&(V.ins_h=(V.ins_h<V.pending_buf_size-5&&(se=V.pending_buf_size-5);;){if(V.lookahead<=1){if(me(V),V.lookahead===0&&ue===h)return A;if(V.lookahead===0)break}V.strstart+=V.lookahead,V.lookahead=0;var Y=V.block_start+se;if((V.strstart===0||V.strstart>=Y)&&(V.lookahead=V.strstart-Y,V.strstart=Y,q(V,!1),V.strm.avail_out===0)||V.strstart-V.block_start>=V.w_size-O&&(q(V,!1),V.strm.avail_out===0))return A}return V.insert=0,ue===f?(q(V,!0),V.strm.avail_out===0?j:H):(V.strstart>V.block_start&&(q(V,!1),V.strm.avail_out),A)}),new ve(4,4,8,4,le),new ve(4,5,16,8,le),new ve(4,6,32,32,le),new ve(4,4,16,16,fe),new ve(8,16,32,32,fe),new ve(8,16,128,128,fe),new ve(8,32,128,256,fe),new ve(32,128,258,1024,fe),new ve(32,258,258,4096,fe)],i.deflateInit=function(V,ue){return Pe(V,ue,b,15,8,0)},i.deflateInit2=Pe,i.deflateReset=Be,i.deflateResetKeep=Me,i.deflateSetHeader=function(V,ue){return V&&V.state?V.state.wrap!==2?d:(V.state.gzhead=ue,p):d},i.deflate=function(V,ue){var se,Y,J,ne;if(!V||!V.state||5>8&255),ee(Y,Y.gzhead.time>>16&255),ee(Y,Y.gzhead.time>>24&255),ee(Y,Y.level===9?2:2<=Y.strategy||Y.level<2?4:0),ee(Y,255&Y.gzhead.os),Y.gzhead.extra&&Y.gzhead.extra.length&&(ee(Y,255&Y.gzhead.extra.length),ee(Y,Y.gzhead.extra.length>>8&255)),Y.gzhead.hcrc&&(V.adler=u(V.adler,Y.pending_buf,Y.pending,0)),Y.gzindex=0,Y.status=69):(ee(Y,0),ee(Y,0),ee(Y,0),ee(Y,0),ee(Y,0),ee(Y,Y.level===9?2:2<=Y.strategy||Y.level<2?4:0),ee(Y,3),Y.status=F);else{var ge=b+(Y.w_bits-8<<4)<<8;ge|=(2<=Y.strategy||Y.level<2?0:Y.level<6?1:Y.level===6?2:3)<<6,Y.strstart!==0&&(ge|=32),ge+=31-ge%31,Y.status=F,X(Y,ge),Y.strstart!==0&&(X(Y,V.adler>>>16),X(Y,65535&V.adler)),V.adler=1}if(Y.status===69)if(Y.gzhead.extra){for(J=Y.pending;Y.gzindex<(65535&Y.gzhead.extra.length)&&(Y.pending!==Y.pending_buf_size||(Y.gzhead.hcrc&&Y.pending>J&&(V.adler=u(V.adler,Y.pending_buf,Y.pending-J,J)),L(V),J=Y.pending,Y.pending!==Y.pending_buf_size));)ee(Y,255&Y.gzhead.extra[Y.gzindex]),Y.gzindex++;Y.gzhead.hcrc&&Y.pending>J&&(V.adler=u(V.adler,Y.pending_buf,Y.pending-J,J)),Y.gzindex===Y.gzhead.extra.length&&(Y.gzindex=0,Y.status=73)}else Y.status=73;if(Y.status===73)if(Y.gzhead.name){J=Y.pending;do{if(Y.pending===Y.pending_buf_size&&(Y.gzhead.hcrc&&Y.pending>J&&(V.adler=u(V.adler,Y.pending_buf,Y.pending-J,J)),L(V),J=Y.pending,Y.pending===Y.pending_buf_size)){ne=1;break}ne=Y.gzindexJ&&(V.adler=u(V.adler,Y.pending_buf,Y.pending-J,J)),ne===0&&(Y.gzindex=0,Y.status=91)}else Y.status=91;if(Y.status===91)if(Y.gzhead.comment){J=Y.pending;do{if(Y.pending===Y.pending_buf_size&&(Y.gzhead.hcrc&&Y.pending>J&&(V.adler=u(V.adler,Y.pending_buf,Y.pending-J,J)),L(V),J=Y.pending,Y.pending===Y.pending_buf_size)){ne=1;break}ne=Y.gzindexJ&&(V.adler=u(V.adler,Y.pending_buf,Y.pending-J,J)),ne===0&&(Y.status=103)}else Y.status=103;if(Y.status===103&&(Y.gzhead.hcrc?(Y.pending+2>Y.pending_buf_size&&L(V),Y.pending+2<=Y.pending_buf_size&&(ee(Y,255&V.adler),ee(Y,V.adler>>8&255),V.adler=0,Y.status=F)):Y.status=F),Y.pending!==0){if(L(V),V.avail_out===0)return Y.last_flush=-1,p}else if(V.avail_in===0&&z(ue)<=z(se)&&ue!==f)return G(V,-5);if(Y.status===666&&V.avail_in!==0)return G(V,-5);if(V.avail_in!==0||Y.lookahead!==0||ue!==h&&Y.status!==666){var de=Y.strategy===2?function(re,Ce){for(var xe;;){if(re.lookahead===0&&(me(re),re.lookahead===0)){if(Ce===h)return A;break}if(re.match_length=0,xe=o._tr_tally(re,0,re.window[re.strstart]),re.lookahead--,re.strstart++,xe&&(q(re,!1),re.strm.avail_out===0))return A}return re.insert=0,Ce===f?(q(re,!0),re.strm.avail_out===0?j:H):re.last_lit&&(q(re,!1),re.strm.avail_out===0)?A:I}(Y,ue):Y.strategy===3?function(re,Ce){for(var xe,pe,Fe,m,v=re.window;;){if(re.lookahead<=D){if(me(re),re.lookahead<=D&&Ce===h)return A;if(re.lookahead===0)break}if(re.match_length=0,re.lookahead>=P&&0re.lookahead&&(re.match_length=re.lookahead)}if(re.match_length>=P?(xe=o._tr_tally(re,1,re.match_length-P),re.lookahead-=re.match_length,re.strstart+=re.match_length,re.match_length=0):(xe=o._tr_tally(re,0,re.window[re.strstart]),re.lookahead--,re.strstart++),xe&&(q(re,!1),re.strm.avail_out===0))return A}return re.insert=0,Ce===f?(q(re,!0),re.strm.avail_out===0?j:H):re.last_lit&&(q(re,!1),re.strm.avail_out===0)?A:I}(Y,ue):s[Y.level].func(Y,ue);if(de!==j&&de!==H||(Y.status=666),de===A||de===j)return V.avail_out===0&&(Y.last_flush=-1),p;if(de===I&&(ue===1?o._tr_align(Y):ue!==5&&(o._tr_stored_block(Y,0,0,!1),ue===3&&(R(Y.head),Y.lookahead===0&&(Y.strstart=0,Y.block_start=0,Y.insert=0))),L(V),V.avail_out===0))return Y.last_flush=-1,p}return ue!==f?p:Y.wrap<=0?1:(Y.wrap===2?(ee(Y,255&V.adler),ee(Y,V.adler>>8&255),ee(Y,V.adler>>16&255),ee(Y,V.adler>>24&255),ee(Y,255&V.total_in),ee(Y,V.total_in>>8&255),ee(Y,V.total_in>>16&255),ee(Y,V.total_in>>24&255)):(X(Y,V.adler>>>16),X(Y,65535&V.adler)),L(V),0=se.w_size&&(ne===0&&(R(se.head),se.strstart=0,se.block_start=0,se.insert=0),Ce=new a.Buf8(se.w_size),a.arraySet(Ce,ue,xe-se.w_size,se.w_size,0),ue=Ce,xe=se.w_size),ge=V.avail_in,de=V.next_in,re=V.input,V.avail_in=xe,V.next_in=0,V.input=ue,me(se);se.lookahead>=P;){for(Y=se.strstart,J=se.lookahead-(P-1);se.ins_h=(se.ins_h<>>=P=N>>>24,S-=P,(P=N>>>16&255)===0)I[l++]=65535&N;else{if(!(16&P)){if(!(64&P)){N=k[(65535&N)+(b&(1<>>=P,S-=P),S<15&&(b+=A[c++]<>>=P=N>>>24,S-=P,!(16&(P=N>>>16&255))){if(!(64&P)){N=T[(65535&N)+(b&(1<>>=P,S-=P,(P=l-h)>3,b&=(1<<(S-=D<<3))-1,s.next_in=c,s.next_out=l,s.avail_in=c>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<24)}function b(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function S(E){var F;return E&&E.state?(F=E.state,E.total_in=E.total_out=F.total=0,E.msg="",F.wrap&&(E.adler=1&F.wrap),F.mode=d,F.last=0,F.havedict=0,F.dmax=32768,F.head=null,F.hold=0,F.bits=0,F.lencode=F.lendyn=new s.Buf32(g),F.distcode=F.distdyn=new s.Buf32(y),F.sane=1,F.back=-1,f):p}function k(E){var F;return E&&E.state?((F=E.state).wsize=0,F.whave=0,F.wnext=0,S(E)):p}function T(E,F){var A,I;return E&&E.state?(I=E.state,F<0?(A=0,F=-F):(A=1+(F>>4),F<48&&(F&=15)),F&&(F<8||15=H.wsize?(s.arraySet(H.window,F,A-H.wsize,H.wsize,0),H.wnext=0,H.whave=H.wsize):(I<(j=H.wsize-H.wnext)&&(j=I),s.arraySet(H.window,F,A-I,j,H.wnext),(I-=j)?(s.arraySet(H.window,F,A-I,I,0),H.wnext=I,H.whave=H.wsize):(H.wnext+=j,H.wnext===H.wsize&&(H.wnext=0),H.whave>>8&255,A.check=o(A.check,ne,2,0),q=L=0,A.mode=2;break}if(A.flags=0,A.head&&(A.head.done=!1),!(1&A.wrap)||(((255&L)<<8)+(L>>8))%31){E.msg="incorrect header check",A.mode=30;break}if((15&L)!=8){E.msg="unknown compression method",A.mode=30;break}if(q-=4,V=8+(15&(L>>>=4)),A.wbits===0)A.wbits=V;else if(V>A.wbits){E.msg="invalid window size",A.mode=30;break}A.dmax=1<>8&1),512&A.flags&&(ne[0]=255&L,ne[1]=L>>>8&255,A.check=o(A.check,ne,2,0)),q=L=0,A.mode=3;case 3:for(;q<32;){if(z===0)break e;z--,L+=I[H++]<>>8&255,ne[2]=L>>>16&255,ne[3]=L>>>24&255,A.check=o(A.check,ne,4,0)),q=L=0,A.mode=4;case 4:for(;q<16;){if(z===0)break e;z--,L+=I[H++]<>8),512&A.flags&&(ne[0]=255&L,ne[1]=L>>>8&255,A.check=o(A.check,ne,2,0)),q=L=0,A.mode=5;case 5:if(1024&A.flags){for(;q<16;){if(z===0)break e;z--,L+=I[H++]<>>8&255,A.check=o(A.check,ne,2,0)),q=L=0}else A.head&&(A.head.extra=null);A.mode=6;case 6:if(1024&A.flags&&(z<(oe=A.length)&&(oe=z),oe&&(A.head&&(V=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Array(A.head.extra_len)),s.arraySet(A.head.extra,I,H,oe,V)),512&A.flags&&(A.check=o(A.check,I,oe,H)),z-=oe,H+=oe,A.length-=oe),A.length))break e;A.length=0,A.mode=7;case 7:if(2048&A.flags){if(z===0)break e;for(oe=0;V=I[H+oe++],A.head&&V&&A.length<65536&&(A.head.name+=String.fromCharCode(V)),V&&oe>9&1,A.head.done=!0),E.adler=A.check=0,A.mode=12;break;case 10:for(;q<32;){if(z===0)break e;z--,L+=I[H++]<>>=7&q,q-=7&q,A.mode=27;break}for(;q<3;){if(z===0)break e;z--,L+=I[H++]<>>=1)){case 0:A.mode=14;break;case 1:if(D(A),A.mode=20,F!==6)break;L>>>=2,q-=2;break e;case 2:A.mode=17;break;case 3:E.msg="invalid block type",A.mode=30}L>>>=2,q-=2;break;case 14:for(L>>>=7&q,q-=7&q;q<32;){if(z===0)break e;z--,L+=I[H++]<>>16^65535)){E.msg="invalid stored block lengths",A.mode=30;break}if(A.length=65535&L,q=L=0,A.mode=15,F===6)break e;case 15:A.mode=16;case 16:if(oe=A.length){if(z>>=5,q-=5,A.ndist=1+(31&L),L>>>=5,q-=5,A.ncode=4+(15&L),L>>>=4,q-=4,286>>=3,q-=3}for(;A.have<19;)A.lens[ge[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,se={bits:A.lenbits},ue=u(0,A.lens,0,19,A.lencode,0,A.work,se),A.lenbits=se.bits,ue){E.msg="invalid code lengths set",A.mode=30;break}A.have=0,A.mode=19;case 19:for(;A.have>>16&255,Ae=65535&J,!((fe=J>>>24)<=q);){if(z===0)break e;z--,L+=I[H++]<>>=fe,q-=fe,A.lens[A.have++]=Ae;else{if(Ae===16){for(Y=fe+2;q>>=fe,q-=fe,A.have===0){E.msg="invalid bit length repeat",A.mode=30;break}V=A.lens[A.have-1],oe=3+(3&L),L>>>=2,q-=2}else if(Ae===17){for(Y=fe+3;q>>=fe)),L>>>=3,q-=3}else{for(Y=fe+7;q>>=fe)),L>>>=7,q-=7}if(A.have+oe>A.nlen+A.ndist){E.msg="invalid bit length repeat",A.mode=30;break}for(;oe--;)A.lens[A.have++]=V}}if(A.mode===30)break;if(A.lens[256]===0){E.msg="invalid code -- missing end-of-block",A.mode=30;break}if(A.lenbits=9,se={bits:A.lenbits},ue=u(l,A.lens,0,A.nlen,A.lencode,0,A.work,se),A.lenbits=se.bits,ue){E.msg="invalid literal/lengths set",A.mode=30;break}if(A.distbits=6,A.distcode=A.distdyn,se={bits:A.distbits},ue=u(h,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,se),A.distbits=se.bits,ue){E.msg="invalid distances set",A.mode=30;break}if(A.mode=20,F===6)break e;case 20:A.mode=21;case 21:if(6<=z&&258<=R){E.next_out=G,E.avail_out=R,E.next_in=H,E.avail_in=z,A.hold=L,A.bits=q,c(E,X),G=E.next_out,j=E.output,R=E.avail_out,H=E.next_in,I=E.input,z=E.avail_in,L=A.hold,q=A.bits,A.mode===12&&(A.back=-1);break}for(A.back=0;ve=(J=A.lencode[L&(1<>>16&255,Ae=65535&J,!((fe=J>>>24)<=q);){if(z===0)break e;z--,L+=I[H++]<>Me)])>>>16&255,Ae=65535&J,!(Me+(fe=J>>>24)<=q);){if(z===0)break e;z--,L+=I[H++]<>>=Me,q-=Me,A.back+=Me}if(L>>>=fe,q-=fe,A.back+=fe,A.length=Ae,ve===0){A.mode=26;break}if(32&ve){A.back=-1,A.mode=12;break}if(64&ve){E.msg="invalid literal/length code",A.mode=30;break}A.extra=15&ve,A.mode=22;case 22:if(A.extra){for(Y=A.extra;q>>=A.extra,q-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=23;case 23:for(;ve=(J=A.distcode[L&(1<>>16&255,Ae=65535&J,!((fe=J>>>24)<=q);){if(z===0)break e;z--,L+=I[H++]<>Me)])>>>16&255,Ae=65535&J,!(Me+(fe=J>>>24)<=q);){if(z===0)break e;z--,L+=I[H++]<>>=Me,q-=Me,A.back+=Me}if(L>>>=fe,q-=fe,A.back+=fe,64&ve){E.msg="invalid distance code",A.mode=30;break}A.offset=Ae,A.extra=15&ve,A.mode=24;case 24:if(A.extra){for(Y=A.extra;q>>=A.extra,q-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){E.msg="invalid distance too far back",A.mode=30;break}A.mode=25;case 25:if(R===0)break e;if(oe=X-R,A.offset>oe){if((oe=A.offset-oe)>A.whave&&A.sane){E.msg="invalid distance too far back",A.mode=30;break}me=oe>A.wnext?(oe-=A.wnext,A.wsize-oe):A.wnext-oe,oe>A.length&&(oe=A.length),le=A.window}else le=j,me=G-A.offset,oe=A.length;for(RB?(P=me[le+y[F]],q[ee+y[F]]):(P=96,0),b=1<>G)+(S-=b)]=N<<24|P<<16|D|0,S!==0;);for(b=1<>=1;if(b!==0?(L&=b-1,L+=b):L=0,F++,--X[E]==0){if(E===I)break;E=h[f+y[F]]}if(j>>7)]}function ee(J,ne){J.pending_buf[J.pending++]=255&ne,J.pending_buf[J.pending++]=ne>>>8&255}function X(J,ne,ge){J.bi_valid>x-ge?(J.bi_buf|=ne<>x-J.bi_valid,J.bi_valid+=ge-x):(J.bi_buf|=ne<>>=1,ge<<=1,0<--ne;);return ge>>>1}function le(J,ne,ge){var de,re,Ce=new Array(y+1),xe=0;for(de=1;de<=y;de++)Ce[de]=xe=xe+ge[de-1]<<1;for(re=0;re<=ne;re++){var pe=J[2*re+1];pe!==0&&(J[2*re]=me(Ce[pe]++,pe))}}function fe(J){var ne;for(ne=0;ne>1;1<=ge;ge--)Me(J,Ce,ge);for(re=Fe;ge=J.heap[1],J.heap[1]=J.heap[J.heap_len--],Me(J,Ce,1),de=J.heap[1],J.heap[--J.heap_max]=ge,J.heap[--J.heap_max]=de,Ce[2*re]=Ce[2*ge]+Ce[2*de],J.depth[re]=(J.depth[ge]>=J.depth[de]?J.depth[ge]:J.depth[de])+1,Ce[2*ge+1]=Ce[2*de+1]=re,J.heap[1]=re++,Me(J,Ce,1),2<=J.heap_len;);J.heap[--J.heap_max]=J.heap[1],function(v,w){var M,$,W,Z,Ee,Ue,ke=w.dyn_tree,Ie=w.max_code,Le=w.stat_desc.static_tree,Ht=w.stat_desc.has_stree,Ot=w.stat_desc.extra_bits,qc=w.stat_desc.extra_base,At=w.stat_desc.max_length,Bt=0;for(Z=0;Z<=y;Z++)v.bl_count[Z]=0;for(ke[2*v.heap[v.heap_max]+1]=0,M=v.heap_max+1;M>=7;re>>=1)if(1&m&&pe.dyn_ltree[2*Fe]!==0)return a;if(pe.dyn_ltree[18]!==0||pe.dyn_ltree[20]!==0||pe.dyn_ltree[26]!==0)return o;for(Fe=32;Fe>>3,(Ce=J.static_len+3+7>>>3)<=re&&(re=Ce)):re=Ce=ge+5,ge+4<=re&&ne!==-1?Y(J,ne,ge,de):J.strategy===4||Ce===re?(X(J,2+(de?1:0),3),Be(J,O,E)):(X(J,4+(de?1:0),3),function(pe,Fe,m,v){var w;for(X(pe,Fe-257,5),X(pe,m-1,5),X(pe,v-4,4),w=0;w>>8&255,J.pending_buf[J.d_buf+2*J.last_lit+1]=255&ne,J.pending_buf[J.l_buf+J.last_lit]=255&ge,J.last_lit++,ne===0?J.dyn_ltree[2*ge]++:(J.matches++,ne--,J.dyn_ltree[2*(A[ge]+h+1)]++,J.dyn_dtree[2*q(ne)]++),J.last_lit===J.lit_bufsize-1},i._tr_align=function(J){X(J,2,3),oe(J,S,O),function(ne){ne.bi_valid===16?(ee(ne,ne.bi_buf),ne.bi_buf=0,ne.bi_valid=0):8<=ne.bi_valid&&(ne.pending_buf[ne.pending++]=255&ne.bi_buf,ne.bi_buf>>=8,ne.bi_valid-=8)}(J)}},{"../utils/common":41}],53:[function(r,n,i){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(r,n,i){(function(s){(function(a,o){if(!a.setImmediate){var c,u,l,h,f=1,p={},d=!1,g=a.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(a);y=y&&y.setTimeout?y:a,c={}.toString.call(a.process)==="[object process]"?function(k){process.nextTick(function(){b(k)})}:function(){if(a.postMessage&&!a.importScripts){var k=!0,T=a.onmessage;return a.onmessage=function(){k=!1},a.postMessage("","*"),a.onmessage=T,k}}()?(h="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",S,!1):a.attachEvent("onmessage",S),function(k){a.postMessage(h+k,"*")}):a.MessageChannel?((l=new MessageChannel).port1.onmessage=function(k){b(k.data)},function(k){l.port2.postMessage(k)}):g&&"onreadystatechange"in g.createElement("script")?(u=g.documentElement,function(k){var T=g.createElement("script");T.onreadystatechange=function(){b(k),T.onreadystatechange=null,u.removeChild(T),T=null},u.appendChild(T)}):function(k){setTimeout(b,0,k)},y.setImmediate=function(k){typeof k!="function"&&(k=new Function(""+k));for(var T=new Array(arguments.length-1),_=0;_"u"?s===void 0?this:s:self)}).call(this,typeof We<"u"?We:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(i_);var mD=i_.exports;const vD=el(mD);var s_={exports:{}};(function(t,e){(function(r,n){n()})(We,function(){function r(u,l){return typeof l>"u"?l={autoBom:!1}:typeof l!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),l={autoBom:!l}),l.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(u.type)?new Blob(["\uFEFF",u],{type:u.type}):u}function n(u,l,h){var f=new XMLHttpRequest;f.open("GET",u),f.responseType="blob",f.onload=function(){c(f.response,l,h)},f.onerror=function(){console.error("could not download file")},f.send()}function i(u){var l=new XMLHttpRequest;l.open("HEAD",u,!1);try{l.send()}catch{}return 200<=l.status&&299>=l.status}function s(u){try{u.dispatchEvent(new MouseEvent("click"))}catch{var l=document.createEvent("MouseEvents");l.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),u.dispatchEvent(l)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof We=="object"&&We.global===We?We:void 0,o=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),c=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!o?function(u,l,h){var f=a.URL||a.webkitURL,p=document.createElement("a");l=l||u.name||"download",p.download=l,p.rel="noopener",typeof u=="string"?(p.href=u,p.origin===location.origin?s(p):i(p.href)?n(u,l,h):s(p,p.target="_blank")):(p.href=f.createObjectURL(u),setTimeout(function(){f.revokeObjectURL(p.href)},4e4),setTimeout(function(){s(p)},0))}:"msSaveOrOpenBlob"in navigator?function(u,l,h){if(l=l||u.name||"download",typeof u!="string")navigator.msSaveOrOpenBlob(r(u,h),l);else if(i(u))n(u,l,h);else{var f=document.createElement("a");f.href=u,f.target="_blank",setTimeout(function(){s(f)})}}:function(u,l,h,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof u=="string")return n(u,l,h);var p=u.type==="application/octet-stream",d=/constructor/i.test(a.HTMLElement)||a.safari,g=/CriOS\/[\d]+/.test(navigator.userAgent);if((g||p&&d||o)&&typeof FileReader<"u"){var y=new FileReader;y.onloadend=function(){var S=y.result;S=g?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=S:location=S,f=null},y.readAsDataURL(u)}else{var x=a.URL||a.webkitURL,b=x.createObjectURL(u);f?f.location=b:location.href=b,f=null,setTimeout(function(){x.revokeObjectURL(b)},4e4)}});a.saveAs=c.saveAs=c,t.exports=c})})(s_);var yD=s_.exports;const xD=el(yD),bD=` - - -// Welcome to BetterIDE Studio -// Feel free to edit the following smartweave contract code and add your own functions - -function createVoteContract(state,action) -{ - state={...state,votes:{A:0,B:0}} - state.campaignName=action.input.campaign; - state.votes.A=0; - state.votes.B=0; - return {state} -} - -function vote(state, action){ - if(!action.for) throw new ContractError("Need to input 'for'"); - -} - -function voteA(state) -{ - state.votes.A+=1; - return { state } -} - -function voteB(state) -{ - state.votes.B+=1; - return { state } -} - -function result(state) -{ - if(state.votes.A>state.votes.B) - { - state.result="A won" - } - else if(state.votes.B>state.votes.A) - { - state.result="B won" - } - else - { - state.result="Draw"; - } - return {state}; -} - -export function handle(state, action) { - const input = action.input - switch (input.function) { - case "createVoteContract": - return createVoteContract(state, action); - // no need for break statement because we are using return - case "voteA": - return voteA(state,action); - case "voteB": - return voteB(state,action); - case "result": - return result(state); - default: - throw new ContractError(\`Function not recognised: "\${input.function}"\`) - } -} - -`,wD=` -{ - "campaignName": "", - "votes":{ - "A":0, - "B":0 - }, - "result":"" -} - -`,ED=` -// src/read/balance.js -async function balance(state, action) { - const addr = action?.input?.target || action.caller; - return { - result: { - target: addr, - ticker: state.ticker, - balance: state.balances[addr] || 0 - } - }; -} -// src/hyper-either.js -var Right = (x) => ({ - isLeft: false, - chain: (f) => f(x), - ap: (other) => other.map(x), - alt: (other) => Right(x), - extend: (f) => f(Right(x)), - concat: (other) => other.fold( - (x2) => other, - (y) => Right(x.concat(y)) - ), - traverse: (of2, f) => f(x).map(Right), - map: (f) => Right(f(x)), - fold: (_, g) => g(x), - toString: () => \`Right(\${ x })\`, - extract: () => x -}); -var Left = (x) => ({ - isLeft: true, - chain: (_) => Left(x), - ap: (_) => Left(x), - extend: (_) => Left(x), - alt: (other) => other, - concat: (_) => Left(x), - traverse: (of2, _) => of2(Left(x)), - map: (_) => Left(x), - fold: (f, _) => f(x), - toString: () => \`Left(\${ x })\`, - extract: () => x -}); -var of = Right; -var fromNullable = (x) => x != null ? Right(x) : Left(x); -// node_modules/bignumber.js/bignumber.mjs -var isNumeric = /^-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?$/i; -var mathceil = Math.ceil; -var mathfloor = Math.floor; -var bignumberError = "[BigNumber Error] "; -var tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: "; -var BASE = 1e14; -var LOG_BASE = 14; -var MAX_SAFE_INTEGER = 9007199254740991; -var POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13]; -var SQRT_BASE = 1e7; -var MAX = 1e9; -function clone(configObject) { - var div, convertBase, parseNumeric, P = BigNumber2.prototype = { constructor: BigNumber2, toString: null, valueOf: null }, ONE = new BigNumber2(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP = -1e7, MAX_EXP = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = { - prefix: "", - groupSize: 3, - secondaryGroupSize: 0, - groupSeparator: ",", - decimalSeparator: ".", - fractionGroupSize: 0, - fractionGroupSeparator: " ", - // non-breaking space - suffix: "" - }, ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz", alphabetHasNormalDecimalDigits = true; - function BigNumber2(v, b) { - var alphabet, c, caseChanged, e, i, isNum, len, str, x = this; - if (!(x instanceof BigNumber2)) - return new BigNumber2(v, b); - if (b == null) { - if (v && v._isBigNumber === true) { - x.s = v.s; - if (!v.c || v.e > MAX_EXP) { - x.c = x.e = null; - } else if (v.e < MIN_EXP) { - x.c = [x.e = 0]; - } else { - x.e = v.e; - x.c = v.c.slice(); - } - return; - } - if ((isNum = typeof v == "number") && v * 0 == 0) { - x.s = 1 / v < 0 ? (v = -v, -1) : 1; - if (v === ~~v) { - for (e = 0, i = v; i >= 10; i /= 10, e++) - ; - if (e > MAX_EXP) { - x.c = x.e = null; - } else { - x.e = e; - x.c = [v]; - } - return; - } - str = String(v); - } else { - if (!isNumeric.test(str = String(v))) - return parseNumeric(x, str, isNum); - x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1; - } - if ((e = str.indexOf(".")) > -1) - str = str.replace(".", ""); - if ((i = str.search(/e/i)) > 0) { - if (e < 0) - e = i; - e += +str.slice(i + 1); - str = str.substring(0, i); - } else if (e < 0) { - e = str.length; - } - } else { - intCheck(b, 2, ALPHABET.length, "Base"); - if (b == 10 && alphabetHasNormalDecimalDigits) { - x = new BigNumber2(v); - return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE); - } - str = String(v); - if (isNum = typeof v == "number") { - if (v * 0 != 0) - return parseNumeric(x, str, isNum, b); - x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1; - if (BigNumber2.DEBUG && str.replace(/^0\\.0*|\\./, "").length > 15) { - throw Error(tooManyDigits + v); - } - } else { - x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1; - } - alphabet = ALPHABET.slice(0, b); - e = i = 0; - for (len = str.length; i < len; i++) { - if (alphabet.indexOf(c = str.charAt(i)) < 0) { - if (c == ".") { - if (i > e) { - e = len; - continue; - } - } else if (!caseChanged) { - if (str == str.toUpperCase() && (str = str.toLowerCase()) || str == str.toLowerCase() && (str = str.toUpperCase())) { - caseChanged = true; - i = -1; - e = 0; - continue; - } - } - return parseNumeric(x, String(v), isNum, b); - } - } - isNum = false; - str = convertBase(str, b, 10, x.s); - if ((e = str.indexOf(".")) > -1) - str = str.replace(".", ""); - else - e = str.length; - } - for (i = 0; str.charCodeAt(i) === 48; i++) - ; - for (len = str.length; str.charCodeAt(--len) === 48; ) - ; - if (str = str.slice(i, ++len)) { - len -= i; - if (isNum && BigNumber2.DEBUG && len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) { - throw Error(tooManyDigits + x.s * v); - } - if ((e = e - i - 1) > MAX_EXP) { - x.c = x.e = null; - } else if (e < MIN_EXP) { - x.c = [x.e = 0]; - } else { - x.e = e; - x.c = []; - i = (e + 1) % LOG_BASE; - if (e < 0) - i += LOG_BASE; - if (i < len) { - if (i) - x.c.push(+str.slice(0, i)); - for (len -= LOG_BASE; i < len; ) { - x.c.push(+str.slice(i, i += LOG_BASE)); - } - i = LOG_BASE - (str = str.slice(i)).length; - } else { - i -= len; - } - for (; i--; str += "0") - ; - x.c.push(+str); - } - } else { - x.c = [x.e = 0]; - } - } - BigNumber2.clone = clone; - BigNumber2.ROUND_UP = 0; - BigNumber2.ROUND_DOWN = 1; - BigNumber2.ROUND_CEIL = 2; - BigNumber2.ROUND_FLOOR = 3; - BigNumber2.ROUND_HALF_UP = 4; - BigNumber2.ROUND_HALF_DOWN = 5; - BigNumber2.ROUND_HALF_EVEN = 6; - BigNumber2.ROUND_HALF_CEIL = 7; - BigNumber2.ROUND_HALF_FLOOR = 8; - BigNumber2.EUCLID = 9; - BigNumber2.config = BigNumber2.set = function(obj) { - var p, v; - if (obj != null) { - if (typeof obj == "object") { - if (obj.hasOwnProperty(p = "DECIMAL_PLACES")) { - v = obj[p]; - intCheck(v, 0, MAX, p); - DECIMAL_PLACES = v; - } - if (obj.hasOwnProperty(p = "ROUNDING_MODE")) { - v = obj[p]; - intCheck(v, 0, 8, p); - ROUNDING_MODE = v; - } - if (obj.hasOwnProperty(p = "EXPONENTIAL_AT")) { - v = obj[p]; - if (v && v.pop) { - intCheck(v[0], -MAX, 0, p); - intCheck(v[1], 0, MAX, p); - TO_EXP_NEG = v[0]; - TO_EXP_POS = v[1]; - } else { - intCheck(v, -MAX, MAX, p); - TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v); - } - } - if (obj.hasOwnProperty(p = "RANGE")) { - v = obj[p]; - if (v && v.pop) { - intCheck(v[0], -MAX, -1, p); - intCheck(v[1], 1, MAX, p); - MIN_EXP = v[0]; - MAX_EXP = v[1]; - } else { - intCheck(v, -MAX, MAX, p); - if (v) { - MIN_EXP = -(MAX_EXP = v < 0 ? -v : v); - } else { - throw Error(bignumberError + p + " cannot be zero: " + v); - } - } - } - if (obj.hasOwnProperty(p = "CRYPTO")) { - v = obj[p]; - if (v === !!v) { - if (v) { - if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) { - CRYPTO = v; - } else { - CRYPTO = !v; - throw Error(bignumberError + "crypto unavailable"); - } - } else { - CRYPTO = v; - } - } else { - throw Error(bignumberError + p + " not true or false: " + v); - } - } - if (obj.hasOwnProperty(p = "MODULO_MODE")) { - v = obj[p]; - intCheck(v, 0, 9, p); - MODULO_MODE = v; - } - if (obj.hasOwnProperty(p = "POW_PRECISION")) { - v = obj[p]; - intCheck(v, 0, MAX, p); - POW_PRECISION = v; - } - if (obj.hasOwnProperty(p = "FORMAT")) { - v = obj[p]; - if (typeof v == "object") - FORMAT = v; - else - throw Error(bignumberError + p + " not an object: " + v); - } - if (obj.hasOwnProperty(p = "ALPHABET")) { - v = obj[p]; - if (typeof v == "string" && !/^.?$|[+\\-.\\s]|(.).*\\1/.test(v)) { - alphabetHasNormalDecimalDigits = v.slice(0, 10) == "0123456789"; - ALPHABET = v; - } else { - throw Error(bignumberError + p + " invalid: " + v); - } - } - } else { - throw Error(bignumberError + "Object expected: " + obj); - } - } - return { - DECIMAL_PLACES, - ROUNDING_MODE, - EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS], - RANGE: [MIN_EXP, MAX_EXP], - CRYPTO, - MODULO_MODE, - POW_PRECISION, - FORMAT, - ALPHABET - }; - }; - BigNumber2.isBigNumber = function(v) { - if (!v || v._isBigNumber !== true) - return false; - if (!BigNumber2.DEBUG) - return true; - var i, n, c = v.c, e = v.e, s = v.s; - out: - if ({}.toString.call(c) == "[object Array]") { - if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) { - if (c[0] === 0) { - if (e === 0 && c.length === 1) - return true; - break out; - } - i = (e + 1) % LOG_BASE; - if (i < 1) - i += LOG_BASE; - if (String(c[0]).length == i) { - for (i = 0; i < c.length; i++) { - n = c[i]; - if (n < 0 || n >= BASE || n !== mathfloor(n)) - break out; - } - if (n !== 0) - return true; - } - } - } else if (c === null && e === null && (s === null || s === 1 || s === -1)) { - return true; - } - throw Error(bignumberError + "Invalid BigNumber: " + v); - }; - BigNumber2.maximum = BigNumber2.max = function() { - return maxOrMin(arguments, P.lt); - }; - BigNumber2.minimum = BigNumber2.min = function() { - return maxOrMin(arguments, P.gt); - }; - BigNumber2.random = function() { - var pow2_53 = 9007199254740992; - var random53bitInt = Math.random() * pow2_53 & 2097151 ? function() { - return mathfloor(Math.random() * pow2_53); - } : function() { - return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0); - }; - return function(dp) { - var a, b, e, k, v, i = 0, c = [], rand = new BigNumber2(ONE); - if (dp == null) - dp = DECIMAL_PLACES; - else - intCheck(dp, 0, MAX); - k = mathceil(dp / LOG_BASE); - if (CRYPTO) { - if (crypto.getRandomValues) { - a = crypto.getRandomValues(new Uint32Array(k *= 2)); - for (; i < k; ) { - v = a[i] * 131072 + (a[i + 1] >>> 11); - if (v >= 9e15) { - b = crypto.getRandomValues(new Uint32Array(2)); - a[i] = b[0]; - a[i + 1] = b[1]; - } else { - c.push(v % 1e14); - i += 2; - } - } - i = k / 2; - } else if (crypto.randomBytes) { - a = crypto.randomBytes(k *= 7); - for (; i < k; ) { - v = (a[i] & 31) * 281474976710656 + a[i + 1] * 1099511627776 + a[i + 2] * 4294967296 + a[i + 3] * 16777216 + (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6]; - if (v >= 9e15) { - crypto.randomBytes(7).copy(a, i); - } else { - c.push(v % 1e14); - i += 7; - } - } - i = k / 7; - } else { - CRYPTO = false; - throw Error(bignumberError + "crypto unavailable"); - } - } - if (!CRYPTO) { - for (; i < k; ) { - v = random53bitInt(); - if (v < 9e15) - c[i++] = v % 1e14; - } - } - k = c[--i]; - dp %= LOG_BASE; - if (k && dp) { - v = POWS_TEN[LOG_BASE - dp]; - c[i] = mathfloor(k / v) * v; - } - for (; c[i] === 0; c.pop(), i--) - ; - if (i < 0) { - c = [e = 0]; - } else { - for (e = -1; c[0] === 0; c.splice(0, 1), e -= LOG_BASE) - ; - for (i = 1, v = c[0]; v >= 10; v /= 10, i++) - ; - if (i < LOG_BASE) - e -= LOG_BASE - i; - } - rand.e = e; - rand.c = c; - return rand; - }; - }(); - BigNumber2.sum = function() { - var i = 1, args = arguments, sum = new BigNumber2(args[0]); - for (; i < args.length; ) - sum = sum.plus(args[i++]); - return sum; - }; - convertBase = function() { - var decimal = "0123456789"; - function toBaseOut(str, baseIn, baseOut, alphabet) { - var j, arr = [0], arrL, i = 0, len = str.length; - for (; i < len; ) { - for (arrL = arr.length; arrL--; arr[arrL] *= baseIn) - ; - arr[0] += alphabet.indexOf(str.charAt(i++)); - for (j = 0; j < arr.length; j++) { - if (arr[j] > baseOut - 1) { - if (arr[j + 1] == null) - arr[j + 1] = 0; - arr[j + 1] += arr[j] / baseOut | 0; - arr[j] %= baseOut; - } - } - } - return arr.reverse(); - } - return function(str, baseIn, baseOut, sign, callerIsToString) { - var alphabet, d, e, k, r, x, xc, y, i = str.indexOf("."), dp = DECIMAL_PLACES, rm = ROUNDING_MODE; - if (i >= 0) { - k = POW_PRECISION; - POW_PRECISION = 0; - str = str.replace(".", ""); - y = new BigNumber2(baseIn); - x = y.pow(str.length - i); - POW_PRECISION = k; - y.c = toBaseOut( - toFixedPoint(coeffToString(x.c), x.e, "0"), - 10, - baseOut, - decimal - ); - y.e = y.c.length; - } - xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet = ALPHABET, decimal) : (alphabet = decimal, ALPHABET)); - e = k = xc.length; - for (; xc[--k] == 0; xc.pop()) - ; - if (!xc[0]) - return alphabet.charAt(0); - if (i < 0) { - --e; - } else { - x.c = xc; - x.e = e; - x.s = sign; - x = div(x, y, dp, rm, baseOut); - xc = x.c; - r = x.r; - e = x.e; - } - d = e + dp + 1; - i = xc[d]; - k = baseOut / 2; - r = r || d < 0 || xc[d + 1] != null; - r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7)); - if (d < 1 || !xc[0]) { - str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0); - } else { - xc.length = d; - if (r) { - for (--baseOut; ++xc[--d] > baseOut; ) { - xc[d] = 0; - if (!d) { - ++e; - xc = [1].concat(xc); - } - } - } - for (k = xc.length; !xc[--k]; ) - ; - for (i = 0, str = ""; i <= k; str += alphabet.charAt(xc[i++])) - ; - str = toFixedPoint(str, e, alphabet.charAt(0)); - } - return str; - }; - }(); - div = function() { - function multiply(x, k, base) { - var m, temp, xlo, xhi, carry = 0, i = x.length, klo = k % SQRT_BASE, khi = k / SQRT_BASE | 0; - for (x = x.slice(); i--; ) { - xlo = x[i] % SQRT_BASE; - xhi = x[i] / SQRT_BASE | 0; - m = khi * xlo + xhi * klo; - temp = klo * xlo + m % SQRT_BASE * SQRT_BASE + carry; - carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi; - x[i] = temp % base; - } - if (carry) - x = [carry].concat(x); - return x; - } - function compare2(a, b, aL, bL) { - var i, cmp; - if (aL != bL) { - cmp = aL > bL ? 1 : -1; - } else { - for (i = cmp = 0; i < aL; i++) { - if (a[i] != b[i]) { - cmp = a[i] > b[i] ? 1 : -1; - break; - } - } - } - return cmp; - } - function subtract(a, b, aL, base) { - var i = 0; - for (; aL--; ) { - a[aL] -= i; - i = a[aL] < b[aL] ? 1 : 0; - a[aL] = i * base + a[aL] - b[aL]; - } - for (; !a[0] && a.length > 1; a.splice(0, 1)) - ; - } - return function(x, y, dp, rm, base) { - var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0, yL, yz, s = x.s == y.s ? 1 : -1, xc = x.c, yc = y.c; - if (!xc || !xc[0] || !yc || !yc[0]) { - return new BigNumber2( - // Return NaN if either NaN, or both Infinity or 0. - !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : ( - // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0. - xc && xc[0] == 0 || !yc ? s * 0 : s / 0 - ) - ); - } - q = new BigNumber2(s); - qc = q.c = []; - e = x.e - y.e; - s = dp + e + 1; - if (!base) { - base = BASE; - e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE); - s = s / LOG_BASE | 0; - } - for (i = 0; yc[i] == (xc[i] || 0); i++) - ; - if (yc[i] > (xc[i] || 0)) - e--; - if (s < 0) { - qc.push(1); - more = true; - } else { - xL = xc.length; - yL = yc.length; - i = 0; - s += 2; - n = mathfloor(base / (yc[0] + 1)); - if (n > 1) { - yc = multiply(yc, n, base); - xc = multiply(xc, n, base); - yL = yc.length; - xL = xc.length; - } - xi = yL; - rem = xc.slice(0, yL); - remL = rem.length; - for (; remL < yL; rem[remL++] = 0) - ; - yz = yc.slice(); - yz = [0].concat(yz); - yc0 = yc[0]; - if (yc[1] >= base / 2) - yc0++; - do { - n = 0; - cmp = compare2(yc, rem, yL, remL); - if (cmp < 0) { - rem0 = rem[0]; - if (yL != remL) - rem0 = rem0 * base + (rem[1] || 0); - n = mathfloor(rem0 / yc0); - if (n > 1) { - if (n >= base) - n = base - 1; - prod = multiply(yc, n, base); - prodL = prod.length; - remL = rem.length; - while (compare2(prod, rem, prodL, remL) == 1) { - n--; - subtract(prod, yL < prodL ? yz : yc, prodL, base); - prodL = prod.length; - cmp = 1; - } - } else { - if (n == 0) { - cmp = n = 1; - } - prod = yc.slice(); - prodL = prod.length; - } - if (prodL < remL) - prod = [0].concat(prod); - subtract(rem, prod, remL, base); - remL = rem.length; - if (cmp == -1) { - while (compare2(yc, rem, yL, remL) < 1) { - n++; - subtract(rem, yL < remL ? yz : yc, remL, base); - remL = rem.length; - } - } - } else if (cmp === 0) { - n++; - rem = [0]; - } - qc[i++] = n; - if (rem[0]) { - rem[remL++] = xc[xi] || 0; - } else { - rem = [xc[xi]]; - remL = 1; - } - } while ((xi++ < xL || rem[0] != null) && s--); - more = rem[0] != null; - if (!qc[0]) - qc.splice(0, 1); - } - if (base == BASE) { - for (i = 1, s = qc[0]; s >= 10; s /= 10, i++) - ; - round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more); - } else { - q.e = e; - q.r = +more; - } - return q; - }; - }(); - function format(n, i, rm, id) { - var c0, e, ne, len, str; - if (rm == null) - rm = ROUNDING_MODE; - else - intCheck(rm, 0, 8); - if (!n.c) - return n.toString(); - c0 = n.c[0]; - ne = n.e; - if (i == null) { - str = coeffToString(n.c); - str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) ? toExponential(str, ne) : toFixedPoint(str, ne, "0"); - } else { - n = round(new BigNumber2(n), i, rm); - e = n.e; - str = coeffToString(n.c); - len = str.length; - if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) { - for (; len < i; str += "0", len++) - ; - str = toExponential(str, e); - } else { - i -= ne; - str = toFixedPoint(str, e, "0"); - if (e + 1 > len) { - if (--i > 0) - for (str += "."; i--; str += "0") - ; - } else { - i += e - len; - if (i > 0) { - if (e + 1 == len) - str += "."; - for (; i--; str += "0") - ; - } - } - } - } - return n.s < 0 && c0 ? "-" + str : str; - } - function maxOrMin(args, method) { - var n, i = 1, m = new BigNumber2(args[0]); - for (; i < args.length; i++) { - n = new BigNumber2(args[i]); - if (!n.s) { - m = n; - break; - } else if (method.call(m, n)) { - m = n; - } - } - return m; - } - function normalise(n, c, e) { - var i = 1, j = c.length; - for (; !c[--j]; c.pop()) - ; - for (j = c[0]; j >= 10; j /= 10, i++) - ; - if ((e = i + e * LOG_BASE - 1) > MAX_EXP) { - n.c = n.e = null; - } else if (e < MIN_EXP) { - n.c = [n.e = 0]; - } else { - n.e = e; - n.c = c; - } - return n; - } - parseNumeric = function() { - var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i, dotAfter = /^([^.]+)\\.$/, dotBefore = /^\\.([^.]+)$/, isInfinityOrNaN = /^-?(Infinity|NaN)$/, whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g; - return function(x, str, isNum, b) { - var base, s = isNum ? str : str.replace(whitespaceOrPlus, ""); - if (isInfinityOrNaN.test(s)) { - x.s = isNaN(s) ? null : s < 0 ? -1 : 1; - } else { - if (!isNum) { - s = s.replace(basePrefix, function(m, p1, p2) { - base = (p2 = p2.toLowerCase()) == "x" ? 16 : p2 == "b" ? 2 : 8; - return !b || b == base ? p1 : m; - }); - if (b) { - base = b; - s = s.replace(dotAfter, "$1").replace(dotBefore, "0.$1"); - } - if (str != s) - return new BigNumber2(s, base); - } - if (BigNumber2.DEBUG) { - throw Error(bignumberError + "Not a" + (b ? " base " + b : "") + " number: " + str); - } - x.s = null; - } - x.c = x.e = null; - }; - }(); - function round(x, sd, rm, r) { - var d, i, j, k, n, ni, rd, xc = x.c, pows10 = POWS_TEN; - if (xc) { - out: { - for (d = 1, k = xc[0]; k >= 10; k /= 10, d++) - ; - i = sd - d; - if (i < 0) { - i += LOG_BASE; - j = sd; - n = xc[ni = 0]; - rd = n / pows10[d - j - 1] % 10 | 0; - } else { - ni = mathceil((i + 1) / LOG_BASE); - if (ni >= xc.length) { - if (r) { - for (; xc.length <= ni; xc.push(0)) - ; - n = rd = 0; - d = 1; - i %= LOG_BASE; - j = i - LOG_BASE + 1; - } else { - break out; - } - } else { - n = k = xc[ni]; - for (d = 1; k >= 10; k /= 10, d++) - ; - i %= LOG_BASE; - j = i - LOG_BASE + d; - rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0; - } - } - r = r || sd < 0 || // Are there any non-zero digits after the rounding digit? - // The expression n % pows10[d - j - 1] returns all digits of n to the right - // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714. - xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]); - r = rm < 4 ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 && // Check whether the digit to the left of the rounding digit is odd. - (i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7)); - if (sd < 1 || !xc[0]) { - xc.length = 0; - if (r) { - sd -= x.e + 1; - xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE]; - x.e = -sd || 0; - } else { - xc[0] = x.e = 0; - } - return x; - } - if (i == 0) { - xc.length = ni; - k = 1; - ni--; - } else { - xc.length = ni + 1; - k = pows10[LOG_BASE - i]; - xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0; - } - if (r) { - for (; ; ) { - if (ni == 0) { - for (i = 1, j = xc[0]; j >= 10; j /= 10, i++) - ; - j = xc[0] += k; - for (k = 1; j >= 10; j /= 10, k++) - ; - if (i != k) { - x.e++; - if (xc[0] == BASE) - xc[0] = 1; - } - break; - } else { - xc[ni] += k; - if (xc[ni] != BASE) - break; - xc[ni--] = 0; - k = 1; - } - } - } - for (i = xc.length; xc[--i] === 0; xc.pop()) - ; - } - if (x.e > MAX_EXP) { - x.c = x.e = null; - } else if (x.e < MIN_EXP) { - x.c = [x.e = 0]; - } - } - return x; - } - function valueOf(n) { - var str, e = n.e; - if (e === null) - return n.toString(); - str = coeffToString(n.c); - str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(str, e) : toFixedPoint(str, e, "0"); - return n.s < 0 ? "-" + str : str; - } - P.absoluteValue = P.abs = function() { - var x = new BigNumber2(this); - if (x.s < 0) - x.s = 1; - return x; - }; - P.comparedTo = function(y, b) { - return compare(this, new BigNumber2(y, b)); - }; - P.decimalPlaces = P.dp = function(dp, rm) { - var c, n, v, x = this; - if (dp != null) { - intCheck(dp, 0, MAX); - if (rm == null) - rm = ROUNDING_MODE; - else - intCheck(rm, 0, 8); - return round(new BigNumber2(x), dp + x.e + 1, rm); - } - if (!(c = x.c)) - return null; - n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE; - if (v = c[v]) - for (; v % 10 == 0; v /= 10, n--) - ; - if (n < 0) - n = 0; - return n; - }; - P.dividedBy = P.div = function(y, b) { - return div(this, new BigNumber2(y, b), DECIMAL_PLACES, ROUNDING_MODE); - }; - P.dividedToIntegerBy = P.idiv = function(y, b) { - return div(this, new BigNumber2(y, b), 0, 1); - }; - P.exponentiatedBy = P.pow = function(n, m) { - var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y, x = this; - n = new BigNumber2(n); - if (n.c && !n.isInteger()) { - throw Error(bignumberError + "Exponent not an integer: " + valueOf(n)); - } - if (m != null) - m = new BigNumber2(m); - nIsBig = n.e > 14; - if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) { - y = new BigNumber2(Math.pow(+valueOf(x), nIsBig ? n.s * (2 - isOdd(n)) : +valueOf(n))); - return m ? y.mod(m) : y; - } - nIsNeg = n.s < 0; - if (m) { - if (m.c ? !m.c[0] : !m.s) - return new BigNumber2(NaN); - isModExp = !nIsNeg && x.isInteger() && m.isInteger(); - if (isModExp) - x = x.mod(m); - } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0 ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7 : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) { - k = x.s < 0 && isOdd(n) ? -0 : 0; - if (x.e > -1) - k = 1 / k; - return new BigNumber2(nIsNeg ? 1 / k : k); - } else if (POW_PRECISION) { - k = mathceil(POW_PRECISION / LOG_BASE + 2); - } - if (nIsBig) { - half = new BigNumber2(0.5); - if (nIsNeg) - n.s = 1; - nIsOdd = isOdd(n); - } else { - i = Math.abs(+valueOf(n)); - nIsOdd = i % 2; - } - y = new BigNumber2(ONE); - for (; ; ) { - if (nIsOdd) { - y = y.times(x); - if (!y.c) - break; - if (k) { - if (y.c.length > k) - y.c.length = k; - } else if (isModExp) { - y = y.mod(m); - } - } - if (i) { - i = mathfloor(i / 2); - if (i === 0) - break; - nIsOdd = i % 2; - } else { - n = n.times(half); - round(n, n.e + 1, 1); - if (n.e > 14) { - nIsOdd = isOdd(n); - } else { - i = +valueOf(n); - if (i === 0) - break; - nIsOdd = i % 2; - } - } - x = x.times(x); - if (k) { - if (x.c && x.c.length > k) - x.c.length = k; - } else if (isModExp) { - x = x.mod(m); - } - } - if (isModExp) - return y; - if (nIsNeg) - y = ONE.div(y); - return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y; - }; - P.integerValue = function(rm) { - var n = new BigNumber2(this); - if (rm == null) - rm = ROUNDING_MODE; - else - intCheck(rm, 0, 8); - return round(n, n.e + 1, rm); - }; - P.isEqualTo = P.eq = function(y, b) { - return compare(this, new BigNumber2(y, b)) === 0; - }; - P.isFinite = function() { - return !!this.c; - }; - P.isGreaterThan = P.gt = function(y, b) { - return compare(this, new BigNumber2(y, b)) > 0; - }; - P.isGreaterThanOrEqualTo = P.gte = function(y, b) { - return (b = compare(this, new BigNumber2(y, b))) === 1 || b === 0; - }; - P.isInteger = function() { - return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2; - }; - P.isLessThan = P.lt = function(y, b) { - return compare(this, new BigNumber2(y, b)) < 0; - }; - P.isLessThanOrEqualTo = P.lte = function(y, b) { - return (b = compare(this, new BigNumber2(y, b))) === -1 || b === 0; - }; - P.isNaN = function() { - return !this.s; - }; - P.isNegative = function() { - return this.s < 0; - }; - P.isPositive = function() { - return this.s > 0; - }; - P.isZero = function() { - return !!this.c && this.c[0] == 0; - }; - P.minus = function(y, b) { - var i, j, t, xLTy, x = this, a = x.s; - y = new BigNumber2(y, b); - b = y.s; - if (!a || !b) - return new BigNumber2(NaN); - if (a != b) { - y.s = -b; - return x.plus(y); - } - var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c; - if (!xe || !ye) { - if (!xc || !yc) - return xc ? (y.s = -b, y) : new BigNumber2(yc ? x : NaN); - if (!xc[0] || !yc[0]) { - return yc[0] ? (y.s = -b, y) : new BigNumber2(xc[0] ? x : ( - // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity - ROUNDING_MODE == 3 ? -0 : 0 - )); - } - } - xe = bitFloor(xe); - ye = bitFloor(ye); - xc = xc.slice(); - if (a = xe - ye) { - if (xLTy = a < 0) { - a = -a; - t = xc; - } else { - ye = xe; - t = yc; - } - t.reverse(); - for (b = a; b--; t.push(0)) - ; - t.reverse(); - } else { - j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b; - for (a = b = 0; b < j; b++) { - if (xc[b] != yc[b]) { - xLTy = xc[b] < yc[b]; - break; - } - } - } - if (xLTy) - t = xc, xc = yc, yc = t, y.s = -y.s; - b = (j = yc.length) - (i = xc.length); - if (b > 0) - for (; b--; xc[i++] = 0) - ; - b = BASE - 1; - for (; j > a; ) { - if (xc[--j] < yc[j]) { - for (i = j; i && !xc[--i]; xc[i] = b) - ; - --xc[i]; - xc[j] += BASE; - } - xc[j] -= yc[j]; - } - for (; xc[0] == 0; xc.splice(0, 1), --ye) - ; - if (!xc[0]) { - y.s = ROUNDING_MODE == 3 ? -1 : 1; - y.c = [y.e = 0]; - return y; - } - return normalise(y, xc, ye); - }; - P.modulo = P.mod = function(y, b) { - var q, s, x = this; - y = new BigNumber2(y, b); - if (!x.c || !y.s || y.c && !y.c[0]) { - return new BigNumber2(NaN); - } else if (!y.c || x.c && !x.c[0]) { - return new BigNumber2(x); - } - if (MODULO_MODE == 9) { - s = y.s; - y.s = 1; - q = div(x, y, 0, 3); - y.s = s; - q.s *= s; - } else { - q = div(x, y, 0, MODULO_MODE); - } - y = x.minus(q.times(y)); - if (!y.c[0] && MODULO_MODE == 1) - y.s = x.s; - return y; - }; - P.multipliedBy = P.times = function(y, b) { - var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc, base, sqrtBase, x = this, xc = x.c, yc = (y = new BigNumber2(y, b)).c; - if (!xc || !yc || !xc[0] || !yc[0]) { - if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) { - y.c = y.e = y.s = null; - } else { - y.s *= x.s; - if (!xc || !yc) { - y.c = y.e = null; - } else { - y.c = [0]; - y.e = 0; - } - } - return y; - } - e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE); - y.s *= x.s; - xcL = xc.length; - ycL = yc.length; - if (xcL < ycL) - zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i; - for (i = xcL + ycL, zc = []; i--; zc.push(0)) - ; - base = BASE; - sqrtBase = SQRT_BASE; - for (i = ycL; --i >= 0; ) { - c = 0; - ylo = yc[i] % sqrtBase; - yhi = yc[i] / sqrtBase | 0; - for (k = xcL, j = i + k; j > i; ) { - xlo = xc[--k] % sqrtBase; - xhi = xc[k] / sqrtBase | 0; - m = yhi * xlo + xhi * ylo; - xlo = ylo * xlo + m % sqrtBase * sqrtBase + zc[j] + c; - c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi; - zc[j--] = xlo % base; - } - zc[j] = c; - } - if (c) { - ++e; - } else { - zc.splice(0, 1); - } - return normalise(y, zc, e); - }; - P.negated = function() { - var x = new BigNumber2(this); - x.s = -x.s || null; - return x; - }; - P.plus = function(y, b) { - var t, x = this, a = x.s; - y = new BigNumber2(y, b); - b = y.s; - if (!a || !b) - return new BigNumber2(NaN); - if (a != b) { - y.s = -b; - return x.minus(y); - } - var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c; - if (!xe || !ye) { - if (!xc || !yc) - return new BigNumber2(a / 0); - if (!xc[0] || !yc[0]) - return yc[0] ? y : new BigNumber2(xc[0] ? x : a * 0); - } - xe = bitFloor(xe); - ye = bitFloor(ye); - xc = xc.slice(); - if (a = xe - ye) { - if (a > 0) { - ye = xe; - t = yc; - } else { - a = -a; - t = xc; - } - t.reverse(); - for (; a--; t.push(0)) - ; - t.reverse(); - } - a = xc.length; - b = yc.length; - if (a - b < 0) - t = yc, yc = xc, xc = t, b = a; - for (a = 0; b; ) { - a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0; - xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE; - } - if (a) { - xc = [a].concat(xc); - ++ye; - } - return normalise(y, xc, ye); - }; - P.precision = P.sd = function(sd, rm) { - var c, n, v, x = this; - if (sd != null && sd !== !!sd) { - intCheck(sd, 1, MAX); - if (rm == null) - rm = ROUNDING_MODE; - else - intCheck(rm, 0, 8); - return round(new BigNumber2(x), sd, rm); - } - if (!(c = x.c)) - return null; - v = c.length - 1; - n = v * LOG_BASE + 1; - if (v = c[v]) { - for (; v % 10 == 0; v /= 10, n--) - ; - for (v = c[0]; v >= 10; v /= 10, n++) - ; - } - if (sd && x.e + 1 > n) - n = x.e + 1; - return n; - }; - P.shiftedBy = function(k) { - intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER); - return this.times("1e" + k); - }; - P.squareRoot = P.sqrt = function() { - var m, n, r, rep, t, x = this, c = x.c, s = x.s, e = x.e, dp = DECIMAL_PLACES + 4, half = new BigNumber2("0.5"); - if (s !== 1 || !c || !c[0]) { - return new BigNumber2(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0); - } - s = Math.sqrt(+valueOf(x)); - if (s == 0 || s == 1 / 0) { - n = coeffToString(c); - if ((n.length + e) % 2 == 0) - n += "0"; - s = Math.sqrt(+n); - e = bitFloor((e + 1) / 2) - (e < 0 || e % 2); - if (s == 1 / 0) { - n = "5e" + e; - } else { - n = s.toExponential(); - n = n.slice(0, n.indexOf("e") + 1) + e; - } - r = new BigNumber2(n); - } else { - r = new BigNumber2(s + ""); - } - if (r.c[0]) { - e = r.e; - s = e + dp; - if (s < 3) - s = 0; - for (; ; ) { - t = r; - r = half.times(t.plus(div(x, t, dp, 1))); - if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) { - if (r.e < e) - --s; - n = n.slice(s - 3, s + 1); - if (n == "9999" || !rep && n == "4999") { - if (!rep) { - round(t, t.e + DECIMAL_PLACES + 2, 0); - if (t.times(t).eq(x)) { - r = t; - break; - } - } - dp += 4; - s += 4; - rep = 1; - } else { - if (!+n || !+n.slice(1) && n.charAt(0) == "5") { - round(r, r.e + DECIMAL_PLACES + 2, 1); - m = !r.times(r).eq(x); - } - break; - } - } - } - } - return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m); - }; - P.toExponential = function(dp, rm) { - if (dp != null) { - intCheck(dp, 0, MAX); - dp++; - } - return format(this, dp, rm, 1); - }; - P.toFixed = function(dp, rm) { - if (dp != null) { - intCheck(dp, 0, MAX); - dp = dp + this.e + 1; - } - return format(this, dp, rm); - }; - P.toFormat = function(dp, rm, format2) { - var str, x = this; - if (format2 == null) { - if (dp != null && rm && typeof rm == "object") { - format2 = rm; - rm = null; - } else if (dp && typeof dp == "object") { - format2 = dp; - dp = rm = null; - } else { - format2 = FORMAT; - } - } else if (typeof format2 != "object") { - throw Error(bignumberError + "Argument not an object: " + format2); - } - str = x.toFixed(dp, rm); - if (x.c) { - var i, arr = str.split("."), g1 = +format2.groupSize, g2 = +format2.secondaryGroupSize, groupSeparator = format2.groupSeparator || "", intPart = arr[0], fractionPart = arr[1], isNeg = x.s < 0, intDigits = isNeg ? intPart.slice(1) : intPart, len = intDigits.length; - if (g2) - i = g1, g1 = g2, g2 = i, len -= i; - if (g1 > 0 && len > 0) { - i = len % g1 || g1; - intPart = intDigits.substr(0, i); - for (; i < len; i += g1) - intPart += groupSeparator + intDigits.substr(i, g1); - if (g2 > 0) - intPart += groupSeparator + intDigits.slice(i); - if (isNeg) - intPart = "-" + intPart; - } - str = fractionPart ? intPart + (format2.decimalSeparator || "") + ((g2 = +format2.fractionGroupSize) ? fractionPart.replace( - new RegExp("\\d{" + g2 + "}\\B", "g"), - "$&" + (format2.fractionGroupSeparator || "") - ) : fractionPart) : intPart; - } - return (format2.prefix || "") + str + (format2.suffix || ""); - }; - P.toFraction = function(md) { - var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s, x = this, xc = x.c; - if (md != null) { - n = new BigNumber2(md); - if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) { - throw Error(bignumberError + "Argument " + (n.isInteger() ? "out of range: " : "not an integer: ") + valueOf(n)); - } - } - if (!xc) - return new BigNumber2(x); - d = new BigNumber2(ONE); - n1 = d0 = new BigNumber2(ONE); - d1 = n0 = new BigNumber2(ONE); - s = coeffToString(xc); - e = d.e = s.length - x.e - 1; - d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp]; - md = !md || n.comparedTo(d) > 0 ? e > 0 ? d : n1 : n; - exp = MAX_EXP; - MAX_EXP = 1 / 0; - n = new BigNumber2(s); - n0.c[0] = 0; - for (; ; ) { - q = div(n, d, 0, 1); - d2 = d0.plus(q.times(d1)); - if (d2.comparedTo(md) == 1) - break; - d0 = d1; - d1 = d2; - n1 = n0.plus(q.times(d2 = n1)); - n0 = d2; - d = n.minus(q.times(d2 = d)); - n = d2; - } - d2 = div(md.minus(d0), d1, 0, 1); - n0 = n0.plus(d2.times(n1)); - d0 = d0.plus(d2.times(d1)); - n0.s = n1.s = x.s; - e = e * 2; - r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo( - div(n0, d0, e, ROUNDING_MODE).minus(x).abs() - ) < 1 ? [n1, d1] : [n0, d0]; - MAX_EXP = exp; - return r; - }; - P.toNumber = function() { - return +valueOf(this); - }; - P.toPrecision = function(sd, rm) { - if (sd != null) - intCheck(sd, 1, MAX); - return format(this, sd, rm, 2); - }; - P.toString = function(b) { - var str, n = this, s = n.s, e = n.e; - if (e === null) { - if (s) { - str = "Infinity"; - if (s < 0) - str = "-" + str; - } else { - str = "NaN"; - } - } else { - if (b == null) { - str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(coeffToString(n.c), e) : toFixedPoint(coeffToString(n.c), e, "0"); - } else if (b === 10 && alphabetHasNormalDecimalDigits) { - n = round(new BigNumber2(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE); - str = toFixedPoint(coeffToString(n.c), n.e, "0"); - } else { - intCheck(b, 2, ALPHABET.length, "Base"); - str = convertBase(toFixedPoint(coeffToString(n.c), e, "0"), 10, b, s, true); - } - if (s < 0 && n.c[0]) - str = "-" + str; - } - return str; - }; - P.valueOf = P.toJSON = function() { - return valueOf(this); - }; - P._isBigNumber = true; - P[Symbol.toStringTag] = "BigNumber"; - P[Symbol.for("nodejs.util.inspect.custom")] = P.valueOf; - if (configObject != null) - BigNumber2.set(configObject); - return BigNumber2; -} -function bitFloor(n) { - var i = n | 0; - return n > 0 || n === i ? i : i - 1; -} -function coeffToString(a) { - var s, z, i = 1, j = a.length, r = a[0] + ""; - for (; i < j; ) { - s = a[i++] + ""; - z = LOG_BASE - s.length; - for (; z--; s = "0" + s) - ; - r += s; - } - for (j = r.length; r.charCodeAt(--j) === 48; ) - ; - return r.slice(0, j + 1 || 1); -} -function compare(x, y) { - var a, b, xc = x.c, yc = y.c, i = x.s, j = y.s, k = x.e, l = y.e; - if (!i || !j) - return null; - a = xc && !xc[0]; - b = yc && !yc[0]; - if (a || b) - return a ? b ? 0 : -j : i; - if (i != j) - return i; - a = i < 0; - b = k == l; - if (!xc || !yc) - return b ? 0 : !xc ^ a ? 1 : -1; - if (!b) - return k > l ^ a ? 1 : -1; - j = (k = xc.length) < (l = yc.length) ? k : l; - for (i = 0; i < j; i++) - if (xc[i] != yc[i]) - return xc[i] > yc[i] ^ a ? 1 : -1; - return k == l ? 0 : k > l ^ a ? 1 : -1; -} -function intCheck(n, min, max, name) { - if (n < min || n > max || n !== mathfloor(n)) { - throw Error(bignumberError + (name || "Argument") + (typeof n == "number" ? n < min || n > max ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n)); - } -} -function isOdd(n) { - var k = n.c.length - 1; - return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0; -} -function toExponential(str, e) { - return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e < 0 ? "e" : "e+") + e; -} -function toFixedPoint(str, e, z) { - var len, zs; - if (e < 0) { - for (zs = z + "."; ++e; zs += z) - ; - str = zs + str; - } else { - len = str.length; - if (++e > len) { - for (zs = z, e -= len; --e; zs += z) - ; - str += zs; - } else if (e < len) { - str = str.slice(0, e) + "." + str.slice(e); - } - } - return str; -} -var BigNumberClone = clone(); -var bignumber_default = BigNumberClone; -// src/util.js -var ce = (flag, message) => (p) => flag ? Left(message) : Right(p); -function isInteger(v) { - return new bignumber_default(v).isInteger(); -} -function roundDown(v) { - return new bignumber_default(v).integerValue(bignumber_default.ROUND_DOWN).toNumber(); -} -var addClaimBalanceTo = ({ state, action }) => { - const indexToRemove = state.claimable.findIndex( - (claim3) => claim3.txID === action.input.txID - ); - const claim2 = state.claimable[indexToRemove]; - const balance2 = state.balances[claim2.to] || 0; - state.balances[claim2.to] = balance2 + claim2.qty; - return indexToRemove; -}; -var addClaimBalanceFrom = ({ state, action }) => { - const indexToRemove = state.claimable.findIndex( - (claim3) => claim3.txID === action.input.tx - ); - const claim2 = state.claimable[indexToRemove]; - const balance2 = state.balances[claim2.from] || 0; - state.balances[claim2.from] = balance2 + claim2.qty; - return indexToRemove; -}; -function isArweaveAddress(address) { - if (!address) - return void 0; - const addr = address.toString().trim(); - return /[a-z0-9_-]{43}/i.test(addr); -} -// src/write/transfer.js -function transfer(state, action) { - return of({ state, action }).chain(fromNullable).chain(ce(!action.input?.target, "Please specify a target.")).chain( - ce(action.input?.target === action.caller, "Target cannot be caller.") - ).chain(ce(!isArweaveAddress(action.input?.target), "Invalid target.")).chain(ce(!isInteger(action.input?.qty), "qty must be an integer.")).chain( - ce( - roundDown(action.input?.qty) < 1, - "Invalid token transfer. qty must be an integer greater than 0." - ) - ).chain( - ce( - (state.balances[action.caller] || 0) < roundDown(action.input?.qty), - "Not enough tokens for transfer." - ) - ).map(updateBalances).fold( - (error) => { - throw new ContractError(error || "An error occurred."); - }, - () => ({ state }) - ); -} -var updateBalances = ({ state, action }) => { - const safeQty = roundDown(action.input.qty); - state.balances[action.caller] -= safeQty; - const targetBalance = state.balances[action.input.target] || 0; - state.balances[action.input.target] = targetBalance + safeQty; -}; -// src/write/claim.js -function claim(state, action) { - return of({ state, action }).chain(fromNullable).chain( - ce(!action.input?.txID, "txID must be passed to the claim function.") - ).chain(ce(!action.input?.qty, "A qty must be specified.")).chain( - ce( - state.claimable.filter((c) => c.txID === action.input.txID).length !== 1, - "There must be 1 claimable with this tx id." - ) - ).chain( - ce( - state.claimable.filter((c) => c.txID === action.input?.txID)[0]?.to !== action.caller, - "Claim not addressed to caller." - ) - ).chain( - ce( - state.claimable.filter((c) => c.txID === action.input.txID)[0]?.qty !== action.input?.qty, - "Incorrect qty." - ) - ).map(addClaimBalanceTo).map((indexToRemove) => { - state.claimable.splice(indexToRemove, 1); - return state; - }).fold( - (msg) => { - throw new ContractError(msg || "An error occurred."); - }, - () => { - return { state }; - } - ); -} -// src/write/allow.js -function allow(state, action) { - return of(action.caller).chain(fromNullable).chain(ce(!action.input?.target, "Please specify a target.")).chain( - ce(action.input?.target === action.caller, "Target cannot be caller.") - ).chain(ce(!isArweaveAddress(action.input?.target), "Invalid target.")).chain(ce(!isInteger(action.input?.qty), "qty must be an integer.")).chain( - ce( - roundDown(action.input?.qty) < 1, - "Invalid token transfer. qty must be an integer greater than 0." - ) - ).chain( - ce( - (state.balances[action.caller] || 0) < roundDown(action.input?.qty), - "Not enough tokens for transfer." - ) - ).map((caller) => { - const safeQty = roundDown(action.input.qty); - state.balances[caller] -= safeQty; - state.claimable.push({ - from: caller, - to: action.input.target, - qty: safeQty, - txID: SmartWeave.transaction.id - }); - }).fold( - (msg) => { - throw new ContractError(msg || "An error occurred."); - }, - () => ({ state }) - ); -} -// src/write/test-mint.js -function mint(state, action) { - if (!state.block) - state.block = SmartWeave?.block?.height + 720; - if (SmartWeave?.block?.height > state.block) { - state.block = SmartWeave?.block?.height + 720; - state.minted = []; - } - if (state.minted.includes(action.caller)) - return { state }; - const balance2 = state.balances[action.caller] || 0; - state.balances[action.caller] = balance2 + 1e6; - state.minted.push(action.caller); - return { state }; -} -// src/write/reject.js -function rejectClaimable(state, action) { - return of({ state, action }).chain(fromNullable).chain(ce(!action.input?.tx, "txID must be passed to the reject function.")).chain( - ce( - state.claimable.filter((c) => c.txID === action.input.tx).length !== 1, - "There must be 1 claimable with this tx id." - ) - ).chain( - ce( - state.claimable.filter((c) => c.txID === action.input.tx)[0]?.to !== action.caller, - "Claim not addressed to caller." - ) - ).map(addClaimBalanceFrom).map((indexToRemove) => { - state.claimable.splice(indexToRemove, 1); - return state; - }).fold( - (msg) => { - throw new ContractError(msg || "An error occurred."); - }, - (state2) => ({ state: state2 }) - ); -} -// src/test-contract.js -export async function handle(state, action) { - if (SmartWeave.transaction.origin === "L1") { - return { state }; - } - switch (action?.input?.function) { - case "balance": - return balance(state, action); - case "reject": - return rejectClaimable(state, action); - case "transfer": - return transfer(state, action); - case "allow": - return allow(state, action); - case "claim": - return claim(state, action); - case "mint": - return mint(state, action); - default: - throw new ContractError( - \`No function supplied or function not recognized\` - ); - } -} - -`,AD=` -{ - "name": "test-U", - "note": "Dad <3's U B & R!", - "block": null, - "owner": "9x24zjvs9DA5zAz2DmqBWAg6XcxrrE-8w3EkpwRm4e4", - "minted": [], - "ticker": "test-U", - "balances": { - "9x24zjvs9DA5zAz2DmqBWAg6XcxrrE-8w3EkpwRm4e4": 100000000 - }, - "settings": [ - [ - "isTradeable", - true - ], - [ - "communityLogo", - "J3WXX4OGa6wP5E9oLhNyqlN4deYI7ARjrd5se740ftE" - ] - ], - "claimable": [], - "divisibility": 1000000 -} -`,SD=` - -// Welcome to BetterIDE Studio -// Feel free to edit the following smartweave contract code and add your own functions - -// This is a contract function -function _set(state, action) { - ContractAssert(action.input.key, "Key not supplied") - ContractAssert(action.input.value, "Value not supplied") - // Modify state with the input - state.db[action.input.key] = action.input.value - return { state } -} - -function _get(state) { - ContractAssert(action.input.key, "Key not supplied") - // simply return the value for myName key in state - return { result: state.db[action.input.key] } -} - -function _delete(state) { - ContractAssert(action.input.key, "Key not supplied") - delete state.db[action.input.key] - return { state } -} - -// This is the handler for all contract functions -export function handle(state, action) { - const input = action.input - switch (input.function) { - case "set": - return _set(state, action); - // no need for break statement because we are using return - case "get": - return _get(state, action); - case "delete": - return _delete(state, action) - default: - throw new ContractError(\`Function not recognised: "\${input.function}"\`) - } -} - - -`,CD=` -{ - "db":{} -} - -`;function _D({contracts:t,setActiveMenuItem:e,setActiveContract:r,setActiveFile:n}){const[i,s]=K.useState(JSON.parse(localStorage.getItem("recents"))||[]);function a({name:o,src:c,state:u}){return te.jsxs("div",{className:"ring-1 rounded ring-white/50 p-2 px-3 flex flex-col gap-2 hover:bg-white/5 min-w-[150px]",children:[te.jsx("div",{className:"text-lg",children:o}),te.jsxs("button",{className:"relative bg-[#2c3b50] hover:bg-[#395d8b] px-2 rounded hover:w-24 w-14 text-left transition-all duration-300",onClick:()=>{const l=[...i];if(c&&u){const h=t.newContract(c,u);h&&(setTimeout(()=>{r(h),n("README.md"),e("Contracts")},400),l.includes(h)&&l.splice(l.indexOf(h),1),l.unshift(h),localStorage.setItem("recents",JSON.stringify(l)))}else r(o),n("README.md"),e("Contracts"),l.includes(o)&&l.splice(l.indexOf(o),1),l.unshift(o),localStorage.setItem("recents",JSON.stringify(l))},children:[c&&u?"edit":"open",te.jsx("div",{className:"absolute right-2 w-full text-right text-transparent hover:text-white top-0",children:"->"})]})]})}return te.jsxs("div",{className:" h-full flex flex-col gap-1 items-center justify-center",children:[te.jsx("div",{className:"text-2xl",children:"Welcome to BetterIDEa! 🚀"}),te.jsx("div",{className:"text-lg",children:"Your one stop solution for developing smart contracts on Arweave"}),te.jsxs("div",{className:"flex flex-col gap-5 justify-start items-start w-full px-10",children:[te.jsxs("div",{children:[te.jsx("div",{className:"text-xl my-1",children:i.length==0?"No recently opened contracts":"Recently opened contracts"}),te.jsx("div",{className:"flex gap-3",children:i.map(o=>te.jsx(a,{name:o}))})]}),te.jsxs("div",{children:[te.jsx("div",{className:"text-xl my-1",children:"Explore contract templates"}),te.jsxs("div",{className:"flex gap-3",children:[te.jsx(a,{name:"Vote",src:bD,state:wD}),te.jsx(a,{name:"Database",src:SD,state:CD}),te.jsx(a,{name:"U-Token",src:ED,state:AD})]})]})]})]})}function mt(){return mt=Object.assign?Object.assign.bind():function(t){for(var e=1;et.forEach(r=>kD(r,e))}function Jr(...t){return K.useCallback(a_(...t),t)}const mh=K.forwardRef((t,e)=>{const{children:r,...n}=t,i=K.Children.toArray(r),s=i.find(ID);if(s){const a=s.props.children,o=i.map(c=>c===s?K.Children.count(a)>1?K.Children.only(null):K.isValidElement(a)?a.props.children:null:c);return K.createElement(Vb,mt({},n,{ref:e}),K.isValidElement(a)?K.cloneElement(a,void 0,o):null)}return K.createElement(Vb,mt({},n,{ref:e}),r)});mh.displayName="Slot";const Vb=K.forwardRef((t,e)=>{const{children:r,...n}=t;return K.isValidElement(r)?K.cloneElement(r,{...FD(n,r.props),ref:e?a_(e,r.ref):r.ref}):K.Children.count(r)>1?K.Children.only(null):null});Vb.displayName="SlotClone";const BD=({children:t})=>K.createElement(K.Fragment,null,t);function ID(t){return K.isValidElement(t)&&t.type===BD}function FD(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...o)=>{s(...o),i(...o)}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function o_(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;etypeof t=="boolean"?"".concat(t):t===0?"0":t,FE=TD,PD=(t,e)=>r=>{var n;if((e==null?void 0:e.variants)==null)return FE(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:i,defaultVariants:s}=e,a=Object.keys(i).map(u=>{const l=r==null?void 0:r[u],h=s==null?void 0:s[u];if(l===null)return null;const f=IE(l)||IE(h);return i[u][f]}),o=r&&Object.entries(r).reduce((u,l)=>{let[h,f]=l;return f===void 0||(u[h]=f),u},{}),c=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((u,l)=>{let{class:h,className:f,...p}=l;return Object.entries(p).every(d=>{let[g,y]=d;return Array.isArray(y)?y.includes({...s,...o}[g]):{...s,...o}[g]===y})?[...u,h,f]:u},[]);return FE(t,a,c,r==null?void 0:r.class,r==null?void 0:r.className)};function c_(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;eo(s)))==null?void 0:a.classGroupId}const TE=/^\[(.+)\]$/;function DD(t){if(TE.test(t)){const e=TE.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}}function RD(t){const{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return LD(Object.entries(t.classGroups),r).forEach(([s,a])=>{qb(a,n,s,e)}),n}function qb(t,e,r,n){t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:PE(e,i);s.classGroupId=r;return}if(typeof i=="function"){if(MD(i)){qb(i(n),e,r,n);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([s,a])=>{qb(a,PE(e,s),r,n)})})}function PE(t,e){let r=t;return e.split(w3).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r}function MD(t){return t.isThemeGetter}function LD(t,e){return e?t.map(([r,n])=>{const i=n.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([a,o])=>[e+a,o])):s);return[r,i]}):t}function jD(t){if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map;function i(s,a){r.set(s,a),e++,e>t&&(e=0,n=r,r=new Map)}return{get(s){let a=r.get(s);if(a!==void 0)return a;if((a=n.get(s))!==void 0)return i(s,a),a},set(s,a){r.has(s)?r.set(s,a):i(s,a)}}}const l_="!";function UD(t){const e=t.separator,r=e.length===1,n=e[0],i=e.length;return function(a){const o=[];let c=0,u=0,l;for(let g=0;gu?l-u:void 0;return{modifiers:o,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:d}}}function $D(t){if(t.length<=1)return t;const e=[];let r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e}function HD(t){return{cache:jD(t.cacheSize),splitModifiers:UD(t),...OD(t)}}const zD=/\s+/;function VD(t,e){const{splitModifiers:r,getClassGroupId:n,getConflictingClassGroupIds:i}=e,s=new Set;return t.trim().split(zD).map(a=>{const{modifiers:o,hasImportantModifier:c,baseClassName:u,maybePostfixModifierPosition:l}=r(a);let h=n(l?u.substring(0,l):u),f=!!l;if(!h){if(!l)return{isTailwindClass:!1,originalClassName:a};if(h=n(u),!h)return{isTailwindClass:!1,originalClassName:a};f=!1}const p=$D(o).join(":");return{isTailwindClass:!0,modifierId:c?p+l_:p,classGroupId:h,originalClassName:a,hasPostfixModifier:f}}).reverse().filter(a=>{if(!a.isTailwindClass)return!0;const{modifierId:o,classGroupId:c,hasPostfixModifier:u}=a,l=o+c;return s.has(l)?!1:(s.add(l),i(c,u).forEach(h=>s.add(o+h)),!0)}).reverse().map(a=>a.originalClassName).join(" ")}function qD(){let t=0,e,r,n="";for(;th(l),t());return r=HD(u),n=r.cache.get,i=r.cache.set,s=o,o(c)}function o(c){const u=n(c);if(u)return u;const l=VD(c,r);return i(c,l),l}return function(){return s(qD.apply(null,arguments))}}function Dt(t){const e=r=>r[t]||[];return e.isThemeGetter=!0,e}const h_=/^\[(?:([a-z-]+):)?(.+)\]$/i,WD=/^\d+\/\d+$/,GD=new Set(["px","full","screen"]),ZD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,JD=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,XD=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,QD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function wa(t){return tu(t)||GD.has(t)||WD.test(t)}function _o(t){return Gh(t,"length",aR)}function tu(t){return!!t&&!Number.isNaN(Number(t))}function v1(t){return Gh(t,"number",tu)}function x0(t){return!!t&&Number.isInteger(Number(t))}function YD(t){return t.endsWith("%")&&tu(t.slice(0,-1))}function nt(t){return h_.test(t)}function ko(t){return ZD.test(t)}const eR=new Set(["length","size","percentage"]);function tR(t){return Gh(t,eR,d_)}function rR(t){return Gh(t,"position",d_)}const nR=new Set(["image","url"]);function iR(t){return Gh(t,nR,cR)}function sR(t){return Gh(t,"",oR)}function b0(){return!0}function Gh(t,e,r){const n=h_.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1}function aR(t){return JD.test(t)}function d_(){return!1}function oR(t){return XD.test(t)}function cR(t){return QD.test(t)}function uR(){const t=Dt("colors"),e=Dt("spacing"),r=Dt("blur"),n=Dt("brightness"),i=Dt("borderColor"),s=Dt("borderRadius"),a=Dt("borderSpacing"),o=Dt("borderWidth"),c=Dt("contrast"),u=Dt("grayscale"),l=Dt("hueRotate"),h=Dt("invert"),f=Dt("gap"),p=Dt("gradientColorStops"),d=Dt("gradientColorStopPositions"),g=Dt("inset"),y=Dt("margin"),x=Dt("opacity"),b=Dt("padding"),S=Dt("saturate"),k=Dt("scale"),T=Dt("sepia"),_=Dt("skew"),B=Dt("space"),N=Dt("translate"),P=()=>["auto","contain","none"],D=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto",nt,e],E=()=>[nt,e],F=()=>["",wa,_o],A=()=>["auto",tu,nt],I=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],j=()=>["solid","dashed","dotted","double","none"],H=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"],G=()=>["start","end","center","between","around","evenly","stretch"],z=()=>["","0",nt],R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>[tu,v1],q=()=>[tu,nt];return{cacheSize:500,separator:":",theme:{colors:[b0],spacing:[wa,_o],blur:["none","",ko,nt],brightness:L(),borderColor:[t],borderRadius:["none","","full",ko,nt],borderSpacing:E(),borderWidth:F(),contrast:L(),grayscale:z(),hueRotate:q(),invert:z(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[YD,_o],inset:O(),margin:O(),opacity:L(),padding:E(),saturate:L(),scale:L(),sepia:z(),skew:q(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",nt]}],container:["container"],columns:[{columns:[ko]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...I(),nt]}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",x0,nt]}],basis:[{basis:O()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",nt]}],grow:[{grow:z()}],shrink:[{shrink:z()}],order:[{order:["first","last","none",x0,nt]}],"grid-cols":[{"grid-cols":[b0]}],"col-start-end":[{col:["auto",{span:["full",x0,nt]},nt]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[b0]}],"row-start-end":[{row:["auto",{span:[x0,nt]},nt]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",nt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",nt]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...G()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...G(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...G(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[B]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[B]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",nt,e]}],"min-w":[{"min-w":[nt,e,"min","max","fit"]}],"max-w":[{"max-w":[nt,e,"none","full","min","max","fit","prose",{screen:[ko]},ko]}],h:[{h:[nt,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[nt,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[nt,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[nt,e,"auto","min","max","fit"]}],"font-size":[{text:["base",ko,_o]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",v1]}],"font-family":[{font:[b0]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",nt]}],"line-clamp":[{"line-clamp":["none",tu,v1]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",wa,nt]}],"list-image":[{"list-image":["none",nt]}],"list-style-type":[{list:["none","disc","decimal",nt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[x]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...j(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",wa,_o]}],"underline-offset":[{"underline-offset":["auto",wa,nt]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",nt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",nt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[x]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...I(),rR]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",tR]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},iR]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[d]}],"gradient-via-pos":[{via:[d]}],"gradient-to-pos":[{to:[d]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[o]}],"border-w-x":[{"border-x":[o]}],"border-w-y":[{"border-y":[o]}],"border-w-s":[{"border-s":[o]}],"border-w-e":[{"border-e":[o]}],"border-w-t":[{"border-t":[o]}],"border-w-r":[{"border-r":[o]}],"border-w-b":[{"border-b":[o]}],"border-w-l":[{"border-l":[o]}],"border-opacity":[{"border-opacity":[x]}],"border-style":[{border:[...j(),"hidden"]}],"divide-x":[{"divide-x":[o]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[o]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[x]}],"divide-style":[{divide:j()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...j()]}],"outline-offset":[{"outline-offset":[wa,nt]}],"outline-w":[{outline:[wa,_o]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[wa,_o]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",ko,sR]}],"shadow-color":[{shadow:[b0]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":H()}],"bg-blend":[{"bg-blend":H()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",ko,nt]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[l]}],invert:[{invert:[h]}],saturate:[{saturate:[S]}],sepia:[{sepia:[T]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[l]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[x]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[T]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",nt]}],duration:[{duration:q()}],ease:[{ease:["linear","in","out","in-out",nt]}],delay:[{delay:q()}],animate:[{animate:["none","spin","ping","pulse","bounce",nt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[x0,nt]}],"translate-x":[{"translate-x":[N]}],"translate-y":[{"translate-y":[N]}],"skew-x":[{"skew-x":[_]}],"skew-y":[{"skew-y":[_]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",nt]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",nt]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",nt]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[wa,_o,v1]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}const lR=KD(uR);function Hi(...t){return lR(ND(t))}const fR=PD("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Za=K.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...i},s)=>{const a=n?mh:"button";return te.jsx(a,{className:Hi(fR({variant:e,size:r,className:t})),ref:s,...i})});Za.displayName="Button";const E3=JSON,hR=t=>t.toUpperCase(),dR=t=>{const e={};return t.forEach((r,n)=>{e[n]=r}),e},pR=(t,e,r)=>t.document?t:{document:t,variables:e,requestHeaders:r,signal:void 0},gR=(t,e,r)=>t.query?t:{query:t,variables:e,requestHeaders:r,signal:void 0},mR=(t,e)=>t.documents?t:{documents:t,requestHeaders:e,signal:void 0};function Q1(t,e){if(!!!t)throw new Error(e)}function vR(t){return typeof t=="object"&&t!==null}function yR(t,e){if(!!!t)throw new Error(e??"Unexpected invariant triggered.")}const xR=/\r\n|[\n\r]/g;function Kb(t,e){let r=0,n=1;for(const i of t.body.matchAll(xR)){if(typeof i.index=="number"||yR(!1),i.index>=e)break;r=i.index+i[0].length,n+=1}return{line:n,column:e+1-r}}function bR(t){return p_(t.source,Kb(t.source,t.start))}function p_(t,e){const r=t.locationOffset.column-1,n="".padStart(r)+t.body,i=e.line-1,s=t.locationOffset.line-1,a=e.line+s,o=e.line===1?r:0,c=e.column+o,u=`${t.name}:${a}:${c} -`,l=n.split(/\r\n|[\n\r]/g),h=l[i];if(h.length>120){const f=Math.floor(c/80),p=c%80,d=[];for(let g=0;g["|",g]),["|","^".padStart(p)],["|",d[f+1]]])}return u+NE([[`${a-1} |`,l[i-1]],[`${a} |`,h],["|","^".padStart(c)],[`${a+1} |`,l[i+1]]])}function NE(t){const e=t.filter(([n,i])=>i!==void 0),r=Math.max(...e.map(([n])=>n.length));return e.map(([n,i])=>n.padStart(r)+(i?" "+i:"")).join(` -`)}function wR(t){const e=t[0];return e==null||"kind"in e||"length"in e?{nodes:e,source:t[1],positions:t[2],path:t[3],originalError:t[4],extensions:t[5]}:e}class A3 extends Error{constructor(e,...r){var n,i,s;const{nodes:a,source:o,positions:c,path:u,originalError:l,extensions:h}=wR(r);super(e),this.name="GraphQLError",this.path=u??void 0,this.originalError=l??void 0,this.nodes=OE(Array.isArray(a)?a:a?[a]:void 0);const f=OE((n=this.nodes)===null||n===void 0?void 0:n.map(d=>d.loc).filter(d=>d!=null));this.source=o??(f==null||(i=f[0])===null||i===void 0?void 0:i.source),this.positions=c??(f==null?void 0:f.map(d=>d.start)),this.locations=c&&o?c.map(d=>Kb(o,d)):f==null?void 0:f.map(d=>Kb(d.source,d.start));const p=vR(l==null?void 0:l.extensions)?l==null?void 0:l.extensions:void 0;this.extensions=(s=h??p)!==null&&s!==void 0?s:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),l!=null&&l.stack?Object.defineProperty(this,"stack",{value:l.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,A3):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const r of this.nodes)r.loc&&(e+=` - -`+bR(r.loc));else if(this.source&&this.locations)for(const r of this.locations)e+=` - -`+p_(this.source,r);return e}toJSON(){const e={message:this.message};return this.locations!=null&&(e.locations=this.locations),this.path!=null&&(e.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function OE(t){return t===void 0||t.length===0?void 0:t}function Or(t,e,r){return new A3(`Syntax Error: ${r}`,{source:t,positions:[e]})}class ER{constructor(e,r,n){this.start=e.start,this.end=r.end,this.startToken=e,this.endToken=r,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class g_{constructor(e,r,n,i,s,a){this.kind=e,this.start=r,this.end=n,this.line=i,this.column=s,this.value=a,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const m_={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},AR=new Set(Object.keys(m_));function DE(t){const e=t==null?void 0:t.kind;return typeof e=="string"&&AR.has(e)}var Kl;(function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"})(Kl||(Kl={}));var Wb;(function(t){t.QUERY="QUERY",t.MUTATION="MUTATION",t.SUBSCRIPTION="SUBSCRIPTION",t.FIELD="FIELD",t.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",t.FRAGMENT_SPREAD="FRAGMENT_SPREAD",t.INLINE_FRAGMENT="INLINE_FRAGMENT",t.VARIABLE_DEFINITION="VARIABLE_DEFINITION",t.SCHEMA="SCHEMA",t.SCALAR="SCALAR",t.OBJECT="OBJECT",t.FIELD_DEFINITION="FIELD_DEFINITION",t.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",t.INTERFACE="INTERFACE",t.UNION="UNION",t.ENUM="ENUM",t.ENUM_VALUE="ENUM_VALUE",t.INPUT_OBJECT="INPUT_OBJECT",t.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"})(Wb||(Wb={}));var Xe;(function(t){t.NAME="Name",t.DOCUMENT="Document",t.OPERATION_DEFINITION="OperationDefinition",t.VARIABLE_DEFINITION="VariableDefinition",t.SELECTION_SET="SelectionSet",t.FIELD="Field",t.ARGUMENT="Argument",t.FRAGMENT_SPREAD="FragmentSpread",t.INLINE_FRAGMENT="InlineFragment",t.FRAGMENT_DEFINITION="FragmentDefinition",t.VARIABLE="Variable",t.INT="IntValue",t.FLOAT="FloatValue",t.STRING="StringValue",t.BOOLEAN="BooleanValue",t.NULL="NullValue",t.ENUM="EnumValue",t.LIST="ListValue",t.OBJECT="ObjectValue",t.OBJECT_FIELD="ObjectField",t.DIRECTIVE="Directive",t.NAMED_TYPE="NamedType",t.LIST_TYPE="ListType",t.NON_NULL_TYPE="NonNullType",t.SCHEMA_DEFINITION="SchemaDefinition",t.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",t.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",t.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",t.FIELD_DEFINITION="FieldDefinition",t.INPUT_VALUE_DEFINITION="InputValueDefinition",t.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",t.UNION_TYPE_DEFINITION="UnionTypeDefinition",t.ENUM_TYPE_DEFINITION="EnumTypeDefinition",t.ENUM_VALUE_DEFINITION="EnumValueDefinition",t.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",t.DIRECTIVE_DEFINITION="DirectiveDefinition",t.SCHEMA_EXTENSION="SchemaExtension",t.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",t.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",t.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",t.UNION_TYPE_EXTENSION="UnionTypeExtension",t.ENUM_TYPE_EXTENSION="EnumTypeExtension",t.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"})(Xe||(Xe={}));function Gb(t){return t===9||t===32}function Bd(t){return t>=48&&t<=57}function v_(t){return t>=97&&t<=122||t>=65&&t<=90}function y_(t){return v_(t)||t===95}function SR(t){return v_(t)||Bd(t)||t===95}function CR(t){var e;let r=Number.MAX_SAFE_INTEGER,n=null,i=-1;for(let a=0;ao===0?a:a.slice(r)).slice((e=n)!==null&&e!==void 0?e:0,i+1)}function _R(t){let e=0;for(;e1&&n.slice(1).every(p=>p.length===0||Gb(p.charCodeAt(0))),a=r.endsWith('\\"""'),o=t.endsWith('"')&&!a,c=t.endsWith("\\"),u=o||c,l=!(e!=null&&e.minimize)&&(!i||t.length>70||u||s||a);let h="";const f=i&&Gb(t.charCodeAt(0));return(l&&!f||s)&&(h+=` -`),h+=r,(l||u)&&(h+=` -`),'"""'+h+'"""'}var _e;(function(t){t.SOF="",t.EOF="",t.BANG="!",t.DOLLAR="$",t.AMP="&",t.PAREN_L="(",t.PAREN_R=")",t.SPREAD="...",t.COLON=":",t.EQUALS="=",t.AT="@",t.BRACKET_L="[",t.BRACKET_R="]",t.BRACE_L="{",t.PIPE="|",t.BRACE_R="}",t.NAME="Name",t.INT="Int",t.FLOAT="Float",t.STRING="String",t.BLOCK_STRING="BlockString",t.COMMENT="Comment"})(_e||(_e={}));class BR{constructor(e){const r=new g_(_e.SOF,0,0,0,0);this.source=e,this.lastToken=r,this.token=r,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==_e.EOF)do if(e.next)e=e.next;else{const r=FR(this,e.end);e.next=r,r.prev=e,e=r}while(e.kind===_e.COMMENT);return e}}function IR(t){return t===_e.BANG||t===_e.DOLLAR||t===_e.AMP||t===_e.PAREN_L||t===_e.PAREN_R||t===_e.SPREAD||t===_e.COLON||t===_e.EQUALS||t===_e.AT||t===_e.BRACKET_L||t===_e.BRACKET_R||t===_e.BRACE_L||t===_e.PIPE||t===_e.BRACE_R}function Zh(t){return t>=0&&t<=55295||t>=57344&&t<=1114111}function pv(t,e){return x_(t.charCodeAt(e))&&b_(t.charCodeAt(e+1))}function x_(t){return t>=55296&&t<=56319}function b_(t){return t>=56320&&t<=57343}function Hu(t,e){const r=t.source.body.codePointAt(e);if(r===void 0)return _e.EOF;if(r>=32&&r<=126){const n=String.fromCodePoint(r);return n==='"'?`'"'`:`"${n}"`}return"U+"+r.toString(16).toUpperCase().padStart(4,"0")}function mr(t,e,r,n,i){const s=t.line,a=1+r-t.lineStart;return new g_(e,r,n,s,a,i)}function FR(t,e){const r=t.source.body,n=r.length;let i=e;for(;i=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function RR(t,e){const r=t.source.body;switch(r.charCodeAt(e+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:` -`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw Or(t.source,e,`Invalid character escape sequence: "${r.slice(e,e+2)}".`)}function MR(t,e){const r=t.source.body,n=r.length;let i=t.lineStart,s=e+3,a=s,o="";const c=[];for(;sw_?"["+VR(t)+"]":"{ "+r.map(([i,s])=>i+": "+gv(s,e)).join(", ")+" }"}function zR(t,e){if(t.length===0)return"[]";if(e.length>w_)return"[Array]";const r=Math.min(jR,t.length),n=t.length-r,i=[];for(let s=0;s1&&i.push(`... ${n} more items`),"["+i.join(", ")+"]"}function VR(t){const e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){const r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}const qR=globalThis.process?function(e,r){return e instanceof r}:function(e,r){if(e instanceof r)return!0;if(typeof e=="object"&&e!==null){var n;const i=r.prototype[Symbol.toStringTag],s=Symbol.toStringTag in e?e[Symbol.toStringTag]:(n=e.constructor)===null||n===void 0?void 0:n.name;if(i===s){const a=S3(e);throw new Error(`Cannot use ${i} "${a}" from another module or realm. - -Ensure that there is only one instance of "graphql" in the node_modules -directory. If different versions of "graphql" are the dependencies of other -relied on modules, use "resolutions" to ensure only one version is installed. - -https://yarnpkg.com/en/docs/selective-version-resolutions - -Duplicate "graphql" modules cannot be used at the same time since different -versions may have different capabilities and behavior. The data from one -version used in the function from another could produce confusing and -spurious results.`)}}return!1};class E_{constructor(e,r="GraphQL request",n={line:1,column:1}){typeof e=="string"||Q1(!1,`Body must be a string. Received: ${S3(e)}.`),this.body=e,this.name=r,this.locationOffset=n,this.locationOffset.line>0||Q1(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Q1(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function KR(t){return qR(t,E_)}function WR(t,e){return new GR(t,e).parseDocument()}class GR{constructor(e,r={}){const n=KR(e)?e:new E_(e);this._lexer=new BR(n),this._options=r,this._tokenCounter=0}parseName(){const e=this.expectToken(_e.NAME);return this.node(e,{kind:Xe.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:Xe.DOCUMENT,definitions:this.many(_e.SOF,this.parseDefinition,_e.EOF)})}parseDefinition(){if(this.peek(_e.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),r=e?this._lexer.lookahead():this._lexer.token;if(r.kind===_e.NAME){switch(r.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(e)throw Or(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(r.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(r)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(_e.BRACE_L))return this.node(e,{kind:Xe.OPERATION_DEFINITION,operation:Kl.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const r=this.parseOperationType();let n;return this.peek(_e.NAME)&&(n=this.parseName()),this.node(e,{kind:Xe.OPERATION_DEFINITION,operation:r,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(_e.NAME);switch(e.value){case"query":return Kl.QUERY;case"mutation":return Kl.MUTATION;case"subscription":return Kl.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(_e.PAREN_L,this.parseVariableDefinition,_e.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:Xe.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(_e.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(_e.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(_e.DOLLAR),this.node(e,{kind:Xe.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:Xe.SELECTION_SET,selections:this.many(_e.BRACE_L,this.parseSelection,_e.BRACE_R)})}parseSelection(){return this.peek(_e.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,r=this.parseName();let n,i;return this.expectOptionalToken(_e.COLON)?(n=r,i=this.parseName()):i=r,this.node(e,{kind:Xe.FIELD,alias:n,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(_e.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const r=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(_e.PAREN_L,r,_e.PAREN_R)}parseArgument(e=!1){const r=this._lexer.token,n=this.parseName();return this.expectToken(_e.COLON),this.node(r,{kind:Xe.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(_e.SPREAD);const r=this.expectOptionalKeyword("on");return!r&&this.peek(_e.NAME)?this.node(e,{kind:Xe.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:Xe.INLINE_FRAGMENT,typeCondition:r?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(e,{kind:Xe.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:Xe.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(e){const r=this._lexer.token;switch(r.kind){case _e.BRACKET_L:return this.parseList(e);case _e.BRACE_L:return this.parseObject(e);case _e.INT:return this.advanceLexer(),this.node(r,{kind:Xe.INT,value:r.value});case _e.FLOAT:return this.advanceLexer(),this.node(r,{kind:Xe.FLOAT,value:r.value});case _e.STRING:case _e.BLOCK_STRING:return this.parseStringLiteral();case _e.NAME:switch(this.advanceLexer(),r.value){case"true":return this.node(r,{kind:Xe.BOOLEAN,value:!0});case"false":return this.node(r,{kind:Xe.BOOLEAN,value:!1});case"null":return this.node(r,{kind:Xe.NULL});default:return this.node(r,{kind:Xe.ENUM,value:r.value})}case _e.DOLLAR:if(e)if(this.expectToken(_e.DOLLAR),this._lexer.token.kind===_e.NAME){const n=this._lexer.token.value;throw Or(this._lexer.source,r.start,`Unexpected variable "$${n}" in constant value.`)}else throw this.unexpected(r);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:Xe.STRING,value:e.value,block:e.kind===_e.BLOCK_STRING})}parseList(e){const r=()=>this.parseValueLiteral(e);return this.node(this._lexer.token,{kind:Xe.LIST,values:this.any(_e.BRACKET_L,r,_e.BRACKET_R)})}parseObject(e){const r=()=>this.parseObjectField(e);return this.node(this._lexer.token,{kind:Xe.OBJECT,fields:this.any(_e.BRACE_L,r,_e.BRACE_R)})}parseObjectField(e){const r=this._lexer.token,n=this.parseName();return this.expectToken(_e.COLON),this.node(r,{kind:Xe.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const r=[];for(;this.peek(_e.AT);)r.push(this.parseDirective(e));return r}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const r=this._lexer.token;return this.expectToken(_e.AT),this.node(r,{kind:Xe.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let r;if(this.expectOptionalToken(_e.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(_e.BRACKET_R),r=this.node(e,{kind:Xe.LIST_TYPE,type:n})}else r=this.parseNamedType();return this.expectOptionalToken(_e.BANG)?this.node(e,{kind:Xe.NON_NULL_TYPE,type:r}):r}parseNamedType(){return this.node(this._lexer.token,{kind:Xe.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(_e.STRING)||this.peek(_e.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),i=this.many(_e.BRACE_L,this.parseOperationTypeDefinition,_e.BRACE_R);return this.node(e,{kind:Xe.SCHEMA_DEFINITION,description:r,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const e=this._lexer.token,r=this.parseOperationType();this.expectToken(_e.COLON);const n=this.parseNamedType();return this.node(e,{kind:Xe.OPERATION_TYPE_DEFINITION,operation:r,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),i=this.parseConstDirectives();return this.node(e,{kind:Xe.SCALAR_TYPE_DEFINITION,description:r,name:n,directives:i})}parseObjectTypeDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(e,{kind:Xe.OBJECT_TYPE_DEFINITION,description:r,name:n,interfaces:i,directives:s,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(_e.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(_e.BRACE_L,this.parseFieldDefinition,_e.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,r=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(_e.COLON);const s=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(e,{kind:Xe.FIELD_DEFINITION,description:r,name:n,arguments:i,type:s,directives:a})}parseArgumentDefs(){return this.optionalMany(_e.PAREN_L,this.parseInputValueDef,_e.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,r=this.parseDescription(),n=this.parseName();this.expectToken(_e.COLON);const i=this.parseTypeReference();let s;this.expectOptionalToken(_e.EQUALS)&&(s=this.parseConstValueLiteral());const a=this.parseConstDirectives();return this.node(e,{kind:Xe.INPUT_VALUE_DEFINITION,description:r,name:n,type:i,defaultValue:s,directives:a})}parseInterfaceTypeDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(e,{kind:Xe.INTERFACE_TYPE_DEFINITION,description:r,name:n,interfaces:i,directives:s,fields:a})}parseUnionTypeDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),i=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(e,{kind:Xe.UNION_TYPE_DEFINITION,description:r,name:n,directives:i,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(_e.EQUALS)?this.delimitedMany(_e.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),i=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(e,{kind:Xe.ENUM_TYPE_DEFINITION,description:r,name:n,directives:i,values:s})}parseEnumValuesDefinition(){return this.optionalMany(_e.BRACE_L,this.parseEnumValueDefinition,_e.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,r=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(e,{kind:Xe.ENUM_VALUE_DEFINITION,description:r,name:n,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw Or(this._lexer.source,this._lexer.token.start,`${y1(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),i=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(e,{kind:Xe.INPUT_OBJECT_TYPE_DEFINITION,description:r,name:n,directives:i,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(_e.BRACE_L,this.parseInputValueDef,_e.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===_e.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const r=this.parseConstDirectives(),n=this.optionalMany(_e.BRACE_L,this.parseOperationTypeDefinition,_e.BRACE_R);if(r.length===0&&n.length===0)throw this.unexpected();return this.node(e,{kind:Xe.SCHEMA_EXTENSION,directives:r,operationTypes:n})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const r=this.parseName(),n=this.parseConstDirectives();if(n.length===0)throw this.unexpected();return this.node(e,{kind:Xe.SCALAR_TYPE_EXTENSION,name:r,directives:n})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const r=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(n.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(e,{kind:Xe.OBJECT_TYPE_EXTENSION,name:r,interfaces:n,directives:i,fields:s})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const r=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(n.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(e,{kind:Xe.INTERFACE_TYPE_EXTENSION,name:r,interfaces:n,directives:i,fields:s})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const r=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:Xe.UNION_TYPE_EXTENSION,name:r,directives:n,types:i})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const r=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:Xe.ENUM_TYPE_EXTENSION,name:r,directives:n,values:i})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const r=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:Xe.INPUT_OBJECT_TYPE_EXTENSION,name:r,directives:n,fields:i})}parseDirectiveDefinition(){const e=this._lexer.token,r=this.parseDescription();this.expectKeyword("directive"),this.expectToken(_e.AT);const n=this.parseName(),i=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const a=this.parseDirectiveLocations();return this.node(e,{kind:Xe.DIRECTIVE_DEFINITION,description:r,name:n,arguments:i,repeatable:s,locations:a})}parseDirectiveLocations(){return this.delimitedMany(_e.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,r=this.parseName();if(Object.prototype.hasOwnProperty.call(Wb,r.value))return r;throw this.unexpected(e)}node(e,r){return this._options.noLocation!==!0&&(r.loc=new ER(e,this._lexer.lastToken,this._lexer.source)),r}peek(e){return this._lexer.token.kind===e}expectToken(e){const r=this._lexer.token;if(r.kind===e)return this.advanceLexer(),r;throw Or(this._lexer.source,r.start,`Expected ${A_(e)}, found ${y1(r)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e?(this.advanceLexer(),!0):!1}expectKeyword(e){const r=this._lexer.token;if(r.kind===_e.NAME&&r.value===e)this.advanceLexer();else throw Or(this._lexer.source,r.start,`Expected "${e}", found ${y1(r)}.`)}expectOptionalKeyword(e){const r=this._lexer.token;return r.kind===_e.NAME&&r.value===e?(this.advanceLexer(),!0):!1}unexpected(e){const r=e??this._lexer.token;return Or(this._lexer.source,r.start,`Unexpected ${y1(r)}.`)}any(e,r,n){this.expectToken(e);const i=[];for(;!this.expectOptionalToken(n);)i.push(r.call(this));return i}optionalMany(e,r,n){if(this.expectOptionalToken(e)){const i=[];do i.push(r.call(this));while(!this.expectOptionalToken(n));return i}return[]}many(e,r,n){this.expectToken(e);const i=[];do i.push(r.call(this));while(!this.expectOptionalToken(n));return i}delimitedMany(e,r){this.expectOptionalToken(e);const n=[];do n.push(r.call(this));while(this.expectOptionalToken(e));return n}advanceLexer(){const{maxTokens:e}=this._options,r=this._lexer.advance();if(e!==void 0&&r.kind!==_e.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw Or(this._lexer.source,r.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function y1(t){const e=t.value;return A_(t.kind)+(e!=null?` "${e}"`:"")}function A_(t){return IR(t)?`"${t}"`:t}function ZR(t){return`"${t.replace(JR,XR)}"`}const JR=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function XR(t){return QR[t.charCodeAt(0)]}const QR=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],YR=Object.freeze({});function eM(t,e,r=m_){const n=new Map;for(const x of Object.values(Xe))n.set(x,tM(e,x));let i,s=Array.isArray(t),a=[t],o=-1,c=[],u=t,l,h;const f=[],p=[];do{o++;const x=o===a.length,b=x&&c.length!==0;if(x){if(l=p.length===0?void 0:f[f.length-1],u=h,h=p.pop(),b)if(s){u=u.slice();let k=0;for(const[T,_]of c){const B=T-k;_===null?(u.splice(B,1),k++):u[B]=_}}else{u=Object.defineProperties({},Object.getOwnPropertyDescriptors(u));for(const[k,T]of c)u[k]=T}o=i.index,a=i.keys,c=i.edits,s=i.inArray,i=i.prev}else if(h){if(l=s?o:a[o],u=h[l],u==null)continue;f.push(l)}let S;if(!Array.isArray(u)){var d,g;DE(u)||Q1(!1,`Invalid AST Node: ${S3(u)}.`);const k=x?(d=n.get(u.kind))===null||d===void 0?void 0:d.leave:(g=n.get(u.kind))===null||g===void 0?void 0:g.enter;if(S=k==null?void 0:k.call(e,u,l,h,f,p),S===YR)break;if(S===!1){if(!x){f.pop();continue}}else if(S!==void 0&&(c.push([l,S]),!x))if(DE(S))u=S;else{f.pop();continue}}if(S===void 0&&b&&c.push([l,u]),x)f.pop();else{var y;i={inArray:s,index:o,keys:a,edits:c,prev:i},s=Array.isArray(u),a=s?u:(y=r[u.kind])!==null&&y!==void 0?y:[],o=-1,c=[],h&&p.push(h),h=u}}while(i!==void 0);return c.length!==0?c[c.length-1][1]:t}function tM(t,e){const r=t[e];return typeof r=="object"?r:typeof r=="function"?{enter:r,leave:void 0}:{enter:t.enter,leave:t.leave}}function rM(t){return eM(t,iM)}const nM=80,iM={Name:{leave:t=>t.value},Variable:{leave:t=>"$"+t.name},Document:{leave:t=>Ve(t.definitions,` - -`)},OperationDefinition:{leave(t){const e=ot("(",Ve(t.variableDefinitions,", "),")"),r=Ve([t.operation,Ve([t.name,e]),Ve(t.directives," ")]," ");return(r==="query"?"":r+" ")+t.selectionSet}},VariableDefinition:{leave:({variable:t,type:e,defaultValue:r,directives:n})=>t+": "+e+ot(" = ",r)+ot(" ",Ve(n," "))},SelectionSet:{leave:({selections:t})=>Yi(t)},Field:{leave({alias:t,name:e,arguments:r,directives:n,selectionSet:i}){const s=ot("",t,": ")+e;let a=s+ot("(",Ve(r,", "),")");return a.length>nM&&(a=s+ot(`( -`,Y1(Ve(r,` -`)),` -)`)),Ve([a,Ve(n," "),i]," ")}},Argument:{leave:({name:t,value:e})=>t+": "+e},FragmentSpread:{leave:({name:t,directives:e})=>"..."+t+ot(" ",Ve(e," "))},InlineFragment:{leave:({typeCondition:t,directives:e,selectionSet:r})=>Ve(["...",ot("on ",t),Ve(e," "),r]," ")},FragmentDefinition:{leave:({name:t,typeCondition:e,variableDefinitions:r,directives:n,selectionSet:i})=>`fragment ${t}${ot("(",Ve(r,", "),")")} on ${e} ${ot("",Ve(n," ")," ")}`+i},IntValue:{leave:({value:t})=>t},FloatValue:{leave:({value:t})=>t},StringValue:{leave:({value:t,block:e})=>e?kR(t):ZR(t)},BooleanValue:{leave:({value:t})=>t?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:t})=>t},ListValue:{leave:({values:t})=>"["+Ve(t,", ")+"]"},ObjectValue:{leave:({fields:t})=>"{"+Ve(t,", ")+"}"},ObjectField:{leave:({name:t,value:e})=>t+": "+e},Directive:{leave:({name:t,arguments:e})=>"@"+t+ot("(",Ve(e,", "),")")},NamedType:{leave:({name:t})=>t},ListType:{leave:({type:t})=>"["+t+"]"},NonNullType:{leave:({type:t})=>t+"!"},SchemaDefinition:{leave:({description:t,directives:e,operationTypes:r})=>ot("",t,` -`)+Ve(["schema",Ve(e," "),Yi(r)]," ")},OperationTypeDefinition:{leave:({operation:t,type:e})=>t+": "+e},ScalarTypeDefinition:{leave:({description:t,name:e,directives:r})=>ot("",t,` -`)+Ve(["scalar",e,Ve(r," ")]," ")},ObjectTypeDefinition:{leave:({description:t,name:e,interfaces:r,directives:n,fields:i})=>ot("",t,` -`)+Ve(["type",e,ot("implements ",Ve(r," & ")),Ve(n," "),Yi(i)]," ")},FieldDefinition:{leave:({description:t,name:e,arguments:r,type:n,directives:i})=>ot("",t,` -`)+e+(ME(r)?ot(`( -`,Y1(Ve(r,` -`)),` -)`):ot("(",Ve(r,", "),")"))+": "+n+ot(" ",Ve(i," "))},InputValueDefinition:{leave:({description:t,name:e,type:r,defaultValue:n,directives:i})=>ot("",t,` -`)+Ve([e+": "+r,ot("= ",n),Ve(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:t,name:e,interfaces:r,directives:n,fields:i})=>ot("",t,` -`)+Ve(["interface",e,ot("implements ",Ve(r," & ")),Ve(n," "),Yi(i)]," ")},UnionTypeDefinition:{leave:({description:t,name:e,directives:r,types:n})=>ot("",t,` -`)+Ve(["union",e,Ve(r," "),ot("= ",Ve(n," | "))]," ")},EnumTypeDefinition:{leave:({description:t,name:e,directives:r,values:n})=>ot("",t,` -`)+Ve(["enum",e,Ve(r," "),Yi(n)]," ")},EnumValueDefinition:{leave:({description:t,name:e,directives:r})=>ot("",t,` -`)+Ve([e,Ve(r," ")]," ")},InputObjectTypeDefinition:{leave:({description:t,name:e,directives:r,fields:n})=>ot("",t,` -`)+Ve(["input",e,Ve(r," "),Yi(n)]," ")},DirectiveDefinition:{leave:({description:t,name:e,arguments:r,repeatable:n,locations:i})=>ot("",t,` -`)+"directive @"+e+(ME(r)?ot(`( -`,Y1(Ve(r,` -`)),` -)`):ot("(",Ve(r,", "),")"))+(n?" repeatable":"")+" on "+Ve(i," | ")},SchemaExtension:{leave:({directives:t,operationTypes:e})=>Ve(["extend schema",Ve(t," "),Yi(e)]," ")},ScalarTypeExtension:{leave:({name:t,directives:e})=>Ve(["extend scalar",t,Ve(e," ")]," ")},ObjectTypeExtension:{leave:({name:t,interfaces:e,directives:r,fields:n})=>Ve(["extend type",t,ot("implements ",Ve(e," & ")),Ve(r," "),Yi(n)]," ")},InterfaceTypeExtension:{leave:({name:t,interfaces:e,directives:r,fields:n})=>Ve(["extend interface",t,ot("implements ",Ve(e," & ")),Ve(r," "),Yi(n)]," ")},UnionTypeExtension:{leave:({name:t,directives:e,types:r})=>Ve(["extend union",t,Ve(e," "),ot("= ",Ve(r," | "))]," ")},EnumTypeExtension:{leave:({name:t,directives:e,values:r})=>Ve(["extend enum",t,Ve(e," "),Yi(r)]," ")},InputObjectTypeExtension:{leave:({name:t,directives:e,fields:r})=>Ve(["extend input",t,Ve(e," "),Yi(r)]," ")}};function Ve(t,e=""){var r;return(r=t==null?void 0:t.filter(n=>n).join(e))!==null&&r!==void 0?r:""}function Yi(t){return ot(`{ -`,Y1(Ve(t,` -`)),` -}`)}function ot(t,e,r=""){return e!=null&&e!==""?t+e+r:""}function Y1(t){return ot(" ",t.replace(/\n/g,` - `))}function ME(t){var e;return(e=t==null?void 0:t.some(r=>r.includes(` -`)))!==null&&e!==void 0?e:!1}const LE=t=>{var n,i;let e;const r=t.definitions.filter(s=>s.kind==="OperationDefinition");return r.length===1&&(e=(i=(n=r[0])==null?void 0:n.name)==null?void 0:i.value),e},d2=t=>{if(typeof t=="string"){let r;try{const n=WR(t);r=LE(n)}catch{}return{query:t,operationName:r}}const e=LE(t);return{query:rM(t),operationName:e}};class td extends Error{constructor(e,r){const n=`${td.extractMessage(e)}: ${JSON.stringify({response:e,request:r})}`;super(n),Object.setPrototypeOf(this,td.prototype),this.response=e,this.request=r,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,td)}static extractMessage(e){var r,n;return((n=(r=e.errors)==null?void 0:r[0])==null?void 0:n.message)??`GraphQL Error (Code: ${e.status})`}}var Zb={exports:{}};(function(t,e){var r=typeof self<"u"?self:We,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(a){var o={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function c(A){return A&&DataView.prototype.isPrototypeOf(A)}if(o.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(A){return A&&u.indexOf(Object.prototype.toString.call(A))>-1};function h(A){if(typeof A!="string"&&(A=String(A)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(A))throw new TypeError("Invalid character in header field name");return A.toLowerCase()}function f(A){return typeof A!="string"&&(A=String(A)),A}function p(A){var I={next:function(){var j=A.shift();return{done:j===void 0,value:j}}};return o.iterable&&(I[Symbol.iterator]=function(){return I}),I}function d(A){this.map={},A instanceof d?A.forEach(function(I,j){this.append(j,I)},this):Array.isArray(A)?A.forEach(function(I){this.append(I[0],I[1])},this):A&&Object.getOwnPropertyNames(A).forEach(function(I){this.append(I,A[I])},this)}d.prototype.append=function(A,I){A=h(A),I=f(I);var j=this.map[A];this.map[A]=j?j+", "+I:I},d.prototype.delete=function(A){delete this.map[h(A)]},d.prototype.get=function(A){return A=h(A),this.has(A)?this.map[A]:null},d.prototype.has=function(A){return this.map.hasOwnProperty(h(A))},d.prototype.set=function(A,I){this.map[h(A)]=f(I)},d.prototype.forEach=function(A,I){for(var j in this.map)this.map.hasOwnProperty(j)&&A.call(I,this.map[j],j,this)},d.prototype.keys=function(){var A=[];return this.forEach(function(I,j){A.push(j)}),p(A)},d.prototype.values=function(){var A=[];return this.forEach(function(I){A.push(I)}),p(A)},d.prototype.entries=function(){var A=[];return this.forEach(function(I,j){A.push([j,I])}),p(A)},o.iterable&&(d.prototype[Symbol.iterator]=d.prototype.entries);function g(A){if(A.bodyUsed)return Promise.reject(new TypeError("Already read"));A.bodyUsed=!0}function y(A){return new Promise(function(I,j){A.onload=function(){I(A.result)},A.onerror=function(){j(A.error)}})}function x(A){var I=new FileReader,j=y(I);return I.readAsArrayBuffer(A),j}function b(A){var I=new FileReader,j=y(I);return I.readAsText(A),j}function S(A){for(var I=new Uint8Array(A),j=new Array(I.length),H=0;H-1?I:A}function N(A,I){I=I||{};var j=I.body;if(A instanceof N){if(A.bodyUsed)throw new TypeError("Already read");this.url=A.url,this.credentials=A.credentials,I.headers||(this.headers=new d(A.headers)),this.method=A.method,this.mode=A.mode,this.signal=A.signal,!j&&A._bodyInit!=null&&(j=A._bodyInit,A.bodyUsed=!0)}else this.url=String(A);if(this.credentials=I.credentials||this.credentials||"same-origin",(I.headers||!this.headers)&&(this.headers=new d(I.headers)),this.method=B(I.method||this.method||"GET"),this.mode=I.mode||this.mode||null,this.signal=I.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&j)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(j)}N.prototype.clone=function(){return new N(this,{body:this._bodyInit})};function P(A){var I=new FormData;return A.trim().split("&").forEach(function(j){if(j){var H=j.split("="),G=H.shift().replace(/\+/g," "),z=H.join("=").replace(/\+/g," ");I.append(decodeURIComponent(G),decodeURIComponent(z))}}),I}function D(A){var I=new d,j=A.replace(/\r?\n[\t ]+/g," ");return j.split(/\r?\n/).forEach(function(H){var G=H.split(":"),z=G.shift().trim();if(z){var R=G.join(":").trim();I.append(z,R)}}),I}T.call(N.prototype);function O(A,I){I||(I={}),this.type="default",this.status=I.status===void 0?200:I.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in I?I.statusText:"OK",this.headers=new d(I.headers),this.url=I.url||"",this._initBody(A)}T.call(O.prototype),O.prototype.clone=function(){return new O(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},O.error=function(){var A=new O(null,{status:0,statusText:""});return A.type="error",A};var E=[301,302,303,307,308];O.redirect=function(A,I){if(E.indexOf(I)===-1)throw new RangeError("Invalid status code");return new O(null,{status:I,headers:{location:A}})},a.DOMException=s.DOMException;try{new a.DOMException}catch{a.DOMException=function(I,j){this.message=I,this.name=j;var H=Error(I);this.stack=H.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function F(A,I){return new Promise(function(j,H){var G=new N(A,I);if(G.signal&&G.signal.aborted)return H(new a.DOMException("Aborted","AbortError"));var z=new XMLHttpRequest;function R(){z.abort()}z.onload=function(){var L={status:z.status,statusText:z.statusText,headers:D(z.getAllResponseHeaders()||"")};L.url="responseURL"in z?z.responseURL:L.headers.get("X-Request-URL");var q="response"in z?z.response:z.responseText;j(new O(q,L))},z.onerror=function(){H(new TypeError("Network request failed"))},z.ontimeout=function(){H(new TypeError("Network request failed"))},z.onabort=function(){H(new a.DOMException("Aborted","AbortError"))},z.open(G.method,G.url,!0),G.credentials==="include"?z.withCredentials=!0:G.credentials==="omit"&&(z.withCredentials=!1),"responseType"in z&&o.blob&&(z.responseType="blob"),G.headers.forEach(function(L,q){z.setRequestHeader(q,L)}),G.signal&&(G.signal.addEventListener("abort",R),z.onreadystatechange=function(){z.readyState===4&&G.signal.removeEventListener("abort",R)}),z.send(typeof G._bodyInit>"u"?null:G._bodyInit)})}return F.polyfill=!0,s.fetch||(s.fetch=F,s.Headers=d,s.Request=N,s.Response=O),a.Headers=d,a.Request=N,a.Response=O,a.fetch=F,Object.defineProperty(a,"__esModule",{value:!0}),a})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(Zb,Zb.exports);var em=Zb.exports;const eg=el(em),sM=z9({__proto__:null,default:eg},[em]),ml=t=>{let e={};return t&&(typeof Headers<"u"&&t instanceof Headers||sM&&em.Headers&&t instanceof em.Headers?e=dR(t):Array.isArray(t)?t.forEach(([r,n])=>{r&&n!==void 0&&(e[r]=n)}):e=t),e},jE=t=>t.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),aM=t=>{if(!Array.isArray(t.query)){const n=t,i=[`query=${encodeURIComponent(jE(n.query))}`];return t.variables&&i.push(`variables=${encodeURIComponent(n.jsonSerializer.stringify(n.variables))}`),n.operationName&&i.push(`operationName=${encodeURIComponent(n.operationName)}`),i.join("&")}if(typeof t.variables<"u"&&!Array.isArray(t.variables))throw new Error("Cannot create query with given variable type, array expected");const e=t,r=t.query.reduce((n,i,s)=>(n.push({query:jE(i),variables:e.variables?e.jsonSerializer.stringify(e.variables[s]):void 0}),n),[]);return`query=${encodeURIComponent(e.jsonSerializer.stringify(r))}`},oM=t=>async e=>{const{url:r,query:n,variables:i,operationName:s,fetch:a,fetchOptions:o,middleware:c}=e,u={...e.headers};let l="",h;t==="POST"?(h=uM(n,i,s,o.jsonSerializer),typeof h=="string"&&(u["Content-Type"]="application/json")):l=aM({query:n,variables:i,operationName:s,jsonSerializer:o.jsonSerializer??E3});const f={method:t,headers:u,body:h,...o};let p=r,d=f;if(c){const g=await Promise.resolve(c({...f,url:r,operationName:s,variables:i})),{url:y,...x}=g;p=y,d=x}return l&&(p=`${p}?${l}`),await a(p,d)};class cM{constructor(e,r={}){this.url=e,this.requestConfig=r,this.rawRequest=async(...n)=>{const[i,s,a]=n,o=gR(i,s,a),{headers:c,fetch:u=eg,method:l="POST",requestMiddleware:h,responseMiddleware:f,...p}=this.requestConfig,{url:d}=this;o.signal!==void 0&&(p.signal=o.signal);const{operationName:g}=d2(o.query);return p2({url:d,query:o.query,variables:o.variables,headers:{...ml(g2(c)),...ml(o.requestHeaders)},operationName:g,fetch:u,method:l,fetchOptions:p,middleware:h}).then(y=>(f&&f(y),y)).catch(y=>{throw f&&f(y),y})}}async request(e,...r){const[n,i]=r,s=pR(e,n,i),{headers:a,fetch:o=eg,method:c="POST",requestMiddleware:u,responseMiddleware:l,...h}=this.requestConfig,{url:f}=this;s.signal!==void 0&&(h.signal=s.signal);const{query:p,operationName:d}=d2(s.document);return p2({url:f,query:p,variables:s.variables,headers:{...ml(g2(a)),...ml(s.requestHeaders)},operationName:d,fetch:o,method:c,fetchOptions:h,middleware:u}).then(g=>(l&&l(g),g.data)).catch(g=>{throw l&&l(g),g})}batchRequests(e,r){const n=mR(e,r),{headers:i,...s}=this.requestConfig;n.signal!==void 0&&(s.signal=n.signal);const a=n.documents.map(({document:c})=>d2(c).query),o=n.documents.map(({variables:c})=>c);return p2({url:this.url,query:a,variables:o,headers:{...ml(g2(i)),...ml(n.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??eg,method:this.requestConfig.method||"POST",fetchOptions:s,middleware:this.requestConfig.requestMiddleware}).then(c=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(c),c.data)).catch(c=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(c),c})}setHeaders(e){return this.requestConfig.headers=e,this}setHeader(e,r){const{headers:n}=this.requestConfig;return n?n[e]=r:this.requestConfig.headers={[e]:r},this}setEndpoint(e){return this.url=e,this}}const p2=async t=>{const{query:e,variables:r,fetchOptions:n}=t,i=oM(hR(t.method??"post")),s=Array.isArray(t.query),a=await i(t),o=await lM(a,n.jsonSerializer??E3),c=Array.isArray(o)?!o.some(({data:l})=>!l):!!o.data,u=Array.isArray(o)||!o.errors||Array.isArray(o.errors)&&!o.errors.length||n.errorPolicy==="all"||n.errorPolicy==="ignore";if(a.ok&&u&&c){const{errors:l,...h}=(Array.isArray(o),o),f=n.errorPolicy==="ignore"?h:o;return{...s?{data:f}:f,headers:a.headers,status:a.status}}else{const l=typeof o=="string"?{error:o}:o;throw new td({...l,status:a.status,headers:a.headers},{query:e,variables:r})}},uM=(t,e,r,n)=>{const i=n??E3;if(!Array.isArray(t))return i.stringify({query:t,variables:e,operationName:r});if(typeof e<"u"&&!Array.isArray(e))throw new Error("Cannot create request body with given variable type, array expected");const s=t.reduce((a,o,c)=>(a.push({query:o,variables:e?e[c]:void 0}),a),[]);return i.stringify(s)},lM=async(t,e)=>{let r;return t.headers.forEach((n,i)=>{i.toLowerCase()==="content-type"&&(r=n)}),r&&(r.toLowerCase().startsWith("application/json")||r.toLowerCase().startsWith("application/graphql+json")||r.toLowerCase().startsWith("application/graphql-response+json"))?e.parse(await t.text()):t.text()},g2=t=>typeof t=="function"?t():t,fM=(t,...e)=>t.reduce((r,n,i)=>`${r}${n}${i in e?String(e[i]):""}`,"");var hM={},dM=Object.create,C3=Object.defineProperty,pM=Object.getOwnPropertyDescriptor,gM=Object.getOwnPropertyNames,mM=Object.getPrototypeOf,vM=Object.prototype.hasOwnProperty,Jh=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),yM=(t,e)=>{for(var r in e)C3(t,r,{get:e[r],enumerable:!0})},xM=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of gM(e))!vM.call(t,i)&&i!==r&&C3(t,i,{get:()=>e[i],enumerable:!(n=pM(e,i))||n.enumerable});return t},S_=(t,e,r)=>(r=t!=null?dM(mM(t)):{},xM(e||!t||!t.__esModule?C3(r,"default",{value:t,enumerable:!0}):r,t)),bM=Jh((t,e)=>{var r=1e3,n=r*60,i=n*60,s=i*24,a=s*7,o=s*365.25;e.exports=function(f,p){p=p||{};var d=typeof f;if(d==="string"&&f.length>0)return c(f);if(d==="number"&&isFinite(f))return p.long?l(f):u(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))};function c(f){if(f=String(f),!(f.length>100)){var p=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(f);if(p){var d=parseFloat(p[1]),g=(p[2]||"ms").toLowerCase();switch(g){case"years":case"year":case"yrs":case"yr":case"y":return d*o;case"weeks":case"week":case"w":return d*a;case"days":case"day":case"d":return d*s;case"hours":case"hour":case"hrs":case"hr":case"h":return d*i;case"minutes":case"minute":case"mins":case"min":case"m":return d*n;case"seconds":case"second":case"secs":case"sec":case"s":return d*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return d;default:return}}}}function u(f){var p=Math.abs(f);return p>=s?Math.round(f/s)+"d":p>=i?Math.round(f/i)+"h":p>=n?Math.round(f/n)+"m":p>=r?Math.round(f/r)+"s":f+"ms"}function l(f){var p=Math.abs(f);return p>=s?h(f,p,s,"day"):p>=i?h(f,p,i,"hour"):p>=n?h(f,p,n,"minute"):p>=r?h(f,p,r,"second"):f+" ms"}function h(f,p,d,g){var y=p>=d*1.5;return Math.round(f/d)+" "+g+(y?"s":"")}}),wM=Jh((t,e)=>{function r(n){s.debug=s,s.default=s,s.coerce=h,s.disable=c,s.enable=o,s.enabled=u,s.humanize=bM(),s.destroy=f,Object.keys(n).forEach(p=>{s[p]=n[p]}),s.names=[],s.skips=[],s.formatters={};function i(p){let d=0;for(let g=0;g{if(N==="%%")return"%";B++;let D=s.formatters[P];if(typeof D=="function"){let O=S[B];N=D.call(k,O),S.splice(B,1),B--}return N}),s.formatArgs.call(k,S),(k.log||s.log).apply(k,S)}return b.namespace=p,b.useColors=s.useColors(),b.color=s.selectColor(p),b.extend=a,b.destroy=s.destroy,Object.defineProperty(b,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(y!==s.namespaces&&(y=s.namespaces,x=s.enabled(p)),x),set:S=>{g=S}}),typeof s.init=="function"&&s.init(b),b}function a(p,d){let g=s(this.namespace+(typeof d>"u"?":":d)+p);return g.log=this.log,g}function o(p){s.save(p),s.namespaces=p,s.names=[],s.skips=[];let d,g=(typeof p=="string"?p:"").split(/[\s,]+/),y=g.length;for(d=0;d"-"+d)].join(",");return s.enable(""),p}function u(p){if(p[p.length-1]==="*")return!0;let d,g;for(d=0,g=s.skips.length;d{t.formatArgs=n,t.save=i,t.load=s,t.useColors=r,t.storage=a(),t.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;let u="color: "+this.color;c.splice(1,0,u,"color: inherit");let l=0,h=0;c[0].replace(/%[a-zA-Z%]/g,f=>{f!=="%%"&&(l++,f==="%c"&&(h=l))}),c.splice(h,0,u)}t.log=console.debug||console.log||(()=>{});function i(c){try{c?t.storage.setItem("debug",c):t.storage.removeItem("debug")}catch{}}function s(){let c;try{c=t.storage.getItem("debug")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=hM.DEBUG),c}function a(){try{return localStorage}catch{}}e.exports=wM()(t);var{formatters:o}=e.exports;o.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}),AM=Jh(t=>{t.byteLength=c,t.toByteArray=l,t.fromByteArray=p;var e=[],r=[],n=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(s=0,a=i.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var y=d.indexOf("=");y===-1&&(y=g);var x=y===g?0:4-y%4;return[y,x]}function c(d){var g=o(d),y=g[0],x=g[1];return(y+x)*3/4-x}function u(d,g,y){return(g+y)*3/4-y}function l(d){var g,y=o(d),x=y[0],b=y[1],S=new n(u(d,x,b)),k=0,T=b>0?x-4:x,_;for(_=0;_>16&255,S[k++]=g>>8&255,S[k++]=g&255;return b===2&&(g=r[d.charCodeAt(_)]<<2|r[d.charCodeAt(_+1)]>>4,S[k++]=g&255),b===1&&(g=r[d.charCodeAt(_)]<<10|r[d.charCodeAt(_+1)]<<4|r[d.charCodeAt(_+2)]>>2,S[k++]=g>>8&255,S[k++]=g&255),S}function h(d){return e[d>>18&63]+e[d>>12&63]+e[d>>6&63]+e[d&63]}function f(d,g,y){for(var x,b=[],S=g;ST?T:k+S));return x===1?(g=d[y-1],b.push(e[g>>2]+e[g<<4&63]+"==")):x===2&&(g=(d[y-2]<<8)+d[y-1],b.push(e[g>>10]+e[g>>4&63]+e[g<<2&63]+"=")),b.join("")}}),SM=Jh(t=>{t.read=function(e,r,n,i,s){var a,o,c=s*8-i-1,u=(1<>1,h=-7,f=n?s-1:0,p=n?-1:1,d=e[r+f];for(f+=p,a=d&(1<<-h)-1,d>>=-h,h+=c;h>0;a=a*256+e[r+f],f+=p,h-=8);for(o=a&(1<<-h)-1,a>>=-h,h+=i;h>0;o=o*256+e[r+f],f+=p,h-=8);if(a===0)a=1-l;else{if(a===u)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,i),a=a-l}return(d?-1:1)*o*Math.pow(2,a-i)},t.write=function(e,r,n,i,s,a){var o,c,u,l=a*8-s-1,h=(1<>1,p=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:a-1,g=i?1:-1,y=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,o=h):(o=Math.floor(Math.log(r)/Math.LN2),r*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+f>=1?r+=p/u:r+=p*Math.pow(2,1-f),r*u>=2&&(o++,u/=2),o+f>=h?(c=0,o=h):o+f>=1?(c=(r*u-1)*Math.pow(2,s),o=o+f):(c=r*Math.pow(2,f-1)*Math.pow(2,s),o=0));s>=8;e[n+d]=c&255,d+=g,c/=256,s-=8);for(o=o<0;e[n+d]=o&255,d+=g,o/=256,l-=8);e[n+d-g]|=y*128}}),CM=Jh(t=>{var e=AM(),r=SM(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=o,t.SlowBuffer=b,t.INSPECT_MAX_BYTES=50;var i=2147483647;t.kMaxLength=i,o.TYPED_ARRAY_SUPPORT=s(),!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 s(){try{let m=new Uint8Array(1),v={foo:function(){return 42}};return Object.setPrototypeOf(v,Uint8Array.prototype),Object.setPrototypeOf(m,v),m.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 a(m){if(m>i)throw new RangeError('The value "'+m+'" is invalid for option "size"');let v=new Uint8Array(m);return Object.setPrototypeOf(v,o.prototype),v}function o(m,v,w){if(typeof m=="number"){if(typeof v=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return h(m)}return c(m,v,w)}o.poolSize=8192;function c(m,v,w){if(typeof m=="string")return f(m,v);if(ArrayBuffer.isView(m))return d(m);if(m==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m);if(re(m,ArrayBuffer)||m&&re(m.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(re(m,SharedArrayBuffer)||m&&re(m.buffer,SharedArrayBuffer)))return g(m,v,w);if(typeof m=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let M=m.valueOf&&m.valueOf();if(M!=null&&M!==m)return o.from(M,v,w);let $=y(m);if($)return $;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof m[Symbol.toPrimitive]=="function")return o.from(m[Symbol.toPrimitive]("string"),v,w);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m)}o.from=function(m,v,w){return c(m,v,w)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function u(m){if(typeof m!="number")throw new TypeError('"size" argument must be of type number');if(m<0)throw new RangeError('The value "'+m+'" is invalid for option "size"')}function l(m,v,w){return u(m),m<=0?a(m):v!==void 0?typeof w=="string"?a(m).fill(v,w):a(m).fill(v):a(m)}o.alloc=function(m,v,w){return l(m,v,w)};function h(m){return u(m),a(m<0?0:x(m)|0)}o.allocUnsafe=function(m){return h(m)},o.allocUnsafeSlow=function(m){return h(m)};function f(m,v){if((typeof v!="string"||v==="")&&(v="utf8"),!o.isEncoding(v))throw new TypeError("Unknown encoding: "+v);let w=S(m,v)|0,M=a(w),$=M.write(m,v);return $!==w&&(M=M.slice(0,$)),M}function p(m){let v=m.length<0?0:x(m.length)|0,w=a(v);for(let M=0;M=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return m|0}function b(m){return+m!=m&&(m=0),o.alloc(+m)}o.isBuffer=function(m){return m!=null&&m._isBuffer===!0&&m!==o.prototype},o.compare=function(m,v){if(re(m,Uint8Array)&&(m=o.from(m,m.offset,m.byteLength)),re(v,Uint8Array)&&(v=o.from(v,v.offset,v.byteLength)),!o.isBuffer(m)||!o.isBuffer(v))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(m===v)return 0;let w=m.length,M=v.length;for(let $=0,W=Math.min(w,M);$M.length?(o.isBuffer(W)||(W=o.from(W)),W.copy(M,$)):Uint8Array.prototype.set.call(M,W,$);else if(o.isBuffer(W))W.copy(M,$);else throw new TypeError('"list" argument must be an Array of Buffers');$+=W.length}return M};function S(m,v){if(o.isBuffer(m))return m.length;if(ArrayBuffer.isView(m)||re(m,ArrayBuffer))return m.byteLength;if(typeof m!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof m);let w=m.length,M=arguments.length>2&&arguments[2]===!0;if(!M&&w===0)return 0;let $=!1;for(;;)switch(v){case"ascii":case"latin1":case"binary":return w;case"utf8":case"utf-8":return Y(m).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w*2;case"hex":return w>>>1;case"base64":return ge(m).length;default:if($)return M?-1:Y(m).length;v=(""+v).toLowerCase(),$=!0}}o.byteLength=S;function k(m,v,w){let M=!1;if((v===void 0||v<0)&&(v=0),v>this.length||((w===void 0||w>this.length)&&(w=this.length),w<=0)||(w>>>=0,v>>>=0,w<=v))return"";for(m||(m="utf8");;)switch(m){case"hex":return z(this,v,w);case"utf8":case"utf-8":return A(this,v,w);case"ascii":return H(this,v,w);case"latin1":case"binary":return G(this,v,w);case"base64":return F(this,v,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,v,w);default:if(M)throw new TypeError("Unknown encoding: "+m);m=(m+"").toLowerCase(),M=!0}}o.prototype._isBuffer=!0;function T(m,v,w){let M=m[v];m[v]=m[w],m[w]=M}o.prototype.swap16=function(){let m=this.length;if(m%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let v=0;vv&&(m+=" ... "),""},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(m,v,w,M,$){if(re(m,Uint8Array)&&(m=o.from(m,m.offset,m.byteLength)),!o.isBuffer(m))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof m);if(v===void 0&&(v=0),w===void 0&&(w=m?m.length:0),M===void 0&&(M=0),$===void 0&&($=this.length),v<0||w>m.length||M<0||$>this.length)throw new RangeError("out of range index");if(M>=$&&v>=w)return 0;if(M>=$)return-1;if(v>=w)return 1;if(v>>>=0,w>>>=0,M>>>=0,$>>>=0,this===m)return 0;let W=$-M,Z=w-v,Ee=Math.min(W,Z),Ue=this.slice(M,$),ke=m.slice(v,w);for(let Ie=0;Ie2147483647?w=2147483647:w<-2147483648&&(w=-2147483648),w=+w,Ce(w)&&(w=$?0:m.length-1),w<0&&(w=m.length+w),w>=m.length){if($)return-1;w=m.length-1}else if(w<0)if($)w=0;else return-1;if(typeof v=="string"&&(v=o.from(v,M)),o.isBuffer(v))return v.length===0?-1:B(m,v,w,M,$);if(typeof v=="number")return v=v&255,typeof Uint8Array.prototype.indexOf=="function"?$?Uint8Array.prototype.indexOf.call(m,v,w):Uint8Array.prototype.lastIndexOf.call(m,v,w):B(m,[v],w,M,$);throw new TypeError("val must be string, number or Buffer")}function B(m,v,w,M,$){let W=1,Z=m.length,Ee=v.length;if(M!==void 0&&(M=String(M).toLowerCase(),M==="ucs2"||M==="ucs-2"||M==="utf16le"||M==="utf-16le")){if(m.length<2||v.length<2)return-1;W=2,Z/=2,Ee/=2,w/=2}function Ue(Ie,Le){return W===1?Ie[Le]:Ie.readUInt16BE(Le*W)}let ke;if($){let Ie=-1;for(ke=w;keZ&&(w=Z-Ee),ke=w;ke>=0;ke--){let Ie=!0;for(let Le=0;Le$&&(M=$)):M=$;let W=v.length;M>W/2&&(M=W/2);let Z;for(Z=0;Z>>0,isFinite(w)?(w=w>>>0,M===void 0&&(M="utf8")):(M=w,w=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let $=this.length-v;if((w===void 0||w>$)&&(w=$),m.length>0&&(w<0||v<0)||v>this.length)throw new RangeError("Attempt to write outside buffer bounds");M||(M="utf8");let W=!1;for(;;)switch(M){case"hex":return N(this,m,v,w);case"utf8":case"utf-8":return P(this,m,v,w);case"ascii":case"latin1":case"binary":return D(this,m,v,w);case"base64":return O(this,m,v,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,m,v,w);default:if(W)throw new TypeError("Unknown encoding: "+M);M=(""+M).toLowerCase(),W=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function F(m,v,w){return v===0&&w===m.length?e.fromByteArray(m):e.fromByteArray(m.slice(v,w))}function A(m,v,w){w=Math.min(m.length,w);let M=[],$=v;for(;$239?4:W>223?3:W>191?2:1;if($+Ee<=w){let Ue,ke,Ie,Le;switch(Ee){case 1:W<128&&(Z=W);break;case 2:Ue=m[$+1],(Ue&192)===128&&(Le=(W&31)<<6|Ue&63,Le>127&&(Z=Le));break;case 3:Ue=m[$+1],ke=m[$+2],(Ue&192)===128&&(ke&192)===128&&(Le=(W&15)<<12|(Ue&63)<<6|ke&63,Le>2047&&(Le<55296||Le>57343)&&(Z=Le));break;case 4:Ue=m[$+1],ke=m[$+2],Ie=m[$+3],(Ue&192)===128&&(ke&192)===128&&(Ie&192)===128&&(Le=(W&15)<<18|(Ue&63)<<12|(ke&63)<<6|Ie&63,Le>65535&&Le<1114112&&(Z=Le))}}Z===null?(Z=65533,Ee=1):Z>65535&&(Z-=65536,M.push(Z>>>10&1023|55296),Z=56320|Z&1023),M.push(Z),$+=Ee}return j(M)}var I=4096;function j(m){let v=m.length;if(v<=I)return String.fromCharCode.apply(String,m);let w="",M=0;for(;MM)&&(w=M);let $="";for(let W=v;Ww&&(m=w),v<0?(v+=w,v<0&&(v=0)):v>w&&(v=w),vw)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(m,v,w){m=m>>>0,v=v>>>0,w||L(m,v,this.length);let M=this[m],$=1,W=0;for(;++W>>0,v=v>>>0,w||L(m,v,this.length);let M=this[m+--v],$=1;for(;v>0&&($*=256);)M+=this[m+--v]*$;return M},o.prototype.readUint8=o.prototype.readUInt8=function(m,v){return m=m>>>0,v||L(m,1,this.length),this[m]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(m,v){return m=m>>>0,v||L(m,2,this.length),this[m]|this[m+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(m,v){return m=m>>>0,v||L(m,2,this.length),this[m]<<8|this[m+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(m,v){return m=m>>>0,v||L(m,4,this.length),(this[m]|this[m+1]<<8|this[m+2]<<16)+this[m+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(m,v){return m=m>>>0,v||L(m,4,this.length),this[m]*16777216+(this[m+1]<<16|this[m+2]<<8|this[m+3])},o.prototype.readBigUInt64LE=pe(function(m){m=m>>>0,Pe(m,"offset");let v=this[m],w=this[m+7];(v===void 0||w===void 0)&&V(m,this.length-8);let M=v+this[++m]*2**8+this[++m]*2**16+this[++m]*2**24,$=this[++m]+this[++m]*2**8+this[++m]*2**16+w*2**24;return BigInt(M)+(BigInt($)<>>0,Pe(m,"offset");let v=this[m],w=this[m+7];(v===void 0||w===void 0)&&V(m,this.length-8);let M=v*2**24+this[++m]*2**16+this[++m]*2**8+this[++m],$=this[++m]*2**24+this[++m]*2**16+this[++m]*2**8+w;return(BigInt(M)<>>0,v=v>>>0,w||L(m,v,this.length);let M=this[m],$=1,W=0;for(;++W=$&&(M-=Math.pow(2,8*v)),M},o.prototype.readIntBE=function(m,v,w){m=m>>>0,v=v>>>0,w||L(m,v,this.length);let M=v,$=1,W=this[m+--M];for(;M>0&&($*=256);)W+=this[m+--M]*$;return $*=128,W>=$&&(W-=Math.pow(2,8*v)),W},o.prototype.readInt8=function(m,v){return m=m>>>0,v||L(m,1,this.length),this[m]&128?(255-this[m]+1)*-1:this[m]},o.prototype.readInt16LE=function(m,v){m=m>>>0,v||L(m,2,this.length);let w=this[m]|this[m+1]<<8;return w&32768?w|4294901760:w},o.prototype.readInt16BE=function(m,v){m=m>>>0,v||L(m,2,this.length);let w=this[m+1]|this[m]<<8;return w&32768?w|4294901760:w},o.prototype.readInt32LE=function(m,v){return m=m>>>0,v||L(m,4,this.length),this[m]|this[m+1]<<8|this[m+2]<<16|this[m+3]<<24},o.prototype.readInt32BE=function(m,v){return m=m>>>0,v||L(m,4,this.length),this[m]<<24|this[m+1]<<16|this[m+2]<<8|this[m+3]},o.prototype.readBigInt64LE=pe(function(m){m=m>>>0,Pe(m,"offset");let v=this[m],w=this[m+7];(v===void 0||w===void 0)&&V(m,this.length-8);let M=this[m+4]+this[m+5]*2**8+this[m+6]*2**16+(w<<24);return(BigInt(M)<>>0,Pe(m,"offset");let v=this[m],w=this[m+7];(v===void 0||w===void 0)&&V(m,this.length-8);let M=(v<<24)+this[++m]*2**16+this[++m]*2**8+this[++m];return(BigInt(M)<>>0,v||L(m,4,this.length),r.read(this,m,!0,23,4)},o.prototype.readFloatBE=function(m,v){return m=m>>>0,v||L(m,4,this.length),r.read(this,m,!1,23,4)},o.prototype.readDoubleLE=function(m,v){return m=m>>>0,v||L(m,8,this.length),r.read(this,m,!0,52,8)},o.prototype.readDoubleBE=function(m,v){return m=m>>>0,v||L(m,8,this.length),r.read(this,m,!1,52,8)};function q(m,v,w,M,$,W){if(!o.isBuffer(m))throw new TypeError('"buffer" argument must be a Buffer instance');if(v>$||vm.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(m,v,w,M){if(m=+m,v=v>>>0,w=w>>>0,!M){let Z=Math.pow(2,8*w)-1;q(this,m,v,w,Z,0)}let $=1,W=0;for(this[v]=m&255;++W>>0,w=w>>>0,!M){let Z=Math.pow(2,8*w)-1;q(this,m,v,w,Z,0)}let $=w-1,W=1;for(this[v+$]=m&255;--$>=0&&(W*=256);)this[v+$]=m/W&255;return v+w},o.prototype.writeUint8=o.prototype.writeUInt8=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,1,255,0),this[v]=m&255,v+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,2,65535,0),this[v]=m&255,this[v+1]=m>>>8,v+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,2,65535,0),this[v]=m>>>8,this[v+1]=m&255,v+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,4,4294967295,0),this[v+3]=m>>>24,this[v+2]=m>>>16,this[v+1]=m>>>8,this[v]=m&255,v+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,4,4294967295,0),this[v]=m>>>24,this[v+1]=m>>>16,this[v+2]=m>>>8,this[v+3]=m&255,v+4};function ee(m,v,w,M,$){Be(v,M,$,m,w,7);let W=Number(v&BigInt(4294967295));m[w++]=W,W=W>>8,m[w++]=W,W=W>>8,m[w++]=W,W=W>>8,m[w++]=W;let Z=Number(v>>BigInt(32)&BigInt(4294967295));return m[w++]=Z,Z=Z>>8,m[w++]=Z,Z=Z>>8,m[w++]=Z,Z=Z>>8,m[w++]=Z,w}function X(m,v,w,M,$){Be(v,M,$,m,w,7);let W=Number(v&BigInt(4294967295));m[w+7]=W,W=W>>8,m[w+6]=W,W=W>>8,m[w+5]=W,W=W>>8,m[w+4]=W;let Z=Number(v>>BigInt(32)&BigInt(4294967295));return m[w+3]=Z,Z=Z>>8,m[w+2]=Z,Z=Z>>8,m[w+1]=Z,Z=Z>>8,m[w]=Z,w+8}o.prototype.writeBigUInt64LE=pe(function(m,v=0){return ee(this,m,v,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=pe(function(m,v=0){return X(this,m,v,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(m,v,w,M){if(m=+m,v=v>>>0,!M){let Ee=Math.pow(2,8*w-1);q(this,m,v,w,Ee-1,-Ee)}let $=0,W=1,Z=0;for(this[v]=m&255;++$>0)-Z&255;return v+w},o.prototype.writeIntBE=function(m,v,w,M){if(m=+m,v=v>>>0,!M){let Ee=Math.pow(2,8*w-1);q(this,m,v,w,Ee-1,-Ee)}let $=w-1,W=1,Z=0;for(this[v+$]=m&255;--$>=0&&(W*=256);)m<0&&Z===0&&this[v+$+1]!==0&&(Z=1),this[v+$]=(m/W>>0)-Z&255;return v+w},o.prototype.writeInt8=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,1,127,-128),m<0&&(m=255+m+1),this[v]=m&255,v+1},o.prototype.writeInt16LE=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,2,32767,-32768),this[v]=m&255,this[v+1]=m>>>8,v+2},o.prototype.writeInt16BE=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,2,32767,-32768),this[v]=m>>>8,this[v+1]=m&255,v+2},o.prototype.writeInt32LE=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,4,2147483647,-2147483648),this[v]=m&255,this[v+1]=m>>>8,this[v+2]=m>>>16,this[v+3]=m>>>24,v+4},o.prototype.writeInt32BE=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,4,2147483647,-2147483648),m<0&&(m=4294967295+m+1),this[v]=m>>>24,this[v+1]=m>>>16,this[v+2]=m>>>8,this[v+3]=m&255,v+4},o.prototype.writeBigInt64LE=pe(function(m,v=0){return ee(this,m,v,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=pe(function(m,v=0){return X(this,m,v,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function oe(m,v,w,M,$,W){if(w+M>m.length)throw new RangeError("Index out of range");if(w<0)throw new RangeError("Index out of range")}function me(m,v,w,M,$){return v=+v,w=w>>>0,$||oe(m,v,w,4),r.write(m,v,w,M,23,4),w+4}o.prototype.writeFloatLE=function(m,v,w){return me(this,m,v,!0,w)},o.prototype.writeFloatBE=function(m,v,w){return me(this,m,v,!1,w)};function le(m,v,w,M,$){return v=+v,w=w>>>0,$||oe(m,v,w,8),r.write(m,v,w,M,52,8),w+8}o.prototype.writeDoubleLE=function(m,v,w){return le(this,m,v,!0,w)},o.prototype.writeDoubleBE=function(m,v,w){return le(this,m,v,!1,w)},o.prototype.copy=function(m,v,w,M){if(!o.isBuffer(m))throw new TypeError("argument should be a Buffer");if(w||(w=0),!M&&M!==0&&(M=this.length),v>=m.length&&(v=m.length),v||(v=0),M>0&&M=this.length)throw new RangeError("Index out of range");if(M<0)throw new RangeError("sourceEnd out of bounds");M>this.length&&(M=this.length),m.length-v>>0,w=w===void 0?this.length:w>>>0,m||(m=0);let $;if(typeof m=="number")for($=v;$2**32?$=Ae(String(w)):typeof w=="bigint"&&($=String(w),(w>BigInt(2)**BigInt(32)||w<-(BigInt(2)**BigInt(32)))&&($=Ae($)),$+="n"),M+=` It must be ${v}. Received ${$}`,M},RangeError);function Ae(m){let v="",w=m.length,M=m[0]==="-"?1:0;for(;w>=M+4;w-=3)v=`_${m.slice(w-3,w)}${v}`;return`${m.slice(0,w)}${v}`}function Me(m,v,w){Pe(v,"offset"),(m[v]===void 0||m[v+w]===void 0)&&V(v,m.length-(w+1))}function Be(m,v,w,M,$,W){if(m>w||m3?v===0||v===BigInt(0)?Ee=`>= 0${Z} and < 2${Z} ** ${(W+1)*8}${Z}`:Ee=`>= -(2${Z} ** ${(W+1)*8-1}${Z}) and < 2 ** ${(W+1)*8-1}${Z}`:Ee=`>= ${v}${Z} and <= ${w}${Z}`,new fe.ERR_OUT_OF_RANGE("value",Ee,m)}Me(M,$,W)}function Pe(m,v){if(typeof m!="number")throw new fe.ERR_INVALID_ARG_TYPE(v,"number",m)}function V(m,v,w){throw Math.floor(m)!==m?(Pe(m,w),new fe.ERR_OUT_OF_RANGE(w||"offset","an integer",m)):v<0?new fe.ERR_BUFFER_OUT_OF_BOUNDS:new fe.ERR_OUT_OF_RANGE(w||"offset",`>= ${w?1:0} and <= ${v}`,m)}var ue=/[^+/0-9A-Za-z-_]/g;function se(m){if(m=m.split("=")[0],m=m.trim().replace(ue,""),m.length<2)return"";for(;m.length%4!==0;)m=m+"=";return m}function Y(m,v){v=v||1/0;let w,M=m.length,$=null,W=[];for(let Z=0;Z55295&&w<57344){if(!$){if(w>56319){(v-=3)>-1&&W.push(239,191,189);continue}else if(Z+1===M){(v-=3)>-1&&W.push(239,191,189);continue}$=w;continue}if(w<56320){(v-=3)>-1&&W.push(239,191,189),$=w;continue}w=($-55296<<10|w-56320)+65536}else $&&(v-=3)>-1&&W.push(239,191,189);if($=null,w<128){if((v-=1)<0)break;W.push(w)}else if(w<2048){if((v-=2)<0)break;W.push(w>>6|192,w&63|128)}else if(w<65536){if((v-=3)<0)break;W.push(w>>12|224,w>>6&63|128,w&63|128)}else if(w<1114112){if((v-=4)<0)break;W.push(w>>18|240,w>>12&63|128,w>>6&63|128,w&63|128)}else throw new Error("Invalid code point")}return W}function J(m){let v=[];for(let w=0;w>8,$=w%256,W.push($),W.push(M);return W}function ge(m){return e.toByteArray(se(m))}function de(m,v,w,M){let $;for($=0;$=v.length||$>=m.length);++$)v[$+w]=m[$];return $}function re(m,v){return m instanceof v||m!=null&&m.constructor!=null&&m.constructor.name!=null&&m.constructor.name===v.name}function Ce(m){return m!==m}var xe=function(){let m="0123456789abcdef",v=new Array(256);for(let w=0;w<16;++w){let M=w*16;for(let $=0;$<16;++$)v[M+$]=m[w]+m[$]}return v}();function pe(m){return typeof BigInt>"u"?Fe:m}function Fe(){throw new Error("BigInt not supported")}});function jt(t){return t!=null&&typeof t=="object"&&t["@@functional/placeholder"]===!0}function Dn(t){return function e(r){return arguments.length===0||jt(r)?e:t.apply(this,arguments)}}function ur(t){return function e(r,n){switch(arguments.length){case 0:return e;case 1:return jt(r)?e:Dn(function(i){return t(r,i)});default:return jt(r)&&jt(n)?e:jt(r)?Dn(function(i){return t(i,n)}):jt(n)?Dn(function(i){return t(r,i)}):t(r,n)}}}function mv(t,e){switch(t){case 0:return function(){return e.apply(this,arguments)};case 1:return function(r){return e.apply(this,arguments)};case 2:return function(r,n){return e.apply(this,arguments)};case 3:return function(r,n,i){return e.apply(this,arguments)};case 4:return function(r,n,i,s){return e.apply(this,arguments)};case 5:return function(r,n,i,s,a){return e.apply(this,arguments)};case 6:return function(r,n,i,s,a,o){return e.apply(this,arguments)};case 7:return function(r,n,i,s,a,o,c){return e.apply(this,arguments)};case 8:return function(r,n,i,s,a,o,c,u){return e.apply(this,arguments)};case 9:return function(r,n,i,s,a,o,c,u,l){return e.apply(this,arguments)};case 10:return function(r,n,i,s,a,o,c,u,l,h){return e.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function C_(t,e,r){return function(){for(var n=[],i=0,s=t,a=0,o=!1;a=arguments.length)?c=e[a]:(c=arguments[i],i+=1),n[a]=c,jt(c)?o=!0:s-=1,a+=1}return!o&&s<=0?r.apply(this,n):mv(Math.max(0,s),C_(t,n,r))}}var _M=ur(function(t,e){return t===1?Dn(e):mv(t,C_(t,[],e))}),__=_M;function _3(t){return function e(r,n,i){switch(arguments.length){case 0:return e;case 1:return jt(r)?e:ur(function(s,a){return t(r,s,a)});case 2:return jt(r)&&jt(n)?e:jt(r)?ur(function(s,a){return t(s,n,a)}):jt(n)?ur(function(s,a){return t(r,s,a)}):Dn(function(s){return t(r,n,s)});default:return jt(r)&&jt(n)&&jt(i)?e:jt(r)&&jt(n)?ur(function(s,a){return t(s,a,i)}):jt(r)&&jt(i)?ur(function(s,a){return t(s,n,a)}):jt(n)&&jt(i)?ur(function(s,a){return t(r,s,a)}):jt(r)?Dn(function(s){return t(s,n,i)}):jt(n)?Dn(function(s){return t(r,s,i)}):jt(i)?Dn(function(s){return t(r,n,s)}):t(r,n,i)}}}var k3=Array.isArray||function(t){return t!=null&&t.length>=0&&Object.prototype.toString.call(t)==="[object Array]"};function kM(t){return t!=null&&typeof t["@@transducer/step"]=="function"}function B3(t,e,r){return function(){if(arguments.length===0)return r();var n=arguments[arguments.length-1];if(!k3(n)){for(var i=0;i=0;)e=zE[r],tm(e,t)&&!OM(n,e)&&(n[n.length]=e),r-=1;return n}),vh=DM,RM=Dn(function(t){return t===null?"Null":t===void 0?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}),qE=RM;function KE(t,e,r,n){var i=UE(t),s=UE(e);function a(o,c){return I3(o,c,r.slice(),n.slice())}return!$E(function(o,c){return!$E(a,c,o)},s,i)}function I3(t,e,r,n){if(m2(t,e))return!0;var i=qE(t);if(i!==qE(e))return!1;if(typeof t["fantasy-land/equals"]=="function"||typeof e["fantasy-land/equals"]=="function")return typeof t["fantasy-land/equals"]=="function"&&t["fantasy-land/equals"](e)&&typeof e["fantasy-land/equals"]=="function"&&e["fantasy-land/equals"](t);if(typeof t.equals=="function"||typeof e.equals=="function")return typeof t.equals=="function"&&t.equals(e)&&typeof e.equals=="function"&&e.equals(t);switch(i){case"Arguments":case"Array":case"Object":if(typeof t.constructor=="function"&&IM(t.constructor)==="Promise")return t===e;break;case"Boolean":case"Number":case"String":if(!(typeof t==typeof e&&m2(t.valueOf(),e.valueOf())))return!1;break;case"Date":if(!m2(t.valueOf(),e.valueOf()))return!1;break;case"Error":return t.name===e.name&&t.message===e.message;case"RegExp":if(!(t.source===e.source&&t.global===e.global&&t.ignoreCase===e.ignoreCase&&t.multiline===e.multiline&&t.sticky===e.sticky&&t.unicode===e.unicode))return!1;break}for(var s=r.length-1;s>=0;){if(r[s]===t)return n[s]===e;s-=1}switch(i){case"Map":return t.size!==e.size?!1:KE(t.entries(),e.entries(),r.concat([t]),n.concat([e]));case"Set":return t.size!==e.size?!1:KE(t.values(),e.values(),r.concat([t]),n.concat([e]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var a=vh(t);if(a.length!==vh(e).length)return!1;var o=r.concat([t]),c=n.concat([e]);for(s=a.length-1;s>=0;){var u=a[s];if(!(tm(u,e)&&I3(e[u],t[u],o,c)))return!1;s-=1}return!0}var MM=ur(function(t,e){return I3(t,e,[],[])}),k_=MM;function LM(t,e,r){var n,i;if(typeof t.indexOf=="function")switch(typeof e){case"number":if(e===0){for(n=1/e;r=0}function rd(t,e){for(var r=0,n=e.length,i=Array(n);r":I_(s,a)},n=function(s,a){return rd(function(o){return v2(o)+": "+r(s[o])},a.slice().sort())};switch(Object.prototype.toString.call(t)){case"[object Arguments]":return"(function() { return arguments; }("+rd(r,t).join(", ")+"))";case"[object Array]":return"["+rd(r,t).concat(n(t,JM(function(s){return/^\d+$/.test(s)},vh(t)))).join(", ")+"]";case"[object Boolean]":return typeof t=="object"?"new Boolean("+r(t.valueOf())+")":t.toString();case"[object Date]":return"new Date("+(isNaN(t.valueOf())?r(NaN):v2($M(t)))+")";case"[object Map]":return"new Map("+r(Array.from(t))+")";case"[object Null]":return"null";case"[object Number]":return typeof t=="object"?"new Number("+r(t.valueOf())+")":1/t===-1/0?"-0":t.toString(10);case"[object Set]":return"new Set("+r(Array.from(t).sort())+")";case"[object String]":return typeof t=="object"?"new String("+r(t.valueOf())+")":v2(t);case"[object Undefined]":return"undefined";default:if(typeof t.toString=="function"){var i=t.toString();if(i!=="[object Object]")return i}return"{"+n(t,vh(t)).join(", ")+"}"}}var XM=Dn(function(t){return I_(t,[])}),WE=XM,QM=ur(function(t,e){if(t===e)return e;function r(o,c){if(o>c!=c>o)return c>o?c:o}var n=r(t,e);if(n!==void 0)return n;var i=r(typeof t,typeof e);if(i!==void 0)return i===typeof t?t:e;var s=WE(t),a=r(s,WE(e));return a!==void 0&&a===s?t:e}),YM=QM,eL=function(){function t(e,r){this.xf=r,this.f=e}return t.prototype["@@transducer/init"]=Id.init,t.prototype["@@transducer/result"]=Id.result,t.prototype["@@transducer/step"]=function(e,r){return this.xf["@@transducer/step"](e,this.f(r))},t}(),tL=function(t){return function(e){return new eL(t,e)}},rL=tL,nL=ur(B3(["fantasy-land/map","map"],rL,function(t,e){switch(Object.prototype.toString.call(e)){case"[object Function]":return __(e.length,function(){return t.call(this,e.apply(this,arguments))});case"[object Object]":return B_(function(r,n){return r[n]=t(e[n]),r},{},vh(e));default:return rd(t,e)}})),iL=nL,F_=Number.isInteger||function(t){return t<<0===t};function T_(t){return Object.prototype.toString.call(t)==="[object String]"}var sL=ur(function(t,e){var r=t<0?e.length+t:t;return T_(e)?e.charAt(r):e[r]}),P_=sL,aL=ur(function(t,e){if(e!=null)return F_(t)?P_(t,e):e[t]}),vv=aL,oL=ur(function(t,e){return iL(vv(t),e)}),cL=oL,uL=Dn(function(t){return k3(t)?!0:!t||typeof t!="object"||T_(t)?!1:t.length===0?!0:t.length>0?t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1):!1}),lL=uL,GE=typeof Symbol<"u"?Symbol.iterator:"@@iterator";function fL(t,e,r){return function(n,i,s){if(lL(s))return t(n,i,s);if(s==null)return i;if(typeof s["fantasy-land/reduce"]=="function")return e(n,i,s,"fantasy-land/reduce");if(s[GE]!=null)return r(n,i,s[GE]());if(typeof s.next=="function")return r(n,i,s);if(typeof s.reduce=="function")return e(n,i,s,"reduce");throw new TypeError("reduce: list must be array or iterable")}}function hL(t,e,r){for(var n=0,i=r.length;nD_(Jb([]),NL(UL(t,"name")),Jb({}),vv("value")),M_=t=>D_(e=>{if(!e)throw new HL(t);return e},vv("tags"),Jb([]));function L_({fetch:t,GATEWAY_URL:e}){return async({query:r,variables:n})=>t(`${e}/graphql`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:r,variables:n})}).then(i=>i.json())}function KL({fetch:t,GATEWAY_URL:e}){let r=L_({fetch:t,GATEWAY_URL:e}),n=Qb({fetch:t,GATEWAY_URL:e}),i=` - query GetTransactions ($transactionIds: [ID!]!) { - transactions(ids: $transactionIds) { - edges { - node { - tags { - name - value - } - } - } - } - } - `;return async s=>r({query:i,variables:{transactionIds:[s]}}).then(R_(["data","transactions","edges","0","node"])).then(M_(`Process ${s} was not found on gateway ${e}`)).then(Xb(qL)).then(a=>{if(!a)throw new $L('No "Scheduler" tag found on process');return n(a)})}function Qb({fetch:t,GATEWAY_URL:e}){let r=L_({fetch:t,GATEWAY_URL:e}),n=` - query GetSchedulerLocation ($owner: String!) { - transactions ( - owners: [$owner] - tags: [ - { name: "Data-Protocol", values: ["ao"] }, - { name: "Type", values: ["Scheduler-Location"] } - ] - # Only need the most recent Scheduler-Location - sort: HEIGHT_DESC - first: 1 - ) { - edges { - node { - tags { - name - value - } - } - } - } - } - `;return async i=>r({query:n,variables:{owner:i}}).then(R_(["data","transactions","edges","0","node"])).then(M_(`Could not find 'Scheduler-Location' owner by wallet ${i}`)).then(DL([Xb(zL),Xb(VL)])).then(([s,a])=>{if(!s)throw new rm('No "Url" tag found on Scheduler-Location');if(!a)throw new rm('No "Time-To-Live" tag found on Scheduler-Location');return{url:s,ttl:a,owner:i}})}var vl=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,j_=new Set,Yb=typeof process=="object"&&process?process:{},U_=(t,e,r,n)=>{typeof Yb.emitWarning=="function"?Yb.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`)},nm=globalThis.AbortController,ZE=globalThis.AbortSignal,H9;if(typeof nm>"u"){ZE=class{constructor(){ae(this,"onabort");ae(this,"_onabort",[]);ae(this,"reason");ae(this,"aborted",!1)}addEventListener(r,n){this._onabort.push(n)}},nm=class{constructor(){ae(this,"signal",new ZE);e()}abort(r){var n,i;if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=!0;for(let s of this.signal._onabort)s(r);(i=(n=this.signal).onabort)==null||i.call(n,r)}}};let t=((H9=Yb.env)==null?void 0:H9.LRU_CACHE_IGNORE_AC_WARNING)!=="1",e=()=>{t&&(t=!1,U_("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var WL=t=>!j_.has(t),Oo=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),$_=t=>Oo(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?tg:null:null,tg=class extends Array{constructor(t){super(t),this.fill(0)}},Ya,yf,GL=(Ya=class{constructor(e,r){ae(this,"heap");ae(this,"length");if(!U(Ya,yf))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}static create(e){let r=$_(e);if(!r)return[];Q(Ya,yf,!0);let n=new Ya(e,r);return Q(Ya,yf,!1),n}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},yf=new WeakMap,ce(Ya,yf,!1),Ya),as,Kn,os,cs,xf,wr,us,gr,Lt,et,fn,Wn,en,Ir,ls,Fr,fs,hs,Gn,ds,Ko,hn,op,ew,ou,Fa,cp,Zn,zm,H_,cu,bf,up,$s,Do,Hs,Ro,lp,tw,wf,rg,Ef,ng,It,Mt,fp,rw,uu,M0,hp,ZL=(hp=class{constructor(e){ce(this,op);ce(this,zm);ce(this,$s);ce(this,Hs);ce(this,lp);ce(this,wf);ce(this,Ef);ce(this,It);ce(this,fp);ce(this,uu);ce(this,as,void 0);ce(this,Kn,void 0);ce(this,os,void 0);ce(this,cs,void 0);ce(this,xf,void 0);ae(this,"ttl");ae(this,"ttlResolution");ae(this,"ttlAutopurge");ae(this,"updateAgeOnGet");ae(this,"updateAgeOnHas");ae(this,"allowStale");ae(this,"noDisposeOnSet");ae(this,"noUpdateTTL");ae(this,"maxEntrySize");ae(this,"sizeCalculation");ae(this,"noDeleteOnFetchRejection");ae(this,"noDeleteOnStaleGet");ae(this,"allowStaleOnFetchAbort");ae(this,"allowStaleOnFetchRejection");ae(this,"ignoreFetchAbort");ce(this,wr,void 0);ce(this,us,void 0);ce(this,gr,void 0);ce(this,Lt,void 0);ce(this,et,void 0);ce(this,fn,void 0);ce(this,Wn,void 0);ce(this,en,void 0);ce(this,Ir,void 0);ce(this,ls,void 0);ce(this,Fr,void 0);ce(this,fs,void 0);ce(this,hs,void 0);ce(this,Gn,void 0);ce(this,ds,void 0);ce(this,Ko,void 0);ce(this,hn,void 0);ce(this,ou,()=>{});ce(this,Fa,()=>{});ce(this,cp,()=>{});ce(this,Zn,()=>!1);ce(this,cu,e=>{});ce(this,bf,(e,r,n)=>{});ce(this,up,(e,r,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:a,updateAgeOnHas:o,allowStale:c,dispose:u,disposeAfter:l,noDisposeOnSet:h,noUpdateTTL:f,maxSize:p=0,maxEntrySize:d=0,sizeCalculation:g,fetchMethod:y,noDeleteOnFetchRejection:x,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:k,ignoreFetchAbort:T}=e;if(r!==0&&!Oo(r))throw new TypeError("max option must be a nonnegative integer");let _=r?$_(r):Array;if(!_)throw new Error("invalid max value: "+r);if(Q(this,as,r),Q(this,Kn,p),this.maxEntrySize=d||U(this,Kn),this.sizeCalculation=g,this.sizeCalculation){if(!U(this,Kn)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(Q(this,xf,y),Q(this,Ko,!!y),Q(this,gr,new Map),Q(this,Lt,new Array(r).fill(void 0)),Q(this,et,new Array(r).fill(void 0)),Q(this,fn,new _(r)),Q(this,Wn,new _(r)),Q(this,en,0),Q(this,Ir,0),Q(this,ls,GL.create(r)),Q(this,wr,0),Q(this,us,0),typeof u=="function"&&Q(this,os,u),typeof l=="function"?(Q(this,cs,l),Q(this,Fr,[])):(Q(this,cs,void 0),Q(this,Fr,void 0)),Q(this,ds,!!U(this,os)),Q(this,hn,!!U(this,cs)),this.noDisposeOnSet=!!h,this.noUpdateTTL=!!f,this.noDeleteOnFetchRejection=!!x,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!k,this.ignoreFetchAbort=!!T,this.maxEntrySize!==0){if(U(this,Kn)!==0&&!Oo(U(this,Kn)))throw new TypeError("maxSize must be a positive integer if specified");if(!Oo(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");ye(this,zm,H_).call(this)}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!o,this.ttlResolution=Oo(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!Oo(this.ttl))throw new TypeError("ttl must be a positive integer if specified");ye(this,op,ew).call(this)}if(U(this,as)===0&&this.ttl===0&&U(this,Kn)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!U(this,as)&&!U(this,Kn)){let B="LRU_CACHE_UNBOUNDED";WL(B)&&(j_.add(B),U_("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",B,hp))}}static unsafeExposeInternals(e){return{starts:U(e,hs),ttls:U(e,Gn),sizes:U(e,fs),keyMap:U(e,gr),keyList:U(e,Lt),valList:U(e,et),next:U(e,fn),prev:U(e,Wn),get head(){return U(e,en)},get tail(){return U(e,Ir)},free:U(e,ls),isBackgroundFetch:r=>{var n;return ye(n=e,It,Mt).call(n,r)},backgroundFetch:(r,n,i,s)=>{var a;return ye(a=e,Ef,ng).call(a,r,n,i,s)},moveToTail:r=>{var n;return ye(n=e,uu,M0).call(n,r)},indexes:r=>{var n;return ye(n=e,$s,Do).call(n,r)},rindexes:r=>{var n;return ye(n=e,Hs,Ro).call(n,r)},isStale:r=>{var n;return U(n=e,Zn).call(n,r)}}}get max(){return U(this,as)}get maxSize(){return U(this,Kn)}get calculatedSize(){return U(this,us)}get size(){return U(this,wr)}get fetchMethod(){return U(this,xf)}get dispose(){return U(this,os)}get disposeAfter(){return U(this,cs)}getRemainingTTL(e){return U(this,gr).has(e)?1/0:0}*entries(){for(let e of ye(this,$s,Do).call(this))U(this,et)[e]!==void 0&&U(this,Lt)[e]!==void 0&&!ye(this,It,Mt).call(this,U(this,et)[e])&&(yield[U(this,Lt)[e],U(this,et)[e]])}*rentries(){for(let e of ye(this,Hs,Ro).call(this))U(this,et)[e]!==void 0&&U(this,Lt)[e]!==void 0&&!ye(this,It,Mt).call(this,U(this,et)[e])&&(yield[U(this,Lt)[e],U(this,et)[e]])}*keys(){for(let e of ye(this,$s,Do).call(this)){let r=U(this,Lt)[e];r!==void 0&&!ye(this,It,Mt).call(this,U(this,et)[e])&&(yield r)}}*rkeys(){for(let e of ye(this,Hs,Ro).call(this)){let r=U(this,Lt)[e];r!==void 0&&!ye(this,It,Mt).call(this,U(this,et)[e])&&(yield r)}}*values(){for(let e of ye(this,$s,Do).call(this))U(this,et)[e]!==void 0&&!ye(this,It,Mt).call(this,U(this,et)[e])&&(yield U(this,et)[e])}*rvalues(){for(let e of ye(this,Hs,Ro).call(this))U(this,et)[e]!==void 0&&!ye(this,It,Mt).call(this,U(this,et)[e])&&(yield U(this,et)[e])}[Symbol.iterator](){return this.entries()}find(e,r={}){for(let n of ye(this,$s,Do).call(this)){let i=U(this,et)[n],s=ye(this,It,Mt).call(this,i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,U(this,Lt)[n],this))return this.get(U(this,Lt)[n],r)}}forEach(e,r=this){for(let n of ye(this,$s,Do).call(this)){let i=U(this,et)[n],s=ye(this,It,Mt).call(this,i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,U(this,Lt)[n],this)}}rforEach(e,r=this){for(let n of ye(this,Hs,Ro).call(this)){let i=U(this,et)[n],s=ye(this,It,Mt).call(this,i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,U(this,Lt)[n],this)}}purgeStale(){let e=!1;for(let r of ye(this,Hs,Ro).call(this,{allowStale:!0}))U(this,Zn).call(this,r)&&(this.delete(U(this,Lt)[r]),e=!0);return e}info(e){let r=U(this,gr).get(e);if(r===void 0)return;let n=U(this,et)[r],i=ye(this,It,Mt).call(this,n)?n.__staleWhileFetching:n;if(i===void 0)return;let s={value:i};if(U(this,Gn)&&U(this,hs)){let a=U(this,Gn)[r],o=U(this,hs)[r];if(a&&o){let c=a-(vl.now()-o);s.ttl=c,s.start=Date.now()}}return U(this,fs)&&(s.size=U(this,fs)[r]),s}dump(){let e=[];for(let r of ye(this,$s,Do).call(this,{allowStale:!0})){let n=U(this,Lt)[r],i=U(this,et)[r],s=ye(this,It,Mt).call(this,i)?i.__staleWhileFetching:i;if(s===void 0||n===void 0)continue;let a={value:s};if(U(this,Gn)&&U(this,hs)){a.ttl=U(this,Gn)[r];let o=vl.now()-U(this,hs)[r];a.start=Math.floor(Date.now()-o)}U(this,fs)&&(a.size=U(this,fs)[r]),e.unshift([n,a])}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let i=Date.now()-n.start;n.start=vl.now()-i}this.set(r,n.value,n)}}set(e,r,n={}){var f,p,d,g,y;if(r===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:c}=n,{noUpdateTTL:u=this.noUpdateTTL}=n,l=U(this,up).call(this,e,r,n.size||0,o);if(this.maxEntrySize&&l>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this.delete(e),this;let h=U(this,wr)===0?void 0:U(this,gr).get(e);if(h===void 0)h=U(this,wr)===0?U(this,Ir):U(this,ls).length!==0?U(this,ls).pop():U(this,wr)===U(this,as)?ye(this,wf,rg).call(this,!1):U(this,wr),U(this,Lt)[h]=e,U(this,et)[h]=r,U(this,gr).set(e,h),U(this,fn)[U(this,Ir)]=h,U(this,Wn)[h]=U(this,Ir),Q(this,Ir,h),So(this,wr)._++,U(this,bf).call(this,h,l,c),c&&(c.set="add"),u=!1;else{ye(this,uu,M0).call(this,h);let x=U(this,et)[h];if(r!==x){if(U(this,Ko)&&ye(this,It,Mt).call(this,x)){x.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:b}=x;b!==void 0&&!a&&(U(this,ds)&&((f=U(this,os))==null||f.call(this,b,e,"set")),U(this,hn)&&((p=U(this,Fr))==null||p.push([b,e,"set"])))}else a||(U(this,ds)&&((d=U(this,os))==null||d.call(this,x,e,"set")),U(this,hn)&&((g=U(this,Fr))==null||g.push([x,e,"set"])));if(U(this,cu).call(this,h),U(this,bf).call(this,h,l,c),U(this,et)[h]=r,c){c.set="replace";let b=x&&ye(this,It,Mt).call(this,x)?x.__staleWhileFetching:x;b!==void 0&&(c.oldValue=b)}}else c&&(c.set="update")}if(i!==0&&!U(this,Gn)&&ye(this,op,ew).call(this),U(this,Gn)&&(u||U(this,cp).call(this,h,i,s),c&&U(this,Fa).call(this,c,h)),!a&&U(this,hn)&&U(this,Fr)){let x=U(this,Fr),b;for(;b=x==null?void 0:x.shift();)(y=U(this,cs))==null||y.call(this,...b)}return this}pop(){var e;try{for(;U(this,wr);){let r=U(this,et)[U(this,en)];if(ye(this,wf,rg).call(this,!0),ye(this,It,Mt).call(this,r)){if(r.__staleWhileFetching)return r.__staleWhileFetching}else if(r!==void 0)return r}}finally{if(U(this,hn)&&U(this,Fr)){let r=U(this,Fr),n;for(;n=r==null?void 0:r.shift();)(e=U(this,cs))==null||e.call(this,...n)}}}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=r,s=U(this,gr).get(e);if(s!==void 0){let a=U(this,et)[s];if(ye(this,It,Mt).call(this,a)&&a.__staleWhileFetching===void 0)return!1;if(U(this,Zn).call(this,s))i&&(i.has="stale",U(this,Fa).call(this,i,s));else return n&&U(this,ou).call(this,s),i&&(i.has="hit",U(this,Fa).call(this,i,s)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{allowStale:n=this.allowStale}=r,i=U(this,gr).get(e);if(i===void 0||!n&&U(this,Zn).call(this,i))return;let s=U(this,et)[i];return ye(this,It,Mt).call(this,s)?s.__staleWhileFetching:s}async fetch(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:c=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:d=this.allowStaleOnFetchAbort,context:g,forceRefresh:y=!1,status:x,signal:b}=r;if(!U(this,Ko))return x&&(x.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:x});let S={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:o,size:c,sizeCalculation:u,noUpdateTTL:l,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:d,ignoreFetchAbort:p,status:x,signal:b},k=U(this,gr).get(e);if(k===void 0){x&&(x.fetch="miss");let T=ye(this,Ef,ng).call(this,e,k,S,g);return T.__returned=T}else{let T=U(this,et)[k];if(ye(this,It,Mt).call(this,T)){let P=n&&T.__staleWhileFetching!==void 0;return x&&(x.fetch="inflight",P&&(x.returnedStale=!0)),P?T.__staleWhileFetching:T.__returned=T}let _=U(this,Zn).call(this,k);if(!y&&!_)return x&&(x.fetch="hit"),ye(this,uu,M0).call(this,k),i&&U(this,ou).call(this,k),x&&U(this,Fa).call(this,x,k),T;let B=ye(this,Ef,ng).call(this,e,k,S,g),N=B.__staleWhileFetching!==void 0&&n;return x&&(x.fetch=_?"stale":"refresh",N&&_&&(x.returnedStale=!0)),N?B.__staleWhileFetching:B.__returned=B}}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:a}=r,o=U(this,gr).get(e);if(o!==void 0){let c=U(this,et)[o],u=ye(this,It,Mt).call(this,c);return a&&U(this,Fa).call(this,a,o),U(this,Zn).call(this,o)?(a&&(a.get="stale"),u?(a&&n&&c.__staleWhileFetching!==void 0&&(a.returnedStale=!0),n?c.__staleWhileFetching:void 0):(s||this.delete(e),a&&n&&(a.returnedStale=!0),n?c:void 0)):(a&&(a.get="hit"),u?c.__staleWhileFetching:(ye(this,uu,M0).call(this,o),i&&U(this,ou).call(this,o),c))}else a&&(a.get="miss")}delete(e){var n,i,s,a;let r=!1;if(U(this,wr)!==0){let o=U(this,gr).get(e);if(o!==void 0)if(r=!0,U(this,wr)===1)this.clear();else{U(this,cu).call(this,o);let c=U(this,et)[o];if(ye(this,It,Mt).call(this,c)?c.__abortController.abort(new Error("deleted")):(U(this,ds)||U(this,hn))&&(U(this,ds)&&((n=U(this,os))==null||n.call(this,c,e,"delete")),U(this,hn)&&((i=U(this,Fr))==null||i.push([c,e,"delete"]))),U(this,gr).delete(e),U(this,Lt)[o]=void 0,U(this,et)[o]=void 0,o===U(this,Ir))Q(this,Ir,U(this,Wn)[o]);else if(o===U(this,en))Q(this,en,U(this,fn)[o]);else{let u=U(this,Wn)[o];U(this,fn)[u]=U(this,fn)[o];let l=U(this,fn)[o];U(this,Wn)[l]=U(this,Wn)[o]}So(this,wr)._--,U(this,ls).push(o)}}if(U(this,hn)&&((s=U(this,Fr))!=null&&s.length)){let o=U(this,Fr),c;for(;c=o==null?void 0:o.shift();)(a=U(this,cs))==null||a.call(this,...c)}return r}clear(){var e,r,n;for(let i of ye(this,Hs,Ro).call(this,{allowStale:!0})){let s=U(this,et)[i];if(ye(this,It,Mt).call(this,s))s.__abortController.abort(new Error("deleted"));else{let a=U(this,Lt)[i];U(this,ds)&&((e=U(this,os))==null||e.call(this,s,a,"delete")),U(this,hn)&&((r=U(this,Fr))==null||r.push([s,a,"delete"]))}}if(U(this,gr).clear(),U(this,et).fill(void 0),U(this,Lt).fill(void 0),U(this,Gn)&&U(this,hs)&&(U(this,Gn).fill(0),U(this,hs).fill(0)),U(this,fs)&&U(this,fs).fill(0),Q(this,en,0),Q(this,Ir,0),U(this,ls).length=0,Q(this,us,0),Q(this,wr,0),U(this,hn)&&U(this,Fr)){let i=U(this,Fr),s;for(;s=i==null?void 0:i.shift();)(n=U(this,cs))==null||n.call(this,...s)}}},as=new WeakMap,Kn=new WeakMap,os=new WeakMap,cs=new WeakMap,xf=new WeakMap,wr=new WeakMap,us=new WeakMap,gr=new WeakMap,Lt=new WeakMap,et=new WeakMap,fn=new WeakMap,Wn=new WeakMap,en=new WeakMap,Ir=new WeakMap,ls=new WeakMap,Fr=new WeakMap,fs=new WeakMap,hs=new WeakMap,Gn=new WeakMap,ds=new WeakMap,Ko=new WeakMap,hn=new WeakMap,op=new WeakSet,ew=function(){let e=new tg(U(this,as)),r=new tg(U(this,as));Q(this,Gn,e),Q(this,hs,r),Q(this,cp,(s,a,o=vl.now())=>{if(r[s]=a!==0?o:0,e[s]=a,a!==0&&this.ttlAutopurge){let c=setTimeout(()=>{U(this,Zn).call(this,s)&&this.delete(U(this,Lt)[s])},a+1);c.unref&&c.unref()}}),Q(this,ou,s=>{r[s]=e[s]!==0?vl.now():0}),Q(this,Fa,(s,a)=>{if(e[a]){let o=e[a],c=r[a];if(!o||!c)return;s.ttl=o,s.start=c,s.now=n||i();let u=s.now-c;s.remainingTTL=o-u}});let n=0,i=()=>{let s=vl.now();if(this.ttlResolution>0){n=s;let a=setTimeout(()=>n=0,this.ttlResolution);a.unref&&a.unref()}return s};this.getRemainingTTL=s=>{let a=U(this,gr).get(s);if(a===void 0)return 0;let o=e[a],c=r[a];if(!o||!c)return 1/0;let u=(n||i())-c;return o-u},Q(this,Zn,s=>{let a=r[s],o=e[s];return!!o&&!!a&&(n||i())-a>o})},ou=new WeakMap,Fa=new WeakMap,cp=new WeakMap,Zn=new WeakMap,zm=new WeakSet,H_=function(){let e=new tg(U(this,as));Q(this,us,0),Q(this,fs,e),Q(this,cu,r=>{Q(this,us,U(this,us)-e[r]),e[r]=0}),Q(this,up,(r,n,i,s)=>{if(ye(this,It,Mt).call(this,n))return 0;if(!Oo(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(n,r),!Oo(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i}),Q(this,bf,(r,n,i)=>{if(e[r]=n,U(this,Kn)){let s=U(this,Kn)-e[r];for(;U(this,us)>s;)ye(this,wf,rg).call(this,!0)}Q(this,us,U(this,us)+e[r]),i&&(i.entrySize=n,i.totalCalculatedSize=U(this,us))})},cu=new WeakMap,bf=new WeakMap,up=new WeakMap,$s=new WeakSet,Do=function*({allowStale:e=this.allowStale}={}){if(U(this,wr))for(let r=U(this,Ir);!(!ye(this,lp,tw).call(this,r)||((e||!U(this,Zn).call(this,r))&&(yield r),r===U(this,en)));)r=U(this,Wn)[r]},Hs=new WeakSet,Ro=function*({allowStale:e=this.allowStale}={}){if(U(this,wr))for(let r=U(this,en);!(!ye(this,lp,tw).call(this,r)||((e||!U(this,Zn).call(this,r))&&(yield r),r===U(this,Ir)));)r=U(this,fn)[r]},lp=new WeakSet,tw=function(e){return e!==void 0&&U(this,gr).get(U(this,Lt)[e])===e},wf=new WeakSet,rg=function(e){var s,a;let r=U(this,en),n=U(this,Lt)[r],i=U(this,et)[r];return U(this,Ko)&&ye(this,It,Mt).call(this,i)?i.__abortController.abort(new Error("evicted")):(U(this,ds)||U(this,hn))&&(U(this,ds)&&((s=U(this,os))==null||s.call(this,i,n,"evict")),U(this,hn)&&((a=U(this,Fr))==null||a.push([i,n,"evict"]))),U(this,cu).call(this,r),e&&(U(this,Lt)[r]=void 0,U(this,et)[r]=void 0,U(this,ls).push(r)),U(this,wr)===1?(Q(this,en,Q(this,Ir,0)),U(this,ls).length=0):Q(this,en,U(this,fn)[r]),U(this,gr).delete(n),So(this,wr)._--,r},Ef=new WeakSet,ng=function(e,r,n,i){let s=r===void 0?void 0:U(this,et)[r];if(ye(this,It,Mt).call(this,s))return s;let a=new nm,{signal:o}=n;o==null||o.addEventListener("abort",()=>a.abort(o.reason),{signal:a.signal});let c={signal:a.signal,options:n,context:i},u=(g,y=!1)=>{let{aborted:x}=a.signal,b=n.ignoreFetchAbort&&g!==void 0;if(n.status&&(x&&!y?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,b&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),x&&!b&&!y)return h(a.signal.reason);let S=p;return U(this,et)[r]===p&&(g===void 0?S.__staleWhileFetching?U(this,et)[r]=S.__staleWhileFetching:this.delete(e):(n.status&&(n.status.fetchUpdated=!0),this.set(e,g,c.options))),g},l=g=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=g),h(g)),h=g=>{let{aborted:y}=a.signal,x=y&&n.allowStaleOnFetchAbort,b=x||n.allowStaleOnFetchRejection,S=b||n.noDeleteOnFetchRejection,k=p;if(U(this,et)[r]===p&&(!S||k.__staleWhileFetching===void 0?this.delete(e):x||(U(this,et)[r]=k.__staleWhileFetching)),b)return n.status&&k.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),k.__staleWhileFetching;if(k.__returned===k)throw g},f=(g,y)=>{var b;let x=(b=U(this,xf))==null?void 0:b.call(this,e,s,c);x&&x instanceof Promise&&x.then(S=>g(S===void 0?void 0:S),y),a.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(g(void 0),n.allowStaleOnFetchAbort&&(g=S=>u(S,!0)))})};n.status&&(n.status.fetchDispatched=!0);let p=new Promise(f).then(u,l),d=Object.assign(p,{__abortController:a,__staleWhileFetching:s,__returned:void 0});return r===void 0?(this.set(e,d,{...c.options,status:void 0}),r=U(this,gr).get(e)):U(this,et)[r]=d,d},It=new WeakSet,Mt=function(e){if(!U(this,Ko))return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof nm},fp=new WeakSet,rw=function(e,r){U(this,Wn)[r]=e,U(this,fn)[e]=r},uu=new WeakSet,M0=function(e){e!==U(this,Ir)&&(e===U(this,en)?Q(this,en,U(this,fn)[e]):ye(this,fp,rw).call(this,U(this,Wn)[e],U(this,fn)[e]),ye(this,fp,rw).call(this,U(this,Ir),e),Q(this,Ir,e))},hp),Tu,Dp;function JL({size:t}){return Tu||(Dp=t,Tu=new ZL({max:t,maxSize:1e6*5,sizeCalculation:e=>JSON.stringify(e).length,allowStale:!0}),Tu)}function XL({cache:t=Tu}){return async e=>{if(Dp)return t.get(e)}}function QL({cache:t=Tu}){return async(e,{url:r,address:n},i)=>{if(Dp)return t.set(e,{url:r,address:n},{ttl:i})}}function YL({cache:t=Tu}){return async e=>{if(Dp)return t.get(e)}}function ej({cache:t=Tu}){return async(e,r,n)=>{if(Dp)return t.set(e,{url:r,address:e},{ttl:n})}}function tj({loadProcessScheduler:t,cache:e}){return r=>e.getByProcess(r).then(n=>n||t(r).then(i=>{let s={url:i.url,address:i.owner};return Promise.all([e.setByProcess(r,s,i.ttl),e.setByOwner(i.owner,i.url,i.ttl)]).then(()=>s)}))}function rj({loadScheduler:t,cache:e}){return r=>e.getByOwner(r).then(n=>n?{url:n.url}:t(r).then(i=>e.setByOwner(r,i.url,i.ttl).then(()=>({url:i.url}))).catch(i=>{if(!(i instanceof rm))throw i}))}function nj({loadScheduler:t,cache:e}){return r=>e.getByOwner(r).then(n=>n?!0:t(r).then(i=>e.setByOwner(r,i.url,i.ttl)).then(()=>!0).catch(i=>{if(i instanceof rm)return!1;throw i}))}var ij=globalThis.GATEWAY_URL||"https://arweave.net";function z_({cacheSize:t=100,GATEWAY_URL:e=ij}={}){let r=JL({size:t}),n=YL({cache:r}),i=XL({cache:r}),s=ej({cache:r}),a=QL({cache:r}),o=tj({loadProcessScheduler:KL({fetch,GATEWAY_URL:e}),cache:{getByProcess:i,getByOwner:n,setByProcess:a,setByOwner:s}}),c=nj({loadScheduler:Qb({fetch,GATEWAY_URL:e}),cache:{getByProcess:i,getByOwner:n,setByProcess:a,setByOwner:s}}),u=rj({loadScheduler:Qb({fetch,GATEWAY_URL:e}),cache:{getByProcess:i,getByOwner:n,setByProcess:a,setByOwner:s}});return{locate:o,validate:c,raw:u}}z_();var Va=t=>({fork:t,toPromise:()=>new Promise((e,r)=>t(r,e)),map:e=>Va((r,n)=>t(r,i=>n(e(i)))),bimap:(e,r)=>Va((n,i)=>t(s=>n(e(s)),s=>i(r(s)))),chain:e=>Va((r,n)=>t(r,i=>e(i).fork(r,n))),bichain:(e,r)=>Va((n,i)=>t(s=>e(s).fork(n,i),s=>r(s).fork(n,i))),fold:(e,r)=>Va((n,i)=>t(s=>e(s).fork(n,i),s=>r(s).fork(n,i)))}),st=t=>Va((e,r)=>r(t)),Cc=t=>Va((e,r)=>r(t)),Rc=t=>Va((e,r)=>e(t)),Tt=t=>(...e)=>Va((r,n)=>t(...e).then(n).catch(r));function sj({fetch:t,MU_URL:e,logger:r}){let n=r.child("deployMessage");return i=>st(i).chain(Tt(({processId:s,data:a,tags:o,anchor:c,signer:u})=>u({data:a,tags:o,target:s,anchor:c}))).chain(s=>st(s).chain(Tt(async a=>t(e,{method:"POST",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},body:a.raw}))).bichain(a=>Rc(new Error(`Error while communicating with MU: ${JSON.stringify(a)}`)),Tt(async a=>{if(a.ok)return a.json();throw new Error(`${a.status}: ${await a.text()}`)})).bimap(n.tap("Error encountered when writing message via MU"),n.tap("Successfully wrote message via MU")).map(a=>({res:a,messageId:s.id}))).toPromise()}function aj({fetch:t,MU_URL:e,logger:r}){let n=r.child("deployProcess");return i=>st(i).chain(Tt(({data:s,tags:a,signer:o})=>o({data:s,tags:a}))).chain(s=>st(s).chain(Tt(async a=>t(e,{method:"POST",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},body:a.raw}))).bichain(a=>Rc(new Error(`Error while communicating with MU: ${JSON.stringify(a)}`)),Tt(async a=>{if(a.ok)return a.json();throw new Error(`${a.status}: ${await a.text()}`)})).bimap(n.tap("Error encountered when deploying process via MU"),n.tap("Successfully deployed process via MU")).map(a=>({res:a,processId:s.id}))).toPromise()}function oj({fetch:t,MU_URL:e,logger:r}){let n=r.child("deployMonitor");return i=>st(i).chain(Tt(({processId:s,data:a,tags:o,anchor:c,signer:u})=>u({data:a,tags:o,target:s,anchor:c}))).chain(s=>st(s).chain(Tt(async a=>t(e+"/monitor/"+i.processId,{method:"POST",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},body:a.raw}))).bichain(a=>Rc(new Error(`Error while communicating with MU: ${JSON.stringify(a)}`)),Tt(async a=>{if(a.ok)return{ok:!0};throw new Error(`${a.status}: ${await a.text()}`)})).bimap(n.tap("Error encountered when subscribing to process via MU"),n.tap("Successfully subscribed to process via MU")).map(a=>({res:a,messageId:s.id}))).toPromise()}function cj({fetch:t,MU_URL:e,logger:r}){let n=r.child("deployUnmonitor");return i=>st(i).chain(Tt(({processId:s,data:a,tags:o,anchor:c,signer:u})=>u({data:a,tags:o,target:s,anchor:c}))).chain(s=>st(s).chain(Tt(async a=>t(e+"/monitor/"+i.processId,{method:"DELETE",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},body:a.raw}))).bichain(a=>Rc(new Error(`Error while communicating with MU: ${JSON.stringify(a)}`)),Tt(async a=>{if(a.ok)return{ok:!0};throw new Error(`${a.status}: ${await a.text()}`)})).bimap(n.tap("Error encountered when unsubscribing to process via MU"),n.tap("Successfully unsubscribed to process via MU")).map(a=>({res:a,messageId:s.id}))).toPromise()}function uj({fetch:t,CU_URL:e,logger:r}){return n=>st(n).map(r.tap("posting dryrun request to CU")).chain(Tt(i=>t(`${e}/dry-run?process-id=${i.Target}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}).then(s=>s.json()))).toPromise()}function lj({fetch:t,CU_URL:e,logger:r}){return({id:n,processId:i})=>st(`${e}/result/${n}?process-id=${i}`).map(r.tap("fetching message result from CU")).chain(Tt(async s=>t(s,{method:"GET",headers:{Accept:"application/json"}}).then(a=>a.json()))).toPromise()}function fj({fetch:t,CU_URL:e,logger:r}){return({process:n,from:i,to:s,sort:a,limit:o})=>{let c=new URL(`${e}/results/${n}`),u=new URLSearchParams(c.search);return i&&u.append("from",i),s&&u.append("to",s),a&&u.append("sort",a),o&&u.append("limit",o),c.search=u,st(c.toString()).map(r.tap("fetching message result from CU")).chain(Tt(async l=>t(l,{method:"GET",headers:{Accept:"application/json"}}).then(h=>h.json()))).toPromise()}}var y2=({fetch:t})=>async({suUrl:e,processId:r})=>t(`${e}/processes/${r}`,{method:"GET"}).then(n=>n.json()),hj=function(){return!1},dj=hj,pj=function(){return!0},F3=pj,uo={"@@functional/placeholder":!0};function Ut(t){return t!=null&&typeof t=="object"&&t["@@functional/placeholder"]===!0}function yr(t){return function e(r){return arguments.length===0||Ut(r)?e:t.apply(this,arguments)}}function _t(t){return function e(r,n){switch(arguments.length){case 0:return e;case 1:return Ut(r)?e:yr(function(i){return t(r,i)});default:return Ut(r)&&Ut(n)?e:Ut(r)?yr(function(i){return t(i,n)}):Ut(n)?yr(function(i){return t(r,i)}):t(r,n)}}}function gj(t,e){t=t||[],e=e||[];var r,n=t.length,i=e.length,s=[];for(r=0;r=arguments.length)?c=e[a]:(c=arguments[i],i+=1),n[a]=c,Ut(c)?o=!0:s-=1,a+=1}return!o&&s<=0?r.apply(this,n):Rp(Math.max(0,s),V_(t,n,r))}}var mj=_t(function(t,e){return t===1?yr(e):Rp(t,V_(t,[],e))}),yv=mj;function nl(t){return function e(r,n,i){switch(arguments.length){case 0:return e;case 1:return Ut(r)?e:_t(function(s,a){return t(r,s,a)});case 2:return Ut(r)&&Ut(n)?e:Ut(r)?_t(function(s,a){return t(s,n,a)}):Ut(n)?_t(function(s,a){return t(r,s,a)}):yr(function(s){return t(r,n,s)});default:return Ut(r)&&Ut(n)&&Ut(i)?e:Ut(r)&&Ut(n)?_t(function(s,a){return t(s,a,i)}):Ut(r)&&Ut(i)?_t(function(s,a){return t(s,n,a)}):Ut(n)&&Ut(i)?_t(function(s,a){return t(r,s,a)}):Ut(r)?yr(function(s){return t(s,n,i)}):Ut(n)?yr(function(s){return t(r,s,i)}):Ut(i)?yr(function(s){return t(r,n,s)}):t(r,n,i)}}}var yh=Array.isArray||function(t){return t!=null&&t.length>=0&&Object.prototype.toString.call(t)==="[object Array]"};function vj(t){return t!=null&&typeof t["@@transducer/step"]=="function"}function xv(t,e,r){return function(){if(arguments.length===0)return r();var n=arguments[arguments.length-1];if(!yh(n)){for(var i=0;i=0;)e=YE[r],xh(e,t)&&!Aj(n,e)&&(n[n.length]=e),r-=1;return n}),bh=Sj,Cj=yr(function(t){return t===null?"Null":t===void 0?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}),t6=Cj;function r6(t,e,r,n){var i=JE(t),s=JE(e);function a(o,c){return T3(o,c,r.slice(),n.slice())}return!XE(function(o,c){return!XE(a,c,o)},s,i)}function T3(t,e,r,n){if(x2(t,e))return!0;var i=t6(t);if(i!==t6(e))return!1;if(typeof t["fantasy-land/equals"]=="function"||typeof e["fantasy-land/equals"]=="function")return typeof t["fantasy-land/equals"]=="function"&&t["fantasy-land/equals"](e)&&typeof e["fantasy-land/equals"]=="function"&&e["fantasy-land/equals"](t);if(typeof t.equals=="function"||typeof e.equals=="function")return typeof t.equals=="function"&&t.equals(e)&&typeof e.equals=="function"&&e.equals(t);switch(i){case"Arguments":case"Array":case"Object":if(typeof t.constructor=="function"&&yj(t.constructor)==="Promise")return t===e;break;case"Boolean":case"Number":case"String":if(!(typeof t==typeof e&&x2(t.valueOf(),e.valueOf())))return!1;break;case"Date":if(!x2(t.valueOf(),e.valueOf()))return!1;break;case"Error":return t.name===e.name&&t.message===e.message;case"RegExp":if(!(t.source===e.source&&t.global===e.global&&t.ignoreCase===e.ignoreCase&&t.multiline===e.multiline&&t.sticky===e.sticky&&t.unicode===e.unicode))return!1;break}for(var s=r.length-1;s>=0;){if(r[s]===t)return n[s]===e;s-=1}switch(i){case"Map":return t.size!==e.size?!1:r6(t.entries(),e.entries(),r.concat([t]),n.concat([e]));case"Set":return t.size!==e.size?!1:r6(t.values(),e.values(),r.concat([t]),n.concat([e]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var a=bh(t);if(a.length!==bh(e).length)return!1;var o=r.concat([t]),c=n.concat([e]);for(s=a.length-1;s>=0;){var u=a[s];if(!(xh(u,e)&&T3(e[u],t[u],o,c)))return!1;s-=1}return!0}var _j=_t(function(t,e){return T3(t,e,[],[])}),lf=_j;function kj(t,e,r){var n,i;if(typeof t.indexOf=="function")switch(typeof e){case"number":if(e===0){for(n=1/e;r=0}function ig(t,e){for(var r=0,n=e.length,i=Array(n);r":G_(s,a)},n=function(s,a){return ig(function(o){return b2(o)+": "+r(s[o])},a.slice().sort())};switch(Object.prototype.toString.call(t)){case"[object Arguments]":return"(function() { return arguments; }("+ig(r,t).join(", ")+"))";case"[object Array]":return"["+ig(r,t).concat(n(t,W_(function(s){return/^\d+$/.test(s)},bh(t)))).join(", ")+"]";case"[object Boolean]":return typeof t=="object"?"new Boolean("+r(t.valueOf())+")":t.toString();case"[object Date]":return"new Date("+(isNaN(t.valueOf())?r(NaN):b2(Ij(t)))+")";case"[object Map]":return"new Map("+r(Array.from(t))+")";case"[object Null]":return"null";case"[object Number]":return typeof t=="object"?"new Number("+r(t.valueOf())+")":1/t===-1/0?"-0":t.toString(10);case"[object Set]":return"new Set("+r(Array.from(t).sort())+")";case"[object String]":return typeof t=="object"?"new String("+r(t.valueOf())+")":b2(t);case"[object Undefined]":return"undefined";default:if(typeof t.toString=="function"){var i=t.toString();if(i!=="[object Object]")return i}return"{"+n(t,bh(t)).join(", ")+"}"}}var Lj=yr(function(t){return G_(t,[])}),ff=Lj,jj=_t(function(t,e){if(t===e)return e;function r(o,c){if(o>c!=c>o)return c>o?c:o}var n=r(t,e);if(n!==void 0)return n;var i=r(typeof t,typeof e);if(i!==void 0)return i===typeof t?t:e;var s=ff(t),a=r(s,ff(e));return a!==void 0&&a===s?t:e}),Z_=jj,Uj=function(){function t(e,r){this.xf=r,this.f=e}return t.prototype["@@transducer/init"]=ha.init,t.prototype["@@transducer/result"]=ha.result,t.prototype["@@transducer/step"]=function(e,r){return this.xf["@@transducer/step"](e,this.f(r))},t}(),$j=function(t){return function(e){return new Uj(t,e)}},J_=$j,Hj=_t(xv(["fantasy-land/map","map"],J_,function(t,e){switch(Object.prototype.toString.call(e)){case"[object Function]":return yv(e.length,function(){return t.call(this,e.apply(this,arguments))});case"[object Object]":return K_(function(r,n){return r[n]=t(e[n]),r},{},bh(e));default:return ig(t,e)}})),bv=Hj,wv=Number.isInteger||function(t){return t<<0===t};function im(t){return Object.prototype.toString.call(t)==="[object String]"}var zj=_t(function(t,e){var r=t<0?e.length+t:t;return im(e)?e.charAt(r):e[r]}),X_=zj,Vj=_t(function(t,e){if(e!=null)return wv(t)?X_(t,e):e[t]}),Mc=Vj,qj=_t(function(t,e){return bv(Mc(t),e)}),Kj=qj,Wj=yr(function(t){return yh(t)?!0:!t||typeof t!="object"||im(t)?!1:t.length===0?!0:t.length>0?t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1):!1}),P3=Wj,n6=typeof Symbol<"u"?Symbol.iterator:"@@iterator";function Gj(t,e,r){return function(n,i,s){if(P3(s))return t(n,i,s);if(s==null)return i;if(typeof s["fantasy-land/reduce"]=="function")return e(n,i,s,"fantasy-land/reduce");if(s[n6]!=null)return r(n,i,s[n6]());if(typeof s.next=="function")return r(n,i,s);if(typeof s.reduce=="function")return e(n,i,s,"reduce");throw new TypeError("reduce: list must be array or iterable")}}function Q_(t,e,r){for(var n=0,i=r.length;n1){var s=!sm(n)&&xh(i,n)&&typeof n[i]=="object"?n[i]:wv(e[1])?[]:{};r=t(Array.prototype.slice.call(e,1),r,s)}return oU(i,r,n)}),lU=uU,fU=nl(function(t,e,r){return lU([t],e,r)}),_s=fU;function nw(t){var e=Object.prototype.toString.call(t);return e==="[object Function]"||e==="[object AsyncFunction]"||e==="[object GeneratorFunction]"||e==="[object AsyncGeneratorFunction]"}function hU(t){return function e(r){for(var n,i,s,a=[],o=0,c=r.length;oi;function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let s={};for(let a of i)s[a]=a;return s},t.getValidEnumValues=i=>{let s=t.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),a={};for(let o of s)a[o]=i[o];return t.objectValues(a)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&s.push(a);return s},t.find=(i,s)=>{for(let a of i)if(s(a))return a},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(yt||(yt={}));var sw;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(sw||(sw={}));var je=yt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Vo=t=>{switch(typeof t){case"undefined":return je.undefined;case"string":return je.string;case"number":return isNaN(t)?je.nan:je.number;case"boolean":return je.boolean;case"function":return je.function;case"bigint":return je.bigint;case"symbol":return je.symbol;case"object":return Array.isArray(t)?je.array:t===null?je.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?je.promise:typeof Map<"u"&&t instanceof Map?je.map:typeof Set<"u"&&t instanceof Set?je.set:typeof Date<"u"&&t instanceof Date?je.date:je.object;default:return je.unknown}},De=yt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),t$=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Di=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(s){return s.message},n={_errors:[]},i=s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let o=n,c=0;for(;cr.message){let r={},n=[];for(let i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Di.create=t=>new Di(t);var Fd=(t,e)=>{let r;switch(t.code){case De.invalid_type:t.received===je.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case De.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,yt.jsonStringifyReplacer)}`;break;case De.unrecognized_keys:r=`Unrecognized key(s) in object: ${yt.joinValues(t.keys,", ")}`;break;case De.invalid_union:r="Invalid input";break;case De.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${yt.joinValues(t.options)}`;break;case De.invalid_enum_value:r=`Invalid enum value. Expected ${yt.joinValues(t.options)}, received '${t.received}'`;break;case De.invalid_arguments:r="Invalid function arguments";break;case De.invalid_return_type:r="Invalid function return type";break;case De.invalid_date:r="Invalid date";break;case De.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:yt.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case De.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case De.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case De.custom:r="Invalid input";break;case De.invalid_intersection_types:r="Intersection results could not be merged";break;case De.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case De.not_finite:r="Number must be finite";break;default:r=e.defaultError,yt.assertNever(t)}return{message:r}},ik=Fd;function r$(t){ik=t}function am(){return ik}var om=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,s=[...r,...i.path||[]],a={...i,path:s},o="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)o=u(a,{data:e,defaultError:o}).message;return{...i,path:s,message:i.message||o}},n$=[];function $e(t,e){let r=om({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,am(),Fd].filter(n=>!!n)});t.common.issues.push(r)}var Un=class sk{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return tt;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r)n.push({key:await i.key,value:await i.value});return sk.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:s,value:a}=i;if(s.status==="aborted"||a.status==="aborted")return tt;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(n[s.value]=a.value)}return{status:e.value,value:n}}},tt=Object.freeze({status:"aborted"}),ak=t=>({status:"dirty",value:t}),Sn=t=>({status:"valid",value:t}),aw=t=>t.status==="aborted",ow=t=>t.status==="dirty",Td=t=>t.status==="valid",cm=t=>typeof Promise<"u"&&t instanceof Promise,Ge;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Ge||(Ge={}));var da=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},s6=(t,e)=>{if(Td(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Di(t.common.issues);return this._error=r,this._error}}};function rt(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>s.code!=="invalid_type"?{message:a.defaultError}:typeof a.data>"u"?{message:n??a.defaultError}:{message:r??a.defaultError},description:i}}var it=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Vo(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Vo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Un,ctx:{common:e.parent.common,data:e.data,parsedType:Vo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(cm(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let i={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vo(e)},s=this._parseSync({data:e,path:i.path,parent:i});return s6(i,s)}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vo(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(cm(i)?i:Promise.resolve(i));return s6(n,s)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,s)=>{let a=e(i),o=()=>s.addIssue({code:De.custom,...n(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new ks({schema:this,typeName:Qe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return to.create(this,this._def)}nullable(){return Vu.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return zu.create(this,this._def)}promise(){return Ch.create(this,this._def)}or(e){return Ld.create([this,e],this._def)}and(e){return jd.create(this,e,this._def)}transform(e){return new ks({...rt(this._def),schema:this,typeName:Qe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new zd({...rt(this._def),innerType:this,defaultValue:r,typeName:Qe.ZodDefault})}brand(){return new pk({typeName:Qe.ZodBranded,type:this,...rt(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new dm({...rt(this._def),innerType:this,catchValue:r,typeName:Qe.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return M3.create(this,e)}readonly(){return gm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},i$=/^c[^\s-]{8,}$/i,s$=/^[a-z][a-z0-9]*$/,a$=/^[0-9A-HJKMNP-TV-Z]{26}$/,o$=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,c$=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,u$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",w2,l$=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,f$=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,h$=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function d$(t,e){return!!((e==="v4"||!e)&&l$.test(t)||(e==="v6"||!e)&&f$.test(t))}var Ah=class L0 extends it{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==je.string){let i=this._getOrReturnCtx(e);return $e(i,{code:De.invalid_type,expected:je.string,received:i.parsedType}),tt}let r=new Un,n;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(n=this._getOrReturnCtx(e,n),$e(n,{code:De.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.lengthe.test(i),{validation:r,code:De.invalid_string,...Ge.errToObj(n)})}_addCheck(e){return new L0({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ge.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ge.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ge.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ge.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ge.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ge.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ge.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ge.errToObj(e)})}datetime(e){var r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!==null&&r!==void 0?r:!1,...Ge.errToObj(e==null?void 0:e.message)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Ge.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...Ge.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Ge.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Ge.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Ge.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Ge.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Ge.errToObj(r)})}nonempty(e){return this.min(1,Ge.errToObj(e))}trim(){return new L0({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new L0({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new L0({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value{var e;return new Ah({checks:[],typeName:Qe.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...rt(t)})};function p$(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,s=parseInt(t.toFixed(i).replace(".","")),a=parseInt(e.toFixed(i).replace(".",""));return s%a/Math.pow(10,i)}var Pd=class cw extends it{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==je.number){let i=this._getOrReturnCtx(e);return $e(i,{code:De.invalid_type,expected:je.number,received:i.parsedType}),tt}let r,n=new Un;for(let i of this._def.checks)i.kind==="int"?yt.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{code:De.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),$e(r,{code:De.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?p$(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),$e(r,{code:De.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{code:De.not_finite,message:i.message}),n.dirty()):yt.assertNever(i);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Ge.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Ge.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Ge.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Ge.toString(r))}setLimit(e,r,n,i){return new cw({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Ge.toString(i)}]})}_addCheck(e){return new cw({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ge.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ge.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ge.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ge.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ge.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Ge.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Ge.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ge.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ge.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&yt.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.valuenew Pd({checks:[],typeName:Qe.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...rt(t)});var Nd=class uw extends it{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==je.bigint){let i=this._getOrReturnCtx(e);return $e(i,{code:De.invalid_type,expected:je.bigint,received:i.parsedType}),tt}let r,n=new Un;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),$e(r,{code:De.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),$e(r,{code:De.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):yt.assertNever(i);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Ge.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Ge.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Ge.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Ge.toString(r))}setLimit(e,r,n,i){return new uw({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Ge.toString(i)}]})}_addCheck(e){return new uw({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ge.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ge.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ge.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ge.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Ge.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value{var e;return new Nd({checks:[],typeName:Qe.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...rt(t)})};var Od=class extends it{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==je.boolean){let e=this._getOrReturnCtx(t);return $e(e,{code:De.invalid_type,expected:je.boolean,received:e.parsedType}),tt}return Sn(t.data)}};Od.create=t=>new Od({typeName:Qe.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...rt(t)});var Dd=class ok extends it{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==je.date){let i=this._getOrReturnCtx(e);return $e(i,{code:De.invalid_type,expected:je.date,received:i.parsedType}),tt}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return $e(i,{code:De.invalid_date}),tt}let r=new Un,n;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(n=this._getOrReturnCtx(e,n),$e(n,{code:De.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):yt.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ok({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Ge.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Ge.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Dd({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Qe.ZodDate,...rt(t)});var um=class extends it{_parse(t){if(this._getType(t)!==je.symbol){let e=this._getOrReturnCtx(t);return $e(e,{code:De.invalid_type,expected:je.symbol,received:e.parsedType}),tt}return Sn(t.data)}};um.create=t=>new um({typeName:Qe.ZodSymbol,...rt(t)});var Rd=class extends it{_parse(t){if(this._getType(t)!==je.undefined){let e=this._getOrReturnCtx(t);return $e(e,{code:De.invalid_type,expected:je.undefined,received:e.parsedType}),tt}return Sn(t.data)}};Rd.create=t=>new Rd({typeName:Qe.ZodUndefined,...rt(t)});var Md=class extends it{_parse(t){if(this._getType(t)!==je.null){let e=this._getOrReturnCtx(t);return $e(e,{code:De.invalid_type,expected:je.null,received:e.parsedType}),tt}return Sn(t.data)}};Md.create=t=>new Md({typeName:Qe.ZodNull,...rt(t)});var Sh=class extends it{constructor(){super(...arguments),this._any=!0}_parse(t){return Sn(t.data)}};Sh.create=t=>new Sh({typeName:Qe.ZodAny,...rt(t)});var Pu=class extends it{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Sn(t.data)}};Pu.create=t=>new Pu({typeName:Qe.ZodUnknown,...rt(t)});var lo=class extends it{_parse(e){let r=this._getOrReturnCtx(e);return $e(r,{code:De.invalid_type,expected:je.never,received:r.parsedType}),tt}};lo.create=t=>new lo({typeName:Qe.ZodNever,...rt(t)});var lm=class extends it{_parse(t){if(this._getType(t)!==je.undefined){let e=this._getOrReturnCtx(t);return $e(e,{code:De.invalid_type,expected:je.void,received:e.parsedType}),tt}return Sn(t.data)}};lm.create=t=>new lm({typeName:Qe.ZodVoid,...rt(t)});var zu=class ag extends it{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==je.array)return $e(r,{code:De.invalid_type,expected:je.array,received:r.parsedType}),tt;if(i.exactLength!==null){let a=r.data.length>i.exactLength.value,o=r.data.lengthi.maxLength.value&&($e(r,{code:De.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,o)=>i.type._parseAsync(new da(r,a,r.path,o)))).then(a=>Un.mergeArray(n,a));let s=[...r.data].map((a,o)=>i.type._parseSync(new da(r,a,r.path,o)));return Un.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new ag({...this._def,minLength:{value:e,message:Ge.toString(r)}})}max(e,r){return new ag({...this._def,maxLength:{value:e,message:Ge.toString(r)}})}length(e,r){return new ag({...this._def,exactLength:{value:e,message:Ge.toString(r)}})}nonempty(e){return this.min(1,e)}};zu.create=(t,e)=>new zu({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Qe.ZodArray,...rt(e)});function Bl(t){if(t instanceof zi){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=to.create(Bl(n))}return new zi({...t._def,shape:()=>e})}else return t instanceof zu?new zu({...t._def,type:Bl(t.element)}):t instanceof to?to.create(Bl(t.unwrap())):t instanceof Vu?Vu.create(Bl(t.unwrap())):t instanceof _c?_c.create(t.items.map(e=>Bl(e))):t}var zi=class rs extends it{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=yt.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==je.object){let c=this._getOrReturnCtx(e);return $e(c,{code:De.invalid_type,expected:je.object,received:c.parsedType}),tt}let{status:r,ctx:n}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof lo&&this._def.unknownKeys==="strip"))for(let c in n.data)s.includes(c)||a.push(c);let o=[];for(let c of s){let u=i[c],l=n.data[c];o.push({key:{status:"valid",value:c},value:u._parse(new da(n,l,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof lo){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)o.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(c==="strict")a.length>0&&($e(n,{code:De.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let l=n.data[u];o.push({key:{status:"valid",value:u},value:c._parse(new da(n,l,n.path,u)),alwaysSet:u in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of o){let l=await u.key;c.push({key:l,value:await u.value,alwaysSet:u.alwaysSet})}return c}).then(c=>Un.mergeObjectSync(r,c)):Un.mergeObjectSync(r,o)}get shape(){return this._def.shape()}strict(e){return Ge.errToObj,new rs({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,s,a,o;let c=(a=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(o=Ge.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new rs({...this._def,unknownKeys:"strip"})}passthrough(){return new rs({...this._def,unknownKeys:"passthrough"})}extend(e){return new rs({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new rs({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Qe.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new rs({...this._def,catchall:e})}pick(e){let r={};return yt.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new rs({...this._def,shape:()=>r})}omit(e){let r={};return yt.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new rs({...this._def,shape:()=>r})}deepPartial(){return Bl(this)}partial(e){let r={};return yt.objectKeys(this.shape).forEach(n=>{let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}),new rs({...this._def,shape:()=>r})}required(e){let r={};return yt.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof to;)i=i._def.innerType;r[n]=i}}),new rs({...this._def,shape:()=>r})}keyof(){return dk(yt.objectKeys(this.shape))}};zi.create=(t,e)=>new zi({shape:()=>t,unknownKeys:"strip",catchall:lo.create(),typeName:Qe.ZodObject,...rt(e)});zi.strictCreate=(t,e)=>new zi({shape:()=>t,unknownKeys:"strict",catchall:lo.create(),typeName:Qe.ZodObject,...rt(e)});zi.lazycreate=(t,e)=>new zi({shape:t,unknownKeys:"strip",catchall:lo.create(),typeName:Qe.ZodObject,...rt(e)});var Ld=class extends it{_parse(t){let{ctx:e}=this._processInputParams(t),r=this._def.options;function n(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return e.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new Di(a.ctx.common.issues));return $e(e,{code:De.invalid_union,unionErrors:s}),tt}if(e.common.async)return Promise.all(r.map(async i=>{let s={...e,common:{...e.common,issues:[]},parent:null};return{result:await i._parseAsync({data:e.data,path:e.path,parent:s}),ctx:s}})).then(n);{let i,s=[];for(let o of r){let c={...e,common:{...e.common,issues:[]},parent:null},u=o._parseSync({data:e.data,path:e.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return e.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(o=>new Di(o));return $e(e,{code:De.invalid_union,unionErrors:a}),tt}}get options(){return this._def.options}};Ld.create=(t,e)=>new Ld({options:t,typeName:Qe.ZodUnion,...rt(e)});var og=t=>t instanceof Ud?og(t.schema):t instanceof ks?og(t.innerType()):t instanceof $d?[t.value]:t instanceof Mp?t.options:t instanceof Hd?Object.keys(t.enum):t instanceof zd?og(t._def.innerType):t instanceof Rd?[void 0]:t instanceof Md?[null]:null,ck=class uk extends it{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==je.object)return $e(r,{code:De.invalid_type,expected:je.object,received:r.parsedType}),tt;let n=this.discriminator,i=r.data[n],s=this.optionsMap.get(i);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):($e(r,{code:De.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),tt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let s of r){let a=og(s.shape[e]);if(!a)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of a){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,s)}}return new uk({typeName:Qe.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...rt(n)})}};function lw(t,e){let r=Vo(t),n=Vo(e);if(t===e)return{valid:!0,data:t};if(r===je.object&&n===je.object){let i=yt.objectKeys(e),s=yt.objectKeys(t).filter(o=>i.indexOf(o)!==-1),a={...t,...e};for(let o of s){let c=lw(t[o],e[o]);if(!c.valid)return{valid:!1};a[o]=c.data}return{valid:!0,data:a}}else if(r===je.array&&n===je.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let s=0;s{if(aw(i)||aw(s))return tt;let a=lw(i.value,s.value);return a.valid?((ow(i)||ow(s))&&e.dirty(),{status:e.value,value:a.data}):($e(r,{code:De.invalid_intersection_types}),tt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>n(i,s)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};jd.create=(t,e,r)=>new jd({left:t,right:e,typeName:Qe.ZodIntersection,...rt(r)});var _c=class lk extends it{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==je.array)return $e(n,{code:De.invalid_type,expected:je.array,received:n.parsedType}),tt;if(n.data.lengththis._def.items.length&&($e(n,{code:De.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let o=this._def.items[a]||this._def.rest;return o?o._parse(new da(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>Un.mergeArray(r,s)):Un.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new lk({...this._def,rest:e})}};_c.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new _c({items:t,typeName:Qe.ZodTuple,rest:null,...rt(e)})};var fk=class fw extends it{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==je.object)return $e(n,{code:De.invalid_type,expected:je.object,received:n.parsedType}),tt;let i=[],s=this._def.keyType,a=this._def.valueType;for(let o in n.data)i.push({key:s._parse(new da(n,o,n.path,o)),value:a._parse(new da(n,n.data[o],n.path,o))});return n.common.async?Un.mergeObjectAsync(r,i):Un.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof it?new fw({keyType:e,valueType:r,typeName:Qe.ZodRecord,...rt(n)}):new fw({keyType:Ah.create(),valueType:e,typeName:Qe.ZodRecord,...rt(r)})}},fm=class extends it{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==je.map)return $e(r,{code:De.invalid_type,expected:je.map,received:r.parsedType}),tt;let n=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([a,o],c)=>({key:n._parse(new da(r,a,r.path,[c,"key"])),value:i._parse(new da(r,o,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let o of s){let c=await o.key,u=await o.value;if(c.status==="aborted"||u.status==="aborted")return tt;(c.status==="dirty"||u.status==="dirty")&&e.dirty(),a.set(c.value,u.value)}return{status:e.value,value:a}})}else{let a=new Map;for(let o of s){let c=o.key,u=o.value;if(c.status==="aborted"||u.status==="aborted")return tt;(c.status==="dirty"||u.status==="dirty")&&e.dirty(),a.set(c.value,u.value)}return{status:e.value,value:a}}}};fm.create=(t,e,r)=>new fm({valueType:e,keyType:t,typeName:Qe.ZodMap,...rt(r)});var hm=class hw extends it{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==je.set)return $e(n,{code:De.invalid_type,expected:je.set,received:n.parsedType}),tt;let i=this._def;i.minSize!==null&&n.data.sizei.maxSize.value&&($e(n,{code:De.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let s=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return tt;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let o=[...n.data.values()].map((c,u)=>s._parse(new da(n,c,n.path,u)));return n.common.async?Promise.all(o).then(c=>a(c)):a(o)}min(e,r){return new hw({...this._def,minSize:{value:e,message:Ge.toString(r)}})}max(e,r){return new hw({...this._def,maxSize:{value:e,message:Ge.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};hm.create=(t,e)=>new hm({valueType:t,minSize:null,maxSize:null,typeName:Qe.ZodSet,...rt(e)});var hk=class cg extends it{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==je.function)return $e(r,{code:De.invalid_type,expected:je.function,received:r.parsedType}),tt;function n(o,c){return om({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,am(),Fd].filter(u=>!!u),issueData:{code:De.invalid_arguments,argumentsError:c}})}function i(o,c){return om({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,am(),Fd].filter(u=>!!u),issueData:{code:De.invalid_return_type,returnTypeError:c}})}let s={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Ch){let o=this;return Sn(async function(...c){let u=new Di([]),l=await o._def.args.parseAsync(c,s).catch(f=>{throw u.addIssue(n(c,f)),u}),h=await Reflect.apply(a,this,l);return await o._def.returns._def.type.parseAsync(h,s).catch(f=>{throw u.addIssue(i(h,f)),u})})}else{let o=this;return Sn(function(...c){let u=o._def.args.safeParse(c,s);if(!u.success)throw new Di([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),h=o._def.returns.safeParse(l,s);if(!h.success)throw new Di([i(l,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new cg({...this._def,args:_c.create(e).rest(Pu.create())})}returns(e){return new cg({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new cg({args:e||_c.create([]).rest(Pu.create()),returns:r||Pu.create(),typeName:Qe.ZodFunction,...rt(n)})}},Ud=class extends it{get schema(){return this._def.getter()}_parse(t){let{ctx:e}=this._processInputParams(t);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}};Ud.create=(t,e)=>new Ud({getter:t,typeName:Qe.ZodLazy,...rt(e)});var $d=class extends it{_parse(t){if(t.data!==this._def.value){let e=this._getOrReturnCtx(t);return $e(e,{received:e.data,code:De.invalid_literal,expected:this._def.value}),tt}return{status:"valid",value:t.data}}get value(){return this._def.value}};$d.create=(t,e)=>new $d({value:t,typeName:Qe.ZodLiteral,...rt(e)});function dk(t,e){return new Mp({values:t,typeName:Qe.ZodEnum,...rt(e)})}var Mp=class dw extends it{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return $e(r,{expected:yt.joinValues(n),received:r.parsedType,code:De.invalid_type}),tt}if(this._def.values.indexOf(e.data)===-1){let r=this._getOrReturnCtx(e),n=this._def.values;return $e(r,{received:r.data,code:De.invalid_enum_value,options:n}),tt}return Sn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e){return dw.create(e)}exclude(e){return dw.create(this.options.filter(r=>!e.includes(r)))}};Mp.create=dk;var Hd=class extends it{_parse(t){let e=yt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==je.string&&r.parsedType!==je.number){let n=yt.objectValues(e);return $e(r,{expected:yt.joinValues(n),received:r.parsedType,code:De.invalid_type}),tt}if(e.indexOf(t.data)===-1){let n=yt.objectValues(e);return $e(r,{received:r.data,code:De.invalid_enum_value,options:n}),tt}return Sn(t.data)}get enum(){return this._def.values}};Hd.create=(t,e)=>new Hd({values:t,typeName:Qe.ZodNativeEnum,...rt(e)});var Ch=class extends it{unwrap(){return this._def.type}_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==je.promise&&e.common.async===!1)return $e(e,{code:De.invalid_type,expected:je.promise,received:e.parsedType}),tt;let r=e.parsedType===je.promise?e.data:Promise.resolve(e.data);return Sn(r.then(n=>this._def.type.parseAsync(n,{path:e.path,errorMap:e.common.contextualErrorMap})))}};Ch.create=(t,e)=>new Ch({type:t,typeName:Qe.ZodPromise,...rt(e)});var ks=class extends it{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Qe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:a=>{$e(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let a=i.transform(n.data,s);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(a).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:a,path:n.path,parent:n})}if(i.type==="refinement"){let a=o=>{let c=i.refinement(o,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?tt:(o.status==="dirty"&&r.dirty(),a(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?tt:(o.status==="dirty"&&r.dirty(),a(o.value).then(()=>({status:r.value,value:o.value}))))}if(i.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Td(a))return a;let o=i.transform(a.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Td(a)?Promise.resolve(i.transform(a.value,s)).then(o=>({status:r.value,value:o})):a);yt.assertNever(i)}};ks.create=(t,e,r)=>new ks({schema:t,typeName:Qe.ZodEffects,effect:e,...rt(r)});ks.createWithPreprocess=(t,e,r)=>new ks({schema:e,effect:{type:"preprocess",transform:t},typeName:Qe.ZodEffects,...rt(r)});var to=class extends it{_parse(t){return this._getType(t)===je.undefined?Sn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};to.create=(t,e)=>new to({innerType:t,typeName:Qe.ZodOptional,...rt(e)});var Vu=class extends it{_parse(e){return this._getType(e)===je.null?Sn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Vu.create=(t,e)=>new Vu({innerType:t,typeName:Qe.ZodNullable,...rt(e)});var zd=class extends it{_parse(t){let{ctx:e}=this._processInputParams(t),r=e.data;return e.parsedType===je.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:e.path,parent:e})}removeDefault(){return this._def.innerType}};zd.create=(t,e)=>new zd({innerType:t,typeName:Qe.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...rt(e)});var dm=class extends it{_parse(t){let{ctx:e}=this._processInputParams(t),r={...e,common:{...e.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return cm(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Di(r.common.issues)},input:r.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Di(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};dm.create=(t,e)=>new dm({innerType:t,typeName:Qe.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...rt(e)});var pm=class extends it{_parse(t){if(this._getType(t)!==je.nan){let e=this._getOrReturnCtx(t);return $e(e,{code:De.invalid_type,expected:je.nan,received:e.parsedType}),tt}return{status:"valid",value:t.data}}};pm.create=t=>new pm({typeName:Qe.ZodNaN,...rt(t)});var g$=Symbol("zod_brand"),pk=class extends it{_parse(t){let{ctx:e}=this._processInputParams(t),r=e.data;return this._def.type._parse({data:r,path:e.path,parent:e})}unwrap(){return this._def.type}},M3=class gk extends it{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?tt:i.status==="dirty"?(r.dirty(),ak(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?tt:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new gk({in:e,out:r,typeName:Qe.ZodPipeline})}},gm=class extends it{_parse(t){let e=this._def.innerType._parse(t);return Td(e)&&(e.value=Object.freeze(e.value)),e}};gm.create=(t,e)=>new gm({innerType:t,typeName:Qe.ZodReadonly,...rt(e)});var mk=(t,e={},r)=>t?Sh.create().superRefine((n,i)=>{var s,a;if(!t(n)){let o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(a=(s=o.fatal)!==null&&s!==void 0?s:r)!==null&&a!==void 0?a:!0,u=typeof o=="string"?{message:o}:o;i.addIssue({code:"custom",...u,fatal:c})}}):Sh.create(),m$={object:zi.lazycreate},Qe;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Qe||(Qe={}));var v$=(t,e={message:`Input not instance of ${t.name}`})=>mk(r=>r instanceof t,e),vk=Ah.create,yk=Pd.create,y$=pm.create,x$=Nd.create,xk=Od.create,b$=Dd.create,w$=um.create,E$=Rd.create,A$=Md.create,S$=Sh.create,C$=Pu.create,_$=lo.create,k$=lm.create,B$=zu.create,I$=zi.create,F$=zi.strictCreate,T$=Ld.create,P$=ck.create,N$=jd.create,O$=_c.create,D$=fk.create,R$=fm.create,M$=hm.create,L$=hk.create,j$=Ud.create,U$=$d.create,$$=Mp.create,H$=Hd.create,z$=Ch.create,a6=ks.create,V$=to.create,q$=Vu.create,K$=ks.createWithPreprocess,W$=M3.create,G$=()=>vk().optional(),Z$=()=>yk().optional(),J$=()=>xk().optional(),X$={string:t=>Ah.create({...t,coerce:!0}),number:t=>Pd.create({...t,coerce:!0}),boolean:t=>Od.create({...t,coerce:!0}),bigint:t=>Nd.create({...t,coerce:!0}),date:t=>Dd.create({...t,coerce:!0})},Q$=tt,be=Object.freeze({__proto__:null,defaultErrorMap:Fd,setErrorMap:r$,getErrorMap:am,makeIssue:om,EMPTY_PATH:n$,addIssueToContext:$e,ParseStatus:Un,INVALID:tt,DIRTY:ak,OK:Sn,isAborted:aw,isDirty:ow,isValid:Td,isAsync:cm,get util(){return yt},get objectUtil(){return sw},ZodParsedType:je,getParsedType:Vo,ZodType:it,ZodString:Ah,ZodNumber:Pd,ZodBigInt:Nd,ZodBoolean:Od,ZodDate:Dd,ZodSymbol:um,ZodUndefined:Rd,ZodNull:Md,ZodAny:Sh,ZodUnknown:Pu,ZodNever:lo,ZodVoid:lm,ZodArray:zu,ZodObject:zi,ZodUnion:Ld,ZodDiscriminatedUnion:ck,ZodIntersection:jd,ZodTuple:_c,ZodRecord:fk,ZodMap:fm,ZodSet:hm,ZodFunction:hk,ZodLazy:Ud,ZodLiteral:$d,ZodEnum:Mp,ZodNativeEnum:Hd,ZodPromise:Ch,ZodEffects:ks,ZodTransformer:ks,ZodOptional:to,ZodNullable:Vu,ZodDefault:zd,ZodCatch:dm,ZodNaN:pm,BRAND:g$,ZodBranded:pk,ZodPipeline:M3,ZodReadonly:gm,custom:mk,Schema:it,ZodSchema:it,late:m$,get ZodFirstPartyTypeKind(){return Qe},coerce:X$,any:S$,array:B$,bigint:x$,boolean:xk,date:b$,discriminatedUnion:P$,effect:a6,enum:$$,function:L$,instanceof:v$,intersection:N$,lazy:j$,literal:U$,map:R$,nan:y$,nativeEnum:H$,never:_$,null:A$,nullable:q$,number:yk,object:I$,oboolean:J$,onumber:Z$,optional:V$,ostring:G$,pipeline:W$,preprocess:K$,promise:z$,record:D$,set:M$,strictObject:F$,string:vk,symbol:w$,transformer:a6,tuple:O$,undefined:E$,union:T$,unknown:C$,void:k$,NEVER:Q$,ZodIssueCode:De,quotelessJson:t$,ZodError:Di});function Y$({fetch:t,GATEWAY_URL:e}){let r=` - query GetTransactions ($transactionIds: [ID!]!) { - transactions(ids: $transactionIds) { - edges { - node { - owner { - address - } - tags { - name - value - } - block { - id - height - timestamp - } - } - } - } - }`,n=be.object({data:be.object({transactions:be.object({edges:be.array(be.object({node:be.record(be.any())}))})})});return i=>st(i).chain(Tt(s=>t(`${e}/graphql`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:r,variables:{transactionIds:[s]}})}).then(a=>a.json()).then(n.parse).then(WU(["data","transactions","edges","0","node"])))).toPromise()}var eH=S_(EM(),1),bk=(t="@permaweb/aoconnect")=>{let e=(0,eH.default)(t);return e.child=r=>bk(`${e.namespace}:${r}`),e.tap=(r,...n)=>e$((...i)=>e(r,...n,...i)),e};function wk(t){return Eh(Ev([]),wh((e,r)=>Eh(JU([],r.name),O3(r.value),_s(r.name,uo,e))(e),{}),bv(e=>e.length>1?e:e[0]))(t)}function Ii(t,e){return r=>W_(iU([i6(t,"name"),R3(N3(e),i6(e,"value"),F3)]),r)}function mm(t){return nk([[nd(String),lf(t)],[nd(Array),MU(t)],[F3,dj]])}function Ek(t=""){return t.endsWith("/")?Ek(t.slice(0,-1)):t}function Qh(t){let e;return nd(Di,t)?(e=new Error(tH(t)),e.stack+=t.stack):nd(Error,t)?e=t:OU("message",t)?e=new Error(t.message):nd(String,t)?e=new Error(t):e=new Error("An error occurred"),e}function tH(t){return Eh(e=>function r(n,i,s){return wh((a,o)=>Eh(nk([[lf(De.invalid_arguments),()=>r(o.argumentsError,422,"Invalid Arguments")],[lf(De.invalid_return_type),()=>r(o.returnTypeError,500,"Invalid Return")],[lf(De.invalid_union),()=>bU(c=>r(c,400,"Invalid Union"),o.unionErrors)],[F3,()=>[{...o,status:i,contextCode:s}]]]),D3(a))(o.code),[],n.issues)}(e,400,""),e=>wh((r,n)=>{let{message:i,path:s,contextCode:a}=n,o=s[1]||s[0],c=a?`${a} `:"";return r.push(`${c}'${o}': ${i}.`),r},[],e),zU(" | "))(t)}var rH=be.object({id:be.string().min(1,{message:"message is required to be a message id"}),processId:be.string().min(1,{message:"process is required to be a process id"})});function nH(){return t=>st(t).map(rH.parse).map(()=>t)}var Lp=be.object({name:be.string(),value:be.string()}),iH=be.function().args(be.object({Id:be.string(),Target:be.string(),Owner:be.string(),Anchor:be.string().optional(),Data:be.any().default("1234"),Tags:be.array(be.object({name:be.string(),value:be.string()}))})).returns(be.promise(be.any())),sH=be.function().args(be.object({id:be.string().min(1,{message:"message id is required"}),processId:be.string().min(1,{message:"process id is required"})})).returns(be.promise(be.any())),aH=be.function().args(be.object({process:be.string().min(1,{message:"process id is required"}),from:be.string().optional(),to:be.string().optional(),sort:be.enum(["ASC","DESC"]).default("ASC"),limit:be.string().optional()})).returns(be.promise(be.object({edges:be.array(be.object({cursor:be.string(),node:be.object({Output:be.any().optional(),Messages:be.array(be.any()).optional(),Spawns:be.array(be.any()).optional(),Error:be.any().optional()})}))}))),Ak=be.function().args(be.object({processId:be.string(),data:be.any(),tags:be.array(Lp),anchor:be.string().optional(),signer:be.any()})).returns(be.promise(be.object({messageId:be.string()}).passthrough())),oH=be.function().args(be.object({data:be.any(),tags:be.array(Lp),signer:be.any()})).returns(be.promise(be.object({processId:be.string()}).passthrough())),Sk=Ak,cH=be.function().args(be.object({suUrl:be.string().url(),processId:be.string()})).returns(be.promise(be.object({tags:be.array(Lp)}).passthrough())),uH=be.function().args(be.string()).returns(be.promise(be.object({url:be.string()}))),lH=be.function().args(be.string()).returns(be.promise(be.boolean())),fH=be.function().args(be.string()).returns(be.promise(be.object({tags:be.array(Lp)}).passthrough())),Av=be.function().args(be.object({data:be.any(),tags:be.array(Lp),target:be.string().optional(),anchor:be.string().optional()})).returns(be.promise(be.object({id:be.string(),raw:be.any()})));function hH({loadResult:t}){return t=Tt(sH.implement(t)),e=>st({id:e.id,processId:e.processId}).chain(t)}function dH(t){let e=nH(),r=hH(t);return({message:n,process:i})=>st({id:n,processId:i}).chain(e).chain(r).map(t.logger.tap('readResult result for message "%s": %O',n)).map(s=>s).bimap(Qh,Xh).toPromise()}function pH({loadProcessMeta:t,locateScheduler:e,logger:r}){let n=(i,s,a)=>o=>s(o[i])?Cc(o):Rc(`Tag '${i}': ${a}`);return t=Tt(cH.implement(t)),e=Tt(uH.implement(e)),i=>st(i).map(r.tap("Verifying Process")).map(r.tap("Locating Scheduler for Process to retrieve Process meta")).chain(e).chain(({url:s})=>t({suUrl:Ek(s),processId:i})).map(Mc("tags")).map(wk).chain(n("Data-Protocol",mm("ao"),"value 'ao' was not found on process")).chain(n("Type",mm("Process"),"value 'Process' was not found on process")).chain(n("Module",sg,"was not found on process"))}function L3(t){let e=pH(t);return r=>st(r.id).chain(e).map(()=>r)}var gH=be.array(be.object({name:be.string(),value:be.string()}));function mH(){return t=>st(t.tags).map(Ev([])).map(Ii("Data-Protocol","ao")).map(Ii("Variant")).map(Ii("Type")).map(Ii("SDK")).map(D3(uo,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Message"},{name:"SDK",value:"aoconnect"}])).map(gH.parse).map(_s("tags",uo,t))}function vH({logger:t}){return e=>st(e).chain(R3(N3(e.data),()=>Cc(e),()=>Cc(Math.random().toString().slice(-4)).map(_s("data",uo,e)).map(r=>Eh(Mc("tags"),Ii("Content-Type"),O3({name:"Content-Type",value:"text/plain"}),_s("tags",uo,r))(r)).map(t.tap('added pseudo-random string as message "data"'))))}function yH(t){let e=mH(),r=vH(t),n=Ak.implement(t.deployMessage);return i=>st(i).chain(e).chain(r).chain(Tt(({id:s,data:a,tags:o,anchor:c,signer:u})=>n({processId:s,data:a,tags:o,anchor:c,signer:Av.implement(u)}))).map(s=>_s("messageId",s.messageId,i))}function xH(t){let e=L3(t),r=yH(t);return({process:n,data:i,tags:s,anchor:a,signer:o})=>st({id:n,data:i,tags:s,anchor:a,signer:o}).chain(e).chain(r).map(c=>c.messageId).bimap(Qh,Xh).toPromise()}var A0=(t,e,r)=>n=>e(n[t])?Cc(n):Rc(`Tag '${t}': ${r}`);function bH({loadTransactionMeta:t,logger:e}){return t=Tt(fH.implement(t)),r=>st(r).chain(t).map(Mc("tags")).map(wk).chain(A0("Data-Protocol",mm("ao"),"value 'ao' was not found on module")).chain(A0("Type",mm("Module"),"value 'Module' was not found on module")).chain(A0("Module-Format",sg,"was not found on module")).chain(A0("Input-Encoding",sg,"was not found on module")).chain(A0("Output-Encoding",sg,"was not found on module")).bimap(e.tap("Verifying module source failed: %s"),e.tap("Verified module source"))}function wH({logger:t,validateScheduler:e}){return e=Tt(lH.implement(e)),r=>st(r).chain(n=>e(n).chain(i=>i?Cc(n):Rc(`Valid Scheduler-Location owned by ${n} not found`))).bimap(t.tap("Verifying scheduler failed: %s"),t.tap("Verified scheduler"))}function EH({logger:t}){return e=>st(e).map(t.tap("Checking for signer")).chain(r=>r?Cc(r):Rc("signer not found"))}function AH(t){let e=t.logger.child("verifyInput");t={...t,logger:e};let r=bH(t),n=wH(t),i=EH(t);return s=>st(s).chain(a=>r(a.module).map(()=>a)).chain(a=>n(a.scheduler)).map(()=>s).chain(a=>i(a.signer).map(()=>a)).bimap(e.tap("Error when verify input: %s"),e.tap("Successfully verified inputs"))}var SH=be.array(be.object({name:be.string(),value:be.string()}));function CH(){return t=>st(t).map(Mc("tags")).map(Ev([])).map(Ii("Data-Protocol","ao")).map(Ii("Variant")).map(Ii("Type")).map(Ii("Module")).map(Ii("Scheduler")).map(Ii("SDK")).map(D3(uo,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Process"},{name:"Module",value:t.module},{name:"Scheduler",value:t.scheduler},{name:"SDK",value:"aoconnect"}])).map(SH.parse).map(_s("tags",uo,t))}function _H({logger:t}){return e=>st(e).chain(R3(N3(e.data),()=>Cc(e),()=>Cc(Math.random().toString().slice(-4)).map(_s("data",uo,e)).map(r=>Eh(Mc("tags"),Ii("Content-Type"),O3({name:"Content-Type",value:"text/plain"}),_s("tags",uo,r))(r)).map(t.tap('added pseudo-random string as process "data"'))))}function kH(t){let e=t.logger.child("uploadProcess");t={...t,logger:e};let r=CH(),n=_H(t),i=oH.implement(t.deployProcess);return s=>st(s).chain(r).chain(n).chain(Tt(({data:a,tags:o,signer:c})=>i({data:a,tags:o,signer:Av.implement(c)}))).map(a=>_s("processId",a.processId,s))}function BH(t){let e=AH(t),r=kH(t);return({module:n,scheduler:i,signer:s,tags:a,data:o})=>st({module:n,scheduler:i,signer:s,tags:a,data:o}).chain(e).chain(r).map(c=>c.processId).bimap(Qh,Xh).toPromise()}function IH(t){let e=Sk.implement(t.deployMonitor);return r=>st(r).chain(Tt(({id:n,signer:i})=>e({processId:n,signer:Av.implement(i),data:Math.random().toString().slice(-4),tags:[]}))).map(n=>_s("monitorId",n.messageId,r))}function FH(t){let e=L3(t),r=IH(t);return({process:n,signer:i})=>st({id:n,signer:i}).chain(e).chain(r).map(s=>s.monitorId).bimap(Qh,Xh).toPromise()}function TH(t){let e=Sk.implement(t.deployUnmonitor);return r=>st(r).chain(Tt(({id:n,signer:i})=>e({processId:n,signer:Av.implement(i),data:Math.random().toString().slice(-4),tags:[]}))).map(n=>_s("monitorId",n.messageId,r))}function PH(t){let e=L3(t),r=TH(t);return({process:n,signer:i})=>st({id:n,signer:i}).chain(e).chain(r).map(s=>s.monitorId).bimap(Qh,Xh).toPromise()}var NH=be.object({process:be.string().min(1,{message:"process identifier is required"}),from:be.string().optional(),to:be.string().optional(),sort:be.enum(["ASC","DESC"]).default("ASC"),limit:be.string().optional()});function OH(){return t=>st(t).map(NH.parse).map(()=>t)}function DH({queryResults:t}){return t=Tt(aH.implement(t)),e=>st({process:e.process,from:e.from,to:e.to,sort:e.sort}).chain(t)}function RH(t){let e=OH(),r=DH(t);return({process:n,from:i,to:s,sort:a})=>st({process:n,from:i,to:s,sort:a}).chain(e).chain(r).map(t.logger.tap('readResults result for message "%s": %O',n)).map(o=>o).bimap(Qh,Xh).toPromise()}var MH=be.object({Id:be.string(),Target:be.string(),Owner:be.string(),Anchor:be.string().optional(),Data:be.any().default("1234"),Tags:be.array(be.object({name:be.string(),value:be.string()}))});function LH(){return t=>st(t).map(MH.parse).map(e=>(e.Tags=e.Tags.concat([{name:"Data-Protocol",value:"ao"},{name:"Type",value:"Message"},{name:"Variant",value:"ao.TN.1"}]),e))}function jH({dryrunFetch:t}){return Tt(iH.implement(t))}function UH(t){let e=LH(),r=jH(t);return n=>st(n).map($H).chain(e).chain(r).toPromise()}function $H({process:t,data:e,tags:r,anchor:n,...i}){return{Id:"1234",Owner:"1234",...i,Target:t,Data:e||"1234",Tags:r||[],Anchor:n||"0"}}var HH="https://arweave.net",zH="https://mu.ao-testnet.xyz",VH="https://cu.ao-testnet.xyz";function qu({GATEWAY_URL:t=HH,MU_URL:e=zH,CU_URL:r=VH}={}){let n=bk("@permaweb/ao-sdk"),{locate:i,validate:s}=z_({cacheSize:100,GATEWAY_URL:t}),a=n.child("result"),o=dH({loadResult:lj({fetch,CU_URL:r,logger:a}),logger:a}),c=n.child("message"),u=xH({loadProcessMeta:y2({fetch}),locateScheduler:i,deployMessage:sj({fetch,MU_URL:e,logger:c}),logger:c}),l=n.child("spawn"),h=BH({loadTransactionMeta:Y$({fetch,GATEWAY_URL:t}),validateScheduler:s,deployProcess:aj({fetch,MU_URL:e,logger:l}),logger:l}),f=n.child("monitor"),p=FH({loadProcessMeta:y2({fetch}),locateScheduler:i,deployMonitor:oj({fetch,MU_URL:e,logger:f}),logger:f}),d=n.child("unmonitor"),g=PH({loadProcessMeta:y2({fetch}),locateScheduler:i,deployUnmonitor:cj({fetch,MU_URL:e,logger:d}),logger:f}),y=n.child("results"),x=RH({queryResults:fj({fetch,CU_URL:r,logger:y}),logger:y}),b=n.child("dryrun"),S=UH({dryrunFetch:uj({fetch,CU_URL:r,logger:b}),logger:b});return{result:o,results:x,message:u,spawn:h,monitor:p,unmonitor:g,dryrun:S}}var Ck={};yM(Ck,{createDataItemSigner:()=>vz});var _k=S_(CM(),1),qH=Object.create,j3=Object.defineProperty,KH=Object.getOwnPropertyDescriptor,WH=Object.getOwnPropertyNames,GH=Object.getPrototypeOf,ZH=Object.prototype.hasOwnProperty,wo=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),JH=(t,e)=>{for(var r in e)j3(t,r,{get:e[r],enumerable:!0})},XH=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of WH(e))!ZH.call(t,i)&&i!==r&&j3(t,i,{get:()=>e[i],enumerable:!(n=KH(e,i))||n.enumerable});return t},il=(t,e,r)=>(r=t!=null?qH(GH(t)):{},XH(e||!t||!t.__esModule?j3(r,"default",{value:t,enumerable:!0}):r,t)),QH=wo(t=>{Object.defineProperty(t,"__esModule",{value:!0});function e(r){var n=4,i=r.length,s=i%n;if(!s)return r;var a=i,o=n-s,c=i+o,u=Buffer.alloc(c);for(u.write(r);o--;)u.write("=",a++);return u.toString()}t.default=e}),YH=wo(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=QH();function r(c,u){return u===void 0&&(u="utf8"),Buffer.isBuffer(c)?s(c.toString("base64")):s(Buffer.from(c,u).toString("base64"))}function n(c,u){return u===void 0&&(u="utf8"),Buffer.from(i(c),"base64").toString(u)}function i(c){return c=c.toString(),e.default(c).replace(/\-/g,"+").replace(/_/g,"/")}function s(c){return c.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function a(c){return Buffer.from(i(c),"base64")}var o=r;o.encode=r,o.decode=n,o.toBase64=i,o.fromBase64=s,o.toBuffer=a,t.default=o}),U3=wo((t,e)=>{e.exports=YH().default,e.exports.default=e.exports}),kk=wo(t=>{t.byteLength=c,t.toByteArray=l,t.fromByteArray=p;var e=[],r=[],n=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(s=0,a=i.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var y=d.indexOf("=");y===-1&&(y=g);var x=y===g?0:4-y%4;return[y,x]}function c(d){var g=o(d),y=g[0],x=g[1];return(y+x)*3/4-x}function u(d,g,y){return(g+y)*3/4-y}function l(d){var g,y=o(d),x=y[0],b=y[1],S=new n(u(d,x,b)),k=0,T=b>0?x-4:x,_;for(_=0;_>16&255,S[k++]=g>>8&255,S[k++]=g&255;return b===2&&(g=r[d.charCodeAt(_)]<<2|r[d.charCodeAt(_+1)]>>4,S[k++]=g&255),b===1&&(g=r[d.charCodeAt(_)]<<10|r[d.charCodeAt(_+1)]<<4|r[d.charCodeAt(_+2)]>>2,S[k++]=g>>8&255,S[k++]=g&255),S}function h(d){return e[d>>18&63]+e[d>>12&63]+e[d>>6&63]+e[d&63]}function f(d,g,y){for(var x,b=[],S=g;ST?T:k+S));return x===1?(g=d[y-1],b.push(e[g>>2]+e[g<<4&63]+"==")):x===2&&(g=(d[y-2]<<8)+d[y-1],b.push(e[g>>10]+e[g>>4&63]+e[g<<2&63]+"=")),b.join("")}}),Bk=wo(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var e=kk();function r(f){let p=0;for(let y=0;y{Object.defineProperty(t,"__esModule",{value:!0});var e=Bk(),r=class{constructor(){ae(this,"keyLength",4096);ae(this,"publicExponent",65537);ae(this,"hashAlgorithm","sha256");ae(this,"driver");if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let n=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),i=await this.driver.exportKey("jwk",n.privateKey);return{kty:i.kty,e:i.e,n:i.n,d:i.d,p:i.p,q:i.q,dp:i.dp,dq:i.dq,qi:i.qi}}async sign(n,i,{saltLength:s}={}){let a=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(n),i);return new Uint8Array(a)}async hash(n,i="SHA-256"){let s=await this.driver.digest(i,n);return new Uint8Array(s)}async verify(n,i,s){let a={kty:"RSA",e:"AQAB",n},o=await this.jwkToPublicCryptoKey(a),c=await this.driver.digest("SHA-256",i),u=await this.driver.verify({name:"RSA-PSS",saltLength:0},o,s,i),l=await this.driver.verify({name:"RSA-PSS",saltLength:32},o,s,i),h=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((o.algorithm.modulusLength-1)/8)-c.byteLength-2},o,s,i);return u||l||h}async jwkToCryptoKey(n){return this.driver.importKey("jwk",n,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(n){return this.driver.importKey("jwk",n,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let n=crypto==null?void 0:crypto.subtle;return n===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(i=>typeof n[i]=="function")}async encrypt(n,i,s){let a=await this.driver.importKey("raw",typeof i=="string"?e.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:s?e.stringToBuffer(s):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},a,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),c=new Uint8Array(16);crypto.getRandomValues(c);let u=await this.driver.encrypt({name:"AES-CBC",iv:c},o,n);return e.concatBuffers([c,u])}async decrypt(n,i,s){let a=await this.driver.importKey("raw",typeof i=="string"?e.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:s?e.stringToBuffer(s):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},a,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),c=n.slice(0,16),u=await this.driver.decrypt({name:"AES-CBC",iv:c},o,n.slice(16));return e.concatBuffers([u])}};t.default=r}),tz=wo(t=>{t.read=function(e,r,n,i,s){var a,o,c=s*8-i-1,u=(1<>1,h=-7,f=n?s-1:0,p=n?-1:1,d=e[r+f];for(f+=p,a=d&(1<<-h)-1,d>>=-h,h+=c;h>0;a=a*256+e[r+f],f+=p,h-=8);for(o=a&(1<<-h)-1,a>>=-h,h+=i;h>0;o=o*256+e[r+f],f+=p,h-=8);if(a===0)a=1-l;else{if(a===u)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,i),a=a-l}return(d?-1:1)*o*Math.pow(2,a-i)},t.write=function(e,r,n,i,s,a){var o,c,u,l=a*8-s-1,h=(1<>1,p=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:a-1,g=i?1:-1,y=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,o=h):(o=Math.floor(Math.log(r)/Math.LN2),r*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+f>=1?r+=p/u:r+=p*Math.pow(2,1-f),r*u>=2&&(o++,u/=2),o+f>=h?(c=0,o=h):o+f>=1?(c=(r*u-1)*Math.pow(2,s),o=o+f):(c=r*Math.pow(2,f-1)*Math.pow(2,s),o=0));s>=8;e[n+d]=c&255,d+=g,c/=256,s-=8);for(o=o<0;e[n+d]=o&255,d+=g,o/=256,l-=8);e[n+d-g]|=y*128}}),pw=wo(t=>{var e=kk(),r=tz(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=o,t.SlowBuffer=b,t.INSPECT_MAX_BYTES=50;var i=2147483647;t.kMaxLength=i,o.TYPED_ARRAY_SUPPORT=s(),!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 s(){try{let m=new Uint8Array(1),v={foo:function(){return 42}};return Object.setPrototypeOf(v,Uint8Array.prototype),Object.setPrototypeOf(m,v),m.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 a(m){if(m>i)throw new RangeError('The value "'+m+'" is invalid for option "size"');let v=new Uint8Array(m);return Object.setPrototypeOf(v,o.prototype),v}function o(m,v,w){if(typeof m=="number"){if(typeof v=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return h(m)}return c(m,v,w)}o.poolSize=8192;function c(m,v,w){if(typeof m=="string")return f(m,v);if(ArrayBuffer.isView(m))return d(m);if(m==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m);if(re(m,ArrayBuffer)||m&&re(m.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(re(m,SharedArrayBuffer)||m&&re(m.buffer,SharedArrayBuffer)))return g(m,v,w);if(typeof m=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let M=m.valueOf&&m.valueOf();if(M!=null&&M!==m)return o.from(M,v,w);let $=y(m);if($)return $;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof m[Symbol.toPrimitive]=="function")return o.from(m[Symbol.toPrimitive]("string"),v,w);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m)}o.from=function(m,v,w){return c(m,v,w)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function u(m){if(typeof m!="number")throw new TypeError('"size" argument must be of type number');if(m<0)throw new RangeError('The value "'+m+'" is invalid for option "size"')}function l(m,v,w){return u(m),m<=0?a(m):v!==void 0?typeof w=="string"?a(m).fill(v,w):a(m).fill(v):a(m)}o.alloc=function(m,v,w){return l(m,v,w)};function h(m){return u(m),a(m<0?0:x(m)|0)}o.allocUnsafe=function(m){return h(m)},o.allocUnsafeSlow=function(m){return h(m)};function f(m,v){if((typeof v!="string"||v==="")&&(v="utf8"),!o.isEncoding(v))throw new TypeError("Unknown encoding: "+v);let w=S(m,v)|0,M=a(w),$=M.write(m,v);return $!==w&&(M=M.slice(0,$)),M}function p(m){let v=m.length<0?0:x(m.length)|0,w=a(v);for(let M=0;M=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return m|0}function b(m){return+m!=m&&(m=0),o.alloc(+m)}o.isBuffer=function(m){return m!=null&&m._isBuffer===!0&&m!==o.prototype},o.compare=function(m,v){if(re(m,Uint8Array)&&(m=o.from(m,m.offset,m.byteLength)),re(v,Uint8Array)&&(v=o.from(v,v.offset,v.byteLength)),!o.isBuffer(m)||!o.isBuffer(v))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(m===v)return 0;let w=m.length,M=v.length;for(let $=0,W=Math.min(w,M);$M.length?(o.isBuffer(W)||(W=o.from(W)),W.copy(M,$)):Uint8Array.prototype.set.call(M,W,$);else if(o.isBuffer(W))W.copy(M,$);else throw new TypeError('"list" argument must be an Array of Buffers');$+=W.length}return M};function S(m,v){if(o.isBuffer(m))return m.length;if(ArrayBuffer.isView(m)||re(m,ArrayBuffer))return m.byteLength;if(typeof m!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof m);let w=m.length,M=arguments.length>2&&arguments[2]===!0;if(!M&&w===0)return 0;let $=!1;for(;;)switch(v){case"ascii":case"latin1":case"binary":return w;case"utf8":case"utf-8":return Y(m).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w*2;case"hex":return w>>>1;case"base64":return ge(m).length;default:if($)return M?-1:Y(m).length;v=(""+v).toLowerCase(),$=!0}}o.byteLength=S;function k(m,v,w){let M=!1;if((v===void 0||v<0)&&(v=0),v>this.length||((w===void 0||w>this.length)&&(w=this.length),w<=0)||(w>>>=0,v>>>=0,w<=v))return"";for(m||(m="utf8");;)switch(m){case"hex":return z(this,v,w);case"utf8":case"utf-8":return A(this,v,w);case"ascii":return H(this,v,w);case"latin1":case"binary":return G(this,v,w);case"base64":return F(this,v,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,v,w);default:if(M)throw new TypeError("Unknown encoding: "+m);m=(m+"").toLowerCase(),M=!0}}o.prototype._isBuffer=!0;function T(m,v,w){let M=m[v];m[v]=m[w],m[w]=M}o.prototype.swap16=function(){let m=this.length;if(m%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let v=0;vv&&(m+=" ... "),""},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(m,v,w,M,$){if(re(m,Uint8Array)&&(m=o.from(m,m.offset,m.byteLength)),!o.isBuffer(m))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof m);if(v===void 0&&(v=0),w===void 0&&(w=m?m.length:0),M===void 0&&(M=0),$===void 0&&($=this.length),v<0||w>m.length||M<0||$>this.length)throw new RangeError("out of range index");if(M>=$&&v>=w)return 0;if(M>=$)return-1;if(v>=w)return 1;if(v>>>=0,w>>>=0,M>>>=0,$>>>=0,this===m)return 0;let W=$-M,Z=w-v,Ee=Math.min(W,Z),Ue=this.slice(M,$),ke=m.slice(v,w);for(let Ie=0;Ie2147483647?w=2147483647:w<-2147483648&&(w=-2147483648),w=+w,Ce(w)&&(w=$?0:m.length-1),w<0&&(w=m.length+w),w>=m.length){if($)return-1;w=m.length-1}else if(w<0)if($)w=0;else return-1;if(typeof v=="string"&&(v=o.from(v,M)),o.isBuffer(v))return v.length===0?-1:B(m,v,w,M,$);if(typeof v=="number")return v=v&255,typeof Uint8Array.prototype.indexOf=="function"?$?Uint8Array.prototype.indexOf.call(m,v,w):Uint8Array.prototype.lastIndexOf.call(m,v,w):B(m,[v],w,M,$);throw new TypeError("val must be string, number or Buffer")}function B(m,v,w,M,$){let W=1,Z=m.length,Ee=v.length;if(M!==void 0&&(M=String(M).toLowerCase(),M==="ucs2"||M==="ucs-2"||M==="utf16le"||M==="utf-16le")){if(m.length<2||v.length<2)return-1;W=2,Z/=2,Ee/=2,w/=2}function Ue(Ie,Le){return W===1?Ie[Le]:Ie.readUInt16BE(Le*W)}let ke;if($){let Ie=-1;for(ke=w;keZ&&(w=Z-Ee),ke=w;ke>=0;ke--){let Ie=!0;for(let Le=0;Le$&&(M=$)):M=$;let W=v.length;M>W/2&&(M=W/2);let Z;for(Z=0;Z>>0,isFinite(w)?(w=w>>>0,M===void 0&&(M="utf8")):(M=w,w=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let $=this.length-v;if((w===void 0||w>$)&&(w=$),m.length>0&&(w<0||v<0)||v>this.length)throw new RangeError("Attempt to write outside buffer bounds");M||(M="utf8");let W=!1;for(;;)switch(M){case"hex":return N(this,m,v,w);case"utf8":case"utf-8":return P(this,m,v,w);case"ascii":case"latin1":case"binary":return D(this,m,v,w);case"base64":return O(this,m,v,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,m,v,w);default:if(W)throw new TypeError("Unknown encoding: "+M);M=(""+M).toLowerCase(),W=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function F(m,v,w){return v===0&&w===m.length?e.fromByteArray(m):e.fromByteArray(m.slice(v,w))}function A(m,v,w){w=Math.min(m.length,w);let M=[],$=v;for(;$239?4:W>223?3:W>191?2:1;if($+Ee<=w){let Ue,ke,Ie,Le;switch(Ee){case 1:W<128&&(Z=W);break;case 2:Ue=m[$+1],(Ue&192)===128&&(Le=(W&31)<<6|Ue&63,Le>127&&(Z=Le));break;case 3:Ue=m[$+1],ke=m[$+2],(Ue&192)===128&&(ke&192)===128&&(Le=(W&15)<<12|(Ue&63)<<6|ke&63,Le>2047&&(Le<55296||Le>57343)&&(Z=Le));break;case 4:Ue=m[$+1],ke=m[$+2],Ie=m[$+3],(Ue&192)===128&&(ke&192)===128&&(Ie&192)===128&&(Le=(W&15)<<18|(Ue&63)<<12|(ke&63)<<6|Ie&63,Le>65535&&Le<1114112&&(Z=Le))}}Z===null?(Z=65533,Ee=1):Z>65535&&(Z-=65536,M.push(Z>>>10&1023|55296),Z=56320|Z&1023),M.push(Z),$+=Ee}return j(M)}var I=4096;function j(m){let v=m.length;if(v<=I)return String.fromCharCode.apply(String,m);let w="",M=0;for(;MM)&&(w=M);let $="";for(let W=v;Ww&&(m=w),v<0?(v+=w,v<0&&(v=0)):v>w&&(v=w),vw)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(m,v,w){m=m>>>0,v=v>>>0,w||L(m,v,this.length);let M=this[m],$=1,W=0;for(;++W>>0,v=v>>>0,w||L(m,v,this.length);let M=this[m+--v],$=1;for(;v>0&&($*=256);)M+=this[m+--v]*$;return M},o.prototype.readUint8=o.prototype.readUInt8=function(m,v){return m=m>>>0,v||L(m,1,this.length),this[m]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(m,v){return m=m>>>0,v||L(m,2,this.length),this[m]|this[m+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(m,v){return m=m>>>0,v||L(m,2,this.length),this[m]<<8|this[m+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(m,v){return m=m>>>0,v||L(m,4,this.length),(this[m]|this[m+1]<<8|this[m+2]<<16)+this[m+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(m,v){return m=m>>>0,v||L(m,4,this.length),this[m]*16777216+(this[m+1]<<16|this[m+2]<<8|this[m+3])},o.prototype.readBigUInt64LE=pe(function(m){m=m>>>0,Pe(m,"offset");let v=this[m],w=this[m+7];(v===void 0||w===void 0)&&V(m,this.length-8);let M=v+this[++m]*2**8+this[++m]*2**16+this[++m]*2**24,$=this[++m]+this[++m]*2**8+this[++m]*2**16+w*2**24;return BigInt(M)+(BigInt($)<>>0,Pe(m,"offset");let v=this[m],w=this[m+7];(v===void 0||w===void 0)&&V(m,this.length-8);let M=v*2**24+this[++m]*2**16+this[++m]*2**8+this[++m],$=this[++m]*2**24+this[++m]*2**16+this[++m]*2**8+w;return(BigInt(M)<>>0,v=v>>>0,w||L(m,v,this.length);let M=this[m],$=1,W=0;for(;++W=$&&(M-=Math.pow(2,8*v)),M},o.prototype.readIntBE=function(m,v,w){m=m>>>0,v=v>>>0,w||L(m,v,this.length);let M=v,$=1,W=this[m+--M];for(;M>0&&($*=256);)W+=this[m+--M]*$;return $*=128,W>=$&&(W-=Math.pow(2,8*v)),W},o.prototype.readInt8=function(m,v){return m=m>>>0,v||L(m,1,this.length),this[m]&128?(255-this[m]+1)*-1:this[m]},o.prototype.readInt16LE=function(m,v){m=m>>>0,v||L(m,2,this.length);let w=this[m]|this[m+1]<<8;return w&32768?w|4294901760:w},o.prototype.readInt16BE=function(m,v){m=m>>>0,v||L(m,2,this.length);let w=this[m+1]|this[m]<<8;return w&32768?w|4294901760:w},o.prototype.readInt32LE=function(m,v){return m=m>>>0,v||L(m,4,this.length),this[m]|this[m+1]<<8|this[m+2]<<16|this[m+3]<<24},o.prototype.readInt32BE=function(m,v){return m=m>>>0,v||L(m,4,this.length),this[m]<<24|this[m+1]<<16|this[m+2]<<8|this[m+3]},o.prototype.readBigInt64LE=pe(function(m){m=m>>>0,Pe(m,"offset");let v=this[m],w=this[m+7];(v===void 0||w===void 0)&&V(m,this.length-8);let M=this[m+4]+this[m+5]*2**8+this[m+6]*2**16+(w<<24);return(BigInt(M)<>>0,Pe(m,"offset");let v=this[m],w=this[m+7];(v===void 0||w===void 0)&&V(m,this.length-8);let M=(v<<24)+this[++m]*2**16+this[++m]*2**8+this[++m];return(BigInt(M)<>>0,v||L(m,4,this.length),r.read(this,m,!0,23,4)},o.prototype.readFloatBE=function(m,v){return m=m>>>0,v||L(m,4,this.length),r.read(this,m,!1,23,4)},o.prototype.readDoubleLE=function(m,v){return m=m>>>0,v||L(m,8,this.length),r.read(this,m,!0,52,8)},o.prototype.readDoubleBE=function(m,v){return m=m>>>0,v||L(m,8,this.length),r.read(this,m,!1,52,8)};function q(m,v,w,M,$,W){if(!o.isBuffer(m))throw new TypeError('"buffer" argument must be a Buffer instance');if(v>$||vm.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(m,v,w,M){if(m=+m,v=v>>>0,w=w>>>0,!M){let Z=Math.pow(2,8*w)-1;q(this,m,v,w,Z,0)}let $=1,W=0;for(this[v]=m&255;++W>>0,w=w>>>0,!M){let Z=Math.pow(2,8*w)-1;q(this,m,v,w,Z,0)}let $=w-1,W=1;for(this[v+$]=m&255;--$>=0&&(W*=256);)this[v+$]=m/W&255;return v+w},o.prototype.writeUint8=o.prototype.writeUInt8=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,1,255,0),this[v]=m&255,v+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,2,65535,0),this[v]=m&255,this[v+1]=m>>>8,v+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,2,65535,0),this[v]=m>>>8,this[v+1]=m&255,v+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,4,4294967295,0),this[v+3]=m>>>24,this[v+2]=m>>>16,this[v+1]=m>>>8,this[v]=m&255,v+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,4,4294967295,0),this[v]=m>>>24,this[v+1]=m>>>16,this[v+2]=m>>>8,this[v+3]=m&255,v+4};function ee(m,v,w,M,$){Be(v,M,$,m,w,7);let W=Number(v&BigInt(4294967295));m[w++]=W,W=W>>8,m[w++]=W,W=W>>8,m[w++]=W,W=W>>8,m[w++]=W;let Z=Number(v>>BigInt(32)&BigInt(4294967295));return m[w++]=Z,Z=Z>>8,m[w++]=Z,Z=Z>>8,m[w++]=Z,Z=Z>>8,m[w++]=Z,w}function X(m,v,w,M,$){Be(v,M,$,m,w,7);let W=Number(v&BigInt(4294967295));m[w+7]=W,W=W>>8,m[w+6]=W,W=W>>8,m[w+5]=W,W=W>>8,m[w+4]=W;let Z=Number(v>>BigInt(32)&BigInt(4294967295));return m[w+3]=Z,Z=Z>>8,m[w+2]=Z,Z=Z>>8,m[w+1]=Z,Z=Z>>8,m[w]=Z,w+8}o.prototype.writeBigUInt64LE=pe(function(m,v=0){return ee(this,m,v,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=pe(function(m,v=0){return X(this,m,v,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(m,v,w,M){if(m=+m,v=v>>>0,!M){let Ee=Math.pow(2,8*w-1);q(this,m,v,w,Ee-1,-Ee)}let $=0,W=1,Z=0;for(this[v]=m&255;++$>0)-Z&255;return v+w},o.prototype.writeIntBE=function(m,v,w,M){if(m=+m,v=v>>>0,!M){let Ee=Math.pow(2,8*w-1);q(this,m,v,w,Ee-1,-Ee)}let $=w-1,W=1,Z=0;for(this[v+$]=m&255;--$>=0&&(W*=256);)m<0&&Z===0&&this[v+$+1]!==0&&(Z=1),this[v+$]=(m/W>>0)-Z&255;return v+w},o.prototype.writeInt8=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,1,127,-128),m<0&&(m=255+m+1),this[v]=m&255,v+1},o.prototype.writeInt16LE=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,2,32767,-32768),this[v]=m&255,this[v+1]=m>>>8,v+2},o.prototype.writeInt16BE=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,2,32767,-32768),this[v]=m>>>8,this[v+1]=m&255,v+2},o.prototype.writeInt32LE=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,4,2147483647,-2147483648),this[v]=m&255,this[v+1]=m>>>8,this[v+2]=m>>>16,this[v+3]=m>>>24,v+4},o.prototype.writeInt32BE=function(m,v,w){return m=+m,v=v>>>0,w||q(this,m,v,4,2147483647,-2147483648),m<0&&(m=4294967295+m+1),this[v]=m>>>24,this[v+1]=m>>>16,this[v+2]=m>>>8,this[v+3]=m&255,v+4},o.prototype.writeBigInt64LE=pe(function(m,v=0){return ee(this,m,v,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=pe(function(m,v=0){return X(this,m,v,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function oe(m,v,w,M,$,W){if(w+M>m.length)throw new RangeError("Index out of range");if(w<0)throw new RangeError("Index out of range")}function me(m,v,w,M,$){return v=+v,w=w>>>0,$||oe(m,v,w,4),r.write(m,v,w,M,23,4),w+4}o.prototype.writeFloatLE=function(m,v,w){return me(this,m,v,!0,w)},o.prototype.writeFloatBE=function(m,v,w){return me(this,m,v,!1,w)};function le(m,v,w,M,$){return v=+v,w=w>>>0,$||oe(m,v,w,8),r.write(m,v,w,M,52,8),w+8}o.prototype.writeDoubleLE=function(m,v,w){return le(this,m,v,!0,w)},o.prototype.writeDoubleBE=function(m,v,w){return le(this,m,v,!1,w)},o.prototype.copy=function(m,v,w,M){if(!o.isBuffer(m))throw new TypeError("argument should be a Buffer");if(w||(w=0),!M&&M!==0&&(M=this.length),v>=m.length&&(v=m.length),v||(v=0),M>0&&M=this.length)throw new RangeError("Index out of range");if(M<0)throw new RangeError("sourceEnd out of bounds");M>this.length&&(M=this.length),m.length-v>>0,w=w===void 0?this.length:w>>>0,m||(m=0);let $;if(typeof m=="number")for($=v;$2**32?$=Ae(String(w)):typeof w=="bigint"&&($=String(w),(w>BigInt(2)**BigInt(32)||w<-(BigInt(2)**BigInt(32)))&&($=Ae($)),$+="n"),M+=` It must be ${v}. Received ${$}`,M},RangeError);function Ae(m){let v="",w=m.length,M=m[0]==="-"?1:0;for(;w>=M+4;w-=3)v=`_${m.slice(w-3,w)}${v}`;return`${m.slice(0,w)}${v}`}function Me(m,v,w){Pe(v,"offset"),(m[v]===void 0||m[v+w]===void 0)&&V(v,m.length-(w+1))}function Be(m,v,w,M,$,W){if(m>w||m3?v===0||v===BigInt(0)?Ee=`>= 0${Z} and < 2${Z} ** ${(W+1)*8}${Z}`:Ee=`>= -(2${Z} ** ${(W+1)*8-1}${Z}) and < 2 ** ${(W+1)*8-1}${Z}`:Ee=`>= ${v}${Z} and <= ${w}${Z}`,new fe.ERR_OUT_OF_RANGE("value",Ee,m)}Me(M,$,W)}function Pe(m,v){if(typeof m!="number")throw new fe.ERR_INVALID_ARG_TYPE(v,"number",m)}function V(m,v,w){throw Math.floor(m)!==m?(Pe(m,w),new fe.ERR_OUT_OF_RANGE(w||"offset","an integer",m)):v<0?new fe.ERR_BUFFER_OUT_OF_BOUNDS:new fe.ERR_OUT_OF_RANGE(w||"offset",`>= ${w?1:0} and <= ${v}`,m)}var ue=/[^+/0-9A-Za-z-_]/g;function se(m){if(m=m.split("=")[0],m=m.trim().replace(ue,""),m.length<2)return"";for(;m.length%4!==0;)m=m+"=";return m}function Y(m,v){v=v||1/0;let w,M=m.length,$=null,W=[];for(let Z=0;Z55295&&w<57344){if(!$){if(w>56319){(v-=3)>-1&&W.push(239,191,189);continue}else if(Z+1===M){(v-=3)>-1&&W.push(239,191,189);continue}$=w;continue}if(w<56320){(v-=3)>-1&&W.push(239,191,189),$=w;continue}w=($-55296<<10|w-56320)+65536}else $&&(v-=3)>-1&&W.push(239,191,189);if($=null,w<128){if((v-=1)<0)break;W.push(w)}else if(w<2048){if((v-=2)<0)break;W.push(w>>6|192,w&63|128)}else if(w<65536){if((v-=3)<0)break;W.push(w>>12|224,w>>6&63|128,w&63|128)}else if(w<1114112){if((v-=4)<0)break;W.push(w>>18|240,w>>12&63|128,w>>6&63|128,w&63|128)}else throw new Error("Invalid code point")}return W}function J(m){let v=[];for(let w=0;w>8,$=w%256,W.push($),W.push(M);return W}function ge(m){return e.toByteArray(se(m))}function de(m,v,w,M){let $;for($=0;$=v.length||$>=m.length);++$)v[$+w]=m[$];return $}function re(m,v){return m instanceof v||m!=null&&m.constructor!=null&&m.constructor.name!=null&&m.constructor.name===v.name}function Ce(m){return m!==m}var xe=function(){let m="0123456789abcdef",v=new Array(256);for(let w=0;w<16;++w){let M=w*16;for(let $=0;$<16;++$)v[M+$]=m[w]+m[$]}return v}();function pe(m){return typeof BigInt>"u"?Fe:m}function Fe(){throw new Error("BigInt not supported")}}),rz=wo((t,e)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,e.exports={Buffer:pw().Buffer,Crypto:window.crypto}):e.exports={Buffer:pw().Buffer,Crypto:crypto}}),Ik={};JH(Ik,{AVSCTap:()=>Sv,ArweaveSigner:()=>Pk,DataItem:()=>vm,MAX_TAG_BYTES:()=>$3,MIN_BINARY_SIZE:()=>Dk,SIG_CONFIG:()=>Vd,SignatureConfig:()=>ti,Signer:()=>nz,createData:()=>pz,deserializeTags:()=>mw,indexToType:()=>Nk,serializeTags:()=>Ok,tagsExceedLimit:()=>lz});var nz=class{constructor(){ae(this,"signer");ae(this,"publicKey");ae(this,"signatureType");ae(this,"signatureLength");ae(this,"ownerLength");ae(this,"pem")}static verify(t,e,r,n){throw new Error("You must implement verify method on child")}},iz=il(U3(),1),xs=il(Bk(),1);async function Fk(t){if(Array.isArray(t)){let i=(0,xs.concatBuffers)([(0,xs.stringToBuffer)("list"),(0,xs.stringToBuffer)(t.length.toString())]);return await Tk(t,await Ja().hash(i,"SHA-384"))}let e=t,r=(0,xs.concatBuffers)([(0,xs.stringToBuffer)("blob"),(0,xs.stringToBuffer)(e.byteLength.toString())]),n=(0,xs.concatBuffers)([await Ja().hash(r,"SHA-384"),await Ja().hash(e,"SHA-384")]);return await Ja().hash(n,"SHA-384")}async function Tk(t,e){if(t.length<1)return e;let r=(0,xs.concatBuffers)([e,await Fk(t[0])]),n=await Ja().hash(r,"SHA-384");return await Tk(t.slice(1),n)}var E2=il(ez(),1),sz=E2.default.default?E2.default.default:E2.default,az=class extends sz{getPublicKey(t){throw new Error("Unimplemented")}},oz;function Ja(){return oz??(oz=new az)}var ti;(function(t){t[t.ARWEAVE=1]="ARWEAVE",t[t.ED25519=2]="ED25519",t[t.ETHEREUM=3]="ETHEREUM",t[t.SOLANA=4]="SOLANA",t[t.INJECTEDAPTOS=5]="INJECTEDAPTOS",t[t.MULTIAPTOS=6]="MULTIAPTOS",t[t.TYPEDETHEREUM=7]="TYPEDETHEREUM"})(ti||(ti={}));var Vd={[ti.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[ti.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[ti.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[ti.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[ti.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[ti.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[ti.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},Pk=class{constructor(t){ae(this,"signatureType",1);ae(this,"ownerLength",Vd[1].pubLength);ae(this,"signatureLength",Vd[1].sigLength);ae(this,"jwk");ae(this,"pk");this.pk=t.n,this.jwk=t}get publicKey(){return iz.default.toBuffer(this.pk)}sign(t){return Ja().sign(this.jwk,t)}static async verify(t,e,r){return await Ja().verify(t,e,r)}},Nk={1:Pk},Ms=il(U3(),1);async function gw(t){return Fk([(0,xs.stringToBuffer)("dataitem"),(0,xs.stringToBuffer)("1"),(0,xs.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}async function cz(t,e){let r=await gw(t),n=await e.sign(r),i=await Ja().hash(n);return{signature:Buffer.from(n),id:Buffer.from(i)}}async function uz(t,e){let{signature:r,id:n}=await cz(t,e);return t.getRaw().set(r,2),n}var Sv=class{constructor(t=Buffer.alloc($3),e=0){ae(this,"buf");ae(this,"pos");this.buf=t,this.pos=e}writeTags(t){if(!Array.isArray(t))throw new Error("input must be array");let e=t.length,r;if(e)for(this.writeLong(e),r=0;rthis.buf.length)throw new Error(`Too many tag bytes (${this.pos} > ${this.buf.length})`);return this.buf.copy(t,0,0,this.pos),t}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(t){let e=this.buf,r,n;if(t>=-1073741824&&t<1073741824){n=t>=0?t<<1:~t<<1|1;do e[this.pos]=n&127,n>>=7;while(n&&(e[this.pos++]|=128))}else{r=t>=0?t*2:-t*2-1;do e[this.pos]=r&127,r/=128;while(r>=1&&(e[this.pos++]|=128))}this.pos++,this.buf=e}writeString(t){let e=Buffer.byteLength(t),r=this.buf;this.writeLong(e);let n=this.pos;if(this.pos+=e,!(this.pos>r.length)){if(e>64)this.buf.write(t,this.pos-e,e,"utf8");else{let i,s,a,o;for(i=0,s=e;i>6|192,r[n++]=a&63|128):(a&64512)===55296&&((o=t.charCodeAt(i+1))&64512)===56320?(a=65536+((a&1023)<<10)+(o&1023),i++,r[n++]=a>>18|240,r[n++]=a>>12&63|128,r[n++]=a>>6&63|128,r[n++]=a&63|128):(r[n++]=a>>12|224,r[n++]=a>>6&63|128,r[n++]=a&63|128)}this.buf=r}}readLong(){let t=0,e=0,r=this.buf,n,i,s,a;do n=r[this.pos++],i=n&128,t|=(n&127)<>1^-(t&1)}skipLong(){let t=this.buf;for(;t[this.pos++]&128;);}readTags(){let t=[],e;for(;e=this.readLong();)for(e<0&&(e=-e,this.skipLong());e--;){let r=this.readString(),n=this.readString();t.push({name:r,value:n})}return t}readString(){let t=this.readLong(),e=this.pos,r=this.buf;if(this.pos+=t,!(this.pos>r.length))return this.buf.slice(e,e+t).toString()}};function Ok(t){let e=new Sv;return e.writeTags(t),e.toBuffer()}function lz(t){let e=new Sv;return e.writeTags(t),e.tagsExceedLimit()}function mw(t){return new Sv(t).readTags()}function Bo(t){let e=0;for(let r=t.length-1;r>=0;r--)e=e*256+t[r];return e}function fz(t){if(t>29)throw new Error("Short too long");let e=[0,0];for(let r=0;rMs.default.encode(await this.rawId))()}set id(t){this._id=Ms.default.toBuffer(t)}get rawId(){return(async()=>yl.Buffer.from(await hz.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(t){this._id=t}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return Ms.default.encode(this.rawSignature)}set rawOwner(t){if(t.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${t.byteLength} bytes.`);this.binary.set(t,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return Vd[this.signatureType].sigLength}get owner(){return Ms.default.encode(this.rawOwner)}get ownerLength(){return Vd[this.signatureType].pubLength}get rawTarget(){let t=this.getTargetStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):yl.Buffer.alloc(0)}get target(){return Ms.default.encode(this.rawTarget)}get rawAnchor(){let t=this.getAnchorStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):yl.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let t=this.getTagsStart(),e=Bo(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){let t=this.getTagsStart();if(Bo(this.binary.subarray(t,t+8))==0)return[];let e=Bo(this.binary.subarray(t+8,t+16));return mw(yl.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map(t=>({name:Ms.default.encode(t.name),value:Ms.default.encode(t.value)}))}getStartOfData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=Bo(e);return t+16+r}get rawData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=Bo(e),n=t+16+r;return this.binary.subarray(n,this.binary.length)}get data(){return Ms.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await uz(this,t),this.rawId}async setSignature(t){this.binary.set(t,2),this._id=yl.Buffer.from(await Ja().hash(t))}isSigned(){var t;return(((t=this._id)==null?void 0:t.length)??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(t=>({name:Ms.default.encode(t.name),value:Ms.default.encode(t.value)})),data:this.data}}static async verify(t){if(t.byteLength$3)return!1;if(i>0)try{if(mw(yl.Buffer.from(t.subarray(n+16,n+16+a))).length!==i)return!1}catch{return!1}let o=Nk[r],c=await gw(e);return await o.verify(e.rawOwner,c,e.rawSignature)}async getSignatureData(){return gw(this)}getTagsStart(){let t=this.getTargetStart(),e=this.binary[t]==1,r=t+(e?33:1),n=this.binary[r]==1;return r+=n?33:1,r}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let t=this.getTargetStart()+1,e=this.binary[this.getTargetStart()]==1;return t+=e?32:0,t}},dz=il(U3(),1);function pz(t,e,r){var S,k;let n=e.publicKey,i=r!=null&&r.target?dz.default.toBuffer(r.target):null,s=1+((i==null?void 0:i.byteLength)??0),a=r!=null&&r.anchor?Buffer.from(r.anchor):null,o=1+((a==null?void 0:a.byteLength)??0),c=(((S=r==null?void 0:r.tags)==null?void 0:S.length)??0)>0?Ok(r.tags):null,u=16+(c?c.byteLength:0),l=Buffer.from(t),h=l.byteLength,f=2+e.signatureLength+e.ownerLength+s+o+u+h,p=Buffer.alloc(f);if(p.set(fz(e.signatureType),0),p.set(new Uint8Array(e.signatureLength).fill(0),2),n.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${n.byteLength}`);p.set(n,2+e.signatureLength);let d=2+e.signatureLength+e.ownerLength;if(p[d]=i?1:0,i){if(i.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);p.set(i,d+1)}let g=d+s,y=g+1;if(p[g]=a?1:0,a){if(y+=a.byteLength,a.byteLength!==32)throw new Error("Anchor must be 32 bytes");p.set(a,g+1)}p.set(o6(((k=r==null?void 0:r.tags)==null?void 0:k.length)??0),y);let x=o6((c==null?void 0:c.byteLength)??0);p.set(x,y+8),c&&p.set(c,y+16);let b=y+u;return p.set(l,b),new vm(p)}var Rk={...Ik};globalThis.arbundles??(globalThis.arbundles=Rk);var gz=Rk,{DataItem:mz}=gz;globalThis.Buffer||(globalThis.Buffer=_k.Buffer);function vz(t){return async({data:e,tags:r,target:n,anchor:i,createDataItem:s=a=>new mz(a)})=>{let a=await t.signDataItem({data:e,tags:r,target:n,anchor:i}),o=s(_k.Buffer.from(a));return{id:await o.id,raw:await o.getRaw()}}}var yz=globalThis.GATEWAY_URL||void 0,xz=globalThis.MU_URL||void 0,bz=globalThis.CU_URL||void 0,{result:hf,results:Mk,message:xue,spawn:bue,monitor:wue,unmonitor:Eue,dryrun:Aue}=qu({GATEWAY_URL:yz,MU_URL:xz,CU_URL:bz}),_h=Ck.createDataItemSigner;/*! Bundled license information: - -ieee754/index.js: - (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *) - -buffer/index.js: - (*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - *) - -warp-arbundles/build/web/esm/bundle.js: - (*! Bundled license information: - - ieee754/index.js: - (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *) - - buffer/index.js: - (*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - *) - *) -*/const H3="9afQ1PLf2mrshqCTZEzzJTR2gWaC9zNPnYgYEqg1Pt4",z3="TZ7o7SIZ06ZEJ14lXwVtng1EtSx60QkPy-kh-kdAXog",c6="Efcq95Er0FKbehfmDGRQfH1vBPwd3snX4iVgtVhAhVU";function u6(t,[e,r]){return Math.min(r,Math.max(e,t))}function Sr(t,e,{checkForDefaultPrevented:r=!0}={}){return function(i){if(t==null||t(i),r===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function Cv(t,e=[]){let r=[];function n(s,a){const o=K.createContext(a),c=r.length;r=[...r,a];function u(h){const{scope:f,children:p,...d}=h,g=(f==null?void 0:f[t][c])||o,y=K.useMemo(()=>d,Object.values(d));return K.createElement(g.Provider,{value:y},p)}function l(h,f){const p=(f==null?void 0:f[t][c])||o,d=K.useContext(p);if(d)return d;if(a!==void 0)return a;throw new Error(`\`${h}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,l]}const i=()=>{const s=r.map(a=>K.createContext(a));return function(o){const c=(o==null?void 0:o[t])||s;return K.useMemo(()=>({[`__scope${t}`]:{...o,[t]:c}}),[o,c])}};return i.scopeName=t,[n,wz(i,...e)]}function wz(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const a=n.reduce((o,{useScope:c,scopeName:u})=>{const h=c(s)[`__scope${u}`];return{...o,...h}},{});return K.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}function Ez(t){const e=t+"CollectionProvider",[r,n]=Cv(e),[i,s]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{const{scope:d,children:g}=p,y=Pr.useRef(null),x=Pr.useRef(new Map).current;return Pr.createElement(i,{scope:d,itemMap:x,collectionRef:y},g)},o=t+"CollectionSlot",c=Pr.forwardRef((p,d)=>{const{scope:g,children:y}=p,x=s(o,g),b=Jr(d,x.collectionRef);return Pr.createElement(mh,{ref:b},y)}),u=t+"CollectionItemSlot",l="data-radix-collection-item",h=Pr.forwardRef((p,d)=>{const{scope:g,children:y,...x}=p,b=Pr.useRef(null),S=Jr(d,b),k=s(u,g);return Pr.useEffect(()=>(k.itemMap.set(b,{ref:b,...x}),()=>void k.itemMap.delete(b))),Pr.createElement(mh,{[l]:"",ref:S},y)});function f(p){const d=s(t+"CollectionConsumer",p);return Pr.useCallback(()=>{const y=d.collectionRef.current;if(!y)return[];const x=Array.from(y.querySelectorAll(`[${l}]`));return Array.from(d.itemMap.values()).sort((k,T)=>x.indexOf(k.ref.current)-x.indexOf(T.ref.current))},[d.collectionRef,d.itemMap])}return[{Provider:a,Slot:c,ItemSlot:h},f,n]}const Az=K.createContext(void 0);function Sz(t){const e=K.useContext(Az);return t||e||"ltr"}const Cz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],kr=Cz.reduce((t,e)=>{const r=K.forwardRef((n,i)=>{const{asChild:s,...a}=n,o=s?mh:e;return K.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),K.createElement(o,mt({},a,{ref:i}))});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function _z(t,e){t&&Wh.flushSync(()=>t.dispatchEvent(e))}function fo(t){const e=K.useRef(t);return K.useEffect(()=>{e.current=t}),K.useMemo(()=>(...r)=>{var n;return(n=e.current)===null||n===void 0?void 0:n.call(e,...r)},[])}function kz(t,e=globalThis==null?void 0:globalThis.document){const r=fo(t);K.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return e.addEventListener("keydown",n),()=>e.removeEventListener("keydown",n)},[r,e])}const vw="dismissableLayer.update",Bz="dismissableLayer.pointerDownOutside",Iz="dismissableLayer.focusOutside";let l6;const Fz=K.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Tz=K.forwardRef((t,e)=>{var r;const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,onDismiss:c,...u}=t,l=K.useContext(Fz),[h,f]=K.useState(null),p=(r=h==null?void 0:h.ownerDocument)!==null&&r!==void 0?r:globalThis==null?void 0:globalThis.document,[,d]=K.useState({}),g=Jr(e,N=>f(N)),y=Array.from(l.layers),[x]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),b=y.indexOf(x),S=h?y.indexOf(h):-1,k=l.layersWithOutsidePointerEventsDisabled.size>0,T=S>=b,_=Pz(N=>{const P=N.target,D=[...l.branches].some(O=>O.contains(P));!T||D||(s==null||s(N),o==null||o(N),N.defaultPrevented||c==null||c())},p),B=Nz(N=>{const P=N.target;[...l.branches].some(O=>O.contains(P))||(a==null||a(N),o==null||o(N),N.defaultPrevented||c==null||c())},p);return kz(N=>{S===l.layers.size-1&&(i==null||i(N),!N.defaultPrevented&&c&&(N.preventDefault(),c()))},p),K.useEffect(()=>{if(h)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(l6=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(h)),l.layers.add(h),f6(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=l6)}},[h,p,n,l]),K.useEffect(()=>()=>{h&&(l.layers.delete(h),l.layersWithOutsidePointerEventsDisabled.delete(h),f6())},[h,l]),K.useEffect(()=>{const N=()=>d({});return document.addEventListener(vw,N),()=>document.removeEventListener(vw,N)},[]),K.createElement(kr.div,mt({},u,{ref:g,style:{pointerEvents:k?T?"auto":"none":void 0,...t.style},onFocusCapture:Sr(t.onFocusCapture,B.onFocusCapture),onBlurCapture:Sr(t.onBlurCapture,B.onBlurCapture),onPointerDownCapture:Sr(t.onPointerDownCapture,_.onPointerDownCapture)}))});function Pz(t,e=globalThis==null?void 0:globalThis.document){const r=fo(t),n=K.useRef(!1),i=K.useRef(()=>{});return K.useEffect(()=>{const s=o=>{if(o.target&&!n.current){let u=function(){Lk(Bz,r,c,{discrete:!0})};const c={originalEvent:o};o.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=u,e.addEventListener("click",i.current,{once:!0})):u()}else e.removeEventListener("click",i.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function Nz(t,e=globalThis==null?void 0:globalThis.document){const r=fo(t),n=K.useRef(!1);return K.useEffect(()=>{const i=s=>{s.target&&!n.current&&Lk(Iz,r,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function f6(){const t=new CustomEvent(vw);document.dispatchEvent(t)}function Lk(t,e,r,{discrete:n}){const i=r.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&i.addEventListener(t,e,{once:!0}),n?_z(i,s):i.dispatchEvent(s)}let A2=0;function Oz(){K.useEffect(()=>{var t,e;const r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(t=r[0])!==null&&t!==void 0?t:h6()),document.body.insertAdjacentElement("beforeend",(e=r[1])!==null&&e!==void 0?e:h6()),A2++,()=>{A2===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),A2--}},[])}function h6(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",t}const S2="focusScope.autoFocusOnMount",C2="focusScope.autoFocusOnUnmount",d6={bubbles:!1,cancelable:!0},Dz=K.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...a}=t,[o,c]=K.useState(null),u=fo(i),l=fo(s),h=K.useRef(null),f=Jr(e,g=>c(g)),p=K.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;K.useEffect(()=>{if(n){let g=function(S){if(p.paused||!o)return;const k=S.target;o.contains(k)?h.current=k:Mo(h.current,{select:!0})},y=function(S){if(p.paused||!o)return;const k=S.relatedTarget;k!==null&&(o.contains(k)||Mo(h.current,{select:!0}))},x=function(S){if(document.activeElement===document.body)for(const T of S)T.removedNodes.length>0&&Mo(o)};document.addEventListener("focusin",g),document.addEventListener("focusout",y);const b=new MutationObserver(x);return o&&b.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",y),b.disconnect()}}},[n,o,p.paused]),K.useEffect(()=>{if(o){g6.add(p);const g=document.activeElement;if(!o.contains(g)){const x=new CustomEvent(S2,d6);o.addEventListener(S2,u),o.dispatchEvent(x),x.defaultPrevented||(Rz($z(jk(o)),{select:!0}),document.activeElement===g&&Mo(o))}return()=>{o.removeEventListener(S2,u),setTimeout(()=>{const x=new CustomEvent(C2,d6);o.addEventListener(C2,l),o.dispatchEvent(x),x.defaultPrevented||Mo(g??document.body,{select:!0}),o.removeEventListener(C2,l),g6.remove(p)},0)}}},[o,u,l,p]);const d=K.useCallback(g=>{if(!r&&!n||p.paused)return;const y=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,x=document.activeElement;if(y&&x){const b=g.currentTarget,[S,k]=Mz(b);S&&k?!g.shiftKey&&x===k?(g.preventDefault(),r&&Mo(S,{select:!0})):g.shiftKey&&x===S&&(g.preventDefault(),r&&Mo(k,{select:!0})):x===b&&g.preventDefault()}},[r,n,p.paused]);return K.createElement(kr.div,mt({tabIndex:-1},a,{ref:f,onKeyDown:d}))});function Rz(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(Mo(n,{select:e}),document.activeElement!==r)return}function Mz(t){const e=jk(t),r=p6(e,t),n=p6(e.reverse(),t);return[r,n]}function jk(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function p6(t,e){for(const r of t)if(!Lz(r,{upTo:e}))return r}function Lz(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function jz(t){return t instanceof HTMLInputElement&&"select"in t}function Mo(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&jz(t)&&e&&t.select()}}const g6=Uz();function Uz(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=m6(t,e),t.unshift(e)},remove(e){var r;t=m6(t,e),(r=t[0])===null||r===void 0||r.resume()}}}function m6(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function $z(t){return t.filter(e=>e.tagName!=="A")}const Vi=globalThis!=null&&globalThis.document?K.useLayoutEffect:()=>{},Hz=Y9.useId||(()=>{});let zz=0;function Uk(t){const[e,r]=K.useState(Hz());return Vi(()=>{t||r(n=>n??String(zz++))},[t]),t||(e?`radix-${e}`:"")}const Vz=["top","right","bottom","left"],kc=Math.min,ii=Math.max,ym=Math.round,x1=Math.floor,Bc=t=>({x:t,y:t}),qz={left:"right",right:"left",bottom:"top",top:"bottom"},Kz={start:"end",end:"start"};function yw(t,e,r){return ii(t,kc(e,r))}function ho(t,e){return typeof t=="function"?t(e):t}function po(t){return t.split("-")[0]}function Yh(t){return t.split("-")[1]}function V3(t){return t==="x"?"y":"x"}function q3(t){return t==="y"?"height":"width"}function e0(t){return["top","bottom"].includes(po(t))?"y":"x"}function K3(t){return V3(e0(t))}function Wz(t,e,r){r===void 0&&(r=!1);const n=Yh(t),i=K3(t),s=q3(i);let a=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(a=xm(a)),[a,xm(a)]}function Gz(t){const e=xm(t);return[xw(t),e,xw(e)]}function xw(t){return t.replace(/start|end/g,e=>Kz[e])}function Zz(t,e,r){const n=["left","right"],i=["right","left"],s=["top","bottom"],a=["bottom","top"];switch(t){case"top":case"bottom":return r?e?i:n:e?n:i;case"left":case"right":return e?s:a;default:return[]}}function Jz(t,e,r,n){const i=Yh(t);let s=Zz(po(t),r==="start",n);return i&&(s=s.map(a=>a+"-"+i),e&&(s=s.concat(s.map(xw)))),s}function xm(t){return t.replace(/left|right|bottom|top/g,e=>qz[e])}function Xz(t){return{top:0,right:0,bottom:0,left:0,...t}}function $k(t){return typeof t!="number"?Xz(t):{top:t,right:t,bottom:t,left:t}}function bm(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}function v6(t,e,r){let{reference:n,floating:i}=t;const s=e0(e),a=K3(e),o=q3(a),c=po(e),u=s==="y",l=n.x+n.width/2-i.width/2,h=n.y+n.height/2-i.height/2,f=n[o]/2-i[o]/2;let p;switch(c){case"top":p={x:l,y:n.y-i.height};break;case"bottom":p={x:l,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:h};break;case"left":p={x:n.x-i.width,y:h};break;default:p={x:n.x,y:n.y}}switch(Yh(e)){case"start":p[a]-=f*(r&&u?-1:1);break;case"end":p[a]+=f*(r&&u?-1:1);break}return p}const Qz=async(t,e,r)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:a}=r,o=s.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(e));let u=await a.getElementRects({reference:t,floating:e,strategy:i}),{x:l,y:h}=v6(u,n,c),f=n,p={},d=0;for(let g=0;g({name:"arrow",options:t,async fn(e){const{x:r,y:n,placement:i,rects:s,platform:a,elements:o,middlewareData:c}=e,{element:u,padding:l=0}=ho(t,e)||{};if(u==null)return{};const h=$k(l),f={x:r,y:n},p=K3(i),d=q3(p),g=await a.getDimensions(u),y=p==="y",x=y?"top":"left",b=y?"bottom":"right",S=y?"clientHeight":"clientWidth",k=s.reference[d]+s.reference[p]-f[p]-s.floating[d],T=f[p]-s.reference[p],_=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let B=_?_[S]:0;(!B||!await(a.isElement==null?void 0:a.isElement(_)))&&(B=o.floating[S]||s.floating[d]);const N=k/2-T/2,P=B/2-g[d]/2-1,D=kc(h[x],P),O=kc(h[b],P),E=D,F=B-g[d]-O,A=B/2-g[d]/2+N,I=yw(E,A,F),j=!c.arrow&&Yh(i)!=null&&A!=I&&s.reference[d]/2-(AE<=0)){var P,D;const E=(((P=s.flip)==null?void 0:P.index)||0)+1,F=T[E];if(F)return{data:{index:E,overflows:N},reset:{placement:F}};let A=(D=N.filter(I=>I.overflows[0]<=0).sort((I,j)=>I.overflows[1]-j.overflows[1])[0])==null?void 0:D.placement;if(!A)switch(p){case"bestFit":{var O;const I=(O=N.map(j=>[j.placement,j.overflows.filter(H=>H>0).reduce((H,G)=>H+G,0)]).sort((j,H)=>j[1]-H[1])[0])==null?void 0:O[0];I&&(A=I);break}case"initialPlacement":A=o;break}if(i!==A)return{reset:{placement:A}}}return{}}}};function y6(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function x6(t){return Vz.some(e=>t[e]>=0)}const tV=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:n="referenceHidden",...i}=ho(t,e);switch(n){case"referenceHidden":{const s=await qd(e,{...i,elementContext:"reference"}),a=y6(s,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:x6(a)}}}case"escaped":{const s=await qd(e,{...i,altBoundary:!0}),a=y6(s,r.floating);return{data:{escapedOffsets:a,escaped:x6(a)}}}default:return{}}}}};async function rV(t,e){const{placement:r,platform:n,elements:i}=t,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),a=po(r),o=Yh(r),c=e0(r)==="y",u=["left","top"].includes(a)?-1:1,l=s&&c?-1:1,h=ho(e,t);let{mainAxis:f,crossAxis:p,alignmentAxis:d}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...h};return o&&typeof d=="number"&&(p=o==="end"?d*-1:d),c?{x:p*l,y:f*u}:{x:f*u,y:p*l}}const nV=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,n;const{x:i,y:s,placement:a,middlewareData:o}=e,c=await rV(e,t);return a===((r=o.offset)==null?void 0:r.placement)&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:a}}}}},iV=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:n,placement:i}=e,{mainAxis:s=!0,crossAxis:a=!1,limiter:o={fn:y=>{let{x,y:b}=y;return{x,y:b}}},...c}=ho(t,e),u={x:r,y:n},l=await qd(e,c),h=e0(po(i)),f=V3(h);let p=u[f],d=u[h];if(s){const y=f==="y"?"top":"left",x=f==="y"?"bottom":"right",b=p+l[y],S=p-l[x];p=yw(b,p,S)}if(a){const y=h==="y"?"top":"left",x=h==="y"?"bottom":"right",b=d+l[y],S=d-l[x];d=yw(b,d,S)}const g=o.fn({...e,[f]:p,[h]:d});return{...g,data:{x:g.x-r,y:g.y-n}}}}},sV=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:n,placement:i,rects:s,middlewareData:a}=e,{offset:o=0,mainAxis:c=!0,crossAxis:u=!0}=ho(t,e),l={x:r,y:n},h=e0(i),f=V3(h);let p=l[f],d=l[h];const g=ho(o,e),y=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const S=f==="y"?"height":"width",k=s.reference[f]-s.floating[S]+y.mainAxis,T=s.reference[f]+s.reference[S]-y.mainAxis;pT&&(p=T)}if(u){var x,b;const S=f==="y"?"width":"height",k=["top","left"].includes(po(i)),T=s.reference[h]-s.floating[S]+(k&&((x=a.offset)==null?void 0:x[h])||0)+(k?0:y.crossAxis),_=s.reference[h]+s.reference[S]+(k?0:((b=a.offset)==null?void 0:b[h])||0)-(k?y.crossAxis:0);d_&&(d=_)}return{[f]:p,[h]:d}}}},aV=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:r,rects:n,platform:i,elements:s}=e,{apply:a=()=>{},...o}=ho(t,e),c=await qd(e,o),u=po(r),l=Yh(r),h=e0(r)==="y",{width:f,height:p}=n.floating;let d,g;u==="top"||u==="bottom"?(d=u,g=l===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(g=u,d=l==="end"?"top":"bottom");const y=p-c[d],x=f-c[g],b=!e.middlewareData.shift;let S=y,k=x;if(h){const _=f-c.left-c.right;k=l||b?kc(x,_):_}else{const _=p-c.top-c.bottom;S=l||b?kc(y,_):_}if(b&&!l){const _=ii(c.left,0),B=ii(c.right,0),N=ii(c.top,0),P=ii(c.bottom,0);h?k=f-2*(_!==0||B!==0?_+B:ii(c.left,c.right)):S=p-2*(N!==0||P!==0?N+P:ii(c.top,c.bottom))}await a({...e,availableWidth:k,availableHeight:S});const T=await i.getDimensions(s.floating);return f!==T.width||p!==T.height?{reset:{rects:!0}}:{}}}};function Ic(t){return Hk(t)?(t.nodeName||"").toLowerCase():"#document"}function ui(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Eo(t){var e;return(e=(Hk(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Hk(t){return t instanceof Node||t instanceof ui(t).Node}function go(t){return t instanceof Element||t instanceof ui(t).Element}function pa(t){return t instanceof HTMLElement||t instanceof ui(t).HTMLElement}function b6(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ui(t).ShadowRoot}function jp(t){const{overflow:e,overflowX:r,overflowY:n,display:i}=qi(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(i)}function oV(t){return["table","td","th"].includes(Ic(t))}function W3(t){const e=G3(),r=qi(t);return r.transform!=="none"||r.perspective!=="none"||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function cV(t){let e=kh(t);for(;pa(e)&&!_v(e);){if(W3(e))return e;e=kh(e)}return null}function G3(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function _v(t){return["html","body","#document"].includes(Ic(t))}function qi(t){return ui(t).getComputedStyle(t)}function kv(t){return go(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function kh(t){if(Ic(t)==="html")return t;const e=t.assignedSlot||t.parentNode||b6(t)&&t.host||Eo(t);return b6(e)?e.host:e}function zk(t){const e=kh(t);return _v(e)?t.ownerDocument?t.ownerDocument.body:t.body:pa(e)&&jp(e)?e:zk(e)}function Kd(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);const i=zk(t),s=i===((n=t.ownerDocument)==null?void 0:n.body),a=ui(i);return s?e.concat(a,a.visualViewport||[],jp(i)?i:[],a.frameElement&&r?Kd(a.frameElement):[]):e.concat(i,Kd(i,[],r))}function Vk(t){const e=qi(t);let r=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=pa(t),s=i?t.offsetWidth:r,a=i?t.offsetHeight:n,o=ym(r)!==s||ym(n)!==a;return o&&(r=s,n=a),{width:r,height:n,$:o}}function Z3(t){return go(t)?t:t.contextElement}function df(t){const e=Z3(t);if(!pa(e))return Bc(1);const r=e.getBoundingClientRect(),{width:n,height:i,$:s}=Vk(e);let a=(s?ym(r.width):r.width)/n,o=(s?ym(r.height):r.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const uV=Bc(0);function qk(t){const e=ui(t);return!G3()||!e.visualViewport?uV:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function lV(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==ui(t)?!1:e}function Ku(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);const i=t.getBoundingClientRect(),s=Z3(t);let a=Bc(1);e&&(n?go(n)&&(a=df(n)):a=df(t));const o=lV(s,r,n)?qk(s):Bc(0);let c=(i.left+o.x)/a.x,u=(i.top+o.y)/a.y,l=i.width/a.x,h=i.height/a.y;if(s){const f=ui(s),p=n&&go(n)?ui(n):n;let d=f.frameElement;for(;d&&n&&p!==f;){const g=df(d),y=d.getBoundingClientRect(),x=qi(d),b=y.left+(d.clientLeft+parseFloat(x.paddingLeft))*g.x,S=y.top+(d.clientTop+parseFloat(x.paddingTop))*g.y;c*=g.x,u*=g.y,l*=g.x,h*=g.y,c+=b,u+=S,d=ui(d).frameElement}}return bm({width:l,height:h,x:c,y:u})}function fV(t){let{rect:e,offsetParent:r,strategy:n}=t;const i=pa(r),s=Eo(r);if(r===s)return e;let a={scrollLeft:0,scrollTop:0},o=Bc(1);const c=Bc(0);if((i||!i&&n!=="fixed")&&((Ic(r)!=="body"||jp(s))&&(a=kv(r)),pa(r))){const u=Ku(r);o=df(r),c.x=u.x+r.clientLeft,c.y=u.y+r.clientTop}return{width:e.width*o.x,height:e.height*o.y,x:e.x*o.x-a.scrollLeft*o.x+c.x,y:e.y*o.y-a.scrollTop*o.y+c.y}}function hV(t){return Array.from(t.getClientRects())}function Kk(t){return Ku(Eo(t)).left+kv(t).scrollLeft}function dV(t){const e=Eo(t),r=kv(t),n=t.ownerDocument.body,i=ii(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=ii(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let a=-r.scrollLeft+Kk(t);const o=-r.scrollTop;return qi(n).direction==="rtl"&&(a+=ii(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:a,y:o}}function pV(t,e){const r=ui(t),n=Eo(t),i=r.visualViewport;let s=n.clientWidth,a=n.clientHeight,o=0,c=0;if(i){s=i.width,a=i.height;const u=G3();(!u||u&&e==="fixed")&&(o=i.offsetLeft,c=i.offsetTop)}return{width:s,height:a,x:o,y:c}}function gV(t,e){const r=Ku(t,!0,e==="fixed"),n=r.top+t.clientTop,i=r.left+t.clientLeft,s=pa(t)?df(t):Bc(1),a=t.clientWidth*s.x,o=t.clientHeight*s.y,c=i*s.x,u=n*s.y;return{width:a,height:o,x:c,y:u}}function w6(t,e,r){let n;if(e==="viewport")n=pV(t,r);else if(e==="document")n=dV(Eo(t));else if(go(e))n=gV(e,r);else{const i=qk(t);n={...e,x:e.x-i.x,y:e.y-i.y}}return bm(n)}function Wk(t,e){const r=kh(t);return r===e||!go(r)||_v(r)?!1:qi(r).position==="fixed"||Wk(r,e)}function mV(t,e){const r=e.get(t);if(r)return r;let n=Kd(t,[],!1).filter(o=>go(o)&&Ic(o)!=="body"),i=null;const s=qi(t).position==="fixed";let a=s?kh(t):t;for(;go(a)&&!_v(a);){const o=qi(a),c=W3(a);!c&&o.position==="fixed"&&(i=null),(s?!c&&!i:!c&&o.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||jp(a)&&!c&&Wk(t,a))?n=n.filter(l=>l!==a):i=o,a=kh(a)}return e.set(t,n),n}function vV(t){let{element:e,boundary:r,rootBoundary:n,strategy:i}=t;const a=[...r==="clippingAncestors"?mV(e,this._c):[].concat(r),n],o=a[0],c=a.reduce((u,l)=>{const h=w6(e,l,i);return u.top=ii(h.top,u.top),u.right=kc(h.right,u.right),u.bottom=kc(h.bottom,u.bottom),u.left=ii(h.left,u.left),u},w6(e,o,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function yV(t){const{width:e,height:r}=Vk(t);return{width:e,height:r}}function xV(t,e,r){const n=pa(e),i=Eo(e),s=r==="fixed",a=Ku(t,!0,s,e);let o={scrollLeft:0,scrollTop:0};const c=Bc(0);if(n||!n&&!s)if((Ic(e)!=="body"||jp(i))&&(o=kv(e)),n){const u=Ku(e,!0,s,e);c.x=u.x+e.clientLeft,c.y=u.y+e.clientTop}else i&&(c.x=Kk(i));return{x:a.left+o.scrollLeft-c.x,y:a.top+o.scrollTop-c.y,width:a.width,height:a.height}}function E6(t,e){return!pa(t)||qi(t).position==="fixed"?null:e?e(t):t.offsetParent}function Gk(t,e){const r=ui(t);if(!pa(t))return r;let n=E6(t,e);for(;n&&oV(n)&&qi(n).position==="static";)n=E6(n,e);return n&&(Ic(n)==="html"||Ic(n)==="body"&&qi(n).position==="static"&&!W3(n))?r:n||cV(t)||r}const bV=async function(t){let{reference:e,floating:r,strategy:n}=t;const i=this.getOffsetParent||Gk,s=this.getDimensions;return{reference:xV(e,await i(r),n),floating:{x:0,y:0,...await s(r)}}};function wV(t){return qi(t).direction==="rtl"}const EV={convertOffsetParentRelativeRectToViewportRelativeRect:fV,getDocumentElement:Eo,getClippingRect:vV,getOffsetParent:Gk,getElementRects:bV,getClientRects:hV,getDimensions:yV,getScale:df,isElement:go,isRTL:wV};function AV(t,e){let r=null,n;const i=Eo(t);function s(){clearTimeout(n),r&&r.disconnect(),r=null}function a(o,c){o===void 0&&(o=!1),c===void 0&&(c=1),s();const{left:u,top:l,width:h,height:f}=t.getBoundingClientRect();if(o||e(),!h||!f)return;const p=x1(l),d=x1(i.clientWidth-(u+h)),g=x1(i.clientHeight-(l+f)),y=x1(u),b={rootMargin:-p+"px "+-d+"px "+-g+"px "+-y+"px",threshold:ii(0,kc(1,c))||1};let S=!0;function k(T){const _=T[0].intersectionRatio;if(_!==c){if(!S)return a();_?a(!1,_):n=setTimeout(()=>{a(!1,1e-7)},100)}S=!1}try{r=new IntersectionObserver(k,{...b,root:i.ownerDocument})}catch{r=new IntersectionObserver(k,b)}r.observe(t)}return a(!0),s}function SV(t,e,r,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=Z3(t),l=i||s?[...u?Kd(u):[],...Kd(e)]:[];l.forEach(x=>{i&&x.addEventListener("scroll",r,{passive:!0}),s&&x.addEventListener("resize",r)});const h=u&&o?AV(u,r):null;let f=-1,p=null;a&&(p=new ResizeObserver(x=>{let[b]=x;b&&b.target===u&&p&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{p&&p.observe(e)})),r()}),u&&!c&&p.observe(u),p.observe(e));let d,g=c?Ku(t):null;c&&y();function y(){const x=Ku(t);g&&(x.x!==g.x||x.y!==g.y||x.width!==g.width||x.height!==g.height)&&r(),g=x,d=requestAnimationFrame(y)}return r(),()=>{l.forEach(x=>{i&&x.removeEventListener("scroll",r),s&&x.removeEventListener("resize",r)}),h&&h(),p&&p.disconnect(),p=null,c&&cancelAnimationFrame(d)}}const CV=iV,_V=eV,kV=aV,BV=tV,A6=Yz,IV=sV,FV=(t,e,r)=>{const n=new Map,i={platform:EV,...r},s={...i.platform,_c:n};return Qz(t,e,{...i,platform:s})},TV=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:n,padding:i}=typeof t=="function"?t(r):t;return n&&e(n)?n.current!=null?A6({element:n.current,padding:i}).fn(r):{}:n?A6({element:n,padding:i}).fn(r):{}}}};var ug=typeof document<"u"?K.useLayoutEffect:K.useEffect;function wm(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,n,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(n=r;n--!==0;)if(!wm(t[n],e[n]))return!1;return!0}if(i=Object.keys(t),r=i.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,i[n]))return!1;for(n=r;n--!==0;){const s=i[n];if(!(s==="_owner"&&t.$$typeof)&&!wm(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function Zk(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function S6(t,e){const r=Zk(t);return Math.round(e*r)/r}function C6(t){const e=K.useRef(t);return ug(()=>{e.current=t}),e}function PV(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:n=[],platform:i,elements:{reference:s,floating:a}={},transform:o=!0,whileElementsMounted:c,open:u}=t,[l,h]=K.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=K.useState(n);wm(f,n)||p(n);const[d,g]=K.useState(null),[y,x]=K.useState(null),b=K.useCallback(H=>{H!==_.current&&(_.current=H,g(H))},[]),S=K.useCallback(H=>{H!==B.current&&(B.current=H,x(H))},[]),k=s||d,T=a||y,_=K.useRef(null),B=K.useRef(null),N=K.useRef(l),P=c!=null,D=C6(c),O=C6(i),E=K.useCallback(()=>{if(!_.current||!B.current)return;const H={placement:e,strategy:r,middleware:f};O.current&&(H.platform=O.current),FV(_.current,B.current,H).then(G=>{const z={...G,isPositioned:!0};F.current&&!wm(N.current,z)&&(N.current=z,Wh.flushSync(()=>{h(z)}))})},[f,e,r,O]);ug(()=>{u===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,h(H=>({...H,isPositioned:!1})))},[u]);const F=K.useRef(!1);ug(()=>(F.current=!0,()=>{F.current=!1}),[]),ug(()=>{if(k&&(_.current=k),T&&(B.current=T),k&&T){if(D.current)return D.current(k,T,E);E()}},[k,T,E,D,P]);const A=K.useMemo(()=>({reference:_,floating:B,setReference:b,setFloating:S}),[b,S]),I=K.useMemo(()=>({reference:k,floating:T}),[k,T]),j=K.useMemo(()=>{const H={position:r,left:0,top:0};if(!I.floating)return H;const G=S6(I.floating,l.x),z=S6(I.floating,l.y);return o?{...H,transform:"translate("+G+"px, "+z+"px)",...Zk(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:G,top:z}},[r,o,I.floating,l.x,l.y]);return K.useMemo(()=>({...l,update:E,refs:A,elements:I,floatingStyles:j}),[l,E,A,I,j])}function Jk(t){const[e,r]=K.useState(void 0);return Vi(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const n=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let a,o;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,o=u.blockSize}else a=t.offsetWidth,o=t.offsetHeight;r({width:a,height:o})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}const Xk="Popper",[Qk,Yk]=Cv(Xk),[NV,eB]=Qk(Xk),OV=t=>{const{__scopePopper:e,children:r}=t,[n,i]=K.useState(null);return K.createElement(NV,{scope:e,anchor:n,onAnchorChange:i},r)},DV="PopperAnchor",RV=K.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:n,...i}=t,s=eB(DV,r),a=K.useRef(null),o=Jr(e,a);return K.useEffect(()=>{s.onAnchorChange((n==null?void 0:n.current)||a.current)}),n?null:K.createElement(kr.div,mt({},i,{ref:o}))}),tB="PopperContent",[MV,Sue]=Qk(tB),LV=K.forwardRef((t,e)=>{var r,n,i,s,a,o,c,u;const{__scopePopper:l,side:h="bottom",sideOffset:f=0,align:p="center",alignOffset:d=0,arrowPadding:g=0,avoidCollisions:y=!0,collisionBoundary:x=[],collisionPadding:b=0,sticky:S="partial",hideWhenDetached:k=!1,updatePositionStrategy:T="optimized",onPlaced:_,...B}=t,N=eB(tB,l),[P,D]=K.useState(null),O=Jr(e,ue=>D(ue)),[E,F]=K.useState(null),A=Jk(E),I=(r=A==null?void 0:A.width)!==null&&r!==void 0?r:0,j=(n=A==null?void 0:A.height)!==null&&n!==void 0?n:0,H=h+(p!=="center"?"-"+p:""),G=typeof b=="number"?b:{top:0,right:0,bottom:0,left:0,...b},z=Array.isArray(x)?x:[x],R=z.length>0,L={padding:G,boundary:z.filter(jV),altBoundary:R},{refs:q,floatingStyles:ee,placement:X,isPositioned:oe,middlewareData:me}=PV({strategy:"fixed",placement:H,whileElementsMounted:(...ue)=>SV(...ue,{animationFrame:T==="always"}),elements:{reference:N.anchor},middleware:[nV({mainAxis:f+j,alignmentAxis:d}),y&&CV({mainAxis:!0,crossAxis:!1,limiter:S==="partial"?IV():void 0,...L}),y&&_V({...L}),kV({...L,apply:({elements:ue,rects:se,availableWidth:Y,availableHeight:J})=>{const{width:ne,height:ge}=se.reference,de=ue.floating.style;de.setProperty("--radix-popper-available-width",`${Y}px`),de.setProperty("--radix-popper-available-height",`${J}px`),de.setProperty("--radix-popper-anchor-width",`${ne}px`),de.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),E&&TV({element:E,padding:g}),UV({arrowWidth:I,arrowHeight:j}),k&&BV({strategy:"referenceHidden",...L})]}),[le,fe]=rB(X),ve=fo(_);Vi(()=>{oe&&(ve==null||ve())},[oe,ve]);const Ae=(i=me.arrow)===null||i===void 0?void 0:i.x,Me=(s=me.arrow)===null||s===void 0?void 0:s.y,Be=((a=me.arrow)===null||a===void 0?void 0:a.centerOffset)!==0,[Pe,V]=K.useState();return Vi(()=>{P&&V(window.getComputedStyle(P).zIndex)},[P]),K.createElement("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...ee,transform:oe?ee.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Pe,"--radix-popper-transform-origin":[(o=me.transformOrigin)===null||o===void 0?void 0:o.x,(c=me.transformOrigin)===null||c===void 0?void 0:c.y].join(" ")},dir:t.dir},K.createElement(MV,{scope:l,placedSide:le,onArrowChange:F,arrowX:Ae,arrowY:Me,shouldHideArrow:Be},K.createElement(kr.div,mt({"data-side":le,"data-align":fe},B,{ref:O,style:{...B.style,animation:oe?void 0:"none",opacity:(u=me.hide)!==null&&u!==void 0&&u.referenceHidden?0:void 0}}))))});function jV(t){return t!==null}const UV=t=>({name:"transformOrigin",options:t,fn(e){var r,n,i,s,a;const{placement:o,rects:c,middlewareData:u}=e,h=((r=u.arrow)===null||r===void 0?void 0:r.centerOffset)!==0,f=h?0:t.arrowWidth,p=h?0:t.arrowHeight,[d,g]=rB(o),y={start:"0%",center:"50%",end:"100%"}[g],x=((n=(i=u.arrow)===null||i===void 0?void 0:i.x)!==null&&n!==void 0?n:0)+f/2,b=((s=(a=u.arrow)===null||a===void 0?void 0:a.y)!==null&&s!==void 0?s:0)+p/2;let S="",k="";return d==="bottom"?(S=h?y:`${x}px`,k=`${-p}px`):d==="top"?(S=h?y:`${x}px`,k=`${c.floating.height+p}px`):d==="right"?(S=`${-p}px`,k=h?y:`${b}px`):d==="left"&&(S=`${c.floating.width+p}px`,k=h?y:`${b}px`),{data:{x:S,y:k}}}});function rB(t){const[e,r="center"]=t.split("-");return[e,r]}const $V=OV,HV=RV,zV=LV,VV=K.forwardRef((t,e)=>{var r;const{container:n=globalThis==null||(r=globalThis.document)===null||r===void 0?void 0:r.body,...i}=t;return n?gD.createPortal(K.createElement(kr.div,mt({},i,{ref:e})),n):null});function bw({prop:t,defaultProp:e,onChange:r=()=>{}}){const[n,i]=qV({defaultProp:e,onChange:r}),s=t!==void 0,a=s?t:n,o=fo(r),c=K.useCallback(u=>{if(s){const h=typeof u=="function"?u(t):u;h!==t&&o(h)}else i(u)},[s,t,i,o]);return[a,c]}function qV({defaultProp:t,onChange:e}){const r=K.useState(t),[n]=r,i=K.useRef(n),s=fo(e);return K.useEffect(()=>{i.current!==n&&(s(n),i.current=n)},[n,i,s]),r}function nB(t){const e=K.useRef({value:t,previous:t});return K.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}const KV=K.forwardRef((t,e)=>K.createElement(kr.span,mt({},t,{ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}})));var WV=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},xl=new WeakMap,b1=new WeakMap,w1={},_2=0,iB=function(t){return t&&(t.host||iB(t.parentNode))},GV=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=iB(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},ZV=function(t,e,r,n){var i=GV(e,Array.isArray(t)?t:[t]);w1[r]||(w1[r]=new WeakMap);var s=w1[r],a=[],o=new Set,c=new Set(i),u=function(h){!h||o.has(h)||(o.add(h),u(h.parentNode))};i.forEach(u);var l=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(f){if(o.has(f))l(f);else{var p=f.getAttribute(n),d=p!==null&&p!=="false",g=(xl.get(f)||0)+1,y=(s.get(f)||0)+1;xl.set(f,g),s.set(f,y),a.push(f),g===1&&d&&b1.set(f,!0),y===1&&f.setAttribute(r,"true"),d||f.setAttribute(n,"true")}})};return l(e),o.clear(),_2++,function(){a.forEach(function(h){var f=xl.get(h)-1,p=s.get(h)-1;xl.set(h,f),s.set(h,p),f||(b1.has(h)||h.removeAttribute(n),b1.delete(h)),p||h.removeAttribute(r)}),_2--,_2||(xl=new WeakMap,xl=new WeakMap,b1=new WeakMap,w1={})}},JV=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),i=e||WV(t);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),ZV(n,i,r,"aria-hidden")):function(){return null}},Qs=function(){return Qs=Object.assign||function(e){for(var r,n=1,i=arguments.length;n"u")return hq;var e=dq(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},gq=cB(),mq=function(t,e,r,n){var i=t.left,s=t.top,a=t.right,o=t.gap;return r===void 0&&(r="margin"),` - .`.concat(QV,` { - overflow: hidden `).concat(n,`; - padding-right: `).concat(o,"px ").concat(n,`; - } - body { - overflow: hidden `).concat(n,`; - overscroll-behavior: contain; - `).concat([e&&"position: relative ".concat(n,";"),r==="margin"&&` - padding-left: `.concat(i,`px; - padding-top: `).concat(s,`px; - padding-right: `).concat(a,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(o,"px ").concat(n,`; - `),r==="padding"&&"padding-right: ".concat(o,"px ").concat(n,";")].filter(Boolean).join(""),` - } - - .`).concat(lg,` { - right: `).concat(o,"px ").concat(n,`; - } - - .`).concat(fg,` { - margin-right: `).concat(o,"px ").concat(n,`; - } - - .`).concat(lg," .").concat(lg,` { - right: 0 `).concat(n,`; - } - - .`).concat(fg," .").concat(fg,` { - margin-right: 0 `).concat(n,`; - } - - body { - `).concat(YV,": ").concat(o,`px; - } -`)},vq=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,i=n===void 0?"margin":n,s=K.useMemo(function(){return pq(i)},[i]);return K.createElement(gq,{styles:mq(s,!e,i,r?"":"!important")})},ww=!1;if(typeof window<"u")try{var E1=Object.defineProperty({},"passive",{get:function(){return ww=!0,!0}});window.addEventListener("test",E1,E1),window.removeEventListener("test",E1,E1)}catch{ww=!1}var bl=ww?{passive:!1}:!1,yq=function(t){return t.tagName==="TEXTAREA"},uB=function(t,e){var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!yq(t)&&r[e]==="visible")},xq=function(t){return uB(t,"overflowY")},bq=function(t){return uB(t,"overflowX")},B6=function(t,e){var r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var n=lB(t,r);if(n){var i=fB(t,r),s=i[1],a=i[2];if(s>a)return!0}r=r.parentNode}while(r&&r!==document.body);return!1},wq=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},Eq=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},lB=function(t,e){return t==="v"?xq(e):bq(e)},fB=function(t,e){return t==="v"?wq(e):Eq(e)},Aq=function(t,e){return t==="h"&&e==="rtl"?-1:1},Sq=function(t,e,r,n,i){var s=Aq(t,window.getComputedStyle(e).direction),a=s*n,o=r.target,c=e.contains(o),u=!1,l=a>0,h=0,f=0;do{var p=fB(t,o),d=p[0],g=p[1],y=p[2],x=g-y-s*d;(d||x)&&lB(t,o)&&(h+=x,f+=d),o=o.parentNode}while(!c&&o!==document.body||c&&(e.contains(o)||e===o));return(l&&(i&&h===0||!i&&a>h)||!l&&(i&&f===0||!i&&-a>f))&&(u=!0),u},A1=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},I6=function(t){return[t.deltaX,t.deltaY]},F6=function(t){return t&&"current"in t?t.current:t},Cq=function(t,e){return t[0]===e[0]&&t[1]===e[1]},_q=function(t){return` - .block-interactivity-`.concat(t,` {pointer-events: none;} - .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},kq=0,wl=[];function Bq(t){var e=K.useRef([]),r=K.useRef([0,0]),n=K.useRef(),i=K.useState(kq++)[0],s=K.useState(function(){return cB()})[0],a=K.useRef(t);K.useEffect(function(){a.current=t},[t]),K.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var g=XV([t.lockRef.current],(t.shards||[]).map(F6),!0).filter(Boolean);return g.forEach(function(y){return y.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),g.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var o=K.useCallback(function(g,y){if("touches"in g&&g.touches.length===2)return!a.current.allowPinchZoom;var x=A1(g),b=r.current,S="deltaX"in g?g.deltaX:b[0]-x[0],k="deltaY"in g?g.deltaY:b[1]-x[1],T,_=g.target,B=Math.abs(S)>Math.abs(k)?"h":"v";if("touches"in g&&B==="h"&&_.type==="range")return!1;var N=B6(B,_);if(!N)return!0;if(N?T=B:(T=B==="v"?"h":"v",N=B6(B,_)),!N)return!1;if(!n.current&&"changedTouches"in g&&(S||k)&&(n.current=T),!T)return!0;var P=n.current||T;return Sq(P,y,g,P==="h"?S:k,!0)},[]),c=K.useCallback(function(g){var y=g;if(!(!wl.length||wl[wl.length-1]!==s)){var x="deltaY"in y?I6(y):A1(y),b=e.current.filter(function(T){return T.name===y.type&&T.target===y.target&&Cq(T.delta,x)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}if(!b){var S=(a.current.shards||[]).map(F6).filter(Boolean).filter(function(T){return T.contains(y.target)}),k=S.length>0?o(y,S[0]):!a.current.noIsolation;k&&y.cancelable&&y.preventDefault()}}},[]),u=K.useCallback(function(g,y,x,b){var S={name:g,delta:y,target:x,should:b};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(k){return k!==S})},1)},[]),l=K.useCallback(function(g){r.current=A1(g),n.current=void 0},[]),h=K.useCallback(function(g){u(g.type,I6(g),g.target,o(g,t.lockRef.current))},[]),f=K.useCallback(function(g){u(g.type,A1(g),g.target,o(g,t.lockRef.current))},[]);K.useEffect(function(){return wl.push(s),t.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:f}),document.addEventListener("wheel",c,bl),document.addEventListener("touchmove",c,bl),document.addEventListener("touchstart",l,bl),function(){wl=wl.filter(function(g){return g!==s}),document.removeEventListener("wheel",c,bl),document.removeEventListener("touchmove",c,bl),document.removeEventListener("touchstart",l,bl)}},[]);var p=t.removeScrollBar,d=t.inert;return K.createElement(K.Fragment,null,d?K.createElement(s,{styles:_q(i)}):null,p?K.createElement(vq,{gapMode:"margin"}):null)}const Iq=sq(oB,Bq);var hB=K.forwardRef(function(t,e){return K.createElement(Bv,Qs({},t,{ref:e,sideCar:Iq}))});hB.classNames=Bv.classNames;const Fq=hB,Tq=[" ","Enter","ArrowUp","ArrowDown"],Pq=[" ","Enter"],Iv="Select",[Fv,Tv,Nq]=Ez(Iv),[t0,Cue]=Cv(Iv,[Nq,Yk]),J3=Yk(),[Oq,sl]=t0(Iv),[Dq,Rq]=t0(Iv),Mq=t=>{const{__scopeSelect:e,children:r,open:n,defaultOpen:i,onOpenChange:s,value:a,defaultValue:o,onValueChange:c,dir:u,name:l,autoComplete:h,disabled:f,required:p}=t,d=J3(e),[g,y]=K.useState(null),[x,b]=K.useState(null),[S,k]=K.useState(!1),T=Sz(u),[_=!1,B]=bw({prop:n,defaultProp:i,onChange:s}),[N,P]=bw({prop:a,defaultProp:o,onChange:c}),D=K.useRef(null),O=g?!!g.closest("form"):!0,[E,F]=K.useState(new Set),A=Array.from(E).map(I=>I.props.value).join(";");return K.createElement($V,d,K.createElement(Oq,{required:p,scope:e,trigger:g,onTriggerChange:y,valueNode:x,onValueNodeChange:b,valueNodeHasChildren:S,onValueNodeHasChildrenChange:k,contentId:Uk(),value:N,onValueChange:P,open:_,onOpenChange:B,dir:T,triggerPointerDownPosRef:D,disabled:f},K.createElement(Fv.Provider,{scope:e},K.createElement(Dq,{scope:t.__scopeSelect,onNativeOptionAdd:K.useCallback(I=>{F(j=>new Set(j).add(I))},[]),onNativeOptionRemove:K.useCallback(I=>{F(j=>{const H=new Set(j);return H.delete(I),H})},[])},r)),O?K.createElement(vB,{key:A,"aria-hidden":!0,required:p,tabIndex:-1,name:l,autoComplete:h,value:N,onChange:I=>P(I.target.value),disabled:f},N===void 0?K.createElement("option",{value:""}):null,Array.from(E)):null))},Lq="SelectTrigger",jq=K.forwardRef((t,e)=>{const{__scopeSelect:r,disabled:n=!1,...i}=t,s=J3(r),a=sl(Lq,r),o=a.disabled||n,c=Jr(e,a.onTriggerChange),u=Tv(r),[l,h,f]=yB(d=>{const g=u().filter(b=>!b.disabled),y=g.find(b=>b.value===a.value),x=xB(g,d,y);x!==void 0&&a.onValueChange(x.value)}),p=()=>{o||(a.onOpenChange(!0),f())};return K.createElement(HV,mt({asChild:!0},s),K.createElement(kr.button,mt({type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:o,"data-disabled":o?"":void 0,"data-placeholder":mB(a.value)?"":void 0},i,{ref:c,onClick:Sr(i.onClick,d=>{d.currentTarget.focus()}),onPointerDown:Sr(i.onPointerDown,d=>{const g=d.target;g.hasPointerCapture(d.pointerId)&&g.releasePointerCapture(d.pointerId),d.button===0&&d.ctrlKey===!1&&(p(),a.triggerPointerDownPosRef.current={x:Math.round(d.pageX),y:Math.round(d.pageY)},d.preventDefault())}),onKeyDown:Sr(i.onKeyDown,d=>{const g=l.current!=="";!(d.ctrlKey||d.altKey||d.metaKey)&&d.key.length===1&&h(d.key),!(g&&d.key===" ")&&Tq.includes(d.key)&&(p(),d.preventDefault())})})))}),Uq="SelectValue",$q=K.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:i,children:s,placeholder:a="",...o}=t,c=sl(Uq,r),{onValueNodeHasChildrenChange:u}=c,l=s!==void 0,h=Jr(e,c.onValueNodeChange);return Vi(()=>{u(l)},[u,l]),K.createElement(kr.span,mt({},o,{ref:h,style:{pointerEvents:"none"}}),mB(c.value)?K.createElement(K.Fragment,null,a):s)}),Hq=K.forwardRef((t,e)=>{const{__scopeSelect:r,children:n,...i}=t;return K.createElement(kr.span,mt({"aria-hidden":!0},i,{ref:e}),n||"▼")}),zq=t=>K.createElement(VV,mt({asChild:!0},t)),Bh="SelectContent",Vq=K.forwardRef((t,e)=>{const r=sl(Bh,t.__scopeSelect),[n,i]=K.useState();if(Vi(()=>{i(new DocumentFragment)},[]),!r.open){const s=n;return s?Wh.createPortal(K.createElement(dB,{scope:t.__scopeSelect},K.createElement(Fv.Slot,{scope:t.__scopeSelect},K.createElement("div",null,t.children))),s):null}return K.createElement(qq,mt({},t,{ref:e}))}),Sa=10,[dB,al]=t0(Bh),qq=K.forwardRef((t,e)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:a,side:o,sideOffset:c,align:u,alignOffset:l,arrowPadding:h,collisionBoundary:f,collisionPadding:p,sticky:d,hideWhenDetached:g,avoidCollisions:y,...x}=t,b=sl(Bh,r),[S,k]=K.useState(null),[T,_]=K.useState(null),B=Jr(e,le=>k(le)),[N,P]=K.useState(null),[D,O]=K.useState(null),E=Tv(r),[F,A]=K.useState(!1),I=K.useRef(!1);K.useEffect(()=>{if(S)return JV(S)},[S]),Oz();const j=K.useCallback(le=>{const[fe,...ve]=E().map(Be=>Be.ref.current),[Ae]=ve.slice(-1),Me=document.activeElement;for(const Be of le)if(Be===Me||(Be==null||Be.scrollIntoView({block:"nearest"}),Be===fe&&T&&(T.scrollTop=0),Be===Ae&&T&&(T.scrollTop=T.scrollHeight),Be==null||Be.focus(),document.activeElement!==Me))return},[E,T]),H=K.useCallback(()=>j([N,S]),[j,N,S]);K.useEffect(()=>{F&&H()},[F,H]);const{onOpenChange:G,triggerPointerDownPosRef:z}=b;K.useEffect(()=>{if(S){let le={x:0,y:0};const fe=Ae=>{var Me,Be,Pe,V;le={x:Math.abs(Math.round(Ae.pageX)-((Me=(Be=z.current)===null||Be===void 0?void 0:Be.x)!==null&&Me!==void 0?Me:0)),y:Math.abs(Math.round(Ae.pageY)-((Pe=(V=z.current)===null||V===void 0?void 0:V.y)!==null&&Pe!==void 0?Pe:0))}},ve=Ae=>{le.x<=10&&le.y<=10?Ae.preventDefault():S.contains(Ae.target)||G(!1),document.removeEventListener("pointermove",fe),z.current=null};return z.current!==null&&(document.addEventListener("pointermove",fe),document.addEventListener("pointerup",ve,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",fe),document.removeEventListener("pointerup",ve,{capture:!0})}}},[S,G,z]),K.useEffect(()=>{const le=()=>G(!1);return window.addEventListener("blur",le),window.addEventListener("resize",le),()=>{window.removeEventListener("blur",le),window.removeEventListener("resize",le)}},[G]);const[R,L]=yB(le=>{const fe=E().filter(Me=>!Me.disabled),ve=fe.find(Me=>Me.ref.current===document.activeElement),Ae=xB(fe,le,ve);Ae&&setTimeout(()=>Ae.ref.current.focus())}),q=K.useCallback((le,fe,ve)=>{const Ae=!I.current&&!ve;(b.value!==void 0&&b.value===fe||Ae)&&(P(le),Ae&&(I.current=!0))},[b.value]),ee=K.useCallback(()=>S==null?void 0:S.focus(),[S]),X=K.useCallback((le,fe,ve)=>{const Ae=!I.current&&!ve;(b.value!==void 0&&b.value===fe||Ae)&&O(le)},[b.value]),oe=n==="popper"?T6:Kq,me=oe===T6?{side:o,sideOffset:c,align:u,alignOffset:l,arrowPadding:h,collisionBoundary:f,collisionPadding:p,sticky:d,hideWhenDetached:g,avoidCollisions:y}:{};return K.createElement(dB,{scope:r,content:S,viewport:T,onViewportChange:_,itemRefCallback:q,selectedItem:N,onItemLeave:ee,itemTextRefCallback:X,focusSelectedItem:H,selectedItemText:D,position:n,isPositioned:F,searchRef:R},K.createElement(Fq,{as:mh,allowPinchZoom:!0},K.createElement(Dz,{asChild:!0,trapped:b.open,onMountAutoFocus:le=>{le.preventDefault()},onUnmountAutoFocus:Sr(i,le=>{var fe;(fe=b.trigger)===null||fe===void 0||fe.focus({preventScroll:!0}),le.preventDefault()})},K.createElement(Tz,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:le=>le.preventDefault(),onDismiss:()=>b.onOpenChange(!1)},K.createElement(oe,mt({role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:le=>le.preventDefault()},x,me,{onPlaced:()=>A(!0),ref:B,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:Sr(x.onKeyDown,le=>{const fe=le.ctrlKey||le.altKey||le.metaKey;if(le.key==="Tab"&&le.preventDefault(),!fe&&le.key.length===1&&L(le.key),["ArrowUp","ArrowDown","Home","End"].includes(le.key)){let Ae=E().filter(Me=>!Me.disabled).map(Me=>Me.ref.current);if(["ArrowUp","End"].includes(le.key)&&(Ae=Ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(le.key)){const Me=le.target,Be=Ae.indexOf(Me);Ae=Ae.slice(Be+1)}setTimeout(()=>j(Ae)),le.preventDefault()}})}))))))}),Kq=K.forwardRef((t,e)=>{const{__scopeSelect:r,onPlaced:n,...i}=t,s=sl(Bh,r),a=al(Bh,r),[o,c]=K.useState(null),[u,l]=K.useState(null),h=Jr(e,B=>l(B)),f=Tv(r),p=K.useRef(!1),d=K.useRef(!0),{viewport:g,selectedItem:y,selectedItemText:x,focusSelectedItem:b}=a,S=K.useCallback(()=>{if(s.trigger&&s.valueNode&&o&&u&&g&&y&&x){const B=s.trigger.getBoundingClientRect(),N=u.getBoundingClientRect(),P=s.valueNode.getBoundingClientRect(),D=x.getBoundingClientRect();if(s.dir!=="rtl"){const Me=D.left-N.left,Be=P.left-Me,Pe=B.left-Be,V=B.width+Pe,ue=Math.max(V,N.width),se=window.innerWidth-Sa,Y=u6(Be,[Sa,se-ue]);o.style.minWidth=V+"px",o.style.left=Y+"px"}else{const Me=N.right-D.right,Be=window.innerWidth-P.right-Me,Pe=window.innerWidth-B.right-Be,V=B.width+Pe,ue=Math.max(V,N.width),se=window.innerWidth-Sa,Y=u6(Be,[Sa,se-ue]);o.style.minWidth=V+"px",o.style.right=Y+"px"}const O=f(),E=window.innerHeight-Sa*2,F=g.scrollHeight,A=window.getComputedStyle(u),I=parseInt(A.borderTopWidth,10),j=parseInt(A.paddingTop,10),H=parseInt(A.borderBottomWidth,10),G=parseInt(A.paddingBottom,10),z=I+j+F+G+H,R=Math.min(y.offsetHeight*5,z),L=window.getComputedStyle(g),q=parseInt(L.paddingTop,10),ee=parseInt(L.paddingBottom,10),X=B.top+B.height/2-Sa,oe=E-X,me=y.offsetHeight/2,le=y.offsetTop+me,fe=I+j+le,ve=z-fe;if(fe<=X){const Me=y===O[O.length-1].ref.current;o.style.bottom="0px";const Be=u.clientHeight-g.offsetTop-g.offsetHeight,Pe=Math.max(oe,me+(Me?ee:0)+Be+H),V=fe+Pe;o.style.height=V+"px"}else{const Me=y===O[0].ref.current;o.style.top="0px";const Pe=Math.max(X,I+g.offsetTop+(Me?q:0)+me)+ve;o.style.height=Pe+"px",g.scrollTop=fe-X+g.offsetTop}o.style.margin=`${Sa}px 0`,o.style.minHeight=R+"px",o.style.maxHeight=E+"px",n==null||n(),requestAnimationFrame(()=>p.current=!0)}},[f,s.trigger,s.valueNode,o,u,g,y,x,s.dir,n]);Vi(()=>S(),[S]);const[k,T]=K.useState();Vi(()=>{u&&T(window.getComputedStyle(u).zIndex)},[u]);const _=K.useCallback(B=>{B&&d.current===!0&&(S(),b==null||b(),d.current=!1)},[S,b]);return K.createElement(Wq,{scope:r,contentWrapper:o,shouldExpandOnScrollRef:p,onScrollButtonChange:_},K.createElement("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k}},K.createElement(kr.div,mt({},i,{ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}}))))}),T6=K.forwardRef((t,e)=>{const{__scopeSelect:r,align:n="start",collisionPadding:i=Sa,...s}=t,a=J3(r);return K.createElement(zV,mt({},a,s,{ref:e,align:n,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}}))}),[Wq,X3]=t0(Bh,{}),P6="SelectViewport",Gq=K.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,i=al(P6,r),s=X3(P6,r),a=Jr(e,i.onViewportChange),o=K.useRef(0);return K.createElement(K.Fragment,null,K.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"}}),K.createElement(Fv.Slot,{scope:r},K.createElement(kr.div,mt({"data-radix-select-viewport":"",role:"presentation"},n,{ref:a,style:{position:"relative",flex:1,overflow:"auto",...n.style},onScroll:Sr(n.onScroll,c=>{const u=c.currentTarget,{contentWrapper:l,shouldExpandOnScrollRef:h}=s;if(h!=null&&h.current&&l){const f=Math.abs(o.current-u.scrollTop);if(f>0){const p=window.innerHeight-Sa*2,d=parseFloat(l.style.minHeight),g=parseFloat(l.style.height),y=Math.max(d,g);if(y0?S:0,l.style.justifyContent="flex-end")}}}o.current=u.scrollTop})}))))}),Zq="SelectGroup",[_ue,Jq]=t0(Zq),Xq="SelectLabel",Qq=K.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,i=Jq(Xq,r);return K.createElement(kr.div,mt({id:i.id},n,{ref:e}))}),Ew="SelectItem",[Yq,pB]=t0(Ew),eK=K.forwardRef((t,e)=>{const{__scopeSelect:r,value:n,disabled:i=!1,textValue:s,...a}=t,o=sl(Ew,r),c=al(Ew,r),u=o.value===n,[l,h]=K.useState(s??""),[f,p]=K.useState(!1),d=Jr(e,x=>{var b;return(b=c.itemRefCallback)===null||b===void 0?void 0:b.call(c,x,n,i)}),g=Uk(),y=()=>{i||(o.onValueChange(n),o.onOpenChange(!1))};if(n==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return K.createElement(Yq,{scope:r,value:n,disabled:i,textId:g,isSelected:u,onItemTextChange:K.useCallback(x=>{h(b=>{var S;return b||((S=x==null?void 0:x.textContent)!==null&&S!==void 0?S:"").trim()})},[])},K.createElement(Fv.ItemSlot,{scope:r,value:n,disabled:i,textValue:l},K.createElement(kr.div,mt({role:"option","aria-labelledby":g,"data-highlighted":f?"":void 0,"aria-selected":u&&f,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1},a,{ref:d,onFocus:Sr(a.onFocus,()=>p(!0)),onBlur:Sr(a.onBlur,()=>p(!1)),onPointerUp:Sr(a.onPointerUp,y),onPointerMove:Sr(a.onPointerMove,x=>{if(i){var b;(b=c.onItemLeave)===null||b===void 0||b.call(c)}else x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Sr(a.onPointerLeave,x=>{if(x.currentTarget===document.activeElement){var b;(b=c.onItemLeave)===null||b===void 0||b.call(c)}}),onKeyDown:Sr(a.onKeyDown,x=>{var b;((b=c.searchRef)===null||b===void 0?void 0:b.current)!==""&&x.key===" "||(Pq.includes(x.key)&&y(),x.key===" "&&x.preventDefault())})}))))}),S1="SelectItemText",tK=K.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:i,...s}=t,a=sl(S1,r),o=al(S1,r),c=pB(S1,r),u=Rq(S1,r),[l,h]=K.useState(null),f=Jr(e,x=>h(x),c.onItemTextChange,x=>{var b;return(b=o.itemTextRefCallback)===null||b===void 0?void 0:b.call(o,x,c.value,c.disabled)}),p=l==null?void 0:l.textContent,d=K.useMemo(()=>K.createElement("option",{key:c.value,value:c.value,disabled:c.disabled},p),[c.disabled,c.value,p]),{onNativeOptionAdd:g,onNativeOptionRemove:y}=u;return Vi(()=>(g(d),()=>y(d)),[g,y,d]),K.createElement(K.Fragment,null,K.createElement(kr.span,mt({id:c.textId},s,{ref:f})),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Wh.createPortal(s.children,a.valueNode):null)}),rK="SelectItemIndicator",nK=K.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return pB(rK,r).isSelected?K.createElement(kr.span,mt({"aria-hidden":!0},n,{ref:e})):null}),N6="SelectScrollUpButton",iK=K.forwardRef((t,e)=>{const r=al(N6,t.__scopeSelect),n=X3(N6,t.__scopeSelect),[i,s]=K.useState(!1),a=Jr(e,n.onScrollButtonChange);return Vi(()=>{if(r.viewport&&r.isPositioned){let c=function(){const u=o.scrollTop>0;s(u)};const o=r.viewport;return c(),o.addEventListener("scroll",c),()=>o.removeEventListener("scroll",c)}},[r.viewport,r.isPositioned]),i?K.createElement(gB,mt({},t,{ref:a,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=r;o&&c&&(o.scrollTop=o.scrollTop-c.offsetHeight)}})):null}),O6="SelectScrollDownButton",sK=K.forwardRef((t,e)=>{const r=al(O6,t.__scopeSelect),n=X3(O6,t.__scopeSelect),[i,s]=K.useState(!1),a=Jr(e,n.onScrollButtonChange);return Vi(()=>{if(r.viewport&&r.isPositioned){let c=function(){const u=o.scrollHeight-o.clientHeight,l=Math.ceil(o.scrollTop)o.removeEventListener("scroll",c)}},[r.viewport,r.isPositioned]),i?K.createElement(gB,mt({},t,{ref:a,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=r;o&&c&&(o.scrollTop=o.scrollTop+c.offsetHeight)}})):null}),gB=K.forwardRef((t,e)=>{const{__scopeSelect:r,onAutoScroll:n,...i}=t,s=al("SelectScrollButton",r),a=K.useRef(null),o=Tv(r),c=K.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return K.useEffect(()=>()=>c(),[c]),Vi(()=>{var u;const l=o().find(h=>h.ref.current===document.activeElement);l==null||(u=l.ref.current)===null||u===void 0||u.scrollIntoView({block:"nearest"})},[o]),K.createElement(kr.div,mt({"aria-hidden":!0},i,{ref:e,style:{flexShrink:0,...i.style},onPointerDown:Sr(i.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:Sr(i.onPointerMove,()=>{var u;(u=s.onItemLeave)===null||u===void 0||u.call(s),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:Sr(i.onPointerLeave,()=>{c()})}))}),aK=K.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return K.createElement(kr.div,mt({"aria-hidden":!0},n,{ref:e}))});function mB(t){return t===""||t===void 0}const vB=K.forwardRef((t,e)=>{const{value:r,...n}=t,i=K.useRef(null),s=Jr(e,i),a=nB(r);return K.useEffect(()=>{const o=i.current,c=window.HTMLSelectElement.prototype,l=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==r&&l){const h=new Event("change",{bubbles:!0});l.call(o,r),o.dispatchEvent(h)}},[a,r]),K.createElement(KV,{asChild:!0},K.createElement("select",mt({},n,{ref:s,defaultValue:r})))});vB.displayName="BubbleSelect";function yB(t){const e=fo(t),r=K.useRef(""),n=K.useRef(0),i=K.useCallback(a=>{const o=r.current+a;e(o),function c(u){r.current=u,window.clearTimeout(n.current),u!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(o)},[e]),s=K.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return K.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,i,s]}function xB(t,e,r){const i=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,s=r?t.indexOf(r):-1;let a=oK(t,Math.max(s,0));i.length===1&&(a=a.filter(u=>u!==r));const c=a.find(u=>u.textValue.toLowerCase().startsWith(i.toLowerCase()));return c!==r?c:void 0}function oK(t,e){return t.map((r,n)=>t[(e+n)%t.length])}const cK=Mq,bB=jq,uK=$q,lK=Hq,fK=zq,wB=Vq,hK=Gq,EB=Qq,AB=eK,dK=tK,pK=nK,SB=iK,CB=sK,_B=aK;/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var gK={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"};/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mK=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),wt=(t,e)=>{const r=K.forwardRef(({color:n="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:a,className:o="",children:c,...u},l)=>K.createElement("svg",{ref:l,...gK,width:i,height:i,stroke:n,strokeWidth:a?Number(s)*24/Number(i):s,className:["lucide",`lucide-${mK(t)}`,o].join(" "),...u},[...e.map(([h,f])=>K.createElement(h,f)),...Array.isArray(c)?c:[c]]));return r.displayName=`${t}`,r};/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vK=wt("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yK=wt("Banknote",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xK=wt("Box",[["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"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bK=wt("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wK=wt("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const EK=wt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Q3=wt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const AK=wt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const SK=wt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const CK=wt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _K=wt("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kK=wt("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const BK=wt("FolderClosed",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const IK=wt("HelpCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const FK=wt("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const TK=wt("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const PK=wt("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const NK=wt("Loader",[["line",{x1:"12",x2:"12",y1:"2",y2:"6",key:"gza1u7"}],["line",{x1:"12",x2:"12",y1:"18",y2:"22",key:"1qhbu9"}],["line",{x1:"4.93",x2:"7.76",y1:"4.93",y2:"7.76",key:"xae44r"}],["line",{x1:"16.24",x2:"19.07",y1:"16.24",y2:"19.07",key:"bxnmvf"}],["line",{x1:"2",x2:"6",y1:"12",y2:"12",key:"89khin"}],["line",{x1:"18",x2:"22",y1:"12",y2:"12",key:"pb8tfm"}],["line",{x1:"4.93",x2:"7.76",y1:"19.07",y2:"16.24",key:"1uxjnu"}],["line",{x1:"16.24",x2:"19.07",y1:"7.76",y2:"4.93",key:"6duxfx"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const OK=wt("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const DK=wt("MessageSquareMore",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M16 10h.01",key:"1m94wz"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const RK=wt("PlayCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const MK=wt("PlusCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const LK=wt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jK=wt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const UK=wt("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"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $K=wt("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2v0a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12v0a2 2 0 0 1-2-2V7",key:"jon5kx"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const HK=wt("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"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zK=wt("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const VK=wt("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"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qK=wt("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"}]]);/** - * @license lucide-react v0.309.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const KK=wt("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),WK=cK,GK=uK,kB=K.forwardRef(({className:t,children:e,...r},n)=>te.jsxs(bB,{ref:n,className:Hi("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...r,children:[e,te.jsx(lK,{asChild:!0,children:te.jsx(Q3,{className:"h-4 w-4 opacity-50"})})]}));kB.displayName=bB.displayName;const BB=K.forwardRef(({className:t,...e},r)=>te.jsx(SB,{ref:r,className:Hi("flex cursor-default items-center justify-center py-1",t),...e,children:te.jsx(CK,{className:"h-4 w-4"})}));BB.displayName=SB.displayName;const IB=K.forwardRef(({className:t,...e},r)=>te.jsx(CB,{ref:r,className:Hi("flex cursor-default items-center justify-center py-1",t),...e,children:te.jsx(Q3,{className:"h-4 w-4"})}));IB.displayName=CB.displayName;const FB=K.forwardRef(({className:t,children:e,position:r="popper",...n},i)=>te.jsx(fK,{children:te.jsxs(wB,{ref:i,className:Hi("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,...n,children:[te.jsx(BB,{}),te.jsx(hK,{className:Hi("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),te.jsx(IB,{})]})}));FB.displayName=wB.displayName;const ZK=K.forwardRef(({className:t,...e},r)=>te.jsx(EB,{ref:r,className:Hi("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));ZK.displayName=EB.displayName;const TB=K.forwardRef(({className:t,children:e,...r},n)=>te.jsxs(AB,{ref:n,className:Hi("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[te.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:te.jsx(pK,{children:te.jsx(EK,{className:"h-4 w-4"})})}),te.jsx(dK,{children:e})]}));TB.displayName=AB.displayName;const JK=K.forwardRef(({className:t,...e},r)=>te.jsx(_B,{ref:r,className:Hi("-mx-1 my-1 h-px bg-muted",t),...e}));JK.displayName=_B.displayName;const D6={chat:"/?getcode=tXTL4xmTgBWPhdcnG58zgxGdbLK1tCms_k5rrAHe1SE",token:"/?getcode=Vx0OaXCQV8dd87CiZSxm2dbH8Sn66_bsCzj_1y1BAjo",voting:"/?getcode=n8kHWl8s3n_6aQSUuURvUBUU16gEjYBU8_x4pANSbjs"};function XK({setActiveMenuItem:t}){const[e,r]=K.useState([]),[n,i]=K.useState(!1);K.useEffect(()=>{const a=new cM("https://arweave.net/graphql"),o=fM` - query ($address: [String!]!) { - transactions( - owners: $address - tags: [ - { name: "Data-Protocol", values: ["ao"] } - { name: "Type", values: ["Process"] } - ] - ) { - edges { - node { - id - } - } - } - } - `;async function c(){const u=await window.arweaveWallet.getActiveAddress();console.log(u);const l=await a.request(o,{address:u});console.log(l),r(l.transactions.edges.map(h=>h.node.id))}c()},[]);async function s(){i(!0);const a=_h(window.arweaveWallet);console.log(a);const o=await qu().spawn({module:H3,scheduler:z3,signer:a,tags:[]});console.log(o),r(c=>[o,...c]),localStorage.setItem("activeProcess",o),t("Notebook"),i(!1)}return te.jsxs("div",{className:"h-full flex flex-col gap-24 items-center justify-center",children:[te.jsxs("h1",{className:"text-3xl tracking-tight",children:[te.jsxs("span",{className:"italic font-light mr-1",children:["Unlock Infinite Creativity with"," "]}),te.jsx("span",{className:"bg-gradient-to-r from-[#006F86] to-white bg-clip-text text-transparent font-bold not-italic",children:"AO notebook's threaded computer"})]}),te.jsxs("div",{className:"w-full max-w-xl flex flex-col gap-3",children:[te.jsx("h3",{className:"text-xl font-bold",children:"Your Processes"}),te.jsxs("div",{className:"flex flex-row gap-3 items-center",children:[te.jsxs(WK,{disabled:e.length===0||n,onValueChange:a=>{localStorage.setItem("activeProcess",a),t("Notebook")},children:[te.jsx(kB,{className:"flex-grow max-w-full",children:te.jsx(GK,{placeholder:n?"Spawning...":"Process ID"})}),te.jsx(FB,{children:e.map(a=>te.jsx(TB,{value:a,children:a},a))})]}),te.jsx("div",{children:"OR"}),te.jsx(Za,{disabled:n,onClick:s,children:n?"spawning new process...":"Create New Process"})]})]}),te.jsxs("div",{className:"w-full max-w-xl flex flex-col gap-3",children:[te.jsx("h3",{className:"text-xl font-bold",children:"Explore templates"}),te.jsx("div",{className:"grid grid-cols-3 gap-2",children:Object.keys(D6).map((a,o)=>te.jsx(Za,{onClick:()=>{window.open(D6[a])},children:a},o))})]})]})}const QK="modulepreload",YK=function(t,e){return new URL(t,e).href},R6={},Aw=function(e,r,n){let i=Promise.resolve();if(r&&r.length>0){const s=document.getElementsByTagName("link");i=Promise.all(r.map(a=>{if(a=YK(a,n),a in R6)return;R6[a]=!0;const o=a.endsWith(".css"),c=o?'[rel="stylesheet"]':"";if(!!n)for(let h=s.length-1;h>=0;h--){const f=s[h];if(f.href===a&&(!o||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${c}`))return;const l=document.createElement("link");if(l.rel=o?"stylesheet":QK,o||(l.as="script",l.crossOrigin=""),l.href=a,document.head.appendChild(l),o)return new Promise((h,f)=>{l.addEventListener("load",h),l.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${a}`)))})}))}return i.then(()=>e()).catch(s=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s})};function PB(t,e){return function(){return t.apply(e,arguments)}}const{toString:eW}=Object.prototype,{getPrototypeOf:Y3}=Object,Pv=(t=>e=>{const r=eW.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),ya=t=>(t=t.toLowerCase(),e=>Pv(e)===t),Nv=t=>e=>typeof e===t,{isArray:r0}=Array,Wd=Nv("undefined");function tW(t){return t!==null&&!Wd(t)&&t.constructor!==null&&!Wd(t.constructor)&&Ri(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const NB=ya("ArrayBuffer");function rW(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&NB(t.buffer),e}const nW=Nv("string"),Ri=Nv("function"),OB=Nv("number"),Ov=t=>t!==null&&typeof t=="object",iW=t=>t===!0||t===!1,hg=t=>{if(Pv(t)!=="object")return!1;const e=Y3(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},sW=ya("Date"),aW=ya("File"),oW=ya("Blob"),cW=ya("FileList"),uW=t=>Ov(t)&&Ri(t.pipe),lW=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Ri(t.append)&&((e=Pv(t))==="formdata"||e==="object"&&Ri(t.toString)&&t.toString()==="[object FormData]"))},fW=ya("URLSearchParams"),hW=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Up(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),r0(t))for(n=0,i=t.length;n0;)if(i=r[n],e===i.toLowerCase())return i;return null}const RB=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,MB=t=>!Wd(t)&&t!==RB;function Sw(){const{caseless:t}=MB(this)&&this||{},e={},r=(n,i)=>{const s=t&&DB(e,i)||i;hg(e[s])&&hg(n)?e[s]=Sw(e[s],n):hg(n)?e[s]=Sw({},n):r0(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n(Up(e,(i,s)=>{r&&Ri(i)?t[s]=PB(i,r):t[s]=i},{allOwnKeys:n}),t),pW=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),gW=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},mW=(t,e,r,n)=>{let i,s,a;const o={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)a=i[s],(!n||n(a,t,e))&&!o[a]&&(e[a]=t[a],o[a]=!0);t=r!==!1&&Y3(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},vW=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},yW=t=>{if(!t)return null;if(r0(t))return t;let e=t.length;if(!OB(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},xW=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Y3(Uint8Array)),bW=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},wW=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},EW=ya("HTMLFormElement"),AW=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),M6=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),SW=ya("RegExp"),LB=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};Up(r,(i,s)=>{let a;(a=e(i,s,t))!==!1&&(n[s]=a||i)}),Object.defineProperties(t,n)},CW=t=>{LB(t,(e,r)=>{if(Ri(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Ri(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},_W=(t,e)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return r0(t)?n(t):n(String(t).split(e)),r},kW=()=>{},BW=(t,e)=>(t=+t,Number.isFinite(t)?t:e),F2="abcdefghijklmnopqrstuvwxyz",L6="0123456789",jB={DIGIT:L6,ALPHA:F2,ALPHA_DIGIT:F2+F2.toUpperCase()+L6},IW=(t=16,e=jB.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function FW(t){return!!(t&&Ri(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const TW=t=>{const e=new Array(10),r=(n,i)=>{if(Ov(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=r0(n)?[]:{};return Up(n,(a,o)=>{const c=r(a,i+1);!Wd(c)&&(s[o]=c)}),e[i]=void 0,s}}return n};return r(t,0)},PW=ya("AsyncFunction"),NW=t=>t&&(Ov(t)||Ri(t))&&Ri(t.then)&&Ri(t.catch),Se={isArray:r0,isArrayBuffer:NB,isBuffer:tW,isFormData:lW,isArrayBufferView:rW,isString:nW,isNumber:OB,isBoolean:iW,isObject:Ov,isPlainObject:hg,isUndefined:Wd,isDate:sW,isFile:aW,isBlob:oW,isRegExp:SW,isFunction:Ri,isStream:uW,isURLSearchParams:fW,isTypedArray:xW,isFileList:cW,forEach:Up,merge:Sw,extend:dW,trim:hW,stripBOM:pW,inherits:gW,toFlatObject:mW,kindOf:Pv,kindOfTest:ya,endsWith:vW,toArray:yW,forEachEntry:bW,matchAll:wW,isHTMLForm:EW,hasOwnProperty:M6,hasOwnProp:M6,reduceDescriptors:LB,freezeMethods:CW,toObjectSet:_W,toCamelCase:AW,noop:kW,toFiniteNumber:BW,findKey:DB,global:RB,isContextDefined:MB,ALPHABET:jB,generateString:IW,isSpecCompliantForm:FW,toJSONObject:TW,isAsyncFn:PW,isThenable:NW};function pt(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}Se.inherits(pt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Se.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const UB=pt.prototype,$B={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{$B[t]={value:t}});Object.defineProperties(pt,$B);Object.defineProperty(UB,"isAxiosError",{value:!0});pt.from=(t,e,r,n,i,s)=>{const a=Object.create(UB);return Se.toFlatObject(t,a,function(c){return c!==Error.prototype},o=>o!=="isAxiosError"),pt.call(a,t.message,e,r,n,i),a.cause=t,a.name=t.name,s&&Object.assign(a,s),a};const OW=null;function Cw(t){return Se.isPlainObject(t)||Se.isArray(t)}function HB(t){return Se.endsWith(t,"[]")?t.slice(0,-2):t}function j6(t,e,r){return t?t.concat(e).map(function(i,s){return i=HB(i),!r&&s?"["+i+"]":i}).join(r?".":""):e}function DW(t){return Se.isArray(t)&&!t.some(Cw)}const RW=Se.toFlatObject(Se,{},null,function(e){return/^is[A-Z]/.test(e)});function Dv(t,e,r){if(!Se.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=Se.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,y){return!Se.isUndefined(y[g])});const n=r.metaTokens,i=r.visitor||l,s=r.dots,a=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&Se.isSpecCompliantForm(e);if(!Se.isFunction(i))throw new TypeError("visitor must be a function");function u(d){if(d===null)return"";if(Se.isDate(d))return d.toISOString();if(!c&&Se.isBlob(d))throw new pt("Blob is not supported. Use a Buffer instead.");return Se.isArrayBuffer(d)||Se.isTypedArray(d)?c&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function l(d,g,y){let x=d;if(d&&!y&&typeof d=="object"){if(Se.endsWith(g,"{}"))g=n?g:g.slice(0,-2),d=JSON.stringify(d);else if(Se.isArray(d)&&DW(d)||(Se.isFileList(d)||Se.endsWith(g,"[]"))&&(x=Se.toArray(d)))return g=HB(g),x.forEach(function(S,k){!(Se.isUndefined(S)||S===null)&&e.append(a===!0?j6([g],k,s):a===null?g:g+"[]",u(S))}),!1}return Cw(d)?!0:(e.append(j6(y,g,s),u(d)),!1)}const h=[],f=Object.assign(RW,{defaultVisitor:l,convertValue:u,isVisitable:Cw});function p(d,g){if(!Se.isUndefined(d)){if(h.indexOf(d)!==-1)throw Error("Circular reference detected in "+g.join("."));h.push(d),Se.forEach(d,function(x,b){(!(Se.isUndefined(x)||x===null)&&i.call(e,x,Se.isString(b)?b.trim():b,g,f))===!0&&p(x,g?g.concat(b):[b])}),h.pop()}}if(!Se.isObject(t))throw new TypeError("data must be an object");return p(t),e}function U6(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function e8(t,e){this._pairs=[],t&&Dv(t,this,e)}const zB=e8.prototype;zB.append=function(e,r){this._pairs.push([e,r])};zB.toString=function(e){const r=e?function(n){return e.call(this,n,U6)}:U6;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function MW(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function VB(t,e,r){if(!e)return t;const n=r&&r.encode||MW,i=r&&r.serialize;let s;if(i?s=i(e,r):s=Se.isURLSearchParams(e)?e.toString():new e8(e,r).toString(n),s){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class LW{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Se.forEach(this.handlers,function(n){n!==null&&e(n)})}}const $6=LW,qB={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},jW=typeof URLSearchParams<"u"?URLSearchParams:e8,UW=typeof FormData<"u"?FormData:null,$W=typeof Blob<"u"?Blob:null,HW={isBrowser:!0,classes:{URLSearchParams:jW,FormData:UW,Blob:$W},protocols:["http","https","file","blob","url","data"]},KB=typeof window<"u"&&typeof document<"u",zW=(t=>KB&&["ReactNative","NativeScript","NS"].indexOf(t)<0)(typeof navigator<"u"&&navigator.product),VW=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",qW=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:KB,hasStandardBrowserEnv:zW,hasStandardBrowserWebWorkerEnv:VW},Symbol.toStringTag,{value:"Module"})),ra={...qW,...HW};function KW(t,e){return Dv(t,new ra.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return ra.isNode&&Se.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function WW(t){return Se.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function GW(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n=r.length;return a=!a&&Se.isArray(i)?i.length:a,c?(Se.hasOwnProp(i,a)?i[a]=[i[a],n]:i[a]=n,!o):((!i[a]||!Se.isObject(i[a]))&&(i[a]=[]),e(r,n,i[a],s)&&Se.isArray(i[a])&&(i[a]=GW(i[a])),!o)}if(Se.isFormData(t)&&Se.isFunction(t.entries)){const r={};return Se.forEachEntry(t,(n,i)=>{e(WW(n),i,r,0)}),r}return null}function ZW(t,e,r){if(Se.isString(t))try{return(e||JSON.parse)(t),Se.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const t8={transitional:qB,adapter:["xhr","http"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=Se.isObject(e);if(s&&Se.isHTMLForm(e)&&(e=new FormData(e)),Se.isFormData(e))return i&&i?JSON.stringify(WB(e)):e;if(Se.isArrayBuffer(e)||Se.isBuffer(e)||Se.isStream(e)||Se.isFile(e)||Se.isBlob(e))return e;if(Se.isArrayBufferView(e))return e.buffer;if(Se.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return KW(e,this.formSerializer).toString();if((o=Se.isFileList(e))||n.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Dv(o?{"files[]":e}:e,c&&new c,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),ZW(e)):e}],transformResponse:[function(e){const r=this.transitional||t8.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(e&&Se.isString(e)&&(n&&!this.responseType||i)){const a=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(o){if(a)throw o.name==="SyntaxError"?pt.from(o,pt.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ra.classes.FormData,Blob:ra.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Se.forEach(["delete","get","head","post","put","patch"],t=>{t8.headers[t]={}});const r8=t8,JW=Se.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),XW=t=>{const e={};let r,n,i;return t&&t.split(` -`).forEach(function(a){i=a.indexOf(":"),r=a.substring(0,i).trim().toLowerCase(),n=a.substring(i+1).trim(),!(!r||e[r]&&JW[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},H6=Symbol("internals");function S0(t){return t&&String(t).trim().toLowerCase()}function dg(t){return t===!1||t==null?t:Se.isArray(t)?t.map(dg):String(t)}function QW(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const YW=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function T2(t,e,r,n,i){if(Se.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!Se.isString(e)){if(Se.isString(n))return e.indexOf(n)!==-1;if(Se.isRegExp(n))return n.test(e)}}function eG(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function tG(t,e){const r=Se.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,a){return this[n].call(this,e,i,s,a)},configurable:!0})})}class Rv{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(o,c,u){const l=S0(c);if(!l)throw new Error("header name must be a non-empty string");const h=Se.findKey(i,l);(!h||i[h]===void 0||u===!0||u===void 0&&i[h]!==!1)&&(i[h||c]=dg(o))}const a=(o,c)=>Se.forEach(o,(u,l)=>s(u,l,c));return Se.isPlainObject(e)||e instanceof this.constructor?a(e,r):Se.isString(e)&&(e=e.trim())&&!YW(e)?a(XW(e),r):e!=null&&s(r,e,n),this}get(e,r){if(e=S0(e),e){const n=Se.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return QW(i);if(Se.isFunction(r))return r.call(this,i,n);if(Se.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=S0(e),e){const n=Se.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||T2(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function s(a){if(a=S0(a),a){const o=Se.findKey(n,a);o&&(!r||T2(n,n[o],o,r))&&(delete n[o],i=!0)}}return Se.isArray(e)?e.forEach(s):s(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!e||T2(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const r=this,n={};return Se.forEach(this,(i,s)=>{const a=Se.findKey(n,s);if(a){r[a]=dg(i),delete r[s];return}const o=e?eG(s):String(s).trim();o!==s&&delete r[s],r[o]=dg(i),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return Se.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&Se.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[H6]=this[H6]={accessors:{}}).accessors,i=this.prototype;function s(a){const o=S0(a);n[o]||(tG(i,a),n[o]=!0)}return Se.isArray(e)?e.forEach(s):s(e),this}}Rv.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Se.reduceDescriptors(Rv.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});Se.freezeMethods(Rv);const ro=Rv;function P2(t,e){const r=this||r8,n=e||r,i=ro.from(n.headers);let s=n.data;return Se.forEach(t,function(o){s=o.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function GB(t){return!!(t&&t.__CANCEL__)}function $p(t,e,r){pt.call(this,t??"canceled",pt.ERR_CANCELED,e,r),this.name="CanceledError"}Se.inherits($p,pt,{__CANCEL__:!0});function rG(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new pt("Request failed with status code "+r.status,[pt.ERR_BAD_REQUEST,pt.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}const nG=ra.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const a=[t+"="+encodeURIComponent(e)];Se.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),Se.isString(n)&&a.push("path="+n),Se.isString(i)&&a.push("domain="+i),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function iG(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function sG(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}function ZB(t,e){return t&&!iG(e)?sG(t,e):e}const aG=ra.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");let n;function i(s){let a=s;return e&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(a){const o=Se.isString(a)?i(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}();function oG(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function cG(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,s=0,a;return e=e!==void 0?e:1e3,function(c){const u=Date.now(),l=n[s];a||(a=u),r[i]=c,n[i]=u;let h=s,f=0;for(;h!==i;)f+=r[h++],h=h%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),u-a{const s=i.loaded,a=i.lengthComputable?i.total:void 0,o=s-r,c=n(o),u=s<=a;r=s;const l={loaded:s,total:a,progress:a?s/a:void 0,bytes:o,rate:c||void 0,estimated:c&&a&&u?(a-s)/c:void 0,event:i};l[e?"download":"upload"]=!0,t(l)}}const uG=typeof XMLHttpRequest<"u",lG=uG&&function(t){return new Promise(function(r,n){let i=t.data;const s=ro.from(t.headers).normalize();let{responseType:a,withXSRFToken:o}=t,c;function u(){t.cancelToken&&t.cancelToken.unsubscribe(c),t.signal&&t.signal.removeEventListener("abort",c)}let l;if(Se.isFormData(i)){if(ra.hasStandardBrowserEnv||ra.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((l=s.getContentType())!==!1){const[g,...y]=l?l.split(";").map(x=>x.trim()).filter(Boolean):[];s.setContentType([g||"multipart/form-data",...y].join("; "))}}let h=new XMLHttpRequest;if(t.auth){const g=t.auth.username||"",y=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(g+":"+y))}const f=ZB(t.baseURL,t.url);h.open(t.method.toUpperCase(),VB(f,t.params,t.paramsSerializer),!0),h.timeout=t.timeout;function p(){if(!h)return;const g=ro.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),x={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:g,config:t,request:h};rG(function(S){r(S),u()},function(S){n(S),u()},x),h=null}if("onloadend"in h?h.onloadend=p:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(p)},h.onabort=function(){h&&(n(new pt("Request aborted",pt.ECONNABORTED,t,h)),h=null)},h.onerror=function(){n(new pt("Network Error",pt.ERR_NETWORK,t,h)),h=null},h.ontimeout=function(){let y=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const x=t.transitional||qB;t.timeoutErrorMessage&&(y=t.timeoutErrorMessage),n(new pt(y,x.clarifyTimeoutError?pt.ETIMEDOUT:pt.ECONNABORTED,t,h)),h=null},ra.hasStandardBrowserEnv&&(o&&Se.isFunction(o)&&(o=o(t)),o||o!==!1&&aG(f))){const g=t.xsrfHeaderName&&t.xsrfCookieName&&nG.read(t.xsrfCookieName);g&&s.set(t.xsrfHeaderName,g)}i===void 0&&s.setContentType(null),"setRequestHeader"in h&&Se.forEach(s.toJSON(),function(y,x){h.setRequestHeader(x,y)}),Se.isUndefined(t.withCredentials)||(h.withCredentials=!!t.withCredentials),a&&a!=="json"&&(h.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&h.addEventListener("progress",z6(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&h.upload&&h.upload.addEventListener("progress",z6(t.onUploadProgress)),(t.cancelToken||t.signal)&&(c=g=>{h&&(n(!g||g.type?new $p(null,t,h):g),h.abort(),h=null)},t.cancelToken&&t.cancelToken.subscribe(c),t.signal&&(t.signal.aborted?c():t.signal.addEventListener("abort",c)));const d=oG(f);if(d&&ra.protocols.indexOf(d)===-1){n(new pt("Unsupported protocol "+d+":",pt.ERR_BAD_REQUEST,t));return}h.send(i||null)})},_w={http:OW,xhr:lG};Se.forEach(_w,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const V6=t=>`- ${t}`,fG=t=>Se.isFunction(t)||t===null||t===!1,JB={getAdapter:t=>{t=Se.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s`adapter ${o} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=e?s.length>1?`since : -`+s.map(V6).join(` -`):" "+V6(s[0]):"as no adapter specified";throw new pt("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return n},adapters:_w};function N2(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new $p(null,t)}function q6(t){return N2(t),t.headers=ro.from(t.headers),t.data=P2.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),JB.getAdapter(t.adapter||r8.adapter)(t).then(function(n){return N2(t),n.data=P2.call(t,t.transformResponse,n),n.headers=ro.from(n.headers),n},function(n){return GB(n)||(N2(t),n&&n.response&&(n.response.data=P2.call(t,t.transformResponse,n.response),n.response.headers=ro.from(n.response.headers))),Promise.reject(n)})}const K6=t=>t instanceof ro?t.toJSON():t;function Ih(t,e){e=e||{};const r={};function n(u,l,h){return Se.isPlainObject(u)&&Se.isPlainObject(l)?Se.merge.call({caseless:h},u,l):Se.isPlainObject(l)?Se.merge({},l):Se.isArray(l)?l.slice():l}function i(u,l,h){if(Se.isUndefined(l)){if(!Se.isUndefined(u))return n(void 0,u,h)}else return n(u,l,h)}function s(u,l){if(!Se.isUndefined(l))return n(void 0,l)}function a(u,l){if(Se.isUndefined(l)){if(!Se.isUndefined(u))return n(void 0,u)}else return n(void 0,l)}function o(u,l,h){if(h in e)return n(u,l);if(h in t)return n(void 0,u)}const c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(u,l)=>i(K6(u),K6(l),!0)};return Se.forEach(Object.keys(Object.assign({},t,e)),function(l){const h=c[l]||i,f=h(t[l],e[l],l);Se.isUndefined(f)&&h!==o||(r[l]=f)}),r}const XB="1.6.2",n8={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{n8[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const W6={};n8.transitional=function(e,r,n){function i(s,a){return"[Axios v"+XB+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return(s,a,o)=>{if(e===!1)throw new pt(i(a," has been removed"+(r?" in "+r:"")),pt.ERR_DEPRECATED);return r&&!W6[a]&&(W6[a]=!0,console.warn(i(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,a,o):!0}};function hG(t,e,r){if(typeof t!="object")throw new pt("options must be an object",pt.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],a=e[s];if(a){const o=t[s],c=o===void 0||a(o,s,t);if(c!==!0)throw new pt("option "+s+" must be "+c,pt.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new pt("Unknown option "+s,pt.ERR_BAD_OPTION)}}const kw={assertOptions:hG,validators:n8},Io=kw.validators;class Em{constructor(e){this.defaults=e,this.interceptors={request:new $6,response:new $6}}request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=Ih(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&kw.assertOptions(n,{silentJSONParsing:Io.transitional(Io.boolean),forcedJSONParsing:Io.transitional(Io.boolean),clarifyTimeoutError:Io.transitional(Io.boolean)},!1),i!=null&&(Se.isFunction(i)?r.paramsSerializer={serialize:i}:kw.assertOptions(i,{encode:Io.function,serialize:Io.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=s&&Se.merge(s.common,s[r.method]);s&&Se.forEach(["delete","get","head","post","put","patch","common"],d=>{delete s[d]}),r.headers=ro.concat(a,s);const o=[];let c=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(r)===!1||(c=c&&g.synchronous,o.unshift(g.fulfilled,g.rejected))});const u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let l,h=0,f;if(!c){const d=[q6.bind(this),void 0];for(d.unshift.apply(d,o),d.push.apply(d,u),f=d.length,l=Promise.resolve(r);h{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const a=new Promise(o=>{n.subscribe(o),s=o}).then(i);return a.cancel=function(){n.unsubscribe(s)},a},e(function(s,a,o){n.reason||(n.reason=new $p(s,a,o),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}static source(){let e;return{token:new i8(function(i){e=i}),cancel:e}}}const dG=i8;function pG(t){return function(r){return t.apply(null,r)}}function gG(t){return Se.isObject(t)&&t.isAxiosError===!0}const Bw={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Bw).forEach(([t,e])=>{Bw[e]=t});const mG=Bw;function QB(t){const e=new pg(t),r=PB(pg.prototype.request,e);return Se.extend(r,pg.prototype,e,{allOwnKeys:!0}),Se.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return QB(Ih(t,i))},r}const br=QB(r8);br.Axios=pg;br.CanceledError=$p;br.CancelToken=dG;br.isCancel=GB;br.VERSION=XB;br.toFormData=Dv;br.AxiosError=pt;br.Cancel=br.CanceledError;br.all=function(e){return Promise.all(e)};br.spread=pG;br.isAxiosError=gG;br.mergeConfig=Ih;br.AxiosHeaders=ro;br.formToJSON=t=>WB(Se.isHTMLForm(t)?new FormData(t):t);br.getAdapter=JB.getAdapter;br.HttpStatusCode=mG;br.default=br;const gi=br;function Js(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(n=Object.getOwnPropertySymbols(t);i0&&f[f.length-1])||b[0]!==6&&b[0]!==2)){d=0;continue}if(b[0]===3&&(!f||b[1]>f[0]&&b[1]0?setTimeout(h,x):h()}}window.addEventListener("storage",g),c.addToWaiting(g);var y=setTimeout(g,Math.max(0,u-Date.now()))})];case 1:return l.sent(),[2]}})})},c.addToWaiting=function(u){this.removeFromWaiting(u),c.waiters!==void 0&&c.waiters.push(u)},c.removeFromWaiting=function(u){c.waiters!==void 0&&(c.waiters=c.waiters.filter(function(l){return l!==u}))},c.notifyWaiters=function(){c.waiters!==void 0&&c.waiters.slice().forEach(function(u){return u()})},c.prototype.releaseLock=function(u){return r(this,void 0,void 0,function(){return n(this,function(l){switch(l.label){case 0:return[4,this.releaseLock__private__(u)];case 1:return[2,l.sent()]}})})},c.prototype.releaseLock__private__=function(u){return r(this,void 0,void 0,function(){var l,h,f;return n(this,function(p){switch(p.label){case 0:return l=window.localStorage,h=i+"-"+u,(f=l.getItem(h))===null?[2]:(f=JSON.parse(f)).id!==this.id?[3,2]:[4,Zc.default().lock(f.iat)];case 1:p.sent(),this.acquiredIatSet.delete(f.iat),l.removeItem(h),Zc.default().unlock(f.iat),c.notifyWaiters(),p.label=2;case 2:return[2]}})})},c.lockCorrector=function(){for(var u=Date.now()-5e3,l=window.localStorage,h=Object.keys(l),f=!1,p=0;pDate.now();let ri=class Iw extends Error{constructor(e,r){super(r),this.error=e,this.error_description=r,Object.setPrototypeOf(this,Iw.prototype)}static fromPayload({error:e,error_description:r}){return new Iw(e,r)}},xG=class tI extends ri{constructor(e,r,n,i=null){super(e,r),this.state=n,this.appState=i,Object.setPrototypeOf(this,tI.prototype)}},Fw=class rI extends ri{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,rI.prototype)}},bG=class nI extends Fw{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,nI.prototype)}},wG=class iI extends ri{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,iI.prototype)}},EG=class sI extends ri{constructor(e,r,n){super(e,r),this.mfa_token=n,Object.setPrototypeOf(this,sI.prototype)}},aI=class oI extends ri{constructor(e,r){super("missing_refresh_token",`Missing Refresh Token (audience: '${G6(e,["default"])}', scope: '${G6(r)}')`),this.audience=e,this.scope=r,Object.setPrototypeOf(this,oI.prototype)}};function G6(t,e=[]){return t&&!e.includes(t)?t:""}const gg=()=>window.crypto,O2=()=>{const t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let e="";return Array.from(gg().getRandomValues(new Uint8Array(43))).forEach(r=>e+=t[r%t.length]),e},Z6=t=>btoa(t),Tw=t=>{var{clientId:e}=t,r=Js(t,["clientId"]);return new URLSearchParams((n=>Object.keys(n).filter(i=>n[i]!==void 0).reduce((i,s)=>Object.assign(Object.assign({},i),{[s]:n[s]}),{}))(Object.assign({client_id:e},r))).toString()},J6=t=>(e=>decodeURIComponent(atob(e).split("").map(r=>"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)).join("")))(t.replace(/_/g,"/").replace(/-/g,"+")),AG=async(t,e)=>{const r=await fetch(t,e);return{ok:r.ok,json:await r.json()}},SG=async(t,e,r)=>{const n=new AbortController;let i;return e.signal=n.signal,Promise.race([AG(t,e),new Promise((s,a)=>{i=setTimeout(()=>{n.abort(),a(new Error("Timeout when executing 'fetch'"))},r)})]).finally(()=>{clearTimeout(i)})},CG=async(t,e,r,n,i,s,a)=>{return o={auth:{audience:e,scope:r},timeout:i,fetchUrl:t,fetchOptions:n,useFormData:a},c=s,new Promise(function(u,l){const h=new MessageChannel;h.port1.onmessage=function(f){f.data.error?l(new Error(f.data.error)):u(f.data),h.port1.close()},c.postMessage(o,[h.port2])});var o,c},_G=async(t,e,r,n,i,s,a=1e4)=>i?CG(t,e,r,n,a,i,s):SG(t,n,a);async function kG(t,e){var{baseUrl:r,timeout:n,audience:i,scope:s,auth0Client:a,useFormData:o}=t,c=Js(t,["baseUrl","timeout","audience","scope","auth0Client","useFormData"]);const u=o?Tw(c):JSON.stringify(c);return await async function(l,h,f,p,d,g,y){let x,b=null;for(let N=0;N<3;N++)try{x=await _G(l,f,p,d,g,y,h),b=null;break}catch(P){b=P}if(b)throw b;const S=x.json,{error:k,error_description:T}=S,_=Js(S,["error","error_description"]),{ok:B}=x;if(!B){const N=T||`HTTP error. Unable to fetch ${l}`;throw k==="mfa_required"?new EG(k,N,_.mfa_token):k==="missing_refresh_token"?new aI(f,p):new ri(k||"request_error",N)}return _}(`${r}/oauth/token`,n,i||"default",s,{method:"POST",body:u,headers:{"Content-Type":o?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(a||YB))}},e,o)}const C1=(...t)=>{return(e=t.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(e))).join(" ");var e};class na{constructor(e,r="@@auth0spajs@@",n){this.prefix=r,this.suffix=n,this.clientId=e.clientId,this.scope=e.scope,this.audience=e.audience}toKey(){return[this.prefix,this.clientId,this.audience,this.scope,this.suffix].filter(Boolean).join("::")}static fromKey(e){const[r,n,i,s]=e.split("::");return new na({clientId:n,scope:s,audience:i},r)}static fromCacheEntry(e){const{scope:r,audience:n,client_id:i}=e;return new na({scope:r,audience:n,clientId:i})}}let BG=class{set(e,r){localStorage.setItem(e,JSON.stringify(r))}get(e){const r=window.localStorage.getItem(e);if(r)try{return JSON.parse(r)}catch{return}}remove(e){localStorage.removeItem(e)}allKeys(){return Object.keys(window.localStorage).filter(e=>e.startsWith("@@auth0spajs@@"))}};class cI{constructor(){this.enclosedCache=function(){let e={};return{set(r,n){e[r]=n},get(r){const n=e[r];if(n)return n},remove(r){delete e[r]},allKeys:()=>Object.keys(e)}}()}}let IG=class{constructor(e,r,n){this.cache=e,this.keyManifest=r,this.nowProvider=n||eI}async setIdToken(e,r,n){var i;const s=this.getIdTokenCacheKey(e);await this.cache.set(s,{id_token:r,decodedToken:n}),await((i=this.keyManifest)===null||i===void 0?void 0:i.add(s))}async getIdToken(e){const r=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!r&&e.scope&&e.audience){const n=await this.get(e);return!n||!n.id_token||!n.decodedToken?void 0:{id_token:n.id_token,decodedToken:n.decodedToken}}if(r)return{id_token:r.id_token,decodedToken:r.decodedToken}}async get(e,r=0){var n;let i=await this.cache.get(e.toKey());if(!i){const o=await this.getCacheKeys();if(!o)return;const c=this.matchExistingCacheKey(e,o);c&&(i=await this.cache.get(c))}if(!i)return;const s=await this.nowProvider(),a=Math.floor(s/1e3);return i.expiresAt-r!e||i.includes(e)).reduce(async(i,s)=>{await i,await this.cache.remove(s)},Promise.resolve()),await((r=this.keyManifest)===null||r===void 0?void 0:r.clear()))}async wrapCacheEntry(e){const r=await this.nowProvider();return{body:e,expiresAt:Math.floor(r/1e3)+e.expires_in}}async getCacheKeys(){var e;return this.keyManifest?(e=await this.keyManifest.get())===null||e===void 0?void 0:e.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new na({clientId:e},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(e,r){return r.filter(n=>{var i;const s=na.fromKey(n),a=new Set(s.scope&&s.scope.split(" ")),o=((i=e.scope)===null||i===void 0?void 0:i.split(" "))||[],c=s.scope&&o.reduce((u,l)=>u&&a.has(l),!0);return s.prefix==="@@auth0spajs@@"&&s.clientId===e.clientId&&s.audience===e.audience&&c})[0]}},FG=class{constructor(e,r,n){this.storage=e,this.clientId=r,this.cookieDomain=n,this.storageKey=`a0.spajs.txs.${this.clientId}`}create(e){this.storage.save(this.storageKey,e,{daysUntilExpire:1,cookieDomain:this.cookieDomain})}get(){return this.storage.get(this.storageKey)}remove(){this.storage.remove(this.storageKey,{cookieDomain:this.cookieDomain})}};const C0=t=>typeof t=="number",TG=["iss","aud","exp","nbf","iat","jti","azp","nonce","auth_time","at_hash","c_hash","acr","amr","sub_jwk","cnf","sip_from_tag","sip_date","sip_callid","sip_cseq_num","sip_via_branch","orig","dest","mky","events","toe","txn","rph","sid","vot","vtm"],PG=t=>{if(!t.id_token)throw new Error("ID token is required but missing");const e=(s=>{const a=s.split("."),[o,c,u]=a;if(a.length!==3||!o||!c||!u)throw new Error("ID token could not be decoded");const l=JSON.parse(J6(c)),h={__raw:s},f={};return Object.keys(l).forEach(p=>{h[p]=l[p],TG.includes(p)||(f[p]=l[p])}),{encoded:{header:o,payload:c,signature:u},header:JSON.parse(J6(o)),claims:h,user:f}})(t.id_token);if(!e.claims.iss)throw new Error("Issuer (iss) claim must be a string present in the ID token");if(e.claims.iss!==t.iss)throw new Error(`Issuer (iss) claim mismatch in the ID token; expected "${t.iss}", found "${e.claims.iss}"`);if(!e.user.sub)throw new Error("Subject (sub) claim must be a string present in the ID token");if(e.header.alg!=="RS256")throw new Error(`Signature algorithm of "${e.header.alg}" is not supported. Expected the ID token to be signed with "RS256".`);if(!e.claims.aud||typeof e.claims.aud!="string"&&!Array.isArray(e.claims.aud))throw new Error("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(e.claims.aud)){if(!e.claims.aud.includes(t.aud))throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${t.aud}" but was not one of "${e.claims.aud.join(", ")}"`);if(e.claims.aud.length>1){if(!e.claims.azp)throw new Error("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");if(e.claims.azp!==t.aud)throw new Error(`Authorized Party (azp) claim mismatch in the ID token; expected "${t.aud}", found "${e.claims.azp}"`)}}else if(e.claims.aud!==t.aud)throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${t.aud}" but found "${e.claims.aud}"`);if(t.nonce){if(!e.claims.nonce)throw new Error("Nonce (nonce) claim must be a string present in the ID token");if(e.claims.nonce!==t.nonce)throw new Error(`Nonce (nonce) claim mismatch in the ID token; expected "${t.nonce}", found "${e.claims.nonce}"`)}if(t.max_age&&!C0(e.claims.auth_time))throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");if(e.claims.exp==null||!C0(e.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!C0(e.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const r=t.leeway||60,n=new Date(t.now||Date.now()),i=new Date(0);if(i.setUTCSeconds(e.claims.exp+r),n>i)throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${n}) is after expiration time (${i})`);if(e.claims.nbf!=null&&C0(e.claims.nbf)){const s=new Date(0);if(s.setUTCSeconds(e.claims.nbf-r),ns)throw new Error(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (${n}) is after last auth at ${s}`)}if(t.organization){const s=t.organization.trim();if(s.startsWith("org_")){const a=s;if(!e.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(a!==e.claims.org_id)throw new Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${a}", found "${e.claims.org_id}"`)}else{const a=s.toLowerCase();if(!e.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(a!==e.claims.org_name)throw new Error(`Organization Name (org_name) claim mismatch in the ID token; expected "${a}", found "${e.claims.org_name}"`)}}return e};var ru=a8(function(t,e){var r=Wl&&Wl.__assign||function(){return r=Object.assign||function(c){for(var u,l=1,h=arguments.length;l"u")return;const e=sessionStorage.getItem(t);return e!=null?JSON.parse(e):void 0},save(t,e){sessionStorage.setItem(t,JSON.stringify(e))},remove(t){sessionStorage.removeItem(t)}};function RG(t,e,r){var n=e===void 0?null:e,i=function(c,u){var l=atob(c);if(u){for(var h=new Uint8Array(l.length),f=0,p=l.length;f0?await this.cache.set(this.manifestKey,{keys:[...n]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(e){return`@@auth0spajs@@::${e}`}};const jG={memory:()=>new cI().enclosedCache,localstorage:()=>new BG},eA=t=>jG[t],tA=t=>{const{openUrl:e,onRedirect:r}=t,n=Js(t,["openUrl","onRedirect"]);return Object.assign(Object.assign({},n),{openUrl:e===!1||e?e:r})},M2=new vG;let UG=class{constructor(e){let r,n;if(this.userCache=new cI().enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{await M2.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),e),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),e.authorizationParams)}),typeof window<"u"&&(()=>{if(!gg())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(gg().subtle===void 0)throw new Error(` - auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/master/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information. - `)})(),e.cache&&e.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),e.cache)n=e.cache;else{if(r=e.cacheLocation||"memory",!eA(r))throw new Error(`Invalid cache location "${r}"`);n=eA(r)()}this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=e.legacySameSiteCookie===!1?Il:OG,this.orgHintCookieName=`auth0.${this.options.clientId}.organization_hint`,this.isAuthenticatedCookieName=(a=>`auth0.${a}.is.authenticated`)(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;const i=e.useCookiesForTransactions?this.cookieStorage:DG;var s;this.scope=C1("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new FG(i,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||eI,this.cacheManager=new IG(n,n.allKeys?void 0:new LG(n,this.options.clientId),this.nowProvider),this.domainUrl=(s=this.options.domain,/^https?:\/\//.test(s)?s:`https://${s}`),this.tokenIssuer=((a,o)=>a?a.startsWith("https://")?a:`https://${a}/`:`${o}/`)(this.options.issuer,this.domainUrl),typeof window<"u"&&window.Worker&&this.options.useRefreshTokens&&r==="memory"&&(this.worker=new MG)}_url(e){const r=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||YB)));return`${this.domainUrl}${e}&auth0Client=${r}`}_authorizeUrl(e){return this._url(`/authorize?${Tw(e)}`)}async _verifyIdToken(e,r,n){const i=await this.nowProvider();return PG({iss:this.tokenIssuer,aud:this.options.clientId,id_token:e,nonce:r,organization:n,leeway:this.options.leeway,max_age:(s=this.options.authorizationParams.max_age,typeof s!="string"?s:parseInt(s,10)||void 0),now:i});var s}_processOrgHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}async _prepareAuthorizeUrl(e,r,n){const i=Z6(O2()),s=Z6(O2()),a=O2(),o=(l=>{const h=new Uint8Array(l);return(f=>{const p={"+":"-","/":"_","=":""};return f.replace(/[+/=]/g,d=>p[d])})(window.btoa(String.fromCharCode(...Array.from(h))))})(await(async l=>await gg().subtle.digest({name:"SHA-256"},new TextEncoder().encode(l)))(a)),c=((l,h,f,p,d,g,y,x)=>Object.assign(Object.assign(Object.assign({client_id:l.clientId},l.authorizationParams),f),{scope:C1(h,f.scope),response_type:"code",response_mode:x||"query",state:p,nonce:d,redirect_uri:y||l.authorizationParams.redirect_uri,code_challenge:g,code_challenge_method:"S256"}))(this.options,this.scope,e,i,s,o,e.redirect_uri||this.options.authorizationParams.redirect_uri||n,r==null?void 0:r.response_mode),u=this._authorizeUrl(c);return{nonce:s,code_verifier:a,scope:c.scope,audience:c.audience||"default",redirect_uri:c.redirect_uri,state:i,url:u}}async loginWithPopup(e,r){var n;if(e=e||{},!(r=r||{}).popup&&(r.popup=(o=>{const c=window.screenX+(window.innerWidth-400)/2,u=window.screenY+(window.innerHeight-600)/2;return window.open(o,"auth0:authorize:popup",`left=${c},top=${u},width=400,height=600,resizable,scrollbars=yes,status=1`)})(""),!r.popup))throw new Error("Unable to open a popup for loginWithPopup - window.open returned `null`");const i=await this._prepareAuthorizeUrl(e.authorizationParams||{},{response_mode:"web_message"},window.location.origin);r.popup.location.href=i.url;const s=await(o=>new Promise((c,u)=>{let l;const h=setInterval(()=>{o.popup&&o.popup.closed&&(clearInterval(h),clearTimeout(f),window.removeEventListener("message",l,!1),u(new wG(o.popup)))},1e3),f=setTimeout(()=>{clearInterval(h),u(new bG(o.popup)),window.removeEventListener("message",l,!1)},1e3*(o.timeoutInSeconds||60));l=function(p){if(p.data&&p.data.type==="authorization_response"){if(clearTimeout(f),clearInterval(h),window.removeEventListener("message",l,!1),o.popup.close(),p.data.response.error)return u(ri.fromPayload(p.data.response));c(p.data.response)}},window.addEventListener("message",l)}))(Object.assign(Object.assign({},r),{timeoutInSeconds:r.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(i.state!==s.state)throw new ri("state_mismatch","Invalid state");const a=((n=e.authorizationParams)===null||n===void 0?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:i.audience,scope:i.scope,code_verifier:i.code_verifier,grant_type:"authorization_code",code:s.code,redirect_uri:i.redirect_uri},{nonceIn:i.nonce,organization:a})}async getUser(){var e;const r=await this._getIdTokenFromCache();return(e=r==null?void 0:r.decodedToken)===null||e===void 0?void 0:e.user}async getIdTokenClaims(){var e;const r=await this._getIdTokenFromCache();return(e=r==null?void 0:r.decodedToken)===null||e===void 0?void 0:e.claims}async loginWithRedirect(e={}){var r;const n=tA(e),{openUrl:i,fragment:s,appState:a}=n,o=Js(n,["openUrl","fragment","appState"]),c=((r=o.authorizationParams)===null||r===void 0?void 0:r.organization)||this.options.authorizationParams.organization,u=await this._prepareAuthorizeUrl(o.authorizationParams||{}),{url:l}=u,h=Js(u,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},h),{appState:a}),c&&{organization:c}));const f=s?`${l}#${s}`:l;i?await i(f):window.location.assign(f)}async handleRedirectCallback(e=window.location.href){const r=e.split("?").slice(1);if(r.length===0)throw new Error("There are no query params available for parsing.");const{state:n,code:i,error:s,error_description:a}=(h=>{h.indexOf("#")>-1&&(h=h.substring(0,h.indexOf("#")));const f=new URLSearchParams(h);return{state:f.get("state"),code:f.get("code")||void 0,error:f.get("error")||void 0,error_description:f.get("error_description")||void 0}})(r.join("")),o=this.transactionManager.get();if(!o)throw new ri("missing_transaction","Invalid state");if(this.transactionManager.remove(),s)throw new xG(s,a||s,n,o.appState);if(!o.code_verifier||o.state&&o.state!==n)throw new ri("state_mismatch","Invalid state");const c=o.organization,u=o.nonce,l=o.redirect_uri;return await this._requestToken(Object.assign({audience:o.audience,scope:o.scope,code_verifier:o.code_verifier,grant_type:"authorization_code",code:i},l?{redirect_uri:l}:{}),{nonceIn:u,organization:c}),{appState:o.appState}}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(e)}catch{}}async getTokenSilently(e={}){var r;const n=Object.assign(Object.assign({cacheMode:"on"},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:C1(this.scope,(r=e.authorizationParams)===null||r===void 0?void 0:r.scope)})}),i=await((s,a)=>{let o=R2[a];return o||(o=s().finally(()=>{delete R2[a],o=null}),R2[a]=o),o})(()=>this._getTokenSilently(n),`${this.options.clientId}::${n.authorizationParams.audience}::${n.authorizationParams.scope}`);return e.detailedResponse?i:i==null?void 0:i.access_token}async _getTokenSilently(e){const{cacheMode:r}=e,n=Js(e,["cacheMode"]);if(r!=="off"){const i=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(i)return i}if(r!=="cache-only"){if(!await(async(i,s=3)=>{for(let a=0;aM2.acquireLock("auth0.lock.getTokenSilently",5e3),10))throw new Fw;try{if(window.addEventListener("pagehide",this._releaseLockOnPageHide),r!=="off"){const u=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(u)return u}const i=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),{id_token:s,access_token:a,oauthTokenScope:o,expires_in:c}=i;return Object.assign(Object.assign({id_token:s,access_token:a},o?{scope:o}:null),{expires_in:c})}finally{await M2.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}}async getTokenWithPopup(e={},r={}){var n;const i=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:C1(this.scope,(n=e.authorizationParams)===null||n===void 0?void 0:n.scope)})});return r=Object.assign(Object.assign({},yG),r),await this.loginWithPopup(i,r),(await this.cacheManager.get(new na({scope:i.authorizationParams.scope,audience:i.authorizationParams.audience||"default",clientId:this.options.clientId}))).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(e){e.clientId!==null?e.clientId=e.clientId||this.options.clientId:delete e.clientId;const r=e.logoutParams||{},{federated:n}=r,i=Js(r,["federated"]),s=n?"&federated":"";return this._url(`/v2/logout?${Tw(Object.assign({clientId:e.clientId},i))}`)+s}async logout(e={}){const r=tA(e),{openUrl:n}=r,i=Js(r,["openUrl"]);e.clientId===null?await this.cacheManager.clear():await this.cacheManager.clear(e.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove("@@user@@");const s=this._buildLogoutUrl(i);n?await n(s):n!==!1&&window.location.assign(s)}async _getTokenFromIFrame(e){const r=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!r.organization&&(r.organization=n);const{url:i,state:s,nonce:a,code_verifier:o,redirect_uri:c,scope:u,audience:l}=await this._prepareAuthorizeUrl(r,{response_mode:"web_message"},window.location.origin);try{if(window.crossOriginIsolated)throw new ri("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const h=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds,f=await((d,g,y=60)=>new Promise((x,b)=>{const S=window.document.createElement("iframe");S.setAttribute("width","0"),S.setAttribute("height","0"),S.style.display="none";const k=()=>{window.document.body.contains(S)&&(window.document.body.removeChild(S),window.removeEventListener("message",T,!1))};let T;const _=setTimeout(()=>{b(new Fw),k()},1e3*y);T=function(B){if(B.origin!=g||!B.data||B.data.type!=="authorization_response")return;const N=B.source;N&&N.close(),B.data.response.error?b(ri.fromPayload(B.data.response)):x(B.data.response),clearTimeout(_),window.removeEventListener("message",T,!1),setTimeout(k,2e3)},window.addEventListener("message",T,!1),window.document.body.appendChild(S),S.setAttribute("src",d)}))(i,this.domainUrl,h);if(s!==f.state)throw new ri("state_mismatch","Invalid state");const p=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:o,code:f.code,grant_type:"authorization_code",redirect_uri:c,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:a,organization:r.organization});return Object.assign(Object.assign({},p),{scope:u,oauthTokenScope:p.scope,audience:l})}catch(h){throw h.error==="login_required"&&this.logout({openUrl:!1}),h}}async _getTokenUsingRefreshToken(e){const r=await this.cacheManager.get(new na({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||"default",clientId:this.options.clientId}));if(!(r&&r.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new aI(e.authorizationParams.audience||"default",e.authorizationParams.scope)}const n=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,i=typeof e.timeoutInSeconds=="number"?1e3*e.timeoutInSeconds:null;try{const s=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:r&&r.refresh_token,redirect_uri:n}),i&&{timeout:i}));return Object.assign(Object.assign({},s),{scope:e.authorizationParams.scope,oauthTokenScope:s.scope,audience:e.authorizationParams.audience||"default"})}catch(s){if((s.message.indexOf("Missing Refresh Token")>-1||s.message&&s.message.indexOf("invalid refresh token")>-1)&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw s}}async _saveEntryInCache(e){const{id_token:r,decodedToken:n}=e,i=Js(e,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:r,decodedToken:n}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(i)}async _getIdTokenFromCache(){const e=this.options.authorizationParams.audience||"default",r=await this.cacheManager.getIdToken(new na({clientId:this.options.clientId,audience:e,scope:this.scope})),n=this.userCache.get("@@user@@");return r&&r.id_token===(n==null?void 0:n.id_token)?n:(this.userCache.set("@@user@@",r),r)}async _getEntryFromCache({scope:e,audience:r,clientId:n}){const i=await this.cacheManager.get(new na({scope:e,audience:r,clientId:n}),60);if(i&&i.access_token){const{access_token:s,oauthTokenScope:a,expires_in:o}=i,c=await this._getIdTokenFromCache();return c&&Object.assign(Object.assign({id_token:c.id_token,access_token:s},a?{scope:a}:null),{expires_in:o})}}async _requestToken(e,r){const{nonceIn:n,organization:i}=r||{},s=await kG(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs},e),this.worker),a=await this._verifyIdToken(s.id_token,n,i);return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},s),{decodedToken:a,scope:e.scope,audience:e.audience||"default"}),s.scope?{oauthTokenScope:s.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(i||a.claims.org_id),Object.assign(Object.assign({},s),{decodedToken:a})}};async function $G(t){const e=new UG(t);return await e.checkSession(),e}function Pw(t){this.message=t}Pw.prototype=new Error,Pw.prototype.name="InvalidCharacterError";var rA=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new Pw("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,s=0,a="";n=e.charAt(s++);~n&&(r=i%4?64*r+n:n,i++%4)?a+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return a};function HG(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(r){return decodeURIComponent(rA(r).replace(/(.)/g,function(n,i){var s=i.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}(e)}catch{return rA(e)}}function Am(t){this.message=t}function Fo(t,e){if(typeof t!="string")throw new Am("Invalid token specified");var r=(e=e||{}).header===!0?0:1;try{return JSON.parse(HG(t.split(".")[r]))}catch(n){throw new Am("Invalid token specified: "+n.message)}}Am.prototype=new Error,Am.prototype.name="InvalidTokenError";var Lc={},o8={exports:{}};const zG={},VG=Object.freeze(Object.defineProperty({__proto__:null,default:zG},Symbol.toStringTag,{value:"Module"})),c8=VP(VG);o8.exports;(function(t){(function(e,r){function n(O,E){if(!O)throw new Error(E||"Assertion failed")}function i(O,E){O.super_=E;var F=function(){};F.prototype=E.prototype,O.prototype=new F,O.prototype.constructor=O}function s(O,E,F){if(s.isBN(O))return O;this.negative=0,this.words=null,this.length=0,this.red=null,O!==null&&((E==="le"||E==="be")&&(F=E,E=10),this._init(O||0,E||10,F||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=c8.Buffer}catch{}s.isBN=function(E){return E instanceof s?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===s.wordSize&&Array.isArray(E.words)},s.max=function(E,F){return E.cmp(F)>0?E:F},s.min=function(E,F){return E.cmp(F)<0?E:F},s.prototype._init=function(E,F,A){if(typeof E=="number")return this._initNumber(E,F,A);if(typeof E=="object")return this._initArray(E,F,A);F==="hex"&&(F=16),n(F===(F|0)&&F>=2&&F<=36),E=E.toString().replace(/\s+/g,"");var I=0;E[0]==="-"&&(I++,this.negative=1),I=0;I-=3)H=E[I]|E[I-1]<<8|E[I-2]<<16,this.words[j]|=H<>>26-G&67108863,G+=24,G>=26&&(G-=26,j++);else if(A==="le")for(I=0,j=0;I>>26-G&67108863,G+=24,G>=26&&(G-=26,j++);return this.strip()};function o(O,E){var F=O.charCodeAt(E);return F>=65&&F<=70?F-55:F>=97&&F<=102?F-87:F-48&15}function c(O,E,F){var A=o(O,F);return F-1>=E&&(A|=o(O,F-1)<<4),A}s.prototype._parseHex=function(E,F,A){this.length=Math.ceil((E.length-F)/6),this.words=new Array(this.length);for(var I=0;I=F;I-=2)G=c(E,F,I)<=18?(j-=18,H+=1,this.words[H]|=G>>>26):j+=8;else{var z=E.length-F;for(I=z%2===0?F+1:F;I=18?(j-=18,H+=1,this.words[H]|=G>>>26):j+=8}this.strip()};function u(O,E,F,A){for(var I=0,j=Math.min(O.length,F),H=E;H=49?I+=G-49+10:G>=17?I+=G-17+10:I+=G}return I}s.prototype._parseBase=function(E,F,A){this.words=[0],this.length=1;for(var I=0,j=1;j<=67108863;j*=F)I++;I--,j=j/F|0;for(var H=E.length-A,G=H%I,z=Math.min(H,H-G)+A,R=0,L=A;L1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var l=["","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"],h=[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],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(E,F){E=E||10,F=F|0||1;var A;if(E===16||E==="hex"){A="";for(var I=0,j=0,H=0;H>>24-I&16777215,j!==0||H!==this.length-1?A=l[6-z.length]+z+A:A=z+A,I+=2,I>=26&&(I-=26,H--)}for(j!==0&&(A=j.toString(16)+A);A.length%F!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}if(E===(E|0)&&E>=2&&E<=36){var R=h[E],L=f[E];A="";var q=this.clone();for(q.negative=0;!q.isZero();){var ee=q.modn(L).toString(E);q=q.idivn(L),q.isZero()?A=ee+A:A=l[R-ee.length]+ee+A}for(this.isZero()&&(A="0"+A);A.length%F!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(E,F){return n(typeof a<"u"),this.toArrayLike(a,E,F)},s.prototype.toArray=function(E,F){return this.toArrayLike(Array,E,F)},s.prototype.toArrayLike=function(E,F,A){var I=this.byteLength(),j=A||Math.max(1,I);n(I<=j,"byte array longer than desired length"),n(j>0,"Requested array length <= 0"),this.strip();var H=F==="le",G=new E(j),z,R,L=this.clone();if(H){for(R=0;!L.isZero();R++)z=L.andln(255),L.iushrn(8),G[R]=z;for(;R=4096&&(A+=13,F>>>=13),F>=64&&(A+=7,F>>>=7),F>=8&&(A+=4,F>>>=4),F>=2&&(A+=2,F>>>=2),A+F},s.prototype._zeroBits=function(E){if(E===0)return 26;var F=E,A=0;return F&8191||(A+=13,F>>>=13),F&127||(A+=7,F>>>=7),F&15||(A+=4,F>>>=4),F&3||(A+=2,F>>>=2),F&1||A++,A},s.prototype.bitLength=function(){var E=this.words[this.length-1],F=this._countBits(E);return(this.length-1)*26+F};function p(O){for(var E=new Array(O.bitLength()),F=0;F>>I}return E}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,F=0;FE.length?this.clone().ior(E):E.clone().ior(this)},s.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},s.prototype.iuand=function(E){var F;this.length>E.length?F=E:F=this;for(var A=0;AE.length?this.clone().iand(E):E.clone().iand(this)},s.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},s.prototype.iuxor=function(E){var F,A;this.length>E.length?(F=this,A=E):(F=E,A=this);for(var I=0;IE.length?this.clone().ixor(E):E.clone().ixor(this)},s.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},s.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var F=Math.ceil(E/26)|0,A=E%26;this._expand(F),A>0&&F--;for(var I=0;I0&&(this.words[I]=~this.words[I]&67108863>>26-A),this.strip()},s.prototype.notn=function(E){return this.clone().inotn(E)},s.prototype.setn=function(E,F){n(typeof E=="number"&&E>=0);var A=E/26|0,I=E%26;return this._expand(A+1),F?this.words[A]=this.words[A]|1<E.length?(A=this,I=E):(A=E,I=this);for(var j=0,H=0;H>>26;for(;j!==0&&H>>26;if(this.length=A.length,j!==0)this.words[this.length]=j,this.length++;else if(A!==this)for(;HE.length?this.clone().iadd(E):E.clone().iadd(this)},s.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var F=this.iadd(E);return E.negative=1,F._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var A=this.cmp(E);if(A===0)return this.negative=0,this.length=1,this.words[0]=0,this;var I,j;A>0?(I=this,j=E):(I=E,j=this);for(var H=0,G=0;G>26,this.words[G]=F&67108863;for(;H!==0&&G>26,this.words[G]=F&67108863;if(H===0&&G>>26,q=z&67108863,ee=Math.min(R,E.length-1),X=Math.max(0,R-O.length+1);X<=ee;X++){var oe=R-X|0;I=O.words[oe]|0,j=E.words[X]|0,H=I*j+q,L+=H/67108864|0,q=H&67108863}F.words[R]=q|0,z=L|0}return z!==0?F.words[R]=z|0:F.length--,F.strip()}var g=function(E,F,A){var I=E.words,j=F.words,H=A.words,G=0,z,R,L,q=I[0]|0,ee=q&8191,X=q>>>13,oe=I[1]|0,me=oe&8191,le=oe>>>13,fe=I[2]|0,ve=fe&8191,Ae=fe>>>13,Me=I[3]|0,Be=Me&8191,Pe=Me>>>13,V=I[4]|0,ue=V&8191,se=V>>>13,Y=I[5]|0,J=Y&8191,ne=Y>>>13,ge=I[6]|0,de=ge&8191,re=ge>>>13,Ce=I[7]|0,xe=Ce&8191,pe=Ce>>>13,Fe=I[8]|0,m=Fe&8191,v=Fe>>>13,w=I[9]|0,M=w&8191,$=w>>>13,W=j[0]|0,Z=W&8191,Ee=W>>>13,Ue=j[1]|0,ke=Ue&8191,Ie=Ue>>>13,Le=j[2]|0,Ht=Le&8191,Ot=Le>>>13,qc=j[3]|0,At=qc&8191,Bt=qc>>>13,Xp=j[4]|0,rr=Xp&8191,qt=Xp>>>13,Qp=j[5]|0,nr=Qp&8191,Kt=Qp>>>13,Yp=j[6]|0,Wt=Yp&8191,dt=Yp>>>13,Xi=j[7]|0,Gt=Xi&8191,ir=Xi>>>13,y5=j[8]|0,fr=y5&8191,hr=y5>>>13,x5=j[9]|0,dr=x5&8191,pr=x5>>>13;A.negative=E.negative^F.negative,A.length=19,z=Math.imul(ee,Z),R=Math.imul(ee,Ee),R=R+Math.imul(X,Z)|0,L=Math.imul(X,Ee);var by=(G+z|0)+((R&8191)<<13)|0;G=(L+(R>>>13)|0)+(by>>>26)|0,by&=67108863,z=Math.imul(me,Z),R=Math.imul(me,Ee),R=R+Math.imul(le,Z)|0,L=Math.imul(le,Ee),z=z+Math.imul(ee,ke)|0,R=R+Math.imul(ee,Ie)|0,R=R+Math.imul(X,ke)|0,L=L+Math.imul(X,Ie)|0;var wy=(G+z|0)+((R&8191)<<13)|0;G=(L+(R>>>13)|0)+(wy>>>26)|0,wy&=67108863,z=Math.imul(ve,Z),R=Math.imul(ve,Ee),R=R+Math.imul(Ae,Z)|0,L=Math.imul(Ae,Ee),z=z+Math.imul(me,ke)|0,R=R+Math.imul(me,Ie)|0,R=R+Math.imul(le,ke)|0,L=L+Math.imul(le,Ie)|0,z=z+Math.imul(ee,Ht)|0,R=R+Math.imul(ee,Ot)|0,R=R+Math.imul(X,Ht)|0,L=L+Math.imul(X,Ot)|0;var Ey=(G+z|0)+((R&8191)<<13)|0;G=(L+(R>>>13)|0)+(Ey>>>26)|0,Ey&=67108863,z=Math.imul(Be,Z),R=Math.imul(Be,Ee),R=R+Math.imul(Pe,Z)|0,L=Math.imul(Pe,Ee),z=z+Math.imul(ve,ke)|0,R=R+Math.imul(ve,Ie)|0,R=R+Math.imul(Ae,ke)|0,L=L+Math.imul(Ae,Ie)|0,z=z+Math.imul(me,Ht)|0,R=R+Math.imul(me,Ot)|0,R=R+Math.imul(le,Ht)|0,L=L+Math.imul(le,Ot)|0,z=z+Math.imul(ee,At)|0,R=R+Math.imul(ee,Bt)|0,R=R+Math.imul(X,At)|0,L=L+Math.imul(X,Bt)|0;var Ay=(G+z|0)+((R&8191)<<13)|0;G=(L+(R>>>13)|0)+(Ay>>>26)|0,Ay&=67108863,z=Math.imul(ue,Z),R=Math.imul(ue,Ee),R=R+Math.imul(se,Z)|0,L=Math.imul(se,Ee),z=z+Math.imul(Be,ke)|0,R=R+Math.imul(Be,Ie)|0,R=R+Math.imul(Pe,ke)|0,L=L+Math.imul(Pe,Ie)|0,z=z+Math.imul(ve,Ht)|0,R=R+Math.imul(ve,Ot)|0,R=R+Math.imul(Ae,Ht)|0,L=L+Math.imul(Ae,Ot)|0,z=z+Math.imul(me,At)|0,R=R+Math.imul(me,Bt)|0,R=R+Math.imul(le,At)|0,L=L+Math.imul(le,Bt)|0,z=z+Math.imul(ee,rr)|0,R=R+Math.imul(ee,qt)|0,R=R+Math.imul(X,rr)|0,L=L+Math.imul(X,qt)|0;var Sy=(G+z|0)+((R&8191)<<13)|0;G=(L+(R>>>13)|0)+(Sy>>>26)|0,Sy&=67108863,z=Math.imul(J,Z),R=Math.imul(J,Ee),R=R+Math.imul(ne,Z)|0,L=Math.imul(ne,Ee),z=z+Math.imul(ue,ke)|0,R=R+Math.imul(ue,Ie)|0,R=R+Math.imul(se,ke)|0,L=L+Math.imul(se,Ie)|0,z=z+Math.imul(Be,Ht)|0,R=R+Math.imul(Be,Ot)|0,R=R+Math.imul(Pe,Ht)|0,L=L+Math.imul(Pe,Ot)|0,z=z+Math.imul(ve,At)|0,R=R+Math.imul(ve,Bt)|0,R=R+Math.imul(Ae,At)|0,L=L+Math.imul(Ae,Bt)|0,z=z+Math.imul(me,rr)|0,R=R+Math.imul(me,qt)|0,R=R+Math.imul(le,rr)|0,L=L+Math.imul(le,qt)|0,z=z+Math.imul(ee,nr)|0,R=R+Math.imul(ee,Kt)|0,R=R+Math.imul(X,nr)|0,L=L+Math.imul(X,Kt)|0;var Cy=(G+z|0)+((R&8191)<<13)|0;G=(L+(R>>>13)|0)+(Cy>>>26)|0,Cy&=67108863,z=Math.imul(de,Z),R=Math.imul(de,Ee),R=R+Math.imul(re,Z)|0,L=Math.imul(re,Ee),z=z+Math.imul(J,ke)|0,R=R+Math.imul(J,Ie)|0,R=R+Math.imul(ne,ke)|0,L=L+Math.imul(ne,Ie)|0,z=z+Math.imul(ue,Ht)|0,R=R+Math.imul(ue,Ot)|0,R=R+Math.imul(se,Ht)|0,L=L+Math.imul(se,Ot)|0,z=z+Math.imul(Be,At)|0,R=R+Math.imul(Be,Bt)|0,R=R+Math.imul(Pe,At)|0,L=L+Math.imul(Pe,Bt)|0,z=z+Math.imul(ve,rr)|0,R=R+Math.imul(ve,qt)|0,R=R+Math.imul(Ae,rr)|0,L=L+Math.imul(Ae,qt)|0,z=z+Math.imul(me,nr)|0,R=R+Math.imul(me,Kt)|0,R=R+Math.imul(le,nr)|0,L=L+Math.imul(le,Kt)|0,z=z+Math.imul(ee,Wt)|0,R=R+Math.imul(ee,dt)|0,R=R+Math.imul(X,Wt)|0,L=L+Math.imul(X,dt)|0;var _y=(G+z|0)+((R&8191)<<13)|0;G=(L+(R>>>13)|0)+(_y>>>26)|0,_y&=67108863,z=Math.imul(xe,Z),R=Math.imul(xe,Ee),R=R+Math.imul(pe,Z)|0,L=Math.imul(pe,Ee),z=z+Math.imul(de,ke)|0,R=R+Math.imul(de,Ie)|0,R=R+Math.imul(re,ke)|0,L=L+Math.imul(re,Ie)|0,z=z+Math.imul(J,Ht)|0,R=R+Math.imul(J,Ot)|0,R=R+Math.imul(ne,Ht)|0,L=L+Math.imul(ne,Ot)|0,z=z+Math.imul(ue,At)|0,R=R+Math.imul(ue,Bt)|0,R=R+Math.imul(se,At)|0,L=L+Math.imul(se,Bt)|0,z=z+Math.imul(Be,rr)|0,R=R+Math.imul(Be,qt)|0,R=R+Math.imul(Pe,rr)|0,L=L+Math.imul(Pe,qt)|0,z=z+Math.imul(ve,nr)|0,R=R+Math.imul(ve,Kt)|0,R=R+Math.imul(Ae,nr)|0,L=L+Math.imul(Ae,Kt)|0,z=z+Math.imul(me,Wt)|0,R=R+Math.imul(me,dt)|0,R=R+Math.imul(le,Wt)|0,L=L+Math.imul(le,dt)|0,z=z+Math.imul(ee,Gt)|0,R=R+Math.imul(ee,ir)|0,R=R+Math.imul(X,Gt)|0,L=L+Math.imul(X,ir)|0;var ky=(G+z|0)+((R&8191)<<13)|0;G=(L+(R>>>13)|0)+(ky>>>26)|0,ky&=67108863,z=Math.imul(m,Z),R=Math.imul(m,Ee),R=R+Math.imul(v,Z)|0,L=Math.imul(v,Ee),z=z+Math.imul(xe,ke)|0,R=R+Math.imul(xe,Ie)|0,R=R+Math.imul(pe,ke)|0,L=L+Math.imul(pe,Ie)|0,z=z+Math.imul(de,Ht)|0,R=R+Math.imul(de,Ot)|0,R=R+Math.imul(re,Ht)|0,L=L+Math.imul(re,Ot)|0,z=z+Math.imul(J,At)|0,R=R+Math.imul(J,Bt)|0,R=R+Math.imul(ne,At)|0,L=L+Math.imul(ne,Bt)|0,z=z+Math.imul(ue,rr)|0,R=R+Math.imul(ue,qt)|0,R=R+Math.imul(se,rr)|0,L=L+Math.imul(se,qt)|0,z=z+Math.imul(Be,nr)|0,R=R+Math.imul(Be,Kt)|0,R=R+Math.imul(Pe,nr)|0,L=L+Math.imul(Pe,Kt)|0,z=z+Math.imul(ve,Wt)|0,R=R+Math.imul(ve,dt)|0,R=R+Math.imul(Ae,Wt)|0,L=L+Math.imul(Ae,dt)|0,z=z+Math.imul(me,Gt)|0,R=R+Math.imul(me,ir)|0,R=R+Math.imul(le,Gt)|0,L=L+Math.imul(le,ir)|0,z=z+Math.imul(ee,fr)|0,R=R+Math.imul(ee,hr)|0,R=R+Math.imul(X,fr)|0,L=L+Math.imul(X,hr)|0;var By=(G+z|0)+((R&8191)<<13)|0;G=(L+(R>>>13)|0)+(By>>>26)|0,By&=67108863,z=Math.imul(M,Z),R=Math.imul(M,Ee),R=R+Math.imul($,Z)|0,L=Math.imul($,Ee),z=z+Math.imul(m,ke)|0,R=R+Math.imul(m,Ie)|0,R=R+Math.imul(v,ke)|0,L=L+Math.imul(v,Ie)|0,z=z+Math.imul(xe,Ht)|0,R=R+Math.imul(xe,Ot)|0,R=R+Math.imul(pe,Ht)|0,L=L+Math.imul(pe,Ot)|0,z=z+Math.imul(de,At)|0,R=R+Math.imul(de,Bt)|0,R=R+Math.imul(re,At)|0,L=L+Math.imul(re,Bt)|0,z=z+Math.imul(J,rr)|0,R=R+Math.imul(J,qt)|0,R=R+Math.imul(ne,rr)|0,L=L+Math.imul(ne,qt)|0,z=z+Math.imul(ue,nr)|0,R=R+Math.imul(ue,Kt)|0,R=R+Math.imul(se,nr)|0,L=L+Math.imul(se,Kt)|0,z=z+Math.imul(Be,Wt)|0,R=R+Math.imul(Be,dt)|0,R=R+Math.imul(Pe,Wt)|0,L=L+Math.imul(Pe,dt)|0,z=z+Math.imul(ve,Gt)|0,R=R+Math.imul(ve,ir)|0,R=R+Math.imul(Ae,Gt)|0,L=L+Math.imul(Ae,ir)|0,z=z+Math.imul(me,fr)|0,R=R+Math.imul(me,hr)|0,R=R+Math.imul(le,fr)|0,L=L+Math.imul(le,hr)|0,z=z+Math.imul(ee,dr)|0,R=R+Math.imul(ee,pr)|0,R=R+Math.imul(X,dr)|0,L=L+Math.imul(X,pr)|0;var Iy=(G+z|0)+((R&8191)<<13)|0;G=(L+(R>>>13)|0)+(Iy>>>26)|0,Iy&=67108863,z=Math.imul(M,ke),R=Math.imul(M,Ie),R=R+Math.imul($,ke)|0,L=Math.imul($,Ie),z=z+Math.imul(m,Ht)|0,R=R+Math.imul(m,Ot)|0,R=R+Math.imul(v,Ht)|0,L=L+Math.imul(v,Ot)|0,z=z+Math.imul(xe,At)|0,R=R+Math.imul(xe,Bt)|0,R=R+Math.imul(pe,At)|0,L=L+Math.imul(pe,Bt)|0,z=z+Math.imul(de,rr)|0,R=R+Math.imul(de,qt)|0,R=R+Math.imul(re,rr)|0,L=L+Math.imul(re,qt)|0,z=z+Math.imul(J,nr)|0,R=R+Math.imul(J,Kt)|0,R=R+Math.imul(ne,nr)|0,L=L+Math.imul(ne,Kt)|0,z=z+Math.imul(ue,Wt)|0,R=R+Math.imul(ue,dt)|0,R=R+Math.imul(se,Wt)|0,L=L+Math.imul(se,dt)|0,z=z+Math.imul(Be,Gt)|0,R=R+Math.imul(Be,ir)|0,R=R+Math.imul(Pe,Gt)|0,L=L+Math.imul(Pe,ir)|0,z=z+Math.imul(ve,fr)|0,R=R+Math.imul(ve,hr)|0,R=R+Math.imul(Ae,fr)|0,L=L+Math.imul(Ae,hr)|0,z=z+Math.imul(me,dr)|0,R=R+Math.imul(me,pr)|0,R=R+Math.imul(le,dr)|0,L=L+Math.imul(le,pr)|0;var Fy=(G+z|0)+((R&8191)<<13)|0;G=(L+(R>>>13)|0)+(Fy>>>26)|0,Fy&=67108863,z=Math.imul(M,Ht),R=Math.imul(M,Ot),R=R+Math.imul($,Ht)|0,L=Math.imul($,Ot),z=z+Math.imul(m,At)|0,R=R+Math.imul(m,Bt)|0,R=R+Math.imul(v,At)|0,L=L+Math.imul(v,Bt)|0,z=z+Math.imul(xe,rr)|0,R=R+Math.imul(xe,qt)|0,R=R+Math.imul(pe,rr)|0,L=L+Math.imul(pe,qt)|0,z=z+Math.imul(de,nr)|0,R=R+Math.imul(de,Kt)|0,R=R+Math.imul(re,nr)|0,L=L+Math.imul(re,Kt)|0,z=z+Math.imul(J,Wt)|0,R=R+Math.imul(J,dt)|0,R=R+Math.imul(ne,Wt)|0,L=L+Math.imul(ne,dt)|0,z=z+Math.imul(ue,Gt)|0,R=R+Math.imul(ue,ir)|0,R=R+Math.imul(se,Gt)|0,L=L+Math.imul(se,ir)|0,z=z+Math.imul(Be,fr)|0,R=R+Math.imul(Be,hr)|0,R=R+Math.imul(Pe,fr)|0,L=L+Math.imul(Pe,hr)|0,z=z+Math.imul(ve,dr)|0,R=R+Math.imul(ve,pr)|0,R=R+Math.imul(Ae,dr)|0,L=L+Math.imul(Ae,pr)|0;var Ty=(G+z|0)+((R&8191)<<13)|0;G=(L+(R>>>13)|0)+(Ty>>>26)|0,Ty&=67108863,z=Math.imul(M,At),R=Math.imul(M,Bt),R=R+Math.imul($,At)|0,L=Math.imul($,Bt),z=z+Math.imul(m,rr)|0,R=R+Math.imul(m,qt)|0,R=R+Math.imul(v,rr)|0,L=L+Math.imul(v,qt)|0,z=z+Math.imul(xe,nr)|0,R=R+Math.imul(xe,Kt)|0,R=R+Math.imul(pe,nr)|0,L=L+Math.imul(pe,Kt)|0,z=z+Math.imul(de,Wt)|0,R=R+Math.imul(de,dt)|0,R=R+Math.imul(re,Wt)|0,L=L+Math.imul(re,dt)|0,z=z+Math.imul(J,Gt)|0,R=R+Math.imul(J,ir)|0,R=R+Math.imul(ne,Gt)|0,L=L+Math.imul(ne,ir)|0,z=z+Math.imul(ue,fr)|0,R=R+Math.imul(ue,hr)|0,R=R+Math.imul(se,fr)|0,L=L+Math.imul(se,hr)|0,z=z+Math.imul(Be,dr)|0,R=R+Math.imul(Be,pr)|0,R=R+Math.imul(Pe,dr)|0,L=L+Math.imul(Pe,pr)|0;var Py=(G+z|0)+((R&8191)<<13)|0;G=(L+(R>>>13)|0)+(Py>>>26)|0,Py&=67108863,z=Math.imul(M,rr),R=Math.imul(M,qt),R=R+Math.imul($,rr)|0,L=Math.imul($,qt),z=z+Math.imul(m,nr)|0,R=R+Math.imul(m,Kt)|0,R=R+Math.imul(v,nr)|0,L=L+Math.imul(v,Kt)|0,z=z+Math.imul(xe,Wt)|0,R=R+Math.imul(xe,dt)|0,R=R+Math.imul(pe,Wt)|0,L=L+Math.imul(pe,dt)|0,z=z+Math.imul(de,Gt)|0,R=R+Math.imul(de,ir)|0,R=R+Math.imul(re,Gt)|0,L=L+Math.imul(re,ir)|0,z=z+Math.imul(J,fr)|0,R=R+Math.imul(J,hr)|0,R=R+Math.imul(ne,fr)|0,L=L+Math.imul(ne,hr)|0,z=z+Math.imul(ue,dr)|0,R=R+Math.imul(ue,pr)|0,R=R+Math.imul(se,dr)|0,L=L+Math.imul(se,pr)|0;var Ny=(G+z|0)+((R&8191)<<13)|0;G=(L+(R>>>13)|0)+(Ny>>>26)|0,Ny&=67108863,z=Math.imul(M,nr),R=Math.imul(M,Kt),R=R+Math.imul($,nr)|0,L=Math.imul($,Kt),z=z+Math.imul(m,Wt)|0,R=R+Math.imul(m,dt)|0,R=R+Math.imul(v,Wt)|0,L=L+Math.imul(v,dt)|0,z=z+Math.imul(xe,Gt)|0,R=R+Math.imul(xe,ir)|0,R=R+Math.imul(pe,Gt)|0,L=L+Math.imul(pe,ir)|0,z=z+Math.imul(de,fr)|0,R=R+Math.imul(de,hr)|0,R=R+Math.imul(re,fr)|0,L=L+Math.imul(re,hr)|0,z=z+Math.imul(J,dr)|0,R=R+Math.imul(J,pr)|0,R=R+Math.imul(ne,dr)|0,L=L+Math.imul(ne,pr)|0;var Oy=(G+z|0)+((R&8191)<<13)|0;G=(L+(R>>>13)|0)+(Oy>>>26)|0,Oy&=67108863,z=Math.imul(M,Wt),R=Math.imul(M,dt),R=R+Math.imul($,Wt)|0,L=Math.imul($,dt),z=z+Math.imul(m,Gt)|0,R=R+Math.imul(m,ir)|0,R=R+Math.imul(v,Gt)|0,L=L+Math.imul(v,ir)|0,z=z+Math.imul(xe,fr)|0,R=R+Math.imul(xe,hr)|0,R=R+Math.imul(pe,fr)|0,L=L+Math.imul(pe,hr)|0,z=z+Math.imul(de,dr)|0,R=R+Math.imul(de,pr)|0,R=R+Math.imul(re,dr)|0,L=L+Math.imul(re,pr)|0;var Dy=(G+z|0)+((R&8191)<<13)|0;G=(L+(R>>>13)|0)+(Dy>>>26)|0,Dy&=67108863,z=Math.imul(M,Gt),R=Math.imul(M,ir),R=R+Math.imul($,Gt)|0,L=Math.imul($,ir),z=z+Math.imul(m,fr)|0,R=R+Math.imul(m,hr)|0,R=R+Math.imul(v,fr)|0,L=L+Math.imul(v,hr)|0,z=z+Math.imul(xe,dr)|0,R=R+Math.imul(xe,pr)|0,R=R+Math.imul(pe,dr)|0,L=L+Math.imul(pe,pr)|0;var Ry=(G+z|0)+((R&8191)<<13)|0;G=(L+(R>>>13)|0)+(Ry>>>26)|0,Ry&=67108863,z=Math.imul(M,fr),R=Math.imul(M,hr),R=R+Math.imul($,fr)|0,L=Math.imul($,hr),z=z+Math.imul(m,dr)|0,R=R+Math.imul(m,pr)|0,R=R+Math.imul(v,dr)|0,L=L+Math.imul(v,pr)|0;var My=(G+z|0)+((R&8191)<<13)|0;G=(L+(R>>>13)|0)+(My>>>26)|0,My&=67108863,z=Math.imul(M,dr),R=Math.imul(M,pr),R=R+Math.imul($,dr)|0,L=Math.imul($,pr);var Ly=(G+z|0)+((R&8191)<<13)|0;return G=(L+(R>>>13)|0)+(Ly>>>26)|0,Ly&=67108863,H[0]=by,H[1]=wy,H[2]=Ey,H[3]=Ay,H[4]=Sy,H[5]=Cy,H[6]=_y,H[7]=ky,H[8]=By,H[9]=Iy,H[10]=Fy,H[11]=Ty,H[12]=Py,H[13]=Ny,H[14]=Oy,H[15]=Dy,H[16]=Ry,H[17]=My,H[18]=Ly,G!==0&&(H[19]=G,A.length++),A};Math.imul||(g=d);function y(O,E,F){F.negative=E.negative^O.negative,F.length=O.length+E.length;for(var A=0,I=0,j=0;j>>26)|0,I+=H>>>26,H&=67108863}F.words[j]=G,A=H,H=I}return A!==0?F.words[j]=A:F.length--,F.strip()}function x(O,E,F){var A=new b;return A.mulp(O,E,F)}s.prototype.mulTo=function(E,F){var A,I=this.length+E.length;return this.length===10&&E.length===10?A=g(this,E,F):I<63?A=d(this,E,F):I<1024?A=y(this,E,F):A=x(this,E,F),A};function b(O,E){this.x=O,this.y=E}b.prototype.makeRBT=function(E){for(var F=new Array(E),A=s.prototype._countBits(E)-1,I=0;I>=1;return I},b.prototype.permute=function(E,F,A,I,j,H){for(var G=0;G>>1)j++;return 1<>>13,A[2*H+1]=j&8191,j=j>>>13;for(H=2*F;H>=26,F+=I/67108864|0,F+=j>>>26,this.words[A]=j&67108863}return F!==0&&(this.words[A]=F,this.length++),this},s.prototype.muln=function(E){return this.clone().imuln(E)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(E){var F=p(E);if(F.length===0)return new s(1);for(var A=this,I=0;I=0);var F=E%26,A=(E-F)/26,I=67108863>>>26-F<<26-F,j;if(F!==0){var H=0;for(j=0;j>>26-F}H&&(this.words[j]=H,this.length++)}if(A!==0){for(j=this.length-1;j>=0;j--)this.words[j+A]=this.words[j];for(j=0;j=0);var I;F?I=(F-F%26)/26:I=0;var j=E%26,H=Math.min((E-j)/26,this.length),G=67108863^67108863>>>j<H)for(this.length-=H,R=0;R=0&&(L!==0||R>=I);R--){var q=this.words[R]|0;this.words[R]=L<<26-j|q>>>j,L=q&G}return z&&L!==0&&(z.words[z.length++]=L),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(E,F,A){return n(this.negative===0),this.iushrn(E,F,A)},s.prototype.shln=function(E){return this.clone().ishln(E)},s.prototype.ushln=function(E){return this.clone().iushln(E)},s.prototype.shrn=function(E){return this.clone().ishrn(E)},s.prototype.ushrn=function(E){return this.clone().iushrn(E)},s.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var F=E%26,A=(E-F)/26,I=1<=0);var F=E%26,A=(E-F)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=A)return this;if(F!==0&&A++,this.length=Math.min(A,this.length),F!==0){var I=67108863^67108863>>>F<=67108864;F++)this.words[F]-=67108864,F===this.length-1?this.words[F+1]=1:this.words[F+1]++;return this.length=Math.max(this.length,F+1),this},s.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var F=0;F>26)-(z/67108864|0),this.words[j+A]=H&67108863}for(;j>26,this.words[j+A]=H&67108863;if(G===0)return this.strip();for(n(G===-1),G=0,j=0;j>26,this.words[j]=H&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(E,F){var A=this.length-E.length,I=this.clone(),j=E,H=j.words[j.length-1]|0,G=this._countBits(H);A=26-G,A!==0&&(j=j.ushln(A),I.iushln(A),H=j.words[j.length-1]|0);var z=I.length-j.length,R;if(F!=="mod"){R=new s(null),R.length=z+1,R.words=new Array(R.length);for(var L=0;L=0;ee--){var X=(I.words[j.length+ee]|0)*67108864+(I.words[j.length+ee-1]|0);for(X=Math.min(X/H|0,67108863),I._ishlnsubmul(j,X,ee);I.negative!==0;)X--,I.negative=0,I._ishlnsubmul(j,1,ee),I.isZero()||(I.negative^=1);R&&(R.words[ee]=X)}return R&&R.strip(),I.strip(),F!=="div"&&A!==0&&I.iushrn(A),{div:R||null,mod:I}},s.prototype.divmod=function(E,F,A){if(n(!E.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var I,j,H;return this.negative!==0&&E.negative===0?(H=this.neg().divmod(E,F),F!=="mod"&&(I=H.div.neg()),F!=="div"&&(j=H.mod.neg(),A&&j.negative!==0&&j.iadd(E)),{div:I,mod:j}):this.negative===0&&E.negative!==0?(H=this.divmod(E.neg(),F),F!=="mod"&&(I=H.div.neg()),{div:I,mod:H.mod}):this.negative&E.negative?(H=this.neg().divmod(E.neg(),F),F!=="div"&&(j=H.mod.neg(),A&&j.negative!==0&&j.isub(E)),{div:H.div,mod:j}):E.length>this.length||this.cmp(E)<0?{div:new s(0),mod:this}:E.length===1?F==="div"?{div:this.divn(E.words[0]),mod:null}:F==="mod"?{div:null,mod:new s(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new s(this.modn(E.words[0]))}:this._wordDiv(E,F)},s.prototype.div=function(E){return this.divmod(E,"div",!1).div},s.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},s.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},s.prototype.divRound=function(E){var F=this.divmod(E);if(F.mod.isZero())return F.div;var A=F.div.negative!==0?F.mod.isub(E):F.mod,I=E.ushrn(1),j=E.andln(1),H=A.cmp(I);return H<0||j===1&&H===0?F.div:F.div.negative!==0?F.div.isubn(1):F.div.iaddn(1)},s.prototype.modn=function(E){n(E<=67108863);for(var F=(1<<26)%E,A=0,I=this.length-1;I>=0;I--)A=(F*A+(this.words[I]|0))%E;return A},s.prototype.idivn=function(E){n(E<=67108863);for(var F=0,A=this.length-1;A>=0;A--){var I=(this.words[A]|0)+F*67108864;this.words[A]=I/E|0,F=I%E}return this.strip()},s.prototype.divn=function(E){return this.clone().idivn(E)},s.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var F=this,A=E.clone();F.negative!==0?F=F.umod(E):F=F.clone();for(var I=new s(1),j=new s(0),H=new s(0),G=new s(1),z=0;F.isEven()&&A.isEven();)F.iushrn(1),A.iushrn(1),++z;for(var R=A.clone(),L=F.clone();!F.isZero();){for(var q=0,ee=1;!(F.words[0]&ee)&&q<26;++q,ee<<=1);if(q>0)for(F.iushrn(q);q-- >0;)(I.isOdd()||j.isOdd())&&(I.iadd(R),j.isub(L)),I.iushrn(1),j.iushrn(1);for(var X=0,oe=1;!(A.words[0]&oe)&&X<26;++X,oe<<=1);if(X>0)for(A.iushrn(X);X-- >0;)(H.isOdd()||G.isOdd())&&(H.iadd(R),G.isub(L)),H.iushrn(1),G.iushrn(1);F.cmp(A)>=0?(F.isub(A),I.isub(H),j.isub(G)):(A.isub(F),H.isub(I),G.isub(j))}return{a:H,b:G,gcd:A.iushln(z)}},s.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var F=this,A=E.clone();F.negative!==0?F=F.umod(E):F=F.clone();for(var I=new s(1),j=new s(0),H=A.clone();F.cmpn(1)>0&&A.cmpn(1)>0;){for(var G=0,z=1;!(F.words[0]&z)&&G<26;++G,z<<=1);if(G>0)for(F.iushrn(G);G-- >0;)I.isOdd()&&I.iadd(H),I.iushrn(1);for(var R=0,L=1;!(A.words[0]&L)&&R<26;++R,L<<=1);if(R>0)for(A.iushrn(R);R-- >0;)j.isOdd()&&j.iadd(H),j.iushrn(1);F.cmp(A)>=0?(F.isub(A),I.isub(j)):(A.isub(F),j.isub(I))}var q;return F.cmpn(1)===0?q=I:q=j,q.cmpn(0)<0&&q.iadd(E),q},s.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var F=this.clone(),A=E.clone();F.negative=0,A.negative=0;for(var I=0;F.isEven()&&A.isEven();I++)F.iushrn(1),A.iushrn(1);do{for(;F.isEven();)F.iushrn(1);for(;A.isEven();)A.iushrn(1);var j=F.cmp(A);if(j<0){var H=F;F=A,A=H}else if(j===0||A.cmpn(1)===0)break;F.isub(A)}while(!0);return A.iushln(I)},s.prototype.invm=function(E){return this.egcd(E).a.umod(E)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(E){return this.words[0]&E},s.prototype.bincn=function(E){n(typeof E=="number");var F=E%26,A=(E-F)/26,I=1<>>26,G&=67108863,this.words[H]=G}return j!==0&&(this.words[H]=j,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(E){var F=E<0;if(this.negative!==0&&!F)return-1;if(this.negative===0&&F)return 1;this.strip();var A;if(this.length>1)A=1;else{F&&(E=-E),n(E<=67108863,"Number is too big");var I=this.words[0]|0;A=I===E?0:IE.length)return 1;if(this.length=0;A--){var I=this.words[A]|0,j=E.words[A]|0;if(I!==j){Ij&&(F=1);break}}return F},s.prototype.gtn=function(E){return this.cmpn(E)===1},s.prototype.gt=function(E){return this.cmp(E)===1},s.prototype.gten=function(E){return this.cmpn(E)>=0},s.prototype.gte=function(E){return this.cmp(E)>=0},s.prototype.ltn=function(E){return this.cmpn(E)===-1},s.prototype.lt=function(E){return this.cmp(E)===-1},s.prototype.lten=function(E){return this.cmpn(E)<=0},s.prototype.lte=function(E){return this.cmp(E)<=0},s.prototype.eqn=function(E){return this.cmpn(E)===0},s.prototype.eq=function(E){return this.cmp(E)===0},s.red=function(E){return new P(E)},s.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(E){return this.red=E,this},s.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},s.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},s.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},s.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},s.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},s.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},s.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},s.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var S={k256:null,p224:null,p192:null,p25519:null};function k(O,E){this.name=O,this.p=new s(E,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}k.prototype._tmp=function(){var E=new s(null);return E.words=new Array(Math.ceil(this.n/13)),E},k.prototype.ireduce=function(E){var F=E,A;do this.split(F,this.tmp),F=this.imulK(F),F=F.iadd(this.tmp),A=F.bitLength();while(A>this.n);var I=A0?F.isub(this.p):F.strip!==void 0?F.strip():F._strip(),F},k.prototype.split=function(E,F){E.iushrn(this.n,0,F)},k.prototype.imulK=function(E){return E.imul(this.k)};function T(){k.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(T,k),T.prototype.split=function(E,F){for(var A=4194303,I=Math.min(E.length,9),j=0;j>>22,H=G}H>>>=22,E.words[j-10]=H,H===0&&E.length>10?E.length-=10:E.length-=9},T.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var F=0,A=0;A>>=26,E.words[A]=j,F=I}return F!==0&&(E.words[E.length++]=F),E},s._prime=function(E){if(S[E])return S[E];var F;if(E==="k256")F=new T;else if(E==="p224")F=new _;else if(E==="p192")F=new B;else if(E==="p25519")F=new N;else throw new Error("Unknown prime "+E);return S[E]=F,F};function P(O){if(typeof O=="string"){var E=s._prime(O);this.m=E.p,this.prime=E}else n(O.gtn(1),"modulus must be greater than 1"),this.m=O,this.prime=null}P.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},P.prototype._verify2=function(E,F){n((E.negative|F.negative)===0,"red works only with positives"),n(E.red&&E.red===F.red,"red works only with red numbers")},P.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},P.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},P.prototype.add=function(E,F){this._verify2(E,F);var A=E.add(F);return A.cmp(this.m)>=0&&A.isub(this.m),A._forceRed(this)},P.prototype.iadd=function(E,F){this._verify2(E,F);var A=E.iadd(F);return A.cmp(this.m)>=0&&A.isub(this.m),A},P.prototype.sub=function(E,F){this._verify2(E,F);var A=E.sub(F);return A.cmpn(0)<0&&A.iadd(this.m),A._forceRed(this)},P.prototype.isub=function(E,F){this._verify2(E,F);var A=E.isub(F);return A.cmpn(0)<0&&A.iadd(this.m),A},P.prototype.shl=function(E,F){return this._verify1(E),this.imod(E.ushln(F))},P.prototype.imul=function(E,F){return this._verify2(E,F),this.imod(E.imul(F))},P.prototype.mul=function(E,F){return this._verify2(E,F),this.imod(E.mul(F))},P.prototype.isqr=function(E){return this.imul(E,E.clone())},P.prototype.sqr=function(E){return this.mul(E,E)},P.prototype.sqrt=function(E){if(E.isZero())return E.clone();var F=this.m.andln(3);if(n(F%2===1),F===3){var A=this.m.add(new s(1)).iushrn(2);return this.pow(E,A)}for(var I=this.m.subn(1),j=0;!I.isZero()&&I.andln(1)===0;)j++,I.iushrn(1);n(!I.isZero());var H=new s(1).toRed(this),G=H.redNeg(),z=this.m.subn(1).iushrn(1),R=this.m.bitLength();for(R=new s(2*R*R).toRed(this);this.pow(R,z).cmp(G)!==0;)R.redIAdd(G);for(var L=this.pow(R,I),q=this.pow(E,I.addn(1).iushrn(1)),ee=this.pow(E,I),X=j;ee.cmp(H)!==0;){for(var oe=ee,me=0;oe.cmp(H)!==0;me++)oe=oe.redSqr();n(me=0;j--){for(var L=F.words[j],q=R-1;q>=0;q--){var ee=L>>q&1;if(H!==I[0]&&(H=this.sqr(H)),ee===0&&G===0){z=0;continue}G<<=1,G|=ee,z++,!(z!==A&&(j!==0||q!==0))&&(H=this.mul(H,I[G]),z=0,G=0)}R=26}return H},P.prototype.convertTo=function(E){var F=E.umod(this.m);return F===E?F.clone():F},P.prototype.convertFrom=function(E){var F=E.clone();return F.red=null,F},s.mont=function(E){return new D(E)};function D(O){P.call(this,O),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(D,P),D.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},D.prototype.convertFrom=function(E){var F=this.imod(E.mul(this.rinv));return F.red=null,F},D.prototype.imul=function(E,F){if(E.isZero()||F.isZero())return E.words[0]=0,E.length=1,E;var A=E.imul(F),I=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),j=A.isub(I).iushrn(this.shift),H=j;return j.cmp(this.m)>=0?H=j.isub(this.m):j.cmpn(0)<0&&(H=j.iadd(this.m)),H._forceRed(this)},D.prototype.mul=function(E,F){if(E.isZero()||F.isZero())return new s(0)._forceRed(this);var A=E.mul(F),I=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),j=A.isub(I).iushrn(this.shift),H=j;return j.cmp(this.m)>=0?H=j.isub(this.m):j.cmpn(0)<0&&(H=j.iadd(this.m)),H._forceRed(this)},D.prototype.invm=function(E){var F=this.imod(E._invmp(this.m).mul(this.r2));return F._forceRed(this)}})(t,We)})(o8);var Ps=o8.exports,fI={},u8={},Nw={exports:{}};typeof Object.create=="function"?Nw.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Nw.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var Ns=Nw.exports,l8={},Mv={};Mv.byteLength=WG;Mv.toByteArray=ZG;Mv.fromByteArray=QG;var Ys=[],bi=[],qG=typeof Uint8Array<"u"?Uint8Array:Array,L2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var El=0,KG=L2.length;El0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function WG(t){var e=hI(t),r=e[0],n=e[1];return(r+n)*3/4-n}function GG(t,e,r){return(e+r)*3/4-r}function ZG(t){var e,r=hI(t),n=r[0],i=r[1],s=new qG(GG(t,n,i)),a=0,o=i>0?n-4:n,c;for(c=0;c>16&255,s[a++]=e>>8&255,s[a++]=e&255;return i===2&&(e=bi[t.charCodeAt(c)]<<2|bi[t.charCodeAt(c+1)]>>4,s[a++]=e&255),i===1&&(e=bi[t.charCodeAt(c)]<<10|bi[t.charCodeAt(c+1)]<<4|bi[t.charCodeAt(c+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}function JG(t){return Ys[t>>18&63]+Ys[t>>12&63]+Ys[t>>6&63]+Ys[t&63]}function XG(t,e,r){for(var n,i=[],s=e;so?o:a+s));return n===1?(e=t[r-1],i.push(Ys[e>>2]+Ys[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Ys[e>>10]+Ys[e>>4&63]+Ys[e<<2&63]+"=")),i.join("")}var f8={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */f8.read=function(t,e,r,n,i){var s,a,o=i*8-n-1,c=(1<>1,l=-7,h=r?i-1:0,f=r?-1:1,p=t[e+h];for(h+=f,s=p&(1<<-l)-1,p>>=-l,l+=o;l>0;s=s*256+t[e+h],h+=f,l-=8);for(a=s&(1<<-l)-1,s>>=-l,l+=n;l>0;a=a*256+t[e+h],h+=f,l-=8);if(s===0)s=1-u;else{if(s===c)return a?NaN:(p?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-u}return(p?-1:1)*a*Math.pow(2,s-n)};f8.write=function(t,e,r,n,i,s){var a,o,c,u=s*8-i-1,l=(1<>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:s-1,d=n?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+h>=1?e+=f/c:e+=f*Math.pow(2,1-h),e*c>=2&&(a++,c/=2),a+h>=l?(o=0,a=l):a+h>=1?(o=(e*c-1)*Math.pow(2,i),a=a+h):(o=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+p]=o&255,p+=d,o/=256,i-=8);for(a=a<0;t[r+p]=a&255,p+=d,a/=256,u-=8);t[r+p-d]|=g*128};/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */(function(t){const e=Mv,r=f8,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=o,t.SlowBuffer=b,t.INSPECT_MAX_BYTES=50;const i=2147483647;t.kMaxLength=i,o.TYPED_ARRAY_SUPPORT=s(),!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 s(){try{const m=new Uint8Array(1),v={foo:function(){return 42}};return Object.setPrototypeOf(v,Uint8Array.prototype),Object.setPrototypeOf(m,v),m.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 a(m){if(m>i)throw new RangeError('The value "'+m+'" is invalid for option "size"');const v=new Uint8Array(m);return Object.setPrototypeOf(v,o.prototype),v}function o(m,v,w){if(typeof m=="number"){if(typeof v=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return h(m)}return c(m,v,w)}o.poolSize=8192;function c(m,v,w){if(typeof m=="string")return f(m,v);if(ArrayBuffer.isView(m))return d(m);if(m==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m);if(re(m,ArrayBuffer)||m&&re(m.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(re(m,SharedArrayBuffer)||m&&re(m.buffer,SharedArrayBuffer)))return g(m,v,w);if(typeof m=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const M=m.valueOf&&m.valueOf();if(M!=null&&M!==m)return o.from(M,v,w);const $=y(m);if($)return $;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof m[Symbol.toPrimitive]=="function")return o.from(m[Symbol.toPrimitive]("string"),v,w);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m)}o.from=function(m,v,w){return c(m,v,w)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function u(m){if(typeof m!="number")throw new TypeError('"size" argument must be of type number');if(m<0)throw new RangeError('The value "'+m+'" is invalid for option "size"')}function l(m,v,w){return u(m),m<=0?a(m):v!==void 0?typeof w=="string"?a(m).fill(v,w):a(m).fill(v):a(m)}o.alloc=function(m,v,w){return l(m,v,w)};function h(m){return u(m),a(m<0?0:x(m)|0)}o.allocUnsafe=function(m){return h(m)},o.allocUnsafeSlow=function(m){return h(m)};function f(m,v){if((typeof v!="string"||v==="")&&(v="utf8"),!o.isEncoding(v))throw new TypeError("Unknown encoding: "+v);const w=S(m,v)|0;let M=a(w);const $=M.write(m,v);return $!==w&&(M=M.slice(0,$)),M}function p(m){const v=m.length<0?0:x(m.length)|0,w=a(v);for(let M=0;M=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return m|0}function b(m){return+m!=m&&(m=0),o.alloc(+m)}o.isBuffer=function(v){return v!=null&&v._isBuffer===!0&&v!==o.prototype},o.compare=function(v,w){if(re(v,Uint8Array)&&(v=o.from(v,v.offset,v.byteLength)),re(w,Uint8Array)&&(w=o.from(w,w.offset,w.byteLength)),!o.isBuffer(v)||!o.isBuffer(w))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(v===w)return 0;let M=v.length,$=w.length;for(let W=0,Z=Math.min(M,$);W$.length?(o.isBuffer(Z)||(Z=o.from(Z)),Z.copy($,W)):Uint8Array.prototype.set.call($,Z,W);else if(o.isBuffer(Z))Z.copy($,W);else throw new TypeError('"list" argument must be an Array of Buffers');W+=Z.length}return $};function S(m,v){if(o.isBuffer(m))return m.length;if(ArrayBuffer.isView(m)||re(m,ArrayBuffer))return m.byteLength;if(typeof m!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof m);const w=m.length,M=arguments.length>2&&arguments[2]===!0;if(!M&&w===0)return 0;let $=!1;for(;;)switch(v){case"ascii":case"latin1":case"binary":return w;case"utf8":case"utf-8":return Y(m).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w*2;case"hex":return w>>>1;case"base64":return ge(m).length;default:if($)return M?-1:Y(m).length;v=(""+v).toLowerCase(),$=!0}}o.byteLength=S;function k(m,v,w){let M=!1;if((v===void 0||v<0)&&(v=0),v>this.length||((w===void 0||w>this.length)&&(w=this.length),w<=0)||(w>>>=0,v>>>=0,w<=v))return"";for(m||(m="utf8");;)switch(m){case"hex":return z(this,v,w);case"utf8":case"utf-8":return A(this,v,w);case"ascii":return H(this,v,w);case"latin1":case"binary":return G(this,v,w);case"base64":return F(this,v,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,v,w);default:if(M)throw new TypeError("Unknown encoding: "+m);m=(m+"").toLowerCase(),M=!0}}o.prototype._isBuffer=!0;function T(m,v,w){const M=m[v];m[v]=m[w],m[w]=M}o.prototype.swap16=function(){const v=this.length;if(v%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let w=0;ww&&(v+=" ... "),""},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(v,w,M,$,W){if(re(v,Uint8Array)&&(v=o.from(v,v.offset,v.byteLength)),!o.isBuffer(v))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof v);if(w===void 0&&(w=0),M===void 0&&(M=v?v.length:0),$===void 0&&($=0),W===void 0&&(W=this.length),w<0||M>v.length||$<0||W>this.length)throw new RangeError("out of range index");if($>=W&&w>=M)return 0;if($>=W)return-1;if(w>=M)return 1;if(w>>>=0,M>>>=0,$>>>=0,W>>>=0,this===v)return 0;let Z=W-$,Ee=M-w;const Ue=Math.min(Z,Ee),ke=this.slice($,W),Ie=v.slice(w,M);for(let Le=0;Le2147483647?w=2147483647:w<-2147483648&&(w=-2147483648),w=+w,Ce(w)&&(w=$?0:m.length-1),w<0&&(w=m.length+w),w>=m.length){if($)return-1;w=m.length-1}else if(w<0)if($)w=0;else return-1;if(typeof v=="string"&&(v=o.from(v,M)),o.isBuffer(v))return v.length===0?-1:B(m,v,w,M,$);if(typeof v=="number")return v=v&255,typeof Uint8Array.prototype.indexOf=="function"?$?Uint8Array.prototype.indexOf.call(m,v,w):Uint8Array.prototype.lastIndexOf.call(m,v,w):B(m,[v],w,M,$);throw new TypeError("val must be string, number or Buffer")}function B(m,v,w,M,$){let W=1,Z=m.length,Ee=v.length;if(M!==void 0&&(M=String(M).toLowerCase(),M==="ucs2"||M==="ucs-2"||M==="utf16le"||M==="utf-16le")){if(m.length<2||v.length<2)return-1;W=2,Z/=2,Ee/=2,w/=2}function Ue(Ie,Le){return W===1?Ie[Le]:Ie.readUInt16BE(Le*W)}let ke;if($){let Ie=-1;for(ke=w;keZ&&(w=Z-Ee),ke=w;ke>=0;ke--){let Ie=!0;for(let Le=0;Le$&&(M=$)):M=$;const W=v.length;M>W/2&&(M=W/2);let Z;for(Z=0;Z>>0,isFinite(M)?(M=M>>>0,$===void 0&&($="utf8")):($=M,M=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const W=this.length-w;if((M===void 0||M>W)&&(M=W),v.length>0&&(M<0||w<0)||w>this.length)throw new RangeError("Attempt to write outside buffer bounds");$||($="utf8");let Z=!1;for(;;)switch($){case"hex":return N(this,v,w,M);case"utf8":case"utf-8":return P(this,v,w,M);case"ascii":case"latin1":case"binary":return D(this,v,w,M);case"base64":return O(this,v,w,M);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,v,w,M);default:if(Z)throw new TypeError("Unknown encoding: "+$);$=(""+$).toLowerCase(),Z=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function F(m,v,w){return v===0&&w===m.length?e.fromByteArray(m):e.fromByteArray(m.slice(v,w))}function A(m,v,w){w=Math.min(m.length,w);const M=[];let $=v;for(;$239?4:W>223?3:W>191?2:1;if($+Ee<=w){let Ue,ke,Ie,Le;switch(Ee){case 1:W<128&&(Z=W);break;case 2:Ue=m[$+1],(Ue&192)===128&&(Le=(W&31)<<6|Ue&63,Le>127&&(Z=Le));break;case 3:Ue=m[$+1],ke=m[$+2],(Ue&192)===128&&(ke&192)===128&&(Le=(W&15)<<12|(Ue&63)<<6|ke&63,Le>2047&&(Le<55296||Le>57343)&&(Z=Le));break;case 4:Ue=m[$+1],ke=m[$+2],Ie=m[$+3],(Ue&192)===128&&(ke&192)===128&&(Ie&192)===128&&(Le=(W&15)<<18|(Ue&63)<<12|(ke&63)<<6|Ie&63,Le>65535&&Le<1114112&&(Z=Le))}}Z===null?(Z=65533,Ee=1):Z>65535&&(Z-=65536,M.push(Z>>>10&1023|55296),Z=56320|Z&1023),M.push(Z),$+=Ee}return j(M)}const I=4096;function j(m){const v=m.length;if(v<=I)return String.fromCharCode.apply(String,m);let w="",M=0;for(;MM)&&(w=M);let $="";for(let W=v;WM&&(v=M),w<0?(w+=M,w<0&&(w=0)):w>M&&(w=M),ww)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(v,w,M){v=v>>>0,w=w>>>0,M||L(v,w,this.length);let $=this[v],W=1,Z=0;for(;++Z>>0,w=w>>>0,M||L(v,w,this.length);let $=this[v+--w],W=1;for(;w>0&&(W*=256);)$+=this[v+--w]*W;return $},o.prototype.readUint8=o.prototype.readUInt8=function(v,w){return v=v>>>0,w||L(v,1,this.length),this[v]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(v,w){return v=v>>>0,w||L(v,2,this.length),this[v]|this[v+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(v,w){return v=v>>>0,w||L(v,2,this.length),this[v]<<8|this[v+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(v,w){return v=v>>>0,w||L(v,4,this.length),(this[v]|this[v+1]<<8|this[v+2]<<16)+this[v+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(v,w){return v=v>>>0,w||L(v,4,this.length),this[v]*16777216+(this[v+1]<<16|this[v+2]<<8|this[v+3])},o.prototype.readBigUInt64LE=pe(function(v){v=v>>>0,Pe(v,"offset");const w=this[v],M=this[v+7];(w===void 0||M===void 0)&&V(v,this.length-8);const $=w+this[++v]*2**8+this[++v]*2**16+this[++v]*2**24,W=this[++v]+this[++v]*2**8+this[++v]*2**16+M*2**24;return BigInt($)+(BigInt(W)<>>0,Pe(v,"offset");const w=this[v],M=this[v+7];(w===void 0||M===void 0)&&V(v,this.length-8);const $=w*2**24+this[++v]*2**16+this[++v]*2**8+this[++v],W=this[++v]*2**24+this[++v]*2**16+this[++v]*2**8+M;return(BigInt($)<>>0,w=w>>>0,M||L(v,w,this.length);let $=this[v],W=1,Z=0;for(;++Z=W&&($-=Math.pow(2,8*w)),$},o.prototype.readIntBE=function(v,w,M){v=v>>>0,w=w>>>0,M||L(v,w,this.length);let $=w,W=1,Z=this[v+--$];for(;$>0&&(W*=256);)Z+=this[v+--$]*W;return W*=128,Z>=W&&(Z-=Math.pow(2,8*w)),Z},o.prototype.readInt8=function(v,w){return v=v>>>0,w||L(v,1,this.length),this[v]&128?(255-this[v]+1)*-1:this[v]},o.prototype.readInt16LE=function(v,w){v=v>>>0,w||L(v,2,this.length);const M=this[v]|this[v+1]<<8;return M&32768?M|4294901760:M},o.prototype.readInt16BE=function(v,w){v=v>>>0,w||L(v,2,this.length);const M=this[v+1]|this[v]<<8;return M&32768?M|4294901760:M},o.prototype.readInt32LE=function(v,w){return v=v>>>0,w||L(v,4,this.length),this[v]|this[v+1]<<8|this[v+2]<<16|this[v+3]<<24},o.prototype.readInt32BE=function(v,w){return v=v>>>0,w||L(v,4,this.length),this[v]<<24|this[v+1]<<16|this[v+2]<<8|this[v+3]},o.prototype.readBigInt64LE=pe(function(v){v=v>>>0,Pe(v,"offset");const w=this[v],M=this[v+7];(w===void 0||M===void 0)&&V(v,this.length-8);const $=this[v+4]+this[v+5]*2**8+this[v+6]*2**16+(M<<24);return(BigInt($)<>>0,Pe(v,"offset");const w=this[v],M=this[v+7];(w===void 0||M===void 0)&&V(v,this.length-8);const $=(w<<24)+this[++v]*2**16+this[++v]*2**8+this[++v];return(BigInt($)<>>0,w||L(v,4,this.length),r.read(this,v,!0,23,4)},o.prototype.readFloatBE=function(v,w){return v=v>>>0,w||L(v,4,this.length),r.read(this,v,!1,23,4)},o.prototype.readDoubleLE=function(v,w){return v=v>>>0,w||L(v,8,this.length),r.read(this,v,!0,52,8)},o.prototype.readDoubleBE=function(v,w){return v=v>>>0,w||L(v,8,this.length),r.read(this,v,!1,52,8)};function q(m,v,w,M,$,W){if(!o.isBuffer(m))throw new TypeError('"buffer" argument must be a Buffer instance');if(v>$||vm.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(v,w,M,$){if(v=+v,w=w>>>0,M=M>>>0,!$){const Ee=Math.pow(2,8*M)-1;q(this,v,w,M,Ee,0)}let W=1,Z=0;for(this[w]=v&255;++Z>>0,M=M>>>0,!$){const Ee=Math.pow(2,8*M)-1;q(this,v,w,M,Ee,0)}let W=M-1,Z=1;for(this[w+W]=v&255;--W>=0&&(Z*=256);)this[w+W]=v/Z&255;return w+M},o.prototype.writeUint8=o.prototype.writeUInt8=function(v,w,M){return v=+v,w=w>>>0,M||q(this,v,w,1,255,0),this[w]=v&255,w+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(v,w,M){return v=+v,w=w>>>0,M||q(this,v,w,2,65535,0),this[w]=v&255,this[w+1]=v>>>8,w+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(v,w,M){return v=+v,w=w>>>0,M||q(this,v,w,2,65535,0),this[w]=v>>>8,this[w+1]=v&255,w+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(v,w,M){return v=+v,w=w>>>0,M||q(this,v,w,4,4294967295,0),this[w+3]=v>>>24,this[w+2]=v>>>16,this[w+1]=v>>>8,this[w]=v&255,w+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(v,w,M){return v=+v,w=w>>>0,M||q(this,v,w,4,4294967295,0),this[w]=v>>>24,this[w+1]=v>>>16,this[w+2]=v>>>8,this[w+3]=v&255,w+4};function ee(m,v,w,M,$){Be(v,M,$,m,w,7);let W=Number(v&BigInt(4294967295));m[w++]=W,W=W>>8,m[w++]=W,W=W>>8,m[w++]=W,W=W>>8,m[w++]=W;let Z=Number(v>>BigInt(32)&BigInt(4294967295));return m[w++]=Z,Z=Z>>8,m[w++]=Z,Z=Z>>8,m[w++]=Z,Z=Z>>8,m[w++]=Z,w}function X(m,v,w,M,$){Be(v,M,$,m,w,7);let W=Number(v&BigInt(4294967295));m[w+7]=W,W=W>>8,m[w+6]=W,W=W>>8,m[w+5]=W,W=W>>8,m[w+4]=W;let Z=Number(v>>BigInt(32)&BigInt(4294967295));return m[w+3]=Z,Z=Z>>8,m[w+2]=Z,Z=Z>>8,m[w+1]=Z,Z=Z>>8,m[w]=Z,w+8}o.prototype.writeBigUInt64LE=pe(function(v,w=0){return ee(this,v,w,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=pe(function(v,w=0){return X(this,v,w,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(v,w,M,$){if(v=+v,w=w>>>0,!$){const Ue=Math.pow(2,8*M-1);q(this,v,w,M,Ue-1,-Ue)}let W=0,Z=1,Ee=0;for(this[w]=v&255;++W>0)-Ee&255;return w+M},o.prototype.writeIntBE=function(v,w,M,$){if(v=+v,w=w>>>0,!$){const Ue=Math.pow(2,8*M-1);q(this,v,w,M,Ue-1,-Ue)}let W=M-1,Z=1,Ee=0;for(this[w+W]=v&255;--W>=0&&(Z*=256);)v<0&&Ee===0&&this[w+W+1]!==0&&(Ee=1),this[w+W]=(v/Z>>0)-Ee&255;return w+M},o.prototype.writeInt8=function(v,w,M){return v=+v,w=w>>>0,M||q(this,v,w,1,127,-128),v<0&&(v=255+v+1),this[w]=v&255,w+1},o.prototype.writeInt16LE=function(v,w,M){return v=+v,w=w>>>0,M||q(this,v,w,2,32767,-32768),this[w]=v&255,this[w+1]=v>>>8,w+2},o.prototype.writeInt16BE=function(v,w,M){return v=+v,w=w>>>0,M||q(this,v,w,2,32767,-32768),this[w]=v>>>8,this[w+1]=v&255,w+2},o.prototype.writeInt32LE=function(v,w,M){return v=+v,w=w>>>0,M||q(this,v,w,4,2147483647,-2147483648),this[w]=v&255,this[w+1]=v>>>8,this[w+2]=v>>>16,this[w+3]=v>>>24,w+4},o.prototype.writeInt32BE=function(v,w,M){return v=+v,w=w>>>0,M||q(this,v,w,4,2147483647,-2147483648),v<0&&(v=4294967295+v+1),this[w]=v>>>24,this[w+1]=v>>>16,this[w+2]=v>>>8,this[w+3]=v&255,w+4},o.prototype.writeBigInt64LE=pe(function(v,w=0){return ee(this,v,w,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=pe(function(v,w=0){return X(this,v,w,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function oe(m,v,w,M,$,W){if(w+M>m.length)throw new RangeError("Index out of range");if(w<0)throw new RangeError("Index out of range")}function me(m,v,w,M,$){return v=+v,w=w>>>0,$||oe(m,v,w,4),r.write(m,v,w,M,23,4),w+4}o.prototype.writeFloatLE=function(v,w,M){return me(this,v,w,!0,M)},o.prototype.writeFloatBE=function(v,w,M){return me(this,v,w,!1,M)};function le(m,v,w,M,$){return v=+v,w=w>>>0,$||oe(m,v,w,8),r.write(m,v,w,M,52,8),w+8}o.prototype.writeDoubleLE=function(v,w,M){return le(this,v,w,!0,M)},o.prototype.writeDoubleBE=function(v,w,M){return le(this,v,w,!1,M)},o.prototype.copy=function(v,w,M,$){if(!o.isBuffer(v))throw new TypeError("argument should be a Buffer");if(M||(M=0),!$&&$!==0&&($=this.length),w>=v.length&&(w=v.length),w||(w=0),$>0&&$=this.length)throw new RangeError("Index out of range");if($<0)throw new RangeError("sourceEnd out of bounds");$>this.length&&($=this.length),v.length-w<$-M&&($=v.length-w+M);const W=$-M;return this===v&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(w,M,$):Uint8Array.prototype.set.call(v,this.subarray(M,$),w),W},o.prototype.fill=function(v,w,M,$){if(typeof v=="string"){if(typeof w=="string"?($=w,w=0,M=this.length):typeof M=="string"&&($=M,M=this.length),$!==void 0&&typeof $!="string")throw new TypeError("encoding must be a string");if(typeof $=="string"&&!o.isEncoding($))throw new TypeError("Unknown encoding: "+$);if(v.length===1){const Z=v.charCodeAt(0);($==="utf8"&&Z<128||$==="latin1")&&(v=Z)}}else typeof v=="number"?v=v&255:typeof v=="boolean"&&(v=Number(v));if(w<0||this.length>>0,M=M===void 0?this.length:M>>>0,v||(v=0);let W;if(typeof v=="number")for(W=w;W2**32?$=Ae(String(w)):typeof w=="bigint"&&($=String(w),(w>BigInt(2)**BigInt(32)||w<-(BigInt(2)**BigInt(32)))&&($=Ae($)),$+="n"),M+=` It must be ${v}. Received ${$}`,M},RangeError);function Ae(m){let v="",w=m.length;const M=m[0]==="-"?1:0;for(;w>=M+4;w-=3)v=`_${m.slice(w-3,w)}${v}`;return`${m.slice(0,w)}${v}`}function Me(m,v,w){Pe(v,"offset"),(m[v]===void 0||m[v+w]===void 0)&&V(v,m.length-(w+1))}function Be(m,v,w,M,$,W){if(m>w||m3?v===0||v===BigInt(0)?Ee=`>= 0${Z} and < 2${Z} ** ${(W+1)*8}${Z}`:Ee=`>= -(2${Z} ** ${(W+1)*8-1}${Z}) and < 2 ** ${(W+1)*8-1}${Z}`:Ee=`>= ${v}${Z} and <= ${w}${Z}`,new fe.ERR_OUT_OF_RANGE("value",Ee,m)}Me(M,$,W)}function Pe(m,v){if(typeof m!="number")throw new fe.ERR_INVALID_ARG_TYPE(v,"number",m)}function V(m,v,w){throw Math.floor(m)!==m?(Pe(m,w),new fe.ERR_OUT_OF_RANGE(w||"offset","an integer",m)):v<0?new fe.ERR_BUFFER_OUT_OF_BOUNDS:new fe.ERR_OUT_OF_RANGE(w||"offset",`>= ${w?1:0} and <= ${v}`,m)}const ue=/[^+/0-9A-Za-z-_]/g;function se(m){if(m=m.split("=")[0],m=m.trim().replace(ue,""),m.length<2)return"";for(;m.length%4!==0;)m=m+"=";return m}function Y(m,v){v=v||1/0;let w;const M=m.length;let $=null;const W=[];for(let Z=0;Z55295&&w<57344){if(!$){if(w>56319){(v-=3)>-1&&W.push(239,191,189);continue}else if(Z+1===M){(v-=3)>-1&&W.push(239,191,189);continue}$=w;continue}if(w<56320){(v-=3)>-1&&W.push(239,191,189),$=w;continue}w=($-55296<<10|w-56320)+65536}else $&&(v-=3)>-1&&W.push(239,191,189);if($=null,w<128){if((v-=1)<0)break;W.push(w)}else if(w<2048){if((v-=2)<0)break;W.push(w>>6|192,w&63|128)}else if(w<65536){if((v-=3)<0)break;W.push(w>>12|224,w>>6&63|128,w&63|128)}else if(w<1114112){if((v-=4)<0)break;W.push(w>>18|240,w>>12&63|128,w>>6&63|128,w&63|128)}else throw new Error("Invalid code point")}return W}function J(m){const v=[];for(let w=0;w>8,$=w%256,W.push($),W.push(M);return W}function ge(m){return e.toByteArray(se(m))}function de(m,v,w,M){let $;for($=0;$=v.length||$>=m.length);++$)v[$+w]=m[$];return $}function re(m,v){return m instanceof v||m!=null&&m.constructor!=null&&m.constructor.name!=null&&m.constructor.name===v.name}function Ce(m){return m!==m}const xe=function(){const m="0123456789abcdef",v=new Array(256);for(let w=0;w<16;++w){const M=w*16;for(let $=0;$<16;++$)v[M+$]=m[w]+m[$]}return v}();function pe(m){return typeof BigInt>"u"?Fe:m}function Fe(){throw new Error("BigInt not supported")}})(l8);var mg=l8,pf=mg.Buffer,Fi={},Ti;for(Ti in mg)mg.hasOwnProperty(Ti)&&(Ti==="SlowBuffer"||Ti==="Buffer"||(Fi[Ti]=mg[Ti]));var gf=Fi.Buffer={};for(Ti in pf)pf.hasOwnProperty(Ti)&&(Ti==="allocUnsafe"||Ti==="allocUnsafeSlow"||(gf[Ti]=pf[Ti]));Fi.Buffer.prototype=pf.prototype;(!gf.from||gf.from===Uint8Array.from)&&(gf.from=function(t,e,r){if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type '+typeof t);if(t&&typeof t.length>"u")throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);return pf(t,e,r)});gf.alloc||(gf.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError('The "size" argument must be of type number. Received type '+typeof t);if(t<0||t>=2*(1<<30))throw new RangeError('The value "'+t+'" is invalid for option "size"');var n=pf(t);return!e||e.length===0?n.fill(0):typeof r=="string"?n.fill(e,r):n.fill(e),n});if(!Fi.kStringMaxLength)try{Fi.kStringMaxLength=process.binding("buffer").kStringMaxLength}catch{}Fi.constants||(Fi.constants={MAX_LENGTH:Fi.kMaxLength},Fi.kStringMaxLength&&(Fi.constants.MAX_STRING_LENGTH=Fi.kStringMaxLength));var h8=Fi,Lv={};const YG=Ns;function Gi(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}Lv.Reporter=Gi;Gi.prototype.isError=function(e){return e instanceof Fh};Gi.prototype.save=function(){const e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}};Gi.prototype.restore=function(e){const r=this._reporterState;r.obj=e.obj,r.path=r.path.slice(0,e.pathLen)};Gi.prototype.enterKey=function(e){return this._reporterState.path.push(e)};Gi.prototype.exitKey=function(e){const r=this._reporterState;r.path=r.path.slice(0,e-1)};Gi.prototype.leaveKey=function(e,r,n){const i=this._reporterState;this.exitKey(e),i.obj!==null&&(i.obj[r]=n)};Gi.prototype.path=function(){return this._reporterState.path.join("/")};Gi.prototype.enterObject=function(){const e=this._reporterState,r=e.obj;return e.obj={},r};Gi.prototype.leaveObject=function(e){const r=this._reporterState,n=r.obj;return r.obj=e,n};Gi.prototype.error=function(e){let r;const n=this._reporterState,i=e instanceof Fh;if(i?r=e:r=new Fh(n.path.map(function(s){return"["+JSON.stringify(s)+"]"}).join(""),e.message||e,e.stack),!n.options.partial)throw r;return i||n.errors.push(r),r};Gi.prototype.wrapResult=function(e){const r=this._reporterState;return r.options.partial?{result:this.isError(e)?null:e,errors:r.errors}:e};function Fh(t,e){this.path=t,this.rethrow(e)}YG(Fh,Error);Fh.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,Fh),!this.stack)try{throw new Error(this.message)}catch(r){this.stack=r.stack}return this};var Wu={};const eZ=Ns,jv=Lv.Reporter,Th=h8.Buffer;function Ki(t,e){if(jv.call(this,e),!Th.isBuffer(t)){this.error("Input not Buffer");return}this.base=t,this.offset=0,this.length=t.length}eZ(Ki,jv);Wu.DecoderBuffer=Ki;Ki.isDecoderBuffer=function(e){return e instanceof Ki?!0:typeof e=="object"&&Th.isBuffer(e.base)&&e.constructor.name==="DecoderBuffer"&&typeof e.offset=="number"&&typeof e.length=="number"&&typeof e.save=="function"&&typeof e.restore=="function"&&typeof e.isEmpty=="function"&&typeof e.readUInt8=="function"&&typeof e.skip=="function"&&typeof e.raw=="function"};Ki.prototype.save=function(){return{offset:this.offset,reporter:jv.prototype.save.call(this)}};Ki.prototype.restore=function(e){const r=new Ki(this.base);return r.offset=e.offset,r.length=this.offset,this.offset=e.offset,jv.prototype.restore.call(this,e.reporter),r};Ki.prototype.isEmpty=function(){return this.offset===this.length};Ki.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")};Ki.prototype.skip=function(e,r){if(!(this.offset+e<=this.length))return this.error(r||"DecoderBuffer overrun");const n=new Ki(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+e,this.offset+=e,n};Ki.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)};function Ph(t,e){if(Array.isArray(t))this.length=0,this.value=t.map(function(r){return Ph.isEncoderBuffer(r)||(r=new Ph(r,e)),this.length+=r.length,r},this);else if(typeof t=="number"){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if(typeof t=="string")this.value=t,this.length=Th.byteLength(t);else if(Th.isBuffer(t))this.value=t,this.length=t.length;else return e.error("Unsupported type: "+typeof t)}Wu.EncoderBuffer=Ph;Ph.isEncoderBuffer=function(e){return e instanceof Ph?!0:typeof e=="object"&&e.constructor.name==="EncoderBuffer"&&typeof e.length=="number"&&typeof e.join=="function"};Ph.prototype.join=function(e,r){return e||(e=Th.alloc(this.length)),r||(r=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(n){n.join(e,r),r+=n.length}):(typeof this.value=="number"?e[r]=this.value:typeof this.value=="string"?e.write(this.value,r):Th.isBuffer(this.value)&&this.value.copy(e,r),r+=this.length)),e};var jc=dI;function dI(t,e){if(!t)throw new Error(e||"Assertion failed")}dI.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};const tZ=Lv.Reporter,rZ=Wu.EncoderBuffer,nZ=Wu.DecoderBuffer,Cn=jc,pI=["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"],iZ=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(pI),sZ=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function kt(t,e,r){const n={};this._baseState=n,n.name=r,n.enc=t,n.parent=e||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}var d8=kt;const aZ=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];kt.prototype.clone=function(){const e=this._baseState,r={};aZ.forEach(function(i){r[i]=e[i]});const n=new this.constructor(r.parent);return n._baseState=r,n};kt.prototype._wrap=function(){const e=this._baseState;iZ.forEach(function(r){this[r]=function(){const i=new this.constructor(this);return e.children.push(i),i[r].apply(i,arguments)}},this)};kt.prototype._init=function(e){const r=this._baseState;Cn(r.parent===null),e.call(this),r.children=r.children.filter(function(n){return n._baseState.parent===this},this),Cn.equal(r.children.length,1,"Root node can have only one child")};kt.prototype._useArgs=function(e){const r=this._baseState,n=e.filter(function(i){return i instanceof this.constructor},this);e=e.filter(function(i){return!(i instanceof this.constructor)},this),n.length!==0&&(Cn(r.children===null),r.children=n,n.forEach(function(i){i._baseState.parent=this},this)),e.length!==0&&(Cn(r.args===null),r.args=e,r.reverseArgs=e.map(function(i){if(typeof i!="object"||i.constructor!==Object)return i;const s={};return Object.keys(i).forEach(function(a){a==(a|0)&&(a|=0);const o=i[a];s[o]=a}),s}))};sZ.forEach(function(t){kt.prototype[t]=function(){const r=this._baseState;throw new Error(t+" not implemented for encoding: "+r.enc)}});pI.forEach(function(t){kt.prototype[t]=function(){const r=this._baseState,n=Array.prototype.slice.call(arguments);return Cn(r.tag===null),r.tag=t,this._useArgs(n),this}});kt.prototype.use=function(e){Cn(e);const r=this._baseState;return Cn(r.use===null),r.use=e,this};kt.prototype.optional=function(){const e=this._baseState;return e.optional=!0,this};kt.prototype.def=function(e){const r=this._baseState;return Cn(r.default===null),r.default=e,r.optional=!0,this};kt.prototype.explicit=function(e){const r=this._baseState;return Cn(r.explicit===null&&r.implicit===null),r.explicit=e,this};kt.prototype.implicit=function(e){const r=this._baseState;return Cn(r.explicit===null&&r.implicit===null),r.implicit=e,this};kt.prototype.obj=function(){const e=this._baseState,r=Array.prototype.slice.call(arguments);return e.obj=!0,r.length!==0&&this._useArgs(r),this};kt.prototype.key=function(e){const r=this._baseState;return Cn(r.key===null),r.key=e,this};kt.prototype.any=function(){const e=this._baseState;return e.any=!0,this};kt.prototype.choice=function(e){const r=this._baseState;return Cn(r.choice===null),r.choice=e,this._useArgs(Object.keys(e).map(function(n){return e[n]})),this};kt.prototype.contains=function(e){const r=this._baseState;return Cn(r.use===null),r.contains=e,this};kt.prototype._decode=function(e,r){const n=this._baseState;if(n.parent===null)return e.wrapResult(n.children[0]._decode(e,r));let i=n.default,s=!0,a=null;if(n.key!==null&&(a=e.enterKey(n.key)),n.optional){let c=null;if(n.explicit!==null?c=n.explicit:n.implicit!==null?c=n.implicit:n.tag!==null&&(c=n.tag),c===null&&!n.any){const u=e.save();try{n.choice===null?this._decodeGeneric(n.tag,e,r):this._decodeChoice(e,r),s=!0}catch{s=!1}e.restore(u)}else if(s=this._peekTag(e,c,n.any),e.isError(s))return s}let o;if(n.obj&&s&&(o=e.enterObject()),s){if(n.explicit!==null){const u=this._decodeTag(e,n.explicit);if(e.isError(u))return u;e=u}const c=e.offset;if(n.use===null&&n.choice===null){let u;n.any&&(u=e.save());const l=this._decodeTag(e,n.implicit!==null?n.implicit:n.tag,n.any);if(e.isError(l))return l;n.any?i=e.raw(u):e=l}if(r&&r.track&&n.tag!==null&&r.track(e.path(),c,e.length,"tagged"),r&&r.track&&n.tag!==null&&r.track(e.path(),e.offset,e.length,"content"),n.any||(n.choice===null?i=this._decodeGeneric(n.tag,e,r):i=this._decodeChoice(e,r)),e.isError(i))return i;if(!n.any&&n.choice===null&&n.children!==null&&n.children.forEach(function(l){l._decode(e,r)}),n.contains&&(n.tag==="octstr"||n.tag==="bitstr")){const u=new nZ(i);i=this._getUse(n.contains,e._reporterState.obj)._decode(u,r)}}return n.obj&&s&&(i=e.leaveObject(o)),n.key!==null&&(i!==null||s===!0)?e.leaveKey(a,n.key,i):a!==null&&e.exitKey(a),i};kt.prototype._decodeGeneric=function(e,r,n){const i=this._baseState;return e==="seq"||e==="set"?null:e==="seqof"||e==="setof"?this._decodeList(r,e,i.args[0],n):/str$/.test(e)?this._decodeStr(r,e,n):e==="objid"&&i.args?this._decodeObjid(r,i.args[0],i.args[1],n):e==="objid"?this._decodeObjid(r,null,null,n):e==="gentime"||e==="utctime"?this._decodeTime(r,e,n):e==="null_"?this._decodeNull(r,n):e==="bool"?this._decodeBool(r,n):e==="objDesc"?this._decodeStr(r,e,n):e==="int"||e==="enum"?this._decodeInt(r,i.args&&i.args[0],n):i.use!==null?this._getUse(i.use,r._reporterState.obj)._decode(r,n):r.error("unknown tag: "+e)};kt.prototype._getUse=function(e,r){const n=this._baseState;return n.useDecoder=this._use(e,r),Cn(n.useDecoder._baseState.parent===null),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder};kt.prototype._decodeChoice=function(e,r){const n=this._baseState;let i=null,s=!1;return Object.keys(n.choice).some(function(a){const o=e.save(),c=n.choice[a];try{const u=c._decode(e,r);if(e.isError(u))return!1;i={type:a,value:u},s=!0}catch{return e.restore(o),!1}return!0},this),s?i:e.error("Choice not matched")};kt.prototype._createEncoderBuffer=function(e){return new rZ(e,this.reporter)};kt.prototype._encode=function(e,r,n){const i=this._baseState;if(i.default!==null&&i.default===e)return;const s=this._encodeValue(e,r,n);if(s!==void 0&&!this._skipDefault(s,r,n))return s};kt.prototype._encodeValue=function(e,r,n){const i=this._baseState;if(i.parent===null)return i.children[0]._encode(e,r||new tZ);let s=null;if(this.reporter=r,i.optional&&e===void 0)if(i.default!==null)e=i.default;else return;let a=null,o=!1;if(i.any)s=this._createEncoderBuffer(e);else if(i.choice)s=this._encodeChoice(e,r);else if(i.contains)a=this._getUse(i.contains,n)._encode(e,r),o=!0;else if(i.children)a=i.children.map(function(c){if(c._baseState.tag==="null_")return c._encode(null,r,e);if(c._baseState.key===null)return r.error("Child should have a key");const u=r.enterKey(c._baseState.key);if(typeof e!="object")return r.error("Child expected, but input is not object");const l=c._encode(e[c._baseState.key],r,e);return r.leaveKey(u),l},this).filter(function(c){return c}),a=this._createEncoderBuffer(a);else if(i.tag==="seqof"||i.tag==="setof"){if(!(i.args&&i.args.length===1))return r.error("Too many args for : "+i.tag);if(!Array.isArray(e))return r.error("seqof/setof, but data is not Array");const c=this.clone();c._baseState.implicit=null,a=this._createEncoderBuffer(e.map(function(u){const l=this._baseState;return this._getUse(l.args[0],e)._encode(u,r)},c))}else i.use!==null?s=this._getUse(i.use,n)._encode(e,r):(a=this._encodePrimitive(i.tag,e),o=!0);if(!i.any&&i.choice===null){const c=i.implicit!==null?i.implicit:i.tag,u=i.implicit===null?"universal":"context";c===null?i.use===null&&r.error("Tag could be omitted only for .use()"):i.use===null&&(s=this._encodeComposite(c,o,u,a))}return i.explicit!==null&&(s=this._encodeComposite(i.explicit,!1,"context",s)),s};kt.prototype._encodeChoice=function(e,r){const n=this._baseState,i=n.choice[e.type];return i||Cn(!1,e.type+" not found in "+JSON.stringify(Object.keys(n.choice))),i._encode(e.value,r)};kt.prototype._encodePrimitive=function(e,r){const n=this._baseState;if(/str$/.test(e))return this._encodeStr(r,e);if(e==="objid"&&n.args)return this._encodeObjid(r,n.reverseArgs[0],n.args[1]);if(e==="objid")return this._encodeObjid(r,null,null);if(e==="gentime"||e==="utctime")return this._encodeTime(r,e);if(e==="null_")return this._encodeNull();if(e==="int"||e==="enum")return this._encodeInt(r,n.args&&n.reverseArgs[0]);if(e==="bool")return this._encodeBool(r);if(e==="objDesc")return this._encodeStr(r,e);throw new Error("Unsupported tag: "+e)};kt.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)};kt.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)};var Uv={};(function(t){function e(r){const n={};return Object.keys(r).forEach(function(i){(i|0)==i&&(i=i|0);const s=r[i];n[s]=i}),n}t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=e(t.tagClass),t.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"},t.tagByName=e(t.tag)})(Uv);const oZ=Ns,qa=h8.Buffer,gI=d8,j2=Uv;function mI(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new Os,this.tree._init(t.body)}var vI=mI;mI.prototype.encode=function(e,r){return this.tree._encode(e,r).join()};function Os(t){gI.call(this,"der",t)}oZ(Os,gI);Os.prototype._encodeComposite=function(e,r,n,i){const s=cZ(e,r,n,this.reporter);if(i.length<128){const c=qa.alloc(2);return c[0]=s,c[1]=i.length,this._createEncoderBuffer([c,i])}let a=1;for(let c=i.length;c>=256;c>>=8)a++;const o=qa.alloc(2+a);o[0]=s,o[1]=128|a;for(let c=1+a,u=i.length;u>0;c--,u>>=8)o[c]=u&255;return this._createEncoderBuffer([o,i])};Os.prototype._encodeStr=function(e,r){if(r==="bitstr")return this._createEncoderBuffer([e.unused|0,e.data]);if(r==="bmpstr"){const n=qa.alloc(e.length*2);for(let i=0;i=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,e[0]*40+e[1])}let i=0;for(let o=0;o=128;c>>=7)i++}const s=qa.alloc(i);let a=s.length-1;for(let o=e.length-1;o>=0;o--){let c=e[o];for(s[a--]=c&127;(c>>=7)>0;)s[a--]=128|c&127}return this._createEncoderBuffer(s)};function mi(t){return t<10?"0"+t:t}Os.prototype._encodeTime=function(e,r){let n;const i=new Date(e);return r==="gentime"?n=[mi(i.getUTCFullYear()),mi(i.getUTCMonth()+1),mi(i.getUTCDate()),mi(i.getUTCHours()),mi(i.getUTCMinutes()),mi(i.getUTCSeconds()),"Z"].join(""):r==="utctime"?n=[mi(i.getUTCFullYear()%100),mi(i.getUTCMonth()+1),mi(i.getUTCDate()),mi(i.getUTCHours()),mi(i.getUTCMinutes()),mi(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+r+" time is not supported yet"),this._encodeStr(n,"octstr")};Os.prototype._encodeNull=function(){return this._createEncoderBuffer("")};Os.prototype._encodeInt=function(e,r){if(typeof e=="string"){if(!r)return this.reporter.error("String int or enum given, but no values map");if(!r.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=r[e]}if(typeof e!="number"&&!qa.isBuffer(e)){const s=e.toArray();!e.sign&&s[0]&128&&s.unshift(0),e=qa.from(s)}if(qa.isBuffer(e)){let s=e.length;e.length===0&&s++;const a=qa.alloc(s);return e.copy(a),e.length===0&&(a[0]=0),this._createEncoderBuffer(a)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let n=1;for(let s=e;s>=256;s>>=8)n++;const i=new Array(n);for(let s=i.length-1;s>=0;s--)i[s]=e&255,e>>=8;return i[0]&128&&i.unshift(0),this._createEncoderBuffer(qa.from(i))};Os.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)};Os.prototype._use=function(e,r){return typeof e=="function"&&(e=e(r)),e._getEncoder("der").tree};Os.prototype._skipDefault=function(e,r,n){const i=this._baseState;let s;if(i.default===null)return!1;const a=e.join();if(i.defaultBuffer===void 0&&(i.defaultBuffer=this._encodeValue(i.default,r,n).join()),a.length!==i.defaultBuffer.length)return!1;for(s=0;s=31?n.error("Multi-octet tag encoding unsupported"):(e||(i|=32),i|=j2.tagClassByName[r||"universal"]<<6,i)}const uZ=Ns,p8=vI;function g8(t){p8.call(this,t),this.enc="pem"}uZ(g8,p8);var lZ=g8;g8.prototype.encode=function(e,r){const i=p8.prototype.encode.call(this,e).toString("base64"),s=["-----BEGIN "+r.label+"-----"];for(let a=0;a>6],i=(r&32)===0;if((r&31)===31){let a=r;for(r=0;(a&128)===128;){if(a=t.readUInt8(e),t.isError(a))return a;r<<=7,r|=a&127}}else r&=31;const s=iA.tag[r];return{cls:n,primitive:i,tag:r,tagStr:s}}function wI(t,e,r){let n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&n===128)return null;if(!(n&128))return n;const i=n&127;if(i>4)return t.error("length octect is too long");n=0;for(let s=0;s */(function(t,e){var r=l8,n=r.Buffer;function i(a,o){for(var c in a)o[c]=a[c]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=s);function s(a,o,c){return n(a,o,c)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(a,o,c){if(typeof a=="number")throw new TypeError("Argument must not be a number");return n(a,o,c)},s.alloc=function(a,o,c){if(typeof a!="number")throw new TypeError("Argument must be a number");var u=n(a);return o!==void 0?typeof c=="string"?u.fill(o,c):u.fill(o):u.fill(0),u},s.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return n(a)},s.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(a)}})(Ow,Ow.exports);var SI=Ow.exports,CI={};const mZ="elliptic",vZ="6.5.4",yZ="EC cryptography",xZ="lib/elliptic.js",bZ=["lib"],wZ={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},EZ={type:"git",url:"git@github.com:indutny/elliptic"},AZ=["EC","Elliptic","curve","Cryptography"],SZ="Fedor Indutny ",CZ="MIT",_Z={url:"https://github.com/indutny/elliptic/issues"},kZ="https://github.com/indutny/elliptic",BZ={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},IZ={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},FZ={name:mZ,version:vZ,description:yZ,main:xZ,files:bZ,scripts:wZ,repository:EZ,keywords:AZ,author:SZ,license:CZ,bugs:_Z,homepage:kZ,devDependencies:BZ,dependencies:IZ};var pi={},b8={};(function(t){var e=t;function r(s,a){if(Array.isArray(s))return s.slice();if(!s)return[];var o=[];if(typeof s!="string"){for(var c=0;c>8,h=u&255;l?o.push(l,h):o.push(h)}return o}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var a="",o=0;o(d>>1)-1?x=(d>>1)-b:x=b,g.isubn(x)):x=0,p[y]=x,g.iushrn(1)}return p}e.getNAF=s;function a(l,h){var f=[[],[]];l=l.clone(),h=h.clone();for(var p=0,d=0,g;l.cmpn(-p)>0||h.cmpn(-d)>0;){var y=l.andln(3)+p&3,x=h.andln(3)+d&3;y===3&&(y=-1),x===3&&(x=-1);var b;y&1?(g=l.andln(7)+p&7,(g===3||g===5)&&x===2?b=-y:b=y):b=0,f[0].push(b);var S;x&1?(g=h.andln(7)+d&7,(g===3||g===5)&&y===2?S=-x:S=x):S=0,f[1].push(S),2*p===b+1&&(p=1-p),2*d===S+1&&(d=1-d),l.iushrn(1),h.iushrn(1)}return f}e.getJSF=a;function o(l,h,f){var p="_"+h;l.prototype[h]=function(){return this[p]!==void 0?this[p]:this[p]=f.call(this)}}e.cachedProperty=o;function c(l){return typeof l=="string"?e.toArray(l,"hex"):l}e.parseBytes=c;function u(l){return new r(l,"hex","le")}e.intFromLE=u})(pi);var w8={exports:{}},U2;w8.exports=function(e){return U2||(U2=new lc(null)),U2.generate(e)};function lc(t){this.rand=t}w8.exports.Rand=lc;lc.prototype.generate=function(e){return this._rand(e)};lc.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var $v=Uc;Uc.prototype.point=function(){throw new Error("Not implemented")};Uc.prototype.validate=function(){throw new Error("Not implemented")};Uc.prototype._fixedNafMul=function(e,r){Cm(e.precomputed);var n=e._getDoubles(),i=Sm(r,1,this._bitLength),s=(1<=o;u--)c=(c<<1)+i[u];a.push(c)}for(var l=this.jpoint(null,null,null),h=this.jpoint(null,null,null),f=s;f>0;f--){for(o=0;o=0;c--){for(var u=0;c>=0&&a[c]===0;c--)u++;if(c>=0&&u++,o=o.dblp(u),c<0)break;var l=a[c];Cm(l!==0),e.type==="affine"?l>0?o=o.mixedAdd(s[l-1>>1]):o=o.mixedAdd(s[-l-1>>1].neg()):l>0?o=o.add(s[l-1>>1]):o=o.add(s[-l-1>>1].neg())}return e.type==="affine"?o.toP():o};Uc.prototype._wnafMulAdd=function(e,r,n,i,s){var a=this._wnafT1,o=this._wnafT2,c=this._wnafT3,u=0,l,h,f;for(l=0;l=1;l-=2){var d=l-1,g=l;if(a[d]!==1||a[g]!==1){c[d]=Sm(n[d],a[d],this._bitLength),c[g]=Sm(n[g],a[g],this._bitLength),u=Math.max(c[d].length,u),u=Math.max(c[g].length,u);continue}var y=[r[d],null,null,r[g]];r[d].y.cmp(r[g].y)===0?(y[1]=r[d].add(r[g]),y[2]=r[d].toJ().mixedAdd(r[g].neg())):r[d].y.cmp(r[g].y.redNeg())===0?(y[1]=r[d].toJ().mixedAdd(r[g]),y[2]=r[d].add(r[g].neg())):(y[1]=r[d].toJ().mixedAdd(r[g]),y[2]=r[d].toJ().mixedAdd(r[g].neg()));var x=[-3,-1,-5,-7,0,7,5,1,3],b=TZ(n[d],n[g]);for(u=Math.max(b[0].length,u),c[d]=new Array(u),c[g]=new Array(u),h=0;h=0;l--){for(var B=0;l>=0;){var N=!0;for(h=0;h=0&&B++,T=T.dblp(B),l<0)break;for(h=0;h0?f=o[h][P-1>>1]:P<0&&(f=o[h][-P-1>>1].neg()),f.type==="affine"?T=T.mixedAdd(f):T=T.add(f))}}for(l=0;l=Math.ceil((e.bitLength()+1)/r.step):!1};Zi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(p=u,d=l),h.negative&&(h=h.neg(),f=f.neg()),p.negative&&(p=p.neg(),d=d.neg()),[{a:h,b:f},{a:p,b:d}]};Ji.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),a=n.b.neg().mul(e).divRound(this.n),o=s.mul(n.a),c=a.mul(i.a),u=s.mul(n.b),l=a.mul(i.b),h=e.sub(o).sub(c),f=u.add(l).neg();return{k1:h,k2:f}};Ji.prototype.pointFromX=function(e,r){e=new or(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)};Ji.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0};Ji.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,a=0;a":""};$r.prototype.isInfinity=function(){return this.inf};$r.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};$r.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),a=s.redSqr().redISub(this.x.redAdd(this.x)),o=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,o)};$r.prototype.getX=function(){return this.x.fromRed()};$r.prototype.getY=function(){return this.y.fromRed()};$r.prototype.mul=function(e){return e=new or(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};$r.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};$r.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};$r.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};$r.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};$r.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Xr(t,e,r,n){n0.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new or(0)):(this.x=new or(e,16),this.y=new or(r,16),this.z=new or(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}A8(Xr,n0.BasePoint);Ji.prototype.jpoint=function(e,r,n){return new Xr(this,e,r,n)};Xr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};Xr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Xr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),a=this.y.redMul(r.redMul(e.z)),o=e.y.redMul(n.redMul(this.z)),c=i.redSub(s),u=a.redSub(o);if(c.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=c.redSqr(),h=l.redMul(c),f=i.redMul(l),p=u.redSqr().redIAdd(h).redISub(f).redISub(f),d=u.redMul(f.redISub(p)).redISub(a.redMul(h)),g=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(p,d,g)};Xr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,a=e.y.redMul(r).redMul(this.z),o=n.redSub(i),c=s.redSub(a);if(o.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=o.redSqr(),l=u.redMul(o),h=n.redMul(u),f=c.redSqr().redIAdd(l).redISub(h).redISub(h),p=c.redMul(h.redISub(f)).redISub(s.redMul(l)),d=this.z.redMul(o);return this.curve.jpoint(f,p,d)};Xr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}};Xr.prototype.inspect=function(){return this.isInfinity()?"":""};Xr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Gl=Ps,kI=Ns,Hv=$v,DZ=pi;function i0(t){Hv.call(this,"mont",t),this.a=new Gl(t.a,16).toRed(this.red),this.b=new Gl(t.b,16).toRed(this.red),this.i4=new Gl(4).toRed(this.red).redInvm(),this.two=new Gl(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}kI(i0,Hv);var RZ=i0;i0.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function jr(t,e,r){Hv.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Gl(e,16),this.z=new Gl(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}kI(jr,Hv.BasePoint);i0.prototype.decodePoint=function(e,r){return this.point(DZ.toArray(e,r),1)};i0.prototype.point=function(e,r){return new jr(this,e,r)};i0.prototype.pointFromJSON=function(e){return jr.fromJSON(this,e)};jr.prototype.precompute=function(){};jr.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};jr.fromJSON=function(e,r){return new jr(e,r[0],r[1]||e.one)};jr.prototype.inspect=function(){return this.isInfinity()?"":""};jr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};jr.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),a=r.redMul(i),o=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(a,o)};jr.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};jr.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),a=e.x.redSub(e.z),o=a.redMul(n),c=s.redMul(i),u=r.z.redMul(o.redAdd(c).redSqr()),l=r.x.redMul(o.redISub(c).redSqr());return this.curve.point(u,l)};jr.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,a=[];r.cmpn(0)!==0;r.iushrn(1))a.push(r.andln(1));for(var o=a.length-1;o>=0;o--)a[o]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i};jr.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};jr.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};jr.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};jr.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};jr.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var MZ=pi,Xa=Ps,BI=Ns,zv=$v,LZ=MZ.assert;function xa(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,zv.call(this,"edwards",t),this.a=new Xa(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Xa(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Xa(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),LZ(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}BI(xa,zv);var jZ=xa;xa.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};xa.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};xa.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)};xa.prototype.pointFromX=function(e,r){e=new Xa(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),a=i.redMul(s.redInvm()),o=a.redSqrt();if(o.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");var c=o.fromRed().isOdd();return(r&&!c||!r&&c)&&(o=o.redNeg()),this.point(e,o)};xa.prototype.pointFromY=function(e,r){e=new Xa(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),a=i.redMul(s.redInvm());if(a.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var o=a.redSqrt();if(o.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");return o.fromRed().isOdd()!==r&&(o=o.redNeg()),this.point(o,e)};xa.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function Nt(t,e,r,n,i){zv.BasePoint.call(this,t,"projective"),e===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 Xa(e,16),this.y=new Xa(r,16),this.z=n?new Xa(n,16):this.curve.one,this.t=i&&new Xa(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.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()))))}BI(Nt,zv.BasePoint);xa.prototype.pointFromJSON=function(e){return Nt.fromJSON(this,e)};xa.prototype.point=function(e,r,n,i){return new Nt(this,e,r,n,i)};Nt.fromJSON=function(e,r){return new Nt(e,r[0],r[1],r[2])};Nt.prototype.inspect=function(){return this.isInfinity()?"":""};Nt.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Nt.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),a=i.redAdd(r),o=a.redSub(n),c=i.redSub(r),u=s.redMul(o),l=a.redMul(c),h=s.redMul(c),f=o.redMul(a);return this.curve.point(u,l,f,h)};Nt.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,a,o,c,u;if(this.curve.twisted){o=this.curve._mulA(r);var l=o.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(l.redSub(this.curve.two)),s=l.redMul(o.redSub(n)),a=l.redSqr().redSub(l).redSub(l)):(c=this.z.redSqr(),u=l.redSub(c).redISub(c),i=e.redSub(r).redISub(n).redMul(u),s=l.redMul(o.redSub(n)),a=l.redMul(u))}else o=r.redAdd(n),c=this.curve._mulC(this.z).redSqr(),u=o.redSub(c).redSub(c),i=this.curve._mulC(e.redISub(o)).redMul(u),s=this.curve._mulC(o).redMul(r.redISub(n)),a=o.redMul(u);return this.curve.point(i,s,a)};Nt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Nt.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),a=n.redSub(r),o=s.redSub(i),c=s.redAdd(i),u=n.redAdd(r),l=a.redMul(o),h=c.redMul(u),f=a.redMul(u),p=o.redMul(c);return this.curve.point(l,h,p,f)};Nt.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(i).redMul(s),o=n.redSub(a),c=n.redAdd(a),u=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),l=r.redMul(o).redMul(u),h,f;return this.curve.twisted?(h=r.redMul(c).redMul(s.redSub(this.curve._mulA(i))),f=o.redMul(c)):(h=r.redMul(c).redMul(s.redSub(i)),f=this.curve._mulC(o).redMul(c)),this.curve.point(l,h,f)};Nt.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};Nt.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};Nt.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)};Nt.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)};Nt.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this};Nt.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Nt.prototype.getX=function(){return this.normalize(),this.x.fromRed()};Nt.prototype.getY=function(){return this.normalize(),this.y.fromRed()};Nt.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};Nt.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}};Nt.prototype.toP=Nt.prototype.normalize;Nt.prototype.mixedAdd=Nt.prototype.add;(function(t){var e=t;e.base=$v,e.short=OZ,e.mont=RZ,e.edwards=jZ})(E8);var Vv={},qv={},lt={},UZ=jc,$Z=Ns;lt.inherits=$Z;function HZ(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function zZ(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):HZ(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}lt.htonl=II;function qZ(t,e){for(var r="",n=0;n>>0}return s}lt.join32=KZ;function WZ(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}lt.split32=WZ;function GZ(t,e){return t>>>e|t<<32-e}lt.rotr32=GZ;function ZZ(t,e){return t<>>32-e}lt.rotl32=ZZ;function JZ(t,e){return t+e>>>0}lt.sum32=JZ;function XZ(t,e,r){return t+e+r>>>0}lt.sum32_3=XZ;function QZ(t,e,r,n){return t+e+r+n>>>0}lt.sum32_4=QZ;function YZ(t,e,r,n,i){return t+e+r+n+i>>>0}lt.sum32_5=YZ;function eJ(t,e,r,n){var i=t[e],s=t[e+1],a=n+s>>>0,o=(a>>0,t[e+1]=a}lt.sum64=eJ;function tJ(t,e,r,n){var i=e+n>>>0,s=(i>>0}lt.sum64_hi=tJ;function rJ(t,e,r,n){var i=e+n;return i>>>0}lt.sum64_lo=rJ;function nJ(t,e,r,n,i,s,a,o){var c=0,u=e;u=u+n>>>0,c+=u>>0,c+=u>>0,c+=u>>0}lt.sum64_4_hi=nJ;function iJ(t,e,r,n,i,s,a,o){var c=e+n+s+o;return c>>>0}lt.sum64_4_lo=iJ;function sJ(t,e,r,n,i,s,a,o,c,u){var l=0,h=e;h=h+n>>>0,l+=h>>0,l+=h>>0,l+=h>>0,l+=h>>0}lt.sum64_5_hi=sJ;function aJ(t,e,r,n,i,s,a,o,c,u){var l=e+n+s+o+u;return l>>>0}lt.sum64_5_lo=aJ;function oJ(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}lt.rotr64_hi=oJ;function cJ(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}lt.rotr64_lo=cJ;function uJ(t,e,r){return t>>>r}lt.shr64_hi=uJ;function lJ(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}lt.shr64_lo=lJ;var s0={},aA=lt,fJ=jc;function Kv(){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}s0.BlockHash=Kv;Kv.prototype.update=function(e,r){if(e=aA.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=aA.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,a=8;a>>3}ba.g0_256=mJ;function vJ(t){return oa(t,17)^oa(t,19)^t>>>10}ba.g1_256=vJ;var Nh=lt,yJ=s0,xJ=ba,$2=Nh.rotl32,_0=Nh.sum32,bJ=Nh.sum32_5,wJ=xJ.ft_1,DI=yJ.BlockHash,EJ=[1518500249,1859775393,2400959708,3395469782];function ga(){if(!(this instanceof ga))return new ga;DI.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Nh.inherits(ga,DI);var AJ=ga;ga.blockSize=512;ga.outSize=160;ga.hmacStrength=80;ga.padLength=64;ga.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),lX(e.length<=this.blockSize);for(var r=e.length;r=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var pX=Fc;Fc.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};Fc.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Nu.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var _m=Ps,S8=pi,yX=S8.assert;function Wv(t,e){if(t instanceof Wv)return t;this._importDER(t,e)||(yX(t.r&&t.s,"Signature without r or s"),this.r=new _m(t.r,16),this.s=new _m(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var xX=Wv;function bX(){this.place=0}function q2(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,a=e.place;s>>=0;return i<=127?!1:(e.place=a,i)}function fA(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Wv.prototype.toDER=function(e){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=fA(r),n=fA(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];K2(i,r.length),i=i.concat(r),i.push(2),K2(i,n.length);var s=i.concat(n),a=[48];return K2(a,s.length),a=a.concat(s),S8.encode(a,e)};var Ou=Ps,WI=pX,wX=pi,W2=Vv,EX=_I,GI=wX.assert,C8=vX,Gv=xX;function Wi(t){if(!(this instanceof Wi))return new Wi(t);typeof t=="string"&&(GI(Object.prototype.hasOwnProperty.call(W2,t),"Unknown curve "+t),t=W2[t]),t instanceof W2.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var AX=Wi;Wi.prototype.keyPair=function(e){return new C8(this,e)};Wi.prototype.keyFromPrivate=function(e,r){return C8.fromPrivate(this,e,r)};Wi.prototype.keyFromPublic=function(e,r){return C8.fromPublic(this,e,r)};Wi.prototype.genKeyPair=function(e){e||(e={});for(var r=new WI({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||EX(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new Ou(2));;){var s=new Ou(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};Wi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};Wi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new Ou(e,16));for(var s=this.n.byteLength(),a=r.getPrivate().toArray("be",s),o=e.toArray("be",s),c=new WI({hash:this.hash,entropy:a,nonce:o,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new Ou(1)),l=0;;l++){var h=i.k?i.k(l):new Ou(c.generate(this.n.byteLength()));if(h=this._truncateToN(h,!0),!(h.cmpn(1)<=0||h.cmp(u)>=0)){var f=this.g.mul(h);if(!f.isInfinity()){var p=f.getX(),d=p.umod(this.n);if(d.cmpn(0)!==0){var g=h.invm(this.n).mul(d.mul(r.getPrivate()).iadd(e));if(g=g.umod(this.n),g.cmpn(0)!==0){var y=(f.getY().isOdd()?1:0)|(p.cmp(d)!==0?2:0);return i.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),y^=1),new Gv({r:d,s:g,recoveryParam:y})}}}}}};Wi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new Ou(e,16)),n=this.keyFromPublic(n,i),r=new Gv(r,"hex");var s=r.r,a=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var o=a.invm(this.n),c=o.mul(e).umod(this.n),u=o.mul(s).umod(this.n),l;return this.curve._maxwellTrick?(l=this.g.jmulAdd(c,n.getPublic(),u),l.isInfinity()?!1:l.eqXToP(s)):(l=this.g.mulAdd(c,n.getPublic(),u),l.isInfinity()?!1:l.getX().umod(this.n).cmp(s)===0)};Wi.prototype.recoverPubKey=function(t,e,r,n){GI((3&r)===r,"The recovery param is more than two bits"),e=new Gv(e,n);var i=this.n,s=new Ou(t),a=e.r,o=e.s,c=r&1,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?a=this.curve.pointFromX(a.add(this.curve.n),c):a=this.curve.pointFromX(a,c);var l=e.r.invm(i),h=i.sub(s).mul(l).umod(i),f=o.mul(l).umod(i);return this.g.mulAdd(h,a,f)};Wi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Gv(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var zp=pi,ZI=zp.assert,hA=zp.parseBytes,c0=zp.cachedProperty;function Lr(t,e){this.eddsa=t,this._secret=hA(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=hA(e.pub)}Lr.fromPublic=function(e,r){return r instanceof Lr?r:new Lr(e,{pub:r})};Lr.fromSecret=function(e,r){return r instanceof Lr?r:new Lr(e,{secret:r})};Lr.prototype.secret=function(){return this._secret};c0(Lr,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});c0(Lr,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});c0(Lr,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i});c0(Lr,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});c0(Lr,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});c0(Lr,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});Lr.prototype.sign=function(e){return ZI(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};Lr.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)};Lr.prototype.getSecret=function(e){return ZI(this._secret,"KeyPair is public only"),zp.encode(this.secret(),e)};Lr.prototype.getPublic=function(e){return zp.encode(this.pubBytes(),e)};var SX=Lr,CX=Ps,Zv=pi,_X=Zv.assert,Jv=Zv.cachedProperty,kX=Zv.parseBytes;function ol(t,e){this.eddsa=t,typeof e!="object"&&(e=kX(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),_X(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof CX&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Jv(ol,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});Jv(ol,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});Jv(ol,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});Jv(ol,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});ol.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};ol.prototype.toHex=function(){return Zv.encode(this.toBytes(),"hex").toUpperCase()};var BX=ol,IX=qv,FX=Vv,Rh=pi,TX=Rh.assert,JI=Rh.parseBytes,XI=SX,dA=BX;function Hn(t){if(TX(t==="ed25519","only tested with ed25519 so far"),!(this instanceof Hn))return new Hn(t);t=FX[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=IX.sha512}var PX=Hn;Hn.prototype.sign=function(e,r){e=JI(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),a=this.encodePoint(s),o=this.hashInt(a,n.pubBytes(),e).mul(n.priv()),c=i.add(o).umod(this.curve.n);return this.makeSignature({R:s,S:c,Rencoded:a})};Hn.prototype.verify=function(e,r,n){e=JI(e),r=this.makeSignature(r);var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),a=this.g.mul(r.S()),o=r.R().add(i.pub().mul(s));return o.eq(a)};Hn.prototype.hashInt=function(){for(var e=this.hash(),r=0;r>>2]>>>24-x%4*8&255;p[g+x>>>2]|=b<<24-(g+x)%4*8}else for(var x=0;x>>2]=d[x>>>2];return this.sigBytes+=y,this},clamp:function(){var f=this.words,p=this.sigBytes;f[p>>>2]&=4294967295<<32-p%4*8,f.length=t.ceil(p/4)},clone:function(){var f=i.clone.call(this);return f.words=this.words.slice(0),f},random:function(f){for(var p=[],d=0;d>>2]>>>24-y%4*8&255;g.push((x>>>4).toString(16)),g.push((x&15).toString(16))}return g.join("")},parse:function(f){for(var p=f.length,d=[],g=0;g>>3]|=parseInt(f.substr(g,2),16)<<24-g%8*4;return new s.init(d,p/2)}},c=a.Latin1={stringify:function(f){for(var p=f.words,d=f.sigBytes,g=[],y=0;y>>2]>>>24-y%4*8&255;g.push(String.fromCharCode(x))}return g.join("")},parse:function(f){for(var p=f.length,d=[],g=0;g>>2]|=(f.charCodeAt(g)&255)<<24-g%4*8;return new s.init(d,p)}},u=a.Utf8={stringify:function(f){try{return decodeURIComponent(escape(c.stringify(f)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(f){return c.parse(unescape(encodeURIComponent(f)))}},l=n.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(f){typeof f=="string"&&(f=u.parse(f)),this._data.concat(f),this._nDataBytes+=f.sigBytes},_process:function(f){var p=this._data,d=p.words,g=p.sigBytes,y=this.blockSize,x=y*4,b=g/x;f?b=t.ceil(b):b=t.max((b|0)-this._minBufferSize,0);var S=b*y,k=t.min(S*4,g);if(S){for(var T=0;T>>2]&255}},e.BlockCipher=o.extend({cfg:o.cfg.extend({mode:h,padding:u}),reset:function(){o.reset.call(this);var y=this.cfg,g=y.iv,y=y.mode;if(this._xformMode==this._ENC_XFORM_MODE)var x=y.createEncryptor;else x=y.createDecryptor,this._minBufferSize=1;this._mode=x.call(y,this,g&&g.words)},_doProcessBlock:function(g,y){this._mode.processBlock(g,y)},_doFinalize:function(){var g=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){g.pad(this._data,this.blockSize);var y=this._process(!0)}else y=this._process(!0),g.unpad(y);return y},blockSize:4});var l=e.CipherParams=r.extend({init:function(g){this.mixIn(g)},toString:function(g){return(g||this.formatter).stringify(this)}}),h=(p.format={}).OpenSSL={stringify:function(g){var y=g.ciphertext;return g=g.salt,(g?n.create([1398893684,1701076831]).concat(g).concat(y):y).toString(s)},parse:function(g){g=s.parse(g);var y=g.words;if(y[0]==1398893684&&y[1]==1701076831){var x=n.create(y.slice(2,4));y.splice(0,4),g.sigBytes-=16}return l.create({ciphertext:g,salt:x})}},f=e.SerializableCipher=r.extend({cfg:r.extend({format:h}),encrypt:function(g,y,x,b){b=this.cfg.extend(b);var S=g.createEncryptor(x,b);return y=S.finalize(y),S=S.cfg,l.create({ciphertext:y,key:x,iv:S.iv,algorithm:g,mode:S.mode,padding:S.padding,blockSize:g.blockSize,formatter:b.format})},decrypt:function(g,y,x,b){return b=this.cfg.extend(b),y=this._parse(y,b.format),g.createDecryptor(x,b).finalize(y.ciphertext)},_parse:function(g,y){return typeof g=="string"?y.parse(g,this):g}}),p=(p.kdf={}).OpenSSL={execute:function(g,y,x,b){return b||(b=n.random(8)),g=a.create({keySize:y+x}).compute(g,b),x=n.create(g.words.slice(y),4*x),g.sigBytes=4*y,l.create({key:g,iv:x,salt:b})}},d=e.PasswordBasedCipher=f.extend({cfg:f.cfg.extend({kdf:p}),encrypt:function(g,y,x,b){return b=this.cfg.extend(b),x=b.kdf.execute(x,g.keySize,g.ivSize),b.iv=x.iv,g=f.encrypt.call(this,g,y,x.key,b),g.mixIn(x),g},decrypt:function(g,y,x,b){return b=this.cfg.extend(b),y=this._parse(y,b.format),x=b.kdf.execute(x,g.keySize,g.ivSize,y.salt),b.iv=x.iv,f.decrypt.call(this,g,y,x.key,b)}})}();(function(){for(var t=Re,e=t.lib.BlockCipher,_=t.algo,r=[],n=[],i=[],s=[],a=[],o=[],c=[],u=[],l=[],h=[],f=[],p=0;256>p;p++)f[p]=128>p?p<<1:p<<1^283;for(var d=0,g=0,p=0;256>p;p++){var y=g^g<<1^g<<2^g<<3^g<<4,y=y>>>8^y&255^99;r[d]=y,n[y]=d;var x=f[d],b=f[x],S=f[b],k=257*f[y]^16843008*y;i[d]=k<<24|k>>>8,s[d]=k<<16|k>>>16,a[d]=k<<8|k>>>24,o[d]=k,k=16843009*S^65537*b^257*x^16843008*d,c[y]=k<<24|k>>>8,u[y]=k<<16|k>>>16,l[y]=k<<8|k>>>24,h[y]=k,d?(d=x^f[f[f[S^x]]],g^=f[f[g]]):d=g=1}var T=[0,1,2,4,8,16,32,64,128,27,54],_=_.AES=e.extend({_doReset:function(){for(var P=this._key,B=P.words,N=P.sigBytes/4,P=4*((this._nRounds=N+6)+1),D=this._keySchedule=[],O=0;O>>24]<<24|r[E>>>16&255]<<16|r[E>>>8&255]<<8|r[E&255]):(E=E<<8|E>>>24,E=r[E>>>24]<<24|r[E>>>16&255]<<16|r[E>>>8&255]<<8|r[E&255],E^=T[O/N|0]<<24),D[O]=D[O-N]^E}for(B=this._invKeySchedule=[],N=0;NN||4>=O?E:c[r[E>>>24]]^u[r[E>>>16&255]]^l[r[E>>>8&255]]^h[r[E&255]]},encryptBlock:function(B,N){this._doCryptBlock(B,N,this._keySchedule,i,s,a,o,r)},decryptBlock:function(B,N){var P=B[N+1];B[N+1]=B[N+3],B[N+3]=P,this._doCryptBlock(B,N,this._invKeySchedule,c,u,l,h,n),P=B[N+1],B[N+1]=B[N+3],B[N+3]=P},_doCryptBlock:function(B,N,P,D,O,E,F,A){for(var I=this._nRounds,q=B[N]^P[0],ee=B[N+1]^P[1],X=B[N+2]^P[2],L=B[N+3]^P[3],j=4,H=1;H>>24]^O[ee>>>16&255]^E[X>>>8&255]^F[L&255]^P[j++],z=D[ee>>>24]^O[X>>>16&255]^E[L>>>8&255]^F[q&255]^P[j++],R=D[X>>>24]^O[L>>>16&255]^E[q>>>8&255]^F[ee&255]^P[j++],L=D[L>>>24]^O[q>>>16&255]^E[ee>>>8&255]^F[X&255]^P[j++],q=G,ee=z,X=R;G=(A[q>>>24]<<24|A[ee>>>16&255]<<16|A[X>>>8&255]<<8|A[L&255])^P[j++],z=(A[ee>>>24]<<24|A[X>>>16&255]<<16|A[L>>>8&255]<<8|A[q&255])^P[j++],R=(A[X>>>24]<<24|A[L>>>16&255]<<16|A[q>>>8&255]<<8|A[ee&255])^P[j++],L=(A[L>>>24]<<24|A[q>>>16&255]<<16|A[ee>>>8&255]<<8|A[X&255])^P[j++],B[N]=G,B[N+1]=z,B[N+2]=R,B[N+3]=L},keySize:8});t.AES=e._createHelper(_)})();(function(){function t(f,p){var d=(this._lBlock>>>f^this._rBlock)&p;this._rBlock^=d,this._lBlock^=d<>>f^this._lBlock)&p;this._lBlock^=d,this._rBlock^=d<d;d++){var g=a[d]-1;p[d]=f[g>>>5]>>>31-g%32&1}for(f=this._subKeys=[],g=0;16>g;g++){for(var y=f[g]=[],x=c[g],d=0;24>d;d++)y[d/6|0]|=p[(o[d]-1+x)%28]<<31-d%6,y[4+(d/6|0)]|=p[28+(o[d+24]-1+x)%28]<<31-d%6;for(y[0]=y[0]<<1|y[0]>>>31,d=1;7>d;d++)y[d]>>>=4*(d-1)+3;y[7]=y[7]<<5|y[7]>>>27}for(p=this._invSubKeys=[],d=0;16>d;d++)p[d]=f[15-d]},encryptBlock:function(f,p){this._doCryptBlock(f,p,this._subKeys)},decryptBlock:function(f,p){this._doCryptBlock(f,p,this._invSubKeys)},_doCryptBlock:function(f,p,d){this._lBlock=f[p],this._rBlock=f[p+1],t.call(this,4,252645135),t.call(this,16,65535),e.call(this,2,858993459),e.call(this,8,16711935),t.call(this,1,1431655765);for(var g=0;16>g;g++){for(var y=d[g],x=this._lBlock,b=this._rBlock,S=0,k=0;8>k;k++)S|=u[k][((b^y[k])&l[k])>>>0];this._lBlock=b,this._rBlock=x^S}d=this._lBlock,this._lBlock=this._rBlock,this._rBlock=d,t.call(this,1,1431655765),e.call(this,8,16711935),e.call(this,2,858993459),t.call(this,16,65535),t.call(this,4,252645135),f[p]=this._lBlock,f[p+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});r.DES=i._createHelper(h),s=s.TripleDES=i.extend({_doReset:function(){var f=this._key.words;this._des1=h.createEncryptor(n.create(f.slice(0,2))),this._des2=h.createEncryptor(n.create(f.slice(2,4))),this._des3=h.createEncryptor(n.create(f.slice(4,6)))},encryptBlock:function(f,p){this._des1.encryptBlock(f,p),this._des2.decryptBlock(f,p),this._des3.encryptBlock(f,p)},decryptBlock:function(f,p){this._des3.decryptBlock(f,p),this._des2.encryptBlock(f,p),this._des1.decryptBlock(f,p)},keySize:6,ivSize:2,blockSize:2}),r.TripleDES=i._createHelper(s)})();(function(){var t=Re,e=t.lib.WordArray;t.enc.Base64={stringify:function(r){var n=r.words,i=r.sigBytes,s=this._map;r.clamp(),r=[];for(var a=0;a>>2]>>>24-8*(a%4)&255)<<16|(n[a+1>>>2]>>>24-8*((a+1)%4)&255)<<8|n[a+2>>>2]>>>24-8*((a+2)%4)&255,c=0;4>c&&a+.75*c>>6*(3-c)&63));if(n=s.charAt(64))for(;r.length%4;)r.push(n);return r.join("")},parse:function(r){var n=r.length,i=this._map,s=i.charAt(64);s&&(s=r.indexOf(s),s!=-1&&(n=s));for(var s=[],a=0,o=0;o>>6-2*(o%4);s[a>>>2]|=(c|u)<<24-8*(a%4),a++}return e.create(s,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();(function(t){function e(h,f,p,d,g,y,x){return h=h+(f&p|~f&d)+g+x,(h<>>32-y)+f}function r(h,f,p,d,g,y,x){return h=h+(f&d|p&~d)+g+x,(h<>>32-y)+f}function n(h,f,p,d,g,y,x){return h=h+(f^p^d)+g+x,(h<>>32-y)+f}function i(h,f,p,d,g,y,x){return h=h+(p^(f|~d))+g+x,(h<>>32-y)+f}for(var s=Re,c=s.lib,a=c.WordArray,o=c.Hasher,c=s.algo,u=[],l=0;64>l;l++)u[l]=4294967296*t.abs(t.sin(l+1))|0;c=c.MD5=o.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(h,f){for(var p=0;16>p;p++){var d=f+p,g=h[d];h[d]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}var p=this._hash.words,d=h[f+0],g=h[f+1],y=h[f+2],x=h[f+3],b=h[f+4],S=h[f+5],k=h[f+6],T=h[f+7],_=h[f+8],B=h[f+9],N=h[f+10],P=h[f+11],D=h[f+12],O=h[f+13],E=h[f+14],F=h[f+15],A=p[0],H=p[1],j=p[2],I=p[3],A=e(A,H,j,I,d,7,u[0]),I=e(I,A,H,j,g,12,u[1]),j=e(j,I,A,H,y,17,u[2]),H=e(H,j,I,A,x,22,u[3]),A=e(A,H,j,I,b,7,u[4]),I=e(I,A,H,j,S,12,u[5]),j=e(j,I,A,H,k,17,u[6]),H=e(H,j,I,A,T,22,u[7]),A=e(A,H,j,I,_,7,u[8]),I=e(I,A,H,j,B,12,u[9]),j=e(j,I,A,H,N,17,u[10]),H=e(H,j,I,A,P,22,u[11]),A=e(A,H,j,I,D,7,u[12]),I=e(I,A,H,j,O,12,u[13]),j=e(j,I,A,H,E,17,u[14]),H=e(H,j,I,A,F,22,u[15]),A=r(A,H,j,I,g,5,u[16]),I=r(I,A,H,j,k,9,u[17]),j=r(j,I,A,H,P,14,u[18]),H=r(H,j,I,A,d,20,u[19]),A=r(A,H,j,I,S,5,u[20]),I=r(I,A,H,j,N,9,u[21]),j=r(j,I,A,H,F,14,u[22]),H=r(H,j,I,A,b,20,u[23]),A=r(A,H,j,I,B,5,u[24]),I=r(I,A,H,j,E,9,u[25]),j=r(j,I,A,H,x,14,u[26]),H=r(H,j,I,A,_,20,u[27]),A=r(A,H,j,I,O,5,u[28]),I=r(I,A,H,j,y,9,u[29]),j=r(j,I,A,H,T,14,u[30]),H=r(H,j,I,A,D,20,u[31]),A=n(A,H,j,I,S,4,u[32]),I=n(I,A,H,j,_,11,u[33]),j=n(j,I,A,H,P,16,u[34]),H=n(H,j,I,A,E,23,u[35]),A=n(A,H,j,I,g,4,u[36]),I=n(I,A,H,j,b,11,u[37]),j=n(j,I,A,H,T,16,u[38]),H=n(H,j,I,A,N,23,u[39]),A=n(A,H,j,I,O,4,u[40]),I=n(I,A,H,j,d,11,u[41]),j=n(j,I,A,H,x,16,u[42]),H=n(H,j,I,A,k,23,u[43]),A=n(A,H,j,I,B,4,u[44]),I=n(I,A,H,j,D,11,u[45]),j=n(j,I,A,H,F,16,u[46]),H=n(H,j,I,A,y,23,u[47]),A=i(A,H,j,I,d,6,u[48]),I=i(I,A,H,j,T,10,u[49]),j=i(j,I,A,H,E,15,u[50]),H=i(H,j,I,A,S,21,u[51]),A=i(A,H,j,I,D,6,u[52]),I=i(I,A,H,j,x,10,u[53]),j=i(j,I,A,H,N,15,u[54]),H=i(H,j,I,A,g,21,u[55]),A=i(A,H,j,I,_,6,u[56]),I=i(I,A,H,j,F,10,u[57]),j=i(j,I,A,H,k,15,u[58]),H=i(H,j,I,A,O,21,u[59]),A=i(A,H,j,I,b,6,u[60]),I=i(I,A,H,j,P,10,u[61]),j=i(j,I,A,H,y,15,u[62]),H=i(H,j,I,A,B,21,u[63]);p[0]=p[0]+A|0,p[1]=p[1]+H|0,p[2]=p[2]+j|0,p[3]=p[3]+I|0},_doFinalize:function(){var h=this._data,f=h.words,p=8*this._nDataBytes,d=8*h.sigBytes;f[d>>>5]|=128<<24-d%32;var g=t.floor(p/4294967296);for(f[(d+64>>>9<<4)+15]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,f[(d+64>>>9<<4)+14]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,h.sigBytes=4*(f.length+1),this._process(),h=this._hash,f=h.words,p=0;4>p;p++)d=f[p],f[p]=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360;return h},clone:function(){var h=o.clone.call(this);return h._hash=this._hash.clone(),h}}),s.MD5=o._createHelper(c),s.HmacMD5=o._createHmacHelper(c)})(Math);(function(){var t=Re,i=t.lib,e=i.WordArray,r=i.Hasher,n=[],i=t.algo.SHA1=r.extend({_doReset:function(){this._hash=new e.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(s,a){for(var o=this._hash.words,c=o[0],u=o[1],l=o[2],h=o[3],f=o[4],p=0;80>p;p++){if(16>p)n[p]=s[a+p]|0;else{var d=n[p-3]^n[p-8]^n[p-14]^n[p-16];n[p]=d<<1|d>>>31}d=(c<<5|c>>>27)+f+n[p],d=20>p?d+((u&l|~u&h)+1518500249):40>p?d+((u^l^h)+1859775393):60>p?d+((u&l|u&h|l&h)-1894007588):d+((u^l^h)-899497514),f=h,h=l,l=u<<30|u>>>2,u=c,c=d}o[0]=o[0]+c|0,o[1]=o[1]+u|0,o[2]=o[2]+l|0,o[3]=o[3]+h|0,o[4]=o[4]+f|0},_doFinalize:function(){var s=this._data,a=s.words,o=8*this._nDataBytes,c=8*s.sigBytes;return a[c>>>5]|=128<<24-c%32,a[(c+64>>>9<<4)+14]=Math.floor(o/4294967296),a[(c+64>>>9<<4)+15]=o,s.sigBytes=4*a.length,this._process(),this._hash},clone:function(){var s=r.clone.call(this);return s._hash=this._hash.clone(),s}});t.SHA1=r._createHelper(i),t.HmacSHA1=r._createHmacHelper(i)})();(function(t){for(var e=Re,p=e.lib,r=p.WordArray,n=p.Hasher,p=e.algo,i=[],s=[],a=function(g){return 4294967296*(g-(g|0))|0},o=2,c=0;64>c;){var u;e:{u=o;for(var l=t.sqrt(u),h=2;h<=l;h++)if(!(u%h)){u=!1;break e}u=!0}u&&(8>c&&(i[c]=a(t.pow(o,.5))),s[c]=a(t.pow(o,1/3)),c++),o++}var f=[],p=p.SHA256=n.extend({_doReset:function(){this._hash=new r.init(i.slice(0))},_doProcessBlock:function(d,g){for(var y=this._hash.words,x=y[0],b=y[1],S=y[2],k=y[3],T=y[4],_=y[5],B=y[6],N=y[7],P=0;64>P;P++){if(16>P)f[P]=d[g+P]|0;else{var D=f[P-15],O=f[P-2];f[P]=((D<<25|D>>>7)^(D<<14|D>>>18)^D>>>3)+f[P-7]+((O<<15|O>>>17)^(O<<13|O>>>19)^O>>>10)+f[P-16]}D=N+((T<<26|T>>>6)^(T<<21|T>>>11)^(T<<7|T>>>25))+(T&_^~T&B)+s[P]+f[P],O=((x<<30|x>>>2)^(x<<19|x>>>13)^(x<<10|x>>>22))+(x&b^x&S^b&S),N=B,B=_,_=T,T=k+D|0,k=S,S=b,b=x,x=D+O|0}y[0]=y[0]+x|0,y[1]=y[1]+b|0,y[2]=y[2]+S|0,y[3]=y[3]+k|0,y[4]=y[4]+T|0,y[5]=y[5]+_|0,y[6]=y[6]+B|0,y[7]=y[7]+N|0},_doFinalize:function(){var d=this._data,g=d.words,y=8*this._nDataBytes,x=8*d.sigBytes;return g[x>>>5]|=128<<24-x%32,g[(x+64>>>9<<4)+14]=t.floor(y/4294967296),g[(x+64>>>9<<4)+15]=y,d.sigBytes=4*g.length,this._process(),this._hash},clone:function(){var d=n.clone.call(this);return d._hash=this._hash.clone(),d}});e.SHA256=n._createHelper(p),e.HmacSHA256=n._createHmacHelper(p)})(Math);(function(){var t=Re,e=t.lib.WordArray,n=t.algo,r=n.SHA256,n=n.SHA224=r.extend({_doReset:function(){this._hash=new e.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var i=r._doFinalize.call(this);return i.sigBytes-=4,i}});t.SHA224=r._createHelper(n),t.HmacSHA224=r._createHmacHelper(n)})();(function(){function t(){return n.create.apply(n,arguments)}for(var e=Re,r=e.lib.Hasher,s=e.x64,n=s.Word,i=s.WordArray,s=e.algo,a=[t(1116352408,3609767458),t(1899447441,602891725),t(3049323471,3964484399),t(3921009573,2173295548),t(961987163,4081628472),t(1508970993,3053834265),t(2453635748,2937671579),t(2870763221,3664609560),t(3624381080,2734883394),t(310598401,1164996542),t(607225278,1323610764),t(1426881987,3590304994),t(1925078388,4068182383),t(2162078206,991336113),t(2614888103,633803317),t(3248222580,3479774868),t(3835390401,2666613458),t(4022224774,944711139),t(264347078,2341262773),t(604807628,2007800933),t(770255983,1495990901),t(1249150122,1856431235),t(1555081692,3175218132),t(1996064986,2198950837),t(2554220882,3999719339),t(2821834349,766784016),t(2952996808,2566594879),t(3210313671,3203337956),t(3336571891,1034457026),t(3584528711,2466948901),t(113926993,3758326383),t(338241895,168717936),t(666307205,1188179964),t(773529912,1546045734),t(1294757372,1522805485),t(1396182291,2643833823),t(1695183700,2343527390),t(1986661051,1014477480),t(2177026350,1206759142),t(2456956037,344077627),t(2730485921,1290863460),t(2820302411,3158454273),t(3259730800,3505952657),t(3345764771,106217008),t(3516065817,3606008344),t(3600352804,1432725776),t(4094571909,1467031594),t(275423344,851169720),t(430227734,3100823752),t(506948616,1363258195),t(659060556,3750685593),t(883997877,3785050280),t(958139571,3318307427),t(1322822218,3812723403),t(1537002063,2003034995),t(1747873779,3602036899),t(1955562222,1575990012),t(2024104815,1125592928),t(2227730452,2716904306),t(2361852424,442776044),t(2428436474,593698344),t(2756734187,3733110249),t(3204031479,2999351573),t(3329325298,3815920427),t(3391569614,3928383900),t(3515267271,566280711),t(3940187606,3454069534),t(4118630271,4000239992),t(116418474,1914138554),t(174292421,2731055270),t(289380356,3203993006),t(460393269,320620315),t(685471733,587496836),t(852142971,1086792851),t(1017036298,365543100),t(1126000580,2618297676),t(1288033470,3409855158),t(1501505948,4234509866),t(1607167915,987167468),t(1816402316,1246189591)],o=[],c=0;80>c;c++)o[c]=t();s=s.SHA512=r.extend({_doReset:function(){this._hash=new i.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(u,l){for(var b=this._hash.words,h=b[0],f=b[1],p=b[2],d=b[3],g=b[4],y=b[5],x=b[6],b=b[7],S=h.high,k=h.low,T=f.high,_=f.low,B=p.high,N=p.low,P=d.high,D=d.low,O=g.high,E=g.low,F=y.high,A=y.low,I=x.high,j=x.low,H=b.high,G=b.low,z=S,R=k,L=T,q=_,ee=B,X=N,oe=P,me=D,le=O,fe=E,ve=F,Ae=A,Me=I,Be=j,Pe=H,V=G,ue=0;80>ue;ue++){var m=o[ue];if(16>ue)var se=m.high=u[l+2*ue]|0,Fe=m.low=u[l+2*ue+1]|0;else{var se=o[ue-15],Fe=se.high,ge=se.low,se=(Fe>>>1|ge<<31)^(Fe>>>8|ge<<24)^Fe>>>7,ge=(ge>>>1|Fe<<31)^(ge>>>8|Fe<<24)^(ge>>>7|Fe<<25),de=o[ue-2],Fe=de.high,xe=de.low,de=(Fe>>>19|xe<<13)^(Fe<<3|xe>>>29)^Fe>>>6,xe=(xe>>>19|Fe<<13)^(xe<<3|Fe>>>29)^(xe>>>6|Fe<<26),Fe=o[ue-7],Y=Fe.high,J=o[ue-16],pe=J.high,J=J.low,Fe=ge+Fe.low,se=se+Y+(Fe>>>0>>0?1:0),Fe=Fe+xe,se=se+de+(Fe>>>0>>0?1:0),Fe=Fe+J,se=se+pe+(Fe>>>0>>0?1:0);m.high=se,m.low=Fe}var Y=le&ve^~le&Me,J=fe&Ae^~fe&Be,m=z&L^z&ee^L&ee,ne=R&q^R&X^q&X,ge=(z>>>28|R<<4)^(z<<30|R>>>2)^(z<<25|R>>>7),de=(R>>>28|z<<4)^(R<<30|z>>>2)^(R<<25|z>>>7),xe=a[ue],re=xe.high,Ce=xe.low,xe=V+((fe>>>14|le<<18)^(fe>>>18|le<<14)^(fe<<23|le>>>9)),pe=Pe+((le>>>14|fe<<18)^(le>>>18|fe<<14)^(le<<23|fe>>>9))+(xe>>>0>>0?1:0),xe=xe+J,pe=pe+Y+(xe>>>0>>0?1:0),xe=xe+Ce,pe=pe+re+(xe>>>0>>0?1:0),xe=xe+Fe,pe=pe+se+(xe>>>0>>0?1:0),Fe=de+ne,m=ge+m+(Fe>>>0>>0?1:0),Pe=Me,V=Be,Me=ve,Be=Ae,ve=le,Ae=fe,fe=me+xe|0,le=oe+pe+(fe>>>0>>0?1:0)|0,oe=ee,me=X,ee=L,X=q,L=z,q=R,R=xe+Fe|0,z=pe+m+(R>>>0>>0?1:0)|0}k=h.low=k+R,h.high=S+z+(k>>>0>>0?1:0),_=f.low=_+q,f.high=T+L+(_>>>0>>0?1:0),N=p.low=N+X,p.high=B+ee+(N>>>0>>0?1:0),D=d.low=D+me,d.high=P+oe+(D>>>0>>0?1:0),E=g.low=E+fe,g.high=O+le+(E>>>0>>0?1:0),A=y.low=A+Ae,y.high=F+ve+(A>>>0>>0?1:0),j=x.low=j+Be,x.high=I+Me+(j>>>0>>0?1:0),G=b.low=G+V,b.high=H+Pe+(G>>>0>>0?1:0)},_doFinalize:function(){var u=this._data,l=u.words,h=8*this._nDataBytes,f=8*u.sigBytes;return l[f>>>5]|=128<<24-f%32,l[(f+128>>>10<<5)+30]=Math.floor(h/4294967296),l[(f+128>>>10<<5)+31]=h,u.sigBytes=4*l.length,this._process(),this._hash.toX32()},clone:function(){var u=r.clone.call(this);return u._hash=this._hash.clone(),u},blockSize:32}),e.SHA512=r._createHelper(s),e.HmacSHA512=r._createHmacHelper(s)})();(function(){var t=Re,i=t.x64,e=i.Word,r=i.WordArray,i=t.algo,n=i.SHA512,i=i.SHA384=n.extend({_doReset:function(){this._hash=new r.init([new e.init(3418070365,3238371032),new e.init(1654270250,914150663),new e.init(2438529370,812702999),new e.init(355462360,4144912697),new e.init(1731405415,4290775857),new e.init(2394180231,1750603025),new e.init(3675008525,1694076839),new e.init(1203062813,3204075428)])},_doFinalize:function(){var s=n._doFinalize.call(this);return s.sigBytes-=16,s}});t.SHA384=n._createHelper(i),t.HmacSHA384=n._createHmacHelper(i)})();(function(){var t=Re,u=t.lib,e=u.WordArray,r=u.Hasher,u=t.algo,n=e.create([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]),i=e.create([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]),s=e.create([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]),a=e.create([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]),o=e.create([0,1518500249,1859775393,2400959708,2840853838]),c=e.create([1352829926,1548603684,1836072691,2053994217,0]),u=u.RIPEMD160=r.extend({_doReset:function(){this._hash=e.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(l,h){for(var f=0;16>f;f++){var p=h+f,d=l[p];l[p]=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360}var p=this._hash.words,d=o.words,g=c.words,y=n.words,x=i.words,b=s.words,S=a.words,k,T,_,B,N,P,D,O,E,F;P=k=p[0],D=T=p[1],O=_=p[2],E=B=p[3],F=N=p[4];for(var A,f=0;80>f;f+=1)A=k+l[h+y[f]]|0,A=16>f?A+((T^_^B)+d[0]):32>f?A+((T&_|~T&B)+d[1]):48>f?A+(((T|~_)^B)+d[2]):64>f?A+((T&B|_&~B)+d[3]):A+((T^(_|~B))+d[4]),A|=0,A=A<>>32-b[f],A=A+N|0,k=N,N=B,B=_<<10|_>>>22,_=T,T=A,A=P+l[h+x[f]]|0,A=16>f?A+((D^(O|~E))+g[0]):32>f?A+((D&E|O&~E)+g[1]):48>f?A+(((D|~O)^E)+g[2]):64>f?A+((D&O|~D&E)+g[3]):A+((D^O^E)+g[4]),A|=0,A=A<>>32-S[f],A=A+F|0,P=F,F=E,E=O<<10|O>>>22,O=D,D=A;A=p[1]+_+E|0,p[1]=p[2]+B+F|0,p[2]=p[3]+N+P|0,p[3]=p[4]+k+D|0,p[4]=p[0]+T+O|0,p[0]=A},_doFinalize:function(){var l=this._data,h=l.words,f=8*this._nDataBytes,p=8*l.sigBytes;for(h[p>>>5]|=128<<24-p%32,h[(p+64>>>9<<4)+14]=(f<<8|f>>>24)&16711935|(f<<24|f>>>8)&4278255360,l.sigBytes=4*(h.length+1),this._process(),l=this._hash,h=l.words,f=0;5>f;f++)p=h[f],h[f]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360;return l},clone:function(){var l=r.clone.call(this);return l._hash=this._hash.clone(),l}});t.RIPEMD160=r._createHelper(u),t.HmacRIPEMD160=r._createHmacHelper(u)})();(function(){var t=Re,e=t.enc.Utf8;t.algo.HMAC=t.lib.Base.extend({init:function(r,n){r=this._hasher=new r.init,typeof n=="string"&&(n=e.parse(n));var i=r.blockSize,s=4*i;n.sigBytes>s&&(n=r.finalize(n)),n.clamp();for(var a=this._oKey=n.clone(),o=this._iKey=n.clone(),c=a.words,u=o.words,l=0;l>6)+Fl.charAt(r&63);for(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),n+=Fl.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),n+=Fl.charAt(r>>2)+Fl.charAt((r&3)<<4));(n.length&3)>0;)n+=iF;return n}function k8(t){var e="",r,n=0,i,s;for(r=0;r>2),i=s&3,n=1):n==1?(e+=Ca(i<<2|s>>4),i=s&15,n=2):n==2?(e+=Ca(i),e+=Ca(s>>2),i=s&3,n=3):(e+=Ca(i<<2|s>>4),e+=Ca(s&15),n=0));return n==1&&(e+=Ca(i<<2)),e}/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ -*/var bc;function ie(t,e,r){t!=null&&(typeof t=="number"?this.fromNumber(t,e,r):e==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,e))}function ft(){return new ie(null)}function aQ(t,e,r,n,i,s){for(;--s>=0;){var a=e*this[t++]+r[n]+i;i=Math.floor(a/67108864),r[n++]=a&67108863}return i}function oQ(t,e,r,n,i,s){for(var a=e&32767,o=e>>15;--s>=0;){var c=this[t]&32767,u=this[t++]>>15,l=o*c+u*a;c=a*c+((l&32767)<<15)+r[n]+(i&1073741823),i=(c>>>30)+(l>>>15)+o*u+(i>>>30),r[n++]=c&1073741823}return i}function cQ(t,e,r,n,i,s){for(var a=e&16383,o=e>>14;--s>=0;){var c=this[t]&16383,u=this[t++]>>14,l=o*c+u*a;c=a*c+((l&16383)<<14)+r[n]+i,i=(c>>28)+(l>>14)+o*u,r[n++]=c&268435455}return i}Gd.appName=="Microsoft Internet Explorer"?(ie.prototype.am=oQ,bc=30):Gd.appName!="Netscape"?(ie.prototype.am=aQ,bc=26):(ie.prototype.am=cQ,bc=28);ie.prototype.DB=bc;ie.prototype.DM=(1<=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function fQ(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0}function fc(t){var e=ft();return e.fromInt(t),e}function hQ(t,e){var r;if(e==16)r=4;else if(e==8)r=3;else if(e==256)r=8;else if(e==2)r=1;else if(e==32)r=5;else if(e==4)r=2;else{this.fromRadix(t,e);return}this.t=0,this.s=0;for(var n=t.length,i=!1,s=0;--n>=0;){var a=r==8?t[n]&255:sF(t,n);if(a<0){t.charAt(n)=="-"&&(i=!0);continue}i=!1,s==0?this[this.t++]=a:s+r>this.DB?(this[this.t-1]|=(a&(1<>this.DB-s):this[this.t-1]|=a<=this.DB&&(s-=this.DB)}r==8&&t[0]&128&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t}function pQ(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(t==16)e=4;else if(t==8)e=3;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else return this.toRadix(t);var r=(1<0)for(o>o)>0&&(i=!0,s=Ca(n));a>=0;)o>(o+=this.DB-e)):(n=this[a]>>(o-=e)&r,o<=0&&(o+=this.DB,--a)),n>0&&(i=!0),i&&(s+=Ca(n));return i?s:"0"}function gQ(){var t=ft();return ie.ZERO.subTo(this,t),t}function mQ(){return this.s<0?this.negate():this}function vQ(t){var e=this.s-t.s;if(e!=0)return e;var r=this.t;if(e=r-t.t,e!=0)return this.s<0?-e:e;for(;--r>=0;)if((e=this[r]-t[r])!=0)return e;return 0}function Qv(t){var e=1,r;return(r=t>>>16)!=0&&(t=r,e+=16),(r=t>>8)!=0&&(t=r,e+=8),(r=t>>4)!=0&&(t=r,e+=4),(r=t>>2)!=0&&(t=r,e+=2),(r=t>>1)!=0&&(t=r,e+=1),e}function yQ(){return this.t<=0?0:this.DB*(this.t-1)+Qv(this[this.t-1]^this.s&this.DM)}function xQ(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s}function bQ(t,e){for(var r=t;r=0;--o)e[o+s+1]=this[o]>>n|a,a=(this[o]&i)<=0;--o)e[o]=0;e[s]=a,e.t=this.t+s+1,e.s=this.s,e.clamp()}function EQ(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t){e.t=0;return}var n=t%this.DB,i=this.DB-n,s=(1<>n;for(var a=r+1;a>n;n>0&&(e[this.t-r-1]|=(this.s&s)<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[r++]=this.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()}function SQ(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e[i]=0;for(i=0;i=0;)t[r]=0;for(r=0;r=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()}function _Q(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(c,s),i.lShiftTo(c,r)):(n.copyTo(s),i.copyTo(r));var u=s.t,l=s[u-1];if(l!=0){var h=l*(1<1?s[u-2]>>this.F2:0),f=this.FV/h,p=(1<=0&&(r[r.t++]=1,r.subTo(x,r)),ie.ONE.dlShiftTo(u,x),x.subTo(s,s);s.t=0;){var b=r[--g]==l?this.DM:Math.floor(r[g]*f+(r[g-1]+d)*p);if((r[g]+=s.am(0,b,r,y,0,u))0&&r.rShiftTo(c,r),a<0&&ie.ZERO.subTo(r,r)}}}function kQ(t){var e=ft();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(ie.ZERO)>0&&t.subTo(e,e),e}function cl(t){this.m=t}function BQ(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function IQ(t){return t}function FQ(t){t.divRemTo(this.m,null,t)}function TQ(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function PQ(t,e){t.squareTo(e),this.reduce(e)}cl.prototype.convert=BQ;cl.prototype.revert=IQ;cl.prototype.reduce=FQ;cl.prototype.mulTo=TQ;cl.prototype.sqrTo=PQ;function NQ(){if(this.t<1)return 0;var t=this[0];if(!(t&1))return 0;var e=t&3;return e=e*(2-(t&15)*e)&15,e=e*(2-(t&255)*e)&255,e=e*(2-((t&65535)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}function ul(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e}function DQ(t){var e=ft();return t.copyTo(e),this.reduce(e),e}function RQ(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t[r]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function MQ(t,e){t.squareTo(e),this.reduce(e)}function LQ(t,e,r){t.multiplyTo(e,r),this.reduce(r)}ul.prototype.convert=OQ;ul.prototype.revert=DQ;ul.prototype.reduce=RQ;ul.prototype.mulTo=LQ;ul.prototype.sqrTo=MQ;function jQ(){return(this.t>0?this[0]&1:this.s)==0}function UQ(t,e){if(t>4294967295||t<1)return ie.ONE;var r=ft(),n=ft(),i=e.convert(this),s=Qv(t)-1;for(i.copyTo(r);--s>=0;)if(e.sqrTo(r,n),(t&1<0)e.mulTo(n,i,r);else{var a=r;r=n,n=a}return e.revert(r)}function $Q(t,e){var r;return t<256||e.isEven()?r=new cl(e):r=new ul(e),this.exp(t,r)}ie.prototype.copyTo=lQ;ie.prototype.fromInt=fQ;ie.prototype.fromString=hQ;ie.prototype.clamp=dQ;ie.prototype.dlShiftTo=xQ;ie.prototype.drShiftTo=bQ;ie.prototype.lShiftTo=wQ;ie.prototype.rShiftTo=EQ;ie.prototype.subTo=AQ;ie.prototype.multiplyTo=SQ;ie.prototype.squareTo=CQ;ie.prototype.divRemTo=_Q;ie.prototype.invDigit=NQ;ie.prototype.isEven=jQ;ie.prototype.exp=UQ;ie.prototype.toString=pQ;ie.prototype.negate=gQ;ie.prototype.abs=mQ;ie.prototype.compareTo=vQ;ie.prototype.bitLength=yQ;ie.prototype.mod=kQ;ie.prototype.modPowInt=$Q;ie.ZERO=fc(0);ie.ONE=fc(1);/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */function HQ(){var t=ft();return this.copyTo(t),t}function zQ(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function qQ(){return this.t==0?this.s:this[0]<<16>>16}function KQ(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function WQ(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function GQ(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=fc(r),i=ft(),s=ft(),a="";for(this.divRemTo(n,i,s);i.signum()>0;)a=(r+s.intValue()).toString(t).substr(1)+a,i.divRemTo(n,i,s);return s.intValue().toString(t)+a}function ZQ(t,e){this.fromInt(0),e==null&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,s=0,a=0,o=0;o=r&&(this.dMultiply(n),this.dAddOffset(a,0),s=0,a=0)}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(a,0)),i&&ie.ZERO.subTo(this,this)}function JQ(t,e,r){if(typeof e=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(ie.ONE.shiftLeft(t-1),I8,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(ie.ONE.shiftLeft(t-1),this);else{var n=new Array,i=t&7;n.length=(t>>3)+1,e.nextBytes(n),i>0?n[0]&=(1<0)for(r>r)!=(this.s&this.DM)>>r&&(e[i++]=n|this.s<=0;)r<8?(n=(this[t]&(1<>(r+=this.DB-8)):(n=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),n&128&&(n|=-256),i==0&&(this.s&128)!=(n&128)&&++i,(i>0||n!=this.s)&&(e[i++]=n);return e}function QQ(t){return this.compareTo(t)==0}function YQ(t){return this.compareTo(t)<0?this:t}function eY(t){return this.compareTo(t)>0?this:t}function tY(t,e,r){var n,i,s=Math.min(t.t,this.t);for(n=0;n>=16,e+=16),t&255||(t>>=8,e+=8),t&15||(t>>=4,e+=4),t&3||(t>>=2,e+=2),t&1||++e,e}function fY(){for(var t=0;t=this.t?this.s!=0:(this[e]&1<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[r++]=n:n<-1&&(e[r++]=this.DV+n),e.t=r,e.clamp()}function bY(t){var e=ft();return this.addTo(t,e),e}function wY(t){var e=ft();return this.subTo(t,e),e}function EY(t){var e=ft();return this.multiplyTo(t,e),e}function AY(){var t=ft();return this.squareTo(t),t}function SY(t){var e=ft();return this.divRemTo(t,e,null),e}function CY(t){var e=ft();return this.divRemTo(t,null,e),e}function _Y(t){var e=ft(),r=ft();return this.divRemTo(t,e,r),new Array(e,r)}function kY(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function BY(t,e){if(t!=0){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}function Vp(){}function cF(t){return t}function IY(t,e,r){t.multiplyTo(e,r)}function FY(t,e){t.squareTo(e)}Vp.prototype.convert=cF;Vp.prototype.revert=cF;Vp.prototype.mulTo=IY;Vp.prototype.sqrTo=FY;function TY(t){return this.exp(t,new Vp)}function PY(t,e,r){var n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r[--n]=0;var i;for(i=r.t-this.t;n=0;)r[n]=0;for(n=Math.max(e-this.t,0);n2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=ft();return t.copyTo(e),this.reduce(e),e}function DY(t){return t}function RY(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function MY(t,e){t.squareTo(e),this.reduce(e)}function LY(t,e,r){t.multiplyTo(e,r),this.reduce(r)}l0.prototype.convert=OY;l0.prototype.revert=DY;l0.prototype.reduce=RY;l0.prototype.mulTo=LY;l0.prototype.sqrTo=MY;function jY(t,e){var r=t.bitLength(),n,i=fc(1),s;if(r<=0)return i;r<18?n=1:r<48?n=3:r<144?n=4:r<768?n=5:n=6,r<8?s=new cl(e):e.isEven()?s=new l0(e):s=new ul(e);var a=new Array,o=3,c=n-1,u=(1<1){var l=ft();for(s.sqrTo(a[1],l);o<=u;)a[o]=ft(),s.mulTo(l,a[o-2],a[o]),o+=2}var h=t.t-1,f,p=!0,d=ft(),g;for(r=Qv(t[h])-1;h>=0;){for(r>=c?f=t[h]>>r-c&u:(f=(t[h]&(1<0&&(f|=t[h-1]>>this.DB+r-c)),o=n;!(f&1);)f>>=1,--o;if((r-=o)<0&&(r+=this.DB,--h),p)a[f].copyTo(i),p=!1;else{for(;o>1;)s.sqrTo(i,d),s.sqrTo(d,i),o-=2;o>0?s.sqrTo(i,d):(g=i,i=d,d=g),s.mulTo(d,a[f],i)}for(;h>=0&&!(t[h]&1<0&&(e.rShiftTo(s,e),r.rShiftTo(s,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r}function $Y(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(e==0)r=this[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this[n])%t;return r}function HY(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return ie.ZERO;for(var r=t.clone(),n=this.clone(),i=fc(1),s=fc(0),a=fc(0),o=fc(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),e?((!i.isEven()||!s.isEven())&&(i.addTo(this,i),s.subTo(t,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),e?((!a.isEven()||!o.isEven())&&(a.addTo(this,a),o.subTo(t,o)),a.rShiftTo(1,a)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(a,i),s.subTo(o,s)):(n.subTo(r,n),e&&a.subTo(i,a),o.subTo(s,o))}if(n.compareTo(ie.ONE)!=0)return ie.ZERO;if(o.compareTo(t)>=0)return o.subtract(t);if(o.signum()<0)o.addTo(t,o);else return o;return o.signum()<0?o.add(t):o}var gn=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],zY=(1<<26)/gn[gn.length-1];function VY(t){var e,r=this.abs();if(r.t==1&&r[0]<=gn[gn.length-1]){for(e=0;e>1,t>gn.length&&(t=gn.length);for(var i=ft(),s=0;s>8&255,si[Dr++]^=t>>16&255,si[Dr++]^=t>>24&255,Dr>=$w&&(Dr-=$w)}function uF(){ZY(new Date().getTime())}if(si==null){si=new Array,Dr=0;var ts;if(Al!==void 0&&(Al.crypto!==void 0||Al.msCrypto!==void 0)){var vA=Al.crypto||Al.msCrypto;if(vA.getRandomValues){var yA=new Uint8Array(32);for(vA.getRandomValues(yA),ts=0;ts<32;++ts)si[Dr++]=yA[ts]}else if(Gd.appName=="Netscape"&&Gd.appVersion<"5"){var xA=Al.crypto.random(32);for(ts=0;ts>>8,si[Dr++]=ts&255;Dr=0,uF()}function JY(){if(k1==null){for(uF(),k1=GY(),k1.init(si),Dr=0;Dr=0&&e>0;){var i=t.charCodeAt(n--);i<128?r[--e]=i:i>127&&i<2048?(r[--e]=i&63|128,r[--e]=i>>6|192):(r[--e]=i&63|128,r[--e]=i>>6&63|128,r[--e]=i>>12|224)}r[--e]=0;for(var s=new ll,a=new Array;e>2;){for(a[0]=0;a[0]==0;)s.nextBytes(a);r[--e]=a[0]}return r[--e]=2,r[--e]=0,new ie(r)}function bA(t,e,r){for(var n="",i=0;n.length>24,(i&16711680)>>16,(i&65280)>>8,i&255]))),i+=1;return n}function YY(t,e,r,n){var i=C.crypto.MessageDigest,s=C.crypto.Util,a=null;if(r||(r="sha1"),typeof r=="string"&&(a=i.getCanonicalAlgName(r),n=i.getHashLength(a),r=function(g){return Mi(s.hashHex(Is(g),a))}),t.length+2*n+2>e)throw"Message too long for RSA";var o="",c;for(c=0;c0&&e.length>0)this.n=sn(t,16),this.e=parseInt(e,16);else throw"Invalid RSA public key"}function tee(t){return t.modPowInt(this.e,this.n)}function ree(t){var e=QY(t,this.n.bitLength()+7>>3);if(e==null)return null;var r=this.doPublic(e);if(r==null)return null;var n=r.toString(16);return n.length&1?"0"+n:n}function nee(t,e,r){var n=this.n.bitLength()+7>>3,i=YY(t,n,e,r);if(i==null)return null;var s=this.doPublic(i);if(s==null)return null;for(var a=s.toString(16);a.length=r.length)return null;for(var i="";++n191&&s<224?(i+=String.fromCharCode((s&31)<<6|r[n+1]&63),++n):(i+=String.fromCharCode((s&15)<<12|(r[n+1]&63)<<6|r[n+2]&63),n+=2)}return i}function wA(t,e,r){for(var n="",i=0;n.length>24,(i&16711680)>>16,(i&65280)>>8,i&255])),i+=1;return n}function see(t,e,r,n){var i=C.crypto.MessageDigest,s=C.crypto.Util,a=null;r||(r="sha1"),typeof r=="string"&&(a=i.getCanonicalAlgName(r),n=i.getHashLength(a),r=function(y){return Mi(s.hashHex(Is(y),a))}),t=t.toByteArray();var h;for(h=0;h0&&e.length>0)this.n=sn(t,16),this.e=parseInt(e,16),this.d=sn(r,16);else throw"Invalid RSA private key"}function oee(t,e,r,n,i,s,a,o){if(this.isPrivate=!0,this.isPublic=!1,t==null)throw"RSASetPrivateEx N == null";if(e==null)throw"RSASetPrivateEx E == null";if(t.length==0)throw"RSASetPrivateEx N.length == 0";if(e.length==0)throw"RSASetPrivateEx E.length == 0";if(t!=null&&e!=null&&t.length>0&&e.length>0)this.n=sn(t,16),this.e=parseInt(e,16),this.d=sn(r,16),this.p=sn(n,16),this.q=sn(i,16),this.dmp1=sn(s,16),this.dmq1=sn(a,16),this.coeff=sn(o,16);else throw"Invalid RSA private key in RSASetPrivateEx"}function cee(t,e){var r=new ll,n=t>>1;this.e=parseInt(e,16);for(var i=new ie(e,16),s=t/2-100,a=ie.ONE.shiftLeft(s);;){for(;this.p=new ie(t-n,1,r),!(this.p.subtract(ie.ONE).gcd(i).compareTo(ie.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new ie(n,1,r),!(this.q.subtract(ie.ONE).gcd(i).compareTo(ie.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var c=this.q.subtract(this.p).abs();if(!(c.bitLength()>3)}function fee(t,e,r){if(t.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var n=sn(t,16),i=this.doPrivate(n);return i==null?null:see(i,this.n.bitLength()+7>>3,e,r)}Ze.prototype.doPrivate=uee;Ze.prototype.setPrivate=aee;Ze.prototype.setPrivateEx=oee;Ze.prototype.generate=cee;Ze.prototype.decrypt=lee;Ze.prototype.decryptOAEP=fee;/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */function Ur(t,e){this.x=e,this.q=t}function hee(t){return t==this?!0:this.q.equals(t.q)&&this.x.equals(t.x)}function dee(){return this.x}function pee(){return new Ur(this.q,this.x.negate().mod(this.q))}function gee(t){return new Ur(this.q,this.x.add(t.toBigInteger()).mod(this.q))}function mee(t){return new Ur(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))}function vee(t){return new Ur(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))}function yee(){return new Ur(this.q,this.x.square().mod(this.q))}function xee(t){return new Ur(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))}Ur.prototype.equals=hee;Ur.prototype.toBigInteger=dee;Ur.prototype.negate=pee;Ur.prototype.add=gee;Ur.prototype.subtract=mee;Ur.prototype.multiply=vee;Ur.prototype.square=yee;Ur.prototype.divide=xee;Ur.prototype.sqrt=function(){return new Ur(this.q,this.x.sqrt().mod(this.q))};function bt(t,e,r,n){this.curve=t,this.x=e,this.y=r,n==null?this.z=ie.ONE:this.z=n,this.zinv=null}function bee(){return this.zinv==null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function wee(){return this.zinv==null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function Eee(t){if(t==this)return!0;if(this.isInfinity())return t.isInfinity();if(t.isInfinity())return this.isInfinity();var e,r;return e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),e.equals(ie.ZERO)?(r=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q),r.equals(ie.ZERO)):!1}function Aee(){return this.x==null&&this.y==null?!0:this.z.equals(ie.ZERO)&&!this.y.toBigInteger().equals(ie.ZERO)}function See(){return new bt(this.curve,this.x,this.y.negate(),this.z)}function Cee(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),r=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q);if(ie.ZERO.equals(r))return ie.ZERO.equals(e)?this.twice():this.curve.getInfinity();var n=new ie("3"),i=this.x.toBigInteger(),s=this.y.toBigInteger();t.x.toBigInteger(),t.y.toBigInteger();var a=r.square(),o=a.multiply(r),c=i.multiply(a),u=e.square().multiply(this.z),l=u.subtract(c.shiftLeft(1)).multiply(t.z).subtract(o).multiply(r).mod(this.curve.q),h=c.multiply(n).multiply(e).subtract(s.multiply(o)).subtract(u.multiply(e)).multiply(t.z).add(e.multiply(o)).mod(this.curve.q),f=o.multiply(this.z).multiply(t.z).mod(this.curve.q);return new bt(this.curve,this.curve.fromBigInteger(l),this.curve.fromBigInteger(h),f)}function _ee(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var t=new ie("3"),e=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),i=n.multiply(r).mod(this.curve.q),s=this.curve.a.toBigInteger(),a=e.square().multiply(t);ie.ZERO.equals(s)||(a=a.add(this.z.square().multiply(s))),a=a.mod(this.curve.q);var o=a.square().subtract(e.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(n).mod(this.curve.q),c=a.multiply(t).multiply(e).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(a.square().multiply(a)).mod(this.curve.q),u=n.square().multiply(n).shiftLeft(3).mod(this.curve.q);return new bt(this.curve,this.curve.fromBigInteger(o),this.curve.fromBigInteger(c),u)}function kee(t){if(this.isInfinity())return this;if(t.signum()==0)return this.curve.getInfinity();var e=t,r=e.multiply(new ie("3")),n=this.negate(),i=this,s=this.curve.q.subtract(t),a=s.multiply(new ie("3")),o=new bt(this.curve,this.x,this.y),c=o.negate(),u;for(u=r.bitLength()-2;u>0;--u){i=i.twice();var l=r.testBit(u),h=e.testBit(u);l!=h&&(i=i.add(l?this:n))}for(u=a.bitLength()-2;u>0;--u){o=o.twice();var f=a.testBit(u),p=s.testBit(u);f!=p&&(o=o.add(f?o:c))}return i}function Bee(t,e,r){var n;t.bitLength()>r.bitLength()?n=t.bitLength()-1:n=r.bitLength()-1;for(var i=this.curve.getInfinity(),s=this.add(e);n>=0;)i=i.twice(),t.testBit(n)?r.testBit(n)?i=i.add(s):i=i.add(this):r.testBit(n)&&(i=i.add(e)),--n;return i}bt.prototype.getX=bee;bt.prototype.getY=wee;bt.prototype.equals=Eee;bt.prototype.isInfinity=Aee;bt.prototype.negate=See;bt.prototype.add=Cee;bt.prototype.twice=_ee;bt.prototype.multiply=kee;bt.prototype.multiplyTwo=Bee;function $c(t,e,r){this.q=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(r),this.infinity=new bt(this,null,null)}function Iee(){return this.q}function Fee(){return this.a}function Tee(){return this.b}function Pee(t){return t==this?!0:this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)}function Nee(){return this.infinity}function Oee(t){return new Ur(this.q,t)}function Dee(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:var e=t.substr(0,2);t.substr(2);var r=this.fromBigInteger(new ie(c,16)),n=this.getA(),i=this.getB(),s=r.square().add(n).multiply(r).add(i),a=s.sqrt();return e=="03"&&(a=a.negate()),new bt(this,r,a);case 4:case 6:case 7:var o=(t.length-2)/2,c=t.substr(2,o),u=t.substr(o+2,o);return new bt(this,this.fromBigInteger(new ie(c,16)),this.fromBigInteger(new ie(u,16)));default:return null}}$c.prototype.getQ=Iee;$c.prototype.getA=Fee;$c.prototype.getB=Tee;$c.prototype.equals=Pee;$c.prototype.getInfinity=Nee;$c.prototype.fromBigInteger=Oee;$c.prototype.decodePointHex=Dee;/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib - */Ur.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};bt.prototype.getEncoded=function(t){var e=function(s,a){var o=s.toByteArrayUnsigned();if(ao.length;)o.unshift(0);return o},r=this.getX().toBigInteger(),n=this.getY().toBigInteger(),i=e(r,32);return t?n.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(e(n,32))),i};bt.decodeFrom=function(t,e){e[0];var r=e.length-1,n=e.slice(1,1+r/2),i=e.slice(1+r/2,1+r);n.unshift(0),i.unshift(0);var s=new ie(n),a=new ie(i);return new bt(t,t.fromBigInteger(s),t.fromBigInteger(a))};bt.decodeFromHex=function(t,e){e.substr(0,2);var r=e.length-2,n=e.substr(2,r/2),i=e.substr(2+r/2,r/2),s=new ie(n,16),a=new ie(i,16);return new bt(t,t.fromBigInteger(s),t.fromBigInteger(a))};bt.prototype.add2D=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;if(this.x.equals(t.x))return this.y.equals(t.y)?this.twice():this.curve.getInfinity();var e=t.x.subtract(this.x),r=t.y.subtract(this.y),n=r.divide(e),i=n.square().subtract(this.x).subtract(t.x),s=n.multiply(this.x.subtract(i)).subtract(this.y);return new bt(this.curve,i,s)};bt.prototype.twice2D=function(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var t=this.curve.fromBigInteger(ie.valueOf(2)),e=this.curve.fromBigInteger(ie.valueOf(3)),r=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(t)),n=r.square().subtract(this.x.multiply(t)),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new bt(this.curve,n,i)};bt.prototype.multiply2D=function(t){if(this.isInfinity())return this;if(t.signum()==0)return this.curve.getInfinity();var e=t,r=e.multiply(new ie("3")),n=this.negate(),i=this,s;for(s=r.bitLength()-2;s>0;--s){i=i.twice();var a=r.testBit(s),o=e.testBit(s);a!=o&&(i=i.add2D(a?this:n))}return i};bt.prototype.isOnCurve=function(){var t=this.getX().toBigInteger(),e=this.getY().toBigInteger(),r=this.curve.getA().toBigInteger(),n=this.curve.getB().toBigInteger(),i=this.curve.getQ(),s=e.multiply(e).mod(i),a=t.multiply(t).multiply(t).add(r.multiply(t)).add(n).mod(i);return s.equals(a)};bt.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};bt.prototype.validate=function(){var t=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var e=this.getX().toBigInteger(),r=this.getY().toBigInteger();if(e.compareTo(ie.ONE)<0||e.compareTo(t.subtract(ie.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(ie.ONE)<0||r.compareTo(t.subtract(ie.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(t).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval - */var lF=function(){var t="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)",e='(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))',r='(?:"'+e+'*")',n=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+t+"|"+r+")","g"),i=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),s={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:` -`,r:"\r",t:" "};function a(l,h,f){return h?s[h]:String.fromCharCode(parseInt(f,16))}var o=new String(""),c="\\",u=Object.hasOwnProperty;return function(l,h){var f=l.match(n),p,d=f[0],g=!1;d==="{"?p={}:d==="["?p=[]:(p=[],g=!0);for(var y,x=[p],b=1-g,S=f.length;b=0;)delete N[P[E]]}return h.call(_,B,N)};p=T({"":p},"")}return p}}();(typeof C>"u"||!C)&&(C={});(typeof C.asn1>"u"||!C.asn1)&&(C.asn1={});C.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){return Yv(t)},this.getPEMStringFromHex=function(t,e){return yn(t,e)},this.newObject=function(t){var e=C,r=e.asn1,n=r.ASN1Object,i=r.DERBoolean,s=r.DERInteger,a=r.DERBitString,o=r.DEROctetString,c=r.DERNull,u=r.DERObjectIdentifier,l=r.DEREnumerated,h=r.DERUTF8String,f=r.DERNumericString,p=r.DERPrintableString,d=r.DERTeletexString,g=r.DERIA5String,y=r.DERUTCTime,x=r.DERGeneralizedTime,b=r.DERVisibleString,S=r.DERBMPString,k=r.DERSequence,T=r.DERSet,_=r.DERTaggedObject,B=r.ASN1Util.newObject;if(t instanceof r.ASN1Object)return t;var N=Object.keys(t);if(N.length!=1)throw new Error("key of param shall be only one.");var P=N[0];if(":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+P+":")==-1)throw new Error("undefined key: "+P);if(P=="bool")return new i(t[P]);if(P=="int")return new s(t[P]);if(P=="bitstr")return new a(t[P]);if(P=="octstr")return new o(t[P]);if(P=="null")return new c(t[P]);if(P=="oid")return new u(t[P]);if(P=="enum")return new l(t[P]);if(P=="utf8str")return new h(t[P]);if(P=="numstr")return new f(t[P]);if(P=="prnstr")return new p(t[P]);if(P=="telstr")return new d(t[P]);if(P=="ia5str")return new g(t[P]);if(P=="utctime")return new y(t[P]);if(P=="gentime")return new x(t[P]);if(P=="visstr")return new b(t[P]);if(P=="bmpstr")return new S(t[P]);if(P=="asn1")return new n(t[P]);if(P=="seq"){for(var D=t[P],O=[],E=0;E"u"||this.hV==null)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n="+e.length+",v="+this.hV);var r=this.hV.length/2,n=r.toString(16);if(n.length%2==1&&(n="0"+n),r<128)return n;var i=n.length/2;if(i>15)throw new Error("ASN.1 length too long to represent by 8x: n = "+r.toString(16));var s=128+i;return s.toString(16)+n},this.tohex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.getValueHex=function(){return this.tohex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(r){this.params=r},t!=null&&t.tlv!=null&&(this.hTLV=t.tlv,this.isModified=!1)};C.asn1.DERAbstractString=function(t){C.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=N8(this.s).toLowerCase()},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},typeof t<"u"&&(typeof t=="string"?this.setString(t):typeof t.str<"u"?this.setString(t.str):typeof t.hex<"u"&&this.setStringHex(t.hex))};we(C.asn1.DERAbstractString,C.asn1.ASN1Object);C.asn1.DERAbstractTime=function(t){C.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(e){var r=e.getTime()+e.getTimezoneOffset()*6e4,n=new Date(r);return n},this.formatDate=function(e,r,n){var i=this.zeroPadding,s=this.localDateToUTC(e),a=String(s.getFullYear());r=="utc"&&(a=a.substr(2,2));var o=i(String(s.getMonth()+1),2),c=i(String(s.getDate()),2),u=i(String(s.getHours()),2),l=i(String(s.getMinutes()),2),h=i(String(s.getSeconds()),2),f=a+o+c+u+l+h;if(n===!0){var p=s.getMilliseconds();if(p!=0){var d=i(String(p),3);d=d.replace(/[0]+$/,""),f=f+"."+d}}return f+"Z"},this.zeroPadding=function(e,r){return e.length>=r?e:new Array(r-e.length+1).join("0")+e},this.setByParam=function(e){this.hV=null,this.hTLV=null,this.params=e},this.getString=function(){},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.params==null&&(this.params={}),this.params.str=e},this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.params==null&&(this.params={}),this.params.date=e},this.setByDateValue=function(e,r,n,i,s,a){var o=new Date(Date.UTC(e,r-1,n,i,s,a,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}};we(C.asn1.DERAbstractTime,C.asn1.ASN1Object);C.asn1.DERAbstractStructured=function(t){C.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,typeof t<"u"&&typeof t.array<"u"&&(this.asn1Array=t.array)};we(C.asn1.DERAbstractStructured,C.asn1.ASN1Object);C.asn1.DERBoolean=function(t){C.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",t==!1?this.hTLV="010100":this.hTLV="0101ff"};we(C.asn1.DERBoolean,C.asn1.ASN1Object);C.asn1.DERInteger=function(t){C.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.params=null;var e=Yv;this.setByBigInteger=function(r){this.isModified=!0,this.params={bigint:r}},this.setByInteger=function(r){this.isModified=!0,this.params=r},this.setValueHex=function(r){this.isModified=!0,this.params={hex:r}},this.getFreshValueHex=function(){var r=this.params,n=null;if(r==null)throw new Error("value not set");if(typeof r=="object"&&r.hex!=null)return this.hV=r.hex,this.hV;if(typeof r=="number")n=new ie(String(r),10);else if(r.int!=null)n=new ie(String(r.int),10);else if(r.bigint!=null)n=r.bigint;else throw new Error("wrong parameter");return this.hV=e(n),this.hV},t!=null&&(this.params=t)};we(C.asn1.DERInteger,C.asn1.ASN1Object);C.asn1.DERBitString=function(t){if(t!==void 0&&typeof t.obj<"u"){var e=C.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.tohex()}C.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(r){this.hTLV=null,this.isModified=!0,this.hV=r},this.setUnusedBitsAndHexValue=function(r,n){if(r<0||7=s)break}return n};Ne.getNthChildIdx=function(t,e,r){var n=Ne.getChildIdx(t,e);return n[r]};Ne.getIdxbyList=function(t,e,r,n){var i=Ne,s,a;return r.length==0?n!==void 0&&t.substr(e,2)!==n?-1:e:(s=r.shift(),a=i.getChildIdx(t,e),s>=a.length?-1:i.getIdxbyList(t,a[s],r,n))};Ne.getIdxbyListEx=function(t,e,r,n){var i=Ne,s,a;if(r.length==0)return n!==void 0&&t.substr(e,2)!==n?-1:e;s=r.shift(),a=i.getChildIdx(t,e);for(var o=0,c=0;c=t.length?null:i.getTLV(t,s)};Ne.getTLVbyListEx=function(t,e,r,n){var i=Ne,s=i.getIdxbyListEx(t,e,r,n);return s==-1?null:i.getTLV(t,s)};Ne.getVbyList=function(t,e,r,n,i){var s=Ne,a,o;return a=s.getIdxbyList(t,e,r,n),a==-1||a>=t.length?null:(o=s.getV(t,a),i===!0&&(o=o.substr(2)),o)};Ne.getVbyListEx=function(t,e,r,n,i){var s=Ne,a,o;return a=s.getIdxbyListEx(t,e,r,n),a==-1?null:(o=s.getV(t,a),t.substr(a,2)=="03"&&i!==!1&&(o=o.substr(2)),o)};Ne.getInt=function(t,e,r){r==null&&(r=-1);try{var n=t.substr(e,2);if(n!="02"&&n!="03")return r;var i=Ne.getV(t,e);return n=="02"?parseInt(i,16):Wee(i)}catch{return r}};Ne.getOID=function(t,e,r){r==null&&(r=null);try{if(t.substr(e,2)!="06")return r;var n=Ne.getV(t,e);return O8(n)}catch{return r}};Ne.getOIDName=function(t,e,r){r==null&&(r=null);try{var n=Ne.getOID(t,e,r);if(n==r)return r;var i=C.asn1.x509.OID.oid2name(n);return i==""?n:i}catch{return r}};Ne.getString=function(t,e,r){r==null&&(r=null);try{var n=Ne.getV(t,e);return Mi(n)}catch{return r}};Ne.hextooidstr=function(t){var e=function(h,f){return h.length>=f?h:new Array(f-h.length+1).join("0")+h},r=[],n=t.substr(0,2),i=parseInt(n,16);r[0]=new String(Math.floor(i/40)),r[1]=new String(i%40);for(var s=t.substr(2),a=[],o=0;o0&&(l=l+"."+c.join(".")),l};Ne.dump=function(t,e,r,n){var i=Ne,s=i.getV,a=i.dump,o=i.getChildIdx,c=t;t instanceof C.asn1.ASN1Object&&(c=t.tohex());var u=function(B,N){if(B.length<=N*2)return B;var P=B.substr(0,N)+"..(total "+B.length/2+"bytes).."+B.substr(B.length-N,N);return P};e===void 0&&(e={ommit_long_octet:32}),r===void 0&&(r=0),n===void 0&&(n="");var l=e.ommit_long_octet,T=c.substr(r,2);if(T=="01"){var h=s(c,r);return h=="00"?n+`BOOLEAN FALSE -`:n+`BOOLEAN TRUE -`}if(T=="02"){var h=s(c,r);return n+"INTEGER "+u(h,l)+` -`}if(T=="03"){var h=s(c,r);if(i.isASN1HEX(h.substr(2))){var f=n+`BITSTRING, encapsulates -`;return f=f+a(h.substr(2),e,0,n+" "),f}else return n+"BITSTRING "+u(h,l)+` -`}if(T=="04"){var h=s(c,r);if(i.isASN1HEX(h)){var f=n+`OCTETSTRING, encapsulates -`;return f=f+a(h,e,0,n+" "),f}else return n+"OCTETSTRING "+u(h,l)+` -`}if(T=="05")return n+`NULL -`;if(T=="06"){var p=s(c,r),d=C.asn1.ASN1Util.oidHexToInt(p),g=C.asn1.x509.OID.oid2name(d),y=d.replace(/\./g," ");return g!=""?n+"ObjectIdentifier "+g+" ("+y+`) -`:n+"ObjectIdentifier ("+y+`) -`}if(T=="0a")return n+"ENUMERATED "+parseInt(s(c,r))+` -`;if(T=="0c")return n+"UTF8String '"+St(s(c,r))+`' -`;if(T=="13")return n+"PrintableString '"+St(s(c,r))+`' -`;if(T=="14")return n+"TeletexString '"+St(s(c,r))+`' -`;if(T=="16")return n+"IA5String '"+St(s(c,r))+`' -`;if(T=="17")return n+"UTCTime "+St(s(c,r))+` -`;if(T=="18")return n+"GeneralizedTime "+St(s(c,r))+` -`;if(T=="1a")return n+"VisualString '"+St(s(c,r))+`' -`;if(T=="1e")return n+"BMPString '"+pF(s(c,r))+`' -`;if(T=="30"){if(c.substr(r,4)=="3000")return n+`SEQUENCE {} -`;var f=n+`SEQUENCE -`,x=o(c,r),b=e;if((x.length==2||x.length==3)&&c.substr(x[0],2)=="06"&&c.substr(x[x.length-1],2)=="04"){var g=i.oidname(s(c,x[0])),S=JSON.parse(JSON.stringify(e));S.x509ExtName=g,b=S}for(var k=0;k4?{enum:{hex:x}}:{enum:parseInt(x,16)};if(g=="30"||g=="31")return y[p[g]]=d(t),y;if(g=="14"){var _=f(x);return y[p[g]]={str:_},y}else if(g=="1e"){var _=h(x);return y[p[g]]={str:_},y}else if(":0c:12:13:16:17:18:1a:".indexOf(g)!=-1){var _=l(x);return y[p[g]]={str:_},y}else if(g.match(/^8[0-9]$/)){var _=l(x);return _==null|_==""?{tag:{tag:g,explicit:!1,hex:x}}:_.match(/[\x00-\x1F\x7F-\x9F]/)!=null||_.match(/[\u0000-\u001F\u0080–\u009F]/)!=null?{tag:{tag:g,explicit:!1,hex:x}}:{tag:{tag:g,explicit:!1,str:_}}}else if(g.match(/^a[0-9]$/))try{if(!n(x))throw new Error("not encap");return{tag:{tag:g,explicit:!0,obj:r(x)}}}catch{return{tag:{tag:g,explicit:!0,hex:x}}}else{var B=new C.asn1.ASN1Object;B.hV=x;var N=B.getLengthHexFromValue();return{asn1:{tlv:g+N+x}}}}}};Ne.isContextTag=function(t,e){t=t.toLowerCase();var r,n;try{r=parseInt(t,16)}catch{return-1}if(e===void 0)return(r&192)==128;try{var i=e.match(/^\[[0-9]+\]$/);return i==null||(n=parseInt(e.substr(1,e.length-1),10),n>31)?!1:(r&192)==128&&(r&31)==n}catch{return!1}};Ne.isASN1HEX=function(t){var e=Ne;if(t.length%2==1)return!1;var r=e.getVblen(t,0),n=t.substr(0,2),i=e.getL(t,0),s=t.length-n.length-i.length;return s==r*2};Ne.checkStrictDER=function(t,e,r,n,i){var s=Ne;if(r===void 0){if(typeof t!="string")throw new Error("not hex string");if(t=t.toLowerCase(),!C.lang.String.isHex(t))throw new Error("not hex string");r=t.length,n=t.length/2,n<128?i=1:i=Math.ceil(n.toString(16))+1}var a=s.getL(t,e);if(a.length>i*2)throw new Error("L of TLV too long: idx="+e);var o=s.getVblen(t,e);if(o>n)throw new Error("value of L too long than hex: idx="+e);var c=s.getTLV(t,e),u=c.length-2-s.getL(t,e).length;if(u!==o*2)throw new Error("V string length and L's value not the same:"+u+"/"+o*2);if(e===0&&t.length!=c.length)throw new Error("total length and TLV length unmatch:"+t.length+"!="+c.length);var l=t.substr(e,2);if(l==="02"){var h=s.getVidx(t,e);if(t.substr(h,2)=="00"&&t.charCodeAt(h+2)<56)throw new Error("not least zeros for DER INTEGER")}if(parseInt(l,16)&32){for(var f=s.getVblen(t,e),p=0,d=s.getChildIdx(t,e),g=0;g"u"||!C)&&(C={});(typeof C.asn1>"u"||!C.asn1)&&(C.asn1={});(typeof C.asn1.x509>"u"||!C.asn1.x509)&&(C.asn1.x509={});C.asn1.x509.Certificate=function(t){C.asn1.x509.Certificate.superclass.constructor.call(this);var e=C,r=e.asn1,n=r.DERBitString,i=r.DERSequence,s=r.x509,a=s.TBSCertificate,o=s.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(c){this.params=c},this.sign=function(){var c=this.params,u=c.sigalg;c.sigalg.name!=null&&(u=c.sigalg.name);var l=c.tbsobj.tohex(),h=new C.crypto.Signature({alg:u});h.init(c.cakey),h.updateHex(l),c.sighex=h.sign()},this.getPEM=function(){return yn(this.tohex(),"CERTIFICATE")},this.tohex=function(){var c=this.params;if((c.tbsobj==null||c.tbsobj==null)&&(c.tbsobj=new a(c)),c.sighex==null&&c.cakey!=null&&this.sign(),c.sighex==null)throw new Error("sighex or cakey parameter not defined");var u=[];u.push(c.tbsobj),u.push(new o({name:c.sigalg})),u.push(new n({hex:"00"+c.sighex}));var l=new i({array:u});return l.tohex()},this.getEncodedHex=function(){return this.tohex()},t!=null&&(this.params=t)};we(C.asn1.x509.Certificate,C.asn1.ASN1Object);C.asn1.x509.TBSCertificate=function(t){C.asn1.x509.TBSCertificate.superclass.constructor.call(this);var e=C,r=e.asn1,n=r.x509,i=r.DERTaggedObject,s=r.DERInteger,a=r.DERSequence,o=n.AlgorithmIdentifier,c=n.Time,u=n.X500Name,l=n.Extensions,h=n.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(f){this.params=f},this.tohex=function(){var f=[],p=this.params;if(p.version!=null||p.version!=1){var d=2;p.version!=null&&(d=p.version-1);var g=new i({obj:new s({int:d})});f.push(g)}f.push(new s(p.serial)),f.push(new o({name:p.sigalg})),f.push(new u(p.issuer)),f.push(new a({array:[new c(p.notbefore),new c(p.notafter)]})),f.push(new u(p.subject)),f.push(new h(ct.getKey(p.sbjpubkey))),p.ext!==void 0&&p.ext.length>0&&f.push(new i({tag:"a3",obj:new l(p.ext)}));var y=new C.asn1.DERSequence({array:f});return y.tohex()},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&this.setByParam(t)};we(C.asn1.x509.TBSCertificate,C.asn1.ASN1Object);C.asn1.x509.Extensions=function(t){C.asn1.x509.Extensions.superclass.constructor.call(this);var e=C,r=e.asn1,n=r.DERSequence,i=r.x509;this.aParam=[],this.setByParam=function(s){this.aParam=s},this.tohex=function(){for(var s=[],a=0;a-1&&s.push(new n({int:this.pathLen}));var a=new i({array:s});return this.asn1ExtnValue=a,this.asn1ExtnValue.tohex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,t!==void 0&&(t.cA!==void 0&&(this.cA=t.cA),t.pathLen!==void 0&&(this.pathLen=t.pathLen))};we(C.asn1.x509.BasicConstraints,C.asn1.x509.Extension);C.asn1.x509.CRLDistributionPoints=function(t){C.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,t);var e=C,r=e.asn1,n=r.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.setByDPArray=function(i){for(var s=[],a=0;a0&&s.push(new r({array:a}))}var c=new r({array:s});return c.tohex()},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&(this.params=t)};we(C.asn1.x509.PolicyInformation,C.asn1.ASN1Object);C.asn1.x509.PolicyQualifierInfo=function(t){C.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,t);var e=C.asn1,r=e.DERSequence,n=e.DERIA5String,i=e.DERObjectIdentifier,s=e.x509.UserNotice;this.params=null,this.tohex=function(){if(this.params.cps!==void 0){var a=new r({array:[new i({oid:"1.3.6.1.5.5.7.2.1"}),new n({str:this.params.cps})]});return a.tohex()}if(this.params.unotice!=null){var a=new r({array:[new i({oid:"1.3.6.1.5.5.7.2.2"}),new s(this.params.unotice)]});return a.tohex()}},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&(this.params=t)};we(C.asn1.x509.PolicyQualifierInfo,C.asn1.ASN1Object);C.asn1.x509.UserNotice=function(t){C.asn1.x509.UserNotice.superclass.constructor.call(this,t);var e=C.asn1.DERSequence;C.asn1.DERInteger;var r=C.asn1.x509.DisplayText,n=C.asn1.x509.NoticeReference;this.params=null,this.tohex=function(){var i=[];this.params.noticeref!==void 0&&i.push(new n(this.params.noticeref)),this.params.exptext!==void 0&&i.push(new r(this.params.exptext));var s=new e({array:i});return s.tohex()},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&(this.params=t)};we(C.asn1.x509.UserNotice,C.asn1.ASN1Object);C.asn1.x509.NoticeReference=function(t){C.asn1.x509.NoticeReference.superclass.constructor.call(this,t);var e=C.asn1.DERSequence,r=C.asn1.DERInteger,n=C.asn1.x509.DisplayText;this.params=null,this.tohex=function(){var i=[];if(this.params.org!==void 0&&i.push(new n(this.params.org)),this.params.noticenum!==void 0){for(var s=[],a=this.params.noticenum,o=0;o0)for(var s=0;s0;i++){var s=e.shift();if(r===!0){var a=n.pop(),o=(a+","+s).replace(/\\,/g,",");n.push(o),r=!1}else n.push(s);s.substr(-1,1)==="\\"&&(r=!0)}return n=n.map(function(c){return c.replace("/","\\/")}),n.reverse(),"/"+n.join("/")};C.asn1.x509.X500Name.ldapToOneline=function(t){return C.asn1.x509.X500Name.ldapToCompat(t)};C.asn1.x509.RDN=function(t){C.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var e=C.asn1.x509.AttributeTypeAndValue;this.setByParam=function(r){r.rule!==void 0&&(this.sRule=r.rule),r.str!==void 0&&this.addByMultiValuedString(r.str),r.array!==void 0&&(this.paramArray=r.array)},this.addByString=function(r){this.asn1Array.push(new C.asn1.x509.AttributeTypeAndValue({str:r,rule:this.sRule}))},this.addByMultiValuedString=function(r){for(var n=C.asn1.x509.RDN.parseString(r),i=0;i0)for(var r=0;r0;i++){var s=e.shift();if(r===!0){var a=n.pop(),o=(a+"+"+s).replace(/\\\+/g,"+");n.push(o),r=!1}else n.push(s);s.substr(-1,1)==="\\"&&(r=!0)}for(var c=!1,u=[],i=0;n.length>0;i++){var s=n.shift();if(c===!0){var l=u.pop();if(s.match(/"$/)){var o=(l+"+"+s).replace(/^([^=]+)="(.*)"$/,"$1=$2");u.push(o),c=!1}else u.push(l+"+"+s)}else u.push(s);s.match(/^[^=]+="/)&&(c=!0)}return u};C.asn1.x509.AttributeTypeAndValue=function(t){C.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var e=C,r=e.asn1,n=r.DERSequence,i=r.DERUTF8String,s=r.DERPrintableString,a=r.DERTeletexString,o=r.DERIA5String,c=r.DERVisibleString,u=r.DERBMPString,l=e.lang.String.isMail,h=e.lang.String.isPrintable;this.setByParam=function(f){if(f.rule!==void 0&&(this.sRule=f.rule),f.ds!==void 0&&(this.dsType=f.ds),f.value===void 0&&f.str!==void 0){var p=f.str,d=p.match(/^([^=]+)=(.+)$/);if(d)this.sType=d[1],this.sValue=d[2];else throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr)}else this.sType=f.type,this.sValue=f.value},this.setByString=function(f,p){p!==void 0&&(this.sRule=p);var d=f.match(/^([^=]+)=(.+)$/);if(d)this.setByAttrTypeAndValueStr(d[1],d[2]);else throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr)},this._getDsType=function(){var f=this.sType,p=this.sValue,d=this.sRule;return d==="prn"?f=="CN"&&l(p)?"ia5":h(p)?"prn":"utf8":d==="utf8"?f=="CN"&&l(p)?"ia5":f=="C"?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(f,p,d){d!==void 0&&(this.sRule=d),this.sType=f,this.sValue=p},this.getValueObj=function(f,p){if(f=="utf8")return new i({str:p});if(f=="prn")return new s({str:p});if(f=="tel")return new a({str:p});if(f=="ia5")return new o({str:p});if(f=="vis")return new c({str:p});if(f=="bmp")return new u({str:p});throw new Error("unsupported directory string type: type="+f+" value="+p)},this.tohex=function(){this.dsType==null&&(this.dsType=this._getDsType());var f=C.asn1.x509.OID.atype2obj(this.sType),p=this.getValueObj(this.dsType,this.sValue),d=new n({array:[f,p]});return this.TLV=d.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&this.setByParam(t)};we(C.asn1.x509.AttributeTypeAndValue,C.asn1.ASN1Object);C.asn1.x509.SubjectPublicKeyInfo=function(t){C.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var e=C,r=e.asn1,n=r.DERInteger,i=r.DERBitString,s=r.DERObjectIdentifier,a=r.DERSequence,o=r.ASN1Util.newObject,c=r.x509,u=c.AlgorithmIdentifier,l=e.crypto;l.ECDSA,l.DSA,this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null)throw"algId and/or subjPubKey not set";var h=new a({array:[this.asn1AlgId,this.asn1SubjPKey]});return h},this.tohex=function(){var h=this.getASN1Object();return this.hTLV=h.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.setPubKey=function(h){try{if(h instanceof Ze){var f=o({seq:[{int:{bigint:h.n}},{int:{int:h.e}}]}),p=f.tohex();this.asn1AlgId=new u({name:"rsaEncryption"}),this.asn1SubjPKey=new i({hex:"00"+p})}}catch{}try{if(h instanceof C.crypto.ECDSA){var d=new s({name:h.curveName});this.asn1AlgId=new u({name:"ecPublicKey",asn1params:d}),this.asn1SubjPKey=new i({hex:"00"+h.pubKeyHex})}}catch{}try{if(h instanceof C.crypto.DSA){var d=new o({seq:[{int:{bigint:h.p}},{int:{bigint:h.q}},{int:{bigint:h.g}}]});this.asn1AlgId=new u({name:"dsa",asn1params:d});var g=new n({bigint:h.y});this.asn1SubjPKey=new i({hex:"00"+g.tohex()})}}catch{}},t!==void 0&&this.setPubKey(t)};we(C.asn1.x509.SubjectPublicKeyInfo,C.asn1.ASN1Object);C.asn1.x509.Time=function(t){C.asn1.x509.Time.superclass.constructor.call(this);var e=C,r=e.asn1,n=r.DERUTCTime,i=r.DERGeneralizedTime;this.params=null,this.type=null,this.setTimeParams=function(s){this.timeParams=s},this.setByParam=function(s){this.params=s},this.getType=function(s){return s.match(/^[0-9]{12}Z$/)?"utc":s.match(/^[0-9]{14}Z$/)?"gen":s.match(/^[0-9]{12}\.[0-9]+Z$/)?"utc":s.match(/^[0-9]{14}\.[0-9]+Z$/)?"gen":null},this.tohex=function(){var s=this.params,a=null;if(typeof s=="string"&&(s={str:s}),s!=null&&s.str&&(s.type==null||s.type==null)&&(s.type=this.getType(s.str)),s!=null&&s.str?(s.type=="utc"&&(a=new n(s.str)),s.type=="gen"&&(a=new i(s.str))):this.type=="gen"?a=new i:a=new n,a==null)throw new Error("wrong setting for Time");return this.TLV=a.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},t!=null&&this.setByParam(t)};C.asn1.x509.Time_bak=function(t){C.asn1.x509.Time_bak.superclass.constructor.call(this);var e=C,r=e.asn1,n=r.DERUTCTime,i=r.DERGeneralizedTime;this.setTimeParams=function(s){this.timeParams=s},this.tohex=function(){var s=null;return this.timeParams!=null?this.type=="utc"?s=new n(this.timeParams):s=new i(this.timeParams):this.type=="utc"?s=new n:s=new i,this.TLV=s.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},this.type="utc",t!==void 0&&(t.type!==void 0?this.type=t.type:t.str!==void 0&&(t.str.match(/^[0-9]{12}Z$/)&&(this.type="utc"),t.str.match(/^[0-9]{14}Z$/)&&(this.type="gen")),this.timeParams=t)};we(C.asn1.x509.Time,C.asn1.ASN1Object);C.asn1.x509.AlgorithmIdentifier=function(t){C.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var e=C,r=e.asn1,n=r.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;if(this.tohex=function(){if(this.nameAlg===null&&this.asn1Alg===null)throw new Error("algorithm not specified");if(this.nameAlg!==null){var s=null;for(var a in n)a===this.nameAlg&&(s=n[a]);if(s!==null)return this.hTLV=s,this.hTLV}this.nameAlg!==null&&this.asn1Alg===null&&(this.asn1Alg=r.x509.OID.name2obj(this.nameAlg));var o=[this.asn1Alg];this.asn1Params!==null&&o.push(this.asn1Params);var c=new r.DERSequence({array:o});return this.hTLV=c.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&(t.name!==void 0&&(this.nameAlg=t.name),t.asn1params!==void 0&&(this.asn1Params=t.asn1params),t.paramempty!==void 0&&(this.paramEmpty=t.paramempty)),this.asn1Params===null&&this.paramEmpty===!1&&this.nameAlg!==null){this.nameAlg.name!==void 0&&(this.nameAlg=this.nameAlg.name);var i=this.nameAlg.toLowerCase();i.substr(-7,7)!=="withdsa"&&i.substr(-9,9)!=="withecdsa"&&(this.asn1Params=new r.DERNull)}};we(C.asn1.x509.AlgorithmIdentifier,C.asn1.ASN1Object);C.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"};C.asn1.x509.GeneralName=function(t){C.asn1.x509.GeneralName.superclass.constructor.call(this);var e=C,r=e.asn1,n=r.x509,i=n.X500Name,s=n.OtherName,a=r.DERIA5String;r.DERPrintableString;var o=r.DEROctetString,c=r.DERTaggedObject,u=r.ASN1Object,l=Error;this.params=null,this.setByParam=function(h){this.params=h},this.tohex=function(){var h=this.params,f,d,p,d=!1;if(h.other!==void 0)f="a0",p=new s(h.other);else if(h.rfc822!==void 0)f="81",p=new a({str:h.rfc822});else if(h.dns!==void 0)f="82",p=new a({str:h.dns});else if(h.dn!==void 0)f="a4",d=!0,typeof h.dn=="string"?p=new i({str:h.dn}):h.dn instanceof C.asn1.x509.X500Name?p=h.dn:p=new i(h.dn);else if(h.ldapdn!==void 0)f="a4",d=!0,p=new i({ldapstr:h.ldapdn});else if(h.certissuer!==void 0||h.certsubj!==void 0){f="a4",d=!0;var g,y,x=null;if(h.certsubj!==void 0?(g=!1,y=h.certsubj):(g=!0,y=h.certissuer),y.match(/^[0-9A-Fa-f]+$/),y.indexOf("-----BEGIN ")!=-1&&(x=xr(y)),x==null)throw new Error("certsubj/certissuer not cert");var b=new Ye;b.hex=x;var S;g?S=b.getIssuerHex():S=b.getSubjectHex(),p=new u,p.hTLV=S}else if(h.uri!==void 0)f="86",p=new a({str:h.uri});else if(h.ip!==void 0){f="87";var k,T=h.ip;try{if(T.match(/^[0-9a-f]+$/)){var _=T.length;if(_==8||_==16||_==32||_==64)k=T;else throw"err"}else k=dF(T)}catch(N){throw new l("malformed IP address: "+h.ip+":"+N.message)}p=new o({hex:k})}else throw new l("improper params");var B=new c({tag:f,explicit:d,obj:p});return B.tohex()},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&this.setByParam(t)};we(C.asn1.x509.GeneralName,C.asn1.ASN1Object);C.asn1.x509.GeneralNames=function(t){C.asn1.x509.GeneralNames.superclass.constructor.call(this);var e=C,r=e.asn1;this.setByParamArray=function(n){for(var i=0;i"u")throw"Name of ObjectIdentifier not defined: "+e;var r=this.name2oidList[e],n=new t({oid:r});return this.objCache[e]=n,n},this.atype2obj=function(e){if(this.objCache[e]!==void 0)return this.objCache[e];var r;if(e.match(/^\d+\.\d+\.[0-9.]+$/))r=e;else if(this.atype2oidList[e]!==void 0)r=this.atype2oidList[e];else if(this.name2oidList[e]!==void 0)r=this.name2oidList[e];else throw new Error("AttributeType name undefined: "+e);var n=new t({oid:r});return this.objCache[e]=n,n},this.registerOIDs=function(e){if(this.checkOIDs(e))for(var r in e)this.name2oidList[r]=e[r]},this.checkOIDs=function(e){try{var r=Object.keys(e);return r.length==0?!1:(r.map(function(n,i,s){var a=this[n];if(!a.match(/^[0-2]\.[0-9.]+$/))throw new Error("value is not OID")},e),!0)}catch{return!1}}};C.asn1.x509.OID.oid2name=function(t){var e=C.asn1.x509.OID.name2oidList;for(var r in e)if(e[r]==t)return r;return""};C.asn1.x509.OID.oid2atype=function(t){var e=C.asn1.x509.OID.atype2oidList;for(var r in e)if(e[r]==t)return r;return t};C.asn1.x509.OID.name2oid=function(t){if(t.match(/^[0-9.]+$/))return t;var e=C.asn1.x509.OID.name2oidList;return e[t]===void 0?"":e[t]};C.asn1.x509.X509Util={};C.asn1.x509.X509Util.newCertPEM=function(t){var e=C.asn1.x509;e.TBSCertificate;var r=e.Certificate,n=new r(t);return n.getPEM()};(typeof C>"u"||!C)&&(C={});(typeof C.asn1>"u"||!C.asn1)&&(C.asn1={});(typeof C.asn1.cms>"u"||!C.asn1.cms)&&(C.asn1.cms={});C.asn1.cms.Attribute=function(t){var e=Error,r=C,n=r.asn1,i=n.DERSequence,s=n.DERSet,a=n.DERObjectIdentifier;this.params=null,this.typeOid=null,this.setByParam=function(o){this.params=o},this.getValueArray=function(){throw new e("not yet implemented abstract")},this.tohex=function(){var o=new a({oid:this.typeOid}),c=new s({array:this.getValueArray()}),u=new i({array:[o,c]});return u.tohex()},this.getEncodedHex=function(){return this.tohex()}};we(C.asn1.cms.Attribute,C.asn1.ASN1Object);C.asn1.cms.ContentType=function(t){var e=C,r=e.asn1;r.cms.ContentType.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.3",this.getValueArray=function(){var n=new r.DERObjectIdentifier(this.params.type);return[n]},t!=null&&this.setByParam(t)};we(C.asn1.cms.ContentType,C.asn1.cms.Attribute);C.asn1.cms.MessageDigest=function(t){var e=C,r=e.asn1,n=r.DEROctetString,i=r.cms;i.MessageDigest.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.4",this.getValueArray=function(){var s=new n(this.params);return[s]},t!=null&&this.setByParam(t)};we(C.asn1.cms.MessageDigest,C.asn1.cms.Attribute);C.asn1.cms.SigningTime=function(t){var e=C,r=e.asn1;r.cms.SigningTime.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.5",this.getValueArray=function(){var n=new r.x509.Time(this.params);return[n]},t!=null&&this.setByParam(t)};we(C.asn1.cms.SigningTime,C.asn1.cms.Attribute);C.asn1.cms.SigningCertificate=function(t){var e=Error,r=C,n=r.asn1,i=n.DERSequence,s=n.cms,a=s.ESSCertID;r.crypto,s.SigningCertificate.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.12",this.getValueArray=function(){if(this.params==null||this.params==null||this.params.array==null)throw new e("parameter 'array' not specified");for(var o=this.params.array,c=[],u=0;u0){for(var p=s(h.valhex,f[0]),d=l(p,0),g=[],y=0;y1){var S=s(h.valhex,f[1]);h.polhex=S}delete h.valhex},this.setSignaturePolicyIdentifier=function(h){var f=l(h.valhex,0);if(f.length>0){var p=n.getOID(h.valhex,f[0]);h.oid=p}if(f.length>1){var d=new e,g=l(h.valhex,f[1]),y=s(h.valhex,g[0]),x=d.getAlgorithmIdentifierName(y);h.alg=x;var b=i(h.valhex,g[1]);h.hash=b}delete h.valhex},this.setSigningCertificateV2=function(h){var f=l(h.valhex,0);if(f.length>0){for(var p=s(h.valhex,f[0]),d=l(p,0),g=[],y=0;y1){var S=s(h.valhex,f[1]);h.polhex=S}delete h.valhex},this.getESSCertID=function(h){var f={},p=l(h,0);if(p.length>0){var d=i(h,p[0]);f.hash=d}if(p.length>1){var g=s(h,p[1]),y=this.getIssuerSerial(g);y.serial!=null&&(f.serial=y.serial),y.issuer!=null&&(f.issuer=y.issuer)}return f},this.getESSCertIDv2=function(h){var f={},p=l(h,0);if(p.length<1||3d+1){var x=s(h,p[d+1]),b=this.getIssuerSerial(x);f.issuer=b.issuer,f.serial=b.serial}return f},this.getIssuerSerial=function(h){var f={},p=l(h,0),d=s(h,p[0]),g=r.getGeneralNames(d),y=g[0].dn;f.issuer=y;var x=i(h,p[1]);return f.serial={hex:x},f},this.getCertificateSet=function(h){for(var f=l(h,0),p=[],d=0;d"u"||!C)&&(C={});(typeof C.asn1>"u"||!C.asn1)&&(C.asn1={});(typeof C.asn1.tsp>"u"||!C.asn1.tsp)&&(C.asn1.tsp={});C.asn1.tsp.TimeStampToken=function(t){var e=C,r=e.asn1,n=r.tsp;n.TimeStampToken.superclass.constructor.call(this),this.params=null,this.getEncodedHexPrepare=function(){var i=new n.TSTInfo(this.params.econtent.content);this.params.econtent.content.hex=i.tohex()},t!=null&&this.setByParam(t)};we(C.asn1.tsp.TimeStampToken,C.asn1.cms.SignedData);C.asn1.tsp.TSTInfo=function(t){var e=C,r=e.asn1,n=r.DERSequence,i=r.DERInteger,s=r.DERBoolean,a=r.DERGeneralizedTime,o=r.DERObjectIdentifier,c=r.DERTaggedObject,u=r.tsp,l=u.MessageImprint,h=u.Accuracy;r.x509.X500Name;var f=r.x509.GeneralName;if(u.TSTInfo.superclass.constructor.call(this),this.dVersion=new i({int:1}),this.dPolicy=null,this.dMessageImprint=null,this.dSerial=null,this.dGenTime=null,this.dAccuracy=null,this.dOrdering=null,this.dNonce=null,this.dTsa=null,this.tohex=function(){var p=[this.dVersion];if(this.dPolicy==null)throw new Error("policy shall be specified.");if(p.push(this.dPolicy),this.dMessageImprint==null)throw new Error("messageImprint shall be specified.");if(p.push(this.dMessageImprint),this.dSerial==null)throw new Error("serialNumber shall be specified.");if(p.push(this.dSerial),this.dGenTime==null)throw new Error("genTime shall be specified.");p.push(this.dGenTime),this.dAccuracy!=null&&p.push(this.dAccuracy),this.dOrdering!=null&&p.push(this.dOrdering),this.dNonce!=null&&p.push(this.dNonce),this.dTsa!=null&&p.push(this.dTsa);var d=new n({array:p});return this.hTLV=d.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},t!==void 0){if(typeof t.policy=="string"){if(!t.policy.match(/^[0-9.]+$/))throw"policy shall be oid like 0.1.4.134";this.dPolicy=new o({oid:t.policy})}t.messageImprint!==void 0&&(this.dMessageImprint=new l(t.messageImprint)),t.serial!==void 0&&(this.dSerial=new i(t.serial)),t.genTime!==void 0&&(this.dGenTime=new a(t.genTime)),t.accuracy!==void 0&&(this.dAccuracy=new h(t.accuracy)),t.ordering!==void 0&&t.ordering==!0&&(this.dOrdering=new s),t.nonce!==void 0&&(this.dNonce=new i(t.nonce)),t.tsa!==void 0&&(this.dTsa=new c({tag:"a0",explicit:!0,obj:new f({dn:t.tsa})}))}};we(C.asn1.tsp.TSTInfo,C.asn1.ASN1Object);C.asn1.tsp.Accuracy=function(t){var e=C,r=e.asn1,n=r.ASN1Util.newObject;r.tsp.Accuracy.superclass.constructor.call(this),this.params=null,this.tohex=function(){var i=this.params,s=[];return i.seconds!=null&&typeof i.seconds=="number"&&s.push({int:i.seconds}),i.millis!=null&&typeof i.millis=="number"&&s.push({tag:{tagi:"80",obj:{int:i.millis}}}),i.micros!=null&&typeof i.micros=="number"&&s.push({tag:{tagi:"81",obj:{int:i.micros}}}),n({seq:s}).tohex()},this.getEncodedHex=function(){return this.tohex()},t!=null&&this.setByParam(t)};we(C.asn1.tsp.Accuracy,C.asn1.ASN1Object);C.asn1.tsp.MessageImprint=function(t){var e=C,r=e.asn1,n=r.DERSequence,i=r.DEROctetString,s=r.x509,a=s.AlgorithmIdentifier;r.tsp.MessageImprint.superclass.constructor.call(this),this.params=null,this.tohex=function(){var o=this.params,c=new a({name:o.alg}),u=new i({hex:o.hash}),l=new n({array:[c,u]});return l.tohex()},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&this.setByParam(t)};we(C.asn1.tsp.MessageImprint,C.asn1.ASN1Object);C.asn1.tsp.TimeStampReq=function(t){var e=C,r=e.asn1,n=r.DERSequence,i=r.DERInteger,s=r.DERBoolean;r.ASN1Object;var a=r.DERObjectIdentifier,o=r.tsp,c=o.MessageImprint;o.TimeStampReq.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params,l=[];l.push(new i({int:1})),u.messageImprint instanceof C.asn1.ASN1Object?l.push(u.messageImprint):l.push(new c(u.messageImprint)),u.policy!=null&&l.push(new a(u.policy)),u.nonce!=null&&l.push(new i(u.nonce)),u.certreq==!0&&l.push(new s);var h=new n({array:l});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},t!=null&&this.setByParam(t)};we(C.asn1.tsp.TimeStampReq,C.asn1.ASN1Object);C.asn1.tsp.TimeStampResp=function(t){var e=C,r=e.asn1,n=r.DERSequence;r.ASN1Object;var i=r.tsp,s=i.PKIStatusInfo;i.TimeStampResp.superclass.constructor.call(this),this.params=null,this.tohex=function(){var a=this.params,o=[];if(a.econtent!=null||a.tst!=null)if(a.statusinfo!=null?o.push(new s(a.statusinfo)):o.push(new s("granted")),a.econtent!=null)o.push(new i.TimeStampToken(a).getContentInfo());else if(a.tst instanceof r.ASN1Object)o.push(a.tst);else throw new Error("improper member tst value");else if(a.statusinfo!=null)o.push(new s(a.statusinfo));else throw new Error("parameter for token nor statusinfo not specified");var c=new n({array:o});return c.tohex()},this.getEncodedHex=function(){return this.tohex()},t!=null&&this.setByParam(t)};we(C.asn1.tsp.TimeStampResp,C.asn1.ASN1Object);C.asn1.tsp.PKIStatusInfo=function(t){var e=Error,r=C,n=r.asn1,i=n.DERSequence,s=n.tsp,a=s.PKIStatus,o=s.PKIFreeText,c=s.PKIFailureInfo;s.PKIStatusInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params,l=[];if(typeof u=="string")l.push(new a(u));else{if(u.status==null)throw new e("property 'status' unspecified");l.push(new a(u.status)),u.statusstr!=null&&l.push(new o(u.statusstr)),u.failinfo!=null&&l.push(new c(u.failinfo))}var h=new i({array:l});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},t!=null&&this.setByParam(t)};we(C.asn1.tsp.PKIStatusInfo,C.asn1.ASN1Object);C.asn1.tsp.PKIStatus=function(t){var e=Error,r=C,n=r.asn1,i=n.DERInteger,s=n.tsp;s.PKIStatus.superclass.constructor.call(this);var a={granted:0,grantedWithMods:1,rejection:2,waiting:3,revocationWarning:4,revocationNotification:5};this.params=null,this.tohex=function(){var o=this.params,c;if(typeof o=="string")try{c=a[o]}catch{throw new e("undefined name: "+o)}else if(typeof o=="number")c=o;else throw new e("unsupported params");return new i({int:c}).tohex()},this.getEncodedHex=function(){return this.tohex()},t!=null&&this.setByParam(t)};we(C.asn1.tsp.PKIStatus,C.asn1.ASN1Object);C.asn1.tsp.PKIFreeText=function(t){var e=Error,r=C,n=r.asn1,i=n.DERSequence,s=n.DERUTF8String,a=n.tsp;a.PKIFreeText.superclass.constructor.call(this),this.params=null,this.tohex=function(){var o=this.params;if(!o instanceof Array)throw new e("wrong params: not array");for(var c=[],u=0;u=0;f--)h+=l[f];return h}else{if(typeof c=="string"&&o[c]!=null)return zw([c],o);if(typeof c=="object"&&c.length!=null)return zw(c,o);throw new e("wrong params")}},this.tohex=function(){this.params;var c=this.getBinValue();return new i({bin:c}).tohex()},this.getEncodedHex=function(){return this.tohex()},t!=null&&this.setByParam(t)};we(C.asn1.tsp.PKIFailureInfo,C.asn1.ASN1Object);C.asn1.tsp.AbstractTSAAdapter=function(t){this.getTSTHex=function(e,r){throw"not implemented yet"}};C.asn1.tsp.SimpleTSAAdapter=function(t){var e=C,r=e.asn1,n=r.tsp,i=e.crypto.Util.hashHex;n.SimpleTSAAdapter.superclass.constructor.call(this),this.params=null,this.serial=0,this.getTSTHex=function(s,a){var o=i(s,a);this.params.econtent.content.messageImprint={alg:a,hash:o},this.params.econtent.content.serial={int:this.serial++};var c=Math.floor(Math.random()*1e9);this.params.econtent.content.nonce={int:c};var u=new n.TimeStampToken(this.params);return u.getContentInfoEncodedHex()},t!==void 0&&(this.params=t)};we(C.asn1.tsp.SimpleTSAAdapter,C.asn1.tsp.AbstractTSAAdapter);C.asn1.tsp.FixedTSAAdapter=function(t){var e=C,r=e.asn1,n=r.tsp,i=e.crypto.Util.hashHex;n.FixedTSAAdapter.superclass.constructor.call(this),this.params=null,this.getTSTHex=function(s,a){var o=i(s,a);this.params.econtent.content.messageImprint={alg:a,hash:o};var c=new n.TimeStampToken(this.params);return c.getContentInfoEncodedHex()},t!==void 0&&(this.params=t)};we(C.asn1.tsp.FixedTSAAdapter,C.asn1.tsp.AbstractTSAAdapter);C.asn1.tsp.TSPUtil=new function(){};C.asn1.tsp.TSPUtil.newTimeStampToken=function(t){return new C.asn1.tsp.TimeStampToken(t)};C.asn1.tsp.TSPUtil.parseTimeStampReq=function(t){var e=new C.asn1.tsp.TSPParser;return e.getTimeStampReq(t)};C.asn1.tsp.TSPUtil.parseMessageImprint=function(t){var e=new C.asn1.tsp.TSPParser;return e.getMessageImprint(t)};C.asn1.tsp.TSPParser=function(){var t=Ye,e=new t,r=Ne,n=r.getV,i=r.getTLV,s=r.getIdxbyList;r.getTLVbyListEx;var a=r.getChildIdx,o=["granted","grantedWithMods","rejection","waiting","revocationWarning","revocationNotification"],c={0:"badAlg",2:"badRequest",5:"badDataFormat",14:"timeNotAvailable",15:"unacceptedPolicy",16:"unacceptedExtension",17:"addInfoNotAvailable",25:"systemFailure"};this.getResponse=function(u){var l=a(u,0);if(l.length==1)return this.getPKIStatusInfo(i(u,l[0]));if(l.length>1){var h=this.getPKIStatusInfo(i(u,l[0])),f=i(u,l[1]),p=this.getToken(f);return p.statusinfo=h,p}},this.getToken=function(u){var l=new C.asn1.cms.CMSParser,h=l.getCMSSignedData(u);return this.setTSTInfo(h),h},this.setTSTInfo=function(u){var l=u.econtent;if(l.type=="tstinfo"){var h=l.content.hex,f=this.getTSTInfo(h);l.content=f}},this.getTSTInfo=function(u){var l={},h=a(u,0),f=n(u,h[1]);l.policy=O8(f);var p=i(u,h[2]);l.messageImprint=this.getMessageImprint(p);var d=n(u,h[3]);l.serial={hex:d};var g=n(u,h[4]);l.genTime={str:St(g)};var y=0;if(h.length>5&&u.substr(h[5],2)=="30"){var x=i(u,h[5]);l.accuracy=this.getAccuracy(x),y++}if(h.length>5+y&&u.substr(h[5+y],2)=="01"){var b=n(u,h[5+y]);b=="ff"&&(l.ordering=!0),y++}if(h.length>5+y&&u.substr(h[5+y],2)=="02"){var S=n(u,h[5+y]);l.nonce={hex:S},y++}if(h.length>5+y&&u.substr(h[5+y],2)=="a0"){var k=i(u,h[5+y]);k="30"+k.substr(2),pGeneralNames=e.getGeneralNames(k);var T=pGeneralNames[0].dn;l.tsa=T,y++}if(h.length>5+y&&u.substr(h[5+y],2)=="a1"){var _=i(u,h[5+y]);_="30"+_.substr(2);var B=e.getExtParamArray(_);l.ext=B,y++}return l},this.getAccuracy=function(u){for(var l={},h=a(u,0),f=0;f1&&u.substr(h[1],2)=="30"){var g=i(u,h[1]);l.statusstr=this.getPKIFreeText(g),f++}if(h.length>f&&u.substr(h[1+f],2)=="03"){var y=i(u,h[1+f]);l.failinfo=this.getPKIFailureInfo(y)}return l},this.getPKIFreeText=function(u){for(var l=[],h=a(u,0),f=0;f"u"||!C)&&(C={});(typeof C.asn1>"u"||!C.asn1)&&(C.asn1={});(typeof C.asn1.cades>"u"||!C.asn1.cades)&&(C.asn1.cades={});C.asn1.cades.SignaturePolicyIdentifier=function(t){var e=C,r=e.asn1,n=r.cades,i=n.SignaturePolicyId;n.SignaturePolicyIdentifier.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.15",this.params=null,this.getValueArray=function(){return[new i(this.params)]},this.setByParam=function(s){this.params=s},t!=null&&this.setByParam(t)};we(C.asn1.cades.SignaturePolicyIdentifier,C.asn1.cms.Attribute);C.asn1.cades.SignaturePolicyId=function(t){var e=C,r=e.asn1,n=r.DERSequence,i=r.DERObjectIdentifier,s=r.x509;s.AlgorithmIdentifier;var a=r.cades,o=a.SignaturePolicyId,c=a.OtherHashAlgAndValue;o.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params,l=[];l.push(new i(u.oid)),l.push(new c(u));var h=new n({array:l});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(u){this.params=u},t!=null&&this.setByParam(t)};we(C.asn1.cades.SignaturePolicyId,C.asn1.ASN1Object);C.asn1.cades.OtherHashAlgAndValue=function(t){var e=Error,r=C,n=r.asn1,i=n.DERSequence,s=n.DEROctetString,a=n.x509,o=a.AlgorithmIdentifier,c=n.cades,u=c.OtherHashAlgAndValue;u.superclass.constructor.call(this),this.params=null,this.tohex=function(){var l=this.params;if(l.alg==null)throw new e("property 'alg' not specified");if(l.hash==null&&l.cert==null)throw new e("property 'hash' nor 'cert' not specified");var h=null;if(l.hash!=null)h=l.hash;else if(l.cert!=null){if(typeof l.cert!="string")throw new e("cert not string");var f=l.cert;l.cert.indexOf("-----BEGIN")!=-1&&(f=xr(l.cert)),h=C.crypto.Util.hashHex(f,l.alg)}var p=[];p.push(new o({name:l.alg})),p.push(new s({hex:h}));var d=new i({array:p});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},t!=null&&this.setByParam(t)};we(C.asn1.cades.OtherHashAlgAndValue,C.asn1.ASN1Object);C.asn1.cades.OtherHashValue=function(t){C.asn1.cades.OtherHashValue.superclass.constructor.call(this);var e=Error,r=C;r.lang.String.isHex;var n=r.asn1,i=n.DEROctetString;r.crypto.Util.hashHex,this.params=null,this.tohex=function(){var s=this.params;if(s.hash==null&&s.cert==null)throw new e("hash or cert not specified");var a=null;if(s.hash!=null)a=s.hash;else if(s.cert!=null){if(typeof s.cert!="string")throw new e("cert not string");var o=s.cert;s.cert.indexOf("-----BEGIN")!=-1&&(o=xr(s.cert)),a=C.crypto.Util.hashHex(o,"sha1")}return new i({hex:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},t!=null&&this.setByParam(t)};we(C.asn1.cades.OtherHashValue,C.asn1.ASN1Object);C.asn1.cades.SignatureTimeStamp=function(t){var e=Error,r=C,n=r.lang.String.isHex,i=r.asn1,s=i.ASN1Object;i.x509;var a=i.cades;a.SignatureTimeStamp.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.14",this.params=null,this.getValueArray=function(){var o=this.params;if(o.tst!=null)if(n(o.tst)){var c=new s;return c.hTLV=o.tst,[c]}else{if(o.tst instanceof s)return[o.tst];throw new e("params.tst has wrong value")}else if(o.res!=null){var u=o.res;if(u instanceof s&&(u=u.tohex()),typeof u!="string"||!n(u))throw new e("params.res has wrong value");Ne.getTLVbyList(u,0,[1]);var c=new s;return c.hTLV=o.tst,[c]}},t!=null&&this.setByParam(t)};we(C.asn1.cades.SignatureTimeStamp,C.asn1.cms.Attribute);C.asn1.cades.CompleteCertificateRefs=function(t){var e=Error,r=C,n=r.asn1,i=n.DERSequence,s=n.cades,a=s.OtherCertID,o=r.lang.String.isHex;s.CompleteCertificateRefs.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.21",this.params=null,this.getValueArray=function(){for(var c=this.params,u=[],l=0;l"u"||!C.asn1.csr)&&(C.asn1.csr={});C.asn1.csr.CertificationRequest=function(t){var e=C,r=e.asn1,n=r.DERBitString,i=r.DERSequence,s=r.csr;r.x509;var a=s.CertificationRequestInfo;s.CertificationRequest.superclass.constructor.call(this),this.setByParam=function(o){this.params=o},this.sign=function(){var o=new a(this.params).tohex(),c=new C.crypto.Signature({alg:this.params.sigalg});c.init(this.params.sbjprvkey),c.updateHex(o);var u=c.sign();this.params.sighex=u},this.getPEM=function(){return yn(this.tohex(),"CERTIFICATE REQUEST")},this.tohex=function(){var o=this.params,c=new C.asn1.csr.CertificationRequestInfo(this.params),u=new C.asn1.x509.AlgorithmIdentifier({name:o.sigalg});if(o.sighex==null&&o.sbjprvkey!=null&&this.sign(),o.sighex==null)throw new Error("sighex or sbjprvkey parameter not defined");var l=new n({hex:"00"+o.sighex}),h=new i({array:[c,u,l]});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&this.setByParam(t)};we(C.asn1.csr.CertificationRequest,C.asn1.ASN1Object);C.asn1.csr.CertificationRequestInfo=function(t){var e=C,r=e.asn1;r.DERBitString;var n=r.DERSequence,i=r.DERInteger,s=r.DERUTF8String,a=r.DERTaggedObject,o=r.ASN1Util.newObject,c=r.csr,u=r.x509,l=u.X500Name,h=u.Extensions,f=u.SubjectPublicKeyInfo;c.AttributeList,c.CertificationRequestInfo.superclass.constructor.call(this),this.params=null,this.setByParam=function(d){d!=null&&(this.params=d)},this.tohex=function(){var d=this.params,g=[];if(g.push(new i({int:0})),g.push(new l(d.subject)),g.push(new f(ct.getKey(d.sbjpubkey))),d.attrs!=null){var y=p(d.attrs),x=o({tag:{tage:"a0",obj:y}});g.push(x)}else if(d.extreq!=null){var b=new h(d.extreq),x=o({tag:{tage:"a0",obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[b]}]}}});g.push(x)}else g.push(new a({tag:"a0",explicit:!1,obj:new s({str:""})}));var S=new n({array:g});return S.tohex()},this.getEncodedHex=function(){return this.tohex()};function p(d){for(var g=Error,y=C.asn1.x509.Extensions,x=[],b=0;b"u"||!C)&&(C={});(typeof C.asn1>"u"||!C.asn1)&&(C.asn1={});(typeof C.asn1.ocsp>"u"||!C.asn1.ocsp)&&(C.asn1.ocsp={});C.asn1.ocsp.DEFAULT_HASH="sha1";C.asn1.ocsp.OCSPResponse=function(t){C.asn1.ocsp.OCSPResponse.superclass.constructor.call(this),C.asn1.DEREnumerated;var e=C.asn1.ASN1Util.newObject,r=C.asn1.ocsp.ResponseBytes,n=["successful","malformedRequest","internalError","tryLater","_not_used_","sigRequired","unauthorized"];this.params=null,this._getStatusCode=function(){var i=this.params.resstatus;return typeof i=="number"?i:typeof i!="string"?-1:n.indexOf(i)},this.setByParam=function(i){this.params=i},this.tohex=function(){var i=this.params,s=this._getStatusCode();if(s==-1)throw new Error("responseStatus not supported: "+i.resstatus);if(s!=0)return e({seq:[{enum:{int:s}}]}).tohex();var a=new r(i);return e({seq:[{enum:{int:0}},{tag:{tag:"a0",explicit:!0,obj:a}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&this.setByParam(t)};we(C.asn1.ocsp.OCSPResponse,C.asn1.ASN1Object);C.asn1.ocsp.ResponseBytes=function(t){C.asn1.ocsp.ResponseBytes.superclass.constructor.call(this);var e=C.asn1,r=e.DERSequence,n=e.DERObjectIdentifier,i=e.DEROctetString,s=e.ocsp.BasicOCSPResponse;this.params=null,this.setByParam=function(a){this.params=a},this.tohex=function(){var a=this.params;if(a.restype!="ocspBasic")throw new Error("not supported responseType: "+a.restype);var o=new s(a),c=[];c.push(new n({name:"ocspBasic"})),c.push(new i({hex:o.tohex()}));var u=new r({array:c});return u.tohex()},this.getEncodedHex=function(){return this.tohex()},t!==void 0&&this.setByParam(t)};we(C.asn1.ocsp.ResponseBytes,C.asn1.ASN1Object);C.asn1.ocsp.BasicOCSPResponse=function(t){C.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var e=Error,r=C.asn1,n=r.ASN1Object,i=r.DERSequence;r.DERGeneralizedTime;var s=r.DERTaggedObject,a=r.DERBitString;r.x509.Extensions;var o=r.x509.AlgorithmIdentifier,c=r.ocsp;c.ResponderID,_SingleResponseList=c.SingleResponseList,_ResponseData=c.ResponseData,this.params=null,this.setByParam=function(u){this.params=u},this.sign=function(){var u=this.params,l=u.tbsresp.tohex(),h=new C.crypto.Signature({alg:u.sigalg});h.init(u.reskey),h.updateHex(l),u.sighex=h.sign()},this.tohex=function(){var u=this.params;u.tbsresp==null&&(u.tbsresp=new _ResponseData(u)),u.sighex==null&&u.reskey!=null&&this.sign();var l=[];if(l.push(u.tbsresp),l.push(new o({name:u.sigalg})),l.push(new a({hex:"00"+u.sighex})),u.certs!=null&&u.certs.length!=null){for(var h=[],f=0;f"u"||!C)&&(C={});(typeof C.lang>"u"||!C.lang)&&(C.lang={});C.lang.String=function(){};function Ree(t){for(var e=new Array,r=0;r>6,c=128|a&63;return St(o.toString(16)+c.toString(16))}var o=224|(s&240)>>4,c=128|(s&15)<<2|(a&192)>>6,u=128|a&63;return St(o.toString(16)+c.toString(16)+u.toString(16))}var r=t.match(/.{4}/g),n=r.map(e);return n.join("")}function gF(t){for(var e=encodeURIComponent(t),r="",n=0;n"7"?"00"+t:t}function qee(t){var e=function(o){var c=o.toString(16);return c.length==1&&(c="0"+c),c},r=function(o){var c="",u=parseInt(o,10),l=u.toString(2),h=7-l.length%7;h==7&&(h=0);for(var f="",p=0;p0&&(u=u+"."+o.join(".")),u}catch{return null}}function Kee(t){var e=new ie(String(t),10);return Yv(e)}function Yv(t){var e=t.toString(16);if(e.substr(0,1)!="-")return e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e),e;var r=e.substr(1),n=r.length;n%2==1?n+=1:e.match(/^[0-7]/)||(n+=2);for(var i="",s=0;s=e?t:new Array(e-t.length+1).join(r)+t};function Wee(t){if(t.length%2!=0||(t=t.toLowerCase(),t.match(/^[0-9a-f]+$/)==null))return-1;try{var e=t.substr(0,2);if(e=="00")return parseInt(t.substr(2),16);var r=parseInt(e,16);if(r>7)return-1;var n=t.substr(2),i=parseInt(n,16).toString(2);i=="0"&&(i="00000000"),i=i.slice(0,0-r);var s=parseInt(i,2);return s==NaN?-1:s}catch{return-1}}function Gee(t){if(typeof t!="string"||t.length%2!=0||!t.match(/^[0-9a-f]+$/))return null;try{var e=parseInt(t.substr(0,2),16);if(e<0||7=0;n--)s+=i[n];return s}function Ft(t,n,r){if(typeof t=="object"){for(var n=String(n).split("."),i=0;i"u"||!C)&&(C={});(typeof C.crypto>"u"||!C.crypto)&&(C.crypto={});C.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:Re.algo.MD5,sha1:Re.algo.SHA1,sha224:Re.algo.SHA224,sha256:Re.algo.SHA256,sha384:Re.algo.SHA384,sha512:Re.algo.SHA512,ripemd160:Re.algo.RIPEMD160},this.getDigestInfoHex=function(t,e){if(typeof this.DIGESTINFOHEAD[e]>"u")throw"alg not supported in Util.DIGESTINFOHEAD: "+e;return this.DIGESTINFOHEAD[e]+t},this.getPaddedDigestInfoHex=function(t,e,r){var n=this.getDigestInfoHex(t,e),i=r/4;if(n.length+22>i)throw"key is too short for SigAlg: keylen="+r+","+e;for(var s="0001",a="00"+n,o="",c=i-s.length-a.length,u=0;u"u"||!C)&&(C={});(typeof C.crypto>"u"||!C.crypto)&&(C.crypto={});C.crypto.ECDSA=function(t){var e="secp256r1",r=Error,n=ie,i=bt,s=C.crypto.ECDSA,a=C.crypto.ECParameterDB,o=s.getName,c=Ne,u=c.getVbyListEx,l=c.isASN1HEX,h=new ll;this.type="EC",this.isPrivate=!1,this.isPublic=!1,this.getBigRandom=function(f){return new n(f.bitLength(),h).mod(f.subtract(n.ONE)).add(n.ONE)},this.setNamedCurve=function(f){this.ecparams=a.getByName(f),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=f},this.setPrivateKeyHex=function(f){this.isPrivate=!0,this.prvKeyHex=f},this.setPublicKeyHex=function(f){this.isPublic=!0,this.pubKeyHex=f},this.getPublicKeyXYHex=function(){var f=this.pubKeyHex;if(f.substr(0,2)!=="04")throw"this method supports uncompressed format(04) only";var p=this.ecparams.keycharlen;if(f.length!==2+p*2)throw"malformed public key hex length";var d={};return d.x=f.substr(2,p),d.y=f.substr(2+p),d},this.getShortNISTPCurveName=function(){var f=this.curveName;return f==="secp256r1"||f==="NIST P-256"||f==="P-256"||f==="prime256v1"?"P-256":f==="secp384r1"||f==="NIST P-384"||f==="P-384"?"P-384":f==="secp521r1"||f==="NIST P-521"||f==="P-521"?"P-521":null},this.generateKeyPairHex=function(){var f=this.ecparams.n,p=this.getBigRandom(f),d=this.ecparams.keycharlen,g=("0000000000"+p.toString(16)).slice(-d);this.setPrivateKeyHex(g);var y=this.generatePublicKeyHex();return{ecprvhex:g,ecpubhex:y}},this.generatePublicKeyHex=function(){var f=new n(this.prvKeyHex,16),p=this.ecparams.G.multiply(f),d=p.getX().toBigInteger(),g=p.getY().toBigInteger(),y=this.ecparams.keycharlen,x=("0000000000"+d.toString(16)).slice(-y),b=("0000000000"+g.toString(16)).slice(-y),S="04"+x+b;return this.setPublicKeyHex(S),S},this.signWithMessageHash=function(f){return this.signHex(f,this.prvKeyHex)},this.signHex=function(f,p){var d=new n(p,16),g=this.ecparams.n,y=new n(f.substring(0,this.ecparams.keycharlen),16);do var x=this.getBigRandom(g),b=this.ecparams.G,S=b.multiply(x),k=S.getX().toBigInteger().mod(g);while(k.compareTo(n.ZERO)<=0);var T=x.modInverse(g).multiply(y.add(d.multiply(k))).mod(g);return s.biRSSigToASN1Sig(k,T)},this.sign=function(f,p){var d=p,g=this.ecparams.n,y=n.fromByteArrayUnsigned(f);do var x=this.getBigRandom(g),b=this.ecparams.G,S=b.multiply(x),k=S.getX().toBigInteger().mod(g);while(k.compareTo(ie.ZERO)<=0);var T=x.modInverse(g).multiply(y.add(d.multiply(k))).mod(g);return this.serializeSig(k,T)},this.verifyWithMessageHash=function(f,p){return this.verifyHex(f,p,this.pubKeyHex)},this.verifyHex=function(f,p,d){try{var g,y,x=s.parseSigHex(p);g=x.r,y=x.s;var b=i.decodeFromHex(this.ecparams.curve,d),S=new n(f.substring(0,this.ecparams.keycharlen),16);return this.verifyRaw(S,g,y,b)}catch{return!1}},this.verify=function(f,p,d){var g,y;if(Bitcoin.Util.isArray(p)){var x=this.parseSig(p);g=x.r,y=x.s}else if(typeof p=="object"&&p.r&&p.s)g=p.r,y=p.s;else throw"Invalid value for signature";var b;if(d instanceof bt)b=d;else if(Bitcoin.Util.isArray(d))b=i.decodeFrom(this.ecparams.curve,d);else throw"Invalid format for pubkey value, must be byte array or ECPointFp";var S=n.fromByteArrayUnsigned(f);return this.verifyRaw(S,g,y,b)},this.verifyRaw=function(f,p,d,g){var y=this.ecparams.n,x=this.ecparams.G;if(p.compareTo(n.ONE)<0||p.compareTo(y)>=0||d.compareTo(n.ONE)<0||d.compareTo(y)>=0)return!1;var b=d.modInverse(y),S=f.multiply(b).mod(y),k=p.multiply(b).mod(y),T=x.multiply(S).add(g.multiply(k)),_=T.getX().toBigInteger().mod(y);return _.equals(p)},this.serializeSig=function(f,p){var d=f.toByteArraySigned(),g=p.toByteArraySigned(),y=[];return y.push(2),y.push(d.length),y=y.concat(d),y.push(2),y.push(g.length),y=y.concat(g),y.unshift(y.length),y.unshift(48),y},this.parseSig=function(f){var p;if(f[0]!=48)throw new Error("Signature not a valid DERSequence");if(p=2,f[p]!=2)throw new Error("First element in signature must be a DERInteger");var d=f.slice(p+2,p+2+f[p+1]);if(p+=2+f[p+1],f[p]!=2)throw new Error("Second element in signature must be a DERInteger");var g=f.slice(p+2,p+2+f[p+1]);p+=2+f[p+1];var y=n.fromByteArrayUnsigned(d),x=n.fromByteArrayUnsigned(g);return{r:y,s:x}},this.parseSigCompact=function(f){if(f.length!==65)throw"Signature has the wrong length";var p=f[0]-27;if(p<0||p>7)throw"Invalid signature type";var d=this.ecparams.n,g=n.fromByteArrayUnsigned(f.slice(1,33)).mod(d),y=n.fromByteArrayUnsigned(f.slice(33,65)).mod(d);return{r:g,s:y,i:p}},this.readPKCS5PrvKeyHex=function(f){if(l(f)===!1)throw new Error("not ASN.1 hex string");var p,d,g;try{p=u(f,0,["[0]",0],"06"),d=u(f,0,[1],"04");try{g=u(f,0,["[1]",0],"03")}catch{}}catch{throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=o(p),this.curveName===void 0)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(g),this.setPrivateKeyHex(d),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(f){if(l(f)===!1)throw new r("not ASN.1 hex string");var p,d,g,y;try{p=u(f,0,[1,0],"06"),d=u(f,0,[1,1],"06"),g=u(f,0,[2,0,1],"04");try{y=u(f,0,[2,0,"[1]",0],"03")}catch{}}catch{throw new r("malformed PKCS#8 plain ECC private key")}if(this.curveName=o(d),this.curveName===void 0)throw new r("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(y),this.setPrivateKeyHex(g),this.isPublic=!1},this.readPKCS8PubKeyHex=function(f){if(l(f)===!1)throw new r("not ASN.1 hex string");var p,d,g;try{p=u(f,0,[0,0],"06"),d=u(f,0,[0,1],"06"),g=u(f,0,[1],"03")}catch{throw new r("malformed PKCS#8 ECC public key")}if(this.curveName=o(d),this.curveName===null)throw new r("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(g)},this.readCertPubKeyHex=function(f,p){if(l(f)===!1)throw new r("not ASN.1 hex string");var d,g;try{d=u(f,0,[0,5,0,1],"06"),g=u(f,0,[0,5,1],"03")}catch{throw new r("malformed X.509 certificate ECC public key")}if(this.curveName=o(d),this.curveName===null)throw new r("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(g)},t!==void 0&&t.curve!==void 0&&(this.curveName=t.curve),this.curveName===void 0&&(this.curveName=e),this.setNamedCurve(this.curveName),t!==void 0&&(t.prv!==void 0&&this.setPrivateKeyHex(t.prv),t.pub!==void 0&&this.setPublicKeyHex(t.pub))};C.crypto.ECDSA.parseSigHex=function(t){var e=C.crypto.ECDSA.parseSigHexInHexRS(t),r=new ie(e.r,16),n=new ie(e.s,16);return{r,s:n}};C.crypto.ECDSA.parseSigHexInHexRS=function(t){var e=Ne,r=e.getChildIdx,n=e.getV;if(e.checkStrictDER(t,0),t.substr(0,2)!="30")throw new Error("signature is not a ASN.1 sequence");var i=r(t,0);if(i.length!=2)throw new Error("signature shall have two elements");var s=i[0],a=i[1];if(t.substr(s,2)!="02")throw new Error("1st item not ASN.1 integer");if(t.substr(a,2)!="02")throw new Error("2nd item not ASN.1 integer");var o=n(t,s),c=n(t,a);return{r:o,s:c}};C.crypto.ECDSA.asn1SigToConcatSig=function(t){var e=C.crypto.ECDSA.parseSigHexInHexRS(t),r=e.r,n=e.s;if(r.length>=130&&r.length<=134){if(r.length%2!=0)throw Error("unknown ECDSA sig r length error");if(n.length%2!=0)throw Error("unknown ECDSA sig s length error");r.substr(0,2)=="00"&&(r=r.substr(2)),n.substr(0,2)=="00"&&(n=n.substr(2));var i=Math.max(r.length,n.length);return r=("000000"+r).slice(-i),n=("000000"+n).slice(-i),r+n}if(r.substr(0,2)=="00"&&r.length%32==2&&(r=r.substr(2)),n.substr(0,2)=="00"&&n.length%32==2&&(n=n.substr(2)),r.length%32==30&&(r="00"+r),n.length%32==30&&(n="00"+n),r.length%32!=0)throw Error("unknown ECDSA sig r length error");if(n.length%32!=0)throw Error("unknown ECDSA sig s length error");return r+n};C.crypto.ECDSA.concatSigToASN1Sig=function(t){if(t.length%4!=0)throw Error("unknown ECDSA concatinated r-s sig length error");var e=t.substr(0,t.length/2),r=t.substr(t.length/2);return C.crypto.ECDSA.hexRSSigToASN1Sig(e,r)};C.crypto.ECDSA.hexRSSigToASN1Sig=function(t,e){var r=new ie(t,16),n=new ie(e,16);return C.crypto.ECDSA.biRSSigToASN1Sig(r,n)};C.crypto.ECDSA.biRSSigToASN1Sig=function(t,e){var r=C.asn1,n=new r.DERInteger({bigint:t}),i=new r.DERInteger({bigint:e}),s=new r.DERSequence({array:[n,i]});return s.tohex()};C.crypto.ECDSA.getName=function(t){return t==="2b8104001f"?"secp192k1":t==="2a8648ce3d030107"?"secp256r1":t==="2b8104000a"?"secp256k1":t==="2b81040021"?"secp224r1":t==="2b81040022"?"secp384r1":t==="2b81040023"?"secp521r1":"|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(t)!==-1?"secp256r1":"|secp256k1|".indexOf(t)!==-1?"secp256k1":"|secp224r1|NIST P-224|P-224|".indexOf(t)!==-1?"secp224r1":"|secp384r1|NIST P-384|P-384|".indexOf(t)!==-1?"secp384r1":"|secp521r1|NIST P-521|P-521|".indexOf(t)!==-1?"secp521r1":null};(typeof C>"u"||!C)&&(C={});(typeof C.crypto>"u"||!C.crypto)&&(C.crypto={});C.crypto.ECParameterDB=new function(){var t={},e={};function r(n){return new ie(n,16)}this.getByName=function(n){var i=n;if(typeof e[i]<"u"&&(i=e[n]),typeof t[i]<"u")return t[i];throw"unregistered EC curve name: "+i},this.regist=function(n,i,s,a,o,c,u,l,h,f,p,d){t[n]={};var g=r(s),y=r(a),x=r(o),b=r(c),S=r(u),k=new $c(g,y,x),T=k.decodePointHex("04"+l+h);t[n].name=n,t[n].keylen=i,t[n].keycharlen=Math.ceil(i/8)*2,t[n].curve=k,t[n].G=T,t[n].n=b,t[n].h=S,t[n].oid=p,t[n].info=d;for(var _=0;_"u"||!C)&&(C={});(typeof C.crypto>"u"||!C.crypto)&&(C.crypto={});C.crypto.DSA=function(){var t=Ne;t.getVbyList;var e=t.getVbyListEx,r=t.isASN1HEX,n=ie;this.p=null,this.q=null,this.g=null,this.y=null,this.x=null,this.type="DSA",this.isPrivate=!1,this.isPublic=!1,this.setPrivate=function(i,s,a,o,c){this.isPrivate=!0,this.p=i,this.q=s,this.g=a,this.y=o,this.x=c},this.setPrivateHex=function(i,s,a,o,c){var u,l,h,f,p;u=new ie(i,16),l=new ie(s,16),h=new ie(a,16),typeof o=="string"&&o.length>1?f=new ie(o,16):f=null,p=new ie(c,16),this.setPrivate(u,l,h,f,p)},this.setPublic=function(i,s,a,o){this.isPublic=!0,this.p=i,this.q=s,this.g=a,this.y=o,this.x=null},this.setPublicHex=function(i,s,a,o){var c,u,l,h;c=new ie(i,16),u=new ie(s,16),l=new ie(a,16),h=new ie(o,16),this.setPublic(c,u,l,h)},this.signWithMessageHash=function(i){var s=this.p,a=this.q,o=this.g;this.y;var c=this.x,u=C.crypto.Util.getRandomBigIntegerMinToMax(ie.ONE.add(ie.ONE),a.subtract(ie.ONE)),l=i.substr(0,a.bitLength()/4),h=new ie(l,16),f=o.modPow(u,s).mod(a),p=u.modInverse(a).multiply(h.add(c.multiply(f))).mod(a),d=C.asn1.ASN1Util.jsonToASN1HEX({seq:[{int:{bigint:f}},{int:{bigint:p}}]});return d},this.verifyWithMessageHash=function(i,s){var a=this.p,o=this.q,c=this.g,u=this.y,l=this.parseASN1Signature(s),h=l[0],f=l[1],p=i.substr(0,o.bitLength()/4),d=new ie(p,16);if(ie.ZERO.compareTo(h)>0||h.compareTo(o)>0||ie.ZERO.compareTo(f)>=0||f.compareTo(o)>0)throw"invalid DSA signature";var g=f.modInverse(o),y=d.multiply(g).mod(o),x=h.multiply(g).mod(o),b=c.modPow(y,a).multiply(u.modPow(x,a)).mod(a).mod(o);return b.compareTo(h)==0},this.parseASN1Signature=function(i){try{var s=new n(e(i,0,[0],"02"),16),a=new n(e(i,0,[1],"02"),16);return[s,a]}catch{throw new Error("malformed ASN.1 DSA signature")}},this.readPKCS5PrvKeyHex=function(i){var s,a,o,c,u;if(r(i)===!1)throw new Error("not ASN.1 hex string");try{s=e(i,0,[1],"02"),a=e(i,0,[2],"02"),o=e(i,0,[3],"02"),c=e(i,0,[4],"02"),u=e(i,0,[5],"02")}catch{throw new Error("malformed PKCS#1/5 plain DSA private key")}this.setPrivateHex(s,a,o,c,u)},this.readPKCS8PrvKeyHex=function(i){var s,a,o,c;if(r(i)===!1)throw new Error("not ASN.1 hex string");try{s=e(i,0,[1,1,0],"02"),a=e(i,0,[1,1,1],"02"),o=e(i,0,[1,1,2],"02"),c=e(i,0,[2,0],"02")}catch{throw new Error("malformed PKCS#8 plain DSA private key")}this.setPrivateHex(s,a,o,null,c)},this.readPKCS8PubKeyHex=function(i){var s,a,o,c;if(r(i)===!1)throw new Error("not ASN.1 hex string");try{s=e(i,0,[0,1,0],"02"),a=e(i,0,[0,1,1],"02"),o=e(i,0,[0,1,2],"02"),c=e(i,0,[1,0],"02")}catch{throw new Error("malformed PKCS#8 DSA public key")}this.setPublicHex(s,a,o,c)},this.readCertPubKeyHex=function(i,s){var a,o,c,u;if(r(i)===!1)throw new Error("not ASN.1 hex string");try{a=e(i,0,[0,5,0,1,0],"02"),o=e(i,0,[0,5,0,1,1],"02"),c=e(i,0,[0,5,0,1,2],"02"),u=e(i,0,[0,5,1,0],"02")}catch{throw new Error("malformed X.509 certificate DSA public key")}this.setPublicHex(a,o,c,u)}};var ct=function(){var t=function(d,g,y){return n(Re.AES,d,g,y)},e=function(d,g,y){return n(Re.TripleDES,d,g,y)},r=function(d,g,y){return n(Re.DES,d,g,y)},n=function(d,g,y,x){var b=Re.enc.Hex.parse(g),S=Re.enc.Hex.parse(y),k=Re.enc.Hex.parse(x),T={};T.key=S,T.iv=k,T.ciphertext=b;var _=d.decrypt(T,S,{iv:k});return Re.enc.Hex.stringify(_)},i=function(d,g,y){return o(Re.AES,d,g,y)},s=function(d,g,y){return o(Re.TripleDES,d,g,y)},a=function(d,g,y){return o(Re.DES,d,g,y)},o=function(d,g,y,x){var b=Re.enc.Hex.parse(g),S=Re.enc.Hex.parse(y),k=Re.enc.Hex.parse(x),T=d.encrypt(b,S,{iv:k}),_=Re.enc.Hex.parse(T.toString()),B=Re.enc.Base64.stringify(_);return B},c={"AES-256-CBC":{proc:t,eproc:i,keylen:32,ivlen:16},"AES-192-CBC":{proc:t,eproc:i,keylen:24,ivlen:16},"AES-128-CBC":{proc:t,eproc:i,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:e,eproc:s,keylen:24,ivlen:8},"DES-CBC":{proc:r,eproc:a,keylen:8,ivlen:8}},u=function(d){var g=Re.lib.WordArray.random(d),y=Re.enc.Hex.stringify(g);return y},l=function(d){var g={},y=d.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));y&&(g.cipher=y[1],g.ivsalt=y[2]);var x=d.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));x&&(g.type=x[1]);var b=-1,S=0;d.indexOf(`\r -\r -`)!=-1&&(b=d.indexOf(`\r -\r -`),S=2),d.indexOf(` - -`)!=-1&&(b=d.indexOf(` - -`),S=1);var k=d.indexOf("-----END");if(b!=-1&&k!=-1){var T=d.substring(b+S*2,k-S);T=T.replace(/\s+/g,""),g.data=T}return g},h=function(d,g,y){for(var x=y.substring(0,16),b=Re.enc.Hex.parse(x),S=Re.enc.Utf8.parse(g),k=c[d].keylen+c[d].ivlen,T="",_=null;;){var B=Re.algo.MD5.create();if(_!=null&&B.update(_),B.update(S),B.update(b),_=B.finalize(),T=T+Re.enc.Hex.stringify(_),T.length>=k*2)break}var N={};return N.keyhex=T.substr(0,c[d].keylen*2),N.ivhex=T.substr(c[d].keylen*2,c[d].ivlen*2),N},f=function(d,g,y,x){var b=Re.enc.Base64.parse(d),S=Re.enc.Hex.stringify(b),k=c[g].proc,T=k(S,y,x);return T},p=function(d,g,y,x){var b=c[g].eproc,S=b(d,y,x);return S};return{version:"1.0.0",parsePKCS5PEM:function(d){return l(d)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(d,g,y){return h(d,g,y)},decryptKeyB64:function(d,g,y,x){return f(d,g,y,x)},getDecryptedKeyHex:function(d,g){var y=l(d),x=y.cipher,b=y.ivsalt,S=y.data,k=h(x,g,b),T=k.keyhex,_=f(S,x,T,b);return _},getEncryptedPKCS5PEMFromPrvKeyHex:function(d,g,y,x,b){var P="";if((typeof x>"u"||x==null)&&(x="AES-256-CBC"),typeof c[x]>"u")throw new Error("KEYUTIL unsupported algorithm: "+x);if(typeof b>"u"||b==null){var S=c[x].ivlen,k=u(S);b=k.toUpperCase()}var T=h(x,y,b),_=T.keyhex,B=p(g,x,_,b),N=B.replace(/(.{64})/g,`$1\r -`),P="-----BEGIN "+d+` PRIVATE KEY-----\r -`;return P+=`Proc-Type: 4,ENCRYPTED\r -`,P+="DEK-Info: "+x+","+b+`\r -`,P+=`\r -`,P+=N,P+=`\r ------END `+d+` PRIVATE KEY-----\r -`,P},getEncryptedPKCS8PEM:function(d,g,y){var x=this.getEncryptedPKCS8Hex(d,g,y);return yn(x,"ENCRYPTED PRIVATE KEY")},getEncryptedPKCS8Hex:function(d,g,y){var x;y==null||y==null?x={}:x=JSON.parse(JSON.stringify(y)),x.plain=d,this.initPBES2Param(x),this.encryptPBES2Param(x,g);var b=this.generatePBES2ASN1Param(x);return C.asn1.ASN1Util.newObject(b).tohex()},initPBES2Param:function(d){if(Ft(d,"encalg")==null&&(d.encalg="aes256-CBC"),Ft(d,"iter")==null&&(d.iter=2048),Ft(d,"prf")==null&&(d.prf="hmacWithSHA256"),Ft(d,"salt")==null&&(d.salt=Re.enc.Hex.stringify(Re.lib.WordArray.random(8))),Ft(d,"enciv")==null){var g;d.encalg=="des-EDE3-CBC"&&(g=8),d.encalg=="aes128-CBC"&&(g=16),d.encalg=="aes256-CBC"&&(g=16),d.enciv=Re.enc.Hex.stringify(Re.lib.WordArray.random(g))}},encryptPBES2Param:function(d,g){var y=ct.getDKFromPBES2Param(d,g);try{var x=C.crypto.Cipher.encrypt(d.plain,y,d.encalg,{iv:d.enciv})}catch{throw new Error("encrypt error: "+d.plain+" "+y+" "+d.encalg+" "+d.enciv)}d.enc=x},generatePBES2ASN1Param:function(d){var g={seq:[{seq:[{oid:"pkcs5PBES2"},{seq:[{seq:[{oid:"pkcs5PBKDF2"},{seq:[{octstr:{hex:d.salt}},{int:{hex:Kee(d.iter)}}]}]},{seq:[{oid:d.encalg},{octstr:{hex:d.enciv}}]}]}]},{octstr:{hex:d.enc}}]};return d.prf!="hmacWithSHA1"&&g.seq[0].seq[1].seq[0].seq[1].seq.push({seq:[{oid:d.prf},{null:""}]}),g},parseHexOfEncryptedPKCS8:function(d){var g=Ne,y=g.getChildIdx,x=g.getV,b={},S=y(d,0);if(S.length!=2)throw new Error("malformed format: SEQUENCE(0).items != 2: "+S.length);b.ciphertext=x(d,S[1]);var k=y(d,S[0]);if(k.length!=2)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+k.length);if(x(d,k[0])!="2a864886f70d01050d")throw new Error("this only supports pkcs5PBES2");var T=y(d,k[1]);if(k.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+T.length);var _=y(d,T[1]);if(_.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+_.length);if(x(d,_[0])!="2a864886f70d0307")throw"this only supports TripleDES";b.encryptionSchemeAlg="TripleDES",b.encryptionSchemeIV=x(d,_[1]);var B=y(d,T[0]);if(B.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+B.length);if(x(d,B[0])!="2a864886f70d01050c")throw new Error("this only supports pkcs5PBKDF2");var N=y(d,B[1]);if(N.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+N.length);b.pbkdf2Salt=x(d,N[0]);var P=x(d,N[1]);try{b.pbkdf2Iter=parseInt(P,16)}catch{throw new Error("malformed format pbkdf2Iter: "+P)}return b},getPBKDF2KeyHexFromParam:function(d,g){var y=Re.enc.Hex.parse(d.pbkdf2Salt),x=d.pbkdf2Iter,b=Re.PBKDF2(g,y,{keySize:192/32,iterations:x}),S=Re.enc.Hex.stringify(b);return S},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(d,g){var y=xr(d,"ENCRYPTED PRIVATE KEY"),x=this.parseHexOfEncryptedPKCS8(y),b=ct.getPBKDF2KeyHexFromParam(x,g),S={};S.ciphertext=Re.enc.Hex.parse(x.ciphertext);var k=Re.enc.Hex.parse(b),T=Re.enc.Hex.parse(x.encryptionSchemeIV),_=Re.TripleDES.decrypt(S,k,{iv:T}),B=Re.enc.Hex.stringify(_);return B},parsePBES2:function(d){var g=Ne.parse(d);if(Ft(g,"seq.0.seq.0.oid")!="pkcs5PBES2"||Ft(g,"seq.0.seq.1.seq.0.seq.0.oid")!="pkcs5PBKDF2")throw new Error("not pkcs5PBES2 and pkcs5PBKDF2 used");var y=Ft(g,"seq.0.seq.1.seq.0.seq.1.seq");if(y==null)throw new Error("PBKDF2 parameter not found");var x=Ft(y,"0.octstr.hex"),b=Ft(y,"1.int.hex"),S=Ft(y,"2.seq.0.oid","hmacWithSHA1"),k=-1;try{k=parseInt(b,16)}catch{throw new Error("iter not proper value")}var T=Ft(g,"seq.0.seq.1.seq.1.seq.0.oid"),_=Ft(g,"seq.0.seq.1.seq.1.seq.1.octstr.hex"),B=Ft(g,"seq.1.octstr.hex");if(T==null||_==null||B==null)throw new Error("encalg, enciv or enc is undefined");var N={salt:x,iter:k,prf:S,encalg:T,enciv:_,enc:B};return N},getDKFromPBES2Param:function(d,g){var y={hmacWithSHA1:Re.algo.SHA1,hmacWithSHA224:Re.algo.SHA224,hmacWithSHA256:Re.algo.SHA256,hmacWithSHA384:Re.algo.SHA384,hmacWithSHA512:Re.algo.SHA512},x={"des-EDE3-CBC":192/32,"aes128-CBC":128/32,"aes256-CBC":256/32},b=y[d.prf];if(b==null)throw new Error("unsupported prf");var S=x[d.encalg];if(S==null)throw new Error("unsupported encalg");var k=Re.enc.Hex.parse(d.salt),T=d.iter;try{var _=Re.PBKDF2(g,k,{keySize:S,iterations:T,hasher:b});return Re.enc.Hex.stringify(_)}catch(B){throw new Error("PBKDF2 error: "+B+" "+JSON.stringify(d)+" "+g)}},getPlainHexFromEncryptedPKCS8PEM:function(d,g){if(d.indexOf("BEGIN ENCRYPTED PRIVATE KEY")==-1)throw new Error("not Encrypted PKCS#8 PEM string");var y=xr(d),x;try{x=ct.parsePBES2(y)}catch(S){throw new Error("malformed PBES2 format: "+S.message)}var b=ct.getDKFromPBES2Param(x,g);return C.crypto.Cipher.decrypt(x.enc,b,x.encalg,{iv:x.enciv})},getKeyFromEncryptedPKCS8PEM:function(d,g){var y=this.getPlainHexFromEncryptedPKCS8PEM(d,g),x=this.getKeyFromPlainPrivatePKCS8Hex(y);return x},parsePlainPrivatePKCS8Hex:function(d){var g=Ne,y=g.getChildIdx,x=g.getV,b={};if(b.algparam=null,d.substr(0,2)!="30")throw new Error("malformed plain PKCS8 private key(code:001)");var S=y(d,0);if(S.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if(d.substr(S[1],2)!="30")throw new Error("malformed PKCS8 private key(code:003)");var k=y(d,S[1]);if(k.length!=2)throw new Error("malformed PKCS8 private key(code:004)");if(d.substr(k[0],2)!="06")throw new Error("malformed PKCS8 private key(code:005)");if(b.algoid=x(d,k[0]),d.substr(k[1],2)=="06"&&(b.algparam=x(d,k[1])),d.substr(S[2],2)!="04")throw new Error("malformed PKCS8 private key(code:006)");return b.keyidx=g.getVidx(d,S[2]),b},getKeyFromPlainPrivatePKCS8PEM:function(d){var g=xr(d,"PRIVATE KEY"),y=this.getKeyFromPlainPrivatePKCS8Hex(g);return y},getKeyFromPlainPrivatePKCS8Hex:function(d){var g=this.parsePlainPrivatePKCS8Hex(d),y;if(g.algoid=="2a864886f70d010101")y=new Ze;else if(g.algoid=="2a8648ce380401")y=new C.crypto.DSA;else if(g.algoid=="2a8648ce3d0201")y=new C.crypto.ECDSA;else throw new Error("unsupported private key algorithm");return y.readPKCS8PrvKeyHex(d),y},_getKeyFromPublicPKCS8Hex:function(d){var g,y=Ne.getVbyList(d,0,[0,0],"06");if(y==="2a864886f70d010101")g=new Ze;else if(y==="2a8648ce380401")g=new C.crypto.DSA;else if(y==="2a8648ce3d0201")g=new C.crypto.ECDSA;else throw new Error("unsupported PKCS#8 public key hex");return g.readPKCS8PubKeyHex(d),g},parsePublicRawRSAKeyHex:function(d){var g=Ne,y=g.getChildIdx,x=g.getV,b={};if(d.substr(0,2)!="30")throw new Error("malformed RSA key(code:001)");var S=y(d,0);if(S.length!=2)throw new Error("malformed RSA key(code:002)");if(d.substr(S[0],2)!="02")throw new Error("malformed RSA key(code:003)");if(b.n=x(d,S[0]),d.substr(S[1],2)!="02")throw new Error("malformed RSA key(code:004)");return b.e=x(d,S[1]),b},parsePublicPKCS8Hex:function(d){var g=Ne,y=g.getChildIdx,x=g.getV,b={};b.algparam=null;var S=y(d,0);if(S.length!=2)throw new Error("outer DERSequence shall have 2 elements: "+S.length);var k=S[0];if(d.substr(k,2)!="30")throw new Error("malformed PKCS8 public key(code:001)");var T=y(d,k);if(T.length!=2)throw new Error("malformed PKCS8 public key(code:002)");if(d.substr(T[0],2)!="06")throw new Error("malformed PKCS8 public key(code:003)");if(b.algoid=x(d,T[0]),d.substr(T[1],2)=="06"?b.algparam=x(d,T[1]):d.substr(T[1],2)=="30"&&(b.algparam={},b.algparam.p=g.getVbyList(d,T[1],[0],"02"),b.algparam.q=g.getVbyList(d,T[1],[1],"02"),b.algparam.g=g.getVbyList(d,T[1],[2],"02")),d.substr(S[1],2)!="03")throw new Error("malformed PKCS8 public key(code:004)");return b.key=x(d,S[1]).substr(2),b}}}();ct.getKey=function(t,e,r){var n=Ne,i=n.getChildIdx;n.getV;var s=n.getVbyList,a=C.crypto,o=a.ECDSA,c=a.DSA,u=Ze,l=xr,h=ct;if(typeof u<"u"&&t instanceof u||typeof o<"u"&&t instanceof o||typeof c<"u"&&t instanceof c)return t;if(t.curve!==void 0&&t.xy!==void 0&&t.d===void 0)return new o({pub:t.xy,curve:t.curve});if(t.curve!==void 0&&t.d!==void 0)return new o({prv:t.d,curve:t.curve});if(t.kty===void 0&&t.n!==void 0&&t.e!==void 0&&t.d===void 0){var f=new u;return f.setPublic(t.n,t.e),f}if(t.kty===void 0&&t.n!==void 0&&t.e!==void 0&&t.d!==void 0&&t.p!==void 0&&t.q!==void 0&&t.dp!==void 0&&t.dq!==void 0&&t.co!==void 0&&t.qi===void 0){var f=new u;return f.setPrivateEx(t.n,t.e,t.d,t.p,t.q,t.dp,t.dq,t.co),f}if(t.kty===void 0&&t.n!==void 0&&t.e!==void 0&&t.d!==void 0&&t.p===void 0){var f=new u;return f.setPrivate(t.n,t.e,t.d),f}if(t.p!==void 0&&t.q!==void 0&&t.g!==void 0&&t.y!==void 0&&t.x===void 0){var f=new c;return f.setPublic(t.p,t.q,t.g,t.y),f}if(t.p!==void 0&&t.q!==void 0&&t.g!==void 0&&t.y!==void 0&&t.x!==void 0){var f=new c;return f.setPrivate(t.p,t.q,t.g,t.y,t.x),f}if(t.kty==="RSA"&&t.n!==void 0&&t.e!==void 0&&t.d===void 0){var f=new u;return f.setPublic(zt(t.n),zt(t.e)),f}if(t.kty==="RSA"&&t.n!==void 0&&t.e!==void 0&&t.d!==void 0&&t.p!==void 0&&t.q!==void 0&&t.dp!==void 0&&t.dq!==void 0&&t.qi!==void 0){var f=new u;return f.setPrivateEx(zt(t.n),zt(t.e),zt(t.d),zt(t.p),zt(t.q),zt(t.dp),zt(t.dq),zt(t.qi)),f}if(t.kty==="RSA"&&t.n!==void 0&&t.e!==void 0&&t.d!==void 0){var f=new u;return f.setPrivate(zt(t.n),zt(t.e),zt(t.d)),f}if(t.kty==="EC"&&t.crv!==void 0&&t.x!==void 0&&t.y!==void 0&&t.d===void 0){var p=new o({curve:t.crv}),d=p.ecparams.keycharlen,g=("0000000000"+zt(t.x)).slice(-d),y=("0000000000"+zt(t.y)).slice(-d),x="04"+g+y;return p.setPublicKeyHex(x),p}if(t.kty==="EC"&&t.crv!==void 0&&t.x!==void 0&&t.y!==void 0&&t.d!==void 0){var p=new o({curve:t.crv}),d=p.ecparams.keycharlen,g=("0000000000"+zt(t.x)).slice(-d),y=("0000000000"+zt(t.y)).slice(-d),x="04"+g+y,b=("0000000000"+zt(t.d)).slice(-d);return p.setPublicKeyHex(x),p.setPrivateKeyHex(b),p}if(r==="pkcs5prv"){var S=t,n=Ne,k,f;if(k=i(S,0),k.length===9)f=new u,f.readPKCS5PrvKeyHex(S);else if(k.length===6)f=new c,f.readPKCS5PrvKeyHex(S);else if(k.length>2&&S.substr(k[1],2)==="04")f=new o,f.readPKCS5PrvKeyHex(S);else throw new Error("unsupported PKCS#1/5 hexadecimal key");return f}if(r==="pkcs8prv"){var f=h.getKeyFromPlainPrivatePKCS8Hex(t);return f}if(r==="pkcs8pub")return h._getKeyFromPublicPKCS8Hex(t);if(r==="x509pub")return Ye.getPublicKeyFromCertHex(t);if(t.indexOf("-END CERTIFICATE-",0)!=-1||t.indexOf("-END X509 CERTIFICATE-",0)!=-1||t.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1)return Ye.getPublicKeyFromCertPEM(t);if(t.indexOf("-END PUBLIC KEY-")!=-1){var T=xr(t,"PUBLIC KEY");return h._getKeyFromPublicPKCS8Hex(T)}if(t.indexOf("-END RSA PRIVATE KEY-")!=-1&&t.indexOf("4,ENCRYPTED")==-1){var _=l(t,"RSA PRIVATE KEY");return h.getKey(_,null,"pkcs5prv")}if(t.indexOf("-END DSA PRIVATE KEY-")!=-1&&t.indexOf("4,ENCRYPTED")==-1){var B=l(t,"DSA PRIVATE KEY"),N=s(B,0,[1],"02"),P=s(B,0,[2],"02"),D=s(B,0,[3],"02"),O=s(B,0,[4],"02"),E=s(B,0,[5],"02"),f=new c;return f.setPrivate(new ie(N,16),new ie(P,16),new ie(D,16),new ie(O,16),new ie(E,16)),f}if(t.indexOf("-END EC PRIVATE KEY-")!=-1&&t.indexOf("4,ENCRYPTED")==-1){var _=l(t,"EC PRIVATE KEY");return h.getKey(_,null,"pkcs5prv")}if(t.indexOf("-END PRIVATE KEY-")!=-1)return h.getKeyFromPlainPrivatePKCS8PEM(t);if(t.indexOf("-END RSA PRIVATE KEY-")!=-1&&t.indexOf("4,ENCRYPTED")!=-1){var F=h.getDecryptedKeyHex(t,e),A=new Ze;return A.readPKCS5PrvKeyHex(F),A}if(t.indexOf("-END EC PRIVATE KEY-")!=-1&&t.indexOf("4,ENCRYPTED")!=-1){var B=h.getDecryptedKeyHex(t,e),f=s(B,0,[1],"04"),I=s(B,0,[2,0],"06"),j=s(B,0,[3,0],"03").substr(2),H="";if(C.crypto.OID.oidhex2name[I]!==void 0)H=C.crypto.OID.oidhex2name[I];else throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+I);var p=new o({curve:H});return p.setPublicKeyHex(j),p.setPrivateKeyHex(f),p.isPublic=!1,p}if(t.indexOf("-END DSA PRIVATE KEY-")!=-1&&t.indexOf("4,ENCRYPTED")!=-1){var B=h.getDecryptedKeyHex(t,e),N=s(B,0,[1],"02"),P=s(B,0,[2],"02"),D=s(B,0,[3],"02"),O=s(B,0,[4],"02"),E=s(B,0,[5],"02"),f=new c;return f.setPrivate(new ie(N,16),new ie(P,16),new ie(D,16),new ie(O,16),new ie(E,16)),f}if(t.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1)return h.getKeyFromEncryptedPKCS8PEM(t,e);throw new Error("not supported argument")};ct.generateKeypair=function(t,e){if(t=="RSA"){var r=e,n=new Ze;n.generate(r,"10001"),n.isPrivate=!0,n.isPublic=!0;var i=new Ze,s=n.n.toString(16),a=n.e.toString(16);i.setPublic(s,a),i.isPrivate=!1,i.isPublic=!0;var o={};return o.prvKeyObj=n,o.pubKeyObj=i,o}else if(t=="EC"){var c=e,u=new C.crypto.ECDSA({curve:c}),l=u.generateKeyPairHex(),n=new C.crypto.ECDSA({curve:c});n.setPublicKeyHex(l.ecpubhex),n.setPrivateKeyHex(l.ecprvhex),n.isPrivate=!0,n.isPublic=!1;var i=new C.crypto.ECDSA({curve:c});i.setPublicKeyHex(l.ecpubhex),i.isPrivate=!1,i.isPublic=!0;var o={};return o.prvKeyObj=n,o.pubKeyObj=i,o}else throw new Error("unknown algorithm: "+t)};ct.getPEM=function(t,e,r,n,i,s){var a=C,o=a.asn1,c=o.DERObjectIdentifier,u=o.DERInteger,l=o.ASN1Util.newObject,h=o.x509,f=h.SubjectPublicKeyInfo,p=a.crypto,d=p.DSA,g=p.ECDSA,y=Ze;function x(I){var j=l({seq:[{int:0},{int:{bigint:I.n}},{int:I.e},{int:{bigint:I.d}},{int:{bigint:I.p}},{int:{bigint:I.q}},{int:{bigint:I.dmp1}},{int:{bigint:I.dmq1}},{int:{bigint:I.coeff}}]});return j}function b(I){var j=l({seq:[{int:1},{octstr:{hex:I.prvKeyHex}},{tag:["a0",!0,{oid:{name:I.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+I.pubKeyHex}}]}]});return j}function S(I){var j=l({seq:[{int:0},{int:{bigint:I.p}},{int:{bigint:I.q}},{int:{bigint:I.g}},{int:{bigint:I.y}},{int:{bigint:I.x}}]});return j}if((y!==void 0&&t instanceof y||d!==void 0&&t instanceof d||g!==void 0&&t instanceof g)&&t.isPublic==!0&&(e===void 0||e=="PKCS8PUB")){var k=new f(t),T=k.tohex();return yn(T,"PUBLIC KEY")}if(e=="PKCS1PRV"&&y!==void 0&&t instanceof y&&(r===void 0||r==null)&&t.isPrivate==!0){var k=x(t),T=k.tohex();return yn(T,"RSA PRIVATE KEY")}if(e=="PKCS1PRV"&&g!==void 0&&t instanceof g&&(r===void 0||r==null)&&t.isPrivate==!0){var _=new c({name:t.curveName}),B=_.tohex(),N=b(t),P=N.tohex(),D="";return D+=yn(B,"EC PARAMETERS"),D+=yn(P,"EC PRIVATE KEY"),D}if(e=="PKCS1PRV"&&d!==void 0&&t instanceof d&&(r===void 0||r==null)&&t.isPrivate==!0){var k=S(t),T=k.tohex();return yn(T,"DSA PRIVATE KEY")}if(e=="PKCS5PRV"&&y!==void 0&&t instanceof y&&r!==void 0&&r!=null&&t.isPrivate==!0){var k=x(t),T=k.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",T,r,n,s)}if(e=="PKCS5PRV"&&g!==void 0&&t instanceof g&&r!==void 0&&r!=null&&t.isPrivate==!0){var k=b(t),T=k.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",T,r,n,s)}if(e=="PKCS5PRV"&&d!==void 0&&t instanceof d&&r!==void 0&&r!=null&&t.isPrivate==!0){var k=S(t),T=k.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",T,r,n,s)}var O=function(I,j){if(typeof j=="string")return ct.getEncryptedPKCS8PEM(I,j);if(typeof j=="object"&&Ft(j,"passcode")!=null){var H=JSON.parse(JSON.stringify(j)),G=H.passcode;return delete H.passcode,ct.getEncryptedPKCS8PEM(I,G,H)}};if(e=="PKCS8PRV"&&y!=null&&t instanceof y&&t.isPrivate==!0){var E=x(t),F=E.tohex(),k=l({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:F}}]}),T=k.tohex();return r===void 0||r==null?yn(T,"PRIVATE KEY"):O(T,r)}if(e=="PKCS8PRV"&&g!==void 0&&t instanceof g&&t.isPrivate==!0){var A={seq:[{int:1},{octstr:{hex:t.prvKeyHex}}]};typeof t.pubKeyHex=="string"&&A.seq.push({tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]});var E=new l(A),F=E.tohex(),k=l({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:t.curveName}}]},{octstr:{hex:F}}]}),T=k.tohex();return r===void 0||r==null?yn(T,"PRIVATE KEY"):O(T,r)}if(e=="PKCS8PRV"&&d!==void 0&&t instanceof d&&t.isPrivate==!0){var E=new u({bigint:t.x}),F=E.tohex(),k=l({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]}]},{octstr:{hex:F}}]}),T=k.tohex();return r===void 0||r==null?yn(T,"PRIVATE KEY"):O(T,r)}throw new Error("unsupported object nor format")};ct.getKeyFromCSRPEM=function(t){var e=xr(t,"CERTIFICATE REQUEST"),r=ct.getKeyFromCSRHex(e);return r};ct.getKeyFromCSRHex=function(t){var e=ct.parseCSRHex(t),r=ct.getKey(e.p8pubkeyhex,null,"pkcs8pub");return r};ct.parseCSRHex=function(t){var e=Ne,r=e.getChildIdx,n=e.getTLV,i={},s=t;if(s.substr(0,2)!="30")throw new Error("malformed CSR(code:001)");var a=r(s,0);if(a.length<1)throw new Error("malformed CSR(code:002)");if(s.substr(a[0],2)!="30")throw new Error("malformed CSR(code:003)");var o=r(s,a[0]);if(o.length<3)throw new Error("malformed CSR(code:004)");return i.p8pubkeyhex=n(s,o[2]),i};ct.getKeyID=function(t){var e=ct,r=Ne;typeof t=="string"&&t.indexOf("BEGIN ")!=-1&&(t=e.getKey(t));var n=xr(e.getPEM(t)),i=r.getIdxbyList(n,0,[1]),s=r.getV(n,i).substring(2);return C.crypto.Util.hashHex(s,"sha1")};ct.getJWK=function(t,e,r,n,i){var s,a={},o,c=C.crypto.Util.hashHex;if(typeof t=="string")s=ct.getKey(t),t.indexOf("CERTIFICATE")!=-1&&(o=xr(t));else if(typeof t=="object")t instanceof Ye?(s=t.getPublicKey(),o=t.hex):s=t;else throw new Error("unsupported keyinfo type");if(s instanceof Ze&&s.isPrivate)a.kty="RSA",a.n=Br(s.n.toString(16)),a.e=Br(s.e.toString(16)),a.d=Br(s.d.toString(16)),a.p=Br(s.p.toString(16)),a.q=Br(s.q.toString(16)),a.dp=Br(s.dmp1.toString(16)),a.dq=Br(s.dmq1.toString(16)),a.qi=Br(s.coeff.toString(16));else if(s instanceof Ze&&s.isPublic)a.kty="RSA",a.n=Br(s.n.toString(16)),a.e=Br(s.e.toString(16));else if(s instanceof C.crypto.ECDSA&&s.isPrivate){var u=s.getShortNISTPCurveName();if(u!=="P-256"&&u!=="P-384"&&u!=="P-521")throw new Error("unsupported curve name for JWT: "+u);var l=s.getPublicKeyXYHex();a.kty="EC",a.crv=u,a.x=Br(l.x),a.y=Br(l.y),a.d=Br(s.prvKeyHex)}else if(s instanceof C.crypto.ECDSA&&s.isPublic){var u=s.getShortNISTPCurveName();if(u!=="P-256"&&u!=="P-384"&&u!=="P-521")throw new Error("unsupported curve name for JWT: "+u);var l=s.getPublicKeyXYHex();a.kty="EC",a.crv=u,a.x=Br(l.x),a.y=Br(l.y)}if(a.kty==null)throw new Error("unsupported keyinfo");return!s.isPrivate&&e!=!0&&(a.kid=C.jws.JWS.getJWKthumbprint(a)),o!=null&&r!=!0&&(a.x5c=[id(o)]),o!=null&&n!=!0&&(a.x5t=km(id(c(o,"sha1")))),o!=null&&i!=!0&&(a["x5t#S256"]=km(id(c(o,"sha256")))),a};ct.getJWKFromKey=function(t){return ct.getJWK(t,!0,!0,!0,!0)};Ze.getPosArrayOfChildrenFromHex=function(t){return Ne.getChildIdx(t,0)};Ze.getHexValueArrayOfChildrenFromHex=function(t){var e=Ne,r=e.getV,f=Ze.getPosArrayOfChildrenFromHex(t),n=r(t,f[0]),i=r(t,f[1]),s=r(t,f[2]),a=r(t,f[3]),o=r(t,f[4]),c=r(t,f[5]),u=r(t,f[6]),l=r(t,f[7]),h=r(t,f[8]),f=new Array;return f.push(n,i,s,a,o,c,u,l,h),f};Ze.prototype.readPrivateKeyFromPEMString=function(t){var e=xr(t),r=Ze.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])};Ze.prototype.readPKCS5PrvKeyHex=function(t){var e=Ze.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])};Ze.prototype.readPKCS8PrvKeyHex=function(t){var e,r,n,i,s,a,o,c,u=Ne,l=u.getVbyListEx;if(u.isASN1HEX(t)===!1)throw new Error("not ASN.1 hex string");try{e=l(t,0,[2,0,1],"02"),r=l(t,0,[2,0,2],"02"),n=l(t,0,[2,0,3],"02"),i=l(t,0,[2,0,4],"02"),s=l(t,0,[2,0,5],"02"),a=l(t,0,[2,0,6],"02"),o=l(t,0,[2,0,7],"02"),c=l(t,0,[2,0,8],"02")}catch{throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(e,r,n,i,s,a,o,c)};Ze.prototype.readPKCS5PubKeyHex=function(t){var e=Ne,r=e.getV;if(e.isASN1HEX(t)===!1)throw new Error("keyHex is not ASN.1 hex string");var n=e.getChildIdx(t,0);if(n.length!==2||t.substr(n[0],2)!=="02"||t.substr(n[1],2)!=="02")throw new Error("wrong hex for PKCS#5 public key");var i=r(t,n[0]),s=r(t,n[1]);this.setPublic(i,s)};Ze.prototype.readPKCS8PubKeyHex=function(t){var e=Ne;if(e.isASN1HEX(t)===!1)throw new Error("not ASN.1 hex string");if(e.getTLVbyListEx(t,0,[0,0])!=="06092a864886f70d010101")throw new Error("not PKCS8 RSA public key");var r=e.getTLVbyListEx(t,0,[1,0]);this.readPKCS5PubKeyHex(r)};Ze.prototype.readCertPubKeyHex=function(t,e){var r,n;r=new Ye,r.readCertHex(t),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)};function yF(t,e){for(var r="",n=e/4-t.length,i=0;i>24,(i&16711680)>>16,(i&65280)>>8,i&255])))),i+=1;return n}Ze.prototype.signPSS=function(t,e,r){var n=function(s){return C.crypto.Util.hashHex(s,e)},i=n(Is(t));return r===void 0&&(r=-1),this.signWithMessageHashPSS(i,e,r)};Ze.prototype.signWithMessageHashPSS=function(t,e,r){var n=Mi(t),i=n.length,s=this.n.bitLength()-1,a=Math.ceil(s/8),o,c=function(y){return C.crypto.Util.hashHex(y,e)};if(r===-1||r===void 0)r=i;else if(r===-2)r=a-i-2;else if(r<-2)throw new Error("invalid salt length");if(a0&&(u=new Array(r),new ll().nextBytes(u),u=String.fromCharCode.apply(String,u));var l=Mi(c(Is("\0\0\0\0\0\0\0\0"+n+u))),h=[];for(o=0;o>8*a-s&255;for(d[0]&=~g,o=0;on)return!1;var i=this.doPublic(r),s=i.toString(16);if(s.length+3!=n/4)return!1;var a=s.replace(/^1f+00/,""),o=bF(a);if(o.length==0)return!1;var c=o[0],u=o[1],l=function(f){return C.crypto.Util.hashString(f,c)},h=l(t);return u==h};Ze.prototype.verifyWithMessageHash=function(t,e){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=sn(e,16);if(r.bitLength()>this.n.bitLength())return 0;var n=this.doPublic(r),i=n.toString(16).replace(/^1f+00/,""),s=bF(i);if(s.length==0)return!1;s[0];var a=s[1];return a==t};Ze.prototype.verifyPSS=function(t,e,r,n){var i=function(a){return C.crypto.Util.hashHex(a,r)},s=i(Is(t));return n===void 0&&(n=-1),this.verifyWithMessageHashPSS(s,e,r,n)};Ze.prototype.verifyWithMessageHashPSS=function(t,e,r,n){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var i=new ie(e,16),s=function(b){return C.crypto.Util.hashHex(b,r)},a=Mi(t),o=a.length,c=this.n.bitLength()-1,u=Math.ceil(c/8),l;if(n===-1||n===void 0)n=o;else if(n===-2)n=u-o-2;else if(n<-2)throw new Error("invalid salt length");if(u>8*u-c&255;if(f.charCodeAt(0)&d)throw new Error("bits beyond keysize not zero");var g=xF(p,f.length,s),y=[];for(l=0;l0?B:void 0}catch{return}},this._asn1ToNoticeRef=function(_){try{for(var B={},N=Ft(_,"seq"),P=0;P0?B:void 0}catch{return}},this._asn1ToNoticeNum=function(_){try{for(var B=Ft(_,"seq"),N=[],P=0;P1){var O=s(_,D[1]),E=this.getGeneralName(O);E.uri!=null&&(P.uri=E.uri)}if(D.length>2){var F=s(_,D[2]);F=="0101ff"&&(P.reqauth=!0),F=="010100"&&(P.reqauth=!1)}return P},this.getExtSubjectDirectoryAttributes=function(_,B){if(_===void 0&&B===void 0){var N=this.getExtInfo("subjectDirectoryAttributes");if(N===void 0)return;_=s(this.hex,N.vidx),B=N.critical}var P={extname:"subjectDirectoryAttributes"};B&&(P.critical=!0);try{for(var D=i(_),O=[],E=0;E0&&(B.ext=this.getExtParamArray()),B.sighex=this.getSignatureValueHex(),_.tbshex==!0&&(B.tbshex=c(this.hex,0,[0])),_.nodnarray==!0&&(delete B.issuer.array,delete B.subject.array),B},this.getExtParamArray=function(_){if(_==null){var B=h(this.hex,0,[0,"[3]"]);B!=-1&&(_=u(this.hex,0,[0,"[3]",0],"30"))}for(var N=[],P=r(_,0),D=0;D"u"||!C)&&(C={});(typeof C.jws>"u"||!C.jws)&&(C.jws={});C.jws.JWS=function(){var t=C,e=t.jws.JWS,r=e.isSafeJSONString;this.parseJWS=function(n,i){if(!(this.parsedJWS!==void 0&&(i||this.parsedJWS.sigvalH!==void 0))){var s=n.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(s==null)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var a=s[1],o=s[2],c=s[3],u=a+"."+o;if(this.parsedJWS={},this.parsedJWS.headB64U=a,this.parsedJWS.payloadB64U=o,this.parsedJWS.sigvalB64U=c,this.parsedJWS.si=u,!i){var l=zt(c),h=sn(l,16);this.parsedJWS.sigvalH=l,this.parsedJWS.sigvalBI=h}var f=la(a),p=la(o);if(this.parsedJWS.headS=f,this.parsedJWS.payloadS=p,!r(f,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+f}}};C.jws.JWS.sign=function(t,e,r,n,i){var s=C,a=s.jws,o=a.JWS,c=o.readSafeJSONString,u=o.isSafeJSONString,l=s.crypto;l.ECDSA;var h=l.Mac,f=l.Signature,p=JSON,d,g,y;if(typeof e!="string"&&typeof e!="object")throw"spHeader must be JSON string or object: "+e;if(typeof e=="object"&&(g=e,d=p.stringify(g)),typeof e=="string"){if(d=e,!u(d))throw"JWS Head is not safe JSON string: "+d;g=c(d)}if(y=r,typeof r=="object"&&(y=p.stringify(r)),(t==""||t==null)&&g.alg!==void 0&&(t=g.alg),t!=""&&t!=null&&g.alg===void 0&&(g.alg=t,d=p.stringify(g)),t!==g.alg)throw"alg and sHeader.alg doesn't match: "+t+"!="+g.alg;var x=null;if(o.jwsalg2sigalg[t]===void 0)throw"unsupported alg name: "+t;x=o.jwsalg2sigalg[t];var b=Bm(d),S=Bm(y),k=b+"."+S,T="";if(x.substr(0,4)=="Hmac"){if(n===void 0)throw"mac key shall be specified for HS* alg";var _=new h({alg:x,prov:"cryptojs",pass:n});_.updateString(k),T=_.doFinal()}else if(x.indexOf("withECDSA")!=-1){var B=new f({alg:x});B.init(n,i),B.updateString(k);var N=B.sign();T=C.crypto.ECDSA.asn1SigToConcatSig(N)}else if(x!="none"){var B=new f({alg:x});B.init(n,i),B.updateString(k),T=B.sign()}var P=Br(T);return k+"."+P};C.jws.JWS.verify=function(t,e,r){var n=C,i=n.jws,s=i.JWS,a=s.readSafeJSONString,o=n.crypto,c=o.ECDSA,u=o.Mac,l=o.Signature,h;if(typeof Ze!==void 0&&(h=Ze),!vF(t))return!1;var f=t.split(".");if(f.length!==3)return!1;var p=f[0],d=f[1],g=p+"."+d,y=zt(f[2]),x=a(la(f[0])),b=null,S=null;if(x.alg===void 0)throw"algorithm not specified in header";if(b=x.alg,S=b.substr(0,2),r!=null&&Object.prototype.toString.call(r)==="[object Array]"&&r.length>0){var k=":"+r.join(":")+":";if(k.indexOf(":"+b+":")==-1)throw"algorithm '"+b+"' not accepted in the list"}if(b!="none"&&e===null)throw"key shall be specified to verify.";if(typeof e=="string"&&e.indexOf("-----BEGIN ")!=-1&&(e=ct.getKey(e)),(S=="RS"||S=="PS")&&!(e instanceof h))throw"key shall be a RSAKey obj for RS* and PS* algs";if(S=="ES"&&!(e instanceof c))throw"key shall be a ECDSA obj for ES* algs";var T=null;if(s.jwsalg2sigalg[x.alg]===void 0)throw"unsupported alg name: "+b;if(T=s.jwsalg2sigalg[b],T=="none")throw"not supported";if(T.substr(0,4)=="Hmac"){var _=null;if(e===void 0)throw"hexadecimal key shall be specified for HMAC";var B=new u({alg:T,pass:e});return B.updateString(g),_=B.doFinal(),y==_}else if(T.indexOf("withECDSA")!=-1){var N=null;try{N=c.concatSigToASN1Sig(y)}catch{return!1}var P=new l({alg:T});return P.init(e),P.updateString(g),P.verify(N)}else{var P=new l({alg:T});return P.init(e),P.updateString(g),P.verify(y)}};C.jws.JWS.parse=function(t){var e=t.split("."),r={},n,i,s;if(e.length!=2&&e.length!=3)throw"malformed sJWS: wrong number of '.' splitted elements";return n=e[0],i=e[1],e.length==3&&(s=e[2]),r.headerObj=C.jws.JWS.readSafeJSONString(la(n)),r.payloadObj=C.jws.JWS.readSafeJSONString(la(i)),r.headerPP=JSON.stringify(r.headerObj,null," "),r.payloadObj==null?r.payloadPP=la(i):r.payloadPP=JSON.stringify(r.payloadObj,null," "),s!==void 0&&(r.sigHex=zt(s)),r};C.jws.JWS.verifyJWT=function(t,e,r){var n=C,i=n.jws,s=i.JWS,a=s.readSafeJSONString,o=s.inArray,c=s.includedArray;if(!vF(t))return!1;var u=t.split(".");if(u.length!=3)return!1;var l=u[0],h=u[1];zt(u[2]);var f=a(la(l)),p=a(la(h));if(f.alg===void 0)return!1;if(r.alg===void 0)throw"acceptField.alg shall be specified";if(!o(f.alg,r.alg)||p.iss!==void 0&&typeof r.iss=="object"&&!o(p.iss,r.iss)||p.sub!==void 0&&typeof r.sub=="object"&&!o(p.sub,r.sub))return!1;if(p.aud!==void 0&&typeof r.aud=="object"){if(typeof p.aud=="string"){if(!o(p.aud,r.aud))return!1}else if(typeof p.aud=="object"&&!c(p.aud,r.aud))return!1}var d=i.IntDate.getNow();return r.verifyAt!==void 0&&typeof r.verifyAt=="number"&&(d=r.verifyAt),(r.gracePeriod===void 0||typeof r.gracePeriod!="number")&&(r.gracePeriod=0),!(p.exp!==void 0&&typeof p.exp=="number"&&p.exp+r.gracePeriod"u"||!C)&&(C={});(typeof C.jws>"u"||!C.jws)&&(C.jws={});C.jws.JWSJS=function(){var t=C,e=t.jws,r=e.JWS,n=r.readSafeJSONString;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload=void 0,this.aSignature=[]},this.initWithJWS=function(i){this.init();var s=i.split(".");if(s.length!=3)throw"malformed input JWS";this.aHeader.push(s[0]),this.sPayload=s[1],this.aSignature.push(s[2])},this.addSignature=function(i,s,a,o){if(this.sPayload===void 0||this.sPayload===null)throw"there's no JSON-JS signature to add.";var c=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length)throw"aHeader.length != aSignature.length";try{var u=C.jws.JWS.sign(i,s,this.sPayload,a,o),l=u.split("."),h=l[0],f=l[2];this.aHeader.push(l[0]),this.aSignature.push(l[2])}catch(p){throw this.aHeader.length>c&&this.aHeader.pop(),this.aSignature.length>c&&this.aSignature.pop(),"addSignature failed: "+p}},this.verifyAll=function(i){if(this.aHeader.length!==i.length||this.aSignature.length!==i.length)return!1;for(var s=0;s0)this.aHeader=i.headers;else throw"malformed header";if(typeof i.payload=="string")this.sPayload=i.payload;else throw"malformed signatures";if(i.signatures.length>0)this.aSignature=i.signatures;else throw"malformed signatures"}catch(a){throw"malformed JWS-JS JSON object: "+a}},this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}},this.isEmpty=function(){return this.aHeader.length==0?1:0}};C.crypto.ECDSA;C.crypto.DSA;C.crypto.Signature;C.crypto.MessageDigest;C.crypto.Mac;C.crypto.Cipher;var Zee=C;C.crypto;C.asn1;C.jws;C.lang;var wF={exports:{}},Z2={exports:{}},BA;function ht(){return BA||(BA=1,function(t,e){(function(r,n){t.exports=n()})(We,function(){var r=r||function(n,i){var s;if(typeof window<"u"&&window.crypto&&(s=window.crypto),typeof self<"u"&&self.crypto&&(s=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(s=globalThis.crypto),!s&&typeof window<"u"&&window.msCrypto&&(s=window.msCrypto),!s&&typeof We<"u"&&We.crypto&&(s=We.crypto),!s&&typeof D0=="function")try{s=c8}catch{}var a=function(){if(s){if(typeof s.getRandomValues=="function")try{return s.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof s.randomBytes=="function")try{return s.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function b(){}return function(S){var k;return b.prototype=S,k=new b,b.prototype=null,k}}(),c={},u=c.lib={},l=u.Base=function(){return{extend:function(b){var S=o(this);return b&&S.mixIn(b),(!S.hasOwnProperty("init")||this.init===S.init)&&(S.init=function(){S.$super.init.apply(this,arguments)}),S.init.prototype=S,S.$super=this,S},create:function(){var b=this.extend();return b.init.apply(b,arguments),b},init:function(){},mixIn:function(b){for(var S in b)b.hasOwnProperty(S)&&(this[S]=b[S]);b.hasOwnProperty("toString")&&(this.toString=b.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),h=u.WordArray=l.extend({init:function(b,S){b=this.words=b||[],S!=i?this.sigBytes=S:this.sigBytes=b.length*4},toString:function(b){return(b||p).stringify(this)},concat:function(b){var S=this.words,k=b.words,T=this.sigBytes,_=b.sigBytes;if(this.clamp(),T%4)for(var B=0;B<_;B++){var N=k[B>>>2]>>>24-B%4*8&255;S[T+B>>>2]|=N<<24-(T+B)%4*8}else for(var P=0;P<_;P+=4)S[T+P>>>2]=k[P>>>2];return this.sigBytes+=_,this},clamp:function(){var b=this.words,S=this.sigBytes;b[S>>>2]&=4294967295<<32-S%4*8,b.length=n.ceil(S/4)},clone:function(){var b=l.clone.call(this);return b.words=this.words.slice(0),b},random:function(b){for(var S=[],k=0;k>>2]>>>24-_%4*8&255;T.push((B>>>4).toString(16)),T.push((B&15).toString(16))}return T.join("")},parse:function(b){for(var S=b.length,k=[],T=0;T>>3]|=parseInt(b.substr(T,2),16)<<24-T%8*4;return new h.init(k,S/2)}},d=f.Latin1={stringify:function(b){for(var S=b.words,k=b.sigBytes,T=[],_=0;_>>2]>>>24-_%4*8&255;T.push(String.fromCharCode(B))}return T.join("")},parse:function(b){for(var S=b.length,k=[],T=0;T>>2]|=(b.charCodeAt(T)&255)<<24-T%4*8;return new h.init(k,S)}},g=f.Utf8={stringify:function(b){try{return decodeURIComponent(escape(d.stringify(b)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(b){return d.parse(unescape(encodeURIComponent(b)))}},y=u.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new h.init,this._nDataBytes=0},_append:function(b){typeof b=="string"&&(b=g.parse(b)),this._data.concat(b),this._nDataBytes+=b.sigBytes},_process:function(b){var S,k=this._data,T=k.words,_=k.sigBytes,B=this.blockSize,N=B*4,P=_/N;b?P=n.ceil(P):P=n.max((P|0)-this._minBufferSize,0);var D=P*B,O=n.min(D*4,_);if(D){for(var E=0;E>>2]|=c[h]<<24-h%4*8;a.call(this,l,u)}else a.apply(this,arguments)};o.prototype=s}}(),r.lib.WordArray})}(X2)),X2.exports}var Q2={exports:{}},TA;function Xee(){return TA||(TA=1,function(t,e){(function(r,n){t.exports=n(ht())})(We,function(r){return function(){var n=r,i=n.lib,s=i.WordArray,a=n.enc;a.Utf16=a.Utf16BE={stringify:function(c){for(var u=c.words,l=c.sigBytes,h=[],f=0;f>>2]>>>16-f%4*8&65535;h.push(String.fromCharCode(p))}return h.join("")},parse:function(c){for(var u=c.length,l=[],h=0;h>>1]|=c.charCodeAt(h)<<16-h%2*16;return s.create(l,u*2)}},a.Utf16LE={stringify:function(c){for(var u=c.words,l=c.sigBytes,h=[],f=0;f>>2]>>>16-f%4*8&65535);h.push(String.fromCharCode(p))}return h.join("")},parse:function(c){for(var u=c.length,l=[],h=0;h>>1]|=o(c.charCodeAt(h)<<16-h%2*16);return s.create(l,u*2)}};function o(c){return c<<8&4278255360|c>>>8&16711935}}(),r.enc.Utf16})}(Q2)),Q2.exports}var Y2={exports:{}},PA;function fl(){return PA||(PA=1,function(t,e){(function(r,n){t.exports=n(ht())})(We,function(r){return function(){var n=r,i=n.lib,s=i.WordArray,a=n.enc;a.Base64={stringify:function(c){var u=c.words,l=c.sigBytes,h=this._map;c.clamp();for(var f=[],p=0;p>>2]>>>24-p%4*8&255,g=u[p+1>>>2]>>>24-(p+1)%4*8&255,y=u[p+2>>>2]>>>24-(p+2)%4*8&255,x=d<<16|g<<8|y,b=0;b<4&&p+b*.75>>6*(3-b)&63));var S=h.charAt(64);if(S)for(;f.length%4;)f.push(S);return f.join("")},parse:function(c){var u=c.length,l=this._map,h=this._reverseMap;if(!h){h=this._reverseMap=[];for(var f=0;f>>6-p%4*2,y=d|g;h[f>>>2]|=y<<24-f%4*8,f++}return s.create(h,f)}}(),r.enc.Base64})}(Y2)),Y2.exports}var ex={exports:{}},NA;function Qee(){return NA||(NA=1,function(t,e){(function(r,n){t.exports=n(ht())})(We,function(r){return function(){var n=r,i=n.lib,s=i.WordArray,a=n.enc;a.Base64url={stringify:function(c,u){u===void 0&&(u=!0);var l=c.words,h=c.sigBytes,f=u?this._safe_map:this._map;c.clamp();for(var p=[],d=0;d>>2]>>>24-d%4*8&255,y=l[d+1>>>2]>>>24-(d+1)%4*8&255,x=l[d+2>>>2]>>>24-(d+2)%4*8&255,b=g<<16|y<<8|x,S=0;S<4&&d+S*.75>>6*(3-S)&63));var k=f.charAt(64);if(k)for(;p.length%4;)p.push(k);return p.join("")},parse:function(c,u){u===void 0&&(u=!0);var l=c.length,h=u?this._safe_map:this._map,f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var p=0;p>>6-p%4*2,y=d|g;h[f>>>2]|=y<<24-f%4*8,f++}return s.create(h,f)}}(),r.enc.Base64url})}(ex)),ex.exports}var tx={exports:{}},OA;function hl(){return OA||(OA=1,function(t,e){(function(r,n){t.exports=n(ht())})(We,function(r){return function(n){var i=r,s=i.lib,a=s.WordArray,o=s.Hasher,c=i.algo,u=[];(function(){for(var g=0;g<64;g++)u[g]=n.abs(n.sin(g+1))*4294967296|0})();var l=c.MD5=o.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(g,y){for(var x=0;x<16;x++){var b=y+x,S=g[b];g[b]=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360}var k=this._hash.words,T=g[y+0],_=g[y+1],B=g[y+2],N=g[y+3],P=g[y+4],D=g[y+5],O=g[y+6],E=g[y+7],F=g[y+8],A=g[y+9],I=g[y+10],j=g[y+11],H=g[y+12],G=g[y+13],z=g[y+14],R=g[y+15],L=k[0],q=k[1],ee=k[2],X=k[3];L=h(L,q,ee,X,T,7,u[0]),X=h(X,L,q,ee,_,12,u[1]),ee=h(ee,X,L,q,B,17,u[2]),q=h(q,ee,X,L,N,22,u[3]),L=h(L,q,ee,X,P,7,u[4]),X=h(X,L,q,ee,D,12,u[5]),ee=h(ee,X,L,q,O,17,u[6]),q=h(q,ee,X,L,E,22,u[7]),L=h(L,q,ee,X,F,7,u[8]),X=h(X,L,q,ee,A,12,u[9]),ee=h(ee,X,L,q,I,17,u[10]),q=h(q,ee,X,L,j,22,u[11]),L=h(L,q,ee,X,H,7,u[12]),X=h(X,L,q,ee,G,12,u[13]),ee=h(ee,X,L,q,z,17,u[14]),q=h(q,ee,X,L,R,22,u[15]),L=f(L,q,ee,X,_,5,u[16]),X=f(X,L,q,ee,O,9,u[17]),ee=f(ee,X,L,q,j,14,u[18]),q=f(q,ee,X,L,T,20,u[19]),L=f(L,q,ee,X,D,5,u[20]),X=f(X,L,q,ee,I,9,u[21]),ee=f(ee,X,L,q,R,14,u[22]),q=f(q,ee,X,L,P,20,u[23]),L=f(L,q,ee,X,A,5,u[24]),X=f(X,L,q,ee,z,9,u[25]),ee=f(ee,X,L,q,N,14,u[26]),q=f(q,ee,X,L,F,20,u[27]),L=f(L,q,ee,X,G,5,u[28]),X=f(X,L,q,ee,B,9,u[29]),ee=f(ee,X,L,q,E,14,u[30]),q=f(q,ee,X,L,H,20,u[31]),L=p(L,q,ee,X,D,4,u[32]),X=p(X,L,q,ee,F,11,u[33]),ee=p(ee,X,L,q,j,16,u[34]),q=p(q,ee,X,L,z,23,u[35]),L=p(L,q,ee,X,_,4,u[36]),X=p(X,L,q,ee,P,11,u[37]),ee=p(ee,X,L,q,E,16,u[38]),q=p(q,ee,X,L,I,23,u[39]),L=p(L,q,ee,X,G,4,u[40]),X=p(X,L,q,ee,T,11,u[41]),ee=p(ee,X,L,q,N,16,u[42]),q=p(q,ee,X,L,O,23,u[43]),L=p(L,q,ee,X,A,4,u[44]),X=p(X,L,q,ee,H,11,u[45]),ee=p(ee,X,L,q,R,16,u[46]),q=p(q,ee,X,L,B,23,u[47]),L=d(L,q,ee,X,T,6,u[48]),X=d(X,L,q,ee,E,10,u[49]),ee=d(ee,X,L,q,z,15,u[50]),q=d(q,ee,X,L,D,21,u[51]),L=d(L,q,ee,X,H,6,u[52]),X=d(X,L,q,ee,N,10,u[53]),ee=d(ee,X,L,q,I,15,u[54]),q=d(q,ee,X,L,_,21,u[55]),L=d(L,q,ee,X,F,6,u[56]),X=d(X,L,q,ee,R,10,u[57]),ee=d(ee,X,L,q,O,15,u[58]),q=d(q,ee,X,L,G,21,u[59]),L=d(L,q,ee,X,P,6,u[60]),X=d(X,L,q,ee,j,10,u[61]),ee=d(ee,X,L,q,B,15,u[62]),q=d(q,ee,X,L,A,21,u[63]),k[0]=k[0]+L|0,k[1]=k[1]+q|0,k[2]=k[2]+ee|0,k[3]=k[3]+X|0},_doFinalize:function(){var g=this._data,y=g.words,x=this._nDataBytes*8,b=g.sigBytes*8;y[b>>>5]|=128<<24-b%32;var S=n.floor(x/4294967296),k=x;y[(b+64>>>9<<4)+15]=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360,y[(b+64>>>9<<4)+14]=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360,g.sigBytes=(y.length+1)*4,this._process();for(var T=this._hash,_=T.words,B=0;B<4;B++){var N=_[B];_[B]=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360}return T},clone:function(){var g=o.clone.call(this);return g._hash=this._hash.clone(),g}});function h(g,y,x,b,S,k,T){var _=g+(y&x|~y&b)+S+T;return(_<>>32-k)+y}function f(g,y,x,b,S,k,T){var _=g+(y&b|x&~b)+S+T;return(_<>>32-k)+y}function p(g,y,x,b,S,k,T){var _=g+(y^x^b)+S+T;return(_<>>32-k)+y}function d(g,y,x,b,S,k,T){var _=g+(x^(y|~b))+S+T;return(_<>>32-k)+y}i.MD5=o._createHelper(l),i.HmacMD5=o._createHmacHelper(l)}(Math),r.MD5})}(tx)),tx.exports}var rx={exports:{}},DA;function EF(){return DA||(DA=1,function(t,e){(function(r,n){t.exports=n(ht())})(We,function(r){return function(){var n=r,i=n.lib,s=i.WordArray,a=i.Hasher,o=n.algo,c=[],u=o.SHA1=a.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(l,h){for(var f=this._hash.words,p=f[0],d=f[1],g=f[2],y=f[3],x=f[4],b=0;b<80;b++){if(b<16)c[b]=l[h+b]|0;else{var S=c[b-3]^c[b-8]^c[b-14]^c[b-16];c[b]=S<<1|S>>>31}var k=(p<<5|p>>>27)+x+c[b];b<20?k+=(d&g|~d&y)+1518500249:b<40?k+=(d^g^y)+1859775393:b<60?k+=(d&g|d&y|g&y)-1894007588:k+=(d^g^y)-899497514,x=y,y=g,g=d<<30|d>>>2,d=p,p=k}f[0]=f[0]+p|0,f[1]=f[1]+d|0,f[2]=f[2]+g|0,f[3]=f[3]+y|0,f[4]=f[4]+x|0},_doFinalize:function(){var l=this._data,h=l.words,f=this._nDataBytes*8,p=l.sigBytes*8;return h[p>>>5]|=128<<24-p%32,h[(p+64>>>9<<4)+14]=Math.floor(f/4294967296),h[(p+64>>>9<<4)+15]=f,l.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var l=a.clone.call(this);return l._hash=this._hash.clone(),l}});n.SHA1=a._createHelper(u),n.HmacSHA1=a._createHmacHelper(u)}(),r.SHA1})}(rx)),rx.exports}var nx={exports:{}},RA;function D8(){return RA||(RA=1,function(t,e){(function(r,n){t.exports=n(ht())})(We,function(r){return function(n){var i=r,s=i.lib,a=s.WordArray,o=s.Hasher,c=i.algo,u=[],l=[];(function(){function p(x){for(var b=n.sqrt(x),S=2;S<=b;S++)if(!(x%S))return!1;return!0}function d(x){return(x-(x|0))*4294967296|0}for(var g=2,y=0;y<64;)p(g)&&(y<8&&(u[y]=d(n.pow(g,1/2))),l[y]=d(n.pow(g,1/3)),y++),g++})();var h=[],f=c.SHA256=o.extend({_doReset:function(){this._hash=new a.init(u.slice(0))},_doProcessBlock:function(p,d){for(var g=this._hash.words,y=g[0],x=g[1],b=g[2],S=g[3],k=g[4],T=g[5],_=g[6],B=g[7],N=0;N<64;N++){if(N<16)h[N]=p[d+N]|0;else{var P=h[N-15],D=(P<<25|P>>>7)^(P<<14|P>>>18)^P>>>3,O=h[N-2],E=(O<<15|O>>>17)^(O<<13|O>>>19)^O>>>10;h[N]=D+h[N-7]+E+h[N-16]}var F=k&T^~k&_,A=y&x^y&b^x&b,I=(y<<30|y>>>2)^(y<<19|y>>>13)^(y<<10|y>>>22),j=(k<<26|k>>>6)^(k<<21|k>>>11)^(k<<7|k>>>25),H=B+j+F+l[N]+h[N],G=I+A;B=_,_=T,T=k,k=S+H|0,S=b,b=x,x=y,y=H+G|0}g[0]=g[0]+y|0,g[1]=g[1]+x|0,g[2]=g[2]+b|0,g[3]=g[3]+S|0,g[4]=g[4]+k|0,g[5]=g[5]+T|0,g[6]=g[6]+_|0,g[7]=g[7]+B|0},_doFinalize:function(){var p=this._data,d=p.words,g=this._nDataBytes*8,y=p.sigBytes*8;return d[y>>>5]|=128<<24-y%32,d[(y+64>>>9<<4)+14]=n.floor(g/4294967296),d[(y+64>>>9<<4)+15]=g,p.sigBytes=d.length*4,this._process(),this._hash},clone:function(){var p=o.clone.call(this);return p._hash=this._hash.clone(),p}});i.SHA256=o._createHelper(f),i.HmacSHA256=o._createHmacHelper(f)}(Math),r.SHA256})}(nx)),nx.exports}var ix={exports:{}},MA;function Yee(){return MA||(MA=1,function(t,e){(function(r,n,i){t.exports=n(ht(),D8())})(We,function(r){return function(){var n=r,i=n.lib,s=i.WordArray,a=n.algo,o=a.SHA256,c=a.SHA224=o.extend({_doReset:function(){this._hash=new s.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var u=o._doFinalize.call(this);return u.sigBytes-=4,u}});n.SHA224=o._createHelper(c),n.HmacSHA224=o._createHmacHelper(c)}(),r.SHA224})}(ix)),ix.exports}var sx={exports:{}},LA;function AF(){return LA||(LA=1,function(t,e){(function(r,n,i){t.exports=n(ht(),ey())})(We,function(r){return function(){var n=r,i=n.lib,s=i.Hasher,a=n.x64,o=a.Word,c=a.WordArray,u=n.algo;function l(){return o.create.apply(o,arguments)}var h=[l(1116352408,3609767458),l(1899447441,602891725),l(3049323471,3964484399),l(3921009573,2173295548),l(961987163,4081628472),l(1508970993,3053834265),l(2453635748,2937671579),l(2870763221,3664609560),l(3624381080,2734883394),l(310598401,1164996542),l(607225278,1323610764),l(1426881987,3590304994),l(1925078388,4068182383),l(2162078206,991336113),l(2614888103,633803317),l(3248222580,3479774868),l(3835390401,2666613458),l(4022224774,944711139),l(264347078,2341262773),l(604807628,2007800933),l(770255983,1495990901),l(1249150122,1856431235),l(1555081692,3175218132),l(1996064986,2198950837),l(2554220882,3999719339),l(2821834349,766784016),l(2952996808,2566594879),l(3210313671,3203337956),l(3336571891,1034457026),l(3584528711,2466948901),l(113926993,3758326383),l(338241895,168717936),l(666307205,1188179964),l(773529912,1546045734),l(1294757372,1522805485),l(1396182291,2643833823),l(1695183700,2343527390),l(1986661051,1014477480),l(2177026350,1206759142),l(2456956037,344077627),l(2730485921,1290863460),l(2820302411,3158454273),l(3259730800,3505952657),l(3345764771,106217008),l(3516065817,3606008344),l(3600352804,1432725776),l(4094571909,1467031594),l(275423344,851169720),l(430227734,3100823752),l(506948616,1363258195),l(659060556,3750685593),l(883997877,3785050280),l(958139571,3318307427),l(1322822218,3812723403),l(1537002063,2003034995),l(1747873779,3602036899),l(1955562222,1575990012),l(2024104815,1125592928),l(2227730452,2716904306),l(2361852424,442776044),l(2428436474,593698344),l(2756734187,3733110249),l(3204031479,2999351573),l(3329325298,3815920427),l(3391569614,3928383900),l(3515267271,566280711),l(3940187606,3454069534),l(4118630271,4000239992),l(116418474,1914138554),l(174292421,2731055270),l(289380356,3203993006),l(460393269,320620315),l(685471733,587496836),l(852142971,1086792851),l(1017036298,365543100),l(1126000580,2618297676),l(1288033470,3409855158),l(1501505948,4234509866),l(1607167915,987167468),l(1816402316,1246189591)],f=[];(function(){for(var d=0;d<80;d++)f[d]=l()})();var p=u.SHA512=s.extend({_doReset:function(){this._hash=new c.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(d,g){for(var y=this._hash.words,x=y[0],b=y[1],S=y[2],k=y[3],T=y[4],_=y[5],B=y[6],N=y[7],P=x.high,D=x.low,O=b.high,E=b.low,F=S.high,A=S.low,I=k.high,j=k.low,H=T.high,G=T.low,z=_.high,R=_.low,L=B.high,q=B.low,ee=N.high,X=N.low,oe=P,me=D,le=O,fe=E,ve=F,Ae=A,Me=I,Be=j,Pe=H,V=G,ue=z,se=R,Y=L,J=q,ne=ee,ge=X,de=0;de<80;de++){var re,Ce,xe=f[de];if(de<16)Ce=xe.high=d[g+de*2]|0,re=xe.low=d[g+de*2+1]|0;else{var pe=f[de-15],Fe=pe.high,m=pe.low,v=(Fe>>>1|m<<31)^(Fe>>>8|m<<24)^Fe>>>7,w=(m>>>1|Fe<<31)^(m>>>8|Fe<<24)^(m>>>7|Fe<<25),M=f[de-2],$=M.high,W=M.low,Z=($>>>19|W<<13)^($<<3|W>>>29)^$>>>6,Ee=(W>>>19|$<<13)^(W<<3|$>>>29)^(W>>>6|$<<26),Ue=f[de-7],ke=Ue.high,Ie=Ue.low,Le=f[de-16],Ht=Le.high,Ot=Le.low;re=w+Ie,Ce=v+ke+(re>>>0>>0?1:0),re=re+Ee,Ce=Ce+Z+(re>>>0>>0?1:0),re=re+Ot,Ce=Ce+Ht+(re>>>0>>0?1:0),xe.high=Ce,xe.low=re}var qc=Pe&ue^~Pe&Y,At=V&se^~V&J,Bt=oe&le^oe&ve^le&ve,Xp=me&fe^me&Ae^fe&Ae,rr=(oe>>>28|me<<4)^(oe<<30|me>>>2)^(oe<<25|me>>>7),qt=(me>>>28|oe<<4)^(me<<30|oe>>>2)^(me<<25|oe>>>7),Qp=(Pe>>>14|V<<18)^(Pe>>>18|V<<14)^(Pe<<23|V>>>9),nr=(V>>>14|Pe<<18)^(V>>>18|Pe<<14)^(V<<23|Pe>>>9),Kt=h[de],Yp=Kt.high,Wt=Kt.low,dt=ge+nr,Xi=ne+Qp+(dt>>>0>>0?1:0),dt=dt+At,Xi=Xi+qc+(dt>>>0>>0?1:0),dt=dt+Wt,Xi=Xi+Yp+(dt>>>0>>0?1:0),dt=dt+re,Xi=Xi+Ce+(dt>>>0>>0?1:0),Gt=qt+Xp,ir=rr+Bt+(Gt>>>0>>0?1:0);ne=Y,ge=J,Y=ue,J=se,ue=Pe,se=V,V=Be+dt|0,Pe=Me+Xi+(V>>>0>>0?1:0)|0,Me=ve,Be=Ae,ve=le,Ae=fe,le=oe,fe=me,me=dt+Gt|0,oe=Xi+ir+(me>>>0
>>0?1:0)|0}D=x.low=D+me,x.high=P+oe+(D>>>0>>0?1:0),E=b.low=E+fe,b.high=O+le+(E>>>0>>0?1:0),A=S.low=A+Ae,S.high=F+ve+(A>>>0>>0?1:0),j=k.low=j+Be,k.high=I+Me+(j>>>0>>0?1:0),G=T.low=G+V,T.high=H+Pe+(G>>>0>>0?1:0),R=_.low=R+se,_.high=z+ue+(R>>>0>>0?1:0),q=B.low=q+J,B.high=L+Y+(q>>>0>>0?1:0),X=N.low=X+ge,N.high=ee+ne+(X>>>0>>0?1:0)},_doFinalize:function(){var d=this._data,g=d.words,y=this._nDataBytes*8,x=d.sigBytes*8;g[x>>>5]|=128<<24-x%32,g[(x+128>>>10<<5)+30]=Math.floor(y/4294967296),g[(x+128>>>10<<5)+31]=y,d.sigBytes=g.length*4,this._process();var b=this._hash.toX32();return b},clone:function(){var d=s.clone.call(this);return d._hash=this._hash.clone(),d},blockSize:1024/32});n.SHA512=s._createHelper(p),n.HmacSHA512=s._createHmacHelper(p)}(),r.SHA512})}(sx)),sx.exports}var ax={exports:{}},jA;function ete(){return jA||(jA=1,function(t,e){(function(r,n,i){t.exports=n(ht(),ey(),AF())})(We,function(r){return function(){var n=r,i=n.x64,s=i.Word,a=i.WordArray,o=n.algo,c=o.SHA512,u=o.SHA384=c.extend({_doReset:function(){this._hash=new a.init([new s.init(3418070365,3238371032),new s.init(1654270250,914150663),new s.init(2438529370,812702999),new s.init(355462360,4144912697),new s.init(1731405415,4290775857),new s.init(2394180231,1750603025),new s.init(3675008525,1694076839),new s.init(1203062813,3204075428)])},_doFinalize:function(){var l=c._doFinalize.call(this);return l.sigBytes-=16,l}});n.SHA384=c._createHelper(u),n.HmacSHA384=c._createHmacHelper(u)}(),r.SHA384})}(ax)),ax.exports}var ox={exports:{}},UA;function tte(){return UA||(UA=1,function(t,e){(function(r,n,i){t.exports=n(ht(),ey())})(We,function(r){return function(n){var i=r,s=i.lib,a=s.WordArray,o=s.Hasher,c=i.x64,u=c.Word,l=i.algo,h=[],f=[],p=[];(function(){for(var y=1,x=0,b=0;b<24;b++){h[y+5*x]=(b+1)*(b+2)/2%64;var S=x%5,k=(2*y+3*x)%5;y=S,x=k}for(var y=0;y<5;y++)for(var x=0;x<5;x++)f[y+5*x]=x+(2*y+3*x)%5*5;for(var T=1,_=0;_<24;_++){for(var B=0,N=0,P=0;P<7;P++){if(T&1){var D=(1<>>24)&16711935|(T<<24|T>>>8)&4278255360,_=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360;var B=b[k];B.high^=_,B.low^=T}for(var N=0;N<24;N++){for(var P=0;P<5;P++){for(var D=0,O=0,E=0;E<5;E++){var B=b[P+5*E];D^=B.high,O^=B.low}var F=d[P];F.high=D,F.low=O}for(var P=0;P<5;P++)for(var A=d[(P+4)%5],I=d[(P+1)%5],j=I.high,H=I.low,D=A.high^(j<<1|H>>>31),O=A.low^(H<<1|j>>>31),E=0;E<5;E++){var B=b[P+5*E];B.high^=D,B.low^=O}for(var G=1;G<25;G++){var D,O,B=b[G],z=B.high,R=B.low,L=h[G];L<32?(D=z<>>32-L,O=R<>>32-L):(D=R<>>64-L,O=z<>>64-L);var q=d[f[G]];q.high=D,q.low=O}var ee=d[0],X=b[0];ee.high=X.high,ee.low=X.low;for(var P=0;P<5;P++)for(var E=0;E<5;E++){var G=P+5*E,B=b[G],oe=d[G],me=d[(P+1)%5+5*E],le=d[(P+2)%5+5*E];B.high=oe.high^~me.high&le.high,B.low=oe.low^~me.low&le.low}var B=b[0],fe=p[N];B.high^=fe.high,B.low^=fe.low}},_doFinalize:function(){var y=this._data,x=y.words;this._nDataBytes*8;var b=y.sigBytes*8,S=this.blockSize*32;x[b>>>5]|=1<<24-b%32,x[(n.ceil((b+1)/S)*S>>>5)-1]|=128,y.sigBytes=x.length*4,this._process();for(var k=this._state,T=this.cfg.outputLength/8,_=T/8,B=[],N=0;N<_;N++){var P=k[N],D=P.high,O=P.low;D=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,O=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360,B.push(O),B.push(D)}return new a.init(B,T)},clone:function(){for(var y=o.clone.call(this),x=y._state=this._state.slice(0),b=0;b<25;b++)x[b]=x[b].clone();return y}});i.SHA3=o._createHelper(g),i.HmacSHA3=o._createHmacHelper(g)}(Math),r.SHA3})}(ox)),ox.exports}var cx={exports:{}},$A;function rte(){return $A||($A=1,function(t,e){(function(r,n){t.exports=n(ht())})(We,function(r){/** @preserve - (c) 2012 by Cédric Mesnil. All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */return function(n){var i=r,s=i.lib,a=s.WordArray,o=s.Hasher,c=i.algo,u=a.create([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]),l=a.create([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]),h=a.create([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]),f=a.create([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]),p=a.create([0,1518500249,1859775393,2400959708,2840853838]),d=a.create([1352829926,1548603684,1836072691,2053994217,0]),g=c.RIPEMD160=o.extend({_doReset:function(){this._hash=a.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(_,B){for(var N=0;N<16;N++){var P=B+N,D=_[P];_[P]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360}var O=this._hash.words,E=p.words,F=d.words,A=u.words,I=l.words,j=h.words,H=f.words,G,z,R,L,q,ee,X,oe,me,le;ee=G=O[0],X=z=O[1],oe=R=O[2],me=L=O[3],le=q=O[4];for(var fe,N=0;N<80;N+=1)fe=G+_[B+A[N]]|0,N<16?fe+=y(z,R,L)+E[0]:N<32?fe+=x(z,R,L)+E[1]:N<48?fe+=b(z,R,L)+E[2]:N<64?fe+=S(z,R,L)+E[3]:fe+=k(z,R,L)+E[4],fe=fe|0,fe=T(fe,j[N]),fe=fe+q|0,G=q,q=L,L=T(R,10),R=z,z=fe,fe=ee+_[B+I[N]]|0,N<16?fe+=k(X,oe,me)+F[0]:N<32?fe+=S(X,oe,me)+F[1]:N<48?fe+=b(X,oe,me)+F[2]:N<64?fe+=x(X,oe,me)+F[3]:fe+=y(X,oe,me)+F[4],fe=fe|0,fe=T(fe,H[N]),fe=fe+le|0,ee=le,le=me,me=T(oe,10),oe=X,X=fe;fe=O[1]+R+me|0,O[1]=O[2]+L+le|0,O[2]=O[3]+q+ee|0,O[3]=O[4]+G+X|0,O[4]=O[0]+z+oe|0,O[0]=fe},_doFinalize:function(){var _=this._data,B=_.words,N=this._nDataBytes*8,P=_.sigBytes*8;B[P>>>5]|=128<<24-P%32,B[(P+64>>>9<<4)+14]=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360,_.sigBytes=(B.length+1)*4,this._process();for(var D=this._hash,O=D.words,E=0;E<5;E++){var F=O[E];O[E]=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360}return D},clone:function(){var _=o.clone.call(this);return _._hash=this._hash.clone(),_}});function y(_,B,N){return _^B^N}function x(_,B,N){return _&B|~_&N}function b(_,B,N){return(_|~B)^N}function S(_,B,N){return _&N|B&~N}function k(_,B,N){return _^(B|~N)}function T(_,B){return _<>>32-B}i.RIPEMD160=o._createHelper(g),i.HmacRIPEMD160=o._createHmacHelper(g)}(),r.RIPEMD160})}(cx)),cx.exports}var ux={exports:{}},HA;function R8(){return HA||(HA=1,function(t,e){(function(r,n){t.exports=n(ht())})(We,function(r){(function(){var n=r,i=n.lib,s=i.Base,a=n.enc,o=a.Utf8,c=n.algo;c.HMAC=s.extend({init:function(u,l){u=this._hasher=new u.init,typeof l=="string"&&(l=o.parse(l));var h=u.blockSize,f=h*4;l.sigBytes>f&&(l=u.finalize(l)),l.clamp();for(var p=this._oKey=l.clone(),d=this._iKey=l.clone(),g=p.words,y=d.words,x=0;x>>2]&255;D.sigBytes-=O}};s.BlockCipher=p.extend({cfg:p.cfg.extend({mode:y,padding:b}),reset:function(){var D;p.reset.call(this);var O=this.cfg,E=O.iv,F=O.mode;this._xformMode==this._ENC_XFORM_MODE?D=F.createEncryptor:(D=F.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==D?this._mode.init(this,E&&E.words):(this._mode=D.call(F,this,E&&E.words),this._mode.__creator=D)},_doProcessBlock:function(D,O){this._mode.processBlock(D,O)},_doFinalize:function(){var D,O=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(O.pad(this._data,this.blockSize),D=this._process(!0)):(D=this._process(!0),O.unpad(D)),D},blockSize:128/32});var S=s.CipherParams=a.extend({init:function(D){this.mixIn(D)},toString:function(D){return(D||this.formatter).stringify(this)}}),k=i.format={},T=k.OpenSSL={stringify:function(D){var O,E=D.ciphertext,F=D.salt;return F?O=o.create([1398893684,1701076831]).concat(F).concat(E):O=E,O.toString(l)},parse:function(D){var O,E=l.parse(D),F=E.words;return F[0]==1398893684&&F[1]==1701076831&&(O=o.create(F.slice(2,4)),F.splice(0,4),E.sigBytes-=16),S.create({ciphertext:E,salt:O})}},_=s.SerializableCipher=a.extend({cfg:a.extend({format:T}),encrypt:function(D,O,E,F){F=this.cfg.extend(F);var A=D.createEncryptor(E,F),I=A.finalize(O),j=A.cfg;return S.create({ciphertext:I,key:E,iv:j.iv,algorithm:D,mode:j.mode,padding:j.padding,blockSize:D.blockSize,formatter:F.format})},decrypt:function(D,O,E,F){F=this.cfg.extend(F),O=this._parse(O,F.format);var A=D.createDecryptor(E,F).finalize(O.ciphertext);return A},_parse:function(D,O){return typeof D=="string"?O.parse(D,this):D}}),B=i.kdf={},N=B.OpenSSL={execute:function(D,O,E,F,A){if(F||(F=o.random(64/8)),A)var I=f.create({keySize:O+E,hasher:A}).compute(D,F);else var I=f.create({keySize:O+E}).compute(D,F);var j=o.create(I.words.slice(O),E*4);return I.sigBytes=O*4,S.create({key:I,iv:j,salt:F})}},P=s.PasswordBasedCipher=_.extend({cfg:_.cfg.extend({kdf:N}),encrypt:function(D,O,E,F){F=this.cfg.extend(F);var A=F.kdf.execute(E,D.keySize,D.ivSize,F.salt,F.hasher);F.iv=A.iv;var I=_.encrypt.call(this,D,O,A.key,F);return I.mixIn(A),I},decrypt:function(D,O,E,F){F=this.cfg.extend(F),O=this._parse(O,F.format);var A=F.kdf.execute(E,D.keySize,D.ivSize,O.salt,F.hasher);F.iv=A.iv;var I=_.decrypt.call(this,D,O,A.key,F);return I}})}()})}(hx)),hx.exports}var dx={exports:{}},KA;function ite(){return KA||(KA=1,function(t,e){(function(r,n,i){t.exports=n(ht(),Hr())})(We,function(r){return r.mode.CFB=function(){var n=r.lib.BlockCipherMode.extend();n.Encryptor=n.extend({processBlock:function(s,a){var o=this._cipher,c=o.blockSize;i.call(this,s,a,c,o),this._prevBlock=s.slice(a,a+c)}}),n.Decryptor=n.extend({processBlock:function(s,a){var o=this._cipher,c=o.blockSize,u=s.slice(a,a+c);i.call(this,s,a,c,o),this._prevBlock=u}});function i(s,a,o,c){var u,l=this._iv;l?(u=l.slice(0),this._iv=void 0):u=this._prevBlock,c.encryptBlock(u,0);for(var h=0;h>24&255)===255){var c=o>>16&255,u=o>>8&255,l=o&255;c===255?(c=0,u===255?(u=0,l===255?l=0:++l):++u):++c,o=0,o+=c<<16,o+=u<<8,o+=l}else o+=1<<24;return o}function s(o){return(o[0]=i(o[0]))===0&&(o[1]=i(o[1])),o}var a=n.Encryptor=n.extend({processBlock:function(o,c){var u=this._cipher,l=u.blockSize,h=this._iv,f=this._counter;h&&(f=this._counter=h.slice(0),this._iv=void 0),s(f);var p=f.slice(0);u.encryptBlock(p,0);for(var d=0;d>>2]|=o<<24-c%4*8,n.sigBytes+=o},unpad:function(n){var i=n.words[n.sigBytes-1>>>2]&255;n.sigBytes-=i}},r.pad.Ansix923})}(yx)),yx.exports}var xx={exports:{}},QA;function lte(){return QA||(QA=1,function(t,e){(function(r,n,i){t.exports=n(ht(),Hr())})(We,function(r){return r.pad.Iso10126={pad:function(n,i){var s=i*4,a=s-n.sigBytes%s;n.concat(r.lib.WordArray.random(a-1)).concat(r.lib.WordArray.create([a<<24],1))},unpad:function(n){var i=n.words[n.sigBytes-1>>>2]&255;n.sigBytes-=i}},r.pad.Iso10126})}(xx)),xx.exports}var bx={exports:{}},YA;function fte(){return YA||(YA=1,function(t,e){(function(r,n,i){t.exports=n(ht(),Hr())})(We,function(r){return r.pad.Iso97971={pad:function(n,i){n.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(n,i)},unpad:function(n){r.pad.ZeroPadding.unpad(n),n.sigBytes--}},r.pad.Iso97971})}(bx)),bx.exports}var wx={exports:{}},eS;function hte(){return eS||(eS=1,function(t,e){(function(r,n,i){t.exports=n(ht(),Hr())})(We,function(r){return r.pad.ZeroPadding={pad:function(n,i){var s=i*4;n.clamp(),n.sigBytes+=s-(n.sigBytes%s||s)},unpad:function(n){for(var i=n.words,s=n.sigBytes-1,s=n.sigBytes-1;s>=0;s--)if(i[s>>>2]>>>24-s%4*8&255){n.sigBytes=s+1;break}}},r.pad.ZeroPadding})}(wx)),wx.exports}var Ex={exports:{}},tS;function dte(){return tS||(tS=1,function(t,e){(function(r,n,i){t.exports=n(ht(),Hr())})(We,function(r){return r.pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding})}(Ex)),Ex.exports}var Ax={exports:{}},rS;function pte(){return rS||(rS=1,function(t,e){(function(r,n,i){t.exports=n(ht(),Hr())})(We,function(r){return function(n){var i=r,s=i.lib,a=s.CipherParams,o=i.enc,c=o.Hex,u=i.format;u.Hex={stringify:function(l){return l.ciphertext.toString(c)},parse:function(l){var h=c.parse(l);return a.create({ciphertext:h})}}}(),r.format.Hex})}(Ax)),Ax.exports}var Sx={exports:{}},nS;function gte(){return nS||(nS=1,function(t,e){(function(r,n,i){t.exports=n(ht(),fl(),hl(),Hc(),Hr())})(We,function(r){return function(){var n=r,i=n.lib,s=i.BlockCipher,a=n.algo,o=[],c=[],u=[],l=[],h=[],f=[],p=[],d=[],g=[],y=[];(function(){for(var S=[],k=0;k<256;k++)k<128?S[k]=k<<1:S[k]=k<<1^283;for(var T=0,_=0,k=0;k<256;k++){var B=_^_<<1^_<<2^_<<3^_<<4;B=B>>>8^B&255^99,o[T]=B,c[B]=T;var N=S[T],P=S[N],D=S[P],O=S[B]*257^B*16843008;u[T]=O<<24|O>>>8,l[T]=O<<16|O>>>16,h[T]=O<<8|O>>>24,f[T]=O;var O=D*16843009^P*65537^N*257^T*16843008;p[B]=O<<24|O>>>8,d[B]=O<<16|O>>>16,g[B]=O<<8|O>>>24,y[B]=O,T?(T=N^S[S[S[D^N]]],_^=S[S[_]]):T=_=1}})();var x=[0,1,2,4,8,16,32,64,128,27,54],b=a.AES=s.extend({_doReset:function(){var S;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var k=this._keyPriorReset=this._key,T=k.words,_=k.sigBytes/4,B=this._nRounds=_+6,N=(B+1)*4,P=this._keySchedule=[],D=0;D6&&D%_==4&&(S=o[S>>>24]<<24|o[S>>>16&255]<<16|o[S>>>8&255]<<8|o[S&255]):(S=S<<8|S>>>24,S=o[S>>>24]<<24|o[S>>>16&255]<<16|o[S>>>8&255]<<8|o[S&255],S^=x[D/_|0]<<24),P[D]=P[D-_]^S);for(var O=this._invKeySchedule=[],E=0;E>>24]]^d[o[S>>>16&255]]^g[o[S>>>8&255]]^y[o[S&255]]}}},encryptBlock:function(S,k){this._doCryptBlock(S,k,this._keySchedule,u,l,h,f,o)},decryptBlock:function(S,k){var T=S[k+1];S[k+1]=S[k+3],S[k+3]=T,this._doCryptBlock(S,k,this._invKeySchedule,p,d,g,y,c);var T=S[k+1];S[k+1]=S[k+3],S[k+3]=T},_doCryptBlock:function(S,k,T,_,B,N,P,D){for(var O=this._nRounds,E=S[k]^T[0],F=S[k+1]^T[1],A=S[k+2]^T[2],I=S[k+3]^T[3],j=4,H=1;H>>24]^B[F>>>16&255]^N[A>>>8&255]^P[I&255]^T[j++],z=_[F>>>24]^B[A>>>16&255]^N[I>>>8&255]^P[E&255]^T[j++],R=_[A>>>24]^B[I>>>16&255]^N[E>>>8&255]^P[F&255]^T[j++],L=_[I>>>24]^B[E>>>16&255]^N[F>>>8&255]^P[A&255]^T[j++];E=G,F=z,A=R,I=L}var G=(D[E>>>24]<<24|D[F>>>16&255]<<16|D[A>>>8&255]<<8|D[I&255])^T[j++],z=(D[F>>>24]<<24|D[A>>>16&255]<<16|D[I>>>8&255]<<8|D[E&255])^T[j++],R=(D[A>>>24]<<24|D[I>>>16&255]<<16|D[E>>>8&255]<<8|D[F&255])^T[j++],L=(D[I>>>24]<<24|D[E>>>16&255]<<16|D[F>>>8&255]<<8|D[A&255])^T[j++];S[k]=G,S[k+1]=z,S[k+2]=R,S[k+3]=L},keySize:256/32});n.AES=s._createHelper(b)}(),r.AES})}(Sx)),Sx.exports}var Cx={exports:{}},iS;function mte(){return iS||(iS=1,function(t,e){(function(r,n,i){t.exports=n(ht(),fl(),hl(),Hc(),Hr())})(We,function(r){return function(){var n=r,i=n.lib,s=i.WordArray,a=i.BlockCipher,o=n.algo,c=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],u=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],h=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],f=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],p=o.DES=a.extend({_doReset:function(){for(var x=this._key,b=x.words,S=[],k=0;k<56;k++){var T=c[k]-1;S[k]=b[T>>>5]>>>31-T%32&1}for(var _=this._subKeys=[],B=0;B<16;B++){for(var N=_[B]=[],P=l[B],k=0;k<24;k++)N[k/6|0]|=S[(u[k]-1+P)%28]<<31-k%6,N[4+(k/6|0)]|=S[28+(u[k+24]-1+P)%28]<<31-k%6;N[0]=N[0]<<1|N[0]>>>31;for(var k=1;k<7;k++)N[k]=N[k]>>>(k-1)*4+3;N[7]=N[7]<<5|N[7]>>>27}for(var D=this._invSubKeys=[],k=0;k<16;k++)D[k]=_[15-k]},encryptBlock:function(x,b){this._doCryptBlock(x,b,this._subKeys)},decryptBlock:function(x,b){this._doCryptBlock(x,b,this._invSubKeys)},_doCryptBlock:function(x,b,S){this._lBlock=x[b],this._rBlock=x[b+1],d.call(this,4,252645135),d.call(this,16,65535),g.call(this,2,858993459),g.call(this,8,16711935),d.call(this,1,1431655765);for(var k=0;k<16;k++){for(var T=S[k],_=this._lBlock,B=this._rBlock,N=0,P=0;P<8;P++)N|=h[P][((B^T[P])&f[P])>>>0];this._lBlock=B,this._rBlock=_^N}var D=this._lBlock;this._lBlock=this._rBlock,this._rBlock=D,d.call(this,1,1431655765),g.call(this,8,16711935),g.call(this,2,858993459),d.call(this,16,65535),d.call(this,4,252645135),x[b]=this._lBlock,x[b+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function d(x,b){var S=(this._lBlock>>>x^this._rBlock)&b;this._rBlock^=S,this._lBlock^=S<>>x^this._lBlock)&b;this._lBlock^=S,this._rBlock^=S<192.");var S=b.slice(0,2),k=b.length<4?b.slice(0,2):b.slice(2,4),T=b.length<6?b.slice(0,2):b.slice(4,6);this._des1=p.createEncryptor(s.create(S)),this._des2=p.createEncryptor(s.create(k)),this._des3=p.createEncryptor(s.create(T))},encryptBlock:function(x,b){this._des1.encryptBlock(x,b),this._des2.decryptBlock(x,b),this._des3.encryptBlock(x,b)},decryptBlock:function(x,b){this._des3.decryptBlock(x,b),this._des2.encryptBlock(x,b),this._des1.decryptBlock(x,b)},keySize:192/32,ivSize:64/32,blockSize:64/32});n.TripleDES=a._createHelper(y)}(),r.TripleDES})}(Cx)),Cx.exports}var _x={exports:{}},sS;function vte(){return sS||(sS=1,function(t,e){(function(r,n,i){t.exports=n(ht(),fl(),hl(),Hc(),Hr())})(We,function(r){return function(){var n=r,i=n.lib,s=i.StreamCipher,a=n.algo,o=a.RC4=s.extend({_doReset:function(){for(var l=this._key,h=l.words,f=l.sigBytes,p=this._S=[],d=0;d<256;d++)p[d]=d;for(var d=0,g=0;d<256;d++){var y=d%f,x=h[y>>>2]>>>24-y%4*8&255;g=(g+p[d]+x)%256;var b=p[d];p[d]=p[g],p[g]=b}this._i=this._j=0},_doProcessBlock:function(l,h){l[h]^=c.call(this)},keySize:256/32,ivSize:0});function c(){for(var l=this._S,h=this._i,f=this._j,p=0,d=0;d<4;d++){h=(h+1)%256,f=(f+l[h])%256;var g=l[h];l[h]=l[f],l[f]=g,p|=l[(l[h]+l[f])%256]<<24-d*8}return this._i=h,this._j=f,p}n.RC4=s._createHelper(o);var u=a.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var l=this.cfg.drop;l>0;l--)c.call(this)}});n.RC4Drop=s._createHelper(u)}(),r.RC4})}(_x)),_x.exports}var kx={exports:{}},aS;function yte(){return aS||(aS=1,function(t,e){(function(r,n,i){t.exports=n(ht(),fl(),hl(),Hc(),Hr())})(We,function(r){return function(){var n=r,i=n.lib,s=i.StreamCipher,a=n.algo,o=[],c=[],u=[],l=a.Rabbit=s.extend({_doReset:function(){for(var f=this._key.words,p=this.cfg.iv,d=0;d<4;d++)f[d]=(f[d]<<8|f[d]>>>24)&16711935|(f[d]<<24|f[d]>>>8)&4278255360;var g=this._X=[f[0],f[3]<<16|f[2]>>>16,f[1],f[0]<<16|f[3]>>>16,f[2],f[1]<<16|f[0]>>>16,f[3],f[2]<<16|f[1]>>>16],y=this._C=[f[2]<<16|f[2]>>>16,f[0]&4294901760|f[1]&65535,f[3]<<16|f[3]>>>16,f[1]&4294901760|f[2]&65535,f[0]<<16|f[0]>>>16,f[2]&4294901760|f[3]&65535,f[1]<<16|f[1]>>>16,f[3]&4294901760|f[0]&65535];this._b=0;for(var d=0;d<4;d++)h.call(this);for(var d=0;d<8;d++)y[d]^=g[d+4&7];if(p){var x=p.words,b=x[0],S=x[1],k=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,T=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360,_=k>>>16|T&4294901760,B=T<<16|k&65535;y[0]^=k,y[1]^=_,y[2]^=T,y[3]^=B,y[4]^=k,y[5]^=_,y[6]^=T,y[7]^=B;for(var d=0;d<4;d++)h.call(this)}},_doProcessBlock:function(f,p){var d=this._X;h.call(this),o[0]=d[0]^d[5]>>>16^d[3]<<16,o[1]=d[2]^d[7]>>>16^d[5]<<16,o[2]=d[4]^d[1]>>>16^d[7]<<16,o[3]=d[6]^d[3]>>>16^d[1]<<16;for(var g=0;g<4;g++)o[g]=(o[g]<<8|o[g]>>>24)&16711935|(o[g]<<24|o[g]>>>8)&4278255360,f[p+g]^=o[g]},blockSize:128/32,ivSize:64/32});function h(){for(var f=this._X,p=this._C,d=0;d<8;d++)c[d]=p[d];p[0]=p[0]+1295307597+this._b|0,p[1]=p[1]+3545052371+(p[0]>>>0>>0?1:0)|0,p[2]=p[2]+886263092+(p[1]>>>0>>0?1:0)|0,p[3]=p[3]+1295307597+(p[2]>>>0>>0?1:0)|0,p[4]=p[4]+3545052371+(p[3]>>>0>>0?1:0)|0,p[5]=p[5]+886263092+(p[4]>>>0>>0?1:0)|0,p[6]=p[6]+1295307597+(p[5]>>>0>>0?1:0)|0,p[7]=p[7]+3545052371+(p[6]>>>0>>0?1:0)|0,this._b=p[7]>>>0>>0?1:0;for(var d=0;d<8;d++){var g=f[d]+p[d],y=g&65535,x=g>>>16,b=((y*y>>>17)+y*x>>>15)+x*x,S=((g&4294901760)*g|0)+((g&65535)*g|0);u[d]=b^S}f[0]=u[0]+(u[7]<<16|u[7]>>>16)+(u[6]<<16|u[6]>>>16)|0,f[1]=u[1]+(u[0]<<8|u[0]>>>24)+u[7]|0,f[2]=u[2]+(u[1]<<16|u[1]>>>16)+(u[0]<<16|u[0]>>>16)|0,f[3]=u[3]+(u[2]<<8|u[2]>>>24)+u[1]|0,f[4]=u[4]+(u[3]<<16|u[3]>>>16)+(u[2]<<16|u[2]>>>16)|0,f[5]=u[5]+(u[4]<<8|u[4]>>>24)+u[3]|0,f[6]=u[6]+(u[5]<<16|u[5]>>>16)+(u[4]<<16|u[4]>>>16)|0,f[7]=u[7]+(u[6]<<8|u[6]>>>24)+u[5]|0}n.Rabbit=s._createHelper(l)}(),r.Rabbit})}(kx)),kx.exports}var Bx={exports:{}},oS;function xte(){return oS||(oS=1,function(t,e){(function(r,n,i){t.exports=n(ht(),fl(),hl(),Hc(),Hr())})(We,function(r){return function(){var n=r,i=n.lib,s=i.StreamCipher,a=n.algo,o=[],c=[],u=[],l=a.RabbitLegacy=s.extend({_doReset:function(){var f=this._key.words,p=this.cfg.iv,d=this._X=[f[0],f[3]<<16|f[2]>>>16,f[1],f[0]<<16|f[3]>>>16,f[2],f[1]<<16|f[0]>>>16,f[3],f[2]<<16|f[1]>>>16],g=this._C=[f[2]<<16|f[2]>>>16,f[0]&4294901760|f[1]&65535,f[3]<<16|f[3]>>>16,f[1]&4294901760|f[2]&65535,f[0]<<16|f[0]>>>16,f[2]&4294901760|f[3]&65535,f[1]<<16|f[1]>>>16,f[3]&4294901760|f[0]&65535];this._b=0;for(var y=0;y<4;y++)h.call(this);for(var y=0;y<8;y++)g[y]^=d[y+4&7];if(p){var x=p.words,b=x[0],S=x[1],k=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,T=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360,_=k>>>16|T&4294901760,B=T<<16|k&65535;g[0]^=k,g[1]^=_,g[2]^=T,g[3]^=B,g[4]^=k,g[5]^=_,g[6]^=T,g[7]^=B;for(var y=0;y<4;y++)h.call(this)}},_doProcessBlock:function(f,p){var d=this._X;h.call(this),o[0]=d[0]^d[5]>>>16^d[3]<<16,o[1]=d[2]^d[7]>>>16^d[5]<<16,o[2]=d[4]^d[1]>>>16^d[7]<<16,o[3]=d[6]^d[3]>>>16^d[1]<<16;for(var g=0;g<4;g++)o[g]=(o[g]<<8|o[g]>>>24)&16711935|(o[g]<<24|o[g]>>>8)&4278255360,f[p+g]^=o[g]},blockSize:128/32,ivSize:64/32});function h(){for(var f=this._X,p=this._C,d=0;d<8;d++)c[d]=p[d];p[0]=p[0]+1295307597+this._b|0,p[1]=p[1]+3545052371+(p[0]>>>0>>0?1:0)|0,p[2]=p[2]+886263092+(p[1]>>>0>>0?1:0)|0,p[3]=p[3]+1295307597+(p[2]>>>0>>0?1:0)|0,p[4]=p[4]+3545052371+(p[3]>>>0>>0?1:0)|0,p[5]=p[5]+886263092+(p[4]>>>0>>0?1:0)|0,p[6]=p[6]+1295307597+(p[5]>>>0>>0?1:0)|0,p[7]=p[7]+3545052371+(p[6]>>>0>>0?1:0)|0,this._b=p[7]>>>0>>0?1:0;for(var d=0;d<8;d++){var g=f[d]+p[d],y=g&65535,x=g>>>16,b=((y*y>>>17)+y*x>>>15)+x*x,S=((g&4294901760)*g|0)+((g&65535)*g|0);u[d]=b^S}f[0]=u[0]+(u[7]<<16|u[7]>>>16)+(u[6]<<16|u[6]>>>16)|0,f[1]=u[1]+(u[0]<<8|u[0]>>>24)+u[7]|0,f[2]=u[2]+(u[1]<<16|u[1]>>>16)+(u[0]<<16|u[0]>>>16)|0,f[3]=u[3]+(u[2]<<8|u[2]>>>24)+u[1]|0,f[4]=u[4]+(u[3]<<16|u[3]>>>16)+(u[2]<<16|u[2]>>>16)|0,f[5]=u[5]+(u[4]<<8|u[4]>>>24)+u[3]|0,f[6]=u[6]+(u[5]<<16|u[5]>>>16)+(u[4]<<16|u[4]>>>16)|0,f[7]=u[7]+(u[6]<<8|u[6]>>>24)+u[5]|0}n.RabbitLegacy=s._createHelper(l)}(),r.RabbitLegacy})}(Bx)),Bx.exports}var Ix={exports:{}},cS;function bte(){return cS||(cS=1,function(t,e){(function(r,n,i){t.exports=n(ht(),fl(),hl(),Hc(),Hr())})(We,function(r){return function(){var n=r,i=n.lib,s=i.BlockCipher,a=n.algo;const o=16,c=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],u=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var l={pbox:[],sbox:[]};function h(y,x){let b=x>>24&255,S=x>>16&255,k=x>>8&255,T=x&255,_=y.sbox[0][b]+y.sbox[1][S];return _=_^y.sbox[2][k],_=_+y.sbox[3][T],_}function f(y,x,b){let S=x,k=b,T;for(let _=0;_1;--_)S=S^y.pbox[_],k=h(y,S)^k,T=S,S=k,k=T;return T=S,S=k,k=T,k=k^y.pbox[1],S=S^y.pbox[0],{left:S,right:k}}function d(y,x,b){for(let B=0;B<4;B++){y.sbox[B]=[];for(let N=0;N<256;N++)y.sbox[B][N]=u[B][N]}let S=0;for(let B=0;B=b&&(S=0);let k=0,T=0,_=0;for(let B=0;Br.toString(16).padStart(2,"0")).join("")}async function SF(t){const e=t.API_ID,r=window.location.href;return gi({method:"POST",url:"https://server.othent.io/use-othent",data:{API_ID:e,callbackURL:r}}).then(n=>{if(n.data.success===!1)throw new Error("Please specify an API ID (you can get one from Othent.io)");const i=()=>$G({domain:"auth.othent.io",clientId:"dyegx4dZj5yOv0v0RkoUsc48CIqaNS6C",authorizationParams:{redirect_uri:window.location.origin}});function s(c,u){return c.getTokenSilently({detailedResponse:!0,authorizationParams:u,cacheMode:"off"})}async function a(c){let u;if(c instanceof File)u=await async function(l){return new Promise((h,f)=>{const p=new FileReader;p.onload=()=>{const d=p.result,g=Buffer.from(d);h(g)},p.onerror=f,p.readAsArrayBuffer(l)})}(c);else if(typeof c=="string")u=Buffer.from(c,"utf8");else if(Buffer.isBuffer(c))u=c;else if(c instanceof ArrayBuffer||c instanceof SharedArrayBuffer)u=Buffer.from(c);else{if(!(c instanceof Uint8Array))throw new Error("Invalid data, we accept: string | Buffer | ArrayBuffer | SharedArrayBuffer | Uint8Array | File");u=Buffer.from(c.buffer)}return u}async function o(){const c=await i(),u={transaction_input:JSON.stringify({othentFunction:"idToken"})},l=(await s(c,u)).id_token,h=Fo(l);if(h.contract_id)return delete h.nonce,delete h.sid,delete h.aud,delete h.iss,delete h.iat,delete h.exp,delete h.updated_at,h;throw new Error('{ success: false, message: "Please create a Othent account" }')}return{getAPIID:async function(){const c=await i(),u={transaction_input:JSON.stringify({othentFunction:"API_ID"})},l=(await s(c,u)).id_token,h=Fo(l);if(h.contract_id)return{API_ID:h.API_ID};throw new Error('{ success: false, message: "Please create a Othent account" }')},queryWalletAddressTxns:async function(c){return await gi({method:"POST",url:"https://server.othent.io/query-wallet-address-txns",data:{walletAddress:c.walletAddress}}).then(u=>u.data).catch(u=>{throw u})},ping:async function(){return await gi({method:"GET",url:"https://server.othent.io/"}).then(c=>c.data).catch(c=>{throw c})},logIn:async function(){const c=await i();if(await c.isAuthenticated())return await o();{const u={authorizationParams:{transaction_input:JSON.stringify({othentFunction:"idToken"}),redirect_uri:window.location.origin}};let l=null,h="";try{await c.loginWithPopup(u);const f={transaction_input:JSON.stringify({othentFunction:"idToken"})};h=(await s(c,f)).id_token,l=Fo(h)}catch(f){throw f instanceof Error&&f.message,new Error("Your browser is blocking us! Please turn off your shields or allow cross site cookies! :)")}return l&&l.contract_id?(delete l.nonce,delete l.sid,delete l.aud,delete l.iss,delete l.iat,delete l.exp,delete l.updated_at,l):await gi({method:"POST",url:"https://server.othent.io/create-user",data:{JWT:h,API_ID:e}}).then(f=>{const p=f.data;return{contract_id:p.contract_id,given_name:p.given_name,family_name:p.family_name,nickname:p.nickname,name:p.name,picture:p.picture,locale:p.locale,email:p.email,email_verified:p.email_verified,sub:p.sub,success:p.success,message:p.message}}).catch(f=>{throw console.log(f.response.data),f})}},logOut:async function(){return await(await i()).logout({logoutParams:{returnTo:window.location.origin}}),{response:"User logged out"}},userDetails:o,readContract:async function(){const c=await i(),u={transaction_input:JSON.stringify({othentFunction:"idToken"})},l=(await s(c,u)).id_token;return await gi({method:"POST",url:"https://server.othent.io/read-contract",data:{JWT:l}}).then(h=>h.data).catch(h=>{throw console.log(h.response.data),h})},signTransactionWarp:async function(c){var u;(u=c.tags)!==null&&u!==void 0||(c.tags=[]);const l={function:c.othentFunction,data:{toContractId:c.data.toContractId,toContractFunction:c.data.toContractFunction,txnData:c.data.txnData}},h=await i(),f={transaction_input:JSON.stringify({othentFunction:c.othentFunction,warpData:l})},p=await s(h,f),d=p.id_token;if(!Fo(d).contract_id)throw new Error('{success: false, message:"Please create a Othent account"}');return{JWT:p.id_token,tags:c.tags}},sendTransactionWarp:async function(c){const u=c.JWT,l=c.tags;return await gi({method:"POST",url:"https://server.othent.io/send-transaction",data:{JWT:u,tags:l,API_ID:e}}).then(h=>h.data).catch(h=>{throw console.log(h.response.data),h})},signTransactionArweave:async function(c){var u;(u=c.tags)!==null&&u!==void 0||(c.tags=[]);const l=await a(c.data);if(!l)throw new Error("Invalid data, we accept: string | Buffer | ArrayBuffer | SharedArrayBuffer | Uint8Array | File");const h=await B0(l),f=await i(),p={transaction_input:JSON.stringify({othentFunction:c.othentFunction,file_hash:h})},d=await s(f,p),g=d.id_token;if(!Fo(g).contract_id)throw new Error('{ success: false, message: "Please create a Othent account" }');return{data:l,JWT:d.id_token,tags:c.tags}},sendTransactionArweave:async function(c){const u=c.data,l=new Blob([u]),h=new FormData;return h.append("file",l),h.append("dataHashJWT",c.JWT),h.append("API_ID",e),h.append("tags",JSON.stringify(c.tags)),await fetch("https://server.othent.io/upload-data-arweave",{method:"POST",body:h}).then(f=>f.json()).then(f=>f).catch(f=>{throw console.log(f),f})},signTransactionBundlr:async function(c){var u;(u=c.tags)!==null&&u!==void 0||(c.tags=[]);const l=await a(c.data);if(!l)throw new Error("Invalid data, we accept: string | Buffer | ArrayBuffer | SharedArrayBuffer | Uint8Array | File");const h=await B0(l),f=await i(),p={transaction_input:JSON.stringify({othentFunction:c.othentFunction,file_hash:h})},d=await s(f,p),g=d.id_token;if(!Fo(g).contract_id)throw new Error('{ success: false, message: "Please create a Othent account" }');return{data:l,JWT:d.id_token,tags:c.tags}},sendTransactionBundlr:async function(c){const u=c.data,l=new Blob([u]),h=new FormData;return h.append("file",l),h.append("dataHashJWT",c.JWT),h.append("API_ID",e),h.append("tags",JSON.stringify(c.tags)),await fetch("https://server.othent.io/upload-data-bundlr",{method:"POST",body:h}).then(f=>f.json()).then(f=>f).catch(f=>{throw console.log(f),f})},initializeJWK:async function(c){const u=c.privateKey,l=JSON.stringify(u),h=JSON.parse(l),f=mA(h),p=await i(),d={transaction_input:JSON.stringify({othentFunction:"initializeJWK",warpData:{function:"initializeJWK",data:{JWK_public_key_PEM:f,JWK_public_key:null}}})},g=(await s(p,d)).id_token;return gi({method:"POST",url:"https://server.othent.io/initialize-JWK",data:{PEM_key_JWT:g,API_ID:e}}).then(y=>y.data).catch(y=>{throw console.log(y.response.data),y})},JWKBackupTxn:async function(c){const u={iat:Math.floor(Date.now()/1e3),sub:c.sub,contract_id:c.contract_id,tags:c.tags,contract_input:{data:c.data,othentFunction:c.othentFunction}},l=c.privateKey,h=mA(l,{private:!0}),f={alg:"RS256",typ:"JWT",exp:Math.floor(Date.now()/1e3)+3600},p=Zee.jws.JWS.sign("RS256",JSON.stringify(f),JSON.stringify(u),h);return await gi({method:"POST",url:"https://server.othent.io/JWK-backup-transaction",data:{JWK_signed_JWT:p,API_ID:e}}).then(d=>d.data).catch(d=>{throw console.log(d.response.data),d})},readCustomContract:async function(c){return await gi({method:"POST",url:"https://server.othent.io/read-custom-contract",data:{contract_id:c.contract_id}}).then(u=>u.data).catch(u=>{throw console.log(u.response.data),u})},verifyArweaveData:async function(c){let u;(await(await fetch(`https://arweave.net/tx/${c.transactionId}`,{headers:{responseType:"arraybuffer"}})).json()).tags.map(d=>{atob(d.name)==="File-Hash-JWT"&&(u=Fo(atob(d.value)))});const h=u.file_hash;let f=(await gi.get(`https://arweave.net/${c.transactionId}`,{responseType:"arraybuffer"})).data;const p=await B0(f);return h===p?{validData:!0,contract_id:u.contract_id,onChainHash:p,tagHash:h,iat:u.iat,userId:u.sub}:{validData:!1,onChainHash:p,tagHash:h}},verifyBundlrData:async function(c){let u;(await(await fetch(`https://gateway.bundlr.network/tx/${c.transactionId}`,{headers:{responseType:"arraybuffer"}})).json()).tags.map(d=>{d.name==="File-Hash-JWT"&&(u=Fo(d.value))});const h=u.file_hash;let f=(await gi.get(`https://arweave.net/${c.transactionId}`,{responseType:"arraybuffer"})).data;const p=await B0(f);return h===p?{validData:!0,contract_id:u.contract_id,onChainHash:p,tagHash:h,iat:u.iat,userId:u.sub}:{validData:!1,onChainHash:p,tagHash:h}},encryptData:async function(c){const u=c.data,l=c.key;return{encryptedData:Fx.AES.encrypt(u,l).toString()}},decryptData:async function(c){const u=c.data,l=c.key,h=Fx.AES.decrypt(u,l);return{decryptedData:Fx.enc.Utf8.stringify(h)}},deployWarpContract:async function(c){var u;(u=c.tags)!==null&&u!==void 0||(c.tags=[]);const l=await B0(c.contractSrc),h=await i(),f={transaction_input:JSON.stringify({othentFunction:"uploadData",file_hash:l})},p=(await s(h,f)).id_token;return await gi({method:"POST",url:"https://server.othent.io/deploy-warp-contract",data:{contractSrc:c.contractSrc,contractState:c.state,JWT:p,tags:c.tags}}).then(d=>d.data).catch(d=>{throw console.log(d.response.data),d})}}}).catch(n=>{throw console.error("An error occurred:",n),n})}const M8={name:"ArweaveKit",value:"1.5.1"},CF=t=>{const e=t||{};return{use:n=>{if(!n.name)throw new Error("Please provide a valid plugin name.");if(e.hasOwnProperty(n.name))throw new Error("Plugin name already exists, please change plugin name.");return e[n.name]=n.plugin,CF(e)},...e}},Ete="6.9.0";function Ate(t,e,r){const n=e.split("|").map(s=>s.trim());for(let s=0;sPromise.resolve(t[n])))).reduce((n,i,s)=>(n[e[s]]=i,n),{})}function Je(t,e,r){for(let n in e){let i=e[n];const s=r?r[n]:null;s&&Ate(i,s,n),Object.defineProperty(t,n,{enumerable:!0,value:i,writable:!1})}}function Zl(t){if(t==null)return"null";if(Array.isArray(t))return"[ "+t.map(Zl).join(", ")+" ]";if(t instanceof Uint8Array){const e="0123456789abcdef";let r="0x";for(let n=0;n>4],r+=e[t[n]&15];return r}if(typeof t=="object"&&typeof t.toJSON=="function")return Zl(t.toJSON());switch(typeof t){case"boolean":case"symbol":return t.toString();case"bigint":return BigInt(t).toString();case"number":return t.toString();case"string":return JSON.stringify(t);case"object":{const e=Object.keys(t);return e.sort(),"{ "+e.map(r=>`${Zl(r)}: ${Zl(t[r])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function Li(t,e){return t&&t.code===e}function L8(t){return Li(t,"CALL_EXCEPTION")}function Er(t,e,r){let n=t;{const s=[];if(r){if("message"in r||"code"in r||"name"in r)throw new Error(`value will overwrite populated values: ${Zl(r)}`);for(const a in r){if(a==="shortMessage")continue;const o=r[a];s.push(a+"="+Zl(o))}}s.push(`code=${e}`),s.push(`version=${Ete}`),s.length&&(t+=" ("+s.join(", ")+")")}let i;switch(e){case"INVALID_ARGUMENT":i=new TypeError(t);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":i=new RangeError(t);break;default:i=new Error(t)}return Je(i,{code:e}),r&&Object.assign(i,r),i.shortMessage==null&&Je(i,{shortMessage:n}),i}function Te(t,e,r,n){if(!t)throw Er(e,r,n)}function he(t,e,r,n){Te(t,e,"INVALID_ARGUMENT",{argument:r,value:n})}function _F(t,e,r){r==null&&(r=""),r&&(r=": "+r),Te(t>=e,"missing arguemnt"+r,"MISSING_ARGUMENT",{count:t,expectedCount:e}),Te(t<=e,"too many arguemnts"+r,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}const Ste=["NFD","NFC","NFKD","NFKC"].reduce((t,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");t.push(e)}catch{}return t},[]);function Cte(t){Te(Ste.indexOf(t)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:t}})}function ty(t,e,r){if(r==null&&(r=""),t!==e){let n=r,i="new";r&&(n+=".",i+=" "+r),Te(!1,`private constructor; use ${n}from* methods`,"UNSUPPORTED_OPERATION",{operation:i})}}function kF(t,e,r){if(t instanceof Uint8Array)return r?new Uint8Array(t):t;if(typeof t=="string"&&t.match(/^0x([0-9a-f][0-9a-f])*$/i)){const n=new Uint8Array((t.length-2)/2);let i=2;for(let s=0;s>4]+uS[i&15]}return r}function _r(t){return"0x"+t.map(e=>qe(e).substring(2)).join("")}function mf(t){return Yt(t,!0)?(t.length-2)/2:Et(t).length}function sr(t,e,r){const n=Et(t);return r!=null&&r>n.length&&Te(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r}),qe(n.slice(e??0,r??n.length))}function BF(t,e,r){const n=Et(t);Te(e>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:e,offset:e+1});const i=new Uint8Array(e);return i.fill(0),r?i.set(n,e-n.length):i.set(n,0),qe(i)}function Zu(t,e){return BF(t,e,!0)}function kte(t,e){return BF(t,e,!1)}const ry=BigInt(0),Es=BigInt(1),Jl=9007199254740991;function Bte(t,e){const r=ny(t,"value"),n=BigInt(at(e,"width"));if(Te(r>>n===ry,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),r>>n-Es){const i=(Es<=-Jl&&t<=Jl,"overflow",e||"value",t),BigInt(t);case"string":try{if(t==="")throw new Error("empty string");return t[0]==="-"&&t[1]!=="-"?-BigInt(t.substring(1)):BigInt(t)}catch(r){he(!1,`invalid BigNumberish string: ${r.message}`,e||"value",t)}}he(!1,"invalid BigNumberish value",e||"value",t)}function ny(t,e){const r=Ke(t,e);return Te(r>=ry,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),r}const lS="0123456789abcdef";function j8(t){if(t instanceof Uint8Array){let e="0x0";for(const r of t)e+=lS[r>>4],e+=lS[r&15];return BigInt(e)}return Ke(t)}function at(t,e){switch(typeof t){case"bigint":return he(t>=-Jl&&t<=Jl,"overflow",e||"value",t),Number(t);case"number":return he(Number.isInteger(t),"underflow",e||"value",t),he(t>=-Jl&&t<=Jl,"overflow",e||"value",t),t;case"string":try{if(t==="")throw new Error("empty string");return at(BigInt(t),e)}catch(r){he(!1,`invalid numeric string: ${r.message}`,e||"value",t)}}he(!1,"invalid numeric value",e||"value",t)}function Ite(t){return at(j8(t))}function Tc(t,e){let n=ny(t,"value").toString(16);if(e==null)n.length%2&&(n="0"+n);else{const i=at(e,"width");for(Te(i*2>=n.length,`value exceeds width (${i} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:t});n.length>6===2;a++)s++;return s}return t==="OVERRUN"?r.length-e-1:0}function Dte(t,e,r,n,i){return t==="OVERLONG"?(he(typeof i=="number","invalid bad code point for replacement","badCodepoint",i),n.push(i),0):(n.push(65533),TF(t,e,r))}const Rte=Object.freeze({error:Ote,ignore:TF,replace:Dte});function Mte(t,e){e==null&&(e=Rte.error);const r=Et(t,"bytes"),n=[];let i=0;for(;i>7)){n.push(s);continue}let a=null,o=null;if((s&224)===192)a=1,o=127;else if((s&240)===224)a=2,o=2047;else if((s&248)===240)a=3,o=65535;else{(s&192)===128?i+=e("UNEXPECTED_CONTINUE",i-1,r,n):i+=e("BAD_PREFIX",i-1,r,n);continue}if(i-1+a>=r.length){i+=e("OVERRUN",i-1,r,n);continue}let c=s&(1<<8-a-1)-1;for(let u=0;u1114111){i+=e("OUT_OF_RANGE",i-1-a,r,n,c);continue}if(c>=55296&&c<=57343){i+=e("UTF16_SURROGATE",i-1-a,r,n,c);continue}if(c<=o){i+=e("OVERLONG",i-1-a,r,n,c);continue}n.push(c)}}return n}function no(t,e){e!=null&&(Cte(e),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);he(n>18|240),r.push(a>>12&63|128),r.push(a>>6&63|128),r.push(a&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return new Uint8Array(r)}function Lte(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function U8(t,e){return Lte(Mte(t,e))}function PF(t){async function e(r,n){const i=r.url.split(":")[0].toLowerCase();Te(i==="http"||i==="https",`unsupported protocol ${i}`,"UNSUPPORTED_OPERATION",{info:{protocol:i},operation:"request"}),Te(i==="https"||!r.credentials||r.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let s;if(n){const h=new AbortController;s=h.signal,n.addListener(()=>{h.abort()})}const a={method:r.method,headers:new Headers(Array.from(r)),body:r.body||void 0,signal:s},o=await fetch(r.url,a),c={};o.headers.forEach((h,f)=>{c[f.toLowerCase()]=h});const u=await o.arrayBuffer(),l=u==null?null:new Uint8Array(u);return{statusCode:o.status,statusMessage:o.statusText,headers:c,body:l}}return e}const jte=12,Ute=250;let hS=PF();const $te=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),Hte=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let Tx=!1;async function NF(t,e){try{const r=t.match($te);if(!r)throw new Error("invalid data");return new wc(200,"OK",{"content-type":r[1]||"text/plain"},r[2]?Pte(r[3]):Vte(r[3]))}catch{return new wc(599,"BAD REQUEST (invalid data: URI)",{},null,new Pc(t))}}function OF(t){async function e(r,n){try{const i=r.match(Hte);if(!i)throw new Error("invalid link");return new Pc(`${t}${i[2]}`)}catch{return new wc(599,"BAD REQUEST (invalid IPFS URI)",{},null,new Pc(r))}}return e}const B1={data:NF,ipfs:OF("https://gateway.ipfs.io/ipfs/")},DF=new WeakMap;var lu,Wo;class zte{constructor(e){ce(this,lu,void 0);ce(this,Wo,void 0);Q(this,lu,[]),Q(this,Wo,!1),DF.set(e,()=>{if(!U(this,Wo)){Q(this,Wo,!0);for(const r of U(this,lu))setTimeout(()=>{r()},0);Q(this,lu,[])}})}addListener(e){Te(!U(this,Wo),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),U(this,lu).push(e)}get cancelled(){return U(this,Wo)}checkSignal(){Te(!this.cancelled,"cancelled","CANCELLED",{})}}lu=new WeakMap,Wo=new WeakMap;function I1(t){if(t==null)throw new Error("missing signal; should not happen");return t.checkSignal(),t}var Sf,Cf,ps,Ta,_f,kf,Tr,Jn,Pa,fu,hu,du,zs,Na,Go,pu,U0;const Vm=class Vm{constructor(e){ce(this,pu);ce(this,Sf,void 0);ce(this,Cf,void 0);ce(this,ps,void 0);ce(this,Ta,void 0);ce(this,_f,void 0);ce(this,kf,void 0);ce(this,Tr,void 0);ce(this,Jn,void 0);ce(this,Pa,void 0);ce(this,fu,void 0);ce(this,hu,void 0);ce(this,du,void 0);ce(this,zs,void 0);ce(this,Na,void 0);ce(this,Go,void 0);Q(this,kf,String(e)),Q(this,Sf,!1),Q(this,Cf,!0),Q(this,ps,{}),Q(this,Ta,""),Q(this,_f,3e5),Q(this,Na,{slotInterval:Ute,maxAttempts:jte}),Q(this,Go,null)}get url(){return U(this,kf)}set url(e){Q(this,kf,String(e))}get body(){return U(this,Tr)==null?null:new Uint8Array(U(this,Tr))}set body(e){if(e==null)Q(this,Tr,void 0),Q(this,Jn,void 0);else if(typeof e=="string")Q(this,Tr,no(e)),Q(this,Jn,"text/plain");else if(e instanceof Uint8Array)Q(this,Tr,e),Q(this,Jn,"application/octet-stream");else if(typeof e=="object")Q(this,Tr,no(JSON.stringify(e))),Q(this,Jn,"application/json");else throw new Error("invalid body")}hasBody(){return U(this,Tr)!=null}get method(){return U(this,Ta)?U(this,Ta):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),Q(this,Ta,String(e).toUpperCase())}get headers(){const e=Object.assign({},U(this,ps));return U(this,Pa)&&(e.authorization=`Basic ${Nte(no(U(this,Pa)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&U(this,Jn)&&(e["content-type"]=U(this,Jn)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,r){U(this,ps)[String(e).toLowerCase()]=String(r)}clearHeaders(){Q(this,ps,{})}[Symbol.iterator](){const e=this.headers,r=Object.keys(e);let n=0;return{next:()=>{if(n=0,"timeout must be non-zero","timeout",e),Q(this,_f,e)}get preflightFunc(){return U(this,fu)||null}set preflightFunc(e){Q(this,fu,e)}get processFunc(){return U(this,hu)||null}set processFunc(e){Q(this,hu,e)}get retryFunc(){return U(this,du)||null}set retryFunc(e){Q(this,du,e)}get getUrlFunc(){return U(this,Go)||hS}set getUrlFunc(e){Q(this,Go,e)}toString(){return``}setThrottleParams(e){e.slotInterval!=null&&(U(this,Na).slotInterval=e.slotInterval),e.maxAttempts!=null&&(U(this,Na).maxAttempts=e.maxAttempts)}send(){return Te(U(this,zs)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),Q(this,zs,new zte(this)),ye(this,pu,U0).call(this,0,dS()+this.timeout,0,this,new wc(0,"",{},null,this))}cancel(){Te(U(this,zs)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=DF.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const r=this.url.split(":")[0].toLowerCase(),n=e.split(":")[0].toLowerCase();Te(this.method==="GET"&&(r!=="https"||n!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const i=new Vm(e);return i.method="GET",i.allowGzip=this.allowGzip,i.timeout=this.timeout,Q(i,ps,Object.assign({},U(this,ps))),U(this,Tr)&&Q(i,Tr,new Uint8Array(U(this,Tr))),Q(i,Jn,U(this,Jn)),i}clone(){const e=new Vm(this.url);return Q(e,Ta,U(this,Ta)),U(this,Tr)&&Q(e,Tr,U(this,Tr)),Q(e,Jn,U(this,Jn)),Q(e,ps,Object.assign({},U(this,ps))),Q(e,Pa,U(this,Pa)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),Q(e,fu,U(this,fu)),Q(e,hu,U(this,hu)),Q(e,du,U(this,du)),Q(e,Go,U(this,Go)),e}static lockConfig(){Tx=!0}static getGateway(e){return B1[e.toLowerCase()]||null}static registerGateway(e,r){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(Tx)throw new Error("gateways locked");B1[e]=r}static registerGetUrl(e){if(Tx)throw new Error("gateways locked");hS=e}static createGetUrlFunc(e){return PF()}static createDataGateway(){return NF}static createIpfsGatewayFunc(e){return OF(e)}};Sf=new WeakMap,Cf=new WeakMap,ps=new WeakMap,Ta=new WeakMap,_f=new WeakMap,kf=new WeakMap,Tr=new WeakMap,Jn=new WeakMap,Pa=new WeakMap,fu=new WeakMap,hu=new WeakMap,du=new WeakMap,zs=new WeakMap,Na=new WeakMap,Go=new WeakMap,pu=new WeakSet,U0=async function(e,r,n,i,s){var l,h,f;if(e>=U(this,Na).maxAttempts)return s.makeServerError("exceeded maximum retry limit");Te(dS()<=r,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:i}),n>0&&await qte(n);let a=this.clone();const o=(a.url.split(":")[0]||"").toLowerCase();if(o in B1){const p=await B1[o](a.url,I1(U(i,zs)));if(p instanceof wc){let d=p;if(this.processFunc){I1(U(i,zs));try{d=await this.processFunc(a,d)}catch(g){(g.throttle==null||typeof g.stall!="number")&&d.makeServerError("error in post-processing function",g).assertOk()}}return d}a=p}this.preflightFunc&&(a=await this.preflightFunc(a));const c=await this.getUrlFunc(a,I1(U(i,zs)));let u=new wc(c.statusCode,c.statusMessage,c.headers,c.body,i);if(u.statusCode===301||u.statusCode===302){try{const p=u.headers.location||"";return ye(l=a.redirect(p),pu,U0).call(l,e+1,r,0,i,u)}catch{}return u}else if(u.statusCode===429&&(this.retryFunc==null||await this.retryFunc(a,u,e))){const p=u.headers["retry-after"];let d=U(this,Na).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof p=="string"&&p.match(/^[1-9][0-9]*$/)&&(d=parseInt(p)),ye(h=a.clone(),pu,U0).call(h,e+1,r,d,i,u)}if(this.processFunc){I1(U(i,zs));try{u=await this.processFunc(a,u)}catch(p){(p.throttle==null||typeof p.stall!="number")&&u.makeServerError("error in post-processing function",p).assertOk();let d=U(this,Na).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return p.stall>=0&&(d=p.stall),ye(f=a.clone(),pu,U0).call(f,e+1,r,d,i,u)}}return u};let Pc=Vm;var dp,pp,gp,gs,Bf,gu;const g5=class g5{constructor(e,r,n,i,s){ce(this,dp,void 0);ce(this,pp,void 0);ce(this,gp,void 0);ce(this,gs,void 0);ce(this,Bf,void 0);ce(this,gu,void 0);Q(this,dp,e),Q(this,pp,r),Q(this,gp,Object.keys(n).reduce((a,o)=>(a[o.toLowerCase()]=String(n[o]),a),{})),Q(this,gs,i==null?null:new Uint8Array(i)),Q(this,Bf,s||null),Q(this,gu,{message:""})}toString(){return``}get statusCode(){return U(this,dp)}get statusMessage(){return U(this,pp)}get headers(){return Object.assign({},U(this,gp))}get body(){return U(this,gs)==null?null:new Uint8Array(U(this,gs))}get bodyText(){try{return U(this,gs)==null?"":U8(U(this,gs))}catch{Te(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{Te(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,r=Object.keys(e);let n=0;return{next:()=>{if(n=0,"invalid stall timeout","stall",r);const n=new Error(e||"throttling requests");throw Je(n,{stall:r,throttle:!0}),n}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return U(this,gs)!=null}get request(){return U(this,Bf)}ok(){return U(this,gu).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:r}=U(this,gu);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`),Te(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:r})}};dp=new WeakMap,pp=new WeakMap,gp=new WeakMap,gs=new WeakMap,Bf=new WeakMap,gu=new WeakMap;let wc=g5;function dS(){return new Date().getTime()}function Vte(t){return no(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function qte(t){return new Promise(e=>setTimeout(e,t))}function Kte(t){let e=t.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function pS(t,e,r){let n=0;for(let i=0;i{Te(n<=t.length,"data short segment too short","BUFFER_OVERRUN",{buffer:t,length:t.length,offset:n})};if(t[e]>=248){const n=t[e]-247;r(e+1+n);const i=pS(t,e+1,n);return r(e+1+n+i),gS(t,e,e+1+n,n+i)}else if(t[e]>=192){const n=t[e]-192;return r(e+1+n),gS(t,e,e+1,n)}else if(t[e]>=184){const n=t[e]-183;r(e+1+n);const i=pS(t,e+1,n);r(e+1+n+i);const s=qe(t.slice(e+1+n,e+1+n+i));return{consumed:1+n+i,result:s}}else if(t[e]>=128){const n=t[e]-128;r(e+1+n);const i=qe(t.slice(e+1,e+1+n));return{consumed:1+n,result:i}}return{consumed:1,result:Kte(t[e])}}function $8(t){const e=Et(t,"data"),r=RF(e,0);return he(r.consumed===e.length,"unexpected junk after rlp payload","data",t),r.result}function mS(t){const e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function MF(t){if(Array.isArray(t)){let n=[];if(t.forEach(function(s){n=n.concat(MF(s))}),n.length<=55)return n.unshift(192+n.length),n;const i=mS(n.length);return i.unshift(247+i.length),i.concat(n)}const e=Array.prototype.slice.call(Et(t,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const r=mS(e.length);return r.unshift(183+r.length),r.concat(e)}const vS="0123456789abcdef";function Zd(t){let e="0x";for(const r of MF(t))e+=vS[r>>4],e+=vS[r&15];return e}const bn=32,Vw=new Uint8Array(bn),Wte=["then"],F1={};function I0(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);throw r.error=e,r}var Zo;const ud=class ud extends Array{constructor(...r){const n=r[0];let i=r[1],s=(r[2]||[]).slice(),a=!0;n!==F1&&(i=r,s=[],a=!1);super(i.length);ce(this,Zo,void 0);i.forEach((c,u)=>{this[u]=c});const o=s.reduce((c,u)=>(typeof u=="string"&&c.set(u,(c.get(u)||0)+1),c),new Map);if(Q(this,Zo,Object.freeze(i.map((c,u)=>{const l=s[u];return l!=null&&o.get(l)===1?l:null}))),!!a)return Object.freeze(this),new Proxy(this,{get:(c,u,l)=>{if(typeof u=="string"){if(u.match(/^[0-9]+$/)){const f=at(u,"%index");if(f<0||f>=this.length)throw new RangeError("out of result range");const p=c[f];return p instanceof Error&&I0(`index ${f}`,p),p}if(Wte.indexOf(u)>=0)return Reflect.get(c,u,l);const h=c[u];if(h instanceof Function)return function(...f){return h.apply(this===l?c:this,f)};if(!(u in c))return c.getValue.apply(this===l?c:this,[u])}return Reflect.get(c,u,l)}})}toArray(){const r=[];return this.forEach((n,i)=>{n instanceof Error&&I0(`index ${i}`,n),r.push(n)}),r}toObject(){return U(this,Zo).reduce((r,n,i)=>(Te(n!=null,"value at index ${ index } unnamed","UNSUPPORTED_OPERATION",{operation:"toObject()"}),n in r||(r[n]=this.getValue(n)),r),{})}slice(r,n){r==null&&(r=0),r<0&&(r+=this.length,r<0&&(r=0)),n==null&&(n=this.length),n<0&&(n+=this.length,n<0&&(n=0)),n>this.length&&(n=this.length);const i=[],s=[];for(let a=r;a{U(this,Oa)[e]=yS(r)}}}Oa=new WeakMap,mu=new WeakMap,If=new WeakSet,vg=function(e){return U(this,Oa).push(e),Q(this,mu,U(this,mu)+e.length),e.length};var Xn,wi,qm,LF;const m5=class m5{constructor(e,r){ce(this,qm);ae(this,"allowLoose");ce(this,Xn,void 0);ce(this,wi,void 0);Je(this,{allowLoose:!!r}),Q(this,Xn,Nn(e)),Q(this,wi,0)}get data(){return qe(U(this,Xn))}get dataLength(){return U(this,Xn).length}get consumed(){return U(this,wi)}get bytes(){return new Uint8Array(U(this,Xn))}subReader(e){return new m5(U(this,Xn).slice(U(this,wi)+e),this.allowLoose)}readBytes(e,r){let n=ye(this,qm,LF).call(this,0,e,!!r);return Q(this,wi,U(this,wi)+n.length),n.slice(0,e)}readValue(){return j8(this.readBytes(bn))}readIndex(){return Ite(this.readBytes(bn))}};Xn=new WeakMap,wi=new WeakMap,qm=new WeakSet,LF=function(e,r,n){let i=Math.ceil(r/bn)*bn;return U(this,wi)+i>U(this,Xn).length&&(this.allowLoose&&n&&U(this,wi)+r<=U(this,Xn).length?i=r:Te(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:Nn(U(this,Xn)),length:U(this,Xn).length,offset:U(this,wi)+i})),U(this,Xn).slice(U(this,wi),U(this,wi)+i)};let Kw=m5;function Fm(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function H8(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function Gte(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Fm(t.outputLen),Fm(t.blockLen)}function Mh(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function jF(t,e){H8(t);const r=e.outputLen;if(t.lengtht instanceof Uint8Array,Zte=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),Nx=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),js=(t,e)=>t<<32-e|t>>>e,Jte=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Jte)throw new Error("Non little-endian hardware is not supported");function Xte(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function iy(t){if(typeof t=="string"&&(t=Xte(t)),!UF(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function Qte(...t){const e=new Uint8Array(t.reduce((n,i)=>n+i.length,0));let r=0;return t.forEach(n=>{if(!UF(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}class z8{clone(){return this._cloneInto()}}function $F(t){const e=n=>t().update(iy(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function Yte(t=32){if(Px&&typeof Px.getRandomValues=="function")return Px.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class HF extends z8{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,Gte(e);const n=iy(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let a=0;anew HF(t,e).update(r).digest();zF.create=(t,e)=>new HF(t,e);function ere(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),a=Number(r>>i&s),o=Number(r&s),c=n?4:0,u=n?0:4;t.setUint32(e+c,a,n),t.setUint32(e+u,o,n)}class tre extends z8{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Nx(this.buffer)}update(e){Mh(this);const{view:r,buffer:n,blockLen:i}=this;e=iy(e);const s=e.length;for(let a=0;ai-a&&(this.process(n,0),a=0);for(let h=a;hl.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;ht&e^~t&r,nre=(t,e,r)=>t&e^t&r^e&r,ire=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]),Po=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),No=new Uint32Array(64);class sre extends tre{constructor(){super(64,32,8,!1),this.A=Po[0]|0,this.B=Po[1]|0,this.C=Po[2]|0,this.D=Po[3]|0,this.E=Po[4]|0,this.F=Po[5]|0,this.G=Po[6]|0,this.H=Po[7]|0}get(){const{A:e,B:r,C:n,D:i,E:s,F:a,G:o,H:c}=this;return[e,r,n,i,s,a,o,c]}set(e,r,n,i,s,a,o,c){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=a|0,this.G=o|0,this.H=c|0}process(e,r){for(let h=0;h<16;h++,r+=4)No[h]=e.getUint32(r,!1);for(let h=16;h<64;h++){const f=No[h-15],p=No[h-2],d=js(f,7)^js(f,18)^f>>>3,g=js(p,17)^js(p,19)^p>>>10;No[h]=g+No[h-7]+d+No[h-16]|0}let{A:n,B:i,C:s,D:a,E:o,F:c,G:u,H:l}=this;for(let h=0;h<64;h++){const f=js(o,6)^js(o,11)^js(o,25),p=l+f+rre(o,c,u)+ire[h]+No[h]|0,g=(js(n,2)^js(n,13)^js(n,22))+nre(n,i,s)|0;l=u,u=c,c=o,o=a+p|0,a=s,s=i,i=n,n=p+g|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,a=a+this.D|0,o=o+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(n,i,s,a,o,c,u,l)}roundClean(){No.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const are=$F(()=>new sre),T1=BigInt(2**32-1),xS=BigInt(32);function ore(t,e=!1){return e?{h:Number(t&T1),l:Number(t>>xS&T1)}:{h:Number(t>>xS&T1)|0,l:Number(t&T1)|0}}function cre(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;it<>>32-r,lre=(t,e,r)=>e<>>32-r,fre=(t,e,r)=>e<>>64-r,hre=(t,e,r)=>t<>>64-r,[VF,qF,KF]=[[],[],[]],dre=BigInt(0),F0=BigInt(1),pre=BigInt(2),gre=BigInt(7),mre=BigInt(256),vre=BigInt(113);for(let t=0,e=F0,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],VF.push(2*(5*n+r)),qF.push((t+1)*(t+2)/2%64);let i=dre;for(let s=0;s<7;s++)e=(e<>gre)*vre)%mre,e&pre&&(i^=F0<<(F0<r>32?fre(t,e,r):ure(t,e,r),wS=(t,e,r)=>r>32?hre(t,e,r):lre(t,e,r);function bre(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let a=0;a<10;a++)r[a]=t[a]^t[a+10]^t[a+20]^t[a+30]^t[a+40];for(let a=0;a<10;a+=2){const o=(a+8)%10,c=(a+2)%10,u=r[c],l=r[c+1],h=bS(u,l,1)^r[o],f=wS(u,l,1)^r[o+1];for(let p=0;p<50;p+=10)t[a+p]^=h,t[a+p+1]^=f}let i=t[2],s=t[3];for(let a=0;a<24;a++){const o=qF[a],c=bS(i,s,o),u=wS(i,s,o),l=VF[a];i=t[l],s=t[l+1],t[l]=c,t[l+1]=u}for(let a=0;a<50;a+=10){for(let o=0;o<10;o++)r[o]=t[a+o];for(let o=0;o<10;o++)t[a+o]^=~r[(o+2)%10]&r[(o+4)%10]}t[0]^=yre[n],t[1]^=xre[n]}r.fill(0)}class V8 extends z8{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Fm(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Zte(this.state)}keccak(){bre(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Mh(this);const{blockLen:r,state:n}=this;e=iy(e);const i=e.length;for(let s=0;s=n&&this.keccak();const a=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+a),i),this.posOut+=a,i+=a}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Fm(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(jF(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:a}=this;return e||(e=new V8(r,n,i,a,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=a,e.destroyed=this.destroyed,e}}const wre=(t,e,r)=>$F(()=>new V8(e,t,r)),Ere=wre(1,136,256/8);let WF=!1;const GF=function(t){return Ere(t)};let ZF=GF;function Qt(t){const e=Et(t,"data");return qe(ZF(e))}Qt._=GF;Qt.lock=function(){WF=!0};Qt.register=function(t){if(WF)throw new TypeError("keccak256 is locked");ZF=t};Object.freeze(Qt);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const JF=BigInt(0),sy=BigInt(1),Are=BigInt(2),ay=t=>t instanceof Uint8Array,Sre=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Lh(t){if(!ay(t))throw new Error("Uint8Array expected");let e="";for(let r=0;rn+i.length,0));let r=0;return t.forEach(n=>{if(!ay(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}function _re(t,e){if(t.length!==e.length)return!1;for(let r=0;rJF;t>>=sy,e+=1);return e}function Ire(t,e){return t>>BigInt(e)&sy}const Fre=(t,e,r)=>t|(r?sy:JF)<(Are<new Uint8Array(t),ES=t=>Uint8Array.from(t);function QF(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=Ox(t),i=Ox(t),s=0;const a=()=>{n.fill(1),i.fill(0),s=0},o=(...h)=>r(i,n,...h),c=(h=Ox())=>{i=o(ES([0]),h),n=o(),h.length!==0&&(i=o(ES([1]),h),n=o())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let h=0;const f=[];for(;h{a(),c(h);let p;for(;!(p=f(u()));)c();return a(),p}}const Tre={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function qp(t,e,r={}){const n=(i,s,a)=>{const o=Tre[s];if(typeof o!="function")throw new Error(`Invalid validator "${s}", expected function`);const c=t[i];if(!(a&&c===void 0)&&!o(c,t))throw new Error(`Invalid param ${String(i)}=${c} (${typeof c}), expected ${s}`)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const Pre=Object.freeze(Object.defineProperty({__proto__:null,bitGet:Ire,bitLen:Bre,bitMask:G8,bitSet:Fre,bytesToHex:Lh,bytesToNumberBE:Du,bytesToNumberLE:K8,concatBytes:Jd,createHmacDrbg:QF,ensureBytes:ss,equalBytes:_re,hexToBytes:jh,hexToNumber:q8,numberToBytesBE:Uh,numberToBytesLE:W8,numberToHexUnpadded:XF,numberToVarBytesBE:Cre,utf8ToBytes:kre,validateObject:qp},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Rr=BigInt(0),lr=BigInt(1),Jc=BigInt(2),Nre=BigInt(3),Ww=BigInt(4),AS=BigInt(5),SS=BigInt(8);BigInt(9);BigInt(16);function In(t,e){const r=t%e;return r>=Rr?r:e+r}function Ore(t,e,r){if(r<=Rr||e 0");if(r===lr)return Rr;let n=lr;for(;e>Rr;)e&lr&&(n=n*t%r),t=t*t%r,e>>=lr;return n}function vi(t,e,r){let n=t;for(;e-- >Rr;)n*=n,n%=r;return n}function Gw(t,e){if(t===Rr||e<=Rr)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=In(t,e),n=e,i=Rr,s=lr;for(;r!==Rr;){const o=n/r,c=n%r,u=i-s*o;n=r,r=c,i=s,s=u}if(n!==lr)throw new Error("invert: does not exist");return In(i,e)}function Dre(t){const e=(t-lr)/Jc;let r,n,i;for(r=t-lr,n=0;r%Jc===Rr;r/=Jc,n++);for(i=Jc;i(n[i]="function",n),e);return qp(t,r)}function jre(t,e,r){if(r 0");if(r===Rr)return t.ONE;if(r===lr)return e;let n=t.ONE,i=e;for(;r>Rr;)r&lr&&(n=t.mul(n,i)),i=t.sqr(i),r>>=lr;return n}function Ure(t,e){const r=new Array(e.length),n=e.reduce((s,a,o)=>t.is0(a)?s:(r[o]=s,t.mul(s,a)),t.ONE),i=t.inv(n);return e.reduceRight((s,a,o)=>t.is0(a)?s:(r[o]=t.mul(s,r[o]),t.mul(s,a)),i),r}function YF(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function $re(t,e,r=!1,n={}){if(t<=Rr)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=YF(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=Rre(t),o=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:G8(i),ZERO:Rr,ONE:lr,create:c=>In(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return Rr<=c&&cc===Rr,isOdd:c=>(c&lr)===lr,neg:c=>In(-c,t),eql:(c,u)=>c===u,sqr:c=>In(c*c,t),add:(c,u)=>In(c+u,t),sub:(c,u)=>In(c-u,t),mul:(c,u)=>In(c*u,t),pow:(c,u)=>jre(o,c,u),div:(c,u)=>In(c*Gw(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>Gw(c,t),sqrt:n.sqrt||(c=>a(o,c)),invertBatch:c=>Ure(o,c),cmov:(c,u,l)=>l?u:c,toBytes:c=>r?W8(c,s):Uh(c,s),fromBytes:c=>{if(c.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${c.length}`);return r?K8(c):Du(c)}});return Object.freeze(o)}function eT(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function tT(t){const e=eT(t);return e+Math.ceil(e/2)}function Hre(t,e,r=!1){const n=t.length,i=eT(e),s=tT(e);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const a=r?Du(t):K8(t),o=In(a,e-lr)+lr;return r?W8(o,i):Uh(o,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const zre=BigInt(0),Dx=BigInt(1);function Vre(t,e){const r=(i,s)=>{const a=s.negate();return i?a:s},n=i=>{const s=Math.ceil(e/i)+1,a=2**(i-1);return{windows:s,windowSize:a}};return{constTimeNegate:r,unsafeLadder(i,s){let a=t.ZERO,o=i;for(;s>zre;)s&Dx&&(a=a.add(o)),o=o.double(),s>>=Dx;return a},precomputeWindow(i,s){const{windows:a,windowSize:o}=n(s),c=[];let u=i,l=u;for(let h=0;h>=p,y>c&&(y-=f,a+=Dx);const x=g,b=g+Math.abs(y)-1,S=d%2!==0,k=y<0;y===0?l=l.add(r(S,s[x])):u=u.add(r(k,s[b]))}return{p:u,f:l}},wNAFCached(i,s,a,o){const c=i._WINDOW_SIZE||1;let u=s.get(i);return u||(u=this.precomputeWindow(i,c),c!==1&&s.set(i,o(u))),this.wNAF(c,u,a)}}}function rT(t){return Lre(t.Fp),qp(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...YF(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function qre(t){const e=rT(t);qp(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:Kre,hexToBytes:Wre}=Pre,nu={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=nu;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");const r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:Kre(n),l:t.subarray(r+2)}},toSig(t){const{Err:e}=nu,r=typeof t=="string"?Wre(t):t;if(!(r instanceof Uint8Array))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");const{d:i,l:s}=nu._parseInt(r.subarray(2)),{d:a,l:o}=nu._parseInt(s);if(o.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s:a}},hexFromSig(t){const e=u=>Number.parseInt(u[0],16)&8?"00"+u:u,r=u=>{const l=u.toString(16);return l.length&1?`0${l}`:l},n=e(r(t.s)),i=e(r(t.r)),s=n.length/2,a=i.length/2,o=r(s),c=r(a);return`30${r(a+s+4)}02${c}${i}02${o}${n}`}},Ka=BigInt(0),_i=BigInt(1);BigInt(2);const CS=BigInt(3);BigInt(4);function Gre(t){const e=qre(t),{Fp:r}=e,n=e.toBytes||((d,g,y)=>{const x=g.toAffine();return Jd(Uint8Array.from([4]),r.toBytes(x.x),r.toBytes(x.y))}),i=e.fromBytes||(d=>{const g=d.subarray(1),y=r.fromBytes(g.subarray(0,r.BYTES)),x=r.fromBytes(g.subarray(r.BYTES,2*r.BYTES));return{x:y,y:x}});function s(d){const{a:g,b:y}=e,x=r.sqr(d),b=r.mul(x,d);return r.add(r.add(b,r.mul(d,g)),y)}if(!r.eql(r.sqr(e.Gy),s(e.Gx)))throw new Error("bad generator point: equation left != right");function a(d){return typeof d=="bigint"&&Kar.eql(S,r.ZERO);return b(y)&&b(x)?h.ZERO:new h(y,x,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(g){const y=r.invertBatch(g.map(x=>x.pz));return g.map((x,b)=>x.toAffine(y[b])).map(h.fromAffine)}static fromHex(g){const y=h.fromAffine(i(ss("pointHex",g)));return y.assertValidity(),y}static fromPrivateKey(g){return h.BASE.multiply(c(g))}_setWindowSize(g){this._WINDOW_SIZE=g,u.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:g,y}=this.toAffine();if(!r.isValid(g)||!r.isValid(y))throw new Error("bad point: x or y not FE");const x=r.sqr(y),b=s(g);if(!r.eql(x,b))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:g}=this.toAffine();if(r.isOdd)return!r.isOdd(g);throw new Error("Field doesn't support isOdd")}equals(g){l(g);const{px:y,py:x,pz:b}=this,{px:S,py:k,pz:T}=g,_=r.eql(r.mul(y,T),r.mul(S,b)),B=r.eql(r.mul(x,T),r.mul(k,b));return _&&B}negate(){return new h(this.px,r.neg(this.py),this.pz)}double(){const{a:g,b:y}=e,x=r.mul(y,CS),{px:b,py:S,pz:k}=this;let T=r.ZERO,_=r.ZERO,B=r.ZERO,N=r.mul(b,b),P=r.mul(S,S),D=r.mul(k,k),O=r.mul(b,S);return O=r.add(O,O),B=r.mul(b,k),B=r.add(B,B),T=r.mul(g,B),_=r.mul(x,D),_=r.add(T,_),T=r.sub(P,_),_=r.add(P,_),_=r.mul(T,_),T=r.mul(O,T),B=r.mul(x,B),D=r.mul(g,D),O=r.sub(N,D),O=r.mul(g,O),O=r.add(O,B),B=r.add(N,N),N=r.add(B,N),N=r.add(N,D),N=r.mul(N,O),_=r.add(_,N),D=r.mul(S,k),D=r.add(D,D),N=r.mul(D,O),T=r.sub(T,N),B=r.mul(D,P),B=r.add(B,B),B=r.add(B,B),new h(T,_,B)}add(g){l(g);const{px:y,py:x,pz:b}=this,{px:S,py:k,pz:T}=g;let _=r.ZERO,B=r.ZERO,N=r.ZERO;const P=e.a,D=r.mul(e.b,CS);let O=r.mul(y,S),E=r.mul(x,k),F=r.mul(b,T),A=r.add(y,x),I=r.add(S,k);A=r.mul(A,I),I=r.add(O,E),A=r.sub(A,I),I=r.add(y,b);let j=r.add(S,T);return I=r.mul(I,j),j=r.add(O,F),I=r.sub(I,j),j=r.add(x,b),_=r.add(k,T),j=r.mul(j,_),_=r.add(E,F),j=r.sub(j,_),N=r.mul(P,I),_=r.mul(D,F),N=r.add(_,N),_=r.sub(E,N),N=r.add(E,N),B=r.mul(_,N),E=r.add(O,O),E=r.add(E,O),F=r.mul(P,F),I=r.mul(D,I),E=r.add(E,F),F=r.sub(O,F),F=r.mul(P,F),I=r.add(I,F),O=r.mul(E,I),B=r.add(B,O),O=r.mul(j,I),_=r.mul(A,_),_=r.sub(_,O),O=r.mul(A,E),N=r.mul(j,N),N=r.add(N,O),new h(_,B,N)}subtract(g){return this.add(g.negate())}is0(){return this.equals(h.ZERO)}wNAF(g){return p.wNAFCached(this,u,g,y=>{const x=r.invertBatch(y.map(b=>b.pz));return y.map((b,S)=>b.toAffine(x[S])).map(h.fromAffine)})}multiplyUnsafe(g){const y=h.ZERO;if(g===Ka)return y;if(o(g),g===_i)return this;const{endo:x}=e;if(!x)return p.unsafeLadder(this,g);let{k1neg:b,k1:S,k2neg:k,k2:T}=x.splitScalar(g),_=y,B=y,N=this;for(;S>Ka||T>Ka;)S&_i&&(_=_.add(N)),T&_i&&(B=B.add(N)),N=N.double(),S>>=_i,T>>=_i;return b&&(_=_.negate()),k&&(B=B.negate()),B=new h(r.mul(B.px,x.beta),B.py,B.pz),_.add(B)}multiply(g){o(g);let y=g,x,b;const{endo:S}=e;if(S){const{k1neg:k,k1:T,k2neg:_,k2:B}=S.splitScalar(y);let{p:N,f:P}=this.wNAF(T),{p:D,f:O}=this.wNAF(B);N=p.constTimeNegate(k,N),D=p.constTimeNegate(_,D),D=new h(r.mul(D.px,S.beta),D.py,D.pz),x=N.add(D),b=P.add(O)}else{const{p:k,f:T}=this.wNAF(y);x=k,b=T}return h.normalizeZ([x,b])[0]}multiplyAndAddUnsafe(g,y,x){const b=h.BASE,S=(T,_)=>_===Ka||_===_i||!T.equals(b)?T.multiplyUnsafe(_):T.multiply(_),k=S(this,y).add(S(g,x));return k.is0()?void 0:k}toAffine(g){const{px:y,py:x,pz:b}=this,S=this.is0();g==null&&(g=S?r.ONE:r.inv(b));const k=r.mul(y,g),T=r.mul(x,g),_=r.mul(b,g);if(S)return{x:r.ZERO,y:r.ZERO};if(!r.eql(_,r.ONE))throw new Error("invZ was invalid");return{x:k,y:T}}isTorsionFree(){const{h:g,isTorsionFree:y}=e;if(g===_i)return!0;if(y)return y(h,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:g,clearCofactor:y}=e;return g===_i?this:y?y(h,this):this.multiplyUnsafe(e.h)}toRawBytes(g=!0){return this.assertValidity(),n(h,this,g)}toHex(g=!0){return Lh(this.toRawBytes(g))}}h.BASE=new h(e.Gx,e.Gy,r.ONE),h.ZERO=new h(r.ZERO,r.ONE,r.ZERO);const f=e.nBitLength,p=Vre(h,e.endo?Math.ceil(f/2):f);return{CURVE:e,ProjectivePoint:h,normPrivateKeyToScalar:c,weierstrassEquation:s,isWithinCurveOrder:a}}function Zre(t){const e=rT(t);return qp(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Jre(t){const e=Zre(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function a(I){return KaLh(Uh(I,e.nByteLength));function d(I){const j=n>>_i;return I>j}function g(I){return d(I)?o(-I):I}const y=(I,j,H)=>Du(I.slice(j,H));class x{constructor(j,H,G){this.r=j,this.s=H,this.recovery=G,this.assertValidity()}static fromCompact(j){const H=e.nByteLength;return j=ss("compactSignature",j,H*2),new x(y(j,0,H),y(j,H,2*H))}static fromDER(j){const{r:H,s:G}=nu.toSig(ss("DER",j));return new x(H,G)}assertValidity(){if(!f(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!f(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(j){return new x(this.r,this.s,j)}recoverPublicKey(j){const{r:H,s:G,recovery:z}=this,R=B(ss("msgHash",j));if(z==null||![0,1,2,3].includes(z))throw new Error("recovery id invalid");const L=z===2||z===3?H+e.n:H;if(L>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const q=z&1?"03":"02",ee=u.fromHex(q+p(L)),X=c(L),oe=o(-R*X),me=o(G*X),le=u.BASE.multiplyAndAddUnsafe(ee,oe,me);if(!le)throw new Error("point at infinify");return le.assertValidity(),le}hasHighS(){return d(this.s)}normalizeS(){return this.hasHighS()?new x(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return jh(this.toDERHex())}toDERHex(){return nu.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return jh(this.toCompactHex())}toCompactHex(){return p(this.r)+p(this.s)}}const b={isValidPrivateKey(I){try{return l(I),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const I=tT(e.n);return Hre(e.randomBytes(I),e.n)},precompute(I=8,j=u.BASE){return j._setWindowSize(I),j.multiply(BigInt(3)),j}};function S(I,j=!0){return u.fromPrivateKey(I).toRawBytes(j)}function k(I){const j=I instanceof Uint8Array,H=typeof I=="string",G=(j||H)&&I.length;return j?G===i||G===s:H?G===2*i||G===2*s:I instanceof u}function T(I,j,H=!0){if(k(I))throw new Error("first arg must be private key");if(!k(j))throw new Error("second arg must be public key");return u.fromHex(j).multiply(l(I)).toRawBytes(H)}const _=e.bits2int||function(I){const j=Du(I),H=I.length*8-e.nBitLength;return H>0?j>>BigInt(H):j},B=e.bits2int_modN||function(I){return o(_(I))},N=G8(e.nBitLength);function P(I){if(typeof I!="bigint")throw new Error("bigint expected");if(!(Ka<=I&&Ive in H))throw new Error("sign() legacy options not supported");const{hash:G,randomBytes:z}=e;let{lowS:R,prehash:L,extraEntropy:q}=H;R==null&&(R=!0),I=ss("msgHash",I),L&&(I=ss("prehashed msgHash",G(I)));const ee=B(I),X=l(j),oe=[P(X),P(ee)];if(q!=null){const ve=q===!0?z(r.BYTES):q;oe.push(ss("extraEntropy",ve))}const me=Jd(...oe),le=ee;function fe(ve){const Ae=_(ve);if(!f(Ae))return;const Me=c(Ae),Be=u.BASE.multiply(Ae).toAffine(),Pe=o(Be.x);if(Pe===Ka)return;const V=o(Me*o(le+Pe*X));if(V===Ka)return;let ue=(Be.x===Pe?0:2)|Number(Be.y&_i),se=V;return R&&d(V)&&(se=g(V),ue^=1),new x(Pe,se,ue)}return{seed:me,k2sig:fe}}const O={lowS:e.lowS,prehash:!1},E={lowS:e.lowS,prehash:!1};function F(I,j,H=O){const{seed:G,k2sig:z}=D(I,j,H),R=e;return QF(R.hash.outputLen,R.nByteLength,R.hmac)(G,z)}u.BASE._setWindowSize(8);function A(I,j,H,G=E){var Be;const z=I;if(j=ss("msgHash",j),H=ss("publicKey",H),"strict"in G)throw new Error("options.strict was renamed to lowS");const{lowS:R,prehash:L}=G;let q,ee;try{if(typeof z=="string"||z instanceof Uint8Array)try{q=x.fromDER(z)}catch(Pe){if(!(Pe instanceof nu.Err))throw Pe;q=x.fromCompact(z)}else if(typeof z=="object"&&typeof z.r=="bigint"&&typeof z.s=="bigint"){const{r:Pe,s:V}=z;q=new x(Pe,V)}else throw new Error("PARSE");ee=u.fromHex(H)}catch(Pe){if(Pe.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(R&&q.hasHighS())return!1;L&&(j=e.hash(j));const{r:X,s:oe}=q,me=B(j),le=c(oe),fe=o(me*le),ve=o(X*le),Ae=(Be=u.BASE.multiplyAndAddUnsafe(ee,fe,ve))==null?void 0:Be.toAffine();return Ae?o(Ae.x)===X:!1}return{CURVE:e,getPublicKey:S,getSharedSecret:T,sign:F,verify:A,ProjectivePoint:u,Signature:x,utils:b}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Xre(t){return{hash:t,hmac:(e,...r)=>zF(t,e,Qte(...r)),randomBytes:Yte}}function Qre(t,e){const r=n=>Jre({...t,...Xre(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const nT=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),_S=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Yre=BigInt(1),Zw=BigInt(2),kS=(t,e)=>(t+e/Zw)/e;function ene(t){const e=nT,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),a=BigInt(23),o=BigInt(44),c=BigInt(88),u=t*t*t%e,l=u*u*t%e,h=vi(l,r,e)*l%e,f=vi(h,r,e)*l%e,p=vi(f,Zw,e)*u%e,d=vi(p,i,e)*p%e,g=vi(d,s,e)*d%e,y=vi(g,o,e)*g%e,x=vi(y,c,e)*y%e,b=vi(x,o,e)*g%e,S=vi(b,r,e)*l%e,k=vi(S,a,e)*d%e,T=vi(k,n,e)*u%e,_=vi(T,Zw,e);if(!Jw.eql(Jw.sqr(_),t))throw new Error("Cannot find square root");return _}const Jw=$re(nT,void 0,void 0,{sqrt:ene}),Lo=Qre({a:BigInt(0),b:BigInt(7),Fp:Jw,n:_S,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=_S,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Yre*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,a=BigInt("0x100000000000000000000000000000000"),o=kS(s*t,e),c=kS(-n*t,e);let u=In(t-o*r-c*i,e),l=In(-o*n-c*s,e);const h=u>a,f=l>a;if(h&&(u=e-u),f&&(l=e-l),u>a||l>a)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:h,k1:u,k2neg:f,k2:l}}}},are);BigInt(0);Lo.ProjectivePoint;const Xw="0x0000000000000000000000000000000000000000",BS="0x0000000000000000000000000000000000000000000000000000000000000000",IS=BigInt(0),FS=BigInt(1),TS=BigInt(2),PS=BigInt(27),NS=BigInt(28),P1=BigInt(35),Sl={};function OS(t){return Zu(oi(t),32)}var Ff,Tf,Pf,vu;const ns=class ns{constructor(e,r,n,i){ce(this,Ff,void 0);ce(this,Tf,void 0);ce(this,Pf,void 0);ce(this,vu,void 0);ty(e,Sl,"Signature"),Q(this,Ff,r),Q(this,Tf,n),Q(this,Pf,i),Q(this,vu,null)}get r(){return U(this,Ff)}set r(e){he(mf(e)===32,"invalid r","value",e),Q(this,Ff,qe(e))}get s(){return U(this,Tf)}set s(e){he(mf(e)===32,"invalid s","value",e);const r=qe(e);he(parseInt(r.substring(0,3))<8,"non-canonical s","value",r),Q(this,Tf,r)}get v(){return U(this,Pf)}set v(e){const r=at(e,"value");he(r===27||r===28,"invalid v","v",e),Q(this,Pf,r)}get networkV(){return U(this,vu)}get legacyChainId(){const e=this.networkV;return e==null?null:ns.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=Et(this.s);return this.yParity&&(e[0]|=128),qe(e)}get compactSerialized(){return _r([this.r,this.yParityAndS])}get serialized(){return _r([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new ns(Sl,this.r,this.s,this.v);return this.networkV&&Q(e,vu,this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(e){const r=Ke(e,"v");return r==PS||r==NS?IS:(he(r>=P1,"invalid EIP-155 v","v",e),(r-P1)/TS)}static getChainIdV(e,r){return Ke(e)*TS+BigInt(35+r-27)}static getNormalizedV(e){const r=Ke(e);return r===IS||r===PS?27:r===FS||r===NS?28:(he(r>=P1,"invalid v","v",e),r&FS?27:28)}static from(e){function r(u,l){he(u,l,"signature",e)}if(e==null)return new ns(Sl,BS,BS,27);if(typeof e=="string"){const u=Et(e,"signature");if(u.length===64){const l=qe(u.slice(0,32)),h=u.slice(32,64),f=h[0]&128?28:27;return h[0]&=127,new ns(Sl,l,qe(h),f)}if(u.length===65){const l=qe(u.slice(0,32)),h=u.slice(32,64);r((h[0]&128)===0,"non-canonical s");const f=ns.getNormalizedV(u[64]);return new ns(Sl,l,qe(h),f)}r(!1,"invalid raw signature length")}if(e instanceof ns)return e.clone();const n=e.r;r(n!=null,"missing r");const i=OS(n),s=function(u,l){if(u!=null)return OS(u);if(l!=null){r(Yt(l,32),"invalid yParityAndS");const h=Et(l);return h[0]&=127,qe(h)}r(!1,"missing s")}(e.s,e.yParityAndS);r((Et(s)[0]&128)==0,"non-canonical s");const{networkV:a,v:o}=function(u,l,h){if(u!=null){const f=Ke(u);return{networkV:f>=P1?f:void 0,v:ns.getNormalizedV(f)}}if(l!=null)return r(Yt(l,32),"invalid yParityAndS"),{v:Et(l)[0]&128?28:27};if(h!=null){switch(at(h,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}r(!1,"invalid yParity")}r(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),c=new ns(Sl,i,s,o);return a&&Q(c,vu,a),r(e.yParity==null||at(e.yParity,"sig.yParity")===c.yParity,"yParity mismatch"),r(e.yParityAndS==null||e.yParityAndS===c.yParityAndS,"yParityAndS mismatch"),c}};Ff=new WeakMap,Tf=new WeakMap,Pf=new WeakMap,vu=new WeakMap;let Fs=ns;var Da;const Xc=class Xc{constructor(e){ce(this,Da,void 0);he(mf(e)===32,"invalid private key","privateKey","[REDACTED]"),Q(this,Da,qe(e))}get privateKey(){return U(this,Da)}get publicKey(){return Xc.computePublicKey(U(this,Da))}get compressedPublicKey(){return Xc.computePublicKey(U(this,Da),!0)}sign(e){he(mf(e)===32,"invalid digest length","digest",e);const r=Lo.sign(Nn(e),Nn(U(this,Da)),{lowS:!0});return Fs.from({r:Tc(r.r,32),s:Tc(r.s,32),v:r.recovery?28:27})}computeSharedSecret(e){const r=Xc.computePublicKey(e);return qe(Lo.getSharedSecret(Nn(U(this,Da)),Et(r),!1))}static computePublicKey(e,r){let n=Et(e,"key");if(n.length===32){const s=Lo.getPublicKey(n,!!r);return qe(s)}if(n.length===64){const s=new Uint8Array(65);s[0]=4,s.set(n,1),n=s}const i=Lo.ProjectivePoint.fromHex(n);return qe(i.toRawBytes(r))}static recoverPublicKey(e,r){he(mf(e)===32,"invalid digest length","digest",e);const n=Fs.from(r);let i=Lo.Signature.fromCompact(Nn(_r([n.r,n.s])));i=i.addRecoveryBit(n.yParity);const s=i.recoverPublicKey(Nn(e));return he(s!=null,"invalid signautre for digest","signature",r),"0x"+s.toHex(!1)}static addPoints(e,r,n){const i=Lo.ProjectivePoint.fromHex(Xc.computePublicKey(e).substring(2)),s=Lo.ProjectivePoint.fromHex(Xc.computePublicKey(r).substring(2));return"0x"+i.add(s).toHex(!!n)}};Da=new WeakMap;let Xd=Xc;const tne=BigInt(0),rne=BigInt(36);function DS(t){t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=Et(Qt(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const Z8={};for(let t=0;t<10;t++)Z8[String(t)]=String(t);for(let t=0;t<26;t++)Z8[String.fromCharCode(65+t)]=String(10+t);const RS=15;function nne(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Z8[n]).join("");for(;e.length>=RS;){let n=e.substring(0,RS);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}const ine=function(){const t={};for(let e=0;e<36;e++){const r="0123456789abcdefghijklmnopqrstuvwxyz"[e];t[r]=BigInt(e)}return t}();function sne(t){t=t.toLowerCase();let e=tne;for(let r=0;re.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return U(this,yu)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return U(this,yu)===!0?-1:U(this,yu)===!1?this.value.length:null}static from(e,r){return new ka(_a,e,r)}static uint8(e){return He(e,8)}static uint16(e){return He(e,16)}static uint24(e){return He(e,24)}static uint32(e){return He(e,32)}static uint40(e){return He(e,40)}static uint48(e){return He(e,48)}static uint56(e){return He(e,56)}static uint64(e){return He(e,64)}static uint72(e){return He(e,72)}static uint80(e){return He(e,80)}static uint88(e){return He(e,88)}static uint96(e){return He(e,96)}static uint104(e){return He(e,104)}static uint112(e){return He(e,112)}static uint120(e){return He(e,120)}static uint128(e){return He(e,128)}static uint136(e){return He(e,136)}static uint144(e){return He(e,144)}static uint152(e){return He(e,152)}static uint160(e){return He(e,160)}static uint168(e){return He(e,168)}static uint176(e){return He(e,176)}static uint184(e){return He(e,184)}static uint192(e){return He(e,192)}static uint200(e){return He(e,200)}static uint208(e){return He(e,208)}static uint216(e){return He(e,216)}static uint224(e){return He(e,224)}static uint232(e){return He(e,232)}static uint240(e){return He(e,240)}static uint248(e){return He(e,248)}static uint256(e){return He(e,256)}static uint(e){return He(e,256)}static int8(e){return He(e,-8)}static int16(e){return He(e,-16)}static int24(e){return He(e,-24)}static int32(e){return He(e,-32)}static int40(e){return He(e,-40)}static int48(e){return He(e,-48)}static int56(e){return He(e,-56)}static int64(e){return He(e,-64)}static int72(e){return He(e,-72)}static int80(e){return He(e,-80)}static int88(e){return He(e,-88)}static int96(e){return He(e,-96)}static int104(e){return He(e,-104)}static int112(e){return He(e,-112)}static int120(e){return He(e,-120)}static int128(e){return He(e,-128)}static int136(e){return He(e,-136)}static int144(e){return He(e,-144)}static int152(e){return He(e,-152)}static int160(e){return He(e,-160)}static int168(e){return He(e,-168)}static int176(e){return He(e,-176)}static int184(e){return He(e,-184)}static int192(e){return He(e,-192)}static int200(e){return He(e,-200)}static int208(e){return He(e,-208)}static int216(e){return He(e,-216)}static int224(e){return He(e,-224)}static int232(e){return He(e,-232)}static int240(e){return He(e,-240)}static int248(e){return He(e,-248)}static int256(e){return He(e,-256)}static int(e){return He(e,-256)}static bytes1(e){return vt(e,1)}static bytes2(e){return vt(e,2)}static bytes3(e){return vt(e,3)}static bytes4(e){return vt(e,4)}static bytes5(e){return vt(e,5)}static bytes6(e){return vt(e,6)}static bytes7(e){return vt(e,7)}static bytes8(e){return vt(e,8)}static bytes9(e){return vt(e,9)}static bytes10(e){return vt(e,10)}static bytes11(e){return vt(e,11)}static bytes12(e){return vt(e,12)}static bytes13(e){return vt(e,13)}static bytes14(e){return vt(e,14)}static bytes15(e){return vt(e,15)}static bytes16(e){return vt(e,16)}static bytes17(e){return vt(e,17)}static bytes18(e){return vt(e,18)}static bytes19(e){return vt(e,19)}static bytes20(e){return vt(e,20)}static bytes21(e){return vt(e,21)}static bytes22(e){return vt(e,22)}static bytes23(e){return vt(e,23)}static bytes24(e){return vt(e,24)}static bytes25(e){return vt(e,25)}static bytes26(e){return vt(e,26)}static bytes27(e){return vt(e,27)}static bytes28(e){return vt(e,28)}static bytes29(e){return vt(e,29)}static bytes30(e){return vt(e,30)}static bytes31(e){return vt(e,31)}static bytes32(e){return vt(e,32)}static address(e){return new ka(_a,"address",e)}static bool(e){return new ka(_a,"bool",!!e)}static bytes(e){return new ka(_a,"bytes",e)}static string(e){return new ka(_a,"string",e)}static array(e,r){throw new Error("not implemented yet")}static tuple(e,r){throw new Error("not implemented yet")}static overrides(e){return new ka(_a,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===MS}static dereference(e,r){if(ka.isTyped(e)){if(e.type!==r)throw new Error(`invalid type: expecetd ${r}, got ${e.type}`);return e.value}return e}};yu=new WeakMap;let un=ka;class one extends Ao{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){let n=un.dereference(r,"string");try{n=xt(n)}catch(i){return this._throwError(i.message,r)}return e.writeValue(n)}decode(e){return xt(Tc(e.readValue(),20))}}class cne extends Ao{constructor(r){super(r.name,r.type,"_",r.dynamic);ae(this,"coder");this.coder=r}defaultValue(){return this.coder.defaultValue()}encode(r,n){return this.coder.encode(r,n)}decode(r){return this.coder.decode(r)}}function sT(t,e,r){let n=[];if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let c={};n=e.map(u=>{const l=u.localName;return Te(l,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:r}),Te(!c[l],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:r}),c[l]=!0,r[l]})}else he(!1,"invalid tuple value","tuple",r);he(e.length===n.length,"types/value length mismatch","tuple",r);let i=new qw,s=new qw,a=[];e.forEach((c,u)=>{let l=n[u];if(c.dynamic){let h=s.length;c.encode(s,l);let f=i.writeUpdatableValue();a.push(p=>{f(p+h)})}else c.encode(i,l)}),a.forEach(c=>{c(i.length)});let o=t.appendWriter(i);return o+=t.appendWriter(s),o}function aT(t,e){let r=[],n=[],i=t.subReader(0);return e.forEach(s=>{let a=null;if(s.dynamic){let o=t.readIndex(),c=i.subReader(o);try{a=s.decode(c)}catch(u){if(Li(u,"BUFFER_OVERRUN"))throw u;a=u,a.baseType=s.name,a.name=s.localName,a.type=s.type}}else try{a=s.decode(t)}catch(o){if(Li(o,"BUFFER_OVERRUN"))throw o;a=o,a.baseType=s.name,a.name=s.localName,a.type=s.type}if(a==null)throw new Error("investigate");r.push(a),n.push(s.localName||null)}),Im.fromItems(r,n)}class une extends Ao{constructor(r,n,i){const s=r.type+"["+(n>=0?n:"")+"]",a=n===-1||r.dynamic;super("array",s,i,a);ae(this,"coder");ae(this,"length");Je(this,{coder:r,length:n})}defaultValue(){const r=this.coder.defaultValue(),n=[];for(let i=0;ia||i<-(a+mne))&&this._throwError("value out-of-bounds",n),i=IF(i,8*bn)}else(ij0(s,this.size*8))&&this._throwError("value out-of-bounds",n);return r.writeValue(i)}decode(r){let n=j0(r.readValue(),this.size*8);return this.signed&&(n=Bte(n,this.size*8)),n}}class xne extends oT{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,no(un.dereference(r,"string")))}decode(e){return U8(super.decode(e))}}class N1 extends Ao{constructor(r,n){let i=!1;const s=[];r.forEach(o=>{o.dynamic&&(i=!0),s.push(o.type)});const a="tuple("+s.join(",")+")";super("tuple",a,n,i);ae(this,"coders");Je(this,{coders:Object.freeze(r.slice())})}defaultValue(){const r=[];this.coders.forEach(i=>{r.push(i.defaultValue())});const n=this.coders.reduce((i,s)=>{const a=s.localName;return a&&(i[a]||(i[a]=0),i[a]++),i},{});return this.coders.forEach((i,s)=>{let a=i.localName;!a||n[a]!==1||(a==="length"&&(a="_length"),r[a]==null&&(r[a]=r[s]))}),Object.freeze(r)}encode(r,n){const i=un.dereference(n,"tuple");return sT(r,this.coders,i)}decode(r){return aT(r,this.coders)}}function Ju(t){return Qt(no(t))}var bne="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3EfAbfNAz81KUsFWwF3YQZtAm0A+VEfAzEJDQBRSQCzAQBlAHsAM70GD/v3IZWHBwARKQAxALsjTwHZAeMPEzmXgIHwABIAGQA8AEUAQDt3gdvIEGcQZAkGTRFMdEIVEwK0D64L7REdDNkq09PgADSxB/MDWwfzA1sDWwfzB/MDWwfzA1sDWwNbA1scEvAi28gQZw9QBHUFlgWTBN4IiyZREYkHMAjaVBV0JhxPA00BBCMtSSQ7mzMTJUpMFE0LCAQ2SmyvfUADTzGzVP2QqgPTMlc5dAkGHnkSqAAyD3skNb1OhnpPcagKU0+2tYdJak5vAsY6sEAACikJm2/Dd1YGRRAfJ6kQ+ww3AbkBPw3xS9wE9QY/BM0fgRkdD9GVoAipLeEM8SbnLqWAXiP5KocF8Uv4POELUVFsD10LaQnnOmeBUgMlAREijwrhDT0IcRD3Cs1vDekRSQc9A9lJngCpBwULFR05FbkmFGKwCw05ewb/GvoLkyazEy17AAXXGiUGUQEtGwMA0y7rhbRaNVwgT2MGBwspI8sUrFAkDSlAu3hMGh8HGSWtApVDdEqLUToelyH6PEENai4XUYAH+TwJGVMLhTyiRq9FEhHWPpE9TCJNTDAEOYMsMyePCdMPiQy9fHYBXQklCbUMdRM1ERs3yQg9Bx0xlygnGQglRplgngT7owP3E9UDDwVDCUUHFwO5HDETMhUtBRGBKNsC9zbZLrcCk1aEARsFzw8pH+MQVEfkDu0InwJpA4cl7wAxFSUAGyKfCEdnAGOP3FMJLs8Iy2pwI3gDaxTrZRF3B5UOWwerHDcVwxzlcMxeD4YMKKezCV8BeQmdAWME5wgNNV+MpCBFZ1eLXBifIGVBQ14AAjUMaRWjRMGHfAKPD28SHwE5AXcHPQ0FAnsR8RFvEJkI74YINbkz/DopBFMhhyAVCisDU2zSCysm/Qz8bQGnEmYDEDRBd/Jnr2C6KBgBBx0yyUFkIfULlk/RDKAaxRhGVDIZ6AfDA/ca9yfuQVsGAwOnBxc6UTPyBMELbQiPCUMATQ6nGwfbGG4KdYzUATWPAbudA1uVhwJzkwY7Bw8Aaw+LBX3pACECqwinAAkA0wNbAD0CsQehAB0AiUUBQQMrMwEl6QKTA5cINc8BmTMB9y0EH8cMGQD7O25OAsO1AoBuZqYF4VwCkgJNOQFRKQQJUktVA7N15QDfAE8GF+NLARmvTs8e50cB43MvAMsA/wAJOQcJRQHRAfdxALsBYws1Caa3uQFR7S0AhwAZbwHbAo0A4QA5AIP1AVcAUQVd/QXXAlNNARU1HC9bZQG/AyMBNwERAH0Gz5GpzQsjBHEH1wIQHxXlAu8yB7kFAyLjE9FCyQK94lkAMhoKPAqrCqpgX2Q3CjV2PVQAEh+sPss/UgVVO1c7XDtXO1w7VztcO1c7XDtXO1wDm8Pmw+YKcF9JYe8Mqg3YRMw6TRPfYFVgNhPMLbsUxRXSJVoZQRrAJwkl6FUNDwgt12Y0CDA0eRfAAEMpbINFY4oeNApPHOtTlVT8LR8AtUumM7MNsBsZREQFS3XxYi4WEgomAmSFAmJGX1GzAV83JAKh+wJonAJmDQKfiDgfDwJmPwJmKgRyBIMDfxcDfpY5Cjl7GzmGOicnAmwhAjI6OA4CbcsCbbLzjgM3a0kvAWsA4gDlAE4JB5wMkQECD8YAEbkCdzMCdqZDAnlPRwJ4viFg30WyRvcCfEMCeswCfQ0CfPRIBEiBZygALxlJXEpfGRtK0ALRBQLQ0EsrA4hTA4fqRMmRNgLypV0HAwOyS9JMMSkH001QTbMCi0MCitzFHwshR2sJuwKOOwKOYESbhQKO3QKOYHxRuFM5AQ5S2FSJApP/ApMQAO0AIFUiVbNV1AosHymZijLleGpFPz0Cl6MC77ZYJawAXSkClpMCloCgAK1ZsFoNhVEAPwKWuQKWUlxIXNUCmc8CmWhczl0LHQKcnznGOqECnBoCn58CnryOACETNS4TAp31Ap6WALlBYThh8wKe1wKgcgGtAp6jIwKeUqljzGQrKS8CJ7MCJoICoP8CoFDbAqYzAqXSAqgDAIECp/ZogGi1AAdNaiBq1QKs5wKssgKtawKtBgJXIQJV4AKx5dsDH1JsmwKywRECsuwbbORtZ21MYwMl0QK2YD9DbpQDKUkCuGICuUsZArkue3A6cOUCvR0DLbYDMhUCvoxyBgMzdQK+HnMmc1MCw88CwwhzhnRPOUl05AM8qwEDPJ4DPcMCxYACxksCxhSNAshtVQLISALJUwLJMgJkoQLd1nh9ZXiyeSlL1AMYp2cGAmH4GfeVKHsPXpZevxUCz28Cz3AzT1fW9xejAMqxAs93AS3uA04Wfk8JAtwrAtuOAtJTA1JgA1NjAQUDVZCAjUMEzxrxZEl5A4LSg5EC2ssC2eKEFIRNp0ADhqkAMwNkEoZ1Xf0AWQLfaQLevHd7AuIz7RgB8zQrAfSfAfLWiwLr9wLpdH0DAur9AuroAP1LAb0C7o0C66CWrpcHAu5DA4XkmH1w5HGlAvMHAG0DjhqZlwL3FwORcgOSiwL3nAL53QL4apogmq+/O5siA52HAv7+AR8APZ8gAZ+3AwWRA6ZuA6bdANXJAwZuoYyiCQ0DDE0BEwEjB3EGZb1rCQC/BG/DFY8etxEAG3k9ACcDNxJRA42DAWcrJQCM8wAlAOanC6OVCLsGI6fJBgCvBRnDBvElRUYFFoAFcD9GSDNCKUK8X3kZX8QAls0FOgCQVCGbwTsuYDoZutcONxjOGJHJ/gVfBWAFXwVgBWsFYAVfBWAFXwVgBV8FYAVfBWBOHQjfjW8KCgoKbF7xMwTRA7kGN8PDAMMEr8MA70gxFroFTj5xPnhCR0K+X30/X/AAWBkzswCNBsxzzASm70aCRS4rDDMeLz49fnXfcsH5GcoscQFz13Y4HwVnBXLJycnACNdRYwgICAqEXoWTxgA7P4kACxbZBu21Kw0AjMsTAwkVAOVtJUUsJ1JCuULESUArXy9gPi9AKwnJRQYKTD9LPoA+iT54PnkCkULEUUpDX9NWV3JVEjQAc1w3A3IBE3YnX+g7QiMJb6MKaiszRCUuQrNCxDPMCcwEX9EWJzYREBEEBwIHKn6l33JCNVIfybPJtAltydPUCmhBZw/tEKsZAJOVJU1CLRuxbUHOQAo7P0s+eEJHHA8SJVRPdGM0NVrpvBoKhfUlM0JHHGUQUhEWO1xLSj8MO0ucNAqJIzVCRxv9EFsqKyA4OQgNj2nwZgp5ZNFgE2A1K3YHS2AhQQojJmC7DgpzGG1WYFUZCQYHZO9gHWCdYIVgu2BTYJlwFh8GvRbcXbG8YgtDHrMBwzPVyQonHQgkCyYBgQJ0Ajc4nVqIAwGSCsBPIgDsK3SWEtIVBa5N8gGjAo+kVwVIZwD/AEUSCDweX4ITrRQsJ8K3TwBXFDwEAB0TvzVcAtoTS20RIwDgVgZ9BBImYgA5AL4Coi8LFnezOkCnIQFjAY4KBAPh9RcGsgZSBsEAJctdsWIRu2kTkQstRw7DAcMBKgpPBGIGMDAwKCYnKTQaLg4AKRSVAFwCdl+YUZ0JdicFD3lPAdt1F9ZZKCGxuE3yBxkFVGcA/wBFEgiCBwAOLHQSjxOtQDg1z7deFRMAZ8QTAGtKb1ApIiPHADkAvgKiLy1DFtYCmBiDAlDDWNB0eo7fpaMO/aEVRRv0ATEQZBIODyMEAc8JQhCbDRgzFD4TAEMAu9YBCgCsAOkAm5I3ABwAYxvONnR+MhXJAxgKQyxL2+kkJhMbhQKDBMkSsvF0AD9BNQ6uQC7WqSQHwxEAEEIu1hkhAH2z4iQPwyJPHNWpdyYBRSpnJALzoBAEVPPsH20MxA0CCEQKRgAFyAtFAlMNwwjEDUQJRArELtapMg7DDZgJIw+TGukEIwvDFkMAqAtDEMMMBhioe+QAO3MMRAACrgnEBSPY9Q0FDnbSBoMAB8MSYxkSxAEJAPIJAAB8FWMOFtMc/HcXwxhDAC7DAvOowwAewwJdKDKHAAHDAALrFUQVwwAbwyvzpWMWv8wA/ABpAy++bcYDUKPD0KhDCwKmJ1MAAmMA5+UZwxAagwipBRL/eADfw6fDGOMCGsOjk3l6BwOpo4sAEsMOGxMAA5sAbcMOAAvDp0MJGkMDwgipnNIPAwfIqUMGAOGDAAPzABXDAAcDAAnDAGmTABrDAA7DChjDjnEWAwABYwAOcwAuUyYABsMAF8MIKQANUgC6wy4AA8MADqMq8wCyYgAcIwAB8wqpAAXOCx0V4wAHowBCwwEKAGnDAAuDAB3DAAjDCakABdIAbqcZ3QCZCCkABdIAAAFDAAfjAB2jCCkABqIACYMAGzMAbSMA5sOIAAhjAAhDABTDBAkpAAbSAOOTAAlDC6kOzPtnAAdDAG6kQFAATwAKwwwAA0MACbUDPwAHIwAZgwACE6cDAAojAApDAAoDp/MGwwAJIwADEwAQQwgAFEMAEXMAD5MADfMADcMAGRMOFiMAFUMAbqMWuwHDAMIAE0MLAGkzEgDhUwACQwAEWgAXgwUjAAbYABjDBSYBgzBaAEFNALcQBxUMegAwMngBrA0IZgJ0KxQHBREPd1N0ZzKRJwaIHAZqNT4DqQq8BwngAB4DAwt2AX56T1ocKQNXAh1GATQGC3tOxYNagkgAMQA5CQADAQEAWxLjAIOYNAEzAH7tFRk6TglSAF8NAAlYAQ+S1ACAQwQorQBiAN4dAJ1wPyeTANVzuQDX3AIeEMp9eyMgXiUAEdkBkJizKltbVVAaRMqRAAEAhyQ/SDEz6BmfVwB6ATEsOClKIRcDOF0E/832AFNt5AByAnkCRxGCOs94NjXdAwINGBonDBwPALW2AwICAgAAAAAAAAYDBQMDARrUAwAtAAAAAgEGBgYGBgYFBQUFBQUEBQYHCAkEBQUFBQQAAAICAAAAIgCNAJAAlT0A6gC7ANwApEQAwgCyAK0AqADuAKYA2gCjAOcBCAEDAMcAgQBiANIA1AEDAN4A8gCQAKkBMQDqAN8A3AsBCQ8yO9ra2tq8xuLT1tRJOB0BUgFcNU0BWgFpAWgBWwFMUUlLbhMBUxsNEAs6PhMOACcUKy0vMj5AQENDQ0RFFEYGJFdXV1dZWVhZL1pbXVxcI2NnZ2ZoZypsbnZ1eHh4eHh4enp6enp6enp6enp8fH18e2IARPIASQCaAHgAMgBm+ACOAFcAVwA3AnbvAIsABfj4AGQAk/IAnwBPAGIAZP//sACFAIUAaQBWALEAJAC2AIMCQAJDAPwA5wD+AP4A6AD/AOkA6QDoAOYALwJ7AVEBQAE+AVQBPgE+AT4BOQE4ATgBOAEcAVgXADEQCAEAUx8SHgsdHhYAjgCWAKYAUQBqIAIxAHYAbwCXAxUDJzIDIUlGTzEAkQJPAMcCVwKkAMAClgKWApYClgKWApYCiwKWApYClgKWApYClgKVApUCmAKgApcClgKWApQClAKUApQCkgKVAnUB1AKXAp8ClgKWApUeAIETBQD+DQOfAmECOh8BVBg9AuIZEjMbAU4/G1WZAXusRAFpYQEFA0FPAQYAmTEeIJdyADFoAHEANgCRA5zMk/C2jGINwjMWygIZCaXdfDILBCs5dAE7YnQBugDlhoiHhoiGiYqKhouOjIaNkI6Ij4qQipGGkoaThpSSlYaWhpeKmIaZhpqGm4aci52QnoqfhuIC4XTpAt90AIp0LHSoAIsAdHQEQwRABEIERQRDBEkERgRBBEcESQRIBEQERgRJAJ5udACrA490ALxuAQ10ANFZdHQA13QCFHQA/mJ0AP4BIQD+APwA/AD9APwDhGZ03ASMK23HAP4A/AD8AP0A/CR0dACRYnQA/gCRASEA/gCRAvQA/gCRA4RmdNwEjCttxyR0AP9idAEhAP4A/gD8APwA/QD8AP8A/AD8AP0A/AOEZnTcBIwrbcckdHQAkWJ0ASEA/gCRAP4AkQL0AP4AkQOEZnTcBIwrbcckdAJLAT50AlIBQXQCU8l0dAJfdHQDpgL0A6YDpgOnA6cDpwOnA4RmdNwEjCttxyR0dACRYnQBIQOmAJEDpgCRAvQDpgCRA4RmdNwEjCttxyR0BDh0AJEEOQCRDpU5dSgCADR03gV2CwArdAEFAM5iCnR0AF1iAAYcOgp0dACRCnQAXAEIwWZ0CnRmdHQAkWZ0CnRmdEXgAFF03gp0dEY0tlT2u3SOAQTwscwhjZZKrhYcBSfFp9XNbKiVDOD2b+cpe4/Z17mQnbtzzhaeQtE2GGj0IDNTjRUSyTxxw/RPHW/+vS7d1NfRt9z9QPZg4X7QFfhCnkvgNPIItOsC2eV6hPannZNHlZ9xrwZXIMOlu3jSoQSq78WEjwLjw1ELSlF1aBvfzwk5ZX7AUvQzjPQKbDuQ+sm4wNOp4A6AdVuRS0t1y/DZpg4R6m7FNjM9HgvW7Bi88zaMjOo6lM8wtBBdj8LP4ylv3zCXPhebMKJc066o9sF71oFW/8JXu86HJbwDID5lzw5GWLR/LhT0Qqnp2JQxNZNfcbLIzPy+YypqRm/lBmGmex+82+PisxUumSeJkALIT6rJezxMH+CTJmQtt5uwTVbL3ptmjDUQzlSIvWi8Tl7ng1NpuRn1Ng4n14Qc+3Iil7OwkvNWogLSPkn3pihIFytyIGmMhOe3n1tWsuMy9BdKyqF4Z3v2SgggTL9KVvMXPnCbRe+oOuFFP3HejBG/w9gvmfNYvg6JuWia2lcSSN1uIjBktzoIazOHPJZ7kKHPz8mRWVdW3lA8WGF9dQF6Bm673boov3BUWDU2JNcahR23GtfHKLOz/viZ+rYnZFaIznXO67CYEJ1fXuTRpZhYZkKe54xeoagkNGLs+NTZHE0rX45/XvQ2RGADX6vcAvdxIUBV27wxGm2zjZo4X3ILgAlrOFheuZ6wtsvaIj4yLY7qqawlliaIcrz2G+c3vscAnCkCuMzMmZvMfu9lLwTvfX+3cVSyPdN9ZwgDZhfjRgNJcLiJ67b9xx8JHswprbiE3v9UphotAPIgnXVIN5KmMc0piXhc6cChPnN+MRhG9adtdttQTTwSIpl8I4/j//d3sz1326qTBTpPRM/Hgh3kzqEXs8ZAk4ErQhNO8hzrQ0DLkWMA/N+91tn2MdOJnWC2FCZehkQrwzwbKOjhvZsbM95QoeL9skYyMf4srVPVJSgg7pOLUtr/n9eT99oe9nLtFRpjA9okV2Kj8h9k5HaC0oivRD8VyXkJ81tcd4fHNXPCfloIQasxsuO18/46dR2jgul/UIet2G0kRvnyONMKhHs6J26FEoqSqd+rfYjeEGwHWVDpX1fh1jBBcKGMqRepju9Y00mDVHC+Xdij/j44rKfvfjGinNs1jO/0F3jB83XCDINN/HB84axlP+3E/klktRo+vl3U/aiyMJbIodE1XSsDn6UAzIoMtUObY2+k/4gY/l+AkZJ5Sj2vQrkyLm3FoxjhDX+31UXBFf9XrAH31fFqoBmDEZvhvvpnZ87N+oZEu7U9O/nnk+QWj3x8uyoRbEnf+O5UMr9i0nHP38IF5AvzrBW8YWBUR0mIAzIvndQq9N3v/Jto3aPjPXUPl8ASdPPyAp7jENf8bk7VMM9ol9XGmlBmeDMuGqt+WzuL6CXAxXjIhCPM5vACchgMJ/8XBGLO/D1isVvGhwwHHr1DLaI5mn2Jr/b1pUD90uciDaS8cXNDzCWvNmT/PhQe5e8nTnnnkt8Ds/SIjibcum/fqDhKopxAY8AkSrPn+IGDEKOO+U3XOP6djFs2H5N9+orhOahiQk5KnEUWa+CzkVzhp8bMHRbg81qhjjXuIKbHjSLSIBKWqockGtKinY+z4/RdBUF6pcc3JmnlxVcNgrI4SEzKUZSwcD2QCyxzKve+gAmg6ZuSRkpPFa6mfThu7LJNu3H5K42uCpNvPAsoedolKV/LHe/eJ+BbaG5MG0NaSGVPRUmNFMFFSSpXEcXwbVh7UETOZZtoVNRGOIbbkig3McEtR68cG0RZAoJevWYo7Dg/lZ1CQzblWeUvVHmr8fY4Nqd9JJiH/zEX24mJviH60fAyFr0A3c4bC1j3yZU60VgJxXn8JgJXLUIsiBnmKmMYz+7yBQFBvqb2eYnuW59joZBf56/wXvWIR4R8wTmV80i1mZy+S4+BUES+hzjk0uXpC///z/IlqHZ1monzlXp8aCfhGKMti73FI1KbL1q6IKO4fuBuZ59gagjn5xU79muMpHXg6S+e+gDM/U9BKLHbl9l6o8czQKl4RUkJJiqftQG2i3BMg/TQlUYFkJDYBOOvAugYuzYSDnZbDDd/aSd9x0Oe6F+bJcHfl9+gp6L5/TgA+BdFFovbfCrQ40s5vMPw8866pNX8zyFGeFWdxIpPVp9Rg1UPOVFbFZrvaFq/YAzHQgqMWpahMYfqHpmwXfHL1/kpYmGuHFwT55mQu0dylfNuq2Oq0hTMCPwqfxnuBIPLXfci4Y1ANy+1CUipQxld/izVh16WyG2Q0CQQ9NqtAnx1HCHwDj7sYxOSB0wopZSnOzxQOcExmxrVTF2BkOthVpGfuhaGECfCJpJKpjnihY+xOT2QJxN61+9K6QSqtv2Shr82I3jgJrqBg0wELFZPjvHpvzTtaJnLK6Vb97Yn933koO/saN7fsjwNKzp4l2lJVx2orjCGzC/4ZL4zCver6aQYtC5sdoychuFE6ufOiog+VWi5UDkbmvmtah/3aArEBIi39s5ILUnlFLgilcGuz9CQshEY7fw2ouoILAYPVT/gyAIq3TFAIwVsl+ktkRz/qGfnCDGrm5gsl/l9QdvCWGsjPz3dU7XuqKfdUrr/6XIgjp4rey6AJBmCmUJMjITHVdFb5m1p+dLMCL8t55zD42cmftmLEJC0Da04YiRCVUBLLa8D071/N5UBNBXDh0LFsmhV/5B5ExOB4j3WVG/S3lfK5o+V6ELHvy6RR9n4ac+VsK4VE4yphPvV+kG9FegTBH4ZRXL2HytUHCduJazB/KykjfetYxOXTLws267aGOd+I+JhKP//+VnXmS90OD/jvLcVu0asyqcuYN1mSb6XTlCkqv1vigZPIYwNF/zpWcT1GR/6aEIRjkh0yhg4LXJfaGobYJTY4JI58KiAKgmmgAKWdl5nYCeLqavRJGQNuYuZtZFGx+IkI4w4NS2xwbetNMunOjBu/hmKCI/w7tfiiyUd//4rbTeWt4izBY8YvGIN6vyKYmP/8X8wHKCeN+WRcKM70+tXKNGyevU9H2Dg5BsljnTf8YbsJ1TmMs74Ce2XlHisleguhyeg44rQOHZuw/6HTkhnnurK2d62q6yS7210SsAIaR+jXMQA+svkrLpsUY+F30Uw89uOdGAR6vo4FIME0EfVVeHTu6eKicfhSqOeXJhbftcd08sWEnNUL1C9fnprTgd83IMut8onVUF0hvqzZfHduPjbjwEXIcoYmy+P6tcJZHmeOv6VrvEdkHDJecjHuHeWANe79VG662qTjA/HCvumVv3qL+LrOcpqGps2ZGwQdFJ7PU4iuyRlBrwfO+xnPyr47s2cXVbWzAyznDiBGjCM3ksxjjqM62GE9C8f5U38kB3VjtabKp/nRdvMESPGDG90bWRLAt1Qk5DyLuazRR1YzdC1c+hZXvAWV8xA72S4A8B67vjVhbba3MMop293FeEXpe7zItMWrJG/LOH9ByOXmYnNJfjmfuX9KbrpgLOba4nZ+fl8Gbdv/ihv+6wFGKHCYrVwmhFC0J3V2bn2tIB1wCc1CST3d3X2OyxhguXcs4sm679UngzofuSeBewMFJboIQHbUh/m2JhW2hG9DIvG2t7yZIzKBTz9wBtnNC+2pCRYhSIuQ1j8xsz5VvqnyUIthvuoyyu7fNIrg/KQUVmGQaqkqZk/Vx5b33/gsEs8yX7SC1J+NV4icz6bvIE7C5G6McBaI8rVg56q5QBJWxn/87Q1sPK4+sQa8fLU5gXo4paaq4cOcQ4wR0VBHPGjKh+UlPCbA1nLXyEUX45qZ8J7/Ln4FPJE2TdzD0Z8MLSNQiykMMmSyOCiFfy84Rq60emYB2vD09KjYwsoIpeDcBDTElBbXxND72yhd9pC/1CMid/5HUMvAL27OtcIJDzNKpRPNqPOpyt2aPGz9QWIs9hQ9LiX5s8m9hjTUu/f7MyIatjjd+tSfQ3ufZxPpmJhTaBtZtKLUcfOCUqADuO+QoH8B9v6U+P0HV1GLQmtoNFTb3s74ivZgjES0qfK+8RdGgBbcCMSy8eBvh98+et1KIFqSe1KQPyXULBMTsIYnysIwiZBJYdI20vseV+wuJkcqGemehKjaAb9L57xZm3g2zX0bZ2xk/fU+bCo7TlnbW7JuF1YdURo/2Gw7VclDG1W7LOtas2LX4upifZ/23rzpsnY/ALfRgrcWP5hYmV9VxVOQA1fZvp9F2UNU+7d7xRyVm5wiLp3/0dlV7vdw1PMiZrbDAYzIVqEjRY2YU03sJhPnlwIPcZUG5ltL6S8XCxU1eYS5cjr34veBmXAvy7yN4ZjArIG0dfD/5UpBNlX1ZPoxJOwyqRi3wQWtOzd4oNKh0LkoTm8cwqgIfKhqqGOhwo71I+zXnMemTv2B2AUzABWyFztGgGULjDDzWYwJUVBTjKCn5K2QGMK1CQT7SzziOjo+BhAmqBjzuc3xYym2eedGeOIRJVyTwDw37iCMe4g5Vbnsb5ZBdxOAnMT7HU4DHpxWGuQ7GeiY30Cpbvzss55+5Km1YsbD5ea3NI9QNYIXol5apgSu9dZ8f8xS5dtHpido5BclDuLWY4lhik0tbJa07yJhH0BOyEut/GRbYTS6RfiTYWGMCkNpfSHi7HvdiTglEVHKZXaVhezH4kkXiIvKopYAlPusftpE4a5IZwvw1x/eLvoDIh/zpo9FiQInsTb2SAkKHV42XYBjpJDg4374XiVb3ws4qM0s9eSQ5HzsMU4OZJKuopFjBM+dAZEl8RUMx5uU2N486Kr141tVsGQfGjORYMCJAMsxELeNT4RmWjRcpdTGBwcx6XN9drWqPmJzcrGrH4+DRc7+n1w3kPZwu0BkNr6hQrqgo7JTB9A5kdJ/H7P4cWBMwsmuixAzJB3yrQpnGIq90lxAXLzDCdn1LPibsRt7rHNjgQBklRgPZ8vTbjXdgXrTWQsK5MdrXXQVPp0Rinq3frzZKJ0qD6Qhc40VzAraUXlob1gvkhK3vpmHgI6FRlQZNx6eRqkp0zy4AQlX813fAPtL3jMRaitGFFjo0zmErloC+h+YYdVQ6k4F/epxAoF0BmqEoKNTt6j4vQZNQ2BoqF9Vj53TOIoNmDiu9Xp15RkIgQIGcoLpfoIbenzpGUAtqFJp5W+LLnx38jHeECTJ/navKY1NWfN0sY1T8/pB8kIH3DU3DX+u6W3YwpypBMYOhbSxGjq84RZ84fWJow8pyHqn4S/9J15EcCMsXqrfwyd9mhiu3+rEo9pPpoJkdZqHjra4NvzFwuThNKy6hao/SlLw3ZADUcUp3w3SRVfW2rhl80zOgTYnKE0Hs2qp1J6H3xqPqIkvUDRMFDYyRbsFI3M9MEyovPk8rlw7/0a81cDVLmBsR2ze2pBuKb23fbeZC0uXoIvDppfTwIDxk1Oq2dGesGc+oJXWJLGkOha3CX+DUnzgAp9HGH9RsPZN63Hn4RMA5eSVhPHO+9RcRb/IOgtW31V1Q5IPGtoxPjC+MEJbVlIMYADd9aHYWUIQKopuPOHmoqSkubnAKnzgKHqgIOfW5RdAgotN6BN+O2ZYHkuemLnvQ8U9THVrS1RtLmKbcC7PeeDsYznvqzeg6VCNwmr0Yyx1wnLjyT84BZz3EJyCptD3yeueAyDWIs0L2qs/VQ3HUyqfrja0V1LdDzqAikeWuV4sc7RLIB69jEIBjCkyZedoUHqCrOvShVzyd73OdrJW0hPOuQv2qOoHDc9xVb6Yu6uq3Xqp2ZaH46A7lzevbxQEmfrzvAYSJuZ4WDk1Hz3QX1LVdiUK0EvlAGAYlG3Md30r7dcPN63yqBCIj25prpvZP0nI4+EgWoFG95V596CurXpKRBGRjQlHCvy5Ib/iW8nZJWwrET3mgd6mEhfP4KCuaLjopWs7h+MdXFdIv8dHQJgg1xi1eYqB0uDYjxwVmri0Sv5XKut/onqapC+FQiC2C1lvYJ9MVco6yDYsS3AANUfMtvtbYI2hfwZatiSsnoUeMZd34GVjkMMKA+XnjJpXgRW2SHTZplVowPmJsvXy6w3cfO1AK2dvtZEKTkC/TY9LFiKHCG0DnrMQdGm2lzlBHM9iEYynH2UcVMhUEjsc0oDBTgo2ZSQ1gzkAHeWeBXYFjYLuuf8yzTCy7/RFR81WDjXMbq2BOH5dURnxo6oivmxL3cKzKInlZkD31nvpHB9Kk7GfcfE1t+1V64b9LtgeJGlpRFxQCAqWJ5DoY77ski8gsOEOr2uywZaoO/NGa0X0y1pNQHBi3b2SUGNpcZxDT7rLbBf1FSnQ8guxGW3W+36BW0gBje4DOz6Ba6SVk0xiKgt+q2JOFyr4SYfnu+Ic1QZYIuwHBrgzr6UvOcSCzPTOo7D6IC4ISeS7zkl4h+2VoeHpnG/uWR3+ysNgPcOIXQbv0n4mr3BwQcdKJxgPSeyuP/z1Jjg4e9nUvoXegqQVIE30EHx5GHv+FAVUNTowYDJgyFhf5IvlYmEqRif6+WN1MkEJmDcQITx9FX23a4mxy1AQRsOHO/+eImX9l8EMJI3oPWzVXxSOeHU1dUWYr2uAA7AMb+vAEZSbU3qob9ibCyXeypEMpZ6863o6QPqlqGHZkuWABSTVNd4cOh9hv3qEpSx2Zy/DJMP6cItEmiBJ5PFqQnDEIt3NrA3COlOSgz43D7gpNFNJ5MBh4oFzhDPiglC2ypsNU4ISywY2erkyb1NC3Qh/IfWj0eDgZI4/ln8WPfBsT3meTjq1Uqt1E7Zl/qftqkx6aM9KueMCekSnMrcHj1CqTWWzEzPsZGcDe3Ue4Ws+XFYVxNbOFF8ezkvQGR6ZOtOLU2lQEnMBStx47vE6Pb7AYMBRj2OOfZXfisjJnpTfSNjo6sZ6qSvNxZNmDeS7Gk3yYyCk1HtKN2UnhMIjOXUzAqDv90lx9O/q/AT1ZMnit5XQe9wmQxnE/WSH0CqZ9/2Hy+Sfmpeg8RwsHI5Z8kC8H293m/LHVVM/BA7HaTJYg5Enk7M/xWpq0192ACfBai2LA/qrCjCr6Dh1BIMzMXINBmX96MJ5Hn2nxln/RXPFhwHxUmSV0EV2V0jm86/dxxuYSU1W7sVkEbN9EzkG0QFwPhyHKyb3t+Fj5WoUUTErcazE/N6EW6Lvp0d//SDPj7EV9UdJN+Amnf3Wwk3A0SlJ9Z00yvXZ7n3z70G47Hfsow8Wq1JXcfwnA+Yxa5mFsgV464KKP4T31wqIgzFPd3eCe3j5ory5fBF2hgCFyVFrLzI9eetNXvM7oQqyFgDo4CTp/hDV9NMX9JDHQ/nyHTLvZLNLF6ftn2OxjGm8+PqOwhxnPHWipkE/8wbtyri80Sr7pMNkQGMfo4ZYK9OcCC4ESVFFbLMIvlxSoRqWie0wxqnLfcLSXMSpMMQEJYDVObYsXIQNv4TGNwjq1kvT1UOkicTrG3IaBZ3XdScS3u8sgeZPVpOLkbiF940FjbCeNRINNvDbd01EPBrTCPpm12m43ze1bBB59Ia6Ovhnur/Nvx3IxwSWol+3H2qfCJR8df6aQf4v6WiONxkK+IqT4pKQrZK/LplgDI/PJZbOep8dtbV7oCr6CgfpWa8NczOkPx81iSHbsNhVSJBOtrLIMrL31LK9TqHqAbAHe0RLmmV806kRLDLNEhUEJfm9u0sxpkL93Zgd6rw+tqBfTMi59xqXHLXSHwSbSBl0EK0+loECOPtrl+/nsaFe197di4yUgoe4jKoAJDXc6DGDjrQOoFDWZJ9HXwt8xDrQP+7aRwWKWI1GF8s8O4KzxWBBcwnl3vnl1Oez3oh6Ea1vjR7/z7DDTrFtqU2W/KAEzAuXDNZ7MY73MF216dzdSbWmUp4lcm7keJfWaMHgut9x5C9mj66Z0lJ+yhsjVvyiWrfk1lzPOTdhG15Y7gQlXtacvI7qv/XNSscDwqkgwHT/gUsD5yB7LdRRvJxQGYINn9hTpodKFVSTPrtGvyQw+HlRFXIkodErAGu9Iy1YpfSPc3jkFh5CX3lPxv7aqjE/JAfTIpEjGb/H7MO0e2vsViSW1qa/Lmi4/n4DEI3g7lYrcanspDfEpKkdV1OjSLOy0BCUqVoECaB55vs06rXl4jqmLsPsFM/7vYJ0vrBhDCm/00A/H81l1uekJ/6Lml3Hb9+NKiLqATJmDpyzfYZFHumEjC662L0Bwkxi7E9U4cQA0XMVDuMYAIeLMPgQaMVOd8fmt5SflFIfuBoszeAw7ow5gXPE2Y/yBc/7jExARUf/BxIHQBF5Sn3i61w4z5xJdCyO1F1X3+3ax+JSvMeZ7S6QSKp1Fp/sjYz6Z+VgCZzibGeEoujryfMulH7Rai5kAft9ebcW50DyJr2uo2z97mTWIu45YsSnNSMrrNUuG1XsYBtD9TDYzQffKB87vWbkM4EbPAFgoBV4GQS+vtFDUqOFAoi1nTtmIOvg38N4hT2Sn8r8clmBCXspBlMBYTnrqFJGBT3wZOzAyJDre9dHH7+x7qaaKDOB4UQALD5ecS0DE4obubQEiuJZ0EpBVpLuYcce8Aa4PYd/V4DLDAJBYKQPCWTcrEaZ5HYbJi11Gd6hjGom1ii18VHYnG28NKpkz2UKVPxlhYSp8uZr367iOmoy7zsxehW9wzcy2zG0a80PBMCRQMb32hnaHeOR8fnNDzZhaNYhkOdDsBUZ3loDMa1YP0uS0cjUP3b/6DBlqmZOeNABDsLl5BI5QJups8uxAuWJdkUB/pO6Zax6tsg7fN5mjjDgMGngO+DPcKqiHIDbFIGudxtPTIyDi9SFMKBDcfdGQRv41q1AqmxgkVfJMnP8w/Bc7N9/TR6C7mGObFqFkIEom8sKi2xYqJLTCHK7cxzaZvqODo22c3wisBCP4HeAgcRbNPAsBkNRhSmD48dHupdBRw4mIvtS5oeF6zeT1KMCyhMnmhpkFAGWnGscoNkwvQ8ZM5lE/vgTHFYL99OuNxdFBxTEDd5v2qLR8y9WkXsWgG6kZNndFG+pO/UAkOCipqIhL3hq7cRSdrCq7YhUsTocEcnaFa6nVkhnSeRYUA1YO0z5itF9Sly3VlxYDw239TJJH6f3EUfYO5lb7bcFcz8Bp7Oo8QmnsUHOz/fagVUBtKEw1iT88j+aKkv8cscKNkMxjYr8344D1kFoZ7/td1W6LCNYN594301tUGRmFjAzeRg5vyoM1F6+bJZ/Q54jN/k8SFd3DxPTYaAUsivsBfgTn7Mx8H2SpPt4GOdYRnEJOH6jHM2p6SgB0gzIRq6fHxGMmSmqaPCmlfwxiuloaVIitLGN8wie2CDWhkzLoCJcODh7KIOAqbHEvXdUxaS4TTTs07Clzj/6GmVs9kiZDerMxEnhUB6QQPlcfqkG9882RqHoLiHGBoHfQuXIsAG8GTAtao2KVwRnvvam8jo1e312GQAKWEa4sUVEAMG4G6ckcONDwRcg1e2D3+ohXgY4UAWF8wHKQMrSnzCgfFpsxh+aHXMGtPQroQasRY4U6UdG0rz1Vjbka0MekOGRZQEvqQFlxseFor8zWFgHek3v29+WqN6gaK5gZOTOMZzpQIC1201LkMCXild3vWXSc5UX9xcFYfbRPzGFa1FDcPfPB/jUEq/FeGt419CI3YmBlVoHsa4KdcwQP5ZSwHHhFJ7/Ph/Rap/4vmG91eDwPP0lDfCDRCLszTqfzM71xpmiKi2HwS4WlqvGNwtvwF5Dqpn6KTq8ax00UMPkxDcZrEEEsIvHiUXXEphdb4GB4FymlPwBz4Gperqq5pW7TQ6/yNRhW8VT5NhuP0udlxo4gILq5ZxAZk8ZGh3g4CqxJlPKY7AQxupfUcVpWT5VItp1+30UqoyP4wWsRo3olRRgkWZZ2ZN6VC3OZFeXB8NbnUrSdikNptD1QiGuKkr8EmSR/AK9Rw+FF3s5uwuPbvHGiPeFOViltMK7AUaOsq9+x9cndk3iJEE5LKZRlWJbKOZweROzmPNVPkjE3K/TyA57Rs68TkZ3MR8akKpm7cFjnjPd/DdkWjgYoKHSr5Wu5ssoBYU4acRs5g2DHxUmdq8VXOXRbunD8QN0LhgkssgahcdoYsNvuXGUK/KXD/7oFb+VGdhqIn02veuM5bLudJOc2Ky0GMaG4W/xWBxIJcL7yliJOXOpx0AkBqUgzlDczmLT4iILXDxxtRR1oZa2JWFgiAb43obrJnG/TZC2KSK2wqOzRZTXavZZFMb1f3bXvVaNaK828w9TO610gk8JNf3gMfETzXXsbcvRGCG9JWQZ6+cDPqc4466Yo2RcKH+PILeKOqtnlbInR3MmBeGG3FH10yzkybuqEC2HSQwpA0An7d9+73BkDUTm30bZmoP/RGbgFN+GrCOfADgqr0WbI1a1okpFms8iHYw9hm0zUvlEMivBRxModrbJJ+9/p3jUdQQ9BCtQdxnOGrT5dzRUmw0593/mbRSdBg0nRvRZM5/E16m7ZHmDEtWhwvfdZCZ8J8M12W0yRMszXamWfQTwIZ4ayYktrnscQuWr8idp3PjT2eF/jmtdhIfcpMnb+IfZY2FebW6UY/AK3jP4u3Tu4zE4qlnQgLFbM19EBIsNf7KhjdbqQ/D6yiDb+NlEi2SKD+ivXVUK8ib0oBo366gXkR8ZxGjpJIDcEgZPa9TcYe0TIbiPl/rPUQDu3XBJ9X/GNq3FAUsKsll57DzaGMrjcT+gctp+9MLYXCq+sqP81eVQ0r9lt+gcQfZbACRbEjvlMskztZG8gbC8Qn9tt26Q7y7nDrbZq/LEz7kR6Jc6pg3N9rVX8Y5MJrGlML9p9lU4jbTkKqCveeZUJjHB03m2KRKR2TytoFkTXOLg7keU1s1lrPMQJpoOKLuAAC+y1HlJucU6ysB5hsXhvSPPLq5J7JtnqHKZ4vYjC4Vy8153QY+6780xDuGARsGbOs1WqzH0QS765rnSKEbbKlkO8oI/VDwUd0is13tKpqILu1mDJFNy/iJAWcvDgjxvusIT+PGz3ST/J9r9Mtfd0jpaGeiLYIqXc7DiHSS8TcjFVksi66PEkxW1z6ujbLLUGNNYnzOWpH8BZGK4bCK7iR+MbIv8ncDAz1u4StN3vTTzewr9IQjk9wxFxn+6N1ddKs0vffJiS08N3a4G1SVrlZ97Q/M+8G9fe5AP6d9/Qq4WRnORVhofPIKEdCr3llspUfE0oKIIYoByBRPh+bX1HLS3JWGJRhIvE1aW4NTd8ePi4Z+kXb+Z8snYfSNcqijhAgVsx4RCM54cXUiYkjeBmmC4ajOHrChoELscJJC7+9jjMjw5BagZKlgRMiSNYz7h7vvZIoQqbtQmspc0cUk1G/73iXtSpROl5wtLgQi0mW2Ex8i3WULhcggx6E1LMVHUsdc9GHI1PH3U2Ko0PyGdn9KdVOLm7FPBui0i9a0HpA60MsewVE4z8CAt5d401Gv6zXlIT5Ybit1VIA0FCs7wtvYreru1fUyW3oLAZ/+aTnZrOcYRNVA8spoRtlRoWflsRClFcgzkqiHOrf0/SVw+EpVaFlJ0g4Kxq1MMOmiQdpMNpte8lMMQqm6cIFXlnGbfJllysKDi+0JJMotkqgIxOSQgU9dn/lWkeVf8nUm3iwX2Nl3WDw9i6AUK3vBAbZZrcJpDQ/N64AVwjT07Jef30GSSmtNu2WlW7YoyW2FlWfZFQUwk867EdLYKk9VG6JgEnBiBxkY7LMo4YLQJJlAo9l/oTvJkSARDF/XtyAzM8O2t3eT/iXa6wDN3WewNmQHdPfsxChU/KtLG2Mn8i4ZqKdSlIaBZadxJmRzVS/o4yA65RTSViq60oa395Lqw0pzY4SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const LS=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),jS=4;function wne(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),i=1,s=[0,1];for(let T=1;T>--c&1}const h=31,f=2**h,p=f>>>1,d=p>>1,g=f-1;let y=0;for(let T=0;T1;){let D=_+B>>>1;T>>1|l(),N=N<<1^p,P=(P^p)<<1|p|1;b=N,S=1+P-N}let k=n-4;return x.map(T=>{switch(T-k){case 3:return k+65792+(t[o++]<<16|t[o++]<<8|t[o++]);case 2:return k+256+(t[o++]<<8|t[o++]);case 1:return k+t[o++];default:return T-1}})}function Ene(t){let e=0;return()=>t[e++]}function cT(t){return Ene(wne(Ane(t)))}function Ane(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((i,s)=>e[i.charCodeAt(0)]=s);let r=t.length,n=new Uint8Array(6*r>>3);for(let i=0,s=0,a=0,o=0;i=8&&(n[s++]=o>>(a-=8));return n}function Sne(t){return t&1?~t>>1:t>>1}function Cne(t,e){let r=Array(t);for(let n=0,i=0;n{let e=Qd(t);if(e.length)return e})}function lT(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(_ne(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(kne(r,t))}return e.flat()}function Yd(t){let e=[];for(;;){let r=t(e.length);if(!r)break;e.push(r)}return e}function fT(t,e,r){let n=Array(t).fill().map(()=>[]);for(let i=0;in[a].push(s));return n}function _ne(t,e){let r=1+e(),n=e(),i=Yd(e);return fT(i.length,1+t,e).flatMap((a,o)=>{let[c,...u]=a;return Array(i[o]).fill().map((l,h)=>{let f=h*n;return[c+h*r,u.map(p=>p+f)]})})}function kne(t,e){let r=1+e();return fT(r,1+t,e).map(i=>[i[0],i.slice(1)])}function Bne(t){let e=[],r=Qd(t);return i(n([]),[]),e;function n(s){let a=t(),o=Yd(()=>{let c=Qd(t).map(u=>r[u]);if(c.length)return n(c)});return{S:a,B:o,Q:s}}function i({S:s,B:a},o,c){if(!(s&4&&c===o[o.length-1])){s&2&&(c=o[o.length-1]),s&1&&e.push(o);for(let u of a)for(let l of u.Q)i(u,[...o,l],c)}}}function Ine(t){return t.toString(16).toUpperCase().padStart(2,"0")}function hT(t){return`{${Ine(t)}}`}function Fne(t){let e=[];for(let r=0,n=t.length;r>24&255}function gT(t){return t&16777215}let Qw,US,Yw,yg;function Lne(){let t=cT(Pne);Qw=new Map(uT(t).flatMap((e,r)=>e.map(n=>[n,r+1<<24]))),US=new Set(Qd(t)),Yw=new Map,yg=new Map;for(let[e,r]of lT(t)){if(!US.has(e)&&r.length==2){let[n,i]=r,s=yg.get(n);s||(s=new Map,yg.set(n,s)),s.set(i,e)}Yw.set(e,r.reverse())}}function mT(t){return t>=ep&&t=Tm&&t=Pm&&eNm&&e0&&i(Nm+u)}else{let a=Yw.get(s);a?r.push(...a):i(s)}if(!r.length)break;s=r.pop()}if(n&&e.length>1){let s=$0(e[0]);for(let a=1;a0&&i>=a)a==0?(e.push(n,...r),r.length=0,n=o):r.push(o),i=a;else{let c=jne(n,o);c>=0?n=c:i==0&&a==0?(e.push(n),n=o):(r.push(o),i=a)}}return n>=0&&e.push(n,...r),e}function yT(t){return vT(t).map(gT)}function $ne(t){return Une(vT(t))}const $S=45,xT=".",bT=65039,wT=1,Ql=t=>Array.from(t);function tp(t,e){return t.P.has(e)||t.Q.has(e)}class Hne extends Array{get is_emoji(){return!0}}let e4,ET,iu,t4,AT,vf,Mx,Tl,ST,HS,r4;function J8(){if(e4)return;let t=cT(bne);const e=()=>Qd(t),r=()=>new Set(e());e4=new Map(lT(t)),ET=r(),iu=e(),t4=new Set(e().map(l=>iu[l])),iu=new Set(iu),AT=r(),r();let n=uT(t),i=t();const s=()=>new Set(e().flatMap(l=>n[l]).concat(e()));vf=Yd(l=>{let h=Yd(t).map(f=>f+96);if(h.length){let f=l>=i;h[0]-=32,h=$h(h),f&&(h=`Restricted[${h}]`);let p=s(),d=s(),g=!t();return{N:h,P:p,Q:d,M:g,R:f}}}),Mx=r(),Tl=new Map;let a=e().concat(Ql(Mx)).sort((l,h)=>l-h);a.forEach((l,h)=>{let f=t(),p=a[h]=f?a[h-f]:{V:[],M:new Map};p.V.push(l),Mx.has(l)||Tl.set(l,p)});for(let{V:l,M:h}of new Set(Tl.values())){let f=[];for(let d of l){let g=vf.filter(x=>tp(x,d)),y=f.find(({G:x})=>g.some(b=>x.has(b)));y||(y={G:new Set,V:[]},f.push(y)),y.V.push(d),g.forEach(x=>y.G.add(x))}let p=f.flatMap(d=>Ql(d.G));for(let{G:d,V:g}of f){let y=new Set(p.filter(x=>!d.has(x)));for(let x of g)h.set(x,y)}}let o=new Set,c=new Set;const u=l=>o.has(l)?c.add(l):o.add(l);for(let l of vf){for(let h of l.P)u(h);for(let h of l.Q)u(h)}for(let l of o)!Tl.has(l)&&!c.has(l)&&Tl.set(l,wT);ST=new Set(Ql(o).concat(Ql(yT(o)))),HS=Bne(t).map(l=>Hne.from(l)).sort(Tne),r4=new Map;for(let l of HS){let h=[r4];for(let f of l){let p=h.map(d=>{let g=d.get(f);return g||(g=new Map,d.set(f,g)),g});f===bT?h.push(...p):h=p}for(let f of h)f.V=l}}function X8(t){return(CT(t)?"":`${Q8(oy([t]))} `)+hT(t)}function Q8(t){return`"${t}"‎`}function zne(t){if(t.length>=4&&t[2]==$S&&t[3]==$S)throw new Error(`invalid label extension: "${$h(t.slice(0,4))}"`)}function Vne(t){for(let r=t.lastIndexOf(95);r>0;)if(t[--r]!==95)throw new Error("underscore allowed only at start")}function qne(t){let e=t[0],r=LS.get(e);if(r)throw sd(`leading ${r}`);let n=t.length,i=-1;for(let s=1;s{let s=Fne(i),a={input:s,offset:n};n+=s.length+1;try{let o=a.tokens=Yne(s,e,r),c=o.length,u;if(!c)throw new Error("empty label");let l=a.output=o.flat();if(Vne(l),!(a.emoji=c>1||o[0].is_emoji)&&l.every(f=>f<128))zne(l),u="ASCII";else{let f=o.flatMap(p=>p.is_emoji?[]:p);if(!f.length)u="Emoji";else{if(iu.has(l[0]))throw sd("leading combining mark");for(let g=1;ga.has(o)):Ql(a),!r.length)return}else n.push(i)}if(r){for(let i of r)if(n.every(s=>tp(i,s)))throw new Error(`whole-script confusable: ${t.N}/${i.N}`)}}function Jne(t){let e=vf;for(let r of t){let n=e.filter(i=>tp(i,r));if(!n.length)throw vf.some(i=>tp(i,r))?kT(e[0],r):_T(r);if(e=n,n.length==1)break}return e}function Xne(t){return t.map(({input:e,error:r,output:n})=>{if(r){let i=r.message;throw new Error(t.length==1?i:`Invalid label ${Q8(oy(e))}: ${i}`)}return $h(n)}).join(xT)}function _T(t){return new Error(`disallowed character: ${X8(t)}`)}function kT(t,e){let r=X8(e),n=vf.find(i=>i.P.has(e));return n&&(r=`${n.N} ${r}`),new Error(`illegal mixture: ${t.N} + ${r}`)}function sd(t){return new Error(`illegal placement: ${t}`)}function Qne(t,e){for(let r of e)if(!tp(t,r))throw kT(t,r);if(t.M){let r=yT(e);for(let n=1,i=r.length;njS)throw new Error(`excessive non-spacing marks: ${Q8(oy(r.slice(n-1,s)))} (${s-n}/${jS})`);n=s}}}function Yne(t,e,r){let n=[],i=[];for(t=t.slice().reverse();t.length;){let s=tie(t);if(s)i.length&&(n.push(e(i)),i=[]),n.push(r(s));else{let a=t.pop();if(ST.has(a))i.push(a);else{let o=e4.get(a);if(o)i.push(...o);else if(!ET.has(a))throw _T(a)}}}return i.length&&n.push(e(i)),n}function eie(t){return t.filter(e=>e!=bT)}function tie(t,e){let r=r4,n,i=t.length;for(;i&&(r=r.get(t[--i]),!!r);){let{V:s}=r;s&&(n=s,e&&e.push(...t.slice(i).reverse()),t.length=i)}return n}const BT=new Uint8Array(32);BT.fill(0);function zS(t){return he(t.length!==0,"invalid ENS name; empty component","comp",t),t}function IT(t){const e=no(rie(t)),r=[];if(t.length===0)return r;let n=0;for(let i=0;i{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const r=new Uint8Array(e.length+1);return r.set(e,1),r[0]=r.length-1,r})))+"00"}function Lx(t,e){return{address:xt(t),storageKeys:e.map((r,n)=>(he(Yt(r,32),"invalid slot",`storageKeys[${n}]`,r),r.toLowerCase()))}}function dl(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(he(r.length===2,"invalid slot set",`value[${n}]`,r),Lx(r[0],r[1])):(he(r!=null&&typeof r=="object","invalid address-slot set","value",t),Lx(r.address,r.storageKeys)));he(t!=null&&typeof t=="object","invalid access list","value",t);const e=Object.keys(t).map(r=>{const n=t[r].reduce((i,s)=>(i[s]=!0,i),{});return Lx(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function iie(t){let e;return typeof t=="string"?e=Xd.computePublicKey(t,!1):e=t.publicKey,xt(Qt("0x"+e.substring(4)).substring(26))}function sie(t,e){return iie(Xd.recoverPublicKey(t,e))}const Tn=BigInt(0),aie=BigInt(2),oie=BigInt(27),cie=BigInt(28),uie=BigInt(35),lie=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function Y8(t){return t==="0x"?null:xt(t)}function FT(t,e){try{return dl(t)}catch(r){he(!1,r.message,e,t)}}function cy(t,e){return t==="0x"?0:at(t,e)}function xn(t,e){if(t==="0x")return Tn;const r=Ke(t,e);return he(r<=lie,"value exceeds uint size",e,r),r}function Kr(t,e){const r=Ke(t,"value"),n=oi(r);return he(n.length<=32,"value too large",`tx.${e}`,r),n}function TT(t){return dl(t).map(e=>[e.address,e.storageKeys])}function fie(t){const e=$8(t);he(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",t);const r={type:0,nonce:cy(e[0],"nonce"),gasPrice:xn(e[1],"gasPrice"),gasLimit:xn(e[2],"gasLimit"),to:Y8(e[3]),value:xn(e[4],"value"),data:qe(e[5]),chainId:Tn};if(e.length===6)return r;const n=xn(e[6],"v"),i=xn(e[7],"r"),s=xn(e[8],"s");if(i===Tn&&s===Tn)r.chainId=n;else{let a=(n-uie)/aie;a=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),Te(!r||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),Te(this.type!==0||!n,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const i=[];return this.type!=null?i.push(this.type):r?i.push(2):e?(i.push(1),n||i.push(0)):n?(i.push(1),i.push(2)):(i.push(0),i.push(1),i.push(2)),i.sort(),i}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}clone(){return $o.from(this)}toJSON(){const e=r=>r==null?null:r.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(e){if(e==null)return new $o;if(typeof e=="string"){const n=Et(e);if(n[0]>=127)return $o.from(fie(n));switch(n[0]){case 1:return $o.from(die(n));case 2:return $o.from(hie(n))}Te(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const r=new $o;return e.type!=null&&(r.type=e.type),e.to!=null&&(r.to=e.to),e.nonce!=null&&(r.nonce=e.nonce),e.gasLimit!=null&&(r.gasLimit=e.gasLimit),e.gasPrice!=null&&(r.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(r.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(r.maxFeePerGas=e.maxFeePerGas),e.data!=null&&(r.data=e.data),e.value!=null&&(r.value=e.value),e.chainId!=null&&(r.chainId=e.chainId),e.signature!=null&&(r.signature=Fs.from(e.signature)),e.accessList!=null&&(r.accessList=e.accessList),e.hash!=null&&(he(r.isSigned(),"unsigned transaction cannot define hash","tx",e),he(r.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&(he(r.isSigned(),"unsigned transaction cannot define from","tx",e),he(r.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),r}};Ra=new WeakMap,Nf=new WeakMap,Of=new WeakMap,Df=new WeakMap,Rf=new WeakMap,Mf=new WeakMap,Lf=new WeakMap,jf=new WeakMap,Uf=new WeakMap,$f=new WeakMap,Hf=new WeakMap,zf=new WeakMap;let Dm=$o;const NT=new Uint8Array(32);NT.fill(0);const pie=BigInt(-1),OT=BigInt(0),DT=BigInt(1),gie=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function mie(t){const e=Et(t),r=e.length%32;return r?_r([e,NT.slice(r)]):qe(e)}const vie=Tc(DT,32),yie=Tc(OT,32),WS={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},jx=["name","version","chainId","verifyingContract","salt"];function GS(t){return function(e){return he(typeof e=="string",`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const xie={name:GS("name"),version:GS("version"),chainId:function(t){const e=Ke(t,"domain.chainId");return he(e>=0,"invalid chain ID","domain.chainId",t),Number.isSafeInteger(e)?Number(e):Xl(e)},verifyingContract:function(t){try{return xt(t).toLowerCase()}catch{}he(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){const e=Et(t,"domain.salt");return he(e.length===32,'invalid domain value "salt"',"domain.salt",t),qe(e)}};function Ux(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=e[1]==="",n=parseInt(e[2]||"256");he(n%8===0&&n!==0&&n<=256&&(e[2]==null||e[2]===String(n)),"invalid numeric width","type",t);const i=j0(gie,r?n-1:n),s=r?(i+DT)*pie:OT;return function(a){const o=Ke(a,"value");return he(o>=s&&o<=i,`value out-of-bounds for ${t}`,"value",o),Tc(r?IF(o,256):o,32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return he(r!==0&&r<=32&&e[1]===String(r),"invalid bytes width","type",t),function(n){const i=Et(n);return he(i.length===r,`invalid length for ${t}`,"value",n),mie(n)}}}switch(t){case"address":return function(e){return Zu(xt(e),32)};case"bool":return function(e){return e?vie:yie};case"bytes":return function(e){return Qt(e)};case"string":return function(e){return Ju(e)}}return null}function ZS(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}var mp,Ma,Vf,Km,RT;const yi=class yi{constructor(e){ce(this,Km);ae(this,"primaryType");ce(this,mp,void 0);ce(this,Ma,void 0);ce(this,Vf,void 0);Q(this,mp,JSON.stringify(e)),Q(this,Ma,new Map),Q(this,Vf,new Map);const r=new Map,n=new Map,i=new Map;Object.keys(e).forEach(o=>{r.set(o,new Set),n.set(o,[]),i.set(o,new Set)});for(const o in e){const c=new Set;for(const u of e[o]){he(!c.has(u.name),`duplicate variable name ${JSON.stringify(u.name)} in ${JSON.stringify(o)}`,"types",e),c.add(u.name);const l=u.type.match(/^([^\x5b]*)(\x5b|$)/)[1]||null;he(l!==o,`circular type reference to ${JSON.stringify(l)}`,"types",e),!Ux(l)&&(he(n.has(l),`unknown type ${JSON.stringify(l)}`,"types",e),n.get(l).push(o),r.get(o).add(l))}}const s=Array.from(n.keys()).filter(o=>n.get(o).length===0);he(s.length!==0,"missing primary type","types",e),he(s.length===1,`ambiguous primary types or unused types: ${s.map(o=>JSON.stringify(o)).join(", ")}`,"types",e),Je(this,{primaryType:s[0]});function a(o,c){he(!c.has(o),`circular type reference to ${JSON.stringify(o)}`,"types",e),c.add(o);for(const u of r.get(o))if(n.has(u)){a(u,c);for(const l of c)i.get(l).add(u)}c.delete(o)}a(this.primaryType,new Set);for(const[o,c]of i){const u=Array.from(c);u.sort(),U(this,Ma).set(o,ZS(o,e[o])+u.map(l=>ZS(l,e[l])).join(""))}}get types(){return JSON.parse(U(this,mp))}getEncoder(e){let r=U(this,Vf).get(e);return r||(r=ye(this,Km,RT).call(this,e),U(this,Vf).set(e,r)),r}encodeType(e){const r=U(this,Ma).get(e);return he(r,`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return Qt(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,n){if(Ux(e))return n(e,r);const i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i)return he(!i[3]||parseInt(i[3])===r.length,`array length mismatch; expected length ${parseInt(i[3])}`,"value",r),r.map(a=>this._visit(i[1],a,n));const s=this.types[e];if(s)return s.reduce((a,{name:o,type:c})=>(a[o]=this._visit(c,r[o],n),a),{});he(!1,`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new yi(e)}static getPrimaryType(e){return yi.from(e).primaryType}static hashStruct(e,r,n){return yi.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){if(e[n]==null)continue;const i=WS[n];he(i,`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:i})}return r.sort((n,i)=>jx.indexOf(n.name)-jx.indexOf(i.name)),yi.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return _r(["0x1901",yi.hashDomain(e),yi.from(r).hash(n)])}static hash(e,r,n){return Qt(yi.encode(e,r,n))}static async resolveNames(e,r,n,i){e=Object.assign({},e);for(const o in e)e[o]==null&&delete e[o];const s={};e.verifyingContract&&!Yt(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const a=yi.from(r);a.visit(n,(o,c)=>(o==="address"&&!Yt(c,20)&&(s[c]="0x"),c));for(const o in s)s[o]=await i(o);return e.verifyingContract&&s[e.verifyingContract]&&(e.verifyingContract=s[e.verifyingContract]),n=a.visit(n,(o,c)=>o==="address"&&s[c]?s[c]:c),{domain:e,value:n}}static getPayload(e,r,n){yi.hashDomain(e);const i={},s=[];jx.forEach(c=>{const u=e[c];u!=null&&(i[c]=xie[c](u),s.push({name:c,type:WS[c]}))});const a=yi.from(r),o=Object.assign({},r);return he(o.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",r),o.EIP712Domain=s,a.encode(n),{types:o,domain:i,primaryType:a.primaryType,message:a.visit(n,(c,u)=>{if(c.match(/^bytes(\d*)/))return qe(Et(u));if(c.match(/^u?int/))return Ke(u).toString();switch(c){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return he(typeof u=="string","invalid string","value",u),u}he(!1,"unsupported type","type",c)})}}};mp=new WeakMap,Ma=new WeakMap,Vf=new WeakMap,Km=new WeakSet,RT=function(e){{const i=Ux(e);if(i)return i}const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const i=r[1],s=this.getEncoder(i);return a=>{he(!r[3]||parseInt(r[3])===a.length,`array length mismatch; expected length ${parseInt(r[3])}`,"value",a);let o=a.map(s);return U(this,Ma).has(i)&&(o=o.map(Qt)),Qt(_r(o))}}const n=this.types[e];if(n){const i=Ju(U(this,Ma).get(e));return s=>{const a=n.map(({name:o,type:c})=>{const u=this.getEncoder(c)(s[o]);return U(this,Ma).has(c)?Qt(u):u});return a.unshift(i),_r(a)}}he(!1,`unknown type: ${e}`,"type",e)};let Rm=yi;function En(t){const e=new Set;return t.forEach(r=>e.add(r)),Object.freeze(e)}const bie="external public payable",wie=En(bie.split(" ")),MT="constant external internal payable private public pure view",Eie=En(MT.split(" ")),LT="constructor error event fallback function receive struct",jT=En(LT.split(" ")),UT="calldata memory storage payable indexed",Aie=En(UT.split(" ")),Sie="tuple returns",Cie=[LT,UT,Sie,MT].join(" "),_ie=En(Cie.split(" ")),kie={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Bie=new RegExp("^(\\s*)"),Iie=new RegExp("^([0-9]+)"),Fie=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),$T=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),HT=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");var Vr,ms,vp,i4;const Wm=class Wm{constructor(e){ce(this,vp);ce(this,Vr,void 0);ce(this,ms,void 0);Q(this,Vr,0),Q(this,ms,e.slice())}get offset(){return U(this,Vr)}get length(){return U(this,ms).length-U(this,Vr)}clone(){return new Wm(U(this,ms))}reset(){Q(this,Vr,0)}popKeyword(e){const r=this.peek();if(r.type!=="KEYWORD"||!e.has(r.text))throw new Error(`expected keyword ${r.text}`);return this.pop().text}popType(e){if(this.peek().type!==e)throw new Error(`expected ${e}; got ${JSON.stringify(this.peek())}`);return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const r=ye(this,vp,i4).call(this,U(this,Vr)+1,e.match+1);return Q(this,Vr,e.match+1),r}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const r=[];for(;U(this,Vr)=U(this,ms).length)throw new Error("out-of-bounds");return U(this,ms)[U(this,Vr)]}peekKeyword(e){const r=this.peekType("KEYWORD");return r!=null&&e.has(r)?r:null}peekType(e){if(this.length===0)return null;const r=this.peek();return r.type===e?r.text:null}pop(){const e=this.peek();return So(this,Vr)._++,e}toString(){const e=[];for(let r=U(this,Vr);r`}};Vr=new WeakMap,ms=new WeakMap,vp=new WeakSet,i4=function(e=0,r=0){return new Wm(U(this,ms).slice(e,r).map(n=>Object.freeze(Object.assign({},n,{match:n.match-e,linkBack:n.linkBack-e,linkNext:n.linkNext-e}))))};let Ts=Wm;function zc(t){const e=[],r=a=>{const o=s0&&e[e.length-1].type==="NUMBER"){const h=e.pop().text;l=h+l,e[e.length-1].value=at(h)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=l}continue}if(o=a.match(Fie),o){if(c.text=o[1],s+=c.text.length,_ie.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(HT)){c.type="TYPE";continue}c.type="ID";continue}if(o=a.match(Iie),o){c.text=o[1],c.type="NUMBER",s+=c.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(a[0])} at position ${s}`)}return new Ts(e.map(a=>Object.freeze(a)))}function JS(t,e){let r=[];for(const n in e.keys())t.has(n)&&r.push(n);if(r.length>1)throw new Error(`conflicting types: ${r.join(", ")}`)}function uy(t,e){if(e.peekKeyword(jT)){const r=e.pop().text;if(r!==t)throw new Error(`expected ${t}, got ${r}`)}return e.popType("ID")}function yo(t,e){const r=new Set;for(;;){const n=t.peekType("KEYWORD");if(n==null||e&&!e.has(n))break;if(t.pop(),r.has(n))throw new Error(`duplicate keywords: ${JSON.stringify(n)}`);r.add(n)}return Object.freeze(r)}function zT(t){let e=yo(t,Eie);return JS(e,En("constant payable nonpayable".split(" "))),JS(e,En("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function io(t,e){return t.popParams().map(r=>Gr.from(r,e))}function VT(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return Ke(t.pop().text);throw new Error("invalid gas")}return null}function Xu(t){if(t.length)throw new Error(`unexpected tokens: ${t.toString()}`)}const Tie=new RegExp(/^(.*)\[([0-9]*)\]$/);function XS(t){const e=t.match(HT);if(he(e,"invalid type","type",t),t==="uint")return"uint256";if(t==="int")return"int256";if(e[2]){const r=parseInt(e[2]);he(r!==0&&r<=32,"invalid bytes length","type",t)}else if(e[3]){const r=parseInt(e[3]);he(r!==0&&r<=256&&r%8===0,"invalid numeric width","type",t)}return t}const Xt={},zn=Symbol.for("_ethers_internal"),QS="_ParamTypeInternal",YS="_ErrorInternal",e9="_EventInternal",t9="_ConstructorInternal",r9="_FallbackInternal",n9="_FunctionInternal",i9="_StructInternal";var qf,xg;const xi=class xi{constructor(e,r,n,i,s,a,o,c){ce(this,qf);ae(this,"name");ae(this,"type");ae(this,"baseType");ae(this,"indexed");ae(this,"components");ae(this,"arrayLength");ae(this,"arrayChildren");if(ty(e,Xt,"ParamType"),Object.defineProperty(this,zn,{value:QS}),a&&(a=Object.freeze(a.slice())),i==="array"){if(o==null||c==null)throw new Error("")}else if(o!=null||c!=null)throw new Error("");if(i==="tuple"){if(a==null)throw new Error("")}else if(a!=null)throw new Error("");Je(this,{name:r,type:n,baseType:i,indexed:s,components:a,arrayLength:o,arrayChildren:c})}format(e){if(e==null&&(e="sighash"),e==="json"){const n=this.name||"";if(this.isArray()){const s=JSON.parse(this.arrayChildren.format("json"));return s.name=n,s.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(s)}const i={type:this.baseType==="tuple"?"tuple":this.type,name:n};return typeof this.indexed=="boolean"&&(i.indexed=this.indexed),this.isTuple()&&(i.components=this.components.map(s=>JSON.parse(s.format(e)))),JSON.stringify(i)}let r="";return this.isArray()?(r+=this.arrayChildren.format(e),r+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?r+="("+this.components.map(n=>n.format(e)).join(e==="full"?", ":",")+")":r+=this.type,e!=="sighash"&&(this.indexed===!0&&(r+=" indexed"),e==="full"&&this.name&&(r+=" "+this.name)),r}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,r){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const n=this;return e.map(i=>n.arrayChildren.walk(i,r))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const n=this;return e.map((i,s)=>n.components[s].walk(i,r))}return r(this.type,e)}async walkAsync(e,r){const n=[],i=[e];return ye(this,qf,xg).call(this,n,e,r,s=>{i[0]=s}),n.length&&await Promise.all(n),i[0]}static from(e,r){if(xi.isParamType(e))return e;if(typeof e=="string")try{return xi.from(zc(e),r)}catch{he(!1,"invalid param type","obj",e)}else if(e instanceof Ts){let o="",c="",u=null;yo(e,En(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(c="tuple",u=e.popParams().map(g=>xi.from(g)),o=`tuple(${u.map(g=>g.format()).join(",")})`):(o=XS(e.popType("TYPE")),c=o);let l=null,h=null;for(;e.length&&e.peekType("BRACKET");){const g=e.pop();l=new xi(Xt,"",o,c,null,u,h,l),h=g.value,o+=g.text,c="array",u=null}let f=null;if(yo(e,Aie).has("indexed")){if(!r)throw new Error("");f=!0}const d=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new xi(Xt,d,o,c,f,u,h,l)}const n=e.name;he(!n||typeof n=="string"&&n.match($T),"invalid name","obj.name",n);let i=e.indexed;i!=null&&(he(r,"parameter cannot be indexed","obj.indexed",e.indexed),i=!!i);let s=e.type,a=s.match(Tie);if(a){const o=parseInt(a[2]||"-1"),c=xi.from({type:a[1],components:e.components});return new xi(Xt,n||"",s,"array",i,null,o,c)}if(s==="tuple"||s.startsWith("tuple(")||s.startsWith("(")){const o=e.components!=null?e.components.map(u=>xi.from(u)):null;return new xi(Xt,n||"",s,"tuple",i,o,null,null)}return s=XS(e.type),new xi(Xt,n||"",s,s,i,null,null,null)}static isParamType(e){return e&&e[zn]===QS}};qf=new WeakSet,xg=function(e,r,n,i){if(this.isArray()){if(!Array.isArray(r))throw new Error("invalid array value");if(this.arrayLength!==-1&&r.length!==this.arrayLength)throw new Error("array is wrong length");const a=this.arrayChildren,o=r.slice();o.forEach((c,u)=>{var l;ye(l=a,qf,xg).call(l,e,c,n,h=>{o[u]=h})}),i(o);return}if(this.isTuple()){const a=this.components;let o;if(Array.isArray(r))o=r.slice();else{if(r==null||typeof r!="object")throw new Error("invalid tuple value");o=a.map(c=>{if(!c.name)throw new Error("cannot use object value with unnamed components");if(!(c.name in r))throw new Error(`missing value for component ${c.name}`);return r[c.name]})}if(o.length!==this.components.length)throw new Error("array is wrong length");o.forEach((c,u)=>{var l;ye(l=a[u],qf,xg).call(l,e,c,n,h=>{o[u]=h})}),i(o);return}const s=n(this.type,r);s.then?e.push(async function(){i(await s)}()):i(s)};let Gr=xi;class Qu{constructor(e,r,n){ae(this,"type");ae(this,"inputs");ty(e,Xt,"Fragment"),n=Object.freeze(n.slice()),Je(this,{type:r,inputs:n})}static from(e){if(typeof e=="string"){try{Qu.from(JSON.parse(e))}catch{}return Qu.from(zc(e))}if(e instanceof Ts)switch(e.peekKeyword(jT)){case"constructor":return Qa.from(e);case"error":return Pn.from(e);case"event":return ea.from(e);case"fallback":case"receive":return Ia.from(e);case"function":return ta.from(e);case"struct":return Ru.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return Qa.from(e);case"error":return Pn.from(e);case"event":return ea.from(e);case"fallback":case"receive":return Ia.from(e);case"function":return ta.from(e);case"struct":return Ru.from(e)}Te(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}he(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return Qa.isFragment(e)}static isError(e){return Pn.isFragment(e)}static isEvent(e){return ea.isFragment(e)}static isFunction(e){return ta.isFragment(e)}static isStruct(e){return Ru.isFragment(e)}}class ly extends Qu{constructor(r,n,i,s){super(r,n,s);ae(this,"name");he(typeof i=="string"&&i.match($T),"invalid identifier","name",i),s=Object.freeze(s.slice()),Je(this,{name:i})}}function rp(t,e){return"("+e.map(r=>r.format(t)).join(t==="full"?", ":",")+")"}class Pn extends ly{constructor(e,r,n){super(e,"error",r,n),Object.defineProperty(this,zn,{value:YS})}get selector(){return Ju(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});const r=[];return e!=="sighash"&&r.push("error"),r.push(this.name+rp(e,this.inputs)),r.join(" ")}static from(e){if(Pn.isFragment(e))return e;if(typeof e=="string")return Pn.from(zc(e));if(e instanceof Ts){const r=uy("error",e),n=io(e);return Xu(e),new Pn(Xt,r,n)}return new Pn(Xt,e.name,e.inputs?e.inputs.map(Gr.from):[])}static isFragment(e){return e&&e[zn]===YS}}class ea extends ly{constructor(r,n,i,s){super(r,"event",n,i);ae(this,"anonymous");Object.defineProperty(this,zn,{value:e9}),Je(this,{anonymous:s})}get topicHash(){return Ju(this.format("sighash"))}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(r)))});const n=[];return r!=="sighash"&&n.push("event"),n.push(this.name+rp(r,this.inputs)),r!=="sighash"&&this.anonymous&&n.push("anonymous"),n.join(" ")}static getTopicHash(r,n){return n=(n||[]).map(s=>Gr.from(s)),new ea(Xt,r,n,!1).topicHash}static from(r){if(ea.isFragment(r))return r;if(typeof r=="string")try{return ea.from(zc(r))}catch{he(!1,"invalid event fragment","obj",r)}else if(r instanceof Ts){const n=uy("event",r),i=io(r,!0),s=!!yo(r,En(["anonymous"])).has("anonymous");return Xu(r),new ea(Xt,n,i,s)}return new ea(Xt,r.name,r.inputs?r.inputs.map(n=>Gr.from(n,!0)):[],!!r.anonymous)}static isFragment(r){return r&&r[zn]===e9}}class Qa extends Qu{constructor(r,n,i,s,a){super(r,n,i);ae(this,"payable");ae(this,"gas");Object.defineProperty(this,zn,{value:t9}),Je(this,{payable:s,gas:a})}format(r){if(Te(r!=null&&r!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),r==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(r)))});const n=[`constructor${rp(r,this.inputs)}`];return this.payable&&n.push("payable"),this.gas!=null&&n.push(`@${this.gas.toString()}`),n.join(" ")}static from(r){if(Qa.isFragment(r))return r;if(typeof r=="string")try{return Qa.from(zc(r))}catch{he(!1,"invalid constuctor fragment","obj",r)}else if(r instanceof Ts){yo(r,En(["constructor"]));const n=io(r),i=!!yo(r,wie).has("payable"),s=VT(r);return Xu(r),new Qa(Xt,"constructor",n,i,s)}return new Qa(Xt,"constructor",r.inputs?r.inputs.map(Gr.from):[],!!r.payable,r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[zn]===t9}}class Ia extends Qu{constructor(r,n,i){super(r,"fallback",n);ae(this,"payable");Object.defineProperty(this,zn,{value:r9}),Je(this,{payable:i})}format(r){const n=this.inputs.length===0?"receive":"fallback";if(r==="json"){const i=this.payable?"payable":"nonpayable";return JSON.stringify({type:n,stateMutability:i})}return`${n}()${this.payable?" payable":""}`}static from(r){if(Ia.isFragment(r))return r;if(typeof r=="string")try{return Ia.from(zc(r))}catch{he(!1,"invalid fallback fragment","obj",r)}else if(r instanceof Ts){const n=r.toString(),i=r.peekKeyword(En(["fallback","receive"]));if(he(i,"type must be fallback or receive","obj",n),r.popKeyword(En(["fallback","receive"]))==="receive"){const c=io(r);return he(c.length===0,"receive cannot have arguments","obj.inputs",c),yo(r,En(["payable"])),Xu(r),new Ia(Xt,[],!0)}let a=io(r);a.length?he(a.length===1&&a[0].type==="bytes","invalid fallback inputs","obj.inputs",a.map(c=>c.format("minimal")).join(", ")):a=[Gr.from("bytes")];const o=zT(r);if(he(o==="nonpayable"||o==="payable","fallback cannot be constants","obj.stateMutability",o),yo(r,En(["returns"])).has("returns")){const c=io(r);he(c.length===1&&c[0].type==="bytes","invalid fallback outputs","obj.outputs",c.map(u=>u.format("minimal")).join(", "))}return Xu(r),new Ia(Xt,a,o==="payable")}if(r.type==="receive")return new Ia(Xt,[],!0);if(r.type==="fallback"){const n=[Gr.from("bytes")],i=r.stateMutability==="payable";return new Ia(Xt,n,i)}he(!1,"invalid fallback description","obj",r)}static isFragment(r){return r&&r[zn]===r9}}class ta extends ly{constructor(r,n,i,s,a,o){super(r,"function",n,s);ae(this,"constant");ae(this,"outputs");ae(this,"stateMutability");ae(this,"payable");ae(this,"gas");Object.defineProperty(this,zn,{value:n9}),a=Object.freeze(a.slice()),Je(this,{constant:i==="view"||i==="pure",gas:o,outputs:a,payable:i==="payable",stateMutability:i})}get selector(){return Ju(this.format("sighash")).substring(0,10)}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(r))),outputs:this.outputs.map(i=>JSON.parse(i.format(r)))});const n=[];return r!=="sighash"&&n.push("function"),n.push(this.name+rp(r,this.inputs)),r!=="sighash"&&(this.stateMutability!=="nonpayable"&&n.push(this.stateMutability),this.outputs&&this.outputs.length&&(n.push("returns"),n.push(rp(r,this.outputs))),this.gas!=null&&n.push(`@${this.gas.toString()}`)),n.join(" ")}static getSelector(r,n){return n=(n||[]).map(s=>Gr.from(s)),new ta(Xt,r,"view",n,[],null).selector}static from(r){if(ta.isFragment(r))return r;if(typeof r=="string")try{return ta.from(zc(r))}catch{he(!1,"invalid function fragment","obj",r)}else if(r instanceof Ts){const i=uy("function",r),s=io(r),a=zT(r);let o=[];yo(r,En(["returns"])).has("returns")&&(o=io(r));const c=VT(r);return Xu(r),new ta(Xt,i,a,s,o,c)}let n=r.stateMutability;return n==null&&(n="payable",typeof r.constant=="boolean"?(n="view",r.constant||(n="payable",typeof r.payable=="boolean"&&!r.payable&&(n="nonpayable"))):typeof r.payable=="boolean"&&!r.payable&&(n="nonpayable")),new ta(Xt,r.name,n,r.inputs?r.inputs.map(Gr.from):[],r.outputs?r.outputs.map(Gr.from):[],r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[zn]===n9}}class Ru extends ly{constructor(e,r,n){super(e,"struct",r,n),Object.defineProperty(this,zn,{value:i9})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return Ru.from(zc(e))}catch{he(!1,"invalid struct fragment","obj",e)}else if(e instanceof Ts){const r=uy("struct",e),n=io(e);return Xu(e),new Ru(Xt,r,n)}return new Ru(Xt,e.name,e.inputs?e.inputs.map(Gr.from):[])}static isFragment(e){return e&&e[zn]===i9}}const Ds=new Map;Ds.set(0,"GENERIC_PANIC");Ds.set(1,"ASSERT_FALSE");Ds.set(17,"OVERFLOW");Ds.set(18,"DIVIDE_BY_ZERO");Ds.set(33,"ENUM_RANGE_ERROR");Ds.set(34,"BAD_STORAGE_DATA");Ds.set(49,"STACK_UNDERFLOW");Ds.set(50,"ARRAY_RANGE_ERROR");Ds.set(65,"OUT_OF_MEMORY");Ds.set(81,"UNINITIALIZED_FUNCTION_CALL");const Pie=new RegExp(/^bytes([0-9]*)$/),Nie=new RegExp(/^(u?int)([0-9]*)$/);let $x=null;function Oie(t,e,r,n){let i="missing revert data",s=null;const a=null;let o=null;if(r){i="execution reverted";const u=Et(r);if(r=qe(r),u.length===0)i+=" (no data present; likely require(false) occurred",s="require(false)";else if(u.length%32!==4)i+=" (could not decode reason; invalid data length)";else if(qe(u.slice(0,4))==="0x08c379a0")try{s=n.decode(["string"],u.slice(4))[0],o={signature:"Error(string)",name:"Error",args:[s]},i+=`: ${JSON.stringify(s)}`}catch{i+=" (could not decode reason; invalid string data)"}else if(qe(u.slice(0,4))==="0x4e487b71")try{const l=Number(n.decode(["uint256"],u.slice(4))[0]);o={signature:"Panic(uint256)",name:"Panic",args:[l]},s=`Panic due to ${Ds.get(l)||"UNKNOWN"}(${l})`,i+=`: ${s}`}catch{i+=" (could not decode panic code)"}else i+=" (unknown custom error)"}const c={to:e.to?xt(e.to):null,data:e.data||"0x"};return e.from&&(c.from=xt(e.from)),Er(i,"CALL_EXCEPTION",{action:t,data:r,reason:s,transaction:c,invocation:a,revert:o})}var Jo,Pl;const Gm=class Gm{constructor(){ce(this,Jo)}getDefaultValue(e){const r=e.map(i=>ye(this,Jo,Pl).call(this,Gr.from(i)));return new N1(r,"_").defaultValue()}encode(e,r){_F(r.length,e.length,"types/values length mismatch");const n=e.map(a=>ye(this,Jo,Pl).call(this,Gr.from(a))),i=new N1(n,"_"),s=new qw;return i.encode(s,r),s.data}decode(e,r,n){const i=e.map(a=>ye(this,Jo,Pl).call(this,Gr.from(a)));return new N1(i,"_").decode(new Kw(r,n))}static defaultAbiCoder(){return $x==null&&($x=new Gm),$x}static getBuiltinCallException(e,r,n){return Oie(e,r,n,Gm.defaultAbiCoder())}};Jo=new WeakSet,Pl=function(e){if(e.isArray())return new une(ye(this,Jo,Pl).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new N1(e.components.map(n=>ye(this,Jo,Pl).call(this,n)),e.name);switch(e.baseType){case"address":return new one(e.name);case"bool":return new lne(e.name);case"string":return new xne(e.name);case"bytes":return new fne(e.name);case"":return new pne(e.name)}let r=e.type.match(Nie);if(r){let n=parseInt(r[2]||"256");return he(n!==0&&n<=256&&n%8===0,"invalid "+r[1]+" bit length","param",e),new yne(n/8,r[1]==="int",e.name)}if(r=e.type.match(Pie),r){let n=parseInt(r[1]);return he(n!==0&&n<=32,"invalid bytes length","param",e),new hne(n,e.name)}he(!1,"invalid type","type",e.type)};let np=Gm;class Die{constructor(e,r,n){ae(this,"fragment");ae(this,"name");ae(this,"signature");ae(this,"topic");ae(this,"args");const i=e.name,s=e.format();Je(this,{fragment:e,name:i,signature:s,topic:r,args:n})}}class Rie{constructor(e,r,n,i){ae(this,"fragment");ae(this,"name");ae(this,"args");ae(this,"signature");ae(this,"selector");ae(this,"value");const s=e.name,a=e.format();Je(this,{fragment:e,name:s,args:n,signature:a,selector:r,value:i})}}class Mie{constructor(e,r,n){ae(this,"fragment");ae(this,"name");ae(this,"args");ae(this,"signature");ae(this,"selector");const i=e.name,s=e.format();Je(this,{fragment:e,name:i,args:n,signature:s,selector:r})}}class s9{constructor(e){ae(this,"hash");ae(this,"_isIndexed");Je(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const a9={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},o9={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:t=>`reverted with reason string ${JSON.stringify(t)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:t=>{let e="unknown panic code";return t>=0&&t<=255&&a9[t.toString()]&&(e=a9[t.toString()]),`reverted with panic code 0x${t.toString(16)} (${e})`}}};var Vs,qs,Ks,tn,Kf,bg,Wf,wg;const ef=class ef{constructor(e){ce(this,Kf);ce(this,Wf);ae(this,"fragments");ae(this,"deploy");ae(this,"fallback");ae(this,"receive");ce(this,Vs,void 0);ce(this,qs,void 0);ce(this,Ks,void 0);ce(this,tn,void 0);let r=[];typeof e=="string"?r=JSON.parse(e):r=e,Q(this,Ks,new Map),Q(this,Vs,new Map),Q(this,qs,new Map);const n=[];for(const a of r)try{n.push(Qu.from(a))}catch(o){console.log("EE",o)}Je(this,{fragments:Object.freeze(n)});let i=null,s=!1;Q(this,tn,this.getAbiCoder()),this.fragments.forEach((a,o)=>{let c;switch(a.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}Je(this,{deploy:a});return;case"fallback":a.inputs.length===0?s=!0:(he(!i||a.payable!==i.payable,"conflicting fallback fragments",`fragments[${o}]`,a),i=a,s=i.payable);return;case"function":c=U(this,Ks);break;case"event":c=U(this,qs);break;case"error":c=U(this,Vs);break;default:return}const u=a.format();c.has(u)||c.set(u,a)}),this.deploy||Je(this,{deploy:Qa.from("constructor()")}),Je(this,{fallback:i,receive:s})}format(e){const r=e?"minimal":"full";return this.fragments.map(i=>i.format(r))}formatJson(){const e=this.fragments.map(r=>r.format("json"));return JSON.stringify(e.map(r=>JSON.parse(r)))}getAbiCoder(){return np.defaultAbiCoder()}getFunctionName(e){const r=ye(this,Kf,bg).call(this,e,null,!1);return he(r,"no matching function","key",e),r.name}hasFunction(e){return!!ye(this,Kf,bg).call(this,e,null,!1)}getFunction(e,r){return ye(this,Kf,bg).call(this,e,r||null,!0)}forEachFunction(e){const r=Array.from(U(this,Ks).keys());r.sort((n,i)=>n.localeCompare(i));for(let n=0;nn.localeCompare(i));for(let n=0;n1){const s=i.map(a=>JSON.stringify(a.format())).join(", ");he(!1,`ambiguous error description (i.e. ${s})`,"name",e)}return i[0]}if(e=Pn.from(e).format(),e==="Error(string)")return Pn.from("error Error(string)");if(e==="Panic(uint256)")return Pn.from("error Panic(uint256)");const n=U(this,Vs).get(e);return n||null}forEachError(e){const r=Array.from(U(this,Vs).keys());r.sort((n,i)=>n.localeCompare(i));for(let n=0;ns.type==="string"?Ju(a):s.type==="bytes"?Qt(qe(a)):(s.type==="bool"&&typeof a=="boolean"?a=a?"0x01":"0x00":s.type.match(/^u?int/)?a=Tc(a):s.type.match(/^bytes/)?a=kte(a,32):s.type==="address"&&U(this,tn).encode(["address"],[a]),Zu(qe(a),32));for(r.forEach((s,a)=>{const o=e.inputs[a];if(!o.indexed){he(s==null,"cannot filter non-indexed parameters; must be null","contract."+o.name,s);return}s==null?n.push(null):o.baseType==="array"||o.baseType==="tuple"?he(!1,"filtering with tuples or arrays not supported","contract."+o.name,s):Array.isArray(s)?n.push(s.map(c=>i(o,c))):n.push(i(o,s))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){if(typeof e=="string"){const a=this.getEvent(e);he(a,"unknown event","eventFragment",e),e=a}const n=[],i=[],s=[];return e.anonymous||n.push(e.topicHash),he(r.length===e.inputs.length,"event arguments/values mismatch","values",r),e.inputs.forEach((a,o)=>{const c=r[o];if(a.indexed)if(a.type==="string")n.push(Ju(c));else if(a.type==="bytes")n.push(Qt(c));else{if(a.baseType==="tuple"||a.baseType==="array")throw new Error("not implemented");n.push(U(this,tn).encode([a.type],[c]))}else i.push(a),s.push(c)}),{data:U(this,tn).encode(i,s),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"){const p=this.getEvent(e);he(p,"unknown event","eventFragment",e),e=p}if(n!=null&&!e.anonymous){const p=e.topicHash;he(Yt(n[0],32)&&n[0].toLowerCase()===p,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}const i=[],s=[],a=[];e.inputs.forEach((p,d)=>{p.indexed?p.type==="string"||p.type==="bytes"||p.baseType==="tuple"||p.baseType==="array"?(i.push(Gr.from({type:"bytes32",name:p.name})),a.push(!0)):(i.push(p),a.push(!1)):(s.push(p),a.push(!1))});const o=n!=null?U(this,tn).decode(i,_r(n)):null,c=U(this,tn).decode(s,r,!0),u=[],l=[];let h=0,f=0;return e.inputs.forEach((p,d)=>{let g=null;if(p.indexed)if(o==null)g=new s9(null);else if(a[d])g=new s9(o[f++]);else try{g=o[f++]}catch(y){g=y}else try{g=c[h++]}catch(y){g=y}u.push(g),l.push(p.name||null)}),Im.fromItems(u,l)}parseTransaction(e){const r=Et(e.data,"tx.data"),n=Ke(e.value!=null?e.value:0,"tx.value"),i=this.getFunction(qe(r.slice(0,4)));if(!i)return null;const s=U(this,tn).decode(i.inputs,r.slice(4));return new Rie(i,i.selector,s,n)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new Die(r,r.topicHash,this.decodeEventLog(r,e.data,e.topics))}parseError(e){const r=qe(e),n=this.getError(sr(r,0,4));if(!n)return null;const i=U(this,tn).decode(n.inputs,sr(r,4));return new Mie(n,n.selector,i)}static from(e){return e instanceof ef?e:typeof e=="string"?new ef(JSON.parse(e)):typeof e.format=="function"?new ef(e.format("json")):new ef(e)}};Vs=new WeakMap,qs=new WeakMap,Ks=new WeakMap,tn=new WeakMap,Kf=new WeakSet,bg=function(e,r,n){if(Yt(e)){const s=e.toLowerCase();for(const a of U(this,Ks).values())if(s===a.selector)return a;return null}if(e.indexOf("(")===-1){const s=[];for(const[a,o]of U(this,Ks))a.split("(")[0]===e&&s.push(o);if(r){const a=r.length>0?r[r.length-1]:null;let o=r.length,c=!0;un.isTyped(a)&&a.type==="overrides"&&(c=!1,o--);for(let u=s.length-1;u>=0;u--){const l=s[u].inputs.length;l!==o&&(!c||l!==o-1)&&s.splice(u,1)}for(let u=s.length-1;u>=0;u--){const l=s[u].inputs;for(let h=0;h=l.length){if(r[h].type==="overrides")continue;s.splice(u,1);break}if(r[h].type!==l[h].baseType){s.splice(u,1);break}}}}if(s.length===1&&r&&r.length!==s[0].inputs.length){const a=r[r.length-1];(a==null||Array.isArray(a)||typeof a!="object")&&s.splice(0,1)}if(s.length===0)return null;if(s.length>1&&n){const a=s.map(o=>JSON.stringify(o.format())).join(", ");he(!1,`ambiguous function description (i.e. matches ${a})`,"key",e)}return s[0]}const i=U(this,Ks).get(ta.from(e).format());return i||null},Wf=new WeakSet,wg=function(e,r,n){if(Yt(e)){const s=e.toLowerCase();for(const a of U(this,qs).values())if(s===a.topicHash)return a;return null}if(e.indexOf("(")===-1){const s=[];for(const[a,o]of U(this,qs))a.split("(")[0]===e&&s.push(o);if(r){for(let a=s.length-1;a>=0;a--)s[a].inputs.length=0;a--){const o=s[a].inputs;for(let c=0;c1&&n){const a=s.map(o=>JSON.stringify(o.format())).join(", ");he(!1,`ambiguous event description (i.e. matches ${a})`,"key",e)}return s[0]}const i=U(this,qs).get(ea.from(e).format());return i||null};let s4=ef;const qT=BigInt(0);function ad(t){return t??null}function on(t){return t==null?null:t.toString()}class c9{constructor(e,r,n){ae(this,"gasPrice");ae(this,"maxFeePerGas");ae(this,"maxPriorityFeePerGas");Je(this,{gasPrice:ad(e),maxFeePerGas:ad(r),maxPriorityFeePerGas:ad(n)})}toJSON(){const{gasPrice:e,maxFeePerGas:r,maxPriorityFeePerGas:n}=this;return{_type:"FeeData",gasPrice:on(e),maxFeePerGas:on(r),maxPriorityFeePerGas:on(n)}}}function Mm(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=qe(t.data));const r="chainId,gasLimit,gasPrice,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const i of r)!(i in t)||t[i]==null||(e[i]=Ke(t[i],`request.${i}`));const n="type,nonce".split(/,/);for(const i of n)!(i in t)||t[i]==null||(e[i]=at(t[i],`request.${i}`));return t.accessList&&(e.accessList=dl(t.accessList)),"blockTag"in t&&(e.blockTag=t.blockTag),"enableCcipRead"in t&&(e.enableCcipRead=!!t.enableCcipRead),"customData"in t&&(e.customData=t.customData),e}var La;class Lie{constructor(e,r){ae(this,"provider");ae(this,"number");ae(this,"hash");ae(this,"timestamp");ae(this,"parentHash");ae(this,"nonce");ae(this,"difficulty");ae(this,"gasLimit");ae(this,"gasUsed");ae(this,"miner");ae(this,"extraData");ae(this,"baseFeePerGas");ce(this,La,void 0);Q(this,La,e.transactions.map(n=>typeof n!="string"?new ip(n,r):n)),Je(this,{provider:r,hash:ad(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,miner:e.miner,extraData:e.extraData,baseFeePerGas:ad(e.baseFeePerGas)})}get transactions(){return U(this,La).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=U(this,La).slice();return e.length===0?[]:(Te(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:r,extraData:n,gasLimit:i,gasUsed:s,hash:a,miner:o,nonce:c,number:u,parentHash:l,timestamp:h,transactions:f}=this;return{_type:"Block",baseFeePerGas:on(e),difficulty:on(r),extraData:n,gasLimit:on(i),gasUsed:on(s),hash:a,miner:o,nonce:c,number:u,parentHash:l,timestamp:h,transactions:f}}[Symbol.iterator](){let e=0;const r=this.transactions;return{next:()=>enew Kp(i,r))));let n=qT;e.effectiveGasPrice!=null?n=e.effectiveGasPrice:e.gasPrice!=null&&(n=e.gasPrice),Je(this,{provider:r,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,gasPrice:n,type:e.type,status:e.status,root:e.root})}get logs(){return U(this,yp)}toJSON(){const{to:e,from:r,contractAddress:n,hash:i,index:s,blockHash:a,blockNumber:o,logsBloom:c,logs:u,status:l,root:h}=this;return{_type:"TransactionReceipt",blockHash:a,blockNumber:o,contractAddress:n,cumulativeGasUsed:on(this.cumulativeGasUsed),from:r,gasPrice:on(this.gasPrice),gasUsed:on(this.gasUsed),hash:i,index:s,logs:u,logsBloom:c,root:h,status:l,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e{if(o)return null;const{blockNumber:f,nonce:p}=await mn({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(p{if(f==null||f.status!==0)return f;Te(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:f.to,from:f.from,data:""},receipt:f})},l=await this.provider.getTransactionReceipt(this.hash);if(n===0)return u(l);if(l){if(await l.confirmations()>=n)return u(l)}else if(await c(),n===0)return null;return await new Promise((f,p)=>{const d=[],g=()=>{d.forEach(x=>x())};if(d.push(()=>{o=!0}),i>0){const x=setTimeout(()=>{g(),p(Er("wait for transaction timeout","TIMEOUT"))},i);d.push(()=>{clearTimeout(x)})}const y=async x=>{if(await x.confirmations()>=n){g();try{f(u(x))}catch(b){p(b)}}};if(d.push(()=>{this.provider.off(this.hash,y)}),this.provider.on(this.hash,y),s>=0){const x=async()=>{try{await c()}catch(b){if(Li(b,"TRANSACTION_REPLACED")){g(),p(b);return}}o||this.provider.once("block",x)};d.push(()=>{this.provider.off("block",x)}),this.provider.once("block",x)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}removedEvent(){return Te(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),GT(this)}reorderedEvent(e){return Te(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),Te(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),WT(this,e)}replaceableTransaction(e){he(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const r=new v5(this,this.provider);return Q(r,Xo,e),r}};Xo=new WeakMap;let ip=v5;function jie(t){return{orphan:"drop-block",hash:t.hash,number:t.number}}function WT(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function GT(t){return{orphan:"drop-transaction",tx:t}}function Uie(t){return{orphan:"drop-log",log:{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,address:t.address,data:t.data,topics:Object.freeze(t.topics.slice()),index:t.index}}}class e5 extends Kp{constructor(r,n,i){super(r,r.provider);ae(this,"interface");ae(this,"fragment");ae(this,"args");const s=n.decodeEventLog(i,r.data,r.topics);Je(this,{args:s,fragment:i,interface:n})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class ZT extends Kp{constructor(r,n){super(r,r.provider);ae(this,"error");Je(this,{error:n})}}var Gf;class $ie extends KT{constructor(r,n,i){super(i,n);ce(this,Gf,void 0);Q(this,Gf,r)}get logs(){return super.logs.map(r=>{const n=r.topics.length?U(this,Gf).getEvent(r.topics[0]):null;if(n)try{return new e5(r,U(this,Gf),n)}catch(i){return new ZT(r,i)}return r})}}Gf=new WeakMap;var xp;class t5 extends ip{constructor(r,n,i){super(i,n);ce(this,xp,void 0);Q(this,xp,r)}async wait(r){const n=await super.wait(r);return n==null?null:new $ie(U(this,xp),this.provider,n)}}xp=new WeakMap;class JT extends FF{constructor(r,n,i,s){super(r,n,i);ae(this,"log");Je(this,{log:s})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class Hie extends JT{constructor(e,r,n,i,s){super(e,r,n,new e5(s,e.interface,i));const a=e.interface.decodeEventLog(i,this.log.data,this.log.topics);Je(this,{args:a,fragment:i})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const u9=BigInt(0);function XT(t){return t&&typeof t.call=="function"}function QT(t){return t&&typeof t.estimateGas=="function"}function fy(t){return t&&typeof t.resolveName=="function"}function YT(t){return t&&typeof t.sendTransaction=="function"}function eP(t){if(t!=null){if(fy(t))return t;if(t.provider)return t.provider}}var bp;class zie{constructor(e,r,n){ce(this,bp,void 0);ae(this,"fragment");if(Je(this,{fragment:r}),r.inputs.lengthn[c]==null?null:o.walkAsync(n[c],(l,h)=>l==="address"?Array.isArray(h)?Promise.all(h.map(f=>wn(f,s))):wn(h,s):h)));return e.interface.encodeFilterTopics(r,a)}())}getTopicFilter(){return U(this,bp)}}bp=new WeakMap;function Yu(t,e){return t==null?null:typeof t[e]=="function"?t:t.provider&&typeof t.provider[e]=="function"?t.provider:null}function su(t){return t==null?null:t.provider||null}async function tP(t,e){const r=un.dereference(t,"overrides");he(typeof r=="object","invalid overrides parameter","overrides",t);const n=Mm(r);return he(n.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",n.to),he(n.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",n.data),n.from&&(n.from=n.from),n}async function Vie(t,e,r){const n=Yu(t,"resolveName"),i=fy(n)?n:null;return await Promise.all(e.map((s,a)=>s.walkAsync(r[a],(o,c)=>(c=un.dereference(c,o),o==="address"?wn(c,i):c))))}function qie(t){const e=async function(a){const o=await tP(a,["data"]);o.to=await t.getAddress(),o.from&&(o.from=await wn(o.from,eP(t.runner)));const c=t.interface,u=Ke(o.value||u9,"overrides.value")===u9,l=(o.data||"0x")==="0x";c.fallback&&!c.fallback.payable&&c.receive&&!l&&!u&&he(!1,"cannot send data to receive or send value to non-payable fallback","overrides",a),he(c.fallback||l,"cannot send data to receive-only contract","overrides.data",o.data);const h=c.receive||c.fallback&&c.fallback.payable;return he(h||u,"cannot send value to non-payable fallback","overrides.value",o.value),he(c.fallback||l,"cannot send data to receive-only contract","overrides.data",o.data),o},r=async function(a){const o=Yu(t.runner,"call");Te(XT(o),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const c=await e(a);try{return await o.call(c)}catch(u){throw L8(u)&&u.data?t.interface.makeError(u.data,c):u}},n=async function(a){const o=t.runner;Te(YT(o),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const c=await o.sendTransaction(await e(a)),u=su(t.runner);return new t5(t.interface,u,c)},i=async function(a){const o=Yu(t.runner,"estimateGas");return Te(QT(o),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await o.estimateGas(await e(a))},s=async a=>await n(a);return Je(s,{_contract:t,estimateGas:i,populateTransaction:e,send:n,staticCall:r}),s}function Kie(t,e){const r=function(...u){const l=t.interface.getFunction(e,u);return Te(l,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:u}}),l},n=async function(...u){const l=r(...u);let h={};if(l.inputs.length+1===u.length&&(h=await tP(u.pop()),h.from&&(h.from=await wn(h.from,eP(t.runner)))),l.inputs.length!==u.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const f=await Vie(t.runner,l.inputs,u);return Object.assign({},h,await mn({to:t.getAddress(),data:t.interface.encodeFunctionData(l,f)}))},i=async function(...u){const l=await o(...u);return l.length===1?l[0]:l},s=async function(...u){const l=t.runner;Te(YT(l),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const h=await l.sendTransaction(await n(...u)),f=su(t.runner);return new t5(t.interface,f,h)},a=async function(...u){const l=Yu(t.runner,"estimateGas");return Te(QT(l),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await l.estimateGas(await n(...u))},o=async function(...u){const l=Yu(t.runner,"call");Te(XT(l),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const h=await n(...u);let f="0x";try{f=await l.call(h)}catch(d){throw L8(d)&&d.data?t.interface.makeError(d.data,h):d}const p=r(...u);return t.interface.decodeFunctionResult(p,f)},c=async(...u)=>r(...u).constant?await i(...u):await s(...u);return Je(c,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:r,estimateGas:a,populateTransaction:n,send:s,staticCall:i,staticCallResult:o}),Object.defineProperty(c,"fragment",{configurable:!1,enumerable:!0,get:()=>{const u=t.interface.getFunction(e);return Te(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),u}}),c}function Wie(t,e){const r=function(...i){const s=t.interface.getEvent(e,i);return Te(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:i}}),s},n=function(...i){return new zie(t,r(...i),i)};return Je(n,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:r}),Object.defineProperty(n,"fragment",{configurable:!1,enumerable:!0,get:()=>{const i=t.interface.getEvent(e);return Te(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),i}}),n}const Lm=Symbol.for("_ethersInternal_contract"),rP=new WeakMap;function Gie(t,e){rP.set(t[Lm],e)}function qn(t){return rP.get(t[Lm])}function Zie(t){return t&&typeof t=="object"&&"getTopicFilter"in t&&typeof t.getTopicFilter=="function"&&t.fragment}async function r5(t,e){let r,n=null;if(Array.isArray(e)){const s=function(a){if(Yt(a,32))return a;const o=t.interface.getEvent(a);return he(o,"unknown fragment","name",a),o.topicHash};r=e.map(a=>a==null?null:Array.isArray(a)?a.map(s):s(a))}else e==="*"?r=[null]:typeof e=="string"?Yt(e,32)?r=[e]:(n=t.interface.getEvent(e),he(n,"unknown fragment","event",e),r=[n.topicHash]):Zie(e)?r=await e.getTopicFilter():"fragment"in e?(n=e.fragment,r=[n.topicHash]):he(!1,"unknown event name","event",e);r=r.map(s=>{if(s==null)return null;if(Array.isArray(s)){const a=Array.from(new Set(s.map(o=>o.toLowerCase())).values());return a.length===1?a[0]:(a.sort(),a)}return s.toLowerCase()});const i=r.map(s=>s==null?"null":Array.isArray(s)?s.join("|"):s).join("&");return{fragment:n,tag:i,topics:r}}async function H0(t,e){const{subs:r}=qn(t);return r.get((await r5(t,e)).tag)||null}async function l9(t,e,r){const n=su(t.runner);Te(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:i,tag:s,topics:a}=await r5(t,r),{addr:o,subs:c}=qn(t);let u=c.get(s);if(!u){const h={address:o||t,topics:a},f=y=>{let x=i;if(x==null)try{x=t.interface.getEvent(y.topics[0])}catch{}if(x){const b=x,S=i?t.interface.decodeEventLog(i,y.data,y.topics):[];o4(t,r,S,k=>new Hie(t,k,r,b,y))}else o4(t,r,[],b=>new JT(t,b,r,y))};let p=[];u={tag:s,listeners:[],start:()=>{p.length||p.push(n.on(h,f))},stop:async()=>{if(p.length==0)return;let y=p;p=[],await Promise.all(y),n.off(h,f)}},c.set(s,u)}return u}let a4=Promise.resolve();async function Jie(t,e,r,n){await a4;const i=await H0(t,e);if(!i)return!1;const s=i.listeners.length;return i.listeners=i.listeners.filter(({listener:a,once:o})=>{const c=Array.from(r);n&&c.push(n(o?null:a));try{a.call(t,...c)}catch{}return!o}),i.listeners.length===0&&(i.stop(),qn(t).subs.delete(i.tag)),s>0}async function o4(t,e,r,n){try{await a4}catch{}const i=Jie(t,e,r,n);return a4=i,await i}const O1=["then"];var fue;const ld=class ld{constructor(e,r,n,i){ae(this,"target");ae(this,"interface");ae(this,"runner");ae(this,"filters");ae(this,fue);ae(this,"fallback");he(typeof e=="string"||iT(e),"invalid value for Contract target","target",e),n==null&&(n=null);const s=s4.from(r);Je(this,{target:e,runner:n,interface:s}),Object.defineProperty(this,Lm,{value:{}});let a,o=null,c=null;if(i){const h=su(n);c=new t5(this.interface,h,i)}let u=new Map;if(typeof e=="string")if(Yt(e))o=e,a=Promise.resolve(e);else{const h=Yu(n,"resolveName");if(!fy(h))throw Er("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});a=h.resolveName(e).then(f=>{if(f==null)throw Er("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return qn(this).addr=f,f})}else a=e.getAddress().then(h=>{if(h==null)throw new Error("TODO");return qn(this).addr=h,h});Gie(this,{addrPromise:a,addr:o,deployTx:c,subs:u});const l=new Proxy({},{get:(h,f,p)=>{if(typeof f=="symbol"||O1.indexOf(f)>=0)return Reflect.get(h,f,p);try{return this.getEvent(f)}catch(d){if(!Li(d,"INVALID_ARGUMENT")||d.argument!=="key")throw d}},has:(h,f)=>O1.indexOf(f)>=0?Reflect.has(h,f):Reflect.has(h,f)||this.interface.hasEvent(String(f))});return Je(this,{filters:l}),Je(this,{fallback:s.receive||s.fallback?qie(this):null}),new Proxy(this,{get:(h,f,p)=>{if(typeof f=="symbol"||f in h||O1.indexOf(f)>=0)return Reflect.get(h,f,p);try{return h.getFunction(f)}catch(d){if(!Li(d,"INVALID_ARGUMENT")||d.argument!=="key")throw d}},has:(h,f)=>typeof f=="symbol"||f in h||O1.indexOf(f)>=0?Reflect.has(h,f):h.interface.hasFunction(f)})}connect(e){return new ld(this.target,this.interface,e)}attach(e){return new ld(e,this.interface,this.runner)}async getAddress(){return await qn(this).addrPromise}async getDeployedCode(){const e=su(this.runner);Te(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const r=await e.getCode(await this.getAddress());return r==="0x"?null:r}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const n=su(this.runner);return Te(n!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((i,s)=>{const a=async()=>{try{if(await this.getDeployedCode()!=null)return i(this);n.once("block",a)}catch(o){s(o)}};a()})}deploymentTransaction(){return qn(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),Kie(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),Wie(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,r,n){r==null&&(r=0),n==null&&(n="latest");const{addr:i,addrPromise:s}=qn(this),a=i||await s,{fragment:o,topics:c}=await r5(this,e),u={address:a,topics:c,fromBlock:r,toBlock:n},l=su(this.runner);return Te(l,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await l.getLogs(u)).map(h=>{let f=o;if(f==null)try{f=this.interface.getEvent(h.topics[0])}catch{}if(f)try{return new e5(h,this.interface,f)}catch(p){return new ZT(h,p)}return new Kp(h,l)})}async on(e,r){const n=await l9(this,"on",e);return n.listeners.push({listener:r,once:!1}),n.start(),this}async once(e,r){const n=await l9(this,"once",e);return n.listeners.push({listener:r,once:!0}),n.start(),this}async emit(e,...r){return await o4(this,e,r,null)}async listenerCount(e){if(e){const i=await H0(this,e);return i?i.listeners.length:0}const{subs:r}=qn(this);let n=0;for(const{listeners:i}of r.values())n+=i.length;return n}async listeners(e){if(e){const i=await H0(this,e);return i?i.listeners.map(({listener:s})=>s):[]}const{subs:r}=qn(this);let n=[];for(const{listeners:i}of r.values())n=n.concat(i.map(({listener:s})=>s));return n}async off(e,r){const n=await H0(this,e);if(!n)return this;if(r){const i=n.listeners.map(({listener:s})=>s).indexOf(r);i>=0&&n.listeners.splice(i,1)}return(r==null||n.listeners.length===0)&&(n.stop(),qn(this).subs.delete(n.tag)),this}async removeAllListeners(e){if(e){const r=await H0(this,e);if(!r)return this;r.stop(),qn(this).subs.delete(r.tag)}else{const{subs:r}=qn(this);for(const{tag:n,stop:i}of r.values())i(),r.delete(n)}return this}async addListener(e,r){return await this.on(e,r)}async removeListener(e,r){return await this.off(e,r)}static buildClass(e){class r extends ld{constructor(i,s=null){super(i,e,s)}}return r}static from(e,r,n){return n==null&&(n=null),new this(e,r,n)}};fue=Lm;let c4=ld;function Xie(){return c4}class od extends Xie(){}function Hx(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):he(!1,"unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}class Qie{constructor(e){ae(this,"name");Je(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,r){throw new Error("unsupported coin")}async decodeAddress(e,r){throw new Error("unsupported coin")}}const nP=new RegExp("^(ipfs)://(.*)$","i"),f9=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),nP,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];var Qo,xu,Yo,Nl,Zm,iP;const tf=class tf{constructor(e,r,n){ce(this,Yo);ae(this,"provider");ae(this,"address");ae(this,"name");ce(this,Qo,void 0);ce(this,xu,void 0);Je(this,{provider:e,address:r,name:n}),Q(this,Qo,null),Q(this,xu,new od(r,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e))}async supportsWildcard(){return U(this,Qo)==null&&Q(this,Qo,(async()=>{try{return await U(this,xu).supportsInterface("0x9061b923")}catch(e){if(Li(e,"CALL_EXCEPTION"))return!1;throw Q(this,Qo,null),e}})()),await U(this,Qo)}async getAddress(e){if(e==null&&(e=60),e===60)try{const s=await ye(this,Yo,Nl).call(this,"addr(bytes32)");return s==null||s===Xw?null:s}catch(s){if(Li(s,"CALL_EXCEPTION"))return null;throw s}if(e>=0&&e<2147483648){let s=e+2147483648;const a=await ye(this,Yo,Nl).call(this,"addr(bytes32,uint)",[s]);if(Yt(a,20))return xt(a)}let r=null;for(const s of this.provider.plugins)if(s instanceof Qie&&s.supportsCoinType(e)){r=s;break}if(r==null)return null;const n=await ye(this,Yo,Nl).call(this,"addr(bytes32,uint)",[e]);if(n==null||n==="0x")return null;const i=await r.decodeAddress(e,n);if(i!=null)return i;Te(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:n}})}async getText(e){const r=await ye(this,Yo,Nl).call(this,"text(bytes32,string)",[e]);return r==null||r==="0x"?null:r}async getContentHash(){const e=await ye(this,Yo,Nl).call(this,"contenthash(bytes32)");if(e==null||e==="0x")return null;const r=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){const i=r[1]==="e3010170"?"ipfs":"ipns",s=parseInt(r[4],16);if(r[5].length===s*2)return`${i}://${Tte("0x"+r[2])}`}const n=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&n[1].length===64)return`bzz://${n[1]}`;Te(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const r=await this.getText("avatar");if(r==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:r});for(let n=0;n{if(!Array.isArray(e))throw new Error("not an array");return e.map(r=>t(r))}}function Wp(t,e){return r=>{const n={};for(const i in t){let s=i;if(e&&i in e&&!(s in r)){for(const a of e[i])if(a in r){s=a;break}}try{const a=t[i](r[s]);a!==void 0&&(n[i]=a)}catch(a){const o=a instanceof Error?a.message:"not-an-error";Te(!1,`invalid value for value.${i} (${o})`,"BAD_DATA",{value:r})}}return n}}function Yie(t){switch(t){case!0:case"true":return!0;case!1:case"false":return!1}he(!1,`invalid boolean; ${JSON.stringify(t)}`,"value",t)}function zh(t){return he(Yt(t,!0),"invalid data","value",t),t}function ji(t){return he(Yt(t,32),"invalid hash","value",t),t}const ese=Wp({address:xt,blockHash:ji,blockNumber:at,data:zh,index:at,removed:Zt(Yie,!1),topics:n5(ji),transactionHash:ji,transactionIndex:at},{index:["logIndex"]});function tse(t){return ese(t)}const rse=Wp({hash:Zt(ji),parentHash:ji,number:at,timestamp:at,nonce:Zt(zh),difficulty:Ke,gasLimit:Ke,gasUsed:Ke,miner:Zt(xt),extraData:zh,baseFeePerGas:Zt(Ke)});function nse(t){const e=rse(t);return e.transactions=t.transactions.map(r=>typeof r=="string"?r:sP(r)),e}const ise=Wp({transactionIndex:at,blockNumber:at,transactionHash:ji,address:xt,topics:n5(ji),data:zh,index:at,blockHash:ji},{index:["logIndex"]});function sse(t){return ise(t)}const ase=Wp({to:Zt(xt,null),from:Zt(xt,null),contractAddress:Zt(xt,null),index:at,root:Zt(qe),gasUsed:Ke,logsBloom:Zt(zh),blockHash:ji,hash:ji,logs:n5(sse),blockNumber:at,cumulativeGasUsed:Ke,effectiveGasPrice:Zt(Ke),status:Zt(at),type:Zt(at,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function ose(t){return ase(t)}function sP(t){t.to&&Ke(t.to)===h9&&(t.to="0x0000000000000000000000000000000000000000");const e=Wp({hash:ji,type:r=>r==="0x"||r==null?0:at(r),accessList:Zt(dl,null),blockHash:Zt(ji,null),blockNumber:Zt(at,null),transactionIndex:Zt(at,null),from:xt,gasPrice:Zt(Ke),maxPriorityFeePerGas:Zt(Ke),maxFeePerGas:Zt(Ke),gasLimit:Ke,to:Zt(xt,null),value:Ke,nonce:at,data:zh,creates:Zt(xt,null),chainId:Zt(Ke,null)},{data:["input"],gasLimit:["gas"]})(t);if(e.to==null&&e.creates==null&&(e.creates=ane(e)),(t.type===1||t.type===2)&&t.accessList==null&&(e.accessList=[]),t.signature?e.signature=Fs.from(t.signature):e.signature=Fs.from(t),e.chainId==null){const r=e.signature.legacyChainId;r!=null&&(e.chainId=r)}return e.blockHash&&Ke(e.blockHash)===h9&&(e.blockHash=null),e}const cse="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class Gp{constructor(e){ae(this,"name");Je(this,{name:e})}clone(){return new Gp(this.name)}}class hy extends Gp{constructor(r,n){r==null&&(r=0);super(`org.ethers.network.plugins.GasCost#${r||0}`);ae(this,"effectiveBlock");ae(this,"txBase");ae(this,"txCreate");ae(this,"txDataZero");ae(this,"txDataNonzero");ae(this,"txAccessListStorageKey");ae(this,"txAccessListAddress");const i={effectiveBlock:r};function s(a,o){let c=(n||{})[a];c==null&&(c=o),he(typeof c=="number",`invalud value for ${a}`,"costs",n),i[a]=c}s("txBase",21e3),s("txCreate",32e3),s("txDataZero",4),s("txDataNonzero",16),s("txAccessListStorageKey",1900),s("txAccessListAddress",2400),Je(this,i)}clone(){return new hy(this.effectiveBlock,this)}}class dy extends Gp{constructor(r,n){super("org.ethers.plugins.network.Ens");ae(this,"address");ae(this,"targetNetwork");Je(this,{address:r||cse,targetNetwork:n??1})}clone(){return new dy(this.address,this.targetNetwork)}}var wp,Ep;class use extends Gp{constructor(r,n){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");ce(this,wp,void 0);ce(this,Ep,void 0);Q(this,wp,r),Q(this,Ep,n)}get url(){return U(this,wp)}get processFunc(){return U(this,Ep)}clone(){return this}}wp=new WeakMap,Ep=new WeakMap;const zx=new Map;var Zf,Jf,ec;const rf=class rf{constructor(e,r){ce(this,Zf,void 0);ce(this,Jf,void 0);ce(this,ec,void 0);Q(this,Zf,e),Q(this,Jf,Ke(r)),Q(this,ec,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return U(this,Zf)}set name(e){Q(this,Zf,e)}get chainId(){return U(this,Jf)}set chainId(e){Q(this,Jf,Ke(e,"chainId"))}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===Ke(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===Ke(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===Ke(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(U(this,ec).values())}attachPlugin(e){if(U(this,ec).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return U(this,ec).set(e.name,e.clone()),this}getPlugin(e){return U(this,ec).get(e)||null}getPlugins(e){return this.plugins.filter(r=>r.name.split("#")[0]===e)}clone(){const e=new rf(this.name,this.chainId);return this.plugins.forEach(r=>{e.attachPlugin(r.clone())}),e}computeIntrinsicGas(e){const r=this.getPlugin("org.ethers.plugins.network.GasCost")||new hy;let n=r.txBase;if(e.to==null&&(n+=r.txCreate),e.data)for(let i=2;i9){let i=BigInt(n[1].substring(0,9));n[1].substring(9).match(/^0+$/)||i++,n[1]=i.toString()}return BigInt(n[0]+n[1])}function p9(t){return new use(t,async(e,r,n)=>{n.setHeader("User-Agent","ethers");let i;try{const[s,a]=await Promise.all([n.send(),e()]);i=s;const o=i.bodyJson.standard;return{gasPrice:a.gasPrice,maxFeePerGas:d9(o.maxFee,9),maxPriorityFeePerGas:d9(o.maxPriorityFee,9)}}catch(s){Te(!1,`error encountered with polygon gas station (${JSON.stringify(n.url)})`,"SERVER_ERROR",{request:n,response:i,error:s})}})}let g9=!1;function lse(){if(g9)return;g9=!0;function t(e,r,n){const i=function(){const s=new ia(e,r);return n.ensNetwork!=null&&s.attachPlugin(new dy(null,n.ensNetwork)),s.attachPlugin(new hy),(n.plugins||[]).forEach(a=>{s.attachPlugin(a)}),s};ia.register(e,i),ia.register(r,i),n.altNames&&n.altNames.forEach(s=>{ia.register(s,i)})}t("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),t("ropsten",3,{ensNetwork:3}),t("rinkeby",4,{ensNetwork:4}),t("goerli",5,{ensNetwork:5}),t("kovan",42,{ensNetwork:42}),t("sepolia",11155111,{ensNetwork:11155111}),t("classic",61,{}),t("classicKotti",6,{}),t("arbitrum",42161,{ensNetwork:1}),t("arbitrum-goerli",421613,{}),t("base",8453,{ensNetwork:1}),t("base-goerli",84531,{}),t("base-sepolia",84532,{}),t("bnb",56,{ensNetwork:1}),t("bnbt",97,{}),t("linea",59144,{ensNetwork:1}),t("linea-goerli",59140,{}),t("matic",137,{ensNetwork:1,plugins:[p9("https://gasstation.polygon.technology/v2")]}),t("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[p9("https://gasstation-testnet.polygon.technology/v2")]}),t("optimism",10,{ensNetwork:1,plugins:[]}),t("optimism-goerli",420,{}),t("xdai",100,{ensNetwork:1})}function u4(t){return JSON.parse(JSON.stringify(t))}var ja,Ei,tc,Ws,Xf,Eg;class fse{constructor(e){ce(this,Xf);ce(this,ja,void 0);ce(this,Ei,void 0);ce(this,tc,void 0);ce(this,Ws,void 0);Q(this,ja,e),Q(this,Ei,null),Q(this,tc,4e3),Q(this,Ws,-2)}get pollingInterval(){return U(this,tc)}set pollingInterval(e){Q(this,tc,e)}start(){U(this,Ei)||(Q(this,Ei,U(this,ja)._setTimeout(ye(this,Xf,Eg).bind(this),U(this,tc))),ye(this,Xf,Eg).call(this))}stop(){U(this,Ei)&&(U(this,ja)._clearTimeout(U(this,Ei)),Q(this,Ei,null))}pause(e){this.stop(),e&&Q(this,Ws,-2)}resume(){this.start()}}ja=new WeakMap,Ei=new WeakMap,tc=new WeakMap,Ws=new WeakMap,Xf=new WeakSet,Eg=async function(){try{const e=await U(this,ja).getBlockNumber();if(U(this,Ws)===-2){Q(this,Ws,e);return}if(e!==U(this,Ws)){for(let r=U(this,Ws)+1;r<=e;r++){if(U(this,Ei)==null)return;await U(this,ja).emit("block",r)}Q(this,Ws,e)}}catch{}U(this,Ei)!=null&&Q(this,Ei,U(this,ja)._setTimeout(ye(this,Xf,Eg).bind(this),U(this,tc)))};var bu,wu,rc;class i5{constructor(e){ce(this,bu,void 0);ce(this,wu,void 0);ce(this,rc,void 0);Q(this,bu,e),Q(this,rc,!1),Q(this,wu,r=>{this._poll(r,U(this,bu))})}async _poll(e,r){throw new Error("sub-classes must override this")}start(){U(this,rc)||(Q(this,rc,!0),U(this,wu).call(this,-2),U(this,bu).on("block",U(this,wu)))}stop(){U(this,rc)&&(Q(this,rc,!1),U(this,bu).off("block",U(this,wu)))}pause(e){this.stop()}resume(){this.start()}}bu=new WeakMap,wu=new WeakMap,rc=new WeakMap;var Qf,Ua;class hse extends i5{constructor(r,n){super(r);ce(this,Qf,void 0);ce(this,Ua,void 0);Q(this,Qf,n),Q(this,Ua,-2)}pause(r){r&&Q(this,Ua,-2),super.pause(r)}async _poll(r,n){const i=await n.getBlock(U(this,Qf));i!=null&&(U(this,Ua)===-2?Q(this,Ua,i.number):i.number>U(this,Ua)&&(n.emit(U(this,Qf),i.number),Q(this,Ua,i.number)))}}Qf=new WeakMap,Ua=new WeakMap;var Jm;class dse extends i5{constructor(r,n){super(r);ce(this,Jm,void 0);Q(this,Jm,u4(n))}async _poll(r,n){throw new Error("@TODO")}}Jm=new WeakMap;var Yf;class pse extends i5{constructor(r,n){super(r);ce(this,Yf,void 0);Q(this,Yf,n)}async _poll(r,n){const i=await n.getTransactionReceipt(U(this,Yf));i&&n.emit(U(this,Yf),i)}}Yf=new WeakMap;var $a,eh,th,nc,Ai,Xm,aP;class s5{constructor(e,r){ce(this,Xm);ce(this,$a,void 0);ce(this,eh,void 0);ce(this,th,void 0);ce(this,nc,void 0);ce(this,Ai,void 0);Q(this,$a,e),Q(this,eh,u4(r)),Q(this,th,ye(this,Xm,aP).bind(this)),Q(this,nc,!1),Q(this,Ai,-2)}start(){U(this,nc)||(Q(this,nc,!0),U(this,Ai)===-2&&U(this,$a).getBlockNumber().then(e=>{Q(this,Ai,e)}),U(this,$a).on("block",U(this,th)))}stop(){U(this,nc)&&(Q(this,nc,!1),U(this,$a).off("block",U(this,th)))}pause(e){this.stop(),e&&Q(this,Ai,-2)}resume(){this.start()}}$a=new WeakMap,eh=new WeakMap,th=new WeakMap,nc=new WeakMap,Ai=new WeakMap,Xm=new WeakSet,aP=async function(e){if(U(this,Ai)===-2)return;const r=u4(U(this,eh));r.fromBlock=U(this,Ai)+1,r.toBlock=e;const n=await U(this,$a).getLogs(r);if(n.length===0){U(this,Ai){if(n==null)return"null";if(typeof n=="bigint")return`bigint:${n.toString()}`;if(typeof n=="string")return n.toLowerCase();if(typeof n=="object"&&!Array.isArray(n)){const i=Object.keys(n);return i.sort(),i.reduce((s,a)=>(s[a]=n[a],s),{})}return n})}class oP{constructor(e){ae(this,"name");Je(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function vse(t){return JSON.parse(JSON.stringify(t))}function l4(t){return t=Array.from(new Set(t).values()),t.sort(),t}async function Vx(t,e){if(t==null)throw new Error("invalid event");if(Array.isArray(t)&&(t={topics:t}),typeof t=="string")switch(t){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:t,tag:t}}if(Yt(t,32)){const r=t.toLowerCase();return{type:"transaction",tag:Ag("tx",{hash:r}),hash:r}}if(t.orphan){const r=t;return{type:"orphan",tag:Ag("orphan",r),filter:vse(r)}}if(t.address||t.topics){const r=t,n={topics:(r.topics||[]).map(i=>i==null?null:Array.isArray(i)?l4(i.map(s=>s.toLowerCase())):i.toLowerCase())};if(r.address){const i=[],s=[],a=o=>{Yt(o)?i.push(o):s.push((async()=>{i.push(await wn(o,e))})())};Array.isArray(r.address)?r.address.forEach(a):a(r.address),s.length&&await Promise.all(s),n.address=l4(i.map(o=>o.toLowerCase()))}return{filter:n,tag:Ag("event",n),type:"event"}}he(!1,"unknown ProviderEvent","event",t)}function qx(){return new Date().getTime()}const yse={cacheTimeout:250,pollingInterval:4e3};var rn,ic,nn,rh,Qn,Eu,sc,Ha,Ap,Si,nh,ih,dn,Vn,Sp,f4,Cp,h4,Au,z0,_p,d4,Su,V0,sh,Sg;class xse{constructor(e,r){ce(this,dn);ce(this,Sp);ce(this,Cp);ce(this,Au);ce(this,_p);ce(this,Su);ce(this,sh);ce(this,rn,void 0);ce(this,ic,void 0);ce(this,nn,void 0);ce(this,rh,void 0);ce(this,Qn,void 0);ce(this,Eu,void 0);ce(this,sc,void 0);ce(this,Ha,void 0);ce(this,Ap,void 0);ce(this,Si,void 0);ce(this,nh,void 0);ce(this,ih,void 0);if(Q(this,ih,Object.assign({},yse,r||{})),e==="any")Q(this,Eu,!0),Q(this,Qn,null);else if(e){const n=ia.from(e);Q(this,Eu,!1),Q(this,Qn,Promise.resolve(n)),setTimeout(()=>{this.emit("network",n,null)},0)}else Q(this,Eu,!1),Q(this,Qn,null);Q(this,Ha,-1),Q(this,sc,new Map),Q(this,rn,new Map),Q(this,ic,new Map),Q(this,nn,null),Q(this,rh,!1),Q(this,Ap,1),Q(this,Si,new Map),Q(this,nh,!1)}get pollingInterval(){return U(this,ih).pollingInterval}get provider(){return this}get plugins(){return Array.from(U(this,ic).values())}attachPlugin(e){if(U(this,ic).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return U(this,ic).set(e.name,e.connect(this)),this}getPlugin(e){return U(this,ic).get(e)||null}get disableCcipRead(){return U(this,nh)}set disableCcipRead(e){Q(this,nh,!!e)}async ccipReadFetch(e,r,n){if(this.disableCcipRead||n.length===0||e.to==null)return null;const i=e.to.toLowerCase(),s=r.toLowerCase(),a=[];for(let o=0;o=500,`response not found during CCIP fetch: ${h}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:c,errorMessage:h}}),a.push(h)}Te(!1,`error encountered during CCIP fetch: ${a.map(o=>JSON.stringify(o)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:n,errorMessages:a}})}_wrapBlock(e,r){return new Lie(nse(e),this)}_wrapLog(e,r){return new Kp(tse(e),this)}_wrapTransactionReceipt(e,r){return new KT(ose(e),this)}_wrapTransactionResponse(e,r){return new ip(sP(e),this)}_detectNetwork(){Te(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){Te(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=at(await ye(this,dn,Vn).call(this,{method:"getBlockNumber"}),"%response");return U(this,Ha)>=0&&Q(this,Ha,e),e}_getAddress(e){return wn(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(Yt(e))return Yt(e,32)?e:Xl(e);if(typeof e=="bigint"&&(e=at(e,"blockTag")),typeof e=="number")return e>=0?Xl(e):U(this,Ha)>=0?Xl(U(this,Ha)+e):this.getBlockNumber().then(r=>Xl(r+e));he(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const r=(e.topics||[]).map(c=>c==null?null:Array.isArray(c)?l4(c.map(u=>u.toLowerCase())):c.toLowerCase()),n="blockHash"in e?e.blockHash:void 0,i=(c,u,l)=>{let h;switch(c.length){case 0:break;case 1:h=c[0];break;default:c.sort(),h=c}if(n&&(u!=null||l!=null))throw new Error("invalid filter");const f={};return h&&(f.address=h),r.length&&(f.topics=r),u&&(f.fromBlock=u),l&&(f.toBlock=l),n&&(f.blockHash=n),f};let s=[];if(e.address)if(Array.isArray(e.address))for(const c of e.address)s.push(this._getAddress(c));else s.push(this._getAddress(e.address));let a;"fromBlock"in e&&(a=this._getBlockTag(e.fromBlock));let o;return"toBlock"in e&&(o=this._getBlockTag(e.toBlock)),s.filter(c=>typeof c!="string").length||a!=null&&typeof a!="string"||o!=null&&typeof o!="string"?Promise.all([Promise.all(s),a,o]).then(c=>i(c[0],c[1],c[2])):i(s,a,o)}_getTransactionRequest(e){const r=Mm(e),n=[];if(["to","from"].forEach(i=>{if(r[i]==null)return;const s=wn(r[i],this);D1(s)?n.push(async function(){r[i]=await s}()):r[i]=s}),r.blockTag!=null){const i=this._getBlockTag(r.blockTag);D1(i)?n.push(async function(){r.blockTag=await i}()):r.blockTag=i}return n.length?async function(){return await Promise.all(n),r}():r}async getNetwork(){if(U(this,Qn)==null){const i=this._detectNetwork().then(s=>(this.emit("network",s,null),s),s=>{throw U(this,Qn)===i&&Q(this,Qn,null),s});return Q(this,Qn,i),(await i).clone()}const e=U(this,Qn),[r,n]=await Promise.all([e,this._detectNetwork()]);return r.chainId!==n.chainId&&(U(this,Eu)?(this.emit("network",n,r),U(this,Qn)===e&&Q(this,Qn,Promise.resolve(n))):Te(!1,`network changed: ${r.chainId} => ${n.chainId} `,"NETWORK_ERROR",{event:"changed"})),r.clone()}async getFeeData(){const e=await this.getNetwork(),r=async()=>{const{_block:i,gasPrice:s,priorityFee:a}=await mn({_block:ye(this,_p,d4).call(this,"latest",!1),gasPrice:(async()=>{try{const l=await ye(this,dn,Vn).call(this,{method:"getGasPrice"});return Ke(l,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const l=await ye(this,dn,Vn).call(this,{method:"getPriorityFee"});return Ke(l,"%response")}catch{}return null})()});let o=null,c=null;const u=this._wrapBlock(i,e);return u&&u.baseFeePerGas&&(c=a??BigInt("1000000000"),o=u.baseFeePerGas*gse+c),new c9(s,o,c)},n=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(n){const i=new Pc(n.url),s=await n.processFunc(r,this,i);return new c9(s.gasPrice,s.maxFeePerGas,s.maxPriorityFeePerGas)}return await r()}async estimateGas(e){let r=this._getTransactionRequest(e);return D1(r)&&(r=await r),Ke(await ye(this,dn,Vn).call(this,{method:"estimateGas",transaction:r}),"%response")}async call(e){const{tx:r,blockTag:n}=await mn({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await ye(this,Cp,h4).call(this,ye(this,Sp,f4).call(this,r,n,e.enableCcipRead?0:-1))}async getBalance(e,r){return Ke(await ye(this,Au,z0).call(this,{method:"getBalance"},e,r),"%response")}async getTransactionCount(e,r){return at(await ye(this,Au,z0).call(this,{method:"getTransactionCount"},e,r),"%response")}async getCode(e,r){return qe(await ye(this,Au,z0).call(this,{method:"getCode"},e,r))}async getStorage(e,r,n){const i=Ke(r,"position");return qe(await ye(this,Au,z0).call(this,{method:"getStorage",position:i},e,n))}async broadcastTransaction(e){const{blockNumber:r,hash:n,network:i}=await mn({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),s=Dm.from(e);if(s.hash!==n)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(s,i).replaceableTransaction(r)}async getBlock(e,r){const{network:n,params:i}=await mn({network:this.getNetwork(),params:ye(this,_p,d4).call(this,e,!!r)});return i==null?null:this._wrapBlock(i,n)}async getTransaction(e){const{network:r,params:n}=await mn({network:this.getNetwork(),params:ye(this,dn,Vn).call(this,{method:"getTransaction",hash:e})});return n==null?null:this._wrapTransactionResponse(n,r)}async getTransactionReceipt(e){const{network:r,params:n}=await mn({network:this.getNetwork(),params:ye(this,dn,Vn).call(this,{method:"getTransactionReceipt",hash:e})});if(n==null)return null;if(n.gasPrice==null&&n.effectiveGasPrice==null){const i=await ye(this,dn,Vn).call(this,{method:"getTransaction",hash:e});if(i==null)throw new Error("report this; could not find tx or effectiveGasPrice");n.effectiveGasPrice=i.gasPrice}return this._wrapTransactionReceipt(n,r)}async getTransactionResult(e){const{result:r}=await mn({network:this.getNetwork(),result:ye(this,dn,Vn).call(this,{method:"getTransactionResult",hash:e})});return r==null?null:qe(r)}async getLogs(e){let r=this._getFilter(e);D1(r)&&(r=await r);const{network:n,params:i}=await mn({network:this.getNetwork(),params:ye(this,dn,Vn).call(this,{method:"getLogs",filter:r})});return i.map(s=>this._wrapLog(s,n))}_getProvider(e){Te(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await jm.fromName(this,e)}async getAvatar(e){const r=await this.getResolver(e);return r?await r.getAvatar():null}async resolveName(e){const r=await this.getResolver(e);return r?await r.getAddress():null}async lookupAddress(e){e=xt(e);const r=n4(e.substring(2).toLowerCase()+".addr.reverse");try{const n=await jm.getEnsAddress(this),s=await new od(n,["function resolver(bytes32) view returns (address)"],this).resolver(r);if(s==null||s===Xw)return null;const o=await new od(s,["function name(bytes32) view returns (string)"],this).name(r);return await this.resolveName(o)!==e?null:o}catch(n){if(Li(n,"BAD_DATA")&&n.value==="0x"||Li(n,"CALL_EXCEPTION"))return null;throw n}return null}async waitForTransaction(e,r,n){const i=r??1;return i===0?this.getTransactionReceipt(e):new Promise(async(s,a)=>{let o=null;const c=async u=>{try{const l=await this.getTransactionReceipt(e);if(l!=null&&u-l.blockNumber+1>=i){s(l),o&&(clearTimeout(o),o=null);return}}catch(l){console.log("EEE",l)}this.once("block",c)};n!=null&&(o=setTimeout(()=>{o!=null&&(o=null,this.off("block",c),a(Er("timeout","TIMEOUT",{reason:"timeout"})))},n)),c(await this.getBlockNumber())})}async waitForBlock(e){Te(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const r=U(this,Si).get(e);r&&(r.timer&&clearTimeout(r.timer),U(this,Si).delete(e))}_setTimeout(e,r){r==null&&(r=0);const n=So(this,Ap)._++,i=()=>{U(this,Si).delete(n),e()};if(this.paused)U(this,Si).set(n,{timer:null,func:i,time:r});else{const s=setTimeout(i,r);U(this,Si).set(n,{timer:s,func:i,time:qx()})}return n}_forEachSubscriber(e){for(const r of U(this,rn).values())e(r.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new oP(e.type);case"block":{const r=new fse(this);return r.pollingInterval=this.pollingInterval,r}case"safe":case"finalized":return new hse(this,e.type);case"event":return new s5(this,e.filter);case"transaction":return new pse(this,e.hash);case"orphan":return new dse(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,r){for(const n of U(this,rn).values())if(n.subscriber===e){n.started&&n.subscriber.stop(),n.subscriber=r,n.started&&r.start(),U(this,nn)!=null&&r.pause(U(this,nn));break}}async on(e,r){const n=await ye(this,sh,Sg).call(this,e);return n.listeners.push({listener:r,once:!1}),n.started||(n.subscriber.start(),n.started=!0,U(this,nn)!=null&&n.subscriber.pause(U(this,nn))),this}async once(e,r){const n=await ye(this,sh,Sg).call(this,e);return n.listeners.push({listener:r,once:!0}),n.started||(n.subscriber.start(),n.started=!0,U(this,nn)!=null&&n.subscriber.pause(U(this,nn))),this}async emit(e,...r){const n=await ye(this,Su,V0).call(this,e,r);if(!n||n.listeners.length===0)return!1;const i=n.listeners.length;return n.listeners=n.listeners.filter(({listener:s,once:a})=>{const o=new FF(this,a?null:s,e);try{s.call(this,...r,o)}catch{}return!a}),n.listeners.length===0&&(n.started&&n.subscriber.stop(),U(this,rn).delete(n.tag)),i>0}async listenerCount(e){if(e){const n=await ye(this,Su,V0).call(this,e);return n?n.listeners.length:0}let r=0;for(const{listeners:n}of U(this,rn).values())r+=n.length;return r}async listeners(e){if(e){const n=await ye(this,Su,V0).call(this,e);return n?n.listeners.map(({listener:i})=>i):[]}let r=[];for(const{listeners:n}of U(this,rn).values())r=r.concat(n.map(({listener:i})=>i));return r}async off(e,r){const n=await ye(this,Su,V0).call(this,e);if(!n)return this;if(r){const i=n.listeners.map(({listener:s})=>s).indexOf(r);i>=0&&n.listeners.splice(i,1)}return(!r||n.listeners.length===0)&&(n.started&&n.subscriber.stop(),U(this,rn).delete(n.tag)),this}async removeAllListeners(e){if(e){const{tag:r,started:n,subscriber:i}=await ye(this,sh,Sg).call(this,e);n&&i.stop(),U(this,rn).delete(r)}else for(const[r,{started:n,subscriber:i}]of U(this,rn))n&&i.stop(),U(this,rn).delete(r);return this}async addListener(e,r){return await this.on(e,r)}async removeListener(e,r){return this.off(e,r)}get destroyed(){return U(this,rh)}destroy(){this.removeAllListeners();for(const e of U(this,Si).keys())this._clearTimeout(e);Q(this,rh,!0)}get paused(){return U(this,nn)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(Q(this,Ha,-1),U(this,nn)!=null){if(U(this,nn)==!!e)return;Te(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(r=>r.pause(e)),Q(this,nn,!!e);for(const r of U(this,Si).values())r.timer&&clearTimeout(r.timer),r.time=qx()-r.time}resume(){if(U(this,nn)!=null){this._forEachSubscriber(e=>e.resume()),Q(this,nn,null);for(const e of U(this,Si).values()){let r=e.time;r<0&&(r=0),e.time=qx(),setTimeout(e.func,r)}}}}rn=new WeakMap,ic=new WeakMap,nn=new WeakMap,rh=new WeakMap,Qn=new WeakMap,Eu=new WeakMap,sc=new WeakMap,Ha=new WeakMap,Ap=new WeakMap,Si=new WeakMap,nh=new WeakMap,ih=new WeakMap,dn=new WeakSet,Vn=async function(e){const r=U(this,ih).cacheTimeout;if(r<0)return await this._perform(e);const n=Ag(e.method,e);let i=U(this,sc).get(n);return i||(i=this._perform(e),U(this,sc).set(n,i),setTimeout(()=>{U(this,sc).get(n)===i&&U(this,sc).delete(n)},r)),await i},Sp=new WeakSet,f4=async function(e,r,n){Te(n=0&&r==="latest"&&i.to!=null&&sr(s.data,0,4)==="0x556f1830"){const a=s.data,o=await wn(i.to,this);let c;try{c=Sse(sr(s.data,4))}catch(h){Te(!1,h.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:i,info:{data:a}})}Te(c.sender.toLowerCase()===o.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:a,reason:"OffchainLookup",transaction:i,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:c.errorArgs}});const u=await this.ccipReadFetch(i,c.calldata,c.urls);Te(u!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:i,info:{data:s.data,errorArgs:c.errorArgs}});const l={to:o,data:_r([c.selector,Ase([u,c.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:l});try{const h=await ye(this,Sp,f4).call(this,l,r,n+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},l),result:h}),h}catch(h){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},l),error:h}),h}}throw s}},Cp=new WeakSet,h4=async function(e){const{value:r}=await mn({network:this.getNetwork(),value:e});return r},Au=new WeakSet,z0=async function(e,r,n){let i=this._getAddress(r),s=this._getBlockTag(n);return(typeof i!="string"||typeof s!="string")&&([i,s]=await Promise.all([i,s])),await ye(this,Cp,h4).call(this,ye(this,dn,Vn).call(this,Object.assign(e,{address:i,blockTag:s})))},_p=new WeakSet,d4=async function(e,r){if(Yt(e,32))return await ye(this,dn,Vn).call(this,{method:"getBlock",blockHash:e,includeTransactions:r});let n=this._getBlockTag(e);return typeof n!="string"&&(n=await n),await ye(this,dn,Vn).call(this,{method:"getBlock",blockTag:n,includeTransactions:r})},Su=new WeakSet,V0=async function(e,r){let n=await Vx(e,this);return n.type==="event"&&r&&r.length>0&&r[0].removed===!0&&(n=await Vx({orphan:"drop-log",log:r[0]},this)),U(this,rn).get(n.tag)||null},sh=new WeakSet,Sg=async function(e){const r=await Vx(e,this),n=r.tag;let i=U(this,rn).get(n);return i||(i={subscriber:this._getSubscriber(r),tag:n,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},U(this,rn).set(n,i)),i};function bse(t,e){try{const r=p4(t,e);if(r)return U8(r)}catch{}return null}function p4(t,e){if(t==="0x")return null;try{const r=at(sr(t,e,e+32)),n=at(sr(t,r,r+32));return sr(t,r+32,r+32+n)}catch{}return null}function m9(t){const e=oi(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function wse(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}const Ese=new Uint8Array([]);function Ase(t){const e=[];let r=0;for(let n=0;n=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const r=sr(t,0,32);Te(sr(r,0,12)===sr(v9,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=sr(r,12);try{const n=[],i=at(sr(t,32,64)),s=at(sr(t,i,i+32)),a=sr(t,i+32);for(let o=0;oe[n]),e}function Cl(t,e){if(t.provider)return t.provider;Te(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function y9(t,e){let r=Mm(e);if(r.to!=null&&(r.to=wn(r.to,t)),r.from!=null){const n=r.from;r.from=Promise.all([t.getAddress(),wn(n,t)]).then(([i,s])=>(he(i.toLowerCase()===s.toLowerCase(),"transaction from mismatch","tx.from",s),i))}else r.from=t.getAddress();return await mn(r)}class Cse{constructor(e){ae(this,"provider");Je(this,{provider:e||null})}async getNonce(e){return Cl(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await y9(this,e)}async populateTransaction(e){const r=Cl(this,"populateTransaction"),n=await y9(this,e);n.nonce==null&&(n.nonce=await this.getNonce("pending")),n.gasLimit==null&&(n.gasLimit=await this.estimateGas(n));const i=await this.provider.getNetwork();if(n.chainId!=null){const a=Ke(n.chainId);he(a===i.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else n.chainId=i.chainId;const s=n.maxFeePerGas!=null||n.maxPriorityFeePerGas!=null;if(n.gasPrice!=null&&(n.type===2||s)?he(!1,"eip-1559 transaction do not support gasPrice","tx",e):(n.type===0||n.type===1)&&s&&he(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(n.type===2||n.type==null)&&n.maxFeePerGas!=null&&n.maxPriorityFeePerGas!=null)n.type=2;else if(n.type===0||n.type===1){const a=await r.getFeeData();Te(a.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),n.gasPrice==null&&(n.gasPrice=a.gasPrice)}else{const a=await r.getFeeData();if(n.type==null)if(a.maxFeePerGas!=null&&a.maxPriorityFeePerGas!=null)if(n.type=2,n.gasPrice!=null){const o=n.gasPrice;delete n.gasPrice,n.maxFeePerGas=o,n.maxPriorityFeePerGas=o}else n.maxFeePerGas==null&&(n.maxFeePerGas=a.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=a.maxPriorityFeePerGas);else a.gasPrice!=null?(Te(!s,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),n.gasPrice==null&&(n.gasPrice=a.gasPrice),n.type=0):Te(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else n.type===2&&(n.maxFeePerGas==null&&(n.maxFeePerGas=a.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=a.maxPriorityFeePerGas))}return await mn(n)}async estimateGas(e){return Cl(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return Cl(this,"call").call(await this.populateCall(e))}async resolveName(e){return await Cl(this,"resolveName").resolveName(e)}async sendTransaction(e){const r=Cl(this,"sendTransaction"),n=await this.populateTransaction(e);delete n.from;const i=Dm.from(n);return await r.broadcastTransaction(await this.signTransaction(i))}}function _se(t){return JSON.parse(JSON.stringify(t))}var Bn,Gs,Cu,ac,_u,ah,kp,g4,Bp,m4;class cP{constructor(e){ce(this,kp);ce(this,Bp);ce(this,Bn,void 0);ce(this,Gs,void 0);ce(this,Cu,void 0);ce(this,ac,void 0);ce(this,_u,void 0);ce(this,ah,void 0);Q(this,Bn,e),Q(this,Gs,null),Q(this,Cu,ye(this,kp,g4).bind(this)),Q(this,ac,!1),Q(this,_u,null),Q(this,ah,!1)}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,r){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}start(){U(this,ac)||(Q(this,ac,!0),ye(this,kp,g4).call(this,-2))}stop(){U(this,ac)&&(Q(this,ac,!1),Q(this,ah,!0),ye(this,Bp,m4).call(this),U(this,Bn).off("block",U(this,Cu)))}pause(e){e&&ye(this,Bp,m4).call(this),U(this,Bn).off("block",U(this,Cu))}resume(){this.start()}}Bn=new WeakMap,Gs=new WeakMap,Cu=new WeakMap,ac=new WeakMap,_u=new WeakMap,ah=new WeakMap,kp=new WeakSet,g4=async function(e){try{U(this,Gs)==null&&Q(this,Gs,this._subscribe(U(this,Bn)));let r=null;try{r=await U(this,Gs)}catch(s){if(!Li(s,"UNSUPPORTED_OPERATION")||s.operation!=="eth_newFilter")throw s}if(r==null){Q(this,Gs,null),U(this,Bn)._recoverSubscriber(this,this._recover(U(this,Bn)));return}const n=await U(this,Bn).getNetwork();if(U(this,_u)||Q(this,_u,n),U(this,_u).chainId!==n.chainId)throw new Error("chaid changed");if(U(this,ah))return;const i=await U(this,Bn).send("eth_getFilterChanges",[r]);await this._emitResults(U(this,Bn),i)}catch(r){console.log("@TODO",r)}U(this,Bn).once("block",U(this,Cu))},Bp=new WeakSet,m4=function(){const e=U(this,Gs);e&&(Q(this,Gs,null),e.then(r=>{U(this,Bn).send("eth_uninstallFilter",[r])}))};var ku;class kse extends cP{constructor(r,n){super(r);ce(this,ku,void 0);Q(this,ku,_se(n))}_recover(r){return new s5(r,U(this,ku))}async _subscribe(r){return await r.send("eth_newFilter",[U(this,ku)])}async _emitResults(r,n){for(const i of n)r.emit(U(this,ku),r._wrapLog(i,r._network))}}ku=new WeakMap;class Bse extends cP{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,r){for(const n of r)e.emit("pending",n)}}const Ise="bigint,boolean,function,number,string,symbol".split(/,/g);function Cg(t){if(t==null||Ise.indexOf(typeof t)>=0||typeof t.getAddress=="function")return t;if(Array.isArray(t))return t.map(Cg);if(typeof t=="object")return Object.keys(t).reduce((e,r)=>(e[r]=t[r],e),{});throw new Error(`should not happen: ${t} (${typeof t})`)}function Fse(t){return new Promise(e=>{setTimeout(e,t)})}function _l(t){return t&&t.toLowerCase()}function x9(t){return t&&typeof t.pollingInterval=="number"}const Tse={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class Kx extends Cse{constructor(r,n){super(r);ae(this,"address");n=xt(n),Je(this,{address:n})}connect(r){Te(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(r){return await this.populateCall(r)}async sendUncheckedTransaction(r){const n=Cg(r),i=[];if(n.from){const a=n.from;i.push((async()=>{const o=await wn(a,this.provider);he(o!=null&&o.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",r),n.from=o})())}else n.from=this.address;if(n.gasLimit==null&&i.push((async()=>{n.gasLimit=await this.provider.estimateGas({...n,from:this.address})})()),n.to!=null){const a=n.to;i.push((async()=>{n.to=await wn(a,this.provider)})())}i.length&&await Promise.all(i);const s=this.provider.getRpcTransaction(n);return this.provider.send("eth_sendTransaction",[s])}async sendTransaction(r){const n=await this.provider.getBlockNumber(),i=await this.sendUncheckedTransaction(r);return await new Promise((s,a)=>{const o=[1e3,100],c=async()=>{const u=await this.provider.getTransaction(i);if(u!=null){s(u.replaceableTransaction(n));return}this.provider._setTimeout(()=>{c()},o.pop()||4e3)};c()})}async signTransaction(r){const n=Cg(r);if(n.from){const s=await wn(n.from,this.provider);he(s!=null&&s.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",r),n.from=s}else n.from=this.address;const i=this.provider.getRpcTransaction(n);return await this.provider.send("eth_signTransaction",[i])}async signMessage(r){const n=typeof r=="string"?no(r):r;return await this.provider.send("personal_sign",[qe(n),this.address.toLowerCase()])}async signTypedData(r,n,i){const s=Cg(i),a=await Rm.resolveNames(r,n,s,async o=>{const c=await wn(o);return he(c!=null,"TypedData does not support null address","value",o),c});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(Rm.getPayload(a.domain,n,a.value))])}async unlock(r){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),r,null])}async _legacySignMessage(r){const n=typeof r=="string"?no(r):r;return await this.provider.send("eth_sign",[this.address.toLowerCase(),qe(n)])}}var Bu,oh,za,Zs,vs,Ci,Yn,Ip,v4;class Pse extends xse{constructor(r,n){super(r,n);ce(this,Ip);ce(this,Bu,void 0);ce(this,oh,void 0);ce(this,za,void 0);ce(this,Zs,void 0);ce(this,vs,void 0);ce(this,Ci,void 0);ce(this,Yn,void 0);Q(this,oh,1),Q(this,Bu,Object.assign({},Tse,n||{})),Q(this,za,[]),Q(this,Zs,null),Q(this,Ci,null),Q(this,Yn,null);{let s=null;const a=new Promise(o=>{s=o});Q(this,vs,{promise:a,resolve:s})}const i=this._getOption("staticNetwork");typeof i=="boolean"?(he(!i||r!=="any","staticNetwork cannot be used on special network 'any'","options",n),i&&r!=null&&Q(this,Ci,ia.from(r))):i&&(he(r==null||i.matches(r),"staticNetwork MUST match network object","options",n),Q(this,Ci,i))}_getOption(r){return U(this,Bu)[r]}get _network(){return Te(U(this,Ci),"network is not available yet","NETWORK_ERROR"),U(this,Ci)}async _perform(r){if(r.method==="call"||r.method==="estimateGas"){let i=r.transaction;if(i&&i.type!=null&&Ke(i.type)&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const s=await this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(r=Object.assign({},r,{transaction:Object.assign({},i,{type:void 0})}))}}const n=this.getRpcRequest(r);return n!=null?await this.send(n.method,n.args):super._perform(r)}async _detectNetwork(){const r=this._getOption("staticNetwork");if(r)if(r===!0){if(U(this,Ci))return U(this,Ci)}else return r;return U(this,Yn)?await U(this,Yn):this.ready?(Q(this,Yn,(async()=>{const n=ia.from(Ke(await this.send("eth_chainId",[])));return Q(this,Yn,null),n})()),await U(this,Yn)):(Q(this,Yn,(async()=>{const n={id:So(this,oh)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:n});let i;try{i=(await this._send(n))[0],Q(this,Yn,null)}catch(s){throw Q(this,Yn,null),this.emit("debug",{action:"receiveRpcError",error:s}),s}if(this.emit("debug",{action:"receiveRpcResult",result:i}),"result"in i)return ia.from(Ke(i.result));throw this.getRpcError(n,i)})()),await U(this,Yn))}_start(){U(this,vs)==null||U(this,vs).resolve==null||(U(this,vs).resolve(),Q(this,vs,null),(async()=>{for(;U(this,Ci)==null&&!this.destroyed;)try{Q(this,Ci,await this._detectNetwork())}catch(r){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",Er("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:r}})),await Fse(1e3)}ye(this,Ip,v4).call(this)})())}async _waitUntilReady(){if(U(this,vs)!=null)return await U(this,vs).promise}_getSubscriber(r){return r.type==="pending"?new Bse(this):r.type==="event"?this._getOption("polling")?new s5(this,r.filter):new kse(this,r.filter):r.type==="orphan"&&r.filter.orphan==="drop-log"?new oP("orphan"):super._getSubscriber(r)}get ready(){return U(this,vs)==null}getRpcTransaction(r){const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(i=>{if(r[i]==null)return;let s=i;i==="gasLimit"&&(s="gas"),n[s]=Xl(Ke(r[i],`tx.${i}`))}),["from","to","data"].forEach(i=>{r[i]!=null&&(n[i]=qe(r[i]))}),r.accessList&&(n.accessList=dl(r.accessList)),n}getRpcRequest(r){switch(r.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[_l(r.address),r.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[_l(r.address),r.blockTag]};case"getCode":return{method:"eth_getCode",args:[_l(r.address),r.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[_l(r.address),"0x"+r.position.toString(16),r.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[r.signedTransaction]};case"getBlock":if("blockTag"in r)return{method:"eth_getBlockByNumber",args:[r.blockTag,!!r.includeTransactions]};if("blockHash"in r)return{method:"eth_getBlockByHash",args:[r.blockHash,!!r.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[r.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[r.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(r.transaction),r.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(r.transaction)]};case"getLogs":return r.filter&&r.filter.address!=null&&(Array.isArray(r.filter.address)?r.filter.address=r.filter.address.map(_l):r.filter.address=_l(r.filter.address)),{method:"eth_getLogs",args:[r.filter]}}return null}getRpcError(r,n){const{method:i}=r,{error:s}=n;if(i==="eth_estimateGas"&&s.message){const c=s.message;if(!c.match(/revert/i)&&c.match(/insufficient funds/i))return Er("insufficient funds","INSUFFICIENT_FUNDS",{transaction:r.params[0],info:{payload:r,error:s}})}if(i==="eth_call"||i==="eth_estimateGas"){const c=y4(s),u=np.getBuiltinCallException(i==="eth_call"?"call":"estimateGas",r.params[0],c?c.data:null);return u.info={error:s,payload:r},u}const a=JSON.stringify(Ose(s));if(typeof s.message=="string"&&s.message.match(/user denied|ethers-user-denied/i))return Er("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[i]||"unknown",reason:"rejected",info:{payload:r,error:s}});if(i==="eth_sendRawTransaction"||i==="eth_sendTransaction"){const c=r.params[0];if(a.match(/insufficient funds|base fee exceeds gas limit/i))return Er("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:c,info:{error:s}});if(a.match(/nonce/i)&&a.match(/too low/i))return Er("nonce has already been used","NONCE_EXPIRED",{transaction:c,info:{error:s}});if(a.match(/replacement transaction/i)&&a.match(/underpriced/i))return Er("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:c,info:{error:s}});if(a.match(/only replay-protected/i))return Er("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:i,info:{transaction:c,info:{error:s}}})}let o=!!a.match(/the method .* does not exist/i);return o||s&&s.details&&s.details.startsWith("Unauthorized method:")&&(o=!0),o?Er("unsupported operation","UNSUPPORTED_OPERATION",{operation:r.method,info:{error:s,payload:r}}):Er("could not coalesce error","UNKNOWN_ERROR",{error:s,payload:r})}send(r,n){if(this.destroyed)return Promise.reject(Er("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:r}));const i=So(this,oh)._++,s=new Promise((a,o)=>{U(this,za).push({resolve:a,reject:o,payload:{method:r,params:n,id:i,jsonrpc:"2.0"}})});return ye(this,Ip,v4).call(this),s}async getSigner(r){r==null&&(r=0);const n=this.send("eth_accounts",[]);if(typeof r=="number"){const s=await n;if(r>=s.length)throw new Error("no such account");return new Kx(this,s[r])}const{accounts:i}=await mn({network:this.getNetwork(),accounts:n});r=xt(r);for(const s of i)if(xt(s)===r)return new Kx(this,r);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(n=>new Kx(this,n))}destroy(){U(this,Zs)&&(clearTimeout(U(this,Zs)),Q(this,Zs,null));for(const{payload:r,reject:n}of U(this,za))n(Er("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:r.method}));Q(this,za,[]),super.destroy()}}Bu=new WeakMap,oh=new WeakMap,za=new WeakMap,Zs=new WeakMap,vs=new WeakMap,Ci=new WeakMap,Yn=new WeakMap,Ip=new WeakSet,v4=function(){if(U(this,Zs))return;const r=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");Q(this,Zs,setTimeout(()=>{Q(this,Zs,null);const n=U(this,za);for(Q(this,za,[]);n.length;){const i=[n.shift()];for(;n.length&&i.length!==U(this,Bu).batchMaxCount;)if(i.push(n.shift()),JSON.stringify(i.map(a=>a.payload)).length>U(this,Bu).batchMaxSize){n.unshift(i.pop());break}(async()=>{const s=i.length===1?i[0].payload:i.map(a=>a.payload);this.emit("debug",{action:"sendRpcPayload",payload:s});try{const a=await this._send(s);this.emit("debug",{action:"receiveRpcResult",result:a});for(const{resolve:o,reject:c,payload:u}of i){if(this.destroyed){c(Er("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:u.method}));continue}const l=a.filter(h=>h.id===u.id)[0];if(l==null){const h=Er("missing response for request","BAD_DATA",{value:a,info:{payload:u}});this.emit("error",h),c(h);continue}if("error"in l){c(this.getRpcError(u,l));continue}o(l.result)}}catch(a){this.emit("debug",{action:"receiveRpcError",error:a});for(const{reject:o}of i)o(a)}})()}},r))};var oc;class Nse extends Pse{constructor(r,n){super(r,n);ce(this,oc,void 0);Q(this,oc,4e3)}_getSubscriber(r){const n=super._getSubscriber(r);return x9(n)&&(n.pollingInterval=U(this,oc)),n}get pollingInterval(){return U(this,oc)}set pollingInterval(r){if(!Number.isInteger(r)||r<0)throw new Error("invalid interval");Q(this,oc,r),this._forEachSubscriber(n=>{x9(n)&&(n.pollingInterval=U(this,oc))})}}oc=new WeakMap;function y4(t){if(t==null)return null;if(typeof t.message=="string"&&t.message.match(/revert/i)&&Yt(t.data))return{message:t.message,data:t.data};if(typeof t=="object"){for(const e in t){const r=y4(t[e]);if(r)return r}return null}if(typeof t=="string")try{return y4(JSON.parse(t))}catch{}return null}function x4(t,e){if(t!=null){if(typeof t.message=="string"&&e.push(t.message),typeof t=="object")for(const r in t)x4(t[r],e);if(typeof t=="string")try{return x4(JSON.parse(t),e)}catch{}}}function Ose(t){const e=[];return x4(t,e),e}var ch;class Dse extends Nse{constructor(r,n){super(n,{batchMaxCount:1});ce(this,ch,void 0);Q(this,ch,async(i,s)=>{const a={method:i,params:s};this.emit("debug",{action:"sendEip1193Request",payload:a});try{const o=await r.request(a);return this.emit("debug",{action:"receiveEip1193Result",result:o}),o}catch(o){const c=new Error(o.message);throw c.code=o.code,c.data=o.data,c.payload=a,this.emit("debug",{action:"receiveEip1193Error",error:c}),c}})}async send(r,n){return await this._start(),await super.send(r,n)}async _send(r){he(!Array.isArray(r),"EIP-1193 does not support batch request","payload",r);try{const n=await U(this,ch).call(this,r.method,r.params||[]);return[{id:r.id,result:n}]}catch(n){return[{id:r.id,error:{code:n.code,data:n.data,message:n.message}}]}}getRpcError(r,n){switch(n=JSON.parse(JSON.stringify(n)),n.error.code||-1){case 4001:n.error.message=`ethers-user-denied: ${n.error.message}`;break;case 4200:n.error.message=`ethers-unsupported: ${n.error.message}`;break}return super.getRpcError(r,n)}async hasSigner(r){r==null&&(r=0);const n=await this.send("eth_accounts",[]);return typeof r=="number"?n.length>r:(r=r.toLowerCase(),n.filter(i=>i.toLowerCase()===r).length!==0)}async getSigner(r){if(r==null&&(r=0),!await this.hasSigner(r))try{await U(this,ch).call(this,"eth_requestAccounts",[])}catch(n){const i=n.payload;throw this.getRpcError(i,{id:i.id,error:n})}return await super.getSigner(r)}}ch=new WeakMap;const py=async(t,e=!1,r)=>{const{WarpFactory:n,defaultCacheOptions:i}=await Aw(()=>import("./web.bundle.min-UIrkjpjC.js"),__vite__mapDeps([]),import.meta.url),s=t==="local"?n.forLocal():t==="testnet"?n.forTestnet({...i,...r}):n.forMainnet({...i,...r});if(e){const{DeployPlugin:a}=await lP();s.use(new a)}return s},a5=t=>typeof t!="object"?!1:["n","e","d","p","q","dp","dq","qi"].every(r=>r in t),uP=t=>{if(typeof t!="string")return!1;const e=/^[0-9a-fA-F]{64}$/;return t=t.startsWith("0x")?t.substring(2):t,t.length===64&&e.test(t)};function Rse(t){return!(typeof t!="string"||t.length!==43||!/^[A-Za-z0-9_-]+$/.test(t))}const lP=async()=>{if(typeof window<"u"){const{DeployPlugin:t,ArweaveSigner:e,InjectedArweaveSigner:r,InjectedEthereumSigner:n,EthereumSigner:i}=await Aw(()=>import("./web.bundle.min-o_8LNKIc.js"),__vite__mapDeps([]),import.meta.url);return{DeployPlugin:t,ArweaveSigner:e,InjectedArweaveSigner:r,InjectedEthereumSigner:n,EthereumSigner:i}}else{const t=await Aw(()=>import("./web.bundle.min-o_8LNKIc.js"),__vite__mapDeps([]),import.meta.url),{DeployPlugin:e,ArweaveSigner:r,InjectedArweaveSigner:n,InjectedEthereumSigner:i,EthereumSigner:s}=(t==null?void 0:t.default)||t;return{DeployPlugin:e,ArweaveSigner:r,InjectedArweaveSigner:n,InjectedEthereumSigner:i,EthereumSigner:s}}};async function o5(t,e){var f,p;let r,n;const{ArweaveSigner:i,EthereumSigner:s,InjectedArweaveSigner:a,InjectedEthereumSigner:o}=await lP(),c=a5(t.wallet),u=uP(t.wallet);u&&(t.wallet=t.wallet.startsWith("0x")?t.wallet.substring(2):t.wallet);const l=async()=>{var x,b,S;const d=await window.arweaveWallet.getPermissions(),y=["ACCESS_PUBLIC_KEY","SIGNATURE","SIGN_TRANSACTION"].filter(k=>d.indexOf(k)===-1);(d.length===0||y.length>0)&&await window.arweaveWallet.connect([...d,...y]),(S=(b=(x=t.wallet)==null?void 0:x.namespaces)==null?void 0:b.arweaveWallet)!=null&&S.walletName?r=new a(t.wallet):r=new a(window.arweaveWallet),await r.setPublicKey(),r.getAddress=()=>r.signer.getActiveAddress},h=async()=>{var y;await((y=window.ethereum)==null?void 0:y.request({method:"eth_requestAccounts"}));const d=new Dse(window.ethereum),g=await d.getSigner();d.getSigner=()=>g,r=new o(d),await r.setPublicKey(),r.getAddress=()=>g==null?void 0:g.address};if(t.wallet==="use_wallet"){if(typeof window<"u"&&window.arweaveWallet)return n=await e(t.wallet),{wallet:t.wallet,callbackResponse:n};throw new Error("[ArweaveKit] Failed to initialize signer.")}else if(typeof window<"u"&&!c&&!u)if(t.strategy==="arweave"&&window.arweaveWallet)await l();else if(t.strategy==="ethereum"&&window.ethereum&&((f=window.ethereum)!=null&&f.request))await h();else try{if(window.ethereum&&((p=window.ethereum)!=null&&p.request))await h(),n=await e(r);else throw new Error("[ArweaveKit] Ethereum Wallet not found. Trying with Arweave Wallet.")}catch(d){if(console.log(`[ArweaveKit] ${d}`),window.arweaveWallet)await l(),n=await e(r);else throw new Error("[ArweaveKit] Failed to initialize signer.")}else if(t.strategy==="arweave"&&c)r=t.environment==="local"||t!=null&&t.contractTxId?t.wallet:new i(t.wallet);else if(t.strategy==="ethereum"&&u)r=new s(t.wallet);else try{if(u)r=new s(t.wallet),n=await e(r);else throw new Error("[ArweaveKit] Trying with Arweave Signer.")}catch(d){if(console.log(`[ArweaveKit] ${d}`),c)r=t.environment==="local"||t!=null&&t.contractTxId?t.wallet:new i(t.wallet),n=await e(r);else throw new Error("[ArweaveKit] Failed to initialize signer.")}return n||(n=await e(r)),{wallet:r,callbackResponse:n}}function c5(t){typeof window>"u"?t.strategy=a5(t.wallet)?"arweave":uP(t.wallet)?"ethereum":"both":t.strategy=t.strategy||"both"}async function fP(t){let e=400,r="UNSUCCESSFUL";const n=await py(t.environment,!0);c5(t),t.environment==="local"&&a5(t.wallet)&&await n.testing.addFunds(t.wallet).catch(u=>console.log("ERROR",u.message));const i=async u=>{const l=u==="use_wallet"||t.environment==="local",h={wallet:u,initState:t.initialState,evaluationManifest:t.evaluationManifest,tags:[...t.tags||[],M8],data:t.data};return typeof t.contractSource=="string"&&Rse(t.contractSource)?n.deployFromSourceTx({...h,srcTxId:t.contractSource},l):n.deploy({...h,src:t.contractSource},l)},{wallet:s,callbackResponse:a}=await o5(t,i);let o=a==null?void 0:a.contractTxId;const c=n.contract(o).connect(s);return o&&(e=200,r="SUCCESSFUL"),{contract:c,contractTxId:o,result:{status:e,statusText:r}}}async function hP(t){const e=await py(t.environment,!1,t.cacheOptions);c5(t);let r=400,n="UNSUCCESSFUL";const i=e.contract(t.contractTxId).setEvaluationOptions({...t.evaluationOptions}),s=async c=>(i.connect(c),i.writeInteraction(t.options,{tags:[...t.tags||[],M8],vrf:t.vrf,disableBundling:c==="use_wallet"||t.environment==="local"}));let{callbackResponse:a}=await o5(t,s);const o=await i.readState();return a!=null&&a.originalTxId&&(r=200,n="SUCCESSFUL"),{writeContract:a,state:o.cachedValue.state,result:{status:r,statusText:n}}}async function Mse(t){const e=await py(t.environment,!1,t.cacheOptions);let r=400,n="UNSUCCESSFUL";const s=await e.contract(t.contractTxId).setEvaluationOptions({...t.evaluationOptions}).readState();return s.sortKey&&s.cachedValue&&(r=200,n="SUCCESSFUL"),{readContract:s,result:{status:r,statusText:n}}}async function dP(t){const e=await py(t.environment,!1,t.cacheOptions);t.connectWallet=t.connectWallet??!0,c5(t);let r=400,n="UNSUCCESSFUL";const i=e.contract(t.contractTxId).setEvaluationOptions({...t.evaluationOptions}),s=async o=>(i.connect(o),await i.viewState({...t.options}));let a;try{if(!t.connectWallet)throw new Error("View state without connecting wallet");({callbackResponse:a}=await o5(t,s))}catch{a=await i.viewState({...t.options})}return a.type==="ok"&&(r=200,n="SUCCESSFUL"),{viewContract:a,result:{status:r,statusText:n}}}async function Lse(t){return{contract:await(await fetch(`https://gateway.warp.cc/gateway/contract?txId=${t}`,{method:"GET"})).json()}}async function jse(t){const e=await SF({API_ID:t.apiId}),r=await e.signTransactionWarp({othentFunction:t.othentFunction,data:t.data,tags:[...t.tags||[],M8]}),n=await e.sendTransactionWarp(r);if(n.success)return n;throw new Error("Transaction creation unsuccessful.")}async function Use(t){return await(await SF({API_ID:t.apiId})).readCustomContract({contract_id:t.contractTxId})}CF({createContract:fP,writeContract:hP,readContractState:Mse,viewContractState:dP,getContract:Lse,writeContractWOthent:jse,readContractWOthent:Use});function pP(){const[t,e]=K.useState(JSON.parse(localStorage.getItem("deployments"))||{});K.useEffect(()=>{t&&localStorage.setItem("deployments",JSON.stringify(t))},[t]);function r(i,s,a,o){console.log("newDeployment",i,s,a);const c={...t,[i]:{txid:s,env:a,functionNames:o}};e(c)}function n(i){const s={...t};delete s[i],e(s)}return{deployments:t,newDeployment:r,removeDeployment:n}}const $se="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_146_858'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='20'%20height='20'%3e%3crect%20width='20'%20height='20'%20fill='%23D9D9D9'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_146_858)'%3e%3cpath%20d='M7.54853%2014.5833C7.17342%2014.5833%206.85636%2014.4538%206.59734%2014.1948C6.33831%2013.9357%206.2088%2013.6187%206.2088%2013.2436V3.75644C6.2088%203.38133%206.33831%203.06426%206.59734%202.80523C6.85636%202.5462%207.17342%202.41669%207.54853%202.41669H15.0357C15.4108%202.41669%2015.7278%202.5462%2015.9869%202.80523C16.2459%203.06426%2016.3754%203.38133%2016.3754%203.75644V13.2436C16.3754%2013.6187%2016.2459%2013.9357%2015.9869%2014.1948C15.7278%2014.4538%2015.4108%2014.5833%2015.0357%2014.5833H7.54853ZM7.54853%2013.5H15.0357C15.0998%2013.5%2015.1585%2013.4733%2015.212%2013.4199C15.2654%2013.3664%2015.2921%2013.3077%2015.2921%2013.2436V3.75644C15.2921%203.69233%2015.2654%203.63356%2015.212%203.58013C15.1585%203.52671%2015.0998%203.5%2015.0357%203.5H7.54853C7.48442%203.5%207.42566%203.52671%207.37224%203.58013C7.31881%203.63356%207.29209%203.69233%207.29209%203.75644V13.2436C7.29209%2013.3077%207.31881%2013.3664%207.37224%2013.4199C7.42566%2013.4733%207.48442%2013.5%207.54853%2013.5ZM4.96522%2017.1666C4.59012%2017.1666%204.27306%2017.0371%204.01403%2016.7781C3.755%2016.519%203.62549%2016.202%203.62549%2015.8269V5.25644H4.7088V15.8269C4.7088%2015.891%204.73551%2015.9498%204.78893%2016.0032C4.84236%2016.0566%204.90112%2016.0833%204.96522%2016.0833H13.5357V17.1666H4.96522Z'%20fill='white'/%3e%3c/g%3e%3c/svg%3e",Hse="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8.58075%2014.2538L15.3038%207.53078L14.25%206.47696L8.58075%2012.1462L5.73075%209.29618L4.67693%2010.35L8.58075%2014.2538ZM10.0016%2019.5C8.68772%2019.5%207.45268%2019.2506%206.29655%2018.752C5.1404%2018.2533%204.13472%2017.5766%203.2795%2016.7217C2.42427%2015.8669%201.74721%2014.8616%201.24833%2013.706C0.749442%2012.5504%200.5%2011.3156%200.5%2010.0017C0.5%208.68775%200.749334%207.45271%201.248%206.29658C1.74667%205.14043%202.42342%204.13475%203.27825%203.27953C4.1331%202.4243%205.13834%201.74724%206.29398%201.24836C7.44959%200.749473%208.68437%200.500031%209.9983%200.500031C11.3122%200.500031%2012.5473%200.749365%2013.7034%201.24803C14.8596%201.7467%2015.8652%202.42345%2016.7205%203.27828C17.5757%204.13313%2018.2527%205.13837%2018.7516%206.29401C19.2505%207.44962%2019.5%208.6844%2019.5%209.99833C19.5%2011.3123%2019.2506%2012.5473%2018.752%2013.7034C18.2533%2014.8596%2017.5765%2015.8653%2016.7217%2016.7205C15.8669%2017.5757%2014.8616%2018.2528%2013.706%2018.7517C12.5504%2019.2505%2011.3156%2019.5%2010.0016%2019.5ZM9.99998%2018C12.2333%2018%2014.125%2017.225%2015.675%2015.675C17.225%2014.125%2018%2012.2333%2018%2010C18%207.76667%2017.225%205.87501%2015.675%204.32501C14.125%202.77501%2012.2333%202.00001%209.99998%202.00001C7.76664%202.00001%205.87498%202.77501%204.32498%204.32501C2.77498%205.87501%201.99998%207.76667%201.99998%2010C1.99998%2012.2333%202.77498%2014.125%204.32498%2015.675C5.87498%2017.225%207.76664%2018%209.99998%2018Z'%20fill='%23B4FFA1'/%3e%3c/svg%3e",b9=["not allowed","Allowed-With-Credit","Allowed-With-Indication","Allowed-With-License-Passthrough"],w9=["not allowed","Allowed","Allowed-With-Credit"];function zse(t){const e=/case\s+"([^"]+)"/g,r=t.matchAll(e),n=[];for(const i of r)i[1]!="handle"&&n.push(i[1]);return n}const Vse={contractName:"",deployEnv:"local",result:"",usingWebWallet:!1,deploySuccess:!1,walletJWK:void 0,fileName:"",contractTxID:"",derivation:"",commercialUse:"",isError:!1};function qse({contracts:t,target:e,test:r}){const{newDeployment:n}=pP();function i(u){return{...u,contractName:e}}const[s,a]=K.useReducer(o,Vse,i);function o(u,l){switch(l.type){case"set_contract_name":return{...u,contractName:l.payload};case"set_env":return{...u,deployEnv:l.payload};case"set_result":return{...u,result:l.payload};case"set_web_wallet":return{...u,usingWebWallet:l.payload};case"set_deploy_success":return{...u,deploySuccess:l.payload};case"set_file":{const h=l.payload,f=new FileReader;return f.onload=()=>{const p=JSON.parse(f.result);a({type:"set_wallet_jwk",payload:p})},f.readAsText(h),{...u,fileName:h.name}}case"set_wallet_jwk":return{...u,walletJWK:l.payload,usingWebWallet:!1};case"set_contract_id":return{...u,contractTxID:l.payload};case"set_derivation":return{...u,derivation:l.payload};case"set_commercial_use":return{...u,commercialUse:l.payload};case"is_error":return{...u,isError:l.payload};case"deploy_another":return{...u,deploySuccess:!1,contractName:"",contractTxID:"",derivation:"",commercialUse:""}}}async function c(){if(!s.contractName)return alert("Please select a contract");if(!s.deployEnv)return alert("Please select a deployment environment");if(!s.usingWebWallet&&!s.walletJWK)return alert("Please upload a wallet file");const u=t[s.contractName]["contract.js"],l=t[s.contractName]["state.json"],h=[{name:"App-Name",value:"Better-IDE"},{name:"App-Version",value:"1.0.0"}];s.derivation&&h.push({name:"Derivation",value:s.derivation}),s.commercialUse&&h.push({name:"Commercial-Use",value:s.commercialUse});try{const f=await fP({wallet:s.usingWebWallet?"web_wallet":s.walletJWK,contractSource:u,initialState:l,environment:s.deployEnv,strategy:"arweave",tags:h});console.log(f),a({type:"set_deploy_success",payload:!0}),a({type:"set_contract_id",payload:f.contractTxId}),a({type:"set_result",payload:`Deployed successfully! -ID: `+f.contractTxId}),n(s.contractName,f.contractTxId,s.deployEnv,zse(t[s.contractName]["contract.js"])),a({type:"is_error",payload:!1})}catch(f){console.log(f),a({type:"is_error",payload:!0}),a({type:"set_result",payload:f.toString()}),a({type:"set_deploy_success",payload:!1}),a({type:"set_contract_id",payload:""})}}return s?te.jsx("div",{className:"h-full flex flex-col items-center justify-evenly w-full",children:s.deploySuccess?te.jsxs("div",{className:"text-center flex flex-col gap-4 justify-center items-center min-h-[80vh]",children:[te.jsxs("div",{className:"text-3xl font-bold flex gap-1",children:[te.jsx("img",{src:Hse,width:22})," Your contract has been successfully deployed!"]}),te.jsxs("div",{className:"flex gap-1 mx-auto",children:["Txn ID: ",s.contractTxID," ",te.jsx("img",{src:$se,className:"cursor-pointer",width:22,onClick:()=>{navigator.clipboard.writeText(s.contractTxID),alert("Copied to clipboard")}})]}),te.jsx("button",{className:"bg-[#093E49] p-2 px-4 rounded w-fit mx-auto",onClick:()=>a({type:"deploy_another"}),children:"Deploy Another"}),te.jsx("button",{className:"bg-[#093E49] p-2 px-4 rounded w-fit mx-auto",onClick:()=>r(s.contractName),children:"Test this contract"})]}):te.jsxs("div",{className:"flex flex-col justify-center overflow-scroll grow gap-5 w-full",children:[te.jsx("div",{className:"grow"}),te.jsxs("div",{className:"flex gap-10 justify-center items-center",children:[te.jsxs("div",{children:[te.jsx("div",{children:"Select Contract"}),te.jsxs("select",{className:"p-1 rounded ",value:s.contractName,defaultValue:s.contractName,onChange:u=>a({type:"set_contract_name",payload:u.target.value}),children:[te.jsx("option",{value:"",disabled:!0,children:"Select a contract"}),Object.keys(t).map(u=>{if(u!="input")return te.jsx("option",{value:u,children:u})})]})]}),te.jsxs("div",{children:[te.jsx("div",{children:"Select Environment"}),te.jsxs("select",{className:"p-1 rounded",value:s.deployEnv,defaultValue:s.deployEnv,onChange:u=>a({type:"set_env",payload:u.target.value}),children:[te.jsx("option",{value:"",disabled:!0,children:"Select an environment"}),te.jsx("option",{value:"local",children:"Local (npx arlocal)"}),te.jsx("option",{value:"testnet",children:"testnet"}),te.jsx("option",{value:"mainnet",children:"Mainnet"})]})]})]}),te.jsxs("div",{className:"flex gap-4 justify-center",children:[te.jsxs("div",{className:"hover:scale-105 active:scale-95 transition-all duration-200 p-2 px-4",children:[te.jsx("label",{htmlFor:"wallet",className:"p-2 px-4 cursor-pointer rounded bg-[#093E49] text-center w-fit",children:s.walletJWK?`Imported: ${s.fileName} ✅`:"Import a wallet.json file"}),te.jsx("input",{type:"file",accept:"application/JSON",id:"wallet",className:"hidden",onChange:u=>a({type:"set_file",payload:u.target.files[0]})})]}),te.jsxs("button",{className:"p-2 px-4 cursor-pointer rounded bg-[#093E49] text-center w-fit hover:scale-105 active:scale-95",onClick:()=>{window.arweaveWallet.connect(["ACCESS_ADDRESS","SIGN_TRANSACTION","ACCESS_PUBLIC_KEY","SIGNATURE"]).then(()=>{a({type:"set_web_wallet",payload:!0})}).catch(()=>{a({type:"set_web_wallet",payload:!1}),alert("Error connecting to web wallet")})},children:["Use Web Wallet ",s.usingWebWallet&&"✅"]})]}),te.jsxs("div",{className:"flex flex-col gap-3 justify-center items-center",children:[te.jsxs("div",{className:"text-center",children:[te.jsx("span",{className:"font-bold text-xl",children:"Universal Data Licensing"}),te.jsx("br",{}),te.jsx("span",{className:"font-base",children:"Protect the ownership of your content"})]}),te.jsxs("div",{className:"flex gap-10",children:[te.jsxs("div",{children:[te.jsx("div",{children:"License your code"}),te.jsx("select",{className:"p-1 rounded",defaultValue:b9[0],onChange:u=>a({type:"set_derivation",payload:u.target.value}),children:b9.map(u=>te.jsx("option",{value:u,children:u}))})]}),te.jsxs("div",{children:[te.jsx("div",{children:"Add a commercial license"}),te.jsx("select",{className:"p-1 rounded",defaultValue:w9[0],onChange:u=>a({type:"set_commercial_use",payload:u.target.value}),children:w9.map(u=>te.jsx("option",{value:u,children:u}))})]})]})]}),te.jsx("button",{className:"bg-[#093E49] p-2 px-4 rounded w-fit mx-auto",onClick:()=>c(),children:"Deploy! 🚀"}),te.jsx("div",{className:"grow"}),s.result&&te.jsxs("pre",{className:`bg-black/20 border-t border-white/20 p-2 ${s.isError?"text-red-300":"text-green-300"}`,children:["[ Result ]",te.jsx("br",{}),te.jsx("br",{}),s.result]})]})}):te.jsx(te.Fragment,{})}function Kse({contracts:t,target:e}){const[r,n]=K.useState(),[i,s]=K.useState("read"),[a,o]=K.useState(""),{deployments:c,removeDeployment:u}=pP(),[l,h]=K.useState(!1),[f,p]=K.useState(""),[d,g]=K.useState("");K.useEffect(()=>{t.setContracts({...t.contracts,input:{"README.md":"This is not a contract. The state.json is used to send arguments to the contract for testing.","state.json":JSON.stringify({name:"ankushKun"}),"contract.js":""}}),e&&n(e)},[]),K.useEffect(()=>{o(""),s("read")},[r]),K.useEffect(()=>{r&&(a.toLowerCase().startsWith("get")?s("read"):a.toLowerCase().startsWith("set")&&s("write"))},[a,r]);async function y(){if(!r||!a||!i||!t||!t[r])return;const b=JSON.parse(t.input["state.json"]);if(b){if(i=="read")try{const S=await dP({contractTxId:c[r].txid,environment:c[r].env,strategy:"arweave",options:{function:a,...b}});console.log(S),S.result.status==200?(h(!0),g(JSON.stringify({result:S.viewContract.result},null,2)),p(JSON.stringify(S.viewContract.state,null,2))):g(`error: ${S.result.status} -${S.result.statusText} - -${S.viewContract.errorMessage}`)}catch(S){console.log(S),g(`error: ${S}`)}else if(i=="write")try{const S=await hP({contractTxId:c[r].txid,environment:c[r].env,wallet:"use_wallet",strategy:"arweave",options:{function:a,...b},cacheOptions:{inMemory:!0}});console.log(S),S.result.status==200?(h(!0),g(`TXID: ${S.writeContract.originalTxId}`),p(JSON.stringify(S.state,null,2))):g(`error: ${S.result.status} -${S.result.statusText} - -${S.writeContract.errorMessage}`)}catch(S){console.log(S),g(`error: ${S}`)}}}return te.jsxs("div",{className:"flex flex-col justify-center items-center h-full gap-5",children:[te.jsxs("div",{className:"w-fit",children:[te.jsx("label",{className:"block text-white",children:"Select a deployment"}),te.jsxs("select",{className:"",defaultValue:e||"none",onChange:x=>n(x.target.value),children:[te.jsx("option",{value:"none",disabled:!0,children:"Select a deployment"}),Object.keys(c).map(x=>te.jsxs("option",{value:x,children:[x," (",c[x].env,"-",c[x].txid,")"]},x))]})]}),te.jsxs("div",{className:"w-full grid grid-cols-2 p-5 gap-5",children:[te.jsxs("div",{className:"flex flex-col gap-1",children:[te.jsx("div",{className:"text-2xl",children:"Call a Function"}),te.jsxs("div",{className:"flex gap-5 items-center",children:[te.jsx("div",{children:"Type:"}),te.jsxs("div",{className:"flex items-center gap-1",children:[te.jsx("input",{type:"radio",name:"calltype",id:"read",value:"read",checked:i=="read",onClick:()=>s("read")}),te.jsx("label",{htmlFor:"read",children:"Read"})]}),te.jsxs("div",{className:"flex items-center gap-1",children:[te.jsx("input",{type:"radio",name:"calltype",id:"write",value:"write",checked:i=="write",onClick:()=>s("write")}),te.jsx("label",{htmlFor:"write",children:"Write"})]})]}),te.jsx("div",{className:"text-lg mt-5",children:"Function Name"}),te.jsxs("select",{className:"",defaultValue:"none",onChange:x=>o(x.target.value),children:[te.jsx("option",{value:"none",disabled:!0,children:"Select a function"}),r&&c[r].functionNames.map(x=>te.jsx("option",{value:x,children:x},x))]}),te.jsx("div",{className:"ring-1 ring-white/20 rounded overflow-clip p-0.5 h-full w-full",children:te.jsx("iframe",{className:"rounded h-full w-full",src:"/betterIDE?editor&language=json&file=input/state.json"})}),te.jsx("button",{className:"bg-green-500 my-5 text-black rounded-md px-4 p-1 w-fit active:scale-95 hover:scale-105",onClick:y,children:"RUN"})]}),te.jsxs("div",{className:"flex flex-col gap-1",children:[te.jsx("div",{className:"text-2xl",children:"Output"}),te.jsx("div",{children:"Result"}),te.jsx("pre",{className:`bg-white/10 p-1 rounded overflow-scroll ${l?"text-green-400":"text-red-400"}`,children:d||"..."}),te.jsx("div",{children:"Latest State"}),te.jsx("pre",{className:"bg-white/10 p-1 rounded overflow-scroll",children:f||"..."})]})]})]})}function Wse(){return te.jsx("div",{className:"h-full flex items-center justify-center",children:te.jsx("div",{children:"Cloud is a work in progress in this version of the IDE"})})}function Gse(){return te.jsx("div",{className:"h-full flex items-center justify-center",children:te.jsx("div",{children:"Showcase is a work in progress in this version of the IDE"})})}const Zse=""+new URL("ecosystem-Pm6wgfuC.svg",import.meta.url).href;function E9(){return te.jsxs("div",{className:"h-full flex flex-col gap-5 items-center justify-center",children:[te.jsx("img",{src:Zse,className:"w-[269px]",draggable:!1}),te.jsx("a",{href:"https://github.com/ankushKun/betterIDE",target:"_blank",children:te.jsxs("div",{className:"flex items-center gap-3 font-semibold text-2xl tracking-widest ring-1 rounded-lg ring-white/20 p-2 hover:bg-white/5",children:[te.jsx("img",{src:"https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png",className:"w-[60px] rounded-full",draggable:!1}),te.jsxs("div",{children:["View source",te.jsx("br",{})," on Github"]})]})})]})}const Jse="data:image/svg+xml,%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Transformed%20by:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%201024%201024'%20xmlns='http://www.w3.org/2000/svg'%20fill='%23000000'%20stroke='%23000000'%20stroke-width='0.01024'%3e%3cg%20id='SVGRepo_bgCarrier'%20stroke-width='0'/%3e%3cg%20id='SVGRepo_tracerCarrier'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cg%20id='SVGRepo_iconCarrier'%3e%3cpath%20fill='%23ffffff'%20d='M160%20256H96a32%2032%200%200%201%200-64h256V95.936a32%2032%200%200%201%2032-32h256a32%2032%200%200%201%2032%2032V192h256a32%2032%200%201%201%200%2064h-64v672a32%2032%200%200%201-32%2032H192a32%2032%200%200%201-32-32V256zm448-64v-64H416v64h192zM224%20896h576V256H224v640zm192-128a32%2032%200%200%201-32-32V416a32%2032%200%200%201%2064%200v320a32%2032%200%200%201-32%2032zm192%200a32%2032%200%200%201-32-32V416a32%2032%200%200%201%2064%200v320a32%2032%200%200%201-32%2032z'/%3e%3c/g%3e%3c/svg%3e",Xse="data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='SVGRepo_bgCarrier'%20stroke-width='0'%3e%3c/g%3e%3cg%20id='SVGRepo_tracerCarrier'%20stroke-linecap='round'%20stroke-linejoin='round'%3e%3c/g%3e%3cg%20id='SVGRepo_iconCarrier'%3e%3cg%20id='File%20/%20Download_Package'%3e%3cpath%20id='Vector'%20d='M4%208V16.8C4%2017.9201%204%2018.4798%204.21799%2018.9076C4.40973%2019.2839%204.71547%2019.5905%205.0918%2019.7822C5.5192%2020%206.07899%2020%207.19691%2020H16.8031C17.921%2020%2018.48%2020%2018.9074%2019.7822C19.2837%2019.5905%2019.5905%2019.2839%2019.7822%2018.9076C20%2018.4802%2020%2017.921%2020%2016.8031V8M4%208H20M4%208L5.36518%205.61089C5.7002%205.0246%205.86768%204.73151%206.10325%204.51807C6.31184%204.32907%206.55859%204.18605%206.82617%204.09871C7.12861%204%207.46623%204%208.14258%204H15.8571C16.5334%204%2016.8723%204%2017.1747%204.09871C17.4423%204.18605%2017.6879%204.32907%2017.8965%204.51807C18.1322%204.73168%2018.3002%205.02507%2018.6357%205.6123L20%208M12%2011V17M12%2017L15%2015M12%2017L9%2015'%20stroke='%23ffffff'%20stroke-width='0.984'%20stroke-linecap='round'%20stroke-linejoin='round'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Qse="data:image/svg+xml,%3csvg%20fill='%23ffffff'%20viewBox='0%200%2036.00%2036.00'%20version='1.1'%20preserveAspectRatio='xMidYMid%20meet'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20stroke='%23ffffff'%20stroke-width='0.00036'%3e%3cg%20id='SVGRepo_bgCarrier'%20stroke-width='0'%3e%3c/g%3e%3cg%20id='SVGRepo_tracerCarrier'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke='%23CCCCCC'%20stroke-width='0.144'%3e%3c/g%3e%3cg%20id='SVGRepo_iconCarrier'%3e%3ctitle%3edeploy-line%3c/title%3e%3cpath%20class='clr-i-outline%20clr-i-outline-path-1'%20d='M33,2H22.1a1,1,0,0,0,0,2h8.53l-8.82,9a1,1,0,1,0,1.43,1.4L32,5.46V13.9a1,1,0,0,0,2,0V3A1,1,0,0,0,33,2Z'%3e%3c/path%3e%3cpath%20class='clr-i-outline%20clr-i-outline-path-2'%20d='M11.54,10.73l-9,5.17a1,1,0,0,0-.5.87v11a1,1,0,0,0,.5.87l9,5.15a1,1,0,0,0,1,0l9-5.15a1,1,0,0,0,.5-.87v-11a1,1,0,0,0-.5-.87l-9-5.17A1,1,0,0,0,11.54,10.73ZM11,31.08l-7-4V18.44l7,4ZM12,21,4.81,16.87,12,12.78l7.21,4.12Zm8,6.09-7,4V22.44l7-4Z'%3e%3c/path%3e%3crect%20x='0'%20y='0'%20width='36'%20height='36'%20fill-opacity='0'%3e%3c/rect%3e%3c/g%3e%3c/svg%3e",gP=` - -// Welcome to BetterIDE Studio -// Feel free to edit the following smartweave contract code and add your own functions - - -// This is a contract function -function setName(state, action) { - // Modify state with the input - state.myName = action.input.name - return { state } -} - -function getName(state) { - // simply return the value for myName key in state - return { result: state.myName } -} - -// This is the handler for all contract functions -export function handle(state, action) { - const input = action.input - switch (input.function) { - case "setName": - return setName(state, action); - // no need for break statement because we are using return - case "getName": - return getName(state); - default: - throw new ContractError(\`Function not recognised: "\${input.function}"\`) - } -} - -`,mP=` -{ - "myName": "" -} -`,Yse={hello:{"contract.js":gP,"state.json":mP,"README.md":"# Hello"}};function vP(){const[t,e]=K.useState(JSON.parse(localStorage.getItem("contracts"))||Yse);K.useEffect(()=>{t&&localStorage.setItem("contracts",JSON.stringify(t))},[t]);function r(i,s){const a=prompt("Enter contract name");if(!a)return;if(a in t)return alert("Contract with same name already exists");const o={...t,[a]:{"contract.js":i||gP,"state.json":s||mP,"README.md":"# "+a}};return e(o),a}function n(i){const s={...t};delete s[i],e(s)}return{contracts:t,setContracts:e,newContract:r,deleteContract:n}}function eae(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function A9(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function S9(t){for(var e=1;e=0)&&(r[i]=t[i]);return r}function rae(t,e){if(t==null)return{};var r=tae(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function nae(t,e){return iae(t)||sae(t,e)||aae(t,e)||oae()}function iae(t){if(Array.isArray(t))return t}function sae(t,e){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(t)))){var r=[],n=!0,i=!1,s=void 0;try{for(var a=t[Symbol.iterator](),o;!(n=(o=a.next()).done)&&(r.push(o.value),!(e&&r.length===e));n=!0);}catch(c){i=!0,s=c}finally{try{!n&&a.return!=null&&a.return()}finally{if(i)throw s}}return r}}function aae(t,e){if(t){if(typeof t=="string")return C9(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return C9(t,e)}}function C9(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=t.length?t.apply(this,i):function(){for(var a=arguments.length,o=new Array(a),c=0;c1&&arguments[1]!==void 0?arguments[1]:{};R1.initial(t),R1.handler(e);var r={current:t},n=q0(wae)(r,e),i=q0(bae)(r),s=q0(R1.changes)(t),a=q0(xae)(r);function o(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(l){return l};return R1.selector(u),u(r.current)}function c(u){uae(n,i,s,a)(u)}return[o,c]}function xae(t,e){return sp(e)?e(t.current):e}function bae(t,e){return t.current=k9(k9({},t.current),e),e}function wae(t,e,r){return sp(e)?e(t.current):Object.keys(r).forEach(function(n){var i;return(i=e[n])===null||i===void 0?void 0:i.call(e,t.current[n])}),r}var Eae={create:yae},Aae={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function Sae(t){return function e(){for(var r=this,n=arguments.length,i=new Array(n),s=0;s=t.length?t.apply(this,i):function(){for(var a=arguments.length,o=new Array(a),c=0;c{n.current=!1}:t,e)}var ni=Zae;function cd(){}function Yl(t,e,r,n){return Jae(t,n)||Xae(t,e,r,n)}function Jae(t,e){return t.editor.getModel(AP(t,e))}function Xae(t,e,r,n){return t.editor.createModel(e,r,n?AP(t,n):void 0)}function AP(t,e){return t.Uri.parse(e)}function Qae({original:t,modified:e,language:r,originalLanguage:n,modifiedLanguage:i,originalModelPath:s,modifiedModelPath:a,keepCurrentOriginalModel:o=!1,keepCurrentModifiedModel:c=!1,theme:u="light",loading:l="Loading...",options:h={},height:f="100%",width:p="100%",className:d,wrapperProps:g={},beforeMount:y=cd,onMount:x=cd}){let[b,S]=K.useState(!1),[k,T]=K.useState(!0),_=K.useRef(null),B=K.useRef(null),N=K.useRef(null),P=K.useRef(x),D=K.useRef(y),O=K.useRef(!1);u5(()=>{let I=$m.init();return I.then(j=>(B.current=j)&&T(!1)).catch(j=>(j==null?void 0:j.type)!=="cancelation"&&console.error("Monaco initialization: error:",j)),()=>_.current?A():I.cancel()}),ni(()=>{if(_.current&&B.current){let I=_.current.getOriginalEditor(),j=Yl(B.current,t||"",n||r||"text",s||"");j!==I.getModel()&&I.setModel(j)}},[s],b),ni(()=>{if(_.current&&B.current){let I=_.current.getModifiedEditor(),j=Yl(B.current,e||"",i||r||"text",a||"");j!==I.getModel()&&I.setModel(j)}},[a],b),ni(()=>{let I=_.current.getModifiedEditor();I.getOption(B.current.editor.EditorOption.readOnly)?I.setValue(e||""):e!==I.getValue()&&(I.executeEdits("",[{range:I.getModel().getFullModelRange(),text:e||"",forceMoveMarkers:!0}]),I.pushUndoStop())},[e],b),ni(()=>{var I,j;(j=(I=_.current)==null?void 0:I.getModel())==null||j.original.setValue(t||"")},[t],b),ni(()=>{let{original:I,modified:j}=_.current.getModel();B.current.editor.setModelLanguage(I,n||r||"text"),B.current.editor.setModelLanguage(j,i||r||"text")},[r,n,i],b),ni(()=>{var I;(I=B.current)==null||I.editor.setTheme(u)},[u],b),ni(()=>{var I;(I=_.current)==null||I.updateOptions(h)},[h],b);let E=K.useCallback(()=>{var H;if(!B.current)return;D.current(B.current);let I=Yl(B.current,t||"",n||r||"text",s||""),j=Yl(B.current,e||"",i||r||"text",a||"");(H=_.current)==null||H.setModel({original:I,modified:j})},[r,e,i,t,n,s,a]),F=K.useCallback(()=>{var I;!O.current&&N.current&&(_.current=B.current.editor.createDiffEditor(N.current,{automaticLayout:!0,...h}),E(),(I=B.current)==null||I.editor.setTheme(u),S(!0),O.current=!0)},[h,u,E]);K.useEffect(()=>{b&&P.current(_.current,B.current)},[b]),K.useEffect(()=>{!k&&!b&&F()},[k,b,F]);function A(){var j,H,G,z;let I=(j=_.current)==null?void 0:j.getModel();o||((H=I==null?void 0:I.original)==null||H.dispose()),c||((G=I==null?void 0:I.modified)==null||G.dispose()),(z=_.current)==null||z.dispose()}return Pr.createElement(EP,{width:p,height:f,isEditorReady:b,loading:l,_ref:N,className:d,wrapperProps:g})}var Yae=Qae;K.memo(Yae);function eoe(){let[t,e]=K.useState($m.__getMonacoInstance());return u5(()=>{let r;return t||(r=$m.init(),r.then(n=>{e(n)})),()=>r==null?void 0:r.cancel()}),t}var SP=eoe;function toe(t){let e=K.useRef();return K.useEffect(()=>{e.current=t},[t]),e.current}var roe=toe,M1=new Map;function noe({defaultValue:t,defaultLanguage:e,defaultPath:r,value:n,language:i,path:s,theme:a="light",line:o,loading:c="Loading...",options:u={},overrideServices:l={},saveViewState:h=!0,keepCurrentModel:f=!1,width:p="100%",height:d="100%",className:g,wrapperProps:y={},beforeMount:x=cd,onMount:b=cd,onChange:S,onValidate:k=cd}){let[T,_]=K.useState(!1),[B,N]=K.useState(!0),P=K.useRef(null),D=K.useRef(null),O=K.useRef(null),E=K.useRef(b),F=K.useRef(x),A=K.useRef(),I=K.useRef(n),j=roe(s),H=K.useRef(!1),G=K.useRef(!1);u5(()=>{let L=$m.init();return L.then(q=>(P.current=q)&&N(!1)).catch(q=>(q==null?void 0:q.type)!=="cancelation"&&console.error("Monaco initialization: error:",q)),()=>D.current?R():L.cancel()}),ni(()=>{var q,ee,X,oe;let L=Yl(P.current,t||n||"",e||i||"",s||r||"");L!==((q=D.current)==null?void 0:q.getModel())&&(h&&M1.set(j,(ee=D.current)==null?void 0:ee.saveViewState()),(X=D.current)==null||X.setModel(L),h&&((oe=D.current)==null||oe.restoreViewState(M1.get(s))))},[s],T),ni(()=>{var L;(L=D.current)==null||L.updateOptions(u)},[u],T),ni(()=>{!D.current||n===void 0||(D.current.getOption(P.current.editor.EditorOption.readOnly)?D.current.setValue(n):n!==D.current.getValue()&&(G.current=!0,D.current.executeEdits("",[{range:D.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),D.current.pushUndoStop(),G.current=!1))},[n],T),ni(()=>{var q,ee;let L=(q=D.current)==null?void 0:q.getModel();L&&i&&((ee=P.current)==null||ee.editor.setModelLanguage(L,i))},[i],T),ni(()=>{var L;o!==void 0&&((L=D.current)==null||L.revealLine(o))},[o],T),ni(()=>{var L;(L=P.current)==null||L.editor.setTheme(a)},[a],T);let z=K.useCallback(()=>{var L;if(!(!O.current||!P.current)&&!H.current){F.current(P.current);let q=s||r,ee=Yl(P.current,n||t||"",e||i||"",q||"");D.current=(L=P.current)==null?void 0:L.editor.create(O.current,{model:ee,automaticLayout:!0,...u},l),h&&D.current.restoreViewState(M1.get(q)),P.current.editor.setTheme(a),o!==void 0&&D.current.revealLine(o),_(!0),H.current=!0}},[t,e,r,n,i,s,u,l,h,a,o]);K.useEffect(()=>{T&&E.current(D.current,P.current)},[T]),K.useEffect(()=>{!B&&!T&&z()},[B,T,z]),I.current=n,K.useEffect(()=>{var L,q;T&&S&&((L=A.current)==null||L.dispose(),A.current=(q=D.current)==null?void 0:q.onDidChangeModelContent(ee=>{G.current||S(D.current.getValue(),ee)}))},[T,S]),K.useEffect(()=>{if(T){let L=P.current.editor.onDidChangeMarkers(q=>{var X;let ee=(X=D.current.getModel())==null?void 0:X.uri;if(ee&&q.find(oe=>oe.path===ee.path)){let oe=P.current.editor.getModelMarkers({resource:ee});k==null||k(oe)}});return()=>{L==null||L.dispose()}}return()=>{}},[T,k]);function R(){var L,q;(L=A.current)==null||L.dispose(),f?h&&M1.set(s,D.current.saveViewState()):(q=D.current.getModel())==null||q.dispose(),D.current.dispose()}return Pr.createElement(EP,{width:p,height:d,isEditorReady:T,loading:c,_ref:O,className:g,wrapperProps:y})}var ioe=noe,CP=K.memo(ioe);const soe="vs-dark",aoe=!0,ooe=[{background:"0A1917",token:""},{foreground:"202020",fontStyle:"italic",token:"comment"},{foreground:"fc6f09",token:"keyword"},{foreground:"fc6f09",token:"storage"},{foreground:"fc83ff",token:"entity.other.inherited-class"},{foreground:"58c554",token:"constant.numeric"},{foreground:"1edafb",token:"constant"},{foreground:"8dff0a",token:"constant.library"},{foreground:"fc6f09",token:"support.function"},{foreground:"fdc251",token:"constant.language"},{foreground:"8dff0a",token:"string"},{foreground:"1edafb",token:"support.type"},{foreground:"8dff0a",token:"support.constant"},{foreground:"fc6f09",token:"meta.tag"},{foreground:"fc6f09",token:"declaration.tag"},{foreground:"fc6f09",token:"entity.name.tag"},{foreground:"ffff89",token:"entity.other.attribute-name"},{foreground:"ffffff",background:"990000",token:"invalid"},{foreground:"519f50",token:"constant.character.escaped"},{foreground:"519f50",token:"constant.character.escape"},{foreground:"519f50",token:"string source"},{foreground:"519f50",token:"string source.ruby"},{foreground:"e6e1dc",background:"144212",token:"markup.inserted"},{foreground:"e6e1dc",background:"660000",token:"markup.deleted"},{background:"2f33ab",token:"meta.diff.header"},{background:"2f33ab",token:"meta.separator.diff"},{background:"2f33ab",token:"meta.diff.index"},{background:"2f33ab",token:"meta.diff.range"}],coe={"editor.foreground":"#a4b1cd","editor.background":"#ffffff20","editor.selectionBackground":"#454545","editor.lineHighlightBackground":"#333435","editorCursor.foreground":"#FFFFFF","editorWhitespace.foreground":"#404040"},uoe={base:soe,inherit:aoe,rules:ooe,colors:coe};let L1;const loe=new Uint8Array(16);function foe(){if(!L1&&(L1=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!L1))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return L1(loe)}const zr=[];for(let t=0;t<256;++t)zr.push((t+256).toString(16).slice(1));function hoe(t,e=0){return zr[t[e+0]]+zr[t[e+1]]+zr[t[e+2]]+zr[t[e+3]]+"-"+zr[t[e+4]]+zr[t[e+5]]+"-"+zr[t[e+6]]+zr[t[e+7]]+"-"+zr[t[e+8]]+zr[t[e+9]]+"-"+zr[t[e+10]]+zr[t[e+11]]+zr[t[e+12]]+zr[t[e+13]]+zr[t[e+14]]+zr[t[e+15]]}const doe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),I9={randomUUID:doe};function F9(t,e,r){if(I9.randomUUID&&!e&&!t)return I9.randomUUID();t=t||{};const n=t.random||(t.rng||foe)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(let i=0;i<16;++i)e[r+i]=n[i];return e}return hoe(n)}const vn={home:FK,tasks:_K,boxes:PK,money:yK,users:zK,plugins:KK,wallet:VK,arrowDown:Q3,arrowLeft:AK,arrowRight:SK,search:jK,helpCircle:IK,download:kK,sort:vK,chat:DK,info:TK,menu:OK,projects:BK,deploy:xK,test:bK,browser:$K,settings:UK,executeCode:RK,delete:HK,add:LK,addCircle:MK,codeSuccess:wK,codeError:qK,codeRunning:NK};var _P={},T9=function(){function t(e,r){for(var n=0;n]/gm,function(n){return n=="&"?"&":n=="<"?"<":n==">"?">":""})}},{key:"linkify",value:function(r){return r.replace(/(https?:\/\/[^\s]+)/gm,function(n){return''+n+""})}},{key:"ansiToHtml",value:function(r,n){return this.process(r,n,!0)}},{key:"ansiToJson",value:function(r,n){return n=n||{},n.json=!0,n.clearLine=!1,this.process(r,n,!0)}},{key:"ansiToText",value:function(r){return this.process(r,{},!1)}},{key:"process",value:function(r,n,i){var s=this,a=this,o=r.split(/\033\[/),c=o.shift();n==null&&(n={}),n.clearLine=/\r/.test(r);var u=o.map(function(h){return s.processChunk(h,n,i)});if(n&&n.json){var l=a.processChunkJson("");return l.content=c,l.clearLine=n.clearLine,u.unshift(l),n.remove_empty&&(u=u.filter(function(h){return!h.isEmpty()})),u}else u.unshift(c);return u.join("")}},{key:"processChunkJson",value:function(r,n,i){n=typeof n>"u"?{}:n;var s=n.use_classes=typeof n.use_classes<"u"&&n.use_classes,a=n.key=s?"class":"color",o={content:r,fg:null,bg:null,fg_truecolor:null,bg_truecolor:null,clearLine:n.clearLine,decoration:null,was_processed:!1,isEmpty:function(){return!o.content}},c=r.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);if(!c)return o;o.content=c[4];var u=c[2].split(";");if(c[1]!==""||c[3]!=="m"||!i)return o;var l=this;for(l.decoration=null;u.length>0;){var h=u.shift(),f=parseInt(h);if(isNaN(f)||f===0)l.fg=l.bg=l.decoration=null;else if(f===1)l.decoration="bold";else if(f===2)l.decoration="dim";else if(f==3)l.decoration="italic";else if(f==4)l.decoration="underline";else if(f==5)l.decoration="blink";else if(f===7)l.decoration="reverse";else if(f===8)l.decoration="hidden";else if(f===9)l.decoration="strikethrough";else if(f==39)l.fg=null;else if(f==49)l.bg=null;else if(f>=30&&f<38)l.fg=kl[0][f%10][a];else if(f>=90&&f<98)l.fg=kl[1][f%10][a];else if(f>=40&&f<48)l.bg=kl[0][f%10][a];else if(f>=100&&f<108)l.bg=kl[1][f%10][a];else if(f===38||f===48){var p=f===38;if(u.length>=1){var d=u.shift();if(d==="5"&&u.length>=1){var g=parseInt(u.shift());if(g>=0&&g<=255)if(!s)this.PALETTE_COLORS||l.setupPalette(),p?l.fg=this.PALETTE_COLORS[g]:l.bg=this.PALETTE_COLORS[g];else{var y=g>=16?"ansi-palette-"+g:kl[g>7?1:0][g%8].class;p?l.fg=y:l.bg=y}}else if(d==="2"&&u.length>=3){var x=parseInt(u.shift()),b=parseInt(u.shift()),S=parseInt(u.shift());if(x>=0&&x<=255&&b>=0&&b<=255&&S>=0&&S<=255){var k=x+", "+b+", "+S;s?p?(l.fg="ansi-truecolor",l.fg_truecolor=k):(l.bg="ansi-truecolor",l.bg_truecolor=k):p?l.fg=k:l.bg=k}}}}}return l.fg===null&&l.bg===null&&l.decoration===null||(o.fg=l.fg,o.bg=l.bg,o.fg_truecolor=l.fg_truecolor,o.bg_truecolor=l.bg_truecolor,o.decoration=l.decoration,o.was_processed=!0),o}},{key:"processChunk",value:function(r,n,i){var s=this;n=n||{};var a=this.processChunkJson(r,n,i);if(n.json)return a;if(a.isEmpty())return"";if(!a.was_processed)return a.content;var o=n.use_classes,c=[],u=[],l={},h=function(p){var d=[],g=void 0;for(g in p)p.hasOwnProperty(g)&&d.push("data-"+g+'="'+s.escapeForHtml(p[g])+'"');return d.length>0?" "+d.join(" "):""};return a.fg&&(o?(u.push(a.fg+"-fg"),a.fg_truecolor!==null&&(l["ansi-truecolor-fg"]=a.fg_truecolor,a.fg_truecolor=null)):c.push("color:rgb("+a.fg+")")),a.bg&&(o?(u.push(a.bg+"-bg"),a.bg_truecolor!==null&&(l["ansi-truecolor-bg"]=a.bg_truecolor,a.bg_truecolor=null)):c.push("background-color:rgb("+a.bg+")")),a.decoration&&(o?u.push("ansi-"+a.decoration):a.decoration==="bold"?c.push("font-weight:bold"):a.decoration==="dim"?c.push("opacity:0.5"):a.decoration==="italic"?c.push("font-style:italic"):a.decoration==="reverse"?c.push("filter:invert(100%)"):a.decoration==="hidden"?c.push("visibility:hidden"):a.decoration==="strikethrough"?c.push("text-decoration:line-through"):c.push("text-decoration:"+a.decoration)),o?'"+a.content+"":'"+a.content+""}}]),t}(),moe=goe,my={exports:{}};function l5(t){if(!t)return"";if(!/\r/.test(t))return t;for(t=t.replace(/\r+\n/gm,` -`);/\r./.test(t);)t=t.replace(/^([^\r\n]*)\r+([^\r\n]+)/gm,function(e,r,n){return n+r.slice(n.length)});return t}function voe(t){for(var e=0,r=0;r0;){var n=voe(e);r.push(e[n]),e=e.slice(n+1)}return r.join("\r")}function yoe(t){if(!t)return"";if(!/\r/.test(t))return t;if(!/\n/.test(t))return P9(t);t=t.replace(/\r+\n/gm,` -`);var e=t.lastIndexOf(` -`);return l5(t.slice(0,e))+` -`+P9(t.slice(e+1))}my.exports=l5;my.exports.escapeCarriageReturn=l5;my.exports.escapeCarriageReturnSafe=yoe;var xoe=my.exports,boe=We&&We.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},woe=We&&We.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(_P,"__esModule",{value:!0});const Eoe=boe(moe),Aoe=xoe,_g=woe(K);function Soe(t,e=!1){return t=Aoe.escapeCarriageReturn(Ioe(t)),Eoe.default.ansiToJson(t,{json:!0,remove_empty:!0,use_classes:e})}function Coe(t){let e="";return t.bg&&(e+=`${t.bg}-bg `),t.fg&&(e+=`${t.fg}-fg `),t.decoration&&(e+=`ansi-${t.decoration} `),e===""?null:(e=e.substring(0,e.length-1),e)}function _oe(t){const e={};return t.bg&&(e.backgroundColor=`rgb(${t.bg})`),t.fg&&(e.color=`rgb(${t.fg})`),e}function koe(t,e,r,n){const i=e?null:_oe(r),s=e?Coe(r):null;if(!t)return _g.createElement("span",{style:i,key:n,className:s},r.content);const a=[],o=/(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g;let c=0,u;for(;(u=o.exec(r.content))!==null;){const[,l,h]=u,f=u.index+l.length;f>c&&a.push(r.content.substring(c,f));const p=h.startsWith("www.")?`http://${h}`:h;a.push(_g.createElement("a",{key:c,href:p,target:"_blank"},`${h}`)),c=o.lastIndex}return c"u")throw new Error(e)}function Toe(){return Math.random().toString(36).substr(2,8)}function O9(t,e){return{usr:t.state,key:t.key,idx:e}}function b4(t,e,r,n){return r===void 0&&(r=null),ap({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?vy(e):e,{state:r,key:e&&e.key||n||Toe()})}function BP(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function vy(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function Poe(t,e,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:s=!1}=n,a=i.history,o=au.Pop,c=null,u=l();u==null&&(u=0,a.replaceState(ap({},a.state,{idx:u}),""));function l(){return(a.state||{idx:null}).idx}function h(){o=au.Pop;let y=l(),x=y==null?null:y-u;u=y,c&&c({action:o,location:g.location,delta:x})}function f(y,x){o=au.Push;let b=b4(g.location,y,x);r&&r(b,y),u=l()+1;let S=O9(b,u),k=g.createHref(b);try{a.pushState(S,"",k)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;i.location.assign(k)}s&&c&&c({action:o,location:g.location,delta:1})}function p(y,x){o=au.Replace;let b=b4(g.location,y,x);r&&r(b,y),u=l();let S=O9(b,u),k=g.createHref(b);a.replaceState(S,"",k),s&&c&&c({action:o,location:g.location,delta:0})}function d(y){let x=i.location.origin!=="null"?i.location.origin:i.location.href,b=typeof y=="string"?y:BP(y);return fa(x,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,x)}let g={get action(){return o},get location(){return t(i,a)},listen(y){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(N9,h),c=y,()=>{i.removeEventListener(N9,h),c=null}},createHref(y){return e(i,y)},createURL:d,encodeLocation(y){let x=d(y);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:f,replace:p,go(y){return a.go(y)}};return g}var D9;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(D9||(D9={}));function Noe(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function Ooe(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?vy(t):t;return{pathname:r?r.startsWith("/")?r:Doe(r,e):e,search:joe(n),hash:Uoe(i)}}function Doe(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Jx(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Roe(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function Moe(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=vy(t):(i=ap({},t),fa(!i.pathname||!i.pathname.includes("?"),Jx("?","pathname","search",i)),fa(!i.pathname||!i.pathname.includes("#"),Jx("#","pathname","hash",i)),fa(!i.search||!i.search.includes("#"),Jx("#","search","hash",i)));let s=t===""||i.pathname==="",a=s?"/":i.pathname,o;if(a==null)o=r;else if(n){let h=e[e.length-1].replace(/^\//,"").split("/");if(a.startsWith("..")){let f=a.split("/");for(;f[0]==="..";)f.shift(),h.pop();i.pathname=f.join("/")}o="/"+h.join("/")}else{let h=e.length-1;if(a.startsWith("..")){let f=a.split("/");for(;f[0]==="..";)f.shift(),h-=1;i.pathname=f.join("/")}o=h>=0?e[h]:"/"}let c=Ooe(i,o),u=a&&a!=="/"&&a.endsWith("/"),l=(s||a===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(u||l)&&(c.pathname+="/"),c}const Loe=t=>t.join("/").replace(/\/\/+/g,"/"),joe=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Uoe=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,IP=["post","put","patch","delete"];new Set(IP);const $oe=["get",...IP];new Set($oe);/** - * React Router v6.20.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function w4(){return w4=Object.assign?Object.assign.bind():function(t){for(var e=1;ec.pathnameBase)),a=K.useRef(!1);return PP(()=>{a.current=!0}),K.useCallback(function(c,u){if(u===void 0&&(u={}),!a.current)return;if(typeof c=="number"){r.go(c);return}let l=Moe(c,JSON.parse(s),i,u.relative==="path");t==null&&e!=="/"&&(l.pathname=l.pathname==="/"?e:Loe([e,l.pathname])),(u.replace?r.replace:r.push)(l,u.state,u)},[e,r,s,i,t])}var NP=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(NP||{}),OP=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(OP||{});function Voe(t){let e=K.useContext(FP);return e||fa(!1),e}function qoe(t){let e=K.useContext(d5);return e||fa(!1),e}function Koe(t){let e=qoe(),r=e.matches[e.matches.length-1];return r.route.id||fa(!1),r.route.id}function Woe(){let{router:t}=Voe(NP.UseNavigateStable),e=Koe(OP.UseNavigateStable),r=K.useRef(!1);return PP(()=>{r.current=!0}),K.useCallback(function(i,s){s===void 0&&(s={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,w4({fromRouteId:e},s)))},[t,e])}function Goe(t){let{basename:e="/",children:r=null,location:n,navigationType:i=au.Pop,navigator:s,static:a=!1}=t;p5()&&fa(!1);let o=e.replace(/^\/*/,"/"),c=K.useMemo(()=>({basename:o,navigator:s,static:a}),[o,s,a]);typeof n=="string"&&(n=vy(n));let{pathname:u="/",search:l="",hash:h="",state:f=null,key:p="default"}=n,d=K.useMemo(()=>{let g=Noe(u,o);return g==null?null:{location:{pathname:g,search:l,hash:h,state:f,key:p},navigationType:i}},[o,u,l,h,f,p,i]);return d==null?null:K.createElement(f5.Provider,{value:c},K.createElement(h5.Provider,{children:r,value:d}))}new Promise(()=>{});/** - * React Router DOM v6.20.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function E4(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,r)=>{let n=t[r];return e.concat(Array.isArray(n)?n.map(i=>[r,i]):[[r,n]])},[]))}function Zoe(t,e){let r=E4(t);return e&&e.forEach((n,i)=>{r.has(i)||e.getAll(i).forEach(s=>{r.append(i,s)})}),r}const Joe="startTransition",R9=Y9[Joe];function Xoe(t){let{basename:e,children:r,future:n,window:i}=t,s=K.useRef();s.current==null&&(s.current=Foe({window:i,v5Compat:!0}));let a=s.current,[o,c]=K.useState({action:a.action,location:a.location}),{v7_startTransition:u}=n||{},l=K.useCallback(h=>{u&&R9?R9(()=>c(h)):c(h)},[c,u]);return K.useLayoutEffect(()=>a.listen(l),[a,l]),K.createElement(Goe,{basename:e,children:r,location:o.location,navigationType:o.action,navigator:a})}var M9;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(M9||(M9={}));var L9;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(L9||(L9={}));function yy(t){let e=K.useRef(E4(t)),r=K.useRef(!1),n=TP(),i=K.useMemo(()=>Zoe(n.search,r.current?null:e.current),[n.search]),s=Hoe(),a=K.useCallback((o,c)=>{const u=E4(typeof o=="function"?o(i):o);r.current=!0,s("?"+u,c)},[s,i]);return[i,a]}let Qoe={data:""},Yoe=t=>typeof window=="object"?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||Qoe,ece=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,tce=/\/\*[^]*?\*\/| +/g,j9=/\n+/g,qo=(t,e)=>{let r="",n="",i="";for(let s in t){let a=t[s];s[0]=="@"?s[1]=="i"?r=s+" "+a+";":n+=s[1]=="f"?qo(a,s):s+"{"+qo(a,s[1]=="k"?"":e)+"}":typeof a=="object"?n+=qo(a,e?e.replace(/([^,])+/g,o=>s.replace(/(^:.*)|([^,])+/g,c=>/&/.test(c)?c.replace(/&/g,o):o?o+" "+c:c)):s):a!=null&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=qo.p?qo.p(s,a):s+":"+a+";")}return r+(e&&i?e+"{"+i+"}":i)+n},Ea={},DP=t=>{if(typeof t=="object"){let e="";for(let r in t)e+=r+DP(t[r]);return e}return t},rce=(t,e,r,n,i)=>{let s=DP(t),a=Ea[s]||(Ea[s]=(c=>{let u=0,l=11;for(;u>>0;return"go"+l})(s));if(!Ea[a]){let c=s!==t?t:(u=>{let l,h,f=[{}];for(;l=ece.exec(u.replace(tce,""));)l[4]?f.shift():l[3]?(h=l[3].replace(j9," ").trim(),f.unshift(f[0][h]=f[0][h]||{})):f[0][l[1]]=l[2].replace(j9," ").trim();return f[0]})(t);Ea[a]=qo(i?{["@keyframes "+a]:c}:c,r?"":"."+a)}let o=r&&Ea.g?Ea.g:null;return r&&(Ea.g=Ea[a]),((c,u,l,h)=>{h?u.data=u.data.replace(h,c):u.data.indexOf(c)===-1&&(u.data=l?c+u.data:u.data+c)})(Ea[a],e,n,o),a},nce=(t,e,r)=>t.reduce((n,i,s)=>{let a=e[s];if(a&&a.call){let o=a(r),c=o&&o.props&&o.props.className||/^go/.test(o)&&o;a=c?"."+c:o&&typeof o=="object"?o.props?"":qo(o,""):o===!1?"":o}return n+i+(a??"")},"");function xy(t){let e=this||{},r=t.call?t(e.p):t;return rce(r.unshift?r.raw?nce(r,[].slice.call(arguments,1),e.p):r.reduce((n,i)=>Object.assign(n,i&&i.call?i(e.p):i),{}):r,Yoe(e.target),e.g,e.o,e.k)}let RP,A4,S4;xy.bind({g:1});let xo=xy.bind({k:1});function ice(t,e,r,n){qo.p=e,RP=t,A4=r,S4=n}function Vc(t,e){let r=this||{};return function(){let n=arguments;function i(s,a){let o=Object.assign({},s),c=o.className||i.className;r.p=Object.assign({theme:A4&&A4()},o),r.o=/ *go\d+/.test(c),o.className=xy.apply(r,n)+(c?" "+c:""),e&&(o.ref=a);let u=t;return t[0]&&(u=o.as||t,delete o.as),S4&&u[0]&&S4(o),RP(u,o)}return e?e(i):i}}var sce=t=>typeof t=="function",Hm=(t,e)=>sce(t)?t(e):t,ace=(()=>{let t=0;return()=>(++t).toString()})(),MP=(()=>{let t;return()=>{if(t===void 0&&typeof window<"u"){let e=matchMedia("(prefers-reduced-motion: reduce)");t=!e||e.matches}return t}})(),oce=20,kg=new Map,cce=1e3,U9=t=>{if(kg.has(t))return;let e=setTimeout(()=>{kg.delete(t),pl({type:4,toastId:t})},cce);kg.set(t,e)},uce=t=>{let e=kg.get(t);e&&clearTimeout(e)},C4=(t,e)=>{switch(e.type){case 0:return{...t,toasts:[e.toast,...t.toasts].slice(0,oce)};case 1:return e.toast.id&&uce(e.toast.id),{...t,toasts:t.toasts.map(s=>s.id===e.toast.id?{...s,...e.toast}:s)};case 2:let{toast:r}=e;return t.toasts.find(s=>s.id===r.id)?C4(t,{type:1,toast:r}):C4(t,{type:0,toast:r});case 3:let{toastId:n}=e;return n?U9(n):t.toasts.forEach(s=>{U9(s.id)}),{...t,toasts:t.toasts.map(s=>s.id===n||n===void 0?{...s,visible:!1}:s)};case 4:return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(s=>s.id!==e.toastId)};case 5:return{...t,pausedAt:e.time};case 6:let i=e.time-(t.pausedAt||0);return{...t,pausedAt:void 0,toasts:t.toasts.map(s=>({...s,pauseDuration:s.pauseDuration+i}))}}},Bg=[],Ig={toasts:[],pausedAt:void 0},pl=t=>{Ig=C4(Ig,t),Bg.forEach(e=>{e(Ig)})},lce={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},fce=(t={})=>{let[e,r]=K.useState(Ig);K.useEffect(()=>(Bg.push(r),()=>{let i=Bg.indexOf(r);i>-1&&Bg.splice(i,1)}),[e]);let n=e.toasts.map(i=>{var s,a;return{...t,...t[i.type],...i,duration:i.duration||((s=t[i.type])==null?void 0:s.duration)||(t==null?void 0:t.duration)||lce[i.type],style:{...t.style,...(a=t[i.type])==null?void 0:a.style,...i.style}}});return{...e,toasts:n}},hce=(t,e="blank",r)=>({createdAt:Date.now(),visible:!0,type:e,ariaProps:{role:"status","aria-live":"polite"},message:t,pauseDuration:0,...r,id:(r==null?void 0:r.id)||ace()}),Jp=t=>(e,r)=>{let n=hce(e,t,r);return pl({type:2,toast:n}),n.id},Rn=(t,e)=>Jp("blank")(t,e);Rn.error=Jp("error");Rn.success=Jp("success");Rn.loading=Jp("loading");Rn.custom=Jp("custom");Rn.dismiss=t=>{pl({type:3,toastId:t})};Rn.remove=t=>pl({type:4,toastId:t});Rn.promise=(t,e,r)=>{let n=Rn.loading(e.loading,{...r,...r==null?void 0:r.loading});return t.then(i=>(Rn.success(Hm(e.success,i),{id:n,...r,...r==null?void 0:r.success}),i)).catch(i=>{Rn.error(Hm(e.error,i),{id:n,...r,...r==null?void 0:r.error})}),t};var dce=(t,e)=>{pl({type:1,toast:{id:t,height:e}})},pce=()=>{pl({type:5,time:Date.now()})},gce=t=>{let{toasts:e,pausedAt:r}=fce(t);K.useEffect(()=>{if(r)return;let s=Date.now(),a=e.map(o=>{if(o.duration===1/0)return;let c=(o.duration||0)+o.pauseDuration-(s-o.createdAt);if(c<0){o.visible&&Rn.dismiss(o.id);return}return setTimeout(()=>Rn.dismiss(o.id),c)});return()=>{a.forEach(o=>o&&clearTimeout(o))}},[e,r]);let n=K.useCallback(()=>{r&&pl({type:6,time:Date.now()})},[r]),i=K.useCallback((s,a)=>{let{reverseOrder:o=!1,gutter:c=8,defaultPosition:u}=a||{},l=e.filter(p=>(p.position||u)===(s.position||u)&&p.height),h=l.findIndex(p=>p.id===s.id),f=l.filter((p,d)=>dp.visible).slice(...o?[f+1]:[0,f]).reduce((p,d)=>p+(d.height||0)+c,0)},[e]);return{toasts:e,handlers:{updateHeight:dce,startPause:pce,endPause:n,calculateOffset:i}}},mce=xo` -from { - transform: scale(0) rotate(45deg); - opacity: 0; -} -to { - transform: scale(1) rotate(45deg); - opacity: 1; -}`,vce=xo` -from { - transform: scale(0); - opacity: 0; -} -to { - transform: scale(1); - opacity: 1; -}`,yce=xo` -from { - transform: scale(0) rotate(90deg); - opacity: 0; -} -to { - transform: scale(1) rotate(90deg); - opacity: 1; -}`,xce=Vc("div")` - width: 20px; - opacity: 0; - height: 20px; - border-radius: 10px; - background: ${t=>t.primary||"#ff4b4b"}; - position: relative; - transform: rotate(45deg); - - animation: ${mce} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) - forwards; - animation-delay: 100ms; - - &:after, - &:before { - content: ''; - animation: ${vce} 0.15s ease-out forwards; - animation-delay: 150ms; - position: absolute; - border-radius: 3px; - opacity: 0; - background: ${t=>t.secondary||"#fff"}; - bottom: 9px; - left: 4px; - height: 2px; - width: 12px; - } - - &:before { - animation: ${yce} 0.15s ease-out forwards; - animation-delay: 180ms; - transform: rotate(90deg); - } -`,bce=xo` - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -`,wce=Vc("div")` - width: 12px; - height: 12px; - box-sizing: border-box; - border: 2px solid; - border-radius: 100%; - border-color: ${t=>t.secondary||"#e0e0e0"}; - border-right-color: ${t=>t.primary||"#616161"}; - animation: ${bce} 1s linear infinite; -`,Ece=xo` -from { - transform: scale(0) rotate(45deg); - opacity: 0; -} -to { - transform: scale(1) rotate(45deg); - opacity: 1; -}`,Ace=xo` -0% { - height: 0; - width: 0; - opacity: 0; -} -40% { - height: 0; - width: 6px; - opacity: 1; -} -100% { - opacity: 1; - height: 10px; -}`,Sce=Vc("div")` - width: 20px; - opacity: 0; - height: 20px; - border-radius: 10px; - background: ${t=>t.primary||"#61d345"}; - position: relative; - transform: rotate(45deg); - - animation: ${Ece} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) - forwards; - animation-delay: 100ms; - &:after { - content: ''; - box-sizing: border-box; - animation: ${Ace} 0.2s ease-out forwards; - opacity: 0; - animation-delay: 200ms; - position: absolute; - border-right: 2px solid; - border-bottom: 2px solid; - border-color: ${t=>t.secondary||"#fff"}; - bottom: 6px; - left: 6px; - height: 10px; - width: 6px; - } -`,Cce=Vc("div")` - position: absolute; -`,_ce=Vc("div")` - position: relative; - display: flex; - justify-content: center; - align-items: center; - min-width: 20px; - min-height: 20px; -`,kce=xo` -from { - transform: scale(0.6); - opacity: 0.4; -} -to { - transform: scale(1); - opacity: 1; -}`,Bce=Vc("div")` - position: relative; - transform: scale(0.6); - opacity: 0.4; - min-width: 20px; - animation: ${kce} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275) - forwards; -`,Ice=({toast:t})=>{let{icon:e,type:r,iconTheme:n}=t;return e!==void 0?typeof e=="string"?K.createElement(Bce,null,e):e:r==="blank"?null:K.createElement(_ce,null,K.createElement(wce,{...n}),r!=="loading"&&K.createElement(Cce,null,r==="error"?K.createElement(xce,{...n}):K.createElement(Sce,{...n})))},Fce=t=>` -0% {transform: translate3d(0,${t*-200}%,0) scale(.6); opacity:.5;} -100% {transform: translate3d(0,0,0) scale(1); opacity:1;} -`,Tce=t=>` -0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;} -100% {transform: translate3d(0,${t*-150}%,-1px) scale(.6); opacity:0;} -`,Pce="0%{opacity:0;} 100%{opacity:1;}",Nce="0%{opacity:1;} 100%{opacity:0;}",Oce=Vc("div")` - display: flex; - align-items: center; - background: #fff; - color: #363636; - line-height: 1.3; - will-change: transform; - box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05); - max-width: 350px; - pointer-events: auto; - padding: 8px 10px; - border-radius: 8px; -`,Dce=Vc("div")` - display: flex; - justify-content: center; - margin: 4px 10px; - color: inherit; - flex: 1 1 auto; - white-space: pre-line; -`,Rce=(t,e)=>{let r=t.includes("top")?1:-1,[n,i]=MP()?[Pce,Nce]:[Fce(r),Tce(r)];return{animation:e?`${xo(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${xo(i)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},Mce=K.memo(({toast:t,position:e,style:r,children:n})=>{let i=t.height?Rce(t.position||e||"top-center",t.visible):{opacity:0},s=K.createElement(Ice,{toast:t}),a=K.createElement(Dce,{...t.ariaProps},Hm(t.message,t));return K.createElement(Oce,{className:t.className,style:{...i,...r,...t.style}},typeof n=="function"?n({icon:s,message:a}):K.createElement(K.Fragment,null,s,a))});ice(K.createElement);var Lce=({id:t,className:e,style:r,onHeightUpdate:n,children:i})=>{let s=K.useCallback(a=>{if(a){let o=()=>{let c=a.getBoundingClientRect().height;n(t,c)};o(),new MutationObserver(o).observe(a,{subtree:!0,childList:!0,characterData:!0})}},[t,n]);return K.createElement("div",{ref:s,className:e,style:r},i)},jce=(t,e)=>{let r=t.includes("top"),n=r?{top:0}:{bottom:0},i=t.includes("center")?{justifyContent:"center"}:t.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:MP()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${e*(r?1:-1)}px)`,...n,...i}},Uce=xy` - z-index: 9999; - > * { - pointer-events: auto; - } -`,j1=16,$ce=({reverseOrder:t,position:e="top-center",toastOptions:r,gutter:n,children:i,containerStyle:s,containerClassName:a})=>{let{toasts:o,handlers:c}=gce(r);return K.createElement("div",{style:{position:"fixed",zIndex:9999,top:j1,left:j1,right:j1,bottom:j1,pointerEvents:"none",...s},className:a,onMouseEnter:c.startPause,onMouseLeave:c.endPause},o.map(u=>{let l=u.position||e,h=c.calculateOffset(u,{reverseOrder:t,gutter:n,defaultPosition:e}),f=jce(l,h);return K.createElement(Lce,{id:u.id,key:u.id,onHeightUpdate:c.updateHeight,className:u.visible?Uce:"",style:f},u.type==="custom"?Hm(u.message,u):i?i(u):K.createElement(Mce,{toast:u,position:l}))}))};function _4({data:t,processId:e}){const r=_h(window.arweaveWallet);return qu().message({process:e,signer:r,tags:[{name:"Action",value:"Eval"}],data:t})}function Hce({cellId:t,aosProcess:e,cellCodeItems:r,cellOutputItems:n,setCellCodeItems:i,setCellOutputItems:s,deleteCell:a,setActiveCell:o}){const[c,u]=K.useState("default");async function l(){u("running");const h=r[t];console.log("sending message",h);try{const f=await _4({data:h,processId:e}),p=await hf({message:f,process:e}),d=`${JSON.stringify(p.Output.data.output,null,2)||p.Output.data.output}`;s(g=>({...g,[t]:d})),u("success")}catch(f){console.log(f),s(p=>({...p,[t]:f.message??"Error executing this snippet"})),u("error")}}return te.jsxs("div",{className:"flex flex-col w-full justify-center max-w-[calc(90vw-12rem)] overflow-x-clip rounded-lg",children:[te.jsxs("div",{className:"flex flex-row gap-4 bg-[#093E49] px-4 py-6",children:[te.jsx(Za,{variant:"ghost",size:"icon",onClick:l,children:te.jsx(vn.executeCode,{className:"h-6 w-6"})}),te.jsx("div",{className:"flex-grow min-h-[52px] rounded-sm overflow-clip",children:te.jsx(CP,{className:"max-h-[380px] min-h-[52px]",language:"lua",theme:"merbivore",height:(r[t].split(` -`).length>20?20:r[t].split(` -`).length)*19,defaultValue:r[t],onChange:h=>{i(f=>({...f,[t]:h})),o(t)},options:{minimap:{enabled:!1},lineNumbersMinChars:2,scrollBeyondLastLine:!1,renderLineHighlight:"none"}})}),te.jsx(Za,{variant:"ghost",size:"icon",onClick:()=>a(t),children:te.jsx(vn.delete,{className:"h-6 w-6"})})]}),te.jsxs("div",{className:"flex flex-row gap-4 min-h-[32px] bg-[#093E49]/40 px-4 py-3",children:[te.jsxs("div",{className:"min-h-[32px] min-w-[30px] flex justify-center items-center",children:[c=="running"&&te.jsx(vn.codeRunning,{className:"h-4 w-4"}),c=="success"&&te.jsx(vn.codeSuccess,{className:"h-4 w-4"}),c=="error"&&te.jsx(vn.codeError,{className:"h-4 w-4"})]}),te.jsx("pre",{className:"p-2 ring-white/5 overflow-scroll min-h-[32px] max-h-[300px] flex-grow mx-2",children:(()=>{try{return te.jsx(kP,{children:`${JSON.parse(n[t])}`})}catch{return`${n[t]}`}})()}),te.jsx("div",{className:"min-w-[30px]"})]})]})}function zce(){const[t,e]=K.useState(!1),[r,n]=K.useState(null),[i,s]=K.useState(null),[a,o]=K.useState(["0"]),[c,u]=K.useState({0:"1 + 41"}),[l,h]=K.useState({0:"click the run button"}),[f,p]=yy(),[d,g]=K.useState(""),[y,x]=K.useState(!0);K.useEffect(()=>{const P=localStorage.getItem("activeProcess");if(P&&n(P),clearInterval(parseInt(sessionStorage.getItem("interval")||"0")),f.has("getcode")){const O=f.get("getcode");if(O.length!==43)return alert("Invalid process ID");g(O),N(O)}},[]),K.useEffect(()=>{async function P(){if(!r)return;x(!1);const D=await Mk({process:r,limit:1e3,from:sessionStorage.getItem("cursor")||""});D.edges.length>0&&D.edges.forEach(O=>{sessionStorage.setItem("cursor",O.cursor);const E=O.node;E.Output.print&&(console.log(E.Output.data),Rn.custom(F=>te.jsx("div",{className:`${F.visible?"animate-enter":"animate-leave"} - max-w-md w-full bg-[#121212] ring-1 ring-white/30 opacity-80 relative right-[280px] hover:right-0 bottom-10 hover:opacity-100 transition-all duration-200 shadow-lg rounded-lg pointer-events-auto text-white flex p-2 `,onClick:()=>Rn.dismiss(F.id),children:te.jsx(kP,{children:E.Output.data})}),{duration:1e4}))})}return sessionStorage.setItem("interval",setInterval(P,1e3).toString()),()=>{clearInterval(parseInt(sessionStorage.getItem("interval")||"0"))}},[r]),K.useEffect(()=>{localStorage.getItem("notebookData")===null&&localStorage.setItem("notebookData","{}");const P=JSON.parse(localStorage.getItem("notebookData"));r&&P&&(P[r]&&y?(o(P[r].cellIds),u(P[r].cellCodeItems),h(P[r].cellOutputItems),x(!1)):P[r]={cellIds:a,cellCodeItems:c,cellOutputItems:l},localStorage.setItem("notebookData",JSON.stringify(P)))},[r,a,c,l]);function b(P){h(D=>({...D,[P]:"running..."}))}const S=SP();S==null||S.editor.defineTheme("merbivore",uoe),S==null||S.editor.addEditorAction({id:"run",label:"Run",keybindings:[S.KeyMod.CtrlCmd|S.KeyCode.Enter],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:async()=>{console.log("running",i);try{b(i);const P=await _4({data:c[i],processId:r}),D=await hf({message:P,process:r});console.log(D);const O=`${JSON.stringify(D.Output.data.output,null,2)||D.Output.data.output}`;console.log(O),h(E=>({...E,[i]:O}))}catch(P){console.log(P.message)}}});async function k(){if(r)return alert("already spawned");e(!0);const P=_h(window.arweaveWallet);console.log(P);const D=await qu().spawn({module:H3,scheduler:z3,signer:P,tags:[]});console.log(D),n(D),e(!1),T()}function T(){const P=F9();o(D=>[...D,P]),u(D=>({...D,[P]:"1 + 41"})),h(D=>({...D,[P]:""}))}function _(P){o(D=>D.filter(O=>O!==P)),u(D=>(delete D[P],D)),h(D=>(delete D[P],D))}async function B(){const P=a.map(O=>c[O]);console.log("backing up",P);const D=`local json = require("json") - -if not Betteridea then - Betteridea = { - Code = {${JSON.stringify(P,null,2).slice(1,-1)}}, - AccessedBy = {}, - LastUpdated = os.time(os.date("!*t")) - } -else - Betteridea.Code = {${JSON.stringify(P,null,2).slice(1,-1)}} - Betteridea.LastUpdated = os.time(os.date("!*t")) -end - -Handlers.add( - "GetCode", - Handlers.utils.hasMatchingTag("Action","GetCode"), - function(msg) - accessed_by = Betteridea.AccessedBy[msg.From] - if not accessed_by then - Betteridea.AccessedBy[msg.From] = { - Count=1, - Latest=os.time(os.date("!*t")) - } - else - Betteridea.AccessedBy[msg.From] = { - Count = accessed_by.Count+1, - Latest=os.time(os.date("!*t")) - } - end - Handlers.utils.reply(json.encode(Betteridea.Code))(msg) - end -) -`;console.log(D);try{const O=await _4({data:D,processId:r}),E=await hf({message:O,process:r});console.log(E.Output),await navigator.clipboard.writeText(`${window.location.origin}/?getcode=${r}`),alert("shared and url copied to clipboard")}catch(O){console.log(O.message)}}async function N(P){const D=P||d||prompt("Enter the process ID or URL to import");if(!D)return;const O=D.includes("?getcode=")?D.split("?getcode=")[1]:D;if(O.length!==43)return alert("invalid process ID");console.log("importing",O);const E=_h(window.arweaveWallet),F=await qu().message({process:O,signer:E,tags:[{name:"Action",value:"GetCode"}]});console.log(F);const A=await hf({message:F,process:O});console.log(A);const I=JSON.parse(A.Messages[0].Data);console.log(I);const j=I.length,H=[],G={},z={};for(let R=0;RN(),children:"import"}),a.length>0&&te.jsx(Za,{className:"h-7",onClick:B,children:"share"})]}),t&&te.jsx("div",{className:"text-center",children:"Spawning process..."}),!t&&te.jsx(te.Fragment,{children:r?te.jsxs("div",{className:"text-center",children:["Process ID: ",te.jsx("pre",{className:"inline",children:r})]}):te.jsx(Za,{onClick:k,children:"spawn new process"})}),a.map(P=>te.jsx(Hce,{cellId:P,aosProcess:r,cellCodeItems:c,cellOutputItems:l,setCellCodeItems:u,setCellOutputItems:h,deleteCell:_,setActiveCell:s},P)),r&&te.jsxs(Za,{onClick:T,children:[te.jsx(vn.add,{className:"text-black",color:"#000000aa"})," add new cell"]})]})}function Vce(t){const e=new Date(t);return`${e.toDateString()} ${e.toTimeString()}`}function $9({data:t,processId:e}){const r=_h(window.arweaveWallet);return qu().message({process:e,signer:r,tags:[{name:"Action",value:"Eval"}],data:t})}function qce(){const[t,e]=K.useState(""),[r,n]=K.useState(!1),[i,s]=K.useState(!1),[a,o]=K.useState(""),[c,u]=K.useState(""),[l,h]=K.useState([{from:"AO",content:"To start chatting, send /register",timestamp:Date.now()}]);async function f(){if(await window.arweaveWallet.connect(["ACCESS_ADDRESS","SIGN_TRANSACTION"]),t)return alert("already spawned");n(!0);const d=_h(window.arweaveWallet);console.log(d);const g=await qu().spawn({module:H3,scheduler:z3,signer:d,tags:[]});console.log(g),e(g),localStorage.setItem("mypid",g),n(!1)}K.useEffect(()=>{const d=localStorage.getItem("mypid");d?e(d):f()},[]),K.useEffect(()=>{clearInterval(parseInt(sessionStorage.getItem("interval")||"0"));async function d(){if(!t)return;const g=await Mk({process:t,limit:1e3,from:c});console.log(g);let y="";g.edges.forEach(x=>{y=x.cursor}),y&&u(y),sessionStorage.setItem("interval",setTimeout(()=>d(),1e3).toString())}return sessionStorage.setItem("interval",setTimeout(()=>d(),1e3).toString()),()=>clearTimeout(sessionStorage.getItem("interval"))},[t]);async function p(d){if(t&&d.key==="Enter"){if(!a)return;if(s(!0),a.startsWith("/register")){console.log("registering");const g=`ao.send({Target=${c6}, Action="Register"})`,y=await $9({data:g,processId:t}),x=await hf({process:t,message:y});console.log(x.Output.data.output)}else if(a!="Inbox"){const g=`ao.send({Target="${c6}" , Data="${a.toString()}", Action="SendMessage"})`;console.log(g);const y=await $9({data:g,processId:t}),x=await hf({process:t,message:y});console.log(x.Output.data.output)}s(!1),o("")}}return te.jsxs("div",{className:"p-2 h-full max-h-[calc(100vh-5rem)] flex flex-col",children:[te.jsxs("div",{className:"flex flex-row gap-2 justify-between",children:[te.jsx("div",{children:"Welcome to AO chatroom!"}),te.jsxs("div",{children:["Your ID: ",te.jsx("pre",{className:"inline",children:t})]})]}),te.jsx("div",{className:"w-full h-full max-h-full flex-grow overflow-scroll bg-black/30 p-2 flex flex-col-reverse gap-5",children:l.map((d,g)=>te.jsxs("div",{className:"flex flex-col font-mono",children:[te.jsx("div",{className:"text-md opacity-70",children:d.from}),te.jsx("div",{className:"text-xs opacity-50",children:Vce(d.timestamp)}),te.jsxs("div",{className:"text-lg",children:["- ",d.content]})]},g))}),te.jsx("input",{type:"text",className:"w-full bg-white/80 outline-none p-1 text-black",disabled:i,value:a,placeholder:"Type message here",onKeyDown:d=>p(d),onChange:d=>o(d.target.value)})]})}const LP="Switch",[Kce,Oue]=Cv(LP),[Wce,Gce]=Kce(LP),Zce=K.forwardRef((t,e)=>{const{__scopeSwitch:r,name:n,checked:i,defaultChecked:s,required:a,disabled:o,value:c="on",onCheckedChange:u,...l}=t,[h,f]=K.useState(null),p=Jr(e,b=>f(b)),d=K.useRef(!1),g=h?!!h.closest("form"):!0,[y=!1,x]=bw({prop:i,defaultProp:s,onChange:u});return K.createElement(Wce,{scope:r,checked:y,disabled:o},K.createElement(kr.button,mt({type:"button",role:"switch","aria-checked":y,"aria-required":a,"data-state":jP(y),"data-disabled":o?"":void 0,disabled:o,value:c},l,{ref:p,onClick:Sr(t.onClick,b=>{x(S=>!S),g&&(d.current=b.isPropagationStopped(),d.current||b.stopPropagation())})})),g&&K.createElement(Qce,{control:h,bubbles:!d.current,name:n,value:c,checked:y,required:a,disabled:o,style:{transform:"translateX(-100%)"}}))}),Jce="SwitchThumb",Xce=K.forwardRef((t,e)=>{const{__scopeSwitch:r,...n}=t,i=Gce(Jce,r);return K.createElement(kr.span,mt({"data-state":jP(i.checked),"data-disabled":i.disabled?"":void 0},n,{ref:e}))}),Qce=t=>{const{control:e,checked:r,bubbles:n=!0,...i}=t,s=K.useRef(null),a=nB(r),o=Jk(e);return K.useEffect(()=>{const c=s.current,u=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(u,"checked").set;if(a!==r&&h){const f=new Event("click",{bubbles:n});h.call(c,r),c.dispatchEvent(f)}},[a,r,n]),K.createElement("input",mt({type:"checkbox","aria-hidden":!0,defaultChecked:r},i,{tabIndex:-1,ref:s,style:{...t.style,...o,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function jP(t){return t?"checked":"unchecked"}const UP=Zce,Yce=Xce,$P=K.forwardRef(({className:t,...e},r)=>te.jsx(UP,{className:Hi("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:r,children:te.jsx(Yce,{className:Hi("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));$P.displayName=UP.displayName;function eue(){const t=vP(),[e,r]=K.useState(""),[n,i]=K.useState(!0),[s,a]=K.useState(""),[o,c]=K.useState(""),[u,l]=K.useState(""),[h,f]=K.useState(!0),[p,d]=yy();K.useState("");const[g,y]=K.useState(!1),x=[{text:"Home",icon:vn.home,onClick:()=>{r("Home")}},{text:"Notebook",icon:vn.projects,onClick:()=>{r("Notebook")}}],b=[{text:"Home",icon:vn.home,onClick:()=>{r("Home"),c("")}},{text:"Contracts",icon:vn.projects,onClick:()=>{i(!n)}},{text:"Deploy",icon:vn.deploy,onClick:()=>{r("Deploy"),c("")}},{text:"Test",icon:vn.test,onClick:()=>{r("Test"),c("")}},{text:"Cloud",icon:vn.executeCode,onClick:()=>{r("Cloud"),c("")}},{text:"Showcase",icon:vn.plugins,onClick:()=>{r("Showcase"),c("")}}];K.useEffect(()=>{(async()=>{const B=window.arweaveWallet;B?(await B.getActiveAddress()||await B.connect(["ACCESS_ADDRESS","SIGN_TRANSACTION"]),y(!0)):alert("Please install the ArConnect extension")})()},[]),K.useEffect(()=>{async function B(){if(!window.arweaveWallet)return alert("Please install the ArConnect extension");try{await window.arweaveWallet.getActiveAddress(),y(!0)}catch{await window.arweaveWallet.connect(["ACCESS_ADDRESS","SIGN_TRANSACTION"]),y(!0)}if(p.has("getcode")&&h){const P=p.get("getcode");if(console.log(P),P.length!==43)return alert("Invalid process ID");r("Notebook")}}B()},[]),K.useEffect(()=>{a(""),c(""),i(!1),r("Home")},[h]);function S({text:B,Icon:N,onClick:P}){const D=e==B;return te.jsxs("div",{onClick:P,className:Hi("flex gap-1 items-center rounded-md px-3 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground cursor-pointer",D?"bg-[#006F86]":"transparent"),children:[te.jsx(N,{className:"mr-2 h-4 w-4"}),te.jsx("span",{children:B})]})}function k({filename:B}){return te.jsx("div",{className:`h-fit w-fit p-1 px-2 cursor-pointer items-center justify-center flex border rounded-lg border-white/10 ${o==B&&"bg-white/10"}`,onClick:()=>{c(B),r("Contracts")},children:B})}function T({contractname:B}){const N=s==B;function P({name:D}){return te.jsx("div",{className:`p-1 pl-5 cursor-pointer hover:bg-white/10 ${o==D&&"font-bold bg-white/10"}`,onClick:()=>{c(D),r("Contracts")},children:D})}return te.jsxs("div",{className:`w-full max-w-[150px] overflow-scroll cursor-pointer hover:bg-[#2f2f2f] ${s==B&&"bg-white/10"}`,children:[te.jsx("div",{className:"w-full p-2 font-bold",onClick:()=>{a(B),c("README.md"),r("Contracts");const D=localStorage.getItem("recents");if(D){const O=JSON.parse(D);O.includes(B)?O.splice(O.indexOf(B),1):O.length>4&&O.pop(),O.unshift(B),localStorage.setItem("recents",JSON.stringify(O))}else localStorage.setItem("recents",JSON.stringify([B]))},children:B}),N&&te.jsxs("div",{className:"w-full flex flex-col",children:[te.jsx(P,{name:"README.md"}),te.jsx(P,{name:"contract.js"}),te.jsx(P,{name:"state.json"}),te.jsxs("div",{className:"flex flex-col justify-evenly",children:[te.jsxs("button",{className:"flex items-center justify-start gap-2 py-1 pl-2 hover:bg-zinc-300/50",onClick:()=>{a(B),r("Deploy")},children:[te.jsx("img",{src:Qse,width:20}),"deploy"]}),te.jsxs("button",{className:"flex items-center justify-start gap-2 py-1 pl-2 hover:bg-zinc-300/50",onClick:()=>{const D=new vD,O=D.folder(B),E=t[B];Object.keys(E).forEach(F=>{O.file(F,E[F])}),D.generateAsync({type:"blob"}).then(function(F){xD(F,B+".zip")})},children:[te.jsx("img",{src:Xse,width:20}),"download zip"]}),te.jsxs("button",{className:"flex items-center justify-start gap-2 py-1 pl-2 hover:bg-zinc-300/50",onClick:()=>{t.deleteContract(B);const D=JSON.parse(localStorage.getItem("recents"))||[];D.includes(B)&&(D.splice(D.indexOf(B),1),localStorage.setItem("recents",JSON.stringify(D)))},children:[te.jsx("img",{src:Jse,width:17}),"delete"]})]})]})]})}function _(){if(h)switch(e){case"Notebook":return te.jsx(zce,{});case"AOChat":return te.jsx(qce,{});case"Settings":return te.jsx(E9,{});default:return te.jsx(XK,{setActiveMenuItem:r})}else switch(e){case"Contracts":return te.jsx("iframe",{className:"w-full h-full",src:`/?editor&language=${o.endsWith(".js")?"javascript":o.endsWith(".json")?"json":o.endsWith(".md")?"markdown":"text"}&file=${s}/${o}`});case"Deploy":return te.jsx(qse,{contracts:t.contracts,target:s,test:B=>{r("Test"),l(B)}});case"Test":return te.jsx(Kse,{contracts:t,target:u});case"Cloud":return te.jsx(Wse,{});case"Showcase":return te.jsx(Gse,{});case"Settings":return te.jsx(E9,{});default:return te.jsx(_D,{contracts:t,setActiveContract:a,setActiveFile:c,setActiveMenuItem:r})}}return te.jsxs("div",{className:"flex flex-col min-h-screen h-screen max-h-screen",children:[te.jsxs("div",{className:"flex h-20 min-h-[5rem] px-6 bg-[#111111]",children:[te.jsxs("div",{className:"flex justify-center items-center gap-2",children:[te.jsx("img",{src:"/logo-small.svg",className:"h-6 w-6"}),te.jsx("h1",{className:"bg-gradient-to-r from-[#006F86] to-white bg-clip-text text-2xl font-bold tracking-tight text-transparent",children:"BetterIDEa"})]}),s&&te.jsxs("div",{className:"flex items-center rounded-lg gap-2 mx-4",children:[te.jsx(k,{filename:"README.md"}),te.jsx(k,{filename:"contract.js"}),te.jsx(k,{filename:"state.json"})]}),te.jsxs("div",{className:"ml-auto flex justify-center items-center px-3 gap-2",children:[h?"AO Mode":"Warp Mode",te.jsx($P,{checked:h,onCheckedChange:B=>{f(B)}})]})]}),te.jsxs("div",{className:"grow flex",children:[te.jsxs("div",{className:"flex flex-col gap-4 px-2.5 w-48 py-4 bg-[#171717] border-r border-white/30",children:[(h?x:b).map((B,N)=>te.jsx(S,{text:B.text,Icon:B.icon,onClick:B.onClick},N)),te.jsx("div",{className:"flex-grow"}),te.jsx(S,{text:"Settings",Icon:vn.settings,onClick:()=>r("Settings")})]}),!h&&n&&te.jsxs("div",{className:"min-w-[150px] border-r border-white/30 bg-[#171717]",children:[t.contracts&&Object.keys(t.contracts).map((B,N)=>{if(B!="input")return te.jsx(T,{contractname:B},N)}),te.jsx("div",{className:"p-2 cursor-pointer hover:bg-[#2f2f2f]",onClick:()=>t.newContract(),children:"+ new"})]}),te.jsx("div",{className:"grow bg-[#1d1d1d]",children:_()})]})]})}const tue="vs-dark",rue=!0,nue=[{background:"1a1a1a",token:""},{foreground:"696969",fontStyle:"italic",token:"comment"},{foreground:"fc6f09",token:"keyword"},{foreground:"fc6f09",token:"storage"},{foreground:"fc83ff",token:"entity.other.inherited-class"},{foreground:"58c554",token:"constant.numeric"},{foreground:"1edafb",token:"constant"},{foreground:"8dff0a",token:"constant.library"},{foreground:"fc6f09",token:"support.function"},{foreground:"fdc251",token:"constant.language"},{foreground:"8dff0a",token:"string"},{foreground:"1edafb",token:"support.type"},{foreground:"8dff0a",token:"support.constant"},{foreground:"fc6f09",token:"meta.tag"},{foreground:"fc6f09",token:"declaration.tag"},{foreground:"fc6f09",token:"entity.name.tag"},{foreground:"ffff89",token:"entity.other.attribute-name"},{foreground:"ffffff",background:"990000",token:"invalid"},{foreground:"519f50",token:"constant.character.escaped"},{foreground:"519f50",token:"constant.character.escape"},{foreground:"519f50",token:"string source"},{foreground:"519f50",token:"string source.ruby"},{foreground:"e6e1dc",background:"144212",token:"markup.inserted"},{foreground:"e6e1dc",background:"660000",token:"markup.deleted"},{background:"2f33ab",token:"meta.diff.header"},{background:"2f33ab",token:"meta.separator.diff"},{background:"2f33ab",token:"meta.diff.index"},{background:"2f33ab",token:"meta.diff.range"}],iue={"editor.foreground":"#a4b1cd","editor.background":"#1a1a1a","editor.selectionBackground":"#454545","editor.lineHighlightBackground":"#333435","editorCursor.foreground":"#FFFFFF","editorWhitespace.foreground":"#404040"},sue={base:tue,inherit:rue,rules:nue,colors:iue};function aue(){const[t,e]=yy(),{contracts:r,setContracts:n}=vP(),[i,s]=K.useState(""),a=SP();a==null||a.editor.defineTheme("code",sue);const o=t.get("file").split("/"),c=o[0],u=o[1];return K.useEffect(()=>{if(!r)return;const l=JSON.parse(localStorage.getItem("contracts")||"{}"),h=l[c][u];n(l),s(h)},[]),K.useEffect(()=>{if(!i)return;const l={...r};l[c][u]=i,n(l)},[i]),te.jsx(CP,{height:"100vh",language:t.get("language"),theme:"code",defaultValue:i,onChange:l=>{s(l)}})}const oue={theme:"system",setTheme:()=>null},cue=K.createContext(oue);function uue({children:t,defaultTheme:e="system",storageKey:r="vite-ui-theme",...n}){const[i,s]=K.useState(()=>localStorage.getItem(r)||e);K.useEffect(()=>{const o=window.document.documentElement;if(o.classList.remove("light","dark"),i==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";o.classList.add(c);return}o.classList.add(i)},[i]);const a={theme:i,setTheme:o=>{localStorage.setItem(r,o),s(o)}};return te.jsx(cue.Provider,{...n,value:a,children:t})}function lue(){const[t,e]=yy();return te.jsx(uue,{defaultTheme:"dark",storageKey:"vite-ui-theme",children:t.has("editor")?te.jsx(aue,{}):te.jsx(eue,{})})}Xx.createRoot(document.getElementById("root")).render(te.jsx(Pr.StrictMode,{children:te.jsx(Xoe,{children:te.jsx(lue,{})})})); -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = [] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/assets/web.bundle.min-UIrkjpjC.js b/assets/web.bundle.min-CJ9rsceU.js similarity index 83% rename from assets/web.bundle.min-UIrkjpjC.js rename to assets/web.bundle.min-CJ9rsceU.js index d18beb9..ccb7fb3 100644 --- a/assets/web.bundle.min-UIrkjpjC.js +++ b/assets/web.bundle.min-CJ9rsceU.js @@ -1,4 +1,4 @@ -var jn=Object.defineProperty;var Dn=(t,e,r)=>e in t?jn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var j=(t,e,r)=>(Dn(t,typeof e!="symbol"?e+"":e,r),r);var Kn=Object.create,Qe=Object.defineProperty,Wn=Object.getOwnPropertyDescriptor,Fn=Object.getOwnPropertyNames,Vn=Object.getPrototypeOf,Gn=Object.prototype.hasOwnProperty,qn=(t,e,r)=>e in t?Qe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hn=(t,e)=>()=>(t&&(e=t(t=0)),e),pt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),zn=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Fn(e))!Gn.call(t,a)&&a!==r&&Qe(t,a,{get:()=>e[a],enumerable:!(i=Wn(e,a))||i.enumerable});return t},Lt=(t,e,r)=>(r=t!=null?Kn(Vn(t)):{},zn(e||!t||!t.__esModule?Qe(r,"default",{value:t,enumerable:!0}):r,t)),he=(t,e,r)=>(qn(t,typeof e!="symbol"?e+"":e,r),r),Ur=pt(t=>{at(),t.byteLength=p,t.toByteArray=E,t.fromByteArray=k;var e=[],r=[],i=typeof Uint8Array<"u"?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(c=0,l=a.length;c0)throw new Error("Invalid string. Length must be a multiple of 4");var C=b.indexOf("=");C===-1&&(C=U);var K=C===U?0:4-C%4;return[C,K]}function p(b){var U=n(b),C=U[0],K=U[1];return(C+K)*3/4-K}function S(b,U,C){return(U+C)*3/4-C}function E(b){var U,C=n(b),K=C[0],z=C[1],x=new i(S(b,K,z)),v=0,w=z>0?K-4:K,u;for(u=0;u>16&255,x[v++]=U>>8&255,x[v++]=U&255;return z===2&&(U=r[b.charCodeAt(u)]<<2|r[b.charCodeAt(u+1)]>>4,x[v++]=U&255),z===1&&(U=r[b.charCodeAt(u)]<<10|r[b.charCodeAt(u+1)]<<4|r[b.charCodeAt(u+2)]>>2,x[v++]=U>>8&255,x[v++]=U&255),x}function L(b){return e[b>>18&63]+e[b>>12&63]+e[b>>6&63]+e[b&63]}function y(b,U,C){for(var K,z=[],x=U;xw?w:v+x));return K===1?(U=b[C-1],z.push(e[U>>2]+e[U<<4&63]+"==")):K===2&&(U=(b[C-2]<<8)+b[C-1],z.push(e[U>>10]+e[U>>4&63]+e[U<<2&63]+"=")),z.join("")}}),Jn=pt(t=>{at(),t.read=function(e,r,i,a,c){var l,n,p=c*8-a-1,S=(1<>1,L=-7,y=i?c-1:0,k=i?-1:1,b=e[r+y];for(y+=k,l=b&(1<<-L)-1,b>>=-L,L+=p;L>0;l=l*256+e[r+y],y+=k,L-=8);for(n=l&(1<<-L)-1,l>>=-L,L+=a;L>0;n=n*256+e[r+y],y+=k,L-=8);if(l===0)l=1-E;else{if(l===S)return n?NaN:(b?-1:1)*(1/0);n=n+Math.pow(2,a),l=l-E}return(b?-1:1)*n*Math.pow(2,l-a)},t.write=function(e,r,i,a,c,l){var n,p,S,E=l*8-c-1,L=(1<>1,k=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=a?0:l-1,U=a?1:-1,C=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(p=isNaN(r)?1:0,n=L):(n=Math.floor(Math.log(r)/Math.LN2),r*(S=Math.pow(2,-n))<1&&(n--,S*=2),n+y>=1?r+=k/S:r+=k*Math.pow(2,1-y),r*S>=2&&(n++,S/=2),n+y>=L?(p=0,n=L):n+y>=1?(p=(r*S-1)*Math.pow(2,c),n=n+y):(p=r*Math.pow(2,y-1)*Math.pow(2,c),n=0));c>=8;e[i+b]=p&255,b+=U,p/=256,c-=8);for(n=n<0;e[i+b]=n&255,b+=U,n/=256,E-=8);e[i+b-U]|=C*128}}),oe=pt(t=>{at();var e=Ur(),r=Jn(),i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=n,t.SlowBuffer=z,t.INSPECT_MAX_BYTES=50;var a=2147483647;t.kMaxLength=a,n.TYPED_ARRAY_SUPPORT=c(),!n.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 c(){try{var s=new Uint8Array(1),h={foo:function(){return 42}};return Object.setPrototypeOf(h,Uint8Array.prototype),Object.setPrototypeOf(s,h),s.foo()===42}catch{return!1}}Object.defineProperty(n.prototype,"parent",{enumerable:!0,get:function(){if(n.isBuffer(this))return this.buffer}}),Object.defineProperty(n.prototype,"offset",{enumerable:!0,get:function(){if(n.isBuffer(this))return this.byteOffset}});function l(s){if(s>a)throw new RangeError('The value "'+s+'" is invalid for option "size"');var h=new Uint8Array(s);return Object.setPrototypeOf(h,n.prototype),h}function n(s,h,d){if(typeof s=="number"){if(typeof h=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return L(s)}return p(s,h,d)}n.poolSize=8192;function p(s,h,d){if(typeof s=="string")return y(s,h);if(ArrayBuffer.isView(s))return b(s);if(s==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof s);if(M(s,ArrayBuffer)||s&&M(s.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(M(s,SharedArrayBuffer)||s&&M(s.buffer,SharedArrayBuffer)))return U(s,h,d);if(typeof s=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var A=s.valueOf&&s.valueOf();if(A!=null&&A!==s)return n.from(A,h,d);var R=C(s);if(R)return R;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof s[Symbol.toPrimitive]=="function")return n.from(s[Symbol.toPrimitive]("string"),h,d);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof s)}n.from=function(s,h,d){return p(s,h,d)},Object.setPrototypeOf(n.prototype,Uint8Array.prototype),Object.setPrototypeOf(n,Uint8Array);function S(s){if(typeof s!="number")throw new TypeError('"size" argument must be of type number');if(s<0)throw new RangeError('The value "'+s+'" is invalid for option "size"')}function E(s,h,d){return S(s),s<=0?l(s):h!==void 0?typeof d=="string"?l(s).fill(h,d):l(s).fill(h):l(s)}n.alloc=function(s,h,d){return E(s,h,d)};function L(s){return S(s),l(s<0?0:K(s)|0)}n.allocUnsafe=function(s){return L(s)},n.allocUnsafeSlow=function(s){return L(s)};function y(s,h){if((typeof h!="string"||h==="")&&(h="utf8"),!n.isEncoding(h))throw new TypeError("Unknown encoding: "+h);var d=x(s,h)|0,A=l(d),R=A.write(s,h);return R!==d&&(A=A.slice(0,R)),A}function k(s){for(var h=s.length<0?0:K(s.length)|0,d=l(h),A=0;A=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return s|0}function z(s){return+s!=s&&(s=0),n.alloc(+s)}n.isBuffer=function(s){return s!=null&&s._isBuffer===!0&&s!==n.prototype},n.compare=function(s,h){if(M(s,Uint8Array)&&(s=n.from(s,s.offset,s.byteLength)),M(h,Uint8Array)&&(h=n.from(h,h.offset,h.byteLength)),!n.isBuffer(s)||!n.isBuffer(h))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(s===h)return 0;for(var d=s.length,A=h.length,R=0,f=Math.min(d,A);RA.length?n.from(f).copy(A,R):Uint8Array.prototype.set.call(A,f,R);else if(n.isBuffer(f))f.copy(A,R);else throw new TypeError('"list" argument must be an Array of Buffers');R+=f.length}return A};function x(s,h){if(n.isBuffer(s))return s.length;if(ArrayBuffer.isView(s)||M(s,ArrayBuffer))return s.byteLength;if(typeof s!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof s);var d=s.length,A=arguments.length>2&&arguments[2]===!0;if(!A&&d===0)return 0;for(var R=!1;;)switch(h){case"ascii":case"latin1":case"binary":return d;case"utf8":case"utf-8":return dt(s).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d*2;case"hex":return d>>>1;case"base64":return N(s).length;default:if(R)return A?-1:dt(s).length;h=(""+h).toLowerCase(),R=!0}}n.byteLength=x;function v(s,h,d){var A=!1;if((h===void 0||h<0)&&(h=0),h>this.length||((d===void 0||d>this.length)&&(d=this.length),d<=0)||(d>>>=0,h>>>=0,d<=h))return"";for(s||(s="utf8");;)switch(s){case"hex":return W(this,h,d);case"utf8":case"utf-8":return tt(this,h,d);case"ascii":return B(this,h,d);case"latin1":case"binary":return O(this,h,d);case"base64":return J(this,h,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,h,d);default:if(A)throw new TypeError("Unknown encoding: "+s);s=(s+"").toLowerCase(),A=!0}}n.prototype._isBuffer=!0;function w(s,h,d){var A=s[h];s[h]=s[d],s[d]=A}n.prototype.swap16=function(){var s=this.length;if(s%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var h=0;hh&&(s+=" ... "),""},i&&(n.prototype[i]=n.prototype.inspect),n.prototype.compare=function(s,h,d,A,R){if(M(s,Uint8Array)&&(s=n.from(s,s.offset,s.byteLength)),!n.isBuffer(s))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof s);if(h===void 0&&(h=0),d===void 0&&(d=s?s.length:0),A===void 0&&(A=0),R===void 0&&(R=this.length),h<0||d>s.length||A<0||R>this.length)throw new RangeError("out of range index");if(A>=R&&h>=d)return 0;if(A>=R)return-1;if(h>=d)return 1;if(h>>>=0,d>>>=0,A>>>=0,R>>>=0,this===s)return 0;for(var f=R-A,_=d-h,D=Math.min(f,_),Y=this.slice(A,R),lt=s.slice(h,d),ft=0;ft2147483647?d=2147483647:d<-2147483648&&(d=-2147483648),d=+d,X(d)&&(d=R?0:s.length-1),d<0&&(d=s.length+d),d>=s.length){if(R)return-1;d=s.length-1}else if(d<0)if(R)d=0;else return-1;if(typeof h=="string"&&(h=n.from(h,A)),n.isBuffer(h))return h.length===0?-1:T(s,h,d,A,R);if(typeof h=="number")return h=h&255,typeof Uint8Array.prototype.indexOf=="function"?R?Uint8Array.prototype.indexOf.call(s,h,d):Uint8Array.prototype.lastIndexOf.call(s,h,d):T(s,[h],d,A,R);throw new TypeError("val must be string, number or Buffer")}function T(s,h,d,A,R){var f=1,_=s.length,D=h.length;if(A!==void 0&&(A=String(A).toLowerCase(),A==="ucs2"||A==="ucs-2"||A==="utf16le"||A==="utf-16le")){if(s.length<2||h.length<2)return-1;f=2,_/=2,D/=2,d/=2}function Y(m,V){return f===1?m[V]:m.readUInt16BE(V*f)}var lt;if(R){var ft=-1;for(lt=d;lt<_;lt++)if(Y(s,lt)===Y(h,ft===-1?0:lt-ft)){if(ft===-1&&(ft=lt),lt-ft+1===D)return ft*f}else ft!==-1&&(lt-=lt-ft),ft=-1}else for(d+D>_&&(d=_-D),lt=d;lt>=0;lt--){for(var o=!0,g=0;gR&&(A=R)):A=R;var f=h.length;A>f/2&&(A=f/2);for(var _=0;_>>0,isFinite(d)?(d=d>>>0,A===void 0&&(A="utf8")):(A=d,d=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var R=this.length-h;if((d===void 0||d>R)&&(d=R),s.length>0&&(d<0||h<0)||h>this.length)throw new RangeError("Attempt to write outside buffer bounds");A||(A="utf8");for(var f=!1;;)switch(A){case"hex":return I(this,s,h,d);case"utf8":case"utf-8":return P(this,s,h,d);case"ascii":case"latin1":case"binary":return q(this,s,h,d);case"base64":return G(this,s,h,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return et(this,s,h,d);default:if(f)throw new TypeError("Unknown encoding: "+A);A=(""+A).toLowerCase(),f=!0}},n.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function J(s,h,d){return h===0&&d===s.length?e.fromByteArray(s):e.fromByteArray(s.slice(h,d))}function tt(s,h,d){d=Math.min(s.length,d);for(var A=[],R=h;R239?4:f>223?3:f>191?2:1;if(R+D<=d){var Y,lt,ft,o;switch(D){case 1:f<128&&(_=f);break;case 2:Y=s[R+1],(Y&192)===128&&(o=(f&31)<<6|Y&63,o>127&&(_=o));break;case 3:Y=s[R+1],lt=s[R+2],(Y&192)===128&&(lt&192)===128&&(o=(f&15)<<12|(Y&63)<<6|lt&63,o>2047&&(o<55296||o>57343)&&(_=o));break;case 4:Y=s[R+1],lt=s[R+2],ft=s[R+3],(Y&192)===128&&(lt&192)===128&&(ft&192)===128&&(o=(f&15)<<18|(Y&63)<<12|(lt&63)<<6|ft&63,o>65535&&o<1114112&&(_=o))}}_===null?(_=65533,D=1):_>65535&&(_-=65536,A.push(_>>>10&1023|55296),_=56320|_&1023),A.push(_),R+=D}return nt(A)}var st=4096;function nt(s){var h=s.length;if(h<=st)return String.fromCharCode.apply(String,s);for(var d="",A=0;AA)&&(d=A);for(var R="",f=h;fd&&(s=d),h<0?(h+=d,h<0&&(h=0)):h>d&&(h=d),hd)throw new RangeError("Trying to access beyond buffer length")}n.prototype.readUintLE=n.prototype.readUIntLE=function(s,h,d){s=s>>>0,h=h>>>0,d||Z(s,h,this.length);for(var A=this[s],R=1,f=0;++f>>0,h=h>>>0,d||Z(s,h,this.length);for(var A=this[s+--h],R=1;h>0&&(R*=256);)A+=this[s+--h]*R;return A},n.prototype.readUint8=n.prototype.readUInt8=function(s,h){return s=s>>>0,h||Z(s,1,this.length),this[s]},n.prototype.readUint16LE=n.prototype.readUInt16LE=function(s,h){return s=s>>>0,h||Z(s,2,this.length),this[s]|this[s+1]<<8},n.prototype.readUint16BE=n.prototype.readUInt16BE=function(s,h){return s=s>>>0,h||Z(s,2,this.length),this[s]<<8|this[s+1]},n.prototype.readUint32LE=n.prototype.readUInt32LE=function(s,h){return s=s>>>0,h||Z(s,4,this.length),(this[s]|this[s+1]<<8|this[s+2]<<16)+this[s+3]*16777216},n.prototype.readUint32BE=n.prototype.readUInt32BE=function(s,h){return s=s>>>0,h||Z(s,4,this.length),this[s]*16777216+(this[s+1]<<16|this[s+2]<<8|this[s+3])},n.prototype.readIntLE=function(s,h,d){s=s>>>0,h=h>>>0,d||Z(s,h,this.length);for(var A=this[s],R=1,f=0;++f=R&&(A-=Math.pow(2,8*h)),A},n.prototype.readIntBE=function(s,h,d){s=s>>>0,h=h>>>0,d||Z(s,h,this.length);for(var A=h,R=1,f=this[s+--A];A>0&&(R*=256);)f+=this[s+--A]*R;return R*=128,f>=R&&(f-=Math.pow(2,8*h)),f},n.prototype.readInt8=function(s,h){return s=s>>>0,h||Z(s,1,this.length),this[s]&128?(255-this[s]+1)*-1:this[s]},n.prototype.readInt16LE=function(s,h){s=s>>>0,h||Z(s,2,this.length);var d=this[s]|this[s+1]<<8;return d&32768?d|4294901760:d},n.prototype.readInt16BE=function(s,h){s=s>>>0,h||Z(s,2,this.length);var d=this[s+1]|this[s]<<8;return d&32768?d|4294901760:d},n.prototype.readInt32LE=function(s,h){return s=s>>>0,h||Z(s,4,this.length),this[s]|this[s+1]<<8|this[s+2]<<16|this[s+3]<<24},n.prototype.readInt32BE=function(s,h){return s=s>>>0,h||Z(s,4,this.length),this[s]<<24|this[s+1]<<16|this[s+2]<<8|this[s+3]},n.prototype.readFloatLE=function(s,h){return s=s>>>0,h||Z(s,4,this.length),r.read(this,s,!0,23,4)},n.prototype.readFloatBE=function(s,h){return s=s>>>0,h||Z(s,4,this.length),r.read(this,s,!1,23,4)},n.prototype.readDoubleLE=function(s,h){return s=s>>>0,h||Z(s,8,this.length),r.read(this,s,!0,52,8)},n.prototype.readDoubleBE=function(s,h){return s=s>>>0,h||Z(s,8,this.length),r.read(this,s,!1,52,8)};function ot(s,h,d,A,R,f){if(!n.isBuffer(s))throw new TypeError('"buffer" argument must be a Buffer instance');if(h>R||hs.length)throw new RangeError("Index out of range")}n.prototype.writeUintLE=n.prototype.writeUIntLE=function(s,h,d,A){if(s=+s,h=h>>>0,d=d>>>0,!A){var R=Math.pow(2,8*d)-1;ot(this,s,h,d,R,0)}var f=1,_=0;for(this[h]=s&255;++_>>0,d=d>>>0,!A){var R=Math.pow(2,8*d)-1;ot(this,s,h,d,R,0)}var f=d-1,_=1;for(this[h+f]=s&255;--f>=0&&(_*=256);)this[h+f]=s/_&255;return h+d},n.prototype.writeUint8=n.prototype.writeUInt8=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,1,255,0),this[h]=s&255,h+1},n.prototype.writeUint16LE=n.prototype.writeUInt16LE=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,2,65535,0),this[h]=s&255,this[h+1]=s>>>8,h+2},n.prototype.writeUint16BE=n.prototype.writeUInt16BE=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,2,65535,0),this[h]=s>>>8,this[h+1]=s&255,h+2},n.prototype.writeUint32LE=n.prototype.writeUInt32LE=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,4,4294967295,0),this[h+3]=s>>>24,this[h+2]=s>>>16,this[h+1]=s>>>8,this[h]=s&255,h+4},n.prototype.writeUint32BE=n.prototype.writeUInt32BE=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,4,4294967295,0),this[h]=s>>>24,this[h+1]=s>>>16,this[h+2]=s>>>8,this[h+3]=s&255,h+4},n.prototype.writeIntLE=function(s,h,d,A){if(s=+s,h=h>>>0,!A){var R=Math.pow(2,8*d-1);ot(this,s,h,d,R-1,-R)}var f=0,_=1,D=0;for(this[h]=s&255;++f>0)-D&255;return h+d},n.prototype.writeIntBE=function(s,h,d,A){if(s=+s,h=h>>>0,!A){var R=Math.pow(2,8*d-1);ot(this,s,h,d,R-1,-R)}var f=d-1,_=1,D=0;for(this[h+f]=s&255;--f>=0&&(_*=256);)s<0&&D===0&&this[h+f+1]!==0&&(D=1),this[h+f]=(s/_>>0)-D&255;return h+d},n.prototype.writeInt8=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,1,127,-128),s<0&&(s=255+s+1),this[h]=s&255,h+1},n.prototype.writeInt16LE=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,2,32767,-32768),this[h]=s&255,this[h+1]=s>>>8,h+2},n.prototype.writeInt16BE=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,2,32767,-32768),this[h]=s>>>8,this[h+1]=s&255,h+2},n.prototype.writeInt32LE=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,4,2147483647,-2147483648),this[h]=s&255,this[h+1]=s>>>8,this[h+2]=s>>>16,this[h+3]=s>>>24,h+4},n.prototype.writeInt32BE=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,4,2147483647,-2147483648),s<0&&(s=4294967295+s+1),this[h]=s>>>24,this[h+1]=s>>>16,this[h+2]=s>>>8,this[h+3]=s&255,h+4};function ut(s,h,d,A,R,f){if(d+A>s.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("Index out of range")}function gt(s,h,d,A,R){return h=+h,d=d>>>0,R||ut(s,h,d,4),r.write(s,h,d,A,23,4),d+4}n.prototype.writeFloatLE=function(s,h,d){return gt(this,s,h,!0,d)},n.prototype.writeFloatBE=function(s,h,d){return gt(this,s,h,!1,d)};function rt(s,h,d,A,R){return h=+h,d=d>>>0,R||ut(s,h,d,8),r.write(s,h,d,A,52,8),d+8}n.prototype.writeDoubleLE=function(s,h,d){return rt(this,s,h,!0,d)},n.prototype.writeDoubleBE=function(s,h,d){return rt(this,s,h,!1,d)},n.prototype.copy=function(s,h,d,A){if(!n.isBuffer(s))throw new TypeError("argument should be a Buffer");if(d||(d=0),!A&&A!==0&&(A=this.length),h>=s.length&&(h=s.length),h||(h=0),A>0&&A=this.length)throw new RangeError("Index out of range");if(A<0)throw new RangeError("sourceEnd out of bounds");A>this.length&&(A=this.length),s.length-h>>0,d=d===void 0?this.length:d>>>0,s||(s=0);var f;if(typeof s=="number")for(f=h;f55295&&d<57344){if(!R){if(d>56319){(h-=3)>-1&&f.push(239,191,189);continue}else if(_+1===A){(h-=3)>-1&&f.push(239,191,189);continue}R=d;continue}if(d<56320){(h-=3)>-1&&f.push(239,191,189),R=d;continue}d=(R-55296<<10|d-56320)+65536}else R&&(h-=3)>-1&&f.push(239,191,189);if(R=null,d<128){if((h-=1)<0)break;f.push(d)}else if(d<2048){if((h-=2)<0)break;f.push(d>>6|192,d&63|128)}else if(d<65536){if((h-=3)<0)break;f.push(d>>12|224,d>>6&63|128,d&63|128)}else if(d<1114112){if((h-=4)<0)break;f.push(d>>18|240,d>>12&63|128,d>>6&63|128,d&63|128)}else throw new Error("Invalid code point")}return f}function wt(s){for(var h=[],d=0;d>8,R=d%256,f.push(R),f.push(A);return f}function N(s){return e.toByteArray(mt(s))}function $(s,h,d,A){for(var R=0;R=h.length||R>=s.length);++R)h[R+d]=s[R];return R}function M(s,h){return s instanceof h||s!=null&&s.constructor!=null&&s.constructor.name!=null&&s.constructor.name===h.name}function X(s){return s!==s}var H=function(){for(var s="0123456789abcdef",h=new Array(256),d=0;d<16;++d)for(var A=d*16,R=0;R<16;++R)h[A+R]=s[d]+s[R];return h}()}),Qn=pt((t,e)=>{at();var r=e.exports={},i,a;function c(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?i=setTimeout:i=c}catch{i=c}try{typeof clearTimeout=="function"?a=clearTimeout:a=l}catch{a=l}})();function n(K){if(i===setTimeout)return setTimeout(K,0);if((i===c||!i)&&setTimeout)return i=setTimeout,setTimeout(K,0);try{return i(K,0)}catch{try{return i.call(null,K,0)}catch{return i.call(this,K,0)}}}function p(K){if(a===clearTimeout)return clearTimeout(K);if((a===l||!a)&&clearTimeout)return a=clearTimeout,clearTimeout(K);try{return a(K)}catch{try{return a.call(null,K)}catch{return a.call(this,K)}}}var S=[],E=!1,L,y=-1;function k(){!E||!L||(E=!1,L.length?S=L.concat(S):y=-1,S.length&&b())}function b(){if(!E){var K=n(k);E=!0;for(var z=S.length;z;){for(L=S,S=[];++y1)for(var x=1;x{Ct=Lt(oe()),Jt=Lt(Qn()),fr=function(t){function e(){var i=this||self;return delete t.prototype.__magic__,i}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object),Yt=fr}),Yn=pt(t=>{at(),t.supports=function(...e){let r=e.reduce((i,a)=>Object.assign(i,a),{});return Object.assign(r,{snapshots:r.snapshots||!1,permanence:r.permanence||!1,seek:r.seek||!1,clear:r.clear||!1,getMany:r.getMany||!1,keyIterator:r.keyIterator||!1,valueIterator:r.valueIterator||!1,iteratorNextv:r.iteratorNextv||!1,iteratorAll:r.iteratorAll||!1,status:r.status||!1,createIfMissing:r.createIfMissing||!1,errorIfExists:r.errorIfExists||!1,deferredOpen:r.deferredOpen||!1,promises:r.promises||!1,streams:r.streams||!1,encodings:Object.assign({},r.encodings),events:Object.assign({},r.events),additionalMethods:Object.assign({},r.additionalMethods)})}}),jt=pt((t,e)=>{at(),e.exports=class extends Error{constructor(r,i){super(r||""),typeof i=="object"&&i!==null&&(i.code&&(this.code=String(i.code)),i.expected&&(this.expected=!0),i.transient&&(this.transient=!0),i.cause&&(this.cause=i.cause)),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}}),$r=pt((t,e)=>{at();var r=null;e.exports=function(){return r===null&&(r={textEncoder:new TextEncoder,textDecoder:new TextDecoder}),r}}),Pr=pt(t=>{at();var e=jt(),r=new Set(["buffer","view","utf8"]),i=class{constructor(a){if(this.encode=a.encode||this.encode,this.decode=a.decode||this.decode,this.name=a.name||this.name,this.format=a.format||this.format,typeof this.encode!="function")throw new TypeError("The 'encode' property must be a function");if(typeof this.decode!="function")throw new TypeError("The 'decode' property must be a function");if(this.encode=this.encode.bind(this),this.decode=this.decode.bind(this),typeof this.name!="string"||this.name==="")throw new TypeError("The 'name' property must be a string");if(typeof this.format!="string"||!r.has(this.format))throw new TypeError("The 'format' property must be one of 'buffer', 'view', 'utf8'");a.createViewTranscoder&&(this.createViewTranscoder=a.createViewTranscoder),a.createBufferTranscoder&&(this.createBufferTranscoder=a.createBufferTranscoder),a.createUTF8Transcoder&&(this.createUTF8Transcoder=a.createUTF8Transcoder)}get commonName(){return this.name.split("+")[0]}createBufferTranscoder(){throw new e(`Encoding '${this.name}' cannot be transcoded to 'buffer'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createViewTranscoder(){throw new e(`Encoding '${this.name}' cannot be transcoded to 'view'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createUTF8Transcoder(){throw new e(`Encoding '${this.name}' cannot be transcoded to 'utf8'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}};t.Encoding=i}),Mr=pt(t=>{at();var{Buffer:e}=oe()||{},{Encoding:r}=Pr(),i=$r(),a=class extends r{constructor(n){super({...n,format:"buffer"})}createViewTranscoder(){return new c({encode:this.encode,decode:n=>this.decode(e.from(n.buffer,n.byteOffset,n.byteLength)),name:`${this.name}+view`})}createBufferTranscoder(){return this}},c=class extends r{constructor(n){super({...n,format:"view"})}createBufferTranscoder(){return new a({encode:n=>{let p=this.encode(n);return e.from(p.buffer,p.byteOffset,p.byteLength)},decode:this.decode,name:`${this.name}+buffer`})}createViewTranscoder(){return this}},l=class extends r{constructor(n){super({...n,format:"utf8"})}createBufferTranscoder(){return new a({encode:n=>e.from(this.encode(n),"utf8"),decode:n=>this.decode(n.toString("utf8")),name:`${this.name}+buffer`})}createViewTranscoder(){let{textEncoder:n,textDecoder:p}=i();return new c({encode:S=>n.encode(this.encode(S)),decode:S=>this.decode(p.decode(S)),name:`${this.name}+view`})}createUTF8Transcoder(){return this}};t.BufferFormat=a,t.ViewFormat=c,t.UTF8Format=l}),Xn=pt(t=>{at();var{Buffer:e}=oe()||{Buffer:{isBuffer:()=>!1}},{textEncoder:r,textDecoder:i}=$r()(),{BufferFormat:a,ViewFormat:c,UTF8Format:l}=Mr(),n=p=>p;t.utf8=new l({encode:function(p){return e.isBuffer(p)?p.toString("utf8"):ArrayBuffer.isView(p)?i.decode(p):String(p)},decode:n,name:"utf8",createViewTranscoder(){return new c({encode:function(p){return ArrayBuffer.isView(p)?p:r.encode(p)},decode:function(p){return i.decode(p)},name:`${this.name}+view`})},createBufferTranscoder(){return new a({encode:function(p){return e.isBuffer(p)?p:ArrayBuffer.isView(p)?e.from(p.buffer,p.byteOffset,p.byteLength):e.from(String(p),"utf8")},decode:function(p){return p.toString("utf8")},name:`${this.name}+buffer`})}}),t.json=new l({encode:JSON.stringify,decode:JSON.parse,name:"json"}),t.buffer=new a({encode:function(p){return e.isBuffer(p)?p:ArrayBuffer.isView(p)?e.from(p.buffer,p.byteOffset,p.byteLength):e.from(String(p),"utf8")},decode:n,name:"buffer",createViewTranscoder(){return new c({encode:function(p){return ArrayBuffer.isView(p)?p:e.from(String(p),"utf8")},decode:function(p){return e.from(p.buffer,p.byteOffset,p.byteLength)},name:`${this.name}+view`})}}),t.view=new c({encode:function(p){return ArrayBuffer.isView(p)?p:r.encode(p)},decode:n,name:"view",createBufferTranscoder(){return new a({encode:function(p){return e.isBuffer(p)?p:ArrayBuffer.isView(p)?e.from(p.buffer,p.byteOffset,p.byteLength):e.from(String(p),"utf8")},decode:n,name:`${this.name}+buffer`})}}),t.hex=new a({encode:function(p){return e.isBuffer(p)?p:e.from(String(p),"hex")},decode:function(p){return p.toString("hex")},name:"hex"}),t.base64=new a({encode:function(p){return e.isBuffer(p)?p:e.from(String(p),"base64")},decode:function(p){return p.toString("base64")},name:"base64"})}),Zn=pt(t=>{at();var e=jt(),r=Xn(),{Encoding:i}=Pr(),{BufferFormat:a,ViewFormat:c,UTF8Format:l}=Mr(),n=Symbol("formats"),p=Symbol("encodings"),S=new Set(["buffer","view","utf8"]),E=class{constructor(C){if(Array.isArray(C)){if(!C.every(K=>S.has(K)))throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}else throw new TypeError("The first argument 'formats' must be an array");this[p]=new Map,this[n]=new Set(C);for(let K in r)try{this.encoding(K)}catch(z){if(z.code!=="LEVEL_ENCODING_NOT_SUPPORTED")throw z}}encodings(){return Array.from(new Set(this[p].values()))}encoding(C){let K=this[p].get(C);if(K===void 0){if(typeof C=="string"&&C!==""){if(K=b[C],!K)throw new e(`Encoding '${C}' is not found`,{code:"LEVEL_ENCODING_NOT_FOUND"})}else{if(typeof C!="object"||C===null)throw new TypeError("First argument 'encoding' must be a string or object");K=L(C)}let{name:z,format:x}=K;if(!this[n].has(x))if(this[n].has("view"))K=K.createViewTranscoder();else if(this[n].has("buffer"))K=K.createBufferTranscoder();else if(this[n].has("utf8"))K=K.createUTF8Transcoder();else throw new e(`Encoding '${z}' cannot be transcoded`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"});for(let v of[C,z,K.name,K.commonName])this[p].set(v,K)}return K}};t.Transcoder=E;function L(C){if(C instanceof i)return C;let K="type"in C&&typeof C.type=="string"?C.type:void 0,z=C.name||K||`anonymous-${U++}`;switch(y(C)){case"view":return new c({...C,name:z});case"utf8":return new l({...C,name:z});case"buffer":return new a({...C,name:z});default:throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}}function y(C){return"format"in C&&C.format!==void 0?C.format:"buffer"in C&&typeof C.buffer=="boolean"?C.buffer?"buffer":"utf8":"code"in C&&Number.isInteger(C.code)?"view":"buffer"}var k={binary:r.buffer,"utf-8":r.utf8},b={...r,...k},U=0}),ti=pt((t,e)=>{at();var r=typeof Reflect=="object"?Reflect:null,i=r&&typeof r.apply=="function"?r.apply:function(u,T,I){return Function.prototype.apply.call(u,T,I)},a;r&&typeof r.ownKeys=="function"?a=r.ownKeys:Object.getOwnPropertySymbols?a=function(u){return Object.getOwnPropertyNames(u).concat(Object.getOwnPropertySymbols(u))}:a=function(u){return Object.getOwnPropertyNames(u)};function c(u){console&&console.warn&&console.warn(u)}var l=Number.isNaN||function(u){return u!==u};function n(){n.init.call(this)}e.exports=n,e.exports.once=x,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._eventsCount=0,n.prototype._maxListeners=void 0;var p=10;function S(u){if(typeof u!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof u)}Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return p},set:function(u){if(typeof u!="number"||u<0||l(u))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+u+".");p=u}}),n.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},n.prototype.setMaxListeners=function(u){if(typeof u!="number"||u<0||l(u))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+u+".");return this._maxListeners=u,this};function E(u){return u._maxListeners===void 0?n.defaultMaxListeners:u._maxListeners}n.prototype.getMaxListeners=function(){return E(this)},n.prototype.emit=function(u){for(var T=[],I=1;I0&&(G=T[0]),G instanceof Error)throw G;var et=new Error("Unhandled error."+(G?" ("+G.message+")":""));throw et.context=G,et}var J=q[u];if(J===void 0)return!1;if(typeof J=="function")i(J,this,T);else for(var tt=J.length,st=C(J,tt),I=0;I0&&et.length>q&&!et.warned){et.warned=!0;var J=new Error("Possible EventEmitter memory leak detected. "+et.length+" "+String(T)+" listeners added. Use emitter.setMaxListeners() to increase limit");J.name="MaxListenersExceededWarning",J.emitter=u,J.type=T,J.count=et.length,c(J)}return u}n.prototype.addListener=function(u,T){return L(this,u,T,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(u,T){return L(this,u,T,!0)};function y(){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 k(u,T,I){var P={fired:!1,wrapFn:void 0,target:u,type:T,listener:I},q=y.bind(P);return q.listener=I,P.wrapFn=q,q}n.prototype.once=function(u,T){return S(T),this.on(u,k(this,u,T)),this},n.prototype.prependOnceListener=function(u,T){return S(T),this.prependListener(u,k(this,u,T)),this},n.prototype.removeListener=function(u,T){var I,P,q,G,et;if(S(T),P=this._events,P===void 0)return this;if(I=P[u],I===void 0)return this;if(I===T||I.listener===T)--this._eventsCount===0?this._events=Object.create(null):(delete P[u],P.removeListener&&this.emit("removeListener",u,I.listener||T));else if(typeof I!="function"){for(q=-1,G=I.length-1;G>=0;G--)if(I[G]===T||I[G].listener===T){et=I[G].listener,q=G;break}if(q<0)return this;q===0?I.shift():K(I,q),I.length===1&&(P[u]=I[0]),P.removeListener!==void 0&&this.emit("removeListener",u,et||T)}return this},n.prototype.off=n.prototype.removeListener,n.prototype.removeAllListeners=function(u){var T,I,P;if(I=this._events,I===void 0)return this;if(I.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):I[u]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete I[u]),this;if(arguments.length===0){var q=Object.keys(I),G;for(P=0;P=0;P--)this.removeListener(u,T[P]);return this};function b(u,T,I){var P=u._events;if(P===void 0)return[];var q=P[T];return q===void 0?[]:typeof q=="function"?I?[q.listener||q]:[q]:I?z(q):C(q,q.length)}n.prototype.listeners=function(u){return b(this,u,!0)},n.prototype.rawListeners=function(u){return b(this,u,!1)},n.listenerCount=function(u,T){return typeof u.listenerCount=="function"?u.listenerCount(T):U.call(u,T)},n.prototype.listenerCount=U;function U(u){var T=this._events;if(T!==void 0){var I=T[u];if(typeof I=="function")return 1;if(I!==void 0)return I.length}return 0}n.prototype.eventNames=function(){return this._eventsCount>0?a(this._events):[]};function C(u,T){for(var I=new Array(T),P=0;P{at(),e.exports=typeof queueMicrotask=="function"?queueMicrotask:r=>Promise.resolve().then(r)}),ke=pt(t=>{at();var e=ei();t.fromCallback=function(r,i){if(r===void 0){var a=new Promise(function(c,l){r=function(n,p){n?l(n):c(p)}});r[i!==void 0?i:"promise"]=a}else if(typeof r!="function")throw new TypeError("Callback must be a function");return r},t.fromPromise=function(r,i){if(i===void 0)return r;r.then(function(a){e(()=>i(null,a))}).catch(function(a){e(()=>i(a))})}}),Ye=pt(t=>{at(),t.getCallback=function(e,r){return typeof e=="function"?e:r},t.getOptions=function(e,r){return typeof e=="object"&&e!==null?e:r!==void 0?r:{}}}),Xt=pt(t=>{at();var{fromCallback:e}=ke(),r=jt(),{getOptions:i,getCallback:a}=Ye(),c=Symbol("promise"),l=Symbol("callback"),n=Symbol("working"),p=Symbol("handleOne"),S=Symbol("handleMany"),E=Symbol("autoClose"),L=Symbol("finishWork"),y=Symbol("returnMany"),k=Symbol("closing"),b=Symbol("handleClose"),U=Symbol("closed"),C=Symbol("closeCallbacks"),K=Symbol("keyEncoding"),z=Symbol("valueEncoding"),x=Symbol("abortOnClose"),v=Symbol("legacy"),w=Symbol("keys"),u=Symbol("values"),T=Symbol("limit"),I=Symbol("count"),P=Object.freeze({}),q=()=>{},G=!1,et=class{constructor(B,O,W){if(typeof B!="object"||B===null){let F=B===null?"null":typeof B;throw new TypeError(`The first argument must be an abstract-level database, received ${F}`)}if(typeof O!="object"||O===null)throw new TypeError("The second argument must be an options object");this[U]=!1,this[C]=[],this[n]=!1,this[k]=!1,this[E]=!1,this[l]=null,this[p]=this[p].bind(this),this[S]=this[S].bind(this),this[b]=this[b].bind(this),this[K]=O[K],this[z]=O[z],this[v]=W,this[T]=Number.isInteger(O.limit)&&O.limit>=0?O.limit:1/0,this[I]=0,this[x]=!!O.abortOnClose,this.db=B,this.db.attachResource(this),this.nextTick=B.nextTick}get count(){return this[I]}get limit(){return this[T]}next(B){let O;if(B===void 0)O=new Promise((W,F)=>{B=(Z,ot,ut)=>{Z?F(Z):this[v]?ot===void 0&&ut===void 0?W():W([ot,ut]):W(ot)}});else if(typeof B!="function")throw new TypeError("Callback must be a function");return this[k]?this.nextTick(B,new r("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[n]?this.nextTick(B,new r("Iterator is busy: cannot call next() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[n]=!0,this[l]=B,this[I]>=this[T]?this.nextTick(this[p],null):this._next(this[p])),O}_next(B){this.nextTick(B)}nextv(B,O,W){return W=a(O,W),W=e(W,c),O=i(O,P),Number.isInteger(B)?(this[k]?this.nextTick(W,new r("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[n]?this.nextTick(W,new r("Iterator is busy: cannot call nextv() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(B<1&&(B=1),this[T]<1/0&&(B=Math.min(B,this[T]-this[I])),this[n]=!0,this[l]=W,B<=0?this.nextTick(this[S],null,[]):this._nextv(B,O,this[S])),W[c]):(this.nextTick(W,new TypeError("The first argument 'size' must be an integer")),W[c])}_nextv(B,O,W){let F=[],Z=(ot,ut,gt)=>{if(ot)return W(ot);if(this[v]?ut===void 0&>===void 0:ut===void 0)return W(null,F);F.push(this[v]?[ut,gt]:ut),F.length===B?W(null,F):this._next(Z)};this._next(Z)}all(B,O){return O=a(B,O),O=e(O,c),B=i(B,P),this[k]?this.nextTick(O,new r("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[n]?this.nextTick(O,new r("Iterator is busy: cannot call all() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[n]=!0,this[l]=O,this[E]=!0,this[I]>=this[T]?this.nextTick(this[S],null,[]):this._all(B,this[S])),O[c]}_all(B,O){let W=this[I],F=[],Z=()=>{let ut=this[T]<1/0?Math.min(1e3,this[T]-W):1e3;ut<=0?this.nextTick(O,null,F):this._nextv(ut,P,ot)},ot=(ut,gt)=>{ut?O(ut):gt.length===0?O(null,F):(F.push.apply(F,gt),W+=gt.length,Z())};Z()}[L](){let B=this[l];return this[x]&&B===null?q:(this[n]=!1,this[l]=null,this[k]&&this._close(this[b]),B)}[y](B,O,W){this[E]?this.close(B.bind(null,O,W)):B(O,W)}seek(B,O){if(O=i(O,P),!this[k]){if(this[n])throw new r("Iterator is busy: cannot call seek() until next() has completed",{code:"LEVEL_ITERATOR_BUSY"});{let W=this.db.keyEncoding(O.keyEncoding||this[K]),F=W.format;O.keyEncoding!==F&&(O={...O,keyEncoding:F});let Z=this.db.prefixKey(W.encode(B),F);this._seek(Z,O)}}}_seek(B,O){throw new r("Iterator does not support seek()",{code:"LEVEL_NOT_SUPPORTED"})}close(B){return B=e(B,c),this[U]?this.nextTick(B):this[k]?this[C].push(B):(this[k]=!0,this[C].push(B),this[n]?this[x]&&this[L]()(new r("Aborted on iterator close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this._close(this[b])),B[c]}_close(B){this.nextTick(B)}[b](){this[U]=!0,this.db.detachResource(this);let B=this[C];this[C]=[];for(let O of B)O()}async*[Symbol.asyncIterator](){try{let B;for(;(B=await this.next())!==void 0;)yield B}finally{this[U]||await this.close()}}},J=class extends et{constructor(B,O){super(B,O,!0),this[w]=O.keys!==!1,this[u]=O.values!==!1}[p](B,O,W){let F=this[L]();if(B)return F(B);try{O=this[w]&&O!==void 0?this[K].decode(O):void 0,W=this[u]&&W!==void 0?this[z].decode(W):void 0}catch(Z){return F(new nt("entry",Z))}O===void 0&&W===void 0||this[I]++,F(null,O,W)}[S](B,O){let W=this[L]();if(B)return this[y](W,B);try{for(let F of O){let Z=F[0],ot=F[1];F[0]=this[w]&&Z!==void 0?this[K].decode(Z):void 0,F[1]=this[u]&&ot!==void 0?this[z].decode(ot):void 0}}catch(F){return this[y](W,new nt("entries",F))}this[I]+=O.length,this[y](W,null,O)}end(B){return!G&&typeof console<"u"&&(G=!0,console.warn(new r("The iterator.end() method was renamed to close() and end() is an alias that will be removed in a future version",{code:"LEVEL_LEGACY"}))),this.close(B)}},tt=class extends et{constructor(B,O){super(B,O,!1)}[p](B,O){let W=this[L]();if(B)return W(B);try{O=O!==void 0?this[K].decode(O):void 0}catch(F){return W(new nt("key",F))}O!==void 0&&this[I]++,W(null,O)}[S](B,O){let W=this[L]();if(B)return this[y](W,B);try{for(let F=0;F{at();var{AbstractKeyIterator:e,AbstractValueIterator:r}=Xt(),i=Symbol("iterator"),a=Symbol("callback"),c=Symbol("handleOne"),l=Symbol("handleMany"),n=class extends e{constructor(S,E){super(S,E),this[i]=S.iterator({...E,keys:!0,values:!1}),this[c]=this[c].bind(this),this[l]=this[l].bind(this)}},p=class extends r{constructor(S,E){super(S,E),this[i]=S.iterator({...E,keys:!1,values:!0}),this[c]=this[c].bind(this),this[l]=this[l].bind(this)}};for(let S of[n,p]){let E=S===n,L=E?y=>y[0]:y=>y[1];S.prototype._next=function(y){this[a]=y,this[i].next(this[c])},S.prototype[c]=function(y,k,b){let U=this[a];y?U(y):U(null,E?k:b)},S.prototype._nextv=function(y,k,b){this[a]=b,this[i].nextv(y,k,this[l])},S.prototype._all=function(y,k){this[a]=k,this[i].all(y,this[l])},S.prototype[l]=function(y,k){let b=this[a];y?b(y):b(null,k.map(L))},S.prototype._seek=function(y,k){this[i].seek(y,k)},S.prototype._close=function(y){this[i].close(y)}}t.DefaultKeyIterator=n,t.DefaultValueIterator=p}),ni=pt(t=>{at();var{AbstractIterator:e,AbstractKeyIterator:r,AbstractValueIterator:i}=Xt(),a=jt(),c=Symbol("nut"),l=Symbol("undefer"),n=Symbol("factory"),p=class extends e{constructor(L,y){super(L,y),this[c]=null,this[n]=()=>L.iterator(y),this.db.defer(()=>this[l]())}},S=class extends r{constructor(L,y){super(L,y),this[c]=null,this[n]=()=>L.keys(y),this.db.defer(()=>this[l]())}},E=class extends i{constructor(L,y){super(L,y),this[c]=null,this[n]=()=>L.values(y),this.db.defer(()=>this[l]())}};for(let L of[p,S,E])L.prototype[l]=function(){this.db.status==="open"&&(this[c]=this[n]())},L.prototype._next=function(y){this[c]!==null?this[c].next(y):this.db.status==="opening"?this.db.defer(()=>this._next(y)):this.nextTick(y,new a("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},L.prototype._nextv=function(y,k,b){this[c]!==null?this[c].nextv(y,k,b):this.db.status==="opening"?this.db.defer(()=>this._nextv(y,k,b)):this.nextTick(b,new a("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},L.prototype._all=function(y,k){this[c]!==null?this[c].all(k):this.db.status==="opening"?this.db.defer(()=>this._all(y,k)):this.nextTick(k,new a("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},L.prototype._seek=function(y,k){this[c]!==null?this[c]._seek(y,k):this.db.status==="opening"&&this.db.defer(()=>this._seek(y,k))},L.prototype._close=function(y){this[c]!==null?this[c].close(y):this.db.status==="opening"?this.db.defer(()=>this._close(y)):this.nextTick(y)};t.DeferredIterator=p,t.DeferredKeyIterator=S,t.DeferredValueIterator=E}),jr=pt(t=>{at();var{fromCallback:e}=ke(),r=jt(),{getCallback:i,getOptions:a}=Ye(),c=Symbol("promise"),l=Symbol("status"),n=Symbol("operations"),p=Symbol("finishClose"),S=Symbol("closeCallbacks"),E=class{constructor(L){if(typeof L!="object"||L===null){let y=L===null?"null":typeof L;throw new TypeError(`The first argument must be an abstract-level database, received ${y}`)}this[n]=[],this[S]=[],this[l]="open",this[p]=this[p].bind(this),this.db=L,this.db.attachResource(this),this.nextTick=L.nextTick}get length(){return this[n].length}put(L,y,k){if(this[l]!=="open")throw new r("Batch is not open: cannot call put() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let b=this.db._checkKey(L)||this.db._checkValue(y);if(b)throw b;let U=k&&k.sublevel!=null?k.sublevel:this.db,C=k,K=U.keyEncoding(k&&k.keyEncoding),z=U.valueEncoding(k&&k.valueEncoding),x=K.format;k={...k,keyEncoding:x,valueEncoding:z.format},U!==this.db&&(k.sublevel=null);let v=U.prefixKey(K.encode(L),x),w=z.encode(y);return this._put(v,w,k),this[n].push({...C,type:"put",key:L,value:y}),this}_put(L,y,k){}del(L,y){if(this[l]!=="open")throw new r("Batch is not open: cannot call del() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let k=this.db._checkKey(L);if(k)throw k;let b=y&&y.sublevel!=null?y.sublevel:this.db,U=y,C=b.keyEncoding(y&&y.keyEncoding),K=C.format;return y={...y,keyEncoding:K},b!==this.db&&(y.sublevel=null),this._del(b.prefixKey(C.encode(L),K),y),this[n].push({...U,type:"del",key:L}),this}_del(L,y){}clear(){if(this[l]!=="open")throw new r("Batch is not open: cannot call clear() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});return this._clear(),this[n]=[],this}_clear(){}write(L,y){return y=i(L,y),y=e(y,c),L=a(L),this[l]!=="open"?this.nextTick(y,new r("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"})):this.length===0?this.close(y):(this[l]="writing",this._write(L,k=>{this[l]="closing",this[S].push(()=>y(k)),k||this.db.emit("batch",this[n]),this._close(this[p])})),y[c]}_write(L,y){}close(L){return L=e(L,c),this[l]==="closing"?this[S].push(L):this[l]==="closed"?this.nextTick(L):(this[S].push(L),this[l]!=="writing"&&(this[l]="closing",this._close(this[p]))),L[c]}_close(L){this.nextTick(L)}[p](){this[l]="closed",this.db.detachResource(this);let L=this[S];this[S]=[];for(let y of L)y()}};t.AbstractChainedBatch=E}),ii=pt(t=>{at();var{AbstractChainedBatch:e}=jr(),r=jt(),i=Symbol("encoded"),a=class extends e{constructor(c){super(c),this[i]=[]}_put(c,l,n){this[i].push({...n,type:"put",key:c,value:l})}_del(c,l){this[i].push({...l,type:"del",key:c})}_clear(){this[i]=[]}_write(c,l){this.db.status==="opening"?this.db.defer(()=>this._write(c,l)):this.db.status==="open"?this[i].length===0?this.nextTick(l):this.db._batch(this[i],c,l):this.nextTick(l,new r("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"}))}};t.DefaultChainedBatch=a}),ai=pt((t,e)=>{at();var r=jt(),i=Object.prototype.hasOwnProperty,a=new Set(["lt","lte","gt","gte"]);e.exports=function(c,l){let n={};for(let p in c)if(i.call(c,p)&&!(p==="keyEncoding"||p==="valueEncoding")){if(p==="start"||p==="end")throw new r(`The legacy range option '${p}' has been removed`,{code:"LEVEL_LEGACY"});if(p==="encoding")throw new r("The levelup-style 'encoding' alias has been removed, use 'valueEncoding' instead",{code:"LEVEL_LEGACY"});a.has(p)?n[p]=l.encode(c[p]):n[p]=c[p]}return n.reverse=!!n.reverse,n.limit=Number.isInteger(n.limit)&&n.limit>=0?n.limit:-1,n}}),Dr=pt((t,e)=>{at();var r;e.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:Yt):i=>(r||(r=Promise.resolve())).then(i).catch(a=>setTimeout(()=>{throw a},0))}),oi=pt((t,e)=>{at();var r=Dr();e.exports=function(i,...a){a.length===0?r(i):r(()=>i(...a))}}),si=pt(t=>{at();var{AbstractIterator:e,AbstractKeyIterator:r,AbstractValueIterator:i}=Xt(),a=Symbol("unfix"),c=Symbol("iterator"),l=Symbol("handleOne"),n=Symbol("handleMany"),p=Symbol("callback"),S=class extends e{constructor(y,k,b,U){super(y,k),this[c]=b,this[a]=U,this[l]=this[l].bind(this),this[n]=this[n].bind(this),this[p]=null}[l](y,k,b){let U=this[p];if(y)return U(y);k!==void 0&&(k=this[a](k)),U(y,k,b)}[n](y,k){let b=this[p];if(y)return b(y);for(let U of k){let C=U[0];C!==void 0&&(U[0]=this[a](C))}b(y,k)}},E=class extends r{constructor(y,k,b,U){super(y,k),this[c]=b,this[a]=U,this[l]=this[l].bind(this),this[n]=this[n].bind(this),this[p]=null}[l](y,k){let b=this[p];if(y)return b(y);k!==void 0&&(k=this[a](k)),b(y,k)}[n](y,k){let b=this[p];if(y)return b(y);for(let U=0;U{at();var r=jt(),{Buffer:i}=oe()||{},{AbstractSublevelIterator:a,AbstractSublevelKeyIterator:c,AbstractSublevelValueIterator:l}=si(),n=Symbol("prefix"),p=Symbol("upperBound"),S=Symbol("prefixRange"),E=Symbol("parent"),L=Symbol("unfix"),y=new TextEncoder,k={separator:"!"};e.exports=function({AbstractLevel:x}){class v extends x{static defaults(u){if(typeof u=="string")throw new r("The subleveldown string shorthand for { separator } has been removed",{code:"LEVEL_LEGACY"});if(u&&u.open)throw new r("The subleveldown open option has been removed",{code:"LEVEL_LEGACY"});return u==null?k:u.separator?u:{...u,separator:"!"}}constructor(u,T,I){let{separator:P,manifest:q,...G}=v.defaults(I);T=z(T,P);let et=P.charCodeAt(0)+1,J=u[E]||u;if(!y.encode(T).every(nt=>nt>et&&nt<127))throw new r(`Prefix must use bytes > ${et} < 127`,{code:"LEVEL_INVALID_PREFIX"});super(b(J,q),G);let tt=(u.prefix||"")+P+T+P,st=tt.slice(0,-1)+String.fromCharCode(et);this[E]=J,this[n]=new C(tt),this[p]=new C(st),this[L]=new K,this.nextTick=J.nextTick}prefixKey(u,T){if(T==="utf8")return this[n].utf8+u;if(u.byteLength===0)return this[n][T];if(T==="view"){let I=this[n].view,P=new Uint8Array(I.byteLength+u.byteLength);return P.set(I,0),P.set(u,I.byteLength),P}else{let I=this[n].buffer;return i.concat([I,u],I.byteLength+u.byteLength)}}[S](u,T){u.gte!==void 0?u.gte=this.prefixKey(u.gte,T):u.gt!==void 0?u.gt=this.prefixKey(u.gt,T):u.gte=this[n][T],u.lte!==void 0?u.lte=this.prefixKey(u.lte,T):u.lt!==void 0?u.lt=this.prefixKey(u.lt,T):u.lte=this[p][T]}get prefix(){return this[n].utf8}get db(){return this[E]}_open(u,T){this[E].open({passive:!0},T)}_put(u,T,I,P){this[E].put(u,T,I,P)}_get(u,T,I){this[E].get(u,T,I)}_getMany(u,T,I){this[E].getMany(u,T,I)}_del(u,T,I){this[E].del(u,T,I)}_batch(u,T,I){this[E].batch(u,T,I)}_clear(u,T){this[S](u,u.keyEncoding),this[E].clear(u,T)}_iterator(u){this[S](u,u.keyEncoding);let T=this[E].iterator(u),I=this[L].get(this[n].utf8.length,u.keyEncoding);return new a(this,u,T,I)}_keys(u){this[S](u,u.keyEncoding);let T=this[E].keys(u),I=this[L].get(this[n].utf8.length,u.keyEncoding);return new c(this,u,T,I)}_values(u){this[S](u,u.keyEncoding);let T=this[E].values(u);return new l(this,u,T)}}return{AbstractSublevel:v}};var b=function(x,v){return{...x.supports,createIfMissing:!1,errorIfExists:!1,events:{},additionalMethods:{},...v,encodings:{utf8:U(x,"utf8"),buffer:U(x,"buffer"),view:U(x,"view")}}},U=function(x,v){return x.supports.encodings[v]?x.keyEncoding(v).name===v:!1},C=class{constructor(x){this.utf8=x,this.view=y.encode(x),this.buffer=i?i.from(this.view.buffer,0,this.view.byteLength):{}}},K=class{constructor(){this.cache=new Map}get(x,v){let w=this.cache.get(v);return w===void 0&&(v==="view"?w=(function(u,T){return T.subarray(u)}).bind(null,x):w=(function(u,T){return T.slice(u)}).bind(null,x),this.cache.set(v,w)),w}},z=function(x,v){let w=0,u=x.length;for(;ww&&x[u-1]===v;)u--;return x.slice(w,u)}}),gr=pt(t=>{at();var{supports:e}=Yn(),{Transcoder:r}=Zn(),{EventEmitter:i}=ti(),{fromCallback:a}=ke(),c=jt(),{AbstractIterator:l}=Xt(),{DefaultKeyIterator:n,DefaultValueIterator:p}=ri(),{DeferredIterator:S,DeferredKeyIterator:E,DeferredValueIterator:L}=ni(),{DefaultChainedBatch:y}=ii(),{getCallback:k,getOptions:b}=Ye(),U=ai(),C=Symbol("promise"),K=Symbol("landed"),z=Symbol("resources"),x=Symbol("closeResources"),v=Symbol("operations"),w=Symbol("undefer"),u=Symbol("deferOpen"),T=Symbol("options"),I=Symbol("status"),P=Symbol("defaultOptions"),q=Symbol("transcoder"),G=Symbol("keyEncoding"),et=Symbol("valueEncoding"),J=()=>{},tt=class extends i{constructor(O,W){if(super(),typeof O!="object"||O===null)throw new TypeError("The first argument 'manifest' must be an object");W=b(W);let{keyEncoding:F,valueEncoding:Z,passive:ot,...ut}=W;this[z]=new Set,this[v]=[],this[u]=!0,this[T]=ut,this[I]="opening",this.supports=e(O,{status:!0,promises:!0,clear:!0,getMany:!0,deferredOpen:!0,snapshots:O.snapshots!==!1,permanence:O.permanence!==!1,keyIterator:!0,valueIterator:!0,iteratorNextv:!0,iteratorAll:!0,encodings:O.encodings||{},events:Object.assign({},O.events,{opening:!0,open:!0,closing:!0,closed:!0,put:!0,del:!0,batch:!0,clear:!0})}),this[q]=new r(B(this)),this[G]=this[q].encoding(F||"utf8"),this[et]=this[q].encoding(Z||"utf8");for(let gt of this[q].encodings())this.supports.encodings[gt.commonName]||(this.supports.encodings[gt.commonName]=!0);this[P]={empty:Object.freeze({}),entry:Object.freeze({keyEncoding:this[G].commonName,valueEncoding:this[et].commonName}),key:Object.freeze({keyEncoding:this[G].commonName})},this.nextTick(()=>{this[u]&&this.open({passive:!1},J)})}get status(){return this[I]}keyEncoding(O){return this[q].encoding(O??this[G])}valueEncoding(O){return this[q].encoding(O??this[et])}open(O,W){W=k(O,W),W=a(W,C),O={...this[T],...b(O)},O.createIfMissing=O.createIfMissing!==!1,O.errorIfExists=!!O.errorIfExists;let F=Z=>{this[I]==="closing"||this[I]==="opening"?this.once(K,Z?()=>F(Z):F):this[I]!=="open"?W(new c("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN",cause:Z})):W()};return O.passive?this[I]==="opening"?this.once(K,F):this.nextTick(F):this[I]==="closed"||this[u]?(this[u]=!1,this[I]="opening",this.emit("opening"),this._open(O,Z=>{if(Z){this[I]="closed",this[x](()=>{this.emit(K),F(Z)}),this[w]();return}this[I]="open",this[w](),this.emit(K),this[I]==="open"&&this.emit("open"),this[I]==="open"&&this.emit("ready"),F()})):this[I]==="open"?this.nextTick(F):this.once(K,()=>this.open(O,W)),W[C]}_open(O,W){this.nextTick(W)}close(O){O=a(O,C);let W=F=>{this[I]==="opening"||this[I]==="closing"?this.once(K,F?W(F):W):this[I]!=="closed"?O(new c("Database is not closed",{code:"LEVEL_DATABASE_NOT_CLOSED",cause:F})):O()};if(this[I]==="open"){this[I]="closing",this.emit("closing");let F=Z=>{this[I]="open",this[w](),this.emit(K),W(Z)};this[x](()=>{this._close(Z=>{if(Z)return F(Z);this[I]="closed",this[w](),this.emit(K),this[I]==="closed"&&this.emit("closed"),W()})})}else this[I]==="closed"?this.nextTick(W):this.once(K,()=>this.close(O));return O[C]}[x](O){if(this[z].size===0)return this.nextTick(O);let W=this[z].size,F=!0,Z=()=>{--W===0&&(F?this.nextTick(O):O())};for(let ot of this[z])ot.close(Z);F=!1,this[z].clear()}_close(O){this.nextTick(O)}get(O,W,F){if(F=k(W,F),F=a(F,C),W=b(W,this[P].entry),this[I]==="opening")return this.defer(()=>this.get(O,W,F)),F[C];if(nt(this,F))return F[C];let Z=this._checkKey(O);if(Z)return this.nextTick(F,Z),F[C];let ot=this.keyEncoding(W.keyEncoding),ut=this.valueEncoding(W.valueEncoding),gt=ot.format,rt=ut.format;return(W.keyEncoding!==gt||W.valueEncoding!==rt)&&(W=Object.assign({},W,{keyEncoding:gt,valueEncoding:rt})),this._get(this.prefixKey(ot.encode(O),gt),W,(ht,mt)=>{if(ht)return(ht.code==="LEVEL_NOT_FOUND"||ht.notFound||/NotFound/i.test(ht))&&(ht.code||(ht.code="LEVEL_NOT_FOUND"),ht.notFound||(ht.notFound=!0),ht.status||(ht.status=404)),F(ht);try{mt=ut.decode(mt)}catch(dt){return F(new c("Could not decode value",{code:"LEVEL_DECODE_ERROR",cause:dt}))}F(null,mt)}),F[C]}_get(O,W,F){this.nextTick(F,new Error("NotFound"))}getMany(O,W,F){if(F=k(W,F),F=a(F,C),W=b(W,this[P].entry),this[I]==="opening")return this.defer(()=>this.getMany(O,W,F)),F[C];if(nt(this,F))return F[C];if(!Array.isArray(O))return this.nextTick(F,new TypeError("The first argument 'keys' must be an array")),F[C];if(O.length===0)return this.nextTick(F,null,[]),F[C];let Z=this.keyEncoding(W.keyEncoding),ot=this.valueEncoding(W.valueEncoding),ut=Z.format,gt=ot.format;(W.keyEncoding!==ut||W.valueEncoding!==gt)&&(W=Object.assign({},W,{keyEncoding:ut,valueEncoding:gt}));let rt=new Array(O.length);for(let ht=0;ht{if(ht)return F(ht);try{for(let dt=0;dtthis.put(O,W,F,Z)),Z[C];if(nt(this,Z))return Z[C];let ot=this._checkKey(O)||this._checkValue(W);if(ot)return this.nextTick(Z,ot),Z[C];let ut=this.keyEncoding(F.keyEncoding),gt=this.valueEncoding(F.valueEncoding),rt=ut.format,ht=gt.format;(F.keyEncoding!==rt||F.valueEncoding!==ht)&&(F=Object.assign({},F,{keyEncoding:rt,valueEncoding:ht}));let mt=this.prefixKey(ut.encode(O),rt),dt=gt.encode(W);return this._put(mt,dt,F,wt=>{if(wt)return Z(wt);this.emit("put",O,W),Z()}),Z[C]}_put(O,W,F,Z){this.nextTick(Z)}del(O,W,F){if(F=k(W,F),F=a(F,C),W=b(W,this[P].key),this[I]==="opening")return this.defer(()=>this.del(O,W,F)),F[C];if(nt(this,F))return F[C];let Z=this._checkKey(O);if(Z)return this.nextTick(F,Z),F[C];let ot=this.keyEncoding(W.keyEncoding),ut=ot.format;return W.keyEncoding!==ut&&(W=Object.assign({},W,{keyEncoding:ut})),this._del(this.prefixKey(ot.encode(O),ut),W,gt=>{if(gt)return F(gt);this.emit("del",O),F()}),F[C]}_del(O,W,F){this.nextTick(F)}batch(O,W,F){if(!arguments.length){if(this[I]==="opening")return new y(this);if(this[I]!=="open")throw new c("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._chainedBatch()}if(typeof O=="function"?F=O:F=k(W,F),F=a(F,C),W=b(W,this[P].empty),this[I]==="opening")return this.defer(()=>this.batch(O,W,F)),F[C];if(nt(this,F))return F[C];if(!Array.isArray(O))return this.nextTick(F,new TypeError("The first argument 'operations' must be an array")),F[C];if(O.length===0)return this.nextTick(F),F[C];let Z=new Array(O.length),{keyEncoding:ot,valueEncoding:ut,...gt}=W;for(let rt=0;rt{if(rt)return F(rt);this.emit("batch",O),F()}),F[C]}_batch(O,W,F){this.nextTick(F)}sublevel(O,W){return this._sublevel(O,st.defaults(W))}_sublevel(O,W){return new st(this,O,W)}prefixKey(O,W){return O}clear(O,W){if(W=k(O,W),W=a(W,C),O=b(O,this[P].empty),this[I]==="opening")return this.defer(()=>this.clear(O,W)),W[C];if(nt(this,W))return W[C];let F=O,Z=this.keyEncoding(O.keyEncoding);return O=U(O,Z),O.keyEncoding=Z.format,O.limit===0?this.nextTick(W):this._clear(O,ot=>{if(ot)return W(ot);this.emit("clear",F),W()}),W[C]}_clear(O,W){this.nextTick(W)}iterator(O){let W=this.keyEncoding(O&&O.keyEncoding),F=this.valueEncoding(O&&O.valueEncoding);if(O=U(O,W),O.keys=O.keys!==!1,O.values=O.values!==!1,O[l.keyEncoding]=W,O[l.valueEncoding]=F,O.keyEncoding=W.format,O.valueEncoding=F.format,this[I]==="opening")return new S(this,O);if(this[I]!=="open")throw new c("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._iterator(O)}_iterator(O){return new l(this,O)}keys(O){let W=this.keyEncoding(O&&O.keyEncoding),F=this.valueEncoding(O&&O.valueEncoding);if(O=U(O,W),O[l.keyEncoding]=W,O[l.valueEncoding]=F,O.keyEncoding=W.format,O.valueEncoding=F.format,this[I]==="opening")return new E(this,O);if(this[I]!=="open")throw new c("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._keys(O)}_keys(O){return new n(this,O)}values(O){let W=this.keyEncoding(O&&O.keyEncoding),F=this.valueEncoding(O&&O.valueEncoding);if(O=U(O,W),O[l.keyEncoding]=W,O[l.valueEncoding]=F,O.keyEncoding=W.format,O.valueEncoding=F.format,this[I]==="opening")return new L(this,O);if(this[I]!=="open")throw new c("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._values(O)}_values(O){return new p(this,O)}defer(O){if(typeof O!="function")throw new TypeError("The first argument must be a function");this[v].push(O)}[w](){if(this[v].length===0)return;let O=this[v];this[v]=[];for(let W of O)W()}attachResource(O){if(typeof O!="object"||O===null||typeof O.close!="function")throw new TypeError("The first argument must be a resource object");this[z].add(O)}detachResource(O){this[z].delete(O)}_chainedBatch(){return new y(this)}_checkKey(O){if(O==null)return new c("Key cannot be null or undefined",{code:"LEVEL_INVALID_KEY"})}_checkValue(O){if(O==null)return new c("Value cannot be null or undefined",{code:"LEVEL_INVALID_VALUE"})}};tt.prototype.nextTick=oi();var{AbstractSublevel:st}=li()({AbstractLevel:tt});t.AbstractLevel=tt,t.AbstractSublevel=st;var nt=function(O,W){return O[I]!=="open"?(O.nextTick(W,new c("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"})),!0):!1},B=function(O){return Object.keys(O.supports.encodings).filter(W=>!!O.supports.encodings[W])}}),Xe=pt(t=>{at(),t.AbstractLevel=gr().AbstractLevel,t.AbstractSublevel=gr().AbstractSublevel,t.AbstractIterator=Xt().AbstractIterator,t.AbstractKeyIterator=Xt().AbstractKeyIterator,t.AbstractValueIterator=Xt().AbstractValueIterator,t.AbstractChainedBatch=jr().AbstractChainedBatch}),ci=pt((t,e)=>{at(),e.exports=i;var r=Dr();function i(a,c,l){if(typeof c!="number")throw new Error("second argument must be a Number");let n,p,S,E,L,y=!0,k;Array.isArray(a)?(n=[],S=p=a.length):(E=Object.keys(a),n={},S=p=E.length);function b(C){function K(){l&&l(C,n),l=null}y?r(K):K()}function U(C,K,z){if(n[C]=z,K&&(L=!0),--S===0||K)b(K);else if(!L&&k{at(),e.exports=function(r){let i=r.gte!==void 0?r.gte:r.gt!==void 0?r.gt:void 0,a=r.lte!==void 0?r.lte:r.lt!==void 0?r.lt:void 0,c=r.gte===void 0,l=r.lte===void 0;return i!==void 0&&a!==void 0?IDBKeyRange.bound(i,a,c,l):i!==void 0?IDBKeyRange.lowerBound(i,c):a!==void 0?IDBKeyRange.upperBound(a,l):null}}),Wr=pt((t,e)=>{at();var r=new TextEncoder;e.exports=function(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):r.encode(i)}}),ui=pt(t=>{at();var{AbstractIterator:e}=Xe(),r=Kr(),i=Wr(),a=Symbol("cache"),c=Symbol("finished"),l=Symbol("options"),n=Symbol("currentOptions"),p=Symbol("position"),S=Symbol("location"),E=Symbol("first"),L={},y=class extends e{constructor(b,U,C){super(b,C),this[a]=[],this[c]=this.limit===0,this[l]=C,this[n]={...C},this[p]=void 0,this[S]=U,this[E]=!0}_nextv(b,U,C){if(this[E]=!1,this[c])return this.nextTick(C,null,[]);if(this[a].length>0)return b=Math.min(b,this[a].length),this.nextTick(C,null,this[a].splice(0,b));this[p]!==void 0&&(this[l].reverse?(this[n].lt=this[p],this[n].lte=void 0):(this[n].gt=this[p],this[n].gte=void 0));let K;try{K=r(this[n])}catch{return this[c]=!0,this.nextTick(C,null,[])}let z=this.db.db.transaction([this[S]],"readonly"),x=z.objectStore(this[S]),v=[];if(this[l].reverse){let w=!this[l].values&&x.openKeyCursor?"openKeyCursor":"openCursor";x[w](K,"prev").onsuccess=u=>{let T=u.target.result;if(T){let{key:I,value:P}=T;this[p]=I,v.push([this[l].keys&&I!==void 0?i(I):void 0,this[l].values&&P!==void 0?i(P):void 0]),v.length{if(w===void 0||u===void 0)return;let I=Math.max(w.length,u.length);I===0||b===1/0?this[c]=!0:this[p]=w[I-1],v.length=I;for(let P=0;P{w=I.target.result,T()}:(w=[],this.nextTick(T)),this[l].values?x.getAll(K,b<1/0?b:void 0).onsuccess=I=>{u=I.target.result,T()}:(u=[],this.nextTick(T))}z.onabort=()=>{C(z.error||new Error("aborted by user")),C=null},z.oncomplete=()=>{C(null,v),C=null}}_next(b){if(this[a].length>0){let[U,C]=this[a].shift();this.nextTick(b,null,U,C)}else if(this[c])this.nextTick(b);else{let U=Math.min(100,this.limit-this.count);this[E]&&(this[E]=!1,U=1),this._nextv(U,L,(C,K)=>{if(C)return b(C);this[a]=K,this._next(b)})}}_all(b,U){this[E]=!1;let C=this[a].splice(0,this[a].length),K=this.limit-this.count-C.length;if(K<=0)return this.nextTick(U,null,C);this._nextv(K,L,(z,x)=>{if(z)return U(z);C.length>0&&(x=C.concat(x)),U(null,x)})}_seek(b,U){this[E]=!0,this[a]=[],this[c]=!1,this[p]=void 0,this[n]={...this[l]};let C;try{C=r(this[l])}catch{this[c]=!0;return}C!==null&&!C.includes(b)?this[c]=!0:this[l].reverse?this[n].lte=b:this[n].gte=b}};t.Iterator=y;function k(b){typeof b.commit=="function"&&b.commit()}}),hi=pt((t,e)=>{at(),e.exports=function(r,i,a,c,l){if(c.limit===0)return r.nextTick(l);let n=r.db.transaction([i],"readwrite"),p=n.objectStore(i),S=0;n.oncomplete=function(){l()},n.onabort=function(){l(n.error||new Error("aborted by user"))};let E=p.openKeyCursor?"openKeyCursor":"openCursor",L=c.reverse?"prev":"next";p[E](a,L).onsuccess=function(y){let k=y.target.result;k&&(p.delete(k.key).onsuccess=function(){(c.limit<=0||++S{at();var{AbstractLevel:e}=Xe(),r=jt(),i=ci(),{fromCallback:a}=ke(),{Iterator:c}=ui(),l=Wr(),n=hi(),p=Kr(),S="level-js-",E=Symbol("idb"),L=Symbol("namePrefix"),y=Symbol("location"),k=Symbol("version"),b=Symbol("store"),U=Symbol("onComplete"),C=Symbol("promise"),K=class extends e{constructor(z,x,v){if(typeof x=="function"||typeof v=="function")throw new r("The levelup-style callback argument has been removed",{code:"LEVEL_LEGACY"});let{prefix:w,version:u,...T}=x||{};if(super({encodings:{view:!0},snapshots:!1,createIfMissing:!1,errorIfExists:!1,seek:!0},T),typeof z!="string")throw new Error("constructor requires a location string argument");this[y]=z,this[L]=w??S,this[k]=parseInt(u||1,10),this[E]=null}get location(){return this[y]}get namePrefix(){return this[L]}get version(){return this[k]}get db(){return this[E]}get type(){return"browser-level"}_open(z,x){let v=indexedDB.open(this[L]+this[y],this[k]);v.onerror=function(){x(v.error||new Error("unknown error"))},v.onsuccess=()=>{this[E]=v.result,x()},v.onupgradeneeded=w=>{let u=w.target.result;u.objectStoreNames.contains(this[y])||u.createObjectStore(this[y])}}[b](z){return this[E].transaction([this[y]],z).objectStore(this[y])}[U](z,x){let v=z.transaction;v.onabort=function(){x(v.error||new Error("aborted by user"))},v.oncomplete=function(){x(null,z.result)}}_get(z,x,v){let w=this[b]("readonly"),u;try{u=w.get(z)}catch(T){return this.nextTick(v,T)}this[U](u,function(T,I){if(T)return v(T);if(I===void 0)return v(new r("Entry not found",{code:"LEVEL_NOT_FOUND"}));v(null,l(I))})}_getMany(z,x,v){let w=this[b]("readonly"),u=z.map(T=>I=>{let P;try{P=w.get(T)}catch(q){return I(q)}P.onsuccess=()=>{let q=P.result;I(null,q===void 0?q:l(q))},P.onerror=q=>{q.stopPropagation(),I(P.error)}});i(u,16,v)}_del(z,x,v){let w=this[b]("readwrite"),u;try{u=w.delete(z)}catch(T){return this.nextTick(v,T)}this[U](u,v)}_put(z,x,v,w){let u=this[b]("readwrite"),T;try{T=u.put(x,z)}catch(I){return this.nextTick(w,I)}this[U](T,w)}_iterator(z){return new c(this,this[y],z)}_batch(z,x,v){let w=this[b]("readwrite"),u=w.transaction,T=0,I;u.onabort=function(){v(I||u.error||new Error("aborted by user"))},u.oncomplete=function(){v()};function P(){let q=z[T++],G=q.key,et;try{et=q.type==="del"?w.delete(G):w.put(q.value,G)}catch(J){I=J,u.abort();return}T=0)return n(this,this[y],v,z,x);try{let u=this[b]("readwrite");w=v?u.delete(v):u.clear()}catch(u){return this.nextTick(x,u)}this[U](w,x)}_close(z){this[E].close(),this.nextTick(z)}};K.destroy=function(z,x,v){typeof x=="function"&&(v=x,x=S),v=a(v,C);let w=indexedDB.deleteDatabase(x+z);return w.onsuccess=function(){v()},w.onerror=function(u){v(u)},v[C]},t.BrowserLevel=K}),gi=pt(t=>{at(),t.Level=fi().BrowserLevel}),di=pt((t,e)=>{at(),e.exports=z;var r=0,i=1;function a(x,v,w,u,T,I){this._color=x,this.key=v,this.value=w,this.left=u,this.right=T,this._count=I}function c(x){return new a(x._color,x.key,x.value,x.left,x.right,x._count)}function l(x,v){return new a(x,v.key,v.value,v.left,v.right,v._count)}function n(x){x._count=1+(x.left?x.left._count:0)+(x.right?x.right._count:0)}function p(x,v){this._compare=x,this.root=v}var S=p.prototype;Object.defineProperty(S,"keys",{get:function(){var x=[];return this.forEach(function(v,w){x.push(v)}),x}}),Object.defineProperty(S,"values",{get:function(){var x=[];return this.forEach(function(v,w){x.push(w)}),x}}),Object.defineProperty(S,"length",{get:function(){return this.root?this.root._count:0}}),S.insert=function(x,v){for(var w=this._compare,u=this.root,T=[],I=[];u;){var P=w(x,u.key);T.push(u),I.push(P),P<=0?u=u.left:u=u.right}T.push(new a(r,x,v,null,null,1));for(var q=T.length-2;q>=0;--q){var u=T[q];I[q]<=0?T[q]=new a(u._color,u.key,u.value,T[q+1],u.right,u._count+1):T[q]=new a(u._color,u.key,u.value,u.left,T[q+1],u._count+1)}for(var q=T.length-1;q>1;--q){var G=T[q-1],u=T[q];if(G._color===i||u._color===i)break;var et=T[q-2];if(et.left===G)if(G.left===u){var J=et.right;if(J&&J._color===r)G._color=i,et.right=l(i,J),et._color=r,q-=1;else{if(et._color=r,et.left=G.right,G._color=i,G.right=et,T[q-2]=G,T[q-1]=u,n(et),n(G),q>=3){var tt=T[q-3];tt.left===et?tt.left=G:tt.right=G}break}}else{var J=et.right;if(J&&J._color===r)G._color=i,et.right=l(i,J),et._color=r,q-=1;else{if(G.right=u.left,et._color=r,et.left=u.right,u._color=i,u.left=G,u.right=et,T[q-2]=u,T[q-1]=G,n(et),n(G),n(u),q>=3){var tt=T[q-3];tt.left===et?tt.left=u:tt.right=u}break}}else if(G.right===u){var J=et.left;if(J&&J._color===r)G._color=i,et.left=l(i,J),et._color=r,q-=1;else{if(et._color=r,et.right=G.left,G._color=i,G.left=et,T[q-2]=G,T[q-1]=u,n(et),n(G),q>=3){var tt=T[q-3];tt.right===et?tt.right=G:tt.left=G}break}}else{var J=et.left;if(J&&J._color===r)G._color=i,et.left=l(i,J),et._color=r,q-=1;else{if(G.left=u.right,et._color=r,et.right=u.left,u._color=i,u.right=G,u.left=et,T[q-2]=u,T[q-1]=G,n(et),n(G),n(u),q>=3){var tt=T[q-3];tt.right===et?tt.right=u:tt.left=u}break}}}return T[0]._color=i,new p(w,T[0])};function E(x,v){if(v.left){var w=E(x,v.left);if(w)return w}var w=x(v.key,v.value);if(w)return w;if(v.right)return E(x,v.right)}function L(x,v,w,u){var T=v(x,u.key);if(T<=0){if(u.left){var I=L(x,v,w,u.left);if(I)return I}var I=w(u.key,u.value);if(I)return I}if(u.right)return L(x,v,w,u.right)}function y(x,v,w,u,T){var I=w(x,T.key),P=w(v,T.key),q;if(I<=0&&(T.left&&(q=y(x,v,w,u,T.left),q)||P>0&&(q=u(T.key,T.value),q)))return q;if(P>0&&T.right)return y(x,v,w,u,T.right)}S.forEach=function(x,v,w){if(this.root)switch(arguments.length){case 1:return E(x,this.root);case 2:return L(v,this._compare,x,this.root);case 3:return this._compare(v,w)>=0?void 0:y(v,w,this._compare,x,this.root)}},Object.defineProperty(S,"begin",{get:function(){for(var x=[],v=this.root;v;)x.push(v),v=v.left;return new k(this,x)}}),Object.defineProperty(S,"end",{get:function(){for(var x=[],v=this.root;v;)x.push(v),v=v.right;return new k(this,x)}}),S.at=function(x){if(x<0)return new k(this,[]);for(var v=this.root,w=[];;){if(w.push(v),v.left){if(x=v.right._count)break;v=v.right}else break}return new k(this,[])},S.ge=function(x){for(var v=this._compare,w=this.root,u=[],T=0;w;){var I=v(x,w.key);u.push(w),I<=0&&(T=u.length),I<=0?w=w.left:w=w.right}return u.length=T,new k(this,u)},S.gt=function(x){for(var v=this._compare,w=this.root,u=[],T=0;w;){var I=v(x,w.key);u.push(w),I<0&&(T=u.length),I<0?w=w.left:w=w.right}return u.length=T,new k(this,u)},S.lt=function(x){for(var v=this._compare,w=this.root,u=[],T=0;w;){var I=v(x,w.key);u.push(w),I>0&&(T=u.length),I<=0?w=w.left:w=w.right}return u.length=T,new k(this,u)},S.le=function(x){for(var v=this._compare,w=this.root,u=[],T=0;w;){var I=v(x,w.key);u.push(w),I>=0&&(T=u.length),I<0?w=w.left:w=w.right}return u.length=T,new k(this,u)},S.find=function(x){for(var v=this._compare,w=this.root,u=[];w;){var T=v(x,w.key);if(u.push(w),T===0)return new k(this,u);T<=0?w=w.left:w=w.right}return new k(this,[])},S.remove=function(x){var v=this.find(x);return v?v.remove():this},S.get=function(x){for(var v=this._compare,w=this.root;w;){var u=v(x,w.key);if(u===0)return w.value;u<=0?w=w.left:w=w.right}};function k(x,v){this.tree=x,this._stack=v}var b=k.prototype;Object.defineProperty(b,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(b,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),b.clone=function(){return new k(this.tree,this._stack.slice())};function U(x,v){x.key=v.key,x.value=v.value,x.left=v.left,x.right=v.right,x._color=v._color,x._count=v._count}function C(x){for(var v,w,u,T,I=x.length-1;I>=0;--I){if(v=x[I],I===0){v._color=i;return}if(w=x[I-1],w.left===v){if(u=w.right,u.right&&u.right._color===r){if(u=w.right=c(u),T=u.right=c(u.right),w.right=u.left,u.left=w,u.right=T,u._color=w._color,v._color=i,w._color=i,T._color=i,n(w),n(u),I>1){var P=x[I-2];P.left===w?P.left=u:P.right=u}x[I-1]=u;return}else if(u.left&&u.left._color===r){if(u=w.right=c(u),T=u.left=c(u.left),w.right=T.left,u.left=T.right,T.left=w,T.right=u,T._color=w._color,w._color=i,u._color=i,v._color=i,n(w),n(u),n(T),I>1){var P=x[I-2];P.left===w?P.left=T:P.right=T}x[I-1]=T;return}if(u._color===i)if(w._color===r){w._color=i,w.right=l(r,u);return}else{w.right=l(r,u);continue}else{if(u=c(u),w.right=u.left,u.left=w,u._color=w._color,w._color=r,n(w),n(u),I>1){var P=x[I-2];P.left===w?P.left=u:P.right=u}x[I-1]=u,x[I]=w,I+11){var P=x[I-2];P.right===w?P.right=u:P.left=u}x[I-1]=u;return}else if(u.right&&u.right._color===r){if(u=w.left=c(u),T=u.right=c(u.right),w.left=T.right,u.right=T.left,T.right=w,T.left=u,T._color=w._color,w._color=i,u._color=i,v._color=i,n(w),n(u),n(T),I>1){var P=x[I-2];P.right===w?P.right=T:P.left=T}x[I-1]=T;return}if(u._color===i)if(w._color===r){w._color=i,w.left=l(r,u);return}else{w.left=l(r,u);continue}else{if(u=c(u),w.left=u.right,u.right=w,u._color=w._color,w._color=r,n(w),n(u),I>1){var P=x[I-2];P.right===w?P.right=u:P.left=u}x[I-1]=u,x[I]=w,I+1=0;--u){var w=x[u];w.left===x[u+1]?v[u]=new a(w._color,w.key,w.value,v[u+1],w.right,w._count):v[u]=new a(w._color,w.key,w.value,w.left,v[u+1],w._count)}if(w=v[v.length-1],w.left&&w.right){var T=v.length;for(w=w.left;w.right;)v.push(w),w=w.right;var I=v[T-1];v.push(new a(w._color,I.key,I.value,w.left,w.right,w._count)),v[T-1].key=w.key,v[T-1].value=w.value;for(var u=v.length-2;u>=T;--u)w=v[u],v[u]=new a(w._color,w.key,w.value,w.left,v[u+1],w._count);v[T-1].left=v[T]}if(w=v[v.length-1],w._color===r){var P=v[v.length-2];P.left===w?P.left=null:P.right===w&&(P.right=null),v.pop();for(var u=0;u0)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(b,"index",{get:function(){var x=0,v=this._stack;if(v.length===0){var w=this.tree.root;return w?w._count:0}else v[v.length-1].left&&(x=v[v.length-1].left._count);for(var u=v.length-2;u>=0;--u)v[u+1]===v[u].right&&(++x,v[u].left&&(x+=v[u].left._count));return x},enumerable:!0}),b.next=function(){var x=this._stack;if(x.length!==0){var v=x[x.length-1];if(v.right)for(v=v.right;v;)x.push(v),v=v.left;else for(x.pop();x.length>0&&x[x.length-1].right===v;)v=x[x.length-1],x.pop()}},Object.defineProperty(b,"hasNext",{get:function(){var x=this._stack;if(x.length===0)return!1;if(x[x.length-1].right)return!0;for(var v=x.length-1;v>0;--v)if(x[v-1].left===x[v])return!0;return!1}}),b.update=function(x){var v=this._stack;if(v.length===0)throw new Error("Can't update empty node!");var w=new Array(v.length),u=v[v.length-1];w[w.length-1]=new a(u._color,u.key,x,u.left,u.right,u._count);for(var T=v.length-2;T>=0;--T)u=v[T],u.left===v[T+1]?w[T]=new a(u._color,u.key,u.value,w[T+1],u.right,u._count):w[T]=new a(u._color,u.key,u.value,u.left,w[T+1],u._count);return new p(this.tree._compare,w[0])},b.prev=function(){var x=this._stack;if(x.length!==0){var v=x[x.length-1];if(v.left)for(v=v.left;v;)x.push(v),v=v.right;else for(x.pop();x.length>0&&x[x.length-1].left===v;)v=x[x.length-1],x.pop()}},Object.defineProperty(b,"hasPrev",{get:function(){var x=this._stack;if(x.length===0)return!1;if(x[x.length-1].left)return!0;for(var v=x.length-1;v>0;--v)if(x[v-1].right===x[v])return!0;return!1}});function K(x,v){return xv?1:0}function z(x){return new p(x||K,null)}}),pi=pt(t=>{at();var{AbstractLevel:e,AbstractIterator:r,AbstractKeyIterator:i,AbstractValueIterator:a}=Xe(),c=jt(),l=di(),n=new Set(["gt","gte","lt","lte"]),p=Symbol("none"),S=Symbol("tree"),E=Symbol("iterator"),L=Symbol("lowerBound"),y=Symbol("upperBound"),k=Symbol("outOfRange"),b=Symbol("reverse"),U=Symbol("options"),C=Symbol("test"),K=Symbol("advance"),z=Symbol("init");function x(J,tt){if(typeof J=="string")return Jtt?1:0;let st=Math.min(J.byteLength,tt.byteLength);for(let nt=0;nt0}function w(J){return x(J,this[y])>=0}function u(J){return x(J,this[y])<0}function T(J){return x(J,this[y])<=0}var I=class extends r{constructor(J,tt){super(J,tt),this[z](J[S],tt)}_next(J){if(!this[E].valid)return this.nextTick(J);let tt=this[E].key,st=this[E].value;if(!this[C](tt))return this.nextTick(J);this[E][this[K]](),this.nextTick(J,null,tt,st)}_nextv(J,tt,st){let nt=this[E],B=[];for(;nt.valid&&B.length0:x(tt,this[L])>=0:"gte"in this[U]?x(tt,this[L])<0:x(tt,this[L])<=0:!0},J.prototype._seek=function(tt,st){this[k](tt)?(this[E]=this[E].tree.end,this[E].next()):this[b]?this[E]=this[E].tree.le(tt):this[E]=this[E].tree.ge(tt)};var G=class extends e{constructor(J,tt,st){if(typeof J=="object"&&J!==null&&(tt=J),typeof J=="function"||typeof tt=="function"||typeof st=="function")throw new c("The levelup-style callback argument has been removed",{code:"LEVEL_LEGACY"});let{storeEncoding:nt,...B}=tt||{};if(nt=nt||"buffer",!["buffer","view","utf8"].includes(nt))throw new c("The storeEncoding option must be 'buffer', 'view' or 'utf8'",{code:"LEVEL_ENCODING_NOT_SUPPORTED"});super({seek:!0,permanence:!1,createIfMissing:!1,errorIfExists:!1,encodings:{[nt]:!0}},B),this[S]=l(x)}_put(J,tt,st,nt){let B=this[S].find(J);B.valid?this[S]=B.update(tt):this[S]=this[S].insert(J,tt),this.nextTick(nt)}_get(J,tt,st){let nt=this[S].get(J);if(typeof nt>"u")return this.nextTick(st,new Error("NotFound"));this.nextTick(st,null,nt)}_getMany(J,tt,st){this.nextTick(st,null,J.map(nt=>this[S].get(nt)))}_del(J,tt,st){this[S]=this[S].remove(J),this.nextTick(st)}_batch(J,tt,st){let nt=this[S];for(let B of J){let O=B.key,W=nt.find(O);B.type==="put"?nt=W.valid?W.update(B.value):nt.insert(O,B.value):nt=W.remove()}this[S]=nt,this.nextTick(st)}_clear(J,tt){if(J.limit===-1&&!Object.keys(J).some(et))return this[S]=l(x),this.nextTick(tt);let st=this._keys({...J}),nt=st.limit,B=0,O=()=>{for(let W=0;W<500;W++){if(++B>nt||!st[E].valid||!st[C](st[E].key))return tt();this[S]=this[S].remove(st[E].key),st[E][st[K]]()}this.nextTick(O)};this.nextTick(O)}_iterator(J){return new I(this,J)}_keys(J){return new P(this,J)}_values(J){return new q(this,J)}};if(t.MemoryLevel=G,typeof Jt.default<"u"&&!Jt.default.browser&&typeof Yt<"u"&&typeof Yt.setImmediate=="function"){let J=Yt.setImmediate;G.prototype.nextTick=function(tt,...st){st.length===0?J(tt):J(()=>tt(...st))}}function et(J){return n.has(J)}}),te=pt((t,e)=>{at(),typeof window<"u"?(window.global=window,Yt.fetch=window.fetch,e.exports={Buffer:oe().Buffer,Crypto:window.crypto}):e.exports={Buffer:oe().Buffer,Crypto:crypto}}),Fr=pt((t,e)=>{at(),function(r){var i,a=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,c=Math.ceil,l=Math.floor,n="[BigNumber Error] ",p=n+"Number primitive has more than 15 significant digits: ",S=1e14,E=14,L=9007199254740991,y=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],k=1e7,b=1e9;function U(T){var I,P,q,G=rt.prototype={constructor:rt,toString:null,valueOf:null},et=new rt(1),J=20,tt=4,st=-7,nt=21,B=-1e7,O=1e7,W=!1,F=1,Z=0,ot={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},ut="0123456789abcdefghijklmnopqrstuvwxyz",gt=!0;function rt(N,$){var M,X,H,s,h,d,A,R,f=this;if(!(f instanceof rt))return new rt(N,$);if($==null){if(N&&N._isBigNumber===!0){f.s=N.s,!N.c||N.e>O?f.c=f.e=null:N.e=10;h/=10,s++);s>O?f.c=f.e=null:(f.e=s,f.c=[N]);return}R=String(N)}else{if(!a.test(R=String(N)))return q(f,R,d);f.s=R.charCodeAt(0)==45?(R=R.slice(1),-1):1}(s=R.indexOf("."))>-1&&(R=R.replace(".","")),(h=R.search(/e/i))>0?(s<0&&(s=h),s+=+R.slice(h+1),R=R.substring(0,h)):s<0&&(s=R.length)}else{if(x($,2,ut.length,"Base"),$==10&>)return f=new rt(N),wt(f,J+f.e+1,tt);if(R=String(N),d=typeof N=="number"){if(N*0!=0)return q(f,R,d,$);if(f.s=1/N<0?(R=R.slice(1),-1):1,rt.DEBUG&&R.replace(/^0\.0*|\./,"").length>15)throw Error(p+N)}else f.s=R.charCodeAt(0)===45?(R=R.slice(1),-1):1;for(M=ut.slice(0,$),s=h=0,A=R.length;hs){s=A;continue}}else if(!H&&(R==R.toUpperCase()&&(R=R.toLowerCase())||R==R.toLowerCase()&&(R=R.toUpperCase()))){H=!0,h=-1,s=0;continue}return q(f,String(N),d,$)}d=!1,R=P(R,$,10,f.s),(s=R.indexOf("."))>-1?R=R.replace(".",""):s=R.length}for(h=0;R.charCodeAt(h)===48;h++);for(A=R.length;R.charCodeAt(--A)===48;);if(R=R.slice(h,++A)){if(A-=h,d&&rt.DEBUG&&A>15&&(N>L||N!==l(N)))throw Error(p+f.s*N);if((s=s-h-1)>O)f.c=f.e=null;else if(s=-b&&H<=b&&H===l(H)){if(X[0]===0){if(H===0&&X.length===1)return!0;break t}if($=(H+1)%E,$<1&&($+=E),String(X[0]).length==$){for($=0;$=S||M!==l(M))break t;if(M!==0)return!0}}}else if(X===null&&H===null&&(s===null||s===1||s===-1))return!0;throw Error(n+"Invalid BigNumber: "+N)},rt.maximum=rt.max=function(){return mt(arguments,G.lt)},rt.minimum=rt.min=function(){return mt(arguments,G.gt)},rt.random=function(){var N=9007199254740992,$=Math.random()*N&2097151?function(){return l(Math.random()*N)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(M){var X,H,s,h,d,A=0,R=[],f=new rt(et);if(M==null?M=J:x(M,0,b),h=c(M/E),W)if(crypto.getRandomValues){for(X=crypto.getRandomValues(new Uint32Array(h*=2));A>>11),d>=9e15?(H=crypto.getRandomValues(new Uint32Array(2)),X[A]=H[0],X[A+1]=H[1]):(R.push(d%1e14),A+=2);A=h/2}else if(crypto.randomBytes){for(X=crypto.randomBytes(h*=7);A=9e15?crypto.randomBytes(7).copy(X,A):(R.push(d%1e14),A+=7);A=h/7}else throw W=!1,Error(n+"crypto unavailable");if(!W)for(;A=10;d/=10,A++);AH-1&&(d[h+1]==null&&(d[h+1]=0),d[h+1]+=d[h]/H|0,d[h]%=H)}return d.reverse()}return function(M,X,H,s,h){var d,A,R,f,_,D,Y,lt,ft=M.indexOf("."),o=J,g=tt;for(ft>=0&&(f=Z,Z=0,M=M.replace(".",""),lt=new rt(X),D=lt.pow(M.length-ft),Z=f,lt.c=$(u(K(D.c),D.e,"0"),10,H,N),lt.e=lt.c.length),Y=$(M,X,H,h?(d=ut,N):(d=N,ut)),R=f=Y.length;Y[--f]==0;Y.pop());if(!Y[0])return d.charAt(0);if(ft<0?--R:(D.c=Y,D.e=R,D.s=s,D=I(D,lt,o,g,H),Y=D.c,_=D.r,R=D.e),A=R+o+1,ft=Y[A],f=H/2,_=_||A<0||Y[A+1]!=null,_=g<4?(ft!=null||_)&&(g==0||g==(D.s<0?3:2)):ft>f||ft==f&&(g==4||_||g==6&&Y[A-1]&1||g==(D.s<0?8:7)),A<1||!Y[0])M=_?u(d.charAt(1),-o,d.charAt(0)):d.charAt(0);else{if(Y.length=A,_)for(--H;++Y[--A]>H;)Y[A]=0,A||(++R,Y=[1].concat(Y));for(f=Y.length;!Y[--f];);for(ft=0,M="";ft<=f;M+=d.charAt(Y[ft++]));M=u(M,R,d.charAt(0))}return M}}(),I=function(){function N(X,H,s){var h,d,A,R,f=0,_=X.length,D=H%k,Y=H/k|0;for(X=X.slice();_--;)A=X[_]%k,R=X[_]/k|0,h=Y*A+R*D,d=D*A+h%k*k+f,f=(d/s|0)+(h/k|0)+Y*R,X[_]=d%s;return f&&(X=[f].concat(X)),X}function $(X,H,s,h){var d,A;if(s!=h)A=s>h?1:-1;else for(d=A=0;dH[d]?1:-1;break}return A}function M(X,H,s,h){for(var d=0;s--;)X[s]-=d,d=X[s]1;X.splice(0,1));}return function(X,H,s,h,d){var A,R,f,_,D,Y,lt,ft,o,g,m,V,Q,it,ct,Et,kt,Tt=X.s==H.s?1:-1,vt=X.c,bt=H.c;if(!vt||!vt[0]||!bt||!bt[0])return new rt(!X.s||!H.s||(vt?bt&&vt[0]==bt[0]:!bt)?NaN:vt&&vt[0]==0||!bt?Tt*0:Tt/0);for(ft=new rt(Tt),o=ft.c=[],R=X.e-H.e,Tt=s+R+1,d||(d=S,R=C(X.e/E)-C(H.e/E),Tt=Tt/E|0),f=0;bt[f]==(vt[f]||0);f++);if(bt[f]>(vt[f]||0)&&R--,Tt<0)o.push(1),_=!0;else{for(it=vt.length,Et=bt.length,f=0,Tt+=2,D=l(d/(bt[0]+1)),D>1&&(bt=N(bt,D,d),vt=N(vt,D,d),Et=bt.length,it=vt.length),Q=Et,g=vt.slice(0,Et),m=g.length;m=d/2&&ct++;do{if(D=0,A=$(bt,g,Et,m),A<0){if(V=g[0],Et!=m&&(V=V*d+(g[1]||0)),D=l(V/ct),D>1)for(D>=d&&(D=d-1),Y=N(bt,D,d),lt=Y.length,m=g.length;$(Y,g,lt,m)==1;)D--,M(Y,Et=10;Tt/=10,f++);wt(ft,s+(ft.e=f+R*E-1)+1,h,_)}else ft.e=R,ft.r=+_;return ft}}();function ht(N,$,M,X){var H,s,h,d,A;if(M==null?M=tt:x(M,0,8),!N.c)return N.toString();if(H=N.c[0],h=N.e,$==null)A=K(N.c),A=X==1||X==2&&(h<=st||h>=nt)?w(A,h):u(A,h,"0");else if(N=wt(new rt(N),$,M),s=N.e,A=K(N.c),d=A.length,X==1||X==2&&($<=s||s<=st)){for(;d<$;A+="0",d++);A=w(A,s)}else if($-=h,A=u(A,s,"0"),s+1>d){if(--$>0)for(A+=".";$--;A+="0");}else if($+=s-d,$>0)for(s+1==d&&(A+=".");$--;A+="0");return N.s<0&&H?"-"+A:A}function mt(N,$){for(var M,X=1,H=new rt(N[0]);X=10;H/=10,X++);return(M=X+M*E-1)>O?N.c=N.e=null:M=10;d/=10,H++);if(s=$-H,s<0)s+=E,h=$,A=_[R=0],f=A/D[H-h-1]%10|0;else if(R=c((s+1)/E),R>=_.length)if(X){for(;_.length<=R;_.push(0));A=f=0,H=1,s%=E,h=s-E+1}else break t;else{for(A=d=_[R],H=1;d>=10;d/=10,H++);s%=E,h=s-E+H,f=h<0?0:A/D[H-h-1]%10|0}if(X=X||$<0||_[R+1]!=null||(h<0?A:A%D[H-h-1]),X=M<4?(f||X)&&(M==0||M==(N.s<0?3:2)):f>5||f==5&&(M==4||X||M==6&&(s>0?h>0?A/D[H-h]:0:_[R-1])%10&1||M==(N.s<0?8:7)),$<1||!_[0])return _.length=0,X?($-=N.e+1,_[0]=D[(E-$%E)%E],N.e=-$||0):_[0]=N.e=0,N;if(s==0?(_.length=R,d=1,R--):(_.length=R+1,d=D[E-s],_[R]=h>0?l(A/D[H-h]%D[h])*d:0),X)for(;;)if(R==0){for(s=1,h=_[0];h>=10;h/=10,s++);for(h=_[0]+=d,d=1;h>=10;h/=10,d++);s!=d&&(N.e++,_[0]==S&&(_[0]=1));break}else{if(_[R]+=d,_[R]!=S)break;_[R--]=0,d=1}for(s=_.length;_[--s]===0;_.pop());}N.e>O?N.c=N.e=null:N.e=nt?w($,M):u($,M,"0"),N.s<0?"-"+$:$)}return G.absoluteValue=G.abs=function(){var N=new rt(this);return N.s<0&&(N.s=1),N},G.comparedTo=function(N,$){return z(this,new rt(N,$))},G.decimalPlaces=G.dp=function(N,$){var M,X,H,s=this;if(N!=null)return x(N,0,b),$==null?$=tt:x($,0,8),wt(new rt(s),N+s.e+1,$);if(!(M=s.c))return null;if(X=((H=M.length-1)-C(this.e/E))*E,H=M[H])for(;H%10==0;H/=10,X--);return X<0&&(X=0),X},G.dividedBy=G.div=function(N,$){return I(this,new rt(N,$),J,tt)},G.dividedToIntegerBy=G.idiv=function(N,$){return I(this,new rt(N,$),0,1)},G.exponentiatedBy=G.pow=function(N,$){var M,X,H,s,h,d,A,R,f,_=this;if(N=new rt(N),N.c&&!N.isInteger())throw Error(n+"Exponent not an integer: "+St(N));if($!=null&&($=new rt($)),d=N.e>14,!_.c||!_.c[0]||_.c[0]==1&&!_.e&&_.c.length==1||!N.c||!N.c[0])return f=new rt(Math.pow(+St(_),d?N.s*(2-v(N)):+St(N))),$?f.mod($):f;if(A=N.s<0,$){if($.c?!$.c[0]:!$.s)return new rt(NaN);X=!A&&_.isInteger()&&$.isInteger(),X&&(_=_.mod($))}else{if(N.e>9&&(_.e>0||_.e<-1||(_.e==0?_.c[0]>1||d&&_.c[1]>=24e7:_.c[0]<8e13||d&&_.c[0]<=9999975e7)))return s=_.s<0&&v(N)?-0:0,_.e>-1&&(s=1/s),new rt(A?1/s:s);Z&&(s=c(Z/E+2))}for(d?(M=new rt(.5),A&&(N.s=1),R=v(N)):(H=Math.abs(+St(N)),R=H%2),f=new rt(et);;){if(R){if(f=f.times(_),!f.c)break;s?f.c.length>s&&(f.c.length=s):X&&(f=f.mod($))}if(H){if(H=l(H/2),H===0)break;R=H%2}else if(N=N.times(M),wt(N,N.e+1,1),N.e>14)R=v(N);else{if(H=+St(N),H===0)break;R=H%2}_=_.times(_),s?_.c&&_.c.length>s&&(_.c.length=s):X&&(_=_.mod($))}return X?f:(A&&(f=et.div(f)),$?f.mod($):s?wt(f,Z,tt,h):f)},G.integerValue=function(N){var $=new rt(this);return N==null?N=tt:x(N,0,8),wt($,$.e+1,N)},G.isEqualTo=G.eq=function(N,$){return z(this,new rt(N,$))===0},G.isFinite=function(){return!!this.c},G.isGreaterThan=G.gt=function(N,$){return z(this,new rt(N,$))>0},G.isGreaterThanOrEqualTo=G.gte=function(N,$){return($=z(this,new rt(N,$)))===1||$===0},G.isInteger=function(){return!!this.c&&C(this.e/E)>this.c.length-2},G.isLessThan=G.lt=function(N,$){return z(this,new rt(N,$))<0},G.isLessThanOrEqualTo=G.lte=function(N,$){return($=z(this,new rt(N,$)))===-1||$===0},G.isNaN=function(){return!this.s},G.isNegative=function(){return this.s<0},G.isPositive=function(){return this.s>0},G.isZero=function(){return!!this.c&&this.c[0]==0},G.minus=function(N,$){var M,X,H,s,h=this,d=h.s;if(N=new rt(N,$),$=N.s,!d||!$)return new rt(NaN);if(d!=$)return N.s=-$,h.plus(N);var A=h.e/E,R=N.e/E,f=h.c,_=N.c;if(!A||!R){if(!f||!_)return f?(N.s=-$,N):new rt(_?h:NaN);if(!f[0]||!_[0])return _[0]?(N.s=-$,N):new rt(f[0]?h:tt==3?-0:0)}if(A=C(A),R=C(R),f=f.slice(),d=A-R){for((s=d<0)?(d=-d,H=f):(R=A,H=_),H.reverse(),$=d;$--;H.push(0));H.reverse()}else for(X=(s=(d=f.length)<($=_.length))?d:$,d=$=0;$0)for(;$--;f[M++]=0);for($=S-1;X>d;){if(f[--X]<_[X]){for(M=X;M&&!f[--M];f[M]=$);--f[M],f[X]+=S}f[X]-=_[X]}for(;f[0]==0;f.splice(0,1),--R);return f[0]?dt(N,f,R):(N.s=tt==3?-1:1,N.c=[N.e=0],N)},G.modulo=G.mod=function(N,$){var M,X,H=this;return N=new rt(N,$),!H.c||!N.s||N.c&&!N.c[0]?new rt(NaN):!N.c||H.c&&!H.c[0]?new rt(H):(F==9?(X=N.s,N.s=1,M=I(H,N,0,3),N.s=X,M.s*=X):M=I(H,N,0,F),N=H.minus(M.times(N)),!N.c[0]&&F==1&&(N.s=H.s),N)},G.multipliedBy=G.times=function(N,$){var M,X,H,s,h,d,A,R,f,_,D,Y,lt,ft,o,g=this,m=g.c,V=(N=new rt(N,$)).c;if(!m||!V||!m[0]||!V[0])return!g.s||!N.s||m&&!m[0]&&!V||V&&!V[0]&&!m?N.c=N.e=N.s=null:(N.s*=g.s,!m||!V?N.c=N.e=null:(N.c=[0],N.e=0)),N;for(X=C(g.e/E)+C(N.e/E),N.s*=g.s,A=m.length,_=V.length,A<_&&(lt=m,m=V,V=lt,H=A,A=_,_=H),H=A+_,lt=[];H--;lt.push(0));for(ft=S,o=k,H=_;--H>=0;){for(M=0,D=V[H]%o,Y=V[H]/o|0,h=A,s=H+h;s>H;)R=m[--h]%o,f=m[h]/o|0,d=Y*R+f*D,R=D*R+d%o*o+lt[s]+M,M=(R/ft|0)+(d/o|0)+Y*f,lt[s--]=R%ft;lt[s]=M}return M?++X:lt.splice(0,1),dt(N,lt,X)},G.negated=function(){var N=new rt(this);return N.s=-N.s||null,N},G.plus=function(N,$){var M,X=this,H=X.s;if(N=new rt(N,$),$=N.s,!H||!$)return new rt(NaN);if(H!=$)return N.s=-$,X.minus(N);var s=X.e/E,h=N.e/E,d=X.c,A=N.c;if(!s||!h){if(!d||!A)return new rt(H/0);if(!d[0]||!A[0])return A[0]?N:new rt(d[0]?X:H*0)}if(s=C(s),h=C(h),d=d.slice(),H=s-h){for(H>0?(h=s,M=A):(H=-H,M=d),M.reverse();H--;M.push(0));M.reverse()}for(H=d.length,$=A.length,H-$<0&&(M=A,A=d,d=M,$=H),H=0;$;)H=(d[--$]=d[$]+A[$]+H)/S|0,d[$]=S===d[$]?0:d[$]%S;return H&&(d=[H].concat(d),++h),dt(N,d,h)},G.precision=G.sd=function(N,$){var M,X,H,s=this;if(N!=null&&N!==!!N)return x(N,1,b),$==null?$=tt:x($,0,8),wt(new rt(s),N,$);if(!(M=s.c))return null;if(H=M.length-1,X=H*E+1,H=M[H]){for(;H%10==0;H/=10,X--);for(H=M[0];H>=10;H/=10,X++);}return N&&s.e+1>X&&(X=s.e+1),X},G.shiftedBy=function(N){return x(N,-L,L),this.times("1e"+N)},G.squareRoot=G.sqrt=function(){var N,$,M,X,H,s=this,h=s.c,d=s.s,A=s.e,R=J+4,f=new rt("0.5");if(d!==1||!h||!h[0])return new rt(!d||d<0&&(!h||h[0])?NaN:h?s:1/0);if(d=Math.sqrt(+St(s)),d==0||d==1/0?($=K(h),($.length+A)%2==0&&($+="0"),d=Math.sqrt(+$),A=C((A+1)/2)-(A<0||A%2),d==1/0?$="5e"+A:($=d.toExponential(),$=$.slice(0,$.indexOf("e")+1)+A),M=new rt($)):M=new rt(d+""),M.c[0]){for(A=M.e,d=A+R,d<3&&(d=0);;)if(H=M,M=f.times(H.plus(I(s,H,R,1))),K(H.c).slice(0,d)===($=K(M.c)).slice(0,d))if(M.e0&<>0){for(s=lt%d||d,f=Y.substr(0,s);s0&&(f+=R+Y.slice(s)),D&&(f="-"+f)}X=_?f+(M.decimalSeparator||"")+((A=+M.fractionGroupSize)?_.replace(new RegExp("\\d{"+A+"}\\B","g"),"$&"+(M.fractionGroupSeparator||"")):_):f}return(M.prefix||"")+X+(M.suffix||"")},G.toFraction=function(N){var $,M,X,H,s,h,d,A,R,f,_,D,Y=this,lt=Y.c;if(N!=null&&(d=new rt(N),!d.isInteger()&&(d.c||d.s!==1)||d.lt(et)))throw Error(n+"Argument "+(d.isInteger()?"out of range: ":"not an integer: ")+St(d));if(!lt)return new rt(Y);for($=new rt(et),R=M=new rt(et),X=A=new rt(et),D=K(lt),s=$.e=D.length-Y.e-1,$.c[0]=y[(h=s%E)<0?E+h:h],N=!N||d.comparedTo($)>0?s>0?$:R:d,h=O,O=1/0,d=new rt(D),A.c[0]=0;f=I(d,$,0,1),H=M.plus(f.times(X)),H.comparedTo(N)!=1;)M=X,X=H,R=A.plus(f.times(H=R)),A=H,$=d.minus(f.times(H=$)),d=H;return H=I(N.minus(M),X,0,1),A=A.plus(H.times(R)),M=M.plus(H.times(X)),A.s=R.s=Y.s,s=s*2,_=I(R,X,s,tt).minus(Y).abs().comparedTo(I(A,M,s,tt).minus(Y).abs())<1?[R,X]:[A,M],O=h,_},G.toNumber=function(){return+St(this)},G.toPrecision=function(N,$){return N!=null&&x(N,1,b),ht(this,N,$,2)},G.toString=function(N){var $,M=this,X=M.s,H=M.e;return H===null?X?($="Infinity",X<0&&($="-"+$)):$="NaN":(N==null?$=H<=st||H>=nt?w(K(M.c),H):u(K(M.c),H,"0"):N===10&>?(M=wt(new rt(M),J+H+1,tt),$=u(K(M.c),M.e,"0")):(x(N,2,ut.length,"Base"),$=P(u(K(M.c),H,"0"),10,N,X,!0)),X<0&&M.c[0]&&($="-"+$)),$},G.valueOf=G.toJSON=function(){return St(this)},G._isBigNumber=!0,T!=null&&rt.set(T),rt}function C(T){var I=T|0;return T>0||T===I?I:I-1}function K(T){for(var I,P,q=1,G=T.length,et=T[0]+"";qnt^P?1:-1;for(tt=(st=G.length)<(nt=et.length)?st:nt,J=0;Jet[J]^P?1:-1;return st==nt?0:st>nt^P?1:-1}function x(T,I,P,q){if(TP||T!==l(T))throw Error(n+(q||"Argument")+(typeof T=="number"?TP?" out of range: ":" not an integer: ":" not a primitive number: ")+String(T))}function v(T){var I=T.c.length-1;return C(T.e/E)==I&&T.c[I]%2!=0}function w(T,I){return(T.length>1?T.charAt(0)+"."+T.slice(1):T)+(I<0?"e":"e+")+I}function u(T,I,P){var q,G;if(I<0){for(G=P+".";++I;G+=P);T=G+T}else if(q=T.length,++I>q){for(G=P,I-=q;--I;G+=P);T+=G}else I{at(),Object.defineProperty(t,"__esModule",{value:!0});var e=Fr(),r=class{constructor(){j(this,"BigNum");this.BigNum=(i,a)=>{let c=e.BigNumber.clone({DECIMAL_PLACES:a});return new c(i)}}winstonToAr(i,{formatted:a=!1,decimals:c=12,trim:l=!0}={}){let n=this.stringToBigNum(i,c).shiftedBy(-12);return a?n.toFormat(c):n.toFixed(c)}arToWinston(i,{formatted:a=!1}={}){let c=this.stringToBigNum(i).shiftedBy(12);return a?c.toFormat():c.toFixed(0)}compare(i,a){let c=this.stringToBigNum(i),l=this.stringToBigNum(a);return c.comparedTo(l)}isEqual(i,a){return this.compare(i,a)===0}isLessThan(i,a){let c=this.stringToBigNum(i),l=this.stringToBigNum(a);return c.isLessThan(l)}isGreaterThan(i,a){let c=this.stringToBigNum(i),l=this.stringToBigNum(a);return c.isGreaterThan(l)}add(i,a){let c=this.stringToBigNum(i);return this.stringToBigNum(a),c.plus(a).toFixed(0)}sub(i,a){let c=this.stringToBigNum(i);return this.stringToBigNum(a),c.minus(a).toFixed(0)}stringToBigNum(i,a=12){return this.BigNum(i,a)}};t.default=r}),yi=pt(t=>{at(),Object.defineProperty(t,"__esModule",{value:!0});var e=class{constructor(a){j(this,"METHOD_GET","GET");j(this,"METHOD_POST","POST");j(this,"config");this.applyConfig(a)}applyConfig(a){this.config=this.mergeDefaults(a)}getConfig(){return this.config}mergeDefaults(a){let c=a.protocol||"http",l=a.port||(c==="https"?443:80);return{host:a.host||"127.0.0.1",protocol:c,port:l,timeout:a.timeout||2e4,logging:a.logging||!1,logger:a.logger||console.log,network:a.network}}async get(a,c){return await this.request(a,{...c,method:this.METHOD_GET})}async post(a,c,l){var p;let n=new Headers((l==null?void 0:l.headers)||{});return(p=n.get("content-type"))!=null&&p.includes("application/json")||n.append("content-type","application/json"),n.append("accept","application/json, text/plain, */*"),await this.request(a,{...l,method:this.METHOD_POST,body:typeof c!="string"?JSON.stringify(c):c,headers:n})}async request(a,c){var k,b;let l=new Headers((c==null?void 0:c.headers)||{}),n=`${this.config.protocol}://${this.config.host}:${this.config.port}`,p=c==null?void 0:c.responseType;c==null||delete c.responseType,a.startsWith("/")&&(a=a.slice(1)),this.config.network&&l.append("x-network",this.config.network),this.config.logging&&this.config.logger(`Requesting: ${n}/${a}`);let S=await fetch(`${n}/${a}`,{...c||{},headers:l});this.config.logging&&this.config.logger(`Response: ${S.url} - ${S.status}`);let E=(b=(k=S.headers.get("content-type"))==null?void 0:k.match(/charset=([^()<>@,;:\"/[\]?.=\s]*)/i))==null?void 0:b[1],L=S,y=async()=>{if(E)try{L.data=new TextDecoder(E).decode(await S.arrayBuffer())}catch{L.data=await S.text()}else L.data=await S.text()};if(p==="arraybuffer")L.data=await S.arrayBuffer();else if(p==="text")await y();else if(p==="webstream")L.data=r(S.body);else try{let U=await S.clone().json();typeof U!="object"?await y():L.data=await S.json(),U=null}catch{await y()}return L}};t.default=e;var r=a=>{let c=a;return typeof c[Symbol.asyncIterator]>"u"?(c[Symbol.asyncIterator]=i(a),c):a},i=function(a){return async function*(){let c=a.getReader();try{for(;;){let{done:l,value:n}=await c.read();if(l)return;yield n}}finally{c.releaseLock()}}}}),Ft=pt(t=>{at(),Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var e=Ur();function r(y){let k=0;for(let C=0;C{at(),Object.defineProperty(t,"__esModule",{value:!0});var e=Ft(),r=class{constructor(){j(this,"keyLength",4096);j(this,"publicExponent",65537);j(this,"hashAlgorithm","sha256");j(this,"driver");if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let i=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),a=await this.driver.exportKey("jwk",i.privateKey);return{kty:a.kty,e:a.e,n:a.n,d:a.d,p:a.p,q:a.q,dp:a.dp,dq:a.dq,qi:a.qi}}async sign(i,a,{saltLength:c}={}){let l=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(i),a);return new Uint8Array(l)}async hash(i,a="SHA-256"){let c=await this.driver.digest(a,i);return new Uint8Array(c)}async verify(i,a,c){let l={kty:"RSA",e:"AQAB",n:i},n=await this.jwkToPublicCryptoKey(l),p=await this.driver.digest("SHA-256",a),S=await this.driver.verify({name:"RSA-PSS",saltLength:0},n,c,a),E=await this.driver.verify({name:"RSA-PSS",saltLength:32},n,c,a),L=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((n.algorithm.modulusLength-1)/8)-p.byteLength-2},n,c,a);return S||E||L}async jwkToCryptoKey(i){return this.driver.importKey("jwk",i,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(i){return this.driver.importKey("jwk",i,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let i=crypto==null?void 0:crypto.subtle;return i===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(a=>typeof i[a]=="function")}async encrypt(i,a,c){let l=await this.driver.importKey("raw",typeof a=="string"?e.stringToBuffer(a):a,{name:"PBKDF2",length:32},!1,["deriveKey"]),n=await this.driver.deriveKey({name:"PBKDF2",salt:c?e.stringToBuffer(c):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},l,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),p=new Uint8Array(16);crypto.getRandomValues(p);let S=await this.driver.encrypt({name:"AES-CBC",iv:p},n,i);return e.concatBuffers([p,S])}async decrypt(i,a,c){let l=await this.driver.importKey("raw",typeof a=="string"?e.stringToBuffer(a):a,{name:"PBKDF2",length:32},!1,["deriveKey"]),n=await this.driver.deriveKey({name:"PBKDF2",salt:c?e.stringToBuffer(c):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},l,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),p=i.slice(0,16),S=await this.driver.decrypt({name:"AES-CBC",iv:p},n,i.slice(16));return e.concatBuffers([S])}};t.default=r}),bi=pt(t=>{at(),Object.defineProperty(t,"__esModule",{value:!0});var e=class{constructor(r){j(this,"api");this.api=r}getInfo(){return this.api.get("info").then(r=>r.data)}getPeers(){return this.api.get("peers").then(r=>r.data)}};t.default=e}),Ae=pt(t=>{at(),Object.defineProperty(t,"__esModule",{value:!0}),t.getError=void 0;var e=class extends Error{constructor(c,l={}){var a=(...i)=>{super(...i);j(this,"type");j(this,"response")};l.message?a(l.message):a(),this.type=c,this.response=l.response}getType(){return this.type}};t.default=e;function r(a){let c=a.data;if(typeof a.data=="string")try{c=JSON.parse(a.data)}catch{}if(a.data instanceof ArrayBuffer||a.data instanceof Uint8Array)try{c=JSON.parse(c.toString())}catch{}return c?c.error||c:a.statusText||"unknown"}t.getError=r}),vi=pt(t=>{at(),Object.defineProperty(t,"__esModule",{value:!0});var e=_e();async function r(a){if(Array.isArray(a)){let n=e.default.utils.concatBuffers([e.default.utils.stringToBuffer("list"),e.default.utils.stringToBuffer(a.length.toString())]);return await i(a,await e.default.crypto.hash(n,"SHA-384"))}let c=e.default.utils.concatBuffers([e.default.utils.stringToBuffer("blob"),e.default.utils.stringToBuffer(a.byteLength.toString())]),l=e.default.utils.concatBuffers([await e.default.crypto.hash(c,"SHA-384"),await e.default.crypto.hash(a,"SHA-384")]);return await e.default.crypto.hash(l,"SHA-384")}t.default=r;async function i(a,c){if(a.length<1)return c;let l=e.default.utils.concatBuffers([c,await r(a[0])]),n=await e.default.crypto.hash(l,"SHA-384");return await i(a.slice(1),n)}}),Vr=pt(t=>{at(),Object.defineProperty(t,"__esModule",{value:!0}),t.debug=t.validatePath=t.arrayCompare=t.bufferToInt=t.intToBuffer=t.arrayFlatten=t.generateProofs=t.buildLayers=t.generateTransactionChunks=t.generateTree=t.computeRootHash=t.generateLeaves=t.chunkData=t.MIN_CHUNK_SIZE=t.MAX_CHUNK_SIZE=void 0;var e=_e(),r=Ft();t.MAX_CHUNK_SIZE=256*1024,t.MIN_CHUNK_SIZE=32*1024;var i=32,a=32;async function c(w){let u=[],T=w,I=0;for(;T.byteLength>=t.MAX_CHUNK_SIZE;){let P=t.MAX_CHUNK_SIZE,q=T.byteLength-t.MAX_CHUNK_SIZE;q>0&&q({type:"leaf",id:await U(await Promise.all([U(u),U(C(I))])),dataHash:u,minByteRange:T,maxByteRange:I})))}t.generateLeaves=l;async function n(w){return(await p(w)).id}t.computeRootHash=n;async function p(w){return await E(await l(await c(w)))}t.generateTree=p;async function S(w){let u=await c(w),T=await l(u),I=await E(T),P=await L(I),q=u.slice(-1)[0];return q.maxByteRange-q.minByteRange===0&&(u.splice(u.length-1,1),P.splice(P.length-1,1)),{data_root:I.id,chunks:u,proofs:P}}t.generateTransactionChunks=S;async function E(w,u=0){if(w.length<2)return w[0];let T=[];for(let I=0;I{Array.isArray(T)?u.push(...k(T)):u.push(T)}),u}t.arrayFlatten=k;async function b(w,u){return u?{type:"branch",id:await U([await U(w.id),await U(u.id),await U(C(w.maxByteRange))]),byteRange:w.maxByteRange,maxByteRange:u.maxByteRange,leftChild:w,rightChild:u}:w}async function U(w){return Array.isArray(w)&&(w=e.default.utils.concatBuffers(w)),new Uint8Array(await e.default.crypto.hash(w))}function C(w){let u=new Uint8Array(i);for(var T=u.length-1;T>=0;T--){var I=w%256;u[T]=I,w=(w-I)/256}return u}t.intToBuffer=C;function K(w){let u=0;for(var T=0;Tw.every((T,I)=>u[I]===T);t.arrayCompare=z;async function x(w,u,T,I,P){if(I<=0)return!1;if(u>=I)return x(w,0,I-1,I,P);if(u<0)return x(w,0,0,I,P);if(P.length==a+i){let nt=P.slice(0,a),B=P.slice(nt.length,nt.length+i),O=await U([await U(nt),await U(B)]);return(0,t.arrayCompare)(w,O)?{offset:I-1,leftBound:T,rightBound:I,chunkSize:I-T}:!1}let q=P.slice(0,a),G=P.slice(q.length,q.length+a),et=P.slice(q.length+G.length,q.length+G.length+i),J=K(et),tt=P.slice(q.length+G.length+et.length),st=await U([await U(q),await U(G),await U(et)]);return(0,t.arrayCompare)(w,st)?ue in t?jn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var j=(t,e,r)=>(Dn(t,typeof e!="symbol"?e+"":e,r),r);var Kn=Object.create,Qe=Object.defineProperty,Wn=Object.getOwnPropertyDescriptor,Fn=Object.getOwnPropertyNames,Vn=Object.getPrototypeOf,Gn=Object.prototype.hasOwnProperty,qn=(t,e,r)=>e in t?Qe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hn=(t,e)=>()=>(t&&(e=t(t=0)),e),pt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),zn=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Fn(e))!Gn.call(t,a)&&a!==r&&Qe(t,a,{get:()=>e[a],enumerable:!(i=Wn(e,a))||i.enumerable});return t},Lt=(t,e,r)=>(r=t!=null?Kn(Vn(t)):{},zn(e||!t||!t.__esModule?Qe(r,"default",{value:t,enumerable:!0}):r,t)),he=(t,e,r)=>(qn(t,typeof e!="symbol"?e+"":e,r),r),Ur=pt(t=>{at(),t.byteLength=p,t.toByteArray=E,t.fromByteArray=k;var e=[],r=[],i=typeof Uint8Array<"u"?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(c=0,l=a.length;c0)throw new Error("Invalid string. Length must be a multiple of 4");var C=b.indexOf("=");C===-1&&(C=U);var K=C===U?0:4-C%4;return[C,K]}function p(b){var U=n(b),C=U[0],K=U[1];return(C+K)*3/4-K}function S(b,U,C){return(U+C)*3/4-C}function E(b){var U,C=n(b),K=C[0],z=C[1],x=new i(S(b,K,z)),v=0,w=z>0?K-4:K,u;for(u=0;u>16&255,x[v++]=U>>8&255,x[v++]=U&255;return z===2&&(U=r[b.charCodeAt(u)]<<2|r[b.charCodeAt(u+1)]>>4,x[v++]=U&255),z===1&&(U=r[b.charCodeAt(u)]<<10|r[b.charCodeAt(u+1)]<<4|r[b.charCodeAt(u+2)]>>2,x[v++]=U>>8&255,x[v++]=U&255),x}function L(b){return e[b>>18&63]+e[b>>12&63]+e[b>>6&63]+e[b&63]}function y(b,U,C){for(var K,z=[],x=U;xw?w:v+x));return K===1?(U=b[C-1],z.push(e[U>>2]+e[U<<4&63]+"==")):K===2&&(U=(b[C-2]<<8)+b[C-1],z.push(e[U>>10]+e[U>>4&63]+e[U<<2&63]+"=")),z.join("")}}),Jn=pt(t=>{at(),t.read=function(e,r,i,a,c){var l,n,p=c*8-a-1,S=(1<>1,L=-7,y=i?c-1:0,k=i?-1:1,b=e[r+y];for(y+=k,l=b&(1<<-L)-1,b>>=-L,L+=p;L>0;l=l*256+e[r+y],y+=k,L-=8);for(n=l&(1<<-L)-1,l>>=-L,L+=a;L>0;n=n*256+e[r+y],y+=k,L-=8);if(l===0)l=1-E;else{if(l===S)return n?NaN:(b?-1:1)*(1/0);n=n+Math.pow(2,a),l=l-E}return(b?-1:1)*n*Math.pow(2,l-a)},t.write=function(e,r,i,a,c,l){var n,p,S,E=l*8-c-1,L=(1<>1,k=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=a?0:l-1,U=a?1:-1,C=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(p=isNaN(r)?1:0,n=L):(n=Math.floor(Math.log(r)/Math.LN2),r*(S=Math.pow(2,-n))<1&&(n--,S*=2),n+y>=1?r+=k/S:r+=k*Math.pow(2,1-y),r*S>=2&&(n++,S/=2),n+y>=L?(p=0,n=L):n+y>=1?(p=(r*S-1)*Math.pow(2,c),n=n+y):(p=r*Math.pow(2,y-1)*Math.pow(2,c),n=0));c>=8;e[i+b]=p&255,b+=U,p/=256,c-=8);for(n=n<0;e[i+b]=n&255,b+=U,n/=256,E-=8);e[i+b-U]|=C*128}}),oe=pt(t=>{at();var e=Ur(),r=Jn(),i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=n,t.SlowBuffer=z,t.INSPECT_MAX_BYTES=50;var a=2147483647;t.kMaxLength=a,n.TYPED_ARRAY_SUPPORT=c(),!n.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 c(){try{var s=new Uint8Array(1),h={foo:function(){return 42}};return Object.setPrototypeOf(h,Uint8Array.prototype),Object.setPrototypeOf(s,h),s.foo()===42}catch{return!1}}Object.defineProperty(n.prototype,"parent",{enumerable:!0,get:function(){if(n.isBuffer(this))return this.buffer}}),Object.defineProperty(n.prototype,"offset",{enumerable:!0,get:function(){if(n.isBuffer(this))return this.byteOffset}});function l(s){if(s>a)throw new RangeError('The value "'+s+'" is invalid for option "size"');var h=new Uint8Array(s);return Object.setPrototypeOf(h,n.prototype),h}function n(s,h,d){if(typeof s=="number"){if(typeof h=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return L(s)}return p(s,h,d)}n.poolSize=8192;function p(s,h,d){if(typeof s=="string")return y(s,h);if(ArrayBuffer.isView(s))return b(s);if(s==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof s);if(M(s,ArrayBuffer)||s&&M(s.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(M(s,SharedArrayBuffer)||s&&M(s.buffer,SharedArrayBuffer)))return U(s,h,d);if(typeof s=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var A=s.valueOf&&s.valueOf();if(A!=null&&A!==s)return n.from(A,h,d);var R=C(s);if(R)return R;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof s[Symbol.toPrimitive]=="function")return n.from(s[Symbol.toPrimitive]("string"),h,d);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof s)}n.from=function(s,h,d){return p(s,h,d)},Object.setPrototypeOf(n.prototype,Uint8Array.prototype),Object.setPrototypeOf(n,Uint8Array);function S(s){if(typeof s!="number")throw new TypeError('"size" argument must be of type number');if(s<0)throw new RangeError('The value "'+s+'" is invalid for option "size"')}function E(s,h,d){return S(s),s<=0?l(s):h!==void 0?typeof d=="string"?l(s).fill(h,d):l(s).fill(h):l(s)}n.alloc=function(s,h,d){return E(s,h,d)};function L(s){return S(s),l(s<0?0:K(s)|0)}n.allocUnsafe=function(s){return L(s)},n.allocUnsafeSlow=function(s){return L(s)};function y(s,h){if((typeof h!="string"||h==="")&&(h="utf8"),!n.isEncoding(h))throw new TypeError("Unknown encoding: "+h);var d=x(s,h)|0,A=l(d),R=A.write(s,h);return R!==d&&(A=A.slice(0,R)),A}function k(s){for(var h=s.length<0?0:K(s.length)|0,d=l(h),A=0;A=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return s|0}function z(s){return+s!=s&&(s=0),n.alloc(+s)}n.isBuffer=function(s){return s!=null&&s._isBuffer===!0&&s!==n.prototype},n.compare=function(s,h){if(M(s,Uint8Array)&&(s=n.from(s,s.offset,s.byteLength)),M(h,Uint8Array)&&(h=n.from(h,h.offset,h.byteLength)),!n.isBuffer(s)||!n.isBuffer(h))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(s===h)return 0;for(var d=s.length,A=h.length,R=0,f=Math.min(d,A);RA.length?n.from(f).copy(A,R):Uint8Array.prototype.set.call(A,f,R);else if(n.isBuffer(f))f.copy(A,R);else throw new TypeError('"list" argument must be an Array of Buffers');R+=f.length}return A};function x(s,h){if(n.isBuffer(s))return s.length;if(ArrayBuffer.isView(s)||M(s,ArrayBuffer))return s.byteLength;if(typeof s!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof s);var d=s.length,A=arguments.length>2&&arguments[2]===!0;if(!A&&d===0)return 0;for(var R=!1;;)switch(h){case"ascii":case"latin1":case"binary":return d;case"utf8":case"utf-8":return dt(s).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d*2;case"hex":return d>>>1;case"base64":return N(s).length;default:if(R)return A?-1:dt(s).length;h=(""+h).toLowerCase(),R=!0}}n.byteLength=x;function v(s,h,d){var A=!1;if((h===void 0||h<0)&&(h=0),h>this.length||((d===void 0||d>this.length)&&(d=this.length),d<=0)||(d>>>=0,h>>>=0,d<=h))return"";for(s||(s="utf8");;)switch(s){case"hex":return W(this,h,d);case"utf8":case"utf-8":return tt(this,h,d);case"ascii":return B(this,h,d);case"latin1":case"binary":return O(this,h,d);case"base64":return J(this,h,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,h,d);default:if(A)throw new TypeError("Unknown encoding: "+s);s=(s+"").toLowerCase(),A=!0}}n.prototype._isBuffer=!0;function w(s,h,d){var A=s[h];s[h]=s[d],s[d]=A}n.prototype.swap16=function(){var s=this.length;if(s%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var h=0;hh&&(s+=" ... "),""},i&&(n.prototype[i]=n.prototype.inspect),n.prototype.compare=function(s,h,d,A,R){if(M(s,Uint8Array)&&(s=n.from(s,s.offset,s.byteLength)),!n.isBuffer(s))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof s);if(h===void 0&&(h=0),d===void 0&&(d=s?s.length:0),A===void 0&&(A=0),R===void 0&&(R=this.length),h<0||d>s.length||A<0||R>this.length)throw new RangeError("out of range index");if(A>=R&&h>=d)return 0;if(A>=R)return-1;if(h>=d)return 1;if(h>>>=0,d>>>=0,A>>>=0,R>>>=0,this===s)return 0;for(var f=R-A,_=d-h,D=Math.min(f,_),Y=this.slice(A,R),lt=s.slice(h,d),ft=0;ft2147483647?d=2147483647:d<-2147483648&&(d=-2147483648),d=+d,X(d)&&(d=R?0:s.length-1),d<0&&(d=s.length+d),d>=s.length){if(R)return-1;d=s.length-1}else if(d<0)if(R)d=0;else return-1;if(typeof h=="string"&&(h=n.from(h,A)),n.isBuffer(h))return h.length===0?-1:T(s,h,d,A,R);if(typeof h=="number")return h=h&255,typeof Uint8Array.prototype.indexOf=="function"?R?Uint8Array.prototype.indexOf.call(s,h,d):Uint8Array.prototype.lastIndexOf.call(s,h,d):T(s,[h],d,A,R);throw new TypeError("val must be string, number or Buffer")}function T(s,h,d,A,R){var f=1,_=s.length,D=h.length;if(A!==void 0&&(A=String(A).toLowerCase(),A==="ucs2"||A==="ucs-2"||A==="utf16le"||A==="utf-16le")){if(s.length<2||h.length<2)return-1;f=2,_/=2,D/=2,d/=2}function Y(m,V){return f===1?m[V]:m.readUInt16BE(V*f)}var lt;if(R){var ft=-1;for(lt=d;lt<_;lt++)if(Y(s,lt)===Y(h,ft===-1?0:lt-ft)){if(ft===-1&&(ft=lt),lt-ft+1===D)return ft*f}else ft!==-1&&(lt-=lt-ft),ft=-1}else for(d+D>_&&(d=_-D),lt=d;lt>=0;lt--){for(var o=!0,g=0;gR&&(A=R)):A=R;var f=h.length;A>f/2&&(A=f/2);for(var _=0;_>>0,isFinite(d)?(d=d>>>0,A===void 0&&(A="utf8")):(A=d,d=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var R=this.length-h;if((d===void 0||d>R)&&(d=R),s.length>0&&(d<0||h<0)||h>this.length)throw new RangeError("Attempt to write outside buffer bounds");A||(A="utf8");for(var f=!1;;)switch(A){case"hex":return I(this,s,h,d);case"utf8":case"utf-8":return P(this,s,h,d);case"ascii":case"latin1":case"binary":return q(this,s,h,d);case"base64":return G(this,s,h,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return et(this,s,h,d);default:if(f)throw new TypeError("Unknown encoding: "+A);A=(""+A).toLowerCase(),f=!0}},n.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function J(s,h,d){return h===0&&d===s.length?e.fromByteArray(s):e.fromByteArray(s.slice(h,d))}function tt(s,h,d){d=Math.min(s.length,d);for(var A=[],R=h;R239?4:f>223?3:f>191?2:1;if(R+D<=d){var Y,lt,ft,o;switch(D){case 1:f<128&&(_=f);break;case 2:Y=s[R+1],(Y&192)===128&&(o=(f&31)<<6|Y&63,o>127&&(_=o));break;case 3:Y=s[R+1],lt=s[R+2],(Y&192)===128&&(lt&192)===128&&(o=(f&15)<<12|(Y&63)<<6|lt&63,o>2047&&(o<55296||o>57343)&&(_=o));break;case 4:Y=s[R+1],lt=s[R+2],ft=s[R+3],(Y&192)===128&&(lt&192)===128&&(ft&192)===128&&(o=(f&15)<<18|(Y&63)<<12|(lt&63)<<6|ft&63,o>65535&&o<1114112&&(_=o))}}_===null?(_=65533,D=1):_>65535&&(_-=65536,A.push(_>>>10&1023|55296),_=56320|_&1023),A.push(_),R+=D}return nt(A)}var st=4096;function nt(s){var h=s.length;if(h<=st)return String.fromCharCode.apply(String,s);for(var d="",A=0;AA)&&(d=A);for(var R="",f=h;fd&&(s=d),h<0?(h+=d,h<0&&(h=0)):h>d&&(h=d),hd)throw new RangeError("Trying to access beyond buffer length")}n.prototype.readUintLE=n.prototype.readUIntLE=function(s,h,d){s=s>>>0,h=h>>>0,d||Z(s,h,this.length);for(var A=this[s],R=1,f=0;++f>>0,h=h>>>0,d||Z(s,h,this.length);for(var A=this[s+--h],R=1;h>0&&(R*=256);)A+=this[s+--h]*R;return A},n.prototype.readUint8=n.prototype.readUInt8=function(s,h){return s=s>>>0,h||Z(s,1,this.length),this[s]},n.prototype.readUint16LE=n.prototype.readUInt16LE=function(s,h){return s=s>>>0,h||Z(s,2,this.length),this[s]|this[s+1]<<8},n.prototype.readUint16BE=n.prototype.readUInt16BE=function(s,h){return s=s>>>0,h||Z(s,2,this.length),this[s]<<8|this[s+1]},n.prototype.readUint32LE=n.prototype.readUInt32LE=function(s,h){return s=s>>>0,h||Z(s,4,this.length),(this[s]|this[s+1]<<8|this[s+2]<<16)+this[s+3]*16777216},n.prototype.readUint32BE=n.prototype.readUInt32BE=function(s,h){return s=s>>>0,h||Z(s,4,this.length),this[s]*16777216+(this[s+1]<<16|this[s+2]<<8|this[s+3])},n.prototype.readIntLE=function(s,h,d){s=s>>>0,h=h>>>0,d||Z(s,h,this.length);for(var A=this[s],R=1,f=0;++f=R&&(A-=Math.pow(2,8*h)),A},n.prototype.readIntBE=function(s,h,d){s=s>>>0,h=h>>>0,d||Z(s,h,this.length);for(var A=h,R=1,f=this[s+--A];A>0&&(R*=256);)f+=this[s+--A]*R;return R*=128,f>=R&&(f-=Math.pow(2,8*h)),f},n.prototype.readInt8=function(s,h){return s=s>>>0,h||Z(s,1,this.length),this[s]&128?(255-this[s]+1)*-1:this[s]},n.prototype.readInt16LE=function(s,h){s=s>>>0,h||Z(s,2,this.length);var d=this[s]|this[s+1]<<8;return d&32768?d|4294901760:d},n.prototype.readInt16BE=function(s,h){s=s>>>0,h||Z(s,2,this.length);var d=this[s+1]|this[s]<<8;return d&32768?d|4294901760:d},n.prototype.readInt32LE=function(s,h){return s=s>>>0,h||Z(s,4,this.length),this[s]|this[s+1]<<8|this[s+2]<<16|this[s+3]<<24},n.prototype.readInt32BE=function(s,h){return s=s>>>0,h||Z(s,4,this.length),this[s]<<24|this[s+1]<<16|this[s+2]<<8|this[s+3]},n.prototype.readFloatLE=function(s,h){return s=s>>>0,h||Z(s,4,this.length),r.read(this,s,!0,23,4)},n.prototype.readFloatBE=function(s,h){return s=s>>>0,h||Z(s,4,this.length),r.read(this,s,!1,23,4)},n.prototype.readDoubleLE=function(s,h){return s=s>>>0,h||Z(s,8,this.length),r.read(this,s,!0,52,8)},n.prototype.readDoubleBE=function(s,h){return s=s>>>0,h||Z(s,8,this.length),r.read(this,s,!1,52,8)};function ot(s,h,d,A,R,f){if(!n.isBuffer(s))throw new TypeError('"buffer" argument must be a Buffer instance');if(h>R||hs.length)throw new RangeError("Index out of range")}n.prototype.writeUintLE=n.prototype.writeUIntLE=function(s,h,d,A){if(s=+s,h=h>>>0,d=d>>>0,!A){var R=Math.pow(2,8*d)-1;ot(this,s,h,d,R,0)}var f=1,_=0;for(this[h]=s&255;++_>>0,d=d>>>0,!A){var R=Math.pow(2,8*d)-1;ot(this,s,h,d,R,0)}var f=d-1,_=1;for(this[h+f]=s&255;--f>=0&&(_*=256);)this[h+f]=s/_&255;return h+d},n.prototype.writeUint8=n.prototype.writeUInt8=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,1,255,0),this[h]=s&255,h+1},n.prototype.writeUint16LE=n.prototype.writeUInt16LE=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,2,65535,0),this[h]=s&255,this[h+1]=s>>>8,h+2},n.prototype.writeUint16BE=n.prototype.writeUInt16BE=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,2,65535,0),this[h]=s>>>8,this[h+1]=s&255,h+2},n.prototype.writeUint32LE=n.prototype.writeUInt32LE=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,4,4294967295,0),this[h+3]=s>>>24,this[h+2]=s>>>16,this[h+1]=s>>>8,this[h]=s&255,h+4},n.prototype.writeUint32BE=n.prototype.writeUInt32BE=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,4,4294967295,0),this[h]=s>>>24,this[h+1]=s>>>16,this[h+2]=s>>>8,this[h+3]=s&255,h+4},n.prototype.writeIntLE=function(s,h,d,A){if(s=+s,h=h>>>0,!A){var R=Math.pow(2,8*d-1);ot(this,s,h,d,R-1,-R)}var f=0,_=1,D=0;for(this[h]=s&255;++f>0)-D&255;return h+d},n.prototype.writeIntBE=function(s,h,d,A){if(s=+s,h=h>>>0,!A){var R=Math.pow(2,8*d-1);ot(this,s,h,d,R-1,-R)}var f=d-1,_=1,D=0;for(this[h+f]=s&255;--f>=0&&(_*=256);)s<0&&D===0&&this[h+f+1]!==0&&(D=1),this[h+f]=(s/_>>0)-D&255;return h+d},n.prototype.writeInt8=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,1,127,-128),s<0&&(s=255+s+1),this[h]=s&255,h+1},n.prototype.writeInt16LE=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,2,32767,-32768),this[h]=s&255,this[h+1]=s>>>8,h+2},n.prototype.writeInt16BE=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,2,32767,-32768),this[h]=s>>>8,this[h+1]=s&255,h+2},n.prototype.writeInt32LE=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,4,2147483647,-2147483648),this[h]=s&255,this[h+1]=s>>>8,this[h+2]=s>>>16,this[h+3]=s>>>24,h+4},n.prototype.writeInt32BE=function(s,h,d){return s=+s,h=h>>>0,d||ot(this,s,h,4,2147483647,-2147483648),s<0&&(s=4294967295+s+1),this[h]=s>>>24,this[h+1]=s>>>16,this[h+2]=s>>>8,this[h+3]=s&255,h+4};function ut(s,h,d,A,R,f){if(d+A>s.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("Index out of range")}function gt(s,h,d,A,R){return h=+h,d=d>>>0,R||ut(s,h,d,4),r.write(s,h,d,A,23,4),d+4}n.prototype.writeFloatLE=function(s,h,d){return gt(this,s,h,!0,d)},n.prototype.writeFloatBE=function(s,h,d){return gt(this,s,h,!1,d)};function rt(s,h,d,A,R){return h=+h,d=d>>>0,R||ut(s,h,d,8),r.write(s,h,d,A,52,8),d+8}n.prototype.writeDoubleLE=function(s,h,d){return rt(this,s,h,!0,d)},n.prototype.writeDoubleBE=function(s,h,d){return rt(this,s,h,!1,d)},n.prototype.copy=function(s,h,d,A){if(!n.isBuffer(s))throw new TypeError("argument should be a Buffer");if(d||(d=0),!A&&A!==0&&(A=this.length),h>=s.length&&(h=s.length),h||(h=0),A>0&&A=this.length)throw new RangeError("Index out of range");if(A<0)throw new RangeError("sourceEnd out of bounds");A>this.length&&(A=this.length),s.length-h>>0,d=d===void 0?this.length:d>>>0,s||(s=0);var f;if(typeof s=="number")for(f=h;f55295&&d<57344){if(!R){if(d>56319){(h-=3)>-1&&f.push(239,191,189);continue}else if(_+1===A){(h-=3)>-1&&f.push(239,191,189);continue}R=d;continue}if(d<56320){(h-=3)>-1&&f.push(239,191,189),R=d;continue}d=(R-55296<<10|d-56320)+65536}else R&&(h-=3)>-1&&f.push(239,191,189);if(R=null,d<128){if((h-=1)<0)break;f.push(d)}else if(d<2048){if((h-=2)<0)break;f.push(d>>6|192,d&63|128)}else if(d<65536){if((h-=3)<0)break;f.push(d>>12|224,d>>6&63|128,d&63|128)}else if(d<1114112){if((h-=4)<0)break;f.push(d>>18|240,d>>12&63|128,d>>6&63|128,d&63|128)}else throw new Error("Invalid code point")}return f}function wt(s){for(var h=[],d=0;d>8,R=d%256,f.push(R),f.push(A);return f}function N(s){return e.toByteArray(mt(s))}function $(s,h,d,A){for(var R=0;R=h.length||R>=s.length);++R)h[R+d]=s[R];return R}function M(s,h){return s instanceof h||s!=null&&s.constructor!=null&&s.constructor.name!=null&&s.constructor.name===h.name}function X(s){return s!==s}var H=function(){for(var s="0123456789abcdef",h=new Array(256),d=0;d<16;++d)for(var A=d*16,R=0;R<16;++R)h[A+R]=s[d]+s[R];return h}()}),Qn=pt((t,e)=>{at();var r=e.exports={},i,a;function c(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?i=setTimeout:i=c}catch{i=c}try{typeof clearTimeout=="function"?a=clearTimeout:a=l}catch{a=l}})();function n(K){if(i===setTimeout)return setTimeout(K,0);if((i===c||!i)&&setTimeout)return i=setTimeout,setTimeout(K,0);try{return i(K,0)}catch{try{return i.call(null,K,0)}catch{return i.call(this,K,0)}}}function p(K){if(a===clearTimeout)return clearTimeout(K);if((a===l||!a)&&clearTimeout)return a=clearTimeout,clearTimeout(K);try{return a(K)}catch{try{return a.call(null,K)}catch{return a.call(this,K)}}}var S=[],E=!1,L,y=-1;function k(){!E||!L||(E=!1,L.length?S=L.concat(S):y=-1,S.length&&b())}function b(){if(!E){var K=n(k);E=!0;for(var z=S.length;z;){for(L=S,S=[];++y1)for(var x=1;x{Ct=Lt(oe()),Jt=Lt(Qn()),fr=function(t){function e(){var i=this||self;return delete t.prototype.__magic__,i}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object),Yt=fr}),Yn=pt(t=>{at(),t.supports=function(...e){let r=e.reduce((i,a)=>Object.assign(i,a),{});return Object.assign(r,{snapshots:r.snapshots||!1,permanence:r.permanence||!1,seek:r.seek||!1,clear:r.clear||!1,getMany:r.getMany||!1,keyIterator:r.keyIterator||!1,valueIterator:r.valueIterator||!1,iteratorNextv:r.iteratorNextv||!1,iteratorAll:r.iteratorAll||!1,status:r.status||!1,createIfMissing:r.createIfMissing||!1,errorIfExists:r.errorIfExists||!1,deferredOpen:r.deferredOpen||!1,promises:r.promises||!1,streams:r.streams||!1,encodings:Object.assign({},r.encodings),events:Object.assign({},r.events),additionalMethods:Object.assign({},r.additionalMethods)})}}),jt=pt((t,e)=>{at(),e.exports=class extends Error{constructor(r,i){super(r||""),typeof i=="object"&&i!==null&&(i.code&&(this.code=String(i.code)),i.expected&&(this.expected=!0),i.transient&&(this.transient=!0),i.cause&&(this.cause=i.cause)),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}}),$r=pt((t,e)=>{at();var r=null;e.exports=function(){return r===null&&(r={textEncoder:new TextEncoder,textDecoder:new TextDecoder}),r}}),Pr=pt(t=>{at();var e=jt(),r=new Set(["buffer","view","utf8"]),i=class{constructor(a){if(this.encode=a.encode||this.encode,this.decode=a.decode||this.decode,this.name=a.name||this.name,this.format=a.format||this.format,typeof this.encode!="function")throw new TypeError("The 'encode' property must be a function");if(typeof this.decode!="function")throw new TypeError("The 'decode' property must be a function");if(this.encode=this.encode.bind(this),this.decode=this.decode.bind(this),typeof this.name!="string"||this.name==="")throw new TypeError("The 'name' property must be a string");if(typeof this.format!="string"||!r.has(this.format))throw new TypeError("The 'format' property must be one of 'buffer', 'view', 'utf8'");a.createViewTranscoder&&(this.createViewTranscoder=a.createViewTranscoder),a.createBufferTranscoder&&(this.createBufferTranscoder=a.createBufferTranscoder),a.createUTF8Transcoder&&(this.createUTF8Transcoder=a.createUTF8Transcoder)}get commonName(){return this.name.split("+")[0]}createBufferTranscoder(){throw new e(`Encoding '${this.name}' cannot be transcoded to 'buffer'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createViewTranscoder(){throw new e(`Encoding '${this.name}' cannot be transcoded to 'view'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createUTF8Transcoder(){throw new e(`Encoding '${this.name}' cannot be transcoded to 'utf8'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}};t.Encoding=i}),Mr=pt(t=>{at();var{Buffer:e}=oe()||{},{Encoding:r}=Pr(),i=$r(),a=class extends r{constructor(n){super({...n,format:"buffer"})}createViewTranscoder(){return new c({encode:this.encode,decode:n=>this.decode(e.from(n.buffer,n.byteOffset,n.byteLength)),name:`${this.name}+view`})}createBufferTranscoder(){return this}},c=class extends r{constructor(n){super({...n,format:"view"})}createBufferTranscoder(){return new a({encode:n=>{let p=this.encode(n);return e.from(p.buffer,p.byteOffset,p.byteLength)},decode:this.decode,name:`${this.name}+buffer`})}createViewTranscoder(){return this}},l=class extends r{constructor(n){super({...n,format:"utf8"})}createBufferTranscoder(){return new a({encode:n=>e.from(this.encode(n),"utf8"),decode:n=>this.decode(n.toString("utf8")),name:`${this.name}+buffer`})}createViewTranscoder(){let{textEncoder:n,textDecoder:p}=i();return new c({encode:S=>n.encode(this.encode(S)),decode:S=>this.decode(p.decode(S)),name:`${this.name}+view`})}createUTF8Transcoder(){return this}};t.BufferFormat=a,t.ViewFormat=c,t.UTF8Format=l}),Xn=pt(t=>{at();var{Buffer:e}=oe()||{Buffer:{isBuffer:()=>!1}},{textEncoder:r,textDecoder:i}=$r()(),{BufferFormat:a,ViewFormat:c,UTF8Format:l}=Mr(),n=p=>p;t.utf8=new l({encode:function(p){return e.isBuffer(p)?p.toString("utf8"):ArrayBuffer.isView(p)?i.decode(p):String(p)},decode:n,name:"utf8",createViewTranscoder(){return new c({encode:function(p){return ArrayBuffer.isView(p)?p:r.encode(p)},decode:function(p){return i.decode(p)},name:`${this.name}+view`})},createBufferTranscoder(){return new a({encode:function(p){return e.isBuffer(p)?p:ArrayBuffer.isView(p)?e.from(p.buffer,p.byteOffset,p.byteLength):e.from(String(p),"utf8")},decode:function(p){return p.toString("utf8")},name:`${this.name}+buffer`})}}),t.json=new l({encode:JSON.stringify,decode:JSON.parse,name:"json"}),t.buffer=new a({encode:function(p){return e.isBuffer(p)?p:ArrayBuffer.isView(p)?e.from(p.buffer,p.byteOffset,p.byteLength):e.from(String(p),"utf8")},decode:n,name:"buffer",createViewTranscoder(){return new c({encode:function(p){return ArrayBuffer.isView(p)?p:e.from(String(p),"utf8")},decode:function(p){return e.from(p.buffer,p.byteOffset,p.byteLength)},name:`${this.name}+view`})}}),t.view=new c({encode:function(p){return ArrayBuffer.isView(p)?p:r.encode(p)},decode:n,name:"view",createBufferTranscoder(){return new a({encode:function(p){return e.isBuffer(p)?p:ArrayBuffer.isView(p)?e.from(p.buffer,p.byteOffset,p.byteLength):e.from(String(p),"utf8")},decode:n,name:`${this.name}+buffer`})}}),t.hex=new a({encode:function(p){return e.isBuffer(p)?p:e.from(String(p),"hex")},decode:function(p){return p.toString("hex")},name:"hex"}),t.base64=new a({encode:function(p){return e.isBuffer(p)?p:e.from(String(p),"base64")},decode:function(p){return p.toString("base64")},name:"base64"})}),Zn=pt(t=>{at();var e=jt(),r=Xn(),{Encoding:i}=Pr(),{BufferFormat:a,ViewFormat:c,UTF8Format:l}=Mr(),n=Symbol("formats"),p=Symbol("encodings"),S=new Set(["buffer","view","utf8"]),E=class{constructor(C){if(Array.isArray(C)){if(!C.every(K=>S.has(K)))throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}else throw new TypeError("The first argument 'formats' must be an array");this[p]=new Map,this[n]=new Set(C);for(let K in r)try{this.encoding(K)}catch(z){if(z.code!=="LEVEL_ENCODING_NOT_SUPPORTED")throw z}}encodings(){return Array.from(new Set(this[p].values()))}encoding(C){let K=this[p].get(C);if(K===void 0){if(typeof C=="string"&&C!==""){if(K=b[C],!K)throw new e(`Encoding '${C}' is not found`,{code:"LEVEL_ENCODING_NOT_FOUND"})}else{if(typeof C!="object"||C===null)throw new TypeError("First argument 'encoding' must be a string or object");K=L(C)}let{name:z,format:x}=K;if(!this[n].has(x))if(this[n].has("view"))K=K.createViewTranscoder();else if(this[n].has("buffer"))K=K.createBufferTranscoder();else if(this[n].has("utf8"))K=K.createUTF8Transcoder();else throw new e(`Encoding '${z}' cannot be transcoded`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"});for(let v of[C,z,K.name,K.commonName])this[p].set(v,K)}return K}};t.Transcoder=E;function L(C){if(C instanceof i)return C;let K="type"in C&&typeof C.type=="string"?C.type:void 0,z=C.name||K||`anonymous-${U++}`;switch(y(C)){case"view":return new c({...C,name:z});case"utf8":return new l({...C,name:z});case"buffer":return new a({...C,name:z});default:throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}}function y(C){return"format"in C&&C.format!==void 0?C.format:"buffer"in C&&typeof C.buffer=="boolean"?C.buffer?"buffer":"utf8":"code"in C&&Number.isInteger(C.code)?"view":"buffer"}var k={binary:r.buffer,"utf-8":r.utf8},b={...r,...k},U=0}),ti=pt((t,e)=>{at();var r=typeof Reflect=="object"?Reflect:null,i=r&&typeof r.apply=="function"?r.apply:function(u,T,I){return Function.prototype.apply.call(u,T,I)},a;r&&typeof r.ownKeys=="function"?a=r.ownKeys:Object.getOwnPropertySymbols?a=function(u){return Object.getOwnPropertyNames(u).concat(Object.getOwnPropertySymbols(u))}:a=function(u){return Object.getOwnPropertyNames(u)};function c(u){console&&console.warn&&console.warn(u)}var l=Number.isNaN||function(u){return u!==u};function n(){n.init.call(this)}e.exports=n,e.exports.once=x,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._eventsCount=0,n.prototype._maxListeners=void 0;var p=10;function S(u){if(typeof u!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof u)}Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return p},set:function(u){if(typeof u!="number"||u<0||l(u))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+u+".");p=u}}),n.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},n.prototype.setMaxListeners=function(u){if(typeof u!="number"||u<0||l(u))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+u+".");return this._maxListeners=u,this};function E(u){return u._maxListeners===void 0?n.defaultMaxListeners:u._maxListeners}n.prototype.getMaxListeners=function(){return E(this)},n.prototype.emit=function(u){for(var T=[],I=1;I0&&(G=T[0]),G instanceof Error)throw G;var et=new Error("Unhandled error."+(G?" ("+G.message+")":""));throw et.context=G,et}var J=q[u];if(J===void 0)return!1;if(typeof J=="function")i(J,this,T);else for(var tt=J.length,st=C(J,tt),I=0;I0&&et.length>q&&!et.warned){et.warned=!0;var J=new Error("Possible EventEmitter memory leak detected. "+et.length+" "+String(T)+" listeners added. Use emitter.setMaxListeners() to increase limit");J.name="MaxListenersExceededWarning",J.emitter=u,J.type=T,J.count=et.length,c(J)}return u}n.prototype.addListener=function(u,T){return L(this,u,T,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(u,T){return L(this,u,T,!0)};function y(){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 k(u,T,I){var P={fired:!1,wrapFn:void 0,target:u,type:T,listener:I},q=y.bind(P);return q.listener=I,P.wrapFn=q,q}n.prototype.once=function(u,T){return S(T),this.on(u,k(this,u,T)),this},n.prototype.prependOnceListener=function(u,T){return S(T),this.prependListener(u,k(this,u,T)),this},n.prototype.removeListener=function(u,T){var I,P,q,G,et;if(S(T),P=this._events,P===void 0)return this;if(I=P[u],I===void 0)return this;if(I===T||I.listener===T)--this._eventsCount===0?this._events=Object.create(null):(delete P[u],P.removeListener&&this.emit("removeListener",u,I.listener||T));else if(typeof I!="function"){for(q=-1,G=I.length-1;G>=0;G--)if(I[G]===T||I[G].listener===T){et=I[G].listener,q=G;break}if(q<0)return this;q===0?I.shift():K(I,q),I.length===1&&(P[u]=I[0]),P.removeListener!==void 0&&this.emit("removeListener",u,et||T)}return this},n.prototype.off=n.prototype.removeListener,n.prototype.removeAllListeners=function(u){var T,I,P;if(I=this._events,I===void 0)return this;if(I.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):I[u]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete I[u]),this;if(arguments.length===0){var q=Object.keys(I),G;for(P=0;P=0;P--)this.removeListener(u,T[P]);return this};function b(u,T,I){var P=u._events;if(P===void 0)return[];var q=P[T];return q===void 0?[]:typeof q=="function"?I?[q.listener||q]:[q]:I?z(q):C(q,q.length)}n.prototype.listeners=function(u){return b(this,u,!0)},n.prototype.rawListeners=function(u){return b(this,u,!1)},n.listenerCount=function(u,T){return typeof u.listenerCount=="function"?u.listenerCount(T):U.call(u,T)},n.prototype.listenerCount=U;function U(u){var T=this._events;if(T!==void 0){var I=T[u];if(typeof I=="function")return 1;if(I!==void 0)return I.length}return 0}n.prototype.eventNames=function(){return this._eventsCount>0?a(this._events):[]};function C(u,T){for(var I=new Array(T),P=0;P{at(),e.exports=typeof queueMicrotask=="function"?queueMicrotask:r=>Promise.resolve().then(r)}),ke=pt(t=>{at();var e=ei();t.fromCallback=function(r,i){if(r===void 0){var a=new Promise(function(c,l){r=function(n,p){n?l(n):c(p)}});r[i!==void 0?i:"promise"]=a}else if(typeof r!="function")throw new TypeError("Callback must be a function");return r},t.fromPromise=function(r,i){if(i===void 0)return r;r.then(function(a){e(()=>i(null,a))}).catch(function(a){e(()=>i(a))})}}),Ye=pt(t=>{at(),t.getCallback=function(e,r){return typeof e=="function"?e:r},t.getOptions=function(e,r){return typeof e=="object"&&e!==null?e:r!==void 0?r:{}}}),Xt=pt(t=>{at();var{fromCallback:e}=ke(),r=jt(),{getOptions:i,getCallback:a}=Ye(),c=Symbol("promise"),l=Symbol("callback"),n=Symbol("working"),p=Symbol("handleOne"),S=Symbol("handleMany"),E=Symbol("autoClose"),L=Symbol("finishWork"),y=Symbol("returnMany"),k=Symbol("closing"),b=Symbol("handleClose"),U=Symbol("closed"),C=Symbol("closeCallbacks"),K=Symbol("keyEncoding"),z=Symbol("valueEncoding"),x=Symbol("abortOnClose"),v=Symbol("legacy"),w=Symbol("keys"),u=Symbol("values"),T=Symbol("limit"),I=Symbol("count"),P=Object.freeze({}),q=()=>{},G=!1,et=class{constructor(B,O,W){if(typeof B!="object"||B===null){let F=B===null?"null":typeof B;throw new TypeError(`The first argument must be an abstract-level database, received ${F}`)}if(typeof O!="object"||O===null)throw new TypeError("The second argument must be an options object");this[U]=!1,this[C]=[],this[n]=!1,this[k]=!1,this[E]=!1,this[l]=null,this[p]=this[p].bind(this),this[S]=this[S].bind(this),this[b]=this[b].bind(this),this[K]=O[K],this[z]=O[z],this[v]=W,this[T]=Number.isInteger(O.limit)&&O.limit>=0?O.limit:1/0,this[I]=0,this[x]=!!O.abortOnClose,this.db=B,this.db.attachResource(this),this.nextTick=B.nextTick}get count(){return this[I]}get limit(){return this[T]}next(B){let O;if(B===void 0)O=new Promise((W,F)=>{B=(Z,ot,ut)=>{Z?F(Z):this[v]?ot===void 0&&ut===void 0?W():W([ot,ut]):W(ot)}});else if(typeof B!="function")throw new TypeError("Callback must be a function");return this[k]?this.nextTick(B,new r("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[n]?this.nextTick(B,new r("Iterator is busy: cannot call next() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[n]=!0,this[l]=B,this[I]>=this[T]?this.nextTick(this[p],null):this._next(this[p])),O}_next(B){this.nextTick(B)}nextv(B,O,W){return W=a(O,W),W=e(W,c),O=i(O,P),Number.isInteger(B)?(this[k]?this.nextTick(W,new r("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[n]?this.nextTick(W,new r("Iterator is busy: cannot call nextv() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(B<1&&(B=1),this[T]<1/0&&(B=Math.min(B,this[T]-this[I])),this[n]=!0,this[l]=W,B<=0?this.nextTick(this[S],null,[]):this._nextv(B,O,this[S])),W[c]):(this.nextTick(W,new TypeError("The first argument 'size' must be an integer")),W[c])}_nextv(B,O,W){let F=[],Z=(ot,ut,gt)=>{if(ot)return W(ot);if(this[v]?ut===void 0&>===void 0:ut===void 0)return W(null,F);F.push(this[v]?[ut,gt]:ut),F.length===B?W(null,F):this._next(Z)};this._next(Z)}all(B,O){return O=a(B,O),O=e(O,c),B=i(B,P),this[k]?this.nextTick(O,new r("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[n]?this.nextTick(O,new r("Iterator is busy: cannot call all() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[n]=!0,this[l]=O,this[E]=!0,this[I]>=this[T]?this.nextTick(this[S],null,[]):this._all(B,this[S])),O[c]}_all(B,O){let W=this[I],F=[],Z=()=>{let ut=this[T]<1/0?Math.min(1e3,this[T]-W):1e3;ut<=0?this.nextTick(O,null,F):this._nextv(ut,P,ot)},ot=(ut,gt)=>{ut?O(ut):gt.length===0?O(null,F):(F.push.apply(F,gt),W+=gt.length,Z())};Z()}[L](){let B=this[l];return this[x]&&B===null?q:(this[n]=!1,this[l]=null,this[k]&&this._close(this[b]),B)}[y](B,O,W){this[E]?this.close(B.bind(null,O,W)):B(O,W)}seek(B,O){if(O=i(O,P),!this[k]){if(this[n])throw new r("Iterator is busy: cannot call seek() until next() has completed",{code:"LEVEL_ITERATOR_BUSY"});{let W=this.db.keyEncoding(O.keyEncoding||this[K]),F=W.format;O.keyEncoding!==F&&(O={...O,keyEncoding:F});let Z=this.db.prefixKey(W.encode(B),F);this._seek(Z,O)}}}_seek(B,O){throw new r("Iterator does not support seek()",{code:"LEVEL_NOT_SUPPORTED"})}close(B){return B=e(B,c),this[U]?this.nextTick(B):this[k]?this[C].push(B):(this[k]=!0,this[C].push(B),this[n]?this[x]&&this[L]()(new r("Aborted on iterator close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this._close(this[b])),B[c]}_close(B){this.nextTick(B)}[b](){this[U]=!0,this.db.detachResource(this);let B=this[C];this[C]=[];for(let O of B)O()}async*[Symbol.asyncIterator](){try{let B;for(;(B=await this.next())!==void 0;)yield B}finally{this[U]||await this.close()}}},J=class extends et{constructor(B,O){super(B,O,!0),this[w]=O.keys!==!1,this[u]=O.values!==!1}[p](B,O,W){let F=this[L]();if(B)return F(B);try{O=this[w]&&O!==void 0?this[K].decode(O):void 0,W=this[u]&&W!==void 0?this[z].decode(W):void 0}catch(Z){return F(new nt("entry",Z))}O===void 0&&W===void 0||this[I]++,F(null,O,W)}[S](B,O){let W=this[L]();if(B)return this[y](W,B);try{for(let F of O){let Z=F[0],ot=F[1];F[0]=this[w]&&Z!==void 0?this[K].decode(Z):void 0,F[1]=this[u]&&ot!==void 0?this[z].decode(ot):void 0}}catch(F){return this[y](W,new nt("entries",F))}this[I]+=O.length,this[y](W,null,O)}end(B){return!G&&typeof console<"u"&&(G=!0,console.warn(new r("The iterator.end() method was renamed to close() and end() is an alias that will be removed in a future version",{code:"LEVEL_LEGACY"}))),this.close(B)}},tt=class extends et{constructor(B,O){super(B,O,!1)}[p](B,O){let W=this[L]();if(B)return W(B);try{O=O!==void 0?this[K].decode(O):void 0}catch(F){return W(new nt("key",F))}O!==void 0&&this[I]++,W(null,O)}[S](B,O){let W=this[L]();if(B)return this[y](W,B);try{for(let F=0;F{at();var{AbstractKeyIterator:e,AbstractValueIterator:r}=Xt(),i=Symbol("iterator"),a=Symbol("callback"),c=Symbol("handleOne"),l=Symbol("handleMany"),n=class extends e{constructor(S,E){super(S,E),this[i]=S.iterator({...E,keys:!0,values:!1}),this[c]=this[c].bind(this),this[l]=this[l].bind(this)}},p=class extends r{constructor(S,E){super(S,E),this[i]=S.iterator({...E,keys:!1,values:!0}),this[c]=this[c].bind(this),this[l]=this[l].bind(this)}};for(let S of[n,p]){let E=S===n,L=E?y=>y[0]:y=>y[1];S.prototype._next=function(y){this[a]=y,this[i].next(this[c])},S.prototype[c]=function(y,k,b){let U=this[a];y?U(y):U(null,E?k:b)},S.prototype._nextv=function(y,k,b){this[a]=b,this[i].nextv(y,k,this[l])},S.prototype._all=function(y,k){this[a]=k,this[i].all(y,this[l])},S.prototype[l]=function(y,k){let b=this[a];y?b(y):b(null,k.map(L))},S.prototype._seek=function(y,k){this[i].seek(y,k)},S.prototype._close=function(y){this[i].close(y)}}t.DefaultKeyIterator=n,t.DefaultValueIterator=p}),ni=pt(t=>{at();var{AbstractIterator:e,AbstractKeyIterator:r,AbstractValueIterator:i}=Xt(),a=jt(),c=Symbol("nut"),l=Symbol("undefer"),n=Symbol("factory"),p=class extends e{constructor(L,y){super(L,y),this[c]=null,this[n]=()=>L.iterator(y),this.db.defer(()=>this[l]())}},S=class extends r{constructor(L,y){super(L,y),this[c]=null,this[n]=()=>L.keys(y),this.db.defer(()=>this[l]())}},E=class extends i{constructor(L,y){super(L,y),this[c]=null,this[n]=()=>L.values(y),this.db.defer(()=>this[l]())}};for(let L of[p,S,E])L.prototype[l]=function(){this.db.status==="open"&&(this[c]=this[n]())},L.prototype._next=function(y){this[c]!==null?this[c].next(y):this.db.status==="opening"?this.db.defer(()=>this._next(y)):this.nextTick(y,new a("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},L.prototype._nextv=function(y,k,b){this[c]!==null?this[c].nextv(y,k,b):this.db.status==="opening"?this.db.defer(()=>this._nextv(y,k,b)):this.nextTick(b,new a("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},L.prototype._all=function(y,k){this[c]!==null?this[c].all(k):this.db.status==="opening"?this.db.defer(()=>this._all(y,k)):this.nextTick(k,new a("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},L.prototype._seek=function(y,k){this[c]!==null?this[c]._seek(y,k):this.db.status==="opening"&&this.db.defer(()=>this._seek(y,k))},L.prototype._close=function(y){this[c]!==null?this[c].close(y):this.db.status==="opening"?this.db.defer(()=>this._close(y)):this.nextTick(y)};t.DeferredIterator=p,t.DeferredKeyIterator=S,t.DeferredValueIterator=E}),jr=pt(t=>{at();var{fromCallback:e}=ke(),r=jt(),{getCallback:i,getOptions:a}=Ye(),c=Symbol("promise"),l=Symbol("status"),n=Symbol("operations"),p=Symbol("finishClose"),S=Symbol("closeCallbacks"),E=class{constructor(L){if(typeof L!="object"||L===null){let y=L===null?"null":typeof L;throw new TypeError(`The first argument must be an abstract-level database, received ${y}`)}this[n]=[],this[S]=[],this[l]="open",this[p]=this[p].bind(this),this.db=L,this.db.attachResource(this),this.nextTick=L.nextTick}get length(){return this[n].length}put(L,y,k){if(this[l]!=="open")throw new r("Batch is not open: cannot call put() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let b=this.db._checkKey(L)||this.db._checkValue(y);if(b)throw b;let U=k&&k.sublevel!=null?k.sublevel:this.db,C=k,K=U.keyEncoding(k&&k.keyEncoding),z=U.valueEncoding(k&&k.valueEncoding),x=K.format;k={...k,keyEncoding:x,valueEncoding:z.format},U!==this.db&&(k.sublevel=null);let v=U.prefixKey(K.encode(L),x),w=z.encode(y);return this._put(v,w,k),this[n].push({...C,type:"put",key:L,value:y}),this}_put(L,y,k){}del(L,y){if(this[l]!=="open")throw new r("Batch is not open: cannot call del() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let k=this.db._checkKey(L);if(k)throw k;let b=y&&y.sublevel!=null?y.sublevel:this.db,U=y,C=b.keyEncoding(y&&y.keyEncoding),K=C.format;return y={...y,keyEncoding:K},b!==this.db&&(y.sublevel=null),this._del(b.prefixKey(C.encode(L),K),y),this[n].push({...U,type:"del",key:L}),this}_del(L,y){}clear(){if(this[l]!=="open")throw new r("Batch is not open: cannot call clear() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});return this._clear(),this[n]=[],this}_clear(){}write(L,y){return y=i(L,y),y=e(y,c),L=a(L),this[l]!=="open"?this.nextTick(y,new r("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"})):this.length===0?this.close(y):(this[l]="writing",this._write(L,k=>{this[l]="closing",this[S].push(()=>y(k)),k||this.db.emit("batch",this[n]),this._close(this[p])})),y[c]}_write(L,y){}close(L){return L=e(L,c),this[l]==="closing"?this[S].push(L):this[l]==="closed"?this.nextTick(L):(this[S].push(L),this[l]!=="writing"&&(this[l]="closing",this._close(this[p]))),L[c]}_close(L){this.nextTick(L)}[p](){this[l]="closed",this.db.detachResource(this);let L=this[S];this[S]=[];for(let y of L)y()}};t.AbstractChainedBatch=E}),ii=pt(t=>{at();var{AbstractChainedBatch:e}=jr(),r=jt(),i=Symbol("encoded"),a=class extends e{constructor(c){super(c),this[i]=[]}_put(c,l,n){this[i].push({...n,type:"put",key:c,value:l})}_del(c,l){this[i].push({...l,type:"del",key:c})}_clear(){this[i]=[]}_write(c,l){this.db.status==="opening"?this.db.defer(()=>this._write(c,l)):this.db.status==="open"?this[i].length===0?this.nextTick(l):this.db._batch(this[i],c,l):this.nextTick(l,new r("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"}))}};t.DefaultChainedBatch=a}),ai=pt((t,e)=>{at();var r=jt(),i=Object.prototype.hasOwnProperty,a=new Set(["lt","lte","gt","gte"]);e.exports=function(c,l){let n={};for(let p in c)if(i.call(c,p)&&!(p==="keyEncoding"||p==="valueEncoding")){if(p==="start"||p==="end")throw new r(`The legacy range option '${p}' has been removed`,{code:"LEVEL_LEGACY"});if(p==="encoding")throw new r("The levelup-style 'encoding' alias has been removed, use 'valueEncoding' instead",{code:"LEVEL_LEGACY"});a.has(p)?n[p]=l.encode(c[p]):n[p]=c[p]}return n.reverse=!!n.reverse,n.limit=Number.isInteger(n.limit)&&n.limit>=0?n.limit:-1,n}}),Dr=pt((t,e)=>{at();var r;e.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:Yt):i=>(r||(r=Promise.resolve())).then(i).catch(a=>setTimeout(()=>{throw a},0))}),oi=pt((t,e)=>{at();var r=Dr();e.exports=function(i,...a){a.length===0?r(i):r(()=>i(...a))}}),si=pt(t=>{at();var{AbstractIterator:e,AbstractKeyIterator:r,AbstractValueIterator:i}=Xt(),a=Symbol("unfix"),c=Symbol("iterator"),l=Symbol("handleOne"),n=Symbol("handleMany"),p=Symbol("callback"),S=class extends e{constructor(y,k,b,U){super(y,k),this[c]=b,this[a]=U,this[l]=this[l].bind(this),this[n]=this[n].bind(this),this[p]=null}[l](y,k,b){let U=this[p];if(y)return U(y);k!==void 0&&(k=this[a](k)),U(y,k,b)}[n](y,k){let b=this[p];if(y)return b(y);for(let U of k){let C=U[0];C!==void 0&&(U[0]=this[a](C))}b(y,k)}},E=class extends r{constructor(y,k,b,U){super(y,k),this[c]=b,this[a]=U,this[l]=this[l].bind(this),this[n]=this[n].bind(this),this[p]=null}[l](y,k){let b=this[p];if(y)return b(y);k!==void 0&&(k=this[a](k)),b(y,k)}[n](y,k){let b=this[p];if(y)return b(y);for(let U=0;U{at();var r=jt(),{Buffer:i}=oe()||{},{AbstractSublevelIterator:a,AbstractSublevelKeyIterator:c,AbstractSublevelValueIterator:l}=si(),n=Symbol("prefix"),p=Symbol("upperBound"),S=Symbol("prefixRange"),E=Symbol("parent"),L=Symbol("unfix"),y=new TextEncoder,k={separator:"!"};e.exports=function({AbstractLevel:x}){class v extends x{static defaults(u){if(typeof u=="string")throw new r("The subleveldown string shorthand for { separator } has been removed",{code:"LEVEL_LEGACY"});if(u&&u.open)throw new r("The subleveldown open option has been removed",{code:"LEVEL_LEGACY"});return u==null?k:u.separator?u:{...u,separator:"!"}}constructor(u,T,I){let{separator:P,manifest:q,...G}=v.defaults(I);T=z(T,P);let et=P.charCodeAt(0)+1,J=u[E]||u;if(!y.encode(T).every(nt=>nt>et&&nt<127))throw new r(`Prefix must use bytes > ${et} < 127`,{code:"LEVEL_INVALID_PREFIX"});super(b(J,q),G);let tt=(u.prefix||"")+P+T+P,st=tt.slice(0,-1)+String.fromCharCode(et);this[E]=J,this[n]=new C(tt),this[p]=new C(st),this[L]=new K,this.nextTick=J.nextTick}prefixKey(u,T){if(T==="utf8")return this[n].utf8+u;if(u.byteLength===0)return this[n][T];if(T==="view"){let I=this[n].view,P=new Uint8Array(I.byteLength+u.byteLength);return P.set(I,0),P.set(u,I.byteLength),P}else{let I=this[n].buffer;return i.concat([I,u],I.byteLength+u.byteLength)}}[S](u,T){u.gte!==void 0?u.gte=this.prefixKey(u.gte,T):u.gt!==void 0?u.gt=this.prefixKey(u.gt,T):u.gte=this[n][T],u.lte!==void 0?u.lte=this.prefixKey(u.lte,T):u.lt!==void 0?u.lt=this.prefixKey(u.lt,T):u.lte=this[p][T]}get prefix(){return this[n].utf8}get db(){return this[E]}_open(u,T){this[E].open({passive:!0},T)}_put(u,T,I,P){this[E].put(u,T,I,P)}_get(u,T,I){this[E].get(u,T,I)}_getMany(u,T,I){this[E].getMany(u,T,I)}_del(u,T,I){this[E].del(u,T,I)}_batch(u,T,I){this[E].batch(u,T,I)}_clear(u,T){this[S](u,u.keyEncoding),this[E].clear(u,T)}_iterator(u){this[S](u,u.keyEncoding);let T=this[E].iterator(u),I=this[L].get(this[n].utf8.length,u.keyEncoding);return new a(this,u,T,I)}_keys(u){this[S](u,u.keyEncoding);let T=this[E].keys(u),I=this[L].get(this[n].utf8.length,u.keyEncoding);return new c(this,u,T,I)}_values(u){this[S](u,u.keyEncoding);let T=this[E].values(u);return new l(this,u,T)}}return{AbstractSublevel:v}};var b=function(x,v){return{...x.supports,createIfMissing:!1,errorIfExists:!1,events:{},additionalMethods:{},...v,encodings:{utf8:U(x,"utf8"),buffer:U(x,"buffer"),view:U(x,"view")}}},U=function(x,v){return x.supports.encodings[v]?x.keyEncoding(v).name===v:!1},C=class{constructor(x){this.utf8=x,this.view=y.encode(x),this.buffer=i?i.from(this.view.buffer,0,this.view.byteLength):{}}},K=class{constructor(){this.cache=new Map}get(x,v){let w=this.cache.get(v);return w===void 0&&(v==="view"?w=(function(u,T){return T.subarray(u)}).bind(null,x):w=(function(u,T){return T.slice(u)}).bind(null,x),this.cache.set(v,w)),w}},z=function(x,v){let w=0,u=x.length;for(;ww&&x[u-1]===v;)u--;return x.slice(w,u)}}),gr=pt(t=>{at();var{supports:e}=Yn(),{Transcoder:r}=Zn(),{EventEmitter:i}=ti(),{fromCallback:a}=ke(),c=jt(),{AbstractIterator:l}=Xt(),{DefaultKeyIterator:n,DefaultValueIterator:p}=ri(),{DeferredIterator:S,DeferredKeyIterator:E,DeferredValueIterator:L}=ni(),{DefaultChainedBatch:y}=ii(),{getCallback:k,getOptions:b}=Ye(),U=ai(),C=Symbol("promise"),K=Symbol("landed"),z=Symbol("resources"),x=Symbol("closeResources"),v=Symbol("operations"),w=Symbol("undefer"),u=Symbol("deferOpen"),T=Symbol("options"),I=Symbol("status"),P=Symbol("defaultOptions"),q=Symbol("transcoder"),G=Symbol("keyEncoding"),et=Symbol("valueEncoding"),J=()=>{},tt=class extends i{constructor(O,W){if(super(),typeof O!="object"||O===null)throw new TypeError("The first argument 'manifest' must be an object");W=b(W);let{keyEncoding:F,valueEncoding:Z,passive:ot,...ut}=W;this[z]=new Set,this[v]=[],this[u]=!0,this[T]=ut,this[I]="opening",this.supports=e(O,{status:!0,promises:!0,clear:!0,getMany:!0,deferredOpen:!0,snapshots:O.snapshots!==!1,permanence:O.permanence!==!1,keyIterator:!0,valueIterator:!0,iteratorNextv:!0,iteratorAll:!0,encodings:O.encodings||{},events:Object.assign({},O.events,{opening:!0,open:!0,closing:!0,closed:!0,put:!0,del:!0,batch:!0,clear:!0})}),this[q]=new r(B(this)),this[G]=this[q].encoding(F||"utf8"),this[et]=this[q].encoding(Z||"utf8");for(let gt of this[q].encodings())this.supports.encodings[gt.commonName]||(this.supports.encodings[gt.commonName]=!0);this[P]={empty:Object.freeze({}),entry:Object.freeze({keyEncoding:this[G].commonName,valueEncoding:this[et].commonName}),key:Object.freeze({keyEncoding:this[G].commonName})},this.nextTick(()=>{this[u]&&this.open({passive:!1},J)})}get status(){return this[I]}keyEncoding(O){return this[q].encoding(O??this[G])}valueEncoding(O){return this[q].encoding(O??this[et])}open(O,W){W=k(O,W),W=a(W,C),O={...this[T],...b(O)},O.createIfMissing=O.createIfMissing!==!1,O.errorIfExists=!!O.errorIfExists;let F=Z=>{this[I]==="closing"||this[I]==="opening"?this.once(K,Z?()=>F(Z):F):this[I]!=="open"?W(new c("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN",cause:Z})):W()};return O.passive?this[I]==="opening"?this.once(K,F):this.nextTick(F):this[I]==="closed"||this[u]?(this[u]=!1,this[I]="opening",this.emit("opening"),this._open(O,Z=>{if(Z){this[I]="closed",this[x](()=>{this.emit(K),F(Z)}),this[w]();return}this[I]="open",this[w](),this.emit(K),this[I]==="open"&&this.emit("open"),this[I]==="open"&&this.emit("ready"),F()})):this[I]==="open"?this.nextTick(F):this.once(K,()=>this.open(O,W)),W[C]}_open(O,W){this.nextTick(W)}close(O){O=a(O,C);let W=F=>{this[I]==="opening"||this[I]==="closing"?this.once(K,F?W(F):W):this[I]!=="closed"?O(new c("Database is not closed",{code:"LEVEL_DATABASE_NOT_CLOSED",cause:F})):O()};if(this[I]==="open"){this[I]="closing",this.emit("closing");let F=Z=>{this[I]="open",this[w](),this.emit(K),W(Z)};this[x](()=>{this._close(Z=>{if(Z)return F(Z);this[I]="closed",this[w](),this.emit(K),this[I]==="closed"&&this.emit("closed"),W()})})}else this[I]==="closed"?this.nextTick(W):this.once(K,()=>this.close(O));return O[C]}[x](O){if(this[z].size===0)return this.nextTick(O);let W=this[z].size,F=!0,Z=()=>{--W===0&&(F?this.nextTick(O):O())};for(let ot of this[z])ot.close(Z);F=!1,this[z].clear()}_close(O){this.nextTick(O)}get(O,W,F){if(F=k(W,F),F=a(F,C),W=b(W,this[P].entry),this[I]==="opening")return this.defer(()=>this.get(O,W,F)),F[C];if(nt(this,F))return F[C];let Z=this._checkKey(O);if(Z)return this.nextTick(F,Z),F[C];let ot=this.keyEncoding(W.keyEncoding),ut=this.valueEncoding(W.valueEncoding),gt=ot.format,rt=ut.format;return(W.keyEncoding!==gt||W.valueEncoding!==rt)&&(W=Object.assign({},W,{keyEncoding:gt,valueEncoding:rt})),this._get(this.prefixKey(ot.encode(O),gt),W,(ht,mt)=>{if(ht)return(ht.code==="LEVEL_NOT_FOUND"||ht.notFound||/NotFound/i.test(ht))&&(ht.code||(ht.code="LEVEL_NOT_FOUND"),ht.notFound||(ht.notFound=!0),ht.status||(ht.status=404)),F(ht);try{mt=ut.decode(mt)}catch(dt){return F(new c("Could not decode value",{code:"LEVEL_DECODE_ERROR",cause:dt}))}F(null,mt)}),F[C]}_get(O,W,F){this.nextTick(F,new Error("NotFound"))}getMany(O,W,F){if(F=k(W,F),F=a(F,C),W=b(W,this[P].entry),this[I]==="opening")return this.defer(()=>this.getMany(O,W,F)),F[C];if(nt(this,F))return F[C];if(!Array.isArray(O))return this.nextTick(F,new TypeError("The first argument 'keys' must be an array")),F[C];if(O.length===0)return this.nextTick(F,null,[]),F[C];let Z=this.keyEncoding(W.keyEncoding),ot=this.valueEncoding(W.valueEncoding),ut=Z.format,gt=ot.format;(W.keyEncoding!==ut||W.valueEncoding!==gt)&&(W=Object.assign({},W,{keyEncoding:ut,valueEncoding:gt}));let rt=new Array(O.length);for(let ht=0;ht{if(ht)return F(ht);try{for(let dt=0;dtthis.put(O,W,F,Z)),Z[C];if(nt(this,Z))return Z[C];let ot=this._checkKey(O)||this._checkValue(W);if(ot)return this.nextTick(Z,ot),Z[C];let ut=this.keyEncoding(F.keyEncoding),gt=this.valueEncoding(F.valueEncoding),rt=ut.format,ht=gt.format;(F.keyEncoding!==rt||F.valueEncoding!==ht)&&(F=Object.assign({},F,{keyEncoding:rt,valueEncoding:ht}));let mt=this.prefixKey(ut.encode(O),rt),dt=gt.encode(W);return this._put(mt,dt,F,wt=>{if(wt)return Z(wt);this.emit("put",O,W),Z()}),Z[C]}_put(O,W,F,Z){this.nextTick(Z)}del(O,W,F){if(F=k(W,F),F=a(F,C),W=b(W,this[P].key),this[I]==="opening")return this.defer(()=>this.del(O,W,F)),F[C];if(nt(this,F))return F[C];let Z=this._checkKey(O);if(Z)return this.nextTick(F,Z),F[C];let ot=this.keyEncoding(W.keyEncoding),ut=ot.format;return W.keyEncoding!==ut&&(W=Object.assign({},W,{keyEncoding:ut})),this._del(this.prefixKey(ot.encode(O),ut),W,gt=>{if(gt)return F(gt);this.emit("del",O),F()}),F[C]}_del(O,W,F){this.nextTick(F)}batch(O,W,F){if(!arguments.length){if(this[I]==="opening")return new y(this);if(this[I]!=="open")throw new c("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._chainedBatch()}if(typeof O=="function"?F=O:F=k(W,F),F=a(F,C),W=b(W,this[P].empty),this[I]==="opening")return this.defer(()=>this.batch(O,W,F)),F[C];if(nt(this,F))return F[C];if(!Array.isArray(O))return this.nextTick(F,new TypeError("The first argument 'operations' must be an array")),F[C];if(O.length===0)return this.nextTick(F),F[C];let Z=new Array(O.length),{keyEncoding:ot,valueEncoding:ut,...gt}=W;for(let rt=0;rt{if(rt)return F(rt);this.emit("batch",O),F()}),F[C]}_batch(O,W,F){this.nextTick(F)}sublevel(O,W){return this._sublevel(O,st.defaults(W))}_sublevel(O,W){return new st(this,O,W)}prefixKey(O,W){return O}clear(O,W){if(W=k(O,W),W=a(W,C),O=b(O,this[P].empty),this[I]==="opening")return this.defer(()=>this.clear(O,W)),W[C];if(nt(this,W))return W[C];let F=O,Z=this.keyEncoding(O.keyEncoding);return O=U(O,Z),O.keyEncoding=Z.format,O.limit===0?this.nextTick(W):this._clear(O,ot=>{if(ot)return W(ot);this.emit("clear",F),W()}),W[C]}_clear(O,W){this.nextTick(W)}iterator(O){let W=this.keyEncoding(O&&O.keyEncoding),F=this.valueEncoding(O&&O.valueEncoding);if(O=U(O,W),O.keys=O.keys!==!1,O.values=O.values!==!1,O[l.keyEncoding]=W,O[l.valueEncoding]=F,O.keyEncoding=W.format,O.valueEncoding=F.format,this[I]==="opening")return new S(this,O);if(this[I]!=="open")throw new c("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._iterator(O)}_iterator(O){return new l(this,O)}keys(O){let W=this.keyEncoding(O&&O.keyEncoding),F=this.valueEncoding(O&&O.valueEncoding);if(O=U(O,W),O[l.keyEncoding]=W,O[l.valueEncoding]=F,O.keyEncoding=W.format,O.valueEncoding=F.format,this[I]==="opening")return new E(this,O);if(this[I]!=="open")throw new c("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._keys(O)}_keys(O){return new n(this,O)}values(O){let W=this.keyEncoding(O&&O.keyEncoding),F=this.valueEncoding(O&&O.valueEncoding);if(O=U(O,W),O[l.keyEncoding]=W,O[l.valueEncoding]=F,O.keyEncoding=W.format,O.valueEncoding=F.format,this[I]==="opening")return new L(this,O);if(this[I]!=="open")throw new c("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._values(O)}_values(O){return new p(this,O)}defer(O){if(typeof O!="function")throw new TypeError("The first argument must be a function");this[v].push(O)}[w](){if(this[v].length===0)return;let O=this[v];this[v]=[];for(let W of O)W()}attachResource(O){if(typeof O!="object"||O===null||typeof O.close!="function")throw new TypeError("The first argument must be a resource object");this[z].add(O)}detachResource(O){this[z].delete(O)}_chainedBatch(){return new y(this)}_checkKey(O){if(O==null)return new c("Key cannot be null or undefined",{code:"LEVEL_INVALID_KEY"})}_checkValue(O){if(O==null)return new c("Value cannot be null or undefined",{code:"LEVEL_INVALID_VALUE"})}};tt.prototype.nextTick=oi();var{AbstractSublevel:st}=li()({AbstractLevel:tt});t.AbstractLevel=tt,t.AbstractSublevel=st;var nt=function(O,W){return O[I]!=="open"?(O.nextTick(W,new c("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"})),!0):!1},B=function(O){return Object.keys(O.supports.encodings).filter(W=>!!O.supports.encodings[W])}}),Xe=pt(t=>{at(),t.AbstractLevel=gr().AbstractLevel,t.AbstractSublevel=gr().AbstractSublevel,t.AbstractIterator=Xt().AbstractIterator,t.AbstractKeyIterator=Xt().AbstractKeyIterator,t.AbstractValueIterator=Xt().AbstractValueIterator,t.AbstractChainedBatch=jr().AbstractChainedBatch}),ci=pt((t,e)=>{at(),e.exports=i;var r=Dr();function i(a,c,l){if(typeof c!="number")throw new Error("second argument must be a Number");let n,p,S,E,L,y=!0,k;Array.isArray(a)?(n=[],S=p=a.length):(E=Object.keys(a),n={},S=p=E.length);function b(C){function K(){l&&l(C,n),l=null}y?r(K):K()}function U(C,K,z){if(n[C]=z,K&&(L=!0),--S===0||K)b(K);else if(!L&&k{at(),e.exports=function(r){let i=r.gte!==void 0?r.gte:r.gt!==void 0?r.gt:void 0,a=r.lte!==void 0?r.lte:r.lt!==void 0?r.lt:void 0,c=r.gte===void 0,l=r.lte===void 0;return i!==void 0&&a!==void 0?IDBKeyRange.bound(i,a,c,l):i!==void 0?IDBKeyRange.lowerBound(i,c):a!==void 0?IDBKeyRange.upperBound(a,l):null}}),Wr=pt((t,e)=>{at();var r=new TextEncoder;e.exports=function(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):r.encode(i)}}),ui=pt(t=>{at();var{AbstractIterator:e}=Xe(),r=Kr(),i=Wr(),a=Symbol("cache"),c=Symbol("finished"),l=Symbol("options"),n=Symbol("currentOptions"),p=Symbol("position"),S=Symbol("location"),E=Symbol("first"),L={},y=class extends e{constructor(b,U,C){super(b,C),this[a]=[],this[c]=this.limit===0,this[l]=C,this[n]={...C},this[p]=void 0,this[S]=U,this[E]=!0}_nextv(b,U,C){if(this[E]=!1,this[c])return this.nextTick(C,null,[]);if(this[a].length>0)return b=Math.min(b,this[a].length),this.nextTick(C,null,this[a].splice(0,b));this[p]!==void 0&&(this[l].reverse?(this[n].lt=this[p],this[n].lte=void 0):(this[n].gt=this[p],this[n].gte=void 0));let K;try{K=r(this[n])}catch{return this[c]=!0,this.nextTick(C,null,[])}let z=this.db.db.transaction([this[S]],"readonly"),x=z.objectStore(this[S]),v=[];if(this[l].reverse){let w=!this[l].values&&x.openKeyCursor?"openKeyCursor":"openCursor";x[w](K,"prev").onsuccess=u=>{let T=u.target.result;if(T){let{key:I,value:P}=T;this[p]=I,v.push([this[l].keys&&I!==void 0?i(I):void 0,this[l].values&&P!==void 0?i(P):void 0]),v.length{if(w===void 0||u===void 0)return;let I=Math.max(w.length,u.length);I===0||b===1/0?this[c]=!0:this[p]=w[I-1],v.length=I;for(let P=0;P{w=I.target.result,T()}:(w=[],this.nextTick(T)),this[l].values?x.getAll(K,b<1/0?b:void 0).onsuccess=I=>{u=I.target.result,T()}:(u=[],this.nextTick(T))}z.onabort=()=>{C(z.error||new Error("aborted by user")),C=null},z.oncomplete=()=>{C(null,v),C=null}}_next(b){if(this[a].length>0){let[U,C]=this[a].shift();this.nextTick(b,null,U,C)}else if(this[c])this.nextTick(b);else{let U=Math.min(100,this.limit-this.count);this[E]&&(this[E]=!1,U=1),this._nextv(U,L,(C,K)=>{if(C)return b(C);this[a]=K,this._next(b)})}}_all(b,U){this[E]=!1;let C=this[a].splice(0,this[a].length),K=this.limit-this.count-C.length;if(K<=0)return this.nextTick(U,null,C);this._nextv(K,L,(z,x)=>{if(z)return U(z);C.length>0&&(x=C.concat(x)),U(null,x)})}_seek(b,U){this[E]=!0,this[a]=[],this[c]=!1,this[p]=void 0,this[n]={...this[l]};let C;try{C=r(this[l])}catch{this[c]=!0;return}C!==null&&!C.includes(b)?this[c]=!0:this[l].reverse?this[n].lte=b:this[n].gte=b}};t.Iterator=y;function k(b){typeof b.commit=="function"&&b.commit()}}),hi=pt((t,e)=>{at(),e.exports=function(r,i,a,c,l){if(c.limit===0)return r.nextTick(l);let n=r.db.transaction([i],"readwrite"),p=n.objectStore(i),S=0;n.oncomplete=function(){l()},n.onabort=function(){l(n.error||new Error("aborted by user"))};let E=p.openKeyCursor?"openKeyCursor":"openCursor",L=c.reverse?"prev":"next";p[E](a,L).onsuccess=function(y){let k=y.target.result;k&&(p.delete(k.key).onsuccess=function(){(c.limit<=0||++S{at();var{AbstractLevel:e}=Xe(),r=jt(),i=ci(),{fromCallback:a}=ke(),{Iterator:c}=ui(),l=Wr(),n=hi(),p=Kr(),S="level-js-",E=Symbol("idb"),L=Symbol("namePrefix"),y=Symbol("location"),k=Symbol("version"),b=Symbol("store"),U=Symbol("onComplete"),C=Symbol("promise"),K=class extends e{constructor(z,x,v){if(typeof x=="function"||typeof v=="function")throw new r("The levelup-style callback argument has been removed",{code:"LEVEL_LEGACY"});let{prefix:w,version:u,...T}=x||{};if(super({encodings:{view:!0},snapshots:!1,createIfMissing:!1,errorIfExists:!1,seek:!0},T),typeof z!="string")throw new Error("constructor requires a location string argument");this[y]=z,this[L]=w??S,this[k]=parseInt(u||1,10),this[E]=null}get location(){return this[y]}get namePrefix(){return this[L]}get version(){return this[k]}get db(){return this[E]}get type(){return"browser-level"}_open(z,x){let v=indexedDB.open(this[L]+this[y],this[k]);v.onerror=function(){x(v.error||new Error("unknown error"))},v.onsuccess=()=>{this[E]=v.result,x()},v.onupgradeneeded=w=>{let u=w.target.result;u.objectStoreNames.contains(this[y])||u.createObjectStore(this[y])}}[b](z){return this[E].transaction([this[y]],z).objectStore(this[y])}[U](z,x){let v=z.transaction;v.onabort=function(){x(v.error||new Error("aborted by user"))},v.oncomplete=function(){x(null,z.result)}}_get(z,x,v){let w=this[b]("readonly"),u;try{u=w.get(z)}catch(T){return this.nextTick(v,T)}this[U](u,function(T,I){if(T)return v(T);if(I===void 0)return v(new r("Entry not found",{code:"LEVEL_NOT_FOUND"}));v(null,l(I))})}_getMany(z,x,v){let w=this[b]("readonly"),u=z.map(T=>I=>{let P;try{P=w.get(T)}catch(q){return I(q)}P.onsuccess=()=>{let q=P.result;I(null,q===void 0?q:l(q))},P.onerror=q=>{q.stopPropagation(),I(P.error)}});i(u,16,v)}_del(z,x,v){let w=this[b]("readwrite"),u;try{u=w.delete(z)}catch(T){return this.nextTick(v,T)}this[U](u,v)}_put(z,x,v,w){let u=this[b]("readwrite"),T;try{T=u.put(x,z)}catch(I){return this.nextTick(w,I)}this[U](T,w)}_iterator(z){return new c(this,this[y],z)}_batch(z,x,v){let w=this[b]("readwrite"),u=w.transaction,T=0,I;u.onabort=function(){v(I||u.error||new Error("aborted by user"))},u.oncomplete=function(){v()};function P(){let q=z[T++],G=q.key,et;try{et=q.type==="del"?w.delete(G):w.put(q.value,G)}catch(J){I=J,u.abort();return}T=0)return n(this,this[y],v,z,x);try{let u=this[b]("readwrite");w=v?u.delete(v):u.clear()}catch(u){return this.nextTick(x,u)}this[U](w,x)}_close(z){this[E].close(),this.nextTick(z)}};K.destroy=function(z,x,v){typeof x=="function"&&(v=x,x=S),v=a(v,C);let w=indexedDB.deleteDatabase(x+z);return w.onsuccess=function(){v()},w.onerror=function(u){v(u)},v[C]},t.BrowserLevel=K}),gi=pt(t=>{at(),t.Level=fi().BrowserLevel}),di=pt((t,e)=>{at(),e.exports=z;var r=0,i=1;function a(x,v,w,u,T,I){this._color=x,this.key=v,this.value=w,this.left=u,this.right=T,this._count=I}function c(x){return new a(x._color,x.key,x.value,x.left,x.right,x._count)}function l(x,v){return new a(x,v.key,v.value,v.left,v.right,v._count)}function n(x){x._count=1+(x.left?x.left._count:0)+(x.right?x.right._count:0)}function p(x,v){this._compare=x,this.root=v}var S=p.prototype;Object.defineProperty(S,"keys",{get:function(){var x=[];return this.forEach(function(v,w){x.push(v)}),x}}),Object.defineProperty(S,"values",{get:function(){var x=[];return this.forEach(function(v,w){x.push(w)}),x}}),Object.defineProperty(S,"length",{get:function(){return this.root?this.root._count:0}}),S.insert=function(x,v){for(var w=this._compare,u=this.root,T=[],I=[];u;){var P=w(x,u.key);T.push(u),I.push(P),P<=0?u=u.left:u=u.right}T.push(new a(r,x,v,null,null,1));for(var q=T.length-2;q>=0;--q){var u=T[q];I[q]<=0?T[q]=new a(u._color,u.key,u.value,T[q+1],u.right,u._count+1):T[q]=new a(u._color,u.key,u.value,u.left,T[q+1],u._count+1)}for(var q=T.length-1;q>1;--q){var G=T[q-1],u=T[q];if(G._color===i||u._color===i)break;var et=T[q-2];if(et.left===G)if(G.left===u){var J=et.right;if(J&&J._color===r)G._color=i,et.right=l(i,J),et._color=r,q-=1;else{if(et._color=r,et.left=G.right,G._color=i,G.right=et,T[q-2]=G,T[q-1]=u,n(et),n(G),q>=3){var tt=T[q-3];tt.left===et?tt.left=G:tt.right=G}break}}else{var J=et.right;if(J&&J._color===r)G._color=i,et.right=l(i,J),et._color=r,q-=1;else{if(G.right=u.left,et._color=r,et.left=u.right,u._color=i,u.left=G,u.right=et,T[q-2]=u,T[q-1]=G,n(et),n(G),n(u),q>=3){var tt=T[q-3];tt.left===et?tt.left=u:tt.right=u}break}}else if(G.right===u){var J=et.left;if(J&&J._color===r)G._color=i,et.left=l(i,J),et._color=r,q-=1;else{if(et._color=r,et.right=G.left,G._color=i,G.left=et,T[q-2]=G,T[q-1]=u,n(et),n(G),q>=3){var tt=T[q-3];tt.right===et?tt.right=G:tt.left=G}break}}else{var J=et.left;if(J&&J._color===r)G._color=i,et.left=l(i,J),et._color=r,q-=1;else{if(G.left=u.right,et._color=r,et.right=u.left,u._color=i,u.right=G,u.left=et,T[q-2]=u,T[q-1]=G,n(et),n(G),n(u),q>=3){var tt=T[q-3];tt.right===et?tt.right=u:tt.left=u}break}}}return T[0]._color=i,new p(w,T[0])};function E(x,v){if(v.left){var w=E(x,v.left);if(w)return w}var w=x(v.key,v.value);if(w)return w;if(v.right)return E(x,v.right)}function L(x,v,w,u){var T=v(x,u.key);if(T<=0){if(u.left){var I=L(x,v,w,u.left);if(I)return I}var I=w(u.key,u.value);if(I)return I}if(u.right)return L(x,v,w,u.right)}function y(x,v,w,u,T){var I=w(x,T.key),P=w(v,T.key),q;if(I<=0&&(T.left&&(q=y(x,v,w,u,T.left),q)||P>0&&(q=u(T.key,T.value),q)))return q;if(P>0&&T.right)return y(x,v,w,u,T.right)}S.forEach=function(x,v,w){if(this.root)switch(arguments.length){case 1:return E(x,this.root);case 2:return L(v,this._compare,x,this.root);case 3:return this._compare(v,w)>=0?void 0:y(v,w,this._compare,x,this.root)}},Object.defineProperty(S,"begin",{get:function(){for(var x=[],v=this.root;v;)x.push(v),v=v.left;return new k(this,x)}}),Object.defineProperty(S,"end",{get:function(){for(var x=[],v=this.root;v;)x.push(v),v=v.right;return new k(this,x)}}),S.at=function(x){if(x<0)return new k(this,[]);for(var v=this.root,w=[];;){if(w.push(v),v.left){if(x=v.right._count)break;v=v.right}else break}return new k(this,[])},S.ge=function(x){for(var v=this._compare,w=this.root,u=[],T=0;w;){var I=v(x,w.key);u.push(w),I<=0&&(T=u.length),I<=0?w=w.left:w=w.right}return u.length=T,new k(this,u)},S.gt=function(x){for(var v=this._compare,w=this.root,u=[],T=0;w;){var I=v(x,w.key);u.push(w),I<0&&(T=u.length),I<0?w=w.left:w=w.right}return u.length=T,new k(this,u)},S.lt=function(x){for(var v=this._compare,w=this.root,u=[],T=0;w;){var I=v(x,w.key);u.push(w),I>0&&(T=u.length),I<=0?w=w.left:w=w.right}return u.length=T,new k(this,u)},S.le=function(x){for(var v=this._compare,w=this.root,u=[],T=0;w;){var I=v(x,w.key);u.push(w),I>=0&&(T=u.length),I<0?w=w.left:w=w.right}return u.length=T,new k(this,u)},S.find=function(x){for(var v=this._compare,w=this.root,u=[];w;){var T=v(x,w.key);if(u.push(w),T===0)return new k(this,u);T<=0?w=w.left:w=w.right}return new k(this,[])},S.remove=function(x){var v=this.find(x);return v?v.remove():this},S.get=function(x){for(var v=this._compare,w=this.root;w;){var u=v(x,w.key);if(u===0)return w.value;u<=0?w=w.left:w=w.right}};function k(x,v){this.tree=x,this._stack=v}var b=k.prototype;Object.defineProperty(b,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(b,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),b.clone=function(){return new k(this.tree,this._stack.slice())};function U(x,v){x.key=v.key,x.value=v.value,x.left=v.left,x.right=v.right,x._color=v._color,x._count=v._count}function C(x){for(var v,w,u,T,I=x.length-1;I>=0;--I){if(v=x[I],I===0){v._color=i;return}if(w=x[I-1],w.left===v){if(u=w.right,u.right&&u.right._color===r){if(u=w.right=c(u),T=u.right=c(u.right),w.right=u.left,u.left=w,u.right=T,u._color=w._color,v._color=i,w._color=i,T._color=i,n(w),n(u),I>1){var P=x[I-2];P.left===w?P.left=u:P.right=u}x[I-1]=u;return}else if(u.left&&u.left._color===r){if(u=w.right=c(u),T=u.left=c(u.left),w.right=T.left,u.left=T.right,T.left=w,T.right=u,T._color=w._color,w._color=i,u._color=i,v._color=i,n(w),n(u),n(T),I>1){var P=x[I-2];P.left===w?P.left=T:P.right=T}x[I-1]=T;return}if(u._color===i)if(w._color===r){w._color=i,w.right=l(r,u);return}else{w.right=l(r,u);continue}else{if(u=c(u),w.right=u.left,u.left=w,u._color=w._color,w._color=r,n(w),n(u),I>1){var P=x[I-2];P.left===w?P.left=u:P.right=u}x[I-1]=u,x[I]=w,I+11){var P=x[I-2];P.right===w?P.right=u:P.left=u}x[I-1]=u;return}else if(u.right&&u.right._color===r){if(u=w.left=c(u),T=u.right=c(u.right),w.left=T.right,u.right=T.left,T.right=w,T.left=u,T._color=w._color,w._color=i,u._color=i,v._color=i,n(w),n(u),n(T),I>1){var P=x[I-2];P.right===w?P.right=T:P.left=T}x[I-1]=T;return}if(u._color===i)if(w._color===r){w._color=i,w.left=l(r,u);return}else{w.left=l(r,u);continue}else{if(u=c(u),w.left=u.right,u.right=w,u._color=w._color,w._color=r,n(w),n(u),I>1){var P=x[I-2];P.right===w?P.right=u:P.left=u}x[I-1]=u,x[I]=w,I+1=0;--u){var w=x[u];w.left===x[u+1]?v[u]=new a(w._color,w.key,w.value,v[u+1],w.right,w._count):v[u]=new a(w._color,w.key,w.value,w.left,v[u+1],w._count)}if(w=v[v.length-1],w.left&&w.right){var T=v.length;for(w=w.left;w.right;)v.push(w),w=w.right;var I=v[T-1];v.push(new a(w._color,I.key,I.value,w.left,w.right,w._count)),v[T-1].key=w.key,v[T-1].value=w.value;for(var u=v.length-2;u>=T;--u)w=v[u],v[u]=new a(w._color,w.key,w.value,w.left,v[u+1],w._count);v[T-1].left=v[T]}if(w=v[v.length-1],w._color===r){var P=v[v.length-2];P.left===w?P.left=null:P.right===w&&(P.right=null),v.pop();for(var u=0;u0)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(b,"index",{get:function(){var x=0,v=this._stack;if(v.length===0){var w=this.tree.root;return w?w._count:0}else v[v.length-1].left&&(x=v[v.length-1].left._count);for(var u=v.length-2;u>=0;--u)v[u+1]===v[u].right&&(++x,v[u].left&&(x+=v[u].left._count));return x},enumerable:!0}),b.next=function(){var x=this._stack;if(x.length!==0){var v=x[x.length-1];if(v.right)for(v=v.right;v;)x.push(v),v=v.left;else for(x.pop();x.length>0&&x[x.length-1].right===v;)v=x[x.length-1],x.pop()}},Object.defineProperty(b,"hasNext",{get:function(){var x=this._stack;if(x.length===0)return!1;if(x[x.length-1].right)return!0;for(var v=x.length-1;v>0;--v)if(x[v-1].left===x[v])return!0;return!1}}),b.update=function(x){var v=this._stack;if(v.length===0)throw new Error("Can't update empty node!");var w=new Array(v.length),u=v[v.length-1];w[w.length-1]=new a(u._color,u.key,x,u.left,u.right,u._count);for(var T=v.length-2;T>=0;--T)u=v[T],u.left===v[T+1]?w[T]=new a(u._color,u.key,u.value,w[T+1],u.right,u._count):w[T]=new a(u._color,u.key,u.value,u.left,w[T+1],u._count);return new p(this.tree._compare,w[0])},b.prev=function(){var x=this._stack;if(x.length!==0){var v=x[x.length-1];if(v.left)for(v=v.left;v;)x.push(v),v=v.right;else for(x.pop();x.length>0&&x[x.length-1].left===v;)v=x[x.length-1],x.pop()}},Object.defineProperty(b,"hasPrev",{get:function(){var x=this._stack;if(x.length===0)return!1;if(x[x.length-1].left)return!0;for(var v=x.length-1;v>0;--v)if(x[v-1].right===x[v])return!0;return!1}});function K(x,v){return xv?1:0}function z(x){return new p(x||K,null)}}),pi=pt(t=>{at();var{AbstractLevel:e,AbstractIterator:r,AbstractKeyIterator:i,AbstractValueIterator:a}=Xe(),c=jt(),l=di(),n=new Set(["gt","gte","lt","lte"]),p=Symbol("none"),S=Symbol("tree"),E=Symbol("iterator"),L=Symbol("lowerBound"),y=Symbol("upperBound"),k=Symbol("outOfRange"),b=Symbol("reverse"),U=Symbol("options"),C=Symbol("test"),K=Symbol("advance"),z=Symbol("init");function x(J,tt){if(typeof J=="string")return Jtt?1:0;let st=Math.min(J.byteLength,tt.byteLength);for(let nt=0;nt0}function w(J){return x(J,this[y])>=0}function u(J){return x(J,this[y])<0}function T(J){return x(J,this[y])<=0}var I=class extends r{constructor(J,tt){super(J,tt),this[z](J[S],tt)}_next(J){if(!this[E].valid)return this.nextTick(J);let tt=this[E].key,st=this[E].value;if(!this[C](tt))return this.nextTick(J);this[E][this[K]](),this.nextTick(J,null,tt,st)}_nextv(J,tt,st){let nt=this[E],B=[];for(;nt.valid&&B.length0:x(tt,this[L])>=0:"gte"in this[U]?x(tt,this[L])<0:x(tt,this[L])<=0:!0},J.prototype._seek=function(tt,st){this[k](tt)?(this[E]=this[E].tree.end,this[E].next()):this[b]?this[E]=this[E].tree.le(tt):this[E]=this[E].tree.ge(tt)};var G=class extends e{constructor(J,tt,st){if(typeof J=="object"&&J!==null&&(tt=J),typeof J=="function"||typeof tt=="function"||typeof st=="function")throw new c("The levelup-style callback argument has been removed",{code:"LEVEL_LEGACY"});let{storeEncoding:nt,...B}=tt||{};if(nt=nt||"buffer",!["buffer","view","utf8"].includes(nt))throw new c("The storeEncoding option must be 'buffer', 'view' or 'utf8'",{code:"LEVEL_ENCODING_NOT_SUPPORTED"});super({seek:!0,permanence:!1,createIfMissing:!1,errorIfExists:!1,encodings:{[nt]:!0}},B),this[S]=l(x)}_put(J,tt,st,nt){let B=this[S].find(J);B.valid?this[S]=B.update(tt):this[S]=this[S].insert(J,tt),this.nextTick(nt)}_get(J,tt,st){let nt=this[S].get(J);if(typeof nt>"u")return this.nextTick(st,new Error("NotFound"));this.nextTick(st,null,nt)}_getMany(J,tt,st){this.nextTick(st,null,J.map(nt=>this[S].get(nt)))}_del(J,tt,st){this[S]=this[S].remove(J),this.nextTick(st)}_batch(J,tt,st){let nt=this[S];for(let B of J){let O=B.key,W=nt.find(O);B.type==="put"?nt=W.valid?W.update(B.value):nt.insert(O,B.value):nt=W.remove()}this[S]=nt,this.nextTick(st)}_clear(J,tt){if(J.limit===-1&&!Object.keys(J).some(et))return this[S]=l(x),this.nextTick(tt);let st=this._keys({...J}),nt=st.limit,B=0,O=()=>{for(let W=0;W<500;W++){if(++B>nt||!st[E].valid||!st[C](st[E].key))return tt();this[S]=this[S].remove(st[E].key),st[E][st[K]]()}this.nextTick(O)};this.nextTick(O)}_iterator(J){return new I(this,J)}_keys(J){return new P(this,J)}_values(J){return new q(this,J)}};if(t.MemoryLevel=G,typeof Jt.default<"u"&&!Jt.default.browser&&typeof Yt<"u"&&typeof Yt.setImmediate=="function"){let J=Yt.setImmediate;G.prototype.nextTick=function(tt,...st){st.length===0?J(tt):J(()=>tt(...st))}}function et(J){return n.has(J)}}),te=pt((t,e)=>{at(),typeof window<"u"?(window.global=window,Yt.fetch=window.fetch,e.exports={Buffer:oe().Buffer,Crypto:window.crypto}):e.exports={Buffer:oe().Buffer,Crypto:crypto}}),Fr=pt((t,e)=>{at(),function(r){var i,a=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,c=Math.ceil,l=Math.floor,n="[BigNumber Error] ",p=n+"Number primitive has more than 15 significant digits: ",S=1e14,E=14,L=9007199254740991,y=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],k=1e7,b=1e9;function U(T){var I,P,q,G=rt.prototype={constructor:rt,toString:null,valueOf:null},et=new rt(1),J=20,tt=4,st=-7,nt=21,B=-1e7,O=1e7,W=!1,F=1,Z=0,ot={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},ut="0123456789abcdefghijklmnopqrstuvwxyz",gt=!0;function rt(N,$){var M,X,H,s,h,d,A,R,f=this;if(!(f instanceof rt))return new rt(N,$);if($==null){if(N&&N._isBigNumber===!0){f.s=N.s,!N.c||N.e>O?f.c=f.e=null:N.e=10;h/=10,s++);s>O?f.c=f.e=null:(f.e=s,f.c=[N]);return}R=String(N)}else{if(!a.test(R=String(N)))return q(f,R,d);f.s=R.charCodeAt(0)==45?(R=R.slice(1),-1):1}(s=R.indexOf("."))>-1&&(R=R.replace(".","")),(h=R.search(/e/i))>0?(s<0&&(s=h),s+=+R.slice(h+1),R=R.substring(0,h)):s<0&&(s=R.length)}else{if(x($,2,ut.length,"Base"),$==10&>)return f=new rt(N),wt(f,J+f.e+1,tt);if(R=String(N),d=typeof N=="number"){if(N*0!=0)return q(f,R,d,$);if(f.s=1/N<0?(R=R.slice(1),-1):1,rt.DEBUG&&R.replace(/^0\.0*|\./,"").length>15)throw Error(p+N)}else f.s=R.charCodeAt(0)===45?(R=R.slice(1),-1):1;for(M=ut.slice(0,$),s=h=0,A=R.length;hs){s=A;continue}}else if(!H&&(R==R.toUpperCase()&&(R=R.toLowerCase())||R==R.toLowerCase()&&(R=R.toUpperCase()))){H=!0,h=-1,s=0;continue}return q(f,String(N),d,$)}d=!1,R=P(R,$,10,f.s),(s=R.indexOf("."))>-1?R=R.replace(".",""):s=R.length}for(h=0;R.charCodeAt(h)===48;h++);for(A=R.length;R.charCodeAt(--A)===48;);if(R=R.slice(h,++A)){if(A-=h,d&&rt.DEBUG&&A>15&&(N>L||N!==l(N)))throw Error(p+f.s*N);if((s=s-h-1)>O)f.c=f.e=null;else if(s=-b&&H<=b&&H===l(H)){if(X[0]===0){if(H===0&&X.length===1)return!0;break t}if($=(H+1)%E,$<1&&($+=E),String(X[0]).length==$){for($=0;$=S||M!==l(M))break t;if(M!==0)return!0}}}else if(X===null&&H===null&&(s===null||s===1||s===-1))return!0;throw Error(n+"Invalid BigNumber: "+N)},rt.maximum=rt.max=function(){return mt(arguments,G.lt)},rt.minimum=rt.min=function(){return mt(arguments,G.gt)},rt.random=function(){var N=9007199254740992,$=Math.random()*N&2097151?function(){return l(Math.random()*N)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(M){var X,H,s,h,d,A=0,R=[],f=new rt(et);if(M==null?M=J:x(M,0,b),h=c(M/E),W)if(crypto.getRandomValues){for(X=crypto.getRandomValues(new Uint32Array(h*=2));A>>11),d>=9e15?(H=crypto.getRandomValues(new Uint32Array(2)),X[A]=H[0],X[A+1]=H[1]):(R.push(d%1e14),A+=2);A=h/2}else if(crypto.randomBytes){for(X=crypto.randomBytes(h*=7);A=9e15?crypto.randomBytes(7).copy(X,A):(R.push(d%1e14),A+=7);A=h/7}else throw W=!1,Error(n+"crypto unavailable");if(!W)for(;A=10;d/=10,A++);AH-1&&(d[h+1]==null&&(d[h+1]=0),d[h+1]+=d[h]/H|0,d[h]%=H)}return d.reverse()}return function(M,X,H,s,h){var d,A,R,f,_,D,Y,lt,ft=M.indexOf("."),o=J,g=tt;for(ft>=0&&(f=Z,Z=0,M=M.replace(".",""),lt=new rt(X),D=lt.pow(M.length-ft),Z=f,lt.c=$(u(K(D.c),D.e,"0"),10,H,N),lt.e=lt.c.length),Y=$(M,X,H,h?(d=ut,N):(d=N,ut)),R=f=Y.length;Y[--f]==0;Y.pop());if(!Y[0])return d.charAt(0);if(ft<0?--R:(D.c=Y,D.e=R,D.s=s,D=I(D,lt,o,g,H),Y=D.c,_=D.r,R=D.e),A=R+o+1,ft=Y[A],f=H/2,_=_||A<0||Y[A+1]!=null,_=g<4?(ft!=null||_)&&(g==0||g==(D.s<0?3:2)):ft>f||ft==f&&(g==4||_||g==6&&Y[A-1]&1||g==(D.s<0?8:7)),A<1||!Y[0])M=_?u(d.charAt(1),-o,d.charAt(0)):d.charAt(0);else{if(Y.length=A,_)for(--H;++Y[--A]>H;)Y[A]=0,A||(++R,Y=[1].concat(Y));for(f=Y.length;!Y[--f];);for(ft=0,M="";ft<=f;M+=d.charAt(Y[ft++]));M=u(M,R,d.charAt(0))}return M}}(),I=function(){function N(X,H,s){var h,d,A,R,f=0,_=X.length,D=H%k,Y=H/k|0;for(X=X.slice();_--;)A=X[_]%k,R=X[_]/k|0,h=Y*A+R*D,d=D*A+h%k*k+f,f=(d/s|0)+(h/k|0)+Y*R,X[_]=d%s;return f&&(X=[f].concat(X)),X}function $(X,H,s,h){var d,A;if(s!=h)A=s>h?1:-1;else for(d=A=0;dH[d]?1:-1;break}return A}function M(X,H,s,h){for(var d=0;s--;)X[s]-=d,d=X[s]1;X.splice(0,1));}return function(X,H,s,h,d){var A,R,f,_,D,Y,lt,ft,o,g,m,V,Q,it,ct,Et,kt,Tt=X.s==H.s?1:-1,vt=X.c,bt=H.c;if(!vt||!vt[0]||!bt||!bt[0])return new rt(!X.s||!H.s||(vt?bt&&vt[0]==bt[0]:!bt)?NaN:vt&&vt[0]==0||!bt?Tt*0:Tt/0);for(ft=new rt(Tt),o=ft.c=[],R=X.e-H.e,Tt=s+R+1,d||(d=S,R=C(X.e/E)-C(H.e/E),Tt=Tt/E|0),f=0;bt[f]==(vt[f]||0);f++);if(bt[f]>(vt[f]||0)&&R--,Tt<0)o.push(1),_=!0;else{for(it=vt.length,Et=bt.length,f=0,Tt+=2,D=l(d/(bt[0]+1)),D>1&&(bt=N(bt,D,d),vt=N(vt,D,d),Et=bt.length,it=vt.length),Q=Et,g=vt.slice(0,Et),m=g.length;m=d/2&&ct++;do{if(D=0,A=$(bt,g,Et,m),A<0){if(V=g[0],Et!=m&&(V=V*d+(g[1]||0)),D=l(V/ct),D>1)for(D>=d&&(D=d-1),Y=N(bt,D,d),lt=Y.length,m=g.length;$(Y,g,lt,m)==1;)D--,M(Y,Et=10;Tt/=10,f++);wt(ft,s+(ft.e=f+R*E-1)+1,h,_)}else ft.e=R,ft.r=+_;return ft}}();function ht(N,$,M,X){var H,s,h,d,A;if(M==null?M=tt:x(M,0,8),!N.c)return N.toString();if(H=N.c[0],h=N.e,$==null)A=K(N.c),A=X==1||X==2&&(h<=st||h>=nt)?w(A,h):u(A,h,"0");else if(N=wt(new rt(N),$,M),s=N.e,A=K(N.c),d=A.length,X==1||X==2&&($<=s||s<=st)){for(;d<$;A+="0",d++);A=w(A,s)}else if($-=h,A=u(A,s,"0"),s+1>d){if(--$>0)for(A+=".";$--;A+="0");}else if($+=s-d,$>0)for(s+1==d&&(A+=".");$--;A+="0");return N.s<0&&H?"-"+A:A}function mt(N,$){for(var M,X=1,H=new rt(N[0]);X=10;H/=10,X++);return(M=X+M*E-1)>O?N.c=N.e=null:M=10;d/=10,H++);if(s=$-H,s<0)s+=E,h=$,A=_[R=0],f=A/D[H-h-1]%10|0;else if(R=c((s+1)/E),R>=_.length)if(X){for(;_.length<=R;_.push(0));A=f=0,H=1,s%=E,h=s-E+1}else break t;else{for(A=d=_[R],H=1;d>=10;d/=10,H++);s%=E,h=s-E+H,f=h<0?0:A/D[H-h-1]%10|0}if(X=X||$<0||_[R+1]!=null||(h<0?A:A%D[H-h-1]),X=M<4?(f||X)&&(M==0||M==(N.s<0?3:2)):f>5||f==5&&(M==4||X||M==6&&(s>0?h>0?A/D[H-h]:0:_[R-1])%10&1||M==(N.s<0?8:7)),$<1||!_[0])return _.length=0,X?($-=N.e+1,_[0]=D[(E-$%E)%E],N.e=-$||0):_[0]=N.e=0,N;if(s==0?(_.length=R,d=1,R--):(_.length=R+1,d=D[E-s],_[R]=h>0?l(A/D[H-h]%D[h])*d:0),X)for(;;)if(R==0){for(s=1,h=_[0];h>=10;h/=10,s++);for(h=_[0]+=d,d=1;h>=10;h/=10,d++);s!=d&&(N.e++,_[0]==S&&(_[0]=1));break}else{if(_[R]+=d,_[R]!=S)break;_[R--]=0,d=1}for(s=_.length;_[--s]===0;_.pop());}N.e>O?N.c=N.e=null:N.e=nt?w($,M):u($,M,"0"),N.s<0?"-"+$:$)}return G.absoluteValue=G.abs=function(){var N=new rt(this);return N.s<0&&(N.s=1),N},G.comparedTo=function(N,$){return z(this,new rt(N,$))},G.decimalPlaces=G.dp=function(N,$){var M,X,H,s=this;if(N!=null)return x(N,0,b),$==null?$=tt:x($,0,8),wt(new rt(s),N+s.e+1,$);if(!(M=s.c))return null;if(X=((H=M.length-1)-C(this.e/E))*E,H=M[H])for(;H%10==0;H/=10,X--);return X<0&&(X=0),X},G.dividedBy=G.div=function(N,$){return I(this,new rt(N,$),J,tt)},G.dividedToIntegerBy=G.idiv=function(N,$){return I(this,new rt(N,$),0,1)},G.exponentiatedBy=G.pow=function(N,$){var M,X,H,s,h,d,A,R,f,_=this;if(N=new rt(N),N.c&&!N.isInteger())throw Error(n+"Exponent not an integer: "+St(N));if($!=null&&($=new rt($)),d=N.e>14,!_.c||!_.c[0]||_.c[0]==1&&!_.e&&_.c.length==1||!N.c||!N.c[0])return f=new rt(Math.pow(+St(_),d?N.s*(2-v(N)):+St(N))),$?f.mod($):f;if(A=N.s<0,$){if($.c?!$.c[0]:!$.s)return new rt(NaN);X=!A&&_.isInteger()&&$.isInteger(),X&&(_=_.mod($))}else{if(N.e>9&&(_.e>0||_.e<-1||(_.e==0?_.c[0]>1||d&&_.c[1]>=24e7:_.c[0]<8e13||d&&_.c[0]<=9999975e7)))return s=_.s<0&&v(N)?-0:0,_.e>-1&&(s=1/s),new rt(A?1/s:s);Z&&(s=c(Z/E+2))}for(d?(M=new rt(.5),A&&(N.s=1),R=v(N)):(H=Math.abs(+St(N)),R=H%2),f=new rt(et);;){if(R){if(f=f.times(_),!f.c)break;s?f.c.length>s&&(f.c.length=s):X&&(f=f.mod($))}if(H){if(H=l(H/2),H===0)break;R=H%2}else if(N=N.times(M),wt(N,N.e+1,1),N.e>14)R=v(N);else{if(H=+St(N),H===0)break;R=H%2}_=_.times(_),s?_.c&&_.c.length>s&&(_.c.length=s):X&&(_=_.mod($))}return X?f:(A&&(f=et.div(f)),$?f.mod($):s?wt(f,Z,tt,h):f)},G.integerValue=function(N){var $=new rt(this);return N==null?N=tt:x(N,0,8),wt($,$.e+1,N)},G.isEqualTo=G.eq=function(N,$){return z(this,new rt(N,$))===0},G.isFinite=function(){return!!this.c},G.isGreaterThan=G.gt=function(N,$){return z(this,new rt(N,$))>0},G.isGreaterThanOrEqualTo=G.gte=function(N,$){return($=z(this,new rt(N,$)))===1||$===0},G.isInteger=function(){return!!this.c&&C(this.e/E)>this.c.length-2},G.isLessThan=G.lt=function(N,$){return z(this,new rt(N,$))<0},G.isLessThanOrEqualTo=G.lte=function(N,$){return($=z(this,new rt(N,$)))===-1||$===0},G.isNaN=function(){return!this.s},G.isNegative=function(){return this.s<0},G.isPositive=function(){return this.s>0},G.isZero=function(){return!!this.c&&this.c[0]==0},G.minus=function(N,$){var M,X,H,s,h=this,d=h.s;if(N=new rt(N,$),$=N.s,!d||!$)return new rt(NaN);if(d!=$)return N.s=-$,h.plus(N);var A=h.e/E,R=N.e/E,f=h.c,_=N.c;if(!A||!R){if(!f||!_)return f?(N.s=-$,N):new rt(_?h:NaN);if(!f[0]||!_[0])return _[0]?(N.s=-$,N):new rt(f[0]?h:tt==3?-0:0)}if(A=C(A),R=C(R),f=f.slice(),d=A-R){for((s=d<0)?(d=-d,H=f):(R=A,H=_),H.reverse(),$=d;$--;H.push(0));H.reverse()}else for(X=(s=(d=f.length)<($=_.length))?d:$,d=$=0;$0)for(;$--;f[M++]=0);for($=S-1;X>d;){if(f[--X]<_[X]){for(M=X;M&&!f[--M];f[M]=$);--f[M],f[X]+=S}f[X]-=_[X]}for(;f[0]==0;f.splice(0,1),--R);return f[0]?dt(N,f,R):(N.s=tt==3?-1:1,N.c=[N.e=0],N)},G.modulo=G.mod=function(N,$){var M,X,H=this;return N=new rt(N,$),!H.c||!N.s||N.c&&!N.c[0]?new rt(NaN):!N.c||H.c&&!H.c[0]?new rt(H):(F==9?(X=N.s,N.s=1,M=I(H,N,0,3),N.s=X,M.s*=X):M=I(H,N,0,F),N=H.minus(M.times(N)),!N.c[0]&&F==1&&(N.s=H.s),N)},G.multipliedBy=G.times=function(N,$){var M,X,H,s,h,d,A,R,f,_,D,Y,lt,ft,o,g=this,m=g.c,V=(N=new rt(N,$)).c;if(!m||!V||!m[0]||!V[0])return!g.s||!N.s||m&&!m[0]&&!V||V&&!V[0]&&!m?N.c=N.e=N.s=null:(N.s*=g.s,!m||!V?N.c=N.e=null:(N.c=[0],N.e=0)),N;for(X=C(g.e/E)+C(N.e/E),N.s*=g.s,A=m.length,_=V.length,A<_&&(lt=m,m=V,V=lt,H=A,A=_,_=H),H=A+_,lt=[];H--;lt.push(0));for(ft=S,o=k,H=_;--H>=0;){for(M=0,D=V[H]%o,Y=V[H]/o|0,h=A,s=H+h;s>H;)R=m[--h]%o,f=m[h]/o|0,d=Y*R+f*D,R=D*R+d%o*o+lt[s]+M,M=(R/ft|0)+(d/o|0)+Y*f,lt[s--]=R%ft;lt[s]=M}return M?++X:lt.splice(0,1),dt(N,lt,X)},G.negated=function(){var N=new rt(this);return N.s=-N.s||null,N},G.plus=function(N,$){var M,X=this,H=X.s;if(N=new rt(N,$),$=N.s,!H||!$)return new rt(NaN);if(H!=$)return N.s=-$,X.minus(N);var s=X.e/E,h=N.e/E,d=X.c,A=N.c;if(!s||!h){if(!d||!A)return new rt(H/0);if(!d[0]||!A[0])return A[0]?N:new rt(d[0]?X:H*0)}if(s=C(s),h=C(h),d=d.slice(),H=s-h){for(H>0?(h=s,M=A):(H=-H,M=d),M.reverse();H--;M.push(0));M.reverse()}for(H=d.length,$=A.length,H-$<0&&(M=A,A=d,d=M,$=H),H=0;$;)H=(d[--$]=d[$]+A[$]+H)/S|0,d[$]=S===d[$]?0:d[$]%S;return H&&(d=[H].concat(d),++h),dt(N,d,h)},G.precision=G.sd=function(N,$){var M,X,H,s=this;if(N!=null&&N!==!!N)return x(N,1,b),$==null?$=tt:x($,0,8),wt(new rt(s),N,$);if(!(M=s.c))return null;if(H=M.length-1,X=H*E+1,H=M[H]){for(;H%10==0;H/=10,X--);for(H=M[0];H>=10;H/=10,X++);}return N&&s.e+1>X&&(X=s.e+1),X},G.shiftedBy=function(N){return x(N,-L,L),this.times("1e"+N)},G.squareRoot=G.sqrt=function(){var N,$,M,X,H,s=this,h=s.c,d=s.s,A=s.e,R=J+4,f=new rt("0.5");if(d!==1||!h||!h[0])return new rt(!d||d<0&&(!h||h[0])?NaN:h?s:1/0);if(d=Math.sqrt(+St(s)),d==0||d==1/0?($=K(h),($.length+A)%2==0&&($+="0"),d=Math.sqrt(+$),A=C((A+1)/2)-(A<0||A%2),d==1/0?$="5e"+A:($=d.toExponential(),$=$.slice(0,$.indexOf("e")+1)+A),M=new rt($)):M=new rt(d+""),M.c[0]){for(A=M.e,d=A+R,d<3&&(d=0);;)if(H=M,M=f.times(H.plus(I(s,H,R,1))),K(H.c).slice(0,d)===($=K(M.c)).slice(0,d))if(M.e0&<>0){for(s=lt%d||d,f=Y.substr(0,s);s0&&(f+=R+Y.slice(s)),D&&(f="-"+f)}X=_?f+(M.decimalSeparator||"")+((A=+M.fractionGroupSize)?_.replace(new RegExp("\\d{"+A+"}\\B","g"),"$&"+(M.fractionGroupSeparator||"")):_):f}return(M.prefix||"")+X+(M.suffix||"")},G.toFraction=function(N){var $,M,X,H,s,h,d,A,R,f,_,D,Y=this,lt=Y.c;if(N!=null&&(d=new rt(N),!d.isInteger()&&(d.c||d.s!==1)||d.lt(et)))throw Error(n+"Argument "+(d.isInteger()?"out of range: ":"not an integer: ")+St(d));if(!lt)return new rt(Y);for($=new rt(et),R=M=new rt(et),X=A=new rt(et),D=K(lt),s=$.e=D.length-Y.e-1,$.c[0]=y[(h=s%E)<0?E+h:h],N=!N||d.comparedTo($)>0?s>0?$:R:d,h=O,O=1/0,d=new rt(D),A.c[0]=0;f=I(d,$,0,1),H=M.plus(f.times(X)),H.comparedTo(N)!=1;)M=X,X=H,R=A.plus(f.times(H=R)),A=H,$=d.minus(f.times(H=$)),d=H;return H=I(N.minus(M),X,0,1),A=A.plus(H.times(R)),M=M.plus(H.times(X)),A.s=R.s=Y.s,s=s*2,_=I(R,X,s,tt).minus(Y).abs().comparedTo(I(A,M,s,tt).minus(Y).abs())<1?[R,X]:[A,M],O=h,_},G.toNumber=function(){return+St(this)},G.toPrecision=function(N,$){return N!=null&&x(N,1,b),ht(this,N,$,2)},G.toString=function(N){var $,M=this,X=M.s,H=M.e;return H===null?X?($="Infinity",X<0&&($="-"+$)):$="NaN":(N==null?$=H<=st||H>=nt?w(K(M.c),H):u(K(M.c),H,"0"):N===10&>?(M=wt(new rt(M),J+H+1,tt),$=u(K(M.c),M.e,"0")):(x(N,2,ut.length,"Base"),$=P(u(K(M.c),H,"0"),10,N,X,!0)),X<0&&M.c[0]&&($="-"+$)),$},G.valueOf=G.toJSON=function(){return St(this)},G._isBigNumber=!0,T!=null&&rt.set(T),rt}function C(T){var I=T|0;return T>0||T===I?I:I-1}function K(T){for(var I,P,q=1,G=T.length,et=T[0]+"";qnt^P?1:-1;for(tt=(st=G.length)<(nt=et.length)?st:nt,J=0;Jet[J]^P?1:-1;return st==nt?0:st>nt^P?1:-1}function x(T,I,P,q){if(TP||T!==l(T))throw Error(n+(q||"Argument")+(typeof T=="number"?TP?" out of range: ":" not an integer: ":" not a primitive number: ")+String(T))}function v(T){var I=T.c.length-1;return C(T.e/E)==I&&T.c[I]%2!=0}function w(T,I){return(T.length>1?T.charAt(0)+"."+T.slice(1):T)+(I<0?"e":"e+")+I}function u(T,I,P){var q,G;if(I<0){for(G=P+".";++I;G+=P);T=G+T}else if(q=T.length,++I>q){for(G=P,I-=q;--I;G+=P);T+=G}else I{at(),Object.defineProperty(t,"__esModule",{value:!0});var e=Fr(),r=class{constructor(){j(this,"BigNum");this.BigNum=(i,a)=>{let c=e.BigNumber.clone({DECIMAL_PLACES:a});return new c(i)}}winstonToAr(i,{formatted:a=!1,decimals:c=12,trim:l=!0}={}){let n=this.stringToBigNum(i,c).shiftedBy(-12);return a?n.toFormat(c):n.toFixed(c)}arToWinston(i,{formatted:a=!1}={}){let c=this.stringToBigNum(i).shiftedBy(12);return a?c.toFormat():c.toFixed(0)}compare(i,a){let c=this.stringToBigNum(i),l=this.stringToBigNum(a);return c.comparedTo(l)}isEqual(i,a){return this.compare(i,a)===0}isLessThan(i,a){let c=this.stringToBigNum(i),l=this.stringToBigNum(a);return c.isLessThan(l)}isGreaterThan(i,a){let c=this.stringToBigNum(i),l=this.stringToBigNum(a);return c.isGreaterThan(l)}add(i,a){let c=this.stringToBigNum(i);return this.stringToBigNum(a),c.plus(a).toFixed(0)}sub(i,a){let c=this.stringToBigNum(i);return this.stringToBigNum(a),c.minus(a).toFixed(0)}stringToBigNum(i,a=12){return this.BigNum(i,a)}};t.default=r}),yi=pt(t=>{at(),Object.defineProperty(t,"__esModule",{value:!0});var e=class{constructor(a){j(this,"METHOD_GET","GET");j(this,"METHOD_POST","POST");j(this,"config");this.applyConfig(a)}applyConfig(a){this.config=this.mergeDefaults(a)}getConfig(){return this.config}mergeDefaults(a){let c=a.protocol||"http",l=a.port||(c==="https"?443:80);return{host:a.host||"127.0.0.1",protocol:c,port:l,timeout:a.timeout||2e4,logging:a.logging||!1,logger:a.logger||console.log,network:a.network}}async get(a,c){return await this.request(a,{...c,method:this.METHOD_GET})}async post(a,c,l){var p;let n=new Headers((l==null?void 0:l.headers)||{});return(p=n.get("content-type"))!=null&&p.includes("application/json")||n.append("content-type","application/json"),n.append("accept","application/json, text/plain, */*"),await this.request(a,{...l,method:this.METHOD_POST,body:typeof c!="string"?JSON.stringify(c):c,headers:n})}async request(a,c){var k,b;let l=new Headers((c==null?void 0:c.headers)||{}),n=`${this.config.protocol}://${this.config.host}:${this.config.port}`,p=c==null?void 0:c.responseType;c==null||delete c.responseType,a.startsWith("/")&&(a=a.slice(1)),this.config.network&&l.append("x-network",this.config.network),this.config.logging&&this.config.logger(`Requesting: ${n}/${a}`);let S=await fetch(`${n}/${a}`,{...c||{},headers:l});this.config.logging&&this.config.logger(`Response: ${S.url} - ${S.status}`);let E=(b=(k=S.headers.get("content-type"))==null?void 0:k.match(/charset=([^()<>@,;:\"/[\]?.=\s]*)/i))==null?void 0:b[1],L=S,y=async()=>{if(E)try{L.data=new TextDecoder(E).decode(await S.arrayBuffer())}catch{L.data=await S.text()}else L.data=await S.text()};if(p==="arraybuffer")L.data=await S.arrayBuffer();else if(p==="text")await y();else if(p==="webstream")L.data=r(S.body);else try{let U=await S.clone().json();typeof U!="object"?await y():L.data=await S.json(),U=null}catch{await y()}return L}};t.default=e;var r=a=>{let c=a;return typeof c[Symbol.asyncIterator]>"u"?(c[Symbol.asyncIterator]=i(a),c):a},i=function(a){return async function*(){let c=a.getReader();try{for(;;){let{done:l,value:n}=await c.read();if(l)return;yield n}}finally{c.releaseLock()}}}}),Ft=pt(t=>{at(),Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var e=Ur();function r(y){let k=0;for(let C=0;C{at(),Object.defineProperty(t,"__esModule",{value:!0});var e=Ft(),r=class{constructor(){j(this,"keyLength",4096);j(this,"publicExponent",65537);j(this,"hashAlgorithm","sha256");j(this,"driver");if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let i=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),a=await this.driver.exportKey("jwk",i.privateKey);return{kty:a.kty,e:a.e,n:a.n,d:a.d,p:a.p,q:a.q,dp:a.dp,dq:a.dq,qi:a.qi}}async sign(i,a,{saltLength:c}={}){let l=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(i),a);return new Uint8Array(l)}async hash(i,a="SHA-256"){let c=await this.driver.digest(a,i);return new Uint8Array(c)}async verify(i,a,c){let l={kty:"RSA",e:"AQAB",n:i},n=await this.jwkToPublicCryptoKey(l),p=await this.driver.digest("SHA-256",a),S=await this.driver.verify({name:"RSA-PSS",saltLength:0},n,c,a),E=await this.driver.verify({name:"RSA-PSS",saltLength:32},n,c,a),L=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((n.algorithm.modulusLength-1)/8)-p.byteLength-2},n,c,a);return S||E||L}async jwkToCryptoKey(i){return this.driver.importKey("jwk",i,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(i){return this.driver.importKey("jwk",i,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let i=crypto==null?void 0:crypto.subtle;return i===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(a=>typeof i[a]=="function")}async encrypt(i,a,c){let l=await this.driver.importKey("raw",typeof a=="string"?e.stringToBuffer(a):a,{name:"PBKDF2",length:32},!1,["deriveKey"]),n=await this.driver.deriveKey({name:"PBKDF2",salt:c?e.stringToBuffer(c):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},l,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),p=new Uint8Array(16);crypto.getRandomValues(p);let S=await this.driver.encrypt({name:"AES-CBC",iv:p},n,i);return e.concatBuffers([p,S])}async decrypt(i,a,c){let l=await this.driver.importKey("raw",typeof a=="string"?e.stringToBuffer(a):a,{name:"PBKDF2",length:32},!1,["deriveKey"]),n=await this.driver.deriveKey({name:"PBKDF2",salt:c?e.stringToBuffer(c):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},l,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),p=i.slice(0,16),S=await this.driver.decrypt({name:"AES-CBC",iv:p},n,i.slice(16));return e.concatBuffers([S])}};t.default=r}),bi=pt(t=>{at(),Object.defineProperty(t,"__esModule",{value:!0});var e=class{constructor(r){j(this,"api");this.api=r}getInfo(){return this.api.get("info").then(r=>r.data)}getPeers(){return this.api.get("peers").then(r=>r.data)}};t.default=e}),Ae=pt(t=>{at(),Object.defineProperty(t,"__esModule",{value:!0}),t.getError=void 0;var e=class extends Error{constructor(c,l={}){var a=(...i)=>(super(...i),j(this,"type"),j(this,"response"),this);l.message?a(l.message):a(),this.type=c,this.response=l.response}getType(){return this.type}};t.default=e;function r(a){let c=a.data;if(typeof a.data=="string")try{c=JSON.parse(a.data)}catch{}if(a.data instanceof ArrayBuffer||a.data instanceof Uint8Array)try{c=JSON.parse(c.toString())}catch{}return c?c.error||c:a.statusText||"unknown"}t.getError=r}),vi=pt(t=>{at(),Object.defineProperty(t,"__esModule",{value:!0});var e=_e();async function r(a){if(Array.isArray(a)){let n=e.default.utils.concatBuffers([e.default.utils.stringToBuffer("list"),e.default.utils.stringToBuffer(a.length.toString())]);return await i(a,await e.default.crypto.hash(n,"SHA-384"))}let c=e.default.utils.concatBuffers([e.default.utils.stringToBuffer("blob"),e.default.utils.stringToBuffer(a.byteLength.toString())]),l=e.default.utils.concatBuffers([await e.default.crypto.hash(c,"SHA-384"),await e.default.crypto.hash(a,"SHA-384")]);return await e.default.crypto.hash(l,"SHA-384")}t.default=r;async function i(a,c){if(a.length<1)return c;let l=e.default.utils.concatBuffers([c,await r(a[0])]),n=await e.default.crypto.hash(l,"SHA-384");return await i(a.slice(1),n)}}),Vr=pt(t=>{at(),Object.defineProperty(t,"__esModule",{value:!0}),t.debug=t.validatePath=t.arrayCompare=t.bufferToInt=t.intToBuffer=t.arrayFlatten=t.generateProofs=t.buildLayers=t.generateTransactionChunks=t.generateTree=t.computeRootHash=t.generateLeaves=t.chunkData=t.MIN_CHUNK_SIZE=t.MAX_CHUNK_SIZE=void 0;var e=_e(),r=Ft();t.MAX_CHUNK_SIZE=256*1024,t.MIN_CHUNK_SIZE=32*1024;var i=32,a=32;async function c(w){let u=[],T=w,I=0;for(;T.byteLength>=t.MAX_CHUNK_SIZE;){let P=t.MAX_CHUNK_SIZE,q=T.byteLength-t.MAX_CHUNK_SIZE;q>0&&q({type:"leaf",id:await U(await Promise.all([U(u),U(C(I))])),dataHash:u,minByteRange:T,maxByteRange:I})))}t.generateLeaves=l;async function n(w){return(await p(w)).id}t.computeRootHash=n;async function p(w){return await E(await l(await c(w)))}t.generateTree=p;async function S(w){let u=await c(w),T=await l(u),I=await E(T),P=await L(I),q=u.slice(-1)[0];return q.maxByteRange-q.minByteRange===0&&(u.splice(u.length-1,1),P.splice(P.length-1,1)),{data_root:I.id,chunks:u,proofs:P}}t.generateTransactionChunks=S;async function E(w,u=0){if(w.length<2)return w[0];let T=[];for(let I=0;I{Array.isArray(T)?u.push(...k(T)):u.push(T)}),u}t.arrayFlatten=k;async function b(w,u){return u?{type:"branch",id:await U([await U(w.id),await U(u.id),await U(C(w.maxByteRange))]),byteRange:w.maxByteRange,maxByteRange:u.maxByteRange,leftChild:w,rightChild:u}:w}async function U(w){return Array.isArray(w)&&(w=e.default.utils.concatBuffers(w)),new Uint8Array(await e.default.crypto.hash(w))}function C(w){let u=new Uint8Array(i);for(var T=u.length-1;T>=0;T--){var I=w%256;u[T]=I,w=(w-I)/256}return u}t.intToBuffer=C;function K(w){let u=0;for(var T=0;Tw.every((T,I)=>u[I]===T);t.arrayCompare=z;async function x(w,u,T,I,P){if(I<=0)return!1;if(u>=I)return x(w,0,I-1,I,P);if(u<0)return x(w,0,0,I,P);if(P.length==a+i){let nt=P.slice(0,a),B=P.slice(nt.length,nt.length+i),O=await U([await U(nt),await U(B)]);return(0,t.arrayCompare)(w,O)?{offset:I-1,leftBound:T,rightBound:I,chunkSize:I-T}:!1}let q=P.slice(0,a),G=P.slice(q.length,q.length+a),et=P.slice(q.length+G.length,q.length+G.length+i),J=K(et),tt=P.slice(q.length+G.length+et.length),st=await U([await U(q),await U(G),await U(et)]);return(0,t.arrayCompare)(w,st)?u ${JSON.stringify(et)}`;return v(G,J)}t.debug=v}),Ze=pt(t=>{at(),Object.defineProperty(t,"__esModule",{value:!0}),t.Tag=void 0;var e=Ft(),r=vi(),i=Vr(),a=class{get(n,p){if(!Object.getOwnPropertyNames(this).includes(n))throw new Error(`Field "${n}" is not a property of the Arweave Transaction class.`);if(this[n]instanceof Uint8Array)return p&&p.decode&&p.string?e.bufferToString(this[n]):p&&p.decode&&!p.string?this[n]:e.bufferTob64Url(this[n]);if(this[n]instanceof Array){if((p==null?void 0:p.decode)!==void 0||(p==null?void 0:p.string)!==void 0)throw n==="tags"&&console.warn(`Did you mean to use 'transaction["tags"]' ?`),new Error("Cannot decode or stringify an array.");return this[n]}return p&&p.decode==!0?p&&p.string?e.b64UrlToString(this[n]):e.b64UrlToBuffer(this[n]):this[n]}},c=class extends a{constructor(p,S,E=!1){super();j(this,"name");j(this,"value");this.name=p,this.value=S}};t.Tag=c;var l=class extends a{constructor(p={}){super();j(this,"format",2);j(this,"id","");j(this,"last_tx","");j(this,"owner","");j(this,"tags",[]);j(this,"target","");j(this,"quantity","0");j(this,"data_size","0");j(this,"data",new Uint8Array);j(this,"data_root","");j(this,"reward","0");j(this,"signature","");j(this,"chunks");Object.assign(this,p),typeof this.data=="string"&&(this.data=e.b64UrlToBuffer(this.data)),p.tags&&(this.tags=p.tags.map(S=>new c(S.name,S.value)))}addTag(p,S){this.tags.push(new c(e.stringToB64Url(p),e.stringToB64Url(S)))}toJSON(){return{format:this.format,id:this.id,last_tx:this.last_tx,owner:this.owner,tags:this.tags,target:this.target,quantity:this.quantity,data:e.bufferTob64Url(this.data),data_size:this.data_size,data_root:this.data_root,data_tree:this.data_tree,reward:this.reward,signature:this.signature}}setOwner(p){this.owner=p}setSignature({id:p,owner:S,reward:E,tags:L,signature:y}){this.id=p,this.owner=S,E&&(this.reward=E),L&&(this.tags=L),this.signature=y}async prepareChunks(p){!this.chunks&&p.byteLength>0&&(this.chunks=await(0,i.generateTransactionChunks)(p),this.data_root=e.bufferTob64Url(this.chunks.data_root)),!this.chunks&&p.byteLength===0&&(this.chunks={chunks:[],data_root:new Uint8Array,proofs:[]},this.data_root="")}getChunk(p,S){if(!this.chunks)throw new Error("Chunks have not been prepared");let E=this.chunks.proofs[p],L=this.chunks.chunks[p];return{data_root:this.data_root,data_size:this.data_size,data_path:e.bufferTob64Url(E.proof),offset:E.offset.toString(),chunk:e.bufferTob64Url(S.slice(L.minByteRange,L.maxByteRange))}}async getSignatureData(){switch(this.format){case 1:let p=this.tags.reduce((E,L)=>e.concatBuffers([E,L.get("name",{decode:!0,string:!1}),L.get("value",{decode:!0,string:!1})]),new Uint8Array);return e.concatBuffers([this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),this.get("data",{decode:!0,string:!1}),e.stringToBuffer(this.quantity),e.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),p]);case 2:this.data_root||await this.prepareChunks(this.data);let S=this.tags.map(E=>[E.get("name",{decode:!0,string:!1}),E.get("value",{decode:!0,string:!1})]);return await(0,r.default)([e.stringToBuffer(this.format.toString()),this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),e.stringToBuffer(this.quantity),e.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),S,e.stringToBuffer(this.data_size),this.get("data_root",{decode:!0,string:!1})]);default:throw new Error(`Unexpected transaction format: ${this.format}`)}}};t.default=l}),_i=pt(t=>{at(),Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionUploader=void 0;var e=Ze(),r=Ft(),i=Ae(),a=Vr(),c=1,l=["invalid_json","chunk_too_big","data_path_too_big","offset_too_big","data_size_too_big","chunk_proof_ratio_not_attractive","invalid_proof"],n=1e3*40,p=class{constructor(S,E){j(this,"api");j(this,"chunkIndex",0);j(this,"txPosted",!1);j(this,"transaction");j(this,"lastRequestTimeEnd",0);j(this,"totalErrors",0);j(this,"data");j(this,"lastResponseStatus",0);j(this,"lastResponseError","");if(this.api=S,!E.id)throw new Error("Transaction is not signed");if(!E.chunks)throw new Error("Transaction chunks not prepared");this.data=E.data,this.transaction=new e.default(Object.assign({},E,{data:new Uint8Array(0)}))}get isComplete(){return this.txPosted&&this.chunkIndex===this.transaction.chunks.chunks.length}get totalChunks(){return this.transaction.chunks.chunks.length}get uploadedChunks(){return this.chunkIndex}get pctComplete(){return Math.trunc(this.uploadedChunks/this.totalChunks*100)}async uploadChunk(S){if(this.isComplete)throw new Error("Upload is already complete");if(this.lastResponseError!==""?this.totalErrors++:this.totalErrors=0,this.totalErrors===100)throw new Error(`Unable to complete upload: ${this.lastResponseStatus}: ${this.lastResponseError}`);let E=this.lastResponseError===""?0:Math.max(this.lastRequestTimeEnd+n-Date.now(),n);if(E>0&&(E=E-E*Math.random()*.3,await new Promise(k=>setTimeout(k,E))),this.lastResponseError="",!this.txPosted){await this.postTransaction();return}S&&(this.chunkIndex=S);let L=this.transaction.getChunk(S||this.chunkIndex,this.data);if(!await(0,a.validatePath)(this.transaction.chunks.data_root,parseInt(L.offset),0,parseInt(L.data_size),r.b64UrlToBuffer(L.data_path)))throw new Error(`Unable to validate chunk ${this.chunkIndex}`);let y=await this.api.post("chunk",this.transaction.getChunk(this.chunkIndex,this.data)).catch(k=>(console.error(k.message),{status:-1,data:{error:k.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=y.status,this.lastResponseStatus==200)this.chunkIndex++;else if(this.lastResponseError=(0,i.getError)(y),l.includes(this.lastResponseError))throw new Error(`Fatal error uploading chunk ${this.chunkIndex}: ${this.lastResponseError}`)}static async fromSerialized(S,E,L){if(!E||typeof E.chunkIndex!="number"||typeof E.transaction!="object")throw new Error("Serialized object does not match expected format.");var y=new e.default(E.transaction);y.chunks||await y.prepareChunks(L);let k=new p(S,y);if(k.chunkIndex=E.chunkIndex,k.lastRequestTimeEnd=E.lastRequestTimeEnd,k.lastResponseError=E.lastResponseError,k.lastResponseStatus=E.lastResponseStatus,k.txPosted=E.txPosted,k.data=L,k.transaction.data_root!==E.transaction.data_root)throw new Error("Data mismatch: Uploader doesn't match provided data.");return k}static async fromTransactionId(S,E){let L=await S.get(`tx/${E}`);if(L.status!==200)throw new Error(`Tx ${E} not found: ${L.status}`);let y=L.data;return y.data=new Uint8Array(0),{txPosted:!0,chunkIndex:0,lastResponseError:"",lastRequestTimeEnd:0,lastResponseStatus:0,transaction:y}}toJSON(){return{chunkIndex:this.chunkIndex,transaction:this.transaction,lastRequestTimeEnd:this.lastRequestTimeEnd,lastResponseStatus:this.lastResponseStatus,lastResponseError:this.lastResponseError,txPosted:this.txPosted}}async postTransaction(){if(this.totalChunks<=c){this.transaction.data=this.data;let E=await this.api.post("tx",this.transaction).catch(L=>(console.error(L),{status:-1,data:{error:L.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=E.status,this.transaction.data=new Uint8Array(0),E.status>=200&&E.status<300){this.txPosted=!0,this.chunkIndex=c;return}throw this.lastResponseError=(0,i.getError)(E),new Error(`Unable to upload transaction: ${E.status}, ${this.lastResponseError}`)}let S=await this.api.post("tx",this.transaction);if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=S.status,!(S.status>=200&&S.status<300))throw this.lastResponseError=(0,i.getError)(S),new Error(`Unable to upload transaction: ${S.status}, ${this.lastResponseError}`);this.txPosted=!0}};t.TransactionUploader=p}),tr=pt((t,e)=>{at(),e.exports={}}),Ei=pt(t=>{at(),Object.defineProperty(t,"__esModule",{value:!0});var e=Ae(),r=Ze(),i=Ft(),a=_i();tr();var c=class{constructor(l,n,p){j(this,"api");j(this,"crypto");j(this,"chunks");this.api=l,this.crypto=n,this.chunks=p}async getTransactionAnchor(){let l=await this.api.get("tx_anchor");if(!l.data.match(/^[a-z0-9_-]{43,}/i)||!l.ok)throw new Error(`Could not getTransactionAnchor. Received: ${l.data}. Status: ${l.status}, ${l.statusText}`);return l.data}async getPrice(l,n){let p=n?`price/${l}/${n}`:`price/${l}`,S=await this.api.get(p);if(!/^\d+$/.test(S.data)||!S.ok)throw new Error(`Could not getPrice. Received: ${S.data}. Status: ${S.status}, ${S.statusText}`);return S.data}async get(l){let n=await this.api.get(`tx/${l}`);if(n.status==200){let p=parseInt(n.data.data_size);if(n.data.format>=2&&p>0&&p<=1024*1024*12){let S=await this.getData(l);return new r.default({...n.data,data:S})}return new r.default({...n.data,format:n.data.format||1})}throw n.status==404?new e.default("TX_NOT_FOUND"):n.status==410?new e.default("TX_FAILED"):new e.default("TX_INVALID")}fromRaw(l){return new r.default(l)}async search(l,n){return this.api.post("arql",{op:"equals",expr1:l,expr2:n}).then(p=>p.data?p.data:[])}getStatus(l){return this.api.get(`tx/${l}/status`).then(n=>n.status==200?{status:200,confirmed:n.data}:{status:n.status,confirmed:null})}async getData(l,n){let p;try{p=await this.chunks.downloadChunkedData(l)}catch(S){console.error(`Error while trying to download chunked data for ${l}`),console.error(S)}if(!p){console.warn(`Falling back to gateway cache for ${l}`);try{let{data:S,ok:E,status:L,statusText:y}=await this.api.get(`/${l}`,{responseType:"arraybuffer"});if(!E)throw new Error("Bad http status code",{cause:{status:L,statusText:y}});p=S}catch(S){console.error(`Error while trying to download contiguous data from gateway cache for ${l}`),console.error(S)}}if(!p)throw new Error(`${l} data was not found!`);return n&&n.decode&&!n.string?p:n&&n.decode&&n.string?i.bufferToString(p):i.bufferTob64Url(p)}async sign(l,n,p){let S=typeof n=="object"&&(L=>{let y=!0;return["n","e","d","p","q","dp","dq","qi"].map(k=>!(k in L)&&(y=!1)),y})(n),E=typeof arweaveWallet=="object";if(!S&&!E)throw new Error("No valid JWK or external wallet found to sign transaction.");if(E){try{(await arweaveWallet.getPermissions()).includes("SIGN_TRANSACTION")||await arweaveWallet.connect(["SIGN_TRANSACTION"])}catch{}let L=await arweaveWallet.sign(l,p);l.setSignature({id:L.id,owner:L.owner,reward:L.reward,tags:L.tags,signature:L.signature})}else if(S){l.setOwner(n.n);let L=await l.getSignatureData(),y=await this.crypto.sign(n,L,p),k=await this.crypto.hash(y);l.setSignature({id:i.bufferTob64Url(k),owner:n.n,signature:i.bufferTob64Url(y)})}else throw new Error("An error occurred while signing. Check wallet is valid")}async verify(l){let n=await l.getSignatureData(),p=l.get("signature",{decode:!0,string:!1}),S=i.bufferTob64Url(await this.crypto.hash(p));if(l.id!==S)throw new Error("Invalid transaction signature or ID! The transaction ID doesn't match the expected SHA-256 hash of the signature.");return this.crypto.verify(l.owner,n,p)}async post(l){if(typeof l=="string"?l=new r.default(JSON.parse(l)):typeof l.readInt32BE=="function"?l=new r.default(JSON.parse(l.toString())):typeof l=="object"&&!(l instanceof r.default)&&(l=new r.default(l)),!(l instanceof r.default))throw new Error("Must be Transaction object");l.chunks||await l.prepareChunks(l.data);let n=await this.getUploader(l,l.data);try{for(;!n.isComplete;)await n.uploadChunk()}catch(p){if(n.lastResponseStatus>0)return{status:n.lastResponseStatus,statusText:n.lastResponseError,data:{error:n.lastResponseError}};throw p}return{status:200,statusText:"OK",data:{}}}async getUploader(l,n){let p;if(n instanceof ArrayBuffer&&(n=new Uint8Array(n)),l instanceof r.default){if(n||(n=l.data),!(n instanceof Uint8Array))throw new Error("Data format is invalid");l.chunks||await l.prepareChunks(n),p=new a.TransactionUploader(this.api,l),(!p.data||p.data.length===0)&&(p.data=n)}else{if(typeof l=="string"&&(l=await a.TransactionUploader.fromTransactionId(this.api,l)),!n||!(n instanceof Uint8Array))throw new Error("Must provide data when resuming upload");p=await a.TransactionUploader.fromSerialized(this.api,l,n)}return p}async*upload(l,n){let p=await this.getUploader(l,n);for(;!p.isComplete;)await p.uploadChunk(),yield p;return p}};t.default=c}),Ti=pt(t=>{at(),Object.defineProperty(t,"__esModule",{value:!0});var e=Ft();tr();var r=class{constructor(i,a){j(this,"api");j(this,"crypto");this.api=i,this.crypto=a}getBalance(i){return this.api.get(`wallet/${i}/balance`).then(a=>a.data)}getLastTransactionID(i){return this.api.get(`wallet/${i}/last_tx`).then(a=>a.data)}generate(){return this.crypto.generateJWK()}async jwkToAddress(i){return!i||i==="use_wallet"?this.getAddress():this.getAddress(i)}async getAddress(i){if(!i||i==="use_wallet"){try{await arweaveWallet.connect(["ACCESS_ADDRESS"])}catch{}return arweaveWallet.getActiveAddress()}else return this.ownerToAddress(i.n)}async ownerToAddress(i){return e.bufferTob64Url(await this.crypto.hash(e.b64UrlToBuffer(i)))}};t.default=r}),Si=pt(t=>{at(),Object.defineProperty(t,"__esModule",{value:!0}),t.SiloResource=void 0;var e=Ft(),r=class{constructor(a,c,l){j(this,"api");j(this,"crypto");j(this,"transactions");this.api=a,this.crypto=c,this.transactions=l}async get(a){if(!a)throw new Error("No Silo URI specified");let c=await this.parseUri(a),l=await this.transactions.search("Silo-Name",c.getAccessKey());if(l.length==0)throw new Error(`No data could be found for the Silo URI: ${a}`);let n=await this.transactions.get(l[0]);if(!n)throw new Error(`No data could be found for the Silo URI: ${a}`);let p=n.get("data",{decode:!0,string:!1});return this.crypto.decrypt(p,c.getEncryptionKey())}async readTransactionData(a,c){if(!c)throw new Error("No Silo URI specified");let l=await this.parseUri(c),n=a.get("data",{decode:!0,string:!1});return this.crypto.decrypt(n,l.getEncryptionKey())}async parseUri(a){let c=a.match(/^([a-z0-9-_]+)\.([0-9]+)/i);if(!c)throw new Error("Invalid Silo name, must be a name in the format of [a-z0-9]+.[0-9]+, e.g. 'bubble.7'");let l=c[1],n=Math.pow(2,parseInt(c[2])),p=await this.hash(e.stringToBuffer(l),n),S=e.bufferTob64(p.slice(0,15)),E=await this.hash(p.slice(16,31),1);return new i(a,S,E)}async hash(a,c){let l=await this.crypto.hash(a);for(let n=0;n{at(),Object.defineProperty(t,"__esModule",{value:!0});var e=Ae(),r=Ft(),i=class{constructor(a){j(this,"api");this.api=a}async getTransactionOffset(a){let c=await this.api.get(`tx/${a}/offset`);if(c.status===200)return c.data;throw new Error(`Unable to get transaction offset: ${(0,e.getError)(c)}`)}async getChunk(a){let c=await this.api.get(`chunk/${a}`);if(c.status===200)return c.data;throw new Error(`Unable to get chunk: ${(0,e.getError)(c)}`)}async getChunkData(a){let c=await this.getChunk(a);return r.b64UrlToBuffer(c.chunk)}firstChunkOffset(a){return parseInt(a.offset)-parseInt(a.size)+1}async downloadChunkedData(a){let c=await this.getTransactionOffset(a),l=parseInt(c.size),n=parseInt(c.offset)-l+1,p=new Uint8Array(l),S=0;for(;S{at(),Object.defineProperty(t,"__esModule",{value:!0});var e=Ae();tr();var r=class{constructor(a,c){j(this,"api");j(this,"network");this.api=a,this.network=c}async get(a){let c=await this.api.get(`${r.ENDPOINT}${a}`);if(c.status===200)return c.data;throw c.status===404?new e.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${c}`)}async getCurrent(){let{current:a}=await this.network.getInfo();return await this.get(a)}},i=r;he(i,"ENDPOINT","block/hash/"),t.default=i}),_e=pt(t=>{at(),Object.defineProperty(t,"__esModule",{value:!0});var e=wi(),r=yi(),i=mi(),a=bi(),c=Ei(),l=Ti(),n=Ze(),p=Ft(),S=Si(),E=xi(),L=ki(),y=class{constructor(b){j(this,"api");j(this,"wallets");j(this,"transactions");j(this,"network");j(this,"blocks");j(this,"ar");j(this,"silo");j(this,"chunks");this.api=new r.default(b),this.wallets=new l.default(this.api,y.crypto),this.chunks=new E.default(this.api),this.transactions=new c.default(this.api,y.crypto,this.chunks),this.silo=new S.default(this.api,this.crypto,this.transactions),this.network=new a.default(this.api),this.blocks=new L.default(this.api,this.network),this.ar=new e.default}get crypto(){return y.crypto}get utils(){return y.utils}getConfig(){return{api:this.api.getConfig(),crypto:null}}async createTransaction(b,U){let C={};if(Object.assign(C,b),!b.data&&!(b.target&&b.quantity))throw new Error("A new Arweave transaction must have a 'data' value, or 'target' and 'quantity' values.");if(b.owner==null&&U&&U!=="use_wallet"&&(C.owner=U.n),b.last_tx==null&&(C.last_tx=await this.transactions.getTransactionAnchor()),typeof b.data=="string"&&(b.data=p.stringToBuffer(b.data)),b.data instanceof ArrayBuffer&&(b.data=new Uint8Array(b.data)),b.data&&!(b.data instanceof Uint8Array))throw new Error("Expected data to be a string, Uint8Array or ArrayBuffer");if(b.reward==null){let z=b.data?b.data.byteLength:0;C.reward=await this.transactions.getPrice(z,C.target)}C.data_root="",C.data_size=b.data?b.data.byteLength.toString():"0",C.data=b.data||new Uint8Array(0);let K=new n.default(C);return await K.getSignatureData(),K}async createSiloTransaction(b,U,C){let K={};if(Object.assign(K,b),!b.data)throw new Error("Silo transactions must have a 'data' value");if(!C)throw new Error("No Silo URI specified.");if(b.target||b.quantity)throw new Error("Silo transactions can only be used for storing data, sending AR to other wallets isn't supported.");if(b.owner==null){if(!U||!U.n)throw new Error("A new Arweave transaction must either have an 'owner' attribute, or you must provide the jwk parameter.");K.owner=U.n}b.last_tx==null&&(K.last_tx=await this.transactions.getTransactionAnchor());let z=await this.silo.parseUri(C);if(typeof b.data=="string"){let v=await this.crypto.encrypt(p.stringToBuffer(b.data),z.getEncryptionKey());K.reward=await this.transactions.getPrice(v.byteLength),K.data=p.bufferTob64Url(v)}if(b.data instanceof Uint8Array){let v=await this.crypto.encrypt(b.data,z.getEncryptionKey());K.reward=await this.transactions.getPrice(v.byteLength),K.data=p.bufferTob64Url(v)}let x=new n.default(K);return x.addTag("Silo-Name",z.getAccessKey()),x.addTag("Silo-Version","0.1.0"),x}arql(b){return this.api.post("/arql",b).then(U=>U.data||[])}},k=y;he(k,"init"),he(k,"crypto",new i.default),he(k,"utils",p),t.default=k}),Ai=pt(t=>{at(),Object.defineProperty(t,"__esModule",{value:!0}),t.getDefaultConfig=void 0;var e=(a,c)=>{let l=/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/,n=c.split("."),p=n[n.length-1],S=["localhost","[::1]"];return S.includes(c)||a=="file"||S.includes(p)||!!c.match(l)||!!p.match(l)},r=a=>{let c=a.charAt(0)==="[",l=/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/;return!!a.match(l)||c},i=(a,c)=>{if(e(a,c))return{protocol:"https",host:"arweave.net",port:443};if(!r(c)){let l=c.split(".");if(l.length>=3){l.shift();let n=l.join(".");return{protocol:a,host:n}}}return{protocol:a,host:c}};t.getDefaultConfig=i}),er=pt(t=>{at();var e=t&&t.__createBinding||(Object.create?function(c,l,n,p){p===void 0&&(p=n);var S=Object.getOwnPropertyDescriptor(l,n);(!S||("get"in S?!l.__esModule:S.writable||S.configurable))&&(S={enumerable:!0,get:function(){return l[n]}}),Object.defineProperty(c,p,S)}:function(c,l,n,p){p===void 0&&(p=n),c[p]=l[n]}),r=t&&t.__exportStar||function(c,l){for(var n in c)n!=="default"&&!Object.prototype.hasOwnProperty.call(l,n)&&e(l,c,n)};Object.defineProperty(t,"__esModule",{value:!0});var i=_e(),a=Ai();i.default.init=function(c={}){let l={host:"arweave.net",port:443,protocol:"https"};if(typeof location!="object"||!location.protocol||!location.hostname)return new i.default({...c,...l});let n=location.protocol.replace(":",""),p=location.hostname,S=location.port?parseInt(location.port):n=="https"?443:80,E=(0,a.getDefaultConfig)(n,p),L=c.protocol||E.protocol,y=c.host||E.host,k=c.port||E.port||S;return new i.default({...c,host:y,protocol:L,port:k})},typeof globalThis=="object"?globalThis.Arweave=i.default:typeof self=="object"&&(self.Arweave=i.default),r(_e(),t),t.default=i.default}),Ci=pt((t,e)=>{at();var{hasOwnProperty:r}=Object.prototype,i=x();i.configure=x,i.stringify=i,i.default=i,t.stringify=i,t.configure=x,e.exports=i;var a=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/,c=new RegExp(a,"g"),l=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000b","\\f","\\r","\\u000e","\\u000f","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001a","\\u001b","\\u001c","\\u001d","\\u001e","\\u001f","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\"];function n(v){if(v.length===2){let u=v.charCodeAt(1);return`${v[0]}\\u${u.toString(16)}`}let w=v.charCodeAt(0);return l.length>w?l[w]:`\\u${w.toString(16)}`}function p(v){if(v.length<5e3&&!a.test(v))return v;if(v.length>100)return v.replace(c,n);let w="",u=0;for(let T=0;T=55296&&I<=57343){if(I<=56319&&T+1=56320&&P<=57343){T++;continue}}w+=`${v.slice(u,T)}\\u${I.toString(16)}`,u=T+1}}return w+=v.slice(u),w}function S(v){if(v.length>200)return v.sort();for(let w=1;wu;)v[T]=v[T-1],T--;v[T]=u}return v}var E=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function L(v){return E.call(v)!==void 0&&v.length!==0}function y(v,w,u){v.length= 1`)}return u===void 0?1/0:u}function C(v){return v===1?"1 item":`${v} items`}function K(v){let w=new Set;for(let u of v)(typeof u=="string"||typeof u=="number")&&w.add(String(u));return w}function z(v){if(r.call(v,"strict")){let w=v.strict;if(typeof w!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(w)return u=>{let T=`Object can not safely be stringified. Received type ${typeof u}`;throw typeof u!="function"&&(T+=` (${u.toString()})`),new Error(T)}}}function x(v){v={...v};let w=z(v);w&&(v.bigint===void 0&&(v.bigint=!1),"circularValue"in v||(v.circularValue=Error));let u=k(v),T=b(v,"bigint"),I=b(v,"deterministic"),P=U(v,"maximumDepth"),q=U(v,"maximumBreadth");function G(nt,B,O,W,F,Z){let ot=B[nt];switch(typeof ot=="object"&&ot!==null&&typeof ot.toJSON=="function"&&(ot=ot.toJSON(nt)),ot=W.call(B,nt,ot),typeof ot){case"string":return`"${p(ot)}"`;case"object":{if(ot===null)return"null";if(O.indexOf(ot)!==-1)return u;let ut="",gt=",",rt=Z;if(Array.isArray(ot)){if(ot.length===0)return"[]";if(Pq){let X=ot.length-q-1;ut+=`${gt}"... ${C(X)} not stringified"`}return F!==""&&(ut+=` @@ -104,7 +104,7 @@ ${D.stack}`:D.toString()}catch{return""}}();th } } }`,xr=30*1e3,fo=100,Ie=class{constructor(t){j(this,"arweaveWrapper");j(this,"logger",xt.INST.create(Ie.name));this.warp=t,this.arweaveWrapper=new le(t)}async transaction(t){return(await this.fetch(uo,{id:t})).transaction}async transactionUsingUploaderTag(t){let e={name:_t.UPLOADER_TX_ID,values:[t]},r=(await this.fetch(ho,{tags:[e]})).transactions;if(r.edges.length<1)throw new Error(`No interaction with tag ${_t.UPLOADER_TX_ID}:${t}`);return r.edges[0].node}async transactions(t){let e=(await this.fetch(Sr,t)).transactions,r=[...e.edges];for(;e.pageInfo.hasNextPage;){let i=e.edges[fo-1].cursor,a={...t,after:i};e=(await this.fetch(Sr,a)).transactions,r.push(...e.edges)}return r}async fetch(t,e){let r=It.measure(),i=await this.arweaveWrapper.gql(t,e);for(this.logger.debug("GQL page load:",r.elapsed());i.status===403;)this.logger.warn(`GQL rate limiting, waiting ${xr}ms before next try.`),await un(xr),i=await this.arweaveWrapper.gql(t,e);if(i.status!==200)throw new Error(`Unable to retrieve transactions. Arweave gateway responded with status ${i.status}.`);if(i.data.errors)throw this.logger.error(i.data.errors),new Error("Error while fetching arweave transactions");return i.data.data}},kr=100;function Ar(t){var e,r;return!((e=t.node.parent)!=null&&e.id)&&!((r=t.node.bundledIn)!=null&&r.id)}var go=class{constructor(t,e){j(this,"logger",xt.INST.create("ArweaveGatewayInteractionsLoader"));j(this,"sorter");j(this,"arweaveTransactionQuery");j(this,"_warp");j(this,"tagsParser",new ee);this.arweave=t,this.environment=e,this.sorter=new ar(t)}async load(t,e,r,i){this.logger.debug("Loading interactions for",{contractId:t,fromSortKey:e,toSortKey:r});let a=this.sorter.extractBlockHeight(e),c=this.sorter.extractBlockHeight(r),l={tags:[{name:At.APP_NAME,values:["SmartWeaveAction"]},{name:At.CONTRACT_TX_ID,values:[t]}],blockFilter:{min:a,max:c},first:kr},n=It.measure(),p=(await this.arweaveTransactionQuery.transactions(l)).filter(Ar);if(n.stop(),i.internalWrites){let b={tags:[{name:_t.INTERACT_WRITE,values:[t]}],blockFilter:{min:a,max:c},first:kr},U=(await this.arweaveTransactionQuery.transactions(b)).filter(Ar);this.logger.debug("Inner writes interactions length:",U.length),p=p.concat(U)}p=p.filter(b=>b.node.block&&b.node.block.id&&b.node.block.height);let S=new Map;for(let b of p)S.has(b.node.id)||S.set(b.node.id,b);let E=Array.from(S.values()),L=await this.sorter.sort(E);e&&r?L=L.filter(b=>b.node.sortKey.localeCompare(e)>0&&b.node.sortKey.localeCompare(r)<=0):e&&!r?L=L.filter(b=>b.node.sortKey.localeCompare(e)>0):!e&&r&&(L=L.filter(b=>b.node.sortKey.localeCompare(r)<=0)),this.logger.debug("All loaded interactions:",{from:e,to:r,loaded:L.length,time:n.elapsed()});let y=this.environment==="local"||this.environment==="testnet",k=this._warp.maybeLoadPlugin("vrf");return L.map(b=>{let U=b.node;return y&&this.tagsParser.hasVrfTag(U)&&(k?U.vrf=k.process().generateMockVrf(U.sortKey):this.logger.warn('Cannot generate mock vrf for interaction - no "warp-contracts-plugin-vrf" attached!')),U})}type(){return"arweave"}clearCache(){}set warp(t){this.arweaveTransactionQuery=new Ie(t),this._warp=t}};at();var Cr=class{constructor(t){j(this,"logger",xt.INST.create("CacheableInteractionsLoader"));j(this,"interactionsCache",new Map);this.delegate=t}async load(t,e,r,i){if(this.logger.debug("Loading interactions for",{contractTxId:t,fromSortKey:e,toSortKey:r}),this.interactionsCache.has(t)){let a=this.interactionsCache.get(t);if(a!=null&&a.length){let c=a[a.length-1].sortKey;if(c.localeCompare(r)<0){let l=await this.delegate.load(t,c,r,i),n=a.concat(l);return this.interactionsCache.set(t,n),n}}return a}else{let a=await this.delegate.load(t,e,r,i);return a.length&&this.interactionsCache.set(t,a),a}}type(){return this.delegate.type()}clearCache(){this.interactionsCache.clear()}set warp(t){this.delegate.warp=t}};at();var po=class{constructor(t,e=[]){j(this,"logger",xt.INST.create("DefaultStateEvaluator"));j(this,"tagsParser",new ee);this.arweave=t,this.executionContextModifiers=e}async eval(t){return this.doReadState(t.sortedInteractions,new Rt(t.contractDefinition.initState,{},{}),t)}async doReadState(t,e,r){var T;let{ignoreExceptions:i,stackTrace:a,internalWrites:c}=r.evaluationOptions,{contract:l,contractDefinition:n,sortedInteractions:p,warp:S}=r,E=e.state,L=null,y=e.validity,k=e.errorMessages;r==null||r.handler.initState(E);let b=r.contract.callDepth();this.logger.debug(`${zt(b)}Evaluating state for ${n.txId} [${t.length} non-cached of ${p.length} all]`);let U=null,C=null,K=t.length,z=S.maybeLoadPlugin("evm-signature-verification"),x=S.maybeLoadPlugin("evaluation-progress"),v=S.maybeLoadPlugin("vrf"),w=!1;for(let I=0;I0&&I%r.evaluationOptions.cacheEveryNInteractions===0;if(l.isRoot())l.clearChildren(),C&&(l.interactionState().update(l.txId(),C.state,C.tx.sortKey),y[P.id]?await l.interactionState().commit(P,G):await l.interactionState().rollback(P,G));else{let et=new Rt(E,y,k);l.interactionState().update(l.txId(),et,L)}}let u=new Rt(E,y,k);return C!==null&&await this.onStateEvaluated(C.tx,r,C.state),new Pt(L,u)}logResult(t,e,r){t.type==="exception"&&this.logger.error(`Executing of interaction: [${r.contractDefinition.txId} -> ${e.id}] threw exception:`,`${t.errorMessage}`),t.type==="error"&&this.logger.warn(`Executing of interaction: [${r.contractDefinition.txId} -> ${e.id}] returned error:`,t.errorMessage)}parseInput(t){try{return JSON.parse(t.value)}catch(e){return this.logger.error(e),null}}};function je(t){return t.confirmationStatus===void 0?!0:t.confirmationStatus==="confirmed"}at();var wo=class extends po{constructor(e,r,i=[]){super(e,i);j(this,"cLogger",xt.INST.create("CacheableStateEvaluator"));this.cache=r}async eval(e){var E,L,y,k;let{cachedState:r,contract:i}=e,a=e.sortedInteractions;if(r&&r.sortKey==e.requestedSortKey&&!(a!=null&&a.length))return this.cLogger.info(`Exact cache hit for sortKey ${(E=e==null?void 0:e.contractDefinition)==null?void 0:E.txId}:${r.sortKey}`),(L=e.handler)==null||L.initState(r.cachedValue.state),r;let c=e.contractDefinition.txId;if(!c)throw new Error("Contract tx id not set in the execution context");let l=r==null,n=l?e.contractDefinition.initState:r.cachedValue.state,p=l?{}:r.cachedValue.validity,S=l?{}:r.cachedValue.errorMessages;if(l&&(n=await e.handler.maybeCallStateConstructor(e.contractDefinition.initState,e),await i.interactionState().commitKV()),a.length==0)if(this.cLogger.info(`No missing interactions ${c}`),l){(y=e.handler)==null||y.initState(n),this.cLogger.debug("Inserting initial state into cache");let b=new Rt(n,{},{});return await this.cache.put(new Wt(c,Ge),b),new Pt(Ge,b)}else return(k=e.handler)==null||k.initState(r.cachedValue.state),r;return await this.doReadState(a,new Rt(n,p,S||{}),e)}async onStateEvaluated(e,r,i){let a=r.contractDefinition.txId;this.cLogger.debug(`${zt(r.contract.callDepth())}onStateEvaluated: cache update for contract ${a} [${e.sortKey}]`),await this.putInCache(a,e,i)}async onStateUpdate(e,r,i,a=!1){(r.evaluationOptions.updateCacheForEachInteraction||a)&&(this.cLogger.debug(`onStateUpdate: cache update for contract ${r.contractDefinition.txId} [${e.sortKey}]`,{contract:r.contractDefinition.txId,state:i.state,sortKey:e.sortKey}),await this.putInCache(r.contractDefinition.txId,e,i))}async latestAvailableState(e,r){if(this.cLogger.debug("Searching for",{contractTxId:e,sortKey:r}),r){let i=await this.cache.getLessOrEqual(e,r);return i&&this.cLogger.debug(`Latest available state at ${e}: ${i.sortKey}`),i}else return await this.cache.getLast(e)}async onInternalWriteStateUpdate(e,r,i){this.cLogger.debug("Internal write state update:",{sortKey:e.sortKey,dry:e.dry,contractTxId:r,state:i.state}),await this.putInCache(r,e,i)}async onContractCall(e,r,i){var c;if(((c=r.sortedInteractions)==null?void 0:c.length)==0)return;let a=r.sortedInteractions.indexOf(e);a<1||await this.putInCache(r.contractDefinition.txId,r.sortedInteractions[a-1],i)}async putInCache(e,r,i){if(r.dry||r.confirmationStatus!==void 0&&r.confirmationStatus!=="confirmed")return;let a=new Rt(i.state,i.validity,i.errorMessages||{});this.cLogger.debug("Putting into cache",{contractTxId:e,transaction:r.id,sortKey:r.sortKey,dry:r.dry}),await this.cache.put(new Wt(e,r.sortKey),a)}async syncState(e,r,i,a){let c=new Rt(i,a,{});return await this.cache.put(new Wt(e,r),c),new Pt(r,c)}async dumpCache(){return await this.cache.dump()}async internalWriteState(e,r){return await this.cache.get(new Wt(e,r))}async hasContractCached(e){return await this.cache.getLast(e)!=null}async lastCachedSortKey(){return await this.cache.getLastSortKey()}setCache(e){this.cache=e}getCache(){return this.cache}};at();var yo=Lt(te()),De=class{constructor(t,e,r=null){j(this,"interactions",{});j(this,"id");this.contractTxId=t,this.depth=e,this.innerCallType=r,this.id=yo.Crypto.randomUUID()}addInteractionData(t){let{interaction:e,interactionTx:r}=t,i=En.create(new mo(r.id,r.sortKey,r.block.height,r.block.timestamp,e==null?void 0:e.caller,e==null?void 0:e.input.function,e==null?void 0:e.input,r.dry,{}));return this.interactions[r.id]=i,i}getInteraction(t){return this.interactions[t]}print(){return JSON.stringify(this,null,2)}},En=class{constructor(t){j(this,"interactionOutput");this.interactionInput=t}static create(t){return new En(t)}update(t){this.interactionOutput=t}},mo=class{constructor(t,e,r,i,a,c,l,n,p={}){this.txId=t,this.sortKey=e,this.blockHeight=r,this.blockTimestamp=i,this.caller=a,this.functionName=c,this.functionArguments=l,this.dryWrite=n,this.foreignContractCalls=p}},Os=class{constructor(t,e,r,i,a="",c){this.cacheHit=t,this.outputState=e,this.executionTime=r,this.valid=i,this.errorMessage=a,this.gasUsed=c}};at();var Ke=Lt(er());at();at();var bo=(t=>(t.CONTRACT_NOT_FOUND="CONTRACT_NOT_FOUND",t))(bo||{}),vo=class extends Error{constructor(e,r={}){var t=(...args)=>{super(...args);j(this,"type");j(this,"otherInfo")};r.message?t(r.message):t(),this.type=e,this.otherInfo=r}getType(){return this.type}};function _o(t){if(!t)return!1;let e=Tn(t);return t.evolve!==void 0||e.has("evolve")}var Se=class{constructor(){j(this,"logger",xt.INST.create("Evolve"));this.modify=this.modify.bind(this)}async modify(t,e){let{definitionLoader:r,executorFactory:i}=e.warp,a=e.contractDefinition.txId,c=Se.evolvedSrcTxId(t),l=e.contractDefinition.srcTxId;if(c&&l!==c)try{this.logger.info("Evolving to: ",c);let n=await r.load(a,c),p=await i.create(n,e.evaluationOptions,e.warp,e.contract.interactionState());return e.contractDefinition=n,e.handler=p,e.handler.initState(t),this.logger.debug("evolved to:",{evolve:c,newSrcTxId:e.contractDefinition.srcTxId,currentSrcTxId:l,contract:e.contractDefinition.txId}),e}catch(n){throw n.name==="ContractError"&&n.subtype==="unsafeClientSkip"||n.name=="NonWhitelistedSourceError"?n:new vo("CONTRACT_NOT_FOUND",{message:`Error while evolving ${a} from ${l} to ${c}: ${n}`,requestedTxId:a})}return e}static evolvedSrcTxId(t){if(!_o(t))return;let e=Tn(t),r=t.evolve||e.get("evolve"),i=t.canEvolve||e.get("canEvolve");if(i==null&&(i=!0),r&&/[a-z0-9_-]{43}/i.test(r)&&i)return r}};function Tn(t){let e=new Map;return t.settings&&(Eo(t.settings)?e=new Map(t.settings):To(t.settings)&&(e=new Map(Object.entries(t.settings)))),e}function Eo(t){return t==null?!1:typeof t[Symbol.iterator]=="function"}function To(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}at();at();at();var Sn=Lt(Ci(),1);Sn.default.configure;var So=Sn.default;at();async function Ir(t,e,r,i,a,c="",l="0",n=!1,p,S){let E={data:Math.random().toString().slice(-4)};c&&c.length&&(E.target=c.toString(),l&&+l>0&&(E.quantity=l.toString())),n&&(E.reward="0",E.last_tx="p7vc1iSP6bvH_fCeUFa9LqoV5qiyW-jdEKouAT0XMoSwrNraB9mgpi29Q10waEpO"),S&&S.length&&(E.reward=S);let L=await t.createTransaction(E);return xn(r,i,p,a).forEach(y=>L.addTag(y.name,y.value)),e&&await e(L),L}function xo(t,e,r){let i=new ee().decodeTags(t);return{id:t.id,owner:{address:e,key:""},recipient:t.target,tags:i,fee:{winston:t.reward,ar:""},quantity:{winston:t.quantity,ar:""},block:{id:r.indep_hash,height:r.height,timestamp:r.timestamp,previous:null},dry:!0,anchor:null,signature:null,data:null,parent:null,bundledIn:null}}function xn(t,e,r,i){let a=[];if(i&&i.length)for(let c of i)a.push(new $t(c.name.toString(),c.value.toString()));return a.push(new $t(At.APP_NAME,"SmartWeaveAction")),a.push(new $t(At.APP_VERSION,"0.3.0")),a.push(new $t(At.SDK,"Warp")),a.push(new $t(At.CONTRACT_TX_ID,t)),a.push(new $t(At.INPUT,JSON.stringify(e))),r&&a.push(new $t(_t.WARP_TESTNET,"1.0.0")),a}at();var ne={target:"",winstonQty:"0"},Ls=["node1","node2","arweave"];at();var ko=class{eval(t){let e=[];return Object.keys(t.interactions).forEach(r=>{let i=t.interactions[r];this.evalForeignCalls(t.contractTxId,i,e)}),e}evalForeignCalls(t,e,r){Object.keys(e.interactionInput.foreignContractCalls).forEach(i=>{let a=e.interactionInput.foreignContractCalls[i];a.innerCallType=="write"&&Object.keys(a.interactions).forEach(c=>{let l=a.interactions[c];l.interactionInput.dryWrite&&!r.includes(a.contractTxId)&&t!==a.contractTxId&&r.push(a.contractTxId),this.evalForeignCalls(t,l,r)})})}};at();at();var Ao=Object.create,lr=Object.defineProperty,Co=Object.getOwnPropertyDescriptor,Io=Object.getOwnPropertyNames,Oo=Object.getPrototypeOf,Lo=Object.prototype.hasOwnProperty,qt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Bo=(t,e)=>{for(var r in e)lr(t,r,{get:e[r],enumerable:!0})},No=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Io(e))!Lo.call(t,a)&&a!==r&&lr(t,a,{get:()=>e[a],enumerable:!(i=Co(e,a))||i.enumerable});return t},re=(t,e,r)=>(r=t!=null?Ao(Oo(t)):{},No(e||!t||!t.__esModule?lr(r,"default",{value:t,enumerable:!0}):r,t)),Ro=qt(t=>{Object.defineProperty(t,"__esModule",{value:!0});function e(r){var i=4,a=r.length,c=a%i;if(!c)return r;var l=a,n=i-c,p=a+n,S=Ct.Buffer.alloc(p);for(S.write(r);n--;)S.write("=",l++);return S.toString()}t.default=e}),Uo=qt(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Ro();function r(p,S){return S===void 0&&(S="utf8"),Ct.Buffer.isBuffer(p)?c(p.toString("base64")):c(Ct.Buffer.from(p,S).toString("base64"))}function i(p,S){return S===void 0&&(S="utf8"),Ct.Buffer.from(a(p),"base64").toString(S)}function a(p){return p=p.toString(),e.default(p).replace(/\-/g,"+").replace(/_/g,"/")}function c(p){return p.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function l(p){return Ct.Buffer.from(a(p),"base64")}var n=r;n.encode=r,n.decode=i,n.toBase64=a,n.fromBase64=c,n.toBuffer=l,t.default=n}),cr=qt((t,e)=>{e.exports=Uo().default,e.exports.default=e.exports}),kn=qt(t=>{t.byteLength=p,t.toByteArray=E,t.fromByteArray=k;var e=[],r=[],i=typeof Uint8Array<"u"?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(c=0,l=a.length;c0)throw new Error("Invalid string. Length must be a multiple of 4");var C=b.indexOf("=");C===-1&&(C=U);var K=C===U?0:4-C%4;return[C,K]}function p(b){var U=n(b),C=U[0],K=U[1];return(C+K)*3/4-K}function S(b,U,C){return(U+C)*3/4-C}function E(b){var U,C=n(b),K=C[0],z=C[1],x=new i(S(b,K,z)),v=0,w=z>0?K-4:K,u;for(u=0;u>16&255,x[v++]=U>>8&255,x[v++]=U&255;return z===2&&(U=r[b.charCodeAt(u)]<<2|r[b.charCodeAt(u+1)]>>4,x[v++]=U&255),z===1&&(U=r[b.charCodeAt(u)]<<10|r[b.charCodeAt(u+1)]<<4|r[b.charCodeAt(u+2)]>>2,x[v++]=U>>8&255,x[v++]=U&255),x}function L(b){return e[b>>18&63]+e[b>>12&63]+e[b>>6&63]+e[b&63]}function y(b,U,C){for(var K,z=[],x=U;xw?w:v+x));return K===1?(U=b[C-1],z.push(e[U>>2]+e[U<<4&63]+"==")):K===2&&(U=(b[C-2]<<8)+b[C-1],z.push(e[U>>10]+e[U>>4&63]+e[U<<2&63]+"=")),z.join("")}}),An=qt(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var e=kn();function r(y){let k=0;for(let C=0;C{Object.defineProperty(t,"__esModule",{value:!0});var e=An(),r=class{constructor(){j(this,"keyLength",4096);j(this,"publicExponent",65537);j(this,"hashAlgorithm","sha256");j(this,"driver");if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let i=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),a=await this.driver.exportKey("jwk",i.privateKey);return{kty:a.kty,e:a.e,n:a.n,d:a.d,p:a.p,q:a.q,dp:a.dp,dq:a.dq,qi:a.qi}}async sign(i,a,{saltLength:c}={}){let l=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(i),a);return new Uint8Array(l)}async hash(i,a="SHA-256"){let c=await this.driver.digest(a,i);return new Uint8Array(c)}async verify(i,a,c){let l={kty:"RSA",e:"AQAB",n:i},n=await this.jwkToPublicCryptoKey(l),p=await this.driver.digest("SHA-256",a),S=await this.driver.verify({name:"RSA-PSS",saltLength:0},n,c,a),E=await this.driver.verify({name:"RSA-PSS",saltLength:32},n,c,a),L=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((n.algorithm.modulusLength-1)/8)-p.byteLength-2},n,c,a);return S||E||L}async jwkToCryptoKey(i){return this.driver.importKey("jwk",i,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(i){return this.driver.importKey("jwk",i,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let i=crypto==null?void 0:crypto.subtle;return i===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(a=>typeof i[a]=="function")}async encrypt(i,a,c){let l=await this.driver.importKey("raw",typeof a=="string"?e.stringToBuffer(a):a,{name:"PBKDF2",length:32},!1,["deriveKey"]),n=await this.driver.deriveKey({name:"PBKDF2",salt:c?e.stringToBuffer(c):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},l,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),p=new Uint8Array(16);crypto.getRandomValues(p);let S=await this.driver.encrypt({name:"AES-CBC",iv:p},n,i);return e.concatBuffers([p,S])}async decrypt(i,a,c){let l=await this.driver.importKey("raw",typeof a=="string"?e.stringToBuffer(a):a,{name:"PBKDF2",length:32},!1,["deriveKey"]),n=await this.driver.deriveKey({name:"PBKDF2",salt:c?e.stringToBuffer(c):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},l,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),p=i.slice(0,16),S=await this.driver.decrypt({name:"AES-CBC",iv:p},n,i.slice(16));return e.concatBuffers([S])}};t.default=r}),Po=qt(t=>{t.read=function(e,r,i,a,c){var l,n,p=c*8-a-1,S=(1<>1,L=-7,y=i?c-1:0,k=i?-1:1,b=e[r+y];for(y+=k,l=b&(1<<-L)-1,b>>=-L,L+=p;L>0;l=l*256+e[r+y],y+=k,L-=8);for(n=l&(1<<-L)-1,l>>=-L,L+=a;L>0;n=n*256+e[r+y],y+=k,L-=8);if(l===0)l=1-E;else{if(l===S)return n?NaN:(b?-1:1)*(1/0);n=n+Math.pow(2,a),l=l-E}return(b?-1:1)*n*Math.pow(2,l-a)},t.write=function(e,r,i,a,c,l){var n,p,S,E=l*8-c-1,L=(1<>1,k=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=a?0:l-1,U=a?1:-1,C=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(p=isNaN(r)?1:0,n=L):(n=Math.floor(Math.log(r)/Math.LN2),r*(S=Math.pow(2,-n))<1&&(n--,S*=2),n+y>=1?r+=k/S:r+=k*Math.pow(2,1-y),r*S>=2&&(n++,S/=2),n+y>=L?(p=0,n=L):n+y>=1?(p=(r*S-1)*Math.pow(2,c),n=n+y):(p=r*Math.pow(2,y-1)*Math.pow(2,c),n=0));c>=8;e[i+b]=p&255,b+=U,p/=256,c-=8);for(n=n<0;e[i+b]=n&255,b+=U,n/=256,E-=8);e[i+b-U]|=C*128}}),He=qt(t=>{var e=kn(),r=Po(),i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=n,t.SlowBuffer=z,t.INSPECT_MAX_BYTES=50;var a=2147483647;t.kMaxLength=a,n.TYPED_ARRAY_SUPPORT=c(),!n.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 c(){try{let o=new Uint8Array(1),g={foo:function(){return 42}};return Object.setPrototypeOf(g,Uint8Array.prototype),Object.setPrototypeOf(o,g),o.foo()===42}catch{return!1}}Object.defineProperty(n.prototype,"parent",{enumerable:!0,get:function(){if(n.isBuffer(this))return this.buffer}}),Object.defineProperty(n.prototype,"offset",{enumerable:!0,get:function(){if(n.isBuffer(this))return this.byteOffset}});function l(o){if(o>a)throw new RangeError('The value "'+o+'" is invalid for option "size"');let g=new Uint8Array(o);return Object.setPrototypeOf(g,n.prototype),g}function n(o,g,m){if(typeof o=="number"){if(typeof g=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return L(o)}return p(o,g,m)}n.poolSize=8192;function p(o,g,m){if(typeof o=="string")return y(o,g);if(ArrayBuffer.isView(o))return b(o);if(o==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof o);if(_(o,ArrayBuffer)||o&&_(o.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(_(o,SharedArrayBuffer)||o&&_(o.buffer,SharedArrayBuffer)))return U(o,g,m);if(typeof o=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let V=o.valueOf&&o.valueOf();if(V!=null&&V!==o)return n.from(V,g,m);let Q=C(o);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof o[Symbol.toPrimitive]=="function")return n.from(o[Symbol.toPrimitive]("string"),g,m);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof o)}n.from=function(o,g,m){return p(o,g,m)},Object.setPrototypeOf(n.prototype,Uint8Array.prototype),Object.setPrototypeOf(n,Uint8Array);function S(o){if(typeof o!="number")throw new TypeError('"size" argument must be of type number');if(o<0)throw new RangeError('The value "'+o+'" is invalid for option "size"')}function E(o,g,m){return S(o),o<=0?l(o):g!==void 0?typeof m=="string"?l(o).fill(g,m):l(o).fill(g):l(o)}n.alloc=function(o,g,m){return E(o,g,m)};function L(o){return S(o),l(o<0?0:K(o)|0)}n.allocUnsafe=function(o){return L(o)},n.allocUnsafeSlow=function(o){return L(o)};function y(o,g){if((typeof g!="string"||g==="")&&(g="utf8"),!n.isEncoding(g))throw new TypeError("Unknown encoding: "+g);let m=x(o,g)|0,V=l(m),Q=V.write(o,g);return Q!==m&&(V=V.slice(0,Q)),V}function k(o){let g=o.length<0?0:K(o.length)|0,m=l(g);for(let V=0;V=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return o|0}function z(o){return+o!=o&&(o=0),n.alloc(+o)}n.isBuffer=function(o){return o!=null&&o._isBuffer===!0&&o!==n.prototype},n.compare=function(o,g){if(_(o,Uint8Array)&&(o=n.from(o,o.offset,o.byteLength)),_(g,Uint8Array)&&(g=n.from(g,g.offset,g.byteLength)),!n.isBuffer(o)||!n.isBuffer(g))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(o===g)return 0;let m=o.length,V=g.length;for(let Q=0,it=Math.min(m,V);QV.length?(n.isBuffer(it)||(it=n.from(it)),it.copy(V,Q)):Uint8Array.prototype.set.call(V,it,Q);else if(n.isBuffer(it))it.copy(V,Q);else throw new TypeError('"list" argument must be an Array of Buffers');Q+=it.length}return V};function x(o,g){if(n.isBuffer(o))return o.length;if(ArrayBuffer.isView(o)||_(o,ArrayBuffer))return o.byteLength;if(typeof o!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof o);let m=o.length,V=arguments.length>2&&arguments[2]===!0;if(!V&&m===0)return 0;let Q=!1;for(;;)switch(g){case"ascii":case"latin1":case"binary":return m;case"utf8":case"utf-8":return h(o).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m*2;case"hex":return m>>>1;case"base64":return R(o).length;default:if(Q)return V?-1:h(o).length;g=(""+g).toLowerCase(),Q=!0}}n.byteLength=x;function v(o,g,m){let V=!1;if((g===void 0||g<0)&&(g=0),g>this.length||((m===void 0||m>this.length)&&(m=this.length),m<=0)||(m>>>=0,g>>>=0,m<=g))return"";for(o||(o="utf8");;)switch(o){case"hex":return W(this,g,m);case"utf8":case"utf-8":return tt(this,g,m);case"ascii":return B(this,g,m);case"latin1":case"binary":return O(this,g,m);case"base64":return J(this,g,m);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,g,m);default:if(V)throw new TypeError("Unknown encoding: "+o);o=(o+"").toLowerCase(),V=!0}}n.prototype._isBuffer=!0;function w(o,g,m){let V=o[g];o[g]=o[m],o[m]=V}n.prototype.swap16=function(){let o=this.length;if(o%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let g=0;gg&&(o+=" ... "),""},i&&(n.prototype[i]=n.prototype.inspect),n.prototype.compare=function(o,g,m,V,Q){if(_(o,Uint8Array)&&(o=n.from(o,o.offset,o.byteLength)),!n.isBuffer(o))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof o);if(g===void 0&&(g=0),m===void 0&&(m=o?o.length:0),V===void 0&&(V=0),Q===void 0&&(Q=this.length),g<0||m>o.length||V<0||Q>this.length)throw new RangeError("out of range index");if(V>=Q&&g>=m)return 0;if(V>=Q)return-1;if(g>=m)return 1;if(g>>>=0,m>>>=0,V>>>=0,Q>>>=0,this===o)return 0;let it=Q-V,ct=m-g,Et=Math.min(it,ct),kt=this.slice(V,Q),Tt=o.slice(g,m);for(let vt=0;vt2147483647?m=2147483647:m<-2147483648&&(m=-2147483648),m=+m,D(m)&&(m=Q?0:o.length-1),m<0&&(m=o.length+m),m>=o.length){if(Q)return-1;m=o.length-1}else if(m<0)if(Q)m=0;else return-1;if(typeof g=="string"&&(g=n.from(g,V)),n.isBuffer(g))return g.length===0?-1:T(o,g,m,V,Q);if(typeof g=="number")return g=g&255,typeof Uint8Array.prototype.indexOf=="function"?Q?Uint8Array.prototype.indexOf.call(o,g,m):Uint8Array.prototype.lastIndexOf.call(o,g,m):T(o,[g],m,V,Q);throw new TypeError("val must be string, number or Buffer")}function T(o,g,m,V,Q){let it=1,ct=o.length,Et=g.length;if(V!==void 0&&(V=String(V).toLowerCase(),V==="ucs2"||V==="ucs-2"||V==="utf16le"||V==="utf-16le")){if(o.length<2||g.length<2)return-1;it=2,ct/=2,Et/=2,m/=2}function kt(vt,bt){return it===1?vt[bt]:vt.readUInt16BE(bt*it)}let Tt;if(Q){let vt=-1;for(Tt=m;Ttct&&(m=ct-Et),Tt=m;Tt>=0;Tt--){let vt=!0;for(let bt=0;btQ&&(V=Q)):V=Q;let it=g.length;V>it/2&&(V=it/2);let ct;for(ct=0;ct>>0,isFinite(m)?(m=m>>>0,V===void 0&&(V="utf8")):(V=m,m=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let Q=this.length-g;if((m===void 0||m>Q)&&(m=Q),o.length>0&&(m<0||g<0)||g>this.length)throw new RangeError("Attempt to write outside buffer bounds");V||(V="utf8");let it=!1;for(;;)switch(V){case"hex":return I(this,o,g,m);case"utf8":case"utf-8":return P(this,o,g,m);case"ascii":case"latin1":case"binary":return q(this,o,g,m);case"base64":return G(this,o,g,m);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return et(this,o,g,m);default:if(it)throw new TypeError("Unknown encoding: "+V);V=(""+V).toLowerCase(),it=!0}},n.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function J(o,g,m){return g===0&&m===o.length?e.fromByteArray(o):e.fromByteArray(o.slice(g,m))}function tt(o,g,m){m=Math.min(o.length,m);let V=[],Q=g;for(;Q239?4:it>223?3:it>191?2:1;if(Q+Et<=m){let kt,Tt,vt,bt;switch(Et){case 1:it<128&&(ct=it);break;case 2:kt=o[Q+1],(kt&192)===128&&(bt=(it&31)<<6|kt&63,bt>127&&(ct=bt));break;case 3:kt=o[Q+1],Tt=o[Q+2],(kt&192)===128&&(Tt&192)===128&&(bt=(it&15)<<12|(kt&63)<<6|Tt&63,bt>2047&&(bt<55296||bt>57343)&&(ct=bt));break;case 4:kt=o[Q+1],Tt=o[Q+2],vt=o[Q+3],(kt&192)===128&&(Tt&192)===128&&(vt&192)===128&&(bt=(it&15)<<18|(kt&63)<<12|(Tt&63)<<6|vt&63,bt>65535&&bt<1114112&&(ct=bt))}}ct===null?(ct=65533,Et=1):ct>65535&&(ct-=65536,V.push(ct>>>10&1023|55296),ct=56320|ct&1023),V.push(ct),Q+=Et}return nt(V)}var st=4096;function nt(o){let g=o.length;if(g<=st)return String.fromCharCode.apply(String,o);let m="",V=0;for(;VV)&&(m=V);let Q="";for(let it=g;itm&&(o=m),g<0?(g+=m,g<0&&(g=0)):g>m&&(g=m),gm)throw new RangeError("Trying to access beyond buffer length")}n.prototype.readUintLE=n.prototype.readUIntLE=function(o,g,m){o=o>>>0,g=g>>>0,m||Z(o,g,this.length);let V=this[o],Q=1,it=0;for(;++it>>0,g=g>>>0,m||Z(o,g,this.length);let V=this[o+--g],Q=1;for(;g>0&&(Q*=256);)V+=this[o+--g]*Q;return V},n.prototype.readUint8=n.prototype.readUInt8=function(o,g){return o=o>>>0,g||Z(o,1,this.length),this[o]},n.prototype.readUint16LE=n.prototype.readUInt16LE=function(o,g){return o=o>>>0,g||Z(o,2,this.length),this[o]|this[o+1]<<8},n.prototype.readUint16BE=n.prototype.readUInt16BE=function(o,g){return o=o>>>0,g||Z(o,2,this.length),this[o]<<8|this[o+1]},n.prototype.readUint32LE=n.prototype.readUInt32LE=function(o,g){return o=o>>>0,g||Z(o,4,this.length),(this[o]|this[o+1]<<8|this[o+2]<<16)+this[o+3]*16777216},n.prototype.readUint32BE=n.prototype.readUInt32BE=function(o,g){return o=o>>>0,g||Z(o,4,this.length),this[o]*16777216+(this[o+1]<<16|this[o+2]<<8|this[o+3])},n.prototype.readBigUInt64LE=lt(function(o){o=o>>>0,M(o,"offset");let g=this[o],m=this[o+7];(g===void 0||m===void 0)&&X(o,this.length-8);let V=g+this[++o]*2**8+this[++o]*2**16+this[++o]*2**24,Q=this[++o]+this[++o]*2**8+this[++o]*2**16+m*2**24;return BigInt(V)+(BigInt(Q)<>>0,M(o,"offset");let g=this[o],m=this[o+7];(g===void 0||m===void 0)&&X(o,this.length-8);let V=g*2**24+this[++o]*2**16+this[++o]*2**8+this[++o],Q=this[++o]*2**24+this[++o]*2**16+this[++o]*2**8+m;return(BigInt(V)<>>0,g=g>>>0,m||Z(o,g,this.length);let V=this[o],Q=1,it=0;for(;++it=Q&&(V-=Math.pow(2,8*g)),V},n.prototype.readIntBE=function(o,g,m){o=o>>>0,g=g>>>0,m||Z(o,g,this.length);let V=g,Q=1,it=this[o+--V];for(;V>0&&(Q*=256);)it+=this[o+--V]*Q;return Q*=128,it>=Q&&(it-=Math.pow(2,8*g)),it},n.prototype.readInt8=function(o,g){return o=o>>>0,g||Z(o,1,this.length),this[o]&128?(255-this[o]+1)*-1:this[o]},n.prototype.readInt16LE=function(o,g){o=o>>>0,g||Z(o,2,this.length);let m=this[o]|this[o+1]<<8;return m&32768?m|4294901760:m},n.prototype.readInt16BE=function(o,g){o=o>>>0,g||Z(o,2,this.length);let m=this[o+1]|this[o]<<8;return m&32768?m|4294901760:m},n.prototype.readInt32LE=function(o,g){return o=o>>>0,g||Z(o,4,this.length),this[o]|this[o+1]<<8|this[o+2]<<16|this[o+3]<<24},n.prototype.readInt32BE=function(o,g){return o=o>>>0,g||Z(o,4,this.length),this[o]<<24|this[o+1]<<16|this[o+2]<<8|this[o+3]},n.prototype.readBigInt64LE=lt(function(o){o=o>>>0,M(o,"offset");let g=this[o],m=this[o+7];(g===void 0||m===void 0)&&X(o,this.length-8);let V=this[o+4]+this[o+5]*2**8+this[o+6]*2**16+(m<<24);return(BigInt(V)<>>0,M(o,"offset");let g=this[o],m=this[o+7];(g===void 0||m===void 0)&&X(o,this.length-8);let V=(g<<24)+this[++o]*2**16+this[++o]*2**8+this[++o];return(BigInt(V)<>>0,g||Z(o,4,this.length),r.read(this,o,!0,23,4)},n.prototype.readFloatBE=function(o,g){return o=o>>>0,g||Z(o,4,this.length),r.read(this,o,!1,23,4)},n.prototype.readDoubleLE=function(o,g){return o=o>>>0,g||Z(o,8,this.length),r.read(this,o,!0,52,8)},n.prototype.readDoubleBE=function(o,g){return o=o>>>0,g||Z(o,8,this.length),r.read(this,o,!1,52,8)};function ot(o,g,m,V,Q,it){if(!n.isBuffer(o))throw new TypeError('"buffer" argument must be a Buffer instance');if(g>Q||go.length)throw new RangeError("Index out of range")}n.prototype.writeUintLE=n.prototype.writeUIntLE=function(o,g,m,V){if(o=+o,g=g>>>0,m=m>>>0,!V){let ct=Math.pow(2,8*m)-1;ot(this,o,g,m,ct,0)}let Q=1,it=0;for(this[g]=o&255;++it>>0,m=m>>>0,!V){let ct=Math.pow(2,8*m)-1;ot(this,o,g,m,ct,0)}let Q=m-1,it=1;for(this[g+Q]=o&255;--Q>=0&&(it*=256);)this[g+Q]=o/it&255;return g+m},n.prototype.writeUint8=n.prototype.writeUInt8=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,1,255,0),this[g]=o&255,g+1},n.prototype.writeUint16LE=n.prototype.writeUInt16LE=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,2,65535,0),this[g]=o&255,this[g+1]=o>>>8,g+2},n.prototype.writeUint16BE=n.prototype.writeUInt16BE=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,2,65535,0),this[g]=o>>>8,this[g+1]=o&255,g+2},n.prototype.writeUint32LE=n.prototype.writeUInt32LE=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,4,4294967295,0),this[g+3]=o>>>24,this[g+2]=o>>>16,this[g+1]=o>>>8,this[g]=o&255,g+4},n.prototype.writeUint32BE=n.prototype.writeUInt32BE=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,4,4294967295,0),this[g]=o>>>24,this[g+1]=o>>>16,this[g+2]=o>>>8,this[g+3]=o&255,g+4};function ut(o,g,m,V,Q){$(g,V,Q,o,m,7);let it=Number(g&BigInt(4294967295));o[m++]=it,it=it>>8,o[m++]=it,it=it>>8,o[m++]=it,it=it>>8,o[m++]=it;let ct=Number(g>>BigInt(32)&BigInt(4294967295));return o[m++]=ct,ct=ct>>8,o[m++]=ct,ct=ct>>8,o[m++]=ct,ct=ct>>8,o[m++]=ct,m}function gt(o,g,m,V,Q){$(g,V,Q,o,m,7);let it=Number(g&BigInt(4294967295));o[m+7]=it,it=it>>8,o[m+6]=it,it=it>>8,o[m+5]=it,it=it>>8,o[m+4]=it;let ct=Number(g>>BigInt(32)&BigInt(4294967295));return o[m+3]=ct,ct=ct>>8,o[m+2]=ct,ct=ct>>8,o[m+1]=ct,ct=ct>>8,o[m]=ct,m+8}n.prototype.writeBigUInt64LE=lt(function(o,g=0){return ut(this,o,g,BigInt(0),BigInt("0xffffffffffffffff"))}),n.prototype.writeBigUInt64BE=lt(function(o,g=0){return gt(this,o,g,BigInt(0),BigInt("0xffffffffffffffff"))}),n.prototype.writeIntLE=function(o,g,m,V){if(o=+o,g=g>>>0,!V){let Et=Math.pow(2,8*m-1);ot(this,o,g,m,Et-1,-Et)}let Q=0,it=1,ct=0;for(this[g]=o&255;++Q>0)-ct&255;return g+m},n.prototype.writeIntBE=function(o,g,m,V){if(o=+o,g=g>>>0,!V){let Et=Math.pow(2,8*m-1);ot(this,o,g,m,Et-1,-Et)}let Q=m-1,it=1,ct=0;for(this[g+Q]=o&255;--Q>=0&&(it*=256);)o<0&&ct===0&&this[g+Q+1]!==0&&(ct=1),this[g+Q]=(o/it>>0)-ct&255;return g+m},n.prototype.writeInt8=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,1,127,-128),o<0&&(o=255+o+1),this[g]=o&255,g+1},n.prototype.writeInt16LE=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,2,32767,-32768),this[g]=o&255,this[g+1]=o>>>8,g+2},n.prototype.writeInt16BE=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,2,32767,-32768),this[g]=o>>>8,this[g+1]=o&255,g+2},n.prototype.writeInt32LE=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,4,2147483647,-2147483648),this[g]=o&255,this[g+1]=o>>>8,this[g+2]=o>>>16,this[g+3]=o>>>24,g+4},n.prototype.writeInt32BE=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,4,2147483647,-2147483648),o<0&&(o=4294967295+o+1),this[g]=o>>>24,this[g+1]=o>>>16,this[g+2]=o>>>8,this[g+3]=o&255,g+4},n.prototype.writeBigInt64LE=lt(function(o,g=0){return ut(this,o,g,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),n.prototype.writeBigInt64BE=lt(function(o,g=0){return gt(this,o,g,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function rt(o,g,m,V,Q,it){if(m+V>o.length)throw new RangeError("Index out of range");if(m<0)throw new RangeError("Index out of range")}function ht(o,g,m,V,Q){return g=+g,m=m>>>0,Q||rt(o,g,m,4),r.write(o,g,m,V,23,4),m+4}n.prototype.writeFloatLE=function(o,g,m){return ht(this,o,g,!0,m)},n.prototype.writeFloatBE=function(o,g,m){return ht(this,o,g,!1,m)};function mt(o,g,m,V,Q){return g=+g,m=m>>>0,Q||rt(o,g,m,8),r.write(o,g,m,V,52,8),m+8}n.prototype.writeDoubleLE=function(o,g,m){return mt(this,o,g,!0,m)},n.prototype.writeDoubleBE=function(o,g,m){return mt(this,o,g,!1,m)},n.prototype.copy=function(o,g,m,V){if(!n.isBuffer(o))throw new TypeError("argument should be a Buffer");if(m||(m=0),!V&&V!==0&&(V=this.length),g>=o.length&&(g=o.length),g||(g=0),V>0&&V=this.length)throw new RangeError("Index out of range");if(V<0)throw new RangeError("sourceEnd out of bounds");V>this.length&&(V=this.length),o.length-g>>0,m=m===void 0?this.length:m>>>0,o||(o=0);let Q;if(typeof o=="number")for(Q=g;Q2**32?Q=St(String(m)):typeof m=="bigint"&&(Q=String(m),(m>BigInt(2)**BigInt(32)||m<-(BigInt(2)**BigInt(32)))&&(Q=St(Q)),Q+="n"),V+=` It must be ${g}. Received ${Q}`,V},RangeError);function St(o){let g="",m=o.length,V=o[0]==="-"?1:0;for(;m>=V+4;m-=3)g=`_${o.slice(m-3,m)}${g}`;return`${o.slice(0,m)}${g}`}function N(o,g,m){M(g,"offset"),(o[g]===void 0||o[g+m]===void 0)&&X(g,o.length-(m+1))}function $(o,g,m,V,Q,it){if(o>m||o3?g===0||g===BigInt(0)?Et=`>= 0${ct} and < 2${ct} ** ${(it+1)*8}${ct}`:Et=`>= -(2${ct} ** ${(it+1)*8-1}${ct}) and < 2 ** ${(it+1)*8-1}${ct}`:Et=`>= ${g}${ct} and <= ${m}${ct}`,new dt.ERR_OUT_OF_RANGE("value",Et,o)}N(V,Q,it)}function M(o,g){if(typeof o!="number")throw new dt.ERR_INVALID_ARG_TYPE(g,"number",o)}function X(o,g,m){throw Math.floor(o)!==o?(M(o,m),new dt.ERR_OUT_OF_RANGE(m||"offset","an integer",o)):g<0?new dt.ERR_BUFFER_OUT_OF_BOUNDS:new dt.ERR_OUT_OF_RANGE(m||"offset",`>= ${m?1:0} and <= ${g}`,o)}var H=/[^+/0-9A-Za-z-_]/g;function s(o){if(o=o.split("=")[0],o=o.trim().replace(H,""),o.length<2)return"";for(;o.length%4!==0;)o=o+"=";return o}function h(o,g){g=g||1/0;let m,V=o.length,Q=null,it=[];for(let ct=0;ct55295&&m<57344){if(!Q){if(m>56319){(g-=3)>-1&&it.push(239,191,189);continue}else if(ct+1===V){(g-=3)>-1&&it.push(239,191,189);continue}Q=m;continue}if(m<56320){(g-=3)>-1&&it.push(239,191,189),Q=m;continue}m=(Q-55296<<10|m-56320)+65536}else Q&&(g-=3)>-1&&it.push(239,191,189);if(Q=null,m<128){if((g-=1)<0)break;it.push(m)}else if(m<2048){if((g-=2)<0)break;it.push(m>>6|192,m&63|128)}else if(m<65536){if((g-=3)<0)break;it.push(m>>12|224,m>>6&63|128,m&63|128)}else if(m<1114112){if((g-=4)<0)break;it.push(m>>18|240,m>>12&63|128,m>>6&63|128,m&63|128)}else throw new Error("Invalid code point")}return it}function d(o){let g=[];for(let m=0;m>8,Q=m%256,it.push(Q),it.push(V);return it}function R(o){return e.toByteArray(s(o))}function f(o,g,m,V){let Q;for(Q=0;Q=g.length||Q>=o.length);++Q)g[Q+m]=o[Q];return Q}function _(o,g){return o instanceof g||o!=null&&o.constructor!=null&&o.constructor.name!=null&&o.constructor.name===g.name}function D(o){return o!==o}var Y=function(){let o="0123456789abcdef",g=new Array(256);for(let m=0;m<16;++m){let V=m*16;for(let Q=0;Q<16;++Q)g[V+Q]=o[m]+o[Q]}return g}();function lt(o){return typeof BigInt>"u"?ft:o}function ft(){throw new Error("BigInt not supported")}}),Mo=qt((t,e)=>{typeof window<"u"?(window.global=window,Yt.fetch=window.fetch,e.exports={Buffer:He().Buffer,Crypto:window.crypto}):e.exports={Buffer:He().Buffer,Crypto:crypto}}),Cn={};Bo(Cn,{AVSCTap:()=>Oe,ArweaveSigner:()=>ur,DataItem:()=>xe,MAX_TAG_BYTES:()=>hr,MIN_BINARY_SIZE:()=>Rn,SIG_CONFIG:()=>me,SignatureConfig:()=>Ut,Signer:()=>jo,createData:()=>Un,deserializeTags:()=>Je,indexToType:()=>Ln,serializeTags:()=>Bn,tagsExceedLimit:()=>Nn});var jo=class{constructor(){j(this,"signer");j(this,"publicKey");j(this,"signatureType");j(this,"signatureLength");j(this,"ownerLength");j(this,"pem")}static verify(t,e,r,i){throw new Error("You must implement verify method on child")}},Do=re(cr(),1),Mt=re(An(),1);async function In(t){if(Array.isArray(t)){let a=(0,Mt.concatBuffers)([(0,Mt.stringToBuffer)("list"),(0,Mt.stringToBuffer)(t.length.toString())]);return await On(t,await Vt().hash(a,"SHA-384"))}let e=t,r=(0,Mt.concatBuffers)([(0,Mt.stringToBuffer)("blob"),(0,Mt.stringToBuffer)(e.byteLength.toString())]),i=(0,Mt.concatBuffers)([await Vt().hash(r,"SHA-384"),await Vt().hash(e,"SHA-384")]);return await Vt().hash(i,"SHA-384")}async function On(t,e){if(t.length<1)return e;let r=(0,Mt.concatBuffers)([e,await In(t[0])]),i=await Vt().hash(r,"SHA-384");return await On(t.slice(1),i)}var We=re($o(),1),Ko=We.default.default?We.default.default:We.default,Wo=class extends Ko{getPublicKey(t){throw new Error("Unimplemented")}},Fo;function Vt(){return Fo??(Fo=new Wo)}var Ut;(function(t){t[t.ARWEAVE=1]="ARWEAVE",t[t.ED25519=2]="ED25519",t[t.ETHEREUM=3]="ETHEREUM",t[t.SOLANA=4]="SOLANA",t[t.INJECTEDAPTOS=5]="INJECTEDAPTOS",t[t.MULTIAPTOS=6]="MULTIAPTOS",t[t.TYPEDETHEREUM=7]="TYPEDETHEREUM"})(Ut||(Ut={}));var me={[Ut.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[Ut.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[Ut.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[Ut.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[Ut.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[Ut.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[Ut.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},ur=class{constructor(t){j(this,"signatureType",1);j(this,"ownerLength",me[1].pubLength);j(this,"signatureLength",me[1].sigLength);j(this,"jwk");j(this,"pk");this.pk=t.n,this.jwk=t}get publicKey(){return Do.default.toBuffer(this.pk)}sign(t){return Vt().sign(this.jwk,t)}static async verify(t,e,r){return await Vt().verify(t,e,r)}},Ln={1:ur},Dt=re(cr(),1);async function ze(t){return In([(0,Mt.stringToBuffer)("dataitem"),(0,Mt.stringToBuffer)("1"),(0,Mt.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}async function Vo(t,e){let r=await ze(t),i=await e.sign(r),a=await Vt().hash(i);return{signature:Ct.Buffer.from(i),id:Ct.Buffer.from(a)}}async function Go(t,e){let{signature:r,id:i}=await Vo(t,e);return t.getRaw().set(r,2),i}var Oe=class{constructor(t=Ct.Buffer.alloc(hr),e=0){j(this,"buf");j(this,"pos");this.buf=t,this.pos=e}writeTags(t){if(!Array.isArray(t))throw new Error("input must be array");let e=t.length,r;if(e)for(this.writeLong(e),r=0;rthis.buf.length)throw new Error(`Too many tag bytes (${this.pos} > ${this.buf.length})`);return this.buf.copy(t,0,0,this.pos),t}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(t){let e=this.buf,r,i;if(t>=-1073741824&&t<1073741824){i=t>=0?t<<1:~t<<1|1;do e[this.pos]=i&127,i>>=7;while(i&&(e[this.pos++]|=128))}else{r=t>=0?t*2:-t*2-1;do e[this.pos]=r&127,r/=128;while(r>=1&&(e[this.pos++]|=128))}this.pos++,this.buf=e}writeString(t){let e=Ct.Buffer.byteLength(t),r=this.buf;this.writeLong(e);let i=this.pos;if(this.pos+=e,!(this.pos>r.length)){if(e>64)this.buf.write(t,this.pos-e,e,"utf8");else{let a,c,l,n;for(a=0,c=e;a>6|192,r[i++]=l&63|128):(l&64512)===55296&&((n=t.charCodeAt(a+1))&64512)===56320?(l=65536+((l&1023)<<10)+(n&1023),a++,r[i++]=l>>18|240,r[i++]=l>>12&63|128,r[i++]=l>>6&63|128,r[i++]=l&63|128):(r[i++]=l>>12|224,r[i++]=l>>6&63|128,r[i++]=l&63|128)}this.buf=r}}readLong(){let t=0,e=0,r=this.buf,i,a,c,l;do i=r[this.pos++],a=i&128,t|=(i&127)<>1^-(t&1)}skipLong(){let t=this.buf;for(;t[this.pos++]&128;);}readTags(){let t=[],e;for(;e=this.readLong();)for(e<0&&(e=-e,this.skipLong());e--;){let r=this.readString(),i=this.readString();t.push({name:r,value:i})}return t}readString(){let t=this.readLong(),e=this.pos,r=this.buf;if(this.pos+=t,!(this.pos>r.length))return this.buf.slice(e,e+t).toString()}};function Bn(t){let e=new Oe;return e.writeTags(t),e.toBuffer()}function Nn(t){let e=new Oe;return e.writeTags(t),e.tagsExceedLimit()}function Je(t){return new Oe(t).readTags()}function Ht(t){let e=0;for(let r=t.length-1;r>=0;r--)e=e*256+t[r];return e}function qo(t){if(t>29)throw new Error("Short too long");let e=[0,0];for(let r=0;rDt.default.encode(await this.rawId))()}set id(t){this._id=Dt.default.toBuffer(t)}get rawId(){return(async()=>ie.Buffer.from(await Ho.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(t){this._id=t}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return Dt.default.encode(this.rawSignature)}set rawOwner(t){if(t.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${t.byteLength} bytes.`);this.binary.set(t,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return me[this.signatureType].sigLength}get owner(){return Dt.default.encode(this.rawOwner)}get ownerLength(){return me[this.signatureType].pubLength}get rawTarget(){let t=this.getTargetStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):ie.Buffer.alloc(0)}get target(){return Dt.default.encode(this.rawTarget)}get rawAnchor(){let t=this.getAnchorStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):ie.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let t=this.getTagsStart(),e=Ht(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){let t=this.getTagsStart();if(Ht(this.binary.subarray(t,t+8))==0)return[];let e=Ht(this.binary.subarray(t+8,t+16));return Je(ie.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map(t=>({name:Dt.default.encode(t.name),value:Dt.default.encode(t.value)}))}getStartOfData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=Ht(e);return t+16+r}get rawData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=Ht(e),i=t+16+r;return this.binary.subarray(i,this.binary.length)}get data(){return Dt.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await Go(this,t),this.rawId}async setSignature(t){this.binary.set(t,2),this._id=ie.Buffer.from(await Vt().hash(t))}isSigned(){var t;return(((t=this._id)==null?void 0:t.length)??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(t=>({name:Dt.default.encode(t.name),value:Dt.default.encode(t.value)})),data:this.data}}static async verify(t){if(t.byteLengthhr)return!1;if(a>0)try{if(Je(ie.Buffer.from(t.subarray(i+16,i+16+l))).length!==a)return!1}catch{return!1}let n=Ln[r],p=await ze(e);return await n.verify(e.rawOwner,p,e.rawSignature)}async getSignatureData(){return ze(this)}getTagsStart(){let t=this.getTargetStart(),e=this.binary[t]==1,r=t+(e?33:1),i=this.binary[r]==1;return r+=i?33:1,r}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let t=this.getTargetStart()+1,e=this.binary[this.getTargetStart()]==1;return t+=e?32:0,t}},zo=re(cr(),1);function Un(t,e,r){var x,v;let i=e.publicKey,a=r!=null&&r.target?zo.default.toBuffer(r.target):null,c=1+((a==null?void 0:a.byteLength)??0),l=r!=null&&r.anchor?Ct.Buffer.from(r.anchor):null,n=1+((l==null?void 0:l.byteLength)??0),p=(((x=r==null?void 0:r.tags)==null?void 0:x.length)??0)>0?Bn(r.tags):null,S=16+(p?p.byteLength:0),E=Ct.Buffer.from(t),L=E.byteLength,y=2+e.signatureLength+e.ownerLength+c+n+S+L,k=Ct.Buffer.alloc(y);if(k.set(qo(e.signatureType),0),k.set(new Uint8Array(e.signatureLength).fill(0),2),i.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${i.byteLength}`);k.set(i,2+e.signatureLength);let b=2+e.signatureLength+e.ownerLength;if(k[b]=a?1:0,a){if(a.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${a.byteLength}`);k.set(a,b+1)}let U=b+c,C=U+1;if(k[U]=l?1:0,l){if(C+=l.byteLength,l.byteLength!==32)throw new Error("Anchor must be 32 bytes");k.set(l,U+1)}k.set(Or(((v=r==null?void 0:r.tags)==null?void 0:v.length)??0),C);let K=Or((p==null?void 0:p.byteLength)??0);k.set(K,C+8),p&&k.set(p,C+16);let z=C+S;return k.set(E,z),new xe(k)}var Jo={...Cn};globalThis.arbundles??(globalThis.arbundles=Jo);var Qo=class{constructor(t,e){j(this,"signer");j(this,"bundlerSigner");j(this,"type");j(this,"warp");j(this,"signatureProviderType");j(this,"wallet");j(this,"cachedAddress");this.warp=t,this.isCustomSignature(e)?(this.assertEnvForCustomSigner(e.type),this.signer=e.signer,this.type=e.type,this.signatureProviderType="CustomSignature"):this.isValidBundlerSignature(e)?(this.signatureProviderType="BundlerSigner",this.type=Yo(e.signatureType),this.bundlerSigner=e):(this.assignArweaveSigner(e),this.bundlerSigner=typeof e=="string"?null:new ur(e),this.signatureProviderType="ArWallet",this.type="arweave"),this.wallet=e}async getAddress(){if(this.cachedAddress)return this.cachedAddress;switch(this.signatureProviderType){case"CustomSignature":return this.wallet.getAddress?this.cachedAddress=await this.wallet.getAddress():this.cachedAddress=await this.deduceSignerBySigning(),this.cachedAddress;case"ArWallet":return this.cachedAddress=await this.deduceSignerBySigning(),this.cachedAddress;case"BundlerSigner":return this.cachedAddress=await this.deduceSignerBySigning(),this.cachedAddress;default:throw Error("Unknown Signature::signatureProvider : "+this.signatureProviderType)}}async deduceSignerBySigning(){let{arweave:t}=this.warp;if(this.signatureProviderType=="BundlerSigner")try{return await this.bundlerSigner.getAddress()}catch{throw new Error("Could not get address from the signer. Is the 'getAddress' implementation correct?'")}else if(this.signatureProviderType=="ArWallet"||this.signatureProviderType=="CustomSignature"){let e=await t.createTransaction({data:Math.random().toString().slice(-4),reward:"72600854",last_tx:"p7vc1iSP6bvH_fCeUFa9LqoV5qiyW-jdEKouAT0XMoSwrNraB9mgpi29Q10waEpO"});return await this.signer(e),t.wallets.ownerToAddress(e.owner)}else throw Error("Unknown Signature::type")}checkNonArweaveSigningAvailability(t){if(this.type!=="arweave"&&!t)throw new Error(`Unable to use signing function of type: ${this.type} when bundling is disabled.`)}checkBundlerSignerAvailability(t){if((!t||this.warp.environment=="local")&&this.signatureProviderType=="BundlerSigner")throw new Error("Only wallet of type 'ArWallet' or 'CustomSignature' is allowed when bundling is disabled or in local environment.")}assignArweaveSigner(t){this.signer=async e=>{await this.warp.arweave.transactions.sign(e,t)}}assertEnvForCustomSigner(t){if(this.warp.interactionsLoader.type()==="warp")throw new Error("Unable to use signing function when bundling is enabled.");if(t=="ethereum")throw new Error(`Unable to use signing function with signature of type: ${t}.`)}isCustomSignature(t){return t.signer!==void 0&&t.type!==void 0}isValidBundlerSignature(t){let e=t,r=!!e.signatureType&&!!e.ownerLength&&!!e.signatureLength;if(r&&!e.publicKey)throw new Error("It seems that you are using BundlerSigner, but publicKey is not set! Maybe try calling await bundlerSigner.setPublicKey() before using it.");return r}};function Yo(t){if(t===3)return"ethereum";if(t===1)return"arweave";throw Error(`Not supported arbundle SignatureType : ${t}`)}at();var Xo=class{constructor(t,e){j(this,"rootOptions");j(this,"saferEvaluationOptions",{internalWrites:t=>{if(t.internalWrites===void 0||this.rootOptions.internalWrites==t.internalWrites)return this.rootOptions.internalWrites;if(this.rootOptions.internalWrites&&!t.internalWrites||!this.rootOptions.internalWrites&&t.internalWrites)return t.internalWrites;throw new Error('Could not determine "internalWrites" value ')},throwOnInternalWriteError:t=>t.throwOnInternalWriteError===void 0?this.rootOptions.throwOnInternalWriteError:t.throwOnInternalWriteError,unsafeClient:t=>{if(t.unsafeClient===void 0||this.rootOptions.unsafeClient==t.unsafeClient)return this.rootOptions.unsafeClient;if(this.rootOptions.unsafeClient==="throw"||this.rootOptions.unsafeClient==="skip")return this.rootOptions.unsafeClient;if(this.rootOptions.unsafeClient==="allow")return t.unsafeClient==="throw"?"skip":t.unsafeClient;throw new Error('Could not determine "unsafeClient" value')},ignoreExceptions:t=>{if(t.ignoreExceptions===void 0||this.rootOptions.ignoreExceptions==t.ignoreExceptions)return this.rootOptions.ignoreExceptions;if(this.rootOptions.ignoreExceptions&&!t.ignoreExceptions)return this.rootOptions.ignoreExceptions;if(!this.rootOptions.ignoreExceptions&&t.ignoreExceptions)return this.rootOptions.ignoreExceptions;throw new Error('Could not determine "ignoreExceptions" value')},waitForConfirmation:()=>this.rootOptions.waitForConfirmation,updateCacheForEachInteraction:()=>this.rootOptions.updateCacheForEachInteraction,maxCallDepth:()=>this.rootOptions.maxCallDepth,maxInteractionEvaluationTimeSeconds:()=>this.rootOptions.maxInteractionEvaluationTimeSeconds,stackTrace:()=>this.rootOptions.stackTrace,sourceType:()=>this.rootOptions.sourceType,sequencerUrl:()=>this.rootOptions.sequencerUrl,gasLimit:()=>this.rootOptions.gasLimit,allowBigInt:()=>this.rootOptions.allowBigInt,walletBalanceUrl:()=>this.rootOptions.walletBalanceUrl,mineArLocalBlocks:()=>this.rootOptions.mineArLocalBlocks,cacheEveryNInteractions:()=>this.rootOptions.cacheEveryNInteractions,remoteStateSyncEnabled:()=>this.rootOptions.remoteStateSyncEnabled,remoteStateSyncSource:()=>this.rootOptions.remoteStateSyncSource,useKVStorage:t=>t.useKVStorage,useConstructor:t=>t.useConstructor,whitelistSources:()=>this.rootOptions.whitelistSources});j(this,"notConflictingEvaluationOptions",["useKVStorage","sourceType","useConstructor"]);if(e){let r=[];for(let i in e){if(!t.hasOwnProperty(i))throw new Error("Unknown option set in contract's manifest. You probably need to update the Warp SDK version.");let a=i,c=e[i],l=t[i];if(!this.notConflictingEvaluationOptions.includes(a))if(a==="internalWrites"){if(l===!1&&c===!0)throw new Error("Cannot proceed with contract evaluation. User is blocking internal writes, while contract requires them.")}else if(a==="unsafeClient"){if(l==="throw"&&c!=="throw"||l==="skip"&&c==="allow")throw new Error(`Cannot proceed with contract evaluation. User requires to ${l} on any unsafeClient usage, while contract uses ${c} option.`)}else t[i]!==e[i]&&r.push(`Option {${i}} differs. EvaluationOptions: [${t[i]}], manifest: [${e[i]}]. Use contract.setEvaluationOptions({${i}: ${e[i]}}) to evaluate contract state.`)}if(r.length)throw new Error(r.join(` +${B.errorMessage}`);let O=B.type==="ok";y[P.id]=O,E=B.state;let W=new Rt(E,y,k);je(P)&&(C={tx:P,state:W});let F=B.event;F&&S.eventTarget.dispatchEvent(new Ba(O?"interactionCompleted":"interactionFailed",{detail:F}))}x&&x.process({contractTxId:n.txId,allInteractions:K,currentInteraction:I,lastInteractionProcessingTime:q.elapsed()});try{for(let{modify:et}of this.executionContextModifiers)r=await et(E,r)}catch(et){if(et.name=="ContractError"&&et.subtype=="unsafeClientSkip"||et.name=="NonWhitelistedSourceError")y[P.id]=!1,k[P.id]=et.message,w=!0;else throw et}let G=r.evaluationOptions.cacheEveryNInteractions>0&&I%r.evaluationOptions.cacheEveryNInteractions===0;if(l.isRoot())l.clearChildren(),C&&(l.interactionState().update(l.txId(),C.state,C.tx.sortKey),y[P.id]?await l.interactionState().commit(P,G):await l.interactionState().rollback(P,G));else{let et=new Rt(E,y,k);l.interactionState().update(l.txId(),et,L)}}let u=new Rt(E,y,k);return C!==null&&await this.onStateEvaluated(C.tx,r,C.state),new Pt(L,u)}logResult(t,e,r){t.type==="exception"&&this.logger.error(`Executing of interaction: [${r.contractDefinition.txId} -> ${e.id}] threw exception:`,`${t.errorMessage}`),t.type==="error"&&this.logger.warn(`Executing of interaction: [${r.contractDefinition.txId} -> ${e.id}] returned error:`,t.errorMessage)}parseInput(t){try{return JSON.parse(t.value)}catch(e){return this.logger.error(e),null}}};function je(t){return t.confirmationStatus===void 0?!0:t.confirmationStatus==="confirmed"}at();var wo=class extends po{constructor(e,r,i=[]){super(e,i);j(this,"cLogger",xt.INST.create("CacheableStateEvaluator"));this.cache=r}async eval(e){var E,L,y,k;let{cachedState:r,contract:i}=e,a=e.sortedInteractions;if(r&&r.sortKey==e.requestedSortKey&&!(a!=null&&a.length))return this.cLogger.info(`Exact cache hit for sortKey ${(E=e==null?void 0:e.contractDefinition)==null?void 0:E.txId}:${r.sortKey}`),(L=e.handler)==null||L.initState(r.cachedValue.state),r;let c=e.contractDefinition.txId;if(!c)throw new Error("Contract tx id not set in the execution context");let l=r==null,n=l?e.contractDefinition.initState:r.cachedValue.state,p=l?{}:r.cachedValue.validity,S=l?{}:r.cachedValue.errorMessages;if(l&&(n=await e.handler.maybeCallStateConstructor(e.contractDefinition.initState,e),await i.interactionState().commitKV()),a.length==0)if(this.cLogger.info(`No missing interactions ${c}`),l){(y=e.handler)==null||y.initState(n),this.cLogger.debug("Inserting initial state into cache");let b=new Rt(n,{},{});return await this.cache.put(new Wt(c,Ge),b),new Pt(Ge,b)}else return(k=e.handler)==null||k.initState(r.cachedValue.state),r;return await this.doReadState(a,new Rt(n,p,S||{}),e)}async onStateEvaluated(e,r,i){let a=r.contractDefinition.txId;this.cLogger.debug(`${zt(r.contract.callDepth())}onStateEvaluated: cache update for contract ${a} [${e.sortKey}]`),await this.putInCache(a,e,i)}async onStateUpdate(e,r,i,a=!1){(r.evaluationOptions.updateCacheForEachInteraction||a)&&(this.cLogger.debug(`onStateUpdate: cache update for contract ${r.contractDefinition.txId} [${e.sortKey}]`,{contract:r.contractDefinition.txId,state:i.state,sortKey:e.sortKey}),await this.putInCache(r.contractDefinition.txId,e,i))}async latestAvailableState(e,r){if(this.cLogger.debug("Searching for",{contractTxId:e,sortKey:r}),r){let i=await this.cache.getLessOrEqual(e,r);return i&&this.cLogger.debug(`Latest available state at ${e}: ${i.sortKey}`),i}else return await this.cache.getLast(e)}async onInternalWriteStateUpdate(e,r,i){this.cLogger.debug("Internal write state update:",{sortKey:e.sortKey,dry:e.dry,contractTxId:r,state:i.state}),await this.putInCache(r,e,i)}async onContractCall(e,r,i){var c;if(((c=r.sortedInteractions)==null?void 0:c.length)==0)return;let a=r.sortedInteractions.indexOf(e);a<1||await this.putInCache(r.contractDefinition.txId,r.sortedInteractions[a-1],i)}async putInCache(e,r,i){if(r.dry||r.confirmationStatus!==void 0&&r.confirmationStatus!=="confirmed")return;let a=new Rt(i.state,i.validity,i.errorMessages||{});this.cLogger.debug("Putting into cache",{contractTxId:e,transaction:r.id,sortKey:r.sortKey,dry:r.dry}),await this.cache.put(new Wt(e,r.sortKey),a)}async syncState(e,r,i,a){let c=new Rt(i,a,{});return await this.cache.put(new Wt(e,r),c),new Pt(r,c)}async dumpCache(){return await this.cache.dump()}async internalWriteState(e,r){return await this.cache.get(new Wt(e,r))}async hasContractCached(e){return await this.cache.getLast(e)!=null}async lastCachedSortKey(){return await this.cache.getLastSortKey()}setCache(e){this.cache=e}getCache(){return this.cache}};at();var yo=Lt(te()),De=class{constructor(t,e,r=null){j(this,"interactions",{});j(this,"id");this.contractTxId=t,this.depth=e,this.innerCallType=r,this.id=yo.Crypto.randomUUID()}addInteractionData(t){let{interaction:e,interactionTx:r}=t,i=En.create(new mo(r.id,r.sortKey,r.block.height,r.block.timestamp,e==null?void 0:e.caller,e==null?void 0:e.input.function,e==null?void 0:e.input,r.dry,{}));return this.interactions[r.id]=i,i}getInteraction(t){return this.interactions[t]}print(){return JSON.stringify(this,null,2)}},En=class{constructor(t){j(this,"interactionOutput");this.interactionInput=t}static create(t){return new En(t)}update(t){this.interactionOutput=t}},mo=class{constructor(t,e,r,i,a,c,l,n,p={}){this.txId=t,this.sortKey=e,this.blockHeight=r,this.blockTimestamp=i,this.caller=a,this.functionName=c,this.functionArguments=l,this.dryWrite=n,this.foreignContractCalls=p}},Os=class{constructor(t,e,r,i,a="",c){this.cacheHit=t,this.outputState=e,this.executionTime=r,this.valid=i,this.errorMessage=a,this.gasUsed=c}};at();var Ke=Lt(er());at();at();var bo=(t=>(t.CONTRACT_NOT_FOUND="CONTRACT_NOT_FOUND",t))(bo||{}),vo=class extends Error{constructor(e,r={}){var t=(...Sc)=>(super(...Sc),j(this,"type"),j(this,"otherInfo"),this);r.message?t(r.message):t(),this.type=e,this.otherInfo=r}getType(){return this.type}};function _o(t){if(!t)return!1;let e=Tn(t);return t.evolve!==void 0||e.has("evolve")}var Se=class{constructor(){j(this,"logger",xt.INST.create("Evolve"));this.modify=this.modify.bind(this)}async modify(t,e){let{definitionLoader:r,executorFactory:i}=e.warp,a=e.contractDefinition.txId,c=Se.evolvedSrcTxId(t),l=e.contractDefinition.srcTxId;if(c&&l!==c)try{this.logger.info("Evolving to: ",c);let n=await r.load(a,c),p=await i.create(n,e.evaluationOptions,e.warp,e.contract.interactionState());return e.contractDefinition=n,e.handler=p,e.handler.initState(t),this.logger.debug("evolved to:",{evolve:c,newSrcTxId:e.contractDefinition.srcTxId,currentSrcTxId:l,contract:e.contractDefinition.txId}),e}catch(n){throw n.name==="ContractError"&&n.subtype==="unsafeClientSkip"||n.name=="NonWhitelistedSourceError"?n:new vo("CONTRACT_NOT_FOUND",{message:`Error while evolving ${a} from ${l} to ${c}: ${n}`,requestedTxId:a})}return e}static evolvedSrcTxId(t){if(!_o(t))return;let e=Tn(t),r=t.evolve||e.get("evolve"),i=t.canEvolve||e.get("canEvolve");if(i==null&&(i=!0),r&&/[a-z0-9_-]{43}/i.test(r)&&i)return r}};function Tn(t){let e=new Map;return t.settings&&(Eo(t.settings)?e=new Map(t.settings):To(t.settings)&&(e=new Map(Object.entries(t.settings)))),e}function Eo(t){return t==null?!1:typeof t[Symbol.iterator]=="function"}function To(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}at();at();at();var Sn=Lt(Ci(),1);Sn.default.configure;var So=Sn.default;at();async function Ir(t,e,r,i,a,c="",l="0",n=!1,p,S){let E={data:Math.random().toString().slice(-4)};c&&c.length&&(E.target=c.toString(),l&&+l>0&&(E.quantity=l.toString())),n&&(E.reward="0",E.last_tx="p7vc1iSP6bvH_fCeUFa9LqoV5qiyW-jdEKouAT0XMoSwrNraB9mgpi29Q10waEpO"),S&&S.length&&(E.reward=S);let L=await t.createTransaction(E);return xn(r,i,p,a).forEach(y=>L.addTag(y.name,y.value)),e&&await e(L),L}function xo(t,e,r){let i=new ee().decodeTags(t);return{id:t.id,owner:{address:e,key:""},recipient:t.target,tags:i,fee:{winston:t.reward,ar:""},quantity:{winston:t.quantity,ar:""},block:{id:r.indep_hash,height:r.height,timestamp:r.timestamp,previous:null},dry:!0,anchor:null,signature:null,data:null,parent:null,bundledIn:null}}function xn(t,e,r,i){let a=[];if(i&&i.length)for(let c of i)a.push(new $t(c.name.toString(),c.value.toString()));return a.push(new $t(At.APP_NAME,"SmartWeaveAction")),a.push(new $t(At.APP_VERSION,"0.3.0")),a.push(new $t(At.SDK,"Warp")),a.push(new $t(At.CONTRACT_TX_ID,t)),a.push(new $t(At.INPUT,JSON.stringify(e))),r&&a.push(new $t(_t.WARP_TESTNET,"1.0.0")),a}at();var ne={target:"",winstonQty:"0"},Ls=["node1","node2","arweave"];at();var ko=class{eval(t){let e=[];return Object.keys(t.interactions).forEach(r=>{let i=t.interactions[r];this.evalForeignCalls(t.contractTxId,i,e)}),e}evalForeignCalls(t,e,r){Object.keys(e.interactionInput.foreignContractCalls).forEach(i=>{let a=e.interactionInput.foreignContractCalls[i];a.innerCallType=="write"&&Object.keys(a.interactions).forEach(c=>{let l=a.interactions[c];l.interactionInput.dryWrite&&!r.includes(a.contractTxId)&&t!==a.contractTxId&&r.push(a.contractTxId),this.evalForeignCalls(t,l,r)})})}};at();at();var Ao=Object.create,lr=Object.defineProperty,Co=Object.getOwnPropertyDescriptor,Io=Object.getOwnPropertyNames,Oo=Object.getPrototypeOf,Lo=Object.prototype.hasOwnProperty,qt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Bo=(t,e)=>{for(var r in e)lr(t,r,{get:e[r],enumerable:!0})},No=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Io(e))!Lo.call(t,a)&&a!==r&&lr(t,a,{get:()=>e[a],enumerable:!(i=Co(e,a))||i.enumerable});return t},re=(t,e,r)=>(r=t!=null?Ao(Oo(t)):{},No(e||!t||!t.__esModule?lr(r,"default",{value:t,enumerable:!0}):r,t)),Ro=qt(t=>{Object.defineProperty(t,"__esModule",{value:!0});function e(r){var i=4,a=r.length,c=a%i;if(!c)return r;var l=a,n=i-c,p=a+n,S=Ct.Buffer.alloc(p);for(S.write(r);n--;)S.write("=",l++);return S.toString()}t.default=e}),Uo=qt(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Ro();function r(p,S){return S===void 0&&(S="utf8"),Ct.Buffer.isBuffer(p)?c(p.toString("base64")):c(Ct.Buffer.from(p,S).toString("base64"))}function i(p,S){return S===void 0&&(S="utf8"),Ct.Buffer.from(a(p),"base64").toString(S)}function a(p){return p=p.toString(),e.default(p).replace(/\-/g,"+").replace(/_/g,"/")}function c(p){return p.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function l(p){return Ct.Buffer.from(a(p),"base64")}var n=r;n.encode=r,n.decode=i,n.toBase64=a,n.fromBase64=c,n.toBuffer=l,t.default=n}),cr=qt((t,e)=>{e.exports=Uo().default,e.exports.default=e.exports}),kn=qt(t=>{t.byteLength=p,t.toByteArray=E,t.fromByteArray=k;var e=[],r=[],i=typeof Uint8Array<"u"?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(c=0,l=a.length;c0)throw new Error("Invalid string. Length must be a multiple of 4");var C=b.indexOf("=");C===-1&&(C=U);var K=C===U?0:4-C%4;return[C,K]}function p(b){var U=n(b),C=U[0],K=U[1];return(C+K)*3/4-K}function S(b,U,C){return(U+C)*3/4-C}function E(b){var U,C=n(b),K=C[0],z=C[1],x=new i(S(b,K,z)),v=0,w=z>0?K-4:K,u;for(u=0;u>16&255,x[v++]=U>>8&255,x[v++]=U&255;return z===2&&(U=r[b.charCodeAt(u)]<<2|r[b.charCodeAt(u+1)]>>4,x[v++]=U&255),z===1&&(U=r[b.charCodeAt(u)]<<10|r[b.charCodeAt(u+1)]<<4|r[b.charCodeAt(u+2)]>>2,x[v++]=U>>8&255,x[v++]=U&255),x}function L(b){return e[b>>18&63]+e[b>>12&63]+e[b>>6&63]+e[b&63]}function y(b,U,C){for(var K,z=[],x=U;xw?w:v+x));return K===1?(U=b[C-1],z.push(e[U>>2]+e[U<<4&63]+"==")):K===2&&(U=(b[C-2]<<8)+b[C-1],z.push(e[U>>10]+e[U>>4&63]+e[U<<2&63]+"=")),z.join("")}}),An=qt(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var e=kn();function r(y){let k=0;for(let C=0;C{Object.defineProperty(t,"__esModule",{value:!0});var e=An(),r=class{constructor(){j(this,"keyLength",4096);j(this,"publicExponent",65537);j(this,"hashAlgorithm","sha256");j(this,"driver");if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let i=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),a=await this.driver.exportKey("jwk",i.privateKey);return{kty:a.kty,e:a.e,n:a.n,d:a.d,p:a.p,q:a.q,dp:a.dp,dq:a.dq,qi:a.qi}}async sign(i,a,{saltLength:c}={}){let l=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(i),a);return new Uint8Array(l)}async hash(i,a="SHA-256"){let c=await this.driver.digest(a,i);return new Uint8Array(c)}async verify(i,a,c){let l={kty:"RSA",e:"AQAB",n:i},n=await this.jwkToPublicCryptoKey(l),p=await this.driver.digest("SHA-256",a),S=await this.driver.verify({name:"RSA-PSS",saltLength:0},n,c,a),E=await this.driver.verify({name:"RSA-PSS",saltLength:32},n,c,a),L=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((n.algorithm.modulusLength-1)/8)-p.byteLength-2},n,c,a);return S||E||L}async jwkToCryptoKey(i){return this.driver.importKey("jwk",i,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(i){return this.driver.importKey("jwk",i,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let i=crypto==null?void 0:crypto.subtle;return i===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(a=>typeof i[a]=="function")}async encrypt(i,a,c){let l=await this.driver.importKey("raw",typeof a=="string"?e.stringToBuffer(a):a,{name:"PBKDF2",length:32},!1,["deriveKey"]),n=await this.driver.deriveKey({name:"PBKDF2",salt:c?e.stringToBuffer(c):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},l,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),p=new Uint8Array(16);crypto.getRandomValues(p);let S=await this.driver.encrypt({name:"AES-CBC",iv:p},n,i);return e.concatBuffers([p,S])}async decrypt(i,a,c){let l=await this.driver.importKey("raw",typeof a=="string"?e.stringToBuffer(a):a,{name:"PBKDF2",length:32},!1,["deriveKey"]),n=await this.driver.deriveKey({name:"PBKDF2",salt:c?e.stringToBuffer(c):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},l,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),p=i.slice(0,16),S=await this.driver.decrypt({name:"AES-CBC",iv:p},n,i.slice(16));return e.concatBuffers([S])}};t.default=r}),Po=qt(t=>{t.read=function(e,r,i,a,c){var l,n,p=c*8-a-1,S=(1<>1,L=-7,y=i?c-1:0,k=i?-1:1,b=e[r+y];for(y+=k,l=b&(1<<-L)-1,b>>=-L,L+=p;L>0;l=l*256+e[r+y],y+=k,L-=8);for(n=l&(1<<-L)-1,l>>=-L,L+=a;L>0;n=n*256+e[r+y],y+=k,L-=8);if(l===0)l=1-E;else{if(l===S)return n?NaN:(b?-1:1)*(1/0);n=n+Math.pow(2,a),l=l-E}return(b?-1:1)*n*Math.pow(2,l-a)},t.write=function(e,r,i,a,c,l){var n,p,S,E=l*8-c-1,L=(1<>1,k=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=a?0:l-1,U=a?1:-1,C=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(p=isNaN(r)?1:0,n=L):(n=Math.floor(Math.log(r)/Math.LN2),r*(S=Math.pow(2,-n))<1&&(n--,S*=2),n+y>=1?r+=k/S:r+=k*Math.pow(2,1-y),r*S>=2&&(n++,S/=2),n+y>=L?(p=0,n=L):n+y>=1?(p=(r*S-1)*Math.pow(2,c),n=n+y):(p=r*Math.pow(2,y-1)*Math.pow(2,c),n=0));c>=8;e[i+b]=p&255,b+=U,p/=256,c-=8);for(n=n<0;e[i+b]=n&255,b+=U,n/=256,E-=8);e[i+b-U]|=C*128}}),He=qt(t=>{var e=kn(),r=Po(),i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=n,t.SlowBuffer=z,t.INSPECT_MAX_BYTES=50;var a=2147483647;t.kMaxLength=a,n.TYPED_ARRAY_SUPPORT=c(),!n.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 c(){try{let o=new Uint8Array(1),g={foo:function(){return 42}};return Object.setPrototypeOf(g,Uint8Array.prototype),Object.setPrototypeOf(o,g),o.foo()===42}catch{return!1}}Object.defineProperty(n.prototype,"parent",{enumerable:!0,get:function(){if(n.isBuffer(this))return this.buffer}}),Object.defineProperty(n.prototype,"offset",{enumerable:!0,get:function(){if(n.isBuffer(this))return this.byteOffset}});function l(o){if(o>a)throw new RangeError('The value "'+o+'" is invalid for option "size"');let g=new Uint8Array(o);return Object.setPrototypeOf(g,n.prototype),g}function n(o,g,m){if(typeof o=="number"){if(typeof g=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return L(o)}return p(o,g,m)}n.poolSize=8192;function p(o,g,m){if(typeof o=="string")return y(o,g);if(ArrayBuffer.isView(o))return b(o);if(o==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof o);if(_(o,ArrayBuffer)||o&&_(o.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(_(o,SharedArrayBuffer)||o&&_(o.buffer,SharedArrayBuffer)))return U(o,g,m);if(typeof o=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let V=o.valueOf&&o.valueOf();if(V!=null&&V!==o)return n.from(V,g,m);let Q=C(o);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof o[Symbol.toPrimitive]=="function")return n.from(o[Symbol.toPrimitive]("string"),g,m);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof o)}n.from=function(o,g,m){return p(o,g,m)},Object.setPrototypeOf(n.prototype,Uint8Array.prototype),Object.setPrototypeOf(n,Uint8Array);function S(o){if(typeof o!="number")throw new TypeError('"size" argument must be of type number');if(o<0)throw new RangeError('The value "'+o+'" is invalid for option "size"')}function E(o,g,m){return S(o),o<=0?l(o):g!==void 0?typeof m=="string"?l(o).fill(g,m):l(o).fill(g):l(o)}n.alloc=function(o,g,m){return E(o,g,m)};function L(o){return S(o),l(o<0?0:K(o)|0)}n.allocUnsafe=function(o){return L(o)},n.allocUnsafeSlow=function(o){return L(o)};function y(o,g){if((typeof g!="string"||g==="")&&(g="utf8"),!n.isEncoding(g))throw new TypeError("Unknown encoding: "+g);let m=x(o,g)|0,V=l(m),Q=V.write(o,g);return Q!==m&&(V=V.slice(0,Q)),V}function k(o){let g=o.length<0?0:K(o.length)|0,m=l(g);for(let V=0;V=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return o|0}function z(o){return+o!=o&&(o=0),n.alloc(+o)}n.isBuffer=function(o){return o!=null&&o._isBuffer===!0&&o!==n.prototype},n.compare=function(o,g){if(_(o,Uint8Array)&&(o=n.from(o,o.offset,o.byteLength)),_(g,Uint8Array)&&(g=n.from(g,g.offset,g.byteLength)),!n.isBuffer(o)||!n.isBuffer(g))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(o===g)return 0;let m=o.length,V=g.length;for(let Q=0,it=Math.min(m,V);QV.length?(n.isBuffer(it)||(it=n.from(it)),it.copy(V,Q)):Uint8Array.prototype.set.call(V,it,Q);else if(n.isBuffer(it))it.copy(V,Q);else throw new TypeError('"list" argument must be an Array of Buffers');Q+=it.length}return V};function x(o,g){if(n.isBuffer(o))return o.length;if(ArrayBuffer.isView(o)||_(o,ArrayBuffer))return o.byteLength;if(typeof o!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof o);let m=o.length,V=arguments.length>2&&arguments[2]===!0;if(!V&&m===0)return 0;let Q=!1;for(;;)switch(g){case"ascii":case"latin1":case"binary":return m;case"utf8":case"utf-8":return h(o).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m*2;case"hex":return m>>>1;case"base64":return R(o).length;default:if(Q)return V?-1:h(o).length;g=(""+g).toLowerCase(),Q=!0}}n.byteLength=x;function v(o,g,m){let V=!1;if((g===void 0||g<0)&&(g=0),g>this.length||((m===void 0||m>this.length)&&(m=this.length),m<=0)||(m>>>=0,g>>>=0,m<=g))return"";for(o||(o="utf8");;)switch(o){case"hex":return W(this,g,m);case"utf8":case"utf-8":return tt(this,g,m);case"ascii":return B(this,g,m);case"latin1":case"binary":return O(this,g,m);case"base64":return J(this,g,m);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,g,m);default:if(V)throw new TypeError("Unknown encoding: "+o);o=(o+"").toLowerCase(),V=!0}}n.prototype._isBuffer=!0;function w(o,g,m){let V=o[g];o[g]=o[m],o[m]=V}n.prototype.swap16=function(){let o=this.length;if(o%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let g=0;gg&&(o+=" ... "),""},i&&(n.prototype[i]=n.prototype.inspect),n.prototype.compare=function(o,g,m,V,Q){if(_(o,Uint8Array)&&(o=n.from(o,o.offset,o.byteLength)),!n.isBuffer(o))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof o);if(g===void 0&&(g=0),m===void 0&&(m=o?o.length:0),V===void 0&&(V=0),Q===void 0&&(Q=this.length),g<0||m>o.length||V<0||Q>this.length)throw new RangeError("out of range index");if(V>=Q&&g>=m)return 0;if(V>=Q)return-1;if(g>=m)return 1;if(g>>>=0,m>>>=0,V>>>=0,Q>>>=0,this===o)return 0;let it=Q-V,ct=m-g,Et=Math.min(it,ct),kt=this.slice(V,Q),Tt=o.slice(g,m);for(let vt=0;vt2147483647?m=2147483647:m<-2147483648&&(m=-2147483648),m=+m,D(m)&&(m=Q?0:o.length-1),m<0&&(m=o.length+m),m>=o.length){if(Q)return-1;m=o.length-1}else if(m<0)if(Q)m=0;else return-1;if(typeof g=="string"&&(g=n.from(g,V)),n.isBuffer(g))return g.length===0?-1:T(o,g,m,V,Q);if(typeof g=="number")return g=g&255,typeof Uint8Array.prototype.indexOf=="function"?Q?Uint8Array.prototype.indexOf.call(o,g,m):Uint8Array.prototype.lastIndexOf.call(o,g,m):T(o,[g],m,V,Q);throw new TypeError("val must be string, number or Buffer")}function T(o,g,m,V,Q){let it=1,ct=o.length,Et=g.length;if(V!==void 0&&(V=String(V).toLowerCase(),V==="ucs2"||V==="ucs-2"||V==="utf16le"||V==="utf-16le")){if(o.length<2||g.length<2)return-1;it=2,ct/=2,Et/=2,m/=2}function kt(vt,bt){return it===1?vt[bt]:vt.readUInt16BE(bt*it)}let Tt;if(Q){let vt=-1;for(Tt=m;Ttct&&(m=ct-Et),Tt=m;Tt>=0;Tt--){let vt=!0;for(let bt=0;btQ&&(V=Q)):V=Q;let it=g.length;V>it/2&&(V=it/2);let ct;for(ct=0;ct>>0,isFinite(m)?(m=m>>>0,V===void 0&&(V="utf8")):(V=m,m=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let Q=this.length-g;if((m===void 0||m>Q)&&(m=Q),o.length>0&&(m<0||g<0)||g>this.length)throw new RangeError("Attempt to write outside buffer bounds");V||(V="utf8");let it=!1;for(;;)switch(V){case"hex":return I(this,o,g,m);case"utf8":case"utf-8":return P(this,o,g,m);case"ascii":case"latin1":case"binary":return q(this,o,g,m);case"base64":return G(this,o,g,m);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return et(this,o,g,m);default:if(it)throw new TypeError("Unknown encoding: "+V);V=(""+V).toLowerCase(),it=!0}},n.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function J(o,g,m){return g===0&&m===o.length?e.fromByteArray(o):e.fromByteArray(o.slice(g,m))}function tt(o,g,m){m=Math.min(o.length,m);let V=[],Q=g;for(;Q239?4:it>223?3:it>191?2:1;if(Q+Et<=m){let kt,Tt,vt,bt;switch(Et){case 1:it<128&&(ct=it);break;case 2:kt=o[Q+1],(kt&192)===128&&(bt=(it&31)<<6|kt&63,bt>127&&(ct=bt));break;case 3:kt=o[Q+1],Tt=o[Q+2],(kt&192)===128&&(Tt&192)===128&&(bt=(it&15)<<12|(kt&63)<<6|Tt&63,bt>2047&&(bt<55296||bt>57343)&&(ct=bt));break;case 4:kt=o[Q+1],Tt=o[Q+2],vt=o[Q+3],(kt&192)===128&&(Tt&192)===128&&(vt&192)===128&&(bt=(it&15)<<18|(kt&63)<<12|(Tt&63)<<6|vt&63,bt>65535&&bt<1114112&&(ct=bt))}}ct===null?(ct=65533,Et=1):ct>65535&&(ct-=65536,V.push(ct>>>10&1023|55296),ct=56320|ct&1023),V.push(ct),Q+=Et}return nt(V)}var st=4096;function nt(o){let g=o.length;if(g<=st)return String.fromCharCode.apply(String,o);let m="",V=0;for(;VV)&&(m=V);let Q="";for(let it=g;itm&&(o=m),g<0?(g+=m,g<0&&(g=0)):g>m&&(g=m),gm)throw new RangeError("Trying to access beyond buffer length")}n.prototype.readUintLE=n.prototype.readUIntLE=function(o,g,m){o=o>>>0,g=g>>>0,m||Z(o,g,this.length);let V=this[o],Q=1,it=0;for(;++it>>0,g=g>>>0,m||Z(o,g,this.length);let V=this[o+--g],Q=1;for(;g>0&&(Q*=256);)V+=this[o+--g]*Q;return V},n.prototype.readUint8=n.prototype.readUInt8=function(o,g){return o=o>>>0,g||Z(o,1,this.length),this[o]},n.prototype.readUint16LE=n.prototype.readUInt16LE=function(o,g){return o=o>>>0,g||Z(o,2,this.length),this[o]|this[o+1]<<8},n.prototype.readUint16BE=n.prototype.readUInt16BE=function(o,g){return o=o>>>0,g||Z(o,2,this.length),this[o]<<8|this[o+1]},n.prototype.readUint32LE=n.prototype.readUInt32LE=function(o,g){return o=o>>>0,g||Z(o,4,this.length),(this[o]|this[o+1]<<8|this[o+2]<<16)+this[o+3]*16777216},n.prototype.readUint32BE=n.prototype.readUInt32BE=function(o,g){return o=o>>>0,g||Z(o,4,this.length),this[o]*16777216+(this[o+1]<<16|this[o+2]<<8|this[o+3])},n.prototype.readBigUInt64LE=lt(function(o){o=o>>>0,M(o,"offset");let g=this[o],m=this[o+7];(g===void 0||m===void 0)&&X(o,this.length-8);let V=g+this[++o]*2**8+this[++o]*2**16+this[++o]*2**24,Q=this[++o]+this[++o]*2**8+this[++o]*2**16+m*2**24;return BigInt(V)+(BigInt(Q)<>>0,M(o,"offset");let g=this[o],m=this[o+7];(g===void 0||m===void 0)&&X(o,this.length-8);let V=g*2**24+this[++o]*2**16+this[++o]*2**8+this[++o],Q=this[++o]*2**24+this[++o]*2**16+this[++o]*2**8+m;return(BigInt(V)<>>0,g=g>>>0,m||Z(o,g,this.length);let V=this[o],Q=1,it=0;for(;++it=Q&&(V-=Math.pow(2,8*g)),V},n.prototype.readIntBE=function(o,g,m){o=o>>>0,g=g>>>0,m||Z(o,g,this.length);let V=g,Q=1,it=this[o+--V];for(;V>0&&(Q*=256);)it+=this[o+--V]*Q;return Q*=128,it>=Q&&(it-=Math.pow(2,8*g)),it},n.prototype.readInt8=function(o,g){return o=o>>>0,g||Z(o,1,this.length),this[o]&128?(255-this[o]+1)*-1:this[o]},n.prototype.readInt16LE=function(o,g){o=o>>>0,g||Z(o,2,this.length);let m=this[o]|this[o+1]<<8;return m&32768?m|4294901760:m},n.prototype.readInt16BE=function(o,g){o=o>>>0,g||Z(o,2,this.length);let m=this[o+1]|this[o]<<8;return m&32768?m|4294901760:m},n.prototype.readInt32LE=function(o,g){return o=o>>>0,g||Z(o,4,this.length),this[o]|this[o+1]<<8|this[o+2]<<16|this[o+3]<<24},n.prototype.readInt32BE=function(o,g){return o=o>>>0,g||Z(o,4,this.length),this[o]<<24|this[o+1]<<16|this[o+2]<<8|this[o+3]},n.prototype.readBigInt64LE=lt(function(o){o=o>>>0,M(o,"offset");let g=this[o],m=this[o+7];(g===void 0||m===void 0)&&X(o,this.length-8);let V=this[o+4]+this[o+5]*2**8+this[o+6]*2**16+(m<<24);return(BigInt(V)<>>0,M(o,"offset");let g=this[o],m=this[o+7];(g===void 0||m===void 0)&&X(o,this.length-8);let V=(g<<24)+this[++o]*2**16+this[++o]*2**8+this[++o];return(BigInt(V)<>>0,g||Z(o,4,this.length),r.read(this,o,!0,23,4)},n.prototype.readFloatBE=function(o,g){return o=o>>>0,g||Z(o,4,this.length),r.read(this,o,!1,23,4)},n.prototype.readDoubleLE=function(o,g){return o=o>>>0,g||Z(o,8,this.length),r.read(this,o,!0,52,8)},n.prototype.readDoubleBE=function(o,g){return o=o>>>0,g||Z(o,8,this.length),r.read(this,o,!1,52,8)};function ot(o,g,m,V,Q,it){if(!n.isBuffer(o))throw new TypeError('"buffer" argument must be a Buffer instance');if(g>Q||go.length)throw new RangeError("Index out of range")}n.prototype.writeUintLE=n.prototype.writeUIntLE=function(o,g,m,V){if(o=+o,g=g>>>0,m=m>>>0,!V){let ct=Math.pow(2,8*m)-1;ot(this,o,g,m,ct,0)}let Q=1,it=0;for(this[g]=o&255;++it>>0,m=m>>>0,!V){let ct=Math.pow(2,8*m)-1;ot(this,o,g,m,ct,0)}let Q=m-1,it=1;for(this[g+Q]=o&255;--Q>=0&&(it*=256);)this[g+Q]=o/it&255;return g+m},n.prototype.writeUint8=n.prototype.writeUInt8=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,1,255,0),this[g]=o&255,g+1},n.prototype.writeUint16LE=n.prototype.writeUInt16LE=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,2,65535,0),this[g]=o&255,this[g+1]=o>>>8,g+2},n.prototype.writeUint16BE=n.prototype.writeUInt16BE=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,2,65535,0),this[g]=o>>>8,this[g+1]=o&255,g+2},n.prototype.writeUint32LE=n.prototype.writeUInt32LE=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,4,4294967295,0),this[g+3]=o>>>24,this[g+2]=o>>>16,this[g+1]=o>>>8,this[g]=o&255,g+4},n.prototype.writeUint32BE=n.prototype.writeUInt32BE=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,4,4294967295,0),this[g]=o>>>24,this[g+1]=o>>>16,this[g+2]=o>>>8,this[g+3]=o&255,g+4};function ut(o,g,m,V,Q){$(g,V,Q,o,m,7);let it=Number(g&BigInt(4294967295));o[m++]=it,it=it>>8,o[m++]=it,it=it>>8,o[m++]=it,it=it>>8,o[m++]=it;let ct=Number(g>>BigInt(32)&BigInt(4294967295));return o[m++]=ct,ct=ct>>8,o[m++]=ct,ct=ct>>8,o[m++]=ct,ct=ct>>8,o[m++]=ct,m}function gt(o,g,m,V,Q){$(g,V,Q,o,m,7);let it=Number(g&BigInt(4294967295));o[m+7]=it,it=it>>8,o[m+6]=it,it=it>>8,o[m+5]=it,it=it>>8,o[m+4]=it;let ct=Number(g>>BigInt(32)&BigInt(4294967295));return o[m+3]=ct,ct=ct>>8,o[m+2]=ct,ct=ct>>8,o[m+1]=ct,ct=ct>>8,o[m]=ct,m+8}n.prototype.writeBigUInt64LE=lt(function(o,g=0){return ut(this,o,g,BigInt(0),BigInt("0xffffffffffffffff"))}),n.prototype.writeBigUInt64BE=lt(function(o,g=0){return gt(this,o,g,BigInt(0),BigInt("0xffffffffffffffff"))}),n.prototype.writeIntLE=function(o,g,m,V){if(o=+o,g=g>>>0,!V){let Et=Math.pow(2,8*m-1);ot(this,o,g,m,Et-1,-Et)}let Q=0,it=1,ct=0;for(this[g]=o&255;++Q>0)-ct&255;return g+m},n.prototype.writeIntBE=function(o,g,m,V){if(o=+o,g=g>>>0,!V){let Et=Math.pow(2,8*m-1);ot(this,o,g,m,Et-1,-Et)}let Q=m-1,it=1,ct=0;for(this[g+Q]=o&255;--Q>=0&&(it*=256);)o<0&&ct===0&&this[g+Q+1]!==0&&(ct=1),this[g+Q]=(o/it>>0)-ct&255;return g+m},n.prototype.writeInt8=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,1,127,-128),o<0&&(o=255+o+1),this[g]=o&255,g+1},n.prototype.writeInt16LE=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,2,32767,-32768),this[g]=o&255,this[g+1]=o>>>8,g+2},n.prototype.writeInt16BE=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,2,32767,-32768),this[g]=o>>>8,this[g+1]=o&255,g+2},n.prototype.writeInt32LE=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,4,2147483647,-2147483648),this[g]=o&255,this[g+1]=o>>>8,this[g+2]=o>>>16,this[g+3]=o>>>24,g+4},n.prototype.writeInt32BE=function(o,g,m){return o=+o,g=g>>>0,m||ot(this,o,g,4,2147483647,-2147483648),o<0&&(o=4294967295+o+1),this[g]=o>>>24,this[g+1]=o>>>16,this[g+2]=o>>>8,this[g+3]=o&255,g+4},n.prototype.writeBigInt64LE=lt(function(o,g=0){return ut(this,o,g,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),n.prototype.writeBigInt64BE=lt(function(o,g=0){return gt(this,o,g,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function rt(o,g,m,V,Q,it){if(m+V>o.length)throw new RangeError("Index out of range");if(m<0)throw new RangeError("Index out of range")}function ht(o,g,m,V,Q){return g=+g,m=m>>>0,Q||rt(o,g,m,4),r.write(o,g,m,V,23,4),m+4}n.prototype.writeFloatLE=function(o,g,m){return ht(this,o,g,!0,m)},n.prototype.writeFloatBE=function(o,g,m){return ht(this,o,g,!1,m)};function mt(o,g,m,V,Q){return g=+g,m=m>>>0,Q||rt(o,g,m,8),r.write(o,g,m,V,52,8),m+8}n.prototype.writeDoubleLE=function(o,g,m){return mt(this,o,g,!0,m)},n.prototype.writeDoubleBE=function(o,g,m){return mt(this,o,g,!1,m)},n.prototype.copy=function(o,g,m,V){if(!n.isBuffer(o))throw new TypeError("argument should be a Buffer");if(m||(m=0),!V&&V!==0&&(V=this.length),g>=o.length&&(g=o.length),g||(g=0),V>0&&V=this.length)throw new RangeError("Index out of range");if(V<0)throw new RangeError("sourceEnd out of bounds");V>this.length&&(V=this.length),o.length-g>>0,m=m===void 0?this.length:m>>>0,o||(o=0);let Q;if(typeof o=="number")for(Q=g;Q2**32?Q=St(String(m)):typeof m=="bigint"&&(Q=String(m),(m>BigInt(2)**BigInt(32)||m<-(BigInt(2)**BigInt(32)))&&(Q=St(Q)),Q+="n"),V+=` It must be ${g}. Received ${Q}`,V},RangeError);function St(o){let g="",m=o.length,V=o[0]==="-"?1:0;for(;m>=V+4;m-=3)g=`_${o.slice(m-3,m)}${g}`;return`${o.slice(0,m)}${g}`}function N(o,g,m){M(g,"offset"),(o[g]===void 0||o[g+m]===void 0)&&X(g,o.length-(m+1))}function $(o,g,m,V,Q,it){if(o>m||o3?g===0||g===BigInt(0)?Et=`>= 0${ct} and < 2${ct} ** ${(it+1)*8}${ct}`:Et=`>= -(2${ct} ** ${(it+1)*8-1}${ct}) and < 2 ** ${(it+1)*8-1}${ct}`:Et=`>= ${g}${ct} and <= ${m}${ct}`,new dt.ERR_OUT_OF_RANGE("value",Et,o)}N(V,Q,it)}function M(o,g){if(typeof o!="number")throw new dt.ERR_INVALID_ARG_TYPE(g,"number",o)}function X(o,g,m){throw Math.floor(o)!==o?(M(o,m),new dt.ERR_OUT_OF_RANGE(m||"offset","an integer",o)):g<0?new dt.ERR_BUFFER_OUT_OF_BOUNDS:new dt.ERR_OUT_OF_RANGE(m||"offset",`>= ${m?1:0} and <= ${g}`,o)}var H=/[^+/0-9A-Za-z-_]/g;function s(o){if(o=o.split("=")[0],o=o.trim().replace(H,""),o.length<2)return"";for(;o.length%4!==0;)o=o+"=";return o}function h(o,g){g=g||1/0;let m,V=o.length,Q=null,it=[];for(let ct=0;ct55295&&m<57344){if(!Q){if(m>56319){(g-=3)>-1&&it.push(239,191,189);continue}else if(ct+1===V){(g-=3)>-1&&it.push(239,191,189);continue}Q=m;continue}if(m<56320){(g-=3)>-1&&it.push(239,191,189),Q=m;continue}m=(Q-55296<<10|m-56320)+65536}else Q&&(g-=3)>-1&&it.push(239,191,189);if(Q=null,m<128){if((g-=1)<0)break;it.push(m)}else if(m<2048){if((g-=2)<0)break;it.push(m>>6|192,m&63|128)}else if(m<65536){if((g-=3)<0)break;it.push(m>>12|224,m>>6&63|128,m&63|128)}else if(m<1114112){if((g-=4)<0)break;it.push(m>>18|240,m>>12&63|128,m>>6&63|128,m&63|128)}else throw new Error("Invalid code point")}return it}function d(o){let g=[];for(let m=0;m>8,Q=m%256,it.push(Q),it.push(V);return it}function R(o){return e.toByteArray(s(o))}function f(o,g,m,V){let Q;for(Q=0;Q=g.length||Q>=o.length);++Q)g[Q+m]=o[Q];return Q}function _(o,g){return o instanceof g||o!=null&&o.constructor!=null&&o.constructor.name!=null&&o.constructor.name===g.name}function D(o){return o!==o}var Y=function(){let o="0123456789abcdef",g=new Array(256);for(let m=0;m<16;++m){let V=m*16;for(let Q=0;Q<16;++Q)g[V+Q]=o[m]+o[Q]}return g}();function lt(o){return typeof BigInt>"u"?ft:o}function ft(){throw new Error("BigInt not supported")}}),Mo=qt((t,e)=>{typeof window<"u"?(window.global=window,Yt.fetch=window.fetch,e.exports={Buffer:He().Buffer,Crypto:window.crypto}):e.exports={Buffer:He().Buffer,Crypto:crypto}}),Cn={};Bo(Cn,{AVSCTap:()=>Oe,ArweaveSigner:()=>ur,DataItem:()=>xe,MAX_TAG_BYTES:()=>hr,MIN_BINARY_SIZE:()=>Rn,SIG_CONFIG:()=>me,SignatureConfig:()=>Ut,Signer:()=>jo,createData:()=>Un,deserializeTags:()=>Je,indexToType:()=>Ln,serializeTags:()=>Bn,tagsExceedLimit:()=>Nn});var jo=class{constructor(){j(this,"signer");j(this,"publicKey");j(this,"signatureType");j(this,"signatureLength");j(this,"ownerLength");j(this,"pem")}static verify(t,e,r,i){throw new Error("You must implement verify method on child")}},Do=re(cr(),1),Mt=re(An(),1);async function In(t){if(Array.isArray(t)){let a=(0,Mt.concatBuffers)([(0,Mt.stringToBuffer)("list"),(0,Mt.stringToBuffer)(t.length.toString())]);return await On(t,await Vt().hash(a,"SHA-384"))}let e=t,r=(0,Mt.concatBuffers)([(0,Mt.stringToBuffer)("blob"),(0,Mt.stringToBuffer)(e.byteLength.toString())]),i=(0,Mt.concatBuffers)([await Vt().hash(r,"SHA-384"),await Vt().hash(e,"SHA-384")]);return await Vt().hash(i,"SHA-384")}async function On(t,e){if(t.length<1)return e;let r=(0,Mt.concatBuffers)([e,await In(t[0])]),i=await Vt().hash(r,"SHA-384");return await On(t.slice(1),i)}var We=re($o(),1),Ko=We.default.default?We.default.default:We.default,Wo=class extends Ko{getPublicKey(t){throw new Error("Unimplemented")}},Fo;function Vt(){return Fo??(Fo=new Wo)}var Ut;(function(t){t[t.ARWEAVE=1]="ARWEAVE",t[t.ED25519=2]="ED25519",t[t.ETHEREUM=3]="ETHEREUM",t[t.SOLANA=4]="SOLANA",t[t.INJECTEDAPTOS=5]="INJECTEDAPTOS",t[t.MULTIAPTOS=6]="MULTIAPTOS",t[t.TYPEDETHEREUM=7]="TYPEDETHEREUM"})(Ut||(Ut={}));var me={[Ut.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[Ut.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[Ut.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[Ut.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[Ut.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[Ut.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[Ut.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},ur=class{constructor(t){j(this,"signatureType",1);j(this,"ownerLength",me[1].pubLength);j(this,"signatureLength",me[1].sigLength);j(this,"jwk");j(this,"pk");this.pk=t.n,this.jwk=t}get publicKey(){return Do.default.toBuffer(this.pk)}sign(t){return Vt().sign(this.jwk,t)}static async verify(t,e,r){return await Vt().verify(t,e,r)}},Ln={1:ur},Dt=re(cr(),1);async function ze(t){return In([(0,Mt.stringToBuffer)("dataitem"),(0,Mt.stringToBuffer)("1"),(0,Mt.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}async function Vo(t,e){let r=await ze(t),i=await e.sign(r),a=await Vt().hash(i);return{signature:Ct.Buffer.from(i),id:Ct.Buffer.from(a)}}async function Go(t,e){let{signature:r,id:i}=await Vo(t,e);return t.getRaw().set(r,2),i}var Oe=class{constructor(t=Ct.Buffer.alloc(hr),e=0){j(this,"buf");j(this,"pos");this.buf=t,this.pos=e}writeTags(t){if(!Array.isArray(t))throw new Error("input must be array");let e=t.length,r;if(e)for(this.writeLong(e),r=0;rthis.buf.length)throw new Error(`Too many tag bytes (${this.pos} > ${this.buf.length})`);return this.buf.copy(t,0,0,this.pos),t}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(t){let e=this.buf,r,i;if(t>=-1073741824&&t<1073741824){i=t>=0?t<<1:~t<<1|1;do e[this.pos]=i&127,i>>=7;while(i&&(e[this.pos++]|=128))}else{r=t>=0?t*2:-t*2-1;do e[this.pos]=r&127,r/=128;while(r>=1&&(e[this.pos++]|=128))}this.pos++,this.buf=e}writeString(t){let e=Ct.Buffer.byteLength(t),r=this.buf;this.writeLong(e);let i=this.pos;if(this.pos+=e,!(this.pos>r.length)){if(e>64)this.buf.write(t,this.pos-e,e,"utf8");else{let a,c,l,n;for(a=0,c=e;a>6|192,r[i++]=l&63|128):(l&64512)===55296&&((n=t.charCodeAt(a+1))&64512)===56320?(l=65536+((l&1023)<<10)+(n&1023),a++,r[i++]=l>>18|240,r[i++]=l>>12&63|128,r[i++]=l>>6&63|128,r[i++]=l&63|128):(r[i++]=l>>12|224,r[i++]=l>>6&63|128,r[i++]=l&63|128)}this.buf=r}}readLong(){let t=0,e=0,r=this.buf,i,a,c,l;do i=r[this.pos++],a=i&128,t|=(i&127)<>1^-(t&1)}skipLong(){let t=this.buf;for(;t[this.pos++]&128;);}readTags(){let t=[],e;for(;e=this.readLong();)for(e<0&&(e=-e,this.skipLong());e--;){let r=this.readString(),i=this.readString();t.push({name:r,value:i})}return t}readString(){let t=this.readLong(),e=this.pos,r=this.buf;if(this.pos+=t,!(this.pos>r.length))return this.buf.slice(e,e+t).toString()}};function Bn(t){let e=new Oe;return e.writeTags(t),e.toBuffer()}function Nn(t){let e=new Oe;return e.writeTags(t),e.tagsExceedLimit()}function Je(t){return new Oe(t).readTags()}function Ht(t){let e=0;for(let r=t.length-1;r>=0;r--)e=e*256+t[r];return e}function qo(t){if(t>29)throw new Error("Short too long");let e=[0,0];for(let r=0;rDt.default.encode(await this.rawId))()}set id(t){this._id=Dt.default.toBuffer(t)}get rawId(){return(async()=>ie.Buffer.from(await Ho.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(t){this._id=t}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return Dt.default.encode(this.rawSignature)}set rawOwner(t){if(t.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${t.byteLength} bytes.`);this.binary.set(t,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return me[this.signatureType].sigLength}get owner(){return Dt.default.encode(this.rawOwner)}get ownerLength(){return me[this.signatureType].pubLength}get rawTarget(){let t=this.getTargetStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):ie.Buffer.alloc(0)}get target(){return Dt.default.encode(this.rawTarget)}get rawAnchor(){let t=this.getAnchorStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):ie.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let t=this.getTagsStart(),e=Ht(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){let t=this.getTagsStart();if(Ht(this.binary.subarray(t,t+8))==0)return[];let e=Ht(this.binary.subarray(t+8,t+16));return Je(ie.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map(t=>({name:Dt.default.encode(t.name),value:Dt.default.encode(t.value)}))}getStartOfData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=Ht(e);return t+16+r}get rawData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=Ht(e),i=t+16+r;return this.binary.subarray(i,this.binary.length)}get data(){return Dt.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await Go(this,t),this.rawId}async setSignature(t){this.binary.set(t,2),this._id=ie.Buffer.from(await Vt().hash(t))}isSigned(){var t;return(((t=this._id)==null?void 0:t.length)??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(t=>({name:Dt.default.encode(t.name),value:Dt.default.encode(t.value)})),data:this.data}}static async verify(t){if(t.byteLengthhr)return!1;if(a>0)try{if(Je(ie.Buffer.from(t.subarray(i+16,i+16+l))).length!==a)return!1}catch{return!1}let n=Ln[r],p=await ze(e);return await n.verify(e.rawOwner,p,e.rawSignature)}async getSignatureData(){return ze(this)}getTagsStart(){let t=this.getTargetStart(),e=this.binary[t]==1,r=t+(e?33:1),i=this.binary[r]==1;return r+=i?33:1,r}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let t=this.getTargetStart()+1,e=this.binary[this.getTargetStart()]==1;return t+=e?32:0,t}},zo=re(cr(),1);function Un(t,e,r){var x,v;let i=e.publicKey,a=r!=null&&r.target?zo.default.toBuffer(r.target):null,c=1+((a==null?void 0:a.byteLength)??0),l=r!=null&&r.anchor?Ct.Buffer.from(r.anchor):null,n=1+((l==null?void 0:l.byteLength)??0),p=(((x=r==null?void 0:r.tags)==null?void 0:x.length)??0)>0?Bn(r.tags):null,S=16+(p?p.byteLength:0),E=Ct.Buffer.from(t),L=E.byteLength,y=2+e.signatureLength+e.ownerLength+c+n+S+L,k=Ct.Buffer.alloc(y);if(k.set(qo(e.signatureType),0),k.set(new Uint8Array(e.signatureLength).fill(0),2),i.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${i.byteLength}`);k.set(i,2+e.signatureLength);let b=2+e.signatureLength+e.ownerLength;if(k[b]=a?1:0,a){if(a.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${a.byteLength}`);k.set(a,b+1)}let U=b+c,C=U+1;if(k[U]=l?1:0,l){if(C+=l.byteLength,l.byteLength!==32)throw new Error("Anchor must be 32 bytes");k.set(l,U+1)}k.set(Or(((v=r==null?void 0:r.tags)==null?void 0:v.length)??0),C);let K=Or((p==null?void 0:p.byteLength)??0);k.set(K,C+8),p&&k.set(p,C+16);let z=C+S;return k.set(E,z),new xe(k)}var Jo={...Cn};globalThis.arbundles??(globalThis.arbundles=Jo);var Qo=class{constructor(t,e){j(this,"signer");j(this,"bundlerSigner");j(this,"type");j(this,"warp");j(this,"signatureProviderType");j(this,"wallet");j(this,"cachedAddress");this.warp=t,this.isCustomSignature(e)?(this.assertEnvForCustomSigner(e.type),this.signer=e.signer,this.type=e.type,this.signatureProviderType="CustomSignature"):this.isValidBundlerSignature(e)?(this.signatureProviderType="BundlerSigner",this.type=Yo(e.signatureType),this.bundlerSigner=e):(this.assignArweaveSigner(e),this.bundlerSigner=typeof e=="string"?null:new ur(e),this.signatureProviderType="ArWallet",this.type="arweave"),this.wallet=e}async getAddress(){if(this.cachedAddress)return this.cachedAddress;switch(this.signatureProviderType){case"CustomSignature":return this.wallet.getAddress?this.cachedAddress=await this.wallet.getAddress():this.cachedAddress=await this.deduceSignerBySigning(),this.cachedAddress;case"ArWallet":return this.cachedAddress=await this.deduceSignerBySigning(),this.cachedAddress;case"BundlerSigner":return this.cachedAddress=await this.deduceSignerBySigning(),this.cachedAddress;default:throw Error("Unknown Signature::signatureProvider : "+this.signatureProviderType)}}async deduceSignerBySigning(){let{arweave:t}=this.warp;if(this.signatureProviderType=="BundlerSigner")try{return await this.bundlerSigner.getAddress()}catch{throw new Error("Could not get address from the signer. Is the 'getAddress' implementation correct?'")}else if(this.signatureProviderType=="ArWallet"||this.signatureProviderType=="CustomSignature"){let e=await t.createTransaction({data:Math.random().toString().slice(-4),reward:"72600854",last_tx:"p7vc1iSP6bvH_fCeUFa9LqoV5qiyW-jdEKouAT0XMoSwrNraB9mgpi29Q10waEpO"});return await this.signer(e),t.wallets.ownerToAddress(e.owner)}else throw Error("Unknown Signature::type")}checkNonArweaveSigningAvailability(t){if(this.type!=="arweave"&&!t)throw new Error(`Unable to use signing function of type: ${this.type} when bundling is disabled.`)}checkBundlerSignerAvailability(t){if((!t||this.warp.environment=="local")&&this.signatureProviderType=="BundlerSigner")throw new Error("Only wallet of type 'ArWallet' or 'CustomSignature' is allowed when bundling is disabled or in local environment.")}assignArweaveSigner(t){this.signer=async e=>{await this.warp.arweave.transactions.sign(e,t)}}assertEnvForCustomSigner(t){if(this.warp.interactionsLoader.type()==="warp")throw new Error("Unable to use signing function when bundling is enabled.");if(t=="ethereum")throw new Error(`Unable to use signing function with signature of type: ${t}.`)}isCustomSignature(t){return t.signer!==void 0&&t.type!==void 0}isValidBundlerSignature(t){let e=t,r=!!e.signatureType&&!!e.ownerLength&&!!e.signatureLength;if(r&&!e.publicKey)throw new Error("It seems that you are using BundlerSigner, but publicKey is not set! Maybe try calling await bundlerSigner.setPublicKey() before using it.");return r}};function Yo(t){if(t===3)return"ethereum";if(t===1)return"arweave";throw Error(`Not supported arbundle SignatureType : ${t}`)}at();var Xo=class{constructor(t,e){j(this,"rootOptions");j(this,"saferEvaluationOptions",{internalWrites:t=>{if(t.internalWrites===void 0||this.rootOptions.internalWrites==t.internalWrites)return this.rootOptions.internalWrites;if(this.rootOptions.internalWrites&&!t.internalWrites||!this.rootOptions.internalWrites&&t.internalWrites)return t.internalWrites;throw new Error('Could not determine "internalWrites" value ')},throwOnInternalWriteError:t=>t.throwOnInternalWriteError===void 0?this.rootOptions.throwOnInternalWriteError:t.throwOnInternalWriteError,unsafeClient:t=>{if(t.unsafeClient===void 0||this.rootOptions.unsafeClient==t.unsafeClient)return this.rootOptions.unsafeClient;if(this.rootOptions.unsafeClient==="throw"||this.rootOptions.unsafeClient==="skip")return this.rootOptions.unsafeClient;if(this.rootOptions.unsafeClient==="allow")return t.unsafeClient==="throw"?"skip":t.unsafeClient;throw new Error('Could not determine "unsafeClient" value')},ignoreExceptions:t=>{if(t.ignoreExceptions===void 0||this.rootOptions.ignoreExceptions==t.ignoreExceptions)return this.rootOptions.ignoreExceptions;if(this.rootOptions.ignoreExceptions&&!t.ignoreExceptions)return this.rootOptions.ignoreExceptions;if(!this.rootOptions.ignoreExceptions&&t.ignoreExceptions)return this.rootOptions.ignoreExceptions;throw new Error('Could not determine "ignoreExceptions" value')},waitForConfirmation:()=>this.rootOptions.waitForConfirmation,updateCacheForEachInteraction:()=>this.rootOptions.updateCacheForEachInteraction,maxCallDepth:()=>this.rootOptions.maxCallDepth,maxInteractionEvaluationTimeSeconds:()=>this.rootOptions.maxInteractionEvaluationTimeSeconds,stackTrace:()=>this.rootOptions.stackTrace,sourceType:()=>this.rootOptions.sourceType,sequencerUrl:()=>this.rootOptions.sequencerUrl,gasLimit:()=>this.rootOptions.gasLimit,allowBigInt:()=>this.rootOptions.allowBigInt,walletBalanceUrl:()=>this.rootOptions.walletBalanceUrl,mineArLocalBlocks:()=>this.rootOptions.mineArLocalBlocks,cacheEveryNInteractions:()=>this.rootOptions.cacheEveryNInteractions,remoteStateSyncEnabled:()=>this.rootOptions.remoteStateSyncEnabled,remoteStateSyncSource:()=>this.rootOptions.remoteStateSyncSource,useKVStorage:t=>t.useKVStorage,useConstructor:t=>t.useConstructor,whitelistSources:()=>this.rootOptions.whitelistSources});j(this,"notConflictingEvaluationOptions",["useKVStorage","sourceType","useConstructor"]);if(e){let r=[];for(let i in e){if(!t.hasOwnProperty(i))throw new Error("Unknown option set in contract's manifest. You probably need to update the Warp SDK version.");let a=i,c=e[i],l=t[i];if(!this.notConflictingEvaluationOptions.includes(a))if(a==="internalWrites"){if(l===!1&&c===!0)throw new Error("Cannot proceed with contract evaluation. User is blocking internal writes, while contract requires them.")}else if(a==="unsafeClient"){if(l==="throw"&&c!=="throw"||l==="skip"&&c==="allow")throw new Error(`Cannot proceed with contract evaluation. User requires to ${l} on any unsafeClient usage, while contract uses ${c} option.`)}else t[i]!==e[i]&&r.push(`Option {${i}} differs. EvaluationOptions: [${t[i]}], manifest: [${e[i]}]. Use contract.setEvaluationOptions({${i}: ${e[i]}}) to evaluate contract state.`)}if(r.length)throw new Error(r.join(` `))}this.rootOptions=Object.freeze(Object.assign({},t,e||{}))}forForeignContract(t){let e=Te(this.rootOptions);if(t)for(let r in t)e[r]=this.saferEvaluationOptions[r](t);return Object.freeze(e)}};at();var Zo=class{constructor(t){j(this,"name","WarpFetchWrapper");j(this,"logger",xt.INST.create(this.name));this.warp=t,this.warp=t}fetch(t,e){let r;if(this.warp.hasPlugin("fetch-options")){let i=this.warp.loadPlugin("fetch-options");try{let a=i.process({input:t,init:e||{}});r={...e,...a}}catch(a){throw a.message&&this.logger.error(a.message),new Error(`Unable to process fetch options: ${a.message}`)}}else r=e;return fetch(t,r)}};at();var ts=new Error("request for lock canceled"),es=function(t,e,r,i){function a(c){return c instanceof r?c:new r(function(l){l(c)})}return new(r||(r=Promise))(function(c,l){function n(E){try{S(i.next(E))}catch(L){l(L)}}function p(E){try{S(i.throw(E))}catch(L){l(L)}}function S(E){E.done?c(E.value):a(E.value).then(n,p)}S((i=i.apply(t,e||[])).next())})},rs=class{constructor(t,e=ts){this._value=t,this._cancelError=e,this._weightedQueues=[],this._weightedWaiters=[]}acquire(t=1){if(t<=0)throw new Error(`invalid weight ${t}: must be positive`);return new Promise((e,r)=>{this._weightedQueues[t-1]||(this._weightedQueues[t-1]=[]),this._weightedQueues[t-1].push({resolve:e,reject:r}),this._dispatch()})}runExclusive(t,e=1){return es(this,void 0,void 0,function*(){let[r,i]=yield this.acquire(e);try{return yield t(r)}finally{i()}})}waitForUnlock(t=1){if(t<=0)throw new Error(`invalid weight ${t}: must be positive`);return new Promise(e=>{this._weightedWaiters[t-1]||(this._weightedWaiters[t-1]=[]),this._weightedWaiters[t-1].push(e),this._dispatch()})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(t){this._value=t,this._dispatch()}release(t=1){if(t<=0)throw new Error(`invalid weight ${t}: must be positive`);this._value+=t,this._dispatch()}cancel(){this._weightedQueues.forEach(t=>t.forEach(e=>e.reject(this._cancelError))),this._weightedQueues=[]}_dispatch(){var t;for(let e=this._value;e>0;e--){let r=(t=this._weightedQueues[e-1])===null||t===void 0?void 0:t.shift();if(!r)continue;let i=this._value,a=e;this._value-=e,e=this._value+1,r.resolve([i,this._newReleaser(a)])}this._drainUnlockWaiters()}_newReleaser(t){let e=!1;return()=>{e||(e=!0,this.release(t))}}_drainUnlockWaiters(){for(let t=this._value;t>0;t--)this._weightedWaiters[t-1]&&(this._weightedWaiters[t-1].forEach(e=>e()),this._weightedWaiters[t-1]=[])}},ns=function(t,e,r,i){function a(c){return c instanceof r?c:new r(function(l){l(c)})}return new(r||(r=Promise))(function(c,l){function n(E){try{S(i.next(E))}catch(L){l(L)}}function p(E){try{S(i.throw(E))}catch(L){l(L)}}function S(E){E.done?c(E.value):a(E.value).then(n,p)}S((i=i.apply(t,e||[])).next())})},is=class{constructor(t){this._semaphore=new rs(1,t)}acquire(){return ns(this,void 0,void 0,function*(){let[,t]=yield this._semaphore.acquire();return t})}runExclusive(t){return this._semaphore.runExclusive(()=>t())}isLocked(){return this._semaphore.isLocked()}waitForUnlock(){return this._semaphore.waitForUnlock()}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}};at();at();var as=class{constructor(t){j(this,"cache");j(this,"capacity");this.cache=new Map,this.capacity=t||10}has(t){return this.cache.has(t)}size(){return this.cache.size}get(t){if(!this.cache.has(t))return null;let e=this.cache.get(t);return this.cache.delete(t),this.cache.set(t,e),e}set(t,e){this.cache.delete(t),this.cache.size===this.capacity?(this.cache.delete(this.cache.keys().next().value),this.cache.set(t,e)):this.cache.set(t,e)}keys(){return Array.from(this.cache.keys())}},Lr=class{constructor(t){j(this,"_json",new Map);j(this,"_initialJson",new Map);j(this,"_kv",new Map);this._warp=t}has(t,e){var r;return((r=this._json.get(t))==null?void 0:r.has(e))||!1}get(t,e){var r;return((r=this._json.get(t))==null?void 0:r.get(e))||null}getLessOrEqual(t,e){let r=this._json.get(t);if(r!=null&&r.size()>0){let i=r.keys();e&&(i=i.filter(c=>c.localeCompare(e)<=0)),i=i.sort((c,l)=>c.localeCompare(l));let a=i[i.length-1];if(r.get(a))return new Pt(a,r.get(a))}return null}async getKV(t,e){var r;return this._kv.has(t)&&((r=await this._kv.get(t).get(e))==null?void 0:r.cachedValue)||null}async delKV(t,e){this._kv.has(t)&&await this._kv.get(t).del(e)}getKvKeys(t,e,r){return this._warp.kvStorageFactory(t).keys(e,r)}getKvRange(t,e,r){return this._warp.kvStorageFactory(t).kvMap(e,r)}async commit(t,e=!1){if(t.dry)return await this.rollbackKVs(),this.reset();try{let r=new Map;this._json.forEach((i,a)=>{let c=this.getLessOrEqual(a,t.sortKey);c!=null&&r.set(a,c.cachedValue)}),await this.doStoreJson(r,t,e),await this.commitKVs()}finally{this.reset()}}async commitKV(){await this.commitKVs(),this._kv.clear()}async rollback(t,e){try{await this.doStoreJson(this._initialJson,t,e),await this.rollbackKVs()}finally{this.reset()}}setInitial(t,e,r){this._initialJson.set(t,e),this.update(t,e,r)}update(t,e,r){if(!this._json.has(t)){let i=new as(10);this._json.set(t,i)}this._json.get(t).set(r,e)}async updateKV(t,e,r){await(await this.getOrInitKvStorage(t)).put(e,r)}async getOrInitKvStorage(t){if(this._kv.has(t))return this._kv.get(t);let e=this._warp.kvStorageFactory(t);return this._kv.set(t,e),await e.open(),e}reset(){this._json.clear(),this._initialJson.clear(),this._kv.clear()}async doStoreJson(t,e,r=!1){if(t.size>1||r)for(let[i,a]of t)await this._warp.stateEvaluator.putInCache(i,e,a)}async rollbackKVs(){for(let t of this._kv.values())try{await t.rollback()}finally{await t.close()}}async commitKVs(){for(let t of this._kv.values())try{await t.commit()}finally{await t.close()}}},os=Lt(te()),$n=class{constructor(t,e,r=null,i=null){j(this,"logger",xt.INST.create("HandlerBasedContract"));j(this,"ecLogger",xt.INST.create("ExecutionContext"));j(this,"_innerWritesEvaluator",new ko);j(this,"_callDepth");j(this,"_arweaveWrapper");j(this,"_mutex",new is);j(this,"_callStack");j(this,"_evaluationOptions");j(this,"_eoEvaluator");j(this,"_benchmarkStats",null);j(this,"_sorter");j(this,"_rootSortKey");j(this,"_signature");j(this,"_warpFetchWrapper");j(this,"_children",[]);j(this,"_interactionState");j(this,"_dreStates",new Map);var a,c;if(this._contractTxId=t,this.warp=e,this._parentContract=r,this._innerCallData=i,this.waitForConfirmation=this.waitForConfirmation.bind(this),this._arweaveWrapper=new le(e),this._sorter=new ar(e.arweave),r!=null){this._evaluationOptions=this.getRoot().evaluationOptions(),this._callDepth=r.callDepth()+1;let l=r.getCallStack().getInteraction(i.callingInteraction.id);if(this._callDepth>this._evaluationOptions.maxCallDepth)throw new Error(`Max call depth of ${this._evaluationOptions.maxCallDepth} has been exceeded for interaction ${JSON.stringify(l.interactionInput)}`);if(this.logger.debug("Calling interaction",{id:i.callingInteraction.id,sortKey:i.callingInteraction.sortKey,type:i.callType}),((c=(a=l.interactionInput)==null?void 0:a.foreignContractCalls[t])==null?void 0:c.innerCallType)==="write"&&i.callType==="read")throw new Error("Calling a readContractState after performing an inner write is wrong - instead use a state from the result of an internal write.");let n=new De(t,this._callDepth,i==null?void 0:i.callType);l.interactionInput.foreignContractCalls[t]=n,this._callStack=n,this._rootSortKey=r.rootSortKey,r._children.push(this)}else this._callDepth=0,this._callStack=new De(t,0),this._rootSortKey=null,this._evaluationOptions=new La,this._children=[],this._interactionState=new Lr(e);this.getCallStack=this.getCallStack.bind(this),this._warpFetchWrapper=new Zo(this.warp)}async readState(t,e,r){var l,n,p;if(this.logger.info("Read state for",{contractTxId:this._contractTxId,sortKeyOrBlockHeight:t}),!this.isRoot()&&t==null)throw new Error("SortKey MUST be always set for non-root contract calls");let{stateEvaluator:i}=this.warp,a=typeof t=="number"?this._sorter.generateLastSortKey(t):t;if(a&&!this.isRoot()&&this.interactionState().has(this.txId(),a)){let S=this.interactionState().get(this.txId(),a);return new Pt(a,S)}let c=await this._mutex.acquire();try{let S=It.measure();this.maybeResetRootContract();let E=await this.createExecutionContext(this._contractTxId,a,!1,r);this.logger.info("Execution Context",{srcTxId:(l=E.contractDefinition)==null?void 0:l.srcTxId,missingInteractions:(n=E.sortedInteractions)==null?void 0:n.length,cachedSortKey:(p=E.cachedState)==null?void 0:p.sortKey}),S.stop();let L=It.measure(),y=await i.eval(E);L.stop();let k=S.elapsed(!0)+L.elapsed(!0);return this._benchmarkStats={gatewayCommunication:S.elapsed(!0),stateEvaluation:L.elapsed(!0),total:k},this.logger.info("Benchmark",{"Gateway communication ":S.elapsed(),"Contract evaluation ":L.elapsed(),"Total: ":`${k.toFixed(0)}ms`}),a&&!this.isRoot()&&this.interactionState().update(this.txId(),y.cachedValue,a),y}finally{c()}}async readStateFor(t,e){return this.readState(t,void 0,e)}async viewState(t,e=[],r=ne,i){return this.logger.info("View state for",this._contractTxId),await this.callContract(t,"view",i,void 0,e,r)}async viewStateForTx(t,e){return this.logger.info(`View state for ${this._contractTxId}`),await this.doApplyInputOnTx(t,e,"view")}async dryWrite(t,e,r,i,a){return this.logger.info("Dry-write for",this._contractTxId),await this.callContract(t,"write",e,void 0,r,i,void 0,a)}async applyInput(t,e){return this.logger.info(`Apply-input from transaction ${e.id} for ${this._contractTxId}`),await this.doApplyInputOnTx(t,e,"write")}async writeInteraction(t,e){if(this.logger.info("Write interaction",{input:t,options:e}),!this._signature)throw new Error("Wallet not connected. Use 'connect' method first.");let{arweave:r,interactionsLoader:i,environment:a}=this.warp;await this.warp.definitionLoader.load(this._contractTxId);let c=(e==null?void 0:e.tags)||[],l=(e==null?void 0:e.transfer)||ne,n=(e==null?void 0:e.strict)===!0,p=(e==null?void 0:e.vrf)===!0,S=(e==null?void 0:e.disableBundling)===!0,E=e==null?void 0:e.reward,L=i.type()=="warp"&&!S;if(this._signature.checkNonArweaveSigningAvailability(L),this._signature.checkBundlerSignerAvailability(L),L&&l.target!=ne.target&&l.winstonQty!=ne.winstonQty)throw new Error("Ar Transfers are not allowed for bundled interactions");if(p&&!L&&a==="mainnet")throw new Error("Vrf generation is only available for bundle interaction");if(!t)throw new Error(`Input should be a truthy value: ${JSON.stringify(t)}`);if(L)return await this.bundleInteraction(t,{tags:c,strict:n,vrf:p});{let y=await this.createInteraction(t,c,l,n,!1,p&&a!=="mainnet",E),k=await r.transactions.post(y);if(k.status!==200)return this.logger.error("Error while posting transaction",k),null;if(this._evaluationOptions.waitForConfirmation){this.logger.info("Waiting for confirmation of",y.id);let b=It.measure();await this.waitForConfirmation(y.id),this.logger.info("Transaction confirmed after",b.elapsed())}return this.warp.environment=="local"&&this._evaluationOptions.mineArLocalBlocks&&await this.warp.testing.mineBlock(),{originalTxId:y.id,interactionTx:y}}}async bundleInteraction(t,e){this.logger.info("Bundle interaction input",t);let r=await this.createInteractionDataItem(t,e.tags,ne,e.strict,e.vrf),i=this._warpFetchWrapper.fetch(`${we(this._evaluationOptions.sequencerUrl)}/gateway/v2/sequencer/register`,{method:"POST",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},body:r.getRaw()}),a=await r.id;return{bundlrResponse:await Zt(i),originalTxId:a,interactionTx:r}}async createInteractionDataItem(t,e,r,i,a=!1){var S;this._evaluationOptions.internalWrites&&await this.discoverInternalWrites(t,e,r,i,a),a&&e.push(new $t(_t.REQUEST_VRF,"true"));let c=xn(this._contractTxId,t,this.warp.environment==="testnet",e);if(Nn(c))throw new Error("Interaction tags exceed limit of 4096 bytes.");let l=Math.random().toString().slice(-4),n=this._signature.bundlerSigner;if(!n)throw new Error("Signer not set correctly. If you connect wallet through 'use_wallet', please remember that it only works when bundling is disabled.");let p;return or()&&((S=n.signer)!=null&&S.signDataItem)?p=await n.signDataItem(l,c):(p=Un(l,n,{tags:c}),await p.sign(n)),!this._evaluationOptions.internalWrites&&i&&await this.checkInteractionInStrictMode(p.owner,t,e,r,i,a),p}async createInteraction(t,e,r,i,a=!1,c=!1,l){this._evaluationOptions.internalWrites&&await this.discoverInternalWrites(t,e,r,i,c),c&&e.push(new $t(_t.REQUEST_VRF,"true"));let n=await Ir(this.warp.arweave,this._signature.signer,this._contractTxId,t,e,r.target,r.winstonQty,a,this.warp.environment==="testnet",l);return!this._evaluationOptions.internalWrites&&i&&await this.checkInteractionInStrictMode(n.owner,t,e,r,i,c),n}async checkInteractionInStrictMode(t,e,r,i,a,c){let{arweave:l}=this.warp,n=this._signature.type=="arweave"?await l.wallets.ownerToAddress(t):await this._signature.getAddress(),p=await this.callContract(e,"write",n,void 0,r,i,a,c);if(p.type!=="ok")throw Error("Cannot create interaction: "+JSON.stringify(p.error||p.errorMessage))}txId(){return this._contractTxId}getCallStack(){return this._callStack}connect(t){return this._signature=new Qo(this.warp,t),this}setEvaluationOptions(t){if(!this.isRoot())throw new Error("Evaluation options can be set only for the root contract");return this._evaluationOptions={...this._evaluationOptions,...t},this}async waitForConfirmation(t){let{arweave:e}=this.warp,r=await e.transactions.getStatus(t);return r.confirmed===null?(this.logger.info(`Transaction ${t} not yet confirmed. Waiting another 20 seconds before next check.`),await un(2e4),this.waitForConfirmation(t)):(this.logger.info(`Transaction ${t} confirmed`,r),r)}async createExecutionContext(t,e,r=!1,i){var U,C,K,z;let{definitionLoader:a,interactionsLoader:c,stateEvaluator:l}=this.warp,n,p=It.measure();this.isRoot()||(n=this.interactionState().getLessOrEqual(this.txId(),e)),n=n||await l.latestAvailableState(t,e),this.logger.debug("cache lookup",p.elapsed()),p.reset();let S=Se.evolvedSrcTxId((U=n==null?void 0:n.cachedValue)==null?void 0:U.state),E,L,y,k,b=i||[];if(this.logger.debug("Cached state",n,e),n&&n.sortKey==e)this.logger.debug("State fully cached, not loading interactions."),(r||S||i!=null&&i.length)&&(L=await a.load(t,S),i!=null&&i.length&&(b=(await this._sorter.sort(i.map(x=>({node:x,cursor:null})))).map(x=>x.node)));else{if(i!=null&&i.length)throw new Error(`Cannot apply requested interactions at ${e}`);if(L=await a.load(t,S),y=this.resolveEvaluationOptions((C=L.manifest)==null?void 0:C.evaluationOptions),y.remoteStateSyncEnabled&&!y.useKVStorage){k=await this.getRemoteContractState(t),n=await this.maybeSyncStateWithRemoteSource(k,e,n);let x=Se.evolvedSrcTxId((K=n==null?void 0:n.cachedValue)==null?void 0:K.state);x&&x!==L.srcTxId&&(L=await a.load(t,x))}this.warp.executorFactory.checkWhiteListContractSources(L,y),!k&&b.length==0&&(b=await c.load(t,n==null?void 0:n.sortKey,this.getToSortKey(e),y)),n!=null&&n.sortKey&&(b=b.filter(x=>x.sortKey.localeCompare(n==null?void 0:n.sortKey)>0)),e&&(b=b.filter(x=>x.sortKey.localeCompare(e)<=0)),this.logger.debug("contract and interactions load",p.elapsed()),this.isRoot()&&b.length&&(this._rootSortKey=b[b.length-1].sortKey)}return L&&(y||(y=this.resolveEvaluationOptions((z=L.manifest)==null?void 0:z.evaluationOptions)),this.ecLogger.debug(`Evaluation options ${t}:`,y),E=await this.warp.executorFactory.create(L,y,this.warp,this.interactionState())),{warp:this.warp,contract:this,contractDefinition:L,sortedInteractions:b,evaluationOptions:y||this.evaluationOptions(),handler:E,cachedState:n,requestedSortKey:e}}resolveEvaluationOptions(t){return this.isRoot()?(this._eoEvaluator=new Xo(this.evaluationOptions(),t),this._eoEvaluator.rootOptions):this.getRootEoEvaluator().forForeignContract(t)}async getRemoteContractState(t){if(this.hasDreState(t))return this.getDreState(t);{let e=await this.fetchRemoteContractState(t);return e!=null?this.setDREState(t,e):null}}async fetchRemoteContractState(t){return Zt(this._warpFetchWrapper.fetch(`${this._evaluationOptions.remoteStateSyncSource}?id=${t}&events=false`))}getToSortKey(t){var e;return(e=this._parentContract)!=null&&e.rootSortKey?t?this._parentContract.rootSortKey.localeCompare(t)>0?this._parentContract.rootSortKey:t:this._parentContract.rootSortKey:t}async createExecutionContextFromTx(t,e){let r=e.owner.address,i=e.sortKey;return{...await this.createExecutionContext(t,i,!0),caller:r}}maybeResetRootContract(){this.isRoot()&&(this.logger.debug("Clearing call stack for the root contract"),this._callStack=new De(this.txId(),0),this._rootSortKey=null,this.warp.interactionsLoader.clearCache(),this._children=[],this._interactionState=new Lr(this.warp),this._dreStates=new Map)}async callContract(t,e,r,i,a=[],c=ne,l=!1,n=!1,p=!0){var x;this.logger.info("Call contract input",t),this.maybeResetRootContract(),this._signature||this.logger.warn("Wallet not set.");let{arweave:S,stateEvaluator:E}=this.warp,L=await this.createExecutionContext(this._contractTxId,i,!0),y=this.warp.environment=="mainnet"&&this.warp.interactionsLoader.type()!=="arweave"?await this._arweaveWrapper.warpGwBlock():await S.blocks.getCurrent(),k;r?k=r:this._signature?k=await this._signature.getAddress():k="",this.logger.info("effectiveCaller",k),L={...L,caller:k};let b=await E.eval(L);this.logger.info("Current state",b.cachedValue.state);let U={input:t,caller:L.caller,interactionType:e};this.logger.debug("interaction",U);let C=await Ir(S,p?(x=this._signature)==null?void 0:x.signer:void 0,this._contractTxId,t,a,c.target,c.winstonQty,!0,this.warp.environment==="testnet"),K=xo(C,L.caller,y);if(this.logger.debug("Creating sortKey for",{blockId:K.block.id,id:K.id,height:K.block.height}),K.sortKey=await this._sorter.createSortKey(K.block.id,K.id,K.block.height,!0),K.strict=l,n){let v=this.warp.maybeLoadPlugin("vrf");v?K.vrf=v.process().generateMockVrf(K.sortKey):this.logger.warn('Cannot generate mock vrf for interaction - no "warp-contracts-plugin-vrf" attached!')}let z=await this.evalInteraction({interaction:U,interactionTx:K},L,b.cachedValue);return z.type!=="ok"&&this.logger.fatal("Error while interacting with contract",{type:z.type,error:z.errorMessage}),z}async doApplyInputOnTx(t,e,r){this.maybeResetRootContract();let i,a=await this.createExecutionContextFromTx(this._contractTxId,e);!this.isRoot()&&this.interactionState().has(this.txId(),e.sortKey)?i=new Pt(e.sortKey,this.interactionState().get(this.txId(),e.sortKey)):(i=await this.warp.stateEvaluator.eval(a),this.interactionState().update(this.txId(),i.cachedValue,e.sortKey)),this.logger.debug("callContractForTx - evalStateResult",{result:i.cachedValue.state,txId:this._contractTxId});let c={interaction:{input:t,caller:this._parentContract.txId(),interactionType:r},interactionTx:e},l=await this.evalInteraction(c,a,i.cachedValue);return l.originalValidity=i.cachedValue.validity,l.originalErrorMessages=i.cachedValue.errorMessages,l}async evalInteraction(t,e,r){let i=this.getCallStack().addInteractionData(t),a=It.measure();await e.handler.initState(r.state);let c=await e.handler.handle(e,r,t);return i.update({cacheHit:!1,outputState:this._evaluationOptions.stackTrace.saveState?c.state:void 0,executionTime:a.elapsed(!0),valid:c.type==="ok",errorMessage:c.errorMessage,gasUsed:c.gasUsed}),c}parent(){return this._parentContract}callDepth(){return this._callDepth}evaluationOptions(){return this._evaluationOptions}lastReadStateStats(){return this._benchmarkStats}async stateHash(t){let e=So(t),r=await os.Crypto.subtle.digest("SHA-256",Ct.Buffer.from(e,"utf-8"));return Ct.Buffer.from(r).toString("hex")}async syncState(t,e){let{stateEvaluator:r}=this.warp,i=await this._warpFetchWrapper.fetch(`${t}?${new URLSearchParams({id:this._contractTxId,...e})}`).then(a=>a.ok?a.json():Promise.reject(a)).catch(a=>{var c,l;throw(c=a.body)!=null&&c.message&&this.logger.error(a.body.message),new Error(`Unable to retrieve state. ${a.status}: ${(l=a.body)==null?void 0:l.message}`)});return await r.syncState(this._contractTxId,i.sortKey,i.state,i.validity),this}async evolve(t,e){return await this.writeInteraction({function:"evolve",value:t},e)}get rootSortKey(){return this._rootSortKey}getRootEoEvaluator(){return this.getRoot()._eoEvaluator}isRoot(){return this._parentContract==null}async getStorageValues(t){let e=await this.warp.stateEvaluator.getCache().getLast(this.txId());if(e==null)return new Pt(null,new Map);let r=this.warp.kvStorageFactory(this.txId()),i=new Map;try{await r.open();for(let a of t){let c=await r.getLessOrEqual(a,e.sortKey);i.set(a,c==null?null:c.cachedValue)}return new Pt(e.sortKey,i)}finally{await r.close()}}interactionState(){return this.getRoot()._interactionState}getRoot(){let t=this;for(;!t.isRoot();)t=t.parent();return t}async maybeSyncStateWithRemoteSource(t,e,r){let{stateEvaluator:i}=this.warp;return this.isStateHigherThanAndUpTo(t,r==null?void 0:r.sortKey,e)?await i.syncState(this._contractTxId,t.sortKey,t.cachedValue.state,t.cachedValue.validity):r}isStateHigherThanAndUpTo(t,e,r){return t&&(!r||r>=t.sortKey)&&(!e||t.sortKey>e)}setDREState(t,e){let r=new Pt(e.sortKey,new Rt(e.state,{},e.errorMessages));return this.getRoot()._dreStates.set(t,r),r}getDreState(t){return this.getRoot()._dreStates.get(t)}hasDreState(t){return this.getRoot()._dreStates.has(t)}async discoverInternalWrites(t,e,r,i,a){let c=await this.callContract(t,"write",void 0,void 0,e,r,i,a,!1);if(i&&c.type!=="ok")throw Error("Cannot create interaction: "+JSON.stringify(c.error||c.errorMessage));let l=this.getCallStack(),n=this._innerWritesEvaluator.eval(l);this.logger.debug("Input",t),this.logger.debug("Callstack",l.print()),n.forEach(p=>{e.push(new $t(_t.INTERACT_WRITE,p))}),this.logger.debug("Tags with inner calls",e)}clearChildren(){for(let t of this._children)t.clearChildren();this._children=[]}};at();var ss=class extends $n{async currentBalance(t){let e=await this.viewState({function:"balance",target:t});if(e.type!=="ok")throw Error(e.errorMessage);return e.result}async currentState(){return(await super.readState()).cachedValue.state}async transfer(t,e){return await this.writeInteraction({function:"transfer",...t},e)}};at();var ls=class{constructor(t){this.arweave=t}async mineBlock(){this.validateEnv(),await this.arweave.api.get("mine")}async addFunds(t){let e=await this.arweave.wallets.getAddress(t);await this.arweave.api.get(`/mint/${e}/1000000000000000`)}async isArlocal(){return(await fetch(`${this.arweave.api.config.protocol}://${this.arweave.api.config.host}:${this.arweave.api.config.port}/info`).then(t=>t.ok?t.json():Promise.reject()).catch(t=>{throw new Error(`Unable to get network info: ${t.message}`)})).network.includes("arlocal")}async validateEnv(){if(!await this.isArlocal())throw new Error("Testing features are not available in a non testing environment")}};at();at();var cs=class{constructor(t,e){this.baseImplementation=t,this.sourceCode=e}async create(t,e,r,i){return Object.prototype.hasOwnProperty.call(this.sourceCode,t.txId)&&(t={...t,src:this.sourceCode[t.txId]}),await this.baseImplementation.create(t,e,r,i)}checkWhiteListContractSources(t,e){return this.baseImplementation.checkWhiteListContractSources(t,e)}},us=class{constructor(t,e,r="custom"){j(this,"_definitionLoader");j(this,"_interactionsLoader");j(this,"_executorFactory");j(this,"_stateEvaluator");this._arweave=t,this._stateCache=e,this._environment=r}setDefinitionLoader(t){return this._definitionLoader=t,this}setInteractionsLoader(t){return this._interactionsLoader=t,this}setExecutorFactory(t){return this._executorFactory=t,this}setStateEvaluator(t){return this._stateEvaluator=t,this}overwriteSource(t){if(this._executorFactory==null)throw new Error("Set base ExecutorFactory first");return this._executorFactory=new cs(this._executorFactory,t),this.build()}useWarpGateway(t,e){this._interactionsLoader=new Cr(new Oa(t.confirmationStatus,t.source));let r=new Ee({...e,dbLocation:`${e.dbLocation}/contracts`}),i=new Ee({...e,dbLocation:`${e.dbLocation}/source`});return this._definitionLoader=new co(this._arweave,r,i,this._environment),this}useArweaveGateway(){return this._definitionLoader=new _n(this._arweave,this._environment),this._interactionsLoader=new Cr(new go(this._arweave,this._environment)),this}build(){let t=new Pn(this._arweave,this._definitionLoader,this._interactionsLoader,this._executorFactory,this._stateEvaluator,this._environment);return this._definitionLoader.warp=t,this._interactionsLoader.warp=t,t}};at();var hs=["^smartweave-extension-"],fs=["evm-signature-verification","subscription","ivm-handler-api","evaluation-progress","fetch-options","deploy","contract-blacklist","vm2","vrf"],Pn=class{constructor(t,e,r,i,a,c="custom"){j(this,"_createContract");j(this,"_gwUrl",gs);j(this,"testing");j(this,"kvStorageFactory");j(this,"whoAmI");j(this,"eventTarget");j(this,"plugins",new Map);this.arweave=t,this.definitionLoader=e,this.interactionsLoader=r,this.executorFactory=i,this.stateEvaluator=a,this.environment=c,this.testing=new ls(t),this.kvStorageFactory=l=>new Ee({inMemory:!1,dbLocation:`${Mn}/kv/ldb/${l}`}),this.eventTarget=new EventTarget}get createContract(){if(!this._createContract)if(this.plugins.has("deploy")){let t=this.loadPlugin("deploy");this._createContract=t.process(this)}else throw new Error("In order to use CreateContract methods please attach DeployPlugin.");return this._createContract}static builder(t,e,r){return new us(t,e,r)}contract(t,e,r){return new $n(t,this,e,r)}async deploy(t,e){return await this.createContract.deploy(t,e)}async deployFromSourceTx(t,e){return await this.createContract.deployFromSourceTx(t,e)}async deployBundled(t){return await this.createContract.deployBundled(t)}async register(t,e){return await this.createContract.register(t,e)}async createSource(t,e,r=!1){return await this.createContract.createSource(t,e,r)}async saveSource(t,e){return await this.createContract.saveSource(t,e)}pst(t){return new ss(t,this)}useStateCache(t){return this.stateEvaluator.setCache(t),this}useContractCache(t,e){return this.definitionLoader.setSrcCache(e),this.definitionLoader.setCache(t),this}use(t){let e=t.type();if(!this.isPluginType(e))throw new Error(`Unknown plugin type ${e}.`);return this.plugins.set(e,t),this}hasPlugin(t){return this.plugins.has(t)}matchPlugins(t){return[...this.plugins.keys()].filter(e=>e.match(t))}loadPlugin(t){if(!this.hasPlugin(t))throw new Error(`Plugin ${t} not registered.`);return this.plugins.get(t)}maybeLoadPlugin(t){return this.hasPlugin(t)?this.plugins.get(t):null}async close(){return Promise.all([this.definitionLoader.getSrcCache().close(),this.definitionLoader.getCache().close(),this.stateEvaluator.getCache().close()]).then()}async generateWallet(){let t=await this.arweave.wallets.generate();return await this.testing.isArlocal()&&await this.testing.addFunds(t),{jwk:t,address:await this.arweave.wallets.jwkToAddress(t)}}isPluginType(t){return fs.includes(t)||hs.some(e=>t.match(e))}useKVStorageFactory(t){return this.kvStorageFactory=t,this}useGwUrl(t){return this._gwUrl=t,this}gwUrl(){return this._gwUrl}},Fe={confirmationStatus:{notCorrupted:!0},source:"both"},gs="https://gw.warp.cc",Mn="./cache/warp",ue={inMemory:!1,dbLocation:Mn},Bs=class{static forLocal(t=1984,e=Ke.default.init({host:"localhost",port:t,protocol:"http"}),r={...ue,inMemory:!0}){return this.customArweaveGw(e,r,"local")}static forTestnet(t=ue,e=!1,r=Ke.default.init({host:"arweave.net",port:443,protocol:"https"})){return e?this.customArweaveGw(r,t,"testnet"):this.customWarpGw(r,Fe,t,"testnet")}static forMainnet(t=ue,e=!1,r=Ke.default.init({host:"arweave.net",port:443,protocol:"https"})){return e?this.customArweaveGw(r,t,"mainnet"):this.customWarpGw(r,Fe,t,"mainnet")}static custom(t,e,r){let i=new Ee({...e,dbLocation:`${e.dbLocation}/state`}),a=new ba(t),c=new wo(t,i,[new Se]);return Pn.builder(t,i,r).setExecutorFactory(a).setStateEvaluator(c)}static customArweaveGw(t,e=ue,r){return this.custom(t,e,r).useArweaveGateway().build()}static customWarpGw(t,e=Fe,r=ue,i){return this.custom(t,r,i).useWarpGateway(e,r).build()}};at();function Ns(t){let e=/(const|var) ret = makeMutClosure\(arg0, arg1, (\d+?), __wbg_adapter/;return t.match(e)[2]}at();var ds=Lt(er());function Nt(t,e,r=void 0){let i=t.find(({name:a})=>a===e);return i?i.value:r}var ps=class{constructor(t){j(this,"arweaveWrapper");j(this,"arweaveTransactions");j(this,"logger",xt.INST.create(ps.name));this.env=t}async load(t,e){let r=It.measure(),i=await this.fetchContractTx(t);this.logger.debug("Contract tx fetch time",r.elapsed());let a=i.owner.address,c=e||Nt(i.tags,At.CONTRACT_SRC_TX_ID),l=Nt(i.tags,_t.WARP_TESTNET)||null;if(l&&this.env!=="testnet")throw new Error('Trying to use testnet contract in a non-testnet env. Use the "forTestnet" factory method.');if(!l&&this.env==="testnet")throw new Error("Trying to use non-testnet contract in a testnet env.");let n=Nt(i.tags,At.MIN_FEE),p=Nt(i.tags,_t.MANIFEST)?JSON.parse(Nt(i.tags,_t.MANIFEST)):null;this.logger.debug("Tags decoding",r.elapsed());let S=await this.evalInitialState(i);this.logger.debug("init state",S);let E=JSON.parse(S);this.logger.debug("Parsing src and init state",r.elapsed());let{src:L,srcBinary:y,srcWasmLang:k,contractType:b,metadata:U,srcTx:C}=await this.loadContractSource(c),K={txId:t,srcTxId:c,src:L,srcBinary:y,srcWasmLang:k,initState:E,minFee:n,owner:a,contractType:b,metadata:U,manifest:p,contractTx:await this.convertToWarpCompatibleContractTx(i),srcTx:await this.convertToWarpCompatibleContractTx(C),testnet:l};return this.logger.info(`Contract definition loaded in: ${r.elapsed()}`),K}async fetchContractTx(t){return await this.arweaveTransactions.transaction(t)??await this.arweaveTransactions.transactionUsingUploaderTag(t)}async convertToWarpCompatibleContractTx(t){return{tags:t.tags.map(({name:e,value:r})=>({name:Ct.Buffer.from(e).toString("base64url"),value:Ct.Buffer.from(r).toString("base64url")})),owner:t.owner.key,target:t.recipient,signature:t.signature,data:(await this.arweaveWrapper.txData(t.id)).toString("base64url")}}async loadContractSource(t){let e=It.measure(),r=await this.fetchContractTx(t),i=Nt(r.tags,At.CONTENT_TYPE);if(!hn.includes(i))throw new Error(`Contract source content type ${i} not supported`);let a=i==="application/javascript"?"js":"wasm",c=await this.contractSource(r,a),l,n,p;if(a=="wasm"){if(n=new sr(c),l=Nt(r.tags,_t.WASM_LANG),!l)throw new Error(`Wasm lang not set for wasm contract src ${r.id}`);p=JSON.parse(Nt(r.tags,_t.WASM_META))}return this.logger.debug("Contract src tx load",e.elapsed()),e.reset(),{src:a=="js"?c:null,srcBinary:a=="wasm"?n.wasmBinary():null,srcWasmLang:l,contractType:a,metadata:p,srcTx:r}}async contractSource(t,e){if(Nt(t.tags,_t.UPLOADER_TX_ID)!=null){let r=await this.arweaveWrapper.txDataString(t.id);if(e==="wasm")throw new Error("WASM contracts in legacy format are not supported using AR GW");return ds.default.utils.b64UrlToString(JSON.parse(r).data)}return e==="js"?await this.arweaveWrapper.txDataString(t.id):await this.arweaveWrapper.txData(t.id)}async evalInitialState(t){if(Nt(t.tags,_t.INIT_STATE))return Nt(t.tags,_t.INIT_STATE);if(Nt(t.tags,_t.INIT_STATE_TX)){let e=Nt(t.tags,_t.INIT_STATE_TX);return this.arweaveWrapper.txDataString(e)}else return this.arweaveWrapper.txDataString(t.id)}setCache(){throw new Error("Method not implemented.")}setSrcCache(){throw new Error("Method not implemented.")}getCache(){throw new Error("Method not implemented.")}getSrcCache(){throw new Error("Method not implemented.")}type(){return"arweave"}set warp(t){this.arweaveWrapper=new le(t),this.arweaveTransactions=new Ie(t)}};at();var Br=100,ws=100,Nr=1057409,Rr=class{constructor(t,e){j(this,"logger",xt.INST.create(Rr.name));j(this,"arweaveFetcher");j(this,"arweaveWrapper");j(this,"_warp");j(this,"sorter");j(this,"tagsParser",new ee);this.arweave=t,this.environment=e,this.sorter=new ar(t)}async load(t,e,r,i){this.logger.debug("Loading interactions for",{contractId:t,fromSortKey:e,toSortKey:r});let a=this.sorter.extractBlockHeight(e)||0,c=this.sorter.extractBlockHeight(r)||await this.currentBlockHeight(),l={tags:[{name:At.APP_NAME,values:["SmartWeaveAction"]},{name:At.CONTRACT_TX_ID,values:[t]},{name:_t.SEQUENCER,values:["RedStone"]}],blockFilter:{min:a,max:c+ws},first:Br},n=It.measure(),p=await this.arweaveFetcher.transactions(l);i.internalWrites&&(p=await this.appendInternalWriteInteractions(t,a,c,p)),n.stop(),this.logger.debug("All loaded interactions:",{from:e,to:r,loaded:p.length,time:n.elapsed()}),p.forEach(y=>{var k,b,U;y.node.sortKey=y.node.sortKey??((U=(b=(k=y.node)==null?void 0:k.tags)==null?void 0:b.find(C=>C.name===_t.SEQUENCER_SORT_KEY))==null?void 0:U.value)});let S=await this.sorter.sort(p),E=this.environment==="local"||this.environment==="testnet",L=this._warp.maybeLoadPlugin("vrf");return S.filter(y=>this.isNewerThenSortKeyBlockHeight(y)).filter(y=>this.isSortKeyInBounds(e,r,y)).map(y=>this.attachSequencerDataToInteraction(y)).map(y=>this.maybeAddMockVrf(E,y,L)).map((y,k,b)=>this.verifySortKeyIntegrity(y,k,b)).map(({node:y})=>y)}verifySortKeyIntegrity(t,e,r){var i;if(e!==0){let a=r[e-1],c=r[e];if(this.logger.debug(`prev: ${a.node.id} | current: ${c.node.id}`),c.node.block.height<=Nr||((i=c.node.lastSortKey)==null?void 0:i.split(",")[1])===ln)return t;a.node.source==="redstone-sequencer"&&a.node.sortKey!==c.node.lastSortKey&&this.logger.warn(`Interaction loading error: interaction ${c.node.id} lastSortKey is not pointing on prev interaction ${a.node.id}`)}return t}isSortKeyInBounds(t,e,r){return t&&e?r.node.sortKey.localeCompare(t)>0&&r.node.sortKey.localeCompare(e)<=0:t&&!e?r.node.sortKey.localeCompare(t)>0:!t&&e?r.node.sortKey.localeCompare(e)<=0:!0}attachSequencerDataToInteraction(t){let e=E=>{var L;return(L=t.node.tags.find(y=>y.name===E))==null?void 0:L.value},r=e(_t.SEQUENCER_TX_ID),i=e(_t.SEQUENCER_OWNER),a=e(_t.SEQUENCER_BLOCK_ID),c=e(_t.SEQUENCER_BLOCK_HEIGHT),l=e(_t.SEQUENCER_PREV_SORT_KEY)||e(_t.SEQUENCER_LAST_SORT_KEY),n=e(_t.SEQUENCER_SORT_KEY),p=e(_t.SEQUENCER_BLOCK_TIMESTAMP),S=Re(c);if(!i||!a||!c||!l&&S>Nr||!r||!n)throw Error(`Interaction ${t.node.id} is not sequenced by sequencer aborting. Only Sequenced transactions are supported by loader ${Rr.name}`);return{...t,node:{...t.node,owner:{address:i,key:null},block:{...t.node.block,height:Re(c),id:a,timestamp:p?Re(p):t.node.block.timestamp},sortKey:n,lastSortKey:l,id:r,source:"redstone-sequencer"}}}async appendInternalWriteInteractions(t,e,r,i){let a={tags:[{name:_t.INTERACT_WRITE,values:[t]}],blockFilter:{min:e,max:r},first:Br},c=await this.arweaveFetcher.transactions(a);return this.logger.debug("Inner writes interactions length:",c.length),i=i.concat(c),i}maybeAddMockVrf(t,e,r){return t&&this.tagsParser.hasVrfTag(e.node)&&(r?e.node.vrf=r.process().generateMockVrf(e.node.sortKey):this.logger.warn('Cannot generate mock vrf for interaction - no "warp-contracts-plugin-vrf" attached!')),e}isNewerThenSortKeyBlockHeight(t){if(t.node.sortKey){let e=t.node.sortKey.split(",")[0],r=Number.parseInt(e);return Number(t.node.block.height)-r>=0}return!0}async currentBlockHeight(){return(await this.arweaveWrapper.info()).height}type(){return"arweave"}clearCache(){}set warp(t){this.arweaveWrapper=new le(t),this.arweaveFetcher=new Ie(t),this._warp=t}};/*! Bundled license information: ieee754/index.js: diff --git a/assets/web.bundle.min-o_8LNKIc.js b/assets/web.bundle.min-h8pB1Z2N.js similarity index 99% rename from assets/web.bundle.min-o_8LNKIc.js rename to assets/web.bundle.min-h8pB1Z2N.js index 1d66ebf..9d7f2b6 100644 --- a/assets/web.bundle.min-o_8LNKIc.js +++ b/assets/web.bundle.min-h8pB1Z2N.js @@ -13,7 +13,7 @@ ${pt.stack}`:pt.toString()}catch{return""}}(); function ContractAssert(cond, message) { if (!cond) throw new ContractError(message) }; ${a}; return handle; - `}t.normalizeContractSource=r;function u(a,s){try{let e=r(a,!1);return new Function(e)(),!0}catch(e){return s==null||s.error(e),!1}}t.checkJsSrc=u}),Vp=gt((t,i)=>{lt(),function(r){var u,a=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,s=Math.ceil,e=Math.floor,o="[BigNumber Error] ",c=o+"Number primitive has more than 15 significant digits: ",f=1e14,l=14,p=9007199254740991,g=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,m=1e9;function M(U){var P,D,W,q=X.prototype={constructor:X,toString:null,valueOf:null},O=new X(1),L=20,n=4,d=-7,v=21,A=-1e7,T=1e7,S=!1,w=1,b=0,h={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},k="0123456789abcdefghijklmnopqrstuvwxyz",tt=!0;function X(R,j){var z,Z,Q,K,G,H,Y,it,ot=this;if(!(ot instanceof X))return new X(R,j);if(j==null){if(R&&R._isBigNumber===!0){ot.s=R.s,!R.c||R.e>T?ot.c=ot.e=null:R.e=10;G/=10,K++);K>T?ot.c=ot.e=null:(ot.e=K,ot.c=[R]);return}it=String(R)}else{if(!a.test(it=String(R)))return W(ot,it,H);ot.s=it.charCodeAt(0)==45?(it=it.slice(1),-1):1}(K=it.indexOf("."))>-1&&(it=it.replace(".","")),(G=it.search(/e/i))>0?(K<0&&(K=G),K+=+it.slice(G+1),it=it.substring(0,G)):K<0&&(K=it.length)}else{if(C(j,2,k.length,"Base"),j==10&&tt)return ot=new X(R),$(ot,L+ot.e+1,n);if(it=String(R),H=typeof R=="number"){if(R*0!=0)return W(ot,it,H,j);if(ot.s=1/R<0?(it=it.slice(1),-1):1,X.DEBUG&&it.replace(/^0\.0*|\./,"").length>15)throw Error(c+R)}else ot.s=it.charCodeAt(0)===45?(it=it.slice(1),-1):1;for(z=k.slice(0,j),K=G=0,Y=it.length;GK){K=Y;continue}}else if(!Q&&(it==it.toUpperCase()&&(it=it.toLowerCase())||it==it.toLowerCase()&&(it=it.toUpperCase()))){Q=!0,G=-1,K=0;continue}return W(ot,String(R),H,j)}H=!1,it=D(it,j,10,ot.s),(K=it.indexOf("."))>-1?it=it.replace(".",""):K=it.length}for(G=0;it.charCodeAt(G)===48;G++);for(Y=it.length;it.charCodeAt(--Y)===48;);if(it=it.slice(G,++Y)){if(Y-=G,H&&X.DEBUG&&Y>15&&(R>p||R!==e(R)))throw Error(c+ot.s*R);if((K=K-G-1)>T)ot.c=ot.e=null;else if(K=-m&&Q<=m&&Q===e(Q)){if(Z[0]===0){if(Q===0&&Z.length===1)return!0;break t}if(j=(Q+1)%l,j<1&&(j+=l),String(Z[0]).length==j){for(j=0;j=f||z!==e(z))break t;if(z!==0)return!0}}}else if(Z===null&&Q===null&&(K===null||K===1||K===-1))return!0;throw Error(o+"Invalid BigNumber: "+R)},X.maximum=X.max=function(){return et(arguments,q.lt)},X.minimum=X.min=function(){return et(arguments,q.gt)},X.random=function(){var R=9007199254740992,j=Math.random()*R&2097151?function(){return e(Math.random()*R)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(z){var Z,Q,K,G,H,Y=0,it=[],ot=new X(O);if(z==null?z=L:C(z,0,m),G=s(z/l),S)if(crypto.getRandomValues){for(Z=crypto.getRandomValues(new Uint32Array(G*=2));Y>>11),H>=9e15?(Q=crypto.getRandomValues(new Uint32Array(2)),Z[Y]=Q[0],Z[Y+1]=Q[1]):(it.push(H%1e14),Y+=2);Y=G/2}else if(crypto.randomBytes){for(Z=crypto.randomBytes(G*=7);Y=9e15?crypto.randomBytes(7).copy(Z,Y):(it.push(H%1e14),Y+=7);Y=G/7}else throw S=!1,Error(o+"crypto unavailable");if(!S)for(;Y=10;H/=10,Y++);YQ-1&&(H[G+1]==null&&(H[G+1]=0),H[G+1]+=H[G]/Q|0,H[G]%=Q)}return H.reverse()}return function(z,Z,Q,K,G){var H,Y,it,ot,mt,_t,ht,vt,pt=z.indexOf("."),V=L,rt=n;for(pt>=0&&(ot=b,b=0,z=z.replace(".",""),vt=new X(Z),_t=vt.pow(z.length-pt),b=ot,vt.c=j(I(B(_t.c),_t.e,"0"),10,Q,R),vt.e=vt.c.length),ht=j(z,Z,Q,G?(H=k,R):(H=R,k)),it=ot=ht.length;ht[--ot]==0;ht.pop());if(!ht[0])return H.charAt(0);if(pt<0?--it:(_t.c=ht,_t.e=it,_t.s=K,_t=P(_t,vt,V,rt,Q),ht=_t.c,mt=_t.r,it=_t.e),Y=it+V+1,pt=ht[Y],ot=Q/2,mt=mt||Y<0||ht[Y+1]!=null,mt=rt<4?(pt!=null||mt)&&(rt==0||rt==(_t.s<0?3:2)):pt>ot||pt==ot&&(rt==4||mt||rt==6&&ht[Y-1]&1||rt==(_t.s<0?8:7)),Y<1||!ht[0])z=mt?I(H.charAt(1),-V,H.charAt(0)):H.charAt(0);else{if(ht.length=Y,mt)for(--Q;++ht[--Y]>Q;)ht[Y]=0,Y||(++it,ht=[1].concat(ht));for(ot=ht.length;!ht[--ot];);for(pt=0,z="";pt<=ot;z+=H.charAt(ht[pt++]));z=I(z,it,H.charAt(0))}return z}}(),P=function(){function R(Z,Q,K){var G,H,Y,it,ot=0,mt=Z.length,_t=Q%y,ht=Q/y|0;for(Z=Z.slice();mt--;)Y=Z[mt]%y,it=Z[mt]/y|0,G=ht*Y+it*_t,H=_t*Y+G%y*y+ot,ot=(H/K|0)+(G/y|0)+ht*it,Z[mt]=H%K;return ot&&(Z=[ot].concat(Z)),Z}function j(Z,Q,K,G){var H,Y;if(K!=G)Y=K>G?1:-1;else for(H=Y=0;HQ[H]?1:-1;break}return Y}function z(Z,Q,K,G){for(var H=0;K--;)Z[K]-=H,H=Z[K]1;Z.splice(0,1));}return function(Z,Q,K,G,H){var Y,it,ot,mt,_t,ht,vt,pt,V,rt,st,yt,Ct,dt,Mt,Lt,wt,ct=Z.s==Q.s?1:-1,Et=Z.c,ut=Q.c;if(!Et||!Et[0]||!ut||!ut[0])return new X(!Z.s||!Q.s||(Et?ut&&Et[0]==ut[0]:!ut)?NaN:Et&&Et[0]==0||!ut?ct*0:ct/0);for(pt=new X(ct),V=pt.c=[],it=Z.e-Q.e,ct=K+it+1,H||(H=f,it=E(Z.e/l)-E(Q.e/l),ct=ct/l|0),ot=0;ut[ot]==(Et[ot]||0);ot++);if(ut[ot]>(Et[ot]||0)&&it--,ct<0)V.push(1),mt=!0;else{for(dt=Et.length,Lt=ut.length,ot=0,ct+=2,_t=e(H/(ut[0]+1)),_t>1&&(ut=R(ut,_t,H),Et=R(Et,_t,H),Lt=ut.length,dt=Et.length),Ct=Lt,rt=Et.slice(0,Lt),st=rt.length;st=H/2&&Mt++;do{if(_t=0,Y=j(ut,rt,Lt,st),Y<0){if(yt=rt[0],Lt!=st&&(yt=yt*H+(rt[1]||0)),_t=e(yt/Mt),_t>1)for(_t>=H&&(_t=H-1),ht=R(ut,_t,H),vt=ht.length,st=rt.length;j(ht,rt,vt,st)==1;)_t--,z(ht,Lt=10;ct/=10,ot++);$(pt,K+(pt.e=ot+it*l-1)+1,G,mt)}else pt.e=it,pt.r=+mt;return pt}}();function ft(R,j,z,Z){var Q,K,G,H,Y;if(z==null?z=n:C(z,0,8),!R.c)return R.toString();if(Q=R.c[0],G=R.e,j==null)Y=B(R.c),Y=Z==1||Z==2&&(G<=d||G>=v)?F(Y,G):I(Y,G,"0");else if(R=$(new X(R),j,z),K=R.e,Y=B(R.c),H=Y.length,Z==1||Z==2&&(j<=K||K<=d)){for(;HH){if(--j>0)for(Y+=".";j--;Y+="0");}else if(j+=K-H,j>0)for(K+1==H&&(Y+=".");j--;Y+="0");return R.s<0&&Q?"-"+Y:Y}function et(R,j){for(var z,Z=1,Q=new X(R[0]);Z=10;Q/=10,Z++);return(z=Z+z*l-1)>T?R.c=R.e=null:z=10;H/=10,Q++);if(K=j-Q,K<0)K+=l,G=j,Y=mt[it=0],ot=Y/_t[Q-G-1]%10|0;else if(it=s((K+1)/l),it>=mt.length)if(Z){for(;mt.length<=it;mt.push(0));Y=ot=0,Q=1,K%=l,G=K-l+1}else break t;else{for(Y=H=mt[it],Q=1;H>=10;H/=10,Q++);K%=l,G=K-l+Q,ot=G<0?0:Y/_t[Q-G-1]%10|0}if(Z=Z||j<0||mt[it+1]!=null||(G<0?Y:Y%_t[Q-G-1]),Z=z<4?(ot||Z)&&(z==0||z==(R.s<0?3:2)):ot>5||ot==5&&(z==4||Z||z==6&&(K>0?G>0?Y/_t[Q-G]:0:mt[it-1])%10&1||z==(R.s<0?8:7)),j<1||!mt[0])return mt.length=0,Z?(j-=R.e+1,mt[0]=_t[(l-j%l)%l],R.e=-j||0):mt[0]=R.e=0,R;if(K==0?(mt.length=it,H=1,it--):(mt.length=it+1,H=_t[l-K],mt[it]=G>0?e(Y/_t[Q-G]%_t[G])*H:0),Z)for(;;)if(it==0){for(K=1,G=mt[0];G>=10;G/=10,K++);for(G=mt[0]+=H,H=1;G>=10;G/=10,H++);K!=H&&(R.e++,mt[0]==f&&(mt[0]=1));break}else{if(mt[it]+=H,mt[it]!=f)break;mt[it--]=0,H=1}for(K=mt.length;mt[--K]===0;mt.pop());}R.e>T?R.c=R.e=null:R.e=v?F(j,z):I(j,z,"0"),R.s<0?"-"+j:j)}return q.absoluteValue=q.abs=function(){var R=new X(this);return R.s<0&&(R.s=1),R},q.comparedTo=function(R,j){return x(this,new X(R,j))},q.decimalPlaces=q.dp=function(R,j){var z,Z,Q,K=this;if(R!=null)return C(R,0,m),j==null?j=n:C(j,0,8),$(new X(K),R+K.e+1,j);if(!(z=K.c))return null;if(Z=((Q=z.length-1)-E(this.e/l))*l,Q=z[Q])for(;Q%10==0;Q/=10,Z--);return Z<0&&(Z=0),Z},q.dividedBy=q.div=function(R,j){return P(this,new X(R,j),L,n)},q.dividedToIntegerBy=q.idiv=function(R,j){return P(this,new X(R,j),0,1)},q.exponentiatedBy=q.pow=function(R,j){var z,Z,Q,K,G,H,Y,it,ot,mt=this;if(R=new X(R),R.c&&!R.isInteger())throw Error(o+"Exponent not an integer: "+J(R));if(j!=null&&(j=new X(j)),H=R.e>14,!mt.c||!mt.c[0]||mt.c[0]==1&&!mt.e&&mt.c.length==1||!R.c||!R.c[0])return ot=new X(Math.pow(+J(mt),H?R.s*(2-N(R)):+J(R))),j?ot.mod(j):ot;if(Y=R.s<0,j){if(j.c?!j.c[0]:!j.s)return new X(NaN);Z=!Y&&mt.isInteger()&&j.isInteger(),Z&&(mt=mt.mod(j))}else{if(R.e>9&&(mt.e>0||mt.e<-1||(mt.e==0?mt.c[0]>1||H&&mt.c[1]>=24e7:mt.c[0]<8e13||H&&mt.c[0]<=9999975e7)))return K=mt.s<0&&N(R)?-0:0,mt.e>-1&&(K=1/K),new X(Y?1/K:K);b&&(K=s(b/l+2))}for(H?(z=new X(.5),Y&&(R.s=1),it=N(R)):(Q=Math.abs(+J(R)),it=Q%2),ot=new X(O);;){if(it){if(ot=ot.times(mt),!ot.c)break;K?ot.c.length>K&&(ot.c.length=K):Z&&(ot=ot.mod(j))}if(Q){if(Q=e(Q/2),Q===0)break;it=Q%2}else if(R=R.times(z),$(R,R.e+1,1),R.e>14)it=N(R);else{if(Q=+J(R),Q===0)break;it=Q%2}mt=mt.times(mt),K?mt.c&&mt.c.length>K&&(mt.c.length=K):Z&&(mt=mt.mod(j))}return Z?ot:(Y&&(ot=O.div(ot)),j?ot.mod(j):K?$(ot,b,n,G):ot)},q.integerValue=function(R){var j=new X(this);return R==null?R=n:C(R,0,8),$(j,j.e+1,R)},q.isEqualTo=q.eq=function(R,j){return x(this,new X(R,j))===0},q.isFinite=function(){return!!this.c},q.isGreaterThan=q.gt=function(R,j){return x(this,new X(R,j))>0},q.isGreaterThanOrEqualTo=q.gte=function(R,j){return(j=x(this,new X(R,j)))===1||j===0},q.isInteger=function(){return!!this.c&&E(this.e/l)>this.c.length-2},q.isLessThan=q.lt=function(R,j){return x(this,new X(R,j))<0},q.isLessThanOrEqualTo=q.lte=function(R,j){return(j=x(this,new X(R,j)))===-1||j===0},q.isNaN=function(){return!this.s},q.isNegative=function(){return this.s<0},q.isPositive=function(){return this.s>0},q.isZero=function(){return!!this.c&&this.c[0]==0},q.minus=function(R,j){var z,Z,Q,K,G=this,H=G.s;if(R=new X(R,j),j=R.s,!H||!j)return new X(NaN);if(H!=j)return R.s=-j,G.plus(R);var Y=G.e/l,it=R.e/l,ot=G.c,mt=R.c;if(!Y||!it){if(!ot||!mt)return ot?(R.s=-j,R):new X(mt?G:NaN);if(!ot[0]||!mt[0])return mt[0]?(R.s=-j,R):new X(ot[0]?G:n==3?-0:0)}if(Y=E(Y),it=E(it),ot=ot.slice(),H=Y-it){for((K=H<0)?(H=-H,Q=ot):(it=Y,Q=mt),Q.reverse(),j=H;j--;Q.push(0));Q.reverse()}else for(Z=(K=(H=ot.length)<(j=mt.length))?H:j,H=j=0;j0)for(;j--;ot[z++]=0);for(j=f-1;Z>H;){if(ot[--Z]=0;){for(z=0,_t=yt[Q]%V,ht=yt[Q]/V|0,G=Y,K=Q+G;K>Q;)it=st[--G]%V,ot=st[G]/V|0,H=ht*it+ot*_t,it=_t*it+H%V*V+vt[K]+z,z=(it/pt|0)+(H/V|0)+ht*ot,vt[K--]=it%pt;vt[K]=z}return z?++Z:vt.splice(0,1),at(R,vt,Z)},q.negated=function(){var R=new X(this);return R.s=-R.s||null,R},q.plus=function(R,j){var z,Z=this,Q=Z.s;if(R=new X(R,j),j=R.s,!Q||!j)return new X(NaN);if(Q!=j)return R.s=-j,Z.minus(R);var K=Z.e/l,G=R.e/l,H=Z.c,Y=R.c;if(!K||!G){if(!H||!Y)return new X(Q/0);if(!H[0]||!Y[0])return Y[0]?R:new X(H[0]?Z:Q*0)}if(K=E(K),G=E(G),H=H.slice(),Q=K-G){for(Q>0?(G=K,z=Y):(Q=-Q,z=H),z.reverse();Q--;z.push(0));z.reverse()}for(Q=H.length,j=Y.length,Q-j<0&&(z=Y,Y=H,H=z,j=Q),Q=0;j;)Q=(H[--j]=H[j]+Y[j]+Q)/f|0,H[j]=f===H[j]?0:H[j]%f;return Q&&(H=[Q].concat(H),++G),at(R,H,G)},q.precision=q.sd=function(R,j){var z,Z,Q,K=this;if(R!=null&&R!==!!R)return C(R,1,m),j==null?j=n:C(j,0,8),$(new X(K),R,j);if(!(z=K.c))return null;if(Q=z.length-1,Z=Q*l+1,Q=z[Q]){for(;Q%10==0;Q/=10,Z--);for(Q=z[0];Q>=10;Q/=10,Z++);}return R&&K.e+1>Z&&(Z=K.e+1),Z},q.shiftedBy=function(R){return C(R,-p,p),this.times("1e"+R)},q.squareRoot=q.sqrt=function(){var R,j,z,Z,Q,K=this,G=K.c,H=K.s,Y=K.e,it=L+4,ot=new X("0.5");if(H!==1||!G||!G[0])return new X(!H||H<0&&(!G||G[0])?NaN:G?K:1/0);if(H=Math.sqrt(+J(K)),H==0||H==1/0?(j=B(G),(j.length+Y)%2==0&&(j+="0"),H=Math.sqrt(+j),Y=E((Y+1)/2)-(Y<0||Y%2),H==1/0?j="5e"+Y:(j=H.toExponential(),j=j.slice(0,j.indexOf("e")+1)+Y),z=new X(j)):z=new X(H+""),z.c[0]){for(Y=z.e,H=Y+it,H<3&&(H=0);;)if(Q=z,z=ot.times(Q.plus(P(K,Q,it,1))),B(Q.c).slice(0,H)===(j=B(z.c)).slice(0,H))if(z.e0&&vt>0){for(K=vt%H||H,ot=ht.substr(0,K);K0&&(ot+=it+ht.slice(K)),_t&&(ot="-"+ot)}Z=mt?ot+(z.decimalSeparator||"")+((Y=+z.fractionGroupSize)?mt.replace(new RegExp("\\d{"+Y+"}\\B","g"),"$&"+(z.fractionGroupSeparator||"")):mt):ot}return(z.prefix||"")+Z+(z.suffix||"")},q.toFraction=function(R){var j,z,Z,Q,K,G,H,Y,it,ot,mt,_t,ht=this,vt=ht.c;if(R!=null&&(H=new X(R),!H.isInteger()&&(H.c||H.s!==1)||H.lt(O)))throw Error(o+"Argument "+(H.isInteger()?"out of range: ":"not an integer: ")+J(H));if(!vt)return new X(ht);for(j=new X(O),it=z=new X(O),Z=Y=new X(O),_t=B(vt),K=j.e=_t.length-ht.e-1,j.c[0]=g[(G=K%l)<0?l+G:G],R=!R||H.comparedTo(j)>0?K>0?j:it:H,G=T,T=1/0,H=new X(_t),Y.c[0]=0;ot=P(H,j,0,1),Q=z.plus(ot.times(Z)),Q.comparedTo(R)!=1;)z=Z,Z=Q,it=Y.plus(ot.times(Q=it)),Y=Q,j=H.minus(ot.times(Q=j)),H=Q;return Q=P(R.minus(z),Z,0,1),Y=Y.plus(Q.times(it)),z=z.plus(Q.times(Z)),Y.s=it.s=ht.s,K=K*2,mt=P(it,Z,K,n).minus(ht).abs().comparedTo(P(Y,z,K,n).minus(ht).abs())<1?[it,Z]:[Y,z],T=G,mt},q.toNumber=function(){return+J(this)},q.toPrecision=function(R,j){return R!=null&&C(R,1,m),ft(this,R,j,2)},q.toString=function(R){var j,z=this,Z=z.s,Q=z.e;return Q===null?Z?(j="Infinity",Z<0&&(j="-"+j)):j="NaN":(R==null?j=Q<=d||Q>=v?F(B(z.c),Q):I(B(z.c),Q,"0"):R===10&&tt?(z=$(new X(z),L+Q+1,n),j=I(B(z.c),z.e,"0")):(C(R,2,k.length,"Base"),j=D(I(B(z.c),Q,"0"),10,R,Z,!0)),Z<0&&z.c[0]&&(j="-"+j)),j},q.valueOf=q.toJSON=function(){return J(this)},q._isBigNumber=!0,U!=null&&X.set(U),X}function E(U){var P=U|0;return U>0||U===P?P:P-1}function B(U){for(var P,D,W=1,q=U.length,O=U[0]+"";Wv^D?1:-1;for(n=(d=q.length)<(v=O.length)?d:v,L=0;LO[L]^D?1:-1;return d==v?0:d>v^D?1:-1}function C(U,P,D,W){if(UD||U!==e(U))throw Error(o+(W||"Argument")+(typeof U=="number"?UD?" out of range: ":" not an integer: ":" not a primitive number: ")+String(U))}function N(U){var P=U.c.length-1;return E(U.e/l)==P&&U.c[P]%2!=0}function F(U,P){return(U.length>1?U.charAt(0)+"."+U.slice(1):U)+(P<0?"e":"e+")+P}function I(U,P,D){var W,q;if(P<0){for(q=D+".";++P;q+=D);U=q+U}else if(W=U.length,++P>W){for(q=D,P-=W;--P;q+=D);U+=q}else P{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.HandlerExecutorFactory=t.NonWhitelistedSourceError=t.ContractError=void 0;var i=zf(),r=pu(),u=fn(),a=or(),s=wa(),e=Wf(),o=qf(),c=Er(),f=Jn(),l=Vp(),p=class extends Error{constructor(E,B){super(E.toString()),this.error=E,this.subtype=B,this.name=s.KnownErrors.ContractError}};t.ContractError=p;var g=class extends Error{constructor(E){super(E.toString()),this.error=E,this.name=s.KnownErrors.NonWhitelistedSourceError}};t.NonWhitelistedSourceError=g;var y=class{constructor(E){this.arweave=E,this.logger=a.LoggerFactory.INST.create("HandlerExecutorFactory")}async create(E,B,x,C){if(x.hasPlugin("contract-blacklist")&&await this.blacklistContracts(x,E),B.whitelistSources.length>0&&!B.whitelistSources.includes(E.srcTxId))throw new g(`[NonWhitelistedSourceError] Contract source not part of whitelisted sources list: ${E.srcTxId}.`);let N=null;B.useKVStorage&&(N=x.kvStorageFactory(E.txId));let F=new r.SmartWeaveGlobal(this.arweave,{id:E.txId,owner:E.owner},B,C,N);if(x.matchPlugins("^smartweave-extension-").forEach(I=>{x.loadPlugin(I).process(F.extensions)}),E.contractType=="wasm"){this.logger.info("Creating handler for wasm contract",E.txId);let I=u.Benchmark.measure(),U,P=null,D=m(E.srcBinary);switch(E.srcWasmLang){case"rust":{let W={exports:null,modifiedExports:{wasm_bindgen__convert__closures__invoke2_mut__:null,_dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__:null}},q=await M(D,E.srcBinary),O=WebAssembly.Module.exports(q).filter(v=>v.kind==="global"&&v.name.startsWith("__WARP_CONTRACTS_VERSION_")).map(v=>v.name).shift()||"__WARP_CONTRACTS_VERSION_LEGACY",L=WebAssembly.Module.imports(q).filter(v=>v.module==="__wbindgen_placeholder__").map(v=>v.name),{imports:n,exports:d}=(0,i.rustWasmImports)(F,L,W,E.metadata.dtor,O);P=d,U=await WebAssembly.instantiate(q,n),W.exports=U.exports,Object.keys(U.exports).forEach(v=>{v.startsWith("wasm_bindgen__convert__closures__invoke2_mut__")&&(W.modifiedExports.wasm_bindgen__convert__closures__invoke2_mut__=U.exports[v]),v.startsWith("_dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__")&&(W.modifiedExports._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__=U.exports[v])});break}default:throw new Error(`Support for ${E.srcWasmLang} not implemented yet.`)}return this.logger.info(`WASM ${E.srcWasmLang} handler created in ${I.elapsed()}`),new e.WasmHandlerApi(F,E,P||U.exports)}else{let I=(0,o.normalizeContractSource)(E.src,x.hasPlugin("vm2"));if(I.includes("unsafeClient"))switch(B.unsafeClient){case"allow":{this.logger.warn(`Reading unsafe contract ${E.txId}, evaluation is non-deterministic!`);break}case"throw":throw new Error(`[SkipUnsafeError] Using unsafeClient is not allowed by default. Use EvaluationOptions.unsafeClient flag to evaluate ${E.txId}.`);case"skip":throw new p(`[SkipUnsafeError] Skipping evaluation of the unsafe contract ${E.txId}.`,"unsafeClientSkip");default:throw new Error(`Unknown unsafeClient setting ${B.unsafeClient}`)}if(!B.allowBigInt&&I.includes("BigInt"))throw new Error("Using BigInt is not allowed by default. Use EvaluationOptions.allowBigInt flag.");if(x.hasPlugin("vm2"))return x.loadPlugin("vm2").process({normalizedSource:I,swGlobal:F,logger:this.logger,contractDefinition:E});if(x.hasPlugin("ivm-handler-api"))return x.loadPlugin("ivm-handler-api").process({contractSource:E.src,evaluationOptions:B,arweave:this.arweave,swGlobal:F,contractDefinition:E});{let U=new Function(I),P=(0,c.isBrowser)()?U(F,l,a.LoggerFactory.INST.create(F.contract.id),f.Buffer,atob,btoa):U(F,l,a.LoggerFactory.INST.create(F.contract.id));return new s.JsHandlerApi(F,E,P)}}}async blacklistContracts(E,B){let x=E.loadPlugin("contract-blacklist"),C=!1;try{C=await x.process(B.txId)}catch(N){this.logger.error(N)}if(C==!0)throw new p(`[SkipUnsafeError] Skipping evaluation of the blacklisted contract ${B.txId}.`,"blacklistedSkip")}};t.HandlerExecutorFactory=y;function m(E){let B={status:200,statusText:"OK",headers:{"Content-Type":"application/wasm"}};return new Response(E,B)}async function M(E,B){return WebAssembly.compileStreaming?await WebAssembly.compileStreaming(E):await WebAssembly.compile(B)}}),$f=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.arrayToHex=void 0;function i(r){let u="";for(let a of r)u+=("0"+a.toString(16)).slice(-2);return u}t.arrayToHex=i}),Li=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.LexicographicalInteractionsSorter=t.lastPossibleSortKey=t.genesisSortKey=t.sortingLast=t.sortingFirst=t.defaultArweaveMs=void 0;var i=$f(),r=or(),u="".padEnd(13,"0"),a="".padEnd(13,"9");t.defaultArweaveMs="".padEnd(13,"0"),t.sortingFirst="".padEnd(64,"0"),t.sortingLast="".padEnd(64,"z"),t.genesisSortKey=`${"".padStart(12,"0")},${u},${t.sortingFirst}`,t.lastPossibleSortKey=`${"".padStart(12,"9")},${a},${t.sortingLast}`;var s=class{constructor(e){this.arweave=e,this.logger=r.LoggerFactory.INST.create("LexicographicalInteractionsSorter")}async sort(e){let o=[...e],c=o.map(f=>this.addSortKey(f));return await Promise.all(c),o.sort((f,l)=>f.node.sortKey.localeCompare(l.node.sortKey))}async createSortKey(e,o,c,f=!1){let l=this.arweave.utils.b64UrlToBuffer(e),p=this.arweave.utils.b64UrlToBuffer(o),g=this.arweave.utils.concatBuffers([l,p]),y=(0,i.arrayToHex)(await this.arweave.crypto.hash(g)),m=`${c}`.padStart(12,"0"),M=f?a:t.defaultArweaveMs;return`${m},${M},${y}`}extractBlockHeight(e){return e?parseInt(e.split(",")[0]):null}async addSortKey(e){let{node:o}=e,c=e.node.sortKey;c?(e.node.sortKey=c,this.logger.debug("Using sortKey from sequencer",e.node.sortKey)):e.node.sortKey=await this.createSortKey(o.block.id,o.id,o.block.height)}generateLastSortKey(e){return`${`${e}`.padStart(12,"0")},${a},${t.sortingLast}`}};t.LexicographicalInteractionsSorter=s}),wa=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.JsHandlerApi=t.KnownErrors=void 0;var i=pu(),r=Er(),u=va(),a=Li(),s=gu(),e="__init",o=(l,p)=>{let g=new Error(p);throw g.name=l,g},c;(function(l){l.ContractError="ContractError",l.ConstructorError="ConstructorError",l.NetworkCommunicationError="NetworkCommunicationError",l.NonWhitelistedSourceError="NonWhitelistedSourceError"})(c=t.KnownErrors||(t.KnownErrors={}));var f=class extends s.AbstractContractHandler{constructor(l,p,g){super(l,p),this.contractFunction=g}async handle(l,p,g){let{interaction:y,interactionTx:m}=g;return this.setupSwGlobal(g),this.enableInternalWrites(l,m),this.assertNotConstructorCall(y),await this.runContractFunction(l,y,p.state)}initState(l){}async maybeCallStateConstructor(l,p){var g,y;if(!((y=(g=this.contractDefinition.manifest)===null||g===void 0?void 0:g.evaluationOptions)===null||y===void 0)&&y.useConstructor){let m={input:{function:e,args:l},caller:this.contractDefinition.owner,interactionType:"write"},M={owner:{address:p.caller,key:null},sortKey:a.genesisSortKey},E={interaction:m,interactionTx:M};this.setupSwGlobal(E);let B=this.configureSwGlobalForConstructor(),x=await this.runContractFunction(p,m,{});if(B(),x.type!=="ok")throw p.contract.isRoot()?new Error(`ConstructorError: ${x.errorMessage}`):new u.ContractError(`ConstructorError [${p.contract.txId()}]: ${x.errorMessage}`,"constructor");return x.state}else return l}assertNotConstructorCall(l){var p,g;if(!((g=(p=this.contractDefinition.manifest)===null||p===void 0?void 0:p.evaluationOptions)===null||g===void 0)&&g.useConstructor&&l.input.function===e)throw new Error(`You have enabled {useConstructor: true} option, so you can't call function ${e}`)}configureSwGlobalForConstructor(){let l=m=>({get:(M,E)=>o("ConstructorError",`SmartWeave.${m}.${String(E)} is not accessible in constructor context`)});this.swGlobal.contracts.readContractState=()=>o("ConstructorError","Internal writes feature is not available in constructor"),this.swGlobal.contracts.viewContractState=()=>o("ConstructorError","Internal writes feature is not available in constructor"),this.swGlobal.contracts.refreshState=()=>o("ConstructorError","Internal writes feature is not available in constructor"),this.swGlobal.contracts.write=()=>o("ConstructorError","Internal writes feature is not available in constructor");let p=new i.SWBlock(this.swGlobal);this.swGlobal.block=new Proxy(this.swGlobal.block,l("block"));let g=new i.SWVrf(this.swGlobal);this.swGlobal.vrf=new Proxy(this.swGlobal.vrf,l("vrf"));let y=new i.SWTransaction(this.swGlobal);return this.swGlobal.transaction=new Proxy(this.swGlobal.vrf,l("transaction")),()=>{this.swGlobal.block=p,this.swGlobal.vrf=g,this.swGlobal.transaction=y}}async runContractFunction(l,p,g){let y=(0,r.deepCopy)(g),{timeoutId:m,timeoutPromise:M}=(0,r.timeout)(l.evaluationOptions.maxInteractionEvaluationTimeSeconds);try{await this.swGlobal.kv.open(),await this.swGlobal.kv.begin();let E=await Promise.race([M,this.contractFunction(y,p)]);if(E&&(E.state!==void 0||E.result!==void 0)){await this.swGlobal.kv.commit();let B=null;return E.event&&(B={contractTxId:this.swGlobal.contract.id,sortKey:this.swGlobal.transaction.sortKey,transactionId:this.swGlobal.transaction.id,caller:p.caller,input:p.input,blockTimestamp:this.swGlobal.block.timestamp,blockHeight:this.swGlobal.block.height,data:E.event}),{type:"ok",result:E.result,state:E.state||y,event:B}}throw new Error(`Unexpected result from contract: ${JSON.stringify(E)}`)}catch(E){switch(await this.swGlobal.kv.rollback(),E.name){case c.ContractError:return{type:"error",errorMessage:E.message,state:g,result:null,event:null};case c.ConstructorError:throw l.contract.isRoot()?Error(`ConstructorError: ${E.message}`):new u.ContractError(`ConstructorError [${l.contract.txId()}]: ${E.message}`,"constructor");case c.NetworkCommunicationError:throw E;case c.NonWhitelistedSourceError:return{type:"error",errorMessage:E.message,state:g,result:null,event:null};default:return{type:"exception",errorMessage:`${E&&E.stack||E&&E.message||E}`,state:g,result:null,event:null}}}finally{m&&clearTimeout(m),await this.swGlobal.kv.close()}}setupSwGlobal({interaction:l,interactionTx:p}){this.swGlobal._activeTx=p,this.swGlobal.caller=l.caller}enableInternalWrites(l,p){this.assignReadContractState(l,p),this.assignViewContractState(l),this.assignWrite(l),this.assignRefreshState(l)}};t.JsHandlerApi=f}),Er=gt(t=>{lt();var i=t&&t.__importDefault||function(N){return N&&N.__esModule?N:{default:N}};Object.defineProperty(t,"__esModule",{value:!0}),t.safeGet=t.getJsonResponse=t.NetworkCommunicationError=t.isBrowser=t.bufToBn=t.indent=t.stripTrailingSlash=t.timeout=t.descS=t.desc=t.ascS=t.asc=t.mapReviver=t.mapReplacer=t.deepCopy=t.safeParseInt=t.sleep=void 0;var r=i(Gp()),u=wa(),a=N=>new Promise(F=>setTimeout(F,N));t.sleep=a;var s=N=>{let F=Number.parseInt(N);if(Number.isNaN(F)&&!Number.isSafeInteger(F))throw Error(`Failed to cast ${N} to integer`);return F};t.safeParseInt=s;var e=N=>(0,r.default)(N);t.deepCopy=e;var o=(N,F)=>F instanceof Map?{dataType:"Map",value:Array.from(F.entries())}:F;t.mapReplacer=o;var c=(N,F)=>typeof F=="object"&&F!==null&&F.dataType==="Map"?new Map(F.value):F;t.mapReviver=c;var f=(N,F)=>N-F;t.asc=f;var l=(N,F)=>+N-+F;t.ascS=l;var p=(N,F)=>F-N;t.desc=p;var g=(N,F)=>+F-+N;t.descS=g;function y(N){let F=null,I=new Promise((U,P)=>{F=setTimeout(()=>{clearTimeout(F),P("timeout")},N*1e3)});return{timeoutId:F,timeoutPromise:I}}t.timeout=y;function m(N){return N.endsWith("/")?N.slice(0,-1):N}t.stripTrailingSlash=m;function M(N){return`[d:${N}]`.padEnd(N*2,"-").concat("> ")}t.indent=M;function E(N){let F=[];return Uint8Array.from(N).forEach(function(I){let U=I.toString(16);U.length%2&&(U="0"+U),F.push(U)}),BigInt("0x"+F.join(""))}t.bufToBn=E,t.isBrowser=new Function("try {return this===window;}catch(e){ return false;}");var B=class extends Error{constructor(N){super(N.toString()),this.error=N,this.name=u.KnownErrors.NetworkCommunicationError}};t.NetworkCommunicationError=B;async function x(N){let F;try{F=await N}catch(I){throw new B(`Error during network communication: ${JSON.stringify(I)}`)}if(!(F!=null&&F.ok)){let I=await F.text();throw new B(`Wrong response code: ${F.status}. ${I}`)}try{return await F.json()}catch(I){throw new B(`Error while parsing json response: ${JSON.stringify(I)}`)}}t.getJsonResponse=x;async function C(N,F){return x(fetch(N,F))}t.safeGet=C}),No=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.WarpGatewayInteractionsLoader=t.SourceType=void 0;var i=fn(),r=or();Jn();var u=Er(),a;(function(e){e.ARWEAVE="arweave",e.WARP_SEQUENCER="redstone-sequencer",e.BOTH="both"})(a=t.SourceType||(t.SourceType={}));var s=class{constructor(e=null,o=a.BOTH){this.confirmationStatus=e,this.source=o,this.logger=r.LoggerFactory.INST.create("WarpGatewayInteractionsLoader"),Object.assign(this,e),this.source=o}async load(e,o,c,f){this.logger.debug("Loading interactions: for ",{contractId:e,fromSortKey:o,toSortKey:c});let l=[],p=0,g=0,y=0,m=f?f.sourceType:this.source,M=i.Benchmark.measure(),E=(0,u.stripTrailingSlash)(this._warp.gwUrl());do{let B=i.Benchmark.measure(),x=`${E}/gateway/v2/interactions-sort-key`,C=await(0,u.getJsonResponse)(fetch(`${x}?${new URLSearchParams({contractId:e,...this._warp.whoAmI?{client:this._warp.whoAmI}:"",...o?{from:o}:"",...c?{to:c}:"",page:(++p).toString(),fromSdk:"true",...this.confirmationStatus&&this.confirmationStatus.confirmed?{confirmationStatus:"confirmed"}:"",...this.confirmationStatus&&this.confirmationStatus.notCorrupted?{confirmationStatus:"not_corrupted"}:"",...m==a.BOTH?"":{source:m}})}`));this.logger.debug(`Loading interactions: page ${p} loaded in ${B.elapsed()}`),l.push(...C.interactions),g=C.paging.limit,y=C.paging.items,this.logger.debug(`Loaded interactions length: ${l.length}, from: ${o}, to: ${c}`)}while(y==g);return this.logger.debug("All loaded interactions:",{from:o,to:c,loaded:l.length,time:M.elapsed()}),l}type(){return"warp"}clearCache(){}set warp(e){this._warp=e}};t.WarpGatewayInteractionsLoader=s}),Lo=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.InteractionCompleteEvent=t.CustomEvent=t.DefaultEvaluationOptions=t.EvalStateResult=void 0;var i=No(),r=class{constructor(e,o,c){this.state=e,this.validity=o,this.errorMessages=c}};t.EvalStateResult=r;var u=class{constructor(){this.ignoreExceptions=!0,this.waitForConfirmation=!1,this.updateCacheForEachInteraction=!1,this.internalWrites=!1,this.maxCallDepth=7,this.maxInteractionEvaluationTimeSeconds=60,this.stackTrace={saveState:!1},this.sequencerUrl="https://d1o5nlqr4okus2.cloudfront.net/",this.gasLimit=Number.MAX_SAFE_INTEGER,this.sourceType=i.SourceType.BOTH,this.unsafeClient="throw",this.allowBigInt=!1,this.walletBalanceUrl="http://nyc-1.dev.arweave.net:1984/",this.mineArLocalBlocks=!0,this.throwOnInternalWriteError=!0,this.cacheEveryNInteractions=-1,this.useKVStorage=!1,this.remoteStateSyncEnabled=!1,this.remoteStateSyncSource="https://dre-1.warp.cc/contract",this.useConstructor=!1,this.whitelistSources=[]}};t.DefaultEvaluationOptions=u;var a=class extends Event{constructor(e,o){super(e,o),this.detail=o.detail}};t.CustomEvent=a;var s=class{constructor(e,o,c,f,l,p,g,y){this.contractTxId=e,this.sortKey=o,this.transactionId=c,this.caller=f,this.input=l,this.blockTimestamp=p,this.blockHeight=g,this.data=y}};t.InteractionCompleteEvent=s}),Do=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.ContractCache=t.SrcCache=t.ContractMetadata=t.SUPPORTED_SRC_CONTENT_TYPES=void 0,t.SUPPORTED_SRC_CONTENT_TYPES=["application/javascript","application/wasm"];var i=class{};t.ContractMetadata=i;var r=class{constructor(a){this.src=a.src,this.srcBinary=a.srcBinary,this.srcWasmLang=a.srcWasmLang}};t.SrcCache=r;var u=class{constructor(a){this.txId=a.txId,this.srcTxId=a.srcTxId,this.initState=a.initState,this.manifest=a.manifest,this.minFee=a.minFee,this.owner=a.owner,this.contractType=a.contractType,this.metadata=a.metadata,this.contractTx=a.contractTx,this.srcTx=a.srcTx,this.testnet=a.testnet}};t.ContractCache=u}),_n=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.WARP_TAGS=t.SMART_WEAVE_TAGS=void 0,t.SMART_WEAVE_TAGS={APP_NAME:"App-Name",APP_VERSION:"App-Version",CONTRACT_TX_ID:"Contract",INPUT:"Input",CONTENT_TYPE:"Content-Type",CONTRACT_SRC_TX_ID:"Contract-Src",SDK:"SDK",MIN_FEE:"Min-Fee"},t.WARP_TAGS={SEQUENCER:"Sequencer",SEQUENCER_OWNER:"Sequencer-Owner",SEQUENCER_MILLIS:"Sequencer-Mills",SEQUENCER_SORT_KEY:"Sequencer-Sort-Key",SEQUENCER_PREV_SORT_KEY:"Sequencer-Prev-Sort-Key",SEQUENCER_LAST_SORT_KEY:"Sequencer-Last-Sort-Key",SEQUENCER_TX_ID:"Sequencer-Tx-Id",SEQUENCER_BLOCK_HEIGHT:"Sequencer-Block-Height",SEQUENCER_BLOCK_ID:"Sequencer-Block-Id",SEQUENCER_BLOCK_TIMESTAMP:"Sequencer-Block-Timestamp",INIT_STATE:"Init-State",INIT_STATE_TX:"Init-State-TX",INTERACT_WRITE:"Interact-Write",WASM_LANG:"Wasm-Lang",WASM_LANG_VERSION:"Wasm-Lang-Version",WASM_META:"Wasm-Meta",REQUEST_VRF:"Request-Vrf",SIGNATURE_TYPE:"Signature-Type",UPLOADER_TX_ID:"Uploader-Tx-Id",WARP_TESTNET:"Warp-Testnet",MANIFEST:"Contract-Manifest",NONCE:"Nonce"}}),Zp=gt((t,i)=>{lt(),function(r){var u,a=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,s=Math.ceil,e=Math.floor,o="[BigNumber Error] ",c=o+"Number primitive has more than 15 significant digits: ",f=1e14,l=14,p=9007199254740991,g=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,m=1e9;function M(U){var P,D,W,q=X.prototype={constructor:X,toString:null,valueOf:null},O=new X(1),L=20,n=4,d=-7,v=21,A=-1e7,T=1e7,S=!1,w=1,b=0,h={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},k="0123456789abcdefghijklmnopqrstuvwxyz",tt=!0;function X(R,j){var z,Z,Q,K,G,H,Y,it,ot=this;if(!(ot instanceof X))return new X(R,j);if(j==null){if(R&&R._isBigNumber===!0){ot.s=R.s,!R.c||R.e>T?ot.c=ot.e=null:R.e=10;G/=10,K++);K>T?ot.c=ot.e=null:(ot.e=K,ot.c=[R]);return}it=String(R)}else{if(!a.test(it=String(R)))return W(ot,it,H);ot.s=it.charCodeAt(0)==45?(it=it.slice(1),-1):1}(K=it.indexOf("."))>-1&&(it=it.replace(".","")),(G=it.search(/e/i))>0?(K<0&&(K=G),K+=+it.slice(G+1),it=it.substring(0,G)):K<0&&(K=it.length)}else{if(C(j,2,k.length,"Base"),j==10&&tt)return ot=new X(R),$(ot,L+ot.e+1,n);if(it=String(R),H=typeof R=="number"){if(R*0!=0)return W(ot,it,H,j);if(ot.s=1/R<0?(it=it.slice(1),-1):1,X.DEBUG&&it.replace(/^0\.0*|\./,"").length>15)throw Error(c+R)}else ot.s=it.charCodeAt(0)===45?(it=it.slice(1),-1):1;for(z=k.slice(0,j),K=G=0,Y=it.length;GK){K=Y;continue}}else if(!Q&&(it==it.toUpperCase()&&(it=it.toLowerCase())||it==it.toLowerCase()&&(it=it.toUpperCase()))){Q=!0,G=-1,K=0;continue}return W(ot,String(R),H,j)}H=!1,it=D(it,j,10,ot.s),(K=it.indexOf("."))>-1?it=it.replace(".",""):K=it.length}for(G=0;it.charCodeAt(G)===48;G++);for(Y=it.length;it.charCodeAt(--Y)===48;);if(it=it.slice(G,++Y)){if(Y-=G,H&&X.DEBUG&&Y>15&&(R>p||R!==e(R)))throw Error(c+ot.s*R);if((K=K-G-1)>T)ot.c=ot.e=null;else if(K=-m&&Q<=m&&Q===e(Q)){if(Z[0]===0){if(Q===0&&Z.length===1)return!0;break t}if(j=(Q+1)%l,j<1&&(j+=l),String(Z[0]).length==j){for(j=0;j=f||z!==e(z))break t;if(z!==0)return!0}}}else if(Z===null&&Q===null&&(K===null||K===1||K===-1))return!0;throw Error(o+"Invalid BigNumber: "+R)},X.maximum=X.max=function(){return et(arguments,-1)},X.minimum=X.min=function(){return et(arguments,1)},X.random=function(){var R=9007199254740992,j=Math.random()*R&2097151?function(){return e(Math.random()*R)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(z){var Z,Q,K,G,H,Y=0,it=[],ot=new X(O);if(z==null?z=L:C(z,0,m),G=s(z/l),S)if(crypto.getRandomValues){for(Z=crypto.getRandomValues(new Uint32Array(G*=2));Y>>11),H>=9e15?(Q=crypto.getRandomValues(new Uint32Array(2)),Z[Y]=Q[0],Z[Y+1]=Q[1]):(it.push(H%1e14),Y+=2);Y=G/2}else if(crypto.randomBytes){for(Z=crypto.randomBytes(G*=7);Y=9e15?crypto.randomBytes(7).copy(Z,Y):(it.push(H%1e14),Y+=7);Y=G/7}else throw S=!1,Error(o+"crypto unavailable");if(!S)for(;Y=10;H/=10,Y++);YQ-1&&(H[G+1]==null&&(H[G+1]=0),H[G+1]+=H[G]/Q|0,H[G]%=Q)}return H.reverse()}return function(z,Z,Q,K,G){var H,Y,it,ot,mt,_t,ht,vt,pt=z.indexOf("."),V=L,rt=n;for(pt>=0&&(ot=b,b=0,z=z.replace(".",""),vt=new X(Z),_t=vt.pow(z.length-pt),b=ot,vt.c=j(I(B(_t.c),_t.e,"0"),10,Q,R),vt.e=vt.c.length),ht=j(z,Z,Q,G?(H=k,R):(H=R,k)),it=ot=ht.length;ht[--ot]==0;ht.pop());if(!ht[0])return H.charAt(0);if(pt<0?--it:(_t.c=ht,_t.e=it,_t.s=K,_t=P(_t,vt,V,rt,Q),ht=_t.c,mt=_t.r,it=_t.e),Y=it+V+1,pt=ht[Y],ot=Q/2,mt=mt||Y<0||ht[Y+1]!=null,mt=rt<4?(pt!=null||mt)&&(rt==0||rt==(_t.s<0?3:2)):pt>ot||pt==ot&&(rt==4||mt||rt==6&&ht[Y-1]&1||rt==(_t.s<0?8:7)),Y<1||!ht[0])z=mt?I(H.charAt(1),-V,H.charAt(0)):H.charAt(0);else{if(ht.length=Y,mt)for(--Q;++ht[--Y]>Q;)ht[Y]=0,Y||(++it,ht=[1].concat(ht));for(ot=ht.length;!ht[--ot];);for(pt=0,z="";pt<=ot;z+=H.charAt(ht[pt++]));z=I(z,it,H.charAt(0))}return z}}(),P=function(){function R(Z,Q,K){var G,H,Y,it,ot=0,mt=Z.length,_t=Q%y,ht=Q/y|0;for(Z=Z.slice();mt--;)Y=Z[mt]%y,it=Z[mt]/y|0,G=ht*Y+it*_t,H=_t*Y+G%y*y+ot,ot=(H/K|0)+(G/y|0)+ht*it,Z[mt]=H%K;return ot&&(Z=[ot].concat(Z)),Z}function j(Z,Q,K,G){var H,Y;if(K!=G)Y=K>G?1:-1;else for(H=Y=0;HQ[H]?1:-1;break}return Y}function z(Z,Q,K,G){for(var H=0;K--;)Z[K]-=H,H=Z[K]1;Z.splice(0,1));}return function(Z,Q,K,G,H){var Y,it,ot,mt,_t,ht,vt,pt,V,rt,st,yt,Ct,dt,Mt,Lt,wt,ct=Z.s==Q.s?1:-1,Et=Z.c,ut=Q.c;if(!Et||!Et[0]||!ut||!ut[0])return new X(!Z.s||!Q.s||(Et?ut&&Et[0]==ut[0]:!ut)?NaN:Et&&Et[0]==0||!ut?ct*0:ct/0);for(pt=new X(ct),V=pt.c=[],it=Z.e-Q.e,ct=K+it+1,H||(H=f,it=E(Z.e/l)-E(Q.e/l),ct=ct/l|0),ot=0;ut[ot]==(Et[ot]||0);ot++);if(ut[ot]>(Et[ot]||0)&&it--,ct<0)V.push(1),mt=!0;else{for(dt=Et.length,Lt=ut.length,ot=0,ct+=2,_t=e(H/(ut[0]+1)),_t>1&&(ut=R(ut,_t,H),Et=R(Et,_t,H),Lt=ut.length,dt=Et.length),Ct=Lt,rt=Et.slice(0,Lt),st=rt.length;st=H/2&&Mt++;do{if(_t=0,Y=j(ut,rt,Lt,st),Y<0){if(yt=rt[0],Lt!=st&&(yt=yt*H+(rt[1]||0)),_t=e(yt/Mt),_t>1)for(_t>=H&&(_t=H-1),ht=R(ut,_t,H),vt=ht.length,st=rt.length;j(ht,rt,vt,st)==1;)_t--,z(ht,Lt=10;ct/=10,ot++);$(pt,K+(pt.e=ot+it*l-1)+1,G,mt)}else pt.e=it,pt.r=+mt;return pt}}();function ft(R,j,z,Z){var Q,K,G,H,Y;if(z==null?z=n:C(z,0,8),!R.c)return R.toString();if(Q=R.c[0],G=R.e,j==null)Y=B(R.c),Y=Z==1||Z==2&&(G<=d||G>=v)?F(Y,G):I(Y,G,"0");else if(R=$(new X(R),j,z),K=R.e,Y=B(R.c),H=Y.length,Z==1||Z==2&&(j<=K||K<=d)){for(;HH){if(--j>0)for(Y+=".";j--;Y+="0");}else if(j+=K-H,j>0)for(K+1==H&&(Y+=".");j--;Y+="0");return R.s<0&&Q?"-"+Y:Y}function et(R,j){for(var z,Z,Q=1,K=new X(R[0]);Q=10;Q/=10,Z++);return(z=Z+z*l-1)>T?R.c=R.e=null:z=10;H/=10,Q++);if(K=j-Q,K<0)K+=l,G=j,Y=mt[it=0],ot=e(Y/_t[Q-G-1]%10);else if(it=s((K+1)/l),it>=mt.length)if(Z){for(;mt.length<=it;mt.push(0));Y=ot=0,Q=1,K%=l,G=K-l+1}else break t;else{for(Y=H=mt[it],Q=1;H>=10;H/=10,Q++);K%=l,G=K-l+Q,ot=G<0?0:e(Y/_t[Q-G-1]%10)}if(Z=Z||j<0||mt[it+1]!=null||(G<0?Y:Y%_t[Q-G-1]),Z=z<4?(ot||Z)&&(z==0||z==(R.s<0?3:2)):ot>5||ot==5&&(z==4||Z||z==6&&(K>0?G>0?Y/_t[Q-G]:0:mt[it-1])%10&1||z==(R.s<0?8:7)),j<1||!mt[0])return mt.length=0,Z?(j-=R.e+1,mt[0]=_t[(l-j%l)%l],R.e=-j||0):mt[0]=R.e=0,R;if(K==0?(mt.length=it,H=1,it--):(mt.length=it+1,H=_t[l-K],mt[it]=G>0?e(Y/_t[Q-G]%_t[G])*H:0),Z)for(;;)if(it==0){for(K=1,G=mt[0];G>=10;G/=10,K++);for(G=mt[0]+=H,H=1;G>=10;G/=10,H++);K!=H&&(R.e++,mt[0]==f&&(mt[0]=1));break}else{if(mt[it]+=H,mt[it]!=f)break;mt[it--]=0,H=1}for(K=mt.length;mt[--K]===0;mt.pop());}R.e>T?R.c=R.e=null:R.e=v?F(j,z):I(j,z,"0"),R.s<0?"-"+j:j)}return q.absoluteValue=q.abs=function(){var R=new X(this);return R.s<0&&(R.s=1),R},q.comparedTo=function(R,j){return x(this,new X(R,j))},q.decimalPlaces=q.dp=function(R,j){var z,Z,Q,K=this;if(R!=null)return C(R,0,m),j==null?j=n:C(j,0,8),$(new X(K),R+K.e+1,j);if(!(z=K.c))return null;if(Z=((Q=z.length-1)-E(this.e/l))*l,Q=z[Q])for(;Q%10==0;Q/=10,Z--);return Z<0&&(Z=0),Z},q.dividedBy=q.div=function(R,j){return P(this,new X(R,j),L,n)},q.dividedToIntegerBy=q.idiv=function(R,j){return P(this,new X(R,j),0,1)},q.exponentiatedBy=q.pow=function(R,j){var z,Z,Q,K,G,H,Y,it,ot,mt=this;if(R=new X(R),R.c&&!R.isInteger())throw Error(o+"Exponent not an integer: "+J(R));if(j!=null&&(j=new X(j)),H=R.e>14,!mt.c||!mt.c[0]||mt.c[0]==1&&!mt.e&&mt.c.length==1||!R.c||!R.c[0])return ot=new X(Math.pow(+J(mt),H?R.s*(2-N(R)):+J(R))),j?ot.mod(j):ot;if(Y=R.s<0,j){if(j.c?!j.c[0]:!j.s)return new X(NaN);Z=!Y&&mt.isInteger()&&j.isInteger(),Z&&(mt=mt.mod(j))}else{if(R.e>9&&(mt.e>0||mt.e<-1||(mt.e==0?mt.c[0]>1||H&&mt.c[1]>=24e7:mt.c[0]<8e13||H&&mt.c[0]<=9999975e7)))return K=mt.s<0&&N(R)?-0:0,mt.e>-1&&(K=1/K),new X(Y?1/K:K);b&&(K=s(b/l+2))}for(H?(z=new X(.5),Y&&(R.s=1),it=N(R)):(Q=Math.abs(+J(R)),it=Q%2),ot=new X(O);;){if(it){if(ot=ot.times(mt),!ot.c)break;K?ot.c.length>K&&(ot.c.length=K):Z&&(ot=ot.mod(j))}if(Q){if(Q=e(Q/2),Q===0)break;it=Q%2}else if(R=R.times(z),$(R,R.e+1,1),R.e>14)it=N(R);else{if(Q=+J(R),Q===0)break;it=Q%2}mt=mt.times(mt),K?mt.c&&mt.c.length>K&&(mt.c.length=K):Z&&(mt=mt.mod(j))}return Z?ot:(Y&&(ot=O.div(ot)),j?ot.mod(j):K?$(ot,b,n,G):ot)},q.integerValue=function(R){var j=new X(this);return R==null?R=n:C(R,0,8),$(j,j.e+1,R)},q.isEqualTo=q.eq=function(R,j){return x(this,new X(R,j))===0},q.isFinite=function(){return!!this.c},q.isGreaterThan=q.gt=function(R,j){return x(this,new X(R,j))>0},q.isGreaterThanOrEqualTo=q.gte=function(R,j){return(j=x(this,new X(R,j)))===1||j===0},q.isInteger=function(){return!!this.c&&E(this.e/l)>this.c.length-2},q.isLessThan=q.lt=function(R,j){return x(this,new X(R,j))<0},q.isLessThanOrEqualTo=q.lte=function(R,j){return(j=x(this,new X(R,j)))===-1||j===0},q.isNaN=function(){return!this.s},q.isNegative=function(){return this.s<0},q.isPositive=function(){return this.s>0},q.isZero=function(){return!!this.c&&this.c[0]==0},q.minus=function(R,j){var z,Z,Q,K,G=this,H=G.s;if(R=new X(R,j),j=R.s,!H||!j)return new X(NaN);if(H!=j)return R.s=-j,G.plus(R);var Y=G.e/l,it=R.e/l,ot=G.c,mt=R.c;if(!Y||!it){if(!ot||!mt)return ot?(R.s=-j,R):new X(mt?G:NaN);if(!ot[0]||!mt[0])return mt[0]?(R.s=-j,R):new X(ot[0]?G:n==3?-0:0)}if(Y=E(Y),it=E(it),ot=ot.slice(),H=Y-it){for((K=H<0)?(H=-H,Q=ot):(it=Y,Q=mt),Q.reverse(),j=H;j--;Q.push(0));Q.reverse()}else for(Z=(K=(H=ot.length)<(j=mt.length))?H:j,H=j=0;j0)for(;j--;ot[z++]=0);for(j=f-1;Z>H;){if(ot[--Z]=0;){for(z=0,_t=yt[Q]%V,ht=yt[Q]/V|0,G=Y,K=Q+G;K>Q;)it=st[--G]%V,ot=st[G]/V|0,H=ht*it+ot*_t,it=_t*it+H%V*V+vt[K]+z,z=(it/pt|0)+(H/V|0)+ht*ot,vt[K--]=it%pt;vt[K]=z}return z?++Z:vt.splice(0,1),at(R,vt,Z)},q.negated=function(){var R=new X(this);return R.s=-R.s||null,R},q.plus=function(R,j){var z,Z=this,Q=Z.s;if(R=new X(R,j),j=R.s,!Q||!j)return new X(NaN);if(Q!=j)return R.s=-j,Z.minus(R);var K=Z.e/l,G=R.e/l,H=Z.c,Y=R.c;if(!K||!G){if(!H||!Y)return new X(Q/0);if(!H[0]||!Y[0])return Y[0]?R:new X(H[0]?Z:Q*0)}if(K=E(K),G=E(G),H=H.slice(),Q=K-G){for(Q>0?(G=K,z=Y):(Q=-Q,z=H),z.reverse();Q--;z.push(0));z.reverse()}for(Q=H.length,j=Y.length,Q-j<0&&(z=Y,Y=H,H=z,j=Q),Q=0;j;)Q=(H[--j]=H[j]+Y[j]+Q)/f|0,H[j]=f===H[j]?0:H[j]%f;return Q&&(H=[Q].concat(H),++G),at(R,H,G)},q.precision=q.sd=function(R,j){var z,Z,Q,K=this;if(R!=null&&R!==!!R)return C(R,1,m),j==null?j=n:C(j,0,8),$(new X(K),R,j);if(!(z=K.c))return null;if(Q=z.length-1,Z=Q*l+1,Q=z[Q]){for(;Q%10==0;Q/=10,Z--);for(Q=z[0];Q>=10;Q/=10,Z++);}return R&&K.e+1>Z&&(Z=K.e+1),Z},q.shiftedBy=function(R){return C(R,-p,p),this.times("1e"+R)},q.squareRoot=q.sqrt=function(){var R,j,z,Z,Q,K=this,G=K.c,H=K.s,Y=K.e,it=L+4,ot=new X("0.5");if(H!==1||!G||!G[0])return new X(!H||H<0&&(!G||G[0])?NaN:G?K:1/0);if(H=Math.sqrt(+J(K)),H==0||H==1/0?(j=B(G),(j.length+Y)%2==0&&(j+="0"),H=Math.sqrt(+j),Y=E((Y+1)/2)-(Y<0||Y%2),H==1/0?j="5e"+Y:(j=H.toExponential(),j=j.slice(0,j.indexOf("e")+1)+Y),z=new X(j)):z=new X(H+""),z.c[0]){for(Y=z.e,H=Y+it,H<3&&(H=0);;)if(Q=z,z=ot.times(Q.plus(P(K,Q,it,1))),B(Q.c).slice(0,H)===(j=B(z.c)).slice(0,H))if(z.e0&&vt>0){for(K=vt%H||H,ot=ht.substr(0,K);K0&&(ot+=it+ht.slice(K)),_t&&(ot="-"+ot)}Z=mt?ot+(z.decimalSeparator||"")+((Y=+z.fractionGroupSize)?mt.replace(new RegExp("\\d{"+Y+"}\\B","g"),"$&"+(z.fractionGroupSeparator||"")):mt):ot}return(z.prefix||"")+Z+(z.suffix||"")},q.toFraction=function(R){var j,z,Z,Q,K,G,H,Y,it,ot,mt,_t,ht=this,vt=ht.c;if(R!=null&&(H=new X(R),!H.isInteger()&&(H.c||H.s!==1)||H.lt(O)))throw Error(o+"Argument "+(H.isInteger()?"out of range: ":"not an integer: ")+J(H));if(!vt)return new X(ht);for(j=new X(O),it=z=new X(O),Z=Y=new X(O),_t=B(vt),K=j.e=_t.length-ht.e-1,j.c[0]=g[(G=K%l)<0?l+G:G],R=!R||H.comparedTo(j)>0?K>0?j:it:H,G=T,T=1/0,H=new X(_t),Y.c[0]=0;ot=P(H,j,0,1),Q=z.plus(ot.times(Z)),Q.comparedTo(R)!=1;)z=Z,Z=Q,it=Y.plus(ot.times(Q=it)),Y=Q,j=H.minus(ot.times(Q=j)),H=Q;return Q=P(R.minus(z),Z,0,1),Y=Y.plus(Q.times(it)),z=z.plus(Q.times(Z)),Y.s=it.s=ht.s,K=K*2,mt=P(it,Z,K,n).minus(ht).abs().comparedTo(P(Y,z,K,n).minus(ht).abs())<1?[it,Z]:[Y,z],T=G,mt},q.toNumber=function(){return+J(this)},q.toPrecision=function(R,j){return R!=null&&C(R,1,m),ft(this,R,j,2)},q.toString=function(R){var j,z=this,Z=z.s,Q=z.e;return Q===null?Z?(j="Infinity",Z<0&&(j="-"+j)):j="NaN":(R==null?j=Q<=d||Q>=v?F(B(z.c),Q):I(B(z.c),Q,"0"):R===10&&tt?(z=$(new X(z),L+Q+1,n),j=I(B(z.c),z.e,"0")):(C(R,2,k.length,"Base"),j=D(I(B(z.c),Q,"0"),10,R,Z,!0)),Z<0&&z.c[0]&&(j="-"+j)),j},q.valueOf=q.toJSON=function(){return J(this)},q._isBigNumber=!0,U!=null&&X.set(U),X}function E(U){var P=U|0;return U>0||U===P?P:P-1}function B(U){for(var P,D,W=1,q=U.length,O=U[0]+"";Wv^D?1:-1;for(n=(d=q.length)<(v=O.length)?d:v,L=0;LO[L]^D?1:-1;return d==v?0:d>v^D?1:-1}function C(U,P,D,W){if(UD||U!==e(U))throw Error(o+(W||"Argument")+(typeof U=="number"?UD?" out of range: ":" not an integer: ":" not a primitive number: ")+String(U))}function N(U){var P=U.c.length-1;return E(U.e/l)==P&&U.c[P]%2!=0}function F(U,P){return(U.length>1?U.charAt(0)+"."+U.slice(1):U)+(P<0?"e":"e+")+P}function I(U,P,D){var W,q;if(P<0){for(q=D+".";++P;q+=D);U=q+U}else if(W=U.length,++P>W){for(q=D,P-=W;--P;q+=D);U+=q}else P{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=Zp(),r=class{constructor(){Pt(this,"BigNum");this.BigNum=(u,a)=>{let s=i.BigNumber.clone({DECIMAL_PLACES:a});return new s(u)}}winstonToAr(u,{formatted:a=!1,decimals:s=12,trim:e=!0}={}){let o=this.stringToBigNum(u,s).shiftedBy(-12);return a?o.toFormat(s):o.toFixed(s)}arToWinston(u,{formatted:a=!1}={}){let s=this.stringToBigNum(u).shiftedBy(12);return a?s.toFormat():s.toFixed(0)}compare(u,a){let s=this.stringToBigNum(u),e=this.stringToBigNum(a);return s.comparedTo(e)}isEqual(u,a){return this.compare(u,a)===0}isLessThan(u,a){let s=this.stringToBigNum(u),e=this.stringToBigNum(a);return s.isLessThan(e)}isGreaterThan(u,a){let s=this.stringToBigNum(u),e=this.stringToBigNum(a);return s.isGreaterThan(e)}add(u,a){let s=this.stringToBigNum(u);return this.stringToBigNum(a),s.plus(a).toFixed(0)}sub(u,a){let s=this.stringToBigNum(u);return this.stringToBigNum(a),s.minus(a).toFixed(0)}stringToBigNum(u,a=12){return this.BigNum(u,a)}};t.default=r}),Xp=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=class{constructor(a){Pt(this,"METHOD_GET","GET");Pt(this,"METHOD_POST","POST");Pt(this,"config");this.applyConfig(a)}applyConfig(a){this.config=this.mergeDefaults(a)}getConfig(){return this.config}mergeDefaults(a){let s=a.protocol||"http",e=a.port||(s==="https"?443:80);return{host:a.host||"127.0.0.1",protocol:s,port:e,timeout:a.timeout||2e4,logging:a.logging||!1,logger:a.logger||console.log,network:a.network}}async get(a,s){return await this.request(a,{...s,method:this.METHOD_GET})}async post(a,s,e){var c;let o=new Headers((e==null?void 0:e.headers)||{});return(c=o.get("content-type"))!=null&&c.includes("application/json")||o.append("content-type","application/json"),o.append("accept","application/json, text/plain, */*"),await this.request(a,{...e,method:this.METHOD_POST,body:typeof s!="string"?JSON.stringify(s):s,headers:o})}async request(a,s){var y,m;let e=new Headers((s==null?void 0:s.headers)||{}),o=`${this.config.protocol}://${this.config.host}:${this.config.port}`,c=s==null?void 0:s.responseType;s==null||delete s.responseType,a.startsWith("/")&&(a=a.slice(1)),this.config.network&&e.append("x-network",this.config.network),this.config.logging&&this.config.logger(`Requesting: ${o}/${a}`);let f=await fetch(`${o}/${a}`,{...s||{},headers:e});this.config.logging&&this.config.logger(`Response: ${f.url} - ${f.status}`);let l=(m=(y=f.headers.get("content-type"))==null?void 0:y.match(/charset=([^()<>@,;:\"/[\]?.=\s]*)/i))==null?void 0:m[1],p=f,g=async()=>{if(l)try{p.data=new TextDecoder(l).decode(await f.arrayBuffer())}catch{p.data=await f.text()}else p.data=await f.text()};if(c==="arraybuffer")p.data=await f.arrayBuffer();else if(c==="text")await g();else if(c==="webstream")p.data=r(f.body);else try{let M=await f.clone().json();typeof M!="object"?await g():p.data=await f.json(),M=null}catch{await g()}return p}};t.default=i;var r=a=>{let s=a;return typeof s[Symbol.asyncIterator]>"u"?(s[Symbol.asyncIterator]=u(a),s):a},u=function(a){return async function*(){let s=a.getReader();try{for(;;){let{done:e,value:o}=await s.read();if(e)return;yield o}}finally{s.releaseLock()}}}}),En=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var i=Co();function r(g){let y=0;for(let E=0;E{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=En(),r=class{constructor(){Pt(this,"keyLength",4096);Pt(this,"publicExponent",65537);Pt(this,"hashAlgorithm","sha256");Pt(this,"driver");if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let u=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),a=await this.driver.exportKey("jwk",u.privateKey);return{kty:a.kty,e:a.e,n:a.n,d:a.d,p:a.p,q:a.q,dp:a.dp,dq:a.dq,qi:a.qi}}async sign(u,a,{saltLength:s}={}){let e=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(u),a);return new Uint8Array(e)}async hash(u,a="SHA-256"){let s=await this.driver.digest(a,u);return new Uint8Array(s)}async verify(u,a,s){let e={kty:"RSA",e:"AQAB",n:u},o=await this.jwkToPublicCryptoKey(e),c=await this.driver.digest("SHA-256",a),f=await this.driver.verify({name:"RSA-PSS",saltLength:0},o,s,a),l=await this.driver.verify({name:"RSA-PSS",saltLength:32},o,s,a),p=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((o.algorithm.modulusLength-1)/8)-c.byteLength-2},o,s,a);return f||l||p}async jwkToCryptoKey(u){return this.driver.importKey("jwk",u,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(u){return this.driver.importKey("jwk",u,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let u=crypto==null?void 0:crypto.subtle;return u===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(a=>typeof u[a]=="function")}async encrypt(u,a,s){let e=await this.driver.importKey("raw",typeof a=="string"?i.stringToBuffer(a):a,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:s?i.stringToBuffer(s):i.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},e,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),c=new Uint8Array(16);crypto.getRandomValues(c);let f=await this.driver.encrypt({name:"AES-CBC",iv:c},o,u);return i.concatBuffers([c,f])}async decrypt(u,a,s){let e=await this.driver.importKey("raw",typeof a=="string"?i.stringToBuffer(a):a,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:s?i.stringToBuffer(s):i.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},e,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),c=u.slice(0,16),f=await this.driver.decrypt({name:"AES-CBC",iv:c},o,u.slice(16));return i.concatBuffers([f])}};t.default=r}),Qp=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=class{constructor(r){Pt(this,"api");this.api=r}getInfo(){return this.api.get("info").then(r=>r.data)}getPeers(){return this.api.get("peers").then(r=>r.data)}};t.default=i}),jo=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.getError=void 0;var i=class extends Error{constructor(s,e={}){var a=(...u)=>{super(...u);Pt(this,"type");Pt(this,"response")};e.message?a(e.message):a(),this.type=s,this.response=e.response}getType(){return this.type}};t.default=i;function r(a){let s=a.data;if(typeof a.data=="string")try{s=JSON.parse(a.data)}catch{}if(a.data instanceof ArrayBuffer||a.data instanceof Uint8Array)try{s=JSON.parse(s.toString())}catch{}return s?s.error||s:a.statusText||"unknown"}t.getError=r}),tg=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=fo();async function r(a){if(Array.isArray(a)){let o=i.default.utils.concatBuffers([i.default.utils.stringToBuffer("list"),i.default.utils.stringToBuffer(a.length.toString())]);return await u(a,await i.default.crypto.hash(o,"SHA-384"))}let s=i.default.utils.concatBuffers([i.default.utils.stringToBuffer("blob"),i.default.utils.stringToBuffer(a.byteLength.toString())]),e=i.default.utils.concatBuffers([await i.default.crypto.hash(s,"SHA-384"),await i.default.crypto.hash(a,"SHA-384")]);return await i.default.crypto.hash(e,"SHA-384")}t.default=r;async function u(a,s){if(a.length<1)return s;let e=i.default.utils.concatBuffers([s,await r(a[0])]),o=await i.default.crypto.hash(e,"SHA-384");return await u(a.slice(1),o)}}),Hf=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.debug=t.validatePath=t.arrayCompare=t.bufferToInt=t.intToBuffer=t.arrayFlatten=t.generateProofs=t.buildLayers=t.generateTransactionChunks=t.generateTree=t.computeRootHash=t.generateLeaves=t.chunkData=t.MIN_CHUNK_SIZE=t.MAX_CHUNK_SIZE=void 0;var i=fo(),r=En();t.MAX_CHUNK_SIZE=256*1024,t.MIN_CHUNK_SIZE=32*1024;var u=32,a=32;async function s(F){let I=[],U=F,P=0;for(;U.byteLength>=t.MAX_CHUNK_SIZE;){let D=t.MAX_CHUNK_SIZE,W=U.byteLength-t.MAX_CHUNK_SIZE;W>0&&W({type:"leaf",id:await M(await Promise.all([M(I),M(E(P))])),dataHash:I,minByteRange:U,maxByteRange:P})))}t.generateLeaves=e;async function o(F){return(await c(F)).id}t.computeRootHash=o;async function c(F){return await l(await e(await s(F)))}t.generateTree=c;async function f(F){let I=await s(F),U=await e(I),P=await l(U),D=await p(P),W=I.slice(-1)[0];return W.maxByteRange-W.minByteRange===0&&(I.splice(I.length-1,1),D.splice(D.length-1,1)),{data_root:P.id,chunks:I,proofs:D}}t.generateTransactionChunks=f;async function l(F,I=0){if(F.length<2)return F[0];let U=[];for(let P=0;P{Array.isArray(U)?I.push(...y(U)):I.push(U)}),I}t.arrayFlatten=y;async function m(F,I){return I?{type:"branch",id:await M([await M(F.id),await M(I.id),await M(E(F.maxByteRange))]),byteRange:F.maxByteRange,maxByteRange:I.maxByteRange,leftChild:F,rightChild:I}:F}async function M(F){return Array.isArray(F)&&(F=i.default.utils.concatBuffers(F)),new Uint8Array(await i.default.crypto.hash(F))}function E(F){let I=new Uint8Array(u);for(var U=I.length-1;U>=0;U--){var P=F%256;I[U]=P,F=(F-P)/256}return I}t.intToBuffer=E;function B(F){let I=0;for(var U=0;UF.every((U,P)=>I[P]===U);t.arrayCompare=x;async function C(F,I,U,P,D){if(P<=0)return!1;if(I>=P)return C(F,0,P-1,P,D);if(I<0)return C(F,0,0,P,D);if(D.length==a+u){let v=D.slice(0,a),A=D.slice(v.length,v.length+u),T=await M([await M(v),await M(A)]);return(0,t.arrayCompare)(F,T)?{offset:P-1,leftBound:U,rightBound:P,chunkSize:P-U}:!1}let W=D.slice(0,a),q=D.slice(W.length,W.length+a),O=D.slice(W.length+q.length,W.length+q.length+u),L=B(O),n=D.slice(W.length+q.length+O.length),d=await M([await M(W),await M(q),await M(O)]);return(0,t.arrayCompare)(F,d)?I{lt(),function(r){var u,a=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,s=Math.ceil,e=Math.floor,o="[BigNumber Error] ",c=o+"Number primitive has more than 15 significant digits: ",f=1e14,l=14,p=9007199254740991,g=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,m=1e9;function M(U){var P,D,W,q=X.prototype={constructor:X,toString:null,valueOf:null},O=new X(1),L=20,n=4,d=-7,v=21,A=-1e7,T=1e7,S=!1,w=1,b=0,h={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},k="0123456789abcdefghijklmnopqrstuvwxyz",tt=!0;function X(R,j){var z,Z,Q,K,G,H,Y,it,ot=this;if(!(ot instanceof X))return new X(R,j);if(j==null){if(R&&R._isBigNumber===!0){ot.s=R.s,!R.c||R.e>T?ot.c=ot.e=null:R.e=10;G/=10,K++);K>T?ot.c=ot.e=null:(ot.e=K,ot.c=[R]);return}it=String(R)}else{if(!a.test(it=String(R)))return W(ot,it,H);ot.s=it.charCodeAt(0)==45?(it=it.slice(1),-1):1}(K=it.indexOf("."))>-1&&(it=it.replace(".","")),(G=it.search(/e/i))>0?(K<0&&(K=G),K+=+it.slice(G+1),it=it.substring(0,G)):K<0&&(K=it.length)}else{if(C(j,2,k.length,"Base"),j==10&&tt)return ot=new X(R),$(ot,L+ot.e+1,n);if(it=String(R),H=typeof R=="number"){if(R*0!=0)return W(ot,it,H,j);if(ot.s=1/R<0?(it=it.slice(1),-1):1,X.DEBUG&&it.replace(/^0\.0*|\./,"").length>15)throw Error(c+R)}else ot.s=it.charCodeAt(0)===45?(it=it.slice(1),-1):1;for(z=k.slice(0,j),K=G=0,Y=it.length;GK){K=Y;continue}}else if(!Q&&(it==it.toUpperCase()&&(it=it.toLowerCase())||it==it.toLowerCase()&&(it=it.toUpperCase()))){Q=!0,G=-1,K=0;continue}return W(ot,String(R),H,j)}H=!1,it=D(it,j,10,ot.s),(K=it.indexOf("."))>-1?it=it.replace(".",""):K=it.length}for(G=0;it.charCodeAt(G)===48;G++);for(Y=it.length;it.charCodeAt(--Y)===48;);if(it=it.slice(G,++Y)){if(Y-=G,H&&X.DEBUG&&Y>15&&(R>p||R!==e(R)))throw Error(c+ot.s*R);if((K=K-G-1)>T)ot.c=ot.e=null;else if(K=-m&&Q<=m&&Q===e(Q)){if(Z[0]===0){if(Q===0&&Z.length===1)return!0;break t}if(j=(Q+1)%l,j<1&&(j+=l),String(Z[0]).length==j){for(j=0;j=f||z!==e(z))break t;if(z!==0)return!0}}}else if(Z===null&&Q===null&&(K===null||K===1||K===-1))return!0;throw Error(o+"Invalid BigNumber: "+R)},X.maximum=X.max=function(){return et(arguments,q.lt)},X.minimum=X.min=function(){return et(arguments,q.gt)},X.random=function(){var R=9007199254740992,j=Math.random()*R&2097151?function(){return e(Math.random()*R)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(z){var Z,Q,K,G,H,Y=0,it=[],ot=new X(O);if(z==null?z=L:C(z,0,m),G=s(z/l),S)if(crypto.getRandomValues){for(Z=crypto.getRandomValues(new Uint32Array(G*=2));Y>>11),H>=9e15?(Q=crypto.getRandomValues(new Uint32Array(2)),Z[Y]=Q[0],Z[Y+1]=Q[1]):(it.push(H%1e14),Y+=2);Y=G/2}else if(crypto.randomBytes){for(Z=crypto.randomBytes(G*=7);Y=9e15?crypto.randomBytes(7).copy(Z,Y):(it.push(H%1e14),Y+=7);Y=G/7}else throw S=!1,Error(o+"crypto unavailable");if(!S)for(;Y=10;H/=10,Y++);YQ-1&&(H[G+1]==null&&(H[G+1]=0),H[G+1]+=H[G]/Q|0,H[G]%=Q)}return H.reverse()}return function(z,Z,Q,K,G){var H,Y,it,ot,mt,_t,ht,vt,pt=z.indexOf("."),V=L,rt=n;for(pt>=0&&(ot=b,b=0,z=z.replace(".",""),vt=new X(Z),_t=vt.pow(z.length-pt),b=ot,vt.c=j(I(B(_t.c),_t.e,"0"),10,Q,R),vt.e=vt.c.length),ht=j(z,Z,Q,G?(H=k,R):(H=R,k)),it=ot=ht.length;ht[--ot]==0;ht.pop());if(!ht[0])return H.charAt(0);if(pt<0?--it:(_t.c=ht,_t.e=it,_t.s=K,_t=P(_t,vt,V,rt,Q),ht=_t.c,mt=_t.r,it=_t.e),Y=it+V+1,pt=ht[Y],ot=Q/2,mt=mt||Y<0||ht[Y+1]!=null,mt=rt<4?(pt!=null||mt)&&(rt==0||rt==(_t.s<0?3:2)):pt>ot||pt==ot&&(rt==4||mt||rt==6&&ht[Y-1]&1||rt==(_t.s<0?8:7)),Y<1||!ht[0])z=mt?I(H.charAt(1),-V,H.charAt(0)):H.charAt(0);else{if(ht.length=Y,mt)for(--Q;++ht[--Y]>Q;)ht[Y]=0,Y||(++it,ht=[1].concat(ht));for(ot=ht.length;!ht[--ot];);for(pt=0,z="";pt<=ot;z+=H.charAt(ht[pt++]));z=I(z,it,H.charAt(0))}return z}}(),P=function(){function R(Z,Q,K){var G,H,Y,it,ot=0,mt=Z.length,_t=Q%y,ht=Q/y|0;for(Z=Z.slice();mt--;)Y=Z[mt]%y,it=Z[mt]/y|0,G=ht*Y+it*_t,H=_t*Y+G%y*y+ot,ot=(H/K|0)+(G/y|0)+ht*it,Z[mt]=H%K;return ot&&(Z=[ot].concat(Z)),Z}function j(Z,Q,K,G){var H,Y;if(K!=G)Y=K>G?1:-1;else for(H=Y=0;HQ[H]?1:-1;break}return Y}function z(Z,Q,K,G){for(var H=0;K--;)Z[K]-=H,H=Z[K]1;Z.splice(0,1));}return function(Z,Q,K,G,H){var Y,it,ot,mt,_t,ht,vt,pt,V,rt,st,yt,Ct,dt,Mt,Lt,wt,ct=Z.s==Q.s?1:-1,Et=Z.c,ut=Q.c;if(!Et||!Et[0]||!ut||!ut[0])return new X(!Z.s||!Q.s||(Et?ut&&Et[0]==ut[0]:!ut)?NaN:Et&&Et[0]==0||!ut?ct*0:ct/0);for(pt=new X(ct),V=pt.c=[],it=Z.e-Q.e,ct=K+it+1,H||(H=f,it=E(Z.e/l)-E(Q.e/l),ct=ct/l|0),ot=0;ut[ot]==(Et[ot]||0);ot++);if(ut[ot]>(Et[ot]||0)&&it--,ct<0)V.push(1),mt=!0;else{for(dt=Et.length,Lt=ut.length,ot=0,ct+=2,_t=e(H/(ut[0]+1)),_t>1&&(ut=R(ut,_t,H),Et=R(Et,_t,H),Lt=ut.length,dt=Et.length),Ct=Lt,rt=Et.slice(0,Lt),st=rt.length;st=H/2&&Mt++;do{if(_t=0,Y=j(ut,rt,Lt,st),Y<0){if(yt=rt[0],Lt!=st&&(yt=yt*H+(rt[1]||0)),_t=e(yt/Mt),_t>1)for(_t>=H&&(_t=H-1),ht=R(ut,_t,H),vt=ht.length,st=rt.length;j(ht,rt,vt,st)==1;)_t--,z(ht,Lt=10;ct/=10,ot++);$(pt,K+(pt.e=ot+it*l-1)+1,G,mt)}else pt.e=it,pt.r=+mt;return pt}}();function ft(R,j,z,Z){var Q,K,G,H,Y;if(z==null?z=n:C(z,0,8),!R.c)return R.toString();if(Q=R.c[0],G=R.e,j==null)Y=B(R.c),Y=Z==1||Z==2&&(G<=d||G>=v)?F(Y,G):I(Y,G,"0");else if(R=$(new X(R),j,z),K=R.e,Y=B(R.c),H=Y.length,Z==1||Z==2&&(j<=K||K<=d)){for(;HH){if(--j>0)for(Y+=".";j--;Y+="0");}else if(j+=K-H,j>0)for(K+1==H&&(Y+=".");j--;Y+="0");return R.s<0&&Q?"-"+Y:Y}function et(R,j){for(var z,Z=1,Q=new X(R[0]);Z=10;Q/=10,Z++);return(z=Z+z*l-1)>T?R.c=R.e=null:z=10;H/=10,Q++);if(K=j-Q,K<0)K+=l,G=j,Y=mt[it=0],ot=Y/_t[Q-G-1]%10|0;else if(it=s((K+1)/l),it>=mt.length)if(Z){for(;mt.length<=it;mt.push(0));Y=ot=0,Q=1,K%=l,G=K-l+1}else break t;else{for(Y=H=mt[it],Q=1;H>=10;H/=10,Q++);K%=l,G=K-l+Q,ot=G<0?0:Y/_t[Q-G-1]%10|0}if(Z=Z||j<0||mt[it+1]!=null||(G<0?Y:Y%_t[Q-G-1]),Z=z<4?(ot||Z)&&(z==0||z==(R.s<0?3:2)):ot>5||ot==5&&(z==4||Z||z==6&&(K>0?G>0?Y/_t[Q-G]:0:mt[it-1])%10&1||z==(R.s<0?8:7)),j<1||!mt[0])return mt.length=0,Z?(j-=R.e+1,mt[0]=_t[(l-j%l)%l],R.e=-j||0):mt[0]=R.e=0,R;if(K==0?(mt.length=it,H=1,it--):(mt.length=it+1,H=_t[l-K],mt[it]=G>0?e(Y/_t[Q-G]%_t[G])*H:0),Z)for(;;)if(it==0){for(K=1,G=mt[0];G>=10;G/=10,K++);for(G=mt[0]+=H,H=1;G>=10;G/=10,H++);K!=H&&(R.e++,mt[0]==f&&(mt[0]=1));break}else{if(mt[it]+=H,mt[it]!=f)break;mt[it--]=0,H=1}for(K=mt.length;mt[--K]===0;mt.pop());}R.e>T?R.c=R.e=null:R.e=v?F(j,z):I(j,z,"0"),R.s<0?"-"+j:j)}return q.absoluteValue=q.abs=function(){var R=new X(this);return R.s<0&&(R.s=1),R},q.comparedTo=function(R,j){return x(this,new X(R,j))},q.decimalPlaces=q.dp=function(R,j){var z,Z,Q,K=this;if(R!=null)return C(R,0,m),j==null?j=n:C(j,0,8),$(new X(K),R+K.e+1,j);if(!(z=K.c))return null;if(Z=((Q=z.length-1)-E(this.e/l))*l,Q=z[Q])for(;Q%10==0;Q/=10,Z--);return Z<0&&(Z=0),Z},q.dividedBy=q.div=function(R,j){return P(this,new X(R,j),L,n)},q.dividedToIntegerBy=q.idiv=function(R,j){return P(this,new X(R,j),0,1)},q.exponentiatedBy=q.pow=function(R,j){var z,Z,Q,K,G,H,Y,it,ot,mt=this;if(R=new X(R),R.c&&!R.isInteger())throw Error(o+"Exponent not an integer: "+J(R));if(j!=null&&(j=new X(j)),H=R.e>14,!mt.c||!mt.c[0]||mt.c[0]==1&&!mt.e&&mt.c.length==1||!R.c||!R.c[0])return ot=new X(Math.pow(+J(mt),H?R.s*(2-N(R)):+J(R))),j?ot.mod(j):ot;if(Y=R.s<0,j){if(j.c?!j.c[0]:!j.s)return new X(NaN);Z=!Y&&mt.isInteger()&&j.isInteger(),Z&&(mt=mt.mod(j))}else{if(R.e>9&&(mt.e>0||mt.e<-1||(mt.e==0?mt.c[0]>1||H&&mt.c[1]>=24e7:mt.c[0]<8e13||H&&mt.c[0]<=9999975e7)))return K=mt.s<0&&N(R)?-0:0,mt.e>-1&&(K=1/K),new X(Y?1/K:K);b&&(K=s(b/l+2))}for(H?(z=new X(.5),Y&&(R.s=1),it=N(R)):(Q=Math.abs(+J(R)),it=Q%2),ot=new X(O);;){if(it){if(ot=ot.times(mt),!ot.c)break;K?ot.c.length>K&&(ot.c.length=K):Z&&(ot=ot.mod(j))}if(Q){if(Q=e(Q/2),Q===0)break;it=Q%2}else if(R=R.times(z),$(R,R.e+1,1),R.e>14)it=N(R);else{if(Q=+J(R),Q===0)break;it=Q%2}mt=mt.times(mt),K?mt.c&&mt.c.length>K&&(mt.c.length=K):Z&&(mt=mt.mod(j))}return Z?ot:(Y&&(ot=O.div(ot)),j?ot.mod(j):K?$(ot,b,n,G):ot)},q.integerValue=function(R){var j=new X(this);return R==null?R=n:C(R,0,8),$(j,j.e+1,R)},q.isEqualTo=q.eq=function(R,j){return x(this,new X(R,j))===0},q.isFinite=function(){return!!this.c},q.isGreaterThan=q.gt=function(R,j){return x(this,new X(R,j))>0},q.isGreaterThanOrEqualTo=q.gte=function(R,j){return(j=x(this,new X(R,j)))===1||j===0},q.isInteger=function(){return!!this.c&&E(this.e/l)>this.c.length-2},q.isLessThan=q.lt=function(R,j){return x(this,new X(R,j))<0},q.isLessThanOrEqualTo=q.lte=function(R,j){return(j=x(this,new X(R,j)))===-1||j===0},q.isNaN=function(){return!this.s},q.isNegative=function(){return this.s<0},q.isPositive=function(){return this.s>0},q.isZero=function(){return!!this.c&&this.c[0]==0},q.minus=function(R,j){var z,Z,Q,K,G=this,H=G.s;if(R=new X(R,j),j=R.s,!H||!j)return new X(NaN);if(H!=j)return R.s=-j,G.plus(R);var Y=G.e/l,it=R.e/l,ot=G.c,mt=R.c;if(!Y||!it){if(!ot||!mt)return ot?(R.s=-j,R):new X(mt?G:NaN);if(!ot[0]||!mt[0])return mt[0]?(R.s=-j,R):new X(ot[0]?G:n==3?-0:0)}if(Y=E(Y),it=E(it),ot=ot.slice(),H=Y-it){for((K=H<0)?(H=-H,Q=ot):(it=Y,Q=mt),Q.reverse(),j=H;j--;Q.push(0));Q.reverse()}else for(Z=(K=(H=ot.length)<(j=mt.length))?H:j,H=j=0;j0)for(;j--;ot[z++]=0);for(j=f-1;Z>H;){if(ot[--Z]=0;){for(z=0,_t=yt[Q]%V,ht=yt[Q]/V|0,G=Y,K=Q+G;K>Q;)it=st[--G]%V,ot=st[G]/V|0,H=ht*it+ot*_t,it=_t*it+H%V*V+vt[K]+z,z=(it/pt|0)+(H/V|0)+ht*ot,vt[K--]=it%pt;vt[K]=z}return z?++Z:vt.splice(0,1),at(R,vt,Z)},q.negated=function(){var R=new X(this);return R.s=-R.s||null,R},q.plus=function(R,j){var z,Z=this,Q=Z.s;if(R=new X(R,j),j=R.s,!Q||!j)return new X(NaN);if(Q!=j)return R.s=-j,Z.minus(R);var K=Z.e/l,G=R.e/l,H=Z.c,Y=R.c;if(!K||!G){if(!H||!Y)return new X(Q/0);if(!H[0]||!Y[0])return Y[0]?R:new X(H[0]?Z:Q*0)}if(K=E(K),G=E(G),H=H.slice(),Q=K-G){for(Q>0?(G=K,z=Y):(Q=-Q,z=H),z.reverse();Q--;z.push(0));z.reverse()}for(Q=H.length,j=Y.length,Q-j<0&&(z=Y,Y=H,H=z,j=Q),Q=0;j;)Q=(H[--j]=H[j]+Y[j]+Q)/f|0,H[j]=f===H[j]?0:H[j]%f;return Q&&(H=[Q].concat(H),++G),at(R,H,G)},q.precision=q.sd=function(R,j){var z,Z,Q,K=this;if(R!=null&&R!==!!R)return C(R,1,m),j==null?j=n:C(j,0,8),$(new X(K),R,j);if(!(z=K.c))return null;if(Q=z.length-1,Z=Q*l+1,Q=z[Q]){for(;Q%10==0;Q/=10,Z--);for(Q=z[0];Q>=10;Q/=10,Z++);}return R&&K.e+1>Z&&(Z=K.e+1),Z},q.shiftedBy=function(R){return C(R,-p,p),this.times("1e"+R)},q.squareRoot=q.sqrt=function(){var R,j,z,Z,Q,K=this,G=K.c,H=K.s,Y=K.e,it=L+4,ot=new X("0.5");if(H!==1||!G||!G[0])return new X(!H||H<0&&(!G||G[0])?NaN:G?K:1/0);if(H=Math.sqrt(+J(K)),H==0||H==1/0?(j=B(G),(j.length+Y)%2==0&&(j+="0"),H=Math.sqrt(+j),Y=E((Y+1)/2)-(Y<0||Y%2),H==1/0?j="5e"+Y:(j=H.toExponential(),j=j.slice(0,j.indexOf("e")+1)+Y),z=new X(j)):z=new X(H+""),z.c[0]){for(Y=z.e,H=Y+it,H<3&&(H=0);;)if(Q=z,z=ot.times(Q.plus(P(K,Q,it,1))),B(Q.c).slice(0,H)===(j=B(z.c)).slice(0,H))if(z.e0&&vt>0){for(K=vt%H||H,ot=ht.substr(0,K);K0&&(ot+=it+ht.slice(K)),_t&&(ot="-"+ot)}Z=mt?ot+(z.decimalSeparator||"")+((Y=+z.fractionGroupSize)?mt.replace(new RegExp("\\d{"+Y+"}\\B","g"),"$&"+(z.fractionGroupSeparator||"")):mt):ot}return(z.prefix||"")+Z+(z.suffix||"")},q.toFraction=function(R){var j,z,Z,Q,K,G,H,Y,it,ot,mt,_t,ht=this,vt=ht.c;if(R!=null&&(H=new X(R),!H.isInteger()&&(H.c||H.s!==1)||H.lt(O)))throw Error(o+"Argument "+(H.isInteger()?"out of range: ":"not an integer: ")+J(H));if(!vt)return new X(ht);for(j=new X(O),it=z=new X(O),Z=Y=new X(O),_t=B(vt),K=j.e=_t.length-ht.e-1,j.c[0]=g[(G=K%l)<0?l+G:G],R=!R||H.comparedTo(j)>0?K>0?j:it:H,G=T,T=1/0,H=new X(_t),Y.c[0]=0;ot=P(H,j,0,1),Q=z.plus(ot.times(Z)),Q.comparedTo(R)!=1;)z=Z,Z=Q,it=Y.plus(ot.times(Q=it)),Y=Q,j=H.minus(ot.times(Q=j)),H=Q;return Q=P(R.minus(z),Z,0,1),Y=Y.plus(Q.times(it)),z=z.plus(Q.times(Z)),Y.s=it.s=ht.s,K=K*2,mt=P(it,Z,K,n).minus(ht).abs().comparedTo(P(Y,z,K,n).minus(ht).abs())<1?[it,Z]:[Y,z],T=G,mt},q.toNumber=function(){return+J(this)},q.toPrecision=function(R,j){return R!=null&&C(R,1,m),ft(this,R,j,2)},q.toString=function(R){var j,z=this,Z=z.s,Q=z.e;return Q===null?Z?(j="Infinity",Z<0&&(j="-"+j)):j="NaN":(R==null?j=Q<=d||Q>=v?F(B(z.c),Q):I(B(z.c),Q,"0"):R===10&&tt?(z=$(new X(z),L+Q+1,n),j=I(B(z.c),z.e,"0")):(C(R,2,k.length,"Base"),j=D(I(B(z.c),Q,"0"),10,R,Z,!0)),Z<0&&z.c[0]&&(j="-"+j)),j},q.valueOf=q.toJSON=function(){return J(this)},q._isBigNumber=!0,U!=null&&X.set(U),X}function E(U){var P=U|0;return U>0||U===P?P:P-1}function B(U){for(var P,D,W=1,q=U.length,O=U[0]+"";Wv^D?1:-1;for(n=(d=q.length)<(v=O.length)?d:v,L=0;LO[L]^D?1:-1;return d==v?0:d>v^D?1:-1}function C(U,P,D,W){if(UD||U!==e(U))throw Error(o+(W||"Argument")+(typeof U=="number"?UD?" out of range: ":" not an integer: ":" not a primitive number: ")+String(U))}function N(U){var P=U.c.length-1;return E(U.e/l)==P&&U.c[P]%2!=0}function F(U,P){return(U.length>1?U.charAt(0)+"."+U.slice(1):U)+(P<0?"e":"e+")+P}function I(U,P,D){var W,q;if(P<0){for(q=D+".";++P;q+=D);U=q+U}else if(W=U.length,++P>W){for(q=D,P-=W;--P;q+=D);U+=q}else P{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.HandlerExecutorFactory=t.NonWhitelistedSourceError=t.ContractError=void 0;var i=zf(),r=pu(),u=fn(),a=or(),s=wa(),e=Wf(),o=qf(),c=Er(),f=Jn(),l=Vp(),p=class extends Error{constructor(E,B){super(E.toString()),this.error=E,this.subtype=B,this.name=s.KnownErrors.ContractError}};t.ContractError=p;var g=class extends Error{constructor(E){super(E.toString()),this.error=E,this.name=s.KnownErrors.NonWhitelistedSourceError}};t.NonWhitelistedSourceError=g;var y=class{constructor(E){this.arweave=E,this.logger=a.LoggerFactory.INST.create("HandlerExecutorFactory")}async create(E,B,x,C){if(x.hasPlugin("contract-blacklist")&&await this.blacklistContracts(x,E),B.whitelistSources.length>0&&!B.whitelistSources.includes(E.srcTxId))throw new g(`[NonWhitelistedSourceError] Contract source not part of whitelisted sources list: ${E.srcTxId}.`);let N=null;B.useKVStorage&&(N=x.kvStorageFactory(E.txId));let F=new r.SmartWeaveGlobal(this.arweave,{id:E.txId,owner:E.owner},B,C,N);if(x.matchPlugins("^smartweave-extension-").forEach(I=>{x.loadPlugin(I).process(F.extensions)}),E.contractType=="wasm"){this.logger.info("Creating handler for wasm contract",E.txId);let I=u.Benchmark.measure(),U,P=null,D=m(E.srcBinary);switch(E.srcWasmLang){case"rust":{let W={exports:null,modifiedExports:{wasm_bindgen__convert__closures__invoke2_mut__:null,_dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__:null}},q=await M(D,E.srcBinary),O=WebAssembly.Module.exports(q).filter(v=>v.kind==="global"&&v.name.startsWith("__WARP_CONTRACTS_VERSION_")).map(v=>v.name).shift()||"__WARP_CONTRACTS_VERSION_LEGACY",L=WebAssembly.Module.imports(q).filter(v=>v.module==="__wbindgen_placeholder__").map(v=>v.name),{imports:n,exports:d}=(0,i.rustWasmImports)(F,L,W,E.metadata.dtor,O);P=d,U=await WebAssembly.instantiate(q,n),W.exports=U.exports,Object.keys(U.exports).forEach(v=>{v.startsWith("wasm_bindgen__convert__closures__invoke2_mut__")&&(W.modifiedExports.wasm_bindgen__convert__closures__invoke2_mut__=U.exports[v]),v.startsWith("_dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__")&&(W.modifiedExports._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__=U.exports[v])});break}default:throw new Error(`Support for ${E.srcWasmLang} not implemented yet.`)}return this.logger.info(`WASM ${E.srcWasmLang} handler created in ${I.elapsed()}`),new e.WasmHandlerApi(F,E,P||U.exports)}else{let I=(0,o.normalizeContractSource)(E.src,x.hasPlugin("vm2"));if(I.includes("unsafeClient"))switch(B.unsafeClient){case"allow":{this.logger.warn(`Reading unsafe contract ${E.txId}, evaluation is non-deterministic!`);break}case"throw":throw new Error(`[SkipUnsafeError] Using unsafeClient is not allowed by default. Use EvaluationOptions.unsafeClient flag to evaluate ${E.txId}.`);case"skip":throw new p(`[SkipUnsafeError] Skipping evaluation of the unsafe contract ${E.txId}.`,"unsafeClientSkip");default:throw new Error(`Unknown unsafeClient setting ${B.unsafeClient}`)}if(!B.allowBigInt&&I.includes("BigInt"))throw new Error("Using BigInt is not allowed by default. Use EvaluationOptions.allowBigInt flag.");if(x.hasPlugin("vm2"))return x.loadPlugin("vm2").process({normalizedSource:I,swGlobal:F,logger:this.logger,contractDefinition:E});if(x.hasPlugin("ivm-handler-api"))return x.loadPlugin("ivm-handler-api").process({contractSource:E.src,evaluationOptions:B,arweave:this.arweave,swGlobal:F,contractDefinition:E});{let U=new Function(I),P=(0,c.isBrowser)()?U(F,l,a.LoggerFactory.INST.create(F.contract.id),f.Buffer,atob,btoa):U(F,l,a.LoggerFactory.INST.create(F.contract.id));return new s.JsHandlerApi(F,E,P)}}}async blacklistContracts(E,B){let x=E.loadPlugin("contract-blacklist"),C=!1;try{C=await x.process(B.txId)}catch(N){this.logger.error(N)}if(C==!0)throw new p(`[SkipUnsafeError] Skipping evaluation of the blacklisted contract ${B.txId}.`,"blacklistedSkip")}};t.HandlerExecutorFactory=y;function m(E){let B={status:200,statusText:"OK",headers:{"Content-Type":"application/wasm"}};return new Response(E,B)}async function M(E,B){return WebAssembly.compileStreaming?await WebAssembly.compileStreaming(E):await WebAssembly.compile(B)}}),$f=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.arrayToHex=void 0;function i(r){let u="";for(let a of r)u+=("0"+a.toString(16)).slice(-2);return u}t.arrayToHex=i}),Li=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.LexicographicalInteractionsSorter=t.lastPossibleSortKey=t.genesisSortKey=t.sortingLast=t.sortingFirst=t.defaultArweaveMs=void 0;var i=$f(),r=or(),u="".padEnd(13,"0"),a="".padEnd(13,"9");t.defaultArweaveMs="".padEnd(13,"0"),t.sortingFirst="".padEnd(64,"0"),t.sortingLast="".padEnd(64,"z"),t.genesisSortKey=`${"".padStart(12,"0")},${u},${t.sortingFirst}`,t.lastPossibleSortKey=`${"".padStart(12,"9")},${a},${t.sortingLast}`;var s=class{constructor(e){this.arweave=e,this.logger=r.LoggerFactory.INST.create("LexicographicalInteractionsSorter")}async sort(e){let o=[...e],c=o.map(f=>this.addSortKey(f));return await Promise.all(c),o.sort((f,l)=>f.node.sortKey.localeCompare(l.node.sortKey))}async createSortKey(e,o,c,f=!1){let l=this.arweave.utils.b64UrlToBuffer(e),p=this.arweave.utils.b64UrlToBuffer(o),g=this.arweave.utils.concatBuffers([l,p]),y=(0,i.arrayToHex)(await this.arweave.crypto.hash(g)),m=`${c}`.padStart(12,"0"),M=f?a:t.defaultArweaveMs;return`${m},${M},${y}`}extractBlockHeight(e){return e?parseInt(e.split(",")[0]):null}async addSortKey(e){let{node:o}=e,c=e.node.sortKey;c?(e.node.sortKey=c,this.logger.debug("Using sortKey from sequencer",e.node.sortKey)):e.node.sortKey=await this.createSortKey(o.block.id,o.id,o.block.height)}generateLastSortKey(e){return`${`${e}`.padStart(12,"0")},${a},${t.sortingLast}`}};t.LexicographicalInteractionsSorter=s}),wa=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.JsHandlerApi=t.KnownErrors=void 0;var i=pu(),r=Er(),u=va(),a=Li(),s=gu(),e="__init",o=(l,p)=>{let g=new Error(p);throw g.name=l,g},c;(function(l){l.ContractError="ContractError",l.ConstructorError="ConstructorError",l.NetworkCommunicationError="NetworkCommunicationError",l.NonWhitelistedSourceError="NonWhitelistedSourceError"})(c=t.KnownErrors||(t.KnownErrors={}));var f=class extends s.AbstractContractHandler{constructor(l,p,g){super(l,p),this.contractFunction=g}async handle(l,p,g){let{interaction:y,interactionTx:m}=g;return this.setupSwGlobal(g),this.enableInternalWrites(l,m),this.assertNotConstructorCall(y),await this.runContractFunction(l,y,p.state)}initState(l){}async maybeCallStateConstructor(l,p){var g,y;if(!((y=(g=this.contractDefinition.manifest)===null||g===void 0?void 0:g.evaluationOptions)===null||y===void 0)&&y.useConstructor){let m={input:{function:e,args:l},caller:this.contractDefinition.owner,interactionType:"write"},M={owner:{address:p.caller,key:null},sortKey:a.genesisSortKey},E={interaction:m,interactionTx:M};this.setupSwGlobal(E);let B=this.configureSwGlobalForConstructor(),x=await this.runContractFunction(p,m,{});if(B(),x.type!=="ok")throw p.contract.isRoot()?new Error(`ConstructorError: ${x.errorMessage}`):new u.ContractError(`ConstructorError [${p.contract.txId()}]: ${x.errorMessage}`,"constructor");return x.state}else return l}assertNotConstructorCall(l){var p,g;if(!((g=(p=this.contractDefinition.manifest)===null||p===void 0?void 0:p.evaluationOptions)===null||g===void 0)&&g.useConstructor&&l.input.function===e)throw new Error(`You have enabled {useConstructor: true} option, so you can't call function ${e}`)}configureSwGlobalForConstructor(){let l=m=>({get:(M,E)=>o("ConstructorError",`SmartWeave.${m}.${String(E)} is not accessible in constructor context`)});this.swGlobal.contracts.readContractState=()=>o("ConstructorError","Internal writes feature is not available in constructor"),this.swGlobal.contracts.viewContractState=()=>o("ConstructorError","Internal writes feature is not available in constructor"),this.swGlobal.contracts.refreshState=()=>o("ConstructorError","Internal writes feature is not available in constructor"),this.swGlobal.contracts.write=()=>o("ConstructorError","Internal writes feature is not available in constructor");let p=new i.SWBlock(this.swGlobal);this.swGlobal.block=new Proxy(this.swGlobal.block,l("block"));let g=new i.SWVrf(this.swGlobal);this.swGlobal.vrf=new Proxy(this.swGlobal.vrf,l("vrf"));let y=new i.SWTransaction(this.swGlobal);return this.swGlobal.transaction=new Proxy(this.swGlobal.vrf,l("transaction")),()=>{this.swGlobal.block=p,this.swGlobal.vrf=g,this.swGlobal.transaction=y}}async runContractFunction(l,p,g){let y=(0,r.deepCopy)(g),{timeoutId:m,timeoutPromise:M}=(0,r.timeout)(l.evaluationOptions.maxInteractionEvaluationTimeSeconds);try{await this.swGlobal.kv.open(),await this.swGlobal.kv.begin();let E=await Promise.race([M,this.contractFunction(y,p)]);if(E&&(E.state!==void 0||E.result!==void 0)){await this.swGlobal.kv.commit();let B=null;return E.event&&(B={contractTxId:this.swGlobal.contract.id,sortKey:this.swGlobal.transaction.sortKey,transactionId:this.swGlobal.transaction.id,caller:p.caller,input:p.input,blockTimestamp:this.swGlobal.block.timestamp,blockHeight:this.swGlobal.block.height,data:E.event}),{type:"ok",result:E.result,state:E.state||y,event:B}}throw new Error(`Unexpected result from contract: ${JSON.stringify(E)}`)}catch(E){switch(await this.swGlobal.kv.rollback(),E.name){case c.ContractError:return{type:"error",errorMessage:E.message,state:g,result:null,event:null};case c.ConstructorError:throw l.contract.isRoot()?Error(`ConstructorError: ${E.message}`):new u.ContractError(`ConstructorError [${l.contract.txId()}]: ${E.message}`,"constructor");case c.NetworkCommunicationError:throw E;case c.NonWhitelistedSourceError:return{type:"error",errorMessage:E.message,state:g,result:null,event:null};default:return{type:"exception",errorMessage:`${E&&E.stack||E&&E.message||E}`,state:g,result:null,event:null}}}finally{m&&clearTimeout(m),await this.swGlobal.kv.close()}}setupSwGlobal({interaction:l,interactionTx:p}){this.swGlobal._activeTx=p,this.swGlobal.caller=l.caller}enableInternalWrites(l,p){this.assignReadContractState(l,p),this.assignViewContractState(l),this.assignWrite(l),this.assignRefreshState(l)}};t.JsHandlerApi=f}),Er=gt(t=>{lt();var i=t&&t.__importDefault||function(N){return N&&N.__esModule?N:{default:N}};Object.defineProperty(t,"__esModule",{value:!0}),t.safeGet=t.getJsonResponse=t.NetworkCommunicationError=t.isBrowser=t.bufToBn=t.indent=t.stripTrailingSlash=t.timeout=t.descS=t.desc=t.ascS=t.asc=t.mapReviver=t.mapReplacer=t.deepCopy=t.safeParseInt=t.sleep=void 0;var r=i(Gp()),u=wa(),a=N=>new Promise(F=>setTimeout(F,N));t.sleep=a;var s=N=>{let F=Number.parseInt(N);if(Number.isNaN(F)&&!Number.isSafeInteger(F))throw Error(`Failed to cast ${N} to integer`);return F};t.safeParseInt=s;var e=N=>(0,r.default)(N);t.deepCopy=e;var o=(N,F)=>F instanceof Map?{dataType:"Map",value:Array.from(F.entries())}:F;t.mapReplacer=o;var c=(N,F)=>typeof F=="object"&&F!==null&&F.dataType==="Map"?new Map(F.value):F;t.mapReviver=c;var f=(N,F)=>N-F;t.asc=f;var l=(N,F)=>+N-+F;t.ascS=l;var p=(N,F)=>F-N;t.desc=p;var g=(N,F)=>+F-+N;t.descS=g;function y(N){let F=null,I=new Promise((U,P)=>{F=setTimeout(()=>{clearTimeout(F),P("timeout")},N*1e3)});return{timeoutId:F,timeoutPromise:I}}t.timeout=y;function m(N){return N.endsWith("/")?N.slice(0,-1):N}t.stripTrailingSlash=m;function M(N){return`[d:${N}]`.padEnd(N*2,"-").concat("> ")}t.indent=M;function E(N){let F=[];return Uint8Array.from(N).forEach(function(I){let U=I.toString(16);U.length%2&&(U="0"+U),F.push(U)}),BigInt("0x"+F.join(""))}t.bufToBn=E,t.isBrowser=new Function("try {return this===window;}catch(e){ return false;}");var B=class extends Error{constructor(N){super(N.toString()),this.error=N,this.name=u.KnownErrors.NetworkCommunicationError}};t.NetworkCommunicationError=B;async function x(N){let F;try{F=await N}catch(I){throw new B(`Error during network communication: ${JSON.stringify(I)}`)}if(!(F!=null&&F.ok)){let I=await F.text();throw new B(`Wrong response code: ${F.status}. ${I}`)}try{return await F.json()}catch(I){throw new B(`Error while parsing json response: ${JSON.stringify(I)}`)}}t.getJsonResponse=x;async function C(N,F){return x(fetch(N,F))}t.safeGet=C}),No=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.WarpGatewayInteractionsLoader=t.SourceType=void 0;var i=fn(),r=or();Jn();var u=Er(),a;(function(e){e.ARWEAVE="arweave",e.WARP_SEQUENCER="redstone-sequencer",e.BOTH="both"})(a=t.SourceType||(t.SourceType={}));var s=class{constructor(e=null,o=a.BOTH){this.confirmationStatus=e,this.source=o,this.logger=r.LoggerFactory.INST.create("WarpGatewayInteractionsLoader"),Object.assign(this,e),this.source=o}async load(e,o,c,f){this.logger.debug("Loading interactions: for ",{contractId:e,fromSortKey:o,toSortKey:c});let l=[],p=0,g=0,y=0,m=f?f.sourceType:this.source,M=i.Benchmark.measure(),E=(0,u.stripTrailingSlash)(this._warp.gwUrl());do{let B=i.Benchmark.measure(),x=`${E}/gateway/v2/interactions-sort-key`,C=await(0,u.getJsonResponse)(fetch(`${x}?${new URLSearchParams({contractId:e,...this._warp.whoAmI?{client:this._warp.whoAmI}:"",...o?{from:o}:"",...c?{to:c}:"",page:(++p).toString(),fromSdk:"true",...this.confirmationStatus&&this.confirmationStatus.confirmed?{confirmationStatus:"confirmed"}:"",...this.confirmationStatus&&this.confirmationStatus.notCorrupted?{confirmationStatus:"not_corrupted"}:"",...m==a.BOTH?"":{source:m}})}`));this.logger.debug(`Loading interactions: page ${p} loaded in ${B.elapsed()}`),l.push(...C.interactions),g=C.paging.limit,y=C.paging.items,this.logger.debug(`Loaded interactions length: ${l.length}, from: ${o}, to: ${c}`)}while(y==g);return this.logger.debug("All loaded interactions:",{from:o,to:c,loaded:l.length,time:M.elapsed()}),l}type(){return"warp"}clearCache(){}set warp(e){this._warp=e}};t.WarpGatewayInteractionsLoader=s}),Lo=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.InteractionCompleteEvent=t.CustomEvent=t.DefaultEvaluationOptions=t.EvalStateResult=void 0;var i=No(),r=class{constructor(e,o,c){this.state=e,this.validity=o,this.errorMessages=c}};t.EvalStateResult=r;var u=class{constructor(){this.ignoreExceptions=!0,this.waitForConfirmation=!1,this.updateCacheForEachInteraction=!1,this.internalWrites=!1,this.maxCallDepth=7,this.maxInteractionEvaluationTimeSeconds=60,this.stackTrace={saveState:!1},this.sequencerUrl="https://d1o5nlqr4okus2.cloudfront.net/",this.gasLimit=Number.MAX_SAFE_INTEGER,this.sourceType=i.SourceType.BOTH,this.unsafeClient="throw",this.allowBigInt=!1,this.walletBalanceUrl="http://nyc-1.dev.arweave.net:1984/",this.mineArLocalBlocks=!0,this.throwOnInternalWriteError=!0,this.cacheEveryNInteractions=-1,this.useKVStorage=!1,this.remoteStateSyncEnabled=!1,this.remoteStateSyncSource="https://dre-1.warp.cc/contract",this.useConstructor=!1,this.whitelistSources=[]}};t.DefaultEvaluationOptions=u;var a=class extends Event{constructor(e,o){super(e,o),this.detail=o.detail}};t.CustomEvent=a;var s=class{constructor(e,o,c,f,l,p,g,y){this.contractTxId=e,this.sortKey=o,this.transactionId=c,this.caller=f,this.input=l,this.blockTimestamp=p,this.blockHeight=g,this.data=y}};t.InteractionCompleteEvent=s}),Do=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.ContractCache=t.SrcCache=t.ContractMetadata=t.SUPPORTED_SRC_CONTENT_TYPES=void 0,t.SUPPORTED_SRC_CONTENT_TYPES=["application/javascript","application/wasm"];var i=class{};t.ContractMetadata=i;var r=class{constructor(a){this.src=a.src,this.srcBinary=a.srcBinary,this.srcWasmLang=a.srcWasmLang}};t.SrcCache=r;var u=class{constructor(a){this.txId=a.txId,this.srcTxId=a.srcTxId,this.initState=a.initState,this.manifest=a.manifest,this.minFee=a.minFee,this.owner=a.owner,this.contractType=a.contractType,this.metadata=a.metadata,this.contractTx=a.contractTx,this.srcTx=a.srcTx,this.testnet=a.testnet}};t.ContractCache=u}),_n=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.WARP_TAGS=t.SMART_WEAVE_TAGS=void 0,t.SMART_WEAVE_TAGS={APP_NAME:"App-Name",APP_VERSION:"App-Version",CONTRACT_TX_ID:"Contract",INPUT:"Input",CONTENT_TYPE:"Content-Type",CONTRACT_SRC_TX_ID:"Contract-Src",SDK:"SDK",MIN_FEE:"Min-Fee"},t.WARP_TAGS={SEQUENCER:"Sequencer",SEQUENCER_OWNER:"Sequencer-Owner",SEQUENCER_MILLIS:"Sequencer-Mills",SEQUENCER_SORT_KEY:"Sequencer-Sort-Key",SEQUENCER_PREV_SORT_KEY:"Sequencer-Prev-Sort-Key",SEQUENCER_LAST_SORT_KEY:"Sequencer-Last-Sort-Key",SEQUENCER_TX_ID:"Sequencer-Tx-Id",SEQUENCER_BLOCK_HEIGHT:"Sequencer-Block-Height",SEQUENCER_BLOCK_ID:"Sequencer-Block-Id",SEQUENCER_BLOCK_TIMESTAMP:"Sequencer-Block-Timestamp",INIT_STATE:"Init-State",INIT_STATE_TX:"Init-State-TX",INTERACT_WRITE:"Interact-Write",WASM_LANG:"Wasm-Lang",WASM_LANG_VERSION:"Wasm-Lang-Version",WASM_META:"Wasm-Meta",REQUEST_VRF:"Request-Vrf",SIGNATURE_TYPE:"Signature-Type",UPLOADER_TX_ID:"Uploader-Tx-Id",WARP_TESTNET:"Warp-Testnet",MANIFEST:"Contract-Manifest",NONCE:"Nonce"}}),Zp=gt((t,i)=>{lt(),function(r){var u,a=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,s=Math.ceil,e=Math.floor,o="[BigNumber Error] ",c=o+"Number primitive has more than 15 significant digits: ",f=1e14,l=14,p=9007199254740991,g=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,m=1e9;function M(U){var P,D,W,q=X.prototype={constructor:X,toString:null,valueOf:null},O=new X(1),L=20,n=4,d=-7,v=21,A=-1e7,T=1e7,S=!1,w=1,b=0,h={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},k="0123456789abcdefghijklmnopqrstuvwxyz",tt=!0;function X(R,j){var z,Z,Q,K,G,H,Y,it,ot=this;if(!(ot instanceof X))return new X(R,j);if(j==null){if(R&&R._isBigNumber===!0){ot.s=R.s,!R.c||R.e>T?ot.c=ot.e=null:R.e=10;G/=10,K++);K>T?ot.c=ot.e=null:(ot.e=K,ot.c=[R]);return}it=String(R)}else{if(!a.test(it=String(R)))return W(ot,it,H);ot.s=it.charCodeAt(0)==45?(it=it.slice(1),-1):1}(K=it.indexOf("."))>-1&&(it=it.replace(".","")),(G=it.search(/e/i))>0?(K<0&&(K=G),K+=+it.slice(G+1),it=it.substring(0,G)):K<0&&(K=it.length)}else{if(C(j,2,k.length,"Base"),j==10&&tt)return ot=new X(R),$(ot,L+ot.e+1,n);if(it=String(R),H=typeof R=="number"){if(R*0!=0)return W(ot,it,H,j);if(ot.s=1/R<0?(it=it.slice(1),-1):1,X.DEBUG&&it.replace(/^0\.0*|\./,"").length>15)throw Error(c+R)}else ot.s=it.charCodeAt(0)===45?(it=it.slice(1),-1):1;for(z=k.slice(0,j),K=G=0,Y=it.length;GK){K=Y;continue}}else if(!Q&&(it==it.toUpperCase()&&(it=it.toLowerCase())||it==it.toLowerCase()&&(it=it.toUpperCase()))){Q=!0,G=-1,K=0;continue}return W(ot,String(R),H,j)}H=!1,it=D(it,j,10,ot.s),(K=it.indexOf("."))>-1?it=it.replace(".",""):K=it.length}for(G=0;it.charCodeAt(G)===48;G++);for(Y=it.length;it.charCodeAt(--Y)===48;);if(it=it.slice(G,++Y)){if(Y-=G,H&&X.DEBUG&&Y>15&&(R>p||R!==e(R)))throw Error(c+ot.s*R);if((K=K-G-1)>T)ot.c=ot.e=null;else if(K=-m&&Q<=m&&Q===e(Q)){if(Z[0]===0){if(Q===0&&Z.length===1)return!0;break t}if(j=(Q+1)%l,j<1&&(j+=l),String(Z[0]).length==j){for(j=0;j=f||z!==e(z))break t;if(z!==0)return!0}}}else if(Z===null&&Q===null&&(K===null||K===1||K===-1))return!0;throw Error(o+"Invalid BigNumber: "+R)},X.maximum=X.max=function(){return et(arguments,-1)},X.minimum=X.min=function(){return et(arguments,1)},X.random=function(){var R=9007199254740992,j=Math.random()*R&2097151?function(){return e(Math.random()*R)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(z){var Z,Q,K,G,H,Y=0,it=[],ot=new X(O);if(z==null?z=L:C(z,0,m),G=s(z/l),S)if(crypto.getRandomValues){for(Z=crypto.getRandomValues(new Uint32Array(G*=2));Y>>11),H>=9e15?(Q=crypto.getRandomValues(new Uint32Array(2)),Z[Y]=Q[0],Z[Y+1]=Q[1]):(it.push(H%1e14),Y+=2);Y=G/2}else if(crypto.randomBytes){for(Z=crypto.randomBytes(G*=7);Y=9e15?crypto.randomBytes(7).copy(Z,Y):(it.push(H%1e14),Y+=7);Y=G/7}else throw S=!1,Error(o+"crypto unavailable");if(!S)for(;Y=10;H/=10,Y++);YQ-1&&(H[G+1]==null&&(H[G+1]=0),H[G+1]+=H[G]/Q|0,H[G]%=Q)}return H.reverse()}return function(z,Z,Q,K,G){var H,Y,it,ot,mt,_t,ht,vt,pt=z.indexOf("."),V=L,rt=n;for(pt>=0&&(ot=b,b=0,z=z.replace(".",""),vt=new X(Z),_t=vt.pow(z.length-pt),b=ot,vt.c=j(I(B(_t.c),_t.e,"0"),10,Q,R),vt.e=vt.c.length),ht=j(z,Z,Q,G?(H=k,R):(H=R,k)),it=ot=ht.length;ht[--ot]==0;ht.pop());if(!ht[0])return H.charAt(0);if(pt<0?--it:(_t.c=ht,_t.e=it,_t.s=K,_t=P(_t,vt,V,rt,Q),ht=_t.c,mt=_t.r,it=_t.e),Y=it+V+1,pt=ht[Y],ot=Q/2,mt=mt||Y<0||ht[Y+1]!=null,mt=rt<4?(pt!=null||mt)&&(rt==0||rt==(_t.s<0?3:2)):pt>ot||pt==ot&&(rt==4||mt||rt==6&&ht[Y-1]&1||rt==(_t.s<0?8:7)),Y<1||!ht[0])z=mt?I(H.charAt(1),-V,H.charAt(0)):H.charAt(0);else{if(ht.length=Y,mt)for(--Q;++ht[--Y]>Q;)ht[Y]=0,Y||(++it,ht=[1].concat(ht));for(ot=ht.length;!ht[--ot];);for(pt=0,z="";pt<=ot;z+=H.charAt(ht[pt++]));z=I(z,it,H.charAt(0))}return z}}(),P=function(){function R(Z,Q,K){var G,H,Y,it,ot=0,mt=Z.length,_t=Q%y,ht=Q/y|0;for(Z=Z.slice();mt--;)Y=Z[mt]%y,it=Z[mt]/y|0,G=ht*Y+it*_t,H=_t*Y+G%y*y+ot,ot=(H/K|0)+(G/y|0)+ht*it,Z[mt]=H%K;return ot&&(Z=[ot].concat(Z)),Z}function j(Z,Q,K,G){var H,Y;if(K!=G)Y=K>G?1:-1;else for(H=Y=0;HQ[H]?1:-1;break}return Y}function z(Z,Q,K,G){for(var H=0;K--;)Z[K]-=H,H=Z[K]1;Z.splice(0,1));}return function(Z,Q,K,G,H){var Y,it,ot,mt,_t,ht,vt,pt,V,rt,st,yt,Ct,dt,Mt,Lt,wt,ct=Z.s==Q.s?1:-1,Et=Z.c,ut=Q.c;if(!Et||!Et[0]||!ut||!ut[0])return new X(!Z.s||!Q.s||(Et?ut&&Et[0]==ut[0]:!ut)?NaN:Et&&Et[0]==0||!ut?ct*0:ct/0);for(pt=new X(ct),V=pt.c=[],it=Z.e-Q.e,ct=K+it+1,H||(H=f,it=E(Z.e/l)-E(Q.e/l),ct=ct/l|0),ot=0;ut[ot]==(Et[ot]||0);ot++);if(ut[ot]>(Et[ot]||0)&&it--,ct<0)V.push(1),mt=!0;else{for(dt=Et.length,Lt=ut.length,ot=0,ct+=2,_t=e(H/(ut[0]+1)),_t>1&&(ut=R(ut,_t,H),Et=R(Et,_t,H),Lt=ut.length,dt=Et.length),Ct=Lt,rt=Et.slice(0,Lt),st=rt.length;st=H/2&&Mt++;do{if(_t=0,Y=j(ut,rt,Lt,st),Y<0){if(yt=rt[0],Lt!=st&&(yt=yt*H+(rt[1]||0)),_t=e(yt/Mt),_t>1)for(_t>=H&&(_t=H-1),ht=R(ut,_t,H),vt=ht.length,st=rt.length;j(ht,rt,vt,st)==1;)_t--,z(ht,Lt=10;ct/=10,ot++);$(pt,K+(pt.e=ot+it*l-1)+1,G,mt)}else pt.e=it,pt.r=+mt;return pt}}();function ft(R,j,z,Z){var Q,K,G,H,Y;if(z==null?z=n:C(z,0,8),!R.c)return R.toString();if(Q=R.c[0],G=R.e,j==null)Y=B(R.c),Y=Z==1||Z==2&&(G<=d||G>=v)?F(Y,G):I(Y,G,"0");else if(R=$(new X(R),j,z),K=R.e,Y=B(R.c),H=Y.length,Z==1||Z==2&&(j<=K||K<=d)){for(;HH){if(--j>0)for(Y+=".";j--;Y+="0");}else if(j+=K-H,j>0)for(K+1==H&&(Y+=".");j--;Y+="0");return R.s<0&&Q?"-"+Y:Y}function et(R,j){for(var z,Z,Q=1,K=new X(R[0]);Q=10;Q/=10,Z++);return(z=Z+z*l-1)>T?R.c=R.e=null:z=10;H/=10,Q++);if(K=j-Q,K<0)K+=l,G=j,Y=mt[it=0],ot=e(Y/_t[Q-G-1]%10);else if(it=s((K+1)/l),it>=mt.length)if(Z){for(;mt.length<=it;mt.push(0));Y=ot=0,Q=1,K%=l,G=K-l+1}else break t;else{for(Y=H=mt[it],Q=1;H>=10;H/=10,Q++);K%=l,G=K-l+Q,ot=G<0?0:e(Y/_t[Q-G-1]%10)}if(Z=Z||j<0||mt[it+1]!=null||(G<0?Y:Y%_t[Q-G-1]),Z=z<4?(ot||Z)&&(z==0||z==(R.s<0?3:2)):ot>5||ot==5&&(z==4||Z||z==6&&(K>0?G>0?Y/_t[Q-G]:0:mt[it-1])%10&1||z==(R.s<0?8:7)),j<1||!mt[0])return mt.length=0,Z?(j-=R.e+1,mt[0]=_t[(l-j%l)%l],R.e=-j||0):mt[0]=R.e=0,R;if(K==0?(mt.length=it,H=1,it--):(mt.length=it+1,H=_t[l-K],mt[it]=G>0?e(Y/_t[Q-G]%_t[G])*H:0),Z)for(;;)if(it==0){for(K=1,G=mt[0];G>=10;G/=10,K++);for(G=mt[0]+=H,H=1;G>=10;G/=10,H++);K!=H&&(R.e++,mt[0]==f&&(mt[0]=1));break}else{if(mt[it]+=H,mt[it]!=f)break;mt[it--]=0,H=1}for(K=mt.length;mt[--K]===0;mt.pop());}R.e>T?R.c=R.e=null:R.e=v?F(j,z):I(j,z,"0"),R.s<0?"-"+j:j)}return q.absoluteValue=q.abs=function(){var R=new X(this);return R.s<0&&(R.s=1),R},q.comparedTo=function(R,j){return x(this,new X(R,j))},q.decimalPlaces=q.dp=function(R,j){var z,Z,Q,K=this;if(R!=null)return C(R,0,m),j==null?j=n:C(j,0,8),$(new X(K),R+K.e+1,j);if(!(z=K.c))return null;if(Z=((Q=z.length-1)-E(this.e/l))*l,Q=z[Q])for(;Q%10==0;Q/=10,Z--);return Z<0&&(Z=0),Z},q.dividedBy=q.div=function(R,j){return P(this,new X(R,j),L,n)},q.dividedToIntegerBy=q.idiv=function(R,j){return P(this,new X(R,j),0,1)},q.exponentiatedBy=q.pow=function(R,j){var z,Z,Q,K,G,H,Y,it,ot,mt=this;if(R=new X(R),R.c&&!R.isInteger())throw Error(o+"Exponent not an integer: "+J(R));if(j!=null&&(j=new X(j)),H=R.e>14,!mt.c||!mt.c[0]||mt.c[0]==1&&!mt.e&&mt.c.length==1||!R.c||!R.c[0])return ot=new X(Math.pow(+J(mt),H?R.s*(2-N(R)):+J(R))),j?ot.mod(j):ot;if(Y=R.s<0,j){if(j.c?!j.c[0]:!j.s)return new X(NaN);Z=!Y&&mt.isInteger()&&j.isInteger(),Z&&(mt=mt.mod(j))}else{if(R.e>9&&(mt.e>0||mt.e<-1||(mt.e==0?mt.c[0]>1||H&&mt.c[1]>=24e7:mt.c[0]<8e13||H&&mt.c[0]<=9999975e7)))return K=mt.s<0&&N(R)?-0:0,mt.e>-1&&(K=1/K),new X(Y?1/K:K);b&&(K=s(b/l+2))}for(H?(z=new X(.5),Y&&(R.s=1),it=N(R)):(Q=Math.abs(+J(R)),it=Q%2),ot=new X(O);;){if(it){if(ot=ot.times(mt),!ot.c)break;K?ot.c.length>K&&(ot.c.length=K):Z&&(ot=ot.mod(j))}if(Q){if(Q=e(Q/2),Q===0)break;it=Q%2}else if(R=R.times(z),$(R,R.e+1,1),R.e>14)it=N(R);else{if(Q=+J(R),Q===0)break;it=Q%2}mt=mt.times(mt),K?mt.c&&mt.c.length>K&&(mt.c.length=K):Z&&(mt=mt.mod(j))}return Z?ot:(Y&&(ot=O.div(ot)),j?ot.mod(j):K?$(ot,b,n,G):ot)},q.integerValue=function(R){var j=new X(this);return R==null?R=n:C(R,0,8),$(j,j.e+1,R)},q.isEqualTo=q.eq=function(R,j){return x(this,new X(R,j))===0},q.isFinite=function(){return!!this.c},q.isGreaterThan=q.gt=function(R,j){return x(this,new X(R,j))>0},q.isGreaterThanOrEqualTo=q.gte=function(R,j){return(j=x(this,new X(R,j)))===1||j===0},q.isInteger=function(){return!!this.c&&E(this.e/l)>this.c.length-2},q.isLessThan=q.lt=function(R,j){return x(this,new X(R,j))<0},q.isLessThanOrEqualTo=q.lte=function(R,j){return(j=x(this,new X(R,j)))===-1||j===0},q.isNaN=function(){return!this.s},q.isNegative=function(){return this.s<0},q.isPositive=function(){return this.s>0},q.isZero=function(){return!!this.c&&this.c[0]==0},q.minus=function(R,j){var z,Z,Q,K,G=this,H=G.s;if(R=new X(R,j),j=R.s,!H||!j)return new X(NaN);if(H!=j)return R.s=-j,G.plus(R);var Y=G.e/l,it=R.e/l,ot=G.c,mt=R.c;if(!Y||!it){if(!ot||!mt)return ot?(R.s=-j,R):new X(mt?G:NaN);if(!ot[0]||!mt[0])return mt[0]?(R.s=-j,R):new X(ot[0]?G:n==3?-0:0)}if(Y=E(Y),it=E(it),ot=ot.slice(),H=Y-it){for((K=H<0)?(H=-H,Q=ot):(it=Y,Q=mt),Q.reverse(),j=H;j--;Q.push(0));Q.reverse()}else for(Z=(K=(H=ot.length)<(j=mt.length))?H:j,H=j=0;j0)for(;j--;ot[z++]=0);for(j=f-1;Z>H;){if(ot[--Z]=0;){for(z=0,_t=yt[Q]%V,ht=yt[Q]/V|0,G=Y,K=Q+G;K>Q;)it=st[--G]%V,ot=st[G]/V|0,H=ht*it+ot*_t,it=_t*it+H%V*V+vt[K]+z,z=(it/pt|0)+(H/V|0)+ht*ot,vt[K--]=it%pt;vt[K]=z}return z?++Z:vt.splice(0,1),at(R,vt,Z)},q.negated=function(){var R=new X(this);return R.s=-R.s||null,R},q.plus=function(R,j){var z,Z=this,Q=Z.s;if(R=new X(R,j),j=R.s,!Q||!j)return new X(NaN);if(Q!=j)return R.s=-j,Z.minus(R);var K=Z.e/l,G=R.e/l,H=Z.c,Y=R.c;if(!K||!G){if(!H||!Y)return new X(Q/0);if(!H[0]||!Y[0])return Y[0]?R:new X(H[0]?Z:Q*0)}if(K=E(K),G=E(G),H=H.slice(),Q=K-G){for(Q>0?(G=K,z=Y):(Q=-Q,z=H),z.reverse();Q--;z.push(0));z.reverse()}for(Q=H.length,j=Y.length,Q-j<0&&(z=Y,Y=H,H=z,j=Q),Q=0;j;)Q=(H[--j]=H[j]+Y[j]+Q)/f|0,H[j]=f===H[j]?0:H[j]%f;return Q&&(H=[Q].concat(H),++G),at(R,H,G)},q.precision=q.sd=function(R,j){var z,Z,Q,K=this;if(R!=null&&R!==!!R)return C(R,1,m),j==null?j=n:C(j,0,8),$(new X(K),R,j);if(!(z=K.c))return null;if(Q=z.length-1,Z=Q*l+1,Q=z[Q]){for(;Q%10==0;Q/=10,Z--);for(Q=z[0];Q>=10;Q/=10,Z++);}return R&&K.e+1>Z&&(Z=K.e+1),Z},q.shiftedBy=function(R){return C(R,-p,p),this.times("1e"+R)},q.squareRoot=q.sqrt=function(){var R,j,z,Z,Q,K=this,G=K.c,H=K.s,Y=K.e,it=L+4,ot=new X("0.5");if(H!==1||!G||!G[0])return new X(!H||H<0&&(!G||G[0])?NaN:G?K:1/0);if(H=Math.sqrt(+J(K)),H==0||H==1/0?(j=B(G),(j.length+Y)%2==0&&(j+="0"),H=Math.sqrt(+j),Y=E((Y+1)/2)-(Y<0||Y%2),H==1/0?j="5e"+Y:(j=H.toExponential(),j=j.slice(0,j.indexOf("e")+1)+Y),z=new X(j)):z=new X(H+""),z.c[0]){for(Y=z.e,H=Y+it,H<3&&(H=0);;)if(Q=z,z=ot.times(Q.plus(P(K,Q,it,1))),B(Q.c).slice(0,H)===(j=B(z.c)).slice(0,H))if(z.e0&&vt>0){for(K=vt%H||H,ot=ht.substr(0,K);K0&&(ot+=it+ht.slice(K)),_t&&(ot="-"+ot)}Z=mt?ot+(z.decimalSeparator||"")+((Y=+z.fractionGroupSize)?mt.replace(new RegExp("\\d{"+Y+"}\\B","g"),"$&"+(z.fractionGroupSeparator||"")):mt):ot}return(z.prefix||"")+Z+(z.suffix||"")},q.toFraction=function(R){var j,z,Z,Q,K,G,H,Y,it,ot,mt,_t,ht=this,vt=ht.c;if(R!=null&&(H=new X(R),!H.isInteger()&&(H.c||H.s!==1)||H.lt(O)))throw Error(o+"Argument "+(H.isInteger()?"out of range: ":"not an integer: ")+J(H));if(!vt)return new X(ht);for(j=new X(O),it=z=new X(O),Z=Y=new X(O),_t=B(vt),K=j.e=_t.length-ht.e-1,j.c[0]=g[(G=K%l)<0?l+G:G],R=!R||H.comparedTo(j)>0?K>0?j:it:H,G=T,T=1/0,H=new X(_t),Y.c[0]=0;ot=P(H,j,0,1),Q=z.plus(ot.times(Z)),Q.comparedTo(R)!=1;)z=Z,Z=Q,it=Y.plus(ot.times(Q=it)),Y=Q,j=H.minus(ot.times(Q=j)),H=Q;return Q=P(R.minus(z),Z,0,1),Y=Y.plus(Q.times(it)),z=z.plus(Q.times(Z)),Y.s=it.s=ht.s,K=K*2,mt=P(it,Z,K,n).minus(ht).abs().comparedTo(P(Y,z,K,n).minus(ht).abs())<1?[it,Z]:[Y,z],T=G,mt},q.toNumber=function(){return+J(this)},q.toPrecision=function(R,j){return R!=null&&C(R,1,m),ft(this,R,j,2)},q.toString=function(R){var j,z=this,Z=z.s,Q=z.e;return Q===null?Z?(j="Infinity",Z<0&&(j="-"+j)):j="NaN":(R==null?j=Q<=d||Q>=v?F(B(z.c),Q):I(B(z.c),Q,"0"):R===10&&tt?(z=$(new X(z),L+Q+1,n),j=I(B(z.c),z.e,"0")):(C(R,2,k.length,"Base"),j=D(I(B(z.c),Q,"0"),10,R,Z,!0)),Z<0&&z.c[0]&&(j="-"+j)),j},q.valueOf=q.toJSON=function(){return J(this)},q._isBigNumber=!0,U!=null&&X.set(U),X}function E(U){var P=U|0;return U>0||U===P?P:P-1}function B(U){for(var P,D,W=1,q=U.length,O=U[0]+"";Wv^D?1:-1;for(n=(d=q.length)<(v=O.length)?d:v,L=0;LO[L]^D?1:-1;return d==v?0:d>v^D?1:-1}function C(U,P,D,W){if(UD||U!==e(U))throw Error(o+(W||"Argument")+(typeof U=="number"?UD?" out of range: ":" not an integer: ":" not a primitive number: ")+String(U))}function N(U){var P=U.c.length-1;return E(U.e/l)==P&&U.c[P]%2!=0}function F(U,P){return(U.length>1?U.charAt(0)+"."+U.slice(1):U)+(P<0?"e":"e+")+P}function I(U,P,D){var W,q;if(P<0){for(q=D+".";++P;q+=D);U=q+U}else if(W=U.length,++P>W){for(q=D,P-=W;--P;q+=D);U+=q}else P{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=Zp(),r=class{constructor(){Pt(this,"BigNum");this.BigNum=(u,a)=>{let s=i.BigNumber.clone({DECIMAL_PLACES:a});return new s(u)}}winstonToAr(u,{formatted:a=!1,decimals:s=12,trim:e=!0}={}){let o=this.stringToBigNum(u,s).shiftedBy(-12);return a?o.toFormat(s):o.toFixed(s)}arToWinston(u,{formatted:a=!1}={}){let s=this.stringToBigNum(u).shiftedBy(12);return a?s.toFormat():s.toFixed(0)}compare(u,a){let s=this.stringToBigNum(u),e=this.stringToBigNum(a);return s.comparedTo(e)}isEqual(u,a){return this.compare(u,a)===0}isLessThan(u,a){let s=this.stringToBigNum(u),e=this.stringToBigNum(a);return s.isLessThan(e)}isGreaterThan(u,a){let s=this.stringToBigNum(u),e=this.stringToBigNum(a);return s.isGreaterThan(e)}add(u,a){let s=this.stringToBigNum(u);return this.stringToBigNum(a),s.plus(a).toFixed(0)}sub(u,a){let s=this.stringToBigNum(u);return this.stringToBigNum(a),s.minus(a).toFixed(0)}stringToBigNum(u,a=12){return this.BigNum(u,a)}};t.default=r}),Xp=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=class{constructor(a){Pt(this,"METHOD_GET","GET");Pt(this,"METHOD_POST","POST");Pt(this,"config");this.applyConfig(a)}applyConfig(a){this.config=this.mergeDefaults(a)}getConfig(){return this.config}mergeDefaults(a){let s=a.protocol||"http",e=a.port||(s==="https"?443:80);return{host:a.host||"127.0.0.1",protocol:s,port:e,timeout:a.timeout||2e4,logging:a.logging||!1,logger:a.logger||console.log,network:a.network}}async get(a,s){return await this.request(a,{...s,method:this.METHOD_GET})}async post(a,s,e){var c;let o=new Headers((e==null?void 0:e.headers)||{});return(c=o.get("content-type"))!=null&&c.includes("application/json")||o.append("content-type","application/json"),o.append("accept","application/json, text/plain, */*"),await this.request(a,{...e,method:this.METHOD_POST,body:typeof s!="string"?JSON.stringify(s):s,headers:o})}async request(a,s){var y,m;let e=new Headers((s==null?void 0:s.headers)||{}),o=`${this.config.protocol}://${this.config.host}:${this.config.port}`,c=s==null?void 0:s.responseType;s==null||delete s.responseType,a.startsWith("/")&&(a=a.slice(1)),this.config.network&&e.append("x-network",this.config.network),this.config.logging&&this.config.logger(`Requesting: ${o}/${a}`);let f=await fetch(`${o}/${a}`,{...s||{},headers:e});this.config.logging&&this.config.logger(`Response: ${f.url} - ${f.status}`);let l=(m=(y=f.headers.get("content-type"))==null?void 0:y.match(/charset=([^()<>@,;:\"/[\]?.=\s]*)/i))==null?void 0:m[1],p=f,g=async()=>{if(l)try{p.data=new TextDecoder(l).decode(await f.arrayBuffer())}catch{p.data=await f.text()}else p.data=await f.text()};if(c==="arraybuffer")p.data=await f.arrayBuffer();else if(c==="text")await g();else if(c==="webstream")p.data=r(f.body);else try{let M=await f.clone().json();typeof M!="object"?await g():p.data=await f.json(),M=null}catch{await g()}return p}};t.default=i;var r=a=>{let s=a;return typeof s[Symbol.asyncIterator]>"u"?(s[Symbol.asyncIterator]=u(a),s):a},u=function(a){return async function*(){let s=a.getReader();try{for(;;){let{done:e,value:o}=await s.read();if(e)return;yield o}}finally{s.releaseLock()}}}}),En=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var i=Co();function r(g){let y=0;for(let E=0;E{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=En(),r=class{constructor(){Pt(this,"keyLength",4096);Pt(this,"publicExponent",65537);Pt(this,"hashAlgorithm","sha256");Pt(this,"driver");if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let u=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),a=await this.driver.exportKey("jwk",u.privateKey);return{kty:a.kty,e:a.e,n:a.n,d:a.d,p:a.p,q:a.q,dp:a.dp,dq:a.dq,qi:a.qi}}async sign(u,a,{saltLength:s}={}){let e=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(u),a);return new Uint8Array(e)}async hash(u,a="SHA-256"){let s=await this.driver.digest(a,u);return new Uint8Array(s)}async verify(u,a,s){let e={kty:"RSA",e:"AQAB",n:u},o=await this.jwkToPublicCryptoKey(e),c=await this.driver.digest("SHA-256",a),f=await this.driver.verify({name:"RSA-PSS",saltLength:0},o,s,a),l=await this.driver.verify({name:"RSA-PSS",saltLength:32},o,s,a),p=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((o.algorithm.modulusLength-1)/8)-c.byteLength-2},o,s,a);return f||l||p}async jwkToCryptoKey(u){return this.driver.importKey("jwk",u,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(u){return this.driver.importKey("jwk",u,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let u=crypto==null?void 0:crypto.subtle;return u===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(a=>typeof u[a]=="function")}async encrypt(u,a,s){let e=await this.driver.importKey("raw",typeof a=="string"?i.stringToBuffer(a):a,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:s?i.stringToBuffer(s):i.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},e,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),c=new Uint8Array(16);crypto.getRandomValues(c);let f=await this.driver.encrypt({name:"AES-CBC",iv:c},o,u);return i.concatBuffers([c,f])}async decrypt(u,a,s){let e=await this.driver.importKey("raw",typeof a=="string"?i.stringToBuffer(a):a,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:s?i.stringToBuffer(s):i.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},e,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),c=u.slice(0,16),f=await this.driver.decrypt({name:"AES-CBC",iv:c},o,u.slice(16));return i.concatBuffers([f])}};t.default=r}),Qp=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=class{constructor(r){Pt(this,"api");this.api=r}getInfo(){return this.api.get("info").then(r=>r.data)}getPeers(){return this.api.get("peers").then(r=>r.data)}};t.default=i}),jo=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.getError=void 0;var i=class extends Error{constructor(s,e={}){var a=(...u)=>(super(...u),Pt(this,"type"),Pt(this,"response"),this);e.message?a(e.message):a(),this.type=s,this.response=e.response}getType(){return this.type}};t.default=i;function r(a){let s=a.data;if(typeof a.data=="string")try{s=JSON.parse(a.data)}catch{}if(a.data instanceof ArrayBuffer||a.data instanceof Uint8Array)try{s=JSON.parse(s.toString())}catch{}return s?s.error||s:a.statusText||"unknown"}t.getError=r}),tg=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=fo();async function r(a){if(Array.isArray(a)){let o=i.default.utils.concatBuffers([i.default.utils.stringToBuffer("list"),i.default.utils.stringToBuffer(a.length.toString())]);return await u(a,await i.default.crypto.hash(o,"SHA-384"))}let s=i.default.utils.concatBuffers([i.default.utils.stringToBuffer("blob"),i.default.utils.stringToBuffer(a.byteLength.toString())]),e=i.default.utils.concatBuffers([await i.default.crypto.hash(s,"SHA-384"),await i.default.crypto.hash(a,"SHA-384")]);return await i.default.crypto.hash(e,"SHA-384")}t.default=r;async function u(a,s){if(a.length<1)return s;let e=i.default.utils.concatBuffers([s,await r(a[0])]),o=await i.default.crypto.hash(e,"SHA-384");return await u(a.slice(1),o)}}),Hf=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.debug=t.validatePath=t.arrayCompare=t.bufferToInt=t.intToBuffer=t.arrayFlatten=t.generateProofs=t.buildLayers=t.generateTransactionChunks=t.generateTree=t.computeRootHash=t.generateLeaves=t.chunkData=t.MIN_CHUNK_SIZE=t.MAX_CHUNK_SIZE=void 0;var i=fo(),r=En();t.MAX_CHUNK_SIZE=256*1024,t.MIN_CHUNK_SIZE=32*1024;var u=32,a=32;async function s(F){let I=[],U=F,P=0;for(;U.byteLength>=t.MAX_CHUNK_SIZE;){let D=t.MAX_CHUNK_SIZE,W=U.byteLength-t.MAX_CHUNK_SIZE;W>0&&W({type:"leaf",id:await M(await Promise.all([M(I),M(E(P))])),dataHash:I,minByteRange:U,maxByteRange:P})))}t.generateLeaves=e;async function o(F){return(await c(F)).id}t.computeRootHash=o;async function c(F){return await l(await e(await s(F)))}t.generateTree=c;async function f(F){let I=await s(F),U=await e(I),P=await l(U),D=await p(P),W=I.slice(-1)[0];return W.maxByteRange-W.minByteRange===0&&(I.splice(I.length-1,1),D.splice(D.length-1,1)),{data_root:P.id,chunks:I,proofs:D}}t.generateTransactionChunks=f;async function l(F,I=0){if(F.length<2)return F[0];let U=[];for(let P=0;P{Array.isArray(U)?I.push(...y(U)):I.push(U)}),I}t.arrayFlatten=y;async function m(F,I){return I?{type:"branch",id:await M([await M(F.id),await M(I.id),await M(E(F.maxByteRange))]),byteRange:F.maxByteRange,maxByteRange:I.maxByteRange,leftChild:F,rightChild:I}:F}async function M(F){return Array.isArray(F)&&(F=i.default.utils.concatBuffers(F)),new Uint8Array(await i.default.crypto.hash(F))}function E(F){let I=new Uint8Array(u);for(var U=I.length-1;U>=0;U--){var P=F%256;I[U]=P,F=(F-P)/256}return I}t.intToBuffer=E;function B(F){let I=0;for(var U=0;UF.every((U,P)=>I[P]===U);t.arrayCompare=x;async function C(F,I,U,P,D){if(P<=0)return!1;if(I>=P)return C(F,0,P-1,P,D);if(I<0)return C(F,0,0,P,D);if(D.length==a+u){let v=D.slice(0,a),A=D.slice(v.length,v.length+u),T=await M([await M(v),await M(A)]);return(0,t.arrayCompare)(F,T)?{offset:P-1,leftBound:U,rightBound:P,chunkSize:P-U}:!1}let W=D.slice(0,a),q=D.slice(W.length,W.length+a),O=D.slice(W.length+q.length,W.length+q.length+u),L=B(O),n=D.slice(W.length+q.length+O.length),d=await M([await M(W),await M(q),await M(O)]);return(0,t.arrayCompare)(F,d)?I ${JSON.stringify(O)}`;return N(q,L)}t.debug=N}),mu=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.Tag=void 0;var i=En(),r=tg(),u=Hf(),a=class{get(o,c){if(!Object.getOwnPropertyNames(this).includes(o))throw new Error(`Field "${o}" is not a property of the Arweave Transaction class.`);if(this[o]instanceof Uint8Array)return c&&c.decode&&c.string?i.bufferToString(this[o]):c&&c.decode&&!c.string?this[o]:i.bufferTob64Url(this[o]);if(this[o]instanceof Array){if((c==null?void 0:c.decode)!==void 0||(c==null?void 0:c.string)!==void 0)throw o==="tags"&&console.warn(`Did you mean to use 'transaction["tags"]' ?`),new Error("Cannot decode or stringify an array.");return this[o]}return c&&c.decode==!0?c&&c.string?i.b64UrlToString(this[o]):i.b64UrlToBuffer(this[o]):this[o]}},s=class extends a{constructor(c,f,l=!1){super();Pt(this,"name");Pt(this,"value");this.name=c,this.value=f}};t.Tag=s;var e=class extends a{constructor(c={}){super();Pt(this,"format",2);Pt(this,"id","");Pt(this,"last_tx","");Pt(this,"owner","");Pt(this,"tags",[]);Pt(this,"target","");Pt(this,"quantity","0");Pt(this,"data_size","0");Pt(this,"data",new Uint8Array);Pt(this,"data_root","");Pt(this,"reward","0");Pt(this,"signature","");Pt(this,"chunks");Object.assign(this,c),typeof this.data=="string"&&(this.data=i.b64UrlToBuffer(this.data)),c.tags&&(this.tags=c.tags.map(f=>new s(f.name,f.value)))}addTag(c,f){this.tags.push(new s(i.stringToB64Url(c),i.stringToB64Url(f)))}toJSON(){return{format:this.format,id:this.id,last_tx:this.last_tx,owner:this.owner,tags:this.tags,target:this.target,quantity:this.quantity,data:i.bufferTob64Url(this.data),data_size:this.data_size,data_root:this.data_root,data_tree:this.data_tree,reward:this.reward,signature:this.signature}}setOwner(c){this.owner=c}setSignature({id:c,owner:f,reward:l,tags:p,signature:g}){this.id=c,this.owner=f,l&&(this.reward=l),p&&(this.tags=p),this.signature=g}async prepareChunks(c){!this.chunks&&c.byteLength>0&&(this.chunks=await(0,u.generateTransactionChunks)(c),this.data_root=i.bufferTob64Url(this.chunks.data_root)),!this.chunks&&c.byteLength===0&&(this.chunks={chunks:[],data_root:new Uint8Array,proofs:[]},this.data_root="")}getChunk(c,f){if(!this.chunks)throw new Error("Chunks have not been prepared");let l=this.chunks.proofs[c],p=this.chunks.chunks[c];return{data_root:this.data_root,data_size:this.data_size,data_path:i.bufferTob64Url(l.proof),offset:l.offset.toString(),chunk:i.bufferTob64Url(f.slice(p.minByteRange,p.maxByteRange))}}async getSignatureData(){switch(this.format){case 1:let c=this.tags.reduce((l,p)=>i.concatBuffers([l,p.get("name",{decode:!0,string:!1}),p.get("value",{decode:!0,string:!1})]),new Uint8Array);return i.concatBuffers([this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),this.get("data",{decode:!0,string:!1}),i.stringToBuffer(this.quantity),i.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),c]);case 2:this.data_root||await this.prepareChunks(this.data);let f=this.tags.map(l=>[l.get("name",{decode:!0,string:!1}),l.get("value",{decode:!0,string:!1})]);return await(0,r.default)([i.stringToBuffer(this.format.toString()),this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),i.stringToBuffer(this.quantity),i.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),f,i.stringToBuffer(this.data_size),this.get("data_root",{decode:!0,string:!1})]);default:throw new Error(`Unexpected transaction format: ${this.format}`)}}};t.default=e}),eg=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionUploader=void 0;var i=mu(),r=En(),u=jo(),a=Hf(),s=1,e=["invalid_json","chunk_too_big","data_path_too_big","offset_too_big","data_size_too_big","chunk_proof_ratio_not_attractive","invalid_proof"],o=1e3*40,c=class{constructor(f,l){Pt(this,"api");Pt(this,"chunkIndex",0);Pt(this,"txPosted",!1);Pt(this,"transaction");Pt(this,"lastRequestTimeEnd",0);Pt(this,"totalErrors",0);Pt(this,"data");Pt(this,"lastResponseStatus",0);Pt(this,"lastResponseError","");if(this.api=f,!l.id)throw new Error("Transaction is not signed");if(!l.chunks)throw new Error("Transaction chunks not prepared");this.data=l.data,this.transaction=new i.default(Object.assign({},l,{data:new Uint8Array(0)}))}get isComplete(){return this.txPosted&&this.chunkIndex===this.transaction.chunks.chunks.length}get totalChunks(){return this.transaction.chunks.chunks.length}get uploadedChunks(){return this.chunkIndex}get pctComplete(){return Math.trunc(this.uploadedChunks/this.totalChunks*100)}async uploadChunk(f){if(this.isComplete)throw new Error("Upload is already complete");if(this.lastResponseError!==""?this.totalErrors++:this.totalErrors=0,this.totalErrors===100)throw new Error(`Unable to complete upload: ${this.lastResponseStatus}: ${this.lastResponseError}`);let l=this.lastResponseError===""?0:Math.max(this.lastRequestTimeEnd+o-Date.now(),o);if(l>0&&(l=l-l*Math.random()*.3,await new Promise(y=>setTimeout(y,l))),this.lastResponseError="",!this.txPosted){await this.postTransaction();return}f&&(this.chunkIndex=f);let p=this.transaction.getChunk(f||this.chunkIndex,this.data);if(!await(0,a.validatePath)(this.transaction.chunks.data_root,parseInt(p.offset),0,parseInt(p.data_size),r.b64UrlToBuffer(p.data_path)))throw new Error(`Unable to validate chunk ${this.chunkIndex}`);let g=await this.api.post("chunk",this.transaction.getChunk(this.chunkIndex,this.data)).catch(y=>(console.error(y.message),{status:-1,data:{error:y.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=g.status,this.lastResponseStatus==200)this.chunkIndex++;else if(this.lastResponseError=(0,u.getError)(g),e.includes(this.lastResponseError))throw new Error(`Fatal error uploading chunk ${this.chunkIndex}: ${this.lastResponseError}`)}static async fromSerialized(f,l,p){if(!l||typeof l.chunkIndex!="number"||typeof l.transaction!="object")throw new Error("Serialized object does not match expected format.");var g=new i.default(l.transaction);g.chunks||await g.prepareChunks(p);let y=new c(f,g);if(y.chunkIndex=l.chunkIndex,y.lastRequestTimeEnd=l.lastRequestTimeEnd,y.lastResponseError=l.lastResponseError,y.lastResponseStatus=l.lastResponseStatus,y.txPosted=l.txPosted,y.data=p,y.transaction.data_root!==l.transaction.data_root)throw new Error("Data mismatch: Uploader doesn't match provided data.");return y}static async fromTransactionId(f,l){let p=await f.get(`tx/${l}`);if(p.status!==200)throw new Error(`Tx ${l} not found: ${p.status}`);let g=p.data;return g.data=new Uint8Array(0),{txPosted:!0,chunkIndex:0,lastResponseError:"",lastRequestTimeEnd:0,lastResponseStatus:0,transaction:g}}toJSON(){return{chunkIndex:this.chunkIndex,transaction:this.transaction,lastRequestTimeEnd:this.lastRequestTimeEnd,lastResponseStatus:this.lastResponseStatus,lastResponseError:this.lastResponseError,txPosted:this.txPosted}}async postTransaction(){if(this.totalChunks<=s){this.transaction.data=this.data;let l=await this.api.post("tx",this.transaction).catch(p=>(console.error(p),{status:-1,data:{error:p.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=l.status,this.transaction.data=new Uint8Array(0),l.status>=200&&l.status<300){this.txPosted=!0,this.chunkIndex=s;return}throw this.lastResponseError=(0,u.getError)(l),new Error(`Unable to upload transaction: ${l.status}, ${this.lastResponseError}`)}let f=await this.api.post("tx",this.transaction);if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=f.status,!(f.status>=200&&f.status<300))throw this.lastResponseError=(0,u.getError)(f),new Error(`Unable to upload transaction: ${f.status}, ${this.lastResponseError}`);this.txPosted=!0}};t.TransactionUploader=c}),Di=gt((t,i)=>{lt(),i.exports={}}),rg=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=jo(),r=mu(),u=En(),a=eg();Di();var s=class{constructor(e,o,c){Pt(this,"api");Pt(this,"crypto");Pt(this,"chunks");this.api=e,this.crypto=o,this.chunks=c}async getTransactionAnchor(){let e=await this.api.get("tx_anchor");if(!e.data.match(/^[a-z0-9_-]{43,}/i)||!e.ok)throw new Error(`Could not getTransactionAnchor. Received: ${e.data}. Status: ${e.status}, ${e.statusText}`);return e.data}async getPrice(e,o){let c=o?`price/${e}/${o}`:`price/${e}`,f=await this.api.get(c);if(!/^\d+$/.test(f.data)||!f.ok)throw new Error(`Could not getPrice. Received: ${f.data}. Status: ${f.status}, ${f.statusText}`);return f.data}async get(e){let o=await this.api.get(`tx/${e}`);if(o.status==200){let c=parseInt(o.data.data_size);if(o.data.format>=2&&c>0&&c<=1024*1024*12){let f=await this.getData(e);return new r.default({...o.data,data:f})}return new r.default({...o.data,format:o.data.format||1})}throw o.status==404?new i.default("TX_NOT_FOUND"):o.status==410?new i.default("TX_FAILED"):new i.default("TX_INVALID")}fromRaw(e){return new r.default(e)}async search(e,o){return this.api.post("arql",{op:"equals",expr1:e,expr2:o}).then(c=>c.data?c.data:[])}getStatus(e){return this.api.get(`tx/${e}/status`).then(o=>o.status==200?{status:200,confirmed:o.data}:{status:o.status,confirmed:null})}async getData(e,o){let c;try{c=await this.chunks.downloadChunkedData(e)}catch(f){console.error(`Error while trying to download chunked data for ${e}`),console.error(f)}if(!c){console.warn(`Falling back to gateway cache for ${e}`);try{let{data:f,ok:l,status:p,statusText:g}=await this.api.get(`/${e}`,{responseType:"arraybuffer"});if(!l)throw new Error("Bad http status code",{cause:{status:p,statusText:g}});c=f}catch(f){console.error(`Error while trying to download contiguous data from gateway cache for ${e}`),console.error(f)}}if(!c)throw new Error(`${e} data was not found!`);return o&&o.decode&&!o.string?c:o&&o.decode&&o.string?u.bufferToString(c):u.bufferTob64Url(c)}async sign(e,o,c){let f=typeof o=="object"&&(p=>{let g=!0;return["n","e","d","p","q","dp","dq","qi"].map(y=>!(y in p)&&(g=!1)),g})(o),l=typeof arweaveWallet=="object";if(!f&&!l)throw new Error("No valid JWK or external wallet found to sign transaction.");if(l){try{(await arweaveWallet.getPermissions()).includes("SIGN_TRANSACTION")||await arweaveWallet.connect(["SIGN_TRANSACTION"])}catch{}let p=await arweaveWallet.sign(e,c);e.setSignature({id:p.id,owner:p.owner,reward:p.reward,tags:p.tags,signature:p.signature})}else if(f){e.setOwner(o.n);let p=await e.getSignatureData(),g=await this.crypto.sign(o,p,c),y=await this.crypto.hash(g);e.setSignature({id:u.bufferTob64Url(y),owner:o.n,signature:u.bufferTob64Url(g)})}else throw new Error("An error occurred while signing. Check wallet is valid")}async verify(e){let o=await e.getSignatureData(),c=e.get("signature",{decode:!0,string:!1}),f=u.bufferTob64Url(await this.crypto.hash(c));if(e.id!==f)throw new Error("Invalid transaction signature or ID! The transaction ID doesn't match the expected SHA-256 hash of the signature.");return this.crypto.verify(e.owner,o,c)}async post(e){if(typeof e=="string"?e=new r.default(JSON.parse(e)):typeof e.readInt32BE=="function"?e=new r.default(JSON.parse(e.toString())):typeof e=="object"&&!(e instanceof r.default)&&(e=new r.default(e)),!(e instanceof r.default))throw new Error("Must be Transaction object");e.chunks||await e.prepareChunks(e.data);let o=await this.getUploader(e,e.data);try{for(;!o.isComplete;)await o.uploadChunk()}catch(c){if(o.lastResponseStatus>0)return{status:o.lastResponseStatus,statusText:o.lastResponseError,data:{error:o.lastResponseError}};throw c}return{status:200,statusText:"OK",data:{}}}async getUploader(e,o){let c;if(o instanceof ArrayBuffer&&(o=new Uint8Array(o)),e instanceof r.default){if(o||(o=e.data),!(o instanceof Uint8Array))throw new Error("Data format is invalid");e.chunks||await e.prepareChunks(o),c=new a.TransactionUploader(this.api,e),(!c.data||c.data.length===0)&&(c.data=o)}else{if(typeof e=="string"&&(e=await a.TransactionUploader.fromTransactionId(this.api,e)),!o||!(o instanceof Uint8Array))throw new Error("Must provide data when resuming upload");c=await a.TransactionUploader.fromSerialized(this.api,e,o)}return c}async*upload(e,o){let c=await this.getUploader(e,o);for(;!c.isComplete;)await c.uploadChunk(),yield c;return c}};t.default=s}),ng=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=En();Di();var r=class{constructor(u,a){Pt(this,"api");Pt(this,"crypto");this.api=u,this.crypto=a}getBalance(u){return this.api.get(`wallet/${u}/balance`).then(a=>a.data)}getLastTransactionID(u){return this.api.get(`wallet/${u}/last_tx`).then(a=>a.data)}generate(){return this.crypto.generateJWK()}async jwkToAddress(u){return!u||u==="use_wallet"?this.getAddress():this.getAddress(u)}async getAddress(u){if(!u||u==="use_wallet"){try{await arweaveWallet.connect(["ACCESS_ADDRESS"])}catch{}return arweaveWallet.getActiveAddress()}else return this.ownerToAddress(u.n)}async ownerToAddress(u){return i.bufferTob64Url(await this.crypto.hash(i.b64UrlToBuffer(u)))}};t.default=r}),ig=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.SiloResource=void 0;var i=En(),r=class{constructor(a,s,e){Pt(this,"api");Pt(this,"crypto");Pt(this,"transactions");this.api=a,this.crypto=s,this.transactions=e}async get(a){if(!a)throw new Error("No Silo URI specified");let s=await this.parseUri(a),e=await this.transactions.search("Silo-Name",s.getAccessKey());if(e.length==0)throw new Error(`No data could be found for the Silo URI: ${a}`);let o=await this.transactions.get(e[0]);if(!o)throw new Error(`No data could be found for the Silo URI: ${a}`);let c=o.get("data",{decode:!0,string:!1});return this.crypto.decrypt(c,s.getEncryptionKey())}async readTransactionData(a,s){if(!s)throw new Error("No Silo URI specified");let e=await this.parseUri(s),o=a.get("data",{decode:!0,string:!1});return this.crypto.decrypt(o,e.getEncryptionKey())}async parseUri(a){let s=a.match(/^([a-z0-9-_]+)\.([0-9]+)/i);if(!s)throw new Error("Invalid Silo name, must be a name in the format of [a-z0-9]+.[0-9]+, e.g. 'bubble.7'");let e=s[1],o=Math.pow(2,parseInt(s[2])),c=await this.hash(i.stringToBuffer(e),o),f=i.bufferTob64(c.slice(0,15)),l=await this.hash(c.slice(16,31),1);return new u(a,f,l)}async hash(a,s){let e=await this.crypto.hash(a);for(let o=0;o{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=jo(),r=En(),u=class{constructor(a){Pt(this,"api");this.api=a}async getTransactionOffset(a){let s=await this.api.get(`tx/${a}/offset`);if(s.status===200)return s.data;throw new Error(`Unable to get transaction offset: ${(0,i.getError)(s)}`)}async getChunk(a){let s=await this.api.get(`chunk/${a}`);if(s.status===200)return s.data;throw new Error(`Unable to get chunk: ${(0,i.getError)(s)}`)}async getChunkData(a){let s=await this.getChunk(a);return r.b64UrlToBuffer(s.chunk)}firstChunkOffset(a){return parseInt(a.offset)-parseInt(a.size)+1}async downloadChunkedData(a){let s=await this.getTransactionOffset(a),e=parseInt(s.size),o=parseInt(s.offset)-e+1,c=new Uint8Array(e),f=0;for(;f{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=jo();Di();var r=class{constructor(a,s){Pt(this,"api");Pt(this,"network");this.api=a,this.network=s}async get(a){let s=await this.api.get(`${r.ENDPOINT}${a}`);if(s.status===200)return s.data;throw s.status===404?new i.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${s}`)}async getCurrent(){let{current:a}=await this.network.getInfo();return await this.get(a)}},u=r;Wr(u,"ENDPOINT","block/hash/"),t.default=u}),fo=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=Jp(),r=Xp(),u=Yp(),a=Qp(),s=rg(),e=ng(),o=mu(),c=En(),f=ig(),l=ag(),p=og(),g=class{constructor(m){Pt(this,"api");Pt(this,"wallets");Pt(this,"transactions");Pt(this,"network");Pt(this,"blocks");Pt(this,"ar");Pt(this,"silo");Pt(this,"chunks");this.api=new r.default(m),this.wallets=new e.default(this.api,g.crypto),this.chunks=new l.default(this.api),this.transactions=new s.default(this.api,g.crypto,this.chunks),this.silo=new f.default(this.api,this.crypto,this.transactions),this.network=new a.default(this.api),this.blocks=new p.default(this.api,this.network),this.ar=new i.default}get crypto(){return g.crypto}get utils(){return g.utils}getConfig(){return{api:this.api.getConfig(),crypto:null}}async createTransaction(m,M){let E={};if(Object.assign(E,m),!m.data&&!(m.target&&m.quantity))throw new Error("A new Arweave transaction must have a 'data' value, or 'target' and 'quantity' values.");if(m.owner==null&&M&&M!=="use_wallet"&&(E.owner=M.n),m.last_tx==null&&(E.last_tx=await this.transactions.getTransactionAnchor()),typeof m.data=="string"&&(m.data=c.stringToBuffer(m.data)),m.data instanceof ArrayBuffer&&(m.data=new Uint8Array(m.data)),m.data&&!(m.data instanceof Uint8Array))throw new Error("Expected data to be a string, Uint8Array or ArrayBuffer");if(m.reward==null){let x=m.data?m.data.byteLength:0;E.reward=await this.transactions.getPrice(x,E.target)}E.data_root="",E.data_size=m.data?m.data.byteLength.toString():"0",E.data=m.data||new Uint8Array(0);let B=new o.default(E);return await B.getSignatureData(),B}async createSiloTransaction(m,M,E){let B={};if(Object.assign(B,m),!m.data)throw new Error("Silo transactions must have a 'data' value");if(!E)throw new Error("No Silo URI specified.");if(m.target||m.quantity)throw new Error("Silo transactions can only be used for storing data, sending AR to other wallets isn't supported.");if(m.owner==null){if(!M||!M.n)throw new Error("A new Arweave transaction must either have an 'owner' attribute, or you must provide the jwk parameter.");B.owner=M.n}m.last_tx==null&&(B.last_tx=await this.transactions.getTransactionAnchor());let x=await this.silo.parseUri(E);if(typeof m.data=="string"){let N=await this.crypto.encrypt(c.stringToBuffer(m.data),x.getEncryptionKey());B.reward=await this.transactions.getPrice(N.byteLength),B.data=c.bufferTob64Url(N)}if(m.data instanceof Uint8Array){let N=await this.crypto.encrypt(m.data,x.getEncryptionKey());B.reward=await this.transactions.getPrice(N.byteLength),B.data=c.bufferTob64Url(N)}let C=new o.default(B);return C.addTag("Silo-Name",x.getAccessKey()),C.addTag("Silo-Version","0.1.0"),C}arql(m){return this.api.post("/arql",m).then(M=>M.data||[])}},y=g;Wr(y,"init"),Wr(y,"crypto",new u.default),Wr(y,"utils",c),t.default=y}),sg=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.getDefaultConfig=void 0;var i=(a,s)=>{let e=/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/,o=s.split("."),c=o[o.length-1],f=["localhost","[::1]"];return f.includes(s)||a=="file"||f.includes(c)||!!s.match(e)||!!c.match(e)},r=a=>{let s=a.charAt(0)==="[",e=/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/;return!!a.match(e)||s},u=(a,s)=>{if(i(a,s))return{protocol:"https",host:"arweave.net",port:443};if(!r(s)){let e=s.split(".");if(e.length>=3){e.shift();let o=e.join(".");return{protocol:a,host:o}}}return{protocol:a,host:s}};t.getDefaultConfig=u}),yu=gt(t=>{lt();var i=t&&t.__createBinding||(Object.create?function(s,e,o,c){c===void 0&&(c=o);var f=Object.getOwnPropertyDescriptor(e,o);(!f||("get"in f?!e.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return e[o]}}),Object.defineProperty(s,c,f)}:function(s,e,o,c){c===void 0&&(c=o),s[c]=e[o]}),r=t&&t.__exportStar||function(s,e){for(var o in s)o!=="default"&&!Object.prototype.hasOwnProperty.call(e,o)&&i(e,s,o)};Object.defineProperty(t,"__esModule",{value:!0});var u=fo(),a=sg();u.default.init=function(s={}){let e={host:"arweave.net",port:443,protocol:"https"};if(typeof location!="object"||!location.protocol||!location.hostname)return new u.default({...s,...e});let o=location.protocol.replace(":",""),c=location.hostname,f=location.port?parseInt(location.port):o=="https"?443:80,l=(0,a.getDefaultConfig)(o,c),p=s.protocol||l.protocol,g=s.host||l.host,y=s.port||l.port||f;return new u.default({...s,host:g,protocol:p,port:y})},typeof globalThis=="object"?globalThis.Arweave=u.default:typeof self=="object"&&(self.Arweave=u.default),r(fo(),t),t.default=u.default}),_a=gt(t=>{lt();var i=t&&t.__createBinding||(Object.create?function(c,f,l,p){p===void 0&&(p=l);var g=Object.getOwnPropertyDescriptor(f,l);(!g||("get"in g?!f.__esModule:g.writable||g.configurable))&&(g={enumerable:!0,get:function(){return f[l]}}),Object.defineProperty(c,p,g)}:function(c,f,l,p){p===void 0&&(p=l),c[p]=f[l]}),r=t&&t.__setModuleDefault||(Object.create?function(c,f){Object.defineProperty(c,"default",{enumerable:!0,value:f})}:function(c,f){c.default=f}),u=t&&t.__importStar||function(c){if(c&&c.__esModule)return c;var f={};if(c!=null)for(var l in c)l!=="default"&&Object.prototype.hasOwnProperty.call(c,l)&&i(f,c,l);return r(f,c),f};Object.defineProperty(t,"__esModule",{value:!0}),t.Tag=t.Transaction=void 0;var a=u(En()),s=class{get(c,f){if(!Object.getOwnPropertyNames(this).includes(c))throw new Error(`Field "${c}" is not a property of the Arweave Transaction class.`);return this[c]instanceof Uint8Array?f&&f.decode&&f.string?a.bufferToString(this[c]):f&&f.decode&&!f.string?this[c]:a.bufferTob64Url(this[c]):f&&f.decode==!0?f&&f.string?a.b64UrlToString(this[c]):a.b64UrlToBuffer(this[c]):this[c]}},e=class extends s{constructor(c={}){super(),this.format=2,this.id="",this.last_tx="",this.owner="",this.tags=[],this.target="",this.quantity="0",this.data_size="0",this.data=new Uint8Array,this.data_root="",this.reward="0",this.signature="",Object.assign(this,c),typeof this.data=="string"&&(this.data=a.b64UrlToBuffer(this.data)),c.tags&&(this.tags=c.tags.map(f=>new o(f.name,f.value)))}addTag(c,f){this.tags.push(new o(a.stringToB64Url(c),a.stringToB64Url(f)))}toJSON(){return{format:this.format,id:this.id,last_tx:this.last_tx,owner:this.owner,tags:this.tags,target:this.target,quantity:this.quantity,data:a.bufferTob64Url(this.data),data_size:this.data_size,data_root:this.data_root,data_tree:this.data_tree,reward:this.reward,signature:this.signature}}setOwner(c){this.owner=c}setSignature({id:c,owner:f,reward:l,tags:p,signature:g}){this.id=c,this.owner=f,l&&(this.reward=l),p&&(this.tags=p),this.signature=g}async prepareChunks(c){throw new Error("Should not be called, use arweave-js version.")}getChunk(c,f){if(!this.chunks)throw new Error("Chunks have not been prepared");let l=this.chunks.proofs[c],p=this.chunks.chunks[c];return{data_root:this.data_root,data_size:this.data_size,data_path:a.bufferTob64Url(l.proof),offset:l.offset.toString(),chunk:a.bufferTob64Url(f.slice(p.minByteRange,p.maxByteRange))}}async getSignatureData(){throw new Error("Should not be called, use arweave-js version.")}};t.Transaction=e;var o=class extends s{constructor(c,f,l=!1){super(),this.name=c,this.value=f}};t.Tag=o}),ci=gt(t=>{lt();var i=t&&t.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(t,"__esModule",{value:!0}),t.ArweaveWrapper=void 0;var r=i(yu()),u=Jn(),a=or(),s=_a(),e=Er(),o=class{constructor(c){this.warp=c,this.logger=a.LoggerFactory.INST.create("ArweaveWrapper");let{arweave:f}=c;this.baseUrl=`${f.api.config.protocol}://${f.api.config.host}:${f.api.config.port}`,this.logger.debug("baseurl",this.baseUrl)}async warpGwInfo(){return await this.doFetchInfo(`${(0,e.stripTrailingSlash)(this.warp.gwUrl())}/gateway/arweave/info`)}async warpGwBlock(){return this.logger.debug("Calling warp gw block info"),await this.doFetchInfo(`${(0,e.stripTrailingSlash)(this.warp.gwUrl())}/gateway/arweave/block`)}async info(){return await this.doFetchInfo(`${this.baseUrl}/info`)}async gql(c,f){try{let l=JSON.stringify({query:c,variables:f});return{data:await(0,e.getJsonResponse)(fetch(`${this.baseUrl}/graphql`,{method:"POST",body:l,headers:{"Accept-Encoding":"gzip, deflate, br","Content-Type":"application/json",Accept:"application/json"}})),status:200}}catch(l){throw this.logger.error("Error while loading gql",l),l}}async tx(c){let f=await fetch(`${this.baseUrl}/tx/${c}`).then(l=>l.ok?l.json():Promise.reject(l)).catch(l=>{var p,g;throw!((p=l.body)===null||p===void 0)&&p.message&&this.logger.error(l.body.message),new e.NetworkCommunicationError(`Unable to retrieve tx ${c}. ${l.status}. ${(g=l.body)===null||g===void 0?void 0:g.message}`)});return new s.Transaction({...f})}async txData(c){let f=await fetch(`${this.baseUrl}/${c}`);if(f.ok){let l=await f.arrayBuffer();return u.Buffer.from(l)}else{this.logger.warn(`Unable to load data from arweave.net/${c} endpoint, falling back to arweave.js`);let l=await this.warp.arweave.transactions.getData(c,{decode:!0});return u.Buffer.from(l)}}async txDataString(c){let f=await this.txData(c);return r.default.utils.bufferToString(f)}async doFetchInfo(c){return await(0,e.getJsonResponse)(fetch(c))}};t.ArweaveWrapper=o}),di=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.TagsParser=void 0;var i=_n(),r=or(),u=class{constructor(){this.logger=r.LoggerFactory.INST.create("TagsParser")}getInputTag(a,s){if(u.hasMultipleInteractions(a)){this.logger.debug("Interaction transaction is using multiple input tx tag format.");let e=a.tags.findIndex(c=>c.name===i.SMART_WEAVE_TAGS.CONTRACT_TX_ID&&c.value===s);if(a.tags.length-1===e){this.logger.warn("Wrong tags format: 'Contract' is the last tag");return}let o=a.tags[e+1];if(o.name!==i.SMART_WEAVE_TAGS.INPUT){this.logger.warn(`No 'Input' tag found after 'Contract' tag. Instead ${o.name} was found`);return}return o}else return a.tags.find(e=>e.name===i.SMART_WEAVE_TAGS.INPUT)}isInteractWrite(a,s){return a.tags.some(e=>e.name===i.WARP_TAGS.INTERACT_WRITE&&e.value===s)}getInteractWritesContracts(a){return a.tags.filter(s=>s.name===i.WARP_TAGS.INTERACT_WRITE).map(s=>s.value)}getContractTag(a){var s;return(s=a.tags.find(e=>e.name===i.SMART_WEAVE_TAGS.CONTRACT_TX_ID))===null||s===void 0?void 0:s.value}getContractsWithInputs(a){let s=new Map;return a.tags.filter(e=>e.name===i.SMART_WEAVE_TAGS.CONTRACT_TX_ID).forEach(e=>{s.set(e.value,this.getInputTag(a,e.value))}),s}isEvmSigned(a){return a.tags.some(s=>s.name===i.WARP_TAGS.SIGNATURE_TYPE&&s.value==="ethereum")}static hasMultipleInteractions(a){return a.tags.filter(s=>s.name===i.SMART_WEAVE_TAGS.CONTRACT_TX_ID).length>1}decodeTags(a){let s=a.get("tags"),e=[];for(let o of s)try{let c=o.get("name",{decode:!0,string:!0}),f=o.get("value",{decode:!0,string:!0});e.push({name:c,value:f})}catch{}return e}getTag(a,s){let e=a.get("tags");for(let o of e)try{if(o.get("name",{decode:!0,string:!0})===s)return o.get("value",{decode:!0,string:!0})}catch{}return!1}hasVrfTag(a){return a.tags.some(s=>s.name==i.WARP_TAGS.REQUEST_VRF&&s.value==="true")}};t.TagsParser=u}),ug=gt((t,i)=>{lt(),function(r,u){typeof t=="object"&&typeof i<"u"?u(t):typeof define=="function"&&define.amd?define(["exports"],u):(r=typeof globalThis<"u"?globalThis:r||self,u(r.unzipit={}))}(t,function(r){function u(wt){return wt.arrayBuffer?wt.arrayBuffer():new Promise((ct,Et)=>{let ut=new FileReader;ut.addEventListener("loadend",()=>{ct(ut.result)}),ut.addEventListener("error",Et),ut.readAsArrayBuffer(wt)})}async function a(wt){let ct=await u(wt);return new Uint8Array(ct)}function s(wt){return typeof Blob<"u"&&wt instanceof Blob}function e(wt){return typeof SharedArrayBuffer<"u"&&wt instanceof SharedArrayBuffer}let o=typeof Jt.default<"u"&&Jt.default.versions&&typeof Jt.default.versions.node<"u"&&typeof Jt.default.versions.electron>"u";function c(wt){return wt.byteOffset===0&&wt.byteLength===wt.buffer.byteLength}class f{constructor(ct){this.typedArray=ct instanceof ArrayBuffer||e(ct)?new Uint8Array(ct):new Uint8Array(ct.buffer,ct.byteOffset,ct.byteLength)}async getLength(){return this.typedArray.byteLength}async read(ct,Et){return new Uint8Array(this.typedArray.buffer,this.typedArray.byteOffset+ct,Et)}}class l{constructor(ct){this.blob=ct}async getLength(){return this.blob.size}async read(ct,Et){let ut=this.blob.slice(ct,ct+Et),Ot=await u(ut);return new Uint8Array(Ot)}async sliceAsBlob(ct,Et,ut=""){return this.blob.slice(ct,ct+Et,ut)}}class p{constructor(ct){this.url=ct}async getLength(){if(this.length===void 0){let ct=await fetch(this.url,{method:"HEAD"});if(!ct.ok)throw new Error(`failed http request ${this.url}, status: ${ct.status}: ${ct.statusText}`);if(this.length=parseInt(ct.headers.get("content-length")),Number.isNaN(this.length))throw Error("could not get length")}return this.length}async read(ct,Et){if(Et===0)return new Uint8Array(0);let ut=await fetch(this.url,{headers:{Range:`bytes=${ct}-${ct+Et-1}`}});if(!ut.ok)throw new Error(`failed http request ${this.url}, status: ${ut.status} offset: ${ct} size: ${Et}: ${ut.statusText}`);let Ot=await ut.arrayBuffer();return new Uint8Array(Ot)}}function g(wt,ct){var Et=Uint8Array;if(wt[0]==3&&wt[1]==0)return ct||new Et(0);var ut=N,Ot=C,qt=m,nt=F,Rt=ct==null;Rt&&(ct=new Et(wt.length>>>2<<3));for(var Dt=0,bt=0,Tt=0,jt=0,St=0,kt=0,Kt=0,At=0,Nt=0,$t,Ft;Dt==0;){if(Dt=ut(wt,Nt,1),bt=ut(wt,Nt+1,2),Nt+=3,bt==0){Nt&7&&(Nt+=8-(Nt&7));var Wt=(Nt>>>3)+4,ae=wt[Wt-4]|wt[Wt-3]<<8;Rt&&(ct=y(ct,At+ae)),ct.set(new Et(wt.buffer,wt.byteOffset+Wt,ae),At),Nt=Wt+ae<<3,At+=ae;continue}if(Rt&&(ct=y(ct,At+(1<<17))),bt==1&&($t=I.flmap,Ft=I.fdmap,kt=511,Kt=31),bt==2){Tt=Ot(wt,Nt,5)+257,jt=Ot(wt,Nt+5,5)+1,St=Ot(wt,Nt+10,4)+4,Nt+=14;for(var Xt=0;Xt<38;Xt+=2)I.itree[Xt]=0,I.itree[Xt+1]=0;for(var Gt=1,Xt=0;XtGt&&(Gt=he)}Nt+=3*St,E(I.itree,Gt),B(I.itree,Gt,I.imap),$t=I.lmap,Ft=I.dmap,Nt=qt(I.imap,(1<>>4;if(!(te>>>8))ct[At++]=te;else{if(te==256)break;var re=At+te-254;if(te>264){var Se=I.ldef[te-257];re=At+(Se>>>3)+Ot(wt,Nt,Se&7),Nt+=Se&7}var Be=Ft[nt(wt,Nt)&Kt];Nt+=Be&15;var Re=Be>>>4,Te=I.ddef[Re],xe=(Te>>>4)+ut(wt,Nt,Te&15);for(Nt+=Te&15,Rt&&(ct=y(ct,At+(1<<17)));At>>4;if(Tt<=15)qt[Dt]=Tt,Dt++;else{var jt=0,St=0;Tt==16?(St=3+nt(ut,Ot,2),Ot+=2,jt=qt[Dt-1]):Tt==17?(St=3+nt(ut,Ot,3),Ot+=3):Tt==18&&(St=11+nt(ut,Ot,7),Ot+=7);for(var kt=Dt+St;Dt>>1;qtOt&&(Ot=Rt),qt++}for(;qt>1,Rt=wt[qt+1],Dt=nt<<4|Rt,bt=ct-Rt,Tt=wt[qt]<>>15-ct;Et[St]=Dt,Tt++}}function x(wt,ct){for(var Et=I.rev15,ut=15-ct,Ot=0;Ot>>ut}}function C(wt,ct,Et){return(wt[ct>>>3]|wt[(ct>>>3)+1]<<8)>>>(ct&7)&(1<>>3]|wt[(ct>>>3)+1]<<8|wt[(ct>>>3)+2]<<16)>>>(ct&7)&(1<>>3]|wt[(ct>>>3)+1]<<8|wt[(ct>>>3)+2]<<16)>>>(ct&7)}let I=function(){var wt=Uint16Array,ct=Uint32Array;return{next_code:new wt(16),bl_count:new wt(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new wt(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new ct(32),flmap:new wt(512),fltree:[],fdmap:new wt(32),fdtree:[],lmap:new wt(32768),ltree:[],ttree:[],dmap:new wt(32768),dtree:[],imap:new wt(512),itree:[],rev15:new wt(32768),lhst:new ct(286),dhst:new ct(30),ihst:new ct(19),lits:new ct(15e3),strt:new wt(65536),prev:new wt(32768)}}();(function(){for(var wt=32768,ct=0;ct>>1|(Et&1431655765)<<1,Et=(Et&3435973836)>>>2|(Et&858993459)<<2,Et=(Et&4042322160)>>>4|(Et&252645135)<<4,Et=(Et&4278255360)>>>8|(Et&16711935)<<8,I.rev15[ct]=(Et>>>16|Et<<16)>>>17}function ut(Ot,qt,nt){for(;qt--!=0;)Ot.push(0,nt)}for(var ct=0;ct<32;ct++)I.ldef[ct]=I.of0[ct]<<3|I.exb[ct],I.ddef[ct]=I.df0[ct]<<4|I.dxb[ct];ut(I.fltree,144,8),ut(I.fltree,112,9),ut(I.fltree,24,7),ut(I.fltree,8,8),E(I.fltree,9),B(I.fltree,9,I.flmap),x(I.fltree,9),ut(I.fdtree,32,5),E(I.fdtree,5),B(I.fdtree,5,I.fdmap),x(I.fdtree,5),ut(I.itree,19,0),ut(I.ltree,286,0),ut(I.dtree,30,0),ut(I.ttree,320,0)})();let U={table:function(){for(var wt=new Uint32Array(256),ct=0;ct<256;ct++){for(var Et=ct,ut=0;ut<8;ut++)Et&1?Et=3988292384^Et>>>1:Et=Et>>>1;wt[ct]=Et}return wt}(),update:function(wt,ct,Et,ut){for(var Ot=0;Ot>>8;return wt},crc:function(wt,ct,Et){return U.update(4294967295,wt,ct,Et)^4294967295}};function P(wt,ct){return g(wt,ct)}let D={numWorkers:1,workerURL:"",useWorkers:!1},W=0,q=0,O=!0,L=[],n=[],d=[],v=new Map;function A(wt){b(wt.target);let{id:ct,error:Et,data:ut}=wt.data,Ot=v.get(ct);v.delete(ct),Et?Ot.reject(Et):Ot.resolve(ut)}function T(wt){return new Promise((ct,Et)=>{let ut=new Worker(wt);ut.onmessage=Ot=>{Ot.data==="start"?(ut.onerror=void 0,ut.onmessage=void 0,ct(ut)):Et(new Error(`unexpected message: ${Ot.data}`))},ut.onerror=Et})}function S(wt,ct){return wt.require?wt.require(ct):{}}let w=function(){if(o){let{Worker:wt}=S(i,"worker_threads");return{async createWorker(ct){return new wt(ct)},addEventListener(ct,Et){ct.on("message",ut=>{Et({target:ct,data:ut})})},async terminate(ct){await ct.terminate()}}}else return{async createWorker(wt){try{return await T(wt)}catch{console.warn("could not load worker:",wt)}let ct;try{let Et=await fetch(wt,{mode:"cors"});if(!Et.ok)throw new Error(`could not load: ${wt}`);ct=await Et.text(),wt=URL.createObjectURL(new Blob([ct],{type:"application/javascript"}));let ut=await T(wt);return D.workerURL=wt,ut}catch{console.warn("could not load worker via fetch:",wt)}if(ct!==void 0)try{wt=`data:application/javascript;base64,${btoa(ct)}`;let Et=await T(wt);return D.workerURL=wt,Et}catch{console.warn("could not load worker via dataURI")}throw console.warn("workers will not be used"),new Error("can not start workers")},addEventListener(wt,ct){wt.addEventListener("message",ct)},async terminate(wt){wt.terminate()}}}();function b(wt){n.push(wt),tt()}async function h(){if(n.length===0&&q{d.push({src:wt,uncompressedSize:ct,type:Et,resolve:ut,reject:Ot,id:W++}),tt()})}function et(wt){wt.splice(0,wt.length)}async function at(){for(let wt of L)await w.terminate(wt);et(L),et(n),et(d),v.clear(),q=0,O=!0}function $(wt,ct){let Et=wt&31,ut=(wt>>5&15)-1,Ot=(wt>>9&127)+1980,qt=0,nt=(ct&31)*2,Rt=ct>>5&63,Dt=ct>>11&31;return new Date(Ot,ut,Et,Dt,Rt,nt,qt)}class J{constructor(ct,Et){this._reader=ct,this._rawEntry=Et,this.name=Et.name,this.nameBytes=Et.nameBytes,this.size=Et.uncompressedSize,this.compressedSize=Et.compressedSize,this.comment=Et.comment,this.commentBytes=Et.commentBytes,this.compressionMethod=Et.compressionMethod,this.lastModDate=$(Et.lastModFileDate,Et.lastModFileTime),this.isDirectory=Et.uncompressedSize===0&&Et.name.endsWith("/"),this.encrypted=!!(Et.generalPurposeBitFlag&1),this.externalFileAttributes=Et.externalFileAttributes,this.versionMadeBy=Et.versionMadeBy}async blob(ct="application/octet-stream"){return await yt(this._reader,this._rawEntry,ct)}async arrayBuffer(){return await st(this._reader,this._rawEntry)}async text(){let ct=await this.arrayBuffer();return mt(new Uint8Array(ct))}async json(){let ct=await this.text();return JSON.parse(ct)}}let R=22,j=65535,z=101010256,Z=101075792;async function Q(wt,ct,Et){return await wt.read(ct,Et)}async function K(wt,ct,Et,ut){return wt.sliceAsBlob?await wt.sliceAsBlob(ct,Et,ut):await wt.read(ct,Et)}let G={unsigned(){return 0}};function H(wt,ct){return wt[ct]+wt[ct+1]*256}function Y(wt,ct){return wt[ct]+wt[ct+1]*256+wt[ct+2]*65536+wt[ct+3]*16777216}function it(wt,ct){return Y(wt,ct)+Y(wt,ct+4)*4294967296}let ot=new TextDecoder;function mt(wt,ct){return e(wt.buffer)&&(wt=new Uint8Array(wt)),ot.decode(wt)}async function _t(wt,ct){let Et=Math.min(R+j,ct),ut=ct-Et,Ot=await Q(wt,ut,Et);for(let qt=Et-R;qt>=0;--qt){if(Y(Ot,qt)!==z)continue;let nt=new Uint8Array(Ot.buffer,Ot.byteOffset+qt,Ot.byteLength-qt),Rt=H(nt,4);if(Rt!==0)throw new Error(`multi-volume zip files are not supported. This is volume: ${Rt}`);let Dt=H(nt,10),bt=Y(nt,12),Tt=Y(nt,16),jt=H(nt,20),St=nt.length-R;if(jt!==St)throw new Error(`invalid comment length. expected: ${St}, actual: ${jt}`);let kt=new Uint8Array(nt.buffer,nt.byteOffset+22,jt),Kt=mt(kt);return Dt===65535||Tt===4294967295?await vt(wt,ut+qt,Kt,kt):await V(wt,Tt,bt,Dt,Kt,kt)}throw new Error("could not find end of central directory. maybe not zip file")}let ht=117853008;async function vt(wt,ct,Et,ut){let Ot=ct-20,qt=await Q(wt,Ot,20);if(Y(qt,0)!==ht)throw new Error("invalid zip64 end of central directory locator signature");let nt=it(qt,8),Rt=await Q(wt,nt,56);if(Y(Rt,0)!==Z)throw new Error("invalid zip64 end of central directory record signature");let Dt=it(Rt,32),bt=it(Rt,40),Tt=it(Rt,48);return V(wt,Tt,bt,Dt,Et,ut)}let pt=33639248;async function V(wt,ct,Et,ut,Ot,qt){let nt=0,Rt=await Q(wt,ct,Et),Dt=[];for(let bt=0;btAt.length)throw new Error("extra field length exceeds extra field buffer size");St.extraFields.push({id:Ft,data:At.slice(ae,Xt)}),Nt=Xt}if(St.commentBytes=kt.slice(Kt,Kt+St.fileCommentLength),St.comment=mt(St.commentBytes),nt+=kt.length,St.uncompressedSize===4294967295||St.compressedSize===4294967295||St.relativeOffsetOfLocalHeader===4294967295){let Ft=St.extraFields.find(Xt=>Xt.id===1);if(!Ft)throw new Error("expected zip64 extended information extra field");let Wt=Ft.data,ae=0;if(St.uncompressedSize===4294967295){if(ae+8>Wt.length)throw new Error("zip64 extended information extra field does not include uncompressed size");St.uncompressedSize=it(Wt,ae),ae+=8}if(St.compressedSize===4294967295){if(ae+8>Wt.length)throw new Error("zip64 extended information extra field does not include compressed size");St.compressedSize=it(Wt,ae),ae+=8}if(St.relativeOffsetOfLocalHeader===4294967295){if(ae+8>Wt.length)throw new Error("zip64 extended information extra field does not include relative header offset");St.relativeOffsetOfLocalHeader=it(Wt,ae),ae+=8}}let $t=St.extraFields.find(Ft=>Ft.id===28789&&Ft.data.length>=6&&Ft.data[0]===1&&Y(Ft.data,1),G.unsigned(St.nameBytes));if($t&&(St.fileName=mt($t.data.slice(5))),St.compressionMethod===0){let Ft=St.uncompressedSize;if(St.generalPurposeBitFlag&1&&(Ft+=12),St.compressedSize!==Ft)throw new Error(`compressed size mismatch for stored file: ${St.compressedSize} != ${Ft}`)}Dt.push(St)}return{zip:{comment:Ot,commentBytes:qt},entries:Dt.map(bt=>new J(wt,bt))}}async function rt(wt,ct){if(ct.generalPurposeBitFlag&1)throw new Error("encrypted entries not supported");let Et=await Q(wt,ct.relativeOffsetOfLocalHeader,30),ut=await wt.getLength(),Ot=Y(Et,0);if(Ot!==67324752)throw new Error(`invalid local file header signature: 0x${Ot.toString(16)}`);let qt=H(Et,26),nt=H(Et,28),Rt=ct.relativeOffsetOfLocalHeader+Et.length+qt+nt,Dt;if(ct.compressionMethod===0)Dt=!1;else if(ct.compressionMethod===8)Dt=!0;else throw new Error(`unsupported compression method: ${ct.compressionMethod}`);let bt=Rt,Tt=bt+ct.compressedSize;if(ct.compressedSize!==0&&Tt>ut)throw new Error(`file data overflows file bounds: ${bt} + ${ct.compressedSize} > ${ut}`);return{decompress:Dt,fileDataStart:bt}}async function st(wt,ct){let{decompress:Et,fileDataStart:ut}=await rt(wt,ct);if(!Et){let qt=await Q(wt,ut,ct.compressedSize);return c(qt)?qt.buffer:qt.slice().buffer}let Ot=await K(wt,ut,ct.compressedSize);return await ft(Ot,ct.uncompressedSize)}async function yt(wt,ct,Et){let{decompress:ut,fileDataStart:Ot}=await rt(wt,ct);if(!ut){let nt=await K(wt,Ot,ct.compressedSize,Et);return s(nt)?nt:new Blob([e(nt.buffer)?new Uint8Array(nt):nt],{type:Et})}let qt=await K(wt,Ot,ct.compressedSize);return await ft(qt,ct.uncompressedSize,Et)}function Ct(wt){X(wt)}async function dt(wt){let ct;if(typeof Blob<"u"&&wt instanceof Blob)ct=new l(wt);else if(wt instanceof ArrayBuffer||wt&&wt.buffer&&wt.buffer instanceof ArrayBuffer)ct=new f(wt);else if(e(wt)||e(wt.buffer))ct=new f(wt);else if(typeof wt=="string"){let ut=await fetch(wt);if(!ut.ok)throw new Error(`failed http request ${wt}, status: ${ut.status}: ${ut.statusText}`);let Ot=await ut.blob();ct=new l(Ot)}else if(typeof wt.getLength=="function"&&typeof wt.read=="function")ct=wt;else throw new Error("unsupported source type");let Et=await ct.getLength();if(Et>Number.MAX_SAFE_INTEGER)throw new Error(`file too large. size: ${Et}. Only file sizes up 4503599627370496 bytes are supported`);return await _t(ct,Et)}async function Mt(wt){let{zip:ct,entries:Et}=await dt(wt);return{zip:ct,entries:Object.fromEntries(Et.map(ut=>[ut.name,ut]))}}function Lt(){at()}r.HTTPRangeReader=p,r.cleanup=Lt,r.setOptions=Ct,r.unzip=Mt,r.unzipRaw=dt,Object.defineProperty(r,"__esModule",{value:!0})})}),Uo=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.WasmSrc=void 0;var i=ug(),r=Jn(),u=or(),a=class{constructor(s){this.src=s,this.logger=u.LoggerFactory.INST.create("WasmSrc"),this.splitted=this.splitBuffer(s),this.logger.debug(`Buffer splitted into ${this.splitted.length} parts`)}wasmBinary(){return this.splitted[0]}async sourceCode(){let{entries:s}=await(0,i.unzip)(this.splitted[1]),e=new Map;for(let[o,c]of Object.entries(s)){if(c.isDirectory)continue;let f=await c.text();e.set(o,f)}return e}additionalCode(){return this.splitted.length==2?null:this.splitted[2].toString()}splitBuffer(s){let e="",o=parseInt(s.toString("utf8",0,1));this.logger.debug(`Number of elements: ${o}`);let c=s.length,f=0,l=0;for(let y=2;yparseInt(y));this.logger.debug("Lengths",p);let g=[];for(let y of p){let m=r.Buffer.alloc(y),M=l+y;s.copy(m,0,l,M),l=M,g.push(m)}return g}};t.WasmSrc=a}),bu=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.ContractDefinitionLoader=void 0;var i=Do(),r=_n(),u=fn(),a=or(),s=ci(),e=di(),o=Uo(),c=class{constructor(f,l){this.arweave=f,this.env=l,this.logger=a.LoggerFactory.INST.create("ContractDefinitionLoader"),this.tagsParser=new e.TagsParser}async load(f,l){let p=u.Benchmark.measure(),g=await this.doLoad(f,l);return this.logger.info(`Contract definition loaded in: ${p.elapsed()}`),g}async doLoad(f,l){let p=u.Benchmark.measure(),g=await this.arweaveWrapper.tx(f),y=await this.arweave.wallets.ownerToAddress(g.owner);this.logger.debug("Contract tx and owner",p.elapsed()),p.reset();let m=l||this.tagsParser.getTag(g,r.SMART_WEAVE_TAGS.CONTRACT_SRC_TX_ID),M=this.tagsParser.getTag(g,r.WARP_TAGS.WARP_TESTNET)||null;if(M&&this.env!=="testnet")throw new Error('Trying to use testnet contract in a non-testnet env. Use the "forTestnet" factory method.');if(!M&&this.env==="testnet")throw new Error("Trying to use non-testnet contract in a testnet env.");let E=this.tagsParser.getTag(g,r.SMART_WEAVE_TAGS.MIN_FEE),B=null,x=this.tagsParser.getTag(g,r.WARP_TAGS.MANIFEST);x&&(B=JSON.parse(x)),this.logger.debug("Tags decoding",p.elapsed()),p.reset();let C=await this.evalInitialState(g);this.logger.debug("init state",C);let N=JSON.parse(C);this.logger.debug("Parsing src and init state",p.elapsed());let{src:F,srcBinary:I,srcWasmLang:U,contractType:P,metadata:D,srcTx:W}=await this.loadContractSource(m);return{txId:f,srcTxId:m,src:F,srcBinary:I,srcWasmLang:U,initState:N,minFee:E,owner:y,contractType:P,metadata:D,manifest:B,contractTx:g.toJSON(),srcTx:W,testnet:M}}async loadContractSource(f){let l=u.Benchmark.measure(),p=await this.arweaveWrapper.tx(f),g=this.tagsParser.getTag(p,r.SMART_WEAVE_TAGS.CONTENT_TYPE);if(!i.SUPPORTED_SRC_CONTENT_TYPES.includes(g))throw new Error(`Contract source content type ${g} not supported`);let y=g=="application/javascript"?"js":"wasm",m=y=="js"?await this.arweaveWrapper.txDataString(f):await this.arweaveWrapper.txData(f),M,E,B;if(y=="wasm"){if(E=new o.WasmSrc(m),M=this.tagsParser.getTag(p,r.WARP_TAGS.WASM_LANG),!M)throw new Error(`Wasm lang not set for wasm contract src ${f}`);B=JSON.parse(this.tagsParser.getTag(p,r.WARP_TAGS.WASM_META))}return this.logger.debug("Contract src tx load",l.elapsed()),l.reset(),{src:y=="js"?m:null,srcBinary:y=="wasm"?E.wasmBinary():null,srcWasmLang:M,contractType:y,metadata:B,srcTx:p.toJSON()}}async evalInitialState(f){if(this.tagsParser.getTag(f,r.WARP_TAGS.INIT_STATE))return this.tagsParser.getTag(f,r.WARP_TAGS.INIT_STATE);if(this.tagsParser.getTag(f,r.WARP_TAGS.INIT_STATE_TX)){let l=this.tagsParser.getTag(f,r.WARP_TAGS.INIT_STATE_TX);return this.arweaveWrapper.txDataString(l)}else return this.arweaveWrapper.txDataString(f.id)}type(){return"arweave"}setCache(f){throw new Error("No cache implemented for this loader")}setSrcCache(f){throw new Error("No cache implemented for this loader")}getCache(){throw new Error("No cache implemented for this loader")}getSrcCache(){throw new Error("No cache implemented for this loader")}set warp(f){this.arweaveWrapper=new s.ArweaveWrapper(f)}};t.ContractDefinitionLoader=c}),Gf=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.WarpGatewayContractDefinitionLoader=void 0;var i=bu(),r=Jn(),u=Do(),a=_n(),s=fn(),e=or(),o=ci(),c=Uo(),f=di(),l=Xn(),p=_a(),g=Er(),y=class{constructor(m,M,E,B){this.definitionCache=M,this.srcCache=E,this.env=B,this.rLogger=e.LoggerFactory.INST.create("WarpGatewayContractDefinitionLoader"),this.contractDefinitionLoader=new i.ContractDefinitionLoader(m,B),this.tagsParser=new f.TagsParser}async load(m,M){let E=await this.getFromCache(m,M);if(E)return this.rLogger.debug("WarpGatewayContractDefinitionLoader: Hit from cache!"),E.contractType=="wasm"&&E.srcBinary.data&&(E.srcBinary=r.Buffer.from(E.srcBinary.data)),this.verifyEnv(E),E;let B=s.Benchmark.measure(),x=await this.doLoad(m,M);return this.rLogger.info(`Contract definition loaded in: ${B.elapsed()}`),this.verifyEnv(x),await this.putToCache(m,x,M),x}async doLoad(m,M){try{let E=(0,g.stripTrailingSlash)(this._warp.gwUrl()),B=await(0,g.getJsonResponse)(fetch(`${E}/gateway/contract?txId=${m}${M?`&srcTxId=${M}`:""}`));if(B.srcBinary!=null&&!(B.srcBinary instanceof r.Buffer)&&(B.srcBinary=r.Buffer.from(B.srcBinary.data)),B.srcBinary){let x=new c.WasmSrc(B.srcBinary);B.srcBinary=x.wasmBinary();let C;B.srcTx?C=new p.Transaction({...B.srcTx}):C=await this.arweaveWrapper.tx(B.srcTxId);let N=JSON.parse(this.tagsParser.getTag(C,a.WARP_TAGS.WASM_META));B.metadata=N}return B.contractType=B.src?"js":"wasm",B}catch(E){return this.rLogger.warn("Falling back to default contracts loader",E),await this.contractDefinitionLoader.doLoad(m,M)}}async loadContractSource(m){return await this.contractDefinitionLoader.loadContractSource(m)}type(){return"warp"}setCache(m){this.definitionCache=m}setSrcCache(m){this.srcCache=m}getCache(){return this.definitionCache}getSrcCache(){return this.srcCache}verifyEnv(m){if(m.testnet&&this.env!=="testnet")throw new Error('Trying to use testnet contract in a non-testnet env. Use the "forTestnet" factory method.');if(!m.testnet&&this.env==="testnet")throw new Error("Trying to use non-testnet contract in a testnet env.")}async getFromCache(m,M){let E=await this.definitionCache.get(new l.CacheKey(m,"cd"));if(!E)return null;let B=await this.srcCache.get(new l.CacheKey(M||E.cachedValue.srcTxId,"src"));return B?{...E.cachedValue,...B.cachedValue}:null}async putToCache(m,M,E){let B=new u.SrcCache(M),x=new u.ContractCache(M);await this.definitionCache.put({key:m,sortKey:"cd"},x),await this.srcCache.put({key:E||x.srcTxId,sortKey:"src"},B)}set warp(m){this._warp=m,this.arweaveWrapper=new o.ArweaveWrapper(m),this.contractDefinitionLoader.warp=m}};t.WarpGatewayContractDefinitionLoader=y}),vu=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.ArweaveGQLTxsFetcher=void 0;var i=or(),r=ci(),u=Er(),a=fn(),s=_n(),e=`query Transactions($tags: [TagFilter!]!, $blockFilter: BlockFilter!, $first: Int!, $after: String) { transactions(tags: $tags, block: $blockFilter, first: $first, sort: HEIGHT_ASC, after: $after) { pageInfo { @@ -189,8 +189,8 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof y))re Use Chrome, Firefox or Internet Explorer 11`)}var s=Ee().Buffer,e=le.crypto||le.msCrypto;e&&e.getRandomValues?i.exports=o:i.exports=a;function o(c,f){if(c>u)throw new RangeError("requested too many random bytes");var l=s.allocUnsafe(c);if(c>0)if(c>r)for(var p=0;p{lt();var r=Ee().Buffer,u=kr().Transform,a=pe();function s(o,c){if(!r.isBuffer(o)&&typeof o!="string")throw new TypeError(c+" must be a string or a buffer")}function e(o){u.call(this),this._block=r.allocUnsafe(o),this._blockSize=o,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}a(e,u),e.prototype._transform=function(o,c,f){var l=null;try{this.update(o,c)}catch(p){l=p}f(l)},e.prototype._flush=function(o){var c=null;try{this.push(this.digest())}catch(f){c=f}o(c)},e.prototype.update=function(o,c){if(s(o,"Data"),this._finalized)throw new Error("Digest already called");r.isBuffer(o)||(o=r.from(o,c));for(var f=this._block,l=0;this._blockOffset+o.length-l>=this._blockSize;){for(var p=this._blockOffset;p0;++g)this._length[g]+=y,y=this._length[g]/4294967296|0,y>0&&(this._length[g]-=4294967296*y);return this},e.prototype._update=function(){throw new Error("_update is not implemented")},e.prototype.digest=function(o){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var c=this._digest();o!==void 0&&(c=c.toString(o)),this._block.fill(0),this._blockOffset=0;for(var f=0;f<4;++f)this._length[f]=0;return c},e.prototype._digest=function(){throw new Error("_digest is not implemented")},i.exports=e}),Hu=gt((t,i)=>{lt();var r=pe(),u=m0(),a=Ee().Buffer,s=new Array(16);function e(){u.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}r(e,u),e.prototype._update=function(){for(var g=s,y=0;y<16;++y)g[y]=this._block.readInt32LE(y*4);var m=this._a,M=this._b,E=this._c,B=this._d;m=c(m,M,E,B,g[0],3614090360,7),B=c(B,m,M,E,g[1],3905402710,12),E=c(E,B,m,M,g[2],606105819,17),M=c(M,E,B,m,g[3],3250441966,22),m=c(m,M,E,B,g[4],4118548399,7),B=c(B,m,M,E,g[5],1200080426,12),E=c(E,B,m,M,g[6],2821735955,17),M=c(M,E,B,m,g[7],4249261313,22),m=c(m,M,E,B,g[8],1770035416,7),B=c(B,m,M,E,g[9],2336552879,12),E=c(E,B,m,M,g[10],4294925233,17),M=c(M,E,B,m,g[11],2304563134,22),m=c(m,M,E,B,g[12],1804603682,7),B=c(B,m,M,E,g[13],4254626195,12),E=c(E,B,m,M,g[14],2792965006,17),M=c(M,E,B,m,g[15],1236535329,22),m=f(m,M,E,B,g[1],4129170786,5),B=f(B,m,M,E,g[6],3225465664,9),E=f(E,B,m,M,g[11],643717713,14),M=f(M,E,B,m,g[0],3921069994,20),m=f(m,M,E,B,g[5],3593408605,5),B=f(B,m,M,E,g[10],38016083,9),E=f(E,B,m,M,g[15],3634488961,14),M=f(M,E,B,m,g[4],3889429448,20),m=f(m,M,E,B,g[9],568446438,5),B=f(B,m,M,E,g[14],3275163606,9),E=f(E,B,m,M,g[3],4107603335,14),M=f(M,E,B,m,g[8],1163531501,20),m=f(m,M,E,B,g[13],2850285829,5),B=f(B,m,M,E,g[2],4243563512,9),E=f(E,B,m,M,g[7],1735328473,14),M=f(M,E,B,m,g[12],2368359562,20),m=l(m,M,E,B,g[5],4294588738,4),B=l(B,m,M,E,g[8],2272392833,11),E=l(E,B,m,M,g[11],1839030562,16),M=l(M,E,B,m,g[14],4259657740,23),m=l(m,M,E,B,g[1],2763975236,4),B=l(B,m,M,E,g[4],1272893353,11),E=l(E,B,m,M,g[7],4139469664,16),M=l(M,E,B,m,g[10],3200236656,23),m=l(m,M,E,B,g[13],681279174,4),B=l(B,m,M,E,g[0],3936430074,11),E=l(E,B,m,M,g[3],3572445317,16),M=l(M,E,B,m,g[6],76029189,23),m=l(m,M,E,B,g[9],3654602809,4),B=l(B,m,M,E,g[12],3873151461,11),E=l(E,B,m,M,g[15],530742520,16),M=l(M,E,B,m,g[2],3299628645,23),m=p(m,M,E,B,g[0],4096336452,6),B=p(B,m,M,E,g[7],1126891415,10),E=p(E,B,m,M,g[14],2878612391,15),M=p(M,E,B,m,g[5],4237533241,21),m=p(m,M,E,B,g[12],1700485571,6),B=p(B,m,M,E,g[3],2399980690,10),E=p(E,B,m,M,g[10],4293915773,15),M=p(M,E,B,m,g[1],2240044497,21),m=p(m,M,E,B,g[8],1873313359,6),B=p(B,m,M,E,g[15],4264355552,10),E=p(E,B,m,M,g[6],2734768916,15),M=p(M,E,B,m,g[13],1309151649,21),m=p(m,M,E,B,g[4],4149444226,6),B=p(B,m,M,E,g[11],3174756917,10),E=p(E,B,m,M,g[2],718787259,15),M=p(M,E,B,m,g[9],3951481745,21),this._a=this._a+m|0,this._b=this._b+M|0,this._c=this._c+E|0,this._d=this._d+B|0},e.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 g=a.allocUnsafe(16);return g.writeInt32LE(this._a,0),g.writeInt32LE(this._b,4),g.writeInt32LE(this._c,8),g.writeInt32LE(this._d,12),g};function o(g,y){return g<>>32-y}function c(g,y,m,M,E,B,x){return o(g+(y&m|~y&M)+E+B|0,x)+y|0}function f(g,y,m,M,E,B,x){return o(g+(y&M|m&~M)+E+B|0,x)+y|0}function l(g,y,m,M,E,B,x){return o(g+(y^m^M)+E+B|0,x)+y|0}function p(g,y,m,M,E,B,x){return o(g+(m^(y|~M))+E+B|0,x)+y|0}i.exports=e}),Gu=gt((t,i)=>{lt();var r=$e().Buffer,u=pe(),a=m0(),s=new Array(16),e=[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],o=[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],c=[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],f=[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],l=[0,1518500249,1859775393,2400959708,2840853838],p=[1352829926,1548603684,1836072691,2053994217,0];function g(){a.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}u(g,a),g.prototype._update=function(){for(var C=s,N=0;N<16;++N)C[N]=this._block.readInt32LE(N*4);for(var F=this._a|0,I=this._b|0,U=this._c|0,P=this._d|0,D=this._e|0,W=this._a|0,q=this._b|0,O=this._c|0,L=this._d|0,n=this._e|0,d=0;d<80;d+=1){var v,A;d<16?(v=m(F,I,U,P,D,C[e[d]],l[0],c[d]),A=x(W,q,O,L,n,C[o[d]],p[0],f[d])):d<32?(v=M(F,I,U,P,D,C[e[d]],l[1],c[d]),A=B(W,q,O,L,n,C[o[d]],p[1],f[d])):d<48?(v=E(F,I,U,P,D,C[e[d]],l[2],c[d]),A=E(W,q,O,L,n,C[o[d]],p[2],f[d])):d<64?(v=B(F,I,U,P,D,C[e[d]],l[3],c[d]),A=M(W,q,O,L,n,C[o[d]],p[3],f[d])):(v=x(F,I,U,P,D,C[e[d]],l[4],c[d]),A=m(W,q,O,L,n,C[o[d]],p[4],f[d])),F=D,D=P,P=y(U,10),U=I,I=v,W=n,n=L,L=y(O,10),O=q,q=A}var T=this._b+U+L|0;this._b=this._c+P+n|0,this._c=this._d+D+W|0,this._d=this._e+F+q|0,this._e=this._a+I+O|0,this._a=T},g.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 C=r.alloc?r.alloc(20):new r(20);return C.writeInt32LE(this._a,0),C.writeInt32LE(this._b,4),C.writeInt32LE(this._c,8),C.writeInt32LE(this._d,12),C.writeInt32LE(this._e,16),C};function y(C,N){return C<>>32-N}function m(C,N,F,I,U,P,D,W){return y(C+(N^F^I)+P+D|0,W)+U|0}function M(C,N,F,I,U,P,D,W){return y(C+(N&F|~N&I)+P+D|0,W)+U|0}function E(C,N,F,I,U,P,D,W){return y(C+((N|~F)^I)+P+D|0,W)+U|0}function B(C,N,F,I,U,P,D,W){return y(C+(N&I|F&~I)+P+D|0,W)+U|0}function x(C,N,F,I,U,P,D,W){return y(C+(N^(F|~I))+P+D|0,W)+U|0}i.exports=g}),Ki=gt((t,i)=>{lt();var r=Ee().Buffer;function u(a,s){this._block=r.alloc(a),this._finalSize=s,this._blockSize=a,this._len=0}u.prototype.update=function(a,s){typeof a=="string"&&(s=s||"utf8",a=r.from(a,s));for(var e=this._block,o=this._blockSize,c=a.length,f=this._len,l=0;l=this._finalSize&&(this._update(this._block),this._block.fill(0));var e=this._len*8;if(e<=4294967295)this._block.writeUInt32BE(e,this._blockSize-4);else{var o=(e&4294967295)>>>0,c=(e-o)/4294967296;this._block.writeUInt32BE(c,this._blockSize-8),this._block.writeUInt32BE(o,this._blockSize-4)}this._update(this._block);var f=this._hash();return a?f.toString(a):f},u.prototype._update=function(){throw new Error("_update must be implemented by subclass")},i.exports=u}),hm=gt((t,i)=>{lt();var r=pe(),u=Ki(),a=Ee().Buffer,s=[1518500249,1859775393,-1894007588,-899497514],e=new Array(80);function o(){this.init(),this._w=e,u.call(this,64,56)}r(o,u),o.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function c(p){return p<<5|p>>>27}function f(p){return p<<30|p>>>2}function l(p,g,y,m){return p===0?g&y|~g&m:p===2?g&y|g&m|y&m:g^y^m}o.prototype._update=function(p){for(var g=this._w,y=this._a|0,m=this._b|0,M=this._c|0,E=this._d|0,B=this._e|0,x=0;x<16;++x)g[x]=p.readInt32BE(x*4);for(;x<80;++x)g[x]=g[x-3]^g[x-8]^g[x-14]^g[x-16];for(var C=0;C<80;++C){var N=~~(C/20),F=c(y)+l(N,m,M,E)+B+g[C]+s[N]|0;B=E,E=M,M=f(m),m=y,y=F}this._a=y+this._a|0,this._b=m+this._b|0,this._c=M+this._c|0,this._d=E+this._d|0,this._e=B+this._e|0},o.prototype._hash=function(){var p=a.allocUnsafe(20);return p.writeInt32BE(this._a|0,0),p.writeInt32BE(this._b|0,4),p.writeInt32BE(this._c|0,8),p.writeInt32BE(this._d|0,12),p.writeInt32BE(this._e|0,16),p},i.exports=o}),lm=gt((t,i)=>{lt();var r=pe(),u=Ki(),a=Ee().Buffer,s=[1518500249,1859775393,-1894007588,-899497514],e=new Array(80);function o(){this.init(),this._w=e,u.call(this,64,56)}r(o,u),o.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function c(g){return g<<1|g>>>31}function f(g){return g<<5|g>>>27}function l(g){return g<<30|g>>>2}function p(g,y,m,M){return g===0?y&m|~y&M:g===2?y&m|y&M|m&M:y^m^M}o.prototype._update=function(g){for(var y=this._w,m=this._a|0,M=this._b|0,E=this._c|0,B=this._d|0,x=this._e|0,C=0;C<16;++C)y[C]=g.readInt32BE(C*4);for(;C<80;++C)y[C]=c(y[C-3]^y[C-8]^y[C-14]^y[C-16]);for(var N=0;N<80;++N){var F=~~(N/20),I=f(m)+p(F,M,E,B)+x+y[N]+s[F]|0;x=B,B=E,E=l(M),M=m,m=I}this._a=m+this._a|0,this._b=M+this._b|0,this._c=E+this._c|0,this._d=B+this._d|0,this._e=x+this._e|0},o.prototype._hash=function(){var g=a.allocUnsafe(20);return g.writeInt32BE(this._a|0,0),g.writeInt32BE(this._b|0,4),g.writeInt32BE(this._c|0,8),g.writeInt32BE(this._d|0,12),g.writeInt32BE(this._e|0,16),g},i.exports=o}),y0=gt((t,i)=>{lt();var r=pe(),u=Ki(),a=Ee().Buffer,s=[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],e=new Array(64);function o(){this.init(),this._w=e,u.call(this,64,56)}r(o,u),o.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 c(m,M,E){return E^m&(M^E)}function f(m,M,E){return m&M|E&(m|M)}function l(m){return(m>>>2|m<<30)^(m>>>13|m<<19)^(m>>>22|m<<10)}function p(m){return(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7)}function g(m){return(m>>>7|m<<25)^(m>>>18|m<<14)^m>>>3}function y(m){return(m>>>17|m<<15)^(m>>>19|m<<13)^m>>>10}o.prototype._update=function(m){for(var M=this._w,E=this._a|0,B=this._b|0,x=this._c|0,C=this._d|0,N=this._e|0,F=this._f|0,I=this._g|0,U=this._h|0,P=0;P<16;++P)M[P]=m.readInt32BE(P*4);for(;P<64;++P)M[P]=y(M[P-2])+M[P-7]+g(M[P-15])+M[P-16]|0;for(var D=0;D<64;++D){var W=U+p(N)+c(N,F,I)+s[D]+M[D]|0,q=l(E)+f(E,B,x)|0;U=I,I=F,F=N,N=C+W|0,C=x,x=B,B=E,E=W+q|0}this._a=E+this._a|0,this._b=B+this._b|0,this._c=x+this._c|0,this._d=C+this._d|0,this._e=N+this._e|0,this._f=F+this._f|0,this._g=I+this._g|0,this._h=U+this._h|0},o.prototype._hash=function(){var m=a.allocUnsafe(32);return m.writeInt32BE(this._a,0),m.writeInt32BE(this._b,4),m.writeInt32BE(this._c,8),m.writeInt32BE(this._d,12),m.writeInt32BE(this._e,16),m.writeInt32BE(this._f,20),m.writeInt32BE(this._g,24),m.writeInt32BE(this._h,28),m},i.exports=o}),fm=gt((t,i)=>{lt();var r=pe(),u=y0(),a=Ki(),s=Ee().Buffer,e=new Array(64);function o(){this.init(),this._w=e,a.call(this,64,56)}r(o,u),o.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},o.prototype._hash=function(){var c=s.allocUnsafe(28);return c.writeInt32BE(this._a,0),c.writeInt32BE(this._b,4),c.writeInt32BE(this._c,8),c.writeInt32BE(this._d,12),c.writeInt32BE(this._e,16),c.writeInt32BE(this._f,20),c.writeInt32BE(this._g,24),c},i.exports=o}),b0=gt((t,i)=>{lt();var r=pe(),u=Ki(),a=Ee().Buffer,s=[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],e=new Array(160);function o(){this.init(),this._w=e,u.call(this,128,112)}r(o,u),o.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 c(B,x,C){return C^B&(x^C)}function f(B,x,C){return B&x|C&(B|x)}function l(B,x){return(B>>>28|x<<4)^(x>>>2|B<<30)^(x>>>7|B<<25)}function p(B,x){return(B>>>14|x<<18)^(B>>>18|x<<14)^(x>>>9|B<<23)}function g(B,x){return(B>>>1|x<<31)^(B>>>8|x<<24)^B>>>7}function y(B,x){return(B>>>1|x<<31)^(B>>>8|x<<24)^(B>>>7|x<<25)}function m(B,x){return(B>>>19|x<<13)^(x>>>29|B<<3)^B>>>6}function M(B,x){return(B>>>19|x<<13)^(x>>>29|B<<3)^(B>>>6|x<<26)}function E(B,x){return B>>>0>>0?1:0}o.prototype._update=function(B){for(var x=this._w,C=this._ah|0,N=this._bh|0,F=this._ch|0,I=this._dh|0,U=this._eh|0,P=this._fh|0,D=this._gh|0,W=this._hh|0,q=this._al|0,O=this._bl|0,L=this._cl|0,n=this._dl|0,d=this._el|0,v=this._fl|0,A=this._gl|0,T=this._hl|0,S=0;S<32;S+=2)x[S]=B.readInt32BE(S*4),x[S+1]=B.readInt32BE(S*4+4);for(;S<160;S+=2){var w=x[S-30],b=x[S-15*2+1],h=g(w,b),k=y(b,w);w=x[S-2*2],b=x[S-2*2+1];var tt=m(w,b),X=M(b,w),ft=x[S-7*2],et=x[S-7*2+1],at=x[S-16*2],$=x[S-16*2+1],J=k+et|0,R=h+ft+E(J,k)|0;J=J+X|0,R=R+tt+E(J,X)|0,J=J+$|0,R=R+at+E(J,$)|0,x[S]=R,x[S+1]=J}for(var j=0;j<160;j+=2){R=x[j],J=x[j+1];var z=f(C,N,F),Z=f(q,O,L),Q=l(C,q),K=l(q,C),G=p(U,d),H=p(d,U),Y=s[j],it=s[j+1],ot=c(U,P,D),mt=c(d,v,A),_t=T+H|0,ht=W+G+E(_t,T)|0;_t=_t+mt|0,ht=ht+ot+E(_t,mt)|0,_t=_t+it|0,ht=ht+Y+E(_t,it)|0,_t=_t+J|0,ht=ht+R+E(_t,J)|0;var vt=K+Z|0,pt=Q+z+E(vt,K)|0;W=D,T=A,D=P,A=v,P=U,v=d,d=n+_t|0,U=I+ht+E(d,n)|0,I=F,n=L,F=N,L=O,N=C,O=q,q=_t+vt|0,C=ht+pt+E(q,_t)|0}this._al=this._al+q|0,this._bl=this._bl+O|0,this._cl=this._cl+L|0,this._dl=this._dl+n|0,this._el=this._el+d|0,this._fl=this._fl+v|0,this._gl=this._gl+A|0,this._hl=this._hl+T|0,this._ah=this._ah+C+E(this._al,q)|0,this._bh=this._bh+N+E(this._bl,O)|0,this._ch=this._ch+F+E(this._cl,L)|0,this._dh=this._dh+I+E(this._dl,n)|0,this._eh=this._eh+U+E(this._el,d)|0,this._fh=this._fh+P+E(this._fl,v)|0,this._gh=this._gh+D+E(this._gl,A)|0,this._hh=this._hh+W+E(this._hl,T)|0},o.prototype._hash=function(){var B=a.allocUnsafe(64);function x(C,N,F){B.writeInt32BE(C,F),B.writeInt32BE(N,F+4)}return x(this._ah,this._al,0),x(this._bh,this._bl,8),x(this._ch,this._cl,16),x(this._dh,this._dl,24),x(this._eh,this._el,32),x(this._fh,this._fl,40),x(this._gh,this._gl,48),x(this._hh,this._hl,56),B},i.exports=o}),cm=gt((t,i)=>{lt();var r=pe(),u=b0(),a=Ki(),s=Ee().Buffer,e=new Array(160);function o(){this.init(),this._w=e,a.call(this,128,112)}r(o,u),o.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},o.prototype._hash=function(){var c=s.allocUnsafe(48);function f(l,p,g){c.writeInt32BE(l,g),c.writeInt32BE(p,g+4)}return f(this._ah,this._al,0),f(this._bh,this._bl,8),f(this._ch,this._cl,16),f(this._dh,this._dl,24),f(this._eh,this._el,32),f(this._fh,this._fl,40),c},i.exports=o}),Vu=gt((r,i)=>{lt();var r=i.exports=function(u){u=u.toLowerCase();var a=r[u];if(!a)throw new Error(u+" is not supported (we accept pull requests)");return new a};r.sha=hm(),r.sha1=lm(),r.sha224=fm(),r.sha256=y0(),r.sha384=cm(),r.sha512=b0()}),Qn=gt((t,i)=>{lt();var r=Ee().Buffer,u=Cn().Transform,a=co().StringDecoder,s=pe();function e(o){u.call(this),this.hashMode=typeof o=="string",this.hashMode?this[o]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}s(e,u),e.prototype.update=function(o,c,f){typeof o=="string"&&(o=r.from(o,c));var l=this._update(o);return this.hashMode?this:(f&&(l=this._toString(l,f)),l)},e.prototype.setAutoPadding=function(){},e.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},e.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},e.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},e.prototype._transform=function(o,c,f){var l;try{this.hashMode?this._update(o):this.push(this._update(o))}catch(p){l=p}finally{f(l)}},e.prototype._flush=function(o){var c;try{this.push(this.__final())}catch(f){c=f}o(c)},e.prototype._finalOrDigest=function(o){var c=this.__final()||r.alloc(0);return o&&(c=this._toString(c,o,!0)),c},e.prototype._toString=function(o,c,f){if(this._decoder||(this._decoder=new a(c),this._encoding=c),this._encoding!==c)throw new Error("can't switch encodings");var l=this._decoder.write(o);return f&&(l+=this._decoder.end()),l},i.exports=e}),Ea=gt((t,i)=>{lt();var r=pe(),u=Hu(),a=Gu(),s=Vu(),e=Qn();function o(c){e.call(this,"digest"),this._hash=c}r(o,e),o.prototype._update=function(c){this._hash.update(c)},o.prototype._final=function(){return this._hash.digest()},i.exports=function(c){return c=c.toLowerCase(),c==="md5"?new u:c==="rmd160"||c==="ripemd160"?new a:new o(s(c))}}),dm=gt((t,i)=>{lt();var r=pe(),u=Ee().Buffer,a=Qn(),s=u.alloc(128),e=64;function o(c,f){a.call(this,"digest"),typeof f=="string"&&(f=u.from(f)),this._alg=c,this._key=f,f.length>e?f=c(f):f.length{lt();var r=Hu();i.exports=function(u){return new r().update(u).digest()}}),w0=gt((t,i)=>{lt();var r=pe(),u=dm(),a=Qn(),s=Ee().Buffer,e=v0(),o=Gu(),c=Vu(),f=s.alloc(128);function l(p,g){a.call(this,"digest"),typeof g=="string"&&(g=s.from(g));var y=p==="sha512"||p==="sha384"?128:64;if(this._alg=p,this._key=g,g.length>y){var m=p==="rmd160"?new o:c(p);g=m.update(g).digest()}else g.length{i.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"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:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"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:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}}),pm=gt((t,i)=>{lt(),i.exports=_0()}),E0=gt((t,i)=>{lt();var r=Math.pow(2,30)-1;i.exports=function(u,a){if(typeof u!="number")throw new TypeError("Iterations not a number");if(u<0)throw new TypeError("Bad iterations");if(typeof a!="number")throw new TypeError("Key length not a number");if(a<0||a>r||a!==a)throw new TypeError("Bad key length")}}),S0=gt((t,i)=>{lt();var r;le.process&&le.process.browser?r="utf-8":le.process&&le.process.version?(u=parseInt(Jt.default.version.split(".")[0].slice(1),10),r=u>=6?"utf-8":"binary"):r="utf-8";var u;i.exports=r}),A0=gt((t,i)=>{lt();var r=Ee().Buffer;i.exports=function(u,a,s){if(r.isBuffer(u))return u;if(typeof u=="string")return r.from(u,a);if(ArrayBuffer.isView(u))return r.from(u.buffer);throw new TypeError(s+" must be a string, a Buffer, a typed array or a DataView")}}),T0=gt((t,i)=>{lt();var r=v0(),u=Gu(),a=Vu(),s=Ee().Buffer,e=E0(),o=S0(),c=A0(),f=s.alloc(128),l={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function p(m,M,E){var B=g(m),x=m==="sha512"||m==="sha384"?128:64;M.length>x?M=B(M):M.length{lt();var r=Ee().Buffer,u=E0(),a=S0(),s=T0(),e=A0(),o,c=le.crypto&&le.crypto.subtle,f={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"},l=[];function p(E){if(le.process&&!le.process.browser||!c||!c.importKey||!c.deriveBits)return Promise.resolve(!1);if(l[E]!==void 0)return l[E];o=o||r.alloc(8);var B=m(o,o,10,128,E).then(function(){return!0}).catch(function(){return!1});return l[E]=B,B}var g;function y(){return g||(le.process&&le.process.nextTick?g=le.process.nextTick:le.queueMicrotask?g=le.queueMicrotask:le.setImmediate?g=le.setImmediate:g=le.setTimeout,g)}function m(E,B,x,C,N){return c.importKey("raw",E,{name:"PBKDF2"},!1,["deriveBits"]).then(function(F){return c.deriveBits({name:"PBKDF2",salt:B,iterations:x,hash:{name:N}},F,C<<3)}).then(function(F){return r.from(F)})}function M(E,B){E.then(function(x){y()(function(){B(null,x)})},function(x){y()(function(){B(x)})})}i.exports=function(E,B,x,C,N,F){typeof N=="function"&&(F=N,N=void 0),N=N||"sha1";var I=f[N.toLowerCase()];if(!I||typeof le.Promise!="function"){y()(function(){var U;try{U=s(E,B,x,C,N)}catch(P){return F(P)}F(null,U)});return}if(u(x,C),E=e(E,a,"Password"),B=e(B,a,"Salt"),typeof F!="function")throw new Error("No callback provided to pbkdf2");M(p(I).then(function(U){return U?m(E,B,x,C,I):s(E,B,x,C,N)}),F)}}),M0=gt(t=>{lt(),t.pbkdf2=gm(),t.pbkdf2Sync=T0()}),x0=gt(t=>{lt(),t.readUInt32BE=function(a,s){var e=a[0+s]<<24|a[1+s]<<16|a[2+s]<<8|a[3+s];return e>>>0},t.writeUInt32BE=function(a,s,e){a[0+e]=s>>>24,a[1+e]=s>>>16&255,a[2+e]=s>>>8&255,a[3+e]=s&255},t.ip=function(a,s,e,o){for(var c=0,f=0,l=6;l>=0;l-=2){for(var p=0;p<=24;p+=8)c<<=1,c|=s>>>p+l&1;for(var p=0;p<=24;p+=8)c<<=1,c|=a>>>p+l&1}for(var l=6;l>=0;l-=2){for(var p=1;p<=25;p+=8)f<<=1,f|=s>>>p+l&1;for(var p=1;p<=25;p+=8)f<<=1,f|=a>>>p+l&1}e[o+0]=c>>>0,e[o+1]=f>>>0},t.rip=function(a,s,e,o){for(var c=0,f=0,l=0;l<4;l++)for(var p=24;p>=0;p-=8)c<<=1,c|=s>>>p+l&1,c<<=1,c|=a>>>p+l&1;for(var l=4;l<8;l++)for(var p=24;p>=0;p-=8)f<<=1,f|=s>>>p+l&1,f<<=1,f|=a>>>p+l&1;e[o+0]=c>>>0,e[o+1]=f>>>0},t.pc1=function(a,s,e,o){for(var c=0,f=0,l=7;l>=5;l--){for(var p=0;p<=24;p+=8)c<<=1,c|=s>>p+l&1;for(var p=0;p<=24;p+=8)c<<=1,c|=a>>p+l&1}for(var p=0;p<=24;p+=8)c<<=1,c|=s>>p+l&1;for(var l=1;l<=3;l++){for(var p=0;p<=24;p+=8)f<<=1,f|=s>>p+l&1;for(var p=0;p<=24;p+=8)f<<=1,f|=a>>p+l&1}for(var p=0;p<=24;p+=8)f<<=1,f|=a>>p+l&1;e[o+0]=c>>>0,e[o+1]=f>>>0},t.r28shl=function(a,s){return a<>>28-s};var i=[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];t.pc2=function(a,s,e,o){for(var c=0,f=0,l=i.length>>>1,p=0;p>>i[p]&1;for(var p=l;p>>i[p]&1;e[o+0]=c>>>0,e[o+1]=f>>>0},t.expand=function(a,s,e){var o=0,c=0;o=(a&1)<<5|a>>>27;for(var f=23;f>=15;f-=4)o<<=6,o|=a>>>f&63;for(var f=11;f>=3;f-=4)c|=a>>>f&63,c<<=6;c|=(a&31)<<1|a>>>31,s[e+0]=o>>>0,s[e+1]=c>>>0};var r=[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];t.substitute=function(a,s){for(var e=0,o=0;o<4;o++){var c=a>>>18-o*6&63,f=r[o*64+c];e<<=4,e|=f}for(var o=0;o<4;o++){var c=s>>>18-o*6&63,f=r[4*64+o*64+c];e<<=4,e|=f}return e>>>0};var u=[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];t.permute=function(a){for(var s=0,e=0;e>>u[e]&1;return s>>>0},t.padSplit=function(a,s,e){for(var o=a.toString(2);o.length{lt(),i.exports=r;function r(u,a){if(!u)throw new Error(a||"Assertion failed")}r.equal=function(u,a,s){if(u!=a)throw new Error(s||"Assertion failed: "+u+" != "+a)}}),Zu=gt((t,i)=>{lt();var r=Vr();function u(a){this.options=a,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=a.padding!==!1}i.exports=u,u.prototype._init=function(){},u.prototype.update=function(a){return a.length===0?[]:this.type==="decrypt"?this._updateDecrypt(a):this._updateEncrypt(a)},u.prototype._buffer=function(a,s){for(var e=Math.min(this.buffer.length-this.bufferOff,a.length-s),o=0;o0;o--)s+=this._buffer(a,s),e+=this._flushBuffer(c,e);return s+=this._buffer(a,s),c},u.prototype.final=function(a){var s;a&&(s=this.update(a));var e;return this.type==="encrypt"?e=this._finalEncrypt():e=this._finalDecrypt(),s?s.concat(e):e},u.prototype._pad=function(a,s){if(s===0)return!1;for(;s{lt();var r=Vr(),u=pe(),a=x0(),s=Zu();function e(){this.tmp=new Array(2),this.keys=null}function o(f){s.call(this,f);var l=new e;this._desState=l,this.deriveKeys(l,f.key)}u(o,s),i.exports=o,o.create=function(f){return new o(f)};var c=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];o.prototype.deriveKeys=function(f,l){f.keys=new Array(16*2),r.equal(l.length,this.blockSize,"Invalid key length");var p=a.readUInt32BE(l,0),g=a.readUInt32BE(l,4);a.pc1(p,g,f.tmp,0),p=f.tmp[0],g=f.tmp[1];for(var y=0;y>>1];p=a.r28shl(p,m),g=a.r28shl(g,m),a.pc2(p,g,f.keys,y)}},o.prototype._update=function(f,l,p,g){var y=this._desState,m=a.readUInt32BE(f,l),M=a.readUInt32BE(f,l+4);a.ip(m,M,y.tmp,0),m=y.tmp[0],M=y.tmp[1],this.type==="encrypt"?this._encrypt(y,m,M,y.tmp,0):this._decrypt(y,m,M,y.tmp,0),m=y.tmp[0],M=y.tmp[1],a.writeUInt32BE(p,m,g),a.writeUInt32BE(p,M,g+4)},o.prototype._pad=function(f,l){if(this.padding===!1)return!1;for(var p=f.length-l,g=l;g>>0,m=F}a.rip(M,m,g,y)},o.prototype._decrypt=function(f,l,p,g,y){for(var m=p,M=l,E=f.keys.length-2;E>=0;E-=2){var B=f.keys[E],x=f.keys[E+1];a.expand(m,f.tmp,0),B^=f.tmp[0],x^=f.tmp[1];var C=a.substitute(B,x),N=a.permute(C),F=m;m=(M^N)>>>0,M=F}a.rip(m,M,g,y)}}),mm=gt(t=>{lt();var i=Vr(),r=pe(),u={};function a(e){i.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var o=0;o{lt();var r=Vr(),u=pe(),a=Zu(),s=k0();function e(c,f){r.equal(f.length,24,"Invalid key length");var l=f.slice(0,8),p=f.slice(8,16),g=f.slice(16,24);c==="encrypt"?this.ciphers=[s.create({type:"encrypt",key:l}),s.create({type:"decrypt",key:p}),s.create({type:"encrypt",key:g})]:this.ciphers=[s.create({type:"decrypt",key:g}),s.create({type:"encrypt",key:p}),s.create({type:"decrypt",key:l})]}function o(c){a.call(this,c);var f=new e(this.type,this.options.key);this._edeState=f}u(o,a),i.exports=o,o.create=function(c){return new o(c)},o.prototype._update=function(c,f,l,p){var g=this._edeState;g.ciphers[0]._update(c,f,l,p),g.ciphers[1]._update(l,p,l,p),g.ciphers[2]._update(l,p,l,p)},o.prototype._pad=s.prototype._pad,o.prototype._unpad=s.prototype._unpad}),bm=gt(t=>{lt(),t.utils=x0(),t.Cipher=Zu(),t.DES=k0(),t.CBC=mm(),t.EDE=ym()}),vm=gt((t,i)=>{lt();var r=Qn(),u=bm(),a=pe(),s=Ee().Buffer,e={"des-ede3-cbc":u.CBC.instantiate(u.EDE),"des-ede3":u.EDE,"des-ede-cbc":u.CBC.instantiate(u.EDE),"des-ede":u.EDE,"des-cbc":u.CBC.instantiate(u.DES),"des-ecb":u.DES};e.des=e["des-cbc"],e.des3=e["des-ede3-cbc"],i.exports=o,a(o,r);function o(c){r.call(this);var f=c.mode.toLowerCase(),l=e[f],p;c.decrypt?p="decrypt":p="encrypt";var g=c.key;s.isBuffer(g)||(g=s.from(g)),(f==="des-ede"||f==="des-ede-cbc")&&(g=s.concat([g,g.slice(0,8)]));var y=c.iv;s.isBuffer(y)||(y=s.from(y)),this._des=l.create({key:g,iv:y,type:p})}o.prototype._update=function(c){return s.from(this._des.update(c))},o.prototype._final=function(){return s.from(this._des.final())}}),wm=gt(t=>{lt(),t.encrypt=function(i,r){return i._cipher.encryptBlock(r)},t.decrypt=function(i,r){return i._cipher.decryptBlock(r)}}),Sa=gt((t,i)=>{lt(),i.exports=function(r,u){for(var a=Math.min(r.length,u.length),s=new Ut.Buffer(a),e=0;e{lt();var i=Sa();t.encrypt=function(r,u){var a=i(u,r._prev);return r._prev=r._cipher.encryptBlock(a),r._prev},t.decrypt=function(r,u){var a=r._prev;r._prev=u;var s=r._cipher.decryptBlock(u);return i(s,a)}}),Em=gt(t=>{lt();var i=Ee().Buffer,r=Sa();function u(a,s,e){var o=s.length,c=r(s,a._cache);return a._cache=a._cache.slice(o),a._prev=i.concat([a._prev,e?s:c]),c}t.encrypt=function(a,s,e){for(var o=i.allocUnsafe(0),c;s.length;)if(a._cache.length===0&&(a._cache=a._cipher.encryptBlock(a._prev),a._prev=i.allocUnsafe(0)),a._cache.length<=s.length)c=a._cache.length,o=i.concat([o,u(a,s.slice(0,c),e)]),s=s.slice(c);else{o=i.concat([o,u(a,s,e)]);break}return o}}),Sm=gt(t=>{lt();var i=Ee().Buffer;function r(u,a,s){var e=u._cipher.encryptBlock(u._prev),o=e[0]^a;return u._prev=i.concat([u._prev.slice(1),i.from([s?a:o])]),o}t.encrypt=function(u,a,s){for(var e=a.length,o=i.allocUnsafe(e),c=-1;++c{lt();var i=Ee().Buffer;function r(a,s,e){for(var o,c=-1,f=8,l=0,p,g;++c>c%8,a._prev=u(a._prev,e?p:g);return l}function u(a,s){var e=a.length,o=-1,c=i.allocUnsafe(a.length);for(a=i.concat([a,i.from([s])]);++o>7;return c}t.encrypt=function(a,s,e){for(var o=s.length,c=i.allocUnsafe(o),f=-1;++f{lt();var i=Sa();function r(u){return u._prev=u._cipher.encryptBlock(u._prev),u._prev}t.encrypt=function(u,a){for(;u._cache.length{lt();function r(u){for(var a=u.length,s;a--;)if(s=u.readUInt8(a),s===255)u.writeUInt8(0,a);else{s++,u.writeUInt8(s,a);break}}i.exports=r}),xl=gt(t=>{lt();var i=Sa(),r=Ee().Buffer,u=O0();function a(e){var o=e._cipher.encryptBlockRaw(e._prev);return u(e._prev),o}var s=16;t.encrypt=function(e,o){var c=Math.ceil(o.length/s),f=e._cache.length;e._cache=r.concat([e._cache,r.allocUnsafe(c*s)]);for(var l=0;l{i.exports={"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:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"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"}}}),Ju=gt((t,i)=>{lt();var r={ECB:wm(),CBC:_m(),CFB:Em(),CFB8:Sm(),CFB1:Am(),OFB:Tm(),CTR:xl(),GCM:xl()},u=I0();for(a in u)u[a].module=r[u[a].mode];var a;i.exports=u}),Qo=gt((t,i)=>{lt();var r=Ee().Buffer;function u(f){r.isBuffer(f)||(f=r.from(f));for(var l=f.length/4|0,p=new Array(l),g=0;g>>24]^M[C>>>16&255]^E[N>>>8&255]^B[F&255]^l[W++],U=m[C>>>24]^M[N>>>16&255]^E[F>>>8&255]^B[x&255]^l[W++],P=m[N>>>24]^M[F>>>16&255]^E[x>>>8&255]^B[C&255]^l[W++],D=m[F>>>24]^M[x>>>16&255]^E[C>>>8&255]^B[N&255]^l[W++],x=I,C=U,N=P,F=D;return I=(g[x>>>24]<<24|g[C>>>16&255]<<16|g[N>>>8&255]<<8|g[F&255])^l[W++],U=(g[C>>>24]<<24|g[N>>>16&255]<<16|g[F>>>8&255]<<8|g[x&255])^l[W++],P=(g[N>>>24]<<24|g[F>>>16&255]<<16|g[x>>>8&255]<<8|g[C&255])^l[W++],D=(g[F>>>24]<<24|g[x>>>16&255]<<16|g[C>>>8&255]<<8|g[N&255])^l[W++],I=I>>>0,U=U>>>0,P=P>>>0,D=D>>>0,[I,U,P,D]}var e=[0,1,2,4,8,16,32,64,128,27,54],o=function(){for(var f=new Array(256),l=0;l<256;l++)l<128?f[l]=l<<1:f[l]=l<<1^283;for(var p=[],g=[],y=[[],[],[],[]],m=[[],[],[],[]],M=0,E=0,B=0;B<256;++B){var x=E^E<<1^E<<2^E<<3^E<<4;x=x>>>8^x&255^99,p[M]=x,g[x]=M;var C=f[M],N=f[C],F=f[N],I=f[x]*257^x*16843008;y[0][M]=I<<24|I>>>8,y[1][M]=I<<16|I>>>16,y[2][M]=I<<8|I>>>24,y[3][M]=I,I=F*16843009^N*65537^C*257^M*16843008,m[0][x]=I<<24|I>>>8,m[1][x]=I<<16|I>>>16,m[2][x]=I<<8|I>>>24,m[3][x]=I,M===0?M=E=1:(M=C^f[f[f[F^C]]],E^=f[f[E]])}return{SBOX:p,INV_SBOX:g,SUB_MIX:y,INV_SUB_MIX:m}}();function c(f){this._key=u(f),this._reset()}c.blockSize=4*4,c.keySize=256/8,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var f=this._key,l=f.length,p=l+6,g=(p+1)*4,y=[],m=0;m>>24,M=o.SBOX[M>>>24]<<24|o.SBOX[M>>>16&255]<<16|o.SBOX[M>>>8&255]<<8|o.SBOX[M&255],M^=e[m/l|0]<<24):l>6&&m%l===4&&(M=o.SBOX[M>>>24]<<24|o.SBOX[M>>>16&255]<<16|o.SBOX[M>>>8&255]<<8|o.SBOX[M&255]),y[m]=y[m-l]^M}for(var E=[],B=0;B>>24]]^o.INV_SUB_MIX[1][o.SBOX[C>>>16&255]]^o.INV_SUB_MIX[2][o.SBOX[C>>>8&255]]^o.INV_SUB_MIX[3][o.SBOX[C&255]]}this._nRounds=p,this._keySchedule=y,this._invKeySchedule=E},c.prototype.encryptBlockRaw=function(f){return f=u(f),s(f,this._keySchedule,o.SUB_MIX,o.SBOX,this._nRounds)},c.prototype.encryptBlock=function(f){var l=this.encryptBlockRaw(f),p=r.allocUnsafe(16);return p.writeUInt32BE(l[0],0),p.writeUInt32BE(l[1],4),p.writeUInt32BE(l[2],8),p.writeUInt32BE(l[3],12),p},c.prototype.decryptBlock=function(f){f=u(f);var l=f[1];f[1]=f[3],f[3]=l;var p=s(f,this._invKeySchedule,o.INV_SUB_MIX,o.INV_SBOX,this._nRounds),g=r.allocUnsafe(16);return g.writeUInt32BE(p[0],0),g.writeUInt32BE(p[3],4),g.writeUInt32BE(p[2],8),g.writeUInt32BE(p[1],12),g},c.prototype.scrub=function(){a(this._keySchedule),a(this._invKeySchedule),a(this._key)},i.exports.AES=c}),Mm=gt((t,i)=>{lt();var r=Ee().Buffer,u=r.alloc(16,0);function a(o){return[o.readUInt32BE(0),o.readUInt32BE(4),o.readUInt32BE(8),o.readUInt32BE(12)]}function s(o){var c=r.allocUnsafe(16);return c.writeUInt32BE(o[0]>>>0,0),c.writeUInt32BE(o[1]>>>0,4),c.writeUInt32BE(o[2]>>>0,8),c.writeUInt32BE(o[3]>>>0,12),c}function e(o){this.h=o,this.state=r.alloc(16,0),this.cache=r.allocUnsafe(0)}e.prototype.ghash=function(o){for(var c=-1;++c0;f--)o[f]=o[f]>>>1|(o[f-1]&1)<<31;o[0]=o[0]>>>1,p&&(o[0]=o[0]^225<<24)}this.state=s(c)},e.prototype.update=function(o){this.cache=r.concat([this.cache,o]);for(var c;this.cache.length>=16;)c=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(c)},e.prototype.final=function(o,c){return this.cache.length&&this.ghash(r.concat([this.cache,u],16)),this.ghash(s([0,o,0,c])),this.state},i.exports=e}),B0=gt((t,i)=>{lt();var r=Qo(),u=Ee().Buffer,a=Qn(),s=pe(),e=Mm(),o=Sa(),c=O0();function f(g,y){var m=0;g.length!==y.length&&m++;for(var M=Math.min(g.length,y.length),E=0;E{lt();var r=Qo(),u=Ee().Buffer,a=Qn(),s=pe();function e(o,c,f,l){a.call(this),this._cipher=new r.AES(c),this._prev=u.from(f),this._cache=u.allocUnsafe(0),this._secCache=u.allocUnsafe(0),this._decrypt=l,this._mode=o}s(e,a),e.prototype._update=function(o){return this._mode.encrypt(this,o,this._decrypt)},e.prototype._final=function(){this._cipher.scrub()},i.exports=e}),ts=gt((t,i)=>{lt();var r=Ee().Buffer,u=Hu();function a(s,e,o,c){if(r.isBuffer(s)||(s=r.from(s,"binary")),e&&(r.isBuffer(e)||(e=r.from(e,"binary")),e.length!==8))throw new RangeError("salt should be Buffer with 8 byte length");for(var f=o/8,l=r.alloc(f),p=r.alloc(c||0),g=r.alloc(0);f>0||c>0;){var y=new u;y.update(g),y.update(s),e&&y.update(e),g=y.digest();var m=0;if(f>0){var M=l.length-f;m=Math.min(f,g.length),g.copy(l,M,0,m),f-=m}if(m0){var E=p.length-c,B=Math.min(c,g.length-m);g.copy(p,E,m,m+B),c-=B}}return g.fill(0),{key:l,iv:p}}i.exports=a}),xm=gt(t=>{lt();var i=Ju(),r=B0(),u=Ee().Buffer,a=C0(),s=Qn(),e=Qo(),o=ts(),c=pe();function f(m,M,E){s.call(this),this._cache=new p,this._cipher=new e.AES(M),this._prev=u.from(E),this._mode=m,this._autopadding=!0}c(f,s),f.prototype._update=function(m){this._cache.add(m);for(var M,E,B=[];M=this._cache.get();)E=this._mode.encrypt(this,M),B.push(E);return u.concat(B)};var l=u.alloc(16,16);f.prototype._final=function(){var m=this._cache.flush();if(this._autopadding)return m=this._mode.encrypt(this,m),this._cipher.scrub(),m;if(!m.equals(l))throw this._cipher.scrub(),new Error("data not multiple of block length")},f.prototype.setAutoPadding=function(m){return this._autopadding=!!m,this};function p(){this.cache=u.allocUnsafe(0)}p.prototype.add=function(m){this.cache=u.concat([this.cache,m])},p.prototype.get=function(){if(this.cache.length>15){var m=this.cache.slice(0,16);return this.cache=this.cache.slice(16),m}return null},p.prototype.flush=function(){for(var m=16-this.cache.length,M=u.allocUnsafe(m),E=-1;++E{lt();var i=B0(),r=Ee().Buffer,u=Ju(),a=C0(),s=Qn(),e=Qo(),o=ts(),c=pe();function f(m,M,E){s.call(this),this._cache=new l,this._last=void 0,this._cipher=new e.AES(M),this._prev=r.from(E),this._mode=m,this._autopadding=!0}c(f,s),f.prototype._update=function(m){this._cache.add(m);for(var M,E,B=[];M=this._cache.get(this._autopadding);)E=this._mode.decrypt(this,M),B.push(E);return r.concat(B)},f.prototype._final=function(){var m=this._cache.flush();if(this._autopadding)return p(this._mode.decrypt(this,m));if(m)throw new Error("data not multiple of block length")},f.prototype.setAutoPadding=function(m){return this._autopadding=!!m,this};function l(){this.cache=r.allocUnsafe(0)}l.prototype.add=function(m){this.cache=r.concat([this.cache,m])},l.prototype.get=function(m){var M;if(m){if(this.cache.length>16)return M=this.cache.slice(0,16),this.cache=this.cache.slice(16),M}else if(this.cache.length>=16)return M=this.cache.slice(0,16),this.cache=this.cache.slice(16),M;return null},l.prototype.flush=function(){if(this.cache.length)return this.cache};function p(m){var M=m[15];if(M<1||M>16)throw new Error("unable to decrypt data");for(var E=-1;++E{lt();var i=xm(),r=km(),u=I0();function a(){return Object.keys(u)}t.createCipher=t.Cipher=i.createCipher,t.createCipheriv=t.Cipheriv=i.createCipheriv,t.createDecipher=t.Decipher=r.createDecipher,t.createDecipheriv=t.Decipheriv=r.createDecipheriv,t.listCiphers=t.getCiphers=a}),Om=gt(t=>{lt(),t["des-ecb"]={key:8,iv:0},t["des-cbc"]=t.des={key:8,iv:8},t["des-ede3-cbc"]=t.des3={key:24,iv:8},t["des-ede3"]={key:24,iv:0},t["des-ede-cbc"]={key:16,iv:8},t["des-ede"]={key:16,iv:0}}),Im=gt(t=>{lt();var i=vm(),r=Xu(),u=Ju(),a=Om(),s=ts();function e(p,g){p=p.toLowerCase();var y,m;if(u[p])y=u[p].key,m=u[p].iv;else if(a[p])y=a[p].key*8,m=a[p].iv;else throw new TypeError("invalid suite type");var M=s(g,!1,y,m);return c(p,M.key,M.iv)}function o(p,g){p=p.toLowerCase();var y,m;if(u[p])y=u[p].key,m=u[p].iv;else if(a[p])y=a[p].key*8,m=a[p].iv;else throw new TypeError("invalid suite type");var M=s(g,!1,y,m);return f(p,M.key,M.iv)}function c(p,g,y){if(p=p.toLowerCase(),u[p])return r.createCipheriv(p,g,y);if(a[p])return new i({key:g,iv:y,mode:p});throw new TypeError("invalid suite type")}function f(p,g,y){if(p=p.toLowerCase(),u[p])return r.createDecipheriv(p,g,y);if(a[p])return new i({key:g,iv:y,mode:p,decrypt:!0});throw new TypeError("invalid suite type")}function l(){return Object.keys(a).concat(r.getCiphers())}t.createCipher=t.Cipher=e,t.createCipheriv=t.Cipheriv=c,t.createDecipher=t.Decipher=o,t.createDecipheriv=t.Decipheriv=f,t.listCiphers=t.getCiphers=l}),Yu=gt((t,i)=>{lt();var r;i.exports=function(s){return r||(r=new u(null)),r.generate(s)};function u(s){this.rand=s}if(i.exports.Rand=u,u.prototype.generate=function(s){return this._rand(s)},u.prototype._rand=function(s){if(this.rand.getBytes)return this.rand.getBytes(s);for(var e=new Uint8Array(s),o=0;o{lt();var r=sr(),u=Yu();function a(s){this.rand=s||new u.Rand}i.exports=a,a.create=function(s){return new a(s)},a.prototype._randbelow=function(s){var e=s.bitLength(),o=Math.ceil(e/8);do var c=new r(this.rand.generate(o));while(c.cmp(s)>=0);return c},a.prototype._randrange=function(s,e){var o=e.sub(s);return s.add(this._randbelow(o))},a.prototype.test=function(s,e,o){var c=s.bitLength(),f=r.mont(s),l=new r(1).toRed(f);e||(e=Math.max(1,c/48|0));for(var p=s.subn(1),g=0;!p.testn(g);g++);for(var y=s.shrn(g),m=p.toRed(f),M=!0;e>0;e--){var E=this._randrange(new r(2),p);o&&o(E);var B=E.toRed(f).redPow(y);if(!(B.cmp(l)===0||B.cmp(m)===0)){for(var x=1;x0;e--){var m=this._randrange(new r(2),l),M=s.gcd(m);if(M.cmpn(1)!==0)return M;var E=m.toRed(c).redPow(g);if(!(E.cmp(f)===0||E.cmp(y)===0)){for(var B=1;B{lt();var r=Fi();i.exports=x,x.simpleSieve=E,x.fermatTest=B;var u=sr(),a=new u(24),s=P0(),e=new s,o=new u(1),c=new u(2),f=new u(5);new u(16),new u(8);var l=new u(10),p=new u(3);new u(7);var g=new u(11),y=new u(4);new u(12);var m=null;function M(){if(m!==null)return m;var C=1048576,N=[];N[0]=2;for(var F=1,I=3;IC;)F.ishrn(1);if(F.isEven()&&F.iadd(o),F.testn(1)||F.iadd(c),N.cmp(c)){if(!N.cmp(f))for(;F.mod(l).cmp(p);)F.iadd(y)}else for(;F.mod(a).cmp(g);)F.iadd(y);if(I=F.shrn(1),E(I)&&E(F)&&B(I)&&B(F)&&e.test(I)&&e.test(F))return F}}}),Bm=gt((t,i)=>{i.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}}),Cm=gt((t,i)=>{lt();var r=sr(),u=P0(),a=new u,s=new r(24),e=new r(11),o=new r(10),c=new r(3),f=new r(7),l=R0(),p=Fi();i.exports=E;function g(x,C){return C=C||"utf8",Ut.Buffer.isBuffer(x)||(x=new Ut.Buffer(x,C)),this._pub=new r(x),this}function y(x,C){return C=C||"utf8",Ut.Buffer.isBuffer(x)||(x=new Ut.Buffer(x,C)),this._priv=new r(x),this}var m={};function M(x,C){var N=C.toString("hex"),F=[N,x.toString(16)].join("_");if(F in m)return m[F];var I=0;if(x.isEven()||!l.simpleSieve||!l.fermatTest(x)||!a.test(x))return I+=1,N==="02"||N==="05"?I+=8:I+=4,m[F]=I,I;a.test(x.shrn(1))||(I+=2);var U;switch(N){case"02":x.mod(s).cmp(e)&&(I+=8);break;case"05":U=x.mod(o),U.cmp(c)&&U.cmp(f)&&(I+=8);break;default:I+=4}return m[F]=I,I}function E(x,C,N){this.setGenerator(C),this.__prime=new r(x),this._prime=r.mont(this.__prime),this._primeLen=x.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,N?(this.setPublicKey=g,this.setPrivateKey=y):this._primeCode=8}Object.defineProperty(E.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=M(this.__prime,this.__gen)),this._primeCode}}),E.prototype.generateKeys=function(){return this._priv||(this._priv=new r(p(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},E.prototype.computeSecret=function(x){x=new r(x),x=x.toRed(this._prime);var C=x.redPow(this._priv).fromRed(),N=new Ut.Buffer(C.toArray()),F=this.getPrime();if(N.length{lt();var i=R0(),r=Bm(),u=Cm();function a(o){var c=new Ut.Buffer(r[o].prime,"hex"),f=new Ut.Buffer(r[o].gen,"hex");return new u(c,f)}var s={binary:!0,hex:!0,base64:!0};function e(o,c,f,l){return Ut.Buffer.isBuffer(c)||s[c]===void 0?e(o,"binary",c,f):(c=c||"binary",l=l||"binary",f=f||new Ut.Buffer([2]),Ut.Buffer.isBuffer(f)||(f=new Ut.Buffer(f,l)),typeof o=="number"?new u(i(o,f),f,!0):(Ut.Buffer.isBuffer(o)||(o=new Ut.Buffer(o,c)),new u(o,f,!0)))}t.DiffieHellmanGroup=t.createDiffieHellmanGroup=t.getDiffieHellman=a,t.createDiffieHellman=t.DiffieHellman=e}),Rm=gt((t,i)=>{lt(),function(r,u){function a(n,d){if(!n)throw new Error(d||"Assertion failed")}function s(n,d){n.super_=d;var v=function(){};v.prototype=d.prototype,n.prototype=new v,n.prototype.constructor=n}function e(n,d,v){if(e.isBN(n))return n;this.negative=0,this.words=null,this.length=0,this.red=null,n!==null&&((d==="le"||d==="be")&&(v=d,d=10),this._init(n||0,d||10,v||"be"))}typeof r=="object"?r.exports=e:u.BN=e,e.BN=e,e.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=$e().Buffer}catch{}e.isBN=function(n){return n instanceof e?!0:n!==null&&typeof n=="object"&&n.constructor.wordSize===e.wordSize&&Array.isArray(n.words)},e.max=function(n,d){return n.cmp(d)>0?n:d},e.min=function(n,d){return n.cmp(d)<0?n:d},e.prototype._init=function(n,d,v){if(typeof n=="number")return this._initNumber(n,d,v);if(typeof n=="object")return this._initArray(n,d,v);d==="hex"&&(d=16),a(d===(d|0)&&d>=2&&d<=36),n=n.toString().replace(/\s+/g,"");var A=0;n[0]==="-"&&(A++,this.negative=1),A=0;A-=3)S=n[A]|n[A-1]<<8|n[A-2]<<16,this.words[T]|=S<>>26-w&67108863,w+=24,w>=26&&(w-=26,T++);else if(v==="le")for(A=0,T=0;A>>26-w&67108863,w+=24,w>=26&&(w-=26,T++);return this._strip()};function c(n,d){var v=n.charCodeAt(d);if(v>=48&&v<=57)return v-48;if(v>=65&&v<=70)return v-55;if(v>=97&&v<=102)return v-87;a(!1,"Invalid character in "+n)}function f(n,d,v){var A=c(n,v);return v-1>=d&&(A|=c(n,v-1)<<4),A}e.prototype._parseHex=function(n,d,v){this.length=Math.ceil((n.length-d)/6),this.words=new Array(this.length);for(var A=0;A=d;A-=2)w=f(n,d,A)<=18?(T-=18,S+=1,this.words[S]|=w>>>26):T+=8;else{var b=n.length-d;for(A=b%2===0?d+1:d;A=18?(T-=18,S+=1,this.words[S]|=w>>>26):T+=8}this._strip()};function l(n,d,v,A){for(var T=0,S=0,w=Math.min(n.length,v),b=d;b=49?S=h-49+10:h>=17?S=h-17+10:S=h,a(h>=0&&S1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},e.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{e.prototype[Symbol.for("nodejs.util.inspect.custom")]=g}catch{e.prototype.inspect=g}else e.prototype.inspect=g;function g(){return(this.red?""}var y=["","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],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];e.prototype.toString=function(n,d){n=n||10,d=d|0||1;var v;if(n===16||n==="hex"){v="";for(var A=0,T=0,S=0;S>>24-A&16777215,A+=2,A>=26&&(A-=26,S--),T!==0||S!==this.length-1?v=y[6-b.length]+b+v:v=b+v}for(T!==0&&(v=T.toString(16)+v);v.length%d!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(n===(n|0)&&n>=2&&n<=36){var h=m[n],k=M[n];v="";var tt=this.clone();for(tt.negative=0;!tt.isZero();){var X=tt.modrn(k).toString(n);tt=tt.idivn(k),tt.isZero()?v=X+v:v=y[h-X.length]+X+v}for(this.isZero()&&(v="0"+v);v.length%d!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}a(!1,"Base should be between 2 and 36")},e.prototype.toNumber=function(){var n=this.words[0];return this.length===2?n+=this.words[1]*67108864:this.length===3&&this.words[2]===1?n+=4503599627370496+this.words[1]*67108864:this.length>2&&a(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-n:n},e.prototype.toJSON=function(){return this.toString(16,2)},o&&(e.prototype.toBuffer=function(n,d){return this.toArrayLike(o,n,d)}),e.prototype.toArray=function(n,d){return this.toArrayLike(Array,n,d)};var E=function(n,d){return n.allocUnsafe?n.allocUnsafe(d):new n(d)};e.prototype.toArrayLike=function(n,d,v){this._strip();var A=this.byteLength(),T=v||Math.max(1,A);a(A<=T,"byte array longer than desired length"),a(T>0,"Requested array length <= 0");var S=E(n,T),w=d==="le"?"LE":"BE";return this["_toArrayLike"+w](S,A),S},e.prototype._toArrayLikeLE=function(n,d){for(var v=0,A=0,T=0,S=0;T>8&255),v>16&255),S===6?(v>24&255),A=0,S=0):(A=w>>>24,S+=2)}if(v=0&&(n[v--]=w>>8&255),v>=0&&(n[v--]=w>>16&255),S===6?(v>=0&&(n[v--]=w>>24&255),A=0,S=0):(A=w>>>24,S+=2)}if(v>=0)for(n[v--]=A;v>=0;)n[v--]=0},Math.clz32?e.prototype._countBits=function(n){return 32-Math.clz32(n)}:e.prototype._countBits=function(n){var d=n,v=0;return d>=4096&&(v+=13,d>>>=13),d>=64&&(v+=7,d>>>=7),d>=8&&(v+=4,d>>>=4),d>=2&&(v+=2,d>>>=2),v+d},e.prototype._zeroBits=function(n){if(n===0)return 26;var d=n,v=0;return!(d&8191)&&(v+=13,d>>>=13),!(d&127)&&(v+=7,d>>>=7),!(d&15)&&(v+=4,d>>>=4),!(d&3)&&(v+=2,d>>>=2),!(d&1)&&v++,v},e.prototype.bitLength=function(){var n=this.words[this.length-1],d=this._countBits(n);return(this.length-1)*26+d};function B(n){for(var d=new Array(n.bitLength()),v=0;v>>T&1}return d}e.prototype.zeroBits=function(){if(this.isZero())return 0;for(var n=0,d=0;dn.length?this.clone().ior(n):n.clone().ior(this)},e.prototype.uor=function(n){return this.length>n.length?this.clone().iuor(n):n.clone().iuor(this)},e.prototype.iuand=function(n){var d;this.length>n.length?d=n:d=this;for(var v=0;vn.length?this.clone().iand(n):n.clone().iand(this)},e.prototype.uand=function(n){return this.length>n.length?this.clone().iuand(n):n.clone().iuand(this)},e.prototype.iuxor=function(n){var d,v;this.length>n.length?(d=this,v=n):(d=n,v=this);for(var A=0;An.length?this.clone().ixor(n):n.clone().ixor(this)},e.prototype.uxor=function(n){return this.length>n.length?this.clone().iuxor(n):n.clone().iuxor(this)},e.prototype.inotn=function(n){a(typeof n=="number"&&n>=0);var d=Math.ceil(n/26)|0,v=n%26;this._expand(d),v>0&&d--;for(var A=0;A0&&(this.words[A]=~this.words[A]&67108863>>26-v),this._strip()},e.prototype.notn=function(n){return this.clone().inotn(n)},e.prototype.setn=function(n,d){a(typeof n=="number"&&n>=0);var v=n/26|0,A=n%26;return this._expand(v+1),d?this.words[v]=this.words[v]|1<n.length?(v=this,A=n):(v=n,A=this);for(var T=0,S=0;S>>26;for(;T!==0&&S>>26;if(this.length=v.length,T!==0)this.words[this.length]=T,this.length++;else if(v!==this)for(;Sn.length?this.clone().iadd(n):n.clone().iadd(this)},e.prototype.isub=function(n){if(n.negative!==0){n.negative=0;var d=this.iadd(n);return n.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(n),this.negative=1,this._normSign();var v=this.cmp(n);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var A,T;v>0?(A=this,T=n):(A=n,T=this);for(var S=0,w=0;w>26,this.words[w]=d&67108863;for(;S!==0&&w>26,this.words[w]=d&67108863;if(S===0&&w>>26,X=h&67108863,ft=Math.min(k,d.length-1),et=Math.max(0,k-n.length+1);et<=ft;et++){var at=k-et|0;T=n.words[at]|0,S=d.words[et]|0,w=T*S+X,tt+=w/67108864|0,X=w&67108863}v.words[k]=X|0,h=tt|0}return h!==0?v.words[k]=h|0:v.length--,v._strip()}var C=function(n,d,v){var A=n.words,T=d.words,S=v.words,w=0,b,h,k,tt=A[0]|0,X=tt&8191,ft=tt>>>13,et=A[1]|0,at=et&8191,$=et>>>13,J=A[2]|0,R=J&8191,j=J>>>13,z=A[3]|0,Z=z&8191,Q=z>>>13,K=A[4]|0,G=K&8191,H=K>>>13,Y=A[5]|0,it=Y&8191,ot=Y>>>13,mt=A[6]|0,_t=mt&8191,ht=mt>>>13,vt=A[7]|0,pt=vt&8191,V=vt>>>13,rt=A[8]|0,st=rt&8191,yt=rt>>>13,Ct=A[9]|0,dt=Ct&8191,Mt=Ct>>>13,Lt=T[0]|0,wt=Lt&8191,ct=Lt>>>13,Et=T[1]|0,ut=Et&8191,Ot=Et>>>13,qt=T[2]|0,nt=qt&8191,Rt=qt>>>13,Dt=T[3]|0,bt=Dt&8191,Tt=Dt>>>13,jt=T[4]|0,St=jt&8191,kt=jt>>>13,Kt=T[5]|0,At=Kt&8191,Nt=Kt>>>13,$t=T[6]|0,Ft=$t&8191,Wt=$t>>>13,ae=T[7]|0,Xt=ae&8191,Gt=ae>>>13,he=T[8]|0,Qt=he&8191,Zt=he>>>13,se=T[9]|0,te=se&8191,re=se>>>13;v.negative=n.negative^d.negative,v.length=19,b=Math.imul(X,wt),h=Math.imul(X,ct),h=h+Math.imul(ft,wt)|0,k=Math.imul(ft,ct);var Se=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Se>>>26)|0,Se&=67108863,b=Math.imul(at,wt),h=Math.imul(at,ct),h=h+Math.imul($,wt)|0,k=Math.imul($,ct),b=b+Math.imul(X,ut)|0,h=h+Math.imul(X,Ot)|0,h=h+Math.imul(ft,ut)|0,k=k+Math.imul(ft,Ot)|0;var Be=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Be>>>26)|0,Be&=67108863,b=Math.imul(R,wt),h=Math.imul(R,ct),h=h+Math.imul(j,wt)|0,k=Math.imul(j,ct),b=b+Math.imul(at,ut)|0,h=h+Math.imul(at,Ot)|0,h=h+Math.imul($,ut)|0,k=k+Math.imul($,Ot)|0,b=b+Math.imul(X,nt)|0,h=h+Math.imul(X,Rt)|0,h=h+Math.imul(ft,nt)|0,k=k+Math.imul(ft,Rt)|0;var Re=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Re>>>26)|0,Re&=67108863,b=Math.imul(Z,wt),h=Math.imul(Z,ct),h=h+Math.imul(Q,wt)|0,k=Math.imul(Q,ct),b=b+Math.imul(R,ut)|0,h=h+Math.imul(R,Ot)|0,h=h+Math.imul(j,ut)|0,k=k+Math.imul(j,Ot)|0,b=b+Math.imul(at,nt)|0,h=h+Math.imul(at,Rt)|0,h=h+Math.imul($,nt)|0,k=k+Math.imul($,Rt)|0,b=b+Math.imul(X,bt)|0,h=h+Math.imul(X,Tt)|0,h=h+Math.imul(ft,bt)|0,k=k+Math.imul(ft,Tt)|0;var Te=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Te>>>26)|0,Te&=67108863,b=Math.imul(G,wt),h=Math.imul(G,ct),h=h+Math.imul(H,wt)|0,k=Math.imul(H,ct),b=b+Math.imul(Z,ut)|0,h=h+Math.imul(Z,Ot)|0,h=h+Math.imul(Q,ut)|0,k=k+Math.imul(Q,Ot)|0,b=b+Math.imul(R,nt)|0,h=h+Math.imul(R,Rt)|0,h=h+Math.imul(j,nt)|0,k=k+Math.imul(j,Rt)|0,b=b+Math.imul(at,bt)|0,h=h+Math.imul(at,Tt)|0,h=h+Math.imul($,bt)|0,k=k+Math.imul($,Tt)|0,b=b+Math.imul(X,St)|0,h=h+Math.imul(X,kt)|0,h=h+Math.imul(ft,St)|0,k=k+Math.imul(ft,kt)|0;var xe=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(xe>>>26)|0,xe&=67108863,b=Math.imul(it,wt),h=Math.imul(it,ct),h=h+Math.imul(ot,wt)|0,k=Math.imul(ot,ct),b=b+Math.imul(G,ut)|0,h=h+Math.imul(G,Ot)|0,h=h+Math.imul(H,ut)|0,k=k+Math.imul(H,Ot)|0,b=b+Math.imul(Z,nt)|0,h=h+Math.imul(Z,Rt)|0,h=h+Math.imul(Q,nt)|0,k=k+Math.imul(Q,Rt)|0,b=b+Math.imul(R,bt)|0,h=h+Math.imul(R,Tt)|0,h=h+Math.imul(j,bt)|0,k=k+Math.imul(j,Tt)|0,b=b+Math.imul(at,St)|0,h=h+Math.imul(at,kt)|0,h=h+Math.imul($,St)|0,k=k+Math.imul($,kt)|0,b=b+Math.imul(X,At)|0,h=h+Math.imul(X,Nt)|0,h=h+Math.imul(ft,At)|0,k=k+Math.imul(ft,Nt)|0;var Ce=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,b=Math.imul(_t,wt),h=Math.imul(_t,ct),h=h+Math.imul(ht,wt)|0,k=Math.imul(ht,ct),b=b+Math.imul(it,ut)|0,h=h+Math.imul(it,Ot)|0,h=h+Math.imul(ot,ut)|0,k=k+Math.imul(ot,Ot)|0,b=b+Math.imul(G,nt)|0,h=h+Math.imul(G,Rt)|0,h=h+Math.imul(H,nt)|0,k=k+Math.imul(H,Rt)|0,b=b+Math.imul(Z,bt)|0,h=h+Math.imul(Z,Tt)|0,h=h+Math.imul(Q,bt)|0,k=k+Math.imul(Q,Tt)|0,b=b+Math.imul(R,St)|0,h=h+Math.imul(R,kt)|0,h=h+Math.imul(j,St)|0,k=k+Math.imul(j,kt)|0,b=b+Math.imul(at,At)|0,h=h+Math.imul(at,Nt)|0,h=h+Math.imul($,At)|0,k=k+Math.imul($,Nt)|0,b=b+Math.imul(X,Ft)|0,h=h+Math.imul(X,Wt)|0,h=h+Math.imul(ft,Ft)|0,k=k+Math.imul(ft,Wt)|0;var Ue=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,b=Math.imul(pt,wt),h=Math.imul(pt,ct),h=h+Math.imul(V,wt)|0,k=Math.imul(V,ct),b=b+Math.imul(_t,ut)|0,h=h+Math.imul(_t,Ot)|0,h=h+Math.imul(ht,ut)|0,k=k+Math.imul(ht,Ot)|0,b=b+Math.imul(it,nt)|0,h=h+Math.imul(it,Rt)|0,h=h+Math.imul(ot,nt)|0,k=k+Math.imul(ot,Rt)|0,b=b+Math.imul(G,bt)|0,h=h+Math.imul(G,Tt)|0,h=h+Math.imul(H,bt)|0,k=k+Math.imul(H,Tt)|0,b=b+Math.imul(Z,St)|0,h=h+Math.imul(Z,kt)|0,h=h+Math.imul(Q,St)|0,k=k+Math.imul(Q,kt)|0,b=b+Math.imul(R,At)|0,h=h+Math.imul(R,Nt)|0,h=h+Math.imul(j,At)|0,k=k+Math.imul(j,Nt)|0,b=b+Math.imul(at,Ft)|0,h=h+Math.imul(at,Wt)|0,h=h+Math.imul($,Ft)|0,k=k+Math.imul($,Wt)|0,b=b+Math.imul(X,Xt)|0,h=h+Math.imul(X,Gt)|0,h=h+Math.imul(ft,Xt)|0,k=k+Math.imul(ft,Gt)|0;var Ke=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,b=Math.imul(st,wt),h=Math.imul(st,ct),h=h+Math.imul(yt,wt)|0,k=Math.imul(yt,ct),b=b+Math.imul(pt,ut)|0,h=h+Math.imul(pt,Ot)|0,h=h+Math.imul(V,ut)|0,k=k+Math.imul(V,Ot)|0,b=b+Math.imul(_t,nt)|0,h=h+Math.imul(_t,Rt)|0,h=h+Math.imul(ht,nt)|0,k=k+Math.imul(ht,Rt)|0,b=b+Math.imul(it,bt)|0,h=h+Math.imul(it,Tt)|0,h=h+Math.imul(ot,bt)|0,k=k+Math.imul(ot,Tt)|0,b=b+Math.imul(G,St)|0,h=h+Math.imul(G,kt)|0,h=h+Math.imul(H,St)|0,k=k+Math.imul(H,kt)|0,b=b+Math.imul(Z,At)|0,h=h+Math.imul(Z,Nt)|0,h=h+Math.imul(Q,At)|0,k=k+Math.imul(Q,Nt)|0,b=b+Math.imul(R,Ft)|0,h=h+Math.imul(R,Wt)|0,h=h+Math.imul(j,Ft)|0,k=k+Math.imul(j,Wt)|0,b=b+Math.imul(at,Xt)|0,h=h+Math.imul(at,Gt)|0,h=h+Math.imul($,Xt)|0,k=k+Math.imul($,Gt)|0,b=b+Math.imul(X,Qt)|0,h=h+Math.imul(X,Zt)|0,h=h+Math.imul(ft,Qt)|0,k=k+Math.imul(ft,Zt)|0;var Je=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Je>>>26)|0,Je&=67108863,b=Math.imul(dt,wt),h=Math.imul(dt,ct),h=h+Math.imul(Mt,wt)|0,k=Math.imul(Mt,ct),b=b+Math.imul(st,ut)|0,h=h+Math.imul(st,Ot)|0,h=h+Math.imul(yt,ut)|0,k=k+Math.imul(yt,Ot)|0,b=b+Math.imul(pt,nt)|0,h=h+Math.imul(pt,Rt)|0,h=h+Math.imul(V,nt)|0,k=k+Math.imul(V,Rt)|0,b=b+Math.imul(_t,bt)|0,h=h+Math.imul(_t,Tt)|0,h=h+Math.imul(ht,bt)|0,k=k+Math.imul(ht,Tt)|0,b=b+Math.imul(it,St)|0,h=h+Math.imul(it,kt)|0,h=h+Math.imul(ot,St)|0,k=k+Math.imul(ot,kt)|0,b=b+Math.imul(G,At)|0,h=h+Math.imul(G,Nt)|0,h=h+Math.imul(H,At)|0,k=k+Math.imul(H,Nt)|0,b=b+Math.imul(Z,Ft)|0,h=h+Math.imul(Z,Wt)|0,h=h+Math.imul(Q,Ft)|0,k=k+Math.imul(Q,Wt)|0,b=b+Math.imul(R,Xt)|0,h=h+Math.imul(R,Gt)|0,h=h+Math.imul(j,Xt)|0,k=k+Math.imul(j,Gt)|0,b=b+Math.imul(at,Qt)|0,h=h+Math.imul(at,Zt)|0,h=h+Math.imul($,Qt)|0,k=k+Math.imul($,Zt)|0,b=b+Math.imul(X,te)|0,h=h+Math.imul(X,re)|0,h=h+Math.imul(ft,te)|0,k=k+Math.imul(ft,re)|0;var ze=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(ze>>>26)|0,ze&=67108863,b=Math.imul(dt,ut),h=Math.imul(dt,Ot),h=h+Math.imul(Mt,ut)|0,k=Math.imul(Mt,Ot),b=b+Math.imul(st,nt)|0,h=h+Math.imul(st,Rt)|0,h=h+Math.imul(yt,nt)|0,k=k+Math.imul(yt,Rt)|0,b=b+Math.imul(pt,bt)|0,h=h+Math.imul(pt,Tt)|0,h=h+Math.imul(V,bt)|0,k=k+Math.imul(V,Tt)|0,b=b+Math.imul(_t,St)|0,h=h+Math.imul(_t,kt)|0,h=h+Math.imul(ht,St)|0,k=k+Math.imul(ht,kt)|0,b=b+Math.imul(it,At)|0,h=h+Math.imul(it,Nt)|0,h=h+Math.imul(ot,At)|0,k=k+Math.imul(ot,Nt)|0,b=b+Math.imul(G,Ft)|0,h=h+Math.imul(G,Wt)|0,h=h+Math.imul(H,Ft)|0,k=k+Math.imul(H,Wt)|0,b=b+Math.imul(Z,Xt)|0,h=h+Math.imul(Z,Gt)|0,h=h+Math.imul(Q,Xt)|0,k=k+Math.imul(Q,Gt)|0,b=b+Math.imul(R,Qt)|0,h=h+Math.imul(R,Zt)|0,h=h+Math.imul(j,Qt)|0,k=k+Math.imul(j,Zt)|0,b=b+Math.imul(at,te)|0,h=h+Math.imul(at,re)|0,h=h+Math.imul($,te)|0,k=k+Math.imul($,re)|0;var Xe=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,b=Math.imul(dt,nt),h=Math.imul(dt,Rt),h=h+Math.imul(Mt,nt)|0,k=Math.imul(Mt,Rt),b=b+Math.imul(st,bt)|0,h=h+Math.imul(st,Tt)|0,h=h+Math.imul(yt,bt)|0,k=k+Math.imul(yt,Tt)|0,b=b+Math.imul(pt,St)|0,h=h+Math.imul(pt,kt)|0,h=h+Math.imul(V,St)|0,k=k+Math.imul(V,kt)|0,b=b+Math.imul(_t,At)|0,h=h+Math.imul(_t,Nt)|0,h=h+Math.imul(ht,At)|0,k=k+Math.imul(ht,Nt)|0,b=b+Math.imul(it,Ft)|0,h=h+Math.imul(it,Wt)|0,h=h+Math.imul(ot,Ft)|0,k=k+Math.imul(ot,Wt)|0,b=b+Math.imul(G,Xt)|0,h=h+Math.imul(G,Gt)|0,h=h+Math.imul(H,Xt)|0,k=k+Math.imul(H,Gt)|0,b=b+Math.imul(Z,Qt)|0,h=h+Math.imul(Z,Zt)|0,h=h+Math.imul(Q,Qt)|0,k=k+Math.imul(Q,Zt)|0,b=b+Math.imul(R,te)|0,h=h+Math.imul(R,re)|0,h=h+Math.imul(j,te)|0,k=k+Math.imul(j,re)|0;var Ge=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,b=Math.imul(dt,bt),h=Math.imul(dt,Tt),h=h+Math.imul(Mt,bt)|0,k=Math.imul(Mt,Tt),b=b+Math.imul(st,St)|0,h=h+Math.imul(st,kt)|0,h=h+Math.imul(yt,St)|0,k=k+Math.imul(yt,kt)|0,b=b+Math.imul(pt,At)|0,h=h+Math.imul(pt,Nt)|0,h=h+Math.imul(V,At)|0,k=k+Math.imul(V,Nt)|0,b=b+Math.imul(_t,Ft)|0,h=h+Math.imul(_t,Wt)|0,h=h+Math.imul(ht,Ft)|0,k=k+Math.imul(ht,Wt)|0,b=b+Math.imul(it,Xt)|0,h=h+Math.imul(it,Gt)|0,h=h+Math.imul(ot,Xt)|0,k=k+Math.imul(ot,Gt)|0,b=b+Math.imul(G,Qt)|0,h=h+Math.imul(G,Zt)|0,h=h+Math.imul(H,Qt)|0,k=k+Math.imul(H,Zt)|0,b=b+Math.imul(Z,te)|0,h=h+Math.imul(Z,re)|0,h=h+Math.imul(Q,te)|0,k=k+Math.imul(Q,re)|0;var Ye=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,b=Math.imul(dt,St),h=Math.imul(dt,kt),h=h+Math.imul(Mt,St)|0,k=Math.imul(Mt,kt),b=b+Math.imul(st,At)|0,h=h+Math.imul(st,Nt)|0,h=h+Math.imul(yt,At)|0,k=k+Math.imul(yt,Nt)|0,b=b+Math.imul(pt,Ft)|0,h=h+Math.imul(pt,Wt)|0,h=h+Math.imul(V,Ft)|0,k=k+Math.imul(V,Wt)|0,b=b+Math.imul(_t,Xt)|0,h=h+Math.imul(_t,Gt)|0,h=h+Math.imul(ht,Xt)|0,k=k+Math.imul(ht,Gt)|0,b=b+Math.imul(it,Qt)|0,h=h+Math.imul(it,Zt)|0,h=h+Math.imul(ot,Qt)|0,k=k+Math.imul(ot,Zt)|0,b=b+Math.imul(G,te)|0,h=h+Math.imul(G,re)|0,h=h+Math.imul(H,te)|0,k=k+Math.imul(H,re)|0;var We=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(We>>>26)|0,We&=67108863,b=Math.imul(dt,At),h=Math.imul(dt,Nt),h=h+Math.imul(Mt,At)|0,k=Math.imul(Mt,Nt),b=b+Math.imul(st,Ft)|0,h=h+Math.imul(st,Wt)|0,h=h+Math.imul(yt,Ft)|0,k=k+Math.imul(yt,Wt)|0,b=b+Math.imul(pt,Xt)|0,h=h+Math.imul(pt,Gt)|0,h=h+Math.imul(V,Xt)|0,k=k+Math.imul(V,Gt)|0,b=b+Math.imul(_t,Qt)|0,h=h+Math.imul(_t,Zt)|0,h=h+Math.imul(ht,Qt)|0,k=k+Math.imul(ht,Zt)|0,b=b+Math.imul(it,te)|0,h=h+Math.imul(it,re)|0,h=h+Math.imul(ot,te)|0,k=k+Math.imul(ot,re)|0;var Ve=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,b=Math.imul(dt,Ft),h=Math.imul(dt,Wt),h=h+Math.imul(Mt,Ft)|0,k=Math.imul(Mt,Wt),b=b+Math.imul(st,Xt)|0,h=h+Math.imul(st,Gt)|0,h=h+Math.imul(yt,Xt)|0,k=k+Math.imul(yt,Gt)|0,b=b+Math.imul(pt,Qt)|0,h=h+Math.imul(pt,Zt)|0,h=h+Math.imul(V,Qt)|0,k=k+Math.imul(V,Zt)|0,b=b+Math.imul(_t,te)|0,h=h+Math.imul(_t,re)|0,h=h+Math.imul(ht,te)|0,k=k+Math.imul(ht,re)|0;var Ze=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,b=Math.imul(dt,Xt),h=Math.imul(dt,Gt),h=h+Math.imul(Mt,Xt)|0,k=Math.imul(Mt,Gt),b=b+Math.imul(st,Qt)|0,h=h+Math.imul(st,Zt)|0,h=h+Math.imul(yt,Qt)|0,k=k+Math.imul(yt,Zt)|0,b=b+Math.imul(pt,te)|0,h=h+Math.imul(pt,re)|0,h=h+Math.imul(V,te)|0,k=k+Math.imul(V,re)|0;var ar=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(ar>>>26)|0,ar&=67108863,b=Math.imul(dt,Qt),h=Math.imul(dt,Zt),h=h+Math.imul(Mt,Qt)|0,k=Math.imul(Mt,Zt),b=b+Math.imul(st,te)|0,h=h+Math.imul(st,re)|0,h=h+Math.imul(yt,te)|0,k=k+Math.imul(yt,re)|0;var br=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(br>>>26)|0,br&=67108863,b=Math.imul(dt,te),h=Math.imul(dt,re),h=h+Math.imul(Mt,te)|0,k=Math.imul(Mt,re);var cr=(w+b|0)+((h&8191)<<13)|0;return w=(k+(h>>>13)|0)+(cr>>>26)|0,cr&=67108863,S[0]=Se,S[1]=Be,S[2]=Re,S[3]=Te,S[4]=xe,S[5]=Ce,S[6]=Ue,S[7]=Ke,S[8]=Je,S[9]=ze,S[10]=Xe,S[11]=Ge,S[12]=Ye,S[13]=We,S[14]=Ve,S[15]=Ze,S[16]=ar,S[17]=br,S[18]=cr,w!==0&&(S[19]=w,v.length++),v};Math.imul||(C=x);function N(n,d,v){v.negative=d.negative^n.negative,v.length=n.length+d.length;for(var A=0,T=0,S=0;S>>26)|0,T+=w>>>26,w&=67108863}v.words[S]=b,A=w,w=T}return A!==0?v.words[S]=A:v.length--,v._strip()}function F(n,d,v){return N(n,d,v)}e.prototype.mulTo=function(n,d){var v,A=this.length+n.length;return this.length===10&&n.length===10?v=C(this,n,d):A<63?v=x(this,n,d):A<1024?v=N(this,n,d):v=F(this,n,d),v},e.prototype.mul=function(n){var d=new e(null);return d.words=new Array(this.length+n.length),this.mulTo(n,d)},e.prototype.mulf=function(n){var d=new e(null);return d.words=new Array(this.length+n.length),F(this,n,d)},e.prototype.imul=function(n){return this.clone().mulTo(n,this)},e.prototype.imuln=function(n){var d=n<0;d&&(n=-n),a(typeof n=="number"),a(n<67108864);for(var v=0,A=0;A>=26,v+=T/67108864|0,v+=S>>>26,this.words[A]=S&67108863}return v!==0&&(this.words[A]=v,this.length++),d?this.ineg():this},e.prototype.muln=function(n){return this.clone().imuln(n)},e.prototype.sqr=function(){return this.mul(this)},e.prototype.isqr=function(){return this.imul(this.clone())},e.prototype.pow=function(n){var d=B(n);if(d.length===0)return new e(1);for(var v=this,A=0;A=0);var d=n%26,v=(n-d)/26,A=67108863>>>26-d<<26-d,T;if(d!==0){var S=0;for(T=0;T>>26-d}S&&(this.words[T]=S,this.length++)}if(v!==0){for(T=this.length-1;T>=0;T--)this.words[T+v]=this.words[T];for(T=0;T=0);var A;d?A=(d-d%26)/26:A=0;var T=n%26,S=Math.min((n-T)/26,this.length),w=67108863^67108863>>>T<S)for(this.length-=S,h=0;h=0&&(k!==0||h>=A);h--){var tt=this.words[h]|0;this.words[h]=k<<26-T|tt>>>T,k=tt&w}return b&&k!==0&&(b.words[b.length++]=k),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},e.prototype.ishrn=function(n,d,v){return a(this.negative===0),this.iushrn(n,d,v)},e.prototype.shln=function(n){return this.clone().ishln(n)},e.prototype.ushln=function(n){return this.clone().iushln(n)},e.prototype.shrn=function(n){return this.clone().ishrn(n)},e.prototype.ushrn=function(n){return this.clone().iushrn(n)},e.prototype.testn=function(n){a(typeof n=="number"&&n>=0);var d=n%26,v=(n-d)/26,A=1<=0);var d=n%26,v=(n-d)/26;if(a(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(d!==0&&v++,this.length=Math.min(v,this.length),d!==0){var A=67108863^67108863>>>d<=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},e.prototype.isubn=function(n){if(a(typeof n=="number"),a(n<67108864),n<0)return this.iaddn(-n);if(this.negative!==0)return this.negative=0,this.iaddn(n),this.negative=1,this;if(this.words[0]-=n,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(b/67108864|0),this.words[T+v]=S&67108863}for(;T>26,this.words[T+v]=S&67108863;if(w===0)return this._strip();for(a(w===-1),w=0,T=0;T>26,this.words[T]=S&67108863;return this.negative=1,this._strip()},e.prototype._wordDiv=function(n,d){var v=this.length-n.length,A=this.clone(),T=n,S=T.words[T.length-1]|0,w=this._countBits(S);v=26-w,v!==0&&(T=T.ushln(v),A.iushln(v),S=T.words[T.length-1]|0);var b=A.length-T.length,h;if(d!=="mod"){h=new e(null),h.length=b+1,h.words=new Array(h.length);for(var k=0;k=0;X--){var ft=(A.words[T.length+X]|0)*67108864+(A.words[T.length+X-1]|0);for(ft=Math.min(ft/S|0,67108863),A._ishlnsubmul(T,ft,X);A.negative!==0;)ft--,A.negative=0,A._ishlnsubmul(T,1,X),A.isZero()||(A.negative^=1);h&&(h.words[X]=ft)}return h&&h._strip(),A._strip(),d!=="div"&&v!==0&&A.iushrn(v),{div:h||null,mod:A}},e.prototype.divmod=function(n,d,v){if(a(!n.isZero()),this.isZero())return{div:new e(0),mod:new e(0)};var A,T,S;return this.negative!==0&&n.negative===0?(S=this.neg().divmod(n,d),d!=="mod"&&(A=S.div.neg()),d!=="div"&&(T=S.mod.neg(),v&&T.negative!==0&&T.iadd(n)),{div:A,mod:T}):this.negative===0&&n.negative!==0?(S=this.divmod(n.neg(),d),d!=="mod"&&(A=S.div.neg()),{div:A,mod:S.mod}):this.negative&n.negative?(S=this.neg().divmod(n.neg(),d),d!=="div"&&(T=S.mod.neg(),v&&T.negative!==0&&T.isub(n)),{div:S.div,mod:T}):n.length>this.length||this.cmp(n)<0?{div:new e(0),mod:this}:n.length===1?d==="div"?{div:this.divn(n.words[0]),mod:null}:d==="mod"?{div:null,mod:new e(this.modrn(n.words[0]))}:{div:this.divn(n.words[0]),mod:new e(this.modrn(n.words[0]))}:this._wordDiv(n,d)},e.prototype.div=function(n){return this.divmod(n,"div",!1).div},e.prototype.mod=function(n){return this.divmod(n,"mod",!1).mod},e.prototype.umod=function(n){return this.divmod(n,"mod",!0).mod},e.prototype.divRound=function(n){var d=this.divmod(n);if(d.mod.isZero())return d.div;var v=d.div.negative!==0?d.mod.isub(n):d.mod,A=n.ushrn(1),T=n.andln(1),S=v.cmp(A);return S<0||T===1&&S===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},e.prototype.modrn=function(n){var d=n<0;d&&(n=-n),a(n<=67108863);for(var v=(1<<26)%n,A=0,T=this.length-1;T>=0;T--)A=(v*A+(this.words[T]|0))%n;return d?-A:A},e.prototype.modn=function(n){return this.modrn(n)},e.prototype.idivn=function(n){var d=n<0;d&&(n=-n),a(n<=67108863);for(var v=0,A=this.length-1;A>=0;A--){var T=(this.words[A]|0)+v*67108864;this.words[A]=T/n|0,v=T%n}return this._strip(),d?this.ineg():this},e.prototype.divn=function(n){return this.clone().idivn(n)},e.prototype.egcd=function(n){a(n.negative===0),a(!n.isZero());var d=this,v=n.clone();d.negative!==0?d=d.umod(n):d=d.clone();for(var A=new e(1),T=new e(0),S=new e(0),w=new e(1),b=0;d.isEven()&&v.isEven();)d.iushrn(1),v.iushrn(1),++b;for(var h=v.clone(),k=d.clone();!d.isZero();){for(var tt=0,X=1;!(d.words[0]&X)&&tt<26;++tt,X<<=1);if(tt>0)for(d.iushrn(tt);tt-- >0;)(A.isOdd()||T.isOdd())&&(A.iadd(h),T.isub(k)),A.iushrn(1),T.iushrn(1);for(var ft=0,et=1;!(v.words[0]&et)&&ft<26;++ft,et<<=1);if(ft>0)for(v.iushrn(ft);ft-- >0;)(S.isOdd()||w.isOdd())&&(S.iadd(h),w.isub(k)),S.iushrn(1),w.iushrn(1);d.cmp(v)>=0?(d.isub(v),A.isub(S),T.isub(w)):(v.isub(d),S.isub(A),w.isub(T))}return{a:S,b:w,gcd:v.iushln(b)}},e.prototype._invmp=function(n){a(n.negative===0),a(!n.isZero());var d=this,v=n.clone();d.negative!==0?d=d.umod(n):d=d.clone();for(var A=new e(1),T=new e(0),S=v.clone();d.cmpn(1)>0&&v.cmpn(1)>0;){for(var w=0,b=1;!(d.words[0]&b)&&w<26;++w,b<<=1);if(w>0)for(d.iushrn(w);w-- >0;)A.isOdd()&&A.iadd(S),A.iushrn(1);for(var h=0,k=1;!(v.words[0]&k)&&h<26;++h,k<<=1);if(h>0)for(v.iushrn(h);h-- >0;)T.isOdd()&&T.iadd(S),T.iushrn(1);d.cmp(v)>=0?(d.isub(v),A.isub(T)):(v.isub(d),T.isub(A))}var tt;return d.cmpn(1)===0?tt=A:tt=T,tt.cmpn(0)<0&&tt.iadd(n),tt},e.prototype.gcd=function(n){if(this.isZero())return n.abs();if(n.isZero())return this.abs();var d=this.clone(),v=n.clone();d.negative=0,v.negative=0;for(var A=0;d.isEven()&&v.isEven();A++)d.iushrn(1),v.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;v.isEven();)v.iushrn(1);var T=d.cmp(v);if(T<0){var S=d;d=v,v=S}else if(T===0||v.cmpn(1)===0)break;d.isub(v)}while(!0);return v.iushln(A)},e.prototype.invm=function(n){return this.egcd(n).a.umod(n)},e.prototype.isEven=function(){return(this.words[0]&1)===0},e.prototype.isOdd=function(){return(this.words[0]&1)===1},e.prototype.andln=function(n){return this.words[0]&n},e.prototype.bincn=function(n){a(typeof n=="number");var d=n%26,v=(n-d)/26,A=1<>>26,w&=67108863,this.words[S]=w}return T!==0&&(this.words[S]=T,this.length++),this},e.prototype.isZero=function(){return this.length===1&&this.words[0]===0},e.prototype.cmpn=function(n){var d=n<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var v;if(this.length>1)v=1;else{d&&(n=-n),a(n<=67108863,"Number is too big");var A=this.words[0]|0;v=A===n?0:An.length)return 1;if(this.length=0;v--){var A=this.words[v]|0,T=n.words[v]|0;if(A!==T){AT&&(d=1);break}}return d},e.prototype.gtn=function(n){return this.cmpn(n)===1},e.prototype.gt=function(n){return this.cmp(n)===1},e.prototype.gten=function(n){return this.cmpn(n)>=0},e.prototype.gte=function(n){return this.cmp(n)>=0},e.prototype.ltn=function(n){return this.cmpn(n)===-1},e.prototype.lt=function(n){return this.cmp(n)===-1},e.prototype.lten=function(n){return this.cmpn(n)<=0},e.prototype.lte=function(n){return this.cmp(n)<=0},e.prototype.eqn=function(n){return this.cmpn(n)===0},e.prototype.eq=function(n){return this.cmp(n)===0},e.red=function(n){return new O(n)},e.prototype.toRed=function(n){return a(!this.red,"Already a number in reduction context"),a(this.negative===0,"red works only with positives"),n.convertTo(this)._forceRed(n)},e.prototype.fromRed=function(){return a(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},e.prototype._forceRed=function(n){return this.red=n,this},e.prototype.forceRed=function(n){return a(!this.red,"Already a number in reduction context"),this._forceRed(n)},e.prototype.redAdd=function(n){return a(this.red,"redAdd works only with red numbers"),this.red.add(this,n)},e.prototype.redIAdd=function(n){return a(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,n)},e.prototype.redSub=function(n){return a(this.red,"redSub works only with red numbers"),this.red.sub(this,n)},e.prototype.redISub=function(n){return a(this.red,"redISub works only with red numbers"),this.red.isub(this,n)},e.prototype.redShl=function(n){return a(this.red,"redShl works only with red numbers"),this.red.shl(this,n)},e.prototype.redMul=function(n){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.mul(this,n)},e.prototype.redIMul=function(n){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.imul(this,n)},e.prototype.redSqr=function(){return a(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},e.prototype.redISqr=function(){return a(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},e.prototype.redSqrt=function(){return a(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},e.prototype.redInvm=function(){return a(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},e.prototype.redNeg=function(){return a(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},e.prototype.redPow=function(n){return a(this.red&&!n.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,n)};var I={k256:null,p224:null,p192:null,p25519:null};function U(n,d){this.name=n,this.p=new e(d,16),this.n=this.p.bitLength(),this.k=new e(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var n=new e(null);return n.words=new Array(Math.ceil(this.n/13)),n},U.prototype.ireduce=function(n){var d=n,v;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),v=d.bitLength();while(v>this.n);var A=v0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},U.prototype.split=function(n,d){n.iushrn(this.n,0,d)},U.prototype.imulK=function(n){return n.imul(this.k)};function P(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(P,U),P.prototype.split=function(n,d){for(var v=4194303,A=Math.min(n.length,9),T=0;T>>22,S=w}S>>>=22,n.words[T-10]=S,S===0&&n.length>10?n.length-=10:n.length-=9},P.prototype.imulK=function(n){n.words[n.length]=0,n.words[n.length+1]=0,n.length+=2;for(var d=0,v=0;v>>=26,n.words[v]=T,d=A}return d!==0&&(n.words[n.length++]=d),n},e._prime=function(n){if(I[n])return I[n];var d;if(n==="k256")d=new P;else if(n==="p224")d=new D;else if(n==="p192")d=new W;else if(n==="p25519")d=new q;else throw new Error("Unknown prime "+n);return I[n]=d,d};function O(n){if(typeof n=="string"){var d=e._prime(n);this.m=d.p,this.prime=d}else a(n.gtn(1),"modulus must be greater than 1"),this.m=n,this.prime=null}O.prototype._verify1=function(n){a(n.negative===0,"red works only with positives"),a(n.red,"red works only with red numbers")},O.prototype._verify2=function(n,d){a((n.negative|d.negative)===0,"red works only with positives"),a(n.red&&n.red===d.red,"red works only with red numbers")},O.prototype.imod=function(n){return this.prime?this.prime.ireduce(n)._forceRed(this):(p(n,n.umod(this.m)._forceRed(this)),n)},O.prototype.neg=function(n){return n.isZero()?n.clone():this.m.sub(n)._forceRed(this)},O.prototype.add=function(n,d){this._verify2(n,d);var v=n.add(d);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},O.prototype.iadd=function(n,d){this._verify2(n,d);var v=n.iadd(d);return v.cmp(this.m)>=0&&v.isub(this.m),v},O.prototype.sub=function(n,d){this._verify2(n,d);var v=n.sub(d);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},O.prototype.isub=function(n,d){this._verify2(n,d);var v=n.isub(d);return v.cmpn(0)<0&&v.iadd(this.m),v},O.prototype.shl=function(n,d){return this._verify1(n),this.imod(n.ushln(d))},O.prototype.imul=function(n,d){return this._verify2(n,d),this.imod(n.imul(d))},O.prototype.mul=function(n,d){return this._verify2(n,d),this.imod(n.mul(d))},O.prototype.isqr=function(n){return this.imul(n,n.clone())},O.prototype.sqr=function(n){return this.mul(n,n)},O.prototype.sqrt=function(n){if(n.isZero())return n.clone();var d=this.m.andln(3);if(a(d%2===1),d===3){var v=this.m.add(new e(1)).iushrn(2);return this.pow(n,v)}for(var A=this.m.subn(1),T=0;!A.isZero()&&A.andln(1)===0;)T++,A.iushrn(1);a(!A.isZero());var S=new e(1).toRed(this),w=S.redNeg(),b=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new e(2*h*h).toRed(this);this.pow(h,b).cmp(w)!==0;)h.redIAdd(w);for(var k=this.pow(h,A),tt=this.pow(n,A.addn(1).iushrn(1)),X=this.pow(n,A),ft=T;X.cmp(S)!==0;){for(var et=X,at=0;et.cmp(S)!==0;at++)et=et.redSqr();a(at=0;T--){for(var k=d.words[T],tt=h-1;tt>=0;tt--){var X=k>>tt&1;if(S!==A[0]&&(S=this.sqr(S)),X===0&&w===0){b=0;continue}w<<=1,w|=X,b++,!(b!==v&&(T!==0||tt!==0))&&(S=this.mul(S,A[w]),b=0,w=0)}h=26}return S},O.prototype.convertTo=function(n){var d=n.umod(this.m);return d===n?d.clone():d},O.prototype.convertFrom=function(n){var d=n.clone();return d.red=null,d},e.mont=function(n){return new L(n)};function L(n){O.call(this,n),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new e(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(L,O),L.prototype.convertTo=function(n){return this.imod(n.ushln(this.shift))},L.prototype.convertFrom=function(n){var d=this.imod(n.mul(this.rinv));return d.red=null,d},L.prototype.imul=function(n,d){if(n.isZero()||d.isZero())return n.words[0]=0,n.length=1,n;var v=n.imul(d),A=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=v.isub(A).iushrn(this.shift),S=T;return T.cmp(this.m)>=0?S=T.isub(this.m):T.cmpn(0)<0&&(S=T.iadd(this.m)),S._forceRed(this)},L.prototype.mul=function(n,d){if(n.isZero()||d.isZero())return new e(0)._forceRed(this);var v=n.mul(d),A=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=v.isub(A).iushrn(this.shift),S=T;return T.cmp(this.m)>=0?S=T.isub(this.m):T.cmpn(0)<0&&(S=T.iadd(this.m)),S._forceRed(this)},L.prototype.invm=function(n){var d=this.imod(n._invmp(this.m).mul(this.r2));return d._forceRed(this)}}(typeof i>"u"||i,t)}),Qu=gt((t,i)=>{lt();var r=Rm(),u=Fi();function a(o){var c=s(o),f=c.toRed(r.mont(o.modulus)).redPow(new r(o.publicExponent)).fromRed();return{blinder:f,unblinder:c.invm(o.modulus)}}function s(o){var c=o.modulus.byteLength(),f;do f=new r(u(c));while(f.cmp(o.modulus)>=0||!f.umod(o.prime1)||!f.umod(o.prime2));return f}function e(o,c){var f=a(c),l=c.modulus.byteLength(),p=new r(o).mul(f.blinder).umod(c.modulus),g=p.toRed(r.mont(c.prime1)),y=p.toRed(r.mont(c.prime2)),m=c.coefficient,M=c.prime1,E=c.prime2,B=g.redPow(c.exponent1).fromRed(),x=y.redPow(c.exponent2).fromRed(),C=B.isub(x).imul(m).umod(M).imul(E);return x.iadd(C).imul(f.unblinder).umod(c.modulus).toArrayLike(Ut.Buffer,"be",l)}e.getr=s,i.exports=e}),Nm=gt((t,i)=>{i.exports={name:"elliptic",version:"6.5.4",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny ",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}}),N0=gt(t=>{lt();var i=t;function r(s,e){if(Array.isArray(s))return s.slice();if(!s)return[];var o=[];if(typeof s!="string"){for(var c=0;c>8,p=f&255;l?o.push(l,p):o.push(p)}return o}i.toArray=r;function u(s){return s.length===1?"0"+s:s}i.zero2=u;function a(s){for(var e="",o=0;o{lt();var i=t,r=sr(),u=Vr(),a=N0();i.assert=u,i.toArray=a.toArray,i.zero2=a.zero2,i.toHex=a.toHex,i.encode=a.encode;function s(l,p,g){var y=new Array(Math.max(l.bitLength(),g)+1);y.fill(0);for(var m=1<(m>>1)-1?B=(m>>1)-x:B=x,M.isubn(B)):B=0,y[E]=B,M.iushrn(1)}return y}i.getNAF=s;function e(l,p){var g=[[],[]];l=l.clone(),p=p.clone();for(var y=0,m=0,M;l.cmpn(-y)>0||p.cmpn(-m)>0;){var E=l.andln(3)+y&3,B=p.andln(3)+m&3;E===3&&(E=-1),B===3&&(B=-1);var x;E&1?(M=l.andln(7)+y&7,(M===3||M===5)&&B===2?x=-E:x=E):x=0,g[0].push(x);var C;B&1?(M=p.andln(7)+m&7,(M===3||M===5)&&E===2?C=-B:C=B):C=0,g[1].push(C),2*y===x+1&&(y=1-y),2*m===C+1&&(m=1-m),l.iushrn(1),p.iushrn(1)}return g}i.getJSF=e;function o(l,p,g){var y="_"+p;l.prototype[p]=function(){return this[y]!==void 0?this[y]:this[y]=g.call(this)}}i.cachedProperty=o;function c(l){return typeof l=="string"?i.toArray(l,"hex"):l}i.parseBytes=c;function f(l){return new r(l,"hex","le")}i.intFromLE=f}),es=gt((t,i)=>{lt();var r=sr(),u=Zr(),a=u.getNAF,s=u.getJSF,e=u.assert;function o(f,l){this.type=f,this.p=new r(l.p,16),this.red=l.prime?r.red(l.prime):r.mont(this.p),this.zero=new r(0).toRed(this.red),this.one=new r(1).toRed(this.red),this.two=new r(2).toRed(this.red),this.n=l.n&&new r(l.n,16),this.g=l.g&&this.pointFromJSON(l.g,l.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 p=this.n&&this.p.div(this.n);!p||p.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}i.exports=o,o.prototype.point=function(){throw new Error("Not implemented")},o.prototype.validate=function(){throw new Error("Not implemented")},o.prototype._fixedNafMul=function(f,l){e(f.precomputed);var p=f._getDoubles(),g=a(l,1,this._bitLength),y=(1<=M;B--)E=(E<<1)+g[B];m.push(E)}for(var x=this.jpoint(null,null,null),C=this.jpoint(null,null,null),N=y;N>0;N--){for(M=0;M=0;E--){for(var B=0;E>=0&&m[E]===0;E--)B++;if(E>=0&&B++,M=M.dblp(B),E<0)break;var x=m[E];e(x!==0),f.type==="affine"?x>0?M=M.mixedAdd(y[x-1>>1]):M=M.mixedAdd(y[-x-1>>1].neg()):x>0?M=M.add(y[x-1>>1]):M=M.add(y[-x-1>>1].neg())}return f.type==="affine"?M.toP():M},o.prototype._wnafMulAdd=function(f,l,p,g,y){var m=this._wnafT1,M=this._wnafT2,E=this._wnafT3,B=0,x,C,N;for(x=0;x=1;x-=2){var I=x-1,U=x;if(m[I]!==1||m[U]!==1){E[I]=a(p[I],m[I],this._bitLength),E[U]=a(p[U],m[U],this._bitLength),B=Math.max(E[I].length,B),B=Math.max(E[U].length,B);continue}var P=[l[I],null,null,l[U]];l[I].y.cmp(l[U].y)===0?(P[1]=l[I].add(l[U]),P[2]=l[I].toJ().mixedAdd(l[U].neg())):l[I].y.cmp(l[U].y.redNeg())===0?(P[1]=l[I].toJ().mixedAdd(l[U]),P[2]=l[I].add(l[U].neg())):(P[1]=l[I].toJ().mixedAdd(l[U]),P[2]=l[I].toJ().mixedAdd(l[U].neg()));var D=[-3,-1,-5,-7,0,7,5,1,3],W=s(p[I],p[U]);for(B=Math.max(W[0].length,B),E[I]=new Array(B),E[U]=new Array(B),C=0;C=0;x--){for(var d=0;x>=0;){var v=!0;for(C=0;C=0&&d++,L=L.dblp(d),x<0)break;for(C=0;C0?N=M[C][A-1>>1]:A<0&&(N=M[C][-A-1>>1].neg()),N.type==="affine"?L=L.mixedAdd(N):L=L.add(N))}}for(x=0;x=Math.ceil((f.bitLength()+1)/l.step):!1},c.prototype._getDoubles=function(f,l){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var p=[this],g=this,y=0;y{lt();var r=Zr(),u=sr(),a=pe(),s=es(),e=r.assert;function o(l){s.call(this,"short",l),this.a=new u(l.a,16).toRed(this.red),this.b=new u(l.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(l),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}a(o,s),i.exports=o,o.prototype._getEndomorphism=function(l){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var p,g;if(l.beta)p=new u(l.beta,16).toRed(this.red);else{var y=this._getEndoRoots(this.p);p=y[0].cmp(y[1])<0?y[0]:y[1],p=p.toRed(this.red)}if(l.lambda)g=new u(l.lambda,16);else{var m=this._getEndoRoots(this.n);this.g.mul(m[0]).x.cmp(this.g.x.redMul(p))===0?g=m[0]:(g=m[1],e(this.g.mul(g).x.cmp(this.g.x.redMul(p))===0))}var M;return l.basis?M=l.basis.map(function(E){return{a:new u(E.a,16),b:new u(E.b,16)}}):M=this._getEndoBasis(g),{beta:p,lambda:g,basis:M}}},o.prototype._getEndoRoots=function(l){var p=l===this.p?this.red:u.mont(l),g=new u(2).toRed(p).redInvm(),y=g.redNeg(),m=new u(3).toRed(p).redNeg().redSqrt().redMul(g),M=y.redAdd(m).fromRed(),E=y.redSub(m).fromRed();return[M,E]},o.prototype._getEndoBasis=function(l){for(var p=this.n.ushrn(Math.floor(this.n.bitLength()/2)),g=l,y=this.n.clone(),m=new u(1),M=new u(0),E=new u(0),B=new u(1),x,C,N,F,I,U,P,D=0,W,q;g.cmpn(0)!==0;){var O=y.div(g);W=y.sub(O.mul(g)),q=E.sub(O.mul(m));var L=B.sub(O.mul(M));if(!N&&W.cmp(p)<0)x=P.neg(),C=m,N=W.neg(),F=q;else if(N&&++D===2)break;P=W,y=g,g=W,E=m,m=q,B=M,M=L}I=W.neg(),U=q;var n=N.sqr().add(F.sqr()),d=I.sqr().add(U.sqr());return d.cmp(n)>=0&&(I=x,U=C),N.negative&&(N=N.neg(),F=F.neg()),I.negative&&(I=I.neg(),U=U.neg()),[{a:N,b:F},{a:I,b:U}]},o.prototype._endoSplit=function(l){var p=this.endo.basis,g=p[0],y=p[1],m=y.b.mul(l).divRound(this.n),M=g.b.neg().mul(l).divRound(this.n),E=m.mul(g.a),B=M.mul(y.a),x=m.mul(g.b),C=M.mul(y.b),N=l.sub(E).sub(B),F=x.add(C).neg();return{k1:N,k2:F}},o.prototype.pointFromX=function(l,p){l=new u(l,16),l.red||(l=l.toRed(this.red));var g=l.redSqr().redMul(l).redIAdd(l.redMul(this.a)).redIAdd(this.b),y=g.redSqrt();if(y.redSqr().redSub(g).cmp(this.zero)!==0)throw new Error("invalid point");var m=y.fromRed().isOdd();return(p&&!m||!p&&m)&&(y=y.redNeg()),this.point(l,y)},o.prototype.validate=function(l){if(l.inf)return!0;var p=l.x,g=l.y,y=this.a.redMul(p),m=p.redSqr().redMul(p).redIAdd(y).redIAdd(this.b);return g.redSqr().redISub(m).cmpn(0)===0},o.prototype._endoWnafMulAdd=function(l,p,g){for(var y=this._endoWnafT1,m=this._endoWnafT2,M=0;M":""},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(l){if(this.inf)return l;if(l.inf)return this;if(this.eq(l))return this.dbl();if(this.neg().eq(l))return this.curve.point(null,null);if(this.x.cmp(l.x)===0)return this.curve.point(null,null);var p=this.y.redSub(l.y);p.cmpn(0)!==0&&(p=p.redMul(this.x.redSub(l.x).redInvm()));var g=p.redSqr().redISub(this.x).redISub(l.x),y=p.redMul(this.x.redSub(g)).redISub(this.y);return this.curve.point(g,y)},c.prototype.dbl=function(){if(this.inf)return this;var l=this.y.redAdd(this.y);if(l.cmpn(0)===0)return this.curve.point(null,null);var p=this.curve.a,g=this.x.redSqr(),y=l.redInvm(),m=g.redAdd(g).redIAdd(g).redIAdd(p).redMul(y),M=m.redSqr().redISub(this.x.redAdd(this.x)),E=m.redMul(this.x.redSub(M)).redISub(this.y);return this.curve.point(M,E)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(l){return l=new u(l,16),this.isInfinity()?this:this._hasDoubles(l)?this.curve._fixedNafMul(this,l):this.curve.endo?this.curve._endoWnafMulAdd([this],[l]):this.curve._wnafMul(this,l)},c.prototype.mulAdd=function(l,p,g){var y=[this,p],m=[l,g];return this.curve.endo?this.curve._endoWnafMulAdd(y,m):this.curve._wnafMulAdd(1,y,m,2)},c.prototype.jmulAdd=function(l,p,g){var y=[this,p],m=[l,g];return this.curve.endo?this.curve._endoWnafMulAdd(y,m,!0):this.curve._wnafMulAdd(1,y,m,2,!0)},c.prototype.eq=function(l){return this===l||this.inf===l.inf&&(this.inf||this.x.cmp(l.x)===0&&this.y.cmp(l.y)===0)},c.prototype.neg=function(l){if(this.inf)return this;var p=this.curve.point(this.x,this.y.redNeg());if(l&&this.precomputed){var g=this.precomputed,y=function(m){return m.neg()};p.precomputed={naf:g.naf&&{wnd:g.naf.wnd,points:g.naf.points.map(y)},doubles:g.doubles&&{step:g.doubles.step,points:g.doubles.points.map(y)}}}return p},c.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var l=this.curve.jpoint(this.x,this.y,this.curve.one);return l};function f(l,p,g,y){s.BasePoint.call(this,l,"jacobian"),p===null&&g===null&&y===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new u(0)):(this.x=new u(p,16),this.y=new u(g,16),this.z=new u(y,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}a(f,s.BasePoint),o.prototype.jpoint=function(l,p,g){return new f(this,l,p,g)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var l=this.z.redInvm(),p=l.redSqr(),g=this.x.redMul(p),y=this.y.redMul(p).redMul(l);return this.curve.point(g,y)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(l){if(this.isInfinity())return l;if(l.isInfinity())return this;var p=l.z.redSqr(),g=this.z.redSqr(),y=this.x.redMul(p),m=l.x.redMul(g),M=this.y.redMul(p.redMul(l.z)),E=l.y.redMul(g.redMul(this.z)),B=y.redSub(m),x=M.redSub(E);if(B.cmpn(0)===0)return x.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var C=B.redSqr(),N=C.redMul(B),F=y.redMul(C),I=x.redSqr().redIAdd(N).redISub(F).redISub(F),U=x.redMul(F.redISub(I)).redISub(M.redMul(N)),P=this.z.redMul(l.z).redMul(B);return this.curve.jpoint(I,U,P)},f.prototype.mixedAdd=function(l){if(this.isInfinity())return l.toJ();if(l.isInfinity())return this;var p=this.z.redSqr(),g=this.x,y=l.x.redMul(p),m=this.y,M=l.y.redMul(p).redMul(this.z),E=g.redSub(y),B=m.redSub(M);if(E.cmpn(0)===0)return B.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var x=E.redSqr(),C=x.redMul(E),N=g.redMul(x),F=B.redSqr().redIAdd(C).redISub(N).redISub(N),I=B.redMul(N.redISub(F)).redISub(m.redMul(C)),U=this.z.redMul(E);return this.curve.jpoint(F,I,U)},f.prototype.dblp=function(l){if(l===0)return this;if(this.isInfinity())return this;if(!l)return this.dbl();var p;if(this.curve.zeroA||this.curve.threeA){var g=this;for(p=0;p=0)return!1;if(g.redIAdd(m),this.x.cmp(g)===0)return!0}},f.prototype.inspect=function(){return this.isInfinity()?"":""},f.prototype.isInfinity=function(){return this.z.cmpn(0)===0}}),Dm=gt((t,i)=>{lt();var r=sr(),u=pe(),a=es(),s=Zr();function e(c){a.call(this,"mont",c),this.a=new r(c.a,16).toRed(this.red),this.b=new r(c.b,16).toRed(this.red),this.i4=new r(4).toRed(this.red).redInvm(),this.two=new r(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}u(e,a),i.exports=e,e.prototype.validate=function(c){var f=c.normalize().x,l=f.redSqr(),p=l.redMul(f).redAdd(l.redMul(this.a)).redAdd(f),g=p.redSqrt();return g.redSqr().cmp(p)===0};function o(c,f,l){a.BasePoint.call(this,c,"projective"),f===null&&l===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new r(f,16),this.z=new r(l,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}u(o,a.BasePoint),e.prototype.decodePoint=function(c,f){return this.point(s.toArray(c,f),1)},e.prototype.point=function(c,f){return new o(this,c,f)},e.prototype.pointFromJSON=function(c){return o.fromJSON(this,c)},o.prototype.precompute=function(){},o.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},o.fromJSON=function(c,f){return new o(c,f[0],f[1]||c.one)},o.prototype.inspect=function(){return this.isInfinity()?"":""},o.prototype.isInfinity=function(){return this.z.cmpn(0)===0},o.prototype.dbl=function(){var c=this.x.redAdd(this.z),f=c.redSqr(),l=this.x.redSub(this.z),p=l.redSqr(),g=f.redSub(p),y=f.redMul(p),m=g.redMul(p.redAdd(this.curve.a24.redMul(g)));return this.curve.point(y,m)},o.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},o.prototype.diffAdd=function(c,f){var l=this.x.redAdd(this.z),p=this.x.redSub(this.z),g=c.x.redAdd(c.z),y=c.x.redSub(c.z),m=y.redMul(l),M=g.redMul(p),E=f.z.redMul(m.redAdd(M).redSqr()),B=f.x.redMul(m.redISub(M).redSqr());return this.curve.point(E,B)},o.prototype.mul=function(c){for(var f=c.clone(),l=this,p=this.curve.point(null,null),g=this,y=[];f.cmpn(0)!==0;f.iushrn(1))y.push(f.andln(1));for(var m=y.length-1;m>=0;m--)y[m]===0?(l=l.diffAdd(p,g),p=p.dbl()):(p=l.diffAdd(p,g),l=l.dbl());return p},o.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},o.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},o.prototype.eq=function(c){return this.getX().cmp(c.getX())===0},o.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},o.prototype.getX=function(){return this.normalize(),this.x.fromRed()}}),jm=gt((t,i)=>{lt();var r=Zr(),u=sr(),a=pe(),s=es(),e=r.assert;function o(f){this.twisted=(f.a|0)!==1,this.mOneA=this.twisted&&(f.a|0)===-1,this.extended=this.mOneA,s.call(this,"edwards",f),this.a=new u(f.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new u(f.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new u(f.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),e(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(f.c|0)===1}a(o,s),i.exports=o,o.prototype._mulA=function(f){return this.mOneA?f.redNeg():this.a.redMul(f)},o.prototype._mulC=function(f){return this.oneC?f:this.c.redMul(f)},o.prototype.jpoint=function(f,l,p,g){return this.point(f,l,p,g)},o.prototype.pointFromX=function(f,l){f=new u(f,16),f.red||(f=f.toRed(this.red));var p=f.redSqr(),g=this.c2.redSub(this.a.redMul(p)),y=this.one.redSub(this.c2.redMul(this.d).redMul(p)),m=g.redMul(y.redInvm()),M=m.redSqrt();if(M.redSqr().redSub(m).cmp(this.zero)!==0)throw new Error("invalid point");var E=M.fromRed().isOdd();return(l&&!E||!l&&E)&&(M=M.redNeg()),this.point(f,M)},o.prototype.pointFromY=function(f,l){f=new u(f,16),f.red||(f=f.toRed(this.red));var p=f.redSqr(),g=p.redSub(this.c2),y=p.redMul(this.d).redMul(this.c2).redSub(this.a),m=g.redMul(y.redInvm());if(m.cmp(this.zero)===0){if(l)throw new Error("invalid point");return this.point(this.zero,f)}var M=m.redSqrt();if(M.redSqr().redSub(m).cmp(this.zero)!==0)throw new Error("invalid point");return M.fromRed().isOdd()!==l&&(M=M.redNeg()),this.point(M,f)},o.prototype.validate=function(f){if(f.isInfinity())return!0;f.normalize();var l=f.x.redSqr(),p=f.y.redSqr(),g=l.redMul(this.a).redAdd(p),y=this.c2.redMul(this.one.redAdd(this.d.redMul(l).redMul(p)));return g.cmp(y)===0};function c(f,l,p,g,y){s.BasePoint.call(this,f,"projective"),l===null&&p===null&&g===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 u(l,16),this.y=new u(p,16),this.z=g?new u(g,16):this.curve.one,this.t=y&&new u(y,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()))))}a(c,s.BasePoint),o.prototype.pointFromJSON=function(f){return c.fromJSON(this,f)},o.prototype.point=function(f,l,p,g){return new c(this,f,l,p,g)},c.fromJSON=function(f,l){return new c(f,l[0],l[1],l[2])},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},c.prototype._extDbl=function(){var f=this.x.redSqr(),l=this.y.redSqr(),p=this.z.redSqr();p=p.redIAdd(p);var g=this.curve._mulA(f),y=this.x.redAdd(this.y).redSqr().redISub(f).redISub(l),m=g.redAdd(l),M=m.redSub(p),E=g.redSub(l),B=y.redMul(M),x=m.redMul(E),C=y.redMul(E),N=M.redMul(m);return this.curve.point(B,x,N,C)},c.prototype._projDbl=function(){var f=this.x.redAdd(this.y).redSqr(),l=this.x.redSqr(),p=this.y.redSqr(),g,y,m,M,E,B;if(this.curve.twisted){M=this.curve._mulA(l);var x=M.redAdd(p);this.zOne?(g=f.redSub(l).redSub(p).redMul(x.redSub(this.curve.two)),y=x.redMul(M.redSub(p)),m=x.redSqr().redSub(x).redSub(x)):(E=this.z.redSqr(),B=x.redSub(E).redISub(E),g=f.redSub(l).redISub(p).redMul(B),y=x.redMul(M.redSub(p)),m=x.redMul(B))}else M=l.redAdd(p),E=this.curve._mulC(this.z).redSqr(),B=M.redSub(E).redSub(E),g=this.curve._mulC(f.redISub(M)).redMul(B),y=this.curve._mulC(M).redMul(l.redISub(p)),m=M.redMul(B);return this.curve.point(g,y,m)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(f){var l=this.y.redSub(this.x).redMul(f.y.redSub(f.x)),p=this.y.redAdd(this.x).redMul(f.y.redAdd(f.x)),g=this.t.redMul(this.curve.dd).redMul(f.t),y=this.z.redMul(f.z.redAdd(f.z)),m=p.redSub(l),M=y.redSub(g),E=y.redAdd(g),B=p.redAdd(l),x=m.redMul(M),C=E.redMul(B),N=m.redMul(B),F=M.redMul(E);return this.curve.point(x,C,F,N)},c.prototype._projAdd=function(f){var l=this.z.redMul(f.z),p=l.redSqr(),g=this.x.redMul(f.x),y=this.y.redMul(f.y),m=this.curve.d.redMul(g).redMul(y),M=p.redSub(m),E=p.redAdd(m),B=this.x.redAdd(this.y).redMul(f.x.redAdd(f.y)).redISub(g).redISub(y),x=l.redMul(M).redMul(B),C,N;return this.curve.twisted?(C=l.redMul(E).redMul(y.redSub(this.curve._mulA(g))),N=M.redMul(E)):(C=l.redMul(E).redMul(y.redSub(g)),N=this.curve._mulC(M).redMul(E)),this.curve.point(x,C,N)},c.prototype.add=function(f){return this.isInfinity()?f:f.isInfinity()?this:this.curve.extended?this._extAdd(f):this._projAdd(f)},c.prototype.mul=function(f){return this._hasDoubles(f)?this.curve._fixedNafMul(this,f):this.curve._wnafMul(this,f)},c.prototype.mulAdd=function(f,l,p){return this.curve._wnafMulAdd(1,[this,l],[f,p],2,!1)},c.prototype.jmulAdd=function(f,l,p){return this.curve._wnafMulAdd(1,[this,l],[f,p],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var f=this.z.redInvm();return this.x=this.x.redMul(f),this.y=this.y.redMul(f),this.t&&(this.t=this.t.redMul(f)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(f){return this===f||this.getX().cmp(f.getX())===0&&this.getY().cmp(f.getY())===0},c.prototype.eqXToP=function(f){var l=f.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(l)===0)return!0;for(var p=f.clone(),g=this.curve.redN.redMul(this.z);;){if(p.iadd(this.curve.n),p.cmp(this.curve.p)>=0)return!1;if(l.redIAdd(g),this.x.cmp(l)===0)return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add}),L0=gt(t=>{lt();var i=t;i.base=es(),i.short=Lm(),i.mont=Dm(),i.edwards=jm()}),An=gt(t=>{lt();var i=Vr(),r=pe();t.inherits=r;function u(L,n){return(L.charCodeAt(n)&64512)!==55296||n<0||n+1>=L.length?!1:(L.charCodeAt(n+1)&64512)===56320}function a(L,n){if(Array.isArray(L))return L.slice();if(!L)return[];var d=[];if(typeof L=="string")if(n){if(n==="hex")for(L=L.replace(/[^a-z0-9]+/ig,""),L.length%2!==0&&(L="0"+L),A=0;A>6|192,d[v++]=T&63|128):u(L,A)?(T=65536+((T&1023)<<10)+(L.charCodeAt(++A)&1023),d[v++]=T>>18|240,d[v++]=T>>12&63|128,d[v++]=T>>6&63|128,d[v++]=T&63|128):(d[v++]=T>>12|224,d[v++]=T>>6&63|128,d[v++]=T&63|128)}else for(A=0;A>>24|L>>>8&65280|L<<8&16711680|(L&255)<<24;return n>>>0}t.htonl=e;function o(L,n){for(var d="",v=0;v>>0}return T}t.join32=l;function p(L,n){for(var d=new Array(L.length*4),v=0,A=0;v>>24,d[A+1]=T>>>16&255,d[A+2]=T>>>8&255,d[A+3]=T&255):(d[A+3]=T>>>24,d[A+2]=T>>>16&255,d[A+1]=T>>>8&255,d[A]=T&255)}return d}t.split32=p;function g(L,n){return L>>>n|L<<32-n}t.rotr32=g;function y(L,n){return L<>>32-n}t.rotl32=y;function m(L,n){return L+n>>>0}t.sum32=m;function M(L,n,d){return L+n+d>>>0}t.sum32_3=M;function E(L,n,d,v){return L+n+d+v>>>0}t.sum32_4=E;function B(L,n,d,v,A){return L+n+d+v+A>>>0}t.sum32_5=B;function x(L,n,d,v){var A=L[n],T=L[n+1],S=v+T>>>0,w=(S>>0,L[n+1]=S}t.sum64=x;function C(L,n,d,v){var A=n+v>>>0,T=(A>>0}t.sum64_hi=C;function N(L,n,d,v){var A=n+v;return A>>>0}t.sum64_lo=N;function F(L,n,d,v,A,T,S,w){var b=0,h=n;h=h+v>>>0,b+=h>>0,b+=h>>0,b+=h>>0}t.sum64_4_hi=F;function I(L,n,d,v,A,T,S,w){var b=n+v+T+w;return b>>>0}t.sum64_4_lo=I;function U(L,n,d,v,A,T,S,w,b,h){var k=0,tt=n;tt=tt+v>>>0,k+=tt>>0,k+=tt>>0,k+=tt>>0,k+=tt>>0}t.sum64_5_hi=U;function P(L,n,d,v,A,T,S,w,b,h){var k=n+v+T+w+h;return k>>>0}t.sum64_5_lo=P;function D(L,n,d){var v=n<<32-d|L>>>d;return v>>>0}t.rotr64_hi=D;function W(L,n,d){var v=L<<32-d|n>>>d;return v>>>0}t.rotr64_lo=W;function q(L,n,d){return L>>>d}t.shr64_hi=q;function O(L,n,d){var v=L<<32-d|n>>>d;return v>>>0}t.shr64_lo=O}),Aa=gt(t=>{lt();var i=An(),r=Vr();function u(){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}t.BlockHash=u,u.prototype.update=function(a,s){if(a=i.toArray(a,s),this.pending?this.pending=this.pending.concat(a):this.pending=a,this.pendingTotal+=a.length,this.pending.length>=this._delta8){a=this.pending;var e=a.length%this._delta8;this.pending=a.slice(a.length-e,a.length),this.pending.length===0&&(this.pending=null),a=i.join32(a,0,a.length-e,this.endian);for(var o=0;o>>24&255,o[c++]=a>>>16&255,o[c++]=a>>>8&255,o[c++]=a&255}else for(o[c++]=a&255,o[c++]=a>>>8&255,o[c++]=a>>>16&255,o[c++]=a>>>24&255,o[c++]=0,o[c++]=0,o[c++]=0,o[c++]=0,f=8;f{lt();var i=An(),r=i.rotr32;function u(p,g,y,m){if(p===0)return a(g,y,m);if(p===1||p===3)return e(g,y,m);if(p===2)return s(g,y,m)}t.ft_1=u;function a(p,g,y){return p&g^~p&y}t.ch32=a;function s(p,g,y){return p&g^p&y^g&y}t.maj32=s;function e(p,g,y){return p^g^y}t.p32=e;function o(p){return r(p,2)^r(p,13)^r(p,22)}t.s0_256=o;function c(p){return r(p,6)^r(p,11)^r(p,25)}t.s1_256=c;function f(p){return r(p,7)^r(p,18)^p>>>3}t.g0_256=f;function l(p){return r(p,17)^r(p,19)^p>>>10}t.g1_256=l}),Um=gt((t,i)=>{lt();var r=An(),u=Aa(),a=D0(),s=r.rotl32,e=r.sum32,o=r.sum32_5,c=a.ft_1,f=u.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function p(){if(!(this instanceof p))return new p;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}r.inherits(p,f),i.exports=p,p.blockSize=512,p.outSize=160,p.hmacStrength=80,p.padLength=64,p.prototype._update=function(g,y){for(var m=this.W,M=0;M<16;M++)m[M]=g[y+M];for(;M{lt();var r=An(),u=Aa(),a=D0(),s=Vr(),e=r.sum32,o=r.sum32_4,c=r.sum32_5,f=a.ch32,l=a.maj32,p=a.s0_256,g=a.s1_256,y=a.g0_256,m=a.g1_256,M=u.BlockHash,E=[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 B(){if(!(this instanceof B))return new B;M.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=E,this.W=new Array(64)}r.inherits(B,M),i.exports=B,B.blockSize=512,B.outSize=256,B.hmacStrength=192,B.padLength=64,B.prototype._update=function(x,C){for(var N=this.W,F=0;F<16;F++)N[F]=x[C+F];for(;F{lt();var r=An(),u=j0();function a(){if(!(this instanceof a))return new a;u.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}r.inherits(a,u),i.exports=a,a.blockSize=512,a.outSize=224,a.hmacStrength=192,a.padLength=64,a.prototype._digest=function(s){return s==="hex"?r.toHex32(this.h.slice(0,7),"big"):r.split32(this.h.slice(0,7),"big")}}),U0=gt((t,i)=>{lt();var r=An(),u=Aa(),a=Vr(),s=r.rotr64_hi,e=r.rotr64_lo,o=r.shr64_hi,c=r.shr64_lo,f=r.sum64,l=r.sum64_hi,p=r.sum64_lo,g=r.sum64_4_hi,y=r.sum64_4_lo,m=r.sum64_5_hi,M=r.sum64_5_lo,E=u.BlockHash,B=[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 x(){if(!(this instanceof x))return new x;E.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=B,this.W=new Array(160)}r.inherits(x,E),i.exports=x,x.blockSize=1024,x.outSize=512,x.hmacStrength=192,x.padLength=128,x.prototype._prepareBlock=function(d,v){for(var A=this.W,T=0;T<32;T++)A[T]=d[v+T];for(;T{lt();var r=An(),u=U0();function a(){if(!(this instanceof a))return new a;u.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}r.inherits(a,u),i.exports=a,a.blockSize=1024,a.outSize=384,a.hmacStrength=192,a.padLength=128,a.prototype._digest=function(s){return s==="hex"?r.toHex32(this.h.slice(0,12),"big"):r.split32(this.h.slice(0,12),"big")}}),zm=gt(t=>{lt(),t.sha1=Um(),t.sha224=Fm(),t.sha256=j0(),t.sha384=Km(),t.sha512=U0()}),Wm=gt(t=>{lt();var i=An(),r=Aa(),u=i.rotl32,a=i.sum32,s=i.sum32_3,e=i.sum32_4,o=r.BlockHash;function c(){if(!(this instanceof c))return new c;o.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}i.inherits(c,o),t.ripemd160=c,c.blockSize=512,c.outSize=160,c.hmacStrength=192,c.padLength=64,c.prototype._update=function(E,B){for(var x=this.h[0],C=this.h[1],N=this.h[2],F=this.h[3],I=this.h[4],U=x,P=C,D=N,W=F,q=I,O=0;O<80;O++){var L=a(u(e(x,f(O,C,N,F),E[g[O]+B],l(O)),m[O]),I);x=I,I=F,F=u(N,10),N=C,C=L,L=a(u(e(U,f(79-O,P,D,W),E[y[O]+B],p(O)),M[O]),q),U=q,q=W,W=u(D,10),D=P,P=L}L=s(this.h[1],N,W),this.h[1]=s(this.h[2],F,q),this.h[2]=s(this.h[3],I,U),this.h[3]=s(this.h[4],x,P),this.h[4]=s(this.h[0],C,D),this.h[0]=L},c.prototype._digest=function(E){return E==="hex"?i.toHex32(this.h,"little"):i.split32(this.h,"little")};function f(E,B,x,C){return E<=15?B^x^C:E<=31?B&x|~B&C:E<=47?(B|~x)^C:E<=63?B&C|x&~C:B^(x|~C)}function l(E){return E<=15?0:E<=31?1518500249:E<=47?1859775393:E<=63?2400959708:2840853838}function p(E){return E<=15?1352829926:E<=31?1548603684:E<=47?1836072691:E<=63?2053994217:0}var g=[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],y=[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],m=[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],M=[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]}),qm=gt((t,i)=>{lt();var r=An(),u=Vr();function a(s,e,o){if(!(this instanceof a))return new a(s,e,o);this.Hash=s,this.blockSize=s.blockSize/8,this.outSize=s.outSize/8,this.inner=null,this.outer=null,this._init(r.toArray(e,o))}i.exports=a,a.prototype._init=function(s){s.length>this.blockSize&&(s=new this.Hash().update(s).digest()),u(s.length<=this.blockSize);for(var e=s.length;e{lt();var i=t;i.utils=An(),i.common=Aa(),i.sha=zm(),i.ripemd=Wm(),i.hmac=qm(),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160}),$m=gt((t,i)=>{lt(),i.exports={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"]]}}}),th=gt(t=>{lt();var i=t,r=Ta(),u=L0(),a=Zr(),s=a.assert;function e(f){f.type==="short"?this.curve=new u.short(f):f.type==="edwards"?this.curve=new u.edwards(f):this.curve=new u.mont(f),this.g=this.curve.g,this.n=this.curve.n,this.hash=f.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}i.PresetCurve=e;function o(f,l){Object.defineProperty(i,f,{configurable:!0,enumerable:!0,get:function(){var p=new e(l);return Object.defineProperty(i,f,{configurable:!0,enumerable:!0,value:p}),p}})}o("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"]}),o("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"]}),o("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"]}),o("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"]}),o("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"]}),o("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"]}),o("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=$m()}catch{c=void 0}o("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]})}),Hm=gt((t,i)=>{lt();var r=Ta(),u=N0(),a=Vr();function s(e){if(!(this instanceof s))return new s(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 o=u.toArray(e.entropy,e.entropyEnc||"hex"),c=u.toArray(e.nonce,e.nonceEnc||"hex"),f=u.toArray(e.pers,e.persEnc||"hex");a(o.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(o,c,f)}i.exports=s,s.prototype._init=function(e,o,c){var f=e.concat(o).concat(c);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var l=0;l=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(c||[])),this._reseed=1},s.prototype.generate=function(e,o,c,f){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof o!="string"&&(f=c,c=o,o=null),c&&(c=u.toArray(c,f||"hex"),this._update(c));for(var l=[];l.length{lt();var r=sr(),u=Zr(),a=u.assert;function s(e,o){this.ec=e,this.priv=null,this.pub=null,o.priv&&this._importPrivate(o.priv,o.privEnc),o.pub&&this._importPublic(o.pub,o.pubEnc)}i.exports=s,s.fromPublic=function(e,o,c){return o instanceof s?o:new s(e,{pub:o,pubEnc:c})},s.fromPrivate=function(e,o,c){return o instanceof s?o:new s(e,{priv:o,privEnc:c})},s.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},s.prototype.getPublic=function(e,o){return typeof e=="string"&&(o=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),o?this.pub.encode(o,e):this.pub},s.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},s.prototype._importPrivate=function(e,o){this.priv=new r(e,o||16),this.priv=this.priv.umod(this.ec.curve.n)},s.prototype._importPublic=function(e,o){if(e.x||e.y){this.ec.curve.type==="mont"?a(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&a(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,o)},s.prototype.derive=function(e){return e.validate()||a(e.validate(),"public point not validated"),e.mul(this.priv).getX()},s.prototype.sign=function(e,o,c){return this.ec.sign(e,this,o,c)},s.prototype.verify=function(e,o){return this.ec.verify(e,o,this)},s.prototype.inspect=function(){return""}}),Vm=gt((t,i)=>{lt();var r=sr(),u=Zr(),a=u.assert;function s(l,p){if(l instanceof s)return l;this._importDER(l,p)||(a(l.r&&l.s,"Signature without r or s"),this.r=new r(l.r,16),this.s=new r(l.s,16),l.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=l.recoveryParam)}i.exports=s;function e(){this.place=0}function o(l,p){var g=l[p.place++];if(!(g&128))return g;var y=g&15;if(y===0||y>4)return!1;for(var m=0,M=0,E=p.place;M>>=0;return m<=127?!1:(p.place=E,m)}function c(l){for(var p=0,g=l.length-1;!l[p]&&!(l[p+1]&128)&&p>>3);for(l.push(g|128);--g;)l.push(p>>>(g<<3)&255);l.push(p)}s.prototype.toDER=function(l){var p=this.r.toArray(),g=this.s.toArray();for(p[0]&128&&(p=[0].concat(p)),g[0]&128&&(g=[0].concat(g)),p=c(p),g=c(g);!g[0]&&!(g[1]&128);)g=g.slice(1);var y=[2];f(y,p.length),y=y.concat(p),y.push(2),f(y,g.length);var m=y.concat(g),M=[48];return f(M,m.length),M=M.concat(m),u.encode(M,l)}}),Zm=gt((t,i)=>{lt();var r=sr(),u=Hm(),a=Zr(),s=th(),e=Yu(),o=a.assert,c=Gm(),f=Vm();function l(p){if(!(this instanceof l))return new l(p);typeof p=="string"&&(o(Object.prototype.hasOwnProperty.call(s,p),"Unknown curve "+p),p=s[p]),p instanceof s.PresetCurve&&(p={curve:p}),this.curve=p.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=p.curve.g,this.g.precompute(p.curve.n.bitLength()+1),this.hash=p.hash||p.curve.hash}i.exports=l,l.prototype.keyPair=function(p){return new c(this,p)},l.prototype.keyFromPrivate=function(p,g){return c.fromPrivate(this,p,g)},l.prototype.keyFromPublic=function(p,g){return c.fromPublic(this,p,g)},l.prototype.genKeyPair=function(p){p||(p={});for(var g=new u({hash:this.hash,pers:p.pers,persEnc:p.persEnc||"utf8",entropy:p.entropy||e(this.hash.hmacStrength),entropyEnc:p.entropy&&p.entropyEnc||"utf8",nonce:this.n.toArray()}),y=this.n.byteLength(),m=this.n.sub(new r(2));;){var M=new r(g.generate(y));if(!(M.cmp(m)>0))return M.iaddn(1),this.keyFromPrivate(M)}},l.prototype._truncateToN=function(p,g){var y=p.byteLength()*8-this.n.bitLength();return y>0&&(p=p.ushrn(y)),!g&&p.cmp(this.n)>=0?p.sub(this.n):p},l.prototype.sign=function(p,g,y,m){typeof y=="object"&&(m=y,y=null),m||(m={}),g=this.keyFromPrivate(g,y),p=this._truncateToN(new r(p,16));for(var M=this.n.byteLength(),E=g.getPrivate().toArray("be",M),B=p.toArray("be",M),x=new u({hash:this.hash,entropy:E,nonce:B,pers:m.pers,persEnc:m.persEnc||"utf8"}),C=this.n.sub(new r(1)),N=0;;N++){var F=m.k?m.k(N):new r(x.generate(this.n.byteLength()));if(F=this._truncateToN(F,!0),!(F.cmpn(1)<=0||F.cmp(C)>=0)){var I=this.g.mul(F);if(!I.isInfinity()){var U=I.getX(),P=U.umod(this.n);if(P.cmpn(0)!==0){var D=F.invm(this.n).mul(P.mul(g.getPrivate()).iadd(p));if(D=D.umod(this.n),D.cmpn(0)!==0){var W=(I.getY().isOdd()?1:0)|(U.cmp(P)!==0?2:0);return m.canonical&&D.cmp(this.nh)>0&&(D=this.n.sub(D),W^=1),new f({r:P,s:D,recoveryParam:W})}}}}}},l.prototype.verify=function(p,g,y,m){p=this._truncateToN(new r(p,16)),y=this.keyFromPublic(y,m),g=new f(g,"hex");var M=g.r,E=g.s;if(M.cmpn(1)<0||M.cmp(this.n)>=0||E.cmpn(1)<0||E.cmp(this.n)>=0)return!1;var B=E.invm(this.n),x=B.mul(p).umod(this.n),C=B.mul(M).umod(this.n),N;return this.curve._maxwellTrick?(N=this.g.jmulAdd(x,y.getPublic(),C),N.isInfinity()?!1:N.eqXToP(M)):(N=this.g.mulAdd(x,y.getPublic(),C),N.isInfinity()?!1:N.getX().umod(this.n).cmp(M)===0)},l.prototype.recoverPubKey=function(p,g,y,m){o((3&y)===y,"The recovery param is more than two bits"),g=new f(g,m);var M=this.n,E=new r(p),B=g.r,x=g.s,C=y&1,N=y>>1;if(B.cmp(this.curve.p.umod(this.curve.n))>=0&&N)throw new Error("Unable to find sencond key candinate");N?B=this.curve.pointFromX(B.add(this.curve.n),C):B=this.curve.pointFromX(B,C);var F=g.r.invm(M),I=M.sub(E).mul(F).umod(M),U=x.mul(F).umod(M);return this.g.mulAdd(I,B,U)},l.prototype.getKeyRecoveryParam=function(p,g,y,m){if(g=new f(g,m),g.recoveryParam!==null)return g.recoveryParam;for(var M=0;M<4;M++){var E;try{E=this.recoverPubKey(p,g,M)}catch{continue}if(E.eq(y))return M}throw new Error("Unable to find valid recovery factor")}}),Jm=gt((t,i)=>{lt();var r=Zr(),u=r.assert,a=r.parseBytes,s=r.cachedProperty;function e(o,c){this.eddsa=o,this._secret=a(c.secret),o.isPoint(c.pub)?this._pub=c.pub:this._pubBytes=a(c.pub)}e.fromPublic=function(o,c){return c instanceof e?c:new e(o,{pub:c})},e.fromSecret=function(o,c){return c instanceof e?c:new e(o,{secret:c})},e.prototype.secret=function(){return this._secret},s(e,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),s(e,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),s(e,"privBytes",function(){var o=this.eddsa,c=this.hash(),f=o.encodingLength-1,l=c.slice(0,o.encodingLength);return l[0]&=248,l[f]&=127,l[f]|=64,l}),s(e,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),s(e,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),s(e,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),e.prototype.sign=function(o){return u(this._secret,"KeyPair can only verify"),this.eddsa.sign(o,this)},e.prototype.verify=function(o,c){return this.eddsa.verify(o,c,this)},e.prototype.getSecret=function(o){return u(this._secret,"KeyPair is public only"),r.encode(this.secret(),o)},e.prototype.getPublic=function(o){return r.encode(this.pubBytes(),o)},i.exports=e}),Xm=gt((t,i)=>{lt();var r=sr(),u=Zr(),a=u.assert,s=u.cachedProperty,e=u.parseBytes;function o(c,f){this.eddsa=c,typeof f!="object"&&(f=e(f)),Array.isArray(f)&&(f={R:f.slice(0,c.encodingLength),S:f.slice(c.encodingLength)}),a(f.R&&f.S,"Signature without R or S"),c.isPoint(f.R)&&(this._R=f.R),f.S instanceof r&&(this._S=f.S),this._Rencoded=Array.isArray(f.R)?f.R:f.Rencoded,this._Sencoded=Array.isArray(f.S)?f.S:f.Sencoded}s(o,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),s(o,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),s(o,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),s(o,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),o.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},o.prototype.toHex=function(){return u.encode(this.toBytes(),"hex").toUpperCase()},i.exports=o}),Ym=gt((t,i)=>{lt();var r=Ta(),u=th(),a=Zr(),s=a.assert,e=a.parseBytes,o=Jm(),c=Xm();function f(l){if(s(l==="ed25519","only tested with ed25519 so far"),!(this instanceof f))return new f(l);l=u[l].curve,this.curve=l,this.g=l.g,this.g.precompute(l.n.bitLength()+1),this.pointClass=l.point().constructor,this.encodingLength=Math.ceil(l.n.bitLength()/8),this.hash=r.sha512}i.exports=f,f.prototype.sign=function(l,p){l=e(l);var g=this.keyFromSecret(p),y=this.hashInt(g.messagePrefix(),l),m=this.g.mul(y),M=this.encodePoint(m),E=this.hashInt(M,g.pubBytes(),l).mul(g.priv()),B=y.add(E).umod(this.curve.n);return this.makeSignature({R:m,S:B,Rencoded:M})},f.prototype.verify=function(l,p,g){l=e(l),p=this.makeSignature(p);var y=this.keyFromPublic(g),m=this.hashInt(p.Rencoded(),y.pubBytes(),l),M=this.g.mul(p.S()),E=p.R().add(y.pub().mul(m));return E.eq(M)},f.prototype.hashInt=function(){for(var l=this.hash(),p=0;p{lt();var i=t;i.version=Nm().version,i.utils=Zr(),i.rand=Yu(),i.curve=L0(),i.curves=th(),i.ec=Zm(),i.eddsa=Ym()}),F0=gt((t,i)=>{lt(),function(r,u){function a(n,d){if(!n)throw new Error(d||"Assertion failed")}function s(n,d){n.super_=d;var v=function(){};v.prototype=d.prototype,n.prototype=new v,n.prototype.constructor=n}function e(n,d,v){if(e.isBN(n))return n;this.negative=0,this.words=null,this.length=0,this.red=null,n!==null&&((d==="le"||d==="be")&&(v=d,d=10),this._init(n||0,d||10,v||"be"))}typeof r=="object"?r.exports=e:u.BN=e,e.BN=e,e.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=$e().Buffer}catch{}e.isBN=function(n){return n instanceof e?!0:n!==null&&typeof n=="object"&&n.constructor.wordSize===e.wordSize&&Array.isArray(n.words)},e.max=function(n,d){return n.cmp(d)>0?n:d},e.min=function(n,d){return n.cmp(d)<0?n:d},e.prototype._init=function(n,d,v){if(typeof n=="number")return this._initNumber(n,d,v);if(typeof n=="object")return this._initArray(n,d,v);d==="hex"&&(d=16),a(d===(d|0)&&d>=2&&d<=36),n=n.toString().replace(/\s+/g,"");var A=0;n[0]==="-"&&(A++,this.negative=1),A=0;A-=3)S=n[A]|n[A-1]<<8|n[A-2]<<16,this.words[T]|=S<>>26-w&67108863,w+=24,w>=26&&(w-=26,T++);else if(v==="le")for(A=0,T=0;A>>26-w&67108863,w+=24,w>=26&&(w-=26,T++);return this._strip()};function c(n,d){var v=n.charCodeAt(d);if(v>=48&&v<=57)return v-48;if(v>=65&&v<=70)return v-55;if(v>=97&&v<=102)return v-87;a(!1,"Invalid character in "+n)}function f(n,d,v){var A=c(n,v);return v-1>=d&&(A|=c(n,v-1)<<4),A}e.prototype._parseHex=function(n,d,v){this.length=Math.ceil((n.length-d)/6),this.words=new Array(this.length);for(var A=0;A=d;A-=2)w=f(n,d,A)<=18?(T-=18,S+=1,this.words[S]|=w>>>26):T+=8;else{var b=n.length-d;for(A=b%2===0?d+1:d;A=18?(T-=18,S+=1,this.words[S]|=w>>>26):T+=8}this._strip()};function l(n,d,v,A){for(var T=0,S=0,w=Math.min(n.length,v),b=d;b=49?S=h-49+10:h>=17?S=h-17+10:S=h,a(h>=0&&S1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},e.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{e.prototype[Symbol.for("nodejs.util.inspect.custom")]=g}catch{e.prototype.inspect=g}else e.prototype.inspect=g;function g(){return(this.red?""}var y=["","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],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];e.prototype.toString=function(n,d){n=n||10,d=d|0||1;var v;if(n===16||n==="hex"){v="";for(var A=0,T=0,S=0;S>>24-A&16777215,A+=2,A>=26&&(A-=26,S--),T!==0||S!==this.length-1?v=y[6-b.length]+b+v:v=b+v}for(T!==0&&(v=T.toString(16)+v);v.length%d!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(n===(n|0)&&n>=2&&n<=36){var h=m[n],k=M[n];v="";var tt=this.clone();for(tt.negative=0;!tt.isZero();){var X=tt.modrn(k).toString(n);tt=tt.idivn(k),tt.isZero()?v=X+v:v=y[h-X.length]+X+v}for(this.isZero()&&(v="0"+v);v.length%d!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}a(!1,"Base should be between 2 and 36")},e.prototype.toNumber=function(){var n=this.words[0];return this.length===2?n+=this.words[1]*67108864:this.length===3&&this.words[2]===1?n+=4503599627370496+this.words[1]*67108864:this.length>2&&a(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-n:n},e.prototype.toJSON=function(){return this.toString(16,2)},o&&(e.prototype.toBuffer=function(n,d){return this.toArrayLike(o,n,d)}),e.prototype.toArray=function(n,d){return this.toArrayLike(Array,n,d)};var E=function(n,d){return n.allocUnsafe?n.allocUnsafe(d):new n(d)};e.prototype.toArrayLike=function(n,d,v){this._strip();var A=this.byteLength(),T=v||Math.max(1,A);a(A<=T,"byte array longer than desired length"),a(T>0,"Requested array length <= 0");var S=E(n,T),w=d==="le"?"LE":"BE";return this["_toArrayLike"+w](S,A),S},e.prototype._toArrayLikeLE=function(n,d){for(var v=0,A=0,T=0,S=0;T>8&255),v>16&255),S===6?(v>24&255),A=0,S=0):(A=w>>>24,S+=2)}if(v=0&&(n[v--]=w>>8&255),v>=0&&(n[v--]=w>>16&255),S===6?(v>=0&&(n[v--]=w>>24&255),A=0,S=0):(A=w>>>24,S+=2)}if(v>=0)for(n[v--]=A;v>=0;)n[v--]=0},Math.clz32?e.prototype._countBits=function(n){return 32-Math.clz32(n)}:e.prototype._countBits=function(n){var d=n,v=0;return d>=4096&&(v+=13,d>>>=13),d>=64&&(v+=7,d>>>=7),d>=8&&(v+=4,d>>>=4),d>=2&&(v+=2,d>>>=2),v+d},e.prototype._zeroBits=function(n){if(n===0)return 26;var d=n,v=0;return!(d&8191)&&(v+=13,d>>>=13),!(d&127)&&(v+=7,d>>>=7),!(d&15)&&(v+=4,d>>>=4),!(d&3)&&(v+=2,d>>>=2),!(d&1)&&v++,v},e.prototype.bitLength=function(){var n=this.words[this.length-1],d=this._countBits(n);return(this.length-1)*26+d};function B(n){for(var d=new Array(n.bitLength()),v=0;v>>T&1}return d}e.prototype.zeroBits=function(){if(this.isZero())return 0;for(var n=0,d=0;dn.length?this.clone().ior(n):n.clone().ior(this)},e.prototype.uor=function(n){return this.length>n.length?this.clone().iuor(n):n.clone().iuor(this)},e.prototype.iuand=function(n){var d;this.length>n.length?d=n:d=this;for(var v=0;vn.length?this.clone().iand(n):n.clone().iand(this)},e.prototype.uand=function(n){return this.length>n.length?this.clone().iuand(n):n.clone().iuand(this)},e.prototype.iuxor=function(n){var d,v;this.length>n.length?(d=this,v=n):(d=n,v=this);for(var A=0;An.length?this.clone().ixor(n):n.clone().ixor(this)},e.prototype.uxor=function(n){return this.length>n.length?this.clone().iuxor(n):n.clone().iuxor(this)},e.prototype.inotn=function(n){a(typeof n=="number"&&n>=0);var d=Math.ceil(n/26)|0,v=n%26;this._expand(d),v>0&&d--;for(var A=0;A0&&(this.words[A]=~this.words[A]&67108863>>26-v),this._strip()},e.prototype.notn=function(n){return this.clone().inotn(n)},e.prototype.setn=function(n,d){a(typeof n=="number"&&n>=0);var v=n/26|0,A=n%26;return this._expand(v+1),d?this.words[v]=this.words[v]|1<n.length?(v=this,A=n):(v=n,A=this);for(var T=0,S=0;S>>26;for(;T!==0&&S>>26;if(this.length=v.length,T!==0)this.words[this.length]=T,this.length++;else if(v!==this)for(;Sn.length?this.clone().iadd(n):n.clone().iadd(this)},e.prototype.isub=function(n){if(n.negative!==0){n.negative=0;var d=this.iadd(n);return n.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(n),this.negative=1,this._normSign();var v=this.cmp(n);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var A,T;v>0?(A=this,T=n):(A=n,T=this);for(var S=0,w=0;w>26,this.words[w]=d&67108863;for(;S!==0&&w>26,this.words[w]=d&67108863;if(S===0&&w>>26,X=h&67108863,ft=Math.min(k,d.length-1),et=Math.max(0,k-n.length+1);et<=ft;et++){var at=k-et|0;T=n.words[at]|0,S=d.words[et]|0,w=T*S+X,tt+=w/67108864|0,X=w&67108863}v.words[k]=X|0,h=tt|0}return h!==0?v.words[k]=h|0:v.length--,v._strip()}var C=function(n,d,v){var A=n.words,T=d.words,S=v.words,w=0,b,h,k,tt=A[0]|0,X=tt&8191,ft=tt>>>13,et=A[1]|0,at=et&8191,$=et>>>13,J=A[2]|0,R=J&8191,j=J>>>13,z=A[3]|0,Z=z&8191,Q=z>>>13,K=A[4]|0,G=K&8191,H=K>>>13,Y=A[5]|0,it=Y&8191,ot=Y>>>13,mt=A[6]|0,_t=mt&8191,ht=mt>>>13,vt=A[7]|0,pt=vt&8191,V=vt>>>13,rt=A[8]|0,st=rt&8191,yt=rt>>>13,Ct=A[9]|0,dt=Ct&8191,Mt=Ct>>>13,Lt=T[0]|0,wt=Lt&8191,ct=Lt>>>13,Et=T[1]|0,ut=Et&8191,Ot=Et>>>13,qt=T[2]|0,nt=qt&8191,Rt=qt>>>13,Dt=T[3]|0,bt=Dt&8191,Tt=Dt>>>13,jt=T[4]|0,St=jt&8191,kt=jt>>>13,Kt=T[5]|0,At=Kt&8191,Nt=Kt>>>13,$t=T[6]|0,Ft=$t&8191,Wt=$t>>>13,ae=T[7]|0,Xt=ae&8191,Gt=ae>>>13,he=T[8]|0,Qt=he&8191,Zt=he>>>13,se=T[9]|0,te=se&8191,re=se>>>13;v.negative=n.negative^d.negative,v.length=19,b=Math.imul(X,wt),h=Math.imul(X,ct),h=h+Math.imul(ft,wt)|0,k=Math.imul(ft,ct);var Se=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Se>>>26)|0,Se&=67108863,b=Math.imul(at,wt),h=Math.imul(at,ct),h=h+Math.imul($,wt)|0,k=Math.imul($,ct),b=b+Math.imul(X,ut)|0,h=h+Math.imul(X,Ot)|0,h=h+Math.imul(ft,ut)|0,k=k+Math.imul(ft,Ot)|0;var Be=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Be>>>26)|0,Be&=67108863,b=Math.imul(R,wt),h=Math.imul(R,ct),h=h+Math.imul(j,wt)|0,k=Math.imul(j,ct),b=b+Math.imul(at,ut)|0,h=h+Math.imul(at,Ot)|0,h=h+Math.imul($,ut)|0,k=k+Math.imul($,Ot)|0,b=b+Math.imul(X,nt)|0,h=h+Math.imul(X,Rt)|0,h=h+Math.imul(ft,nt)|0,k=k+Math.imul(ft,Rt)|0;var Re=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Re>>>26)|0,Re&=67108863,b=Math.imul(Z,wt),h=Math.imul(Z,ct),h=h+Math.imul(Q,wt)|0,k=Math.imul(Q,ct),b=b+Math.imul(R,ut)|0,h=h+Math.imul(R,Ot)|0,h=h+Math.imul(j,ut)|0,k=k+Math.imul(j,Ot)|0,b=b+Math.imul(at,nt)|0,h=h+Math.imul(at,Rt)|0,h=h+Math.imul($,nt)|0,k=k+Math.imul($,Rt)|0,b=b+Math.imul(X,bt)|0,h=h+Math.imul(X,Tt)|0,h=h+Math.imul(ft,bt)|0,k=k+Math.imul(ft,Tt)|0;var Te=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Te>>>26)|0,Te&=67108863,b=Math.imul(G,wt),h=Math.imul(G,ct),h=h+Math.imul(H,wt)|0,k=Math.imul(H,ct),b=b+Math.imul(Z,ut)|0,h=h+Math.imul(Z,Ot)|0,h=h+Math.imul(Q,ut)|0,k=k+Math.imul(Q,Ot)|0,b=b+Math.imul(R,nt)|0,h=h+Math.imul(R,Rt)|0,h=h+Math.imul(j,nt)|0,k=k+Math.imul(j,Rt)|0,b=b+Math.imul(at,bt)|0,h=h+Math.imul(at,Tt)|0,h=h+Math.imul($,bt)|0,k=k+Math.imul($,Tt)|0,b=b+Math.imul(X,St)|0,h=h+Math.imul(X,kt)|0,h=h+Math.imul(ft,St)|0,k=k+Math.imul(ft,kt)|0;var xe=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(xe>>>26)|0,xe&=67108863,b=Math.imul(it,wt),h=Math.imul(it,ct),h=h+Math.imul(ot,wt)|0,k=Math.imul(ot,ct),b=b+Math.imul(G,ut)|0,h=h+Math.imul(G,Ot)|0,h=h+Math.imul(H,ut)|0,k=k+Math.imul(H,Ot)|0,b=b+Math.imul(Z,nt)|0,h=h+Math.imul(Z,Rt)|0,h=h+Math.imul(Q,nt)|0,k=k+Math.imul(Q,Rt)|0,b=b+Math.imul(R,bt)|0,h=h+Math.imul(R,Tt)|0,h=h+Math.imul(j,bt)|0,k=k+Math.imul(j,Tt)|0,b=b+Math.imul(at,St)|0,h=h+Math.imul(at,kt)|0,h=h+Math.imul($,St)|0,k=k+Math.imul($,kt)|0,b=b+Math.imul(X,At)|0,h=h+Math.imul(X,Nt)|0,h=h+Math.imul(ft,At)|0,k=k+Math.imul(ft,Nt)|0;var Ce=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,b=Math.imul(_t,wt),h=Math.imul(_t,ct),h=h+Math.imul(ht,wt)|0,k=Math.imul(ht,ct),b=b+Math.imul(it,ut)|0,h=h+Math.imul(it,Ot)|0,h=h+Math.imul(ot,ut)|0,k=k+Math.imul(ot,Ot)|0,b=b+Math.imul(G,nt)|0,h=h+Math.imul(G,Rt)|0,h=h+Math.imul(H,nt)|0,k=k+Math.imul(H,Rt)|0,b=b+Math.imul(Z,bt)|0,h=h+Math.imul(Z,Tt)|0,h=h+Math.imul(Q,bt)|0,k=k+Math.imul(Q,Tt)|0,b=b+Math.imul(R,St)|0,h=h+Math.imul(R,kt)|0,h=h+Math.imul(j,St)|0,k=k+Math.imul(j,kt)|0,b=b+Math.imul(at,At)|0,h=h+Math.imul(at,Nt)|0,h=h+Math.imul($,At)|0,k=k+Math.imul($,Nt)|0,b=b+Math.imul(X,Ft)|0,h=h+Math.imul(X,Wt)|0,h=h+Math.imul(ft,Ft)|0,k=k+Math.imul(ft,Wt)|0;var Ue=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,b=Math.imul(pt,wt),h=Math.imul(pt,ct),h=h+Math.imul(V,wt)|0,k=Math.imul(V,ct),b=b+Math.imul(_t,ut)|0,h=h+Math.imul(_t,Ot)|0,h=h+Math.imul(ht,ut)|0,k=k+Math.imul(ht,Ot)|0,b=b+Math.imul(it,nt)|0,h=h+Math.imul(it,Rt)|0,h=h+Math.imul(ot,nt)|0,k=k+Math.imul(ot,Rt)|0,b=b+Math.imul(G,bt)|0,h=h+Math.imul(G,Tt)|0,h=h+Math.imul(H,bt)|0,k=k+Math.imul(H,Tt)|0,b=b+Math.imul(Z,St)|0,h=h+Math.imul(Z,kt)|0,h=h+Math.imul(Q,St)|0,k=k+Math.imul(Q,kt)|0,b=b+Math.imul(R,At)|0,h=h+Math.imul(R,Nt)|0,h=h+Math.imul(j,At)|0,k=k+Math.imul(j,Nt)|0,b=b+Math.imul(at,Ft)|0,h=h+Math.imul(at,Wt)|0,h=h+Math.imul($,Ft)|0,k=k+Math.imul($,Wt)|0,b=b+Math.imul(X,Xt)|0,h=h+Math.imul(X,Gt)|0,h=h+Math.imul(ft,Xt)|0,k=k+Math.imul(ft,Gt)|0;var Ke=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,b=Math.imul(st,wt),h=Math.imul(st,ct),h=h+Math.imul(yt,wt)|0,k=Math.imul(yt,ct),b=b+Math.imul(pt,ut)|0,h=h+Math.imul(pt,Ot)|0,h=h+Math.imul(V,ut)|0,k=k+Math.imul(V,Ot)|0,b=b+Math.imul(_t,nt)|0,h=h+Math.imul(_t,Rt)|0,h=h+Math.imul(ht,nt)|0,k=k+Math.imul(ht,Rt)|0,b=b+Math.imul(it,bt)|0,h=h+Math.imul(it,Tt)|0,h=h+Math.imul(ot,bt)|0,k=k+Math.imul(ot,Tt)|0,b=b+Math.imul(G,St)|0,h=h+Math.imul(G,kt)|0,h=h+Math.imul(H,St)|0,k=k+Math.imul(H,kt)|0,b=b+Math.imul(Z,At)|0,h=h+Math.imul(Z,Nt)|0,h=h+Math.imul(Q,At)|0,k=k+Math.imul(Q,Nt)|0,b=b+Math.imul(R,Ft)|0,h=h+Math.imul(R,Wt)|0,h=h+Math.imul(j,Ft)|0,k=k+Math.imul(j,Wt)|0,b=b+Math.imul(at,Xt)|0,h=h+Math.imul(at,Gt)|0,h=h+Math.imul($,Xt)|0,k=k+Math.imul($,Gt)|0,b=b+Math.imul(X,Qt)|0,h=h+Math.imul(X,Zt)|0,h=h+Math.imul(ft,Qt)|0,k=k+Math.imul(ft,Zt)|0;var Je=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Je>>>26)|0,Je&=67108863,b=Math.imul(dt,wt),h=Math.imul(dt,ct),h=h+Math.imul(Mt,wt)|0,k=Math.imul(Mt,ct),b=b+Math.imul(st,ut)|0,h=h+Math.imul(st,Ot)|0,h=h+Math.imul(yt,ut)|0,k=k+Math.imul(yt,Ot)|0,b=b+Math.imul(pt,nt)|0,h=h+Math.imul(pt,Rt)|0,h=h+Math.imul(V,nt)|0,k=k+Math.imul(V,Rt)|0,b=b+Math.imul(_t,bt)|0,h=h+Math.imul(_t,Tt)|0,h=h+Math.imul(ht,bt)|0,k=k+Math.imul(ht,Tt)|0,b=b+Math.imul(it,St)|0,h=h+Math.imul(it,kt)|0,h=h+Math.imul(ot,St)|0,k=k+Math.imul(ot,kt)|0,b=b+Math.imul(G,At)|0,h=h+Math.imul(G,Nt)|0,h=h+Math.imul(H,At)|0,k=k+Math.imul(H,Nt)|0,b=b+Math.imul(Z,Ft)|0,h=h+Math.imul(Z,Wt)|0,h=h+Math.imul(Q,Ft)|0,k=k+Math.imul(Q,Wt)|0,b=b+Math.imul(R,Xt)|0,h=h+Math.imul(R,Gt)|0,h=h+Math.imul(j,Xt)|0,k=k+Math.imul(j,Gt)|0,b=b+Math.imul(at,Qt)|0,h=h+Math.imul(at,Zt)|0,h=h+Math.imul($,Qt)|0,k=k+Math.imul($,Zt)|0,b=b+Math.imul(X,te)|0,h=h+Math.imul(X,re)|0,h=h+Math.imul(ft,te)|0,k=k+Math.imul(ft,re)|0;var ze=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(ze>>>26)|0,ze&=67108863,b=Math.imul(dt,ut),h=Math.imul(dt,Ot),h=h+Math.imul(Mt,ut)|0,k=Math.imul(Mt,Ot),b=b+Math.imul(st,nt)|0,h=h+Math.imul(st,Rt)|0,h=h+Math.imul(yt,nt)|0,k=k+Math.imul(yt,Rt)|0,b=b+Math.imul(pt,bt)|0,h=h+Math.imul(pt,Tt)|0,h=h+Math.imul(V,bt)|0,k=k+Math.imul(V,Tt)|0,b=b+Math.imul(_t,St)|0,h=h+Math.imul(_t,kt)|0,h=h+Math.imul(ht,St)|0,k=k+Math.imul(ht,kt)|0,b=b+Math.imul(it,At)|0,h=h+Math.imul(it,Nt)|0,h=h+Math.imul(ot,At)|0,k=k+Math.imul(ot,Nt)|0,b=b+Math.imul(G,Ft)|0,h=h+Math.imul(G,Wt)|0,h=h+Math.imul(H,Ft)|0,k=k+Math.imul(H,Wt)|0,b=b+Math.imul(Z,Xt)|0,h=h+Math.imul(Z,Gt)|0,h=h+Math.imul(Q,Xt)|0,k=k+Math.imul(Q,Gt)|0,b=b+Math.imul(R,Qt)|0,h=h+Math.imul(R,Zt)|0,h=h+Math.imul(j,Qt)|0,k=k+Math.imul(j,Zt)|0,b=b+Math.imul(at,te)|0,h=h+Math.imul(at,re)|0,h=h+Math.imul($,te)|0,k=k+Math.imul($,re)|0;var Xe=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,b=Math.imul(dt,nt),h=Math.imul(dt,Rt),h=h+Math.imul(Mt,nt)|0,k=Math.imul(Mt,Rt),b=b+Math.imul(st,bt)|0,h=h+Math.imul(st,Tt)|0,h=h+Math.imul(yt,bt)|0,k=k+Math.imul(yt,Tt)|0,b=b+Math.imul(pt,St)|0,h=h+Math.imul(pt,kt)|0,h=h+Math.imul(V,St)|0,k=k+Math.imul(V,kt)|0,b=b+Math.imul(_t,At)|0,h=h+Math.imul(_t,Nt)|0,h=h+Math.imul(ht,At)|0,k=k+Math.imul(ht,Nt)|0,b=b+Math.imul(it,Ft)|0,h=h+Math.imul(it,Wt)|0,h=h+Math.imul(ot,Ft)|0,k=k+Math.imul(ot,Wt)|0,b=b+Math.imul(G,Xt)|0,h=h+Math.imul(G,Gt)|0,h=h+Math.imul(H,Xt)|0,k=k+Math.imul(H,Gt)|0,b=b+Math.imul(Z,Qt)|0,h=h+Math.imul(Z,Zt)|0,h=h+Math.imul(Q,Qt)|0,k=k+Math.imul(Q,Zt)|0,b=b+Math.imul(R,te)|0,h=h+Math.imul(R,re)|0,h=h+Math.imul(j,te)|0,k=k+Math.imul(j,re)|0;var Ge=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,b=Math.imul(dt,bt),h=Math.imul(dt,Tt),h=h+Math.imul(Mt,bt)|0,k=Math.imul(Mt,Tt),b=b+Math.imul(st,St)|0,h=h+Math.imul(st,kt)|0,h=h+Math.imul(yt,St)|0,k=k+Math.imul(yt,kt)|0,b=b+Math.imul(pt,At)|0,h=h+Math.imul(pt,Nt)|0,h=h+Math.imul(V,At)|0,k=k+Math.imul(V,Nt)|0,b=b+Math.imul(_t,Ft)|0,h=h+Math.imul(_t,Wt)|0,h=h+Math.imul(ht,Ft)|0,k=k+Math.imul(ht,Wt)|0,b=b+Math.imul(it,Xt)|0,h=h+Math.imul(it,Gt)|0,h=h+Math.imul(ot,Xt)|0,k=k+Math.imul(ot,Gt)|0,b=b+Math.imul(G,Qt)|0,h=h+Math.imul(G,Zt)|0,h=h+Math.imul(H,Qt)|0,k=k+Math.imul(H,Zt)|0,b=b+Math.imul(Z,te)|0,h=h+Math.imul(Z,re)|0,h=h+Math.imul(Q,te)|0,k=k+Math.imul(Q,re)|0;var Ye=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,b=Math.imul(dt,St),h=Math.imul(dt,kt),h=h+Math.imul(Mt,St)|0,k=Math.imul(Mt,kt),b=b+Math.imul(st,At)|0,h=h+Math.imul(st,Nt)|0,h=h+Math.imul(yt,At)|0,k=k+Math.imul(yt,Nt)|0,b=b+Math.imul(pt,Ft)|0,h=h+Math.imul(pt,Wt)|0,h=h+Math.imul(V,Ft)|0,k=k+Math.imul(V,Wt)|0,b=b+Math.imul(_t,Xt)|0,h=h+Math.imul(_t,Gt)|0,h=h+Math.imul(ht,Xt)|0,k=k+Math.imul(ht,Gt)|0,b=b+Math.imul(it,Qt)|0,h=h+Math.imul(it,Zt)|0,h=h+Math.imul(ot,Qt)|0,k=k+Math.imul(ot,Zt)|0,b=b+Math.imul(G,te)|0,h=h+Math.imul(G,re)|0,h=h+Math.imul(H,te)|0,k=k+Math.imul(H,re)|0;var We=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(We>>>26)|0,We&=67108863,b=Math.imul(dt,At),h=Math.imul(dt,Nt),h=h+Math.imul(Mt,At)|0,k=Math.imul(Mt,Nt),b=b+Math.imul(st,Ft)|0,h=h+Math.imul(st,Wt)|0,h=h+Math.imul(yt,Ft)|0,k=k+Math.imul(yt,Wt)|0,b=b+Math.imul(pt,Xt)|0,h=h+Math.imul(pt,Gt)|0,h=h+Math.imul(V,Xt)|0,k=k+Math.imul(V,Gt)|0,b=b+Math.imul(_t,Qt)|0,h=h+Math.imul(_t,Zt)|0,h=h+Math.imul(ht,Qt)|0,k=k+Math.imul(ht,Zt)|0,b=b+Math.imul(it,te)|0,h=h+Math.imul(it,re)|0,h=h+Math.imul(ot,te)|0,k=k+Math.imul(ot,re)|0;var Ve=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,b=Math.imul(dt,Ft),h=Math.imul(dt,Wt),h=h+Math.imul(Mt,Ft)|0,k=Math.imul(Mt,Wt),b=b+Math.imul(st,Xt)|0,h=h+Math.imul(st,Gt)|0,h=h+Math.imul(yt,Xt)|0,k=k+Math.imul(yt,Gt)|0,b=b+Math.imul(pt,Qt)|0,h=h+Math.imul(pt,Zt)|0,h=h+Math.imul(V,Qt)|0,k=k+Math.imul(V,Zt)|0,b=b+Math.imul(_t,te)|0,h=h+Math.imul(_t,re)|0,h=h+Math.imul(ht,te)|0,k=k+Math.imul(ht,re)|0;var Ze=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,b=Math.imul(dt,Xt),h=Math.imul(dt,Gt),h=h+Math.imul(Mt,Xt)|0,k=Math.imul(Mt,Gt),b=b+Math.imul(st,Qt)|0,h=h+Math.imul(st,Zt)|0,h=h+Math.imul(yt,Qt)|0,k=k+Math.imul(yt,Zt)|0,b=b+Math.imul(pt,te)|0,h=h+Math.imul(pt,re)|0,h=h+Math.imul(V,te)|0,k=k+Math.imul(V,re)|0;var ar=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(ar>>>26)|0,ar&=67108863,b=Math.imul(dt,Qt),h=Math.imul(dt,Zt),h=h+Math.imul(Mt,Qt)|0,k=Math.imul(Mt,Zt),b=b+Math.imul(st,te)|0,h=h+Math.imul(st,re)|0,h=h+Math.imul(yt,te)|0,k=k+Math.imul(yt,re)|0;var br=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(br>>>26)|0,br&=67108863,b=Math.imul(dt,te),h=Math.imul(dt,re),h=h+Math.imul(Mt,te)|0,k=Math.imul(Mt,re);var cr=(w+b|0)+((h&8191)<<13)|0;return w=(k+(h>>>13)|0)+(cr>>>26)|0,cr&=67108863,S[0]=Se,S[1]=Be,S[2]=Re,S[3]=Te,S[4]=xe,S[5]=Ce,S[6]=Ue,S[7]=Ke,S[8]=Je,S[9]=ze,S[10]=Xe,S[11]=Ge,S[12]=Ye,S[13]=We,S[14]=Ve,S[15]=Ze,S[16]=ar,S[17]=br,S[18]=cr,w!==0&&(S[19]=w,v.length++),v};Math.imul||(C=x);function N(n,d,v){v.negative=d.negative^n.negative,v.length=n.length+d.length;for(var A=0,T=0,S=0;S>>26)|0,T+=w>>>26,w&=67108863}v.words[S]=b,A=w,w=T}return A!==0?v.words[S]=A:v.length--,v._strip()}function F(n,d,v){return N(n,d,v)}e.prototype.mulTo=function(n,d){var v,A=this.length+n.length;return this.length===10&&n.length===10?v=C(this,n,d):A<63?v=x(this,n,d):A<1024?v=N(this,n,d):v=F(this,n,d),v},e.prototype.mul=function(n){var d=new e(null);return d.words=new Array(this.length+n.length),this.mulTo(n,d)},e.prototype.mulf=function(n){var d=new e(null);return d.words=new Array(this.length+n.length),F(this,n,d)},e.prototype.imul=function(n){return this.clone().mulTo(n,this)},e.prototype.imuln=function(n){var d=n<0;d&&(n=-n),a(typeof n=="number"),a(n<67108864);for(var v=0,A=0;A>=26,v+=T/67108864|0,v+=S>>>26,this.words[A]=S&67108863}return v!==0&&(this.words[A]=v,this.length++),d?this.ineg():this},e.prototype.muln=function(n){return this.clone().imuln(n)},e.prototype.sqr=function(){return this.mul(this)},e.prototype.isqr=function(){return this.imul(this.clone())},e.prototype.pow=function(n){var d=B(n);if(d.length===0)return new e(1);for(var v=this,A=0;A=0);var d=n%26,v=(n-d)/26,A=67108863>>>26-d<<26-d,T;if(d!==0){var S=0;for(T=0;T>>26-d}S&&(this.words[T]=S,this.length++)}if(v!==0){for(T=this.length-1;T>=0;T--)this.words[T+v]=this.words[T];for(T=0;T=0);var A;d?A=(d-d%26)/26:A=0;var T=n%26,S=Math.min((n-T)/26,this.length),w=67108863^67108863>>>T<S)for(this.length-=S,h=0;h=0&&(k!==0||h>=A);h--){var tt=this.words[h]|0;this.words[h]=k<<26-T|tt>>>T,k=tt&w}return b&&k!==0&&(b.words[b.length++]=k),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},e.prototype.ishrn=function(n,d,v){return a(this.negative===0),this.iushrn(n,d,v)},e.prototype.shln=function(n){return this.clone().ishln(n)},e.prototype.ushln=function(n){return this.clone().iushln(n)},e.prototype.shrn=function(n){return this.clone().ishrn(n)},e.prototype.ushrn=function(n){return this.clone().iushrn(n)},e.prototype.testn=function(n){a(typeof n=="number"&&n>=0);var d=n%26,v=(n-d)/26,A=1<=0);var d=n%26,v=(n-d)/26;if(a(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(d!==0&&v++,this.length=Math.min(v,this.length),d!==0){var A=67108863^67108863>>>d<=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},e.prototype.isubn=function(n){if(a(typeof n=="number"),a(n<67108864),n<0)return this.iaddn(-n);if(this.negative!==0)return this.negative=0,this.iaddn(n),this.negative=1,this;if(this.words[0]-=n,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(b/67108864|0),this.words[T+v]=S&67108863}for(;T>26,this.words[T+v]=S&67108863;if(w===0)return this._strip();for(a(w===-1),w=0,T=0;T>26,this.words[T]=S&67108863;return this.negative=1,this._strip()},e.prototype._wordDiv=function(n,d){var v=this.length-n.length,A=this.clone(),T=n,S=T.words[T.length-1]|0,w=this._countBits(S);v=26-w,v!==0&&(T=T.ushln(v),A.iushln(v),S=T.words[T.length-1]|0);var b=A.length-T.length,h;if(d!=="mod"){h=new e(null),h.length=b+1,h.words=new Array(h.length);for(var k=0;k=0;X--){var ft=(A.words[T.length+X]|0)*67108864+(A.words[T.length+X-1]|0);for(ft=Math.min(ft/S|0,67108863),A._ishlnsubmul(T,ft,X);A.negative!==0;)ft--,A.negative=0,A._ishlnsubmul(T,1,X),A.isZero()||(A.negative^=1);h&&(h.words[X]=ft)}return h&&h._strip(),A._strip(),d!=="div"&&v!==0&&A.iushrn(v),{div:h||null,mod:A}},e.prototype.divmod=function(n,d,v){if(a(!n.isZero()),this.isZero())return{div:new e(0),mod:new e(0)};var A,T,S;return this.negative!==0&&n.negative===0?(S=this.neg().divmod(n,d),d!=="mod"&&(A=S.div.neg()),d!=="div"&&(T=S.mod.neg(),v&&T.negative!==0&&T.iadd(n)),{div:A,mod:T}):this.negative===0&&n.negative!==0?(S=this.divmod(n.neg(),d),d!=="mod"&&(A=S.div.neg()),{div:A,mod:S.mod}):this.negative&n.negative?(S=this.neg().divmod(n.neg(),d),d!=="div"&&(T=S.mod.neg(),v&&T.negative!==0&&T.isub(n)),{div:S.div,mod:T}):n.length>this.length||this.cmp(n)<0?{div:new e(0),mod:this}:n.length===1?d==="div"?{div:this.divn(n.words[0]),mod:null}:d==="mod"?{div:null,mod:new e(this.modrn(n.words[0]))}:{div:this.divn(n.words[0]),mod:new e(this.modrn(n.words[0]))}:this._wordDiv(n,d)},e.prototype.div=function(n){return this.divmod(n,"div",!1).div},e.prototype.mod=function(n){return this.divmod(n,"mod",!1).mod},e.prototype.umod=function(n){return this.divmod(n,"mod",!0).mod},e.prototype.divRound=function(n){var d=this.divmod(n);if(d.mod.isZero())return d.div;var v=d.div.negative!==0?d.mod.isub(n):d.mod,A=n.ushrn(1),T=n.andln(1),S=v.cmp(A);return S<0||T===1&&S===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},e.prototype.modrn=function(n){var d=n<0;d&&(n=-n),a(n<=67108863);for(var v=(1<<26)%n,A=0,T=this.length-1;T>=0;T--)A=(v*A+(this.words[T]|0))%n;return d?-A:A},e.prototype.modn=function(n){return this.modrn(n)},e.prototype.idivn=function(n){var d=n<0;d&&(n=-n),a(n<=67108863);for(var v=0,A=this.length-1;A>=0;A--){var T=(this.words[A]|0)+v*67108864;this.words[A]=T/n|0,v=T%n}return this._strip(),d?this.ineg():this},e.prototype.divn=function(n){return this.clone().idivn(n)},e.prototype.egcd=function(n){a(n.negative===0),a(!n.isZero());var d=this,v=n.clone();d.negative!==0?d=d.umod(n):d=d.clone();for(var A=new e(1),T=new e(0),S=new e(0),w=new e(1),b=0;d.isEven()&&v.isEven();)d.iushrn(1),v.iushrn(1),++b;for(var h=v.clone(),k=d.clone();!d.isZero();){for(var tt=0,X=1;!(d.words[0]&X)&&tt<26;++tt,X<<=1);if(tt>0)for(d.iushrn(tt);tt-- >0;)(A.isOdd()||T.isOdd())&&(A.iadd(h),T.isub(k)),A.iushrn(1),T.iushrn(1);for(var ft=0,et=1;!(v.words[0]&et)&&ft<26;++ft,et<<=1);if(ft>0)for(v.iushrn(ft);ft-- >0;)(S.isOdd()||w.isOdd())&&(S.iadd(h),w.isub(k)),S.iushrn(1),w.iushrn(1);d.cmp(v)>=0?(d.isub(v),A.isub(S),T.isub(w)):(v.isub(d),S.isub(A),w.isub(T))}return{a:S,b:w,gcd:v.iushln(b)}},e.prototype._invmp=function(n){a(n.negative===0),a(!n.isZero());var d=this,v=n.clone();d.negative!==0?d=d.umod(n):d=d.clone();for(var A=new e(1),T=new e(0),S=v.clone();d.cmpn(1)>0&&v.cmpn(1)>0;){for(var w=0,b=1;!(d.words[0]&b)&&w<26;++w,b<<=1);if(w>0)for(d.iushrn(w);w-- >0;)A.isOdd()&&A.iadd(S),A.iushrn(1);for(var h=0,k=1;!(v.words[0]&k)&&h<26;++h,k<<=1);if(h>0)for(v.iushrn(h);h-- >0;)T.isOdd()&&T.iadd(S),T.iushrn(1);d.cmp(v)>=0?(d.isub(v),A.isub(T)):(v.isub(d),T.isub(A))}var tt;return d.cmpn(1)===0?tt=A:tt=T,tt.cmpn(0)<0&&tt.iadd(n),tt},e.prototype.gcd=function(n){if(this.isZero())return n.abs();if(n.isZero())return this.abs();var d=this.clone(),v=n.clone();d.negative=0,v.negative=0;for(var A=0;d.isEven()&&v.isEven();A++)d.iushrn(1),v.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;v.isEven();)v.iushrn(1);var T=d.cmp(v);if(T<0){var S=d;d=v,v=S}else if(T===0||v.cmpn(1)===0)break;d.isub(v)}while(!0);return v.iushln(A)},e.prototype.invm=function(n){return this.egcd(n).a.umod(n)},e.prototype.isEven=function(){return(this.words[0]&1)===0},e.prototype.isOdd=function(){return(this.words[0]&1)===1},e.prototype.andln=function(n){return this.words[0]&n},e.prototype.bincn=function(n){a(typeof n=="number");var d=n%26,v=(n-d)/26,A=1<>>26,w&=67108863,this.words[S]=w}return T!==0&&(this.words[S]=T,this.length++),this},e.prototype.isZero=function(){return this.length===1&&this.words[0]===0},e.prototype.cmpn=function(n){var d=n<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var v;if(this.length>1)v=1;else{d&&(n=-n),a(n<=67108863,"Number is too big");var A=this.words[0]|0;v=A===n?0:An.length)return 1;if(this.length=0;v--){var A=this.words[v]|0,T=n.words[v]|0;if(A!==T){AT&&(d=1);break}}return d},e.prototype.gtn=function(n){return this.cmpn(n)===1},e.prototype.gt=function(n){return this.cmp(n)===1},e.prototype.gten=function(n){return this.cmpn(n)>=0},e.prototype.gte=function(n){return this.cmp(n)>=0},e.prototype.ltn=function(n){return this.cmpn(n)===-1},e.prototype.lt=function(n){return this.cmp(n)===-1},e.prototype.lten=function(n){return this.cmpn(n)<=0},e.prototype.lte=function(n){return this.cmp(n)<=0},e.prototype.eqn=function(n){return this.cmpn(n)===0},e.prototype.eq=function(n){return this.cmp(n)===0},e.red=function(n){return new O(n)},e.prototype.toRed=function(n){return a(!this.red,"Already a number in reduction context"),a(this.negative===0,"red works only with positives"),n.convertTo(this)._forceRed(n)},e.prototype.fromRed=function(){return a(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},e.prototype._forceRed=function(n){return this.red=n,this},e.prototype.forceRed=function(n){return a(!this.red,"Already a number in reduction context"),this._forceRed(n)},e.prototype.redAdd=function(n){return a(this.red,"redAdd works only with red numbers"),this.red.add(this,n)},e.prototype.redIAdd=function(n){return a(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,n)},e.prototype.redSub=function(n){return a(this.red,"redSub works only with red numbers"),this.red.sub(this,n)},e.prototype.redISub=function(n){return a(this.red,"redISub works only with red numbers"),this.red.isub(this,n)},e.prototype.redShl=function(n){return a(this.red,"redShl works only with red numbers"),this.red.shl(this,n)},e.prototype.redMul=function(n){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.mul(this,n)},e.prototype.redIMul=function(n){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.imul(this,n)},e.prototype.redSqr=function(){return a(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},e.prototype.redISqr=function(){return a(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},e.prototype.redSqrt=function(){return a(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},e.prototype.redInvm=function(){return a(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},e.prototype.redNeg=function(){return a(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},e.prototype.redPow=function(n){return a(this.red&&!n.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,n)};var I={k256:null,p224:null,p192:null,p25519:null};function U(n,d){this.name=n,this.p=new e(d,16),this.n=this.p.bitLength(),this.k=new e(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var n=new e(null);return n.words=new Array(Math.ceil(this.n/13)),n},U.prototype.ireduce=function(n){var d=n,v;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),v=d.bitLength();while(v>this.n);var A=v0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},U.prototype.split=function(n,d){n.iushrn(this.n,0,d)},U.prototype.imulK=function(n){return n.imul(this.k)};function P(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(P,U),P.prototype.split=function(n,d){for(var v=4194303,A=Math.min(n.length,9),T=0;T>>22,S=w}S>>>=22,n.words[T-10]=S,S===0&&n.length>10?n.length-=10:n.length-=9},P.prototype.imulK=function(n){n.words[n.length]=0,n.words[n.length+1]=0,n.length+=2;for(var d=0,v=0;v>>=26,n.words[v]=T,d=A}return d!==0&&(n.words[n.length++]=d),n},e._prime=function(n){if(I[n])return I[n];var d;if(n==="k256")d=new P;else if(n==="p224")d=new D;else if(n==="p192")d=new W;else if(n==="p25519")d=new q;else throw new Error("Unknown prime "+n);return I[n]=d,d};function O(n){if(typeof n=="string"){var d=e._prime(n);this.m=d.p,this.prime=d}else a(n.gtn(1),"modulus must be greater than 1"),this.m=n,this.prime=null}O.prototype._verify1=function(n){a(n.negative===0,"red works only with positives"),a(n.red,"red works only with red numbers")},O.prototype._verify2=function(n,d){a((n.negative|d.negative)===0,"red works only with positives"),a(n.red&&n.red===d.red,"red works only with red numbers")},O.prototype.imod=function(n){return this.prime?this.prime.ireduce(n)._forceRed(this):(p(n,n.umod(this.m)._forceRed(this)),n)},O.prototype.neg=function(n){return n.isZero()?n.clone():this.m.sub(n)._forceRed(this)},O.prototype.add=function(n,d){this._verify2(n,d);var v=n.add(d);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},O.prototype.iadd=function(n,d){this._verify2(n,d);var v=n.iadd(d);return v.cmp(this.m)>=0&&v.isub(this.m),v},O.prototype.sub=function(n,d){this._verify2(n,d);var v=n.sub(d);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},O.prototype.isub=function(n,d){this._verify2(n,d);var v=n.isub(d);return v.cmpn(0)<0&&v.iadd(this.m),v},O.prototype.shl=function(n,d){return this._verify1(n),this.imod(n.ushln(d))},O.prototype.imul=function(n,d){return this._verify2(n,d),this.imod(n.imul(d))},O.prototype.mul=function(n,d){return this._verify2(n,d),this.imod(n.mul(d))},O.prototype.isqr=function(n){return this.imul(n,n.clone())},O.prototype.sqr=function(n){return this.mul(n,n)},O.prototype.sqrt=function(n){if(n.isZero())return n.clone();var d=this.m.andln(3);if(a(d%2===1),d===3){var v=this.m.add(new e(1)).iushrn(2);return this.pow(n,v)}for(var A=this.m.subn(1),T=0;!A.isZero()&&A.andln(1)===0;)T++,A.iushrn(1);a(!A.isZero());var S=new e(1).toRed(this),w=S.redNeg(),b=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new e(2*h*h).toRed(this);this.pow(h,b).cmp(w)!==0;)h.redIAdd(w);for(var k=this.pow(h,A),tt=this.pow(n,A.addn(1).iushrn(1)),X=this.pow(n,A),ft=T;X.cmp(S)!==0;){for(var et=X,at=0;et.cmp(S)!==0;at++)et=et.redSqr();a(at=0;T--){for(var k=d.words[T],tt=h-1;tt>=0;tt--){var X=k>>tt&1;if(S!==A[0]&&(S=this.sqr(S)),X===0&&w===0){b=0;continue}w<<=1,w|=X,b++,!(b!==v&&(T!==0||tt!==0))&&(S=this.mul(S,A[w]),b=0,w=0)}h=26}return S},O.prototype.convertTo=function(n){var d=n.umod(this.m);return d===n?d.clone():d},O.prototype.convertFrom=function(n){var d=n.clone();return d.red=null,d},e.mont=function(n){return new L(n)};function L(n){O.call(this,n),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new e(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(L,O),L.prototype.convertTo=function(n){return this.imod(n.ushln(this.shift))},L.prototype.convertFrom=function(n){var d=this.imod(n.mul(this.rinv));return d.red=null,d},L.prototype.imul=function(n,d){if(n.isZero()||d.isZero())return n.words[0]=0,n.length=1,n;var v=n.imul(d),A=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=v.isub(A).iushrn(this.shift),S=T;return T.cmp(this.m)>=0?S=T.isub(this.m):T.cmpn(0)<0&&(S=T.iadd(this.m)),S._forceRed(this)},L.prototype.mul=function(n,d){if(n.isZero()||d.isZero())return new e(0)._forceRed(this);var v=n.mul(d),A=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=v.isub(A).iushrn(this.shift),S=T;return T.cmp(this.m)>=0?S=T.isub(this.m):T.cmpn(0)<0&&(S=T.iadd(this.m)),S._forceRed(this)},L.prototype.invm=function(n){var d=this.imod(n._invmp(this.m).mul(this.r2));return d._forceRed(this)}}(typeof i>"u"||i,t)}),eh=gt((t,i)=>{lt();var r=$e(),u=r.Buffer,a={},s;for(s in r)!r.hasOwnProperty(s)||s==="SlowBuffer"||s==="Buffer"||(a[s]=r[s]);var e=a.Buffer={};for(s in u)!u.hasOwnProperty(s)||s==="allocUnsafe"||s==="allocUnsafeSlow"||(e[s]=u[s]);if(a.Buffer.prototype=u.prototype,(!e.from||e.from===Uint8Array.from)&&(e.from=function(o,c,f){if(typeof o=="number")throw new TypeError('The "value" argument must not be of type number. Received type '+typeof o);if(o&&typeof o.length>"u")throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof o);return u(o,c,f)}),e.alloc||(e.alloc=function(o,c,f){if(typeof o!="number")throw new TypeError('The "size" argument must be of type number. Received type '+typeof o);if(o<0||o>=2*(1<<30))throw new RangeError('The value "'+o+'" is invalid for option "size"');var l=u(o);return!c||c.length===0?l.fill(0):typeof f=="string"?l.fill(c,f):l.fill(c),l}),!a.kStringMaxLength)try{a.kStringMaxLength=Jt.default.binding("buffer").kStringMaxLength}catch{}a.constants||(a.constants={MAX_LENGTH:a.kMaxLength},a.kStringMaxLength&&(a.constants.MAX_STRING_LENGTH=a.kStringMaxLength)),i.exports=a}),rh=gt(t=>{lt();var i=pe();function r(a){this._reporterState={obj:null,path:[],options:a||{},errors:[]}}t.Reporter=r,r.prototype.isError=function(a){return a instanceof u},r.prototype.save=function(){let a=this._reporterState;return{obj:a.obj,pathLen:a.path.length}},r.prototype.restore=function(a){let s=this._reporterState;s.obj=a.obj,s.path=s.path.slice(0,a.pathLen)},r.prototype.enterKey=function(a){return this._reporterState.path.push(a)},r.prototype.exitKey=function(a){let s=this._reporterState;s.path=s.path.slice(0,a-1)},r.prototype.leaveKey=function(a,s,e){let o=this._reporterState;this.exitKey(a),o.obj!==null&&(o.obj[s]=e)},r.prototype.path=function(){return this._reporterState.path.join("/")},r.prototype.enterObject=function(){let a=this._reporterState,s=a.obj;return a.obj={},s},r.prototype.leaveObject=function(a){let s=this._reporterState,e=s.obj;return s.obj=a,e},r.prototype.error=function(a){let s,e=this._reporterState,o=a instanceof u;if(o?s=a:s=new u(e.path.map(function(c){return"["+JSON.stringify(c)+"]"}).join(""),a.message||a,a.stack),!e.options.partial)throw s;return o||e.errors.push(s),s},r.prototype.wrapResult=function(a){let s=this._reporterState;return s.options.partial?{result:this.isError(a)?null:a,errors:s.errors}:a};function u(a,s){this.path=a,this.rethrow(s)}i(u,Error),u.prototype.rethrow=function(a){if(this.message=a+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,u),!this.stack)try{throw new Error(this.message)}catch(s){this.stack=s.stack}return this}}),ua=gt(t=>{lt();var i=pe(),r=rh().Reporter,u=eh().Buffer;function a(e,o){if(r.call(this,o),!u.isBuffer(e)){this.error("Input not Buffer");return}this.base=e,this.offset=0,this.length=e.length}i(a,r),t.DecoderBuffer=a,a.isDecoderBuffer=function(e){return e instanceof a?!0:typeof e=="object"&&u.isBuffer(e.base)&&e.constructor.name==="DecoderBuffer"&&typeof e.offset=="number"&&typeof e.length=="number"&&typeof e.save=="function"&&typeof e.restore=="function"&&typeof e.isEmpty=="function"&&typeof e.readUInt8=="function"&&typeof e.skip=="function"&&typeof e.raw=="function"},a.prototype.save=function(){return{offset:this.offset,reporter:r.prototype.save.call(this)}},a.prototype.restore=function(e){let o=new a(this.base);return o.offset=e.offset,o.length=this.offset,this.offset=e.offset,r.prototype.restore.call(this,e.reporter),o},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},a.prototype.skip=function(e,o){if(!(this.offset+e<=this.length))return this.error(o||"DecoderBuffer overrun");let c=new a(this.base);return c._reporterState=this._reporterState,c.offset=this.offset,c.length=this.offset+e,this.offset+=e,c},a.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)};function s(e,o){if(Array.isArray(e))this.length=0,this.value=e.map(function(c){return s.isEncoderBuffer(c)||(c=new s(c,o)),this.length+=c.length,c},this);else if(typeof e=="number"){if(!(0<=e&&e<=255))return o.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if(typeof e=="string")this.value=e,this.length=u.byteLength(e);else if(u.isBuffer(e))this.value=e,this.length=e.length;else return o.error("Unsupported type: "+typeof e)}t.EncoderBuffer=s,s.isEncoderBuffer=function(e){return e instanceof s?!0:typeof e=="object"&&e.constructor.name==="EncoderBuffer"&&typeof e.length=="number"&&typeof e.join=="function"},s.prototype.join=function(e,o){return e||(e=u.alloc(this.length)),o||(o=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(c){c.join(e,o),o+=c.length}):(typeof this.value=="number"?e[o]=this.value:typeof this.value=="string"?e.write(this.value,o):u.isBuffer(this.value)&&this.value.copy(e,o),o+=this.length)),e}}),nh=gt((t,i)=>{lt();var r=rh().Reporter,u=ua().EncoderBuffer,a=ua().DecoderBuffer,s=Vr(),e=["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"],o=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(e),c=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function f(p,g,y){let m={};this._baseState=m,m.name=y,m.enc=p,m.parent=g||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())}i.exports=f;var l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];f.prototype.clone=function(){let p=this._baseState,g={};l.forEach(function(m){g[m]=p[m]});let y=new this.constructor(g.parent);return y._baseState=g,y},f.prototype._wrap=function(){let p=this._baseState;o.forEach(function(g){this[g]=function(){let y=new this.constructor(this);return p.children.push(y),y[g].apply(y,arguments)}},this)},f.prototype._init=function(p){let g=this._baseState;s(g.parent===null),p.call(this),g.children=g.children.filter(function(y){return y._baseState.parent===this},this),s.equal(g.children.length,1,"Root node can have only one child")},f.prototype._useArgs=function(p){let g=this._baseState,y=p.filter(function(m){return m instanceof this.constructor},this);p=p.filter(function(m){return!(m instanceof this.constructor)},this),y.length!==0&&(s(g.children===null),g.children=y,y.forEach(function(m){m._baseState.parent=this},this)),p.length!==0&&(s(g.args===null),g.args=p,g.reverseArgs=p.map(function(m){if(typeof m!="object"||m.constructor!==Object)return m;let M={};return Object.keys(m).forEach(function(E){E==(E|0)&&(E|=0);let B=m[E];M[B]=E}),M}))},c.forEach(function(p){f.prototype[p]=function(){let g=this._baseState;throw new Error(p+" not implemented for encoding: "+g.enc)}}),e.forEach(function(p){f.prototype[p]=function(){let g=this._baseState,y=Array.prototype.slice.call(arguments);return s(g.tag===null),g.tag=p,this._useArgs(y),this}}),f.prototype.use=function(p){s(p);let g=this._baseState;return s(g.use===null),g.use=p,this},f.prototype.optional=function(){let p=this._baseState;return p.optional=!0,this},f.prototype.def=function(p){let g=this._baseState;return s(g.default===null),g.default=p,g.optional=!0,this},f.prototype.explicit=function(p){let g=this._baseState;return s(g.explicit===null&&g.implicit===null),g.explicit=p,this},f.prototype.implicit=function(p){let g=this._baseState;return s(g.explicit===null&&g.implicit===null),g.implicit=p,this},f.prototype.obj=function(){let p=this._baseState,g=Array.prototype.slice.call(arguments);return p.obj=!0,g.length!==0&&this._useArgs(g),this},f.prototype.key=function(p){let g=this._baseState;return s(g.key===null),g.key=p,this},f.prototype.any=function(){let p=this._baseState;return p.any=!0,this},f.prototype.choice=function(p){let g=this._baseState;return s(g.choice===null),g.choice=p,this._useArgs(Object.keys(p).map(function(y){return p[y]})),this},f.prototype.contains=function(p){let g=this._baseState;return s(g.use===null),g.contains=p,this},f.prototype._decode=function(p,g){let y=this._baseState;if(y.parent===null)return p.wrapResult(y.children[0]._decode(p,g));let m=y.default,M=!0,E=null;if(y.key!==null&&(E=p.enterKey(y.key)),y.optional){let x=null;if(y.explicit!==null?x=y.explicit:y.implicit!==null?x=y.implicit:y.tag!==null&&(x=y.tag),x===null&&!y.any){let C=p.save();try{y.choice===null?this._decodeGeneric(y.tag,p,g):this._decodeChoice(p,g),M=!0}catch{M=!1}p.restore(C)}else if(M=this._peekTag(p,x,y.any),p.isError(M))return M}let B;if(y.obj&&M&&(B=p.enterObject()),M){if(y.explicit!==null){let C=this._decodeTag(p,y.explicit);if(p.isError(C))return C;p=C}let x=p.offset;if(y.use===null&&y.choice===null){let C;y.any&&(C=p.save());let N=this._decodeTag(p,y.implicit!==null?y.implicit:y.tag,y.any);if(p.isError(N))return N;y.any?m=p.raw(C):p=N}if(g&&g.track&&y.tag!==null&&g.track(p.path(),x,p.length,"tagged"),g&&g.track&&y.tag!==null&&g.track(p.path(),p.offset,p.length,"content"),y.any||(y.choice===null?m=this._decodeGeneric(y.tag,p,g):m=this._decodeChoice(p,g)),p.isError(m))return m;if(!y.any&&y.choice===null&&y.children!==null&&y.children.forEach(function(C){C._decode(p,g)}),y.contains&&(y.tag==="octstr"||y.tag==="bitstr")){let C=new a(m);m=this._getUse(y.contains,p._reporterState.obj)._decode(C,g)}}return y.obj&&M&&(m=p.leaveObject(B)),y.key!==null&&(m!==null||M===!0)?p.leaveKey(E,y.key,m):E!==null&&p.exitKey(E),m},f.prototype._decodeGeneric=function(p,g,y){let m=this._baseState;return p==="seq"||p==="set"?null:p==="seqof"||p==="setof"?this._decodeList(g,p,m.args[0],y):/str$/.test(p)?this._decodeStr(g,p,y):p==="objid"&&m.args?this._decodeObjid(g,m.args[0],m.args[1],y):p==="objid"?this._decodeObjid(g,null,null,y):p==="gentime"||p==="utctime"?this._decodeTime(g,p,y):p==="null_"?this._decodeNull(g,y):p==="bool"?this._decodeBool(g,y):p==="objDesc"?this._decodeStr(g,p,y):p==="int"||p==="enum"?this._decodeInt(g,m.args&&m.args[0],y):m.use!==null?this._getUse(m.use,g._reporterState.obj)._decode(g,y):g.error("unknown tag: "+p)},f.prototype._getUse=function(p,g){let y=this._baseState;return y.useDecoder=this._use(p,g),s(y.useDecoder._baseState.parent===null),y.useDecoder=y.useDecoder._baseState.children[0],y.implicit!==y.useDecoder._baseState.implicit&&(y.useDecoder=y.useDecoder.clone(),y.useDecoder._baseState.implicit=y.implicit),y.useDecoder},f.prototype._decodeChoice=function(p,g){let y=this._baseState,m=null,M=!1;return Object.keys(y.choice).some(function(E){let B=p.save(),x=y.choice[E];try{let C=x._decode(p,g);if(p.isError(C))return!1;m={type:E,value:C},M=!0}catch{return p.restore(B),!1}return!0},this),M?m:p.error("Choice not matched")},f.prototype._createEncoderBuffer=function(p){return new u(p,this.reporter)},f.prototype._encode=function(p,g,y){let m=this._baseState;if(m.default!==null&&m.default===p)return;let M=this._encodeValue(p,g,y);if(M!==void 0&&!this._skipDefault(M,g,y))return M},f.prototype._encodeValue=function(p,g,y){let m=this._baseState;if(m.parent===null)return m.children[0]._encode(p,g||new r);let M=null;if(this.reporter=g,m.optional&&p===void 0)if(m.default!==null)p=m.default;else return;let E=null,B=!1;if(m.any)M=this._createEncoderBuffer(p);else if(m.choice)M=this._encodeChoice(p,g);else if(m.contains)E=this._getUse(m.contains,y)._encode(p,g),B=!0;else if(m.children)E=m.children.map(function(x){if(x._baseState.tag==="null_")return x._encode(null,g,p);if(x._baseState.key===null)return g.error("Child should have a key");let C=g.enterKey(x._baseState.key);if(typeof p!="object")return g.error("Child expected, but input is not object");let N=x._encode(p[x._baseState.key],g,p);return g.leaveKey(C),N},this).filter(function(x){return x}),E=this._createEncoderBuffer(E);else if(m.tag==="seqof"||m.tag==="setof"){if(!(m.args&&m.args.length===1))return g.error("Too many args for : "+m.tag);if(!Array.isArray(p))return g.error("seqof/setof, but data is not Array");let x=this.clone();x._baseState.implicit=null,E=this._createEncoderBuffer(p.map(function(C){let N=this._baseState;return this._getUse(N.args[0],p)._encode(C,g)},x))}else m.use!==null?M=this._getUse(m.use,y)._encode(p,g):(E=this._encodePrimitive(m.tag,p),B=!0);if(!m.any&&m.choice===null){let x=m.implicit!==null?m.implicit:m.tag,C=m.implicit===null?"universal":"context";x===null?m.use===null&&g.error("Tag could be omitted only for .use()"):m.use===null&&(M=this._encodeComposite(x,B,C,E))}return m.explicit!==null&&(M=this._encodeComposite(m.explicit,!1,"context",M)),M},f.prototype._encodeChoice=function(p,g){let y=this._baseState,m=y.choice[p.type];return m||s(!1,p.type+" not found in "+JSON.stringify(Object.keys(y.choice))),m._encode(p.value,g)},f.prototype._encodePrimitive=function(p,g){let y=this._baseState;if(/str$/.test(p))return this._encodeStr(g,p);if(p==="objid"&&y.args)return this._encodeObjid(g,y.reverseArgs[0],y.args[1]);if(p==="objid")return this._encodeObjid(g,null,null);if(p==="gentime"||p==="utctime")return this._encodeTime(g,p);if(p==="null_")return this._encodeNull();if(p==="int"||p==="enum")return this._encodeInt(g,y.args&&y.reverseArgs[0]);if(p==="bool")return this._encodeBool(g);if(p==="objDesc")return this._encodeStr(g,p);throw new Error("Unsupported tag: "+p)},f.prototype._isNumstr=function(p){return/^[0-9 ]*$/.test(p)},f.prototype._isPrintstr=function(p){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(p)}}),ih=gt(t=>{lt();function i(r){let u={};return Object.keys(r).forEach(function(a){(a|0)==a&&(a=a|0);let s=r[a];u[s]=a}),u}t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=i(t.tagClass),t.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"},t.tagByName=i(t.tag)}),K0=gt((t,i)=>{lt();var r=pe(),u=eh().Buffer,a=nh(),s=ih();function e(l){this.enc="der",this.name=l.name,this.entity=l,this.tree=new o,this.tree._init(l.body)}i.exports=e,e.prototype.encode=function(l,p){return this.tree._encode(l,p).join()};function o(l){a.call(this,"der",l)}r(o,a),o.prototype._encodeComposite=function(l,p,g,y){let m=f(l,p,g,this.reporter);if(y.length<128){let B=u.alloc(2);return B[0]=m,B[1]=y.length,this._createEncoderBuffer([B,y])}let M=1;for(let B=y.length;B>=256;B>>=8)M++;let E=u.alloc(2+M);E[0]=m,E[1]=128|M;for(let B=1+M,x=y.length;x>0;B--,x>>=8)E[B]=x&255;return this._createEncoderBuffer([E,y])},o.prototype._encodeStr=function(l,p){if(p==="bitstr")return this._createEncoderBuffer([l.unused|0,l.data]);if(p==="bmpstr"){let g=u.alloc(l.length*2);for(let y=0;y=40)return this.reporter.error("Second objid identifier OOB");l.splice(0,2,l[0]*40+l[1])}let y=0;for(let E=0;E=128;B>>=7)y++}let m=u.alloc(y),M=m.length-1;for(let E=l.length-1;E>=0;E--){let B=l[E];for(m[M--]=B&127;(B>>=7)>0;)m[M--]=128|B&127}return this._createEncoderBuffer(m)};function c(l){return l<10?"0"+l:l}o.prototype._encodeTime=function(l,p){let g,y=new Date(l);return p==="gentime"?g=[c(y.getUTCFullYear()),c(y.getUTCMonth()+1),c(y.getUTCDate()),c(y.getUTCHours()),c(y.getUTCMinutes()),c(y.getUTCSeconds()),"Z"].join(""):p==="utctime"?g=[c(y.getUTCFullYear()%100),c(y.getUTCMonth()+1),c(y.getUTCDate()),c(y.getUTCHours()),c(y.getUTCMinutes()),c(y.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+p+" time is not supported yet"),this._encodeStr(g,"octstr")},o.prototype._encodeNull=function(){return this._createEncoderBuffer("")},o.prototype._encodeInt=function(l,p){if(typeof l=="string"){if(!p)return this.reporter.error("String int or enum given, but no values map");if(!p.hasOwnProperty(l))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(l));l=p[l]}if(typeof l!="number"&&!u.isBuffer(l)){let m=l.toArray();!l.sign&&m[0]&128&&m.unshift(0),l=u.from(m)}if(u.isBuffer(l)){let m=l.length;l.length===0&&m++;let M=u.alloc(m);return l.copy(M),l.length===0&&(M[0]=0),this._createEncoderBuffer(M)}if(l<128)return this._createEncoderBuffer(l);if(l<256)return this._createEncoderBuffer([0,l]);let g=1;for(let m=l;m>=256;m>>=8)g++;let y=new Array(g);for(let m=y.length-1;m>=0;m--)y[m]=l&255,l>>=8;return y[0]&128&&y.unshift(0),this._createEncoderBuffer(u.from(y))},o.prototype._encodeBool=function(l){return this._createEncoderBuffer(l?255:0)},o.prototype._use=function(l,p){return typeof l=="function"&&(l=l(p)),l._getEncoder("der").tree},o.prototype._skipDefault=function(l,p,g){let y=this._baseState,m;if(y.default===null)return!1;let M=l.join();if(y.defaultBuffer===void 0&&(y.defaultBuffer=this._encodeValue(y.default,p,g).join()),M.length!==y.defaultBuffer.length)return!1;for(m=0;m=31?y.error("Multi-octet tag encoding unsupported"):(p||(m|=32),m|=s.tagClassByName[g||"universal"]<<6,m)}}),Qm=gt((t,i)=>{lt();var r=pe(),u=K0();function a(s){u.call(this,s),this.enc="pem"}r(a,u),i.exports=a,a.prototype.encode=function(s,e){let o=u.prototype.encode.call(this,s).toString("base64"),c=["-----BEGIN "+e.label+"-----"];for(let f=0;f{lt();var i=t;i.der=K0(),i.pem=Qm()}),W0=gt((t,i)=>{lt();var r=pe(),u=sr(),a=ua().DecoderBuffer,s=nh(),e=ih();function o(p){this.enc="der",this.name=p.name,this.entity=p,this.tree=new c,this.tree._init(p.body)}i.exports=o,o.prototype.decode=function(p,g){return a.isDecoderBuffer(p)||(p=new a(p,g)),this.tree._decode(p,g)};function c(p){s.call(this,"der",p)}r(c,s),c.prototype._peekTag=function(p,g,y){if(p.isEmpty())return!1;let m=p.save(),M=f(p,'Failed to peek tag: "'+g+'"');return p.isError(M)?M:(p.restore(m),M.tag===g||M.tagStr===g||M.tagStr+"of"===g||y)},c.prototype._decodeTag=function(p,g,y){let m=f(p,'Failed to decode tag of "'+g+'"');if(p.isError(m))return m;let M=l(p,m.primitive,'Failed to get length of "'+g+'"');if(p.isError(M))return M;if(!y&&m.tag!==g&&m.tagStr!==g&&m.tagStr+"of"!==g)return p.error('Failed to match tag: "'+g+'"');if(m.primitive||M!==null)return p.skip(M,'Failed to match body of: "'+g+'"');let E=p.save(),B=this._skipUntilEnd(p,'Failed to skip indefinite length body: "'+this.tag+'"');return p.isError(B)?B:(M=p.offset-E.offset,p.restore(E),p.skip(M,'Failed to match body of: "'+g+'"'))},c.prototype._skipUntilEnd=function(p,g){for(;;){let y=f(p,g);if(p.isError(y))return y;let m=l(p,y.primitive,g);if(p.isError(m))return m;let M;if(y.primitive||m!==null?M=p.skip(m):M=this._skipUntilEnd(p,g),p.isError(M))return M;if(y.tagStr==="end")break}},c.prototype._decodeList=function(p,g,y,m){let M=[];for(;!p.isEmpty();){let E=this._peekTag(p,"end");if(p.isError(E))return E;let B=y.decode(p,"der",m);if(p.isError(B)&&E)break;M.push(B)}return M},c.prototype._decodeStr=function(p,g){if(g==="bitstr"){let y=p.readUInt8();return p.isError(y)?y:{unused:y,data:p.raw()}}else if(g==="bmpstr"){let y=p.raw();if(y.length%2===1)return p.error("Decoding of string type: bmpstr length mismatch");let m="";for(let M=0;M>6],M=(y&32)===0;if((y&31)===31){let B=y;for(y=0;(B&128)===128;){if(B=p.readUInt8(g),p.isError(B))return B;y<<=7,y|=B&127}}else y&=31;let E=e.tag[y];return{cls:m,primitive:M,tag:y,tagStr:E}}function l(p,g,y){let m=p.readUInt8(y);if(p.isError(m))return m;if(!g&&m===128)return null;if(!(m&128))return m;let M=m&127;if(M>4)return p.error("length octect is too long");m=0;for(let E=0;E{lt();var r=pe(),u=eh().Buffer,a=W0();function s(e){a.call(this,e),this.enc="pem"}r(s,a),i.exports=s,s.prototype.decode=function(e,o){let c=e.toString().split(/[\r\n]+/g),f=o.label.toUpperCase(),l=/^-----(BEGIN|END) ([^-]+)-----$/,p=-1,g=-1;for(let M=0;M{lt();var i=t;i.der=W0(),i.pem=ty()}),$0=gt(t=>{lt();var i=z0(),r=q0(),u=pe(),a=t;a.define=function(e,o){return new s(e,o)};function s(e,o){this.name=e,this.body=o,this.decoders={},this.encoders={}}s.prototype._createNamed=function(e){let o=this.name;function c(f){this._initNamed(f,o)}return u(c,e),c.prototype._initNamed=function(f,l){e.call(this,f,l)},new c(this)},s.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(r[e])),this.decoders[e]},s.prototype.decode=function(e,o,c){return this._getDecoder(o).decode(e,c)},s.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(i[e])),this.encoders[e]},s.prototype.encode=function(e,o,c){return this._getEncoder(o).encode(e,c)}}),ey=gt(t=>{lt();var i=t;i.Reporter=rh().Reporter,i.DecoderBuffer=ua().DecoderBuffer,i.EncoderBuffer=ua().EncoderBuffer,i.Node=nh()}),ry=gt(t=>{lt();var i=t;i._reverse=function(r){let u={};return Object.keys(r).forEach(function(a){(a|0)==a&&(a=a|0);let s=r[a];u[s]=a}),u},i.der=ih()}),H0=gt(t=>{lt();var i=t;i.bignum=sr(),i.define=$0().define,i.base=ey(),i.constants=ry(),i.decoders=q0(),i.encoders=z0()}),ny=gt((t,i)=>{lt();var r=H0(),u=r.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),a=r.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),s=r.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),e=r.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())}),o=r.define("RelativeDistinguishedName",function(){this.setof(a)}),c=r.define("RDNSequence",function(){this.seqof(o)}),f=r.define("Name",function(){this.choice({rdnSequence:this.use(c)})}),l=r.define("Validity",function(){this.seq().obj(this.key("notBefore").use(u),this.key("notAfter").use(u))}),p=r.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),g=r.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(s),this.key("issuer").use(f),this.key("validity").use(l),this.key("subject").use(f),this.key("subjectPublicKeyInfo").use(e),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(p).optional())}),y=r.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(g),this.key("signatureAlgorithm").use(s),this.key("signatureValue").bitstr())});i.exports=y}),iy=gt(t=>{lt();var i=H0();t.certificate=ny();var r=i.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())});t.RSAPrivateKey=r;var u=i.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.RSAPublicKey=u;var a=i.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())});t.PublicKey=a;var s=i.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())}),e=i.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(s),this.key("subjectPrivateKey").octstr())});t.PrivateKey=e;var o=i.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())});t.EncryptedPrivateKey=o;var c=i.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())});t.DSAPrivateKey=c,t.DSAparam=i.define("DSAparam",function(){this.int()});var f=i.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(l),this.key("publicKey").optional().explicit(1).bitstr())});t.ECPrivateKey=f;var l=i.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});t.signature=i.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})}),ay=gt((t,i)=>{i.exports={"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"}}),oy=gt((t,i)=>{lt();var r=/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,u=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,a=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,s=ts(),e=Xu(),o=Ee().Buffer;i.exports=function(c,f){var l=c.toString(),p=l.match(r),g;if(p){var y="aes"+p[1],m=o.from(p[2],"hex"),M=o.from(p[3].replace(/[\r\n]/g,""),"base64"),E=s(f,m.slice(0,8),parseInt(p[1],10)).key,B=[],x=e.createDecipheriv(y,E,m);B.push(x.update(M)),B.push(x.final()),g=o.concat(B)}else{var C=l.match(a);g=o.from(C[2].replace(/[\r\n]/g,""),"base64")}var N=l.match(u)[1];return{tag:N,data:g}}}),ns=gt((t,i)=>{lt();var r=iy(),u=ay(),a=oy(),s=Xu(),e=M0(),o=Ee().Buffer;i.exports=c;function c(l){var p;typeof l=="object"&&!o.isBuffer(l)&&(p=l.passphrase,l=l.key),typeof l=="string"&&(l=o.from(l));var g=a(l,p),y=g.tag,m=g.data,M,E;switch(y){case"CERTIFICATE":E=r.certificate.decode(m,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(E||(E=r.PublicKey.decode(m,"der")),M=E.algorithm.algorithm.join("."),M){case"1.2.840.113549.1.1.1":return r.RSAPublicKey.decode(E.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return E.subjectPrivateKey=E.subjectPublicKey,{type:"ec",data:E};case"1.2.840.10040.4.1":return E.algorithm.params.pub_key=r.DSAparam.decode(E.subjectPublicKey.data,"der"),{type:"dsa",data:E.algorithm.params};default:throw new Error("unknown key id "+M)}case"ENCRYPTED PRIVATE KEY":m=r.EncryptedPrivateKey.decode(m,"der"),m=f(m,p);case"PRIVATE KEY":switch(E=r.PrivateKey.decode(m,"der"),M=E.algorithm.algorithm.join("."),M){case"1.2.840.113549.1.1.1":return r.RSAPrivateKey.decode(E.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:E.algorithm.curve,privateKey:r.ECPrivateKey.decode(E.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return E.algorithm.params.priv_key=r.DSAparam.decode(E.subjectPrivateKey,"der"),{type:"dsa",params:E.algorithm.params};default:throw new Error("unknown key id "+M)}case"RSA PUBLIC KEY":return r.RSAPublicKey.decode(m,"der");case"RSA PRIVATE KEY":return r.RSAPrivateKey.decode(m,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:r.DSAPrivateKey.decode(m,"der")};case"EC PRIVATE KEY":return m=r.ECPrivateKey.decode(m,"der"),{curve:m.parameters.value,privateKey:m.privateKey};default:throw new Error("unknown key type "+y)}}c.signature=r.signature;function f(l,p){var g=l.algorithm.decrypt.kde.kdeparams.salt,y=parseInt(l.algorithm.decrypt.kde.kdeparams.iters.toString(),10),m=u[l.algorithm.decrypt.cipher.algo.join(".")],M=l.algorithm.decrypt.cipher.iv,E=l.subjectPrivateKey,B=parseInt(m.split("-")[1],10)/8,x=e.pbkdf2Sync(p,g,y,B,"sha1"),C=s.createDecipheriv(m,x,M),N=[];return N.push(C.update(E)),N.push(C.final()),o.concat(N)}}),G0=gt((t,i)=>{i.exports={"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"}}),sy=gt((t,i)=>{lt();var r=Ee().Buffer,u=w0(),a=Qu(),s=rs().ec,e=F0(),o=ns(),c=G0(),f=1;function l(C,N,F,I,U){var P=o(N);if(P.curve){if(I!=="ecdsa"&&I!=="ecdsa/rsa")throw new Error("wrong private key type");return p(C,P)}else if(P.type==="dsa"){if(I!=="dsa")throw new Error("wrong private key type");return g(C,P,F)}if(I!=="rsa"&&I!=="ecdsa/rsa")throw new Error("wrong private key type");if(N.padding!==void 0&&N.padding!==f)throw new Error("illegal or unsupported padding mode");C=r.concat([U,C]);for(var D=P.modulus.byteLength(),W=[0,1];C.length+W.length+10&&F.ishrn(I),F}function E(C,N){C=M(C,N),C=C.mod(N);var F=r.from(C.toArray());if(F.length{lt();var r=Ee().Buffer,u=F0(),a=rs().ec,s=ns(),e=G0();function o(p,g,y,m,M){var E=s(y);if(E.type==="ec"){if(m!=="ecdsa"&&m!=="ecdsa/rsa")throw new Error("wrong public key type");return c(p,g,E)}else if(E.type==="dsa"){if(m!=="dsa")throw new Error("wrong public key type");return f(p,g,E)}if(m!=="rsa"&&m!=="ecdsa/rsa")throw new Error("wrong public key type");g=r.concat([M,g]);for(var B=E.modulus.byteLength(),x=[1],C=0;g.length+x.length+2=0)throw new Error("invalid sig")}i.exports=o}),hy=gt((t,i)=>{lt();var r=Ee().Buffer,u=Ea(),a=kr(),s=pe(),e=sy(),o=uy(),c=_0();Object.keys(c).forEach(function(y){c[y].id=r.from(c[y].id,"hex"),c[y.toLowerCase()]=c[y]});function f(y){a.Writable.call(this);var m=c[y];if(!m)throw new Error("Unknown message digest");this._hashType=m.hash,this._hash=u(m.hash),this._tag=m.id,this._signType=m.sign}s(f,a.Writable),f.prototype._write=function(y,m,M){this._hash.update(y),M()},f.prototype.update=function(y,m){return this._hash.update(typeof y=="string"?r.from(y,m):y),this},f.prototype.sign=function(y,m){this.end();var M=this._hash.digest(),E=e(M,y,this._hashType,this._signType,this._tag);return m?E.toString(m):E};function l(y){a.Writable.call(this);var m=c[y];if(!m)throw new Error("Unknown message digest");this._hash=u(m.hash),this._tag=m.id,this._signType=m.sign}s(l,a.Writable),l.prototype._write=function(y,m,M){this._hash.update(y),M()},l.prototype.update=function(y,m){return this._hash.update(typeof y=="string"?r.from(y,m):y),this},l.prototype.verify=function(y,m,M){var E=typeof m=="string"?r.from(m,M):m;this.end();var B=this._hash.digest();return o(E,B,y,this._signType,this._tag)};function p(y){return new f(y)}function g(y){return new l(y)}i.exports={Sign:p,Verify:g,createSign:p,createVerify:g}}),ly=gt((t,i)=>{lt();var r=rs(),u=sr();i.exports=function(o){return new s(o)};var a={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}};a.p224=a.secp224r1,a.p256=a.secp256r1=a.prime256v1,a.p192=a.secp192r1=a.prime192v1,a.p384=a.secp384r1,a.p521=a.secp521r1;function s(o){this.curveType=a[o],this.curveType||(this.curveType={name:o}),this.curve=new r.ec(this.curveType.name),this.keys=void 0}s.prototype.generateKeys=function(o,c){return this.keys=this.curve.genKeyPair(),this.getPublicKey(o,c)},s.prototype.computeSecret=function(o,c,f){c=c||"utf8",Ut.Buffer.isBuffer(o)||(o=new Ut.Buffer(o,c));var l=this.curve.keyFromPublic(o).getPublic(),p=l.mul(this.keys.getPrivate()).getX();return e(p,f,this.curveType.byteLength)},s.prototype.getPublicKey=function(o,c){var f=this.keys.getPublic(c==="compressed",!0);return c==="hybrid"&&(f[f.length-1]%2?f[0]=7:f[0]=6),e(f,o)},s.prototype.getPrivateKey=function(o){return e(this.keys.getPrivate(),o)},s.prototype.setPublicKey=function(o,c){return c=c||"utf8",Ut.Buffer.isBuffer(o)||(o=new Ut.Buffer(o,c)),this.keys._importPublic(o),this},s.prototype.setPrivateKey=function(o,c){c=c||"utf8",Ut.Buffer.isBuffer(o)||(o=new Ut.Buffer(o,c));var f=new u(o);return f=f.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(f),this};function e(o,c,f){Array.isArray(o)||(o=o.toArray());var l=new Ut.Buffer(o);if(f&&l.length{lt();var r=Ea(),u=Ee().Buffer;i.exports=function(s,e){for(var o=u.alloc(0),c=0,f;o.length{lt(),i.exports=function(r,u){for(var a=r.length,s=-1;++s{lt();var r=sr(),u=Ee().Buffer;function a(s,e){return u.from(s.toRed(r.mont(e.modulus)).redPow(new r(e.publicExponent)).fromRed().toArray())}i.exports=a}),fy=gt((t,i)=>{lt();var r=ns(),u=Fi(),a=Ea(),s=V0(),e=Z0(),o=sr(),c=J0(),f=Qu(),l=Ee().Buffer;i.exports=function(m,M,E){var B;m.padding?B=m.padding:E?B=1:B=4;var x=r(m),C;if(B===4)C=p(x,M);else if(B===1)C=g(x,M,E);else if(B===3){if(C=new o(M),C.cmp(x.modulus)>=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return E?f(C,x):c(C,x)};function p(m,M){var E=m.modulus.byteLength(),B=M.length,x=a("sha1").update(l.alloc(0)).digest(),C=x.length,N=2*C;if(B>E-N-2)throw new Error("message too long");var F=l.alloc(E-B-N-2),I=E-C-1,U=u(C),P=e(l.concat([x,F,l.alloc(1,1),M],I),s(U,I)),D=e(U,s(P,C));return new o(l.concat([l.alloc(1),D,P],E))}function g(m,M,E){var B=M.length,x=m.modulus.byteLength();if(B>x-11)throw new Error("message too long");var C;return E?C=l.alloc(x-B-3,255):C=y(x-B-3),new o(l.concat([l.from([0,E?1:2]),C,l.alloc(1),M],x))}function y(m){for(var M=l.allocUnsafe(m),E=0,B=u(m*2),x=0,C;E{lt();var r=ns(),u=V0(),a=Z0(),s=sr(),e=Qu(),o=Ea(),c=J0(),f=Ee().Buffer;i.exports=function(y,m,M){var E;y.padding?E=y.padding:M?E=1:E=4;var B=r(y),x=B.modulus.byteLength();if(m.length>x||new s(m).cmp(B.modulus)>=0)throw new Error("decryption error");var C;M?C=c(new s(m),B):C=e(m,B);var N=f.alloc(x-C.length);if(C=f.concat([N,C],x),E===4)return l(B,C);if(E===1)return p(B,C,M);if(E===3)return C;throw new Error("unknown padding")};function l(y,m){var M=y.modulus.byteLength(),E=o("sha1").update(f.alloc(0)).digest(),B=E.length;if(m[0]!==0)throw new Error("decryption error");var x=m.slice(1,B+1),C=m.slice(B+1),N=a(x,u(C,B)),F=a(C,u(N,M-B-1));if(g(E,F.slice(0,B)))throw new Error("decryption error");for(var I=B;F[I]===0;)I++;if(F[I++]!==1)throw new Error("decryption error");return F.slice(I)}function p(y,m,M){for(var E=m.slice(0,2),B=2,x=0;m[B++]!==0;)if(B>=m.length){x++;break}var C=m.slice(2,B-1);if((E.toString("hex")!=="0002"&&!M||E.toString("hex")!=="0001"&&M)&&x++,C.length<8&&x++,x)throw new Error("decryption error");return m.slice(B)}function g(y,m){y=f.from(y),m=f.from(m);var M=0,E=y.length;y.length!==m.length&&(M++,E=Math.min(y.length,m.length));for(var B=-1;++B{lt(),t.publicEncrypt=fy(),t.privateDecrypt=cy(),t.privateEncrypt=function(i,r){return t.publicEncrypt(i,r,!0)},t.publicDecrypt=function(i,r){return t.privateDecrypt(i,r,!0)}}),py=gt(t=>{lt();function i(){throw new Error(`secure random number generation not supported by this browser use chrome, FireFox or Internet Explorer 11`)}var r=Ee(),u=Fi(),a=r.Buffer,s=r.kMaxLength,e=le.crypto||le.msCrypto,o=Math.pow(2,32)-1;function c(y,m){if(typeof y!="number"||y!==y)throw new TypeError("offset must be a number");if(y>o||y<0)throw new TypeError("offset must be a uint32");if(y>s||y>m)throw new RangeError("offset out of range")}function f(y,m,M){if(typeof y!="number"||y!==y)throw new TypeError("size must be a number");if(y>o||y<0)throw new TypeError("size must be a uint32");if(y+m>M||y>s)throw new RangeError("buffer too small")}e&&e.getRandomValues||!Jt.default.browser?(t.randomFill=l,t.randomFillSync=g):(t.randomFill=i,t.randomFillSync=i);function l(y,m,M,E){if(!a.isBuffer(y)&&!(y instanceof le.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof m=="function")E=m,m=0,M=y.length;else if(typeof M=="function")E=M,M=y.length-m;else if(typeof E!="function")throw new TypeError('"cb" argument must be a function');return c(m,y.length),f(M,m,y.length),p(y,m,M,E)}function p(y,m,M,E){if(Jt.default.browser){var B=y.buffer,x=new Uint8Array(B,m,M);if(e.getRandomValues(x),E){Jt.default.nextTick(function(){E(null,y)});return}return y}if(E){u(M,function(N,F){if(N)return E(N);F.copy(y,m),E(null,y)});return}var C=u(M);return C.copy(y,m),y}function g(y,m,M){if(typeof m>"u"&&(m=0),!a.isBuffer(y)&&!(y instanceof le.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return c(m,y.length),M===void 0&&(M=y.length-m),f(M,m,y.length),p(y,m,M)}}),gi=gt(t=>{lt(),t.randomBytes=t.rng=t.pseudoRandomBytes=t.prng=Fi(),t.createHash=t.Hash=Ea(),t.createHmac=t.Hmac=w0();var i=pm(),r=Object.keys(i),u=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(r);t.getHashes=function(){return u};var a=M0();t.pbkdf2=a.pbkdf2,t.pbkdf2Sync=a.pbkdf2Sync;var s=Im();t.Cipher=s.Cipher,t.createCipher=s.createCipher,t.Cipheriv=s.Cipheriv,t.createCipheriv=s.createCipheriv,t.Decipher=s.Decipher,t.createDecipher=s.createDecipher,t.Decipheriv=s.Decipheriv,t.createDecipheriv=s.createDecipheriv,t.getCiphers=s.getCiphers,t.listCiphers=s.listCiphers;var e=Pm();t.DiffieHellmanGroup=e.DiffieHellmanGroup,t.createDiffieHellmanGroup=e.createDiffieHellmanGroup,t.getDiffieHellman=e.getDiffieHellman,t.createDiffieHellman=e.createDiffieHellman,t.DiffieHellman=e.DiffieHellman;var o=hy();t.createSign=o.createSign,t.Sign=o.Sign,t.createVerify=o.createVerify,t.Verify=o.Verify,t.createECDH=ly();var c=dy();t.publicEncrypt=c.publicEncrypt,t.privateEncrypt=c.privateEncrypt,t.publicDecrypt=c.publicDecrypt,t.privateDecrypt=c.privateDecrypt;var f=py();t.randomFill=f.randomFill,t.randomFillSync=f.randomFillSync,t.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join(` -`))},t.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}}),gy=gt((t,i)=>{lt();function r(u,a){typeof a=="boolean"&&(a={forever:a}),this._originalTimeouts=JSON.parse(JSON.stringify(u)),this._timeouts=u,this._options=a||{},this._maxRetryTime=a&&a.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}i.exports=r,r.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},r.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},r.prototype.retry=function(u){if(this._timeout&&clearTimeout(this._timeout),!u)return!1;var a=new Date().getTime();if(u&&a-this._operationStart>=this._maxRetryTime)return this._errors.push(u),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(u);var s=this._timeouts.shift();if(s===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),s=this._cachedTimeouts.slice(-1);else return!1;var e=this;return this._timer=setTimeout(function(){e._attempts++,e._operationTimeoutCb&&(e._timeout=setTimeout(function(){e._operationTimeoutCb(e._attempts)},e._operationTimeout),e._options.unref&&e._timeout.unref()),e._fn(e._attempts)},s),this._options.unref&&this._timer.unref(),!0},r.prototype.attempt=function(u,a){this._fn=u,a&&(a.timeout&&(this._operationTimeout=a.timeout),a.cb&&(this._operationTimeoutCb=a.cb));var s=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){s._operationTimeoutCb()},s._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},r.prototype.try=function(u){console.log("Using RetryOperation.try() is deprecated"),this.attempt(u)},r.prototype.start=function(u){console.log("Using RetryOperation.start() is deprecated"),this.attempt(u)},r.prototype.start=r.prototype.try,r.prototype.errors=function(){return this._errors},r.prototype.attempts=function(){return this._attempts},r.prototype.mainError=function(){if(this._errors.length===0)return null;for(var u={},a=null,s=0,e=0;e=s&&(a=o,s=f)}return a}}),my=gt(t=>{lt();var i=gy();t.operation=function(r){var u=t.timeouts(r);return new i(u,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},t.timeouts=function(r){if(r instanceof Array)return[].concat(r);var u={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var a in r)u[a]=r[a];if(u.minTimeout>u.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var s=[],e=0;e{lt(),i.exports=my()}),by=gt((t,i)=>{lt();var r=yy();function u(a,s){function e(o,c){var f=s||{},l;"randomize"in f||(f.randomize=!0),l=r.operation(f);function p(m){c(m||new Error("Aborted"))}function g(m,M){if(m.bail){p(m);return}l.retry(m)?f.onRetry&&f.onRetry(m,M):c(l.mainError())}function y(m){var M;try{M=a(p,m)}catch(E){g(E,m);return}Promise.resolve(M).then(o).catch(function(E){g(E,m)})}l.attempt(y)}return new Promise(e)}i.exports=u}),vy=gt((t,i)=>{lt(),function(){var r="input is invalid type",u="finalize already called",a=typeof window=="object",s=a?window:{};s.JS_SHA3_NO_WINDOW&&(a=!1);var e=!a&&typeof self=="object",o=!s.JS_SHA3_NO_NODE_JS&&typeof Jt.default=="object"&&Jt.default.versions&&Jt.default.versions.node;o?s=le:e&&(s=self);var c=!s.JS_SHA3_NO_COMMON_JS&&typeof i=="object"&&i.exports,f=typeof define=="function"&&define.amd,l=!s.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),g=[31,7936,2031616,520093696],y=[4,1024,262144,67108864],m=[1,256,65536,16777216],M=[6,1536,393216,100663296],E=[0,8,16,24],B=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],x=[224,256,384,512],C=[128,256],N=["hex","buffer","arrayBuffer","array","digest"],F={128:168,256:136};(s.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(et){return Object.prototype.toString.call(et)==="[object Array]"}),l&&(s.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(et){return typeof et=="object"&&et.buffer&&et.buffer.constructor===ArrayBuffer});for(var I=function(et,at,$){return function(J){return new tt(et,at,et).update(J)[$]()}},U=function(et,at,$){return function(J,R){return new tt(et,at,R).update(J)[$]()}},P=function(et,at,$){return function(J,R,j,z){return v["cshake"+et].update(J,R,j,z)[$]()}},D=function(et,at,$){return function(J,R,j,z){return v["kmac"+et].update(J,R,j,z)[$]()}},W=function(et,at,$,J){for(var R=0;R>5,this.byteCount=this.blockCount<<2,this.outputBlocks=$>>5,this.extraBytes=($&31)>>3;for(var J=0;J<50;++J)this.s[J]=0}tt.prototype.update=function(et){if(this.finalized)throw new Error(u);var at,$=typeof et;if($!=="string"){if($==="object"){if(et===null)throw new Error(r);if(l&&et.constructor===ArrayBuffer)et=new Uint8Array(et);else if(!Array.isArray(et)&&(!l||!ArrayBuffer.isView(et)))throw new Error(r)}else throw new Error(r);at=!0}for(var J=this.blocks,R=this.byteCount,j=et.length,z=this.blockCount,Z=0,Q=this.s,K,G;Z>2]|=et[Z]<>2]|=G<>2]|=(192|G>>6)<>2]|=(128|G&63)<=57344?(J[K>>2]|=(224|G>>12)<>2]|=(128|G>>6&63)<>2]|=(128|G&63)<>2]|=(240|G>>18)<>2]|=(128|G>>12&63)<>2]|=(128|G>>6&63)<>2]|=(128|G&63)<=R){for(this.start=K-R,this.block=J[z],K=0;K>8,$=et&255;$>0;)R.unshift($),et=et>>8,$=et&255,++J;return at?R.push(J):R.unshift(J),this.update(R),R.length},tt.prototype.encodeString=function(et){var at,$=typeof et;if($!=="string"){if($==="object"){if(et===null)throw new Error(r);if(l&&et.constructor===ArrayBuffer)et=new Uint8Array(et);else if(!Array.isArray(et)&&(!l||!ArrayBuffer.isView(et)))throw new Error(r)}else throw new Error(r);at=!0}var J=0,R=et.length;if(at)J=R;else for(var j=0;j=57344?J+=3:(z=65536+((z&1023)<<10|et.charCodeAt(++j)&1023),J+=4)}return J+=this.encode(J*8),this.update(et),J},tt.prototype.bytepad=function(et,at){for(var $=this.encode(at),J=0;J>2]|=this.padding[at&3],this.lastByteIndex===this.byteCount)for(et[0]=et[$],at=1;at<$+1;++at)et[at]=0;for(et[$-1]|=2147483648,at=0;at<$;++at)J[at]^=et[at];ft(J)}},tt.prototype.toString=tt.prototype.hex=function(){this.finalize();for(var et=this.blockCount,at=this.s,$=this.outputBlocks,J=this.extraBytes,R=0,j=0,z="",Z;j<$;){for(R=0;R>4&15]+p[Z&15]+p[Z>>12&15]+p[Z>>8&15]+p[Z>>20&15]+p[Z>>16&15]+p[Z>>28&15]+p[Z>>24&15];j%et===0&&(ft(at),R=0)}return J&&(Z=at[R],z+=p[Z>>4&15]+p[Z&15],J>1&&(z+=p[Z>>12&15]+p[Z>>8&15]),J>2&&(z+=p[Z>>20&15]+p[Z>>16&15])),z},tt.prototype.arrayBuffer=function(){this.finalize();var et=this.blockCount,at=this.s,$=this.outputBlocks,J=this.extraBytes,R=0,j=0,z=this.outputBits>>3,Z;J?Z=new ArrayBuffer($+1<<2):Z=new ArrayBuffer(z);for(var Q=new Uint32Array(Z);j<$;){for(R=0;R>8&255,z[Z+2]=Q>>16&255,z[Z+3]=Q>>24&255;j%et===0&&ft(at)}return J&&(Z=j<<2,Q=at[R],z[Z]=Q&255,J>1&&(z[Z+1]=Q>>8&255),J>2&&(z[Z+2]=Q>>16&255)),z};function X(et,at,$){tt.call(this,et,at,$)}X.prototype=new tt,X.prototype.finalize=function(){return this.encode(this.outputBits,!0),tt.prototype.finalize.call(this)};var ft=function(et){var at,$,J,R,j,z,Z,Q,K,G,H,Y,it,ot,mt,_t,ht,vt,pt,V,rt,st,yt,Ct,dt,Mt,Lt,wt,ct,Et,ut,Ot,qt,nt,Rt,Dt,bt,Tt,jt,St,kt,Kt,At,Nt,$t,Ft,Wt,ae,Xt,Gt,he,Qt,Zt,se,te,re,Se,Be,Re,Te,xe,Ce,Ue;for(J=0;J<48;J+=2)R=et[0]^et[10]^et[20]^et[30]^et[40],j=et[1]^et[11]^et[21]^et[31]^et[41],z=et[2]^et[12]^et[22]^et[32]^et[42],Z=et[3]^et[13]^et[23]^et[33]^et[43],Q=et[4]^et[14]^et[24]^et[34]^et[44],K=et[5]^et[15]^et[25]^et[35]^et[45],G=et[6]^et[16]^et[26]^et[36]^et[46],H=et[7]^et[17]^et[27]^et[37]^et[47],Y=et[8]^et[18]^et[28]^et[38]^et[48],it=et[9]^et[19]^et[29]^et[39]^et[49],at=Y^(z<<1|Z>>>31),$=it^(Z<<1|z>>>31),et[0]^=at,et[1]^=$,et[10]^=at,et[11]^=$,et[20]^=at,et[21]^=$,et[30]^=at,et[31]^=$,et[40]^=at,et[41]^=$,at=R^(Q<<1|K>>>31),$=j^(K<<1|Q>>>31),et[2]^=at,et[3]^=$,et[12]^=at,et[13]^=$,et[22]^=at,et[23]^=$,et[32]^=at,et[33]^=$,et[42]^=at,et[43]^=$,at=z^(G<<1|H>>>31),$=Z^(H<<1|G>>>31),et[4]^=at,et[5]^=$,et[14]^=at,et[15]^=$,et[24]^=at,et[25]^=$,et[34]^=at,et[35]^=$,et[44]^=at,et[45]^=$,at=Q^(Y<<1|it>>>31),$=K^(it<<1|Y>>>31),et[6]^=at,et[7]^=$,et[16]^=at,et[17]^=$,et[26]^=at,et[27]^=$,et[36]^=at,et[37]^=$,et[46]^=at,et[47]^=$,at=G^(R<<1|j>>>31),$=H^(j<<1|R>>>31),et[8]^=at,et[9]^=$,et[18]^=at,et[19]^=$,et[28]^=at,et[29]^=$,et[38]^=at,et[39]^=$,et[48]^=at,et[49]^=$,ot=et[0],mt=et[1],Ft=et[11]<<4|et[10]>>>28,Wt=et[10]<<4|et[11]>>>28,wt=et[20]<<3|et[21]>>>29,ct=et[21]<<3|et[20]>>>29,Te=et[31]<<9|et[30]>>>23,xe=et[30]<<9|et[31]>>>23,Kt=et[40]<<18|et[41]>>>14,At=et[41]<<18|et[40]>>>14,nt=et[2]<<1|et[3]>>>31,Rt=et[3]<<1|et[2]>>>31,_t=et[13]<<12|et[12]>>>20,ht=et[12]<<12|et[13]>>>20,ae=et[22]<<10|et[23]>>>22,Xt=et[23]<<10|et[22]>>>22,Et=et[33]<<13|et[32]>>>19,ut=et[32]<<13|et[33]>>>19,Ce=et[42]<<2|et[43]>>>30,Ue=et[43]<<2|et[42]>>>30,se=et[5]<<30|et[4]>>>2,te=et[4]<<30|et[5]>>>2,Dt=et[14]<<6|et[15]>>>26,bt=et[15]<<6|et[14]>>>26,vt=et[25]<<11|et[24]>>>21,pt=et[24]<<11|et[25]>>>21,Gt=et[34]<<15|et[35]>>>17,he=et[35]<<15|et[34]>>>17,Ot=et[45]<<29|et[44]>>>3,qt=et[44]<<29|et[45]>>>3,Ct=et[6]<<28|et[7]>>>4,dt=et[7]<<28|et[6]>>>4,re=et[17]<<23|et[16]>>>9,Se=et[16]<<23|et[17]>>>9,Tt=et[26]<<25|et[27]>>>7,jt=et[27]<<25|et[26]>>>7,V=et[36]<<21|et[37]>>>11,rt=et[37]<<21|et[36]>>>11,Qt=et[47]<<24|et[46]>>>8,Zt=et[46]<<24|et[47]>>>8,Nt=et[8]<<27|et[9]>>>5,$t=et[9]<<27|et[8]>>>5,Mt=et[18]<<20|et[19]>>>12,Lt=et[19]<<20|et[18]>>>12,Be=et[29]<<7|et[28]>>>25,Re=et[28]<<7|et[29]>>>25,St=et[38]<<8|et[39]>>>24,kt=et[39]<<8|et[38]>>>24,st=et[48]<<14|et[49]>>>18,yt=et[49]<<14|et[48]>>>18,et[0]=ot^~_t&vt,et[1]=mt^~ht&pt,et[10]=Ct^~Mt&wt,et[11]=dt^~Lt&ct,et[20]=nt^~Dt&Tt,et[21]=Rt^~bt&jt,et[30]=Nt^~Ft&ae,et[31]=$t^~Wt&Xt,et[40]=se^~re&Be,et[41]=te^~Se&Re,et[2]=_t^~vt&V,et[3]=ht^~pt&rt,et[12]=Mt^~wt&Et,et[13]=Lt^~ct&ut,et[22]=Dt^~Tt&St,et[23]=bt^~jt&kt,et[32]=Ft^~ae&Gt,et[33]=Wt^~Xt&he,et[42]=re^~Be&Te,et[43]=Se^~Re&xe,et[4]=vt^~V&st,et[5]=pt^~rt&yt,et[14]=wt^~Et&Ot,et[15]=ct^~ut&qt,et[24]=Tt^~St&Kt,et[25]=jt^~kt&At,et[34]=ae^~Gt&Qt,et[35]=Xt^~he&Zt,et[44]=Be^~Te&Ce,et[45]=Re^~xe&Ue,et[6]=V^~st&ot,et[7]=rt^~yt&mt,et[16]=Et^~Ot&Ct,et[17]=ut^~qt&dt,et[26]=St^~Kt&nt,et[27]=kt^~At&Rt,et[36]=Gt^~Qt&Nt,et[37]=he^~Zt&$t,et[46]=Te^~Ce&se,et[47]=xe^~Ue&te,et[8]=st^~ot&_t,et[9]=yt^~mt&ht,et[18]=Ot^~Ct&Mt,et[19]=qt^~dt&Lt,et[28]=Kt^~nt&Dt,et[29]=At^~Rt&bt,et[38]=Qt^~Nt&Ft,et[39]=Zt^~$t&Wt,et[48]=Ce^~se&re,et[49]=Ue^~te&Se,et[0]^=B[J],et[1]^=B[J+1]};if(c)i.exports=v;else{for(T=0;T{lt(),function(r,u){function a(n,d){if(!n)throw new Error(d||"Assertion failed")}function s(n,d){n.super_=d;var v=function(){};v.prototype=d.prototype,n.prototype=new v,n.prototype.constructor=n}function e(n,d,v){if(e.isBN(n))return n;this.negative=0,this.words=null,this.length=0,this.red=null,n!==null&&((d==="le"||d==="be")&&(v=d,d=10),this._init(n||0,d||10,v||"be"))}typeof r=="object"?r.exports=e:u.BN=e,e.BN=e,e.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=$e().Buffer}catch{}e.isBN=function(n){return n instanceof e?!0:n!==null&&typeof n=="object"&&n.constructor.wordSize===e.wordSize&&Array.isArray(n.words)},e.max=function(n,d){return n.cmp(d)>0?n:d},e.min=function(n,d){return n.cmp(d)<0?n:d},e.prototype._init=function(n,d,v){if(typeof n=="number")return this._initNumber(n,d,v);if(typeof n=="object")return this._initArray(n,d,v);d==="hex"&&(d=16),a(d===(d|0)&&d>=2&&d<=36),n=n.toString().replace(/\s+/g,"");var A=0;n[0]==="-"&&(A++,this.negative=1),A=0;A-=3)S=n[A]|n[A-1]<<8|n[A-2]<<16,this.words[T]|=S<>>26-w&67108863,w+=24,w>=26&&(w-=26,T++);else if(v==="le")for(A=0,T=0;A>>26-w&67108863,w+=24,w>=26&&(w-=26,T++);return this._strip()};function c(n,d){var v=n.charCodeAt(d);if(v>=48&&v<=57)return v-48;if(v>=65&&v<=70)return v-55;if(v>=97&&v<=102)return v-87;a(!1,"Invalid character in "+n)}function f(n,d,v){var A=c(n,v);return v-1>=d&&(A|=c(n,v-1)<<4),A}e.prototype._parseHex=function(n,d,v){this.length=Math.ceil((n.length-d)/6),this.words=new Array(this.length);for(var A=0;A=d;A-=2)w=f(n,d,A)<=18?(T-=18,S+=1,this.words[S]|=w>>>26):T+=8;else{var b=n.length-d;for(A=b%2===0?d+1:d;A=18?(T-=18,S+=1,this.words[S]|=w>>>26):T+=8}this._strip()};function l(n,d,v,A){for(var T=0,S=0,w=Math.min(n.length,v),b=d;b=49?S=h-49+10:h>=17?S=h-17+10:S=h,a(h>=0&&S1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},e.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{e.prototype[Symbol.for("nodejs.util.inspect.custom")]=g}catch{e.prototype.inspect=g}else e.prototype.inspect=g;function g(){return(this.red?""}var y=["","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],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];e.prototype.toString=function(n,d){n=n||10,d=d|0||1;var v;if(n===16||n==="hex"){v="";for(var A=0,T=0,S=0;S>>24-A&16777215,A+=2,A>=26&&(A-=26,S--),T!==0||S!==this.length-1?v=y[6-b.length]+b+v:v=b+v}for(T!==0&&(v=T.toString(16)+v);v.length%d!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(n===(n|0)&&n>=2&&n<=36){var h=m[n],k=M[n];v="";var tt=this.clone();for(tt.negative=0;!tt.isZero();){var X=tt.modrn(k).toString(n);tt=tt.idivn(k),tt.isZero()?v=X+v:v=y[h-X.length]+X+v}for(this.isZero()&&(v="0"+v);v.length%d!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}a(!1,"Base should be between 2 and 36")},e.prototype.toNumber=function(){var n=this.words[0];return this.length===2?n+=this.words[1]*67108864:this.length===3&&this.words[2]===1?n+=4503599627370496+this.words[1]*67108864:this.length>2&&a(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-n:n},e.prototype.toJSON=function(){return this.toString(16,2)},o&&(e.prototype.toBuffer=function(n,d){return this.toArrayLike(o,n,d)}),e.prototype.toArray=function(n,d){return this.toArrayLike(Array,n,d)};var E=function(n,d){return n.allocUnsafe?n.allocUnsafe(d):new n(d)};e.prototype.toArrayLike=function(n,d,v){this._strip();var A=this.byteLength(),T=v||Math.max(1,A);a(A<=T,"byte array longer than desired length"),a(T>0,"Requested array length <= 0");var S=E(n,T),w=d==="le"?"LE":"BE";return this["_toArrayLike"+w](S,A),S},e.prototype._toArrayLikeLE=function(n,d){for(var v=0,A=0,T=0,S=0;T>8&255),v>16&255),S===6?(v>24&255),A=0,S=0):(A=w>>>24,S+=2)}if(v=0&&(n[v--]=w>>8&255),v>=0&&(n[v--]=w>>16&255),S===6?(v>=0&&(n[v--]=w>>24&255),A=0,S=0):(A=w>>>24,S+=2)}if(v>=0)for(n[v--]=A;v>=0;)n[v--]=0},Math.clz32?e.prototype._countBits=function(n){return 32-Math.clz32(n)}:e.prototype._countBits=function(n){var d=n,v=0;return d>=4096&&(v+=13,d>>>=13),d>=64&&(v+=7,d>>>=7),d>=8&&(v+=4,d>>>=4),d>=2&&(v+=2,d>>>=2),v+d},e.prototype._zeroBits=function(n){if(n===0)return 26;var d=n,v=0;return!(d&8191)&&(v+=13,d>>>=13),!(d&127)&&(v+=7,d>>>=7),!(d&15)&&(v+=4,d>>>=4),!(d&3)&&(v+=2,d>>>=2),!(d&1)&&v++,v},e.prototype.bitLength=function(){var n=this.words[this.length-1],d=this._countBits(n);return(this.length-1)*26+d};function B(n){for(var d=new Array(n.bitLength()),v=0;v>>T&1}return d}e.prototype.zeroBits=function(){if(this.isZero())return 0;for(var n=0,d=0;dn.length?this.clone().ior(n):n.clone().ior(this)},e.prototype.uor=function(n){return this.length>n.length?this.clone().iuor(n):n.clone().iuor(this)},e.prototype.iuand=function(n){var d;this.length>n.length?d=n:d=this;for(var v=0;vn.length?this.clone().iand(n):n.clone().iand(this)},e.prototype.uand=function(n){return this.length>n.length?this.clone().iuand(n):n.clone().iuand(this)},e.prototype.iuxor=function(n){var d,v;this.length>n.length?(d=this,v=n):(d=n,v=this);for(var A=0;An.length?this.clone().ixor(n):n.clone().ixor(this)},e.prototype.uxor=function(n){return this.length>n.length?this.clone().iuxor(n):n.clone().iuxor(this)},e.prototype.inotn=function(n){a(typeof n=="number"&&n>=0);var d=Math.ceil(n/26)|0,v=n%26;this._expand(d),v>0&&d--;for(var A=0;A0&&(this.words[A]=~this.words[A]&67108863>>26-v),this._strip()},e.prototype.notn=function(n){return this.clone().inotn(n)},e.prototype.setn=function(n,d){a(typeof n=="number"&&n>=0);var v=n/26|0,A=n%26;return this._expand(v+1),d?this.words[v]=this.words[v]|1<n.length?(v=this,A=n):(v=n,A=this);for(var T=0,S=0;S>>26;for(;T!==0&&S>>26;if(this.length=v.length,T!==0)this.words[this.length]=T,this.length++;else if(v!==this)for(;Sn.length?this.clone().iadd(n):n.clone().iadd(this)},e.prototype.isub=function(n){if(n.negative!==0){n.negative=0;var d=this.iadd(n);return n.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(n),this.negative=1,this._normSign();var v=this.cmp(n);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var A,T;v>0?(A=this,T=n):(A=n,T=this);for(var S=0,w=0;w>26,this.words[w]=d&67108863;for(;S!==0&&w>26,this.words[w]=d&67108863;if(S===0&&w>>26,X=h&67108863,ft=Math.min(k,d.length-1),et=Math.max(0,k-n.length+1);et<=ft;et++){var at=k-et|0;T=n.words[at]|0,S=d.words[et]|0,w=T*S+X,tt+=w/67108864|0,X=w&67108863}v.words[k]=X|0,h=tt|0}return h!==0?v.words[k]=h|0:v.length--,v._strip()}var C=function(n,d,v){var A=n.words,T=d.words,S=v.words,w=0,b,h,k,tt=A[0]|0,X=tt&8191,ft=tt>>>13,et=A[1]|0,at=et&8191,$=et>>>13,J=A[2]|0,R=J&8191,j=J>>>13,z=A[3]|0,Z=z&8191,Q=z>>>13,K=A[4]|0,G=K&8191,H=K>>>13,Y=A[5]|0,it=Y&8191,ot=Y>>>13,mt=A[6]|0,_t=mt&8191,ht=mt>>>13,vt=A[7]|0,pt=vt&8191,V=vt>>>13,rt=A[8]|0,st=rt&8191,yt=rt>>>13,Ct=A[9]|0,dt=Ct&8191,Mt=Ct>>>13,Lt=T[0]|0,wt=Lt&8191,ct=Lt>>>13,Et=T[1]|0,ut=Et&8191,Ot=Et>>>13,qt=T[2]|0,nt=qt&8191,Rt=qt>>>13,Dt=T[3]|0,bt=Dt&8191,Tt=Dt>>>13,jt=T[4]|0,St=jt&8191,kt=jt>>>13,Kt=T[5]|0,At=Kt&8191,Nt=Kt>>>13,$t=T[6]|0,Ft=$t&8191,Wt=$t>>>13,ae=T[7]|0,Xt=ae&8191,Gt=ae>>>13,he=T[8]|0,Qt=he&8191,Zt=he>>>13,se=T[9]|0,te=se&8191,re=se>>>13;v.negative=n.negative^d.negative,v.length=19,b=Math.imul(X,wt),h=Math.imul(X,ct),h=h+Math.imul(ft,wt)|0,k=Math.imul(ft,ct);var Se=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Se>>>26)|0,Se&=67108863,b=Math.imul(at,wt),h=Math.imul(at,ct),h=h+Math.imul($,wt)|0,k=Math.imul($,ct),b=b+Math.imul(X,ut)|0,h=h+Math.imul(X,Ot)|0,h=h+Math.imul(ft,ut)|0,k=k+Math.imul(ft,Ot)|0;var Be=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Be>>>26)|0,Be&=67108863,b=Math.imul(R,wt),h=Math.imul(R,ct),h=h+Math.imul(j,wt)|0,k=Math.imul(j,ct),b=b+Math.imul(at,ut)|0,h=h+Math.imul(at,Ot)|0,h=h+Math.imul($,ut)|0,k=k+Math.imul($,Ot)|0,b=b+Math.imul(X,nt)|0,h=h+Math.imul(X,Rt)|0,h=h+Math.imul(ft,nt)|0,k=k+Math.imul(ft,Rt)|0;var Re=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Re>>>26)|0,Re&=67108863,b=Math.imul(Z,wt),h=Math.imul(Z,ct),h=h+Math.imul(Q,wt)|0,k=Math.imul(Q,ct),b=b+Math.imul(R,ut)|0,h=h+Math.imul(R,Ot)|0,h=h+Math.imul(j,ut)|0,k=k+Math.imul(j,Ot)|0,b=b+Math.imul(at,nt)|0,h=h+Math.imul(at,Rt)|0,h=h+Math.imul($,nt)|0,k=k+Math.imul($,Rt)|0,b=b+Math.imul(X,bt)|0,h=h+Math.imul(X,Tt)|0,h=h+Math.imul(ft,bt)|0,k=k+Math.imul(ft,Tt)|0;var Te=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Te>>>26)|0,Te&=67108863,b=Math.imul(G,wt),h=Math.imul(G,ct),h=h+Math.imul(H,wt)|0,k=Math.imul(H,ct),b=b+Math.imul(Z,ut)|0,h=h+Math.imul(Z,Ot)|0,h=h+Math.imul(Q,ut)|0,k=k+Math.imul(Q,Ot)|0,b=b+Math.imul(R,nt)|0,h=h+Math.imul(R,Rt)|0,h=h+Math.imul(j,nt)|0,k=k+Math.imul(j,Rt)|0,b=b+Math.imul(at,bt)|0,h=h+Math.imul(at,Tt)|0,h=h+Math.imul($,bt)|0,k=k+Math.imul($,Tt)|0,b=b+Math.imul(X,St)|0,h=h+Math.imul(X,kt)|0,h=h+Math.imul(ft,St)|0,k=k+Math.imul(ft,kt)|0;var xe=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(xe>>>26)|0,xe&=67108863,b=Math.imul(it,wt),h=Math.imul(it,ct),h=h+Math.imul(ot,wt)|0,k=Math.imul(ot,ct),b=b+Math.imul(G,ut)|0,h=h+Math.imul(G,Ot)|0,h=h+Math.imul(H,ut)|0,k=k+Math.imul(H,Ot)|0,b=b+Math.imul(Z,nt)|0,h=h+Math.imul(Z,Rt)|0,h=h+Math.imul(Q,nt)|0,k=k+Math.imul(Q,Rt)|0,b=b+Math.imul(R,bt)|0,h=h+Math.imul(R,Tt)|0,h=h+Math.imul(j,bt)|0,k=k+Math.imul(j,Tt)|0,b=b+Math.imul(at,St)|0,h=h+Math.imul(at,kt)|0,h=h+Math.imul($,St)|0,k=k+Math.imul($,kt)|0,b=b+Math.imul(X,At)|0,h=h+Math.imul(X,Nt)|0,h=h+Math.imul(ft,At)|0,k=k+Math.imul(ft,Nt)|0;var Ce=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,b=Math.imul(_t,wt),h=Math.imul(_t,ct),h=h+Math.imul(ht,wt)|0,k=Math.imul(ht,ct),b=b+Math.imul(it,ut)|0,h=h+Math.imul(it,Ot)|0,h=h+Math.imul(ot,ut)|0,k=k+Math.imul(ot,Ot)|0,b=b+Math.imul(G,nt)|0,h=h+Math.imul(G,Rt)|0,h=h+Math.imul(H,nt)|0,k=k+Math.imul(H,Rt)|0,b=b+Math.imul(Z,bt)|0,h=h+Math.imul(Z,Tt)|0,h=h+Math.imul(Q,bt)|0,k=k+Math.imul(Q,Tt)|0,b=b+Math.imul(R,St)|0,h=h+Math.imul(R,kt)|0,h=h+Math.imul(j,St)|0,k=k+Math.imul(j,kt)|0,b=b+Math.imul(at,At)|0,h=h+Math.imul(at,Nt)|0,h=h+Math.imul($,At)|0,k=k+Math.imul($,Nt)|0,b=b+Math.imul(X,Ft)|0,h=h+Math.imul(X,Wt)|0,h=h+Math.imul(ft,Ft)|0,k=k+Math.imul(ft,Wt)|0;var Ue=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,b=Math.imul(pt,wt),h=Math.imul(pt,ct),h=h+Math.imul(V,wt)|0,k=Math.imul(V,ct),b=b+Math.imul(_t,ut)|0,h=h+Math.imul(_t,Ot)|0,h=h+Math.imul(ht,ut)|0,k=k+Math.imul(ht,Ot)|0,b=b+Math.imul(it,nt)|0,h=h+Math.imul(it,Rt)|0,h=h+Math.imul(ot,nt)|0,k=k+Math.imul(ot,Rt)|0,b=b+Math.imul(G,bt)|0,h=h+Math.imul(G,Tt)|0,h=h+Math.imul(H,bt)|0,k=k+Math.imul(H,Tt)|0,b=b+Math.imul(Z,St)|0,h=h+Math.imul(Z,kt)|0,h=h+Math.imul(Q,St)|0,k=k+Math.imul(Q,kt)|0,b=b+Math.imul(R,At)|0,h=h+Math.imul(R,Nt)|0,h=h+Math.imul(j,At)|0,k=k+Math.imul(j,Nt)|0,b=b+Math.imul(at,Ft)|0,h=h+Math.imul(at,Wt)|0,h=h+Math.imul($,Ft)|0,k=k+Math.imul($,Wt)|0,b=b+Math.imul(X,Xt)|0,h=h+Math.imul(X,Gt)|0,h=h+Math.imul(ft,Xt)|0,k=k+Math.imul(ft,Gt)|0;var Ke=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,b=Math.imul(st,wt),h=Math.imul(st,ct),h=h+Math.imul(yt,wt)|0,k=Math.imul(yt,ct),b=b+Math.imul(pt,ut)|0,h=h+Math.imul(pt,Ot)|0,h=h+Math.imul(V,ut)|0,k=k+Math.imul(V,Ot)|0,b=b+Math.imul(_t,nt)|0,h=h+Math.imul(_t,Rt)|0,h=h+Math.imul(ht,nt)|0,k=k+Math.imul(ht,Rt)|0,b=b+Math.imul(it,bt)|0,h=h+Math.imul(it,Tt)|0,h=h+Math.imul(ot,bt)|0,k=k+Math.imul(ot,Tt)|0,b=b+Math.imul(G,St)|0,h=h+Math.imul(G,kt)|0,h=h+Math.imul(H,St)|0,k=k+Math.imul(H,kt)|0,b=b+Math.imul(Z,At)|0,h=h+Math.imul(Z,Nt)|0,h=h+Math.imul(Q,At)|0,k=k+Math.imul(Q,Nt)|0,b=b+Math.imul(R,Ft)|0,h=h+Math.imul(R,Wt)|0,h=h+Math.imul(j,Ft)|0,k=k+Math.imul(j,Wt)|0,b=b+Math.imul(at,Xt)|0,h=h+Math.imul(at,Gt)|0,h=h+Math.imul($,Xt)|0,k=k+Math.imul($,Gt)|0,b=b+Math.imul(X,Qt)|0,h=h+Math.imul(X,Zt)|0,h=h+Math.imul(ft,Qt)|0,k=k+Math.imul(ft,Zt)|0;var Je=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Je>>>26)|0,Je&=67108863,b=Math.imul(dt,wt),h=Math.imul(dt,ct),h=h+Math.imul(Mt,wt)|0,k=Math.imul(Mt,ct),b=b+Math.imul(st,ut)|0,h=h+Math.imul(st,Ot)|0,h=h+Math.imul(yt,ut)|0,k=k+Math.imul(yt,Ot)|0,b=b+Math.imul(pt,nt)|0,h=h+Math.imul(pt,Rt)|0,h=h+Math.imul(V,nt)|0,k=k+Math.imul(V,Rt)|0,b=b+Math.imul(_t,bt)|0,h=h+Math.imul(_t,Tt)|0,h=h+Math.imul(ht,bt)|0,k=k+Math.imul(ht,Tt)|0,b=b+Math.imul(it,St)|0,h=h+Math.imul(it,kt)|0,h=h+Math.imul(ot,St)|0,k=k+Math.imul(ot,kt)|0,b=b+Math.imul(G,At)|0,h=h+Math.imul(G,Nt)|0,h=h+Math.imul(H,At)|0,k=k+Math.imul(H,Nt)|0,b=b+Math.imul(Z,Ft)|0,h=h+Math.imul(Z,Wt)|0,h=h+Math.imul(Q,Ft)|0,k=k+Math.imul(Q,Wt)|0,b=b+Math.imul(R,Xt)|0,h=h+Math.imul(R,Gt)|0,h=h+Math.imul(j,Xt)|0,k=k+Math.imul(j,Gt)|0,b=b+Math.imul(at,Qt)|0,h=h+Math.imul(at,Zt)|0,h=h+Math.imul($,Qt)|0,k=k+Math.imul($,Zt)|0,b=b+Math.imul(X,te)|0,h=h+Math.imul(X,re)|0,h=h+Math.imul(ft,te)|0,k=k+Math.imul(ft,re)|0;var ze=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(ze>>>26)|0,ze&=67108863,b=Math.imul(dt,ut),h=Math.imul(dt,Ot),h=h+Math.imul(Mt,ut)|0,k=Math.imul(Mt,Ot),b=b+Math.imul(st,nt)|0,h=h+Math.imul(st,Rt)|0,h=h+Math.imul(yt,nt)|0,k=k+Math.imul(yt,Rt)|0,b=b+Math.imul(pt,bt)|0,h=h+Math.imul(pt,Tt)|0,h=h+Math.imul(V,bt)|0,k=k+Math.imul(V,Tt)|0,b=b+Math.imul(_t,St)|0,h=h+Math.imul(_t,kt)|0,h=h+Math.imul(ht,St)|0,k=k+Math.imul(ht,kt)|0,b=b+Math.imul(it,At)|0,h=h+Math.imul(it,Nt)|0,h=h+Math.imul(ot,At)|0,k=k+Math.imul(ot,Nt)|0,b=b+Math.imul(G,Ft)|0,h=h+Math.imul(G,Wt)|0,h=h+Math.imul(H,Ft)|0,k=k+Math.imul(H,Wt)|0,b=b+Math.imul(Z,Xt)|0,h=h+Math.imul(Z,Gt)|0,h=h+Math.imul(Q,Xt)|0,k=k+Math.imul(Q,Gt)|0,b=b+Math.imul(R,Qt)|0,h=h+Math.imul(R,Zt)|0,h=h+Math.imul(j,Qt)|0,k=k+Math.imul(j,Zt)|0,b=b+Math.imul(at,te)|0,h=h+Math.imul(at,re)|0,h=h+Math.imul($,te)|0,k=k+Math.imul($,re)|0;var Xe=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,b=Math.imul(dt,nt),h=Math.imul(dt,Rt),h=h+Math.imul(Mt,nt)|0,k=Math.imul(Mt,Rt),b=b+Math.imul(st,bt)|0,h=h+Math.imul(st,Tt)|0,h=h+Math.imul(yt,bt)|0,k=k+Math.imul(yt,Tt)|0,b=b+Math.imul(pt,St)|0,h=h+Math.imul(pt,kt)|0,h=h+Math.imul(V,St)|0,k=k+Math.imul(V,kt)|0,b=b+Math.imul(_t,At)|0,h=h+Math.imul(_t,Nt)|0,h=h+Math.imul(ht,At)|0,k=k+Math.imul(ht,Nt)|0,b=b+Math.imul(it,Ft)|0,h=h+Math.imul(it,Wt)|0,h=h+Math.imul(ot,Ft)|0,k=k+Math.imul(ot,Wt)|0,b=b+Math.imul(G,Xt)|0,h=h+Math.imul(G,Gt)|0,h=h+Math.imul(H,Xt)|0,k=k+Math.imul(H,Gt)|0,b=b+Math.imul(Z,Qt)|0,h=h+Math.imul(Z,Zt)|0,h=h+Math.imul(Q,Qt)|0,k=k+Math.imul(Q,Zt)|0,b=b+Math.imul(R,te)|0,h=h+Math.imul(R,re)|0,h=h+Math.imul(j,te)|0,k=k+Math.imul(j,re)|0;var Ge=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,b=Math.imul(dt,bt),h=Math.imul(dt,Tt),h=h+Math.imul(Mt,bt)|0,k=Math.imul(Mt,Tt),b=b+Math.imul(st,St)|0,h=h+Math.imul(st,kt)|0,h=h+Math.imul(yt,St)|0,k=k+Math.imul(yt,kt)|0,b=b+Math.imul(pt,At)|0,h=h+Math.imul(pt,Nt)|0,h=h+Math.imul(V,At)|0,k=k+Math.imul(V,Nt)|0,b=b+Math.imul(_t,Ft)|0,h=h+Math.imul(_t,Wt)|0,h=h+Math.imul(ht,Ft)|0,k=k+Math.imul(ht,Wt)|0,b=b+Math.imul(it,Xt)|0,h=h+Math.imul(it,Gt)|0,h=h+Math.imul(ot,Xt)|0,k=k+Math.imul(ot,Gt)|0,b=b+Math.imul(G,Qt)|0,h=h+Math.imul(G,Zt)|0,h=h+Math.imul(H,Qt)|0,k=k+Math.imul(H,Zt)|0,b=b+Math.imul(Z,te)|0,h=h+Math.imul(Z,re)|0,h=h+Math.imul(Q,te)|0,k=k+Math.imul(Q,re)|0;var Ye=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,b=Math.imul(dt,St),h=Math.imul(dt,kt),h=h+Math.imul(Mt,St)|0,k=Math.imul(Mt,kt),b=b+Math.imul(st,At)|0,h=h+Math.imul(st,Nt)|0,h=h+Math.imul(yt,At)|0,k=k+Math.imul(yt,Nt)|0,b=b+Math.imul(pt,Ft)|0,h=h+Math.imul(pt,Wt)|0,h=h+Math.imul(V,Ft)|0,k=k+Math.imul(V,Wt)|0,b=b+Math.imul(_t,Xt)|0,h=h+Math.imul(_t,Gt)|0,h=h+Math.imul(ht,Xt)|0,k=k+Math.imul(ht,Gt)|0,b=b+Math.imul(it,Qt)|0,h=h+Math.imul(it,Zt)|0,h=h+Math.imul(ot,Qt)|0,k=k+Math.imul(ot,Zt)|0,b=b+Math.imul(G,te)|0,h=h+Math.imul(G,re)|0,h=h+Math.imul(H,te)|0,k=k+Math.imul(H,re)|0;var We=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(We>>>26)|0,We&=67108863,b=Math.imul(dt,At),h=Math.imul(dt,Nt),h=h+Math.imul(Mt,At)|0,k=Math.imul(Mt,Nt),b=b+Math.imul(st,Ft)|0,h=h+Math.imul(st,Wt)|0,h=h+Math.imul(yt,Ft)|0,k=k+Math.imul(yt,Wt)|0,b=b+Math.imul(pt,Xt)|0,h=h+Math.imul(pt,Gt)|0,h=h+Math.imul(V,Xt)|0,k=k+Math.imul(V,Gt)|0,b=b+Math.imul(_t,Qt)|0,h=h+Math.imul(_t,Zt)|0,h=h+Math.imul(ht,Qt)|0,k=k+Math.imul(ht,Zt)|0,b=b+Math.imul(it,te)|0,h=h+Math.imul(it,re)|0,h=h+Math.imul(ot,te)|0,k=k+Math.imul(ot,re)|0;var Ve=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,b=Math.imul(dt,Ft),h=Math.imul(dt,Wt),h=h+Math.imul(Mt,Ft)|0,k=Math.imul(Mt,Wt),b=b+Math.imul(st,Xt)|0,h=h+Math.imul(st,Gt)|0,h=h+Math.imul(yt,Xt)|0,k=k+Math.imul(yt,Gt)|0,b=b+Math.imul(pt,Qt)|0,h=h+Math.imul(pt,Zt)|0,h=h+Math.imul(V,Qt)|0,k=k+Math.imul(V,Zt)|0,b=b+Math.imul(_t,te)|0,h=h+Math.imul(_t,re)|0,h=h+Math.imul(ht,te)|0,k=k+Math.imul(ht,re)|0;var Ze=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,b=Math.imul(dt,Xt),h=Math.imul(dt,Gt),h=h+Math.imul(Mt,Xt)|0,k=Math.imul(Mt,Gt),b=b+Math.imul(st,Qt)|0,h=h+Math.imul(st,Zt)|0,h=h+Math.imul(yt,Qt)|0,k=k+Math.imul(yt,Zt)|0,b=b+Math.imul(pt,te)|0,h=h+Math.imul(pt,re)|0,h=h+Math.imul(V,te)|0,k=k+Math.imul(V,re)|0;var ar=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(ar>>>26)|0,ar&=67108863,b=Math.imul(dt,Qt),h=Math.imul(dt,Zt),h=h+Math.imul(Mt,Qt)|0,k=Math.imul(Mt,Zt),b=b+Math.imul(st,te)|0,h=h+Math.imul(st,re)|0,h=h+Math.imul(yt,te)|0,k=k+Math.imul(yt,re)|0;var br=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(br>>>26)|0,br&=67108863,b=Math.imul(dt,te),h=Math.imul(dt,re),h=h+Math.imul(Mt,te)|0,k=Math.imul(Mt,re);var cr=(w+b|0)+((h&8191)<<13)|0;return w=(k+(h>>>13)|0)+(cr>>>26)|0,cr&=67108863,S[0]=Se,S[1]=Be,S[2]=Re,S[3]=Te,S[4]=xe,S[5]=Ce,S[6]=Ue,S[7]=Ke,S[8]=Je,S[9]=ze,S[10]=Xe,S[11]=Ge,S[12]=Ye,S[13]=We,S[14]=Ve,S[15]=Ze,S[16]=ar,S[17]=br,S[18]=cr,w!==0&&(S[19]=w,v.length++),v};Math.imul||(C=x);function N(n,d,v){v.negative=d.negative^n.negative,v.length=n.length+d.length;for(var A=0,T=0,S=0;S>>26)|0,T+=w>>>26,w&=67108863}v.words[S]=b,A=w,w=T}return A!==0?v.words[S]=A:v.length--,v._strip()}function F(n,d,v){return N(n,d,v)}e.prototype.mulTo=function(n,d){var v,A=this.length+n.length;return this.length===10&&n.length===10?v=C(this,n,d):A<63?v=x(this,n,d):A<1024?v=N(this,n,d):v=F(this,n,d),v},e.prototype.mul=function(n){var d=new e(null);return d.words=new Array(this.length+n.length),this.mulTo(n,d)},e.prototype.mulf=function(n){var d=new e(null);return d.words=new Array(this.length+n.length),F(this,n,d)},e.prototype.imul=function(n){return this.clone().mulTo(n,this)},e.prototype.imuln=function(n){var d=n<0;d&&(n=-n),a(typeof n=="number"),a(n<67108864);for(var v=0,A=0;A>=26,v+=T/67108864|0,v+=S>>>26,this.words[A]=S&67108863}return v!==0&&(this.words[A]=v,this.length++),d?this.ineg():this},e.prototype.muln=function(n){return this.clone().imuln(n)},e.prototype.sqr=function(){return this.mul(this)},e.prototype.isqr=function(){return this.imul(this.clone())},e.prototype.pow=function(n){var d=B(n);if(d.length===0)return new e(1);for(var v=this,A=0;A=0);var d=n%26,v=(n-d)/26,A=67108863>>>26-d<<26-d,T;if(d!==0){var S=0;for(T=0;T>>26-d}S&&(this.words[T]=S,this.length++)}if(v!==0){for(T=this.length-1;T>=0;T--)this.words[T+v]=this.words[T];for(T=0;T=0);var A;d?A=(d-d%26)/26:A=0;var T=n%26,S=Math.min((n-T)/26,this.length),w=67108863^67108863>>>T<S)for(this.length-=S,h=0;h=0&&(k!==0||h>=A);h--){var tt=this.words[h]|0;this.words[h]=k<<26-T|tt>>>T,k=tt&w}return b&&k!==0&&(b.words[b.length++]=k),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},e.prototype.ishrn=function(n,d,v){return a(this.negative===0),this.iushrn(n,d,v)},e.prototype.shln=function(n){return this.clone().ishln(n)},e.prototype.ushln=function(n){return this.clone().iushln(n)},e.prototype.shrn=function(n){return this.clone().ishrn(n)},e.prototype.ushrn=function(n){return this.clone().iushrn(n)},e.prototype.testn=function(n){a(typeof n=="number"&&n>=0);var d=n%26,v=(n-d)/26,A=1<=0);var d=n%26,v=(n-d)/26;if(a(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(d!==0&&v++,this.length=Math.min(v,this.length),d!==0){var A=67108863^67108863>>>d<=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},e.prototype.isubn=function(n){if(a(typeof n=="number"),a(n<67108864),n<0)return this.iaddn(-n);if(this.negative!==0)return this.negative=0,this.iaddn(n),this.negative=1,this;if(this.words[0]-=n,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(b/67108864|0),this.words[T+v]=S&67108863}for(;T>26,this.words[T+v]=S&67108863;if(w===0)return this._strip();for(a(w===-1),w=0,T=0;T>26,this.words[T]=S&67108863;return this.negative=1,this._strip()},e.prototype._wordDiv=function(n,d){var v=this.length-n.length,A=this.clone(),T=n,S=T.words[T.length-1]|0,w=this._countBits(S);v=26-w,v!==0&&(T=T.ushln(v),A.iushln(v),S=T.words[T.length-1]|0);var b=A.length-T.length,h;if(d!=="mod"){h=new e(null),h.length=b+1,h.words=new Array(h.length);for(var k=0;k=0;X--){var ft=(A.words[T.length+X]|0)*67108864+(A.words[T.length+X-1]|0);for(ft=Math.min(ft/S|0,67108863),A._ishlnsubmul(T,ft,X);A.negative!==0;)ft--,A.negative=0,A._ishlnsubmul(T,1,X),A.isZero()||(A.negative^=1);h&&(h.words[X]=ft)}return h&&h._strip(),A._strip(),d!=="div"&&v!==0&&A.iushrn(v),{div:h||null,mod:A}},e.prototype.divmod=function(n,d,v){if(a(!n.isZero()),this.isZero())return{div:new e(0),mod:new e(0)};var A,T,S;return this.negative!==0&&n.negative===0?(S=this.neg().divmod(n,d),d!=="mod"&&(A=S.div.neg()),d!=="div"&&(T=S.mod.neg(),v&&T.negative!==0&&T.iadd(n)),{div:A,mod:T}):this.negative===0&&n.negative!==0?(S=this.divmod(n.neg(),d),d!=="mod"&&(A=S.div.neg()),{div:A,mod:S.mod}):this.negative&n.negative?(S=this.neg().divmod(n.neg(),d),d!=="div"&&(T=S.mod.neg(),v&&T.negative!==0&&T.isub(n)),{div:S.div,mod:T}):n.length>this.length||this.cmp(n)<0?{div:new e(0),mod:this}:n.length===1?d==="div"?{div:this.divn(n.words[0]),mod:null}:d==="mod"?{div:null,mod:new e(this.modrn(n.words[0]))}:{div:this.divn(n.words[0]),mod:new e(this.modrn(n.words[0]))}:this._wordDiv(n,d)},e.prototype.div=function(n){return this.divmod(n,"div",!1).div},e.prototype.mod=function(n){return this.divmod(n,"mod",!1).mod},e.prototype.umod=function(n){return this.divmod(n,"mod",!0).mod},e.prototype.divRound=function(n){var d=this.divmod(n);if(d.mod.isZero())return d.div;var v=d.div.negative!==0?d.mod.isub(n):d.mod,A=n.ushrn(1),T=n.andln(1),S=v.cmp(A);return S<0||T===1&&S===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},e.prototype.modrn=function(n){var d=n<0;d&&(n=-n),a(n<=67108863);for(var v=(1<<26)%n,A=0,T=this.length-1;T>=0;T--)A=(v*A+(this.words[T]|0))%n;return d?-A:A},e.prototype.modn=function(n){return this.modrn(n)},e.prototype.idivn=function(n){var d=n<0;d&&(n=-n),a(n<=67108863);for(var v=0,A=this.length-1;A>=0;A--){var T=(this.words[A]|0)+v*67108864;this.words[A]=T/n|0,v=T%n}return this._strip(),d?this.ineg():this},e.prototype.divn=function(n){return this.clone().idivn(n)},e.prototype.egcd=function(n){a(n.negative===0),a(!n.isZero());var d=this,v=n.clone();d.negative!==0?d=d.umod(n):d=d.clone();for(var A=new e(1),T=new e(0),S=new e(0),w=new e(1),b=0;d.isEven()&&v.isEven();)d.iushrn(1),v.iushrn(1),++b;for(var h=v.clone(),k=d.clone();!d.isZero();){for(var tt=0,X=1;!(d.words[0]&X)&&tt<26;++tt,X<<=1);if(tt>0)for(d.iushrn(tt);tt-- >0;)(A.isOdd()||T.isOdd())&&(A.iadd(h),T.isub(k)),A.iushrn(1),T.iushrn(1);for(var ft=0,et=1;!(v.words[0]&et)&&ft<26;++ft,et<<=1);if(ft>0)for(v.iushrn(ft);ft-- >0;)(S.isOdd()||w.isOdd())&&(S.iadd(h),w.isub(k)),S.iushrn(1),w.iushrn(1);d.cmp(v)>=0?(d.isub(v),A.isub(S),T.isub(w)):(v.isub(d),S.isub(A),w.isub(T))}return{a:S,b:w,gcd:v.iushln(b)}},e.prototype._invmp=function(n){a(n.negative===0),a(!n.isZero());var d=this,v=n.clone();d.negative!==0?d=d.umod(n):d=d.clone();for(var A=new e(1),T=new e(0),S=v.clone();d.cmpn(1)>0&&v.cmpn(1)>0;){for(var w=0,b=1;!(d.words[0]&b)&&w<26;++w,b<<=1);if(w>0)for(d.iushrn(w);w-- >0;)A.isOdd()&&A.iadd(S),A.iushrn(1);for(var h=0,k=1;!(v.words[0]&k)&&h<26;++h,k<<=1);if(h>0)for(v.iushrn(h);h-- >0;)T.isOdd()&&T.iadd(S),T.iushrn(1);d.cmp(v)>=0?(d.isub(v),A.isub(T)):(v.isub(d),T.isub(A))}var tt;return d.cmpn(1)===0?tt=A:tt=T,tt.cmpn(0)<0&&tt.iadd(n),tt},e.prototype.gcd=function(n){if(this.isZero())return n.abs();if(n.isZero())return this.abs();var d=this.clone(),v=n.clone();d.negative=0,v.negative=0;for(var A=0;d.isEven()&&v.isEven();A++)d.iushrn(1),v.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;v.isEven();)v.iushrn(1);var T=d.cmp(v);if(T<0){var S=d;d=v,v=S}else if(T===0||v.cmpn(1)===0)break;d.isub(v)}while(!0);return v.iushln(A)},e.prototype.invm=function(n){return this.egcd(n).a.umod(n)},e.prototype.isEven=function(){return(this.words[0]&1)===0},e.prototype.isOdd=function(){return(this.words[0]&1)===1},e.prototype.andln=function(n){return this.words[0]&n},e.prototype.bincn=function(n){a(typeof n=="number");var d=n%26,v=(n-d)/26,A=1<>>26,w&=67108863,this.words[S]=w}return T!==0&&(this.words[S]=T,this.length++),this},e.prototype.isZero=function(){return this.length===1&&this.words[0]===0},e.prototype.cmpn=function(n){var d=n<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var v;if(this.length>1)v=1;else{d&&(n=-n),a(n<=67108863,"Number is too big");var A=this.words[0]|0;v=A===n?0:An.length)return 1;if(this.length=0;v--){var A=this.words[v]|0,T=n.words[v]|0;if(A!==T){AT&&(d=1);break}}return d},e.prototype.gtn=function(n){return this.cmpn(n)===1},e.prototype.gt=function(n){return this.cmp(n)===1},e.prototype.gten=function(n){return this.cmpn(n)>=0},e.prototype.gte=function(n){return this.cmp(n)>=0},e.prototype.ltn=function(n){return this.cmpn(n)===-1},e.prototype.lt=function(n){return this.cmp(n)===-1},e.prototype.lten=function(n){return this.cmpn(n)<=0},e.prototype.lte=function(n){return this.cmp(n)<=0},e.prototype.eqn=function(n){return this.cmpn(n)===0},e.prototype.eq=function(n){return this.cmp(n)===0},e.red=function(n){return new O(n)},e.prototype.toRed=function(n){return a(!this.red,"Already a number in reduction context"),a(this.negative===0,"red works only with positives"),n.convertTo(this)._forceRed(n)},e.prototype.fromRed=function(){return a(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},e.prototype._forceRed=function(n){return this.red=n,this},e.prototype.forceRed=function(n){return a(!this.red,"Already a number in reduction context"),this._forceRed(n)},e.prototype.redAdd=function(n){return a(this.red,"redAdd works only with red numbers"),this.red.add(this,n)},e.prototype.redIAdd=function(n){return a(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,n)},e.prototype.redSub=function(n){return a(this.red,"redSub works only with red numbers"),this.red.sub(this,n)},e.prototype.redISub=function(n){return a(this.red,"redISub works only with red numbers"),this.red.isub(this,n)},e.prototype.redShl=function(n){return a(this.red,"redShl works only with red numbers"),this.red.shl(this,n)},e.prototype.redMul=function(n){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.mul(this,n)},e.prototype.redIMul=function(n){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.imul(this,n)},e.prototype.redSqr=function(){return a(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},e.prototype.redISqr=function(){return a(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},e.prototype.redSqrt=function(){return a(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},e.prototype.redInvm=function(){return a(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},e.prototype.redNeg=function(){return a(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},e.prototype.redPow=function(n){return a(this.red&&!n.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,n)};var I={k256:null,p224:null,p192:null,p25519:null};function U(n,d){this.name=n,this.p=new e(d,16),this.n=this.p.bitLength(),this.k=new e(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var n=new e(null);return n.words=new Array(Math.ceil(this.n/13)),n},U.prototype.ireduce=function(n){var d=n,v;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),v=d.bitLength();while(v>this.n);var A=v0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},U.prototype.split=function(n,d){n.iushrn(this.n,0,d)},U.prototype.imulK=function(n){return n.imul(this.k)};function P(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(P,U),P.prototype.split=function(n,d){for(var v=4194303,A=Math.min(n.length,9),T=0;T>>22,S=w}S>>>=22,n.words[T-10]=S,S===0&&n.length>10?n.length-=10:n.length-=9},P.prototype.imulK=function(n){n.words[n.length]=0,n.words[n.length+1]=0,n.length+=2;for(var d=0,v=0;v>>=26,n.words[v]=T,d=A}return d!==0&&(n.words[n.length++]=d),n},e._prime=function(n){if(I[n])return I[n];var d;if(n==="k256")d=new P;else if(n==="p224")d=new D;else if(n==="p192")d=new W;else if(n==="p25519")d=new q;else throw new Error("Unknown prime "+n);return I[n]=d,d};function O(n){if(typeof n=="string"){var d=e._prime(n);this.m=d.p,this.prime=d}else a(n.gtn(1),"modulus must be greater than 1"),this.m=n,this.prime=null}O.prototype._verify1=function(n){a(n.negative===0,"red works only with positives"),a(n.red,"red works only with red numbers")},O.prototype._verify2=function(n,d){a((n.negative|d.negative)===0,"red works only with positives"),a(n.red&&n.red===d.red,"red works only with red numbers")},O.prototype.imod=function(n){return this.prime?this.prime.ireduce(n)._forceRed(this):(p(n,n.umod(this.m)._forceRed(this)),n)},O.prototype.neg=function(n){return n.isZero()?n.clone():this.m.sub(n)._forceRed(this)},O.prototype.add=function(n,d){this._verify2(n,d);var v=n.add(d);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},O.prototype.iadd=function(n,d){this._verify2(n,d);var v=n.iadd(d);return v.cmp(this.m)>=0&&v.isub(this.m),v},O.prototype.sub=function(n,d){this._verify2(n,d);var v=n.sub(d);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},O.prototype.isub=function(n,d){this._verify2(n,d);var v=n.isub(d);return v.cmpn(0)<0&&v.iadd(this.m),v},O.prototype.shl=function(n,d){return this._verify1(n),this.imod(n.ushln(d))},O.prototype.imul=function(n,d){return this._verify2(n,d),this.imod(n.imul(d))},O.prototype.mul=function(n,d){return this._verify2(n,d),this.imod(n.mul(d))},O.prototype.isqr=function(n){return this.imul(n,n.clone())},O.prototype.sqr=function(n){return this.mul(n,n)},O.prototype.sqrt=function(n){if(n.isZero())return n.clone();var d=this.m.andln(3);if(a(d%2===1),d===3){var v=this.m.add(new e(1)).iushrn(2);return this.pow(n,v)}for(var A=this.m.subn(1),T=0;!A.isZero()&&A.andln(1)===0;)T++,A.iushrn(1);a(!A.isZero());var S=new e(1).toRed(this),w=S.redNeg(),b=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new e(2*h*h).toRed(this);this.pow(h,b).cmp(w)!==0;)h.redIAdd(w);for(var k=this.pow(h,A),tt=this.pow(n,A.addn(1).iushrn(1)),X=this.pow(n,A),ft=T;X.cmp(S)!==0;){for(var et=X,at=0;et.cmp(S)!==0;at++)et=et.redSqr();a(at=0;T--){for(var k=d.words[T],tt=h-1;tt>=0;tt--){var X=k>>tt&1;if(S!==A[0]&&(S=this.sqr(S)),X===0&&w===0){b=0;continue}w<<=1,w|=X,b++,!(b!==v&&(T!==0||tt!==0))&&(S=this.mul(S,A[w]),b=0,w=0)}h=26}return S},O.prototype.convertTo=function(n){var d=n.umod(this.m);return d===n?d.clone():d},O.prototype.convertFrom=function(n){var d=n.clone();return d.red=null,d},e.mont=function(n){return new L(n)};function L(n){O.call(this,n),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new e(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(L,O),L.prototype.convertTo=function(n){return this.imod(n.ushln(this.shift))},L.prototype.convertFrom=function(n){var d=this.imod(n.mul(this.rinv));return d.red=null,d},L.prototype.imul=function(n,d){if(n.isZero()||d.isZero())return n.words[0]=0,n.length=1,n;var v=n.imul(d),A=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=v.isub(A).iushrn(this.shift),S=T;return T.cmp(this.m)>=0?S=T.isub(this.m):T.cmpn(0)<0&&(S=T.iadd(this.m)),S._forceRed(this)},L.prototype.mul=function(n,d){if(n.isZero()||d.isZero())return new e(0)._forceRed(this);var v=n.mul(d),A=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=v.isub(A).iushrn(this.shift),S=T;return T.cmp(this.m)>=0?S=T.isub(this.m):T.cmpn(0)<0&&(S=T.iadd(this.m)),S._forceRed(this)},L.prototype.invm=function(n){var d=this.imod(n._invmp(this.m).mul(this.r2));return d._forceRed(this)}}(typeof i>"u"||i,t)}),_y=gt((t,i)=>{lt(),function(r,u){function a(n,d){if(!n)throw new Error(d||"Assertion failed")}function s(n,d){n.super_=d;var v=function(){};v.prototype=d.prototype,n.prototype=new v,n.prototype.constructor=n}function e(n,d,v){if(e.isBN(n))return n;this.negative=0,this.words=null,this.length=0,this.red=null,n!==null&&((d==="le"||d==="be")&&(v=d,d=10),this._init(n||0,d||10,v||"be"))}typeof r=="object"?r.exports=e:u.BN=e,e.BN=e,e.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=$e().Buffer}catch{}e.isBN=function(n){return n instanceof e?!0:n!==null&&typeof n=="object"&&n.constructor.wordSize===e.wordSize&&Array.isArray(n.words)},e.max=function(n,d){return n.cmp(d)>0?n:d},e.min=function(n,d){return n.cmp(d)<0?n:d},e.prototype._init=function(n,d,v){if(typeof n=="number")return this._initNumber(n,d,v);if(typeof n=="object")return this._initArray(n,d,v);d==="hex"&&(d=16),a(d===(d|0)&&d>=2&&d<=36),n=n.toString().replace(/\s+/g,"");var A=0;n[0]==="-"&&(A++,this.negative=1),A=0;A-=3)S=n[A]|n[A-1]<<8|n[A-2]<<16,this.words[T]|=S<>>26-w&67108863,w+=24,w>=26&&(w-=26,T++);else if(v==="le")for(A=0,T=0;A>>26-w&67108863,w+=24,w>=26&&(w-=26,T++);return this._strip()};function c(n,d){var v=n.charCodeAt(d);if(v>=48&&v<=57)return v-48;if(v>=65&&v<=70)return v-55;if(v>=97&&v<=102)return v-87;a(!1,"Invalid character in "+n)}function f(n,d,v){var A=c(n,v);return v-1>=d&&(A|=c(n,v-1)<<4),A}e.prototype._parseHex=function(n,d,v){this.length=Math.ceil((n.length-d)/6),this.words=new Array(this.length);for(var A=0;A=d;A-=2)w=f(n,d,A)<=18?(T-=18,S+=1,this.words[S]|=w>>>26):T+=8;else{var b=n.length-d;for(A=b%2===0?d+1:d;A=18?(T-=18,S+=1,this.words[S]|=w>>>26):T+=8}this._strip()};function l(n,d,v,A){for(var T=0,S=0,w=Math.min(n.length,v),b=d;b=49?S=h-49+10:h>=17?S=h-17+10:S=h,a(h>=0&&S1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},e.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{e.prototype[Symbol.for("nodejs.util.inspect.custom")]=g}catch{e.prototype.inspect=g}else e.prototype.inspect=g;function g(){return(this.red?""}var y=["","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],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];e.prototype.toString=function(n,d){n=n||10,d=d|0||1;var v;if(n===16||n==="hex"){v="";for(var A=0,T=0,S=0;S>>24-A&16777215,A+=2,A>=26&&(A-=26,S--),T!==0||S!==this.length-1?v=y[6-b.length]+b+v:v=b+v}for(T!==0&&(v=T.toString(16)+v);v.length%d!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(n===(n|0)&&n>=2&&n<=36){var h=m[n],k=M[n];v="";var tt=this.clone();for(tt.negative=0;!tt.isZero();){var X=tt.modrn(k).toString(n);tt=tt.idivn(k),tt.isZero()?v=X+v:v=y[h-X.length]+X+v}for(this.isZero()&&(v="0"+v);v.length%d!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}a(!1,"Base should be between 2 and 36")},e.prototype.toNumber=function(){var n=this.words[0];return this.length===2?n+=this.words[1]*67108864:this.length===3&&this.words[2]===1?n+=4503599627370496+this.words[1]*67108864:this.length>2&&a(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-n:n},e.prototype.toJSON=function(){return this.toString(16,2)},o&&(e.prototype.toBuffer=function(n,d){return this.toArrayLike(o,n,d)}),e.prototype.toArray=function(n,d){return this.toArrayLike(Array,n,d)};var E=function(n,d){return n.allocUnsafe?n.allocUnsafe(d):new n(d)};e.prototype.toArrayLike=function(n,d,v){this._strip();var A=this.byteLength(),T=v||Math.max(1,A);a(A<=T,"byte array longer than desired length"),a(T>0,"Requested array length <= 0");var S=E(n,T),w=d==="le"?"LE":"BE";return this["_toArrayLike"+w](S,A),S},e.prototype._toArrayLikeLE=function(n,d){for(var v=0,A=0,T=0,S=0;T>8&255),v>16&255),S===6?(v>24&255),A=0,S=0):(A=w>>>24,S+=2)}if(v=0&&(n[v--]=w>>8&255),v>=0&&(n[v--]=w>>16&255),S===6?(v>=0&&(n[v--]=w>>24&255),A=0,S=0):(A=w>>>24,S+=2)}if(v>=0)for(n[v--]=A;v>=0;)n[v--]=0},Math.clz32?e.prototype._countBits=function(n){return 32-Math.clz32(n)}:e.prototype._countBits=function(n){var d=n,v=0;return d>=4096&&(v+=13,d>>>=13),d>=64&&(v+=7,d>>>=7),d>=8&&(v+=4,d>>>=4),d>=2&&(v+=2,d>>>=2),v+d},e.prototype._zeroBits=function(n){if(n===0)return 26;var d=n,v=0;return!(d&8191)&&(v+=13,d>>>=13),!(d&127)&&(v+=7,d>>>=7),!(d&15)&&(v+=4,d>>>=4),!(d&3)&&(v+=2,d>>>=2),!(d&1)&&v++,v},e.prototype.bitLength=function(){var n=this.words[this.length-1],d=this._countBits(n);return(this.length-1)*26+d};function B(n){for(var d=new Array(n.bitLength()),v=0;v>>T&1}return d}e.prototype.zeroBits=function(){if(this.isZero())return 0;for(var n=0,d=0;dn.length?this.clone().ior(n):n.clone().ior(this)},e.prototype.uor=function(n){return this.length>n.length?this.clone().iuor(n):n.clone().iuor(this)},e.prototype.iuand=function(n){var d;this.length>n.length?d=n:d=this;for(var v=0;vn.length?this.clone().iand(n):n.clone().iand(this)},e.prototype.uand=function(n){return this.length>n.length?this.clone().iuand(n):n.clone().iuand(this)},e.prototype.iuxor=function(n){var d,v;this.length>n.length?(d=this,v=n):(d=n,v=this);for(var A=0;An.length?this.clone().ixor(n):n.clone().ixor(this)},e.prototype.uxor=function(n){return this.length>n.length?this.clone().iuxor(n):n.clone().iuxor(this)},e.prototype.inotn=function(n){a(typeof n=="number"&&n>=0);var d=Math.ceil(n/26)|0,v=n%26;this._expand(d),v>0&&d--;for(var A=0;A0&&(this.words[A]=~this.words[A]&67108863>>26-v),this._strip()},e.prototype.notn=function(n){return this.clone().inotn(n)},e.prototype.setn=function(n,d){a(typeof n=="number"&&n>=0);var v=n/26|0,A=n%26;return this._expand(v+1),d?this.words[v]=this.words[v]|1<n.length?(v=this,A=n):(v=n,A=this);for(var T=0,S=0;S>>26;for(;T!==0&&S>>26;if(this.length=v.length,T!==0)this.words[this.length]=T,this.length++;else if(v!==this)for(;Sn.length?this.clone().iadd(n):n.clone().iadd(this)},e.prototype.isub=function(n){if(n.negative!==0){n.negative=0;var d=this.iadd(n);return n.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(n),this.negative=1,this._normSign();var v=this.cmp(n);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var A,T;v>0?(A=this,T=n):(A=n,T=this);for(var S=0,w=0;w>26,this.words[w]=d&67108863;for(;S!==0&&w>26,this.words[w]=d&67108863;if(S===0&&w>>26,X=h&67108863,ft=Math.min(k,d.length-1),et=Math.max(0,k-n.length+1);et<=ft;et++){var at=k-et|0;T=n.words[at]|0,S=d.words[et]|0,w=T*S+X,tt+=w/67108864|0,X=w&67108863}v.words[k]=X|0,h=tt|0}return h!==0?v.words[k]=h|0:v.length--,v._strip()}var C=function(n,d,v){var A=n.words,T=d.words,S=v.words,w=0,b,h,k,tt=A[0]|0,X=tt&8191,ft=tt>>>13,et=A[1]|0,at=et&8191,$=et>>>13,J=A[2]|0,R=J&8191,j=J>>>13,z=A[3]|0,Z=z&8191,Q=z>>>13,K=A[4]|0,G=K&8191,H=K>>>13,Y=A[5]|0,it=Y&8191,ot=Y>>>13,mt=A[6]|0,_t=mt&8191,ht=mt>>>13,vt=A[7]|0,pt=vt&8191,V=vt>>>13,rt=A[8]|0,st=rt&8191,yt=rt>>>13,Ct=A[9]|0,dt=Ct&8191,Mt=Ct>>>13,Lt=T[0]|0,wt=Lt&8191,ct=Lt>>>13,Et=T[1]|0,ut=Et&8191,Ot=Et>>>13,qt=T[2]|0,nt=qt&8191,Rt=qt>>>13,Dt=T[3]|0,bt=Dt&8191,Tt=Dt>>>13,jt=T[4]|0,St=jt&8191,kt=jt>>>13,Kt=T[5]|0,At=Kt&8191,Nt=Kt>>>13,$t=T[6]|0,Ft=$t&8191,Wt=$t>>>13,ae=T[7]|0,Xt=ae&8191,Gt=ae>>>13,he=T[8]|0,Qt=he&8191,Zt=he>>>13,se=T[9]|0,te=se&8191,re=se>>>13;v.negative=n.negative^d.negative,v.length=19,b=Math.imul(X,wt),h=Math.imul(X,ct),h=h+Math.imul(ft,wt)|0,k=Math.imul(ft,ct);var Se=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Se>>>26)|0,Se&=67108863,b=Math.imul(at,wt),h=Math.imul(at,ct),h=h+Math.imul($,wt)|0,k=Math.imul($,ct),b=b+Math.imul(X,ut)|0,h=h+Math.imul(X,Ot)|0,h=h+Math.imul(ft,ut)|0,k=k+Math.imul(ft,Ot)|0;var Be=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Be>>>26)|0,Be&=67108863,b=Math.imul(R,wt),h=Math.imul(R,ct),h=h+Math.imul(j,wt)|0,k=Math.imul(j,ct),b=b+Math.imul(at,ut)|0,h=h+Math.imul(at,Ot)|0,h=h+Math.imul($,ut)|0,k=k+Math.imul($,Ot)|0,b=b+Math.imul(X,nt)|0,h=h+Math.imul(X,Rt)|0,h=h+Math.imul(ft,nt)|0,k=k+Math.imul(ft,Rt)|0;var Re=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Re>>>26)|0,Re&=67108863,b=Math.imul(Z,wt),h=Math.imul(Z,ct),h=h+Math.imul(Q,wt)|0,k=Math.imul(Q,ct),b=b+Math.imul(R,ut)|0,h=h+Math.imul(R,Ot)|0,h=h+Math.imul(j,ut)|0,k=k+Math.imul(j,Ot)|0,b=b+Math.imul(at,nt)|0,h=h+Math.imul(at,Rt)|0,h=h+Math.imul($,nt)|0,k=k+Math.imul($,Rt)|0,b=b+Math.imul(X,bt)|0,h=h+Math.imul(X,Tt)|0,h=h+Math.imul(ft,bt)|0,k=k+Math.imul(ft,Tt)|0;var Te=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Te>>>26)|0,Te&=67108863,b=Math.imul(G,wt),h=Math.imul(G,ct),h=h+Math.imul(H,wt)|0,k=Math.imul(H,ct),b=b+Math.imul(Z,ut)|0,h=h+Math.imul(Z,Ot)|0,h=h+Math.imul(Q,ut)|0,k=k+Math.imul(Q,Ot)|0,b=b+Math.imul(R,nt)|0,h=h+Math.imul(R,Rt)|0,h=h+Math.imul(j,nt)|0,k=k+Math.imul(j,Rt)|0,b=b+Math.imul(at,bt)|0,h=h+Math.imul(at,Tt)|0,h=h+Math.imul($,bt)|0,k=k+Math.imul($,Tt)|0,b=b+Math.imul(X,St)|0,h=h+Math.imul(X,kt)|0,h=h+Math.imul(ft,St)|0,k=k+Math.imul(ft,kt)|0;var xe=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(xe>>>26)|0,xe&=67108863,b=Math.imul(it,wt),h=Math.imul(it,ct),h=h+Math.imul(ot,wt)|0,k=Math.imul(ot,ct),b=b+Math.imul(G,ut)|0,h=h+Math.imul(G,Ot)|0,h=h+Math.imul(H,ut)|0,k=k+Math.imul(H,Ot)|0,b=b+Math.imul(Z,nt)|0,h=h+Math.imul(Z,Rt)|0,h=h+Math.imul(Q,nt)|0,k=k+Math.imul(Q,Rt)|0,b=b+Math.imul(R,bt)|0,h=h+Math.imul(R,Tt)|0,h=h+Math.imul(j,bt)|0,k=k+Math.imul(j,Tt)|0,b=b+Math.imul(at,St)|0,h=h+Math.imul(at,kt)|0,h=h+Math.imul($,St)|0,k=k+Math.imul($,kt)|0,b=b+Math.imul(X,At)|0,h=h+Math.imul(X,Nt)|0,h=h+Math.imul(ft,At)|0,k=k+Math.imul(ft,Nt)|0;var Ce=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,b=Math.imul(_t,wt),h=Math.imul(_t,ct),h=h+Math.imul(ht,wt)|0,k=Math.imul(ht,ct),b=b+Math.imul(it,ut)|0,h=h+Math.imul(it,Ot)|0,h=h+Math.imul(ot,ut)|0,k=k+Math.imul(ot,Ot)|0,b=b+Math.imul(G,nt)|0,h=h+Math.imul(G,Rt)|0,h=h+Math.imul(H,nt)|0,k=k+Math.imul(H,Rt)|0,b=b+Math.imul(Z,bt)|0,h=h+Math.imul(Z,Tt)|0,h=h+Math.imul(Q,bt)|0,k=k+Math.imul(Q,Tt)|0,b=b+Math.imul(R,St)|0,h=h+Math.imul(R,kt)|0,h=h+Math.imul(j,St)|0,k=k+Math.imul(j,kt)|0,b=b+Math.imul(at,At)|0,h=h+Math.imul(at,Nt)|0,h=h+Math.imul($,At)|0,k=k+Math.imul($,Nt)|0,b=b+Math.imul(X,Ft)|0,h=h+Math.imul(X,Wt)|0,h=h+Math.imul(ft,Ft)|0,k=k+Math.imul(ft,Wt)|0;var Ue=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,b=Math.imul(pt,wt),h=Math.imul(pt,ct),h=h+Math.imul(V,wt)|0,k=Math.imul(V,ct),b=b+Math.imul(_t,ut)|0,h=h+Math.imul(_t,Ot)|0,h=h+Math.imul(ht,ut)|0,k=k+Math.imul(ht,Ot)|0,b=b+Math.imul(it,nt)|0,h=h+Math.imul(it,Rt)|0,h=h+Math.imul(ot,nt)|0,k=k+Math.imul(ot,Rt)|0,b=b+Math.imul(G,bt)|0,h=h+Math.imul(G,Tt)|0,h=h+Math.imul(H,bt)|0,k=k+Math.imul(H,Tt)|0,b=b+Math.imul(Z,St)|0,h=h+Math.imul(Z,kt)|0,h=h+Math.imul(Q,St)|0,k=k+Math.imul(Q,kt)|0,b=b+Math.imul(R,At)|0,h=h+Math.imul(R,Nt)|0,h=h+Math.imul(j,At)|0,k=k+Math.imul(j,Nt)|0,b=b+Math.imul(at,Ft)|0,h=h+Math.imul(at,Wt)|0,h=h+Math.imul($,Ft)|0,k=k+Math.imul($,Wt)|0,b=b+Math.imul(X,Xt)|0,h=h+Math.imul(X,Gt)|0,h=h+Math.imul(ft,Xt)|0,k=k+Math.imul(ft,Gt)|0;var Ke=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,b=Math.imul(st,wt),h=Math.imul(st,ct),h=h+Math.imul(yt,wt)|0,k=Math.imul(yt,ct),b=b+Math.imul(pt,ut)|0,h=h+Math.imul(pt,Ot)|0,h=h+Math.imul(V,ut)|0,k=k+Math.imul(V,Ot)|0,b=b+Math.imul(_t,nt)|0,h=h+Math.imul(_t,Rt)|0,h=h+Math.imul(ht,nt)|0,k=k+Math.imul(ht,Rt)|0,b=b+Math.imul(it,bt)|0,h=h+Math.imul(it,Tt)|0,h=h+Math.imul(ot,bt)|0,k=k+Math.imul(ot,Tt)|0,b=b+Math.imul(G,St)|0,h=h+Math.imul(G,kt)|0,h=h+Math.imul(H,St)|0,k=k+Math.imul(H,kt)|0,b=b+Math.imul(Z,At)|0,h=h+Math.imul(Z,Nt)|0,h=h+Math.imul(Q,At)|0,k=k+Math.imul(Q,Nt)|0,b=b+Math.imul(R,Ft)|0,h=h+Math.imul(R,Wt)|0,h=h+Math.imul(j,Ft)|0,k=k+Math.imul(j,Wt)|0,b=b+Math.imul(at,Xt)|0,h=h+Math.imul(at,Gt)|0,h=h+Math.imul($,Xt)|0,k=k+Math.imul($,Gt)|0,b=b+Math.imul(X,Qt)|0,h=h+Math.imul(X,Zt)|0,h=h+Math.imul(ft,Qt)|0,k=k+Math.imul(ft,Zt)|0;var Je=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Je>>>26)|0,Je&=67108863,b=Math.imul(dt,wt),h=Math.imul(dt,ct),h=h+Math.imul(Mt,wt)|0,k=Math.imul(Mt,ct),b=b+Math.imul(st,ut)|0,h=h+Math.imul(st,Ot)|0,h=h+Math.imul(yt,ut)|0,k=k+Math.imul(yt,Ot)|0,b=b+Math.imul(pt,nt)|0,h=h+Math.imul(pt,Rt)|0,h=h+Math.imul(V,nt)|0,k=k+Math.imul(V,Rt)|0,b=b+Math.imul(_t,bt)|0,h=h+Math.imul(_t,Tt)|0,h=h+Math.imul(ht,bt)|0,k=k+Math.imul(ht,Tt)|0,b=b+Math.imul(it,St)|0,h=h+Math.imul(it,kt)|0,h=h+Math.imul(ot,St)|0,k=k+Math.imul(ot,kt)|0,b=b+Math.imul(G,At)|0,h=h+Math.imul(G,Nt)|0,h=h+Math.imul(H,At)|0,k=k+Math.imul(H,Nt)|0,b=b+Math.imul(Z,Ft)|0,h=h+Math.imul(Z,Wt)|0,h=h+Math.imul(Q,Ft)|0,k=k+Math.imul(Q,Wt)|0,b=b+Math.imul(R,Xt)|0,h=h+Math.imul(R,Gt)|0,h=h+Math.imul(j,Xt)|0,k=k+Math.imul(j,Gt)|0,b=b+Math.imul(at,Qt)|0,h=h+Math.imul(at,Zt)|0,h=h+Math.imul($,Qt)|0,k=k+Math.imul($,Zt)|0,b=b+Math.imul(X,te)|0,h=h+Math.imul(X,re)|0,h=h+Math.imul(ft,te)|0,k=k+Math.imul(ft,re)|0;var ze=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(ze>>>26)|0,ze&=67108863,b=Math.imul(dt,ut),h=Math.imul(dt,Ot),h=h+Math.imul(Mt,ut)|0,k=Math.imul(Mt,Ot),b=b+Math.imul(st,nt)|0,h=h+Math.imul(st,Rt)|0,h=h+Math.imul(yt,nt)|0,k=k+Math.imul(yt,Rt)|0,b=b+Math.imul(pt,bt)|0,h=h+Math.imul(pt,Tt)|0,h=h+Math.imul(V,bt)|0,k=k+Math.imul(V,Tt)|0,b=b+Math.imul(_t,St)|0,h=h+Math.imul(_t,kt)|0,h=h+Math.imul(ht,St)|0,k=k+Math.imul(ht,kt)|0,b=b+Math.imul(it,At)|0,h=h+Math.imul(it,Nt)|0,h=h+Math.imul(ot,At)|0,k=k+Math.imul(ot,Nt)|0,b=b+Math.imul(G,Ft)|0,h=h+Math.imul(G,Wt)|0,h=h+Math.imul(H,Ft)|0,k=k+Math.imul(H,Wt)|0,b=b+Math.imul(Z,Xt)|0,h=h+Math.imul(Z,Gt)|0,h=h+Math.imul(Q,Xt)|0,k=k+Math.imul(Q,Gt)|0,b=b+Math.imul(R,Qt)|0,h=h+Math.imul(R,Zt)|0,h=h+Math.imul(j,Qt)|0,k=k+Math.imul(j,Zt)|0,b=b+Math.imul(at,te)|0,h=h+Math.imul(at,re)|0,h=h+Math.imul($,te)|0,k=k+Math.imul($,re)|0;var Xe=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,b=Math.imul(dt,nt),h=Math.imul(dt,Rt),h=h+Math.imul(Mt,nt)|0,k=Math.imul(Mt,Rt),b=b+Math.imul(st,bt)|0,h=h+Math.imul(st,Tt)|0,h=h+Math.imul(yt,bt)|0,k=k+Math.imul(yt,Tt)|0,b=b+Math.imul(pt,St)|0,h=h+Math.imul(pt,kt)|0,h=h+Math.imul(V,St)|0,k=k+Math.imul(V,kt)|0,b=b+Math.imul(_t,At)|0,h=h+Math.imul(_t,Nt)|0,h=h+Math.imul(ht,At)|0,k=k+Math.imul(ht,Nt)|0,b=b+Math.imul(it,Ft)|0,h=h+Math.imul(it,Wt)|0,h=h+Math.imul(ot,Ft)|0,k=k+Math.imul(ot,Wt)|0,b=b+Math.imul(G,Xt)|0,h=h+Math.imul(G,Gt)|0,h=h+Math.imul(H,Xt)|0,k=k+Math.imul(H,Gt)|0,b=b+Math.imul(Z,Qt)|0,h=h+Math.imul(Z,Zt)|0,h=h+Math.imul(Q,Qt)|0,k=k+Math.imul(Q,Zt)|0,b=b+Math.imul(R,te)|0,h=h+Math.imul(R,re)|0,h=h+Math.imul(j,te)|0,k=k+Math.imul(j,re)|0;var Ge=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,b=Math.imul(dt,bt),h=Math.imul(dt,Tt),h=h+Math.imul(Mt,bt)|0,k=Math.imul(Mt,Tt),b=b+Math.imul(st,St)|0,h=h+Math.imul(st,kt)|0,h=h+Math.imul(yt,St)|0,k=k+Math.imul(yt,kt)|0,b=b+Math.imul(pt,At)|0,h=h+Math.imul(pt,Nt)|0,h=h+Math.imul(V,At)|0,k=k+Math.imul(V,Nt)|0,b=b+Math.imul(_t,Ft)|0,h=h+Math.imul(_t,Wt)|0,h=h+Math.imul(ht,Ft)|0,k=k+Math.imul(ht,Wt)|0,b=b+Math.imul(it,Xt)|0,h=h+Math.imul(it,Gt)|0,h=h+Math.imul(ot,Xt)|0,k=k+Math.imul(ot,Gt)|0,b=b+Math.imul(G,Qt)|0,h=h+Math.imul(G,Zt)|0,h=h+Math.imul(H,Qt)|0,k=k+Math.imul(H,Zt)|0,b=b+Math.imul(Z,te)|0,h=h+Math.imul(Z,re)|0,h=h+Math.imul(Q,te)|0,k=k+Math.imul(Q,re)|0;var Ye=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,b=Math.imul(dt,St),h=Math.imul(dt,kt),h=h+Math.imul(Mt,St)|0,k=Math.imul(Mt,kt),b=b+Math.imul(st,At)|0,h=h+Math.imul(st,Nt)|0,h=h+Math.imul(yt,At)|0,k=k+Math.imul(yt,Nt)|0,b=b+Math.imul(pt,Ft)|0,h=h+Math.imul(pt,Wt)|0,h=h+Math.imul(V,Ft)|0,k=k+Math.imul(V,Wt)|0,b=b+Math.imul(_t,Xt)|0,h=h+Math.imul(_t,Gt)|0,h=h+Math.imul(ht,Xt)|0,k=k+Math.imul(ht,Gt)|0,b=b+Math.imul(it,Qt)|0,h=h+Math.imul(it,Zt)|0,h=h+Math.imul(ot,Qt)|0,k=k+Math.imul(ot,Zt)|0,b=b+Math.imul(G,te)|0,h=h+Math.imul(G,re)|0,h=h+Math.imul(H,te)|0,k=k+Math.imul(H,re)|0;var We=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(We>>>26)|0,We&=67108863,b=Math.imul(dt,At),h=Math.imul(dt,Nt),h=h+Math.imul(Mt,At)|0,k=Math.imul(Mt,Nt),b=b+Math.imul(st,Ft)|0,h=h+Math.imul(st,Wt)|0,h=h+Math.imul(yt,Ft)|0,k=k+Math.imul(yt,Wt)|0,b=b+Math.imul(pt,Xt)|0,h=h+Math.imul(pt,Gt)|0,h=h+Math.imul(V,Xt)|0,k=k+Math.imul(V,Gt)|0,b=b+Math.imul(_t,Qt)|0,h=h+Math.imul(_t,Zt)|0,h=h+Math.imul(ht,Qt)|0,k=k+Math.imul(ht,Zt)|0,b=b+Math.imul(it,te)|0,h=h+Math.imul(it,re)|0,h=h+Math.imul(ot,te)|0,k=k+Math.imul(ot,re)|0;var Ve=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,b=Math.imul(dt,Ft),h=Math.imul(dt,Wt),h=h+Math.imul(Mt,Ft)|0,k=Math.imul(Mt,Wt),b=b+Math.imul(st,Xt)|0,h=h+Math.imul(st,Gt)|0,h=h+Math.imul(yt,Xt)|0,k=k+Math.imul(yt,Gt)|0,b=b+Math.imul(pt,Qt)|0,h=h+Math.imul(pt,Zt)|0,h=h+Math.imul(V,Qt)|0,k=k+Math.imul(V,Zt)|0,b=b+Math.imul(_t,te)|0,h=h+Math.imul(_t,re)|0,h=h+Math.imul(ht,te)|0,k=k+Math.imul(ht,re)|0;var Ze=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,b=Math.imul(dt,Xt),h=Math.imul(dt,Gt),h=h+Math.imul(Mt,Xt)|0,k=Math.imul(Mt,Gt),b=b+Math.imul(st,Qt)|0,h=h+Math.imul(st,Zt)|0,h=h+Math.imul(yt,Qt)|0,k=k+Math.imul(yt,Zt)|0,b=b+Math.imul(pt,te)|0,h=h+Math.imul(pt,re)|0,h=h+Math.imul(V,te)|0,k=k+Math.imul(V,re)|0;var ar=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(ar>>>26)|0,ar&=67108863,b=Math.imul(dt,Qt),h=Math.imul(dt,Zt),h=h+Math.imul(Mt,Qt)|0,k=Math.imul(Mt,Zt),b=b+Math.imul(st,te)|0,h=h+Math.imul(st,re)|0,h=h+Math.imul(yt,te)|0,k=k+Math.imul(yt,re)|0;var br=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(br>>>26)|0,br&=67108863,b=Math.imul(dt,te),h=Math.imul(dt,re),h=h+Math.imul(Mt,te)|0,k=Math.imul(Mt,re);var cr=(w+b|0)+((h&8191)<<13)|0;return w=(k+(h>>>13)|0)+(cr>>>26)|0,cr&=67108863,S[0]=Se,S[1]=Be,S[2]=Re,S[3]=Te,S[4]=xe,S[5]=Ce,S[6]=Ue,S[7]=Ke,S[8]=Je,S[9]=ze,S[10]=Xe,S[11]=Ge,S[12]=Ye,S[13]=We,S[14]=Ve,S[15]=Ze,S[16]=ar,S[17]=br,S[18]=cr,w!==0&&(S[19]=w,v.length++),v};Math.imul||(C=x);function N(n,d,v){v.negative=d.negative^n.negative,v.length=n.length+d.length;for(var A=0,T=0,S=0;S>>26)|0,T+=w>>>26,w&=67108863}v.words[S]=b,A=w,w=T}return A!==0?v.words[S]=A:v.length--,v._strip()}function F(n,d,v){return N(n,d,v)}e.prototype.mulTo=function(n,d){var v,A=this.length+n.length;return this.length===10&&n.length===10?v=C(this,n,d):A<63?v=x(this,n,d):A<1024?v=N(this,n,d):v=F(this,n,d),v},e.prototype.mul=function(n){var d=new e(null);return d.words=new Array(this.length+n.length),this.mulTo(n,d)},e.prototype.mulf=function(n){var d=new e(null);return d.words=new Array(this.length+n.length),F(this,n,d)},e.prototype.imul=function(n){return this.clone().mulTo(n,this)},e.prototype.imuln=function(n){var d=n<0;d&&(n=-n),a(typeof n=="number"),a(n<67108864);for(var v=0,A=0;A>=26,v+=T/67108864|0,v+=S>>>26,this.words[A]=S&67108863}return v!==0&&(this.words[A]=v,this.length++),d?this.ineg():this},e.prototype.muln=function(n){return this.clone().imuln(n)},e.prototype.sqr=function(){return this.mul(this)},e.prototype.isqr=function(){return this.imul(this.clone())},e.prototype.pow=function(n){var d=B(n);if(d.length===0)return new e(1);for(var v=this,A=0;A=0);var d=n%26,v=(n-d)/26,A=67108863>>>26-d<<26-d,T;if(d!==0){var S=0;for(T=0;T>>26-d}S&&(this.words[T]=S,this.length++)}if(v!==0){for(T=this.length-1;T>=0;T--)this.words[T+v]=this.words[T];for(T=0;T=0);var A;d?A=(d-d%26)/26:A=0;var T=n%26,S=Math.min((n-T)/26,this.length),w=67108863^67108863>>>T<S)for(this.length-=S,h=0;h=0&&(k!==0||h>=A);h--){var tt=this.words[h]|0;this.words[h]=k<<26-T|tt>>>T,k=tt&w}return b&&k!==0&&(b.words[b.length++]=k),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},e.prototype.ishrn=function(n,d,v){return a(this.negative===0),this.iushrn(n,d,v)},e.prototype.shln=function(n){return this.clone().ishln(n)},e.prototype.ushln=function(n){return this.clone().iushln(n)},e.prototype.shrn=function(n){return this.clone().ishrn(n)},e.prototype.ushrn=function(n){return this.clone().iushrn(n)},e.prototype.testn=function(n){a(typeof n=="number"&&n>=0);var d=n%26,v=(n-d)/26,A=1<=0);var d=n%26,v=(n-d)/26;if(a(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(d!==0&&v++,this.length=Math.min(v,this.length),d!==0){var A=67108863^67108863>>>d<=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},e.prototype.isubn=function(n){if(a(typeof n=="number"),a(n<67108864),n<0)return this.iaddn(-n);if(this.negative!==0)return this.negative=0,this.iaddn(n),this.negative=1,this;if(this.words[0]-=n,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(b/67108864|0),this.words[T+v]=S&67108863}for(;T>26,this.words[T+v]=S&67108863;if(w===0)return this._strip();for(a(w===-1),w=0,T=0;T>26,this.words[T]=S&67108863;return this.negative=1,this._strip()},e.prototype._wordDiv=function(n,d){var v=this.length-n.length,A=this.clone(),T=n,S=T.words[T.length-1]|0,w=this._countBits(S);v=26-w,v!==0&&(T=T.ushln(v),A.iushln(v),S=T.words[T.length-1]|0);var b=A.length-T.length,h;if(d!=="mod"){h=new e(null),h.length=b+1,h.words=new Array(h.length);for(var k=0;k=0;X--){var ft=(A.words[T.length+X]|0)*67108864+(A.words[T.length+X-1]|0);for(ft=Math.min(ft/S|0,67108863),A._ishlnsubmul(T,ft,X);A.negative!==0;)ft--,A.negative=0,A._ishlnsubmul(T,1,X),A.isZero()||(A.negative^=1);h&&(h.words[X]=ft)}return h&&h._strip(),A._strip(),d!=="div"&&v!==0&&A.iushrn(v),{div:h||null,mod:A}},e.prototype.divmod=function(n,d,v){if(a(!n.isZero()),this.isZero())return{div:new e(0),mod:new e(0)};var A,T,S;return this.negative!==0&&n.negative===0?(S=this.neg().divmod(n,d),d!=="mod"&&(A=S.div.neg()),d!=="div"&&(T=S.mod.neg(),v&&T.negative!==0&&T.iadd(n)),{div:A,mod:T}):this.negative===0&&n.negative!==0?(S=this.divmod(n.neg(),d),d!=="mod"&&(A=S.div.neg()),{div:A,mod:S.mod}):this.negative&n.negative?(S=this.neg().divmod(n.neg(),d),d!=="div"&&(T=S.mod.neg(),v&&T.negative!==0&&T.isub(n)),{div:S.div,mod:T}):n.length>this.length||this.cmp(n)<0?{div:new e(0),mod:this}:n.length===1?d==="div"?{div:this.divn(n.words[0]),mod:null}:d==="mod"?{div:null,mod:new e(this.modrn(n.words[0]))}:{div:this.divn(n.words[0]),mod:new e(this.modrn(n.words[0]))}:this._wordDiv(n,d)},e.prototype.div=function(n){return this.divmod(n,"div",!1).div},e.prototype.mod=function(n){return this.divmod(n,"mod",!1).mod},e.prototype.umod=function(n){return this.divmod(n,"mod",!0).mod},e.prototype.divRound=function(n){var d=this.divmod(n);if(d.mod.isZero())return d.div;var v=d.div.negative!==0?d.mod.isub(n):d.mod,A=n.ushrn(1),T=n.andln(1),S=v.cmp(A);return S<0||T===1&&S===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},e.prototype.modrn=function(n){var d=n<0;d&&(n=-n),a(n<=67108863);for(var v=(1<<26)%n,A=0,T=this.length-1;T>=0;T--)A=(v*A+(this.words[T]|0))%n;return d?-A:A},e.prototype.modn=function(n){return this.modrn(n)},e.prototype.idivn=function(n){var d=n<0;d&&(n=-n),a(n<=67108863);for(var v=0,A=this.length-1;A>=0;A--){var T=(this.words[A]|0)+v*67108864;this.words[A]=T/n|0,v=T%n}return this._strip(),d?this.ineg():this},e.prototype.divn=function(n){return this.clone().idivn(n)},e.prototype.egcd=function(n){a(n.negative===0),a(!n.isZero());var d=this,v=n.clone();d.negative!==0?d=d.umod(n):d=d.clone();for(var A=new e(1),T=new e(0),S=new e(0),w=new e(1),b=0;d.isEven()&&v.isEven();)d.iushrn(1),v.iushrn(1),++b;for(var h=v.clone(),k=d.clone();!d.isZero();){for(var tt=0,X=1;!(d.words[0]&X)&&tt<26;++tt,X<<=1);if(tt>0)for(d.iushrn(tt);tt-- >0;)(A.isOdd()||T.isOdd())&&(A.iadd(h),T.isub(k)),A.iushrn(1),T.iushrn(1);for(var ft=0,et=1;!(v.words[0]&et)&&ft<26;++ft,et<<=1);if(ft>0)for(v.iushrn(ft);ft-- >0;)(S.isOdd()||w.isOdd())&&(S.iadd(h),w.isub(k)),S.iushrn(1),w.iushrn(1);d.cmp(v)>=0?(d.isub(v),A.isub(S),T.isub(w)):(v.isub(d),S.isub(A),w.isub(T))}return{a:S,b:w,gcd:v.iushln(b)}},e.prototype._invmp=function(n){a(n.negative===0),a(!n.isZero());var d=this,v=n.clone();d.negative!==0?d=d.umod(n):d=d.clone();for(var A=new e(1),T=new e(0),S=v.clone();d.cmpn(1)>0&&v.cmpn(1)>0;){for(var w=0,b=1;!(d.words[0]&b)&&w<26;++w,b<<=1);if(w>0)for(d.iushrn(w);w-- >0;)A.isOdd()&&A.iadd(S),A.iushrn(1);for(var h=0,k=1;!(v.words[0]&k)&&h<26;++h,k<<=1);if(h>0)for(v.iushrn(h);h-- >0;)T.isOdd()&&T.iadd(S),T.iushrn(1);d.cmp(v)>=0?(d.isub(v),A.isub(T)):(v.isub(d),T.isub(A))}var tt;return d.cmpn(1)===0?tt=A:tt=T,tt.cmpn(0)<0&&tt.iadd(n),tt},e.prototype.gcd=function(n){if(this.isZero())return n.abs();if(n.isZero())return this.abs();var d=this.clone(),v=n.clone();d.negative=0,v.negative=0;for(var A=0;d.isEven()&&v.isEven();A++)d.iushrn(1),v.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;v.isEven();)v.iushrn(1);var T=d.cmp(v);if(T<0){var S=d;d=v,v=S}else if(T===0||v.cmpn(1)===0)break;d.isub(v)}while(!0);return v.iushln(A)},e.prototype.invm=function(n){return this.egcd(n).a.umod(n)},e.prototype.isEven=function(){return(this.words[0]&1)===0},e.prototype.isOdd=function(){return(this.words[0]&1)===1},e.prototype.andln=function(n){return this.words[0]&n},e.prototype.bincn=function(n){a(typeof n=="number");var d=n%26,v=(n-d)/26,A=1<>>26,w&=67108863,this.words[S]=w}return T!==0&&(this.words[S]=T,this.length++),this},e.prototype.isZero=function(){return this.length===1&&this.words[0]===0},e.prototype.cmpn=function(n){var d=n<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var v;if(this.length>1)v=1;else{d&&(n=-n),a(n<=67108863,"Number is too big");var A=this.words[0]|0;v=A===n?0:An.length)return 1;if(this.length=0;v--){var A=this.words[v]|0,T=n.words[v]|0;if(A!==T){AT&&(d=1);break}}return d},e.prototype.gtn=function(n){return this.cmpn(n)===1},e.prototype.gt=function(n){return this.cmp(n)===1},e.prototype.gten=function(n){return this.cmpn(n)>=0},e.prototype.gte=function(n){return this.cmp(n)>=0},e.prototype.ltn=function(n){return this.cmpn(n)===-1},e.prototype.lt=function(n){return this.cmp(n)===-1},e.prototype.lten=function(n){return this.cmpn(n)<=0},e.prototype.lte=function(n){return this.cmp(n)<=0},e.prototype.eqn=function(n){return this.cmpn(n)===0},e.prototype.eq=function(n){return this.cmp(n)===0},e.red=function(n){return new O(n)},e.prototype.toRed=function(n){return a(!this.red,"Already a number in reduction context"),a(this.negative===0,"red works only with positives"),n.convertTo(this)._forceRed(n)},e.prototype.fromRed=function(){return a(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},e.prototype._forceRed=function(n){return this.red=n,this},e.prototype.forceRed=function(n){return a(!this.red,"Already a number in reduction context"),this._forceRed(n)},e.prototype.redAdd=function(n){return a(this.red,"redAdd works only with red numbers"),this.red.add(this,n)},e.prototype.redIAdd=function(n){return a(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,n)},e.prototype.redSub=function(n){return a(this.red,"redSub works only with red numbers"),this.red.sub(this,n)},e.prototype.redISub=function(n){return a(this.red,"redISub works only with red numbers"),this.red.isub(this,n)},e.prototype.redShl=function(n){return a(this.red,"redShl works only with red numbers"),this.red.shl(this,n)},e.prototype.redMul=function(n){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.mul(this,n)},e.prototype.redIMul=function(n){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.imul(this,n)},e.prototype.redSqr=function(){return a(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},e.prototype.redISqr=function(){return a(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},e.prototype.redSqrt=function(){return a(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},e.prototype.redInvm=function(){return a(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},e.prototype.redNeg=function(){return a(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},e.prototype.redPow=function(n){return a(this.red&&!n.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,n)};var I={k256:null,p224:null,p192:null,p25519:null};function U(n,d){this.name=n,this.p=new e(d,16),this.n=this.p.bitLength(),this.k=new e(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var n=new e(null);return n.words=new Array(Math.ceil(this.n/13)),n},U.prototype.ireduce=function(n){var d=n,v;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),v=d.bitLength();while(v>this.n);var A=v0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},U.prototype.split=function(n,d){n.iushrn(this.n,0,d)},U.prototype.imulK=function(n){return n.imul(this.k)};function P(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(P,U),P.prototype.split=function(n,d){for(var v=4194303,A=Math.min(n.length,9),T=0;T>>22,S=w}S>>>=22,n.words[T-10]=S,S===0&&n.length>10?n.length-=10:n.length-=9},P.prototype.imulK=function(n){n.words[n.length]=0,n.words[n.length+1]=0,n.length+=2;for(var d=0,v=0;v>>=26,n.words[v]=T,d=A}return d!==0&&(n.words[n.length++]=d),n},e._prime=function(n){if(I[n])return I[n];var d;if(n==="k256")d=new P;else if(n==="p224")d=new D;else if(n==="p192")d=new W;else if(n==="p25519")d=new q;else throw new Error("Unknown prime "+n);return I[n]=d,d};function O(n){if(typeof n=="string"){var d=e._prime(n);this.m=d.p,this.prime=d}else a(n.gtn(1),"modulus must be greater than 1"),this.m=n,this.prime=null}O.prototype._verify1=function(n){a(n.negative===0,"red works only with positives"),a(n.red,"red works only with red numbers")},O.prototype._verify2=function(n,d){a((n.negative|d.negative)===0,"red works only with positives"),a(n.red&&n.red===d.red,"red works only with red numbers")},O.prototype.imod=function(n){return this.prime?this.prime.ireduce(n)._forceRed(this):(p(n,n.umod(this.m)._forceRed(this)),n)},O.prototype.neg=function(n){return n.isZero()?n.clone():this.m.sub(n)._forceRed(this)},O.prototype.add=function(n,d){this._verify2(n,d);var v=n.add(d);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},O.prototype.iadd=function(n,d){this._verify2(n,d);var v=n.iadd(d);return v.cmp(this.m)>=0&&v.isub(this.m),v},O.prototype.sub=function(n,d){this._verify2(n,d);var v=n.sub(d);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},O.prototype.isub=function(n,d){this._verify2(n,d);var v=n.isub(d);return v.cmpn(0)<0&&v.iadd(this.m),v},O.prototype.shl=function(n,d){return this._verify1(n),this.imod(n.ushln(d))},O.prototype.imul=function(n,d){return this._verify2(n,d),this.imod(n.imul(d))},O.prototype.mul=function(n,d){return this._verify2(n,d),this.imod(n.mul(d))},O.prototype.isqr=function(n){return this.imul(n,n.clone())},O.prototype.sqr=function(n){return this.mul(n,n)},O.prototype.sqrt=function(n){if(n.isZero())return n.clone();var d=this.m.andln(3);if(a(d%2===1),d===3){var v=this.m.add(new e(1)).iushrn(2);return this.pow(n,v)}for(var A=this.m.subn(1),T=0;!A.isZero()&&A.andln(1)===0;)T++,A.iushrn(1);a(!A.isZero());var S=new e(1).toRed(this),w=S.redNeg(),b=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new e(2*h*h).toRed(this);this.pow(h,b).cmp(w)!==0;)h.redIAdd(w);for(var k=this.pow(h,A),tt=this.pow(n,A.addn(1).iushrn(1)),X=this.pow(n,A),ft=T;X.cmp(S)!==0;){for(var et=X,at=0;et.cmp(S)!==0;at++)et=et.redSqr();a(at=0;T--){for(var k=d.words[T],tt=h-1;tt>=0;tt--){var X=k>>tt&1;if(S!==A[0]&&(S=this.sqr(S)),X===0&&w===0){b=0;continue}w<<=1,w|=X,b++,!(b!==v&&(T!==0||tt!==0))&&(S=this.mul(S,A[w]),b=0,w=0)}h=26}return S},O.prototype.convertTo=function(n){var d=n.umod(this.m);return d===n?d.clone():d},O.prototype.convertFrom=function(n){var d=n.clone();return d.red=null,d},e.mont=function(n){return new L(n)};function L(n){O.call(this,n),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new e(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(L,O),L.prototype.convertTo=function(n){return this.imod(n.ushln(this.shift))},L.prototype.convertFrom=function(n){var d=this.imod(n.mul(this.rinv));return d.red=null,d},L.prototype.imul=function(n,d){if(n.isZero()||d.isZero())return n.words[0]=0,n.length=1,n;var v=n.imul(d),A=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=v.isub(A).iushrn(this.shift),S=T;return T.cmp(this.m)>=0?S=T.isub(this.m):T.cmpn(0)<0&&(S=T.iadd(this.m)),S._forceRed(this)},L.prototype.mul=function(n,d){if(n.isZero()||d.isZero())return new e(0)._forceRed(this);var v=n.mul(d),A=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=v.isub(A).iushrn(this.shift),S=T;return T.cmp(this.m)>=0?S=T.isub(this.m):T.cmpn(0)<0&&(S=T.iadd(this.m)),S._forceRed(this)},L.prototype.invm=function(n){var d=this.imod(n._invmp(this.m).mul(this.r2));return d._forceRed(this)}}(typeof i>"u"||i,t)}),X0=gt((t,i)=>{lt(),function(r){function u(b){return parseInt(b)===b}function a(b){if(!u(b.length))return!1;for(var h=0;h255)return!1;return!0}function s(b,h){if(b.buffer&&ArrayBuffer.isView(b)&&b.name==="Uint8Array")return h&&(b.slice?b=b.slice():b=Array.prototype.slice.call(b)),b;if(Array.isArray(b)){if(!a(b))throw new Error("Array contains invalid value: "+b);return new Uint8Array(b)}if(u(b.length)&&a(b))return new Uint8Array(b);throw new Error("unsupported array-like object")}function e(b){return new Uint8Array(b)}function o(b,h,k,tt,X){(tt!=null||X!=null)&&(b.slice?b=b.slice(tt,X):b=Array.prototype.slice.call(b,tt,X)),h.set(b,k)}var c=function(){function b(k){var tt=[],X=0;for(k=encodeURI(k);X191&&ft<224?(tt.push(String.fromCharCode((ft&31)<<6|k[X+1]&63)),X+=2):(tt.push(String.fromCharCode((ft&15)<<12|(k[X+1]&63)<<6|k[X+2]&63)),X+=3)}return tt.join("")}return{toBytes:b,fromBytes:h}}(),f=function(){function b(tt){for(var X=[],ft=0;ft>4]+h[et&15])}return X.join("")}return{toBytes:b,fromBytes:k}}(),l={16:10,24:12,32:14},p=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],g=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],y=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],m=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],M=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],E=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],B=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],x=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],C=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],N=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],F=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],I=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],U=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],P=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],D=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function W(b){for(var h=[],k=0;k>2,this._Ke[ft][h%4]=X[h],this._Kd[b-ft][h%4]=X[h];for(var et=0,at=tt,$;at>16&255]<<24^g[$>>8&255]<<16^g[$&255]<<8^g[$>>24&255]^p[et]<<24,et+=1,tt!=8)for(var h=1;h>8&255]<<8^g[$>>16&255]<<16^g[$>>24&255]<<24;for(var h=tt/2+1;h>2,R=at%4,this._Ke[J][R]=X[h],this._Kd[b-J][R]=X[h++],at++}for(var J=1;J>24&255]^U[$>>16&255]^P[$>>8&255]^D[$&255]},q.prototype.encrypt=function(b){if(b.length!=16)throw new Error("invalid plaintext size (must be 16 bytes)");for(var h=this._Ke.length-1,k=[0,0,0,0],tt=W(b),X=0;X<4;X++)tt[X]^=this._Ke[0][X];for(var ft=1;ft>24&255]^M[tt[(X+1)%4]>>16&255]^E[tt[(X+2)%4]>>8&255]^B[tt[(X+3)%4]&255]^this._Ke[ft][X];tt=k.slice()}for(var et=e(16),at,X=0;X<4;X++)at=this._Ke[h][X],et[4*X]=(g[tt[X]>>24&255]^at>>24)&255,et[4*X+1]=(g[tt[(X+1)%4]>>16&255]^at>>16)&255,et[4*X+2]=(g[tt[(X+2)%4]>>8&255]^at>>8)&255,et[4*X+3]=(g[tt[(X+3)%4]&255]^at)&255;return et},q.prototype.decrypt=function(b){if(b.length!=16)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var h=this._Kd.length-1,k=[0,0,0,0],tt=W(b),X=0;X<4;X++)tt[X]^=this._Kd[0][X];for(var ft=1;ft>24&255]^C[tt[(X+3)%4]>>16&255]^N[tt[(X+2)%4]>>8&255]^F[tt[(X+1)%4]&255]^this._Kd[ft][X];tt=k.slice()}for(var et=e(16),at,X=0;X<4;X++)at=this._Kd[h][X],et[4*X]=(y[tt[X]>>24&255]^at>>24)&255,et[4*X+1]=(y[tt[(X+3)%4]>>16&255]^at>>16)&255,et[4*X+2]=(y[tt[(X+2)%4]>>8&255]^at>>8)&255,et[4*X+3]=(y[tt[(X+1)%4]&255]^at)&255;return et};var O=function(b){if(!(this instanceof O))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new q(b)};O.prototype.encrypt=function(b){if(b=s(b),b.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var h=e(b.length),k=e(16),tt=0;tt=0;--h)this._counter[h]=b%256,b=b>>8},v.prototype.setBytes=function(b){if(b=s(b,!0),b.length!=16)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=b},v.prototype.increment=function(){for(var b=15;b>=0;b--)if(this._counter[b]===255)this._counter[b]=0;else{this._counter[b]++;break}};var A=function(b,h){if(!(this instanceof A))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",h instanceof v||(h=new v(h)),this._counter=h,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new q(b)};A.prototype.encrypt=function(b){for(var h=s(b,!0),k=0;k16)throw new Error("PKCS#7 padding byte out of range");for(var k=b.length-h,tt=0;tt{lt(),function(r){function u(m){let M=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]),E=1779033703,B=3144134277,x=1013904242,C=2773480762,N=1359893119,F=2600822924,I=528734635,U=1541459225,P=new Uint32Array(64);function D(v){let A=0,T=v.length;for(;T>=64;){let S=E,w=B,b=x,h=C,k=N,tt=F,X=I,ft=U,et,at,$,J,R;for(at=0;at<16;at++)$=A+at*4,P[at]=(v[$]&255)<<24|(v[$+1]&255)<<16|(v[$+2]&255)<<8|v[$+3]&255;for(at=16;at<64;at++)et=P[at-2],J=(et>>>17|et<<15)^(et>>>19|et<<13)^et>>>10,et=P[at-15],R=(et>>>7|et<<25)^(et>>>18|et<<14)^et>>>3,P[at]=(J+P[at-7]|0)+(R+P[at-16]|0)|0;for(at=0;at<64;at++)J=(((k>>>6|k<<26)^(k>>>11|k<<21)^(k>>>25|k<<7))+(k&tt^~k&X)|0)+(ft+(M[at]+P[at]|0)|0)|0,R=((S>>>2|S<<30)^(S>>>13|S<<19)^(S>>>22|S<<10))+(S&w^S&b^w&b)|0,ft=X,X=tt,tt=k,k=h+J|0,h=b,b=w,w=S,S=J+R|0;E=E+S|0,B=B+w|0,x=x+b|0,C=C+h|0,N=N+k|0,F=F+tt|0,I=I+X|0,U=U+ft|0,A+=64,T-=64}}D(m);let W,q=m.length%64,O=m.length/536870912|0,L=m.length<<3,n=q<56?56:120,d=m.slice(m.length-q,m.length);for(d.push(128),W=q+1;W>>24&255),d.push(O>>>16&255),d.push(O>>>8&255),d.push(O>>>0&255),d.push(L>>>24&255),d.push(L>>>16&255),d.push(L>>>8&255),d.push(L>>>0&255),D(d),[E>>>24&255,E>>>16&255,E>>>8&255,E>>>0&255,B>>>24&255,B>>>16&255,B>>>8&255,B>>>0&255,x>>>24&255,x>>>16&255,x>>>8&255,x>>>0&255,C>>>24&255,C>>>16&255,C>>>8&255,C>>>0&255,N>>>24&255,N>>>16&255,N>>>8&255,N>>>0&255,F>>>24&255,F>>>16&255,F>>>8&255,F>>>0&255,I>>>24&255,I>>>16&255,I>>>8&255,I>>>0&255,U>>>24&255,U>>>16&255,U>>>8&255,U>>>0&255]}function a(m,M,E){m=m.length<=64?m:u(m);let B=64+M.length+4,x=new Array(B),C=new Array(64),N,F=[];for(N=0;N<64;N++)x[N]=54;for(N=0;N=B-4;U--){if(x[U]++,x[U]<=255)return;x[U]=0}}for(;E>=32;)I(),F=F.concat(u(C.concat(u(x)))),E-=32;return E>0&&(I(),F=F.concat(u(C.concat(u(x))).slice(0,E))),F}function s(m,M,E,B,x){let C;for(f(m,(2*E-1)*16,x,0,16),C=0;C<2*E;C++)c(m,C*16,x,16),o(x,B),f(x,0,m,M+C*16,16);for(C=0;C>>32-M}function o(m,M){f(m,0,M,0,16);for(let E=8;E>0;E-=2)M[4]^=e(M[0]+M[12],7),M[8]^=e(M[4]+M[0],9),M[12]^=e(M[8]+M[4],13),M[0]^=e(M[12]+M[8],18),M[9]^=e(M[5]+M[1],7),M[13]^=e(M[9]+M[5],9),M[1]^=e(M[13]+M[9],13),M[5]^=e(M[1]+M[13],18),M[14]^=e(M[10]+M[6],7),M[2]^=e(M[14]+M[10],9),M[6]^=e(M[2]+M[14],13),M[10]^=e(M[6]+M[2],18),M[3]^=e(M[15]+M[11],7),M[7]^=e(M[3]+M[15],9),M[11]^=e(M[7]+M[3],13),M[15]^=e(M[11]+M[7],18),M[1]^=e(M[0]+M[3],7),M[2]^=e(M[1]+M[0],9),M[3]^=e(M[2]+M[1],13),M[0]^=e(M[3]+M[2],18),M[6]^=e(M[5]+M[4],7),M[7]^=e(M[6]+M[5],9),M[4]^=e(M[7]+M[6],13),M[5]^=e(M[4]+M[7],18),M[11]^=e(M[10]+M[9],7),M[8]^=e(M[11]+M[10],9),M[9]^=e(M[8]+M[11],13),M[10]^=e(M[9]+M[8],18),M[12]^=e(M[15]+M[14],7),M[13]^=e(M[12]+M[15],9),M[14]^=e(M[13]+M[12],13),M[15]^=e(M[14]+M[13],18);for(let E=0;E<16;++E)m[E]+=M[E]}function c(m,M,E,B){for(let x=0;x=256)return!1}return!0}function p(m,M){if(typeof m!="number"||m%1)throw new Error("invalid "+M);return m}function g(m,M,E,B,x,C,N){if(E=p(E,"N"),B=p(B,"r"),x=p(x,"p"),C=p(C,"dkLen"),E===0||(E&E-1)!==0)throw new Error("N must be power of 2");if(E>2147483647/128/B)throw new Error("N too large");if(B>2147483647/128/x)throw new Error("r too large");if(!l(m))throw new Error("password must be an array or buffer");if(m=Array.prototype.slice.call(m),!l(M))throw new Error("salt must be an array or buffer");M=Array.prototype.slice.call(M);let F=a(m,M,x*128*B),I=new Uint32Array(x*32*B);for(let k=0;kw&&(k=w);for(let X=0;Xw&&(k=w);for(let X=0;X>0&255),F.push(I[X]>>8&255),F.push(I[X]>>16&255),F.push(I[X]>>24&255);let tt=a(m,F,C);return N&&N(null,1,tt),tt}N&&b(h)};if(!N)for(;;){let k=h();if(k!=null)return k}h()}let y={scrypt:function(m,M,E,B,x,C,N){return new Promise(function(F,I){let U=0;N&&N(0),g(m,M,E,B,x,C,function(P,D,W){if(P)I(P);else if(W)N&&U!==1&&N(1),F(new Uint8Array(W));else if(N&&D!==U)return U=D,N(D)})})},syncScrypt:function(m,M,E,B,x,C){return new Uint8Array(g(m,M,E,B,x,C))}};typeof t<"u"?i.exports=y:typeof define=="function"&&define.amd?define(y):r&&(r.scrypt&&(r._scrypt=r.scrypt),r.scrypt=y)}(t)}),Sy=gt((t,i)=>{lt();var r=Ee().Buffer;function u(a){if(a.length>=255)throw new TypeError("Alphabet too long");for(var s=new Uint8Array(256),e=0;e>>0,U=new Uint8Array(I);N!==F;){for(var P=B[N],D=0,W=I-1;(P!==0||D>>0,U[W]=P%l>>>0,P=P/l>>>0;if(P!==0)throw new Error("Non-zero carry");C=D,N++}for(var q=I-C;q!==I&&U[q]===0;)q++;for(var O=p.repeat(x);q>>0,I=new Uint8Array(F);B[x];){var U=s[B.charCodeAt(x)];if(U===255)return;for(var P=0,D=F-1;(U!==0||P>>0,I[D]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");N=P,x++}for(var W=F-N;W!==F&&I[W]===0;)W++;var q=r.allocUnsafe(C+(F-W));q.fill(0,0,C);for(var O=C;W!==F;)q[O++]=I[W++];return q}function E(B){var x=M(B);if(x)return x;throw new Error("Non-base"+l+" character")}return{encode:m,decodeUnsafe:M,decode:E}}i.exports=u}),Ay=gt((t,i)=>{lt();var r=Sy(),u="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";i.exports=r(u)}),Ty=gt((t,i)=>{lt();var r={IMPOSSIBLE_CASE:"Impossible case. Please create issue.",TWEAK_ADD:"The tweak was out of range or the resulted private key is invalid",TWEAK_MUL:"The tweak was out of range or equal to zero",CONTEXT_RANDOMIZE_UNKNOW:"Unknow error on context randomization",SECKEY_INVALID:"Private Key is invalid",PUBKEY_PARSE:"Public Key could not be parsed",PUBKEY_SERIALIZE:"Public Key serialization error",PUBKEY_COMBINE:"The sum of the public keys is not valid",SIG_PARSE:"Signature could not be parsed",SIGN:"The nonce generation function failed, or the private key was invalid",RECOVER:"Public key could not be recover",ECDH:"Scalar was invalid (zero or overflow)"};function u(c,f){if(!c)throw new Error(f)}function a(c,f,l){if(u(f instanceof Uint8Array,`Expected ${c} to be an Uint8Array`),l!==void 0)if(Array.isArray(l)){let p=l.join(", "),g=`Expected ${c} to be an Uint8Array with length [${p}]`;u(l.includes(f.length),g)}else{let p=`Expected ${c} to be an Uint8Array with length ${l}`;u(f.length===l,p)}}function s(c){u(o(c)==="Boolean","Expected compressed to be a Boolean")}function e(c=l=>new Uint8Array(l),f){return typeof c=="function"&&(c=c(f)),a("output",c,f),c}function o(c){return Object.prototype.toString.call(c).slice(8,-1)}i.exports=c=>({contextRandomize(f){switch(u(f===null||f instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),f!==null&&a("seed",f,32),c.contextRandomize(f)){case 1:throw new Error(r.CONTEXT_RANDOMIZE_UNKNOW)}},privateKeyVerify(f){return a("private key",f,32),c.privateKeyVerify(f)===0},privateKeyNegate(f){switch(a("private key",f,32),c.privateKeyNegate(f)){case 0:return f;case 1:throw new Error(r.IMPOSSIBLE_CASE)}},privateKeyTweakAdd(f,l){switch(a("private key",f,32),a("tweak",l,32),c.privateKeyTweakAdd(f,l)){case 0:return f;case 1:throw new Error(r.TWEAK_ADD)}},privateKeyTweakMul(f,l){switch(a("private key",f,32),a("tweak",l,32),c.privateKeyTweakMul(f,l)){case 0:return f;case 1:throw new Error(r.TWEAK_MUL)}},publicKeyVerify(f){return a("public key",f,[33,65]),c.publicKeyVerify(f)===0},publicKeyCreate(f,l=!0,p){switch(a("private key",f,32),s(l),p=e(p,l?33:65),c.publicKeyCreate(p,f)){case 0:return p;case 1:throw new Error(r.SECKEY_INVALID);case 2:throw new Error(r.PUBKEY_SERIALIZE)}},publicKeyConvert(f,l=!0,p){switch(a("public key",f,[33,65]),s(l),p=e(p,l?33:65),c.publicKeyConvert(p,f)){case 0:return p;case 1:throw new Error(r.PUBKEY_PARSE);case 2:throw new Error(r.PUBKEY_SERIALIZE)}},publicKeyNegate(f,l=!0,p){switch(a("public key",f,[33,65]),s(l),p=e(p,l?33:65),c.publicKeyNegate(p,f)){case 0:return p;case 1:throw new Error(r.PUBKEY_PARSE);case 2:throw new Error(r.IMPOSSIBLE_CASE);case 3:throw new Error(r.PUBKEY_SERIALIZE)}},publicKeyCombine(f,l=!0,p){u(Array.isArray(f),"Expected public keys to be an Array"),u(f.length>0,"Expected public keys array will have more than zero items");for(let g of f)a("public key",g,[33,65]);switch(s(l),p=e(p,l?33:65),c.publicKeyCombine(p,f)){case 0:return p;case 1:throw new Error(r.PUBKEY_PARSE);case 2:throw new Error(r.PUBKEY_COMBINE);case 3:throw new Error(r.PUBKEY_SERIALIZE)}},publicKeyTweakAdd(f,l,p=!0,g){switch(a("public key",f,[33,65]),a("tweak",l,32),s(p),g=e(g,p?33:65),c.publicKeyTweakAdd(g,f,l)){case 0:return g;case 1:throw new Error(r.PUBKEY_PARSE);case 2:throw new Error(r.TWEAK_ADD)}},publicKeyTweakMul(f,l,p=!0,g){switch(a("public key",f,[33,65]),a("tweak",l,32),s(p),g=e(g,p?33:65),c.publicKeyTweakMul(g,f,l)){case 0:return g;case 1:throw new Error(r.PUBKEY_PARSE);case 2:throw new Error(r.TWEAK_MUL)}},signatureNormalize(f){switch(a("signature",f,64),c.signatureNormalize(f)){case 0:return f;case 1:throw new Error(r.SIG_PARSE)}},signatureExport(f,l){a("signature",f,64),l=e(l,72);let p={output:l,outputlen:72};switch(c.signatureExport(p,f)){case 0:return l.slice(0,p.outputlen);case 1:throw new Error(r.SIG_PARSE);case 2:throw new Error(r.IMPOSSIBLE_CASE)}},signatureImport(f,l){switch(a("signature",f),l=e(l,64),c.signatureImport(l,f)){case 0:return l;case 1:throw new Error(r.SIG_PARSE);case 2:throw new Error(r.IMPOSSIBLE_CASE)}},ecdsaSign(f,l,p={},g){a("message",f,32),a("private key",l,32),u(o(p)==="Object","Expected options to be an Object"),p.data!==void 0&&a("options.data",p.data),p.noncefn!==void 0&&u(o(p.noncefn)==="Function","Expected options.noncefn to be a Function"),g=e(g,64);let y={signature:g,recid:null};switch(c.ecdsaSign(y,f,l,p.data,p.noncefn)){case 0:return y;case 1:throw new Error(r.SIGN);case 2:throw new Error(r.IMPOSSIBLE_CASE)}},ecdsaVerify(f,l,p){switch(a("signature",f,64),a("message",l,32),a("public key",p,[33,65]),c.ecdsaVerify(f,l,p)){case 0:return!0;case 3:return!1;case 1:throw new Error(r.SIG_PARSE);case 2:throw new Error(r.PUBKEY_PARSE)}},ecdsaRecover(f,l,p,g=!0,y){switch(a("signature",f,64),u(o(l)==="Number"&&l>=0&&l<=3,"Expected recovery id to be a Number within interval [0, 3]"),a("message",p,32),s(g),y=e(y,g?33:65),c.ecdsaRecover(y,f,l,p)){case 0:return y;case 1:throw new Error(r.SIG_PARSE);case 2:throw new Error(r.RECOVER);case 3:throw new Error(r.IMPOSSIBLE_CASE)}},ecdh(f,l,p={},g){switch(a("public key",f,[33,65]),a("private key",l,32),u(o(p)==="Object","Expected options to be an Object"),p.data!==void 0&&a("options.data",p.data),p.hashfn!==void 0?(u(o(p.hashfn)==="Function","Expected options.hashfn to be a Function"),p.xbuf!==void 0&&a("options.xbuf",p.xbuf,32),p.ybuf!==void 0&&a("options.ybuf",p.ybuf,32),a("output",g)):g=e(g,32),c.ecdh(g,f,l,p.data,p.hashfn,p.xbuf,p.ybuf)){case 0:return g;case 1:throw new Error(r.PUBKEY_PARSE);case 2:throw new Error(r.ECDH)}}})}),My=gt((t,i)=>{lt();var r=rs().ec,u=new r("secp256k1"),a=u.curve,s=a.n.constructor;function e(l,p){let g=new s(p);if(g.cmp(a.p)>=0)return null;g=g.toRed(a.red);let y=g.redSqr().redIMul(g).redIAdd(a.b).redSqrt();return l===3!==y.isOdd()&&(y=y.redNeg()),u.keyPair({pub:{x:g,y}})}function o(l,p,g){let y=new s(p),m=new s(g);if(y.cmp(a.p)>=0||m.cmp(a.p)>=0||(y=y.toRed(a.red),m=m.toRed(a.red),(l===6||l===7)&&m.isOdd()!==(l===7)))return null;let M=y.redSqr().redIMul(y);return m.redSqr().redISub(M.redIAdd(a.b)).isZero()?u.keyPair({pub:{x:y,y:m}}):null}function c(l){let p=l[0];switch(p){case 2:case 3:return l.length!==33?null:e(p,l.subarray(1,33));case 4:case 6:case 7:return l.length!==65?null:o(p,l.subarray(1,33),l.subarray(33,65));default:return null}}function f(l,p){let g=p.encode(null,l.length===33);for(let y=0;y=0||(g.iadd(new s(l)),g.cmp(a.n)>=0&&g.isub(a.n),g.isZero()))return 1;let y=g.toArrayLike(Uint8Array,"be",32);return l.set(y),0},privateKeyTweakMul(l,p){let g=new s(p);if(g.cmp(a.n)>=0||g.isZero())return 1;g.imul(new s(l)),g.cmp(a.n)>=0&&(g=g.umod(a.n));let y=g.toArrayLike(Uint8Array,"be",32);return l.set(y),0},publicKeyVerify(l){return c(l)===null?1:0},publicKeyCreate(l,p){let g=new s(p);if(g.cmp(a.n)>=0||g.isZero())return 1;let y=u.keyFromPrivate(p).getPublic();return f(l,y),0},publicKeyConvert(l,p){let g=c(p);if(g===null)return 1;let y=g.getPublic();return f(l,y),0},publicKeyNegate(l,p){let g=c(p);if(g===null)return 1;let y=g.getPublic();return y.y=y.y.redNeg(),f(l,y),0},publicKeyCombine(l,p){let g=new Array(p.length);for(let m=0;m=0)return 2;let m=y.getPublic().add(a.g.mul(g));return m.isInfinity()?2:(f(l,m),0)},publicKeyTweakMul(l,p,g){let y=c(p);if(y===null)return 1;if(g=new s(g),g.cmp(a.n)>=0||g.isZero())return 2;let m=y.getPublic().mul(g);return f(l,m),0},signatureNormalize(l){let p=new s(l.subarray(0,32)),g=new s(l.subarray(32,64));return p.cmp(a.n)>=0||g.cmp(a.n)>=0?1:(g.cmp(u.nh)===1&&l.set(a.n.sub(g).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(l,p){let g=p.subarray(0,32),y=p.subarray(32,64);if(new s(g).cmp(a.n)>=0||new s(y).cmp(a.n)>=0)return 1;let{output:m}=l,M=m.subarray(4,37);M[0]=0,M.set(g,1);let E=33,B=0;for(;E>1&&M[B]===0&&!(M[B+1]&128);--E,++B);if(M=M.subarray(B),M[0]&128||E>1&&M[0]===0&&!(M[1]&128))return 1;let x=m.subarray(39,72);x[0]=0,x.set(y,1);let C=33,N=0;for(;C>1&&x[N]===0&&!(x[N+1]&128);--C,++N);return x=x.subarray(N),x[0]&128||C>1&&x[0]===0&&!(x[1]&128)?1:(l.outputlen=6+E+C,m[0]=48,m[1]=l.outputlen-2,m[2]=2,m[3]=M.length,m.set(M,4),m[4+E]=2,m[5+E]=x.length,m.set(x,6+E),0)},signatureImport(l,p){if(p.length<8||p.length>72||p[0]!==48||p[1]!==p.length-2||p[2]!==2)return 1;let g=p[3];if(g===0||5+g>=p.length||p[4+g]!==2)return 1;let y=p[5+g];if(y===0||6+g+y!==p.length||p[4]&128||g>1&&p[4]===0&&!(p[5]&128)||p[g+6]&128||y>1&&p[g+6]===0&&!(p[g+7]&128))return 1;let m=p.subarray(4,4+g);if(m.length===33&&m[0]===0&&(m=m.subarray(1)),m.length>32)return 1;let M=p.subarray(6+g);if(M.length===33&&M[0]===0&&(M=M.slice(1)),M.length>32)throw new Error("S length is too long");let E=new s(m);E.cmp(a.n)>=0&&(E=new s(0));let B=new s(p.subarray(6+g));return B.cmp(a.n)>=0&&(B=new s(0)),l.set(E.toArrayLike(Uint8Array,"be",32),0),l.set(B.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(l,p,g,y,m){if(m){let B=m;m=x=>{let C=B(p,g,null,y,x);if(!(C instanceof Uint8Array&&C.length===32))throw new Error("This is the way");return new s(C)}}let M=new s(g);if(M.cmp(a.n)>=0||M.isZero())return 1;let E;try{E=u.sign(p,g,{canonical:!0,k:m,pers:y})}catch{return 1}return l.signature.set(E.r.toArrayLike(Uint8Array,"be",32),0),l.signature.set(E.s.toArrayLike(Uint8Array,"be",32),32),l.recid=E.recoveryParam,0},ecdsaVerify(l,p,g){let y={r:l.subarray(0,32),s:l.subarray(32,64)},m=new s(y.r),M=new s(y.s);if(m.cmp(a.n)>=0||M.cmp(a.n)>=0)return 1;if(M.cmp(u.nh)===1||m.isZero()||M.isZero())return 3;let E=c(g);if(E===null)return 2;let B=E.getPublic();return u.verify(p,y,B)?0:3},ecdsaRecover(l,p,g,y){let m={r:p.slice(0,32),s:p.slice(32,64)},M=new s(m.r),E=new s(m.s);if(M.cmp(a.n)>=0||E.cmp(a.n)>=0)return 1;if(M.isZero()||E.isZero())return 2;let B;try{B=u.recoverPubKey(y,m,g)}catch{return 2}return f(l,B),0},ecdh(l,p,g,y,m,M,E){let B=c(p);if(B===null)return 1;let x=new s(g);if(x.cmp(a.n)>=0||x.isZero())return 2;let C=B.getPublic().mul(x);if(m===void 0){let N=C.encode(null,!0),F=u.hash().update(N).digest();for(let I=0;I<32;++I)l[I]=F[I]}else{M||(M=new Uint8Array(32));let N=C.getX().toArray("be",32);for(let U=0;U<32;++U)M[U]=N[U];E||(E=new Uint8Array(32));let F=C.getY().toArray("be",32);for(let U=0;U<32;++U)E[U]=F[U];let I=m(M,E,y);if(!(I instanceof Uint8Array&&I.length===l.length))return 2;l.set(I)}return 0}}}),Y0=gt((t,i)=>{lt(),i.exports=Ty()(My())}),xy=gt((t,i)=>{lt();var{Transform:r}=kr();i.exports=u=>class Q0 extends r{constructor(s,e,o,c,f){super(f),this._rate=s,this._capacity=e,this._delimitedSuffix=o,this._hashBitLength=c,this._options=f,this._state=new u,this._state.initialize(s,e),this._finalized=!1}_transform(s,e,o){let c=null;try{this.update(s,e)}catch(f){c=f}o(c)}_flush(s){let e=null;try{this.push(this.digest())}catch(o){e=o}s(e)}update(s,e){if(!Ut.Buffer.isBuffer(s)&&typeof s!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Ut.Buffer.isBuffer(s)||(s=Ut.Buffer.from(s,e)),this._state.absorb(s),this}digest(s){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let e=this._state.squeeze(this._hashBitLength/8);return s!==void 0&&(e=e.toString(s)),this._resetState(),e}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let s=new Q0(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(s._state),s._finalized=this._finalized,s}}}),ky=gt((t,i)=>{lt();var{Transform:r}=kr();i.exports=u=>class td extends r{constructor(s,e,o,c){super(c),this._rate=s,this._capacity=e,this._delimitedSuffix=o,this._options=c,this._state=new u,this._state.initialize(s,e),this._finalized=!1}_transform(s,e,o){let c=null;try{this.update(s,e)}catch(f){c=f}o(c)}_flush(){}_read(s){this.push(this.squeeze(s))}update(s,e){if(!Ut.Buffer.isBuffer(s)&&typeof s!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Ut.Buffer.isBuffer(s)||(s=Ut.Buffer.from(s,e)),this._state.absorb(s),this}squeeze(s,e){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let o=this._state.squeeze(s);return e!==void 0&&(o=o.toString(e)),o}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let s=new td(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(s._state),s._finalized=this._finalized,s}}}),Oy=gt((t,i)=>{lt();var r=xy(),u=ky();i.exports=function(a){let s=r(a),e=u(a);return function(o,c){switch(typeof o=="string"?o.toLowerCase():o){case"keccak224":return new s(1152,448,null,224,c);case"keccak256":return new s(1088,512,null,256,c);case"keccak384":return new s(832,768,null,384,c);case"keccak512":return new s(576,1024,null,512,c);case"sha3-224":return new s(1152,448,6,224,c);case"sha3-256":return new s(1088,512,6,256,c);case"sha3-384":return new s(832,768,6,384,c);case"sha3-512":return new s(576,1024,6,512,c);case"shake128":return new e(1344,256,31,c);case"shake256":return new e(1088,512,31,c);default:throw new Error("Invald algorithm: "+o)}}}}),Iy=gt(t=>{lt();var i=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];t.p1600=function(r){for(let u=0;u<24;++u){let a=r[0]^r[10]^r[20]^r[30]^r[40],s=r[1]^r[11]^r[21]^r[31]^r[41],e=r[2]^r[12]^r[22]^r[32]^r[42],o=r[3]^r[13]^r[23]^r[33]^r[43],c=r[4]^r[14]^r[24]^r[34]^r[44],f=r[5]^r[15]^r[25]^r[35]^r[45],l=r[6]^r[16]^r[26]^r[36]^r[46],p=r[7]^r[17]^r[27]^r[37]^r[47],g=r[8]^r[18]^r[28]^r[38]^r[48],y=r[9]^r[19]^r[29]^r[39]^r[49],m=g^(e<<1|o>>>31),M=y^(o<<1|e>>>31),E=r[0]^m,B=r[1]^M,x=r[10]^m,C=r[11]^M,N=r[20]^m,F=r[21]^M,I=r[30]^m,U=r[31]^M,P=r[40]^m,D=r[41]^M;m=a^(c<<1|f>>>31),M=s^(f<<1|c>>>31);let W=r[2]^m,q=r[3]^M,O=r[12]^m,L=r[13]^M,n=r[22]^m,d=r[23]^M,v=r[32]^m,A=r[33]^M,T=r[42]^m,S=r[43]^M;m=e^(l<<1|p>>>31),M=o^(p<<1|l>>>31);let w=r[4]^m,b=r[5]^M,h=r[14]^m,k=r[15]^M,tt=r[24]^m,X=r[25]^M,ft=r[34]^m,et=r[35]^M,at=r[44]^m,$=r[45]^M;m=c^(g<<1|y>>>31),M=f^(y<<1|g>>>31);let J=r[6]^m,R=r[7]^M,j=r[16]^m,z=r[17]^M,Z=r[26]^m,Q=r[27]^M,K=r[36]^m,G=r[37]^M,H=r[46]^m,Y=r[47]^M;m=l^(a<<1|s>>>31),M=p^(s<<1|a>>>31);let it=r[8]^m,ot=r[9]^M,mt=r[18]^m,_t=r[19]^M,ht=r[28]^m,vt=r[29]^M,pt=r[38]^m,V=r[39]^M,rt=r[48]^m,st=r[49]^M,yt=E,Ct=B,dt=C<<4|x>>>28,Mt=x<<4|C>>>28,Lt=N<<3|F>>>29,wt=F<<3|N>>>29,ct=U<<9|I>>>23,Et=I<<9|U>>>23,ut=P<<18|D>>>14,Ot=D<<18|P>>>14,qt=W<<1|q>>>31,nt=q<<1|W>>>31,Rt=L<<12|O>>>20,Dt=O<<12|L>>>20,bt=n<<10|d>>>22,Tt=d<<10|n>>>22,jt=A<<13|v>>>19,St=v<<13|A>>>19,kt=T<<2|S>>>30,Kt=S<<2|T>>>30,At=b<<30|w>>>2,Nt=w<<30|b>>>2,$t=h<<6|k>>>26,Ft=k<<6|h>>>26,Wt=X<<11|tt>>>21,ae=tt<<11|X>>>21,Xt=ft<<15|et>>>17,Gt=et<<15|ft>>>17,he=$<<29|at>>>3,Qt=at<<29|$>>>3,Zt=J<<28|R>>>4,se=R<<28|J>>>4,te=z<<23|j>>>9,re=j<<23|z>>>9,Se=Z<<25|Q>>>7,Be=Q<<25|Z>>>7,Re=K<<21|G>>>11,Te=G<<21|K>>>11,xe=Y<<24|H>>>8,Ce=H<<24|Y>>>8,Ue=it<<27|ot>>>5,Ke=ot<<27|it>>>5,Je=mt<<20|_t>>>12,ze=_t<<20|mt>>>12,Xe=vt<<7|ht>>>25,Ge=ht<<7|vt>>>25,Ye=pt<<8|V>>>24,We=V<<8|pt>>>24,Ve=rt<<14|st>>>18,Ze=st<<14|rt>>>18;r[0]=yt^~Rt&Wt,r[1]=Ct^~Dt&ae,r[10]=Zt^~Je&Lt,r[11]=se^~ze&wt,r[20]=qt^~$t&Se,r[21]=nt^~Ft&Be,r[30]=Ue^~dt&bt,r[31]=Ke^~Mt&Tt,r[40]=At^~te&Xe,r[41]=Nt^~re&Ge,r[2]=Rt^~Wt&Re,r[3]=Dt^~ae&Te,r[12]=Je^~Lt&jt,r[13]=ze^~wt&St,r[22]=$t^~Se&Ye,r[23]=Ft^~Be&We,r[32]=dt^~bt&Xt,r[33]=Mt^~Tt&Gt,r[42]=te^~Xe&ct,r[43]=re^~Ge&Et,r[4]=Wt^~Re&Ve,r[5]=ae^~Te&Ze,r[14]=Lt^~jt&he,r[15]=wt^~St&Qt,r[24]=Se^~Ye&ut,r[25]=Be^~We&Ot,r[34]=bt^~Xt&xe,r[35]=Tt^~Gt&Ce,r[44]=Xe^~ct&kt,r[45]=Ge^~Et&Kt,r[6]=Re^~Ve&yt,r[7]=Te^~Ze&Ct,r[16]=jt^~he&Zt,r[17]=St^~Qt&se,r[26]=Ye^~ut&qt,r[27]=We^~Ot&nt,r[36]=Xt^~xe&Ue,r[37]=Gt^~Ce&Ke,r[46]=ct^~kt&At,r[47]=Et^~Kt&Nt,r[8]=Ve^~yt&Rt,r[9]=Ze^~Ct&Dt,r[18]=he^~Zt&Je,r[19]=Qt^~se&ze,r[28]=ut^~qt&$t,r[29]=Ot^~nt&Ft,r[38]=xe^~Ue&dt,r[39]=Ce^~Ke&Mt,r[48]=kt^~At&te,r[49]=Kt^~Nt&re,r[0]^=i[u*2],r[1]^=i[u*2+1]}}}),By=gt((t,i)=>{lt();var r=Iy();function u(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}u.prototype.initialize=function(a,s){for(let e=0;e<50;++e)this.state[e]=0;this.blockSize=a/8,this.count=0,this.squeezing=!1},u.prototype.absorb=function(a){for(let s=0;s>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(r.p1600(this.state),this.count=0);return s},u.prototype.copy=function(a){for(let s=0;s<50;++s)a.state[s]=this.state[s];a.blockSize=this.blockSize,a.count=this.count,a.squeezing=this.squeezing},i.exports=u}),Cy=gt((t,i)=>{lt(),i.exports=Oy()(By())}),Py=gt((t,i)=>{lt(),function(r){var u,a=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,s=Math.ceil,e=Math.floor,o="[BigNumber Error] ",c=o+"Number primitive has more than 15 significant digits: ",f=1e14,l=14,p=9007199254740991,g=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,m=1e9;function M(U){var P,D,W,q=X.prototype={constructor:X,toString:null,valueOf:null},O=new X(1),L=20,n=4,d=-7,v=21,A=-1e7,T=1e7,S=!1,w=1,b=0,h={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},k="0123456789abcdefghijklmnopqrstuvwxyz",tt=!0;function X(R,j){var z,Z,Q,K,G,H,Y,it,ot=this;if(!(ot instanceof X))return new X(R,j);if(j==null){if(R&&R._isBigNumber===!0){ot.s=R.s,!R.c||R.e>T?ot.c=ot.e=null:R.e=10;G/=10,K++);K>T?ot.c=ot.e=null:(ot.e=K,ot.c=[R]);return}it=String(R)}else{if(!a.test(it=String(R)))return W(ot,it,H);ot.s=it.charCodeAt(0)==45?(it=it.slice(1),-1):1}(K=it.indexOf("."))>-1&&(it=it.replace(".","")),(G=it.search(/e/i))>0?(K<0&&(K=G),K+=+it.slice(G+1),it=it.substring(0,G)):K<0&&(K=it.length)}else{if(C(j,2,k.length,"Base"),j==10&&tt)return ot=new X(R),$(ot,L+ot.e+1,n);if(it=String(R),H=typeof R=="number"){if(R*0!=0)return W(ot,it,H,j);if(ot.s=1/R<0?(it=it.slice(1),-1):1,X.DEBUG&&it.replace(/^0\.0*|\./,"").length>15)throw Error(c+R)}else ot.s=it.charCodeAt(0)===45?(it=it.slice(1),-1):1;for(z=k.slice(0,j),K=G=0,Y=it.length;GK){K=Y;continue}}else if(!Q&&(it==it.toUpperCase()&&(it=it.toLowerCase())||it==it.toLowerCase()&&(it=it.toUpperCase()))){Q=!0,G=-1,K=0;continue}return W(ot,String(R),H,j)}H=!1,it=D(it,j,10,ot.s),(K=it.indexOf("."))>-1?it=it.replace(".",""):K=it.length}for(G=0;it.charCodeAt(G)===48;G++);for(Y=it.length;it.charCodeAt(--Y)===48;);if(it=it.slice(G,++Y)){if(Y-=G,H&&X.DEBUG&&Y>15&&(R>p||R!==e(R)))throw Error(c+ot.s*R);if((K=K-G-1)>T)ot.c=ot.e=null;else if(K=-m&&Q<=m&&Q===e(Q)){if(Z[0]===0){if(Q===0&&Z.length===1)return!0;break t}if(j=(Q+1)%l,j<1&&(j+=l),String(Z[0]).length==j){for(j=0;j=f||z!==e(z))break t;if(z!==0)return!0}}}else if(Z===null&&Q===null&&(K===null||K===1||K===-1))return!0;throw Error(o+"Invalid BigNumber: "+R)},X.maximum=X.max=function(){return et(arguments,-1)},X.minimum=X.min=function(){return et(arguments,1)},X.random=function(){var R=9007199254740992,j=Math.random()*R&2097151?function(){return e(Math.random()*R)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(z){var Z,Q,K,G,H,Y=0,it=[],ot=new X(O);if(z==null?z=L:C(z,0,m),G=s(z/l),S)if(crypto.getRandomValues){for(Z=crypto.getRandomValues(new Uint32Array(G*=2));Y>>11),H>=9e15?(Q=crypto.getRandomValues(new Uint32Array(2)),Z[Y]=Q[0],Z[Y+1]=Q[1]):(it.push(H%1e14),Y+=2);Y=G/2}else if(crypto.randomBytes){for(Z=crypto.randomBytes(G*=7);Y=9e15?crypto.randomBytes(7).copy(Z,Y):(it.push(H%1e14),Y+=7);Y=G/7}else throw S=!1,Error(o+"crypto unavailable");if(!S)for(;Y=10;H/=10,Y++);YQ-1&&(H[G+1]==null&&(H[G+1]=0),H[G+1]+=H[G]/Q|0,H[G]%=Q)}return H.reverse()}return function(z,Z,Q,K,G){var H,Y,it,ot,mt,_t,ht,vt,pt=z.indexOf("."),V=L,rt=n;for(pt>=0&&(ot=b,b=0,z=z.replace(".",""),vt=new X(Z),_t=vt.pow(z.length-pt),b=ot,vt.c=j(I(B(_t.c),_t.e,"0"),10,Q,R),vt.e=vt.c.length),ht=j(z,Z,Q,G?(H=k,R):(H=R,k)),it=ot=ht.length;ht[--ot]==0;ht.pop());if(!ht[0])return H.charAt(0);if(pt<0?--it:(_t.c=ht,_t.e=it,_t.s=K,_t=P(_t,vt,V,rt,Q),ht=_t.c,mt=_t.r,it=_t.e),Y=it+V+1,pt=ht[Y],ot=Q/2,mt=mt||Y<0||ht[Y+1]!=null,mt=rt<4?(pt!=null||mt)&&(rt==0||rt==(_t.s<0?3:2)):pt>ot||pt==ot&&(rt==4||mt||rt==6&&ht[Y-1]&1||rt==(_t.s<0?8:7)),Y<1||!ht[0])z=mt?I(H.charAt(1),-V,H.charAt(0)):H.charAt(0);else{if(ht.length=Y,mt)for(--Q;++ht[--Y]>Q;)ht[Y]=0,Y||(++it,ht=[1].concat(ht));for(ot=ht.length;!ht[--ot];);for(pt=0,z="";pt<=ot;z+=H.charAt(ht[pt++]));z=I(z,it,H.charAt(0))}return z}}(),P=function(){function R(Z,Q,K){var G,H,Y,it,ot=0,mt=Z.length,_t=Q%y,ht=Q/y|0;for(Z=Z.slice();mt--;)Y=Z[mt]%y,it=Z[mt]/y|0,G=ht*Y+it*_t,H=_t*Y+G%y*y+ot,ot=(H/K|0)+(G/y|0)+ht*it,Z[mt]=H%K;return ot&&(Z=[ot].concat(Z)),Z}function j(Z,Q,K,G){var H,Y;if(K!=G)Y=K>G?1:-1;else for(H=Y=0;HQ[H]?1:-1;break}return Y}function z(Z,Q,K,G){for(var H=0;K--;)Z[K]-=H,H=Z[K]1;Z.splice(0,1));}return function(Z,Q,K,G,H){var Y,it,ot,mt,_t,ht,vt,pt,V,rt,st,yt,Ct,dt,Mt,Lt,wt,ct=Z.s==Q.s?1:-1,Et=Z.c,ut=Q.c;if(!Et||!Et[0]||!ut||!ut[0])return new X(!Z.s||!Q.s||(Et?ut&&Et[0]==ut[0]:!ut)?NaN:Et&&Et[0]==0||!ut?ct*0:ct/0);for(pt=new X(ct),V=pt.c=[],it=Z.e-Q.e,ct=K+it+1,H||(H=f,it=E(Z.e/l)-E(Q.e/l),ct=ct/l|0),ot=0;ut[ot]==(Et[ot]||0);ot++);if(ut[ot]>(Et[ot]||0)&&it--,ct<0)V.push(1),mt=!0;else{for(dt=Et.length,Lt=ut.length,ot=0,ct+=2,_t=e(H/(ut[0]+1)),_t>1&&(ut=R(ut,_t,H),Et=R(Et,_t,H),Lt=ut.length,dt=Et.length),Ct=Lt,rt=Et.slice(0,Lt),st=rt.length;st=H/2&&Mt++;do{if(_t=0,Y=j(ut,rt,Lt,st),Y<0){if(yt=rt[0],Lt!=st&&(yt=yt*H+(rt[1]||0)),_t=e(yt/Mt),_t>1)for(_t>=H&&(_t=H-1),ht=R(ut,_t,H),vt=ht.length,st=rt.length;j(ht,rt,vt,st)==1;)_t--,z(ht,Lt=10;ct/=10,ot++);$(pt,K+(pt.e=ot+it*l-1)+1,G,mt)}else pt.e=it,pt.r=+mt;return pt}}();function ft(R,j,z,Z){var Q,K,G,H,Y;if(z==null?z=n:C(z,0,8),!R.c)return R.toString();if(Q=R.c[0],G=R.e,j==null)Y=B(R.c),Y=Z==1||Z==2&&(G<=d||G>=v)?F(Y,G):I(Y,G,"0");else if(R=$(new X(R),j,z),K=R.e,Y=B(R.c),H=Y.length,Z==1||Z==2&&(j<=K||K<=d)){for(;HH){if(--j>0)for(Y+=".";j--;Y+="0");}else if(j+=K-H,j>0)for(K+1==H&&(Y+=".");j--;Y+="0");return R.s<0&&Q?"-"+Y:Y}function et(R,j){for(var z,Z,Q=1,K=new X(R[0]);Q=10;Q/=10,Z++);return(z=Z+z*l-1)>T?R.c=R.e=null:z=10;H/=10,Q++);if(K=j-Q,K<0)K+=l,G=j,Y=mt[it=0],ot=e(Y/_t[Q-G-1]%10);else if(it=s((K+1)/l),it>=mt.length)if(Z){for(;mt.length<=it;mt.push(0));Y=ot=0,Q=1,K%=l,G=K-l+1}else break t;else{for(Y=H=mt[it],Q=1;H>=10;H/=10,Q++);K%=l,G=K-l+Q,ot=G<0?0:e(Y/_t[Q-G-1]%10)}if(Z=Z||j<0||mt[it+1]!=null||(G<0?Y:Y%_t[Q-G-1]),Z=z<4?(ot||Z)&&(z==0||z==(R.s<0?3:2)):ot>5||ot==5&&(z==4||Z||z==6&&(K>0?G>0?Y/_t[Q-G]:0:mt[it-1])%10&1||z==(R.s<0?8:7)),j<1||!mt[0])return mt.length=0,Z?(j-=R.e+1,mt[0]=_t[(l-j%l)%l],R.e=-j||0):mt[0]=R.e=0,R;if(K==0?(mt.length=it,H=1,it--):(mt.length=it+1,H=_t[l-K],mt[it]=G>0?e(Y/_t[Q-G]%_t[G])*H:0),Z)for(;;)if(it==0){for(K=1,G=mt[0];G>=10;G/=10,K++);for(G=mt[0]+=H,H=1;G>=10;G/=10,H++);K!=H&&(R.e++,mt[0]==f&&(mt[0]=1));break}else{if(mt[it]+=H,mt[it]!=f)break;mt[it--]=0,H=1}for(K=mt.length;mt[--K]===0;mt.pop());}R.e>T?R.c=R.e=null:R.e=v?F(j,z):I(j,z,"0"),R.s<0?"-"+j:j)}return q.absoluteValue=q.abs=function(){var R=new X(this);return R.s<0&&(R.s=1),R},q.comparedTo=function(R,j){return x(this,new X(R,j))},q.decimalPlaces=q.dp=function(R,j){var z,Z,Q,K=this;if(R!=null)return C(R,0,m),j==null?j=n:C(j,0,8),$(new X(K),R+K.e+1,j);if(!(z=K.c))return null;if(Z=((Q=z.length-1)-E(this.e/l))*l,Q=z[Q])for(;Q%10==0;Q/=10,Z--);return Z<0&&(Z=0),Z},q.dividedBy=q.div=function(R,j){return P(this,new X(R,j),L,n)},q.dividedToIntegerBy=q.idiv=function(R,j){return P(this,new X(R,j),0,1)},q.exponentiatedBy=q.pow=function(R,j){var z,Z,Q,K,G,H,Y,it,ot,mt=this;if(R=new X(R),R.c&&!R.isInteger())throw Error(o+"Exponent not an integer: "+J(R));if(j!=null&&(j=new X(j)),H=R.e>14,!mt.c||!mt.c[0]||mt.c[0]==1&&!mt.e&&mt.c.length==1||!R.c||!R.c[0])return ot=new X(Math.pow(+J(mt),H?R.s*(2-N(R)):+J(R))),j?ot.mod(j):ot;if(Y=R.s<0,j){if(j.c?!j.c[0]:!j.s)return new X(NaN);Z=!Y&&mt.isInteger()&&j.isInteger(),Z&&(mt=mt.mod(j))}else{if(R.e>9&&(mt.e>0||mt.e<-1||(mt.e==0?mt.c[0]>1||H&&mt.c[1]>=24e7:mt.c[0]<8e13||H&&mt.c[0]<=9999975e7)))return K=mt.s<0&&N(R)?-0:0,mt.e>-1&&(K=1/K),new X(Y?1/K:K);b&&(K=s(b/l+2))}for(H?(z=new X(.5),Y&&(R.s=1),it=N(R)):(Q=Math.abs(+J(R)),it=Q%2),ot=new X(O);;){if(it){if(ot=ot.times(mt),!ot.c)break;K?ot.c.length>K&&(ot.c.length=K):Z&&(ot=ot.mod(j))}if(Q){if(Q=e(Q/2),Q===0)break;it=Q%2}else if(R=R.times(z),$(R,R.e+1,1),R.e>14)it=N(R);else{if(Q=+J(R),Q===0)break;it=Q%2}mt=mt.times(mt),K?mt.c&&mt.c.length>K&&(mt.c.length=K):Z&&(mt=mt.mod(j))}return Z?ot:(Y&&(ot=O.div(ot)),j?ot.mod(j):K?$(ot,b,n,G):ot)},q.integerValue=function(R){var j=new X(this);return R==null?R=n:C(R,0,8),$(j,j.e+1,R)},q.isEqualTo=q.eq=function(R,j){return x(this,new X(R,j))===0},q.isFinite=function(){return!!this.c},q.isGreaterThan=q.gt=function(R,j){return x(this,new X(R,j))>0},q.isGreaterThanOrEqualTo=q.gte=function(R,j){return(j=x(this,new X(R,j)))===1||j===0},q.isInteger=function(){return!!this.c&&E(this.e/l)>this.c.length-2},q.isLessThan=q.lt=function(R,j){return x(this,new X(R,j))<0},q.isLessThanOrEqualTo=q.lte=function(R,j){return(j=x(this,new X(R,j)))===-1||j===0},q.isNaN=function(){return!this.s},q.isNegative=function(){return this.s<0},q.isPositive=function(){return this.s>0},q.isZero=function(){return!!this.c&&this.c[0]==0},q.minus=function(R,j){var z,Z,Q,K,G=this,H=G.s;if(R=new X(R,j),j=R.s,!H||!j)return new X(NaN);if(H!=j)return R.s=-j,G.plus(R);var Y=G.e/l,it=R.e/l,ot=G.c,mt=R.c;if(!Y||!it){if(!ot||!mt)return ot?(R.s=-j,R):new X(mt?G:NaN);if(!ot[0]||!mt[0])return mt[0]?(R.s=-j,R):new X(ot[0]?G:n==3?-0:0)}if(Y=E(Y),it=E(it),ot=ot.slice(),H=Y-it){for((K=H<0)?(H=-H,Q=ot):(it=Y,Q=mt),Q.reverse(),j=H;j--;Q.push(0));Q.reverse()}else for(Z=(K=(H=ot.length)<(j=mt.length))?H:j,H=j=0;j0)for(;j--;ot[z++]=0);for(j=f-1;Z>H;){if(ot[--Z]=0;){for(z=0,_t=yt[Q]%V,ht=yt[Q]/V|0,G=Y,K=Q+G;K>Q;)it=st[--G]%V,ot=st[G]/V|0,H=ht*it+ot*_t,it=_t*it+H%V*V+vt[K]+z,z=(it/pt|0)+(H/V|0)+ht*ot,vt[K--]=it%pt;vt[K]=z}return z?++Z:vt.splice(0,1),at(R,vt,Z)},q.negated=function(){var R=new X(this);return R.s=-R.s||null,R},q.plus=function(R,j){var z,Z=this,Q=Z.s;if(R=new X(R,j),j=R.s,!Q||!j)return new X(NaN);if(Q!=j)return R.s=-j,Z.minus(R);var K=Z.e/l,G=R.e/l,H=Z.c,Y=R.c;if(!K||!G){if(!H||!Y)return new X(Q/0);if(!H[0]||!Y[0])return Y[0]?R:new X(H[0]?Z:Q*0)}if(K=E(K),G=E(G),H=H.slice(),Q=K-G){for(Q>0?(G=K,z=Y):(Q=-Q,z=H),z.reverse();Q--;z.push(0));z.reverse()}for(Q=H.length,j=Y.length,Q-j<0&&(z=Y,Y=H,H=z,j=Q),Q=0;j;)Q=(H[--j]=H[j]+Y[j]+Q)/f|0,H[j]=f===H[j]?0:H[j]%f;return Q&&(H=[Q].concat(H),++G),at(R,H,G)},q.precision=q.sd=function(R,j){var z,Z,Q,K=this;if(R!=null&&R!==!!R)return C(R,1,m),j==null?j=n:C(j,0,8),$(new X(K),R,j);if(!(z=K.c))return null;if(Q=z.length-1,Z=Q*l+1,Q=z[Q]){for(;Q%10==0;Q/=10,Z--);for(Q=z[0];Q>=10;Q/=10,Z++);}return R&&K.e+1>Z&&(Z=K.e+1),Z},q.shiftedBy=function(R){return C(R,-p,p),this.times("1e"+R)},q.squareRoot=q.sqrt=function(){var R,j,z,Z,Q,K=this,G=K.c,H=K.s,Y=K.e,it=L+4,ot=new X("0.5");if(H!==1||!G||!G[0])return new X(!H||H<0&&(!G||G[0])?NaN:G?K:1/0);if(H=Math.sqrt(+J(K)),H==0||H==1/0?(j=B(G),(j.length+Y)%2==0&&(j+="0"),H=Math.sqrt(+j),Y=E((Y+1)/2)-(Y<0||Y%2),H==1/0?j="5e"+Y:(j=H.toExponential(),j=j.slice(0,j.indexOf("e")+1)+Y),z=new X(j)):z=new X(H+""),z.c[0]){for(Y=z.e,H=Y+it,H<3&&(H=0);;)if(Q=z,z=ot.times(Q.plus(P(K,Q,it,1))),B(Q.c).slice(0,H)===(j=B(z.c)).slice(0,H))if(z.e0&&vt>0){for(K=vt%H||H,ot=ht.substr(0,K);K0&&(ot+=it+ht.slice(K)),_t&&(ot="-"+ot)}Z=mt?ot+(z.decimalSeparator||"")+((Y=+z.fractionGroupSize)?mt.replace(new RegExp("\\d{"+Y+"}\\B","g"),"$&"+(z.fractionGroupSeparator||"")):mt):ot}return(z.prefix||"")+Z+(z.suffix||"")},q.toFraction=function(R){var j,z,Z,Q,K,G,H,Y,it,ot,mt,_t,ht=this,vt=ht.c;if(R!=null&&(H=new X(R),!H.isInteger()&&(H.c||H.s!==1)||H.lt(O)))throw Error(o+"Argument "+(H.isInteger()?"out of range: ":"not an integer: ")+J(H));if(!vt)return new X(ht);for(j=new X(O),it=z=new X(O),Z=Y=new X(O),_t=B(vt),K=j.e=_t.length-ht.e-1,j.c[0]=g[(G=K%l)<0?l+G:G],R=!R||H.comparedTo(j)>0?K>0?j:it:H,G=T,T=1/0,H=new X(_t),Y.c[0]=0;ot=P(H,j,0,1),Q=z.plus(ot.times(Z)),Q.comparedTo(R)!=1;)z=Z,Z=Q,it=Y.plus(ot.times(Q=it)),Y=Q,j=H.minus(ot.times(Q=j)),H=Q;return Q=P(R.minus(z),Z,0,1),Y=Y.plus(Q.times(it)),z=z.plus(Q.times(Z)),Y.s=it.s=ht.s,K=K*2,mt=P(it,Z,K,n).minus(ht).abs().comparedTo(P(Y,z,K,n).minus(ht).abs())<1?[it,Z]:[Y,z],T=G,mt},q.toNumber=function(){return+J(this)},q.toPrecision=function(R,j){return R!=null&&C(R,1,m),ft(this,R,j,2)},q.toString=function(R){var j,z=this,Z=z.s,Q=z.e;return Q===null?Z?(j="Infinity",Z<0&&(j="-"+j)):j="NaN":(R==null?j=Q<=d||Q>=v?F(B(z.c),Q):I(B(z.c),Q,"0"):R===10&&tt?(z=$(new X(z),L+Q+1,n),j=I(B(z.c),z.e,"0")):(C(R,2,k.length,"Base"),j=D(I(B(z.c),Q,"0"),10,R,Z,!0)),Z<0&&z.c[0]&&(j="-"+j)),j},q.valueOf=q.toJSON=function(){return J(this)},q._isBigNumber=!0,U!=null&&X.set(U),X}function E(U){var P=U|0;return U>0||U===P?P:P-1}function B(U){for(var P,D,W=1,q=U.length,O=U[0]+"";Wv^D?1:-1;for(n=(d=q.length)<(v=O.length)?d:v,L=0;LO[L]^D?1:-1;return d==v?0:d>v^D?1:-1}function C(U,P,D,W){if(UD||U!==e(U))throw Error(o+(W||"Argument")+(typeof U=="number"?UD?" out of range: ":" not an integer: ":" not a primitive number: ")+String(U))}function N(U){var P=U.c.length-1;return E(U.e/l)==P&&U.c[P]%2!=0}function F(U,P){return(U.length>1?U.charAt(0)+"."+U.slice(1):U)+(P<0?"e":"e+")+P}function I(U,P,D){var W,q;if(P<0){for(q=D+".";++P;q+=D);U=q+U}else if(W=U.length,++P>W){for(q=D,P-=W;--P;q+=D);U+=q}else P{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=Py(),r=class{constructor(){Pt(this,"BigNum");this.BigNum=(u,a)=>{let s=i.BigNumber.clone({DECIMAL_PLACES:a});return new s(u)}}winstonToAr(u,{formatted:a=!1,decimals:s=12,trim:e=!0}={}){let o=this.stringToBigNum(u,s).shiftedBy(-12);return a?o.toFormat(s):o.toFixed(s)}arToWinston(u,{formatted:a=!1}={}){let s=this.stringToBigNum(u).shiftedBy(12);return a?s.toFormat():s.toFixed(0)}compare(u,a){let s=this.stringToBigNum(u),e=this.stringToBigNum(a);return s.comparedTo(e)}isEqual(u,a){return this.compare(u,a)===0}isLessThan(u,a){let s=this.stringToBigNum(u),e=this.stringToBigNum(a);return s.isLessThan(e)}isGreaterThan(u,a){let s=this.stringToBigNum(u),e=this.stringToBigNum(a);return s.isGreaterThan(e)}add(u,a){let s=this.stringToBigNum(u);return this.stringToBigNum(a),s.plus(a).toFixed(0)}sub(u,a){let s=this.stringToBigNum(u);return this.stringToBigNum(a),s.minus(a).toFixed(0)}stringToBigNum(u,a=12){return this.BigNum(u,a)}};t.default=r}),Ny=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=class{constructor(a){Pt(this,"METHOD_GET","GET");Pt(this,"METHOD_POST","POST");Pt(this,"config");this.applyConfig(a)}applyConfig(a){this.config=this.mergeDefaults(a)}getConfig(){return this.config}mergeDefaults(a){let s=a.protocol||"http",e=a.port||(s==="https"?443:80);return{host:a.host||"127.0.0.1",protocol:s,port:e,timeout:a.timeout||2e4,logging:a.logging||!1,logger:a.logger||console.log,network:a.network}}async get(a,s){return await this.request(a,{...s,method:this.METHOD_GET})}async post(a,s,e){var c;let o=new Headers((e==null?void 0:e.headers)||{});return(c=o.get("content-type"))!=null&&c.includes("application/json")||o.append("content-type","application/json"),o.append("accept","application/json, text/plain, */*"),await this.request(a,{...e,method:this.METHOD_POST,body:typeof s!="string"?JSON.stringify(s):s,headers:o})}async request(a,s){var y,m;let e=new Headers((s==null?void 0:s.headers)||{}),o=`${this.config.protocol}://${this.config.host}:${this.config.port}`,c=s==null?void 0:s.responseType;s==null||delete s.responseType,a.startsWith("/")&&(a=a.slice(1)),this.config.network&&e.append("x-network",this.config.network),this.config.logging&&this.config.logger(`Requesting: ${o}/${a}`);let f=await fetch(`${o}/${a}`,{...s||{},headers:e});this.config.logging&&this.config.logger(`Response: ${f.url} - ${f.status}`);let l=(m=(y=f.headers.get("content-type"))==null?void 0:y.match(/charset=([^()<>@,;:\"/[\]?.=\s]*)/i))==null?void 0:m[1],p=f,g=async()=>{if(l)try{p.data=new TextDecoder(l).decode(await f.arrayBuffer())}catch{p.data=await f.text()}else p.data=await f.text()};if(c==="arraybuffer")p.data=await f.arrayBuffer();else if(c==="text")await g();else if(c==="webstream")p.data=r(f.body);else try{let M=await f.clone().json();typeof M!="object"?await g():p.data=await f.json(),M=null}catch{await g()}return p}};t.default=i;var r=a=>{let s=a;return typeof s[Symbol.asyncIterator]>"u"?(s[Symbol.asyncIterator]=u(a),s):a},u=function(a){return async function*(){let s=a.getReader();try{for(;;){let{done:e,value:o}=await s.read();if(e)return;yield o}}finally{s.releaseLock()}}}}),Pn=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var i=Co();function r(g){let y=0;for(let E=0;E{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=Pn(),r=class{constructor(){Pt(this,"keyLength",4096);Pt(this,"publicExponent",65537);Pt(this,"hashAlgorithm","sha256");Pt(this,"driver");if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let u=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),a=await this.driver.exportKey("jwk",u.privateKey);return{kty:a.kty,e:a.e,n:a.n,d:a.d,p:a.p,q:a.q,dp:a.dp,dq:a.dq,qi:a.qi}}async sign(u,a,{saltLength:s}={}){let e=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(u),a);return new Uint8Array(e)}async hash(u,a="SHA-256"){let s=await this.driver.digest(a,u);return new Uint8Array(s)}async verify(u,a,s){let e={kty:"RSA",e:"AQAB",n:u},o=await this.jwkToPublicCryptoKey(e),c=await this.driver.digest("SHA-256",a),f=await this.driver.verify({name:"RSA-PSS",saltLength:0},o,s,a),l=await this.driver.verify({name:"RSA-PSS",saltLength:32},o,s,a),p=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((o.algorithm.modulusLength-1)/8)-c.byteLength-2},o,s,a);return f||l||p}async jwkToCryptoKey(u){return this.driver.importKey("jwk",u,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(u){return this.driver.importKey("jwk",u,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let u=crypto==null?void 0:crypto.subtle;return u===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(a=>typeof u[a]=="function")}async encrypt(u,a,s){let e=await this.driver.importKey("raw",typeof a=="string"?i.stringToBuffer(a):a,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:s?i.stringToBuffer(s):i.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},e,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),c=new Uint8Array(16);crypto.getRandomValues(c);let f=await this.driver.encrypt({name:"AES-CBC",iv:c},o,u);return i.concatBuffers([c,f])}async decrypt(u,a,s){let e=await this.driver.importKey("raw",typeof a=="string"?i.stringToBuffer(a):a,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:s?i.stringToBuffer(s):i.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},e,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),c=u.slice(0,16),f=await this.driver.decrypt({name:"AES-CBC",iv:c},o,u.slice(16));return i.concatBuffers([f])}};t.default=r}),Dy=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=class{constructor(r){Pt(this,"api");this.api=r}getInfo(){return this.api.get("info").then(r=>r.data)}getPeers(){return this.api.get("peers").then(r=>r.data)}};t.default=i}),is=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.getError=void 0;var i=class extends Error{constructor(s,e={}){var a=(...u)=>{super(...u);Pt(this,"type");Pt(this,"response")};e.message?a(e.message):a(),this.type=s,this.response=e.response}getType(){return this.type}};t.default=i;function r(a){let s=a.data;if(typeof a.data=="string")try{s=JSON.parse(a.data)}catch{}if(a.data instanceof ArrayBuffer||a.data instanceof Uint8Array)try{s=JSON.parse(s.toString())}catch{}return s?s.error||s:a.statusText||"unknown"}t.getError=r}),jy=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=po();async function r(a){if(Array.isArray(a)){let o=i.default.utils.concatBuffers([i.default.utils.stringToBuffer("list"),i.default.utils.stringToBuffer(a.length.toString())]);return await u(a,await i.default.crypto.hash(o,"SHA-384"))}let s=i.default.utils.concatBuffers([i.default.utils.stringToBuffer("blob"),i.default.utils.stringToBuffer(a.byteLength.toString())]),e=i.default.utils.concatBuffers([await i.default.crypto.hash(s,"SHA-384"),await i.default.crypto.hash(a,"SHA-384")]);return await i.default.crypto.hash(e,"SHA-384")}t.default=r;async function u(a,s){if(a.length<1)return s;let e=i.default.utils.concatBuffers([s,await r(a[0])]),o=await i.default.crypto.hash(e,"SHA-384");return await u(a.slice(1),o)}}),ed=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.debug=t.validatePath=t.arrayCompare=t.bufferToInt=t.intToBuffer=t.arrayFlatten=t.generateProofs=t.buildLayers=t.generateTransactionChunks=t.generateTree=t.computeRootHash=t.generateLeaves=t.chunkData=t.MIN_CHUNK_SIZE=t.MAX_CHUNK_SIZE=void 0;var i=po(),r=Pn();t.MAX_CHUNK_SIZE=256*1024,t.MIN_CHUNK_SIZE=32*1024;var u=32,a=32;async function s(F){let I=[],U=F,P=0;for(;U.byteLength>=t.MAX_CHUNK_SIZE;){let D=t.MAX_CHUNK_SIZE,W=U.byteLength-t.MAX_CHUNK_SIZE;W>0&&W({type:"leaf",id:await M(await Promise.all([M(I),M(E(P))])),dataHash:I,minByteRange:U,maxByteRange:P})))}t.generateLeaves=e;async function o(F){return(await c(F)).id}t.computeRootHash=o;async function c(F){return await l(await e(await s(F)))}t.generateTree=c;async function f(F){let I=await s(F),U=await e(I),P=await l(U),D=await p(P),W=I.slice(-1)[0];return W.maxByteRange-W.minByteRange===0&&(I.splice(I.length-1,1),D.splice(D.length-1,1)),{data_root:P.id,chunks:I,proofs:D}}t.generateTransactionChunks=f;async function l(F,I=0){if(F.length<2)return F[0];let U=[];for(let P=0;P{Array.isArray(U)?I.push(...y(U)):I.push(U)}),I}t.arrayFlatten=y;async function m(F,I){return I?{type:"branch",id:await M([await M(F.id),await M(I.id),await M(E(F.maxByteRange))]),byteRange:F.maxByteRange,maxByteRange:I.maxByteRange,leftChild:F,rightChild:I}:F}async function M(F){return Array.isArray(F)&&(F=i.default.utils.concatBuffers(F)),new Uint8Array(await i.default.crypto.hash(F))}function E(F){let I=new Uint8Array(u);for(var U=I.length-1;U>=0;U--){var P=F%256;I[U]=P,F=(F-P)/256}return I}t.intToBuffer=E;function B(F){let I=0;for(var U=0;UF.every((U,P)=>I[P]===U);t.arrayCompare=x;async function C(F,I,U,P,D){if(P<=0)return!1;if(I>=P)return C(F,0,P-1,P,D);if(I<0)return C(F,0,0,P,D);if(D.length==a+u){let v=D.slice(0,a),A=D.slice(v.length,v.length+u),T=await M([await M(v),await M(A)]);return(0,t.arrayCompare)(F,T)?{offset:P-1,leftBound:U,rightBound:P,chunkSize:P-U}:!1}let W=D.slice(0,a),q=D.slice(W.length,W.length+a),O=D.slice(W.length+q.length,W.length+q.length+u),L=B(O),n=D.slice(W.length+q.length+O.length),d=await M([await M(W),await M(q),await M(O)]);return(0,t.arrayCompare)(F,d)?I ${JSON.stringify(O)}`;return N(q,L)}t.debug=N}),ah=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.Tag=void 0;var i=Pn(),r=jy(),u=ed(),a=class{get(o,c){if(!Object.getOwnPropertyNames(this).includes(o))throw new Error(`Field "${o}" is not a property of the Arweave Transaction class.`);if(this[o]instanceof Uint8Array)return c&&c.decode&&c.string?i.bufferToString(this[o]):c&&c.decode&&!c.string?this[o]:i.bufferTob64Url(this[o]);if(this[o]instanceof Array){if((c==null?void 0:c.decode)!==void 0||(c==null?void 0:c.string)!==void 0)throw o==="tags"&&console.warn(`Did you mean to use 'transaction["tags"]' ?`),new Error("Cannot decode or stringify an array.");return this[o]}return c&&c.decode==!0?c&&c.string?i.b64UrlToString(this[o]):i.b64UrlToBuffer(this[o]):this[o]}},s=class extends a{constructor(c,f,l=!1){super();Pt(this,"name");Pt(this,"value");this.name=c,this.value=f}};t.Tag=s;var e=class extends a{constructor(c={}){super();Pt(this,"format",2);Pt(this,"id","");Pt(this,"last_tx","");Pt(this,"owner","");Pt(this,"tags",[]);Pt(this,"target","");Pt(this,"quantity","0");Pt(this,"data_size","0");Pt(this,"data",new Uint8Array);Pt(this,"data_root","");Pt(this,"reward","0");Pt(this,"signature","");Pt(this,"chunks");Object.assign(this,c),typeof this.data=="string"&&(this.data=i.b64UrlToBuffer(this.data)),c.tags&&(this.tags=c.tags.map(f=>new s(f.name,f.value)))}addTag(c,f){this.tags.push(new s(i.stringToB64Url(c),i.stringToB64Url(f)))}toJSON(){return{format:this.format,id:this.id,last_tx:this.last_tx,owner:this.owner,tags:this.tags,target:this.target,quantity:this.quantity,data:i.bufferTob64Url(this.data),data_size:this.data_size,data_root:this.data_root,data_tree:this.data_tree,reward:this.reward,signature:this.signature}}setOwner(c){this.owner=c}setSignature({id:c,owner:f,reward:l,tags:p,signature:g}){this.id=c,this.owner=f,l&&(this.reward=l),p&&(this.tags=p),this.signature=g}async prepareChunks(c){!this.chunks&&c.byteLength>0&&(this.chunks=await(0,u.generateTransactionChunks)(c),this.data_root=i.bufferTob64Url(this.chunks.data_root)),!this.chunks&&c.byteLength===0&&(this.chunks={chunks:[],data_root:new Uint8Array,proofs:[]},this.data_root="")}getChunk(c,f){if(!this.chunks)throw new Error("Chunks have not been prepared");let l=this.chunks.proofs[c],p=this.chunks.chunks[c];return{data_root:this.data_root,data_size:this.data_size,data_path:i.bufferTob64Url(l.proof),offset:l.offset.toString(),chunk:i.bufferTob64Url(f.slice(p.minByteRange,p.maxByteRange))}}async getSignatureData(){switch(this.format){case 1:let c=this.tags.reduce((l,p)=>i.concatBuffers([l,p.get("name",{decode:!0,string:!1}),p.get("value",{decode:!0,string:!1})]),new Uint8Array);return i.concatBuffers([this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),this.get("data",{decode:!0,string:!1}),i.stringToBuffer(this.quantity),i.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),c]);case 2:this.data_root||await this.prepareChunks(this.data);let f=this.tags.map(l=>[l.get("name",{decode:!0,string:!1}),l.get("value",{decode:!0,string:!1})]);return await(0,r.default)([i.stringToBuffer(this.format.toString()),this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),i.stringToBuffer(this.quantity),i.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),f,i.stringToBuffer(this.data_size),this.get("data_root",{decode:!0,string:!1})]);default:throw new Error(`Unexpected transaction format: ${this.format}`)}}};t.default=e}),Uy=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionUploader=void 0;var i=ah(),r=Pn(),u=is(),a=ed(),s=1,e=["invalid_json","chunk_too_big","data_path_too_big","offset_too_big","data_size_too_big","chunk_proof_ratio_not_attractive","invalid_proof"],o=1e3*40,c=class{constructor(f,l){Pt(this,"api");Pt(this,"chunkIndex",0);Pt(this,"txPosted",!1);Pt(this,"transaction");Pt(this,"lastRequestTimeEnd",0);Pt(this,"totalErrors",0);Pt(this,"data");Pt(this,"lastResponseStatus",0);Pt(this,"lastResponseError","");if(this.api=f,!l.id)throw new Error("Transaction is not signed");if(!l.chunks)throw new Error("Transaction chunks not prepared");this.data=l.data,this.transaction=new i.default(Object.assign({},l,{data:new Uint8Array(0)}))}get isComplete(){return this.txPosted&&this.chunkIndex===this.transaction.chunks.chunks.length}get totalChunks(){return this.transaction.chunks.chunks.length}get uploadedChunks(){return this.chunkIndex}get pctComplete(){return Math.trunc(this.uploadedChunks/this.totalChunks*100)}async uploadChunk(f){if(this.isComplete)throw new Error("Upload is already complete");if(this.lastResponseError!==""?this.totalErrors++:this.totalErrors=0,this.totalErrors===100)throw new Error(`Unable to complete upload: ${this.lastResponseStatus}: ${this.lastResponseError}`);let l=this.lastResponseError===""?0:Math.max(this.lastRequestTimeEnd+o-Date.now(),o);if(l>0&&(l=l-l*Math.random()*.3,await new Promise(y=>setTimeout(y,l))),this.lastResponseError="",!this.txPosted){await this.postTransaction();return}f&&(this.chunkIndex=f);let p=this.transaction.getChunk(f||this.chunkIndex,this.data);if(!await(0,a.validatePath)(this.transaction.chunks.data_root,parseInt(p.offset),0,parseInt(p.data_size),r.b64UrlToBuffer(p.data_path)))throw new Error(`Unable to validate chunk ${this.chunkIndex}`);let g=await this.api.post("chunk",this.transaction.getChunk(this.chunkIndex,this.data)).catch(y=>(console.error(y.message),{status:-1,data:{error:y.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=g.status,this.lastResponseStatus==200)this.chunkIndex++;else if(this.lastResponseError=(0,u.getError)(g),e.includes(this.lastResponseError))throw new Error(`Fatal error uploading chunk ${this.chunkIndex}: ${this.lastResponseError}`)}static async fromSerialized(f,l,p){if(!l||typeof l.chunkIndex!="number"||typeof l.transaction!="object")throw new Error("Serialized object does not match expected format.");var g=new i.default(l.transaction);g.chunks||await g.prepareChunks(p);let y=new c(f,g);if(y.chunkIndex=l.chunkIndex,y.lastRequestTimeEnd=l.lastRequestTimeEnd,y.lastResponseError=l.lastResponseError,y.lastResponseStatus=l.lastResponseStatus,y.txPosted=l.txPosted,y.data=p,y.transaction.data_root!==l.transaction.data_root)throw new Error("Data mismatch: Uploader doesn't match provided data.");return y}static async fromTransactionId(f,l){let p=await f.get(`tx/${l}`);if(p.status!==200)throw new Error(`Tx ${l} not found: ${p.status}`);let g=p.data;return g.data=new Uint8Array(0),{txPosted:!0,chunkIndex:0,lastResponseError:"",lastRequestTimeEnd:0,lastResponseStatus:0,transaction:g}}toJSON(){return{chunkIndex:this.chunkIndex,transaction:this.transaction,lastRequestTimeEnd:this.lastRequestTimeEnd,lastResponseStatus:this.lastResponseStatus,lastResponseError:this.lastResponseError,txPosted:this.txPosted}}async postTransaction(){if(this.totalChunks<=s){this.transaction.data=this.data;let l=await this.api.post("tx",this.transaction).catch(p=>(console.error(p),{status:-1,data:{error:p.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=l.status,this.transaction.data=new Uint8Array(0),l.status>=200&&l.status<300){this.txPosted=!0,this.chunkIndex=s;return}throw this.lastResponseError=(0,u.getError)(l),new Error(`Unable to upload transaction: ${l.status}, ${this.lastResponseError}`)}let f=await this.api.post("tx",this.transaction);if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=f.status,!(f.status>=200&&f.status<300))throw this.lastResponseError=(0,u.getError)(f),new Error(`Unable to upload transaction: ${f.status}, ${this.lastResponseError}`);this.txPosted=!0}};t.TransactionUploader=c}),Fy=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=is(),r=ah(),u=Pn(),a=Uy();Di();var s=class{constructor(e,o,c){Pt(this,"api");Pt(this,"crypto");Pt(this,"chunks");this.api=e,this.crypto=o,this.chunks=c}async getTransactionAnchor(){let e=await this.api.get("tx_anchor");if(!e.data.match(/^[a-z0-9_-]{43,}/i)||!e.ok)throw new Error(`Could not getTransactionAnchor. Received: ${e.data}. Status: ${e.status}, ${e.statusText}`);return e.data}async getPrice(e,o){let c=o?`price/${e}/${o}`:`price/${e}`,f=await this.api.get(c);if(!/^\d+$/.test(f.data)||!f.ok)throw new Error(`Could not getPrice. Received: ${f.data}. Status: ${f.status}, ${f.statusText}`);return f.data}async get(e){let o=await this.api.get(`tx/${e}`);if(o.status==200){let c=parseInt(o.data.data_size);if(o.data.format>=2&&c>0&&c<=1024*1024*12){let f=await this.getData(e);return new r.default({...o.data,data:f})}return new r.default({...o.data,format:o.data.format||1})}throw o.status==404?new i.default("TX_NOT_FOUND"):o.status==410?new i.default("TX_FAILED"):new i.default("TX_INVALID")}fromRaw(e){return new r.default(e)}async search(e,o){return this.api.post("arql",{op:"equals",expr1:e,expr2:o}).then(c=>c.data?c.data:[])}getStatus(e){return this.api.get(`tx/${e}/status`).then(o=>o.status==200?{status:200,confirmed:o.data}:{status:o.status,confirmed:null})}async getData(e,o){let c;try{c=await this.chunks.downloadChunkedData(e)}catch(f){console.error(`Error while trying to download chunked data for ${e}`),console.error(f)}if(!c){console.warn(`Falling back to gateway cache for ${e}`);try{let{data:f,ok:l,status:p,statusText:g}=await this.api.get(`/${e}`,{responseType:"arraybuffer"});if(!l)throw new Error("Bad http status code",{cause:{status:p,statusText:g}});c=f}catch(f){console.error(`Error while trying to download contiguous data from gateway cache for ${e}`),console.error(f)}}if(!c)throw new Error(`${e} data was not found!`);return o&&o.decode&&!o.string?c:o&&o.decode&&o.string?u.bufferToString(c):u.bufferTob64Url(c)}async sign(e,o,c){let f=typeof o=="object"&&(p=>{let g=!0;return["n","e","d","p","q","dp","dq","qi"].map(y=>!(y in p)&&(g=!1)),g})(o),l=typeof arweaveWallet=="object";if(!f&&!l)throw new Error("No valid JWK or external wallet found to sign transaction.");if(f){e.setOwner(o.n);let p=await e.getSignatureData(),g=await this.crypto.sign(o,p,c),y=await this.crypto.hash(g);e.setSignature({id:u.bufferTob64Url(y),owner:o.n,signature:u.bufferTob64Url(g)})}else if(l){try{(await arweaveWallet.getPermissions()).includes("SIGN_TRANSACTION")||await arweaveWallet.connect(["SIGN_TRANSACTION"])}catch{}let p=await arweaveWallet.sign(e,c);e.setSignature({id:p.id,owner:p.owner,reward:p.reward,tags:p.tags,signature:p.signature})}else throw new Error("An error occurred while signing. Check wallet is valid")}async verify(e){let o=await e.getSignatureData(),c=e.get("signature",{decode:!0,string:!1}),f=u.bufferTob64Url(await this.crypto.hash(c));if(e.id!==f)throw new Error("Invalid transaction signature or ID! The transaction ID doesn't match the expected SHA-256 hash of the signature.");return this.crypto.verify(e.owner,o,c)}async post(e){if(typeof e=="string"?e=new r.default(JSON.parse(e)):typeof e.readInt32BE=="function"?e=new r.default(JSON.parse(e.toString())):typeof e=="object"&&!(e instanceof r.default)&&(e=new r.default(e)),!(e instanceof r.default))throw new Error("Must be Transaction object");e.chunks||await e.prepareChunks(e.data);let o=await this.getUploader(e,e.data);try{for(;!o.isComplete;)await o.uploadChunk()}catch(c){if(o.lastResponseStatus>0)return{status:o.lastResponseStatus,statusText:o.lastResponseError,data:{error:o.lastResponseError}};throw c}return{status:200,statusText:"OK",data:{}}}async getUploader(e,o){let c;if(o instanceof ArrayBuffer&&(o=new Uint8Array(o)),e instanceof r.default){if(o||(o=e.data),!(o instanceof Uint8Array))throw new Error("Data format is invalid");e.chunks||await e.prepareChunks(o),c=new a.TransactionUploader(this.api,e),(!c.data||c.data.length===0)&&(c.data=o)}else{if(typeof e=="string"&&(e=await a.TransactionUploader.fromTransactionId(this.api,e)),!o||!(o instanceof Uint8Array))throw new Error("Must provide data when resuming upload");c=await a.TransactionUploader.fromSerialized(this.api,e,o)}return c}async*upload(e,o){let c=await this.getUploader(e,o);for(;!c.isComplete;)await c.uploadChunk(),yield c;return c}};t.default=s}),Ky=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=Pn();Di();var r=class{constructor(u,a){Pt(this,"api");Pt(this,"crypto");this.api=u,this.crypto=a}getBalance(u){return this.api.get(`wallet/${u}/balance`).then(a=>a.data)}getLastTransactionID(u){return this.api.get(`wallet/${u}/last_tx`).then(a=>a.data)}generate(){return this.crypto.generateJWK()}async jwkToAddress(u){return!u||u==="use_wallet"?this.getAddress():this.getAddress(u)}async getAddress(u){if(!u||u==="use_wallet"){try{await arweaveWallet.connect(["ACCESS_ADDRESS"])}catch{}return arweaveWallet.getActiveAddress()}else return this.ownerToAddress(u.n)}async ownerToAddress(u){return i.bufferTob64Url(await this.crypto.hash(i.b64UrlToBuffer(u)))}};t.default=r}),zy=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.SiloResource=void 0;var i=Pn(),r=class{constructor(a,s,e){Pt(this,"api");Pt(this,"crypto");Pt(this,"transactions");this.api=a,this.crypto=s,this.transactions=e}async get(a){if(!a)throw new Error("No Silo URI specified");let s=await this.parseUri(a),e=await this.transactions.search("Silo-Name",s.getAccessKey());if(e.length==0)throw new Error(`No data could be found for the Silo URI: ${a}`);let o=await this.transactions.get(e[0]);if(!o)throw new Error(`No data could be found for the Silo URI: ${a}`);let c=o.get("data",{decode:!0,string:!1});return this.crypto.decrypt(c,s.getEncryptionKey())}async readTransactionData(a,s){if(!s)throw new Error("No Silo URI specified");let e=await this.parseUri(s),o=a.get("data",{decode:!0,string:!1});return this.crypto.decrypt(o,e.getEncryptionKey())}async parseUri(a){let s=a.match(/^([a-z0-9-_]+)\.([0-9]+)/i);if(!s)throw new Error("Invalid Silo name, must be a name in the format of [a-z0-9]+.[0-9]+, e.g. 'bubble.7'");let e=s[1],o=Math.pow(2,parseInt(s[2])),c=await this.hash(i.stringToBuffer(e),o),f=i.bufferTob64(c.slice(0,15)),l=await this.hash(c.slice(16,31),1);return new u(a,f,l)}async hash(a,s){let e=await this.crypto.hash(a);for(let o=0;o{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=is(),r=Pn(),u=class{constructor(a){Pt(this,"api");this.api=a}async getTransactionOffset(a){let s=await this.api.get(`tx/${a}/offset`);if(s.status===200)return s.data;throw new Error(`Unable to get transaction offset: ${(0,i.getError)(s)}`)}async getChunk(a){let s=await this.api.get(`chunk/${a}`);if(s.status===200)return s.data;throw new Error(`Unable to get chunk: ${(0,i.getError)(s)}`)}async getChunkData(a){let s=await this.getChunk(a);return r.b64UrlToBuffer(s.chunk)}firstChunkOffset(a){return parseInt(a.offset)-parseInt(a.size)+1}async downloadChunkedData(a){let s=await this.getTransactionOffset(a),e=parseInt(s.size),o=parseInt(s.offset)-e+1,c=new Uint8Array(e),f=0;for(;f{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=is();Di();var r=class{constructor(a,s){Pt(this,"api");Pt(this,"network");this.api=a,this.network=s}async get(a){let s=await this.api.get(`${r.HASH_ENDPOINT}${a}`);if(s.status===200)return s.data;throw s.status===404?new i.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${s}`)}async getByHeight(a){let s=await this.api.get(`${r.HEIGHT_ENDPOINT}${a}`);if(s.status===200)return s.data;throw s.status===404?new i.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${s}`)}async getCurrent(){let{current:a}=await this.network.getInfo();return await this.get(a)}},u=r;Wr(u,"HASH_ENDPOINT","block/hash/"),Wr(u,"HEIGHT_ENDPOINT","block/height/"),t.default=u}),po=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=Ry(),r=Ny(),u=Ly(),a=Dy(),s=Fy(),e=Ky(),o=ah(),c=Pn(),f=zy(),l=Wy(),p=qy(),g=class{constructor(m){Pt(this,"api");Pt(this,"wallets");Pt(this,"transactions");Pt(this,"network");Pt(this,"blocks");Pt(this,"ar");Pt(this,"silo");Pt(this,"chunks");this.api=new r.default(m),this.wallets=new e.default(this.api,g.crypto),this.chunks=new l.default(this.api),this.transactions=new s.default(this.api,g.crypto,this.chunks),this.silo=new f.default(this.api,this.crypto,this.transactions),this.network=new a.default(this.api),this.blocks=new p.default(this.api,this.network),this.ar=new i.default}get crypto(){return g.crypto}get utils(){return g.utils}getConfig(){return{api:this.api.getConfig(),crypto:null}}async createTransaction(m,M){let E={};if(Object.assign(E,m),!m.data&&!(m.target&&m.quantity))throw new Error("A new Arweave transaction must have a 'data' value, or 'target' and 'quantity' values.");if(m.owner==null&&M&&M!=="use_wallet"&&(E.owner=M.n),m.last_tx==null&&(E.last_tx=await this.transactions.getTransactionAnchor()),typeof m.data=="string"&&(m.data=c.stringToBuffer(m.data)),m.data instanceof ArrayBuffer&&(m.data=new Uint8Array(m.data)),m.data&&!(m.data instanceof Uint8Array))throw new Error("Expected data to be a string, Uint8Array or ArrayBuffer");if(m.reward==null){let x=m.data?m.data.byteLength:0;E.reward=await this.transactions.getPrice(x,E.target)}E.data_root="",E.data_size=m.data?m.data.byteLength.toString():"0",E.data=m.data||new Uint8Array(0);let B=new o.default(E);return await B.getSignatureData(),B}async createSiloTransaction(m,M,E){let B={};if(Object.assign(B,m),!m.data)throw new Error("Silo transactions must have a 'data' value");if(!E)throw new Error("No Silo URI specified.");if(m.target||m.quantity)throw new Error("Silo transactions can only be used for storing data, sending AR to other wallets isn't supported.");if(m.owner==null){if(!M||!M.n)throw new Error("A new Arweave transaction must either have an 'owner' attribute, or you must provide the jwk parameter.");B.owner=M.n}m.last_tx==null&&(B.last_tx=await this.transactions.getTransactionAnchor());let x=await this.silo.parseUri(E);if(typeof m.data=="string"){let N=await this.crypto.encrypt(c.stringToBuffer(m.data),x.getEncryptionKey());B.reward=await this.transactions.getPrice(N.byteLength),B.data=c.bufferTob64Url(N)}if(m.data instanceof Uint8Array){let N=await this.crypto.encrypt(m.data,x.getEncryptionKey());B.reward=await this.transactions.getPrice(N.byteLength),B.data=c.bufferTob64Url(N)}let C=new o.default(B);return C.addTag("Silo-Name",x.getAccessKey()),C.addTag("Silo-Version","0.1.0"),C}arql(m){return this.api.post("/arql",m).then(M=>M.data||[])}},y=g;Wr(y,"init"),Wr(y,"crypto",new u.default),Wr(y,"utils",c),t.default=y}),$y=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.getDefaultConfig=void 0;var i=(a,s)=>{let e=/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/,o=s.split("."),c=o[o.length-1],f=["localhost","[::1]"];return f.includes(s)||a=="file"||f.includes(c)||!!s.match(e)||!!c.match(e)},r=a=>{let s=a.charAt(0)==="[",e=/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/;return!!a.match(e)||s},u=(a,s)=>{if(i(a,s))return{protocol:"https",host:"arweave.net",port:443};if(!r(s)){let e=s.split(".");if(e.length>=3){e.shift();let o=e.join(".");return{protocol:a,host:o}}}return{protocol:a,host:s}};t.getDefaultConfig=u}),Hy=gt(t=>{lt();var i=t&&t.__createBinding||(Object.create?function(s,e,o,c){c===void 0&&(c=o);var f=Object.getOwnPropertyDescriptor(e,o);(!f||("get"in f?!e.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return e[o]}}),Object.defineProperty(s,c,f)}:function(s,e,o,c){c===void 0&&(c=o),s[c]=e[o]}),r=t&&t.__exportStar||function(s,e){for(var o in s)o!=="default"&&!Object.prototype.hasOwnProperty.call(e,o)&&i(e,s,o)};Object.defineProperty(t,"__esModule",{value:!0});var u=po(),a=$y();u.default.init=function(s={}){let e={host:"arweave.net",port:443,protocol:"https"};if(typeof location!="object"||!location.protocol||!location.hostname)return new u.default({...s,...e});let o=location.protocol.replace(":",""),c=location.hostname,f=location.port?parseInt(location.port):o=="https"?443:80,l=(0,a.getDefaultConfig)(o,c),p=s.protocol||l.protocol,g=s.host||l.host,y=s.port||l.port||f;return new u.default({...s,host:g,protocol:p,port:y})},typeof globalThis=="object"?globalThis.Arweave=u.default:typeof self=="object"&&(self.Arweave=u.default),r(po(),t),t.default=u.default});lt();lt();lt();var Gy=ye(Jn()),ur=ye(Au());Ko();lt();function Ti(t){return t.signatureLength!==void 0}function kl(t){return t.signatureLength!==void 0}lt();var Vy=ye(Lg()),Zy=ye(pi()),$a=ye(Au()),Ol=new Map([[2,"rust"]]),Jy=class{constructor(t,i,r){Pt(this,"src");Pt(this,"wasmSrcCodeDir");Pt(this,"wasmGlueCode");this.src=t,this.wasmSrcCodeDir=i,this.wasmGlueCode=r}async createWasmSrc(){let t=[],i,r={};Vy.default.meterWASM(this.src,{meterType:"i32"}),t.push(this.src);let u=await WebAssembly.compile(this.src),a=WebAssembly.Module.imports(u),s,e=await WebAssembly.instantiate(this.src,Xy(a));if(!e.instance.exports.lang)throw new Error('No info about source type in wasm binary. Did you forget to export "lang" function?');if(s=e.instance.exports.lang(),i=e.instance.exports.version(),!Ol.has(s))throw new Error(`Unknown wasm source type ${s}`);let o=Ol.get(s);if(this.wasmSrcCodeDir==null)throw new Error("No path to original wasm contract source code");let c=await this.zipContents(this.wasmSrcCodeDir);if(t.push(c),o=="rust"){if(!this.wasmGlueCode)throw new Error("No path to generated wasm-bindgen js code");let p=Zy.default.readFileSync(this.wasmGlueCode,"utf-8"),g=(0,$a.matchMutClosureDtor)(p);r.dtor=parseInt(g),t.push(Ut.Buffer.from(p))}let f=this.joinBuffers(t),l=[{name:$a.WARP_TAGS.WASM_LANG,value:o},{name:$a.WARP_TAGS.WASM_LANG_VERSION,value:i.toString()},{name:$a.WARP_TAGS.WASM_META,value:JSON.stringify(r)}];return{wasmData:f,srcWasmTags:l}}joinBuffers(t){let i=t.length,r=[];return r.push(Ut.Buffer.from(i.toString())),r.push(Ut.Buffer.from("|")),t.forEach(u=>{r.push(Ut.Buffer.from(u.length.toString())),r.push(Ut.Buffer.from("|"))}),r.push(...t),r.reduce((u,a)=>Ut.Buffer.concat([u,a]))}async zipContents(t){let i=nm(),r=om(),u=new r.WritableStreamBuffer({initialSize:1e3*1024,incrementAmount:1e3*1024}),a=i("zip",{zlib:{level:9}});return a.on("error",function(s){throw s}),a.pipe(u),a.directory(t.toString(),t.toString()),await a.finalize(),u.end(),u.getContents()}};function Xy(t){let i={};return t.forEach(r=>{Object.prototype.hasOwnProperty.call(i,r.module)||(i[r.module]={}),i[r.module][r.name]=function(){}}),i}var Yy=class{constructor(t){Pt(this,"logger",ur.LoggerFactory.INST.create("Source"));Pt(this,"signature");this.warp=t}async createSource(t,i,r=!1){this.logger.debug("Creating new contract source");let{src:u,wasmSrcCodeDir:a,wasmGlueCode:s,tags:e}=t,o=e||[];this.warp.environment=="local"&&(r=!0);let c=r==null?this.warp.definitionLoader.type()=="warp":!r;if(!c&&Ti(i))throw new Error("Only ArWallet | CustomSignature wallet type are allowed when bundling is disabled.");if(c&&!Ti(i))throw new Error("Only Signer wallet type is allowed when bundling is enabled.");let f=u instanceof Gy.Buffer?"wasm":"js";if(f=="js"&&!(0,ur.checkJsSrc)(t.src,this.logger))throw new Error('JS contract source does not contain properly exported "handle" function');let l=null,p=[];f=="wasm"&&({wasmData:l,srcWasmTags:p}=await new Jy(u,a,s).createWasmSrc());let g=f=="wasm"?l:u,y=o.concat([new ur.Tag(ur.SMART_WEAVE_TAGS.APP_NAME,"SmartWeaveContractSource"),new ur.Tag(ur.SMART_WEAVE_TAGS.APP_VERSION,"0.3.0"),new ur.Tag(ur.SMART_WEAVE_TAGS.SDK,"Warp"),new ur.Tag(ur.WARP_TAGS.NONCE,Date.now().toString()),new ur.Tag(ur.SMART_WEAVE_TAGS.CONTENT_TYPE,f=="js"?"application/javascript":"application/wasm")]);return r?this.createSourceArweave(i,g,y,p,f):await this.createSourceBundlr(i,y,p,f,g)}async saveSource(t,i){this.logger.debug("Saving contract source",t.id),this.warp.environment=="local"&&(i=!0);let r=i==null?this.warp.definitionLoader.type()=="warp":!i;if(kl(t)&&!r)throw new Error("Unable to save data item when bundling is disabled.");if(!kl(t)){let s=new ur.TagsParser().getTag(t,ur.WARP_TAGS.SIGNATURE_TYPE);if(s&&s!="arweave"&&!r)throw new Error(`Unable to save source with signature type: ${s} when bundling is disabled.`)}let u,a;if(r){let s=await this.postSource(t.getRaw());this.logger.debug(s),u=!0}else a=await this.warp.arweave.transactions.post(t),u=a.status===200||a.status===208;if(u)return t.id;throw new Error(`Unable to write Contract Source. Arweave responded with status ${a.status}: ${a.statusText}`)}async postSource(t){return await(0,ur.getJsonResponse)(fetch(`${this.warp.gwUrl()}/gateway/v2/sources/deploy`,{method:"POST",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},body:t}))}async createSourceArweave(t,i,r,u,a){if(this.signature=new ur.Signature(this.warp,t),this.signature.type!=="arweave")throw new Error(`Unable to use signing function of type: ${this.signature.type}.`);let s=this.signature.signer,e=await this.warp.arweave.createTransaction({data:i});return r.forEach(o=>e.addTag(o.name,o.value)),a=="wasm"&&u.forEach(o=>e.addTag(o.name,o.value)),this.warp.environment==="testnet"&&e.addTag(ur.WARP_TAGS.WARP_TESTNET,"1.0.0"),await s(e),this.logger.debug("Posting transaction with source"),e}async createSourceBundlr(t,i,r,u,a){let s=[...i];u=="wasm"&&r.forEach(o=>s.push(new ur.Tag(o.name,o.value))),this.warp.environment==="testnet"&&s.push(new ur.Tag(ur.WARP_TAGS.WARP_TESTNET,"1.0.0"));let e;return(0,ur.isBrowser)()&&t.signer&&t.signer.signDataItem?e=await t.signDataItem(a,s):(e=Fo(a,t,{tags:s}),await e.sign(t)),this.logger.debug("Posting transaction with source"),e}},rr=ye(Au());Ko();var Qy=class{constructor(t){Pt(this,"logger",rr.LoggerFactory.INST.create("DefaultCreateContract"));Pt(this,"source");Pt(this,"signature");Pt(this,"warpFetchWrapper");this.warp=t,this.deployFromSourceTx=this.deployFromSourceTx.bind(this),this.source=new Yy(this.warp),this.warpFetchWrapper=new rr.WarpFetchWrapper(this.warp)}async deploy(t,i){let{wallet:r,initState:u,tags:a,transfer:s,data:e,evaluationManifest:o}=t,c,f=i==null?this.warp.definitionLoader.type()=="warp":!i;c=await this.source.createSource(t,r,!f),f||await this.source.saveSource(c,!0),this.logger.debug("Creating new contract");let l=await c.id;return await this.deployFromSourceTx({srcTxId:l,wallet:r,initState:u,tags:a,transfer:s,data:e,evaluationManifest:o},!f,c)}async deployFromSourceTx(t,i,r=null){this.logger.debug("Creating new contract from src tx");let{wallet:u,srcTxId:a,initState:s,data:e}=t,o,c,f,l=i==null?this.warp.definitionLoader.type()=="warp":!i;if(!l&&Ti(u))throw new Error("Only ArWallet | CustomSignature wallet type are allowed when bundling is disabled.");if(l&&!Ti(u))throw new Error("Only Signer wallet type is allowed when bundling is enabled.");let p={contract:[{name:rr.SMART_WEAVE_TAGS.APP_NAME,value:"SmartWeaveContract"},{name:rr.SMART_WEAVE_TAGS.APP_VERSION,value:"0.3.0"},{name:rr.SMART_WEAVE_TAGS.CONTRACT_SRC_TX_ID,value:a},{name:rr.SMART_WEAVE_TAGS.SDK,value:"Warp"},{name:rr.WARP_TAGS.NONCE,value:Date.now().toString()}],contractData:[{name:rr.SMART_WEAVE_TAGS.CONTENT_TYPE,value:e&&e["Content-Type"]},{name:rr.WARP_TAGS.INIT_STATE,value:s}],contractNonData:[{name:rr.SMART_WEAVE_TAGS.CONTENT_TYPE,value:"application/json"}],contractTestnet:[{name:rr.WARP_TAGS.WARP_TESTNET,value:"1.0.0"}],contractEvaluationManifest:[{name:rr.WARP_TAGS.MANIFEST,value:JSON.stringify(t.evaluationManifest)}]};l?{contract:o,responseOk:c}=await this.deployContractBundlr(t,p,r):{contract:o,responseOk:c}=await this.deployContractArweave(l,t,p);let g=await o.id;if(c)return{contractTxId:g,srcTxId:a};throw new Error(`Unable to write Contract. Arweave responded with status ${f.status}: ${f.statusText}`)}async deployBundled(t){return await(0,rr.getJsonResponse)(fetch(`${this.warp.gwUrl()}/gateway/contracts/deploy-bundled`,{method:"POST",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},body:t}))}async register(t,i){return await(0,rr.getJsonResponse)(fetch(`${this.warp.gwUrl()}/gateway/contracts/register`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({id:t,registerProvider:i})}))}async createSource(t,i,r=!1){return this.source.createSource(t,i,r)}async saveSource(t,i){return this.source.saveSource(t,i)}async postContract(t,i=null){let r={contract:t};return i&&(r={...r,src:i}),await(0,rr.getJsonResponse)(this.warpFetchWrapper.fetch(`${this.warp.gwUrl()}/gateway/v2/contracts/deploy`,{method:"POST",body:JSON.stringify(r),headers:{"Accept-Encoding":"gzip, deflate, br","Content-Type":"application/json",Accept:"application/json"}}))}async deployContractArweave(t,i,r){let{wallet:u,initState:a,transfer:s,data:e,tags:o}=i;this.signature=new rr.Signature(this.warp,u),!Ti(u)&&this.signature.checkNonArweaveSigningAvailability(t);let c=this.signature.signer;!Ti(u)&&this.signature.checkNonArweaveSigningAvailability(t);let f=await this.warp.arweave.createTransaction({data:(e==null?void 0:e.body)||a});if(+(s==null?void 0:s.winstonQty)>0&&s.target.length&&(this.logger.debug("Creating additional transaction with AR transfer",s),f=await this.warp.arweave.createTransaction({data:(e==null?void 0:e.body)||a,target:s.target,quantity:s.winstonQty})),o==null?void 0:o.length)for(let p of o)f.addTag(p.name.toString(),p.value.toString());r.contract.forEach(p=>f.addTag(p.name,p.value)),e?r.contractData.forEach(p=>f.addTag(p.name,p.value)):r.contractNonData.forEach(p=>f.addTag(p.name,p.value)),this.warp.environment==="testnet"&&r.contractTestnet.forEach(p=>f.addTag(p.name,p.value)),i.evaluationManifest&&r.contractEvaluationManifest.forEach(p=>f.addTag(p.name,p.value)),await c(f);let l=await this.warp.arweave.transactions.post(f);return{contract:f,responseOk:l.status===200||l.status===208}}async deployContractBundlr(t,i,r=null){let{wallet:u,initState:a,data:s,tags:e}=t,o=[...i.contract];if(e!=null&&e.length)for(let f of e)o.push(new rr.Tag(f.name.toString(),f.value.toString()));s?i.contractData.forEach(f=>o.push(new rr.Tag(f.name,f.value))):i.contractNonData.forEach(f=>o.push(new rr.Tag(f.name,f.value))),this.warp.environment==="testnet"&&i.contractTestnet.forEach(f=>o.push(new rr.Tag(f.name,f.value))),t.evaluationManifest&&i.contractEvaluationManifest.forEach(f=>o.push(new rr.Tag(f.name,f.value)));let c;return(0,rr.isBrowser)()&&u.signer&&u.signer.signDataItem?c=await u.signDataItem((s==null?void 0:s.body)||a,o):(c=Fo((s==null?void 0:s.body)||a,u,{tags:o}),await c.sign(u)),await this.postContract(c.getRaw(),r==null?void 0:r.getRaw()),{contract:c,responseOk:!0}}isRegisterProviderType(t){return rr.REGISTER_PROVIDER.includes(t)}};lt();var Aw=class{process(t){return new Qy(t)}type(){return"deploy"}};lt();lt();var rd={};ba(rd,{AVSCTap:()=>Oh,AlgorandSigner:()=>nw,AptosSigner:()=>aw,ArconnectSigner:()=>uw,Arweave:()=>Wd,ArweaveSigner:()=>Zd,Bundle:()=>F1,BundleItem:()=>mw,CryptoDriver:()=>qd,Curve25519:()=>ka,DataItem:()=>ma,EthereumSigner:()=>bs,HexInjectedSolanaSigner:()=>R1,HexSolanaSigner:()=>iw,InjectedAptosSigner:()=>N1,InjectedEthereumSigner:()=>Z6,InjectedSolanaSigner:()=>Jd,InjectedTypedEthereumSigner:()=>ow,MAX_TAG_BYTES:()=>Bh,MIN_BINARY_SIZE:()=>Ih,MultiSignatureAptosSigner:()=>L1,NearSigner:()=>rw,PolygonSigner:()=>ew,Rsa4096:()=>$d,SIG_CONFIG:()=>qe,SignatureConfig:()=>Ae,Signer:()=>tb,SolanaSigner:()=>Th,TypedEthereumSigner:()=>D1,bundleAndSignData:()=>pw,byteArrayToLong:()=>pr,concatBuffers:()=>Tr,createData:()=>W1,deepHash:()=>Oa,deserializeTags:()=>Bo,exportForTesting:()=>Q6,getCryptoDriver:()=>Ar,getSignatureAndId:()=>z1,indexToType:()=>kh,keccak256:()=>Mh,longTo16ByteArray:()=>lw,longTo32ByteArray:()=>fu,longTo8ByteArray:()=>lu,longToNByteArray:()=>Ba,secp256k1:()=>P1,serializeTags:()=>U1,shortTo2ByteArray:()=>j1,sign:()=>Ch,stringToBuffer:()=>je,unbundleData:()=>dw});lt();lt();lt();var tb=class{constructor(){Pt(this,"publicKey");Pt(this,"signatureType");Pt(this,"signatureLength");Pt(this,"ownerLength");Pt(this,"pem")}static verify(t,i,r,u){throw new Error("You must implement verify method on child")}};lt();lt();var eb=ye(Gr(),1);lt();var Ae;(function(t){t[t.ARWEAVE=1]="ARWEAVE",t[t.ED25519=2]="ED25519",t[t.ETHEREUM=3]="ETHEREUM",t[t.SOLANA=4]="SOLANA",t[t.INJECTEDAPTOS=5]="INJECTEDAPTOS",t[t.MULTIAPTOS=6]="MULTIAPTOS",t[t.TYPEDETHEREUM=7]="TYPEDETHEREUM"})(Ae||(Ae={}));var qe={[Ae.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[Ae.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[Ae.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[Ae.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[Ae.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[Ae.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[Ae.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}};lt();var rb=ye(gi(),1),vr=BigInt(0),Pe=BigInt(1),zn=BigInt(2),nb=BigInt(8),Il=BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),tr=Object.freeze({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l:Il,n:Il,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")}),nd=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),na=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742");var ib=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),ab=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),ob=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),sb=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),De=class{constructor(t,i,r,u){this.x=t,this.y=i,this.z=r,this.t=u}static fromAffine(t){if(!(t instanceof fr))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return t.equals(fr.ZERO)?De.ZERO:new De(t.x,t.y,Pe,ie(t.x*t.y))}static toAffineBatch(t){let i=lb(t.map(r=>r.z));return t.map((r,u)=>r.toAffine(i[u]))}static normalizeZ(t){return this.toAffineBatch(t).map(this.fromAffine)}equals(t){Cl(t);let{x:i,y:r,z:u}=this,{x:a,y:s,z:e}=t,o=ie(i*e),c=ie(a*u),f=ie(r*e),l=ie(s*u);return o===c&&f===l}negate(){return new De(ie(-this.x),this.y,this.z,ie(-this.t))}double(){let{x:t,y:i,z:r}=this,{a:u}=tr,a=ie(t*t),s=ie(i*i),e=ie(zn*ie(r*r)),o=ie(u*a),c=t+i,f=ie(ie(c*c)-a-s),l=o+s,p=l-e,g=o-s,y=ie(f*p),m=ie(l*g),M=ie(f*g),E=ie(p*l);return new De(y,m,E,M)}add(t){Cl(t);let{x:i,y:r,z:u,t:a}=this,{x:s,y:e,z:o,t:c}=t,f=ie((r-i)*(e+s)),l=ie((r+i)*(e-s)),p=ie(l-f);if(p===vr)return this.double();let g=ie(u*zn*c),y=ie(a*zn*o),m=y+g,M=l+f,E=y-g,B=ie(m*p),x=ie(M*E),C=ie(m*E),N=ie(p*M);return new De(B,x,N,C)}subtract(t){return this.add(t.negate())}precomputeWindow(t){let i=1+256/t,r=[],u=this,a=u;for(let s=0;s>=l,y>o&&(y-=f,t+=Pe);let m=g,M=g+Math.abs(y)-1,E=p%2!==0,B=y<0;y===0?s=s.add(Bl(E,u[m])):a=a.add(Bl(B,u[M]))}return De.normalizeZ([a,s])[0]}multiply(t,i){return this.wNAF(yo(t,tr.l),i)}multiplyUnsafe(t){let i=yo(t,tr.l,!1),r=De.BASE,u=De.ZERO;if(i===vr)return u;if(this.equals(u)||i===Pe)return this;if(this.equals(r))return this.wNAF(i);let a=u,s=this;for(;i>vr;)i&Pe&&(a=a.add(s)),s=s.double(),i>>=Pe;return a}isSmallOrder(){return this.multiplyUnsafe(tr.h).equals(De.ZERO)}isTorsionFree(){let t=this.multiplyUnsafe(tr.l/zn).double();return tr.l%zn&&(t=t.add(this)),t.equals(De.ZERO)}toAffine(t){let{x:i,y:r,z:u}=this,a=this.equals(De.ZERO);t==null&&(t=a?nb:as(u));let s=ie(i*t),e=ie(r*t),o=ie(u*t);if(a)return fr.ZERO;if(o!==Pe)throw new Error("invZ was invalid");return new fr(s,e)}fromRistrettoBytes(){ks()}toRistrettoBytes(){ks()}fromRistrettoHash(){ks()}};De.BASE=new De(tr.Gx,tr.Gy,Pe,ie(tr.Gx*tr.Gy));De.ZERO=new De(vr,Pe,Pe,vr);function Bl(t,i){let r=i.negate();return t?r:i}function Cl(t){if(!(t instanceof De))throw new TypeError("ExtendedPoint expected")}function xs(t){if(!(t instanceof an))throw new TypeError("RistrettoPoint expected")}function ks(){throw new Error("Legacy method: switch to RistrettoPoint")}var an=class{constructor(t){this.ep=t}static calcElligatorRistrettoMap(t){let{d:i}=tr,r=ie(na*t*t),u=ie((r+Pe)*ob),a=BigInt(-1),s=ie((a-i*r)*ie(r+i)),{isValid:e,value:o}=sh(u,s),c=ie(o*t);Fn(c)||(c=ie(-c)),e||(o=c),e||(a=r);let f=ie(a*(r-Pe)*sb-s),l=o*o,p=ie((o+o)*s),g=ie(f*ib),y=ie(Pe-l),m=ie(Pe+l);return new De(ie(p*m),ie(y*g),ie(g*m),ie(p*y))}static hashToCurve(t){t=Gn(t,64);let i=Os(t.slice(0,32)),r=this.calcElligatorRistrettoMap(i),u=Os(t.slice(32,64)),a=this.calcElligatorRistrettoMap(u);return new an(r.add(a))}static fromHex(t){t=Gn(t,32);let{a:i,d:r}=tr,u="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",a=Os(t);if(!cb(ha(a),t)||Fn(a))throw new Error(u);let s=ie(a*a),e=ie(Pe+i*s),o=ie(Pe-i*s),c=ie(e*e),f=ie(o*o),l=ie(i*r*c-f),{isValid:p,value:g}=Rl(ie(l*f)),y=ie(g*o),m=ie(g*y*l),M=ie((a+a)*y);Fn(M)&&(M=ie(-M));let E=ie(e*m),B=ie(M*E);if(!p||Fn(B)||E===vr)throw new Error(u);return new an(new De(M,E,Pe,B))}toRawBytes(){let{x:t,y:i,z:r,t:u}=this.ep,a=ie(ie(r+i)*ie(r-i)),s=ie(t*i),e=ie(s*s),{value:o}=Rl(ie(a*e)),c=ie(o*a),f=ie(o*s),l=ie(c*f*u),p;if(Fn(u*l)){let y=ie(i*na),m=ie(t*na);t=y,i=m,p=ie(c*ab)}else p=f;Fn(t*l)&&(i=ie(-i));let g=ie((r-i)*p);return Fn(g)&&(g=ie(-g)),ha(g)}toHex(){return Ma(this.toRawBytes())}toString(){return this.toHex()}equals(t){xs(t);let i=this.ep,r=t.ep,u=ie(i.x*r.y)===ie(i.y*r.x),a=ie(i.y*r.y)===ie(i.x*r.x);return u||a}add(t){return xs(t),new an(this.ep.add(t.ep))}subtract(t){return xs(t),new an(this.ep.subtract(t.ep))}multiply(t){return new an(this.ep.multiply(t))}multiplyUnsafe(t){return new an(this.ep.multiplyUnsafe(t))}};an.BASE=new an(De.BASE);an.ZERO=new an(De.ZERO);var Zs=new WeakMap,fr=class{constructor(t,i){this.x=t,this.y=i}_setWindowSize(t){this._WINDOW_SIZE=t,Zs.delete(this)}static fromHex(t,i=!0){let{d:r,P:u}=tr;t=Gn(t,32);let a=t.slice();a[31]=t[31]&-129;let s=xa(a);if(i&&s>=u)throw new Error("Expected 0 < hex < P");if(!i&&s>=nd)throw new Error("Expected 0 < hex < 2**256");let e=ie(s*s),o=ie(e-Pe),c=ie(r*e+Pe),{isValid:f,value:l}=sh(o,c);if(!f)throw new Error("Point.fromHex: invalid y coordinate");let p=(l&Pe)===Pe;return(t[31]&128)!==0!==p&&(l=ie(-l)),new fr(l,s)}static async fromPrivateKey(t){return(await uh(t)).point}toRawBytes(){let t=ha(this.y);return t[31]|=this.x&Pe?128:0,t}toHex(){return Ma(this.toRawBytes())}toX25519(){let{y:t}=this,i=ie((Pe+t)*as(Pe-t));return ha(i)}isTorsionFree(){return De.fromAffine(this).isTorsionFree()}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new fr(ie(-this.x),this.y)}add(t){return De.fromAffine(this).add(De.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return De.fromAffine(this).multiply(t,this).toAffine()}};fr.BASE=new fr(tr.Gx,tr.Gy);fr.ZERO=new fr(vr,Pe);var go=class{constructor(t,i){this.r=t,this.s=i,this.assertValidity()}static fromHex(t){let i=Gn(t,64),r=fr.fromHex(i.slice(0,32),!1),u=xa(i.slice(32,64));return new go(r,u)}assertValidity(){let{r:t,s:i}=this;if(!(t instanceof fr))throw new Error("Expected Point instance");return yo(i,tr.l,!1),this}toRawBytes(){let t=new Uint8Array(64);return t.set(this.r.toRawBytes()),t.set(ha(this.s),32),t}toHex(){return Ma(this.toRawBytes())}};function Pl(...t){if(!t.every(u=>u instanceof Uint8Array))throw new Error("Expected Uint8Array list");if(t.length===1)return t[0];let i=t.reduce((u,a)=>u+a.length,0),r=new Uint8Array(i);for(let u=0,a=0;ui.toString(16).padStart(2,"0"));function Ma(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let i="";for(let r=0;r=vr?r:i+r}function as(t,i=tr.P){if(t===vr||i<=vr)throw new Error(`invert: expected positive integers, got n=${t} mod=${i}`);let r=ie(t,i),u=i,a=vr,s=Pe;for(;r!==vr;){let e=u/r,o=u%r,c=a-s*e;u=r,r=o,a=s,s=c}if(u!==Pe)throw new Error("invert: does not exist");return ie(a,i)}function lb(t,i=tr.P){let r=new Array(t.length),u=t.reduce((s,e,o)=>e===vr?s:(r[o]=s,ie(s*e,i)),Pe),a=as(u,i);return t.reduceRight((s,e,o)=>e===vr?s:(r[o]=ie(s*r[o],i),ie(s*e,i)),a),r}function gn(t,i){let{P:r}=tr,u=t;for(;i-- >vr;)u*=u,u%=r;return u}function fb(t){let{P:i}=tr,r=BigInt(5),u=BigInt(10),a=BigInt(20),s=BigInt(40),e=BigInt(80),o=t*t%i*t%i,c=gn(o,zn)*o%i,f=gn(c,Pe)*t%i,l=gn(f,r)*f%i,p=gn(l,u)*l%i,g=gn(p,a)*p%i,y=gn(g,s)*g%i,m=gn(y,e)*y%i,M=gn(m,e)*y%i,E=gn(M,u)*l%i;return{pow_p_5_8:gn(E,zn)*t%i,b2:o}}function sh(t,i){let r=ie(i*i*i),u=ie(r*r*i),a=fb(t*u).pow_p_5_8,s=ie(t*r*a),e=ie(i*s*s),o=s,c=ie(s*na),f=e===t,l=e===ie(-t),p=e===ie(-t*na);return f&&(s=o),(l||p)&&(s=c),Fn(s)&&(s=ie(-s)),{isValid:f||l,value:s}}function Rl(t){return sh(Pe,t)}function mo(t){return ie(xa(t),tr.l)}function cb(t,i){if(t.length!==i.length)return!1;for(let r=0;r{if(t=Gn(t),t.length<40||t.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return ie(xa(t),tr.l-Pe)+Pe},randomBytes:(t=32)=>{if(Ln.web)return Ln.web.getRandomValues(new Uint8Array(t));if(Ln.node){let{randomBytes:i}=Ln.node;return new Uint8Array(i(t).buffer)}else throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>Pi.randomBytes(32),sha512:async(...t)=>{let i=Pl(...t);if(Ln.web){let r=await Ln.web.subtle.digest("SHA-512",i.buffer);return new Uint8Array(r)}else{if(Ln.node)return Uint8Array.from(Ln.node.createHash("sha512").update(i).digest());throw new Error("The environment doesn't have sha512 function")}},precompute(t=8,i=fr.BASE){let r=i.equals(fr.BASE)?i:new fr(i.x,i.y);return r._setWindowSize(t),r.multiply(zn),r},sha512Sync:void 0};Object.defineProperties(Pi,{sha512Sync:{configurable:!1,get(){return Is},set(t){Is||(Is=t)}}});var ka=class{constructor(t,i){Pt(this,"_key");Pt(this,"pk");Pt(this,"ownerLength",qe[2].pubLength);Pt(this,"signatureLength",qe[2].sigLength);Pt(this,"_publicKey");Pt(this,"signatureType",2);this._key=t,this.pk=i}get publicKey(){return this._publicKey}get key(){throw new Error("You must implement `key`")}sign(t){return mb(Ut.Buffer.from(t),Ut.Buffer.from(this.key))}static async verify(t,i,r){let u=t;return typeof t=="string"&&(u=eb.default.toBuffer(t)),os(Ut.Buffer.from(r),Ut.Buffer.from(i),Ut.Buffer.from(u))}};lt();lt();lt();lt();lt();var ad={};ba(ad,{arToWinston:()=>Eb,b64UrlDecode:()=>fd,b64UrlEncode:()=>ld,b64UrlToBuffer:()=>on,b64UrlToString:()=>ud,bufferToString:()=>hh,bufferTob64:()=>hd,bufferTob64Url:()=>un,concatBuffers:()=>Tr,stringToB64Url:()=>Js,stringToBuffer:()=>je,winstonToAr:()=>_b});lt();var od=ye(Co(),1);lt();var vb=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Bs=Math.ceil,Ur=Math.floor,Br="[BigNumber Error] ",Nl=Br+"Number primitive has more than 15 significant digits: ",Qr=1e14,ve=14,Cs=9007199254740991,Ps=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Dn=1e7,mr=1e9;function sd(t){var i,r,u,a=x.prototype={constructor:x,toString:null,valueOf:null},s=new x(1),e=20,o=4,c=-7,f=21,l=-1e7,p=1e7,g=!1,y=1,m=0,M={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},E="0123456789abcdefghijklmnopqrstuvwxyz",B=!0;function x(P,D){var W,q,O,L,n,d,v,A,T=this;if(!(T instanceof x))return new x(P,D);if(D==null){if(P&&P._isBigNumber===!0){T.s=P.s,!P.c||P.e>p?T.c=T.e=null:P.e=10;n/=10,L++);L>p?T.c=T.e=null:(T.e=L,T.c=[P]);return}A=String(P)}else{if(!vb.test(A=String(P)))return u(T,A,d);T.s=A.charCodeAt(0)==45?(A=A.slice(1),-1):1}(L=A.indexOf("."))>-1&&(A=A.replace(".","")),(n=A.search(/e/i))>0?(L<0&&(L=n),L+=+A.slice(n+1),A=A.substring(0,n)):L<0&&(L=A.length)}else{if(nr(D,2,E.length,"Base"),D==10&&B)return T=new x(P),I(T,e+T.e+1,o);if(A=String(P),d=typeof P=="number"){if(P*0!=0)return u(T,A,d,D);if(T.s=1/P<0?(A=A.slice(1),-1):1,x.DEBUG&&A.replace(/^0\.0*|\./,"").length>15)throw Error(Nl+P)}else T.s=A.charCodeAt(0)===45?(A=A.slice(1),-1):1;for(W=E.slice(0,D),L=n=0,v=A.length;nL){L=v;continue}}else if(!O&&(A==A.toUpperCase()&&(A=A.toLowerCase())||A==A.toLowerCase()&&(A=A.toUpperCase()))){O=!0,n=-1,L=0;continue}return u(T,String(P),d,D)}d=!1,A=r(A,D,10,T.s),(L=A.indexOf("."))>-1?A=A.replace(".",""):L=A.length}for(n=0;A.charCodeAt(n)===48;n++);for(v=A.length;A.charCodeAt(--v)===48;);if(A=A.slice(n,++v)){if(v-=n,d&&x.DEBUG&&v>15&&(P>Cs||P!==Ur(P)))throw Error(Nl+T.s*P);if((L=L-n-1)>p)T.c=T.e=null;else if(L=-mr&&O<=mr&&O===Ur(O)){if(q[0]===0){if(O===0&&q.length===1)return!0;break t}if(D=(O+1)%ve,D<1&&(D+=ve),String(q[0]).length==D){for(D=0;D=Qr||W!==Ur(W))break t;if(W!==0)return!0}}}else if(q===null&&O===null&&(L===null||L===1||L===-1))return!0;throw Error(Br+"Invalid BigNumber: "+P)},x.maximum=x.max=function(){return N(arguments,-1)},x.minimum=x.min=function(){return N(arguments,1)},x.random=function(){var P=9007199254740992,D=Math.random()*P&2097151?function(){return Ur(Math.random()*P)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(W){var q,O,L,n,d,v=0,A=[],T=new x(s);if(W==null?W=e:nr(W,0,mr),n=Bs(W/ve),g)if(crypto.getRandomValues){for(q=crypto.getRandomValues(new Uint32Array(n*=2));v>>11),d>=9e15?(O=crypto.getRandomValues(new Uint32Array(2)),q[v]=O[0],q[v+1]=O[1]):(A.push(d%1e14),v+=2);v=n/2}else if(crypto.randomBytes){for(q=crypto.randomBytes(n*=7);v=9e15?crypto.randomBytes(7).copy(q,v):(A.push(d%1e14),v+=7);v=n/7}else throw g=!1,Error(Br+"crypto unavailable");if(!g)for(;v=10;d/=10,v++);vO-1&&(d[n+1]==null&&(d[n+1]=0),d[n+1]+=d[n]/O|0,d[n]%=O)}return d.reverse()}return function(W,q,O,L,n){var d,v,A,T,S,w,b,h,k=W.indexOf("."),tt=e,X=o;for(k>=0&&(T=m,m=0,W=W.replace(".",""),h=new x(q),w=h.pow(W.length-k),m=T,h.c=D(Mn(Dr(w.c),w.e,"0"),10,O,P),h.e=h.c.length),b=D(W,q,O,n?(d=E,P):(d=P,E)),A=T=b.length;b[--T]==0;b.pop());if(!b[0])return d.charAt(0);if(k<0?--A:(w.c=b,w.e=A,w.s=L,w=i(w,h,tt,X,O),b=w.c,S=w.r,A=w.e),v=A+tt+1,k=b[v],T=O/2,S=S||v<0||b[v+1]!=null,S=X<4?(k!=null||S)&&(X==0||X==(w.s<0?3:2)):k>T||k==T&&(X==4||S||X==6&&b[v-1]&1||X==(w.s<0?8:7)),v<1||!b[0])W=S?Mn(d.charAt(1),-tt,d.charAt(0)):d.charAt(0);else{if(b.length=v,S)for(--O;++b[--v]>O;)b[v]=0,v||(++A,b=[1].concat(b));for(T=b.length;!b[--T];);for(k=0,W="";k<=T;W+=d.charAt(b[k++]));W=Mn(W,A,d.charAt(0))}return W}}(),i=function(){function P(q,O,L){var n,d,v,A,T=0,S=q.length,w=O%Dn,b=O/Dn|0;for(q=q.slice();S--;)v=q[S]%Dn,A=q[S]/Dn|0,n=b*v+A*w,d=w*v+n%Dn*Dn+T,T=(d/L|0)+(n/Dn|0)+b*A,q[S]=d%L;return T&&(q=[T].concat(q)),q}function D(q,O,L,n){var d,v;if(L!=n)v=L>n?1:-1;else for(d=v=0;dO[d]?1:-1;break}return v}function W(q,O,L,n){for(var d=0;L--;)q[L]-=d,d=q[L]1;q.splice(0,1));}return function(q,O,L,n,d){var v,A,T,S,w,b,h,k,tt,X,ft,et,at,$,J,R,j,z=q.s==O.s?1:-1,Z=q.c,Q=O.c;if(!Z||!Z[0]||!Q||!Q[0])return new x(!q.s||!O.s||(Z?Q&&Z[0]==Q[0]:!Q)?NaN:Z&&Z[0]==0||!Q?z*0:z/0);for(k=new x(z),tt=k.c=[],A=q.e-O.e,z=L+A+1,d||(d=Qr,A=Fr(q.e/ve)-Fr(O.e/ve),z=z/ve|0),T=0;Q[T]==(Z[T]||0);T++);if(Q[T]>(Z[T]||0)&&A--,z<0)tt.push(1),S=!0;else{for($=Z.length,R=Q.length,T=0,z+=2,w=Ur(d/(Q[0]+1)),w>1&&(Q=P(Q,w,d),Z=P(Z,w,d),R=Q.length,$=Z.length),at=R,X=Z.slice(0,R),ft=X.length;ft=d/2&&J++;do{if(w=0,v=D(Q,X,R,ft),v<0){if(et=X[0],R!=ft&&(et=et*d+(X[1]||0)),w=Ur(et/J),w>1)for(w>=d&&(w=d-1),b=P(Q,w,d),h=b.length,ft=X.length;D(b,X,h,ft)==1;)w--,W(b,R=10;z/=10,T++);I(k,L+(k.e=T+A*ve-1)+1,n,S)}else k.e=A,k.r=+S;return k}}();function C(P,D,W,q){var O,L,n,d,v;if(W==null?W=o:nr(W,0,8),!P.c)return P.toString();if(O=P.c[0],n=P.e,D==null)v=Dr(P.c),v=q==1||q==2&&(n<=c||n>=f)?Ga(v,n):Mn(v,n,"0");else if(P=I(new x(P),D,W),L=P.e,v=Dr(P.c),d=v.length,q==1||q==2&&(D<=L||L<=c)){for(;dd){if(--D>0)for(v+=".";D--;v+="0");}else if(D+=L-d,D>0)for(L+1==d&&(v+=".");D--;v+="0");return P.s<0&&O?"-"+v:v}function N(P,D){for(var W,q,O=1,L=new x(P[0]);O=10;O/=10,q++);return(W=q+W*ve-1)>p?P.c=P.e=null:W=10;d/=10,O++);if(L=D-O,L<0)L+=ve,n=D,v=S[A=0],T=Ur(v/w[O-n-1]%10);else if(A=Bs((L+1)/ve),A>=S.length)if(q){for(;S.length<=A;S.push(0));v=T=0,O=1,L%=ve,n=L-ve+1}else break t;else{for(v=d=S[A],O=1;d>=10;d/=10,O++);L%=ve,n=L-ve+O,T=n<0?0:Ur(v/w[O-n-1]%10)}if(q=q||D<0||S[A+1]!=null||(n<0?v:v%w[O-n-1]),q=W<4?(T||q)&&(W==0||W==(P.s<0?3:2)):T>5||T==5&&(W==4||q||W==6&&(L>0?n>0?v/w[O-n]:0:S[A-1])%10&1||W==(P.s<0?8:7)),D<1||!S[0])return S.length=0,q?(D-=P.e+1,S[0]=w[(ve-D%ve)%ve],P.e=-D||0):S[0]=P.e=0,P;if(L==0?(S.length=A,d=1,A--):(S.length=A+1,d=w[ve-L],S[A]=n>0?Ur(v/w[O-n]%w[n])*d:0),q)for(;;)if(A==0){for(L=1,n=S[0];n>=10;n/=10,L++);for(n=S[0]+=d,d=1;n>=10;n/=10,d++);L!=d&&(P.e++,S[0]==Qr&&(S[0]=1));break}else{if(S[A]+=d,S[A]!=Qr)break;S[A--]=0,d=1}for(L=S.length;S[--L]===0;S.pop());}P.e>p?P.c=P.e=null:P.e=f?Ga(D,W):Mn(D,W,"0"),P.s<0?"-"+D:D)}return a.absoluteValue=a.abs=function(){var P=new x(this);return P.s<0&&(P.s=1),P},a.comparedTo=function(P,D){return ii(this,new x(P,D))},a.decimalPlaces=a.dp=function(P,D){var W,q,O,L=this;if(P!=null)return nr(P,0,mr),D==null?D=o:nr(D,0,8),I(new x(L),P+L.e+1,D);if(!(W=L.c))return null;if(q=((O=W.length-1)-Fr(this.e/ve))*ve,O=W[O])for(;O%10==0;O/=10,q--);return q<0&&(q=0),q},a.dividedBy=a.div=function(P,D){return i(this,new x(P,D),e,o)},a.dividedToIntegerBy=a.idiv=function(P,D){return i(this,new x(P,D),0,1)},a.exponentiatedBy=a.pow=function(P,D){var W,q,O,L,n,d,v,A,T,S=this;if(P=new x(P),P.c&&!P.isInteger())throw Error(Br+"Exponent not an integer: "+U(P));if(D!=null&&(D=new x(D)),d=P.e>14,!S.c||!S.c[0]||S.c[0]==1&&!S.e&&S.c.length==1||!P.c||!P.c[0])return T=new x(Math.pow(+U(S),d?P.s*(2-Ha(P)):+U(P))),D?T.mod(D):T;if(v=P.s<0,D){if(D.c?!D.c[0]:!D.s)return new x(NaN);q=!v&&S.isInteger()&&D.isInteger(),q&&(S=S.mod(D))}else{if(P.e>9&&(S.e>0||S.e<-1||(S.e==0?S.c[0]>1||d&&S.c[1]>=24e7:S.c[0]<8e13||d&&S.c[0]<=9999975e7)))return L=S.s<0&&Ha(P)?-0:0,S.e>-1&&(L=1/L),new x(v?1/L:L);m&&(L=Bs(m/ve+2))}for(d?(W=new x(.5),v&&(P.s=1),A=Ha(P)):(O=Math.abs(+U(P)),A=O%2),T=new x(s);;){if(A){if(T=T.times(S),!T.c)break;L?T.c.length>L&&(T.c.length=L):q&&(T=T.mod(D))}if(O){if(O=Ur(O/2),O===0)break;A=O%2}else if(P=P.times(W),I(P,P.e+1,1),P.e>14)A=Ha(P);else{if(O=+U(P),O===0)break;A=O%2}S=S.times(S),L?S.c&&S.c.length>L&&(S.c.length=L):q&&(S=S.mod(D))}return q?T:(v&&(T=s.div(T)),D?T.mod(D):L?I(T,m,o,n):T)},a.integerValue=function(P){var D=new x(this);return P==null?P=o:nr(P,0,8),I(D,D.e+1,P)},a.isEqualTo=a.eq=function(P,D){return ii(this,new x(P,D))===0},a.isFinite=function(){return!!this.c},a.isGreaterThan=a.gt=function(P,D){return ii(this,new x(P,D))>0},a.isGreaterThanOrEqualTo=a.gte=function(P,D){return(D=ii(this,new x(P,D)))===1||D===0},a.isInteger=function(){return!!this.c&&Fr(this.e/ve)>this.c.length-2},a.isLessThan=a.lt=function(P,D){return ii(this,new x(P,D))<0},a.isLessThanOrEqualTo=a.lte=function(P,D){return(D=ii(this,new x(P,D)))===-1||D===0},a.isNaN=function(){return!this.s},a.isNegative=function(){return this.s<0},a.isPositive=function(){return this.s>0},a.isZero=function(){return!!this.c&&this.c[0]==0},a.minus=function(P,D){var W,q,O,L,n=this,d=n.s;if(P=new x(P,D),D=P.s,!d||!D)return new x(NaN);if(d!=D)return P.s=-D,n.plus(P);var v=n.e/ve,A=P.e/ve,T=n.c,S=P.c;if(!v||!A){if(!T||!S)return T?(P.s=-D,P):new x(S?n:NaN);if(!T[0]||!S[0])return S[0]?(P.s=-D,P):new x(T[0]?n:o==3?-0:0)}if(v=Fr(v),A=Fr(A),T=T.slice(),d=v-A){for((L=d<0)?(d=-d,O=T):(A=v,O=S),O.reverse(),D=d;D--;O.push(0));O.reverse()}else for(q=(L=(d=T.length)<(D=S.length))?d:D,d=D=0;D0)for(;D--;T[W++]=0);for(D=Qr-1;q>d;){if(T[--q]=0;){for(W=0,w=et[O]%tt,b=et[O]/tt|0,n=v,L=O+n;L>O;)A=ft[--n]%tt,T=ft[n]/tt|0,d=b*A+T*w,A=w*A+d%tt*tt+h[L]+W,W=(A/k|0)+(d/tt|0)+b*T,h[L--]=A%k;h[L]=W}return W?++q:h.splice(0,1),F(P,h,q)},a.negated=function(){var P=new x(this);return P.s=-P.s||null,P},a.plus=function(P,D){var W,q=this,O=q.s;if(P=new x(P,D),D=P.s,!O||!D)return new x(NaN);if(O!=D)return P.s=-D,q.minus(P);var L=q.e/ve,n=P.e/ve,d=q.c,v=P.c;if(!L||!n){if(!d||!v)return new x(O/0);if(!d[0]||!v[0])return v[0]?P:new x(d[0]?q:O*0)}if(L=Fr(L),n=Fr(n),d=d.slice(),O=L-n){for(O>0?(n=L,W=v):(O=-O,W=d),W.reverse();O--;W.push(0));W.reverse()}for(O=d.length,D=v.length,O-D<0&&(W=v,v=d,d=W,D=O),O=0;D;)O=(d[--D]=d[D]+v[D]+O)/Qr|0,d[D]=Qr===d[D]?0:d[D]%Qr;return O&&(d=[O].concat(d),++n),F(P,d,n)},a.precision=a.sd=function(P,D){var W,q,O,L=this;if(P!=null&&P!==!!P)return nr(P,1,mr),D==null?D=o:nr(D,0,8),I(new x(L),P,D);if(!(W=L.c))return null;if(O=W.length-1,q=O*ve+1,O=W[O]){for(;O%10==0;O/=10,q--);for(O=W[0];O>=10;O/=10,q++);}return P&&L.e+1>q&&(q=L.e+1),q},a.shiftedBy=function(P){return nr(P,-Cs,Cs),this.times("1e"+P)},a.squareRoot=a.sqrt=function(){var P,D,W,q,O,L=this,n=L.c,d=L.s,v=L.e,A=e+4,T=new x("0.5");if(d!==1||!n||!n[0])return new x(!d||d<0&&(!n||n[0])?NaN:n?L:1/0);if(d=Math.sqrt(+U(L)),d==0||d==1/0?(D=Dr(n),(D.length+v)%2==0&&(D+="0"),d=Math.sqrt(+D),v=Fr((v+1)/2)-(v<0||v%2),d==1/0?D="5e"+v:(D=d.toExponential(),D=D.slice(0,D.indexOf("e")+1)+v),W=new x(D)):W=new x(d+""),W.c[0]){for(v=W.e,d=v+A,d<3&&(d=0);;)if(O=W,W=T.times(O.plus(i(L,O,A,1))),Dr(O.c).slice(0,d)===(D=Dr(W.c)).slice(0,d))if(W.e0&&h>0){for(L=h%d||d,T=b.substr(0,L);L0&&(T+=A+b.slice(L)),w&&(T="-"+T)}q=S?T+(W.decimalSeparator||"")+((v=+W.fractionGroupSize)?S.replace(new RegExp("\\d{"+v+"}\\B","g"),"$&"+(W.fractionGroupSeparator||"")):S):T}return(W.prefix||"")+q+(W.suffix||"")},a.toFraction=function(P){var D,W,q,O,L,n,d,v,A,T,S,w,b=this,h=b.c;if(P!=null&&(d=new x(P),!d.isInteger()&&(d.c||d.s!==1)||d.lt(s)))throw Error(Br+"Argument "+(d.isInteger()?"out of range: ":"not an integer: ")+U(d));if(!h)return new x(b);for(D=new x(s),A=W=new x(s),q=v=new x(s),w=Dr(h),L=D.e=w.length-b.e-1,D.c[0]=Ps[(n=L%ve)<0?ve+n:n],P=!P||d.comparedTo(D)>0?L>0?D:A:d,n=p,p=1/0,d=new x(w),v.c[0]=0;T=i(d,D,0,1),O=W.plus(T.times(q)),O.comparedTo(P)!=1;)W=q,q=O,A=v.plus(T.times(O=A)),v=O,D=d.minus(T.times(O=D)),d=O;return O=i(P.minus(W),q,0,1),v=v.plus(O.times(A)),W=W.plus(O.times(q)),v.s=A.s=b.s,L=L*2,S=i(A,q,L,o).minus(b).abs().comparedTo(i(v,W,L,o).minus(b).abs())<1?[A,q]:[v,W],p=n,S},a.toNumber=function(){return+U(this)},a.toPrecision=function(P,D){return P!=null&&nr(P,1,mr),C(this,P,D,2)},a.toString=function(P){var D,W=this,q=W.s,O=W.e;return O===null?q?(D="Infinity",q<0&&(D="-"+D)):D="NaN":(P==null?D=O<=c||O>=f?Ga(Dr(W.c),O):Mn(Dr(W.c),O,"0"):P===10&&B?(W=I(new x(W),e+O+1,o),D=Mn(Dr(W.c),W.e,"0")):(nr(P,2,E.length,"Base"),D=r(Mn(Dr(W.c),O,"0"),10,P,q,!0)),q<0&&W.c[0]&&(D="-"+D)),D},a.valueOf=a.toJSON=function(){return U(this)},a._isBigNumber=!0,a[Symbol.toStringTag]="BigNumber",a[Symbol.for("nodejs.util.inspect.custom")]=a.valueOf,t!=null&&x.set(t),x}function Fr(t){var i=t|0;return t>0||t===i?i:i-1}function Dr(t){for(var i,r,u=1,a=t.length,s=t[0]+"";uf^r?1:-1;for(o=(c=a.length)<(f=s.length)?c:f,e=0;es[e]^r?1:-1;return c==f?0:c>f^r?1:-1}function nr(t,i,r,u){if(tr||t!==Ur(t))throw Error(Br+(u||"Argument")+(typeof t=="number"?tr?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function Ha(t){var i=t.c.length-1;return Fr(t.e/ve)==i&&t.c[i]%2!=0}function Ga(t,i){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(i<0?"e":"e+")+i}function Mn(t,i,r){var u,a;if(i<0){for(a=r+".";++i;a+=r);t=a+t}else if(u=t.length,++i>u){for(a=r,i-=u;--i;a+=r);t+=a}else i{super(...args);Pt(this,"type");Pt(this,"response")};r.message?t(r.message):t(),this.type=i,this.response=r.response}getType(){return this.type}};function aa(t){let i=t.data;if(typeof t.data=="string")try{i=JSON.parse(t.data)}catch{}if(t.data instanceof ArrayBuffer||t.data instanceof Uint8Array)try{i=JSON.parse(i.toString())}catch{}return i?i.error||i:t.statusText||"unknown"}var Ab=class{constructor(t,i){Pt(this,"api");Pt(this,"network");this.api=t,this.network=i}async getByHash(t){let i=await this.api.get(`block/hash/${t}`);if(i.status===200)return i.data;throw i.status===404?new ia("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${i}`)}async getByHeight(t){let i=await this.api.get(`block/height/${t}`);if(i.status===200)return i.data;throw i.status===404?new ia("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${i}`)}async getCurrent(){let{current:t}=await this.network.getInfo();return await this.getByHash(t)}};lt();lt();var Wn=256*1024,Tb=32*1024,ta=32,wi=32,Mb=class{constructor(t){Pt(this,"crypto");this.crypto=t.deps.crypto}async chunkData(t){let i=[],r=t,u=0;for(;r.byteLength>=Wn;){let a=Wn,s=r.byteLength-Wn;s>0&&s({type:"leaf",id:await this.hash(await Promise.all([this.hash(i),this.hash(Va(u))])),dataHash:i,minByteRange:r,maxByteRange:u})))}async computeRootHash(t){return(await this.generateTree(t)).id}async generateTree(t){return await this.buildLayers(await this.generateLeaves(await this.chunkData(t)))}async generateTransactionChunks(t){let i=await this.chunkData(t),r=await this.generateLeaves(i),u=await this.buildLayers(r),a=await this.generateProofs(u),s=i.slice(-1)[0];return s.maxByteRange-s.minByteRange===0&&(i.splice(i.length-1,1),a.splice(a.length-1,1)),{data_root:u.id,chunks:i,proofs:a}}async buildLayers(t,i=0){if(t.length<2)return t[0];let r=[];for(let u=0;u=u)return this.validatePath(t,0,u-1,u,a);if(i<0)return this.validatePath(t,0,0,u,a);if(a.length==wi+ta){let p=a.slice(0,wi),g=a.slice(p.length,p.length+ta),y=await this.hash([await this.hash(p),await this.hash(g)]);return Dl(t,y)?{offset:u-1,leftBound:r,rightBound:u,chunkSize:u-r}:!1}let s=a.slice(0,wi),e=a.slice(s.length,s.length+wi),o=a.slice(s.length+e.length,s.length+e.length+ta),c=Ll(o),f=a.slice(s.length+e.length+o.length),l=await this.hash([await this.hash(s),await this.hash(e),await this.hash(o)]);return Dl(t,l)?i{lt();function r(u,a){typeof a=="boolean"&&(a={forever:a}),this._originalTimeouts=JSON.parse(JSON.stringify(u)),this._timeouts=u,this._options=a||{},this._maxRetryTime=a&&a.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}i.exports=r,r.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},r.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},r.prototype.retry=function(u){if(this._timeout&&clearTimeout(this._timeout),!u)return!1;var a=new Date().getTime();if(u&&a-this._operationStart>=this._maxRetryTime)return this._errors.push(u),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(u);var s=this._timeouts.shift();if(s===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),s=this._cachedTimeouts.slice(-1);else return!1;var e=this;return this._timer=setTimeout(function(){e._attempts++,e._operationTimeoutCb&&(e._timeout=setTimeout(function(){e._operationTimeoutCb(e._attempts)},e._operationTimeout),e._options.unref&&e._timeout.unref()),e._fn(e._attempts)},s),this._options.unref&&this._timer.unref(),!0},r.prototype.attempt=function(u,a){this._fn=u,a&&(a.timeout&&(this._operationTimeout=a.timeout),a.cb&&(this._operationTimeoutCb=a.cb));var s=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){s._operationTimeoutCb()},s._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},r.prototype.try=function(u){console.log("Using RetryOperation.try() is deprecated"),this.attempt(u)},r.prototype.start=function(u){console.log("Using RetryOperation.start() is deprecated"),this.attempt(u)},r.prototype.start=r.prototype.try,r.prototype.errors=function(){return this._errors},r.prototype.attempts=function(){return this._attempts},r.prototype.mainError=function(){if(this._errors.length===0)return null;for(var u={},a=null,s=0,e=0;e=s&&(a=o,s=f)}return a}}),my=gt(t=>{lt();var i=gy();t.operation=function(r){var u=t.timeouts(r);return new i(u,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},t.timeouts=function(r){if(r instanceof Array)return[].concat(r);var u={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var a in r)u[a]=r[a];if(u.minTimeout>u.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var s=[],e=0;e{lt(),i.exports=my()}),by=gt((t,i)=>{lt();var r=yy();function u(a,s){function e(o,c){var f=s||{},l;"randomize"in f||(f.randomize=!0),l=r.operation(f);function p(m){c(m||new Error("Aborted"))}function g(m,M){if(m.bail){p(m);return}l.retry(m)?f.onRetry&&f.onRetry(m,M):c(l.mainError())}function y(m){var M;try{M=a(p,m)}catch(E){g(E,m);return}Promise.resolve(M).then(o).catch(function(E){g(E,m)})}l.attempt(y)}return new Promise(e)}i.exports=u}),vy=gt((t,i)=>{lt(),function(){var r="input is invalid type",u="finalize already called",a=typeof window=="object",s=a?window:{};s.JS_SHA3_NO_WINDOW&&(a=!1);var e=!a&&typeof self=="object",o=!s.JS_SHA3_NO_NODE_JS&&typeof Jt.default=="object"&&Jt.default.versions&&Jt.default.versions.node;o?s=le:e&&(s=self);var c=!s.JS_SHA3_NO_COMMON_JS&&typeof i=="object"&&i.exports,f=typeof define=="function"&&define.amd,l=!s.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),g=[31,7936,2031616,520093696],y=[4,1024,262144,67108864],m=[1,256,65536,16777216],M=[6,1536,393216,100663296],E=[0,8,16,24],B=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],x=[224,256,384,512],C=[128,256],N=["hex","buffer","arrayBuffer","array","digest"],F={128:168,256:136};(s.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(et){return Object.prototype.toString.call(et)==="[object Array]"}),l&&(s.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(et){return typeof et=="object"&&et.buffer&&et.buffer.constructor===ArrayBuffer});for(var I=function(et,at,$){return function(J){return new tt(et,at,et).update(J)[$]()}},U=function(et,at,$){return function(J,R){return new tt(et,at,R).update(J)[$]()}},P=function(et,at,$){return function(J,R,j,z){return v["cshake"+et].update(J,R,j,z)[$]()}},D=function(et,at,$){return function(J,R,j,z){return v["kmac"+et].update(J,R,j,z)[$]()}},W=function(et,at,$,J){for(var R=0;R>5,this.byteCount=this.blockCount<<2,this.outputBlocks=$>>5,this.extraBytes=($&31)>>3;for(var J=0;J<50;++J)this.s[J]=0}tt.prototype.update=function(et){if(this.finalized)throw new Error(u);var at,$=typeof et;if($!=="string"){if($==="object"){if(et===null)throw new Error(r);if(l&&et.constructor===ArrayBuffer)et=new Uint8Array(et);else if(!Array.isArray(et)&&(!l||!ArrayBuffer.isView(et)))throw new Error(r)}else throw new Error(r);at=!0}for(var J=this.blocks,R=this.byteCount,j=et.length,z=this.blockCount,Z=0,Q=this.s,K,G;Z>2]|=et[Z]<>2]|=G<>2]|=(192|G>>6)<>2]|=(128|G&63)<=57344?(J[K>>2]|=(224|G>>12)<>2]|=(128|G>>6&63)<>2]|=(128|G&63)<>2]|=(240|G>>18)<>2]|=(128|G>>12&63)<>2]|=(128|G>>6&63)<>2]|=(128|G&63)<=R){for(this.start=K-R,this.block=J[z],K=0;K>8,$=et&255;$>0;)R.unshift($),et=et>>8,$=et&255,++J;return at?R.push(J):R.unshift(J),this.update(R),R.length},tt.prototype.encodeString=function(et){var at,$=typeof et;if($!=="string"){if($==="object"){if(et===null)throw new Error(r);if(l&&et.constructor===ArrayBuffer)et=new Uint8Array(et);else if(!Array.isArray(et)&&(!l||!ArrayBuffer.isView(et)))throw new Error(r)}else throw new Error(r);at=!0}var J=0,R=et.length;if(at)J=R;else for(var j=0;j=57344?J+=3:(z=65536+((z&1023)<<10|et.charCodeAt(++j)&1023),J+=4)}return J+=this.encode(J*8),this.update(et),J},tt.prototype.bytepad=function(et,at){for(var $=this.encode(at),J=0;J>2]|=this.padding[at&3],this.lastByteIndex===this.byteCount)for(et[0]=et[$],at=1;at<$+1;++at)et[at]=0;for(et[$-1]|=2147483648,at=0;at<$;++at)J[at]^=et[at];ft(J)}},tt.prototype.toString=tt.prototype.hex=function(){this.finalize();for(var et=this.blockCount,at=this.s,$=this.outputBlocks,J=this.extraBytes,R=0,j=0,z="",Z;j<$;){for(R=0;R>4&15]+p[Z&15]+p[Z>>12&15]+p[Z>>8&15]+p[Z>>20&15]+p[Z>>16&15]+p[Z>>28&15]+p[Z>>24&15];j%et===0&&(ft(at),R=0)}return J&&(Z=at[R],z+=p[Z>>4&15]+p[Z&15],J>1&&(z+=p[Z>>12&15]+p[Z>>8&15]),J>2&&(z+=p[Z>>20&15]+p[Z>>16&15])),z},tt.prototype.arrayBuffer=function(){this.finalize();var et=this.blockCount,at=this.s,$=this.outputBlocks,J=this.extraBytes,R=0,j=0,z=this.outputBits>>3,Z;J?Z=new ArrayBuffer($+1<<2):Z=new ArrayBuffer(z);for(var Q=new Uint32Array(Z);j<$;){for(R=0;R>8&255,z[Z+2]=Q>>16&255,z[Z+3]=Q>>24&255;j%et===0&&ft(at)}return J&&(Z=j<<2,Q=at[R],z[Z]=Q&255,J>1&&(z[Z+1]=Q>>8&255),J>2&&(z[Z+2]=Q>>16&255)),z};function X(et,at,$){tt.call(this,et,at,$)}X.prototype=new tt,X.prototype.finalize=function(){return this.encode(this.outputBits,!0),tt.prototype.finalize.call(this)};var ft=function(et){var at,$,J,R,j,z,Z,Q,K,G,H,Y,it,ot,mt,_t,ht,vt,pt,V,rt,st,yt,Ct,dt,Mt,Lt,wt,ct,Et,ut,Ot,qt,nt,Rt,Dt,bt,Tt,jt,St,kt,Kt,At,Nt,$t,Ft,Wt,ae,Xt,Gt,he,Qt,Zt,se,te,re,Se,Be,Re,Te,xe,Ce,Ue;for(J=0;J<48;J+=2)R=et[0]^et[10]^et[20]^et[30]^et[40],j=et[1]^et[11]^et[21]^et[31]^et[41],z=et[2]^et[12]^et[22]^et[32]^et[42],Z=et[3]^et[13]^et[23]^et[33]^et[43],Q=et[4]^et[14]^et[24]^et[34]^et[44],K=et[5]^et[15]^et[25]^et[35]^et[45],G=et[6]^et[16]^et[26]^et[36]^et[46],H=et[7]^et[17]^et[27]^et[37]^et[47],Y=et[8]^et[18]^et[28]^et[38]^et[48],it=et[9]^et[19]^et[29]^et[39]^et[49],at=Y^(z<<1|Z>>>31),$=it^(Z<<1|z>>>31),et[0]^=at,et[1]^=$,et[10]^=at,et[11]^=$,et[20]^=at,et[21]^=$,et[30]^=at,et[31]^=$,et[40]^=at,et[41]^=$,at=R^(Q<<1|K>>>31),$=j^(K<<1|Q>>>31),et[2]^=at,et[3]^=$,et[12]^=at,et[13]^=$,et[22]^=at,et[23]^=$,et[32]^=at,et[33]^=$,et[42]^=at,et[43]^=$,at=z^(G<<1|H>>>31),$=Z^(H<<1|G>>>31),et[4]^=at,et[5]^=$,et[14]^=at,et[15]^=$,et[24]^=at,et[25]^=$,et[34]^=at,et[35]^=$,et[44]^=at,et[45]^=$,at=Q^(Y<<1|it>>>31),$=K^(it<<1|Y>>>31),et[6]^=at,et[7]^=$,et[16]^=at,et[17]^=$,et[26]^=at,et[27]^=$,et[36]^=at,et[37]^=$,et[46]^=at,et[47]^=$,at=G^(R<<1|j>>>31),$=H^(j<<1|R>>>31),et[8]^=at,et[9]^=$,et[18]^=at,et[19]^=$,et[28]^=at,et[29]^=$,et[38]^=at,et[39]^=$,et[48]^=at,et[49]^=$,ot=et[0],mt=et[1],Ft=et[11]<<4|et[10]>>>28,Wt=et[10]<<4|et[11]>>>28,wt=et[20]<<3|et[21]>>>29,ct=et[21]<<3|et[20]>>>29,Te=et[31]<<9|et[30]>>>23,xe=et[30]<<9|et[31]>>>23,Kt=et[40]<<18|et[41]>>>14,At=et[41]<<18|et[40]>>>14,nt=et[2]<<1|et[3]>>>31,Rt=et[3]<<1|et[2]>>>31,_t=et[13]<<12|et[12]>>>20,ht=et[12]<<12|et[13]>>>20,ae=et[22]<<10|et[23]>>>22,Xt=et[23]<<10|et[22]>>>22,Et=et[33]<<13|et[32]>>>19,ut=et[32]<<13|et[33]>>>19,Ce=et[42]<<2|et[43]>>>30,Ue=et[43]<<2|et[42]>>>30,se=et[5]<<30|et[4]>>>2,te=et[4]<<30|et[5]>>>2,Dt=et[14]<<6|et[15]>>>26,bt=et[15]<<6|et[14]>>>26,vt=et[25]<<11|et[24]>>>21,pt=et[24]<<11|et[25]>>>21,Gt=et[34]<<15|et[35]>>>17,he=et[35]<<15|et[34]>>>17,Ot=et[45]<<29|et[44]>>>3,qt=et[44]<<29|et[45]>>>3,Ct=et[6]<<28|et[7]>>>4,dt=et[7]<<28|et[6]>>>4,re=et[17]<<23|et[16]>>>9,Se=et[16]<<23|et[17]>>>9,Tt=et[26]<<25|et[27]>>>7,jt=et[27]<<25|et[26]>>>7,V=et[36]<<21|et[37]>>>11,rt=et[37]<<21|et[36]>>>11,Qt=et[47]<<24|et[46]>>>8,Zt=et[46]<<24|et[47]>>>8,Nt=et[8]<<27|et[9]>>>5,$t=et[9]<<27|et[8]>>>5,Mt=et[18]<<20|et[19]>>>12,Lt=et[19]<<20|et[18]>>>12,Be=et[29]<<7|et[28]>>>25,Re=et[28]<<7|et[29]>>>25,St=et[38]<<8|et[39]>>>24,kt=et[39]<<8|et[38]>>>24,st=et[48]<<14|et[49]>>>18,yt=et[49]<<14|et[48]>>>18,et[0]=ot^~_t&vt,et[1]=mt^~ht&pt,et[10]=Ct^~Mt&wt,et[11]=dt^~Lt&ct,et[20]=nt^~Dt&Tt,et[21]=Rt^~bt&jt,et[30]=Nt^~Ft&ae,et[31]=$t^~Wt&Xt,et[40]=se^~re&Be,et[41]=te^~Se&Re,et[2]=_t^~vt&V,et[3]=ht^~pt&rt,et[12]=Mt^~wt&Et,et[13]=Lt^~ct&ut,et[22]=Dt^~Tt&St,et[23]=bt^~jt&kt,et[32]=Ft^~ae&Gt,et[33]=Wt^~Xt&he,et[42]=re^~Be&Te,et[43]=Se^~Re&xe,et[4]=vt^~V&st,et[5]=pt^~rt&yt,et[14]=wt^~Et&Ot,et[15]=ct^~ut&qt,et[24]=Tt^~St&Kt,et[25]=jt^~kt&At,et[34]=ae^~Gt&Qt,et[35]=Xt^~he&Zt,et[44]=Be^~Te&Ce,et[45]=Re^~xe&Ue,et[6]=V^~st&ot,et[7]=rt^~yt&mt,et[16]=Et^~Ot&Ct,et[17]=ut^~qt&dt,et[26]=St^~Kt&nt,et[27]=kt^~At&Rt,et[36]=Gt^~Qt&Nt,et[37]=he^~Zt&$t,et[46]=Te^~Ce&se,et[47]=xe^~Ue&te,et[8]=st^~ot&_t,et[9]=yt^~mt&ht,et[18]=Ot^~Ct&Mt,et[19]=qt^~dt&Lt,et[28]=Kt^~nt&Dt,et[29]=At^~Rt&bt,et[38]=Qt^~Nt&Ft,et[39]=Zt^~$t&Wt,et[48]=Ce^~se&re,et[49]=Ue^~te&Se,et[0]^=B[J],et[1]^=B[J+1]};if(c)i.exports=v;else{for(T=0;T{lt(),function(r,u){function a(n,d){if(!n)throw new Error(d||"Assertion failed")}function s(n,d){n.super_=d;var v=function(){};v.prototype=d.prototype,n.prototype=new v,n.prototype.constructor=n}function e(n,d,v){if(e.isBN(n))return n;this.negative=0,this.words=null,this.length=0,this.red=null,n!==null&&((d==="le"||d==="be")&&(v=d,d=10),this._init(n||0,d||10,v||"be"))}typeof r=="object"?r.exports=e:u.BN=e,e.BN=e,e.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=$e().Buffer}catch{}e.isBN=function(n){return n instanceof e?!0:n!==null&&typeof n=="object"&&n.constructor.wordSize===e.wordSize&&Array.isArray(n.words)},e.max=function(n,d){return n.cmp(d)>0?n:d},e.min=function(n,d){return n.cmp(d)<0?n:d},e.prototype._init=function(n,d,v){if(typeof n=="number")return this._initNumber(n,d,v);if(typeof n=="object")return this._initArray(n,d,v);d==="hex"&&(d=16),a(d===(d|0)&&d>=2&&d<=36),n=n.toString().replace(/\s+/g,"");var A=0;n[0]==="-"&&(A++,this.negative=1),A=0;A-=3)S=n[A]|n[A-1]<<8|n[A-2]<<16,this.words[T]|=S<>>26-w&67108863,w+=24,w>=26&&(w-=26,T++);else if(v==="le")for(A=0,T=0;A>>26-w&67108863,w+=24,w>=26&&(w-=26,T++);return this._strip()};function c(n,d){var v=n.charCodeAt(d);if(v>=48&&v<=57)return v-48;if(v>=65&&v<=70)return v-55;if(v>=97&&v<=102)return v-87;a(!1,"Invalid character in "+n)}function f(n,d,v){var A=c(n,v);return v-1>=d&&(A|=c(n,v-1)<<4),A}e.prototype._parseHex=function(n,d,v){this.length=Math.ceil((n.length-d)/6),this.words=new Array(this.length);for(var A=0;A=d;A-=2)w=f(n,d,A)<=18?(T-=18,S+=1,this.words[S]|=w>>>26):T+=8;else{var b=n.length-d;for(A=b%2===0?d+1:d;A=18?(T-=18,S+=1,this.words[S]|=w>>>26):T+=8}this._strip()};function l(n,d,v,A){for(var T=0,S=0,w=Math.min(n.length,v),b=d;b=49?S=h-49+10:h>=17?S=h-17+10:S=h,a(h>=0&&S1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},e.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{e.prototype[Symbol.for("nodejs.util.inspect.custom")]=g}catch{e.prototype.inspect=g}else e.prototype.inspect=g;function g(){return(this.red?""}var y=["","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],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];e.prototype.toString=function(n,d){n=n||10,d=d|0||1;var v;if(n===16||n==="hex"){v="";for(var A=0,T=0,S=0;S>>24-A&16777215,A+=2,A>=26&&(A-=26,S--),T!==0||S!==this.length-1?v=y[6-b.length]+b+v:v=b+v}for(T!==0&&(v=T.toString(16)+v);v.length%d!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(n===(n|0)&&n>=2&&n<=36){var h=m[n],k=M[n];v="";var tt=this.clone();for(tt.negative=0;!tt.isZero();){var X=tt.modrn(k).toString(n);tt=tt.idivn(k),tt.isZero()?v=X+v:v=y[h-X.length]+X+v}for(this.isZero()&&(v="0"+v);v.length%d!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}a(!1,"Base should be between 2 and 36")},e.prototype.toNumber=function(){var n=this.words[0];return this.length===2?n+=this.words[1]*67108864:this.length===3&&this.words[2]===1?n+=4503599627370496+this.words[1]*67108864:this.length>2&&a(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-n:n},e.prototype.toJSON=function(){return this.toString(16,2)},o&&(e.prototype.toBuffer=function(n,d){return this.toArrayLike(o,n,d)}),e.prototype.toArray=function(n,d){return this.toArrayLike(Array,n,d)};var E=function(n,d){return n.allocUnsafe?n.allocUnsafe(d):new n(d)};e.prototype.toArrayLike=function(n,d,v){this._strip();var A=this.byteLength(),T=v||Math.max(1,A);a(A<=T,"byte array longer than desired length"),a(T>0,"Requested array length <= 0");var S=E(n,T),w=d==="le"?"LE":"BE";return this["_toArrayLike"+w](S,A),S},e.prototype._toArrayLikeLE=function(n,d){for(var v=0,A=0,T=0,S=0;T>8&255),v>16&255),S===6?(v>24&255),A=0,S=0):(A=w>>>24,S+=2)}if(v=0&&(n[v--]=w>>8&255),v>=0&&(n[v--]=w>>16&255),S===6?(v>=0&&(n[v--]=w>>24&255),A=0,S=0):(A=w>>>24,S+=2)}if(v>=0)for(n[v--]=A;v>=0;)n[v--]=0},Math.clz32?e.prototype._countBits=function(n){return 32-Math.clz32(n)}:e.prototype._countBits=function(n){var d=n,v=0;return d>=4096&&(v+=13,d>>>=13),d>=64&&(v+=7,d>>>=7),d>=8&&(v+=4,d>>>=4),d>=2&&(v+=2,d>>>=2),v+d},e.prototype._zeroBits=function(n){if(n===0)return 26;var d=n,v=0;return!(d&8191)&&(v+=13,d>>>=13),!(d&127)&&(v+=7,d>>>=7),!(d&15)&&(v+=4,d>>>=4),!(d&3)&&(v+=2,d>>>=2),!(d&1)&&v++,v},e.prototype.bitLength=function(){var n=this.words[this.length-1],d=this._countBits(n);return(this.length-1)*26+d};function B(n){for(var d=new Array(n.bitLength()),v=0;v>>T&1}return d}e.prototype.zeroBits=function(){if(this.isZero())return 0;for(var n=0,d=0;dn.length?this.clone().ior(n):n.clone().ior(this)},e.prototype.uor=function(n){return this.length>n.length?this.clone().iuor(n):n.clone().iuor(this)},e.prototype.iuand=function(n){var d;this.length>n.length?d=n:d=this;for(var v=0;vn.length?this.clone().iand(n):n.clone().iand(this)},e.prototype.uand=function(n){return this.length>n.length?this.clone().iuand(n):n.clone().iuand(this)},e.prototype.iuxor=function(n){var d,v;this.length>n.length?(d=this,v=n):(d=n,v=this);for(var A=0;An.length?this.clone().ixor(n):n.clone().ixor(this)},e.prototype.uxor=function(n){return this.length>n.length?this.clone().iuxor(n):n.clone().iuxor(this)},e.prototype.inotn=function(n){a(typeof n=="number"&&n>=0);var d=Math.ceil(n/26)|0,v=n%26;this._expand(d),v>0&&d--;for(var A=0;A0&&(this.words[A]=~this.words[A]&67108863>>26-v),this._strip()},e.prototype.notn=function(n){return this.clone().inotn(n)},e.prototype.setn=function(n,d){a(typeof n=="number"&&n>=0);var v=n/26|0,A=n%26;return this._expand(v+1),d?this.words[v]=this.words[v]|1<n.length?(v=this,A=n):(v=n,A=this);for(var T=0,S=0;S>>26;for(;T!==0&&S>>26;if(this.length=v.length,T!==0)this.words[this.length]=T,this.length++;else if(v!==this)for(;Sn.length?this.clone().iadd(n):n.clone().iadd(this)},e.prototype.isub=function(n){if(n.negative!==0){n.negative=0;var d=this.iadd(n);return n.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(n),this.negative=1,this._normSign();var v=this.cmp(n);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var A,T;v>0?(A=this,T=n):(A=n,T=this);for(var S=0,w=0;w>26,this.words[w]=d&67108863;for(;S!==0&&w>26,this.words[w]=d&67108863;if(S===0&&w>>26,X=h&67108863,ft=Math.min(k,d.length-1),et=Math.max(0,k-n.length+1);et<=ft;et++){var at=k-et|0;T=n.words[at]|0,S=d.words[et]|0,w=T*S+X,tt+=w/67108864|0,X=w&67108863}v.words[k]=X|0,h=tt|0}return h!==0?v.words[k]=h|0:v.length--,v._strip()}var C=function(n,d,v){var A=n.words,T=d.words,S=v.words,w=0,b,h,k,tt=A[0]|0,X=tt&8191,ft=tt>>>13,et=A[1]|0,at=et&8191,$=et>>>13,J=A[2]|0,R=J&8191,j=J>>>13,z=A[3]|0,Z=z&8191,Q=z>>>13,K=A[4]|0,G=K&8191,H=K>>>13,Y=A[5]|0,it=Y&8191,ot=Y>>>13,mt=A[6]|0,_t=mt&8191,ht=mt>>>13,vt=A[7]|0,pt=vt&8191,V=vt>>>13,rt=A[8]|0,st=rt&8191,yt=rt>>>13,Ct=A[9]|0,dt=Ct&8191,Mt=Ct>>>13,Lt=T[0]|0,wt=Lt&8191,ct=Lt>>>13,Et=T[1]|0,ut=Et&8191,Ot=Et>>>13,qt=T[2]|0,nt=qt&8191,Rt=qt>>>13,Dt=T[3]|0,bt=Dt&8191,Tt=Dt>>>13,jt=T[4]|0,St=jt&8191,kt=jt>>>13,Kt=T[5]|0,At=Kt&8191,Nt=Kt>>>13,$t=T[6]|0,Ft=$t&8191,Wt=$t>>>13,ae=T[7]|0,Xt=ae&8191,Gt=ae>>>13,he=T[8]|0,Qt=he&8191,Zt=he>>>13,se=T[9]|0,te=se&8191,re=se>>>13;v.negative=n.negative^d.negative,v.length=19,b=Math.imul(X,wt),h=Math.imul(X,ct),h=h+Math.imul(ft,wt)|0,k=Math.imul(ft,ct);var Se=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Se>>>26)|0,Se&=67108863,b=Math.imul(at,wt),h=Math.imul(at,ct),h=h+Math.imul($,wt)|0,k=Math.imul($,ct),b=b+Math.imul(X,ut)|0,h=h+Math.imul(X,Ot)|0,h=h+Math.imul(ft,ut)|0,k=k+Math.imul(ft,Ot)|0;var Be=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Be>>>26)|0,Be&=67108863,b=Math.imul(R,wt),h=Math.imul(R,ct),h=h+Math.imul(j,wt)|0,k=Math.imul(j,ct),b=b+Math.imul(at,ut)|0,h=h+Math.imul(at,Ot)|0,h=h+Math.imul($,ut)|0,k=k+Math.imul($,Ot)|0,b=b+Math.imul(X,nt)|0,h=h+Math.imul(X,Rt)|0,h=h+Math.imul(ft,nt)|0,k=k+Math.imul(ft,Rt)|0;var Re=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Re>>>26)|0,Re&=67108863,b=Math.imul(Z,wt),h=Math.imul(Z,ct),h=h+Math.imul(Q,wt)|0,k=Math.imul(Q,ct),b=b+Math.imul(R,ut)|0,h=h+Math.imul(R,Ot)|0,h=h+Math.imul(j,ut)|0,k=k+Math.imul(j,Ot)|0,b=b+Math.imul(at,nt)|0,h=h+Math.imul(at,Rt)|0,h=h+Math.imul($,nt)|0,k=k+Math.imul($,Rt)|0,b=b+Math.imul(X,bt)|0,h=h+Math.imul(X,Tt)|0,h=h+Math.imul(ft,bt)|0,k=k+Math.imul(ft,Tt)|0;var Te=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Te>>>26)|0,Te&=67108863,b=Math.imul(G,wt),h=Math.imul(G,ct),h=h+Math.imul(H,wt)|0,k=Math.imul(H,ct),b=b+Math.imul(Z,ut)|0,h=h+Math.imul(Z,Ot)|0,h=h+Math.imul(Q,ut)|0,k=k+Math.imul(Q,Ot)|0,b=b+Math.imul(R,nt)|0,h=h+Math.imul(R,Rt)|0,h=h+Math.imul(j,nt)|0,k=k+Math.imul(j,Rt)|0,b=b+Math.imul(at,bt)|0,h=h+Math.imul(at,Tt)|0,h=h+Math.imul($,bt)|0,k=k+Math.imul($,Tt)|0,b=b+Math.imul(X,St)|0,h=h+Math.imul(X,kt)|0,h=h+Math.imul(ft,St)|0,k=k+Math.imul(ft,kt)|0;var xe=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(xe>>>26)|0,xe&=67108863,b=Math.imul(it,wt),h=Math.imul(it,ct),h=h+Math.imul(ot,wt)|0,k=Math.imul(ot,ct),b=b+Math.imul(G,ut)|0,h=h+Math.imul(G,Ot)|0,h=h+Math.imul(H,ut)|0,k=k+Math.imul(H,Ot)|0,b=b+Math.imul(Z,nt)|0,h=h+Math.imul(Z,Rt)|0,h=h+Math.imul(Q,nt)|0,k=k+Math.imul(Q,Rt)|0,b=b+Math.imul(R,bt)|0,h=h+Math.imul(R,Tt)|0,h=h+Math.imul(j,bt)|0,k=k+Math.imul(j,Tt)|0,b=b+Math.imul(at,St)|0,h=h+Math.imul(at,kt)|0,h=h+Math.imul($,St)|0,k=k+Math.imul($,kt)|0,b=b+Math.imul(X,At)|0,h=h+Math.imul(X,Nt)|0,h=h+Math.imul(ft,At)|0,k=k+Math.imul(ft,Nt)|0;var Ce=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,b=Math.imul(_t,wt),h=Math.imul(_t,ct),h=h+Math.imul(ht,wt)|0,k=Math.imul(ht,ct),b=b+Math.imul(it,ut)|0,h=h+Math.imul(it,Ot)|0,h=h+Math.imul(ot,ut)|0,k=k+Math.imul(ot,Ot)|0,b=b+Math.imul(G,nt)|0,h=h+Math.imul(G,Rt)|0,h=h+Math.imul(H,nt)|0,k=k+Math.imul(H,Rt)|0,b=b+Math.imul(Z,bt)|0,h=h+Math.imul(Z,Tt)|0,h=h+Math.imul(Q,bt)|0,k=k+Math.imul(Q,Tt)|0,b=b+Math.imul(R,St)|0,h=h+Math.imul(R,kt)|0,h=h+Math.imul(j,St)|0,k=k+Math.imul(j,kt)|0,b=b+Math.imul(at,At)|0,h=h+Math.imul(at,Nt)|0,h=h+Math.imul($,At)|0,k=k+Math.imul($,Nt)|0,b=b+Math.imul(X,Ft)|0,h=h+Math.imul(X,Wt)|0,h=h+Math.imul(ft,Ft)|0,k=k+Math.imul(ft,Wt)|0;var Ue=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,b=Math.imul(pt,wt),h=Math.imul(pt,ct),h=h+Math.imul(V,wt)|0,k=Math.imul(V,ct),b=b+Math.imul(_t,ut)|0,h=h+Math.imul(_t,Ot)|0,h=h+Math.imul(ht,ut)|0,k=k+Math.imul(ht,Ot)|0,b=b+Math.imul(it,nt)|0,h=h+Math.imul(it,Rt)|0,h=h+Math.imul(ot,nt)|0,k=k+Math.imul(ot,Rt)|0,b=b+Math.imul(G,bt)|0,h=h+Math.imul(G,Tt)|0,h=h+Math.imul(H,bt)|0,k=k+Math.imul(H,Tt)|0,b=b+Math.imul(Z,St)|0,h=h+Math.imul(Z,kt)|0,h=h+Math.imul(Q,St)|0,k=k+Math.imul(Q,kt)|0,b=b+Math.imul(R,At)|0,h=h+Math.imul(R,Nt)|0,h=h+Math.imul(j,At)|0,k=k+Math.imul(j,Nt)|0,b=b+Math.imul(at,Ft)|0,h=h+Math.imul(at,Wt)|0,h=h+Math.imul($,Ft)|0,k=k+Math.imul($,Wt)|0,b=b+Math.imul(X,Xt)|0,h=h+Math.imul(X,Gt)|0,h=h+Math.imul(ft,Xt)|0,k=k+Math.imul(ft,Gt)|0;var Ke=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,b=Math.imul(st,wt),h=Math.imul(st,ct),h=h+Math.imul(yt,wt)|0,k=Math.imul(yt,ct),b=b+Math.imul(pt,ut)|0,h=h+Math.imul(pt,Ot)|0,h=h+Math.imul(V,ut)|0,k=k+Math.imul(V,Ot)|0,b=b+Math.imul(_t,nt)|0,h=h+Math.imul(_t,Rt)|0,h=h+Math.imul(ht,nt)|0,k=k+Math.imul(ht,Rt)|0,b=b+Math.imul(it,bt)|0,h=h+Math.imul(it,Tt)|0,h=h+Math.imul(ot,bt)|0,k=k+Math.imul(ot,Tt)|0,b=b+Math.imul(G,St)|0,h=h+Math.imul(G,kt)|0,h=h+Math.imul(H,St)|0,k=k+Math.imul(H,kt)|0,b=b+Math.imul(Z,At)|0,h=h+Math.imul(Z,Nt)|0,h=h+Math.imul(Q,At)|0,k=k+Math.imul(Q,Nt)|0,b=b+Math.imul(R,Ft)|0,h=h+Math.imul(R,Wt)|0,h=h+Math.imul(j,Ft)|0,k=k+Math.imul(j,Wt)|0,b=b+Math.imul(at,Xt)|0,h=h+Math.imul(at,Gt)|0,h=h+Math.imul($,Xt)|0,k=k+Math.imul($,Gt)|0,b=b+Math.imul(X,Qt)|0,h=h+Math.imul(X,Zt)|0,h=h+Math.imul(ft,Qt)|0,k=k+Math.imul(ft,Zt)|0;var Je=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Je>>>26)|0,Je&=67108863,b=Math.imul(dt,wt),h=Math.imul(dt,ct),h=h+Math.imul(Mt,wt)|0,k=Math.imul(Mt,ct),b=b+Math.imul(st,ut)|0,h=h+Math.imul(st,Ot)|0,h=h+Math.imul(yt,ut)|0,k=k+Math.imul(yt,Ot)|0,b=b+Math.imul(pt,nt)|0,h=h+Math.imul(pt,Rt)|0,h=h+Math.imul(V,nt)|0,k=k+Math.imul(V,Rt)|0,b=b+Math.imul(_t,bt)|0,h=h+Math.imul(_t,Tt)|0,h=h+Math.imul(ht,bt)|0,k=k+Math.imul(ht,Tt)|0,b=b+Math.imul(it,St)|0,h=h+Math.imul(it,kt)|0,h=h+Math.imul(ot,St)|0,k=k+Math.imul(ot,kt)|0,b=b+Math.imul(G,At)|0,h=h+Math.imul(G,Nt)|0,h=h+Math.imul(H,At)|0,k=k+Math.imul(H,Nt)|0,b=b+Math.imul(Z,Ft)|0,h=h+Math.imul(Z,Wt)|0,h=h+Math.imul(Q,Ft)|0,k=k+Math.imul(Q,Wt)|0,b=b+Math.imul(R,Xt)|0,h=h+Math.imul(R,Gt)|0,h=h+Math.imul(j,Xt)|0,k=k+Math.imul(j,Gt)|0,b=b+Math.imul(at,Qt)|0,h=h+Math.imul(at,Zt)|0,h=h+Math.imul($,Qt)|0,k=k+Math.imul($,Zt)|0,b=b+Math.imul(X,te)|0,h=h+Math.imul(X,re)|0,h=h+Math.imul(ft,te)|0,k=k+Math.imul(ft,re)|0;var ze=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(ze>>>26)|0,ze&=67108863,b=Math.imul(dt,ut),h=Math.imul(dt,Ot),h=h+Math.imul(Mt,ut)|0,k=Math.imul(Mt,Ot),b=b+Math.imul(st,nt)|0,h=h+Math.imul(st,Rt)|0,h=h+Math.imul(yt,nt)|0,k=k+Math.imul(yt,Rt)|0,b=b+Math.imul(pt,bt)|0,h=h+Math.imul(pt,Tt)|0,h=h+Math.imul(V,bt)|0,k=k+Math.imul(V,Tt)|0,b=b+Math.imul(_t,St)|0,h=h+Math.imul(_t,kt)|0,h=h+Math.imul(ht,St)|0,k=k+Math.imul(ht,kt)|0,b=b+Math.imul(it,At)|0,h=h+Math.imul(it,Nt)|0,h=h+Math.imul(ot,At)|0,k=k+Math.imul(ot,Nt)|0,b=b+Math.imul(G,Ft)|0,h=h+Math.imul(G,Wt)|0,h=h+Math.imul(H,Ft)|0,k=k+Math.imul(H,Wt)|0,b=b+Math.imul(Z,Xt)|0,h=h+Math.imul(Z,Gt)|0,h=h+Math.imul(Q,Xt)|0,k=k+Math.imul(Q,Gt)|0,b=b+Math.imul(R,Qt)|0,h=h+Math.imul(R,Zt)|0,h=h+Math.imul(j,Qt)|0,k=k+Math.imul(j,Zt)|0,b=b+Math.imul(at,te)|0,h=h+Math.imul(at,re)|0,h=h+Math.imul($,te)|0,k=k+Math.imul($,re)|0;var Xe=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,b=Math.imul(dt,nt),h=Math.imul(dt,Rt),h=h+Math.imul(Mt,nt)|0,k=Math.imul(Mt,Rt),b=b+Math.imul(st,bt)|0,h=h+Math.imul(st,Tt)|0,h=h+Math.imul(yt,bt)|0,k=k+Math.imul(yt,Tt)|0,b=b+Math.imul(pt,St)|0,h=h+Math.imul(pt,kt)|0,h=h+Math.imul(V,St)|0,k=k+Math.imul(V,kt)|0,b=b+Math.imul(_t,At)|0,h=h+Math.imul(_t,Nt)|0,h=h+Math.imul(ht,At)|0,k=k+Math.imul(ht,Nt)|0,b=b+Math.imul(it,Ft)|0,h=h+Math.imul(it,Wt)|0,h=h+Math.imul(ot,Ft)|0,k=k+Math.imul(ot,Wt)|0,b=b+Math.imul(G,Xt)|0,h=h+Math.imul(G,Gt)|0,h=h+Math.imul(H,Xt)|0,k=k+Math.imul(H,Gt)|0,b=b+Math.imul(Z,Qt)|0,h=h+Math.imul(Z,Zt)|0,h=h+Math.imul(Q,Qt)|0,k=k+Math.imul(Q,Zt)|0,b=b+Math.imul(R,te)|0,h=h+Math.imul(R,re)|0,h=h+Math.imul(j,te)|0,k=k+Math.imul(j,re)|0;var Ge=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,b=Math.imul(dt,bt),h=Math.imul(dt,Tt),h=h+Math.imul(Mt,bt)|0,k=Math.imul(Mt,Tt),b=b+Math.imul(st,St)|0,h=h+Math.imul(st,kt)|0,h=h+Math.imul(yt,St)|0,k=k+Math.imul(yt,kt)|0,b=b+Math.imul(pt,At)|0,h=h+Math.imul(pt,Nt)|0,h=h+Math.imul(V,At)|0,k=k+Math.imul(V,Nt)|0,b=b+Math.imul(_t,Ft)|0,h=h+Math.imul(_t,Wt)|0,h=h+Math.imul(ht,Ft)|0,k=k+Math.imul(ht,Wt)|0,b=b+Math.imul(it,Xt)|0,h=h+Math.imul(it,Gt)|0,h=h+Math.imul(ot,Xt)|0,k=k+Math.imul(ot,Gt)|0,b=b+Math.imul(G,Qt)|0,h=h+Math.imul(G,Zt)|0,h=h+Math.imul(H,Qt)|0,k=k+Math.imul(H,Zt)|0,b=b+Math.imul(Z,te)|0,h=h+Math.imul(Z,re)|0,h=h+Math.imul(Q,te)|0,k=k+Math.imul(Q,re)|0;var Ye=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,b=Math.imul(dt,St),h=Math.imul(dt,kt),h=h+Math.imul(Mt,St)|0,k=Math.imul(Mt,kt),b=b+Math.imul(st,At)|0,h=h+Math.imul(st,Nt)|0,h=h+Math.imul(yt,At)|0,k=k+Math.imul(yt,Nt)|0,b=b+Math.imul(pt,Ft)|0,h=h+Math.imul(pt,Wt)|0,h=h+Math.imul(V,Ft)|0,k=k+Math.imul(V,Wt)|0,b=b+Math.imul(_t,Xt)|0,h=h+Math.imul(_t,Gt)|0,h=h+Math.imul(ht,Xt)|0,k=k+Math.imul(ht,Gt)|0,b=b+Math.imul(it,Qt)|0,h=h+Math.imul(it,Zt)|0,h=h+Math.imul(ot,Qt)|0,k=k+Math.imul(ot,Zt)|0,b=b+Math.imul(G,te)|0,h=h+Math.imul(G,re)|0,h=h+Math.imul(H,te)|0,k=k+Math.imul(H,re)|0;var We=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(We>>>26)|0,We&=67108863,b=Math.imul(dt,At),h=Math.imul(dt,Nt),h=h+Math.imul(Mt,At)|0,k=Math.imul(Mt,Nt),b=b+Math.imul(st,Ft)|0,h=h+Math.imul(st,Wt)|0,h=h+Math.imul(yt,Ft)|0,k=k+Math.imul(yt,Wt)|0,b=b+Math.imul(pt,Xt)|0,h=h+Math.imul(pt,Gt)|0,h=h+Math.imul(V,Xt)|0,k=k+Math.imul(V,Gt)|0,b=b+Math.imul(_t,Qt)|0,h=h+Math.imul(_t,Zt)|0,h=h+Math.imul(ht,Qt)|0,k=k+Math.imul(ht,Zt)|0,b=b+Math.imul(it,te)|0,h=h+Math.imul(it,re)|0,h=h+Math.imul(ot,te)|0,k=k+Math.imul(ot,re)|0;var Ve=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,b=Math.imul(dt,Ft),h=Math.imul(dt,Wt),h=h+Math.imul(Mt,Ft)|0,k=Math.imul(Mt,Wt),b=b+Math.imul(st,Xt)|0,h=h+Math.imul(st,Gt)|0,h=h+Math.imul(yt,Xt)|0,k=k+Math.imul(yt,Gt)|0,b=b+Math.imul(pt,Qt)|0,h=h+Math.imul(pt,Zt)|0,h=h+Math.imul(V,Qt)|0,k=k+Math.imul(V,Zt)|0,b=b+Math.imul(_t,te)|0,h=h+Math.imul(_t,re)|0,h=h+Math.imul(ht,te)|0,k=k+Math.imul(ht,re)|0;var Ze=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,b=Math.imul(dt,Xt),h=Math.imul(dt,Gt),h=h+Math.imul(Mt,Xt)|0,k=Math.imul(Mt,Gt),b=b+Math.imul(st,Qt)|0,h=h+Math.imul(st,Zt)|0,h=h+Math.imul(yt,Qt)|0,k=k+Math.imul(yt,Zt)|0,b=b+Math.imul(pt,te)|0,h=h+Math.imul(pt,re)|0,h=h+Math.imul(V,te)|0,k=k+Math.imul(V,re)|0;var ar=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(ar>>>26)|0,ar&=67108863,b=Math.imul(dt,Qt),h=Math.imul(dt,Zt),h=h+Math.imul(Mt,Qt)|0,k=Math.imul(Mt,Zt),b=b+Math.imul(st,te)|0,h=h+Math.imul(st,re)|0,h=h+Math.imul(yt,te)|0,k=k+Math.imul(yt,re)|0;var br=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(br>>>26)|0,br&=67108863,b=Math.imul(dt,te),h=Math.imul(dt,re),h=h+Math.imul(Mt,te)|0,k=Math.imul(Mt,re);var cr=(w+b|0)+((h&8191)<<13)|0;return w=(k+(h>>>13)|0)+(cr>>>26)|0,cr&=67108863,S[0]=Se,S[1]=Be,S[2]=Re,S[3]=Te,S[4]=xe,S[5]=Ce,S[6]=Ue,S[7]=Ke,S[8]=Je,S[9]=ze,S[10]=Xe,S[11]=Ge,S[12]=Ye,S[13]=We,S[14]=Ve,S[15]=Ze,S[16]=ar,S[17]=br,S[18]=cr,w!==0&&(S[19]=w,v.length++),v};Math.imul||(C=x);function N(n,d,v){v.negative=d.negative^n.negative,v.length=n.length+d.length;for(var A=0,T=0,S=0;S>>26)|0,T+=w>>>26,w&=67108863}v.words[S]=b,A=w,w=T}return A!==0?v.words[S]=A:v.length--,v._strip()}function F(n,d,v){return N(n,d,v)}e.prototype.mulTo=function(n,d){var v,A=this.length+n.length;return this.length===10&&n.length===10?v=C(this,n,d):A<63?v=x(this,n,d):A<1024?v=N(this,n,d):v=F(this,n,d),v},e.prototype.mul=function(n){var d=new e(null);return d.words=new Array(this.length+n.length),this.mulTo(n,d)},e.prototype.mulf=function(n){var d=new e(null);return d.words=new Array(this.length+n.length),F(this,n,d)},e.prototype.imul=function(n){return this.clone().mulTo(n,this)},e.prototype.imuln=function(n){var d=n<0;d&&(n=-n),a(typeof n=="number"),a(n<67108864);for(var v=0,A=0;A>=26,v+=T/67108864|0,v+=S>>>26,this.words[A]=S&67108863}return v!==0&&(this.words[A]=v,this.length++),d?this.ineg():this},e.prototype.muln=function(n){return this.clone().imuln(n)},e.prototype.sqr=function(){return this.mul(this)},e.prototype.isqr=function(){return this.imul(this.clone())},e.prototype.pow=function(n){var d=B(n);if(d.length===0)return new e(1);for(var v=this,A=0;A=0);var d=n%26,v=(n-d)/26,A=67108863>>>26-d<<26-d,T;if(d!==0){var S=0;for(T=0;T>>26-d}S&&(this.words[T]=S,this.length++)}if(v!==0){for(T=this.length-1;T>=0;T--)this.words[T+v]=this.words[T];for(T=0;T=0);var A;d?A=(d-d%26)/26:A=0;var T=n%26,S=Math.min((n-T)/26,this.length),w=67108863^67108863>>>T<S)for(this.length-=S,h=0;h=0&&(k!==0||h>=A);h--){var tt=this.words[h]|0;this.words[h]=k<<26-T|tt>>>T,k=tt&w}return b&&k!==0&&(b.words[b.length++]=k),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},e.prototype.ishrn=function(n,d,v){return a(this.negative===0),this.iushrn(n,d,v)},e.prototype.shln=function(n){return this.clone().ishln(n)},e.prototype.ushln=function(n){return this.clone().iushln(n)},e.prototype.shrn=function(n){return this.clone().ishrn(n)},e.prototype.ushrn=function(n){return this.clone().iushrn(n)},e.prototype.testn=function(n){a(typeof n=="number"&&n>=0);var d=n%26,v=(n-d)/26,A=1<=0);var d=n%26,v=(n-d)/26;if(a(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(d!==0&&v++,this.length=Math.min(v,this.length),d!==0){var A=67108863^67108863>>>d<=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},e.prototype.isubn=function(n){if(a(typeof n=="number"),a(n<67108864),n<0)return this.iaddn(-n);if(this.negative!==0)return this.negative=0,this.iaddn(n),this.negative=1,this;if(this.words[0]-=n,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(b/67108864|0),this.words[T+v]=S&67108863}for(;T>26,this.words[T+v]=S&67108863;if(w===0)return this._strip();for(a(w===-1),w=0,T=0;T>26,this.words[T]=S&67108863;return this.negative=1,this._strip()},e.prototype._wordDiv=function(n,d){var v=this.length-n.length,A=this.clone(),T=n,S=T.words[T.length-1]|0,w=this._countBits(S);v=26-w,v!==0&&(T=T.ushln(v),A.iushln(v),S=T.words[T.length-1]|0);var b=A.length-T.length,h;if(d!=="mod"){h=new e(null),h.length=b+1,h.words=new Array(h.length);for(var k=0;k=0;X--){var ft=(A.words[T.length+X]|0)*67108864+(A.words[T.length+X-1]|0);for(ft=Math.min(ft/S|0,67108863),A._ishlnsubmul(T,ft,X);A.negative!==0;)ft--,A.negative=0,A._ishlnsubmul(T,1,X),A.isZero()||(A.negative^=1);h&&(h.words[X]=ft)}return h&&h._strip(),A._strip(),d!=="div"&&v!==0&&A.iushrn(v),{div:h||null,mod:A}},e.prototype.divmod=function(n,d,v){if(a(!n.isZero()),this.isZero())return{div:new e(0),mod:new e(0)};var A,T,S;return this.negative!==0&&n.negative===0?(S=this.neg().divmod(n,d),d!=="mod"&&(A=S.div.neg()),d!=="div"&&(T=S.mod.neg(),v&&T.negative!==0&&T.iadd(n)),{div:A,mod:T}):this.negative===0&&n.negative!==0?(S=this.divmod(n.neg(),d),d!=="mod"&&(A=S.div.neg()),{div:A,mod:S.mod}):this.negative&n.negative?(S=this.neg().divmod(n.neg(),d),d!=="div"&&(T=S.mod.neg(),v&&T.negative!==0&&T.isub(n)),{div:S.div,mod:T}):n.length>this.length||this.cmp(n)<0?{div:new e(0),mod:this}:n.length===1?d==="div"?{div:this.divn(n.words[0]),mod:null}:d==="mod"?{div:null,mod:new e(this.modrn(n.words[0]))}:{div:this.divn(n.words[0]),mod:new e(this.modrn(n.words[0]))}:this._wordDiv(n,d)},e.prototype.div=function(n){return this.divmod(n,"div",!1).div},e.prototype.mod=function(n){return this.divmod(n,"mod",!1).mod},e.prototype.umod=function(n){return this.divmod(n,"mod",!0).mod},e.prototype.divRound=function(n){var d=this.divmod(n);if(d.mod.isZero())return d.div;var v=d.div.negative!==0?d.mod.isub(n):d.mod,A=n.ushrn(1),T=n.andln(1),S=v.cmp(A);return S<0||T===1&&S===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},e.prototype.modrn=function(n){var d=n<0;d&&(n=-n),a(n<=67108863);for(var v=(1<<26)%n,A=0,T=this.length-1;T>=0;T--)A=(v*A+(this.words[T]|0))%n;return d?-A:A},e.prototype.modn=function(n){return this.modrn(n)},e.prototype.idivn=function(n){var d=n<0;d&&(n=-n),a(n<=67108863);for(var v=0,A=this.length-1;A>=0;A--){var T=(this.words[A]|0)+v*67108864;this.words[A]=T/n|0,v=T%n}return this._strip(),d?this.ineg():this},e.prototype.divn=function(n){return this.clone().idivn(n)},e.prototype.egcd=function(n){a(n.negative===0),a(!n.isZero());var d=this,v=n.clone();d.negative!==0?d=d.umod(n):d=d.clone();for(var A=new e(1),T=new e(0),S=new e(0),w=new e(1),b=0;d.isEven()&&v.isEven();)d.iushrn(1),v.iushrn(1),++b;for(var h=v.clone(),k=d.clone();!d.isZero();){for(var tt=0,X=1;!(d.words[0]&X)&&tt<26;++tt,X<<=1);if(tt>0)for(d.iushrn(tt);tt-- >0;)(A.isOdd()||T.isOdd())&&(A.iadd(h),T.isub(k)),A.iushrn(1),T.iushrn(1);for(var ft=0,et=1;!(v.words[0]&et)&&ft<26;++ft,et<<=1);if(ft>0)for(v.iushrn(ft);ft-- >0;)(S.isOdd()||w.isOdd())&&(S.iadd(h),w.isub(k)),S.iushrn(1),w.iushrn(1);d.cmp(v)>=0?(d.isub(v),A.isub(S),T.isub(w)):(v.isub(d),S.isub(A),w.isub(T))}return{a:S,b:w,gcd:v.iushln(b)}},e.prototype._invmp=function(n){a(n.negative===0),a(!n.isZero());var d=this,v=n.clone();d.negative!==0?d=d.umod(n):d=d.clone();for(var A=new e(1),T=new e(0),S=v.clone();d.cmpn(1)>0&&v.cmpn(1)>0;){for(var w=0,b=1;!(d.words[0]&b)&&w<26;++w,b<<=1);if(w>0)for(d.iushrn(w);w-- >0;)A.isOdd()&&A.iadd(S),A.iushrn(1);for(var h=0,k=1;!(v.words[0]&k)&&h<26;++h,k<<=1);if(h>0)for(v.iushrn(h);h-- >0;)T.isOdd()&&T.iadd(S),T.iushrn(1);d.cmp(v)>=0?(d.isub(v),A.isub(T)):(v.isub(d),T.isub(A))}var tt;return d.cmpn(1)===0?tt=A:tt=T,tt.cmpn(0)<0&&tt.iadd(n),tt},e.prototype.gcd=function(n){if(this.isZero())return n.abs();if(n.isZero())return this.abs();var d=this.clone(),v=n.clone();d.negative=0,v.negative=0;for(var A=0;d.isEven()&&v.isEven();A++)d.iushrn(1),v.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;v.isEven();)v.iushrn(1);var T=d.cmp(v);if(T<0){var S=d;d=v,v=S}else if(T===0||v.cmpn(1)===0)break;d.isub(v)}while(!0);return v.iushln(A)},e.prototype.invm=function(n){return this.egcd(n).a.umod(n)},e.prototype.isEven=function(){return(this.words[0]&1)===0},e.prototype.isOdd=function(){return(this.words[0]&1)===1},e.prototype.andln=function(n){return this.words[0]&n},e.prototype.bincn=function(n){a(typeof n=="number");var d=n%26,v=(n-d)/26,A=1<>>26,w&=67108863,this.words[S]=w}return T!==0&&(this.words[S]=T,this.length++),this},e.prototype.isZero=function(){return this.length===1&&this.words[0]===0},e.prototype.cmpn=function(n){var d=n<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var v;if(this.length>1)v=1;else{d&&(n=-n),a(n<=67108863,"Number is too big");var A=this.words[0]|0;v=A===n?0:An.length)return 1;if(this.length=0;v--){var A=this.words[v]|0,T=n.words[v]|0;if(A!==T){AT&&(d=1);break}}return d},e.prototype.gtn=function(n){return this.cmpn(n)===1},e.prototype.gt=function(n){return this.cmp(n)===1},e.prototype.gten=function(n){return this.cmpn(n)>=0},e.prototype.gte=function(n){return this.cmp(n)>=0},e.prototype.ltn=function(n){return this.cmpn(n)===-1},e.prototype.lt=function(n){return this.cmp(n)===-1},e.prototype.lten=function(n){return this.cmpn(n)<=0},e.prototype.lte=function(n){return this.cmp(n)<=0},e.prototype.eqn=function(n){return this.cmpn(n)===0},e.prototype.eq=function(n){return this.cmp(n)===0},e.red=function(n){return new O(n)},e.prototype.toRed=function(n){return a(!this.red,"Already a number in reduction context"),a(this.negative===0,"red works only with positives"),n.convertTo(this)._forceRed(n)},e.prototype.fromRed=function(){return a(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},e.prototype._forceRed=function(n){return this.red=n,this},e.prototype.forceRed=function(n){return a(!this.red,"Already a number in reduction context"),this._forceRed(n)},e.prototype.redAdd=function(n){return a(this.red,"redAdd works only with red numbers"),this.red.add(this,n)},e.prototype.redIAdd=function(n){return a(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,n)},e.prototype.redSub=function(n){return a(this.red,"redSub works only with red numbers"),this.red.sub(this,n)},e.prototype.redISub=function(n){return a(this.red,"redISub works only with red numbers"),this.red.isub(this,n)},e.prototype.redShl=function(n){return a(this.red,"redShl works only with red numbers"),this.red.shl(this,n)},e.prototype.redMul=function(n){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.mul(this,n)},e.prototype.redIMul=function(n){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.imul(this,n)},e.prototype.redSqr=function(){return a(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},e.prototype.redISqr=function(){return a(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},e.prototype.redSqrt=function(){return a(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},e.prototype.redInvm=function(){return a(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},e.prototype.redNeg=function(){return a(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},e.prototype.redPow=function(n){return a(this.red&&!n.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,n)};var I={k256:null,p224:null,p192:null,p25519:null};function U(n,d){this.name=n,this.p=new e(d,16),this.n=this.p.bitLength(),this.k=new e(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var n=new e(null);return n.words=new Array(Math.ceil(this.n/13)),n},U.prototype.ireduce=function(n){var d=n,v;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),v=d.bitLength();while(v>this.n);var A=v0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},U.prototype.split=function(n,d){n.iushrn(this.n,0,d)},U.prototype.imulK=function(n){return n.imul(this.k)};function P(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(P,U),P.prototype.split=function(n,d){for(var v=4194303,A=Math.min(n.length,9),T=0;T>>22,S=w}S>>>=22,n.words[T-10]=S,S===0&&n.length>10?n.length-=10:n.length-=9},P.prototype.imulK=function(n){n.words[n.length]=0,n.words[n.length+1]=0,n.length+=2;for(var d=0,v=0;v>>=26,n.words[v]=T,d=A}return d!==0&&(n.words[n.length++]=d),n},e._prime=function(n){if(I[n])return I[n];var d;if(n==="k256")d=new P;else if(n==="p224")d=new D;else if(n==="p192")d=new W;else if(n==="p25519")d=new q;else throw new Error("Unknown prime "+n);return I[n]=d,d};function O(n){if(typeof n=="string"){var d=e._prime(n);this.m=d.p,this.prime=d}else a(n.gtn(1),"modulus must be greater than 1"),this.m=n,this.prime=null}O.prototype._verify1=function(n){a(n.negative===0,"red works only with positives"),a(n.red,"red works only with red numbers")},O.prototype._verify2=function(n,d){a((n.negative|d.negative)===0,"red works only with positives"),a(n.red&&n.red===d.red,"red works only with red numbers")},O.prototype.imod=function(n){return this.prime?this.prime.ireduce(n)._forceRed(this):(p(n,n.umod(this.m)._forceRed(this)),n)},O.prototype.neg=function(n){return n.isZero()?n.clone():this.m.sub(n)._forceRed(this)},O.prototype.add=function(n,d){this._verify2(n,d);var v=n.add(d);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},O.prototype.iadd=function(n,d){this._verify2(n,d);var v=n.iadd(d);return v.cmp(this.m)>=0&&v.isub(this.m),v},O.prototype.sub=function(n,d){this._verify2(n,d);var v=n.sub(d);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},O.prototype.isub=function(n,d){this._verify2(n,d);var v=n.isub(d);return v.cmpn(0)<0&&v.iadd(this.m),v},O.prototype.shl=function(n,d){return this._verify1(n),this.imod(n.ushln(d))},O.prototype.imul=function(n,d){return this._verify2(n,d),this.imod(n.imul(d))},O.prototype.mul=function(n,d){return this._verify2(n,d),this.imod(n.mul(d))},O.prototype.isqr=function(n){return this.imul(n,n.clone())},O.prototype.sqr=function(n){return this.mul(n,n)},O.prototype.sqrt=function(n){if(n.isZero())return n.clone();var d=this.m.andln(3);if(a(d%2===1),d===3){var v=this.m.add(new e(1)).iushrn(2);return this.pow(n,v)}for(var A=this.m.subn(1),T=0;!A.isZero()&&A.andln(1)===0;)T++,A.iushrn(1);a(!A.isZero());var S=new e(1).toRed(this),w=S.redNeg(),b=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new e(2*h*h).toRed(this);this.pow(h,b).cmp(w)!==0;)h.redIAdd(w);for(var k=this.pow(h,A),tt=this.pow(n,A.addn(1).iushrn(1)),X=this.pow(n,A),ft=T;X.cmp(S)!==0;){for(var et=X,at=0;et.cmp(S)!==0;at++)et=et.redSqr();a(at=0;T--){for(var k=d.words[T],tt=h-1;tt>=0;tt--){var X=k>>tt&1;if(S!==A[0]&&(S=this.sqr(S)),X===0&&w===0){b=0;continue}w<<=1,w|=X,b++,!(b!==v&&(T!==0||tt!==0))&&(S=this.mul(S,A[w]),b=0,w=0)}h=26}return S},O.prototype.convertTo=function(n){var d=n.umod(this.m);return d===n?d.clone():d},O.prototype.convertFrom=function(n){var d=n.clone();return d.red=null,d},e.mont=function(n){return new L(n)};function L(n){O.call(this,n),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new e(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(L,O),L.prototype.convertTo=function(n){return this.imod(n.ushln(this.shift))},L.prototype.convertFrom=function(n){var d=this.imod(n.mul(this.rinv));return d.red=null,d},L.prototype.imul=function(n,d){if(n.isZero()||d.isZero())return n.words[0]=0,n.length=1,n;var v=n.imul(d),A=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=v.isub(A).iushrn(this.shift),S=T;return T.cmp(this.m)>=0?S=T.isub(this.m):T.cmpn(0)<0&&(S=T.iadd(this.m)),S._forceRed(this)},L.prototype.mul=function(n,d){if(n.isZero()||d.isZero())return new e(0)._forceRed(this);var v=n.mul(d),A=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=v.isub(A).iushrn(this.shift),S=T;return T.cmp(this.m)>=0?S=T.isub(this.m):T.cmpn(0)<0&&(S=T.iadd(this.m)),S._forceRed(this)},L.prototype.invm=function(n){var d=this.imod(n._invmp(this.m).mul(this.r2));return d._forceRed(this)}}(typeof i>"u"||i,t)}),_y=gt((t,i)=>{lt(),function(r,u){function a(n,d){if(!n)throw new Error(d||"Assertion failed")}function s(n,d){n.super_=d;var v=function(){};v.prototype=d.prototype,n.prototype=new v,n.prototype.constructor=n}function e(n,d,v){if(e.isBN(n))return n;this.negative=0,this.words=null,this.length=0,this.red=null,n!==null&&((d==="le"||d==="be")&&(v=d,d=10),this._init(n||0,d||10,v||"be"))}typeof r=="object"?r.exports=e:u.BN=e,e.BN=e,e.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=$e().Buffer}catch{}e.isBN=function(n){return n instanceof e?!0:n!==null&&typeof n=="object"&&n.constructor.wordSize===e.wordSize&&Array.isArray(n.words)},e.max=function(n,d){return n.cmp(d)>0?n:d},e.min=function(n,d){return n.cmp(d)<0?n:d},e.prototype._init=function(n,d,v){if(typeof n=="number")return this._initNumber(n,d,v);if(typeof n=="object")return this._initArray(n,d,v);d==="hex"&&(d=16),a(d===(d|0)&&d>=2&&d<=36),n=n.toString().replace(/\s+/g,"");var A=0;n[0]==="-"&&(A++,this.negative=1),A=0;A-=3)S=n[A]|n[A-1]<<8|n[A-2]<<16,this.words[T]|=S<>>26-w&67108863,w+=24,w>=26&&(w-=26,T++);else if(v==="le")for(A=0,T=0;A>>26-w&67108863,w+=24,w>=26&&(w-=26,T++);return this._strip()};function c(n,d){var v=n.charCodeAt(d);if(v>=48&&v<=57)return v-48;if(v>=65&&v<=70)return v-55;if(v>=97&&v<=102)return v-87;a(!1,"Invalid character in "+n)}function f(n,d,v){var A=c(n,v);return v-1>=d&&(A|=c(n,v-1)<<4),A}e.prototype._parseHex=function(n,d,v){this.length=Math.ceil((n.length-d)/6),this.words=new Array(this.length);for(var A=0;A=d;A-=2)w=f(n,d,A)<=18?(T-=18,S+=1,this.words[S]|=w>>>26):T+=8;else{var b=n.length-d;for(A=b%2===0?d+1:d;A=18?(T-=18,S+=1,this.words[S]|=w>>>26):T+=8}this._strip()};function l(n,d,v,A){for(var T=0,S=0,w=Math.min(n.length,v),b=d;b=49?S=h-49+10:h>=17?S=h-17+10:S=h,a(h>=0&&S1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},e.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{e.prototype[Symbol.for("nodejs.util.inspect.custom")]=g}catch{e.prototype.inspect=g}else e.prototype.inspect=g;function g(){return(this.red?""}var y=["","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],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];e.prototype.toString=function(n,d){n=n||10,d=d|0||1;var v;if(n===16||n==="hex"){v="";for(var A=0,T=0,S=0;S>>24-A&16777215,A+=2,A>=26&&(A-=26,S--),T!==0||S!==this.length-1?v=y[6-b.length]+b+v:v=b+v}for(T!==0&&(v=T.toString(16)+v);v.length%d!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(n===(n|0)&&n>=2&&n<=36){var h=m[n],k=M[n];v="";var tt=this.clone();for(tt.negative=0;!tt.isZero();){var X=tt.modrn(k).toString(n);tt=tt.idivn(k),tt.isZero()?v=X+v:v=y[h-X.length]+X+v}for(this.isZero()&&(v="0"+v);v.length%d!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}a(!1,"Base should be between 2 and 36")},e.prototype.toNumber=function(){var n=this.words[0];return this.length===2?n+=this.words[1]*67108864:this.length===3&&this.words[2]===1?n+=4503599627370496+this.words[1]*67108864:this.length>2&&a(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-n:n},e.prototype.toJSON=function(){return this.toString(16,2)},o&&(e.prototype.toBuffer=function(n,d){return this.toArrayLike(o,n,d)}),e.prototype.toArray=function(n,d){return this.toArrayLike(Array,n,d)};var E=function(n,d){return n.allocUnsafe?n.allocUnsafe(d):new n(d)};e.prototype.toArrayLike=function(n,d,v){this._strip();var A=this.byteLength(),T=v||Math.max(1,A);a(A<=T,"byte array longer than desired length"),a(T>0,"Requested array length <= 0");var S=E(n,T),w=d==="le"?"LE":"BE";return this["_toArrayLike"+w](S,A),S},e.prototype._toArrayLikeLE=function(n,d){for(var v=0,A=0,T=0,S=0;T>8&255),v>16&255),S===6?(v>24&255),A=0,S=0):(A=w>>>24,S+=2)}if(v=0&&(n[v--]=w>>8&255),v>=0&&(n[v--]=w>>16&255),S===6?(v>=0&&(n[v--]=w>>24&255),A=0,S=0):(A=w>>>24,S+=2)}if(v>=0)for(n[v--]=A;v>=0;)n[v--]=0},Math.clz32?e.prototype._countBits=function(n){return 32-Math.clz32(n)}:e.prototype._countBits=function(n){var d=n,v=0;return d>=4096&&(v+=13,d>>>=13),d>=64&&(v+=7,d>>>=7),d>=8&&(v+=4,d>>>=4),d>=2&&(v+=2,d>>>=2),v+d},e.prototype._zeroBits=function(n){if(n===0)return 26;var d=n,v=0;return!(d&8191)&&(v+=13,d>>>=13),!(d&127)&&(v+=7,d>>>=7),!(d&15)&&(v+=4,d>>>=4),!(d&3)&&(v+=2,d>>>=2),!(d&1)&&v++,v},e.prototype.bitLength=function(){var n=this.words[this.length-1],d=this._countBits(n);return(this.length-1)*26+d};function B(n){for(var d=new Array(n.bitLength()),v=0;v>>T&1}return d}e.prototype.zeroBits=function(){if(this.isZero())return 0;for(var n=0,d=0;dn.length?this.clone().ior(n):n.clone().ior(this)},e.prototype.uor=function(n){return this.length>n.length?this.clone().iuor(n):n.clone().iuor(this)},e.prototype.iuand=function(n){var d;this.length>n.length?d=n:d=this;for(var v=0;vn.length?this.clone().iand(n):n.clone().iand(this)},e.prototype.uand=function(n){return this.length>n.length?this.clone().iuand(n):n.clone().iuand(this)},e.prototype.iuxor=function(n){var d,v;this.length>n.length?(d=this,v=n):(d=n,v=this);for(var A=0;An.length?this.clone().ixor(n):n.clone().ixor(this)},e.prototype.uxor=function(n){return this.length>n.length?this.clone().iuxor(n):n.clone().iuxor(this)},e.prototype.inotn=function(n){a(typeof n=="number"&&n>=0);var d=Math.ceil(n/26)|0,v=n%26;this._expand(d),v>0&&d--;for(var A=0;A0&&(this.words[A]=~this.words[A]&67108863>>26-v),this._strip()},e.prototype.notn=function(n){return this.clone().inotn(n)},e.prototype.setn=function(n,d){a(typeof n=="number"&&n>=0);var v=n/26|0,A=n%26;return this._expand(v+1),d?this.words[v]=this.words[v]|1<n.length?(v=this,A=n):(v=n,A=this);for(var T=0,S=0;S>>26;for(;T!==0&&S>>26;if(this.length=v.length,T!==0)this.words[this.length]=T,this.length++;else if(v!==this)for(;Sn.length?this.clone().iadd(n):n.clone().iadd(this)},e.prototype.isub=function(n){if(n.negative!==0){n.negative=0;var d=this.iadd(n);return n.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(n),this.negative=1,this._normSign();var v=this.cmp(n);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var A,T;v>0?(A=this,T=n):(A=n,T=this);for(var S=0,w=0;w>26,this.words[w]=d&67108863;for(;S!==0&&w>26,this.words[w]=d&67108863;if(S===0&&w>>26,X=h&67108863,ft=Math.min(k,d.length-1),et=Math.max(0,k-n.length+1);et<=ft;et++){var at=k-et|0;T=n.words[at]|0,S=d.words[et]|0,w=T*S+X,tt+=w/67108864|0,X=w&67108863}v.words[k]=X|0,h=tt|0}return h!==0?v.words[k]=h|0:v.length--,v._strip()}var C=function(n,d,v){var A=n.words,T=d.words,S=v.words,w=0,b,h,k,tt=A[0]|0,X=tt&8191,ft=tt>>>13,et=A[1]|0,at=et&8191,$=et>>>13,J=A[2]|0,R=J&8191,j=J>>>13,z=A[3]|0,Z=z&8191,Q=z>>>13,K=A[4]|0,G=K&8191,H=K>>>13,Y=A[5]|0,it=Y&8191,ot=Y>>>13,mt=A[6]|0,_t=mt&8191,ht=mt>>>13,vt=A[7]|0,pt=vt&8191,V=vt>>>13,rt=A[8]|0,st=rt&8191,yt=rt>>>13,Ct=A[9]|0,dt=Ct&8191,Mt=Ct>>>13,Lt=T[0]|0,wt=Lt&8191,ct=Lt>>>13,Et=T[1]|0,ut=Et&8191,Ot=Et>>>13,qt=T[2]|0,nt=qt&8191,Rt=qt>>>13,Dt=T[3]|0,bt=Dt&8191,Tt=Dt>>>13,jt=T[4]|0,St=jt&8191,kt=jt>>>13,Kt=T[5]|0,At=Kt&8191,Nt=Kt>>>13,$t=T[6]|0,Ft=$t&8191,Wt=$t>>>13,ae=T[7]|0,Xt=ae&8191,Gt=ae>>>13,he=T[8]|0,Qt=he&8191,Zt=he>>>13,se=T[9]|0,te=se&8191,re=se>>>13;v.negative=n.negative^d.negative,v.length=19,b=Math.imul(X,wt),h=Math.imul(X,ct),h=h+Math.imul(ft,wt)|0,k=Math.imul(ft,ct);var Se=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Se>>>26)|0,Se&=67108863,b=Math.imul(at,wt),h=Math.imul(at,ct),h=h+Math.imul($,wt)|0,k=Math.imul($,ct),b=b+Math.imul(X,ut)|0,h=h+Math.imul(X,Ot)|0,h=h+Math.imul(ft,ut)|0,k=k+Math.imul(ft,Ot)|0;var Be=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Be>>>26)|0,Be&=67108863,b=Math.imul(R,wt),h=Math.imul(R,ct),h=h+Math.imul(j,wt)|0,k=Math.imul(j,ct),b=b+Math.imul(at,ut)|0,h=h+Math.imul(at,Ot)|0,h=h+Math.imul($,ut)|0,k=k+Math.imul($,Ot)|0,b=b+Math.imul(X,nt)|0,h=h+Math.imul(X,Rt)|0,h=h+Math.imul(ft,nt)|0,k=k+Math.imul(ft,Rt)|0;var Re=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Re>>>26)|0,Re&=67108863,b=Math.imul(Z,wt),h=Math.imul(Z,ct),h=h+Math.imul(Q,wt)|0,k=Math.imul(Q,ct),b=b+Math.imul(R,ut)|0,h=h+Math.imul(R,Ot)|0,h=h+Math.imul(j,ut)|0,k=k+Math.imul(j,Ot)|0,b=b+Math.imul(at,nt)|0,h=h+Math.imul(at,Rt)|0,h=h+Math.imul($,nt)|0,k=k+Math.imul($,Rt)|0,b=b+Math.imul(X,bt)|0,h=h+Math.imul(X,Tt)|0,h=h+Math.imul(ft,bt)|0,k=k+Math.imul(ft,Tt)|0;var Te=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Te>>>26)|0,Te&=67108863,b=Math.imul(G,wt),h=Math.imul(G,ct),h=h+Math.imul(H,wt)|0,k=Math.imul(H,ct),b=b+Math.imul(Z,ut)|0,h=h+Math.imul(Z,Ot)|0,h=h+Math.imul(Q,ut)|0,k=k+Math.imul(Q,Ot)|0,b=b+Math.imul(R,nt)|0,h=h+Math.imul(R,Rt)|0,h=h+Math.imul(j,nt)|0,k=k+Math.imul(j,Rt)|0,b=b+Math.imul(at,bt)|0,h=h+Math.imul(at,Tt)|0,h=h+Math.imul($,bt)|0,k=k+Math.imul($,Tt)|0,b=b+Math.imul(X,St)|0,h=h+Math.imul(X,kt)|0,h=h+Math.imul(ft,St)|0,k=k+Math.imul(ft,kt)|0;var xe=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(xe>>>26)|0,xe&=67108863,b=Math.imul(it,wt),h=Math.imul(it,ct),h=h+Math.imul(ot,wt)|0,k=Math.imul(ot,ct),b=b+Math.imul(G,ut)|0,h=h+Math.imul(G,Ot)|0,h=h+Math.imul(H,ut)|0,k=k+Math.imul(H,Ot)|0,b=b+Math.imul(Z,nt)|0,h=h+Math.imul(Z,Rt)|0,h=h+Math.imul(Q,nt)|0,k=k+Math.imul(Q,Rt)|0,b=b+Math.imul(R,bt)|0,h=h+Math.imul(R,Tt)|0,h=h+Math.imul(j,bt)|0,k=k+Math.imul(j,Tt)|0,b=b+Math.imul(at,St)|0,h=h+Math.imul(at,kt)|0,h=h+Math.imul($,St)|0,k=k+Math.imul($,kt)|0,b=b+Math.imul(X,At)|0,h=h+Math.imul(X,Nt)|0,h=h+Math.imul(ft,At)|0,k=k+Math.imul(ft,Nt)|0;var Ce=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,b=Math.imul(_t,wt),h=Math.imul(_t,ct),h=h+Math.imul(ht,wt)|0,k=Math.imul(ht,ct),b=b+Math.imul(it,ut)|0,h=h+Math.imul(it,Ot)|0,h=h+Math.imul(ot,ut)|0,k=k+Math.imul(ot,Ot)|0,b=b+Math.imul(G,nt)|0,h=h+Math.imul(G,Rt)|0,h=h+Math.imul(H,nt)|0,k=k+Math.imul(H,Rt)|0,b=b+Math.imul(Z,bt)|0,h=h+Math.imul(Z,Tt)|0,h=h+Math.imul(Q,bt)|0,k=k+Math.imul(Q,Tt)|0,b=b+Math.imul(R,St)|0,h=h+Math.imul(R,kt)|0,h=h+Math.imul(j,St)|0,k=k+Math.imul(j,kt)|0,b=b+Math.imul(at,At)|0,h=h+Math.imul(at,Nt)|0,h=h+Math.imul($,At)|0,k=k+Math.imul($,Nt)|0,b=b+Math.imul(X,Ft)|0,h=h+Math.imul(X,Wt)|0,h=h+Math.imul(ft,Ft)|0,k=k+Math.imul(ft,Wt)|0;var Ue=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,b=Math.imul(pt,wt),h=Math.imul(pt,ct),h=h+Math.imul(V,wt)|0,k=Math.imul(V,ct),b=b+Math.imul(_t,ut)|0,h=h+Math.imul(_t,Ot)|0,h=h+Math.imul(ht,ut)|0,k=k+Math.imul(ht,Ot)|0,b=b+Math.imul(it,nt)|0,h=h+Math.imul(it,Rt)|0,h=h+Math.imul(ot,nt)|0,k=k+Math.imul(ot,Rt)|0,b=b+Math.imul(G,bt)|0,h=h+Math.imul(G,Tt)|0,h=h+Math.imul(H,bt)|0,k=k+Math.imul(H,Tt)|0,b=b+Math.imul(Z,St)|0,h=h+Math.imul(Z,kt)|0,h=h+Math.imul(Q,St)|0,k=k+Math.imul(Q,kt)|0,b=b+Math.imul(R,At)|0,h=h+Math.imul(R,Nt)|0,h=h+Math.imul(j,At)|0,k=k+Math.imul(j,Nt)|0,b=b+Math.imul(at,Ft)|0,h=h+Math.imul(at,Wt)|0,h=h+Math.imul($,Ft)|0,k=k+Math.imul($,Wt)|0,b=b+Math.imul(X,Xt)|0,h=h+Math.imul(X,Gt)|0,h=h+Math.imul(ft,Xt)|0,k=k+Math.imul(ft,Gt)|0;var Ke=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,b=Math.imul(st,wt),h=Math.imul(st,ct),h=h+Math.imul(yt,wt)|0,k=Math.imul(yt,ct),b=b+Math.imul(pt,ut)|0,h=h+Math.imul(pt,Ot)|0,h=h+Math.imul(V,ut)|0,k=k+Math.imul(V,Ot)|0,b=b+Math.imul(_t,nt)|0,h=h+Math.imul(_t,Rt)|0,h=h+Math.imul(ht,nt)|0,k=k+Math.imul(ht,Rt)|0,b=b+Math.imul(it,bt)|0,h=h+Math.imul(it,Tt)|0,h=h+Math.imul(ot,bt)|0,k=k+Math.imul(ot,Tt)|0,b=b+Math.imul(G,St)|0,h=h+Math.imul(G,kt)|0,h=h+Math.imul(H,St)|0,k=k+Math.imul(H,kt)|0,b=b+Math.imul(Z,At)|0,h=h+Math.imul(Z,Nt)|0,h=h+Math.imul(Q,At)|0,k=k+Math.imul(Q,Nt)|0,b=b+Math.imul(R,Ft)|0,h=h+Math.imul(R,Wt)|0,h=h+Math.imul(j,Ft)|0,k=k+Math.imul(j,Wt)|0,b=b+Math.imul(at,Xt)|0,h=h+Math.imul(at,Gt)|0,h=h+Math.imul($,Xt)|0,k=k+Math.imul($,Gt)|0,b=b+Math.imul(X,Qt)|0,h=h+Math.imul(X,Zt)|0,h=h+Math.imul(ft,Qt)|0,k=k+Math.imul(ft,Zt)|0;var Je=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Je>>>26)|0,Je&=67108863,b=Math.imul(dt,wt),h=Math.imul(dt,ct),h=h+Math.imul(Mt,wt)|0,k=Math.imul(Mt,ct),b=b+Math.imul(st,ut)|0,h=h+Math.imul(st,Ot)|0,h=h+Math.imul(yt,ut)|0,k=k+Math.imul(yt,Ot)|0,b=b+Math.imul(pt,nt)|0,h=h+Math.imul(pt,Rt)|0,h=h+Math.imul(V,nt)|0,k=k+Math.imul(V,Rt)|0,b=b+Math.imul(_t,bt)|0,h=h+Math.imul(_t,Tt)|0,h=h+Math.imul(ht,bt)|0,k=k+Math.imul(ht,Tt)|0,b=b+Math.imul(it,St)|0,h=h+Math.imul(it,kt)|0,h=h+Math.imul(ot,St)|0,k=k+Math.imul(ot,kt)|0,b=b+Math.imul(G,At)|0,h=h+Math.imul(G,Nt)|0,h=h+Math.imul(H,At)|0,k=k+Math.imul(H,Nt)|0,b=b+Math.imul(Z,Ft)|0,h=h+Math.imul(Z,Wt)|0,h=h+Math.imul(Q,Ft)|0,k=k+Math.imul(Q,Wt)|0,b=b+Math.imul(R,Xt)|0,h=h+Math.imul(R,Gt)|0,h=h+Math.imul(j,Xt)|0,k=k+Math.imul(j,Gt)|0,b=b+Math.imul(at,Qt)|0,h=h+Math.imul(at,Zt)|0,h=h+Math.imul($,Qt)|0,k=k+Math.imul($,Zt)|0,b=b+Math.imul(X,te)|0,h=h+Math.imul(X,re)|0,h=h+Math.imul(ft,te)|0,k=k+Math.imul(ft,re)|0;var ze=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(ze>>>26)|0,ze&=67108863,b=Math.imul(dt,ut),h=Math.imul(dt,Ot),h=h+Math.imul(Mt,ut)|0,k=Math.imul(Mt,Ot),b=b+Math.imul(st,nt)|0,h=h+Math.imul(st,Rt)|0,h=h+Math.imul(yt,nt)|0,k=k+Math.imul(yt,Rt)|0,b=b+Math.imul(pt,bt)|0,h=h+Math.imul(pt,Tt)|0,h=h+Math.imul(V,bt)|0,k=k+Math.imul(V,Tt)|0,b=b+Math.imul(_t,St)|0,h=h+Math.imul(_t,kt)|0,h=h+Math.imul(ht,St)|0,k=k+Math.imul(ht,kt)|0,b=b+Math.imul(it,At)|0,h=h+Math.imul(it,Nt)|0,h=h+Math.imul(ot,At)|0,k=k+Math.imul(ot,Nt)|0,b=b+Math.imul(G,Ft)|0,h=h+Math.imul(G,Wt)|0,h=h+Math.imul(H,Ft)|0,k=k+Math.imul(H,Wt)|0,b=b+Math.imul(Z,Xt)|0,h=h+Math.imul(Z,Gt)|0,h=h+Math.imul(Q,Xt)|0,k=k+Math.imul(Q,Gt)|0,b=b+Math.imul(R,Qt)|0,h=h+Math.imul(R,Zt)|0,h=h+Math.imul(j,Qt)|0,k=k+Math.imul(j,Zt)|0,b=b+Math.imul(at,te)|0,h=h+Math.imul(at,re)|0,h=h+Math.imul($,te)|0,k=k+Math.imul($,re)|0;var Xe=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,b=Math.imul(dt,nt),h=Math.imul(dt,Rt),h=h+Math.imul(Mt,nt)|0,k=Math.imul(Mt,Rt),b=b+Math.imul(st,bt)|0,h=h+Math.imul(st,Tt)|0,h=h+Math.imul(yt,bt)|0,k=k+Math.imul(yt,Tt)|0,b=b+Math.imul(pt,St)|0,h=h+Math.imul(pt,kt)|0,h=h+Math.imul(V,St)|0,k=k+Math.imul(V,kt)|0,b=b+Math.imul(_t,At)|0,h=h+Math.imul(_t,Nt)|0,h=h+Math.imul(ht,At)|0,k=k+Math.imul(ht,Nt)|0,b=b+Math.imul(it,Ft)|0,h=h+Math.imul(it,Wt)|0,h=h+Math.imul(ot,Ft)|0,k=k+Math.imul(ot,Wt)|0,b=b+Math.imul(G,Xt)|0,h=h+Math.imul(G,Gt)|0,h=h+Math.imul(H,Xt)|0,k=k+Math.imul(H,Gt)|0,b=b+Math.imul(Z,Qt)|0,h=h+Math.imul(Z,Zt)|0,h=h+Math.imul(Q,Qt)|0,k=k+Math.imul(Q,Zt)|0,b=b+Math.imul(R,te)|0,h=h+Math.imul(R,re)|0,h=h+Math.imul(j,te)|0,k=k+Math.imul(j,re)|0;var Ge=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,b=Math.imul(dt,bt),h=Math.imul(dt,Tt),h=h+Math.imul(Mt,bt)|0,k=Math.imul(Mt,Tt),b=b+Math.imul(st,St)|0,h=h+Math.imul(st,kt)|0,h=h+Math.imul(yt,St)|0,k=k+Math.imul(yt,kt)|0,b=b+Math.imul(pt,At)|0,h=h+Math.imul(pt,Nt)|0,h=h+Math.imul(V,At)|0,k=k+Math.imul(V,Nt)|0,b=b+Math.imul(_t,Ft)|0,h=h+Math.imul(_t,Wt)|0,h=h+Math.imul(ht,Ft)|0,k=k+Math.imul(ht,Wt)|0,b=b+Math.imul(it,Xt)|0,h=h+Math.imul(it,Gt)|0,h=h+Math.imul(ot,Xt)|0,k=k+Math.imul(ot,Gt)|0,b=b+Math.imul(G,Qt)|0,h=h+Math.imul(G,Zt)|0,h=h+Math.imul(H,Qt)|0,k=k+Math.imul(H,Zt)|0,b=b+Math.imul(Z,te)|0,h=h+Math.imul(Z,re)|0,h=h+Math.imul(Q,te)|0,k=k+Math.imul(Q,re)|0;var Ye=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,b=Math.imul(dt,St),h=Math.imul(dt,kt),h=h+Math.imul(Mt,St)|0,k=Math.imul(Mt,kt),b=b+Math.imul(st,At)|0,h=h+Math.imul(st,Nt)|0,h=h+Math.imul(yt,At)|0,k=k+Math.imul(yt,Nt)|0,b=b+Math.imul(pt,Ft)|0,h=h+Math.imul(pt,Wt)|0,h=h+Math.imul(V,Ft)|0,k=k+Math.imul(V,Wt)|0,b=b+Math.imul(_t,Xt)|0,h=h+Math.imul(_t,Gt)|0,h=h+Math.imul(ht,Xt)|0,k=k+Math.imul(ht,Gt)|0,b=b+Math.imul(it,Qt)|0,h=h+Math.imul(it,Zt)|0,h=h+Math.imul(ot,Qt)|0,k=k+Math.imul(ot,Zt)|0,b=b+Math.imul(G,te)|0,h=h+Math.imul(G,re)|0,h=h+Math.imul(H,te)|0,k=k+Math.imul(H,re)|0;var We=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(We>>>26)|0,We&=67108863,b=Math.imul(dt,At),h=Math.imul(dt,Nt),h=h+Math.imul(Mt,At)|0,k=Math.imul(Mt,Nt),b=b+Math.imul(st,Ft)|0,h=h+Math.imul(st,Wt)|0,h=h+Math.imul(yt,Ft)|0,k=k+Math.imul(yt,Wt)|0,b=b+Math.imul(pt,Xt)|0,h=h+Math.imul(pt,Gt)|0,h=h+Math.imul(V,Xt)|0,k=k+Math.imul(V,Gt)|0,b=b+Math.imul(_t,Qt)|0,h=h+Math.imul(_t,Zt)|0,h=h+Math.imul(ht,Qt)|0,k=k+Math.imul(ht,Zt)|0,b=b+Math.imul(it,te)|0,h=h+Math.imul(it,re)|0,h=h+Math.imul(ot,te)|0,k=k+Math.imul(ot,re)|0;var Ve=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,b=Math.imul(dt,Ft),h=Math.imul(dt,Wt),h=h+Math.imul(Mt,Ft)|0,k=Math.imul(Mt,Wt),b=b+Math.imul(st,Xt)|0,h=h+Math.imul(st,Gt)|0,h=h+Math.imul(yt,Xt)|0,k=k+Math.imul(yt,Gt)|0,b=b+Math.imul(pt,Qt)|0,h=h+Math.imul(pt,Zt)|0,h=h+Math.imul(V,Qt)|0,k=k+Math.imul(V,Zt)|0,b=b+Math.imul(_t,te)|0,h=h+Math.imul(_t,re)|0,h=h+Math.imul(ht,te)|0,k=k+Math.imul(ht,re)|0;var Ze=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,b=Math.imul(dt,Xt),h=Math.imul(dt,Gt),h=h+Math.imul(Mt,Xt)|0,k=Math.imul(Mt,Gt),b=b+Math.imul(st,Qt)|0,h=h+Math.imul(st,Zt)|0,h=h+Math.imul(yt,Qt)|0,k=k+Math.imul(yt,Zt)|0,b=b+Math.imul(pt,te)|0,h=h+Math.imul(pt,re)|0,h=h+Math.imul(V,te)|0,k=k+Math.imul(V,re)|0;var ar=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(ar>>>26)|0,ar&=67108863,b=Math.imul(dt,Qt),h=Math.imul(dt,Zt),h=h+Math.imul(Mt,Qt)|0,k=Math.imul(Mt,Zt),b=b+Math.imul(st,te)|0,h=h+Math.imul(st,re)|0,h=h+Math.imul(yt,te)|0,k=k+Math.imul(yt,re)|0;var br=(w+b|0)+((h&8191)<<13)|0;w=(k+(h>>>13)|0)+(br>>>26)|0,br&=67108863,b=Math.imul(dt,te),h=Math.imul(dt,re),h=h+Math.imul(Mt,te)|0,k=Math.imul(Mt,re);var cr=(w+b|0)+((h&8191)<<13)|0;return w=(k+(h>>>13)|0)+(cr>>>26)|0,cr&=67108863,S[0]=Se,S[1]=Be,S[2]=Re,S[3]=Te,S[4]=xe,S[5]=Ce,S[6]=Ue,S[7]=Ke,S[8]=Je,S[9]=ze,S[10]=Xe,S[11]=Ge,S[12]=Ye,S[13]=We,S[14]=Ve,S[15]=Ze,S[16]=ar,S[17]=br,S[18]=cr,w!==0&&(S[19]=w,v.length++),v};Math.imul||(C=x);function N(n,d,v){v.negative=d.negative^n.negative,v.length=n.length+d.length;for(var A=0,T=0,S=0;S>>26)|0,T+=w>>>26,w&=67108863}v.words[S]=b,A=w,w=T}return A!==0?v.words[S]=A:v.length--,v._strip()}function F(n,d,v){return N(n,d,v)}e.prototype.mulTo=function(n,d){var v,A=this.length+n.length;return this.length===10&&n.length===10?v=C(this,n,d):A<63?v=x(this,n,d):A<1024?v=N(this,n,d):v=F(this,n,d),v},e.prototype.mul=function(n){var d=new e(null);return d.words=new Array(this.length+n.length),this.mulTo(n,d)},e.prototype.mulf=function(n){var d=new e(null);return d.words=new Array(this.length+n.length),F(this,n,d)},e.prototype.imul=function(n){return this.clone().mulTo(n,this)},e.prototype.imuln=function(n){var d=n<0;d&&(n=-n),a(typeof n=="number"),a(n<67108864);for(var v=0,A=0;A>=26,v+=T/67108864|0,v+=S>>>26,this.words[A]=S&67108863}return v!==0&&(this.words[A]=v,this.length++),d?this.ineg():this},e.prototype.muln=function(n){return this.clone().imuln(n)},e.prototype.sqr=function(){return this.mul(this)},e.prototype.isqr=function(){return this.imul(this.clone())},e.prototype.pow=function(n){var d=B(n);if(d.length===0)return new e(1);for(var v=this,A=0;A=0);var d=n%26,v=(n-d)/26,A=67108863>>>26-d<<26-d,T;if(d!==0){var S=0;for(T=0;T>>26-d}S&&(this.words[T]=S,this.length++)}if(v!==0){for(T=this.length-1;T>=0;T--)this.words[T+v]=this.words[T];for(T=0;T=0);var A;d?A=(d-d%26)/26:A=0;var T=n%26,S=Math.min((n-T)/26,this.length),w=67108863^67108863>>>T<S)for(this.length-=S,h=0;h=0&&(k!==0||h>=A);h--){var tt=this.words[h]|0;this.words[h]=k<<26-T|tt>>>T,k=tt&w}return b&&k!==0&&(b.words[b.length++]=k),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},e.prototype.ishrn=function(n,d,v){return a(this.negative===0),this.iushrn(n,d,v)},e.prototype.shln=function(n){return this.clone().ishln(n)},e.prototype.ushln=function(n){return this.clone().iushln(n)},e.prototype.shrn=function(n){return this.clone().ishrn(n)},e.prototype.ushrn=function(n){return this.clone().iushrn(n)},e.prototype.testn=function(n){a(typeof n=="number"&&n>=0);var d=n%26,v=(n-d)/26,A=1<=0);var d=n%26,v=(n-d)/26;if(a(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(d!==0&&v++,this.length=Math.min(v,this.length),d!==0){var A=67108863^67108863>>>d<=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},e.prototype.isubn=function(n){if(a(typeof n=="number"),a(n<67108864),n<0)return this.iaddn(-n);if(this.negative!==0)return this.negative=0,this.iaddn(n),this.negative=1,this;if(this.words[0]-=n,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(b/67108864|0),this.words[T+v]=S&67108863}for(;T>26,this.words[T+v]=S&67108863;if(w===0)return this._strip();for(a(w===-1),w=0,T=0;T>26,this.words[T]=S&67108863;return this.negative=1,this._strip()},e.prototype._wordDiv=function(n,d){var v=this.length-n.length,A=this.clone(),T=n,S=T.words[T.length-1]|0,w=this._countBits(S);v=26-w,v!==0&&(T=T.ushln(v),A.iushln(v),S=T.words[T.length-1]|0);var b=A.length-T.length,h;if(d!=="mod"){h=new e(null),h.length=b+1,h.words=new Array(h.length);for(var k=0;k=0;X--){var ft=(A.words[T.length+X]|0)*67108864+(A.words[T.length+X-1]|0);for(ft=Math.min(ft/S|0,67108863),A._ishlnsubmul(T,ft,X);A.negative!==0;)ft--,A.negative=0,A._ishlnsubmul(T,1,X),A.isZero()||(A.negative^=1);h&&(h.words[X]=ft)}return h&&h._strip(),A._strip(),d!=="div"&&v!==0&&A.iushrn(v),{div:h||null,mod:A}},e.prototype.divmod=function(n,d,v){if(a(!n.isZero()),this.isZero())return{div:new e(0),mod:new e(0)};var A,T,S;return this.negative!==0&&n.negative===0?(S=this.neg().divmod(n,d),d!=="mod"&&(A=S.div.neg()),d!=="div"&&(T=S.mod.neg(),v&&T.negative!==0&&T.iadd(n)),{div:A,mod:T}):this.negative===0&&n.negative!==0?(S=this.divmod(n.neg(),d),d!=="mod"&&(A=S.div.neg()),{div:A,mod:S.mod}):this.negative&n.negative?(S=this.neg().divmod(n.neg(),d),d!=="div"&&(T=S.mod.neg(),v&&T.negative!==0&&T.isub(n)),{div:S.div,mod:T}):n.length>this.length||this.cmp(n)<0?{div:new e(0),mod:this}:n.length===1?d==="div"?{div:this.divn(n.words[0]),mod:null}:d==="mod"?{div:null,mod:new e(this.modrn(n.words[0]))}:{div:this.divn(n.words[0]),mod:new e(this.modrn(n.words[0]))}:this._wordDiv(n,d)},e.prototype.div=function(n){return this.divmod(n,"div",!1).div},e.prototype.mod=function(n){return this.divmod(n,"mod",!1).mod},e.prototype.umod=function(n){return this.divmod(n,"mod",!0).mod},e.prototype.divRound=function(n){var d=this.divmod(n);if(d.mod.isZero())return d.div;var v=d.div.negative!==0?d.mod.isub(n):d.mod,A=n.ushrn(1),T=n.andln(1),S=v.cmp(A);return S<0||T===1&&S===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},e.prototype.modrn=function(n){var d=n<0;d&&(n=-n),a(n<=67108863);for(var v=(1<<26)%n,A=0,T=this.length-1;T>=0;T--)A=(v*A+(this.words[T]|0))%n;return d?-A:A},e.prototype.modn=function(n){return this.modrn(n)},e.prototype.idivn=function(n){var d=n<0;d&&(n=-n),a(n<=67108863);for(var v=0,A=this.length-1;A>=0;A--){var T=(this.words[A]|0)+v*67108864;this.words[A]=T/n|0,v=T%n}return this._strip(),d?this.ineg():this},e.prototype.divn=function(n){return this.clone().idivn(n)},e.prototype.egcd=function(n){a(n.negative===0),a(!n.isZero());var d=this,v=n.clone();d.negative!==0?d=d.umod(n):d=d.clone();for(var A=new e(1),T=new e(0),S=new e(0),w=new e(1),b=0;d.isEven()&&v.isEven();)d.iushrn(1),v.iushrn(1),++b;for(var h=v.clone(),k=d.clone();!d.isZero();){for(var tt=0,X=1;!(d.words[0]&X)&&tt<26;++tt,X<<=1);if(tt>0)for(d.iushrn(tt);tt-- >0;)(A.isOdd()||T.isOdd())&&(A.iadd(h),T.isub(k)),A.iushrn(1),T.iushrn(1);for(var ft=0,et=1;!(v.words[0]&et)&&ft<26;++ft,et<<=1);if(ft>0)for(v.iushrn(ft);ft-- >0;)(S.isOdd()||w.isOdd())&&(S.iadd(h),w.isub(k)),S.iushrn(1),w.iushrn(1);d.cmp(v)>=0?(d.isub(v),A.isub(S),T.isub(w)):(v.isub(d),S.isub(A),w.isub(T))}return{a:S,b:w,gcd:v.iushln(b)}},e.prototype._invmp=function(n){a(n.negative===0),a(!n.isZero());var d=this,v=n.clone();d.negative!==0?d=d.umod(n):d=d.clone();for(var A=new e(1),T=new e(0),S=v.clone();d.cmpn(1)>0&&v.cmpn(1)>0;){for(var w=0,b=1;!(d.words[0]&b)&&w<26;++w,b<<=1);if(w>0)for(d.iushrn(w);w-- >0;)A.isOdd()&&A.iadd(S),A.iushrn(1);for(var h=0,k=1;!(v.words[0]&k)&&h<26;++h,k<<=1);if(h>0)for(v.iushrn(h);h-- >0;)T.isOdd()&&T.iadd(S),T.iushrn(1);d.cmp(v)>=0?(d.isub(v),A.isub(T)):(v.isub(d),T.isub(A))}var tt;return d.cmpn(1)===0?tt=A:tt=T,tt.cmpn(0)<0&&tt.iadd(n),tt},e.prototype.gcd=function(n){if(this.isZero())return n.abs();if(n.isZero())return this.abs();var d=this.clone(),v=n.clone();d.negative=0,v.negative=0;for(var A=0;d.isEven()&&v.isEven();A++)d.iushrn(1),v.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;v.isEven();)v.iushrn(1);var T=d.cmp(v);if(T<0){var S=d;d=v,v=S}else if(T===0||v.cmpn(1)===0)break;d.isub(v)}while(!0);return v.iushln(A)},e.prototype.invm=function(n){return this.egcd(n).a.umod(n)},e.prototype.isEven=function(){return(this.words[0]&1)===0},e.prototype.isOdd=function(){return(this.words[0]&1)===1},e.prototype.andln=function(n){return this.words[0]&n},e.prototype.bincn=function(n){a(typeof n=="number");var d=n%26,v=(n-d)/26,A=1<>>26,w&=67108863,this.words[S]=w}return T!==0&&(this.words[S]=T,this.length++),this},e.prototype.isZero=function(){return this.length===1&&this.words[0]===0},e.prototype.cmpn=function(n){var d=n<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var v;if(this.length>1)v=1;else{d&&(n=-n),a(n<=67108863,"Number is too big");var A=this.words[0]|0;v=A===n?0:An.length)return 1;if(this.length=0;v--){var A=this.words[v]|0,T=n.words[v]|0;if(A!==T){AT&&(d=1);break}}return d},e.prototype.gtn=function(n){return this.cmpn(n)===1},e.prototype.gt=function(n){return this.cmp(n)===1},e.prototype.gten=function(n){return this.cmpn(n)>=0},e.prototype.gte=function(n){return this.cmp(n)>=0},e.prototype.ltn=function(n){return this.cmpn(n)===-1},e.prototype.lt=function(n){return this.cmp(n)===-1},e.prototype.lten=function(n){return this.cmpn(n)<=0},e.prototype.lte=function(n){return this.cmp(n)<=0},e.prototype.eqn=function(n){return this.cmpn(n)===0},e.prototype.eq=function(n){return this.cmp(n)===0},e.red=function(n){return new O(n)},e.prototype.toRed=function(n){return a(!this.red,"Already a number in reduction context"),a(this.negative===0,"red works only with positives"),n.convertTo(this)._forceRed(n)},e.prototype.fromRed=function(){return a(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},e.prototype._forceRed=function(n){return this.red=n,this},e.prototype.forceRed=function(n){return a(!this.red,"Already a number in reduction context"),this._forceRed(n)},e.prototype.redAdd=function(n){return a(this.red,"redAdd works only with red numbers"),this.red.add(this,n)},e.prototype.redIAdd=function(n){return a(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,n)},e.prototype.redSub=function(n){return a(this.red,"redSub works only with red numbers"),this.red.sub(this,n)},e.prototype.redISub=function(n){return a(this.red,"redISub works only with red numbers"),this.red.isub(this,n)},e.prototype.redShl=function(n){return a(this.red,"redShl works only with red numbers"),this.red.shl(this,n)},e.prototype.redMul=function(n){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.mul(this,n)},e.prototype.redIMul=function(n){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.imul(this,n)},e.prototype.redSqr=function(){return a(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},e.prototype.redISqr=function(){return a(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},e.prototype.redSqrt=function(){return a(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},e.prototype.redInvm=function(){return a(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},e.prototype.redNeg=function(){return a(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},e.prototype.redPow=function(n){return a(this.red&&!n.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,n)};var I={k256:null,p224:null,p192:null,p25519:null};function U(n,d){this.name=n,this.p=new e(d,16),this.n=this.p.bitLength(),this.k=new e(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var n=new e(null);return n.words=new Array(Math.ceil(this.n/13)),n},U.prototype.ireduce=function(n){var d=n,v;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),v=d.bitLength();while(v>this.n);var A=v0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},U.prototype.split=function(n,d){n.iushrn(this.n,0,d)},U.prototype.imulK=function(n){return n.imul(this.k)};function P(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(P,U),P.prototype.split=function(n,d){for(var v=4194303,A=Math.min(n.length,9),T=0;T>>22,S=w}S>>>=22,n.words[T-10]=S,S===0&&n.length>10?n.length-=10:n.length-=9},P.prototype.imulK=function(n){n.words[n.length]=0,n.words[n.length+1]=0,n.length+=2;for(var d=0,v=0;v>>=26,n.words[v]=T,d=A}return d!==0&&(n.words[n.length++]=d),n},e._prime=function(n){if(I[n])return I[n];var d;if(n==="k256")d=new P;else if(n==="p224")d=new D;else if(n==="p192")d=new W;else if(n==="p25519")d=new q;else throw new Error("Unknown prime "+n);return I[n]=d,d};function O(n){if(typeof n=="string"){var d=e._prime(n);this.m=d.p,this.prime=d}else a(n.gtn(1),"modulus must be greater than 1"),this.m=n,this.prime=null}O.prototype._verify1=function(n){a(n.negative===0,"red works only with positives"),a(n.red,"red works only with red numbers")},O.prototype._verify2=function(n,d){a((n.negative|d.negative)===0,"red works only with positives"),a(n.red&&n.red===d.red,"red works only with red numbers")},O.prototype.imod=function(n){return this.prime?this.prime.ireduce(n)._forceRed(this):(p(n,n.umod(this.m)._forceRed(this)),n)},O.prototype.neg=function(n){return n.isZero()?n.clone():this.m.sub(n)._forceRed(this)},O.prototype.add=function(n,d){this._verify2(n,d);var v=n.add(d);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},O.prototype.iadd=function(n,d){this._verify2(n,d);var v=n.iadd(d);return v.cmp(this.m)>=0&&v.isub(this.m),v},O.prototype.sub=function(n,d){this._verify2(n,d);var v=n.sub(d);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},O.prototype.isub=function(n,d){this._verify2(n,d);var v=n.isub(d);return v.cmpn(0)<0&&v.iadd(this.m),v},O.prototype.shl=function(n,d){return this._verify1(n),this.imod(n.ushln(d))},O.prototype.imul=function(n,d){return this._verify2(n,d),this.imod(n.imul(d))},O.prototype.mul=function(n,d){return this._verify2(n,d),this.imod(n.mul(d))},O.prototype.isqr=function(n){return this.imul(n,n.clone())},O.prototype.sqr=function(n){return this.mul(n,n)},O.prototype.sqrt=function(n){if(n.isZero())return n.clone();var d=this.m.andln(3);if(a(d%2===1),d===3){var v=this.m.add(new e(1)).iushrn(2);return this.pow(n,v)}for(var A=this.m.subn(1),T=0;!A.isZero()&&A.andln(1)===0;)T++,A.iushrn(1);a(!A.isZero());var S=new e(1).toRed(this),w=S.redNeg(),b=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new e(2*h*h).toRed(this);this.pow(h,b).cmp(w)!==0;)h.redIAdd(w);for(var k=this.pow(h,A),tt=this.pow(n,A.addn(1).iushrn(1)),X=this.pow(n,A),ft=T;X.cmp(S)!==0;){for(var et=X,at=0;et.cmp(S)!==0;at++)et=et.redSqr();a(at=0;T--){for(var k=d.words[T],tt=h-1;tt>=0;tt--){var X=k>>tt&1;if(S!==A[0]&&(S=this.sqr(S)),X===0&&w===0){b=0;continue}w<<=1,w|=X,b++,!(b!==v&&(T!==0||tt!==0))&&(S=this.mul(S,A[w]),b=0,w=0)}h=26}return S},O.prototype.convertTo=function(n){var d=n.umod(this.m);return d===n?d.clone():d},O.prototype.convertFrom=function(n){var d=n.clone();return d.red=null,d},e.mont=function(n){return new L(n)};function L(n){O.call(this,n),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new e(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(L,O),L.prototype.convertTo=function(n){return this.imod(n.ushln(this.shift))},L.prototype.convertFrom=function(n){var d=this.imod(n.mul(this.rinv));return d.red=null,d},L.prototype.imul=function(n,d){if(n.isZero()||d.isZero())return n.words[0]=0,n.length=1,n;var v=n.imul(d),A=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=v.isub(A).iushrn(this.shift),S=T;return T.cmp(this.m)>=0?S=T.isub(this.m):T.cmpn(0)<0&&(S=T.iadd(this.m)),S._forceRed(this)},L.prototype.mul=function(n,d){if(n.isZero()||d.isZero())return new e(0)._forceRed(this);var v=n.mul(d),A=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=v.isub(A).iushrn(this.shift),S=T;return T.cmp(this.m)>=0?S=T.isub(this.m):T.cmpn(0)<0&&(S=T.iadd(this.m)),S._forceRed(this)},L.prototype.invm=function(n){var d=this.imod(n._invmp(this.m).mul(this.r2));return d._forceRed(this)}}(typeof i>"u"||i,t)}),X0=gt((t,i)=>{lt(),function(r){function u(b){return parseInt(b)===b}function a(b){if(!u(b.length))return!1;for(var h=0;h255)return!1;return!0}function s(b,h){if(b.buffer&&ArrayBuffer.isView(b)&&b.name==="Uint8Array")return h&&(b.slice?b=b.slice():b=Array.prototype.slice.call(b)),b;if(Array.isArray(b)){if(!a(b))throw new Error("Array contains invalid value: "+b);return new Uint8Array(b)}if(u(b.length)&&a(b))return new Uint8Array(b);throw new Error("unsupported array-like object")}function e(b){return new Uint8Array(b)}function o(b,h,k,tt,X){(tt!=null||X!=null)&&(b.slice?b=b.slice(tt,X):b=Array.prototype.slice.call(b,tt,X)),h.set(b,k)}var c=function(){function b(k){var tt=[],X=0;for(k=encodeURI(k);X191&&ft<224?(tt.push(String.fromCharCode((ft&31)<<6|k[X+1]&63)),X+=2):(tt.push(String.fromCharCode((ft&15)<<12|(k[X+1]&63)<<6|k[X+2]&63)),X+=3)}return tt.join("")}return{toBytes:b,fromBytes:h}}(),f=function(){function b(tt){for(var X=[],ft=0;ft>4]+h[et&15])}return X.join("")}return{toBytes:b,fromBytes:k}}(),l={16:10,24:12,32:14},p=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],g=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],y=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],m=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],M=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],E=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],B=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],x=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],C=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],N=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],F=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],I=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],U=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],P=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],D=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function W(b){for(var h=[],k=0;k>2,this._Ke[ft][h%4]=X[h],this._Kd[b-ft][h%4]=X[h];for(var et=0,at=tt,$;at>16&255]<<24^g[$>>8&255]<<16^g[$&255]<<8^g[$>>24&255]^p[et]<<24,et+=1,tt!=8)for(var h=1;h>8&255]<<8^g[$>>16&255]<<16^g[$>>24&255]<<24;for(var h=tt/2+1;h>2,R=at%4,this._Ke[J][R]=X[h],this._Kd[b-J][R]=X[h++],at++}for(var J=1;J>24&255]^U[$>>16&255]^P[$>>8&255]^D[$&255]},q.prototype.encrypt=function(b){if(b.length!=16)throw new Error("invalid plaintext size (must be 16 bytes)");for(var h=this._Ke.length-1,k=[0,0,0,0],tt=W(b),X=0;X<4;X++)tt[X]^=this._Ke[0][X];for(var ft=1;ft>24&255]^M[tt[(X+1)%4]>>16&255]^E[tt[(X+2)%4]>>8&255]^B[tt[(X+3)%4]&255]^this._Ke[ft][X];tt=k.slice()}for(var et=e(16),at,X=0;X<4;X++)at=this._Ke[h][X],et[4*X]=(g[tt[X]>>24&255]^at>>24)&255,et[4*X+1]=(g[tt[(X+1)%4]>>16&255]^at>>16)&255,et[4*X+2]=(g[tt[(X+2)%4]>>8&255]^at>>8)&255,et[4*X+3]=(g[tt[(X+3)%4]&255]^at)&255;return et},q.prototype.decrypt=function(b){if(b.length!=16)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var h=this._Kd.length-1,k=[0,0,0,0],tt=W(b),X=0;X<4;X++)tt[X]^=this._Kd[0][X];for(var ft=1;ft>24&255]^C[tt[(X+3)%4]>>16&255]^N[tt[(X+2)%4]>>8&255]^F[tt[(X+1)%4]&255]^this._Kd[ft][X];tt=k.slice()}for(var et=e(16),at,X=0;X<4;X++)at=this._Kd[h][X],et[4*X]=(y[tt[X]>>24&255]^at>>24)&255,et[4*X+1]=(y[tt[(X+3)%4]>>16&255]^at>>16)&255,et[4*X+2]=(y[tt[(X+2)%4]>>8&255]^at>>8)&255,et[4*X+3]=(y[tt[(X+1)%4]&255]^at)&255;return et};var O=function(b){if(!(this instanceof O))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new q(b)};O.prototype.encrypt=function(b){if(b=s(b),b.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var h=e(b.length),k=e(16),tt=0;tt=0;--h)this._counter[h]=b%256,b=b>>8},v.prototype.setBytes=function(b){if(b=s(b,!0),b.length!=16)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=b},v.prototype.increment=function(){for(var b=15;b>=0;b--)if(this._counter[b]===255)this._counter[b]=0;else{this._counter[b]++;break}};var A=function(b,h){if(!(this instanceof A))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",h instanceof v||(h=new v(h)),this._counter=h,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new q(b)};A.prototype.encrypt=function(b){for(var h=s(b,!0),k=0;k16)throw new Error("PKCS#7 padding byte out of range");for(var k=b.length-h,tt=0;tt{lt(),function(r){function u(m){let M=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]),E=1779033703,B=3144134277,x=1013904242,C=2773480762,N=1359893119,F=2600822924,I=528734635,U=1541459225,P=new Uint32Array(64);function D(v){let A=0,T=v.length;for(;T>=64;){let S=E,w=B,b=x,h=C,k=N,tt=F,X=I,ft=U,et,at,$,J,R;for(at=0;at<16;at++)$=A+at*4,P[at]=(v[$]&255)<<24|(v[$+1]&255)<<16|(v[$+2]&255)<<8|v[$+3]&255;for(at=16;at<64;at++)et=P[at-2],J=(et>>>17|et<<15)^(et>>>19|et<<13)^et>>>10,et=P[at-15],R=(et>>>7|et<<25)^(et>>>18|et<<14)^et>>>3,P[at]=(J+P[at-7]|0)+(R+P[at-16]|0)|0;for(at=0;at<64;at++)J=(((k>>>6|k<<26)^(k>>>11|k<<21)^(k>>>25|k<<7))+(k&tt^~k&X)|0)+(ft+(M[at]+P[at]|0)|0)|0,R=((S>>>2|S<<30)^(S>>>13|S<<19)^(S>>>22|S<<10))+(S&w^S&b^w&b)|0,ft=X,X=tt,tt=k,k=h+J|0,h=b,b=w,w=S,S=J+R|0;E=E+S|0,B=B+w|0,x=x+b|0,C=C+h|0,N=N+k|0,F=F+tt|0,I=I+X|0,U=U+ft|0,A+=64,T-=64}}D(m);let W,q=m.length%64,O=m.length/536870912|0,L=m.length<<3,n=q<56?56:120,d=m.slice(m.length-q,m.length);for(d.push(128),W=q+1;W>>24&255),d.push(O>>>16&255),d.push(O>>>8&255),d.push(O>>>0&255),d.push(L>>>24&255),d.push(L>>>16&255),d.push(L>>>8&255),d.push(L>>>0&255),D(d),[E>>>24&255,E>>>16&255,E>>>8&255,E>>>0&255,B>>>24&255,B>>>16&255,B>>>8&255,B>>>0&255,x>>>24&255,x>>>16&255,x>>>8&255,x>>>0&255,C>>>24&255,C>>>16&255,C>>>8&255,C>>>0&255,N>>>24&255,N>>>16&255,N>>>8&255,N>>>0&255,F>>>24&255,F>>>16&255,F>>>8&255,F>>>0&255,I>>>24&255,I>>>16&255,I>>>8&255,I>>>0&255,U>>>24&255,U>>>16&255,U>>>8&255,U>>>0&255]}function a(m,M,E){m=m.length<=64?m:u(m);let B=64+M.length+4,x=new Array(B),C=new Array(64),N,F=[];for(N=0;N<64;N++)x[N]=54;for(N=0;N=B-4;U--){if(x[U]++,x[U]<=255)return;x[U]=0}}for(;E>=32;)I(),F=F.concat(u(C.concat(u(x)))),E-=32;return E>0&&(I(),F=F.concat(u(C.concat(u(x))).slice(0,E))),F}function s(m,M,E,B,x){let C;for(f(m,(2*E-1)*16,x,0,16),C=0;C<2*E;C++)c(m,C*16,x,16),o(x,B),f(x,0,m,M+C*16,16);for(C=0;C>>32-M}function o(m,M){f(m,0,M,0,16);for(let E=8;E>0;E-=2)M[4]^=e(M[0]+M[12],7),M[8]^=e(M[4]+M[0],9),M[12]^=e(M[8]+M[4],13),M[0]^=e(M[12]+M[8],18),M[9]^=e(M[5]+M[1],7),M[13]^=e(M[9]+M[5],9),M[1]^=e(M[13]+M[9],13),M[5]^=e(M[1]+M[13],18),M[14]^=e(M[10]+M[6],7),M[2]^=e(M[14]+M[10],9),M[6]^=e(M[2]+M[14],13),M[10]^=e(M[6]+M[2],18),M[3]^=e(M[15]+M[11],7),M[7]^=e(M[3]+M[15],9),M[11]^=e(M[7]+M[3],13),M[15]^=e(M[11]+M[7],18),M[1]^=e(M[0]+M[3],7),M[2]^=e(M[1]+M[0],9),M[3]^=e(M[2]+M[1],13),M[0]^=e(M[3]+M[2],18),M[6]^=e(M[5]+M[4],7),M[7]^=e(M[6]+M[5],9),M[4]^=e(M[7]+M[6],13),M[5]^=e(M[4]+M[7],18),M[11]^=e(M[10]+M[9],7),M[8]^=e(M[11]+M[10],9),M[9]^=e(M[8]+M[11],13),M[10]^=e(M[9]+M[8],18),M[12]^=e(M[15]+M[14],7),M[13]^=e(M[12]+M[15],9),M[14]^=e(M[13]+M[12],13),M[15]^=e(M[14]+M[13],18);for(let E=0;E<16;++E)m[E]+=M[E]}function c(m,M,E,B){for(let x=0;x=256)return!1}return!0}function p(m,M){if(typeof m!="number"||m%1)throw new Error("invalid "+M);return m}function g(m,M,E,B,x,C,N){if(E=p(E,"N"),B=p(B,"r"),x=p(x,"p"),C=p(C,"dkLen"),E===0||(E&E-1)!==0)throw new Error("N must be power of 2");if(E>2147483647/128/B)throw new Error("N too large");if(B>2147483647/128/x)throw new Error("r too large");if(!l(m))throw new Error("password must be an array or buffer");if(m=Array.prototype.slice.call(m),!l(M))throw new Error("salt must be an array or buffer");M=Array.prototype.slice.call(M);let F=a(m,M,x*128*B),I=new Uint32Array(x*32*B);for(let k=0;kw&&(k=w);for(let X=0;Xw&&(k=w);for(let X=0;X>0&255),F.push(I[X]>>8&255),F.push(I[X]>>16&255),F.push(I[X]>>24&255);let tt=a(m,F,C);return N&&N(null,1,tt),tt}N&&b(h)};if(!N)for(;;){let k=h();if(k!=null)return k}h()}let y={scrypt:function(m,M,E,B,x,C,N){return new Promise(function(F,I){let U=0;N&&N(0),g(m,M,E,B,x,C,function(P,D,W){if(P)I(P);else if(W)N&&U!==1&&N(1),F(new Uint8Array(W));else if(N&&D!==U)return U=D,N(D)})})},syncScrypt:function(m,M,E,B,x,C){return new Uint8Array(g(m,M,E,B,x,C))}};typeof t<"u"?i.exports=y:typeof define=="function"&&define.amd?define(y):r&&(r.scrypt&&(r._scrypt=r.scrypt),r.scrypt=y)}(t)}),Sy=gt((t,i)=>{lt();var r=Ee().Buffer;function u(a){if(a.length>=255)throw new TypeError("Alphabet too long");for(var s=new Uint8Array(256),e=0;e>>0,U=new Uint8Array(I);N!==F;){for(var P=B[N],D=0,W=I-1;(P!==0||D>>0,U[W]=P%l>>>0,P=P/l>>>0;if(P!==0)throw new Error("Non-zero carry");C=D,N++}for(var q=I-C;q!==I&&U[q]===0;)q++;for(var O=p.repeat(x);q>>0,I=new Uint8Array(F);B[x];){var U=s[B.charCodeAt(x)];if(U===255)return;for(var P=0,D=F-1;(U!==0||P>>0,I[D]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");N=P,x++}for(var W=F-N;W!==F&&I[W]===0;)W++;var q=r.allocUnsafe(C+(F-W));q.fill(0,0,C);for(var O=C;W!==F;)q[O++]=I[W++];return q}function E(B){var x=M(B);if(x)return x;throw new Error("Non-base"+l+" character")}return{encode:m,decodeUnsafe:M,decode:E}}i.exports=u}),Ay=gt((t,i)=>{lt();var r=Sy(),u="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";i.exports=r(u)}),Ty=gt((t,i)=>{lt();var r={IMPOSSIBLE_CASE:"Impossible case. Please create issue.",TWEAK_ADD:"The tweak was out of range or the resulted private key is invalid",TWEAK_MUL:"The tweak was out of range or equal to zero",CONTEXT_RANDOMIZE_UNKNOW:"Unknow error on context randomization",SECKEY_INVALID:"Private Key is invalid",PUBKEY_PARSE:"Public Key could not be parsed",PUBKEY_SERIALIZE:"Public Key serialization error",PUBKEY_COMBINE:"The sum of the public keys is not valid",SIG_PARSE:"Signature could not be parsed",SIGN:"The nonce generation function failed, or the private key was invalid",RECOVER:"Public key could not be recover",ECDH:"Scalar was invalid (zero or overflow)"};function u(c,f){if(!c)throw new Error(f)}function a(c,f,l){if(u(f instanceof Uint8Array,`Expected ${c} to be an Uint8Array`),l!==void 0)if(Array.isArray(l)){let p=l.join(", "),g=`Expected ${c} to be an Uint8Array with length [${p}]`;u(l.includes(f.length),g)}else{let p=`Expected ${c} to be an Uint8Array with length ${l}`;u(f.length===l,p)}}function s(c){u(o(c)==="Boolean","Expected compressed to be a Boolean")}function e(c=l=>new Uint8Array(l),f){return typeof c=="function"&&(c=c(f)),a("output",c,f),c}function o(c){return Object.prototype.toString.call(c).slice(8,-1)}i.exports=c=>({contextRandomize(f){switch(u(f===null||f instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),f!==null&&a("seed",f,32),c.contextRandomize(f)){case 1:throw new Error(r.CONTEXT_RANDOMIZE_UNKNOW)}},privateKeyVerify(f){return a("private key",f,32),c.privateKeyVerify(f)===0},privateKeyNegate(f){switch(a("private key",f,32),c.privateKeyNegate(f)){case 0:return f;case 1:throw new Error(r.IMPOSSIBLE_CASE)}},privateKeyTweakAdd(f,l){switch(a("private key",f,32),a("tweak",l,32),c.privateKeyTweakAdd(f,l)){case 0:return f;case 1:throw new Error(r.TWEAK_ADD)}},privateKeyTweakMul(f,l){switch(a("private key",f,32),a("tweak",l,32),c.privateKeyTweakMul(f,l)){case 0:return f;case 1:throw new Error(r.TWEAK_MUL)}},publicKeyVerify(f){return a("public key",f,[33,65]),c.publicKeyVerify(f)===0},publicKeyCreate(f,l=!0,p){switch(a("private key",f,32),s(l),p=e(p,l?33:65),c.publicKeyCreate(p,f)){case 0:return p;case 1:throw new Error(r.SECKEY_INVALID);case 2:throw new Error(r.PUBKEY_SERIALIZE)}},publicKeyConvert(f,l=!0,p){switch(a("public key",f,[33,65]),s(l),p=e(p,l?33:65),c.publicKeyConvert(p,f)){case 0:return p;case 1:throw new Error(r.PUBKEY_PARSE);case 2:throw new Error(r.PUBKEY_SERIALIZE)}},publicKeyNegate(f,l=!0,p){switch(a("public key",f,[33,65]),s(l),p=e(p,l?33:65),c.publicKeyNegate(p,f)){case 0:return p;case 1:throw new Error(r.PUBKEY_PARSE);case 2:throw new Error(r.IMPOSSIBLE_CASE);case 3:throw new Error(r.PUBKEY_SERIALIZE)}},publicKeyCombine(f,l=!0,p){u(Array.isArray(f),"Expected public keys to be an Array"),u(f.length>0,"Expected public keys array will have more than zero items");for(let g of f)a("public key",g,[33,65]);switch(s(l),p=e(p,l?33:65),c.publicKeyCombine(p,f)){case 0:return p;case 1:throw new Error(r.PUBKEY_PARSE);case 2:throw new Error(r.PUBKEY_COMBINE);case 3:throw new Error(r.PUBKEY_SERIALIZE)}},publicKeyTweakAdd(f,l,p=!0,g){switch(a("public key",f,[33,65]),a("tweak",l,32),s(p),g=e(g,p?33:65),c.publicKeyTweakAdd(g,f,l)){case 0:return g;case 1:throw new Error(r.PUBKEY_PARSE);case 2:throw new Error(r.TWEAK_ADD)}},publicKeyTweakMul(f,l,p=!0,g){switch(a("public key",f,[33,65]),a("tweak",l,32),s(p),g=e(g,p?33:65),c.publicKeyTweakMul(g,f,l)){case 0:return g;case 1:throw new Error(r.PUBKEY_PARSE);case 2:throw new Error(r.TWEAK_MUL)}},signatureNormalize(f){switch(a("signature",f,64),c.signatureNormalize(f)){case 0:return f;case 1:throw new Error(r.SIG_PARSE)}},signatureExport(f,l){a("signature",f,64),l=e(l,72);let p={output:l,outputlen:72};switch(c.signatureExport(p,f)){case 0:return l.slice(0,p.outputlen);case 1:throw new Error(r.SIG_PARSE);case 2:throw new Error(r.IMPOSSIBLE_CASE)}},signatureImport(f,l){switch(a("signature",f),l=e(l,64),c.signatureImport(l,f)){case 0:return l;case 1:throw new Error(r.SIG_PARSE);case 2:throw new Error(r.IMPOSSIBLE_CASE)}},ecdsaSign(f,l,p={},g){a("message",f,32),a("private key",l,32),u(o(p)==="Object","Expected options to be an Object"),p.data!==void 0&&a("options.data",p.data),p.noncefn!==void 0&&u(o(p.noncefn)==="Function","Expected options.noncefn to be a Function"),g=e(g,64);let y={signature:g,recid:null};switch(c.ecdsaSign(y,f,l,p.data,p.noncefn)){case 0:return y;case 1:throw new Error(r.SIGN);case 2:throw new Error(r.IMPOSSIBLE_CASE)}},ecdsaVerify(f,l,p){switch(a("signature",f,64),a("message",l,32),a("public key",p,[33,65]),c.ecdsaVerify(f,l,p)){case 0:return!0;case 3:return!1;case 1:throw new Error(r.SIG_PARSE);case 2:throw new Error(r.PUBKEY_PARSE)}},ecdsaRecover(f,l,p,g=!0,y){switch(a("signature",f,64),u(o(l)==="Number"&&l>=0&&l<=3,"Expected recovery id to be a Number within interval [0, 3]"),a("message",p,32),s(g),y=e(y,g?33:65),c.ecdsaRecover(y,f,l,p)){case 0:return y;case 1:throw new Error(r.SIG_PARSE);case 2:throw new Error(r.RECOVER);case 3:throw new Error(r.IMPOSSIBLE_CASE)}},ecdh(f,l,p={},g){switch(a("public key",f,[33,65]),a("private key",l,32),u(o(p)==="Object","Expected options to be an Object"),p.data!==void 0&&a("options.data",p.data),p.hashfn!==void 0?(u(o(p.hashfn)==="Function","Expected options.hashfn to be a Function"),p.xbuf!==void 0&&a("options.xbuf",p.xbuf,32),p.ybuf!==void 0&&a("options.ybuf",p.ybuf,32),a("output",g)):g=e(g,32),c.ecdh(g,f,l,p.data,p.hashfn,p.xbuf,p.ybuf)){case 0:return g;case 1:throw new Error(r.PUBKEY_PARSE);case 2:throw new Error(r.ECDH)}}})}),My=gt((t,i)=>{lt();var r=rs().ec,u=new r("secp256k1"),a=u.curve,s=a.n.constructor;function e(l,p){let g=new s(p);if(g.cmp(a.p)>=0)return null;g=g.toRed(a.red);let y=g.redSqr().redIMul(g).redIAdd(a.b).redSqrt();return l===3!==y.isOdd()&&(y=y.redNeg()),u.keyPair({pub:{x:g,y}})}function o(l,p,g){let y=new s(p),m=new s(g);if(y.cmp(a.p)>=0||m.cmp(a.p)>=0||(y=y.toRed(a.red),m=m.toRed(a.red),(l===6||l===7)&&m.isOdd()!==(l===7)))return null;let M=y.redSqr().redIMul(y);return m.redSqr().redISub(M.redIAdd(a.b)).isZero()?u.keyPair({pub:{x:y,y:m}}):null}function c(l){let p=l[0];switch(p){case 2:case 3:return l.length!==33?null:e(p,l.subarray(1,33));case 4:case 6:case 7:return l.length!==65?null:o(p,l.subarray(1,33),l.subarray(33,65));default:return null}}function f(l,p){let g=p.encode(null,l.length===33);for(let y=0;y=0||(g.iadd(new s(l)),g.cmp(a.n)>=0&&g.isub(a.n),g.isZero()))return 1;let y=g.toArrayLike(Uint8Array,"be",32);return l.set(y),0},privateKeyTweakMul(l,p){let g=new s(p);if(g.cmp(a.n)>=0||g.isZero())return 1;g.imul(new s(l)),g.cmp(a.n)>=0&&(g=g.umod(a.n));let y=g.toArrayLike(Uint8Array,"be",32);return l.set(y),0},publicKeyVerify(l){return c(l)===null?1:0},publicKeyCreate(l,p){let g=new s(p);if(g.cmp(a.n)>=0||g.isZero())return 1;let y=u.keyFromPrivate(p).getPublic();return f(l,y),0},publicKeyConvert(l,p){let g=c(p);if(g===null)return 1;let y=g.getPublic();return f(l,y),0},publicKeyNegate(l,p){let g=c(p);if(g===null)return 1;let y=g.getPublic();return y.y=y.y.redNeg(),f(l,y),0},publicKeyCombine(l,p){let g=new Array(p.length);for(let m=0;m=0)return 2;let m=y.getPublic().add(a.g.mul(g));return m.isInfinity()?2:(f(l,m),0)},publicKeyTweakMul(l,p,g){let y=c(p);if(y===null)return 1;if(g=new s(g),g.cmp(a.n)>=0||g.isZero())return 2;let m=y.getPublic().mul(g);return f(l,m),0},signatureNormalize(l){let p=new s(l.subarray(0,32)),g=new s(l.subarray(32,64));return p.cmp(a.n)>=0||g.cmp(a.n)>=0?1:(g.cmp(u.nh)===1&&l.set(a.n.sub(g).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(l,p){let g=p.subarray(0,32),y=p.subarray(32,64);if(new s(g).cmp(a.n)>=0||new s(y).cmp(a.n)>=0)return 1;let{output:m}=l,M=m.subarray(4,37);M[0]=0,M.set(g,1);let E=33,B=0;for(;E>1&&M[B]===0&&!(M[B+1]&128);--E,++B);if(M=M.subarray(B),M[0]&128||E>1&&M[0]===0&&!(M[1]&128))return 1;let x=m.subarray(39,72);x[0]=0,x.set(y,1);let C=33,N=0;for(;C>1&&x[N]===0&&!(x[N+1]&128);--C,++N);return x=x.subarray(N),x[0]&128||C>1&&x[0]===0&&!(x[1]&128)?1:(l.outputlen=6+E+C,m[0]=48,m[1]=l.outputlen-2,m[2]=2,m[3]=M.length,m.set(M,4),m[4+E]=2,m[5+E]=x.length,m.set(x,6+E),0)},signatureImport(l,p){if(p.length<8||p.length>72||p[0]!==48||p[1]!==p.length-2||p[2]!==2)return 1;let g=p[3];if(g===0||5+g>=p.length||p[4+g]!==2)return 1;let y=p[5+g];if(y===0||6+g+y!==p.length||p[4]&128||g>1&&p[4]===0&&!(p[5]&128)||p[g+6]&128||y>1&&p[g+6]===0&&!(p[g+7]&128))return 1;let m=p.subarray(4,4+g);if(m.length===33&&m[0]===0&&(m=m.subarray(1)),m.length>32)return 1;let M=p.subarray(6+g);if(M.length===33&&M[0]===0&&(M=M.slice(1)),M.length>32)throw new Error("S length is too long");let E=new s(m);E.cmp(a.n)>=0&&(E=new s(0));let B=new s(p.subarray(6+g));return B.cmp(a.n)>=0&&(B=new s(0)),l.set(E.toArrayLike(Uint8Array,"be",32),0),l.set(B.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(l,p,g,y,m){if(m){let B=m;m=x=>{let C=B(p,g,null,y,x);if(!(C instanceof Uint8Array&&C.length===32))throw new Error("This is the way");return new s(C)}}let M=new s(g);if(M.cmp(a.n)>=0||M.isZero())return 1;let E;try{E=u.sign(p,g,{canonical:!0,k:m,pers:y})}catch{return 1}return l.signature.set(E.r.toArrayLike(Uint8Array,"be",32),0),l.signature.set(E.s.toArrayLike(Uint8Array,"be",32),32),l.recid=E.recoveryParam,0},ecdsaVerify(l,p,g){let y={r:l.subarray(0,32),s:l.subarray(32,64)},m=new s(y.r),M=new s(y.s);if(m.cmp(a.n)>=0||M.cmp(a.n)>=0)return 1;if(M.cmp(u.nh)===1||m.isZero()||M.isZero())return 3;let E=c(g);if(E===null)return 2;let B=E.getPublic();return u.verify(p,y,B)?0:3},ecdsaRecover(l,p,g,y){let m={r:p.slice(0,32),s:p.slice(32,64)},M=new s(m.r),E=new s(m.s);if(M.cmp(a.n)>=0||E.cmp(a.n)>=0)return 1;if(M.isZero()||E.isZero())return 2;let B;try{B=u.recoverPubKey(y,m,g)}catch{return 2}return f(l,B),0},ecdh(l,p,g,y,m,M,E){let B=c(p);if(B===null)return 1;let x=new s(g);if(x.cmp(a.n)>=0||x.isZero())return 2;let C=B.getPublic().mul(x);if(m===void 0){let N=C.encode(null,!0),F=u.hash().update(N).digest();for(let I=0;I<32;++I)l[I]=F[I]}else{M||(M=new Uint8Array(32));let N=C.getX().toArray("be",32);for(let U=0;U<32;++U)M[U]=N[U];E||(E=new Uint8Array(32));let F=C.getY().toArray("be",32);for(let U=0;U<32;++U)E[U]=F[U];let I=m(M,E,y);if(!(I instanceof Uint8Array&&I.length===l.length))return 2;l.set(I)}return 0}}}),Y0=gt((t,i)=>{lt(),i.exports=Ty()(My())}),xy=gt((t,i)=>{lt();var{Transform:r}=kr();i.exports=u=>class Q0 extends r{constructor(s,e,o,c,f){super(f),this._rate=s,this._capacity=e,this._delimitedSuffix=o,this._hashBitLength=c,this._options=f,this._state=new u,this._state.initialize(s,e),this._finalized=!1}_transform(s,e,o){let c=null;try{this.update(s,e)}catch(f){c=f}o(c)}_flush(s){let e=null;try{this.push(this.digest())}catch(o){e=o}s(e)}update(s,e){if(!Ut.Buffer.isBuffer(s)&&typeof s!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Ut.Buffer.isBuffer(s)||(s=Ut.Buffer.from(s,e)),this._state.absorb(s),this}digest(s){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let e=this._state.squeeze(this._hashBitLength/8);return s!==void 0&&(e=e.toString(s)),this._resetState(),e}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let s=new Q0(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(s._state),s._finalized=this._finalized,s}}}),ky=gt((t,i)=>{lt();var{Transform:r}=kr();i.exports=u=>class td extends r{constructor(s,e,o,c){super(c),this._rate=s,this._capacity=e,this._delimitedSuffix=o,this._options=c,this._state=new u,this._state.initialize(s,e),this._finalized=!1}_transform(s,e,o){let c=null;try{this.update(s,e)}catch(f){c=f}o(c)}_flush(){}_read(s){this.push(this.squeeze(s))}update(s,e){if(!Ut.Buffer.isBuffer(s)&&typeof s!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Ut.Buffer.isBuffer(s)||(s=Ut.Buffer.from(s,e)),this._state.absorb(s),this}squeeze(s,e){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let o=this._state.squeeze(s);return e!==void 0&&(o=o.toString(e)),o}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let s=new td(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(s._state),s._finalized=this._finalized,s}}}),Oy=gt((t,i)=>{lt();var r=xy(),u=ky();i.exports=function(a){let s=r(a),e=u(a);return function(o,c){switch(typeof o=="string"?o.toLowerCase():o){case"keccak224":return new s(1152,448,null,224,c);case"keccak256":return new s(1088,512,null,256,c);case"keccak384":return new s(832,768,null,384,c);case"keccak512":return new s(576,1024,null,512,c);case"sha3-224":return new s(1152,448,6,224,c);case"sha3-256":return new s(1088,512,6,256,c);case"sha3-384":return new s(832,768,6,384,c);case"sha3-512":return new s(576,1024,6,512,c);case"shake128":return new e(1344,256,31,c);case"shake256":return new e(1088,512,31,c);default:throw new Error("Invald algorithm: "+o)}}}}),Iy=gt(t=>{lt();var i=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];t.p1600=function(r){for(let u=0;u<24;++u){let a=r[0]^r[10]^r[20]^r[30]^r[40],s=r[1]^r[11]^r[21]^r[31]^r[41],e=r[2]^r[12]^r[22]^r[32]^r[42],o=r[3]^r[13]^r[23]^r[33]^r[43],c=r[4]^r[14]^r[24]^r[34]^r[44],f=r[5]^r[15]^r[25]^r[35]^r[45],l=r[6]^r[16]^r[26]^r[36]^r[46],p=r[7]^r[17]^r[27]^r[37]^r[47],g=r[8]^r[18]^r[28]^r[38]^r[48],y=r[9]^r[19]^r[29]^r[39]^r[49],m=g^(e<<1|o>>>31),M=y^(o<<1|e>>>31),E=r[0]^m,B=r[1]^M,x=r[10]^m,C=r[11]^M,N=r[20]^m,F=r[21]^M,I=r[30]^m,U=r[31]^M,P=r[40]^m,D=r[41]^M;m=a^(c<<1|f>>>31),M=s^(f<<1|c>>>31);let W=r[2]^m,q=r[3]^M,O=r[12]^m,L=r[13]^M,n=r[22]^m,d=r[23]^M,v=r[32]^m,A=r[33]^M,T=r[42]^m,S=r[43]^M;m=e^(l<<1|p>>>31),M=o^(p<<1|l>>>31);let w=r[4]^m,b=r[5]^M,h=r[14]^m,k=r[15]^M,tt=r[24]^m,X=r[25]^M,ft=r[34]^m,et=r[35]^M,at=r[44]^m,$=r[45]^M;m=c^(g<<1|y>>>31),M=f^(y<<1|g>>>31);let J=r[6]^m,R=r[7]^M,j=r[16]^m,z=r[17]^M,Z=r[26]^m,Q=r[27]^M,K=r[36]^m,G=r[37]^M,H=r[46]^m,Y=r[47]^M;m=l^(a<<1|s>>>31),M=p^(s<<1|a>>>31);let it=r[8]^m,ot=r[9]^M,mt=r[18]^m,_t=r[19]^M,ht=r[28]^m,vt=r[29]^M,pt=r[38]^m,V=r[39]^M,rt=r[48]^m,st=r[49]^M,yt=E,Ct=B,dt=C<<4|x>>>28,Mt=x<<4|C>>>28,Lt=N<<3|F>>>29,wt=F<<3|N>>>29,ct=U<<9|I>>>23,Et=I<<9|U>>>23,ut=P<<18|D>>>14,Ot=D<<18|P>>>14,qt=W<<1|q>>>31,nt=q<<1|W>>>31,Rt=L<<12|O>>>20,Dt=O<<12|L>>>20,bt=n<<10|d>>>22,Tt=d<<10|n>>>22,jt=A<<13|v>>>19,St=v<<13|A>>>19,kt=T<<2|S>>>30,Kt=S<<2|T>>>30,At=b<<30|w>>>2,Nt=w<<30|b>>>2,$t=h<<6|k>>>26,Ft=k<<6|h>>>26,Wt=X<<11|tt>>>21,ae=tt<<11|X>>>21,Xt=ft<<15|et>>>17,Gt=et<<15|ft>>>17,he=$<<29|at>>>3,Qt=at<<29|$>>>3,Zt=J<<28|R>>>4,se=R<<28|J>>>4,te=z<<23|j>>>9,re=j<<23|z>>>9,Se=Z<<25|Q>>>7,Be=Q<<25|Z>>>7,Re=K<<21|G>>>11,Te=G<<21|K>>>11,xe=Y<<24|H>>>8,Ce=H<<24|Y>>>8,Ue=it<<27|ot>>>5,Ke=ot<<27|it>>>5,Je=mt<<20|_t>>>12,ze=_t<<20|mt>>>12,Xe=vt<<7|ht>>>25,Ge=ht<<7|vt>>>25,Ye=pt<<8|V>>>24,We=V<<8|pt>>>24,Ve=rt<<14|st>>>18,Ze=st<<14|rt>>>18;r[0]=yt^~Rt&Wt,r[1]=Ct^~Dt&ae,r[10]=Zt^~Je&Lt,r[11]=se^~ze&wt,r[20]=qt^~$t&Se,r[21]=nt^~Ft&Be,r[30]=Ue^~dt&bt,r[31]=Ke^~Mt&Tt,r[40]=At^~te&Xe,r[41]=Nt^~re&Ge,r[2]=Rt^~Wt&Re,r[3]=Dt^~ae&Te,r[12]=Je^~Lt&jt,r[13]=ze^~wt&St,r[22]=$t^~Se&Ye,r[23]=Ft^~Be&We,r[32]=dt^~bt&Xt,r[33]=Mt^~Tt&Gt,r[42]=te^~Xe&ct,r[43]=re^~Ge&Et,r[4]=Wt^~Re&Ve,r[5]=ae^~Te&Ze,r[14]=Lt^~jt&he,r[15]=wt^~St&Qt,r[24]=Se^~Ye&ut,r[25]=Be^~We&Ot,r[34]=bt^~Xt&xe,r[35]=Tt^~Gt&Ce,r[44]=Xe^~ct&kt,r[45]=Ge^~Et&Kt,r[6]=Re^~Ve&yt,r[7]=Te^~Ze&Ct,r[16]=jt^~he&Zt,r[17]=St^~Qt&se,r[26]=Ye^~ut&qt,r[27]=We^~Ot&nt,r[36]=Xt^~xe&Ue,r[37]=Gt^~Ce&Ke,r[46]=ct^~kt&At,r[47]=Et^~Kt&Nt,r[8]=Ve^~yt&Rt,r[9]=Ze^~Ct&Dt,r[18]=he^~Zt&Je,r[19]=Qt^~se&ze,r[28]=ut^~qt&$t,r[29]=Ot^~nt&Ft,r[38]=xe^~Ue&dt,r[39]=Ce^~Ke&Mt,r[48]=kt^~At&te,r[49]=Kt^~Nt&re,r[0]^=i[u*2],r[1]^=i[u*2+1]}}}),By=gt((t,i)=>{lt();var r=Iy();function u(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}u.prototype.initialize=function(a,s){for(let e=0;e<50;++e)this.state[e]=0;this.blockSize=a/8,this.count=0,this.squeezing=!1},u.prototype.absorb=function(a){for(let s=0;s>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(r.p1600(this.state),this.count=0);return s},u.prototype.copy=function(a){for(let s=0;s<50;++s)a.state[s]=this.state[s];a.blockSize=this.blockSize,a.count=this.count,a.squeezing=this.squeezing},i.exports=u}),Cy=gt((t,i)=>{lt(),i.exports=Oy()(By())}),Py=gt((t,i)=>{lt(),function(r){var u,a=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,s=Math.ceil,e=Math.floor,o="[BigNumber Error] ",c=o+"Number primitive has more than 15 significant digits: ",f=1e14,l=14,p=9007199254740991,g=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,m=1e9;function M(U){var P,D,W,q=X.prototype={constructor:X,toString:null,valueOf:null},O=new X(1),L=20,n=4,d=-7,v=21,A=-1e7,T=1e7,S=!1,w=1,b=0,h={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},k="0123456789abcdefghijklmnopqrstuvwxyz",tt=!0;function X(R,j){var z,Z,Q,K,G,H,Y,it,ot=this;if(!(ot instanceof X))return new X(R,j);if(j==null){if(R&&R._isBigNumber===!0){ot.s=R.s,!R.c||R.e>T?ot.c=ot.e=null:R.e=10;G/=10,K++);K>T?ot.c=ot.e=null:(ot.e=K,ot.c=[R]);return}it=String(R)}else{if(!a.test(it=String(R)))return W(ot,it,H);ot.s=it.charCodeAt(0)==45?(it=it.slice(1),-1):1}(K=it.indexOf("."))>-1&&(it=it.replace(".","")),(G=it.search(/e/i))>0?(K<0&&(K=G),K+=+it.slice(G+1),it=it.substring(0,G)):K<0&&(K=it.length)}else{if(C(j,2,k.length,"Base"),j==10&&tt)return ot=new X(R),$(ot,L+ot.e+1,n);if(it=String(R),H=typeof R=="number"){if(R*0!=0)return W(ot,it,H,j);if(ot.s=1/R<0?(it=it.slice(1),-1):1,X.DEBUG&&it.replace(/^0\.0*|\./,"").length>15)throw Error(c+R)}else ot.s=it.charCodeAt(0)===45?(it=it.slice(1),-1):1;for(z=k.slice(0,j),K=G=0,Y=it.length;GK){K=Y;continue}}else if(!Q&&(it==it.toUpperCase()&&(it=it.toLowerCase())||it==it.toLowerCase()&&(it=it.toUpperCase()))){Q=!0,G=-1,K=0;continue}return W(ot,String(R),H,j)}H=!1,it=D(it,j,10,ot.s),(K=it.indexOf("."))>-1?it=it.replace(".",""):K=it.length}for(G=0;it.charCodeAt(G)===48;G++);for(Y=it.length;it.charCodeAt(--Y)===48;);if(it=it.slice(G,++Y)){if(Y-=G,H&&X.DEBUG&&Y>15&&(R>p||R!==e(R)))throw Error(c+ot.s*R);if((K=K-G-1)>T)ot.c=ot.e=null;else if(K=-m&&Q<=m&&Q===e(Q)){if(Z[0]===0){if(Q===0&&Z.length===1)return!0;break t}if(j=(Q+1)%l,j<1&&(j+=l),String(Z[0]).length==j){for(j=0;j=f||z!==e(z))break t;if(z!==0)return!0}}}else if(Z===null&&Q===null&&(K===null||K===1||K===-1))return!0;throw Error(o+"Invalid BigNumber: "+R)},X.maximum=X.max=function(){return et(arguments,-1)},X.minimum=X.min=function(){return et(arguments,1)},X.random=function(){var R=9007199254740992,j=Math.random()*R&2097151?function(){return e(Math.random()*R)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(z){var Z,Q,K,G,H,Y=0,it=[],ot=new X(O);if(z==null?z=L:C(z,0,m),G=s(z/l),S)if(crypto.getRandomValues){for(Z=crypto.getRandomValues(new Uint32Array(G*=2));Y>>11),H>=9e15?(Q=crypto.getRandomValues(new Uint32Array(2)),Z[Y]=Q[0],Z[Y+1]=Q[1]):(it.push(H%1e14),Y+=2);Y=G/2}else if(crypto.randomBytes){for(Z=crypto.randomBytes(G*=7);Y=9e15?crypto.randomBytes(7).copy(Z,Y):(it.push(H%1e14),Y+=7);Y=G/7}else throw S=!1,Error(o+"crypto unavailable");if(!S)for(;Y=10;H/=10,Y++);YQ-1&&(H[G+1]==null&&(H[G+1]=0),H[G+1]+=H[G]/Q|0,H[G]%=Q)}return H.reverse()}return function(z,Z,Q,K,G){var H,Y,it,ot,mt,_t,ht,vt,pt=z.indexOf("."),V=L,rt=n;for(pt>=0&&(ot=b,b=0,z=z.replace(".",""),vt=new X(Z),_t=vt.pow(z.length-pt),b=ot,vt.c=j(I(B(_t.c),_t.e,"0"),10,Q,R),vt.e=vt.c.length),ht=j(z,Z,Q,G?(H=k,R):(H=R,k)),it=ot=ht.length;ht[--ot]==0;ht.pop());if(!ht[0])return H.charAt(0);if(pt<0?--it:(_t.c=ht,_t.e=it,_t.s=K,_t=P(_t,vt,V,rt,Q),ht=_t.c,mt=_t.r,it=_t.e),Y=it+V+1,pt=ht[Y],ot=Q/2,mt=mt||Y<0||ht[Y+1]!=null,mt=rt<4?(pt!=null||mt)&&(rt==0||rt==(_t.s<0?3:2)):pt>ot||pt==ot&&(rt==4||mt||rt==6&&ht[Y-1]&1||rt==(_t.s<0?8:7)),Y<1||!ht[0])z=mt?I(H.charAt(1),-V,H.charAt(0)):H.charAt(0);else{if(ht.length=Y,mt)for(--Q;++ht[--Y]>Q;)ht[Y]=0,Y||(++it,ht=[1].concat(ht));for(ot=ht.length;!ht[--ot];);for(pt=0,z="";pt<=ot;z+=H.charAt(ht[pt++]));z=I(z,it,H.charAt(0))}return z}}(),P=function(){function R(Z,Q,K){var G,H,Y,it,ot=0,mt=Z.length,_t=Q%y,ht=Q/y|0;for(Z=Z.slice();mt--;)Y=Z[mt]%y,it=Z[mt]/y|0,G=ht*Y+it*_t,H=_t*Y+G%y*y+ot,ot=(H/K|0)+(G/y|0)+ht*it,Z[mt]=H%K;return ot&&(Z=[ot].concat(Z)),Z}function j(Z,Q,K,G){var H,Y;if(K!=G)Y=K>G?1:-1;else for(H=Y=0;HQ[H]?1:-1;break}return Y}function z(Z,Q,K,G){for(var H=0;K--;)Z[K]-=H,H=Z[K]1;Z.splice(0,1));}return function(Z,Q,K,G,H){var Y,it,ot,mt,_t,ht,vt,pt,V,rt,st,yt,Ct,dt,Mt,Lt,wt,ct=Z.s==Q.s?1:-1,Et=Z.c,ut=Q.c;if(!Et||!Et[0]||!ut||!ut[0])return new X(!Z.s||!Q.s||(Et?ut&&Et[0]==ut[0]:!ut)?NaN:Et&&Et[0]==0||!ut?ct*0:ct/0);for(pt=new X(ct),V=pt.c=[],it=Z.e-Q.e,ct=K+it+1,H||(H=f,it=E(Z.e/l)-E(Q.e/l),ct=ct/l|0),ot=0;ut[ot]==(Et[ot]||0);ot++);if(ut[ot]>(Et[ot]||0)&&it--,ct<0)V.push(1),mt=!0;else{for(dt=Et.length,Lt=ut.length,ot=0,ct+=2,_t=e(H/(ut[0]+1)),_t>1&&(ut=R(ut,_t,H),Et=R(Et,_t,H),Lt=ut.length,dt=Et.length),Ct=Lt,rt=Et.slice(0,Lt),st=rt.length;st=H/2&&Mt++;do{if(_t=0,Y=j(ut,rt,Lt,st),Y<0){if(yt=rt[0],Lt!=st&&(yt=yt*H+(rt[1]||0)),_t=e(yt/Mt),_t>1)for(_t>=H&&(_t=H-1),ht=R(ut,_t,H),vt=ht.length,st=rt.length;j(ht,rt,vt,st)==1;)_t--,z(ht,Lt=10;ct/=10,ot++);$(pt,K+(pt.e=ot+it*l-1)+1,G,mt)}else pt.e=it,pt.r=+mt;return pt}}();function ft(R,j,z,Z){var Q,K,G,H,Y;if(z==null?z=n:C(z,0,8),!R.c)return R.toString();if(Q=R.c[0],G=R.e,j==null)Y=B(R.c),Y=Z==1||Z==2&&(G<=d||G>=v)?F(Y,G):I(Y,G,"0");else if(R=$(new X(R),j,z),K=R.e,Y=B(R.c),H=Y.length,Z==1||Z==2&&(j<=K||K<=d)){for(;HH){if(--j>0)for(Y+=".";j--;Y+="0");}else if(j+=K-H,j>0)for(K+1==H&&(Y+=".");j--;Y+="0");return R.s<0&&Q?"-"+Y:Y}function et(R,j){for(var z,Z,Q=1,K=new X(R[0]);Q=10;Q/=10,Z++);return(z=Z+z*l-1)>T?R.c=R.e=null:z=10;H/=10,Q++);if(K=j-Q,K<0)K+=l,G=j,Y=mt[it=0],ot=e(Y/_t[Q-G-1]%10);else if(it=s((K+1)/l),it>=mt.length)if(Z){for(;mt.length<=it;mt.push(0));Y=ot=0,Q=1,K%=l,G=K-l+1}else break t;else{for(Y=H=mt[it],Q=1;H>=10;H/=10,Q++);K%=l,G=K-l+Q,ot=G<0?0:e(Y/_t[Q-G-1]%10)}if(Z=Z||j<0||mt[it+1]!=null||(G<0?Y:Y%_t[Q-G-1]),Z=z<4?(ot||Z)&&(z==0||z==(R.s<0?3:2)):ot>5||ot==5&&(z==4||Z||z==6&&(K>0?G>0?Y/_t[Q-G]:0:mt[it-1])%10&1||z==(R.s<0?8:7)),j<1||!mt[0])return mt.length=0,Z?(j-=R.e+1,mt[0]=_t[(l-j%l)%l],R.e=-j||0):mt[0]=R.e=0,R;if(K==0?(mt.length=it,H=1,it--):(mt.length=it+1,H=_t[l-K],mt[it]=G>0?e(Y/_t[Q-G]%_t[G])*H:0),Z)for(;;)if(it==0){for(K=1,G=mt[0];G>=10;G/=10,K++);for(G=mt[0]+=H,H=1;G>=10;G/=10,H++);K!=H&&(R.e++,mt[0]==f&&(mt[0]=1));break}else{if(mt[it]+=H,mt[it]!=f)break;mt[it--]=0,H=1}for(K=mt.length;mt[--K]===0;mt.pop());}R.e>T?R.c=R.e=null:R.e=v?F(j,z):I(j,z,"0"),R.s<0?"-"+j:j)}return q.absoluteValue=q.abs=function(){var R=new X(this);return R.s<0&&(R.s=1),R},q.comparedTo=function(R,j){return x(this,new X(R,j))},q.decimalPlaces=q.dp=function(R,j){var z,Z,Q,K=this;if(R!=null)return C(R,0,m),j==null?j=n:C(j,0,8),$(new X(K),R+K.e+1,j);if(!(z=K.c))return null;if(Z=((Q=z.length-1)-E(this.e/l))*l,Q=z[Q])for(;Q%10==0;Q/=10,Z--);return Z<0&&(Z=0),Z},q.dividedBy=q.div=function(R,j){return P(this,new X(R,j),L,n)},q.dividedToIntegerBy=q.idiv=function(R,j){return P(this,new X(R,j),0,1)},q.exponentiatedBy=q.pow=function(R,j){var z,Z,Q,K,G,H,Y,it,ot,mt=this;if(R=new X(R),R.c&&!R.isInteger())throw Error(o+"Exponent not an integer: "+J(R));if(j!=null&&(j=new X(j)),H=R.e>14,!mt.c||!mt.c[0]||mt.c[0]==1&&!mt.e&&mt.c.length==1||!R.c||!R.c[0])return ot=new X(Math.pow(+J(mt),H?R.s*(2-N(R)):+J(R))),j?ot.mod(j):ot;if(Y=R.s<0,j){if(j.c?!j.c[0]:!j.s)return new X(NaN);Z=!Y&&mt.isInteger()&&j.isInteger(),Z&&(mt=mt.mod(j))}else{if(R.e>9&&(mt.e>0||mt.e<-1||(mt.e==0?mt.c[0]>1||H&&mt.c[1]>=24e7:mt.c[0]<8e13||H&&mt.c[0]<=9999975e7)))return K=mt.s<0&&N(R)?-0:0,mt.e>-1&&(K=1/K),new X(Y?1/K:K);b&&(K=s(b/l+2))}for(H?(z=new X(.5),Y&&(R.s=1),it=N(R)):(Q=Math.abs(+J(R)),it=Q%2),ot=new X(O);;){if(it){if(ot=ot.times(mt),!ot.c)break;K?ot.c.length>K&&(ot.c.length=K):Z&&(ot=ot.mod(j))}if(Q){if(Q=e(Q/2),Q===0)break;it=Q%2}else if(R=R.times(z),$(R,R.e+1,1),R.e>14)it=N(R);else{if(Q=+J(R),Q===0)break;it=Q%2}mt=mt.times(mt),K?mt.c&&mt.c.length>K&&(mt.c.length=K):Z&&(mt=mt.mod(j))}return Z?ot:(Y&&(ot=O.div(ot)),j?ot.mod(j):K?$(ot,b,n,G):ot)},q.integerValue=function(R){var j=new X(this);return R==null?R=n:C(R,0,8),$(j,j.e+1,R)},q.isEqualTo=q.eq=function(R,j){return x(this,new X(R,j))===0},q.isFinite=function(){return!!this.c},q.isGreaterThan=q.gt=function(R,j){return x(this,new X(R,j))>0},q.isGreaterThanOrEqualTo=q.gte=function(R,j){return(j=x(this,new X(R,j)))===1||j===0},q.isInteger=function(){return!!this.c&&E(this.e/l)>this.c.length-2},q.isLessThan=q.lt=function(R,j){return x(this,new X(R,j))<0},q.isLessThanOrEqualTo=q.lte=function(R,j){return(j=x(this,new X(R,j)))===-1||j===0},q.isNaN=function(){return!this.s},q.isNegative=function(){return this.s<0},q.isPositive=function(){return this.s>0},q.isZero=function(){return!!this.c&&this.c[0]==0},q.minus=function(R,j){var z,Z,Q,K,G=this,H=G.s;if(R=new X(R,j),j=R.s,!H||!j)return new X(NaN);if(H!=j)return R.s=-j,G.plus(R);var Y=G.e/l,it=R.e/l,ot=G.c,mt=R.c;if(!Y||!it){if(!ot||!mt)return ot?(R.s=-j,R):new X(mt?G:NaN);if(!ot[0]||!mt[0])return mt[0]?(R.s=-j,R):new X(ot[0]?G:n==3?-0:0)}if(Y=E(Y),it=E(it),ot=ot.slice(),H=Y-it){for((K=H<0)?(H=-H,Q=ot):(it=Y,Q=mt),Q.reverse(),j=H;j--;Q.push(0));Q.reverse()}else for(Z=(K=(H=ot.length)<(j=mt.length))?H:j,H=j=0;j0)for(;j--;ot[z++]=0);for(j=f-1;Z>H;){if(ot[--Z]=0;){for(z=0,_t=yt[Q]%V,ht=yt[Q]/V|0,G=Y,K=Q+G;K>Q;)it=st[--G]%V,ot=st[G]/V|0,H=ht*it+ot*_t,it=_t*it+H%V*V+vt[K]+z,z=(it/pt|0)+(H/V|0)+ht*ot,vt[K--]=it%pt;vt[K]=z}return z?++Z:vt.splice(0,1),at(R,vt,Z)},q.negated=function(){var R=new X(this);return R.s=-R.s||null,R},q.plus=function(R,j){var z,Z=this,Q=Z.s;if(R=new X(R,j),j=R.s,!Q||!j)return new X(NaN);if(Q!=j)return R.s=-j,Z.minus(R);var K=Z.e/l,G=R.e/l,H=Z.c,Y=R.c;if(!K||!G){if(!H||!Y)return new X(Q/0);if(!H[0]||!Y[0])return Y[0]?R:new X(H[0]?Z:Q*0)}if(K=E(K),G=E(G),H=H.slice(),Q=K-G){for(Q>0?(G=K,z=Y):(Q=-Q,z=H),z.reverse();Q--;z.push(0));z.reverse()}for(Q=H.length,j=Y.length,Q-j<0&&(z=Y,Y=H,H=z,j=Q),Q=0;j;)Q=(H[--j]=H[j]+Y[j]+Q)/f|0,H[j]=f===H[j]?0:H[j]%f;return Q&&(H=[Q].concat(H),++G),at(R,H,G)},q.precision=q.sd=function(R,j){var z,Z,Q,K=this;if(R!=null&&R!==!!R)return C(R,1,m),j==null?j=n:C(j,0,8),$(new X(K),R,j);if(!(z=K.c))return null;if(Q=z.length-1,Z=Q*l+1,Q=z[Q]){for(;Q%10==0;Q/=10,Z--);for(Q=z[0];Q>=10;Q/=10,Z++);}return R&&K.e+1>Z&&(Z=K.e+1),Z},q.shiftedBy=function(R){return C(R,-p,p),this.times("1e"+R)},q.squareRoot=q.sqrt=function(){var R,j,z,Z,Q,K=this,G=K.c,H=K.s,Y=K.e,it=L+4,ot=new X("0.5");if(H!==1||!G||!G[0])return new X(!H||H<0&&(!G||G[0])?NaN:G?K:1/0);if(H=Math.sqrt(+J(K)),H==0||H==1/0?(j=B(G),(j.length+Y)%2==0&&(j+="0"),H=Math.sqrt(+j),Y=E((Y+1)/2)-(Y<0||Y%2),H==1/0?j="5e"+Y:(j=H.toExponential(),j=j.slice(0,j.indexOf("e")+1)+Y),z=new X(j)):z=new X(H+""),z.c[0]){for(Y=z.e,H=Y+it,H<3&&(H=0);;)if(Q=z,z=ot.times(Q.plus(P(K,Q,it,1))),B(Q.c).slice(0,H)===(j=B(z.c)).slice(0,H))if(z.e0&&vt>0){for(K=vt%H||H,ot=ht.substr(0,K);K0&&(ot+=it+ht.slice(K)),_t&&(ot="-"+ot)}Z=mt?ot+(z.decimalSeparator||"")+((Y=+z.fractionGroupSize)?mt.replace(new RegExp("\\d{"+Y+"}\\B","g"),"$&"+(z.fractionGroupSeparator||"")):mt):ot}return(z.prefix||"")+Z+(z.suffix||"")},q.toFraction=function(R){var j,z,Z,Q,K,G,H,Y,it,ot,mt,_t,ht=this,vt=ht.c;if(R!=null&&(H=new X(R),!H.isInteger()&&(H.c||H.s!==1)||H.lt(O)))throw Error(o+"Argument "+(H.isInteger()?"out of range: ":"not an integer: ")+J(H));if(!vt)return new X(ht);for(j=new X(O),it=z=new X(O),Z=Y=new X(O),_t=B(vt),K=j.e=_t.length-ht.e-1,j.c[0]=g[(G=K%l)<0?l+G:G],R=!R||H.comparedTo(j)>0?K>0?j:it:H,G=T,T=1/0,H=new X(_t),Y.c[0]=0;ot=P(H,j,0,1),Q=z.plus(ot.times(Z)),Q.comparedTo(R)!=1;)z=Z,Z=Q,it=Y.plus(ot.times(Q=it)),Y=Q,j=H.minus(ot.times(Q=j)),H=Q;return Q=P(R.minus(z),Z,0,1),Y=Y.plus(Q.times(it)),z=z.plus(Q.times(Z)),Y.s=it.s=ht.s,K=K*2,mt=P(it,Z,K,n).minus(ht).abs().comparedTo(P(Y,z,K,n).minus(ht).abs())<1?[it,Z]:[Y,z],T=G,mt},q.toNumber=function(){return+J(this)},q.toPrecision=function(R,j){return R!=null&&C(R,1,m),ft(this,R,j,2)},q.toString=function(R){var j,z=this,Z=z.s,Q=z.e;return Q===null?Z?(j="Infinity",Z<0&&(j="-"+j)):j="NaN":(R==null?j=Q<=d||Q>=v?F(B(z.c),Q):I(B(z.c),Q,"0"):R===10&&tt?(z=$(new X(z),L+Q+1,n),j=I(B(z.c),z.e,"0")):(C(R,2,k.length,"Base"),j=D(I(B(z.c),Q,"0"),10,R,Z,!0)),Z<0&&z.c[0]&&(j="-"+j)),j},q.valueOf=q.toJSON=function(){return J(this)},q._isBigNumber=!0,U!=null&&X.set(U),X}function E(U){var P=U|0;return U>0||U===P?P:P-1}function B(U){for(var P,D,W=1,q=U.length,O=U[0]+"";Wv^D?1:-1;for(n=(d=q.length)<(v=O.length)?d:v,L=0;LO[L]^D?1:-1;return d==v?0:d>v^D?1:-1}function C(U,P,D,W){if(UD||U!==e(U))throw Error(o+(W||"Argument")+(typeof U=="number"?UD?" out of range: ":" not an integer: ":" not a primitive number: ")+String(U))}function N(U){var P=U.c.length-1;return E(U.e/l)==P&&U.c[P]%2!=0}function F(U,P){return(U.length>1?U.charAt(0)+"."+U.slice(1):U)+(P<0?"e":"e+")+P}function I(U,P,D){var W,q;if(P<0){for(q=D+".";++P;q+=D);U=q+U}else if(W=U.length,++P>W){for(q=D,P-=W;--P;q+=D);U+=q}else P{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=Py(),r=class{constructor(){Pt(this,"BigNum");this.BigNum=(u,a)=>{let s=i.BigNumber.clone({DECIMAL_PLACES:a});return new s(u)}}winstonToAr(u,{formatted:a=!1,decimals:s=12,trim:e=!0}={}){let o=this.stringToBigNum(u,s).shiftedBy(-12);return a?o.toFormat(s):o.toFixed(s)}arToWinston(u,{formatted:a=!1}={}){let s=this.stringToBigNum(u).shiftedBy(12);return a?s.toFormat():s.toFixed(0)}compare(u,a){let s=this.stringToBigNum(u),e=this.stringToBigNum(a);return s.comparedTo(e)}isEqual(u,a){return this.compare(u,a)===0}isLessThan(u,a){let s=this.stringToBigNum(u),e=this.stringToBigNum(a);return s.isLessThan(e)}isGreaterThan(u,a){let s=this.stringToBigNum(u),e=this.stringToBigNum(a);return s.isGreaterThan(e)}add(u,a){let s=this.stringToBigNum(u);return this.stringToBigNum(a),s.plus(a).toFixed(0)}sub(u,a){let s=this.stringToBigNum(u);return this.stringToBigNum(a),s.minus(a).toFixed(0)}stringToBigNum(u,a=12){return this.BigNum(u,a)}};t.default=r}),Ny=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=class{constructor(a){Pt(this,"METHOD_GET","GET");Pt(this,"METHOD_POST","POST");Pt(this,"config");this.applyConfig(a)}applyConfig(a){this.config=this.mergeDefaults(a)}getConfig(){return this.config}mergeDefaults(a){let s=a.protocol||"http",e=a.port||(s==="https"?443:80);return{host:a.host||"127.0.0.1",protocol:s,port:e,timeout:a.timeout||2e4,logging:a.logging||!1,logger:a.logger||console.log,network:a.network}}async get(a,s){return await this.request(a,{...s,method:this.METHOD_GET})}async post(a,s,e){var c;let o=new Headers((e==null?void 0:e.headers)||{});return(c=o.get("content-type"))!=null&&c.includes("application/json")||o.append("content-type","application/json"),o.append("accept","application/json, text/plain, */*"),await this.request(a,{...e,method:this.METHOD_POST,body:typeof s!="string"?JSON.stringify(s):s,headers:o})}async request(a,s){var y,m;let e=new Headers((s==null?void 0:s.headers)||{}),o=`${this.config.protocol}://${this.config.host}:${this.config.port}`,c=s==null?void 0:s.responseType;s==null||delete s.responseType,a.startsWith("/")&&(a=a.slice(1)),this.config.network&&e.append("x-network",this.config.network),this.config.logging&&this.config.logger(`Requesting: ${o}/${a}`);let f=await fetch(`${o}/${a}`,{...s||{},headers:e});this.config.logging&&this.config.logger(`Response: ${f.url} - ${f.status}`);let l=(m=(y=f.headers.get("content-type"))==null?void 0:y.match(/charset=([^()<>@,;:\"/[\]?.=\s]*)/i))==null?void 0:m[1],p=f,g=async()=>{if(l)try{p.data=new TextDecoder(l).decode(await f.arrayBuffer())}catch{p.data=await f.text()}else p.data=await f.text()};if(c==="arraybuffer")p.data=await f.arrayBuffer();else if(c==="text")await g();else if(c==="webstream")p.data=r(f.body);else try{let M=await f.clone().json();typeof M!="object"?await g():p.data=await f.json(),M=null}catch{await g()}return p}};t.default=i;var r=a=>{let s=a;return typeof s[Symbol.asyncIterator]>"u"?(s[Symbol.asyncIterator]=u(a),s):a},u=function(a){return async function*(){let s=a.getReader();try{for(;;){let{done:e,value:o}=await s.read();if(e)return;yield o}}finally{s.releaseLock()}}}}),Pn=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var i=Co();function r(g){let y=0;for(let E=0;E{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=Pn(),r=class{constructor(){Pt(this,"keyLength",4096);Pt(this,"publicExponent",65537);Pt(this,"hashAlgorithm","sha256");Pt(this,"driver");if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let u=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),a=await this.driver.exportKey("jwk",u.privateKey);return{kty:a.kty,e:a.e,n:a.n,d:a.d,p:a.p,q:a.q,dp:a.dp,dq:a.dq,qi:a.qi}}async sign(u,a,{saltLength:s}={}){let e=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(u),a);return new Uint8Array(e)}async hash(u,a="SHA-256"){let s=await this.driver.digest(a,u);return new Uint8Array(s)}async verify(u,a,s){let e={kty:"RSA",e:"AQAB",n:u},o=await this.jwkToPublicCryptoKey(e),c=await this.driver.digest("SHA-256",a),f=await this.driver.verify({name:"RSA-PSS",saltLength:0},o,s,a),l=await this.driver.verify({name:"RSA-PSS",saltLength:32},o,s,a),p=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((o.algorithm.modulusLength-1)/8)-c.byteLength-2},o,s,a);return f||l||p}async jwkToCryptoKey(u){return this.driver.importKey("jwk",u,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(u){return this.driver.importKey("jwk",u,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let u=crypto==null?void 0:crypto.subtle;return u===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(a=>typeof u[a]=="function")}async encrypt(u,a,s){let e=await this.driver.importKey("raw",typeof a=="string"?i.stringToBuffer(a):a,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:s?i.stringToBuffer(s):i.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},e,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),c=new Uint8Array(16);crypto.getRandomValues(c);let f=await this.driver.encrypt({name:"AES-CBC",iv:c},o,u);return i.concatBuffers([c,f])}async decrypt(u,a,s){let e=await this.driver.importKey("raw",typeof a=="string"?i.stringToBuffer(a):a,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:s?i.stringToBuffer(s):i.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},e,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),c=u.slice(0,16),f=await this.driver.decrypt({name:"AES-CBC",iv:c},o,u.slice(16));return i.concatBuffers([f])}};t.default=r}),Dy=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=class{constructor(r){Pt(this,"api");this.api=r}getInfo(){return this.api.get("info").then(r=>r.data)}getPeers(){return this.api.get("peers").then(r=>r.data)}};t.default=i}),is=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.getError=void 0;var i=class extends Error{constructor(s,e={}){var a=(...u)=>(super(...u),Pt(this,"type"),Pt(this,"response"),this);e.message?a(e.message):a(),this.type=s,this.response=e.response}getType(){return this.type}};t.default=i;function r(a){let s=a.data;if(typeof a.data=="string")try{s=JSON.parse(a.data)}catch{}if(a.data instanceof ArrayBuffer||a.data instanceof Uint8Array)try{s=JSON.parse(s.toString())}catch{}return s?s.error||s:a.statusText||"unknown"}t.getError=r}),jy=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=po();async function r(a){if(Array.isArray(a)){let o=i.default.utils.concatBuffers([i.default.utils.stringToBuffer("list"),i.default.utils.stringToBuffer(a.length.toString())]);return await u(a,await i.default.crypto.hash(o,"SHA-384"))}let s=i.default.utils.concatBuffers([i.default.utils.stringToBuffer("blob"),i.default.utils.stringToBuffer(a.byteLength.toString())]),e=i.default.utils.concatBuffers([await i.default.crypto.hash(s,"SHA-384"),await i.default.crypto.hash(a,"SHA-384")]);return await i.default.crypto.hash(e,"SHA-384")}t.default=r;async function u(a,s){if(a.length<1)return s;let e=i.default.utils.concatBuffers([s,await r(a[0])]),o=await i.default.crypto.hash(e,"SHA-384");return await u(a.slice(1),o)}}),ed=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.debug=t.validatePath=t.arrayCompare=t.bufferToInt=t.intToBuffer=t.arrayFlatten=t.generateProofs=t.buildLayers=t.generateTransactionChunks=t.generateTree=t.computeRootHash=t.generateLeaves=t.chunkData=t.MIN_CHUNK_SIZE=t.MAX_CHUNK_SIZE=void 0;var i=po(),r=Pn();t.MAX_CHUNK_SIZE=256*1024,t.MIN_CHUNK_SIZE=32*1024;var u=32,a=32;async function s(F){let I=[],U=F,P=0;for(;U.byteLength>=t.MAX_CHUNK_SIZE;){let D=t.MAX_CHUNK_SIZE,W=U.byteLength-t.MAX_CHUNK_SIZE;W>0&&W({type:"leaf",id:await M(await Promise.all([M(I),M(E(P))])),dataHash:I,minByteRange:U,maxByteRange:P})))}t.generateLeaves=e;async function o(F){return(await c(F)).id}t.computeRootHash=o;async function c(F){return await l(await e(await s(F)))}t.generateTree=c;async function f(F){let I=await s(F),U=await e(I),P=await l(U),D=await p(P),W=I.slice(-1)[0];return W.maxByteRange-W.minByteRange===0&&(I.splice(I.length-1,1),D.splice(D.length-1,1)),{data_root:P.id,chunks:I,proofs:D}}t.generateTransactionChunks=f;async function l(F,I=0){if(F.length<2)return F[0];let U=[];for(let P=0;P{Array.isArray(U)?I.push(...y(U)):I.push(U)}),I}t.arrayFlatten=y;async function m(F,I){return I?{type:"branch",id:await M([await M(F.id),await M(I.id),await M(E(F.maxByteRange))]),byteRange:F.maxByteRange,maxByteRange:I.maxByteRange,leftChild:F,rightChild:I}:F}async function M(F){return Array.isArray(F)&&(F=i.default.utils.concatBuffers(F)),new Uint8Array(await i.default.crypto.hash(F))}function E(F){let I=new Uint8Array(u);for(var U=I.length-1;U>=0;U--){var P=F%256;I[U]=P,F=(F-P)/256}return I}t.intToBuffer=E;function B(F){let I=0;for(var U=0;UF.every((U,P)=>I[P]===U);t.arrayCompare=x;async function C(F,I,U,P,D){if(P<=0)return!1;if(I>=P)return C(F,0,P-1,P,D);if(I<0)return C(F,0,0,P,D);if(D.length==a+u){let v=D.slice(0,a),A=D.slice(v.length,v.length+u),T=await M([await M(v),await M(A)]);return(0,t.arrayCompare)(F,T)?{offset:P-1,leftBound:U,rightBound:P,chunkSize:P-U}:!1}let W=D.slice(0,a),q=D.slice(W.length,W.length+a),O=D.slice(W.length+q.length,W.length+q.length+u),L=B(O),n=D.slice(W.length+q.length+O.length),d=await M([await M(W),await M(q),await M(O)]);return(0,t.arrayCompare)(F,d)?I ${JSON.stringify(O)}`;return N(q,L)}t.debug=N}),ah=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.Tag=void 0;var i=Pn(),r=jy(),u=ed(),a=class{get(o,c){if(!Object.getOwnPropertyNames(this).includes(o))throw new Error(`Field "${o}" is not a property of the Arweave Transaction class.`);if(this[o]instanceof Uint8Array)return c&&c.decode&&c.string?i.bufferToString(this[o]):c&&c.decode&&!c.string?this[o]:i.bufferTob64Url(this[o]);if(this[o]instanceof Array){if((c==null?void 0:c.decode)!==void 0||(c==null?void 0:c.string)!==void 0)throw o==="tags"&&console.warn(`Did you mean to use 'transaction["tags"]' ?`),new Error("Cannot decode or stringify an array.");return this[o]}return c&&c.decode==!0?c&&c.string?i.b64UrlToString(this[o]):i.b64UrlToBuffer(this[o]):this[o]}},s=class extends a{constructor(c,f,l=!1){super();Pt(this,"name");Pt(this,"value");this.name=c,this.value=f}};t.Tag=s;var e=class extends a{constructor(c={}){super();Pt(this,"format",2);Pt(this,"id","");Pt(this,"last_tx","");Pt(this,"owner","");Pt(this,"tags",[]);Pt(this,"target","");Pt(this,"quantity","0");Pt(this,"data_size","0");Pt(this,"data",new Uint8Array);Pt(this,"data_root","");Pt(this,"reward","0");Pt(this,"signature","");Pt(this,"chunks");Object.assign(this,c),typeof this.data=="string"&&(this.data=i.b64UrlToBuffer(this.data)),c.tags&&(this.tags=c.tags.map(f=>new s(f.name,f.value)))}addTag(c,f){this.tags.push(new s(i.stringToB64Url(c),i.stringToB64Url(f)))}toJSON(){return{format:this.format,id:this.id,last_tx:this.last_tx,owner:this.owner,tags:this.tags,target:this.target,quantity:this.quantity,data:i.bufferTob64Url(this.data),data_size:this.data_size,data_root:this.data_root,data_tree:this.data_tree,reward:this.reward,signature:this.signature}}setOwner(c){this.owner=c}setSignature({id:c,owner:f,reward:l,tags:p,signature:g}){this.id=c,this.owner=f,l&&(this.reward=l),p&&(this.tags=p),this.signature=g}async prepareChunks(c){!this.chunks&&c.byteLength>0&&(this.chunks=await(0,u.generateTransactionChunks)(c),this.data_root=i.bufferTob64Url(this.chunks.data_root)),!this.chunks&&c.byteLength===0&&(this.chunks={chunks:[],data_root:new Uint8Array,proofs:[]},this.data_root="")}getChunk(c,f){if(!this.chunks)throw new Error("Chunks have not been prepared");let l=this.chunks.proofs[c],p=this.chunks.chunks[c];return{data_root:this.data_root,data_size:this.data_size,data_path:i.bufferTob64Url(l.proof),offset:l.offset.toString(),chunk:i.bufferTob64Url(f.slice(p.minByteRange,p.maxByteRange))}}async getSignatureData(){switch(this.format){case 1:let c=this.tags.reduce((l,p)=>i.concatBuffers([l,p.get("name",{decode:!0,string:!1}),p.get("value",{decode:!0,string:!1})]),new Uint8Array);return i.concatBuffers([this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),this.get("data",{decode:!0,string:!1}),i.stringToBuffer(this.quantity),i.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),c]);case 2:this.data_root||await this.prepareChunks(this.data);let f=this.tags.map(l=>[l.get("name",{decode:!0,string:!1}),l.get("value",{decode:!0,string:!1})]);return await(0,r.default)([i.stringToBuffer(this.format.toString()),this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),i.stringToBuffer(this.quantity),i.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),f,i.stringToBuffer(this.data_size),this.get("data_root",{decode:!0,string:!1})]);default:throw new Error(`Unexpected transaction format: ${this.format}`)}}};t.default=e}),Uy=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionUploader=void 0;var i=ah(),r=Pn(),u=is(),a=ed(),s=1,e=["invalid_json","chunk_too_big","data_path_too_big","offset_too_big","data_size_too_big","chunk_proof_ratio_not_attractive","invalid_proof"],o=1e3*40,c=class{constructor(f,l){Pt(this,"api");Pt(this,"chunkIndex",0);Pt(this,"txPosted",!1);Pt(this,"transaction");Pt(this,"lastRequestTimeEnd",0);Pt(this,"totalErrors",0);Pt(this,"data");Pt(this,"lastResponseStatus",0);Pt(this,"lastResponseError","");if(this.api=f,!l.id)throw new Error("Transaction is not signed");if(!l.chunks)throw new Error("Transaction chunks not prepared");this.data=l.data,this.transaction=new i.default(Object.assign({},l,{data:new Uint8Array(0)}))}get isComplete(){return this.txPosted&&this.chunkIndex===this.transaction.chunks.chunks.length}get totalChunks(){return this.transaction.chunks.chunks.length}get uploadedChunks(){return this.chunkIndex}get pctComplete(){return Math.trunc(this.uploadedChunks/this.totalChunks*100)}async uploadChunk(f){if(this.isComplete)throw new Error("Upload is already complete");if(this.lastResponseError!==""?this.totalErrors++:this.totalErrors=0,this.totalErrors===100)throw new Error(`Unable to complete upload: ${this.lastResponseStatus}: ${this.lastResponseError}`);let l=this.lastResponseError===""?0:Math.max(this.lastRequestTimeEnd+o-Date.now(),o);if(l>0&&(l=l-l*Math.random()*.3,await new Promise(y=>setTimeout(y,l))),this.lastResponseError="",!this.txPosted){await this.postTransaction();return}f&&(this.chunkIndex=f);let p=this.transaction.getChunk(f||this.chunkIndex,this.data);if(!await(0,a.validatePath)(this.transaction.chunks.data_root,parseInt(p.offset),0,parseInt(p.data_size),r.b64UrlToBuffer(p.data_path)))throw new Error(`Unable to validate chunk ${this.chunkIndex}`);let g=await this.api.post("chunk",this.transaction.getChunk(this.chunkIndex,this.data)).catch(y=>(console.error(y.message),{status:-1,data:{error:y.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=g.status,this.lastResponseStatus==200)this.chunkIndex++;else if(this.lastResponseError=(0,u.getError)(g),e.includes(this.lastResponseError))throw new Error(`Fatal error uploading chunk ${this.chunkIndex}: ${this.lastResponseError}`)}static async fromSerialized(f,l,p){if(!l||typeof l.chunkIndex!="number"||typeof l.transaction!="object")throw new Error("Serialized object does not match expected format.");var g=new i.default(l.transaction);g.chunks||await g.prepareChunks(p);let y=new c(f,g);if(y.chunkIndex=l.chunkIndex,y.lastRequestTimeEnd=l.lastRequestTimeEnd,y.lastResponseError=l.lastResponseError,y.lastResponseStatus=l.lastResponseStatus,y.txPosted=l.txPosted,y.data=p,y.transaction.data_root!==l.transaction.data_root)throw new Error("Data mismatch: Uploader doesn't match provided data.");return y}static async fromTransactionId(f,l){let p=await f.get(`tx/${l}`);if(p.status!==200)throw new Error(`Tx ${l} not found: ${p.status}`);let g=p.data;return g.data=new Uint8Array(0),{txPosted:!0,chunkIndex:0,lastResponseError:"",lastRequestTimeEnd:0,lastResponseStatus:0,transaction:g}}toJSON(){return{chunkIndex:this.chunkIndex,transaction:this.transaction,lastRequestTimeEnd:this.lastRequestTimeEnd,lastResponseStatus:this.lastResponseStatus,lastResponseError:this.lastResponseError,txPosted:this.txPosted}}async postTransaction(){if(this.totalChunks<=s){this.transaction.data=this.data;let l=await this.api.post("tx",this.transaction).catch(p=>(console.error(p),{status:-1,data:{error:p.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=l.status,this.transaction.data=new Uint8Array(0),l.status>=200&&l.status<300){this.txPosted=!0,this.chunkIndex=s;return}throw this.lastResponseError=(0,u.getError)(l),new Error(`Unable to upload transaction: ${l.status}, ${this.lastResponseError}`)}let f=await this.api.post("tx",this.transaction);if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=f.status,!(f.status>=200&&f.status<300))throw this.lastResponseError=(0,u.getError)(f),new Error(`Unable to upload transaction: ${f.status}, ${this.lastResponseError}`);this.txPosted=!0}};t.TransactionUploader=c}),Fy=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=is(),r=ah(),u=Pn(),a=Uy();Di();var s=class{constructor(e,o,c){Pt(this,"api");Pt(this,"crypto");Pt(this,"chunks");this.api=e,this.crypto=o,this.chunks=c}async getTransactionAnchor(){let e=await this.api.get("tx_anchor");if(!e.data.match(/^[a-z0-9_-]{43,}/i)||!e.ok)throw new Error(`Could not getTransactionAnchor. Received: ${e.data}. Status: ${e.status}, ${e.statusText}`);return e.data}async getPrice(e,o){let c=o?`price/${e}/${o}`:`price/${e}`,f=await this.api.get(c);if(!/^\d+$/.test(f.data)||!f.ok)throw new Error(`Could not getPrice. Received: ${f.data}. Status: ${f.status}, ${f.statusText}`);return f.data}async get(e){let o=await this.api.get(`tx/${e}`);if(o.status==200){let c=parseInt(o.data.data_size);if(o.data.format>=2&&c>0&&c<=1024*1024*12){let f=await this.getData(e);return new r.default({...o.data,data:f})}return new r.default({...o.data,format:o.data.format||1})}throw o.status==404?new i.default("TX_NOT_FOUND"):o.status==410?new i.default("TX_FAILED"):new i.default("TX_INVALID")}fromRaw(e){return new r.default(e)}async search(e,o){return this.api.post("arql",{op:"equals",expr1:e,expr2:o}).then(c=>c.data?c.data:[])}getStatus(e){return this.api.get(`tx/${e}/status`).then(o=>o.status==200?{status:200,confirmed:o.data}:{status:o.status,confirmed:null})}async getData(e,o){let c;try{c=await this.chunks.downloadChunkedData(e)}catch(f){console.error(`Error while trying to download chunked data for ${e}`),console.error(f)}if(!c){console.warn(`Falling back to gateway cache for ${e}`);try{let{data:f,ok:l,status:p,statusText:g}=await this.api.get(`/${e}`,{responseType:"arraybuffer"});if(!l)throw new Error("Bad http status code",{cause:{status:p,statusText:g}});c=f}catch(f){console.error(`Error while trying to download contiguous data from gateway cache for ${e}`),console.error(f)}}if(!c)throw new Error(`${e} data was not found!`);return o&&o.decode&&!o.string?c:o&&o.decode&&o.string?u.bufferToString(c):u.bufferTob64Url(c)}async sign(e,o,c){let f=typeof o=="object"&&(p=>{let g=!0;return["n","e","d","p","q","dp","dq","qi"].map(y=>!(y in p)&&(g=!1)),g})(o),l=typeof arweaveWallet=="object";if(!f&&!l)throw new Error("No valid JWK or external wallet found to sign transaction.");if(f){e.setOwner(o.n);let p=await e.getSignatureData(),g=await this.crypto.sign(o,p,c),y=await this.crypto.hash(g);e.setSignature({id:u.bufferTob64Url(y),owner:o.n,signature:u.bufferTob64Url(g)})}else if(l){try{(await arweaveWallet.getPermissions()).includes("SIGN_TRANSACTION")||await arweaveWallet.connect(["SIGN_TRANSACTION"])}catch{}let p=await arweaveWallet.sign(e,c);e.setSignature({id:p.id,owner:p.owner,reward:p.reward,tags:p.tags,signature:p.signature})}else throw new Error("An error occurred while signing. Check wallet is valid")}async verify(e){let o=await e.getSignatureData(),c=e.get("signature",{decode:!0,string:!1}),f=u.bufferTob64Url(await this.crypto.hash(c));if(e.id!==f)throw new Error("Invalid transaction signature or ID! The transaction ID doesn't match the expected SHA-256 hash of the signature.");return this.crypto.verify(e.owner,o,c)}async post(e){if(typeof e=="string"?e=new r.default(JSON.parse(e)):typeof e.readInt32BE=="function"?e=new r.default(JSON.parse(e.toString())):typeof e=="object"&&!(e instanceof r.default)&&(e=new r.default(e)),!(e instanceof r.default))throw new Error("Must be Transaction object");e.chunks||await e.prepareChunks(e.data);let o=await this.getUploader(e,e.data);try{for(;!o.isComplete;)await o.uploadChunk()}catch(c){if(o.lastResponseStatus>0)return{status:o.lastResponseStatus,statusText:o.lastResponseError,data:{error:o.lastResponseError}};throw c}return{status:200,statusText:"OK",data:{}}}async getUploader(e,o){let c;if(o instanceof ArrayBuffer&&(o=new Uint8Array(o)),e instanceof r.default){if(o||(o=e.data),!(o instanceof Uint8Array))throw new Error("Data format is invalid");e.chunks||await e.prepareChunks(o),c=new a.TransactionUploader(this.api,e),(!c.data||c.data.length===0)&&(c.data=o)}else{if(typeof e=="string"&&(e=await a.TransactionUploader.fromTransactionId(this.api,e)),!o||!(o instanceof Uint8Array))throw new Error("Must provide data when resuming upload");c=await a.TransactionUploader.fromSerialized(this.api,e,o)}return c}async*upload(e,o){let c=await this.getUploader(e,o);for(;!c.isComplete;)await c.uploadChunk(),yield c;return c}};t.default=s}),Ky=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=Pn();Di();var r=class{constructor(u,a){Pt(this,"api");Pt(this,"crypto");this.api=u,this.crypto=a}getBalance(u){return this.api.get(`wallet/${u}/balance`).then(a=>a.data)}getLastTransactionID(u){return this.api.get(`wallet/${u}/last_tx`).then(a=>a.data)}generate(){return this.crypto.generateJWK()}async jwkToAddress(u){return!u||u==="use_wallet"?this.getAddress():this.getAddress(u)}async getAddress(u){if(!u||u==="use_wallet"){try{await arweaveWallet.connect(["ACCESS_ADDRESS"])}catch{}return arweaveWallet.getActiveAddress()}else return this.ownerToAddress(u.n)}async ownerToAddress(u){return i.bufferTob64Url(await this.crypto.hash(i.b64UrlToBuffer(u)))}};t.default=r}),zy=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.SiloResource=void 0;var i=Pn(),r=class{constructor(a,s,e){Pt(this,"api");Pt(this,"crypto");Pt(this,"transactions");this.api=a,this.crypto=s,this.transactions=e}async get(a){if(!a)throw new Error("No Silo URI specified");let s=await this.parseUri(a),e=await this.transactions.search("Silo-Name",s.getAccessKey());if(e.length==0)throw new Error(`No data could be found for the Silo URI: ${a}`);let o=await this.transactions.get(e[0]);if(!o)throw new Error(`No data could be found for the Silo URI: ${a}`);let c=o.get("data",{decode:!0,string:!1});return this.crypto.decrypt(c,s.getEncryptionKey())}async readTransactionData(a,s){if(!s)throw new Error("No Silo URI specified");let e=await this.parseUri(s),o=a.get("data",{decode:!0,string:!1});return this.crypto.decrypt(o,e.getEncryptionKey())}async parseUri(a){let s=a.match(/^([a-z0-9-_]+)\.([0-9]+)/i);if(!s)throw new Error("Invalid Silo name, must be a name in the format of [a-z0-9]+.[0-9]+, e.g. 'bubble.7'");let e=s[1],o=Math.pow(2,parseInt(s[2])),c=await this.hash(i.stringToBuffer(e),o),f=i.bufferTob64(c.slice(0,15)),l=await this.hash(c.slice(16,31),1);return new u(a,f,l)}async hash(a,s){let e=await this.crypto.hash(a);for(let o=0;o{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=is(),r=Pn(),u=class{constructor(a){Pt(this,"api");this.api=a}async getTransactionOffset(a){let s=await this.api.get(`tx/${a}/offset`);if(s.status===200)return s.data;throw new Error(`Unable to get transaction offset: ${(0,i.getError)(s)}`)}async getChunk(a){let s=await this.api.get(`chunk/${a}`);if(s.status===200)return s.data;throw new Error(`Unable to get chunk: ${(0,i.getError)(s)}`)}async getChunkData(a){let s=await this.getChunk(a);return r.b64UrlToBuffer(s.chunk)}firstChunkOffset(a){return parseInt(a.offset)-parseInt(a.size)+1}async downloadChunkedData(a){let s=await this.getTransactionOffset(a),e=parseInt(s.size),o=parseInt(s.offset)-e+1,c=new Uint8Array(e),f=0;for(;f{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=is();Di();var r=class{constructor(a,s){Pt(this,"api");Pt(this,"network");this.api=a,this.network=s}async get(a){let s=await this.api.get(`${r.HASH_ENDPOINT}${a}`);if(s.status===200)return s.data;throw s.status===404?new i.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${s}`)}async getByHeight(a){let s=await this.api.get(`${r.HEIGHT_ENDPOINT}${a}`);if(s.status===200)return s.data;throw s.status===404?new i.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${s}`)}async getCurrent(){let{current:a}=await this.network.getInfo();return await this.get(a)}},u=r;Wr(u,"HASH_ENDPOINT","block/hash/"),Wr(u,"HEIGHT_ENDPOINT","block/height/"),t.default=u}),po=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0});var i=Ry(),r=Ny(),u=Ly(),a=Dy(),s=Fy(),e=Ky(),o=ah(),c=Pn(),f=zy(),l=Wy(),p=qy(),g=class{constructor(m){Pt(this,"api");Pt(this,"wallets");Pt(this,"transactions");Pt(this,"network");Pt(this,"blocks");Pt(this,"ar");Pt(this,"silo");Pt(this,"chunks");this.api=new r.default(m),this.wallets=new e.default(this.api,g.crypto),this.chunks=new l.default(this.api),this.transactions=new s.default(this.api,g.crypto,this.chunks),this.silo=new f.default(this.api,this.crypto,this.transactions),this.network=new a.default(this.api),this.blocks=new p.default(this.api,this.network),this.ar=new i.default}get crypto(){return g.crypto}get utils(){return g.utils}getConfig(){return{api:this.api.getConfig(),crypto:null}}async createTransaction(m,M){let E={};if(Object.assign(E,m),!m.data&&!(m.target&&m.quantity))throw new Error("A new Arweave transaction must have a 'data' value, or 'target' and 'quantity' values.");if(m.owner==null&&M&&M!=="use_wallet"&&(E.owner=M.n),m.last_tx==null&&(E.last_tx=await this.transactions.getTransactionAnchor()),typeof m.data=="string"&&(m.data=c.stringToBuffer(m.data)),m.data instanceof ArrayBuffer&&(m.data=new Uint8Array(m.data)),m.data&&!(m.data instanceof Uint8Array))throw new Error("Expected data to be a string, Uint8Array or ArrayBuffer");if(m.reward==null){let x=m.data?m.data.byteLength:0;E.reward=await this.transactions.getPrice(x,E.target)}E.data_root="",E.data_size=m.data?m.data.byteLength.toString():"0",E.data=m.data||new Uint8Array(0);let B=new o.default(E);return await B.getSignatureData(),B}async createSiloTransaction(m,M,E){let B={};if(Object.assign(B,m),!m.data)throw new Error("Silo transactions must have a 'data' value");if(!E)throw new Error("No Silo URI specified.");if(m.target||m.quantity)throw new Error("Silo transactions can only be used for storing data, sending AR to other wallets isn't supported.");if(m.owner==null){if(!M||!M.n)throw new Error("A new Arweave transaction must either have an 'owner' attribute, or you must provide the jwk parameter.");B.owner=M.n}m.last_tx==null&&(B.last_tx=await this.transactions.getTransactionAnchor());let x=await this.silo.parseUri(E);if(typeof m.data=="string"){let N=await this.crypto.encrypt(c.stringToBuffer(m.data),x.getEncryptionKey());B.reward=await this.transactions.getPrice(N.byteLength),B.data=c.bufferTob64Url(N)}if(m.data instanceof Uint8Array){let N=await this.crypto.encrypt(m.data,x.getEncryptionKey());B.reward=await this.transactions.getPrice(N.byteLength),B.data=c.bufferTob64Url(N)}let C=new o.default(B);return C.addTag("Silo-Name",x.getAccessKey()),C.addTag("Silo-Version","0.1.0"),C}arql(m){return this.api.post("/arql",m).then(M=>M.data||[])}},y=g;Wr(y,"init"),Wr(y,"crypto",new u.default),Wr(y,"utils",c),t.default=y}),$y=gt(t=>{lt(),Object.defineProperty(t,"__esModule",{value:!0}),t.getDefaultConfig=void 0;var i=(a,s)=>{let e=/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/,o=s.split("."),c=o[o.length-1],f=["localhost","[::1]"];return f.includes(s)||a=="file"||f.includes(c)||!!s.match(e)||!!c.match(e)},r=a=>{let s=a.charAt(0)==="[",e=/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/;return!!a.match(e)||s},u=(a,s)=>{if(i(a,s))return{protocol:"https",host:"arweave.net",port:443};if(!r(s)){let e=s.split(".");if(e.length>=3){e.shift();let o=e.join(".");return{protocol:a,host:o}}}return{protocol:a,host:s}};t.getDefaultConfig=u}),Hy=gt(t=>{lt();var i=t&&t.__createBinding||(Object.create?function(s,e,o,c){c===void 0&&(c=o);var f=Object.getOwnPropertyDescriptor(e,o);(!f||("get"in f?!e.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return e[o]}}),Object.defineProperty(s,c,f)}:function(s,e,o,c){c===void 0&&(c=o),s[c]=e[o]}),r=t&&t.__exportStar||function(s,e){for(var o in s)o!=="default"&&!Object.prototype.hasOwnProperty.call(e,o)&&i(e,s,o)};Object.defineProperty(t,"__esModule",{value:!0});var u=po(),a=$y();u.default.init=function(s={}){let e={host:"arweave.net",port:443,protocol:"https"};if(typeof location!="object"||!location.protocol||!location.hostname)return new u.default({...s,...e});let o=location.protocol.replace(":",""),c=location.hostname,f=location.port?parseInt(location.port):o=="https"?443:80,l=(0,a.getDefaultConfig)(o,c),p=s.protocol||l.protocol,g=s.host||l.host,y=s.port||l.port||f;return new u.default({...s,host:g,protocol:p,port:y})},typeof globalThis=="object"?globalThis.Arweave=u.default:typeof self=="object"&&(self.Arweave=u.default),r(po(),t),t.default=u.default});lt();lt();lt();var Gy=ye(Jn()),ur=ye(Au());Ko();lt();function Ti(t){return t.signatureLength!==void 0}function kl(t){return t.signatureLength!==void 0}lt();var Vy=ye(Lg()),Zy=ye(pi()),$a=ye(Au()),Ol=new Map([[2,"rust"]]),Jy=class{constructor(t,i,r){Pt(this,"src");Pt(this,"wasmSrcCodeDir");Pt(this,"wasmGlueCode");this.src=t,this.wasmSrcCodeDir=i,this.wasmGlueCode=r}async createWasmSrc(){let t=[],i,r={};Vy.default.meterWASM(this.src,{meterType:"i32"}),t.push(this.src);let u=await WebAssembly.compile(this.src),a=WebAssembly.Module.imports(u),s,e=await WebAssembly.instantiate(this.src,Xy(a));if(!e.instance.exports.lang)throw new Error('No info about source type in wasm binary. Did you forget to export "lang" function?');if(s=e.instance.exports.lang(),i=e.instance.exports.version(),!Ol.has(s))throw new Error(`Unknown wasm source type ${s}`);let o=Ol.get(s);if(this.wasmSrcCodeDir==null)throw new Error("No path to original wasm contract source code");let c=await this.zipContents(this.wasmSrcCodeDir);if(t.push(c),o=="rust"){if(!this.wasmGlueCode)throw new Error("No path to generated wasm-bindgen js code");let p=Zy.default.readFileSync(this.wasmGlueCode,"utf-8"),g=(0,$a.matchMutClosureDtor)(p);r.dtor=parseInt(g),t.push(Ut.Buffer.from(p))}let f=this.joinBuffers(t),l=[{name:$a.WARP_TAGS.WASM_LANG,value:o},{name:$a.WARP_TAGS.WASM_LANG_VERSION,value:i.toString()},{name:$a.WARP_TAGS.WASM_META,value:JSON.stringify(r)}];return{wasmData:f,srcWasmTags:l}}joinBuffers(t){let i=t.length,r=[];return r.push(Ut.Buffer.from(i.toString())),r.push(Ut.Buffer.from("|")),t.forEach(u=>{r.push(Ut.Buffer.from(u.length.toString())),r.push(Ut.Buffer.from("|"))}),r.push(...t),r.reduce((u,a)=>Ut.Buffer.concat([u,a]))}async zipContents(t){let i=nm(),r=om(),u=new r.WritableStreamBuffer({initialSize:1e3*1024,incrementAmount:1e3*1024}),a=i("zip",{zlib:{level:9}});return a.on("error",function(s){throw s}),a.pipe(u),a.directory(t.toString(),t.toString()),await a.finalize(),u.end(),u.getContents()}};function Xy(t){let i={};return t.forEach(r=>{Object.prototype.hasOwnProperty.call(i,r.module)||(i[r.module]={}),i[r.module][r.name]=function(){}}),i}var Yy=class{constructor(t){Pt(this,"logger",ur.LoggerFactory.INST.create("Source"));Pt(this,"signature");this.warp=t}async createSource(t,i,r=!1){this.logger.debug("Creating new contract source");let{src:u,wasmSrcCodeDir:a,wasmGlueCode:s,tags:e}=t,o=e||[];this.warp.environment=="local"&&(r=!0);let c=r==null?this.warp.definitionLoader.type()=="warp":!r;if(!c&&Ti(i))throw new Error("Only ArWallet | CustomSignature wallet type are allowed when bundling is disabled.");if(c&&!Ti(i))throw new Error("Only Signer wallet type is allowed when bundling is enabled.");let f=u instanceof Gy.Buffer?"wasm":"js";if(f=="js"&&!(0,ur.checkJsSrc)(t.src,this.logger))throw new Error('JS contract source does not contain properly exported "handle" function');let l=null,p=[];f=="wasm"&&({wasmData:l,srcWasmTags:p}=await new Jy(u,a,s).createWasmSrc());let g=f=="wasm"?l:u,y=o.concat([new ur.Tag(ur.SMART_WEAVE_TAGS.APP_NAME,"SmartWeaveContractSource"),new ur.Tag(ur.SMART_WEAVE_TAGS.APP_VERSION,"0.3.0"),new ur.Tag(ur.SMART_WEAVE_TAGS.SDK,"Warp"),new ur.Tag(ur.WARP_TAGS.NONCE,Date.now().toString()),new ur.Tag(ur.SMART_WEAVE_TAGS.CONTENT_TYPE,f=="js"?"application/javascript":"application/wasm")]);return r?this.createSourceArweave(i,g,y,p,f):await this.createSourceBundlr(i,y,p,f,g)}async saveSource(t,i){this.logger.debug("Saving contract source",t.id),this.warp.environment=="local"&&(i=!0);let r=i==null?this.warp.definitionLoader.type()=="warp":!i;if(kl(t)&&!r)throw new Error("Unable to save data item when bundling is disabled.");if(!kl(t)){let s=new ur.TagsParser().getTag(t,ur.WARP_TAGS.SIGNATURE_TYPE);if(s&&s!="arweave"&&!r)throw new Error(`Unable to save source with signature type: ${s} when bundling is disabled.`)}let u,a;if(r){let s=await this.postSource(t.getRaw());this.logger.debug(s),u=!0}else a=await this.warp.arweave.transactions.post(t),u=a.status===200||a.status===208;if(u)return t.id;throw new Error(`Unable to write Contract Source. Arweave responded with status ${a.status}: ${a.statusText}`)}async postSource(t){return await(0,ur.getJsonResponse)(fetch(`${this.warp.gwUrl()}/gateway/v2/sources/deploy`,{method:"POST",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},body:t}))}async createSourceArweave(t,i,r,u,a){if(this.signature=new ur.Signature(this.warp,t),this.signature.type!=="arweave")throw new Error(`Unable to use signing function of type: ${this.signature.type}.`);let s=this.signature.signer,e=await this.warp.arweave.createTransaction({data:i});return r.forEach(o=>e.addTag(o.name,o.value)),a=="wasm"&&u.forEach(o=>e.addTag(o.name,o.value)),this.warp.environment==="testnet"&&e.addTag(ur.WARP_TAGS.WARP_TESTNET,"1.0.0"),await s(e),this.logger.debug("Posting transaction with source"),e}async createSourceBundlr(t,i,r,u,a){let s=[...i];u=="wasm"&&r.forEach(o=>s.push(new ur.Tag(o.name,o.value))),this.warp.environment==="testnet"&&s.push(new ur.Tag(ur.WARP_TAGS.WARP_TESTNET,"1.0.0"));let e;return(0,ur.isBrowser)()&&t.signer&&t.signer.signDataItem?e=await t.signDataItem(a,s):(e=Fo(a,t,{tags:s}),await e.sign(t)),this.logger.debug("Posting transaction with source"),e}},rr=ye(Au());Ko();var Qy=class{constructor(t){Pt(this,"logger",rr.LoggerFactory.INST.create("DefaultCreateContract"));Pt(this,"source");Pt(this,"signature");Pt(this,"warpFetchWrapper");this.warp=t,this.deployFromSourceTx=this.deployFromSourceTx.bind(this),this.source=new Yy(this.warp),this.warpFetchWrapper=new rr.WarpFetchWrapper(this.warp)}async deploy(t,i){let{wallet:r,initState:u,tags:a,transfer:s,data:e,evaluationManifest:o}=t,c,f=i==null?this.warp.definitionLoader.type()=="warp":!i;c=await this.source.createSource(t,r,!f),f||await this.source.saveSource(c,!0),this.logger.debug("Creating new contract");let l=await c.id;return await this.deployFromSourceTx({srcTxId:l,wallet:r,initState:u,tags:a,transfer:s,data:e,evaluationManifest:o},!f,c)}async deployFromSourceTx(t,i,r=null){this.logger.debug("Creating new contract from src tx");let{wallet:u,srcTxId:a,initState:s,data:e}=t,o,c,f,l=i==null?this.warp.definitionLoader.type()=="warp":!i;if(!l&&Ti(u))throw new Error("Only ArWallet | CustomSignature wallet type are allowed when bundling is disabled.");if(l&&!Ti(u))throw new Error("Only Signer wallet type is allowed when bundling is enabled.");let p={contract:[{name:rr.SMART_WEAVE_TAGS.APP_NAME,value:"SmartWeaveContract"},{name:rr.SMART_WEAVE_TAGS.APP_VERSION,value:"0.3.0"},{name:rr.SMART_WEAVE_TAGS.CONTRACT_SRC_TX_ID,value:a},{name:rr.SMART_WEAVE_TAGS.SDK,value:"Warp"},{name:rr.WARP_TAGS.NONCE,value:Date.now().toString()}],contractData:[{name:rr.SMART_WEAVE_TAGS.CONTENT_TYPE,value:e&&e["Content-Type"]},{name:rr.WARP_TAGS.INIT_STATE,value:s}],contractNonData:[{name:rr.SMART_WEAVE_TAGS.CONTENT_TYPE,value:"application/json"}],contractTestnet:[{name:rr.WARP_TAGS.WARP_TESTNET,value:"1.0.0"}],contractEvaluationManifest:[{name:rr.WARP_TAGS.MANIFEST,value:JSON.stringify(t.evaluationManifest)}]};l?{contract:o,responseOk:c}=await this.deployContractBundlr(t,p,r):{contract:o,responseOk:c}=await this.deployContractArweave(l,t,p);let g=await o.id;if(c)return{contractTxId:g,srcTxId:a};throw new Error(`Unable to write Contract. Arweave responded with status ${f.status}: ${f.statusText}`)}async deployBundled(t){return await(0,rr.getJsonResponse)(fetch(`${this.warp.gwUrl()}/gateway/contracts/deploy-bundled`,{method:"POST",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},body:t}))}async register(t,i){return await(0,rr.getJsonResponse)(fetch(`${this.warp.gwUrl()}/gateway/contracts/register`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({id:t,registerProvider:i})}))}async createSource(t,i,r=!1){return this.source.createSource(t,i,r)}async saveSource(t,i){return this.source.saveSource(t,i)}async postContract(t,i=null){let r={contract:t};return i&&(r={...r,src:i}),await(0,rr.getJsonResponse)(this.warpFetchWrapper.fetch(`${this.warp.gwUrl()}/gateway/v2/contracts/deploy`,{method:"POST",body:JSON.stringify(r),headers:{"Accept-Encoding":"gzip, deflate, br","Content-Type":"application/json",Accept:"application/json"}}))}async deployContractArweave(t,i,r){let{wallet:u,initState:a,transfer:s,data:e,tags:o}=i;this.signature=new rr.Signature(this.warp,u),!Ti(u)&&this.signature.checkNonArweaveSigningAvailability(t);let c=this.signature.signer;!Ti(u)&&this.signature.checkNonArweaveSigningAvailability(t);let f=await this.warp.arweave.createTransaction({data:(e==null?void 0:e.body)||a});if(+(s==null?void 0:s.winstonQty)>0&&s.target.length&&(this.logger.debug("Creating additional transaction with AR transfer",s),f=await this.warp.arweave.createTransaction({data:(e==null?void 0:e.body)||a,target:s.target,quantity:s.winstonQty})),o==null?void 0:o.length)for(let p of o)f.addTag(p.name.toString(),p.value.toString());r.contract.forEach(p=>f.addTag(p.name,p.value)),e?r.contractData.forEach(p=>f.addTag(p.name,p.value)):r.contractNonData.forEach(p=>f.addTag(p.name,p.value)),this.warp.environment==="testnet"&&r.contractTestnet.forEach(p=>f.addTag(p.name,p.value)),i.evaluationManifest&&r.contractEvaluationManifest.forEach(p=>f.addTag(p.name,p.value)),await c(f);let l=await this.warp.arweave.transactions.post(f);return{contract:f,responseOk:l.status===200||l.status===208}}async deployContractBundlr(t,i,r=null){let{wallet:u,initState:a,data:s,tags:e}=t,o=[...i.contract];if(e!=null&&e.length)for(let f of e)o.push(new rr.Tag(f.name.toString(),f.value.toString()));s?i.contractData.forEach(f=>o.push(new rr.Tag(f.name,f.value))):i.contractNonData.forEach(f=>o.push(new rr.Tag(f.name,f.value))),this.warp.environment==="testnet"&&i.contractTestnet.forEach(f=>o.push(new rr.Tag(f.name,f.value))),t.evaluationManifest&&i.contractEvaluationManifest.forEach(f=>o.push(new rr.Tag(f.name,f.value)));let c;return(0,rr.isBrowser)()&&u.signer&&u.signer.signDataItem?c=await u.signDataItem((s==null?void 0:s.body)||a,o):(c=Fo((s==null?void 0:s.body)||a,u,{tags:o}),await c.sign(u)),await this.postContract(c.getRaw(),r==null?void 0:r.getRaw()),{contract:c,responseOk:!0}}isRegisterProviderType(t){return rr.REGISTER_PROVIDER.includes(t)}};lt();var Aw=class{process(t){return new Qy(t)}type(){return"deploy"}};lt();lt();var rd={};ba(rd,{AVSCTap:()=>Oh,AlgorandSigner:()=>nw,AptosSigner:()=>aw,ArconnectSigner:()=>uw,Arweave:()=>Wd,ArweaveSigner:()=>Zd,Bundle:()=>F1,BundleItem:()=>mw,CryptoDriver:()=>qd,Curve25519:()=>ka,DataItem:()=>ma,EthereumSigner:()=>bs,HexInjectedSolanaSigner:()=>R1,HexSolanaSigner:()=>iw,InjectedAptosSigner:()=>N1,InjectedEthereumSigner:()=>Z6,InjectedSolanaSigner:()=>Jd,InjectedTypedEthereumSigner:()=>ow,MAX_TAG_BYTES:()=>Bh,MIN_BINARY_SIZE:()=>Ih,MultiSignatureAptosSigner:()=>L1,NearSigner:()=>rw,PolygonSigner:()=>ew,Rsa4096:()=>$d,SIG_CONFIG:()=>qe,SignatureConfig:()=>Ae,Signer:()=>tb,SolanaSigner:()=>Th,TypedEthereumSigner:()=>D1,bundleAndSignData:()=>pw,byteArrayToLong:()=>pr,concatBuffers:()=>Tr,createData:()=>W1,deepHash:()=>Oa,deserializeTags:()=>Bo,exportForTesting:()=>Q6,getCryptoDriver:()=>Ar,getSignatureAndId:()=>z1,indexToType:()=>kh,keccak256:()=>Mh,longTo16ByteArray:()=>lw,longTo32ByteArray:()=>fu,longTo8ByteArray:()=>lu,longToNByteArray:()=>Ba,secp256k1:()=>P1,serializeTags:()=>U1,shortTo2ByteArray:()=>j1,sign:()=>Ch,stringToBuffer:()=>je,unbundleData:()=>dw});lt();lt();lt();var tb=class{constructor(){Pt(this,"publicKey");Pt(this,"signatureType");Pt(this,"signatureLength");Pt(this,"ownerLength");Pt(this,"pem")}static verify(t,i,r,u){throw new Error("You must implement verify method on child")}};lt();lt();var eb=ye(Gr(),1);lt();var Ae;(function(t){t[t.ARWEAVE=1]="ARWEAVE",t[t.ED25519=2]="ED25519",t[t.ETHEREUM=3]="ETHEREUM",t[t.SOLANA=4]="SOLANA",t[t.INJECTEDAPTOS=5]="INJECTEDAPTOS",t[t.MULTIAPTOS=6]="MULTIAPTOS",t[t.TYPEDETHEREUM=7]="TYPEDETHEREUM"})(Ae||(Ae={}));var qe={[Ae.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[Ae.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[Ae.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[Ae.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[Ae.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[Ae.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[Ae.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}};lt();var rb=ye(gi(),1),vr=BigInt(0),Pe=BigInt(1),zn=BigInt(2),nb=BigInt(8),Il=BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),tr=Object.freeze({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l:Il,n:Il,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")}),nd=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),na=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742");var ib=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),ab=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),ob=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),sb=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),De=class{constructor(t,i,r,u){this.x=t,this.y=i,this.z=r,this.t=u}static fromAffine(t){if(!(t instanceof fr))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return t.equals(fr.ZERO)?De.ZERO:new De(t.x,t.y,Pe,ie(t.x*t.y))}static toAffineBatch(t){let i=lb(t.map(r=>r.z));return t.map((r,u)=>r.toAffine(i[u]))}static normalizeZ(t){return this.toAffineBatch(t).map(this.fromAffine)}equals(t){Cl(t);let{x:i,y:r,z:u}=this,{x:a,y:s,z:e}=t,o=ie(i*e),c=ie(a*u),f=ie(r*e),l=ie(s*u);return o===c&&f===l}negate(){return new De(ie(-this.x),this.y,this.z,ie(-this.t))}double(){let{x:t,y:i,z:r}=this,{a:u}=tr,a=ie(t*t),s=ie(i*i),e=ie(zn*ie(r*r)),o=ie(u*a),c=t+i,f=ie(ie(c*c)-a-s),l=o+s,p=l-e,g=o-s,y=ie(f*p),m=ie(l*g),M=ie(f*g),E=ie(p*l);return new De(y,m,E,M)}add(t){Cl(t);let{x:i,y:r,z:u,t:a}=this,{x:s,y:e,z:o,t:c}=t,f=ie((r-i)*(e+s)),l=ie((r+i)*(e-s)),p=ie(l-f);if(p===vr)return this.double();let g=ie(u*zn*c),y=ie(a*zn*o),m=y+g,M=l+f,E=y-g,B=ie(m*p),x=ie(M*E),C=ie(m*E),N=ie(p*M);return new De(B,x,N,C)}subtract(t){return this.add(t.negate())}precomputeWindow(t){let i=1+256/t,r=[],u=this,a=u;for(let s=0;s>=l,y>o&&(y-=f,t+=Pe);let m=g,M=g+Math.abs(y)-1,E=p%2!==0,B=y<0;y===0?s=s.add(Bl(E,u[m])):a=a.add(Bl(B,u[M]))}return De.normalizeZ([a,s])[0]}multiply(t,i){return this.wNAF(yo(t,tr.l),i)}multiplyUnsafe(t){let i=yo(t,tr.l,!1),r=De.BASE,u=De.ZERO;if(i===vr)return u;if(this.equals(u)||i===Pe)return this;if(this.equals(r))return this.wNAF(i);let a=u,s=this;for(;i>vr;)i&Pe&&(a=a.add(s)),s=s.double(),i>>=Pe;return a}isSmallOrder(){return this.multiplyUnsafe(tr.h).equals(De.ZERO)}isTorsionFree(){let t=this.multiplyUnsafe(tr.l/zn).double();return tr.l%zn&&(t=t.add(this)),t.equals(De.ZERO)}toAffine(t){let{x:i,y:r,z:u}=this,a=this.equals(De.ZERO);t==null&&(t=a?nb:as(u));let s=ie(i*t),e=ie(r*t),o=ie(u*t);if(a)return fr.ZERO;if(o!==Pe)throw new Error("invZ was invalid");return new fr(s,e)}fromRistrettoBytes(){ks()}toRistrettoBytes(){ks()}fromRistrettoHash(){ks()}};De.BASE=new De(tr.Gx,tr.Gy,Pe,ie(tr.Gx*tr.Gy));De.ZERO=new De(vr,Pe,Pe,vr);function Bl(t,i){let r=i.negate();return t?r:i}function Cl(t){if(!(t instanceof De))throw new TypeError("ExtendedPoint expected")}function xs(t){if(!(t instanceof an))throw new TypeError("RistrettoPoint expected")}function ks(){throw new Error("Legacy method: switch to RistrettoPoint")}var an=class{constructor(t){this.ep=t}static calcElligatorRistrettoMap(t){let{d:i}=tr,r=ie(na*t*t),u=ie((r+Pe)*ob),a=BigInt(-1),s=ie((a-i*r)*ie(r+i)),{isValid:e,value:o}=sh(u,s),c=ie(o*t);Fn(c)||(c=ie(-c)),e||(o=c),e||(a=r);let f=ie(a*(r-Pe)*sb-s),l=o*o,p=ie((o+o)*s),g=ie(f*ib),y=ie(Pe-l),m=ie(Pe+l);return new De(ie(p*m),ie(y*g),ie(g*m),ie(p*y))}static hashToCurve(t){t=Gn(t,64);let i=Os(t.slice(0,32)),r=this.calcElligatorRistrettoMap(i),u=Os(t.slice(32,64)),a=this.calcElligatorRistrettoMap(u);return new an(r.add(a))}static fromHex(t){t=Gn(t,32);let{a:i,d:r}=tr,u="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",a=Os(t);if(!cb(ha(a),t)||Fn(a))throw new Error(u);let s=ie(a*a),e=ie(Pe+i*s),o=ie(Pe-i*s),c=ie(e*e),f=ie(o*o),l=ie(i*r*c-f),{isValid:p,value:g}=Rl(ie(l*f)),y=ie(g*o),m=ie(g*y*l),M=ie((a+a)*y);Fn(M)&&(M=ie(-M));let E=ie(e*m),B=ie(M*E);if(!p||Fn(B)||E===vr)throw new Error(u);return new an(new De(M,E,Pe,B))}toRawBytes(){let{x:t,y:i,z:r,t:u}=this.ep,a=ie(ie(r+i)*ie(r-i)),s=ie(t*i),e=ie(s*s),{value:o}=Rl(ie(a*e)),c=ie(o*a),f=ie(o*s),l=ie(c*f*u),p;if(Fn(u*l)){let y=ie(i*na),m=ie(t*na);t=y,i=m,p=ie(c*ab)}else p=f;Fn(t*l)&&(i=ie(-i));let g=ie((r-i)*p);return Fn(g)&&(g=ie(-g)),ha(g)}toHex(){return Ma(this.toRawBytes())}toString(){return this.toHex()}equals(t){xs(t);let i=this.ep,r=t.ep,u=ie(i.x*r.y)===ie(i.y*r.x),a=ie(i.y*r.y)===ie(i.x*r.x);return u||a}add(t){return xs(t),new an(this.ep.add(t.ep))}subtract(t){return xs(t),new an(this.ep.subtract(t.ep))}multiply(t){return new an(this.ep.multiply(t))}multiplyUnsafe(t){return new an(this.ep.multiplyUnsafe(t))}};an.BASE=new an(De.BASE);an.ZERO=new an(De.ZERO);var Zs=new WeakMap,fr=class{constructor(t,i){this.x=t,this.y=i}_setWindowSize(t){this._WINDOW_SIZE=t,Zs.delete(this)}static fromHex(t,i=!0){let{d:r,P:u}=tr;t=Gn(t,32);let a=t.slice();a[31]=t[31]&-129;let s=xa(a);if(i&&s>=u)throw new Error("Expected 0 < hex < P");if(!i&&s>=nd)throw new Error("Expected 0 < hex < 2**256");let e=ie(s*s),o=ie(e-Pe),c=ie(r*e+Pe),{isValid:f,value:l}=sh(o,c);if(!f)throw new Error("Point.fromHex: invalid y coordinate");let p=(l&Pe)===Pe;return(t[31]&128)!==0!==p&&(l=ie(-l)),new fr(l,s)}static async fromPrivateKey(t){return(await uh(t)).point}toRawBytes(){let t=ha(this.y);return t[31]|=this.x&Pe?128:0,t}toHex(){return Ma(this.toRawBytes())}toX25519(){let{y:t}=this,i=ie((Pe+t)*as(Pe-t));return ha(i)}isTorsionFree(){return De.fromAffine(this).isTorsionFree()}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new fr(ie(-this.x),this.y)}add(t){return De.fromAffine(this).add(De.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return De.fromAffine(this).multiply(t,this).toAffine()}};fr.BASE=new fr(tr.Gx,tr.Gy);fr.ZERO=new fr(vr,Pe);var go=class{constructor(t,i){this.r=t,this.s=i,this.assertValidity()}static fromHex(t){let i=Gn(t,64),r=fr.fromHex(i.slice(0,32),!1),u=xa(i.slice(32,64));return new go(r,u)}assertValidity(){let{r:t,s:i}=this;if(!(t instanceof fr))throw new Error("Expected Point instance");return yo(i,tr.l,!1),this}toRawBytes(){let t=new Uint8Array(64);return t.set(this.r.toRawBytes()),t.set(ha(this.s),32),t}toHex(){return Ma(this.toRawBytes())}};function Pl(...t){if(!t.every(u=>u instanceof Uint8Array))throw new Error("Expected Uint8Array list");if(t.length===1)return t[0];let i=t.reduce((u,a)=>u+a.length,0),r=new Uint8Array(i);for(let u=0,a=0;ui.toString(16).padStart(2,"0"));function Ma(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let i="";for(let r=0;r=vr?r:i+r}function as(t,i=tr.P){if(t===vr||i<=vr)throw new Error(`invert: expected positive integers, got n=${t} mod=${i}`);let r=ie(t,i),u=i,a=vr,s=Pe;for(;r!==vr;){let e=u/r,o=u%r,c=a-s*e;u=r,r=o,a=s,s=c}if(u!==Pe)throw new Error("invert: does not exist");return ie(a,i)}function lb(t,i=tr.P){let r=new Array(t.length),u=t.reduce((s,e,o)=>e===vr?s:(r[o]=s,ie(s*e,i)),Pe),a=as(u,i);return t.reduceRight((s,e,o)=>e===vr?s:(r[o]=ie(s*r[o],i),ie(s*e,i)),a),r}function gn(t,i){let{P:r}=tr,u=t;for(;i-- >vr;)u*=u,u%=r;return u}function fb(t){let{P:i}=tr,r=BigInt(5),u=BigInt(10),a=BigInt(20),s=BigInt(40),e=BigInt(80),o=t*t%i*t%i,c=gn(o,zn)*o%i,f=gn(c,Pe)*t%i,l=gn(f,r)*f%i,p=gn(l,u)*l%i,g=gn(p,a)*p%i,y=gn(g,s)*g%i,m=gn(y,e)*y%i,M=gn(m,e)*y%i,E=gn(M,u)*l%i;return{pow_p_5_8:gn(E,zn)*t%i,b2:o}}function sh(t,i){let r=ie(i*i*i),u=ie(r*r*i),a=fb(t*u).pow_p_5_8,s=ie(t*r*a),e=ie(i*s*s),o=s,c=ie(s*na),f=e===t,l=e===ie(-t),p=e===ie(-t*na);return f&&(s=o),(l||p)&&(s=c),Fn(s)&&(s=ie(-s)),{isValid:f||l,value:s}}function Rl(t){return sh(Pe,t)}function mo(t){return ie(xa(t),tr.l)}function cb(t,i){if(t.length!==i.length)return!1;for(let r=0;r{if(t=Gn(t),t.length<40||t.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return ie(xa(t),tr.l-Pe)+Pe},randomBytes:(t=32)=>{if(Ln.web)return Ln.web.getRandomValues(new Uint8Array(t));if(Ln.node){let{randomBytes:i}=Ln.node;return new Uint8Array(i(t).buffer)}else throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>Pi.randomBytes(32),sha512:async(...t)=>{let i=Pl(...t);if(Ln.web){let r=await Ln.web.subtle.digest("SHA-512",i.buffer);return new Uint8Array(r)}else{if(Ln.node)return Uint8Array.from(Ln.node.createHash("sha512").update(i).digest());throw new Error("The environment doesn't have sha512 function")}},precompute(t=8,i=fr.BASE){let r=i.equals(fr.BASE)?i:new fr(i.x,i.y);return r._setWindowSize(t),r.multiply(zn),r},sha512Sync:void 0};Object.defineProperties(Pi,{sha512Sync:{configurable:!1,get(){return Is},set(t){Is||(Is=t)}}});var ka=class{constructor(t,i){Pt(this,"_key");Pt(this,"pk");Pt(this,"ownerLength",qe[2].pubLength);Pt(this,"signatureLength",qe[2].sigLength);Pt(this,"_publicKey");Pt(this,"signatureType",2);this._key=t,this.pk=i}get publicKey(){return this._publicKey}get key(){throw new Error("You must implement `key`")}sign(t){return mb(Ut.Buffer.from(t),Ut.Buffer.from(this.key))}static async verify(t,i,r){let u=t;return typeof t=="string"&&(u=eb.default.toBuffer(t)),os(Ut.Buffer.from(r),Ut.Buffer.from(i),Ut.Buffer.from(u))}};lt();lt();lt();lt();lt();var ad={};ba(ad,{arToWinston:()=>Eb,b64UrlDecode:()=>fd,b64UrlEncode:()=>ld,b64UrlToBuffer:()=>on,b64UrlToString:()=>ud,bufferToString:()=>hh,bufferTob64:()=>hd,bufferTob64Url:()=>un,concatBuffers:()=>Tr,stringToB64Url:()=>Js,stringToBuffer:()=>je,winstonToAr:()=>_b});lt();var od=ye(Co(),1);lt();var vb=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Bs=Math.ceil,Ur=Math.floor,Br="[BigNumber Error] ",Nl=Br+"Number primitive has more than 15 significant digits: ",Qr=1e14,ve=14,Cs=9007199254740991,Ps=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Dn=1e7,mr=1e9;function sd(t){var i,r,u,a=x.prototype={constructor:x,toString:null,valueOf:null},s=new x(1),e=20,o=4,c=-7,f=21,l=-1e7,p=1e7,g=!1,y=1,m=0,M={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},E="0123456789abcdefghijklmnopqrstuvwxyz",B=!0;function x(P,D){var W,q,O,L,n,d,v,A,T=this;if(!(T instanceof x))return new x(P,D);if(D==null){if(P&&P._isBigNumber===!0){T.s=P.s,!P.c||P.e>p?T.c=T.e=null:P.e=10;n/=10,L++);L>p?T.c=T.e=null:(T.e=L,T.c=[P]);return}A=String(P)}else{if(!vb.test(A=String(P)))return u(T,A,d);T.s=A.charCodeAt(0)==45?(A=A.slice(1),-1):1}(L=A.indexOf("."))>-1&&(A=A.replace(".","")),(n=A.search(/e/i))>0?(L<0&&(L=n),L+=+A.slice(n+1),A=A.substring(0,n)):L<0&&(L=A.length)}else{if(nr(D,2,E.length,"Base"),D==10&&B)return T=new x(P),I(T,e+T.e+1,o);if(A=String(P),d=typeof P=="number"){if(P*0!=0)return u(T,A,d,D);if(T.s=1/P<0?(A=A.slice(1),-1):1,x.DEBUG&&A.replace(/^0\.0*|\./,"").length>15)throw Error(Nl+P)}else T.s=A.charCodeAt(0)===45?(A=A.slice(1),-1):1;for(W=E.slice(0,D),L=n=0,v=A.length;nL){L=v;continue}}else if(!O&&(A==A.toUpperCase()&&(A=A.toLowerCase())||A==A.toLowerCase()&&(A=A.toUpperCase()))){O=!0,n=-1,L=0;continue}return u(T,String(P),d,D)}d=!1,A=r(A,D,10,T.s),(L=A.indexOf("."))>-1?A=A.replace(".",""):L=A.length}for(n=0;A.charCodeAt(n)===48;n++);for(v=A.length;A.charCodeAt(--v)===48;);if(A=A.slice(n,++v)){if(v-=n,d&&x.DEBUG&&v>15&&(P>Cs||P!==Ur(P)))throw Error(Nl+T.s*P);if((L=L-n-1)>p)T.c=T.e=null;else if(L=-mr&&O<=mr&&O===Ur(O)){if(q[0]===0){if(O===0&&q.length===1)return!0;break t}if(D=(O+1)%ve,D<1&&(D+=ve),String(q[0]).length==D){for(D=0;D=Qr||W!==Ur(W))break t;if(W!==0)return!0}}}else if(q===null&&O===null&&(L===null||L===1||L===-1))return!0;throw Error(Br+"Invalid BigNumber: "+P)},x.maximum=x.max=function(){return N(arguments,-1)},x.minimum=x.min=function(){return N(arguments,1)},x.random=function(){var P=9007199254740992,D=Math.random()*P&2097151?function(){return Ur(Math.random()*P)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(W){var q,O,L,n,d,v=0,A=[],T=new x(s);if(W==null?W=e:nr(W,0,mr),n=Bs(W/ve),g)if(crypto.getRandomValues){for(q=crypto.getRandomValues(new Uint32Array(n*=2));v>>11),d>=9e15?(O=crypto.getRandomValues(new Uint32Array(2)),q[v]=O[0],q[v+1]=O[1]):(A.push(d%1e14),v+=2);v=n/2}else if(crypto.randomBytes){for(q=crypto.randomBytes(n*=7);v=9e15?crypto.randomBytes(7).copy(q,v):(A.push(d%1e14),v+=7);v=n/7}else throw g=!1,Error(Br+"crypto unavailable");if(!g)for(;v=10;d/=10,v++);vO-1&&(d[n+1]==null&&(d[n+1]=0),d[n+1]+=d[n]/O|0,d[n]%=O)}return d.reverse()}return function(W,q,O,L,n){var d,v,A,T,S,w,b,h,k=W.indexOf("."),tt=e,X=o;for(k>=0&&(T=m,m=0,W=W.replace(".",""),h=new x(q),w=h.pow(W.length-k),m=T,h.c=D(Mn(Dr(w.c),w.e,"0"),10,O,P),h.e=h.c.length),b=D(W,q,O,n?(d=E,P):(d=P,E)),A=T=b.length;b[--T]==0;b.pop());if(!b[0])return d.charAt(0);if(k<0?--A:(w.c=b,w.e=A,w.s=L,w=i(w,h,tt,X,O),b=w.c,S=w.r,A=w.e),v=A+tt+1,k=b[v],T=O/2,S=S||v<0||b[v+1]!=null,S=X<4?(k!=null||S)&&(X==0||X==(w.s<0?3:2)):k>T||k==T&&(X==4||S||X==6&&b[v-1]&1||X==(w.s<0?8:7)),v<1||!b[0])W=S?Mn(d.charAt(1),-tt,d.charAt(0)):d.charAt(0);else{if(b.length=v,S)for(--O;++b[--v]>O;)b[v]=0,v||(++A,b=[1].concat(b));for(T=b.length;!b[--T];);for(k=0,W="";k<=T;W+=d.charAt(b[k++]));W=Mn(W,A,d.charAt(0))}return W}}(),i=function(){function P(q,O,L){var n,d,v,A,T=0,S=q.length,w=O%Dn,b=O/Dn|0;for(q=q.slice();S--;)v=q[S]%Dn,A=q[S]/Dn|0,n=b*v+A*w,d=w*v+n%Dn*Dn+T,T=(d/L|0)+(n/Dn|0)+b*A,q[S]=d%L;return T&&(q=[T].concat(q)),q}function D(q,O,L,n){var d,v;if(L!=n)v=L>n?1:-1;else for(d=v=0;dO[d]?1:-1;break}return v}function W(q,O,L,n){for(var d=0;L--;)q[L]-=d,d=q[L]1;q.splice(0,1));}return function(q,O,L,n,d){var v,A,T,S,w,b,h,k,tt,X,ft,et,at,$,J,R,j,z=q.s==O.s?1:-1,Z=q.c,Q=O.c;if(!Z||!Z[0]||!Q||!Q[0])return new x(!q.s||!O.s||(Z?Q&&Z[0]==Q[0]:!Q)?NaN:Z&&Z[0]==0||!Q?z*0:z/0);for(k=new x(z),tt=k.c=[],A=q.e-O.e,z=L+A+1,d||(d=Qr,A=Fr(q.e/ve)-Fr(O.e/ve),z=z/ve|0),T=0;Q[T]==(Z[T]||0);T++);if(Q[T]>(Z[T]||0)&&A--,z<0)tt.push(1),S=!0;else{for($=Z.length,R=Q.length,T=0,z+=2,w=Ur(d/(Q[0]+1)),w>1&&(Q=P(Q,w,d),Z=P(Z,w,d),R=Q.length,$=Z.length),at=R,X=Z.slice(0,R),ft=X.length;ft=d/2&&J++;do{if(w=0,v=D(Q,X,R,ft),v<0){if(et=X[0],R!=ft&&(et=et*d+(X[1]||0)),w=Ur(et/J),w>1)for(w>=d&&(w=d-1),b=P(Q,w,d),h=b.length,ft=X.length;D(b,X,h,ft)==1;)w--,W(b,R=10;z/=10,T++);I(k,L+(k.e=T+A*ve-1)+1,n,S)}else k.e=A,k.r=+S;return k}}();function C(P,D,W,q){var O,L,n,d,v;if(W==null?W=o:nr(W,0,8),!P.c)return P.toString();if(O=P.c[0],n=P.e,D==null)v=Dr(P.c),v=q==1||q==2&&(n<=c||n>=f)?Ga(v,n):Mn(v,n,"0");else if(P=I(new x(P),D,W),L=P.e,v=Dr(P.c),d=v.length,q==1||q==2&&(D<=L||L<=c)){for(;dd){if(--D>0)for(v+=".";D--;v+="0");}else if(D+=L-d,D>0)for(L+1==d&&(v+=".");D--;v+="0");return P.s<0&&O?"-"+v:v}function N(P,D){for(var W,q,O=1,L=new x(P[0]);O=10;O/=10,q++);return(W=q+W*ve-1)>p?P.c=P.e=null:W=10;d/=10,O++);if(L=D-O,L<0)L+=ve,n=D,v=S[A=0],T=Ur(v/w[O-n-1]%10);else if(A=Bs((L+1)/ve),A>=S.length)if(q){for(;S.length<=A;S.push(0));v=T=0,O=1,L%=ve,n=L-ve+1}else break t;else{for(v=d=S[A],O=1;d>=10;d/=10,O++);L%=ve,n=L-ve+O,T=n<0?0:Ur(v/w[O-n-1]%10)}if(q=q||D<0||S[A+1]!=null||(n<0?v:v%w[O-n-1]),q=W<4?(T||q)&&(W==0||W==(P.s<0?3:2)):T>5||T==5&&(W==4||q||W==6&&(L>0?n>0?v/w[O-n]:0:S[A-1])%10&1||W==(P.s<0?8:7)),D<1||!S[0])return S.length=0,q?(D-=P.e+1,S[0]=w[(ve-D%ve)%ve],P.e=-D||0):S[0]=P.e=0,P;if(L==0?(S.length=A,d=1,A--):(S.length=A+1,d=w[ve-L],S[A]=n>0?Ur(v/w[O-n]%w[n])*d:0),q)for(;;)if(A==0){for(L=1,n=S[0];n>=10;n/=10,L++);for(n=S[0]+=d,d=1;n>=10;n/=10,d++);L!=d&&(P.e++,S[0]==Qr&&(S[0]=1));break}else{if(S[A]+=d,S[A]!=Qr)break;S[A--]=0,d=1}for(L=S.length;S[--L]===0;S.pop());}P.e>p?P.c=P.e=null:P.e=f?Ga(D,W):Mn(D,W,"0"),P.s<0?"-"+D:D)}return a.absoluteValue=a.abs=function(){var P=new x(this);return P.s<0&&(P.s=1),P},a.comparedTo=function(P,D){return ii(this,new x(P,D))},a.decimalPlaces=a.dp=function(P,D){var W,q,O,L=this;if(P!=null)return nr(P,0,mr),D==null?D=o:nr(D,0,8),I(new x(L),P+L.e+1,D);if(!(W=L.c))return null;if(q=((O=W.length-1)-Fr(this.e/ve))*ve,O=W[O])for(;O%10==0;O/=10,q--);return q<0&&(q=0),q},a.dividedBy=a.div=function(P,D){return i(this,new x(P,D),e,o)},a.dividedToIntegerBy=a.idiv=function(P,D){return i(this,new x(P,D),0,1)},a.exponentiatedBy=a.pow=function(P,D){var W,q,O,L,n,d,v,A,T,S=this;if(P=new x(P),P.c&&!P.isInteger())throw Error(Br+"Exponent not an integer: "+U(P));if(D!=null&&(D=new x(D)),d=P.e>14,!S.c||!S.c[0]||S.c[0]==1&&!S.e&&S.c.length==1||!P.c||!P.c[0])return T=new x(Math.pow(+U(S),d?P.s*(2-Ha(P)):+U(P))),D?T.mod(D):T;if(v=P.s<0,D){if(D.c?!D.c[0]:!D.s)return new x(NaN);q=!v&&S.isInteger()&&D.isInteger(),q&&(S=S.mod(D))}else{if(P.e>9&&(S.e>0||S.e<-1||(S.e==0?S.c[0]>1||d&&S.c[1]>=24e7:S.c[0]<8e13||d&&S.c[0]<=9999975e7)))return L=S.s<0&&Ha(P)?-0:0,S.e>-1&&(L=1/L),new x(v?1/L:L);m&&(L=Bs(m/ve+2))}for(d?(W=new x(.5),v&&(P.s=1),A=Ha(P)):(O=Math.abs(+U(P)),A=O%2),T=new x(s);;){if(A){if(T=T.times(S),!T.c)break;L?T.c.length>L&&(T.c.length=L):q&&(T=T.mod(D))}if(O){if(O=Ur(O/2),O===0)break;A=O%2}else if(P=P.times(W),I(P,P.e+1,1),P.e>14)A=Ha(P);else{if(O=+U(P),O===0)break;A=O%2}S=S.times(S),L?S.c&&S.c.length>L&&(S.c.length=L):q&&(S=S.mod(D))}return q?T:(v&&(T=s.div(T)),D?T.mod(D):L?I(T,m,o,n):T)},a.integerValue=function(P){var D=new x(this);return P==null?P=o:nr(P,0,8),I(D,D.e+1,P)},a.isEqualTo=a.eq=function(P,D){return ii(this,new x(P,D))===0},a.isFinite=function(){return!!this.c},a.isGreaterThan=a.gt=function(P,D){return ii(this,new x(P,D))>0},a.isGreaterThanOrEqualTo=a.gte=function(P,D){return(D=ii(this,new x(P,D)))===1||D===0},a.isInteger=function(){return!!this.c&&Fr(this.e/ve)>this.c.length-2},a.isLessThan=a.lt=function(P,D){return ii(this,new x(P,D))<0},a.isLessThanOrEqualTo=a.lte=function(P,D){return(D=ii(this,new x(P,D)))===-1||D===0},a.isNaN=function(){return!this.s},a.isNegative=function(){return this.s<0},a.isPositive=function(){return this.s>0},a.isZero=function(){return!!this.c&&this.c[0]==0},a.minus=function(P,D){var W,q,O,L,n=this,d=n.s;if(P=new x(P,D),D=P.s,!d||!D)return new x(NaN);if(d!=D)return P.s=-D,n.plus(P);var v=n.e/ve,A=P.e/ve,T=n.c,S=P.c;if(!v||!A){if(!T||!S)return T?(P.s=-D,P):new x(S?n:NaN);if(!T[0]||!S[0])return S[0]?(P.s=-D,P):new x(T[0]?n:o==3?-0:0)}if(v=Fr(v),A=Fr(A),T=T.slice(),d=v-A){for((L=d<0)?(d=-d,O=T):(A=v,O=S),O.reverse(),D=d;D--;O.push(0));O.reverse()}else for(q=(L=(d=T.length)<(D=S.length))?d:D,d=D=0;D0)for(;D--;T[W++]=0);for(D=Qr-1;q>d;){if(T[--q]=0;){for(W=0,w=et[O]%tt,b=et[O]/tt|0,n=v,L=O+n;L>O;)A=ft[--n]%tt,T=ft[n]/tt|0,d=b*A+T*w,A=w*A+d%tt*tt+h[L]+W,W=(A/k|0)+(d/tt|0)+b*T,h[L--]=A%k;h[L]=W}return W?++q:h.splice(0,1),F(P,h,q)},a.negated=function(){var P=new x(this);return P.s=-P.s||null,P},a.plus=function(P,D){var W,q=this,O=q.s;if(P=new x(P,D),D=P.s,!O||!D)return new x(NaN);if(O!=D)return P.s=-D,q.minus(P);var L=q.e/ve,n=P.e/ve,d=q.c,v=P.c;if(!L||!n){if(!d||!v)return new x(O/0);if(!d[0]||!v[0])return v[0]?P:new x(d[0]?q:O*0)}if(L=Fr(L),n=Fr(n),d=d.slice(),O=L-n){for(O>0?(n=L,W=v):(O=-O,W=d),W.reverse();O--;W.push(0));W.reverse()}for(O=d.length,D=v.length,O-D<0&&(W=v,v=d,d=W,D=O),O=0;D;)O=(d[--D]=d[D]+v[D]+O)/Qr|0,d[D]=Qr===d[D]?0:d[D]%Qr;return O&&(d=[O].concat(d),++n),F(P,d,n)},a.precision=a.sd=function(P,D){var W,q,O,L=this;if(P!=null&&P!==!!P)return nr(P,1,mr),D==null?D=o:nr(D,0,8),I(new x(L),P,D);if(!(W=L.c))return null;if(O=W.length-1,q=O*ve+1,O=W[O]){for(;O%10==0;O/=10,q--);for(O=W[0];O>=10;O/=10,q++);}return P&&L.e+1>q&&(q=L.e+1),q},a.shiftedBy=function(P){return nr(P,-Cs,Cs),this.times("1e"+P)},a.squareRoot=a.sqrt=function(){var P,D,W,q,O,L=this,n=L.c,d=L.s,v=L.e,A=e+4,T=new x("0.5");if(d!==1||!n||!n[0])return new x(!d||d<0&&(!n||n[0])?NaN:n?L:1/0);if(d=Math.sqrt(+U(L)),d==0||d==1/0?(D=Dr(n),(D.length+v)%2==0&&(D+="0"),d=Math.sqrt(+D),v=Fr((v+1)/2)-(v<0||v%2),d==1/0?D="5e"+v:(D=d.toExponential(),D=D.slice(0,D.indexOf("e")+1)+v),W=new x(D)):W=new x(d+""),W.c[0]){for(v=W.e,d=v+A,d<3&&(d=0);;)if(O=W,W=T.times(O.plus(i(L,O,A,1))),Dr(O.c).slice(0,d)===(D=Dr(W.c)).slice(0,d))if(W.e0&&h>0){for(L=h%d||d,T=b.substr(0,L);L0&&(T+=A+b.slice(L)),w&&(T="-"+T)}q=S?T+(W.decimalSeparator||"")+((v=+W.fractionGroupSize)?S.replace(new RegExp("\\d{"+v+"}\\B","g"),"$&"+(W.fractionGroupSeparator||"")):S):T}return(W.prefix||"")+q+(W.suffix||"")},a.toFraction=function(P){var D,W,q,O,L,n,d,v,A,T,S,w,b=this,h=b.c;if(P!=null&&(d=new x(P),!d.isInteger()&&(d.c||d.s!==1)||d.lt(s)))throw Error(Br+"Argument "+(d.isInteger()?"out of range: ":"not an integer: ")+U(d));if(!h)return new x(b);for(D=new x(s),A=W=new x(s),q=v=new x(s),w=Dr(h),L=D.e=w.length-b.e-1,D.c[0]=Ps[(n=L%ve)<0?ve+n:n],P=!P||d.comparedTo(D)>0?L>0?D:A:d,n=p,p=1/0,d=new x(w),v.c[0]=0;T=i(d,D,0,1),O=W.plus(T.times(q)),O.comparedTo(P)!=1;)W=q,q=O,A=v.plus(T.times(O=A)),v=O,D=d.minus(T.times(O=D)),d=O;return O=i(P.minus(W),q,0,1),v=v.plus(O.times(A)),W=W.plus(O.times(q)),v.s=A.s=b.s,L=L*2,S=i(A,q,L,o).minus(b).abs().comparedTo(i(v,W,L,o).minus(b).abs())<1?[A,q]:[v,W],p=n,S},a.toNumber=function(){return+U(this)},a.toPrecision=function(P,D){return P!=null&&nr(P,1,mr),C(this,P,D,2)},a.toString=function(P){var D,W=this,q=W.s,O=W.e;return O===null?q?(D="Infinity",q<0&&(D="-"+D)):D="NaN":(P==null?D=O<=c||O>=f?Ga(Dr(W.c),O):Mn(Dr(W.c),O,"0"):P===10&&B?(W=I(new x(W),e+O+1,o),D=Mn(Dr(W.c),W.e,"0")):(nr(P,2,E.length,"Base"),D=r(Mn(Dr(W.c),O,"0"),10,P,q,!0)),q<0&&W.c[0]&&(D="-"+D)),D},a.valueOf=a.toJSON=function(){return U(this)},a._isBigNumber=!0,a[Symbol.toStringTag]="BigNumber",a[Symbol.for("nodejs.util.inspect.custom")]=a.valueOf,t!=null&&x.set(t),x}function Fr(t){var i=t|0;return t>0||t===i?i:i-1}function Dr(t){for(var i,r,u=1,a=t.length,s=t[0]+"";uf^r?1:-1;for(o=(c=a.length)<(f=s.length)?c:f,e=0;es[e]^r?1:-1;return c==f?0:c>f^r?1:-1}function nr(t,i,r,u){if(tr||t!==Ur(t))throw Error(Br+(u||"Argument")+(typeof t=="number"?tr?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function Ha(t){var i=t.c.length-1;return Fr(t.e/ve)==i&&t.c[i]%2!=0}function Ga(t,i){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(i<0?"e":"e+")+i}function Mn(t,i,r){var u,a;if(i<0){for(a=r+".";++i;a+=r);t=a+t}else if(u=t.length,++i>u){for(a=r,i-=u;--i;a+=r);t+=a}else i(super(...w5),Pt(this,"type"),Pt(this,"response"),this);r.message?t(r.message):t(),this.type=i,this.response=r.response}getType(){return this.type}};function aa(t){let i=t.data;if(typeof t.data=="string")try{i=JSON.parse(t.data)}catch{}if(t.data instanceof ArrayBuffer||t.data instanceof Uint8Array)try{i=JSON.parse(i.toString())}catch{}return i?i.error||i:t.statusText||"unknown"}var Ab=class{constructor(t,i){Pt(this,"api");Pt(this,"network");this.api=t,this.network=i}async getByHash(t){let i=await this.api.get(`block/hash/${t}`);if(i.status===200)return i.data;throw i.status===404?new ia("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${i}`)}async getByHeight(t){let i=await this.api.get(`block/height/${t}`);if(i.status===200)return i.data;throw i.status===404?new ia("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${i}`)}async getCurrent(){let{current:t}=await this.network.getInfo();return await this.getByHash(t)}};lt();lt();var Wn=256*1024,Tb=32*1024,ta=32,wi=32,Mb=class{constructor(t){Pt(this,"crypto");this.crypto=t.deps.crypto}async chunkData(t){let i=[],r=t,u=0;for(;r.byteLength>=Wn;){let a=Wn,s=r.byteLength-Wn;s>0&&s({type:"leaf",id:await this.hash(await Promise.all([this.hash(i),this.hash(Va(u))])),dataHash:i,minByteRange:r,maxByteRange:u})))}async computeRootHash(t){return(await this.generateTree(t)).id}async generateTree(t){return await this.buildLayers(await this.generateLeaves(await this.chunkData(t)))}async generateTransactionChunks(t){let i=await this.chunkData(t),r=await this.generateLeaves(i),u=await this.buildLayers(r),a=await this.generateProofs(u),s=i.slice(-1)[0];return s.maxByteRange-s.minByteRange===0&&(i.splice(i.length-1,1),a.splice(a.length-1,1)),{data_root:u.id,chunks:i,proofs:a}}async buildLayers(t,i=0){if(t.length<2)return t[0];let r=[];for(let u=0;u=u)return this.validatePath(t,0,u-1,u,a);if(i<0)return this.validatePath(t,0,0,u,a);if(a.length==wi+ta){let p=a.slice(0,wi),g=a.slice(p.length,p.length+ta),y=await this.hash([await this.hash(p),await this.hash(g)]);return Dl(t,y)?{offset:u-1,leftBound:r,rightBound:u,chunkSize:u-r}:!1}let s=a.slice(0,wi),e=a.slice(s.length,s.length+wi),o=a.slice(s.length+e.length,s.length+e.length+ta),c=Ll(o),f=a.slice(s.length+e.length+o.length),l=await this.hash([await this.hash(s),await this.hash(e),await this.hash(o)]);return Dl(t,l)?i ${JSON.stringify(o)}`;return this.debug(e,c)}};function dd(t){let i=[];return t.forEach(r=>{Array.isArray(r)?i.push(...dd(r)):i.push(r)}),i}function Va(t){let i=new Uint8Array(ta);for(let r=i.length-1;r>=0;r--){let u=t%256;i[r]=u,t=(t-u)/256}return i}function Ll(t){let i=0;for(let r=0;rt.every((r,u)=>i[u]===r),xb=Mb,kb=class{constructor(t){Pt(this,"api");this.api=t}async getTransactionMetadata(t){let i=await this.api.get(`tx/${t}/offset`);if(i.status===200)return i.data;throw new Error(`Unable to get transaction offset: ${aa(i)}`)}async getChunk(t){let i=await this.api.get(`chunk/${t}`);if(i.status===200)return i.data;throw new Error(`Unable to get chunk: ${aa(i)}`)}async getChunkData(t){let i=await this.getChunk(t);return on(i.chunk)}firstChunkOffset(t){return parseInt(t.offset)-parseInt(t.size)+1}async downloadChunkedData(t,i){let r=await this.getTransactionMetadata(t),u=parseInt(r.size),a=new Uint8Array(u),s=0;for await(let e of this.concurrentChunkDownloader(t,i))a.set(e,s),s+=e.length;return a}async*concurrentChunkDownloader(t,i){let r={concurrency:10,...i},u=await this.getTransactionMetadata(t),a=new bo(u.offset),s=new bo(u.size),e=a.minus(s).plus(1),o=0,c=Math.ceil(s.dividedBy(Wn).toNumber()),f=m=>this.getChunkData(m.toString()).then(M=>(o+=M.length,M)),l=[],p=c-2,g=Math.min(p,r.concurrency),y=0;for(let m=0;m0;)yield l.shift();if(yield f(e.plus(Wn*y++)),s.isGreaterThan(o)&&(yield f(e.plus(Wn*y++))),!s.isEqualTo(o))throw new Error(`got ${o}B, expected ${s.toString()}B`)}};lt();function Ob(t,i){let r=t;return r.deepHash=new i.deepHash({deps:{utils:{stringToBuffer:je,concatBuffers:Tr},crypto:t}}),r}lt();var Ib=class{constructor({deps:t}){Pt(this,"crypto");Pt(this,"utils");this.crypto=t.crypto,this.utils=t.utils}async deepHash(t){if(Array.isArray(t)){let u=this.utils.concatBuffers([this.utils.stringToBuffer("list"),this.utils.stringToBuffer(t.length.toString())]);return await this.deepHashChunks(t,await this.crypto.hash(u,"SHA-384"))}let i=this.utils.concatBuffers([this.utils.stringToBuffer("blob"),this.utils.stringToBuffer(t.byteLength.toString())]),r=this.utils.concatBuffers([await this.crypto.hash(i,"SHA-384"),await this.crypto.hash(t,"SHA-384")]);return await this.crypto.hash(r,"SHA-384")}async deepHashChunks(t,i){if(t.length<1)return i;let r=this.utils.concatBuffers([i,await this.deepHash(t[0])]),u=await this.crypto.hash(r,"SHA-384");return await this.deepHashChunks(t.slice(1),u)}};lt();lt();lt();lt();lt();lt();function pd(t,i){return function(){return t.apply(i,arguments)}}var{toString:Bb}=Object.prototype,{getPrototypeOf:lh}=Object,ss=(t=>i=>{let r=Bb.call(i);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Tn=t=>(t=t.toLowerCase(),i=>ss(i)===t),us=t=>i=>typeof i===t,{isArray:zi}=Array,la=us("undefined");function Cb(t){return t!==null&&!la(t)&&t.constructor!==null&&!la(t.constructor)&&qr(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var gd=Tn("ArrayBuffer");function Pb(t){let i;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?i=ArrayBuffer.isView(t):i=t&&t.buffer&&gd(t.buffer),i}var Rb=us("string"),qr=us("function"),md=us("number"),hs=t=>t!==null&&typeof t=="object",Nb=t=>t===!0||t===!1,ro=t=>{if(ss(t)!=="object")return!1;let i=lh(t);return(i===null||i===Object.prototype||Object.getPrototypeOf(i)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Lb=Tn("Date"),Db=Tn("File"),jb=Tn("Blob"),Ub=Tn("FileList"),Fb=t=>hs(t)&&qr(t.pipe),Kb=t=>{let i;return t&&(typeof FormData=="function"&&t instanceof FormData||qr(t.append)&&((i=ss(t))==="formdata"||i==="object"&&qr(t.toString)&&t.toString()==="[object FormData]"))},zb=Tn("URLSearchParams"),Wb=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ia(t,i,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let u,a;if(typeof t!="object"&&(t=[t]),zi(t))for(u=0,a=t.length;u0;)if(a=r[u],i===a.toLowerCase())return a;return null}var bd=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:le,vd=t=>!la(t)&&t!==bd;function Xs(){let{caseless:t}=vd(this)&&this||{},i={},r=(u,a)=>{let s=t&&yd(i,a)||a;ro(i[s])&&ro(u)?i[s]=Xs(i[s],u):ro(u)?i[s]=Xs({},u):zi(u)?i[s]=u.slice():i[s]=u};for(let u=0,a=arguments.length;u(Ia(i,(a,s)=>{r&&qr(a)?t[s]=pd(a,r):t[s]=a},{allOwnKeys:u}),t),$b=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Hb=(t,i,r,u)=>{t.prototype=Object.create(i.prototype,u),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:i.prototype}),r&&Object.assign(t.prototype,r)},Gb=(t,i,r,u)=>{let a,s,e,o={};if(i=i||{},t==null)return i;do{for(a=Object.getOwnPropertyNames(t),s=a.length;s-- >0;)e=a[s],(!u||u(e,t,i))&&!o[e]&&(i[e]=t[e],o[e]=!0);t=r!==!1&&lh(t)}while(t&&(!r||r(t,i))&&t!==Object.prototype);return i},Vb=(t,i,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=i.length;let u=t.indexOf(i,r);return u!==-1&&u===r},Zb=t=>{if(!t)return null;if(zi(t))return t;let i=t.length;if(!md(i))return null;let r=new Array(i);for(;i-- >0;)r[i]=t[i];return r},Jb=(t=>i=>t&&i instanceof t)(typeof Uint8Array<"u"&&lh(Uint8Array)),Xb=(t,i)=>{let r=(t&&t[Symbol.iterator]).call(t),u;for(;(u=r.next())&&!u.done;){let a=u.value;i.call(t,a[0],a[1])}},Yb=(t,i)=>{let r,u=[];for(;(r=t.exec(i))!==null;)u.push(r);return u},Qb=Tn("HTMLFormElement"),tv=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,r,u){return r.toUpperCase()+u}),jl=(({hasOwnProperty:t})=>(i,r)=>t.call(i,r))(Object.prototype),ev=Tn("RegExp"),wd=(t,i)=>{let r=Object.getOwnPropertyDescriptors(t),u={};Ia(r,(a,s)=>{let e;(e=i(a,s,t))!==!1&&(u[s]=e||a)}),Object.defineProperties(t,u)},rv=t=>{wd(t,(i,r)=>{if(qr(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let u=t[r];if(qr(u)){if(i.enumerable=!1,"writable"in i){i.writable=!1;return}i.set||(i.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},nv=(t,i)=>{let r={},u=a=>{a.forEach(s=>{r[s]=!0})};return zi(t)?u(t):u(String(t).split(i)),r},iv=()=>{},av=(t,i)=>(t=+t,Number.isFinite(t)?t:i),Rs="abcdefghijklmnopqrstuvwxyz",Ul="0123456789",_d={DIGIT:Ul,ALPHA:Rs,ALPHA_DIGIT:Rs+Rs.toUpperCase()+Ul},ov=(t=16,i=_d.ALPHA_DIGIT)=>{let r="",{length:u}=i;for(;t--;)r+=i[Math.random()*u|0];return r};function sv(t){return!!(t&&qr(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}var uv=t=>{let i=new Array(10),r=(u,a)=>{if(hs(u)){if(i.indexOf(u)>=0)return;if(!("toJSON"in u)){i[a]=u;let s=zi(u)?[]:{};return Ia(u,(e,o)=>{let c=r(e,a+1);!la(c)&&(s[o]=c)}),i[a]=void 0,s}}return u};return r(t,0)},hv=Tn("AsyncFunction"),lv=t=>t&&(hs(t)||qr(t))&&qr(t.then)&&qr(t.catch),ne={isArray:zi,isArrayBuffer:gd,isBuffer:Cb,isFormData:Kb,isArrayBufferView:Pb,isString:Rb,isNumber:md,isBoolean:Nb,isObject:hs,isPlainObject:ro,isUndefined:la,isDate:Lb,isFile:Db,isBlob:jb,isRegExp:ev,isFunction:qr,isStream:Fb,isURLSearchParams:zb,isTypedArray:Jb,isFileList:Ub,forEach:Ia,merge:Xs,extend:qb,trim:Wb,stripBOM:$b,inherits:Hb,toFlatObject:Gb,kindOf:ss,kindOfTest:Tn,endsWith:Vb,toArray:Zb,forEachEntry:Xb,matchAll:Yb,isHTMLForm:Qb,hasOwnProperty:jl,hasOwnProp:jl,reduceDescriptors:wd,freezeMethods:rv,toObjectSet:nv,toCamelCase:tv,noop:iv,toFiniteNumber:av,findKey:yd,global:bd,isContextDefined:vd,ALPHABET:_d,generateString:ov,isSpecCompliantForm:sv,toJSONObject:uv,isAsyncFn:hv,isThenable:lv};lt();lt();lt();lt();lt();function Ri(t,i,r,u,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",i&&(this.code=i),r&&(this.config=r),u&&(this.request=u),a&&(this.response=a)}ne.inherits(Ri,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ne.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var Ed=Ri.prototype,Sd={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{Sd[t]={value:t}});Object.defineProperties(Ri,Sd);Object.defineProperty(Ed,"isAxiosError",{value:!0});Ri.from=(t,i,r,u,a,s)=>{let e=Object.create(Ed);return ne.toFlatObject(t,e,function(o){return o!==Error.prototype},o=>o!=="isAxiosError"),Ri.call(e,t.message,i,r,u,a),e.cause=t,e.name=t.name,s&&Object.assign(e,s),e};var Fe=Ri;lt();var fv=null;function Ys(t){return ne.isPlainObject(t)||ne.isArray(t)}function Ad(t){return ne.endsWith(t,"[]")?t.slice(0,-2):t}function Fl(t,i,r){return t?t.concat(i).map(function(u,a){return u=Ad(u),!r&&a?"["+u+"]":u}).join(r?".":""):i}function cv(t){return ne.isArray(t)&&!t.some(Ys)}var dv=ne.toFlatObject(ne,{},null,function(t){return/^is[A-Z]/.test(t)});function pv(t,i,r){if(!ne.isObject(t))throw new TypeError("target must be an object");i=i||new FormData,r=ne.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,m){return!ne.isUndefined(m[y])});let u=r.metaTokens,a=r.visitor||f,s=r.dots,e=r.indexes,o=(r.Blob||typeof Blob<"u"&&Blob)&&ne.isSpecCompliantForm(i);if(!ne.isFunction(a))throw new TypeError("visitor must be a function");function c(y){if(y===null)return"";if(ne.isDate(y))return y.toISOString();if(!o&&ne.isBlob(y))throw new Fe("Blob is not supported. Use a Buffer instead.");return ne.isArrayBuffer(y)||ne.isTypedArray(y)?o&&typeof Blob=="function"?new Blob([y]):Ut.Buffer.from(y):y}function f(y,m,M){let E=y;if(y&&!M&&typeof y=="object"){if(ne.endsWith(m,"{}"))m=u?m:m.slice(0,-2),y=JSON.stringify(y);else if(ne.isArray(y)&&cv(y)||(ne.isFileList(y)||ne.endsWith(m,"[]"))&&(E=ne.toArray(y)))return m=Ad(m),E.forEach(function(B,x){!(ne.isUndefined(B)||B===null)&&i.append(e===!0?Fl([m],x,s):e===null?m:m+"[]",c(B))}),!1}return Ys(y)?!0:(i.append(Fl(M,m,s),c(y)),!1)}let l=[],p=Object.assign(dv,{defaultVisitor:f,convertValue:c,isVisitable:Ys});function g(y,m){if(!ne.isUndefined(y)){if(l.indexOf(y)!==-1)throw Error("Circular reference detected in "+m.join("."));l.push(y),ne.forEach(y,function(M,E){(!(ne.isUndefined(M)||M===null)&&a.call(i,M,ne.isString(E)?E.trim():E,m,p))===!0&&g(M,m?m.concat(E):[E])}),l.pop()}}if(!ne.isObject(t))throw new TypeError("data must be an object");return g(t),i}var ls=pv;function Kl(t){let i={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return i[r]})}function Td(t,i){this._pairs=[],t&&ls(t,this,i)}var Md=Td.prototype;Md.append=function(t,i){this._pairs.push([t,i])};Md.toString=function(t){let i=t?function(r){return t.call(this,r,Kl)}:Kl;return this._pairs.map(function(r){return i(r[0])+"="+i(r[1])},"").join("&")};var xd=Td;function gv(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function kd(t,i,r){if(!i)return t;let u=r&&r.encode||gv,a=r&&r.serialize,s;if(a?s=a(i,r):s=ne.isURLSearchParams(i)?i.toString():new xd(i,r).toString(u),s){let e=t.indexOf("#");e!==-1&&(t=t.slice(0,e)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}lt();var mv=class{constructor(){this.handlers=[]}use(t,i,r){return this.handlers.push({fulfilled:t,rejected:i,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ne.forEach(this.handlers,function(i){i!==null&&t(i)})}},zl=mv;lt();lt();lt();lt();var Od={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};lt();lt();lt();lt();var yv=typeof URLSearchParams<"u"?URLSearchParams:xd;lt();var bv=typeof FormData<"u"?FormData:null;lt();var vv=typeof Blob<"u"?Blob:null,wv={isBrowser:!0,classes:{URLSearchParams:yv,FormData:bv,Blob:vv},protocols:["http","https","file","blob","url","data"]},Id={};ba(Id,{hasBrowserEnv:()=>Bd,hasStandardBrowserEnv:()=>_v,hasStandardBrowserWebWorkerEnv:()=>Ev});lt();var Bd=typeof window<"u"&&typeof document<"u",_v=(t=>Bd&&["ReactNative","NativeScript","NS"].indexOf(t)<0)(typeof navigator<"u"&&navigator.product),Ev=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",vn={...Id,...wv};function Sv(t,i){return ls(t,new vn.classes.URLSearchParams,Object.assign({visitor:function(r,u,a,s){return vn.isNode&&ne.isBuffer(r)?(this.append(u,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},i))}lt();function Av(t){return ne.matchAll(/\w+|\[(\w*)]/g,t).map(i=>i[0]==="[]"?"":i[1]||i[0])}function Tv(t){let i={},r=Object.keys(t),u,a=r.length,s;for(u=0;u=r.length;return e=!e&&ne.isArray(a)?a.length:e,c?(ne.hasOwnProp(a,e)?a[e]=[a[e],u]:a[e]=u,!o):((!a[e]||!ne.isObject(a[e]))&&(a[e]=[]),i(r,u,a[e],s)&&ne.isArray(a[e])&&(a[e]=Tv(a[e])),!o)}if(ne.isFormData(t)&&ne.isFunction(t.entries)){let r={};return ne.forEachEntry(t,(u,a)=>{i(Av(u),a,r,0)}),r}return null}var Cd=Mv;function xv(t,i,r){if(ne.isString(t))try{return(i||JSON.parse)(t),ne.trim(t)}catch(u){if(u.name!=="SyntaxError")throw u}return(r||JSON.stringify)(t)}var fh={transitional:Od,adapter:["xhr","http"],transformRequest:[function(t,i){let r=i.getContentType()||"",u=r.indexOf("application/json")>-1,a=ne.isObject(t);if(a&&ne.isHTMLForm(t)&&(t=new FormData(t)),ne.isFormData(t))return u&&u?JSON.stringify(Cd(t)):t;if(ne.isArrayBuffer(t)||ne.isBuffer(t)||ne.isStream(t)||ne.isFile(t)||ne.isBlob(t))return t;if(ne.isArrayBufferView(t))return t.buffer;if(ne.isURLSearchParams(t))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Sv(t,this.formSerializer).toString();if((s=ne.isFileList(t))||r.indexOf("multipart/form-data")>-1){let e=this.env&&this.env.FormData;return ls(s?{"files[]":t}:t,e&&new e,this.formSerializer)}}return a||u?(i.setContentType("application/json",!1),xv(t)):t}],transformResponse:[function(t){let i=this.transitional||fh.transitional,r=i&&i.forcedJSONParsing,u=this.responseType==="json";if(t&&ne.isString(t)&&(r&&!this.responseType||u)){let a=!(i&&i.silentJSONParsing)&&u;try{return JSON.parse(t)}catch(s){if(a)throw s.name==="SyntaxError"?Fe.from(s,Fe.ERR_BAD_RESPONSE,this,null,this.response):s}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:vn.classes.FormData,Blob:vn.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ne.forEach(["delete","get","head","post","put","patch"],t=>{fh.headers[t]={}});var ch=fh;lt();lt();var kv=ne.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ov=t=>{let i={},r,u,a;return t&&t.split(` `).forEach(function(s){a=s.indexOf(":"),r=s.substring(0,a).trim().toLowerCase(),u=s.substring(a+1).trim(),!(!r||i[r]&&kv[r])&&(r==="set-cookie"?i[r]?i[r].push(u):i[r]=[u]:i[r]=i[r]?i[r]+", "+u:u)}),i},Wl=Symbol("internals");function Vi(t){return t&&String(t).trim().toLowerCase()}function no(t){return t===!1||t==null?t:ne.isArray(t)?t.map(no):String(t)}function Iv(t){let i=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,u;for(;u=r.exec(t);)i[u[1]]=u[2];return i}var Bv=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Ns(t,i,r,u,a){if(ne.isFunction(u))return u.call(this,i,r);if(a&&(i=r),!!ne.isString(i)){if(ne.isString(u))return i.indexOf(u)!==-1;if(ne.isRegExp(u))return u.test(i)}}function Cv(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(i,r,u)=>r.toUpperCase()+u)}function Pv(t,i){let r=ne.toCamelCase(" "+i);["get","set","has"].forEach(u=>{Object.defineProperty(t,u+r,{value:function(a,s,e){return this[u].call(this,i,a,s,e)},configurable:!0})})}var fs=class{constructor(t){t&&this.set(t)}set(t,i,r){let u=this;function a(e,o,c){let f=Vi(o);if(!f)throw new Error("header name must be a non-empty string");let l=ne.findKey(u,f);(!l||u[l]===void 0||c===!0||c===void 0&&u[l]!==!1)&&(u[l||o]=no(e))}let s=(e,o)=>ne.forEach(e,(c,f)=>a(c,f,o));return ne.isPlainObject(t)||t instanceof this.constructor?s(t,i):ne.isString(t)&&(t=t.trim())&&!Bv(t)?s(Ov(t),i):t!=null&&a(i,t,r),this}get(t,i){if(t=Vi(t),t){let r=ne.findKey(this,t);if(r){let u=this[r];if(!i)return u;if(i===!0)return Iv(u);if(ne.isFunction(i))return i.call(this,u,r);if(ne.isRegExp(i))return i.exec(u);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,i){if(t=Vi(t),t){let r=ne.findKey(this,t);return!!(r&&this[r]!==void 0&&(!i||Ns(this,this[r],r,i)))}return!1}delete(t,i){let r=this,u=!1;function a(s){if(s=Vi(s),s){let e=ne.findKey(r,s);e&&(!i||Ns(r,r[e],e,i))&&(delete r[e],u=!0)}}return ne.isArray(t)?t.forEach(a):a(t),u}clear(t){let i=Object.keys(this),r=i.length,u=!1;for(;r--;){let a=i[r];(!t||Ns(this,this[a],a,t,!0))&&(delete this[a],u=!0)}return u}normalize(t){let i=this,r={};return ne.forEach(this,(u,a)=>{let s=ne.findKey(r,a);if(s){i[s]=no(u),delete i[a];return}let e=t?Cv(a):String(a).trim();e!==a&&delete i[a],i[e]=no(u),r[e]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let i=Object.create(null);return ne.forEach(this,(r,u)=>{r!=null&&r!==!1&&(i[u]=t&&ne.isArray(r)?r.join(", "):r)}),i}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,i])=>t+": "+i).join(` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...i){let r=new this(t);return i.forEach(u=>r.set(u)),r}static accessor(t){let i=(this[Wl]=this[Wl]={accessors:{}}).accessors,r=this.prototype;function u(a){let s=Vi(a);i[s]||(Pv(r,a),i[s]=!0)}return ne.isArray(t)?t.forEach(u):u(t),this}};fs.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ne.reduceDescriptors(fs.prototype,({value:t},i)=>{let r=i[0].toUpperCase()+i.slice(1);return{get:()=>t,set(u){this[r]=u}}});ne.freezeMethods(fs);var In=fs;function Ls(t,i){let r=this||ch,u=i||r,a=In.from(u.headers),s=u.data;return ne.forEach(t,function(e){s=e.call(r,s,a.normalize(),i?i.status:void 0)}),a.normalize(),s}lt();function Pd(t){return!!(t&&t.__CANCEL__)}lt();function Rd(t,i,r){Fe.call(this,t??"canceled",Fe.ERR_CANCELED,i,r),this.name="CanceledError"}ne.inherits(Rd,Fe,{__CANCEL__:!0});var cs=Rd;lt();lt();lt();function Rv(t,i,r){let u=r.config.validateStatus;!r.status||!u||u(r.status)?t(r):i(new Fe("Request failed with status code "+r.status,[Fe.ERR_BAD_REQUEST,Fe.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}lt();var Nv=vn.hasStandardBrowserEnv?function(){return{write:function(t,i,r,u,a,s){let e=[];e.push(t+"="+encodeURIComponent(i)),ne.isNumber(r)&&e.push("expires="+new Date(r).toGMTString()),ne.isString(u)&&e.push("path="+u),ne.isString(a)&&e.push("domain="+a),s===!0&&e.push("secure"),document.cookie=e.join("; ")},read:function(t){let i=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return i?decodeURIComponent(i[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();lt();lt();function Lv(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}lt();function Dv(t,i){return i?t.replace(/\/+$/,"")+"/"+i.replace(/^\/+/,""):t}function Nd(t,i){return t&&!Lv(i)?Dv(t,i):i}lt();var jv=vn.hasStandardBrowserEnv?function(){let t=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a"),r;function u(a){let s=a;return t&&(i.setAttribute("href",s),s=i.href),i.setAttribute("href",s),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:i.pathname.charAt(0)==="/"?i.pathname:"/"+i.pathname}}return r=u(window.location.href),function(a){let s=ne.isString(a)?u(a):a;return s.protocol===r.protocol&&s.host===r.host}}():function(){return function(){return!0}}();lt();function Uv(t){let i=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return i&&i[1]||""}lt();function Fv(t,i){t=t||10;let r=new Array(t),u=new Array(t),a=0,s=0,e;return i=i!==void 0?i:1e3,function(o){let c=Date.now(),f=u[s];e||(e=c),r[a]=o,u[a]=c;let l=s,p=0;for(;l!==a;)p+=r[l++],l=l%t;if(a=(a+1)%t,a===s&&(s=(s+1)%t),c-e{let s=a.loaded,e=a.lengthComputable?a.total:void 0,o=s-r,c=u(o),f=s<=e;r=s;let l={loaded:s,total:e,progress:e?s/e:void 0,bytes:o,rate:c||void 0,estimated:c&&e&&f?(e-s)/c:void 0,event:a};l[i?"download":"upload"]=!0,t(l)}}var zv=typeof XMLHttpRequest<"u",Wv=zv&&function(t){return new Promise(function(i,r){let u=t.data,a=In.from(t.headers).normalize(),s=t.responseType,e;function o(){t.cancelToken&&t.cancelToken.unsubscribe(e),t.signal&&t.signal.removeEventListener("abort",e)}let c;if(ne.isFormData(u)){if(vn.hasStandardBrowserEnv||vn.hasStandardBrowserWebWorkerEnv)a.setContentType(!1);else if((c=a.getContentType())!==!1){let[y,...m]=c?c.split(";").map(M=>M.trim()).filter(Boolean):[];a.setContentType([y||"multipart/form-data",...m].join("; "))}}let f=new XMLHttpRequest;if(t.auth){let y=t.auth.username||"",m=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";a.set("Authorization","Basic "+btoa(y+":"+m))}let l=Nd(t.baseURL,t.url);f.open(t.method.toUpperCase(),kd(l,t.params,t.paramsSerializer),!0),f.timeout=t.timeout;function p(){if(!f)return;let y=In.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders()),m={data:!s||s==="text"||s==="json"?f.responseText:f.response,status:f.status,statusText:f.statusText,headers:y,config:t,request:f};Rv(function(M){i(M),o()},function(M){r(M),o()},m),f=null}if("onloadend"in f?f.onloadend=p:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(p)},f.onabort=function(){!f||(r(new Fe("Request aborted",Fe.ECONNABORTED,t,f)),f=null)},f.onerror=function(){r(new Fe("Network Error",Fe.ERR_NETWORK,t,f)),f=null},f.ontimeout=function(){let y=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",m=t.transitional||Od;t.timeoutErrorMessage&&(y=t.timeoutErrorMessage),r(new Fe(y,m.clarifyTimeoutError?Fe.ETIMEDOUT:Fe.ECONNABORTED,t,f)),f=null},vn.hasStandardBrowserEnv){let y=jv(l)&&t.xsrfCookieName&&Nv.read(t.xsrfCookieName);y&&a.set(t.xsrfHeaderName,y)}u===void 0&&a.setContentType(null),"setRequestHeader"in f&&ne.forEach(a.toJSON(),function(y,m){f.setRequestHeader(m,y)}),ne.isUndefined(t.withCredentials)||(f.withCredentials=!!t.withCredentials),s&&s!=="json"&&(f.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&f.addEventListener("progress",ql(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",ql(t.onUploadProgress)),(t.cancelToken||t.signal)&&(e=y=>{!f||(r(!y||y.type?new cs(null,t,f):y),f.abort(),f=null)},t.cancelToken&&t.cancelToken.subscribe(e),t.signal&&(t.signal.aborted?e():t.signal.addEventListener("abort",e)));let g=Uv(l);if(g&&vn.protocols.indexOf(g)===-1){r(new Fe("Unsupported protocol "+g+":",Fe.ERR_BAD_REQUEST,t));return}f.send(u||null)})},Qs={http:fv,xhr:Wv};ne.forEach(Qs,(t,i)=>{if(t){try{Object.defineProperty(t,"name",{value:i})}catch{}Object.defineProperty(t,"adapterName",{value:i})}});var $l=t=>`- ${t}`,qv=t=>ne.isFunction(t)||t===null||t===!1,Ld={getAdapter:t=>{t=ne.isArray(t)?t:[t];let{length:i}=t,r,u,a={};for(let s=0;s`adapter ${o} `+(c===!1?"is not supported by the environment":"is not available in the build")),e=i?s.length>1?`since : diff --git a/images/arweave/arweave-round.svg b/images/arweave/arweave-round.svg new file mode 100644 index 0000000..c546679 --- /dev/null +++ b/images/arweave/arweave-round.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + diff --git a/assets/ecosystem-Pm6wgfuC.svg b/images/arweave/ecosystem.svg similarity index 100% rename from assets/ecosystem-Pm6wgfuC.svg rename to images/arweave/ecosystem.svg diff --git a/index.html b/index.html index 10211b3..8acb662 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,7 @@ - + BetterIDEa @@ -19,8 +19,8 @@ href="https://fonts.googleapis.com/css2?family=Commissioner:wght@100;300;400;500;700&display=swap" rel="stylesheet" /> - - + +