text: !function(t){var r={};function i(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=t,i.c=r,i.d=function(t,r,e){i.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:e})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,r){if(1&r&&(t=i(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(i.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var n in t)i.d(e,n,function(r){return t[r]}.bind(null,n));return e},i.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(r,"a",r),r},i.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},i.p="",i(i.s=25)}([function(t,r,i){var e;(function(){var i=this,n=i._,o=Array.prototype,s=Object.prototype,h=Function.prototype,u=o.push,a=o.slice,l=s.toString,f=s.hasOwnProperty,m=Array.isArray,c=Object.keys,d=h.bind,p=Object.create,v=function(){},g=function(t){return t instanceof g?t:this instanceof g?void(this._wrapped=t):new g(t)};t.exports&&(r=t.exports=g),r._=g,g.VERSION="1.8.3";var M=function(t,r,i){if(void 0===r)return t;switch(null==i?3:i){case 1:return function(i){return t.call(r,i)};case 2:return function(i,e){return t.call(r,i,e)};case 3:return function(i,e,n){return t.call(r,i,e,n)};case 4:return function(i,e,n,o){return t.call(r,i,e,n,o)}}return function(){return t.apply(r,arguments)}},w=function(t,r,i){return null==t?g.identity:g.isFunction(t)?M(t,r,i):g.isObject(t)?g.matcher(t):g.property(t)};g.iteratee=function(t,r){return w(t,r,1/0)};var y=function(t,r){return function(i){var e=arguments.length;if(e<2||null==i)return i;for(var n=1;n<e;n++)for(var o=arguments[n],s=t(o),h=s.length,u=0;u<h;u++){var a=s[u];r&&void 0!==i[a]||(i[a]=o[a])}return i}},b=function(t){if(!g.isObject(t))return{};if(p)return p(t);v.prototype=t;var r=new v;return v.prototype=null,r},x=function(t){return function(r){return null==r?void 0:r[t]}},_=Math.pow(2,53)-1,A=x("length"),S=function(t){var r=A(t);return"number"==typeof r&&r>=0&&r<=_};function k(t){function r(r,i,e,n,o,s){for(;o>=0&&o<s;o+=t){var h=n?n[o]:o;e=i(e,r[h],h,r)}return e}return function(i,e,n,o){e=M(e,o,4);var s=!S(i)&&g.keys(i),h=(s||i).length,u=t>0?0:h-1;return arguments.length<3&&(n=i[s?s[u]:u],u+=t),r(i,e,n,s,u,h)}}g.each=g.forEach=function(t,r,i){var e,n;if(r=M(r,i),S(t))for(e=0,n=t.length;e<n;e++)r(t[e],e,t);else{var o=g.keys(t);for(e=0,n=o.length;e<n;e++)r(t[o[e]],o[e],t)}return t},g.map=g.collect=function(t,r,i){r=w(r,i);for(var e=!S(t)&&g.keys(t),n=(e||t).length,o=Array(n),s=0;s<n;s++){var h=e?e[s]:s;o[s]=r(t[h],h,t)}return o},g.reduce=g.foldl=g.inject=k(1),g.reduceRight=g.foldr=k(-1),g.find=g.detect=function(t,r,i){var e;if(void 0!==(e=S(t)?g.findIndex(t,r,i):g.findKey(t,r,i))&&-1!==e)return t[e]},g.filter=g.select=function(t,r,i){var e=[];return r=w(r,i),g.each(t,function(t,i,n){r(t,i,n)&&e.push(t)}),e},g.reject=function(t,r,i){return g.filter(t,g.negate(w(r)),i)},g.every=g.all=function(t,r,i){r=w(r,i);for(var e=!S(t)&&g.keys(t),n=(e||t).length,o=0;o<n;o++){var s=e?e[o]:o;if(!r(t[s],s,t))return!1}return!0},g.some=g.any=function(t,r,i){r=w(r,i);for(var e=!S(t)&&g.keys(t),n=(e||t).length,o=0;o<n;o++){var s=e?e[o]:o;if(r(t[s],s,t))return!0}return!1},g.contains=g.includes=g.include=function(t,r,i,e){return S(t)||(t=g.values(t)),("number"!=typeof i||e)&&(i=0),g.indexOf(t,r,i)>=0},g.invoke=function(t,r){var i=a.call(arguments,2),e=g.isFunction(r);return g.map(t,function(t){var n=e?r:t[r];return null==n?n:n.apply(t,i)})},g.pluck=function(t,r){return g.map(t,g.property(r))},g.where=function(t,r){return g.filter(t,g.matcher(r))},g.findWhere=function(t,r){return g.find(t,g.matcher(r))},g.max=function(t,r,i){var e,n,o=-1/0,s=-1/0;if(null==r&&null!=t)for(var h=0,u=(t=S(t)?t:g.values(t)).length;h<u;h++)(e=t[h])>o&&(o=e);else r=w(r,i),g.each(t,function(t,i,e){((n=r(t,i,e))>s||n===-1/0&&o===-1/0)&&(o=t,s=n)});return o},g.min=function(t,r,i){var e,n,o=1/0,s=1/0;if(null==r&&null!=t)for(var h=0,u=(t=S(t)?t:g.values(t)).length;h<u;h++)(e=t[h])<o&&(o=e);else r=w(r,i),g.each(t,function(t,i,e){((n=r(t,i,e))<s||n===1/0&&o===1/0)&&(o=t,s=n)});return o},g.shuffle=function(t){for(var r,i=S(t)?t:g.values(t),e=i.length,n=Array(e),o=0;o<e;o++)(r=g.random(0,o))!==o&&(n[o]=n[r]),n[r]=i[o];return n},g.sample=function(t,r,i){return null==r||i?(S(t)||(t=g.values(t)),t[g.random(t.length-1)]):g.shuffle(t).slice(0,Math.max(0,r))},g.sortBy=function(t,r,i){return r=w(r,i),g.pluck(g.map(t,function(t,i,e){return{value:t,index:i,criteria:r(t,i,e)}}).sort(function(t,r){var i=t.criteria,e=r.criteria;if(i!==e){if(i>e||void 0===i)return 1;if(i<e||void 0===e)return-1}return t.index-r.index}),"value")};var T=function(t){return function(r,i,e){var n={};return i=w(i,e),g.each(r,function(e,o){var s=i(e,o,r);t(n,e,s)}),n}};g.groupBy=T(function(t,r,i){g.has(t,i)?t[i].push(r):t[i]=[r]}),g.indexBy=T(function(t,r,i){t[i]=r}),g.countBy=T(function(t,r,i){g.has(t,i)?t[i]++:t[i]=1}),g.toArray=function(t){return t?g.isArray(t)?a.call(t):S(t)?g.map(t,g.identity):g.values(t):[]},g.size=function(t){return null==t?0:S(t)?t.length:g.keys(t).length},g.partition=function(t,r,i){r=w(r,i);var e=[],n=[];return g.each(t,function(t,i,o){(r(t,i,o)?e:n).push(t)}),[e,n]},g.first=g.head=g.take=function(t,r,i){if(null!=t)return null==r||i?t[0]:g.initial(t,t.length-r)},g.initial=function(t,r,i){return a.call(t,0,Math.max(0,t.length-(null==r||i?1:r)))},g.last=function(t,r,i){if(null!=t)return null==r||i?t[t.length-1]:g.rest(t,Math.max(0,t.length-r))},g.rest=g.tail=g.drop=function(t,r,i){return a.call(t,null==r||i?1:r)},g.compact=function(t){return g.filter(t,g.identity)};var E=function(t,r,i,e){for(var n=[],o=0,s=e||0,h=A(t);s<h;s++){var u=t[s];if(S(u)&&(g.isArray(u)||g.isArguments(u))){r||(u=E(u,r,i));var a=0,l=u.length;for(n.length+=l;a<l;)n[o++]=u[a++]}else i||(n[o++]=u)}return n};function B(t){return function(r,i,e){i=w(i,e);for(var n=A(r),o=t>0?0:n-1;o>=0&&o<n;o+=t)if(i(r[o],o,r))return o;return-1}}function N(t,r,i){return function(e,n,o){var s=0,h=A(e);if("number"==typeof o)t>0?s=o>=0?o:Math.max(o+h,s):h=o>=0?Math.min(o+1,h):o+h+1;else if(i&&o&&h)return e[o=i(e,n)]===n?o:-1;if(n!=n)return(o=r(a.call(e,s,h),g.isNaN))>=0?o+s:-1;for(o=t>0?s:h-1;o>=0&&o<h;o+=t)if(e[o]===n)return o;return-1}}g.flatten=function(t,r){return E(t,r,!1)},g.without=function(t){return g.difference(t,a.call(arguments,1))},g.uniq=g.unique=function(t,r,i,e){g.isBoolean(r)||(e=i,i=r,r=!1),null!=i&&(i=w(i,e));for(var n=[],o=[],s=0,h=A(t);s<h;s++){var u=t[s],a=i?i(u,s,t):u;r?(s&&o===a||n.push(u),o=a):i?g.contains(o,a)||(o.push(a),n.push(u)):g.contains(n,u)||n.push(u)}return n},g.union=function(){return g.uniq(E(arguments,!0,!0))},g.intersection=function(t){for(var r=[],i=arguments.length,e=0,n=A(t);e<n;e++){var o=t[e];if(!g.contains(r,o)){for(var s=1;s<i&&g.contains(arguments[s],o);s++);s===i&&r.push(o)}}return r},g.difference=function(t){var r=E(arguments,!0,!0,1);return g.filter(t,function(t){return!g.contains(r,t)})},g.zip=function(){return g.unzip(arguments)},g.unzip=function(t){for(var r=t&&g.max(t,A).length||0,i=Array(r),e=0;e<r;e++)i[e]=g.pluck(t,e);return i},g.object=function(t,r){for(var i={},e=0,n=A(t);e<n;e++)r?i[t[e]]=r[e]:i[t[e][0]]=t[e][1];return i},g.findIndex=B(1),g.findLastIndex=B(-1),g.sortedIndex=function(t,r,i,e){for(var n=(i=w(i,e,1))(r),o=0,s=A(t);o<s;){var h=Math.floor((o+s)/2);i(t[h])<n?o=h+1:s=h}return o},g.indexOf=N(1,g.findIndex,g.sortedIndex),g.lastIndexOf=N(-1,g.findLastIndex),g.range=function(t,r,i){null==r&&(r=t||0,t=0),i=i||1;for(var e=Math.max(Math.ceil((r-t)/i),0),n=Array(e),o=0;o<e;o++,t+=i)n[o]=t;return n};var C=function(t,r,i,e,n){if(!(e instanceof r))return t.apply(i,n);var o=b(t.prototype),s=t.apply(o,n);return g.isObject(s)?s:o};g.bind=function(t,r){if(d&&t.bind===d)return d.apply(t,a.call(arguments,1));if(!g.isFunction(t))throw new TypeError("Bind must be called on a function");var i=a.call(arguments,2),e=function(){return C(t,e,r,this,i.concat(a.call(arguments)))};return e},g.partial=function(t){var r=a.call(arguments,1),i=function(){for(var e=0,n=r.length,o=Array(n),s=0;s<n;s++)o[s]=r[s]===g?arguments[e++]:r[s];for(;e<arguments.length;)o.push(arguments[e++]);return C(t,i,this,this,o)};return i},g.bindAll=function(t){var r,i,e=arguments.length;if(e<=1)throw new Error("bindAll must be passed function names");for(r=1;r<e;r++)t[i=arguments[r]]=g.bind(t[i],t);return t},g.memoize=function(t,r){var i=function(e){var n=i.cache,o=""+(r?r.apply(this,arguments):e);return g.has(n,o)||(n[o]=t.apply(this,arguments)),n[o]};return i.cache={},i},g.delay=function(t,r){var i=a.call(arguments,2);return setTimeout(function(){return t.apply(null,i)},r)},g.defer=g.partial(g.delay,g,1),g.throttle=function(t,r,i){var e,n,o,s=null,h=0;i||(i={});var u=function(){h=!1===i.leading?0:g.now(),s=null,o=t.apply(e,n),s||(e=n=null)};return function(){var a=g.now();h||!1!==i.leading||(h=a);var l=r-(a-h);return e=this,n=arguments,l<=0||l>r?(s&&(clearTimeout(s),s=null),h=a,o=t.apply(e,n),s||(e=n=null)):s||!1===i.trailing||(s=setTimeout(u,l)),o}},g.debounce=function(t,r,i){var e,n,o,s,h,u=function(){var a=g.now()-s;a<r&&a>=0?e=setTimeout(u,r-a):(e=null,i||(h=t.apply(o,n),e||(o=n=null)))};return function(){o=this,n=arguments,s=g.now();var a=i&&!e;return e||(e=setTimeout(u,r)),a&&(h=t.apply(o,n),o=n=null),h}},g.wrap=function(t,r){return g.partial(r,t)},g.negate=function(t){return function(){return!t.apply(this,arguments)}},g.compose=function(){var t=arguments,r=t.length-1;return function(){for(var i=r,e=t[r].apply(this,arguments);i--;)e=t[i].call(this,e);return e}},g.after=function(t,r){return function(){if(--t<1)return r.apply(this,arguments)}},g.before=function(t,r){var i;return function(){return--t>0&&(i=r.apply(this,arguments)),t<=1&&(r=null),i}},g.once=g.partial(g.before,2);var O=!{toString:null}.propertyIsEnumerable("toString"),R=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];function I(t,r){var i=R.length,e=t.constructor,n=g.isFunction(e)&&e.prototype||s,o="constructor";for(g.has(t,o)&&!g.contains(r,o)&&r.push(o);i--;)(o=R[i])in t&&t[o]!==n[o]&&!g.contains(r,o)&&r.push(o)}g.keys=function(t){if(!g.isObject(t))return[];if(c)return c(t);var r=[];for(var i in t)g.has(t,i)&&r.push(i);return O&&I(t,r),r},g.allKeys=function(t){if(!g.isObject(t))return[];var r=[];for(var i in t)r.push(i);return O&&I(t,r),r},g.values=function(t){for(var r=g.keys(t),i=r.length,e=Array(i),n=0;n<i;n++)e[n]=t[r[n]];return e},g.mapObject=function(t,r,i){r=w(r,i);for(var e,n=g.keys(t),o=n.length,s={},h=0;h<o;h++)s[e=n[h]]=r(t[e],e,t);return s},g.pairs=function(t){for(var r=g.keys(t),i=r.length,e=Array(i),n=0;n<i;n++)e[n]=[r[n],t[r[n]]];return e},g.invert=function(t){for(var r={},i=g.keys(t),e=0,n=i.length;e<n;e++)r[t[i[e]]]=i[e];return r},g.functions=g.methods=function(t){var r=[];for(var i in t)g.isFunction(t[i])&&r.push(i);return r.sort()},g.extend=y(g.allKeys),g.extendOwn=g.assign=y(g.keys),g.findKey=function(t,r,i){r=w(r,i);for(var e,n=g.keys(t),o=0,s=n.length;o<s;o++)if(r(t[e=n[o]],e,t))return e},g.pick=function(t,r,i){var e,n,o={},s=t;if(null==s)return o;g.isFunction(r)?(n=g.allKeys(s),e=M(r,i)):(n=E(arguments,!1,!1,1),e=function(t,r,i){return r in i},s=Object(s));for(var h=0,u=n.length;h<u;h++){var a=n[h],l=s[a];e(l,a,s)&&(o[a]=l)}return o},g.omit=function(t,r,i){if(g.isFunction(r))r=g.negate(r);else{var e=g.map(E(arguments,!1,!1,1),String);r=function(t,r){return!g.contains(e,r)}}return g.pick(t,r,i)},g.defaults=y(g.allKeys,!0),g.create=function(t,r){var i=b(t);return r&&g.extendOwn(i,r),i},g.clone=function(t){return g.isObject(t)?g.isArray(t)?t.slice():g.extend({},t):t},g.tap=function(t,r){return r(t),t},g.isMatch=function(t,r){var i=g.keys(r),e=i.length;if(null==t)return!e;for(var n=Object(t),o=0;o<e;o++){var s=i[o];if(r[s]!==n[s]||!(s in n))return!1}return!0};var P=function(t,r,i,e){if(t===r)return 0!==t||1/t==1/r;if(null==t||null==r)return t===r;t instanceof g&&(t=t._wrapped),r instanceof g&&(r=r._wrapped);var n=l.call(t);if(n!==l.call(r))return!1;switch(n){case"[object RegExp]":case"[object String]":return""+t==""+r;case"[object Number]":return+t!=+t?+r!=+r:0==+t?1/+t==1/r:+t==+r;case"[object Date]":case"[object Boolean]":return+t==+r}var o="[object Array]"===n;if(!o){if("object"!=typeof t||"object"!=typeof r)return!1;var s=t.constructor,h=r.constructor;if(s!==h&&!(g.isFunction(s)&&s instanceof s&&g.isFunction(h)&&h instanceof h)&&"constructor"in t&&"constructor"in r)return!1}e=e||[];for(var u=(i=i||[]).length;u--;)if(i[u]===t)return e[u]===r;if(i.push(t),e.push(r),o){if((u=t.length)!==r.length)return!1;for(;u--;)if(!P(t[u],r[u],i,e))return!1}else{var a,f=g.keys(t);if(u=f.length,g.keys(r).length!==u)return!1;for(;u--;)if(a=f[u],!g.has(r,a)||!P(t[a],r[a],i,e))return!1}return i.pop(),e.pop(),!0};g.isEqual=function(t,r){return P(t,r)},g.isEmpty=function(t){return null==t||(S(t)&&(g.isArray(t)||g.isString(t)||g.isArguments(t))?0===t.length:0===g.keys(t).length)},g.isElement=function(t){return!(!t||1!==t.nodeType)},g.isArray=m||function(t){return"[object Array]"===l.call(t)},g.isObject=function(t){var r=typeof t;return"function"===r||"object"===r&&!!t},g.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(t){g["is"+t]=function(r){return l.call(r)==="[object "+t+"]"}}),g.isArguments(arguments)||(g.isArguments=function(t){return g.has(t,"callee")}),"object"!=typeof Int8Array&&(g.isFunction=function(t){return"function"==typeof t||!1}),g.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},g.isNaN=function(t){return g.isNumber(t)&&t!==+t},g.isBoolean=function(t){return!0===t||!1===t||"[object Boolean]"===l.call(t)},g.isNull=function(t){return null===t},g.isUndefined=function(t){return void 0===t},g.has=function(t,r){return null!=t&&f.call(t,r)},g.noConflict=function(){return i._=n,this},g.identity=function(t){return t},g.constant=function(t){return function(){return t}},g.noop=function(){},g.property=x,g.propertyOf=function(t){return null==t?function(){}:function(r){return t[r]}},g.matcher=g.matches=function(t){return t=g.extendOwn({},t),function(r){return g.isMatch(r,t)}},g.times=function(t,r,i){var e=Array(Math.max(0,t));r=M(r,i,1);for(var n=0;n<t;n++)e[n]=r(n);return e},g.random=function(t,r){return null==r&&(r=t,t=0),t+Math.floor(Math.random()*(r-t+1))},g.now=Date.now||function(){return(new Date).getTime()};var j={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},L=g.invert(j),H=function(t){var r=function(r){return t[r]},i="(?:"+g.keys(t).join("|")+")",e=RegExp(i),n=RegExp(i,"g");return function(t){return t=null==t?"":""+t,e.test(t)?t.replace(n,r):t}};g.escape=H(j),g.unescape=H(L),g.result=function(t,r,i){var e=null==t?void 0:t[r];return void 0===e&&(e=i),g.isFunction(e)?e.call(t):e};var F=0;g.uniqueId=function(t){var r=++F+"";return t?t+r:r},g.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,Z={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},U=/\\|'|\r|\n|\u2028|\u2029/g,z=function(t){return"\\"+Z[t]};g.template=function(t,r,i){!r&&i&&(r=i),r=g.defaults({},r,g.templateSettings);var e=RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),n=0,o="__p+='";t.replace(e,function(r,i,e,s,h){return o+=t.slice(n,h).replace(U,z),n=h+r.length,i?o+="'+\n((__t=("+i+"))==null?'':_.escape(__t))+\n'":e?o+="'+\n((__t=("+e+"))==null?'':__t)+\n'":s&&(o+="';\n"+s+"\n__p+='"),r}),o+="';\n",r.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{var s=new Function(r.variable||"obj","_",o)}catch(t){throw t.source=o,t}var h=function(t){return s.call(this,t,g)},u=r.variable||"obj";return h.source="function("+u+"){\n"+o+"}",h},g.chain=function(t){var r=g(t);return r._chain=!0,r};var D=function(t,r){return t._chain?g(r).chain():r};g.mixin=function(t){g.each(g.functions(t),function(r){var i=g[r]=t[r];g.prototype[r]=function(){var t=[this._wrapped];return u.apply(t,arguments),D(this,i.apply(g,t))}})},g.mixin(g),g.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var r=o[t];g.prototype[t]=function(){var i=this._wrapped;return r.apply(i,arguments),"shift"!==t&&"splice"!==t||0!==i.length||delete i[0],D(this,i)}}),g.each(["concat","join","slice"],function(t){var r=o[t];g.prototype[t]=function(){return D(this,r.apply(this._wrapped,arguments))}}),g.prototype.value=function(){return this._wrapped},g.prototype.valueOf=g.prototype.toJSON=g.prototype.value,g.prototype.toString=function(){return""+this._wrapped},void 0===(e=function(){return g}.apply(r,[]))||(t.exports=e)}).call(this)},function(t,r,i){var e=i(0),n=i(19),o=i(11),s=i(21),h=function(t){return e.isNumber(t)&&(t=Math.trunc(t)),new s(n.toTwosComplement(t).replace("0x",""))};t.exports={formatInputInt:h,formatInputBytes:function(t){if(!n.isHexStrict(t))throw new Error('Given parameter is not bytes: "'+t+'"');var r=t.replace(/^0x/i,"");if(r.length%2!=0)throw new Error('Given parameter bytes has an invalid length: "'+t+'"');if(r.length>64)throw new Error('Given parameter bytes is too long: "'+t+'"');var i=Math.floor((r.length+63)/64);return r=n.padRight(r,64*i),new s(r)},formatInputDynamicBytes:function(t){if(!n.isHexStrict(t))throw new Error('Given parameter is not bytes: "'+t+'"');var r=t.replace(/^0x/i,"");if(r.length%2!=0)throw new Error('Given parameter bytes has an invalid length: "'+t+'"');var i=r.length/2,e=Math.floor((r.length+63)/64);return r=n.padRight(r,64*e),new s(h(i).value+r)},formatInputString:function(t){if(!e.isString(t))throw new Error("Given parameter is not a valid string: "+t);var r=n.utf8ToHex(t).replace(/^0x/i,""),i=r.length/2,o=Math.floor((r.length+63)/64);return r=n.padRight(r,64*o),new s(h(i).value+r)},formatInputBool:function(t){return new s("000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0"))},formatOutputInt:function(t){var r=t.staticPart();if(!r&&!t.rawValue)throw new Error("Couldn't decode "+name+" from ABI: 0x"+t.rawValue);return function(t){return"1"===new o(t.substr(0,1),16).toString(2).substr(0,1)}(r)?new o(r,16).fromTwos(256).toString(10):new o(r,16).toString(10)},formatOutputUInt:function(t,r){var i=t.staticPart();if(!i&&!t.rawValue)throw new Error("Couldn't decode "+r+" from ABI: 0x"+t.rawValue);return new o(i,16).toString(10)},formatOutputBool:function(t,r){var i=t.staticPart();if(!i&&!t.rawValue)throw new Error("Couldn't decode "+r+" from ABI: 0x"+t.rawValue);return"0000000000000000000000000000000000000000000000000000000000000001"===i},formatOutputBytes:function(t,r){var i=r.match(/^bytes([0-9]*)/),e=parseInt(i[1]);if(t.staticPart().slice(0,2*e).length!==2*e)throw new Error("Couldn't decode "+r+" from ABI: 0x"+t.rawValue+" The size doesn't match.");return"0x"+t.staticPart().slice(0,2*e)},formatOutputDynamicBytes:function(t,r){var i=t.dynamicPart().slice(0,64);if(!i)throw new Error("Couldn't decode "+r+" from ABI: 0x"+t.rawValue);var e=2*new o(i,16).toNumber();return"0x"+t.dynamicPart().substr(64,e)},formatOutputString:function(t){var r=t.dynamicPart().slice(0,64);if(!r)throw new Error("ERROR: The returned value is not a convertible string:"+r);var i=2*new o(r,16).toNumber();return i?n.hexToUtf8("0x"+t.dynamicPart().substr(64,i).replace(/^0x/i,"")):""},formatOutputAddress:function(t,r){var i=t.staticPart();if(!i)throw new Error("Couldn't decode "+r+" from ABI: 0x"+t.rawValue);return n.toChecksumAddress("0x"+i.slice(i.length-40,i.length))},toTwosComplement:n.toTwosComplement}},function(t,r){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,r,i){"use strict";(function(t){var e=i(39),n=i(40),o=i(41);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function h(t,r){if(s()<r)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=u.prototype:(null===t&&(t=new u(r)),t.length=r),t}function u(t,r,i){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,r,i);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return f(this,t)}return a(this,t,r,i)}function a(t,r,i,e){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,i,e){if(r.byteLength,i<0||r.byteLength<i)throw new RangeError("'offset' is out of bounds");if(r.byteLength<i+(e||0))throw new RangeError("'length' is out of bounds");r=void 0===i&&void 0===e?new Uint8Array(r):void 0===e?new Uint8Array(r,i):new Uint8Array(r,i,e);u.TYPED_ARRAY_SUPPORT?(t=r).__proto__=u.prototype:t=m(t,r);return t}(t,r,i,e):"string"==typeof r?function(t,r,i){"string"==typeof i&&""!==i||(i="utf8");if(!u.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var e=0|d(r,i),n=(t=h(t,e)).write(r,i);n!==e&&(t=t.slice(0,n));return t}(t,r,i):function(t,r){if(u.isBuffer(r)){var i=0|c(r.length);return 0===(t=h(t,i)).length?t:(r.copy(t,0,0,i),t)}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||(e=r.length)!=e?h(t,0):m(t,r);if("Buffer"===r.type&&o(r.data))return m(t,r.data)}var e;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function f(t,r){if(l(r),t=h(t,r<0?0:0|c(r)),!u.TYPED_ARRAY_SUPPORT)for(var i=0;i<r;++i)t[i]=0;return t}function m(t,r){var i=r.length<0?0:0|c(r.length);t=h(t,i);for(var e=0;e<i;e+=1)t[e]=255&r[e];return t}function c(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function d(t,r){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return Z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return U(t).length;default:if(e)return Z(t).length;r=(""+r).toLowerCase(),e=!0}}function p(t,r,i){var e=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return N(this,r,i);case"utf8":case"utf-8":return k(this,r,i);case"ascii":return E(this,r,i);case"latin1":case"binary":return B(this,r,i);case"base64":return S(this,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,r,i);default:if(e)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),e=!0}}function v(t,r,i){var e=t[r];t[r]=t[i],t[i]=e}function g(t,r,i,e,n){if(0===t.length)return-1;if("string"==typeof i?(e=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=n?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(n)return-1;i=t.length-1}else if(i<0){if(!n)return-1;i=0}if("string"==typeof r&&(r=u.from(r,e)),u.isBuffer(r))return 0===r.length?-1:M(t,r,i,e,n);if("number"==typeof r)return r&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,r,i):Uint8Array.prototype.lastIndexOf.call(t,r,i):M(t,[r],i,e,n);throw new TypeError("val must be string, number or Buffer")}function M(t,r,i,e,n){var o,s=1,h=t.length,u=r.length;if(void 0!==e&&("ucs2"===(e=String(e).toLowerCase())||"ucs-2"===e||"utf16le"===e||"utf-16le"===e)){if(t.length<2||r.length<2)return-1;s=2,h/=2,u/=2,i/=2}function a(t,r){return 1===s?t[r]:t.readUInt16BE(r*s)}if(n){var l=-1;for(o=i;o<h;o++)if(a(t,o)===a(r,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(i+u>h&&(i=h-u),o=i;o>=0;o--){for(var f=!0,m=0;m<u;m++)if(a(t,o+m)!==a(r,m)){f=!1;break}if(f)return o}return-1}function w(t,r,i,e){i=Number(i)||0;var n=t.length-i;e?(e=Number(e))>n&&(e=n):e=n;var o=r.length;if(o%2!=0)throw new TypeError("Invalid hex string");e>o/2&&(e=o/2);for(var s=0;s<e;++s){var h=parseInt(r.substr(2*s,2),16);if(isNaN(h))return s;t[i+s]=h}return s}function y(t,r,i,e){return z(Z(r,t.length-i),t,i,e)}function b(t,r,i,e){return z(function(t){for(var r=[],i=0;i<t.length;++i)r.push(255&t.charCodeAt(i));return r}(r),t,i,e)}function x(t,r,i,e){return b(t,r,i,e)}function _(t,r,i,e){return z(U(r),t,i,e)}function A(t,r,i,e){return z(function(t,r){for(var i,e,n,o=[],s=0;s<t.length&&!((r-=2)<0);++s)i=t.charCodeAt(s),e=i>>8,n=i%256,o.push(n),o.push(e);return o}(r,t.length-i),t,i,e)}function S(t,r,i){return 0===r&&i===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,i))}function k(t,r,i){i=Math.min(t.length,i);for(var e=[],n=r;n<i;){var o,s,h,u,a=t[n],l=null,f=a>239?4:a>223?3:a>191?2:1;if(n+f<=i)switch(f){case 1:a<128&&(l=a);break;case 2:128==(192&(o=t[n+1]))&&(u=(31&a)<<6|63&o)>127&&(l=u);break;case 3:o=t[n+1],s=t[n+2],128==(192&o)&&128==(192&s)&&(u=(15&a)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=t[n+1],s=t[n+2],h=t[n+3],128==(192&o)&&128==(192&s)&&128==(192&h)&&(u=(15&a)<<18|(63&o)<<12|(63&s)<<6|63&h)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,e.push(l>>>10&1023|55296),l=56320|1023&l),e.push(l),n+=f}return function(t){var r=t.length;if(r<=T)return String.fromCharCode.apply(String,t);var i="",e=0;for(;e<r;)i+=String.fromCharCode.apply(String,t.slice(e,e+=T));return i}(e)}r.Buffer=u,r.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},r.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),r.kMaxLength=s(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,r,i){return a(null,t,r,i)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,r,i){return function(t,r,i,e){return l(r),r<=0?h(t,r):void 0!==i?"string"==typeof e?h(t,r).fill(i,e):h(t,r).fill(i):h(t,r)}(null,t,r,i)},u.allocUnsafe=function(t){return f(null,t)},u.allocUnsafeSlow=function(t){return f(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,r){if(!u.isBuffer(t)||!u.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var i=t.length,e=r.length,n=0,o=Math.min(i,e);n<o;++n)if(t[n]!==r[n]){i=t[n],e=r[n];break}return i<e?-1:e<i?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,r){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var i;if(void 0===r)for(r=0,i=0;i<t.length;++i)r+=t[i].length;var e=u.allocUnsafe(r),n=0;for(i=0;i<t.length;++i){var s=t[i];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(e,n),n+=s.length}return e},u.byteLength=d,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)v(this,r,r+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)v(this,r,r+3),v(this,r+1,r+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)v(this,r,r+7),v(this,r+1,r+6),v(this,r+2,r+5),v(this,r+3,r+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?k(this,0,t):p.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",i=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,r,i,e,n){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===i&&(i=t?t.length:0),void 0===e&&(e=0),void 0===n&&(n=this.length),r<0||i>t.length||e<0||n>this.length)throw new RangeError("out of range index");if(e>=n&&r>=i)return 0;if(e>=n)return-1;if(r>=i)return 1;if(this===t)return 0;for(var o=(n>>>=0)-(e>>>=0),s=(i>>>=0)-(r>>>=0),h=Math.min(o,s),a=this.slice(e,n),l=t.slice(r,i),f=0;f<h;++f)if(a[f]!==l[f]){o=a[f],s=l[f];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,r,i){return-1!==this.indexOf(t,r,i)},u.prototype.indexOf=function(t,r,i){return g(this,t,r,i,!0)},u.prototype.lastIndexOf=function(t,r,i){return g(this,t,r,i,!1)},u.prototype.write=function(t,r,i,e){if(void 0===r)e="utf8",i=this.length,r=0;else if(void 0===i&&"string"==typeof r)e=r,i=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(i)?(i|=0,void 0===e&&(e="utf8")):(e=i,i=void 0)}var n=this.length-r;if((void 0===i||i>n)&&(i=n),t.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");e||(e="utf8");for(var o=!1;;)switch(e){case"hex":return w(this,t,r,i);case"utf8":case"utf-8":return y(this,t,r,i);case"ascii":return b(this,t,r,i);case"latin1":case"binary":return x(this,t,r,i);case"base64":return _(this,t,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,r,i);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(""+e).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function E(t,r,i){var e="";i=Math.min(t.length,i);for(var n=r;n<i;++n)e+=String.fromCharCode(127&t[n]);return e}function B(t,r,i){var e="";i=Math.min(t.length,i);for(var n=r;n<i;++n)e+=String.fromCharCode(t[n]);return e}function N(t,r,i){var e=t.length;(!r||r<0)&&(r=0),(!i||i<0||i>e)&&(i=e);for(var n="",o=r;o<i;++o)n+=q(t[o]);return n}function C(t,r,i){for(var e=t.slice(r,i),n="",o=0;o<e.length;o+=2)n+=String.fromCharCode(e[o]+256*e[o+1]);return n}function O(t,r,i){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>i)throw new RangeError("Trying to access beyond buffer length")}function R(t,r,i,e,n,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>n||r<o)throw new RangeError('"value" argument is out of bounds');if(i+e>t.length)throw new RangeError("Index out of range")}function I(t,r,i,e){r<0&&(r=65535+r+1);for(var n=0,o=Math.min(t.length-i,2);n<o;++n)t[i+n]=(r&255<<8*(e?n:1-n))>>>8*(e?n:1-n)}function P(t,r,i,e){r<0&&(r=4294967295+r+1);for(var n=0,o=Math.min(t.length-i,4);n<o;++n)t[i+n]=r>>>8*(e?n:3-n)&255}function j(t,r,i,e,n,o){if(i+e>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function L(t,r,i,e,o){return o||j(t,0,i,4),n.write(t,r,i,e,23,4),i+4}function H(t,r,i,e,o){return o||j(t,0,i,8),n.write(t,r,i,e,52,8),i+8}u.prototype.slice=function(t,r){var i,e=this.length;if((t=~~t)<0?(t+=e)<0&&(t=0):t>e&&(t=e),(r=void 0===r?e:~~r)<0?(r+=e)<0&&(r=0):r>e&&(r=e),r<t&&(r=t),u.TYPED_ARRAY_SUPPORT)(i=this.subarray(t,r)).__proto__=u.prototype;else{var n=r-t;i=new u(n,void 0);for(var o=0;o<n;++o)i[o]=this[o+t]}return i},u.prototype.readUIntLE=function(t,r,i){t|=0,r|=0,i||O(t,r,this.length);for(var e=this[t],n=1,o=0;++o<r&&(n*=256);)e+=this[t+o]*n;return e},u.prototype.readUIntBE=function(t,r,i){t|=0,r|=0,i||O(t,r,this.length);for(var e=this[t+--r],n=1;r>0&&(n*=256);)e+=this[t+--r]*n;return e},u.prototype.readUInt8=function(t,r){return r||O(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,r){return r||O(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,r){return r||O(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,r){return r||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,r){return r||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,r,i){t|=0,r|=0,i||O(t,r,this.length);for(var e=this[t],n=1,o=0;++o<r&&(n*=256);)e+=this[t+o]*n;return e>=(n*=128)&&(e-=Math.pow(2,8*r)),e},u.prototype.readIntBE=function(t,r,i){t|=0,r|=0,i||O(t,r,this.length);for(var e=r,n=1,o=this[t+--e];e>0&&(n*=256);)o+=this[t+--e]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*r)),o},u.prototype.readInt8=function(t,r){return r||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,r){r||O(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},u.prototype.readInt16BE=function(t,r){r||O(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},u.prototype.readInt32LE=function(t,r){return r||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,r){return r||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,r){return r||O(t,4,this.length),n.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,r){return r||O(t,4,this.length),n.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,r){return r||O(t,8,this.length),n.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,r){return r||O(t,8,this.length),n.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,r,i,e){(t=+t,r|=0,i|=0,e)||R(this,t,r,i,Math.pow(2,8*i)-1,0);var n=1,o=0;for(this[r]=255&t;++o<i&&(n*=256);)this[r+o]=t/n&255;return r+i},u.prototype.writeUIntBE=function(t,r,i,e){(t=+t,r|=0,i|=0,e)||R(this,t,r,i,Math.pow(2,8*i)-1,0);var n=i-1,o=1;for(this[r+n]=255&t;--n>=0&&(o*=256);)this[r+n]=t/o&255;return r+i},u.prototype.writeUInt8=function(t,r,i){return t=+t,r|=0,i||R(this,t,r,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},u.prototype.writeUInt16LE=function(t,r,i){return t=+t,r|=0,i||R(this,t,r,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):I(this,t,r,!0),r+2},u.prototype.writeUInt16BE=function(t,r,i){return t=+t,r|=0,i||R(this,t,r,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):I(this,t,r,!1),r+2},u.prototype.writeUInt32LE=function(t,r,i){return t=+t,r|=0,i||R(this,t,r,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):P(this,t,r,!0),r+4},u.prototype.writeUInt32BE=function(t,r,i){return t=+t,r|=0,i||R(this,t,r,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):P(this,t,r,!1),r+4},u.prototype.writeIntLE=function(t,r,i,e){if(t=+t,r|=0,!e){var n=Math.pow(2,8*i-1);R(this,t,r,i,n-1,-n)}var o=0,s=1,h=0;for(this[r]=255&t;++o<i&&(s*=256);)t<0&&0===h&&0!==this[r+o-1]&&(h=1),this[r+o]=(t/s>>0)-h&255;return r+i},u.prototype.writeIntBE=function(t,r,i,e){if(t=+t,r|=0,!e){var n=Math.pow(2,8*i-1);R(this,t,r,i,n-1,-n)}var o=i-1,s=1,h=0;for(this[r+o]=255&t;--o>=0&&(s*=256);)t<0&&0===h&&0!==this[r+o+1]&&(h=1),this[r+o]=(t/s>>0)-h&255;return r+i},u.prototype.writeInt8=function(t,r,i){return t=+t,r|=0,i||R(this,t,r,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},u.prototype.writeInt16LE=function(t,r,i){return t=+t,r|=0,i||R(this,t,r,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):I(this,t,r,!0),r+2},u.prototype.writeInt16BE=function(t,r,i){return t=+t,r|=0,i||R(this,t,r,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):I(this,t,r,!1),r+2},u.prototype.writeInt32LE=function(t,r,i){return t=+t,r|=0,i||R(this,t,r,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):P(this,t,r,!0),r+4},u.prototype.writeInt32BE=function(t,r,i){return t=+t,r|=0,i||R(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):P(this,t,r,!1),r+4},u.prototype.writeFloatLE=function(t,r,i){return L(this,t,r,!0,i)},u.prototype.writeFloatBE=function(t,r,i){return L(this,t,r,!1,i)},u.prototype.writeDoubleLE=function(t,r,i){return H(this,t,r,!0,i)},u.prototype.writeDoubleBE=function(t,r,i){return H(this,t,r,!1,i)},u.prototype.copy=function(t,r,i,e){if(i||(i=0),e||0===e||(e=this.length),r>=t.length&&(r=t.length),r||(r=0),e>0&&e<i&&(e=i),e===i)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(e<0)throw new RangeError("sourceEnd out of bounds");e>this.length&&(e=this.length),t.length-r<e-i&&(e=t.length-r+i);var n,o=e-i;if(this===t&&i<r&&r<e)for(n=o-1;n>=0;--n)t[n+r]=this[n+i];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(n=0;n<o;++n)t[n+r]=this[n+i];else Uint8Array.prototype.set.call(t,this.subarray(i,i+o),r);return o},u.prototype.fill=function(t,r,i,e){if("string"==typeof t){if("string"==typeof r?(e=r,r=0,i=this.length):"string"==typeof i&&(e=i,i=this.length),1===t.length){var n=t.charCodeAt(0);n<256&&(t=n)}if(void 0!==e&&"string"!=typeof e)throw new TypeError("encoding must be a string");if("string"==typeof e&&!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;var o;if(r>>>=0,i=void 0===i?this.length:i>>>0,t||(t=0),"number"==typeof t)for(o=r;o<i;++o)this[o]=t;else{var s=u.isBuffer(t)?t:Z(new u(t,e).toString()),h=s.length;for(o=0;o<i-r;++o)this[o+r]=s[o%h]}return this};var F=/[^+\/0-9A-Za-z-_]/g;function q(t){return t<16?"0"+t.toString(16):t.toString(16)}function Z(t,r){var i;r=r||1/0;for(var e=t.length,n=null,o=[],s=0;s<e;++s){if((i=t.charCodeAt(s))>55295&&i<57344){if(!n){if(i>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(s+1===e){(r-=3)>-1&&o.push(239,191,189);continue}n=i;continue}if(i<56320){(r-=3)>-1&&o.push(239,191,189),n=i;continue}i=65536+(n-55296<<10|i-56320)}else n&&(r-=3)>-1&&o.push(239,191,189);if(n=null,i<128){if((r-=1)<0)break;o.push(i)}else if(i<2048){if((r-=2)<0)break;o.push(i>>6|192,63&i|128)}else if(i<65536){if((r-=3)<0)break;o.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return o}function U(t){return e.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(F,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,r,i,e){for(var n=0;n<e&&!(n+i>=r.length||n>=t.length);++n)r[n+i]=t[n];return n}}).call(this,i(6))},function(t,r,i){var e=i(1),n=i(21),o=function(t){this._inputFormatter=t.inputFormatter,this._outputFormatter=t.outputFormatter};o.prototype.isType=function(t){throw"This method should be overwritten for type "+t},o.prototype.staticPartLength=function(t){return(this.nestedTypes(t)||["[1]"]).map(function(t){return parseInt(t.slice(1,-1),10)||1}).reduce(function(t,r){return t*r},32)},o.prototype.isDynamicArray=function(t){var r=this.nestedTypes(t);return!!r&&!r[r.length-1].match(/[0-9]{1,}/g)},o.prototype.isStaticArray=function(t){var r=this.nestedTypes(t);return!!r&&!!r[r.length-1].match(/[0-9]{1,}/g)},o.prototype.staticArrayLength=function(t){var r=this.nestedTypes(t);return r?parseInt(r[r.length-1].match(/[0-9]{1,}/g)||1):1},o.prototype.nestedName=function(t){var r=this.nestedTypes(t);return r?t.substr(0,t.length-r[r.length-1].length):t},o.prototype.isDynamicType=function(){return!1},o.prototype.nestedTypes=function(t){return t.match(/(\[[0-9]*\])/g)},o.prototype.encode=function(t,r){var i,n,o,s=this;return this.isDynamicArray(r)?(i=t.length,n=s.nestedName(r),(o=[]).push(e.formatInputInt(i).encode()),t.forEach(function(t){o.push(s.encode(t,n))}),o):this.isStaticArray(r)?function(){for(var i=s.staticArrayLength(r),e=s.nestedName(r),n=[],o=0;o<i;o++)n.push(s.encode(t[o],e));return n}():this._inputFormatter(t,r).encode()},o.prototype.decode=function(t,r,i){var e=this;if(this.isDynamicArray(i))return function(){for(var n=parseInt("0x"+t.substr(2*r,64)),o=parseInt("0x"+t.substr(2*n,64)),s=n+32,h=e.nestedName(i),u=e.staticPartLength(h),a=32*Math.floor((u+31)/32),l=[],f=0;f<o*a;f+=a)l.push(e.decode(t,s+f,h));return l}();if(this.isStaticArray(i))return function(){for(var n=e.staticArrayLength(i),o=r,s=e.nestedName(i),h=e.staticPartLength(s),u=32*Math.floor((h+31)/32),a=[],l=0;l<n*u;l+=u)a.push(e.decode(t,o+l,s));return a}();if(this.isDynamicType(i))return function(){var o=parseInt("0x"+t.substr(2*r,64)),s=parseInt("0x"+t.substr(2*o,64)),h=Math.floor((s+31)/32),u=new n(t.substr(2*o,64*(1+h)),0,t);return e._outputFormatter(u,i)}();var o=this.staticPartLength(i),s=new n(t.substr(2*r,2*o),void 0,t);return this._outputFormatter(s,i)},t.exports=o},function(t,r,i){var e=i(44),n=i(45);t.exports=function(t){if("string"==typeof t||"number"==typeof t){var r=new e(1),i=String(t).toLowerCase().trim(),o="0x"===i.substr(0,2)||"-0x"===i.substr(0,3),s=n(i);if("-"===s.substr(0,1)&&(s=n(s.slice(1)),r=new e(-1,10)),!(s=""===s?"0":s).match(/^-?[0-9]+$/)&&s.match(/^[0-9A-Fa-f]+$/)||s.match(/^[a-fA-F]+$/)||!0===o&&s.match(/^[0-9A-Fa-f]+$/))return new e(s,16).mul(r);if((s.match(/^-?[0-9]+$/)||""===s)&&!1===o)return new e(s,10).mul(r)}else if("object"==typeof t&&t.toString&&!t.pop&&!t.push&&t.toString(10).match(/^-?[0-9]+$/)&&(t.mul||t.dividedToIntegerBy))return new e(t.toString(10),10);throw new Error("[number-to-bn] while converting number "+JSON.stringify(t)+" to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported.")}},function(t,r){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,r,i){"use strict";var e=i(43),n=i(5),o=new e(0),s=new e(-1),h={noether:"0",wei:"1",kwei:"1000",Kwei:"1000",babbage:"1000",femtoether:"1000",mwei:"1000000",Mwei:"1000000",lovelace:"1000000",picoether:"1000000",gwei:"1000000000",Gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"};function u(t){var r=t?t.toLowerCase():"ether",i=h[r];if("string"!=typeof i)throw new Error("[ethjs-unit] the unit provided "+t+" doesn't exists, please use the one of the following units "+JSON.stringify(h,null,2));return new e(i,10)}function a(t){if("string"==typeof t){if(!t.match(/^-?[0-9.]+$/))throw new Error("while converting number to string, invalid number value '"+t+"', should be a number matching (^-?[0-9.]+).");return t}if("number"==typeof t)return String(t);if("object"==typeof t&&t.toString&&(t.toTwos||t.dividedToIntegerBy))return t.toPrecision?String(t.toPrecision()):t.toString(10);throw new Error("while converting number to string, invalid number value '"+t+"' type "+typeof t+".")}t.exports={unitMap:h,numberToString:a,getValueOfUnit:u,fromWei:function(t,r,i){var e=n(t),a=e.lt(o),l=u(r),f=h[r].length-1||1,m=i||{};a&&(e=e.mul(s));for(var c=e.mod(l).toString(10);c.length<f;)c="0"+c;m.pad||(c=c.match(/^([0-9]*[1-9]|0)(0*)/)[1]);var d=e.div(l).toString(10);m.commify&&(d=d.replace(/\B(?=(\d{3})+(?!\d))/g,","));var p=d+("0"==c?"":"."+c);return a&&(p="-"+p),p},toWei:function(t,r){var i=a(t),n=u(r),o=h[r].length-1||1,l="-"===i.substring(0,1);if(l&&(i=i.substring(1)),"."===i)throw new Error("[ethjs-unit] while converting number "+t+" to wei, invalid value");var f=i.split(".");if(f.length>2)throw new Error("[ethjs-unit] while converting number "+t+" to wei,  too many decimal points");var m=f[0],c=f[1];if(m||(m="0"),c||(c="0"),c.length>o)throw new Error("[ethjs-unit] while converting number "+t+" to wei, too many decimal places");for(;c.length<o;)c+="0";m=new e(m),c=new e(c);var d=m.mul(n).add(c);return l&&(d=d.mul(s)),new e(d.toString(10),10)}}},function(t,r,i){(function(t,e){var n;!function(o){var s=r,h=(t&&t.exports,"object"==typeof e&&e);h.global!==h&&h.window;var u,a,l,f=String.fromCharCode;function m(t){for(var r,i,e=[],n=0,o=t.length;n<o;)(r=t.charCodeAt(n++))>=55296&&r<=56319&&n<o?56320==(64512&(i=t.charCodeAt(n++)))?e.push(((1023&r)<<10)+(1023&i)+65536):(e.push(r),n--):e.push(r);return e}function c(t){if(t>=55296&&t<=57343)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value")}function d(t,r){return f(t>>r&63|128)}function p(t){if(0==(4294967168&t))return f(t);var r="";return 0==(4294965248&t)?r=f(t>>6&31|192):0==(4294901760&t)?(c(t),r=f(t>>12&15|224),r+=d(t,6)):0==(4292870144&t)&&(r=f(t>>18&7|240),r+=d(t,12),r+=d(t,6)),r+=f(63&t|128)}function v(){if(l>=a)throw Error("Invalid byte index");var t=255&u[l];if(l++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function g(){var t,r;if(l>a)throw Error("Invalid byte index");if(l==a)return!1;if(t=255&u[l],l++,0==(128&t))return t;if(192==(224&t)){if((r=(31&t)<<6|v())>=128)return r;throw Error("Invalid continuation byte")}if(224==(240&t)){if((r=(15&t)<<12|v()<<6|v())>=2048)return c(r),r;throw Error("Invalid continuation byte")}if(240==(248&t)&&(r=(15&t)<<18|v()<<12|v()<<6|v())>=65536&&r<=1114111)return r;throw Error("Invalid UTF-8 detected")}var M={version:"2.0.0",encode:function(t){for(var r=m(t),i=r.length,e=-1,n="";++e<i;)n+=p(r[e]);return n},decode:function(t){u=m(t),a=u.length,l=0;for(var r,i=[];!1!==(r=g());)i.push(r);return function(t){for(var r,i=t.length,e=-1,n="";++e<i;)(r=t[e])>65535&&(n+=f((r-=65536)>>>10&1023|55296),r=56320|1023&r),n+=f(r);return n}(i)}};void 0===(n=function(){return M}.call(r,i,r,t))||(t.exports=n)}()}).call(this,i(2)(t),i(6))},function(t,r,i){t.exports=function(t,r){var e=i(49),n="function"==typeof r;if(t>65536){if(!n)throw new Error("Requested too many random bytes.");r(new Error("Requested too many random bytes."))}if(void 0!==e&&e.randomBytes){if(!n)return"0x"+e.randomBytes(t).toString("hex");e.randomBytes(t,function(t,i){t?r(u):r(null,"0x"+i.toString("hex"))})}else{var o;if(void 0!==e?o=e:"undefined"!=typeof msCrypto&&(o=msCrypto),o&&o.getRandomValues){var s=o.getRandomValues(new Uint8Array(t)),h="0x"+Array.from(s).map(function(t){return t.toString(16)}).join("");if(!n)return h;r(null,h)}else{var u=new Error('No "crypto" object available. This Browser doesn\'t support generating secure random bytes.');if(!n)throw u;r(u)}}}},function(t,r,i){"use strict";(function(t){function e(t){for(var i in t)r.hasOwnProperty(i)||(r[i]=t[i])}Object.defineProperty(r,"__esModule",{value:!0});const n=i(42),o=i(17);e(i(17)),e(i(51)),r.calcIntrinsicGas=function(i){let e=o.params.TxGas;if(i.data){const n=t.from(r.sanitizeHex(i.data),"hex");let s=0,h=0;for(const t of n)t?h++:s++;e+=o.params.TxDataZeroGas*s,e+=o.params.TxDataNonZeroGas*h}return i.to?e+=o.params.ClauseGas:e+=o.params.ClauseGasContractCreation,e},r.toPrefixedHex=function(t){return 0===t.indexOf("0x")?t:"0x"+t},r.sanitizeHex=function(t){return 0===t.indexOf("0x")?t.substr(2):t},r.isHex=function(t){return!!t&&"string"==typeof t&&/^(-0x|0x)?[0-9a-f]+$/i.test(t)},r.newNonce=function(){return Math.floor((new Date).getTime()/65535*Math.random()*65535)},r.toInteger=function(t){const r=Number.parseInt(t);return Number.isInteger(r)?r:null},r.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},r.isObject=function(t){return"[object Object]"===Object.prototype.toString.call(t)},r.isNull=function(t){return"[object Null]"===Object.prototype.toString.call(t)},r.isUndefined=function(t){return"[object Undefined]"===Object.prototype.toString.call(t)},r.isFunction=function(t){return"function"==typeof t},r.mustToBN=function(t){if(r.isNull(t)||r.isUndefined(t))throw new Error("input can't be null or undefined");return n.toBN(t).abs()},r.validNumberOrDefault=function(t,r){return"number"==typeof t&&Number.isInteger(t)?Math.abs(t):!1===Number.isNaN(Number.parseInt(t))?Math.abs(Number.parseInt(t)):r},r.validAddressOrError=function(t,i="Invalid address string"){if(/^(-0x|0x)?[0-9a-fA-F]{40}$/i.test(t))return r.toPrefixedHex(t);throw new Error(i)},r.validBytes32OrError=function(t,i="Invalid hex string"){if(/^(-0x|0x)?[0-9a-fA-F]{64}$/i.test(t))return r.toPrefixedHex(t);throw new Error(i)},r.leftPadToBytes32=function(t){return"0x"+"0".repeat(64-r.sanitizeHex(t).length)+r.sanitizeHex(t)}}).call(this,i(3).Buffer)},function(t,r,i){(function(t){!function(t,r){"use strict";function e(t,r){if(!t)throw new Error(r||"Assertion failed")}function n(t,r){t.super_=r;var i=function(){};i.prototype=r.prototype,t.prototype=new i,t.prototype.constructor=t}function o(t,r,i){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==r&&"be"!==r||(i=r,r=10),this._init(t||0,r||10,i||"be"))}var s;"object"==typeof t?t.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{s=i(3).Buffer}catch(t){}function h(t,r,i){for(var e=0,n=Math.min(t.length,i),o=r;o<n;o++){var s=t.charCodeAt(o)-48;e<<=4,e|=s>=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return e}function u(t,r,i,e){for(var n=0,o=Math.min(t.length,i),s=r;s<o;s++){var h=t.charCodeAt(s)-48;n*=e,n+=h>=49?h-49+10:h>=17?h-17+10:h}return n}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,r){return t.cmp(r)>0?t:r},o.min=function(t,r){return t.cmp(r)<0?t:r},o.prototype._init=function(t,r,i){if("number"==typeof t)return this._initNumber(t,r,i);if("object"==typeof t)return this._initArray(t,r,i);"hex"===r&&(r=16),e(r===(0|r)&&r>=2&&r<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===r?this._parseHex(t,n):this._parseBase(t,r,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===i&&this._initArray(this.toArray(),r,i)},o.prototype._initNumber=function(t,r,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(e(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),r,i)},o.prototype._initArray=function(t,r,i){if(e("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,h=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);return this.strip()},o.prototype._parseHex=function(t,r){this.length=Math.ceil((t.length-r)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var e,n,o=0;for(i=t.length-6,e=0;i>=r;i-=6)n=h(t,i,i+6),this.words[e]|=n<<o&67108863,this.words[e+1]|=n>>>26-o&4194303,(o+=24)>=26&&(o-=26,e++);i+6!==r&&(n=h(t,r,i+6),this.words[e]|=n<<o&67108863,this.words[e+1]|=n>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,r,i){this.words=[0],this.length=1;for(var e=0,n=1;n<=67108863;n*=r)e++;e--,n=n/r|0;for(var o=t.length-i,s=o%e,h=Math.min(o,o-s)+i,a=0,l=i;l<h;l+=e)a=u(t,l,l+e,r),this.imuln(n),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(0!==s){var f=1;for(a=u(t,l,t.length,r),l=0;l<s;l++)f*=r;this.imuln(f),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}},o.prototype.copy=function(t){t.words=new Array(this.length);for(var r=0;r<this.length;r++)t.words[r]=this.words[r];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],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];function m(t,r,i){i.negative=r.negative^t.negative;var e=t.length+r.length|0;i.length=e,e=e-1|0;var n=0|t.words[0],o=0|r.words[0],s=n*o,h=67108863&s,u=s/67108864|0;i.words[0]=h;for(var a=1;a<e;a++){for(var l=u>>>26,f=67108863&u,m=Math.min(a,r.length-1),c=Math.max(0,a-t.length+1);c<=m;c++){var d=a-c|0;l+=(s=(n=0|t.words[d])*(o=0|r.words[c])+f)/67108864|0,f=67108863&s}i.words[a]=0|f,u=0|l}return 0!==u?i.words[a]=0|u:i.length--,i.strip()}o.prototype.toString=function(t,r){var i;if(r=0|r||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var h=this.words[s],u=(16777215&(h<<n|o)).toString(16);i=0!==(o=h>>>24-n&16777215)||s!==this.length-1?a[6-u.length]+u+i:u+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%r!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var m=l[t],c=f[t];i="";var d=this.clone();for(d.negative=0;!d.isZero();){var p=d.modn(c).toString(t);i=(d=d.idivn(c)).isZero()?p+i:a[m-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%r!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}e(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,r){return e(void 0!==s),this.toArrayLike(s,t,r)},o.prototype.toArray=function(t,r){return this.toArrayLike(Array,t,r)},o.prototype.toArrayLike=function(t,r,i){var n=this.byteLength(),o=i||Math.max(1,n);e(n<=o,"byte array longer than desired length"),e(o>0,"Requested array length <= 0"),this.strip();var s,h,u="le"===r,a=new t(o),l=this.clone();if(u){for(h=0;!l.isZero();h++)s=l.andln(255),l.iushrn(8),a[h]=s;for(;h<o;h++)a[h]=0}else{for(h=0;h<o-n;h++)a[h]=0;for(h=0;!l.isZero();h++)s=l.andln(255),l.iushrn(8),a[o-h-1]=s}return a},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var r=t,i=0;return r>=4096&&(i+=13,r>>>=13),r>=64&&(i+=7,r>>>=7),r>=8&&(i+=4,r>>>=4),r>=2&&(i+=2,r>>>=2),i+r},o.prototype._zeroBits=function(t){if(0===t)return 26;var r=t,i=0;return 0==(8191&r)&&(i+=13,r>>>=13),0==(127&r)&&(i+=7,r>>>=7),0==(15&r)&&(i+=4,r>>>=4),0==(3&r)&&(i+=2,r>>>=2),0==(1&r)&&i++,i},o.prototype.bitLength=function(){var t=this.words[this.length-1],r=this._countBits(t);return 26*(this.length-1)+r},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,r=0;r<this.length;r++){var i=this._zeroBits(this.words[r]);if(t+=i,26!==i)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]|t.words[r];return this.strip()},o.prototype.ior=function(t){return e(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var r;r=this.length>t.length?t:this;for(var i=0;i<r.length;i++)this.words[i]=this.words[i]&t.words[i];return this.length=r.length,this.strip()},o.prototype.iand=function(t){return e(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var r,i;this.length>t.length?(r=this,i=t):(r=t,i=this);for(var e=0;e<i.length;e++)this.words[e]=r.words[e]^i.words[e];if(this!==r)for(;e<r.length;e++)this.words[e]=r.words[e];return this.length=r.length,this.strip()},o.prototype.ixor=function(t){return e(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){e("number"==typeof t&&t>=0);var r=0|Math.ceil(t/26),i=t%26;this._expand(r),i>0&&r--;for(var n=0;n<r;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,r){e("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=r?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},o.prototype.iadd=function(t){var r,i,e;if(0!==this.negative&&0===t.negative)return this.negative=0,r=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,r=this.isub(t),t.negative=1,r._normSign();this.length>t.length?(i=this,e=t):(i=t,e=this);for(var n=0,o=0;o<e.length;o++)r=(0|i.words[o])+(0|e.words[o])+n,this.words[o]=67108863&r,n=r>>>26;for(;0!==n&&o<i.length;o++)r=(0|i.words[o])+n,this.words[o]=67108863&r,n=r>>>26;if(this.length=i.length,0!==n)this.words[this.length]=n,this.length++;else if(i!==this)for(;o<i.length;o++)this.words[o]=i.words[o];return this},o.prototype.add=function(t){var r;return 0!==t.negative&&0===this.negative?(t.negative=0,r=this.sub(t),t.negative^=1,r):0===t.negative&&0!==this.negative?(this.negative=0,r=t.sub(this),this.negative=1,r):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var r=this.iadd(t);return t.negative=1,r._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var i,e,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(i=this,e=t):(i=t,e=this);for(var o=0,s=0;s<e.length;s++)o=(r=(0|i.words[s])-(0|e.words[s])+o)>>26,this.words[s]=67108863&r;for(;0!==o&&s<i.length;s++)o=(r=(0|i.words[s])+o)>>26,this.words[s]=67108863&r;if(0===o&&s<i.length&&i!==this)for(;s<i.length;s++)this.words[s]=i.words[s];return this.length=Math.max(this.length,s),i!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var c=function(t,r,i){var e,n,o,s=t.words,h=r.words,u=i.words,a=0,l=0|s[0],f=8191&l,m=l>>>13,c=0|s[1],d=8191&c,p=c>>>13,v=0|s[2],g=8191&v,M=v>>>13,w=0|s[3],y=8191&w,b=w>>>13,x=0|s[4],_=8191&x,A=x>>>13,S=0|s[5],k=8191&S,T=S>>>13,E=0|s[6],B=8191&E,N=E>>>13,C=0|s[7],O=8191&C,R=C>>>13,I=0|s[8],P=8191&I,j=I>>>13,L=0|s[9],H=8191&L,F=L>>>13,q=0|h[0],Z=8191&q,U=q>>>13,z=0|h[1],D=8191&z,W=z>>>13,$=0|h[2],G=8191&$,Y=$>>>13,J=0|h[3],X=8191&J,K=J>>>13,V=0|h[4],Q=8191&V,tt=V>>>13,rt=0|h[5],it=8191&rt,et=rt>>>13,nt=0|h[6],ot=8191&nt,st=nt>>>13,ht=0|h[7],ut=8191&ht,at=ht>>>13,lt=0|h[8],ft=8191&lt,mt=lt>>>13,ct=0|h[9],dt=8191&ct,pt=ct>>>13;i.negative=t.negative^r.negative,i.length=19;var vt=(a+(e=Math.imul(f,Z))|0)+((8191&(n=(n=Math.imul(f,U))+Math.imul(m,Z)|0))<<13)|0;a=((o=Math.imul(m,U))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,e=Math.imul(d,Z),n=(n=Math.imul(d,U))+Math.imul(p,Z)|0,o=Math.imul(p,U);var gt=(a+(e=e+Math.imul(f,D)|0)|0)+((8191&(n=(n=n+Math.imul(f,W)|0)+Math.imul(m,D)|0))<<13)|0;a=((o=o+Math.imul(m,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,e=Math.imul(g,Z),n=(n=Math.imul(g,U))+Math.imul(M,Z)|0,o=Math.imul(M,U),e=e+Math.imul(d,D)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,D)|0,o=o+Math.imul(p,W)|0;var Mt=(a+(e=e+Math.imul(f,G)|0)|0)+((8191&(n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,G)|0))<<13)|0;a=((o=o+Math.imul(m,Y)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,e=Math.imul(y,Z),n=(n=Math.imul(y,U))+Math.imul(b,Z)|0,o=Math.imul(b,U),e=e+Math.imul(g,D)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(M,D)|0,o=o+Math.imul(M,W)|0,e=e+Math.imul(d,G)|0,n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,Y)|0;var wt=(a+(e=e+Math.imul(f,X)|0)|0)+((8191&(n=(n=n+Math.imul(f,K)|0)+Math.imul(m,X)|0))<<13)|0;a=((o=o+Math.imul(m,K)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,e=Math.imul(_,Z),n=(n=Math.imul(_,U))+Math.imul(A,Z)|0,o=Math.imul(A,U),e=e+Math.imul(y,D)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,D)|0,o=o+Math.imul(b,W)|0,e=e+Math.imul(g,G)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,Y)|0,e=e+Math.imul(d,X)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,K)|0;var yt=(a+(e=e+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(m,Q)|0))<<13)|0;a=((o=o+Math.imul(m,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,e=Math.imul(k,Z),n=(n=Math.imul(k,U))+Math.imul(T,Z)|0,o=Math.imul(T,U),e=e+Math.imul(_,D)|0,n=(n=n+Math.imul(_,W)|0)+Math.imul(A,D)|0,o=o+Math.imul(A,W)|0,e=e+Math.imul(y,G)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,Y)|0,e=e+Math.imul(g,X)|0,n=(n=n+Math.imul(g,K)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,K)|0,e=e+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var bt=(a+(e=e+Math.imul(f,it)|0)|0)+((8191&(n=(n=n+Math.imul(f,et)|0)+Math.imul(m,it)|0))<<13)|0;a=((o=o+Math.imul(m,et)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,e=Math.imul(B,Z),n=(n=Math.imul(B,U))+Math.imul(N,Z)|0,o=Math.imul(N,U),e=e+Math.imul(k,D)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(T,D)|0,o=o+Math.imul(T,W)|0,e=e+Math.imul(_,G)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,Y)|0,e=e+Math.imul(y,X)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,K)|0,e=e+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,e=e+Math.imul(d,it)|0,n=(n=n+Math.imul(d,et)|0)+Math.imul(p,it)|0,o=o+Math.imul(p,et)|0;var xt=(a+(e=e+Math.imul(f,ot)|0)|0)+((8191&(n=(n=n+Math.imul(f,st)|0)+Math.imul(m,ot)|0))<<13)|0;a=((o=o+Math.imul(m,st)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,e=Math.imul(O,Z),n=(n=Math.imul(O,U))+Math.imul(R,Z)|0,o=Math.imul(R,U),e=e+Math.imul(B,D)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(N,D)|0,o=o+Math.imul(N,W)|0,e=e+Math.imul(k,G)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,Y)|0,e=e+Math.imul(_,X)|0,n=(n=n+Math.imul(_,K)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,K)|0,e=e+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,e=e+Math.imul(g,it)|0,n=(n=n+Math.imul(g,et)|0)+Math.imul(M,it)|0,o=o+Math.imul(M,et)|0,e=e+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var _t=(a+(e=e+Math.imul(f,ut)|0)|0)+((8191&(n=(n=n+Math.imul(f,at)|0)+Math.imul(m,ut)|0))<<13)|0;a=((o=o+Math.imul(m,at)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,e=Math.imul(P,Z),n=(n=Math.imul(P,U))+Math.imul(j,Z)|0,o=Math.imul(j,U),e=e+Math.imul(O,D)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(R,D)|0,o=o+Math.imul(R,W)|0,e=e+Math.imul(B,G)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,Y)|0,e=e+Math.imul(k,X)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(T,X)|0,o=o+Math.imul(T,K)|0,e=e+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,e=e+Math.imul(y,it)|0,n=(n=n+Math.imul(y,et)|0)+Math.imul(b,it)|0,o=o+Math.imul(b,et)|0,e=e+Math.imul(g,ot)|0,n=(n=n+Math.imul(g,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,e=e+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,at)|0;var At=(a+(e=e+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,mt)|0)+Math.imul(m,ft)|0))<<13)|0;a=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,e=Math.imul(H,Z),n=(n=Math.imul(H,U))+Math.imul(F,Z)|0,o=Math.imul(F,U),e=e+Math.imul(P,D)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(j,D)|0,o=o+Math.imul(j,W)|0,e=e+Math.imul(O,G)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,Y)|0,e=e+Math.imul(B,X)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,K)|0,e=e+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,e=e+Math.imul(_,it)|0,n=(n=n+Math.imul(_,et)|0)+Math.imul(A,it)|0,o=o+Math.imul(A,et)|0,e=e+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,e=e+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,at)|0,e=e+Math.imul(d,ft)|0,n=(n=n+Math.imul(d,mt)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,mt)|0;var St=(a+(e=e+Math.imul(f,dt)|0)|0)+((8191&(n=(n=n+Math.imul(f,pt)|0)+Math.imul(m,dt)|0))<<13)|0;a=((o=o+Math.imul(m,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,e=Math.imul(H,D),n=(n=Math.imul(H,W))+Math.imul(F,D)|0,o=Math.imul(F,W),e=e+Math.imul(P,G)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(j,G)|0,o=o+Math.imul(j,Y)|0,e=e+Math.imul(O,X)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,K)|0,e=e+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,e=e+Math.imul(k,it)|0,n=(n=n+Math.imul(k,et)|0)+Math.imul(T,it)|0,o=o+Math.imul(T,et)|0,e=e+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,e=e+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,at)|0,e=e+Math.imul(g,ft)|0,n=(n=n+Math.imul(g,mt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,mt)|0;var kt=(a+(e=e+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;a=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,e=Math.imul(H,G),n=(n=Math.imul(H,Y))+Math.imul(F,G)|0,o=Math.imul(F,Y),e=e+Math.imul(P,X)|0,n=(n=n+Math.imul(P,K)|0)+Math.imul(j,X)|0,o=o+Math.imul(j,K)|0,e=e+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,e=e+Math.imul(B,it)|0,n=(n=n+Math.imul(B,et)|0)+Math.imul(N,it)|0,o=o+Math.imul(N,et)|0,e=e+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,e=e+Math.imul(_,ut)|0,n=(n=n+Math.imul(_,at)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,at)|0,e=e+Math.imul(y,ft)|0,n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,mt)|0;var Tt=(a+(e=e+Math.imul(g,dt)|0)|0)+((8191&(n=(n=n+Math.imul(g,pt)|0)+Math.imul(M,dt)|0))<<13)|0;a=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,e=Math.imul(H,X),n=(n=Math.imul(H,K))+Math.imul(F,X)|0,o=Math.imul(F,K),e=e+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,e=e+Math.imul(O,it)|0,n=(n=n+Math.imul(O,et)|0)+Math.imul(R,it)|0,o=o+Math.imul(R,et)|0,e=e+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,e=e+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,at)|0,e=e+Math.imul(_,ft)|0,n=(n=n+Math.imul(_,mt)|0)+Math.imul(A,ft)|0,o=o+Math.imul(A,mt)|0;var Et=(a+(e=e+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(b,dt)|0))<<13)|0;a=((o=o+Math.imul(b,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,e=Math.imul(H,Q),n=(n=Math.imul(H,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),e=e+Math.imul(P,it)|0,n=(n=n+Math.imul(P,et)|0)+Math.imul(j,it)|0,o=o+Math.imul(j,et)|0,e=e+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,e=e+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,at)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,at)|0,e=e+Math.imul(k,ft)|0,n=(n=n+Math.imul(k,mt)|0)+Math.imul(T,ft)|0,o=o+Math.imul(T,mt)|0;var Bt=(a+(e=e+Math.imul(_,dt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(A,dt)|0))<<13)|0;a=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,e=Math.imul(H,it),n=(n=Math.imul(H,et))+Math.imul(F,it)|0,o=Math.imul(F,et),e=e+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,st)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,st)|0,e=e+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,at)|0,e=e+Math.imul(B,ft)|0,n=(n=n+Math.imul(B,mt)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,mt)|0;var Nt=(a+(e=e+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(T,dt)|0))<<13)|0;a=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,e=Math.imul(H,ot),n=(n=Math.imul(H,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),e=e+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(j,ut)|0,o=o+Math.imul(j,at)|0,e=e+Math.imul(O,ft)|0,n=(n=n+Math.imul(O,mt)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,mt)|0;var Ct=(a+(e=e+Math.imul(B,dt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul(N,dt)|0))<<13)|0;a=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,e=Math.imul(H,ut),n=(n=Math.imul(H,at))+Math.imul(F,ut)|0,o=Math.imul(F,at),e=e+Math.imul(P,ft)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(j,ft)|0,o=o+Math.imul(j,mt)|0;var Ot=(a+(e=e+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(R,dt)|0))<<13)|0;a=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,e=Math.imul(H,ft),n=(n=Math.imul(H,mt))+Math.imul(F,ft)|0,o=Math.imul(F,mt);var Rt=(a+(e=e+Math.imul(P,dt)|0)|0)+((8191&(n=(n=n+Math.imul(P,pt)|0)+Math.imul(j,dt)|0))<<13)|0;a=((o=o+Math.imul(j,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var It=(a+(e=Math.imul(H,dt))|0)+((8191&(n=(n=Math.imul(H,pt))+Math.imul(F,dt)|0))<<13)|0;return a=((o=Math.imul(F,pt))+(n>>>13)|0)+(It>>>26)|0,It&=67108863,u[0]=vt,u[1]=gt,u[2]=Mt,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=xt,u[7]=_t,u[8]=At,u[9]=St,u[10]=kt,u[11]=Tt,u[12]=Et,u[13]=Bt,u[14]=Nt,u[15]=Ct,u[16]=Ot,u[17]=Rt,u[18]=It,0!==a&&(u[19]=a,i.length++),i};function d(t,r,i){return(new p).mulp(t,r,i)}function p(t,r){this.x=t,this.y=r}Math.imul||(c=m),o.prototype.mulTo=function(t,r){var i=this.length+t.length;return 10===this.length&&10===t.length?c(this,t,r):i<63?m(this,t,r):i<1024?function(t,r,i){i.negative=r.negative^t.negative,i.length=t.length+r.length;for(var e=0,n=0,o=0;o<i.length-1;o++){var s=n;n=0;for(var h=67108863&e,u=Math.min(o,r.length-1),a=Math.max(0,o-t.length+1);a<=u;a++){var l=o-a,f=(0|t.words[l])*(0|r.words[a]),m=67108863&f;h=67108863&(m=m+h|0),n+=(s=(s=s+(f/67108864|0)|0)+(m>>>26)|0)>>>26,s&=67108863}i.words[o]=h,e=s,s=n}return 0!==e?i.words[o]=e:i.length--,i.strip()}(this,t,r):d(this,t,r)},p.prototype.makeRBT=function(t){for(var r=new Array(t),i=o.prototype._countBits(t)-1,e=0;e<t;e++)r[e]=this.revBin(e,i,t);return r},p.prototype.revBin=function(t,r,i){if(0===t||t===i-1)return t;for(var e=0,n=0;n<r;n++)e|=(1&t)<<r-n-1,t>>=1;return e},p.prototype.permute=function(t,r,i,e,n,o){for(var s=0;s<o;s++)e[s]=r[t[s]],n[s]=i[t[s]]},p.prototype.transform=function(t,r,i,e,n,o){this.permute(o,t,r,i,e,n);for(var s=1;s<n;s<<=1)for(var h=s<<1,u=Math.cos(2*Math.PI/h),a=Math.sin(2*Math.PI/h),l=0;l<n;l+=h)for(var f=u,m=a,c=0;c<s;c++){var d=i[l+c],p=e[l+c],v=i[l+c+s],g=e[l+c+s],M=f*v-m*g;g=f*g+m*v,v=M,i[l+c]=d+v,e[l+c]=p+g,i[l+c+s]=d-v,e[l+c+s]=p-g,c!==h&&(M=u*f-a*m,m=u*m+a*f,f=M)}},p.prototype.guessLen13b=function(t,r){var i=1|Math.max(r,t),e=1&i,n=0;for(i=i/2|0;i;i>>>=1)n++;return 1<<n+1+e},p.prototype.conjugate=function(t,r,i){if(!(i<=1))for(var e=0;e<i/2;e++){var n=t[e];t[e]=t[i-e-1],t[i-e-1]=n,n=r[e],r[e]=-r[i-e-1],r[i-e-1]=-n}},p.prototype.normalize13b=function(t,r){for(var i=0,e=0;e<r/2;e++){var n=8192*Math.round(t[2*e+1]/r)+Math.round(t[2*e]/r)+i;t[e]=67108863&n,i=n<67108864?0:n/67108864|0}return t},p.prototype.convert13b=function(t,r,i,n){for(var o=0,s=0;s<r;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*r;s<n;++s)i[s]=0;e(0===o),e(0==(-8192&o))},p.prototype.stub=function(t){for(var r=new Array(t),i=0;i<t;i++)r[i]=0;return r},p.prototype.mulp=function(t,r,i){var e=2*this.guessLen13b(t.length,r.length),n=this.makeRBT(e),o=this.stub(e),s=new Array(e),h=new Array(e),u=new Array(e),a=new Array(e),l=new Array(e),f=new Array(e),m=i.words;m.length=e,this.convert13b(t.words,t.length,s,e),this.convert13b(r.words,r.length,a,e),this.transform(s,o,h,u,e,n),this.transform(a,o,l,f,e,n);for(var c=0;c<e;c++){var d=h[c]*l[c]-u[c]*f[c];u[c]=h[c]*f[c]+u[c]*l[c],h[c]=d}return this.conjugate(h,u,e),this.transform(h,u,m,o,e,n),this.conjugate(m,o,e),this.normalize13b(m,e),i.negative=t.negative^r.negative,i.length=t.length+r.length,i.strip()},o.prototype.mul=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),this.mulTo(t,r)},o.prototype.mulf=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),d(this,t,r)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){e("number"==typeof t),e(t<67108864);for(var r=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&r);r>>=26,r+=n/67108864|0,r+=o>>>26,this.words[i]=67108863&o}return 0!==r&&(this.words[i]=r,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var r=function(t){for(var r=new Array(t.bitLength()),i=0;i<r.length;i++){var e=i/26|0,n=i%26;r[i]=(t.words[e]&1<<n)>>>n}return r}(t);if(0===r.length)return new o(1);for(var i=this,e=0;e<r.length&&0===r[e];e++,i=i.sqr());if(++e<r.length)for(var n=i.sqr();e<r.length;e++,n=n.sqr())0!==r[e]&&(i=i.mul(n));return i},o.prototype.iushln=function(t){e("number"==typeof t&&t>=0);var r,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(r=0;r<this.length;r++){var h=this.words[r]&o,u=(0|this.words[r])-h<<i;this.words[r]=u|s,s=h>>>26-i}s&&(this.words[r]=s,this.length++)}if(0!==n){for(r=this.length-1;r>=0;r--)this.words[r+n]=this.words[r];for(r=0;r<n;r++)this.words[r]=0;this.length+=n}return this.strip()},o.prototype.ishln=function(t){return e(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,r,i){var n;e("number"==typeof t&&t>=0),n=r?(r-r%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),h=67108863^67108863>>>o<<o,u=i;if(n-=s,n=Math.max(0,n),u){for(var a=0;a<s;a++)u.words[a]=this.words[a];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,a=0;a<this.length;a++)this.words[a]=this.words[a+s];else this.words[0]=0,this.length=1;var l=0;for(a=this.length-1;a>=0&&(0!==l||a>=n);a--){var f=0|this.words[a];this.words[a]=l<<26-o|f>>>o,l=f&h}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,r,i){return e(0===this.negative),this.iushrn(t,r,i)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){e("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,n=1<<r;return!(this.length<=i)&&!!(this.words[i]&n)},o.prototype.imaskn=function(t){e("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26;if(e(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==r&&i++,this.length=Math.min(i,this.length),0!==r){var n=67108863^67108863>>>r<<r;this.words[this.length-1]&=n}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return e("number"==typeof t),e(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var r=0;r<this.length&&this.words[r]>=67108864;r++)this.words[r]-=67108864,r===this.length-1?this.words[r+1]=1:this.words[r+1]++;return this.length=Math.max(this.length,r+1),this},o.prototype.isubn=function(t){if(e("number"==typeof t),e(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var r=0;r<this.length&&this.words[r]<0;r++)this.words[r]+=67108864,this.words[r+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,r,i){var n,o,s=t.length+i;this._expand(s);var h=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+h;var u=(0|t.words[n])*r;h=((o-=67108863&u)>>26)-(u/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)h=(o=(0|this.words[n+i])+h)>>26,this.words[n+i]=67108863&o;if(0===h)return this.strip();for(e(-1===h),h=0,n=0;n<this.length;n++)h=(o=-(0|this.words[n])+h)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,r){var i=(this.length,t.length),e=this.clone(),n=t,s=0|n.words[n.length-1];0!==(i=26-this._countBits(s))&&(n=n.ushln(i),e.iushln(i),s=0|n.words[n.length-1]);var h,u=e.length-n.length;if("mod"!==r){(h=new o(null)).length=u+1,h.words=new Array(h.length);for(var a=0;a<h.length;a++)h.words[a]=0}var l=e.clone()._ishlnsubmul(n,1,u);0===l.negative&&(e=l,h&&(h.words[u]=1));for(var f=u-1;f>=0;f--){var m=67108864*(0|e.words[n.length+f])+(0|e.words[n.length+f-1]);for(m=Math.min(m/s|0,67108863),e._ishlnsubmul(n,m,f);0!==e.negative;)m--,e.negative=0,e._ishlnsubmul(n,1,f),e.isZero()||(e.negative^=1);h&&(h.words[f]=m)}return h&&h.strip(),e.strip(),"div"!==r&&0!==i&&e.iushrn(i),{div:h||null,mod:e}},o.prototype.divmod=function(t,r,i){return e(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(h=this.neg().divmod(t,r),"mod"!==r&&(n=h.div.neg()),"div"!==r&&(s=h.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(h=this.divmod(t.neg(),r),"mod"!==r&&(n=h.div.neg()),{div:n,mod:h.mod}):0!=(this.negative&t.negative)?(h=this.neg().divmod(t.neg(),r),"div"!==r&&(s=h.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:h.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===r?{div:this.divn(t.words[0]),mod:null}:"mod"===r?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,r);var n,s,h},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var r=this.divmod(t);if(r.mod.isZero())return r.div;var i=0!==r.div.negative?r.mod.isub(t):r.mod,e=t.ushrn(1),n=t.andln(1),o=i.cmp(e);return o<0||1===n&&0===o?r.div:0!==r.div.negative?r.div.isubn(1):r.div.iaddn(1)},o.prototype.modn=function(t){e(t<=67108863);for(var r=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(r*i+(0|this.words[n]))%t;return i},o.prototype.idivn=function(t){e(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*r;this.words[i]=n/t|0,r=n%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){e(0===t.negative),e(!t.isZero());var r=this,i=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var n=new o(1),s=new o(0),h=new o(0),u=new o(1),a=0;r.isEven()&&i.isEven();)r.iushrn(1),i.iushrn(1),++a;for(var l=i.clone(),f=r.clone();!r.isZero();){for(var m=0,c=1;0==(r.words[0]&c)&&m<26;++m,c<<=1);if(m>0)for(r.iushrn(m);m-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(l),s.isub(f)),n.iushrn(1),s.iushrn(1);for(var d=0,p=1;0==(i.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(i.iushrn(d);d-- >0;)(h.isOdd()||u.isOdd())&&(h.iadd(l),u.isub(f)),h.iushrn(1),u.iushrn(1);r.cmp(i)>=0?(r.isub(i),n.isub(h),s.isub(u)):(i.isub(r),h.isub(n),u.isub(s))}return{a:h,b:u,gcd:i.iushln(a)}},o.prototype._invmp=function(t){e(0===t.negative),e(!t.isZero());var r=this,i=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var n,s=new o(1),h=new o(0),u=i.clone();r.cmpn(1)>0&&i.cmpn(1)>0;){for(var a=0,l=1;0==(r.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(r.iushrn(a);a-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,m=1;0==(i.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(i.iushrn(f);f-- >0;)h.isOdd()&&h.iadd(u),h.iushrn(1);r.cmp(i)>=0?(r.isub(i),s.isub(h)):(i.isub(r),h.isub(s))}return(n=0===r.cmpn(1)?s:h).cmpn(0)<0&&n.iadd(t),n},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var r=this.clone(),i=t.clone();r.negative=0,i.negative=0;for(var e=0;r.isEven()&&i.isEven();e++)r.iushrn(1),i.iushrn(1);for(;;){for(;r.isEven();)r.iushrn(1);for(;i.isEven();)i.iushrn(1);var n=r.cmp(i);if(n<0){var o=r;r=i,i=o}else if(0===n||0===i.cmpn(1))break;r.isub(i)}return i.iushln(e)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){e("number"==typeof t);var r=t%26,i=(t-r)/26,n=1<<r;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var h=0|this.words[s];o=(h+=o)>>>26,h&=67108863,this.words[s]=h}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var r,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)r=1;else{i&&(t=-t),e(t<=67108863,"Number is too big");var n=0|this.words[0];r=n===t?0:n<t?-1:1}return 0!==this.negative?0|-r:r},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var r=this.ucmp(t);return 0!==this.negative?0|-r:r},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var r=0,i=this.length-1;i>=0;i--){var e=0|this.words[i],n=0|t.words[i];if(e!==n){e<n?r=-1:e>n&&(r=1);break}}return r},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new x(t)},o.prototype.toRed=function(t){return e(!this.red,"Already a number in reduction context"),e(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return e(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return e(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function g(t,r){this.name=t,this.p=new o(r,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function y(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function x(t){if("string"==typeof t){var r=o._prime(t);this.m=r.p,this.prime=r}else e(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){x.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var r,i=t;do{this.split(i,this.tmp),r=(i=(i=this.imulK(i)).iadd(this.tmp)).bitLength()}while(r>this.n);var e=r<this.n?-1:i.ucmp(this.p);return 0===e?(i.words[0]=0,i.length=1):e>0?i.isub(this.p):i.strip(),i},g.prototype.split=function(t,r){t.iushrn(this.n,0,r)},g.prototype.imulK=function(t){return t.imul(this.k)},n(M,g),M.prototype.split=function(t,r){for(var i=Math.min(t.length,9),e=0;e<i;e++)r.words[e]=t.words[e];if(r.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(r.words[r.length++]=4194303&n,e=10;e<t.length;e++){var o=0|t.words[e];t.words[e-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,t.words[e-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var r=0,i=0;i<t.length;i++){var e=0|t.words[i];r+=977*e,t.words[i]=67108863&r,r=64*e+(r/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(w,g),n(y,g),n(b,g),b.prototype.imulK=function(t){for(var r=0,i=0;i<t.length;i++){var e=19*(0|t.words[i])+r,n=67108863&e;e>>>=26,t.words[i]=n,r=e}return 0!==r&&(t.words[t.length++]=r),t},o._prime=function(t){if(v[t])return v[t];var r;if("k256"===t)r=new M;else if("p224"===t)r=new w;else if("p192"===t)r=new y;else{if("p25519"!==t)throw new Error("Unknown prime "+t);r=new b}return v[t]=r,r},x.prototype._verify1=function(t){e(0===t.negative,"red works only with positives"),e(t.red,"red works only with red numbers")},x.prototype._verify2=function(t,r){e(0==(t.negative|r.negative),"red works only with positives"),e(t.red&&t.red===r.red,"red works only with red numbers")},x.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},x.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},x.prototype.add=function(t,r){this._verify2(t,r);var i=t.add(r);return i.cmp(this.m)>=0&&i.isub(this.m),i._forceRed(this)},x.prototype.iadd=function(t,r){this._verify2(t,r);var i=t.iadd(r);return i.cmp(this.m)>=0&&i.isub(this.m),i},x.prototype.sub=function(t,r){this._verify2(t,r);var i=t.sub(r);return i.cmpn(0)<0&&i.iadd(this.m),i._forceRed(this)},x.prototype.isub=function(t,r){this._verify2(t,r);var i=t.isub(r);return i.cmpn(0)<0&&i.iadd(this.m),i},x.prototype.shl=function(t,r){return this._verify1(t),this.imod(t.ushln(r))},x.prototype.imul=function(t,r){return this._verify2(t,r),this.imod(t.imul(r))},x.prototype.mul=function(t,r){return this._verify2(t,r),this.imod(t.mul(r))},x.prototype.isqr=function(t){return this.imul(t,t.clone())},x.prototype.sqr=function(t){return this.mul(t,t)},x.prototype.sqrt=function(t){if(t.isZero())return t.clone();var r=this.m.andln(3);if(e(r%2==1),3===r){var i=this.m.add(new o(1)).iushrn(2);return this.pow(t,i)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);e(!n.isZero());var h=new o(1).toRed(this),u=h.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,n),m=this.pow(t,n.addn(1).iushrn(1)),c=this.pow(t,n),d=s;0!==c.cmp(h);){for(var p=c,v=0;0!==p.cmp(h);v++)p=p.redSqr();e(v<d);var g=this.pow(f,new o(1).iushln(d-v-1));m=m.redMul(g),f=g.redSqr(),c=c.redMul(f),d=v}return m},x.prototype.invm=function(t){var r=t._invmp(this.m);return 0!==r.negative?(r.negative=0,this.imod(r).redNeg()):this.imod(r)},x.prototype.pow=function(t,r){if(r.isZero())return new o(1);if(0===r.cmpn(1))return t.clone();var i=new Array(16);i[0]=new o(1).toRed(this),i[1]=t;for(var e=2;e<i.length;e++)i[e]=this.mul(i[e-1],t);var n=i[0],s=0,h=0,u=r.bitLength()%26;for(0===u&&(u=26),e=r.length-1;e>=0;e--){for(var a=r.words[e],l=u-1;l>=0;l--){var f=a>>l&1;n!==i[0]&&(n=this.sqr(n)),0!==f||0!==s?(s<<=1,s|=f,(4===++h||0===e&&0===l)&&(n=this.mul(n,i[s]),h=0,s=0)):h=0}u=26}return n},x.prototype.convertTo=function(t){var r=t.umod(this.m);return r===t?r.clone():r},x.prototype.convertFrom=function(t){var r=t.clone();return r.red=null,r},o.mont=function(t){return new _(t)},n(_,x),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var r=this.imod(t.mul(this.rinv));return r.red=null,r},_.prototype.imul=function(t,r){if(t.isZero()||r.isZero())return t.words[0]=0,t.length=1,t;var i=t.imul(r),e=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(e).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},_.prototype.mul=function(t,r){if(t.isZero()||r.isZero())return new o(0)._forceRed(this);var i=t.mul(r),e=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(e).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,i(2)(t))},function(t,r,i){(function(t){!function(t,r){"use strict";function e(t,r){if(!t)throw new Error(r||"Assertion failed")}function n(t,r){t.super_=r;var i=function(){};i.prototype=r.prototype,t.prototype=new i,t.prototype.constructor=t}function o(t,r,i){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==r&&"be"!==r||(i=r,r=10),this._init(t||0,r||10,i||"be"))}var s;"object"==typeof t?t.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{s=i(3).Buffer}catch(t){}function h(t,r,i){for(var e=0,n=Math.min(t.length,i),o=r;o<n;o++){var s=t.charCodeAt(o)-48;e<<=4,e|=s>=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return e}function u(t,r,i,e){for(var n=0,o=Math.min(t.length,i),s=r;s<o;s++){var h=t.charCodeAt(s)-48;n*=e,n+=h>=49?h-49+10:h>=17?h-17+10:h}return n}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,r){return t.cmp(r)>0?t:r},o.min=function(t,r){return t.cmp(r)<0?t:r},o.prototype._init=function(t,r,i){if("number"==typeof t)return this._initNumber(t,r,i);if("object"==typeof t)return this._initArray(t,r,i);"hex"===r&&(r=16),e(r===(0|r)&&r>=2&&r<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===r?this._parseHex(t,n):this._parseBase(t,r,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===i&&this._initArray(this.toArray(),r,i)},o.prototype._initNumber=function(t,r,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(e(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),r,i)},o.prototype._initArray=function(t,r,i){if(e("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,h=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);return this.strip()},o.prototype._parseHex=function(t,r){this.length=Math.ceil((t.length-r)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var e,n,o=0;for(i=t.length-6,e=0;i>=r;i-=6)n=h(t,i,i+6),this.words[e]|=n<<o&67108863,this.words[e+1]|=n>>>26-o&4194303,(o+=24)>=26&&(o-=26,e++);i+6!==r&&(n=h(t,r,i+6),this.words[e]|=n<<o&67108863,this.words[e+1]|=n>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,r,i){this.words=[0],this.length=1;for(var e=0,n=1;n<=67108863;n*=r)e++;e--,n=n/r|0;for(var o=t.length-i,s=o%e,h=Math.min(o,o-s)+i,a=0,l=i;l<h;l+=e)a=u(t,l,l+e,r),this.imuln(n),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(0!==s){var f=1;for(a=u(t,l,t.length,r),l=0;l<s;l++)f*=r;this.imuln(f),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}},o.prototype.copy=function(t){t.words=new Array(this.length);for(var r=0;r<this.length;r++)t.words[r]=this.words[r];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],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];function m(t,r,i){i.negative=r.negative^t.negative;var e=t.length+r.length|0;i.length=e,e=e-1|0;var n=0|t.words[0],o=0|r.words[0],s=n*o,h=67108863&s,u=s/67108864|0;i.words[0]=h;for(var a=1;a<e;a++){for(var l=u>>>26,f=67108863&u,m=Math.min(a,r.length-1),c=Math.max(0,a-t.length+1);c<=m;c++){var d=a-c|0;l+=(s=(n=0|t.words[d])*(o=0|r.words[c])+f)/67108864|0,f=67108863&s}i.words[a]=0|f,u=0|l}return 0!==u?i.words[a]=0|u:i.length--,i.strip()}o.prototype.toString=function(t,r){var i;if(r=0|r||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var h=this.words[s],u=(16777215&(h<<n|o)).toString(16);i=0!==(o=h>>>24-n&16777215)||s!==this.length-1?a[6-u.length]+u+i:u+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%r!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var m=l[t],c=f[t];i="";var d=this.clone();for(d.negative=0;!d.isZero();){var p=d.modn(c).toString(t);i=(d=d.idivn(c)).isZero()?p+i:a[m-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%r!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}e(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,r){return e(void 0!==s),this.toArrayLike(s,t,r)},o.prototype.toArray=function(t,r){return this.toArrayLike(Array,t,r)},o.prototype.toArrayLike=function(t,r,i){var n=this.byteLength(),o=i||Math.max(1,n);e(n<=o,"byte array longer than desired length"),e(o>0,"Requested array length <= 0"),this.strip();var s,h,u="le"===r,a=new t(o),l=this.clone();if(u){for(h=0;!l.isZero();h++)s=l.andln(255),l.iushrn(8),a[h]=s;for(;h<o;h++)a[h]=0}else{for(h=0;h<o-n;h++)a[h]=0;for(h=0;!l.isZero();h++)s=l.andln(255),l.iushrn(8),a[o-h-1]=s}return a},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var r=t,i=0;return r>=4096&&(i+=13,r>>>=13),r>=64&&(i+=7,r>>>=7),r>=8&&(i+=4,r>>>=4),r>=2&&(i+=2,r>>>=2),i+r},o.prototype._zeroBits=function(t){if(0===t)return 26;var r=t,i=0;return 0==(8191&r)&&(i+=13,r>>>=13),0==(127&r)&&(i+=7,r>>>=7),0==(15&r)&&(i+=4,r>>>=4),0==(3&r)&&(i+=2,r>>>=2),0==(1&r)&&i++,i},o.prototype.bitLength=function(){var t=this.words[this.length-1],r=this._countBits(t);return 26*(this.length-1)+r},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,r=0;r<this.length;r++){var i=this._zeroBits(this.words[r]);if(t+=i,26!==i)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]|t.words[r];return this.strip()},o.prototype.ior=function(t){return e(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var r;r=this.length>t.length?t:this;for(var i=0;i<r.length;i++)this.words[i]=this.words[i]&t.words[i];return this.length=r.length,this.strip()},o.prototype.iand=function(t){return e(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var r,i;this.length>t.length?(r=this,i=t):(r=t,i=this);for(var e=0;e<i.length;e++)this.words[e]=r.words[e]^i.words[e];if(this!==r)for(;e<r.length;e++)this.words[e]=r.words[e];return this.length=r.length,this.strip()},o.prototype.ixor=function(t){return e(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){e("number"==typeof t&&t>=0);var r=0|Math.ceil(t/26),i=t%26;this._expand(r),i>0&&r--;for(var n=0;n<r;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,r){e("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=r?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},o.prototype.iadd=function(t){var r,i,e;if(0!==this.negative&&0===t.negative)return this.negative=0,r=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,r=this.isub(t),t.negative=1,r._normSign();this.length>t.length?(i=this,e=t):(i=t,e=this);for(var n=0,o=0;o<e.length;o++)r=(0|i.words[o])+(0|e.words[o])+n,this.words[o]=67108863&r,n=r>>>26;for(;0!==n&&o<i.length;o++)r=(0|i.words[o])+n,this.words[o]=67108863&r,n=r>>>26;if(this.length=i.length,0!==n)this.words[this.length]=n,this.length++;else if(i!==this)for(;o<i.length;o++)this.words[o]=i.words[o];return this},o.prototype.add=function(t){var r;return 0!==t.negative&&0===this.negative?(t.negative=0,r=this.sub(t),t.negative^=1,r):0===t.negative&&0!==this.negative?(this.negative=0,r=t.sub(this),this.negative=1,r):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var r=this.iadd(t);return t.negative=1,r._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var i,e,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(i=this,e=t):(i=t,e=this);for(var o=0,s=0;s<e.length;s++)o=(r=(0|i.words[s])-(0|e.words[s])+o)>>26,this.words[s]=67108863&r;for(;0!==o&&s<i.length;s++)o=(r=(0|i.words[s])+o)>>26,this.words[s]=67108863&r;if(0===o&&s<i.length&&i!==this)for(;s<i.length;s++)this.words[s]=i.words[s];return this.length=Math.max(this.length,s),i!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var c=function(t,r,i){var e,n,o,s=t.words,h=r.words,u=i.words,a=0,l=0|s[0],f=8191&l,m=l>>>13,c=0|s[1],d=8191&c,p=c>>>13,v=0|s[2],g=8191&v,M=v>>>13,w=0|s[3],y=8191&w,b=w>>>13,x=0|s[4],_=8191&x,A=x>>>13,S=0|s[5],k=8191&S,T=S>>>13,E=0|s[6],B=8191&E,N=E>>>13,C=0|s[7],O=8191&C,R=C>>>13,I=0|s[8],P=8191&I,j=I>>>13,L=0|s[9],H=8191&L,F=L>>>13,q=0|h[0],Z=8191&q,U=q>>>13,z=0|h[1],D=8191&z,W=z>>>13,$=0|h[2],G=8191&$,Y=$>>>13,J=0|h[3],X=8191&J,K=J>>>13,V=0|h[4],Q=8191&V,tt=V>>>13,rt=0|h[5],it=8191&rt,et=rt>>>13,nt=0|h[6],ot=8191&nt,st=nt>>>13,ht=0|h[7],ut=8191&ht,at=ht>>>13,lt=0|h[8],ft=8191&lt,mt=lt>>>13,ct=0|h[9],dt=8191&ct,pt=ct>>>13;i.negative=t.negative^r.negative,i.length=19;var vt=(a+(e=Math.imul(f,Z))|0)+((8191&(n=(n=Math.imul(f,U))+Math.imul(m,Z)|0))<<13)|0;a=((o=Math.imul(m,U))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,e=Math.imul(d,Z),n=(n=Math.imul(d,U))+Math.imul(p,Z)|0,o=Math.imul(p,U);var gt=(a+(e=e+Math.imul(f,D)|0)|0)+((8191&(n=(n=n+Math.imul(f,W)|0)+Math.imul(m,D)|0))<<13)|0;a=((o=o+Math.imul(m,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,e=Math.imul(g,Z),n=(n=Math.imul(g,U))+Math.imul(M,Z)|0,o=Math.imul(M,U),e=e+Math.imul(d,D)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,D)|0,o=o+Math.imul(p,W)|0;var Mt=(a+(e=e+Math.imul(f,G)|0)|0)+((8191&(n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,G)|0))<<13)|0;a=((o=o+Math.imul(m,Y)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,e=Math.imul(y,Z),n=(n=Math.imul(y,U))+Math.imul(b,Z)|0,o=Math.imul(b,U),e=e+Math.imul(g,D)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(M,D)|0,o=o+Math.imul(M,W)|0,e=e+Math.imul(d,G)|0,n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,Y)|0;var wt=(a+(e=e+Math.imul(f,X)|0)|0)+((8191&(n=(n=n+Math.imul(f,K)|0)+Math.imul(m,X)|0))<<13)|0;a=((o=o+Math.imul(m,K)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,e=Math.imul(_,Z),n=(n=Math.imul(_,U))+Math.imul(A,Z)|0,o=Math.imul(A,U),e=e+Math.imul(y,D)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,D)|0,o=o+Math.imul(b,W)|0,e=e+Math.imul(g,G)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,Y)|0,e=e+Math.imul(d,X)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,K)|0;var yt=(a+(e=e+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(m,Q)|0))<<13)|0;a=((o=o+Math.imul(m,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,e=Math.imul(k,Z),n=(n=Math.imul(k,U))+Math.imul(T,Z)|0,o=Math.imul(T,U),e=e+Math.imul(_,D)|0,n=(n=n+Math.imul(_,W)|0)+Math.imul(A,D)|0,o=o+Math.imul(A,W)|0,e=e+Math.imul(y,G)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,Y)|0,e=e+Math.imul(g,X)|0,n=(n=n+Math.imul(g,K)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,K)|0,e=e+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var bt=(a+(e=e+Math.imul(f,it)|0)|0)+((8191&(n=(n=n+Math.imul(f,et)|0)+Math.imul(m,it)|0))<<13)|0;a=((o=o+Math.imul(m,et)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,e=Math.imul(B,Z),n=(n=Math.imul(B,U))+Math.imul(N,Z)|0,o=Math.imul(N,U),e=e+Math.imul(k,D)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(T,D)|0,o=o+Math.imul(T,W)|0,e=e+Math.imul(_,G)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,Y)|0,e=e+Math.imul(y,X)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,K)|0,e=e+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,e=e+Math.imul(d,it)|0,n=(n=n+Math.imul(d,et)|0)+Math.imul(p,it)|0,o=o+Math.imul(p,et)|0;var xt=(a+(e=e+Math.imul(f,ot)|0)|0)+((8191&(n=(n=n+Math.imul(f,st)|0)+Math.imul(m,ot)|0))<<13)|0;a=((o=o+Math.imul(m,st)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,e=Math.imul(O,Z),n=(n=Math.imul(O,U))+Math.imul(R,Z)|0,o=Math.imul(R,U),e=e+Math.imul(B,D)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(N,D)|0,o=o+Math.imul(N,W)|0,e=e+Math.imul(k,G)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,Y)|0,e=e+Math.imul(_,X)|0,n=(n=n+Math.imul(_,K)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,K)|0,e=e+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,e=e+Math.imul(g,it)|0,n=(n=n+Math.imul(g,et)|0)+Math.imul(M,it)|0,o=o+Math.imul(M,et)|0,e=e+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var _t=(a+(e=e+Math.imul(f,ut)|0)|0)+((8191&(n=(n=n+Math.imul(f,at)|0)+Math.imul(m,ut)|0))<<13)|0;a=((o=o+Math.imul(m,at)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,e=Math.imul(P,Z),n=(n=Math.imul(P,U))+Math.imul(j,Z)|0,o=Math.imul(j,U),e=e+Math.imul(O,D)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(R,D)|0,o=o+Math.imul(R,W)|0,e=e+Math.imul(B,G)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,Y)|0,e=e+Math.imul(k,X)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(T,X)|0,o=o+Math.imul(T,K)|0,e=e+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,e=e+Math.imul(y,it)|0,n=(n=n+Math.imul(y,et)|0)+Math.imul(b,it)|0,o=o+Math.imul(b,et)|0,e=e+Math.imul(g,ot)|0,n=(n=n+Math.imul(g,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,e=e+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,at)|0;var At=(a+(e=e+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,mt)|0)+Math.imul(m,ft)|0))<<13)|0;a=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,e=Math.imul(H,Z),n=(n=Math.imul(H,U))+Math.imul(F,Z)|0,o=Math.imul(F,U),e=e+Math.imul(P,D)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(j,D)|0,o=o+Math.imul(j,W)|0,e=e+Math.imul(O,G)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,Y)|0,e=e+Math.imul(B,X)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,K)|0,e=e+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,e=e+Math.imul(_,it)|0,n=(n=n+Math.imul(_,et)|0)+Math.imul(A,it)|0,o=o+Math.imul(A,et)|0,e=e+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,e=e+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,at)|0,e=e+Math.imul(d,ft)|0,n=(n=n+Math.imul(d,mt)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,mt)|0;var St=(a+(e=e+Math.imul(f,dt)|0)|0)+((8191&(n=(n=n+Math.imul(f,pt)|0)+Math.imul(m,dt)|0))<<13)|0;a=((o=o+Math.imul(m,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,e=Math.imul(H,D),n=(n=Math.imul(H,W))+Math.imul(F,D)|0,o=Math.imul(F,W),e=e+Math.imul(P,G)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(j,G)|0,o=o+Math.imul(j,Y)|0,e=e+Math.imul(O,X)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,K)|0,e=e+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,e=e+Math.imul(k,it)|0,n=(n=n+Math.imul(k,et)|0)+Math.imul(T,it)|0,o=o+Math.imul(T,et)|0,e=e+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,e=e+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,at)|0,e=e+Math.imul(g,ft)|0,n=(n=n+Math.imul(g,mt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,mt)|0;var kt=(a+(e=e+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;a=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,e=Math.imul(H,G),n=(n=Math.imul(H,Y))+Math.imul(F,G)|0,o=Math.imul(F,Y),e=e+Math.imul(P,X)|0,n=(n=n+Math.imul(P,K)|0)+Math.imul(j,X)|0,o=o+Math.imul(j,K)|0,e=e+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,e=e+Math.imul(B,it)|0,n=(n=n+Math.imul(B,et)|0)+Math.imul(N,it)|0,o=o+Math.imul(N,et)|0,e=e+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,e=e+Math.imul(_,ut)|0,n=(n=n+Math.imul(_,at)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,at)|0,e=e+Math.imul(y,ft)|0,n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,mt)|0;var Tt=(a+(e=e+Math.imul(g,dt)|0)|0)+((8191&(n=(n=n+Math.imul(g,pt)|0)+Math.imul(M,dt)|0))<<13)|0;a=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,e=Math.imul(H,X),n=(n=Math.imul(H,K))+Math.imul(F,X)|0,o=Math.imul(F,K),e=e+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,e=e+Math.imul(O,it)|0,n=(n=n+Math.imul(O,et)|0)+Math.imul(R,it)|0,o=o+Math.imul(R,et)|0,e=e+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,e=e+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,at)|0,e=e+Math.imul(_,ft)|0,n=(n=n+Math.imul(_,mt)|0)+Math.imul(A,ft)|0,o=o+Math.imul(A,mt)|0;var Et=(a+(e=e+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(b,dt)|0))<<13)|0;a=((o=o+Math.imul(b,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,e=Math.imul(H,Q),n=(n=Math.imul(H,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),e=e+Math.imul(P,it)|0,n=(n=n+Math.imul(P,et)|0)+Math.imul(j,it)|0,o=o+Math.imul(j,et)|0,e=e+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,e=e+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,at)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,at)|0,e=e+Math.imul(k,ft)|0,n=(n=n+Math.imul(k,mt)|0)+Math.imul(T,ft)|0,o=o+Math.imul(T,mt)|0;var Bt=(a+(e=e+Math.imul(_,dt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(A,dt)|0))<<13)|0;a=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,e=Math.imul(H,it),n=(n=Math.imul(H,et))+Math.imul(F,it)|0,o=Math.imul(F,et),e=e+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,st)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,st)|0,e=e+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,at)|0,e=e+Math.imul(B,ft)|0,n=(n=n+Math.imul(B,mt)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,mt)|0;var Nt=(a+(e=e+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(T,dt)|0))<<13)|0;a=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,e=Math.imul(H,ot),n=(n=Math.imul(H,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),e=e+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(j,ut)|0,o=o+Math.imul(j,at)|0,e=e+Math.imul(O,ft)|0,n=(n=n+Math.imul(O,mt)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,mt)|0;var Ct=(a+(e=e+Math.imul(B,dt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul(N,dt)|0))<<13)|0;a=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,e=Math.imul(H,ut),n=(n=Math.imul(H,at))+Math.imul(F,ut)|0,o=Math.imul(F,at),e=e+Math.imul(P,ft)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(j,ft)|0,o=o+Math.imul(j,mt)|0;var Ot=(a+(e=e+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(R,dt)|0))<<13)|0;a=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,e=Math.imul(H,ft),n=(n=Math.imul(H,mt))+Math.imul(F,ft)|0,o=Math.imul(F,mt);var Rt=(a+(e=e+Math.imul(P,dt)|0)|0)+((8191&(n=(n=n+Math.imul(P,pt)|0)+Math.imul(j,dt)|0))<<13)|0;a=((o=o+Math.imul(j,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var It=(a+(e=Math.imul(H,dt))|0)+((8191&(n=(n=Math.imul(H,pt))+Math.imul(F,dt)|0))<<13)|0;return a=((o=Math.imul(F,pt))+(n>>>13)|0)+(It>>>26)|0,It&=67108863,u[0]=vt,u[1]=gt,u[2]=Mt,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=xt,u[7]=_t,u[8]=At,u[9]=St,u[10]=kt,u[11]=Tt,u[12]=Et,u[13]=Bt,u[14]=Nt,u[15]=Ct,u[16]=Ot,u[17]=Rt,u[18]=It,0!==a&&(u[19]=a,i.length++),i};function d(t,r,i){return(new p).mulp(t,r,i)}function p(t,r){this.x=t,this.y=r}Math.imul||(c=m),o.prototype.mulTo=function(t,r){var i=this.length+t.length;return 10===this.length&&10===t.length?c(this,t,r):i<63?m(this,t,r):i<1024?function(t,r,i){i.negative=r.negative^t.negative,i.length=t.length+r.length;for(var e=0,n=0,o=0;o<i.length-1;o++){var s=n;n=0;for(var h=67108863&e,u=Math.min(o,r.length-1),a=Math.max(0,o-t.length+1);a<=u;a++){var l=o-a,f=(0|t.words[l])*(0|r.words[a]),m=67108863&f;h=67108863&(m=m+h|0),n+=(s=(s=s+(f/67108864|0)|0)+(m>>>26)|0)>>>26,s&=67108863}i.words[o]=h,e=s,s=n}return 0!==e?i.words[o]=e:i.length--,i.strip()}(this,t,r):d(this,t,r)},p.prototype.makeRBT=function(t){for(var r=new Array(t),i=o.prototype._countBits(t)-1,e=0;e<t;e++)r[e]=this.revBin(e,i,t);return r},p.prototype.revBin=function(t,r,i){if(0===t||t===i-1)return t;for(var e=0,n=0;n<r;n++)e|=(1&t)<<r-n-1,t>>=1;return e},p.prototype.permute=function(t,r,i,e,n,o){for(var s=0;s<o;s++)e[s]=r[t[s]],n[s]=i[t[s]]},p.prototype.transform=function(t,r,i,e,n,o){this.permute(o,t,r,i,e,n);for(var s=1;s<n;s<<=1)for(var h=s<<1,u=Math.cos(2*Math.PI/h),a=Math.sin(2*Math.PI/h),l=0;l<n;l+=h)for(var f=u,m=a,c=0;c<s;c++){var d=i[l+c],p=e[l+c],v=i[l+c+s],g=e[l+c+s],M=f*v-m*g;g=f*g+m*v,v=M,i[l+c]=d+v,e[l+c]=p+g,i[l+c+s]=d-v,e[l+c+s]=p-g,c!==h&&(M=u*f-a*m,m=u*m+a*f,f=M)}},p.prototype.guessLen13b=function(t,r){var i=1|Math.max(r,t),e=1&i,n=0;for(i=i/2|0;i;i>>>=1)n++;return 1<<n+1+e},p.prototype.conjugate=function(t,r,i){if(!(i<=1))for(var e=0;e<i/2;e++){var n=t[e];t[e]=t[i-e-1],t[i-e-1]=n,n=r[e],r[e]=-r[i-e-1],r[i-e-1]=-n}},p.prototype.normalize13b=function(t,r){for(var i=0,e=0;e<r/2;e++){var n=8192*Math.round(t[2*e+1]/r)+Math.round(t[2*e]/r)+i;t[e]=67108863&n,i=n<67108864?0:n/67108864|0}return t},p.prototype.convert13b=function(t,r,i,n){for(var o=0,s=0;s<r;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*r;s<n;++s)i[s]=0;e(0===o),e(0==(-8192&o))},p.prototype.stub=function(t){for(var r=new Array(t),i=0;i<t;i++)r[i]=0;return r},p.prototype.mulp=function(t,r,i){var e=2*this.guessLen13b(t.length,r.length),n=this.makeRBT(e),o=this.stub(e),s=new Array(e),h=new Array(e),u=new Array(e),a=new Array(e),l=new Array(e),f=new Array(e),m=i.words;m.length=e,this.convert13b(t.words,t.length,s,e),this.convert13b(r.words,r.length,a,e),this.transform(s,o,h,u,e,n),this.transform(a,o,l,f,e,n);for(var c=0;c<e;c++){var d=h[c]*l[c]-u[c]*f[c];u[c]=h[c]*f[c]+u[c]*l[c],h[c]=d}return this.conjugate(h,u,e),this.transform(h,u,m,o,e,n),this.conjugate(m,o,e),this.normalize13b(m,e),i.negative=t.negative^r.negative,i.length=t.length+r.length,i.strip()},o.prototype.mul=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),this.mulTo(t,r)},o.prototype.mulf=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),d(this,t,r)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){e("number"==typeof t),e(t<67108864);for(var r=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&r);r>>=26,r+=n/67108864|0,r+=o>>>26,this.words[i]=67108863&o}return 0!==r&&(this.words[i]=r,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var r=function(t){for(var r=new Array(t.bitLength()),i=0;i<r.length;i++){var e=i/26|0,n=i%26;r[i]=(t.words[e]&1<<n)>>>n}return r}(t);if(0===r.length)return new o(1);for(var i=this,e=0;e<r.length&&0===r[e];e++,i=i.sqr());if(++e<r.length)for(var n=i.sqr();e<r.length;e++,n=n.sqr())0!==r[e]&&(i=i.mul(n));return i},o.prototype.iushln=function(t){e("number"==typeof t&&t>=0);var r,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(r=0;r<this.length;r++){var h=this.words[r]&o,u=(0|this.words[r])-h<<i;this.words[r]=u|s,s=h>>>26-i}s&&(this.words[r]=s,this.length++)}if(0!==n){for(r=this.length-1;r>=0;r--)this.words[r+n]=this.words[r];for(r=0;r<n;r++)this.words[r]=0;this.length+=n}return this.strip()},o.prototype.ishln=function(t){return e(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,r,i){var n;e("number"==typeof t&&t>=0),n=r?(r-r%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),h=67108863^67108863>>>o<<o,u=i;if(n-=s,n=Math.max(0,n),u){for(var a=0;a<s;a++)u.words[a]=this.words[a];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,a=0;a<this.length;a++)this.words[a]=this.words[a+s];else this.words[0]=0,this.length=1;var l=0;for(a=this.length-1;a>=0&&(0!==l||a>=n);a--){var f=0|this.words[a];this.words[a]=l<<26-o|f>>>o,l=f&h}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,r,i){return e(0===this.negative),this.iushrn(t,r,i)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){e("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,n=1<<r;return!(this.length<=i)&&!!(this.words[i]&n)},o.prototype.imaskn=function(t){e("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26;if(e(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==r&&i++,this.length=Math.min(i,this.length),0!==r){var n=67108863^67108863>>>r<<r;this.words[this.length-1]&=n}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return e("number"==typeof t),e(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var r=0;r<this.length&&this.words[r]>=67108864;r++)this.words[r]-=67108864,r===this.length-1?this.words[r+1]=1:this.words[r+1]++;return this.length=Math.max(this.length,r+1),this},o.prototype.isubn=function(t){if(e("number"==typeof t),e(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var r=0;r<this.length&&this.words[r]<0;r++)this.words[r]+=67108864,this.words[r+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,r,i){var n,o,s=t.length+i;this._expand(s);var h=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+h;var u=(0|t.words[n])*r;h=((o-=67108863&u)>>26)-(u/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)h=(o=(0|this.words[n+i])+h)>>26,this.words[n+i]=67108863&o;if(0===h)return this.strip();for(e(-1===h),h=0,n=0;n<this.length;n++)h=(o=-(0|this.words[n])+h)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,r){var i=(this.length,t.length),e=this.clone(),n=t,s=0|n.words[n.length-1];0!==(i=26-this._countBits(s))&&(n=n.ushln(i),e.iushln(i),s=0|n.words[n.length-1]);var h,u=e.length-n.length;if("mod"!==r){(h=new o(null)).length=u+1,h.words=new Array(h.length);for(var a=0;a<h.length;a++)h.words[a]=0}var l=e.clone()._ishlnsubmul(n,1,u);0===l.negative&&(e=l,h&&(h.words[u]=1));for(var f=u-1;f>=0;f--){var m=67108864*(0|e.words[n.length+f])+(0|e.words[n.length+f-1]);for(m=Math.min(m/s|0,67108863),e._ishlnsubmul(n,m,f);0!==e.negative;)m--,e.negative=0,e._ishlnsubmul(n,1,f),e.isZero()||(e.negative^=1);h&&(h.words[f]=m)}return h&&h.strip(),e.strip(),"div"!==r&&0!==i&&e.iushrn(i),{div:h||null,mod:e}},o.prototype.divmod=function(t,r,i){return e(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(h=this.neg().divmod(t,r),"mod"!==r&&(n=h.div.neg()),"div"!==r&&(s=h.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(h=this.divmod(t.neg(),r),"mod"!==r&&(n=h.div.neg()),{div:n,mod:h.mod}):0!=(this.negative&t.negative)?(h=this.neg().divmod(t.neg(),r),"div"!==r&&(s=h.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:h.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===r?{div:this.divn(t.words[0]),mod:null}:"mod"===r?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,r);var n,s,h},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var r=this.divmod(t);if(r.mod.isZero())return r.div;var i=0!==r.div.negative?r.mod.isub(t):r.mod,e=t.ushrn(1),n=t.andln(1),o=i.cmp(e);return o<0||1===n&&0===o?r.div:0!==r.div.negative?r.div.isubn(1):r.div.iaddn(1)},o.prototype.modn=function(t){e(t<=67108863);for(var r=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(r*i+(0|this.words[n]))%t;return i},o.prototype.idivn=function(t){e(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*r;this.words[i]=n/t|0,r=n%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){e(0===t.negative),e(!t.isZero());var r=this,i=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var n=new o(1),s=new o(0),h=new o(0),u=new o(1),a=0;r.isEven()&&i.isEven();)r.iushrn(1),i.iushrn(1),++a;for(var l=i.clone(),f=r.clone();!r.isZero();){for(var m=0,c=1;0==(r.words[0]&c)&&m<26;++m,c<<=1);if(m>0)for(r.iushrn(m);m-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(l),s.isub(f)),n.iushrn(1),s.iushrn(1);for(var d=0,p=1;0==(i.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(i.iushrn(d);d-- >0;)(h.isOdd()||u.isOdd())&&(h.iadd(l),u.isub(f)),h.iushrn(1),u.iushrn(1);r.cmp(i)>=0?(r.isub(i),n.isub(h),s.isub(u)):(i.isub(r),h.isub(n),u.isub(s))}return{a:h,b:u,gcd:i.iushln(a)}},o.prototype._invmp=function(t){e(0===t.negative),e(!t.isZero());var r=this,i=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var n,s=new o(1),h=new o(0),u=i.clone();r.cmpn(1)>0&&i.cmpn(1)>0;){for(var a=0,l=1;0==(r.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(r.iushrn(a);a-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,m=1;0==(i.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(i.iushrn(f);f-- >0;)h.isOdd()&&h.iadd(u),h.iushrn(1);r.cmp(i)>=0?(r.isub(i),s.isub(h)):(i.isub(r),h.isub(s))}return(n=0===r.cmpn(1)?s:h).cmpn(0)<0&&n.iadd(t),n},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var r=this.clone(),i=t.clone();r.negative=0,i.negative=0;for(var e=0;r.isEven()&&i.isEven();e++)r.iushrn(1),i.iushrn(1);for(;;){for(;r.isEven();)r.iushrn(1);for(;i.isEven();)i.iushrn(1);var n=r.cmp(i);if(n<0){var o=r;r=i,i=o}else if(0===n||0===i.cmpn(1))break;r.isub(i)}return i.iushln(e)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){e("number"==typeof t);var r=t%26,i=(t-r)/26,n=1<<r;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var h=0|this.words[s];o=(h+=o)>>>26,h&=67108863,this.words[s]=h}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var r,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)r=1;else{i&&(t=-t),e(t<=67108863,"Number is too big");var n=0|this.words[0];r=n===t?0:n<t?-1:1}return 0!==this.negative?0|-r:r},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var r=this.ucmp(t);return 0!==this.negative?0|-r:r},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var r=0,i=this.length-1;i>=0;i--){var e=0|this.words[i],n=0|t.words[i];if(e!==n){e<n?r=-1:e>n&&(r=1);break}}return r},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new x(t)},o.prototype.toRed=function(t){return e(!this.red,"Already a number in reduction context"),e(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return e(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return e(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function g(t,r){this.name=t,this.p=new o(r,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function y(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function x(t){if("string"==typeof t){var r=o._prime(t);this.m=r.p,this.prime=r}else e(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){x.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var r,i=t;do{this.split(i,this.tmp),r=(i=(i=this.imulK(i)).iadd(this.tmp)).bitLength()}while(r>this.n);var e=r<this.n?-1:i.ucmp(this.p);return 0===e?(i.words[0]=0,i.length=1):e>0?i.isub(this.p):i.strip(),i},g.prototype.split=function(t,r){t.iushrn(this.n,0,r)},g.prototype.imulK=function(t){return t.imul(this.k)},n(M,g),M.prototype.split=function(t,r){for(var i=Math.min(t.length,9),e=0;e<i;e++)r.words[e]=t.words[e];if(r.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(r.words[r.length++]=4194303&n,e=10;e<t.length;e++){var o=0|t.words[e];t.words[e-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,t.words[e-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var r=0,i=0;i<t.length;i++){var e=0|t.words[i];r+=977*e,t.words[i]=67108863&r,r=64*e+(r/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(w,g),n(y,g),n(b,g),b.prototype.imulK=function(t){for(var r=0,i=0;i<t.length;i++){var e=19*(0|t.words[i])+r,n=67108863&e;e>>>=26,t.words[i]=n,r=e}return 0!==r&&(t.words[t.length++]=r),t},o._prime=function(t){if(v[t])return v[t];var r;if("k256"===t)r=new M;else if("p224"===t)r=new w;else if("p192"===t)r=new y;else{if("p25519"!==t)throw new Error("Unknown prime "+t);r=new b}return v[t]=r,r},x.prototype._verify1=function(t){e(0===t.negative,"red works only with positives"),e(t.red,"red works only with red numbers")},x.prototype._verify2=function(t,r){e(0==(t.negative|r.negative),"red works only with positives"),e(t.red&&t.red===r.red,"red works only with red numbers")},x.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},x.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},x.prototype.add=function(t,r){this._verify2(t,r);var i=t.add(r);return i.cmp(this.m)>=0&&i.isub(this.m),i._forceRed(this)},x.prototype.iadd=function(t,r){this._verify2(t,r);var i=t.iadd(r);return i.cmp(this.m)>=0&&i.isub(this.m),i},x.prototype.sub=function(t,r){this._verify2(t,r);var i=t.sub(r);return i.cmpn(0)<0&&i.iadd(this.m),i._forceRed(this)},x.prototype.isub=function(t,r){this._verify2(t,r);var i=t.isub(r);return i.cmpn(0)<0&&i.iadd(this.m),i},x.prototype.shl=function(t,r){return this._verify1(t),this.imod(t.ushln(r))},x.prototype.imul=function(t,r){return this._verify2(t,r),this.imod(t.imul(r))},x.prototype.mul=function(t,r){return this._verify2(t,r),this.imod(t.mul(r))},x.prototype.isqr=function(t){return this.imul(t,t.clone())},x.prototype.sqr=function(t){return this.mul(t,t)},x.prototype.sqrt=function(t){if(t.isZero())return t.clone();var r=this.m.andln(3);if(e(r%2==1),3===r){var i=this.m.add(new o(1)).iushrn(2);return this.pow(t,i)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);e(!n.isZero());var h=new o(1).toRed(this),u=h.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,n),m=this.pow(t,n.addn(1).iushrn(1)),c=this.pow(t,n),d=s;0!==c.cmp(h);){for(var p=c,v=0;0!==p.cmp(h);v++)p=p.redSqr();e(v<d);var g=this.pow(f,new o(1).iushln(d-v-1));m=m.redMul(g),f=g.redSqr(),c=c.redMul(f),d=v}return m},x.prototype.invm=function(t){var r=t._invmp(this.m);return 0!==r.negative?(r.negative=0,this.imod(r).redNeg()):this.imod(r)},x.prototype.pow=function(t,r){if(r.isZero())return new o(1);if(0===r.cmpn(1))return t.clone();var i=new Array(16);i[0]=new o(1).toRed(this),i[1]=t;for(var e=2;e<i.length;e++)i[e]=this.mul(i[e-1],t);var n=i[0],s=0,h=0,u=r.bitLength()%26;for(0===u&&(u=26),e=r.length-1;e>=0;e--){for(var a=r.words[e],l=u-1;l>=0;l--){var f=a>>l&1;n!==i[0]&&(n=this.sqr(n)),0!==f||0!==s?(s<<=1,s|=f,(4===++h||0===e&&0===l)&&(n=this.mul(n,i[s]),h=0,s=0)):h=0}u=26}return n},x.prototype.convertTo=function(t){var r=t.umod(this.m);return r===t?r.clone():r},x.prototype.convertFrom=function(t){var r=t.clone();return r.red=null,r},o.mont=function(t){return new _(t)},n(_,x),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var r=this.imod(t.mul(this.rinv));return r.red=null,r},_.prototype.imul=function(t,r){if(t.isZero()||r.isZero())return t.words[0]=0,t.length=1,t;var i=t.imul(r),e=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(e).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},_.prototype.mul=function(t,r){if(t.isZero()||r.isZero())return new o(0)._forceRed(this);var i=t.mul(r),e=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(e).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,i(2)(t))},function(t,r,i){"use strict";r.decode=r.parse=i(31),r.encode=r.stringify=i(32)},function(t,r,i){"use strict";(function(e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}r.log=function(){var t;return"object"===("undefined"==typeof console?"undefined":n(console))&&console.log&&(t=console).log.apply(t,arguments)},r.formatArgs=function(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;var i="color: "+this.color;r.splice(1,0,i,"color: inherit");var e=0,n=0;r[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(e++,"%c"===t&&(n=e))}),r.splice(n,0,i)},r.save=function(t){try{t?r.storage.setItem("debug",t):r.storage.removeItem("debug")}catch(t){}},r.load=function(){var t;try{t=r.storage.getItem("debug")}catch(t){}!t&&void 0!==e&&"env"in e&&(t=e.env.DEBUG);return t},r.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},r.storage=function(){try{return localStorage}catch(t){}}(),r.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"],t.exports=i(34)(r),t.exports.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this,i(33))},function(t,r,i){var e=i(0),n=i(16),o=i(5),s=i(8),h=i(47),u=function(t){return t instanceof n||t&&t.constructor&&"BN"===t.constructor.name},a=function(t){return t&&t.constructor&&"BigNumber"===t.constructor.name},l=function(t){try{return o.apply(null,arguments)}catch(r){throw new Error(r+' Given value: "'+t+'"')}},f=function(t){return!!/^(0x)?[0-9a-f]{40}$/i.test(t)&&(!(!/^(0x|0X)?[0-9a-f]{40}$/.test(t)&&!/^(0x|0X)?[0-9A-F]{40}$/.test(t))||m(t))},m=function(t){t=t.replace(/^0x/i,"");for(var r=g(t.toLowerCase()).replace(/^0x/i,""),i=0;i<40;i++)if(parseInt(r[i],16)>7&&t[i].toUpperCase()!==t[i]||parseInt(r[i],16)<=7&&t[i].toLowerCase()!==t[i])return!1;return!0},c=function(t){var r="";t=(t=(t=(t=(t=s.encode(t)).replace(/^(?:\u0000)*/,"")).split("").reverse().join("")).replace(/^(?:\u0000)*/,"")).split("").reverse().join("");for(var i=0;i<t.length;i++){var e=t.charCodeAt(i).toString(16);r+=e.length<2?"0"+e:e}return"0x"+r},d=function(t){if(e.isNull(t)||e.isUndefined(t))return t;if(!isFinite(t)&&!v(t))throw new Error('Given input "'+t+'" is not a number.');var r=l(t),i=r.toString(16);return r.lt(new n(0))?"-0x"+i.substr(1):"0x"+i},p=function(t){if(t=t.toString(16),!v(t))throw new Error('Given value "'+t+'" is not a valid hex string.');t=t.replace(/^0x/i,"");for(var r=[],i=0;i<t.length;i+=2)r.push(parseInt(t.substr(i,2),16));return r},v=function(t){return(e.isString(t)||e.isNumber(t))&&/^(-)?0x[0-9a-f]*$/i.test(t)},g=function(t){u(t)&&(t=t.toString()),v(t)&&/^0x/i.test(t.toString())&&(t=p(t));var r=h.keccak256(t);return"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"===r?null:r};g._Hash=h,t.exports={BN:n,isBN:u,isBigNumber:a,toBN:l,isAddress:f,isBloom:function(t){return!(!/^(0x)?[0-9a-f]{512}$/i.test(t)||!/^(0x)?[0-9a-f]{512}$/.test(t)&&!/^(0x)?[0-9A-F]{512}$/.test(t))},isTopic:function(t){return!(!/^(0x)?[0-9a-f]{64}$/i.test(t)||!/^(0x)?[0-9a-f]{64}$/.test(t)&&!/^(0x)?[0-9A-F]{64}$/.test(t))},checkAddressChecksum:m,utf8ToHex:c,hexToUtf8:function(t){if(!v(t))throw new Error('The parameter "'+t+'" must be a valid HEX string.');for(var r="",i=0,e=(t=(t=(t=(t=(t=t.replace(/^0x/i,"")).replace(/^(?:00)*/,"")).split("").reverse().join("")).replace(/^(?:00)*/,"")).split("").reverse().join("")).length,n=0;n<e;n+=2)i=parseInt(t.substr(n,2),16),r+=String.fromCharCode(i);return s.decode(r)},hexToNumber:function(t){return t?l(t).toNumber():t},hexToNumberString:function(t){return t?l(t).toString(10):t},numberToHex:d,toHex:function(t,r){if(f(t))return r?"address":"0x"+t.toLowerCase().replace(/^0x/i,"");if(e.isBoolean(t))return r?"bool":t?"0x01":"0x00";if(e.isObject(t)&&!a(t)&&!u(t))return r?"string":c(JSON.stringify(t));if(e.isString(t)){if(0===t.indexOf("-0x")||0===t.indexOf("-0X"))return r?"int256":d(t);if(0===t.indexOf("0x")||0===t.indexOf("0X"))return r?"bytes":t;if(!isFinite(t))return r?"string":c(t)}return r?t<0?"int256":"uint256":d(t)},hexToBytes:p,bytesToHex:function(t){for(var r=[],i=0;i<t.length;i++)r.push((t[i]>>>4).toString(16)),r.push((15&t[i]).toString(16));return"0x"+r.join("")},isHex:function(t){return(e.isString(t)||e.isNumber(t))&&/^(-0x|0x)?[0-9a-f]*$/i.test(t)},isHexStrict:v,leftPad:function(t,r,i){var e=/^0x/i.test(t)||"number"==typeof t,n=r-(t=t.toString(16).replace(/^0x/i,"")).length+1>=0?r-t.length+1:0;return(e?"0x":"")+new Array(n).join(i||"0")+t},rightPad:function(t,r,i){var e=/^0x/i.test(t)||"number"==typeof t,n=r-(t=t.toString(16).replace(/^0x/i,"")).length+1>=0?r-t.length+1:0;return(e?"0x":"")+t+new Array(n).join(i||"0")},toTwosComplement:function(t){return"0x"+l(t).toTwos(256).toString(16,64)},sha3:g}},function(t,r,i){(function(t){!function(t,r){"use strict";function e(t,r){if(!t)throw new Error(r||"Assertion failed")}function n(t,r){t.super_=r;var i=function(){};i.prototype=r.prototype,t.prototype=new i,t.prototype.constructor=t}function o(t,r,i){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==r&&"be"!==r||(i=r,r=10),this._init(t||0,r||10,i||"be"))}var s;"object"==typeof t?t.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{s=i(3).Buffer}catch(t){}function h(t,r,i){for(var e=0,n=Math.min(t.length,i),o=r;o<n;o++){var s=t.charCodeAt(o)-48;e<<=4,e|=s>=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return e}function u(t,r,i,e){for(var n=0,o=Math.min(t.length,i),s=r;s<o;s++){var h=t.charCodeAt(s)-48;n*=e,n+=h>=49?h-49+10:h>=17?h-17+10:h}return n}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,r){return t.cmp(r)>0?t:r},o.min=function(t,r){return t.cmp(r)<0?t:r},o.prototype._init=function(t,r,i){if("number"==typeof t)return this._initNumber(t,r,i);if("object"==typeof t)return this._initArray(t,r,i);"hex"===r&&(r=16),e(r===(0|r)&&r>=2&&r<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===r?this._parseHex(t,n):this._parseBase(t,r,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===i&&this._initArray(this.toArray(),r,i)},o.prototype._initNumber=function(t,r,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(e(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),r,i)},o.prototype._initArray=function(t,r,i){if(e("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,h=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);return this.strip()},o.prototype._parseHex=function(t,r){this.length=Math.ceil((t.length-r)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var e,n,o=0;for(i=t.length-6,e=0;i>=r;i-=6)n=h(t,i,i+6),this.words[e]|=n<<o&67108863,this.words[e+1]|=n>>>26-o&4194303,(o+=24)>=26&&(o-=26,e++);i+6!==r&&(n=h(t,r,i+6),this.words[e]|=n<<o&67108863,this.words[e+1]|=n>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,r,i){this.words=[0],this.length=1;for(var e=0,n=1;n<=67108863;n*=r)e++;e--,n=n/r|0;for(var o=t.length-i,s=o%e,h=Math.min(o,o-s)+i,a=0,l=i;l<h;l+=e)a=u(t,l,l+e,r),this.imuln(n),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(0!==s){var f=1;for(a=u(t,l,t.length,r),l=0;l<s;l++)f*=r;this.imuln(f),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}},o.prototype.copy=function(t){t.words=new Array(this.length);for(var r=0;r<this.length;r++)t.words[r]=this.words[r];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],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];function m(t,r,i){i.negative=r.negative^t.negative;var e=t.length+r.length|0;i.length=e,e=e-1|0;var n=0|t.words[0],o=0|r.words[0],s=n*o,h=67108863&s,u=s/67108864|0;i.words[0]=h;for(var a=1;a<e;a++){for(var l=u>>>26,f=67108863&u,m=Math.min(a,r.length-1),c=Math.max(0,a-t.length+1);c<=m;c++){var d=a-c|0;l+=(s=(n=0|t.words[d])*(o=0|r.words[c])+f)/67108864|0,f=67108863&s}i.words[a]=0|f,u=0|l}return 0!==u?i.words[a]=0|u:i.length--,i.strip()}o.prototype.toString=function(t,r){var i;if(r=0|r||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var h=this.words[s],u=(16777215&(h<<n|o)).toString(16);i=0!==(o=h>>>24-n&16777215)||s!==this.length-1?a[6-u.length]+u+i:u+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%r!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var m=l[t],c=f[t];i="";var d=this.clone();for(d.negative=0;!d.isZero();){var p=d.modn(c).toString(t);i=(d=d.idivn(c)).isZero()?p+i:a[m-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%r!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}e(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,r){return e(void 0!==s),this.toArrayLike(s,t,r)},o.prototype.toArray=function(t,r){return this.toArrayLike(Array,t,r)},o.prototype.toArrayLike=function(t,r,i){var n=this.byteLength(),o=i||Math.max(1,n);e(n<=o,"byte array longer than desired length"),e(o>0,"Requested array length <= 0"),this.strip();var s,h,u="le"===r,a=new t(o),l=this.clone();if(u){for(h=0;!l.isZero();h++)s=l.andln(255),l.iushrn(8),a[h]=s;for(;h<o;h++)a[h]=0}else{for(h=0;h<o-n;h++)a[h]=0;for(h=0;!l.isZero();h++)s=l.andln(255),l.iushrn(8),a[o-h-1]=s}return a},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var r=t,i=0;return r>=4096&&(i+=13,r>>>=13),r>=64&&(i+=7,r>>>=7),r>=8&&(i+=4,r>>>=4),r>=2&&(i+=2,r>>>=2),i+r},o.prototype._zeroBits=function(t){if(0===t)return 26;var r=t,i=0;return 0==(8191&r)&&(i+=13,r>>>=13),0==(127&r)&&(i+=7,r>>>=7),0==(15&r)&&(i+=4,r>>>=4),0==(3&r)&&(i+=2,r>>>=2),0==(1&r)&&i++,i},o.prototype.bitLength=function(){var t=this.words[this.length-1],r=this._countBits(t);return 26*(this.length-1)+r},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,r=0;r<this.length;r++){var i=this._zeroBits(this.words[r]);if(t+=i,26!==i)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]|t.words[r];return this.strip()},o.prototype.ior=function(t){return e(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var r;r=this.length>t.length?t:this;for(var i=0;i<r.length;i++)this.words[i]=this.words[i]&t.words[i];return this.length=r.length,this.strip()},o.prototype.iand=function(t){return e(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var r,i;this.length>t.length?(r=this,i=t):(r=t,i=this);for(var e=0;e<i.length;e++)this.words[e]=r.words[e]^i.words[e];if(this!==r)for(;e<r.length;e++)this.words[e]=r.words[e];return this.length=r.length,this.strip()},o.prototype.ixor=function(t){return e(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){e("number"==typeof t&&t>=0);var r=0|Math.ceil(t/26),i=t%26;this._expand(r),i>0&&r--;for(var n=0;n<r;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,r){e("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=r?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},o.prototype.iadd=function(t){var r,i,e;if(0!==this.negative&&0===t.negative)return this.negative=0,r=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,r=this.isub(t),t.negative=1,r._normSign();this.length>t.length?(i=this,e=t):(i=t,e=this);for(var n=0,o=0;o<e.length;o++)r=(0|i.words[o])+(0|e.words[o])+n,this.words[o]=67108863&r,n=r>>>26;for(;0!==n&&o<i.length;o++)r=(0|i.words[o])+n,this.words[o]=67108863&r,n=r>>>26;if(this.length=i.length,0!==n)this.words[this.length]=n,this.length++;else if(i!==this)for(;o<i.length;o++)this.words[o]=i.words[o];return this},o.prototype.add=function(t){var r;return 0!==t.negative&&0===this.negative?(t.negative=0,r=this.sub(t),t.negative^=1,r):0===t.negative&&0!==this.negative?(this.negative=0,r=t.sub(this),this.negative=1,r):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var r=this.iadd(t);return t.negative=1,r._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var i,e,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(i=this,e=t):(i=t,e=this);for(var o=0,s=0;s<e.length;s++)o=(r=(0|i.words[s])-(0|e.words[s])+o)>>26,this.words[s]=67108863&r;for(;0!==o&&s<i.length;s++)o=(r=(0|i.words[s])+o)>>26,this.words[s]=67108863&r;if(0===o&&s<i.length&&i!==this)for(;s<i.length;s++)this.words[s]=i.words[s];return this.length=Math.max(this.length,s),i!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var c=function(t,r,i){var e,n,o,s=t.words,h=r.words,u=i.words,a=0,l=0|s[0],f=8191&l,m=l>>>13,c=0|s[1],d=8191&c,p=c>>>13,v=0|s[2],g=8191&v,M=v>>>13,w=0|s[3],y=8191&w,b=w>>>13,x=0|s[4],_=8191&x,A=x>>>13,S=0|s[5],k=8191&S,T=S>>>13,E=0|s[6],B=8191&E,N=E>>>13,C=0|s[7],O=8191&C,R=C>>>13,I=0|s[8],P=8191&I,j=I>>>13,L=0|s[9],H=8191&L,F=L>>>13,q=0|h[0],Z=8191&q,U=q>>>13,z=0|h[1],D=8191&z,W=z>>>13,$=0|h[2],G=8191&$,Y=$>>>13,J=0|h[3],X=8191&J,K=J>>>13,V=0|h[4],Q=8191&V,tt=V>>>13,rt=0|h[5],it=8191&rt,et=rt>>>13,nt=0|h[6],ot=8191&nt,st=nt>>>13,ht=0|h[7],ut=8191&ht,at=ht>>>13,lt=0|h[8],ft=8191&lt,mt=lt>>>13,ct=0|h[9],dt=8191&ct,pt=ct>>>13;i.negative=t.negative^r.negative,i.length=19;var vt=(a+(e=Math.imul(f,Z))|0)+((8191&(n=(n=Math.imul(f,U))+Math.imul(m,Z)|0))<<13)|0;a=((o=Math.imul(m,U))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,e=Math.imul(d,Z),n=(n=Math.imul(d,U))+Math.imul(p,Z)|0,o=Math.imul(p,U);var gt=(a+(e=e+Math.imul(f,D)|0)|0)+((8191&(n=(n=n+Math.imul(f,W)|0)+Math.imul(m,D)|0))<<13)|0;a=((o=o+Math.imul(m,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,e=Math.imul(g,Z),n=(n=Math.imul(g,U))+Math.imul(M,Z)|0,o=Math.imul(M,U),e=e+Math.imul(d,D)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,D)|0,o=o+Math.imul(p,W)|0;var Mt=(a+(e=e+Math.imul(f,G)|0)|0)+((8191&(n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,G)|0))<<13)|0;a=((o=o+Math.imul(m,Y)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,e=Math.imul(y,Z),n=(n=Math.imul(y,U))+Math.imul(b,Z)|0,o=Math.imul(b,U),e=e+Math.imul(g,D)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(M,D)|0,o=o+Math.imul(M,W)|0,e=e+Math.imul(d,G)|0,n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,Y)|0;var wt=(a+(e=e+Math.imul(f,X)|0)|0)+((8191&(n=(n=n+Math.imul(f,K)|0)+Math.imul(m,X)|0))<<13)|0;a=((o=o+Math.imul(m,K)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,e=Math.imul(_,Z),n=(n=Math.imul(_,U))+Math.imul(A,Z)|0,o=Math.imul(A,U),e=e+Math.imul(y,D)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,D)|0,o=o+Math.imul(b,W)|0,e=e+Math.imul(g,G)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,Y)|0,e=e+Math.imul(d,X)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,K)|0;var yt=(a+(e=e+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(m,Q)|0))<<13)|0;a=((o=o+Math.imul(m,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,e=Math.imul(k,Z),n=(n=Math.imul(k,U))+Math.imul(T,Z)|0,o=Math.imul(T,U),e=e+Math.imul(_,D)|0,n=(n=n+Math.imul(_,W)|0)+Math.imul(A,D)|0,o=o+Math.imul(A,W)|0,e=e+Math.imul(y,G)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,Y)|0,e=e+Math.imul(g,X)|0,n=(n=n+Math.imul(g,K)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,K)|0,e=e+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var bt=(a+(e=e+Math.imul(f,it)|0)|0)+((8191&(n=(n=n+Math.imul(f,et)|0)+Math.imul(m,it)|0))<<13)|0;a=((o=o+Math.imul(m,et)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,e=Math.imul(B,Z),n=(n=Math.imul(B,U))+Math.imul(N,Z)|0,o=Math.imul(N,U),e=e+Math.imul(k,D)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(T,D)|0,o=o+Math.imul(T,W)|0,e=e+Math.imul(_,G)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,Y)|0,e=e+Math.imul(y,X)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,K)|0,e=e+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,e=e+Math.imul(d,it)|0,n=(n=n+Math.imul(d,et)|0)+Math.imul(p,it)|0,o=o+Math.imul(p,et)|0;var xt=(a+(e=e+Math.imul(f,ot)|0)|0)+((8191&(n=(n=n+Math.imul(f,st)|0)+Math.imul(m,ot)|0))<<13)|0;a=((o=o+Math.imul(m,st)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,e=Math.imul(O,Z),n=(n=Math.imul(O,U))+Math.imul(R,Z)|0,o=Math.imul(R,U),e=e+Math.imul(B,D)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(N,D)|0,o=o+Math.imul(N,W)|0,e=e+Math.imul(k,G)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,Y)|0,e=e+Math.imul(_,X)|0,n=(n=n+Math.imul(_,K)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,K)|0,e=e+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,e=e+Math.imul(g,it)|0,n=(n=n+Math.imul(g,et)|0)+Math.imul(M,it)|0,o=o+Math.imul(M,et)|0,e=e+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var _t=(a+(e=e+Math.imul(f,ut)|0)|0)+((8191&(n=(n=n+Math.imul(f,at)|0)+Math.imul(m,ut)|0))<<13)|0;a=((o=o+Math.imul(m,at)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,e=Math.imul(P,Z),n=(n=Math.imul(P,U))+Math.imul(j,Z)|0,o=Math.imul(j,U),e=e+Math.imul(O,D)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(R,D)|0,o=o+Math.imul(R,W)|0,e=e+Math.imul(B,G)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,Y)|0,e=e+Math.imul(k,X)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(T,X)|0,o=o+Math.imul(T,K)|0,e=e+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,e=e+Math.imul(y,it)|0,n=(n=n+Math.imul(y,et)|0)+Math.imul(b,it)|0,o=o+Math.imul(b,et)|0,e=e+Math.imul(g,ot)|0,n=(n=n+Math.imul(g,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,e=e+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,at)|0;var At=(a+(e=e+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,mt)|0)+Math.imul(m,ft)|0))<<13)|0;a=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,e=Math.imul(H,Z),n=(n=Math.imul(H,U))+Math.imul(F,Z)|0,o=Math.imul(F,U),e=e+Math.imul(P,D)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(j,D)|0,o=o+Math.imul(j,W)|0,e=e+Math.imul(O,G)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,Y)|0,e=e+Math.imul(B,X)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,K)|0,e=e+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,e=e+Math.imul(_,it)|0,n=(n=n+Math.imul(_,et)|0)+Math.imul(A,it)|0,o=o+Math.imul(A,et)|0,e=e+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,e=e+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,at)|0,e=e+Math.imul(d,ft)|0,n=(n=n+Math.imul(d,mt)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,mt)|0;var St=(a+(e=e+Math.imul(f,dt)|0)|0)+((8191&(n=(n=n+Math.imul(f,pt)|0)+Math.imul(m,dt)|0))<<13)|0;a=((o=o+Math.imul(m,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,e=Math.imul(H,D),n=(n=Math.imul(H,W))+Math.imul(F,D)|0,o=Math.imul(F,W),e=e+Math.imul(P,G)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(j,G)|0,o=o+Math.imul(j,Y)|0,e=e+Math.imul(O,X)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,K)|0,e=e+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,e=e+Math.imul(k,it)|0,n=(n=n+Math.imul(k,et)|0)+Math.imul(T,it)|0,o=o+Math.imul(T,et)|0,e=e+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,e=e+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,at)|0,e=e+Math.imul(g,ft)|0,n=(n=n+Math.imul(g,mt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,mt)|0;var kt=(a+(e=e+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;a=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,e=Math.imul(H,G),n=(n=Math.imul(H,Y))+Math.imul(F,G)|0,o=Math.imul(F,Y),e=e+Math.imul(P,X)|0,n=(n=n+Math.imul(P,K)|0)+Math.imul(j,X)|0,o=o+Math.imul(j,K)|0,e=e+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,e=e+Math.imul(B,it)|0,n=(n=n+Math.imul(B,et)|0)+Math.imul(N,it)|0,o=o+Math.imul(N,et)|0,e=e+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,e=e+Math.imul(_,ut)|0,n=(n=n+Math.imul(_,at)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,at)|0,e=e+Math.imul(y,ft)|0,n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,mt)|0;var Tt=(a+(e=e+Math.imul(g,dt)|0)|0)+((8191&(n=(n=n+Math.imul(g,pt)|0)+Math.imul(M,dt)|0))<<13)|0;a=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,e=Math.imul(H,X),n=(n=Math.imul(H,K))+Math.imul(F,X)|0,o=Math.imul(F,K),e=e+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,e=e+Math.imul(O,it)|0,n=(n=n+Math.imul(O,et)|0)+Math.imul(R,it)|0,o=o+Math.imul(R,et)|0,e=e+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,e=e+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,at)|0,e=e+Math.imul(_,ft)|0,n=(n=n+Math.imul(_,mt)|0)+Math.imul(A,ft)|0,o=o+Math.imul(A,mt)|0;var Et=(a+(e=e+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(b,dt)|0))<<13)|0;a=((o=o+Math.imul(b,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,e=Math.imul(H,Q),n=(n=Math.imul(H,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),e=e+Math.imul(P,it)|0,n=(n=n+Math.imul(P,et)|0)+Math.imul(j,it)|0,o=o+Math.imul(j,et)|0,e=e+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,e=e+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,at)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,at)|0,e=e+Math.imul(k,ft)|0,n=(n=n+Math.imul(k,mt)|0)+Math.imul(T,ft)|0,o=o+Math.imul(T,mt)|0;var Bt=(a+(e=e+Math.imul(_,dt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(A,dt)|0))<<13)|0;a=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,e=Math.imul(H,it),n=(n=Math.imul(H,et))+Math.imul(F,it)|0,o=Math.imul(F,et),e=e+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,st)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,st)|0,e=e+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,at)|0,e=e+Math.imul(B,ft)|0,n=(n=n+Math.imul(B,mt)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,mt)|0;var Nt=(a+(e=e+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(T,dt)|0))<<13)|0;a=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,e=Math.imul(H,ot),n=(n=Math.imul(H,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),e=e+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(j,ut)|0,o=o+Math.imul(j,at)|0,e=e+Math.imul(O,ft)|0,n=(n=n+Math.imul(O,mt)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,mt)|0;var Ct=(a+(e=e+Math.imul(B,dt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul(N,dt)|0))<<13)|0;a=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,e=Math.imul(H,ut),n=(n=Math.imul(H,at))+Math.imul(F,ut)|0,o=Math.imul(F,at),e=e+Math.imul(P,ft)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(j,ft)|0,o=o+Math.imul(j,mt)|0;var Ot=(a+(e=e+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(R,dt)|0))<<13)|0;a=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,e=Math.imul(H,ft),n=(n=Math.imul(H,mt))+Math.imul(F,ft)|0,o=Math.imul(F,mt);var Rt=(a+(e=e+Math.imul(P,dt)|0)|0)+((8191&(n=(n=n+Math.imul(P,pt)|0)+Math.imul(j,dt)|0))<<13)|0;a=((o=o+Math.imul(j,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var It=(a+(e=Math.imul(H,dt))|0)+((8191&(n=(n=Math.imul(H,pt))+Math.imul(F,dt)|0))<<13)|0;return a=((o=Math.imul(F,pt))+(n>>>13)|0)+(It>>>26)|0,It&=67108863,u[0]=vt,u[1]=gt,u[2]=Mt,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=xt,u[7]=_t,u[8]=At,u[9]=St,u[10]=kt,u[11]=Tt,u[12]=Et,u[13]=Bt,u[14]=Nt,u[15]=Ct,u[16]=Ot,u[17]=Rt,u[18]=It,0!==a&&(u[19]=a,i.length++),i};function d(t,r,i){return(new p).mulp(t,r,i)}function p(t,r){this.x=t,this.y=r}Math.imul||(c=m),o.prototype.mulTo=function(t,r){var i=this.length+t.length;return 10===this.length&&10===t.length?c(this,t,r):i<63?m(this,t,r):i<1024?function(t,r,i){i.negative=r.negative^t.negative,i.length=t.length+r.length;for(var e=0,n=0,o=0;o<i.length-1;o++){var s=n;n=0;for(var h=67108863&e,u=Math.min(o,r.length-1),a=Math.max(0,o-t.length+1);a<=u;a++){var l=o-a,f=(0|t.words[l])*(0|r.words[a]),m=67108863&f;h=67108863&(m=m+h|0),n+=(s=(s=s+(f/67108864|0)|0)+(m>>>26)|0)>>>26,s&=67108863}i.words[o]=h,e=s,s=n}return 0!==e?i.words[o]=e:i.length--,i.strip()}(this,t,r):d(this,t,r)},p.prototype.makeRBT=function(t){for(var r=new Array(t),i=o.prototype._countBits(t)-1,e=0;e<t;e++)r[e]=this.revBin(e,i,t);return r},p.prototype.revBin=function(t,r,i){if(0===t||t===i-1)return t;for(var e=0,n=0;n<r;n++)e|=(1&t)<<r-n-1,t>>=1;return e},p.prototype.permute=function(t,r,i,e,n,o){for(var s=0;s<o;s++)e[s]=r[t[s]],n[s]=i[t[s]]},p.prototype.transform=function(t,r,i,e,n,o){this.permute(o,t,r,i,e,n);for(var s=1;s<n;s<<=1)for(var h=s<<1,u=Math.cos(2*Math.PI/h),a=Math.sin(2*Math.PI/h),l=0;l<n;l+=h)for(var f=u,m=a,c=0;c<s;c++){var d=i[l+c],p=e[l+c],v=i[l+c+s],g=e[l+c+s],M=f*v-m*g;g=f*g+m*v,v=M,i[l+c]=d+v,e[l+c]=p+g,i[l+c+s]=d-v,e[l+c+s]=p-g,c!==h&&(M=u*f-a*m,m=u*m+a*f,f=M)}},p.prototype.guessLen13b=function(t,r){var i=1|Math.max(r,t),e=1&i,n=0;for(i=i/2|0;i;i>>>=1)n++;return 1<<n+1+e},p.prototype.conjugate=function(t,r,i){if(!(i<=1))for(var e=0;e<i/2;e++){var n=t[e];t[e]=t[i-e-1],t[i-e-1]=n,n=r[e],r[e]=-r[i-e-1],r[i-e-1]=-n}},p.prototype.normalize13b=function(t,r){for(var i=0,e=0;e<r/2;e++){var n=8192*Math.round(t[2*e+1]/r)+Math.round(t[2*e]/r)+i;t[e]=67108863&n,i=n<67108864?0:n/67108864|0}return t},p.prototype.convert13b=function(t,r,i,n){for(var o=0,s=0;s<r;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*r;s<n;++s)i[s]=0;e(0===o),e(0==(-8192&o))},p.prototype.stub=function(t){for(var r=new Array(t),i=0;i<t;i++)r[i]=0;return r},p.prototype.mulp=function(t,r,i){var e=2*this.guessLen13b(t.length,r.length),n=this.makeRBT(e),o=this.stub(e),s=new Array(e),h=new Array(e),u=new Array(e),a=new Array(e),l=new Array(e),f=new Array(e),m=i.words;m.length=e,this.convert13b(t.words,t.length,s,e),this.convert13b(r.words,r.length,a,e),this.transform(s,o,h,u,e,n),this.transform(a,o,l,f,e,n);for(var c=0;c<e;c++){var d=h[c]*l[c]-u[c]*f[c];u[c]=h[c]*f[c]+u[c]*l[c],h[c]=d}return this.conjugate(h,u,e),this.transform(h,u,m,o,e,n),this.conjugate(m,o,e),this.normalize13b(m,e),i.negative=t.negative^r.negative,i.length=t.length+r.length,i.strip()},o.prototype.mul=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),this.mulTo(t,r)},o.prototype.mulf=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),d(this,t,r)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){e("number"==typeof t),e(t<67108864);for(var r=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&r);r>>=26,r+=n/67108864|0,r+=o>>>26,this.words[i]=67108863&o}return 0!==r&&(this.words[i]=r,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var r=function(t){for(var r=new Array(t.bitLength()),i=0;i<r.length;i++){var e=i/26|0,n=i%26;r[i]=(t.words[e]&1<<n)>>>n}return r}(t);if(0===r.length)return new o(1);for(var i=this,e=0;e<r.length&&0===r[e];e++,i=i.sqr());if(++e<r.length)for(var n=i.sqr();e<r.length;e++,n=n.sqr())0!==r[e]&&(i=i.mul(n));return i},o.prototype.iushln=function(t){e("number"==typeof t&&t>=0);var r,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(r=0;r<this.length;r++){var h=this.words[r]&o,u=(0|this.words[r])-h<<i;this.words[r]=u|s,s=h>>>26-i}s&&(this.words[r]=s,this.length++)}if(0!==n){for(r=this.length-1;r>=0;r--)this.words[r+n]=this.words[r];for(r=0;r<n;r++)this.words[r]=0;this.length+=n}return this.strip()},o.prototype.ishln=function(t){return e(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,r,i){var n;e("number"==typeof t&&t>=0),n=r?(r-r%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),h=67108863^67108863>>>o<<o,u=i;if(n-=s,n=Math.max(0,n),u){for(var a=0;a<s;a++)u.words[a]=this.words[a];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,a=0;a<this.length;a++)this.words[a]=this.words[a+s];else this.words[0]=0,this.length=1;var l=0;for(a=this.length-1;a>=0&&(0!==l||a>=n);a--){var f=0|this.words[a];this.words[a]=l<<26-o|f>>>o,l=f&h}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,r,i){return e(0===this.negative),this.iushrn(t,r,i)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){e("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,n=1<<r;return!(this.length<=i)&&!!(this.words[i]&n)},o.prototype.imaskn=function(t){e("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26;if(e(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==r&&i++,this.length=Math.min(i,this.length),0!==r){var n=67108863^67108863>>>r<<r;this.words[this.length-1]&=n}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return e("number"==typeof t),e(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var r=0;r<this.length&&this.words[r]>=67108864;r++)this.words[r]-=67108864,r===this.length-1?this.words[r+1]=1:this.words[r+1]++;return this.length=Math.max(this.length,r+1),this},o.prototype.isubn=function(t){if(e("number"==typeof t),e(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var r=0;r<this.length&&this.words[r]<0;r++)this.words[r]+=67108864,this.words[r+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,r,i){var n,o,s=t.length+i;this._expand(s);var h=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+h;var u=(0|t.words[n])*r;h=((o-=67108863&u)>>26)-(u/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)h=(o=(0|this.words[n+i])+h)>>26,this.words[n+i]=67108863&o;if(0===h)return this.strip();for(e(-1===h),h=0,n=0;n<this.length;n++)h=(o=-(0|this.words[n])+h)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,r){var i=(this.length,t.length),e=this.clone(),n=t,s=0|n.words[n.length-1];0!==(i=26-this._countBits(s))&&(n=n.ushln(i),e.iushln(i),s=0|n.words[n.length-1]);var h,u=e.length-n.length;if("mod"!==r){(h=new o(null)).length=u+1,h.words=new Array(h.length);for(var a=0;a<h.length;a++)h.words[a]=0}var l=e.clone()._ishlnsubmul(n,1,u);0===l.negative&&(e=l,h&&(h.words[u]=1));for(var f=u-1;f>=0;f--){var m=67108864*(0|e.words[n.length+f])+(0|e.words[n.length+f-1]);for(m=Math.min(m/s|0,67108863),e._ishlnsubmul(n,m,f);0!==e.negative;)m--,e.negative=0,e._ishlnsubmul(n,1,f),e.isZero()||(e.negative^=1);h&&(h.words[f]=m)}return h&&h.strip(),e.strip(),"div"!==r&&0!==i&&e.iushrn(i),{div:h||null,mod:e}},o.prototype.divmod=function(t,r,i){return e(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(h=this.neg().divmod(t,r),"mod"!==r&&(n=h.div.neg()),"div"!==r&&(s=h.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(h=this.divmod(t.neg(),r),"mod"!==r&&(n=h.div.neg()),{div:n,mod:h.mod}):0!=(this.negative&t.negative)?(h=this.neg().divmod(t.neg(),r),"div"!==r&&(s=h.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:h.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===r?{div:this.divn(t.words[0]),mod:null}:"mod"===r?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,r);var n,s,h},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var r=this.divmod(t);if(r.mod.isZero())return r.div;var i=0!==r.div.negative?r.mod.isub(t):r.mod,e=t.ushrn(1),n=t.andln(1),o=i.cmp(e);return o<0||1===n&&0===o?r.div:0!==r.div.negative?r.div.isubn(1):r.div.iaddn(1)},o.prototype.modn=function(t){e(t<=67108863);for(var r=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(r*i+(0|this.words[n]))%t;return i},o.prototype.idivn=function(t){e(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*r;this.words[i]=n/t|0,r=n%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){e(0===t.negative),e(!t.isZero());var r=this,i=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var n=new o(1),s=new o(0),h=new o(0),u=new o(1),a=0;r.isEven()&&i.isEven();)r.iushrn(1),i.iushrn(1),++a;for(var l=i.clone(),f=r.clone();!r.isZero();){for(var m=0,c=1;0==(r.words[0]&c)&&m<26;++m,c<<=1);if(m>0)for(r.iushrn(m);m-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(l),s.isub(f)),n.iushrn(1),s.iushrn(1);for(var d=0,p=1;0==(i.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(i.iushrn(d);d-- >0;)(h.isOdd()||u.isOdd())&&(h.iadd(l),u.isub(f)),h.iushrn(1),u.iushrn(1);r.cmp(i)>=0?(r.isub(i),n.isub(h),s.isub(u)):(i.isub(r),h.isub(n),u.isub(s))}return{a:h,b:u,gcd:i.iushln(a)}},o.prototype._invmp=function(t){e(0===t.negative),e(!t.isZero());var r=this,i=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var n,s=new o(1),h=new o(0),u=i.clone();r.cmpn(1)>0&&i.cmpn(1)>0;){for(var a=0,l=1;0==(r.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(r.iushrn(a);a-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,m=1;0==(i.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(i.iushrn(f);f-- >0;)h.isOdd()&&h.iadd(u),h.iushrn(1);r.cmp(i)>=0?(r.isub(i),s.isub(h)):(i.isub(r),h.isub(s))}return(n=0===r.cmpn(1)?s:h).cmpn(0)<0&&n.iadd(t),n},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var r=this.clone(),i=t.clone();r.negative=0,i.negative=0;for(var e=0;r.isEven()&&i.isEven();e++)r.iushrn(1),i.iushrn(1);for(;;){for(;r.isEven();)r.iushrn(1);for(;i.isEven();)i.iushrn(1);var n=r.cmp(i);if(n<0){var o=r;r=i,i=o}else if(0===n||0===i.cmpn(1))break;r.isub(i)}return i.iushln(e)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){e("number"==typeof t);var r=t%26,i=(t-r)/26,n=1<<r;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var h=0|this.words[s];o=(h+=o)>>>26,h&=67108863,this.words[s]=h}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var r,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)r=1;else{i&&(t=-t),e(t<=67108863,"Number is too big");var n=0|this.words[0];r=n===t?0:n<t?-1:1}return 0!==this.negative?0|-r:r},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var r=this.ucmp(t);return 0!==this.negative?0|-r:r},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var r=0,i=this.length-1;i>=0;i--){var e=0|this.words[i],n=0|t.words[i];if(e!==n){e<n?r=-1:e>n&&(r=1);break}}return r},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new x(t)},o.prototype.toRed=function(t){return e(!this.red,"Already a number in reduction context"),e(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return e(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return e(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function g(t,r){this.name=t,this.p=new o(r,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function y(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function x(t){if("string"==typeof t){var r=o._prime(t);this.m=r.p,this.prime=r}else e(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){x.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var r,i=t;do{this.split(i,this.tmp),r=(i=(i=this.imulK(i)).iadd(this.tmp)).bitLength()}while(r>this.n);var e=r<this.n?-1:i.ucmp(this.p);return 0===e?(i.words[0]=0,i.length=1):e>0?i.isub(this.p):i.strip(),i},g.prototype.split=function(t,r){t.iushrn(this.n,0,r)},g.prototype.imulK=function(t){return t.imul(this.k)},n(M,g),M.prototype.split=function(t,r){for(var i=Math.min(t.length,9),e=0;e<i;e++)r.words[e]=t.words[e];if(r.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(r.words[r.length++]=4194303&n,e=10;e<t.length;e++){var o=0|t.words[e];t.words[e-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,t.words[e-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var r=0,i=0;i<t.length;i++){var e=0|t.words[i];r+=977*e,t.words[i]=67108863&r,r=64*e+(r/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(w,g),n(y,g),n(b,g),b.prototype.imulK=function(t){for(var r=0,i=0;i<t.length;i++){var e=19*(0|t.words[i])+r,n=67108863&e;e>>>=26,t.words[i]=n,r=e}return 0!==r&&(t.words[t.length++]=r),t},o._prime=function(t){if(v[t])return v[t];var r;if("k256"===t)r=new M;else if("p224"===t)r=new w;else if("p192"===t)r=new y;else{if("p25519"!==t)throw new Error("Unknown prime "+t);r=new b}return v[t]=r,r},x.prototype._verify1=function(t){e(0===t.negative,"red works only with positives"),e(t.red,"red works only with red numbers")},x.prototype._verify2=function(t,r){e(0==(t.negative|r.negative),"red works only with positives"),e(t.red&&t.red===r.red,"red works only with red numbers")},x.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},x.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},x.prototype.add=function(t,r){this._verify2(t,r);var i=t.add(r);return i.cmp(this.m)>=0&&i.isub(this.m),i._forceRed(this)},x.prototype.iadd=function(t,r){this._verify2(t,r);var i=t.iadd(r);return i.cmp(this.m)>=0&&i.isub(this.m),i},x.prototype.sub=function(t,r){this._verify2(t,r);var i=t.sub(r);return i.cmpn(0)<0&&i.iadd(this.m),i._forceRed(this)},x.prototype.isub=function(t,r){this._verify2(t,r);var i=t.isub(r);return i.cmpn(0)<0&&i.iadd(this.m),i},x.prototype.shl=function(t,r){return this._verify1(t),this.imod(t.ushln(r))},x.prototype.imul=function(t,r){return this._verify2(t,r),this.imod(t.imul(r))},x.prototype.mul=function(t,r){return this._verify2(t,r),this.imod(t.mul(r))},x.prototype.isqr=function(t){return this.imul(t,t.clone())},x.prototype.sqr=function(t){return this.mul(t,t)},x.prototype.sqrt=function(t){if(t.isZero())return t.clone();var r=this.m.andln(3);if(e(r%2==1),3===r){var i=this.m.add(new o(1)).iushrn(2);return this.pow(t,i)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);e(!n.isZero());var h=new o(1).toRed(this),u=h.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,n),m=this.pow(t,n.addn(1).iushrn(1)),c=this.pow(t,n),d=s;0!==c.cmp(h);){for(var p=c,v=0;0!==p.cmp(h);v++)p=p.redSqr();e(v<d);var g=this.pow(f,new o(1).iushln(d-v-1));m=m.redMul(g),f=g.redSqr(),c=c.redMul(f),d=v}return m},x.prototype.invm=function(t){var r=t._invmp(this.m);return 0!==r.negative?(r.negative=0,this.imod(r).redNeg()):this.imod(r)},x.prototype.pow=function(t,r){if(r.isZero())return new o(1);if(0===r.cmpn(1))return t.clone();var i=new Array(16);i[0]=new o(1).toRed(this),i[1]=t;for(var e=2;e<i.length;e++)i[e]=this.mul(i[e-1],t);var n=i[0],s=0,h=0,u=r.bitLength()%26;for(0===u&&(u=26),e=r.length-1;e>=0;e--){for(var a=r.words[e],l=u-1;l>=0;l--){var f=a>>l&1;n!==i[0]&&(n=this.sqr(n)),0!==f||0!==s?(s<<=1,s|=f,(4===++h||0===e&&0===l)&&(n=this.mul(n,i[s]),h=0,s=0)):h=0}u=26}return n},x.prototype.convertTo=function(t){var r=t.umod(this.m);return r===t?r.clone():r},x.prototype.convertFrom=function(t){var r=t.clone();return r.red=null,r},o.mont=function(t){return new _(t)},n(_,x),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var r=this.imod(t.mul(this.rinv));return r.red=null,r},_.prototype.imul=function(t,r){if(t.isZero()||r.isZero())return t.words[0]=0,t.length=1,t;var i=t.imul(r),e=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(e).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},_.prototype.mul=function(t,r){if(t.isZero()||r.isZero())return new o(0)._forceRed(this);var i=t.mul(r),e=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(e).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,i(2)(t))},function(t,r,i){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.params={defaultGasPriceCoef:128,defaultExpiration:720,TxGas:5e3,ClauseGas:16e3,ClauseGasContractCreation:48e3,TxDataZeroGas:4,TxDataNonZeroGas:68}},function(t,r,i){var e=i(0),n=i(19),o=i(1),s=i(57),h=i(68),u=i(69),a=i(70),l=i(71),f=i(72),m=i(73),c=function(t,r){return t.isDynamicType(r)||t.isDynamicArray(r)};function d(){}var p=function(t){this._types=t};p.prototype._requireType=function(t){var r=this._types.filter(function(r){return r.isType(t)})[0];if(!r)throw Error("Invalid solidity type: "+t);return r},p.prototype._getOffsets=function(t,r){for(var i=r.map(function(r,i){return r.staticPartLength(t[i])}),e=1;e<i.length;e++)i[e]+=i[e-1];return i.map(function(i,e){return i-r[e].staticPartLength(t[e])})},p.prototype._getSolidityTypes=function(t){var r=this;return t.map(function(t){return r._requireType(t)})},p.prototype._encodeMultiWithOffset=function(t,r,i,e){var n="",s=this;return t.forEach(function(h,u){if(c(r[u],t[u])){n+=o.formatInputInt(e).encode();var a=s._encodeWithOffset(t[u],r[u],i[u],e);e+=a.length/2}else n+=s._encodeWithOffset(t[u],r[u],i[u],e)}),t.forEach(function(o,h){if(c(r[h],t[h])){var u=s._encodeWithOffset(t[h],r[h],i[h],e);e+=u.length/2,n+=u}}),n},p.prototype._encodeWithOffset=function(t,r,i,e){var n,s,h,u=this;return r.isDynamicArray(t)?(n=r.nestedName(t),s=r.staticPartLength(n),h=i[0],function(){var t=2;if(r.isDynamicArray(n))for(var u=1;u<i.length;u++)t+=+i[u-1][0]||0,h+=o.formatInputInt(e+u*s+32*t).encode()}(),function(){for(var t=0;t<i.length-1;t++){var o=h/2;h+=u._encodeWithOffset(n,r,i[t+1],e+o)}}(),h):r.isStaticArray(t)?function(){var n=r.nestedName(t),s=r.staticPartLength(n),h="";return r.isDynamicArray(n)&&function(){for(var t=0,r=0;r<i.length;r++)t+=+(i[r-1]||[])[0]||0,h+=o.formatInputInt(e+r*s+32*t).encode()}(),function(){for(var t=0;t<i.length;t++){var o=h/2;h+=u._encodeWithOffset(n,r,i[t],e+o)}}(),h}():i},p.prototype.encodeFunctionSignature=function(t){return e.isObject(t)&&(t=n._jsonInterfaceMethodToString(t)),n.sha3(t).slice(0,10)},p.prototype.encodeEventSignature=function(t){return e.isObject(t)&&(t=n._jsonInterfaceMethodToString(t)),n.sha3(t)},p.prototype.encodeParameter=function(t,r){return this.encodeParameters([t],[r])},p.prototype.encodeParameters=function(t,r){e.isObject(t)&&t.inputs&&(t=e.map(t.inputs,function(t){return t.type}));var i=this._getSolidityTypes(t),n=i.map(function(i,e){return i.encode(r[e],t[e])}),o=i.reduce(function(r,e,n){var o=e.staticPartLength(t[n]),s=32*Math.floor((o+31)/32);return r+(c(i[n],t[n])?32:s)},0);return"0x"+this._encodeMultiWithOffset(t,i,n,o)},p.prototype.encodeFunctionCall=function(t,r){return this.encodeFunctionSignature(t)+this.encodeParameters(t,r).replace("0x","")},p.prototype.decodeParameter=function(t,r){if(!e.isString(t))throw new Error("Given parameter type is not a string: "+t);return this.decodeParameters([{type:t}],r)[0]},p.prototype.decodeParameters=function(t,r){var i=e.isArray(t)&&e.isString(t[0]),n=i?t:[];i||t.forEach(function(t){n.push(t.type)});var o=this._getSolidityTypes(n),s=this._getOffsets(n,o),h=new d;h.__length__=0;var u=0;return t.forEach(function(t,i){var a=o[u].decode(r.replace(/^0x/i,""),s[u],n[u],u);a="0x"===a?null:a,h[i]=a,e.isObject(t)&&t.name&&(h[t.name]=a),h.__length__++,u++}),h},p.prototype.decodeLog=function(t,r,i){r=r||"";var n=[],o=[];t.forEach(function(t,r){t.indexed?o[r]=t:n[r]=t});var s=r.slice(2),h=e.isArray(i)?i.map(function(t){return t.slice(2)}).join(""):i,u=this.decodeParameters(n,s),a=this.decodeParameters(o,h),l=new d;return l.__length__=0,t.forEach(function(t,r){l[r]="string"===t.type?"":null,u[r]&&(l[r]=u[r]),a[r]&&(l[r]=a[r]),t.name&&(l[t.name]=l[r]),l.__length__++}),l};var v=new p([new s,new h,new u,new a,new l,new m,new f]);t.exports=v},function(t,r,i){var e=i(0),n=i(7),o=i(20),s=i(56),h=i(9),u=function(t){if(!o.isHexStrict(t))throw new Error("The parameter must be a valid HEX string.");var r="",i=0,e=t.length;for("0x"===t.substring(0,2)&&(i=2);i<e;i+=2){var n=parseInt(t.substr(i,2),16);r+=String.fromCharCode(n)}return r},a=function(t){if(!t)return"0x00";for(var r="",i=0;i<t.length;i++){var e=t.charCodeAt(i).toString(16);r+=e.length<2?"0"+e:e}return"0x"+r},l=function(t){if(t=t?t.toLowerCase():"ether",!n.unitMap[t])throw new Error('This unit "'+t+"\" doesn't exist, please use the one of the following units"+JSON.stringify(n.unitMap,null,2));return t};t.exports={_fireError:function(t,r,i,n){return!e.isObject(t)||t instanceof Error||!t.data||((e.isObject(t.data)||e.isArray(t.data))&&(t.data=JSON.stringify(t.data,null,2)),t=t.message+"\n"+t.data),e.isString(t)&&(t=new Error(t)),e.isFunction(n)&&n(t),e.isFunction(i)&&((r&&e.isFunction(r.listeners)&&r.listeners("error").length||e.isFunction(n))&&r.catch(function(){}),setTimeout(function(){i(t)},1)),r&&e.isFunction(r.emit)&&setTimeout(function(){r.emit("error",t),r.removeAllListeners()},1),r},_jsonInterfaceMethodToString:function(t){if(e.isObject(t)&&t.name&&-1!==t.name.indexOf("("))return t.name;var r=t.inputs.map(function(t){return t.type}).join(",");return t.name+"("+r+")"},randomHex:h,_:e,BN:o.BN,isBN:o.isBN,isBigNumber:o.isBigNumber,isHex:o.isHex,isHexStrict:o.isHexStrict,sha3:o.sha3,keccak256:o.sha3,soliditySha3:s,isAddress:o.isAddress,checkAddressChecksum:o.checkAddressChecksum,toChecksumAddress:function(t){if(void 0===t)return"";if(!/^(0x)?[0-9a-f]{40}$/i.test(t))throw new Error('Given address "'+t+'" is not a valid Ethereum address.');t=t.toLowerCase().replace(/^0x/i,"");for(var r=o.sha3(t).replace(/^0x/i,""),i="0x",e=0;e<t.length;e++)parseInt(r[e],16)>7?i+=t[e].toUpperCase():i+=t[e];return i},toHex:o.toHex,toBN:o.toBN,bytesToHex:o.bytesToHex,hexToBytes:o.hexToBytes,hexToNumberString:o.hexToNumberString,hexToNumber:o.hexToNumber,toDecimal:o.hexToNumber,numberToHex:o.numberToHex,fromDecimal:o.numberToHex,hexToUtf8:o.hexToUtf8,hexToString:o.hexToUtf8,toUtf8:o.hexToUtf8,utf8ToHex:o.utf8ToHex,stringToHex:o.utf8ToHex,fromUtf8:o.utf8ToHex,hexToAscii:u,toAscii:u,asciiToHex:a,fromAscii:a,unitMap:n.unitMap,toWei:function(t,r){if(r=l(r),!o.isBN(t)&&!e.isString(t))throw new Error("Please pass numbers as strings or BigNumber objects to avoid precision errors.");return o.isBN(t)?n.toWei(t,r):n.toWei(t,r).toString(10)},fromWei:function(t,r){if(r=l(r),!o.isBN(t)&&!e.isString(t))throw new Error("Please pass numbers as strings or BigNumber objects to avoid precision errors.");return o.isBN(t)?n.fromWei(t,r):n.fromWei(t,r).toString(10)},padLeft:o.leftPad,leftPad:o.leftPad,padRight:o.rightPad,rightPad:o.rightPad,toTwosComplement:o.toTwosComplement}},function(t,r,i){var e=i(0),n=i(11),o=i(5),s=i(8),h=i(55),u=function(t){return t instanceof n||t&&t.constructor&&"BN"===t.constructor.name},a=function(t){return t&&t.constructor&&"BigNumber"===t.constructor.name},l=function(t){try{return o.apply(null,arguments)}catch(r){throw new Error(r+' Given value: "'+t+'"')}},f=function(t){return!!/^(0x)?[0-9a-f]{40}$/i.test(t)&&(!(!/^(0x|0X)?[0-9a-f]{40}$/.test(t)&&!/^(0x|0X)?[0-9A-F]{40}$/.test(t))||m(t))},m=function(t){t=t.replace(/^0x/i,"");for(var r=g(t.toLowerCase()).replace(/^0x/i,""),i=0;i<40;i++)if(parseInt(r[i],16)>7&&t[i].toUpperCase()!==t[i]||parseInt(r[i],16)<=7&&t[i].toLowerCase()!==t[i])return!1;return!0},c=function(t){var r="";t=(t=(t=(t=(t=s.encode(t)).replace(/^(?:\u0000)*/,"")).split("").reverse().join("")).replace(/^(?:\u0000)*/,"")).split("").reverse().join("");for(var i=0;i<t.length;i++){var e=t.charCodeAt(i).toString(16);r+=e.length<2?"0"+e:e}return"0x"+r},d=function(t){if(e.isNull(t)||e.isUndefined(t))return t;if(!isFinite(t)&&!v(t))throw new Error('Given input "'+t+'" is not a number.');var r=l(t),i=r.toString(16);return r.lt(new n(0))?"-0x"+i.substr(1):"0x"+i},p=function(t){if(t=t.toString(16),!v(t))throw new Error('Given value "'+t+'" is not a valid hex string.');t=t.replace(/^0x/i,"");for(var r=[],i=0;i<t.length;i+=2)r.push(parseInt(t.substr(i,2),16));return r},v=function(t){return(e.isString(t)||e.isNumber(t))&&/^(-)?0x[0-9a-f]*$/i.test(t)},g=function(t){v(t)&&/^0x/i.test(t.toString())&&(t=p(t));var r=h.keccak256(t);return"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"===r?null:r};g._Hash=h,t.exports={BN:n,isBN:u,isBigNumber:a,toBN:l,isAddress:f,isBloom:function(t){return!(!/^(0x)?[0-9a-f]{512}$/i.test(t)||!/^(0x)?[0-9a-f]{512}$/.test(t)&&!/^(0x)?[0-9A-F]{512}$/.test(t))},isTopic:function(t){return!(!/^(0x)?[0-9a-f]{64}$/i.test(t)||!/^(0x)?[0-9a-f]{64}$/.test(t)&&!/^(0x)?[0-9A-F]{64}$/.test(t))},checkAddressChecksum:m,utf8ToHex:c,hexToUtf8:function(t){if(!v(t))throw new Error('The parameter "'+t+'" must be a valid HEX string.');for(var r="",i=0,e=(t=(t=(t=(t=(t=t.replace(/^0x/i,"")).replace(/^(?:00)*/,"")).split("").reverse().join("")).replace(/^(?:00)*/,"")).split("").reverse().join("")).length,n=0;n<e;n+=2)i=parseInt(t.substr(n,2),16),r+=String.fromCharCode(i);return s.decode(r)},hexToNumber:function(t){return t?l(t).toNumber():t},hexToNumberString:function(t){return t?l(t).toString(10):t},numberToHex:d,toHex:function(t,r){if(f(t))return r?"address":"0x"+t.toLowerCase().replace(/^0x/i,"");if(e.isBoolean(t))return r?"bool":t?"0x01":"0x00";if(e.isObject(t)&&!a(t)&&!u(t))return r?"string":c(JSON.stringify(t));if(e.isString(t)){if(0===t.indexOf("-0x")||0===t.indexOf("-0X"))return r?"int256":d(t);if(0===t.indexOf("0x")||0===t.indexOf("0X"))return r?"bytes":t;if(!isFinite(t))return r?"string":c(t)}return r?t<0?"int256":"uint256":d(t)},hexToBytes:p,bytesToHex:function(t){for(var r=[],i=0;i<t.length;i++)r.push((t[i]>>>4).toString(16)),r.push((15&t[i]).toString(16));return"0x"+r.join("")},isHex:function(t){return(e.isString(t)||e.isNumber(t))&&/^(-0x|0x)?[0-9a-f]*$/i.test(t)},isHexStrict:v,leftPad:function(t,r,i){var e=/^0x/i.test(t)||"number"==typeof t,n=r-(t=t.toString(16).replace(/^0x/i,"")).length+1>=0?r-t.length+1:0;return(e?"0x":"")+new Array(n).join(i||"0")+t},rightPad:function(t,r,i){var e=/^0x/i.test(t)||"number"==typeof t,n=r-(t=t.toString(16).replace(/^0x/i,"")).length+1>=0?r-t.length+1:0;return(e?"0x":"")+t+new Array(n).join(i||"0")},toTwosComplement:function(t){return"0x"+l(t).toTwos(256).toString(16,64)},sha3:g}},function(t,r,i){var e=i(1),n=function(t,r,i){this.value=t||"",this.offset=r,this.rawValue=i};n.prototype.dynamicPartLength=function(){return this.dynamicPart().length/2},n.prototype.withOffset=function(t){return new n(this.value,t)},n.prototype.combine=function(t){return new n(this.value+t.value)},n.prototype.isDynamic=function(){return void 0!==this.offset},n.prototype.offsetAsBytes=function(){return this.isDynamic()?e.toTwosComplement(this.offset).replace("0x",""):""},n.prototype.staticPart=function(){return this.isDynamic()?this.offsetAsBytes():this.value},n.prototype.dynamicPart=function(){return this.isDynamic()?this.value:""},n.prototype.encode=function(){return this.staticPart()+this.dynamicPart()},n.encodeList=function(t){var r=32*t.length,i=t.map(function(t){if(!t.isDynamic())return t;var i=r;return r+=t.dynamicPartLength(),t.withOffset(i)});return i.reduce(function(t,r){return t+r.dynamicPart()},i.reduce(function(t,r){return t+r.staticPart()},""))},t.exports=n},function(t,r,i){var e=i(0),n=i(23),o=i(5),s=i(8),h=i(62),u=function(t){return t instanceof n||t&&t.constructor&&"BN"===t.constructor.name},a=function(t){return t&&t.constructor&&"BigNumber"===t.constructor.name},l=function(t){try{return o.apply(null,arguments)}catch(r){throw new Error(r+' Given value: "'+t+'"')}},f=function(t){return!!/^(0x)?[0-9a-f]{40}$/i.test(t)&&(!(!/^(0x|0X)?[0-9a-f]{40}$/.test(t)&&!/^(0x|0X)?[0-9A-F]{40}$/.test(t))||m(t))},m=function(t){t=t.replace(/^0x/i,"");for(var r=g(t.toLowerCase()).replace(/^0x/i,""),i=0;i<40;i++)if(parseInt(r[i],16)>7&&t[i].toUpperCase()!==t[i]||parseInt(r[i],16)<=7&&t[i].toLowerCase()!==t[i])return!1;return!0},c=function(t){var r="";t=(t=(t=(t=(t=s.encode(t)).replace(/^(?:\u0000)*/,"")).split("").reverse().join("")).replace(/^(?:\u0000)*/,"")).split("").reverse().join("");for(var i=0;i<t.length;i++){var e=t.charCodeAt(i).toString(16);r+=e.length<2?"0"+e:e}return"0x"+r},d=function(t){if(e.isNull(t)||e.isUndefined(t))return t;if(!isFinite(t)&&!v(t))throw new Error('Given input "'+t+'" is not a number.');var r=l(t),i=r.toString(16);return r.lt(new n(0))?"-0x"+i.substr(1):"0x"+i},p=function(t){if(t=t.toString(16),!v(t))throw new Error('Given value "'+t+'" is not a valid hex string.');t=t.replace(/^0x/i,"");for(var r=[],i=0;i<t.length;i+=2)r.push(parseInt(t.substr(i,2),16));return r},v=function(t){return(e.isString(t)||e.isNumber(t))&&/^(-)?0x[0-9a-f]*$/i.test(t)},g=function(t){v(t)&&/^0x/i.test(t.toString())&&(t=p(t));var r=h.keccak256(t);return"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"===r?null:r};g._Hash=h,t.exports={BN:n,isBN:u,isBigNumber:a,toBN:l,isAddress:f,isBloom:function(t){return!(!/^(0x)?[0-9a-f]{512}$/i.test(t)||!/^(0x)?[0-9a-f]{512}$/.test(t)&&!/^(0x)?[0-9A-F]{512}$/.test(t))},isTopic:function(t){return!(!/^(0x)?[0-9a-f]{64}$/i.test(t)||!/^(0x)?[0-9a-f]{64}$/.test(t)&&!/^(0x)?[0-9A-F]{64}$/.test(t))},checkAddressChecksum:m,utf8ToHex:c,hexToUtf8:function(t){if(!v(t))throw new Error('The parameter "'+t+'" must be a valid HEX string.');for(var r="",i=0,e=(t=(t=(t=(t=(t=t.replace(/^0x/i,"")).replace(/^(?:00)*/,"")).split("").reverse().join("")).replace(/^(?:00)*/,"")).split("").reverse().join("")).length,n=0;n<e;n+=2)i=parseInt(t.substr(n,2),16),r+=String.fromCharCode(i);return s.decode(r)},hexToNumber:function(t){return t?l(t).toNumber():t},hexToNumberString:function(t){return t?l(t).toString(10):t},numberToHex:d,toHex:function(t,r){if(f(t))return r?"address":"0x"+t.toLowerCase().replace(/^0x/i,"");if(e.isBoolean(t))return r?"bool":t?"0x01":"0x00";if(e.isObject(t)&&!a(t)&&!u(t))return r?"string":c(JSON.stringify(t));if(e.isString(t)){if(0===t.indexOf("-0x")||0===t.indexOf("-0X"))return r?"int256":d(t);if(0===t.indexOf("0x")||0===t.indexOf("0X"))return r?"bytes":t;if(!isFinite(t))return r?"string":c(t)}return r?t<0?"int256":"uint256":d(t)},hexToBytes:p,bytesToHex:function(t){for(var r=[],i=0;i<t.length;i++)r.push((t[i]>>>4).toString(16)),r.push((15&t[i]).toString(16));return"0x"+r.join("")},isHex:function(t){return(e.isString(t)||e.isNumber(t))&&/^(-0x|0x)?[0-9a-f]*$/i.test(t)},isHexStrict:v,leftPad:function(t,r,i){var e=/^0x/i.test(t)||"number"==typeof t,n=r-(t=t.toString(16).replace(/^0x/i,"")).length+1>=0?r-t.length+1:0;return(e?"0x":"")+new Array(n).join(i||"0")+t},rightPad:function(t,r,i){var e=/^0x/i.test(t)||"number"==typeof t,n=r-(t=t.toString(16).replace(/^0x/i,"")).length+1>=0?r-t.length+1:0;return(e?"0x":"")+t+new Array(n).join(i||"0")},toTwosComplement:function(t){return"0x"+l(t).toTwos(256).toString(16,64)},sha3:g}},function(t,r,i){(function(t){!function(t,r){"use strict";function e(t,r){if(!t)throw new Error(r||"Assertion failed")}function n(t,r){t.super_=r;var i=function(){};i.prototype=r.prototype,t.prototype=new i,t.prototype.constructor=t}function o(t,r,i){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==r&&"be"!==r||(i=r,r=10),this._init(t||0,r||10,i||"be"))}var s;"object"==typeof t?t.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{s=i(3).Buffer}catch(t){}function h(t,r,i){for(var e=0,n=Math.min(t.length,i),o=r;o<n;o++){var s=t.charCodeAt(o)-48;e<<=4,e|=s>=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return e}function u(t,r,i,e){for(var n=0,o=Math.min(t.length,i),s=r;s<o;s++){var h=t.charCodeAt(s)-48;n*=e,n+=h>=49?h-49+10:h>=17?h-17+10:h}return n}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,r){return t.cmp(r)>0?t:r},o.min=function(t,r){return t.cmp(r)<0?t:r},o.prototype._init=function(t,r,i){if("number"==typeof t)return this._initNumber(t,r,i);if("object"==typeof t)return this._initArray(t,r,i);"hex"===r&&(r=16),e(r===(0|r)&&r>=2&&r<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===r?this._parseHex(t,n):this._parseBase(t,r,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===i&&this._initArray(this.toArray(),r,i)},o.prototype._initNumber=function(t,r,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(e(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),r,i)},o.prototype._initArray=function(t,r,i){if(e("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,h=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);return this.strip()},o.prototype._parseHex=function(t,r){this.length=Math.ceil((t.length-r)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var e,n,o=0;for(i=t.length-6,e=0;i>=r;i-=6)n=h(t,i,i+6),this.words[e]|=n<<o&67108863,this.words[e+1]|=n>>>26-o&4194303,(o+=24)>=26&&(o-=26,e++);i+6!==r&&(n=h(t,r,i+6),this.words[e]|=n<<o&67108863,this.words[e+1]|=n>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,r,i){this.words=[0],this.length=1;for(var e=0,n=1;n<=67108863;n*=r)e++;e--,n=n/r|0;for(var o=t.length-i,s=o%e,h=Math.min(o,o-s)+i,a=0,l=i;l<h;l+=e)a=u(t,l,l+e,r),this.imuln(n),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(0!==s){var f=1;for(a=u(t,l,t.length,r),l=0;l<s;l++)f*=r;this.imuln(f),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}},o.prototype.copy=function(t){t.words=new Array(this.length);for(var r=0;r<this.length;r++)t.words[r]=this.words[r];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],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];function m(t,r,i){i.negative=r.negative^t.negative;var e=t.length+r.length|0;i.length=e,e=e-1|0;var n=0|t.words[0],o=0|r.words[0],s=n*o,h=67108863&s,u=s/67108864|0;i.words[0]=h;for(var a=1;a<e;a++){for(var l=u>>>26,f=67108863&u,m=Math.min(a,r.length-1),c=Math.max(0,a-t.length+1);c<=m;c++){var d=a-c|0;l+=(s=(n=0|t.words[d])*(o=0|r.words[c])+f)/67108864|0,f=67108863&s}i.words[a]=0|f,u=0|l}return 0!==u?i.words[a]=0|u:i.length--,i.strip()}o.prototype.toString=function(t,r){var i;if(r=0|r||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var h=this.words[s],u=(16777215&(h<<n|o)).toString(16);i=0!==(o=h>>>24-n&16777215)||s!==this.length-1?a[6-u.length]+u+i:u+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%r!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var m=l[t],c=f[t];i="";var d=this.clone();for(d.negative=0;!d.isZero();){var p=d.modn(c).toString(t);i=(d=d.idivn(c)).isZero()?p+i:a[m-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%r!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}e(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,r){return e(void 0!==s),this.toArrayLike(s,t,r)},o.prototype.toArray=function(t,r){return this.toArrayLike(Array,t,r)},o.prototype.toArrayLike=function(t,r,i){var n=this.byteLength(),o=i||Math.max(1,n);e(n<=o,"byte array longer than desired length"),e(o>0,"Requested array length <= 0"),this.strip();var s,h,u="le"===r,a=new t(o),l=this.clone();if(u){for(h=0;!l.isZero();h++)s=l.andln(255),l.iushrn(8),a[h]=s;for(;h<o;h++)a[h]=0}else{for(h=0;h<o-n;h++)a[h]=0;for(h=0;!l.isZero();h++)s=l.andln(255),l.iushrn(8),a[o-h-1]=s}return a},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var r=t,i=0;return r>=4096&&(i+=13,r>>>=13),r>=64&&(i+=7,r>>>=7),r>=8&&(i+=4,r>>>=4),r>=2&&(i+=2,r>>>=2),i+r},o.prototype._zeroBits=function(t){if(0===t)return 26;var r=t,i=0;return 0==(8191&r)&&(i+=13,r>>>=13),0==(127&r)&&(i+=7,r>>>=7),0==(15&r)&&(i+=4,r>>>=4),0==(3&r)&&(i+=2,r>>>=2),0==(1&r)&&i++,i},o.prototype.bitLength=function(){var t=this.words[this.length-1],r=this._countBits(t);return 26*(this.length-1)+r},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,r=0;r<this.length;r++){var i=this._zeroBits(this.words[r]);if(t+=i,26!==i)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]|t.words[r];return this.strip()},o.prototype.ior=function(t){return e(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var r;r=this.length>t.length?t:this;for(var i=0;i<r.length;i++)this.words[i]=this.words[i]&t.words[i];return this.length=r.length,this.strip()},o.prototype.iand=function(t){return e(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var r,i;this.length>t.length?(r=this,i=t):(r=t,i=this);for(var e=0;e<i.length;e++)this.words[e]=r.words[e]^i.words[e];if(this!==r)for(;e<r.length;e++)this.words[e]=r.words[e];return this.length=r.length,this.strip()},o.prototype.ixor=function(t){return e(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){e("number"==typeof t&&t>=0);var r=0|Math.ceil(t/26),i=t%26;this._expand(r),i>0&&r--;for(var n=0;n<r;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,r){e("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=r?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},o.prototype.iadd=function(t){var r,i,e;if(0!==this.negative&&0===t.negative)return this.negative=0,r=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,r=this.isub(t),t.negative=1,r._normSign();this.length>t.length?(i=this,e=t):(i=t,e=this);for(var n=0,o=0;o<e.length;o++)r=(0|i.words[o])+(0|e.words[o])+n,this.words[o]=67108863&r,n=r>>>26;for(;0!==n&&o<i.length;o++)r=(0|i.words[o])+n,this.words[o]=67108863&r,n=r>>>26;if(this.length=i.length,0!==n)this.words[this.length]=n,this.length++;else if(i!==this)for(;o<i.length;o++)this.words[o]=i.words[o];return this},o.prototype.add=function(t){var r;return 0!==t.negative&&0===this.negative?(t.negative=0,r=this.sub(t),t.negative^=1,r):0===t.negative&&0!==this.negative?(this.negative=0,r=t.sub(this),this.negative=1,r):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var r=this.iadd(t);return t.negative=1,r._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var i,e,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(i=this,e=t):(i=t,e=this);for(var o=0,s=0;s<e.length;s++)o=(r=(0|i.words[s])-(0|e.words[s])+o)>>26,this.words[s]=67108863&r;for(;0!==o&&s<i.length;s++)o=(r=(0|i.words[s])+o)>>26,this.words[s]=67108863&r;if(0===o&&s<i.length&&i!==this)for(;s<i.length;s++)this.words[s]=i.words[s];return this.length=Math.max(this.length,s),i!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var c=function(t,r,i){var e,n,o,s=t.words,h=r.words,u=i.words,a=0,l=0|s[0],f=8191&l,m=l>>>13,c=0|s[1],d=8191&c,p=c>>>13,v=0|s[2],g=8191&v,M=v>>>13,w=0|s[3],y=8191&w,b=w>>>13,x=0|s[4],_=8191&x,A=x>>>13,S=0|s[5],k=8191&S,T=S>>>13,E=0|s[6],B=8191&E,N=E>>>13,C=0|s[7],O=8191&C,R=C>>>13,I=0|s[8],P=8191&I,j=I>>>13,L=0|s[9],H=8191&L,F=L>>>13,q=0|h[0],Z=8191&q,U=q>>>13,z=0|h[1],D=8191&z,W=z>>>13,$=0|h[2],G=8191&$,Y=$>>>13,J=0|h[3],X=8191&J,K=J>>>13,V=0|h[4],Q=8191&V,tt=V>>>13,rt=0|h[5],it=8191&rt,et=rt>>>13,nt=0|h[6],ot=8191&nt,st=nt>>>13,ht=0|h[7],ut=8191&ht,at=ht>>>13,lt=0|h[8],ft=8191&lt,mt=lt>>>13,ct=0|h[9],dt=8191&ct,pt=ct>>>13;i.negative=t.negative^r.negative,i.length=19;var vt=(a+(e=Math.imul(f,Z))|0)+((8191&(n=(n=Math.imul(f,U))+Math.imul(m,Z)|0))<<13)|0;a=((o=Math.imul(m,U))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,e=Math.imul(d,Z),n=(n=Math.imul(d,U))+Math.imul(p,Z)|0,o=Math.imul(p,U);var gt=(a+(e=e+Math.imul(f,D)|0)|0)+((8191&(n=(n=n+Math.imul(f,W)|0)+Math.imul(m,D)|0))<<13)|0;a=((o=o+Math.imul(m,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,e=Math.imul(g,Z),n=(n=Math.imul(g,U))+Math.imul(M,Z)|0,o=Math.imul(M,U),e=e+Math.imul(d,D)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,D)|0,o=o+Math.imul(p,W)|0;var Mt=(a+(e=e+Math.imul(f,G)|0)|0)+((8191&(n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,G)|0))<<13)|0;a=((o=o+Math.imul(m,Y)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,e=Math.imul(y,Z),n=(n=Math.imul(y,U))+Math.imul(b,Z)|0,o=Math.imul(b,U),e=e+Math.imul(g,D)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(M,D)|0,o=o+Math.imul(M,W)|0,e=e+Math.imul(d,G)|0,n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,Y)|0;var wt=(a+(e=e+Math.imul(f,X)|0)|0)+((8191&(n=(n=n+Math.imul(f,K)|0)+Math.imul(m,X)|0))<<13)|0;a=((o=o+Math.imul(m,K)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,e=Math.imul(_,Z),n=(n=Math.imul(_,U))+Math.imul(A,Z)|0,o=Math.imul(A,U),e=e+Math.imul(y,D)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,D)|0,o=o+Math.imul(b,W)|0,e=e+Math.imul(g,G)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,Y)|0,e=e+Math.imul(d,X)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,K)|0;var yt=(a+(e=e+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(m,Q)|0))<<13)|0;a=((o=o+Math.imul(m,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,e=Math.imul(k,Z),n=(n=Math.imul(k,U))+Math.imul(T,Z)|0,o=Math.imul(T,U),e=e+Math.imul(_,D)|0,n=(n=n+Math.imul(_,W)|0)+Math.imul(A,D)|0,o=o+Math.imul(A,W)|0,e=e+Math.imul(y,G)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,Y)|0,e=e+Math.imul(g,X)|0,n=(n=n+Math.imul(g,K)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,K)|0,e=e+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var bt=(a+(e=e+Math.imul(f,it)|0)|0)+((8191&(n=(n=n+Math.imul(f,et)|0)+Math.imul(m,it)|0))<<13)|0;a=((o=o+Math.imul(m,et)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,e=Math.imul(B,Z),n=(n=Math.imul(B,U))+Math.imul(N,Z)|0,o=Math.imul(N,U),e=e+Math.imul(k,D)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(T,D)|0,o=o+Math.imul(T,W)|0,e=e+Math.imul(_,G)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,Y)|0,e=e+Math.imul(y,X)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,K)|0,e=e+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,e=e+Math.imul(d,it)|0,n=(n=n+Math.imul(d,et)|0)+Math.imul(p,it)|0,o=o+Math.imul(p,et)|0;var xt=(a+(e=e+Math.imul(f,ot)|0)|0)+((8191&(n=(n=n+Math.imul(f,st)|0)+Math.imul(m,ot)|0))<<13)|0;a=((o=o+Math.imul(m,st)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,e=Math.imul(O,Z),n=(n=Math.imul(O,U))+Math.imul(R,Z)|0,o=Math.imul(R,U),e=e+Math.imul(B,D)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(N,D)|0,o=o+Math.imul(N,W)|0,e=e+Math.imul(k,G)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,Y)|0,e=e+Math.imul(_,X)|0,n=(n=n+Math.imul(_,K)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,K)|0,e=e+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,e=e+Math.imul(g,it)|0,n=(n=n+Math.imul(g,et)|0)+Math.imul(M,it)|0,o=o+Math.imul(M,et)|0,e=e+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var _t=(a+(e=e+Math.imul(f,ut)|0)|0)+((8191&(n=(n=n+Math.imul(f,at)|0)+Math.imul(m,ut)|0))<<13)|0;a=((o=o+Math.imul(m,at)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,e=Math.imul(P,Z),n=(n=Math.imul(P,U))+Math.imul(j,Z)|0,o=Math.imul(j,U),e=e+Math.imul(O,D)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(R,D)|0,o=o+Math.imul(R,W)|0,e=e+Math.imul(B,G)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,Y)|0,e=e+Math.imul(k,X)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(T,X)|0,o=o+Math.imul(T,K)|0,e=e+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,e=e+Math.imul(y,it)|0,n=(n=n+Math.imul(y,et)|0)+Math.imul(b,it)|0,o=o+Math.imul(b,et)|0,e=e+Math.imul(g,ot)|0,n=(n=n+Math.imul(g,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,e=e+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,at)|0;var At=(a+(e=e+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,mt)|0)+Math.imul(m,ft)|0))<<13)|0;a=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,e=Math.imul(H,Z),n=(n=Math.imul(H,U))+Math.imul(F,Z)|0,o=Math.imul(F,U),e=e+Math.imul(P,D)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(j,D)|0,o=o+Math.imul(j,W)|0,e=e+Math.imul(O,G)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,Y)|0,e=e+Math.imul(B,X)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,K)|0,e=e+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,e=e+Math.imul(_,it)|0,n=(n=n+Math.imul(_,et)|0)+Math.imul(A,it)|0,o=o+Math.imul(A,et)|0,e=e+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,e=e+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,at)|0,e=e+Math.imul(d,ft)|0,n=(n=n+Math.imul(d,mt)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,mt)|0;var St=(a+(e=e+Math.imul(f,dt)|0)|0)+((8191&(n=(n=n+Math.imul(f,pt)|0)+Math.imul(m,dt)|0))<<13)|0;a=((o=o+Math.imul(m,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,e=Math.imul(H,D),n=(n=Math.imul(H,W))+Math.imul(F,D)|0,o=Math.imul(F,W),e=e+Math.imul(P,G)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(j,G)|0,o=o+Math.imul(j,Y)|0,e=e+Math.imul(O,X)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,K)|0,e=e+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,e=e+Math.imul(k,it)|0,n=(n=n+Math.imul(k,et)|0)+Math.imul(T,it)|0,o=o+Math.imul(T,et)|0,e=e+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,e=e+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,at)|0,e=e+Math.imul(g,ft)|0,n=(n=n+Math.imul(g,mt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,mt)|0;var kt=(a+(e=e+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;a=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,e=Math.imul(H,G),n=(n=Math.imul(H,Y))+Math.imul(F,G)|0,o=Math.imul(F,Y),e=e+Math.imul(P,X)|0,n=(n=n+Math.imul(P,K)|0)+Math.imul(j,X)|0,o=o+Math.imul(j,K)|0,e=e+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,e=e+Math.imul(B,it)|0,n=(n=n+Math.imul(B,et)|0)+Math.imul(N,it)|0,o=o+Math.imul(N,et)|0,e=e+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,e=e+Math.imul(_,ut)|0,n=(n=n+Math.imul(_,at)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,at)|0,e=e+Math.imul(y,ft)|0,n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,mt)|0;var Tt=(a+(e=e+Math.imul(g,dt)|0)|0)+((8191&(n=(n=n+Math.imul(g,pt)|0)+Math.imul(M,dt)|0))<<13)|0;a=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,e=Math.imul(H,X),n=(n=Math.imul(H,K))+Math.imul(F,X)|0,o=Math.imul(F,K),e=e+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,e=e+Math.imul(O,it)|0,n=(n=n+Math.imul(O,et)|0)+Math.imul(R,it)|0,o=o+Math.imul(R,et)|0,e=e+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,e=e+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,at)|0,e=e+Math.imul(_,ft)|0,n=(n=n+Math.imul(_,mt)|0)+Math.imul(A,ft)|0,o=o+Math.imul(A,mt)|0;var Et=(a+(e=e+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(b,dt)|0))<<13)|0;a=((o=o+Math.imul(b,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,e=Math.imul(H,Q),n=(n=Math.imul(H,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),e=e+Math.imul(P,it)|0,n=(n=n+Math.imul(P,et)|0)+Math.imul(j,it)|0,o=o+Math.imul(j,et)|0,e=e+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,e=e+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,at)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,at)|0,e=e+Math.imul(k,ft)|0,n=(n=n+Math.imul(k,mt)|0)+Math.imul(T,ft)|0,o=o+Math.imul(T,mt)|0;var Bt=(a+(e=e+Math.imul(_,dt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(A,dt)|0))<<13)|0;a=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,e=Math.imul(H,it),n=(n=Math.imul(H,et))+Math.imul(F,it)|0,o=Math.imul(F,et),e=e+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,st)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,st)|0,e=e+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,at)|0,e=e+Math.imul(B,ft)|0,n=(n=n+Math.imul(B,mt)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,mt)|0;var Nt=(a+(e=e+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(T,dt)|0))<<13)|0;a=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,e=Math.imul(H,ot),n=(n=Math.imul(H,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),e=e+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(j,ut)|0,o=o+Math.imul(j,at)|0,e=e+Math.imul(O,ft)|0,n=(n=n+Math.imul(O,mt)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,mt)|0;var Ct=(a+(e=e+Math.imul(B,dt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul(N,dt)|0))<<13)|0;a=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,e=Math.imul(H,ut),n=(n=Math.imul(H,at))+Math.imul(F,ut)|0,o=Math.imul(F,at),e=e+Math.imul(P,ft)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(j,ft)|0,o=o+Math.imul(j,mt)|0;var Ot=(a+(e=e+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(R,dt)|0))<<13)|0;a=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,e=Math.imul(H,ft),n=(n=Math.imul(H,mt))+Math.imul(F,ft)|0,o=Math.imul(F,mt);var Rt=(a+(e=e+Math.imul(P,dt)|0)|0)+((8191&(n=(n=n+Math.imul(P,pt)|0)+Math.imul(j,dt)|0))<<13)|0;a=((o=o+Math.imul(j,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var It=(a+(e=Math.imul(H,dt))|0)+((8191&(n=(n=Math.imul(H,pt))+Math.imul(F,dt)|0))<<13)|0;return a=((o=Math.imul(F,pt))+(n>>>13)|0)+(It>>>26)|0,It&=67108863,u[0]=vt,u[1]=gt,u[2]=Mt,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=xt,u[7]=_t,u[8]=At,u[9]=St,u[10]=kt,u[11]=Tt,u[12]=Et,u[13]=Bt,u[14]=Nt,u[15]=Ct,u[16]=Ot,u[17]=Rt,u[18]=It,0!==a&&(u[19]=a,i.length++),i};function d(t,r,i){return(new p).mulp(t,r,i)}function p(t,r){this.x=t,this.y=r}Math.imul||(c=m),o.prototype.mulTo=function(t,r){var i=this.length+t.length;return 10===this.length&&10===t.length?c(this,t,r):i<63?m(this,t,r):i<1024?function(t,r,i){i.negative=r.negative^t.negative,i.length=t.length+r.length;for(var e=0,n=0,o=0;o<i.length-1;o++){var s=n;n=0;for(var h=67108863&e,u=Math.min(o,r.length-1),a=Math.max(0,o-t.length+1);a<=u;a++){var l=o-a,f=(0|t.words[l])*(0|r.words[a]),m=67108863&f;h=67108863&(m=m+h|0),n+=(s=(s=s+(f/67108864|0)|0)+(m>>>26)|0)>>>26,s&=67108863}i.words[o]=h,e=s,s=n}return 0!==e?i.words[o]=e:i.length--,i.strip()}(this,t,r):d(this,t,r)},p.prototype.makeRBT=function(t){for(var r=new Array(t),i=o.prototype._countBits(t)-1,e=0;e<t;e++)r[e]=this.revBin(e,i,t);return r},p.prototype.revBin=function(t,r,i){if(0===t||t===i-1)return t;for(var e=0,n=0;n<r;n++)e|=(1&t)<<r-n-1,t>>=1;return e},p.prototype.permute=function(t,r,i,e,n,o){for(var s=0;s<o;s++)e[s]=r[t[s]],n[s]=i[t[s]]},p.prototype.transform=function(t,r,i,e,n,o){this.permute(o,t,r,i,e,n);for(var s=1;s<n;s<<=1)for(var h=s<<1,u=Math.cos(2*Math.PI/h),a=Math.sin(2*Math.PI/h),l=0;l<n;l+=h)for(var f=u,m=a,c=0;c<s;c++){var d=i[l+c],p=e[l+c],v=i[l+c+s],g=e[l+c+s],M=f*v-m*g;g=f*g+m*v,v=M,i[l+c]=d+v,e[l+c]=p+g,i[l+c+s]=d-v,e[l+c+s]=p-g,c!==h&&(M=u*f-a*m,m=u*m+a*f,f=M)}},p.prototype.guessLen13b=function(t,r){var i=1|Math.max(r,t),e=1&i,n=0;for(i=i/2|0;i;i>>>=1)n++;return 1<<n+1+e},p.prototype.conjugate=function(t,r,i){if(!(i<=1))for(var e=0;e<i/2;e++){var n=t[e];t[e]=t[i-e-1],t[i-e-1]=n,n=r[e],r[e]=-r[i-e-1],r[i-e-1]=-n}},p.prototype.normalize13b=function(t,r){for(var i=0,e=0;e<r/2;e++){var n=8192*Math.round(t[2*e+1]/r)+Math.round(t[2*e]/r)+i;t[e]=67108863&n,i=n<67108864?0:n/67108864|0}return t},p.prototype.convert13b=function(t,r,i,n){for(var o=0,s=0;s<r;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*r;s<n;++s)i[s]=0;e(0===o),e(0==(-8192&o))},p.prototype.stub=function(t){for(var r=new Array(t),i=0;i<t;i++)r[i]=0;return r},p.prototype.mulp=function(t,r,i){var e=2*this.guessLen13b(t.length,r.length),n=this.makeRBT(e),o=this.stub(e),s=new Array(e),h=new Array(e),u=new Array(e),a=new Array(e),l=new Array(e),f=new Array(e),m=i.words;m.length=e,this.convert13b(t.words,t.length,s,e),this.convert13b(r.words,r.length,a,e),this.transform(s,o,h,u,e,n),this.transform(a,o,l,f,e,n);for(var c=0;c<e;c++){var d=h[c]*l[c]-u[c]*f[c];u[c]=h[c]*f[c]+u[c]*l[c],h[c]=d}return this.conjugate(h,u,e),this.transform(h,u,m,o,e,n),this.conjugate(m,o,e),this.normalize13b(m,e),i.negative=t.negative^r.negative,i.length=t.length+r.length,i.strip()},o.prototype.mul=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),this.mulTo(t,r)},o.prototype.mulf=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),d(this,t,r)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){e("number"==typeof t),e(t<67108864);for(var r=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&r);r>>=26,r+=n/67108864|0,r+=o>>>26,this.words[i]=67108863&o}return 0!==r&&(this.words[i]=r,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var r=function(t){for(var r=new Array(t.bitLength()),i=0;i<r.length;i++){var e=i/26|0,n=i%26;r[i]=(t.words[e]&1<<n)>>>n}return r}(t);if(0===r.length)return new o(1);for(var i=this,e=0;e<r.length&&0===r[e];e++,i=i.sqr());if(++e<r.length)for(var n=i.sqr();e<r.length;e++,n=n.sqr())0!==r[e]&&(i=i.mul(n));return i},o.prototype.iushln=function(t){e("number"==typeof t&&t>=0);var r,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(r=0;r<this.length;r++){var h=this.words[r]&o,u=(0|this.words[r])-h<<i;this.words[r]=u|s,s=h>>>26-i}s&&(this.words[r]=s,this.length++)}if(0!==n){for(r=this.length-1;r>=0;r--)this.words[r+n]=this.words[r];for(r=0;r<n;r++)this.words[r]=0;this.length+=n}return this.strip()},o.prototype.ishln=function(t){return e(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,r,i){var n;e("number"==typeof t&&t>=0),n=r?(r-r%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),h=67108863^67108863>>>o<<o,u=i;if(n-=s,n=Math.max(0,n),u){for(var a=0;a<s;a++)u.words[a]=this.words[a];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,a=0;a<this.length;a++)this.words[a]=this.words[a+s];else this.words[0]=0,this.length=1;var l=0;for(a=this.length-1;a>=0&&(0!==l||a>=n);a--){var f=0|this.words[a];this.words[a]=l<<26-o|f>>>o,l=f&h}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,r,i){return e(0===this.negative),this.iushrn(t,r,i)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){e("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,n=1<<r;return!(this.length<=i)&&!!(this.words[i]&n)},o.prototype.imaskn=function(t){e("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26;if(e(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==r&&i++,this.length=Math.min(i,this.length),0!==r){var n=67108863^67108863>>>r<<r;this.words[this.length-1]&=n}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return e("number"==typeof t),e(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var r=0;r<this.length&&this.words[r]>=67108864;r++)this.words[r]-=67108864,r===this.length-1?this.words[r+1]=1:this.words[r+1]++;return this.length=Math.max(this.length,r+1),this},o.prototype.isubn=function(t){if(e("number"==typeof t),e(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var r=0;r<this.length&&this.words[r]<0;r++)this.words[r]+=67108864,this.words[r+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,r,i){var n,o,s=t.length+i;this._expand(s);var h=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+h;var u=(0|t.words[n])*r;h=((o-=67108863&u)>>26)-(u/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)h=(o=(0|this.words[n+i])+h)>>26,this.words[n+i]=67108863&o;if(0===h)return this.strip();for(e(-1===h),h=0,n=0;n<this.length;n++)h=(o=-(0|this.words[n])+h)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,r){var i=(this.length,t.length),e=this.clone(),n=t,s=0|n.words[n.length-1];0!==(i=26-this._countBits(s))&&(n=n.ushln(i),e.iushln(i),s=0|n.words[n.length-1]);var h,u=e.length-n.length;if("mod"!==r){(h=new o(null)).length=u+1,h.words=new Array(h.length);for(var a=0;a<h.length;a++)h.words[a]=0}var l=e.clone()._ishlnsubmul(n,1,u);0===l.negative&&(e=l,h&&(h.words[u]=1));for(var f=u-1;f>=0;f--){var m=67108864*(0|e.words[n.length+f])+(0|e.words[n.length+f-1]);for(m=Math.min(m/s|0,67108863),e._ishlnsubmul(n,m,f);0!==e.negative;)m--,e.negative=0,e._ishlnsubmul(n,1,f),e.isZero()||(e.negative^=1);h&&(h.words[f]=m)}return h&&h.strip(),e.strip(),"div"!==r&&0!==i&&e.iushrn(i),{div:h||null,mod:e}},o.prototype.divmod=function(t,r,i){return e(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(h=this.neg().divmod(t,r),"mod"!==r&&(n=h.div.neg()),"div"!==r&&(s=h.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(h=this.divmod(t.neg(),r),"mod"!==r&&(n=h.div.neg()),{div:n,mod:h.mod}):0!=(this.negative&t.negative)?(h=this.neg().divmod(t.neg(),r),"div"!==r&&(s=h.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:h.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===r?{div:this.divn(t.words[0]),mod:null}:"mod"===r?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,r);var n,s,h},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var r=this.divmod(t);if(r.mod.isZero())return r.div;var i=0!==r.div.negative?r.mod.isub(t):r.mod,e=t.ushrn(1),n=t.andln(1),o=i.cmp(e);return o<0||1===n&&0===o?r.div:0!==r.div.negative?r.div.isubn(1):r.div.iaddn(1)},o.prototype.modn=function(t){e(t<=67108863);for(var r=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(r*i+(0|this.words[n]))%t;return i},o.prototype.idivn=function(t){e(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*r;this.words[i]=n/t|0,r=n%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){e(0===t.negative),e(!t.isZero());var r=this,i=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var n=new o(1),s=new o(0),h=new o(0),u=new o(1),a=0;r.isEven()&&i.isEven();)r.iushrn(1),i.iushrn(1),++a;for(var l=i.clone(),f=r.clone();!r.isZero();){for(var m=0,c=1;0==(r.words[0]&c)&&m<26;++m,c<<=1);if(m>0)for(r.iushrn(m);m-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(l),s.isub(f)),n.iushrn(1),s.iushrn(1);for(var d=0,p=1;0==(i.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(i.iushrn(d);d-- >0;)(h.isOdd()||u.isOdd())&&(h.iadd(l),u.isub(f)),h.iushrn(1),u.iushrn(1);r.cmp(i)>=0?(r.isub(i),n.isub(h),s.isub(u)):(i.isub(r),h.isub(n),u.isub(s))}return{a:h,b:u,gcd:i.iushln(a)}},o.prototype._invmp=function(t){e(0===t.negative),e(!t.isZero());var r=this,i=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var n,s=new o(1),h=new o(0),u=i.clone();r.cmpn(1)>0&&i.cmpn(1)>0;){for(var a=0,l=1;0==(r.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(r.iushrn(a);a-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,m=1;0==(i.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(i.iushrn(f);f-- >0;)h.isOdd()&&h.iadd(u),h.iushrn(1);r.cmp(i)>=0?(r.isub(i),s.isub(h)):(i.isub(r),h.isub(s))}return(n=0===r.cmpn(1)?s:h).cmpn(0)<0&&n.iadd(t),n},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var r=this.clone(),i=t.clone();r.negative=0,i.negative=0;for(var e=0;r.isEven()&&i.isEven();e++)r.iushrn(1),i.iushrn(1);for(;;){for(;r.isEven();)r.iushrn(1);for(;i.isEven();)i.iushrn(1);var n=r.cmp(i);if(n<0){var o=r;r=i,i=o}else if(0===n||0===i.cmpn(1))break;r.isub(i)}return i.iushln(e)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){e("number"==typeof t);var r=t%26,i=(t-r)/26,n=1<<r;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var h=0|this.words[s];o=(h+=o)>>>26,h&=67108863,this.words[s]=h}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var r,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)r=1;else{i&&(t=-t),e(t<=67108863,"Number is too big");var n=0|this.words[0];r=n===t?0:n<t?-1:1}return 0!==this.negative?0|-r:r},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var r=this.ucmp(t);return 0!==this.negative?0|-r:r},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var r=0,i=this.length-1;i>=0;i--){var e=0|this.words[i],n=0|t.words[i];if(e!==n){e<n?r=-1:e>n&&(r=1);break}}return r},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new x(t)},o.prototype.toRed=function(t){return e(!this.red,"Already a number in reduction context"),e(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return e(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return e(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function g(t,r){this.name=t,this.p=new o(r,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function y(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function x(t){if("string"==typeof t){var r=o._prime(t);this.m=r.p,this.prime=r}else e(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){x.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var r,i=t;do{this.split(i,this.tmp),r=(i=(i=this.imulK(i)).iadd(this.tmp)).bitLength()}while(r>this.n);var e=r<this.n?-1:i.ucmp(this.p);return 0===e?(i.words[0]=0,i.length=1):e>0?i.isub(this.p):i.strip(),i},g.prototype.split=function(t,r){t.iushrn(this.n,0,r)},g.prototype.imulK=function(t){return t.imul(this.k)},n(M,g),M.prototype.split=function(t,r){for(var i=Math.min(t.length,9),e=0;e<i;e++)r.words[e]=t.words[e];if(r.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(r.words[r.length++]=4194303&n,e=10;e<t.length;e++){var o=0|t.words[e];t.words[e-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,t.words[e-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var r=0,i=0;i<t.length;i++){var e=0|t.words[i];r+=977*e,t.words[i]=67108863&r,r=64*e+(r/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(w,g),n(y,g),n(b,g),b.prototype.imulK=function(t){for(var r=0,i=0;i<t.length;i++){var e=19*(0|t.words[i])+r,n=67108863&e;e>>>=26,t.words[i]=n,r=e}return 0!==r&&(t.words[t.length++]=r),t},o._prime=function(t){if(v[t])return v[t];var r;if("k256"===t)r=new M;else if("p224"===t)r=new w;else if("p192"===t)r=new y;else{if("p25519"!==t)throw new Error("Unknown prime "+t);r=new b}return v[t]=r,r},x.prototype._verify1=function(t){e(0===t.negative,"red works only with positives"),e(t.red,"red works only with red numbers")},x.prototype._verify2=function(t,r){e(0==(t.negative|r.negative),"red works only with positives"),e(t.red&&t.red===r.red,"red works only with red numbers")},x.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},x.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},x.prototype.add=function(t,r){this._verify2(t,r);var i=t.add(r);return i.cmp(this.m)>=0&&i.isub(this.m),i._forceRed(this)},x.prototype.iadd=function(t,r){this._verify2(t,r);var i=t.iadd(r);return i.cmp(this.m)>=0&&i.isub(this.m),i},x.prototype.sub=function(t,r){this._verify2(t,r);var i=t.sub(r);return i.cmpn(0)<0&&i.iadd(this.m),i._forceRed(this)},x.prototype.isub=function(t,r){this._verify2(t,r);var i=t.isub(r);return i.cmpn(0)<0&&i.iadd(this.m),i},x.prototype.shl=function(t,r){return this._verify1(t),this.imod(t.ushln(r))},x.prototype.imul=function(t,r){return this._verify2(t,r),this.imod(t.imul(r))},x.prototype.mul=function(t,r){return this._verify2(t,r),this.imod(t.mul(r))},x.prototype.isqr=function(t){return this.imul(t,t.clone())},x.prototype.sqr=function(t){return this.mul(t,t)},x.prototype.sqrt=function(t){if(t.isZero())return t.clone();var r=this.m.andln(3);if(e(r%2==1),3===r){var i=this.m.add(new o(1)).iushrn(2);return this.pow(t,i)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);e(!n.isZero());var h=new o(1).toRed(this),u=h.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,n),m=this.pow(t,n.addn(1).iushrn(1)),c=this.pow(t,n),d=s;0!==c.cmp(h);){for(var p=c,v=0;0!==p.cmp(h);v++)p=p.redSqr();e(v<d);var g=this.pow(f,new o(1).iushln(d-v-1));m=m.redMul(g),f=g.redSqr(),c=c.redMul(f),d=v}return m},x.prototype.invm=function(t){var r=t._invmp(this.m);return 0!==r.negative?(r.negative=0,this.imod(r).redNeg()):this.imod(r)},x.prototype.pow=function(t,r){if(r.isZero())return new o(1);if(0===r.cmpn(1))return t.clone();var i=new Array(16);i[0]=new o(1).toRed(this),i[1]=t;for(var e=2;e<i.length;e++)i[e]=this.mul(i[e-1],t);var n=i[0],s=0,h=0,u=r.bitLength()%26;for(0===u&&(u=26),e=r.length-1;e>=0;e--){for(var a=r.words[e],l=u-1;l>=0;l--){var f=a>>l&1;n!==i[0]&&(n=this.sqr(n)),0!==f||0!==s?(s<<=1,s|=f,(4===++h||0===e&&0===l)&&(n=this.mul(n,i[s]),h=0,s=0)):h=0}u=26}return n},x.prototype.convertTo=function(t){var r=t.umod(this.m);return r===t?r.clone():r},x.prototype.convertFrom=function(t){var r=t.clone();return r.red=null,r},o.mont=function(t){return new _(t)},n(_,x),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var r=this.imod(t.mul(this.rinv));return r.red=null,r},_.prototype.imul=function(t,r){if(t.isZero()||r.isZero())return t.words[0]=0,t.length=1,t;var i=t.imul(r),e=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(e).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},_.prototype.mul=function(t,r){if(t.isZero()||r.isZero())return new o(0)._forceRed(this);var i=t.mul(r),e=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(e).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,i(2)(t))},function(t,r,i){var e=i(0),n=i(12),o=i(5),s=i(8),h=i(66),u=function(t){return t instanceof n||t&&t.constructor&&"BN"===t.constructor.name},a=function(t){return t&&t.constructor&&"BigNumber"===t.constructor.name},l=function(t){try{return o.apply(null,arguments)}catch(r){throw new Error(r+' Given value: "'+t+'"')}},f=function(t){return!!/^(0x)?[0-9a-f]{40}$/i.test(t)&&(!(!/^(0x|0X)?[0-9a-f]{40}$/.test(t)&&!/^(0x|0X)?[0-9A-F]{40}$/.test(t))||m(t))},m=function(t){t=t.replace(/^0x/i,"");for(var r=g(t.toLowerCase()).replace(/^0x/i,""),i=0;i<40;i++)if(parseInt(r[i],16)>7&&t[i].toUpperCase()!==t[i]||parseInt(r[i],16)<=7&&t[i].toLowerCase()!==t[i])return!1;return!0},c=function(t){var r="";t=(t=(t=(t=(t=s.encode(t)).replace(/^(?:\u0000)*/,"")).split("").reverse().join("")).replace(/^(?:\u0000)*/,"")).split("").reverse().join("");for(var i=0;i<t.length;i++){var e=t.charCodeAt(i).toString(16);r+=e.length<2?"0"+e:e}return"0x"+r},d=function(t){if(e.isNull(t)||e.isUndefined(t))return t;if(!isFinite(t)&&!v(t))throw new Error('Given input "'+t+'" is not a number.');var r=l(t),i=r.toString(16);return r.lt(new n(0))?"-0x"+i.substr(1):"0x"+i},p=function(t){if(t=t.toString(16),!v(t))throw new Error('Given value "'+t+'" is not a valid hex string.');t=t.replace(/^0x/i,"");for(var r=[],i=0;i<t.length;i+=2)r.push(parseInt(t.substr(i,2),16));return r},v=function(t){return(e.isString(t)||e.isNumber(t))&&/^(-)?0x[0-9a-f]*$/i.test(t)},g=function(t){v(t)&&/^0x/i.test(t.toString())&&(t=p(t));var r=h.keccak256(t);return"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"===r?null:r};g._Hash=h,t.exports={BN:n,isBN:u,isBigNumber:a,toBN:l,isAddress:f,isBloom:function(t){return!(!/^(0x)?[0-9a-f]{512}$/i.test(t)||!/^(0x)?[0-9a-f]{512}$/.test(t)&&!/^(0x)?[0-9A-F]{512}$/.test(t))},isTopic:function(t){return!(!/^(0x)?[0-9a-f]{64}$/i.test(t)||!/^(0x)?[0-9a-f]{64}$/.test(t)&&!/^(0x)?[0-9A-F]{64}$/.test(t))},checkAddressChecksum:m,utf8ToHex:c,hexToUtf8:function(t){if(!v(t))throw new Error('The parameter "'+t+'" must be a valid HEX string.');for(var r="",i=0,e=(t=(t=(t=(t=(t=t.replace(/^0x/i,"")).replace(/^(?:00)*/,"")).split("").reverse().join("")).replace(/^(?:00)*/,"")).split("").reverse().join("")).length,n=0;n<e;n+=2)i=parseInt(t.substr(n,2),16),r+=String.fromCharCode(i);return s.decode(r)},hexToNumber:function(t){return t?l(t).toNumber():t},hexToNumberString:function(t){return t?l(t).toString(10):t},numberToHex:d,toHex:function(t,r){if(f(t))return r?"address":"0x"+t.toLowerCase().replace(/^0x/i,"");if(e.isBoolean(t))return r?"bool":t?"0x01":"0x00";if(e.isObject(t)&&!a(t)&&!u(t))return r?"string":c(JSON.stringify(t));if(e.isString(t)){if(0===t.indexOf("-0x")||0===t.indexOf("-0X"))return r?"int256":d(t);if(0===t.indexOf("0x")||0===t.indexOf("0X"))return r?"bytes":t;if(!isFinite(t))return r?"string":c(t)}return r?t<0?"int256":"uint256":d(t)},hexToBytes:p,bytesToHex:function(t){for(var r=[],i=0;i<t.length;i++)r.push((t[i]>>>4).toString(16)),r.push((15&t[i]).toString(16));return"0x"+r.join("")},isHex:function(t){return(e.isString(t)||e.isNumber(t))&&/^(-0x|0x)?[0-9a-f]*$/i.test(t)},isHexStrict:v,leftPad:function(t,r,i){var e=/^0x/i.test(t)||"number"==typeof t,n=r-(t=t.toString(16).replace(/^0x/i,"")).length+1>=0?r-t.length+1:0;return(e?"0x":"")+new Array(n).join(i||"0")+t},rightPad:function(t,r,i){var e=/^0x/i.test(t)||"number"==typeof t,n=r-(t=t.toString(16).replace(/^0x/i,"")).length+1>=0?r-t.length+1:0;return(e?"0x":"")+t+new Array(n).join(i||"0")},toTwosComplement:function(t){return"0x"+l(t).toTwos(256).toString(16,64)},sha3:g}},function(t,r,i){t.exports=i(26)},function(t,r,i){!function(){var t,r=i(27).ThorProvider;try{var e=o();t=function(t,r){var i=JSON.parse(t);if(i.requestId==r)return 1==i.code?i.data:i.message}(h("getNodeUrl",{},"cbGetNodeUrl",e),e)}catch(t){alert(t)}r.prototype.enable=function(){var t=o();s("cbGetAccounts",t).catch(function(t){return callback(new Error("[thor-provider] while get accounts: ".concat(t)),null)}),h("getAccounts",{},"cbGetAccounts",t)},r.prototype._sendAsync=r.prototype.sendAsync,r.prototype.sendAsync=function(t,r){if("eth_sendTransaction"===t.method){var i=Object.assign({},t.params[0]),e=o();try{h("send",i,"cbSend",e),s("cbSend",e).then(function(i){return r(null,{id:t.id,jsonrpc:"2.0",result:i})}).catch(function(t){return r(new Error("[thor-provider] while send transaction: ".concat(t)),null)})}catch(t){return r(new Error("[thor-provider] while send transaction: ".concat(t)),null)}}else if("eth_getBalance"===t.method){var n=o();h("getBalance",{address:t.params[0]},"cbGetBalance",n),s("cbGetBalance",n).then(function(i){return r(null,{id:t.id,jsonrpc:"2.0",result:i})}).catch(function(t){return r(new Error("[thor-provider] while get balance: ".concat(t)),null)})}else if("eth_accounts"===t.method){var u=o();h("getAccounts",{},"cbGetAccounts",u),s("cbGetAccounts",u).then(function(i){return r(null,{id:t.id,jsonrpc:"2.0",result:i})}).catch(function(t){return r(new Error("[thor-provider] while get accounts: ".concat(t)),null)})}else t.method,this._sendAsync(t,r)};var n=new r(t,0);function o(){return+new Date+Math.random().toString().substr(2,4)}function s(t,r){return new Promise(function(i,e){window[t+r]=void 0,window[t+r]=function(t){var n=JSON.parse(t);n.requestId==r&&(1==n.code?i(n.data):e(n.message))}})}function h(t,r,i,e){if(window.thorWeb3&&window.thorWeb3.post)return window.thorWeb3.post(t,JSON.stringify(r),i,e);var n={method:t,params:r,callbackId:i,requestId:e};return window.prompt("test","wallet://".concat(JSON.stringify(n)))}window.thor=n}()},function(t,r,i){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const e=i(28),n=i(14)("thor:http-provider"),o=i(36),s=i(37),h=i(13),u=i(38),a=i(52);r.ThorProvider=class extends o.EventEmitter{constructor(t,r=0){if(super(),!t)throw new Error('[thor-provider]Thorify requires that the host be specified(e.g. "http://localhost:8669")');const i=e.parse(t);if(!i.protocol||!i.host)throw new Error("[thor-provider]Parsing url failed!");this.RESTHost=`${i.protocol}//${i.host}`,this.WSHost=`${i.protocol.replace("http","ws")}//${i.host}`,this.timeout=r,this.sockets=[]}sendAsync(t,r){n("payload: %O",t);const i=new u.JSONRPC(t);return"eth_sendTransaction"===i.method?r(null,i.makeError("[thor-provider]The private key corresponding to from filed can't be found in local eth.accounts.wallet!")):"eth_subscribe"===i.method||"eth_unsubscribe"===i.method?this.ManagerSubscription(i,r):void(a.RPCMethodMap.has(i.method)?a.RPCMethodMap.get(i.method)(i,this.RESTHost,this.timeout).then(t=>{n("response: %O",t.result),l(r(null,t))}).catch(t=>{l(r(t,null))}):r(null,i.makeError("[thor-provider]Method not supported!")))}ManagerSubscription(t,r){let i="";if("eth_subscribe"===t.method){let e="/subscriptions/";switch(t.params[0]){case"newHeads":e+="block",t.params[1]&&"best"!==t.params[1]&&(e+="?pos="+t.params[1]);break;case"logs":e+="event",(i=h.stringify(t.params[1]))&&(e+="?"+i);break;case"transfers":e+="transfer",(i=h.stringify(t.params[1]))&&(e+="?"+i);break;default:return void r(null,t.makeError(`Subscription ${t.params[0]} not supported!`))}const o=new s(this.WSHost+e);return o.onerror=r=>{n("error from ws: %O",r),this.emit("data",t.makeSubError(r.error?r.error:"Error from upstream"))},o.onmessage=r=>{n("[ws]message from ws: %O",r.data);try{const i=JSON.parse(r.data);i.removed=i.obsolete,delete i.obsolete,this.emit("data",t.makeSubResult(i))}catch(t){n("Parse message failed %O",t)}},o.onopen=()=>{n("[ws]opened"),o.onclose=r=>{n("[ws]close",r.code,r.reason);let i="Connection closed.";r.code&&(i+=" Error code: "+r.code),r.reason&&(i+=" Error reason: "+r.reason),this.emit("data",t.makeSubError(new Error(i)))}},this.sockets[t.id]={rpc:t,ws:o},void r(null,t.makeResult(t.id))}if(this.sockets[t.params[0]]){const i=this.sockets[t.params[0]].ws;i&&i.readyState===i.OPEN?(i.close(),i.removeAllListeners?i.removeAllListeners():(i.onopen=null,i.onerror=null,i.onmessage=null,i.onclose=null),delete this.sockets[t.params[0]],r(null,t.makeResult(!0))):(delete this.sockets[t.params[0]],r(null,t.makeResult(!0)))}else r(null,t.makeResult(!0))}};const l=function(t){t&&t.catch&&t.catch(()=>null)}},function(t,r,i){"use strict";var e=i(29),n=i(30);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}r.parse=w,r.resolve=function(t,r){return w(t,!1,!0).resolve(r)},r.resolveObject=function(t,r){return t?w(t,!1,!0).resolveObject(r):r},r.format=function(t){n.isString(t)&&(t=w(t));return t instanceof o?t.format():o.prototype.format.call(t)},r.Url=o;var s=/^([a-z0-9.+-]+:)/i,h=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,a=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(a),f=["%","/","?",";","#"].concat(l),m=["/","?","#"],c=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,p={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},M=i(13);function w(t,r,i){if(t&&n.isObject(t)&&t instanceof o)return t;var e=new o;return e.parse(t,r,i),e}o.prototype.parse=function(t,r,i){if(!n.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),h=-1!==o&&o<t.indexOf("#")?"?":"#",a=t.split(h);a[0]=a[0].replace(/\\/g,"/");var w=t=a.join(h);if(w=w.trim(),!i&&1===t.split("#").length){var y=u.exec(w);if(y)return this.path=w,this.href=w,this.pathname=y[1],y[2]?(this.search=y[2],this.query=r?M.parse(this.search.substr(1)):this.search.substr(1)):r&&(this.search="",this.query={}),this}var b=s.exec(w);if(b){var x=(b=b[0]).toLowerCase();this.protocol=x,w=w.substr(b.length)}if(i||b||w.match(/^\/\/[^@\/]+@[^@\/]+/)){var _="//"===w.substr(0,2);!_||b&&v[b]||(w=w.substr(2),this.slashes=!0)}if(!v[b]&&(_||b&&!g[b])){for(var A,S,k=-1,T=0;T<m.length;T++){-1!==(E=w.indexOf(m[T]))&&(-1===k||E<k)&&(k=E)}-1!==(S=-1===k?w.lastIndexOf("@"):w.lastIndexOf("@",k))&&(A=w.slice(0,S),w=w.slice(S+1),this.auth=decodeURIComponent(A)),k=-1;for(T=0;T<f.length;T++){var E;-1!==(E=w.indexOf(f[T]))&&(-1===k||E<k)&&(k=E)}-1===k&&(k=w.length),this.host=w.slice(0,k),w=w.slice(k),this.parseHost(),this.hostname=this.hostname||"";var B="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!B)for(var N=this.hostname.split(/\./),C=(T=0,N.length);T<C;T++){var O=N[T];if(O&&!O.match(c)){for(var R="",I=0,P=O.length;I<P;I++)O.charCodeAt(I)>127?R+="x":R+=O[I];if(!R.match(c)){var j=N.slice(0,T),L=N.slice(T+1),H=O.match(d);H&&(j.push(H[1]),L.unshift(H[2])),L.length&&(w="/"+L.join(".")+w),this.hostname=j.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),B||(this.hostname=e.toASCII(this.hostname));var F=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+F,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==w[0]&&(w="/"+w))}if(!p[x])for(T=0,C=l.length;T<C;T++){var Z=l[T];if(-1!==w.indexOf(Z)){var U=encodeURIComponent(Z);U===Z&&(U=escape(Z)),w=w.split(Z).join(U)}}var z=w.indexOf("#");-1!==z&&(this.hash=w.substr(z),w=w.slice(0,z));var D=w.indexOf("?");if(-1!==D?(this.search=w.substr(D),this.query=w.substr(D+1),r&&(this.query=M.parse(this.query)),w=w.slice(0,D)):r&&(this.search="",this.query={}),w&&(this.pathname=w),g[x]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){F=this.pathname||"";var W=this.search||"";this.path=F+W}return this.href=this.format(),this},o.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var r=this.protocol||"",i=this.pathname||"",e=this.hash||"",o=!1,s="";this.host?o=t+this.host:this.hostname&&(o=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&n.isObject(this.query)&&Object.keys(this.query).length&&(s=M.stringify(this.query));var h=this.search||s&&"?"+s||"";return r&&":"!==r.substr(-1)&&(r+=":"),this.slashes||(!r||g[r])&&!1!==o?(o="//"+(o||""),i&&"/"!==i.charAt(0)&&(i="/"+i)):o||(o=""),e&&"#"!==e.charAt(0)&&(e="#"+e),h&&"?"!==h.charAt(0)&&(h="?"+h),r+o+(i=i.replace(/[?#]/g,function(t){return encodeURIComponent(t)}))+(h=h.replace("#","%23"))+e},o.prototype.resolve=function(t){return this.resolveObject(w(t,!1,!0)).format()},o.prototype.resolveObject=function(t){if(n.isString(t)){var r=new o;r.parse(t,!1,!0),t=r}for(var i=new o,e=Object.keys(this),s=0;s<e.length;s++){var h=e[s];i[h]=this[h]}if(i.hash=t.hash,""===t.href)return i.href=i.format(),i;if(t.slashes&&!t.protocol){for(var u=Object.keys(t),a=0;a<u.length;a++){var l=u[a];"protocol"!==l&&(i[l]=t[l])}return g[i.protocol]&&i.hostname&&!i.pathname&&(i.path=i.pathname="/"),i.href=i.format(),i}if(t.protocol&&t.protocol!==i.protocol){if(!g[t.protocol]){for(var f=Object.keys(t),m=0;m<f.length;m++){var c=f[m];i[c]=t[c]}return i.href=i.format(),i}if(i.protocol=t.protocol,t.host||v[t.protocol])i.pathname=t.pathname;else{for(var d=(t.pathname||"").split("/");d.length&&!(t.host=d.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),i.pathname=d.join("/")}if(i.search=t.search,i.query=t.query,i.host=t.host||"",i.auth=t.auth,i.hostname=t.hostname||t.host,i.port=t.port,i.pathname||i.search){var p=i.pathname||"",M=i.search||"";i.path=p+M}return i.slashes=i.slashes||t.slashes,i.href=i.format(),i}var w=i.pathname&&"/"===i.pathname.charAt(0),y=t.host||t.pathname&&"/"===t.pathname.charAt(0),b=y||w||i.host&&t.pathname,x=b,_=i.pathname&&i.pathname.split("/")||[],A=(d=t.pathname&&t.pathname.split("/")||[],i.protocol&&!g[i.protocol]);if(A&&(i.hostname="",i.port=null,i.host&&(""===_[0]?_[0]=i.host:_.unshift(i.host)),i.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===d[0]?d[0]=t.host:d.unshift(t.host)),t.host=null),b=b&&(""===d[0]||""===_[0])),y)i.host=t.host||""===t.host?t.host:i.host,i.hostname=t.hostname||""===t.hostname?t.hostname:i.hostname,i.search=t.search,i.query=t.query,_=d;else if(d.length)_||(_=[]),_.pop(),_=_.concat(d),i.search=t.search,i.query=t.query;else if(!n.isNullOrUndefined(t.search)){if(A)i.hostname=i.host=_.shift(),(B=!!(i.host&&i.host.indexOf("@")>0)&&i.host.split("@"))&&(i.auth=B.shift(),i.host=i.hostname=B.shift());return i.search=t.search,i.query=t.query,n.isNull(i.pathname)&&n.isNull(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.href=i.format(),i}if(!_.length)return i.pathname=null,i.search?i.path="/"+i.search:i.path=null,i.href=i.format(),i;for(var S=_.slice(-1)[0],k=(i.host||t.host||_.length>1)&&("."===S||".."===S)||""===S,T=0,E=_.length;E>=0;E--)"."===(S=_[E])?_.splice(E,1):".."===S?(_.splice(E,1),T++):T&&(_.splice(E,1),T--);if(!b&&!x)for(;T--;T)_.unshift("..");!b||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),k&&"/"!==_.join("/").substr(-1)&&_.push("");var B,N=""===_[0]||_[0]&&"/"===_[0].charAt(0);A&&(i.hostname=i.host=N?"":_.length?_.shift():"",(B=!!(i.host&&i.host.indexOf("@")>0)&&i.host.split("@"))&&(i.auth=B.shift(),i.host=i.hostname=B.shift()));return(b=b||i.host&&_.length)&&!N&&_.unshift(""),_.length?i.pathname=_.join("/"):(i.pathname=null,i.path=null),n.isNull(i.pathname)&&n.isNull(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.auth=t.auth||i.auth,i.slashes=i.slashes||t.slashes,i.href=i.format(),i},o.prototype.parseHost=function(){var t=this.host,r=h.exec(t);r&&(":"!==(r=r[0])&&(this.port=r.substr(1)),t=t.substr(0,t.length-r.length)),t&&(this.hostname=t)}},function(t,r,i){(function(t,e){var n;!function(o){r&&r.nodeType,t&&t.nodeType;var s="object"==typeof e&&e;s.global!==s&&s.window!==s&&s.self;var h,u=2147483647,a=36,l=1,f=26,m=38,c=700,d=72,p=128,v="-",g=/^xn--/,M=/[^\x20-\x7E]/,w=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},b=a-l,x=Math.floor,_=String.fromCharCode;function A(t){throw new RangeError(y[t])}function S(t,r){for(var i=t.length,e=[];i--;)e[i]=r(t[i]);return e}function k(t,r){var i=t.split("@"),e="";return i.length>1&&(e=i[0]+"@",t=i[1]),e+S((t=t.replace(w,".")).split("."),r).join(".")}function T(t){for(var r,i,e=[],n=0,o=t.length;n<o;)(r=t.charCodeAt(n++))>=55296&&r<=56319&&n<o?56320==(64512&(i=t.charCodeAt(n++)))?e.push(((1023&r)<<10)+(1023&i)+65536):(e.push(r),n--):e.push(r);return e}function E(t){return S(t,function(t){var r="";return t>65535&&(r+=_((t-=65536)>>>10&1023|55296),t=56320|1023&t),r+=_(t)}).join("")}function B(t,r){return t+22+75*(t<26)-((0!=r)<<5)}function N(t,r,i){var e=0;for(t=i?x(t/c):t>>1,t+=x(t/r);t>b*f>>1;e+=a)t=x(t/b);return x(e+(b+1)*t/(t+m))}function C(t){var r,i,e,n,o,s,h,m,c,g,M,w=[],y=t.length,b=0,_=p,S=d;for((i=t.lastIndexOf(v))<0&&(i=0),e=0;e<i;++e)t.charCodeAt(e)>=128&&A("not-basic"),w.push(t.charCodeAt(e));for(n=i>0?i+1:0;n<y;){for(o=b,s=1,h=a;n>=y&&A("invalid-input"),((m=(M=t.charCodeAt(n++))-48<10?M-22:M-65<26?M-65:M-97<26?M-97:a)>=a||m>x((u-b)/s))&&A("overflow"),b+=m*s,!(m<(c=h<=S?l:h>=S+f?f:h-S));h+=a)s>x(u/(g=a-c))&&A("overflow"),s*=g;S=N(b-o,r=w.length+1,0==o),x(b/r)>u-_&&A("overflow"),_+=x(b/r),b%=r,w.splice(b++,0,_)}return E(w)}function O(t){var r,i,e,n,o,s,h,m,c,g,M,w,y,b,S,k=[];for(w=(t=T(t)).length,r=p,i=0,o=d,s=0;s<w;++s)(M=t[s])<128&&k.push(_(M));for(e=n=k.length,n&&k.push(v);e<w;){for(h=u,s=0;s<w;++s)(M=t[s])>=r&&M<h&&(h=M);for(h-r>x((u-i)/(y=e+1))&&A("overflow"),i+=(h-r)*y,r=h,s=0;s<w;++s)if((M=t[s])<r&&++i>u&&A("overflow"),M==r){for(m=i,c=a;!(m<(g=c<=o?l:c>=o+f?f:c-o));c+=a)S=m-g,b=a-g,k.push(_(B(g+S%b,0))),m=x(S/b);k.push(_(B(m,0))),o=N(i,y,e==n),i=0,++e}++i,++r}return k.join("")}h={version:"1.4.1",ucs2:{decode:T,encode:E},decode:C,encode:O,toASCII:function(t){return k(t,function(t){return M.test(t)?"xn--"+O(t):t})},toUnicode:function(t){return k(t,function(t){return g.test(t)?C(t.slice(4).toLowerCase()):t})}},void 0===(n=function(){return h}.call(r,i,r,t))||(t.exports=n)}()}).call(this,i(2)(t),i(6))},function(t,r,i){"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,r,i){"use strict";function e(t,r){return Object.prototype.hasOwnProperty.call(t,r)}t.exports=function(t,r,i,o){r=r||"&",i=i||"=";var s={};if("string"!=typeof t||0===t.length)return s;var h=/\+/g;t=t.split(r);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var a=t.length;u>0&&a>u&&(a=u);for(var l=0;l<a;++l){var f,m,c,d,p=t[l].replace(h,"%20"),v=p.indexOf(i);v>=0?(f=p.substr(0,v),m=p.substr(v+1)):(f=p,m=""),c=decodeURIComponent(f),d=decodeURIComponent(m),e(s,c)?n(s[c])?s[c].push(d):s[c]=[s[c],d]:s[c]=d}return s};var n=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,r,i){"use strict";var e=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,r,i,h){return r=r||"&",i=i||"=",null===t&&(t=void 0),"object"==typeof t?o(s(t),function(s){var h=encodeURIComponent(e(s))+i;return n(t[s])?o(t[s],function(t){return h+encodeURIComponent(e(t))}).join(r):h+encodeURIComponent(e(t[s]))}).join(r):h?encodeURIComponent(e(h))+i+encodeURIComponent(e(t)):""};var n=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function o(t,r){if(t.map)return t.map(r);for(var i=[],e=0;e<t.length;e++)i.push(r(t[e],e));return i}var s=Object.keys||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&r.push(i);return r}},function(t,r){var i,e,n=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function h(t){if(i===setTimeout)return setTimeout(t,0);if((i===o||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(r){try{return i.call(null,t,0)}catch(r){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:o}catch(t){i=o}try{e="function"==typeof clearTimeout?clearTimeout:s}catch(t){e=s}}();var u,a=[],l=!1,f=-1;function m(){l&&u&&(l=!1,u.length?a=u.concat(a):f=-1,a.length&&c())}function c(){if(!l){var t=h(m);l=!0;for(var r=a.length;r;){for(u=a,a=[];++f<r;)u&&u[f].run();f=-1,r=a.length}u=null,l=!1,function(t){if(e===clearTimeout)return clearTimeout(t);if((e===s||!e)&&clearTimeout)return e=clearTimeout,clearTimeout(t);try{e(t)}catch(r){try{return e.call(null,t)}catch(r){return e.call(this,t)}}}(t)}}function d(t,r){this.fun=t,this.array=r}function p(){}n.nextTick=function(t){var r=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)r[i-1]=arguments[i];a.push(new d(t,r)),1!==a.length||l||h(c)},d.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},function(t,r,i){"use strict";t.exports=function(t){function r(t){for(var r=0,i=0;i<t.length;i++)r=(r<<5)-r+t.charCodeAt(i),r|=0;return e.colors[Math.abs(r)%e.colors.length]}function e(t){var i;function s(){if(s.enabled){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var o=s,h=Number(new Date),u=h-(i||h);o.diff=u,o.prev=i,o.curr=h,i=h,r[0]=e.coerce(r[0]),"string"!=typeof r[0]&&r.unshift("%O");var a=0;r[0]=r[0].replace(/%([a-zA-Z%])/g,function(t,i){if("%%"===t)return t;a++;var n=e.formatters[i];if("function"==typeof n){var s=r[a];t=n.call(o,s),r.splice(a,1),a--}return t}),e.formatArgs.call(o,r),(o.log||e.log).apply(o,r)}}return s.namespace=t,s.enabled=e.enabled(t),s.useColors=e.useColors(),s.color=r(t),s.destroy=n,s.extend=o,"function"==typeof e.init&&e.init(s),e.instances.push(s),s}function n(){var t=e.instances.indexOf(this);return-1!==t&&(e.instances.splice(t,1),!0)}function o(t,r){return e(this.namespace+(void 0===r?":":r)+t)}return e.debug=e,e.default=e,e.coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){e.enable("")},e.enable=function(t){var r;e.save(t),e.names=[],e.skips=[];var i=("string"==typeof t?t:"").split(/[\s,]+/),n=i.length;for(r=0;r<n;r++)i[r]&&("-"===(t=i[r].replace(/\*/g,".*?"))[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")));for(r=0;r<e.instances.length;r++){var o=e.instances[r];o.enabled=e.enabled(o.namespace)}},e.enabled=function(t){if("*"===t[t.length-1])return!0;var r,i;for(r=0,i=e.skips.length;r<i;r++)if(e.skips[r].test(t))return!1;for(r=0,i=e.names.length;r<i;r++)if(e.names[r].test(t))return!0;return!1},e.humanize=i(35),Object.keys(t).forEach(function(r){e[r]=t[r]}),e.instances=[],e.names=[],e.skips=[],e.formatters={},e.selectColor=r,e.enable(e.load()),e}},function(t,r){var i=1e3,e=60*i,n=60*e,o=24*n,s=7*o,h=365.25*o;function u(t,r,i,e){var n=r>=1.5*i;return Math.round(t/i)+" "+e+(n?"s":"")}t.exports=function(t,r){r=r||{};var a=typeof t;if("string"===a&&t.length>0)return function(t){if((t=String(t)).length>100)return;var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!r)return;var u=parseFloat(r[1]);switch((r[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return u*h;case"weeks":case"week":case"w":return u*s;case"days":case"day":case"d":return u*o;case"hours":case"hour":case"hrs":case"hr":case"h":return u*n;case"minutes":case"minute":case"mins":case"min":case"m":return u*e;case"seconds":case"second":case"secs":case"sec":case"s":return u*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(t);if("number"===a&&isFinite(t))return r.long?function(t){var r=Math.abs(t);if(r>=o)return u(t,r,o,"day");if(r>=n)return u(t,r,n,"hour");if(r>=e)return u(t,r,e,"minute");if(r>=i)return u(t,r,i,"second");return t+" ms"}(t):function(t){var r=Math.abs(t);if(r>=o)return Math.round(t/o)+"d";if(r>=n)return Math.round(t/n)+"h";if(r>=e)return Math.round(t/e)+"m";if(r>=i)return Math.round(t/i)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,r,i){"use strict";var e=Object.prototype.hasOwnProperty,n="~";function o(){}function s(t,r,i){this.fn=t,this.context=r,this.once=i||!1}function h(t,r,i,e,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var h=new s(i,e||t,o),u=n?n+r:r;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],h]:t._events[u].push(h):(t._events[u]=h,t._eventsCount++),t}function u(t,r){0==--t._eventsCount?t._events=new o:delete t._events[r]}function a(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(n=!1)),a.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},a.prototype.listeners=function(t){var r=n?n+t:t,i=this._events[r];if(!i)return[];if(i.fn)return[i.fn];for(var e=0,o=i.length,s=new Array(o);e<o;e++)s[e]=i[e].fn;return s},a.prototype.listenerCount=function(t){var r=n?n+t:t,i=this._events[r];return i?i.fn?1:i.length:0},a.prototype.emit=function(t,r,i,e,o,s){var h=n?n+t:t;if(!this._events[h])return!1;var u,a,l=this._events[h],f=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),f){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,r),!0;case 3:return l.fn.call(l.context,r,i),!0;case 4:return l.fn.call(l.context,r,i,e),!0;case 5:return l.fn.call(l.context,r,i,e,o),!0;case 6:return l.fn.call(l.context,r,i,e,o,s),!0}for(a=1,u=new Array(f-1);a<f;a++)u[a-1]=arguments[a];l.fn.apply(l.context,u)}else{var m,c=l.length;for(a=0;a<c;a++)switch(l[a].once&&this.removeListener(t,l[a].fn,void 0,!0),f){case 1:l[a].fn.call(l[a].context);break;case 2:l[a].fn.call(l[a].context,r);break;case 3:l[a].fn.call(l[a].context,r,i);break;case 4:l[a].fn.call(l[a].context,r,i,e);break;default:if(!u)for(m=1,u=new Array(f-1);m<f;m++)u[m-1]=arguments[m];l[a].fn.apply(l[a].context,u)}}return!0},a.prototype.on=function(t,r,i){return h(this,t,r,i,!1)},a.prototype.once=function(t,r,i){return h(this,t,r,i,!0)},a.prototype.removeListener=function(t,r,i,e){var o=n?n+t:t;if(!this._events[o])return this;if(!r)return u(this,o),this;var s=this._events[o];if(s.fn)s.fn!==r||e&&!s.once||i&&s.context!==i||u(this,o);else{for(var h=0,a=[],l=s.length;h<l;h++)(s[h].fn!==r||e&&!s[h].once||i&&s[h].context!==i)&&a.push(s[h]);a.length?this._events[o]=1===a.length?a[0]:a:u(this,o)}return this},a.prototype.removeAllListeners=function(t){var r;return t?(r=n?n+t:t,this._events[r]&&u(this,r)):(this._events=new o,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a},function(t,r,i){(function(r){var i=null;"undefined"!=typeof WebSocket?i=WebSocket:"undefined"!=typeof MozWebSocket?i=MozWebSocket:void 0!==r?i=r.WebSocket||r.MozWebSocket:"undefined"!=typeof window?i=window.WebSocket||window.MozWebSocket:"undefined"!=typeof self&&(i=self.WebSocket||self.MozWebSocket),t.exports=i}).call(this,i(6))},function(t,r,i){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const e=i(10),n=function(t){return e.isArray(t)?t=t.map(t=>(Object.defineProperty(t,"isThorified",{get:()=>!0}),t)):e.isObject(t)&&Object.defineProperty(t,"isThorified",{get:()=>!0}),t};r.JSONRPC=class{constructor(t){this.id=t.id,this.method=t.method,this.params=t.params}makeResult(t){return{id:this.id,jsonrpc:"2.0",result:n(t)}}makeError(t){return{id:this.id,jsonrpc:"2.0",error:{message:t}}}makeSubResult(t){return{id:this.id,jsonrpc:"2.0",method:this.method,params:{result:{data:n(t)},subscription:this.id}}}makeSubError(t){return{id:this.id,jsonrpc:"2.0",method:this.method,params:{result:{error:t},subscription:this.id}}}}},function(t,r,i){"use strict";r.byteLength=function(t){var r=a(t),i=r[0],e=r[1];return 3*(i+e)/4-e},r.toByteArray=function(t){for(var r,i=a(t),e=i[0],s=i[1],h=new o(function(t,r,i){return 3*(r+i)/4-i}(0,e,s)),u=0,l=s>0?e-4:e,f=0;f<l;f+=4)r=n[t.charCodeAt(f)]<<18|n[t.charCodeAt(f+1)]<<12|n[t.charCodeAt(f+2)]<<6|n[t.charCodeAt(f+3)],h[u++]=r>>16&255,h[u++]=r>>8&255,h[u++]=255&r;2===s&&(r=n[t.charCodeAt(f)]<<2|n[t.charCodeAt(f+1)]>>4,h[u++]=255&r);1===s&&(r=n[t.charCodeAt(f)]<<10|n[t.charCodeAt(f+1)]<<4|n[t.charCodeAt(f+2)]>>2,h[u++]=r>>8&255,h[u++]=255&r);return h},r.fromByteArray=function(t){for(var r,i=t.length,n=i%3,o=[],s=0,h=i-n;s<h;s+=16383)o.push(l(t,s,s+16383>h?h:s+16383));1===n?(r=t[i-1],o.push(e[r>>2]+e[r<<4&63]+"==")):2===n&&(r=(t[i-2]<<8)+t[i-1],o.push(e[r>>10]+e[r>>4&63]+e[r<<2&63]+"="));return o.join("")};for(var e=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,u=s.length;h<u;++h)e[h]=s[h],n[s.charCodeAt(h)]=h;function a(t){var r=t.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.indexOf("=");return-1===i&&(i=r),[i,i===r?0:4-i%4]}function l(t,r,i){for(var n,o,s=[],h=r;h<i;h+=3)n=(t[h]<<16&16711680)+(t[h+1]<<8&65280)+(255&t[h+2]),s.push(e[(o=n)>>18&63]+e[o>>12&63]+e[o>>6&63]+e[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(t,r){r.read=function(t,r,i,e,n){var o,s,h=8*n-e-1,u=(1<<h)-1,a=u>>1,l=-7,f=i?n-1:0,m=i?-1:1,c=t[r+f];for(f+=m,o=c&(1<<-l)-1,c>>=-l,l+=h;l>0;o=256*o+t[r+f],f+=m,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=e;l>0;s=256*s+t[r+f],f+=m,l-=8);if(0===o)o=1-a;else{if(o===u)return s?NaN:1/0*(c?-1:1);s+=Math.pow(2,e),o-=a}return(c?-1:1)*s*Math.pow(2,o-e)},r.write=function(t,r,i,e,n,o){var s,h,u,a=8*o-n-1,l=(1<<a)-1,f=l>>1,m=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,c=e?0:o-1,d=e?1:-1,p=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(h=isNaN(r)?1:0,s=l):(s=Math.floor(Math.log(r)/Math.LN2),r*(u=Math.pow(2,-s))<1&&(s--,u*=2),(r+=s+f>=1?m/u:m*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(h=0,s=l):s+f>=1?(h=(r*u-1)*Math.pow(2,n),s+=f):(h=r*Math.pow(2,f-1)*Math.pow(2,n),s=0));n>=8;t[i+c]=255&h,c+=d,h/=256,n-=8);for(s=s<<n|h,a+=n;a>0;t[i+c]=255&s,c+=d,s/=256,a-=8);t[i+c-d]|=128*p}},function(t,r){var i={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==i.call(t)}},function(t,r,i){var e=i(0),n=i(7),o=i(15),s=i(48),h=i(9),u=function(t,r){var i=[];return r.forEach(function(r){if("object"==typeof r.components){if("tuple"!==r.type.substring(0,5))throw new Error("components found but type is not tuple; report on GitHub");var n="",o=r.type.indexOf("[");o>=0&&(n=r.type.substring(o));var s=u(t,r.components);e.isArray(s)&&t?i.push("tuple("+s.join(",")+")"+n):t?i.push("("+s+")"):i.push("("+s.join(",")+")"+n)}else i.push(r.type)}),i},a=function(t){if(!o.isHexStrict(t))throw new Error("The parameter must be a valid HEX string.");var r="",i=0,e=t.length;for("0x"===t.substring(0,2)&&(i=2);i<e;i+=2){var n=parseInt(t.substr(i,2),16);r+=String.fromCharCode(n)}return r},l=function(t){if(!t)return"0x00";for(var r="",i=0;i<t.length;i++){var e=t.charCodeAt(i).toString(16);r+=e.length<2?"0"+e:e}return"0x"+r},f=function(t){if(t=t?t.toLowerCase():"ether",!n.unitMap[t])throw new Error('This unit "'+t+"\" doesn't exist, please use the one of the following units"+JSON.stringify(n.unitMap,null,2));return t};t.exports={_fireError:function(t,r,i,n){return!e.isObject(t)||t instanceof Error||!t.data||((e.isObject(t.data)||e.isArray(t.data))&&(t.data=JSON.stringify(t.data,null,2)),t=t.message+"\n"+t.data),e.isString(t)&&(t=new Error(t)),e.isFunction(n)&&n(t),e.isFunction(i)&&((r&&e.isFunction(r.listeners)&&r.listeners("error").length||e.isFunction(n))&&r.catch(function(){}),setTimeout(function(){i(t)},1)),r&&e.isFunction(r.emit)&&setTimeout(function(){r.emit("error",t),r.removeAllListeners()},1),r},_jsonInterfaceMethodToString:function(t){return e.isObject(t)&&t.name&&-1!==t.name.indexOf("(")?t.name:t.name+"("+u(!1,t.inputs).join(",")+")"},_flattenTypes:u,randomHex:h,_:e,BN:o.BN,isBN:o.isBN,isBigNumber:o.isBigNumber,isHex:o.isHex,isHexStrict:o.isHexStrict,sha3:o.sha3,keccak256:o.sha3,soliditySha3:s,isAddress:o.isAddress,checkAddressChecksum:o.checkAddressChecksum,toChecksumAddress:function(t){if(void 0===t)return"";if(!/^(0x)?[0-9a-f]{40}$/i.test(t))throw new Error('Given address "'+t+'" is not a valid Ethereum address.');t=t.toLowerCase().replace(/^0x/i,"");for(var r=o.sha3(t).replace(/^0x/i,""),i="0x",e=0;e<t.length;e++)parseInt(r[e],16)>7?i+=t[e].toUpperCase():i+=t[e];return i},toHex:o.toHex,toBN:o.toBN,bytesToHex:o.bytesToHex,hexToBytes:o.hexToBytes,hexToNumberString:o.hexToNumberString,hexToNumber:o.hexToNumber,toDecimal:o.hexToNumber,numberToHex:o.numberToHex,fromDecimal:o.numberToHex,hexToUtf8:o.hexToUtf8,hexToString:o.hexToUtf8,toUtf8:o.hexToUtf8,utf8ToHex:o.utf8ToHex,stringToHex:o.utf8ToHex,fromUtf8:o.utf8ToHex,hexToAscii:a,toAscii:a,asciiToHex:l,fromAscii:l,unitMap:n.unitMap,toWei:function(t,r){if(r=f(r),!o.isBN(t)&&!e.isString(t))throw new Error("Please pass numbers as strings or BigNumber objects to avoid precision errors.");return o.isBN(t)?n.toWei(t,r):n.toWei(t,r).toString(10)},fromWei:function(t,r){if(r=f(r),!o.isBN(t)&&!e.isString(t))throw new Error("Please pass numbers as strings or BigNumber objects to avoid precision errors.");return o.isBN(t)?n.fromWei(t,r):n.fromWei(t,r).toString(10)},padLeft:o.leftPad,leftPad:o.leftPad,padRight:o.rightPad,rightPad:o.rightPad,toTwosComplement:o.toTwosComplement}},function(t,r,i){(function(t){!function(t,r){"use strict";function e(t,r){if(!t)throw new Error(r||"Assertion failed")}function n(t,r){t.super_=r;var i=function(){};i.prototype=r.prototype,t.prototype=new i,t.prototype.constructor=t}function o(t,r,i){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==r&&"be"!==r||(i=r,r=10),this._init(t||0,r||10,i||"be"))}var s;"object"==typeof t?t.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{s=i(3).Buffer}catch(t){}function h(t,r,i){for(var e=0,n=Math.min(t.length,i),o=r;o<n;o++){var s=t.charCodeAt(o)-48;e<<=4,e|=s>=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return e}function u(t,r,i,e){for(var n=0,o=Math.min(t.length,i),s=r;s<o;s++){var h=t.charCodeAt(s)-48;n*=e,n+=h>=49?h-49+10:h>=17?h-17+10:h}return n}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,r){return t.cmp(r)>0?t:r},o.min=function(t,r){return t.cmp(r)<0?t:r},o.prototype._init=function(t,r,i){if("number"==typeof t)return this._initNumber(t,r,i);if("object"==typeof t)return this._initArray(t,r,i);"hex"===r&&(r=16),e(r===(0|r)&&r>=2&&r<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===r?this._parseHex(t,n):this._parseBase(t,r,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===i&&this._initArray(this.toArray(),r,i)},o.prototype._initNumber=function(t,r,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(e(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),r,i)},o.prototype._initArray=function(t,r,i){if(e("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,h=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);return this.strip()},o.prototype._parseHex=function(t,r){this.length=Math.ceil((t.length-r)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var e,n,o=0;for(i=t.length-6,e=0;i>=r;i-=6)n=h(t,i,i+6),this.words[e]|=n<<o&67108863,this.words[e+1]|=n>>>26-o&4194303,(o+=24)>=26&&(o-=26,e++);i+6!==r&&(n=h(t,r,i+6),this.words[e]|=n<<o&67108863,this.words[e+1]|=n>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,r,i){this.words=[0],this.length=1;for(var e=0,n=1;n<=67108863;n*=r)e++;e--,n=n/r|0;for(var o=t.length-i,s=o%e,h=Math.min(o,o-s)+i,a=0,l=i;l<h;l+=e)a=u(t,l,l+e,r),this.imuln(n),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(0!==s){var f=1;for(a=u(t,l,t.length,r),l=0;l<s;l++)f*=r;this.imuln(f),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}},o.prototype.copy=function(t){t.words=new Array(this.length);for(var r=0;r<this.length;r++)t.words[r]=this.words[r];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],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];function m(t,r,i){i.negative=r.negative^t.negative;var e=t.length+r.length|0;i.length=e,e=e-1|0;var n=0|t.words[0],o=0|r.words[0],s=n*o,h=67108863&s,u=s/67108864|0;i.words[0]=h;for(var a=1;a<e;a++){for(var l=u>>>26,f=67108863&u,m=Math.min(a,r.length-1),c=Math.max(0,a-t.length+1);c<=m;c++){var d=a-c|0;l+=(s=(n=0|t.words[d])*(o=0|r.words[c])+f)/67108864|0,f=67108863&s}i.words[a]=0|f,u=0|l}return 0!==u?i.words[a]=0|u:i.length--,i.strip()}o.prototype.toString=function(t,r){var i;if(r=0|r||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var h=this.words[s],u=(16777215&(h<<n|o)).toString(16);i=0!==(o=h>>>24-n&16777215)||s!==this.length-1?a[6-u.length]+u+i:u+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%r!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var m=l[t],c=f[t];i="";var d=this.clone();for(d.negative=0;!d.isZero();){var p=d.modn(c).toString(t);i=(d=d.idivn(c)).isZero()?p+i:a[m-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%r!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}e(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,r){return e(void 0!==s),this.toArrayLike(s,t,r)},o.prototype.toArray=function(t,r){return this.toArrayLike(Array,t,r)},o.prototype.toArrayLike=function(t,r,i){var n=this.byteLength(),o=i||Math.max(1,n);e(n<=o,"byte array longer than desired length"),e(o>0,"Requested array length <= 0"),this.strip();var s,h,u="le"===r,a=new t(o),l=this.clone();if(u){for(h=0;!l.isZero();h++)s=l.andln(255),l.iushrn(8),a[h]=s;for(;h<o;h++)a[h]=0}else{for(h=0;h<o-n;h++)a[h]=0;for(h=0;!l.isZero();h++)s=l.andln(255),l.iushrn(8),a[o-h-1]=s}return a},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var r=t,i=0;return r>=4096&&(i+=13,r>>>=13),r>=64&&(i+=7,r>>>=7),r>=8&&(i+=4,r>>>=4),r>=2&&(i+=2,r>>>=2),i+r},o.prototype._zeroBits=function(t){if(0===t)return 26;var r=t,i=0;return 0==(8191&r)&&(i+=13,r>>>=13),0==(127&r)&&(i+=7,r>>>=7),0==(15&r)&&(i+=4,r>>>=4),0==(3&r)&&(i+=2,r>>>=2),0==(1&r)&&i++,i},o.prototype.bitLength=function(){var t=this.words[this.length-1],r=this._countBits(t);return 26*(this.length-1)+r},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,r=0;r<this.length;r++){var i=this._zeroBits(this.words[r]);if(t+=i,26!==i)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]|t.words[r];return this.strip()},o.prototype.ior=function(t){return e(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var r;r=this.length>t.length?t:this;for(var i=0;i<r.length;i++)this.words[i]=this.words[i]&t.words[i];return this.length=r.length,this.strip()},o.prototype.iand=function(t){return e(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var r,i;this.length>t.length?(r=this,i=t):(r=t,i=this);for(var e=0;e<i.length;e++)this.words[e]=r.words[e]^i.words[e];if(this!==r)for(;e<r.length;e++)this.words[e]=r.words[e];return this.length=r.length,this.strip()},o.prototype.ixor=function(t){return e(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){e("number"==typeof t&&t>=0);var r=0|Math.ceil(t/26),i=t%26;this._expand(r),i>0&&r--;for(var n=0;n<r;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,r){e("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=r?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},o.prototype.iadd=function(t){var r,i,e;if(0!==this.negative&&0===t.negative)return this.negative=0,r=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,r=this.isub(t),t.negative=1,r._normSign();this.length>t.length?(i=this,e=t):(i=t,e=this);for(var n=0,o=0;o<e.length;o++)r=(0|i.words[o])+(0|e.words[o])+n,this.words[o]=67108863&r,n=r>>>26;for(;0!==n&&o<i.length;o++)r=(0|i.words[o])+n,this.words[o]=67108863&r,n=r>>>26;if(this.length=i.length,0!==n)this.words[this.length]=n,this.length++;else if(i!==this)for(;o<i.length;o++)this.words[o]=i.words[o];return this},o.prototype.add=function(t){var r;return 0!==t.negative&&0===this.negative?(t.negative=0,r=this.sub(t),t.negative^=1,r):0===t.negative&&0!==this.negative?(this.negative=0,r=t.sub(this),this.negative=1,r):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var r=this.iadd(t);return t.negative=1,r._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var i,e,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(i=this,e=t):(i=t,e=this);for(var o=0,s=0;s<e.length;s++)o=(r=(0|i.words[s])-(0|e.words[s])+o)>>26,this.words[s]=67108863&r;for(;0!==o&&s<i.length;s++)o=(r=(0|i.words[s])+o)>>26,this.words[s]=67108863&r;if(0===o&&s<i.length&&i!==this)for(;s<i.length;s++)this.words[s]=i.words[s];return this.length=Math.max(this.length,s),i!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var c=function(t,r,i){var e,n,o,s=t.words,h=r.words,u=i.words,a=0,l=0|s[0],f=8191&l,m=l>>>13,c=0|s[1],d=8191&c,p=c>>>13,v=0|s[2],g=8191&v,M=v>>>13,w=0|s[3],y=8191&w,b=w>>>13,x=0|s[4],_=8191&x,A=x>>>13,S=0|s[5],k=8191&S,T=S>>>13,E=0|s[6],B=8191&E,N=E>>>13,C=0|s[7],O=8191&C,R=C>>>13,I=0|s[8],P=8191&I,j=I>>>13,L=0|s[9],H=8191&L,F=L>>>13,q=0|h[0],Z=8191&q,U=q>>>13,z=0|h[1],D=8191&z,W=z>>>13,$=0|h[2],G=8191&$,Y=$>>>13,J=0|h[3],X=8191&J,K=J>>>13,V=0|h[4],Q=8191&V,tt=V>>>13,rt=0|h[5],it=8191&rt,et=rt>>>13,nt=0|h[6],ot=8191&nt,st=nt>>>13,ht=0|h[7],ut=8191&ht,at=ht>>>13,lt=0|h[8],ft=8191&lt,mt=lt>>>13,ct=0|h[9],dt=8191&ct,pt=ct>>>13;i.negative=t.negative^r.negative,i.length=19;var vt=(a+(e=Math.imul(f,Z))|0)+((8191&(n=(n=Math.imul(f,U))+Math.imul(m,Z)|0))<<13)|0;a=((o=Math.imul(m,U))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,e=Math.imul(d,Z),n=(n=Math.imul(d,U))+Math.imul(p,Z)|0,o=Math.imul(p,U);var gt=(a+(e=e+Math.imul(f,D)|0)|0)+((8191&(n=(n=n+Math.imul(f,W)|0)+Math.imul(m,D)|0))<<13)|0;a=((o=o+Math.imul(m,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,e=Math.imul(g,Z),n=(n=Math.imul(g,U))+Math.imul(M,Z)|0,o=Math.imul(M,U),e=e+Math.imul(d,D)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,D)|0,o=o+Math.imul(p,W)|0;var Mt=(a+(e=e+Math.imul(f,G)|0)|0)+((8191&(n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,G)|0))<<13)|0;a=((o=o+Math.imul(m,Y)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,e=Math.imul(y,Z),n=(n=Math.imul(y,U))+Math.imul(b,Z)|0,o=Math.imul(b,U),e=e+Math.imul(g,D)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(M,D)|0,o=o+Math.imul(M,W)|0,e=e+Math.imul(d,G)|0,n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,Y)|0;var wt=(a+(e=e+Math.imul(f,X)|0)|0)+((8191&(n=(n=n+Math.imul(f,K)|0)+Math.imul(m,X)|0))<<13)|0;a=((o=o+Math.imul(m,K)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,e=Math.imul(_,Z),n=(n=Math.imul(_,U))+Math.imul(A,Z)|0,o=Math.imul(A,U),e=e+Math.imul(y,D)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,D)|0,o=o+Math.imul(b,W)|0,e=e+Math.imul(g,G)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,Y)|0,e=e+Math.imul(d,X)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,K)|0;var yt=(a+(e=e+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(m,Q)|0))<<13)|0;a=((o=o+Math.imul(m,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,e=Math.imul(k,Z),n=(n=Math.imul(k,U))+Math.imul(T,Z)|0,o=Math.imul(T,U),e=e+Math.imul(_,D)|0,n=(n=n+Math.imul(_,W)|0)+Math.imul(A,D)|0,o=o+Math.imul(A,W)|0,e=e+Math.imul(y,G)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,Y)|0,e=e+Math.imul(g,X)|0,n=(n=n+Math.imul(g,K)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,K)|0,e=e+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var bt=(a+(e=e+Math.imul(f,it)|0)|0)+((8191&(n=(n=n+Math.imul(f,et)|0)+Math.imul(m,it)|0))<<13)|0;a=((o=o+Math.imul(m,et)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,e=Math.imul(B,Z),n=(n=Math.imul(B,U))+Math.imul(N,Z)|0,o=Math.imul(N,U),e=e+Math.imul(k,D)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(T,D)|0,o=o+Math.imul(T,W)|0,e=e+Math.imul(_,G)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,Y)|0,e=e+Math.imul(y,X)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,K)|0,e=e+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,e=e+Math.imul(d,it)|0,n=(n=n+Math.imul(d,et)|0)+Math.imul(p,it)|0,o=o+Math.imul(p,et)|0;var xt=(a+(e=e+Math.imul(f,ot)|0)|0)+((8191&(n=(n=n+Math.imul(f,st)|0)+Math.imul(m,ot)|0))<<13)|0;a=((o=o+Math.imul(m,st)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,e=Math.imul(O,Z),n=(n=Math.imul(O,U))+Math.imul(R,Z)|0,o=Math.imul(R,U),e=e+Math.imul(B,D)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(N,D)|0,o=o+Math.imul(N,W)|0,e=e+Math.imul(k,G)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,Y)|0,e=e+Math.imul(_,X)|0,n=(n=n+Math.imul(_,K)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,K)|0,e=e+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,e=e+Math.imul(g,it)|0,n=(n=n+Math.imul(g,et)|0)+Math.imul(M,it)|0,o=o+Math.imul(M,et)|0,e=e+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var _t=(a+(e=e+Math.imul(f,ut)|0)|0)+((8191&(n=(n=n+Math.imul(f,at)|0)+Math.imul(m,ut)|0))<<13)|0;a=((o=o+Math.imul(m,at)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,e=Math.imul(P,Z),n=(n=Math.imul(P,U))+Math.imul(j,Z)|0,o=Math.imul(j,U),e=e+Math.imul(O,D)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(R,D)|0,o=o+Math.imul(R,W)|0,e=e+Math.imul(B,G)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,Y)|0,e=e+Math.imul(k,X)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(T,X)|0,o=o+Math.imul(T,K)|0,e=e+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,e=e+Math.imul(y,it)|0,n=(n=n+Math.imul(y,et)|0)+Math.imul(b,it)|0,o=o+Math.imul(b,et)|0,e=e+Math.imul(g,ot)|0,n=(n=n+Math.imul(g,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,e=e+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,at)|0;var At=(a+(e=e+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,mt)|0)+Math.imul(m,ft)|0))<<13)|0;a=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,e=Math.imul(H,Z),n=(n=Math.imul(H,U))+Math.imul(F,Z)|0,o=Math.imul(F,U),e=e+Math.imul(P,D)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(j,D)|0,o=o+Math.imul(j,W)|0,e=e+Math.imul(O,G)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,Y)|0,e=e+Math.imul(B,X)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,K)|0,e=e+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,e=e+Math.imul(_,it)|0,n=(n=n+Math.imul(_,et)|0)+Math.imul(A,it)|0,o=o+Math.imul(A,et)|0,e=e+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,e=e+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,at)|0,e=e+Math.imul(d,ft)|0,n=(n=n+Math.imul(d,mt)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,mt)|0;var St=(a+(e=e+Math.imul(f,dt)|0)|0)+((8191&(n=(n=n+Math.imul(f,pt)|0)+Math.imul(m,dt)|0))<<13)|0;a=((o=o+Math.imul(m,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,e=Math.imul(H,D),n=(n=Math.imul(H,W))+Math.imul(F,D)|0,o=Math.imul(F,W),e=e+Math.imul(P,G)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(j,G)|0,o=o+Math.imul(j,Y)|0,e=e+Math.imul(O,X)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,K)|0,e=e+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,e=e+Math.imul(k,it)|0,n=(n=n+Math.imul(k,et)|0)+Math.imul(T,it)|0,o=o+Math.imul(T,et)|0,e=e+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,e=e+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,at)|0,e=e+Math.imul(g,ft)|0,n=(n=n+Math.imul(g,mt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,mt)|0;var kt=(a+(e=e+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;a=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,e=Math.imul(H,G),n=(n=Math.imul(H,Y))+Math.imul(F,G)|0,o=Math.imul(F,Y),e=e+Math.imul(P,X)|0,n=(n=n+Math.imul(P,K)|0)+Math.imul(j,X)|0,o=o+Math.imul(j,K)|0,e=e+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,e=e+Math.imul(B,it)|0,n=(n=n+Math.imul(B,et)|0)+Math.imul(N,it)|0,o=o+Math.imul(N,et)|0,e=e+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,e=e+Math.imul(_,ut)|0,n=(n=n+Math.imul(_,at)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,at)|0,e=e+Math.imul(y,ft)|0,n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,mt)|0;var Tt=(a+(e=e+Math.imul(g,dt)|0)|0)+((8191&(n=(n=n+Math.imul(g,pt)|0)+Math.imul(M,dt)|0))<<13)|0;a=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,e=Math.imul(H,X),n=(n=Math.imul(H,K))+Math.imul(F,X)|0,o=Math.imul(F,K),e=e+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,e=e+Math.imul(O,it)|0,n=(n=n+Math.imul(O,et)|0)+Math.imul(R,it)|0,o=o+Math.imul(R,et)|0,e=e+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,e=e+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,at)|0,e=e+Math.imul(_,ft)|0,n=(n=n+Math.imul(_,mt)|0)+Math.imul(A,ft)|0,o=o+Math.imul(A,mt)|0;var Et=(a+(e=e+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(b,dt)|0))<<13)|0;a=((o=o+Math.imul(b,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,e=Math.imul(H,Q),n=(n=Math.imul(H,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),e=e+Math.imul(P,it)|0,n=(n=n+Math.imul(P,et)|0)+Math.imul(j,it)|0,o=o+Math.imul(j,et)|0,e=e+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,e=e+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,at)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,at)|0,e=e+Math.imul(k,ft)|0,n=(n=n+Math.imul(k,mt)|0)+Math.imul(T,ft)|0,o=o+Math.imul(T,mt)|0;var Bt=(a+(e=e+Math.imul(_,dt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(A,dt)|0))<<13)|0;a=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,e=Math.imul(H,it),n=(n=Math.imul(H,et))+Math.imul(F,it)|0,o=Math.imul(F,et),e=e+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,st)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,st)|0,e=e+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,at)|0,e=e+Math.imul(B,ft)|0,n=(n=n+Math.imul(B,mt)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,mt)|0;var Nt=(a+(e=e+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(T,dt)|0))<<13)|0;a=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,e=Math.imul(H,ot),n=(n=Math.imul(H,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),e=e+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(j,ut)|0,o=o+Math.imul(j,at)|0,e=e+Math.imul(O,ft)|0,n=(n=n+Math.imul(O,mt)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,mt)|0;var Ct=(a+(e=e+Math.imul(B,dt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul(N,dt)|0))<<13)|0;a=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,e=Math.imul(H,ut),n=(n=Math.imul(H,at))+Math.imul(F,ut)|0,o=Math.imul(F,at),e=e+Math.imul(P,ft)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(j,ft)|0,o=o+Math.imul(j,mt)|0;var Ot=(a+(e=e+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(R,dt)|0))<<13)|0;a=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,e=Math.imul(H,ft),n=(n=Math.imul(H,mt))+Math.imul(F,ft)|0,o=Math.imul(F,mt);var Rt=(a+(e=e+Math.imul(P,dt)|0)|0)+((8191&(n=(n=n+Math.imul(P,pt)|0)+Math.imul(j,dt)|0))<<13)|0;a=((o=o+Math.imul(j,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var It=(a+(e=Math.imul(H,dt))|0)+((8191&(n=(n=Math.imul(H,pt))+Math.imul(F,dt)|0))<<13)|0;return a=((o=Math.imul(F,pt))+(n>>>13)|0)+(It>>>26)|0,It&=67108863,u[0]=vt,u[1]=gt,u[2]=Mt,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=xt,u[7]=_t,u[8]=At,u[9]=St,u[10]=kt,u[11]=Tt,u[12]=Et,u[13]=Bt,u[14]=Nt,u[15]=Ct,u[16]=Ot,u[17]=Rt,u[18]=It,0!==a&&(u[19]=a,i.length++),i};function d(t,r,i){return(new p).mulp(t,r,i)}function p(t,r){this.x=t,this.y=r}Math.imul||(c=m),o.prototype.mulTo=function(t,r){var i=this.length+t.length;return 10===this.length&&10===t.length?c(this,t,r):i<63?m(this,t,r):i<1024?function(t,r,i){i.negative=r.negative^t.negative,i.length=t.length+r.length;for(var e=0,n=0,o=0;o<i.length-1;o++){var s=n;n=0;for(var h=67108863&e,u=Math.min(o,r.length-1),a=Math.max(0,o-t.length+1);a<=u;a++){var l=o-a,f=(0|t.words[l])*(0|r.words[a]),m=67108863&f;h=67108863&(m=m+h|0),n+=(s=(s=s+(f/67108864|0)|0)+(m>>>26)|0)>>>26,s&=67108863}i.words[o]=h,e=s,s=n}return 0!==e?i.words[o]=e:i.length--,i.strip()}(this,t,r):d(this,t,r)},p.prototype.makeRBT=function(t){for(var r=new Array(t),i=o.prototype._countBits(t)-1,e=0;e<t;e++)r[e]=this.revBin(e,i,t);return r},p.prototype.revBin=function(t,r,i){if(0===t||t===i-1)return t;for(var e=0,n=0;n<r;n++)e|=(1&t)<<r-n-1,t>>=1;return e},p.prototype.permute=function(t,r,i,e,n,o){for(var s=0;s<o;s++)e[s]=r[t[s]],n[s]=i[t[s]]},p.prototype.transform=function(t,r,i,e,n,o){this.permute(o,t,r,i,e,n);for(var s=1;s<n;s<<=1)for(var h=s<<1,u=Math.cos(2*Math.PI/h),a=Math.sin(2*Math.PI/h),l=0;l<n;l+=h)for(var f=u,m=a,c=0;c<s;c++){var d=i[l+c],p=e[l+c],v=i[l+c+s],g=e[l+c+s],M=f*v-m*g;g=f*g+m*v,v=M,i[l+c]=d+v,e[l+c]=p+g,i[l+c+s]=d-v,e[l+c+s]=p-g,c!==h&&(M=u*f-a*m,m=u*m+a*f,f=M)}},p.prototype.guessLen13b=function(t,r){var i=1|Math.max(r,t),e=1&i,n=0;for(i=i/2|0;i;i>>>=1)n++;return 1<<n+1+e},p.prototype.conjugate=function(t,r,i){if(!(i<=1))for(var e=0;e<i/2;e++){var n=t[e];t[e]=t[i-e-1],t[i-e-1]=n,n=r[e],r[e]=-r[i-e-1],r[i-e-1]=-n}},p.prototype.normalize13b=function(t,r){for(var i=0,e=0;e<r/2;e++){var n=8192*Math.round(t[2*e+1]/r)+Math.round(t[2*e]/r)+i;t[e]=67108863&n,i=n<67108864?0:n/67108864|0}return t},p.prototype.convert13b=function(t,r,i,n){for(var o=0,s=0;s<r;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*r;s<n;++s)i[s]=0;e(0===o),e(0==(-8192&o))},p.prototype.stub=function(t){for(var r=new Array(t),i=0;i<t;i++)r[i]=0;return r},p.prototype.mulp=function(t,r,i){var e=2*this.guessLen13b(t.length,r.length),n=this.makeRBT(e),o=this.stub(e),s=new Array(e),h=new Array(e),u=new Array(e),a=new Array(e),l=new Array(e),f=new Array(e),m=i.words;m.length=e,this.convert13b(t.words,t.length,s,e),this.convert13b(r.words,r.length,a,e),this.transform(s,o,h,u,e,n),this.transform(a,o,l,f,e,n);for(var c=0;c<e;c++){var d=h[c]*l[c]-u[c]*f[c];u[c]=h[c]*f[c]+u[c]*l[c],h[c]=d}return this.conjugate(h,u,e),this.transform(h,u,m,o,e,n),this.conjugate(m,o,e),this.normalize13b(m,e),i.negative=t.negative^r.negative,i.length=t.length+r.length,i.strip()},o.prototype.mul=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),this.mulTo(t,r)},o.prototype.mulf=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),d(this,t,r)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){e("number"==typeof t),e(t<67108864);for(var r=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&r);r>>=26,r+=n/67108864|0,r+=o>>>26,this.words[i]=67108863&o}return 0!==r&&(this.words[i]=r,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var r=function(t){for(var r=new Array(t.bitLength()),i=0;i<r.length;i++){var e=i/26|0,n=i%26;r[i]=(t.words[e]&1<<n)>>>n}return r}(t);if(0===r.length)return new o(1);for(var i=this,e=0;e<r.length&&0===r[e];e++,i=i.sqr());if(++e<r.length)for(var n=i.sqr();e<r.length;e++,n=n.sqr())0!==r[e]&&(i=i.mul(n));return i},o.prototype.iushln=function(t){e("number"==typeof t&&t>=0);var r,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(r=0;r<this.length;r++){var h=this.words[r]&o,u=(0|this.words[r])-h<<i;this.words[r]=u|s,s=h>>>26-i}s&&(this.words[r]=s,this.length++)}if(0!==n){for(r=this.length-1;r>=0;r--)this.words[r+n]=this.words[r];for(r=0;r<n;r++)this.words[r]=0;this.length+=n}return this.strip()},o.prototype.ishln=function(t){return e(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,r,i){var n;e("number"==typeof t&&t>=0),n=r?(r-r%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),h=67108863^67108863>>>o<<o,u=i;if(n-=s,n=Math.max(0,n),u){for(var a=0;a<s;a++)u.words[a]=this.words[a];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,a=0;a<this.length;a++)this.words[a]=this.words[a+s];else this.words[0]=0,this.length=1;var l=0;for(a=this.length-1;a>=0&&(0!==l||a>=n);a--){var f=0|this.words[a];this.words[a]=l<<26-o|f>>>o,l=f&h}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,r,i){return e(0===this.negative),this.iushrn(t,r,i)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){e("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,n=1<<r;return!(this.length<=i)&&!!(this.words[i]&n)},o.prototype.imaskn=function(t){e("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26;if(e(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==r&&i++,this.length=Math.min(i,this.length),0!==r){var n=67108863^67108863>>>r<<r;this.words[this.length-1]&=n}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return e("number"==typeof t),e(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var r=0;r<this.length&&this.words[r]>=67108864;r++)this.words[r]-=67108864,r===this.length-1?this.words[r+1]=1:this.words[r+1]++;return this.length=Math.max(this.length,r+1),this},o.prototype.isubn=function(t){if(e("number"==typeof t),e(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var r=0;r<this.length&&this.words[r]<0;r++)this.words[r]+=67108864,this.words[r+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,r,i){var n,o,s=t.length+i;this._expand(s);var h=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+h;var u=(0|t.words[n])*r;h=((o-=67108863&u)>>26)-(u/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)h=(o=(0|this.words[n+i])+h)>>26,this.words[n+i]=67108863&o;if(0===h)return this.strip();for(e(-1===h),h=0,n=0;n<this.length;n++)h=(o=-(0|this.words[n])+h)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,r){var i=(this.length,t.length),e=this.clone(),n=t,s=0|n.words[n.length-1];0!==(i=26-this._countBits(s))&&(n=n.ushln(i),e.iushln(i),s=0|n.words[n.length-1]);var h,u=e.length-n.length;if("mod"!==r){(h=new o(null)).length=u+1,h.words=new Array(h.length);for(var a=0;a<h.length;a++)h.words[a]=0}var l=e.clone()._ishlnsubmul(n,1,u);0===l.negative&&(e=l,h&&(h.words[u]=1));for(var f=u-1;f>=0;f--){var m=67108864*(0|e.words[n.length+f])+(0|e.words[n.length+f-1]);for(m=Math.min(m/s|0,67108863),e._ishlnsubmul(n,m,f);0!==e.negative;)m--,e.negative=0,e._ishlnsubmul(n,1,f),e.isZero()||(e.negative^=1);h&&(h.words[f]=m)}return h&&h.strip(),e.strip(),"div"!==r&&0!==i&&e.iushrn(i),{div:h||null,mod:e}},o.prototype.divmod=function(t,r,i){return e(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(h=this.neg().divmod(t,r),"mod"!==r&&(n=h.div.neg()),"div"!==r&&(s=h.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(h=this.divmod(t.neg(),r),"mod"!==r&&(n=h.div.neg()),{div:n,mod:h.mod}):0!=(this.negative&t.negative)?(h=this.neg().divmod(t.neg(),r),"div"!==r&&(s=h.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:h.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===r?{div:this.divn(t.words[0]),mod:null}:"mod"===r?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,r);var n,s,h},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var r=this.divmod(t);if(r.mod.isZero())return r.div;var i=0!==r.div.negative?r.mod.isub(t):r.mod,e=t.ushrn(1),n=t.andln(1),o=i.cmp(e);return o<0||1===n&&0===o?r.div:0!==r.div.negative?r.div.isubn(1):r.div.iaddn(1)},o.prototype.modn=function(t){e(t<=67108863);for(var r=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(r*i+(0|this.words[n]))%t;return i},o.prototype.idivn=function(t){e(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*r;this.words[i]=n/t|0,r=n%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){e(0===t.negative),e(!t.isZero());var r=this,i=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var n=new o(1),s=new o(0),h=new o(0),u=new o(1),a=0;r.isEven()&&i.isEven();)r.iushrn(1),i.iushrn(1),++a;for(var l=i.clone(),f=r.clone();!r.isZero();){for(var m=0,c=1;0==(r.words[0]&c)&&m<26;++m,c<<=1);if(m>0)for(r.iushrn(m);m-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(l),s.isub(f)),n.iushrn(1),s.iushrn(1);for(var d=0,p=1;0==(i.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(i.iushrn(d);d-- >0;)(h.isOdd()||u.isOdd())&&(h.iadd(l),u.isub(f)),h.iushrn(1),u.iushrn(1);r.cmp(i)>=0?(r.isub(i),n.isub(h),s.isub(u)):(i.isub(r),h.isub(n),u.isub(s))}return{a:h,b:u,gcd:i.iushln(a)}},o.prototype._invmp=function(t){e(0===t.negative),e(!t.isZero());var r=this,i=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var n,s=new o(1),h=new o(0),u=i.clone();r.cmpn(1)>0&&i.cmpn(1)>0;){for(var a=0,l=1;0==(r.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(r.iushrn(a);a-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,m=1;0==(i.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(i.iushrn(f);f-- >0;)h.isOdd()&&h.iadd(u),h.iushrn(1);r.cmp(i)>=0?(r.isub(i),s.isub(h)):(i.isub(r),h.isub(s))}return(n=0===r.cmpn(1)?s:h).cmpn(0)<0&&n.iadd(t),n},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var r=this.clone(),i=t.clone();r.negative=0,i.negative=0;for(var e=0;r.isEven()&&i.isEven();e++)r.iushrn(1),i.iushrn(1);for(;;){for(;r.isEven();)r.iushrn(1);for(;i.isEven();)i.iushrn(1);var n=r.cmp(i);if(n<0){var o=r;r=i,i=o}else if(0===n||0===i.cmpn(1))break;r.isub(i)}return i.iushln(e)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){e("number"==typeof t);var r=t%26,i=(t-r)/26,n=1<<r;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var h=0|this.words[s];o=(h+=o)>>>26,h&=67108863,this.words[s]=h}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var r,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)r=1;else{i&&(t=-t),e(t<=67108863,"Number is too big");var n=0|this.words[0];r=n===t?0:n<t?-1:1}return 0!==this.negative?0|-r:r},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var r=this.ucmp(t);return 0!==this.negative?0|-r:r},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var r=0,i=this.length-1;i>=0;i--){var e=0|this.words[i],n=0|t.words[i];if(e!==n){e<n?r=-1:e>n&&(r=1);break}}return r},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new x(t)},o.prototype.toRed=function(t){return e(!this.red,"Already a number in reduction context"),e(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return e(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return e(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function g(t,r){this.name=t,this.p=new o(r,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function y(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function x(t){if("string"==typeof t){var r=o._prime(t);this.m=r.p,this.prime=r}else e(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){x.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var r,i=t;do{this.split(i,this.tmp),r=(i=(i=this.imulK(i)).iadd(this.tmp)).bitLength()}while(r>this.n);var e=r<this.n?-1:i.ucmp(this.p);return 0===e?(i.words[0]=0,i.length=1):e>0?i.isub(this.p):i.strip(),i},g.prototype.split=function(t,r){t.iushrn(this.n,0,r)},g.prototype.imulK=function(t){return t.imul(this.k)},n(M,g),M.prototype.split=function(t,r){for(var i=Math.min(t.length,9),e=0;e<i;e++)r.words[e]=t.words[e];if(r.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(r.words[r.length++]=4194303&n,e=10;e<t.length;e++){var o=0|t.words[e];t.words[e-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,t.words[e-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var r=0,i=0;i<t.length;i++){var e=0|t.words[i];r+=977*e,t.words[i]=67108863&r,r=64*e+(r/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(w,g),n(y,g),n(b,g),b.prototype.imulK=function(t){for(var r=0,i=0;i<t.length;i++){var e=19*(0|t.words[i])+r,n=67108863&e;e>>>=26,t.words[i]=n,r=e}return 0!==r&&(t.words[t.length++]=r),t},o._prime=function(t){if(v[t])return v[t];var r;if("k256"===t)r=new M;else if("p224"===t)r=new w;else if("p192"===t)r=new y;else{if("p25519"!==t)throw new Error("Unknown prime "+t);r=new b}return v[t]=r,r},x.prototype._verify1=function(t){e(0===t.negative,"red works only with positives"),e(t.red,"red works only with red numbers")},x.prototype._verify2=function(t,r){e(0==(t.negative|r.negative),"red works only with positives"),e(t.red&&t.red===r.red,"red works only with red numbers")},x.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},x.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},x.prototype.add=function(t,r){this._verify2(t,r);var i=t.add(r);return i.cmp(this.m)>=0&&i.isub(this.m),i._forceRed(this)},x.prototype.iadd=function(t,r){this._verify2(t,r);var i=t.iadd(r);return i.cmp(this.m)>=0&&i.isub(this.m),i},x.prototype.sub=function(t,r){this._verify2(t,r);var i=t.sub(r);return i.cmpn(0)<0&&i.iadd(this.m),i._forceRed(this)},x.prototype.isub=function(t,r){this._verify2(t,r);var i=t.isub(r);return i.cmpn(0)<0&&i.iadd(this.m),i},x.prototype.shl=function(t,r){return this._verify1(t),this.imod(t.ushln(r))},x.prototype.imul=function(t,r){return this._verify2(t,r),this.imod(t.imul(r))},x.prototype.mul=function(t,r){return this._verify2(t,r),this.imod(t.mul(r))},x.prototype.isqr=function(t){return this.imul(t,t.clone())},x.prototype.sqr=function(t){return this.mul(t,t)},x.prototype.sqrt=function(t){if(t.isZero())return t.clone();var r=this.m.andln(3);if(e(r%2==1),3===r){var i=this.m.add(new o(1)).iushrn(2);return this.pow(t,i)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);e(!n.isZero());var h=new o(1).toRed(this),u=h.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,n),m=this.pow(t,n.addn(1).iushrn(1)),c=this.pow(t,n),d=s;0!==c.cmp(h);){for(var p=c,v=0;0!==p.cmp(h);v++)p=p.redSqr();e(v<d);var g=this.pow(f,new o(1).iushln(d-v-1));m=m.redMul(g),f=g.redSqr(),c=c.redMul(f),d=v}return m},x.prototype.invm=function(t){var r=t._invmp(this.m);return 0!==r.negative?(r.negative=0,this.imod(r).redNeg()):this.imod(r)},x.prototype.pow=function(t,r){if(r.isZero())return new o(1);if(0===r.cmpn(1))return t.clone();var i=new Array(16);i[0]=new o(1).toRed(this),i[1]=t;for(var e=2;e<i.length;e++)i[e]=this.mul(i[e-1],t);var n=i[0],s=0,h=0,u=r.bitLength()%26;for(0===u&&(u=26),e=r.length-1;e>=0;e--){for(var a=r.words[e],l=u-1;l>=0;l--){var f=a>>l&1;n!==i[0]&&(n=this.sqr(n)),0!==f||0!==s?(s<<=1,s|=f,(4===++h||0===e&&0===l)&&(n=this.mul(n,i[s]),h=0,s=0)):h=0}u=26}return n},x.prototype.convertTo=function(t){var r=t.umod(this.m);return r===t?r.clone():r},x.prototype.convertFrom=function(t){var r=t.clone();return r.red=null,r},o.mont=function(t){return new _(t)},n(_,x),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var r=this.imod(t.mul(this.rinv));return r.red=null,r},_.prototype.imul=function(t,r){if(t.isZero()||r.isZero())return t.words[0]=0,t.length=1,t;var i=t.imul(r),e=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(e).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},_.prototype.mul=function(t,r){if(t.isZero()||r.isZero())return new o(0)._forceRed(this);var i=t.mul(r),e=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(e).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,i(2)(t))},function(t,r,i){(function(t){!function(t,r){"use strict";function e(t,r){if(!t)throw new Error(r||"Assertion failed")}function n(t,r){t.super_=r;var i=function(){};i.prototype=r.prototype,t.prototype=new i,t.prototype.constructor=t}function o(t,r,i){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==r&&"be"!==r||(i=r,r=10),this._init(t||0,r||10,i||"be"))}var s;"object"==typeof t?t.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{s=i(3).Buffer}catch(t){}function h(t,r,i){for(var e=0,n=Math.min(t.length,i),o=r;o<n;o++){var s=t.charCodeAt(o)-48;e<<=4,e|=s>=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return e}function u(t,r,i,e){for(var n=0,o=Math.min(t.length,i),s=r;s<o;s++){var h=t.charCodeAt(s)-48;n*=e,n+=h>=49?h-49+10:h>=17?h-17+10:h}return n}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,r){return t.cmp(r)>0?t:r},o.min=function(t,r){return t.cmp(r)<0?t:r},o.prototype._init=function(t,r,i){if("number"==typeof t)return this._initNumber(t,r,i);if("object"==typeof t)return this._initArray(t,r,i);"hex"===r&&(r=16),e(r===(0|r)&&r>=2&&r<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===r?this._parseHex(t,n):this._parseBase(t,r,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===i&&this._initArray(this.toArray(),r,i)},o.prototype._initNumber=function(t,r,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(e(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),r,i)},o.prototype._initArray=function(t,r,i){if(e("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,h=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);return this.strip()},o.prototype._parseHex=function(t,r){this.length=Math.ceil((t.length-r)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var e,n,o=0;for(i=t.length-6,e=0;i>=r;i-=6)n=h(t,i,i+6),this.words[e]|=n<<o&67108863,this.words[e+1]|=n>>>26-o&4194303,(o+=24)>=26&&(o-=26,e++);i+6!==r&&(n=h(t,r,i+6),this.words[e]|=n<<o&67108863,this.words[e+1]|=n>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,r,i){this.words=[0],this.length=1;for(var e=0,n=1;n<=67108863;n*=r)e++;e--,n=n/r|0;for(var o=t.length-i,s=o%e,h=Math.min(o,o-s)+i,a=0,l=i;l<h;l+=e)a=u(t,l,l+e,r),this.imuln(n),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(0!==s){var f=1;for(a=u(t,l,t.length,r),l=0;l<s;l++)f*=r;this.imuln(f),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}},o.prototype.copy=function(t){t.words=new Array(this.length);for(var r=0;r<this.length;r++)t.words[r]=this.words[r];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],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];function m(t,r,i){i.negative=r.negative^t.negative;var e=t.length+r.length|0;i.length=e,e=e-1|0;var n=0|t.words[0],o=0|r.words[0],s=n*o,h=67108863&s,u=s/67108864|0;i.words[0]=h;for(var a=1;a<e;a++){for(var l=u>>>26,f=67108863&u,m=Math.min(a,r.length-1),c=Math.max(0,a-t.length+1);c<=m;c++){var d=a-c|0;l+=(s=(n=0|t.words[d])*(o=0|r.words[c])+f)/67108864|0,f=67108863&s}i.words[a]=0|f,u=0|l}return 0!==u?i.words[a]=0|u:i.length--,i.strip()}o.prototype.toString=function(t,r){var i;if(r=0|r||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var h=this.words[s],u=(16777215&(h<<n|o)).toString(16);i=0!==(o=h>>>24-n&16777215)||s!==this.length-1?a[6-u.length]+u+i:u+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%r!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var m=l[t],c=f[t];i="";var d=this.clone();for(d.negative=0;!d.isZero();){var p=d.modn(c).toString(t);i=(d=d.idivn(c)).isZero()?p+i:a[m-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%r!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}e(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,r){return e(void 0!==s),this.toArrayLike(s,t,r)},o.prototype.toArray=function(t,r){return this.toArrayLike(Array,t,r)},o.prototype.toArrayLike=function(t,r,i){var n=this.byteLength(),o=i||Math.max(1,n);e(n<=o,"byte array longer than desired length"),e(o>0,"Requested array length <= 0"),this.strip();var s,h,u="le"===r,a=new t(o),l=this.clone();if(u){for(h=0;!l.isZero();h++)s=l.andln(255),l.iushrn(8),a[h]=s;for(;h<o;h++)a[h]=0}else{for(h=0;h<o-n;h++)a[h]=0;for(h=0;!l.isZero();h++)s=l.andln(255),l.iushrn(8),a[o-h-1]=s}return a},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var r=t,i=0;return r>=4096&&(i+=13,r>>>=13),r>=64&&(i+=7,r>>>=7),r>=8&&(i+=4,r>>>=4),r>=2&&(i+=2,r>>>=2),i+r},o.prototype._zeroBits=function(t){if(0===t)return 26;var r=t,i=0;return 0==(8191&r)&&(i+=13,r>>>=13),0==(127&r)&&(i+=7,r>>>=7),0==(15&r)&&(i+=4,r>>>=4),0==(3&r)&&(i+=2,r>>>=2),0==(1&r)&&i++,i},o.prototype.bitLength=function(){var t=this.words[this.length-1],r=this._countBits(t);return 26*(this.length-1)+r},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,r=0;r<this.length;r++){var i=this._zeroBits(this.words[r]);if(t+=i,26!==i)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]|t.words[r];return this.strip()},o.prototype.ior=function(t){return e(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var r;r=this.length>t.length?t:this;for(var i=0;i<r.length;i++)this.words[i]=this.words[i]&t.words[i];return this.length=r.length,this.strip()},o.prototype.iand=function(t){return e(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var r,i;this.length>t.length?(r=this,i=t):(r=t,i=this);for(var e=0;e<i.length;e++)this.words[e]=r.words[e]^i.words[e];if(this!==r)for(;e<r.length;e++)this.words[e]=r.words[e];return this.length=r.length,this.strip()},o.prototype.ixor=function(t){return e(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){e("number"==typeof t&&t>=0);var r=0|Math.ceil(t/26),i=t%26;this._expand(r),i>0&&r--;for(var n=0;n<r;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,r){e("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=r?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},o.prototype.iadd=function(t){var r,i,e;if(0!==this.negative&&0===t.negative)return this.negative=0,r=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,r=this.isub(t),t.negative=1,r._normSign();this.length>t.length?(i=this,e=t):(i=t,e=this);for(var n=0,o=0;o<e.length;o++)r=(0|i.words[o])+(0|e.words[o])+n,this.words[o]=67108863&r,n=r>>>26;for(;0!==n&&o<i.length;o++)r=(0|i.words[o])+n,this.words[o]=67108863&r,n=r>>>26;if(this.length=i.length,0!==n)this.words[this.length]=n,this.length++;else if(i!==this)for(;o<i.length;o++)this.words[o]=i.words[o];return this},o.prototype.add=function(t){var r;return 0!==t.negative&&0===this.negative?(t.negative=0,r=this.sub(t),t.negative^=1,r):0===t.negative&&0!==this.negative?(this.negative=0,r=t.sub(this),this.negative=1,r):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var r=this.iadd(t);return t.negative=1,r._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var i,e,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(i=this,e=t):(i=t,e=this);for(var o=0,s=0;s<e.length;s++)o=(r=(0|i.words[s])-(0|e.words[s])+o)>>26,this.words[s]=67108863&r;for(;0!==o&&s<i.length;s++)o=(r=(0|i.words[s])+o)>>26,this.words[s]=67108863&r;if(0===o&&s<i.length&&i!==this)for(;s<i.length;s++)this.words[s]=i.words[s];return this.length=Math.max(this.length,s),i!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var c=function(t,r,i){var e,n,o,s=t.words,h=r.words,u=i.words,a=0,l=0|s[0],f=8191&l,m=l>>>13,c=0|s[1],d=8191&c,p=c>>>13,v=0|s[2],g=8191&v,M=v>>>13,w=0|s[3],y=8191&w,b=w>>>13,x=0|s[4],_=8191&x,A=x>>>13,S=0|s[5],k=8191&S,T=S>>>13,E=0|s[6],B=8191&E,N=E>>>13,C=0|s[7],O=8191&C,R=C>>>13,I=0|s[8],P=8191&I,j=I>>>13,L=0|s[9],H=8191&L,F=L>>>13,q=0|h[0],Z=8191&q,U=q>>>13,z=0|h[1],D=8191&z,W=z>>>13,$=0|h[2],G=8191&$,Y=$>>>13,J=0|h[3],X=8191&J,K=J>>>13,V=0|h[4],Q=8191&V,tt=V>>>13,rt=0|h[5],it=8191&rt,et=rt>>>13,nt=0|h[6],ot=8191&nt,st=nt>>>13,ht=0|h[7],ut=8191&ht,at=ht>>>13,lt=0|h[8],ft=8191&lt,mt=lt>>>13,ct=0|h[9],dt=8191&ct,pt=ct>>>13;i.negative=t.negative^r.negative,i.length=19;var vt=(a+(e=Math.imul(f,Z))|0)+((8191&(n=(n=Math.imul(f,U))+Math.imul(m,Z)|0))<<13)|0;a=((o=Math.imul(m,U))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,e=Math.imul(d,Z),n=(n=Math.imul(d,U))+Math.imul(p,Z)|0,o=Math.imul(p,U);var gt=(a+(e=e+Math.imul(f,D)|0)|0)+((8191&(n=(n=n+Math.imul(f,W)|0)+Math.imul(m,D)|0))<<13)|0;a=((o=o+Math.imul(m,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,e=Math.imul(g,Z),n=(n=Math.imul(g,U))+Math.imul(M,Z)|0,o=Math.imul(M,U),e=e+Math.imul(d,D)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,D)|0,o=o+Math.imul(p,W)|0;var Mt=(a+(e=e+Math.imul(f,G)|0)|0)+((8191&(n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,G)|0))<<13)|0;a=((o=o+Math.imul(m,Y)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,e=Math.imul(y,Z),n=(n=Math.imul(y,U))+Math.imul(b,Z)|0,o=Math.imul(b,U),e=e+Math.imul(g,D)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(M,D)|0,o=o+Math.imul(M,W)|0,e=e+Math.imul(d,G)|0,n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,Y)|0;var wt=(a+(e=e+Math.imul(f,X)|0)|0)+((8191&(n=(n=n+Math.imul(f,K)|0)+Math.imul(m,X)|0))<<13)|0;a=((o=o+Math.imul(m,K)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,e=Math.imul(_,Z),n=(n=Math.imul(_,U))+Math.imul(A,Z)|0,o=Math.imul(A,U),e=e+Math.imul(y,D)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,D)|0,o=o+Math.imul(b,W)|0,e=e+Math.imul(g,G)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,Y)|0,e=e+Math.imul(d,X)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,K)|0;var yt=(a+(e=e+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(m,Q)|0))<<13)|0;a=((o=o+Math.imul(m,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,e=Math.imul(k,Z),n=(n=Math.imul(k,U))+Math.imul(T,Z)|0,o=Math.imul(T,U),e=e+Math.imul(_,D)|0,n=(n=n+Math.imul(_,W)|0)+Math.imul(A,D)|0,o=o+Math.imul(A,W)|0,e=e+Math.imul(y,G)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,Y)|0,e=e+Math.imul(g,X)|0,n=(n=n+Math.imul(g,K)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,K)|0,e=e+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var bt=(a+(e=e+Math.imul(f,it)|0)|0)+((8191&(n=(n=n+Math.imul(f,et)|0)+Math.imul(m,it)|0))<<13)|0;a=((o=o+Math.imul(m,et)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,e=Math.imul(B,Z),n=(n=Math.imul(B,U))+Math.imul(N,Z)|0,o=Math.imul(N,U),e=e+Math.imul(k,D)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(T,D)|0,o=o+Math.imul(T,W)|0,e=e+Math.imul(_,G)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,Y)|0,e=e+Math.imul(y,X)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,K)|0,e=e+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,e=e+Math.imul(d,it)|0,n=(n=n+Math.imul(d,et)|0)+Math.imul(p,it)|0,o=o+Math.imul(p,et)|0;var xt=(a+(e=e+Math.imul(f,ot)|0)|0)+((8191&(n=(n=n+Math.imul(f,st)|0)+Math.imul(m,ot)|0))<<13)|0;a=((o=o+Math.imul(m,st)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,e=Math.imul(O,Z),n=(n=Math.imul(O,U))+Math.imul(R,Z)|0,o=Math.imul(R,U),e=e+Math.imul(B,D)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul(N,D)|0,o=o+Math.imul(N,W)|0,e=e+Math.imul(k,G)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,Y)|0,e=e+Math.imul(_,X)|0,n=(n=n+Math.imul(_,K)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,K)|0,e=e+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,e=e+Math.imul(g,it)|0,n=(n=n+Math.imul(g,et)|0)+Math.imul(M,it)|0,o=o+Math.imul(M,et)|0,e=e+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var _t=(a+(e=e+Math.imul(f,ut)|0)|0)+((8191&(n=(n=n+Math.imul(f,at)|0)+Math.imul(m,ut)|0))<<13)|0;a=((o=o+Math.imul(m,at)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,e=Math.imul(P,Z),n=(n=Math.imul(P,U))+Math.imul(j,Z)|0,o=Math.imul(j,U),e=e+Math.imul(O,D)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(R,D)|0,o=o+Math.imul(R,W)|0,e=e+Math.imul(B,G)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,Y)|0,e=e+Math.imul(k,X)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(T,X)|0,o=o+Math.imul(T,K)|0,e=e+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,e=e+Math.imul(y,it)|0,n=(n=n+Math.imul(y,et)|0)+Math.imul(b,it)|0,o=o+Math.imul(b,et)|0,e=e+Math.imul(g,ot)|0,n=(n=n+Math.imul(g,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,e=e+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,at)|0;var At=(a+(e=e+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,mt)|0)+Math.imul(m,ft)|0))<<13)|0;a=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,e=Math.imul(H,Z),n=(n=Math.imul(H,U))+Math.imul(F,Z)|0,o=Math.imul(F,U),e=e+Math.imul(P,D)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(j,D)|0,o=o+Math.imul(j,W)|0,e=e+Math.imul(O,G)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,Y)|0,e=e+Math.imul(B,X)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,K)|0,e=e+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,e=e+Math.imul(_,it)|0,n=(n=n+Math.imul(_,et)|0)+Math.imul(A,it)|0,o=o+Math.imul(A,et)|0,e=e+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,e=e+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,at)|0,e=e+Math.imul(d,ft)|0,n=(n=n+Math.imul(d,mt)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,mt)|0;var St=(a+(e=e+Math.imul(f,dt)|0)|0)+((8191&(n=(n=n+Math.imul(f,pt)|0)+Math.imul(m,dt)|0))<<13)|0;a=((o=o+Math.imul(m,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,e=Math.imul(H,D),n=(n=Math.imul(H,W))+Math.imul(F,D)|0,o=Math.imul(F,W),e=e+Math.imul(P,G)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(j,G)|0,o=o+Math.imul(j,Y)|0,e=e+Math.imul(O,X)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,K)|0,e=e+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,e=e+Math.imul(k,it)|0,n=(n=n+Math.imul(k,et)|0)+Math.imul(T,it)|0,o=o+Math.imul(T,et)|0,e=e+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,e=e+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,at)|0,e=e+Math.imul(g,ft)|0,n=(n=n+Math.imul(g,mt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,mt)|0;var kt=(a+(e=e+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;a=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,e=Math.imul(H,G),n=(n=Math.imul(H,Y))+Math.imul(F,G)|0,o=Math.imul(F,Y),e=e+Math.imul(P,X)|0,n=(n=n+Math.imul(P,K)|0)+Math.imul(j,X)|0,o=o+Math.imul(j,K)|0,e=e+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,e=e+Math.imul(B,it)|0,n=(n=n+Math.imul(B,et)|0)+Math.imul(N,it)|0,o=o+Math.imul(N,et)|0,e=e+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,e=e+Math.imul(_,ut)|0,n=(n=n+Math.imul(_,at)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,at)|0,e=e+Math.imul(y,ft)|0,n=(n=n+Math.imul(y,mt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,mt)|0;var Tt=(a+(e=e+Math.imul(g,dt)|0)|0)+((8191&(n=(n=n+Math.imul(g,pt)|0)+Math.imul(M,dt)|0))<<13)|0;a=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,e=Math.imul(H,X),n=(n=Math.imul(H,K))+Math.imul(F,X)|0,o=Math.imul(F,K),e=e+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,e=e+Math.imul(O,it)|0,n=(n=n+Math.imul(O,et)|0)+Math.imul(R,it)|0,o=o+Math.imul(R,et)|0,e=e+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,e=e+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,at)|0,e=e+Math.imul(_,ft)|0,n=(n=n+Math.imul(_,mt)|0)+Math.imul(A,ft)|0,o=o+Math.imul(A,mt)|0;var Et=(a+(e=e+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(b,dt)|0))<<13)|0;a=((o=o+Math.imul(b,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,e=Math.imul(H,Q),n=(n=Math.imul(H,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),e=e+Math.imul(P,it)|0,n=(n=n+Math.imul(P,et)|0)+Math.imul(j,it)|0,o=o+Math.imul(j,et)|0,e=e+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,e=e+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,at)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,at)|0,e=e+Math.imul(k,ft)|0,n=(n=n+Math.imul(k,mt)|0)+Math.imul(T,ft)|0,o=o+Math.imul(T,mt)|0;var Bt=(a+(e=e+Math.imul(_,dt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(A,dt)|0))<<13)|0;a=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,e=Math.imul(H,it),n=(n=Math.imul(H,et))+Math.imul(F,it)|0,o=Math.imul(F,et),e=e+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,st)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,st)|0,e=e+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,at)|0,e=e+Math.imul(B,ft)|0,n=(n=n+Math.imul(B,mt)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,mt)|0;var Nt=(a+(e=e+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(T,dt)|0))<<13)|0;a=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,e=Math.imul(H,ot),n=(n=Math.imul(H,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),e=e+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(j,ut)|0,o=o+Math.imul(j,at)|0,e=e+Math.imul(O,ft)|0,n=(n=n+Math.imul(O,mt)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,mt)|0;var Ct=(a+(e=e+Math.imul(B,dt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul(N,dt)|0))<<13)|0;a=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,e=Math.imul(H,ut),n=(n=Math.imul(H,at))+Math.imul(F,ut)|0,o=Math.imul(F,at),e=e+Math.imul(P,ft)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(j,ft)|0,o=o+Math.imul(j,mt)|0;var Ot=(a+(e=e+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(R,dt)|0))<<13)|0;a=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,e=Math.imul(H,ft),n=(n=Math.imul(H,mt))+Math.imul(F,ft)|0,o=Math.imul(F,mt);var Rt=(a+(e=e+Math.imul(P,dt)|0)|0)+((8191&(n=(n=n+Math.imul(P,pt)|0)+Math.imul(j,dt)|0))<<13)|0;a=((o=o+Math.imul(j,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var It=(a+(e=Math.imul(H,dt))|0)+((8191&(n=(n=Math.imul(H,pt))+Math.imul(F,dt)|0))<<13)|0;return a=((o=Math.imul(F,pt))+(n>>>13)|0)+(It>>>26)|0,It&=67108863,u[0]=vt,u[1]=gt,u[2]=Mt,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=xt,u[7]=_t,u[8]=At,u[9]=St,u[10]=kt,u[11]=Tt,u[12]=Et,u[13]=Bt,u[14]=Nt,u[15]=Ct,u[16]=Ot,u[17]=Rt,u[18]=It,0!==a&&(u[19]=a,i.length++),i};function d(t,r,i){return(new p).mulp(t,r,i)}function p(t,r){this.x=t,this.y=r}Math.imul||(c=m),o.prototype.mulTo=function(t,r){var i=this.length+t.length;return 10===this.length&&10===t.length?c(this,t,r):i<63?m(this,t,r):i<1024?function(t,r,i){i.negative=r.negative^t.negative,i.length=t.length+r.length;for(var e=0,n=0,o=0;o<i.length-1;o++){var s=n;n=0;for(var h=67108863&e,u=Math.min(o,r.length-1),a=Math.max(0,o-t.length+1);a<=u;a++){var l=o-a,f=(0|t.words[l])*(0|r.words[a]),m=67108863&f;h=67108863&(m=m+h|0),n+=(s=(s=s+(f/67108864|0)|0)+(m>>>26)|0)>>>26,s&=67108863}i.words[o]=h,e=s,s=n}return 0!==e?i.words[o]=e:i.length--,i.strip()}(this,t,r):d(this,t,r)},p.prototype.makeRBT=function(t){for(var r=new Array(t),i=o.prototype._countBits(t)-1,e=0;e<t;e++)r[e]=this.revBin(e,i,t);return r},p.prototype.revBin=function(t,r,i){if(0===t||t===i-1)return t;for(var e=0,n=0;n<r;n++)e|=(1&t)<<r-n-1,t>>=1;return e},p.prototype.permute=function(t,r,i,e,n,o){for(var s=0;s<o;s++)e[s]=r[t[s]],n[s]=i[t[s]]},p.prototype.transform=function(t,r,i,e,n,o){this.permute(o,t,r,i,e,n);for(var s=1;s<n;s<<=1)for(var h=s<<1,u=Math.cos(2*Math.PI/h),a=Math.sin(2*Math.PI/h),l=0;l<n;l+=h)for(var f=u,m=a,c=0;c<s;c++){var d=i[l+c],p=e[l+c],v=i[l+c+s],g=e[l+c+s],M=f*v-m*g;g=f*g+m*v,v=M,i[l+c]=d+v,e[l+c]=p+g,i[l+c+s]=d-v,e[l+c+s]=p-g,c!==h&&(M=u*f-a*m,m=u*m+a*f,f=M)}},p.prototype.guessLen13b=function(t,r){var i=1|Math.max(r,t),e=1&i,n=0;for(i=i/2|0;i;i>>>=1)n++;return 1<<n+1+e},p.prototype.conjugate=function(t,r,i){if(!(i<=1))for(var e=0;e<i/2;e++){var n=t[e];t[e]=t[i-e-1],t[i-e-1]=n,n=r[e],r[e]=-r[i-e-1],r[i-e-1]=-n}},p.prototype.normalize13b=function(t,r){for(var i=0,e=0;e<r/2;e++){var n=8192*Math.round(t[2*e+1]/r)+Math.round(t[2*e]/r)+i;t[e]=67108863&n,i=n<67108864?0:n/67108864|0}return t},p.prototype.convert13b=function(t,r,i,n){for(var o=0,s=0;s<r;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*r;s<n;++s)i[s]=0;e(0===o),e(0==(-8192&o))},p.prototype.stub=function(t){for(var r=new Array(t),i=0;i<t;i++)r[i]=0;return r},p.prototype.mulp=function(t,r,i){var e=2*this.guessLen13b(t.length,r.length),n=this.makeRBT(e),o=this.stub(e),s=new Array(e),h=new Array(e),u=new Array(e),a=new Array(e),l=new Array(e),f=new Array(e),m=i.words;m.length=e,this.convert13b(t.words,t.length,s,e),this.convert13b(r.words,r.length,a,e),this.transform(s,o,h,u,e,n),this.transform(a,o,l,f,e,n);for(var c=0;c<e;c++){var d=h[c]*l[c]-u[c]*f[c];u[c]=h[c]*f[c]+u[c]*l[c],h[c]=d}return this.conjugate(h,u,e),this.transform(h,u,m,o,e,n),this.conjugate(m,o,e),this.normalize13b(m,e),i.negative=t.negative^r.negative,i.length=t.length+r.length,i.strip()},o.prototype.mul=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),this.mulTo(t,r)},o.prototype.mulf=function(t){var r=new o(null);return r.words=new Array(this.length+t.length),d(this,t,r)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){e("number"==typeof t),e(t<67108864);for(var r=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&r);r>>=26,r+=n/67108864|0,r+=o>>>26,this.words[i]=67108863&o}return 0!==r&&(this.words[i]=r,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var r=function(t){for(var r=new Array(t.bitLength()),i=0;i<r.length;i++){var e=i/26|0,n=i%26;r[i]=(t.words[e]&1<<n)>>>n}return r}(t);if(0===r.length)return new o(1);for(var i=this,e=0;e<r.length&&0===r[e];e++,i=i.sqr());if(++e<r.length)for(var n=i.sqr();e<r.length;e++,n=n.sqr())0!==r[e]&&(i=i.mul(n));return i},o.prototype.iushln=function(t){e("number"==typeof t&&t>=0);var r,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(r=0;r<this.length;r++){var h=this.words[r]&o,u=(0|this.words[r])-h<<i;this.words[r]=u|s,s=h>>>26-i}s&&(this.words[r]=s,this.length++)}if(0!==n){for(r=this.length-1;r>=0;r--)this.words[r+n]=this.words[r];for(r=0;r<n;r++)this.words[r]=0;this.length+=n}return this.strip()},o.prototype.ishln=function(t){return e(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,r,i){var n;e("number"==typeof t&&t>=0),n=r?(r-r%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),h=67108863^67108863>>>o<<o,u=i;if(n-=s,n=Math.max(0,n),u){for(var a=0;a<s;a++)u.words[a]=this.words[a];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,a=0;a<this.length;a++)this.words[a]=this.words[a+s];else this.words[0]=0,this.length=1;var l=0;for(a=this.length-1;a>=0&&(0!==l||a>=n);a--){var f=0|this.words[a];this.words[a]=l<<26-o|f>>>o,l=f&h}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,r,i){return e(0===this.negative),this.iushrn(t,r,i)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){e("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26,n=1<<r;return!(this.length<=i)&&!!(this.words[i]&n)},o.prototype.imaskn=function(t){e("number"==typeof t&&t>=0);var r=t%26,i=(t-r)/26;if(e(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==r&&i++,this.length=Math.min(i,this.length),0!==r){var n=67108863^67108863>>>r<<r;this.words[this.length-1]&=n}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return e("number"==typeof t),e(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var r=0;r<this.length&&this.words[r]>=67108864;r++)this.words[r]-=67108864,r===this.length-1?this.words[r+1]=1:this.words[r+1]++;return this.length=Math.max(this.length,r+1),this},o.prototype.isubn=function(t){if(e("number"==typeof t),e(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var r=0;r<this.length&&this.words[r]<0;r++)this.words[r]+=67108864,this.words[r+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,r,i){var n,o,s=t.length+i;this._expand(s);var h=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+h;var u=(0|t.words[n])*r;h=((o-=67108863&u)>>26)-(u/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)h=(o=(0|this.words[n+i])+h)>>26,this.words[n+i]=67108863&o;if(0===h)return this.strip();for(e(-1===h),h=0,n=0;n<this.length;n++)h=(o=-(0|this.words[n])+h)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,r){var i=(this.length,t.length),e=this.clone(),n=t,s=0|n.words[n.length-1];0!==(i=26-this._countBits(s))&&(n=n.ushln(i),e.iushln(i),s=0|n.words[n.length-1]);var h,u=e.length-n.length;if("mod"!==r){(h=new o(null)).length=u+1,h.words=new Array(h.length);for(var a=0;a<h.length;a++)h.words[a]=0}var l=e.clone()._ishlnsubmul(n,1,u);0===l.negative&&(e=l,h&&(h.words[u]=1));for(var f=u-1;f>=0;f--){var m=67108864*(0|e.words[n.length+f])+(0|e.words[n.length+f-1]);for(m=Math.min(m/s|0,67108863),e._ishlnsubmul(n,m,f);0!==e.negative;)m--,e.negative=0,e._ishlnsubmul(n,1,f),e.isZero()||(e.negative^=1);h&&(h.words[f]=m)}return h&&h.strip(),e.strip(),"div"!==r&&0!==i&&e.iushrn(i),{div:h||null,mod:e}},o.prototype.divmod=function(t,r,i){return e(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(h=this.neg().divmod(t,r),"mod"!==r&&(n=h.div.neg()),"div"!==r&&(s=h.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(h=this.divmod(t.neg(),r),"mod"!==r&&(n=h.div.neg()),{div:n,mod:h.mod}):0!=(this.negative&t.negative)?(h=this.neg().divmod(t.neg(),r),"div"!==r&&(s=h.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:h.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===r?{div:this.divn(t.words[0]),mod:null}:"mod"===r?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,r);var n,s,h},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var r=this.divmod(t);if(r.mod.isZero())return r.div;var i=0!==r.div.negative?r.mod.isub(t):r.mod,e=t.ushrn(1),n=t.andln(1),o=i.cmp(e);return o<0||1===n&&0===o?r.div:0!==r.div.negative?r.div.isubn(1):r.div.iaddn(1)},o.prototype.modn=function(t){e(t<=67108863);for(var r=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(r*i+(0|this.words[n]))%t;return i},o.prototype.idivn=function(t){e(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*r;this.words[i]=n/t|0,r=n%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){e(0===t.negative),e(!t.isZero());var r=this,i=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var n=new o(1),s=new o(0),h=new o(0),u=new o(1),a=0;r.isEven()&&i.isEven();)r.iushrn(1),i.iushrn(1),++a;for(var l=i.clone(),f=r.clone();!r.isZero();){for(var m=0,c=1;0==(r.words[0]&c)&&m<26;++m,c<<=1);if(m>0)for(r.iushrn(m);m-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(l),s.isub(f)),n.iushrn(1),s.iushrn(1);for(var d=0,p=1;0==(i.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(i.iushrn(d);d-- >0;)(h.isOdd()||u.isOdd())&&(h.iadd(l),u.isub(f)),h.iushrn(1),u.iushrn(1);r.cmp(i)>=0?(r.isub(i),n.isub(h),s.isub(u)):(i.isub(r),h.isub(n),u.isub(s))}return{a:h,b:u,gcd:i.iushln(a)}},o.prototype._invmp=function(t){e(0===t.negative),e(!t.isZero());var r=this,i=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var n,s=new o(1),h=new o(0),u=i.clone();r.cmpn(1)>0&&i.cmpn(1)>0;){for(var a=0,l=1;0==(r.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(r.iushrn(a);a-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,m=1;0==(i.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(i.iushrn(f);f-- >0;)h.isOdd()&&h.iadd(u),h.iushrn(1);r.cmp(i)>=0?(r.isub(i),s.isub(h)):(i.isub(r),h.isub(s))}return(n=0===r.cmpn(1)?s:h).cmpn(0)<0&&n.iadd(t),n},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var r=this.clone(),i=t.clone();r.negative=0,i.negative=0;for(var e=0;r.isEven()&&i.isEven();e++)r.iushrn(1),i.iushrn(1);for(;;){for(;r.isEven();)r.iushrn(1);for(;i.isEven();)i.iushrn(1);var n=r.cmp(i);if(n<0){var o=r;r=i,i=o}else if(0===n||0===i.cmpn(1))break;r.isub(i)}return i.iushln(e)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){e("number"==typeof t);var r=t%26,i=(t-r)/26,n=1<<r;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var h=0|this.words[s];o=(h+=o)>>>26,h&=67108863,this.words[s]=h}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var r,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)r=1;else{i&&(t=-t),e(t<=67108863,"Number is too big");var n=0|this.words[0];r=n===t?0:n<t?-1:1}return 0!==this.negative?0|-r:r},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var r=this.ucmp(t);return 0!==this.negative?0|-r:r},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var r=0,i=this.length-1;i>=0;i--){var e=0|this.words[i],n=0|t.words[i];if(e!==n){e<n?r=-1:e>n&&(r=1);break}}return r},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new x(t)},o.prototype.toRed=function(t){return e(!this.red,"Already a number in reduction context"),e(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return e(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return e(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function g(t,r){this.name=t,this.p=new o(r,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function y(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function x(t){if("string"==typeof t){var r=o._prime(t);this.m=r.p,this.prime=r}else e(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){x.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var r,i=t;do{this.split(i,this.tmp),r=(i=(i=this.imulK(i)).iadd(this.tmp)).bitLength()}while(r>this.n);var e=r<this.n?-1:i.ucmp(this.p);return 0===e?(i.words[0]=0,i.length=1):e>0?i.isub(this.p):i.strip(),i},g.prototype.split=function(t,r){t.iushrn(this.n,0,r)},g.prototype.imulK=function(t){return t.imul(this.k)},n(M,g),M.prototype.split=function(t,r){for(var i=Math.min(t.length,9),e=0;e<i;e++)r.words[e]=t.words[e];if(r.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(r.words[r.length++]=4194303&n,e=10;e<t.length;e++){var o=0|t.words[e];t.words[e-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,t.words[e-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var r=0,i=0;i<t.length;i++){var e=0|t.words[i];r+=977*e,t.words[i]=67108863&r,r=64*e+(r/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(w,g),n(y,g),n(b,g),b.prototype.imulK=function(t){for(var r=0,i=0;i<t.length;i++){var e=19*(0|t.words[i])+r,n=67108863&e;e>>>=26,t.words[i]=n,r=e}return 0!==r&&(t.words[t.length++]=r),t},o._prime=function(t){if(v[t])return v[t];var r;if("k256"===t)r=new M;else if("p224"===t)r=new w;else if("p192"===t)r=new y;else{if("p25519"!==t)throw new Error("Unknown prime "+t);r=new b}return v[t]=r,r},x.prototype._verify1=function(t){e(0===t.negative,"red works only with positives"),e(t.red,"red works only with red numbers")},x.prototype._verify2=function(t,r){e(0==(t.negative|r.negative),"red works only with positives"),e(t.red&&t.red===r.red,"red works only with red numbers")},x.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},x.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},x.prototype.add=function(t,r){this._verify2(t,r);var i=t.add(r);return i.cmp(this.m)>=0&&i.isub(this.m),i._forceRed(this)},x.prototype.iadd=function(t,r){this._verify2(t,r);var i=t.iadd(r);return i.cmp(this.m)>=0&&i.isub(this.m),i},x.prototype.sub=function(t,r){this._verify2(t,r);var i=t.sub(r);return i.cmpn(0)<0&&i.iadd(this.m),i._forceRed(this)},x.prototype.isub=function(t,r){this._verify2(t,r);var i=t.isub(r);return i.cmpn(0)<0&&i.iadd(this.m),i},x.prototype.shl=function(t,r){return this._verify1(t),this.imod(t.ushln(r))},x.prototype.imul=function(t,r){return this._verify2(t,r),this.imod(t.imul(r))},x.prototype.mul=function(t,r){return this._verify2(t,r),this.imod(t.mul(r))},x.prototype.isqr=function(t){return this.imul(t,t.clone())},x.prototype.sqr=function(t){return this.mul(t,t)},x.prototype.sqrt=function(t){if(t.isZero())return t.clone();var r=this.m.andln(3);if(e(r%2==1),3===r){var i=this.m.add(new o(1)).iushrn(2);return this.pow(t,i)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);e(!n.isZero());var h=new o(1).toRed(this),u=h.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,n),m=this.pow(t,n.addn(1).iushrn(1)),c=this.pow(t,n),d=s;0!==c.cmp(h);){for(var p=c,v=0;0!==p.cmp(h);v++)p=p.redSqr();e(v<d);var g=this.pow(f,new o(1).iushln(d-v-1));m=m.redMul(g),f=g.redSqr(),c=c.redMul(f),d=v}return m},x.prototype.invm=function(t){var r=t._invmp(this.m);return 0!==r.negative?(r.negative=0,this.imod(r).redNeg()):this.imod(r)},x.prototype.pow=function(t,r){if(r.isZero())return new o(1);if(0===r.cmpn(1))return t.clone();var i=new Array(16);i[0]=new o(1).toRed(this),i[1]=t;for(var e=2;e<i.length;e++)i[e]=this.mul(i[e-1],t);var n=i[0],s=0,h=0,u=r.bitLength()%26;for(0===u&&(u=26),e=r.length-1;e>=0;e--){for(var a=r.words[e],l=u-1;l>=0;l--){var f=a>>l&1;n!==i[0]&&(n=this.sqr(n)),0!==f||0!==s?(s<<=1,s|=f,(4===++h||0===e&&0===l)&&(n=this.mul(n,i[s]),h=0,s=0)):h=0}u=26}return n},x.prototype.convertTo=function(t){var r=t.umod(this.m);return r===t?r.clone():r},x.prototype.convertFrom=function(t){var r=t.clone();return r.red=null,r},o.mont=function(t){return new _(t)},n(_,x),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var r=this.imod(t.mul(this.rinv));return r.red=null,r},_.prototype.imul=function(t,r){if(t.isZero()||r.isZero())return t.words[0]=0,t.length=1,t;var i=t.imul(r),e=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(e).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},_.prototype.mul=function(t,r){if(t.isZero()||r.isZero())return new o(0)._forceRed(this);var i=t.mul(r),e=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(e).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,i(2)(t))},function(t,r,i){var e=i(46);t.exports=function(t){return"string"!=typeof t?t:e(t)?t.slice(2):t}},function(t,r){t.exports=function(t){if("string"!=typeof t)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof t+", while checking isHexPrefixed.");return"0x"===t.slice(0,2)}},function(t,r){var i="0123456789abcdef".split(""),e=[1,256,65536,16777216],n=[0,8,16,24],o=[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],s=function(t){var r,i,e,n,s,h,u,a,l,f,m,c,d,p,v,g,M,w,y,b,x,_,A,S,k,T,E,B,N,C,O,R,I,P,j,L,H,F,q,Z,U,z,D,W,$,G,Y,J,X,K,V,Q,tt,rt,it,et,nt,ot,st,ht,ut,at,lt;for(e=0;e<48;e+=2)n=t[0]^t[10]^t[20]^t[30]^t[40],s=t[1]^t[11]^t[21]^t[31]^t[41],h=t[2]^t[12]^t[22]^t[32]^t[42],u=t[3]^t[13]^t[23]^t[33]^t[43],a=t[4]^t[14]^t[24]^t[34]^t[44],l=t[5]^t[15]^t[25]^t[35]^t[45],f=t[6]^t[16]^t[26]^t[36]^t[46],m=t[7]^t[17]^t[27]^t[37]^t[47],r=(c=t[8]^t[18]^t[28]^t[38]^t[48])^(h<<1|u>>>31),i=(d=t[9]^t[19]^t[29]^t[39]^t[49])^(u<<1|h>>>31),t[0]^=r,t[1]^=i,t[10]^=r,t[11]^=i,t[20]^=r,t[21]^=i,t[30]^=r,t[31]^=i,t[40]^=r,t[41]^=i,r=n^(a<<1|l>>>31),i=s^(l<<1|a>>>31),t[2]^=r,t[3]^=i,t[12]^=r,t[13]^=i,t[22]^=r,t[23]^=i,t[32]^=r,t[33]^=i,t[42]^=r,t[43]^=i,r=h^(f<<1|m>>>31),i=u^(m<<1|f>>>31),t[4]^=r,t[5]^=i,t[14]^=r,t[15]^=i,t[24]^=r,t[25]^=i,t[34]^=r,t[35]^=i,t[44]^=r,t[45]^=i,r=a^(c<<1|d>>>31),i=l^(d<<1|c>>>31),t[6]^=r,t[7]^=i,t[16]^=r,t[17]^=i,t[26]^=r,t[27]^=i,t[36]^=r,t[37]^=i,t[46]^=r,t[47]^=i,r=f^(n<<1|s>>>31),i=m^(s<<1|n>>>31),t[8]^=r,t[9]^=i,t[18]^=r,t[19]^=i,t[28]^=r,t[29]^=i,t[38]^=r,t[39]^=i,t[48]^=r,t[49]^=i,p=t[0],v=t[1],G=t[11]<<4|t[10]>>>28,Y=t[10]<<4|t[11]>>>28,B=t[20]<<3|t[21]>>>29,N=t[21]<<3|t[20]>>>29,ht=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,z=t[40]<<18|t[41]>>>14,D=t[41]<<18|t[40]>>>14,P=t[2]<<1|t[3]>>>31,j=t[3]<<1|t[2]>>>31,g=t[13]<<12|t[12]>>>20,M=t[12]<<12|t[13]>>>20,J=t[22]<<10|t[23]>>>22,X=t[23]<<10|t[22]>>>22,C=t[33]<<13|t[32]>>>19,O=t[32]<<13|t[33]>>>19,at=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,rt=t[5]<<30|t[4]>>>2,it=t[4]<<30|t[5]>>>2,L=t[14]<<6|t[15]>>>26,H=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,y=t[24]<<11|t[25]>>>21,K=t[34]<<15|t[35]>>>17,V=t[35]<<15|t[34]>>>17,R=t[45]<<29|t[44]>>>3,I=t[44]<<29|t[45]>>>3,S=t[6]<<28|t[7]>>>4,k=t[7]<<28|t[6]>>>4,et=t[17]<<23|t[16]>>>9,nt=t[16]<<23|t[17]>>>9,F=t[26]<<25|t[27]>>>7,q=t[27]<<25|t[26]>>>7,b=t[36]<<21|t[37]>>>11,x=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,W=t[8]<<27|t[9]>>>5,$=t[9]<<27|t[8]>>>5,T=t[18]<<20|t[19]>>>12,E=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,Z=t[38]<<8|t[39]>>>24,U=t[39]<<8|t[38]>>>24,_=t[48]<<14|t[49]>>>18,A=t[49]<<14|t[48]>>>18,t[0]=p^~g&w,t[1]=v^~M&y,t[10]=S^~T&B,t[11]=k^~E&N,t[20]=P^~L&F,t[21]=j^~H&q,t[30]=W^~G&J,t[31]=$^~Y&X,t[40]=rt^~et&ot,t[41]=it^~nt&st,t[2]=g^~w&b,t[3]=M^~y&x,t[12]=T^~B&C,t[13]=E^~N&O,t[22]=L^~F&Z,t[23]=H^~q&U,t[32]=G^~J&K,t[33]=Y^~X&V,t[42]=et^~ot&ht,t[43]=nt^~st&ut,t[4]=w^~b&_,t[5]=y^~x&A,t[14]=B^~C&R,t[15]=N^~O&I,t[24]=F^~Z&z,t[25]=q^~U&D,t[34]=J^~K&Q,t[35]=X^~V&tt,t[44]=ot^~ht&at,t[45]=st^~ut&lt,t[6]=b^~_&p,t[7]=x^~A&v,t[16]=C^~R&S,t[17]=O^~I&k,t[26]=Z^~z&P,t[27]=U^~D&j,t[36]=K^~Q&W,t[37]=V^~tt&$,t[46]=ht^~at&rt,t[47]=ut^~lt&it,t[8]=_^~p&g,t[9]=A^~v&M,t[18]=R^~S&T,t[19]=I^~k&E,t[28]=z^~P&L,t[29]=D^~j&H,t[38]=Q^~W&G,t[39]=tt^~$&Y,t[48]=at^~rt&et,t[49]=lt^~it&nt,t[0]^=o[e],t[1]^=o[e+1]},h=function(t){return function(r){var o;if("0x"===r.slice(0,2)){o=[];for(var h=2,u=r.length;h<u;h+=2)o.push(parseInt(r.slice(h,h+2),16))}else o=r;return function(t,r){for(var o,h=r.length,u=t.blocks,a=t.blockCount<<2,l=t.blockCount,f=t.outputBlocks,m=t.s,c=0;c<h;){if(t.reset)for(t.reset=!1,u[0]=t.block,v=1;v<l+1;++v)u[v]=0;if("string"!=typeof r)for(v=t.start;c<h&&v<a;++c)u[v>>2]|=r[c]<<n[3&v++];else for(v=t.start;c<h&&v<a;++c)(o=r.charCodeAt(c))<128?u[v>>2]|=o<<n[3&v++]:o<2048?(u[v>>2]|=(192|o>>6)<<n[3&v++],u[v>>2]|=(128|63&o)<<n[3&v++]):o<55296||o>=57344?(u[v>>2]|=(224|o>>12)<<n[3&v++],u[v>>2]|=(128|o>>6&63)<<n[3&v++],u[v>>2]|=(128|63&o)<<n[3&v++]):(o=65536+((1023&o)<<10|1023&r.charCodeAt(++c)),u[v>>2]|=(240|o>>18)<<n[3&v++],u[v>>2]|=(128|o>>12&63)<<n[3&v++],u[v>>2]|=(128|o>>6&63)<<n[3&v++],u[v>>2]|=(128|63&o)<<n[3&v++]);if(t.lastByteIndex=v,v>=a){for(t.start=v-a,t.block=u[l],v=0;v<l;++v)m[v]^=u[v];s(m),t.reset=!0}else t.start=v}if(u[(v=t.lastByteIndex)>>2]|=e[3&v],t.lastByteIndex===a)for(u[0]=u[l],v=1;v<l+1;++v)u[v]=0;for(u[l-1]|=2147483648,v=0;v<l;++v)m[v]^=u[v];s(m);for(var d,p="",v=0,g=0;g<f;){for(v=0;v<l&&g<f;++v,++g)d=m[v],p+=i[d>>4&15]+i[15&d]+i[d>>12&15]+i[d>>8&15]+i[d>>20&15]+i[d>>16&15]+i[d>>28&15]+i[d>>24&15];g%l==0&&(s(m),v=0)}return"0x"+p}(function(t){return{blocks:[],reset:!0,block:0,start:0,blockCount:1600-(t<<1)>>5,outputBlocks:t>>5,s:(r=[0,0,0,0,0,0,0,0,0,0],[].concat(r,r,r,r,r))};var r}(t),o)}};t.exports={keccak256:h(256),keccak512:h(512),keccak256s:h(256),keccak512s:h(512)}},function(t,r,i){var e=i(0),n=i(16),o=i(15),s=function(t){var r=typeof t;if("string"===r)return o.isHexStrict(t)?new n(t.replace(/0x/i,""),16):new n(t,10);if("number"===r)return new n(t);if(o.isBigNumber(t))return new n(t.toString(10));if(o.isBN(t))return t;throw new Error(t+" is not a number")},h=function(t,r,i){var e,h;if("bytes"===(t=function(t){return t.startsWith("int[")?"int256"+t.slice(3):"int"===t?"int256":t.startsWith("uint[")?"uint256"+t.slice(4):"uint"===t?"uint256":t.startsWith("fixed[")?"fixed128x128"+t.slice(5):"fixed"===t?"fixed128x128":t.startsWith("ufixed[")?"ufixed128x128"+t.slice(6):"ufixed"===t?"ufixed128x128":t}(t))){if(r.replace(/^0x/i,"").length%2!=0)throw new Error("Invalid bytes characters "+r.length);return r}if("string"===t)return o.utf8ToHex(r);if("bool"===t)return r?"01":"00";if(t.startsWith("address")){if(e=i?64:40,!o.isAddress(r))throw new Error(r+" is not a valid address, or the checksum is invalid.");return o.leftPad(r.toLowerCase(),e)}if(e=function(t){var r=/^\D+(\d+).*$/.exec(t);return r?parseInt(r[1],10):null}(t),t.startsWith("bytes")){if(!e)throw new Error("bytes[] not yet supported in solidity");if(i&&(e=32),e<1||e>32||e<r.replace(/^0x/i,"").length/2)throw new Error("Invalid bytes"+e+" for "+r);return o.rightPad(r,2*e)}if(t.startsWith("uint")){if(e%8||e<8||e>256)throw new Error("Invalid uint"+e+" size");if((h=s(r)).bitLength()>e)throw new Error("Supplied uint exceeds width: "+e+" vs "+h.bitLength());if(h.lt(new n(0)))throw new Error("Supplied uint "+h.toString()+" is negative");return e?o.leftPad(h.toString("hex"),e/8*2):h}if(t.startsWith("int")){if(e%8||e<8||e>256)throw new Error("Invalid int"+e+" size");if((h=s(r)).bitLength()>e)throw new Error("Supplied int exceeds width: "+e+" vs "+h.bitLength());return h.lt(new n(0))?h.toTwos(e).toString("hex"):e?o.leftPad(h.toString("hex"),e/8*2):h}throw new Error("Unsupported or invalid type: "+t)},u=function(t){if(e.isArray(t))throw new Error("Autodetection of array types is not supported.");var r,i,s="";if(e.isObject(t)&&(t.hasOwnProperty("v")||t.hasOwnProperty("t")||t.hasOwnProperty("value")||t.hasOwnProperty("type"))?(r=t.hasOwnProperty("t")?t.t:t.type,s=t.hasOwnProperty("v")?t.v:t.value):(r=o.toHex(t,!0),s=o.toHex(t),r.startsWith("int")||r.startsWith("uint")||(r="bytes")),!r.startsWith("int")&&!r.startsWith("uint")||"string"!=typeof s||/^(-)?0x/i.test(s)||(s=new n(s)),e.isArray(s)){if((i=function(t){var r=/^\D+\d*\[(\d+)\]$/.exec(t);return r?parseInt(r[1],10):null}(r))&&s.length!==i)throw new Error(r+" is not matching the given array "+JSON.stringify(s));i=s.length}return e.isArray(s)?s.map(function(t){return h(r,t,i).toString("hex").replace("0x","")}).join(""):h(r,s,i).toString("hex").replace("0x","")};t.exports=function(){var t=Array.prototype.slice.call(arguments),r=e.map(t,u);return o.sha3("0x"+r.join(""))}},function(t,r,i){t.exports=i(50)},function(t,r){t.exports=window.crypto},function(t,r,i){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const e=i(10);r.fromETHBlockNumber=function(t){if("number"==typeof t)return t;if("string"==typeof t){if("earliest"===t)return 0;if("latest"===t||"pending"===t)return"best";{const r=e.toInteger(t);return r||0===r?r:"best"}}return"best"},r.fromETHBlockNumberOrHash=function(t){return/^(-0x|0x)?[0-9a-fA-F]{64}$/i.test(t)?t:r.fromETHBlockNumber(t)},r.formatRange=function(t){const i={};if("block"!==t.unit&&"time"!==t.unit)return null;if(i.unit=t.unit,t.hasOwnProperty("from")){const e=r.fromETHBlockNumber(t.from);i.from="best"!==e?e:0}else i.from=0;if(t.hasOwnProperty("to")){const r=e.fromETHBlockNumber(t.to);i.to="best"!==r?r:Number.MAX_SAFE_INTEGER}else i.to=Number.MAX_SAFE_INTEGER;return i},r.formatOptions=function(t){const r={};if(t.hasOwnProperty("limit")){const i=e.toInteger(t.limit);i&&(r.limit=i)}if(t.hasOwnProperty("offset")){const i=e.toInteger(t.offset);i&&(r.offset=i)}return r.hasOwnProperty("limit")||r.hasOwnProperty("offset")?r:null},r.formatLogQuery=function(t){const i={topicSets:[]};if(t.range){const e=r.formatRange(t.range);e&&(i.range=e)}if(t.options){const e=r.formatOptions(t.options);e&&(i.options=e)}i.range||!t.hasOwnProperty("fromBlock")&&!t.hasOwnProperty("toBlock")||(i.range={unit:"block"},t.hasOwnProperty("fromBlock")&&(i.range.from=t.fromBlock),t.hasOwnProperty("toBlock")&&(i.range.to=t.toBlock),i.range=r.formatRange(i.range)),i.topicSets=[];const n=[];if(t.topics&&t.topics.length)for(let r=0;r<t.topics.length;r++)"string"==typeof t.topics[r]?n.push({name:"topic"+r,array:[t.topics[r]]}):e.isArray(t.topics[r])&&t.topics[r].length&&n.push({name:"topic"+r,array:t.topics[r]});const o=function(t,r,i,e){if(r===t.length){const t={};return Object.assign(t,e),void i.push(t)}for(const n of t[r].array)e[t[r].name]=n,o(t,r+1,i,e)};return n.length&&o(n,0,i.topicSets,{}),i}},function(t,r,i){"use strict";var e=this&&this.__awaiter||function(t,r,i,e){return new(i||(i=Promise))(function(n,o){function s(t){try{u(e.next(t))}catch(t){o(t)}}function h(t){try{u(e.throw(t))}catch(t){o(t)}}function u(t){t.done?n(t.value):new i(function(r){r(t.value)}).then(s,h)}u((e=e.apply(t,r||[])).next())})};Object.defineProperty(r,"__esModule",{value:!0});const n=i(10),o=i(53),s=i(14)("thor:http-provider:rpc");r.RPCMethodMap=new Map;const h=function(t){return 0===t.Code?Promise.reject(new Error("[thor-provider] Invalid response, check the host")):200!==t.Code?Promise.reject(new Error(t.Body?t.Body:"[thor-provider] Invalid response code from provider: "+t.Code)):Promise.resolve(t.Body)};r.RPCMethodMap.set("eth_getBlockByNumber",function(t,r,i){return e(this,void 0,void 0,function*(){const e=r+"/blocks/"+n.fromETHBlockNumber(t.params[0]),s=yield o.HTTP.get(e,i).then(h);return t.makeResult(s)})}),r.RPCMethodMap.set("eth_getBlockByHash",function(t,r,i){return e(this,void 0,void 0,function*(){const e=r+"/blocks/"+t.params[0],n=yield o.HTTP.get(e,i).then(h);return t.makeResult(n)})}),r.RPCMethodMap.set("eth_blockNumber",function(t,r,i){return e(this,void 0,void 0,function*(){const e=r+"/blocks/best",n=yield o.HTTP.get(e,i).then(h);return t.makeResult(n?n.number:null)})}),r.RPCMethodMap.set("eth_getBalance",function(t,r,i){return e(this,void 0,void 0,function*(){const e=r+"/accounts/"+t.params[0]+"?revision="+n.fromETHBlockNumberOrHash(t.params[1]),s=yield o.HTTP.get(e,i).then(h);return t.makeResult(s?s.balance:null)})}),r.RPCMethodMap.set("eth_getEnergy",function(t,r,i){return e(this,void 0,void 0,function*(){const e=r+"/accounts/"+t.params[0]+"?revision="+n.fromETHBlockNumberOrHash(t.params[1]),s=yield o.HTTP.get(e,i).then(h);return t.makeResult(s?s.energy:null)})}),r.RPCMethodMap.set("eth_getCode",function(t,r,i){return e(this,void 0,void 0,function*(){const e=r+"/accounts/"+t.params[0]+"/code?revision="+n.fromETHBlockNumberOrHash(t.params[1]),s=yield o.HTTP.get(e,i).then(h);return t.makeResult(s?s.code:null)})}),r.RPCMethodMap.set("eth_getStorageAt",function(t,r,i){return e(this,void 0,void 0,function*(){const e=r+"/accounts/"+t.params[0]+"/storage/"+n.leftPadToBytes32(t.params[1])+"?revision="+n.fromETHBlockNumberOrHash(t.params[2]),s=yield o.HTTP.get(e,i).then(h);return t.makeResult(s?s.value:null)})}),r.RPCMethodMap.set("eth_sendRawTransaction",function(t,r,i){return e(this,void 0,void 0,function*(){const e=r+"/transactions",n={raw:t.params[0]},s=yield o.HTTP.post(e,n,i).then(h);return t.makeResult(s?s.id:null)})}),r.RPCMethodMap.set("eth_getTransactionByHash",function(t,r,i){return e(this,void 0,void 0,function*(){const e=r+"/transactions/"+t.params[0],n=yield o.HTTP.get(e,i).then(h);return n?(n.blockNumber=n.meta.blockNumber,t.makeResult(n)):t.makeResult(null)})}),r.RPCMethodMap.set("eth_getTransactionReceipt",function(t,r,i){return e(this,void 0,void 0,function*(){const e=r+"/transactions/"+t.params[0]+"/receipt",n=yield o.HTTP.get(e,i).then(h);return n?(n.blockNumber=n.meta.blockNumber,n.blockHash=n.meta.blockID,n.transactionHash=n.meta.txID,n.reverted?n.status="0x0":n.status="0x1",1===n.outputs.length&&(n.contractAddress=n.outputs[0].contractAddress),t.makeResult(n)):t.makeResult(null)})}),r.RPCMethodMap.set("eth_call",function(t,r,u){return e(this,void 0,void 0,function*(){let e="";t.params[0].to&&(e="/"+t.params[0].to),e+="?revision="+n.fromETHBlockNumberOrHash(t.params[1]);const a=r+"/accounts"+e,l={value:t.params[0].value||"",data:t.params[0].data||"0x",gasPrice:t.params[0].gasPrice||""};t.params[0].gas&&("number"==typeof t.params[0].gas?l.gas=t.params[0].gas:l.gas=parseInt(n.sanitizeHex(t.params[0].gas),16)),t.params[0].from&&(l.caller=t.params[0].from);const f=yield o.HTTP.post(a,l,u).then(h);return s("eth_call returns",f),f?f.reverted||f.vmError?f.data&&f.data.startsWith("0x08c379a0")?t.makeError("VM reverted: "+i(18).decodeParameter("string",f.data.replace(/^0x08c379a0/i,""))):t.makeError("VM executing failed"+(f.vmError?": "+f.vmError:"")):t.makeResult("0x"===f.data?"":f.data):t.makeResult(null)})}),r.RPCMethodMap.set("eth_estimateGas",function(t,r,u){return e(this,void 0,void 0,function*(){let e="";t.params[0].to&&(e="/"+t.params[0].to),e+="?revision="+n.fromETHBlockNumberOrHash(t.params[1]);const a=r+"/accounts"+e,l={value:t.params[0].value||"",data:t.params[0].data||"0x",gasPrice:t.params[0].gasPrice||""};t.params[0].gas&&("number"==typeof t.params[0].gas?l.gas=t.params[0].gas:l.gas=parseInt(n.sanitizeHex(t.params[0].gas),16)),t.params[0].from&&(l.caller=t.params[0].from);const f=yield o.HTTP.post(a,l,u).then(h);if(f){if(f.reverted||f.vmError)return f.data&&f.data.startsWith("0x08c379a0")?t.makeError("Gas estimation failed with VM reverted: "+i(18).decodeParameter("string",f.data.replace(/^0x08c379a0/i,""))):t.makeError("Gas estimation failed"+(f.vmError?": "+f.vmError:""));{s("VM gas:",f.gasUsed);const r=n.calcIntrinsicGas(Object.assign(l,{to:t.params[0].to}));return 0===f.gasUsed&&"0x"===l.data?t.makeResult(r):t.makeResult(Math.floor(1.2*f.gasUsed)+r)}}return t.makeResult(null)})}),r.RPCMethodMap.set("eth_getLogs",function(t,r,i){return e(this,void 0,void 0,function*(){let e="";t.params[0].address&&(e="&address="+t.params[0].address),!t.params[0].order||"ASC"!==t.params[0].order.toUpperCase()&&"DESC"!==t.params[0].order.toUpperCase()||(e+="&order="+t.params[0].order.toUpperCase()),e=e.replace("&","?");const s=r+"/logs/events"+e,u=n.formatLogQuery(t.params[0]),a=yield o.HTTP.post(s,u,i).then(h);if(!a)return t.makeResult(null);for(const t of a)t.blockNumber=t.meta.blockNumber,t.blockHash=t.meta.blockID,t.transactionHash=t.meta.txID;return t.makeResult(a)})}),r.RPCMethodMap.set("eth_getBlockRef",function(t,r,i){return e(this,void 0,void 0,function*(){const e=r+"/blocks/best",n=yield o.HTTP.get(e,i).then(h);return n&&n.id?t.makeResult(n.id.substr(0,18)):t.makeResult(null)})}),r.RPCMethodMap.set("eth_getChainTag",function(t,r,i){return e(this,void 0,void 0,function*(){const e=r+"/blocks/0",n=yield o.HTTP.get(e,i).then(h);return n&&n.id&&66===n.id.length?t.makeResult("0x"+n.id.substr(64,2)):t.makeResult(null)})})},function(t,r,i){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const e=i(54);var n;!function(t){t[t.GET=0]="GET",t[t.POST=1]="POST"}(n=r.Method||(r.Method={}));r.HTTP={get:function(t,r=0){return o(n.GET,t,null,r)},post:function(t,r,i=0){return o(n.POST,t,r,i)}};const o=function(t,r,i,o){return new Promise((s,h)=>{const u=new e;u.timeout=o,u.open(n[t],r),u.onreadystatechange=()=>{if(4===u.readyState){const t={Code:u.status,Body:null};if(200===u.status)try{t.Body=JSON.parse(u.responseText)}catch(t){return h(new Error(`[thor-provider]Error parsing the response: ${t.message}`))}else u.responseText&&u.responseText.length&&(t.Body=u.responseText);return s(t)}},u.ontimeout=()=>h(new Error("[thor-provider]Time out for whatever reason, check your provider"));try{u.send(t===n.POST?JSON.stringify(i):null)}catch(t){return h(new Error(`[thor-provider]Connect error: ${t.message}`))}})}},function(t,r){t.exports=XMLHttpRequest},function(t,r){var i="0123456789abcdef".split(""),e=[1,256,65536,16777216],n=[0,8,16,24],o=[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],s=function(t){var r,i,e,n,s,h,u,a,l,f,m,c,d,p,v,g,M,w,y,b,x,_,A,S,k,T,E,B,N,C,O,R,I,P,j,L,H,F,q,Z,U,z,D,W,$,G,Y,J,X,K,V,Q,tt,rt,it,et,nt,ot,st,ht,ut,at,lt;for(e=0;e<48;e+=2)n=t[0]^t[10]^t[20]^t[30]^t[40],s=t[1]^t[11]^t[21]^t[31]^t[41],h=t[2]^t[12]^t[22]^t[32]^t[42],u=t[3]^t[13]^t[23]^t[33]^t[43],a=t[4]^t[14]^t[24]^t[34]^t[44],l=t[5]^t[15]^t[25]^t[35]^t[45],f=t[6]^t[16]^t[26]^t[36]^t[46],m=t[7]^t[17]^t[27]^t[37]^t[47],r=(c=t[8]^t[18]^t[28]^t[38]^t[48])^(h<<1|u>>>31),i=(d=t[9]^t[19]^t[29]^t[39]^t[49])^(u<<1|h>>>31),t[0]^=r,t[1]^=i,t[10]^=r,t[11]^=i,t[20]^=r,t[21]^=i,t[30]^=r,t[31]^=i,t[40]^=r,t[41]^=i,r=n^(a<<1|l>>>31),i=s^(l<<1|a>>>31),t[2]^=r,t[3]^=i,t[12]^=r,t[13]^=i,t[22]^=r,t[23]^=i,t[32]^=r,t[33]^=i,t[42]^=r,t[43]^=i,r=h^(f<<1|m>>>31),i=u^(m<<1|f>>>31),t[4]^=r,t[5]^=i,t[14]^=r,t[15]^=i,t[24]^=r,t[25]^=i,t[34]^=r,t[35]^=i,t[44]^=r,t[45]^=i,r=a^(c<<1|d>>>31),i=l^(d<<1|c>>>31),t[6]^=r,t[7]^=i,t[16]^=r,t[17]^=i,t[26]^=r,t[27]^=i,t[36]^=r,t[37]^=i,t[46]^=r,t[47]^=i,r=f^(n<<1|s>>>31),i=m^(s<<1|n>>>31),t[8]^=r,t[9]^=i,t[18]^=r,t[19]^=i,t[28]^=r,t[29]^=i,t[38]^=r,t[39]^=i,t[48]^=r,t[49]^=i,p=t[0],v=t[1],G=t[11]<<4|t[10]>>>28,Y=t[10]<<4|t[11]>>>28,B=t[20]<<3|t[21]>>>29,N=t[21]<<3|t[20]>>>29,ht=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,z=t[40]<<18|t[41]>>>14,D=t[41]<<18|t[40]>>>14,P=t[2]<<1|t[3]>>>31,j=t[3]<<1|t[2]>>>31,g=t[13]<<12|t[12]>>>20,M=t[12]<<12|t[13]>>>20,J=t[22]<<10|t[23]>>>22,X=t[23]<<10|t[22]>>>22,C=t[33]<<13|t[32]>>>19,O=t[32]<<13|t[33]>>>19,at=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,rt=t[5]<<30|t[4]>>>2,it=t[4]<<30|t[5]>>>2,L=t[14]<<6|t[15]>>>26,H=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,y=t[24]<<11|t[25]>>>21,K=t[34]<<15|t[35]>>>17,V=t[35]<<15|t[34]>>>17,R=t[45]<<29|t[44]>>>3,I=t[44]<<29|t[45]>>>3,S=t[6]<<28|t[7]>>>4,k=t[7]<<28|t[6]>>>4,et=t[17]<<23|t[16]>>>9,nt=t[16]<<23|t[17]>>>9,F=t[26]<<25|t[27]>>>7,q=t[27]<<25|t[26]>>>7,b=t[36]<<21|t[37]>>>11,x=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,W=t[8]<<27|t[9]>>>5,$=t[9]<<27|t[8]>>>5,T=t[18]<<20|t[19]>>>12,E=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,Z=t[38]<<8|t[39]>>>24,U=t[39]<<8|t[38]>>>24,_=t[48]<<14|t[49]>>>18,A=t[49]<<14|t[48]>>>18,t[0]=p^~g&w,t[1]=v^~M&y,t[10]=S^~T&B,t[11]=k^~E&N,t[20]=P^~L&F,t[21]=j^~H&q,t[30]=W^~G&J,t[31]=$^~Y&X,t[40]=rt^~et&ot,t[41]=it^~nt&st,t[2]=g^~w&b,t[3]=M^~y&x,t[12]=T^~B&C,t[13]=E^~N&O,t[22]=L^~F&Z,t[23]=H^~q&U,t[32]=G^~J&K,t[33]=Y^~X&V,t[42]=et^~ot&ht,t[43]=nt^~st&ut,t[4]=w^~b&_,t[5]=y^~x&A,t[14]=B^~C&R,t[15]=N^~O&I,t[24]=F^~Z&z,t[25]=q^~U&D,t[34]=J^~K&Q,t[35]=X^~V&tt,t[44]=ot^~ht&at,t[45]=st^~ut&lt,t[6]=b^~_&p,t[7]=x^~A&v,t[16]=C^~R&S,t[17]=O^~I&k,t[26]=Z^~z&P,t[27]=U^~D&j,t[36]=K^~Q&W,t[37]=V^~tt&$,t[46]=ht^~at&rt,t[47]=ut^~lt&it,t[8]=_^~p&g,t[9]=A^~v&M,t[18]=R^~S&T,t[19]=I^~k&E,t[28]=z^~P&L,t[29]=D^~j&H,t[38]=Q^~W&G,t[39]=tt^~$&Y,t[48]=at^~rt&et,t[49]=lt^~it&nt,t[0]^=o[e],t[1]^=o[e+1]},h=function(t){return function(r){var o;if("0x"===r.slice(0,2)){o=[];for(var h=2,u=r.length;h<u;h+=2)o.push(parseInt(r.slice(h,h+2),16))}else o=r;return function(t,r){for(var o,h=r.length,u=t.blocks,a=t.blockCount<<2,l=t.blockCount,f=t.outputBlocks,m=t.s,c=0;c<h;){if(t.reset)for(t.reset=!1,u[0]=t.block,v=1;v<l+1;++v)u[v]=0;if("string"!=typeof r)for(v=t.start;c<h&&v<a;++c)u[v>>2]|=r[c]<<n[3&v++];else for(v=t.start;c<h&&v<a;++c)(o=r.charCodeAt(c))<128?u[v>>2]|=o<<n[3&v++]:o<2048?(u[v>>2]|=(192|o>>6)<<n[3&v++],u[v>>2]|=(128|63&o)<<n[3&v++]):o<55296||o>=57344?(u[v>>2]|=(224|o>>12)<<n[3&v++],u[v>>2]|=(128|o>>6&63)<<n[3&v++],u[v>>2]|=(128|63&o)<<n[3&v++]):(o=65536+((1023&o)<<10|1023&r.charCodeAt(++c)),u[v>>2]|=(240|o>>18)<<n[3&v++],u[v>>2]|=(128|o>>12&63)<<n[3&v++],u[v>>2]|=(128|o>>6&63)<<n[3&v++],u[v>>2]|=(128|63&o)<<n[3&v++]);if(t.lastByteIndex=v,v>=a){for(t.start=v-a,t.block=u[l],v=0;v<l;++v)m[v]^=u[v];s(m),t.reset=!0}else t.start=v}if(u[(v=t.lastByteIndex)>>2]|=e[3&v],t.lastByteIndex===a)for(u[0]=u[l],v=1;v<l+1;++v)u[v]=0;for(u[l-1]|=2147483648,v=0;v<l;++v)m[v]^=u[v];s(m);for(var d,p="",v=0,g=0;g<f;){for(v=0;v<l&&g<f;++v,++g)d=m[v],p+=i[d>>4&15]+i[15&d]+i[d>>12&15]+i[d>>8&15]+i[d>>20&15]+i[d>>16&15]+i[d>>28&15]+i[d>>24&15];g%l==0&&(s(m),v=0)}return"0x"+p}(function(t){return{blocks:[],reset:!0,block:0,start:0,blockCount:1600-(t<<1)>>5,outputBlocks:t>>5,s:(r=[0,0,0,0,0,0,0,0,0,0],[].concat(r,r,r,r,r))};var r}(t),o)}};t.exports={keccak256:h(256),keccak512:h(512),keccak256s:h(256),keccak512s:h(512)}},function(t,r,i){var e=i(0),n=i(11),o=i(20),s=function(t){var r=typeof t;if("string"===r)return o.isHexStrict(t)?new n(t.replace(/0x/i,""),16):new n(t,10);if("number"===r)return new n(t);if(o.isBigNumber(t))return new n(t.toString(10));if(o.isBN(t))return t;throw new Error(t+" is not a number")},h=function(t,r,i){var e,h;if("bytes"===(t=function(t){return t.startsWith("int[")?"int256"+t.slice(3):"int"===t?"int256":t.startsWith("uint[")?"uint256"+t.slice(4):"uint"===t?"uint256":t.startsWith("fixed[")?"fixed128x128"+t.slice(5):"fixed"===t?"fixed128x128":t.startsWith("ufixed[")?"ufixed128x128"+t.slice(6):"ufixed"===t?"ufixed128x128":t}(t))){if(r.replace(/^0x/i,"").length%2!=0)throw new Error("Invalid bytes characters "+r.length);return r}if("string"===t)return o.utf8ToHex(r);if("bool"===t)return r?"01":"00";if(t.startsWith("address")){if(e=i?64:40,!o.isAddress(r))throw new Error(r+" is not a valid address, or the checksum is invalid.");return o.leftPad(r.toLowerCase(),e)}if(e=function(t){var r=/^\D+(\d+).*$/.exec(t);return r?parseInt(r[1],10):null}(t),t.startsWith("bytes")){if(!e)throw new Error("bytes[] not yet supported in solidity");if(i&&(e=32),e<1||e>32||e<r.replace(/^0x/i,"").length/2)throw new Error("Invalid bytes"+e+" for "+r);return o.rightPad(r,2*e)}if(t.startsWith("uint")){if(e%8||e<8||e>256)throw new Error("Invalid uint"+e+" size");if((h=s(r)).bitLength()>e)throw new Error("Supplied uint exceeds width: "+e+" vs "+h.bitLength());if(h.lt(new n(0)))throw new Error("Supplied uint "+h.toString()+" is negative");return e?o.leftPad(h.toString("hex"),e/8*2):h}if(t.startsWith("int")){if(e%8||e<8||e>256)throw new Error("Invalid int"+e+" size");if((h=s(r)).bitLength()>e)throw new Error("Supplied int exceeds width: "+e+" vs "+h.bitLength());return h.lt(new n(0))?h.toTwos(e).toString("hex"):e?o.leftPad(h.toString("hex"),e/8*2):h}throw new Error("Unsupported or invalid type: "+t)},u=function(t){if(e.isArray(t))throw new Error("Autodetection of array types is not supported.");var r,i,s="";if(e.isObject(t)&&(t.hasOwnProperty("v")||t.hasOwnProperty("t")||t.hasOwnProperty("value")||t.hasOwnProperty("type"))?(r=t.hasOwnProperty("t")?t.t:t.type,s=t.hasOwnProperty("v")?t.v:t.value):(r=o.toHex(t,!0),s=o.toHex(t),r.startsWith("int")||r.startsWith("uint")||(r="bytes")),!r.startsWith("int")&&!r.startsWith("uint")||"string"!=typeof s||/^(-)?0x/i.test(s)||(s=new n(s)),e.isArray(s)){if((i=function(t){var r=/^\D+\d*\[(\d+)\]$/.exec(t);return r?parseInt(r[1],10):null}(r))&&s.length!==i)throw new Error(r+" is not matching the given array "+JSON.stringify(s));i=s.length}return e.isArray(s)?s.map(function(t){return h(r,t,i).toString("hex").replace("0x","")}).join(""):h(r,s,i).toString("hex").replace("0x","")};t.exports=function(){var t=Array.prototype.slice.call(arguments),r=e.map(t,u);return o.sha3("0x"+r.join(""))}},function(t,r,i){var e=i(1),n=i(58).formatters,o=i(4),s=function(){this._inputFormatter=function(){var t=Array.prototype.slice.call(arguments);return t[0]=t[0]&&"0x0"!==t[0]?n.inputAddressFormatter(t[0]):"",e.formatInputInt.apply(this,t)},this._outputFormatter=e.formatOutputAddress};(s.prototype=new o({})).constructor=s,s.prototype.isType=function(t){return!!t.match(/address(\[([0-9]*)\])?/)},t.exports=s},function(t,r,i){"use strict";var e=i(59),n=i(60);t.exports={errors:e,formatters:n}},function(t,r,i){"use strict";t.exports={ErrorResponse:function(t){var r=t&&t.error&&t.error.message?t.error.message:JSON.stringify(t);return new Error("Returned error: "+r)},InvalidNumberOfParams:function(t,r,i){return new Error('Invalid number of parameters for "'+i+'". Got '+t+" expected "+r+"!")},InvalidConnection:function(t){return new Error("CONNECTION ERROR: Couldn't connect to node "+t+".")},InvalidProvider:function(){return new Error("Provider not set or invalid")},InvalidResponse:function(t){var r=t&&t.error&&t.error.message?t.error.message:"Invalid JSON RPC response: "+JSON.stringify(t);return new Error(r)},ConnectionTimeout:function(t){return new Error("CONNECTION TIMEOUT: timeout of "+t+" ms achived")}}},function(t,r,i){"use strict";var e=i(0),n=i(61),o=i(64),s=function(t){return n.toBN(t).toString(10)},h=function(t){if(void 0!==t)return function(t){return"latest"===t||"pending"===t||"earliest"===t}(t)?t:n.isHexStrict(t)?e.isString(t)?t.toLowerCase():t:n.numberToHex(t)},u=function(t){if(t.to&&(t.to=f(t.to)),t.data&&t.input)throw new Error('You can\'t have "data" and "input" as properties of transactions at the same time, please use either "data" or "input" instead.');if(!t.data&&t.input&&(t.data=t.input,delete t.input),t.data&&!n.isHex(t.data))throw new Error("The data field must be HEX encoded data.");return(t.gas||t.gasLimit)&&(t.gas=t.gas||t.gasLimit),["gasPrice","gas","value","nonce"].filter(function(r){return void 0!==t[r]}).forEach(function(r){t[r]=n.numberToHex(t[r])}),t},a=function(t){return null!==t.blockNumber&&(t.blockNumber=n.hexToNumber(t.blockNumber)),null!==t.transactionIndex&&(t.transactionIndex=n.hexToNumber(t.transactionIndex)),t.nonce=n.hexToNumber(t.nonce),t.gas=n.hexToNumber(t.gas),t.gasPrice=s(t.gasPrice),t.value=s(t.value),t.to&&n.isAddress(t.to)?t.to=n.toChecksumAddress(t.to):t.to=null,t.from&&(t.from=n.toChecksumAddress(t.from)),t},l=function(t){if("string"==typeof t.blockHash&&"string"==typeof t.transactionHash&&"string"==typeof t.logIndex){var r=n.sha3(t.blockHash.replace("0x","")+t.transactionHash.replace("0x","")+t.logIndex.replace("0x",""));t.id="log_"+r.replace("0x","").substr(0,8)}else t.id||(t.id=null);return null!==t.blockNumber&&(t.blockNumber=n.hexToNumber(t.blockNumber)),null!==t.transactionIndex&&(t.transactionIndex=n.hexToNumber(t.transactionIndex)),null!==t.logIndex&&(t.logIndex=n.hexToNumber(t.logIndex)),t.address&&(t.address=n.toChecksumAddress(t.address)),t},f=function(t){var r=new o(t);if(r.isValid()&&r.isDirect())return r.toAddress().toLowerCase();if(n.isAddress(t))return"0x"+t.toLowerCase().replace("0x","");throw new Error('Provided address "'+t+"\" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.")};t.exports={inputDefaultBlockNumberFormatter:function(t){return this&&null==t?this.defaultBlock:"genesis"===t||"earliest"===t?"0x0":h(t)},inputBlockNumberFormatter:h,inputCallFormatter:function(t){var r=(t=u(t)).from||(this?this.defaultAccount:null);return r&&(t.from=f(r)),t},inputTransactionFormatter:function(t){if(t=u(t),!e.isNumber(t.from)&&!e.isObject(t.from)){if(t.from=t.from||(this?this.defaultAccount:null),!t.from&&!e.isNumber(t.from))throw new Error('The send transactions "from" field must be defined!');t.from=f(t.from)}return t},inputAddressFormatter:f,inputPostFormatter:function(t){return t.ttl&&(t.ttl=n.numberToHex(t.ttl)),t.workToProve&&(t.workToProve=n.numberToHex(t.workToProve)),t.priority&&(t.priority=n.numberToHex(t.priority)),e.isArray(t.topics)||(t.topics=t.topics?[t.topics]:[]),t.topics=t.topics.map(function(t){return 0===t.indexOf("0x")?t:n.fromUtf8(t)}),t},inputLogFormatter:function(t){var r=function(t){return null==t?null:0===(t=String(t)).indexOf("0x")?t:n.fromUtf8(t)};return t.topics=t.topics||[],t.topics=t.topics.map(function(t){return e.isArray(t)?t.map(r):r(t)}),r=null,t.address&&(t.address=e.isArray(t.address)?t.address.map(function(t){return f(t)}):f(t.address)),t},inputSignFormatter:function(t){return n.isHexStrict(t)?t:n.utf8ToHex(t)},outputBigNumberFormatter:s,outputTransactionFormatter:a,outputTransactionReceiptFormatter:function(t){if("object"!=typeof t)throw new Error("Received receipt is invalid: "+t);return null!==t.blockNumber&&(t.blockNumber=n.hexToNumber(t.blockNumber)),null!==t.transactionIndex&&(t.transactionIndex=n.hexToNumber(t.transactionIndex)),t.cumulativeGasUsed=n.hexToNumber(t.cumulativeGasUsed),t.gasUsed=n.hexToNumber(t.gasUsed),e.isArray(t.logs)&&(t.logs=t.logs.map(l)),t.contractAddress&&(t.contractAddress=n.toChecksumAddress(t.contractAddress)),void 0!==t.status&&(t.status=Boolean(parseInt(t.status))),t},outputBlockFormatter:function(t){return t.gasLimit=n.hexToNumber(t.gasLimit),t.gasUsed=n.hexToNumber(t.gasUsed),t.size=n.hexToNumber(t.size),t.timestamp=n.hexToNumber(t.timestamp),null!==t.number&&(t.number=n.hexToNumber(t.number)),t.difficulty&&(t.difficulty=s(t.difficulty)),t.totalDifficulty&&(t.totalDifficulty=s(t.totalDifficulty)),e.isArray(t.transactions)&&t.transactions.forEach(function(t){if(!e.isString(t))return a(t)}),t.miner&&(t.miner=n.toChecksumAddress(t.miner)),t},outputLogFormatter:l,outputPostFormatter:function(t){return t.expiry=n.hexToNumber(t.expiry),t.sent=n.hexToNumber(t.sent),t.ttl=n.hexToNumber(t.ttl),t.workProved=n.hexToNumber(t.workProved),t.topics||(t.topics=[]),t.topics=t.topics.map(function(t){return n.toUtf8(t)}),t},outputSyncingFormatter:function(t){return t.startingBlock=n.hexToNumber(t.startingBlock),t.currentBlock=n.hexToNumber(t.currentBlock),t.highestBlock=n.hexToNumber(t.highestBlock),t.knownStates&&(t.knownStates=n.hexToNumber(t.knownStates),t.pulledStates=n.hexToNumber(t.pulledStates)),t}}},function(t,r,i){var e=i(0),n=i(7),o=i(22),s=i(63),h=i(9),u=function(t){if(!o.isHexStrict(t))throw new Error("The parameter must be a valid HEX string.");var r="",i=0,e=t.length;for("0x"===t.substring(0,2)&&(i=2);i<e;i+=2){var n=parseInt(t.substr(i,2),16);r+=String.fromCharCode(n)}return r},a=function(t){if(!t)return"0x00";for(var r="",i=0;i<t.length;i++){var e=t.charCodeAt(i).toString(16);r+=e.length<2?"0"+e:e}return"0x"+r},l=function(t){if(t=t?t.toLowerCase():"ether",!n.unitMap[t])throw new Error('This unit "'+t+"\" doesn't exist, please use the one of the following units"+JSON.stringify(n.unitMap,null,2));return t};t.exports={_fireError:function(t,r,i,n){return!e.isObject(t)||t instanceof Error||!t.data||((e.isObject(t.data)||e.isArray(t.data))&&(t.data=JSON.stringify(t.data,null,2)),t=t.message+"\n"+t.data),e.isString(t)&&(t=new Error(t)),e.isFunction(n)&&n(t),e.isFunction(i)&&((r&&e.isFunction(r.listeners)&&r.listeners("error").length||e.isFunction(n))&&r.catch(function(){}),setTimeout(function(){i(t)},1)),r&&e.isFunction(r.emit)&&setTimeout(function(){r.emit("error",t),r.removeAllListeners()},1),r},_jsonInterfaceMethodToString:function(t){if(e.isObject(t)&&t.name&&-1!==t.name.indexOf("("))return t.name;var r=t.inputs.map(function(t){return t.type}).join(",");return t.name+"("+r+")"},randomHex:h,_:e,BN:o.BN,isBN:o.isBN,isBigNumber:o.isBigNumber,isHex:o.isHex,isHexStrict:o.isHexStrict,sha3:o.sha3,keccak256:o.sha3,soliditySha3:s,isAddress:o.isAddress,checkAddressChecksum:o.checkAddressChecksum,toChecksumAddress:function(t){if(void 0===t)return"";if(!/^(0x)?[0-9a-f]{40}$/i.test(t))throw new Error('Given address "'+t+'" is not a valid Ethereum address.');t=t.toLowerCase().replace(/^0x/i,"");for(var r=o.sha3(t).replace(/^0x/i,""),i="0x",e=0;e<t.length;e++)parseInt(r[e],16)>7?i+=t[e].toUpperCase():i+=t[e];return i},toHex:o.toHex,toBN:o.toBN,bytesToHex:o.bytesToHex,hexToBytes:o.hexToBytes,hexToNumberString:o.hexToNumberString,hexToNumber:o.hexToNumber,toDecimal:o.hexToNumber,numberToHex:o.numberToHex,fromDecimal:o.numberToHex,hexToUtf8:o.hexToUtf8,hexToString:o.hexToUtf8,toUtf8:o.hexToUtf8,utf8ToHex:o.utf8ToHex,stringToHex:o.utf8ToHex,fromUtf8:o.utf8ToHex,hexToAscii:u,toAscii:u,asciiToHex:a,fromAscii:a,unitMap:n.unitMap,toWei:function(t,r){if(r=l(r),!o.isBN(t)&&!e.isString(t))throw new Error("Please pass numbers as strings or BigNumber objects to avoid precision errors.");return o.isBN(t)?n.toWei(t,r):n.toWei(t,r).toString(10)},fromWei:function(t,r){if(r=l(r),!o.isBN(t)&&!e.isString(t))throw new Error("Please pass numbers as strings or BigNumber objects to avoid precision errors.");return o.isBN(t)?n.fromWei(t,r):n.fromWei(t,r).toString(10)},padLeft:o.leftPad,leftPad:o.leftPad,padRight:o.rightPad,rightPad:o.rightPad,toTwosComplement:o.toTwosComplement}},function(t,r){var i="0123456789abcdef".split(""),e=[1,256,65536,16777216],n=[0,8,16,24],o=[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],s=function(t){var r,i,e,n,s,h,u,a,l,f,m,c,d,p,v,g,M,w,y,b,x,_,A,S,k,T,E,B,N,C,O,R,I,P,j,L,H,F,q,Z,U,z,D,W,$,G,Y,J,X,K,V,Q,tt,rt,it,et,nt,ot,st,ht,ut,at,lt;for(e=0;e<48;e+=2)n=t[0]^t[10]^t[20]^t[30]^t[40],s=t[1]^t[11]^t[21]^t[31]^t[41],h=t[2]^t[12]^t[22]^t[32]^t[42],u=t[3]^t[13]^t[23]^t[33]^t[43],a=t[4]^t[14]^t[24]^t[34]^t[44],l=t[5]^t[15]^t[25]^t[35]^t[45],f=t[6]^t[16]^t[26]^t[36]^t[46],m=t[7]^t[17]^t[27]^t[37]^t[47],r=(c=t[8]^t[18]^t[28]^t[38]^t[48])^(h<<1|u>>>31),i=(d=t[9]^t[19]^t[29]^t[39]^t[49])^(u<<1|h>>>31),t[0]^=r,t[1]^=i,t[10]^=r,t[11]^=i,t[20]^=r,t[21]^=i,t[30]^=r,t[31]^=i,t[40]^=r,t[41]^=i,r=n^(a<<1|l>>>31),i=s^(l<<1|a>>>31),t[2]^=r,t[3]^=i,t[12]^=r,t[13]^=i,t[22]^=r,t[23]^=i,t[32]^=r,t[33]^=i,t[42]^=r,t[43]^=i,r=h^(f<<1|m>>>31),i=u^(m<<1|f>>>31),t[4]^=r,t[5]^=i,t[14]^=r,t[15]^=i,t[24]^=r,t[25]^=i,t[34]^=r,t[35]^=i,t[44]^=r,t[45]^=i,r=a^(c<<1|d>>>31),i=l^(d<<1|c>>>31),t[6]^=r,t[7]^=i,t[16]^=r,t[17]^=i,t[26]^=r,t[27]^=i,t[36]^=r,t[37]^=i,t[46]^=r,t[47]^=i,r=f^(n<<1|s>>>31),i=m^(s<<1|n>>>31),t[8]^=r,t[9]^=i,t[18]^=r,t[19]^=i,t[28]^=r,t[29]^=i,t[38]^=r,t[39]^=i,t[48]^=r,t[49]^=i,p=t[0],v=t[1],G=t[11]<<4|t[10]>>>28,Y=t[10]<<4|t[11]>>>28,B=t[20]<<3|t[21]>>>29,N=t[21]<<3|t[20]>>>29,ht=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,z=t[40]<<18|t[41]>>>14,D=t[41]<<18|t[40]>>>14,P=t[2]<<1|t[3]>>>31,j=t[3]<<1|t[2]>>>31,g=t[13]<<12|t[12]>>>20,M=t[12]<<12|t[13]>>>20,J=t[22]<<10|t[23]>>>22,X=t[23]<<10|t[22]>>>22,C=t[33]<<13|t[32]>>>19,O=t[32]<<13|t[33]>>>19,at=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,rt=t[5]<<30|t[4]>>>2,it=t[4]<<30|t[5]>>>2,L=t[14]<<6|t[15]>>>26,H=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,y=t[24]<<11|t[25]>>>21,K=t[34]<<15|t[35]>>>17,V=t[35]<<15|t[34]>>>17,R=t[45]<<29|t[44]>>>3,I=t[44]<<29|t[45]>>>3,S=t[6]<<28|t[7]>>>4,k=t[7]<<28|t[6]>>>4,et=t[17]<<23|t[16]>>>9,nt=t[16]<<23|t[17]>>>9,F=t[26]<<25|t[27]>>>7,q=t[27]<<25|t[26]>>>7,b=t[36]<<21|t[37]>>>11,x=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,W=t[8]<<27|t[9]>>>5,$=t[9]<<27|t[8]>>>5,T=t[18]<<20|t[19]>>>12,E=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,Z=t[38]<<8|t[39]>>>24,U=t[39]<<8|t[38]>>>24,_=t[48]<<14|t[49]>>>18,A=t[49]<<14|t[48]>>>18,t[0]=p^~g&w,t[1]=v^~M&y,t[10]=S^~T&B,t[11]=k^~E&N,t[20]=P^~L&F,t[21]=j^~H&q,t[30]=W^~G&J,t[31]=$^~Y&X,t[40]=rt^~et&ot,t[41]=it^~nt&st,t[2]=g^~w&b,t[3]=M^~y&x,t[12]=T^~B&C,t[13]=E^~N&O,t[22]=L^~F&Z,t[23]=H^~q&U,t[32]=G^~J&K,t[33]=Y^~X&V,t[42]=et^~ot&ht,t[43]=nt^~st&ut,t[4]=w^~b&_,t[5]=y^~x&A,t[14]=B^~C&R,t[15]=N^~O&I,t[24]=F^~Z&z,t[25]=q^~U&D,t[34]=J^~K&Q,t[35]=X^~V&tt,t[44]=ot^~ht&at,t[45]=st^~ut&lt,t[6]=b^~_&p,t[7]=x^~A&v,t[16]=C^~R&S,t[17]=O^~I&k,t[26]=Z^~z&P,t[27]=U^~D&j,t[36]=K^~Q&W,t[37]=V^~tt&$,t[46]=ht^~at&rt,t[47]=ut^~lt&it,t[8]=_^~p&g,t[9]=A^~v&M,t[18]=R^~S&T,t[19]=I^~k&E,t[28]=z^~P&L,t[29]=D^~j&H,t[38]=Q^~W&G,t[39]=tt^~$&Y,t[48]=at^~rt&et,t[49]=lt^~it&nt,t[0]^=o[e],t[1]^=o[e+1]},h=function(t){return function(r){var o;if("0x"===r.slice(0,2)){o=[];for(var h=2,u=r.length;h<u;h+=2)o.push(parseInt(r.slice(h,h+2),16))}else o=r;return function(t,r){for(var o,h=r.length,u=t.blocks,a=t.blockCount<<2,l=t.blockCount,f=t.outputBlocks,m=t.s,c=0;c<h;){if(t.reset)for(t.reset=!1,u[0]=t.block,v=1;v<l+1;++v)u[v]=0;if("string"!=typeof r)for(v=t.start;c<h&&v<a;++c)u[v>>2]|=r[c]<<n[3&v++];else for(v=t.start;c<h&&v<a;++c)(o=r.charCodeAt(c))<128?u[v>>2]|=o<<n[3&v++]:o<2048?(u[v>>2]|=(192|o>>6)<<n[3&v++],u[v>>2]|=(128|63&o)<<n[3&v++]):o<55296||o>=57344?(u[v>>2]|=(224|o>>12)<<n[3&v++],u[v>>2]|=(128|o>>6&63)<<n[3&v++],u[v>>2]|=(128|63&o)<<n[3&v++]):(o=65536+((1023&o)<<10|1023&r.charCodeAt(++c)),u[v>>2]|=(240|o>>18)<<n[3&v++],u[v>>2]|=(128|o>>12&63)<<n[3&v++],u[v>>2]|=(128|o>>6&63)<<n[3&v++],u[v>>2]|=(128|63&o)<<n[3&v++]);if(t.lastByteIndex=v,v>=a){for(t.start=v-a,t.block=u[l],v=0;v<l;++v)m[v]^=u[v];s(m),t.reset=!0}else t.start=v}if(u[(v=t.lastByteIndex)>>2]|=e[3&v],t.lastByteIndex===a)for(u[0]=u[l],v=1;v<l+1;++v)u[v]=0;for(u[l-1]|=2147483648,v=0;v<l;++v)m[v]^=u[v];s(m);for(var d,p="",v=0,g=0;g<f;){for(v=0;v<l&&g<f;++v,++g)d=m[v],p+=i[d>>4&15]+i[15&d]+i[d>>12&15]+i[d>>8&15]+i[d>>20&15]+i[d>>16&15]+i[d>>28&15]+i[d>>24&15];g%l==0&&(s(m),v=0)}return"0x"+p}(function(t){return{blocks:[],reset:!0,block:0,start:0,blockCount:1600-(t<<1)>>5,outputBlocks:t>>5,s:(r=[0,0,0,0,0,0,0,0,0,0],[].concat(r,r,r,r,r))};var r}(t),o)}};t.exports={keccak256:h(256),keccak512:h(512),keccak256s:h(256),keccak512s:h(512)}},function(t,r,i){var e=i(0),n=i(23),o=i(22),s=function(t){var r=typeof t;if("string"===r)return o.isHexStrict(t)?new n(t.replace(/0x/i,""),16):new n(t,10);if("number"===r)return new n(t);if(o.isBigNumber(t))return new n(t.toString(10));if(o.isBN(t))return t;throw new Error(t+" is not a number")},h=function(t,r,i){var e,h;if("bytes"===(t=function(t){return t.startsWith("int[")?"int256"+t.slice(3):"int"===t?"int256":t.startsWith("uint[")?"uint256"+t.slice(4):"uint"===t?"uint256":t.startsWith("fixed[")?"fixed128x128"+t.slice(5):"fixed"===t?"fixed128x128":t.startsWith("ufixed[")?"ufixed128x128"+t.slice(6):"ufixed"===t?"ufixed128x128":t}(t))){if(r.replace(/^0x/i,"").length%2!=0)throw new Error("Invalid bytes characters "+r.length);return r}if("string"===t)return o.utf8ToHex(r);if("bool"===t)return r?"01":"00";if(t.startsWith("address")){if(e=i?64:40,!o.isAddress(r))throw new Error(r+" is not a valid address, or the checksum is invalid.");return o.leftPad(r.toLowerCase(),e)}if(e=function(t){var r=/^\D+(\d+).*$/.exec(t);return r?parseInt(r[1],10):null}(t),t.startsWith("bytes")){if(!e)throw new Error("bytes[] not yet supported in solidity");if(i&&(e=32),e<1||e>32||e<r.replace(/^0x/i,"").length/2)throw new Error("Invalid bytes"+e+" for "+r);return o.rightPad(r,2*e)}if(t.startsWith("uint")){if(e%8||e<8||e>256)throw new Error("Invalid uint"+e+" size");if((h=s(r)).bitLength()>e)throw new Error("Supplied uint exceeds width: "+e+" vs "+h.bitLength());if(h.lt(new n(0)))throw new Error("Supplied uint "+h.toString()+" is negative");return e?o.leftPad(h.toString("hex"),e/8*2):h}if(t.startsWith("int")){if(e%8||e<8||e>256)throw new Error("Invalid int"+e+" size");if((h=s(r)).bitLength()>e)throw new Error("Supplied int exceeds width: "+e+" vs "+h.bitLength());return h.lt(new n(0))?h.toTwos(e).toString("hex"):e?o.leftPad(h.toString("hex"),e/8*2):h}throw new Error("Unsupported or invalid type: "+t)},u=function(t){if(e.isArray(t))throw new Error("Autodetection of array types is not supported.");var r,i,s="";if(e.isObject(t)&&(t.hasOwnProperty("v")||t.hasOwnProperty("t")||t.hasOwnProperty("value")||t.hasOwnProperty("type"))?(r=t.hasOwnProperty("t")?t.t:t.type,s=t.hasOwnProperty("v")?t.v:t.value):(r=o.toHex(t,!0),s=o.toHex(t),r.startsWith("int")||r.startsWith("uint")||(r="bytes")),!r.startsWith("int")&&!r.startsWith("uint")||"string"!=typeof s||/^(-)?0x/i.test(s)||(s=new n(s)),e.isArray(s)){if((i=function(t){var r=/^\D+\d*\[(\d+)\]$/.exec(t);return r?parseInt(r[1],10):null}(r))&&s.length!==i)throw new Error(r+" is not matching the given array "+JSON.stringify(s));i=s.length}return e.isArray(s)?s.map(function(t){return h(r,t,i).toString("hex").replace("0x","")}).join(""):h(r,s,i).toString("hex").replace("0x","")};t.exports=function(){var t=Array.prototype.slice.call(arguments),r=e.map(t,u);return o.sha3("0x"+r.join(""))}},function(t,r,i){"use strict";var e=i(65),n=i(12),o=function(t){var r="A".charCodeAt(0),i="Z".charCodeAt(0);return(t=(t=t.toUpperCase()).substr(4)+t.substr(0,4)).split("").map(function(t){var e=t.charCodeAt(0);return e>=r&&e<=i?e-r+10:t}).join("")},s=function(t){for(var r,i=t;i.length>2;)r=i.slice(0,9),i=parseInt(r,10)%97+i.slice(r.length);return parseInt(i,10)%97},h=function(t){this._iban=t};h.toAddress=function(t){if(!(t=new h(t)).isDirect())throw new Error("IBAN is indirect and can't be converted");return t.toAddress()},h.toIban=function(t){return h.fromAddress(t).toString()},h.fromAddress=function(t){if(!e.isAddress(t))throw new Error("Provided address is not a valid address: "+t);t=t.replace("0x","").replace("0X","");var r=function(t,r){for(var i=t;i.length<2*r;)i="0"+i;return i}(new n(t,16).toString(36),15);return h.fromBban(r.toUpperCase())},h.fromBban=function(t){var r=("0"+(98-s(o("XE00"+t)))).slice(-2);return new h("XE"+r+t)},h.createIndirect=function(t){return h.fromBban("ETH"+t.institution+t.identifier)},h.isValid=function(t){return new h(t).isValid()},h.prototype.isValid=function(){return/^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(this._iban)&&1===s(o(this._iban))},h.prototype.isDirect=function(){return 34===this._iban.length||35===this._iban.length},h.prototype.isIndirect=function(){return 20===this._iban.length},h.prototype.checksum=function(){return this._iban.substr(2,2)},h.prototype.institution=function(){return this.isIndirect()?this._iban.substr(7,4):""},h.prototype.client=function(){return this.isIndirect()?this._iban.substr(11):""},h.prototype.toAddress=function(){if(this.isDirect()){var t=this._iban.substr(4),r=new n(t,36);return e.toChecksumAddress(r.toString(16,20))}return""},h.prototype.toString=function(){return this._iban},t.exports=h},function(t,r,i){var e=i(0),n=i(7),o=i(24),s=i(67),h=i(9),u=function(t){if(!o.isHexStrict(t))throw new Error("The parameter must be a valid HEX string.");var r="",i=0,e=t.length;for("0x"===t.substring(0,2)&&(i=2);i<e;i+=2){var n=parseInt(t.substr(i,2),16);r+=String.fromCharCode(n)}return r},a=function(t){if(!t)return"0x00";for(var r="",i=0;i<t.length;i++){var e=t.charCodeAt(i).toString(16);r+=e.length<2?"0"+e:e}return"0x"+r},l=function(t){if(t=t?t.toLowerCase():"ether",!n.unitMap[t])throw new Error('This unit "'+t+"\" doesn't exist, please use the one of the following units"+JSON.stringify(n.unitMap,null,2));return t};t.exports={_fireError:function(t,r,i,n){return!e.isObject(t)||t instanceof Error||!t.data||((e.isObject(t.data)||e.isArray(t.data))&&(t.data=JSON.stringify(t.data,null,2)),t=t.message+"\n"+t.data),e.isString(t)&&(t=new Error(t)),e.isFunction(n)&&n(t),e.isFunction(i)&&((r&&e.isFunction(r.listeners)&&r.listeners("error").length||e.isFunction(n))&&r.catch(function(){}),setTimeout(function(){i(t)},1)),r&&e.isFunction(r.emit)&&setTimeout(function(){r.emit("error",t),r.removeAllListeners()},1),r},_jsonInterfaceMethodToString:function(t){if(e.isObject(t)&&t.name&&-1!==t.name.indexOf("("))return t.name;var r=t.inputs.map(function(t){return t.type}).join(",");return t.name+"("+r+")"},randomHex:h,_:e,BN:o.BN,isBN:o.isBN,isBigNumber:o.isBigNumber,isHex:o.isHex,isHexStrict:o.isHexStrict,sha3:o.sha3,keccak256:o.sha3,soliditySha3:s,isAddress:o.isAddress,checkAddressChecksum:o.checkAddressChecksum,toChecksumAddress:function(t){if(void 0===t)return"";if(!/^(0x)?[0-9a-f]{40}$/i.test(t))throw new Error('Given address "'+t+'" is not a valid Ethereum address.');t=t.toLowerCase().replace(/^0x/i,"");for(var r=o.sha3(t).replace(/^0x/i,""),i="0x",e=0;e<t.length;e++)parseInt(r[e],16)>7?i+=t[e].toUpperCase():i+=t[e];return i},toHex:o.toHex,toBN:o.toBN,bytesToHex:o.bytesToHex,hexToBytes:o.hexToBytes,hexToNumberString:o.hexToNumberString,hexToNumber:o.hexToNumber,toDecimal:o.hexToNumber,numberToHex:o.numberToHex,fromDecimal:o.numberToHex,hexToUtf8:o.hexToUtf8,hexToString:o.hexToUtf8,toUtf8:o.hexToUtf8,utf8ToHex:o.utf8ToHex,stringToHex:o.utf8ToHex,fromUtf8:o.utf8ToHex,hexToAscii:u,toAscii:u,asciiToHex:a,fromAscii:a,unitMap:n.unitMap,toWei:function(t,r){if(r=l(r),!o.isBN(t)&&!e.isString(t))throw new Error("Please pass numbers as strings or BigNumber objects to avoid precision errors.");return o.isBN(t)?n.toWei(t,r):n.toWei(t,r).toString(10)},fromWei:function(t,r){if(r=l(r),!o.isBN(t)&&!e.isString(t))throw new Error("Please pass numbers as strings or BigNumber objects to avoid precision errors.");return o.isBN(t)?n.fromWei(t,r):n.fromWei(t,r).toString(10)},padLeft:o.leftPad,leftPad:o.leftPad,padRight:o.rightPad,rightPad:o.rightPad,toTwosComplement:o.toTwosComplement}},function(t,r){var i="0123456789abcdef".split(""),e=[1,256,65536,16777216],n=[0,8,16,24],o=[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],s=function(t){var r,i,e,n,s,h,u,a,l,f,m,c,d,p,v,g,M,w,y,b,x,_,A,S,k,T,E,B,N,C,O,R,I,P,j,L,H,F,q,Z,U,z,D,W,$,G,Y,J,X,K,V,Q,tt,rt,it,et,nt,ot,st,ht,ut,at,lt;for(e=0;e<48;e+=2)n=t[0]^t[10]^t[20]^t[30]^t[40],s=t[1]^t[11]^t[21]^t[31]^t[41],h=t[2]^t[12]^t[22]^t[32]^t[42],u=t[3]^t[13]^t[23]^t[33]^t[43],a=t[4]^t[14]^t[24]^t[34]^t[44],l=t[5]^t[15]^t[25]^t[35]^t[45],f=t[6]^t[16]^t[26]^t[36]^t[46],m=t[7]^t[17]^t[27]^t[37]^t[47],r=(c=t[8]^t[18]^t[28]^t[38]^t[48])^(h<<1|u>>>31),i=(d=t[9]^t[19]^t[29]^t[39]^t[49])^(u<<1|h>>>31),t[0]^=r,t[1]^=i,t[10]^=r,t[11]^=i,t[20]^=r,t[21]^=i,t[30]^=r,t[31]^=i,t[40]^=r,t[41]^=i,r=n^(a<<1|l>>>31),i=s^(l<<1|a>>>31),t[2]^=r,t[3]^=i,t[12]^=r,t[13]^=i,t[22]^=r,t[23]^=i,t[32]^=r,t[33]^=i,t[42]^=r,t[43]^=i,r=h^(f<<1|m>>>31),i=u^(m<<1|f>>>31),t[4]^=r,t[5]^=i,t[14]^=r,t[15]^=i,t[24]^=r,t[25]^=i,t[34]^=r,t[35]^=i,t[44]^=r,t[45]^=i,r=a^(c<<1|d>>>31),i=l^(d<<1|c>>>31),t[6]^=r,t[7]^=i,t[16]^=r,t[17]^=i,t[26]^=r,t[27]^=i,t[36]^=r,t[37]^=i,t[46]^=r,t[47]^=i,r=f^(n<<1|s>>>31),i=m^(s<<1|n>>>31),t[8]^=r,t[9]^=i,t[18]^=r,t[19]^=i,t[28]^=r,t[29]^=i,t[38]^=r,t[39]^=i,t[48]^=r,t[49]^=i,p=t[0],v=t[1],G=t[11]<<4|t[10]>>>28,Y=t[10]<<4|t[11]>>>28,B=t[20]<<3|t[21]>>>29,N=t[21]<<3|t[20]>>>29,ht=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,z=t[40]<<18|t[41]>>>14,D=t[41]<<18|t[40]>>>14,P=t[2]<<1|t[3]>>>31,j=t[3]<<1|t[2]>>>31,g=t[13]<<12|t[12]>>>20,M=t[12]<<12|t[13]>>>20,J=t[22]<<10|t[23]>>>22,X=t[23]<<10|t[22]>>>22,C=t[33]<<13|t[32]>>>19,O=t[32]<<13|t[33]>>>19,at=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,rt=t[5]<<30|t[4]>>>2,it=t[4]<<30|t[5]>>>2,L=t[14]<<6|t[15]>>>26,H=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,y=t[24]<<11|t[25]>>>21,K=t[34]<<15|t[35]>>>17,V=t[35]<<15|t[34]>>>17,R=t[45]<<29|t[44]>>>3,I=t[44]<<29|t[45]>>>3,S=t[6]<<28|t[7]>>>4,k=t[7]<<28|t[6]>>>4,et=t[17]<<23|t[16]>>>9,nt=t[16]<<23|t[17]>>>9,F=t[26]<<25|t[27]>>>7,q=t[27]<<25|t[26]>>>7,b=t[36]<<21|t[37]>>>11,x=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,W=t[8]<<27|t[9]>>>5,$=t[9]<<27|t[8]>>>5,T=t[18]<<20|t[19]>>>12,E=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,Z=t[38]<<8|t[39]>>>24,U=t[39]<<8|t[38]>>>24,_=t[48]<<14|t[49]>>>18,A=t[49]<<14|t[48]>>>18,t[0]=p^~g&w,t[1]=v^~M&y,t[10]=S^~T&B,t[11]=k^~E&N,t[20]=P^~L&F,t[21]=j^~H&q,t[30]=W^~G&J,t[31]=$^~Y&X,t[40]=rt^~et&ot,t[41]=it^~nt&st,t[2]=g^~w&b,t[3]=M^~y&x,t[12]=T^~B&C,t[13]=E^~N&O,t[22]=L^~F&Z,t[23]=H^~q&U,t[32]=G^~J&K,t[33]=Y^~X&V,t[42]=et^~ot&ht,t[43]=nt^~st&ut,t[4]=w^~b&_,t[5]=y^~x&A,t[14]=B^~C&R,t[15]=N^~O&I,t[24]=F^~Z&z,t[25]=q^~U&D,t[34]=J^~K&Q,t[35]=X^~V&tt,t[44]=ot^~ht&at,t[45]=st^~ut&lt,t[6]=b^~_&p,t[7]=x^~A&v,t[16]=C^~R&S,t[17]=O^~I&k,t[26]=Z^~z&P,t[27]=U^~D&j,t[36]=K^~Q&W,t[37]=V^~tt&$,t[46]=ht^~at&rt,t[47]=ut^~lt&it,t[8]=_^~p&g,t[9]=A^~v&M,t[18]=R^~S&T,t[19]=I^~k&E,t[28]=z^~P&L,t[29]=D^~j&H,t[38]=Q^~W&G,t[39]=tt^~$&Y,t[48]=at^~rt&et,t[49]=lt^~it&nt,t[0]^=o[e],t[1]^=o[e+1]},h=function(t){return function(r){var o;if("0x"===r.slice(0,2)){o=[];for(var h=2,u=r.length;h<u;h+=2)o.push(parseInt(r.slice(h,h+2),16))}else o=r;return function(t,r){for(var o,h=r.length,u=t.blocks,a=t.blockCount<<2,l=t.blockCount,f=t.outputBlocks,m=t.s,c=0;c<h;){if(t.reset)for(t.reset=!1,u[0]=t.block,v=1;v<l+1;++v)u[v]=0;if("string"!=typeof r)for(v=t.start;c<h&&v<a;++c)u[v>>2]|=r[c]<<n[3&v++];else for(v=t.start;c<h&&v<a;++c)(o=r.charCodeAt(c))<128?u[v>>2]|=o<<n[3&v++]:o<2048?(u[v>>2]|=(192|o>>6)<<n[3&v++],u[v>>2]|=(128|63&o)<<n[3&v++]):o<55296||o>=57344?(u[v>>2]|=(224|o>>12)<<n[3&v++],u[v>>2]|=(128|o>>6&63)<<n[3&v++],u[v>>2]|=(128|63&o)<<n[3&v++]):(o=65536+((1023&o)<<10|1023&r.charCodeAt(++c)),u[v>>2]|=(240|o>>18)<<n[3&v++],u[v>>2]|=(128|o>>12&63)<<n[3&v++],u[v>>2]|=(128|o>>6&63)<<n[3&v++],u[v>>2]|=(128|63&o)<<n[3&v++]);if(t.lastByteIndex=v,v>=a){for(t.start=v-a,t.block=u[l],v=0;v<l;++v)m[v]^=u[v];s(m),t.reset=!0}else t.start=v}if(u[(v=t.lastByteIndex)>>2]|=e[3&v],t.lastByteIndex===a)for(u[0]=u[l],v=1;v<l+1;++v)u[v]=0;for(u[l-1]|=2147483648,v=0;v<l;++v)m[v]^=u[v];s(m);for(var d,p="",v=0,g=0;g<f;){for(v=0;v<l&&g<f;++v,++g)d=m[v],p+=i[d>>4&15]+i[15&d]+i[d>>12&15]+i[d>>8&15]+i[d>>20&15]+i[d>>16&15]+i[d>>28&15]+i[d>>24&15];g%l==0&&(s(m),v=0)}return"0x"+p}(function(t){return{blocks:[],reset:!0,block:0,start:0,blockCount:1600-(t<<1)>>5,outputBlocks:t>>5,s:(r=[0,0,0,0,0,0,0,0,0,0],[].concat(r,r,r,r,r))};var r}(t),o)}};t.exports={keccak256:h(256),keccak512:h(512),keccak256s:h(256),keccak512s:h(512)}},function(t,r,i){var e=i(0),n=i(12),o=i(24),s=function(t){var r=typeof t;if("string"===r)return o.isHexStrict(t)?new n(t.replace(/0x/i,""),16):new n(t,10);if("number"===r)return new n(t);if(o.isBigNumber(t))return new n(t.toString(10));if(o.isBN(t))return t;throw new Error(t+" is not a number")},h=function(t,r,i){var e,h;if("bytes"===(t=function(t){return t.startsWith("int[")?"int256"+t.slice(3):"int"===t?"int256":t.startsWith("uint[")?"uint256"+t.slice(4):"uint"===t?"uint256":t.startsWith("fixed[")?"fixed128x128"+t.slice(5):"fixed"===t?"fixed128x128":t.startsWith("ufixed[")?"ufixed128x128"+t.slice(6):"ufixed"===t?"ufixed128x128":t}(t))){if(r.replace(/^0x/i,"").length%2!=0)throw new Error("Invalid bytes characters "+r.length);return r}if("string"===t)return o.utf8ToHex(r);if("bool"===t)return r?"01":"00";if(t.startsWith("address")){if(e=i?64:40,!o.isAddress(r))throw new Error(r+" is not a valid address, or the checksum is invalid.");return o.leftPad(r.toLowerCase(),e)}if(e=function(t){var r=/^\D+(\d+).*$/.exec(t);return r?parseInt(r[1],10):null}(t),t.startsWith("bytes")){if(!e)throw new Error("bytes[] not yet supported in solidity");if(i&&(e=32),e<1||e>32||e<r.replace(/^0x/i,"").length/2)throw new Error("Invalid bytes"+e+" for "+r);return o.rightPad(r,2*e)}if(t.startsWith("uint")){if(e%8||e<8||e>256)throw new Error("Invalid uint"+e+" size");if((h=s(r)).bitLength()>e)throw new Error("Supplied uint exceeds width: "+e+" vs "+h.bitLength());if(h.lt(new n(0)))throw new Error("Supplied uint "+h.toString()+" is negative");return e?o.leftPad(h.toString("hex"),e/8*2):h}if(t.startsWith("int")){if(e%8||e<8||e>256)throw new Error("Invalid int"+e+" size");if((h=s(r)).bitLength()>e)throw new Error("Supplied int exceeds width: "+e+" vs "+h.bitLength());return h.lt(new n(0))?h.toTwos(e).toString("hex"):e?o.leftPad(h.toString("hex"),e/8*2):h}throw new Error("Unsupported or invalid type: "+t)},u=function(t){if(e.isArray(t))throw new Error("Autodetection of array types is not supported.");var r,i,s="";if(e.isObject(t)&&(t.hasOwnProperty("v")||t.hasOwnProperty("t")||t.hasOwnProperty("value")||t.hasOwnProperty("type"))?(r=t.hasOwnProperty("t")?t.t:t.type,s=t.hasOwnProperty("v")?t.v:t.value):(r=o.toHex(t,!0),s=o.toHex(t),r.startsWith("int")||r.startsWith("uint")||(r="bytes")),!r.startsWith("int")&&!r.startsWith("uint")||"string"!=typeof s||/^(-)?0x/i.test(s)||(s=new n(s)),e.isArray(s)){if((i=function(t){var r=/^\D+\d*\[(\d+)\]$/.exec(t);return r?parseInt(r[1],10):null}(r))&&s.length!==i)throw new Error(r+" is not matching the given array "+JSON.stringify(s));i=s.length}return e.isArray(s)?s.map(function(t){return h(r,t,i).toString("hex").replace("0x","")}).join(""):h(r,s,i).toString("hex").replace("0x","")};t.exports=function(){var t=Array.prototype.slice.call(arguments),r=e.map(t,u);return o.sha3("0x"+r.join(""))}},function(t,r,i){var e=i(1),n=i(4),o=function(){this._inputFormatter=e.formatInputBool,this._outputFormatter=e.formatOutputBool};(o.prototype=new n({})).constructor=o,o.prototype.isType=function(t){return!!t.match(/^bool(\[([0-9]*)\])*$/)},t.exports=o},function(t,r,i){var e=i(1),n=i(4),o=function(){this._inputFormatter=e.formatInputInt,this._outputFormatter=e.formatOutputInt};(o.prototype=new n({})).constructor=o,o.prototype.isType=function(t){return!!t.match(/^int([0-9]*)?(\[([0-9]*)\])*$/)},t.exports=o},function(t,r,i){var e=i(1),n=i(4),o=function(){this._inputFormatter=e.formatInputInt,this._outputFormatter=e.formatOutputUInt};(o.prototype=new n({})).constructor=o,o.prototype.isType=function(t){return!!t.match(/^uint([0-9]*)?(\[([0-9]*)\])*$/)},t.exports=o},function(t,r,i){var e=i(1),n=i(4),o=function(){this._inputFormatter=e.formatInputDynamicBytes,this._outputFormatter=e.formatOutputDynamicBytes};(o.prototype=new n({})).constructor=o,o.prototype.isType=function(t){return!!t.match(/^bytes(\[([0-9]*)\])*$/)},o.prototype.isDynamicType=function(){return!0},t.exports=o},function(t,r,i){var e=i(1),n=i(4),o=function(){this._inputFormatter=e.formatInputString,this._outputFormatter=e.formatOutputString};(o.prototype=new n({})).constructor=o,o.prototype.isType=function(t){return!!t.match(/^string(\[([0-9]*)\])*$/)},o.prototype.isDynamicType=function(){return!0},t.exports=o},function(t,r,i){var e=i(1),n=i(4),o=function(){this._inputFormatter=e.formatInputBytes,this._outputFormatter=e.formatOutputBytes};(o.prototype=new n({})).constructor=o,o.prototype.isType=function(t){return!!t.match(/^bytes([0-9]{1,})(\[([0-9]*)\])*$/)},t.exports=o}]);